@gen-epix/ui-core-form 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/_chunks/Autocomplete.js.map +1 -1
  2. package/dist/_chunks/DatePicker.js +74 -74
  3. package/dist/_chunks/DatePicker.js.map +1 -1
  4. package/dist/_chunks/FormUtil.js +136 -141
  5. package/dist/_chunks/FormUtil.js.map +1 -1
  6. package/dist/_chunks/RichTextEditor.js +17451 -18531
  7. package/dist/_chunks/RichTextEditor.js.map +1 -1
  8. package/dist/_chunks/TransferList.js +1 -1
  9. package/dist/_chunks/TransferList.js.map +1 -1
  10. package/dist/_chunks/UploadButton.js.map +1 -1
  11. package/dist/_chunks/index.esm.js +236 -186
  12. package/dist/_chunks/index.esm.js.map +1 -1
  13. package/dist/_chunks/isEqual.js.map +1 -1
  14. package/dist/_chunks/isValid.js +1 -1
  15. package/dist/_chunks/isValid.js.map +1 -1
  16. package/dist/_chunks/rolldown-runtime.js +2 -2
  17. package/dist/_chunks/sv.js +15 -15
  18. package/dist/components/fields/CheckboxGroup/index.js +89 -89
  19. package/dist/components/fields/CheckboxGroup/index.js.map +1 -1
  20. package/dist/components/fields/DateRangePicker/index.js +193 -193
  21. package/dist/components/fields/DateRangePicker/index.js.map +1 -1
  22. package/dist/components/fields/NumberField/index.js.map +1 -1
  23. package/dist/components/fields/NumberRangeInput/index.js +140 -140
  24. package/dist/components/fields/NumberRangeInput/index.js.map +1 -1
  25. package/dist/components/fields/RadioGroup/index.js.map +1 -1
  26. package/dist/components/fields/Select/index.js.map +1 -1
  27. package/dist/components/fields/Switch/index.js +44 -44
  28. package/dist/components/fields/Switch/index.js.map +1 -1
  29. package/dist/components/fields/TextField/index.js.map +1 -1
  30. package/dist/components/fields/ToggleButtonGroup/index.js.map +1 -1
  31. package/dist/components/helpers/FormFieldHelperText/index.js.map +1 -1
  32. package/dist/components/helpers/GenericForm/index.js.map +1 -1
  33. package/package.json +3 -3
  34. /package/dist/@types/{ui-form.d.ts → ui-core-form.d.ts} +0 -0
@@ -1,68 +1,117 @@
1
1
  import e from "react";
2
- //#region ../../node_modules/.pnpm/react-hook-form@7.80.0_react@19.2.7/node_modules/react-hook-form/dist/index.esm.mjs
3
- var t = (e) => e.type === "checkbox", n = (e) => e instanceof Date, r = (e) => e == null, i = (e) => typeof e == "object", a = (e) => !r(e) && !Array.isArray(e) && i(e) && !n(e), o = (e) => a(e) && e.target ? t(e.target) ? e.target.checked : e.target.value : e, s = (e, t) => t.split(".").some((t, n, r) => !isNaN(Number(t)) && e.has(r.slice(0, n).join("."))), c = (e) => {
4
- let t = e.constructor && e.constructor.prototype;
5
- return a(t) && t.hasOwnProperty("isPrototypeOf");
6
- }, l = typeof window < "u" && window.HTMLElement !== void 0 && typeof document < "u";
7
- function u(e) {
2
+ //#region ../../node_modules/.pnpm/react-hook-form@7.87.0_react@19.2.8/node_modules/react-hook-form/dist/index.esm.mjs
3
+ var t = (e) => e.type === "checkbox", n = (e) => e.type === "file", r = (e) => e instanceof Date, i = (e) => e == null, a = (e) => typeof e == "object", o = (e) => !i(e) && !Array.isArray(e) && a(e) && !r(e), s = (e) => o(e) && e.target ? t(e.target) ? e.target.checked : n(e.target) ? e.target.files : e.target.value : e, c = /[.[\]'"]/, l = (e) => e.split(c).filter(Boolean);
4
+ function u(e, t) {
5
+ let n = l(t), r = e._formValues, i = e._defaultValues;
6
+ for (let e = 0; e < n.length - 1; e++) {
7
+ let t = n[e];
8
+ if (r = r == null ? r : r[t], i = i == null ? i : i[t], r === null || i === null) return null;
9
+ }
10
+ }
11
+ var d = (e, t) => t.split(".").some((t, n, r) => !isNaN(Number(t)) && e.has(r.slice(0, n).join("."))), f = typeof window < "u" && window.HTMLElement !== void 0 && typeof document < "u";
12
+ function p(e) {
13
+ if (typeof e != "object" || !e) return e;
8
14
  if (e instanceof Date) return new Date(e);
9
15
  let t = typeof FileList < "u" && e instanceof FileList;
10
- if (l && (e instanceof Blob || t)) return e;
16
+ if (f && (e instanceof Blob || t)) return e;
11
17
  let n = Array.isArray(e);
12
- if (!n && !(a(e) && c(e))) return e;
18
+ if (!n && e.constructor !== Object) return e;
13
19
  let r = n ? [] : Object.create(Object.getPrototypeOf(e));
14
- for (let t in e) Object.prototype.hasOwnProperty.call(e, t) && (r[t] = u(e[t]));
20
+ for (let t in e) Object.prototype.hasOwnProperty.call(e, t) && (r[t] = p(e[t]));
15
21
  return r;
16
22
  }
17
- var d = {
23
+ var m = {
18
24
  BLUR: "blur",
19
25
  FOCUS_OUT: "focusout",
20
26
  CHANGE: "change",
21
27
  SUBMIT: "submit",
22
28
  TRIGGER: "trigger",
23
29
  VALID: "valid"
24
- }, f = {
30
+ }, h = {
25
31
  onBlur: "onBlur",
26
32
  onChange: "onChange",
27
33
  onSubmit: "onSubmit",
28
34
  onTouched: "onTouched",
29
35
  all: "all"
30
- }, p = [
36
+ }, g = [
31
37
  "__proto__",
32
38
  "constructor",
33
39
  "prototype"
34
- ], m = /^\w*$/, h = (e) => m.test(e), g = (e) => e === void 0, _ = /[.[\]'"]/, v = (e) => e.split(_).filter(Boolean), y = (e, t, n) => {
35
- if (!t || !a(e)) return n;
36
- let i = h(t) ? [t] : v(t);
37
- if (i.some((e) => p.includes(e))) return n;
38
- let o = i.reduce((e, t) => r(e) ? void 0 : e[t], e);
39
- return g(o) || o === e ? g(e[t]) ? n : e[t] : o;
40
- }, b = (e) => typeof e == "boolean", x = (e) => typeof e == "function", S = (e, t, n) => {
41
- let r = -1, i = h(t) ? [t] : v(t), o = i.length, s = o - 1;
42
- for (; ++r < o;) {
43
- let t = i[r], o = n;
40
+ ], _ = /^\w*$/, v = (e) => _.test(e), y = (e) => e === void 0, b = (e, t, n) => {
41
+ if (!t || !o(e)) return n;
42
+ let r = v(t) ? [t] : l(t);
43
+ if (r.some((e) => g.includes(e))) return n;
44
+ let a = r.reduce((e, t) => i(e) ? void 0 : e[t], e);
45
+ return y(a) || a === e ? y(e[t]) ? n : e[t] : a;
46
+ }, x = (e) => typeof e == "boolean", S = (e) => typeof e == "function", C = (e, t, n) => {
47
+ let r = -1, i = v(t) ? [t] : l(t), a = i.length, s = a - 1;
48
+ for (; ++r < a;) {
49
+ let t = i[r], a = n;
44
50
  if (r !== s) {
45
51
  let n = e[t];
46
- o = a(n) || Array.isArray(n) ? n : isNaN(+i[r + 1]) ? {} : [];
52
+ a = o(n) || Array.isArray(n) ? n : isNaN(+i[r + 1]) ? {} : [];
47
53
  }
48
- if (p.includes(t)) return;
49
- e[t] = o, e = e[t];
54
+ if (g.includes(t)) return;
55
+ e[t] = a, e = e[t];
50
56
  }
51
- }, C = e.createContext(null);
52
- C.displayName = "HookFormControlContext";
53
- var w = () => e.useContext(C), T = (e, t, n, r = !0) => {
57
+ }, w = e.createContext(null);
58
+ w.displayName = "HookFormControlContext";
59
+ var T = () => e.useContext(w), E = (e, t, n, r = !0) => {
54
60
  let i = {};
55
61
  for (let a in e) Object.defineProperty(i, a, { get: () => {
56
62
  let i = a;
57
- return t._proxyFormState[i] !== f.all && (t._proxyFormState[i] = !r || f.all), n && (n[i] = !0), e[i];
63
+ return t._proxyFormState[i] !== h.all && (t._proxyFormState[i] = !r || h.all), n && (n[i] = !0), e[i];
58
64
  } });
59
65
  return i;
60
- }, E = l ? e.useLayoutEffect : e.useEffect;
61
- function D(t) {
62
- let n = w(), { control: r = n, disabled: i, name: a, exact: o } = t || {}, [s, c] = e.useState(() => ({
66
+ }, D = f ? e.useLayoutEffect : e.useEffect, O = (e) => {
67
+ let t = e.constructor && e.constructor.prototype;
68
+ return o(t) && t.hasOwnProperty("isPrototypeOf");
69
+ }, k = (e) => i(e) || !a(e), A = (e, t) => t.length === 0 && !Array.isArray(e) && !O(e);
70
+ function j(e, t, n = /* @__PURE__ */ new WeakMap()) {
71
+ if (e === t) return !0;
72
+ if (k(e) || k(t)) return Object.is(e, t);
73
+ if (r(e) && r(t)) return Object.is(e.getTime(), t.getTime());
74
+ let i = Object.keys(e), a = Object.keys(t);
75
+ if (i.length !== a.length) return !1;
76
+ if (A(e, i) || A(t, a)) return Object.is(e, t);
77
+ if (!i.length && Array.isArray(e) !== Array.isArray(t)) return !1;
78
+ let s = n.get(e);
79
+ if (s && s.has(t)) return !0;
80
+ if (s) s.add(t);
81
+ else {
82
+ let r = /* @__PURE__ */ new WeakSet();
83
+ r.add(t), n.set(e, r);
84
+ }
85
+ for (let a of i) {
86
+ let i = e[a];
87
+ if (!(a in t)) return !1;
88
+ if (a !== "ref") {
89
+ let e = t[a];
90
+ if (r(i) && r(e) || (o(i) || Array.isArray(i)) && (o(e) || Array.isArray(e)) ? !j(i, e, n) : !Object.is(i, e)) return !1;
91
+ }
92
+ }
93
+ return !0;
94
+ }
95
+ function M(t) {
96
+ let n = e.useRef(!1), r = e.useRef(!1), i = e.useRef(void 0), a = e.useRef(0);
97
+ return a.current++, !r.current && t && (r.current = !0, i.current = p(t())), {
98
+ resyncIfNeeded: e.useCallback((e, t, o) => {
99
+ if (e && (n.current || r.current && a.current > 1)) {
100
+ let e = t();
101
+ j(i.current, e) || o(e);
102
+ }
103
+ n.current = !0;
104
+ }, []),
105
+ snapshot: e.useCallback((e, t) => {
106
+ e && (i.current = p(t()));
107
+ }, [])
108
+ };
109
+ }
110
+ function N(t) {
111
+ let n = T(), { control: r = n, disabled: i, name: a, exact: o } = t || {}, s = () => ({
63
112
  ...r._formState,
64
113
  defaultValues: r._defaultValues
65
- })), l = e.useRef({
114
+ }), [c, l] = e.useState(s), u = e.useRef({
66
115
  isDirty: !1,
67
116
  isLoading: !1,
68
117
  dirtyFields: !1,
@@ -71,215 +120,212 @@ function D(t) {
71
120
  isValidating: !1,
72
121
  isValid: !1,
73
122
  errors: !1
74
- });
75
- return E(() => r._subscribe({
76
- name: a,
77
- formState: l.current,
78
- exact: o,
79
- callback: (e) => {
80
- !i && c({
81
- ...r._formState,
82
- ...e,
83
- defaultValues: r._defaultValues
84
- });
85
- }
86
- }), [
123
+ }), { resyncIfNeeded: d, snapshot: f } = M(s);
124
+ return D(() => {
125
+ d(!i, s, l);
126
+ let e = r._subscribe({
127
+ name: a,
128
+ formState: u.current,
129
+ exact: o,
130
+ callback: (e) => {
131
+ !i && l({
132
+ ...r._formState,
133
+ ...e,
134
+ defaultValues: r._defaultValues
135
+ });
136
+ }
137
+ });
138
+ return () => {
139
+ e(), f(!i, s);
140
+ };
141
+ }, [
87
142
  a,
88
143
  i,
89
- o
144
+ o,
145
+ d,
146
+ f
90
147
  ]), e.useEffect(() => {
91
- l.current.isValid && r._setValid(!0);
92
- }, [r]), e.useMemo(() => T(s, r, l.current, !1), [s, r]);
93
- }
94
- var O = (e) => typeof e == "string", k = (e, t, n, r, i) => O(e) ? (r && t.watch.add(e), y(n, e, i)) : Array.isArray(e) ? e.map((e) => (r && t.watch.add(e), y(n, e))) : (r && (t.watchAll = !0), n), A = (e) => r(e) || !i(e), j = (e, t) => t.length === 0 && !Array.isArray(e) && !c(e);
95
- function M(e, t, r = /* @__PURE__ */ new WeakMap()) {
96
- if (e === t) return !0;
97
- if (A(e) || A(t)) return Object.is(e, t);
98
- if (n(e) && n(t)) return Object.is(e.getTime(), t.getTime());
99
- let i = Object.keys(e), o = Object.keys(t);
100
- if (i.length !== o.length) return !1;
101
- if (j(e, i) || j(t, o)) return Object.is(e, t);
102
- if (!i.length && Array.isArray(e) !== Array.isArray(t)) return !1;
103
- let s = r.get(e);
104
- if (s && s.has(t)) return !0;
105
- if (s) s.add(t);
106
- else {
107
- let n = /* @__PURE__ */ new WeakSet();
108
- n.add(t), r.set(e, n);
109
- }
110
- for (let o of i) {
111
- let i = e[o];
112
- if (!(o in t)) return !1;
113
- if (o !== "ref") {
114
- let e = t[o];
115
- if (n(i) && n(e) || (a(i) || Array.isArray(i)) && (a(e) || Array.isArray(e)) ? !M(i, e, r) : !Object.is(i, e)) return !1;
116
- }
117
- }
118
- return !0;
148
+ u.current.isValid && r._setValid(!0);
149
+ }, [r]), e.useMemo(() => E(c, r, u.current, !1), [c, r]);
119
150
  }
120
- function N(t) {
121
- let n = w(), { control: r = n, name: i, defaultValue: a, disabled: o, exact: s, compute: c } = t || {}, l = e.useRef(a), u = e.useRef(c), d = e.useRef(void 0), f = e.useRef(r), p = e.useRef(i);
151
+ var P = (e) => typeof e == "string", F = (e, t, n, r, i) => P(e) ? (r && t.watch.add(e), b(n, e, i)) : Array.isArray(e) ? e.map((e) => (r && t.watch.add(e), b(n, e, b(i, e)))) : (r && (t.watchAll = !0), n);
152
+ function I(t) {
153
+ let n = T(), { control: r = n, name: i, defaultValue: a, disabled: o, exact: s, compute: c } = t || {}, l = e.useRef(a), u = e.useRef(c), d = e.useRef(void 0), f = e.useRef(r), p = e.useRef(i);
122
154
  u.current = c;
123
- let [m, h] = e.useState(() => {
155
+ let m = () => {
124
156
  let e = r._getWatch(i, l.current);
125
157
  return u.current ? u.current(e) : e;
126
- }), g = e.useCallback((e) => {
127
- let t = k(i, r._names, e || r._formValues, !1, l.current);
158
+ }, [h, g] = e.useState(m), _ = e.useCallback((e) => {
159
+ let t = F(i, r._names, e || r._formValues, !1, l.current);
128
160
  return u.current ? u.current(t) : t;
129
161
  }, [
130
162
  r._formValues,
131
163
  r._names,
132
164
  i
133
- ]), _ = e.useCallback((e) => {
165
+ ]), v = e.useCallback((e) => {
134
166
  if (!o) {
135
- let t = k(i, r._names, e || r._formValues, !1, l.current);
167
+ let t = F(i, r._names, e || r._formValues, !1, l.current);
136
168
  if (u.current) {
137
169
  let e = u.current(t);
138
- M(e, d.current) || (h(e), d.current = e);
139
- } else h(t);
170
+ j(e, d.current) || (g(e), d.current = e);
171
+ } else g(t);
140
172
  }
141
173
  }, [
142
174
  r._formValues,
143
175
  r._names,
144
176
  o,
145
177
  i
146
- ]);
147
- E(() => ((f.current !== r || !M(p.current, i)) && (f.current = r, p.current = i, _()), r._subscribe({
148
- name: i,
149
- formState: { values: !0 },
150
- exact: s,
151
- callback: (e) => {
152
- _(e.values);
153
- }
154
- })), [
178
+ ]), { resyncIfNeeded: y, snapshot: b } = M(m), x = e.useRef(v);
179
+ x.current = v;
180
+ let S = e.useRef(_);
181
+ S.current = _, D(() => {
182
+ f.current !== r || !j(p.current, i) ? (f.current = r, p.current = i, x.current()) : y(!o, () => S.current(), (e) => {
183
+ g(e), d.current = e;
184
+ });
185
+ let e = r._subscribe({
186
+ name: i,
187
+ formState: { values: !0 },
188
+ exact: s,
189
+ callback: (e) => {
190
+ x.current(e.values);
191
+ }
192
+ });
193
+ return () => {
194
+ e(), b(!o, () => S.current());
195
+ };
196
+ }, [
155
197
  r,
156
198
  s,
157
199
  i,
158
- _
200
+ o,
201
+ y,
202
+ b
159
203
  ]), e.useEffect(() => r._removeUnmounted());
160
- let v = f.current !== r, y = p.current, b = e.useMemo(() => {
161
- if (o) return null;
162
- let e = !v && !M(y, i);
163
- return v || e ? g() : null;
204
+ let C = f.current !== r, w = p.current;
205
+ return e.useMemo(() => {
206
+ if (o) return !1;
207
+ let e = !C && !j(w, i);
208
+ return C || e;
164
209
  }, [
165
210
  o,
166
- v,
211
+ C,
167
212
  i,
168
- y,
169
- g
170
- ]);
171
- return b === null ? m : b;
213
+ w
214
+ ]) ? _() : h;
172
215
  }
173
- function P(t) {
174
- let n = w(), { name: r, disabled: i, control: a = n, shouldUnregister: c, defaultValue: l, exact: f = !0 } = t, p = s(a._names.array, r), m = N({
216
+ function L(t) {
217
+ let n = T(), { name: r, disabled: i, control: a = n, shouldUnregister: o, defaultValue: c, exact: l = !0 } = t, f = d(a._names.array, r), h = I({
175
218
  control: a,
176
219
  name: r,
177
- defaultValue: e.useMemo(() => y(a._formValues, r, y(a._defaultValues, r, l)), [
220
+ defaultValue: e.useMemo(() => {
221
+ let e = b(a._formValues, r, b(a._defaultValues, r, c));
222
+ return y(e) ? u(a, r) : e;
223
+ }, [
178
224
  a,
179
225
  r,
180
- l
226
+ c
181
227
  ]),
182
- exact: f
183
- }), h = D({
228
+ exact: l
229
+ }), g = N({
184
230
  control: a,
185
231
  name: r,
186
- exact: f
187
- }), _ = e.useRef(t), v = e.useRef(null), C = e.useRef(a.register(r, {
232
+ exact: l
233
+ }), _ = e.useRef(t), v = e.useRef(null), w = e.useRef(a.register(r, {
188
234
  ...t.rules,
189
- value: m,
190
- ...b(t.disabled) ? { disabled: t.disabled } : {}
235
+ value: h,
236
+ ...x(t.disabled) ? { disabled: t.disabled } : {}
191
237
  }));
192
238
  _.current = t;
193
- let T = e.useMemo(() => Object.defineProperties({}, {
239
+ let E = e.useMemo(() => Object.defineProperties({}, {
194
240
  invalid: {
195
241
  enumerable: !0,
196
- get: () => !!y(h.errors, r)
242
+ get: () => !!b(g.errors, r)
197
243
  },
198
244
  isDirty: {
199
245
  enumerable: !0,
200
- get: () => !!y(h.dirtyFields, r)
246
+ get: () => !!b(g.dirtyFields, r)
201
247
  },
202
248
  isTouched: {
203
249
  enumerable: !0,
204
- get: () => !!y(h.touchedFields, r)
250
+ get: () => !!b(g.touchedFields, r)
205
251
  },
206
252
  isValidating: {
207
253
  enumerable: !0,
208
- get: () => !!y(h.validatingFields, r)
254
+ get: () => !!b(g.validatingFields, r)
209
255
  },
210
256
  error: {
211
257
  enumerable: !0,
212
- get: () => y(h.errors, r)
258
+ get: () => b(g.errors, r)
213
259
  }
214
- }), [h, r]), E = e.useCallback((e) => {
215
- let t = o(e);
216
- return y(a._fields, r) || (C.current = a.register(r, {
260
+ }), [g, r]), D = e.useCallback((e) => {
261
+ let t = s(e);
262
+ return b(a._fields, r) || (w.current = a.register(r, {
217
263
  ..._.current.rules,
218
264
  value: t
219
- })), C.current.onChange({
265
+ })), w.current.onChange({
220
266
  target: {
221
- value: o(e),
267
+ value: s(e),
222
268
  name: r
223
269
  },
224
- type: d.CHANGE
270
+ type: m.CHANGE
225
271
  });
226
- }, [r, a]), O = e.useCallback(() => C.current.onBlur({
272
+ }, [r, a]), O = e.useCallback(() => w.current.onBlur({
227
273
  target: {
228
- value: y(a._formValues, r),
274
+ value: b(a._formValues, r),
229
275
  name: r
230
276
  },
231
- type: d.BLUR
277
+ type: m.BLUR
232
278
  }), [r, a._formValues]), k = e.useCallback((e) => {
233
279
  e && (v.current = {
234
- focus: () => x(e.focus) && e.focus(),
235
- select: () => x(e.select) && e.select(),
236
- setCustomValidity: (t) => x(e.setCustomValidity) && e.setCustomValidity(t),
237
- reportValidity: () => x(e.reportValidity) && e.reportValidity()
280
+ focus: () => S(e.focus) && e.focus(),
281
+ select: () => S(e.select) && e.select(),
282
+ setCustomValidity: (t) => S(e.setCustomValidity) && e.setCustomValidity(t),
283
+ reportValidity: () => S(e.reportValidity) && e.reportValidity()
238
284
  });
239
- let t = y(a._fields, r);
285
+ let t = b(a._fields, r);
240
286
  t && t._f && e && (t._f.ref = v.current);
241
287
  }, [a._fields, r]), A = e.useMemo(() => ({
242
288
  name: r,
243
- value: m,
244
- ...b(i) || h.disabled ? { disabled: h.disabled || i } : {},
245
- onChange: E,
289
+ value: h,
290
+ ...x(i) || g.disabled ? { disabled: g.disabled || i } : {},
291
+ onChange: D,
246
292
  onBlur: O,
247
293
  ref: k
248
294
  }), [
249
295
  r,
250
296
  i,
251
- h.disabled,
252
- E,
297
+ g.disabled,
298
+ D,
253
299
  O,
254
300
  k,
255
- m
301
+ h
256
302
  ]);
257
303
  return e.useEffect(() => {
258
- let e = a._options.shouldUnregister || c;
259
- a.register(r, {
304
+ let e = a._options.shouldUnregister || o;
305
+ w.current = a.register(r, {
260
306
  ..._.current.rules,
261
- ...b(_.current.disabled) ? { disabled: _.current.disabled } : {}
307
+ ...x(_.current.disabled) ? { disabled: _.current.disabled } : {}
262
308
  });
263
309
  let t = (e, t) => {
264
- let n = y(a._fields, e);
310
+ let n = b(a._fields, e);
265
311
  n && n._f && (n._f.mount = t);
266
312
  };
267
313
  if (t(r, !0), e) {
268
- let e = u(y(c ? a._defaultValues : a._options.values || a._defaultValues, r, y(a._options.defaultValues, r, _.current.defaultValue)));
269
- S(a._defaultValues, r, e), g(y(a._formValues, r)) && S(a._formValues, r, e);
314
+ let e = p(b(o ? a._defaultValues : a._options.values || a._defaultValues, r, b(a._options.defaultValues, r, _.current.defaultValue)));
315
+ C(a._defaultValues, r, e), y(b(a._formValues, r)) && C(a._formValues, r, e);
270
316
  }
271
- if (!p && a.register(r), v.current) {
272
- let e = y(a._fields, r);
317
+ if (!f && a.register(r), v.current) {
318
+ let e = b(a._fields, r);
273
319
  e && e._f && (e._f.ref = v.current);
274
320
  }
275
321
  return () => {
276
- (p ? e && !a._state.action : e) ? a.unregister(r) : t(r, !1);
322
+ (f ? e && !a._state.action : e) ? a.unregister(r) : t(r, !1);
277
323
  };
278
324
  }, [
279
325
  r,
280
326
  a,
281
- p,
282
- c
327
+ f,
328
+ o
283
329
  ]), e.useEffect(() => {
284
330
  a._setDisabledField({
285
331
  disabled: i,
@@ -291,58 +337,62 @@ function P(t) {
291
337
  a
292
338
  ]), e.useMemo(() => ({
293
339
  field: A,
294
- formState: h,
295
- fieldState: T
340
+ formState: g,
341
+ fieldState: E
296
342
  }), [
297
343
  A,
298
- h,
299
- T
344
+ g,
345
+ E
300
346
  ]);
301
347
  }
302
- var F = (e) => e.render(P(e)), I = e.createContext(null);
303
- I.displayName = "HookFormContext";
304
- var L = () => e.useContext(I), R = ({ children: t, watch: n, getValues: r, getFieldState: i, setError: a, clearErrors: o, setValue: s, setValues: c, trigger: l, formState: u, resetField: d, reset: f, handleSubmit: p, unregister: m, control: h, register: g, setFocus: _, subscribe: v }) => {
305
- let y = e.useMemo(() => ({
348
+ var R = (e) => e.render(L(e)), z = e.createContext(null);
349
+ z.displayName = "HookFormContext";
350
+ var B = () => e.useContext(z), V = ({ children: t, watch: n, getValues: r, getErrors: i, getFieldState: a, setError: o, clearErrors: s, setValue: c, setValues: l, trigger: u, formState: d, resetField: f, reset: p, resetDefaultValues: m, handleSubmit: h, unregister: g, control: _, register: v, setFocus: y, subscribe: b }) => {
351
+ let x = e.useMemo(() => ({
306
352
  watch: n,
307
353
  getValues: r,
308
- getFieldState: i,
309
- setError: a,
310
- clearErrors: o,
311
- setValue: s,
312
- setValues: c,
313
- trigger: l,
314
- formState: u,
315
- resetField: d,
316
- reset: f,
317
- handleSubmit: p,
318
- unregister: m,
319
- control: h,
320
- register: g,
321
- setFocus: _,
322
- subscribe: v
354
+ getErrors: i,
355
+ getFieldState: a,
356
+ setError: o,
357
+ clearErrors: s,
358
+ setValue: c,
359
+ setValues: l,
360
+ trigger: u,
361
+ formState: d,
362
+ resetField: f,
363
+ reset: p,
364
+ resetDefaultValues: m,
365
+ handleSubmit: h,
366
+ unregister: g,
367
+ control: _,
368
+ register: v,
369
+ setFocus: y,
370
+ subscribe: b
323
371
  }), [
324
- o,
325
- h,
326
- u,
372
+ s,
373
+ _,
374
+ d,
327
375
  i,
376
+ a,
328
377
  r,
378
+ h,
379
+ v,
329
380
  p,
330
- g,
381
+ m,
331
382
  f,
332
- d,
333
- a,
334
- _,
335
- s,
383
+ o,
384
+ y,
336
385
  c,
337
- v,
338
386
  l,
339
- m,
387
+ b,
388
+ u,
389
+ g,
340
390
  n
341
391
  ]);
342
- return e.createElement(I.Provider, { value: y }, e.createElement(C.Provider, { value: y.control }, t));
392
+ return e.createElement(z.Provider, { value: x }, e.createElement(w.Provider, { value: x.control }, t));
343
393
  };
344
- f.onSubmit, f.onChange;
394
+ h.onSubmit, h.onChange;
345
395
  //#endregion
346
- export { N as a, L as i, R as n, S as r, F as t };
396
+ export { I as a, B as i, V as n, C as r, R as t };
347
397
 
348
398
  //# sourceMappingURL=index.esm.js.map