@goodie-forms/react 1.0.0-alpha → 1.1.1-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,167 +1,182 @@
1
- import { FormController as Rr, Field as we } from "@goodie-forms/core";
2
- import ke, { useState as W, useRef as De, useEffect as D } from "react";
3
- function Y(...a) {
1
+ import { FormController as br, Field as F } from "@goodie-forms/core";
2
+ import De, { useState as ne, useRef as re, startTransition as pr, useEffect as I } from "react";
3
+ function W(...t) {
4
4
  return () => {
5
- for (const i of a)
6
- i();
5
+ for (const o of t)
6
+ o();
7
7
  };
8
8
  }
9
- function q() {
10
- const [, a] = W(0), i = De(0);
11
- return i.current++, {
12
- renderCount: i.current,
13
- forceRerender: () => a((l) => l + 1)
9
+ function J() {
10
+ const [, t] = ne(0), o = re(0), l = re(!1);
11
+ o.current++;
12
+ const d = () => {
13
+ l.current || (l.current = !0, queueMicrotask(() => {
14
+ pr(() => {
15
+ t((v) => v + 1);
16
+ }), l.current = !1;
17
+ }));
18
+ };
19
+ return {
20
+ renderCount: o.current,
21
+ forceRerender: d
14
22
  };
15
23
  }
16
- function Or(a, i) {
17
- const [l] = W(() => new Rr(a)), f = q(), [, d] = W(() => l.isSubmitting), [, v] = W(() => l.isValid);
18
- return D(() => {
19
- const h = () => {
24
+ function Sr(t, o) {
25
+ const [l] = ne(() => new br(t)), d = J();
26
+ return I(() => {
27
+ const v = () => {
20
28
  };
21
- return Y(
22
- l.events.on("statusChanged", (C) => {
23
- d(C === "submitting"), v(l.isValid);
29
+ return W(
30
+ l.events.on("submissionStatusChange", () => {
31
+ d.forceRerender();
24
32
  }),
25
- i?.watchIssues ? l.events.on(
26
- "validationIssuesUpdated",
27
- () => f.forceRerender()
28
- ) : h,
29
- i?.watchValues ? l.events.on(
33
+ o?.watchIssues ? l.events.on(
34
+ "fieldIssuesUpdated",
35
+ () => d.forceRerender()
36
+ ) : v,
37
+ o?.watchValues ? l.events.on(
30
38
  "valueChanged",
31
- () => f.forceRerender()
32
- ) : h
39
+ () => d.forceRerender()
40
+ ) : v
33
41
  );
34
42
  }, [l]), {
35
- formConfigs: a,
36
- hookConfigs: i,
43
+ formConfigs: t,
44
+ hookConfigs: o,
37
45
  controller: l
38
46
  };
39
47
  }
40
- function mr(a, i, l) {
41
- const f = q(), [d] = W(() => a.controller.getField(i) ?? a.controller.bindField(i, {
42
- defaultValue: l
43
- }));
44
- return D(() => {
45
- const { events: v } = a.controller;
46
- return Y(
47
- v.on("valueChanged", (h) => {
48
- h === i && f.forceRerender();
48
+ function mr(t, o, l) {
49
+ const d = J(), [v, c] = ne(() => {
50
+ let g = t.controller.getField(o);
51
+ return g == null && l != null && (g = t.controller.bindField(o, l)), g;
52
+ });
53
+ return I(() => {
54
+ const { events: g } = t.controller;
55
+ return c(t.controller.getField(o)), W(
56
+ g.on("fieldBound", (h) => {
57
+ h === o && c(t.controller.getField(o));
58
+ }),
59
+ g.on("fieldUnbound", (h) => {
60
+ h === o && c(void 0);
61
+ }),
62
+ g.on("valueChanged", (h) => {
63
+ (h === o || F.isDescendant(h, o)) && d.forceRerender();
49
64
  }),
50
- v.on("fieldTouchUpdated", (h) => {
51
- h === i && f.forceRerender();
65
+ g.on("fieldTouchUpdated", (h) => {
66
+ h === o && d.forceRerender();
52
67
  }),
53
- v.on("fieldDirtyUpdated", (h) => {
54
- h === i && f.forceRerender();
68
+ g.on("fieldDirtyUpdated", (h) => {
69
+ h === o && d.forceRerender();
55
70
  }),
56
- v.on("validationIssuesUpdated", (h) => {
57
- h === i && f.forceRerender();
71
+ g.on("fieldIssuesUpdated", (h) => {
72
+ h === o && d.forceRerender();
58
73
  })
59
74
  );
60
- }, []), d;
75
+ }, []), v;
61
76
  }
62
- function Sr(a, i) {
63
- const l = q();
64
- return D(() => {
65
- const { events: f } = a.controller;
66
- return Y(
67
- f.on("valueChanged", (d) => {
68
- (i?.include?.includes?.(d) ?? !0) && l.forceRerender();
77
+ function wr(t, o) {
78
+ const l = J(), d = o?.include == null ? t.controller._data : o.include.reduce((v, c) => {
79
+ const g = F.getValue(t.controller._data, c);
80
+ return F.setValue(v, c, g), v;
81
+ }, {});
82
+ return I(() => {
83
+ const { events: v } = t.controller;
84
+ return W(
85
+ v.on("valueChanged", (c) => {
86
+ (o?.include == null || o.include.some(
87
+ (h) => h === c || F.isDescendant(h, c)
88
+ )) && l.forceRerender();
69
89
  })
70
90
  );
71
- }, []), i?.include == null ? a.controller._data : i.include.reduce((f, d) => {
72
- const v = we.getValue(a.controller._data, d);
73
- return we.setValue(f, d, v), f;
74
- }, {});
91
+ }, []), d;
75
92
  }
76
- function br(a, i) {
93
+ function yr(t, o) {
77
94
  const l = {};
78
- for (const f of a) {
79
- const d = i(f);
80
- (l[d] ??= []).push(f);
95
+ for (const d of t) {
96
+ const v = o(d);
97
+ (l[v] ??= []).push(d);
81
98
  }
82
99
  return l;
83
100
  }
84
- function wr(a, i) {
85
- const l = q();
86
- D(() => {
87
- const { events: d } = a.controller;
88
- return Y(
89
- d.on("validationIssuesUpdated", (v) => {
90
- (i?.include?.includes?.(v) ?? !0) && l.forceRerender();
101
+ function Pr(t, o) {
102
+ const l = J(), d = t.controller._issues.filter((c) => {
103
+ if (o?.include == null) return !0;
104
+ const g = F.parsePath(c.path);
105
+ return o.include.includes(g);
106
+ }), v = yr(
107
+ d,
108
+ (c) => F.parsePath(c.path)
109
+ );
110
+ return I(() => {
111
+ const { events: c } = t.controller;
112
+ return W(
113
+ c.on("fieldIssuesUpdated", (g) => {
114
+ (o?.include?.includes?.(g) ?? !0) && l.forceRerender();
91
115
  })
92
116
  );
93
- }, []);
94
- const f = a.controller._issues.filter((d) => {
95
- if (i?.include == null) return !0;
96
- const v = d.path.join(".");
97
- return i.include.includes(v);
98
- });
99
- return br(
100
- f,
101
- (d) => d.path.join(".")
102
- );
117
+ }, []), v;
103
118
  }
104
- var J = { exports: {} }, V = {};
105
- var Pe;
119
+ var q = { exports: {} }, $ = {};
120
+ var Fe;
106
121
  function Er() {
107
- if (Pe) return V;
108
- Pe = 1;
109
- var a = ke, i = /* @__PURE__ */ Symbol.for("react.element"), l = /* @__PURE__ */ Symbol.for("react.fragment"), f = Object.prototype.hasOwnProperty, d = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, v = { key: !0, ref: !0, __self: !0, __source: !0 };
110
- function h(C, R, j) {
111
- var y, T = {}, S = null, U = null;
112
- j !== void 0 && (S = "" + j), R.key !== void 0 && (S = "" + R.key), R.ref !== void 0 && (U = R.ref);
113
- for (y in R) f.call(R, y) && !v.hasOwnProperty(y) && (T[y] = R[y]);
114
- if (C && C.defaultProps) for (y in R = C.defaultProps, R) T[y] === void 0 && (T[y] = R[y]);
115
- return { $$typeof: i, type: C, key: S, ref: U, props: T, _owner: d.current };
122
+ if (Fe) return $;
123
+ Fe = 1;
124
+ var t = De, o = /* @__PURE__ */ Symbol.for("react.element"), l = /* @__PURE__ */ Symbol.for("react.fragment"), d = Object.prototype.hasOwnProperty, v = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, c = { key: !0, ref: !0, __self: !0, __source: !0 };
125
+ function g(h, p, j) {
126
+ var _, T = {}, S = null, Y = null;
127
+ j !== void 0 && (S = "" + j), p.key !== void 0 && (S = "" + p.key), p.ref !== void 0 && (Y = p.ref);
128
+ for (_ in p) d.call(p, _) && !c.hasOwnProperty(_) && (T[_] = p[_]);
129
+ if (h && h.defaultProps) for (_ in p = h.defaultProps, p) T[_] === void 0 && (T[_] = p[_]);
130
+ return { $$typeof: o, type: h, key: S, ref: Y, props: T, _owner: v.current };
116
131
  }
117
- return V.Fragment = l, V.jsx = h, V.jsxs = h, V;
132
+ return $.Fragment = l, $.jsx = g, $.jsxs = g, $;
118
133
  }
119
- var $ = {};
134
+ var U = {};
120
135
  var je;
121
- function yr() {
136
+ function _r() {
122
137
  return je || (je = 1, process.env.NODE_ENV !== "production" && (function() {
123
- var a = ke, i = /* @__PURE__ */ Symbol.for("react.element"), l = /* @__PURE__ */ Symbol.for("react.portal"), f = /* @__PURE__ */ Symbol.for("react.fragment"), d = /* @__PURE__ */ Symbol.for("react.strict_mode"), v = /* @__PURE__ */ Symbol.for("react.profiler"), h = /* @__PURE__ */ Symbol.for("react.provider"), C = /* @__PURE__ */ Symbol.for("react.context"), R = /* @__PURE__ */ Symbol.for("react.forward_ref"), j = /* @__PURE__ */ Symbol.for("react.suspense"), y = /* @__PURE__ */ Symbol.for("react.suspense_list"), T = /* @__PURE__ */ Symbol.for("react.memo"), S = /* @__PURE__ */ Symbol.for("react.lazy"), U = /* @__PURE__ */ Symbol.for("react.offscreen"), re = Symbol.iterator, Ae = "@@iterator";
124
- function Ie(e) {
138
+ var t = De, o = /* @__PURE__ */ Symbol.for("react.element"), l = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), v = /* @__PURE__ */ Symbol.for("react.strict_mode"), c = /* @__PURE__ */ Symbol.for("react.profiler"), g = /* @__PURE__ */ Symbol.for("react.provider"), h = /* @__PURE__ */ Symbol.for("react.context"), p = /* @__PURE__ */ Symbol.for("react.forward_ref"), j = /* @__PURE__ */ Symbol.for("react.suspense"), _ = /* @__PURE__ */ Symbol.for("react.suspense_list"), T = /* @__PURE__ */ Symbol.for("react.memo"), S = /* @__PURE__ */ Symbol.for("react.lazy"), Y = /* @__PURE__ */ Symbol.for("react.offscreen"), te = Symbol.iterator, Ie = "@@iterator";
139
+ function Ae(e) {
125
140
  if (e === null || typeof e != "object")
126
141
  return null;
127
- var r = re && e[re] || e[Ae];
142
+ var r = te && e[te] || e[Ie];
128
143
  return typeof r == "function" ? r : null;
129
144
  }
130
- var x = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
145
+ var x = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
131
146
  function m(e) {
132
147
  {
133
- for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), t = 1; t < r; t++)
134
- n[t - 1] = arguments[t];
148
+ for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++)
149
+ n[a - 1] = arguments[a];
135
150
  Ve("error", e, n);
136
151
  }
137
152
  }
138
153
  function Ve(e, r, n) {
139
154
  {
140
- var t = x.ReactDebugCurrentFrame, s = t.getStackAddendum();
155
+ var a = x.ReactDebugCurrentFrame, s = a.getStackAddendum();
141
156
  s !== "" && (r += "%s", n = n.concat([s]));
142
- var c = n.map(function(u) {
157
+ var f = n.map(function(u) {
143
158
  return String(u);
144
159
  });
145
- c.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, c);
160
+ f.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, f);
146
161
  }
147
162
  }
148
- var $e = !1, We = !1, Ye = !1, Ue = !1, Me = !1, ne;
149
- ne = /* @__PURE__ */ Symbol.for("react.module.reference");
163
+ var $e = !1, Ue = !1, We = !1, Ye = !1, Me = !1, ae;
164
+ ae = /* @__PURE__ */ Symbol.for("react.module.reference");
150
165
  function Le(e) {
151
- return !!(typeof e == "string" || typeof e == "function" || e === f || e === v || Me || e === d || e === j || e === y || Ue || e === U || $e || We || Ye || typeof e == "object" && e !== null && (e.$$typeof === S || e.$$typeof === T || e.$$typeof === h || e.$$typeof === C || e.$$typeof === R || // This needs to include all possible module reference object
166
+ return !!(typeof e == "string" || typeof e == "function" || e === d || e === c || Me || e === v || e === j || e === _ || Ye || e === Y || $e || Ue || We || typeof e == "object" && e !== null && (e.$$typeof === S || e.$$typeof === T || e.$$typeof === g || e.$$typeof === h || e.$$typeof === p || // This needs to include all possible module reference object
152
167
  // types supported by any Flight configuration anywhere since
153
168
  // we don't know which Flight build this will end up being used
154
169
  // with.
155
- e.$$typeof === ne || e.getModuleId !== void 0));
170
+ e.$$typeof === ae || e.getModuleId !== void 0));
156
171
  }
157
- function Ne(e, r, n) {
158
- var t = e.displayName;
159
- if (t)
160
- return t;
172
+ function Be(e, r, n) {
173
+ var a = e.displayName;
174
+ if (a)
175
+ return a;
161
176
  var s = r.displayName || r.name || "";
162
177
  return s !== "" ? n + "(" + s + ")" : n;
163
178
  }
164
- function te(e) {
179
+ function oe(e) {
165
180
  return e.displayName || "Context";
166
181
  }
167
182
  function O(e) {
@@ -172,36 +187,36 @@ function yr() {
172
187
  if (typeof e == "string")
173
188
  return e;
174
189
  switch (e) {
175
- case f:
190
+ case d:
176
191
  return "Fragment";
177
192
  case l:
178
193
  return "Portal";
179
- case v:
194
+ case c:
180
195
  return "Profiler";
181
- case d:
196
+ case v:
182
197
  return "StrictMode";
183
198
  case j:
184
199
  return "Suspense";
185
- case y:
200
+ case _:
186
201
  return "SuspenseList";
187
202
  }
188
203
  if (typeof e == "object")
189
204
  switch (e.$$typeof) {
190
- case C:
191
- var r = e;
192
- return te(r) + ".Consumer";
193
205
  case h:
206
+ var r = e;
207
+ return oe(r) + ".Consumer";
208
+ case g:
194
209
  var n = e;
195
- return te(n._context) + ".Provider";
196
- case R:
197
- return Ne(e, e.render, "ForwardRef");
210
+ return oe(n._context) + ".Provider";
211
+ case p:
212
+ return Be(e, e.render, "ForwardRef");
198
213
  case T:
199
- var t = e.displayName || null;
200
- return t !== null ? t : O(e.type) || "Memo";
214
+ var a = e.displayName || null;
215
+ return a !== null ? a : O(e.type) || "Memo";
201
216
  case S: {
202
- var s = e, c = s._payload, u = s._init;
217
+ var s = e, f = s._payload, u = s._init;
203
218
  try {
204
- return O(u(c));
219
+ return O(u(f));
205
220
  } catch {
206
221
  return null;
207
222
  }
@@ -209,18 +224,18 @@ function yr() {
209
224
  }
210
225
  return null;
211
226
  }
212
- var w = Object.assign, A = 0, ae, oe, ie, ue, le, se, ce;
213
- function fe() {
227
+ var w = Object.assign, A = 0, ie, ue, le, se, ce, fe, de;
228
+ function ve() {
214
229
  }
215
- fe.__reactDisabledLog = !0;
216
- function Be() {
230
+ ve.__reactDisabledLog = !0;
231
+ function Ne() {
217
232
  {
218
233
  if (A === 0) {
219
- ae = console.log, oe = console.info, ie = console.warn, ue = console.error, le = console.group, se = console.groupCollapsed, ce = console.groupEnd;
234
+ ie = console.log, ue = console.info, le = console.warn, se = console.error, ce = console.group, fe = console.groupCollapsed, de = console.groupEnd;
220
235
  var e = {
221
236
  configurable: !0,
222
237
  enumerable: !0,
223
- value: fe,
238
+ value: ve,
224
239
  writable: !0
225
240
  };
226
241
  Object.defineProperties(console, {
@@ -236,7 +251,7 @@ function yr() {
236
251
  A++;
237
252
  }
238
253
  }
239
- function Je() {
254
+ function qe() {
240
255
  {
241
256
  if (A--, A === 0) {
242
257
  var e = {
@@ -246,25 +261,25 @@ function yr() {
246
261
  };
247
262
  Object.defineProperties(console, {
248
263
  log: w({}, e, {
249
- value: ae
264
+ value: ie
250
265
  }),
251
266
  info: w({}, e, {
252
- value: oe
267
+ value: ue
253
268
  }),
254
269
  warn: w({}, e, {
255
- value: ie
270
+ value: le
256
271
  }),
257
272
  error: w({}, e, {
258
- value: ue
273
+ value: se
259
274
  }),
260
275
  group: w({}, e, {
261
- value: le
276
+ value: ce
262
277
  }),
263
278
  groupCollapsed: w({}, e, {
264
- value: se
279
+ value: fe
265
280
  }),
266
281
  groupEnd: w({}, e, {
267
- value: ce
282
+ value: de
268
283
  })
269
284
  });
270
285
  }
@@ -278,8 +293,8 @@ function yr() {
278
293
  try {
279
294
  throw Error();
280
295
  } catch (s) {
281
- var t = s.stack.trim().match(/\n( *(at )?)/);
282
- G = t && t[1] || "";
296
+ var a = s.stack.trim().match(/\n( *(at )?)/);
297
+ G = a && a[1] || "";
283
298
  }
284
299
  return `
285
300
  ` + G + e;
@@ -287,10 +302,10 @@ function yr() {
287
302
  }
288
303
  var z = !1, L;
289
304
  {
290
- var qe = typeof WeakMap == "function" ? WeakMap : Map;
291
- L = new qe();
305
+ var Je = typeof WeakMap == "function" ? WeakMap : Map;
306
+ L = new Je();
292
307
  }
293
- function de(e, r) {
308
+ function ge(e, r) {
294
309
  if (!e || z)
295
310
  return "";
296
311
  {
@@ -298,12 +313,12 @@ function yr() {
298
313
  if (n !== void 0)
299
314
  return n;
300
315
  }
301
- var t;
316
+ var a;
302
317
  z = !0;
303
318
  var s = Error.prepareStackTrace;
304
319
  Error.prepareStackTrace = void 0;
305
- var c;
306
- c = K.current, K.current = null, Be();
320
+ var f;
321
+ f = K.current, K.current = null, Ne();
307
322
  try {
308
323
  if (r) {
309
324
  var u = function() {
@@ -317,14 +332,14 @@ function yr() {
317
332
  try {
318
333
  Reflect.construct(u, []);
319
334
  } catch (E) {
320
- t = E;
335
+ a = E;
321
336
  }
322
337
  Reflect.construct(e, [], u);
323
338
  } else {
324
339
  try {
325
340
  u.call();
326
341
  } catch (E) {
327
- t = E;
342
+ a = E;
328
343
  }
329
344
  e.call(u.prototype);
330
345
  }
@@ -332,95 +347,95 @@ function yr() {
332
347
  try {
333
348
  throw Error();
334
349
  } catch (E) {
335
- t = E;
350
+ a = E;
336
351
  }
337
352
  e();
338
353
  }
339
354
  } catch (E) {
340
- if (E && t && typeof E.stack == "string") {
341
- for (var o = E.stack.split(`
342
- `), b = t.stack.split(`
343
- `), g = o.length - 1, p = b.length - 1; g >= 1 && p >= 0 && o[g] !== b[p]; )
344
- p--;
345
- for (; g >= 1 && p >= 0; g--, p--)
346
- if (o[g] !== b[p]) {
347
- if (g !== 1 || p !== 1)
355
+ if (E && a && typeof E.stack == "string") {
356
+ for (var i = E.stack.split(`
357
+ `), y = a.stack.split(`
358
+ `), R = i.length - 1, b = y.length - 1; R >= 1 && b >= 0 && i[R] !== y[b]; )
359
+ b--;
360
+ for (; R >= 1 && b >= 0; R--, b--)
361
+ if (i[R] !== y[b]) {
362
+ if (R !== 1 || b !== 1)
348
363
  do
349
- if (g--, p--, p < 0 || o[g] !== b[p]) {
350
- var _ = `
351
- ` + o[g].replace(" at new ", " at ");
352
- return e.displayName && _.includes("<anonymous>") && (_ = _.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, _), _;
364
+ if (R--, b--, b < 0 || i[R] !== y[b]) {
365
+ var C = `
366
+ ` + i[R].replace(" at new ", " at ");
367
+ return e.displayName && C.includes("<anonymous>") && (C = C.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, C), C;
353
368
  }
354
- while (g >= 1 && p >= 0);
369
+ while (R >= 1 && b >= 0);
355
370
  break;
356
371
  }
357
372
  }
358
373
  } finally {
359
- z = !1, K.current = c, Je(), Error.prepareStackTrace = s;
374
+ z = !1, K.current = f, qe(), Error.prepareStackTrace = s;
360
375
  }
361
- var k = e ? e.displayName || e.name : "", P = k ? M(k) : "";
376
+ var D = e ? e.displayName || e.name : "", P = D ? M(D) : "";
362
377
  return typeof e == "function" && L.set(e, P), P;
363
378
  }
364
379
  function Ke(e, r, n) {
365
- return de(e, !1);
380
+ return ge(e, !1);
366
381
  }
367
382
  function Ge(e) {
368
383
  var r = e.prototype;
369
384
  return !!(r && r.isReactComponent);
370
385
  }
371
- function N(e, r, n) {
386
+ function B(e, r, n) {
372
387
  if (e == null)
373
388
  return "";
374
389
  if (typeof e == "function")
375
- return de(e, Ge(e));
390
+ return ge(e, Ge(e));
376
391
  if (typeof e == "string")
377
392
  return M(e);
378
393
  switch (e) {
379
394
  case j:
380
395
  return M("Suspense");
381
- case y:
396
+ case _:
382
397
  return M("SuspenseList");
383
398
  }
384
399
  if (typeof e == "object")
385
400
  switch (e.$$typeof) {
386
- case R:
401
+ case p:
387
402
  return Ke(e.render);
388
403
  case T:
389
- return N(e.type, r, n);
404
+ return B(e.type, r, n);
390
405
  case S: {
391
- var t = e, s = t._payload, c = t._init;
406
+ var a = e, s = a._payload, f = a._init;
392
407
  try {
393
- return N(c(s), r, n);
408
+ return B(f(s), r, n);
394
409
  } catch {
395
410
  }
396
411
  }
397
412
  }
398
413
  return "";
399
414
  }
400
- var I = Object.prototype.hasOwnProperty, ve = {}, ge = x.ReactDebugCurrentFrame;
401
- function B(e) {
415
+ var V = Object.prototype.hasOwnProperty, he = {}, Re = x.ReactDebugCurrentFrame;
416
+ function N(e) {
402
417
  if (e) {
403
- var r = e._owner, n = N(e.type, e._source, r ? r.type : null);
404
- ge.setExtraStackFrame(n);
418
+ var r = e._owner, n = B(e.type, e._source, r ? r.type : null);
419
+ Re.setExtraStackFrame(n);
405
420
  } else
406
- ge.setExtraStackFrame(null);
421
+ Re.setExtraStackFrame(null);
407
422
  }
408
- function ze(e, r, n, t, s) {
423
+ function ze(e, r, n, a, s) {
409
424
  {
410
- var c = Function.call.bind(I);
425
+ var f = Function.call.bind(V);
411
426
  for (var u in e)
412
- if (c(e, u)) {
413
- var o = void 0;
427
+ if (f(e, u)) {
428
+ var i = void 0;
414
429
  try {
415
430
  if (typeof e[u] != "function") {
416
- var b = Error((t || "React class") + ": " + n + " type `" + u + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[u] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
417
- throw b.name = "Invariant Violation", b;
431
+ var y = Error((a || "React class") + ": " + n + " type `" + u + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[u] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
432
+ throw y.name = "Invariant Violation", y;
418
433
  }
419
- o = e[u](r, u, t, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
420
- } catch (g) {
421
- o = g;
434
+ i = e[u](r, u, a, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
435
+ } catch (R) {
436
+ i = R;
422
437
  }
423
- o && !(o instanceof Error) && (B(s), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", t || "React class", n, u, typeof o), B(null)), o instanceof Error && !(o.message in ve) && (ve[o.message] = !0, B(s), m("Failed %s type: %s", n, o.message), B(null));
438
+ i && !(i instanceof Error) && (N(s), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", a || "React class", n, u, typeof i), N(null)), i instanceof Error && !(i.message in he) && (he[i.message] = !0, N(s), m("Failed %s type: %s", n, i.message), N(null));
424
439
  }
425
440
  }
426
441
  }
@@ -436,26 +451,26 @@ function yr() {
436
451
  }
437
452
  function Ze(e) {
438
453
  try {
439
- return pe(e), !1;
454
+ return be(e), !1;
440
455
  } catch {
441
456
  return !0;
442
457
  }
443
458
  }
444
- function pe(e) {
459
+ function be(e) {
445
460
  return "" + e;
446
461
  }
447
- function he(e) {
462
+ function pe(e) {
448
463
  if (Ze(e))
449
- return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", He(e)), pe(e);
464
+ return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", He(e)), be(e);
450
465
  }
451
- var Re = x.ReactCurrentOwner, Qe = {
466
+ var me = x.ReactCurrentOwner, Qe = {
452
467
  key: !0,
453
468
  ref: !0,
454
469
  __self: !0,
455
470
  __source: !0
456
- }, me, be;
471
+ }, ye, Ee;
457
472
  function er(e) {
458
- if (I.call(e, "ref")) {
473
+ if (V.call(e, "ref")) {
459
474
  var r = Object.getOwnPropertyDescriptor(e, "ref").get;
460
475
  if (r && r.isReactWarning)
461
476
  return !1;
@@ -463,7 +478,7 @@ function yr() {
463
478
  return e.ref !== void 0;
464
479
  }
465
480
  function rr(e) {
466
- if (I.call(e, "key")) {
481
+ if (V.call(e, "key")) {
467
482
  var r = Object.getOwnPropertyDescriptor(e, "key").get;
468
483
  if (r && r.isReactWarning)
469
484
  return !1;
@@ -471,12 +486,12 @@ function yr() {
471
486
  return e.key !== void 0;
472
487
  }
473
488
  function nr(e, r) {
474
- typeof e.ref == "string" && Re.current;
489
+ typeof e.ref == "string" && me.current;
475
490
  }
476
491
  function tr(e, r) {
477
492
  {
478
493
  var n = function() {
479
- me || (me = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
494
+ ye || (ye = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
480
495
  };
481
496
  n.isReactWarning = !0, Object.defineProperty(e, "key", {
482
497
  get: n,
@@ -487,7 +502,7 @@ function yr() {
487
502
  function ar(e, r) {
488
503
  {
489
504
  var n = function() {
490
- be || (be = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
505
+ Ee || (Ee = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
491
506
  };
492
507
  n.isReactWarning = !0, Object.defineProperty(e, "ref", {
493
508
  get: n,
@@ -495,67 +510,67 @@ function yr() {
495
510
  });
496
511
  }
497
512
  }
498
- var or = function(e, r, n, t, s, c, u) {
499
- var o = {
513
+ var or = function(e, r, n, a, s, f, u) {
514
+ var i = {
500
515
  // This tag allows us to uniquely identify this as a React Element
501
- $$typeof: i,
516
+ $$typeof: o,
502
517
  // Built-in properties that belong on the element
503
518
  type: e,
504
519
  key: r,
505
520
  ref: n,
506
521
  props: u,
507
522
  // Record the component responsible for creating this element.
508
- _owner: c
523
+ _owner: f
509
524
  };
510
- return o._store = {}, Object.defineProperty(o._store, "validated", {
525
+ return i._store = {}, Object.defineProperty(i._store, "validated", {
511
526
  configurable: !1,
512
527
  enumerable: !1,
513
528
  writable: !0,
514
529
  value: !1
515
- }), Object.defineProperty(o, "_self", {
530
+ }), Object.defineProperty(i, "_self", {
516
531
  configurable: !1,
517
532
  enumerable: !1,
518
533
  writable: !1,
519
- value: t
520
- }), Object.defineProperty(o, "_source", {
534
+ value: a
535
+ }), Object.defineProperty(i, "_source", {
521
536
  configurable: !1,
522
537
  enumerable: !1,
523
538
  writable: !1,
524
539
  value: s
525
- }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
540
+ }), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
526
541
  };
527
- function ir(e, r, n, t, s) {
542
+ function ir(e, r, n, a, s) {
528
543
  {
529
- var c, u = {}, o = null, b = null;
530
- n !== void 0 && (he(n), o = "" + n), rr(r) && (he(r.key), o = "" + r.key), er(r) && (b = r.ref, nr(r, s));
531
- for (c in r)
532
- I.call(r, c) && !Qe.hasOwnProperty(c) && (u[c] = r[c]);
544
+ var f, u = {}, i = null, y = null;
545
+ n !== void 0 && (pe(n), i = "" + n), rr(r) && (pe(r.key), i = "" + r.key), er(r) && (y = r.ref, nr(r, s));
546
+ for (f in r)
547
+ V.call(r, f) && !Qe.hasOwnProperty(f) && (u[f] = r[f]);
533
548
  if (e && e.defaultProps) {
534
- var g = e.defaultProps;
535
- for (c in g)
536
- u[c] === void 0 && (u[c] = g[c]);
549
+ var R = e.defaultProps;
550
+ for (f in R)
551
+ u[f] === void 0 && (u[f] = R[f]);
537
552
  }
538
- if (o || b) {
539
- var p = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
540
- o && tr(u, p), b && ar(u, p);
553
+ if (i || y) {
554
+ var b = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
555
+ i && tr(u, b), y && ar(u, b);
541
556
  }
542
- return or(e, o, b, s, t, Re.current, u);
557
+ return or(e, i, y, s, a, me.current, u);
543
558
  }
544
559
  }
545
- var H = x.ReactCurrentOwner, Ee = x.ReactDebugCurrentFrame;
546
- function F(e) {
560
+ var H = x.ReactCurrentOwner, _e = x.ReactDebugCurrentFrame;
561
+ function k(e) {
547
562
  if (e) {
548
- var r = e._owner, n = N(e.type, e._source, r ? r.type : null);
549
- Ee.setExtraStackFrame(n);
563
+ var r = e._owner, n = B(e.type, e._source, r ? r.type : null);
564
+ _e.setExtraStackFrame(n);
550
565
  } else
551
- Ee.setExtraStackFrame(null);
566
+ _e.setExtraStackFrame(null);
552
567
  }
553
568
  var Z;
554
569
  Z = !1;
555
570
  function Q(e) {
556
- return typeof e == "object" && e !== null && e.$$typeof === i;
571
+ return typeof e == "object" && e !== null && e.$$typeof === o;
557
572
  }
558
- function ye() {
573
+ function Ce() {
559
574
  {
560
575
  if (H.current) {
561
576
  var e = O(H.current.type);
@@ -570,10 +585,10 @@ Check the render method of \`` + e + "`.";
570
585
  function ur(e) {
571
586
  return "";
572
587
  }
573
- var _e = {};
588
+ var Te = {};
574
589
  function lr(e) {
575
590
  {
576
- var r = ye();
591
+ var r = Ce();
577
592
  if (!r) {
578
593
  var n = typeof e == "string" ? e : e.displayName || e.name;
579
594
  n && (r = `
@@ -583,35 +598,35 @@ Check the top-level render call using <` + n + ">.");
583
598
  return r;
584
599
  }
585
600
  }
586
- function Ce(e, r) {
601
+ function Oe(e, r) {
587
602
  {
588
603
  if (!e._store || e._store.validated || e.key != null)
589
604
  return;
590
605
  e._store.validated = !0;
591
606
  var n = lr(r);
592
- if (_e[n])
607
+ if (Te[n])
593
608
  return;
594
- _e[n] = !0;
595
- var t = "";
596
- e && e._owner && e._owner !== H.current && (t = " It was passed a child from " + O(e._owner.type) + "."), F(e), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, t), F(null);
609
+ Te[n] = !0;
610
+ var a = "";
611
+ e && e._owner && e._owner !== H.current && (a = " It was passed a child from " + O(e._owner.type) + "."), k(e), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, a), k(null);
597
612
  }
598
613
  }
599
- function Te(e, r) {
614
+ function Se(e, r) {
600
615
  {
601
616
  if (typeof e != "object")
602
617
  return;
603
618
  if (X(e))
604
619
  for (var n = 0; n < e.length; n++) {
605
- var t = e[n];
606
- Q(t) && Ce(t, r);
620
+ var a = e[n];
621
+ Q(a) && Oe(a, r);
607
622
  }
608
623
  else if (Q(e))
609
624
  e._store && (e._store.validated = !0);
610
625
  else if (e) {
611
- var s = Ie(e);
626
+ var s = Ae(e);
612
627
  if (typeof s == "function" && s !== e.entries)
613
- for (var c = s.call(e), u; !(u = c.next()).done; )
614
- Q(u.value) && Ce(u.value, r);
628
+ for (var f = s.call(e), u; !(u = f.next()).done; )
629
+ Q(u.value) && Oe(u.value, r);
615
630
  }
616
631
  }
617
632
  }
@@ -623,15 +638,15 @@ Check the top-level render call using <` + n + ">.");
623
638
  var n;
624
639
  if (typeof r == "function")
625
640
  n = r.propTypes;
626
- else if (typeof r == "object" && (r.$$typeof === R || // Note: Memo only checks outer props here.
641
+ else if (typeof r == "object" && (r.$$typeof === p || // Note: Memo only checks outer props here.
627
642
  // Inner props are checked in the reconciler.
628
643
  r.$$typeof === T))
629
644
  n = r.propTypes;
630
645
  else
631
646
  return;
632
647
  if (n) {
633
- var t = O(r);
634
- ze(n, e.props, "prop", t, e);
648
+ var a = O(r);
649
+ ze(n, e.props, "prop", a, e);
635
650
  } else if (r.PropTypes !== void 0 && !Z) {
636
651
  Z = !0;
637
652
  var s = O(r);
@@ -643,80 +658,83 @@ Check the top-level render call using <` + n + ">.");
643
658
  function cr(e) {
644
659
  {
645
660
  for (var r = Object.keys(e.props), n = 0; n < r.length; n++) {
646
- var t = r[n];
647
- if (t !== "children" && t !== "key") {
648
- F(e), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", t), F(null);
661
+ var a = r[n];
662
+ if (a !== "children" && a !== "key") {
663
+ k(e), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", a), k(null);
649
664
  break;
650
665
  }
651
666
  }
652
- e.ref !== null && (F(e), m("Invalid attribute `ref` supplied to `React.Fragment`."), F(null));
667
+ e.ref !== null && (k(e), m("Invalid attribute `ref` supplied to `React.Fragment`."), k(null));
653
668
  }
654
669
  }
655
- var Oe = {};
656
- function Se(e, r, n, t, s, c) {
670
+ var we = {};
671
+ function Pe(e, r, n, a, s, f) {
657
672
  {
658
673
  var u = Le(e);
659
674
  if (!u) {
660
- var o = "";
661
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (o += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
662
- var b = ur();
663
- b ? o += b : o += ye();
664
- var g;
665
- e === null ? g = "null" : X(e) ? g = "array" : e !== void 0 && e.$$typeof === i ? (g = "<" + (O(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : g = typeof e, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", g, o);
675
+ var i = "";
676
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (i += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
677
+ var y = ur();
678
+ y ? i += y : i += Ce();
679
+ var R;
680
+ e === null ? R = "null" : X(e) ? R = "array" : e !== void 0 && e.$$typeof === o ? (R = "<" + (O(e.type) || "Unknown") + " />", i = " Did you accidentally export a JSX literal instead of a component?") : R = typeof e, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, i);
666
681
  }
667
- var p = ir(e, r, n, s, c);
668
- if (p == null)
669
- return p;
682
+ var b = ir(e, r, n, s, f);
683
+ if (b == null)
684
+ return b;
670
685
  if (u) {
671
- var _ = r.children;
672
- if (_ !== void 0)
673
- if (t)
674
- if (X(_)) {
675
- for (var k = 0; k < _.length; k++)
676
- Te(_[k], e);
677
- Object.freeze && Object.freeze(_);
686
+ var C = r.children;
687
+ if (C !== void 0)
688
+ if (a)
689
+ if (X(C)) {
690
+ for (var D = 0; D < C.length; D++)
691
+ Se(C[D], e);
692
+ Object.freeze && Object.freeze(C);
678
693
  } else
679
694
  m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
680
695
  else
681
- Te(_, e);
696
+ Se(C, e);
682
697
  }
683
- if (I.call(r, "key")) {
684
- var P = O(e), E = Object.keys(r).filter(function(hr) {
685
- return hr !== "key";
698
+ if (V.call(r, "key")) {
699
+ var P = O(e), E = Object.keys(r).filter(function(Rr) {
700
+ return Rr !== "key";
686
701
  }), ee = E.length > 0 ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}";
687
- if (!Oe[P + ee]) {
688
- var pr = E.length > 0 ? "{" + E.join(": ..., ") + ": ...}" : "{}";
702
+ if (!we[P + ee]) {
703
+ var hr = E.length > 0 ? "{" + E.join(": ..., ") + ": ...}" : "{}";
689
704
  m(`A props object containing a "key" prop is being spread into JSX:
690
705
  let props = %s;
691
706
  <%s {...props} />
692
707
  React keys must be passed directly to JSX without using spread:
693
708
  let props = %s;
694
- <%s key={someKey} {...props} />`, ee, P, pr, P), Oe[P + ee] = !0;
709
+ <%s key={someKey} {...props} />`, ee, P, hr, P), we[P + ee] = !0;
695
710
  }
696
711
  }
697
- return e === f ? cr(p) : sr(p), p;
712
+ return e === d ? cr(b) : sr(b), b;
698
713
  }
699
714
  }
700
715
  function fr(e, r, n) {
701
- return Se(e, r, n, !0);
716
+ return Pe(e, r, n, !0);
702
717
  }
703
718
  function dr(e, r, n) {
704
- return Se(e, r, n, !1);
719
+ return Pe(e, r, n, !1);
705
720
  }
706
721
  var vr = dr, gr = fr;
707
- $.Fragment = f, $.jsx = vr, $.jsxs = gr;
708
- })()), $;
722
+ U.Fragment = d, U.jsx = vr, U.jsxs = gr;
723
+ })()), U;
709
724
  }
710
725
  var xe;
711
- function _r() {
712
- return xe || (xe = 1, process.env.NODE_ENV === "production" ? J.exports = Er() : J.exports = yr()), J.exports;
726
+ function Cr() {
727
+ return xe || (xe = 1, process.env.NODE_ENV === "production" ? q.exports = Er() : q.exports = _r()), q.exports;
713
728
  }
714
- var Fe = _r();
715
- function Pr(a) {
716
- const i = De(null), l = mr(a.form, a.path, a.defaultValue), f = {
717
- onChange(d) {
718
- const { target: v } = d;
719
- v === l.boundElement && "value" in v && typeof v.value == "string" && l.setValue(v.value, {
729
+ var ke = Cr();
730
+ function Fr(t) {
731
+ const o = re(null), l = mr(t.form, t.path, {
732
+ overrideInitialValue: t.overrideInitialValue ?? !0,
733
+ defaultValue: typeof t.defaultValue == "function" ? t.defaultValue() : t.defaultValue
734
+ }), d = {
735
+ onChange(v) {
736
+ const { target: c } = v;
737
+ c === l.boundElement && "value" in c && typeof c.value == "string" && l.setValue(c.value, {
720
738
  shouldTouch: !0,
721
739
  shouldMarkDirty: !0
722
740
  });
@@ -725,31 +743,31 @@ function Pr(a) {
725
743
  l.touch();
726
744
  },
727
745
  onBlur() {
728
- (a.form.hookConfigs?.validateMode === "onBlur" || a.form.hookConfigs?.validateMode === "onChange") && a.form.controller.validateField(a.path);
746
+ (t.form.hookConfigs?.validateMode === "onBlur" || t.form.hookConfigs?.validateMode === "onChange") && t.form.controller.validateField(t.path);
729
747
  }
730
748
  };
731
- return D(() => {
732
- const { events: d } = a.form.controller;
733
- return Y(
734
- d.on("valueChanged", (v) => {
735
- v === a.path && a.form.hookConfigs?.validateMode === "onChange" && a.form.controller.validateField(v);
749
+ return I(() => {
750
+ const { events: v } = t.form.controller;
751
+ return W(
752
+ v.on("valueChanged", (c) => {
753
+ c !== t.path && !F.isDescendant(c, t.path) || t.form.hookConfigs?.validateMode === "onChange" && t.form.controller.validateField(t.path);
736
754
  })
737
755
  );
738
- }, []), D(() => (l.bindElement(i.current), () => {
739
- a.resetOnUnmount && a.form.controller.unbindField(a.path);
740
- }), []), /* @__PURE__ */ Fe.jsx(Fe.Fragment, { children: a.render({
741
- ref: i,
756
+ }, []), I(() => (l.bindElement(o.current), () => {
757
+ t.unbindOnUnmount && t.form.controller.unbindField(t.path);
758
+ }), []), /* @__PURE__ */ ke.jsx(ke.Fragment, { children: t.render({
759
+ ref: o,
742
760
  value: l.value,
743
- handlers: f,
761
+ handlers: d,
744
762
  field: l
745
763
  }) });
746
764
  }
747
765
  export {
748
- Pr as FieldRenderer,
749
- Or as useForm,
750
- wr as useFormErrorObserver,
766
+ Fr as FieldRenderer,
767
+ Sr as useForm,
768
+ Pr as useFormErrorObserver,
751
769
  mr as useFormField,
752
- Sr as useFormValuesObserver,
753
- q as useRenderControl
770
+ wr as useFormValuesObserver,
771
+ J as useRenderControl
754
772
  };
755
773
  //# sourceMappingURL=index.js.map