@ballistix.digital/react-components 0.4.115 → 0.4.117
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/dist/index.d.ts +93 -47
- package/dist/index.esm.js +2291 -229
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2290 -227
- package/dist/index.js.map +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
package/dist/index.esm.js
CHANGED
|
@@ -8,7 +8,7 @@ import { fal } from '@fortawesome/pro-light-svg-icons';
|
|
|
8
8
|
import { far } from '@fortawesome/pro-regular-svg-icons';
|
|
9
9
|
import { fas } from '@fortawesome/pro-solid-svg-icons';
|
|
10
10
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
11
|
-
import React, { Children, Fragment, useState, useEffect, useCallback, useMemo } from 'react';
|
|
11
|
+
import React, { Children, Fragment, useState, useEffect, useCallback, useMemo, forwardRef, useImperativeHandle, useRef, useReducer } from 'react';
|
|
12
12
|
import { Menu, Transition, Dialog } from '@headlessui/react';
|
|
13
13
|
import { useMask } from '@react-input/mask';
|
|
14
14
|
import { ViewColumnsIcon, ChevronDownIcon as ChevronDownIcon$1, TableCellsIcon } from '@heroicons/react/24/outline';
|
|
@@ -46,6 +46,61 @@ var __assign = function() {
|
|
|
46
46
|
return __assign.apply(this, arguments);
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
50
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
51
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
52
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
53
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
54
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
55
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function __generator(thisArg, body) {
|
|
60
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
61
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
62
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
63
|
+
function step(op) {
|
|
64
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
65
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
66
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
67
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
68
|
+
switch (op[0]) {
|
|
69
|
+
case 0: case 1: t = op; break;
|
|
70
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
71
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
72
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
73
|
+
default:
|
|
74
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
75
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
76
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
77
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
78
|
+
if (t[2]) _.ops.pop();
|
|
79
|
+
_.trys.pop(); continue;
|
|
80
|
+
}
|
|
81
|
+
op = body.call(thisArg, _);
|
|
82
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
83
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function __read(o, n) {
|
|
88
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
89
|
+
if (!m) return o;
|
|
90
|
+
var i = m.call(o), r, ar = [], e;
|
|
91
|
+
try {
|
|
92
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
93
|
+
}
|
|
94
|
+
catch (error) { e = { error: error }; }
|
|
95
|
+
finally {
|
|
96
|
+
try {
|
|
97
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
98
|
+
}
|
|
99
|
+
finally { if (e) throw e.error; }
|
|
100
|
+
}
|
|
101
|
+
return ar;
|
|
102
|
+
}
|
|
103
|
+
|
|
49
104
|
function __spreadArray(to, from, pack) {
|
|
50
105
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
106
|
if (ar || !(i in from)) {
|
|
@@ -97,10 +152,10 @@ var deepCopyObject = function (object) {
|
|
|
97
152
|
var AvatarElement = function (props) {
|
|
98
153
|
var src = props.src, placeholder = props.placeholder, children = props.children, url = props.url, _a = props.size, size = _a === void 0 ? 'md' : _a, _b = props.figure, figure = _b === void 0 ? 'block' : _b, status = props.status, isDisabled = props.isDisabled, isLoading = props.isLoading, stylesOverrides = props.styles;
|
|
99
154
|
var handleGenerateStyle = function () {
|
|
100
|
-
var result = deepCopyObject(styles$
|
|
101
|
-
var keys = calculateNestedKeys(styles$
|
|
155
|
+
var result = deepCopyObject(styles$p.base);
|
|
156
|
+
var keys = calculateNestedKeys(styles$p.base);
|
|
102
157
|
keys.forEach(function (key) {
|
|
103
|
-
set(result, key, toClassName(get(styles$
|
|
158
|
+
set(result, key, toClassName(get(styles$p.base, key), size && get(styles$p[size], key), figure && get(styles$p[figure], key), status && get(styles$p[status], key), isDisabled && get(styles$p.disabled, key), isLoading && get(styles$p.loading, key), get(stylesOverrides, key)));
|
|
104
159
|
});
|
|
105
160
|
return result;
|
|
106
161
|
};
|
|
@@ -118,7 +173,7 @@ var AvatarElement = function (props) {
|
|
|
118
173
|
return (jsx("a", { href: url, children: jsxs("div", { className: "flex items-center", children: [jsxs("span", { className: "flex items-center justify-center", children: [jsx("div", { className: styles.container, style: { backgroundImage: "url(".concat(src, ")") } }), status && jsx("span", { className: styles.indicator })] }), children && jsx("div", { className: "ml-3", children: children })] }) }));
|
|
119
174
|
};
|
|
120
175
|
|
|
121
|
-
var base$
|
|
176
|
+
var base$n = {
|
|
122
177
|
loading: 'inline-block relative overflow-hidden bg-gray-50 flex items-center justify-center',
|
|
123
178
|
spinner: 'w-5 h-5 animate-spin text-gray-400',
|
|
124
179
|
empty: 'inline-block relative overflow-hidden bg-gray-50 text-red-400',
|
|
@@ -181,7 +236,7 @@ var rounded$2 = {
|
|
|
181
236
|
placeholder: 'rounded-full',
|
|
182
237
|
container: 'rounded-full',
|
|
183
238
|
};
|
|
184
|
-
var disabled$
|
|
239
|
+
var disabled$7 = {
|
|
185
240
|
container: 'opacity-20 cursor-not-allowed',
|
|
186
241
|
};
|
|
187
242
|
var loading$2 = {
|
|
@@ -196,8 +251,8 @@ var online = {
|
|
|
196
251
|
var blocked = {
|
|
197
252
|
indicator: 'bg-red-400',
|
|
198
253
|
};
|
|
199
|
-
var styles$
|
|
200
|
-
base: base$
|
|
254
|
+
var styles$p = {
|
|
255
|
+
base: base$n,
|
|
201
256
|
xs: xs$4,
|
|
202
257
|
sm: sm$5,
|
|
203
258
|
md: md$4,
|
|
@@ -208,17 +263,17 @@ var styles$o = {
|
|
|
208
263
|
offline: offline,
|
|
209
264
|
online: online,
|
|
210
265
|
blocked: blocked,
|
|
211
|
-
disabled: disabled$
|
|
266
|
+
disabled: disabled$7,
|
|
212
267
|
loading: loading$2,
|
|
213
268
|
};
|
|
214
269
|
|
|
215
270
|
var BadgeElement = function (props) {
|
|
216
271
|
var children = props.children, _a = props.color, color = _a === void 0 ? 'gray' : _a, _b = props.type, type = _b === void 0 ? 'normal' : _b, _c = props.size, size = _c === void 0 ? 'sm' : _c, _d = props.figure, figure = _d === void 0 ? 'block' : _d, isDisabled = props.isDisabled, isLoading = props.isLoading, onClose = props.onClose, stylesOverrides = props.styles;
|
|
217
272
|
var handleGenerateStyle = function () {
|
|
218
|
-
var result = deepCopyObject(styles$
|
|
219
|
-
var keys = calculateNestedKeys(styles$
|
|
273
|
+
var result = deepCopyObject(styles$o.base);
|
|
274
|
+
var keys = calculateNestedKeys(styles$o.base);
|
|
220
275
|
keys.forEach(function (key) {
|
|
221
|
-
set(result, key, toClassName(get(styles$
|
|
276
|
+
set(result, key, toClassName(get(styles$o.base, key), type && get(styles$o[type], key), color && get(styles$o[color], key), size && get(styles$o[size], key), figure && get(styles$o[figure], key), isDisabled && get(styles$o.disabled, key), isLoading && get(styles$o.loading, key), get(stylesOverrides, key)));
|
|
222
277
|
});
|
|
223
278
|
return result;
|
|
224
279
|
};
|
|
@@ -230,12 +285,12 @@ var BadgeElement = function (props) {
|
|
|
230
285
|
return (jsxs("span", { className: styles.container, children: [type === 'indicator' && (jsx("svg", { className: styles.indicator, fill: "currentColor", viewBox: "0 0 8 8", children: jsx("circle", { cx: 4, cy: 4, r: 3 }) })), children, type === 'close' && (jsxs("button", { type: "button", className: styles.button, onClick: onClose, children: [jsx("span", { className: "sr-only", children: "Remove large option" }), xIcon] }))] }));
|
|
231
286
|
};
|
|
232
287
|
|
|
233
|
-
var base$
|
|
288
|
+
var base$m = {
|
|
234
289
|
container: 'inline-flex items-center font-medium py-0.5',
|
|
235
290
|
indicator: '',
|
|
236
291
|
button: 'flex-shrink-0 ml-0.5 h-4 w-4 rounded-full inline-flex items-center justify-center focus:text-white focus:outline-none',
|
|
237
292
|
};
|
|
238
|
-
var normal$
|
|
293
|
+
var normal$6 = {
|
|
239
294
|
container: 'px-2.5',
|
|
240
295
|
};
|
|
241
296
|
var indicator = {
|
|
@@ -307,15 +362,15 @@ var pink = {
|
|
|
307
362
|
indicator: 'text-pink-400',
|
|
308
363
|
button: 'text-pink-400 hover:bg-pink-200 hover:text-pink-500 focus:bg-purple-500',
|
|
309
364
|
};
|
|
310
|
-
var disabled$
|
|
365
|
+
var disabled$6 = {
|
|
311
366
|
container: 'opacity-20 cursor-not-allowed',
|
|
312
367
|
};
|
|
313
368
|
var loading$1 = {
|
|
314
369
|
container: 'cursor-progress',
|
|
315
370
|
};
|
|
316
|
-
var styles$
|
|
317
|
-
base: base$
|
|
318
|
-
normal: normal$
|
|
371
|
+
var styles$o = {
|
|
372
|
+
base: base$m,
|
|
373
|
+
normal: normal$6,
|
|
319
374
|
indicator: indicator,
|
|
320
375
|
close: close,
|
|
321
376
|
primary: primary$1,
|
|
@@ -333,7 +388,7 @@ var styles$n = {
|
|
|
333
388
|
indigo: indigo,
|
|
334
389
|
purple: purple,
|
|
335
390
|
pink: pink,
|
|
336
|
-
disabled: disabled$
|
|
391
|
+
disabled: disabled$6,
|
|
337
392
|
loading: loading$1,
|
|
338
393
|
};
|
|
339
394
|
|
|
@@ -372,10 +427,10 @@ var IconElement = function (props) {
|
|
|
372
427
|
var ButtonElement = function (props) {
|
|
373
428
|
var children = props.children, innerRef = props.innerRef, _a = props.htmlType, htmlType = _a === void 0 ? 'button' : _a, _b = props.type, type = _b === void 0 ? 'primary' : _b, _c = props.size, size = _c === void 0 ? 'md' : _c, _d = props.figure, figure = _d === void 0 ? 'block' : _d, _e = props.status, status = _e === void 0 ? 'idle' : _e, isDisabled = props.isDisabled, stylesOverrides = props.styles, onClick = props.onClick;
|
|
374
429
|
var handleGenerateStyle = function () {
|
|
375
|
-
var result = deepCopyObject(styles$
|
|
376
|
-
var keys = calculateNestedKeys(styles$
|
|
430
|
+
var result = deepCopyObject(styles$n.base);
|
|
431
|
+
var keys = calculateNestedKeys(styles$n.base);
|
|
377
432
|
keys.forEach(function (key) {
|
|
378
|
-
set(result, key, toClassName(get(styles$
|
|
433
|
+
set(result, key, toClassName(get(styles$n.base, key), type && get(styles$n[type], key), size && get(styles$n[size], key), figure && get(styles$n[figure], key), status && get(styles$n[status], key), isDisabled && get(styles$n.disabled, key), get(stylesOverrides, key)));
|
|
379
434
|
});
|
|
380
435
|
return result;
|
|
381
436
|
};
|
|
@@ -383,7 +438,7 @@ var ButtonElement = function (props) {
|
|
|
383
438
|
return (jsxs("button", { type: htmlType, className: styles.container, disabled: isDisabled || status !== 'idle', onClick: onClick, ref: innerRef, children: [status === 'idle' && children, status === 'loading' && (jsxs("div", { className: styles.content, children: [jsx(IconElement, { type: "regular", accessor: "spinner", className: styles.spinner }), jsx("div", { children: children })] })), status === 'error' && (jsxs("div", { className: styles.content, children: [jsx(IconElement, { type: "regular", accessor: "circle-exclamation", className: styles.icon }), jsx("div", { children: children })] })), status === 'success' && (jsxs("div", { className: styles.content, children: [jsx(IconElement, { type: "regular", accessor: "circle-check", className: styles.icon }), jsx("div", { children: children })] }))] }));
|
|
384
439
|
};
|
|
385
440
|
|
|
386
|
-
var base$
|
|
441
|
+
var base$l = {
|
|
387
442
|
container: 'inline-flex items-center border border-transparent font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 duration-300',
|
|
388
443
|
content: 'flex gap-2',
|
|
389
444
|
icon: '',
|
|
@@ -432,11 +487,11 @@ var error = {
|
|
|
432
487
|
container: 'bg-rose-400 hover:bg-rose-500 !text-white duration-300',
|
|
433
488
|
content: 'flex items-center',
|
|
434
489
|
};
|
|
435
|
-
var disabled$
|
|
490
|
+
var disabled$5 = {
|
|
436
491
|
container: '!opacity-20 !cursor-not-allowed',
|
|
437
492
|
};
|
|
438
|
-
var styles$
|
|
439
|
-
base: base$
|
|
493
|
+
var styles$n = {
|
|
494
|
+
base: base$l,
|
|
440
495
|
primary: primary,
|
|
441
496
|
secondary: secondary,
|
|
442
497
|
outline: outline,
|
|
@@ -451,16 +506,16 @@ var styles$m = {
|
|
|
451
506
|
loading: loading,
|
|
452
507
|
success: success,
|
|
453
508
|
error: error,
|
|
454
|
-
disabled: disabled$
|
|
509
|
+
disabled: disabled$5,
|
|
455
510
|
};
|
|
456
511
|
|
|
457
512
|
var ButtonGroupElement = function (props) {
|
|
458
513
|
var children = props.children, stylesOverrides = props.styles;
|
|
459
514
|
var handleGenerateStyle = function () {
|
|
460
|
-
var result = deepCopyObject(styles$
|
|
461
|
-
var keys = calculateNestedKeys(styles$
|
|
515
|
+
var result = deepCopyObject(styles$m.base);
|
|
516
|
+
var keys = calculateNestedKeys(styles$m.base);
|
|
462
517
|
keys.forEach(function (key) {
|
|
463
|
-
set(result, key, toClassName(get(styles$
|
|
518
|
+
set(result, key, toClassName(get(styles$m.base, key), get(stylesOverrides, key)));
|
|
464
519
|
});
|
|
465
520
|
return result;
|
|
466
521
|
};
|
|
@@ -478,23 +533,23 @@ var ButtonGroupElement = function (props) {
|
|
|
478
533
|
}) }));
|
|
479
534
|
};
|
|
480
535
|
|
|
481
|
-
var base$
|
|
536
|
+
var base$k = {
|
|
482
537
|
container: 'relative z-0 inline-flex shadow-sm rounded-md',
|
|
483
538
|
firstButton: 'relative inline-flex items-center px-4 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:z-10 focus:outline-none focus:ring-1 focus:ring-primary-500 focus:border-primary-500',
|
|
484
539
|
button: '-ml-px relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:z-10 focus:outline-none focus:ring-1 focus:ring-primary-500 focus:border-primary-500',
|
|
485
540
|
lastButton: '-ml-px relative inline-flex items-center px-4 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:z-10 focus:outline-none focus:ring-1 focus:ring-primary-500 focus:border-primary-500',
|
|
486
541
|
};
|
|
487
|
-
var styles$
|
|
488
|
-
base: base$
|
|
542
|
+
var styles$m = {
|
|
543
|
+
base: base$k,
|
|
489
544
|
};
|
|
490
545
|
|
|
491
546
|
var Container$3 = function (props) {
|
|
492
547
|
var children = props.children, label = props.label, trigger = props.trigger, _a = props.type, type = _a === void 0 ? 'button' : _a, _b = props.direction, direction = _b === void 0 ? 'bottom-left' : _b, _c = props.isEscapingOverflow, isEscapingOverflow = _c === void 0 ? false : _c, stylesOverrides = props.styles;
|
|
493
548
|
var handleGenerateStyle = function () {
|
|
494
|
-
var result = deepCopyObject(styles$
|
|
495
|
-
var keys = calculateNestedKeys(styles$
|
|
549
|
+
var result = deepCopyObject(styles$l.base);
|
|
550
|
+
var keys = calculateNestedKeys(styles$l.base);
|
|
496
551
|
keys.forEach(function (key) {
|
|
497
|
-
set(result, key, toClassName(get(styles$
|
|
552
|
+
set(result, key, toClassName(get(styles$l.base, key), type && get(styles$l[type], key), direction && get(styles$l[direction], key), get(stylesOverrides, key)));
|
|
498
553
|
});
|
|
499
554
|
return result;
|
|
500
555
|
};
|
|
@@ -507,7 +562,7 @@ var DropdownElement = {
|
|
|
507
562
|
Item: Menu.Item,
|
|
508
563
|
};
|
|
509
564
|
|
|
510
|
-
var base$
|
|
565
|
+
var base$j = {
|
|
511
566
|
container: 'inline-block text-left',
|
|
512
567
|
button: 'inline-flex justify-center w-full rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-primary-500',
|
|
513
568
|
compact: 'bg-gray-100 rounded-full flex items-center text-gray-400 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-primary-500',
|
|
@@ -528,8 +583,8 @@ var topLeft = {
|
|
|
528
583
|
var topRight = {
|
|
529
584
|
items: 'origin-bottom-left left-0 bottom-0',
|
|
530
585
|
};
|
|
531
|
-
var styles$
|
|
532
|
-
base: base$
|
|
586
|
+
var styles$l = {
|
|
587
|
+
base: base$j,
|
|
533
588
|
button: button,
|
|
534
589
|
compact: compact,
|
|
535
590
|
'bottom-left': bottomLeft,
|
|
@@ -548,10 +603,10 @@ var InputGroupForm = function (props) {
|
|
|
548
603
|
replacement: (_a = {}, _a[(_b = mask === null || mask === void 0 ? void 0 : mask.replacementCharacter) !== null && _b !== void 0 ? _b : 'X'] = /\d|\D/, _a),
|
|
549
604
|
});
|
|
550
605
|
var handleGenerateStyle = function () {
|
|
551
|
-
var result = deepCopyObject(styles$
|
|
552
|
-
var keys = calculateNestedKeys(styles$
|
|
606
|
+
var result = deepCopyObject(styles$k.base);
|
|
607
|
+
var keys = calculateNestedKeys(styles$k.base);
|
|
553
608
|
keys.forEach(function (key) {
|
|
554
|
-
set(result, key, toClassName(get(styles$
|
|
609
|
+
set(result, key, toClassName(get(styles$k.base, key), leading !== undefined && get(styles$k.leading, key), trailing !== undefined && get(styles$k.trailing, key), type && get(styles$k[type], key), isTouched === true && !isValid && get(styles$k.invalid, key), isDisabled && get(styles$k.disabled, key), get(stylesOverrides, key)));
|
|
555
610
|
});
|
|
556
611
|
return result;
|
|
557
612
|
};
|
|
@@ -561,7 +616,7 @@ var InputGroupForm = function (props) {
|
|
|
561
616
|
(htmlType !== 'area' && (jsx("input", { type: mask !== undefined ? 'text' : htmlType, ref: mask && ref, name: name, id: name, className: toClassName(styles.input, htmlType === 'color' && '!h-10'), placeholder: placeholder, defaultValue: isSolo ? value : undefined, value: isSolo ? undefined : value, min: min, max: max, maxLength: maxLength, disabled: isDisabled, onChange: onChange, onBlur: onBlur }))), htmlType === 'area' && (jsx("textarea", { rows: rows, name: name, id: name, className: styles.input, placeholder: placeholder, defaultValue: isSolo ? value : undefined, value: isSolo ? undefined : value, maxLength: maxLength, disabled: isDisabled, onChange: onChange, onBlur: onBlur })), type === 'floored' && (jsx("div", { className: "absolute inset-x-0 bottom-0 border-t border-gray-300 peer-focus:border-t-2 peer-focus:border-primary-600", "aria-hidden": "true" })), trailing && isValid && (jsx("div", { className: styles.trailing, children: trailing })), isTouched && !isValid && (jsx("div", { className: styles.trailing, children: invalidIcon }))] }), jsxs("div", { className: styles.foot, children: [description && !(error && isTouched) && (jsx("p", { className: styles.description, children: description })), error && isTouched && jsx("p", { className: styles.error, children: error })] })] }));
|
|
562
617
|
};
|
|
563
618
|
|
|
564
|
-
var base$
|
|
619
|
+
var base$i = {
|
|
565
620
|
container: '',
|
|
566
621
|
head: 'flex justify-between',
|
|
567
622
|
body: 'relative rounded-md',
|
|
@@ -574,11 +629,11 @@ var base$h = {
|
|
|
574
629
|
description: 'text-gray-400 text-xs mt-1',
|
|
575
630
|
error: 'text-red-500 text-xs ml-5 mt-1',
|
|
576
631
|
};
|
|
577
|
-
var leading$
|
|
632
|
+
var leading$3 = {
|
|
578
633
|
input: 'pl-10',
|
|
579
634
|
};
|
|
580
|
-
var trailing$
|
|
581
|
-
var normal$
|
|
635
|
+
var trailing$3 = {};
|
|
636
|
+
var normal$5 = {
|
|
582
637
|
label: 'leading-6 text-sm mb-2',
|
|
583
638
|
hint: 'leading-6',
|
|
584
639
|
leading: 'pl-3',
|
|
@@ -586,14 +641,14 @@ var normal$4 = {
|
|
|
586
641
|
trailing: 'pr-3',
|
|
587
642
|
description: 'mt-2 text-sm',
|
|
588
643
|
};
|
|
589
|
-
var inset$
|
|
644
|
+
var inset$3 = {
|
|
590
645
|
container: 'rounded-md px-3 pt-2.5 pb-1.5 shadow-sm ring-1 ring-inset ring-gray-300 focus-within:ring-2 focus-within:ring-primary-600',
|
|
591
646
|
label: 'text-xs',
|
|
592
647
|
hint: 'text-xs',
|
|
593
648
|
input: 'border-0 !ring-0 p-0 text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm pl-0',
|
|
594
649
|
description: 'hidden',
|
|
595
650
|
};
|
|
596
|
-
var overlapping$
|
|
651
|
+
var overlapping$3 = {
|
|
597
652
|
container: 'relative',
|
|
598
653
|
head: ' absolute flex justify-between items-center left-0 -top-2 right-0 mx-2 z-10 w-full',
|
|
599
654
|
label: 'inline-block bg-white px-1 text-xs font-medium text-gray-900 ',
|
|
@@ -601,49 +656,49 @@ var overlapping$2 = {
|
|
|
601
656
|
input: 'block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6',
|
|
602
657
|
description: 'hidden',
|
|
603
658
|
};
|
|
604
|
-
var pill$
|
|
659
|
+
var pill$3 = {
|
|
605
660
|
head: 'mx-px block px-4 text-sm font-medium leading-6 text-gray-900 mb-1 pr-6',
|
|
606
661
|
foot: 'mx-px block px-4 text-sm font-medium leading-6 text-gray-900 mt-1 pr-6',
|
|
607
662
|
input: 'block w-full rounded-full border-0 px-4 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6',
|
|
608
663
|
trailing: 'pr-2',
|
|
609
664
|
description: 'text-xs',
|
|
610
665
|
};
|
|
611
|
-
var floored$
|
|
666
|
+
var floored$3 = {
|
|
612
667
|
body: 'relative mt-2',
|
|
613
668
|
label: 'block text-sm font-medium leading-6 text-gray-900',
|
|
614
669
|
input: 'peer block w-full border-0 bg-gray-50 py-1.5 text-gray-900 focus:ring-0 sm:text-sm sm:leading-6 ring-0',
|
|
615
670
|
description: 'text-xs mt-2',
|
|
616
671
|
};
|
|
617
|
-
var invalid$
|
|
672
|
+
var invalid$3 = {
|
|
618
673
|
container: 'ring-red-500',
|
|
619
674
|
input:
|
|
620
675
|
// 'block w-full border border-transparent text-red-900 ring-1 ring-inset ring-red-300 placeholder:text-red-300 focus:ring-2 focus:ring-inset focus:ring-red-500 sm:leading-6 pr-10',
|
|
621
676
|
'block w-full border border-transparent text-red-900 ring-1 ring-inset ring-red-300 placeholder:text-red-300 focus:ring-2 focus:ring-inset focus:ring-red-500 pr-10',
|
|
622
677
|
description: 'text-sm text-red-600',
|
|
623
678
|
};
|
|
624
|
-
var disabled$
|
|
679
|
+
var disabled$4 = {
|
|
625
680
|
input: 'block w-full rounded-md border-0 text-gray-900 shadow-sm ring-1 ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-500 disabled:ring-gray-200',
|
|
626
681
|
};
|
|
627
|
-
var styles$
|
|
628
|
-
base: base$
|
|
629
|
-
leading: leading$
|
|
630
|
-
trailing: trailing$
|
|
631
|
-
normal: normal$
|
|
632
|
-
inset: inset$
|
|
633
|
-
overlapping: overlapping$
|
|
634
|
-
pill: pill$
|
|
635
|
-
floored: floored$
|
|
636
|
-
invalid: invalid$
|
|
637
|
-
disabled: disabled$
|
|
682
|
+
var styles$k = {
|
|
683
|
+
base: base$i,
|
|
684
|
+
leading: leading$3,
|
|
685
|
+
trailing: trailing$3,
|
|
686
|
+
normal: normal$5,
|
|
687
|
+
inset: inset$3,
|
|
688
|
+
overlapping: overlapping$3,
|
|
689
|
+
pill: pill$3,
|
|
690
|
+
floored: floored$3,
|
|
691
|
+
invalid: invalid$3,
|
|
692
|
+
disabled: disabled$4,
|
|
638
693
|
};
|
|
639
694
|
|
|
640
695
|
var ContainerLayout = function (props) {
|
|
641
696
|
var children = props.children, _a = props.type, type = _a === void 0 ? 'break' : _a, stylesOverrides = props.styles;
|
|
642
697
|
var handleGenerateStyle = function () {
|
|
643
|
-
var result = deepCopyObject(styles$
|
|
644
|
-
var keys = calculateNestedKeys(styles$
|
|
698
|
+
var result = deepCopyObject(styles$j.base);
|
|
699
|
+
var keys = calculateNestedKeys(styles$j.base);
|
|
645
700
|
keys.forEach(function (key) {
|
|
646
|
-
set(result, key, toClassName(get(styles$
|
|
701
|
+
set(result, key, toClassName(get(styles$j.base, key), type && get(styles$j[type], key), get(stylesOverrides, key)));
|
|
647
702
|
});
|
|
648
703
|
return result;
|
|
649
704
|
};
|
|
@@ -666,7 +721,7 @@ var ContainerLayout = function (props) {
|
|
|
666
721
|
return handleGenerateComponent();
|
|
667
722
|
};
|
|
668
723
|
|
|
669
|
-
var base$
|
|
724
|
+
var base$h = {
|
|
670
725
|
container: '',
|
|
671
726
|
content: '',
|
|
672
727
|
};
|
|
@@ -680,8 +735,8 @@ var center$3 = {
|
|
|
680
735
|
var fill$1 = {
|
|
681
736
|
container: 'max-w-7xl mx-auto sm:px-6 lg:px-8',
|
|
682
737
|
};
|
|
683
|
-
var styles$
|
|
684
|
-
base: base$
|
|
738
|
+
var styles$j = {
|
|
739
|
+
base: base$h,
|
|
685
740
|
break: breakStyles,
|
|
686
741
|
center: center$3,
|
|
687
742
|
fill: fill$1,
|
|
@@ -690,10 +745,10 @@ var styles$i = {
|
|
|
690
745
|
var DividerLayout = function (props) {
|
|
691
746
|
var children = props.children, _a = props.type, type = _a === void 0 ? 'left' : _a, stylesOverrides = props.styles;
|
|
692
747
|
var handleGenerateStyle = function () {
|
|
693
|
-
var result = deepCopyObject(styles$
|
|
694
|
-
var keys = calculateNestedKeys(styles$
|
|
748
|
+
var result = deepCopyObject(styles$i.base);
|
|
749
|
+
var keys = calculateNestedKeys(styles$i.base);
|
|
695
750
|
keys.forEach(function (key) {
|
|
696
|
-
set(result, key, toClassName(get(styles$
|
|
751
|
+
set(result, key, toClassName(get(styles$i.base, key), type && get(styles$i[type], key), get(stylesOverrides, key)));
|
|
697
752
|
});
|
|
698
753
|
return result;
|
|
699
754
|
};
|
|
@@ -702,7 +757,7 @@ var DividerLayout = function (props) {
|
|
|
702
757
|
return (jsxs("div", { className: styles.container, children: [jsx("div", { className: styles.head, "aria-hidden": "true", children: jsx("div", { className: styles.line }) }), jsx("div", { className: styles.body, children: jsx("div", { className: styles.content, children: children }) })] }));
|
|
703
758
|
};
|
|
704
759
|
|
|
705
|
-
var base$
|
|
760
|
+
var base$g = {
|
|
706
761
|
container: 'relative',
|
|
707
762
|
head: 'absolute inset-0 flex items-center',
|
|
708
763
|
line: 'w-full border-t border-gray-300',
|
|
@@ -718,8 +773,8 @@ var center$2 = {
|
|
|
718
773
|
var right = {
|
|
719
774
|
body: 'justify-end',
|
|
720
775
|
};
|
|
721
|
-
var styles$
|
|
722
|
-
base: base$
|
|
776
|
+
var styles$i = {
|
|
777
|
+
base: base$g,
|
|
723
778
|
left: left,
|
|
724
779
|
center: center$2,
|
|
725
780
|
right: right,
|
|
@@ -728,10 +783,10 @@ var styles$h = {
|
|
|
728
783
|
var ListContainerLayout = function (props) {
|
|
729
784
|
var children = props.children, _a = props.type, type = _a === void 0 ? 'fill' : _a, stylesOverrides = props.styles;
|
|
730
785
|
var handleGenerateStyle = function () {
|
|
731
|
-
var result = deepCopyObject(styles$
|
|
732
|
-
var keys = calculateNestedKeys(styles$
|
|
786
|
+
var result = deepCopyObject(styles$h.base);
|
|
787
|
+
var keys = calculateNestedKeys(styles$h.base);
|
|
733
788
|
keys.forEach(function (key) {
|
|
734
|
-
set(result, key, toClassName(get(styles$
|
|
789
|
+
set(result, key, toClassName(get(styles$h.base, key), type && get(styles$h[type], key), get(stylesOverrides, key)));
|
|
735
790
|
});
|
|
736
791
|
return result;
|
|
737
792
|
};
|
|
@@ -742,7 +797,7 @@ var ListContainerLayout = function (props) {
|
|
|
742
797
|
}) }) }));
|
|
743
798
|
};
|
|
744
799
|
|
|
745
|
-
var base$
|
|
800
|
+
var base$f = {
|
|
746
801
|
container: '',
|
|
747
802
|
list: '',
|
|
748
803
|
item: '',
|
|
@@ -773,8 +828,8 @@ var cardSticky = {
|
|
|
773
828
|
list: 'space-y-3',
|
|
774
829
|
item: 'bg-white shadow overflow-hidden px-4 py-4 sm:px-6 sm:rounded-md',
|
|
775
830
|
};
|
|
776
|
-
var styles$
|
|
777
|
-
base: base$
|
|
831
|
+
var styles$h = {
|
|
832
|
+
base: base$f,
|
|
778
833
|
fill: fill,
|
|
779
834
|
'fill-sticky': fillSticky,
|
|
780
835
|
center: center$1,
|
|
@@ -786,10 +841,10 @@ var styles$g = {
|
|
|
786
841
|
var MediaObjectLayout = function (props) {
|
|
787
842
|
var title = props.title, paragraph = props.paragraph, customFigure = props.figure, _a = props.type, type = _a === void 0 ? 'top' : _a, stylesOverrides = props.styles;
|
|
788
843
|
var handleGenerateStyle = function () {
|
|
789
|
-
var result = deepCopyObject(styles$
|
|
790
|
-
var keys = calculateNestedKeys(styles$
|
|
844
|
+
var result = deepCopyObject(styles$g.base);
|
|
845
|
+
var keys = calculateNestedKeys(styles$g.base);
|
|
791
846
|
keys.forEach(function (key) {
|
|
792
|
-
set(result, key, toClassName(get(styles$
|
|
847
|
+
set(result, key, toClassName(get(styles$g.base, key), type && get(styles$g[type], key), get(stylesOverrides, key)));
|
|
793
848
|
});
|
|
794
849
|
return result;
|
|
795
850
|
};
|
|
@@ -807,7 +862,7 @@ var MediaObjectLayout = function (props) {
|
|
|
807
862
|
return (jsxs("div", { className: styles.container, children: [jsx("div", { className: styles.figure, children: $svg }), jsxs("div", { children: [jsx("h4", { className: styles.title, children: title }), jsx("p", { className: styles.paragraph, children: paragraph })] })] }));
|
|
808
863
|
};
|
|
809
864
|
|
|
810
|
-
var base$
|
|
865
|
+
var base$e = {
|
|
811
866
|
container: '',
|
|
812
867
|
figure: 'mr-4 flex-shrink-0',
|
|
813
868
|
svg: 'h-16 w-16 border border-gray-300 bg-white text-gray-300',
|
|
@@ -862,8 +917,8 @@ var wideReversed = {
|
|
|
862
917
|
figure: 'mb-4 md:mb-0 sm:mr-4 sm:mb-4',
|
|
863
918
|
svg: 'h-32 w-full sm:w-32',
|
|
864
919
|
};
|
|
865
|
-
var styles$
|
|
866
|
-
base: base$
|
|
920
|
+
var styles$g = {
|
|
921
|
+
base: base$e,
|
|
867
922
|
top: top,
|
|
868
923
|
'top-reversed': topReversed,
|
|
869
924
|
center: center,
|
|
@@ -881,10 +936,10 @@ var styles$f = {
|
|
|
881
936
|
var Container$2 = function (props) {
|
|
882
937
|
var children = props.children, _a = props.type, type = _a === void 0 ? 'normal' : _a, stylesOverrides = props.styles;
|
|
883
938
|
var handleGenerateStyle = function () {
|
|
884
|
-
var result = deepCopyObject(styles$
|
|
885
|
-
var keys = calculateNestedKeys(styles$
|
|
939
|
+
var result = deepCopyObject(styles$f.base);
|
|
940
|
+
var keys = calculateNestedKeys(styles$f.base);
|
|
886
941
|
keys.forEach(function (key) {
|
|
887
|
-
set(result, key, toClassName(get(styles$
|
|
942
|
+
set(result, key, toClassName(get(styles$f.base, key), type && get(styles$f[type], key), get(stylesOverrides, key)));
|
|
888
943
|
});
|
|
889
944
|
return result;
|
|
890
945
|
};
|
|
@@ -894,10 +949,10 @@ var Container$2 = function (props) {
|
|
|
894
949
|
var Section = function (props) {
|
|
895
950
|
var children = props.children, stylesOverrides = props.styles;
|
|
896
951
|
var handleGenerateStyle = function () {
|
|
897
|
-
var result = deepCopyObject(styles$
|
|
898
|
-
var keys = calculateNestedKeys(styles$
|
|
952
|
+
var result = deepCopyObject(styles$f.base);
|
|
953
|
+
var keys = calculateNestedKeys(styles$f.base);
|
|
899
954
|
keys.forEach(function (key) {
|
|
900
|
-
set(result, key, toClassName(get(styles$
|
|
955
|
+
set(result, key, toClassName(get(styles$f.base, key), get(stylesOverrides, key)));
|
|
901
956
|
});
|
|
902
957
|
return result;
|
|
903
958
|
};
|
|
@@ -909,19 +964,19 @@ var LayoutPanel = {
|
|
|
909
964
|
Section: Section,
|
|
910
965
|
};
|
|
911
966
|
|
|
912
|
-
var base$
|
|
967
|
+
var base$d = {
|
|
913
968
|
container: 'bg-white overflow-hidden shadow',
|
|
914
969
|
section: 'px-4 py-5 sm:px-6',
|
|
915
970
|
};
|
|
916
|
-
var normal$
|
|
971
|
+
var normal$4 = {
|
|
917
972
|
container: 'rounded-lg',
|
|
918
973
|
};
|
|
919
974
|
var sticky$1 = {
|
|
920
975
|
container: 'sm:rounded-lg',
|
|
921
976
|
};
|
|
922
|
-
var styles$
|
|
923
|
-
base: base$
|
|
924
|
-
normal: normal$
|
|
977
|
+
var styles$f = {
|
|
978
|
+
base: base$d,
|
|
979
|
+
normal: normal$4,
|
|
925
980
|
sticky: sticky$1,
|
|
926
981
|
};
|
|
927
982
|
|
|
@@ -1025,10 +1080,10 @@ var PanelPaginationNavigation = function (props) {
|
|
|
1025
1080
|
}
|
|
1026
1081
|
}, [defaultValue]);
|
|
1027
1082
|
var handleGenerateStyle = function () {
|
|
1028
|
-
var result = deepCopyObject(styles$
|
|
1029
|
-
var keys = calculateNestedKeys(styles$
|
|
1083
|
+
var result = deepCopyObject(styles$e.base);
|
|
1084
|
+
var keys = calculateNestedKeys(styles$e.base);
|
|
1030
1085
|
keys.forEach(function (key) {
|
|
1031
|
-
set(result, key, toClassName(get(styles$
|
|
1086
|
+
set(result, key, toClassName(get(styles$e.base, key), get(stylesOverrides, key)));
|
|
1032
1087
|
});
|
|
1033
1088
|
return result;
|
|
1034
1089
|
};
|
|
@@ -1068,7 +1123,7 @@ var PanelPaginationNavigation = function (props) {
|
|
|
1068
1123
|
return (jsxs("div", { className: styles.container, children: [jsxs("div", { className: "flex flex-1 justify-between sm:hidden", children: [jsx("button", { className: toClassName(styles.mobile.button, current === min && styles.button.disabled), disabled: current === min, onClick: function () { return handleChangeCurrent(current - 1); }, children: "Previous" }), jsx("button", { className: toClassName(styles.mobile.button, current === max && styles.button.disabled), disabled: current === max, onClick: function () { return handleChangeCurrent(current + 1); }, children: "Next" })] }), jsxs("div", { className: styles.desktop.container, children: [jsx("div", { children: jsx("div", { className: "text-sm text-gray-700", children: children && children({ min: min, max: max, current: current }) }) }), jsx("div", { children: jsxs("nav", { className: styles.desktop.navigation, "aria-label": "Pagination", children: [jsxs("button", { className: toClassName(styles.desktop.leftButton, current === min && styles.button.disabled), disabled: current === min, onClick: function () { return handleChangeCurrent(current - 1); }, children: [jsx("span", { className: styles.label, children: "Previous" }), jsx(ChevronLeftIcon, { className: styles.icon, "aria-hidden": "true" })] }), component, jsxs("button", { className: toClassName(styles.desktop.rightButton, current === max && styles.button.disabled), disabled: current === max, onClick: function () { return handleChangeCurrent(current + 1); }, children: [jsx("span", { className: styles.label, children: "Next" }), jsx(ChevronRightIcon, { className: styles.icon, "aria-hidden": "true" })] })] }) })] })] }));
|
|
1069
1124
|
};
|
|
1070
1125
|
|
|
1071
|
-
var base$
|
|
1126
|
+
var base$c = {
|
|
1072
1127
|
container: 'flex items-center justify-between border-t border-gray-200 bg-white py-3',
|
|
1073
1128
|
mobile: {
|
|
1074
1129
|
container: '',
|
|
@@ -1089,8 +1144,8 @@ var base$b = {
|
|
|
1089
1144
|
label: 'sr-only',
|
|
1090
1145
|
icon: 'w-5 h-5',
|
|
1091
1146
|
};
|
|
1092
|
-
var styles$
|
|
1093
|
-
base: base$
|
|
1147
|
+
var styles$e = {
|
|
1148
|
+
base: base$c,
|
|
1094
1149
|
};
|
|
1095
1150
|
|
|
1096
1151
|
var TableList = function (props) {
|
|
@@ -1098,10 +1153,10 @@ var TableList = function (props) {
|
|
|
1098
1153
|
var id = props.id, columns = props.columns, data = props.data, page = props.page, children = props.children, defaultOrder = props.defaultOrder, defaultVisibility = props.defaultVisibility, _f = props.type, type = _f === void 0 ? 'normal' : _f, isLoading = props.isLoading, _g = props.isStriped, isStriped = _g === void 0 ? false : _g, _h = props.hasStickyHeader, hasStickyHeader = _h === void 0 ? false : _h, _j = props.hasVerticalSeparators, hasVerticalSeparators = _j === void 0 ? false : _j, _k = props.areControlsVisible, areControlsVisible = _k === void 0 ? true : _k, customControls = props.customControls, _l = props.exportFileName, exportFileName = _l === void 0 ? 'table-export' : _l, stylesOverrides = props.styles, onChange = props.onChange, onPaginate = props.onPaginate;
|
|
1099
1154
|
var _m = useExcel(), generate = _m.generate, write = _m.write;
|
|
1100
1155
|
var handleGenerateStyle = function () {
|
|
1101
|
-
var result = deepCopyObject(styles$
|
|
1102
|
-
var keys = calculateNestedKeys(styles$
|
|
1156
|
+
var result = deepCopyObject(styles$d.base);
|
|
1157
|
+
var keys = calculateNestedKeys(styles$d.base);
|
|
1103
1158
|
keys.forEach(function (key) {
|
|
1104
|
-
set(result, key, toClassName(get(styles$
|
|
1159
|
+
set(result, key, toClassName(get(styles$d.base, key), type && get(styles$d[type], key), hasStickyHeader && get(styles$d.sticky, key), hasVerticalSeparators && get(styles$d.separated, key), areControlsVisible && get(styles$d.controlled, key), get(stylesOverrides, key)));
|
|
1105
1160
|
});
|
|
1106
1161
|
return result;
|
|
1107
1162
|
};
|
|
@@ -1226,7 +1281,7 @@ var TableList = function (props) {
|
|
|
1226
1281
|
: { container: 'mt-4' }, onChange: onPaginate, children: children })] }) }));
|
|
1227
1282
|
};
|
|
1228
1283
|
|
|
1229
|
-
var base$
|
|
1284
|
+
var base$b = {
|
|
1230
1285
|
container: 'px-4 sm:px-6 lg:px-8',
|
|
1231
1286
|
head: {
|
|
1232
1287
|
container: 'sm:flex sm:items-center',
|
|
@@ -1280,7 +1335,7 @@ var base$a = {
|
|
|
1280
1335
|
},
|
|
1281
1336
|
},
|
|
1282
1337
|
};
|
|
1283
|
-
var normal$
|
|
1338
|
+
var normal$3 = {
|
|
1284
1339
|
body: {
|
|
1285
1340
|
content: 'inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8',
|
|
1286
1341
|
styleWrapper: 'relative',
|
|
@@ -1338,9 +1393,9 @@ var controlled = {
|
|
|
1338
1393
|
container: '!flex',
|
|
1339
1394
|
},
|
|
1340
1395
|
};
|
|
1341
|
-
var styles$
|
|
1342
|
-
base: base$
|
|
1343
|
-
normal: normal$
|
|
1396
|
+
var styles$d = {
|
|
1397
|
+
base: base$b,
|
|
1398
|
+
normal: normal$3,
|
|
1344
1399
|
panel: panel$1,
|
|
1345
1400
|
full: full,
|
|
1346
1401
|
sticky: sticky,
|
|
@@ -1357,10 +1412,10 @@ var TableList2 = function (props) {
|
|
|
1357
1412
|
}), columnVisibility = _d[0], setColumnVisibility = _d[1];
|
|
1358
1413
|
var _e = useState([]), columnOrder = _e[0], setColumnOrder = _e[1];
|
|
1359
1414
|
var handleGenerateStyle = function () {
|
|
1360
|
-
var result = deepCopyObject(styles$
|
|
1361
|
-
var keys = calculateNestedKeys(styles$
|
|
1415
|
+
var result = deepCopyObject(styles$c.base);
|
|
1416
|
+
var keys = calculateNestedKeys(styles$c.base);
|
|
1362
1417
|
keys.forEach(function (key) {
|
|
1363
|
-
set(result, key, toClassName(get(styles$
|
|
1418
|
+
set(result, key, toClassName(get(styles$c.base, key),
|
|
1364
1419
|
// type && get(defaultStyles[type], key),
|
|
1365
1420
|
// hasStickyHeader && get(defaultStyles.sticky, key),
|
|
1366
1421
|
// hasVerticalSeparators && get(defaultStyles.separated, key),
|
|
@@ -1452,7 +1507,7 @@ var TableList2 = function (props) {
|
|
|
1452
1507
|
}) }))] }), isLoading && (jsx("div", { className: "flex flex-col gap-y-2 w-full pt-5", children: new Array(8).fill(undefined).map(function (index) { return (jsxs("div", { className: "flex gap-2", children: [jsx("div", { className: "w-20 h-12 rounded-md bg-gray-100 animate-pulse" }), jsx("div", { className: "w-full h-12 rounded-md bg-gray-100 animate-pulse" })] }, index)); }) }))] }) }) }) }), jsx("div", { className: styles.foot, children: foot && foot(state) })] }));
|
|
1453
1508
|
};
|
|
1454
1509
|
|
|
1455
|
-
var base$
|
|
1510
|
+
var base$a = {
|
|
1456
1511
|
container: '',
|
|
1457
1512
|
head: '',
|
|
1458
1513
|
body: {
|
|
@@ -1487,8 +1542,8 @@ var base$9 = {
|
|
|
1487
1542
|
},
|
|
1488
1543
|
},
|
|
1489
1544
|
};
|
|
1490
|
-
var styles$
|
|
1491
|
-
base: base$
|
|
1545
|
+
var styles$c = {
|
|
1546
|
+
base: base$a,
|
|
1492
1547
|
};
|
|
1493
1548
|
|
|
1494
1549
|
var createColumnHelper = function () {
|
|
@@ -1498,10 +1553,10 @@ var createColumnHelper = function () {
|
|
|
1498
1553
|
var BreadcrumbsNavigation = function (props) {
|
|
1499
1554
|
var _a = props.href, href = _a === void 0 ? '/' : _a, pages = props.pages, _b = props.type, type = _b === void 0 ? 'slashes' : _b, customSeparator = props.separator, stylesOverrides = props.styles;
|
|
1500
1555
|
var handleGenerateStyle = function () {
|
|
1501
|
-
var result = deepCopyObject(styles$
|
|
1502
|
-
var keys = calculateNestedKeys(styles$
|
|
1556
|
+
var result = deepCopyObject(styles$b.base);
|
|
1557
|
+
var keys = calculateNestedKeys(styles$b.base);
|
|
1503
1558
|
keys.forEach(function (key) {
|
|
1504
|
-
set$1(result, key, toClassName(get$1(styles$
|
|
1559
|
+
set$1(result, key, toClassName(get$1(styles$b.base, key), type && get$1(styles$b[type], key), get$1(stylesOverrides, key)));
|
|
1505
1560
|
});
|
|
1506
1561
|
return result;
|
|
1507
1562
|
};
|
|
@@ -1537,7 +1592,7 @@ var BreadcrumbsNavigation = function (props) {
|
|
|
1537
1592
|
return (jsx("nav", { className: styles.container, "aria-label": "Breadcrumb", children: jsxs("ol", { className: styles.list, children: [jsx(HomeLink, {}), pages === null || pages === void 0 ? void 0 : pages.map(function (page) { return jsx(PageLink, { page: page }, page.name); })] }) }));
|
|
1538
1593
|
};
|
|
1539
1594
|
|
|
1540
|
-
var base$
|
|
1595
|
+
var base$9 = {
|
|
1541
1596
|
container: 'flex',
|
|
1542
1597
|
list: 'flex',
|
|
1543
1598
|
separator: '',
|
|
@@ -1622,8 +1677,8 @@ var bar = {
|
|
|
1622
1677
|
link: '',
|
|
1623
1678
|
},
|
|
1624
1679
|
};
|
|
1625
|
-
var styles$
|
|
1626
|
-
base: base$
|
|
1680
|
+
var styles$b = {
|
|
1681
|
+
base: base$9,
|
|
1627
1682
|
slashes: slashes,
|
|
1628
1683
|
chevrons: chevrons,
|
|
1629
1684
|
panel: panel,
|
|
@@ -1634,10 +1689,10 @@ var PagePaginationNavigation = function (props) {
|
|
|
1634
1689
|
var _a = props.min, min = _a === void 0 ? 1 : _a, _b = props.max, max = _b === void 0 ? 20 : _b, stylesOverrides = props.styles, onChange = props.onChange;
|
|
1635
1690
|
var _c = useState(2), current = _c[0], setCurrent = _c[1];
|
|
1636
1691
|
var handleGenerateStyle = function () {
|
|
1637
|
-
var result = deepCopyObject(styles$
|
|
1638
|
-
var keys = calculateNestedKeys(styles$
|
|
1692
|
+
var result = deepCopyObject(styles$a.base);
|
|
1693
|
+
var keys = calculateNestedKeys(styles$a.base);
|
|
1639
1694
|
keys.forEach(function (key) {
|
|
1640
|
-
set(result, key, toClassName(get(styles$
|
|
1695
|
+
set(result, key, toClassName(get(styles$a.base, key), get(stylesOverrides, key)));
|
|
1641
1696
|
});
|
|
1642
1697
|
return result;
|
|
1643
1698
|
};
|
|
@@ -1672,7 +1727,7 @@ var PagePaginationNavigation = function (props) {
|
|
|
1672
1727
|
return (jsxs("nav", { className: styles.container, children: [jsx("div", { className: styles.left.container, children: jsxs("button", { className: toClassName(styles.left.button, current === min && styles.button.disabled), disabled: current === min, onClick: function () { return setCurrent(current - 1); }, children: [jsx(ArrowLongLeftIcon, { className: styles.left.icon }), "Previous"] }) }), jsx("div", { className: styles.center.container, children: component }), jsx("div", { className: styles.right.container, children: jsxs("button", { className: toClassName(styles.right.button, current === max && styles.button.disabled), disabled: current === max, onClick: function () { return setCurrent(current + 1); }, children: ["Next", jsx(ArrowLongRightIcon, { className: styles.right.icon })] }) })] }));
|
|
1673
1728
|
};
|
|
1674
1729
|
|
|
1675
|
-
var base$
|
|
1730
|
+
var base$8 = {
|
|
1676
1731
|
container: 'flex items-center justify-between border-t border-gray-200 px-4 sm:px-0',
|
|
1677
1732
|
left: {
|
|
1678
1733
|
container: '-mt-px flex w-0 flex-1',
|
|
@@ -1694,18 +1749,18 @@ var base$7 = {
|
|
|
1694
1749
|
},
|
|
1695
1750
|
divider: 'inline-flex items-center border-t-2 border-transparent px-4 pt-4 text-sm font-medium text-gray-500',
|
|
1696
1751
|
};
|
|
1697
|
-
var styles$
|
|
1698
|
-
base: base$
|
|
1752
|
+
var styles$a = {
|
|
1753
|
+
base: base$8,
|
|
1699
1754
|
};
|
|
1700
1755
|
|
|
1701
1756
|
var Container$1 = function (props) {
|
|
1702
1757
|
var children = props.children, stylesOverrides = props.styles;
|
|
1703
1758
|
var _a = useState(''), active = _a[0], setActive = _a[1];
|
|
1704
1759
|
var handleGenerateStyle = function () {
|
|
1705
|
-
var result = deepCopyObject(styles$
|
|
1706
|
-
var keys = calculateNestedKeys(styles$
|
|
1760
|
+
var result = deepCopyObject(styles$9.base);
|
|
1761
|
+
var keys = calculateNestedKeys(styles$9.base);
|
|
1707
1762
|
keys.forEach(function (key) {
|
|
1708
|
-
set(result, key, toClassName(get(styles$
|
|
1763
|
+
set(result, key, toClassName(get(styles$9.base, key), get(stylesOverrides, key)));
|
|
1709
1764
|
});
|
|
1710
1765
|
return result;
|
|
1711
1766
|
};
|
|
@@ -1715,10 +1770,10 @@ var Container$1 = function (props) {
|
|
|
1715
1770
|
var List$1 = function (props) {
|
|
1716
1771
|
var name = props.name, children = props.children, active = props.active, setActive = props.setActive, stylesOverrides = props.styles;
|
|
1717
1772
|
var handleGenerateStyle = function () {
|
|
1718
|
-
var result = deepCopyObject(styles$
|
|
1719
|
-
var keys = calculateNestedKeys(styles$
|
|
1773
|
+
var result = deepCopyObject(styles$9.base);
|
|
1774
|
+
var keys = calculateNestedKeys(styles$9.base);
|
|
1720
1775
|
keys.forEach(function (key) {
|
|
1721
|
-
set(result, key, toClassName(get(styles$
|
|
1776
|
+
set(result, key, toClassName(get(styles$9.base, key), get(stylesOverrides, key)));
|
|
1722
1777
|
});
|
|
1723
1778
|
return result;
|
|
1724
1779
|
};
|
|
@@ -1764,10 +1819,10 @@ var List$1 = function (props) {
|
|
|
1764
1819
|
var Item$1 = function (props) {
|
|
1765
1820
|
var children = props.children, _a = props.as, LinkComponent = _a === void 0 ? 'a' : _a, _b = props.type, type = _b === void 0 ? 'underline' : _b, href = props.href, isCurrent = props.isCurrent, onClick = props.onClick, stylesOverrides = props.styles, isLoading = props.isLoading;
|
|
1766
1821
|
var handleGenerateStyle = function () {
|
|
1767
|
-
var result = deepCopyObject(styles$
|
|
1768
|
-
var keys = calculateNestedKeys(styles$
|
|
1822
|
+
var result = deepCopyObject(styles$9.base);
|
|
1823
|
+
var keys = calculateNestedKeys(styles$9.base);
|
|
1769
1824
|
keys.forEach(function (key) {
|
|
1770
|
-
set(result, key, toClassName(get(styles$
|
|
1825
|
+
set(result, key, toClassName(get(styles$9.base, key), type && get(styles$9[type], key), get(stylesOverrides, key)));
|
|
1771
1826
|
});
|
|
1772
1827
|
return result;
|
|
1773
1828
|
};
|
|
@@ -1788,7 +1843,7 @@ var TabNavigation = {
|
|
|
1788
1843
|
View: View$1,
|
|
1789
1844
|
};
|
|
1790
1845
|
|
|
1791
|
-
var base$
|
|
1846
|
+
var base$7 = {
|
|
1792
1847
|
container: '',
|
|
1793
1848
|
list: {
|
|
1794
1849
|
container: '',
|
|
@@ -1825,8 +1880,8 @@ var buttons = {
|
|
|
1825
1880
|
inactive: 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300',
|
|
1826
1881
|
},
|
|
1827
1882
|
};
|
|
1828
|
-
var styles$
|
|
1829
|
-
base: base$
|
|
1883
|
+
var styles$9 = {
|
|
1884
|
+
base: base$7,
|
|
1830
1885
|
underline: underline,
|
|
1831
1886
|
pills: pills,
|
|
1832
1887
|
buttons: buttons,
|
|
@@ -1853,11 +1908,11 @@ var List = function (props) {
|
|
|
1853
1908
|
setActive && setActive(tab === null || tab === void 0 ? void 0 : tab.props.accessor);
|
|
1854
1909
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1855
1910
|
}, []);
|
|
1856
|
-
return (jsx("nav", { className: toClassName(styles$
|
|
1911
|
+
return (jsx("nav", { className: toClassName(styles$8.list, stylesOverrides === null || stylesOverrides === void 0 ? void 0 : stylesOverrides.list), children: children }));
|
|
1857
1912
|
};
|
|
1858
1913
|
var Item = function (props) {
|
|
1859
1914
|
var children = props.children, href = props.href, isCurrent = props.isCurrent, _a = props.linkComponent, LinkComponent = _a === void 0 ? 'a' : _a, onClick = props.onClick;
|
|
1860
|
-
return (jsx(LinkComponent, { href: href, className: toClassName(styles$
|
|
1915
|
+
return (jsx(LinkComponent, { href: href, className: toClassName(styles$8.item[isCurrent ? 'active' : 'notActive'], styles$8.item.base), onClick: onClick, children: children }));
|
|
1861
1916
|
};
|
|
1862
1917
|
var View = function (props) {
|
|
1863
1918
|
var children = props.children;
|
|
@@ -1870,7 +1925,7 @@ var VerticalNavigation = {
|
|
|
1870
1925
|
View: View,
|
|
1871
1926
|
};
|
|
1872
1927
|
|
|
1873
|
-
var styles$
|
|
1928
|
+
var styles$8 = {
|
|
1874
1929
|
container: '',
|
|
1875
1930
|
list: 'space-y-1',
|
|
1876
1931
|
item: {
|
|
@@ -1888,10 +1943,10 @@ var ModalOverlay = function (props) {
|
|
|
1888
1943
|
handleClose: function () { return setIsOpen(false); },
|
|
1889
1944
|
}); }, []);
|
|
1890
1945
|
var handleGenerateStyle = function () {
|
|
1891
|
-
var result = deepCopyObject(styles$
|
|
1892
|
-
var keys = calculateNestedKeys(styles$
|
|
1946
|
+
var result = deepCopyObject(styles$7.base);
|
|
1947
|
+
var keys = calculateNestedKeys(styles$7.base);
|
|
1893
1948
|
keys.forEach(function (key) {
|
|
1894
|
-
set(result, key, toClassName(get(styles$
|
|
1949
|
+
set(result, key, toClassName(get(styles$7.base, key), size && get(styles$7[size], key), get(stylesOverrides, key)));
|
|
1895
1950
|
});
|
|
1896
1951
|
return result;
|
|
1897
1952
|
};
|
|
@@ -1909,7 +1964,7 @@ var ModalOverlay = function (props) {
|
|
|
1909
1964
|
return (jsxs(Fragment$1, { children: [jsx(Transition.Root, { show: isOpen, as: Fragment, children: jsxs(Dialog, { as: "div", className: styles.container, onClose: setIsOpen, children: [jsx(Transition.Child, { as: Fragment, enter: styles.background.transition.enter, enterFrom: styles.background.transition.enterFrom, enterTo: styles.background.transition.enterTo, leave: styles.background.transition.leave, leaveFrom: styles.background.transition.leaveFrom, leaveTo: styles.background.transition.leaveTo, children: jsx("div", { className: styles.background.container }) }), jsx("div", { className: styles.layout.container, children: jsx("div", { className: styles.layout.content, children: jsx(Transition.Child, { as: Fragment, enter: styles.panel.transition.enter, enterFrom: styles.panel.transition.enterFrom, enterTo: styles.panel.transition.enterTo, leave: styles.panel.transition.leave, leaveFrom: styles.panel.transition.leaveFrom, leaveTo: styles.panel.transition.leaveTo, children: jsx(Dialog.Panel, { className: styles.panel.container, children: children(options) }) }) }) })] }) }), trigger && trigger(options)] }));
|
|
1910
1965
|
};
|
|
1911
1966
|
|
|
1912
|
-
var base$
|
|
1967
|
+
var base$6 = {
|
|
1913
1968
|
container: 'relative z-20',
|
|
1914
1969
|
background: {
|
|
1915
1970
|
container: 'fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity',
|
|
@@ -1963,8 +2018,8 @@ var xl$2 = {
|
|
|
1963
2018
|
container: 'sm:max-w-4xl',
|
|
1964
2019
|
},
|
|
1965
2020
|
};
|
|
1966
|
-
var styles$
|
|
1967
|
-
base: base$
|
|
2021
|
+
var styles$7 = {
|
|
2022
|
+
base: base$6,
|
|
1968
2023
|
xs: xs$2,
|
|
1969
2024
|
sm: sm$2,
|
|
1970
2025
|
md: md$2,
|
|
@@ -1975,10 +2030,10 @@ var styles$6 = {
|
|
|
1975
2030
|
var NotificationOverlayContainer = function (_a) {
|
|
1976
2031
|
var children = _a.children, stylesOverrides = _a.styles;
|
|
1977
2032
|
var handleGenerateStyle = function () {
|
|
1978
|
-
var result = deepCopyObject(styles$
|
|
1979
|
-
var keys = calculateNestedKeys(styles$
|
|
2033
|
+
var result = deepCopyObject(styles$6.base);
|
|
2034
|
+
var keys = calculateNestedKeys(styles$6.base);
|
|
1980
2035
|
keys.forEach(function (key) {
|
|
1981
|
-
set(result, key, toClassName(get(styles$
|
|
2036
|
+
set(result, key, toClassName(get(styles$6.base, key), get(stylesOverrides, key)));
|
|
1982
2037
|
});
|
|
1983
2038
|
return result;
|
|
1984
2039
|
};
|
|
@@ -1993,10 +2048,10 @@ var NotificationOverlayItem = function (props) {
|
|
|
1993
2048
|
onClose: function () { return setIsOpen(false); },
|
|
1994
2049
|
}); }, []);
|
|
1995
2050
|
var handleGenerateStyle = function () {
|
|
1996
|
-
var result = deepCopyObject(styles$
|
|
1997
|
-
var keys = calculateNestedKeys(styles$
|
|
2051
|
+
var result = deepCopyObject(styles$6.base);
|
|
2052
|
+
var keys = calculateNestedKeys(styles$6.base);
|
|
1998
2053
|
keys.forEach(function (key) {
|
|
1999
|
-
set(result, key, toClassName(get(styles$
|
|
2054
|
+
set(result, key, toClassName(get(styles$6.base, key), size && get(styles$6[size], key), get(stylesOverrides, key)));
|
|
2000
2055
|
});
|
|
2001
2056
|
return result;
|
|
2002
2057
|
};
|
|
@@ -2008,7 +2063,7 @@ var NotificationOverlay = {
|
|
|
2008
2063
|
Item: NotificationOverlayItem,
|
|
2009
2064
|
};
|
|
2010
2065
|
|
|
2011
|
-
var base$
|
|
2066
|
+
var base$5 = {
|
|
2012
2067
|
container: {
|
|
2013
2068
|
outer: 'pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6 z-30',
|
|
2014
2069
|
inner: 'flex w-full flex-col items-center space-y-4 sm:items-end',
|
|
@@ -2068,8 +2123,8 @@ var xl$1 = {
|
|
|
2068
2123
|
},
|
|
2069
2124
|
},
|
|
2070
2125
|
};
|
|
2071
|
-
var styles$
|
|
2072
|
-
base: base$
|
|
2126
|
+
var styles$6 = {
|
|
2127
|
+
base: base$5,
|
|
2073
2128
|
xs: xs$1,
|
|
2074
2129
|
sm: sm$1,
|
|
2075
2130
|
md: md$1,
|
|
@@ -2085,10 +2140,10 @@ var SlideOverOverlay = function (props) {
|
|
|
2085
2140
|
handleClose: function () { return setIsOpen(false); },
|
|
2086
2141
|
}); }, []);
|
|
2087
2142
|
var handleGenerateStyle = function () {
|
|
2088
|
-
var result = deepCopyObject(styles$
|
|
2089
|
-
var keys = calculateNestedKeys(styles$
|
|
2143
|
+
var result = deepCopyObject(styles$5.base);
|
|
2144
|
+
var keys = calculateNestedKeys(styles$5.base);
|
|
2090
2145
|
keys.forEach(function (key) {
|
|
2091
|
-
set(result, key, toClassName(get(styles$
|
|
2146
|
+
set(result, key, toClassName(get(styles$5.base, key), size && get(styles$5[size], key), get(stylesOverrides, key)));
|
|
2092
2147
|
});
|
|
2093
2148
|
return result;
|
|
2094
2149
|
};
|
|
@@ -2096,7 +2151,7 @@ var SlideOverOverlay = function (props) {
|
|
|
2096
2151
|
return (jsxs(Fragment$1, { children: [jsx(Transition.Root, { show: isOpen, as: Fragment, children: jsxs(Dialog, { as: "div", className: styles.container, onClose: setIsOpen, children: [jsx(Transition.Child, { as: Fragment, enter: styles.background.transition.enter, enterFrom: styles.background.transition.enterFrom, enterTo: styles.background.transition.enterTo, leave: styles.background.transition.leave, leaveFrom: styles.background.transition.leaveFrom, leaveTo: styles.background.transition.leaveTo, children: jsx("div", { className: styles.background.container }) }), jsx("div", { className: styles.layout.container, children: jsx("div", { className: styles.layout.content, children: jsx("div", { className: styles.layout.inner, children: jsx(Transition.Child, { as: Fragment, enter: styles.panel.transition.enter, enterFrom: styles.panel.transition.enterFrom, enterTo: styles.panel.transition.enterTo, leave: styles.panel.transition.leave, leaveFrom: styles.panel.transition.leaveFrom, leaveTo: styles.panel.transition.leaveTo, children: jsx(Dialog.Panel, { className: styles.panel.container, children: children(options) }) }) }) }) })] }) }), trigger && trigger(options)] }));
|
|
2097
2152
|
};
|
|
2098
2153
|
|
|
2099
|
-
var base$
|
|
2154
|
+
var base$4 = {
|
|
2100
2155
|
container: 'relative z-20',
|
|
2101
2156
|
background: {
|
|
2102
2157
|
container: 'fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity',
|
|
@@ -2151,8 +2206,8 @@ var xl = {
|
|
|
2151
2206
|
container: 'sm:max-w-4xl',
|
|
2152
2207
|
},
|
|
2153
2208
|
};
|
|
2154
|
-
var styles$
|
|
2155
|
-
base: base$
|
|
2209
|
+
var styles$5 = {
|
|
2210
|
+
base: base$4,
|
|
2156
2211
|
xs: xs,
|
|
2157
2212
|
sm: sm,
|
|
2158
2213
|
md: md,
|
|
@@ -2173,17 +2228,17 @@ var TableColumnOptionsCustom = function (props) {
|
|
|
2173
2228
|
ids.splice(location, 0, column.id);
|
|
2174
2229
|
setColumnOrder(ids);
|
|
2175
2230
|
}, []);
|
|
2176
|
-
return (jsx(DropdownElement.Container, { trigger: trigger, children: jsx("div", { className: styles$
|
|
2231
|
+
return (jsx(DropdownElement.Container, { trigger: trigger, children: jsx("div", { className: styles$4.controls.content, children: table.getAllLeafColumns().map(function (column, index) {
|
|
2177
2232
|
var canSort = column === null || column === void 0 ? void 0 : column.getCanSort();
|
|
2178
|
-
return (jsx(DropdownElement.Item, { children: function () { return (jsxs("div", { className: toClassName(styles$
|
|
2233
|
+
return (jsx(DropdownElement.Item, { children: function () { return (jsxs("div", { className: toClassName(styles$4.controls.dropdown.container, !canSort && 'hidden'), children: [jsx("input", { className: styles$4.controls.dropdown.input, type: "checkbox", checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler() }), jsx("label", { className: styles$4.controls.dropdown.label, children: column.columnDef.header }), jsxs("div", { className: styles$4.controls.dropdown.actions, children: [jsx(ChevronDownIcon$1, { className: styles$4.controls.dropdown.upIcon, onClick: function () {
|
|
2179
2234
|
return handleUpdateColumnOrder(table, column, index - 1, setColumnOrder);
|
|
2180
|
-
} }), jsx(ChevronDownIcon$1, { className: styles$
|
|
2235
|
+
} }), jsx(ChevronDownIcon$1, { className: styles$4.controls.dropdown.downIcon, onClick: function () {
|
|
2181
2236
|
return handleUpdateColumnOrder(table, column, index + 1, setColumnOrder);
|
|
2182
2237
|
} })] })] })); } }, column.id));
|
|
2183
2238
|
}) }) }));
|
|
2184
2239
|
};
|
|
2185
2240
|
|
|
2186
|
-
var styles$
|
|
2241
|
+
var styles$4 = {
|
|
2187
2242
|
container: '',
|
|
2188
2243
|
controls: {
|
|
2189
2244
|
container: 'flex-row justify-between z-10 relative mb-4 gap-2 hidden',
|
|
@@ -2220,10 +2275,10 @@ var SelectMenuForm = function (props) {
|
|
|
2220
2275
|
var _k = useState(value !== null && value !== void 0 ? value : null), state = _k[0], setState = _k[1];
|
|
2221
2276
|
var isValid = error === undefined;
|
|
2222
2277
|
var handleGenerateStyle = function () {
|
|
2223
|
-
var result = deepCopyObject(styles$
|
|
2224
|
-
var keys = calculateNestedKeys(styles$
|
|
2278
|
+
var result = deepCopyObject(styles$3.base);
|
|
2279
|
+
var keys = calculateNestedKeys(styles$3.base);
|
|
2225
2280
|
keys.forEach(function (key) {
|
|
2226
|
-
set(result, key, toClassName(get(styles$
|
|
2281
|
+
set(result, key, toClassName(get(styles$3.base, key), get(styles$3['normal'], key), isTouched === true && !isValid && get(styles$3.invalid, key), isDisabled && get(styles$3.disabled, key), get(stylesOverrides, key)));
|
|
2227
2282
|
});
|
|
2228
2283
|
return result;
|
|
2229
2284
|
};
|
|
@@ -2280,7 +2335,7 @@ var SelectMenuForm = function (props) {
|
|
|
2280
2335
|
} }), !isSolo && (jsxs("div", { className: styles.foot, children: [description && !(error && isTouched) && (jsx("p", { className: styles.description, children: description })), error && isTouched && (jsx("p", { className: styles.error, children: JSON.stringify(error).replaceAll('"', '') }))] }))] })] }));
|
|
2281
2336
|
};
|
|
2282
2337
|
|
|
2283
|
-
var base$
|
|
2338
|
+
var base$3 = {
|
|
2284
2339
|
container: '',
|
|
2285
2340
|
head: 'flex justify-between',
|
|
2286
2341
|
body: 'relative rounded-md',
|
|
@@ -2308,11 +2363,11 @@ var base$2 = {
|
|
|
2308
2363
|
description: 'text-gray-400 text-xs mt-1',
|
|
2309
2364
|
error: 'text-red-500 text-xs ml-5 mt-1',
|
|
2310
2365
|
};
|
|
2311
|
-
var leading$
|
|
2366
|
+
var leading$2 = {
|
|
2312
2367
|
input: 'pl-10',
|
|
2313
2368
|
};
|
|
2314
|
-
var trailing$
|
|
2315
|
-
var normal$
|
|
2369
|
+
var trailing$2 = {};
|
|
2370
|
+
var normal$2 = {
|
|
2316
2371
|
label: 'leading-6 text-sm mb-2',
|
|
2317
2372
|
hint: 'leading-6',
|
|
2318
2373
|
leading: 'pl-3',
|
|
@@ -2320,14 +2375,14 @@ var normal$1 = {
|
|
|
2320
2375
|
trailing: '',
|
|
2321
2376
|
description: 'mt-2 text-sm',
|
|
2322
2377
|
};
|
|
2323
|
-
var inset$
|
|
2378
|
+
var inset$2 = {
|
|
2324
2379
|
container: 'rounded-md px-3 pt-2.5 pb-1.5 shadow-sm ring-1 ring-inset ring-gray-300 focus-within:ring-2 focus-within:ring-primary-600',
|
|
2325
2380
|
label: 'text-xs',
|
|
2326
2381
|
hint: 'text-xs',
|
|
2327
2382
|
input: 'border-0 !ring-0 p-0 text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm pl-0',
|
|
2328
2383
|
description: 'hidden',
|
|
2329
2384
|
};
|
|
2330
|
-
var overlapping$
|
|
2385
|
+
var overlapping$2 = {
|
|
2331
2386
|
container: 'relative',
|
|
2332
2387
|
head: ' absolute flex justify-between items-center left-0 -top-2 right-0 mx-2 z-10 w-full',
|
|
2333
2388
|
label: 'inline-block bg-white px-1 text-xs font-medium text-gray-900 ',
|
|
@@ -2335,40 +2390,40 @@ var overlapping$1 = {
|
|
|
2335
2390
|
input: 'block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6',
|
|
2336
2391
|
description: 'hidden',
|
|
2337
2392
|
};
|
|
2338
|
-
var pill$
|
|
2393
|
+
var pill$2 = {
|
|
2339
2394
|
head: 'mx-px block px-4 text-sm font-medium leading-6 text-gray-900 mb-1 pr-6',
|
|
2340
2395
|
foot: 'mx-px block px-4 text-sm font-medium leading-6 text-gray-900 mt-1 pr-6',
|
|
2341
2396
|
input: 'block w-full rounded-full border-0 px-4 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6',
|
|
2342
2397
|
trailing: 'pr-2',
|
|
2343
2398
|
description: 'text-xs',
|
|
2344
2399
|
};
|
|
2345
|
-
var floored$
|
|
2400
|
+
var floored$2 = {
|
|
2346
2401
|
body: 'relative mt-2',
|
|
2347
2402
|
label: 'block text-sm font-medium leading-6 text-gray-900',
|
|
2348
2403
|
input: 'peer block w-full border-0 bg-gray-50 py-1.5 text-gray-900 focus:ring-0 sm:text-sm sm:leading-6 ring-0',
|
|
2349
2404
|
description: 'text-xs mt-2',
|
|
2350
2405
|
};
|
|
2351
|
-
var invalid$
|
|
2406
|
+
var invalid$2 = {
|
|
2352
2407
|
container: 'ring-red-500',
|
|
2353
2408
|
input:
|
|
2354
2409
|
// 'block w-full border border-transparent text-red-900 ring-1 ring-inset ring-red-300 placeholder:text-red-300 focus:ring-2 focus:ring-inset focus:ring-red-500 sm:leading-6 pr-10',
|
|
2355
2410
|
'block w-full border border-transparent text-red-900 ring-1 ring-inset ring-red-300 placeholder:text-red-300 focus:ring-2 focus:ring-inset focus:ring-red-500',
|
|
2356
2411
|
description: 'text-sm text-red-600',
|
|
2357
2412
|
};
|
|
2358
|
-
var disabled$
|
|
2413
|
+
var disabled$3 = {
|
|
2359
2414
|
input: 'block w-full rounded-md border-0 text-gray-900 shadow-sm ring-1 ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 cursor-not-allowed bg-gray-50 text-gray-500 ring-gray-200',
|
|
2360
2415
|
};
|
|
2361
|
-
var styles$
|
|
2362
|
-
base: base$
|
|
2363
|
-
leading: leading$
|
|
2364
|
-
trailing: trailing$
|
|
2365
|
-
normal: normal$
|
|
2366
|
-
inset: inset$
|
|
2367
|
-
overlapping: overlapping$
|
|
2368
|
-
pill: pill$
|
|
2369
|
-
floored: floored$
|
|
2370
|
-
invalid: invalid$
|
|
2371
|
-
disabled: disabled$
|
|
2416
|
+
var styles$3 = {
|
|
2417
|
+
base: base$3,
|
|
2418
|
+
leading: leading$2,
|
|
2419
|
+
trailing: trailing$2,
|
|
2420
|
+
normal: normal$2,
|
|
2421
|
+
inset: inset$2,
|
|
2422
|
+
overlapping: overlapping$2,
|
|
2423
|
+
pill: pill$2,
|
|
2424
|
+
floored: floored$2,
|
|
2425
|
+
invalid: invalid$2,
|
|
2426
|
+
disabled: disabled$3,
|
|
2372
2427
|
};
|
|
2373
2428
|
|
|
2374
2429
|
var DateMenuForm = function (props) {
|
|
@@ -2388,10 +2443,10 @@ var DateMenuForm = function (props) {
|
|
|
2388
2443
|
setIsFocus(false);
|
|
2389
2444
|
};
|
|
2390
2445
|
var handleGenerateStyle = function () {
|
|
2391
|
-
var result = deepCopyObject(styles$
|
|
2392
|
-
var keys = calculateNestedKeys(styles$
|
|
2446
|
+
var result = deepCopyObject(styles$2.base);
|
|
2447
|
+
var keys = calculateNestedKeys(styles$2.base);
|
|
2393
2448
|
keys.forEach(function (key) {
|
|
2394
|
-
set(result, key, toClassName(get(styles$
|
|
2449
|
+
set(result, key, toClassName(get(styles$2.base, key), type && get(styles$2[type], key), isTouched === true && !isValid && get(styles$2.invalid, key), isDisabled && get(styles$2.disabled, key), get(stylesOverrides, key)));
|
|
2395
2450
|
});
|
|
2396
2451
|
return result;
|
|
2397
2452
|
};
|
|
@@ -2421,7 +2476,7 @@ var DateMenuForm = function (props) {
|
|
|
2421
2476
|
: (_a = error === null || error === void 0 ? void 0 : error.startDate) !== null && _a !== void 0 ? _a : error === null || error === void 0 ? void 0 : error.endDate }))] }))] })] }));
|
|
2422
2477
|
};
|
|
2423
2478
|
|
|
2424
|
-
var base$
|
|
2479
|
+
var base$2 = {
|
|
2425
2480
|
container: '',
|
|
2426
2481
|
head: 'flex justify-between',
|
|
2427
2482
|
body: 'relative rounded-md',
|
|
@@ -2434,11 +2489,11 @@ var base$1 = {
|
|
|
2434
2489
|
description: 'text-gray-400 text-xs mt-1',
|
|
2435
2490
|
error: 'text-red-500 text-xs ml-5 mt-1',
|
|
2436
2491
|
};
|
|
2437
|
-
var leading = {
|
|
2492
|
+
var leading$1 = {
|
|
2438
2493
|
input: 'pl-10',
|
|
2439
2494
|
};
|
|
2440
|
-
var trailing = {};
|
|
2441
|
-
var normal = {
|
|
2495
|
+
var trailing$1 = {};
|
|
2496
|
+
var normal$1 = {
|
|
2442
2497
|
label: 'leading-6 text-sm mb-2',
|
|
2443
2498
|
hint: 'leading-6',
|
|
2444
2499
|
leading: 'pl-3',
|
|
@@ -2446,14 +2501,14 @@ var normal = {
|
|
|
2446
2501
|
trailing: 'pr-3',
|
|
2447
2502
|
description: 'mt-2 text-sm',
|
|
2448
2503
|
};
|
|
2449
|
-
var inset = {
|
|
2504
|
+
var inset$1 = {
|
|
2450
2505
|
container: 'rounded-md px-3 pt-2.5 pb-1.5 shadow-sm ring-1 ring-inset ring-gray-300 focus-within:ring-2 focus-within:ring-primary-600',
|
|
2451
2506
|
label: 'text-xs',
|
|
2452
2507
|
hint: 'text-xs',
|
|
2453
2508
|
input: 'border-0 !ring-0 p-0 text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm pl-0',
|
|
2454
2509
|
description: 'hidden',
|
|
2455
2510
|
};
|
|
2456
|
-
var overlapping = {
|
|
2511
|
+
var overlapping$1 = {
|
|
2457
2512
|
container: 'relative',
|
|
2458
2513
|
head: ' absolute flex justify-between items-center left-0 -top-2 right-0 mx-2 z-10 w-full',
|
|
2459
2514
|
label: 'inline-block bg-white px-1 text-xs font-medium text-gray-900 ',
|
|
@@ -2461,58 +2516,58 @@ var overlapping = {
|
|
|
2461
2516
|
input: 'block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6',
|
|
2462
2517
|
description: 'hidden',
|
|
2463
2518
|
};
|
|
2464
|
-
var pill = {
|
|
2519
|
+
var pill$1 = {
|
|
2465
2520
|
head: 'mx-px block px-4 text-sm font-medium leading-6 text-gray-900 mb-1 pr-6',
|
|
2466
2521
|
foot: 'mx-px block px-4 text-sm font-medium leading-6 text-gray-900 mt-1 pr-6',
|
|
2467
2522
|
input: 'block w-full rounded-full border-0 px-4 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6',
|
|
2468
2523
|
trailing: 'pr-2',
|
|
2469
2524
|
description: 'text-xs',
|
|
2470
2525
|
};
|
|
2471
|
-
var floored = {
|
|
2526
|
+
var floored$1 = {
|
|
2472
2527
|
body: 'relative mt-2',
|
|
2473
2528
|
label: 'block text-sm font-medium leading-6 text-gray-900',
|
|
2474
2529
|
input: 'peer block w-full border-0 bg-gray-50 py-1.5 text-gray-900 focus:ring-0 sm:text-sm sm:leading-6 ring-0',
|
|
2475
2530
|
description: 'text-xs mt-2',
|
|
2476
2531
|
};
|
|
2477
|
-
var invalid = {
|
|
2532
|
+
var invalid$1 = {
|
|
2478
2533
|
container: '!ring-red-500',
|
|
2479
2534
|
input:
|
|
2480
2535
|
// 'block w-full border border-transparent text-red-900 ring-1 ring-inset ring-red-300 placeholder:text-red-300 focus:ring-2 focus:ring-inset focus:ring-red-500 sm:leading-6 pr-10',
|
|
2481
2536
|
'block w-full border border-transparent text-red-900 ring-1 ring-inset ring-red-300 placeholder:text-red-300 focus:ring-2 focus:ring-inset focus:ring-red-500 pr-10',
|
|
2482
2537
|
description: 'text-sm text-red-600',
|
|
2483
2538
|
};
|
|
2484
|
-
var disabled$
|
|
2539
|
+
var disabled$2 = {
|
|
2485
2540
|
input: 'block w-full rounded-md border-0 text-gray-900 shadow-sm ring-1 ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-500 disabled:ring-gray-200',
|
|
2486
2541
|
};
|
|
2487
|
-
var styles$
|
|
2488
|
-
base: base$
|
|
2489
|
-
leading: leading,
|
|
2490
|
-
trailing: trailing,
|
|
2491
|
-
normal: normal,
|
|
2492
|
-
inset: inset,
|
|
2493
|
-
overlapping: overlapping,
|
|
2494
|
-
pill: pill,
|
|
2495
|
-
floored: floored,
|
|
2496
|
-
invalid: invalid,
|
|
2497
|
-
disabled: disabled$
|
|
2542
|
+
var styles$2 = {
|
|
2543
|
+
base: base$2,
|
|
2544
|
+
leading: leading$1,
|
|
2545
|
+
trailing: trailing$1,
|
|
2546
|
+
normal: normal$1,
|
|
2547
|
+
inset: inset$1,
|
|
2548
|
+
overlapping: overlapping$1,
|
|
2549
|
+
pill: pill$1,
|
|
2550
|
+
floored: floored$1,
|
|
2551
|
+
invalid: invalid$1,
|
|
2552
|
+
disabled: disabled$2,
|
|
2498
2553
|
};
|
|
2499
2554
|
|
|
2500
2555
|
var CheckboxInputGroupForm = function (props) {
|
|
2501
2556
|
var name = props.name, form = props.form, options = props.options, values = props.values, isDisabled = props.isDisabled, stylesOverrides = props.styles;
|
|
2502
2557
|
var handleGenerateStyle = function () {
|
|
2503
|
-
var result = deepCopyObject(styles.base);
|
|
2504
|
-
var keys = calculateNestedKeys(styles.base);
|
|
2558
|
+
var result = deepCopyObject(styles$1.base);
|
|
2559
|
+
var keys = calculateNestedKeys(styles$1.base);
|
|
2505
2560
|
keys.forEach(function (key) {
|
|
2506
|
-
set(result, key, toClassName(get(styles.base, key),
|
|
2561
|
+
set(result, key, toClassName(get(styles$1.base, key),
|
|
2507
2562
|
// isTouched === true && !isValid && get(defaultStyles.invalid, key),
|
|
2508
|
-
isDisabled && get(styles.disabled, key), get(stylesOverrides, key)));
|
|
2563
|
+
isDisabled && get(styles$1.disabled, key), get(stylesOverrides, key)));
|
|
2509
2564
|
});
|
|
2510
2565
|
return result;
|
|
2511
2566
|
};
|
|
2512
|
-
var styles
|
|
2513
|
-
return (jsx(FormikProvider, { value: form, children: jsxs("div", { children: [jsx("legend", { className: styles
|
|
2567
|
+
var styles = handleGenerateStyle();
|
|
2568
|
+
return (jsx(FormikProvider, { value: form, children: jsxs("div", { children: [jsx("legend", { className: styles.sr, children: name }), jsx("div", { className: styles.list, children: jsx(FieldArray, { name: name, render: function (_a) {
|
|
2514
2569
|
var remove = _a.remove, push = _a.push;
|
|
2515
|
-
return (jsx(Fragment$1, { children: options === null || options === void 0 ? void 0 : options.map(function (option) { return (jsxs("div", { className: styles
|
|
2570
|
+
return (jsx(Fragment$1, { children: options === null || options === void 0 ? void 0 : options.map(function (option) { return (jsxs("div", { className: styles.item.container, children: [jsx("div", { className: styles.item.head, children: jsx("input", { id: option.value, name: option.value, "aria-describedby": "".concat(option.value, "-description"), type: "checkbox", checked: values === null || values === void 0 ? void 0 : values.includes(option.value), className: styles.item.input, disabled: isDisabled, onChange: function (value) {
|
|
2516
2571
|
var isChecked = value.currentTarget.checked;
|
|
2517
2572
|
if (isChecked) {
|
|
2518
2573
|
push(option.value);
|
|
@@ -2520,11 +2575,11 @@ var CheckboxInputGroupForm = function (props) {
|
|
|
2520
2575
|
}
|
|
2521
2576
|
var findIndex = values.findIndex(function (value) { return value === option.value; });
|
|
2522
2577
|
remove(findIndex);
|
|
2523
|
-
} }) }), jsxs("div", { className: styles
|
|
2578
|
+
} }) }), jsxs("div", { className: styles.item.body, children: [jsx("label", { htmlFor: "comments", className: styles.item.label, children: option.title }), option.description && (jsx("p", { id: "comments-description", className: styles.item.description, children: option.description }))] })] }, option.value)); }) }));
|
|
2524
2579
|
} }) })] }) }));
|
|
2525
2580
|
};
|
|
2526
2581
|
|
|
2527
|
-
var base = {
|
|
2582
|
+
var base$1 = {
|
|
2528
2583
|
container: '',
|
|
2529
2584
|
sr: 'sr-only',
|
|
2530
2585
|
list: 'space-y-5',
|
|
@@ -2537,15 +2592,2022 @@ var base = {
|
|
|
2537
2592
|
description: 'text-gray-500',
|
|
2538
2593
|
},
|
|
2539
2594
|
};
|
|
2540
|
-
var disabled = {
|
|
2595
|
+
var disabled$1 = {
|
|
2541
2596
|
item: {
|
|
2542
2597
|
input: 'block rounded-md border-0 text-gray-900 shadow-sm ring-1 ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-500 disabled:ring-gray-200',
|
|
2543
2598
|
},
|
|
2544
2599
|
};
|
|
2600
|
+
var styles$1 = {
|
|
2601
|
+
base: base$1,
|
|
2602
|
+
disabled: disabled$1,
|
|
2603
|
+
};
|
|
2604
|
+
|
|
2605
|
+
function getDefaultExportFromCjs (x) {
|
|
2606
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
var propTypes = {exports: {}};
|
|
2610
|
+
|
|
2611
|
+
var reactIs = {exports: {}};
|
|
2612
|
+
|
|
2613
|
+
var reactIs_production_min = {};
|
|
2614
|
+
|
|
2615
|
+
var hasRequiredReactIs_production_min;
|
|
2616
|
+
function requireReactIs_production_min () {
|
|
2617
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
2618
|
+
hasRequiredReactIs_production_min = 1;
|
|
2619
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
2620
|
+
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
2621
|
+
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
|
|
2622
|
+
reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
|
|
2623
|
+
reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
|
|
2624
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
|
|
2625
|
+
return reactIs_production_min;
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
var reactIs_development = {};
|
|
2629
|
+
|
|
2630
|
+
var hasRequiredReactIs_development;
|
|
2631
|
+
function requireReactIs_development () {
|
|
2632
|
+
if (hasRequiredReactIs_development) return reactIs_development;
|
|
2633
|
+
hasRequiredReactIs_development = 1;
|
|
2634
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2635
|
+
(function() {
|
|
2636
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
2637
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
2638
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
2639
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
2640
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
2641
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
2642
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
2643
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
2644
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
2645
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
2646
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
2647
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
2648
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
2649
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
2650
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
2651
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
2652
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
2653
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
2654
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
2655
|
+
function isValidElementType(type) {
|
|
2656
|
+
return typeof type === 'string' || typeof type === 'function' ||
|
|
2657
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
2658
|
+
}
|
|
2659
|
+
function typeOf(object) {
|
|
2660
|
+
if (typeof object === 'object' && object !== null) {
|
|
2661
|
+
var $$typeof = object.$$typeof;
|
|
2662
|
+
switch ($$typeof) {
|
|
2663
|
+
case REACT_ELEMENT_TYPE:
|
|
2664
|
+
var type = object.type;
|
|
2665
|
+
switch (type) {
|
|
2666
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
2667
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
2668
|
+
case REACT_FRAGMENT_TYPE:
|
|
2669
|
+
case REACT_PROFILER_TYPE:
|
|
2670
|
+
case REACT_STRICT_MODE_TYPE:
|
|
2671
|
+
case REACT_SUSPENSE_TYPE:
|
|
2672
|
+
return type;
|
|
2673
|
+
default:
|
|
2674
|
+
var $$typeofType = type && type.$$typeof;
|
|
2675
|
+
switch ($$typeofType) {
|
|
2676
|
+
case REACT_CONTEXT_TYPE:
|
|
2677
|
+
case REACT_FORWARD_REF_TYPE:
|
|
2678
|
+
case REACT_LAZY_TYPE:
|
|
2679
|
+
case REACT_MEMO_TYPE:
|
|
2680
|
+
case REACT_PROVIDER_TYPE:
|
|
2681
|
+
return $$typeofType;
|
|
2682
|
+
default:
|
|
2683
|
+
return $$typeof;
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
case REACT_PORTAL_TYPE:
|
|
2687
|
+
return $$typeof;
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
return undefined;
|
|
2691
|
+
}
|
|
2692
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
2693
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
2694
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
2695
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
2696
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
2697
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
2698
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
2699
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
2700
|
+
var Memo = REACT_MEMO_TYPE;
|
|
2701
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
2702
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
2703
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2704
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
2705
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
2706
|
+
function isAsyncMode(object) {
|
|
2707
|
+
{
|
|
2708
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
2709
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
2710
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
2714
|
+
}
|
|
2715
|
+
function isConcurrentMode(object) {
|
|
2716
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
2717
|
+
}
|
|
2718
|
+
function isContextConsumer(object) {
|
|
2719
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
2720
|
+
}
|
|
2721
|
+
function isContextProvider(object) {
|
|
2722
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
2723
|
+
}
|
|
2724
|
+
function isElement(object) {
|
|
2725
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
2726
|
+
}
|
|
2727
|
+
function isForwardRef(object) {
|
|
2728
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
2729
|
+
}
|
|
2730
|
+
function isFragment(object) {
|
|
2731
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
2732
|
+
}
|
|
2733
|
+
function isLazy(object) {
|
|
2734
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
2735
|
+
}
|
|
2736
|
+
function isMemo(object) {
|
|
2737
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
2738
|
+
}
|
|
2739
|
+
function isPortal(object) {
|
|
2740
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
2741
|
+
}
|
|
2742
|
+
function isProfiler(object) {
|
|
2743
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
2744
|
+
}
|
|
2745
|
+
function isStrictMode(object) {
|
|
2746
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
2747
|
+
}
|
|
2748
|
+
function isSuspense(object) {
|
|
2749
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
2750
|
+
}
|
|
2751
|
+
reactIs_development.AsyncMode = AsyncMode;
|
|
2752
|
+
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
2753
|
+
reactIs_development.ContextConsumer = ContextConsumer;
|
|
2754
|
+
reactIs_development.ContextProvider = ContextProvider;
|
|
2755
|
+
reactIs_development.Element = Element;
|
|
2756
|
+
reactIs_development.ForwardRef = ForwardRef;
|
|
2757
|
+
reactIs_development.Fragment = Fragment;
|
|
2758
|
+
reactIs_development.Lazy = Lazy;
|
|
2759
|
+
reactIs_development.Memo = Memo;
|
|
2760
|
+
reactIs_development.Portal = Portal;
|
|
2761
|
+
reactIs_development.Profiler = Profiler;
|
|
2762
|
+
reactIs_development.StrictMode = StrictMode;
|
|
2763
|
+
reactIs_development.Suspense = Suspense;
|
|
2764
|
+
reactIs_development.isAsyncMode = isAsyncMode;
|
|
2765
|
+
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
2766
|
+
reactIs_development.isContextConsumer = isContextConsumer;
|
|
2767
|
+
reactIs_development.isContextProvider = isContextProvider;
|
|
2768
|
+
reactIs_development.isElement = isElement;
|
|
2769
|
+
reactIs_development.isForwardRef = isForwardRef;
|
|
2770
|
+
reactIs_development.isFragment = isFragment;
|
|
2771
|
+
reactIs_development.isLazy = isLazy;
|
|
2772
|
+
reactIs_development.isMemo = isMemo;
|
|
2773
|
+
reactIs_development.isPortal = isPortal;
|
|
2774
|
+
reactIs_development.isProfiler = isProfiler;
|
|
2775
|
+
reactIs_development.isStrictMode = isStrictMode;
|
|
2776
|
+
reactIs_development.isSuspense = isSuspense;
|
|
2777
|
+
reactIs_development.isValidElementType = isValidElementType;
|
|
2778
|
+
reactIs_development.typeOf = typeOf;
|
|
2779
|
+
})();
|
|
2780
|
+
}
|
|
2781
|
+
return reactIs_development;
|
|
2782
|
+
}
|
|
2783
|
+
|
|
2784
|
+
var hasRequiredReactIs;
|
|
2785
|
+
function requireReactIs () {
|
|
2786
|
+
if (hasRequiredReactIs) return reactIs.exports;
|
|
2787
|
+
hasRequiredReactIs = 1;
|
|
2788
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2789
|
+
reactIs.exports = requireReactIs_production_min();
|
|
2790
|
+
} else {
|
|
2791
|
+
reactIs.exports = requireReactIs_development();
|
|
2792
|
+
}
|
|
2793
|
+
return reactIs.exports;
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
var objectAssign;
|
|
2797
|
+
var hasRequiredObjectAssign;
|
|
2798
|
+
function requireObjectAssign () {
|
|
2799
|
+
if (hasRequiredObjectAssign) return objectAssign;
|
|
2800
|
+
hasRequiredObjectAssign = 1;
|
|
2801
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
2802
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2803
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
2804
|
+
function toObject(val) {
|
|
2805
|
+
if (val === null || val === undefined) {
|
|
2806
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
2807
|
+
}
|
|
2808
|
+
return Object(val);
|
|
2809
|
+
}
|
|
2810
|
+
function shouldUseNative() {
|
|
2811
|
+
try {
|
|
2812
|
+
if (!Object.assign) {
|
|
2813
|
+
return false;
|
|
2814
|
+
}
|
|
2815
|
+
var test1 = new String('abc');
|
|
2816
|
+
test1[5] = 'de';
|
|
2817
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
2818
|
+
return false;
|
|
2819
|
+
}
|
|
2820
|
+
var test2 = {};
|
|
2821
|
+
for (var i = 0; i < 10; i++) {
|
|
2822
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
2823
|
+
}
|
|
2824
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
2825
|
+
return test2[n];
|
|
2826
|
+
});
|
|
2827
|
+
if (order2.join('') !== '0123456789') {
|
|
2828
|
+
return false;
|
|
2829
|
+
}
|
|
2830
|
+
var test3 = {};
|
|
2831
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
2832
|
+
test3[letter] = letter;
|
|
2833
|
+
});
|
|
2834
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
2835
|
+
'abcdefghijklmnopqrst') {
|
|
2836
|
+
return false;
|
|
2837
|
+
}
|
|
2838
|
+
return true;
|
|
2839
|
+
} catch (err) {
|
|
2840
|
+
return false;
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
2844
|
+
var from;
|
|
2845
|
+
var to = toObject(target);
|
|
2846
|
+
var symbols;
|
|
2847
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
2848
|
+
from = Object(arguments[s]);
|
|
2849
|
+
for (var key in from) {
|
|
2850
|
+
if (hasOwnProperty.call(from, key)) {
|
|
2851
|
+
to[key] = from[key];
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
if (getOwnPropertySymbols) {
|
|
2855
|
+
symbols = getOwnPropertySymbols(from);
|
|
2856
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
2857
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
2858
|
+
to[symbols[i]] = from[symbols[i]];
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
return to;
|
|
2864
|
+
};
|
|
2865
|
+
return objectAssign;
|
|
2866
|
+
}
|
|
2867
|
+
|
|
2868
|
+
var ReactPropTypesSecret_1;
|
|
2869
|
+
var hasRequiredReactPropTypesSecret;
|
|
2870
|
+
function requireReactPropTypesSecret () {
|
|
2871
|
+
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
2872
|
+
hasRequiredReactPropTypesSecret = 1;
|
|
2873
|
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
2874
|
+
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
2875
|
+
return ReactPropTypesSecret_1;
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2878
|
+
var has;
|
|
2879
|
+
var hasRequiredHas;
|
|
2880
|
+
function requireHas () {
|
|
2881
|
+
if (hasRequiredHas) return has;
|
|
2882
|
+
hasRequiredHas = 1;
|
|
2883
|
+
has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
2884
|
+
return has;
|
|
2885
|
+
}
|
|
2886
|
+
|
|
2887
|
+
var checkPropTypes_1;
|
|
2888
|
+
var hasRequiredCheckPropTypes;
|
|
2889
|
+
function requireCheckPropTypes () {
|
|
2890
|
+
if (hasRequiredCheckPropTypes) return checkPropTypes_1;
|
|
2891
|
+
hasRequiredCheckPropTypes = 1;
|
|
2892
|
+
var printWarning = function() {};
|
|
2893
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2894
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
2895
|
+
var loggedTypeFailures = {};
|
|
2896
|
+
var has = requireHas();
|
|
2897
|
+
printWarning = function(text) {
|
|
2898
|
+
var message = 'Warning: ' + text;
|
|
2899
|
+
if (typeof console !== 'undefined') {
|
|
2900
|
+
console.error(message);
|
|
2901
|
+
}
|
|
2902
|
+
try {
|
|
2903
|
+
throw new Error(message);
|
|
2904
|
+
} catch (x) { }
|
|
2905
|
+
};
|
|
2906
|
+
}
|
|
2907
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
2908
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2909
|
+
for (var typeSpecName in typeSpecs) {
|
|
2910
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
2911
|
+
var error;
|
|
2912
|
+
try {
|
|
2913
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
2914
|
+
var err = Error(
|
|
2915
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
2916
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
2917
|
+
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
2918
|
+
);
|
|
2919
|
+
err.name = 'Invariant Violation';
|
|
2920
|
+
throw err;
|
|
2921
|
+
}
|
|
2922
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
2923
|
+
} catch (ex) {
|
|
2924
|
+
error = ex;
|
|
2925
|
+
}
|
|
2926
|
+
if (error && !(error instanceof Error)) {
|
|
2927
|
+
printWarning(
|
|
2928
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
2929
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
2930
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
2931
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
2932
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
2933
|
+
'shape all require an argument).'
|
|
2934
|
+
);
|
|
2935
|
+
}
|
|
2936
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
2937
|
+
loggedTypeFailures[error.message] = true;
|
|
2938
|
+
var stack = getStack ? getStack() : '';
|
|
2939
|
+
printWarning(
|
|
2940
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
2941
|
+
);
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
checkPropTypes.resetWarningCache = function() {
|
|
2948
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2949
|
+
loggedTypeFailures = {};
|
|
2950
|
+
}
|
|
2951
|
+
};
|
|
2952
|
+
checkPropTypes_1 = checkPropTypes;
|
|
2953
|
+
return checkPropTypes_1;
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
var factoryWithTypeCheckers;
|
|
2957
|
+
var hasRequiredFactoryWithTypeCheckers;
|
|
2958
|
+
function requireFactoryWithTypeCheckers () {
|
|
2959
|
+
if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
|
|
2960
|
+
hasRequiredFactoryWithTypeCheckers = 1;
|
|
2961
|
+
var ReactIs = requireReactIs();
|
|
2962
|
+
var assign = requireObjectAssign();
|
|
2963
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
2964
|
+
var has = requireHas();
|
|
2965
|
+
var checkPropTypes = requireCheckPropTypes();
|
|
2966
|
+
var printWarning = function() {};
|
|
2967
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2968
|
+
printWarning = function(text) {
|
|
2969
|
+
var message = 'Warning: ' + text;
|
|
2970
|
+
if (typeof console !== 'undefined') {
|
|
2971
|
+
console.error(message);
|
|
2972
|
+
}
|
|
2973
|
+
try {
|
|
2974
|
+
throw new Error(message);
|
|
2975
|
+
} catch (x) {}
|
|
2976
|
+
};
|
|
2977
|
+
}
|
|
2978
|
+
function emptyFunctionThatReturnsNull() {
|
|
2979
|
+
return null;
|
|
2980
|
+
}
|
|
2981
|
+
factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
2982
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
2983
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
2984
|
+
function getIteratorFn(maybeIterable) {
|
|
2985
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
2986
|
+
if (typeof iteratorFn === 'function') {
|
|
2987
|
+
return iteratorFn;
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
var ANONYMOUS = '<<anonymous>>';
|
|
2991
|
+
var ReactPropTypes = {
|
|
2992
|
+
array: createPrimitiveTypeChecker('array'),
|
|
2993
|
+
bigint: createPrimitiveTypeChecker('bigint'),
|
|
2994
|
+
bool: createPrimitiveTypeChecker('boolean'),
|
|
2995
|
+
func: createPrimitiveTypeChecker('function'),
|
|
2996
|
+
number: createPrimitiveTypeChecker('number'),
|
|
2997
|
+
object: createPrimitiveTypeChecker('object'),
|
|
2998
|
+
string: createPrimitiveTypeChecker('string'),
|
|
2999
|
+
symbol: createPrimitiveTypeChecker('symbol'),
|
|
3000
|
+
any: createAnyTypeChecker(),
|
|
3001
|
+
arrayOf: createArrayOfTypeChecker,
|
|
3002
|
+
element: createElementTypeChecker(),
|
|
3003
|
+
elementType: createElementTypeTypeChecker(),
|
|
3004
|
+
instanceOf: createInstanceTypeChecker,
|
|
3005
|
+
node: createNodeChecker(),
|
|
3006
|
+
objectOf: createObjectOfTypeChecker,
|
|
3007
|
+
oneOf: createEnumTypeChecker,
|
|
3008
|
+
oneOfType: createUnionTypeChecker,
|
|
3009
|
+
shape: createShapeTypeChecker,
|
|
3010
|
+
exact: createStrictShapeTypeChecker,
|
|
3011
|
+
};
|
|
3012
|
+
function is(x, y) {
|
|
3013
|
+
if (x === y) {
|
|
3014
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
3015
|
+
} else {
|
|
3016
|
+
return x !== x && y !== y;
|
|
3017
|
+
}
|
|
3018
|
+
}
|
|
3019
|
+
function PropTypeError(message, data) {
|
|
3020
|
+
this.message = message;
|
|
3021
|
+
this.data = data && typeof data === 'object' ? data: {};
|
|
3022
|
+
this.stack = '';
|
|
3023
|
+
}
|
|
3024
|
+
PropTypeError.prototype = Error.prototype;
|
|
3025
|
+
function createChainableTypeChecker(validate) {
|
|
3026
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3027
|
+
var manualPropTypeCallCache = {};
|
|
3028
|
+
var manualPropTypeWarningCount = 0;
|
|
3029
|
+
}
|
|
3030
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
3031
|
+
componentName = componentName || ANONYMOUS;
|
|
3032
|
+
propFullName = propFullName || propName;
|
|
3033
|
+
if (secret !== ReactPropTypesSecret) {
|
|
3034
|
+
if (throwOnDirectAccess) {
|
|
3035
|
+
var err = new Error(
|
|
3036
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
3037
|
+
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
3038
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
3039
|
+
);
|
|
3040
|
+
err.name = 'Invariant Violation';
|
|
3041
|
+
throw err;
|
|
3042
|
+
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
3043
|
+
var cacheKey = componentName + ':' + propName;
|
|
3044
|
+
if (
|
|
3045
|
+
!manualPropTypeCallCache[cacheKey] &&
|
|
3046
|
+
manualPropTypeWarningCount < 3
|
|
3047
|
+
) {
|
|
3048
|
+
printWarning(
|
|
3049
|
+
'You are manually calling a React.PropTypes validation ' +
|
|
3050
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
3051
|
+
'and will throw in the standalone `prop-types` package. ' +
|
|
3052
|
+
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
3053
|
+
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
3054
|
+
);
|
|
3055
|
+
manualPropTypeCallCache[cacheKey] = true;
|
|
3056
|
+
manualPropTypeWarningCount++;
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
if (props[propName] == null) {
|
|
3061
|
+
if (isRequired) {
|
|
3062
|
+
if (props[propName] === null) {
|
|
3063
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
3064
|
+
}
|
|
3065
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
3066
|
+
}
|
|
3067
|
+
return null;
|
|
3068
|
+
} else {
|
|
3069
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
3073
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
3074
|
+
return chainedCheckType;
|
|
3075
|
+
}
|
|
3076
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
3077
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
3078
|
+
var propValue = props[propName];
|
|
3079
|
+
var propType = getPropType(propValue);
|
|
3080
|
+
if (propType !== expectedType) {
|
|
3081
|
+
var preciseType = getPreciseType(propValue);
|
|
3082
|
+
return new PropTypeError(
|
|
3083
|
+
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
3084
|
+
{expectedType: expectedType}
|
|
3085
|
+
);
|
|
3086
|
+
}
|
|
3087
|
+
return null;
|
|
3088
|
+
}
|
|
3089
|
+
return createChainableTypeChecker(validate);
|
|
3090
|
+
}
|
|
3091
|
+
function createAnyTypeChecker() {
|
|
3092
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
3093
|
+
}
|
|
3094
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
3095
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3096
|
+
if (typeof typeChecker !== 'function') {
|
|
3097
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
3098
|
+
}
|
|
3099
|
+
var propValue = props[propName];
|
|
3100
|
+
if (!Array.isArray(propValue)) {
|
|
3101
|
+
var propType = getPropType(propValue);
|
|
3102
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
3103
|
+
}
|
|
3104
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
3105
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
|
3106
|
+
if (error instanceof Error) {
|
|
3107
|
+
return error;
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
return null;
|
|
3111
|
+
}
|
|
3112
|
+
return createChainableTypeChecker(validate);
|
|
3113
|
+
}
|
|
3114
|
+
function createElementTypeChecker() {
|
|
3115
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3116
|
+
var propValue = props[propName];
|
|
3117
|
+
if (!isValidElement(propValue)) {
|
|
3118
|
+
var propType = getPropType(propValue);
|
|
3119
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
3120
|
+
}
|
|
3121
|
+
return null;
|
|
3122
|
+
}
|
|
3123
|
+
return createChainableTypeChecker(validate);
|
|
3124
|
+
}
|
|
3125
|
+
function createElementTypeTypeChecker() {
|
|
3126
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3127
|
+
var propValue = props[propName];
|
|
3128
|
+
if (!ReactIs.isValidElementType(propValue)) {
|
|
3129
|
+
var propType = getPropType(propValue);
|
|
3130
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
3131
|
+
}
|
|
3132
|
+
return null;
|
|
3133
|
+
}
|
|
3134
|
+
return createChainableTypeChecker(validate);
|
|
3135
|
+
}
|
|
3136
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
3137
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3138
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
3139
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
3140
|
+
var actualClassName = getClassName(props[propName]);
|
|
3141
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
3142
|
+
}
|
|
3143
|
+
return null;
|
|
3144
|
+
}
|
|
3145
|
+
return createChainableTypeChecker(validate);
|
|
3146
|
+
}
|
|
3147
|
+
function createEnumTypeChecker(expectedValues) {
|
|
3148
|
+
if (!Array.isArray(expectedValues)) {
|
|
3149
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3150
|
+
if (arguments.length > 1) {
|
|
3151
|
+
printWarning(
|
|
3152
|
+
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
3153
|
+
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
3154
|
+
);
|
|
3155
|
+
} else {
|
|
3156
|
+
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
return emptyFunctionThatReturnsNull;
|
|
3160
|
+
}
|
|
3161
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3162
|
+
var propValue = props[propName];
|
|
3163
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
3164
|
+
if (is(propValue, expectedValues[i])) {
|
|
3165
|
+
return null;
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
3169
|
+
var type = getPreciseType(value);
|
|
3170
|
+
if (type === 'symbol') {
|
|
3171
|
+
return String(value);
|
|
3172
|
+
}
|
|
3173
|
+
return value;
|
|
3174
|
+
});
|
|
3175
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
3176
|
+
}
|
|
3177
|
+
return createChainableTypeChecker(validate);
|
|
3178
|
+
}
|
|
3179
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
3180
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3181
|
+
if (typeof typeChecker !== 'function') {
|
|
3182
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
3183
|
+
}
|
|
3184
|
+
var propValue = props[propName];
|
|
3185
|
+
var propType = getPropType(propValue);
|
|
3186
|
+
if (propType !== 'object') {
|
|
3187
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
3188
|
+
}
|
|
3189
|
+
for (var key in propValue) {
|
|
3190
|
+
if (has(propValue, key)) {
|
|
3191
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
3192
|
+
if (error instanceof Error) {
|
|
3193
|
+
return error;
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
return null;
|
|
3198
|
+
}
|
|
3199
|
+
return createChainableTypeChecker(validate);
|
|
3200
|
+
}
|
|
3201
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
3202
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
3203
|
+
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
3204
|
+
return emptyFunctionThatReturnsNull;
|
|
3205
|
+
}
|
|
3206
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
3207
|
+
var checker = arrayOfTypeCheckers[i];
|
|
3208
|
+
if (typeof checker !== 'function') {
|
|
3209
|
+
printWarning(
|
|
3210
|
+
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
3211
|
+
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
3212
|
+
);
|
|
3213
|
+
return emptyFunctionThatReturnsNull;
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
3216
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3217
|
+
var expectedTypes = [];
|
|
3218
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
3219
|
+
var checker = arrayOfTypeCheckers[i];
|
|
3220
|
+
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
3221
|
+
if (checkerResult == null) {
|
|
3222
|
+
return null;
|
|
3223
|
+
}
|
|
3224
|
+
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
3225
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
3229
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
3230
|
+
}
|
|
3231
|
+
return createChainableTypeChecker(validate);
|
|
3232
|
+
}
|
|
3233
|
+
function createNodeChecker() {
|
|
3234
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3235
|
+
if (!isNode(props[propName])) {
|
|
3236
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
3237
|
+
}
|
|
3238
|
+
return null;
|
|
3239
|
+
}
|
|
3240
|
+
return createChainableTypeChecker(validate);
|
|
3241
|
+
}
|
|
3242
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
3243
|
+
return new PropTypeError(
|
|
3244
|
+
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
3245
|
+
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
3246
|
+
);
|
|
3247
|
+
}
|
|
3248
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
3249
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3250
|
+
var propValue = props[propName];
|
|
3251
|
+
var propType = getPropType(propValue);
|
|
3252
|
+
if (propType !== 'object') {
|
|
3253
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
3254
|
+
}
|
|
3255
|
+
for (var key in shapeTypes) {
|
|
3256
|
+
var checker = shapeTypes[key];
|
|
3257
|
+
if (typeof checker !== 'function') {
|
|
3258
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
3259
|
+
}
|
|
3260
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
3261
|
+
if (error) {
|
|
3262
|
+
return error;
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
return null;
|
|
3266
|
+
}
|
|
3267
|
+
return createChainableTypeChecker(validate);
|
|
3268
|
+
}
|
|
3269
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
3270
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
3271
|
+
var propValue = props[propName];
|
|
3272
|
+
var propType = getPropType(propValue);
|
|
3273
|
+
if (propType !== 'object') {
|
|
3274
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
3275
|
+
}
|
|
3276
|
+
var allKeys = assign({}, props[propName], shapeTypes);
|
|
3277
|
+
for (var key in allKeys) {
|
|
3278
|
+
var checker = shapeTypes[key];
|
|
3279
|
+
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
3280
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
3281
|
+
}
|
|
3282
|
+
if (!checker) {
|
|
3283
|
+
return new PropTypeError(
|
|
3284
|
+
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
3285
|
+
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
3286
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
3287
|
+
);
|
|
3288
|
+
}
|
|
3289
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
3290
|
+
if (error) {
|
|
3291
|
+
return error;
|
|
3292
|
+
}
|
|
3293
|
+
}
|
|
3294
|
+
return null;
|
|
3295
|
+
}
|
|
3296
|
+
return createChainableTypeChecker(validate);
|
|
3297
|
+
}
|
|
3298
|
+
function isNode(propValue) {
|
|
3299
|
+
switch (typeof propValue) {
|
|
3300
|
+
case 'number':
|
|
3301
|
+
case 'string':
|
|
3302
|
+
case 'undefined':
|
|
3303
|
+
return true;
|
|
3304
|
+
case 'boolean':
|
|
3305
|
+
return !propValue;
|
|
3306
|
+
case 'object':
|
|
3307
|
+
if (Array.isArray(propValue)) {
|
|
3308
|
+
return propValue.every(isNode);
|
|
3309
|
+
}
|
|
3310
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
3311
|
+
return true;
|
|
3312
|
+
}
|
|
3313
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
3314
|
+
if (iteratorFn) {
|
|
3315
|
+
var iterator = iteratorFn.call(propValue);
|
|
3316
|
+
var step;
|
|
3317
|
+
if (iteratorFn !== propValue.entries) {
|
|
3318
|
+
while (!(step = iterator.next()).done) {
|
|
3319
|
+
if (!isNode(step.value)) {
|
|
3320
|
+
return false;
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
} else {
|
|
3324
|
+
while (!(step = iterator.next()).done) {
|
|
3325
|
+
var entry = step.value;
|
|
3326
|
+
if (entry) {
|
|
3327
|
+
if (!isNode(entry[1])) {
|
|
3328
|
+
return false;
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
} else {
|
|
3334
|
+
return false;
|
|
3335
|
+
}
|
|
3336
|
+
return true;
|
|
3337
|
+
default:
|
|
3338
|
+
return false;
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
function isSymbol(propType, propValue) {
|
|
3342
|
+
if (propType === 'symbol') {
|
|
3343
|
+
return true;
|
|
3344
|
+
}
|
|
3345
|
+
if (!propValue) {
|
|
3346
|
+
return false;
|
|
3347
|
+
}
|
|
3348
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
3349
|
+
return true;
|
|
3350
|
+
}
|
|
3351
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
3352
|
+
return true;
|
|
3353
|
+
}
|
|
3354
|
+
return false;
|
|
3355
|
+
}
|
|
3356
|
+
function getPropType(propValue) {
|
|
3357
|
+
var propType = typeof propValue;
|
|
3358
|
+
if (Array.isArray(propValue)) {
|
|
3359
|
+
return 'array';
|
|
3360
|
+
}
|
|
3361
|
+
if (propValue instanceof RegExp) {
|
|
3362
|
+
return 'object';
|
|
3363
|
+
}
|
|
3364
|
+
if (isSymbol(propType, propValue)) {
|
|
3365
|
+
return 'symbol';
|
|
3366
|
+
}
|
|
3367
|
+
return propType;
|
|
3368
|
+
}
|
|
3369
|
+
function getPreciseType(propValue) {
|
|
3370
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
|
3371
|
+
return '' + propValue;
|
|
3372
|
+
}
|
|
3373
|
+
var propType = getPropType(propValue);
|
|
3374
|
+
if (propType === 'object') {
|
|
3375
|
+
if (propValue instanceof Date) {
|
|
3376
|
+
return 'date';
|
|
3377
|
+
} else if (propValue instanceof RegExp) {
|
|
3378
|
+
return 'regexp';
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
return propType;
|
|
3382
|
+
}
|
|
3383
|
+
function getPostfixForTypeWarning(value) {
|
|
3384
|
+
var type = getPreciseType(value);
|
|
3385
|
+
switch (type) {
|
|
3386
|
+
case 'array':
|
|
3387
|
+
case 'object':
|
|
3388
|
+
return 'an ' + type;
|
|
3389
|
+
case 'boolean':
|
|
3390
|
+
case 'date':
|
|
3391
|
+
case 'regexp':
|
|
3392
|
+
return 'a ' + type;
|
|
3393
|
+
default:
|
|
3394
|
+
return type;
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
function getClassName(propValue) {
|
|
3398
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
3399
|
+
return ANONYMOUS;
|
|
3400
|
+
}
|
|
3401
|
+
return propValue.constructor.name;
|
|
3402
|
+
}
|
|
3403
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
3404
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
3405
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
3406
|
+
return ReactPropTypes;
|
|
3407
|
+
};
|
|
3408
|
+
return factoryWithTypeCheckers;
|
|
3409
|
+
}
|
|
3410
|
+
|
|
3411
|
+
var factoryWithThrowingShims;
|
|
3412
|
+
var hasRequiredFactoryWithThrowingShims;
|
|
3413
|
+
function requireFactoryWithThrowingShims () {
|
|
3414
|
+
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
3415
|
+
hasRequiredFactoryWithThrowingShims = 1;
|
|
3416
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
3417
|
+
function emptyFunction() {}
|
|
3418
|
+
function emptyFunctionWithReset() {}
|
|
3419
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
3420
|
+
factoryWithThrowingShims = function() {
|
|
3421
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
3422
|
+
if (secret === ReactPropTypesSecret) {
|
|
3423
|
+
return;
|
|
3424
|
+
}
|
|
3425
|
+
var err = new Error(
|
|
3426
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
3427
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
3428
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
3429
|
+
);
|
|
3430
|
+
err.name = 'Invariant Violation';
|
|
3431
|
+
throw err;
|
|
3432
|
+
} shim.isRequired = shim;
|
|
3433
|
+
function getShim() {
|
|
3434
|
+
return shim;
|
|
3435
|
+
} var ReactPropTypes = {
|
|
3436
|
+
array: shim,
|
|
3437
|
+
bigint: shim,
|
|
3438
|
+
bool: shim,
|
|
3439
|
+
func: shim,
|
|
3440
|
+
number: shim,
|
|
3441
|
+
object: shim,
|
|
3442
|
+
string: shim,
|
|
3443
|
+
symbol: shim,
|
|
3444
|
+
any: shim,
|
|
3445
|
+
arrayOf: getShim,
|
|
3446
|
+
element: shim,
|
|
3447
|
+
elementType: shim,
|
|
3448
|
+
instanceOf: getShim,
|
|
3449
|
+
node: shim,
|
|
3450
|
+
objectOf: getShim,
|
|
3451
|
+
oneOf: getShim,
|
|
3452
|
+
oneOfType: getShim,
|
|
3453
|
+
shape: getShim,
|
|
3454
|
+
exact: getShim,
|
|
3455
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
3456
|
+
resetWarningCache: emptyFunction
|
|
3457
|
+
};
|
|
3458
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
3459
|
+
return ReactPropTypes;
|
|
3460
|
+
};
|
|
3461
|
+
return factoryWithThrowingShims;
|
|
3462
|
+
}
|
|
3463
|
+
|
|
3464
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3465
|
+
var ReactIs = requireReactIs();
|
|
3466
|
+
var throwOnDirectAccess = true;
|
|
3467
|
+
propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
3468
|
+
} else {
|
|
3469
|
+
propTypes.exports = requireFactoryWithThrowingShims()();
|
|
3470
|
+
}
|
|
3471
|
+
var propTypesExports = propTypes.exports;
|
|
3472
|
+
var PropTypes = getDefaultExportFromCjs(propTypesExports);
|
|
3473
|
+
|
|
3474
|
+
var COMMON_MIME_TYPES = new Map([
|
|
3475
|
+
['aac', 'audio/aac'],
|
|
3476
|
+
['abw', 'application/x-abiword'],
|
|
3477
|
+
['arc', 'application/x-freearc'],
|
|
3478
|
+
['avif', 'image/avif'],
|
|
3479
|
+
['avi', 'video/x-msvideo'],
|
|
3480
|
+
['azw', 'application/vnd.amazon.ebook'],
|
|
3481
|
+
['bin', 'application/octet-stream'],
|
|
3482
|
+
['bmp', 'image/bmp'],
|
|
3483
|
+
['bz', 'application/x-bzip'],
|
|
3484
|
+
['bz2', 'application/x-bzip2'],
|
|
3485
|
+
['cda', 'application/x-cdf'],
|
|
3486
|
+
['csh', 'application/x-csh'],
|
|
3487
|
+
['css', 'text/css'],
|
|
3488
|
+
['csv', 'text/csv'],
|
|
3489
|
+
['doc', 'application/msword'],
|
|
3490
|
+
['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
|
|
3491
|
+
['eot', 'application/vnd.ms-fontobject'],
|
|
3492
|
+
['epub', 'application/epub+zip'],
|
|
3493
|
+
['gz', 'application/gzip'],
|
|
3494
|
+
['gif', 'image/gif'],
|
|
3495
|
+
['heic', 'image/heic'],
|
|
3496
|
+
['heif', 'image/heif'],
|
|
3497
|
+
['htm', 'text/html'],
|
|
3498
|
+
['html', 'text/html'],
|
|
3499
|
+
['ico', 'image/vnd.microsoft.icon'],
|
|
3500
|
+
['ics', 'text/calendar'],
|
|
3501
|
+
['jar', 'application/java-archive'],
|
|
3502
|
+
['jpeg', 'image/jpeg'],
|
|
3503
|
+
['jpg', 'image/jpeg'],
|
|
3504
|
+
['js', 'text/javascript'],
|
|
3505
|
+
['json', 'application/json'],
|
|
3506
|
+
['jsonld', 'application/ld+json'],
|
|
3507
|
+
['mid', 'audio/midi'],
|
|
3508
|
+
['midi', 'audio/midi'],
|
|
3509
|
+
['mjs', 'text/javascript'],
|
|
3510
|
+
['mp3', 'audio/mpeg'],
|
|
3511
|
+
['mp4', 'video/mp4'],
|
|
3512
|
+
['mpeg', 'video/mpeg'],
|
|
3513
|
+
['mpkg', 'application/vnd.apple.installer+xml'],
|
|
3514
|
+
['odp', 'application/vnd.oasis.opendocument.presentation'],
|
|
3515
|
+
['ods', 'application/vnd.oasis.opendocument.spreadsheet'],
|
|
3516
|
+
['odt', 'application/vnd.oasis.opendocument.text'],
|
|
3517
|
+
['oga', 'audio/ogg'],
|
|
3518
|
+
['ogv', 'video/ogg'],
|
|
3519
|
+
['ogx', 'application/ogg'],
|
|
3520
|
+
['opus', 'audio/opus'],
|
|
3521
|
+
['otf', 'font/otf'],
|
|
3522
|
+
['png', 'image/png'],
|
|
3523
|
+
['pdf', 'application/pdf'],
|
|
3524
|
+
['php', 'application/x-httpd-php'],
|
|
3525
|
+
['ppt', 'application/vnd.ms-powerpoint'],
|
|
3526
|
+
['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
|
|
3527
|
+
['rar', 'application/vnd.rar'],
|
|
3528
|
+
['rtf', 'application/rtf'],
|
|
3529
|
+
['sh', 'application/x-sh'],
|
|
3530
|
+
['svg', 'image/svg+xml'],
|
|
3531
|
+
['swf', 'application/x-shockwave-flash'],
|
|
3532
|
+
['tar', 'application/x-tar'],
|
|
3533
|
+
['tif', 'image/tiff'],
|
|
3534
|
+
['tiff', 'image/tiff'],
|
|
3535
|
+
['ts', 'video/mp2t'],
|
|
3536
|
+
['ttf', 'font/ttf'],
|
|
3537
|
+
['txt', 'text/plain'],
|
|
3538
|
+
['vsd', 'application/vnd.visio'],
|
|
3539
|
+
['wav', 'audio/wav'],
|
|
3540
|
+
['weba', 'audio/webm'],
|
|
3541
|
+
['webm', 'video/webm'],
|
|
3542
|
+
['webp', 'image/webp'],
|
|
3543
|
+
['woff', 'font/woff'],
|
|
3544
|
+
['woff2', 'font/woff2'],
|
|
3545
|
+
['xhtml', 'application/xhtml+xml'],
|
|
3546
|
+
['xls', 'application/vnd.ms-excel'],
|
|
3547
|
+
['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
|
|
3548
|
+
['xml', 'application/xml'],
|
|
3549
|
+
['xul', 'application/vnd.mozilla.xul+xml'],
|
|
3550
|
+
['zip', 'application/zip'],
|
|
3551
|
+
['7z', 'application/x-7z-compressed'],
|
|
3552
|
+
['mkv', 'video/x-matroska'],
|
|
3553
|
+
['mov', 'video/quicktime'],
|
|
3554
|
+
['msg', 'application/vnd.ms-outlook']
|
|
3555
|
+
]);
|
|
3556
|
+
function toFileWithPath(file, path) {
|
|
3557
|
+
var f = withMimeType(file);
|
|
3558
|
+
if (typeof f.path !== 'string') {
|
|
3559
|
+
var webkitRelativePath = file.webkitRelativePath;
|
|
3560
|
+
Object.defineProperty(f, 'path', {
|
|
3561
|
+
value: typeof path === 'string'
|
|
3562
|
+
? path
|
|
3563
|
+
: typeof webkitRelativePath === 'string' && webkitRelativePath.length > 0
|
|
3564
|
+
? webkitRelativePath
|
|
3565
|
+
: file.name,
|
|
3566
|
+
writable: false,
|
|
3567
|
+
configurable: false,
|
|
3568
|
+
enumerable: true
|
|
3569
|
+
});
|
|
3570
|
+
}
|
|
3571
|
+
return f;
|
|
3572
|
+
}
|
|
3573
|
+
function withMimeType(file) {
|
|
3574
|
+
var name = file.name;
|
|
3575
|
+
var hasExtension = name && name.lastIndexOf('.') !== -1;
|
|
3576
|
+
if (hasExtension && !file.type) {
|
|
3577
|
+
var ext = name.split('.')
|
|
3578
|
+
.pop().toLowerCase();
|
|
3579
|
+
var type = COMMON_MIME_TYPES.get(ext);
|
|
3580
|
+
if (type) {
|
|
3581
|
+
Object.defineProperty(file, 'type', {
|
|
3582
|
+
value: type,
|
|
3583
|
+
writable: false,
|
|
3584
|
+
configurable: false,
|
|
3585
|
+
enumerable: true
|
|
3586
|
+
});
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
return file;
|
|
3590
|
+
}
|
|
3591
|
+
|
|
3592
|
+
var FILES_TO_IGNORE = [
|
|
3593
|
+
'.DS_Store',
|
|
3594
|
+
'Thumbs.db'
|
|
3595
|
+
];
|
|
3596
|
+
function fromEvent(evt) {
|
|
3597
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3598
|
+
return __generator(this, function (_a) {
|
|
3599
|
+
if (isObject(evt) && isDataTransfer(evt.dataTransfer)) {
|
|
3600
|
+
return [2 , getDataTransferFiles(evt.dataTransfer, evt.type)];
|
|
3601
|
+
}
|
|
3602
|
+
else if (isChangeEvt(evt)) {
|
|
3603
|
+
return [2 , getInputFiles(evt)];
|
|
3604
|
+
}
|
|
3605
|
+
else if (Array.isArray(evt) && evt.every(function (item) { return 'getFile' in item && typeof item.getFile === 'function'; })) {
|
|
3606
|
+
return [2 , getFsHandleFiles(evt)];
|
|
3607
|
+
}
|
|
3608
|
+
return [2 , []];
|
|
3609
|
+
});
|
|
3610
|
+
});
|
|
3611
|
+
}
|
|
3612
|
+
function isDataTransfer(value) {
|
|
3613
|
+
return isObject(value);
|
|
3614
|
+
}
|
|
3615
|
+
function isChangeEvt(value) {
|
|
3616
|
+
return isObject(value) && isObject(value.target);
|
|
3617
|
+
}
|
|
3618
|
+
function isObject(v) {
|
|
3619
|
+
return typeof v === 'object' && v !== null;
|
|
3620
|
+
}
|
|
3621
|
+
function getInputFiles(evt) {
|
|
3622
|
+
return fromList(evt.target.files).map(function (file) { return toFileWithPath(file); });
|
|
3623
|
+
}
|
|
3624
|
+
function getFsHandleFiles(handles) {
|
|
3625
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3626
|
+
var files;
|
|
3627
|
+
return __generator(this, function (_a) {
|
|
3628
|
+
switch (_a.label) {
|
|
3629
|
+
case 0: return [4 , Promise.all(handles.map(function (h) { return h.getFile(); }))];
|
|
3630
|
+
case 1:
|
|
3631
|
+
files = _a.sent();
|
|
3632
|
+
return [2 , files.map(function (file) { return toFileWithPath(file); })];
|
|
3633
|
+
}
|
|
3634
|
+
});
|
|
3635
|
+
});
|
|
3636
|
+
}
|
|
3637
|
+
function getDataTransferFiles(dt, type) {
|
|
3638
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3639
|
+
var items, files;
|
|
3640
|
+
return __generator(this, function (_a) {
|
|
3641
|
+
switch (_a.label) {
|
|
3642
|
+
case 0:
|
|
3643
|
+
if (!dt.items) return [3 , 2];
|
|
3644
|
+
items = fromList(dt.items)
|
|
3645
|
+
.filter(function (item) { return item.kind === 'file'; });
|
|
3646
|
+
if (type !== 'drop') {
|
|
3647
|
+
return [2 , items];
|
|
3648
|
+
}
|
|
3649
|
+
return [4 , Promise.all(items.map(toFilePromises))];
|
|
3650
|
+
case 1:
|
|
3651
|
+
files = _a.sent();
|
|
3652
|
+
return [2 , noIgnoredFiles(flatten(files))];
|
|
3653
|
+
case 2: return [2 , noIgnoredFiles(fromList(dt.files)
|
|
3654
|
+
.map(function (file) { return toFileWithPath(file); }))];
|
|
3655
|
+
}
|
|
3656
|
+
});
|
|
3657
|
+
});
|
|
3658
|
+
}
|
|
3659
|
+
function noIgnoredFiles(files) {
|
|
3660
|
+
return files.filter(function (file) { return FILES_TO_IGNORE.indexOf(file.name) === -1; });
|
|
3661
|
+
}
|
|
3662
|
+
function fromList(items) {
|
|
3663
|
+
if (items === null) {
|
|
3664
|
+
return [];
|
|
3665
|
+
}
|
|
3666
|
+
var files = [];
|
|
3667
|
+
for (var i = 0; i < items.length; i++) {
|
|
3668
|
+
var file = items[i];
|
|
3669
|
+
files.push(file);
|
|
3670
|
+
}
|
|
3671
|
+
return files;
|
|
3672
|
+
}
|
|
3673
|
+
function toFilePromises(item) {
|
|
3674
|
+
if (typeof item.webkitGetAsEntry !== 'function') {
|
|
3675
|
+
return fromDataTransferItem(item);
|
|
3676
|
+
}
|
|
3677
|
+
var entry = item.webkitGetAsEntry();
|
|
3678
|
+
if (entry && entry.isDirectory) {
|
|
3679
|
+
return fromDirEntry(entry);
|
|
3680
|
+
}
|
|
3681
|
+
return fromDataTransferItem(item);
|
|
3682
|
+
}
|
|
3683
|
+
function flatten(items) {
|
|
3684
|
+
return items.reduce(function (acc, files) { return __spreadArray(__spreadArray([], __read(acc), false), __read((Array.isArray(files) ? flatten(files) : [files])), false); }, []);
|
|
3685
|
+
}
|
|
3686
|
+
function fromDataTransferItem(item) {
|
|
3687
|
+
var file = item.getAsFile();
|
|
3688
|
+
if (!file) {
|
|
3689
|
+
return Promise.reject("".concat(item, " is not a File"));
|
|
3690
|
+
}
|
|
3691
|
+
var fwp = toFileWithPath(file);
|
|
3692
|
+
return Promise.resolve(fwp);
|
|
3693
|
+
}
|
|
3694
|
+
function fromEntry(entry) {
|
|
3695
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3696
|
+
return __generator(this, function (_a) {
|
|
3697
|
+
return [2 , entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
|
|
3698
|
+
});
|
|
3699
|
+
});
|
|
3700
|
+
}
|
|
3701
|
+
function fromDirEntry(entry) {
|
|
3702
|
+
var reader = entry.createReader();
|
|
3703
|
+
return new Promise(function (resolve, reject) {
|
|
3704
|
+
var entries = [];
|
|
3705
|
+
function readEntries() {
|
|
3706
|
+
var _this = this;
|
|
3707
|
+
reader.readEntries(function (batch) { return __awaiter(_this, void 0, void 0, function () {
|
|
3708
|
+
var files, err_1, items;
|
|
3709
|
+
return __generator(this, function (_a) {
|
|
3710
|
+
switch (_a.label) {
|
|
3711
|
+
case 0:
|
|
3712
|
+
if (!!batch.length) return [3 , 5];
|
|
3713
|
+
_a.label = 1;
|
|
3714
|
+
case 1:
|
|
3715
|
+
_a.trys.push([1, 3, , 4]);
|
|
3716
|
+
return [4 , Promise.all(entries)];
|
|
3717
|
+
case 2:
|
|
3718
|
+
files = _a.sent();
|
|
3719
|
+
resolve(files);
|
|
3720
|
+
return [3 , 4];
|
|
3721
|
+
case 3:
|
|
3722
|
+
err_1 = _a.sent();
|
|
3723
|
+
reject(err_1);
|
|
3724
|
+
return [3 , 4];
|
|
3725
|
+
case 4: return [3 , 6];
|
|
3726
|
+
case 5:
|
|
3727
|
+
items = Promise.all(batch.map(fromEntry));
|
|
3728
|
+
entries.push(items);
|
|
3729
|
+
readEntries();
|
|
3730
|
+
_a.label = 6;
|
|
3731
|
+
case 6: return [2 ];
|
|
3732
|
+
}
|
|
3733
|
+
});
|
|
3734
|
+
}); }, function (err) {
|
|
3735
|
+
reject(err);
|
|
3736
|
+
});
|
|
3737
|
+
}
|
|
3738
|
+
readEntries();
|
|
3739
|
+
});
|
|
3740
|
+
}
|
|
3741
|
+
function fromFileEntry(entry) {
|
|
3742
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3743
|
+
return __generator(this, function (_a) {
|
|
3744
|
+
return [2 , new Promise(function (resolve, reject) {
|
|
3745
|
+
entry.file(function (file) {
|
|
3746
|
+
var fwp = toFileWithPath(file, entry.fullPath);
|
|
3747
|
+
resolve(fwp);
|
|
3748
|
+
}, function (err) {
|
|
3749
|
+
reject(err);
|
|
3750
|
+
});
|
|
3751
|
+
})];
|
|
3752
|
+
});
|
|
3753
|
+
});
|
|
3754
|
+
}
|
|
3755
|
+
|
|
3756
|
+
var _default = function (file, acceptedFiles) {
|
|
3757
|
+
if (file && acceptedFiles) {
|
|
3758
|
+
var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
|
|
3759
|
+
var fileName = file.name || '';
|
|
3760
|
+
var mimeType = (file.type || '').toLowerCase();
|
|
3761
|
+
var baseMimeType = mimeType.replace(/\/.*$/, '');
|
|
3762
|
+
return acceptedFilesArray.some(function (type) {
|
|
3763
|
+
var validType = type.trim().toLowerCase();
|
|
3764
|
+
if (validType.charAt(0) === '.') {
|
|
3765
|
+
return fileName.toLowerCase().endsWith(validType);
|
|
3766
|
+
} else if (validType.endsWith('/*')) {
|
|
3767
|
+
return baseMimeType === validType.replace(/\/.*$/, '');
|
|
3768
|
+
}
|
|
3769
|
+
return mimeType === validType;
|
|
3770
|
+
});
|
|
3771
|
+
}
|
|
3772
|
+
return true;
|
|
3773
|
+
};
|
|
3774
|
+
|
|
3775
|
+
function _toConsumableArray$1(arr) { return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1(); }
|
|
3776
|
+
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."); }
|
|
3777
|
+
function _iterableToArray$1(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
3778
|
+
function _arrayWithoutHoles$1(arr) { if (Array.isArray(arr)) return _arrayLikeToArray$1(arr); }
|
|
3779
|
+
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; }
|
|
3780
|
+
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; }
|
|
3781
|
+
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; }
|
|
3782
|
+
function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
|
|
3783
|
+
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."); }
|
|
3784
|
+
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); }
|
|
3785
|
+
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; }
|
|
3786
|
+
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; }
|
|
3787
|
+
function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
|
|
3788
|
+
var FILE_INVALID_TYPE = "file-invalid-type";
|
|
3789
|
+
var FILE_TOO_LARGE = "file-too-large";
|
|
3790
|
+
var FILE_TOO_SMALL = "file-too-small";
|
|
3791
|
+
var TOO_MANY_FILES = "too-many-files";
|
|
3792
|
+
var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr(accept) {
|
|
3793
|
+
accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
|
|
3794
|
+
var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(", ")) : accept;
|
|
3795
|
+
return {
|
|
3796
|
+
code: FILE_INVALID_TYPE,
|
|
3797
|
+
message: "File type must be ".concat(messageSuffix)
|
|
3798
|
+
};
|
|
3799
|
+
};
|
|
3800
|
+
var getTooLargeRejectionErr = function getTooLargeRejectionErr(maxSize) {
|
|
3801
|
+
return {
|
|
3802
|
+
code: FILE_TOO_LARGE,
|
|
3803
|
+
message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? "byte" : "bytes")
|
|
3804
|
+
};
|
|
3805
|
+
};
|
|
3806
|
+
var getTooSmallRejectionErr = function getTooSmallRejectionErr(minSize) {
|
|
3807
|
+
return {
|
|
3808
|
+
code: FILE_TOO_SMALL,
|
|
3809
|
+
message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? "byte" : "bytes")
|
|
3810
|
+
};
|
|
3811
|
+
};
|
|
3812
|
+
var TOO_MANY_FILES_REJECTION = {
|
|
3813
|
+
code: TOO_MANY_FILES,
|
|
3814
|
+
message: "Too many files"
|
|
3815
|
+
};
|
|
3816
|
+
function fileAccepted(file, accept) {
|
|
3817
|
+
var isAcceptable = file.type === "application/x-moz-file" || _default(file, accept);
|
|
3818
|
+
return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
|
|
3819
|
+
}
|
|
3820
|
+
function fileMatchSize(file, minSize, maxSize) {
|
|
3821
|
+
if (isDefined(file.size)) {
|
|
3822
|
+
if (isDefined(minSize) && isDefined(maxSize)) {
|
|
3823
|
+
if (file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
|
|
3824
|
+
if (file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];
|
|
3825
|
+
} else if (isDefined(minSize) && file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];else if (isDefined(maxSize) && file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
|
|
3826
|
+
}
|
|
3827
|
+
return [true, null];
|
|
3828
|
+
}
|
|
3829
|
+
function isDefined(value) {
|
|
3830
|
+
return value !== undefined && value !== null;
|
|
3831
|
+
}
|
|
3832
|
+
function allFilesAccepted(_ref) {
|
|
3833
|
+
var files = _ref.files,
|
|
3834
|
+
accept = _ref.accept,
|
|
3835
|
+
minSize = _ref.minSize,
|
|
3836
|
+
maxSize = _ref.maxSize,
|
|
3837
|
+
multiple = _ref.multiple,
|
|
3838
|
+
maxFiles = _ref.maxFiles,
|
|
3839
|
+
validator = _ref.validator;
|
|
3840
|
+
if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
|
|
3841
|
+
return false;
|
|
3842
|
+
}
|
|
3843
|
+
return files.every(function (file) {
|
|
3844
|
+
var _fileAccepted = fileAccepted(file, accept),
|
|
3845
|
+
_fileAccepted2 = _slicedToArray$1(_fileAccepted, 1),
|
|
3846
|
+
accepted = _fileAccepted2[0];
|
|
3847
|
+
var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
|
|
3848
|
+
_fileMatchSize2 = _slicedToArray$1(_fileMatchSize, 1),
|
|
3849
|
+
sizeMatch = _fileMatchSize2[0];
|
|
3850
|
+
var customErrors = validator ? validator(file) : null;
|
|
3851
|
+
return accepted && sizeMatch && !customErrors;
|
|
3852
|
+
});
|
|
3853
|
+
}
|
|
3854
|
+
function isPropagationStopped(event) {
|
|
3855
|
+
if (typeof event.isPropagationStopped === "function") {
|
|
3856
|
+
return event.isPropagationStopped();
|
|
3857
|
+
} else if (typeof event.cancelBubble !== "undefined") {
|
|
3858
|
+
return event.cancelBubble;
|
|
3859
|
+
}
|
|
3860
|
+
return false;
|
|
3861
|
+
}
|
|
3862
|
+
function isEvtWithFiles(event) {
|
|
3863
|
+
if (!event.dataTransfer) {
|
|
3864
|
+
return !!event.target && !!event.target.files;
|
|
3865
|
+
}
|
|
3866
|
+
return Array.prototype.some.call(event.dataTransfer.types, function (type) {
|
|
3867
|
+
return type === "Files" || type === "application/x-moz-file";
|
|
3868
|
+
});
|
|
3869
|
+
}
|
|
3870
|
+
function onDocumentDragOver(event) {
|
|
3871
|
+
event.preventDefault();
|
|
3872
|
+
}
|
|
3873
|
+
function isIe(userAgent) {
|
|
3874
|
+
return userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident/") !== -1;
|
|
3875
|
+
}
|
|
3876
|
+
function isEdge(userAgent) {
|
|
3877
|
+
return userAgent.indexOf("Edge/") !== -1;
|
|
3878
|
+
}
|
|
3879
|
+
function isIeOrEdge() {
|
|
3880
|
+
var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent;
|
|
3881
|
+
return isIe(userAgent) || isEdge(userAgent);
|
|
3882
|
+
}
|
|
3883
|
+
function composeEventHandlers() {
|
|
3884
|
+
for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3885
|
+
fns[_key] = arguments[_key];
|
|
3886
|
+
}
|
|
3887
|
+
return function (event) {
|
|
3888
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
3889
|
+
args[_key2 - 1] = arguments[_key2];
|
|
3890
|
+
}
|
|
3891
|
+
return fns.some(function (fn) {
|
|
3892
|
+
if (!isPropagationStopped(event) && fn) {
|
|
3893
|
+
fn.apply(void 0, [event].concat(args));
|
|
3894
|
+
}
|
|
3895
|
+
return isPropagationStopped(event);
|
|
3896
|
+
});
|
|
3897
|
+
};
|
|
3898
|
+
}
|
|
3899
|
+
function canUseFileSystemAccessAPI() {
|
|
3900
|
+
return "showOpenFilePicker" in window;
|
|
3901
|
+
}
|
|
3902
|
+
function pickerOptionsFromAccept(accept) {
|
|
3903
|
+
if (isDefined(accept)) {
|
|
3904
|
+
var acceptForPicker = Object.entries(accept).filter(function (_ref2) {
|
|
3905
|
+
var _ref3 = _slicedToArray$1(_ref2, 2),
|
|
3906
|
+
mimeType = _ref3[0],
|
|
3907
|
+
ext = _ref3[1];
|
|
3908
|
+
var ok = true;
|
|
3909
|
+
if (!isMIMEType(mimeType)) {
|
|
3910
|
+
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."));
|
|
3911
|
+
ok = false;
|
|
3912
|
+
}
|
|
3913
|
+
if (!Array.isArray(ext) || !ext.every(isExt)) {
|
|
3914
|
+
console.warn("Skipped \"".concat(mimeType, "\" because an invalid file extension was provided."));
|
|
3915
|
+
ok = false;
|
|
3916
|
+
}
|
|
3917
|
+
return ok;
|
|
3918
|
+
}).reduce(function (agg, _ref4) {
|
|
3919
|
+
var _ref5 = _slicedToArray$1(_ref4, 2),
|
|
3920
|
+
mimeType = _ref5[0],
|
|
3921
|
+
ext = _ref5[1];
|
|
3922
|
+
return _objectSpread$1(_objectSpread$1({}, agg), {}, _defineProperty$1({}, mimeType, ext));
|
|
3923
|
+
}, {});
|
|
3924
|
+
return [{
|
|
3925
|
+
description: "Files",
|
|
3926
|
+
accept: acceptForPicker
|
|
3927
|
+
}];
|
|
3928
|
+
}
|
|
3929
|
+
return accept;
|
|
3930
|
+
}
|
|
3931
|
+
function acceptPropAsAcceptAttr(accept) {
|
|
3932
|
+
if (isDefined(accept)) {
|
|
3933
|
+
return Object.entries(accept).reduce(function (a, _ref6) {
|
|
3934
|
+
var _ref7 = _slicedToArray$1(_ref6, 2),
|
|
3935
|
+
mimeType = _ref7[0],
|
|
3936
|
+
ext = _ref7[1];
|
|
3937
|
+
return [].concat(_toConsumableArray$1(a), [mimeType], _toConsumableArray$1(ext));
|
|
3938
|
+
}, [])
|
|
3939
|
+
.filter(function (v) {
|
|
3940
|
+
return isMIMEType(v) || isExt(v);
|
|
3941
|
+
}).join(",");
|
|
3942
|
+
}
|
|
3943
|
+
return undefined;
|
|
3944
|
+
}
|
|
3945
|
+
function isAbort(v) {
|
|
3946
|
+
return v instanceof DOMException && (v.name === "AbortError" || v.code === v.ABORT_ERR);
|
|
3947
|
+
}
|
|
3948
|
+
function isSecurityError(v) {
|
|
3949
|
+
return v instanceof DOMException && (v.name === "SecurityError" || v.code === v.SECURITY_ERR);
|
|
3950
|
+
}
|
|
3951
|
+
function isMIMEType(v) {
|
|
3952
|
+
return v === "audio/*" || v === "video/*" || v === "image/*" || v === "text/*" || /\w+\/[-+.\w]+/g.test(v);
|
|
3953
|
+
}
|
|
3954
|
+
function isExt(v) {
|
|
3955
|
+
return /^.*\.[\w]+$/.test(v);
|
|
3956
|
+
}
|
|
3957
|
+
|
|
3958
|
+
var _excluded = ["children"],
|
|
3959
|
+
_excluded2 = ["open"],
|
|
3960
|
+
_excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
|
|
3961
|
+
_excluded4 = ["refKey", "onChange", "onClick"];
|
|
3962
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3963
|
+
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."); }
|
|
3964
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
3965
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
3966
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3967
|
+
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."); }
|
|
3968
|
+
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); }
|
|
3969
|
+
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; }
|
|
3970
|
+
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; }
|
|
3971
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
3972
|
+
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; }
|
|
3973
|
+
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; }
|
|
3974
|
+
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; }
|
|
3975
|
+
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; }
|
|
3976
|
+
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; }
|
|
3977
|
+
var Dropzone = forwardRef(function (_ref, ref) {
|
|
3978
|
+
var children = _ref.children,
|
|
3979
|
+
params = _objectWithoutProperties(_ref, _excluded);
|
|
3980
|
+
var _useDropzone = useDropzone(params),
|
|
3981
|
+
open = _useDropzone.open,
|
|
3982
|
+
props = _objectWithoutProperties(_useDropzone, _excluded2);
|
|
3983
|
+
useImperativeHandle(ref, function () {
|
|
3984
|
+
return {
|
|
3985
|
+
open: open
|
|
3986
|
+
};
|
|
3987
|
+
}, [open]);
|
|
3988
|
+
return React.createElement(Fragment, null, children(_objectSpread(_objectSpread({}, props), {}, {
|
|
3989
|
+
open: open
|
|
3990
|
+
})));
|
|
3991
|
+
});
|
|
3992
|
+
Dropzone.displayName = "Dropzone";
|
|
3993
|
+
var defaultProps = {
|
|
3994
|
+
disabled: false,
|
|
3995
|
+
getFilesFromEvent: fromEvent,
|
|
3996
|
+
maxSize: Infinity,
|
|
3997
|
+
minSize: 0,
|
|
3998
|
+
multiple: true,
|
|
3999
|
+
maxFiles: 0,
|
|
4000
|
+
preventDropOnDocument: true,
|
|
4001
|
+
noClick: false,
|
|
4002
|
+
noKeyboard: false,
|
|
4003
|
+
noDrag: false,
|
|
4004
|
+
noDragEventsBubbling: false,
|
|
4005
|
+
validator: null,
|
|
4006
|
+
useFsAccessApi: true,
|
|
4007
|
+
autoFocus: false
|
|
4008
|
+
};
|
|
4009
|
+
Dropzone.defaultProps = defaultProps;
|
|
4010
|
+
Dropzone.propTypes = {
|
|
4011
|
+
children: PropTypes.func,
|
|
4012
|
+
accept: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)),
|
|
4013
|
+
multiple: PropTypes.bool,
|
|
4014
|
+
preventDropOnDocument: PropTypes.bool,
|
|
4015
|
+
noClick: PropTypes.bool,
|
|
4016
|
+
noKeyboard: PropTypes.bool,
|
|
4017
|
+
noDrag: PropTypes.bool,
|
|
4018
|
+
noDragEventsBubbling: PropTypes.bool,
|
|
4019
|
+
minSize: PropTypes.number,
|
|
4020
|
+
maxSize: PropTypes.number,
|
|
4021
|
+
maxFiles: PropTypes.number,
|
|
4022
|
+
disabled: PropTypes.bool,
|
|
4023
|
+
getFilesFromEvent: PropTypes.func,
|
|
4024
|
+
onFileDialogCancel: PropTypes.func,
|
|
4025
|
+
onFileDialogOpen: PropTypes.func,
|
|
4026
|
+
useFsAccessApi: PropTypes.bool,
|
|
4027
|
+
autoFocus: PropTypes.bool,
|
|
4028
|
+
onDragEnter: PropTypes.func,
|
|
4029
|
+
onDragLeave: PropTypes.func,
|
|
4030
|
+
onDragOver: PropTypes.func,
|
|
4031
|
+
onDrop: PropTypes.func,
|
|
4032
|
+
onDropAccepted: PropTypes.func,
|
|
4033
|
+
onDropRejected: PropTypes.func,
|
|
4034
|
+
onError: PropTypes.func,
|
|
4035
|
+
validator: PropTypes.func
|
|
4036
|
+
};
|
|
4037
|
+
var initialState = {
|
|
4038
|
+
isFocused: false,
|
|
4039
|
+
isFileDialogActive: false,
|
|
4040
|
+
isDragActive: false,
|
|
4041
|
+
isDragAccept: false,
|
|
4042
|
+
isDragReject: false,
|
|
4043
|
+
acceptedFiles: [],
|
|
4044
|
+
fileRejections: []
|
|
4045
|
+
};
|
|
4046
|
+
function useDropzone() {
|
|
4047
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4048
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
4049
|
+
accept = _defaultProps$props.accept,
|
|
4050
|
+
disabled = _defaultProps$props.disabled,
|
|
4051
|
+
getFilesFromEvent = _defaultProps$props.getFilesFromEvent,
|
|
4052
|
+
maxSize = _defaultProps$props.maxSize,
|
|
4053
|
+
minSize = _defaultProps$props.minSize,
|
|
4054
|
+
multiple = _defaultProps$props.multiple,
|
|
4055
|
+
maxFiles = _defaultProps$props.maxFiles,
|
|
4056
|
+
onDragEnter = _defaultProps$props.onDragEnter,
|
|
4057
|
+
onDragLeave = _defaultProps$props.onDragLeave,
|
|
4058
|
+
onDragOver = _defaultProps$props.onDragOver,
|
|
4059
|
+
onDrop = _defaultProps$props.onDrop,
|
|
4060
|
+
onDropAccepted = _defaultProps$props.onDropAccepted,
|
|
4061
|
+
onDropRejected = _defaultProps$props.onDropRejected,
|
|
4062
|
+
onFileDialogCancel = _defaultProps$props.onFileDialogCancel,
|
|
4063
|
+
onFileDialogOpen = _defaultProps$props.onFileDialogOpen,
|
|
4064
|
+
useFsAccessApi = _defaultProps$props.useFsAccessApi,
|
|
4065
|
+
autoFocus = _defaultProps$props.autoFocus,
|
|
4066
|
+
preventDropOnDocument = _defaultProps$props.preventDropOnDocument,
|
|
4067
|
+
noClick = _defaultProps$props.noClick,
|
|
4068
|
+
noKeyboard = _defaultProps$props.noKeyboard,
|
|
4069
|
+
noDrag = _defaultProps$props.noDrag,
|
|
4070
|
+
noDragEventsBubbling = _defaultProps$props.noDragEventsBubbling,
|
|
4071
|
+
onError = _defaultProps$props.onError,
|
|
4072
|
+
validator = _defaultProps$props.validator;
|
|
4073
|
+
var acceptAttr = useMemo(function () {
|
|
4074
|
+
return acceptPropAsAcceptAttr(accept);
|
|
4075
|
+
}, [accept]);
|
|
4076
|
+
var pickerTypes = useMemo(function () {
|
|
4077
|
+
return pickerOptionsFromAccept(accept);
|
|
4078
|
+
}, [accept]);
|
|
4079
|
+
var onFileDialogOpenCb = useMemo(function () {
|
|
4080
|
+
return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop;
|
|
4081
|
+
}, [onFileDialogOpen]);
|
|
4082
|
+
var onFileDialogCancelCb = useMemo(function () {
|
|
4083
|
+
return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop;
|
|
4084
|
+
}, [onFileDialogCancel]);
|
|
4085
|
+
var rootRef = useRef(null);
|
|
4086
|
+
var inputRef = useRef(null);
|
|
4087
|
+
var _useReducer = useReducer(reducer, initialState),
|
|
4088
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
4089
|
+
state = _useReducer2[0],
|
|
4090
|
+
dispatch = _useReducer2[1];
|
|
4091
|
+
var isFocused = state.isFocused,
|
|
4092
|
+
isFileDialogActive = state.isFileDialogActive;
|
|
4093
|
+
var fsAccessApiWorksRef = useRef(typeof window !== "undefined" && window.isSecureContext && useFsAccessApi && canUseFileSystemAccessAPI());
|
|
4094
|
+
var onWindowFocus = function onWindowFocus() {
|
|
4095
|
+
if (!fsAccessApiWorksRef.current && isFileDialogActive) {
|
|
4096
|
+
setTimeout(function () {
|
|
4097
|
+
if (inputRef.current) {
|
|
4098
|
+
var files = inputRef.current.files;
|
|
4099
|
+
if (!files.length) {
|
|
4100
|
+
dispatch({
|
|
4101
|
+
type: "closeDialog"
|
|
4102
|
+
});
|
|
4103
|
+
onFileDialogCancelCb();
|
|
4104
|
+
}
|
|
4105
|
+
}
|
|
4106
|
+
}, 300);
|
|
4107
|
+
}
|
|
4108
|
+
};
|
|
4109
|
+
useEffect(function () {
|
|
4110
|
+
window.addEventListener("focus", onWindowFocus, false);
|
|
4111
|
+
return function () {
|
|
4112
|
+
window.removeEventListener("focus", onWindowFocus, false);
|
|
4113
|
+
};
|
|
4114
|
+
}, [inputRef, isFileDialogActive, onFileDialogCancelCb, fsAccessApiWorksRef]);
|
|
4115
|
+
var dragTargetsRef = useRef([]);
|
|
4116
|
+
var onDocumentDrop = function onDocumentDrop(event) {
|
|
4117
|
+
if (rootRef.current && rootRef.current.contains(event.target)) {
|
|
4118
|
+
return;
|
|
4119
|
+
}
|
|
4120
|
+
event.preventDefault();
|
|
4121
|
+
dragTargetsRef.current = [];
|
|
4122
|
+
};
|
|
4123
|
+
useEffect(function () {
|
|
4124
|
+
if (preventDropOnDocument) {
|
|
4125
|
+
document.addEventListener("dragover", onDocumentDragOver, false);
|
|
4126
|
+
document.addEventListener("drop", onDocumentDrop, false);
|
|
4127
|
+
}
|
|
4128
|
+
return function () {
|
|
4129
|
+
if (preventDropOnDocument) {
|
|
4130
|
+
document.removeEventListener("dragover", onDocumentDragOver);
|
|
4131
|
+
document.removeEventListener("drop", onDocumentDrop);
|
|
4132
|
+
}
|
|
4133
|
+
};
|
|
4134
|
+
}, [rootRef, preventDropOnDocument]);
|
|
4135
|
+
useEffect(function () {
|
|
4136
|
+
if (!disabled && autoFocus && rootRef.current) {
|
|
4137
|
+
rootRef.current.focus();
|
|
4138
|
+
}
|
|
4139
|
+
return function () {};
|
|
4140
|
+
}, [rootRef, autoFocus, disabled]);
|
|
4141
|
+
var onErrCb = useCallback(function (e) {
|
|
4142
|
+
if (onError) {
|
|
4143
|
+
onError(e);
|
|
4144
|
+
} else {
|
|
4145
|
+
console.error(e);
|
|
4146
|
+
}
|
|
4147
|
+
}, [onError]);
|
|
4148
|
+
var onDragEnterCb = useCallback(function (event) {
|
|
4149
|
+
event.preventDefault();
|
|
4150
|
+
event.persist();
|
|
4151
|
+
stopPropagation(event);
|
|
4152
|
+
dragTargetsRef.current = [].concat(_toConsumableArray(dragTargetsRef.current), [event.target]);
|
|
4153
|
+
if (isEvtWithFiles(event)) {
|
|
4154
|
+
Promise.resolve(getFilesFromEvent(event)).then(function (files) {
|
|
4155
|
+
if (isPropagationStopped(event) && !noDragEventsBubbling) {
|
|
4156
|
+
return;
|
|
4157
|
+
}
|
|
4158
|
+
var fileCount = files.length;
|
|
4159
|
+
var isDragAccept = fileCount > 0 && allFilesAccepted({
|
|
4160
|
+
files: files,
|
|
4161
|
+
accept: acceptAttr,
|
|
4162
|
+
minSize: minSize,
|
|
4163
|
+
maxSize: maxSize,
|
|
4164
|
+
multiple: multiple,
|
|
4165
|
+
maxFiles: maxFiles,
|
|
4166
|
+
validator: validator
|
|
4167
|
+
});
|
|
4168
|
+
var isDragReject = fileCount > 0 && !isDragAccept;
|
|
4169
|
+
dispatch({
|
|
4170
|
+
isDragAccept: isDragAccept,
|
|
4171
|
+
isDragReject: isDragReject,
|
|
4172
|
+
isDragActive: true,
|
|
4173
|
+
type: "setDraggedFiles"
|
|
4174
|
+
});
|
|
4175
|
+
if (onDragEnter) {
|
|
4176
|
+
onDragEnter(event);
|
|
4177
|
+
}
|
|
4178
|
+
}).catch(function (e) {
|
|
4179
|
+
return onErrCb(e);
|
|
4180
|
+
});
|
|
4181
|
+
}
|
|
4182
|
+
}, [getFilesFromEvent, onDragEnter, onErrCb, noDragEventsBubbling, acceptAttr, minSize, maxSize, multiple, maxFiles, validator]);
|
|
4183
|
+
var onDragOverCb = useCallback(function (event) {
|
|
4184
|
+
event.preventDefault();
|
|
4185
|
+
event.persist();
|
|
4186
|
+
stopPropagation(event);
|
|
4187
|
+
var hasFiles = isEvtWithFiles(event);
|
|
4188
|
+
if (hasFiles && event.dataTransfer) {
|
|
4189
|
+
try {
|
|
4190
|
+
event.dataTransfer.dropEffect = "copy";
|
|
4191
|
+
} catch (_unused) {}
|
|
4192
|
+
}
|
|
4193
|
+
if (hasFiles && onDragOver) {
|
|
4194
|
+
onDragOver(event);
|
|
4195
|
+
}
|
|
4196
|
+
return false;
|
|
4197
|
+
}, [onDragOver, noDragEventsBubbling]);
|
|
4198
|
+
var onDragLeaveCb = useCallback(function (event) {
|
|
4199
|
+
event.preventDefault();
|
|
4200
|
+
event.persist();
|
|
4201
|
+
stopPropagation(event);
|
|
4202
|
+
var targets = dragTargetsRef.current.filter(function (target) {
|
|
4203
|
+
return rootRef.current && rootRef.current.contains(target);
|
|
4204
|
+
});
|
|
4205
|
+
var targetIdx = targets.indexOf(event.target);
|
|
4206
|
+
if (targetIdx !== -1) {
|
|
4207
|
+
targets.splice(targetIdx, 1);
|
|
4208
|
+
}
|
|
4209
|
+
dragTargetsRef.current = targets;
|
|
4210
|
+
if (targets.length > 0) {
|
|
4211
|
+
return;
|
|
4212
|
+
}
|
|
4213
|
+
dispatch({
|
|
4214
|
+
type: "setDraggedFiles",
|
|
4215
|
+
isDragActive: false,
|
|
4216
|
+
isDragAccept: false,
|
|
4217
|
+
isDragReject: false
|
|
4218
|
+
});
|
|
4219
|
+
if (isEvtWithFiles(event) && onDragLeave) {
|
|
4220
|
+
onDragLeave(event);
|
|
4221
|
+
}
|
|
4222
|
+
}, [rootRef, onDragLeave, noDragEventsBubbling]);
|
|
4223
|
+
var setFiles = useCallback(function (files, event) {
|
|
4224
|
+
var acceptedFiles = [];
|
|
4225
|
+
var fileRejections = [];
|
|
4226
|
+
files.forEach(function (file) {
|
|
4227
|
+
var _fileAccepted = fileAccepted(file, acceptAttr),
|
|
4228
|
+
_fileAccepted2 = _slicedToArray(_fileAccepted, 2),
|
|
4229
|
+
accepted = _fileAccepted2[0],
|
|
4230
|
+
acceptError = _fileAccepted2[1];
|
|
4231
|
+
var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
|
|
4232
|
+
_fileMatchSize2 = _slicedToArray(_fileMatchSize, 2),
|
|
4233
|
+
sizeMatch = _fileMatchSize2[0],
|
|
4234
|
+
sizeError = _fileMatchSize2[1];
|
|
4235
|
+
var customErrors = validator ? validator(file) : null;
|
|
4236
|
+
if (accepted && sizeMatch && !customErrors) {
|
|
4237
|
+
acceptedFiles.push(file);
|
|
4238
|
+
} else {
|
|
4239
|
+
var errors = [acceptError, sizeError];
|
|
4240
|
+
if (customErrors) {
|
|
4241
|
+
errors = errors.concat(customErrors);
|
|
4242
|
+
}
|
|
4243
|
+
fileRejections.push({
|
|
4244
|
+
file: file,
|
|
4245
|
+
errors: errors.filter(function (e) {
|
|
4246
|
+
return e;
|
|
4247
|
+
})
|
|
4248
|
+
});
|
|
4249
|
+
}
|
|
4250
|
+
});
|
|
4251
|
+
if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
|
|
4252
|
+
acceptedFiles.forEach(function (file) {
|
|
4253
|
+
fileRejections.push({
|
|
4254
|
+
file: file,
|
|
4255
|
+
errors: [TOO_MANY_FILES_REJECTION]
|
|
4256
|
+
});
|
|
4257
|
+
});
|
|
4258
|
+
acceptedFiles.splice(0);
|
|
4259
|
+
}
|
|
4260
|
+
dispatch({
|
|
4261
|
+
acceptedFiles: acceptedFiles,
|
|
4262
|
+
fileRejections: fileRejections,
|
|
4263
|
+
type: "setFiles"
|
|
4264
|
+
});
|
|
4265
|
+
if (onDrop) {
|
|
4266
|
+
onDrop(acceptedFiles, fileRejections, event);
|
|
4267
|
+
}
|
|
4268
|
+
if (fileRejections.length > 0 && onDropRejected) {
|
|
4269
|
+
onDropRejected(fileRejections, event);
|
|
4270
|
+
}
|
|
4271
|
+
if (acceptedFiles.length > 0 && onDropAccepted) {
|
|
4272
|
+
onDropAccepted(acceptedFiles, event);
|
|
4273
|
+
}
|
|
4274
|
+
}, [dispatch, multiple, acceptAttr, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
|
|
4275
|
+
var onDropCb = useCallback(function (event) {
|
|
4276
|
+
event.preventDefault();
|
|
4277
|
+
event.persist();
|
|
4278
|
+
stopPropagation(event);
|
|
4279
|
+
dragTargetsRef.current = [];
|
|
4280
|
+
if (isEvtWithFiles(event)) {
|
|
4281
|
+
Promise.resolve(getFilesFromEvent(event)).then(function (files) {
|
|
4282
|
+
if (isPropagationStopped(event) && !noDragEventsBubbling) {
|
|
4283
|
+
return;
|
|
4284
|
+
}
|
|
4285
|
+
setFiles(files, event);
|
|
4286
|
+
}).catch(function (e) {
|
|
4287
|
+
return onErrCb(e);
|
|
4288
|
+
});
|
|
4289
|
+
}
|
|
4290
|
+
dispatch({
|
|
4291
|
+
type: "reset"
|
|
4292
|
+
});
|
|
4293
|
+
}, [getFilesFromEvent, setFiles, onErrCb, noDragEventsBubbling]);
|
|
4294
|
+
var openFileDialog = useCallback(function () {
|
|
4295
|
+
if (fsAccessApiWorksRef.current) {
|
|
4296
|
+
dispatch({
|
|
4297
|
+
type: "openDialog"
|
|
4298
|
+
});
|
|
4299
|
+
onFileDialogOpenCb();
|
|
4300
|
+
var opts = {
|
|
4301
|
+
multiple: multiple,
|
|
4302
|
+
types: pickerTypes
|
|
4303
|
+
};
|
|
4304
|
+
window.showOpenFilePicker(opts).then(function (handles) {
|
|
4305
|
+
return getFilesFromEvent(handles);
|
|
4306
|
+
}).then(function (files) {
|
|
4307
|
+
setFiles(files, null);
|
|
4308
|
+
dispatch({
|
|
4309
|
+
type: "closeDialog"
|
|
4310
|
+
});
|
|
4311
|
+
}).catch(function (e) {
|
|
4312
|
+
if (isAbort(e)) {
|
|
4313
|
+
onFileDialogCancelCb(e);
|
|
4314
|
+
dispatch({
|
|
4315
|
+
type: "closeDialog"
|
|
4316
|
+
});
|
|
4317
|
+
} else if (isSecurityError(e)) {
|
|
4318
|
+
fsAccessApiWorksRef.current = false;
|
|
4319
|
+
if (inputRef.current) {
|
|
4320
|
+
inputRef.current.value = null;
|
|
4321
|
+
inputRef.current.click();
|
|
4322
|
+
} else {
|
|
4323
|
+
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."));
|
|
4324
|
+
}
|
|
4325
|
+
} else {
|
|
4326
|
+
onErrCb(e);
|
|
4327
|
+
}
|
|
4328
|
+
});
|
|
4329
|
+
return;
|
|
4330
|
+
}
|
|
4331
|
+
if (inputRef.current) {
|
|
4332
|
+
dispatch({
|
|
4333
|
+
type: "openDialog"
|
|
4334
|
+
});
|
|
4335
|
+
onFileDialogOpenCb();
|
|
4336
|
+
inputRef.current.value = null;
|
|
4337
|
+
inputRef.current.click();
|
|
4338
|
+
}
|
|
4339
|
+
}, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, onErrCb, pickerTypes, multiple]);
|
|
4340
|
+
var onKeyDownCb = useCallback(function (event) {
|
|
4341
|
+
if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
|
|
4342
|
+
return;
|
|
4343
|
+
}
|
|
4344
|
+
if (event.key === " " || event.key === "Enter" || event.keyCode === 32 || event.keyCode === 13) {
|
|
4345
|
+
event.preventDefault();
|
|
4346
|
+
openFileDialog();
|
|
4347
|
+
}
|
|
4348
|
+
}, [rootRef, openFileDialog]);
|
|
4349
|
+
var onFocusCb = useCallback(function () {
|
|
4350
|
+
dispatch({
|
|
4351
|
+
type: "focus"
|
|
4352
|
+
});
|
|
4353
|
+
}, []);
|
|
4354
|
+
var onBlurCb = useCallback(function () {
|
|
4355
|
+
dispatch({
|
|
4356
|
+
type: "blur"
|
|
4357
|
+
});
|
|
4358
|
+
}, []);
|
|
4359
|
+
var onClickCb = useCallback(function () {
|
|
4360
|
+
if (noClick) {
|
|
4361
|
+
return;
|
|
4362
|
+
}
|
|
4363
|
+
if (isIeOrEdge()) {
|
|
4364
|
+
setTimeout(openFileDialog, 0);
|
|
4365
|
+
} else {
|
|
4366
|
+
openFileDialog();
|
|
4367
|
+
}
|
|
4368
|
+
}, [noClick, openFileDialog]);
|
|
4369
|
+
var composeHandler = function composeHandler(fn) {
|
|
4370
|
+
return disabled ? null : fn;
|
|
4371
|
+
};
|
|
4372
|
+
var composeKeyboardHandler = function composeKeyboardHandler(fn) {
|
|
4373
|
+
return noKeyboard ? null : composeHandler(fn);
|
|
4374
|
+
};
|
|
4375
|
+
var composeDragHandler = function composeDragHandler(fn) {
|
|
4376
|
+
return noDrag ? null : composeHandler(fn);
|
|
4377
|
+
};
|
|
4378
|
+
var stopPropagation = function stopPropagation(event) {
|
|
4379
|
+
if (noDragEventsBubbling) {
|
|
4380
|
+
event.stopPropagation();
|
|
4381
|
+
}
|
|
4382
|
+
};
|
|
4383
|
+
var getRootProps = useMemo(function () {
|
|
4384
|
+
return function () {
|
|
4385
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
4386
|
+
_ref2$refKey = _ref2.refKey,
|
|
4387
|
+
refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey,
|
|
4388
|
+
role = _ref2.role,
|
|
4389
|
+
onKeyDown = _ref2.onKeyDown,
|
|
4390
|
+
onFocus = _ref2.onFocus,
|
|
4391
|
+
onBlur = _ref2.onBlur,
|
|
4392
|
+
onClick = _ref2.onClick,
|
|
4393
|
+
onDragEnter = _ref2.onDragEnter,
|
|
4394
|
+
onDragOver = _ref2.onDragOver,
|
|
4395
|
+
onDragLeave = _ref2.onDragLeave,
|
|
4396
|
+
onDrop = _ref2.onDrop,
|
|
4397
|
+
rest = _objectWithoutProperties(_ref2, _excluded3);
|
|
4398
|
+
return _objectSpread(_objectSpread(_defineProperty({
|
|
4399
|
+
onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
|
|
4400
|
+
onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
|
|
4401
|
+
onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
|
|
4402
|
+
onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
|
|
4403
|
+
onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter, onDragEnterCb)),
|
|
4404
|
+
onDragOver: composeDragHandler(composeEventHandlers(onDragOver, onDragOverCb)),
|
|
4405
|
+
onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave, onDragLeaveCb)),
|
|
4406
|
+
onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb)),
|
|
4407
|
+
role: typeof role === "string" && role !== "" ? role : "presentation"
|
|
4408
|
+
}, refKey, rootRef), !disabled && !noKeyboard ? {
|
|
4409
|
+
tabIndex: 0
|
|
4410
|
+
} : {}), rest);
|
|
4411
|
+
};
|
|
4412
|
+
}, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
|
|
4413
|
+
var onInputElementClick = useCallback(function (event) {
|
|
4414
|
+
event.stopPropagation();
|
|
4415
|
+
}, []);
|
|
4416
|
+
var getInputProps = useMemo(function () {
|
|
4417
|
+
return function () {
|
|
4418
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
4419
|
+
_ref3$refKey = _ref3.refKey,
|
|
4420
|
+
refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey,
|
|
4421
|
+
onChange = _ref3.onChange,
|
|
4422
|
+
onClick = _ref3.onClick,
|
|
4423
|
+
rest = _objectWithoutProperties(_ref3, _excluded4);
|
|
4424
|
+
var inputProps = _defineProperty({
|
|
4425
|
+
accept: acceptAttr,
|
|
4426
|
+
multiple: multiple,
|
|
4427
|
+
type: "file",
|
|
4428
|
+
style: {
|
|
4429
|
+
display: "none"
|
|
4430
|
+
},
|
|
4431
|
+
onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
|
|
4432
|
+
onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
|
|
4433
|
+
tabIndex: -1
|
|
4434
|
+
}, refKey, inputRef);
|
|
4435
|
+
return _objectSpread(_objectSpread({}, inputProps), rest);
|
|
4436
|
+
};
|
|
4437
|
+
}, [inputRef, accept, multiple, onDropCb, disabled]);
|
|
4438
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
4439
|
+
isFocused: isFocused && !disabled,
|
|
4440
|
+
getRootProps: getRootProps,
|
|
4441
|
+
getInputProps: getInputProps,
|
|
4442
|
+
rootRef: rootRef,
|
|
4443
|
+
inputRef: inputRef,
|
|
4444
|
+
open: composeHandler(openFileDialog)
|
|
4445
|
+
});
|
|
4446
|
+
}
|
|
4447
|
+
function reducer(state, action) {
|
|
4448
|
+
switch (action.type) {
|
|
4449
|
+
case "focus":
|
|
4450
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
4451
|
+
isFocused: true
|
|
4452
|
+
});
|
|
4453
|
+
case "blur":
|
|
4454
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
4455
|
+
isFocused: false
|
|
4456
|
+
});
|
|
4457
|
+
case "openDialog":
|
|
4458
|
+
return _objectSpread(_objectSpread({}, initialState), {}, {
|
|
4459
|
+
isFileDialogActive: true
|
|
4460
|
+
});
|
|
4461
|
+
case "closeDialog":
|
|
4462
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
4463
|
+
isFileDialogActive: false
|
|
4464
|
+
});
|
|
4465
|
+
case "setDraggedFiles":
|
|
4466
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
4467
|
+
isDragActive: action.isDragActive,
|
|
4468
|
+
isDragAccept: action.isDragAccept,
|
|
4469
|
+
isDragReject: action.isDragReject
|
|
4470
|
+
});
|
|
4471
|
+
case "setFiles":
|
|
4472
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
4473
|
+
acceptedFiles: action.acceptedFiles,
|
|
4474
|
+
fileRejections: action.fileRejections
|
|
4475
|
+
});
|
|
4476
|
+
case "reset":
|
|
4477
|
+
return _objectSpread({}, initialState);
|
|
4478
|
+
default:
|
|
4479
|
+
return state;
|
|
4480
|
+
}
|
|
4481
|
+
}
|
|
4482
|
+
function noop() {}
|
|
4483
|
+
|
|
4484
|
+
var FileInputGroupForm = function (props) {
|
|
4485
|
+
var _a = props.name, name = _a === void 0 ? 'multiple-file-input' : _a, label = props.label, description = props.description, required = props.required, value = props.value, _b = props.max, max = _b === void 0 ? 10 * 1024 * 1024 : _b, error = props.error, isDisabled = props.isDisabled, _c = props.isRequired, isRequired = _c === void 0 ? false : _c, _d = props.isTouched, isTouched = _d === void 0 ? false : _d, children = props.children, onChange = props.onChange, onBlur = props.onBlur, stylesOverrides = props.styles;
|
|
4486
|
+
var isValid = error === undefined;
|
|
4487
|
+
var _e = useState(false), isDragging = _e[0], setIsDragging = _e[1];
|
|
4488
|
+
var handleChangeInput = useCallback(function (file) {
|
|
4489
|
+
var reader = new FileReader();
|
|
4490
|
+
reader === null || reader === void 0 ? void 0 : reader.readAsDataURL(file);
|
|
4491
|
+
reader.onload = function () {
|
|
4492
|
+
var result = {
|
|
4493
|
+
name: file.name,
|
|
4494
|
+
size: file.size,
|
|
4495
|
+
type: file.type,
|
|
4496
|
+
blob: reader === null || reader === void 0 ? void 0 : reader.result,
|
|
4497
|
+
file: file,
|
|
4498
|
+
};
|
|
4499
|
+
if (max && max < result.size) {
|
|
4500
|
+
return;
|
|
4501
|
+
}
|
|
4502
|
+
onChange(result);
|
|
4503
|
+
};
|
|
4504
|
+
}, [max, onChange]);
|
|
4505
|
+
var onDrop = useCallback(function (files) {
|
|
4506
|
+
setIsDragging(false);
|
|
4507
|
+
handleChangeInput(files[0]);
|
|
4508
|
+
}, [handleChangeInput]);
|
|
4509
|
+
var _f = useDropzone({
|
|
4510
|
+
onDrop: onDrop,
|
|
4511
|
+
multiple: false,
|
|
4512
|
+
onError: function () {
|
|
4513
|
+
// console.log('error');
|
|
4514
|
+
// setFieldError('file', t('component.form.error.multipleFiles') as string);
|
|
4515
|
+
},
|
|
4516
|
+
onDragEnter: function () {
|
|
4517
|
+
setIsDragging(true);
|
|
4518
|
+
},
|
|
4519
|
+
onDragLeave: function () {
|
|
4520
|
+
setIsDragging(false);
|
|
4521
|
+
},
|
|
4522
|
+
}), getRootProps = _f.getRootProps, getInputProps = _f.getInputProps;
|
|
4523
|
+
var handleGenerateStyle = function () {
|
|
4524
|
+
var result = deepCopyObject(styles.base);
|
|
4525
|
+
var keys = calculateNestedKeys(styles.base);
|
|
4526
|
+
keys.forEach(function (key) {
|
|
4527
|
+
set(result, key, toClassName(get(styles.base, key), isTouched === true && !isValid && get(styles.invalid, key), isDisabled && get(styles.disabled, key), get(stylesOverrides, key)));
|
|
4528
|
+
});
|
|
4529
|
+
return result;
|
|
4530
|
+
};
|
|
4531
|
+
var styles$1 = handleGenerateStyle();
|
|
4532
|
+
var input = getInputProps();
|
|
4533
|
+
return (jsxs("div", { className: styles$1.container, children: [jsxs("div", { className: styles$1.head, children: [label && (jsx("label", { htmlFor: name, className: styles$1.label, children: label })), !required && !isRequired && typeof label === 'string' && (jsx("span", { className: styles$1.hint, children: "Optional" })), required && required({ isRequired: isRequired })] }), jsxs("div", __assign({ className: styles$1.body }, getRootProps(), { children: [children && children({ value: value, isDragging: isDragging }), jsx("input", { name: name, accept: input.accept, multiple: input.multiple, onChange: input.onChange, ref: input === null || input === void 0 ? void 0 : input.ref, style: input.style, tabIndex: input.tabIndex, type: input.type, onBlur: onBlur })] })), jsxs("div", { className: styles$1.foot, children: [description && !(error && isTouched) && (jsx("p", { className: styles$1.description, children: description })), error && isTouched && jsx("p", { className: styles$1.error, children: error })] })] }));
|
|
4534
|
+
};
|
|
4535
|
+
|
|
4536
|
+
var base = {
|
|
4537
|
+
container: '',
|
|
4538
|
+
head: 'flex justify-between',
|
|
4539
|
+
body: 'relative rounded-md py-2',
|
|
4540
|
+
foot: '',
|
|
4541
|
+
label: 'block font-medium text-gray-900',
|
|
4542
|
+
hint: 'text-xs text-gray-500',
|
|
4543
|
+
leading: 'pointer-events-none absolute inset-y-0 left-0 flex items-center',
|
|
4544
|
+
input: 'block w-full',
|
|
4545
|
+
trailing: 'pointer-events-none absolute inset-y-0 right-0 flex items-center',
|
|
4546
|
+
description: 'text-gray-400 text-xs mt-1',
|
|
4547
|
+
error: 'text-red-500 text-xs mt-1',
|
|
4548
|
+
};
|
|
4549
|
+
var leading = {
|
|
4550
|
+
input: 'pl-10',
|
|
4551
|
+
};
|
|
4552
|
+
var trailing = {};
|
|
4553
|
+
var normal = {
|
|
4554
|
+
label: 'leading-6 text-sm mb-2',
|
|
4555
|
+
hint: 'leading-6',
|
|
4556
|
+
leading: 'pl-3',
|
|
4557
|
+
input: 'rounded-md border-gray-200 shadow-sm focus:border-primary-500 focus:ring-primary-500 sm:text-sm placeholder-gray-300',
|
|
4558
|
+
trailing: 'pr-3',
|
|
4559
|
+
description: 'mt-2 text-sm',
|
|
4560
|
+
};
|
|
4561
|
+
var inset = {
|
|
4562
|
+
container: 'rounded-md px-3 pt-2.5 pb-1.5 shadow-sm ring-1 ring-inset ring-gray-300 focus-within:ring-2 focus-within:ring-primary-600',
|
|
4563
|
+
label: 'text-xs',
|
|
4564
|
+
hint: 'text-xs',
|
|
4565
|
+
input: 'border-0 !ring-0 p-0 text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm pl-0',
|
|
4566
|
+
description: 'hidden',
|
|
4567
|
+
};
|
|
4568
|
+
var overlapping = {
|
|
4569
|
+
container: 'relative',
|
|
4570
|
+
head: ' absolute flex justify-between items-center left-0 -top-2 right-0 mx-2 z-10 w-full',
|
|
4571
|
+
label: 'inline-block bg-white px-1 text-xs font-medium text-gray-900 ',
|
|
4572
|
+
hint: 'text-xs mr-4 bg-white px-1',
|
|
4573
|
+
input: 'block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6',
|
|
4574
|
+
description: 'hidden',
|
|
4575
|
+
};
|
|
4576
|
+
var pill = {
|
|
4577
|
+
head: 'mx-px block px-4 text-sm font-medium leading-6 text-gray-900 mb-1 pr-6',
|
|
4578
|
+
foot: 'mx-px block px-4 text-sm font-medium leading-6 text-gray-900 mt-1 pr-6',
|
|
4579
|
+
input: 'block w-full rounded-full border-0 px-4 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6',
|
|
4580
|
+
trailing: 'pr-2',
|
|
4581
|
+
description: 'text-xs',
|
|
4582
|
+
};
|
|
4583
|
+
var floored = {
|
|
4584
|
+
body: 'relative mt-2',
|
|
4585
|
+
label: 'block text-sm font-medium leading-6 text-gray-900',
|
|
4586
|
+
input: 'peer block w-full border-0 bg-gray-50 py-1.5 text-gray-900 focus:ring-0 sm:text-sm sm:leading-6 ring-0',
|
|
4587
|
+
description: 'text-xs mt-2',
|
|
4588
|
+
};
|
|
4589
|
+
var invalid = {
|
|
4590
|
+
container: 'ring-red-500',
|
|
4591
|
+
input:
|
|
4592
|
+
// 'block w-full border border-transparent text-red-900 ring-1 ring-inset ring-red-300 placeholder:text-red-300 focus:ring-2 focus:ring-inset focus:ring-red-500 sm:leading-6 pr-10',
|
|
4593
|
+
'block w-full border border-transparent text-red-900 ring-1 ring-inset ring-red-300 placeholder:text-red-300 focus:ring-2 focus:ring-inset focus:ring-red-500 pr-10',
|
|
4594
|
+
description: 'text-sm text-red-600',
|
|
4595
|
+
};
|
|
4596
|
+
var disabled = {
|
|
4597
|
+
input: 'block w-full rounded-md border-0 text-gray-900 shadow-sm ring-1 ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-500 disabled:ring-gray-200',
|
|
4598
|
+
};
|
|
2545
4599
|
var styles = {
|
|
2546
4600
|
base: base,
|
|
4601
|
+
leading: leading,
|
|
4602
|
+
trailing: trailing,
|
|
4603
|
+
normal: normal,
|
|
4604
|
+
inset: inset,
|
|
4605
|
+
overlapping: overlapping,
|
|
4606
|
+
pill: pill,
|
|
4607
|
+
floored: floored,
|
|
4608
|
+
invalid: invalid,
|
|
2547
4609
|
disabled: disabled,
|
|
2548
4610
|
};
|
|
2549
4611
|
|
|
2550
|
-
export { AvatarElement, BadgeElement, BreadcrumbsNavigation, ButtonElement, ButtonGroupElement, CheckboxInputGroupForm as CheckboxInputFormGroup, ContainerLayout, DateMenuForm, DividerLayout, DropdownElement, IconElement, InputGroupForm, ListContainerLayout, MediaObjectLayout, ModalOverlay, NotificationOverlay, PagePaginationNavigation, LayoutPanel as PanelLayout, PanelPaginationNavigation, SelectMenuForm, SlideOverOverlay, TabNavigation, TableColumnOptionsCustom, TableExcelExportCustom as TableExportCustom, TableList, TableList2, VerticalNavigation, createColumnHelper, fromSelectMenuOptionToStringValue };
|
|
4612
|
+
export { AvatarElement, BadgeElement, BreadcrumbsNavigation, ButtonElement, ButtonGroupElement, CheckboxInputGroupForm as CheckboxInputFormGroup, ContainerLayout, DateMenuForm, DividerLayout, DropdownElement, FileInputGroupForm as FileInputFormGroup, IconElement, InputGroupForm, ListContainerLayout, MediaObjectLayout, ModalOverlay, NotificationOverlay, PagePaginationNavigation, LayoutPanel as PanelLayout, PanelPaginationNavigation, SelectMenuForm, SlideOverOverlay, TabNavigation, TableColumnOptionsCustom, TableExcelExportCustom as TableExportCustom, TableList, TableList2, VerticalNavigation, createColumnHelper, fromSelectMenuOptionToStringValue };
|
|
2551
4613
|
//# sourceMappingURL=index.esm.js.map
|