@torq-north/react-tools 1.4.2 → 1.4.4
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.cjs +40 -240
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +40 -240
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -2
package/dist/index.es.js
CHANGED
|
@@ -386,154 +386,6 @@ function FieldWrapper(_a) {
|
|
|
386
386
|
return (jsxs(Stack, { direction: "row", alignItems: "center", children: [(icon || showSpace) && (jsx(Box, { minWidth: 32, color: "primary.main", mt: 2, mx: 1, children: icon })), children] }));
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
function getDefaultExportFromCjs (x) {
|
|
390
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
var cjs;
|
|
394
|
-
var hasRequiredCjs;
|
|
395
|
-
|
|
396
|
-
function requireCjs () {
|
|
397
|
-
if (hasRequiredCjs) return cjs;
|
|
398
|
-
hasRequiredCjs = 1;
|
|
399
|
-
|
|
400
|
-
var isMergeableObject = function isMergeableObject(value) {
|
|
401
|
-
return isNonNullObject(value)
|
|
402
|
-
&& !isSpecial(value)
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
function isNonNullObject(value) {
|
|
406
|
-
return !!value && typeof value === 'object'
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
function isSpecial(value) {
|
|
410
|
-
var stringValue = Object.prototype.toString.call(value);
|
|
411
|
-
|
|
412
|
-
return stringValue === '[object RegExp]'
|
|
413
|
-
|| stringValue === '[object Date]'
|
|
414
|
-
|| isReactElement(value)
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
|
418
|
-
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
419
|
-
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
420
|
-
|
|
421
|
-
function isReactElement(value) {
|
|
422
|
-
return value.$$typeof === REACT_ELEMENT_TYPE
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
function emptyTarget(val) {
|
|
426
|
-
return Array.isArray(val) ? [] : {}
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
430
|
-
return (options.clone !== false && options.isMergeableObject(value))
|
|
431
|
-
? deepmerge(emptyTarget(value), value, options)
|
|
432
|
-
: value
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
function defaultArrayMerge(target, source, options) {
|
|
436
|
-
return target.concat(source).map(function(element) {
|
|
437
|
-
return cloneUnlessOtherwiseSpecified(element, options)
|
|
438
|
-
})
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
function getMergeFunction(key, options) {
|
|
442
|
-
if (!options.customMerge) {
|
|
443
|
-
return deepmerge
|
|
444
|
-
}
|
|
445
|
-
var customMerge = options.customMerge(key);
|
|
446
|
-
return typeof customMerge === 'function' ? customMerge : deepmerge
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
function getEnumerableOwnPropertySymbols(target) {
|
|
450
|
-
return Object.getOwnPropertySymbols
|
|
451
|
-
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
452
|
-
return Object.propertyIsEnumerable.call(target, symbol)
|
|
453
|
-
})
|
|
454
|
-
: []
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
function getKeys(target) {
|
|
458
|
-
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
function propertyIsOnObject(object, property) {
|
|
462
|
-
try {
|
|
463
|
-
return property in object
|
|
464
|
-
} catch(_) {
|
|
465
|
-
return false
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
// Protects from prototype poisoning and unexpected merging up the prototype chain.
|
|
470
|
-
function propertyIsUnsafe(target, key) {
|
|
471
|
-
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
|
|
472
|
-
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
|
|
473
|
-
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
function mergeObject(target, source, options) {
|
|
477
|
-
var destination = {};
|
|
478
|
-
if (options.isMergeableObject(target)) {
|
|
479
|
-
getKeys(target).forEach(function(key) {
|
|
480
|
-
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
getKeys(source).forEach(function(key) {
|
|
484
|
-
if (propertyIsUnsafe(target, key)) {
|
|
485
|
-
return
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
489
|
-
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
490
|
-
} else {
|
|
491
|
-
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
492
|
-
}
|
|
493
|
-
});
|
|
494
|
-
return destination
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
function deepmerge(target, source, options) {
|
|
498
|
-
options = options || {};
|
|
499
|
-
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
500
|
-
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
501
|
-
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
|
502
|
-
// implementations can use it. The caller may not replace it.
|
|
503
|
-
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
504
|
-
|
|
505
|
-
var sourceIsArray = Array.isArray(source);
|
|
506
|
-
var targetIsArray = Array.isArray(target);
|
|
507
|
-
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
508
|
-
|
|
509
|
-
if (!sourceAndTargetTypesMatch) {
|
|
510
|
-
return cloneUnlessOtherwiseSpecified(source, options)
|
|
511
|
-
} else if (sourceIsArray) {
|
|
512
|
-
return options.arrayMerge(target, source, options)
|
|
513
|
-
} else {
|
|
514
|
-
return mergeObject(target, source, options)
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
deepmerge.all = function deepmergeAll(array, options) {
|
|
519
|
-
if (!Array.isArray(array)) {
|
|
520
|
-
throw new Error('first argument should be an array')
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
return array.reduce(function(prev, next) {
|
|
524
|
-
return deepmerge(prev, next, options)
|
|
525
|
-
}, {})
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
var deepmerge_1 = deepmerge;
|
|
529
|
-
|
|
530
|
-
cjs = deepmerge_1;
|
|
531
|
-
return cjs;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
var cjsExports = requireCjs();
|
|
535
|
-
var deepmerge = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
|
|
536
|
-
|
|
537
389
|
// https://codesandbox.io/s/github/final-form/react-final-form/tree/master/examples/field-level-validation?file=/index.js:557-691
|
|
538
390
|
function composeValidators() {
|
|
539
391
|
var validators = [];
|
|
@@ -560,18 +412,12 @@ function TextFormField(_a) {
|
|
|
560
412
|
var name = _a.name, label = _a.label, required = _a.required, multiline = _a.multiline, disabled = _a.disabled, placeholder = _a.placeholder, slotProps = _a.slotProps, helperText = _a.helperText, icon = _a.icon, showSpace = _a.showSpace, format = _a.format, _c = _a.validators, validators = _c === void 0 ? [] : _c;
|
|
561
413
|
var _d = useField(name, __assign({ format: format, validate: required
|
|
562
414
|
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), input = _d.input, meta = _d.meta;
|
|
563
|
-
var
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
placeholder: placeholder,
|
|
570
|
-
error: meta.touched && meta.error,
|
|
571
|
-
helperText: (meta.touched && meta.error) || helperText,
|
|
572
|
-
slotProps: { input: input },
|
|
573
|
-
}, (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) !== null && _b !== void 0 ? _b : {});
|
|
574
|
-
return (jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsx(TextField, __assign({}, textFieldProps)) }));
|
|
415
|
+
var _e = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) !== null && _b !== void 0 ? _b : {}), textFieldSlotProps = _e.slotProps, remainingTextFieldProps = __rest(_e, ["slotProps"]);
|
|
416
|
+
var inputSlotProp = textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.input;
|
|
417
|
+
var mergedSlotProps = __assign(__assign({}, textFieldSlotProps), { input: typeof inputSlotProp === "function"
|
|
418
|
+
? function (ownerState) { return (__assign(__assign({}, input), inputSlotProp(ownerState))); }
|
|
419
|
+
: __assign(__assign({}, input), inputSlotProp) });
|
|
420
|
+
return (jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsx(TextField, __assign({ fullWidth: true, label: label, required: required, multiline: multiline, disabled: disabled, placeholder: placeholder, error: meta.touched && meta.error, helperText: (meta.touched && meta.error) || helperText, slotProps: mergedSlotProps }, remainingTextFieldProps)) }));
|
|
575
421
|
}
|
|
576
422
|
|
|
577
423
|
function isGroup(o) {
|
|
@@ -618,25 +464,17 @@ function SelectFormField(_a) {
|
|
|
618
464
|
var name = _a.name, label = _a.label, required = _a.required, disabled = _a.disabled, helperText = _a.helperText, slotProps = _a.slotProps, isClearable = _a.isClearable, options = _a.options, icon = _a.icon, showSpace = _a.showSpace, format = _a.format, _d = _a.validators, validators = _d === void 0 ? [] : _d;
|
|
619
465
|
var _e = useField(name, __assign({ format: format, validate: required
|
|
620
466
|
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), _f = _e.input, value = _f.value, onChange = _f.onChange, otherInputProps = __rest(_f, ["value", "onChange"]), meta = _e.meta;
|
|
621
|
-
var
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
onChange: onChange,
|
|
631
|
-
slotProps: {
|
|
632
|
-
input: otherInputProps,
|
|
633
|
-
select: {
|
|
634
|
-
endAdornment: isClearable ? (jsx(Box, { pr: 2, children: jsx(IconButton, { size: (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) === null || _b === void 0 ? void 0 : _b.size, onClick: function () { return onChange(undefined); }, children: jsx(CloseIcon, { fontSize: "inherit" }) }) })) : undefined,
|
|
635
|
-
},
|
|
636
|
-
},
|
|
637
|
-
}, (_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) !== null && _c !== void 0 ? _c : {});
|
|
467
|
+
var _g = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) !== null && _b !== void 0 ? _b : {}), textFieldSlotProps = _g.slotProps, remainingTextFieldProps = __rest(_g, ["slotProps"]);
|
|
468
|
+
// SlotProps can be an object or a callback; we only support the object form here.
|
|
469
|
+
var inputSlotProps = typeof (textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.input) === "function"
|
|
470
|
+
? undefined
|
|
471
|
+
: textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.input;
|
|
472
|
+
var hasEndAdornment = isClearable || (inputSlotProps === null || inputSlotProps === void 0 ? void 0 : inputSlotProps.endAdornment);
|
|
473
|
+
var mergedSlotProps = __assign(__assign({}, textFieldSlotProps), { input: __assign(__assign({}, otherInputProps), inputSlotProps), select: __assign(__assign({}, textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.select), (hasEndAdornment && {
|
|
474
|
+
endAdornment: (jsxs(Stack, { direction: "row", spacing: 1, pr: 2, children: [inputSlotProps === null || inputSlotProps === void 0 ? void 0 : inputSlotProps.endAdornment, " ", isClearable && (jsx(IconButton, { size: (_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) === null || _c === void 0 ? void 0 : _c.size, onClick: function () { return onChange(undefined); }, children: jsx(CloseIcon, { fontSize: "inherit" }) }))] })),
|
|
475
|
+
})) });
|
|
638
476
|
var renderedOptions = useMemo(function () { return renderSelectOptions(options); }, [options]);
|
|
639
|
-
return (jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxs(TextField, __assign({},
|
|
477
|
+
return (jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxs(TextField, __assign({ fullWidth: true, select: true, label: label, required: required, disabled: disabled, error: meta.touched && meta.error, helperText: (meta.touched && meta.error) || helperText, value: value ? value : [], onChange: onChange, slotProps: mergedSlotProps }, remainingTextFieldProps, { children: [renderedOptions, !options && jsx(MenuItem, {})] })) }));
|
|
640
478
|
}
|
|
641
479
|
|
|
642
480
|
function findTextFor(value, options) {
|
|
@@ -665,29 +503,16 @@ function MultiSelectFormField(_a) {
|
|
|
665
503
|
var name = _a.name, label = _a.label, required = _a.required, disabled = _a.disabled, helperText = _a.helperText, slotProps = _a.slotProps, isClearable = _a.isClearable, options = _a.options, icon = _a.icon, showSpace = _a.showSpace, format = _a.format, _d = _a.validators, validators = _d === void 0 ? [] : _d;
|
|
666
504
|
var _e = useField(name, __assign({ format: format, validate: required
|
|
667
505
|
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), _f = _e.input, value = _f.value, onChange = _f.onChange, otherInputProps = __rest(_f, ["value", "onChange"]), meta = _e.meta;
|
|
668
|
-
var
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
value: value ? value : [],
|
|
677
|
-
onChange: onChange,
|
|
678
|
-
slotProps: {
|
|
679
|
-
input: otherInputProps,
|
|
680
|
-
select: {
|
|
681
|
-
endAdornment: isClearable ? (jsx(Box, { pr: 2, children: jsx(IconButton, { size: (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) === null || _b === void 0 ? void 0 : _b.size, onClick: function () { return onChange([]); }, children: jsx(CloseIcon, { fontSize: "inherit" }) }) })) : undefined,
|
|
682
|
-
multiple: true,
|
|
683
|
-
renderValue: function (selected) { return (jsx(Box, { whiteSpace: "normal", children: selected
|
|
684
|
-
.map(function (s) { var _a; return (_a = findTextFor(s, options)) !== null && _a !== void 0 ? _a : "Unknown"; })
|
|
685
|
-
.join(", ") })); },
|
|
686
|
-
},
|
|
687
|
-
},
|
|
688
|
-
}, (_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) !== null && _c !== void 0 ? _c : {});
|
|
506
|
+
var _g = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) !== null && _b !== void 0 ? _b : {}), textFieldSlotProps = _g.slotProps, remainingTextFieldProps = __rest(_g, ["slotProps"]);
|
|
507
|
+
// SlotProps can be an object or a callback; we only support the object form here.
|
|
508
|
+
var inputSlotProps = typeof (textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.input) === "function"
|
|
509
|
+
? undefined
|
|
510
|
+
: textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.input;
|
|
511
|
+
var mergedSlotProps = __assign(__assign({}, textFieldSlotProps), { input: __assign(__assign({}, otherInputProps), inputSlotProps), select: __assign(__assign({}, textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.select), { endAdornment: (jsxs(Stack, { direction: "row", spacing: 1, pr: 2, children: [inputSlotProps === null || inputSlotProps === void 0 ? void 0 : inputSlotProps.endAdornment, " ", isClearable && (jsx(IconButton, { size: (_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) === null || _c === void 0 ? void 0 : _c.size, onClick: function () { return onChange([]); }, children: jsx(CloseIcon, { fontSize: "inherit" }) }))] })), multiple: true, renderValue: function (selected) { return (jsx(Box, { whiteSpace: "normal", children: selected
|
|
512
|
+
.map(function (s) { var _a; return (_a = findTextFor(s, options)) !== null && _a !== void 0 ? _a : "Unknown"; })
|
|
513
|
+
.join(", ") })); } }) });
|
|
689
514
|
var renderedOptions = useMemo(function () { return renderCheckboxSelectOptions(options, value); }, [options, value]);
|
|
690
|
-
return (jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxs(TextField, __assign({},
|
|
515
|
+
return (jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxs(TextField, __assign({ fullWidth: true, select: true, label: label, required: required, disabled: disabled, error: meta.touched && meta.error, helperText: (meta.touched && meta.error) || helperText, value: value ? value : [], onChange: onChange, slotProps: mergedSlotProps }, remainingTextFieldProps, { children: [renderedOptions, !options && jsx(MenuItem, {})] })) }));
|
|
691
516
|
}
|
|
692
517
|
|
|
693
518
|
var mustBeChecked = function (v) {
|
|
@@ -695,11 +520,10 @@ var mustBeChecked = function (v) {
|
|
|
695
520
|
};
|
|
696
521
|
|
|
697
522
|
var CheckboxFormField = function (_a) {
|
|
698
|
-
var _b;
|
|
699
|
-
var
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
var checkboxProps = deepmerge(__assign(__assign({}, input), { disabled: disabled }), (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.checkbox) !== null && _b !== void 0 ? _b : {});
|
|
523
|
+
var name = _a.name, label = _a.label, mustBeTrue = _a.mustBeTrue, disabled = _a.disabled, helperText = _a.helperText, slotProps = _a.slotProps, icon = _a.icon, showSpace = _a.showSpace, _b = _a.validators, validators = _b === void 0 ? [] : _b, forceError = _a.forceError;
|
|
524
|
+
var _c = useField(name, __assign({ type: "checkbox", validate: mustBeTrue
|
|
525
|
+
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [mustBeChecked], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), input = _c.input, meta = _c.meta;
|
|
526
|
+
var checkboxProps = __assign(__assign(__assign({}, input), { disabled: disabled }), slotProps === null || slotProps === void 0 ? void 0 : slotProps.checkbox);
|
|
703
527
|
return (jsxs(FieldWrapper, { icon: icon, showSpace: showSpace, children: [jsx(FormControlLabel, { control: jsx(FormGroup, { children: jsx(Checkbox, __assign({}, checkboxProps)) }), label: label, disabled: disabled }), ((meta.touched && meta.error) || helperText) && (jsx(FormHelperText, { disabled: disabled, error: (meta.touched && meta.error) || forceError, sx: { marginTop: 0, marginLeft: 2 }, children: meta.error || helperText }))] }));
|
|
704
528
|
};
|
|
705
529
|
|
|
@@ -708,25 +532,11 @@ var DateFormField = function (_a) {
|
|
|
708
532
|
var name = _a.name, label = _a.label, required = _a.required, icon = _a.icon, showSpace = _a.showSpace, slotProps = _a.slotProps, disabled = _a.disabled, helperText = _a.helperText, format = _a.format, _c = _a.validators, validators = _c === void 0 ? [] : _c, _d = _a.formatAsDate, formatAsDate = _d === void 0 ? false : _d;
|
|
709
533
|
var _e = useField(name, __assign({ format: format, validate: required
|
|
710
534
|
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), input = _e.input, meta = _e.meta;
|
|
711
|
-
var
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
views: ["year", "month", "day"],
|
|
715
|
-
slotProps: {
|
|
716
|
-
textField: {
|
|
717
|
-
fullWidth: true,
|
|
718
|
-
required: required,
|
|
719
|
-
color: meta.touched && meta.error ? "error" : undefined,
|
|
720
|
-
error: meta.touched && meta.error,
|
|
721
|
-
helperText: (meta.touched && meta.error) || helperText,
|
|
722
|
-
onFocus: input.onFocus,
|
|
723
|
-
onBlur: input.onBlur,
|
|
724
|
-
},
|
|
725
|
-
},
|
|
726
|
-
}, (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.datePicker) !== null && _b !== void 0 ? _b : {});
|
|
727
|
-
return (jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsx(DatePicker, __assign({ value: input.value ? dayjs(input.value) : null, onChange: function (value) {
|
|
535
|
+
var _f = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.datePicker) !== null && _b !== void 0 ? _b : {}), datePickerSlotProps = _f.slotProps, remainingDatePickerProps = __rest(_f, ["slotProps"]);
|
|
536
|
+
var mergedSlotProps = __assign(__assign({}, datePickerSlotProps), { textField: __assign({ fullWidth: true, required: required, color: meta.touched && meta.error ? "error" : undefined, error: meta.touched && meta.error, helperText: (meta.touched && meta.error) || helperText, onFocus: input.onFocus, onBlur: input.onBlur }, datePickerSlotProps === null || datePickerSlotProps === void 0 ? void 0 : datePickerSlotProps.textField) });
|
|
537
|
+
return (jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsx(DatePicker, __assign({ label: label, disabled: disabled, views: ["year", "month", "day"], value: input.value ? dayjs(input.value) : null, onOpen: input.onFocus, onClose: input.onBlur, onChange: function (value) {
|
|
728
538
|
return input.onChange(formatAsDate ? value === null || value === void 0 ? void 0 : value.format("YYYY-MM-DD") : value === null || value === void 0 ? void 0 : value.toJSON());
|
|
729
|
-
} },
|
|
539
|
+
}, slotProps: mergedSlotProps }, remainingDatePickerProps)) }));
|
|
730
540
|
};
|
|
731
541
|
|
|
732
542
|
var DateTimeFormField = function (_a) {
|
|
@@ -734,23 +544,9 @@ var DateTimeFormField = function (_a) {
|
|
|
734
544
|
var name = _a.name, label = _a.label, required = _a.required, icon = _a.icon, showSpace = _a.showSpace, slotProps = _a.slotProps, disabled = _a.disabled, helperText = _a.helperText, format = _a.format, _c = _a.validators, validators = _c === void 0 ? [] : _c;
|
|
735
545
|
var _d = useField(name, __assign({ format: format, validate: required
|
|
736
546
|
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), input = _d.input, meta = _d.meta;
|
|
737
|
-
var
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
views: ["year", "month", "day"],
|
|
741
|
-
slotProps: {
|
|
742
|
-
textField: {
|
|
743
|
-
fullWidth: true,
|
|
744
|
-
required: required,
|
|
745
|
-
color: meta.touched && meta.error ? "error" : undefined,
|
|
746
|
-
error: meta.touched && meta.error,
|
|
747
|
-
helperText: (meta.touched && meta.error) || helperText,
|
|
748
|
-
onFocus: input.onFocus,
|
|
749
|
-
onBlur: input.onBlur,
|
|
750
|
-
},
|
|
751
|
-
},
|
|
752
|
-
}, (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.dateTimePicker) !== null && _b !== void 0 ? _b : {});
|
|
753
|
-
return (jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsx(DateTimePicker, __assign({ value: input.value ? dayjs(input.value) : null, onChange: function (value) { return input.onChange(value === null || value === void 0 ? void 0 : value.toJSON()); } }, dateTimeProps)) }));
|
|
547
|
+
var _e = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.dateTimePicker) !== null && _b !== void 0 ? _b : {}), dateTimePickerSlotProps = _e.slotProps, remainingDateTimePickerProps = __rest(_e, ["slotProps"]);
|
|
548
|
+
var mergedSlotProps = __assign(__assign({}, dateTimePickerSlotProps), { textField: __assign({ fullWidth: true, required: required, color: meta.touched && meta.error ? "error" : undefined, error: meta.touched && meta.error, helperText: (meta.touched && meta.error) || helperText, onFocus: input.onFocus, onBlur: input.onBlur }, dateTimePickerSlotProps === null || dateTimePickerSlotProps === void 0 ? void 0 : dateTimePickerSlotProps.textField) });
|
|
549
|
+
return (jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsx(DateTimePicker, __assign({ label: label, disabled: disabled, value: input.value ? dayjs(input.value) : null, onOpen: input.onFocus, onClose: input.onBlur, onChange: function (value) { return input.onChange(value === null || value === void 0 ? void 0 : value.toJSON()); }, slotProps: mergedSlotProps }, remainingDateTimePickerProps)) }));
|
|
754
550
|
};
|
|
755
551
|
|
|
756
552
|
//Courtesy of https://stackoverflow.com/questions/58099124/how-to-use-custom-radio-component-with-react-final-form
|
|
@@ -878,6 +674,10 @@ function FileDisplay(_a) {
|
|
|
878
674
|
return (jsx(Stack, { children: files.map(function (f) { return (jsx(IndividualFile, __assign({ file: f }, individualFileProps), isAsset(f) ? f.id : f.name)); }) }));
|
|
879
675
|
}
|
|
880
676
|
|
|
677
|
+
function getDefaultExportFromCjs (x) {
|
|
678
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
679
|
+
}
|
|
680
|
+
|
|
881
681
|
var propTypes = {exports: {}};
|
|
882
682
|
|
|
883
683
|
var reactIs = {exports: {}};
|