@me1a/ui 1.1.2 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/example/index/example/index.d.ts +1 -0
- package/dist/example/index/example/simple.d.ts +4 -0
- package/dist/example/index/hook-forms/form-provider.d.ts +8 -0
- package/dist/example/index/hook-forms/index.d.ts +9 -0
- package/dist/example/index/hook-forms/rhf-autocomplete.d.ts +11 -0
- package/dist/example/index/hook-forms/rhf-checkbox.d.ts +19 -0
- package/dist/example/index/hook-forms/rhf-radio-group.d.ts +13 -0
- package/dist/example/index/hook-forms/rhf-select.d.ts +11 -0
- package/dist/example/index/hook-forms/rhf-slider.d.ts +7 -0
- package/dist/example/index/hook-forms/rhf-switch.d.ts +7 -0
- package/dist/example/index/hook-forms/rhf-text-field.d.ts +6 -0
- package/dist/example/index/index.cjs.js +1381 -0
- package/dist/example/index/index.cjs.js.map +1 -0
- package/dist/example/index/index.d.ts +2 -0
- package/dist/example/index/index.es.js +1379 -0
- package/dist/example/index/index.es.js.map +1 -0
- package/dist/hook-forms/index/example/index.d.ts +1 -0
- package/dist/hook-forms/index/example/simple.d.ts +4 -0
- package/dist/hook-forms/index/hook-forms/form-provider.d.ts +8 -0
- package/dist/hook-forms/index/hook-forms/index.d.ts +9 -0
- package/dist/hook-forms/index/hook-forms/rhf-autocomplete.d.ts +11 -0
- package/dist/hook-forms/index/hook-forms/rhf-checkbox.d.ts +19 -0
- package/dist/hook-forms/index/hook-forms/rhf-radio-group.d.ts +13 -0
- package/dist/hook-forms/index/hook-forms/rhf-select.d.ts +11 -0
- package/dist/hook-forms/index/hook-forms/rhf-slider.d.ts +7 -0
- package/dist/hook-forms/index/hook-forms/rhf-switch.d.ts +7 -0
- package/dist/hook-forms/index/hook-forms/rhf-text-field.d.ts +6 -0
- package/dist/{index.cjs.js → hook-forms/index/index.cjs.js} +280 -359
- package/dist/hook-forms/index/index.cjs.js.map +1 -0
- package/dist/hook-forms/index/index.d.ts +2 -0
- package/dist/{index.es.js → hook-forms/index/index.es.js} +280 -359
- package/dist/hook-forms/index/index.es.js.map +1 -0
- package/dist/index/example/index.d.ts +1 -0
- package/dist/index/example/simple.d.ts +4 -0
- package/dist/index/hook-forms/form-provider.d.ts +8 -0
- package/dist/index/hook-forms/index.d.ts +9 -0
- package/dist/index/hook-forms/rhf-autocomplete.d.ts +11 -0
- package/dist/index/hook-forms/rhf-checkbox.d.ts +19 -0
- package/dist/index/hook-forms/rhf-radio-group.d.ts +13 -0
- package/dist/index/hook-forms/rhf-select.d.ts +11 -0
- package/dist/index/hook-forms/rhf-slider.d.ts +7 -0
- package/dist/index/hook-forms/rhf-switch.d.ts +7 -0
- package/dist/index/hook-forms/rhf-text-field.d.ts +6 -0
- package/dist/index/index.cjs.js +27272 -0
- package/dist/index/index.cjs.js.map +1 -0
- package/dist/index/index.d.ts +2 -0
- package/dist/index/index.es.js +27232 -0
- package/dist/index/index.es.js.map +1 -0
- package/package.json +3 -3
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.d.ts +0 -74
- package/dist/index.es.js.map +0 -1
|
@@ -1621,7 +1621,7 @@ function createFormControl(props = {}) {
|
|
|
1621
1621
|
timer = setTimeout(callback, wait);
|
|
1622
1622
|
};
|
|
1623
1623
|
const _updateValid = async (shouldUpdateValid) => {
|
|
1624
|
-
if (!
|
|
1624
|
+
if (!_options.disabled && (_proxyFormState.isValid || shouldUpdateValid)) {
|
|
1625
1625
|
const isValid = _options.resolver
|
|
1626
1626
|
? isEmptyObject((await _executeSchema()).errors)
|
|
1627
1627
|
: await executeBuiltInValidation(_fields, true);
|
|
@@ -1633,7 +1633,7 @@ function createFormControl(props = {}) {
|
|
|
1633
1633
|
}
|
|
1634
1634
|
};
|
|
1635
1635
|
const _updateIsValidating = (names, isValidating) => {
|
|
1636
|
-
if (!
|
|
1636
|
+
if (!_options.disabled &&
|
|
1637
1637
|
(_proxyFormState.isValidating || _proxyFormState.validatingFields)) {
|
|
1638
1638
|
(names || Array.from(_names.mount)).forEach((name) => {
|
|
1639
1639
|
if (name) {
|
|
@@ -1649,7 +1649,7 @@ function createFormControl(props = {}) {
|
|
|
1649
1649
|
}
|
|
1650
1650
|
};
|
|
1651
1651
|
const _updateFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
|
1652
|
-
if (args && method && !
|
|
1652
|
+
if (args && method && !_options.disabled) {
|
|
1653
1653
|
_state.action = true;
|
|
1654
1654
|
if (shouldUpdateFieldsAndState && Array.isArray(get(_fields, name))) {
|
|
1655
1655
|
const fieldValues = method(get(_fields, name), args.argA, args.argB);
|
|
@@ -1713,7 +1713,7 @@ function createFormControl(props = {}) {
|
|
|
1713
1713
|
const output = {
|
|
1714
1714
|
name,
|
|
1715
1715
|
};
|
|
1716
|
-
if (!
|
|
1716
|
+
if (!_options.disabled) {
|
|
1717
1717
|
const disabledField = !!(get(_fields, name) &&
|
|
1718
1718
|
get(_fields, name)._f &&
|
|
1719
1719
|
get(_fields, name)._f.disabled);
|
|
@@ -1849,7 +1849,7 @@ function createFormControl(props = {}) {
|
|
|
1849
1849
|
}
|
|
1850
1850
|
_names.unMount = new Set();
|
|
1851
1851
|
};
|
|
1852
|
-
const _getDirty = (name, data) => !
|
|
1852
|
+
const _getDirty = (name, data) => !_options.disabled &&
|
|
1853
1853
|
(name && data && set(_formValues, name, data),
|
|
1854
1854
|
!deepEqual(getValues(), _defaultValues));
|
|
1855
1855
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
|
@@ -2165,7 +2165,7 @@ function createFormControl(props = {}) {
|
|
|
2165
2165
|
};
|
|
2166
2166
|
const register = (name, options = {}) => {
|
|
2167
2167
|
let field = get(_fields, name);
|
|
2168
|
-
const disabledIsDefined = isBoolean(options.disabled) || isBoolean(
|
|
2168
|
+
const disabledIsDefined = isBoolean(options.disabled) || isBoolean(_options.disabled);
|
|
2169
2169
|
set(_fields, name, {
|
|
2170
2170
|
...(field || {}),
|
|
2171
2171
|
_f: {
|
|
@@ -2181,7 +2181,7 @@ function createFormControl(props = {}) {
|
|
|
2181
2181
|
field,
|
|
2182
2182
|
disabled: isBoolean(options.disabled)
|
|
2183
2183
|
? options.disabled
|
|
2184
|
-
:
|
|
2184
|
+
: _options.disabled,
|
|
2185
2185
|
name,
|
|
2186
2186
|
value: options.value,
|
|
2187
2187
|
});
|
|
@@ -2191,7 +2191,7 @@ function createFormControl(props = {}) {
|
|
|
2191
2191
|
}
|
|
2192
2192
|
return {
|
|
2193
2193
|
...(disabledIsDefined
|
|
2194
|
-
? { disabled: options.disabled ||
|
|
2194
|
+
? { disabled: options.disabled || _options.disabled }
|
|
2195
2195
|
: {}),
|
|
2196
2196
|
...(_options.progressive
|
|
2197
2197
|
? {
|
|
@@ -2275,6 +2275,12 @@ function createFormControl(props = {}) {
|
|
|
2275
2275
|
e.preventDefault && e.preventDefault();
|
|
2276
2276
|
e.persist && e.persist();
|
|
2277
2277
|
}
|
|
2278
|
+
if (_options.disabled) {
|
|
2279
|
+
if (onInvalid) {
|
|
2280
|
+
await onInvalid({ ..._formState.errors }, e);
|
|
2281
|
+
}
|
|
2282
|
+
return;
|
|
2283
|
+
}
|
|
2278
2284
|
let fieldValues = cloneObject(_formValues);
|
|
2279
2285
|
_subjects.state.next({
|
|
2280
2286
|
isSubmitting: true,
|
|
@@ -2453,7 +2459,9 @@ function createFormControl(props = {}) {
|
|
|
2453
2459
|
: fieldReference.ref;
|
|
2454
2460
|
if (fieldRef.focus) {
|
|
2455
2461
|
fieldRef.focus();
|
|
2456
|
-
options.shouldSelect &&
|
|
2462
|
+
options.shouldSelect &&
|
|
2463
|
+
isFunction(fieldRef.select) &&
|
|
2464
|
+
fieldRef.select();
|
|
2457
2465
|
}
|
|
2458
2466
|
}
|
|
2459
2467
|
};
|
|
@@ -2654,103 +2662,10 @@ function useForm(props = {}) {
|
|
|
2654
2662
|
values: control._getWatch(),
|
|
2655
2663
|
});
|
|
2656
2664
|
}, [props.shouldUnregister, control]);
|
|
2657
|
-
React__default.useEffect(() => {
|
|
2658
|
-
if (_formControl.current) {
|
|
2659
|
-
_formControl.current.watch = _formControl.current.watch.bind({});
|
|
2660
|
-
}
|
|
2661
|
-
}, [formState]);
|
|
2662
2665
|
_formControl.current.formState = getProxyFormState(formState, control);
|
|
2663
2666
|
return _formControl.current;
|
|
2664
2667
|
}
|
|
2665
2668
|
|
|
2666
|
-
function _arrayLikeToArray(r, a) {
|
|
2667
|
-
(null == a || a > r.length) && (a = r.length);
|
|
2668
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
2669
|
-
return n;
|
|
2670
|
-
}
|
|
2671
|
-
function _arrayWithoutHoles(r) {
|
|
2672
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
2673
|
-
}
|
|
2674
|
-
function _defineProperty(e, r, t) {
|
|
2675
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
2676
|
-
value: t,
|
|
2677
|
-
enumerable: !0,
|
|
2678
|
-
configurable: !0,
|
|
2679
|
-
writable: !0
|
|
2680
|
-
}) : e[r] = t, e;
|
|
2681
|
-
}
|
|
2682
|
-
function _iterableToArray(r) {
|
|
2683
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
2684
|
-
}
|
|
2685
|
-
function _nonIterableSpread() {
|
|
2686
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2687
|
-
}
|
|
2688
|
-
function ownKeys(e, r) {
|
|
2689
|
-
var t = Object.keys(e);
|
|
2690
|
-
if (Object.getOwnPropertySymbols) {
|
|
2691
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
2692
|
-
r && (o = o.filter(function (r) {
|
|
2693
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
2694
|
-
})), t.push.apply(t, o);
|
|
2695
|
-
}
|
|
2696
|
-
return t;
|
|
2697
|
-
}
|
|
2698
|
-
function _objectSpread2(e) {
|
|
2699
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
2700
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
2701
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
2702
|
-
_defineProperty(e, r, t[r]);
|
|
2703
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
2704
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
2705
|
-
});
|
|
2706
|
-
}
|
|
2707
|
-
return e;
|
|
2708
|
-
}
|
|
2709
|
-
function _objectWithoutProperties(e, t) {
|
|
2710
|
-
if (null == e) return {};
|
|
2711
|
-
var o,
|
|
2712
|
-
r,
|
|
2713
|
-
i = _objectWithoutPropertiesLoose$1(e, t);
|
|
2714
|
-
if (Object.getOwnPropertySymbols) {
|
|
2715
|
-
var s = Object.getOwnPropertySymbols(e);
|
|
2716
|
-
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
2717
|
-
}
|
|
2718
|
-
return i;
|
|
2719
|
-
}
|
|
2720
|
-
function _objectWithoutPropertiesLoose$1(r, e) {
|
|
2721
|
-
if (null == r) return {};
|
|
2722
|
-
var t = {};
|
|
2723
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
2724
|
-
if (e.includes(n)) continue;
|
|
2725
|
-
t[n] = r[n];
|
|
2726
|
-
}
|
|
2727
|
-
return t;
|
|
2728
|
-
}
|
|
2729
|
-
function _toConsumableArray(r) {
|
|
2730
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
2731
|
-
}
|
|
2732
|
-
function _toPrimitive(t, r) {
|
|
2733
|
-
if ("object" != typeof t || !t) return t;
|
|
2734
|
-
var e = t[Symbol.toPrimitive];
|
|
2735
|
-
if (void 0 !== e) {
|
|
2736
|
-
var i = e.call(t, r || "default");
|
|
2737
|
-
if ("object" != typeof i) return i;
|
|
2738
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2739
|
-
}
|
|
2740
|
-
return ("string" === r ? String : Number)(t);
|
|
2741
|
-
}
|
|
2742
|
-
function _toPropertyKey(t) {
|
|
2743
|
-
var i = _toPrimitive(t, "string");
|
|
2744
|
-
return "symbol" == typeof i ? i : i + "";
|
|
2745
|
-
}
|
|
2746
|
-
function _unsupportedIterableToArray(r, a) {
|
|
2747
|
-
if (r) {
|
|
2748
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
2749
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
2750
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
2751
|
-
}
|
|
2752
|
-
}
|
|
2753
|
-
|
|
2754
2669
|
function getDefaultExportFromCjs (x) {
|
|
2755
2670
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2756
2671
|
}
|
|
@@ -3989,7 +3904,6 @@ function requireReactJsxRuntime_development () {
|
|
|
3989
3904
|
}
|
|
3990
3905
|
}
|
|
3991
3906
|
|
|
3992
|
-
var didWarnAboutKeySpread = {};
|
|
3993
3907
|
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
3994
3908
|
{
|
|
3995
3909
|
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
@@ -4060,24 +3974,6 @@ function requireReactJsxRuntime_development () {
|
|
|
4060
3974
|
}
|
|
4061
3975
|
}
|
|
4062
3976
|
|
|
4063
|
-
{
|
|
4064
|
-
if (hasOwnProperty.call(props, 'key')) {
|
|
4065
|
-
var componentName = getComponentNameFromType(type);
|
|
4066
|
-
var keys = Object.keys(props).filter(function (k) {
|
|
4067
|
-
return k !== 'key';
|
|
4068
|
-
});
|
|
4069
|
-
var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
|
|
4070
|
-
|
|
4071
|
-
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
4072
|
-
var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
|
|
4073
|
-
|
|
4074
|
-
error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
|
4075
|
-
|
|
4076
|
-
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
4077
|
-
}
|
|
4078
|
-
}
|
|
4079
|
-
}
|
|
4080
|
-
|
|
4081
3977
|
if (type === REACT_FRAGMENT_TYPE) {
|
|
4082
3978
|
validateFragmentProps(element);
|
|
4083
3979
|
} else {
|
|
@@ -22360,48 +22256,53 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
22360
22256
|
variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])
|
|
22361
22257
|
} : void 0;
|
|
22362
22258
|
|
|
22363
|
-
|
|
22364
|
-
|
|
22365
|
-
|
|
22366
|
-
|
|
22367
|
-
|
|
22368
|
-
|
|
22369
|
-
|
|
22370
|
-
|
|
22371
|
-
|
|
22372
|
-
|
|
22373
|
-
|
|
22374
|
-
|
|
22259
|
+
function RHFSelect({
|
|
22260
|
+
name,
|
|
22261
|
+
native,
|
|
22262
|
+
maxHeight = 220,
|
|
22263
|
+
helperText,
|
|
22264
|
+
children,
|
|
22265
|
+
PaperPropsSx,
|
|
22266
|
+
...other
|
|
22267
|
+
}) {
|
|
22268
|
+
const {
|
|
22269
|
+
control
|
|
22270
|
+
} = useFormContext();
|
|
22375
22271
|
return jsxRuntimeExports.jsx(Controller, {
|
|
22376
22272
|
name: name,
|
|
22377
22273
|
control: control,
|
|
22378
|
-
render:
|
|
22379
|
-
|
|
22380
|
-
|
|
22381
|
-
|
|
22382
|
-
|
|
22383
|
-
|
|
22384
|
-
|
|
22385
|
-
|
|
22386
|
-
|
|
22387
|
-
|
|
22388
|
-
|
|
22389
|
-
|
|
22274
|
+
render: ({
|
|
22275
|
+
field,
|
|
22276
|
+
fieldState: {
|
|
22277
|
+
error
|
|
22278
|
+
}
|
|
22279
|
+
}) => jsxRuntimeExports.jsx(TextField, {
|
|
22280
|
+
...field,
|
|
22281
|
+
select: true,
|
|
22282
|
+
fullWidth: true,
|
|
22283
|
+
slotProps: {
|
|
22284
|
+
select: {
|
|
22285
|
+
native,
|
|
22286
|
+
MenuProps: {
|
|
22287
|
+
PaperProps: {
|
|
22288
|
+
sx: {
|
|
22289
|
+
...(!native && {
|
|
22390
22290
|
maxHeight: typeof maxHeight === "number" ? maxHeight : "unset"
|
|
22391
|
-
}),
|
|
22291
|
+
}),
|
|
22292
|
+
...PaperPropsSx
|
|
22392
22293
|
}
|
|
22393
|
-
},
|
|
22394
|
-
sx: {
|
|
22395
|
-
textTransform: "capitalize"
|
|
22396
22294
|
}
|
|
22295
|
+
},
|
|
22296
|
+
sx: {
|
|
22297
|
+
textTransform: "capitalize"
|
|
22397
22298
|
}
|
|
22398
|
-
}
|
|
22399
|
-
|
|
22400
|
-
|
|
22401
|
-
|
|
22402
|
-
|
|
22403
|
-
|
|
22404
|
-
}
|
|
22299
|
+
}
|
|
22300
|
+
},
|
|
22301
|
+
error: !!error,
|
|
22302
|
+
helperText: error ? error?.message : helperText,
|
|
22303
|
+
...other,
|
|
22304
|
+
children: children
|
|
22305
|
+
})
|
|
22405
22306
|
});
|
|
22406
22307
|
}
|
|
22407
22308
|
|
|
@@ -24484,96 +24385,100 @@ process.env.NODE_ENV !== "production" ? FormControlLabel.propTypes /* remove-pro
|
|
|
24484
24385
|
value: PropTypes.any
|
|
24485
24386
|
} : void 0;
|
|
24486
24387
|
|
|
24487
|
-
|
|
24488
|
-
|
|
24489
|
-
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
|
|
24493
|
-
|
|
24494
|
-
|
|
24388
|
+
function RHFCheckbox({
|
|
24389
|
+
name,
|
|
24390
|
+
helperText,
|
|
24391
|
+
...other
|
|
24392
|
+
}) {
|
|
24393
|
+
const {
|
|
24394
|
+
control
|
|
24395
|
+
} = useFormContext();
|
|
24495
24396
|
return jsxRuntimeExports.jsx(Controller, {
|
|
24496
24397
|
name: name,
|
|
24497
24398
|
control: control,
|
|
24498
|
-
render:
|
|
24499
|
-
|
|
24500
|
-
|
|
24501
|
-
|
|
24502
|
-
|
|
24503
|
-
|
|
24504
|
-
|
|
24505
|
-
|
|
24506
|
-
|
|
24507
|
-
|
|
24508
|
-
|
|
24509
|
-
|
|
24510
|
-
})
|
|
24511
|
-
|
|
24399
|
+
render: ({
|
|
24400
|
+
field,
|
|
24401
|
+
fieldState: {
|
|
24402
|
+
error
|
|
24403
|
+
}
|
|
24404
|
+
}) => jsxRuntimeExports.jsxs("div", {
|
|
24405
|
+
children: [jsxRuntimeExports.jsx(FormControlLabel, {
|
|
24406
|
+
control: jsxRuntimeExports.jsx(Checkbox, {
|
|
24407
|
+
...field,
|
|
24408
|
+
checked: field.value
|
|
24409
|
+
}),
|
|
24410
|
+
...other
|
|
24411
|
+
}), (!!error || helperText) && jsxRuntimeExports.jsx(FormHelperText, {
|
|
24412
|
+
error: !!error,
|
|
24413
|
+
children: error ? error?.message : helperText
|
|
24414
|
+
})]
|
|
24415
|
+
})
|
|
24512
24416
|
});
|
|
24513
24417
|
}
|
|
24514
|
-
function RHFMultiCheckbox(
|
|
24515
|
-
|
|
24516
|
-
|
|
24517
|
-
|
|
24518
|
-
|
|
24519
|
-
|
|
24520
|
-
|
|
24521
|
-
|
|
24522
|
-
|
|
24523
|
-
|
|
24524
|
-
|
|
24525
|
-
|
|
24526
|
-
|
|
24527
|
-
|
|
24528
|
-
}) : [].concat(_toConsumableArray(selectedItems), [item]);
|
|
24529
|
-
};
|
|
24418
|
+
function RHFMultiCheckbox({
|
|
24419
|
+
row,
|
|
24420
|
+
name,
|
|
24421
|
+
label,
|
|
24422
|
+
options,
|
|
24423
|
+
spacing,
|
|
24424
|
+
helperText,
|
|
24425
|
+
sx,
|
|
24426
|
+
...other
|
|
24427
|
+
}) {
|
|
24428
|
+
const {
|
|
24429
|
+
control
|
|
24430
|
+
} = useFormContext();
|
|
24431
|
+
const getSelected = (selectedItems, item) => selectedItems.includes(item) ? selectedItems.filter(value => value !== item) : [...selectedItems, item];
|
|
24530
24432
|
return jsxRuntimeExports.jsx(Controller, {
|
|
24531
24433
|
name: name,
|
|
24532
24434
|
control: control,
|
|
24533
|
-
render:
|
|
24534
|
-
|
|
24535
|
-
|
|
24536
|
-
|
|
24537
|
-
|
|
24538
|
-
|
|
24539
|
-
|
|
24540
|
-
|
|
24541
|
-
|
|
24542
|
-
|
|
24543
|
-
|
|
24544
|
-
}
|
|
24545
|
-
|
|
24435
|
+
render: ({
|
|
24436
|
+
field,
|
|
24437
|
+
fieldState: {
|
|
24438
|
+
error
|
|
24439
|
+
}
|
|
24440
|
+
}) => jsxRuntimeExports.jsxs(FormControl, {
|
|
24441
|
+
component: "fieldset",
|
|
24442
|
+
children: [label && jsxRuntimeExports.jsx(FormLabel, {
|
|
24443
|
+
component: "legend",
|
|
24444
|
+
sx: {
|
|
24445
|
+
typography: "body2"
|
|
24446
|
+
},
|
|
24447
|
+
children: label
|
|
24448
|
+
}), jsxRuntimeExports.jsx(FormGroup, {
|
|
24449
|
+
sx: {
|
|
24450
|
+
...(row && {
|
|
24546
24451
|
flexDirection: "row"
|
|
24547
|
-
}),
|
|
24452
|
+
}),
|
|
24453
|
+
[`& .${formControlLabelClasses.root}`]: {
|
|
24548
24454
|
"&:not(:last-of-type)": {
|
|
24549
24455
|
mb: spacing || 0
|
|
24550
|
-
}
|
|
24551
|
-
|
|
24552
|
-
|
|
24553
|
-
|
|
24554
|
-
|
|
24555
|
-
|
|
24556
|
-
|
|
24557
|
-
children: options.map(function (option) {
|
|
24558
|
-
return jsxRuntimeExports.jsx(FormControlLabel, _objectSpread2({
|
|
24559
|
-
control: jsxRuntimeExports.jsx(Checkbox, {
|
|
24560
|
-
checked: field.value.includes(option.value),
|
|
24561
|
-
onChange: function onChange() {
|
|
24562
|
-
return field.onChange(getSelected(field.value, "".concat(option.value)));
|
|
24563
|
-
}
|
|
24564
|
-
}),
|
|
24565
|
-
label: option.label
|
|
24566
|
-
}, other), option.value);
|
|
24567
|
-
})
|
|
24568
|
-
}), (!!error || helperText) && jsxRuntimeExports.jsx(FormHelperText, {
|
|
24569
|
-
error: !!error,
|
|
24570
|
-
sx: {
|
|
24571
|
-
mx: 0
|
|
24456
|
+
},
|
|
24457
|
+
...(row && {
|
|
24458
|
+
mr: 0,
|
|
24459
|
+
"&:not(:last-of-type)": {
|
|
24460
|
+
mr: spacing || 2
|
|
24461
|
+
}
|
|
24462
|
+
})
|
|
24572
24463
|
},
|
|
24573
|
-
|
|
24574
|
-
}
|
|
24575
|
-
|
|
24576
|
-
|
|
24464
|
+
...sx
|
|
24465
|
+
},
|
|
24466
|
+
children: options.map(option => jsxRuntimeExports.jsx(FormControlLabel, {
|
|
24467
|
+
control: jsxRuntimeExports.jsx(Checkbox, {
|
|
24468
|
+
checked: field.value.includes(option.value),
|
|
24469
|
+
onChange: () => field.onChange(getSelected(field.value, `${option.value}`))
|
|
24470
|
+
}),
|
|
24471
|
+
label: option.label,
|
|
24472
|
+
...other
|
|
24473
|
+
}, option.value))
|
|
24474
|
+
}), (!!error || helperText) && jsxRuntimeExports.jsx(FormHelperText, {
|
|
24475
|
+
error: !!error,
|
|
24476
|
+
sx: {
|
|
24477
|
+
mx: 0
|
|
24478
|
+
},
|
|
24479
|
+
children: error ? error?.message : helperText
|
|
24480
|
+
})]
|
|
24481
|
+
})
|
|
24577
24482
|
});
|
|
24578
24483
|
}
|
|
24579
24484
|
|
|
@@ -24908,30 +24813,34 @@ process.env.NODE_ENV !== "production" ? Switch.propTypes /* remove-proptypes */
|
|
|
24908
24813
|
value: PropTypes.any
|
|
24909
24814
|
} : void 0;
|
|
24910
24815
|
|
|
24911
|
-
|
|
24912
|
-
|
|
24913
|
-
|
|
24914
|
-
|
|
24915
|
-
|
|
24916
|
-
|
|
24917
|
-
control
|
|
24816
|
+
function RHFSwitch({
|
|
24817
|
+
name,
|
|
24818
|
+
helperText,
|
|
24819
|
+
...other
|
|
24820
|
+
}) {
|
|
24821
|
+
const {
|
|
24822
|
+
control
|
|
24823
|
+
} = useFormContext();
|
|
24918
24824
|
return jsxRuntimeExports.jsx(Controller, {
|
|
24919
24825
|
name: name,
|
|
24920
24826
|
control: control,
|
|
24921
|
-
render:
|
|
24922
|
-
|
|
24923
|
-
|
|
24924
|
-
|
|
24925
|
-
|
|
24926
|
-
|
|
24927
|
-
|
|
24928
|
-
|
|
24929
|
-
|
|
24930
|
-
|
|
24931
|
-
|
|
24932
|
-
|
|
24933
|
-
})
|
|
24934
|
-
|
|
24827
|
+
render: ({
|
|
24828
|
+
field,
|
|
24829
|
+
fieldState: {
|
|
24830
|
+
error
|
|
24831
|
+
}
|
|
24832
|
+
}) => jsxRuntimeExports.jsxs("div", {
|
|
24833
|
+
children: [jsxRuntimeExports.jsx(FormControlLabel, {
|
|
24834
|
+
control: jsxRuntimeExports.jsx(Switch, {
|
|
24835
|
+
...field,
|
|
24836
|
+
checked: field.value
|
|
24837
|
+
}),
|
|
24838
|
+
...other
|
|
24839
|
+
}), (!!error || helperText) && jsxRuntimeExports.jsx(FormHelperText, {
|
|
24840
|
+
error: !!error,
|
|
24841
|
+
children: error ? error?.message : helperText
|
|
24842
|
+
})]
|
|
24843
|
+
})
|
|
24935
24844
|
});
|
|
24936
24845
|
}
|
|
24937
24846
|
|
|
@@ -26709,60 +26618,68 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
|
|
|
26709
26618
|
valueLabelFormat: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
|
|
26710
26619
|
} : void 0;
|
|
26711
26620
|
|
|
26712
|
-
|
|
26713
|
-
|
|
26714
|
-
|
|
26715
|
-
|
|
26716
|
-
|
|
26717
|
-
|
|
26718
|
-
control
|
|
26621
|
+
function RHFSlider({
|
|
26622
|
+
name,
|
|
26623
|
+
helperText,
|
|
26624
|
+
...other
|
|
26625
|
+
}) {
|
|
26626
|
+
const {
|
|
26627
|
+
control
|
|
26628
|
+
} = useFormContext();
|
|
26719
26629
|
return jsxRuntimeExports.jsx(Controller, {
|
|
26720
26630
|
name: name,
|
|
26721
26631
|
control: control,
|
|
26722
|
-
render:
|
|
26723
|
-
|
|
26724
|
-
|
|
26725
|
-
|
|
26726
|
-
|
|
26727
|
-
|
|
26728
|
-
|
|
26729
|
-
|
|
26730
|
-
|
|
26731
|
-
|
|
26732
|
-
})
|
|
26733
|
-
|
|
26632
|
+
render: ({
|
|
26633
|
+
field,
|
|
26634
|
+
fieldState: {
|
|
26635
|
+
error
|
|
26636
|
+
}
|
|
26637
|
+
}) => jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
26638
|
+
children: [jsxRuntimeExports.jsx(Slider, {
|
|
26639
|
+
...field,
|
|
26640
|
+
valueLabelDisplay: "auto",
|
|
26641
|
+
...other
|
|
26642
|
+
}), (!!error || helperText) && jsxRuntimeExports.jsx(FormHelperText, {
|
|
26643
|
+
error: !!error,
|
|
26644
|
+
children: error ? error?.message : helperText
|
|
26645
|
+
})]
|
|
26646
|
+
})
|
|
26734
26647
|
});
|
|
26735
26648
|
}
|
|
26736
26649
|
|
|
26737
|
-
|
|
26738
|
-
|
|
26739
|
-
|
|
26740
|
-
|
|
26741
|
-
|
|
26742
|
-
|
|
26743
|
-
|
|
26744
|
-
control
|
|
26650
|
+
function RHFTextField({
|
|
26651
|
+
name,
|
|
26652
|
+
helperText,
|
|
26653
|
+
type,
|
|
26654
|
+
...other
|
|
26655
|
+
}) {
|
|
26656
|
+
const {
|
|
26657
|
+
control
|
|
26658
|
+
} = useFormContext();
|
|
26745
26659
|
return jsxRuntimeExports.jsx(Controller, {
|
|
26746
26660
|
name: name,
|
|
26747
26661
|
control: control,
|
|
26748
|
-
render:
|
|
26749
|
-
|
|
26750
|
-
|
|
26751
|
-
|
|
26752
|
-
|
|
26753
|
-
|
|
26754
|
-
|
|
26755
|
-
|
|
26756
|
-
|
|
26757
|
-
|
|
26758
|
-
|
|
26759
|
-
|
|
26760
|
-
|
|
26761
|
-
}
|
|
26762
|
-
|
|
26763
|
-
|
|
26764
|
-
},
|
|
26765
|
-
|
|
26662
|
+
render: ({
|
|
26663
|
+
field,
|
|
26664
|
+
fieldState: {
|
|
26665
|
+
error
|
|
26666
|
+
}
|
|
26667
|
+
}) => jsxRuntimeExports.jsx(TextField, {
|
|
26668
|
+
...field,
|
|
26669
|
+
fullWidth: true,
|
|
26670
|
+
type: type,
|
|
26671
|
+
value: type === "number" && field.value === 0 ? "" : field.value,
|
|
26672
|
+
onChange: event => {
|
|
26673
|
+
if (type === "number") {
|
|
26674
|
+
field.onChange(Number(event.target.value));
|
|
26675
|
+
} else {
|
|
26676
|
+
field.onChange(event.target.value);
|
|
26677
|
+
}
|
|
26678
|
+
},
|
|
26679
|
+
error: !!error,
|
|
26680
|
+
helperText: error ? error?.message : helperText,
|
|
26681
|
+
...other
|
|
26682
|
+
})
|
|
26766
26683
|
});
|
|
26767
26684
|
}
|
|
26768
26685
|
|
|
@@ -27217,76 +27134,80 @@ process.env.NODE_ENV !== "production" ? RadioGroup.propTypes /* remove-proptypes
|
|
|
27217
27134
|
value: PropTypes.any
|
|
27218
27135
|
} : void 0;
|
|
27219
27136
|
|
|
27220
|
-
|
|
27221
|
-
|
|
27222
|
-
|
|
27223
|
-
|
|
27224
|
-
|
|
27225
|
-
|
|
27226
|
-
|
|
27227
|
-
|
|
27228
|
-
|
|
27229
|
-
|
|
27230
|
-
control
|
|
27231
|
-
|
|
27137
|
+
function RHFRadioGroup({
|
|
27138
|
+
row,
|
|
27139
|
+
name,
|
|
27140
|
+
label,
|
|
27141
|
+
options,
|
|
27142
|
+
spacing,
|
|
27143
|
+
helperText,
|
|
27144
|
+
...other
|
|
27145
|
+
}) {
|
|
27146
|
+
const {
|
|
27147
|
+
control
|
|
27148
|
+
} = useFormContext();
|
|
27149
|
+
const labelledby = label ? `${name}-${label}` : "";
|
|
27232
27150
|
return jsxRuntimeExports.jsx(Controller, {
|
|
27233
27151
|
name: name,
|
|
27234
27152
|
control: control,
|
|
27235
|
-
render:
|
|
27236
|
-
|
|
27237
|
-
|
|
27238
|
-
|
|
27239
|
-
|
|
27240
|
-
|
|
27241
|
-
|
|
27242
|
-
|
|
27243
|
-
|
|
27244
|
-
|
|
27245
|
-
|
|
27246
|
-
|
|
27247
|
-
}
|
|
27248
|
-
|
|
27249
|
-
|
|
27250
|
-
|
|
27251
|
-
|
|
27252
|
-
|
|
27253
|
-
|
|
27254
|
-
|
|
27255
|
-
|
|
27256
|
-
|
|
27257
|
-
|
|
27258
|
-
mb: spacing || 0
|
|
27259
|
-
}
|
|
27260
|
-
}, row && {
|
|
27261
|
-
mr: 0,
|
|
27262
|
-
"&:not(:last-of-type)": {
|
|
27263
|
-
mr: spacing || 2
|
|
27264
|
-
}
|
|
27265
|
-
})
|
|
27266
|
-
}, option.value);
|
|
27267
|
-
})
|
|
27268
|
-
})), (!!error || helperText) && jsxRuntimeExports.jsx(FormHelperText, {
|
|
27269
|
-
error: !!error,
|
|
27153
|
+
render: ({
|
|
27154
|
+
field,
|
|
27155
|
+
fieldState: {
|
|
27156
|
+
error
|
|
27157
|
+
}
|
|
27158
|
+
}) => jsxRuntimeExports.jsxs(FormControl, {
|
|
27159
|
+
component: "fieldset",
|
|
27160
|
+
children: [label && jsxRuntimeExports.jsx(FormLabel, {
|
|
27161
|
+
component: "legend",
|
|
27162
|
+
id: labelledby,
|
|
27163
|
+
sx: {
|
|
27164
|
+
typography: "body2"
|
|
27165
|
+
},
|
|
27166
|
+
children: label
|
|
27167
|
+
}), jsxRuntimeExports.jsx(RadioGroup, {
|
|
27168
|
+
...field,
|
|
27169
|
+
"aria-labelledby": labelledby,
|
|
27170
|
+
row: row,
|
|
27171
|
+
...other,
|
|
27172
|
+
children: options.map(option => jsxRuntimeExports.jsx(FormControlLabel, {
|
|
27173
|
+
value: option.value,
|
|
27174
|
+
control: jsxRuntimeExports.jsx(Radio, {}),
|
|
27175
|
+
label: option.label,
|
|
27270
27176
|
sx: {
|
|
27271
|
-
|
|
27272
|
-
|
|
27273
|
-
|
|
27274
|
-
|
|
27275
|
-
|
|
27276
|
-
|
|
27177
|
+
"&:not(:last-of-type)": {
|
|
27178
|
+
mb: spacing || 0
|
|
27179
|
+
},
|
|
27180
|
+
...(row && {
|
|
27181
|
+
mr: 0,
|
|
27182
|
+
"&:not(:last-of-type)": {
|
|
27183
|
+
mr: spacing || 2
|
|
27184
|
+
}
|
|
27185
|
+
})
|
|
27186
|
+
}
|
|
27187
|
+
}, option.value))
|
|
27188
|
+
}), (!!error || helperText) && jsxRuntimeExports.jsx(FormHelperText, {
|
|
27189
|
+
error: !!error,
|
|
27190
|
+
sx: {
|
|
27191
|
+
mx: 0
|
|
27192
|
+
},
|
|
27193
|
+
children: error ? error?.message : helperText
|
|
27194
|
+
})]
|
|
27195
|
+
})
|
|
27277
27196
|
});
|
|
27278
27197
|
}
|
|
27279
27198
|
|
|
27280
|
-
function FormProvider(
|
|
27281
|
-
|
|
27282
|
-
|
|
27283
|
-
|
|
27284
|
-
|
|
27199
|
+
function FormProvider({
|
|
27200
|
+
children,
|
|
27201
|
+
onSubmit,
|
|
27202
|
+
methods
|
|
27203
|
+
}) {
|
|
27204
|
+
return jsxRuntimeExports.jsx(FormProvider$1, {
|
|
27205
|
+
...methods,
|
|
27285
27206
|
children: jsxRuntimeExports.jsx("form", {
|
|
27286
27207
|
onSubmit: onSubmit,
|
|
27287
27208
|
children: children
|
|
27288
27209
|
})
|
|
27289
|
-
})
|
|
27210
|
+
});
|
|
27290
27211
|
}
|
|
27291
27212
|
|
|
27292
27213
|
export { Controller, Form, FormProvider, FormProvider$1 as FormProviderController, RHFCheckbox, RHFMultiCheckbox, RHFRadioGroup, RHFSelect, RHFSlider, RHFSwitch, RHFTextField, appendErrors, get, set, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch };
|