ics-ui-kit 1.0.0-alpha.0 → 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CalendarPreviousMonthButton-CHMp8bkd.js +2964 -0
- package/dist/CalendarPreviousMonthButton-CHMp8bkd.js.map +1 -0
- package/dist/{CheckboxField-Ca48ZYoX.js → CheckboxField-xDqHgXHh.js} +2 -2
- package/dist/{CheckboxField-Ca48ZYoX.js.map → CheckboxField-xDqHgXHh.js.map} +1 -1
- package/dist/{Command-CsW4aK7M.js → Command-WsAKNQrY.js} +2 -2
- package/dist/{Command-CsW4aK7M.js.map → Command-WsAKNQrY.js.map} +1 -1
- package/dist/{Dialog-BT_775Iz.js → Dialog-i_Y-phdM.js} +42 -43
- package/dist/Dialog-i_Y-phdM.js.map +1 -0
- package/dist/{Field-BRPdaQ8D.js → Field-BcwUtgGr.js} +2 -2
- package/dist/{Field-BRPdaQ8D.js.map → Field-BcwUtgGr.js.map} +1 -1
- package/dist/{FieldLabel-ic0eq9Un.js → FieldLabel-DYu1AcGH.js} +2 -2
- package/dist/{FieldLabel-ic0eq9Un.js.map → FieldLabel-DYu1AcGH.js.map} +1 -1
- package/dist/{FormFooterTemplate-BIwnBQhL.js → FormFooterTemplate-CHlas_Pp.js} +2 -2
- package/dist/{FormFooterTemplate-BIwnBQhL.js.map → FormFooterTemplate-CHlas_Pp.js.map} +1 -1
- package/dist/FormStack-DfoaOry7.js +1205 -0
- package/dist/FormStack-DfoaOry7.js.map +1 -0
- package/dist/{IconTooltip-CgbefRXG.js → IconTooltip-R6_6_f40.js} +2 -2
- package/dist/{IconTooltip-CgbefRXG.js.map → IconTooltip-R6_6_f40.js.map} +1 -1
- package/dist/{Popover-Dz2eNsXh.js → Popover-XrJa7lyb.js} +49 -50
- package/dist/Popover-XrJa7lyb.js.map +1 -0
- package/dist/{Select-Bfbtj5zt.js → Select-DO02vXt3.js} +185 -186
- package/dist/{Select-Bfbtj5zt.js.map → Select-DO02vXt3.js.map} +1 -1
- package/dist/{Sheet-aLBPtE1k.js → Sheet-C2UoHLL0.js} +35 -36
- package/dist/Sheet-C2UoHLL0.js.map +1 -0
- package/dist/{TextOverflowTooltip-BaNPKqnO.js → TextOverflowTooltip-XPDdO9Dz.js} +2 -2
- package/dist/{TextOverflowTooltip-BaNPKqnO.js.map → TextOverflowTooltip-XPDdO9Dz.js.map} +1 -1
- package/dist/{Tooltip-DOgKy50D.js → Tooltip-D2XvRS0c.js} +63 -64
- package/dist/Tooltip-D2XvRS0c.js.map +1 -0
- package/dist/blocks/auth/otp-form.js +3240 -204
- package/dist/blocks/auth/otp-form.js.map +1 -1
- package/dist/components/alert-dialog/AlertDialog.d.ts +2 -4
- package/dist/components/alert-dialog.js +70 -71
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/calendar/components/calendar-dropdown/CalendarDropdown.d.ts +24 -0
- package/dist/components/calendar/styles.d.ts +61 -0
- package/dist/components/calendar-scroll/CalendarScroll.d.ts +21 -0
- package/dist/components/calendar-scroll/CalendarScroll.stories.d.ts +16 -0
- package/dist/components/calendar-scroll/index.d.ts +3 -0
- package/dist/components/calendar-scroll.d.ts +2 -0
- package/dist/components/calendar-scroll.js +181 -0
- package/dist/components/calendar-scroll.js.map +1 -0
- package/dist/components/calendar.js +51 -147
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/command.js +1 -1
- package/dist/components/dialog/Dialog.d.ts +2 -4
- package/dist/components/dialog.js +3 -3
- package/dist/components/drawer/components/drawer-content/DrawerContent.d.ts +1 -2
- package/dist/components/drawer.js +96 -97
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown/Dropdown.d.ts +2 -4
- package/dist/components/dropdown.js +251 -252
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/file-upload.js +1 -1
- package/dist/components/form/Form.d.ts +14 -0
- package/dist/components/form/components/form-field/FormField.d.ts +4 -0
- package/dist/components/form.js +3 -3
- package/dist/components/icon-tooltip.js +1 -1
- package/dist/components/label.js +1 -1
- package/dist/components/overflow-tooltip.js +1 -1
- package/dist/components/popover/Popover.d.ts +1 -2
- package/dist/components/popover.js +1 -1
- package/dist/components/resizable/Resizable.d.ts +1 -1
- package/dist/components/scheduler.js +1 -1
- package/dist/components/search-select/multi-select/MultiSelect.d.ts +1 -1
- package/dist/components/search-select.js +3 -3
- package/dist/components/search-select.js.map +1 -1
- package/dist/components/select/Select.d.ts +1 -2
- package/dist/components/select.js +1 -1
- package/dist/components/sheet/Sheet.d.ts +1 -2
- package/dist/components/sheet.js +1 -1
- package/dist/components/sidebar.js +2 -2
- package/dist/components/switch.js +1 -1
- package/dist/components/tag-input.js +1 -1
- package/dist/components/tooltip/Tooltip.d.ts +2 -4
- package/dist/components/tooltip.js +1 -1
- package/dist/tailwind.css +406 -361
- package/package.json +22 -18
- package/dist/DayPicker-4hE1QEvO.js +0 -2452
- package/dist/DayPicker-4hE1QEvO.js.map +0 -1
- package/dist/Dialog-BT_775Iz.js.map +0 -1
- package/dist/FormStack-CxiZhx1n.js +0 -127
- package/dist/FormStack-CxiZhx1n.js.map +0 -1
- package/dist/Popover-Dz2eNsXh.js.map +0 -1
- package/dist/Sheet-aLBPtE1k.js.map +0 -1
- package/dist/Tooltip-DOgKy50D.js.map +0 -1
- package/dist/buildMatchPatternFn-d7GTeGl_.js +0 -68
- package/dist/buildMatchPatternFn-d7GTeGl_.js.map +0 -1
- package/dist/components/portal-container/PortalContainer.d.ts +0 -10
- package/dist/components/portal-container/index.d.ts +0 -2
- package/dist/components/portal-container/portalContainerEvents.d.ts +0 -12
- package/dist/components/portal-container/usePortalContainer.d.ts +0 -11
- package/dist/components/portal-container.d.ts +0 -2
- package/dist/components/portal-container.js +0 -14
- package/dist/components/portal-container.js.map +0 -1
- package/dist/index.esm-CXA6i4d7.js +0 -1282
- package/dist/index.esm-CXA6i4d7.js.map +0 -1
- package/dist/normalizeDates-9A3c9WYM.js +0 -32
- package/dist/normalizeDates-9A3c9WYM.js.map +0 -1
- package/dist/styles.css +0 -9064
- package/dist/styles.d.ts +0 -1
- package/dist/usePortalContainer-B1xla842.js +0 -33
- package/dist/usePortalContainer-B1xla842.js.map +0 -1
- package/dist/vendors/date-fns/index.d.ts +0 -12
- package/dist/vendors/date-fns/locale/en-US/index.d.ts +0 -5
- package/dist/vendors/date-fns/locale/en-US.d.ts +0 -2
- package/dist/vendors/date-fns/locale/en-US.js +0 -372
- package/dist/vendors/date-fns/locale/en-US.js.map +0 -1
- package/dist/vendors/date-fns/locale/ru/index.d.ts +0 -5
- package/dist/vendors/date-fns/locale/ru.d.ts +0 -2
- package/dist/vendors/date-fns/locale/ru.js +0 -569
- package/dist/vendors/date-fns/locale/ru.js.map +0 -1
- package/dist/vendors/date-fns.d.ts +0 -2
- package/dist/vendors/date-fns.js +0 -2
- package/dist/vendors/date-fns.js.map +0 -1
- package/dist/vendors/react-day-picker/index.d.ts +0 -13
- package/dist/vendors/react-day-picker.d.ts +0 -2
- package/dist/vendors/react-day-picker.js +0 -87
- package/dist/vendors/react-day-picker.js.map +0 -1
- package/dist/vendors/react-hook-form/index.d.ts +0 -14
- package/dist/vendors/react-hook-form.d.ts +0 -2
- package/dist/vendors/react-hook-form.js +0 -19
- package/dist/vendors/react-hook-form.js.map +0 -1
- package/dist/vendors/tanstack/react-table/index.d.ts +0 -13
- package/dist/vendors/tanstack/react-table.d.ts +0 -2
- package/dist/vendors/tanstack/react-table.js +0 -2090
- package/dist/vendors/tanstack/react-table.js.map +0 -1
- package/dist/vendors/zod/index.d.ts +0 -13
- package/dist/vendors/zod.d.ts +0 -2
- package/dist/vendors/zod.js +0 -3080
- package/dist/vendors/zod.js.map +0 -1
- package/dist/zod-BMNoK3aM.js +0 -75
- package/dist/zod-BMNoK3aM.js.map +0 -1
|
@@ -1,1282 +0,0 @@
|
|
|
1
|
-
import h from "react";
|
|
2
|
-
var _e = (e) => e.type === "checkbox", ue = (e) => e instanceof Date, z = (e) => e == null;
|
|
3
|
-
const We = (e) => typeof e == "object";
|
|
4
|
-
var N = (e) => !z(e) && !Array.isArray(e) && We(e) && !ue(e), yt = (e) => N(e) && e.target ? _e(e.target) ? e.target.checked : e.target.value : e, Nt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, gt = (e, r) => e.has(Nt(r)), Bt = (e) => {
|
|
5
|
-
const r = e.constructor && e.constructor.prototype;
|
|
6
|
-
return N(r) && r.hasOwnProperty("isPrototypeOf");
|
|
7
|
-
}, qe = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
8
|
-
function L(e) {
|
|
9
|
-
let r;
|
|
10
|
-
const t = Array.isArray(e), i = typeof FileList < "u" ? e instanceof FileList : !1;
|
|
11
|
-
if (e instanceof Date)
|
|
12
|
-
r = new Date(e);
|
|
13
|
-
else if (e instanceof Set)
|
|
14
|
-
r = new Set(e);
|
|
15
|
-
else if (!(qe && (e instanceof Blob || i)) && (t || N(e)))
|
|
16
|
-
if (r = t ? [] : {}, !t && !Bt(e))
|
|
17
|
-
r = e;
|
|
18
|
-
else
|
|
19
|
-
for (const n in e)
|
|
20
|
-
e.hasOwnProperty(n) && (r[n] = L(e[n]));
|
|
21
|
-
else
|
|
22
|
-
return e;
|
|
23
|
-
return r;
|
|
24
|
-
}
|
|
25
|
-
var he = (e) => Array.isArray(e) ? e.filter(Boolean) : [], T = (e) => e === void 0, c = (e, r, t) => {
|
|
26
|
-
if (!r || !N(e))
|
|
27
|
-
return t;
|
|
28
|
-
const i = he(r.split(/[,[\].]+?/)).reduce((n, l) => z(n) ? n : n[l], e);
|
|
29
|
-
return T(i) || i === e ? T(e[r]) ? t : e[r] : i;
|
|
30
|
-
}, Y = (e) => typeof e == "boolean", $e = (e) => /^\w*$/.test(e), _t = (e) => he(e.replace(/["|']|\]/g, "").split(/\.|\[/)), C = (e, r, t) => {
|
|
31
|
-
let i = -1;
|
|
32
|
-
const n = $e(r) ? [r] : _t(r), l = n.length, f = l - 1;
|
|
33
|
-
for (; ++i < l; ) {
|
|
34
|
-
const y = n[i];
|
|
35
|
-
let F = t;
|
|
36
|
-
if (i !== f) {
|
|
37
|
-
const x = e[y];
|
|
38
|
-
F = N(x) || Array.isArray(x) ? x : isNaN(+n[i + 1]) ? {} : [];
|
|
39
|
-
}
|
|
40
|
-
if (y === "__proto__" || y === "constructor" || y === "prototype")
|
|
41
|
-
return;
|
|
42
|
-
e[y] = F, e = e[y];
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const Fe = {
|
|
46
|
-
BLUR: "blur",
|
|
47
|
-
FOCUS_OUT: "focusout",
|
|
48
|
-
CHANGE: "change"
|
|
49
|
-
}, ee = {
|
|
50
|
-
onBlur: "onBlur",
|
|
51
|
-
onChange: "onChange",
|
|
52
|
-
onSubmit: "onSubmit",
|
|
53
|
-
onTouched: "onTouched",
|
|
54
|
-
all: "all"
|
|
55
|
-
}, ie = {
|
|
56
|
-
max: "max",
|
|
57
|
-
min: "min",
|
|
58
|
-
maxLength: "maxLength",
|
|
59
|
-
minLength: "minLength",
|
|
60
|
-
pattern: "pattern",
|
|
61
|
-
required: "required",
|
|
62
|
-
validate: "validate"
|
|
63
|
-
}, ht = h.createContext(null), me = () => h.useContext(ht), ar = (e) => {
|
|
64
|
-
const { children: r, ...t } = e;
|
|
65
|
-
return h.createElement(ht.Provider, { value: t }, r);
|
|
66
|
-
};
|
|
67
|
-
var mt = (e, r, t, i = !0) => {
|
|
68
|
-
const n = {
|
|
69
|
-
defaultValues: r._defaultValues
|
|
70
|
-
};
|
|
71
|
-
for (const l in e)
|
|
72
|
-
Object.defineProperty(n, l, {
|
|
73
|
-
get: () => {
|
|
74
|
-
const f = l;
|
|
75
|
-
return r._proxyFormState[f] !== ee.all && (r._proxyFormState[f] = !i || ee.all), t && (t[f] = !0), e[f];
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
return n;
|
|
79
|
-
};
|
|
80
|
-
function It(e) {
|
|
81
|
-
const r = me(), { control: t = r.control, disabled: i, name: n, exact: l } = e || {}, [f, y] = h.useState(t._formState), F = h.useRef({
|
|
82
|
-
isDirty: !1,
|
|
83
|
-
isLoading: !1,
|
|
84
|
-
dirtyFields: !1,
|
|
85
|
-
touchedFields: !1,
|
|
86
|
-
validatingFields: !1,
|
|
87
|
-
isValidating: !1,
|
|
88
|
-
isValid: !1,
|
|
89
|
-
errors: !1
|
|
90
|
-
}), x = h.useRef(n);
|
|
91
|
-
return x.current = n, h.useEffect(() => t._subscribe({
|
|
92
|
-
name: x.current,
|
|
93
|
-
formState: F.current,
|
|
94
|
-
exact: l,
|
|
95
|
-
callback: (w) => {
|
|
96
|
-
!i && y({
|
|
97
|
-
...t._formState,
|
|
98
|
-
...w
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}), [t, i, l]), h.useEffect(() => {
|
|
102
|
-
F.current.isValid && t._setValid(!0);
|
|
103
|
-
}, [t]), h.useMemo(() => mt(f, t, F.current, !1), [f, t]);
|
|
104
|
-
}
|
|
105
|
-
var se = (e) => typeof e == "string", bt = (e, r, t, i, n) => se(e) ? (i && r.watch.add(e), c(t, e, n)) : Array.isArray(e) ? e.map((l) => (i && r.watch.add(l), c(t, l))) : (i && (r.watchAll = !0), t);
|
|
106
|
-
function Pt(e) {
|
|
107
|
-
const r = me(), { control: t = r.control, name: i, defaultValue: n, disabled: l, exact: f } = e || {}, y = h.useRef(i), F = h.useRef(n);
|
|
108
|
-
y.current = i, h.useEffect(() => t._subscribe({
|
|
109
|
-
name: y.current,
|
|
110
|
-
formState: {
|
|
111
|
-
values: !0
|
|
112
|
-
},
|
|
113
|
-
exact: f,
|
|
114
|
-
callback: (k) => !l && w(bt(y.current, t._names, k.values || t._formValues, !1, F.current))
|
|
115
|
-
}), [t, l, f]);
|
|
116
|
-
const [x, w] = h.useState(t._getWatch(i, n));
|
|
117
|
-
return h.useEffect(() => t._removeUnmounted()), x;
|
|
118
|
-
}
|
|
119
|
-
function Wt(e) {
|
|
120
|
-
const r = me(), { name: t, disabled: i, control: n = r.control, shouldUnregister: l } = e, f = gt(n._names.array, t), y = Pt({
|
|
121
|
-
control: n,
|
|
122
|
-
name: t,
|
|
123
|
-
defaultValue: c(n._formValues, t, c(n._defaultValues, t, e.defaultValue)),
|
|
124
|
-
exact: !0
|
|
125
|
-
}), F = It({
|
|
126
|
-
control: n,
|
|
127
|
-
name: t,
|
|
128
|
-
exact: !0
|
|
129
|
-
}), x = h.useRef(e), w = h.useRef(n.register(t, {
|
|
130
|
-
...e.rules,
|
|
131
|
-
value: y,
|
|
132
|
-
...Y(e.disabled) ? { disabled: e.disabled } : {}
|
|
133
|
-
})), k = h.useMemo(() => Object.defineProperties({}, {
|
|
134
|
-
invalid: {
|
|
135
|
-
enumerable: !0,
|
|
136
|
-
get: () => !!c(F.errors, t)
|
|
137
|
-
},
|
|
138
|
-
isDirty: {
|
|
139
|
-
enumerable: !0,
|
|
140
|
-
get: () => !!c(F.dirtyFields, t)
|
|
141
|
-
},
|
|
142
|
-
isTouched: {
|
|
143
|
-
enumerable: !0,
|
|
144
|
-
get: () => !!c(F.touchedFields, t)
|
|
145
|
-
},
|
|
146
|
-
isValidating: {
|
|
147
|
-
enumerable: !0,
|
|
148
|
-
get: () => !!c(F.validatingFields, t)
|
|
149
|
-
},
|
|
150
|
-
error: {
|
|
151
|
-
enumerable: !0,
|
|
152
|
-
get: () => c(F.errors, t)
|
|
153
|
-
}
|
|
154
|
-
}), [F, t]), A = h.useCallback((B) => w.current.onChange({
|
|
155
|
-
target: {
|
|
156
|
-
value: yt(B),
|
|
157
|
-
name: t
|
|
158
|
-
},
|
|
159
|
-
type: Fe.CHANGE
|
|
160
|
-
}), [t]), O = h.useCallback(() => w.current.onBlur({
|
|
161
|
-
target: {
|
|
162
|
-
value: c(n._formValues, t),
|
|
163
|
-
name: t
|
|
164
|
-
},
|
|
165
|
-
type: Fe.BLUR
|
|
166
|
-
}), [t, n._formValues]), $ = h.useCallback((B) => {
|
|
167
|
-
const I = c(n._fields, t);
|
|
168
|
-
I && B && (I._f.ref = {
|
|
169
|
-
focus: () => B.focus(),
|
|
170
|
-
select: () => B.select(),
|
|
171
|
-
setCustomValidity: (v) => B.setCustomValidity(v),
|
|
172
|
-
reportValidity: () => B.reportValidity()
|
|
173
|
-
});
|
|
174
|
-
}, [n._fields, t]), U = h.useMemo(() => ({
|
|
175
|
-
name: t,
|
|
176
|
-
value: y,
|
|
177
|
-
...Y(i) || F.disabled ? { disabled: F.disabled || i } : {},
|
|
178
|
-
onChange: A,
|
|
179
|
-
onBlur: O,
|
|
180
|
-
ref: $
|
|
181
|
-
}), [t, i, F.disabled, A, O, $, y]);
|
|
182
|
-
return h.useEffect(() => {
|
|
183
|
-
const B = n._options.shouldUnregister || l;
|
|
184
|
-
n.register(t, {
|
|
185
|
-
...x.current.rules,
|
|
186
|
-
...Y(x.current.disabled) ? { disabled: x.current.disabled } : {}
|
|
187
|
-
});
|
|
188
|
-
const I = (v, H) => {
|
|
189
|
-
const q = c(n._fields, v);
|
|
190
|
-
q && q._f && (q._f.mount = H);
|
|
191
|
-
};
|
|
192
|
-
if (I(t, !0), B) {
|
|
193
|
-
const v = L(c(n._options.defaultValues, t));
|
|
194
|
-
C(n._defaultValues, t, v), T(c(n._formValues, t)) && C(n._formValues, t, v);
|
|
195
|
-
}
|
|
196
|
-
return !f && n.register(t), () => {
|
|
197
|
-
(f ? B && !n._state.action : B) ? n.unregister(t) : I(t, !1);
|
|
198
|
-
};
|
|
199
|
-
}, [t, n, f, l]), h.useEffect(() => {
|
|
200
|
-
n._setDisabledField({
|
|
201
|
-
disabled: i,
|
|
202
|
-
name: t
|
|
203
|
-
});
|
|
204
|
-
}, [i, t, n]), h.useMemo(() => ({
|
|
205
|
-
field: U,
|
|
206
|
-
formState: F,
|
|
207
|
-
fieldState: k
|
|
208
|
-
}), [U, F, k]);
|
|
209
|
-
}
|
|
210
|
-
const nr = (e) => e.render(Wt(e)), vt = (e) => {
|
|
211
|
-
const r = {};
|
|
212
|
-
for (const t of Object.keys(e))
|
|
213
|
-
if (We(e[t]) && e[t] !== null) {
|
|
214
|
-
const i = vt(e[t]);
|
|
215
|
-
for (const n of Object.keys(i))
|
|
216
|
-
r[`${t}.${n}`] = i[n];
|
|
217
|
-
} else
|
|
218
|
-
r[t] = e[t];
|
|
219
|
-
return r;
|
|
220
|
-
}, qt = "post";
|
|
221
|
-
function lr(e) {
|
|
222
|
-
const r = me(), [t, i] = h.useState(!1), { control: n = r.control, onSubmit: l, children: f, action: y, method: F = qt, headers: x, encType: w, onError: k, render: A, onSuccess: O, validateStatus: $, ...U } = e, B = async (I) => {
|
|
223
|
-
let v = !1, H = "";
|
|
224
|
-
await n.handleSubmit(async (q) => {
|
|
225
|
-
const R = new FormData();
|
|
226
|
-
let m = "";
|
|
227
|
-
try {
|
|
228
|
-
m = JSON.stringify(q);
|
|
229
|
-
} catch {
|
|
230
|
-
}
|
|
231
|
-
const b = vt(n._formValues);
|
|
232
|
-
for (const V in b)
|
|
233
|
-
R.append(V, b[V]);
|
|
234
|
-
if (l && await l({
|
|
235
|
-
data: q,
|
|
236
|
-
event: I,
|
|
237
|
-
method: F,
|
|
238
|
-
formData: R,
|
|
239
|
-
formDataJson: m
|
|
240
|
-
}), y)
|
|
241
|
-
try {
|
|
242
|
-
const V = [
|
|
243
|
-
x && x["Content-Type"],
|
|
244
|
-
w
|
|
245
|
-
].some((j) => j && j.includes("json")), S = await fetch(String(y), {
|
|
246
|
-
method: F,
|
|
247
|
-
headers: {
|
|
248
|
-
...x,
|
|
249
|
-
...w ? { "Content-Type": w } : {}
|
|
250
|
-
},
|
|
251
|
-
body: V ? m : R
|
|
252
|
-
});
|
|
253
|
-
S && ($ ? !$(S.status) : S.status < 200 || S.status >= 300) ? (v = !0, k && k({ response: S }), H = String(S.status)) : O && O({ response: S });
|
|
254
|
-
} catch (V) {
|
|
255
|
-
v = !0, k && k({ error: V });
|
|
256
|
-
}
|
|
257
|
-
})(I), v && e.control && (e.control._subjects.state.next({
|
|
258
|
-
isSubmitSuccessful: !1
|
|
259
|
-
}), e.control.setError("root.server", {
|
|
260
|
-
type: H
|
|
261
|
-
}));
|
|
262
|
-
};
|
|
263
|
-
return h.useEffect(() => {
|
|
264
|
-
i(!0);
|
|
265
|
-
}, []), A ? h.createElement(h.Fragment, null, A({
|
|
266
|
-
submit: B
|
|
267
|
-
})) : h.createElement("form", { noValidate: t, action: y, method: F, encType: w, onSubmit: B, ...U }, f);
|
|
268
|
-
}
|
|
269
|
-
var $t = (e, r, t, i, n) => r ? {
|
|
270
|
-
...t[e],
|
|
271
|
-
types: {
|
|
272
|
-
...t[e] && t[e].types ? t[e].types : {},
|
|
273
|
-
[i]: n || !0
|
|
274
|
-
}
|
|
275
|
-
} : {}, Q = (e) => Array.isArray(e) ? e : [e], it = () => {
|
|
276
|
-
let e = [];
|
|
277
|
-
return {
|
|
278
|
-
get observers() {
|
|
279
|
-
return e;
|
|
280
|
-
},
|
|
281
|
-
next: (n) => {
|
|
282
|
-
for (const l of e)
|
|
283
|
-
l.next && l.next(n);
|
|
284
|
-
},
|
|
285
|
-
subscribe: (n) => (e.push(n), {
|
|
286
|
-
unsubscribe: () => {
|
|
287
|
-
e = e.filter((l) => l !== n);
|
|
288
|
-
}
|
|
289
|
-
}),
|
|
290
|
-
unsubscribe: () => {
|
|
291
|
-
e = [];
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
}, Be = (e) => z(e) || !We(e);
|
|
295
|
-
function le(e, r) {
|
|
296
|
-
if (Be(e) || Be(r))
|
|
297
|
-
return e === r;
|
|
298
|
-
if (ue(e) && ue(r))
|
|
299
|
-
return e.getTime() === r.getTime();
|
|
300
|
-
const t = Object.keys(e), i = Object.keys(r);
|
|
301
|
-
if (t.length !== i.length)
|
|
302
|
-
return !1;
|
|
303
|
-
for (const n of t) {
|
|
304
|
-
const l = e[n];
|
|
305
|
-
if (!i.includes(n))
|
|
306
|
-
return !1;
|
|
307
|
-
if (n !== "ref") {
|
|
308
|
-
const f = r[n];
|
|
309
|
-
if (ue(l) && ue(f) || N(l) && N(f) || Array.isArray(l) && Array.isArray(f) ? !le(l, f) : l !== f)
|
|
310
|
-
return !1;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
return !0;
|
|
314
|
-
}
|
|
315
|
-
var J = (e) => N(e) && !Object.keys(e).length, He = (e) => e.type === "file", te = (e) => typeof e == "function", Ae = (e) => {
|
|
316
|
-
if (!qe)
|
|
317
|
-
return !1;
|
|
318
|
-
const r = e ? e.ownerDocument : 0;
|
|
319
|
-
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
320
|
-
}, Ft = (e) => e.type === "select-multiple", je = (e) => e.type === "radio", Ht = (e) => je(e) || _e(e), pe = (e) => Ae(e) && e.isConnected;
|
|
321
|
-
function jt(e, r) {
|
|
322
|
-
const t = r.slice(0, -1).length;
|
|
323
|
-
let i = 0;
|
|
324
|
-
for (; i < t; )
|
|
325
|
-
e = T(e) ? i++ : e[r[i++]];
|
|
326
|
-
return e;
|
|
327
|
-
}
|
|
328
|
-
function Kt(e) {
|
|
329
|
-
for (const r in e)
|
|
330
|
-
if (e.hasOwnProperty(r) && !T(e[r]))
|
|
331
|
-
return !1;
|
|
332
|
-
return !0;
|
|
333
|
-
}
|
|
334
|
-
function W(e, r) {
|
|
335
|
-
const t = Array.isArray(r) ? r : $e(r) ? [r] : _t(r), i = t.length === 1 ? e : jt(e, t), n = t.length - 1, l = t[n];
|
|
336
|
-
return i && delete i[l], n !== 0 && (N(i) && J(i) || Array.isArray(i) && Kt(i)) && W(e, t.slice(0, -1)), e;
|
|
337
|
-
}
|
|
338
|
-
var At = (e) => {
|
|
339
|
-
for (const r in e)
|
|
340
|
-
if (te(e[r]))
|
|
341
|
-
return !0;
|
|
342
|
-
return !1;
|
|
343
|
-
};
|
|
344
|
-
function Ve(e, r = {}) {
|
|
345
|
-
const t = Array.isArray(e);
|
|
346
|
-
if (N(e) || t)
|
|
347
|
-
for (const i in e)
|
|
348
|
-
Array.isArray(e[i]) || N(e[i]) && !At(e[i]) ? (r[i] = Array.isArray(e[i]) ? [] : {}, Ve(e[i], r[i])) : z(e[i]) || (r[i] = !0);
|
|
349
|
-
return r;
|
|
350
|
-
}
|
|
351
|
-
function Vt(e, r, t) {
|
|
352
|
-
const i = Array.isArray(e);
|
|
353
|
-
if (N(e) || i)
|
|
354
|
-
for (const n in e)
|
|
355
|
-
Array.isArray(e[n]) || N(e[n]) && !At(e[n]) ? T(r) || Be(t[n]) ? t[n] = Array.isArray(e[n]) ? Ve(e[n], []) : { ...Ve(e[n]) } : Vt(e[n], z(r) ? {} : r[n], t[n]) : t[n] = !le(e[n], r[n]);
|
|
356
|
-
return t;
|
|
357
|
-
}
|
|
358
|
-
var ye = (e, r) => Vt(e, r, Ve(r));
|
|
359
|
-
const at = {
|
|
360
|
-
value: !1,
|
|
361
|
-
isValid: !1
|
|
362
|
-
}, nt = { value: !0, isValid: !0 };
|
|
363
|
-
var xt = (e) => {
|
|
364
|
-
if (Array.isArray(e)) {
|
|
365
|
-
if (e.length > 1) {
|
|
366
|
-
const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
|
|
367
|
-
return { value: r, isValid: !!r.length };
|
|
368
|
-
}
|
|
369
|
-
return e[0].checked && !e[0].disabled ? (
|
|
370
|
-
// @ts-expect-error expected to work in the browser
|
|
371
|
-
e[0].attributes && !T(e[0].attributes.value) ? T(e[0].value) || e[0].value === "" ? nt : { value: e[0].value, isValid: !0 } : nt
|
|
372
|
-
) : at;
|
|
373
|
-
}
|
|
374
|
-
return at;
|
|
375
|
-
}, St = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: i }) => T(e) ? e : r ? e === "" ? NaN : e && +e : t && se(e) ? new Date(e) : i ? i(e) : e;
|
|
376
|
-
const lt = {
|
|
377
|
-
isValid: !1,
|
|
378
|
-
value: null
|
|
379
|
-
};
|
|
380
|
-
var wt = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
|
|
381
|
-
isValid: !0,
|
|
382
|
-
value: t.value
|
|
383
|
-
} : r, lt) : lt;
|
|
384
|
-
function ut(e) {
|
|
385
|
-
const r = e.ref;
|
|
386
|
-
return He(r) ? r.files : je(r) ? wt(e.refs).value : Ft(r) ? [...r.selectedOptions].map(({ value: t }) => t) : _e(r) ? xt(e.refs).value : St(T(r.value) ? e.ref.value : r.value, e);
|
|
387
|
-
}
|
|
388
|
-
var Jt = (e, r, t, i) => {
|
|
389
|
-
const n = {};
|
|
390
|
-
for (const l of e) {
|
|
391
|
-
const f = c(r, l);
|
|
392
|
-
f && C(n, l, f._f);
|
|
393
|
-
}
|
|
394
|
-
return {
|
|
395
|
-
criteriaMode: t,
|
|
396
|
-
names: [...e],
|
|
397
|
-
fields: n,
|
|
398
|
-
shouldUseNativeValidation: i
|
|
399
|
-
};
|
|
400
|
-
}, xe = (e) => e instanceof RegExp, ge = (e) => T(e) ? e : xe(e) ? e.source : N(e) ? xe(e.value) ? e.value.source : e.value : e, ce = (e) => ({
|
|
401
|
-
isOnSubmit: !e || e === ee.onSubmit,
|
|
402
|
-
isOnBlur: e === ee.onBlur,
|
|
403
|
-
isOnChange: e === ee.onChange,
|
|
404
|
-
isOnAll: e === ee.all,
|
|
405
|
-
isOnTouch: e === ee.onTouched
|
|
406
|
-
});
|
|
407
|
-
const ot = "AsyncFunction";
|
|
408
|
-
var zt = (e) => !!e && !!e.validate && !!(te(e.validate) && e.validate.constructor.name === ot || N(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === ot)), Gt = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Ie = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((i) => e.startsWith(i) && /^\.\w+/.test(e.slice(i.length))));
|
|
409
|
-
const fe = (e, r, t, i) => {
|
|
410
|
-
for (const n of t || Object.keys(e)) {
|
|
411
|
-
const l = c(e, n);
|
|
412
|
-
if (l) {
|
|
413
|
-
const { _f: f, ...y } = l;
|
|
414
|
-
if (f) {
|
|
415
|
-
if (f.refs && f.refs[0] && r(f.refs[0], n) && !i)
|
|
416
|
-
return !0;
|
|
417
|
-
if (f.ref && r(f.ref, f.name) && !i)
|
|
418
|
-
return !0;
|
|
419
|
-
if (fe(y, r))
|
|
420
|
-
break;
|
|
421
|
-
} else if (N(y) && fe(y, r))
|
|
422
|
-
break;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
function ct(e, r, t) {
|
|
427
|
-
const i = c(e, t);
|
|
428
|
-
if (i || $e(t))
|
|
429
|
-
return {
|
|
430
|
-
error: i,
|
|
431
|
-
name: t
|
|
432
|
-
};
|
|
433
|
-
const n = t.split(".");
|
|
434
|
-
for (; n.length; ) {
|
|
435
|
-
const l = n.join("."), f = c(r, l), y = c(e, l);
|
|
436
|
-
if (f && !Array.isArray(f) && t !== l)
|
|
437
|
-
return { name: t };
|
|
438
|
-
if (y && y.type)
|
|
439
|
-
return {
|
|
440
|
-
name: l,
|
|
441
|
-
error: y
|
|
442
|
-
};
|
|
443
|
-
n.pop();
|
|
444
|
-
}
|
|
445
|
-
return {
|
|
446
|
-
name: t
|
|
447
|
-
};
|
|
448
|
-
}
|
|
449
|
-
var Qt = (e, r, t, i) => {
|
|
450
|
-
t(e);
|
|
451
|
-
const { name: n, ...l } = e;
|
|
452
|
-
return J(l) || Object.keys(l).length >= Object.keys(r).length || Object.keys(l).find((f) => r[f] === (!i || ee.all));
|
|
453
|
-
}, Yt = (e, r, t) => !e || !r || e === r || Q(e).some((i) => i && (t ? i === r : i.startsWith(r) || r.startsWith(i))), Xt = (e, r, t, i, n) => n.isOnAll ? !1 : !t && n.isOnTouch ? !(r || e) : (t ? i.isOnBlur : n.isOnBlur) ? !e : (t ? i.isOnChange : n.isOnChange) ? e : !0, Zt = (e, r) => !he(c(e, r)).length && W(e, r), kt = (e, r, t) => {
|
|
454
|
-
const i = Q(c(e, t));
|
|
455
|
-
return C(i, "root", r[t]), C(e, t, i), e;
|
|
456
|
-
}, ve = (e) => se(e);
|
|
457
|
-
function ft(e, r, t = "validate") {
|
|
458
|
-
if (ve(e) || Array.isArray(e) && e.every(ve) || Y(e) && !e)
|
|
459
|
-
return {
|
|
460
|
-
type: t,
|
|
461
|
-
message: ve(e) ? e : "",
|
|
462
|
-
ref: r
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
var oe = (e) => N(e) && !xe(e) ? e : {
|
|
466
|
-
value: e,
|
|
467
|
-
message: ""
|
|
468
|
-
}, Pe = async (e, r, t, i, n, l) => {
|
|
469
|
-
const { ref: f, refs: y, required: F, maxLength: x, minLength: w, min: k, max: A, pattern: O, validate: $, name: U, valueAsNumber: B, mount: I } = e._f, v = c(t, U);
|
|
470
|
-
if (!I || r.has(U))
|
|
471
|
-
return {};
|
|
472
|
-
const H = y ? y[0] : f, q = (p) => {
|
|
473
|
-
n && H.reportValidity && (H.setCustomValidity(Y(p) ? "" : p || ""), H.reportValidity());
|
|
474
|
-
}, R = {}, m = je(f), b = _e(f), V = m || b, S = (B || He(f)) && T(f.value) && T(v) || Ae(f) && f.value === "" || v === "" || Array.isArray(v) && !v.length, j = $t.bind(null, U, i, R), X = (p, D, M, G = ie.maxLength, Z = ie.minLength) => {
|
|
475
|
-
const re = p ? D : M;
|
|
476
|
-
R[U] = {
|
|
477
|
-
type: p ? G : Z,
|
|
478
|
-
message: re,
|
|
479
|
-
ref: f,
|
|
480
|
-
...j(p ? G : Z, re)
|
|
481
|
-
};
|
|
482
|
-
};
|
|
483
|
-
if (l ? !Array.isArray(v) || !v.length : F && (!V && (S || z(v)) || Y(v) && !v || b && !xt(y).isValid || m && !wt(y).isValid)) {
|
|
484
|
-
const { value: p, message: D } = ve(F) ? { value: !!F, message: F } : oe(F);
|
|
485
|
-
if (p && (R[U] = {
|
|
486
|
-
type: ie.required,
|
|
487
|
-
message: D,
|
|
488
|
-
ref: H,
|
|
489
|
-
...j(ie.required, D)
|
|
490
|
-
}, !i))
|
|
491
|
-
return q(D), R;
|
|
492
|
-
}
|
|
493
|
-
if (!S && (!z(k) || !z(A))) {
|
|
494
|
-
let p, D;
|
|
495
|
-
const M = oe(A), G = oe(k);
|
|
496
|
-
if (!z(v) && !isNaN(v)) {
|
|
497
|
-
const Z = f.valueAsNumber || v && +v;
|
|
498
|
-
z(M.value) || (p = Z > M.value), z(G.value) || (D = Z < G.value);
|
|
499
|
-
} else {
|
|
500
|
-
const Z = f.valueAsDate || new Date(v), re = (be) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + be), ae = f.type == "time", de = f.type == "week";
|
|
501
|
-
se(M.value) && v && (p = ae ? re(v) > re(M.value) : de ? v > M.value : Z > new Date(M.value)), se(G.value) && v && (D = ae ? re(v) < re(G.value) : de ? v < G.value : Z < new Date(G.value));
|
|
502
|
-
}
|
|
503
|
-
if ((p || D) && (X(!!p, M.message, G.message, ie.max, ie.min), !i))
|
|
504
|
-
return q(R[U].message), R;
|
|
505
|
-
}
|
|
506
|
-
if ((x || w) && !S && (se(v) || l && Array.isArray(v))) {
|
|
507
|
-
const p = oe(x), D = oe(w), M = !z(p.value) && v.length > +p.value, G = !z(D.value) && v.length < +D.value;
|
|
508
|
-
if ((M || G) && (X(M, p.message, D.message), !i))
|
|
509
|
-
return q(R[U].message), R;
|
|
510
|
-
}
|
|
511
|
-
if (O && !S && se(v)) {
|
|
512
|
-
const { value: p, message: D } = oe(O);
|
|
513
|
-
if (xe(p) && !v.match(p) && (R[U] = {
|
|
514
|
-
type: ie.pattern,
|
|
515
|
-
message: D,
|
|
516
|
-
ref: f,
|
|
517
|
-
...j(ie.pattern, D)
|
|
518
|
-
}, !i))
|
|
519
|
-
return q(D), R;
|
|
520
|
-
}
|
|
521
|
-
if ($) {
|
|
522
|
-
if (te($)) {
|
|
523
|
-
const p = await $(v, t), D = ft(p, H);
|
|
524
|
-
if (D && (R[U] = {
|
|
525
|
-
...D,
|
|
526
|
-
...j(ie.validate, D.message)
|
|
527
|
-
}, !i))
|
|
528
|
-
return q(D.message), R;
|
|
529
|
-
} else if (N($)) {
|
|
530
|
-
let p = {};
|
|
531
|
-
for (const D in $) {
|
|
532
|
-
if (!J(p) && !i)
|
|
533
|
-
break;
|
|
534
|
-
const M = ft(await $[D](v, t), H, D);
|
|
535
|
-
M && (p = {
|
|
536
|
-
...M,
|
|
537
|
-
...j(D, M.message)
|
|
538
|
-
}, q(M.message), i && (R[U] = p));
|
|
539
|
-
}
|
|
540
|
-
if (!J(p) && (R[U] = {
|
|
541
|
-
ref: H,
|
|
542
|
-
...p
|
|
543
|
-
}, !i))
|
|
544
|
-
return R;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
return q(!0), R;
|
|
548
|
-
};
|
|
549
|
-
const er = {
|
|
550
|
-
mode: ee.onSubmit,
|
|
551
|
-
reValidateMode: ee.onChange,
|
|
552
|
-
shouldFocusError: !0
|
|
553
|
-
};
|
|
554
|
-
function tr(e = {}) {
|
|
555
|
-
let r = {
|
|
556
|
-
...er,
|
|
557
|
-
...e
|
|
558
|
-
}, t = {
|
|
559
|
-
submitCount: 0,
|
|
560
|
-
isDirty: !1,
|
|
561
|
-
isLoading: te(r.defaultValues),
|
|
562
|
-
isValidating: !1,
|
|
563
|
-
isSubmitted: !1,
|
|
564
|
-
isSubmitting: !1,
|
|
565
|
-
isSubmitSuccessful: !1,
|
|
566
|
-
isValid: !1,
|
|
567
|
-
touchedFields: {},
|
|
568
|
-
dirtyFields: {},
|
|
569
|
-
validatingFields: {},
|
|
570
|
-
errors: r.errors || {},
|
|
571
|
-
disabled: r.disabled || !1
|
|
572
|
-
};
|
|
573
|
-
const i = {};
|
|
574
|
-
let n = N(r.defaultValues) || N(r.values) ? L(r.values || r.defaultValues) || {} : {}, l = r.shouldUnregister ? {} : L(n), f = {
|
|
575
|
-
action: !1,
|
|
576
|
-
mount: !1,
|
|
577
|
-
watch: !1
|
|
578
|
-
}, y = {
|
|
579
|
-
mount: /* @__PURE__ */ new Set(),
|
|
580
|
-
disabled: /* @__PURE__ */ new Set(),
|
|
581
|
-
unMount: /* @__PURE__ */ new Set(),
|
|
582
|
-
array: /* @__PURE__ */ new Set(),
|
|
583
|
-
watch: /* @__PURE__ */ new Set()
|
|
584
|
-
}, F, x = 0;
|
|
585
|
-
const w = {
|
|
586
|
-
isDirty: !1,
|
|
587
|
-
dirtyFields: !1,
|
|
588
|
-
validatingFields: !1,
|
|
589
|
-
touchedFields: !1,
|
|
590
|
-
isValidating: !1,
|
|
591
|
-
isValid: !1,
|
|
592
|
-
errors: !1
|
|
593
|
-
};
|
|
594
|
-
let k = {
|
|
595
|
-
...w
|
|
596
|
-
};
|
|
597
|
-
const A = {
|
|
598
|
-
array: it(),
|
|
599
|
-
state: it()
|
|
600
|
-
}, O = ce(r.mode), $ = ce(r.reValidateMode), U = r.criteriaMode === ee.all, B = (s) => (a) => {
|
|
601
|
-
clearTimeout(x), x = setTimeout(s, a);
|
|
602
|
-
}, I = async (s) => {
|
|
603
|
-
if (!r.disabled && (w.isValid || k.isValid || s)) {
|
|
604
|
-
const a = r.resolver ? J((await S()).errors) : await X(i, !0);
|
|
605
|
-
a !== t.isValid && A.state.next({
|
|
606
|
-
isValid: a
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
}, v = (s, a) => {
|
|
610
|
-
!r.disabled && (w.isValidating || w.validatingFields || k.isValidating || k.validatingFields) && ((s || Array.from(y.mount)).forEach((u) => {
|
|
611
|
-
u && (a ? C(t.validatingFields, u, a) : W(t.validatingFields, u));
|
|
612
|
-
}), A.state.next({
|
|
613
|
-
validatingFields: t.validatingFields,
|
|
614
|
-
isValidating: !J(t.validatingFields)
|
|
615
|
-
}));
|
|
616
|
-
}, H = (s, a = [], u, g, d = !0, o = !0) => {
|
|
617
|
-
if (g && u && !r.disabled) {
|
|
618
|
-
if (f.action = !0, o && Array.isArray(c(i, s))) {
|
|
619
|
-
const _ = u(c(i, s), g.argA, g.argB);
|
|
620
|
-
d && C(i, s, _);
|
|
621
|
-
}
|
|
622
|
-
if (o && Array.isArray(c(t.errors, s))) {
|
|
623
|
-
const _ = u(c(t.errors, s), g.argA, g.argB);
|
|
624
|
-
d && C(t.errors, s, _), Zt(t.errors, s);
|
|
625
|
-
}
|
|
626
|
-
if ((w.touchedFields || k.touchedFields) && o && Array.isArray(c(t.touchedFields, s))) {
|
|
627
|
-
const _ = u(c(t.touchedFields, s), g.argA, g.argB);
|
|
628
|
-
d && C(t.touchedFields, s, _);
|
|
629
|
-
}
|
|
630
|
-
(w.dirtyFields || k.dirtyFields) && (t.dirtyFields = ye(n, l)), A.state.next({
|
|
631
|
-
name: s,
|
|
632
|
-
isDirty: D(s, a),
|
|
633
|
-
dirtyFields: t.dirtyFields,
|
|
634
|
-
errors: t.errors,
|
|
635
|
-
isValid: t.isValid
|
|
636
|
-
});
|
|
637
|
-
} else
|
|
638
|
-
C(l, s, a);
|
|
639
|
-
}, q = (s, a) => {
|
|
640
|
-
C(t.errors, s, a), A.state.next({
|
|
641
|
-
errors: t.errors
|
|
642
|
-
});
|
|
643
|
-
}, R = (s) => {
|
|
644
|
-
t.errors = s, A.state.next({
|
|
645
|
-
errors: t.errors,
|
|
646
|
-
isValid: !1
|
|
647
|
-
});
|
|
648
|
-
}, m = (s, a, u, g) => {
|
|
649
|
-
const d = c(i, s);
|
|
650
|
-
if (d) {
|
|
651
|
-
const o = c(l, s, T(u) ? c(n, s) : u);
|
|
652
|
-
T(o) || g && g.defaultChecked || a ? C(l, s, a ? o : ut(d._f)) : Z(s, o), f.mount && I();
|
|
653
|
-
}
|
|
654
|
-
}, b = (s, a, u, g, d) => {
|
|
655
|
-
let o = !1, _ = !1;
|
|
656
|
-
const E = {
|
|
657
|
-
name: s
|
|
658
|
-
};
|
|
659
|
-
if (!r.disabled) {
|
|
660
|
-
if (!u || g) {
|
|
661
|
-
(w.isDirty || k.isDirty) && (_ = t.isDirty, t.isDirty = E.isDirty = D(), o = _ !== E.isDirty);
|
|
662
|
-
const P = le(c(n, s), a);
|
|
663
|
-
_ = !!c(t.dirtyFields, s), P ? W(t.dirtyFields, s) : C(t.dirtyFields, s, !0), E.dirtyFields = t.dirtyFields, o = o || (w.dirtyFields || k.dirtyFields) && _ !== !P;
|
|
664
|
-
}
|
|
665
|
-
if (u) {
|
|
666
|
-
const P = c(t.touchedFields, s);
|
|
667
|
-
P || (C(t.touchedFields, s, u), E.touchedFields = t.touchedFields, o = o || (w.touchedFields || k.touchedFields) && P !== u);
|
|
668
|
-
}
|
|
669
|
-
o && d && A.state.next(E);
|
|
670
|
-
}
|
|
671
|
-
return o ? E : {};
|
|
672
|
-
}, V = (s, a, u, g) => {
|
|
673
|
-
const d = c(t.errors, s), o = (w.isValid || k.isValid) && Y(a) && t.isValid !== a;
|
|
674
|
-
if (r.delayError && u ? (F = B(() => q(s, u)), F(r.delayError)) : (clearTimeout(x), F = null, u ? C(t.errors, s, u) : W(t.errors, s)), (u ? !le(d, u) : d) || !J(g) || o) {
|
|
675
|
-
const _ = {
|
|
676
|
-
...g,
|
|
677
|
-
...o && Y(a) ? { isValid: a } : {},
|
|
678
|
-
errors: t.errors,
|
|
679
|
-
name: s
|
|
680
|
-
};
|
|
681
|
-
t = {
|
|
682
|
-
...t,
|
|
683
|
-
..._
|
|
684
|
-
}, A.state.next(_);
|
|
685
|
-
}
|
|
686
|
-
}, S = async (s) => {
|
|
687
|
-
v(s, !0);
|
|
688
|
-
const a = await r.resolver(l, r.context, Jt(s || y.mount, i, r.criteriaMode, r.shouldUseNativeValidation));
|
|
689
|
-
return v(s), a;
|
|
690
|
-
}, j = async (s) => {
|
|
691
|
-
const { errors: a } = await S(s);
|
|
692
|
-
if (s)
|
|
693
|
-
for (const u of s) {
|
|
694
|
-
const g = c(a, u);
|
|
695
|
-
g ? C(t.errors, u, g) : W(t.errors, u);
|
|
696
|
-
}
|
|
697
|
-
else
|
|
698
|
-
t.errors = a;
|
|
699
|
-
return a;
|
|
700
|
-
}, X = async (s, a, u = {
|
|
701
|
-
valid: !0
|
|
702
|
-
}) => {
|
|
703
|
-
for (const g in s) {
|
|
704
|
-
const d = s[g];
|
|
705
|
-
if (d) {
|
|
706
|
-
const { _f: o, ..._ } = d;
|
|
707
|
-
if (o) {
|
|
708
|
-
const E = y.array.has(o.name), P = d._f && zt(d._f);
|
|
709
|
-
P && w.validatingFields && v([g], !0);
|
|
710
|
-
const K = await Pe(d, y.disabled, l, U, r.shouldUseNativeValidation && !a, E);
|
|
711
|
-
if (P && w.validatingFields && v([g]), K[o.name] && (u.valid = !1, a))
|
|
712
|
-
break;
|
|
713
|
-
!a && (c(K, o.name) ? E ? kt(t.errors, K, o.name) : C(t.errors, o.name, K[o.name]) : W(t.errors, o.name));
|
|
714
|
-
}
|
|
715
|
-
!J(_) && await X(_, a, u);
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
return u.valid;
|
|
719
|
-
}, p = () => {
|
|
720
|
-
for (const s of y.unMount) {
|
|
721
|
-
const a = c(i, s);
|
|
722
|
-
a && (a._f.refs ? a._f.refs.every((u) => !pe(u)) : !pe(a._f.ref)) && we(s);
|
|
723
|
-
}
|
|
724
|
-
y.unMount = /* @__PURE__ */ new Set();
|
|
725
|
-
}, D = (s, a) => !r.disabled && (s && a && C(l, s, a), !le(Ke(), n)), M = (s, a, u) => bt(s, y, {
|
|
726
|
-
...f.mount ? l : T(a) ? n : se(s) ? { [s]: a } : a
|
|
727
|
-
}, u, a), G = (s) => he(c(f.mount ? l : n, s, r.shouldUnregister ? c(n, s, []) : [])), Z = (s, a, u = {}) => {
|
|
728
|
-
const g = c(i, s);
|
|
729
|
-
let d = a;
|
|
730
|
-
if (g) {
|
|
731
|
-
const o = g._f;
|
|
732
|
-
o && (!o.disabled && C(l, s, St(a, o)), d = Ae(o.ref) && z(a) ? "" : a, Ft(o.ref) ? [...o.ref.options].forEach((_) => _.selected = d.includes(_.value)) : o.refs ? _e(o.ref) ? o.refs.length > 1 ? o.refs.forEach((_) => (!_.defaultChecked || !_.disabled) && (_.checked = Array.isArray(d) ? !!d.find((E) => E === _.value) : d === _.value)) : o.refs[0] && (o.refs[0].checked = !!d) : o.refs.forEach((_) => _.checked = _.value === d) : He(o.ref) ? o.ref.value = "" : (o.ref.value = d, o.ref.type || A.state.next({
|
|
733
|
-
name: s,
|
|
734
|
-
values: L(l)
|
|
735
|
-
})));
|
|
736
|
-
}
|
|
737
|
-
(u.shouldDirty || u.shouldTouch) && b(s, d, u.shouldTouch, u.shouldDirty, !0), u.shouldValidate && Se(s);
|
|
738
|
-
}, re = (s, a, u) => {
|
|
739
|
-
for (const g in a) {
|
|
740
|
-
const d = a[g], o = `${s}.${g}`, _ = c(i, o);
|
|
741
|
-
(y.array.has(s) || N(d) || _ && !_._f) && !ue(d) ? re(o, d, u) : Z(o, d, u);
|
|
742
|
-
}
|
|
743
|
-
}, ae = (s, a, u = {}) => {
|
|
744
|
-
const g = c(i, s), d = y.array.has(s), o = L(a);
|
|
745
|
-
C(l, s, o), d ? (A.array.next({
|
|
746
|
-
name: s,
|
|
747
|
-
values: L(l)
|
|
748
|
-
}), (w.isDirty || w.dirtyFields || k.isDirty || k.dirtyFields) && u.shouldDirty && A.state.next({
|
|
749
|
-
name: s,
|
|
750
|
-
dirtyFields: ye(n, l),
|
|
751
|
-
isDirty: D(s, o)
|
|
752
|
-
})) : g && !g._f && !z(o) ? re(s, o, u) : Z(s, o, u), Ie(s, y) && A.state.next({ ...t }), A.state.next({
|
|
753
|
-
name: f.mount ? s : void 0,
|
|
754
|
-
values: L(l)
|
|
755
|
-
});
|
|
756
|
-
}, de = async (s) => {
|
|
757
|
-
f.mount = !0;
|
|
758
|
-
const a = s.target;
|
|
759
|
-
let u = a.name, g = !0;
|
|
760
|
-
const d = c(i, u), o = (_) => {
|
|
761
|
-
g = Number.isNaN(_) || ue(_) && isNaN(_.getTime()) || le(_, c(l, u, _));
|
|
762
|
-
};
|
|
763
|
-
if (d) {
|
|
764
|
-
let _, E;
|
|
765
|
-
const P = a.type ? ut(d._f) : yt(s), K = s.type === Fe.BLUR || s.type === Fe.FOCUS_OUT, Lt = !Gt(d._f) && !r.resolver && !c(t.errors, u) && !d._f.deps || Xt(K, c(t.touchedFields, u), t.isSubmitted, $, O), De = Ie(u, y, K);
|
|
766
|
-
C(l, u, P), K ? (d._f.onBlur && d._f.onBlur(s), F && F(0)) : d._f.onChange && d._f.onChange(s);
|
|
767
|
-
const Ee = b(u, P, K), Ut = !J(Ee) || De;
|
|
768
|
-
if (!K && A.state.next({
|
|
769
|
-
name: u,
|
|
770
|
-
type: s.type,
|
|
771
|
-
values: L(l)
|
|
772
|
-
}), Lt)
|
|
773
|
-
return (w.isValid || k.isValid) && (r.mode === "onBlur" ? K && I() : K || I()), Ut && A.state.next({ name: u, ...De ? {} : Ee });
|
|
774
|
-
if (!K && De && A.state.next({ ...t }), r.resolver) {
|
|
775
|
-
const { errors: rt } = await S([u]);
|
|
776
|
-
if (o(P), g) {
|
|
777
|
-
const Mt = ct(t.errors, i, u), st = ct(rt, i, Mt.name || u);
|
|
778
|
-
_ = st.error, u = st.name, E = J(rt);
|
|
779
|
-
}
|
|
780
|
-
} else
|
|
781
|
-
v([u], !0), _ = (await Pe(d, y.disabled, l, U, r.shouldUseNativeValidation))[u], v([u]), o(P), g && (_ ? E = !1 : (w.isValid || k.isValid) && (E = await X(i, !0)));
|
|
782
|
-
g && (d._f.deps && Se(d._f.deps), V(u, E, _, Ee));
|
|
783
|
-
}
|
|
784
|
-
}, be = (s, a) => {
|
|
785
|
-
if (c(t.errors, a) && s.focus)
|
|
786
|
-
return s.focus(), 1;
|
|
787
|
-
}, Se = async (s, a = {}) => {
|
|
788
|
-
let u, g;
|
|
789
|
-
const d = Q(s);
|
|
790
|
-
if (r.resolver) {
|
|
791
|
-
const o = await j(T(s) ? s : d);
|
|
792
|
-
u = J(o), g = s ? !d.some((_) => c(o, _)) : u;
|
|
793
|
-
} else s ? (g = (await Promise.all(d.map(async (o) => {
|
|
794
|
-
const _ = c(i, o);
|
|
795
|
-
return await X(_ && _._f ? { [o]: _ } : _);
|
|
796
|
-
}))).every(Boolean), !(!g && !t.isValid) && I()) : g = u = await X(i);
|
|
797
|
-
return A.state.next({
|
|
798
|
-
...!se(s) || (w.isValid || k.isValid) && u !== t.isValid ? {} : { name: s },
|
|
799
|
-
...r.resolver || !s ? { isValid: u } : {},
|
|
800
|
-
errors: t.errors
|
|
801
|
-
}), a.shouldFocus && !g && fe(i, be, s ? d : y.mount), g;
|
|
802
|
-
}, Ke = (s) => {
|
|
803
|
-
const a = {
|
|
804
|
-
...f.mount ? l : n
|
|
805
|
-
};
|
|
806
|
-
return T(s) ? a : se(s) ? c(a, s) : s.map((u) => c(a, u));
|
|
807
|
-
}, Je = (s, a) => ({
|
|
808
|
-
invalid: !!c((a || t).errors, s),
|
|
809
|
-
isDirty: !!c((a || t).dirtyFields, s),
|
|
810
|
-
error: c((a || t).errors, s),
|
|
811
|
-
isValidating: !!c(t.validatingFields, s),
|
|
812
|
-
isTouched: !!c((a || t).touchedFields, s)
|
|
813
|
-
}), Dt = (s) => {
|
|
814
|
-
s && Q(s).forEach((a) => W(t.errors, a)), A.state.next({
|
|
815
|
-
errors: s ? t.errors : {}
|
|
816
|
-
});
|
|
817
|
-
}, ze = (s, a, u) => {
|
|
818
|
-
const g = (c(i, s, { _f: {} })._f || {}).ref, d = c(t.errors, s) || {}, { ref: o, message: _, type: E, ...P } = d;
|
|
819
|
-
C(t.errors, s, {
|
|
820
|
-
...P,
|
|
821
|
-
...a,
|
|
822
|
-
ref: g
|
|
823
|
-
}), A.state.next({
|
|
824
|
-
name: s,
|
|
825
|
-
errors: t.errors,
|
|
826
|
-
isValid: !1
|
|
827
|
-
}), u && u.shouldFocus && g && g.focus && g.focus();
|
|
828
|
-
}, Et = (s, a) => te(s) ? A.state.subscribe({
|
|
829
|
-
next: (u) => s(M(void 0, a), u)
|
|
830
|
-
}) : M(s, a, !0), Ge = (s) => A.state.subscribe({
|
|
831
|
-
next: (a) => {
|
|
832
|
-
Yt(s.name, a.name, s.exact) && Qt(a, s.formState || w, Rt, s.reRenderRoot) && s.callback({
|
|
833
|
-
values: { ...l },
|
|
834
|
-
...t,
|
|
835
|
-
...a
|
|
836
|
-
});
|
|
837
|
-
}
|
|
838
|
-
}).unsubscribe, pt = (s) => (f.mount = !0, k = {
|
|
839
|
-
...k,
|
|
840
|
-
...s.formState
|
|
841
|
-
}, Ge({
|
|
842
|
-
...s,
|
|
843
|
-
formState: k
|
|
844
|
-
})), we = (s, a = {}) => {
|
|
845
|
-
for (const u of s ? Q(s) : y.mount)
|
|
846
|
-
y.mount.delete(u), y.array.delete(u), a.keepValue || (W(i, u), W(l, u)), !a.keepError && W(t.errors, u), !a.keepDirty && W(t.dirtyFields, u), !a.keepTouched && W(t.touchedFields, u), !a.keepIsValidating && W(t.validatingFields, u), !r.shouldUnregister && !a.keepDefaultValue && W(n, u);
|
|
847
|
-
A.state.next({
|
|
848
|
-
values: L(l)
|
|
849
|
-
}), A.state.next({
|
|
850
|
-
...t,
|
|
851
|
-
...a.keepDirty ? { isDirty: D() } : {}
|
|
852
|
-
}), !a.keepIsValid && I();
|
|
853
|
-
}, Qe = ({ disabled: s, name: a }) => {
|
|
854
|
-
(Y(s) && f.mount || s || y.disabled.has(a)) && (s ? y.disabled.add(a) : y.disabled.delete(a));
|
|
855
|
-
}, ke = (s, a = {}) => {
|
|
856
|
-
let u = c(i, s);
|
|
857
|
-
const g = Y(a.disabled) || Y(r.disabled);
|
|
858
|
-
return C(i, s, {
|
|
859
|
-
...u || {},
|
|
860
|
-
_f: {
|
|
861
|
-
...u && u._f ? u._f : { ref: { name: s } },
|
|
862
|
-
name: s,
|
|
863
|
-
mount: !0,
|
|
864
|
-
...a
|
|
865
|
-
}
|
|
866
|
-
}), y.mount.add(s), u ? Qe({
|
|
867
|
-
disabled: Y(a.disabled) ? a.disabled : r.disabled,
|
|
868
|
-
name: s
|
|
869
|
-
}) : m(s, !0, a.value), {
|
|
870
|
-
...g ? { disabled: a.disabled || r.disabled } : {},
|
|
871
|
-
...r.progressive ? {
|
|
872
|
-
required: !!a.required,
|
|
873
|
-
min: ge(a.min),
|
|
874
|
-
max: ge(a.max),
|
|
875
|
-
minLength: ge(a.minLength),
|
|
876
|
-
maxLength: ge(a.maxLength),
|
|
877
|
-
pattern: ge(a.pattern)
|
|
878
|
-
} : {},
|
|
879
|
-
name: s,
|
|
880
|
-
onChange: de,
|
|
881
|
-
onBlur: de,
|
|
882
|
-
ref: (d) => {
|
|
883
|
-
if (d) {
|
|
884
|
-
ke(s, a), u = c(i, s);
|
|
885
|
-
const o = T(d.value) && d.querySelectorAll && d.querySelectorAll("input,select,textarea")[0] || d, _ = Ht(o), E = u._f.refs || [];
|
|
886
|
-
if (_ ? E.find((P) => P === o) : o === u._f.ref)
|
|
887
|
-
return;
|
|
888
|
-
C(i, s, {
|
|
889
|
-
_f: {
|
|
890
|
-
...u._f,
|
|
891
|
-
..._ ? {
|
|
892
|
-
refs: [
|
|
893
|
-
...E.filter(pe),
|
|
894
|
-
o,
|
|
895
|
-
...Array.isArray(c(n, s)) ? [{}] : []
|
|
896
|
-
],
|
|
897
|
-
ref: { type: o.type, name: s }
|
|
898
|
-
} : { ref: o }
|
|
899
|
-
}
|
|
900
|
-
}), m(s, !1, void 0, o);
|
|
901
|
-
} else
|
|
902
|
-
u = c(i, s, {}), u._f && (u._f.mount = !1), (r.shouldUnregister || a.shouldUnregister) && !(gt(y.array, s) && f.action) && y.unMount.add(s);
|
|
903
|
-
}
|
|
904
|
-
};
|
|
905
|
-
}, Ye = () => r.shouldFocusError && fe(i, be, y.mount), Ct = (s) => {
|
|
906
|
-
Y(s) && (A.state.next({ disabled: s }), fe(i, (a, u) => {
|
|
907
|
-
const g = c(i, u);
|
|
908
|
-
g && (a.disabled = g._f.disabled || s, Array.isArray(g._f.refs) && g._f.refs.forEach((d) => {
|
|
909
|
-
d.disabled = g._f.disabled || s;
|
|
910
|
-
}));
|
|
911
|
-
}, 0, !1));
|
|
912
|
-
}, Xe = (s, a) => async (u) => {
|
|
913
|
-
let g;
|
|
914
|
-
u && (u.preventDefault && u.preventDefault(), u.persist && u.persist());
|
|
915
|
-
let d = L(l);
|
|
916
|
-
if (A.state.next({
|
|
917
|
-
isSubmitting: !0
|
|
918
|
-
}), r.resolver) {
|
|
919
|
-
const { errors: o, values: _ } = await S();
|
|
920
|
-
t.errors = o, d = _;
|
|
921
|
-
} else
|
|
922
|
-
await X(i);
|
|
923
|
-
if (y.disabled.size)
|
|
924
|
-
for (const o of y.disabled)
|
|
925
|
-
C(d, o, void 0);
|
|
926
|
-
if (W(t.errors, "root"), J(t.errors)) {
|
|
927
|
-
A.state.next({
|
|
928
|
-
errors: {}
|
|
929
|
-
});
|
|
930
|
-
try {
|
|
931
|
-
await s(d, u);
|
|
932
|
-
} catch (o) {
|
|
933
|
-
g = o;
|
|
934
|
-
}
|
|
935
|
-
} else
|
|
936
|
-
a && await a({ ...t.errors }, u), Ye(), setTimeout(Ye);
|
|
937
|
-
if (A.state.next({
|
|
938
|
-
isSubmitted: !0,
|
|
939
|
-
isSubmitting: !1,
|
|
940
|
-
isSubmitSuccessful: J(t.errors) && !g,
|
|
941
|
-
submitCount: t.submitCount + 1,
|
|
942
|
-
errors: t.errors
|
|
943
|
-
}), g)
|
|
944
|
-
throw g;
|
|
945
|
-
}, Ot = (s, a = {}) => {
|
|
946
|
-
c(i, s) && (T(a.defaultValue) ? ae(s, L(c(n, s))) : (ae(s, a.defaultValue), C(n, s, L(a.defaultValue))), a.keepTouched || W(t.touchedFields, s), a.keepDirty || (W(t.dirtyFields, s), t.isDirty = a.defaultValue ? D(s, L(c(n, s))) : D()), a.keepError || (W(t.errors, s), w.isValid && I()), A.state.next({ ...t }));
|
|
947
|
-
}, Ze = (s, a = {}) => {
|
|
948
|
-
const u = s ? L(s) : n, g = L(u), d = J(s), o = d ? n : g;
|
|
949
|
-
if (a.keepDefaultValues || (n = u), !a.keepValues) {
|
|
950
|
-
if (a.keepDirtyValues) {
|
|
951
|
-
const _ = /* @__PURE__ */ new Set([
|
|
952
|
-
...y.mount,
|
|
953
|
-
...Object.keys(ye(n, l))
|
|
954
|
-
]);
|
|
955
|
-
for (const E of Array.from(_))
|
|
956
|
-
c(t.dirtyFields, E) ? C(o, E, c(l, E)) : ae(E, c(o, E));
|
|
957
|
-
} else {
|
|
958
|
-
if (qe && T(s))
|
|
959
|
-
for (const _ of y.mount) {
|
|
960
|
-
const E = c(i, _);
|
|
961
|
-
if (E && E._f) {
|
|
962
|
-
const P = Array.isArray(E._f.refs) ? E._f.refs[0] : E._f.ref;
|
|
963
|
-
if (Ae(P)) {
|
|
964
|
-
const K = P.closest("form");
|
|
965
|
-
if (K) {
|
|
966
|
-
K.reset();
|
|
967
|
-
break;
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
for (const _ of y.mount)
|
|
973
|
-
ae(_, c(o, _));
|
|
974
|
-
}
|
|
975
|
-
l = L(o), A.array.next({
|
|
976
|
-
values: { ...o }
|
|
977
|
-
}), A.state.next({
|
|
978
|
-
values: { ...o }
|
|
979
|
-
});
|
|
980
|
-
}
|
|
981
|
-
y = {
|
|
982
|
-
mount: a.keepDirtyValues ? y.mount : /* @__PURE__ */ new Set(),
|
|
983
|
-
unMount: /* @__PURE__ */ new Set(),
|
|
984
|
-
array: /* @__PURE__ */ new Set(),
|
|
985
|
-
disabled: /* @__PURE__ */ new Set(),
|
|
986
|
-
watch: /* @__PURE__ */ new Set(),
|
|
987
|
-
watchAll: !1,
|
|
988
|
-
focus: ""
|
|
989
|
-
}, f.mount = !w.isValid || !!a.keepIsValid || !!a.keepDirtyValues, f.watch = !!r.shouldUnregister, A.state.next({
|
|
990
|
-
submitCount: a.keepSubmitCount ? t.submitCount : 0,
|
|
991
|
-
isDirty: d ? !1 : a.keepDirty ? t.isDirty : !!(a.keepDefaultValues && !le(s, n)),
|
|
992
|
-
isSubmitted: a.keepIsSubmitted ? t.isSubmitted : !1,
|
|
993
|
-
dirtyFields: d ? {} : a.keepDirtyValues ? a.keepDefaultValues && l ? ye(n, l) : t.dirtyFields : a.keepDefaultValues && s ? ye(n, s) : a.keepDirty ? t.dirtyFields : {},
|
|
994
|
-
touchedFields: a.keepTouched ? t.touchedFields : {},
|
|
995
|
-
errors: a.keepErrors ? t.errors : {},
|
|
996
|
-
isSubmitSuccessful: a.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
997
|
-
isSubmitting: !1
|
|
998
|
-
});
|
|
999
|
-
}, et = (s, a) => Ze(te(s) ? s(l) : s, a), Tt = (s, a = {}) => {
|
|
1000
|
-
const u = c(i, s), g = u && u._f;
|
|
1001
|
-
if (g) {
|
|
1002
|
-
const d = g.refs ? g.refs[0] : g.ref;
|
|
1003
|
-
d.focus && (d.focus(), a.shouldSelect && te(d.select) && d.select());
|
|
1004
|
-
}
|
|
1005
|
-
}, Rt = (s) => {
|
|
1006
|
-
t = {
|
|
1007
|
-
...t,
|
|
1008
|
-
...s
|
|
1009
|
-
};
|
|
1010
|
-
}, tt = {
|
|
1011
|
-
control: {
|
|
1012
|
-
register: ke,
|
|
1013
|
-
unregister: we,
|
|
1014
|
-
getFieldState: Je,
|
|
1015
|
-
handleSubmit: Xe,
|
|
1016
|
-
setError: ze,
|
|
1017
|
-
_subscribe: Ge,
|
|
1018
|
-
_runSchema: S,
|
|
1019
|
-
_getWatch: M,
|
|
1020
|
-
_getDirty: D,
|
|
1021
|
-
_setValid: I,
|
|
1022
|
-
_setFieldArray: H,
|
|
1023
|
-
_setDisabledField: Qe,
|
|
1024
|
-
_setErrors: R,
|
|
1025
|
-
_getFieldArray: G,
|
|
1026
|
-
_reset: Ze,
|
|
1027
|
-
_resetDefaultValues: () => te(r.defaultValues) && r.defaultValues().then((s) => {
|
|
1028
|
-
et(s, r.resetOptions), A.state.next({
|
|
1029
|
-
isLoading: !1
|
|
1030
|
-
});
|
|
1031
|
-
}),
|
|
1032
|
-
_removeUnmounted: p,
|
|
1033
|
-
_disableForm: Ct,
|
|
1034
|
-
_subjects: A,
|
|
1035
|
-
_proxyFormState: w,
|
|
1036
|
-
get _fields() {
|
|
1037
|
-
return i;
|
|
1038
|
-
},
|
|
1039
|
-
get _formValues() {
|
|
1040
|
-
return l;
|
|
1041
|
-
},
|
|
1042
|
-
get _state() {
|
|
1043
|
-
return f;
|
|
1044
|
-
},
|
|
1045
|
-
set _state(s) {
|
|
1046
|
-
f = s;
|
|
1047
|
-
},
|
|
1048
|
-
get _defaultValues() {
|
|
1049
|
-
return n;
|
|
1050
|
-
},
|
|
1051
|
-
get _names() {
|
|
1052
|
-
return y;
|
|
1053
|
-
},
|
|
1054
|
-
set _names(s) {
|
|
1055
|
-
y = s;
|
|
1056
|
-
},
|
|
1057
|
-
get _formState() {
|
|
1058
|
-
return t;
|
|
1059
|
-
},
|
|
1060
|
-
get _options() {
|
|
1061
|
-
return r;
|
|
1062
|
-
},
|
|
1063
|
-
set _options(s) {
|
|
1064
|
-
r = {
|
|
1065
|
-
...r,
|
|
1066
|
-
...s
|
|
1067
|
-
};
|
|
1068
|
-
}
|
|
1069
|
-
},
|
|
1070
|
-
subscribe: pt,
|
|
1071
|
-
trigger: Se,
|
|
1072
|
-
register: ke,
|
|
1073
|
-
handleSubmit: Xe,
|
|
1074
|
-
watch: Et,
|
|
1075
|
-
setValue: ae,
|
|
1076
|
-
getValues: Ke,
|
|
1077
|
-
reset: et,
|
|
1078
|
-
resetField: Ot,
|
|
1079
|
-
clearErrors: Dt,
|
|
1080
|
-
unregister: we,
|
|
1081
|
-
setError: ze,
|
|
1082
|
-
setFocus: Tt,
|
|
1083
|
-
getFieldState: Je
|
|
1084
|
-
};
|
|
1085
|
-
return {
|
|
1086
|
-
...tt,
|
|
1087
|
-
formControl: tt
|
|
1088
|
-
};
|
|
1089
|
-
}
|
|
1090
|
-
var ne = () => {
|
|
1091
|
-
const e = typeof performance > "u" ? Date.now() : performance.now() * 1e3;
|
|
1092
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
|
|
1093
|
-
const t = (Math.random() * 16 + e) % 16 | 0;
|
|
1094
|
-
return (r == "x" ? t : t & 3 | 8).toString(16);
|
|
1095
|
-
});
|
|
1096
|
-
}, Ce = (e, r, t = {}) => t.shouldFocus || T(t.shouldFocus) ? t.focusName || `${e}.${T(t.focusIndex) ? r : t.focusIndex}.` : "", Oe = (e, r) => [
|
|
1097
|
-
...e,
|
|
1098
|
-
...Q(r)
|
|
1099
|
-
], Te = (e) => Array.isArray(e) ? e.map(() => {
|
|
1100
|
-
}) : void 0;
|
|
1101
|
-
function Re(e, r, t) {
|
|
1102
|
-
return [
|
|
1103
|
-
...e.slice(0, r),
|
|
1104
|
-
...Q(t),
|
|
1105
|
-
...e.slice(r)
|
|
1106
|
-
];
|
|
1107
|
-
}
|
|
1108
|
-
var Le = (e, r, t) => Array.isArray(e) ? (T(e[t]) && (e[t] = void 0), e.splice(t, 0, e.splice(r, 1)[0]), e) : [], Ue = (e, r) => [
|
|
1109
|
-
...Q(r),
|
|
1110
|
-
...Q(e)
|
|
1111
|
-
];
|
|
1112
|
-
function rr(e, r) {
|
|
1113
|
-
let t = 0;
|
|
1114
|
-
const i = [...e];
|
|
1115
|
-
for (const n of r)
|
|
1116
|
-
i.splice(n - t, 1), t++;
|
|
1117
|
-
return he(i).length ? i : [];
|
|
1118
|
-
}
|
|
1119
|
-
var Me = (e, r) => T(r) ? [] : rr(e, Q(r).sort((t, i) => t - i)), Ne = (e, r, t) => {
|
|
1120
|
-
[e[r], e[t]] = [e[t], e[r]];
|
|
1121
|
-
}, dt = (e, r, t) => (e[r] = t, e);
|
|
1122
|
-
function ur(e) {
|
|
1123
|
-
const r = me(), { control: t = r.control, name: i, keyName: n = "id", shouldUnregister: l, rules: f } = e, [y, F] = h.useState(t._getFieldArray(i)), x = h.useRef(t._getFieldArray(i).map(ne)), w = h.useRef(y), k = h.useRef(i), A = h.useRef(!1);
|
|
1124
|
-
k.current = i, w.current = y, t._names.array.add(i), f && t.register(i, f), h.useEffect(() => t._subjects.array.subscribe({
|
|
1125
|
-
next: ({ values: m, name: b }) => {
|
|
1126
|
-
if (b === k.current || !b) {
|
|
1127
|
-
const V = c(m, k.current);
|
|
1128
|
-
Array.isArray(V) && (F(V), x.current = V.map(ne));
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
}).unsubscribe, [t]);
|
|
1132
|
-
const O = h.useCallback((m) => {
|
|
1133
|
-
A.current = !0, t._setFieldArray(i, m);
|
|
1134
|
-
}, [t, i]), $ = (m, b) => {
|
|
1135
|
-
const V = Q(L(m)), S = Oe(t._getFieldArray(i), V);
|
|
1136
|
-
t._names.focus = Ce(i, S.length - 1, b), x.current = Oe(x.current, V.map(ne)), O(S), F(S), t._setFieldArray(i, S, Oe, {
|
|
1137
|
-
argA: Te(m)
|
|
1138
|
-
});
|
|
1139
|
-
}, U = (m, b) => {
|
|
1140
|
-
const V = Q(L(m)), S = Ue(t._getFieldArray(i), V);
|
|
1141
|
-
t._names.focus = Ce(i, 0, b), x.current = Ue(x.current, V.map(ne)), O(S), F(S), t._setFieldArray(i, S, Ue, {
|
|
1142
|
-
argA: Te(m)
|
|
1143
|
-
});
|
|
1144
|
-
}, B = (m) => {
|
|
1145
|
-
const b = Me(t._getFieldArray(i), m);
|
|
1146
|
-
x.current = Me(x.current, m), O(b), F(b), !Array.isArray(c(t._fields, i)) && C(t._fields, i, void 0), t._setFieldArray(i, b, Me, {
|
|
1147
|
-
argA: m
|
|
1148
|
-
});
|
|
1149
|
-
}, I = (m, b, V) => {
|
|
1150
|
-
const S = Q(L(b)), j = Re(t._getFieldArray(i), m, S);
|
|
1151
|
-
t._names.focus = Ce(i, m, V), x.current = Re(x.current, m, S.map(ne)), O(j), F(j), t._setFieldArray(i, j, Re, {
|
|
1152
|
-
argA: m,
|
|
1153
|
-
argB: Te(b)
|
|
1154
|
-
});
|
|
1155
|
-
}, v = (m, b) => {
|
|
1156
|
-
const V = t._getFieldArray(i);
|
|
1157
|
-
Ne(V, m, b), Ne(x.current, m, b), O(V), F(V), t._setFieldArray(i, V, Ne, {
|
|
1158
|
-
argA: m,
|
|
1159
|
-
argB: b
|
|
1160
|
-
}, !1);
|
|
1161
|
-
}, H = (m, b) => {
|
|
1162
|
-
const V = t._getFieldArray(i);
|
|
1163
|
-
Le(V, m, b), Le(x.current, m, b), O(V), F(V), t._setFieldArray(i, V, Le, {
|
|
1164
|
-
argA: m,
|
|
1165
|
-
argB: b
|
|
1166
|
-
}, !1);
|
|
1167
|
-
}, q = (m, b) => {
|
|
1168
|
-
const V = L(b), S = dt(t._getFieldArray(i), m, V);
|
|
1169
|
-
x.current = [...S].map((j, X) => !j || X === m ? ne() : x.current[X]), O(S), F([...S]), t._setFieldArray(i, S, dt, {
|
|
1170
|
-
argA: m,
|
|
1171
|
-
argB: V
|
|
1172
|
-
}, !0, !1);
|
|
1173
|
-
}, R = (m) => {
|
|
1174
|
-
const b = Q(L(m));
|
|
1175
|
-
x.current = b.map(ne), O([...b]), F([...b]), t._setFieldArray(i, [...b], (V) => V, {}, !0, !1);
|
|
1176
|
-
};
|
|
1177
|
-
return h.useEffect(() => {
|
|
1178
|
-
if (t._state.action = !1, Ie(i, t._names) && t._subjects.state.next({
|
|
1179
|
-
...t._formState
|
|
1180
|
-
}), A.current && (!ce(t._options.mode).isOnSubmit || t._formState.isSubmitted) && !ce(t._options.reValidateMode).isOnSubmit)
|
|
1181
|
-
if (t._options.resolver)
|
|
1182
|
-
t._runSchema([i]).then((m) => {
|
|
1183
|
-
const b = c(m.errors, i), V = c(t._formState.errors, i);
|
|
1184
|
-
(V ? !b && V.type || b && (V.type !== b.type || V.message !== b.message) : b && b.type) && (b ? C(t._formState.errors, i, b) : W(t._formState.errors, i), t._subjects.state.next({
|
|
1185
|
-
errors: t._formState.errors
|
|
1186
|
-
}));
|
|
1187
|
-
});
|
|
1188
|
-
else {
|
|
1189
|
-
const m = c(t._fields, i);
|
|
1190
|
-
m && m._f && !(ce(t._options.reValidateMode).isOnSubmit && ce(t._options.mode).isOnSubmit) && Pe(m, t._names.disabled, t._formValues, t._options.criteriaMode === ee.all, t._options.shouldUseNativeValidation, !0).then((b) => !J(b) && t._subjects.state.next({
|
|
1191
|
-
errors: kt(t._formState.errors, b, i)
|
|
1192
|
-
}));
|
|
1193
|
-
}
|
|
1194
|
-
t._subjects.state.next({
|
|
1195
|
-
name: i,
|
|
1196
|
-
values: L(t._formValues)
|
|
1197
|
-
}), t._names.focus && fe(t._fields, (m, b) => {
|
|
1198
|
-
if (t._names.focus && b.startsWith(t._names.focus) && m.focus)
|
|
1199
|
-
return m.focus(), 1;
|
|
1200
|
-
}), t._names.focus = "", t._setValid(), A.current = !1;
|
|
1201
|
-
}, [y, i, t]), h.useEffect(() => (!c(t._formValues, i) && t._setFieldArray(i), () => {
|
|
1202
|
-
const m = (b, V) => {
|
|
1203
|
-
const S = c(t._fields, b);
|
|
1204
|
-
S && S._f && (S._f.mount = V);
|
|
1205
|
-
};
|
|
1206
|
-
t._options.shouldUnregister || l ? t.unregister(i) : m(i, !1);
|
|
1207
|
-
}), [i, t, n, l]), {
|
|
1208
|
-
swap: h.useCallback(v, [O, i, t]),
|
|
1209
|
-
move: h.useCallback(H, [O, i, t]),
|
|
1210
|
-
prepend: h.useCallback(U, [O, i, t]),
|
|
1211
|
-
append: h.useCallback($, [O, i, t]),
|
|
1212
|
-
remove: h.useCallback(B, [O, i, t]),
|
|
1213
|
-
insert: h.useCallback(I, [O, i, t]),
|
|
1214
|
-
update: h.useCallback(q, [O, i, t]),
|
|
1215
|
-
replace: h.useCallback(R, [O, i, t]),
|
|
1216
|
-
fields: h.useMemo(() => y.map((m, b) => ({
|
|
1217
|
-
...m,
|
|
1218
|
-
[n]: x.current[b] || ne()
|
|
1219
|
-
})), [y, n])
|
|
1220
|
-
};
|
|
1221
|
-
}
|
|
1222
|
-
function or(e = {}) {
|
|
1223
|
-
const r = h.useRef(void 0), t = h.useRef(void 0), [i, n] = h.useState({
|
|
1224
|
-
isDirty: !1,
|
|
1225
|
-
isValidating: !1,
|
|
1226
|
-
isLoading: te(e.defaultValues),
|
|
1227
|
-
isSubmitted: !1,
|
|
1228
|
-
isSubmitting: !1,
|
|
1229
|
-
isSubmitSuccessful: !1,
|
|
1230
|
-
isValid: !1,
|
|
1231
|
-
submitCount: 0,
|
|
1232
|
-
dirtyFields: {},
|
|
1233
|
-
touchedFields: {},
|
|
1234
|
-
validatingFields: {},
|
|
1235
|
-
errors: e.errors || {},
|
|
1236
|
-
disabled: e.disabled || !1,
|
|
1237
|
-
defaultValues: te(e.defaultValues) ? void 0 : e.defaultValues
|
|
1238
|
-
});
|
|
1239
|
-
r.current || (r.current = {
|
|
1240
|
-
...e.formControl ? e.formControl : tr(e),
|
|
1241
|
-
formState: i
|
|
1242
|
-
}, e.formControl && e.defaultValues && !te(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions));
|
|
1243
|
-
const l = r.current.control;
|
|
1244
|
-
return l._options = e, h.useLayoutEffect(() => l._subscribe({
|
|
1245
|
-
formState: l._proxyFormState,
|
|
1246
|
-
callback: () => n({ ...l._formState }),
|
|
1247
|
-
reRenderRoot: !0
|
|
1248
|
-
}), [l]), h.useEffect(() => l._disableForm(e.disabled), [l, e.disabled]), h.useEffect(() => {
|
|
1249
|
-
if (l._proxyFormState.isDirty) {
|
|
1250
|
-
const f = l._getDirty();
|
|
1251
|
-
f !== i.isDirty && l._subjects.state.next({
|
|
1252
|
-
isDirty: f
|
|
1253
|
-
});
|
|
1254
|
-
}
|
|
1255
|
-
}, [l, i.isDirty]), h.useEffect(() => {
|
|
1256
|
-
e.values && !le(e.values, t.current) ? (l._reset(e.values, l._options.resetOptions), t.current = e.values, n((f) => ({ ...f }))) : l._resetDefaultValues();
|
|
1257
|
-
}, [e.values, l]), h.useEffect(() => {
|
|
1258
|
-
e.errors && !J(e.errors) && l._setErrors(e.errors);
|
|
1259
|
-
}, [e.errors, l]), h.useEffect(() => {
|
|
1260
|
-
l._state.mount || (l._setValid(), l._state.mount = !0), l._state.watch && (l._state.watch = !1, l._subjects.state.next({ ...l._formState })), l._removeUnmounted();
|
|
1261
|
-
}), h.useEffect(() => {
|
|
1262
|
-
e.shouldUnregister && l._subjects.state.next({
|
|
1263
|
-
values: l._getWatch()
|
|
1264
|
-
});
|
|
1265
|
-
}, [e.shouldUnregister, l]), r.current.formState = mt(i, l), r.current;
|
|
1266
|
-
}
|
|
1267
|
-
export {
|
|
1268
|
-
nr as C,
|
|
1269
|
-
lr as F,
|
|
1270
|
-
ar as a,
|
|
1271
|
-
$t as b,
|
|
1272
|
-
tr as c,
|
|
1273
|
-
ur as d,
|
|
1274
|
-
or as e,
|
|
1275
|
-
me as f,
|
|
1276
|
-
c as g,
|
|
1277
|
-
It as h,
|
|
1278
|
-
Pt as i,
|
|
1279
|
-
C as s,
|
|
1280
|
-
Wt as u
|
|
1281
|
-
};
|
|
1282
|
-
//# sourceMappingURL=index.esm-CXA6i4d7.js.map
|