@abgov/react-components 3.4.0-beta.8 → 4.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -97
- package/experimental/index.d.ts +0 -10
- package/experimental/package.json +1 -1
- package/experimental/react-components.esm.js +0 -1714
- package/experimental/react-components.umd.js +5 -1735
- package/index.d.ts +33 -16
- package/lib/app-header/app-header.d.ts +18 -0
- package/lib/badge/badge.d.ts +28 -0
- package/lib/button/button.d.ts +27 -35
- package/lib/button-group/button-group.d.ts +18 -0
- package/lib/callout/callout.d.ts +14 -23
- package/lib/card/card-actions.d.ts +16 -0
- package/lib/card/card-content.d.ts +13 -0
- package/lib/card/card-group.d.ts +16 -0
- package/lib/card/card-image.d.ts +18 -0
- package/lib/card/card.d.ts +18 -0
- package/lib/card/index.d.ts +5 -0
- package/lib/checkbox/checkbox.d.ts +27 -36
- package/lib/chip/chip.d.ts +23 -0
- package/lib/circular-progress/circular-progress.d.ts +29 -0
- package/lib/container/container.d.ts +23 -0
- package/lib/dropdown/dropdown-option.d.ts +21 -0
- package/lib/dropdown/dropdown.d.ts +37 -0
- package/lib/flex/index.d.ts +1 -0
- package/lib/flex/row.d.ts +7 -0
- package/lib/form/form-item.d.ts +22 -0
- package/lib/form/index.d.ts +1 -0
- package/lib/form/validators.d.ts +10 -0
- package/lib/hero-banner/hero-banner-actions.d.ts +4 -0
- package/lib/hero-banner/hero-banner.d.ts +18 -0
- package/lib/icons/icon-button.d.ts +27 -0
- package/lib/icons/icon.d.ts +37 -0
- package/lib/icons/index.d.ts +2 -0
- package/lib/input/input.d.ts +73 -0
- package/lib/microsite-header/microsite-header.d.ts +21 -0
- package/lib/modal/modal.d.ts +25 -0
- package/lib/notification/notification.d.ts +14 -35
- package/lib/page-block/page-block.d.ts +9 -0
- package/lib/radio-group/radio-group.d.ts +21 -44
- package/lib/radio-group/radio.d.ts +27 -0
- package/lib/skeleton/skeleton.d.ts +19 -0
- package/lib/spinner/spinner.d.ts +26 -0
- package/lib/textarea/textarea.d.ts +30 -0
- package/package.json +5 -4
- package/react-components.esm.js +755 -2355
- package/react-components.umd.js +815 -2397
- package/experimental/badge/badge.component.d.ts +0 -8
- package/experimental/common.d.ts +0 -3
- package/experimental/element-loader/element-loader.d.ts +0 -18
- package/experimental/form/form.actions.component.d.ts +0 -3
- package/experimental/form/form.component.d.ts +0 -10
- package/experimental/form/form.item.component.d.ts +0 -7
- package/experimental/form/formFieldValidator.d.ts +0 -4
- package/experimental/icons/icons.d.ts +0 -13
- package/experimental/input/input.component.d.ts +0 -15
- package/experimental/modal/modal.component.d.ts +0 -44
- package/experimental/scrollable/scrollable.component.d.ts +0 -12
- package/experimental/skeleton/skeleton-element.d.ts +0 -8
- package/experimental/skeleton/skeleton-grid-column.d.ts +0 -9
- package/experimental/skeleton/skeleton-image-content.d.ts +0 -9
- package/experimental/skeleton/skeleton-titled-content.d.ts +0 -9
- package/lib/card/card.component.d.ts +0 -26
- package/lib/card-group/card.group.component.d.ts +0 -24
- package/lib/dropdown/dropdown.component.d.ts +0 -59
- package/lib/dropdown/dropdown.context.d.ts +0 -17
- package/lib/dropdown/option/option.component.d.ts +0 -10
- package/lib/dropdown/option-group/option-group.component.d.ts +0 -6
- package/lib/header/header.d.ts +0 -10
- package/lib/hero-banner/content/hero-banner-content.component.d.ts +0 -7
- package/lib/hero-banner/hero-banner.component.d.ts +0 -11
- package/lib/hero-banner/link/hero-banner-link.component.d.ts +0 -8
- package/lib/microsite-logo/microsite-logo.d.ts +0 -8
- package/lib/page-loader/page-loader.d.ts +0 -43
- package/lib/radio-group/radio/radio.d.ts +0 -17
- package/lib/radio-group/radio-group.context.d.ts +0 -6
|
@@ -1,1738 +1,8 @@
|
|
|
1
|
-
(function (
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}(this, (function (exports, React, classnames) { 'use strict';
|
|
1
|
+
(function (factory) {
|
|
2
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
3
|
+
factory();
|
|
4
|
+
})((function () { 'use strict';
|
|
6
5
|
|
|
7
|
-
var React__default = 'default' in React ? React['default'] : React;
|
|
8
|
-
classnames = classnames && classnames.hasOwnProperty('default') ? classnames['default'] : classnames;
|
|
9
6
|
|
|
10
|
-
function styleInject(css, ref) {
|
|
11
|
-
if ( ref === void 0 ) ref = {};
|
|
12
|
-
var insertAt = ref.insertAt;
|
|
13
7
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
17
|
-
var style = document.createElement('style');
|
|
18
|
-
style.type = 'text/css';
|
|
19
|
-
|
|
20
|
-
if (insertAt === 'top') {
|
|
21
|
-
if (head.firstChild) {
|
|
22
|
-
head.insertBefore(style, head.firstChild);
|
|
23
|
-
} else {
|
|
24
|
-
head.appendChild(style);
|
|
25
|
-
}
|
|
26
|
-
} else {
|
|
27
|
-
head.appendChild(style);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (style.styleSheet) {
|
|
31
|
-
style.styleSheet.cssText = css;
|
|
32
|
-
} else {
|
|
33
|
-
style.appendChild(document.createTextNode(css));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
var css_248z = "/* Palette */\n/* Semantic usages */\n.goa-badge-icon {\n margin-left: 4px;\n margin-right: 0px;\n position: relative;\n top: -5px;\n height: 14px;\n width: 14px;\n font-size: 14px !important; }\n\n.badge-module_goa-badge__3F6Ve {\n line-height: 24px;\n font-size: 14px;\n font-weight: 400 !important; }\n\n.badge-module_goa-badge__3F6Ve {\n display: inline-block;\n border-radius: 4px;\n padding-top: 4px;\n padding-left: 4px;\n padding-right: 4px;\n height: 20px; }\n .badge-module_goa-badge__3F6Ve * {\n margin-left: 4px;\n margin-right: 4px; }\n .badge-module_goa-badge__3F6Ve .badge-module_goa-badge-content__3UN-3 {\n position: relative;\n top: -5px;\n height: 14px;\n display: inline; }\n .badge-module_goa-badge__3F6Ve mat-icon {\n margin-left: 4px;\n margin-right: 4px;\n position: relative;\n top: -3px;\n height: 14px;\n width: 14px;\n font-size: 14px !important; }\n\n.badge-module_goa-badge__3F6Ve.badge-module_badge-information__2r_Eq {\n background-color: #0070c4;\n color: #fff; }\n\n.badge-module_goa-badge__3F6Ve.badge-module_badge-success__18wcm {\n background-color: #00853f;\n color: #fff; }\n\n.badge-module_goa-badge__3F6Ve.badge-module_badge-warning__20BNM {\n background-color: #feba35;\n color: #333; }\n\n.badge-module_goa-badge__3F6Ve.badge-module_badge-emergency__E4mHn {\n background-color: #ec040b;\n color: #fff; }\n\n.badge-module_goa-badge__3F6Ve.badge-module_badge-dark__1thw- {\n background-color: #0070c4;\n color: #fff; }\n\n.badge-module_goa-badge__3F6Ve.badge-module_badge-midtone__1Gt4T {\n background-color: #767676;\n color: #fff; }\n\n.badge-module_goa-badge__3F6Ve.badge-module_badge-light__B8ZMt {\n background-color: #fff;\n color: #333; }\n\n.badge-module_goa-badge__3F6Ve.badge-module_badge-inactive__35PEw {\n background-color: #fff;\n color: #333; }\n";
|
|
38
|
-
var styles = {"goa-badge":"badge-module_goa-badge__3F6Ve","goa-badge-content":"badge-module_goa-badge-content__3UN-3","badge-information":"badge-module_badge-information__2r_Eq","badge-success":"badge-module_badge-success__18wcm","badge-warning":"badge-module_badge-warning__20BNM","badge-emergency":"badge-module_badge-emergency__E4mHn","badge-dark":"badge-module_badge-dark__1thw-","badge-midtone":"badge-module_badge-midtone__1Gt4T","badge-light":"badge-module_badge-light__B8ZMt","badge-inactive":"badge-module_badge-inactive__35PEw"};
|
|
39
|
-
styleInject(css_248z);
|
|
40
|
-
|
|
41
|
-
var GoABadge = function GoABadge(_ref) {
|
|
42
|
-
var type = _ref.type,
|
|
43
|
-
content = _ref.content,
|
|
44
|
-
icon = _ref.icon;
|
|
45
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
46
|
-
className: classnames(styles['goa-badge'], styles["badge-".concat(type)])
|
|
47
|
-
}, icon, /*#__PURE__*/React__default.createElement("span", {
|
|
48
|
-
className: classnames(styles['goa-badge-content'])
|
|
49
|
-
}, content));
|
|
50
|
-
};
|
|
51
|
-
GoABadge.defaultProps = {
|
|
52
|
-
type: 'information'
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
function createCommonjsModule(fn, module) {
|
|
56
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** @license React v16.13.1
|
|
60
|
-
* react-is.production.min.js
|
|
61
|
-
*
|
|
62
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
63
|
-
*
|
|
64
|
-
* This source code is licensed under the MIT license found in the
|
|
65
|
-
* LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/
|
|
67
|
-
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
68
|
-
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
69
|
-
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d;
|
|
70
|
-
var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
|
|
71
|
-
var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
|
|
72
|
-
var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
|
|
73
|
-
|
|
74
|
-
var reactIs_production_min = {
|
|
75
|
-
AsyncMode: AsyncMode,
|
|
76
|
-
ConcurrentMode: ConcurrentMode,
|
|
77
|
-
ContextConsumer: ContextConsumer,
|
|
78
|
-
ContextProvider: ContextProvider,
|
|
79
|
-
Element: Element,
|
|
80
|
-
ForwardRef: ForwardRef,
|
|
81
|
-
Fragment: Fragment,
|
|
82
|
-
Lazy: Lazy,
|
|
83
|
-
Memo: Memo,
|
|
84
|
-
Portal: Portal,
|
|
85
|
-
Profiler: Profiler,
|
|
86
|
-
StrictMode: StrictMode,
|
|
87
|
-
Suspense: Suspense,
|
|
88
|
-
isAsyncMode: isAsyncMode,
|
|
89
|
-
isConcurrentMode: isConcurrentMode,
|
|
90
|
-
isContextConsumer: isContextConsumer,
|
|
91
|
-
isContextProvider: isContextProvider,
|
|
92
|
-
isElement: isElement,
|
|
93
|
-
isForwardRef: isForwardRef,
|
|
94
|
-
isFragment: isFragment,
|
|
95
|
-
isLazy: isLazy,
|
|
96
|
-
isMemo: isMemo,
|
|
97
|
-
isPortal: isPortal,
|
|
98
|
-
isProfiler: isProfiler,
|
|
99
|
-
isStrictMode: isStrictMode,
|
|
100
|
-
isSuspense: isSuspense,
|
|
101
|
-
isValidElementType: isValidElementType,
|
|
102
|
-
typeOf: typeOf
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
var reactIs_development = createCommonjsModule(function (module, exports) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (process.env.NODE_ENV !== "production") {
|
|
110
|
-
(function() {
|
|
111
|
-
|
|
112
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
113
|
-
// nor polyfill, then a plain number is used for performance.
|
|
114
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
115
|
-
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
116
|
-
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
117
|
-
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
118
|
-
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
119
|
-
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
120
|
-
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
121
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
122
|
-
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
123
|
-
|
|
124
|
-
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
125
|
-
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
126
|
-
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
127
|
-
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
128
|
-
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
129
|
-
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
130
|
-
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
131
|
-
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
132
|
-
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
133
|
-
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
134
|
-
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
135
|
-
|
|
136
|
-
function isValidElementType(type) {
|
|
137
|
-
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
138
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function typeOf(object) {
|
|
142
|
-
if (typeof object === 'object' && object !== null) {
|
|
143
|
-
var $$typeof = object.$$typeof;
|
|
144
|
-
|
|
145
|
-
switch ($$typeof) {
|
|
146
|
-
case REACT_ELEMENT_TYPE:
|
|
147
|
-
var type = object.type;
|
|
148
|
-
|
|
149
|
-
switch (type) {
|
|
150
|
-
case REACT_ASYNC_MODE_TYPE:
|
|
151
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
152
|
-
case REACT_FRAGMENT_TYPE:
|
|
153
|
-
case REACT_PROFILER_TYPE:
|
|
154
|
-
case REACT_STRICT_MODE_TYPE:
|
|
155
|
-
case REACT_SUSPENSE_TYPE:
|
|
156
|
-
return type;
|
|
157
|
-
|
|
158
|
-
default:
|
|
159
|
-
var $$typeofType = type && type.$$typeof;
|
|
160
|
-
|
|
161
|
-
switch ($$typeofType) {
|
|
162
|
-
case REACT_CONTEXT_TYPE:
|
|
163
|
-
case REACT_FORWARD_REF_TYPE:
|
|
164
|
-
case REACT_LAZY_TYPE:
|
|
165
|
-
case REACT_MEMO_TYPE:
|
|
166
|
-
case REACT_PROVIDER_TYPE:
|
|
167
|
-
return $$typeofType;
|
|
168
|
-
|
|
169
|
-
default:
|
|
170
|
-
return $$typeof;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
case REACT_PORTAL_TYPE:
|
|
176
|
-
return $$typeof;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return undefined;
|
|
181
|
-
} // AsyncMode is deprecated along with isAsyncMode
|
|
182
|
-
|
|
183
|
-
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
184
|
-
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
185
|
-
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
186
|
-
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
187
|
-
var Element = REACT_ELEMENT_TYPE;
|
|
188
|
-
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
189
|
-
var Fragment = REACT_FRAGMENT_TYPE;
|
|
190
|
-
var Lazy = REACT_LAZY_TYPE;
|
|
191
|
-
var Memo = REACT_MEMO_TYPE;
|
|
192
|
-
var Portal = REACT_PORTAL_TYPE;
|
|
193
|
-
var Profiler = REACT_PROFILER_TYPE;
|
|
194
|
-
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
195
|
-
var Suspense = REACT_SUSPENSE_TYPE;
|
|
196
|
-
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
197
|
-
|
|
198
|
-
function isAsyncMode(object) {
|
|
199
|
-
{
|
|
200
|
-
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
201
|
-
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
202
|
-
|
|
203
|
-
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
208
|
-
}
|
|
209
|
-
function isConcurrentMode(object) {
|
|
210
|
-
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
211
|
-
}
|
|
212
|
-
function isContextConsumer(object) {
|
|
213
|
-
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
214
|
-
}
|
|
215
|
-
function isContextProvider(object) {
|
|
216
|
-
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
217
|
-
}
|
|
218
|
-
function isElement(object) {
|
|
219
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
220
|
-
}
|
|
221
|
-
function isForwardRef(object) {
|
|
222
|
-
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
223
|
-
}
|
|
224
|
-
function isFragment(object) {
|
|
225
|
-
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
226
|
-
}
|
|
227
|
-
function isLazy(object) {
|
|
228
|
-
return typeOf(object) === REACT_LAZY_TYPE;
|
|
229
|
-
}
|
|
230
|
-
function isMemo(object) {
|
|
231
|
-
return typeOf(object) === REACT_MEMO_TYPE;
|
|
232
|
-
}
|
|
233
|
-
function isPortal(object) {
|
|
234
|
-
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
235
|
-
}
|
|
236
|
-
function isProfiler(object) {
|
|
237
|
-
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
238
|
-
}
|
|
239
|
-
function isStrictMode(object) {
|
|
240
|
-
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
241
|
-
}
|
|
242
|
-
function isSuspense(object) {
|
|
243
|
-
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
exports.AsyncMode = AsyncMode;
|
|
247
|
-
exports.ConcurrentMode = ConcurrentMode;
|
|
248
|
-
exports.ContextConsumer = ContextConsumer;
|
|
249
|
-
exports.ContextProvider = ContextProvider;
|
|
250
|
-
exports.Element = Element;
|
|
251
|
-
exports.ForwardRef = ForwardRef;
|
|
252
|
-
exports.Fragment = Fragment;
|
|
253
|
-
exports.Lazy = Lazy;
|
|
254
|
-
exports.Memo = Memo;
|
|
255
|
-
exports.Portal = Portal;
|
|
256
|
-
exports.Profiler = Profiler;
|
|
257
|
-
exports.StrictMode = StrictMode;
|
|
258
|
-
exports.Suspense = Suspense;
|
|
259
|
-
exports.isAsyncMode = isAsyncMode;
|
|
260
|
-
exports.isConcurrentMode = isConcurrentMode;
|
|
261
|
-
exports.isContextConsumer = isContextConsumer;
|
|
262
|
-
exports.isContextProvider = isContextProvider;
|
|
263
|
-
exports.isElement = isElement;
|
|
264
|
-
exports.isForwardRef = isForwardRef;
|
|
265
|
-
exports.isFragment = isFragment;
|
|
266
|
-
exports.isLazy = isLazy;
|
|
267
|
-
exports.isMemo = isMemo;
|
|
268
|
-
exports.isPortal = isPortal;
|
|
269
|
-
exports.isProfiler = isProfiler;
|
|
270
|
-
exports.isStrictMode = isStrictMode;
|
|
271
|
-
exports.isSuspense = isSuspense;
|
|
272
|
-
exports.isValidElementType = isValidElementType;
|
|
273
|
-
exports.typeOf = typeOf;
|
|
274
|
-
})();
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
var reactIs_development_1 = reactIs_development.AsyncMode;
|
|
278
|
-
var reactIs_development_2 = reactIs_development.ConcurrentMode;
|
|
279
|
-
var reactIs_development_3 = reactIs_development.ContextConsumer;
|
|
280
|
-
var reactIs_development_4 = reactIs_development.ContextProvider;
|
|
281
|
-
var reactIs_development_5 = reactIs_development.Element;
|
|
282
|
-
var reactIs_development_6 = reactIs_development.ForwardRef;
|
|
283
|
-
var reactIs_development_7 = reactIs_development.Fragment;
|
|
284
|
-
var reactIs_development_8 = reactIs_development.Lazy;
|
|
285
|
-
var reactIs_development_9 = reactIs_development.Memo;
|
|
286
|
-
var reactIs_development_10 = reactIs_development.Portal;
|
|
287
|
-
var reactIs_development_11 = reactIs_development.Profiler;
|
|
288
|
-
var reactIs_development_12 = reactIs_development.StrictMode;
|
|
289
|
-
var reactIs_development_13 = reactIs_development.Suspense;
|
|
290
|
-
var reactIs_development_14 = reactIs_development.isAsyncMode;
|
|
291
|
-
var reactIs_development_15 = reactIs_development.isConcurrentMode;
|
|
292
|
-
var reactIs_development_16 = reactIs_development.isContextConsumer;
|
|
293
|
-
var reactIs_development_17 = reactIs_development.isContextProvider;
|
|
294
|
-
var reactIs_development_18 = reactIs_development.isElement;
|
|
295
|
-
var reactIs_development_19 = reactIs_development.isForwardRef;
|
|
296
|
-
var reactIs_development_20 = reactIs_development.isFragment;
|
|
297
|
-
var reactIs_development_21 = reactIs_development.isLazy;
|
|
298
|
-
var reactIs_development_22 = reactIs_development.isMemo;
|
|
299
|
-
var reactIs_development_23 = reactIs_development.isPortal;
|
|
300
|
-
var reactIs_development_24 = reactIs_development.isProfiler;
|
|
301
|
-
var reactIs_development_25 = reactIs_development.isStrictMode;
|
|
302
|
-
var reactIs_development_26 = reactIs_development.isSuspense;
|
|
303
|
-
var reactIs_development_27 = reactIs_development.isValidElementType;
|
|
304
|
-
var reactIs_development_28 = reactIs_development.typeOf;
|
|
305
|
-
|
|
306
|
-
var reactIs = createCommonjsModule(function (module) {
|
|
307
|
-
|
|
308
|
-
if (process.env.NODE_ENV === 'production') {
|
|
309
|
-
module.exports = reactIs_production_min;
|
|
310
|
-
} else {
|
|
311
|
-
module.exports = reactIs_development;
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
/*
|
|
316
|
-
object-assign
|
|
317
|
-
(c) Sindre Sorhus
|
|
318
|
-
@license MIT
|
|
319
|
-
*/
|
|
320
|
-
/* eslint-disable no-unused-vars */
|
|
321
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
322
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
323
|
-
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
324
|
-
|
|
325
|
-
function toObject(val) {
|
|
326
|
-
if (val === null || val === undefined) {
|
|
327
|
-
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
return Object(val);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
function shouldUseNative() {
|
|
334
|
-
try {
|
|
335
|
-
if (!Object.assign) {
|
|
336
|
-
return false;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// Detect buggy property enumeration order in older V8 versions.
|
|
340
|
-
|
|
341
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
342
|
-
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
343
|
-
test1[5] = 'de';
|
|
344
|
-
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
345
|
-
return false;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
349
|
-
var test2 = {};
|
|
350
|
-
for (var i = 0; i < 10; i++) {
|
|
351
|
-
test2['_' + String.fromCharCode(i)] = i;
|
|
352
|
-
}
|
|
353
|
-
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
354
|
-
return test2[n];
|
|
355
|
-
});
|
|
356
|
-
if (order2.join('') !== '0123456789') {
|
|
357
|
-
return false;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
361
|
-
var test3 = {};
|
|
362
|
-
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
363
|
-
test3[letter] = letter;
|
|
364
|
-
});
|
|
365
|
-
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
366
|
-
'abcdefghijklmnopqrst') {
|
|
367
|
-
return false;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
return true;
|
|
371
|
-
} catch (err) {
|
|
372
|
-
// We don't expect any of the above to throw, but better to be safe.
|
|
373
|
-
return false;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
378
|
-
var from;
|
|
379
|
-
var to = toObject(target);
|
|
380
|
-
var symbols;
|
|
381
|
-
|
|
382
|
-
for (var s = 1; s < arguments.length; s++) {
|
|
383
|
-
from = Object(arguments[s]);
|
|
384
|
-
|
|
385
|
-
for (var key in from) {
|
|
386
|
-
if (hasOwnProperty.call(from, key)) {
|
|
387
|
-
to[key] = from[key];
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
if (getOwnPropertySymbols) {
|
|
392
|
-
symbols = getOwnPropertySymbols(from);
|
|
393
|
-
for (var i = 0; i < symbols.length; i++) {
|
|
394
|
-
if (propIsEnumerable.call(from, symbols[i])) {
|
|
395
|
-
to[symbols[i]] = from[symbols[i]];
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
return to;
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
406
|
-
*
|
|
407
|
-
* This source code is licensed under the MIT license found in the
|
|
408
|
-
* LICENSE file in the root directory of this source tree.
|
|
409
|
-
*/
|
|
410
|
-
|
|
411
|
-
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
412
|
-
|
|
413
|
-
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
414
|
-
|
|
415
|
-
var printWarning = function() {};
|
|
416
|
-
|
|
417
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
418
|
-
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
419
|
-
var loggedTypeFailures = {};
|
|
420
|
-
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
421
|
-
|
|
422
|
-
printWarning = function(text) {
|
|
423
|
-
var message = 'Warning: ' + text;
|
|
424
|
-
if (typeof console !== 'undefined') {
|
|
425
|
-
console.error(message);
|
|
426
|
-
}
|
|
427
|
-
try {
|
|
428
|
-
// --- Welcome to debugging React ---
|
|
429
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
430
|
-
// to find the callsite that caused this warning to fire.
|
|
431
|
-
throw new Error(message);
|
|
432
|
-
} catch (x) {}
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Assert that the values match with the type specs.
|
|
438
|
-
* Error messages are memorized and will only be shown once.
|
|
439
|
-
*
|
|
440
|
-
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
441
|
-
* @param {object} values Runtime values that need to be type-checked
|
|
442
|
-
* @param {string} location e.g. "prop", "context", "child context"
|
|
443
|
-
* @param {string} componentName Name of the component for error messages.
|
|
444
|
-
* @param {?Function} getStack Returns the component stack.
|
|
445
|
-
* @private
|
|
446
|
-
*/
|
|
447
|
-
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
448
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
449
|
-
for (var typeSpecName in typeSpecs) {
|
|
450
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
451
|
-
var error;
|
|
452
|
-
// Prop type validation may throw. In case they do, we don't want to
|
|
453
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
454
|
-
// After these have been cleaned up, we'll let them throw.
|
|
455
|
-
try {
|
|
456
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
457
|
-
// behavior as without this statement except with a better message.
|
|
458
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
459
|
-
var err = Error(
|
|
460
|
-
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
461
|
-
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
|
462
|
-
);
|
|
463
|
-
err.name = 'Invariant Violation';
|
|
464
|
-
throw err;
|
|
465
|
-
}
|
|
466
|
-
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
|
|
467
|
-
} catch (ex) {
|
|
468
|
-
error = ex;
|
|
469
|
-
}
|
|
470
|
-
if (error && !(error instanceof Error)) {
|
|
471
|
-
printWarning(
|
|
472
|
-
(componentName || 'React class') + ': type specification of ' +
|
|
473
|
-
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
474
|
-
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
475
|
-
'You may have forgotten to pass an argument to the type checker ' +
|
|
476
|
-
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
477
|
-
'shape all require an argument).'
|
|
478
|
-
);
|
|
479
|
-
}
|
|
480
|
-
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
481
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
482
|
-
// same error.
|
|
483
|
-
loggedTypeFailures[error.message] = true;
|
|
484
|
-
|
|
485
|
-
var stack = getStack ? getStack() : '';
|
|
486
|
-
|
|
487
|
-
printWarning(
|
|
488
|
-
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
489
|
-
);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* Resets warning cache when testing.
|
|
498
|
-
*
|
|
499
|
-
* @private
|
|
500
|
-
*/
|
|
501
|
-
checkPropTypes.resetWarningCache = function() {
|
|
502
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
503
|
-
loggedTypeFailures = {};
|
|
504
|
-
}
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
var checkPropTypes_1 = checkPropTypes;
|
|
508
|
-
|
|
509
|
-
var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
510
|
-
var printWarning$1 = function() {};
|
|
511
|
-
|
|
512
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
513
|
-
printWarning$1 = function(text) {
|
|
514
|
-
var message = 'Warning: ' + text;
|
|
515
|
-
if (typeof console !== 'undefined') {
|
|
516
|
-
console.error(message);
|
|
517
|
-
}
|
|
518
|
-
try {
|
|
519
|
-
// --- Welcome to debugging React ---
|
|
520
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
521
|
-
// to find the callsite that caused this warning to fire.
|
|
522
|
-
throw new Error(message);
|
|
523
|
-
} catch (x) {}
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
function emptyFunctionThatReturnsNull() {
|
|
528
|
-
return null;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
532
|
-
/* global Symbol */
|
|
533
|
-
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
534
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* Returns the iterator method function contained on the iterable object.
|
|
538
|
-
*
|
|
539
|
-
* Be sure to invoke the function with the iterable as context:
|
|
540
|
-
*
|
|
541
|
-
* var iteratorFn = getIteratorFn(myIterable);
|
|
542
|
-
* if (iteratorFn) {
|
|
543
|
-
* var iterator = iteratorFn.call(myIterable);
|
|
544
|
-
* ...
|
|
545
|
-
* }
|
|
546
|
-
*
|
|
547
|
-
* @param {?object} maybeIterable
|
|
548
|
-
* @return {?function}
|
|
549
|
-
*/
|
|
550
|
-
function getIteratorFn(maybeIterable) {
|
|
551
|
-
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
552
|
-
if (typeof iteratorFn === 'function') {
|
|
553
|
-
return iteratorFn;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
/**
|
|
558
|
-
* Collection of methods that allow declaration and validation of props that are
|
|
559
|
-
* supplied to React components. Example usage:
|
|
560
|
-
*
|
|
561
|
-
* var Props = require('ReactPropTypes');
|
|
562
|
-
* var MyArticle = React.createClass({
|
|
563
|
-
* propTypes: {
|
|
564
|
-
* // An optional string prop named "description".
|
|
565
|
-
* description: Props.string,
|
|
566
|
-
*
|
|
567
|
-
* // A required enum prop named "category".
|
|
568
|
-
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
569
|
-
*
|
|
570
|
-
* // A prop named "dialog" that requires an instance of Dialog.
|
|
571
|
-
* dialog: Props.instanceOf(Dialog).isRequired
|
|
572
|
-
* },
|
|
573
|
-
* render: function() { ... }
|
|
574
|
-
* });
|
|
575
|
-
*
|
|
576
|
-
* A more formal specification of how these methods are used:
|
|
577
|
-
*
|
|
578
|
-
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
579
|
-
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
580
|
-
*
|
|
581
|
-
* Each and every declaration produces a function with the same signature. This
|
|
582
|
-
* allows the creation of custom validation functions. For example:
|
|
583
|
-
*
|
|
584
|
-
* var MyLink = React.createClass({
|
|
585
|
-
* propTypes: {
|
|
586
|
-
* // An optional string or URI prop named "href".
|
|
587
|
-
* href: function(props, propName, componentName) {
|
|
588
|
-
* var propValue = props[propName];
|
|
589
|
-
* if (propValue != null && typeof propValue !== 'string' &&
|
|
590
|
-
* !(propValue instanceof URI)) {
|
|
591
|
-
* return new Error(
|
|
592
|
-
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
593
|
-
* componentName
|
|
594
|
-
* );
|
|
595
|
-
* }
|
|
596
|
-
* }
|
|
597
|
-
* },
|
|
598
|
-
* render: function() {...}
|
|
599
|
-
* });
|
|
600
|
-
*
|
|
601
|
-
* @internal
|
|
602
|
-
*/
|
|
603
|
-
|
|
604
|
-
var ANONYMOUS = '<<anonymous>>';
|
|
605
|
-
|
|
606
|
-
// Important!
|
|
607
|
-
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
608
|
-
var ReactPropTypes = {
|
|
609
|
-
array: createPrimitiveTypeChecker('array'),
|
|
610
|
-
bool: createPrimitiveTypeChecker('boolean'),
|
|
611
|
-
func: createPrimitiveTypeChecker('function'),
|
|
612
|
-
number: createPrimitiveTypeChecker('number'),
|
|
613
|
-
object: createPrimitiveTypeChecker('object'),
|
|
614
|
-
string: createPrimitiveTypeChecker('string'),
|
|
615
|
-
symbol: createPrimitiveTypeChecker('symbol'),
|
|
616
|
-
|
|
617
|
-
any: createAnyTypeChecker(),
|
|
618
|
-
arrayOf: createArrayOfTypeChecker,
|
|
619
|
-
element: createElementTypeChecker(),
|
|
620
|
-
elementType: createElementTypeTypeChecker(),
|
|
621
|
-
instanceOf: createInstanceTypeChecker,
|
|
622
|
-
node: createNodeChecker(),
|
|
623
|
-
objectOf: createObjectOfTypeChecker,
|
|
624
|
-
oneOf: createEnumTypeChecker,
|
|
625
|
-
oneOfType: createUnionTypeChecker,
|
|
626
|
-
shape: createShapeTypeChecker,
|
|
627
|
-
exact: createStrictShapeTypeChecker,
|
|
628
|
-
};
|
|
629
|
-
|
|
630
|
-
/**
|
|
631
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
632
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
633
|
-
*/
|
|
634
|
-
/*eslint-disable no-self-compare*/
|
|
635
|
-
function is(x, y) {
|
|
636
|
-
// SameValue algorithm
|
|
637
|
-
if (x === y) {
|
|
638
|
-
// Steps 1-5, 7-10
|
|
639
|
-
// Steps 6.b-6.e: +0 != -0
|
|
640
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
641
|
-
} else {
|
|
642
|
-
// Step 6.a: NaN == NaN
|
|
643
|
-
return x !== x && y !== y;
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
/*eslint-enable no-self-compare*/
|
|
647
|
-
|
|
648
|
-
/**
|
|
649
|
-
* We use an Error-like object for backward compatibility as people may call
|
|
650
|
-
* PropTypes directly and inspect their output. However, we don't use real
|
|
651
|
-
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
652
|
-
* is prohibitively expensive if they are created too often, such as what
|
|
653
|
-
* happens in oneOfType() for any type before the one that matched.
|
|
654
|
-
*/
|
|
655
|
-
function PropTypeError(message) {
|
|
656
|
-
this.message = message;
|
|
657
|
-
this.stack = '';
|
|
658
|
-
}
|
|
659
|
-
// Make `instanceof Error` still work for returned errors.
|
|
660
|
-
PropTypeError.prototype = Error.prototype;
|
|
661
|
-
|
|
662
|
-
function createChainableTypeChecker(validate) {
|
|
663
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
664
|
-
var manualPropTypeCallCache = {};
|
|
665
|
-
var manualPropTypeWarningCount = 0;
|
|
666
|
-
}
|
|
667
|
-
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
668
|
-
componentName = componentName || ANONYMOUS;
|
|
669
|
-
propFullName = propFullName || propName;
|
|
670
|
-
|
|
671
|
-
if (secret !== ReactPropTypesSecret_1) {
|
|
672
|
-
if (throwOnDirectAccess) {
|
|
673
|
-
// New behavior only for users of `prop-types` package
|
|
674
|
-
var err = new Error(
|
|
675
|
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
676
|
-
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
677
|
-
'Read more at http://fb.me/use-check-prop-types'
|
|
678
|
-
);
|
|
679
|
-
err.name = 'Invariant Violation';
|
|
680
|
-
throw err;
|
|
681
|
-
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
682
|
-
// Old behavior for people using React.PropTypes
|
|
683
|
-
var cacheKey = componentName + ':' + propName;
|
|
684
|
-
if (
|
|
685
|
-
!manualPropTypeCallCache[cacheKey] &&
|
|
686
|
-
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
687
|
-
manualPropTypeWarningCount < 3
|
|
688
|
-
) {
|
|
689
|
-
printWarning$1(
|
|
690
|
-
'You are manually calling a React.PropTypes validation ' +
|
|
691
|
-
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
692
|
-
'and will throw in the standalone `prop-types` package. ' +
|
|
693
|
-
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
694
|
-
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
695
|
-
);
|
|
696
|
-
manualPropTypeCallCache[cacheKey] = true;
|
|
697
|
-
manualPropTypeWarningCount++;
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
if (props[propName] == null) {
|
|
702
|
-
if (isRequired) {
|
|
703
|
-
if (props[propName] === null) {
|
|
704
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
705
|
-
}
|
|
706
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
707
|
-
}
|
|
708
|
-
return null;
|
|
709
|
-
} else {
|
|
710
|
-
return validate(props, propName, componentName, location, propFullName);
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
var chainedCheckType = checkType.bind(null, false);
|
|
715
|
-
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
716
|
-
|
|
717
|
-
return chainedCheckType;
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
function createPrimitiveTypeChecker(expectedType) {
|
|
721
|
-
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
722
|
-
var propValue = props[propName];
|
|
723
|
-
var propType = getPropType(propValue);
|
|
724
|
-
if (propType !== expectedType) {
|
|
725
|
-
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
726
|
-
// check, but we can offer a more precise error message here rather than
|
|
727
|
-
// 'of type `object`'.
|
|
728
|
-
var preciseType = getPreciseType(propValue);
|
|
729
|
-
|
|
730
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
|
731
|
-
}
|
|
732
|
-
return null;
|
|
733
|
-
}
|
|
734
|
-
return createChainableTypeChecker(validate);
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
function createAnyTypeChecker() {
|
|
738
|
-
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
function createArrayOfTypeChecker(typeChecker) {
|
|
742
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
743
|
-
if (typeof typeChecker !== 'function') {
|
|
744
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
745
|
-
}
|
|
746
|
-
var propValue = props[propName];
|
|
747
|
-
if (!Array.isArray(propValue)) {
|
|
748
|
-
var propType = getPropType(propValue);
|
|
749
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
750
|
-
}
|
|
751
|
-
for (var i = 0; i < propValue.length; i++) {
|
|
752
|
-
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
|
|
753
|
-
if (error instanceof Error) {
|
|
754
|
-
return error;
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
return null;
|
|
758
|
-
}
|
|
759
|
-
return createChainableTypeChecker(validate);
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
function createElementTypeChecker() {
|
|
763
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
764
|
-
var propValue = props[propName];
|
|
765
|
-
if (!isValidElement(propValue)) {
|
|
766
|
-
var propType = getPropType(propValue);
|
|
767
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
768
|
-
}
|
|
769
|
-
return null;
|
|
770
|
-
}
|
|
771
|
-
return createChainableTypeChecker(validate);
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
function createElementTypeTypeChecker() {
|
|
775
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
776
|
-
var propValue = props[propName];
|
|
777
|
-
if (!reactIs.isValidElementType(propValue)) {
|
|
778
|
-
var propType = getPropType(propValue);
|
|
779
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
780
|
-
}
|
|
781
|
-
return null;
|
|
782
|
-
}
|
|
783
|
-
return createChainableTypeChecker(validate);
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
function createInstanceTypeChecker(expectedClass) {
|
|
787
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
788
|
-
if (!(props[propName] instanceof expectedClass)) {
|
|
789
|
-
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
790
|
-
var actualClassName = getClassName(props[propName]);
|
|
791
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
792
|
-
}
|
|
793
|
-
return null;
|
|
794
|
-
}
|
|
795
|
-
return createChainableTypeChecker(validate);
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
function createEnumTypeChecker(expectedValues) {
|
|
799
|
-
if (!Array.isArray(expectedValues)) {
|
|
800
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
801
|
-
if (arguments.length > 1) {
|
|
802
|
-
printWarning$1(
|
|
803
|
-
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
804
|
-
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
805
|
-
);
|
|
806
|
-
} else {
|
|
807
|
-
printWarning$1('Invalid argument supplied to oneOf, expected an array.');
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
return emptyFunctionThatReturnsNull;
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
814
|
-
var propValue = props[propName];
|
|
815
|
-
for (var i = 0; i < expectedValues.length; i++) {
|
|
816
|
-
if (is(propValue, expectedValues[i])) {
|
|
817
|
-
return null;
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
822
|
-
var type = getPreciseType(value);
|
|
823
|
-
if (type === 'symbol') {
|
|
824
|
-
return String(value);
|
|
825
|
-
}
|
|
826
|
-
return value;
|
|
827
|
-
});
|
|
828
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
829
|
-
}
|
|
830
|
-
return createChainableTypeChecker(validate);
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
function createObjectOfTypeChecker(typeChecker) {
|
|
834
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
835
|
-
if (typeof typeChecker !== 'function') {
|
|
836
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
837
|
-
}
|
|
838
|
-
var propValue = props[propName];
|
|
839
|
-
var propType = getPropType(propValue);
|
|
840
|
-
if (propType !== 'object') {
|
|
841
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
842
|
-
}
|
|
843
|
-
for (var key in propValue) {
|
|
844
|
-
if (has$1(propValue, key)) {
|
|
845
|
-
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
846
|
-
if (error instanceof Error) {
|
|
847
|
-
return error;
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
return null;
|
|
852
|
-
}
|
|
853
|
-
return createChainableTypeChecker(validate);
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
857
|
-
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
858
|
-
process.env.NODE_ENV !== 'production' ? printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
859
|
-
return emptyFunctionThatReturnsNull;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
863
|
-
var checker = arrayOfTypeCheckers[i];
|
|
864
|
-
if (typeof checker !== 'function') {
|
|
865
|
-
printWarning$1(
|
|
866
|
-
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
867
|
-
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
868
|
-
);
|
|
869
|
-
return emptyFunctionThatReturnsNull;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
874
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
875
|
-
var checker = arrayOfTypeCheckers[i];
|
|
876
|
-
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
|
|
877
|
-
return null;
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
|
882
|
-
}
|
|
883
|
-
return createChainableTypeChecker(validate);
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
function createNodeChecker() {
|
|
887
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
888
|
-
if (!isNode(props[propName])) {
|
|
889
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
890
|
-
}
|
|
891
|
-
return null;
|
|
892
|
-
}
|
|
893
|
-
return createChainableTypeChecker(validate);
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
function createShapeTypeChecker(shapeTypes) {
|
|
897
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
898
|
-
var propValue = props[propName];
|
|
899
|
-
var propType = getPropType(propValue);
|
|
900
|
-
if (propType !== 'object') {
|
|
901
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
902
|
-
}
|
|
903
|
-
for (var key in shapeTypes) {
|
|
904
|
-
var checker = shapeTypes[key];
|
|
905
|
-
if (!checker) {
|
|
906
|
-
continue;
|
|
907
|
-
}
|
|
908
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
909
|
-
if (error) {
|
|
910
|
-
return error;
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
return null;
|
|
914
|
-
}
|
|
915
|
-
return createChainableTypeChecker(validate);
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
function createStrictShapeTypeChecker(shapeTypes) {
|
|
919
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
920
|
-
var propValue = props[propName];
|
|
921
|
-
var propType = getPropType(propValue);
|
|
922
|
-
if (propType !== 'object') {
|
|
923
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
924
|
-
}
|
|
925
|
-
// We need to check all keys in case some are required but missing from
|
|
926
|
-
// props.
|
|
927
|
-
var allKeys = objectAssign({}, props[propName], shapeTypes);
|
|
928
|
-
for (var key in allKeys) {
|
|
929
|
-
var checker = shapeTypes[key];
|
|
930
|
-
if (!checker) {
|
|
931
|
-
return new PropTypeError(
|
|
932
|
-
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
933
|
-
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
934
|
-
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
935
|
-
);
|
|
936
|
-
}
|
|
937
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
938
|
-
if (error) {
|
|
939
|
-
return error;
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
return null;
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
return createChainableTypeChecker(validate);
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
function isNode(propValue) {
|
|
949
|
-
switch (typeof propValue) {
|
|
950
|
-
case 'number':
|
|
951
|
-
case 'string':
|
|
952
|
-
case 'undefined':
|
|
953
|
-
return true;
|
|
954
|
-
case 'boolean':
|
|
955
|
-
return !propValue;
|
|
956
|
-
case 'object':
|
|
957
|
-
if (Array.isArray(propValue)) {
|
|
958
|
-
return propValue.every(isNode);
|
|
959
|
-
}
|
|
960
|
-
if (propValue === null || isValidElement(propValue)) {
|
|
961
|
-
return true;
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
var iteratorFn = getIteratorFn(propValue);
|
|
965
|
-
if (iteratorFn) {
|
|
966
|
-
var iterator = iteratorFn.call(propValue);
|
|
967
|
-
var step;
|
|
968
|
-
if (iteratorFn !== propValue.entries) {
|
|
969
|
-
while (!(step = iterator.next()).done) {
|
|
970
|
-
if (!isNode(step.value)) {
|
|
971
|
-
return false;
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
} else {
|
|
975
|
-
// Iterator will provide entry [k,v] tuples rather than values.
|
|
976
|
-
while (!(step = iterator.next()).done) {
|
|
977
|
-
var entry = step.value;
|
|
978
|
-
if (entry) {
|
|
979
|
-
if (!isNode(entry[1])) {
|
|
980
|
-
return false;
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
} else {
|
|
986
|
-
return false;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
return true;
|
|
990
|
-
default:
|
|
991
|
-
return false;
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
function isSymbol(propType, propValue) {
|
|
996
|
-
// Native Symbol.
|
|
997
|
-
if (propType === 'symbol') {
|
|
998
|
-
return true;
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
// falsy value can't be a Symbol
|
|
1002
|
-
if (!propValue) {
|
|
1003
|
-
return false;
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1007
|
-
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
1008
|
-
return true;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
1012
|
-
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
1013
|
-
return true;
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
return false;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
1020
|
-
function getPropType(propValue) {
|
|
1021
|
-
var propType = typeof propValue;
|
|
1022
|
-
if (Array.isArray(propValue)) {
|
|
1023
|
-
return 'array';
|
|
1024
|
-
}
|
|
1025
|
-
if (propValue instanceof RegExp) {
|
|
1026
|
-
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
1027
|
-
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
1028
|
-
// passes PropTypes.object.
|
|
1029
|
-
return 'object';
|
|
1030
|
-
}
|
|
1031
|
-
if (isSymbol(propType, propValue)) {
|
|
1032
|
-
return 'symbol';
|
|
1033
|
-
}
|
|
1034
|
-
return propType;
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
// This handles more types than `getPropType`. Only used for error messages.
|
|
1038
|
-
// See `createPrimitiveTypeChecker`.
|
|
1039
|
-
function getPreciseType(propValue) {
|
|
1040
|
-
if (typeof propValue === 'undefined' || propValue === null) {
|
|
1041
|
-
return '' + propValue;
|
|
1042
|
-
}
|
|
1043
|
-
var propType = getPropType(propValue);
|
|
1044
|
-
if (propType === 'object') {
|
|
1045
|
-
if (propValue instanceof Date) {
|
|
1046
|
-
return 'date';
|
|
1047
|
-
} else if (propValue instanceof RegExp) {
|
|
1048
|
-
return 'regexp';
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
return propType;
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
// Returns a string that is postfixed to a warning about an invalid type.
|
|
1055
|
-
// For example, "undefined" or "of type array"
|
|
1056
|
-
function getPostfixForTypeWarning(value) {
|
|
1057
|
-
var type = getPreciseType(value);
|
|
1058
|
-
switch (type) {
|
|
1059
|
-
case 'array':
|
|
1060
|
-
case 'object':
|
|
1061
|
-
return 'an ' + type;
|
|
1062
|
-
case 'boolean':
|
|
1063
|
-
case 'date':
|
|
1064
|
-
case 'regexp':
|
|
1065
|
-
return 'a ' + type;
|
|
1066
|
-
default:
|
|
1067
|
-
return type;
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
// Returns class name of the object, if any.
|
|
1072
|
-
function getClassName(propValue) {
|
|
1073
|
-
if (!propValue.constructor || !propValue.constructor.name) {
|
|
1074
|
-
return ANONYMOUS;
|
|
1075
|
-
}
|
|
1076
|
-
return propValue.constructor.name;
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
ReactPropTypes.checkPropTypes = checkPropTypes_1;
|
|
1080
|
-
ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache;
|
|
1081
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1082
|
-
|
|
1083
|
-
return ReactPropTypes;
|
|
1084
|
-
};
|
|
1085
|
-
|
|
1086
|
-
function emptyFunction() {}
|
|
1087
|
-
function emptyFunctionWithReset() {}
|
|
1088
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1089
|
-
|
|
1090
|
-
var factoryWithThrowingShims = function() {
|
|
1091
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1092
|
-
if (secret === ReactPropTypesSecret_1) {
|
|
1093
|
-
// It is still safe when called from React.
|
|
1094
|
-
return;
|
|
1095
|
-
}
|
|
1096
|
-
var err = new Error(
|
|
1097
|
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
1098
|
-
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
1099
|
-
'Read more at http://fb.me/use-check-prop-types'
|
|
1100
|
-
);
|
|
1101
|
-
err.name = 'Invariant Violation';
|
|
1102
|
-
throw err;
|
|
1103
|
-
} shim.isRequired = shim;
|
|
1104
|
-
function getShim() {
|
|
1105
|
-
return shim;
|
|
1106
|
-
} // Important!
|
|
1107
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1108
|
-
var ReactPropTypes = {
|
|
1109
|
-
array: shim,
|
|
1110
|
-
bool: shim,
|
|
1111
|
-
func: shim,
|
|
1112
|
-
number: shim,
|
|
1113
|
-
object: shim,
|
|
1114
|
-
string: shim,
|
|
1115
|
-
symbol: shim,
|
|
1116
|
-
|
|
1117
|
-
any: shim,
|
|
1118
|
-
arrayOf: getShim,
|
|
1119
|
-
element: shim,
|
|
1120
|
-
elementType: shim,
|
|
1121
|
-
instanceOf: getShim,
|
|
1122
|
-
node: shim,
|
|
1123
|
-
objectOf: getShim,
|
|
1124
|
-
oneOf: getShim,
|
|
1125
|
-
oneOfType: getShim,
|
|
1126
|
-
shape: getShim,
|
|
1127
|
-
exact: getShim,
|
|
1128
|
-
|
|
1129
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
1130
|
-
resetWarningCache: emptyFunction
|
|
1131
|
-
};
|
|
1132
|
-
|
|
1133
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1134
|
-
|
|
1135
|
-
return ReactPropTypes;
|
|
1136
|
-
};
|
|
1137
|
-
|
|
1138
|
-
var propTypes = createCommonjsModule(function (module) {
|
|
1139
|
-
/**
|
|
1140
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1141
|
-
*
|
|
1142
|
-
* This source code is licensed under the MIT license found in the
|
|
1143
|
-
* LICENSE file in the root directory of this source tree.
|
|
1144
|
-
*/
|
|
1145
|
-
|
|
1146
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1147
|
-
var ReactIs = reactIs;
|
|
1148
|
-
|
|
1149
|
-
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
1150
|
-
// http://fb.me/prop-types-in-prod
|
|
1151
|
-
var throwOnDirectAccess = true;
|
|
1152
|
-
module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
|
1153
|
-
} else {
|
|
1154
|
-
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
1155
|
-
// http://fb.me/prop-types-in-prod
|
|
1156
|
-
module.exports = factoryWithThrowingShims();
|
|
1157
|
-
}
|
|
1158
|
-
});
|
|
1159
|
-
|
|
1160
|
-
var css_248z$1 = "/* Palette */\n/* Semantic usages */\n/* Palette */\n/* Semantic usages */\n.svg {\n max-width: 100px; }\n\n.svg--small {\n max-width: 65px; }\n\n@-webkit-keyframes circle-animation {\n 0% {\n stroke-dashoffset: 75;\n transform: rotate(0); }\n 100% {\n stroke-dashoffset: 75;\n transform: rotate(360deg); } }\n\n@keyframes circle-animation {\n 0% {\n stroke-dashoffset: 75;\n transform: rotate(0); }\n 100% {\n stroke-dashoffset: 75;\n transform: rotate(360deg); } }\n\n.base-circle {\n display: block;\n fill: transparent;\n stroke: #c8eef9;\n stroke-width: 7px; }\n\n.progress-circle, .progress-circle--infinite {\n display: block;\n fill: transparent;\n stroke: #0070c4;\n stroke-linecap: round;\n stroke-dasharray: 283;\n stroke-dashoffset: 280;\n stroke-width: 7px;\n transform-origin: 50% 50%; }\n .progress-circle--infinite {\n -webkit-animation: circle-animation 1.2s linear infinite;\n animation: circle-animation 1.2s linear infinite; }\n\n.progress-message, .progress-message--large, .progress-message--small {\n font-style: normal;\n font-weight: normal; }\n .progress-message--large {\n margin-top: 32px;\n font-size: 24px;\n color: #000; }\n .progress-message--small {\n margin-top: 18px;\n font-size: 18px;\n color: #000; }\n\n.progress-container, .progress-container--small, .progress-container--large {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background: white; }\n .progress-container--large {\n width: 100%;\n height: 100%; }\n\n@-webkit-keyframes rotate {\n 100% {\n transform: rotate(360deg); } }\n\n@keyframes rotate {\n 100% {\n transform: rotate(360deg); } }\n\n.circular-loader {\n -webkit-animation: rotate 1s linear infinite;\n animation: rotate 1s linear infinite; }\n";
|
|
1161
|
-
styleInject(css_248z$1);
|
|
1162
|
-
|
|
1163
|
-
var GoAElementLoader = function GoAElementLoader(_ref) {
|
|
1164
|
-
var _ref$visible = _ref.visible,
|
|
1165
|
-
visible = _ref$visible === void 0 ? false : _ref$visible,
|
|
1166
|
-
_ref$baseColour = _ref.baseColour,
|
|
1167
|
-
baseColour = _ref$baseColour === void 0 ? '#c8eef9' : _ref$baseColour,
|
|
1168
|
-
_ref$spinnerColour = _ref.spinnerColour,
|
|
1169
|
-
spinnerColour = _ref$spinnerColour === void 0 ? '#0070c4' : _ref$spinnerColour,
|
|
1170
|
-
_ref$size = _ref.size,
|
|
1171
|
-
size = _ref$size === void 0 ? 25 : _ref$size;
|
|
1172
|
-
var radius = size;
|
|
1173
|
-
var diameter = radius * 2;
|
|
1174
|
-
|
|
1175
|
-
var boxView = function boxView() {
|
|
1176
|
-
return "0 0 ".concat(diameter, " ").concat(diameter);
|
|
1177
|
-
};
|
|
1178
|
-
/**
|
|
1179
|
-
* Generates the value for an SVG arc.
|
|
1180
|
-
* @param current Current value.
|
|
1181
|
-
* @param total Maximum value.
|
|
1182
|
-
* @param pathRadius Radius of the SVG path.
|
|
1183
|
-
* @param elementRadius Radius of the SVG container.
|
|
1184
|
-
* @param isSemicircle Whether the element should be a semicircle.
|
|
1185
|
-
*/
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
function getArc(current, total, pathRadius, elementRadius) {
|
|
1189
|
-
var isSemicircle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
1190
|
-
var value = Math.max(0, Math.min(current || 0, total));
|
|
1191
|
-
var maxAngle = isSemicircle ? 180 : 359.9999;
|
|
1192
|
-
var percentage = total === 0 ? maxAngle : value / total * maxAngle;
|
|
1193
|
-
|
|
1194
|
-
var start = _polarToCartesian(elementRadius, pathRadius, percentage);
|
|
1195
|
-
|
|
1196
|
-
var end = _polarToCartesian(elementRadius, pathRadius, 0);
|
|
1197
|
-
|
|
1198
|
-
var arcSweep = percentage <= 180 ? 0 : 1;
|
|
1199
|
-
return "M ".concat(start, " A ").concat(pathRadius, " ").concat(pathRadius, " 0 ").concat(arcSweep, " 0 ").concat(end);
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
var DEGREE_IN_RADIANS = Math.PI / 180;
|
|
1203
|
-
/**
|
|
1204
|
-
* Converts polar cooradinates to Cartesian.
|
|
1205
|
-
* @param elementRadius Radius of the wrapper element.
|
|
1206
|
-
* @param pathRadius Radius of the path being described.
|
|
1207
|
-
* @param angleInDegrees Degree to be converted.
|
|
1208
|
-
*/
|
|
1209
|
-
|
|
1210
|
-
function _polarToCartesian(elementRadius, pathRadius, angleInDegrees) {
|
|
1211
|
-
var angleInRadians = (angleInDegrees - 90) * DEGREE_IN_RADIANS;
|
|
1212
|
-
var x = elementRadius + pathRadius * Math.cos(angleInRadians);
|
|
1213
|
-
var y = elementRadius + pathRadius * Math.sin(angleInRadians);
|
|
1214
|
-
return x + ' ' + y;
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
return visible && /*#__PURE__*/React__default.createElement("svg", {
|
|
1218
|
-
className: "circular-loader",
|
|
1219
|
-
fill: "none",
|
|
1220
|
-
viewBox: boxView(),
|
|
1221
|
-
width: "".concat(size),
|
|
1222
|
-
height: "".concat(size),
|
|
1223
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
1224
|
-
}, /*#__PURE__*/React__default.createElement("circle", {
|
|
1225
|
-
cx: "".concat(radius),
|
|
1226
|
-
cy: "".concat(radius),
|
|
1227
|
-
stroke: "".concat(baseColour),
|
|
1228
|
-
strokeWidth: "7",
|
|
1229
|
-
r: "".concat(radius - 7 / 2)
|
|
1230
|
-
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1231
|
-
d: getArc(75, 100, radius - 7 / 2, radius, false),
|
|
1232
|
-
strokeWidth: "7",
|
|
1233
|
-
stroke: "".concat(spinnerColour),
|
|
1234
|
-
strokeLinecap: "round"
|
|
1235
|
-
}));
|
|
1236
|
-
};
|
|
1237
|
-
GoAElementLoader.propTypes = {
|
|
1238
|
-
visible: propTypes.bool,
|
|
1239
|
-
baseColour: propTypes.string,
|
|
1240
|
-
spinnerColour: propTypes.string,
|
|
1241
|
-
size: propTypes.number
|
|
1242
|
-
};
|
|
1243
|
-
|
|
1244
|
-
function _slicedToArray(arr, i) {
|
|
1245
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
function _arrayWithHoles(arr) {
|
|
1249
|
-
if (Array.isArray(arr)) return arr;
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
function _iterableToArrayLimit(arr, i) {
|
|
1253
|
-
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
1254
|
-
var _arr = [];
|
|
1255
|
-
var _n = true;
|
|
1256
|
-
var _d = false;
|
|
1257
|
-
var _e = undefined;
|
|
1258
|
-
|
|
1259
|
-
try {
|
|
1260
|
-
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
1261
|
-
_arr.push(_s.value);
|
|
1262
|
-
|
|
1263
|
-
if (i && _arr.length === i) break;
|
|
1264
|
-
}
|
|
1265
|
-
} catch (err) {
|
|
1266
|
-
_d = true;
|
|
1267
|
-
_e = err;
|
|
1268
|
-
} finally {
|
|
1269
|
-
try {
|
|
1270
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
1271
|
-
} finally {
|
|
1272
|
-
if (_d) throw _e;
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
return _arr;
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
1280
|
-
if (!o) return;
|
|
1281
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
1282
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1283
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1284
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
1285
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
function _arrayLikeToArray(arr, len) {
|
|
1289
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
1290
|
-
|
|
1291
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1292
|
-
|
|
1293
|
-
return arr2;
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
function _nonIterableRest() {
|
|
1297
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
var css_248z$2 = "/* Palette */\n/* Semantic usages */\n.goa-input {\n position: relative; }\n\n.goa-input-error-message {\n font-size: var(--fs-sm);\n font-weight: 300;\n color: red;\n margin: 0; }\n\n.goa-input-help-text-message {\n font-size: var(--fs-sm);\n font-weight: 200;\n color: #333;\n margin: 0; }\n\n.goa-input-field {\n border: 1px solid #666666;\n border-radius: 4px; }\n\n.goa-input-field-error {\n border: 1px solid #ec040b;\n border-radius: 4px; }\n\n.goa-input-highlight-error {\n border: 4px solid #ec040b;\n border-radius: 4px; }\n";
|
|
1301
|
-
styleInject(css_248z$2);
|
|
1302
|
-
|
|
1303
|
-
var GoAInput = function GoAInput(_ref) {
|
|
1304
|
-
var _ref$validate = _ref.validate,
|
|
1305
|
-
validate = _ref$validate === void 0 ? null : _ref$validate,
|
|
1306
|
-
_ref$name = _ref.name,
|
|
1307
|
-
name = _ref$name === void 0 ? '' : _ref$name,
|
|
1308
|
-
_ref$type = _ref.type,
|
|
1309
|
-
type = _ref$type === void 0 ? '' : _ref$type,
|
|
1310
|
-
_ref$message = _ref.message,
|
|
1311
|
-
message = _ref$message === void 0 ? '' : _ref$message,
|
|
1312
|
-
_ref$required = _ref.required,
|
|
1313
|
-
required = _ref$required === void 0 ? false : _ref$required,
|
|
1314
|
-
_ref$helpText = _ref.helpText,
|
|
1315
|
-
helpText = _ref$helpText === void 0 ? '' : _ref$helpText,
|
|
1316
|
-
_ref$multiLine = _ref.multiLine,
|
|
1317
|
-
multiLine = _ref$multiLine === void 0 ? false : _ref$multiLine,
|
|
1318
|
-
_ref$navigator = _ref.navigator,
|
|
1319
|
-
navigator = _ref$navigator === void 0 ? false : _ref$navigator,
|
|
1320
|
-
onChange = _ref.onChange;
|
|
1321
|
-
|
|
1322
|
-
var _useState = React.useState(true),
|
|
1323
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1324
|
-
valid = _useState2[0],
|
|
1325
|
-
setValid = _useState2[1];
|
|
1326
|
-
|
|
1327
|
-
var _useState3 = React.useState(''),
|
|
1328
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1329
|
-
value = _useState4[0],
|
|
1330
|
-
setValue = _useState4[1];
|
|
1331
|
-
|
|
1332
|
-
var handleInput = function handleInput(e) {
|
|
1333
|
-
var value = e.target.value;
|
|
1334
|
-
setValue(value);
|
|
1335
|
-
|
|
1336
|
-
if (validate) {
|
|
1337
|
-
setValid(validate(value));
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
|
-
onChange(value);
|
|
1341
|
-
};
|
|
1342
|
-
|
|
1343
|
-
var inputFieldClass = !message ? 'goa-input-field' : !navigator ? 'goa-input-field-error' : 'goa-input-highlight-error';
|
|
1344
|
-
return /*#__PURE__*/React__default.createElement("div", null, multiLine ? /*#__PURE__*/React__default.createElement("textarea", {
|
|
1345
|
-
placeholder: name,
|
|
1346
|
-
onChange: handleInput,
|
|
1347
|
-
className: inputFieldClass
|
|
1348
|
-
}, value) : /*#__PURE__*/React__default.createElement("input", {
|
|
1349
|
-
type: type,
|
|
1350
|
-
required: required,
|
|
1351
|
-
name: name,
|
|
1352
|
-
value: value,
|
|
1353
|
-
onChange: handleInput,
|
|
1354
|
-
className: inputFieldClass,
|
|
1355
|
-
placeholder: name
|
|
1356
|
-
}), message && /*#__PURE__*/React__default.createElement("p", {
|
|
1357
|
-
className: "goa-input-error-message"
|
|
1358
|
-
}, message), helpText && /*#__PURE__*/React__default.createElement("p", {
|
|
1359
|
-
className: "goa-input-help-text-message"
|
|
1360
|
-
}, helpText));
|
|
1361
|
-
};
|
|
1362
|
-
GoAInput.propTypes = {
|
|
1363
|
-
validate: propTypes.func,
|
|
1364
|
-
name: propTypes.string,
|
|
1365
|
-
type: propTypes.string,
|
|
1366
|
-
message: propTypes.string,
|
|
1367
|
-
required: propTypes.bool,
|
|
1368
|
-
helpText: propTypes.string,
|
|
1369
|
-
multiLine: propTypes.bool,
|
|
1370
|
-
navigator: propTypes.bool,
|
|
1371
|
-
onChange: propTypes.func
|
|
1372
|
-
};
|
|
1373
|
-
|
|
1374
|
-
var css_248z$3 = ".goa-scrollable {\n overflow: hidden;\n height: 100%;\n}\n\n.goa-scrollable > div::-webkit-scrollbar {\n width: 6px;\n}\n\n.goa-scrollable > div::-webkit-scrollbar-track {\n background: #f1f1f1;\n}\n\n.goa-scrollable > div::-webkit-scrollbar-thumb {\n background: #888;\n}\n\n.goa-scrollable > div::-webkit-scrollbar-thumb:hover {\n background: #555;\n}\n";
|
|
1375
|
-
styleInject(css_248z$3);
|
|
1376
|
-
|
|
1377
|
-
var GoAScrollable = function GoAScrollable(_ref) {
|
|
1378
|
-
var vertical = _ref.vertical,
|
|
1379
|
-
horizontal = _ref.horizontal,
|
|
1380
|
-
hPadding = _ref.hPadding,
|
|
1381
|
-
vPadding = _ref.vPadding,
|
|
1382
|
-
height = _ref.height,
|
|
1383
|
-
children = _ref.children,
|
|
1384
|
-
testId = _ref.testId;
|
|
1385
|
-
var style = {
|
|
1386
|
-
overflowY: vertical ? 'auto' : 'hidden',
|
|
1387
|
-
overflowX: horizontal ? 'auto' : 'hidden',
|
|
1388
|
-
height: height !== null && height !== void 0 ? height : '100%',
|
|
1389
|
-
padding: "".concat(vPadding !== null && vPadding !== void 0 ? vPadding : 0, "rem ").concat(hPadding !== null && hPadding !== void 0 ? hPadding : 0, "rem")
|
|
1390
|
-
};
|
|
1391
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1392
|
-
className: "goa-scrollable"
|
|
1393
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1394
|
-
style: style,
|
|
1395
|
-
"data-testid": testId
|
|
1396
|
-
}, children));
|
|
1397
|
-
};
|
|
1398
|
-
|
|
1399
|
-
var css_248z$4 = "/* Root ============================================================================== */\n\n.modal-root {\n position: fixed;\n top: 0;\n left: 0;\n bottom: 0;\n width: 100vw;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n z-index: 1000;\n}\n\n/* Modal ============================================================================== */\n\n.modal {\n position: relative;\n background: #fff;\n transition: opacity 150ms ease-in;\n z-index: 1002;\n}\n\n@media (max-width: 639px) {\n .modal {\n width: 100vw;\n height: 100vh;\n }\n}\n\n@media (min-width: 640px) {\n .modal {\n box-shadow: 6px 6px 6px rgba(0, 0, 0, 0.2);\n border-radius: 4px;\n margin: 1rem;\n max-height: 80vh;\n width: 600px;\n }\n}\n@media (min-width: 1024px) {\n .modal {\n width: 65ch;\n }\n}\n\n/* Modal Content ============================================================================== */\n\n.modal-content {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n/* Modal Actions ============================================================================== */\n\n.modal-actions {\n text-align: right;\n margin: 1rem;\n}\n\n@media (max-width: 639px) {\n .modal-actions button + button {\n margin-top: 0.5rem;\n }\n .modal-actions button {\n display: block;\n width: 100%;\n }\n}\n\n@media (min-width: 640px) {\n .modal-actions > button {\n margin-right: 0;\n }\n .modal-actions > button + button {\n margin-left: 0.5rem;\n }\n}\n\n/* Modal Title ============================================================================ */\n\n.modal-title {\n font-size: var(--fs-xl);\n padding: 1rem;\n margin-right: 40px; /* close icon spacing */\n}\n\n/* Modal Background ======================================================================= */\n\n.modal-background {\n position: fixed;\n inset: 0;\n opacity: 0;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1001;\n transition: opacity 100ms ease-in;\n}\n";
|
|
1400
|
-
styleInject(css_248z$4);
|
|
1401
|
-
|
|
1402
|
-
var css_248z$5 = ".icon-circular {\n padding: 0.5rem;\n top: 0.5rem;\n right: 0.5rem;\n position: absolute;\n cursor: pointer;\n height: 1.5rem;\n width: 1.5rem;\n border-radius: 999px;\n transition: background 200ms ease-in;\n}\n\n.icon-circular:hover {\n background: rgba(0, 0, 0, 0.1);\n}\n";
|
|
1403
|
-
styleInject(css_248z$5);
|
|
1404
|
-
|
|
1405
|
-
var Icons = {
|
|
1406
|
-
close: /*#__PURE__*/React__default.createElement("svg", {
|
|
1407
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1408
|
-
viewBox: "0 0 512 512"
|
|
1409
|
-
}, /*#__PURE__*/React__default.createElement("title", null, "Close"), /*#__PURE__*/React__default.createElement("path", {
|
|
1410
|
-
fill: "none",
|
|
1411
|
-
stroke: "currentColor",
|
|
1412
|
-
strokeLinecap: "round",
|
|
1413
|
-
strokeLinejoin: "round",
|
|
1414
|
-
strokeWidth: "32",
|
|
1415
|
-
d: "M368 368L144 144M368 144L144 368"
|
|
1416
|
-
}))
|
|
1417
|
-
};
|
|
1418
|
-
function GoAIcon(_ref) {
|
|
1419
|
-
var type = _ref.type,
|
|
1420
|
-
_ref$variant = _ref.variant,
|
|
1421
|
-
variant = _ref$variant === void 0 ? 'goa' : _ref$variant,
|
|
1422
|
-
onClick = _ref.onClick,
|
|
1423
|
-
_ref$size = _ref.size,
|
|
1424
|
-
size = _ref$size === void 0 ? 'small' : _ref$size;
|
|
1425
|
-
var pxSize = getSize(size);
|
|
1426
|
-
var styles = {
|
|
1427
|
-
width: "".concat(pxSize, "px"),
|
|
1428
|
-
height: "".concat(pxSize, "px")
|
|
1429
|
-
};
|
|
1430
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1431
|
-
className: "icon-".concat(variant),
|
|
1432
|
-
style: styles,
|
|
1433
|
-
"data-testid": "icon-".concat(type),
|
|
1434
|
-
onClick: onClick
|
|
1435
|
-
}, Icons[type]);
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
function getSize(size) {
|
|
1439
|
-
switch (size) {
|
|
1440
|
-
case 'small':
|
|
1441
|
-
return 24;
|
|
1442
|
-
|
|
1443
|
-
case 'medium':
|
|
1444
|
-
return 32;
|
|
1445
|
-
|
|
1446
|
-
case 'large':
|
|
1447
|
-
return 48;
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
var GoAModal = function GoAModal(_ref) {
|
|
1452
|
-
var children = _ref.children,
|
|
1453
|
-
isOpen = _ref.isOpen,
|
|
1454
|
-
onClose = _ref.onClose,
|
|
1455
|
-
testId = _ref.testId,
|
|
1456
|
-
backgroundTestId = _ref.backgroundTestId;
|
|
1457
|
-
|
|
1458
|
-
var _useState = React.useState('init'),
|
|
1459
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1460
|
-
state = _useState2[0],
|
|
1461
|
-
setState = _useState2[1];
|
|
1462
|
-
|
|
1463
|
-
var _useState3 = React.useState(false),
|
|
1464
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1465
|
-
visible = _useState4[0],
|
|
1466
|
-
setVisible = _useState4[1];
|
|
1467
|
-
|
|
1468
|
-
React.useEffect(function () {
|
|
1469
|
-
if (isOpen) {
|
|
1470
|
-
show();
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
if (!isOpen && state === 'visible') {
|
|
1474
|
-
hide();
|
|
1475
|
-
}
|
|
1476
|
-
}, [isOpen, state]);
|
|
1477
|
-
|
|
1478
|
-
function show() {
|
|
1479
|
-
setVisible(true); // need to perform on the next render cycle to allow the css transitions to take place
|
|
1480
|
-
|
|
1481
|
-
setTimeout(function () {
|
|
1482
|
-
setState('visible');
|
|
1483
|
-
var scrollbarWidth = calculateScrollbarWidth();
|
|
1484
|
-
document.body.style.overflow = 'hidden';
|
|
1485
|
-
document.body.style.paddingRight = scrollbarWidth + 'px';
|
|
1486
|
-
}, 0);
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
function hide() {
|
|
1490
|
-
setState('hidden'); // need to perform on the next render cycle to allow the css transitions to take place
|
|
1491
|
-
|
|
1492
|
-
setTimeout(function () {
|
|
1493
|
-
setVisible(false);
|
|
1494
|
-
document.body.style.overflow = '';
|
|
1495
|
-
document.body.style.paddingRight = '0';
|
|
1496
|
-
}, 300); // 300ms allows for any close animations to complete
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
return visible && /*#__PURE__*/React__default.createElement("div", {
|
|
1500
|
-
className: "modal-root",
|
|
1501
|
-
"data-testid": testId
|
|
1502
|
-
}, /*#__PURE__*/React__default.createElement(Content, {
|
|
1503
|
-
onClick: onClose,
|
|
1504
|
-
visible: state === 'visible'
|
|
1505
|
-
}, children), /*#__PURE__*/React__default.createElement(Background, {
|
|
1506
|
-
onClick: function onClick() {
|
|
1507
|
-
return onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
1508
|
-
},
|
|
1509
|
-
visible: state === 'visible',
|
|
1510
|
-
testId: backgroundTestId
|
|
1511
|
-
}));
|
|
1512
|
-
};
|
|
1513
|
-
// Public Child Components
|
|
1514
|
-
// ******************************************************************************
|
|
1515
|
-
// ***************
|
|
1516
|
-
// GoAModalActions
|
|
1517
|
-
// ***************
|
|
1518
|
-
|
|
1519
|
-
var GoAModalActions = function GoAModalActions(_ref2) {
|
|
1520
|
-
var children = _ref2.children;
|
|
1521
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1522
|
-
className: "modal-actions"
|
|
1523
|
-
}, children);
|
|
1524
|
-
}; // ***************
|
|
1525
|
-
// GoAModalContent
|
|
1526
|
-
// ***************
|
|
1527
|
-
|
|
1528
|
-
var GoAModalContent = function GoAModalContent(_ref3) {
|
|
1529
|
-
var children = _ref3.children,
|
|
1530
|
-
testId = _ref3.testId;
|
|
1531
|
-
return /*#__PURE__*/React__default.createElement(GoAScrollable, {
|
|
1532
|
-
testId: testId,
|
|
1533
|
-
vertical: true,
|
|
1534
|
-
hPadding: 1
|
|
1535
|
-
}, children);
|
|
1536
|
-
}; // *************
|
|
1537
|
-
// GoAModalTitle
|
|
1538
|
-
// *************
|
|
1539
|
-
|
|
1540
|
-
var GoAModalTitle = function GoAModalTitle(_ref4) {
|
|
1541
|
-
var children = _ref4.children,
|
|
1542
|
-
testId = _ref4.testId;
|
|
1543
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1544
|
-
"data-testid": testId,
|
|
1545
|
-
className: "modal-title"
|
|
1546
|
-
}, children);
|
|
1547
|
-
}; // ******************************************************************************
|
|
1548
|
-
// Private Components
|
|
1549
|
-
// ******************************************************************************
|
|
1550
|
-
// *************
|
|
1551
|
-
// Content
|
|
1552
|
-
// *************
|
|
1553
|
-
|
|
1554
|
-
var Content = function Content(_ref5) {
|
|
1555
|
-
var children = _ref5.children,
|
|
1556
|
-
onClick = _ref5.onClick,
|
|
1557
|
-
visible = _ref5.visible;
|
|
1558
|
-
var opacity = visible ? 1 : 0;
|
|
1559
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1560
|
-
className: "modal",
|
|
1561
|
-
onClick: function onClick(e) {
|
|
1562
|
-
return e.stopPropagation();
|
|
1563
|
-
},
|
|
1564
|
-
style: {
|
|
1565
|
-
opacity: opacity
|
|
1566
|
-
}
|
|
1567
|
-
}, onClick && /*#__PURE__*/React__default.createElement(GoAIcon, {
|
|
1568
|
-
type: "close",
|
|
1569
|
-
variant: "circular",
|
|
1570
|
-
onClick: onClick
|
|
1571
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
1572
|
-
className: "modal-content"
|
|
1573
|
-
}, children));
|
|
1574
|
-
}; // ****************
|
|
1575
|
-
// Background
|
|
1576
|
-
// ****************
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
var Background = function Background(_ref6) {
|
|
1580
|
-
var visible = _ref6.visible,
|
|
1581
|
-
onClick = _ref6.onClick,
|
|
1582
|
-
testId = _ref6.testId;
|
|
1583
|
-
var opacity = visible ? 1 : 0;
|
|
1584
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1585
|
-
className: "modal-background",
|
|
1586
|
-
onClick: onClick,
|
|
1587
|
-
style: {
|
|
1588
|
-
opacity: opacity
|
|
1589
|
-
},
|
|
1590
|
-
"data-testid": testId
|
|
1591
|
-
});
|
|
1592
|
-
}; // *******
|
|
1593
|
-
// Helpers
|
|
1594
|
-
// *******
|
|
1595
|
-
|
|
1596
|
-
/**
|
|
1597
|
-
* Based on the an invisible container and the window width it calculates the scrollbar width
|
|
1598
|
-
*/
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
function calculateScrollbarWidth() {
|
|
1602
|
-
// no scrollbars present
|
|
1603
|
-
if (document.body.clientHeight <= document.documentElement.clientHeight) {
|
|
1604
|
-
return 0;
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
var outer = document.createElement('div');
|
|
1608
|
-
outer.style.visibility = 'hidden';
|
|
1609
|
-
outer.style.overflow = 'scroll';
|
|
1610
|
-
document.body.appendChild(outer); // Creating inner element and placing it in the container
|
|
1611
|
-
|
|
1612
|
-
var inner = document.createElement('div');
|
|
1613
|
-
outer.appendChild(inner); // Calculating difference between container's full width and the child width
|
|
1614
|
-
|
|
1615
|
-
var scrollbarWidth = outer.offsetWidth - inner.offsetWidth; // Removing temporary elements from the DOM
|
|
1616
|
-
|
|
1617
|
-
outer.parentNode.removeChild(outer);
|
|
1618
|
-
return scrollbarWidth;
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
var GoAFormItem = function GoAFormItem(_ref) {
|
|
1622
|
-
var children = _ref.children,
|
|
1623
|
-
helpText = _ref.helpText,
|
|
1624
|
-
error = _ref.error;
|
|
1625
|
-
var className = error ? "goa-form-item error" : "goa-form-item";
|
|
1626
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1627
|
-
className: className
|
|
1628
|
-
}, children, error && /*#__PURE__*/React__default.createElement("div", {
|
|
1629
|
-
className: "error-msg"
|
|
1630
|
-
}, error), helpText && !error && /*#__PURE__*/React__default.createElement("div", {
|
|
1631
|
-
id: "helpText",
|
|
1632
|
-
className: "help-msg"
|
|
1633
|
-
}, helpText));
|
|
1634
|
-
};
|
|
1635
|
-
|
|
1636
|
-
var GoAFormActions = function GoAFormActions(_ref) {
|
|
1637
|
-
var children = _ref.children;
|
|
1638
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1639
|
-
className: "goa-form-actions"
|
|
1640
|
-
}, children);
|
|
1641
|
-
};
|
|
1642
|
-
|
|
1643
|
-
var css_248z$6 = "/* Palette */\n/* Semantic usages */\n.goa-form {\n box-sizing: border-box; }\n\n.goa-form *,\n.goa-form *:before,\n.goa-form *:after {\n box-sizing: inherit; }\n\n.goa-form-item {\n margin-bottom: 0.5rem; }\n .goa-form-item label {\n display: block;\n font-weight: bold;\n color: #333; }\n .goa-form-item input,\n .goa-form-item textarea {\n display: block;\n width: 100%;\n padding: 0.5rem;\n border-radius: 4px;\n border: 1px solid var(--color-gray-600); }\n .goa-form-item.error input,\n .goa-form-item.error textarea {\n border-color: var(--color-red-600); }\n .goa-form-item.error .error-msg {\n color: var(--color-red-600); }\n .goa-form-item .help-msg {\n font-size: var(--fs-sm);\n font-weight: 200;\n color: var(--color-gray-600); }\n\n.goa-form-actions {\n margin-top: 2rem; }\n @media (min-width: 640px) {\n .goa-form-actions {\n display: flex;\n justify-content: flex-end;\n align-items: flex-end; }\n .goa-form-actions button {\n min-width: 6rem; }\n .goa-form-actions button + button,\n .goa-form-actions button + .goa-link-button,\n .goa-form-actions .goa-link-button + button,\n .goa-form-actions .goa-link-button + .goa-link-button {\n margin-left: 0.5rem; } }\n .goa-form-actions button {\n margin: 0; }\n";
|
|
1644
|
-
styleInject(css_248z$6);
|
|
1645
|
-
|
|
1646
|
-
var GoAForm = function GoAForm(_ref) {
|
|
1647
|
-
var children = _ref.children;
|
|
1648
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1649
|
-
className: "goa-form"
|
|
1650
|
-
}, children);
|
|
1651
|
-
};
|
|
1652
|
-
|
|
1653
|
-
var css_248z$7 = "@use '../variables/main.css';\n/* Palette */\n/* Semantic usages */\n@-webkit-keyframes pulse {\n 0% {\n opacity: 0.5; }\n 50% {\n opacity: 1; }\n 100% {\n opacity: 0.5; } }\n@keyframes pulse {\n 0% {\n opacity: 0.5; }\n 50% {\n opacity: 1; }\n 100% {\n opacity: 0.5; } }\n\n[data-skeleton] {\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none; }\n [data-skeleton] * {\n border-color: #ddd !important;\n color: transparent !important; }\n [data-skeleton] p,\n [data-skeleton] a {\n background-color: #ddd !important;\n -webkit-animation: pulse 2s infinite ease-in-out;\n animation: pulse 2s infinite ease-in-out;\n display: inline;\n line-height: 0 !important;\n font-size: 50% !important; }\n [data-skeleton] p::after,\n [data-skeleton] a::after {\n content: '' !important;\n display: block !important;\n margin-bottom: 1rem !important;\n background-size: contain; }\n [data-skeleton] h1,\n [data-skeleton] h2,\n [data-skeleton] h3,\n [data-skeleton] h4,\n [data-skeleton] h5,\n [data-skeleton] h6 {\n background-color: #ddd !important;\n -webkit-animation: pulse 2s infinite ease-in-out;\n animation: pulse 2s infinite ease-in-out;\n margin-bottom: 1rem; }\n [data-skeleton] h1 {\n height: calc(0.6 * var(--fs-3xl)) !important; }\n [data-skeleton] h2 {\n height: calc(0.6 * var(--fs-2xl)) !important; }\n [data-skeleton] h3 {\n height: calc(0.6 * var(--fs-xl)) !important; }\n [data-skeleton] h4 {\n height: calc(0.6 * var(--fs-lg)) !important; }\n [data-skeleton] img {\n background-color: #ddd !important;\n -webkit-animation: pulse 2s infinite ease-in-out;\n animation: pulse 2s infinite ease-in-out; }\n\n/* basic styles */\n.skeleton {\n background-color: #ddd !important;\n -webkit-animation: pulse 2s infinite ease-in-out;\n animation: pulse 2s infinite ease-in-out;\n background: #dcdcdc;\n overflow: hidden;\n margin: 10px 0; }\n\n.skeleton.text {\n width: 100%;\n height: 12px;\n border-radius: 4px; }\n\n.skeleton.paragraph {\n width: 100%;\n height: 70px;\n border-radius: 4px; }\n\n.skeleton.title {\n width: 50%;\n height: 20px;\n margin-bottom: 15px;\n border-radius: 4px; }\n\n.skeleton.avatar {\n width: 100px;\n height: 100px;\n border-radius: 50%; }\n\n.skeleton.thumbnail {\n width: 100px;\n height: 100px;\n border-radius: 4px; }\n\n/* skeleton image text */\n.skeleton-image-content {\n display: flex;\n flex-direction: row;\n gap: 30px; }\n\n.skeleton-image-content__text {\n flex: 1 1 auto; }\n\n/* skeleton content */\n.skeleton-content {\n display: grid;\n grid-template-columns: 1fr;\n gap: 30px;\n align-items: left; }\n";
|
|
1654
|
-
styleInject(css_248z$7);
|
|
1655
|
-
|
|
1656
|
-
var GoASkeletonElement = function GoASkeletonElement(_ref) {
|
|
1657
|
-
var _ref$type = _ref.type,
|
|
1658
|
-
type = _ref$type === void 0 ? 'text' : _ref$type;
|
|
1659
|
-
var classes = "skeleton ".concat(type);
|
|
1660
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1661
|
-
className: classes
|
|
1662
|
-
});
|
|
1663
|
-
};
|
|
1664
|
-
|
|
1665
|
-
var GoASkeletonContent = function GoASkeletonContent(_ref) {
|
|
1666
|
-
var _ref$rows = _ref.rows,
|
|
1667
|
-
rows = _ref$rows === void 0 ? 1 : _ref$rows;
|
|
1668
|
-
var elements = [];
|
|
1669
|
-
|
|
1670
|
-
for (var i = 0; i < rows; i++) {
|
|
1671
|
-
elements.push( /*#__PURE__*/React__default.createElement(GoASkeletonElement, {
|
|
1672
|
-
type: "text"
|
|
1673
|
-
}));
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1677
|
-
className: "skeleton-content"
|
|
1678
|
-
}, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(GoASkeletonElement, {
|
|
1679
|
-
type: "title"
|
|
1680
|
-
}), elements));
|
|
1681
|
-
};
|
|
1682
|
-
|
|
1683
|
-
var GoASkeletonGridColumnContent = function GoASkeletonGridColumnContent(_ref) {
|
|
1684
|
-
var _ref$rows = _ref.rows,
|
|
1685
|
-
rows = _ref$rows === void 0 ? 1 : _ref$rows;
|
|
1686
|
-
var elements = [];
|
|
1687
|
-
|
|
1688
|
-
for (var i = 0; i < rows; i++) {
|
|
1689
|
-
elements.push( /*#__PURE__*/React__default.createElement(GoASkeletonElement, {
|
|
1690
|
-
type: "text"
|
|
1691
|
-
}));
|
|
1692
|
-
}
|
|
1693
|
-
|
|
1694
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1695
|
-
className: "skeleton-content"
|
|
1696
|
-
}, /*#__PURE__*/React__default.createElement("div", null, elements));
|
|
1697
|
-
};
|
|
1698
|
-
|
|
1699
|
-
var GoASkeletonImageContent = function GoASkeletonImageContent(_ref) {
|
|
1700
|
-
var _ref$rows = _ref.rows,
|
|
1701
|
-
rows = _ref$rows === void 0 ? 1 : _ref$rows;
|
|
1702
|
-
var elements = [];
|
|
1703
|
-
|
|
1704
|
-
for (var i = 0; i < rows; i++) {
|
|
1705
|
-
elements.push( /*#__PURE__*/React__default.createElement(GoASkeletonElement, {
|
|
1706
|
-
type: "text"
|
|
1707
|
-
}));
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1711
|
-
className: "skeleton-image-content"
|
|
1712
|
-
}, /*#__PURE__*/React__default.createElement(GoASkeletonElement, {
|
|
1713
|
-
type: "thumbnail"
|
|
1714
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
1715
|
-
className: "skeleton-image-content__text"
|
|
1716
|
-
}, /*#__PURE__*/React__default.createElement(GoASkeletonElement, {
|
|
1717
|
-
type: "title"
|
|
1718
|
-
}), elements));
|
|
1719
|
-
};
|
|
1720
|
-
|
|
1721
|
-
exports.GoABadge = GoABadge;
|
|
1722
|
-
exports.GoAElementLoader = GoAElementLoader;
|
|
1723
|
-
exports.GoAForm = GoAForm;
|
|
1724
|
-
exports.GoAFormActions = GoAFormActions;
|
|
1725
|
-
exports.GoAFormItem = GoAFormItem;
|
|
1726
|
-
exports.GoAInput = GoAInput;
|
|
1727
|
-
exports.GoAModal = GoAModal;
|
|
1728
|
-
exports.GoAModalActions = GoAModalActions;
|
|
1729
|
-
exports.GoAModalContent = GoAModalContent;
|
|
1730
|
-
exports.GoAModalTitle = GoAModalTitle;
|
|
1731
|
-
exports.GoAScrollable = GoAScrollable;
|
|
1732
|
-
exports.GoASkeletonContent = GoASkeletonContent;
|
|
1733
|
-
exports.GoASkeletonGridColumnContent = GoASkeletonGridColumnContent;
|
|
1734
|
-
exports.GoASkeletonImageContent = GoASkeletonImageContent;
|
|
1735
|
-
|
|
1736
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1737
|
-
|
|
1738
|
-
})));
|
|
8
|
+
}));
|