@sunggang/ui-lib 0.2.98 → 0.3.0

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/index.esm2.js CHANGED
@@ -18,9 +18,7 @@ import * as locales from 'react-date-range/dist/locale/index.js';
18
18
  import addDays from 'date-fns/addDays/index.js';
19
19
  import format$1 from 'date-fns/format/index.js';
20
20
  import { keyframes, jsx as jsx$1, css as css$2 } from '@emotion/react';
21
- import Radio from '@mui/material/Radio';
22
- import RadioGroup from '@mui/material/RadioGroup';
23
- import FormControlLabel from '@mui/material/FormControlLabel';
21
+ import { Checkbox, RadioGroup, FormControlLabel, Radio } from '@mui/material';
24
22
  import { useReactTable, getCoreRowModel, getPaginationRowModel, getSortedRowModel, getFilteredRowModel, flexRender } from '@tanstack/react-table';
25
23
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
26
24
  import { ChevronRightIcon, CheckIcon, DotFilledIcon } from '@radix-ui/react-icons';
@@ -19582,7 +19580,6 @@ var set = function(object, path, value1) {
19582
19580
  object[key] = newValue;
19583
19581
  object = object[key];
19584
19582
  }
19585
- return object;
19586
19583
  };
19587
19584
  var EVENTS = {
19588
19585
  BLUR: "blur",
@@ -19695,42 +19692,6 @@ var getProxyFormState = function(formState, control, localProxyFormState) {
19695
19692
  for(var key in formState)_loop(key);
19696
19693
  return result;
19697
19694
  };
19698
- var isEmptyObject = function(value1) {
19699
- return isObject$a(value1) && !Object.keys(value1).length;
19700
- };
19701
- var shouldRenderFormState = function(formStateData, _proxyFormState, updateFormState, isRoot) {
19702
- updateFormState(formStateData);
19703
- formStateData.name; var formState = _object_without_properties$7(formStateData, [
19704
- "name"
19705
- ]);
19706
- return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find(function(key) {
19707
- return _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all);
19708
- });
19709
- };
19710
- var convertToArrayPayload = function(value1) {
19711
- return Array.isArray(value1) ? value1 : [
19712
- value1
19713
- ];
19714
- };
19715
- var shouldSubscribeByName = function(name, signalName, exact) {
19716
- return !name || !signalName || name === signalName || convertToArrayPayload(name).some(function(currentName) {
19717
- return currentName && (exact ? currentName === signalName : currentName.startsWith(signalName) || signalName.startsWith(currentName));
19718
- });
19719
- };
19720
- function useSubscribe(props) {
19721
- var _props = React__default.useRef(props);
19722
- _props.current = props;
19723
- React__default.useEffect(function() {
19724
- var subscription = !props.disabled && _props.current.subject && _props.current.subject.subscribe({
19725
- next: _props.current.next
19726
- });
19727
- return function() {
19728
- subscription && subscription.unsubscribe();
19729
- };
19730
- }, [
19731
- props.disabled
19732
- ]);
19733
- }
19734
19695
  /**
19735
19696
  * This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.
19736
19697
  *
@@ -19764,7 +19725,6 @@ function useSubscribe(props) {
19764
19725
  var methods = useFormContext();
19765
19726
  var _ref = props || {}, _ref_control = _ref.control, control = _ref_control === void 0 ? methods.control : _ref_control, disabled = _ref.disabled, name = _ref.name, exact = _ref.exact;
19766
19727
  var _React_useState = _sliced_to_array$8(React__default.useState(control._formState), 2), formState = _React_useState[0], updateFormState = _React_useState[1];
19767
- var _mounted = React__default.useRef(true);
19768
19728
  var _localProxyFormState = React__default.useRef({
19769
19729
  isDirty: false,
19770
19730
  isLoading: false,
@@ -19777,19 +19737,22 @@ function useSubscribe(props) {
19777
19737
  });
19778
19738
  var _name = React__default.useRef(name);
19779
19739
  _name.current = name;
19780
- useSubscribe({
19781
- disabled: disabled,
19782
- next: function(value1) {
19783
- return _mounted.current && shouldSubscribeByName(_name.current, value1.name, exact) && shouldRenderFormState(value1, _localProxyFormState.current, control._updateFormState) && updateFormState(_object_spread$e({}, control._formState, value1));
19784
- },
19785
- subject: control._subjects.state
19786
- });
19787
19740
  React__default.useEffect(function() {
19788
- _mounted.current = true;
19789
- _localProxyFormState.current.isValid && control._updateValid(true);
19790
- return function() {
19791
- _mounted.current = false;
19792
- };
19741
+ return control._subscribe({
19742
+ name: _name.current,
19743
+ formState: _localProxyFormState.current,
19744
+ exact: exact,
19745
+ callback: function(formState) {
19746
+ !disabled && updateFormState(_object_spread$e({}, control._formState, formState));
19747
+ }
19748
+ });
19749
+ }, [
19750
+ control,
19751
+ disabled,
19752
+ exact
19753
+ ]);
19754
+ React__default.useEffect(function() {
19755
+ _localProxyFormState.current.isValid && control._setValid(true);
19793
19756
  }, [
19794
19757
  control
19795
19758
  ]);
@@ -19835,16 +19798,24 @@ var generateWatchOutput = function(names, _names, formValues, isGlobal, defaultV
19835
19798
  var methods = useFormContext();
19836
19799
  var _ref = props || {}, _ref_control = _ref.control, control = _ref_control === void 0 ? methods.control : _ref_control, name = _ref.name, defaultValue = _ref.defaultValue, disabled = _ref.disabled, exact = _ref.exact;
19837
19800
  var _name = React__default.useRef(name);
19801
+ var _defaultValue = React__default.useRef(defaultValue);
19838
19802
  _name.current = name;
19839
- useSubscribe({
19840
- disabled: disabled,
19841
- subject: control._subjects.values,
19842
- next: function(formState) {
19843
- if (shouldSubscribeByName(_name.current, formState.name, exact)) {
19844
- updateValue(cloneObject(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, defaultValue)));
19803
+ React__default.useEffect(function() {
19804
+ return control._subscribe({
19805
+ name: _name.current,
19806
+ formState: {
19807
+ values: true
19808
+ },
19809
+ exact: exact,
19810
+ callback: function(formState) {
19811
+ return !disabled && updateValue(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, _defaultValue.current));
19845
19812
  }
19846
- }
19847
- });
19813
+ });
19814
+ }, [
19815
+ control,
19816
+ disabled,
19817
+ exact
19818
+ ]);
19848
19819
  var _React_useState = _sliced_to_array$8(React__default.useState(control._getWatch(name, defaultValue)), 2), value1 = _React_useState[0], updateValue = _React_useState[1];
19849
19820
  React__default.useEffect(function() {
19850
19821
  return control._removeUnmounted();
@@ -19889,6 +19860,7 @@ var generateWatchOutput = function(names, _names, formValues, isGlobal, defaultV
19889
19860
  name: name,
19890
19861
  exact: true
19891
19862
  });
19863
+ var _props = React__default.useRef(props);
19892
19864
  var _registerProps = React__default.useRef(control.register(name, _object_spread$e(_object_spread_props$a(_object_spread$e({}, props.rules), {
19893
19865
  value: value1
19894
19866
  }), isBoolean(props.disabled) ? {
@@ -19931,6 +19903,51 @@ var generateWatchOutput = function(names, _names, formValues, isGlobal, defaultV
19931
19903
  formState,
19932
19904
  name
19933
19905
  ]);
19906
+ var onChange = React__default.useCallback(function(event) {
19907
+ return _registerProps.current.onChange({
19908
+ target: {
19909
+ value: getEventValue(event),
19910
+ name: name
19911
+ },
19912
+ type: EVENTS.CHANGE
19913
+ });
19914
+ }, [
19915
+ name
19916
+ ]);
19917
+ var onBlur = React__default.useCallback(function() {
19918
+ return _registerProps.current.onBlur({
19919
+ target: {
19920
+ value: get$2(control._formValues, name),
19921
+ name: name
19922
+ },
19923
+ type: EVENTS.BLUR
19924
+ });
19925
+ }, [
19926
+ name,
19927
+ control._formValues
19928
+ ]);
19929
+ var ref = React__default.useCallback(function(elm) {
19930
+ var field = get$2(control._fields, name);
19931
+ if (field && elm) {
19932
+ field._f.ref = {
19933
+ focus: function() {
19934
+ return elm.focus();
19935
+ },
19936
+ select: function() {
19937
+ return elm.select();
19938
+ },
19939
+ setCustomValidity: function(message) {
19940
+ return elm.setCustomValidity(message);
19941
+ },
19942
+ reportValidity: function() {
19943
+ return elm.reportValidity();
19944
+ }
19945
+ };
19946
+ }
19947
+ }, [
19948
+ control._fields,
19949
+ name
19950
+ ]);
19934
19951
  var field = React__default.useMemo(function() {
19935
19952
  return _object_spread_props$a(_object_spread$e({
19936
19953
  name: name,
@@ -19938,54 +19955,24 @@ var generateWatchOutput = function(names, _names, formValues, isGlobal, defaultV
19938
19955
  }, isBoolean(disabled) || formState.disabled ? {
19939
19956
  disabled: formState.disabled || disabled
19940
19957
  } : {}), {
19941
- onChange: function(event) {
19942
- return _registerProps.current.onChange({
19943
- target: {
19944
- value: getEventValue(event),
19945
- name: name
19946
- },
19947
- type: EVENTS.CHANGE
19948
- });
19949
- },
19950
- onBlur: function() {
19951
- return _registerProps.current.onBlur({
19952
- target: {
19953
- value: get$2(control._formValues, name),
19954
- name: name
19955
- },
19956
- type: EVENTS.BLUR
19957
- });
19958
- },
19959
- ref: function(elm) {
19960
- var field = get$2(control._fields, name);
19961
- if (field && elm) {
19962
- field._f.ref = {
19963
- focus: function() {
19964
- return elm.focus();
19965
- },
19966
- select: function() {
19967
- return elm.select();
19968
- },
19969
- setCustomValidity: function(message) {
19970
- return elm.setCustomValidity(message);
19971
- },
19972
- reportValidity: function() {
19973
- return elm.reportValidity();
19974
- }
19975
- };
19976
- }
19977
- }
19958
+ onChange: onChange,
19959
+ onBlur: onBlur,
19960
+ ref: ref
19978
19961
  });
19979
19962
  }, [
19980
19963
  name,
19981
- control._formValues,
19982
19964
  disabled,
19983
19965
  formState.disabled,
19984
- value1,
19985
- control._fields
19966
+ onChange,
19967
+ onBlur,
19968
+ ref,
19969
+ value1
19986
19970
  ]);
19987
19971
  React__default.useEffect(function() {
19988
19972
  var _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
19973
+ control.register(name, _object_spread$e({}, _props.current.rules, isBoolean(_props.current.disabled) ? {
19974
+ disabled: _props.current.disabled
19975
+ } : {}));
19989
19976
  var updateMounted = function(name, value1) {
19990
19977
  var field = get$2(control._fields, name);
19991
19978
  if (field && field._f) {
@@ -20011,9 +19998,8 @@ var generateWatchOutput = function(names, _names, formValues, isGlobal, defaultV
20011
19998
  shouldUnregister
20012
19999
  ]);
20013
20000
  React__default.useEffect(function() {
20014
- control._updateDisabledField({
20001
+ control._setDisabledField({
20015
20002
  disabled: disabled,
20016
- fields: control._fields,
20017
20003
  name: name
20018
20004
  });
20019
20005
  }, [
@@ -20082,405 +20068,11 @@ var appendErrors = function(name, validateAllFieldCriteria, errors, type, messag
20082
20068
  types: _object_spread_props$a(_object_spread$e({}, errors[name] && errors[name].types ? errors[name].types : {}), _define_property$e({}, type, message || true))
20083
20069
  }) : {};
20084
20070
  };
20085
- var getValidationModes = function(mode) {
20086
- return {
20087
- isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,
20088
- isOnBlur: mode === VALIDATION_MODE.onBlur,
20089
- isOnChange: mode === VALIDATION_MODE.onChange,
20090
- isOnAll: mode === VALIDATION_MODE.all,
20091
- isOnTouch: mode === VALIDATION_MODE.onTouched
20092
- };
20093
- };
20094
- var isWatched = function(name, _names, isBlurEvent) {
20095
- return !isBlurEvent && (_names.watchAll || _names.watch.has(name) || _to_consumable_array$3(_names.watch).some(function(watchName) {
20096
- return name.startsWith(watchName) && /^\.\w+/.test(name.slice(watchName.length));
20097
- }));
20098
- };
20099
- var iterateFieldsByAction = function(fields, action, fieldsNames, abortEarly) {
20100
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
20101
- try {
20102
- for(var _iterator = (fieldsNames || Object.keys(fields))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
20103
- var _ref = _step.value;
20104
- var key = _ref;
20105
- var field = get$2(fields, key);
20106
- if (field) {
20107
- var _f = field._f, currentField = _object_without_properties$7(field, [
20108
- "_f"
20109
- ]);
20110
- if (_f) {
20111
- if (_f.refs && _f.refs[0] && action(_f.refs[0], key) && !abortEarly) {
20112
- return true;
20113
- } else if (_f.ref && action(_f.ref, _f.name) && !abortEarly) {
20114
- return true;
20115
- } else {
20116
- if (iterateFieldsByAction(currentField, action)) {
20117
- break;
20118
- }
20119
- }
20120
- } else if (isObject$a(currentField)) {
20121
- if (iterateFieldsByAction(currentField, action)) {
20122
- break;
20123
- }
20124
- }
20125
- }
20126
- }
20127
- } catch (err) {
20128
- _didIteratorError = true;
20129
- _iteratorError = err;
20130
- } finally{
20131
- try {
20132
- if (!_iteratorNormalCompletion && _iterator.return != null) {
20133
- _iterator.return();
20134
- }
20135
- } finally{
20136
- if (_didIteratorError) {
20137
- throw _iteratorError;
20138
- }
20139
- }
20140
- }
20141
- return;
20142
- };
20143
- var updateFieldArrayRootError = function(errors, error, name) {
20144
- var fieldArrayErrors = convertToArrayPayload(get$2(errors, name));
20145
- set(fieldArrayErrors, "root", error[name]);
20146
- set(errors, name, fieldArrayErrors);
20147
- return errors;
20148
- };
20149
- var isFileInput = function(element) {
20150
- return element.type === "file";
20151
- };
20152
- var isFunction$5 = function(value1) {
20153
- return typeof value1 === "function";
20154
- };
20155
- var isHTMLElement$3 = function(value1) {
20156
- if (!isWeb) {
20157
- return false;
20158
- }
20159
- var owner = value1 ? value1.ownerDocument : 0;
20160
- return _instanceof$8(value1, owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement);
20161
- };
20162
- var isMessage = function(value1) {
20163
- return isString(value1);
20164
- };
20165
- var isRadioInput = function(element) {
20166
- return element.type === "radio";
20167
- };
20168
- var isRegex = function(value1) {
20169
- return _instanceof$8(value1, RegExp);
20170
- };
20171
- var defaultResult = {
20172
- value: false,
20173
- isValid: false
20174
- };
20175
- var validResult = {
20176
- value: true,
20177
- isValid: true
20178
- };
20179
- var getCheckboxValue = function(options) {
20180
- if (Array.isArray(options)) {
20181
- if (options.length > 1) {
20182
- var values = options.filter(function(option) {
20183
- return option && option.checked && !option.disabled;
20184
- }).map(function(option) {
20185
- return option.value;
20186
- });
20187
- return {
20188
- value: values,
20189
- isValid: !!values.length
20190
- };
20191
- }
20192
- return options[0].checked && !options[0].disabled ? options[0].attributes && !isUndefined(options[0].attributes.value) ? isUndefined(options[0].value) || options[0].value === "" ? validResult : {
20193
- value: options[0].value,
20194
- isValid: true
20195
- } : validResult : defaultResult;
20196
- }
20197
- return defaultResult;
20198
- };
20199
- var defaultReturn = {
20200
- isValid: false,
20201
- value: null
20202
- };
20203
- var getRadioValue = function(options) {
20204
- return Array.isArray(options) ? options.reduce(function(previous, option) {
20205
- return option && option.checked && !option.disabled ? {
20206
- isValid: true,
20207
- value: option.value
20208
- } : previous;
20209
- }, defaultReturn) : defaultReturn;
20210
- };
20211
- function getValidateError(result, ref) {
20212
- var type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "validate";
20213
- if (isMessage(result) || Array.isArray(result) && result.every(isMessage) || isBoolean(result) && !result) {
20214
- return {
20215
- type: type,
20216
- message: isMessage(result) ? result : "",
20217
- ref: ref
20218
- };
20219
- }
20220
- }
20221
- var getValueAndMessage = function(validationData) {
20222
- return isObject$a(validationData) && !isRegex(validationData) ? validationData : {
20223
- value: validationData,
20224
- message: ""
20225
- };
20071
+ var convertToArrayPayload = function(value1) {
20072
+ return Array.isArray(value1) ? value1 : [
20073
+ value1
20074
+ ];
20226
20075
  };
20227
- var validateField = function() {
20228
- var _ref = _async_to_generator$2(function(field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) {
20229
- var _field__f, ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, valueAsNumber, mount, inputValue, inputRef, setCustomValidity, error, isRadio, isCheckBox, isRadioOrCheckbox, isEmpty, appendErrorsCurry, getMinMaxMessage, _ref, value1, message, exceedMax, exceedMin, maxOutput, minOutput, valueNumber, valueDate, convertTimeToDate, isTime, isWeek, maxLengthOutput, minLengthOutput, exceedMax1, exceedMin1, _getValueAndMessage, patternValue, message1, result, validateError, validationResult, _tmp, _tmp1, _i, key, validateError1;
20230
- return _ts_generator$2(this, function(_state) {
20231
- switch(_state.label){
20232
- case 0:
20233
- _field__f = field._f, ref = _field__f.ref, refs = _field__f.refs, required = _field__f.required, maxLength = _field__f.maxLength, minLength = _field__f.minLength, min = _field__f.min, max = _field__f.max, pattern = _field__f.pattern, validate = _field__f.validate, name = _field__f.name, valueAsNumber = _field__f.valueAsNumber, mount = _field__f.mount;
20234
- inputValue = get$2(formValues, name);
20235
- if (!mount || disabledFieldNames.has(name)) {
20236
- return [
20237
- 2,
20238
- {}
20239
- ];
20240
- }
20241
- inputRef = refs ? refs[0] : ref;
20242
- setCustomValidity = function(message) {
20243
- if (shouldUseNativeValidation && inputRef.reportValidity) {
20244
- inputRef.setCustomValidity(isBoolean(message) ? "" : message || "");
20245
- inputRef.reportValidity();
20246
- }
20247
- };
20248
- error = {};
20249
- isRadio = isRadioInput(ref);
20250
- isCheckBox = isCheckBoxInput(ref);
20251
- isRadioOrCheckbox = isRadio || isCheckBox;
20252
- isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement$3(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
20253
- appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error);
20254
- getMinMaxMessage = function(exceedMax, maxLengthMessage, minLengthMessage) {
20255
- var maxType = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : INPUT_VALIDATION_RULES.maxLength, minType = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : INPUT_VALIDATION_RULES.minLength;
20256
- var message = exceedMax ? maxLengthMessage : minLengthMessage;
20257
- error[name] = _object_spread$e({
20258
- type: exceedMax ? maxType : minType,
20259
- message: message,
20260
- ref: ref
20261
- }, appendErrorsCurry(exceedMax ? maxType : minType, message));
20262
- };
20263
- if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) {
20264
- _ref = isMessage(required) ? {
20265
- value: !!required,
20266
- message: required
20267
- } : getValueAndMessage(required), value1 = _ref.value, message = _ref.message;
20268
- if (value1) {
20269
- error[name] = _object_spread$e({
20270
- type: INPUT_VALIDATION_RULES.required,
20271
- message: message,
20272
- ref: inputRef
20273
- }, appendErrorsCurry(INPUT_VALIDATION_RULES.required, message));
20274
- if (!validateAllFieldCriteria) {
20275
- setCustomValidity(message);
20276
- return [
20277
- 2,
20278
- error
20279
- ];
20280
- }
20281
- }
20282
- }
20283
- if (!isEmpty && (!isNullOrUndefined(min) || !isNullOrUndefined(max))) {
20284
- maxOutput = getValueAndMessage(max);
20285
- minOutput = getValueAndMessage(min);
20286
- if (!isNullOrUndefined(inputValue) && !isNaN(inputValue)) {
20287
- valueNumber = ref.valueAsNumber || (inputValue ? +inputValue : inputValue);
20288
- if (!isNullOrUndefined(maxOutput.value)) {
20289
- exceedMax = valueNumber > maxOutput.value;
20290
- }
20291
- if (!isNullOrUndefined(minOutput.value)) {
20292
- exceedMin = valueNumber < minOutput.value;
20293
- }
20294
- } else {
20295
- valueDate = ref.valueAsDate || new Date(inputValue);
20296
- convertTimeToDate = function(time) {
20297
- return new Date(new Date().toDateString() + " " + time);
20298
- };
20299
- isTime = ref.type == "time";
20300
- isWeek = ref.type == "week";
20301
- if (isString(maxOutput.value) && inputValue) {
20302
- exceedMax = isTime ? convertTimeToDate(inputValue) > convertTimeToDate(maxOutput.value) : isWeek ? inputValue > maxOutput.value : valueDate > new Date(maxOutput.value);
20303
- }
20304
- if (isString(minOutput.value) && inputValue) {
20305
- exceedMin = isTime ? convertTimeToDate(inputValue) < convertTimeToDate(minOutput.value) : isWeek ? inputValue < minOutput.value : valueDate < new Date(minOutput.value);
20306
- }
20307
- }
20308
- if (exceedMax || exceedMin) {
20309
- getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
20310
- if (!validateAllFieldCriteria) {
20311
- setCustomValidity(error[name].message);
20312
- return [
20313
- 2,
20314
- error
20315
- ];
20316
- }
20317
- }
20318
- }
20319
- if ((maxLength || minLength) && !isEmpty && (isString(inputValue) || isFieldArray && Array.isArray(inputValue))) {
20320
- maxLengthOutput = getValueAndMessage(maxLength);
20321
- minLengthOutput = getValueAndMessage(minLength);
20322
- exceedMax1 = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > +maxLengthOutput.value;
20323
- exceedMin1 = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < +minLengthOutput.value;
20324
- if (exceedMax1 || exceedMin1) {
20325
- getMinMaxMessage(exceedMax1, maxLengthOutput.message, minLengthOutput.message);
20326
- if (!validateAllFieldCriteria) {
20327
- setCustomValidity(error[name].message);
20328
- return [
20329
- 2,
20330
- error
20331
- ];
20332
- }
20333
- }
20334
- }
20335
- if (pattern && !isEmpty && isString(inputValue)) {
20336
- _getValueAndMessage = getValueAndMessage(pattern), patternValue = _getValueAndMessage.value, message1 = _getValueAndMessage.message;
20337
- if (isRegex(patternValue) && !inputValue.match(patternValue)) {
20338
- error[name] = _object_spread$e({
20339
- type: INPUT_VALIDATION_RULES.pattern,
20340
- message: message1,
20341
- ref: ref
20342
- }, appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message1));
20343
- if (!validateAllFieldCriteria) {
20344
- setCustomValidity(message1);
20345
- return [
20346
- 2,
20347
- error
20348
- ];
20349
- }
20350
- }
20351
- }
20352
- if (!validate) return [
20353
- 3,
20354
- 7
20355
- ];
20356
- if (!isFunction$5(validate)) return [
20357
- 3,
20358
- 2
20359
- ];
20360
- return [
20361
- 4,
20362
- validate(inputValue, formValues)
20363
- ];
20364
- case 1:
20365
- result = _state.sent();
20366
- validateError = getValidateError(result, inputRef);
20367
- if (validateError) {
20368
- error[name] = _object_spread$e({}, validateError, appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message));
20369
- if (!validateAllFieldCriteria) {
20370
- setCustomValidity(validateError.message);
20371
- return [
20372
- 2,
20373
- error
20374
- ];
20375
- }
20376
- }
20377
- return [
20378
- 3,
20379
- 7
20380
- ];
20381
- case 2:
20382
- if (!isObject$a(validate)) return [
20383
- 3,
20384
- 7
20385
- ];
20386
- validationResult = {};
20387
- _tmp = [];
20388
- for(_tmp1 in validate)_tmp.push(_tmp1);
20389
- _i = 0;
20390
- _state.label = 3;
20391
- case 3:
20392
- if (!(_i < _tmp.length)) return [
20393
- 3,
20394
- 6
20395
- ];
20396
- key = _tmp[_i];
20397
- if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {
20398
- return [
20399
- 3,
20400
- 6
20401
- ];
20402
- }
20403
- return [
20404
- 4,
20405
- validate[key](inputValue, formValues)
20406
- ];
20407
- case 4:
20408
- validateError1 = getValidateError.apply(void 0, [
20409
- _state.sent(),
20410
- inputRef,
20411
- key
20412
- ]);
20413
- if (validateError1) {
20414
- validationResult = _object_spread$e({}, validateError1, appendErrorsCurry(key, validateError1.message));
20415
- setCustomValidity(validateError1.message);
20416
- if (validateAllFieldCriteria) {
20417
- error[name] = validationResult;
20418
- }
20419
- }
20420
- _state.label = 5;
20421
- case 5:
20422
- _i++;
20423
- return [
20424
- 3,
20425
- 3
20426
- ];
20427
- case 6:
20428
- if (!isEmptyObject(validationResult)) {
20429
- error[name] = _object_spread$e({
20430
- ref: inputRef
20431
- }, validationResult);
20432
- if (!validateAllFieldCriteria) {
20433
- return [
20434
- 2,
20435
- error
20436
- ];
20437
- }
20438
- }
20439
- _state.label = 7;
20440
- case 7:
20441
- setCustomValidity(true);
20442
- return [
20443
- 2,
20444
- error
20445
- ];
20446
- }
20447
- });
20448
- });
20449
- return function validateField(field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) {
20450
- return _ref.apply(this, arguments);
20451
- };
20452
- }();
20453
- function baseGet$5(object, updatePath) {
20454
- var length = updatePath.slice(0, -1).length;
20455
- var index = 0;
20456
- while(index < length){
20457
- object = isUndefined(object) ? index++ : object[updatePath[index++]];
20458
- }
20459
- return object;
20460
- }
20461
- function isEmptyArray(obj) {
20462
- for(var key in obj){
20463
- if (obj.hasOwnProperty(key) && !isUndefined(obj[key])) {
20464
- return false;
20465
- }
20466
- }
20467
- return true;
20468
- }
20469
- function unset(object, path) {
20470
- var paths = Array.isArray(path) ? path : isKey$4(path) ? [
20471
- path
20472
- ] : stringToPath$2(path);
20473
- var childObject = paths.length === 1 ? object : baseGet$5(object, paths);
20474
- var index = paths.length - 1;
20475
- var key = paths[index];
20476
- if (childObject) {
20477
- delete childObject[key];
20478
- }
20479
- if (index !== 0 && (isObject$a(childObject) && isEmptyObject(childObject) || Array.isArray(childObject) && isEmptyArray(childObject))) {
20480
- unset(object, paths.slice(0, -1));
20481
- }
20482
- return object;
20483
- }
20484
20076
  var createSubject = function() {
20485
20077
  var _observers = [];
20486
20078
  var next = function(value1) {
@@ -20573,15 +20165,65 @@ function deepEqual(object1, object2) {
20573
20165
  }
20574
20166
  return true;
20575
20167
  }
20168
+ var isEmptyObject = function(value1) {
20169
+ return isObject$a(value1) && !Object.keys(value1).length;
20170
+ };
20171
+ var isFileInput = function(element) {
20172
+ return element.type === "file";
20173
+ };
20174
+ var isFunction$5 = function(value1) {
20175
+ return typeof value1 === "function";
20176
+ };
20177
+ var isHTMLElement$3 = function(value1) {
20178
+ if (!isWeb) {
20179
+ return false;
20180
+ }
20181
+ var owner = value1 ? value1.ownerDocument : 0;
20182
+ return _instanceof$8(value1, owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement);
20183
+ };
20576
20184
  var isMultipleSelect = function(element) {
20577
20185
  return element.type === "select-multiple";
20578
20186
  };
20187
+ var isRadioInput = function(element) {
20188
+ return element.type === "radio";
20189
+ };
20579
20190
  var isRadioOrCheckbox = function(ref) {
20580
20191
  return isRadioInput(ref) || isCheckBoxInput(ref);
20581
20192
  };
20582
20193
  var live = function(ref) {
20583
20194
  return isHTMLElement$3(ref) && ref.isConnected;
20584
20195
  };
20196
+ function baseGet$5(object, updatePath) {
20197
+ var length = updatePath.slice(0, -1).length;
20198
+ var index = 0;
20199
+ while(index < length){
20200
+ object = isUndefined(object) ? index++ : object[updatePath[index++]];
20201
+ }
20202
+ return object;
20203
+ }
20204
+ function isEmptyArray(obj) {
20205
+ for(var key in obj){
20206
+ if (obj.hasOwnProperty(key) && !isUndefined(obj[key])) {
20207
+ return false;
20208
+ }
20209
+ }
20210
+ return true;
20211
+ }
20212
+ function unset(object, path) {
20213
+ var paths = Array.isArray(path) ? path : isKey$4(path) ? [
20214
+ path
20215
+ ] : stringToPath$2(path);
20216
+ var childObject = paths.length === 1 ? object : baseGet$5(object, paths);
20217
+ var index = paths.length - 1;
20218
+ var key = paths[index];
20219
+ if (childObject) {
20220
+ delete childObject[key];
20221
+ }
20222
+ if (index !== 0 && (isObject$a(childObject) && isEmptyObject(childObject) || Array.isArray(childObject) && isEmptyArray(childObject))) {
20223
+ unset(object, paths.slice(0, -1));
20224
+ }
20225
+ return object;
20226
+ }
20585
20227
  var objectHasFunction = function(data) {
20586
20228
  for(var key in data){
20587
20229
  if (isFunction$5(data[key])) {
@@ -20625,10 +20267,50 @@ function getDirtyFieldsFromDefaultValues(data, formValues, dirtyFieldsFromValues
20625
20267
  var getDirtyFields = function(defaultValues, formValues) {
20626
20268
  return getDirtyFieldsFromDefaultValues(defaultValues, formValues, markFieldsDirty(formValues));
20627
20269
  };
20270
+ var defaultResult = {
20271
+ value: false,
20272
+ isValid: false
20273
+ };
20274
+ var validResult = {
20275
+ value: true,
20276
+ isValid: true
20277
+ };
20278
+ var getCheckboxValue = function(options) {
20279
+ if (Array.isArray(options)) {
20280
+ if (options.length > 1) {
20281
+ var values = options.filter(function(option) {
20282
+ return option && option.checked && !option.disabled;
20283
+ }).map(function(option) {
20284
+ return option.value;
20285
+ });
20286
+ return {
20287
+ value: values,
20288
+ isValid: !!values.length
20289
+ };
20290
+ }
20291
+ return options[0].checked && !options[0].disabled ? options[0].attributes && !isUndefined(options[0].attributes.value) ? isUndefined(options[0].value) || options[0].value === "" ? validResult : {
20292
+ value: options[0].value,
20293
+ isValid: true
20294
+ } : validResult : defaultResult;
20295
+ }
20296
+ return defaultResult;
20297
+ };
20628
20298
  var getFieldValueAs = function(value1, param) {
20629
20299
  var valueAsNumber = param.valueAsNumber, valueAsDate = param.valueAsDate, setValueAs = param.setValueAs;
20630
20300
  return isUndefined(value1) ? value1 : valueAsNumber ? value1 === "" ? NaN : value1 ? +value1 : value1 : valueAsDate && isString(value1) ? new Date(value1) : setValueAs ? setValueAs(value1) : value1;
20631
20301
  };
20302
+ var defaultReturn = {
20303
+ isValid: false,
20304
+ value: null
20305
+ };
20306
+ var getRadioValue = function(options) {
20307
+ return Array.isArray(options) ? options.reduce(function(previous, option) {
20308
+ return option && option.checked && !option.disabled ? {
20309
+ isValid: true,
20310
+ value: option.value
20311
+ } : previous;
20312
+ }, defaultReturn) : defaultReturn;
20313
+ };
20632
20314
  function getFieldValue(_f) {
20633
20315
  var ref = _f.ref;
20634
20316
  if (isFileInput(ref)) {
@@ -20678,9 +20360,21 @@ var getResolverOptions = function(fieldsNames, _fields, criteriaMode, shouldUseN
20678
20360
  shouldUseNativeValidation: shouldUseNativeValidation
20679
20361
  };
20680
20362
  };
20363
+ var isRegex = function(value1) {
20364
+ return _instanceof$8(value1, RegExp);
20365
+ };
20681
20366
  var getRuleValue = function(rule) {
20682
20367
  return isUndefined(rule) ? rule : isRegex(rule) ? rule.source : isObject$a(rule) ? isRegex(rule.value) ? rule.value.source : rule.value : rule;
20683
20368
  };
20369
+ var getValidationModes = function(mode) {
20370
+ return {
20371
+ isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,
20372
+ isOnBlur: mode === VALIDATION_MODE.onBlur,
20373
+ isOnChange: mode === VALIDATION_MODE.onChange,
20374
+ isOnAll: mode === VALIDATION_MODE.all,
20375
+ isOnTouch: mode === VALIDATION_MODE.onTouched
20376
+ };
20377
+ };
20684
20378
  var ASYNC_FUNCTION = "AsyncFunction";
20685
20379
  var hasPromiseValidation = function(fieldReference) {
20686
20380
  return !!fieldReference && !!fieldReference.validate && !!(isFunction$5(fieldReference.validate) && fieldReference.validate.constructor.name === ASYNC_FUNCTION || isObject$a(fieldReference.validate) && Object.values(fieldReference.validate).find(function(validateFunction) {
@@ -20690,6 +20384,55 @@ var hasPromiseValidation = function(fieldReference) {
20690
20384
  var hasValidation = function(options) {
20691
20385
  return options.mount && (options.required || options.min || options.max || options.maxLength || options.minLength || options.pattern || options.validate);
20692
20386
  };
20387
+ var isWatched = function(name, _names, isBlurEvent) {
20388
+ return !isBlurEvent && (_names.watchAll || _names.watch.has(name) || _to_consumable_array$3(_names.watch).some(function(watchName) {
20389
+ return name.startsWith(watchName) && /^\.\w+/.test(name.slice(watchName.length));
20390
+ }));
20391
+ };
20392
+ var iterateFieldsByAction = function(fields, action, fieldsNames, abortEarly) {
20393
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
20394
+ try {
20395
+ for(var _iterator = (fieldsNames || Object.keys(fields))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
20396
+ var _ref = _step.value;
20397
+ var key = _ref;
20398
+ var field = get$2(fields, key);
20399
+ if (field) {
20400
+ var _f = field._f, currentField = _object_without_properties$7(field, [
20401
+ "_f"
20402
+ ]);
20403
+ if (_f) {
20404
+ if (_f.refs && _f.refs[0] && action(_f.refs[0], key) && !abortEarly) {
20405
+ return true;
20406
+ } else if (_f.ref && action(_f.ref, _f.name) && !abortEarly) {
20407
+ return true;
20408
+ } else {
20409
+ if (iterateFieldsByAction(currentField, action)) {
20410
+ break;
20411
+ }
20412
+ }
20413
+ } else if (isObject$a(currentField)) {
20414
+ if (iterateFieldsByAction(currentField, action)) {
20415
+ break;
20416
+ }
20417
+ }
20418
+ }
20419
+ }
20420
+ } catch (err) {
20421
+ _didIteratorError = true;
20422
+ _iteratorError = err;
20423
+ } finally{
20424
+ try {
20425
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
20426
+ _iterator.return();
20427
+ }
20428
+ } finally{
20429
+ if (_didIteratorError) {
20430
+ throw _iteratorError;
20431
+ }
20432
+ }
20433
+ }
20434
+ return;
20435
+ };
20693
20436
  function schemaErrorLookup(errors, _fields, name) {
20694
20437
  var error = get$2(errors, name);
20695
20438
  if (error || isKey$4(name)) {
@@ -20720,6 +20463,20 @@ function schemaErrorLookup(errors, _fields, name) {
20720
20463
  name: name
20721
20464
  };
20722
20465
  }
20466
+ var shouldRenderFormState = function(formStateData, _proxyFormState, updateFormState, isRoot) {
20467
+ updateFormState(formStateData);
20468
+ formStateData.name; var formState = _object_without_properties$7(formStateData, [
20469
+ "name"
20470
+ ]);
20471
+ return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find(function(key) {
20472
+ return _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all);
20473
+ });
20474
+ };
20475
+ var shouldSubscribeByName = function(name, signalName, exact) {
20476
+ return !name || !signalName || name === signalName || convertToArrayPayload(name).some(function(currentName) {
20477
+ return currentName && (exact ? currentName === signalName : currentName.startsWith(signalName) || signalName.startsWith(currentName));
20478
+ });
20479
+ };
20723
20480
  var skipValidation = function(isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) {
20724
20481
  if (mode.isOnAll) {
20725
20482
  return false;
@@ -20735,6 +20492,257 @@ var skipValidation = function(isBlurEvent, isTouched, isSubmitted, reValidateMod
20735
20492
  var unsetEmptyArray = function(ref, name) {
20736
20493
  return !compact(get$2(ref, name)).length && unset(ref, name);
20737
20494
  };
20495
+ var updateFieldArrayRootError = function(errors, error, name) {
20496
+ var fieldArrayErrors = convertToArrayPayload(get$2(errors, name));
20497
+ set(fieldArrayErrors, "root", error[name]);
20498
+ set(errors, name, fieldArrayErrors);
20499
+ return errors;
20500
+ };
20501
+ var isMessage = function(value1) {
20502
+ return isString(value1);
20503
+ };
20504
+ function getValidateError(result, ref) {
20505
+ var type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "validate";
20506
+ if (isMessage(result) || Array.isArray(result) && result.every(isMessage) || isBoolean(result) && !result) {
20507
+ return {
20508
+ type: type,
20509
+ message: isMessage(result) ? result : "",
20510
+ ref: ref
20511
+ };
20512
+ }
20513
+ }
20514
+ var getValueAndMessage = function(validationData) {
20515
+ return isObject$a(validationData) && !isRegex(validationData) ? validationData : {
20516
+ value: validationData,
20517
+ message: ""
20518
+ };
20519
+ };
20520
+ var validateField = function() {
20521
+ var _ref = _async_to_generator$2(function(field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) {
20522
+ var _field__f, ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, valueAsNumber, mount, inputValue, inputRef, setCustomValidity, error, isRadio, isCheckBox, isRadioOrCheckbox, isEmpty, appendErrorsCurry, getMinMaxMessage, _ref, value1, message, exceedMax, exceedMin, maxOutput, minOutput, valueNumber, valueDate, convertTimeToDate, isTime, isWeek, maxLengthOutput, minLengthOutput, exceedMax1, exceedMin1, _getValueAndMessage, patternValue, message1, result, validateError, validationResult, _tmp, _tmp1, _i, key, validateError1;
20523
+ return _ts_generator$2(this, function(_state) {
20524
+ switch(_state.label){
20525
+ case 0:
20526
+ _field__f = field._f, ref = _field__f.ref, refs = _field__f.refs, required = _field__f.required, maxLength = _field__f.maxLength, minLength = _field__f.minLength, min = _field__f.min, max = _field__f.max, pattern = _field__f.pattern, validate = _field__f.validate, name = _field__f.name, valueAsNumber = _field__f.valueAsNumber, mount = _field__f.mount;
20527
+ inputValue = get$2(formValues, name);
20528
+ if (!mount || disabledFieldNames.has(name)) {
20529
+ return [
20530
+ 2,
20531
+ {}
20532
+ ];
20533
+ }
20534
+ inputRef = refs ? refs[0] : ref;
20535
+ setCustomValidity = function(message) {
20536
+ if (shouldUseNativeValidation && inputRef.reportValidity) {
20537
+ inputRef.setCustomValidity(isBoolean(message) ? "" : message || "");
20538
+ inputRef.reportValidity();
20539
+ }
20540
+ };
20541
+ error = {};
20542
+ isRadio = isRadioInput(ref);
20543
+ isCheckBox = isCheckBoxInput(ref);
20544
+ isRadioOrCheckbox = isRadio || isCheckBox;
20545
+ isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement$3(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
20546
+ appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error);
20547
+ getMinMaxMessage = function(exceedMax, maxLengthMessage, minLengthMessage) {
20548
+ var maxType = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : INPUT_VALIDATION_RULES.maxLength, minType = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : INPUT_VALIDATION_RULES.minLength;
20549
+ var message = exceedMax ? maxLengthMessage : minLengthMessage;
20550
+ error[name] = _object_spread$e({
20551
+ type: exceedMax ? maxType : minType,
20552
+ message: message,
20553
+ ref: ref
20554
+ }, appendErrorsCurry(exceedMax ? maxType : minType, message));
20555
+ };
20556
+ if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) {
20557
+ _ref = isMessage(required) ? {
20558
+ value: !!required,
20559
+ message: required
20560
+ } : getValueAndMessage(required), value1 = _ref.value, message = _ref.message;
20561
+ if (value1) {
20562
+ error[name] = _object_spread$e({
20563
+ type: INPUT_VALIDATION_RULES.required,
20564
+ message: message,
20565
+ ref: inputRef
20566
+ }, appendErrorsCurry(INPUT_VALIDATION_RULES.required, message));
20567
+ if (!validateAllFieldCriteria) {
20568
+ setCustomValidity(message);
20569
+ return [
20570
+ 2,
20571
+ error
20572
+ ];
20573
+ }
20574
+ }
20575
+ }
20576
+ if (!isEmpty && (!isNullOrUndefined(min) || !isNullOrUndefined(max))) {
20577
+ maxOutput = getValueAndMessage(max);
20578
+ minOutput = getValueAndMessage(min);
20579
+ if (!isNullOrUndefined(inputValue) && !isNaN(inputValue)) {
20580
+ valueNumber = ref.valueAsNumber || (inputValue ? +inputValue : inputValue);
20581
+ if (!isNullOrUndefined(maxOutput.value)) {
20582
+ exceedMax = valueNumber > maxOutput.value;
20583
+ }
20584
+ if (!isNullOrUndefined(minOutput.value)) {
20585
+ exceedMin = valueNumber < minOutput.value;
20586
+ }
20587
+ } else {
20588
+ valueDate = ref.valueAsDate || new Date(inputValue);
20589
+ convertTimeToDate = function(time) {
20590
+ return new Date(new Date().toDateString() + " " + time);
20591
+ };
20592
+ isTime = ref.type == "time";
20593
+ isWeek = ref.type == "week";
20594
+ if (isString(maxOutput.value) && inputValue) {
20595
+ exceedMax = isTime ? convertTimeToDate(inputValue) > convertTimeToDate(maxOutput.value) : isWeek ? inputValue > maxOutput.value : valueDate > new Date(maxOutput.value);
20596
+ }
20597
+ if (isString(minOutput.value) && inputValue) {
20598
+ exceedMin = isTime ? convertTimeToDate(inputValue) < convertTimeToDate(minOutput.value) : isWeek ? inputValue < minOutput.value : valueDate < new Date(minOutput.value);
20599
+ }
20600
+ }
20601
+ if (exceedMax || exceedMin) {
20602
+ getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
20603
+ if (!validateAllFieldCriteria) {
20604
+ setCustomValidity(error[name].message);
20605
+ return [
20606
+ 2,
20607
+ error
20608
+ ];
20609
+ }
20610
+ }
20611
+ }
20612
+ if ((maxLength || minLength) && !isEmpty && (isString(inputValue) || isFieldArray && Array.isArray(inputValue))) {
20613
+ maxLengthOutput = getValueAndMessage(maxLength);
20614
+ minLengthOutput = getValueAndMessage(minLength);
20615
+ exceedMax1 = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > +maxLengthOutput.value;
20616
+ exceedMin1 = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < +minLengthOutput.value;
20617
+ if (exceedMax1 || exceedMin1) {
20618
+ getMinMaxMessage(exceedMax1, maxLengthOutput.message, minLengthOutput.message);
20619
+ if (!validateAllFieldCriteria) {
20620
+ setCustomValidity(error[name].message);
20621
+ return [
20622
+ 2,
20623
+ error
20624
+ ];
20625
+ }
20626
+ }
20627
+ }
20628
+ if (pattern && !isEmpty && isString(inputValue)) {
20629
+ _getValueAndMessage = getValueAndMessage(pattern), patternValue = _getValueAndMessage.value, message1 = _getValueAndMessage.message;
20630
+ if (isRegex(patternValue) && !inputValue.match(patternValue)) {
20631
+ error[name] = _object_spread$e({
20632
+ type: INPUT_VALIDATION_RULES.pattern,
20633
+ message: message1,
20634
+ ref: ref
20635
+ }, appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message1));
20636
+ if (!validateAllFieldCriteria) {
20637
+ setCustomValidity(message1);
20638
+ return [
20639
+ 2,
20640
+ error
20641
+ ];
20642
+ }
20643
+ }
20644
+ }
20645
+ if (!validate) return [
20646
+ 3,
20647
+ 7
20648
+ ];
20649
+ if (!isFunction$5(validate)) return [
20650
+ 3,
20651
+ 2
20652
+ ];
20653
+ return [
20654
+ 4,
20655
+ validate(inputValue, formValues)
20656
+ ];
20657
+ case 1:
20658
+ result = _state.sent();
20659
+ validateError = getValidateError(result, inputRef);
20660
+ if (validateError) {
20661
+ error[name] = _object_spread$e({}, validateError, appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message));
20662
+ if (!validateAllFieldCriteria) {
20663
+ setCustomValidity(validateError.message);
20664
+ return [
20665
+ 2,
20666
+ error
20667
+ ];
20668
+ }
20669
+ }
20670
+ return [
20671
+ 3,
20672
+ 7
20673
+ ];
20674
+ case 2:
20675
+ if (!isObject$a(validate)) return [
20676
+ 3,
20677
+ 7
20678
+ ];
20679
+ validationResult = {};
20680
+ _tmp = [];
20681
+ for(_tmp1 in validate)_tmp.push(_tmp1);
20682
+ _i = 0;
20683
+ _state.label = 3;
20684
+ case 3:
20685
+ if (!(_i < _tmp.length)) return [
20686
+ 3,
20687
+ 6
20688
+ ];
20689
+ key = _tmp[_i];
20690
+ if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {
20691
+ return [
20692
+ 3,
20693
+ 6
20694
+ ];
20695
+ }
20696
+ return [
20697
+ 4,
20698
+ validate[key](inputValue, formValues)
20699
+ ];
20700
+ case 4:
20701
+ validateError1 = getValidateError.apply(void 0, [
20702
+ _state.sent(),
20703
+ inputRef,
20704
+ key
20705
+ ]);
20706
+ if (validateError1) {
20707
+ validationResult = _object_spread$e({}, validateError1, appendErrorsCurry(key, validateError1.message));
20708
+ setCustomValidity(validateError1.message);
20709
+ if (validateAllFieldCriteria) {
20710
+ error[name] = validationResult;
20711
+ }
20712
+ }
20713
+ _state.label = 5;
20714
+ case 5:
20715
+ _i++;
20716
+ return [
20717
+ 3,
20718
+ 3
20719
+ ];
20720
+ case 6:
20721
+ if (!isEmptyObject(validationResult)) {
20722
+ error[name] = _object_spread$e({
20723
+ ref: inputRef
20724
+ }, validationResult);
20725
+ if (!validateAllFieldCriteria) {
20726
+ return [
20727
+ 2,
20728
+ error
20729
+ ];
20730
+ }
20731
+ }
20732
+ _state.label = 7;
20733
+ case 7:
20734
+ setCustomValidity(true);
20735
+ return [
20736
+ 2,
20737
+ error
20738
+ ];
20739
+ }
20740
+ });
20741
+ });
20742
+ return function validateField(field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) {
20743
+ return _ref.apply(this, arguments);
20744
+ };
20745
+ }();
20738
20746
  var defaultOptions = {
20739
20747
  mode: VALIDATION_MODE.onSubmit,
20740
20748
  reValidateMode: VALIDATION_MODE.onChange,
@@ -20759,7 +20767,7 @@ function createFormControl() {
20759
20767
  disabled: _options.disabled || false
20760
20768
  };
20761
20769
  var _fields = {};
20762
- var _defaultValues = isObject$a(_options.defaultValues) || isObject$a(_options.values) ? cloneObject(_options.defaultValues || _options.values) || {} : {};
20770
+ var _defaultValues = isObject$a(_options.defaultValues) || isObject$a(_options.values) ? cloneObject(_options.values || _options.defaultValues) || {} : {};
20763
20771
  var _formValues = _options.shouldUnregister ? {} : cloneObject(_defaultValues);
20764
20772
  var _state = {
20765
20773
  action: false,
@@ -20784,8 +20792,8 @@ function createFormControl() {
20784
20792
  isValid: false,
20785
20793
  errors: false
20786
20794
  };
20795
+ var _proxySubscribeFormState = _object_spread$e({}, _proxyFormState);
20787
20796
  var _subjects = {
20788
- values: createSubject(),
20789
20797
  array: createSubject(),
20790
20798
  state: createSubject()
20791
20799
  };
@@ -20798,13 +20806,13 @@ function createFormControl() {
20798
20806
  timer = setTimeout(callback, wait);
20799
20807
  };
20800
20808
  };
20801
- var _updateValid = function() {
20809
+ var _setValid = function() {
20802
20810
  var _ref = _async_to_generator$2(function(shouldUpdateValid) {
20803
20811
  var isValid, _tmp;
20804
20812
  return _ts_generator$2(this, function(_state) {
20805
20813
  switch(_state.label){
20806
20814
  case 0:
20807
- if (!(!_options.disabled && (_proxyFormState.isValid || shouldUpdateValid))) return [
20815
+ if (!(!_options.disabled && (_proxyFormState.isValid || _proxySubscribeFormState.isValid || shouldUpdateValid))) return [
20808
20816
  3,
20809
20817
  5
20810
20818
  ];
@@ -20814,7 +20822,7 @@ function createFormControl() {
20814
20822
  ];
20815
20823
  return [
20816
20824
  4,
20817
- _executeSchema()
20825
+ _runSchema()
20818
20826
  ];
20819
20827
  case 1:
20820
20828
  _tmp = isEmptyObject.apply(void 0, [
@@ -20847,12 +20855,12 @@ function createFormControl() {
20847
20855
  }
20848
20856
  });
20849
20857
  });
20850
- return function _updateValid(shouldUpdateValid) {
20858
+ return function _setValid(shouldUpdateValid) {
20851
20859
  return _ref.apply(this, arguments);
20852
20860
  };
20853
20861
  }();
20854
20862
  var _updateIsValidating = function(names, isValidating) {
20855
- if (!_options.disabled && (_proxyFormState.isValidating || _proxyFormState.validatingFields)) {
20863
+ if (!_options.disabled && (_proxyFormState.isValidating || _proxyFormState.validatingFields || _proxySubscribeFormState.isValidating || _proxySubscribeFormState.validatingFields)) {
20856
20864
  (names || Array.from(_names.mount)).forEach(function(name) {
20857
20865
  if (name) {
20858
20866
  isValidating ? set(_formState.validatingFields, name, isValidating) : unset(_formState.validatingFields, name);
@@ -20864,7 +20872,7 @@ function createFormControl() {
20864
20872
  });
20865
20873
  }
20866
20874
  };
20867
- var _updateFieldArray = function(name) {
20875
+ var _setFieldArray = function(name) {
20868
20876
  var values = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], method = arguments.length > 2 ? arguments[2] : void 0, args = arguments.length > 3 ? arguments[3] : void 0, shouldSetValues = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true, shouldUpdateFieldsAndState = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true;
20869
20877
  if (args && method && !_options.disabled) {
20870
20878
  _state.action = true;
@@ -20877,11 +20885,11 @@ function createFormControl() {
20877
20885
  shouldSetValues && set(_formState.errors, name, errors);
20878
20886
  unsetEmptyArray(_formState.errors, name);
20879
20887
  }
20880
- if (_proxyFormState.touchedFields && shouldUpdateFieldsAndState && Array.isArray(get$2(_formState.touchedFields, name))) {
20888
+ if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get$2(_formState.touchedFields, name))) {
20881
20889
  var touchedFields = method(get$2(_formState.touchedFields, name), args.argA, args.argB);
20882
20890
  shouldSetValues && set(_formState.touchedFields, name, touchedFields);
20883
20891
  }
20884
- if (_proxyFormState.dirtyFields) {
20892
+ if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) {
20885
20893
  _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
20886
20894
  }
20887
20895
  _subjects.state.next({
@@ -20913,7 +20921,7 @@ function createFormControl() {
20913
20921
  if (field) {
20914
20922
  var defaultValue = get$2(_formValues, name, isUndefined(value1) ? get$2(_defaultValues, name) : value1);
20915
20923
  isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);
20916
- _state.mount && _updateValid();
20924
+ _state.mount && _setValid();
20917
20925
  }
20918
20926
  };
20919
20927
  var updateTouchAndDirty = function(name, fieldValue, isBlurEvent, shouldDirty, shouldRender) {
@@ -20923,25 +20931,24 @@ function createFormControl() {
20923
20931
  name: name
20924
20932
  };
20925
20933
  if (!_options.disabled) {
20926
- var disabledField = !!(get$2(_fields, name) && get$2(_fields, name)._f && get$2(_fields, name)._f.disabled);
20927
20934
  if (!isBlurEvent || shouldDirty) {
20928
- if (_proxyFormState.isDirty) {
20935
+ if (_proxyFormState.isDirty || _proxySubscribeFormState.isDirty) {
20929
20936
  isPreviousDirty = _formState.isDirty;
20930
20937
  _formState.isDirty = output.isDirty = _getDirty();
20931
20938
  shouldUpdateField = isPreviousDirty !== output.isDirty;
20932
20939
  }
20933
- var isCurrentFieldPristine = disabledField || deepEqual(get$2(_defaultValues, name), fieldValue);
20934
- isPreviousDirty = !!(!disabledField && get$2(_formState.dirtyFields, name));
20935
- isCurrentFieldPristine || disabledField ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
20940
+ var isCurrentFieldPristine = deepEqual(get$2(_defaultValues, name), fieldValue);
20941
+ isPreviousDirty = !!get$2(_formState.dirtyFields, name);
20942
+ isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
20936
20943
  output.dirtyFields = _formState.dirtyFields;
20937
- shouldUpdateField = shouldUpdateField || _proxyFormState.dirtyFields && isPreviousDirty !== !isCurrentFieldPristine;
20944
+ shouldUpdateField = shouldUpdateField || (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) && isPreviousDirty !== !isCurrentFieldPristine;
20938
20945
  }
20939
20946
  if (isBlurEvent) {
20940
20947
  var isPreviousFieldTouched = get$2(_formState.touchedFields, name);
20941
20948
  if (!isPreviousFieldTouched) {
20942
20949
  set(_formState.touchedFields, name, isBlurEvent);
20943
20950
  output.touchedFields = _formState.touchedFields;
20944
- shouldUpdateField = shouldUpdateField || _proxyFormState.touchedFields && isPreviousFieldTouched !== isBlurEvent;
20951
+ shouldUpdateField = shouldUpdateField || (_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && isPreviousFieldTouched !== isBlurEvent;
20945
20952
  }
20946
20953
  }
20947
20954
  shouldUpdateField && shouldRender && _subjects.state.next(output);
@@ -20950,7 +20957,7 @@ function createFormControl() {
20950
20957
  };
20951
20958
  var shouldRenderByError = function(name, isValid, error, fieldState) {
20952
20959
  var previousFieldError = get$2(_formState.errors, name);
20953
- var shouldUpdateValid = _proxyFormState.isValid && isBoolean(isValid) && _formState.isValid !== isValid;
20960
+ var shouldUpdateValid = (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isBoolean(isValid) && _formState.isValid !== isValid;
20954
20961
  if (_options.delayError && error) {
20955
20962
  delayErrorCallback = debounce(function() {
20956
20963
  return updateErrors(name, error);
@@ -20972,7 +20979,7 @@ function createFormControl() {
20972
20979
  _subjects.state.next(updatedFormState);
20973
20980
  }
20974
20981
  };
20975
- var _executeSchema = function() {
20982
+ var _runSchema = function() {
20976
20983
  var _ref = _async_to_generator$2(function(name) {
20977
20984
  var result;
20978
20985
  return _ts_generator$2(this, function(_state) {
@@ -20993,7 +21000,7 @@ function createFormControl() {
20993
21000
  }
20994
21001
  });
20995
21002
  });
20996
- return function _executeSchema(name) {
21003
+ return function _runSchema(name) {
20997
21004
  return _ref.apply(this, arguments);
20998
21005
  };
20999
21006
  }();
@@ -21005,7 +21012,7 @@ function createFormControl() {
21005
21012
  case 0:
21006
21013
  return [
21007
21014
  4,
21008
- _executeSchema(names)
21015
+ _runSchema(names)
21009
21016
  ];
21010
21017
  case 1:
21011
21018
  errors = _state.sent().errors;
@@ -21205,9 +21212,9 @@ function createFormControl() {
21205
21212
  } else {
21206
21213
  fieldReference.ref.value = fieldValue;
21207
21214
  if (!fieldReference.ref.type) {
21208
- _subjects.values.next({
21215
+ _subjects.state.next({
21209
21216
  name: name,
21210
- values: _object_spread$e({}, _formValues)
21217
+ values: cloneObject(_formValues)
21211
21218
  });
21212
21219
  }
21213
21220
  }
@@ -21233,9 +21240,9 @@ function createFormControl() {
21233
21240
  if (isFieldArray) {
21234
21241
  _subjects.array.next({
21235
21242
  name: name,
21236
- values: _object_spread$e({}, _formValues)
21243
+ values: cloneObject(_formValues)
21237
21244
  });
21238
- if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields) && options.shouldDirty) {
21245
+ if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields || _proxySubscribeFormState.isDirty || _proxySubscribeFormState.dirtyFields) && options.shouldDirty) {
21239
21246
  _subjects.state.next({
21240
21247
  name: name,
21241
21248
  dirtyFields: getDirtyFields(_defaultValues, _formValues),
@@ -21246,14 +21253,14 @@ function createFormControl() {
21246
21253
  field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options) : setFieldValue(name, cloneValue, options);
21247
21254
  }
21248
21255
  isWatched(name, _names) && _subjects.state.next(_object_spread$e({}, _formState));
21249
- _subjects.values.next({
21256
+ _subjects.state.next({
21250
21257
  name: _state.mount ? name : undefined,
21251
- values: _object_spread$e({}, _formValues)
21258
+ values: cloneObject(_formValues)
21252
21259
  });
21253
21260
  };
21254
21261
  var onChange = function() {
21255
21262
  var _ref = _async_to_generator$2(function(event) {
21256
- var target, name, isFieldValueUpdated, field, getCurrentFieldValue, _updateIsFieldValueUpdated, error, isValid, fieldValue, isBlurEvent, shouldSkipValidation, watched, fieldState, shouldRender, errors, previousErrorLookupResult, errorLookupResult;
21263
+ var target, name, isFieldValueUpdated, field, _updateIsFieldValueUpdated, error, isValid, fieldValue, isBlurEvent, shouldSkipValidation, watched, fieldState, shouldRender, errors, previousErrorLookupResult, errorLookupResult;
21257
21264
  return _ts_generator$2(this, function(_state1) {
21258
21265
  switch(_state1.label){
21259
21266
  case 0:
@@ -21262,9 +21269,6 @@ function createFormControl() {
21262
21269
  name = target.name;
21263
21270
  isFieldValueUpdated = true;
21264
21271
  field = get$2(_fields, name);
21265
- getCurrentFieldValue = function() {
21266
- return target.type ? getFieldValue(field._f) : getEventValue(event);
21267
- };
21268
21272
  _updateIsFieldValueUpdated = function(fieldValue) {
21269
21273
  isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get$2(_formValues, name, fieldValue));
21270
21274
  };
@@ -21272,7 +21276,7 @@ function createFormControl() {
21272
21276
  3,
21273
21277
  7
21274
21278
  ];
21275
- fieldValue = getCurrentFieldValue();
21279
+ fieldValue = target.type ? getFieldValue(field._f) : getEventValue(event);
21276
21280
  isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;
21277
21281
  shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get$2(_formState.errors, name) && !field._f.deps || skipValidation(isBlurEvent, get$2(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);
21278
21282
  watched = isWatched(name, _names, isBlurEvent);
@@ -21283,19 +21287,21 @@ function createFormControl() {
21283
21287
  } else if (field._f.onChange) {
21284
21288
  field._f.onChange(event);
21285
21289
  }
21286
- fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent, false);
21290
+ fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent);
21287
21291
  shouldRender = !isEmptyObject(fieldState) || watched;
21288
- !isBlurEvent && _subjects.values.next({
21292
+ !isBlurEvent && _subjects.state.next({
21289
21293
  name: name,
21290
21294
  type: event.type,
21291
- values: _object_spread$e({}, _formValues)
21295
+ values: cloneObject(_formValues)
21292
21296
  });
21293
21297
  if (shouldSkipValidation) {
21294
- if (_proxyFormState.isValid) {
21295
- if (_options.mode === "onBlur" && isBlurEvent) {
21296
- _updateValid();
21298
+ if (_proxyFormState.isValid || _proxySubscribeFormState.isValid) {
21299
+ if (_options.mode === "onBlur") {
21300
+ if (isBlurEvent) {
21301
+ _setValid();
21302
+ }
21297
21303
  } else if (!isBlurEvent) {
21298
- _updateValid();
21304
+ _setValid();
21299
21305
  }
21300
21306
  }
21301
21307
  return [
@@ -21312,7 +21318,7 @@ function createFormControl() {
21312
21318
  ];
21313
21319
  return [
21314
21320
  4,
21315
- _executeSchema([
21321
+ _runSchema([
21316
21322
  name
21317
21323
  ])
21318
21324
  ];
@@ -21358,7 +21364,7 @@ function createFormControl() {
21358
21364
  6
21359
21365
  ];
21360
21366
  case 4:
21361
- if (!_proxyFormState.isValid) return [
21367
+ if (!(_proxyFormState.isValid || _proxySubscribeFormState.isValid)) return [
21362
21368
  3,
21363
21369
  6
21364
21370
  ];
@@ -21453,7 +21459,7 @@ function createFormControl() {
21453
21459
  ];
21454
21460
  case 3:
21455
21461
  validationResult = _state.sent().every(Boolean);
21456
- !(!validationResult && !_formState.isValid) && _updateValid();
21462
+ !(!validationResult && !_formState.isValid) && _setValid();
21457
21463
  return [
21458
21464
  3,
21459
21465
  6
@@ -21467,7 +21473,7 @@ function createFormControl() {
21467
21473
  validationResult = isValid = _state.sent();
21468
21474
  _state.label = 6;
21469
21475
  case 6:
21470
- _subjects.state.next(_object_spread_props$a(_object_spread$e({}, !isString(name) || _proxyFormState.isValid && isValid !== _formState.isValid ? {} : {
21476
+ _subjects.state.next(_object_spread_props$a(_object_spread$e({}, !isString(name) || (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isValid !== _formState.isValid ? {} : {
21471
21477
  name: name
21472
21478
  }, _options.resolver || !name ? {
21473
21479
  isValid: isValid
@@ -21531,12 +21537,30 @@ function createFormControl() {
21531
21537
  options && options.shouldFocus && ref && ref.focus && ref.focus();
21532
21538
  };
21533
21539
  var watch = function(name, defaultValue) {
21534
- return isFunction$5(name) ? _subjects.values.subscribe({
21540
+ return isFunction$5(name) ? _subjects.state.subscribe({
21535
21541
  next: function(payload) {
21536
21542
  return name(_getWatch(undefined, defaultValue), payload);
21537
21543
  }
21538
21544
  }) : _getWatch(name, defaultValue, true);
21539
21545
  };
21546
+ var _subscribe = function(props) {
21547
+ return _subjects.state.subscribe({
21548
+ next: function(formState) {
21549
+ if (shouldSubscribeByName(props.name, formState.name, props.exact) && shouldRenderFormState(formState, props.formState || _proxyFormState, _setFormState, props.reRenderRoot)) {
21550
+ props.callback(_object_spread$e({
21551
+ values: _object_spread$e({}, _formValues)
21552
+ }, _formState, formState));
21553
+ }
21554
+ }
21555
+ }).unsubscribe;
21556
+ };
21557
+ var subscribe = function(props) {
21558
+ _state.mount = true;
21559
+ _proxySubscribeFormState = _object_spread$e({}, _proxySubscribeFormState, props.formState);
21560
+ return _subscribe(_object_spread_props$a(_object_spread$e({}, props), {
21561
+ formState: _proxySubscribeFormState
21562
+ }));
21563
+ };
21540
21564
  var unregister = function(name) {
21541
21565
  var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
21542
21566
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
@@ -21569,19 +21593,18 @@ function createFormControl() {
21569
21593
  }
21570
21594
  }
21571
21595
  }
21572
- _subjects.values.next({
21573
- values: _object_spread$e({}, _formValues)
21596
+ _subjects.state.next({
21597
+ values: cloneObject(_formValues)
21574
21598
  });
21575
21599
  _subjects.state.next(_object_spread$e({}, _formState, !options.keepDirty ? {} : {
21576
21600
  isDirty: _getDirty()
21577
21601
  }));
21578
- !options.keepIsValid && _updateValid();
21602
+ !options.keepIsValid && _setValid();
21579
21603
  };
21580
- var _updateDisabledField = function(param) {
21581
- var disabled = param.disabled, name = param.name, field = param.field, fields = param.fields;
21604
+ var _setDisabledField = function(param) {
21605
+ var disabled = param.disabled, name = param.name;
21582
21606
  if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(name)) {
21583
21607
  disabled ? _names.disabled.add(name) : _names.disabled.delete(name);
21584
- updateTouchAndDirty(name, getFieldValue(field ? field._f : get$2(fields, name)._f), false, false, true);
21585
21608
  }
21586
21609
  };
21587
21610
  var register = function(name) {
@@ -21600,8 +21623,7 @@ function createFormControl() {
21600
21623
  }));
21601
21624
  _names.mount.add(name);
21602
21625
  if (field) {
21603
- _updateDisabledField({
21604
- field: field,
21626
+ _setDisabledField({
21605
21627
  disabled: isBoolean(options.disabled) ? options.disabled : _options.disabled,
21606
21628
  name: name
21607
21629
  });
@@ -21683,7 +21705,7 @@ function createFormControl() {
21683
21705
  var handleSubmit = function(onValid, onInvalid) {
21684
21706
  return function() {
21685
21707
  var _ref = _async_to_generator$2(function(e) {
21686
- var onValidError, fieldValues, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, name, _ref, errors, values, error;
21708
+ var onValidError, fieldValues, _ref, errors, values, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, name, error;
21687
21709
  return _ts_generator$2(this, function(_state) {
21688
21710
  switch(_state.label){
21689
21711
  case 0:
@@ -21693,28 +21715,6 @@ function createFormControl() {
21693
21715
  e.persist && e.persist();
21694
21716
  }
21695
21717
  fieldValues = cloneObject(_formValues);
21696
- if (_names.disabled.size) {
21697
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
21698
- try {
21699
- for(_iterator = _names.disabled[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
21700
- name = _step.value;
21701
- set(fieldValues, name, undefined);
21702
- }
21703
- } catch (err) {
21704
- _didIteratorError = true;
21705
- _iteratorError = err;
21706
- } finally{
21707
- try {
21708
- if (!_iteratorNormalCompletion && _iterator.return != null) {
21709
- _iterator.return();
21710
- }
21711
- } finally{
21712
- if (_didIteratorError) {
21713
- throw _iteratorError;
21714
- }
21715
- }
21716
- }
21717
- }
21718
21718
  _subjects.state.next({
21719
21719
  isSubmitting: true
21720
21720
  });
@@ -21724,7 +21724,7 @@ function createFormControl() {
21724
21724
  ];
21725
21725
  return [
21726
21726
  4,
21727
- _executeSchema()
21727
+ _runSchema()
21728
21728
  ];
21729
21729
  case 1:
21730
21730
  _ref = _state.sent(), errors = _ref.errors, values = _ref.values;
@@ -21743,6 +21743,28 @@ function createFormControl() {
21743
21743
  _state.sent();
21744
21744
  _state.label = 4;
21745
21745
  case 4:
21746
+ if (_names.disabled.size) {
21747
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
21748
+ try {
21749
+ for(_iterator = _names.disabled[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
21750
+ name = _step.value;
21751
+ set(fieldValues, name, undefined);
21752
+ }
21753
+ } catch (err) {
21754
+ _didIteratorError = true;
21755
+ _iteratorError = err;
21756
+ } finally{
21757
+ try {
21758
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
21759
+ _iterator.return();
21760
+ }
21761
+ } finally{
21762
+ if (_didIteratorError) {
21763
+ throw _iteratorError;
21764
+ }
21765
+ }
21766
+ }
21767
+ }
21746
21768
  unset(_formState.errors, "root");
21747
21769
  if (!isEmptyObject(_formState.errors)) return [
21748
21770
  3,
@@ -21837,7 +21859,7 @@ function createFormControl() {
21837
21859
  }
21838
21860
  if (!options.keepError) {
21839
21861
  unset(_formState.errors, name);
21840
- _proxyFormState.isValid && _updateValid();
21862
+ _proxyFormState.isValid && _setValid();
21841
21863
  }
21842
21864
  _subjects.state.next(_object_spread$e({}, _formState));
21843
21865
  }
@@ -21907,13 +21929,32 @@ function createFormControl() {
21907
21929
  }
21908
21930
  }
21909
21931
  }
21910
- _fields = {};
21932
+ var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
21933
+ try {
21934
+ for(var _iterator2 = _names.mount[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
21935
+ var fieldName1 = _step2.value;
21936
+ setValue(fieldName1, get$2(values, fieldName1));
21937
+ }
21938
+ } catch (err) {
21939
+ _didIteratorError2 = true;
21940
+ _iteratorError2 = err;
21941
+ } finally{
21942
+ try {
21943
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
21944
+ _iterator2.return();
21945
+ }
21946
+ } finally{
21947
+ if (_didIteratorError2) {
21948
+ throw _iteratorError2;
21949
+ }
21950
+ }
21951
+ }
21911
21952
  }
21912
- _formValues = _options.shouldUnregister ? keepStateOptions.keepDefaultValues ? cloneObject(_defaultValues) : {} : cloneObject(values);
21953
+ _formValues = cloneObject(values);
21913
21954
  _subjects.array.next({
21914
21955
  values: _object_spread$e({}, values)
21915
21956
  });
21916
- _subjects.values.next({
21957
+ _subjects.state.next({
21917
21958
  values: _object_spread$e({}, values)
21918
21959
  });
21919
21960
  }
@@ -21954,7 +21995,7 @@ function createFormControl() {
21954
21995
  }
21955
21996
  }
21956
21997
  };
21957
- var _updateFormState = function(updatedFormState) {
21998
+ var _setFormState = function(updatedFormState) {
21958
21999
  _formState = _object_spread$e({}, _formState, updatedFormState);
21959
22000
  };
21960
22001
  var _resetDefaultValues = function() {
@@ -21965,28 +22006,28 @@ function createFormControl() {
21965
22006
  });
21966
22007
  });
21967
22008
  };
21968
- return {
22009
+ var methods = {
21969
22010
  control: {
21970
22011
  register: register,
21971
22012
  unregister: unregister,
21972
22013
  getFieldState: getFieldState,
21973
22014
  handleSubmit: handleSubmit,
21974
22015
  setError: setError,
21975
- _executeSchema: _executeSchema,
22016
+ _subscribe: _subscribe,
22017
+ _runSchema: _runSchema,
21976
22018
  _getWatch: _getWatch,
21977
22019
  _getDirty: _getDirty,
21978
- _updateValid: _updateValid,
21979
- _removeUnmounted: _removeUnmounted,
21980
- _updateFieldArray: _updateFieldArray,
21981
- _updateDisabledField: _updateDisabledField,
22020
+ _setValid: _setValid,
22021
+ _setFieldArray: _setFieldArray,
22022
+ _setDisabledField: _setDisabledField,
22023
+ _setErrors: _setErrors,
21982
22024
  _getFieldArray: _getFieldArray,
21983
22025
  _reset: _reset,
21984
22026
  _resetDefaultValues: _resetDefaultValues,
21985
- _updateFormState: _updateFormState,
22027
+ _removeUnmounted: _removeUnmounted,
21986
22028
  _disableForm: _disableForm,
21987
22029
  _subjects: _subjects,
21988
22030
  _proxyFormState: _proxyFormState,
21989
- _setErrors: _setErrors,
21990
22031
  get _fields () {
21991
22032
  return _fields;
21992
22033
  },
@@ -22011,9 +22052,6 @@ function createFormControl() {
22011
22052
  get _formState () {
22012
22053
  return _formState;
22013
22054
  },
22014
- set _formState (value){
22015
- _formState = value;
22016
- },
22017
22055
  get _options () {
22018
22056
  return _options;
22019
22057
  },
@@ -22021,6 +22059,7 @@ function createFormControl() {
22021
22059
  _options = _object_spread$e({}, _options, value);
22022
22060
  }
22023
22061
  },
22062
+ subscribe: subscribe,
22024
22063
  trigger: trigger,
22025
22064
  register: register,
22026
22065
  handleSubmit: handleSubmit,
@@ -22035,6 +22074,9 @@ function createFormControl() {
22035
22074
  setFocus: setFocus,
22036
22075
  getFieldState: getFieldState
22037
22076
  };
22077
+ return _object_spread_props$a(_object_spread$e({}, methods), {
22078
+ formControl: methods
22079
+ });
22038
22080
  }
22039
22081
  /**
22040
22082
  * Custom hook to manage the entire form.
@@ -22085,20 +22127,26 @@ function createFormControl() {
22085
22127
  defaultValues: isFunction$5(props.defaultValues) ? undefined : props.defaultValues
22086
22128
  }), 2), formState = _React_useState[0], updateFormState = _React_useState[1];
22087
22129
  if (!_formControl.current) {
22088
- _formControl.current = _object_spread_props$a(_object_spread$e({}, createFormControl(props)), {
22130
+ _formControl.current = _object_spread_props$a(_object_spread$e({}, props.formControl ? props.formControl : createFormControl(props)), {
22089
22131
  formState: formState
22090
22132
  });
22133
+ if (props.formControl && props.defaultValues && !isFunction$5(props.defaultValues)) {
22134
+ props.formControl.reset(props.defaultValues, props.resetOptions);
22135
+ }
22091
22136
  }
22092
22137
  var control = _formControl.current.control;
22093
22138
  control._options = props;
22094
- useSubscribe({
22095
- subject: control._subjects.state,
22096
- next: function(value1) {
22097
- if (shouldRenderFormState(value1, control._proxyFormState, control._updateFormState, true)) {
22098
- updateFormState(_object_spread$e({}, control._formState));
22099
- }
22100
- }
22101
- });
22139
+ React__default.useLayoutEffect(function() {
22140
+ return control._subscribe({
22141
+ formState: control._proxyFormState,
22142
+ callback: function() {
22143
+ return updateFormState(_object_spread$e({}, control._formState));
22144
+ },
22145
+ reRenderRoot: true
22146
+ });
22147
+ }, [
22148
+ control
22149
+ ]);
22102
22150
  React__default.useEffect(function() {
22103
22151
  return control._disableForm(props.disabled);
22104
22152
  }, [
@@ -22133,7 +22181,7 @@ function createFormControl() {
22133
22181
  control
22134
22182
  ]);
22135
22183
  React__default.useEffect(function() {
22136
- if (props.errors) {
22184
+ if (props.errors && !isEmptyObject(props.errors)) {
22137
22185
  control._setErrors(props.errors);
22138
22186
  }
22139
22187
  }, [
@@ -22142,7 +22190,7 @@ function createFormControl() {
22142
22190
  ]);
22143
22191
  React__default.useEffect(function() {
22144
22192
  if (!control._state.mount) {
22145
- control._updateValid();
22193
+ control._setValid();
22146
22194
  control._state.mount = true;
22147
22195
  }
22148
22196
  if (control._state.watch) {
@@ -22152,7 +22200,7 @@ function createFormControl() {
22152
22200
  control._removeUnmounted();
22153
22201
  });
22154
22202
  React__default.useEffect(function() {
22155
- props.shouldUnregister && control._subjects.values.next({
22203
+ props.shouldUnregister && control._subjects.state.next({
22156
22204
  values: control._getWatch()
22157
22205
  });
22158
22206
  }, [
@@ -30553,13 +30601,13 @@ function _instanceof$4(left, right) {
30553
30601
  return left instanceof right;
30554
30602
  }
30555
30603
  }
30556
- var f = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled", m = "active", y = "data-styled-version", v = "6.1.16", g = "/*!sc*/\n", S = "undefined" != typeof window && "HTMLElement" in window, w = Boolean("boolean" == typeof SC_DISABLE_SPEEDY ? SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.REACT_APP_SC_DISABLE_SPEEDY && "" !== process.env.REACT_APP_SC_DISABLE_SPEEDY ? "false" !== process.env.REACT_APP_SC_DISABLE_SPEEDY && process.env.REACT_APP_SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.SC_DISABLE_SPEEDY && "" !== process.env.SC_DISABLE_SPEEDY ? "false" !== process.env.SC_DISABLE_SPEEDY && process.env.SC_DISABLE_SPEEDY : "production" !== process.env.NODE_ENV), E = /invalid hook call/i, N = new Set, P = function P(t, n) {
30604
+ var f = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled", m = "active", y = "data-styled-version", v = "6.1.17", g = "/*!sc*/\n", S = "undefined" != typeof window && "HTMLElement" in window, w = Boolean("boolean" == typeof SC_DISABLE_SPEEDY ? SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.REACT_APP_SC_DISABLE_SPEEDY && "" !== process.env.REACT_APP_SC_DISABLE_SPEEDY ? "false" !== process.env.REACT_APP_SC_DISABLE_SPEEDY && process.env.REACT_APP_SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.SC_DISABLE_SPEEDY && "" !== process.env.SC_DISABLE_SPEEDY ? "false" !== process.env.SC_DISABLE_SPEEDY && process.env.SC_DISABLE_SPEEDY : "production" !== process.env.NODE_ENV), E = /invalid hook call/i, N = new Set, P = function P(t, n) {
30557
30605
  if ("production" !== process.env.NODE_ENV) {
30558
- var _$r = n ? ' with the id of "'.concat(n, '"') : "", s = "The component ".concat(t).concat(_$r, " has been created dynamically.\n") + "You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.", i = console.error;
30606
+ var _$o = n ? ' with the id of "'.concat(n, '"') : "", s = "The component ".concat(t).concat(_$o, " has been created dynamically.\n") + "You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.\nSee https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.\n", i = console.error;
30559
30607
  try {
30560
30608
  var a = !0;
30561
30609
  console.error = function(t) {
30562
- for(var _$n = [], _$r = 1; _$r < arguments.length; _$r++)_$n[_$r - 1] = arguments[_$r];
30610
+ for(var _$n = [], _$o = 1; _$o < arguments.length; _$o++)_$n[_$o - 1] = arguments[_$o];
30563
30611
  E.test(t) ? (a = !1, N.delete(s)) : i.apply(void 0, __spreadArray([
30564
30612
  t
30565
30613
  ], _$n, !1));
@@ -30774,16 +30822,16 @@ function X(e) {
30774
30822
  var t;
30775
30823
  }
30776
30824
  var Z = Object.defineProperty, K = Object.getOwnPropertyNames, Q = Object.getOwnPropertySymbols, ee = Object.getOwnPropertyDescriptor, te = Object.getPrototypeOf, ne = Object.prototype;
30777
- function re(e, t, n) {
30825
+ function oe(e, t, n) {
30778
30826
  if ("string" != typeof t) {
30779
30827
  if (ne) {
30780
- var _$r = te(t);
30781
- _$r && _$r !== ne && re(e, _$r, n);
30828
+ var _$o = te(t);
30829
+ _$o && _$o !== ne && oe(e, _$o, n);
30782
30830
  }
30783
- var o = K(t);
30784
- Q && (o = o.concat(Q(t)));
30785
- for(var s = X(e), i = X(t), a = 0; a < o.length; ++a){
30786
- var c = o[a];
30831
+ var r = K(t);
30832
+ Q && (r = r.concat(Q(t)));
30833
+ for(var s = X(e), i = X(t), a = 0; a < r.length; ++a){
30834
+ var c = r[a];
30787
30835
  if (!(c in H || n && n[c] || i && c in i || s && c in s)) {
30788
30836
  var l = ee(t, c);
30789
30837
  try {
@@ -30794,7 +30842,7 @@ function re(e, t, n) {
30794
30842
  }
30795
30843
  return e;
30796
30844
  }
30797
- function oe(e) {
30845
+ function re(e) {
30798
30846
  return "function" == typeof e;
30799
30847
  }
30800
30848
  function se(e) {
@@ -30805,7 +30853,7 @@ function ie(e, t) {
30805
30853
  }
30806
30854
  function ae(e, t) {
30807
30855
  if (0 === e.length) return "";
30808
- for(var n = e[0], _$r = 1; _$r < e.length; _$r++)n += t ? t + e[_$r] : e[_$r];
30856
+ for(var n = e[0], _$o = 1; _$o < e.length; _$o++)n += t ? t + e[_$o] : e[_$o];
30809
30857
  return n;
30810
30858
  }
30811
30859
  function ce(e) {
@@ -30813,8 +30861,8 @@ function ce(e) {
30813
30861
  }
30814
30862
  function le(e, t, n) {
30815
30863
  if (void 0 === n && (n = !1), !n && !ce(e) && !Array.isArray(e)) return t;
30816
- if (Array.isArray(t)) for(var _$r = 0; _$r < t.length; _$r++)e[_$r] = le(e[_$r], t[_$r]);
30817
- else if (ce(t)) for(var _$r in t)e[_$r] = le(e[_$r], t[_$r]);
30864
+ if (Array.isArray(t)) for(var _$o = 0; _$o < t.length; _$o++)e[_$o] = le(e[_$o], t[_$o]);
30865
+ else if (ce(t)) for(var _$o in t)e[_$o] = le(e[_$o], t[_$o]);
30818
30866
  return e;
30819
30867
  }
30820
30868
  function ue(e, t) {
@@ -30844,13 +30892,13 @@ var pe = "production" !== process.env.NODE_ENV ? {
30844
30892
  } : {};
30845
30893
  function de() {
30846
30894
  for(var e = [], t = 0; t < arguments.length; t++)e[t] = arguments[t];
30847
- for(var n = e[0], _$r = [], o = 1, s = e.length; o < s; o += 1)_$r.push(e[o]);
30848
- return _$r.forEach(function(e) {
30895
+ for(var n = e[0], _$o = [], r = 1, s = e.length; r < s; r += 1)_$o.push(e[r]);
30896
+ return _$o.forEach(function(e) {
30849
30897
  n = n.replace(/%[a-z]/, e);
30850
30898
  }), n;
30851
30899
  }
30852
30900
  function he(t) {
30853
- for(var n = [], _$r = 1; _$r < arguments.length; _$r++)n[_$r - 1] = arguments[_$r];
30901
+ for(var n = [], _$o = 1; _$o < arguments.length; _$o++)n[_$o - 1] = arguments[_$o];
30854
30902
  return "production" === process.env.NODE_ENV ? new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t, " for more information.").concat(n.length > 0 ? " Args: ".concat(n.join(", ")) : "")) : new Error(de.apply(void 0, __spreadArray([
30855
30903
  pe[t]
30856
30904
  ], n, !1)).trim());
@@ -30864,21 +30912,21 @@ var fe = function() {
30864
30912
  return t;
30865
30913
  }, e.prototype.insertRules = function(e, t) {
30866
30914
  if (e >= this.groupSizes.length) {
30867
- for(var n = this.groupSizes, _$r = n.length, o = _$r; e >= o;)if ((o <<= 1) < 0) throw he(16, "".concat(e));
30868
- this.groupSizes = new Uint32Array(o), this.groupSizes.set(n), this.length = o;
30869
- for(var s = _$r; s < o; s++)this.groupSizes[s] = 0;
30915
+ for(var n = this.groupSizes, _$o = n.length, r = _$o; e >= r;)if ((r <<= 1) < 0) throw he(16, "".concat(e));
30916
+ this.groupSizes = new Uint32Array(r), this.groupSizes.set(n), this.length = r;
30917
+ for(var s = _$o; s < r; s++)this.groupSizes[s] = 0;
30870
30918
  }
30871
30919
  for(var i = this.indexOfGroup(e + 1), a = (s = 0, t.length); s < a; s++)this.tag.insertRule(i, t[s]) && (this.groupSizes[e]++, i++);
30872
30920
  }, e.prototype.clearGroup = function(e) {
30873
30921
  if (e < this.length) {
30874
- var t = this.groupSizes[e], n = this.indexOfGroup(e), _$r = n + t;
30922
+ var t = this.groupSizes[e], n = this.indexOfGroup(e), _$o = n + t;
30875
30923
  this.groupSizes[e] = 0;
30876
- for(var o = n; o < _$r; o++)this.tag.deleteRule(n);
30924
+ for(var r = n; r < _$o; r++)this.tag.deleteRule(n);
30877
30925
  }
30878
30926
  }, e.prototype.getGroup = function(e) {
30879
30927
  var t = "";
30880
30928
  if (e >= this.length || 0 === this.groupSizes[e]) return t;
30881
- for(var n = this.groupSizes[e], _$r = this.indexOfGroup(e), o = _$r + n, s = _$r; s < o; s++)t += "".concat(this.tag.getRule(s)).concat(g);
30929
+ for(var n = this.groupSizes[e], _$o = this.indexOfGroup(e), r = _$o + n, s = _$o; s < r; s++)t += "".concat(this.tag.getRule(s)).concat(g);
30882
30930
  return t;
30883
30931
  }, e;
30884
30932
  }(), me = 1 << 30, ye = new Map, ve = new Map, ge = 1, Se = function Se(e) {
@@ -30890,42 +30938,42 @@ var fe = function() {
30890
30938
  }, we = function we(e, t) {
30891
30939
  ge = t + 1, ye.set(e, t), ve.set(t, e);
30892
30940
  }, be = "style[".concat(f, "][").concat(y, '="').concat(v, '"]'), Ee = new RegExp("^".concat(f, '\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')), Ne = function Ne(e, t, n) {
30893
- for(var _$r, o = n.split(","), s = 0, i = o.length; s < i; s++)(_$r = o[s]) && e.registerName(t, _$r);
30941
+ for(var _$o, r = n.split(","), s = 0, i = r.length; s < i; s++)(_$o = r[s]) && e.registerName(t, _$o);
30894
30942
  }, Pe = function Pe(e, t) {
30895
- for(var n, _$r = (null !== (n = t.textContent) && void 0 !== n ? n : "").split(g), o = [], s = 0, i = _$r.length; s < i; s++){
30896
- var a = _$r[s].trim();
30943
+ for(var n, _$o = (null !== (n = t.textContent) && void 0 !== n ? n : "").split(g), r = [], s = 0, i = _$o.length; s < i; s++){
30944
+ var a = _$o[s].trim();
30897
30945
  if (a) {
30898
30946
  var c = a.match(Ee);
30899
30947
  if (c) {
30900
30948
  var l = 0 | parseInt(c[1], 10), u = c[2];
30901
- 0 !== l && (we(u, l), Ne(e, u, c[3]), e.getTag().insertRules(l, o)), o.length = 0;
30902
- } else o.push(a);
30949
+ 0 !== l && (we(u, l), Ne(e, u, c[3]), e.getTag().insertRules(l, r)), r.length = 0;
30950
+ } else r.push(a);
30903
30951
  }
30904
30952
  }
30905
30953
  }, _e = function _e(e) {
30906
- for(var t = document.querySelectorAll(be), n = 0, _$r = t.length; n < _$r; n++){
30907
- var o = t[n];
30908
- o && o.getAttribute(f) !== m && (Pe(e, o), o.parentNode && o.parentNode.removeChild(o));
30954
+ for(var t = document.querySelectorAll(be), n = 0, _$o = t.length; n < _$o; n++){
30955
+ var r = t[n];
30956
+ r && r.getAttribute(f) !== m && (Pe(e, r), r.parentNode && r.parentNode.removeChild(r));
30909
30957
  }
30910
30958
  };
30911
30959
  function Ce() {
30912
30960
  return "undefined" != typeof __webpack_nonce__ ? __webpack_nonce__ : null;
30913
30961
  }
30914
30962
  var Ie = function Ie(e) {
30915
- var t = document.head, n = e || t, _$r = document.createElement("style"), o = function(e) {
30963
+ var t = document.head, n = e || t, _$o = document.createElement("style"), r = function(e) {
30916
30964
  var t = Array.from(e.querySelectorAll("style[".concat(f, "]")));
30917
30965
  return t[t.length - 1];
30918
- }(n), s = void 0 !== o ? o.nextSibling : null;
30919
- _$r.setAttribute(f, m), _$r.setAttribute(y, v);
30966
+ }(n), s = void 0 !== r ? r.nextSibling : null;
30967
+ _$o.setAttribute(f, m), _$o.setAttribute(y, v);
30920
30968
  var i = Ce();
30921
- return i && _$r.setAttribute("nonce", i), n.insertBefore(_$r, s), _$r;
30969
+ return i && _$o.setAttribute("nonce", i), n.insertBefore(_$o, s), _$o;
30922
30970
  }, Ae = function() {
30923
30971
  function e(e) {
30924
30972
  this.element = Ie(e), this.element.appendChild(document.createTextNode("")), this.sheet = function(e) {
30925
30973
  if (e.sheet) return e.sheet;
30926
- for(var t = document.styleSheets, n = 0, _$r = t.length; n < _$r; n++){
30927
- var o = t[n];
30928
- if (o.ownerNode === e) return o;
30974
+ for(var t = document.styleSheets, n = 0, _$o = t.length; n < _$o; n++){
30975
+ var r = t[n];
30976
+ if (r.ownerNode === e) return r;
30929
30977
  }
30930
30978
  throw he(17);
30931
30979
  }(this.element), this.length = 0;
@@ -30972,33 +31020,33 @@ var Ie = function Ie(e) {
30972
31020
  isServer: !S,
30973
31021
  useCSSOMInjection: !w
30974
31022
  }, ke = function() {
30975
- function e(e, n, r) {
31023
+ function e(e, n, o) {
30976
31024
  void 0 === e && (e = C), void 0 === n && (n = {});
30977
- var o = this;
30978
- this.options = __assign(__assign({}, Te), e), this.gs = n, this.names = new Map(r), this.server = !!e.isServer, !this.server && S && Re && (Re = !1, _e(this)), ue(this, function() {
31025
+ var r = this;
31026
+ this.options = __assign(__assign({}, Te), e), this.gs = n, this.names = new Map(o), this.server = !!e.isServer, !this.server && S && Re && (Re = !1, _e(this)), ue(this, function() {
30979
31027
  return function(e) {
30980
- for(var _$t = e.getTag(), _$n = _$t.length, _$r = "", o = function o(n) {
30981
- var o = function(e) {
31028
+ for(var _$t = e.getTag(), _$n = _$t.length, _$o = "", r = function r(n) {
31029
+ var r = function(e) {
30982
31030
  return ve.get(e);
30983
31031
  }(n);
30984
- if (void 0 === o) return "continue";
30985
- var s = e.names.get(o), i = _$t.getGroup(n);
31032
+ if (void 0 === r) return "continue";
31033
+ var s = e.names.get(r), i = _$t.getGroup(n);
30986
31034
  if (void 0 === s || !s.size || 0 === i.length) return "continue";
30987
- var a = "".concat(f, ".g").concat(n, '[id="').concat(o, '"]'), c = "";
31035
+ var a = "".concat(f, ".g").concat(n, '[id="').concat(r, '"]'), c = "";
30988
31036
  void 0 !== s && s.forEach(function(e) {
30989
31037
  e.length > 0 && (c += "".concat(e, ","));
30990
- }), _$r += "".concat(i).concat(a, '{content:"').concat(c, '"}').concat(g);
30991
- }, s = 0; s < _$n; s++)o(s);
30992
- return _$r;
30993
- }(o);
31038
+ }), _$o += "".concat(i).concat(a, '{content:"').concat(c, '"}').concat(g);
31039
+ }, s = 0; s < _$n; s++)r(s);
31040
+ return _$o;
31041
+ }(r);
30994
31042
  });
30995
31043
  }
30996
31044
  return e.registerId = function(e) {
30997
31045
  return Se(e);
30998
31046
  }, e.prototype.rehydrate = function() {
30999
31047
  !this.server && S && _e(this);
31000
- }, e.prototype.reconstructWithOptions = function(n, r) {
31001
- return void 0 === r && (r = !0), new e(__assign(__assign({}, this.options), n), this.gs, r && this.names || void 0);
31048
+ }, e.prototype.reconstructWithOptions = function(n, o) {
31049
+ return void 0 === o && (o = !0), new e(__assign(__assign({}, this.options), n), this.gs, o && this.names || void 0);
31002
31050
  }, e.prototype.allocateGSInstance = function(e) {
31003
31051
  return this.gs[e] = (this.gs[e] || 0) + 1;
31004
31052
  }, e.prototype.getTag = function() {
@@ -31033,15 +31081,15 @@ function Ve(e, t) {
31033
31081
  });
31034
31082
  }
31035
31083
  function Fe(e) {
31036
- var t, n, _$r, o = void 0 === e ? C : e, s = o.options, i = void 0 === s ? C : s, a = o.plugins, c = void 0 === a ? _$1 : a, l = function l(e, r, o) {
31037
- return o.startsWith(n) && o.endsWith(n) && o.replaceAll(n, "").length > 0 ? ".".concat(t) : e;
31084
+ var t, n, _$o, r = void 0 === e ? C : e, s = r.options, i = void 0 === s ? C : s, a = r.plugins, c = void 0 === a ? _$1 : a, l = function l(e, o, r) {
31085
+ return r.startsWith(n) && r.endsWith(n) && r.replaceAll(n, "").length > 0 ? ".".concat(t) : e;
31038
31086
  }, u = c.slice();
31039
31087
  u.push(function(e) {
31040
- e.type === RULESET && e.value.includes("&") && (e.props[0] = e.props[0].replace(je, n).replace(_$r, l));
31088
+ e.type === RULESET && e.value.includes("&") && (e.props[0] = e.props[0].replace(je, n).replace(_$o, l));
31041
31089
  }), i.prefix && u.push(prefixer), u.push(stringify);
31042
- var p = function p(e, o, s, a) {
31043
- void 0 === o && (o = ""), void 0 === s && (s = ""), void 0 === a && (a = "&"), t = a, n = o, _$r = new RegExp("\\".concat(n, "\\b"), "g");
31044
- var c = e.replace(xe, ""), l = compile(s || o ? "".concat(s, " ").concat(o, " { ").concat(c, " }") : c);
31090
+ var p = function p(e, r, s, a) {
31091
+ void 0 === r && (r = ""), void 0 === s && (s = ""), void 0 === a && (a = "&"), t = a, n = r, _$o = new RegExp("\\".concat(n, "\\b"), "g");
31092
+ var c = e.replace(xe, ""), l = compile(s || r ? "".concat(s, " ").concat(r, " { ").concat(c, " }") : c);
31045
31093
  i.namespace && (l = Ve(l, i.namespace));
31046
31094
  var p = [];
31047
31095
  return serialize(l, middleware(u.concat(rulesheet(function(e) {
@@ -31065,8 +31113,8 @@ var qe = function() {
31065
31113
  var n = this;
31066
31114
  this.inject = function(e, t) {
31067
31115
  void 0 === t && (t = ze);
31068
- var _$r = n.name + t.hash;
31069
- e.hasNameForId(n.id, _$r) || e.insertRules(n.id, _$r, t(n.rules, _$r, "@keyframes"));
31116
+ var _$o = n.name + t.hash;
31117
+ e.hasNameForId(n.id, _$o) || e.insertRules(n.id, _$o, t(n.rules, _$o, "@keyframes"));
31070
31118
  }, this.name = e, this.id = "sc-keyframes-".concat(e), this.rules = t, ue(this, function() {
31071
31119
  throw he(12, String(n.name));
31072
31120
  });
@@ -31079,45 +31127,45 @@ var qe = function() {
31079
31127
  };
31080
31128
  function He(e) {
31081
31129
  for(var t = "", n = 0; n < e.length; n++){
31082
- var _$r = e[n];
31083
- if (1 === n && "-" === _$r && "-" === e[0]) return e;
31084
- We(_$r) ? t += "-" + _$r.toLowerCase() : t += _$r;
31130
+ var _$o = e[n];
31131
+ if (1 === n && "-" === _$o && "-" === e[0]) return e;
31132
+ We(_$o) ? t += "-" + _$o.toLowerCase() : t += _$o;
31085
31133
  }
31086
31134
  return t.startsWith("ms-") ? "-" + t : t;
31087
31135
  }
31088
31136
  var Ue = function Ue(e) {
31089
31137
  return null == e || !1 === e || "" === e;
31090
31138
  }, Je = function Je1(t) {
31091
- var n, _$r, o = [];
31139
+ var n, _$o, r = [];
31092
31140
  for(var s in t){
31093
31141
  var i = t[s];
31094
- t.hasOwnProperty(s) && !Ue(i) && (Array.isArray(i) && i.isCss || oe(i) ? o.push("".concat(He(s), ":"), i, ";") : ce(i) ? o.push.apply(o, __spreadArray(__spreadArray([
31142
+ t.hasOwnProperty(s) && !Ue(i) && (Array.isArray(i) && i.isCss || re(i) ? r.push("".concat(He(s), ":"), i, ";") : ce(i) ? r.push.apply(r, __spreadArray(__spreadArray([
31095
31143
  "".concat(s, " {")
31096
31144
  ], Je(i), !1), [
31097
31145
  "}"
31098
- ], !1)) : o.push("".concat(He(s), ": ").concat((n = s, null == (_$r = i) || "boolean" == typeof _$r || "" === _$r ? "" : "number" != typeof _$r || 0 === _$r || n in unitlessKeys || n.startsWith("--") ? String(_$r).trim() : "".concat(_$r, "px")), ";")));
31146
+ ], !1)) : r.push("".concat(He(s), ": ").concat((n = s, null == (_$o = i) || "boolean" == typeof _$o || "" === _$o ? "" : "number" != typeof _$o || 0 === _$o || n in unitlessKeys || n.startsWith("--") ? String(_$o).trim() : "".concat(_$o, "px")), ";")));
31099
31147
  }
31100
- return o;
31148
+ return r;
31101
31149
  };
31102
- function Xe(e, t, n, r) {
31150
+ function Xe(e, t, n, o) {
31103
31151
  if (Ue(e)) return [];
31104
31152
  if (se(e)) return [
31105
31153
  ".".concat(e.styledComponentId)
31106
31154
  ];
31107
- if (oe(e)) {
31108
- if (!oe(s = e) || s.prototype && s.prototype.isReactComponent || !t) return [
31155
+ if (re(e)) {
31156
+ if (!re(s = e) || s.prototype && s.prototype.isReactComponent || !t) return [
31109
31157
  e
31110
31158
  ];
31111
- var o = e(t);
31112
- return "production" === process.env.NODE_ENV || "object" != typeof o || Array.isArray(o) || _instanceof$4(o, qe) || ce(o) || null === o || console.error("".concat(B(e), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")), Xe(o, t, n, r);
31159
+ var r = e(t);
31160
+ return "production" === process.env.NODE_ENV || "object" != typeof r || Array.isArray(r) || _instanceof$4(r, qe) || ce(r) || null === r || console.error("".concat(B(e), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")), Xe(r, t, n, o);
31113
31161
  }
31114
31162
  var s;
31115
- return _instanceof$4(e, qe) ? n ? (e.inject(n, r), [
31116
- e.getName(r)
31163
+ return _instanceof$4(e, qe) ? n ? (e.inject(n, o), [
31164
+ e.getName(o)
31117
31165
  ]) : [
31118
31166
  e
31119
31167
  ] : ce(e) ? Je(e) : Array.isArray(e) ? Array.prototype.concat.apply(_$1, e.map(function(e) {
31120
- return Xe(e, t, n, r);
31168
+ return Xe(e, t, n, o);
31121
31169
  })) : [
31122
31170
  e.toString()
31123
31171
  ];
@@ -31125,7 +31173,7 @@ function Xe(e, t, n, r) {
31125
31173
  function Ze(e) {
31126
31174
  for(var t = 0; t < e.length; t += 1){
31127
31175
  var n = e[t];
31128
- if (oe(n) && !se(n)) return !1;
31176
+ if (re(n) && !se(n)) return !1;
31129
31177
  }
31130
31178
  return !0;
31131
31179
  }
@@ -31134,15 +31182,15 @@ var Ke = z(v), Qe = function() {
31134
31182
  this.rules = e, this.staticRulesId = "", this.isStatic = "production" === process.env.NODE_ENV && (void 0 === n || n.isStatic) && Ze(e), this.componentId = t, this.baseHash = M(Ke, t), this.baseStyle = n, ke.registerId(t);
31135
31183
  }
31136
31184
  return e.prototype.generateAndInjectStyles = function(e, t, n) {
31137
- var _$r = this.baseStyle ? this.baseStyle.generateAndInjectStyles(e, t, n) : "";
31138
- if (this.isStatic && !n.hash) if (this.staticRulesId && t.hasNameForId(this.componentId, this.staticRulesId)) _$r = ie(_$r, this.staticRulesId);
31185
+ var _$o = this.baseStyle ? this.baseStyle.generateAndInjectStyles(e, t, n) : "";
31186
+ if (this.isStatic && !n.hash) if (this.staticRulesId && t.hasNameForId(this.componentId, this.staticRulesId)) _$o = ie(_$o, this.staticRulesId);
31139
31187
  else {
31140
- var o = ae(Xe(this.rules, e, t, n)), s = x(M(this.baseHash, o) >>> 0);
31188
+ var r = ae(Xe(this.rules, e, t, n)), s = x(M(this.baseHash, r) >>> 0);
31141
31189
  if (!t.hasNameForId(this.componentId, s)) {
31142
- var i = n(o, ".".concat(s), void 0, this.componentId);
31190
+ var i = n(r, ".".concat(s), void 0, this.componentId);
31143
31191
  t.insertRules(this.componentId, s, i);
31144
31192
  }
31145
- _$r = ie(_$r, s), this.staticRulesId = s;
31193
+ _$o = ie(_$o, s), this.staticRulesId = s;
31146
31194
  }
31147
31195
  else {
31148
31196
  for(var a = M(this.baseHash, n.hash), c = "", l = 0; l < this.rules.length; l++){
@@ -31155,55 +31203,55 @@ var Ke = z(v), Qe = function() {
31155
31203
  }
31156
31204
  if (c) {
31157
31205
  var d = x(a >>> 0);
31158
- t.hasNameForId(this.componentId, d) || t.insertRules(this.componentId, d, n(c, ".".concat(d), void 0, this.componentId)), _$r = ie(_$r, d);
31206
+ t.hasNameForId(this.componentId, d) || t.insertRules(this.componentId, d, n(c, ".".concat(d), void 0, this.componentId)), _$o = ie(_$o, d);
31159
31207
  }
31160
31208
  }
31161
- return _$r;
31209
+ return _$o;
31162
31210
  }, e;
31163
31211
  }(), et = React__default.createContext(void 0); et.Consumer;
31164
- var ot = {}, st = new Set;
31165
- function it(e, o, s) {
31166
- var i = se(e), a = e, c = !L(e), p = o.attrs, d = void 0 === p ? _$1 : p, h = o.componentId, f = void 0 === h ? function(e, t) {
31212
+ var rt = {}, st = new Set;
31213
+ function it(e, r, s) {
31214
+ var i = se(e), a = e, c = !L(e), p = r.attrs, d = void 0 === p ? _$1 : p, h = r.componentId, f = void 0 === h ? function(e, t) {
31167
31215
  var n = "string" != typeof e ? "sc" : R(e);
31168
- ot[n] = (ot[n] || 0) + 1;
31169
- var _$r = "".concat(n, "-").concat($(v + n + ot[n]));
31170
- return t ? "".concat(t, "-").concat(_$r) : _$r;
31171
- }(o.displayName, o.parentComponentId) : h, m = o.displayName, y = void 0 === m ? function(e) {
31216
+ rt[n] = (rt[n] || 0) + 1;
31217
+ var _$o = "".concat(n, "-").concat($(v + n + rt[n]));
31218
+ return t ? "".concat(t, "-").concat(_$o) : _$o;
31219
+ }(r.displayName, r.parentComponentId) : h, m = r.displayName, y = void 0 === m ? function(e) {
31172
31220
  return L(e) ? "styled.".concat(e) : "Styled(".concat(B(e), ")");
31173
- }(e) : m, g = o.displayName && o.componentId ? "".concat(R(o.displayName), "-").concat(o.componentId) : o.componentId || f, S = i && a.attrs ? a.attrs.concat(d).filter(Boolean) : d, w = o.shouldForwardProp;
31221
+ }(e) : m, g = r.displayName && r.componentId ? "".concat(R(r.displayName), "-").concat(r.componentId) : r.componentId || f, S = i && a.attrs ? a.attrs.concat(d).filter(Boolean) : d, w = r.shouldForwardProp;
31174
31222
  if (i && a.shouldForwardProp) {
31175
31223
  var b = a.shouldForwardProp;
31176
- if (o.shouldForwardProp) {
31177
- var E = o.shouldForwardProp;
31224
+ if (r.shouldForwardProp) {
31225
+ var E = r.shouldForwardProp;
31178
31226
  w = function w(e, t) {
31179
31227
  return b(e, t) && E(e, t);
31180
31228
  };
31181
31229
  } else w = b;
31182
31230
  }
31183
31231
  var N = new Qe(s, g, i ? a.componentStyle : void 0);
31184
- function O(e, o) {
31185
- return function(e, o, s) {
31232
+ function O(e, r) {
31233
+ return function(e, r, s) {
31186
31234
  var i = e.attrs, a = e.componentStyle, c = e.defaultProps, p = e.foldedComponentIds, d = e.styledComponentId, h = e.target, f = React__default.useContext(et), m = Ge(), y = e.shouldForwardProp || m.shouldForwardProp;
31187
31235
  "production" !== process.env.NODE_ENV && useDebugValue(d);
31188
- var v = I(o, f, c) || C, g = function(e, n, r) {
31189
- for(var _$o, _$s = __assign(__assign({}, n), {
31236
+ var v = I(r, f, c) || C, g = function(e, n, o) {
31237
+ for(var _$r, _$s = __assign(__assign({}, n), {
31190
31238
  className: void 0,
31191
- theme: r
31239
+ theme: o
31192
31240
  }), i = 0; i < e.length; i += 1){
31193
- var a = oe(_$o = e[i]) ? _$o(_$s) : _$o;
31241
+ var a = re(_$r = e[i]) ? _$r(_$s) : _$r;
31194
31242
  for(var c in a)_$s[c] = "className" === c ? ie(_$s[c], a[c]) : "style" === c ? __assign(__assign({}, _$s[c]), a[c]) : a[c];
31195
31243
  }
31196
31244
  return n.className && (_$s.className = ie(_$s.className, n.className)), _$s;
31197
- }(i, o, v), S = g.as || h, w = {};
31245
+ }(i, r, v), S = g.as || h, w = {};
31198
31246
  for(var b in g)void 0 === g[b] || "$" === b[0] || "as" === b || "theme" === b && g.theme === v || ("forwardedAs" === b ? w.as = g.forwardedAs : y && !y(b, S) || (w[b] = g[b], y || "development" !== process.env.NODE_ENV || isPropValid(b) || st.has(b) || !A.has(S) || (st.add(b), console.warn('styled-components: it looks like an unknown prop "'.concat(b, '" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));
31199
31247
  var E = function(e, t) {
31200
- var _$n = Ge(), _$r = e.generateAndInjectStyles(t, _$n.styleSheet, _$n.stylis);
31201
- return "production" !== process.env.NODE_ENV && useDebugValue(_$r), _$r;
31248
+ var _$n = Ge(), _$o = e.generateAndInjectStyles(t, _$n.styleSheet, _$n.stylis);
31249
+ return "production" !== process.env.NODE_ENV && useDebugValue(_$o), _$o;
31202
31250
  }(a, g);
31203
31251
  "production" !== process.env.NODE_ENV && e.warnTooManyClasses && e.warnTooManyClasses(E);
31204
31252
  var N = ie(p, d);
31205
31253
  return E && (N += " " + E), g.className && (N += " " + g.className), w[L(S) && !A.has(S) ? "class" : "className"] = N, s && (w.ref = s), createElement(S, w);
31206
- }(D, e, o);
31254
+ }(D, e, r);
31207
31255
  }
31208
31256
  O.displayName = y;
31209
31257
  var D = React__default.forwardRef(O);
@@ -31214,21 +31262,21 @@ function it(e, o, s) {
31214
31262
  set: function set(e) {
31215
31263
  this._foldedDefaultProps = i ? function(e) {
31216
31264
  for(var t = [], n = 1; n < arguments.length; n++)t[n - 1] = arguments[n];
31217
- for(var _$r = 0, _$o = t; _$r < _$o.length; _$r++)le(e, _$o[_$r], !0);
31265
+ for(var _$o = 0, _$r = t; _$o < _$r.length; _$o++)le(e, _$r[_$o], !0);
31218
31266
  return e;
31219
31267
  }({}, a.defaultProps, e) : e;
31220
31268
  }
31221
31269
  }), "production" !== process.env.NODE_ENV && (P(y, g), D.warnTooManyClasses = function(e, t) {
31222
- var n = {}, _$r = !1;
31223
- return function(o) {
31224
- if (!_$r && (n[o] = !0, Object.keys(n).length >= 200)) {
31270
+ var n = {}, _$o = !1;
31271
+ return function(r) {
31272
+ if (!_$o && (n[r] = !0, Object.keys(n).length >= 200)) {
31225
31273
  var _$s = t ? ' with the id of "'.concat(t, '"') : "";
31226
- console.warn("Over ".concat(200, " classes were generated for component ").concat(e).concat(_$s, ".\n") + "Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"), _$r = !0, n = {};
31274
+ console.warn("Over ".concat(200, " classes were generated for component ").concat(e).concat(_$s, ".\n") + "Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"), _$o = !0, n = {};
31227
31275
  }
31228
31276
  };
31229
31277
  }(y, g)), ue(D, function() {
31230
31278
  return ".".concat(D.styledComponentId);
31231
- }), c && re(D, e, {
31279
+ }), c && oe(D, e, {
31232
31280
  attrs: !0,
31233
31281
  componentStyle: !0,
31234
31282
  displayName: !0,
@@ -31241,7 +31289,7 @@ function it(e, o, s) {
31241
31289
  function at(e, t) {
31242
31290
  for(var n = [
31243
31291
  e[0]
31244
- ], _$r = 0, o = t.length; _$r < o; _$r += 1)n.push(t[_$r], e[_$r + 1]);
31292
+ ], _$o = 0, r = t.length; _$o < r; _$o += 1)n.push(t[_$o], e[_$o + 1]);
31245
31293
  return n;
31246
31294
  }
31247
31295
  var ct = function ct(e) {
@@ -31250,27 +31298,27 @@ var ct = function ct(e) {
31250
31298
  });
31251
31299
  };
31252
31300
  function lt$1(t) {
31253
- for(var n = [], _$r = 1; _$r < arguments.length; _$r++)n[_$r - 1] = arguments[_$r];
31254
- if (oe(t) || ce(t)) return ct(Xe(at(_$1, __spreadArray([
31301
+ for(var n = [], _$o = 1; _$o < arguments.length; _$o++)n[_$o - 1] = arguments[_$o];
31302
+ if (re(t) || ce(t)) return ct(Xe(at(_$1, __spreadArray([
31255
31303
  t
31256
31304
  ], n, !0))));
31257
- var o = t;
31258
- return 0 === n.length && 1 === o.length && "string" == typeof o[0] ? Xe(o) : ct(Xe(at(o, n)));
31305
+ var r = t;
31306
+ return 0 === n.length && 1 === r.length && "string" == typeof r[0] ? Xe(r) : ct(Xe(at(r, n)));
31259
31307
  }
31260
- function ut(n, r, o) {
31261
- if (void 0 === o && (o = C), !r) throw he(1, r);
31308
+ function ut(n, o, r) {
31309
+ if (void 0 === r && (r = C), !o) throw he(1, o);
31262
31310
  var s = function s(t) {
31263
31311
  for(var s = [], i = 1; i < arguments.length; i++)s[i - 1] = arguments[i];
31264
- return n(r, o, lt$1.apply(void 0, __spreadArray([
31312
+ return n(o, r, lt$1.apply(void 0, __spreadArray([
31265
31313
  t
31266
31314
  ], s, !1)));
31267
31315
  };
31268
31316
  return s.attrs = function(e) {
31269
- return ut(n, r, __assign(__assign({}, o), {
31270
- attrs: Array.prototype.concat(o.attrs, e).filter(Boolean)
31317
+ return ut(n, o, __assign(__assign({}, r), {
31318
+ attrs: Array.prototype.concat(r.attrs, e).filter(Boolean)
31271
31319
  }));
31272
31320
  }, s.withConfig = function(e) {
31273
- return ut(n, r, __assign(__assign({}, o), e));
31321
+ return ut(n, o, __assign(__assign({}, r), e));
31274
31322
  }, s;
31275
31323
  }
31276
31324
  var pt = function pt(e) {
@@ -46691,7 +46739,7 @@ var CityDistrict = function(param) {
46691
46739
  };
46692
46740
  return /*#__PURE__*/ jsxs("div", {
46693
46741
  className: [
46694
- "h-24 my-2 mx-0 sm:mx-4 w-full",
46742
+ "h-24 mx-0 sm:mx-4 w-full",
46695
46743
  item === null || item === void 0 ? void 0 : item.className
46696
46744
  ].join(" "),
46697
46745
  children: [
@@ -47212,74 +47260,91 @@ var City = function(param) {
47212
47260
  })
47213
47261
  }, item.name);
47214
47262
  };
47215
- // const CheckboxField: React.FC<FormType> = ({ item }) => {
47216
- // const {
47217
- // control,
47218
- // formState: { errors },
47219
- // } = useFormContext();
47220
- // return (
47221
- // <div className={['w-full min-h-[6rem] h-fit', item?.className].join(' ')}>
47222
- // <FieldLabel item={item} />
47223
- // {item?.checkboxes?.length ? (
47224
- // <div
47225
- // className={[
47226
- // item?.direction === 'horizontal' ? 'flex gap-4' : '',
47227
- // ].join(' ')}
47228
- // >
47229
- // {item?.checkboxes?.map((checkbox, index) => (
47230
- // <div key={index} className="flex items-center gap-1 my-2">
47231
- // <Controller
47232
- // name={checkbox?.name}
47233
- // control={control}
47234
- // rules={
47235
- // checkbox?.validateOption?.required
47236
- // ? { required: checkbox?.errorText }
47237
- // : undefined
47238
- // }
47239
- // render={({ field }) => (
47240
- // <Checkbox
47241
- // {...field}
47242
- // {...checkbox?.muiProps}
47243
- // sx={{ padding: 0 }}
47244
- // />
47245
- // )}
47246
- // />
47247
- // <div className={checkbox?.checkboxLabelClass}>
47248
- // {checkbox?.checkboxLabel}
47249
- // </div>
47250
- // {validateMsg(errors, checkbox) && (
47251
- // <div className="pt-1 text-xs text-[#EF5533]">
47252
- // *{validateMsg(errors, checkbox)}
47253
- // </div>
47254
- // )}
47255
- // </div>
47256
- // ))}
47257
- // </div>
47258
- // ) : (
47259
- // <div className="flex items-center gap-2">
47260
- // <Controller
47261
- // name={item?.name}
47262
- // control={control}
47263
- // rules={
47264
- // item?.validateOption?.required
47265
- // ? { required: item?.errorText }
47266
- // : undefined
47267
- // }
47268
- // render={({ field }) => (
47269
- // <Checkbox {...field} {...item?.muiProps} sx={{ padding: 0 }} />
47270
- // )}
47271
- // />
47272
- // <div className={item?.checkboxLabelClass}>{item?.checkboxLabel}</div>
47273
- // {validateMsg(errors, item) && (
47274
- // <div className="pt-1 text-xs text-[#EF5533]">
47275
- // *{validateMsg(errors, item)}
47276
- // </div>
47277
- // )}
47278
- // </div>
47279
- // )}
47280
- // </div>
47281
- // );
47282
- // };
47263
+ var CheckboxField = function(param) {
47264
+ var item = param.item;
47265
+ var _item_checkboxes, _item_checkboxes1, _item_validateOption;
47266
+ var _useFormContext = useFormContext(), control = _useFormContext.control, errors = _useFormContext.formState.errors;
47267
+ return /*#__PURE__*/ jsxs("div", {
47268
+ className: [
47269
+ "w-full min-h-[6rem] h-fit",
47270
+ item === null || item === void 0 ? void 0 : item.className
47271
+ ].join(" "),
47272
+ children: [
47273
+ /*#__PURE__*/ jsx(FieldLabel, {
47274
+ item: item
47275
+ }),
47276
+ (item === null || item === void 0 ? void 0 : (_item_checkboxes = item.checkboxes) === null || _item_checkboxes === void 0 ? void 0 : _item_checkboxes.length) ? /*#__PURE__*/ jsx("div", {
47277
+ className: [
47278
+ (item === null || item === void 0 ? void 0 : item.direction) === "horizontal" ? "flex gap-4" : ""
47279
+ ].join(" "),
47280
+ children: item === null || item === void 0 ? void 0 : (_item_checkboxes1 = item.checkboxes) === null || _item_checkboxes1 === void 0 ? void 0 : _item_checkboxes1.map(function(checkbox, index) {
47281
+ var _checkbox_validateOption;
47282
+ return /*#__PURE__*/ jsxs("div", {
47283
+ className: "flex items-center gap-1 my-2",
47284
+ children: [
47285
+ /*#__PURE__*/ jsx(Controller, {
47286
+ name: checkbox === null || checkbox === void 0 ? void 0 : checkbox.name,
47287
+ control: control,
47288
+ rules: (checkbox === null || checkbox === void 0 ? void 0 : (_checkbox_validateOption = checkbox.validateOption) === null || _checkbox_validateOption === void 0 ? void 0 : _checkbox_validateOption.required) ? {
47289
+ required: checkbox === null || checkbox === void 0 ? void 0 : checkbox.errorText
47290
+ } : undefined,
47291
+ render: function(param) {
47292
+ var field = param.field;
47293
+ return /*#__PURE__*/ jsx(Checkbox, _object_spread_props$3(_object_spread$6({}, field, checkbox === null || checkbox === void 0 ? void 0 : checkbox.muiProps), {
47294
+ sx: {
47295
+ padding: 0
47296
+ }
47297
+ }));
47298
+ }
47299
+ }),
47300
+ /*#__PURE__*/ jsx("div", {
47301
+ className: checkbox === null || checkbox === void 0 ? void 0 : checkbox.checkboxLabelClass,
47302
+ children: checkbox === null || checkbox === void 0 ? void 0 : checkbox.checkboxLabel
47303
+ }),
47304
+ validateMsg(errors, checkbox) && /*#__PURE__*/ jsxs("div", {
47305
+ className: "pt-1 text-xs text-[#EF5533]",
47306
+ children: [
47307
+ "*",
47308
+ validateMsg(errors, checkbox)
47309
+ ]
47310
+ })
47311
+ ]
47312
+ }, index);
47313
+ })
47314
+ }) : /*#__PURE__*/ jsxs("div", {
47315
+ className: "flex items-center gap-2",
47316
+ children: [
47317
+ /*#__PURE__*/ jsx(Controller, {
47318
+ name: item === null || item === void 0 ? void 0 : item.name,
47319
+ control: control,
47320
+ rules: (item === null || item === void 0 ? void 0 : (_item_validateOption = item.validateOption) === null || _item_validateOption === void 0 ? void 0 : _item_validateOption.required) ? {
47321
+ required: item === null || item === void 0 ? void 0 : item.errorText
47322
+ } : undefined,
47323
+ render: function(param) {
47324
+ var field = param.field;
47325
+ return /*#__PURE__*/ jsx(Checkbox, _object_spread_props$3(_object_spread$6({}, field, item === null || item === void 0 ? void 0 : item.muiProps), {
47326
+ sx: {
47327
+ padding: 0
47328
+ }
47329
+ }));
47330
+ }
47331
+ }),
47332
+ /*#__PURE__*/ jsx("div", {
47333
+ className: item === null || item === void 0 ? void 0 : item.checkboxLabelClass,
47334
+ children: item === null || item === void 0 ? void 0 : item.checkboxLabel
47335
+ }),
47336
+ validateMsg(errors, item) && /*#__PURE__*/ jsxs("div", {
47337
+ className: "pt-1 text-xs text-[#EF5533]",
47338
+ children: [
47339
+ "*",
47340
+ validateMsg(errors, item)
47341
+ ]
47342
+ })
47343
+ ]
47344
+ })
47345
+ ]
47346
+ });
47347
+ };
47283
47348
  var RadioField = function(param) {
47284
47349
  var item = param.item;
47285
47350
  var _item_validateOption;
@@ -47423,9 +47488,9 @@ var Row = function(param) {
47423
47488
  return /*#__PURE__*/ jsx(Time, _object_spread$6({}, baseConfig));
47424
47489
  case "switch":
47425
47490
  return /*#__PURE__*/ jsx(BaseSwitch, _object_spread$6({}, baseConfig));
47426
- // case 'checkbox':
47427
- // case 'checkboxGroup':
47428
- // return <CheckboxField {...baseConfig} />;
47491
+ case "checkbox":
47492
+ case "checkboxGroup":
47493
+ return /*#__PURE__*/ jsx(CheckboxField, _object_spread$6({}, baseConfig));
47429
47494
  case "radio":
47430
47495
  return /*#__PURE__*/ jsx(RadioField, _object_spread$6({}, baseConfig));
47431
47496
  case "textarea":
@@ -47452,7 +47517,9 @@ var Form = {
47452
47517
  Time: Time,
47453
47518
  Textarea: Textarea,
47454
47519
  City: City,
47455
- CityDistrict: CityDistrict
47520
+ CityDistrict: CityDistrict,
47521
+ CheckboxField: CheckboxField,
47522
+ BaseCkeditor: BaseCkeditor
47456
47523
  };
47457
47524
 
47458
47525
  function _define_property$5(obj, key, value) {