UNPKG

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