@typeolymp/ui-components 1.16.7 → 1.17.1
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/build/components/atoms/Icon/index.d.ts +1 -1
- package/build/components/molecules/FileUpload/index.d.ts +14 -0
- package/build/components/molecules/FileUpload/stories.d.ts +13 -0
- package/build/components/molecules/FileUpload/styles.d.ts +3 -0
- package/build/index.d.ts +3 -2
- package/build/index.es.js +2827 -120
- package/build/index.es.js.map +1 -1
- package/build/index.js +2826 -118
- package/build/index.js.map +1 -1
- package/build/{lib → utils}/translations/index.d.ts +1 -1
- package/build/utils/types/TranslationType.d.ts +11 -0
- package/package.json +5 -3
- package/build/components/atoms/Input/translations.d.ts +0 -11
- package/build/components/molecules/Key/translations.d.ts +0 -5
- package/build/components/molecules/PasswordInputField/translations.d.ts +0 -11
- package/build/components/molecules/Tabs/styles.d.ts +0 -2
- package/build/lib/types/TranslationType.d.ts +0 -7
- /package/build/{lib → utils}/enums.d.ts +0 -0
- /package/build/{lib → utils}/helpers.d.ts +0 -0
- /package/build/{lib → utils}/theme/index.d.ts +0 -0
- /package/build/{lib → utils}/theme/types.d.ts +0 -0
package/build/index.js
CHANGED
|
@@ -250,6 +250,23 @@ function __generator(thisArg, body) {
|
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
function __read(o, n) {
|
|
254
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
255
|
+
if (!m) return o;
|
|
256
|
+
var i = m.call(o), r, ar = [], e;
|
|
257
|
+
try {
|
|
258
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
259
|
+
}
|
|
260
|
+
catch (error) { e = { error: error }; }
|
|
261
|
+
finally {
|
|
262
|
+
try {
|
|
263
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
264
|
+
}
|
|
265
|
+
finally { if (e) throw e.error; }
|
|
266
|
+
}
|
|
267
|
+
return ar;
|
|
268
|
+
}
|
|
269
|
+
|
|
253
270
|
function __spreadArray(to, from, pack) {
|
|
254
271
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
255
272
|
if (ar || !(i in from)) {
|
|
@@ -463,7 +480,7 @@ var from = String.fromCharCode;
|
|
|
463
480
|
* @param {object}
|
|
464
481
|
* @return {object}
|
|
465
482
|
*/
|
|
466
|
-
var assign = Object.assign;
|
|
483
|
+
var assign$1 = Object.assign;
|
|
467
484
|
|
|
468
485
|
/**
|
|
469
486
|
* @param {string} value
|
|
@@ -589,7 +606,7 @@ function node$1 (value, root, parent, type, props, children, length) {
|
|
|
589
606
|
* @return {object}
|
|
590
607
|
*/
|
|
591
608
|
function copy (root, props) {
|
|
592
|
-
return assign(node$1('', null, null, '', null, null, 0), root, {length: -root.length}, props)
|
|
609
|
+
return assign$1(node$1('', null, null, '', null, null, 0), root, {length: -root.length}, props)
|
|
593
610
|
}
|
|
594
611
|
|
|
595
612
|
/**
|
|
@@ -1978,7 +1995,7 @@ function getStatics(component) {
|
|
|
1978
1995
|
|
|
1979
1996
|
var defineProperty = Object.defineProperty;
|
|
1980
1997
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
1981
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
1998
|
+
var getOwnPropertySymbols$1 = Object.getOwnPropertySymbols;
|
|
1982
1999
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
1983
2000
|
var getPrototypeOf = Object.getPrototypeOf;
|
|
1984
2001
|
var objectPrototype = Object.prototype;
|
|
@@ -1995,8 +2012,8 @@ function hoistNonReactStatics$2(targetComponent, sourceComponent, blacklist) {
|
|
|
1995
2012
|
|
|
1996
2013
|
var keys = getOwnPropertyNames(sourceComponent);
|
|
1997
2014
|
|
|
1998
|
-
if (getOwnPropertySymbols) {
|
|
1999
|
-
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
|
2015
|
+
if (getOwnPropertySymbols$1) {
|
|
2016
|
+
keys = keys.concat(getOwnPropertySymbols$1(sourceComponent));
|
|
2000
2017
|
}
|
|
2001
2018
|
|
|
2002
2019
|
var targetStatics = getStatics(targetComponent);
|
|
@@ -2508,7 +2525,7 @@ var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$2 ? syncFallback : use
|
|
|
2508
2525
|
var useInsertionEffectWithLayoutFallback = useInsertionEffect || React$3.useLayoutEffect;
|
|
2509
2526
|
|
|
2510
2527
|
var isBrowser$1 = typeof document !== 'undefined';
|
|
2511
|
-
var hasOwnProperty = {}.hasOwnProperty;
|
|
2528
|
+
var hasOwnProperty$1 = {}.hasOwnProperty;
|
|
2512
2529
|
|
|
2513
2530
|
var EmotionCacheContext = /* #__PURE__ */React$3.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
|
|
2514
2531
|
// because this module is primarily intended for the browser and node
|
|
@@ -2677,7 +2694,7 @@ var createEmotionProps = function createEmotionProps(type, props) {
|
|
|
2677
2694
|
var newProps = {};
|
|
2678
2695
|
|
|
2679
2696
|
for (var key in props) {
|
|
2680
|
-
if (hasOwnProperty.call(props, key)) {
|
|
2697
|
+
if (hasOwnProperty$1.call(props, key)) {
|
|
2681
2698
|
newProps[key] = props[key];
|
|
2682
2699
|
}
|
|
2683
2700
|
}
|
|
@@ -2754,7 +2771,7 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
2754
2771
|
var newProps = {};
|
|
2755
2772
|
|
|
2756
2773
|
for (var key in props) {
|
|
2757
|
-
if (hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && (process.env.NODE_ENV === 'production' || key !== labelPropName)) {
|
|
2774
|
+
if (hasOwnProperty$1.call(props, key) && key !== 'css' && key !== typePropName && (process.env.NODE_ENV === 'production' || key !== labelPropName)) {
|
|
2758
2775
|
newProps[key] = props[key];
|
|
2759
2776
|
}
|
|
2760
2777
|
}
|
|
@@ -2893,7 +2910,7 @@ var pkg = {
|
|
|
2893
2910
|
var jsx = function jsx(type, props) {
|
|
2894
2911
|
var args = arguments;
|
|
2895
2912
|
|
|
2896
|
-
if (props == null || !hasOwnProperty.call(props, 'css')) {
|
|
2913
|
+
if (props == null || !hasOwnProperty$1.call(props, 'css')) {
|
|
2897
2914
|
// $FlowFixMe
|
|
2898
2915
|
return React$3.createElement.apply(undefined, args);
|
|
2899
2916
|
}
|
|
@@ -3441,14 +3458,14 @@ Object.defineProperty(BeatLoader, "__esModule", { value: true });
|
|
|
3441
3458
|
var React$2 = __importStar$2(React__default["default"]);
|
|
3442
3459
|
var react_1 = require$$1;
|
|
3443
3460
|
var helpers_1 = helpers$1;
|
|
3444
|
-
var beat = react_1.keyframes(templateObject_1$
|
|
3461
|
+
var beat = react_1.keyframes(templateObject_1$U || (templateObject_1$U = __makeTemplateObject(["\n 50% {transform: scale(0.75);opacity: 0.2}\n 100% {transform: scale(1);opacity: 1}\n"], ["\n 50% {transform: scale(0.75);opacity: 0.2}\n 100% {transform: scale(1);opacity: 1}\n"])));
|
|
3445
3462
|
var Loader = /** @class */ (function (_super) {
|
|
3446
3463
|
__extends$1(Loader, _super);
|
|
3447
3464
|
function Loader() {
|
|
3448
3465
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
3449
3466
|
_this.style = function (i) {
|
|
3450
3467
|
var _a = _this.props, color = _a.color, size = _a.size, margin = _a.margin, speedMultiplier = _a.speedMultiplier;
|
|
3451
|
-
return react_1.css(templateObject_2$
|
|
3468
|
+
return react_1.css(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n display: inline-block;\n background-color: ", ";\n width: ", ";\n height: ", ";\n margin: ", ";\n border-radius: 100%;\n animation: ", " ", "s ", "\n infinite linear;\n animation-fill-mode: both;\n "], ["\n display: inline-block;\n background-color: ", ";\n width: ", ";\n height: ", ";\n margin: ", ";\n border-radius: 100%;\n animation: ", " ", "s ", "\n infinite linear;\n animation-fill-mode: both;\n "])), color, helpers_1.cssValue(size), helpers_1.cssValue(size), helpers_1.cssValue(margin), beat, 0.7 / speedMultiplier, i % 2 ? "0s" : 0.35 / speedMultiplier + "s");
|
|
3452
3469
|
};
|
|
3453
3470
|
return _this;
|
|
3454
3471
|
}
|
|
@@ -3462,10 +3479,10 @@ var Loader = /** @class */ (function (_super) {
|
|
|
3462
3479
|
Loader.defaultProps = helpers_1.sizeMarginDefaults(15);
|
|
3463
3480
|
return Loader;
|
|
3464
3481
|
}(React$2.PureComponent));
|
|
3465
|
-
var _default = BeatLoader.default = Loader;
|
|
3466
|
-
var templateObject_1$
|
|
3482
|
+
var _default$1 = BeatLoader.default = Loader;
|
|
3483
|
+
var templateObject_1$U, templateObject_2$A;
|
|
3467
3484
|
|
|
3468
|
-
var StyledButton = styled__default["default"].button(templateObject_1$
|
|
3485
|
+
var StyledButton = styled__default["default"].button(templateObject_1$T || (templateObject_1$T = __makeTemplateObject$1(["\n width: ", ";\n height: ", ";\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 13px 20px 16px;\n background-color: ", ";\n box-shadow: ", ";\n\n border: ", ";\n border-radius: 6px;\n box-sizing: border-box;\n text-decoration: none;\n cursor: pointer;\n\n span {\n color: ", ";\n font-family: ", ";\n font-style: normal;\n font-weight: bold;\n font-size: ", ";\n }\n\n :hover {\n opacity: 0.85;\n }\n\n :active {\n box-shadow: none;\n margin-top: ", ";\n height: ", ";\n }\n"], ["\n width: ", ";\n height: ", ";\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 13px 20px 16px;\n background-color: ", ";\n box-shadow: ", ";\n\n border: ", ";\n border-radius: 6px;\n box-sizing: border-box;\n text-decoration: none;\n cursor: pointer;\n\n span {\n color: ", ";\n font-family: ", ";\n font-style: normal;\n font-weight: bold;\n font-size: ", ";\n }\n\n :hover {\n opacity: 0.85;\n }\n\n :active {\n box-shadow: none;\n margin-top: ", ";\n height: ", ";\n }\n"])), function (_a) {
|
|
3469
3486
|
var fluid = _a.fluid;
|
|
3470
3487
|
return (fluid ? "100%" : "fit-content");
|
|
3471
3488
|
}, function (_a) {
|
|
@@ -3519,11 +3536,11 @@ var StyledButton = styled__default["default"].button(templateObject_1$S || (temp
|
|
|
3519
3536
|
? theme.button.medium.heightActive
|
|
3520
3537
|
: theme.button[size].heightActive;
|
|
3521
3538
|
});
|
|
3522
|
-
var DisabledButton = styled__default["default"](StyledButton)(templateObject_2$
|
|
3539
|
+
var DisabledButton = styled__default["default"](StyledButton)(templateObject_2$z || (templateObject_2$z = __makeTemplateObject$1(["\n background-color: ", ";\n border: 1px solid ", ";\n box-shadow: none;\n padding: 16px 20px;\n cursor: not-allowed;\n\n span {\n color: ", ";\n }\n\n :active {\n margin-top: 0;\n height: ", ";\n }\n"], ["\n background-color: ", ";\n border: 1px solid ", ";\n box-shadow: none;\n padding: 16px 20px;\n cursor: not-allowed;\n\n span {\n color: ", ";\n }\n\n :active {\n margin-top: 0;\n height: ", ";\n }\n"])), theme.colors.lightGray.dark, theme.colors.lightGray.darker, theme.colors.lightGray.darker, function (_a) {
|
|
3523
3540
|
var size = _a.size;
|
|
3524
3541
|
return !size ? theme.button.medium.height : theme.button[size].height;
|
|
3525
3542
|
});
|
|
3526
|
-
var GhostButton = styled__default["default"](StyledButton)(templateObject_3$
|
|
3543
|
+
var GhostButton = styled__default["default"](StyledButton)(templateObject_3$d || (templateObject_3$d = __makeTemplateObject$1(["\n height: ", ";\n padding: 16px 18px;\n\n :active {\n box-shadow: none;\n height: ", ";\n margin-top: ", ";\n margin-bottom: -2.5px;\n }\n"], ["\n height: ", ";\n padding: 16px 18px;\n\n :active {\n box-shadow: none;\n height: ", ";\n margin-top: ", ";\n margin-bottom: -2.5px;\n }\n"])), function (_a) {
|
|
3527
3544
|
var size = _a.size;
|
|
3528
3545
|
return !size
|
|
3529
3546
|
? "calc(".concat(theme.button.medium.height, " - 2.5px)")
|
|
@@ -3546,7 +3563,7 @@ var LoaderWrapper = styled__default["default"].div(templateObject_4$8 || (templa
|
|
|
3546
3563
|
var size = _a.size;
|
|
3547
3564
|
return (size === "small" ? "3px" : "");
|
|
3548
3565
|
});
|
|
3549
|
-
var templateObject_1$
|
|
3566
|
+
var templateObject_1$T, templateObject_2$z, templateObject_3$d, templateObject_4$8;
|
|
3550
3567
|
|
|
3551
3568
|
var Button = React$3.forwardRef(function (_a, ref) {
|
|
3552
3569
|
var label = _a.label, color = _a.color, size = _a.size, fluid = _a.fluid, disabled = _a.disabled, type = _a.type, tabIndex = _a.tabIndex, href = _a.href, asAnchor = _a.asAnchor, props = __rest(_a, ["label", "color", "size", "fluid", "disabled", "type", "tabIndex", "href", "asAnchor"]);
|
|
@@ -3574,7 +3591,7 @@ var Button = React$3.forwardRef(function (_a, ref) {
|
|
|
3574
3591
|
var width = ((_b = buttonRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth) - 40;
|
|
3575
3592
|
if (dark)
|
|
3576
3593
|
width = width + 4;
|
|
3577
|
-
return (jsxRuntime.jsx(LoaderWrapper, __assign$2({ width: width, size: size }, { children: jsxRuntime.jsx(_default, { size: 10, color: dark
|
|
3594
|
+
return (jsxRuntime.jsx(LoaderWrapper, __assign$2({ width: width, size: size }, { children: jsxRuntime.jsx(_default$1, { size: 10, color: dark
|
|
3578
3595
|
? theme.colors.lightGray.darker
|
|
3579
3596
|
: theme.colors.lightGray.light, speedMultiplier: 0.5 }) })));
|
|
3580
3597
|
};
|
|
@@ -3586,7 +3603,7 @@ var Button = React$3.forwardRef(function (_a, ref) {
|
|
|
3586
3603
|
return (jsxRuntime.jsx(StyledButton, __assign$2({ color: color, size: size, fluid: fluid, type: type, tabIndex: tabIndex, as: as, href: href, ref: ref ? ref : buttonRef, onClick: onClick }, { children: isLoading ? jsxRuntime.jsx(Loader, {}) : jsxRuntime.jsx("span", { children: label }) })));
|
|
3587
3604
|
});
|
|
3588
3605
|
|
|
3589
|
-
var StyledCheckbox = styled__default["default"].div(templateObject_1$
|
|
3606
|
+
var StyledCheckbox = styled__default["default"].div(templateObject_1$S || (templateObject_1$S = __makeTemplateObject$1(["\n min-height: 25px;\n max-height: 25px;\n min-width: 25px;\n max-width: 25px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n cursor: ", ";\n background-color: ", ";\n\n svg {\n margin-left: -1px;\n fill: ", ";\n }\n\n input {\n display: none;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"], ["\n min-height: 25px;\n max-height: 25px;\n min-width: 25px;\n max-width: 25px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n cursor: ", ";\n background-color: ", ";\n\n svg {\n margin-left: -1px;\n fill: ", ";\n }\n\n input {\n display: none;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"])), function (_a) {
|
|
3590
3607
|
var checked = _a.checked, disabled = _a.disabled;
|
|
3591
3608
|
if (disabled)
|
|
3592
3609
|
return theme.colors.lightGray.darker;
|
|
@@ -3607,7 +3624,7 @@ var StyledCheckbox = styled__default["default"].div(templateObject_1$R || (templ
|
|
|
3607
3624
|
return theme.colors.green.base;
|
|
3608
3625
|
return theme.colors.lightGray.darker;
|
|
3609
3626
|
}, theme.colors.blue.dark, "0 0 0 1px ".concat(theme.colors.blue.dark));
|
|
3610
|
-
var templateObject_1$
|
|
3627
|
+
var templateObject_1$S;
|
|
3611
3628
|
|
|
3612
3629
|
var Checkbox = function (props) {
|
|
3613
3630
|
var _a;
|
|
@@ -3640,7 +3657,7 @@ var Checkbox = function (props) {
|
|
|
3640
3657
|
return (jsxRuntime.jsxs(StyledCheckbox, __assign$2({ checked: checked, disabled: props.disabled, tabIndex: 0, onClick: toggle, onBlur: props.onBlur, onKeyPress: function (e) { return (e.key === "Enter" ? toggle() : null); }, ref: wrapperRef }, { children: [checked && (jsxRuntime.jsx("svg", __assign$2({ width: 16, height: 12, viewBox: "0 0 16 12", fill: "none" }, { children: jsxRuntime.jsx("path", { d: "M12.61.563l-6.585 6.6L3.439 4.57a1.997 1.997 0 00-3.374.885c-.183.7.026 1.446.546 1.949l4 4.008a1.997 1.997 0 002.828 0l8-8.017a2.007 2.007 0 00-.025-2.809 1.997 1.997 0 00-2.803-.024z" }) }))), jsxRuntime.jsx("input", { type: "checkbox", disabled: !!props.disabled, id: props.id, name: props.name, value: props.value, ref: inputRef })] })));
|
|
3641
3658
|
};
|
|
3642
3659
|
|
|
3643
|
-
var Wrapper$a = styled__default["default"].div(templateObject_1$
|
|
3660
|
+
var Wrapper$a = styled__default["default"].div(templateObject_1$R || (templateObject_1$R = __makeTemplateObject$1(["\n width: ", ";\n height: ", ";\n"], ["\n width: ", ";\n height: ", ";\n"])), function (_a) {
|
|
3644
3661
|
var size = _a.size;
|
|
3645
3662
|
switch (size) {
|
|
3646
3663
|
case "small":
|
|
@@ -3663,7 +3680,7 @@ var Wrapper$a = styled__default["default"].div(templateObject_1$Q || (templateOb
|
|
|
3663
3680
|
return "27px";
|
|
3664
3681
|
}
|
|
3665
3682
|
});
|
|
3666
|
-
var templateObject_1$
|
|
3683
|
+
var templateObject_1$R;
|
|
3667
3684
|
|
|
3668
3685
|
var parsers = {};
|
|
3669
3686
|
|
|
@@ -3671,6 +3688,48 @@ var getCountryByLocale$1 = {};
|
|
|
3671
3688
|
|
|
3672
3689
|
var enums = {};
|
|
3673
3690
|
|
|
3691
|
+
var AccountType = {};
|
|
3692
|
+
|
|
3693
|
+
(function (exports) {
|
|
3694
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3695
|
+
exports.AccountType = void 0;
|
|
3696
|
+
(function (AccountType) {
|
|
3697
|
+
AccountType["STUDENT"] = "student";
|
|
3698
|
+
AccountType["PARENT"] = "parent";
|
|
3699
|
+
AccountType["TUTOR"] = "tutor";
|
|
3700
|
+
})(exports.AccountType || (exports.AccountType = {}));
|
|
3701
|
+
|
|
3702
|
+
}(AccountType));
|
|
3703
|
+
|
|
3704
|
+
var AchievementType = {};
|
|
3705
|
+
|
|
3706
|
+
(function (exports) {
|
|
3707
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3708
|
+
exports.AchievementType = void 0;
|
|
3709
|
+
(function (AchievementType) {
|
|
3710
|
+
AchievementType["PRACTICE_TIME"] = "practiceTime";
|
|
3711
|
+
AchievementType["PRACTICE_STREAK"] = "practiceStreak";
|
|
3712
|
+
AchievementType["MEDALS"] = "medals";
|
|
3713
|
+
})(exports.AchievementType || (exports.AchievementType = {}));
|
|
3714
|
+
|
|
3715
|
+
}(AchievementType));
|
|
3716
|
+
|
|
3717
|
+
var ChartDataType = {};
|
|
3718
|
+
|
|
3719
|
+
(function (exports) {
|
|
3720
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3721
|
+
exports.ChartDataType = void 0;
|
|
3722
|
+
(function (ChartDataType) {
|
|
3723
|
+
ChartDataType["PROGRESS"] = "progress";
|
|
3724
|
+
ChartDataType["TIME_PRACTISED"] = "timePractised";
|
|
3725
|
+
ChartDataType["RESULTS"] = "results";
|
|
3726
|
+
ChartDataType["HITS"] = "hits";
|
|
3727
|
+
ChartDataType["KPM"] = "kpm";
|
|
3728
|
+
ChartDataType["ACCURACY"] = "accuracy";
|
|
3729
|
+
})(exports.ChartDataType || (exports.ChartDataType = {}));
|
|
3730
|
+
|
|
3731
|
+
}(ChartDataType));
|
|
3732
|
+
|
|
3674
3733
|
var Color = {};
|
|
3675
3734
|
|
|
3676
3735
|
(function (exports) {
|
|
@@ -3714,6 +3773,69 @@ exports.CourseTranslation = void 0;
|
|
|
3714
3773
|
|
|
3715
3774
|
}(CourseTranslation));
|
|
3716
3775
|
|
|
3776
|
+
var Currency = {};
|
|
3777
|
+
|
|
3778
|
+
(function (exports) {
|
|
3779
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3780
|
+
exports.Currency = void 0;
|
|
3781
|
+
(function (Currency) {
|
|
3782
|
+
Currency["EUR"] = "EUR";
|
|
3783
|
+
Currency["GBP"] = "GBP";
|
|
3784
|
+
Currency["USD"] = "USD";
|
|
3785
|
+
})(exports.Currency || (exports.Currency = {}));
|
|
3786
|
+
|
|
3787
|
+
}(Currency));
|
|
3788
|
+
|
|
3789
|
+
var ExerciseType = {};
|
|
3790
|
+
|
|
3791
|
+
(function (exports) {
|
|
3792
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3793
|
+
exports.ExerciseType = void 0;
|
|
3794
|
+
(function (ExerciseType) {
|
|
3795
|
+
ExerciseType["KEYS"] = "keys";
|
|
3796
|
+
ExerciseType["DRILLS"] = "drills";
|
|
3797
|
+
ExerciseType["WORDS"] = "words";
|
|
3798
|
+
ExerciseType["TEXT"] = "text";
|
|
3799
|
+
})(exports.ExerciseType || (exports.ExerciseType = {}));
|
|
3800
|
+
|
|
3801
|
+
}(ExerciseType));
|
|
3802
|
+
|
|
3803
|
+
var HttpStatus = {};
|
|
3804
|
+
|
|
3805
|
+
(function (exports) {
|
|
3806
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3807
|
+
exports.HttpStatusText = exports.HttpStatusCode = void 0;
|
|
3808
|
+
(function (HttpStatusCode) {
|
|
3809
|
+
// 2xx Success
|
|
3810
|
+
HttpStatusCode[HttpStatusCode["OK"] = 200] = "OK";
|
|
3811
|
+
HttpStatusCode[HttpStatusCode["CREATED"] = 201] = "CREATED";
|
|
3812
|
+
// 4xx Client Errors
|
|
3813
|
+
HttpStatusCode[HttpStatusCode["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
3814
|
+
HttpStatusCode[HttpStatusCode["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
3815
|
+
HttpStatusCode[HttpStatusCode["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
3816
|
+
HttpStatusCode[HttpStatusCode["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
3817
|
+
HttpStatusCode[HttpStatusCode["CONFLICT"] = 409] = "CONFLICT";
|
|
3818
|
+
// 5xx Server Errors
|
|
3819
|
+
HttpStatusCode[HttpStatusCode["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
3820
|
+
HttpStatusCode[HttpStatusCode["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
3821
|
+
})(exports.HttpStatusCode || (exports.HttpStatusCode = {}));
|
|
3822
|
+
(function (HttpStatusText) {
|
|
3823
|
+
// 2xx Success
|
|
3824
|
+
HttpStatusText["OK"] = "OK";
|
|
3825
|
+
HttpStatusText["CREATED"] = "Created";
|
|
3826
|
+
// 4xx Client Errors
|
|
3827
|
+
HttpStatusText["BAD_REQUEST"] = "Bad Request";
|
|
3828
|
+
HttpStatusText["UNAUTHORIZED"] = "Unauthorized";
|
|
3829
|
+
HttpStatusText["FORBIDDEN"] = "Forbidden";
|
|
3830
|
+
HttpStatusText["NOT_FOUND"] = "Not Found";
|
|
3831
|
+
HttpStatusText["CONFLICT"] = "Conflict";
|
|
3832
|
+
// 5xx Server Errors
|
|
3833
|
+
HttpStatusText["INTERNAL_SERVER_ERROR"] = "Internal Server Error";
|
|
3834
|
+
HttpStatusText["NOT_IMPLEMENTED"] = "Not Implemented";
|
|
3835
|
+
})(exports.HttpStatusText || (exports.HttpStatusText = {}));
|
|
3836
|
+
|
|
3837
|
+
}(HttpStatus));
|
|
3838
|
+
|
|
3717
3839
|
var KeyboardLayout = {};
|
|
3718
3840
|
|
|
3719
3841
|
(function (exports) {
|
|
@@ -3747,6 +3869,32 @@ exports.Locale = void 0;
|
|
|
3747
3869
|
|
|
3748
3870
|
}(Locale));
|
|
3749
3871
|
|
|
3872
|
+
var Medal$1 = {};
|
|
3873
|
+
|
|
3874
|
+
(function (exports) {
|
|
3875
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3876
|
+
exports.Medal = void 0;
|
|
3877
|
+
(function (Medal) {
|
|
3878
|
+
Medal["GOLD"] = "gold";
|
|
3879
|
+
Medal["SILVER"] = "silver";
|
|
3880
|
+
Medal["BRONZE"] = "bronze";
|
|
3881
|
+
})(exports.Medal || (exports.Medal = {}));
|
|
3882
|
+
|
|
3883
|
+
}(Medal$1));
|
|
3884
|
+
|
|
3885
|
+
var NodeEnv = {};
|
|
3886
|
+
|
|
3887
|
+
(function (exports) {
|
|
3888
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3889
|
+
exports.NodeEnv = void 0;
|
|
3890
|
+
(function (NodeEnv) {
|
|
3891
|
+
NodeEnv["TEST"] = "test";
|
|
3892
|
+
NodeEnv["DEVELOPMENT"] = "development";
|
|
3893
|
+
NodeEnv["PRODUCTION"] = "production";
|
|
3894
|
+
})(exports.NodeEnv || (exports.NodeEnv = {}));
|
|
3895
|
+
|
|
3896
|
+
}(NodeEnv));
|
|
3897
|
+
|
|
3750
3898
|
var Plan = {};
|
|
3751
3899
|
|
|
3752
3900
|
(function (exports) {
|
|
@@ -3778,19 +3926,6 @@ exports.TextTopic = void 0;
|
|
|
3778
3926
|
|
|
3779
3927
|
}(TextTopic));
|
|
3780
3928
|
|
|
3781
|
-
var Medal$1 = {};
|
|
3782
|
-
|
|
3783
|
-
(function (exports) {
|
|
3784
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3785
|
-
exports.Medal = void 0;
|
|
3786
|
-
(function (Medal) {
|
|
3787
|
-
Medal["GOLD"] = "gold";
|
|
3788
|
-
Medal["SILVER"] = "silver";
|
|
3789
|
-
Medal["BRONZE"] = "bronze";
|
|
3790
|
-
})(exports.Medal || (exports.Medal = {}));
|
|
3791
|
-
|
|
3792
|
-
}(Medal$1));
|
|
3793
|
-
|
|
3794
3929
|
(function (exports) {
|
|
3795
3930
|
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3796
3931
|
if (k2 === undefined) k2 = k;
|
|
@@ -3807,14 +3942,21 @@ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m
|
|
|
3807
3942
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
3808
3943
|
};
|
|
3809
3944
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3945
|
+
__exportStar(AccountType, exports);
|
|
3946
|
+
__exportStar(AchievementType, exports);
|
|
3947
|
+
__exportStar(ChartDataType, exports);
|
|
3810
3948
|
__exportStar(Color, exports);
|
|
3811
3949
|
__exportStar(Country, exports);
|
|
3812
3950
|
__exportStar(CourseTranslation, exports);
|
|
3951
|
+
__exportStar(Currency, exports);
|
|
3952
|
+
__exportStar(ExerciseType, exports);
|
|
3953
|
+
__exportStar(HttpStatus, exports);
|
|
3813
3954
|
__exportStar(KeyboardLayout, exports);
|
|
3814
3955
|
__exportStar(Locale, exports);
|
|
3956
|
+
__exportStar(Medal$1, exports);
|
|
3957
|
+
__exportStar(NodeEnv, exports);
|
|
3815
3958
|
__exportStar(Plan, exports);
|
|
3816
3959
|
__exportStar(TextTopic, exports);
|
|
3817
|
-
__exportStar(Medal$1, exports);
|
|
3818
3960
|
|
|
3819
3961
|
}(enums));
|
|
3820
3962
|
|
|
@@ -3934,7 +4076,7 @@ var flags = {
|
|
|
3934
4076
|
};
|
|
3935
4077
|
var Flag = function (props) { return (jsxRuntime.jsx(Wrapper$a, __assign$2({}, props, { children: flags[parsers.getCountryCodeByLocale(props.locale)] }))); };
|
|
3936
4078
|
|
|
3937
|
-
var StyledHeading = styled__default["default"].span(templateObject_1$
|
|
4079
|
+
var StyledHeading = styled__default["default"].span(templateObject_1$Q || (templateObject_1$Q = __makeTemplateObject$1(["\n font-family: ", ";\n font-size: ", ";\n font-weight: 700;\n font-style: normal;\n line-height: ", ";\n letter-spacing: ", ";\n margin: 0;\n color: ", ";\n text-align: ", ";\n"], ["\n font-family: ", ";\n font-size: ", ";\n font-weight: 700;\n font-style: normal;\n line-height: ", ";\n letter-spacing: ", ";\n margin: 0;\n color: ", ";\n text-align: ", ";\n"])), theme.fonts.heading, function (_a) {
|
|
3938
4080
|
var type = _a.type;
|
|
3939
4081
|
return theme.heading[type].fontSize;
|
|
3940
4082
|
}, function (_a) {
|
|
@@ -3958,14 +4100,14 @@ var StyledHeading = styled__default["default"].span(templateObject_1$P || (templ
|
|
|
3958
4100
|
var align = _a.align;
|
|
3959
4101
|
return align;
|
|
3960
4102
|
});
|
|
3961
|
-
var templateObject_1$
|
|
4103
|
+
var templateObject_1$Q;
|
|
3962
4104
|
|
|
3963
4105
|
var Heading = function (props) {
|
|
3964
4106
|
var element = !!props.as ? props.as : props.type;
|
|
3965
4107
|
return (jsxRuntime.jsx(StyledHeading, __assign$2({}, props, { as: element }, { children: props.children })));
|
|
3966
4108
|
};
|
|
3967
4109
|
|
|
3968
|
-
var Wrapper$9 = styled__default["default"].div(templateObject_1$
|
|
4110
|
+
var Wrapper$9 = styled__default["default"].div(templateObject_1$P || (templateObject_1$P = __makeTemplateObject$1(["\n width: ", ";\n height: ", ";\n\n > svg {\n fill: ", ";\n\n :hover {\n cursor: ", ";\n fill: ", ";\n }\n }\n"], ["\n width: ", ";\n height: ", ";\n\n > svg {\n fill: ", ";\n\n :hover {\n cursor: ", ";\n fill: ", ";\n }\n }\n"])), function (_a) {
|
|
3969
4111
|
var size = _a.size;
|
|
3970
4112
|
return theme.icon[size] || theme.icon.medium;
|
|
3971
4113
|
}, function (_a) {
|
|
@@ -4023,7 +4165,7 @@ var Wrapper$9 = styled__default["default"].div(templateObject_1$O || (templateOb
|
|
|
4023
4165
|
return theme.colors.lightGray.base;
|
|
4024
4166
|
}
|
|
4025
4167
|
});
|
|
4026
|
-
var templateObject_1$
|
|
4168
|
+
var templateObject_1$P;
|
|
4027
4169
|
|
|
4028
4170
|
var icons = {
|
|
4029
4171
|
check: (jsxRuntime.jsx("path", { d: "M16.6107 6.5626L10.0247 13.1623L7.43866 10.5709C6.9365 10.0499 6.19289 9.841 5.49363 10.0244C4.79436 10.2078 4.24826 10.7551 4.06523 11.4558C3.8822 12.1565 4.09071 12.9017 4.61063 13.4049L8.61067 17.4132C9.39168 18.1956 10.6577 18.1956 11.4387 17.4132L19.4388 9.3965C20.1967 8.6101 20.1859 7.36009 19.4144 6.58701C18.6429 5.81393 17.3955 5.80307 16.6107 6.5626Z" })),
|
|
@@ -4054,10 +4196,11 @@ var icons = {
|
|
|
4054
4196
|
thunder: (jsxRuntime.jsx("path", { d: "M20.3 8.7h-6.9l.6-7.6c0-.3-.1-.6-.3-.8-.2-.2-.5-.3-.7-.3-.3 0-.6.2-.7.4L2.9 13.6c-.1.2-.2.4-.2.7 0 .2.1.5.3.6.2.2.4.2.7.2h7.1l-.7 7.8c0 .2 0 .4.2.6.1.2.3.3.5.4l.2.1c.3 0 .6-.2.8-.5L21 10.2c.1-.2.2-.4.2-.7 0-.2-.1-.5-.3-.6-.1-.1-.4-.2-.6-.2z" })),
|
|
4055
4197
|
fire: (jsxRuntime.jsx("path", { d: "M17.3 9.2c-.7-.6-1.3-1.2-1.8-1.9C12.4 3.3 14 0 14 0 8.3 2.4 7 6.2 7 9c0 0 .1 1.7.8 3.5.2.6-.2 1.2-.8 1.3-.4.1-.8-.2-1-.6-.3-.7-.8-1.8-.6-2.6-.9 1.2-1.5 2.8-1.7 4.4-.3 4.2 2.6 8 6.7 8.8 4.8 1 9.3-2.3 10-7.1.3-2.9-.9-5.7-3.1-7.5z" })),
|
|
4056
4198
|
control: (jsxRuntime.jsx("path", { d: "M1.4 5.3h2.4c.5 1.6 2 2.8 3.8 2.8 1.8 0 3.3-1.2 3.8-2.8h11.2c.7 0 1.2-.5 1.2-1.2s-.5-1.2-1.2-1.2H11.5C10.9 1.2 9.4 0 7.6 0 5.8 0 4.3 1.2 3.8 2.8H1.4C.7 2.8.2 3.3.2 4s.5 1.3 1.2 1.3zm6.2-2.8c.9 0 1.6.7 1.6 1.6s-.7 1.6-1.6 1.6S6 5 6 4.1c0-.9.7-1.6 1.6-1.6zM22.6 10.8h-2.4c-.5-1.6-2-2.8-3.8-2.8-1.8 0-3.3 1.2-3.8 2.8H1.4c-.7 0-1.2.5-1.2 1.2s.5 1.2 1.2 1.2h11.2c.5 1.6 2 2.8 3.8 2.8 1.8 0 3.3-1.2 3.8-2.8h2.4c.7 0 1.2-.5 1.2-1.2.1-.7-.5-1.2-1.2-1.2zm-6.2 2.8c-.9 0-1.6-.7-1.6-1.6 0-.9.7-1.6 1.6-1.6.9 0 1.6.7 1.6 1.6 0 .9-.7 1.6-1.6 1.6zM22.6 18.7H11.5c-.5-1.6-2-2.8-3.8-2.8-1.8 0-3.3 1.2-3.8 2.8H1.4c-.7 0-1.2.5-1.2 1.2s.5 1.2 1.2 1.2h2.4c.5 1.6 2 2.8 3.8 2.8 1.8 0 3.3-1.2 3.8-2.8h11.2c.7 0 1.2-.5 1.2-1.2s-.5-1.2-1.2-1.2zm-15 2.8c-.9 0-1.6-.7-1.6-1.6 0-.9.7-1.6 1.6-1.6.9 0 1.6.7 1.6 1.6 0 .9-.7 1.6-1.6 1.6z" })),
|
|
4199
|
+
file: (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("path", { d: "M6 2.75C4.75736 2.75 3.75 3.75736 3.75 5V19C3.75 20.2426 4.75736 21.25 6 21.25H18C19.2426 21.25 20.25 20.2426 20.25 19V9.08615C20.25 8.55979 20.0655 8.05009 19.7285 7.64574L16.3234 3.55959C15.8959 3.0466 15.2626 2.75 14.5949 2.75H6ZM2.25 5C2.25 2.92893 3.92893 1.25 6 1.25H14.5949C15.7078 1.25 16.7632 1.74434 17.4757 2.59931L20.8808 6.68546C21.4424 7.35939 21.75 8.20889 21.75 9.08615V19C21.75 21.0711 20.0711 22.75 18 22.75H6C3.92893 22.75 2.25 21.0711 2.25 19V5Z" }), jsxRuntime.jsx("path", { d: "M15 1.75C15.4142 1.75 15.75 2.08579 15.75 2.5V6C15.75 7.24264 16.7574 8.25 18 8.25H20.5C20.9142 8.25 21.25 8.58579 21.25 9C21.25 9.41421 20.9142 9.75 20.5 9.75H18C15.9289 9.75 14.25 8.07107 14.25 6V2.5C14.25 2.08579 14.5858 1.75 15 1.75Z" })] })),
|
|
4057
4200
|
};
|
|
4058
4201
|
var Icon = function (props) { return (jsxRuntime.jsx(Wrapper$9, __assign$2({}, props, { children: jsxRuntime.jsx("svg", __assign$2({ viewBox: "0 0 24 24", fill: "none" }, { children: icons[props.type] })) }))); };
|
|
4059
4202
|
|
|
4060
|
-
var Wrapper$8 = styled__default["default"].div(templateObject_1$
|
|
4203
|
+
var Wrapper$8 = styled__default["default"].div(templateObject_1$O || (templateObject_1$O = __makeTemplateObject$1(["\n > svg {\n height: ", ";\n }\n"], ["\n > svg {\n height: ", ";\n }\n"])), function (_a) {
|
|
4061
4204
|
var size = _a.size;
|
|
4062
4205
|
switch (size) {
|
|
4063
4206
|
case "tiny":
|
|
@@ -4071,7 +4214,7 @@ var Wrapper$8 = styled__default["default"].div(templateObject_1$N || (templateOb
|
|
|
4071
4214
|
return "118px";
|
|
4072
4215
|
}
|
|
4073
4216
|
});
|
|
4074
|
-
var templateObject_1$
|
|
4217
|
+
var templateObject_1$O;
|
|
4075
4218
|
|
|
4076
4219
|
var illustrations = {
|
|
4077
4220
|
keyboard: (jsxRuntime.jsxs("svg", __assign$2({ viewBox: "0 0 32.9 20.8" }, { children: [jsxRuntime.jsx("path", { d: "M31.5 1H1.4C.6 1 0 1.6 0 2.4v17.1c0 .8.6 1.4 1.4 1.4h30.1c.8 0 1.4-.6 1.4-1.4V2.4c0-.8-.6-1.4-1.4-1.4z", fill: "#829190" }), jsxRuntime.jsx("path", { d: "M31.5 0H1.4C.6 0 0 .6 0 1.4v17.1c0 .8.6 1.4 1.4 1.4h30.1c.8 0 1.4-.6 1.4-1.4V1.4c0-.8-.6-1.4-1.4-1.4z", fill: "#99adac" }), jsxRuntime.jsx("path", { d: "M27.1 14.2H5.7c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h21.4c.3 0 .5-.2.5-.5v-3.4c-.1-.3-.3-.5-.5-.5zM8.4 8.6H2.1c-.3 0-.5.2-.5.4v3.4c0 .3.2.5.5.5h6.3c.3 0 .5-.2.5-.5V9c0-.2-.2-.4-.5-.4zM13.8 8.6h-3.3c-.3 0-.5.2-.5.4v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V9c-.1-.2-.3-.4-.5-.4zM5.4 3.3H2.1c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V3.8c-.1-.3-.3-.5-.5-.5zM10.5 3.3H7.2c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V3.8c-.1-.3-.3-.5-.5-.5zM15.5 3.3h-3.3c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V3.8c0-.3-.2-.5-.5-.5zM20.6 3.3h-3.3c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V3.8c0-.3-.2-.5-.5-.5zM25.7 3.3h-3.3c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V3.8c0-.3-.2-.5-.5-.5zM30.8 3.3h-3.3c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V3.8c0-.3-.2-.5-.5-.5zM18.9 8.6h-3.3c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V9c-.1-.2-.3-.4-.5-.4zM23.9 8.6h-3.3c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V9.1c0-.3-.2-.5-.5-.5zM30.7 8.6h-4.9c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h4.9c.3 0 .5-.2.5-.5V9.1c0-.3-.2-.5-.5-.5z", fill: "#899a99" }), jsxRuntime.jsx("path", { d: "M27.1 13.7H5.7c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h21.4c.3 0 .5-.2.5-.5v-3.4c-.1-.3-.3-.5-.5-.5zM8.4 8.1H2.1c-.3 0-.5.2-.5.5V12c0 .3.2.5.5.5h6.3c.3 0 .5-.2.5-.5V8.6c0-.3-.2-.5-.5-.5zM13.8 8.1h-3.3c-.3 0-.5.2-.5.5V12c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V8.6c-.1-.3-.3-.5-.5-.5z", fill: "#eeeded" }), jsxRuntime.jsx("path", { d: "M5.4 2.8H2.1c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V3.3c-.1-.3-.3-.5-.5-.5z", fill: "#e62944" }), jsxRuntime.jsx("path", { d: "M10.5 2.8H7.2c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V3.3c-.1-.3-.3-.5-.5-.5zM15.5 2.8h-3.3c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V3.3c0-.3-.2-.5-.5-.5zM20.6 2.8h-3.3c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V3.3c0-.3-.2-.5-.5-.5zM25.7 2.8h-3.3c-.2 0-.4.2-.4.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V3.3c-.1-.3-.3-.5-.6-.5zM30.8 2.8h-3.3c-.3 0-.5.2-.5.5v3.4c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V3.3c0-.3-.2-.5-.5-.5zM18.9 8.1h-3.3c-.3 0-.5.2-.5.5V12c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V8.6c-.1-.3-.3-.5-.5-.5zM23.9 8.1h-3.3c-.3 0-.5.2-.5.5V12c0 .3.2.5.5.5h3.3c.3 0 .5-.2.5-.5V8.6c0-.3-.2-.5-.5-.5zM30.7 8.1h-4.9c-.3 0-.5.2-.5.5V12c0 .3.2.5.5.5h4.9c.3 0 .5-.2.5-.5V8.6c0-.3-.2-.5-.5-.5z", fill: "#eeeded" })] }))),
|
|
@@ -4092,7 +4235,7 @@ var illustrations = {
|
|
|
4092
4235
|
};
|
|
4093
4236
|
var Illustration = function (props) { return (jsxRuntime.jsx(Wrapper$8, __assign$2({}, props, { children: illustrations[props.type] }))); };
|
|
4094
4237
|
|
|
4095
|
-
var StyledParagraph = styled__default["default"].p(templateObject_1$
|
|
4238
|
+
var StyledParagraph = styled__default["default"].p(templateObject_1$N || (templateObject_1$N = __makeTemplateObject$1(["\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n font-style: normal;\n line-height: ", ";\n color: ", ";\n margin: 0;\n text-align: ", ";\n text-transform: ", ";\n"], ["\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n font-style: normal;\n line-height: ", ";\n color: ", ";\n margin: 0;\n text-align: ", ";\n text-transform: ", ";\n"])), theme.fonts.paragraph, function (_a) {
|
|
4096
4239
|
var size = _a.size;
|
|
4097
4240
|
return size ? theme.paragraph[size].fontSize : theme.paragraph.medium.fontSize;
|
|
4098
4241
|
}, function (_a) {
|
|
@@ -4127,17 +4270,17 @@ var StyledParagraph = styled__default["default"].p(templateObject_1$M || (templa
|
|
|
4127
4270
|
var transform = _a.transform;
|
|
4128
4271
|
return transform;
|
|
4129
4272
|
});
|
|
4130
|
-
var templateObject_1$
|
|
4273
|
+
var templateObject_1$N;
|
|
4131
4274
|
|
|
4132
|
-
var Container$
|
|
4133
|
-
var InputIconWrapper = styled__default["default"].div(templateObject_2$
|
|
4275
|
+
var Container$n = styled__default["default"].div(templateObject_1$M || (templateObject_1$M = __makeTemplateObject$1(["\n width: 100%;\n"], ["\n width: 100%;\n"])));
|
|
4276
|
+
var InputIconWrapper = styled__default["default"].div(templateObject_2$y || (templateObject_2$y = __makeTemplateObject$1(["\n position: relative;\n width: 100%;\n\n input {\n padding-right: 43px;\n }\n\n input[type=\"date\"] {\n color: ", ";\n }\n\n div {\n position: absolute;\n height: 24px;\n right: 12px;\n top: 14px;\n }\n\n svg {\n cursor: ", ";\n }\n"], ["\n position: relative;\n width: 100%;\n\n input {\n padding-right: 43px;\n }\n\n input[type=\"date\"] {\n color: ", ";\n }\n\n div {\n position: absolute;\n height: 24px;\n right: 12px;\n top: 14px;\n }\n\n svg {\n cursor: ", ";\n }\n"])), function (_a) {
|
|
4134
4277
|
var isChanged = _a.isChanged;
|
|
4135
4278
|
return !isChanged ? theme.colors.lightGray.darker : "";
|
|
4136
4279
|
}, function (_a) {
|
|
4137
4280
|
var disabled = _a.disabled;
|
|
4138
4281
|
return (disabled ? "not-allowed" : "pointer");
|
|
4139
4282
|
});
|
|
4140
|
-
var StyledInput = styled__default["default"].input(templateObject_3$
|
|
4283
|
+
var StyledInput = styled__default["default"].input(templateObject_3$c || (templateObject_3$c = __makeTemplateObject$1(["\n width: 100%;\n min-width: 228px;\n height: 50px;\n background-color: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n box-sizing: border-box;\n border-radius: 4px;\n padding: 13px 15px;\n cursor: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: 500;\n font-style: normal;\n line-height: ", ";\n color: ", ";\n\n ::placeholder {\n font-family: ", ";\n font-size: ", ";\n font-weight: 500;\n font-style: normal;\n line-height: ", ";\n color: ", ";\n }\n\n ::-webkit-calendar-picker-indicator {\n display: none;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"], ["\n width: 100%;\n min-width: 228px;\n height: 50px;\n background-color: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n box-sizing: border-box;\n border-radius: 4px;\n padding: 13px 15px;\n cursor: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: 500;\n font-style: normal;\n line-height: ", ";\n color: ", ";\n\n ::placeholder {\n font-family: ", ";\n font-size: ", ";\n font-weight: 500;\n font-style: normal;\n line-height: ", ";\n color: ", ";\n }\n\n ::-webkit-calendar-picker-indicator {\n display: none;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"])), function (_a) {
|
|
4141
4284
|
var disabled = _a.disabled;
|
|
4142
4285
|
return disabled ? theme.colors.lightGray.dark : theme.colors.lightGray.light;
|
|
4143
4286
|
}, function (_a) {
|
|
@@ -4156,7 +4299,7 @@ var Helper = styled__default["default"](StyledParagraph)(templateObject_6$3 || (
|
|
|
4156
4299
|
var isOk = _a.isOk;
|
|
4157
4300
|
return isOk ? theme.colors.green.base : theme.colors.darkGray.light;
|
|
4158
4301
|
}, fadeIn);
|
|
4159
|
-
var templateObject_1$
|
|
4302
|
+
var templateObject_1$M, templateObject_2$y, templateObject_3$c, templateObject_4$7, templateObject_5$3, templateObject_6$3;
|
|
4160
4303
|
|
|
4161
4304
|
var expressions = {};
|
|
4162
4305
|
|
|
@@ -4252,24 +4395,30 @@ __exportStar(isStrongPassword$1, exports);
|
|
|
4252
4395
|
}(expressions));
|
|
4253
4396
|
|
|
4254
4397
|
var password_helper_capital_letter = "Minimaal 1 hoofdletter";
|
|
4255
|
-
var password_helper_number = "Minimaal 1
|
|
4398
|
+
var password_helper_number = "Minimaal 1 cijfer";
|
|
4256
4399
|
var password_helper_special_character = "Minimaal 1 leesteken";
|
|
4257
4400
|
var password_helper_password_length = "Minimaal 8 karakters";
|
|
4401
|
+
var or = "of";
|
|
4258
4402
|
var nl_NL = {
|
|
4259
4403
|
password_helper_capital_letter: password_helper_capital_letter,
|
|
4260
4404
|
password_helper_number: password_helper_number,
|
|
4261
4405
|
password_helper_special_character: password_helper_special_character,
|
|
4262
|
-
password_helper_password_length: password_helper_password_length
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4406
|
+
password_helper_password_length: password_helper_password_length,
|
|
4407
|
+
"Drag file(s) here...": "Bestand(en) hierheen slepen...",
|
|
4408
|
+
or: or,
|
|
4409
|
+
"Select file(s)": "Bestand(en) kiezen",
|
|
4410
|
+
"Upload file(s)...": "Bestand(en) uploaden...",
|
|
4411
|
+
"File type not allowed": "Bestandstype niet toegestaan"
|
|
4412
|
+
};
|
|
4413
|
+
|
|
4414
|
+
var _a;
|
|
4415
|
+
// import en_GB from "./en-gb.json";
|
|
4416
|
+
// import fr_FR from "./fr-fr.json";
|
|
4417
|
+
// import de_DE from "./de-de.json";
|
|
4418
|
+
var translations = (_a = {},
|
|
4419
|
+
_a[enums.Locale.NL_NL] = nl_NL,
|
|
4420
|
+
_a[enums.Locale.NL_BE] = nl_NL,
|
|
4421
|
+
_a);
|
|
4273
4422
|
|
|
4274
4423
|
var PasswordInput = function (props) {
|
|
4275
4424
|
var _a = React$3.useState(props.defaultValue || ""), value = _a[0], setValue = _a[1];
|
|
@@ -4287,7 +4436,7 @@ var PasswordInput = function (props) {
|
|
|
4287
4436
|
if (props.onKeyPress)
|
|
4288
4437
|
props.onKeyPress(e);
|
|
4289
4438
|
};
|
|
4290
|
-
return (jsxRuntime.jsxs(Container$
|
|
4439
|
+
return (jsxRuntime.jsxs(Container$n, { children: [jsxRuntime.jsxs(InputIconWrapper, __assign$2({ disabled: props.disabled }, { children: [jsxRuntime.jsx(Icon, { type: isVisible ? "eyeInvisible" : "eye", color: "gray", size: "small", onClick: toggle }), jsxRuntime.jsx(StyledInput, __assign$2({ type: isVisible ? "text" : "password" }, props, { onChange: onChange, onKeyPress: onKeyPress }))] })), props.helperLocale && value.length ? (jsxRuntime.jsxs(HelperContainer, { children: [jsxRuntime.jsxs(Helper, __assign$2({ isOk: expressions.hasCapitalLetter(value) }, { children: ["\u2022 ", translations[props.helperLocale].password_helper_capital_letter] })), jsxRuntime.jsxs(Helper, __assign$2({ isOk: expressions.hasNumber(value) }, { children: ["\u2022 ", translations[props.helperLocale].password_helper_number] })), jsxRuntime.jsxs(Helper, __assign$2({ isOk: expressions.hasSpecialCharacter(value) }, { children: ["\u2022 ", translations[props.helperLocale].password_helper_special_character] })), jsxRuntime.jsxs(Helper, __assign$2({ isOk: value.length >= 8 }, { children: ["\u2022 ", translations[props.helperLocale].password_helper_password_length] }))] })) : null] }));
|
|
4291
4440
|
};
|
|
4292
4441
|
|
|
4293
4442
|
function requiredArgs(required, args) {
|
|
@@ -4621,7 +4770,7 @@ Input.Date = DateInput;
|
|
|
4621
4770
|
|
|
4622
4771
|
var Logo = function (props) { return (jsxRuntime.jsxs("svg", __assign$2({ width: 396, height: 66, viewBox: "0 0 662.8 118.1", fill: "none", xmlSpace: "preserve" }, props, { children: [jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx("path", { d: "M61.6 23.5c-.4-.5-.9-1.1-1.3-1.5l-4.9-4.8L42 4c-1.3-1.3-2.8-2.3-4.5-3-1.7-.7-3.5-1-5.3-1-1.8 0-3.6.4-5.3 1-1.7.7-3.2 1.7-4.5 3L4.1 22C1.5 24.6 0 28 0 31.7c0 3.6 1.5 7.1 4.1 9.7l18.3 18c2.6 2.6 6.2 4 9.8 4 3.7 0 7.2-1.4 9.8-4l13.4-13.2-4.9-4.8c-.5-.5-.9-1-1.3-1.5L35.7 53.1c-.5.5-1 .8-1.6 1.1-.6.2-1.3.4-1.9.4-.7 0-1.3-.1-1.9-.4-.6-.2-1.2-.6-1.6-1.1l-18.3-18c-.9-.9-1.5-2.2-1.5-3.5 0-1.3.5-2.5 1.5-3.5l18.3-18c.5-.5 1-.8 1.6-1.1.6-.2 1.3-.4 1.9-.4.7 0 1.3.1 1.9.4.6.2 1.2.6 1.6 1.1l13.5 13.3 4.8 4.7c.5.4.8 1 1.1 1.6.2.6.4 1.2.4 1.9v.1c0 1.3.5 2.5 1.5 3.4l4.8 4.7c1.8-2.4 2.7-5.2 2.7-8.1-.1-3-1.1-5.8-2.9-8.2z", fill: "#e62743" }), jsxRuntime.jsx("path", { d: "M153.3 22L135 4c-1.3-1.3-2.8-2.3-4.5-3-1.7-.7-3.5-1-5.3-1-1.8 0-3.6.4-5.3 1-1.7.7-3.2 1.7-4.5 3L102 17.2 97.1 22c-.5.5-.9 1-1.3 1.5-1.8 2.4-2.8 5.2-2.8 8.2 0 2.9 1 5.8 2.7 8.1l4.8-4.7c.9-.9 1.4-2.1 1.5-3.4 0-.6.1-1.3.4-1.9.2-.6.6-1.1 1.1-1.6l4.8-4.7 13.5-13.3c.5-.5 1-.8 1.6-1.1.6-.2 1.2-.4 1.9-.4s1.3.1 1.9.4c.6.2 1.1.6 1.6 1.1l18.3 18c.5.5.8 1 1.1 1.6.3.6.4 1.2.4 1.9 0 .6-.1 1.3-.4 1.9-.3.6-.6 1.1-1.1 1.6l-18.3 18c-.5.5-1 .8-1.6 1.1-.6.2-1.2.4-1.9.4s-1.3-.1-1.9-.4c-.6-.2-1.1-.6-1.6-1.1l-13.5-13.3c-.4.5-.8 1.1-1.3 1.5l-4.9 4.8 13.4 13.2c1.3 1.3 2.8 2.3 4.5 3 1.7.7 3.5 1 5.3 1 1.8 0 3.6-.4 5.3-1 1.7-.7 3.2-1.7 4.5-3l18.3-18c1.3-1.3 2.3-2.8 3-4.5.7-1.7 1.1-3.5 1.1-5.3 0-1.8-.4-3.6-1.1-5.3-.8-1.5-1.8-3-3.1-4.3z", fill: "#53b476" }), jsxRuntime.jsx("path", { d: "M61.9 23.3l-.3.3c-.4-.5-.9-1.1-1.3-1.5l-4.9-4.8L68.8 4c1.3-1.3 2.8-2.3 4.5-3 1.7-.7 3.5-1 5.3-1s3.6.4 5.3 1c1.7.7 3.2 1.7 4.5 3l13.4 13.1-4.7 4.9c-.5.5-.9 1-1.3 1.5L82.2 10.2c-.5-.5-1-.8-1.6-1.1-.6-.2-1.3-.4-1.9-.4-.7 0-1.3.1-1.9.4-.6.2-1.2.6-1.6 1.1L61.9 23.3zm41.5 4.9l4.8-4.7c1.8 2.4 2.7 5.2 2.7 8.2 0 2.9-1 5.8-2.7 8.2-.4.5-.8 1.1-1.3 1.5l-4.9 4.8-13.5 13.2c-2.6 2.6-6.2 4-9.8 4s-7.2-1.4-9.8-4L55.4 46.1l-4.9-4.8c-.5-.5-.9-1-1.3-1.5-1.8-2.4-2.7-5.2-2.7-8.1 0-2.9 1-5.8 2.7-8.1l4.8 4.7c.5.4.8 1 1.1 1.6.2.6.4 1.2.4 1.9v.1c0 1.3.5 2.5 1.5 3.4l4.8 4.7 13.5 13.3c.5.5 1 .8 1.6 1.1s1.3.4 1.9.4 1.3-.1 1.9-.4 1.2-.6 1.6-1.1L95.8 40l4.8-4.7c.9-.9 1.4-2.1 1.5-3.4 0-.6.1-1.3.4-1.9 0-.8.4-1.3.9-1.8z", fillRule: "evenodd", clipRule: "evenodd", fill: "#ffd800" }), jsxRuntime.jsx("path", { d: "M130 76.6l-18.3-18c-2.6-2.6-6.2-4-9.8-4-3.7 0-7.2 1.4-9.8 4L78.7 71.9l-4.9 4.8c-.5.5-.9 1-1.3 1.5-1.8 2.4-2.7 5.2-2.7 8.1 0 2.9 1 5.8 2.7 8.1l4.8-4.7c.9-.9 1.4-2.1 1.5-3.4 0-1.3.5-2.5 1.5-3.4l4.8-4.7 13.5-13.3c.9-.9 2.2-1.4 3.5-1.4 1.3 0 2.6.5 3.5 1.4l18.3 18c.9.9 1.5 2.2 1.5 3.5 0 1.3-.5 2.5-1.5 3.5l-18.3 18c-.9.9-2.2 1.4-3.5 1.4-1.3 0-2.6-.5-3.5-1.4L84.9 94.5c-.4.6-.8 1.1-1.3 1.5l-4.9 4.8L92.1 114c2.6 2.6 6.2 4 9.8 4 3.7 0 7.2-1.4 9.8-4L130 96c1.3-1.3 2.3-2.8 3-4.5.7-1.7 1.1-3.5 1.1-5.3 0-1.8-.4-3.6-1.1-5.3-.6-1.5-1.7-3-3-4.3z", fill: "#8c5ca2" }), jsxRuntime.jsx("path", { d: "M84.9 78.2l-4.8 4.7c-.9.9-1.4 2.1-1.5 3.4 0 1.3-.5 2.5-1.5 3.4l-4.8 4.7-13.5 13.3c-.9.9-2.2 1.4-3.5 1.4s-2.6-.5-3.5-1.4l-18.3-18c-.9-.9-1.4-2.2-1.4-3.5s.5-2.5 1.4-3.5l18.3-18c.9-.9 2.2-1.4 3.5-1.4s2.6.5 3.5 1.4L72.3 78c.4-.5.8-1.1 1.3-1.5l4.9-4.8-13.3-13c-2.6-2.6-6.2-4-9.8-4-3.7 0-7.2 1.4-9.8 4l-18.3 18c-2.6 2.6-4.1 6.1-4.1 9.7s1.5 7.1 4.1 9.7l18.3 18c2.6 2.6 6.2 4 9.8 4 3.7 0 7.2-1.4 9.8-4l13.4-13.2 4.9-4.8c.5-.5.9-1 1.3-1.5 1.8-2.4 2.7-5.2 2.7-8.1.1-3.1-.9-5.9-2.6-8.3z", fill: "#3da9e1" })] }), jsxRuntime.jsxs("g", __assign$2({ fill: "#23292f" }, { children: [jsxRuntime.jsx("path", { d: "M236.6 21.5c-1.1-1-2.4-1.5-3.9-1.5h-40.2c-1.6 0-2.9.5-3.9 1.4-1.1.9-1.6 2.2-1.6 3.8 0 1.6.5 2.8 1.6 3.8s2.4 1.5 3.9 1.5h14.2V78c0 1.6.5 2.9 1.6 3.9 1.1 1.1 2.5 1.6 4.2 1.6 1.8 0 3.2-.5 4.3-1.6 1.1-1.1 1.7-2.4 1.7-3.9V30.4h14.2c1.6 0 2.9-.5 3.9-1.4 1.1-.9 1.6-2.2 1.6-3.8 0-1.5-.5-2.8-1.6-3.7z" }), jsxRuntime.jsx("path", { d: "M270.6 36.6c-1-1.1-2.3-1.6-3.9-1.6s-2.9.5-3.9 1.6-1.5 2.4-1.5 3.9v23.2c0 2.3-.4 4.2-1.2 5.8-.8 1.6-1.9 2.8-3.4 3.6-1.5.8-3.2 1.2-5.3 1.2-3.1 0-5.5-.8-7.2-2.4-1.7-1.6-2.6-4.4-2.6-8.3V40.5c0-1.6-.5-2.9-1.5-3.9-1-1.1-2.3-1.6-3.9-1.6s-2.9.5-3.9 1.6-1.5 2.4-1.5 3.9V67c0 3.4.7 6.4 2 9 1.3 2.6 3.2 4.7 5.6 6.2 2.4 1.5 5.2 2.2 8.4 2.2 2.7 0 5.1-.3 7.3-1 2.1-.7 3.9-1.6 5.5-2.9.7-.6 1.3-1.3 1.9-2v1c0 3.1-.5 5.5-1.4 7.3-.9 1.8-2.3 3.1-4.2 3.8-1.8.8-4.2 1.1-6.9 1.1-2.1 0-3.9-.3-5.4-1-1.6-.6-2.8-1.1-3.8-1.4-1.3-.5-2.6-.4-3.8.2-1.2.6-2.1 1.8-2.6 3.6-.4 1.3-.3 2.6.4 3.8.7 1.2 1.9 2.2 3.8 2.9 1.4.6 3.2 1.1 5.3 1.4 2.2.3 4.2.5 6.2.5 4.4 0 8.3-.7 11.8-2.2 3.5-1.4 6.3-3.8 8.4-7.1 2.1-3.3 3.1-7.7 3.1-13.3V40.5c-.3-1.6-.8-2.9-1.8-3.9zM327.5 46.1c-2-3.7-4.6-6.7-8-8.8-3.4-2.1-7.1-3.2-11.4-3.2-2.1 0-4.1.4-6 1.1-1.9.7-3.6 1.6-5 2.8-1.3 1-2.4 2-3.2 3.1v-.5c0-1.6-.5-2.9-1.5-3.9-1-1.1-2.3-1.6-3.9-1.6s-2.9.5-3.9 1.6-1.5 2.4-1.5 3.9v55.6c0 1.6.5 3 1.5 4s2.3 1.5 3.9 1.5 2.9-.5 3.9-1.6 1.5-2.4 1.5-3.9V78.3c.6.6 1.4 1.3 2.2 1.9 1.6 1.2 3.5 2.2 5.6 3 2.1.8 4.4 1.2 6.8 1.2 4.1 0 7.8-1.1 11.1-3.2s5.9-5.1 7.9-8.9c2-3.8 2.9-8.1 2.9-13.1s-1-9.3-2.9-13.1zm-9.2 20.8c-1.1 2.3-2.7 4.2-4.6 5.5-2 1.3-4.3 2-6.9 2s-5-.7-7-2-3.6-3.2-4.7-5.5-1.7-4.9-1.7-7.8c0-2.9.6-5.5 1.7-7.8s2.7-4.1 4.7-5.4c2-1.3 4.3-2 7-2s5 .7 6.9 2c2 1.3 3.5 3.1 4.6 5.4 1.1 2.3 1.7 4.8 1.7 7.8 0 2.9-.6 5.5-1.7 7.8zM380.4 61.6c1.1-.9 1.7-2.1 1.7-3.5 0-3.3-.6-6.3-1.9-9.2-1.2-2.9-2.9-5.5-5-7.7s-4.5-3.9-7.3-5.2c-2.8-1.3-5.7-1.9-8.7-1.9-4 0-7.8 1-11.3 3.1-3.6 2.1-6.5 5-8.7 8.8-2.2 3.8-3.3 8.5-3.3 13.9 0 4.7 1 8.8 3 12.5 2 3.7 4.9 6.6 8.7 8.7 3.8 2.1 8.2 3.2 13.4 3.2 3 0 6-.5 8.8-1.5 2.8-1 5-2.2 6.6-3.5 1.7-1.3 2.5-2.8 2.5-4.4 0-1.2-.4-2.3-1.3-3.2-.9-.9-2-1.4-3.3-1.4-1 0-2 .3-3.1.8-.7.4-1.4.8-2.2 1.3-.8.5-1.9 1-3.2 1.3-1.3.4-3.1.5-5.3.5-2.4 0-4.7-.6-6.8-1.8-2.1-1.2-3.9-2.9-5.3-5.2-.8-1.3-1.3-2.8-1.7-4.5h29.9c1.4.3 2.7-.2 3.8-1.1zM350 47.2c1.1-1.1 2.5-2 4.1-2.4 1.6-.5 3.3-.7 5.1-.7 1.9 0 3.6.4 5.3 1.2 1.7.8 3.1 1.9 4.2 3.3s1.7 3 1.9 4.7v.6h-23.7c.1-.7.3-1.5.5-2.1.5-1.9 1.5-3.4 2.6-4.6zM447.3 39.1c-1.5-3.9-3.6-7.4-6.4-10.4-2.8-3-6-5.3-9.8-7-3.8-1.7-7.9-2.5-12.4-2.5s-8.6.8-12.3 2.5c-3.7 1.7-7 4-9.7 7-2.8 3-4.9 6.5-6.4 10.4-1.5 3.9-2.3 8.2-2.3 12.7s.8 8.8 2.3 12.7c1.5 3.9 3.6 7.4 6.4 10.4 2.7 3 6 5.3 9.7 7 3.7 1.7 7.9 2.5 12.3 2.5 4.5 0 8.6-.8 12.4-2.5 3.8-1.7 7-4 9.8-7 2.8-3 4.9-6.5 6.4-10.4 1.5-3.9 2.3-8.2 2.3-12.7-.1-4.6-.8-8.8-2.3-12.7zm-12 23.7c-1.6 3.3-3.9 5.9-6.7 7.8-2.8 1.9-6.1 2.9-9.9 2.9-3.7 0-7-1-9.9-2.9-2.8-1.9-5.1-4.5-6.7-7.8-1.6-3.3-2.4-7-2.4-11 0-4.1.8-7.8 2.4-11.1 1.6-3.3 3.8-5.9 6.7-7.8 2.8-1.9 6.1-2.9 9.9-2.9 3.7 0 7 1 9.9 2.9 2.8 1.9 5.1 4.5 6.7 7.8 1.6 3.3 2.4 7 2.4 11 .1 4.1-.8 7.8-2.4 11.1zM468.4 18c-1-1.1-2.3-1.6-3.9-1.6s-2.9.5-3.9 1.6c-1.1 1.1-1.6 2.4-1.6 3.9v56c0 1.6.5 2.9 1.5 3.9 1 1.1 2.3 1.6 3.8 1.6 1.6 0 2.9-.5 3.9-1.6 1.1-1.1 1.6-2.4 1.6-3.9v-56c.1-1.5-.4-2.9-1.4-3.9zM520.2 36.6c-1-1.1-2.3-1.6-3.9-1.6s-2.9.5-3.9 1.6-1.5 2.4-1.5 3.9v23.2c0 2.3-.4 4.2-1.2 5.8-.8 1.6-1.9 2.8-3.4 3.6-1.4.8-3.2 1.2-5.3 1.2-3.1 0-5.5-.8-7.2-2.4-1.7-1.6-2.6-4.4-2.6-8.3V40.5c0-1.6-.5-2.9-1.5-3.9-1-1.1-2.3-1.6-3.9-1.6s-2.9.5-3.9 1.6-1.5 2.4-1.5 3.9V67c0 3.4.7 6.4 2 9 1.3 2.6 3.2 4.7 5.6 6.2 2.4 1.5 5.2 2.2 8.4 2.2 2.7 0 5.1-.3 7.3-1 2.1-.7 3.9-1.6 5.5-2.9.7-.6 1.3-1.3 1.9-2v1c0 3.1-.5 5.5-1.4 7.3-.9 1.8-2.3 3.1-4.2 3.8-1.8.8-4.2 1.1-6.9 1.1-2.1 0-3.9-.3-5.4-1-1.6-.6-2.8-1.1-3.8-1.4-1.3-.5-2.6-.4-3.8.2-1.2.6-2.1 1.8-2.6 3.6-.4 1.3-.3 2.6.4 3.8.7 1.2 1.9 2.2 3.8 2.9 1.4.6 3.2 1.1 5.3 1.4 2.2.3 4.2.5 6.2.5 4.4 0 8.3-.7 11.8-2.2 3.5-1.4 6.3-3.8 8.4-7.1 2.1-3.3 3.1-7.7 3.1-13.3V40.5c-.2-1.6-.7-2.9-1.8-3.9zM603.2 44.4c-.8-3.1-2.4-5.6-4.7-7.5s-5.6-2.8-9.9-2.8c-2.7 0-5.1.6-7.2 1.7-2.1 1.1-4 2.5-5.5 4.1-1.4 1.5-2.5 2.9-3.2 4.2-.8-2.6-2.1-4.7-3.9-6.5-2.3-2.3-5.9-3.5-10.7-3.5-2 0-3.8.3-5.5 1-1.7.6-3.2 1.5-4.6 2.5-1.4 1-2.6 2.1-3.5 3.3l-.9 1.2v-1.5c0-1.6-.5-2.9-1.5-3.9-1-1.1-2.3-1.6-3.9-1.6s-2.9.5-3.9 1.6-1.5 2.4-1.5 3.9V78c0 1.6.5 2.9 1.5 3.9 1 1.1 2.3 1.6 3.9 1.6s2.9-.5 3.9-1.6 1.5-2.4 1.5-3.9V54.7c0-2 .4-3.8 1.2-5.4.8-1.6 2-2.9 3.7-3.9 1.6-1 3.6-1.4 5.9-1.4 2.4 0 4.2.5 5.4 1.4 1.3 1 2.1 2.3 2.6 3.9s.7 3.4.7 5.4v23.2c0 1.6.5 2.9 1.5 3.9 1 1.1 2.3 1.6 3.9 1.6s2.9-.5 3.9-1.6 1.5-2.4 1.5-3.9V54.7c0-2 .4-3.8 1.2-5.4.8-1.6 2-2.9 3.7-3.9 1.6-1 3.6-1.4 5.9-1.4 2.4 0 4.2.5 5.4 1.4 1.3 1 2.1 2.3 2.6 3.9s.7 3.4.7 5.4v23.2c0 1.6.5 2.9 1.5 3.9 1 1.1 2.3 1.6 3.9 1.6s2.9-.5 3.9-1.6 1.5-2.4 1.5-3.9V54.7c.3-3.8-.2-7.2-1-10.3zM659.8 46.1c-2-3.7-4.6-6.7-8-8.8-3.4-2.1-7.1-3.2-11.4-3.2-2.1 0-4.1.4-6 1.1-1.9.7-3.6 1.6-5 2.8-1.3 1-2.4 2-3.2 3.1v-.5c0-1.6-.5-2.9-1.5-3.9-1-1.1-2.3-1.6-3.9-1.6s-2.9.5-3.9 1.6-1.5 2.4-1.5 3.9v55.6c0 1.6.5 3 1.5 4s2.3 1.5 3.9 1.5 2.9-.5 3.9-1.6 1.5-2.4 1.5-3.9V78.3c.6.6 1.4 1.3 2.2 1.9 1.6 1.2 3.5 2.2 5.6 3s4.4 1.2 6.8 1.2c4.1 0 7.8-1.1 11.1-3.2s5.9-5.1 7.9-8.9c2-3.8 2.9-8.1 2.9-13.1.1-5-.9-9.3-2.9-13.1zm-9.1 20.8c-1.1 2.3-2.7 4.2-4.6 5.5-2 1.3-4.3 2-6.9 2s-5-.7-7-2-3.5-3.2-4.7-5.5c-1.1-2.3-1.7-4.9-1.7-7.8 0-2.9.6-5.5 1.7-7.8s2.7-4.1 4.7-5.4c2-1.3 4.3-2 7-2s5 .7 6.9 2c2 1.3 3.5 3.1 4.6 5.4 1.1 2.3 1.7 4.8 1.7 7.8-.1 2.9-.6 5.5-1.7 7.8z" })] }))] }))); };
|
|
4623
4772
|
|
|
4624
|
-
var Wrapper$7 = styled__default["default"].div(templateObject_1$
|
|
4773
|
+
var Wrapper$7 = styled__default["default"].div(templateObject_1$L || (templateObject_1$L = __makeTemplateObject$1(["\n width: ", ";\n"], ["\n width: ", ";\n"])), function (_a) {
|
|
4625
4774
|
var size = _a.size;
|
|
4626
4775
|
switch (size) {
|
|
4627
4776
|
default:
|
|
@@ -4631,7 +4780,7 @@ var Wrapper$7 = styled__default["default"].div(templateObject_1$K || (templateOb
|
|
|
4631
4780
|
return "116px";
|
|
4632
4781
|
}
|
|
4633
4782
|
});
|
|
4634
|
-
var templateObject_1$
|
|
4783
|
+
var templateObject_1$L;
|
|
4635
4784
|
|
|
4636
4785
|
var medals = {
|
|
4637
4786
|
small: {
|
|
@@ -4647,11 +4796,11 @@ var medals = {
|
|
|
4647
4796
|
};
|
|
4648
4797
|
var Medal = function (props) { return (jsxRuntime.jsx(Wrapper$7, __assign$2({}, props, { children: medals[props.size || "small"][props.type] }))); };
|
|
4649
4798
|
|
|
4650
|
-
var Wrapper$6 = styled__default["default"].div(templateObject_1$
|
|
4799
|
+
var Wrapper$6 = styled__default["default"].div(templateObject_1$K || (templateObject_1$K = __makeTemplateObject$1(["\n width: fit-content;\n display: flex;\n\n button:first-child {\n border-radius: 6px 0 0 6px;\n border-width: 2px 1px 2px 2px;\n }\n\n button:last-child {\n border-radius: 0 6px 6px 0;\n border-width: 2px 2px 2px 1px;\n }\n\n button {\n width: ", ";\n }\n"], ["\n width: fit-content;\n display: flex;\n\n button:first-child {\n border-radius: 6px 0 0 6px;\n border-width: 2px 1px 2px 2px;\n }\n\n button:last-child {\n border-radius: 0 6px 6px 0;\n border-width: 2px 2px 2px 1px;\n }\n\n button {\n width: ", ";\n }\n"])), function (_a) {
|
|
4651
4800
|
var disabled = _a.disabled;
|
|
4652
4801
|
return (disabled ? "49.5px" : "");
|
|
4653
4802
|
});
|
|
4654
|
-
var StyledInputNumber = styled__default["default"].input(templateObject_2$
|
|
4803
|
+
var StyledInputNumber = styled__default["default"].input(templateObject_2$x || (templateObject_2$x = __makeTemplateObject$1(["\n width: 50px;\n height: 50px;\n background-color: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n box-sizing: border-box;\n cursor: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: 400;\n font-style: normal;\n line-height: ", ";\n color: ", ";\n text-align: center;\n -moz-appearance: textfield;\n\n ::-webkit-inner-spin-button {\n -webkit-appearance: none;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"], ["\n width: 50px;\n height: 50px;\n background-color: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n box-sizing: border-box;\n cursor: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: 400;\n font-style: normal;\n line-height: ", ";\n color: ", ";\n text-align: center;\n -moz-appearance: textfield;\n\n ::-webkit-inner-spin-button {\n -webkit-appearance: none;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"])), function (_a) {
|
|
4655
4804
|
var disabled = _a.disabled;
|
|
4656
4805
|
return disabled ? theme.colors.lightGray.base : theme.colors.lightGray.light;
|
|
4657
4806
|
}, function (_a) {
|
|
@@ -4664,7 +4813,7 @@ var StyledInputNumber = styled__default["default"].input(templateObject_2$w || (
|
|
|
4664
4813
|
var disabled = _a.disabled;
|
|
4665
4814
|
return disabled ? theme.colors.darkGray.light : theme.colors.darkGray.base;
|
|
4666
4815
|
}, theme.colors.blue.dark, "0 0 0 1px ".concat(theme.colors.blue.dark));
|
|
4667
|
-
var templateObject_1$
|
|
4816
|
+
var templateObject_1$K, templateObject_2$x;
|
|
4668
4817
|
|
|
4669
4818
|
var Number$1 = function (props) {
|
|
4670
4819
|
var inputRef = React$3.useRef(null);
|
|
@@ -4703,7 +4852,7 @@ var Number$1 = function (props) {
|
|
|
4703
4852
|
|
|
4704
4853
|
var Paragraph = function (props) { return (jsxRuntime.jsx(StyledParagraph, __assign$2({}, props, { children: props.children }))); };
|
|
4705
4854
|
|
|
4706
|
-
var StyledRadio = styled__default["default"].div(templateObject_1$
|
|
4855
|
+
var StyledRadio = styled__default["default"].div(templateObject_1$J || (templateObject_1$J = __makeTemplateObject$1(["\n min-height: 25px;\n max-height: 25px;\n min-width: 25px;\n max-width: 25px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 14px;\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n cursor: ", ";\n background-color: ", ";\n\n svg {\n margin-left: -1px;\n fill: ", ";\n }\n\n input {\n display: none;\n }\n\n :after {\n content: \"\";\n width: 15px;\n height: 15px;\n border-radius: 50%;\n background-color: ", ";\n position: absolute;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"], ["\n min-height: 25px;\n max-height: 25px;\n min-width: 25px;\n max-width: 25px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 14px;\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n cursor: ", ";\n background-color: ", ";\n\n svg {\n margin-left: -1px;\n fill: ", ";\n }\n\n input {\n display: none;\n }\n\n :after {\n content: \"\";\n width: 15px;\n height: 15px;\n border-radius: 50%;\n background-color: ", ";\n position: absolute;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"])), function (_a) {
|
|
4707
4856
|
var checked = _a.checked, disabled = _a.disabled;
|
|
4708
4857
|
if (disabled)
|
|
4709
4858
|
return theme.colors.lightGray.darker;
|
|
@@ -4731,7 +4880,7 @@ var StyledRadio = styled__default["default"].div(templateObject_1$I || (template
|
|
|
4731
4880
|
return theme.colors.green.base;
|
|
4732
4881
|
return "";
|
|
4733
4882
|
}, theme.colors.blue.dark, "0 0 0 1px ".concat(theme.colors.blue.dark));
|
|
4734
|
-
var templateObject_1$
|
|
4883
|
+
var templateObject_1$J;
|
|
4735
4884
|
|
|
4736
4885
|
var Radio = function (props) {
|
|
4737
4886
|
var _a, _b;
|
|
@@ -4763,7 +4912,7 @@ var Radio = function (props) {
|
|
|
4763
4912
|
return (jsxRuntime.jsx(StyledRadio, __assign$2({ checked: checked, disabled: props.disabled, tabIndex: 0, onClick: toggle, onBlur: props.onBlur, onKeyPress: function (e) { return (e.key === "Enter" ? toggle() : null); }, ref: wrapperRef }, { children: jsxRuntime.jsx("input", { type: "radio", disabled: !!props.disabled, id: props.id, name: props.name, value: props.value, ref: inputRef }) })));
|
|
4764
4913
|
};
|
|
4765
4914
|
|
|
4766
|
-
var StyledRange = styled__default["default"].div(templateObject_1$
|
|
4915
|
+
var StyledRange = styled__default["default"].div(templateObject_1$I || (templateObject_1$I = __makeTemplateObject$1(["\n input {\n appearance: none;\n width: 100%;\n height: 11px;\n border: ", ";\n border-radius: 8px;\n position: relative;\n background: ", ";\n\n ::-webkit-slider-thumb {\n appearance: none;\n width: 24px;\n height: 24px;\n background-color: ", ";\n border: ", ";\n border-radius: 50%;\n cursor: ", ";\n }\n }\n"], ["\n input {\n appearance: none;\n width: 100%;\n height: 11px;\n border: ", ";\n border-radius: 8px;\n position: relative;\n background: ", ";\n\n ::-webkit-slider-thumb {\n appearance: none;\n width: 24px;\n height: 24px;\n background-color: ", ";\n border: ", ";\n border-radius: 50%;\n cursor: ", ";\n }\n }\n"])), function () { return "2px solid ".concat(theme.colors.lightGray.dark); }, function (_a) {
|
|
4767
4916
|
var value = _a.value, disabled = _a.disabled;
|
|
4768
4917
|
return "linear-gradient(90deg,\n ".concat(disabled ? theme.colors.lightGray.darker : theme.colors.green.base, " 0%,\n ").concat(disabled ? theme.colors.lightGray.darker : theme.colors.green.base, " ").concat(value, "%,\n ").concat(theme.colors.lightGray.dark, " ").concat(value, "%,\n ").concat(theme.colors.lightGray.dark, " 100%\n )");
|
|
4769
4918
|
}, function () { return theme.colors.lightGray.light; }, function (_a) {
|
|
@@ -4773,7 +4922,7 @@ var StyledRange = styled__default["default"].div(templateObject_1$H || (template
|
|
|
4773
4922
|
var disabled = _a.disabled;
|
|
4774
4923
|
return disabled ? "not-allowed" : "pointer";
|
|
4775
4924
|
});
|
|
4776
|
-
var templateObject_1$
|
|
4925
|
+
var templateObject_1$I;
|
|
4777
4926
|
|
|
4778
4927
|
var Range = function (props) {
|
|
4779
4928
|
var _a;
|
|
@@ -4802,11 +4951,11 @@ var Range = function (props) {
|
|
|
4802
4951
|
return (jsxRuntime.jsx(StyledRange, __assign$2({ value: value, disabled: props.disabled }, { children: jsxRuntime.jsx("input", { type: "range", disabled: !!props.disabled, id: props.id, min: props.min || 0, max: props.max || 100, ref: rangeRef, defaultValue: props.defaultValue, onChange: onChange, onBlur: props.onBlur }) })));
|
|
4803
4952
|
};
|
|
4804
4953
|
|
|
4805
|
-
var Wrapper$5 = styled__default["default"].div(templateObject_1$
|
|
4954
|
+
var Wrapper$5 = styled__default["default"].div(templateObject_1$H || (templateObject_1$H = __makeTemplateObject$1(["\n position: relative;\n\n div {\n pointer-events: none;\n position: absolute;\n height: 24px;\n right: 12px;\n top: 14px;\n }\n\n svg {\n cursor: ", ";\n }\n"], ["\n position: relative;\n\n div {\n pointer-events: none;\n position: absolute;\n height: 24px;\n right: 12px;\n top: 14px;\n }\n\n svg {\n cursor: ", ";\n }\n"])), function (_a) {
|
|
4806
4955
|
var disabled = _a.disabled;
|
|
4807
4956
|
return (disabled ? "not-allowed" : "pointer");
|
|
4808
4957
|
});
|
|
4809
|
-
var StyledSelect = styled__default["default"].select(templateObject_2$
|
|
4958
|
+
var StyledSelect = styled__default["default"].select(templateObject_2$w || (templateObject_2$w = __makeTemplateObject$1(["\n width: 100%;\n height: 50px;\n background-color: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n box-sizing: border-box;\n border-radius: 4px;\n padding: 13px 43px 15px 13px;\n cursor: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: 500;\n font-style: normal;\n line-height: ", ";\n color: ", ";\n appearance: none;\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"], ["\n width: 100%;\n height: 50px;\n background-color: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n box-sizing: border-box;\n border-radius: 4px;\n padding: 13px 43px 15px 13px;\n cursor: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: 500;\n font-style: normal;\n line-height: ", ";\n color: ", ";\n appearance: none;\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"])), function (_a) {
|
|
4810
4959
|
var disabled = _a.disabled;
|
|
4811
4960
|
return disabled ? theme.colors.lightGray.dark : theme.colors.lightGray.light;
|
|
4812
4961
|
}, function (_a) {
|
|
@@ -4819,7 +4968,7 @@ var StyledSelect = styled__default["default"].select(templateObject_2$v || (temp
|
|
|
4819
4968
|
var isChanged = _a.isChanged;
|
|
4820
4969
|
return isChanged ? theme.colors.darkGray.base : theme.colors.lightGray.darker;
|
|
4821
4970
|
}, theme.colors.blue.dark, "0 0 0 1px ".concat(theme.colors.blue.dark));
|
|
4822
|
-
var templateObject_1$
|
|
4971
|
+
var templateObject_1$H, templateObject_2$w;
|
|
4823
4972
|
|
|
4824
4973
|
var Select = function (props) {
|
|
4825
4974
|
var _a;
|
|
@@ -4841,18 +4990,18 @@ var Select = function (props) {
|
|
|
4841
4990
|
return (jsxRuntime.jsxs(Wrapper$5, { children: [jsxRuntime.jsx(Icon, { type: "chevronDown", color: "gray", size: "small" }), jsxRuntime.jsxs(StyledSelect, __assign$2({}, props, { onChange: onChange, isChanged: isChanged || props.defaultValue, ref: inputRef }, { children: [props.placeholder && jsxRuntime.jsx("option", __assign$2({ hidden: true }, { children: props.placeholder })), props.children] }))] }));
|
|
4842
4991
|
};
|
|
4843
4992
|
|
|
4844
|
-
var StyledSpacer = styled__default["default"].div(templateObject_1$
|
|
4993
|
+
var StyledSpacer = styled__default["default"].div(templateObject_1$G || (templateObject_1$G = __makeTemplateObject$1(["\n width: ", ";\n height: ", ";\n"], ["\n width: ", ";\n height: ", ";\n"])), function (_a) {
|
|
4845
4994
|
var horizontal = _a.horizontal;
|
|
4846
4995
|
return (horizontal ? "".concat(horizontal, "px") : "");
|
|
4847
4996
|
}, function (_a) {
|
|
4848
4997
|
var vertical = _a.vertical;
|
|
4849
4998
|
return (vertical ? "".concat(vertical, "px") : "");
|
|
4850
4999
|
});
|
|
4851
|
-
var templateObject_1$
|
|
5000
|
+
var templateObject_1$G;
|
|
4852
5001
|
|
|
4853
5002
|
var Spacer = function (props) { return (jsxRuntime.jsx(StyledSpacer, __assign$2({}, props))); };
|
|
4854
5003
|
|
|
4855
|
-
var StyledSubheading = styled__default["default"].p(templateObject_1$
|
|
5004
|
+
var StyledSubheading = styled__default["default"].p(templateObject_1$F || (templateObject_1$F = __makeTemplateObject$1(["\n font-family: ", ";\n font-style: normal;\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n text-align: ", ";\n margin: 0;\n color: ", ";\n"], ["\n font-family: ", ";\n font-style: normal;\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n text-align: ", ";\n margin: 0;\n color: ", ";\n"])), theme.fonts.paragraph, function (_a) {
|
|
4856
5005
|
var size = _a.size;
|
|
4857
5006
|
return size ? theme.subheading[size].fontSize : theme.subheading.medium.fontSize;
|
|
4858
5007
|
}, function (_a) {
|
|
@@ -4880,18 +5029,18 @@ var StyledSubheading = styled__default["default"].p(templateObject_1$E || (templ
|
|
|
4880
5029
|
return theme.colors.darkGray.dark;
|
|
4881
5030
|
}
|
|
4882
5031
|
});
|
|
4883
|
-
var templateObject_1$
|
|
5032
|
+
var templateObject_1$F;
|
|
4884
5033
|
|
|
4885
5034
|
var Subheading = function (props) { return (jsxRuntime.jsx(StyledSubheading, __assign$2({}, props, { children: props.children }))); };
|
|
4886
5035
|
|
|
4887
|
-
var Container$
|
|
4888
|
-
var templateObject_1$
|
|
5036
|
+
var Container$m = styled__default["default"].div(templateObject_1$E || (templateObject_1$E = __makeTemplateObject$1(["\n padding: 7px 10px;\n background-color: ", ";\n box-shadow: 0 2px 0 ", ";\n border: 1px solid ", ";\n border-radius: 4px;\n box-sizing: border-box;\n text-decoration: none;\n\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n font-style: normal;\n color: ", ";\n"], ["\n padding: 7px 10px;\n background-color: ", ";\n box-shadow: 0 2px 0 ", ";\n border: 1px solid ", ";\n border-radius: 4px;\n box-sizing: border-box;\n text-decoration: none;\n\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n font-style: normal;\n color: ", ";\n"])), theme.colors.lightGray.base, theme.colors.lightGray.darker, theme.colors.lightGray.darker, theme.fonts.paragraph, theme.subheading.small.fontSize, theme.subheading.small.fontWeight, theme.colors.darkGray.light);
|
|
5037
|
+
var templateObject_1$E;
|
|
4889
5038
|
|
|
4890
5039
|
var Tag = function (props) {
|
|
4891
|
-
return jsxRuntime.jsx(Container$
|
|
5040
|
+
return jsxRuntime.jsx(Container$m, { children: props.children });
|
|
4892
5041
|
};
|
|
4893
5042
|
|
|
4894
|
-
var Container$
|
|
5043
|
+
var Container$l = styled__default["default"].div(templateObject_1$D || (templateObject_1$D = __makeTemplateObject$1(["\n width: 46px;\n min-width: 46px;\n max-width: 46px;\n height: 27px;\n min-height: 27px;\n max-height: 27px;\n border-radius: 14px;\n cursor: ", ";\n position: relative;\n background-color: ", ";\n\n :after {\n content: \"\";\n width: 21px;\n height: 21px;\n border-radius: 50%;\n position: absolute;\n top: 3px;\n right: ", ";\n left: ", ";\n background-color: ", ";\n }\n\n input {\n display: none;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"], ["\n width: 46px;\n min-width: 46px;\n max-width: 46px;\n height: 27px;\n min-height: 27px;\n max-height: 27px;\n border-radius: 14px;\n cursor: ", ";\n position: relative;\n background-color: ", ";\n\n :after {\n content: \"\";\n width: 21px;\n height: 21px;\n border-radius: 50%;\n position: absolute;\n top: 3px;\n right: ", ";\n left: ", ";\n background-color: ", ";\n }\n\n input {\n display: none;\n }\n\n :focus {\n outline: 0;\n border-color: ", ";\n box-shadow: ", ";\n }\n"])), function (_a) {
|
|
4895
5044
|
var disabled = _a.disabled;
|
|
4896
5045
|
return (disabled ? "not-allowed" : "pointer");
|
|
4897
5046
|
}, function (_a) {
|
|
@@ -4909,7 +5058,7 @@ var Container$k = styled__default["default"].div(templateObject_1$C || (template
|
|
|
4909
5058
|
var disabled = _a.disabled;
|
|
4910
5059
|
return disabled ? theme.colors.lightGray.darker : theme.colors.lightGray.light;
|
|
4911
5060
|
}, theme.colors.blue.dark, "0 0 0 1px ".concat(theme.colors.blue.dark));
|
|
4912
|
-
var templateObject_1$
|
|
5061
|
+
var templateObject_1$D;
|
|
4913
5062
|
|
|
4914
5063
|
var Toggle = function (props) {
|
|
4915
5064
|
var _a;
|
|
@@ -4937,10 +5086,10 @@ var Toggle = function (props) {
|
|
|
4937
5086
|
props.onChange(newValue);
|
|
4938
5087
|
}
|
|
4939
5088
|
};
|
|
4940
|
-
return (jsxRuntime.jsx(Container$
|
|
5089
|
+
return (jsxRuntime.jsx(Container$l, __assign$2({ checked: checked, disabled: props.disabled, tabIndex: 0, onClick: toggle, onBlur: props.onBlur, onKeyPress: function (e) { return (e.key === "Enter" ? toggle() : null); }, ref: containerRef }, { children: jsxRuntime.jsx("input", { type: "checkbox", disabled: !!props.disabled, id: props.id, name: props.name, ref: inputRef }) })));
|
|
4941
5090
|
};
|
|
4942
5091
|
|
|
4943
|
-
var Wrapper$4 = styled__default["default"].div(templateObject_1$
|
|
5092
|
+
var Wrapper$4 = styled__default["default"].div(templateObject_1$C || (templateObject_1$C = __makeTemplateObject$1(["\n display: flex;\n align-items: flex-end;\n\n > svg {\n height: ", ";\n }\n"], ["\n display: flex;\n align-items: flex-end;\n\n > svg {\n height: ", ";\n }\n"])), function (_a) {
|
|
4944
5093
|
var level = _a.level;
|
|
4945
5094
|
switch (level) {
|
|
4946
5095
|
case 1:
|
|
@@ -4951,7 +5100,7 @@ var Wrapper$4 = styled__default["default"].div(templateObject_1$B || (templateOb
|
|
|
4951
5100
|
return "70px";
|
|
4952
5101
|
}
|
|
4953
5102
|
});
|
|
4954
|
-
var templateObject_1$
|
|
5103
|
+
var templateObject_1$C;
|
|
4955
5104
|
|
|
4956
5105
|
var trophies = {
|
|
4957
5106
|
1: {
|
|
@@ -4987,7 +5136,7 @@ var trophies = {
|
|
|
4987
5136
|
};
|
|
4988
5137
|
var Trophy = function (props) { return (jsxRuntime.jsx(Wrapper$4, __assign$2({}, props, { children: trophies[props.variant][props.level] }))); };
|
|
4989
5138
|
|
|
4990
|
-
var Container$
|
|
5139
|
+
var Container$k = styled__default["default"].div(templateObject_1$B || (templateObject_1$B = __makeTemplateObject$1(["\n min-height: 44px;\n padding: 10px;\n background-color: ", ";\n box-sizing: border-box;\n border-radius: 4px;\n display: flex;\n align-items: center;\n gap: 10px;\n\n > div:first-child {\n min-width: 24px;\n min-height: 24px;\n }\n\n p {\n color: ", ";\n }\n"], ["\n min-height: 44px;\n padding: 10px;\n background-color: ", ";\n box-sizing: border-box;\n border-radius: 4px;\n display: flex;\n align-items: center;\n gap: 10px;\n\n > div:first-child {\n min-width: 24px;\n min-height: 24px;\n }\n\n p {\n color: ", ";\n }\n"])), function (_a) {
|
|
4991
5140
|
var type = _a.type;
|
|
4992
5141
|
switch (type) {
|
|
4993
5142
|
case "success":
|
|
@@ -5004,11 +5153,11 @@ var Container$j = styled__default["default"].div(templateObject_1$A || (template
|
|
|
5004
5153
|
return theme.colors.red.base;
|
|
5005
5154
|
}
|
|
5006
5155
|
});
|
|
5007
|
-
var templateObject_1$
|
|
5156
|
+
var templateObject_1$B;
|
|
5008
5157
|
|
|
5009
|
-
var Alert = function (props) { return (jsxRuntime.jsxs(Container$
|
|
5158
|
+
var Alert = function (props) { return (jsxRuntime.jsxs(Container$k, __assign$2({}, props, { children: [jsxRuntime.jsx(Icon, { size: "small", type: props.type === "success" ? "check" : "warning", color: props.type === "success" ? "green" : "red" }), jsxRuntime.jsx(Paragraph, { children: props.message })] }))); };
|
|
5010
5159
|
|
|
5011
|
-
var StyledCard = styled__default["default"].div(templateObject_1$
|
|
5160
|
+
var StyledCard = styled__default["default"].div(templateObject_1$A || (templateObject_1$A = __makeTemplateObject$1(["\n background-color: ", ";\n border: ", ";\n box-shadow: 0px 4px 0px rgba(0, 0, 0, 20%);\n border-radius: 6px;\n overflow: hidden;\n position: relative;\n\n ", "\n"], ["\n background-color: ", ";\n border: ", ";\n box-shadow: 0px 4px 0px rgba(0, 0, 0, 20%);\n border-radius: 6px;\n overflow: hidden;\n position: relative;\n\n ", "\n"])), theme.colors.lightGray.light, function (_a) {
|
|
5012
5161
|
var bordered = _a.bordered;
|
|
5013
5162
|
return bordered ? "1px solid ".concat(theme.colors.lightGray.dark) : "none";
|
|
5014
5163
|
}, function (_a) {
|
|
@@ -5020,12 +5169,12 @@ var StyledCard = styled__default["default"].div(templateObject_1$z || (templateO
|
|
|
5020
5169
|
}, ";\n\n > div:first-child {\n width: 175%;\n padding-bottom: 175%;\n top: -25%;\n right: -25%;\n }\n }")
|
|
5021
5170
|
: "";
|
|
5022
5171
|
});
|
|
5023
|
-
var Ellipse = styled__default["default"].div(templateObject_2$
|
|
5172
|
+
var Ellipse = styled__default["default"].div(templateObject_2$v || (templateObject_2$v = __makeTemplateObject$1(["\n width: 85%;\n height: 0;\n padding-bottom: 85%;\n border-radius: 50%;\n background-color: ", ";\n opacity: 0.3;\n position: absolute;\n top: -20%;\n right: -20%;\n transition: width 0.75s, padding-bottom 0.75s, top 0.75s, right 0.75s;\n"], ["\n width: 85%;\n height: 0;\n padding-bottom: 85%;\n border-radius: 50%;\n background-color: ", ";\n opacity: 0.3;\n position: absolute;\n top: -20%;\n right: -20%;\n transition: width 0.75s, padding-bottom 0.75s, top 0.75s, right 0.75s;\n"])), function (_a) {
|
|
5024
5173
|
var color = _a.color;
|
|
5025
5174
|
return color ? theme.colors[color].light : "";
|
|
5026
5175
|
});
|
|
5027
|
-
var Content = styled__default["default"].div(templateObject_3$
|
|
5028
|
-
var templateObject_1$
|
|
5176
|
+
var Content = styled__default["default"].div(templateObject_3$b || (templateObject_3$b = __makeTemplateObject$1(["\n height: 100%;\n padding: 15px;\n position: inherit;\n top: 0;\n left: 0;\n"], ["\n height: 100%;\n padding: 15px;\n position: inherit;\n top: 0;\n left: 0;\n"])));
|
|
5177
|
+
var templateObject_1$A, templateObject_2$v, templateObject_3$b;
|
|
5029
5178
|
|
|
5030
5179
|
var Card = function (props) { return (jsxRuntime.jsxs(StyledCard, __assign$2({}, props, { children: [props.ellipse && jsxRuntime.jsx(Ellipse, { color: props.ellipse }), jsxRuntime.jsx(Content, { children: props.children })] }))); };
|
|
5031
5180
|
|
|
@@ -10173,15 +10322,15 @@ possibleStandardNamesOptimized$1.possibleStandardNames = {
|
|
|
10173
10322
|
|
|
10174
10323
|
Object.defineProperty(lib, '__esModule', { value: true });
|
|
10175
10324
|
|
|
10176
|
-
function _slicedToArray(arr, i) {
|
|
10177
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
10325
|
+
function _slicedToArray$2(arr, i) {
|
|
10326
|
+
return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest$2();
|
|
10178
10327
|
}
|
|
10179
10328
|
|
|
10180
|
-
function _arrayWithHoles(arr) {
|
|
10329
|
+
function _arrayWithHoles$2(arr) {
|
|
10181
10330
|
if (Array.isArray(arr)) return arr;
|
|
10182
10331
|
}
|
|
10183
10332
|
|
|
10184
|
-
function _iterableToArrayLimit(arr, i) {
|
|
10333
|
+
function _iterableToArrayLimit$2(arr, i) {
|
|
10185
10334
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
10186
10335
|
|
|
10187
10336
|
if (_i == null) return;
|
|
@@ -10211,16 +10360,16 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
10211
10360
|
return _arr;
|
|
10212
10361
|
}
|
|
10213
10362
|
|
|
10214
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
10363
|
+
function _unsupportedIterableToArray$2(o, minLen) {
|
|
10215
10364
|
if (!o) return;
|
|
10216
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
10365
|
+
if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
|
|
10217
10366
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
10218
10367
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
10219
10368
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
10220
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
10369
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
|
|
10221
10370
|
}
|
|
10222
10371
|
|
|
10223
|
-
function _arrayLikeToArray(arr, len) {
|
|
10372
|
+
function _arrayLikeToArray$2(arr, len) {
|
|
10224
10373
|
if (len == null || len > arr.length) len = arr.length;
|
|
10225
10374
|
|
|
10226
10375
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
@@ -10228,7 +10377,7 @@ function _arrayLikeToArray(arr, len) {
|
|
|
10228
10377
|
return arr2;
|
|
10229
10378
|
}
|
|
10230
10379
|
|
|
10231
|
-
function _nonIterableRest() {
|
|
10380
|
+
function _nonIterableRest$2() {
|
|
10232
10381
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10233
10382
|
}
|
|
10234
10383
|
|
|
@@ -10292,7 +10441,7 @@ reservedProps.forEach(function (name) {
|
|
|
10292
10441
|
// This is a mapping from React prop names to the attribute names.
|
|
10293
10442
|
|
|
10294
10443
|
[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
|
10295
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
10444
|
+
var _ref2 = _slicedToArray$2(_ref, 2),
|
|
10296
10445
|
name = _ref2[0],
|
|
10297
10446
|
attributeName = _ref2[1];
|
|
10298
10447
|
|
|
@@ -11274,14 +11423,14 @@ htmlReactParser.Element;
|
|
|
11274
11423
|
htmlReactParser.ProcessingInstruction;
|
|
11275
11424
|
htmlReactParser.Text;
|
|
11276
11425
|
|
|
11277
|
-
var Fieldset$1 = styled__default["default"].fieldset(templateObject_1$
|
|
11278
|
-
var CheckboxContainer = styled__default["default"].div(templateObject_2$
|
|
11279
|
-
var CheckboxWrapper = styled__default["default"].div(templateObject_3$
|
|
11426
|
+
var Fieldset$1 = styled__default["default"].fieldset(templateObject_1$z || (templateObject_1$z = __makeTemplateObject$1(["\n border: 0;\n margin: 0;\n padding: 0;\n"], ["\n border: 0;\n margin: 0;\n padding: 0;\n"])));
|
|
11427
|
+
var CheckboxContainer = styled__default["default"].div(templateObject_2$u || (templateObject_2$u = __makeTemplateObject$1(["\n margin-top: 5px;\n"], ["\n margin-top: 5px;\n"])));
|
|
11428
|
+
var CheckboxWrapper = styled__default["default"].div(templateObject_3$a || (templateObject_3$a = __makeTemplateObject$1(["\n display: flex;\n align-items: center;\n\n > div:first-child {\n margin-right: 10px;\n }\n\n :not(:last-child) {\n margin-bottom: 20px;\n }\n"], ["\n display: flex;\n align-items: center;\n\n > div:first-child {\n margin-right: 10px;\n }\n\n :not(:last-child) {\n margin-bottom: 20px;\n }\n"])));
|
|
11280
11429
|
var Label$9 = styled__default["default"](StyledParagraph)(templateObject_4$6 || (templateObject_4$6 = __makeTemplateObject$1(["\n font-weight: ", ";\n color: ", ";\n display: flex;\n flex-wrap: wrap;\n gap: 0 6px;\n align-items: center;\n cursor: pointer;\n\n a {\n color: ", ";\n }\n"], ["\n font-weight: ", ";\n color: ", ";\n display: flex;\n flex-wrap: wrap;\n gap: 0 6px;\n align-items: center;\n cursor: pointer;\n\n a {\n color: ", ";\n }\n"])), function (_a) {
|
|
11281
11430
|
var weight = _a.weight;
|
|
11282
11431
|
return weight || 500;
|
|
11283
11432
|
}, theme.colors.darkGray.base, theme.colors.blue.base);
|
|
11284
|
-
var templateObject_1$
|
|
11433
|
+
var templateObject_1$z, templateObject_2$u, templateObject_3$a, templateObject_4$6;
|
|
11285
11434
|
|
|
11286
11435
|
var Checkboxes = function (props) {
|
|
11287
11436
|
var _a = React$3.useState(props.defaultValue || []), values = _a[0], setValues = _a[1];
|
|
@@ -11304,12 +11453,12 @@ var Checkboxes = function (props) {
|
|
|
11304
11453
|
}) })] }));
|
|
11305
11454
|
};
|
|
11306
11455
|
|
|
11307
|
-
var Container$
|
|
11308
|
-
var Item = styled__default["default"].div(templateObject_2$
|
|
11456
|
+
var Container$j = styled__default["default"].div(templateObject_1$y || (templateObject_1$y = __makeTemplateObject$1(["\n width: 100%;\n background-color: ", ";\n box-shadow: 0px 4px 0px rgba(0, 0, 0, 20%);\n border-radius: 6px;\n padding: 10px 20px;\n"], ["\n width: 100%;\n background-color: ", ";\n box-shadow: 0px 4px 0px rgba(0, 0, 0, 20%);\n border-radius: 6px;\n padding: 10px 20px;\n"])), theme.colors.lightGray.light);
|
|
11457
|
+
var Item = styled__default["default"].div(templateObject_2$t || (templateObject_2$t = __makeTemplateObject$1(["\n padding: 10px 0;\n cursor: pointer;\n\n > div:first-child {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 5px;\n }\n\n p, > div:last-child {\n display: ", ";\n margin: 0;\n }\n\n :not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n"], ["\n padding: 10px 0;\n cursor: pointer;\n\n > div:first-child {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 5px;\n }\n\n p, > div:last-child {\n display: ", ";\n margin: 0;\n }\n\n :not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n"])), function (_a) {
|
|
11309
11458
|
var isOpen = _a.isOpen;
|
|
11310
11459
|
return (isOpen ? "" : "none");
|
|
11311
11460
|
}, theme.colors.lightGray.dark);
|
|
11312
|
-
var templateObject_1$
|
|
11461
|
+
var templateObject_1$y, templateObject_2$t;
|
|
11313
11462
|
|
|
11314
11463
|
var Collapse = function (props) {
|
|
11315
11464
|
var _a = React$3.useState([]), openItems = _a[0], setOpenItems = _a[1];
|
|
@@ -11321,18 +11470,18 @@ var Collapse = function (props) {
|
|
|
11321
11470
|
setOpenItems(function (prevState) { return __spreadArray(__spreadArray([], prevState, true), [index], false); });
|
|
11322
11471
|
}
|
|
11323
11472
|
};
|
|
11324
|
-
return (jsxRuntime.jsx(Container$
|
|
11473
|
+
return (jsxRuntime.jsx(Container$j, __assign$2({}, props, { children: props.items.map(function (item, index) {
|
|
11325
11474
|
var isOpen = openItems.includes(index);
|
|
11326
11475
|
return (jsxRuntime.jsxs(Item, __assign$2({ isOpen: isOpen, onClick: function () { return onClickItem(index, isOpen); } }, { children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Heading, __assign$2({ type: "h6" }, { children: item.title })), jsxRuntime.jsx(Icon, { type: isOpen ? "chevronUp" : "chevronDown", color: "blue" })] }), jsxRuntime.jsx(Paragraph, __assign$2({ weight: "regular", as: typeof item.content !== "string" ? "div" : undefined }, { children: item.content }))] }), "".concat(item.title, "-").concat(index)));
|
|
11327
11476
|
}) })));
|
|
11328
11477
|
};
|
|
11329
11478
|
|
|
11330
|
-
var Wrapper$3 = styled__default["default"].div(templateObject_1$
|
|
11331
|
-
var Value = styled__default["default"].div(templateObject_2$
|
|
11479
|
+
var Wrapper$3 = styled__default["default"].div(templateObject_1$x || (templateObject_1$x = __makeTemplateObject$1(["\n display: flex;\n"], ["\n display: flex;\n"])));
|
|
11480
|
+
var Value = styled__default["default"].div(templateObject_2$s || (templateObject_2$s = __makeTemplateObject$1(["\n width: 40px;\n height: 32px;\n background-color: ", ";\n border-radius: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0 6px;\n\n h5 {\n color: ", ";\n }\n\n :first-child {\n margin-left: 0;\n }\n"], ["\n width: 40px;\n height: 32px;\n background-color: ", ";\n border-radius: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0 6px;\n\n h5 {\n color: ", ";\n }\n\n :first-child {\n margin-left: 0;\n }\n"])), function (_a) {
|
|
11332
11481
|
var contrast = _a.contrast;
|
|
11333
11482
|
return contrast ? theme.colors.lightGray.dark : theme.colors.lightGray.light;
|
|
11334
11483
|
}, theme.colors.darkGray.base);
|
|
11335
|
-
var templateObject_1$
|
|
11484
|
+
var templateObject_1$x, templateObject_2$s;
|
|
11336
11485
|
|
|
11337
11486
|
var Countdown = function (_a) {
|
|
11338
11487
|
var till = _a.till, contrast = _a.contrast;
|
|
@@ -11359,9 +11508,9 @@ var Countdown = function (_a) {
|
|
|
11359
11508
|
return (jsxRuntime.jsxs(Wrapper$3, { children: [jsxRuntime.jsx(Value, __assign$2({ contrast: contrast }, { children: jsxRuntime.jsx(Heading, __assign$2({ type: "h5" }, { children: HH })) })), jsxRuntime.jsx(Heading, __assign$2({ type: "h5", color: color }, { children: ":" })), jsxRuntime.jsx(Value, __assign$2({ contrast: contrast }, { children: jsxRuntime.jsx(Heading, __assign$2({ type: "h5" }, { children: MM })) })), jsxRuntime.jsx(Heading, __assign$2({ type: "h5", color: color }, { children: ":" })), jsxRuntime.jsx(Value, __assign$2({ contrast: contrast }, { children: jsxRuntime.jsx(Heading, __assign$2({ type: "h5" }, { children: SS })) }))] }));
|
|
11360
11509
|
};
|
|
11361
11510
|
|
|
11362
|
-
var Container$
|
|
11363
|
-
var Label$8 = styled__default["default"](StyledParagraph)(templateObject_2$
|
|
11364
|
-
var templateObject_1$
|
|
11511
|
+
var Container$i = styled__default["default"].div(templateObject_1$w || (templateObject_1$w = __makeTemplateObject$1(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-wrap: wrap;\n"], ["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-wrap: wrap;\n"])));
|
|
11512
|
+
var Label$8 = styled__default["default"](StyledParagraph)(templateObject_2$r || (templateObject_2$r = __makeTemplateObject$1(["\n font-weight: 500;\n color: ", ";\n"], ["\n font-weight: 500;\n color: ", ";\n"])), theme.colors.darkGray.base);
|
|
11513
|
+
var templateObject_1$w, templateObject_2$r;
|
|
11365
11514
|
|
|
11366
11515
|
var DateInputField = function (props) {
|
|
11367
11516
|
var onChange = function (value) {
|
|
@@ -11372,7 +11521,2565 @@ var DateInputField = function (props) {
|
|
|
11372
11521
|
if (props.onBlur)
|
|
11373
11522
|
props.onBlur(props.name);
|
|
11374
11523
|
};
|
|
11375
|
-
return (jsxRuntime.jsxs(Container$
|
|
11524
|
+
return (jsxRuntime.jsxs(Container$i, { children: [jsxRuntime.jsx(Label$8, __assign$2({ as: "label", htmlFor: props.name }, { children: props.label })), jsxRuntime.jsx(Spacer, { vertical: 5 }), jsxRuntime.jsx(Input.Date, { defaultValue: props.defaultValue, min: props.min, max: props.max, autoComplete: props.autoComplete, autoFocus: props.autoFocus, disabled: props.disabled, id: props.name, onChange: onChange, onBlur: onBlur })] }));
|
|
11525
|
+
};
|
|
11526
|
+
|
|
11527
|
+
var propTypes = {exports: {}};
|
|
11528
|
+
|
|
11529
|
+
/*
|
|
11530
|
+
object-assign
|
|
11531
|
+
(c) Sindre Sorhus
|
|
11532
|
+
@license MIT
|
|
11533
|
+
*/
|
|
11534
|
+
/* eslint-disable no-unused-vars */
|
|
11535
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
11536
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
11537
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
11538
|
+
|
|
11539
|
+
function toObject(val) {
|
|
11540
|
+
if (val === null || val === undefined) {
|
|
11541
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
11542
|
+
}
|
|
11543
|
+
|
|
11544
|
+
return Object(val);
|
|
11545
|
+
}
|
|
11546
|
+
|
|
11547
|
+
function shouldUseNative() {
|
|
11548
|
+
try {
|
|
11549
|
+
if (!Object.assign) {
|
|
11550
|
+
return false;
|
|
11551
|
+
}
|
|
11552
|
+
|
|
11553
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
11554
|
+
|
|
11555
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
11556
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
11557
|
+
test1[5] = 'de';
|
|
11558
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
11559
|
+
return false;
|
|
11560
|
+
}
|
|
11561
|
+
|
|
11562
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
11563
|
+
var test2 = {};
|
|
11564
|
+
for (var i = 0; i < 10; i++) {
|
|
11565
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
11566
|
+
}
|
|
11567
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
11568
|
+
return test2[n];
|
|
11569
|
+
});
|
|
11570
|
+
if (order2.join('') !== '0123456789') {
|
|
11571
|
+
return false;
|
|
11572
|
+
}
|
|
11573
|
+
|
|
11574
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
11575
|
+
var test3 = {};
|
|
11576
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
11577
|
+
test3[letter] = letter;
|
|
11578
|
+
});
|
|
11579
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
11580
|
+
'abcdefghijklmnopqrst') {
|
|
11581
|
+
return false;
|
|
11582
|
+
}
|
|
11583
|
+
|
|
11584
|
+
return true;
|
|
11585
|
+
} catch (err) {
|
|
11586
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
11587
|
+
return false;
|
|
11588
|
+
}
|
|
11589
|
+
}
|
|
11590
|
+
|
|
11591
|
+
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
11592
|
+
var from;
|
|
11593
|
+
var to = toObject(target);
|
|
11594
|
+
var symbols;
|
|
11595
|
+
|
|
11596
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
11597
|
+
from = Object(arguments[s]);
|
|
11598
|
+
|
|
11599
|
+
for (var key in from) {
|
|
11600
|
+
if (hasOwnProperty.call(from, key)) {
|
|
11601
|
+
to[key] = from[key];
|
|
11602
|
+
}
|
|
11603
|
+
}
|
|
11604
|
+
|
|
11605
|
+
if (getOwnPropertySymbols) {
|
|
11606
|
+
symbols = getOwnPropertySymbols(from);
|
|
11607
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
11608
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
11609
|
+
to[symbols[i]] = from[symbols[i]];
|
|
11610
|
+
}
|
|
11611
|
+
}
|
|
11612
|
+
}
|
|
11613
|
+
}
|
|
11614
|
+
|
|
11615
|
+
return to;
|
|
11616
|
+
};
|
|
11617
|
+
|
|
11618
|
+
/**
|
|
11619
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
11620
|
+
*
|
|
11621
|
+
* This source code is licensed under the MIT license found in the
|
|
11622
|
+
* LICENSE file in the root directory of this source tree.
|
|
11623
|
+
*/
|
|
11624
|
+
|
|
11625
|
+
var ReactPropTypesSecret$3 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
11626
|
+
|
|
11627
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret$3;
|
|
11628
|
+
|
|
11629
|
+
var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
11630
|
+
|
|
11631
|
+
/**
|
|
11632
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
11633
|
+
*
|
|
11634
|
+
* This source code is licensed under the MIT license found in the
|
|
11635
|
+
* LICENSE file in the root directory of this source tree.
|
|
11636
|
+
*/
|
|
11637
|
+
|
|
11638
|
+
var printWarning$1 = function() {};
|
|
11639
|
+
|
|
11640
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
11641
|
+
var ReactPropTypesSecret$2 = ReactPropTypesSecret_1;
|
|
11642
|
+
var loggedTypeFailures = {};
|
|
11643
|
+
var has$1 = has$2;
|
|
11644
|
+
|
|
11645
|
+
printWarning$1 = function(text) {
|
|
11646
|
+
var message = 'Warning: ' + text;
|
|
11647
|
+
if (typeof console !== 'undefined') {
|
|
11648
|
+
console.error(message);
|
|
11649
|
+
}
|
|
11650
|
+
try {
|
|
11651
|
+
// --- Welcome to debugging React ---
|
|
11652
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
11653
|
+
// to find the callsite that caused this warning to fire.
|
|
11654
|
+
throw new Error(message);
|
|
11655
|
+
} catch (x) { /**/ }
|
|
11656
|
+
};
|
|
11657
|
+
}
|
|
11658
|
+
|
|
11659
|
+
/**
|
|
11660
|
+
* Assert that the values match with the type specs.
|
|
11661
|
+
* Error messages are memorized and will only be shown once.
|
|
11662
|
+
*
|
|
11663
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
11664
|
+
* @param {object} values Runtime values that need to be type-checked
|
|
11665
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
|
11666
|
+
* @param {string} componentName Name of the component for error messages.
|
|
11667
|
+
* @param {?Function} getStack Returns the component stack.
|
|
11668
|
+
* @private
|
|
11669
|
+
*/
|
|
11670
|
+
function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
|
|
11671
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
11672
|
+
for (var typeSpecName in typeSpecs) {
|
|
11673
|
+
if (has$1(typeSpecs, typeSpecName)) {
|
|
11674
|
+
var error;
|
|
11675
|
+
// Prop type validation may throw. In case they do, we don't want to
|
|
11676
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
11677
|
+
// After these have been cleaned up, we'll let them throw.
|
|
11678
|
+
try {
|
|
11679
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
11680
|
+
// behavior as without this statement except with a better message.
|
|
11681
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
11682
|
+
var err = Error(
|
|
11683
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
11684
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
11685
|
+
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
11686
|
+
);
|
|
11687
|
+
err.name = 'Invariant Violation';
|
|
11688
|
+
throw err;
|
|
11689
|
+
}
|
|
11690
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$2);
|
|
11691
|
+
} catch (ex) {
|
|
11692
|
+
error = ex;
|
|
11693
|
+
}
|
|
11694
|
+
if (error && !(error instanceof Error)) {
|
|
11695
|
+
printWarning$1(
|
|
11696
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
11697
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
11698
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
11699
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
11700
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
11701
|
+
'shape all require an argument).'
|
|
11702
|
+
);
|
|
11703
|
+
}
|
|
11704
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
11705
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
11706
|
+
// same error.
|
|
11707
|
+
loggedTypeFailures[error.message] = true;
|
|
11708
|
+
|
|
11709
|
+
var stack = getStack ? getStack() : '';
|
|
11710
|
+
|
|
11711
|
+
printWarning$1(
|
|
11712
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
11713
|
+
);
|
|
11714
|
+
}
|
|
11715
|
+
}
|
|
11716
|
+
}
|
|
11717
|
+
}
|
|
11718
|
+
}
|
|
11719
|
+
|
|
11720
|
+
/**
|
|
11721
|
+
* Resets warning cache when testing.
|
|
11722
|
+
*
|
|
11723
|
+
* @private
|
|
11724
|
+
*/
|
|
11725
|
+
checkPropTypes$1.resetWarningCache = function() {
|
|
11726
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
11727
|
+
loggedTypeFailures = {};
|
|
11728
|
+
}
|
|
11729
|
+
};
|
|
11730
|
+
|
|
11731
|
+
var checkPropTypes_1 = checkPropTypes$1;
|
|
11732
|
+
|
|
11733
|
+
/**
|
|
11734
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
11735
|
+
*
|
|
11736
|
+
* This source code is licensed under the MIT license found in the
|
|
11737
|
+
* LICENSE file in the root directory of this source tree.
|
|
11738
|
+
*/
|
|
11739
|
+
|
|
11740
|
+
var ReactIs$1 = reactIs$1.exports;
|
|
11741
|
+
var assign = objectAssign;
|
|
11742
|
+
|
|
11743
|
+
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
11744
|
+
var has = has$2;
|
|
11745
|
+
var checkPropTypes = checkPropTypes_1;
|
|
11746
|
+
|
|
11747
|
+
var printWarning = function() {};
|
|
11748
|
+
|
|
11749
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
11750
|
+
printWarning = function(text) {
|
|
11751
|
+
var message = 'Warning: ' + text;
|
|
11752
|
+
if (typeof console !== 'undefined') {
|
|
11753
|
+
console.error(message);
|
|
11754
|
+
}
|
|
11755
|
+
try {
|
|
11756
|
+
// --- Welcome to debugging React ---
|
|
11757
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
11758
|
+
// to find the callsite that caused this warning to fire.
|
|
11759
|
+
throw new Error(message);
|
|
11760
|
+
} catch (x) {}
|
|
11761
|
+
};
|
|
11762
|
+
}
|
|
11763
|
+
|
|
11764
|
+
function emptyFunctionThatReturnsNull() {
|
|
11765
|
+
return null;
|
|
11766
|
+
}
|
|
11767
|
+
|
|
11768
|
+
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
11769
|
+
/* global Symbol */
|
|
11770
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
11771
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
11772
|
+
|
|
11773
|
+
/**
|
|
11774
|
+
* Returns the iterator method function contained on the iterable object.
|
|
11775
|
+
*
|
|
11776
|
+
* Be sure to invoke the function with the iterable as context:
|
|
11777
|
+
*
|
|
11778
|
+
* var iteratorFn = getIteratorFn(myIterable);
|
|
11779
|
+
* if (iteratorFn) {
|
|
11780
|
+
* var iterator = iteratorFn.call(myIterable);
|
|
11781
|
+
* ...
|
|
11782
|
+
* }
|
|
11783
|
+
*
|
|
11784
|
+
* @param {?object} maybeIterable
|
|
11785
|
+
* @return {?function}
|
|
11786
|
+
*/
|
|
11787
|
+
function getIteratorFn(maybeIterable) {
|
|
11788
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
11789
|
+
if (typeof iteratorFn === 'function') {
|
|
11790
|
+
return iteratorFn;
|
|
11791
|
+
}
|
|
11792
|
+
}
|
|
11793
|
+
|
|
11794
|
+
/**
|
|
11795
|
+
* Collection of methods that allow declaration and validation of props that are
|
|
11796
|
+
* supplied to React components. Example usage:
|
|
11797
|
+
*
|
|
11798
|
+
* var Props = require('ReactPropTypes');
|
|
11799
|
+
* var MyArticle = React.createClass({
|
|
11800
|
+
* propTypes: {
|
|
11801
|
+
* // An optional string prop named "description".
|
|
11802
|
+
* description: Props.string,
|
|
11803
|
+
*
|
|
11804
|
+
* // A required enum prop named "category".
|
|
11805
|
+
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
11806
|
+
*
|
|
11807
|
+
* // A prop named "dialog" that requires an instance of Dialog.
|
|
11808
|
+
* dialog: Props.instanceOf(Dialog).isRequired
|
|
11809
|
+
* },
|
|
11810
|
+
* render: function() { ... }
|
|
11811
|
+
* });
|
|
11812
|
+
*
|
|
11813
|
+
* A more formal specification of how these methods are used:
|
|
11814
|
+
*
|
|
11815
|
+
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
11816
|
+
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
11817
|
+
*
|
|
11818
|
+
* Each and every declaration produces a function with the same signature. This
|
|
11819
|
+
* allows the creation of custom validation functions. For example:
|
|
11820
|
+
*
|
|
11821
|
+
* var MyLink = React.createClass({
|
|
11822
|
+
* propTypes: {
|
|
11823
|
+
* // An optional string or URI prop named "href".
|
|
11824
|
+
* href: function(props, propName, componentName) {
|
|
11825
|
+
* var propValue = props[propName];
|
|
11826
|
+
* if (propValue != null && typeof propValue !== 'string' &&
|
|
11827
|
+
* !(propValue instanceof URI)) {
|
|
11828
|
+
* return new Error(
|
|
11829
|
+
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
11830
|
+
* componentName
|
|
11831
|
+
* );
|
|
11832
|
+
* }
|
|
11833
|
+
* }
|
|
11834
|
+
* },
|
|
11835
|
+
* render: function() {...}
|
|
11836
|
+
* });
|
|
11837
|
+
*
|
|
11838
|
+
* @internal
|
|
11839
|
+
*/
|
|
11840
|
+
|
|
11841
|
+
var ANONYMOUS = '<<anonymous>>';
|
|
11842
|
+
|
|
11843
|
+
// Important!
|
|
11844
|
+
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
11845
|
+
var ReactPropTypes = {
|
|
11846
|
+
array: createPrimitiveTypeChecker('array'),
|
|
11847
|
+
bigint: createPrimitiveTypeChecker('bigint'),
|
|
11848
|
+
bool: createPrimitiveTypeChecker('boolean'),
|
|
11849
|
+
func: createPrimitiveTypeChecker('function'),
|
|
11850
|
+
number: createPrimitiveTypeChecker('number'),
|
|
11851
|
+
object: createPrimitiveTypeChecker('object'),
|
|
11852
|
+
string: createPrimitiveTypeChecker('string'),
|
|
11853
|
+
symbol: createPrimitiveTypeChecker('symbol'),
|
|
11854
|
+
|
|
11855
|
+
any: createAnyTypeChecker(),
|
|
11856
|
+
arrayOf: createArrayOfTypeChecker,
|
|
11857
|
+
element: createElementTypeChecker(),
|
|
11858
|
+
elementType: createElementTypeTypeChecker(),
|
|
11859
|
+
instanceOf: createInstanceTypeChecker,
|
|
11860
|
+
node: createNodeChecker(),
|
|
11861
|
+
objectOf: createObjectOfTypeChecker,
|
|
11862
|
+
oneOf: createEnumTypeChecker,
|
|
11863
|
+
oneOfType: createUnionTypeChecker,
|
|
11864
|
+
shape: createShapeTypeChecker,
|
|
11865
|
+
exact: createStrictShapeTypeChecker,
|
|
11866
|
+
};
|
|
11867
|
+
|
|
11868
|
+
/**
|
|
11869
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
11870
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
11871
|
+
*/
|
|
11872
|
+
/*eslint-disable no-self-compare*/
|
|
11873
|
+
function is(x, y) {
|
|
11874
|
+
// SameValue algorithm
|
|
11875
|
+
if (x === y) {
|
|
11876
|
+
// Steps 1-5, 7-10
|
|
11877
|
+
// Steps 6.b-6.e: +0 != -0
|
|
11878
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
11879
|
+
} else {
|
|
11880
|
+
// Step 6.a: NaN == NaN
|
|
11881
|
+
return x !== x && y !== y;
|
|
11882
|
+
}
|
|
11883
|
+
}
|
|
11884
|
+
/*eslint-enable no-self-compare*/
|
|
11885
|
+
|
|
11886
|
+
/**
|
|
11887
|
+
* We use an Error-like object for backward compatibility as people may call
|
|
11888
|
+
* PropTypes directly and inspect their output. However, we don't use real
|
|
11889
|
+
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
11890
|
+
* is prohibitively expensive if they are created too often, such as what
|
|
11891
|
+
* happens in oneOfType() for any type before the one that matched.
|
|
11892
|
+
*/
|
|
11893
|
+
function PropTypeError(message, data) {
|
|
11894
|
+
this.message = message;
|
|
11895
|
+
this.data = data && typeof data === 'object' ? data: {};
|
|
11896
|
+
this.stack = '';
|
|
11897
|
+
}
|
|
11898
|
+
// Make `instanceof Error` still work for returned errors.
|
|
11899
|
+
PropTypeError.prototype = Error.prototype;
|
|
11900
|
+
|
|
11901
|
+
function createChainableTypeChecker(validate) {
|
|
11902
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
11903
|
+
var manualPropTypeCallCache = {};
|
|
11904
|
+
var manualPropTypeWarningCount = 0;
|
|
11905
|
+
}
|
|
11906
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
11907
|
+
componentName = componentName || ANONYMOUS;
|
|
11908
|
+
propFullName = propFullName || propName;
|
|
11909
|
+
|
|
11910
|
+
if (secret !== ReactPropTypesSecret$1) {
|
|
11911
|
+
if (throwOnDirectAccess) {
|
|
11912
|
+
// New behavior only for users of `prop-types` package
|
|
11913
|
+
var err = new Error(
|
|
11914
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
11915
|
+
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
11916
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
11917
|
+
);
|
|
11918
|
+
err.name = 'Invariant Violation';
|
|
11919
|
+
throw err;
|
|
11920
|
+
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
11921
|
+
// Old behavior for people using React.PropTypes
|
|
11922
|
+
var cacheKey = componentName + ':' + propName;
|
|
11923
|
+
if (
|
|
11924
|
+
!manualPropTypeCallCache[cacheKey] &&
|
|
11925
|
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
11926
|
+
manualPropTypeWarningCount < 3
|
|
11927
|
+
) {
|
|
11928
|
+
printWarning(
|
|
11929
|
+
'You are manually calling a React.PropTypes validation ' +
|
|
11930
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
11931
|
+
'and will throw in the standalone `prop-types` package. ' +
|
|
11932
|
+
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
11933
|
+
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
11934
|
+
);
|
|
11935
|
+
manualPropTypeCallCache[cacheKey] = true;
|
|
11936
|
+
manualPropTypeWarningCount++;
|
|
11937
|
+
}
|
|
11938
|
+
}
|
|
11939
|
+
}
|
|
11940
|
+
if (props[propName] == null) {
|
|
11941
|
+
if (isRequired) {
|
|
11942
|
+
if (props[propName] === null) {
|
|
11943
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
11944
|
+
}
|
|
11945
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
11946
|
+
}
|
|
11947
|
+
return null;
|
|
11948
|
+
} else {
|
|
11949
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
11950
|
+
}
|
|
11951
|
+
}
|
|
11952
|
+
|
|
11953
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
11954
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
11955
|
+
|
|
11956
|
+
return chainedCheckType;
|
|
11957
|
+
}
|
|
11958
|
+
|
|
11959
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
11960
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
11961
|
+
var propValue = props[propName];
|
|
11962
|
+
var propType = getPropType(propValue);
|
|
11963
|
+
if (propType !== expectedType) {
|
|
11964
|
+
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
11965
|
+
// check, but we can offer a more precise error message here rather than
|
|
11966
|
+
// 'of type `object`'.
|
|
11967
|
+
var preciseType = getPreciseType(propValue);
|
|
11968
|
+
|
|
11969
|
+
return new PropTypeError(
|
|
11970
|
+
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
11971
|
+
{expectedType: expectedType}
|
|
11972
|
+
);
|
|
11973
|
+
}
|
|
11974
|
+
return null;
|
|
11975
|
+
}
|
|
11976
|
+
return createChainableTypeChecker(validate);
|
|
11977
|
+
}
|
|
11978
|
+
|
|
11979
|
+
function createAnyTypeChecker() {
|
|
11980
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
11981
|
+
}
|
|
11982
|
+
|
|
11983
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
11984
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
11985
|
+
if (typeof typeChecker !== 'function') {
|
|
11986
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
11987
|
+
}
|
|
11988
|
+
var propValue = props[propName];
|
|
11989
|
+
if (!Array.isArray(propValue)) {
|
|
11990
|
+
var propType = getPropType(propValue);
|
|
11991
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
11992
|
+
}
|
|
11993
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
11994
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret$1);
|
|
11995
|
+
if (error instanceof Error) {
|
|
11996
|
+
return error;
|
|
11997
|
+
}
|
|
11998
|
+
}
|
|
11999
|
+
return null;
|
|
12000
|
+
}
|
|
12001
|
+
return createChainableTypeChecker(validate);
|
|
12002
|
+
}
|
|
12003
|
+
|
|
12004
|
+
function createElementTypeChecker() {
|
|
12005
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
12006
|
+
var propValue = props[propName];
|
|
12007
|
+
if (!isValidElement(propValue)) {
|
|
12008
|
+
var propType = getPropType(propValue);
|
|
12009
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
12010
|
+
}
|
|
12011
|
+
return null;
|
|
12012
|
+
}
|
|
12013
|
+
return createChainableTypeChecker(validate);
|
|
12014
|
+
}
|
|
12015
|
+
|
|
12016
|
+
function createElementTypeTypeChecker() {
|
|
12017
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
12018
|
+
var propValue = props[propName];
|
|
12019
|
+
if (!ReactIs$1.isValidElementType(propValue)) {
|
|
12020
|
+
var propType = getPropType(propValue);
|
|
12021
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
12022
|
+
}
|
|
12023
|
+
return null;
|
|
12024
|
+
}
|
|
12025
|
+
return createChainableTypeChecker(validate);
|
|
12026
|
+
}
|
|
12027
|
+
|
|
12028
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
12029
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
12030
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
12031
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
12032
|
+
var actualClassName = getClassName(props[propName]);
|
|
12033
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
12034
|
+
}
|
|
12035
|
+
return null;
|
|
12036
|
+
}
|
|
12037
|
+
return createChainableTypeChecker(validate);
|
|
12038
|
+
}
|
|
12039
|
+
|
|
12040
|
+
function createEnumTypeChecker(expectedValues) {
|
|
12041
|
+
if (!Array.isArray(expectedValues)) {
|
|
12042
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
12043
|
+
if (arguments.length > 1) {
|
|
12044
|
+
printWarning(
|
|
12045
|
+
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
12046
|
+
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
12047
|
+
);
|
|
12048
|
+
} else {
|
|
12049
|
+
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
12050
|
+
}
|
|
12051
|
+
}
|
|
12052
|
+
return emptyFunctionThatReturnsNull;
|
|
12053
|
+
}
|
|
12054
|
+
|
|
12055
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
12056
|
+
var propValue = props[propName];
|
|
12057
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
12058
|
+
if (is(propValue, expectedValues[i])) {
|
|
12059
|
+
return null;
|
|
12060
|
+
}
|
|
12061
|
+
}
|
|
12062
|
+
|
|
12063
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
12064
|
+
var type = getPreciseType(value);
|
|
12065
|
+
if (type === 'symbol') {
|
|
12066
|
+
return String(value);
|
|
12067
|
+
}
|
|
12068
|
+
return value;
|
|
12069
|
+
});
|
|
12070
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
12071
|
+
}
|
|
12072
|
+
return createChainableTypeChecker(validate);
|
|
12073
|
+
}
|
|
12074
|
+
|
|
12075
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
12076
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
12077
|
+
if (typeof typeChecker !== 'function') {
|
|
12078
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
12079
|
+
}
|
|
12080
|
+
var propValue = props[propName];
|
|
12081
|
+
var propType = getPropType(propValue);
|
|
12082
|
+
if (propType !== 'object') {
|
|
12083
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
12084
|
+
}
|
|
12085
|
+
for (var key in propValue) {
|
|
12086
|
+
if (has(propValue, key)) {
|
|
12087
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
|
|
12088
|
+
if (error instanceof Error) {
|
|
12089
|
+
return error;
|
|
12090
|
+
}
|
|
12091
|
+
}
|
|
12092
|
+
}
|
|
12093
|
+
return null;
|
|
12094
|
+
}
|
|
12095
|
+
return createChainableTypeChecker(validate);
|
|
12096
|
+
}
|
|
12097
|
+
|
|
12098
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
12099
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
12100
|
+
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
12101
|
+
return emptyFunctionThatReturnsNull;
|
|
12102
|
+
}
|
|
12103
|
+
|
|
12104
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
12105
|
+
var checker = arrayOfTypeCheckers[i];
|
|
12106
|
+
if (typeof checker !== 'function') {
|
|
12107
|
+
printWarning(
|
|
12108
|
+
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
12109
|
+
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
12110
|
+
);
|
|
12111
|
+
return emptyFunctionThatReturnsNull;
|
|
12112
|
+
}
|
|
12113
|
+
}
|
|
12114
|
+
|
|
12115
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
12116
|
+
var expectedTypes = [];
|
|
12117
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
12118
|
+
var checker = arrayOfTypeCheckers[i];
|
|
12119
|
+
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1);
|
|
12120
|
+
if (checkerResult == null) {
|
|
12121
|
+
return null;
|
|
12122
|
+
}
|
|
12123
|
+
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
12124
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
12125
|
+
}
|
|
12126
|
+
}
|
|
12127
|
+
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
12128
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
12129
|
+
}
|
|
12130
|
+
return createChainableTypeChecker(validate);
|
|
12131
|
+
}
|
|
12132
|
+
|
|
12133
|
+
function createNodeChecker() {
|
|
12134
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
12135
|
+
if (!isNode(props[propName])) {
|
|
12136
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
12137
|
+
}
|
|
12138
|
+
return null;
|
|
12139
|
+
}
|
|
12140
|
+
return createChainableTypeChecker(validate);
|
|
12141
|
+
}
|
|
12142
|
+
|
|
12143
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
12144
|
+
return new PropTypeError(
|
|
12145
|
+
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
12146
|
+
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
12147
|
+
);
|
|
12148
|
+
}
|
|
12149
|
+
|
|
12150
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
12151
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
12152
|
+
var propValue = props[propName];
|
|
12153
|
+
var propType = getPropType(propValue);
|
|
12154
|
+
if (propType !== 'object') {
|
|
12155
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
12156
|
+
}
|
|
12157
|
+
for (var key in shapeTypes) {
|
|
12158
|
+
var checker = shapeTypes[key];
|
|
12159
|
+
if (typeof checker !== 'function') {
|
|
12160
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
12161
|
+
}
|
|
12162
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
|
|
12163
|
+
if (error) {
|
|
12164
|
+
return error;
|
|
12165
|
+
}
|
|
12166
|
+
}
|
|
12167
|
+
return null;
|
|
12168
|
+
}
|
|
12169
|
+
return createChainableTypeChecker(validate);
|
|
12170
|
+
}
|
|
12171
|
+
|
|
12172
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
12173
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
12174
|
+
var propValue = props[propName];
|
|
12175
|
+
var propType = getPropType(propValue);
|
|
12176
|
+
if (propType !== 'object') {
|
|
12177
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
12178
|
+
}
|
|
12179
|
+
// We need to check all keys in case some are required but missing from props.
|
|
12180
|
+
var allKeys = assign({}, props[propName], shapeTypes);
|
|
12181
|
+
for (var key in allKeys) {
|
|
12182
|
+
var checker = shapeTypes[key];
|
|
12183
|
+
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
12184
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
12185
|
+
}
|
|
12186
|
+
if (!checker) {
|
|
12187
|
+
return new PropTypeError(
|
|
12188
|
+
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
12189
|
+
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
12190
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
12191
|
+
);
|
|
12192
|
+
}
|
|
12193
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
|
|
12194
|
+
if (error) {
|
|
12195
|
+
return error;
|
|
12196
|
+
}
|
|
12197
|
+
}
|
|
12198
|
+
return null;
|
|
12199
|
+
}
|
|
12200
|
+
|
|
12201
|
+
return createChainableTypeChecker(validate);
|
|
12202
|
+
}
|
|
12203
|
+
|
|
12204
|
+
function isNode(propValue) {
|
|
12205
|
+
switch (typeof propValue) {
|
|
12206
|
+
case 'number':
|
|
12207
|
+
case 'string':
|
|
12208
|
+
case 'undefined':
|
|
12209
|
+
return true;
|
|
12210
|
+
case 'boolean':
|
|
12211
|
+
return !propValue;
|
|
12212
|
+
case 'object':
|
|
12213
|
+
if (Array.isArray(propValue)) {
|
|
12214
|
+
return propValue.every(isNode);
|
|
12215
|
+
}
|
|
12216
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
12217
|
+
return true;
|
|
12218
|
+
}
|
|
12219
|
+
|
|
12220
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
12221
|
+
if (iteratorFn) {
|
|
12222
|
+
var iterator = iteratorFn.call(propValue);
|
|
12223
|
+
var step;
|
|
12224
|
+
if (iteratorFn !== propValue.entries) {
|
|
12225
|
+
while (!(step = iterator.next()).done) {
|
|
12226
|
+
if (!isNode(step.value)) {
|
|
12227
|
+
return false;
|
|
12228
|
+
}
|
|
12229
|
+
}
|
|
12230
|
+
} else {
|
|
12231
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
|
12232
|
+
while (!(step = iterator.next()).done) {
|
|
12233
|
+
var entry = step.value;
|
|
12234
|
+
if (entry) {
|
|
12235
|
+
if (!isNode(entry[1])) {
|
|
12236
|
+
return false;
|
|
12237
|
+
}
|
|
12238
|
+
}
|
|
12239
|
+
}
|
|
12240
|
+
}
|
|
12241
|
+
} else {
|
|
12242
|
+
return false;
|
|
12243
|
+
}
|
|
12244
|
+
|
|
12245
|
+
return true;
|
|
12246
|
+
default:
|
|
12247
|
+
return false;
|
|
12248
|
+
}
|
|
12249
|
+
}
|
|
12250
|
+
|
|
12251
|
+
function isSymbol(propType, propValue) {
|
|
12252
|
+
// Native Symbol.
|
|
12253
|
+
if (propType === 'symbol') {
|
|
12254
|
+
return true;
|
|
12255
|
+
}
|
|
12256
|
+
|
|
12257
|
+
// falsy value can't be a Symbol
|
|
12258
|
+
if (!propValue) {
|
|
12259
|
+
return false;
|
|
12260
|
+
}
|
|
12261
|
+
|
|
12262
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
12263
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
12264
|
+
return true;
|
|
12265
|
+
}
|
|
12266
|
+
|
|
12267
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
12268
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
12269
|
+
return true;
|
|
12270
|
+
}
|
|
12271
|
+
|
|
12272
|
+
return false;
|
|
12273
|
+
}
|
|
12274
|
+
|
|
12275
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
12276
|
+
function getPropType(propValue) {
|
|
12277
|
+
var propType = typeof propValue;
|
|
12278
|
+
if (Array.isArray(propValue)) {
|
|
12279
|
+
return 'array';
|
|
12280
|
+
}
|
|
12281
|
+
if (propValue instanceof RegExp) {
|
|
12282
|
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
12283
|
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
12284
|
+
// passes PropTypes.object.
|
|
12285
|
+
return 'object';
|
|
12286
|
+
}
|
|
12287
|
+
if (isSymbol(propType, propValue)) {
|
|
12288
|
+
return 'symbol';
|
|
12289
|
+
}
|
|
12290
|
+
return propType;
|
|
12291
|
+
}
|
|
12292
|
+
|
|
12293
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
|
12294
|
+
// See `createPrimitiveTypeChecker`.
|
|
12295
|
+
function getPreciseType(propValue) {
|
|
12296
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
|
12297
|
+
return '' + propValue;
|
|
12298
|
+
}
|
|
12299
|
+
var propType = getPropType(propValue);
|
|
12300
|
+
if (propType === 'object') {
|
|
12301
|
+
if (propValue instanceof Date) {
|
|
12302
|
+
return 'date';
|
|
12303
|
+
} else if (propValue instanceof RegExp) {
|
|
12304
|
+
return 'regexp';
|
|
12305
|
+
}
|
|
12306
|
+
}
|
|
12307
|
+
return propType;
|
|
12308
|
+
}
|
|
12309
|
+
|
|
12310
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
|
12311
|
+
// For example, "undefined" or "of type array"
|
|
12312
|
+
function getPostfixForTypeWarning(value) {
|
|
12313
|
+
var type = getPreciseType(value);
|
|
12314
|
+
switch (type) {
|
|
12315
|
+
case 'array':
|
|
12316
|
+
case 'object':
|
|
12317
|
+
return 'an ' + type;
|
|
12318
|
+
case 'boolean':
|
|
12319
|
+
case 'date':
|
|
12320
|
+
case 'regexp':
|
|
12321
|
+
return 'a ' + type;
|
|
12322
|
+
default:
|
|
12323
|
+
return type;
|
|
12324
|
+
}
|
|
12325
|
+
}
|
|
12326
|
+
|
|
12327
|
+
// Returns class name of the object, if any.
|
|
12328
|
+
function getClassName(propValue) {
|
|
12329
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
12330
|
+
return ANONYMOUS;
|
|
12331
|
+
}
|
|
12332
|
+
return propValue.constructor.name;
|
|
12333
|
+
}
|
|
12334
|
+
|
|
12335
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
12336
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
12337
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
12338
|
+
|
|
12339
|
+
return ReactPropTypes;
|
|
12340
|
+
};
|
|
12341
|
+
|
|
12342
|
+
/**
|
|
12343
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
12344
|
+
*
|
|
12345
|
+
* This source code is licensed under the MIT license found in the
|
|
12346
|
+
* LICENSE file in the root directory of this source tree.
|
|
12347
|
+
*/
|
|
12348
|
+
|
|
12349
|
+
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
12350
|
+
|
|
12351
|
+
function emptyFunction() {}
|
|
12352
|
+
function emptyFunctionWithReset() {}
|
|
12353
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
12354
|
+
|
|
12355
|
+
var factoryWithThrowingShims = function() {
|
|
12356
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
12357
|
+
if (secret === ReactPropTypesSecret) {
|
|
12358
|
+
// It is still safe when called from React.
|
|
12359
|
+
return;
|
|
12360
|
+
}
|
|
12361
|
+
var err = new Error(
|
|
12362
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
12363
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
12364
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
12365
|
+
);
|
|
12366
|
+
err.name = 'Invariant Violation';
|
|
12367
|
+
throw err;
|
|
12368
|
+
} shim.isRequired = shim;
|
|
12369
|
+
function getShim() {
|
|
12370
|
+
return shim;
|
|
12371
|
+
} // Important!
|
|
12372
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
12373
|
+
var ReactPropTypes = {
|
|
12374
|
+
array: shim,
|
|
12375
|
+
bigint: shim,
|
|
12376
|
+
bool: shim,
|
|
12377
|
+
func: shim,
|
|
12378
|
+
number: shim,
|
|
12379
|
+
object: shim,
|
|
12380
|
+
string: shim,
|
|
12381
|
+
symbol: shim,
|
|
12382
|
+
|
|
12383
|
+
any: shim,
|
|
12384
|
+
arrayOf: getShim,
|
|
12385
|
+
element: shim,
|
|
12386
|
+
elementType: shim,
|
|
12387
|
+
instanceOf: getShim,
|
|
12388
|
+
node: shim,
|
|
12389
|
+
objectOf: getShim,
|
|
12390
|
+
oneOf: getShim,
|
|
12391
|
+
oneOfType: getShim,
|
|
12392
|
+
shape: getShim,
|
|
12393
|
+
exact: getShim,
|
|
12394
|
+
|
|
12395
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
12396
|
+
resetWarningCache: emptyFunction
|
|
12397
|
+
};
|
|
12398
|
+
|
|
12399
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
12400
|
+
|
|
12401
|
+
return ReactPropTypes;
|
|
12402
|
+
};
|
|
12403
|
+
|
|
12404
|
+
/**
|
|
12405
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
12406
|
+
*
|
|
12407
|
+
* This source code is licensed under the MIT license found in the
|
|
12408
|
+
* LICENSE file in the root directory of this source tree.
|
|
12409
|
+
*/
|
|
12410
|
+
|
|
12411
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
12412
|
+
var ReactIs = reactIs$1.exports;
|
|
12413
|
+
|
|
12414
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
12415
|
+
// http://fb.me/prop-types-in-prod
|
|
12416
|
+
var throwOnDirectAccess = true;
|
|
12417
|
+
propTypes.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
|
12418
|
+
} else {
|
|
12419
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
12420
|
+
// http://fb.me/prop-types-in-prod
|
|
12421
|
+
propTypes.exports = factoryWithThrowingShims();
|
|
12422
|
+
}
|
|
12423
|
+
|
|
12424
|
+
var PropTypes = propTypes.exports;
|
|
12425
|
+
|
|
12426
|
+
var COMMON_MIME_TYPES = new Map([
|
|
12427
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
|
|
12428
|
+
['aac', 'audio/aac'],
|
|
12429
|
+
['abw', 'application/x-abiword'],
|
|
12430
|
+
['arc', 'application/x-freearc'],
|
|
12431
|
+
['avif', 'image/avif'],
|
|
12432
|
+
['avi', 'video/x-msvideo'],
|
|
12433
|
+
['azw', 'application/vnd.amazon.ebook'],
|
|
12434
|
+
['bin', 'application/octet-stream'],
|
|
12435
|
+
['bmp', 'image/bmp'],
|
|
12436
|
+
['bz', 'application/x-bzip'],
|
|
12437
|
+
['bz2', 'application/x-bzip2'],
|
|
12438
|
+
['cda', 'application/x-cdf'],
|
|
12439
|
+
['csh', 'application/x-csh'],
|
|
12440
|
+
['css', 'text/css'],
|
|
12441
|
+
['csv', 'text/csv'],
|
|
12442
|
+
['doc', 'application/msword'],
|
|
12443
|
+
['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
|
|
12444
|
+
['eot', 'application/vnd.ms-fontobject'],
|
|
12445
|
+
['epub', 'application/epub+zip'],
|
|
12446
|
+
['gz', 'application/gzip'],
|
|
12447
|
+
['gif', 'image/gif'],
|
|
12448
|
+
['heic', 'image/heic'],
|
|
12449
|
+
['heif', 'image/heif'],
|
|
12450
|
+
['htm', 'text/html'],
|
|
12451
|
+
['html', 'text/html'],
|
|
12452
|
+
['ico', 'image/vnd.microsoft.icon'],
|
|
12453
|
+
['ics', 'text/calendar'],
|
|
12454
|
+
['jar', 'application/java-archive'],
|
|
12455
|
+
['jpeg', 'image/jpeg'],
|
|
12456
|
+
['jpg', 'image/jpeg'],
|
|
12457
|
+
['js', 'text/javascript'],
|
|
12458
|
+
['json', 'application/json'],
|
|
12459
|
+
['jsonld', 'application/ld+json'],
|
|
12460
|
+
['mid', 'audio/midi'],
|
|
12461
|
+
['midi', 'audio/midi'],
|
|
12462
|
+
['mjs', 'text/javascript'],
|
|
12463
|
+
['mp3', 'audio/mpeg'],
|
|
12464
|
+
['mp4', 'video/mp4'],
|
|
12465
|
+
['mpeg', 'video/mpeg'],
|
|
12466
|
+
['mpkg', 'application/vnd.apple.installer+xml'],
|
|
12467
|
+
['odp', 'application/vnd.oasis.opendocument.presentation'],
|
|
12468
|
+
['ods', 'application/vnd.oasis.opendocument.spreadsheet'],
|
|
12469
|
+
['odt', 'application/vnd.oasis.opendocument.text'],
|
|
12470
|
+
['oga', 'audio/ogg'],
|
|
12471
|
+
['ogv', 'video/ogg'],
|
|
12472
|
+
['ogx', 'application/ogg'],
|
|
12473
|
+
['opus', 'audio/opus'],
|
|
12474
|
+
['otf', 'font/otf'],
|
|
12475
|
+
['png', 'image/png'],
|
|
12476
|
+
['pdf', 'application/pdf'],
|
|
12477
|
+
['php', 'application/x-httpd-php'],
|
|
12478
|
+
['ppt', 'application/vnd.ms-powerpoint'],
|
|
12479
|
+
['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
|
|
12480
|
+
['rar', 'application/vnd.rar'],
|
|
12481
|
+
['rtf', 'application/rtf'],
|
|
12482
|
+
['sh', 'application/x-sh'],
|
|
12483
|
+
['svg', 'image/svg+xml'],
|
|
12484
|
+
['swf', 'application/x-shockwave-flash'],
|
|
12485
|
+
['tar', 'application/x-tar'],
|
|
12486
|
+
['tif', 'image/tiff'],
|
|
12487
|
+
['tiff', 'image/tiff'],
|
|
12488
|
+
['ts', 'video/mp2t'],
|
|
12489
|
+
['ttf', 'font/ttf'],
|
|
12490
|
+
['txt', 'text/plain'],
|
|
12491
|
+
['vsd', 'application/vnd.visio'],
|
|
12492
|
+
['wav', 'audio/wav'],
|
|
12493
|
+
['weba', 'audio/webm'],
|
|
12494
|
+
['webm', 'video/webm'],
|
|
12495
|
+
['webp', 'image/webp'],
|
|
12496
|
+
['woff', 'font/woff'],
|
|
12497
|
+
['woff2', 'font/woff2'],
|
|
12498
|
+
['xhtml', 'application/xhtml+xml'],
|
|
12499
|
+
['xls', 'application/vnd.ms-excel'],
|
|
12500
|
+
['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
|
|
12501
|
+
['xml', 'application/xml'],
|
|
12502
|
+
['xul', 'application/vnd.mozilla.xul+xml'],
|
|
12503
|
+
['zip', 'application/zip'],
|
|
12504
|
+
['7z', 'application/x-7z-compressed'],
|
|
12505
|
+
// Others
|
|
12506
|
+
['mkv', 'video/x-matroska'],
|
|
12507
|
+
['mov', 'video/quicktime'],
|
|
12508
|
+
['msg', 'application/vnd.ms-outlook']
|
|
12509
|
+
]);
|
|
12510
|
+
function toFileWithPath(file, path) {
|
|
12511
|
+
var f = withMimeType(file);
|
|
12512
|
+
if (typeof f.path !== 'string') { // on electron, path is already set to the absolute path
|
|
12513
|
+
var webkitRelativePath = file.webkitRelativePath;
|
|
12514
|
+
Object.defineProperty(f, 'path', {
|
|
12515
|
+
value: typeof path === 'string'
|
|
12516
|
+
? path
|
|
12517
|
+
// If <input webkitdirectory> is set,
|
|
12518
|
+
// the File will have a {webkitRelativePath} property
|
|
12519
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory
|
|
12520
|
+
: typeof webkitRelativePath === 'string' && webkitRelativePath.length > 0
|
|
12521
|
+
? webkitRelativePath
|
|
12522
|
+
: file.name,
|
|
12523
|
+
writable: false,
|
|
12524
|
+
configurable: false,
|
|
12525
|
+
enumerable: true
|
|
12526
|
+
});
|
|
12527
|
+
}
|
|
12528
|
+
return f;
|
|
12529
|
+
}
|
|
12530
|
+
function withMimeType(file) {
|
|
12531
|
+
var name = file.name;
|
|
12532
|
+
var hasExtension = name && name.lastIndexOf('.') !== -1;
|
|
12533
|
+
if (hasExtension && !file.type) {
|
|
12534
|
+
var ext = name.split('.')
|
|
12535
|
+
.pop().toLowerCase();
|
|
12536
|
+
var type = COMMON_MIME_TYPES.get(ext);
|
|
12537
|
+
if (type) {
|
|
12538
|
+
Object.defineProperty(file, 'type', {
|
|
12539
|
+
value: type,
|
|
12540
|
+
writable: false,
|
|
12541
|
+
configurable: false,
|
|
12542
|
+
enumerable: true
|
|
12543
|
+
});
|
|
12544
|
+
}
|
|
12545
|
+
}
|
|
12546
|
+
return file;
|
|
12547
|
+
}
|
|
12548
|
+
|
|
12549
|
+
var FILES_TO_IGNORE = [
|
|
12550
|
+
// Thumbnail cache files for macOS and Windows
|
|
12551
|
+
'.DS_Store',
|
|
12552
|
+
'Thumbs.db' // Windows
|
|
12553
|
+
];
|
|
12554
|
+
/**
|
|
12555
|
+
* Convert a DragEvent's DataTrasfer object to a list of File objects
|
|
12556
|
+
* NOTE: If some of the items are folders,
|
|
12557
|
+
* everything will be flattened and placed in the same list but the paths will be kept as a {path} property.
|
|
12558
|
+
*
|
|
12559
|
+
* EXPERIMENTAL: A list of https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle objects can also be passed as an arg
|
|
12560
|
+
* and a list of File objects will be returned.
|
|
12561
|
+
*
|
|
12562
|
+
* @param evt
|
|
12563
|
+
*/
|
|
12564
|
+
function fromEvent(evt) {
|
|
12565
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12566
|
+
return __generator(this, function (_a) {
|
|
12567
|
+
if (isObject(evt) && isDataTransfer(evt.dataTransfer)) {
|
|
12568
|
+
return [2 /*return*/, getDataTransferFiles(evt.dataTransfer, evt.type)];
|
|
12569
|
+
}
|
|
12570
|
+
else if (isChangeEvt(evt)) {
|
|
12571
|
+
return [2 /*return*/, getInputFiles(evt)];
|
|
12572
|
+
}
|
|
12573
|
+
else if (Array.isArray(evt) && evt.every(function (item) { return 'getFile' in item && typeof item.getFile === 'function'; })) {
|
|
12574
|
+
return [2 /*return*/, getFsHandleFiles(evt)];
|
|
12575
|
+
}
|
|
12576
|
+
return [2 /*return*/, []];
|
|
12577
|
+
});
|
|
12578
|
+
});
|
|
12579
|
+
}
|
|
12580
|
+
function isDataTransfer(value) {
|
|
12581
|
+
return isObject(value);
|
|
12582
|
+
}
|
|
12583
|
+
function isChangeEvt(value) {
|
|
12584
|
+
return isObject(value) && isObject(value.target);
|
|
12585
|
+
}
|
|
12586
|
+
function isObject(v) {
|
|
12587
|
+
return typeof v === 'object' && v !== null;
|
|
12588
|
+
}
|
|
12589
|
+
function getInputFiles(evt) {
|
|
12590
|
+
return fromList(evt.target.files).map(function (file) { return toFileWithPath(file); });
|
|
12591
|
+
}
|
|
12592
|
+
// Ee expect each handle to be https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle
|
|
12593
|
+
function getFsHandleFiles(handles) {
|
|
12594
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12595
|
+
var files;
|
|
12596
|
+
return __generator(this, function (_a) {
|
|
12597
|
+
switch (_a.label) {
|
|
12598
|
+
case 0: return [4 /*yield*/, Promise.all(handles.map(function (h) { return h.getFile(); }))];
|
|
12599
|
+
case 1:
|
|
12600
|
+
files = _a.sent();
|
|
12601
|
+
return [2 /*return*/, files.map(function (file) { return toFileWithPath(file); })];
|
|
12602
|
+
}
|
|
12603
|
+
});
|
|
12604
|
+
});
|
|
12605
|
+
}
|
|
12606
|
+
function getDataTransferFiles(dt, type) {
|
|
12607
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12608
|
+
var items, files;
|
|
12609
|
+
return __generator(this, function (_a) {
|
|
12610
|
+
switch (_a.label) {
|
|
12611
|
+
case 0:
|
|
12612
|
+
if (!dt.items) return [3 /*break*/, 2];
|
|
12613
|
+
items = fromList(dt.items)
|
|
12614
|
+
.filter(function (item) { return item.kind === 'file'; });
|
|
12615
|
+
// According to https://html.spec.whatwg.org/multipage/dnd.html#dndevents,
|
|
12616
|
+
// only 'dragstart' and 'drop' has access to the data (source node)
|
|
12617
|
+
if (type !== 'drop') {
|
|
12618
|
+
return [2 /*return*/, items];
|
|
12619
|
+
}
|
|
12620
|
+
return [4 /*yield*/, Promise.all(items.map(toFilePromises))];
|
|
12621
|
+
case 1:
|
|
12622
|
+
files = _a.sent();
|
|
12623
|
+
return [2 /*return*/, noIgnoredFiles(flatten(files))];
|
|
12624
|
+
case 2: return [2 /*return*/, noIgnoredFiles(fromList(dt.files)
|
|
12625
|
+
.map(function (file) { return toFileWithPath(file); }))];
|
|
12626
|
+
}
|
|
12627
|
+
});
|
|
12628
|
+
});
|
|
12629
|
+
}
|
|
12630
|
+
function noIgnoredFiles(files) {
|
|
12631
|
+
return files.filter(function (file) { return FILES_TO_IGNORE.indexOf(file.name) === -1; });
|
|
12632
|
+
}
|
|
12633
|
+
// IE11 does not support Array.from()
|
|
12634
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Browser_compatibility
|
|
12635
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/FileList
|
|
12636
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItemList
|
|
12637
|
+
function fromList(items) {
|
|
12638
|
+
if (items === null) {
|
|
12639
|
+
return [];
|
|
12640
|
+
}
|
|
12641
|
+
var files = [];
|
|
12642
|
+
// tslint:disable: prefer-for-of
|
|
12643
|
+
for (var i = 0; i < items.length; i++) {
|
|
12644
|
+
var file = items[i];
|
|
12645
|
+
files.push(file);
|
|
12646
|
+
}
|
|
12647
|
+
return files;
|
|
12648
|
+
}
|
|
12649
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem
|
|
12650
|
+
function toFilePromises(item) {
|
|
12651
|
+
if (typeof item.webkitGetAsEntry !== 'function') {
|
|
12652
|
+
return fromDataTransferItem(item);
|
|
12653
|
+
}
|
|
12654
|
+
var entry = item.webkitGetAsEntry();
|
|
12655
|
+
// Safari supports dropping an image node from a different window and can be retrieved using
|
|
12656
|
+
// the DataTransferItem.getAsFile() API
|
|
12657
|
+
// NOTE: FileSystemEntry.file() throws if trying to get the file
|
|
12658
|
+
if (entry && entry.isDirectory) {
|
|
12659
|
+
return fromDirEntry(entry);
|
|
12660
|
+
}
|
|
12661
|
+
return fromDataTransferItem(item);
|
|
12662
|
+
}
|
|
12663
|
+
function flatten(items) {
|
|
12664
|
+
return items.reduce(function (acc, files) { return __spreadArray(__spreadArray([], __read(acc), false), __read((Array.isArray(files) ? flatten(files) : [files])), false); }, []);
|
|
12665
|
+
}
|
|
12666
|
+
function fromDataTransferItem(item) {
|
|
12667
|
+
var file = item.getAsFile();
|
|
12668
|
+
if (!file) {
|
|
12669
|
+
return Promise.reject("".concat(item, " is not a File"));
|
|
12670
|
+
}
|
|
12671
|
+
var fwp = toFileWithPath(file);
|
|
12672
|
+
return Promise.resolve(fwp);
|
|
12673
|
+
}
|
|
12674
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry
|
|
12675
|
+
function fromEntry(entry) {
|
|
12676
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12677
|
+
return __generator(this, function (_a) {
|
|
12678
|
+
return [2 /*return*/, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
|
|
12679
|
+
});
|
|
12680
|
+
});
|
|
12681
|
+
}
|
|
12682
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry
|
|
12683
|
+
function fromDirEntry(entry) {
|
|
12684
|
+
var reader = entry.createReader();
|
|
12685
|
+
return new Promise(function (resolve, reject) {
|
|
12686
|
+
var entries = [];
|
|
12687
|
+
function readEntries() {
|
|
12688
|
+
var _this = this;
|
|
12689
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry/createReader
|
|
12690
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries
|
|
12691
|
+
reader.readEntries(function (batch) { return __awaiter(_this, void 0, void 0, function () {
|
|
12692
|
+
var files, err_1, items;
|
|
12693
|
+
return __generator(this, function (_a) {
|
|
12694
|
+
switch (_a.label) {
|
|
12695
|
+
case 0:
|
|
12696
|
+
if (!!batch.length) return [3 /*break*/, 5];
|
|
12697
|
+
_a.label = 1;
|
|
12698
|
+
case 1:
|
|
12699
|
+
_a.trys.push([1, 3, , 4]);
|
|
12700
|
+
return [4 /*yield*/, Promise.all(entries)];
|
|
12701
|
+
case 2:
|
|
12702
|
+
files = _a.sent();
|
|
12703
|
+
resolve(files);
|
|
12704
|
+
return [3 /*break*/, 4];
|
|
12705
|
+
case 3:
|
|
12706
|
+
err_1 = _a.sent();
|
|
12707
|
+
reject(err_1);
|
|
12708
|
+
return [3 /*break*/, 4];
|
|
12709
|
+
case 4: return [3 /*break*/, 6];
|
|
12710
|
+
case 5:
|
|
12711
|
+
items = Promise.all(batch.map(fromEntry));
|
|
12712
|
+
entries.push(items);
|
|
12713
|
+
// Continue reading
|
|
12714
|
+
readEntries();
|
|
12715
|
+
_a.label = 6;
|
|
12716
|
+
case 6: return [2 /*return*/];
|
|
12717
|
+
}
|
|
12718
|
+
});
|
|
12719
|
+
}); }, function (err) {
|
|
12720
|
+
reject(err);
|
|
12721
|
+
});
|
|
12722
|
+
}
|
|
12723
|
+
readEntries();
|
|
12724
|
+
});
|
|
12725
|
+
}
|
|
12726
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileEntry
|
|
12727
|
+
function fromFileEntry(entry) {
|
|
12728
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12729
|
+
return __generator(this, function (_a) {
|
|
12730
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
12731
|
+
entry.file(function (file) {
|
|
12732
|
+
var fwp = toFileWithPath(file, entry.fullPath);
|
|
12733
|
+
resolve(fwp);
|
|
12734
|
+
}, function (err) {
|
|
12735
|
+
reject(err);
|
|
12736
|
+
});
|
|
12737
|
+
})];
|
|
12738
|
+
});
|
|
12739
|
+
});
|
|
12740
|
+
}
|
|
12741
|
+
|
|
12742
|
+
var _default = function (file, acceptedFiles) {
|
|
12743
|
+
if (file && acceptedFiles) {
|
|
12744
|
+
var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
|
|
12745
|
+
var fileName = file.name || '';
|
|
12746
|
+
var mimeType = (file.type || '').toLowerCase();
|
|
12747
|
+
var baseMimeType = mimeType.replace(/\/.*$/, '');
|
|
12748
|
+
return acceptedFilesArray.some(function (type) {
|
|
12749
|
+
var validType = type.trim().toLowerCase();
|
|
12750
|
+
|
|
12751
|
+
if (validType.charAt(0) === '.') {
|
|
12752
|
+
return fileName.toLowerCase().endsWith(validType);
|
|
12753
|
+
} else if (validType.endsWith('/*')) {
|
|
12754
|
+
// This is something like a image/* mime type
|
|
12755
|
+
return baseMimeType === validType.replace(/\/.*$/, '');
|
|
12756
|
+
}
|
|
12757
|
+
|
|
12758
|
+
return mimeType === validType;
|
|
12759
|
+
});
|
|
12760
|
+
}
|
|
12761
|
+
|
|
12762
|
+
return true;
|
|
12763
|
+
};
|
|
12764
|
+
|
|
12765
|
+
function _toConsumableArray$1(arr) { return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1(); }
|
|
12766
|
+
|
|
12767
|
+
function _nonIterableSpread$1() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12768
|
+
|
|
12769
|
+
function _iterableToArray$1(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12770
|
+
|
|
12771
|
+
function _arrayWithoutHoles$1(arr) { if (Array.isArray(arr)) return _arrayLikeToArray$1(arr); }
|
|
12772
|
+
|
|
12773
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12774
|
+
|
|
12775
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12776
|
+
|
|
12777
|
+
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12778
|
+
|
|
12779
|
+
function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
|
|
12780
|
+
|
|
12781
|
+
function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12782
|
+
|
|
12783
|
+
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
|
12784
|
+
|
|
12785
|
+
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12786
|
+
|
|
12787
|
+
function _iterableToArrayLimit$1(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12788
|
+
|
|
12789
|
+
function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
|
|
12790
|
+
|
|
12791
|
+
var FILE_INVALID_TYPE = "file-invalid-type";
|
|
12792
|
+
var FILE_TOO_LARGE = "file-too-large";
|
|
12793
|
+
var FILE_TOO_SMALL = "file-too-small";
|
|
12794
|
+
var TOO_MANY_FILES = "too-many-files";
|
|
12795
|
+
|
|
12796
|
+
var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr(accept) {
|
|
12797
|
+
accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
|
|
12798
|
+
var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(", ")) : accept;
|
|
12799
|
+
return {
|
|
12800
|
+
code: FILE_INVALID_TYPE,
|
|
12801
|
+
message: "File type must be ".concat(messageSuffix)
|
|
12802
|
+
};
|
|
12803
|
+
};
|
|
12804
|
+
var getTooLargeRejectionErr = function getTooLargeRejectionErr(maxSize) {
|
|
12805
|
+
return {
|
|
12806
|
+
code: FILE_TOO_LARGE,
|
|
12807
|
+
message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? "byte" : "bytes")
|
|
12808
|
+
};
|
|
12809
|
+
};
|
|
12810
|
+
var getTooSmallRejectionErr = function getTooSmallRejectionErr(minSize) {
|
|
12811
|
+
return {
|
|
12812
|
+
code: FILE_TOO_SMALL,
|
|
12813
|
+
message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? "byte" : "bytes")
|
|
12814
|
+
};
|
|
12815
|
+
};
|
|
12816
|
+
var TOO_MANY_FILES_REJECTION = {
|
|
12817
|
+
code: TOO_MANY_FILES,
|
|
12818
|
+
message: "Too many files"
|
|
12819
|
+
}; // Firefox versions prior to 53 return a bogus MIME type for every file drag, so dragovers with
|
|
12820
|
+
// that MIME type will always be accepted
|
|
12821
|
+
|
|
12822
|
+
function fileAccepted(file, accept) {
|
|
12823
|
+
var isAcceptable = file.type === "application/x-moz-file" || _default(file, accept);
|
|
12824
|
+
return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
|
|
12825
|
+
}
|
|
12826
|
+
function fileMatchSize(file, minSize, maxSize) {
|
|
12827
|
+
if (isDefined(file.size)) {
|
|
12828
|
+
if (isDefined(minSize) && isDefined(maxSize)) {
|
|
12829
|
+
if (file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
|
|
12830
|
+
if (file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];
|
|
12831
|
+
} else if (isDefined(minSize) && file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];else if (isDefined(maxSize) && file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
|
|
12832
|
+
}
|
|
12833
|
+
|
|
12834
|
+
return [true, null];
|
|
12835
|
+
}
|
|
12836
|
+
|
|
12837
|
+
function isDefined(value) {
|
|
12838
|
+
return value !== undefined && value !== null;
|
|
12839
|
+
}
|
|
12840
|
+
/**
|
|
12841
|
+
*
|
|
12842
|
+
* @param {object} options
|
|
12843
|
+
* @param {File[]} options.files
|
|
12844
|
+
* @param {string|string[]} [options.accept]
|
|
12845
|
+
* @param {number} [options.minSize]
|
|
12846
|
+
* @param {number} [options.maxSize]
|
|
12847
|
+
* @param {boolean} [options.multiple]
|
|
12848
|
+
* @param {number} [options.maxFiles]
|
|
12849
|
+
* @param {(f: File) => FileError|FileError[]|null} [options.validator]
|
|
12850
|
+
* @returns
|
|
12851
|
+
*/
|
|
12852
|
+
|
|
12853
|
+
|
|
12854
|
+
function allFilesAccepted(_ref) {
|
|
12855
|
+
var files = _ref.files,
|
|
12856
|
+
accept = _ref.accept,
|
|
12857
|
+
minSize = _ref.minSize,
|
|
12858
|
+
maxSize = _ref.maxSize,
|
|
12859
|
+
multiple = _ref.multiple,
|
|
12860
|
+
maxFiles = _ref.maxFiles,
|
|
12861
|
+
validator = _ref.validator;
|
|
12862
|
+
|
|
12863
|
+
if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
|
|
12864
|
+
return false;
|
|
12865
|
+
}
|
|
12866
|
+
|
|
12867
|
+
return files.every(function (file) {
|
|
12868
|
+
var _fileAccepted = fileAccepted(file, accept),
|
|
12869
|
+
_fileAccepted2 = _slicedToArray$1(_fileAccepted, 1),
|
|
12870
|
+
accepted = _fileAccepted2[0];
|
|
12871
|
+
|
|
12872
|
+
var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
|
|
12873
|
+
_fileMatchSize2 = _slicedToArray$1(_fileMatchSize, 1),
|
|
12874
|
+
sizeMatch = _fileMatchSize2[0];
|
|
12875
|
+
|
|
12876
|
+
var customErrors = validator ? validator(file) : null;
|
|
12877
|
+
return accepted && sizeMatch && !customErrors;
|
|
12878
|
+
});
|
|
12879
|
+
} // React's synthetic events has event.isPropagationStopped,
|
|
12880
|
+
// but to remain compatibility with other libs (Preact) fall back
|
|
12881
|
+
// to check event.cancelBubble
|
|
12882
|
+
|
|
12883
|
+
function isPropagationStopped(event) {
|
|
12884
|
+
if (typeof event.isPropagationStopped === "function") {
|
|
12885
|
+
return event.isPropagationStopped();
|
|
12886
|
+
} else if (typeof event.cancelBubble !== "undefined") {
|
|
12887
|
+
return event.cancelBubble;
|
|
12888
|
+
}
|
|
12889
|
+
|
|
12890
|
+
return false;
|
|
12891
|
+
}
|
|
12892
|
+
function isEvtWithFiles(event) {
|
|
12893
|
+
if (!event.dataTransfer) {
|
|
12894
|
+
return !!event.target && !!event.target.files;
|
|
12895
|
+
} // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/types
|
|
12896
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#file
|
|
12897
|
+
|
|
12898
|
+
|
|
12899
|
+
return Array.prototype.some.call(event.dataTransfer.types, function (type) {
|
|
12900
|
+
return type === "Files" || type === "application/x-moz-file";
|
|
12901
|
+
});
|
|
12902
|
+
}
|
|
12903
|
+
|
|
12904
|
+
function onDocumentDragOver(event) {
|
|
12905
|
+
event.preventDefault();
|
|
12906
|
+
}
|
|
12907
|
+
|
|
12908
|
+
function isIe(userAgent) {
|
|
12909
|
+
return userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident/") !== -1;
|
|
12910
|
+
}
|
|
12911
|
+
|
|
12912
|
+
function isEdge(userAgent) {
|
|
12913
|
+
return userAgent.indexOf("Edge/") !== -1;
|
|
12914
|
+
}
|
|
12915
|
+
|
|
12916
|
+
function isIeOrEdge() {
|
|
12917
|
+
var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent;
|
|
12918
|
+
return isIe(userAgent) || isEdge(userAgent);
|
|
12919
|
+
}
|
|
12920
|
+
/**
|
|
12921
|
+
* This is intended to be used to compose event handlers
|
|
12922
|
+
* They are executed in order until one of them calls `event.isPropagationStopped()`.
|
|
12923
|
+
* Note that the check is done on the first invoke too,
|
|
12924
|
+
* meaning that if propagation was stopped before invoking the fns,
|
|
12925
|
+
* no handlers will be executed.
|
|
12926
|
+
*
|
|
12927
|
+
* @param {Function} fns the event hanlder functions
|
|
12928
|
+
* @return {Function} the event handler to add to an element
|
|
12929
|
+
*/
|
|
12930
|
+
|
|
12931
|
+
function composeEventHandlers() {
|
|
12932
|
+
for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
12933
|
+
fns[_key] = arguments[_key];
|
|
12934
|
+
}
|
|
12935
|
+
|
|
12936
|
+
return function (event) {
|
|
12937
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
12938
|
+
args[_key2 - 1] = arguments[_key2];
|
|
12939
|
+
}
|
|
12940
|
+
|
|
12941
|
+
return fns.some(function (fn) {
|
|
12942
|
+
if (!isPropagationStopped(event) && fn) {
|
|
12943
|
+
fn.apply(void 0, [event].concat(args));
|
|
12944
|
+
}
|
|
12945
|
+
|
|
12946
|
+
return isPropagationStopped(event);
|
|
12947
|
+
});
|
|
12948
|
+
};
|
|
12949
|
+
}
|
|
12950
|
+
/**
|
|
12951
|
+
* canUseFileSystemAccessAPI checks if the [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API)
|
|
12952
|
+
* is supported by the browser.
|
|
12953
|
+
* @returns {boolean}
|
|
12954
|
+
*/
|
|
12955
|
+
|
|
12956
|
+
function canUseFileSystemAccessAPI() {
|
|
12957
|
+
return "showOpenFilePicker" in window;
|
|
12958
|
+
}
|
|
12959
|
+
/**
|
|
12960
|
+
* Convert the `{accept}` dropzone prop to the
|
|
12961
|
+
* `{types}` option for https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
|
|
12962
|
+
*
|
|
12963
|
+
* @param {AcceptProp} accept
|
|
12964
|
+
* @returns {{accept: string[]}[]}
|
|
12965
|
+
*/
|
|
12966
|
+
|
|
12967
|
+
function pickerOptionsFromAccept(accept) {
|
|
12968
|
+
if (isDefined(accept)) {
|
|
12969
|
+
var acceptForPicker = Object.entries(accept).filter(function (_ref2) {
|
|
12970
|
+
var _ref3 = _slicedToArray$1(_ref2, 2),
|
|
12971
|
+
mimeType = _ref3[0],
|
|
12972
|
+
ext = _ref3[1];
|
|
12973
|
+
|
|
12974
|
+
var ok = true;
|
|
12975
|
+
|
|
12976
|
+
if (!isMIMEType(mimeType)) {
|
|
12977
|
+
console.warn("Skipped \"".concat(mimeType, "\" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types."));
|
|
12978
|
+
ok = false;
|
|
12979
|
+
}
|
|
12980
|
+
|
|
12981
|
+
if (!Array.isArray(ext) || !ext.every(isExt)) {
|
|
12982
|
+
console.warn("Skipped \"".concat(mimeType, "\" because an invalid file extension was provided."));
|
|
12983
|
+
ok = false;
|
|
12984
|
+
}
|
|
12985
|
+
|
|
12986
|
+
return ok;
|
|
12987
|
+
}).reduce(function (agg, _ref4) {
|
|
12988
|
+
var _ref5 = _slicedToArray$1(_ref4, 2),
|
|
12989
|
+
mimeType = _ref5[0],
|
|
12990
|
+
ext = _ref5[1];
|
|
12991
|
+
|
|
12992
|
+
return _objectSpread$1(_objectSpread$1({}, agg), {}, _defineProperty$1({}, mimeType, ext));
|
|
12993
|
+
}, {});
|
|
12994
|
+
return [{
|
|
12995
|
+
// description is required due to https://crbug.com/1264708
|
|
12996
|
+
description: "Files",
|
|
12997
|
+
accept: acceptForPicker
|
|
12998
|
+
}];
|
|
12999
|
+
}
|
|
13000
|
+
|
|
13001
|
+
return accept;
|
|
13002
|
+
}
|
|
13003
|
+
/**
|
|
13004
|
+
* Convert the `{accept}` dropzone prop to an array of MIME types/extensions.
|
|
13005
|
+
* @param {AcceptProp} accept
|
|
13006
|
+
* @returns {string}
|
|
13007
|
+
*/
|
|
13008
|
+
|
|
13009
|
+
function acceptPropAsAcceptAttr(accept) {
|
|
13010
|
+
if (isDefined(accept)) {
|
|
13011
|
+
return Object.entries(accept).reduce(function (a, _ref6) {
|
|
13012
|
+
var _ref7 = _slicedToArray$1(_ref6, 2),
|
|
13013
|
+
mimeType = _ref7[0],
|
|
13014
|
+
ext = _ref7[1];
|
|
13015
|
+
|
|
13016
|
+
return [].concat(_toConsumableArray$1(a), [mimeType], _toConsumableArray$1(ext));
|
|
13017
|
+
}, []) // Silently discard invalid entries as pickerOptionsFromAccept warns about these
|
|
13018
|
+
.filter(function (v) {
|
|
13019
|
+
return isMIMEType(v) || isExt(v);
|
|
13020
|
+
}).join(",");
|
|
13021
|
+
}
|
|
13022
|
+
|
|
13023
|
+
return undefined;
|
|
13024
|
+
}
|
|
13025
|
+
/**
|
|
13026
|
+
* Check if v is an exception caused by aborting a request (e.g window.showOpenFilePicker()).
|
|
13027
|
+
*
|
|
13028
|
+
* See https://developer.mozilla.org/en-US/docs/Web/API/DOMException.
|
|
13029
|
+
* @param {any} v
|
|
13030
|
+
* @returns {boolean} True if v is an abort exception.
|
|
13031
|
+
*/
|
|
13032
|
+
|
|
13033
|
+
function isAbort(v) {
|
|
13034
|
+
return v instanceof DOMException && (v.name === "AbortError" || v.code === v.ABORT_ERR);
|
|
13035
|
+
}
|
|
13036
|
+
/**
|
|
13037
|
+
* Check if v is a security error.
|
|
13038
|
+
*
|
|
13039
|
+
* See https://developer.mozilla.org/en-US/docs/Web/API/DOMException.
|
|
13040
|
+
* @param {any} v
|
|
13041
|
+
* @returns {boolean} True if v is a security error.
|
|
13042
|
+
*/
|
|
13043
|
+
|
|
13044
|
+
function isSecurityError(v) {
|
|
13045
|
+
return v instanceof DOMException && (v.name === "SecurityError" || v.code === v.SECURITY_ERR);
|
|
13046
|
+
}
|
|
13047
|
+
/**
|
|
13048
|
+
* Check if v is a MIME type string.
|
|
13049
|
+
*
|
|
13050
|
+
* See accepted format: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers.
|
|
13051
|
+
*
|
|
13052
|
+
* @param {string} v
|
|
13053
|
+
*/
|
|
13054
|
+
|
|
13055
|
+
function isMIMEType(v) {
|
|
13056
|
+
return v === "audio/*" || v === "video/*" || v === "image/*" || v === "text/*" || /\w+\/[-+.\w]+/g.test(v);
|
|
13057
|
+
}
|
|
13058
|
+
/**
|
|
13059
|
+
* Check if v is a file extension.
|
|
13060
|
+
* @param {string} v
|
|
13061
|
+
*/
|
|
13062
|
+
|
|
13063
|
+
function isExt(v) {
|
|
13064
|
+
return /^.*\.[\w]+$/.test(v);
|
|
13065
|
+
}
|
|
13066
|
+
/**
|
|
13067
|
+
* @typedef {Object.<string, string[]>} AcceptProp
|
|
13068
|
+
*/
|
|
13069
|
+
|
|
13070
|
+
/**
|
|
13071
|
+
* @typedef {object} FileError
|
|
13072
|
+
* @property {string} message
|
|
13073
|
+
* @property {ErrorCode|string} code
|
|
13074
|
+
*/
|
|
13075
|
+
|
|
13076
|
+
/**
|
|
13077
|
+
* @typedef {"file-invalid-type"|"file-too-large"|"file-too-small"|"too-many-files"} ErrorCode
|
|
13078
|
+
*/
|
|
13079
|
+
|
|
13080
|
+
var _excluded = ["children"],
|
|
13081
|
+
_excluded2 = ["open"],
|
|
13082
|
+
_excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
|
|
13083
|
+
_excluded4 = ["refKey", "onChange", "onClick"];
|
|
13084
|
+
|
|
13085
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13086
|
+
|
|
13087
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13088
|
+
|
|
13089
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
13090
|
+
|
|
13091
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13092
|
+
|
|
13093
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13094
|
+
|
|
13095
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13096
|
+
|
|
13097
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13098
|
+
|
|
13099
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
13100
|
+
|
|
13101
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
13102
|
+
|
|
13103
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13104
|
+
|
|
13105
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13106
|
+
|
|
13107
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13108
|
+
|
|
13109
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13110
|
+
|
|
13111
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
13112
|
+
|
|
13113
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
13114
|
+
/**
|
|
13115
|
+
* Convenience wrapper component for the `useDropzone` hook
|
|
13116
|
+
*
|
|
13117
|
+
* ```jsx
|
|
13118
|
+
* <Dropzone>
|
|
13119
|
+
* {({getRootProps, getInputProps}) => (
|
|
13120
|
+
* <div {...getRootProps()}>
|
|
13121
|
+
* <input {...getInputProps()} />
|
|
13122
|
+
* <p>Drag 'n' drop some files here, or click to select files</p>
|
|
13123
|
+
* </div>
|
|
13124
|
+
* )}
|
|
13125
|
+
* </Dropzone>
|
|
13126
|
+
* ```
|
|
13127
|
+
*/
|
|
13128
|
+
|
|
13129
|
+
var Dropzone = /*#__PURE__*/React$3.forwardRef(function (_ref, ref) {
|
|
13130
|
+
var children = _ref.children,
|
|
13131
|
+
params = _objectWithoutProperties(_ref, _excluded);
|
|
13132
|
+
|
|
13133
|
+
var _useDropzone = useDropzone(params),
|
|
13134
|
+
open = _useDropzone.open,
|
|
13135
|
+
props = _objectWithoutProperties(_useDropzone, _excluded2);
|
|
13136
|
+
|
|
13137
|
+
React$3.useImperativeHandle(ref, function () {
|
|
13138
|
+
return {
|
|
13139
|
+
open: open
|
|
13140
|
+
};
|
|
13141
|
+
}, [open]); // TODO: Figure out why react-styleguidist cannot create docs if we don't return a jsx element
|
|
13142
|
+
|
|
13143
|
+
return /*#__PURE__*/React__default["default"].createElement(React$3.Fragment, null, children(_objectSpread(_objectSpread({}, props), {}, {
|
|
13144
|
+
open: open
|
|
13145
|
+
})));
|
|
13146
|
+
});
|
|
13147
|
+
Dropzone.displayName = "Dropzone"; // Add default props for react-docgen
|
|
13148
|
+
|
|
13149
|
+
var defaultProps = {
|
|
13150
|
+
disabled: false,
|
|
13151
|
+
getFilesFromEvent: fromEvent,
|
|
13152
|
+
maxSize: Infinity,
|
|
13153
|
+
minSize: 0,
|
|
13154
|
+
multiple: true,
|
|
13155
|
+
maxFiles: 0,
|
|
13156
|
+
preventDropOnDocument: true,
|
|
13157
|
+
noClick: false,
|
|
13158
|
+
noKeyboard: false,
|
|
13159
|
+
noDrag: false,
|
|
13160
|
+
noDragEventsBubbling: false,
|
|
13161
|
+
validator: null,
|
|
13162
|
+
useFsAccessApi: true,
|
|
13163
|
+
autoFocus: false
|
|
13164
|
+
};
|
|
13165
|
+
Dropzone.defaultProps = defaultProps;
|
|
13166
|
+
Dropzone.propTypes = {
|
|
13167
|
+
/**
|
|
13168
|
+
* Render function that exposes the dropzone state and prop getter fns
|
|
13169
|
+
*
|
|
13170
|
+
* @param {object} params
|
|
13171
|
+
* @param {Function} params.getRootProps Returns the props you should apply to the root drop container you render
|
|
13172
|
+
* @param {Function} params.getInputProps Returns the props you should apply to hidden file input you render
|
|
13173
|
+
* @param {Function} params.open Open the native file selection dialog
|
|
13174
|
+
* @param {boolean} params.isFocused Dropzone area is in focus
|
|
13175
|
+
* @param {boolean} params.isFileDialogActive File dialog is opened
|
|
13176
|
+
* @param {boolean} params.isDragActive Active drag is in progress
|
|
13177
|
+
* @param {boolean} params.isDragAccept Dragged files are accepted
|
|
13178
|
+
* @param {boolean} params.isDragReject Some dragged files are rejected
|
|
13179
|
+
* @param {File[]} params.acceptedFiles Accepted files
|
|
13180
|
+
* @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected
|
|
13181
|
+
*/
|
|
13182
|
+
children: PropTypes.func,
|
|
13183
|
+
|
|
13184
|
+
/**
|
|
13185
|
+
* Set accepted file types.
|
|
13186
|
+
* Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.
|
|
13187
|
+
* Keep in mind that mime type determination is not reliable across platforms. CSV files,
|
|
13188
|
+
* for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
|
|
13189
|
+
* Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).
|
|
13190
|
+
*/
|
|
13191
|
+
accept: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)),
|
|
13192
|
+
|
|
13193
|
+
/**
|
|
13194
|
+
* Allow drag 'n' drop (or selection from the file dialog) of multiple files
|
|
13195
|
+
*/
|
|
13196
|
+
multiple: PropTypes.bool,
|
|
13197
|
+
|
|
13198
|
+
/**
|
|
13199
|
+
* If false, allow dropped items to take over the current browser window
|
|
13200
|
+
*/
|
|
13201
|
+
preventDropOnDocument: PropTypes.bool,
|
|
13202
|
+
|
|
13203
|
+
/**
|
|
13204
|
+
* If true, disables click to open the native file selection dialog
|
|
13205
|
+
*/
|
|
13206
|
+
noClick: PropTypes.bool,
|
|
13207
|
+
|
|
13208
|
+
/**
|
|
13209
|
+
* If true, disables SPACE/ENTER to open the native file selection dialog.
|
|
13210
|
+
* Note that it also stops tracking the focus state.
|
|
13211
|
+
*/
|
|
13212
|
+
noKeyboard: PropTypes.bool,
|
|
13213
|
+
|
|
13214
|
+
/**
|
|
13215
|
+
* If true, disables drag 'n' drop
|
|
13216
|
+
*/
|
|
13217
|
+
noDrag: PropTypes.bool,
|
|
13218
|
+
|
|
13219
|
+
/**
|
|
13220
|
+
* If true, stops drag event propagation to parents
|
|
13221
|
+
*/
|
|
13222
|
+
noDragEventsBubbling: PropTypes.bool,
|
|
13223
|
+
|
|
13224
|
+
/**
|
|
13225
|
+
* Minimum file size (in bytes)
|
|
13226
|
+
*/
|
|
13227
|
+
minSize: PropTypes.number,
|
|
13228
|
+
|
|
13229
|
+
/**
|
|
13230
|
+
* Maximum file size (in bytes)
|
|
13231
|
+
*/
|
|
13232
|
+
maxSize: PropTypes.number,
|
|
13233
|
+
|
|
13234
|
+
/**
|
|
13235
|
+
* Maximum accepted number of files
|
|
13236
|
+
* The default value is 0 which means there is no limitation to how many files are accepted.
|
|
13237
|
+
*/
|
|
13238
|
+
maxFiles: PropTypes.number,
|
|
13239
|
+
|
|
13240
|
+
/**
|
|
13241
|
+
* Enable/disable the dropzone
|
|
13242
|
+
*/
|
|
13243
|
+
disabled: PropTypes.bool,
|
|
13244
|
+
|
|
13245
|
+
/**
|
|
13246
|
+
* Use this to provide a custom file aggregator
|
|
13247
|
+
*
|
|
13248
|
+
* @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
|
|
13249
|
+
*/
|
|
13250
|
+
getFilesFromEvent: PropTypes.func,
|
|
13251
|
+
|
|
13252
|
+
/**
|
|
13253
|
+
* Cb for when closing the file dialog with no selection
|
|
13254
|
+
*/
|
|
13255
|
+
onFileDialogCancel: PropTypes.func,
|
|
13256
|
+
|
|
13257
|
+
/**
|
|
13258
|
+
* Cb for when opening the file dialog
|
|
13259
|
+
*/
|
|
13260
|
+
onFileDialogOpen: PropTypes.func,
|
|
13261
|
+
|
|
13262
|
+
/**
|
|
13263
|
+
* Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
|
|
13264
|
+
* to open the file picker instead of using an `<input type="file">` click event.
|
|
13265
|
+
*/
|
|
13266
|
+
useFsAccessApi: PropTypes.bool,
|
|
13267
|
+
|
|
13268
|
+
/**
|
|
13269
|
+
* Set to true to focus the root element on render
|
|
13270
|
+
*/
|
|
13271
|
+
autoFocus: PropTypes.bool,
|
|
13272
|
+
|
|
13273
|
+
/**
|
|
13274
|
+
* Cb for when the `dragenter` event occurs.
|
|
13275
|
+
*
|
|
13276
|
+
* @param {DragEvent} event
|
|
13277
|
+
*/
|
|
13278
|
+
onDragEnter: PropTypes.func,
|
|
13279
|
+
|
|
13280
|
+
/**
|
|
13281
|
+
* Cb for when the `dragleave` event occurs
|
|
13282
|
+
*
|
|
13283
|
+
* @param {DragEvent} event
|
|
13284
|
+
*/
|
|
13285
|
+
onDragLeave: PropTypes.func,
|
|
13286
|
+
|
|
13287
|
+
/**
|
|
13288
|
+
* Cb for when the `dragover` event occurs
|
|
13289
|
+
*
|
|
13290
|
+
* @param {DragEvent} event
|
|
13291
|
+
*/
|
|
13292
|
+
onDragOver: PropTypes.func,
|
|
13293
|
+
|
|
13294
|
+
/**
|
|
13295
|
+
* Cb for when the `drop` event occurs.
|
|
13296
|
+
* Note that this callback is invoked after the `getFilesFromEvent` callback is done.
|
|
13297
|
+
*
|
|
13298
|
+
* Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
|
|
13299
|
+
* `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension.
|
|
13300
|
+
* If `multiple` is set to false and additional files are dropped,
|
|
13301
|
+
* all files besides the first will be rejected.
|
|
13302
|
+
* Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
|
|
13303
|
+
*
|
|
13304
|
+
* Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
|
|
13305
|
+
* If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
|
|
13306
|
+
*
|
|
13307
|
+
* `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
|
|
13308
|
+
* For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
|
|
13309
|
+
*
|
|
13310
|
+
* ```js
|
|
13311
|
+
* function onDrop(acceptedFiles) {
|
|
13312
|
+
* const req = request.post('/upload')
|
|
13313
|
+
* acceptedFiles.forEach(file => {
|
|
13314
|
+
* req.attach(file.name, file)
|
|
13315
|
+
* })
|
|
13316
|
+
* req.end(callback)
|
|
13317
|
+
* }
|
|
13318
|
+
* ```
|
|
13319
|
+
*
|
|
13320
|
+
* @param {File[]} acceptedFiles
|
|
13321
|
+
* @param {FileRejection[]} fileRejections
|
|
13322
|
+
* @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
|
|
13323
|
+
*/
|
|
13324
|
+
onDrop: PropTypes.func,
|
|
13325
|
+
|
|
13326
|
+
/**
|
|
13327
|
+
* Cb for when the `drop` event occurs.
|
|
13328
|
+
* Note that if no files are accepted, this callback is not invoked.
|
|
13329
|
+
*
|
|
13330
|
+
* @param {File[]} files
|
|
13331
|
+
* @param {(DragEvent|Event)} event
|
|
13332
|
+
*/
|
|
13333
|
+
onDropAccepted: PropTypes.func,
|
|
13334
|
+
|
|
13335
|
+
/**
|
|
13336
|
+
* Cb for when the `drop` event occurs.
|
|
13337
|
+
* Note that if no files are rejected, this callback is not invoked.
|
|
13338
|
+
*
|
|
13339
|
+
* @param {FileRejection[]} fileRejections
|
|
13340
|
+
* @param {(DragEvent|Event)} event
|
|
13341
|
+
*/
|
|
13342
|
+
onDropRejected: PropTypes.func,
|
|
13343
|
+
|
|
13344
|
+
/**
|
|
13345
|
+
* Cb for when there's some error from any of the promises.
|
|
13346
|
+
*
|
|
13347
|
+
* @param {Error} error
|
|
13348
|
+
*/
|
|
13349
|
+
onError: PropTypes.func,
|
|
13350
|
+
|
|
13351
|
+
/**
|
|
13352
|
+
* Custom validation function. It must return null if there's no errors.
|
|
13353
|
+
* @param {File} file
|
|
13354
|
+
* @returns {FileError|FileError[]|null}
|
|
13355
|
+
*/
|
|
13356
|
+
validator: PropTypes.func
|
|
13357
|
+
};
|
|
13358
|
+
/**
|
|
13359
|
+
* A function that is invoked for the `dragenter`,
|
|
13360
|
+
* `dragover` and `dragleave` events.
|
|
13361
|
+
* It is not invoked if the items are not files (such as link, text, etc.).
|
|
13362
|
+
*
|
|
13363
|
+
* @callback dragCb
|
|
13364
|
+
* @param {DragEvent} event
|
|
13365
|
+
*/
|
|
13366
|
+
|
|
13367
|
+
/**
|
|
13368
|
+
* A function that is invoked for the `drop` or input change event.
|
|
13369
|
+
* It is not invoked if the items are not files (such as link, text, etc.).
|
|
13370
|
+
*
|
|
13371
|
+
* @callback dropCb
|
|
13372
|
+
* @param {File[]} acceptedFiles List of accepted files
|
|
13373
|
+
* @param {FileRejection[]} fileRejections List of rejected files and why they were rejected
|
|
13374
|
+
* @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
|
|
13375
|
+
*/
|
|
13376
|
+
|
|
13377
|
+
/**
|
|
13378
|
+
* A function that is invoked for the `drop` or input change event.
|
|
13379
|
+
* It is not invoked if the items are files (such as link, text, etc.).
|
|
13380
|
+
*
|
|
13381
|
+
* @callback dropAcceptedCb
|
|
13382
|
+
* @param {File[]} files List of accepted files that meet the given criteria
|
|
13383
|
+
* (`accept`, `multiple`, `minSize`, `maxSize`)
|
|
13384
|
+
* @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
|
|
13385
|
+
*/
|
|
13386
|
+
|
|
13387
|
+
/**
|
|
13388
|
+
* A function that is invoked for the `drop` or input change event.
|
|
13389
|
+
*
|
|
13390
|
+
* @callback dropRejectedCb
|
|
13391
|
+
* @param {File[]} files List of rejected files that do not meet the given criteria
|
|
13392
|
+
* (`accept`, `multiple`, `minSize`, `maxSize`)
|
|
13393
|
+
* @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
|
|
13394
|
+
*/
|
|
13395
|
+
|
|
13396
|
+
/**
|
|
13397
|
+
* A function that is used aggregate files,
|
|
13398
|
+
* in a asynchronous fashion, from drag or input change events.
|
|
13399
|
+
*
|
|
13400
|
+
* @callback getFilesFromEvent
|
|
13401
|
+
* @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
|
|
13402
|
+
* @returns {(File[]|Promise<File[]>)}
|
|
13403
|
+
*/
|
|
13404
|
+
|
|
13405
|
+
/**
|
|
13406
|
+
* An object with the current dropzone state.
|
|
13407
|
+
*
|
|
13408
|
+
* @typedef {object} DropzoneState
|
|
13409
|
+
* @property {boolean} isFocused Dropzone area is in focus
|
|
13410
|
+
* @property {boolean} isFileDialogActive File dialog is opened
|
|
13411
|
+
* @property {boolean} isDragActive Active drag is in progress
|
|
13412
|
+
* @property {boolean} isDragAccept Dragged files are accepted
|
|
13413
|
+
* @property {boolean} isDragReject Some dragged files are rejected
|
|
13414
|
+
* @property {File[]} acceptedFiles Accepted files
|
|
13415
|
+
* @property {FileRejection[]} fileRejections Rejected files and why they were rejected
|
|
13416
|
+
*/
|
|
13417
|
+
|
|
13418
|
+
/**
|
|
13419
|
+
* An object with the dropzone methods.
|
|
13420
|
+
*
|
|
13421
|
+
* @typedef {object} DropzoneMethods
|
|
13422
|
+
* @property {Function} getRootProps Returns the props you should apply to the root drop container you render
|
|
13423
|
+
* @property {Function} getInputProps Returns the props you should apply to hidden file input you render
|
|
13424
|
+
* @property {Function} open Open the native file selection dialog
|
|
13425
|
+
*/
|
|
13426
|
+
|
|
13427
|
+
var initialState = {
|
|
13428
|
+
isFocused: false,
|
|
13429
|
+
isFileDialogActive: false,
|
|
13430
|
+
isDragActive: false,
|
|
13431
|
+
isDragAccept: false,
|
|
13432
|
+
isDragReject: false,
|
|
13433
|
+
acceptedFiles: [],
|
|
13434
|
+
fileRejections: []
|
|
13435
|
+
};
|
|
13436
|
+
/**
|
|
13437
|
+
* A React hook that creates a drag 'n' drop area.
|
|
13438
|
+
*
|
|
13439
|
+
* ```jsx
|
|
13440
|
+
* function MyDropzone(props) {
|
|
13441
|
+
* const {getRootProps, getInputProps} = useDropzone({
|
|
13442
|
+
* onDrop: acceptedFiles => {
|
|
13443
|
+
* // do something with the File objects, e.g. upload to some server
|
|
13444
|
+
* }
|
|
13445
|
+
* });
|
|
13446
|
+
* return (
|
|
13447
|
+
* <div {...getRootProps()}>
|
|
13448
|
+
* <input {...getInputProps()} />
|
|
13449
|
+
* <p>Drag and drop some files here, or click to select files</p>
|
|
13450
|
+
* </div>
|
|
13451
|
+
* )
|
|
13452
|
+
* }
|
|
13453
|
+
* ```
|
|
13454
|
+
*
|
|
13455
|
+
* @function useDropzone
|
|
13456
|
+
*
|
|
13457
|
+
* @param {object} props
|
|
13458
|
+
* @param {import("./utils").AcceptProp} [props.accept] Set accepted file types.
|
|
13459
|
+
* Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.
|
|
13460
|
+
* Keep in mind that mime type determination is not reliable across platforms. CSV files,
|
|
13461
|
+
* for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
|
|
13462
|
+
* Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).
|
|
13463
|
+
* @param {boolean} [props.multiple=true] Allow drag 'n' drop (or selection from the file dialog) of multiple files
|
|
13464
|
+
* @param {boolean} [props.preventDropOnDocument=true] If false, allow dropped items to take over the current browser window
|
|
13465
|
+
* @param {boolean} [props.noClick=false] If true, disables click to open the native file selection dialog
|
|
13466
|
+
* @param {boolean} [props.noKeyboard=false] If true, disables SPACE/ENTER to open the native file selection dialog.
|
|
13467
|
+
* Note that it also stops tracking the focus state.
|
|
13468
|
+
* @param {boolean} [props.noDrag=false] If true, disables drag 'n' drop
|
|
13469
|
+
* @param {boolean} [props.noDragEventsBubbling=false] If true, stops drag event propagation to parents
|
|
13470
|
+
* @param {number} [props.minSize=0] Minimum file size (in bytes)
|
|
13471
|
+
* @param {number} [props.maxSize=Infinity] Maximum file size (in bytes)
|
|
13472
|
+
* @param {boolean} [props.disabled=false] Enable/disable the dropzone
|
|
13473
|
+
* @param {getFilesFromEvent} [props.getFilesFromEvent] Use this to provide a custom file aggregator
|
|
13474
|
+
* @param {Function} [props.onFileDialogCancel] Cb for when closing the file dialog with no selection
|
|
13475
|
+
* @param {boolean} [props.useFsAccessApi] Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
|
|
13476
|
+
* to open the file picker instead of using an `<input type="file">` click event.
|
|
13477
|
+
* @param {boolean} autoFocus Set to true to auto focus the root element.
|
|
13478
|
+
* @param {Function} [props.onFileDialogOpen] Cb for when opening the file dialog
|
|
13479
|
+
* @param {dragCb} [props.onDragEnter] Cb for when the `dragenter` event occurs.
|
|
13480
|
+
* @param {dragCb} [props.onDragLeave] Cb for when the `dragleave` event occurs
|
|
13481
|
+
* @param {dragCb} [props.onDragOver] Cb for when the `dragover` event occurs
|
|
13482
|
+
* @param {dropCb} [props.onDrop] Cb for when the `drop` event occurs.
|
|
13483
|
+
* Note that this callback is invoked after the `getFilesFromEvent` callback is done.
|
|
13484
|
+
*
|
|
13485
|
+
* Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
|
|
13486
|
+
* `accept` must be an object with keys as a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) and the value an array of file extensions (optional).
|
|
13487
|
+
* If `multiple` is set to false and additional files are dropped,
|
|
13488
|
+
* all files besides the first will be rejected.
|
|
13489
|
+
* Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
|
|
13490
|
+
*
|
|
13491
|
+
* Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
|
|
13492
|
+
* If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
|
|
13493
|
+
*
|
|
13494
|
+
* `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
|
|
13495
|
+
* For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
|
|
13496
|
+
*
|
|
13497
|
+
* ```js
|
|
13498
|
+
* function onDrop(acceptedFiles) {
|
|
13499
|
+
* const req = request.post('/upload')
|
|
13500
|
+
* acceptedFiles.forEach(file => {
|
|
13501
|
+
* req.attach(file.name, file)
|
|
13502
|
+
* })
|
|
13503
|
+
* req.end(callback)
|
|
13504
|
+
* }
|
|
13505
|
+
* ```
|
|
13506
|
+
* @param {dropAcceptedCb} [props.onDropAccepted]
|
|
13507
|
+
* @param {dropRejectedCb} [props.onDropRejected]
|
|
13508
|
+
* @param {(error: Error) => void} [props.onError]
|
|
13509
|
+
*
|
|
13510
|
+
* @returns {DropzoneState & DropzoneMethods}
|
|
13511
|
+
*/
|
|
13512
|
+
|
|
13513
|
+
function useDropzone() {
|
|
13514
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13515
|
+
|
|
13516
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
13517
|
+
accept = _defaultProps$props.accept,
|
|
13518
|
+
disabled = _defaultProps$props.disabled,
|
|
13519
|
+
getFilesFromEvent = _defaultProps$props.getFilesFromEvent,
|
|
13520
|
+
maxSize = _defaultProps$props.maxSize,
|
|
13521
|
+
minSize = _defaultProps$props.minSize,
|
|
13522
|
+
multiple = _defaultProps$props.multiple,
|
|
13523
|
+
maxFiles = _defaultProps$props.maxFiles,
|
|
13524
|
+
onDragEnter = _defaultProps$props.onDragEnter,
|
|
13525
|
+
onDragLeave = _defaultProps$props.onDragLeave,
|
|
13526
|
+
onDragOver = _defaultProps$props.onDragOver,
|
|
13527
|
+
onDrop = _defaultProps$props.onDrop,
|
|
13528
|
+
onDropAccepted = _defaultProps$props.onDropAccepted,
|
|
13529
|
+
onDropRejected = _defaultProps$props.onDropRejected,
|
|
13530
|
+
onFileDialogCancel = _defaultProps$props.onFileDialogCancel,
|
|
13531
|
+
onFileDialogOpen = _defaultProps$props.onFileDialogOpen,
|
|
13532
|
+
useFsAccessApi = _defaultProps$props.useFsAccessApi,
|
|
13533
|
+
autoFocus = _defaultProps$props.autoFocus,
|
|
13534
|
+
preventDropOnDocument = _defaultProps$props.preventDropOnDocument,
|
|
13535
|
+
noClick = _defaultProps$props.noClick,
|
|
13536
|
+
noKeyboard = _defaultProps$props.noKeyboard,
|
|
13537
|
+
noDrag = _defaultProps$props.noDrag,
|
|
13538
|
+
noDragEventsBubbling = _defaultProps$props.noDragEventsBubbling,
|
|
13539
|
+
onError = _defaultProps$props.onError,
|
|
13540
|
+
validator = _defaultProps$props.validator;
|
|
13541
|
+
|
|
13542
|
+
var acceptAttr = React$3.useMemo(function () {
|
|
13543
|
+
return acceptPropAsAcceptAttr(accept);
|
|
13544
|
+
}, [accept]);
|
|
13545
|
+
var pickerTypes = React$3.useMemo(function () {
|
|
13546
|
+
return pickerOptionsFromAccept(accept);
|
|
13547
|
+
}, [accept]);
|
|
13548
|
+
var onFileDialogOpenCb = React$3.useMemo(function () {
|
|
13549
|
+
return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop;
|
|
13550
|
+
}, [onFileDialogOpen]);
|
|
13551
|
+
var onFileDialogCancelCb = React$3.useMemo(function () {
|
|
13552
|
+
return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop;
|
|
13553
|
+
}, [onFileDialogCancel]);
|
|
13554
|
+
/**
|
|
13555
|
+
* @constant
|
|
13556
|
+
* @type {React.MutableRefObject<HTMLElement>}
|
|
13557
|
+
*/
|
|
13558
|
+
|
|
13559
|
+
var rootRef = React$3.useRef(null);
|
|
13560
|
+
var inputRef = React$3.useRef(null);
|
|
13561
|
+
|
|
13562
|
+
var _useReducer = React$3.useReducer(reducer, initialState),
|
|
13563
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
13564
|
+
state = _useReducer2[0],
|
|
13565
|
+
dispatch = _useReducer2[1];
|
|
13566
|
+
|
|
13567
|
+
var isFocused = state.isFocused,
|
|
13568
|
+
isFileDialogActive = state.isFileDialogActive;
|
|
13569
|
+
var fsAccessApiWorksRef = React$3.useRef(typeof window !== "undefined" && window.isSecureContext && useFsAccessApi && canUseFileSystemAccessAPI()); // Update file dialog active state when the window is focused on
|
|
13570
|
+
|
|
13571
|
+
var onWindowFocus = function onWindowFocus() {
|
|
13572
|
+
// Execute the timeout only if the file dialog is opened in the browser
|
|
13573
|
+
if (!fsAccessApiWorksRef.current && isFileDialogActive) {
|
|
13574
|
+
setTimeout(function () {
|
|
13575
|
+
if (inputRef.current) {
|
|
13576
|
+
var files = inputRef.current.files;
|
|
13577
|
+
|
|
13578
|
+
if (!files.length) {
|
|
13579
|
+
dispatch({
|
|
13580
|
+
type: "closeDialog"
|
|
13581
|
+
});
|
|
13582
|
+
onFileDialogCancelCb();
|
|
13583
|
+
}
|
|
13584
|
+
}
|
|
13585
|
+
}, 300);
|
|
13586
|
+
}
|
|
13587
|
+
};
|
|
13588
|
+
|
|
13589
|
+
React$3.useEffect(function () {
|
|
13590
|
+
window.addEventListener("focus", onWindowFocus, false);
|
|
13591
|
+
return function () {
|
|
13592
|
+
window.removeEventListener("focus", onWindowFocus, false);
|
|
13593
|
+
};
|
|
13594
|
+
}, [inputRef, isFileDialogActive, onFileDialogCancelCb, fsAccessApiWorksRef]);
|
|
13595
|
+
var dragTargetsRef = React$3.useRef([]);
|
|
13596
|
+
|
|
13597
|
+
var onDocumentDrop = function onDocumentDrop(event) {
|
|
13598
|
+
if (rootRef.current && rootRef.current.contains(event.target)) {
|
|
13599
|
+
// If we intercepted an event for our instance, let it propagate down to the instance's onDrop handler
|
|
13600
|
+
return;
|
|
13601
|
+
}
|
|
13602
|
+
|
|
13603
|
+
event.preventDefault();
|
|
13604
|
+
dragTargetsRef.current = [];
|
|
13605
|
+
};
|
|
13606
|
+
|
|
13607
|
+
React$3.useEffect(function () {
|
|
13608
|
+
if (preventDropOnDocument) {
|
|
13609
|
+
document.addEventListener("dragover", onDocumentDragOver, false);
|
|
13610
|
+
document.addEventListener("drop", onDocumentDrop, false);
|
|
13611
|
+
}
|
|
13612
|
+
|
|
13613
|
+
return function () {
|
|
13614
|
+
if (preventDropOnDocument) {
|
|
13615
|
+
document.removeEventListener("dragover", onDocumentDragOver);
|
|
13616
|
+
document.removeEventListener("drop", onDocumentDrop);
|
|
13617
|
+
}
|
|
13618
|
+
};
|
|
13619
|
+
}, [rootRef, preventDropOnDocument]); // Auto focus the root when autoFocus is true
|
|
13620
|
+
|
|
13621
|
+
React$3.useEffect(function () {
|
|
13622
|
+
if (!disabled && autoFocus && rootRef.current) {
|
|
13623
|
+
rootRef.current.focus();
|
|
13624
|
+
}
|
|
13625
|
+
|
|
13626
|
+
return function () {};
|
|
13627
|
+
}, [rootRef, autoFocus, disabled]);
|
|
13628
|
+
var onErrCb = React$3.useCallback(function (e) {
|
|
13629
|
+
if (onError) {
|
|
13630
|
+
onError(e);
|
|
13631
|
+
} else {
|
|
13632
|
+
// Let the user know something's gone wrong if they haven't provided the onError cb.
|
|
13633
|
+
console.error(e);
|
|
13634
|
+
}
|
|
13635
|
+
}, [onError]);
|
|
13636
|
+
var onDragEnterCb = React$3.useCallback(function (event) {
|
|
13637
|
+
event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
|
|
13638
|
+
|
|
13639
|
+
event.persist();
|
|
13640
|
+
stopPropagation(event);
|
|
13641
|
+
dragTargetsRef.current = [].concat(_toConsumableArray(dragTargetsRef.current), [event.target]);
|
|
13642
|
+
|
|
13643
|
+
if (isEvtWithFiles(event)) {
|
|
13644
|
+
Promise.resolve(getFilesFromEvent(event)).then(function (files) {
|
|
13645
|
+
if (isPropagationStopped(event) && !noDragEventsBubbling) {
|
|
13646
|
+
return;
|
|
13647
|
+
}
|
|
13648
|
+
|
|
13649
|
+
var fileCount = files.length;
|
|
13650
|
+
var isDragAccept = fileCount > 0 && allFilesAccepted({
|
|
13651
|
+
files: files,
|
|
13652
|
+
accept: acceptAttr,
|
|
13653
|
+
minSize: minSize,
|
|
13654
|
+
maxSize: maxSize,
|
|
13655
|
+
multiple: multiple,
|
|
13656
|
+
maxFiles: maxFiles,
|
|
13657
|
+
validator: validator
|
|
13658
|
+
});
|
|
13659
|
+
var isDragReject = fileCount > 0 && !isDragAccept;
|
|
13660
|
+
dispatch({
|
|
13661
|
+
isDragAccept: isDragAccept,
|
|
13662
|
+
isDragReject: isDragReject,
|
|
13663
|
+
isDragActive: true,
|
|
13664
|
+
type: "setDraggedFiles"
|
|
13665
|
+
});
|
|
13666
|
+
|
|
13667
|
+
if (onDragEnter) {
|
|
13668
|
+
onDragEnter(event);
|
|
13669
|
+
}
|
|
13670
|
+
}).catch(function (e) {
|
|
13671
|
+
return onErrCb(e);
|
|
13672
|
+
});
|
|
13673
|
+
}
|
|
13674
|
+
}, [getFilesFromEvent, onDragEnter, onErrCb, noDragEventsBubbling, acceptAttr, minSize, maxSize, multiple, maxFiles, validator]);
|
|
13675
|
+
var onDragOverCb = React$3.useCallback(function (event) {
|
|
13676
|
+
event.preventDefault();
|
|
13677
|
+
event.persist();
|
|
13678
|
+
stopPropagation(event);
|
|
13679
|
+
var hasFiles = isEvtWithFiles(event);
|
|
13680
|
+
|
|
13681
|
+
if (hasFiles && event.dataTransfer) {
|
|
13682
|
+
try {
|
|
13683
|
+
event.dataTransfer.dropEffect = "copy";
|
|
13684
|
+
} catch (_unused) {}
|
|
13685
|
+
/* eslint-disable-line no-empty */
|
|
13686
|
+
|
|
13687
|
+
}
|
|
13688
|
+
|
|
13689
|
+
if (hasFiles && onDragOver) {
|
|
13690
|
+
onDragOver(event);
|
|
13691
|
+
}
|
|
13692
|
+
|
|
13693
|
+
return false;
|
|
13694
|
+
}, [onDragOver, noDragEventsBubbling]);
|
|
13695
|
+
var onDragLeaveCb = React$3.useCallback(function (event) {
|
|
13696
|
+
event.preventDefault();
|
|
13697
|
+
event.persist();
|
|
13698
|
+
stopPropagation(event); // Only deactivate once the dropzone and all children have been left
|
|
13699
|
+
|
|
13700
|
+
var targets = dragTargetsRef.current.filter(function (target) {
|
|
13701
|
+
return rootRef.current && rootRef.current.contains(target);
|
|
13702
|
+
}); // Make sure to remove a target present multiple times only once
|
|
13703
|
+
// (Firefox may fire dragenter/dragleave multiple times on the same element)
|
|
13704
|
+
|
|
13705
|
+
var targetIdx = targets.indexOf(event.target);
|
|
13706
|
+
|
|
13707
|
+
if (targetIdx !== -1) {
|
|
13708
|
+
targets.splice(targetIdx, 1);
|
|
13709
|
+
}
|
|
13710
|
+
|
|
13711
|
+
dragTargetsRef.current = targets;
|
|
13712
|
+
|
|
13713
|
+
if (targets.length > 0) {
|
|
13714
|
+
return;
|
|
13715
|
+
}
|
|
13716
|
+
|
|
13717
|
+
dispatch({
|
|
13718
|
+
type: "setDraggedFiles",
|
|
13719
|
+
isDragActive: false,
|
|
13720
|
+
isDragAccept: false,
|
|
13721
|
+
isDragReject: false
|
|
13722
|
+
});
|
|
13723
|
+
|
|
13724
|
+
if (isEvtWithFiles(event) && onDragLeave) {
|
|
13725
|
+
onDragLeave(event);
|
|
13726
|
+
}
|
|
13727
|
+
}, [rootRef, onDragLeave, noDragEventsBubbling]);
|
|
13728
|
+
var setFiles = React$3.useCallback(function (files, event) {
|
|
13729
|
+
var acceptedFiles = [];
|
|
13730
|
+
var fileRejections = [];
|
|
13731
|
+
files.forEach(function (file) {
|
|
13732
|
+
var _fileAccepted = fileAccepted(file, acceptAttr),
|
|
13733
|
+
_fileAccepted2 = _slicedToArray(_fileAccepted, 2),
|
|
13734
|
+
accepted = _fileAccepted2[0],
|
|
13735
|
+
acceptError = _fileAccepted2[1];
|
|
13736
|
+
|
|
13737
|
+
var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
|
|
13738
|
+
_fileMatchSize2 = _slicedToArray(_fileMatchSize, 2),
|
|
13739
|
+
sizeMatch = _fileMatchSize2[0],
|
|
13740
|
+
sizeError = _fileMatchSize2[1];
|
|
13741
|
+
|
|
13742
|
+
var customErrors = validator ? validator(file) : null;
|
|
13743
|
+
|
|
13744
|
+
if (accepted && sizeMatch && !customErrors) {
|
|
13745
|
+
acceptedFiles.push(file);
|
|
13746
|
+
} else {
|
|
13747
|
+
var errors = [acceptError, sizeError];
|
|
13748
|
+
|
|
13749
|
+
if (customErrors) {
|
|
13750
|
+
errors = errors.concat(customErrors);
|
|
13751
|
+
}
|
|
13752
|
+
|
|
13753
|
+
fileRejections.push({
|
|
13754
|
+
file: file,
|
|
13755
|
+
errors: errors.filter(function (e) {
|
|
13756
|
+
return e;
|
|
13757
|
+
})
|
|
13758
|
+
});
|
|
13759
|
+
}
|
|
13760
|
+
});
|
|
13761
|
+
|
|
13762
|
+
if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
|
|
13763
|
+
// Reject everything and empty accepted files
|
|
13764
|
+
acceptedFiles.forEach(function (file) {
|
|
13765
|
+
fileRejections.push({
|
|
13766
|
+
file: file,
|
|
13767
|
+
errors: [TOO_MANY_FILES_REJECTION]
|
|
13768
|
+
});
|
|
13769
|
+
});
|
|
13770
|
+
acceptedFiles.splice(0);
|
|
13771
|
+
}
|
|
13772
|
+
|
|
13773
|
+
dispatch({
|
|
13774
|
+
acceptedFiles: acceptedFiles,
|
|
13775
|
+
fileRejections: fileRejections,
|
|
13776
|
+
type: "setFiles"
|
|
13777
|
+
});
|
|
13778
|
+
|
|
13779
|
+
if (onDrop) {
|
|
13780
|
+
onDrop(acceptedFiles, fileRejections, event);
|
|
13781
|
+
}
|
|
13782
|
+
|
|
13783
|
+
if (fileRejections.length > 0 && onDropRejected) {
|
|
13784
|
+
onDropRejected(fileRejections, event);
|
|
13785
|
+
}
|
|
13786
|
+
|
|
13787
|
+
if (acceptedFiles.length > 0 && onDropAccepted) {
|
|
13788
|
+
onDropAccepted(acceptedFiles, event);
|
|
13789
|
+
}
|
|
13790
|
+
}, [dispatch, multiple, acceptAttr, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
|
|
13791
|
+
var onDropCb = React$3.useCallback(function (event) {
|
|
13792
|
+
event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
|
|
13793
|
+
|
|
13794
|
+
event.persist();
|
|
13795
|
+
stopPropagation(event);
|
|
13796
|
+
dragTargetsRef.current = [];
|
|
13797
|
+
|
|
13798
|
+
if (isEvtWithFiles(event)) {
|
|
13799
|
+
Promise.resolve(getFilesFromEvent(event)).then(function (files) {
|
|
13800
|
+
if (isPropagationStopped(event) && !noDragEventsBubbling) {
|
|
13801
|
+
return;
|
|
13802
|
+
}
|
|
13803
|
+
|
|
13804
|
+
setFiles(files, event);
|
|
13805
|
+
}).catch(function (e) {
|
|
13806
|
+
return onErrCb(e);
|
|
13807
|
+
});
|
|
13808
|
+
}
|
|
13809
|
+
|
|
13810
|
+
dispatch({
|
|
13811
|
+
type: "reset"
|
|
13812
|
+
});
|
|
13813
|
+
}, [getFilesFromEvent, setFiles, onErrCb, noDragEventsBubbling]); // Fn for opening the file dialog programmatically
|
|
13814
|
+
|
|
13815
|
+
var openFileDialog = React$3.useCallback(function () {
|
|
13816
|
+
// No point to use FS access APIs if context is not secure
|
|
13817
|
+
// https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts#feature_detection
|
|
13818
|
+
if (fsAccessApiWorksRef.current) {
|
|
13819
|
+
dispatch({
|
|
13820
|
+
type: "openDialog"
|
|
13821
|
+
});
|
|
13822
|
+
onFileDialogOpenCb(); // https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
|
|
13823
|
+
|
|
13824
|
+
var opts = {
|
|
13825
|
+
multiple: multiple,
|
|
13826
|
+
types: pickerTypes
|
|
13827
|
+
};
|
|
13828
|
+
window.showOpenFilePicker(opts).then(function (handles) {
|
|
13829
|
+
return getFilesFromEvent(handles);
|
|
13830
|
+
}).then(function (files) {
|
|
13831
|
+
setFiles(files, null);
|
|
13832
|
+
dispatch({
|
|
13833
|
+
type: "closeDialog"
|
|
13834
|
+
});
|
|
13835
|
+
}).catch(function (e) {
|
|
13836
|
+
// AbortError means the user canceled
|
|
13837
|
+
if (isAbort(e)) {
|
|
13838
|
+
onFileDialogCancelCb(e);
|
|
13839
|
+
dispatch({
|
|
13840
|
+
type: "closeDialog"
|
|
13841
|
+
});
|
|
13842
|
+
} else if (isSecurityError(e)) {
|
|
13843
|
+
fsAccessApiWorksRef.current = false; // CORS, so cannot use this API
|
|
13844
|
+
// Try using the input
|
|
13845
|
+
|
|
13846
|
+
if (inputRef.current) {
|
|
13847
|
+
inputRef.current.value = null;
|
|
13848
|
+
inputRef.current.click();
|
|
13849
|
+
} else {
|
|
13850
|
+
onErrCb(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."));
|
|
13851
|
+
}
|
|
13852
|
+
} else {
|
|
13853
|
+
onErrCb(e);
|
|
13854
|
+
}
|
|
13855
|
+
});
|
|
13856
|
+
return;
|
|
13857
|
+
}
|
|
13858
|
+
|
|
13859
|
+
if (inputRef.current) {
|
|
13860
|
+
dispatch({
|
|
13861
|
+
type: "openDialog"
|
|
13862
|
+
});
|
|
13863
|
+
onFileDialogOpenCb();
|
|
13864
|
+
inputRef.current.value = null;
|
|
13865
|
+
inputRef.current.click();
|
|
13866
|
+
}
|
|
13867
|
+
}, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, onErrCb, pickerTypes, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone
|
|
13868
|
+
|
|
13869
|
+
var onKeyDownCb = React$3.useCallback(function (event) {
|
|
13870
|
+
// Ignore keyboard events bubbling up the DOM tree
|
|
13871
|
+
if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
|
|
13872
|
+
return;
|
|
13873
|
+
}
|
|
13874
|
+
|
|
13875
|
+
if (event.key === " " || event.key === "Enter" || event.keyCode === 32 || event.keyCode === 13) {
|
|
13876
|
+
event.preventDefault();
|
|
13877
|
+
openFileDialog();
|
|
13878
|
+
}
|
|
13879
|
+
}, [rootRef, openFileDialog]); // Update focus state for the dropzone
|
|
13880
|
+
|
|
13881
|
+
var onFocusCb = React$3.useCallback(function () {
|
|
13882
|
+
dispatch({
|
|
13883
|
+
type: "focus"
|
|
13884
|
+
});
|
|
13885
|
+
}, []);
|
|
13886
|
+
var onBlurCb = React$3.useCallback(function () {
|
|
13887
|
+
dispatch({
|
|
13888
|
+
type: "blur"
|
|
13889
|
+
});
|
|
13890
|
+
}, []); // Cb to open the file dialog when click occurs on the dropzone
|
|
13891
|
+
|
|
13892
|
+
var onClickCb = React$3.useCallback(function () {
|
|
13893
|
+
if (noClick) {
|
|
13894
|
+
return;
|
|
13895
|
+
} // In IE11/Edge the file-browser dialog is blocking, therefore, use setTimeout()
|
|
13896
|
+
// to ensure React can handle state changes
|
|
13897
|
+
// See: https://github.com/react-dropzone/react-dropzone/issues/450
|
|
13898
|
+
|
|
13899
|
+
|
|
13900
|
+
if (isIeOrEdge()) {
|
|
13901
|
+
setTimeout(openFileDialog, 0);
|
|
13902
|
+
} else {
|
|
13903
|
+
openFileDialog();
|
|
13904
|
+
}
|
|
13905
|
+
}, [noClick, openFileDialog]);
|
|
13906
|
+
|
|
13907
|
+
var composeHandler = function composeHandler(fn) {
|
|
13908
|
+
return disabled ? null : fn;
|
|
13909
|
+
};
|
|
13910
|
+
|
|
13911
|
+
var composeKeyboardHandler = function composeKeyboardHandler(fn) {
|
|
13912
|
+
return noKeyboard ? null : composeHandler(fn);
|
|
13913
|
+
};
|
|
13914
|
+
|
|
13915
|
+
var composeDragHandler = function composeDragHandler(fn) {
|
|
13916
|
+
return noDrag ? null : composeHandler(fn);
|
|
13917
|
+
};
|
|
13918
|
+
|
|
13919
|
+
var stopPropagation = function stopPropagation(event) {
|
|
13920
|
+
if (noDragEventsBubbling) {
|
|
13921
|
+
event.stopPropagation();
|
|
13922
|
+
}
|
|
13923
|
+
};
|
|
13924
|
+
|
|
13925
|
+
var getRootProps = React$3.useMemo(function () {
|
|
13926
|
+
return function () {
|
|
13927
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
13928
|
+
_ref2$refKey = _ref2.refKey,
|
|
13929
|
+
refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey,
|
|
13930
|
+
role = _ref2.role,
|
|
13931
|
+
onKeyDown = _ref2.onKeyDown,
|
|
13932
|
+
onFocus = _ref2.onFocus,
|
|
13933
|
+
onBlur = _ref2.onBlur,
|
|
13934
|
+
onClick = _ref2.onClick,
|
|
13935
|
+
onDragEnter = _ref2.onDragEnter,
|
|
13936
|
+
onDragOver = _ref2.onDragOver,
|
|
13937
|
+
onDragLeave = _ref2.onDragLeave,
|
|
13938
|
+
onDrop = _ref2.onDrop,
|
|
13939
|
+
rest = _objectWithoutProperties(_ref2, _excluded3);
|
|
13940
|
+
|
|
13941
|
+
return _objectSpread(_objectSpread(_defineProperty({
|
|
13942
|
+
onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
|
|
13943
|
+
onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
|
|
13944
|
+
onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
|
|
13945
|
+
onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
|
|
13946
|
+
onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter, onDragEnterCb)),
|
|
13947
|
+
onDragOver: composeDragHandler(composeEventHandlers(onDragOver, onDragOverCb)),
|
|
13948
|
+
onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave, onDragLeaveCb)),
|
|
13949
|
+
onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb)),
|
|
13950
|
+
role: typeof role === "string" && role !== "" ? role : "presentation"
|
|
13951
|
+
}, refKey, rootRef), !disabled && !noKeyboard ? {
|
|
13952
|
+
tabIndex: 0
|
|
13953
|
+
} : {}), rest);
|
|
13954
|
+
};
|
|
13955
|
+
}, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
|
|
13956
|
+
var onInputElementClick = React$3.useCallback(function (event) {
|
|
13957
|
+
event.stopPropagation();
|
|
13958
|
+
}, []);
|
|
13959
|
+
var getInputProps = React$3.useMemo(function () {
|
|
13960
|
+
return function () {
|
|
13961
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
13962
|
+
_ref3$refKey = _ref3.refKey,
|
|
13963
|
+
refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey,
|
|
13964
|
+
onChange = _ref3.onChange,
|
|
13965
|
+
onClick = _ref3.onClick,
|
|
13966
|
+
rest = _objectWithoutProperties(_ref3, _excluded4);
|
|
13967
|
+
|
|
13968
|
+
var inputProps = _defineProperty({
|
|
13969
|
+
accept: acceptAttr,
|
|
13970
|
+
multiple: multiple,
|
|
13971
|
+
type: "file",
|
|
13972
|
+
style: {
|
|
13973
|
+
display: "none"
|
|
13974
|
+
},
|
|
13975
|
+
onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
|
|
13976
|
+
onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
|
|
13977
|
+
tabIndex: -1
|
|
13978
|
+
}, refKey, inputRef);
|
|
13979
|
+
|
|
13980
|
+
return _objectSpread(_objectSpread({}, inputProps), rest);
|
|
13981
|
+
};
|
|
13982
|
+
}, [inputRef, accept, multiple, onDropCb, disabled]);
|
|
13983
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
13984
|
+
isFocused: isFocused && !disabled,
|
|
13985
|
+
getRootProps: getRootProps,
|
|
13986
|
+
getInputProps: getInputProps,
|
|
13987
|
+
rootRef: rootRef,
|
|
13988
|
+
inputRef: inputRef,
|
|
13989
|
+
open: composeHandler(openFileDialog)
|
|
13990
|
+
});
|
|
13991
|
+
}
|
|
13992
|
+
/**
|
|
13993
|
+
* @param {DropzoneState} state
|
|
13994
|
+
* @param {{type: string} & DropzoneState} action
|
|
13995
|
+
* @returns {DropzoneState}
|
|
13996
|
+
*/
|
|
13997
|
+
|
|
13998
|
+
function reducer(state, action) {
|
|
13999
|
+
/* istanbul ignore next */
|
|
14000
|
+
switch (action.type) {
|
|
14001
|
+
case "focus":
|
|
14002
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
14003
|
+
isFocused: true
|
|
14004
|
+
});
|
|
14005
|
+
|
|
14006
|
+
case "blur":
|
|
14007
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
14008
|
+
isFocused: false
|
|
14009
|
+
});
|
|
14010
|
+
|
|
14011
|
+
case "openDialog":
|
|
14012
|
+
return _objectSpread(_objectSpread({}, initialState), {}, {
|
|
14013
|
+
isFileDialogActive: true
|
|
14014
|
+
});
|
|
14015
|
+
|
|
14016
|
+
case "closeDialog":
|
|
14017
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
14018
|
+
isFileDialogActive: false
|
|
14019
|
+
});
|
|
14020
|
+
|
|
14021
|
+
case "setDraggedFiles":
|
|
14022
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
14023
|
+
isDragActive: action.isDragActive,
|
|
14024
|
+
isDragAccept: action.isDragAccept,
|
|
14025
|
+
isDragReject: action.isDragReject
|
|
14026
|
+
});
|
|
14027
|
+
|
|
14028
|
+
case "setFiles":
|
|
14029
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
14030
|
+
acceptedFiles: action.acceptedFiles,
|
|
14031
|
+
fileRejections: action.fileRejections
|
|
14032
|
+
});
|
|
14033
|
+
|
|
14034
|
+
case "reset":
|
|
14035
|
+
return _objectSpread({}, initialState);
|
|
14036
|
+
|
|
14037
|
+
default:
|
|
14038
|
+
return state;
|
|
14039
|
+
}
|
|
14040
|
+
}
|
|
14041
|
+
|
|
14042
|
+
function noop() {}
|
|
14043
|
+
|
|
14044
|
+
var Container$h = styled__default["default"].div(templateObject_1$v || (templateObject_1$v = __makeTemplateObject$1(["\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 15px;\n"], ["\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 15px;\n"])));
|
|
14045
|
+
var DropZone = styled__default["default"].div(templateObject_2$q || (templateObject_2$q = __makeTemplateObject$1(["\n min-height: 250px;\n border-width: 2px;\n border-style: dashed;\n border-color: ", ";\n box-sizing: border-box;\n border-radius: 4px;\n background-color: ", ";\n padding: 25px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"], ["\n min-height: 250px;\n border-width: 2px;\n border-style: dashed;\n border-color: ", ";\n box-sizing: border-box;\n border-radius: 4px;\n background-color: ", ";\n padding: 25px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"])), function (_a) {
|
|
14046
|
+
_a.isDragActive; var isDragAccept = _a.isDragAccept, isDragReject = _a.isDragReject;
|
|
14047
|
+
// if (isDragActive) return theme.colors.blue.base;
|
|
14048
|
+
if (isDragAccept)
|
|
14049
|
+
return theme.colors.green.base;
|
|
14050
|
+
else if (isDragReject)
|
|
14051
|
+
return theme.colors.red.base;
|
|
14052
|
+
else
|
|
14053
|
+
return theme.colors.lightGray.darker;
|
|
14054
|
+
}, function (_a) {
|
|
14055
|
+
_a.isDragActive; var isDragAccept = _a.isDragAccept, isDragReject = _a.isDragReject;
|
|
14056
|
+
// if (isDragActive) return `${theme.colors.blue.light}25`;
|
|
14057
|
+
if (isDragAccept)
|
|
14058
|
+
return "".concat(theme.colors.green.light, "25");
|
|
14059
|
+
else if (isDragReject)
|
|
14060
|
+
return "".concat(theme.colors.red.light, "25");
|
|
14061
|
+
else
|
|
14062
|
+
return theme.colors.lightGray.base;
|
|
14063
|
+
});
|
|
14064
|
+
var FileList = styled__default["default"].div(templateObject_3$9 || (templateObject_3$9 = __makeTemplateObject$1(["\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 10px;\n"], ["\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 10px;\n"])));
|
|
14065
|
+
var templateObject_1$v, templateObject_2$q, templateObject_3$9;
|
|
14066
|
+
|
|
14067
|
+
var FileUpload = function (_a) {
|
|
14068
|
+
var locale = _a.locale, accept = _a.accept, onDrop = _a.onDrop, files = _a.files;
|
|
14069
|
+
var _b = useDropzone({
|
|
14070
|
+
onDrop: onDrop,
|
|
14071
|
+
accept: accept,
|
|
14072
|
+
// Max file size: 2MB
|
|
14073
|
+
maxSize: 1048576 * 2,
|
|
14074
|
+
minSize: 0,
|
|
14075
|
+
// Max number of files: 1
|
|
14076
|
+
maxFiles: 1,
|
|
14077
|
+
}), getRootProps = _b.getRootProps, getInputProps = _b.getInputProps, isDragActive = _b.isDragActive, isDragAccept = _b.isDragAccept, isDragReject = _b.isDragReject;
|
|
14078
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(Container$h, { children: [jsxRuntime.jsxs(DropZone, __assign$2({}, getRootProps({
|
|
14079
|
+
isDragActive: isDragActive,
|
|
14080
|
+
isDragAccept: isDragAccept,
|
|
14081
|
+
isDragReject: isDragReject,
|
|
14082
|
+
}), { children: [jsxRuntime.jsx("input", __assign$2({}, getInputProps())), jsxRuntime.jsx(Icon, { type: "file", size: "large" }), jsxRuntime.jsx(Spacer, { vertical: 15 }), !isDragActive && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Heading, __assign$2({ type: "h6" }, { children: translations[locale]["Drag file(s) here..."] })), jsxRuntime.jsx(Spacer, { vertical: 5 }), jsxRuntime.jsx(Paragraph, { children: translations[locale]["or"] }), jsxRuntime.jsx(Spacer, { vertical: 10 }), jsxRuntime.jsx(Button, { label: translations[locale]["Select file(s)"], size: "small" })] })), isDragActive && !isDragReject && (jsxRuntime.jsx(Heading, __assign$2({ type: "h6" }, { children: translations[locale]["Upload file(s)..."] }))), isDragReject && (jsxRuntime.jsx(Heading, __assign$2({ type: "h6" }, { children: translations[locale]["File type not allowed"] })))] })), files && files.length > 0 && (jsxRuntime.jsx(FileList, { children: files.map(function (file, index) { return (jsxRuntime.jsx(Alert, { type: "success", message: file.name }, "".concat(file.name, "-").concat(index))); }) }))] }) }));
|
|
11376
14083
|
};
|
|
11377
14084
|
|
|
11378
14085
|
var StyledIconButton = styled__default["default"](StyledButton)(templateObject_1$u || (templateObject_1$u = __makeTemplateObject$1(["\n min-width: ", ";\n max-width: ", ";\n min-height: ", ";\n max-height: ", ";\n padding: 2px 0 0 0;\n\n > div:first-child {\n margin-top: -2px;\n }\n\n :active {\n min-height: ", ";\n max-height: ", ";\n margin-top: 2px;\n }\n"], ["\n min-width: ", ";\n max-width: ", ";\n min-height: ", ";\n max-height: ", ";\n padding: 2px 0 0 0;\n\n > div:first-child {\n margin-top: -2px;\n }\n\n :active {\n min-height: ", ";\n max-height: ", ";\n margin-top: 2px;\n }\n"])), function (_a) {
|
|
@@ -11515,7 +14222,7 @@ var Container$e = styled__default["default"].div(templateObject_1$q || (template
|
|
|
11515
14222
|
});
|
|
11516
14223
|
var templateObject_1$q;
|
|
11517
14224
|
|
|
11518
|
-
var Loading = function (props) { return (jsxRuntime.jsxs(Container$e, __assign$2({}, props, { children: [jsxRuntime.jsx(_default, { color: theme.colors[props.color].base, speedMultiplier: 0.5 }), props.text && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Spacer, { vertical: 20 }), jsxRuntime.jsx(Heading, __assign$2({ type: "h6", color: props.textColor || "black" }, { children: props.text }))] }))] }))); };
|
|
14225
|
+
var Loading = function (props) { return (jsxRuntime.jsxs(Container$e, __assign$2({}, props, { children: [jsxRuntime.jsx(_default$1, { color: theme.colors[props.color].base, speedMultiplier: 0.5 }), props.text && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Spacer, { vertical: 20 }), jsxRuntime.jsx(Heading, __assign$2({ type: "h6", color: props.textColor || "black" }, { children: props.text }))] }))] }))); };
|
|
11519
14226
|
|
|
11520
14227
|
var Container$d = styled__default["default"].div(templateObject_1$p || (templateObject_1$p = __makeTemplateObject$1(["\n padding: 15px;\n background-color: ", ";\n border-radius: 6px 6px 0 0;\n position: relative;\n cursor: pointer;\n"], ["\n padding: 15px;\n background-color: ", ";\n border-radius: 6px 6px 0 0;\n position: relative;\n cursor: pointer;\n"])), function (_a) {
|
|
11521
14228
|
var dropdownIsVisible = _a.dropdownIsVisible, color = _a.color;
|
|
@@ -12522,6 +15229,7 @@ exports.Checkboxes = Checkboxes;
|
|
|
12522
15229
|
exports.Collapse = Collapse;
|
|
12523
15230
|
exports.Countdown = Countdown;
|
|
12524
15231
|
exports.DateInputField = DateInputField;
|
|
15232
|
+
exports.FileUpload = FileUpload;
|
|
12525
15233
|
exports.Flag = Flag;
|
|
12526
15234
|
exports.Form = Form;
|
|
12527
15235
|
exports.Heading = Heading;
|