UNPKG

12.1 kBJavaScriptView Raw
1/*
2 * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5 * the License. A copy of the License is located at
6 *
7 * http://aws.amazon.com/apache2.0/
8 *
9 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11 * and limitations under the License.
12 */
13var __assign = (this && this.__assign) || function () {
14 __assign = Object.assign || function(t) {
15 for (var s, i = 1, n = arguments.length; i < n; i++) {
16 s = arguments[i];
17 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
18 t[p] = s[p];
19 }
20 return t;
21 };
22 return __assign.apply(this, arguments);
23};
24import * as React from 'react';
25import { objectLessAttributes } from '@aws-amplify/core';
26import AmplifyTheme from './AmplifyTheme';
27export var Container = function (props) {
28 var theme = props.theme || AmplifyTheme;
29 var style = propStyle(props, theme.container);
30 var p = objectLessAttributes(props, 'theme');
31 return beforeAfter(React.createElement("div", __assign({}, p, { className: "amplify-container", style: style }), props.children));
32};
33export var FormContainer = function (props) {
34 var theme = props.theme || AmplifyTheme;
35 var style = propStyle(props, theme.formContainer);
36 return beforeAfter(React.createElement("div", { className: "amplify-form-container", style: style }, props.children));
37};
38export var FormSection = function (props) {
39 var theme = props.theme || AmplifyTheme;
40 var style = propStyle(props, theme.formSection);
41 return (React.createElement(FormContainer, { theme: theme }, beforeAfter(React.createElement("div", { className: "amplify-form-section", style: style }, props.children))));
42};
43export var ErrorSection = function (props) {
44 var theme = props.theme || AmplifyTheme;
45 var style = propStyle(props, theme.errorSection);
46 var p = objectLessAttributes(props, 'theme');
47 return beforeAfter(React.createElement("div", __assign({}, p, { className: "amplify-error-section", style: style }),
48 React.createElement(ErrorSectionContent, null, props.children)));
49};
50export var ErrorSectionContent = function (props) {
51 var theme = props.theme || AmplifyTheme;
52 var style = propStyle(props, theme.errorSectionContent);
53 return beforeAfter(React.createElement("span", { className: "amplify-error-section-content", style: style }, props.children));
54};
55export var SectionHeader = function (props) {
56 var theme = props.theme || AmplifyTheme;
57 var style = propStyle(props, theme.sectionHeader);
58 var p = objectLessAttributes(props, 'theme');
59 return beforeAfter(React.createElement("div", __assign({}, p, { className: "amplify-section-header", style: style }),
60 React.createElement(SectionHeaderContent, { theme: theme }, props.children)));
61};
62export var SectionHeaderContent = function (props) {
63 var theme = props.theme || AmplifyTheme;
64 var style = propStyle(props, theme.sectionHeaderContent);
65 return beforeAfter(React.createElement("span", { className: "amplify-section-header-content", style: style }, props.children));
66};
67export var SectionFooter = function (props) {
68 var theme = props.theme || AmplifyTheme;
69 var style = propStyle(props, theme.sectionFooter);
70 var p = objectLessAttributes(props, 'theme');
71 return beforeAfter(React.createElement("div", __assign({}, p, { className: "amplify-section-footer", style: style }),
72 React.createElement(SectionFooterContent, { theme: theme }, props.children)));
73};
74export var SectionFooterContent = function (props) {
75 var theme = props.theme || AmplifyTheme;
76 var style = propStyle(props, theme.sectionFooterContent);
77 return beforeAfter(React.createElement("span", { className: "amplify-section-footer-content", style: style }, props.children));
78};
79export var SectionBody = function (props) {
80 var theme = props.theme || AmplifyTheme;
81 var style = propStyle(props, theme.sectionBody);
82 var p = objectLessAttributes(props, 'theme');
83 return beforeAfter(React.createElement("div", __assign({}, p, { className: "amplify-section-body", style: style }), props.children));
84};
85export var ActionRow = function (props) {
86 var theme = props.theme || AmplifyTheme;
87 var style = propStyle(props, theme.actionRow);
88 var p = objectLessAttributes(props, 'theme');
89 return beforeAfter(React.createElement("div", __assign({}, p, { className: "amplify-action-row", style: style }), props.children));
90};
91export var FormRow = function (props) {
92 var theme = props.theme || AmplifyTheme;
93 var style = propStyle(props, theme.formRow);
94 var p = objectLessAttributes(props, 'theme');
95 return beforeAfter(React.createElement("div", __assign({}, p, { className: "amplify-form-row", style: style }), props.children));
96};
97export var InputRow = function (props) {
98 var theme = props.theme || AmplifyTheme;
99 var style = propStyle(props, theme.input);
100 var p = objectLessAttributes(props, 'theme');
101 return (React.createElement(FormRow, { theme: theme }, beforeAfter(React.createElement("input", __assign({}, p, { className: "amplify-input", style: style })))));
102};
103export var RadioRow = function (props) {
104 var id = props.id || '_' + props.value;
105 var theme = props.theme || AmplifyTheme;
106 return (React.createElement(FormRow, { theme: theme },
107 React.createElement(Radio, __assign({}, props, { id: id })),
108 React.createElement(Label, { htmlFor: id, theme: theme }, props.placeholder)));
109};
110export var Radio = function (props) {
111 var theme = props.theme || AmplifyTheme;
112 var style = propStyle(props, theme.radio);
113 var p = objectLessAttributes(props, 'theme');
114 return beforeAfter(React.createElement("input", __assign({}, p, { type: "radio", className: "amplify-radio", style: style })));
115};
116export var CheckboxRow = function (props) {
117 var id = props.id || '_' + props.name;
118 var theme = props.theme || AmplifyTheme;
119 return (React.createElement(FormRow, { theme: theme },
120 React.createElement(Checkbox, __assign({}, props, { id: id })),
121 React.createElement(Label, { htmlFor: id, theme: theme }, props.placeholder)));
122};
123export var Checkbox = function (props) {
124 var theme = props.theme || AmplifyTheme;
125 var style = propStyle(props, theme.checkbox);
126 var p = objectLessAttributes(props, 'theme');
127 return beforeAfter(React.createElement("input", __assign({}, p, { type: "checkbox", className: "amplify-checkbox", style: style })));
128};
129export var MessageRow = function (props) {
130 var theme = props.theme || AmplifyTheme;
131 return (React.createElement(FormRow, { theme: theme },
132 React.createElement(MessageContent, { theme: theme }, props.children)));
133};
134export var MessageContent = function (props) {
135 var theme = props.theme || AmplifyTheme;
136 return beforeAfter(React.createElement("span", { className: "amplify-message-content", style: theme.messageContent }, props.children));
137};
138export var ButtonRow = function (props) {
139 var theme = props.theme || AmplifyTheme;
140 return beforeAfter(React.createElement("div", { className: "amplify-action-row", style: theme.actionRow },
141 React.createElement(Button, __assign({}, props))));
142};
143export var Button = function (props) {
144 var theme = props.theme || AmplifyTheme;
145 var style = propStyle(props, theme.button);
146 var p = objectLessAttributes(props, 'theme');
147 return beforeAfter(React.createElement("button", __assign({}, p, { className: "amplify-button", style: style }),
148 React.createElement(ButtonContent, { theme: theme }, props.children)));
149};
150export var ButtonContent = function (props) {
151 var theme = props.theme || AmplifyTheme;
152 return beforeAfter(React.createElement("span", { className: "amplify-button-content", style: theme.buttonContent }, props.children));
153};
154export var SignInButton = function (props) {
155 var theme = props.theme || AmplifyTheme;
156 var style = propStyle(props, theme.signInButton);
157 var p = objectLessAttributes(props, 'theme');
158 return beforeAfter(React.createElement("button", __assign({}, p, { className: "amplify-signin-button", style: style }), props.children));
159};
160export var Link = function (props) {
161 var theme = props.theme || AmplifyTheme;
162 var style = propStyle(props, theme.a);
163 var p = objectLessAttributes(props, 'theme');
164 return beforeAfter(React.createElement("a", __assign({}, p, { className: "amplify-a", style: style }), props.children));
165};
166export var Label = function (props) {
167 var theme = props.theme || AmplifyTheme;
168 var style = propStyle(props, theme.label);
169 var p = objectLessAttributes(props, 'theme');
170 return beforeAfter(React.createElement("label", __assign({}, p, { className: "amplify-label", style: style }), props.children));
171};
172export var Space = function (props) {
173 var theme = props.theme || AmplifyTheme;
174 var style = propStyle(props, theme.space);
175 var p = objectLessAttributes(props, 'theme');
176 return beforeAfter(React.createElement("span", __assign({}, p, { className: "amplify-space", style: style }), props.children));
177};
178export var NavBar = function (props) {
179 var theme = props.theme || AmplifyTheme;
180 var style = propStyle(props, theme.navBar);
181 var p = objectLessAttributes(props, 'theme');
182 return beforeAfter(React.createElement("div", __assign({}, p, { className: "amplify-nav-bar", style: style }), props.children));
183};
184export var Nav = function (props) {
185 var theme = props.theme || AmplifyTheme;
186 var style = propStyle(props, theme.nav);
187 var p = objectLessAttributes(props, 'theme');
188 return beforeAfter(React.createElement("div", __assign({}, p, { className: "amplify-nav", style: style }), props.children));
189};
190export var NavRight = function (props) {
191 var theme = props.theme || AmplifyTheme;
192 var style = propStyle(props, theme.navRight);
193 var p = objectLessAttributes(props, 'theme');
194 return beforeAfter(React.createElement("div", __assign({}, p, { className: "amplify-nav-right", style: style }), props.children));
195};
196export var NavItem = function (props) {
197 var theme = props.theme || AmplifyTheme;
198 var style = propStyle(props, theme.navItem);
199 var p = objectLessAttributes(props, 'theme');
200 return beforeAfter(React.createElement("div", __assign({}, p, { className: "amplify-nav-item", style: style }), props.children));
201};
202export var NavButton = function (props) {
203 var theme = props.theme || AmplifyTheme;
204 var style = propStyle(props, theme.navButton);
205 var p = objectLessAttributes(props, 'theme');
206 return beforeAfter(React.createElement("button", __assign({}, p, { className: "amplify-nav-button", style: style }), beforeAfter(React.createElement("span", { style: theme.navButtonContent }, props.children))));
207};
208export var beforeAfter = function (el) {
209 var style = el.props.style || {};
210 var before = style.before, after = style.after;
211 if (!before && !after) {
212 return el;
213 }
214 return (React.createElement("span", { style: { position: 'relative' } },
215 before ? React.createElement("span", { style: before }, before.content) : null,
216 el,
217 after ? React.createElement("span", { style: after }, after.content) : null));
218};
219export var propStyle = function (props, themeStyle) {
220 var id = props.id, style = props.style;
221 var styl = Object.assign({}, style, themeStyle);
222 if (!id) {
223 return styl;
224 }
225 var selector = '#' + id;
226 Object.assign(styl, styl[selector]);
227 return styl;
228};
229export var transparent1X1 = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
230export var white1X1 = 'data:image/gif;base64,R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
231//# sourceMappingURL=AmplifyUI.js.map
\No newline at end of file