@goodie-forms/react 1.1.0-alpha → 1.1.2-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 ADDED
@@ -0,0 +1,773 @@
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
+ return () => {
5
+ for (const o of t)
6
+ o();
7
+ };
8
+ }
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
22
+ };
23
+ }
24
+ function Sr(t, o) {
25
+ const [l] = ne(() => new br(t)), d = J();
26
+ return I(() => {
27
+ const v = () => {
28
+ };
29
+ return W(
30
+ l.events.on("submissionStatusChange", () => {
31
+ d.forceRerender();
32
+ }),
33
+ o?.watchIssues ? l.events.on(
34
+ "fieldIssuesUpdated",
35
+ () => d.forceRerender()
36
+ ) : v,
37
+ o?.watchValues ? l.events.on(
38
+ "valueChanged",
39
+ () => d.forceRerender()
40
+ ) : v
41
+ );
42
+ }, [l]), {
43
+ formConfigs: t,
44
+ hookConfigs: o,
45
+ controller: l
46
+ };
47
+ }
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();
64
+ }),
65
+ g.on("fieldTouchUpdated", (h) => {
66
+ h === o && d.forceRerender();
67
+ }),
68
+ g.on("fieldDirtyUpdated", (h) => {
69
+ h === o && d.forceRerender();
70
+ }),
71
+ g.on("fieldIssuesUpdated", (h) => {
72
+ h === o && d.forceRerender();
73
+ })
74
+ );
75
+ }, []), v;
76
+ }
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();
89
+ })
90
+ );
91
+ }, []), d;
92
+ }
93
+ function yr(t, o) {
94
+ const l = {};
95
+ for (const d of t) {
96
+ const v = o(d);
97
+ (l[v] ??= []).push(d);
98
+ }
99
+ return l;
100
+ }
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();
115
+ })
116
+ );
117
+ }, []), v;
118
+ }
119
+ var q = { exports: {} }, $ = {};
120
+ var Fe;
121
+ function Er() {
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 };
131
+ }
132
+ return $.Fragment = l, $.jsx = g, $.jsxs = g, $;
133
+ }
134
+ var U = {};
135
+ var je;
136
+ function _r() {
137
+ return je || (je = 1, process.env.NODE_ENV !== "production" && (function() {
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) {
140
+ if (e === null || typeof e != "object")
141
+ return null;
142
+ var r = te && e[te] || e[Ie];
143
+ return typeof r == "function" ? r : null;
144
+ }
145
+ var x = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
146
+ function m(e) {
147
+ {
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];
150
+ Ve("error", e, n);
151
+ }
152
+ }
153
+ function Ve(e, r, n) {
154
+ {
155
+ var a = x.ReactDebugCurrentFrame, s = a.getStackAddendum();
156
+ s !== "" && (r += "%s", n = n.concat([s]));
157
+ var f = n.map(function(u) {
158
+ return String(u);
159
+ });
160
+ f.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, f);
161
+ }
162
+ }
163
+ var $e = !1, Ue = !1, We = !1, Ye = !1, Me = !1, ae;
164
+ ae = /* @__PURE__ */ Symbol.for("react.module.reference");
165
+ function Le(e) {
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
167
+ // types supported by any Flight configuration anywhere since
168
+ // we don't know which Flight build this will end up being used
169
+ // with.
170
+ e.$$typeof === ae || e.getModuleId !== void 0));
171
+ }
172
+ function Be(e, r, n) {
173
+ var a = e.displayName;
174
+ if (a)
175
+ return a;
176
+ var s = r.displayName || r.name || "";
177
+ return s !== "" ? n + "(" + s + ")" : n;
178
+ }
179
+ function oe(e) {
180
+ return e.displayName || "Context";
181
+ }
182
+ function O(e) {
183
+ if (e == null)
184
+ return null;
185
+ if (typeof e.tag == "number" && m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
186
+ return e.displayName || e.name || null;
187
+ if (typeof e == "string")
188
+ return e;
189
+ switch (e) {
190
+ case d:
191
+ return "Fragment";
192
+ case l:
193
+ return "Portal";
194
+ case c:
195
+ return "Profiler";
196
+ case v:
197
+ return "StrictMode";
198
+ case j:
199
+ return "Suspense";
200
+ case _:
201
+ return "SuspenseList";
202
+ }
203
+ if (typeof e == "object")
204
+ switch (e.$$typeof) {
205
+ case h:
206
+ var r = e;
207
+ return oe(r) + ".Consumer";
208
+ case g:
209
+ var n = e;
210
+ return oe(n._context) + ".Provider";
211
+ case p:
212
+ return Be(e, e.render, "ForwardRef");
213
+ case T:
214
+ var a = e.displayName || null;
215
+ return a !== null ? a : O(e.type) || "Memo";
216
+ case S: {
217
+ var s = e, f = s._payload, u = s._init;
218
+ try {
219
+ return O(u(f));
220
+ } catch {
221
+ return null;
222
+ }
223
+ }
224
+ }
225
+ return null;
226
+ }
227
+ var w = Object.assign, A = 0, ie, ue, le, se, ce, fe, de;
228
+ function ve() {
229
+ }
230
+ ve.__reactDisabledLog = !0;
231
+ function Ne() {
232
+ {
233
+ if (A === 0) {
234
+ ie = console.log, ue = console.info, le = console.warn, se = console.error, ce = console.group, fe = console.groupCollapsed, de = console.groupEnd;
235
+ var e = {
236
+ configurable: !0,
237
+ enumerable: !0,
238
+ value: ve,
239
+ writable: !0
240
+ };
241
+ Object.defineProperties(console, {
242
+ info: e,
243
+ log: e,
244
+ warn: e,
245
+ error: e,
246
+ group: e,
247
+ groupCollapsed: e,
248
+ groupEnd: e
249
+ });
250
+ }
251
+ A++;
252
+ }
253
+ }
254
+ function qe() {
255
+ {
256
+ if (A--, A === 0) {
257
+ var e = {
258
+ configurable: !0,
259
+ enumerable: !0,
260
+ writable: !0
261
+ };
262
+ Object.defineProperties(console, {
263
+ log: w({}, e, {
264
+ value: ie
265
+ }),
266
+ info: w({}, e, {
267
+ value: ue
268
+ }),
269
+ warn: w({}, e, {
270
+ value: le
271
+ }),
272
+ error: w({}, e, {
273
+ value: se
274
+ }),
275
+ group: w({}, e, {
276
+ value: ce
277
+ }),
278
+ groupCollapsed: w({}, e, {
279
+ value: fe
280
+ }),
281
+ groupEnd: w({}, e, {
282
+ value: de
283
+ })
284
+ });
285
+ }
286
+ A < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
287
+ }
288
+ }
289
+ var K = x.ReactCurrentDispatcher, G;
290
+ function M(e, r, n) {
291
+ {
292
+ if (G === void 0)
293
+ try {
294
+ throw Error();
295
+ } catch (s) {
296
+ var a = s.stack.trim().match(/\n( *(at )?)/);
297
+ G = a && a[1] || "";
298
+ }
299
+ return `
300
+ ` + G + e;
301
+ }
302
+ }
303
+ var z = !1, L;
304
+ {
305
+ var Je = typeof WeakMap == "function" ? WeakMap : Map;
306
+ L = new Je();
307
+ }
308
+ function ge(e, r) {
309
+ if (!e || z)
310
+ return "";
311
+ {
312
+ var n = L.get(e);
313
+ if (n !== void 0)
314
+ return n;
315
+ }
316
+ var a;
317
+ z = !0;
318
+ var s = Error.prepareStackTrace;
319
+ Error.prepareStackTrace = void 0;
320
+ var f;
321
+ f = K.current, K.current = null, Ne();
322
+ try {
323
+ if (r) {
324
+ var u = function() {
325
+ throw Error();
326
+ };
327
+ if (Object.defineProperty(u.prototype, "props", {
328
+ set: function() {
329
+ throw Error();
330
+ }
331
+ }), typeof Reflect == "object" && Reflect.construct) {
332
+ try {
333
+ Reflect.construct(u, []);
334
+ } catch (E) {
335
+ a = E;
336
+ }
337
+ Reflect.construct(e, [], u);
338
+ } else {
339
+ try {
340
+ u.call();
341
+ } catch (E) {
342
+ a = E;
343
+ }
344
+ e.call(u.prototype);
345
+ }
346
+ } else {
347
+ try {
348
+ throw Error();
349
+ } catch (E) {
350
+ a = E;
351
+ }
352
+ e();
353
+ }
354
+ } catch (E) {
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)
363
+ do
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;
368
+ }
369
+ while (R >= 1 && b >= 0);
370
+ break;
371
+ }
372
+ }
373
+ } finally {
374
+ z = !1, K.current = f, qe(), Error.prepareStackTrace = s;
375
+ }
376
+ var D = e ? e.displayName || e.name : "", P = D ? M(D) : "";
377
+ return typeof e == "function" && L.set(e, P), P;
378
+ }
379
+ function Ke(e, r, n) {
380
+ return ge(e, !1);
381
+ }
382
+ function Ge(e) {
383
+ var r = e.prototype;
384
+ return !!(r && r.isReactComponent);
385
+ }
386
+ function B(e, r, n) {
387
+ if (e == null)
388
+ return "";
389
+ if (typeof e == "function")
390
+ return ge(e, Ge(e));
391
+ if (typeof e == "string")
392
+ return M(e);
393
+ switch (e) {
394
+ case j:
395
+ return M("Suspense");
396
+ case _:
397
+ return M("SuspenseList");
398
+ }
399
+ if (typeof e == "object")
400
+ switch (e.$$typeof) {
401
+ case p:
402
+ return Ke(e.render);
403
+ case T:
404
+ return B(e.type, r, n);
405
+ case S: {
406
+ var a = e, s = a._payload, f = a._init;
407
+ try {
408
+ return B(f(s), r, n);
409
+ } catch {
410
+ }
411
+ }
412
+ }
413
+ return "";
414
+ }
415
+ var V = Object.prototype.hasOwnProperty, he = {}, Re = x.ReactDebugCurrentFrame;
416
+ function N(e) {
417
+ if (e) {
418
+ var r = e._owner, n = B(e.type, e._source, r ? r.type : null);
419
+ Re.setExtraStackFrame(n);
420
+ } else
421
+ Re.setExtraStackFrame(null);
422
+ }
423
+ function ze(e, r, n, a, s) {
424
+ {
425
+ var f = Function.call.bind(V);
426
+ for (var u in e)
427
+ if (f(e, u)) {
428
+ var i = void 0;
429
+ try {
430
+ if (typeof e[u] != "function") {
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;
433
+ }
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;
437
+ }
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));
439
+ }
440
+ }
441
+ }
442
+ var Xe = Array.isArray;
443
+ function X(e) {
444
+ return Xe(e);
445
+ }
446
+ function He(e) {
447
+ {
448
+ var r = typeof Symbol == "function" && Symbol.toStringTag, n = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
449
+ return n;
450
+ }
451
+ }
452
+ function Ze(e) {
453
+ try {
454
+ return be(e), !1;
455
+ } catch {
456
+ return !0;
457
+ }
458
+ }
459
+ function be(e) {
460
+ return "" + e;
461
+ }
462
+ function pe(e) {
463
+ if (Ze(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);
465
+ }
466
+ var me = x.ReactCurrentOwner, Qe = {
467
+ key: !0,
468
+ ref: !0,
469
+ __self: !0,
470
+ __source: !0
471
+ }, ye, Ee;
472
+ function er(e) {
473
+ if (V.call(e, "ref")) {
474
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
475
+ if (r && r.isReactWarning)
476
+ return !1;
477
+ }
478
+ return e.ref !== void 0;
479
+ }
480
+ function rr(e) {
481
+ if (V.call(e, "key")) {
482
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
483
+ if (r && r.isReactWarning)
484
+ return !1;
485
+ }
486
+ return e.key !== void 0;
487
+ }
488
+ function nr(e, r) {
489
+ typeof e.ref == "string" && me.current;
490
+ }
491
+ function tr(e, r) {
492
+ {
493
+ var n = function() {
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));
495
+ };
496
+ n.isReactWarning = !0, Object.defineProperty(e, "key", {
497
+ get: n,
498
+ configurable: !0
499
+ });
500
+ }
501
+ }
502
+ function ar(e, r) {
503
+ {
504
+ var n = function() {
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));
506
+ };
507
+ n.isReactWarning = !0, Object.defineProperty(e, "ref", {
508
+ get: n,
509
+ configurable: !0
510
+ });
511
+ }
512
+ }
513
+ var or = function(e, r, n, a, s, f, u) {
514
+ var i = {
515
+ // This tag allows us to uniquely identify this as a React Element
516
+ $$typeof: o,
517
+ // Built-in properties that belong on the element
518
+ type: e,
519
+ key: r,
520
+ ref: n,
521
+ props: u,
522
+ // Record the component responsible for creating this element.
523
+ _owner: f
524
+ };
525
+ return i._store = {}, Object.defineProperty(i._store, "validated", {
526
+ configurable: !1,
527
+ enumerable: !1,
528
+ writable: !0,
529
+ value: !1
530
+ }), Object.defineProperty(i, "_self", {
531
+ configurable: !1,
532
+ enumerable: !1,
533
+ writable: !1,
534
+ value: a
535
+ }), Object.defineProperty(i, "_source", {
536
+ configurable: !1,
537
+ enumerable: !1,
538
+ writable: !1,
539
+ value: s
540
+ }), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
541
+ };
542
+ function ir(e, r, n, a, s) {
543
+ {
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]);
548
+ if (e && e.defaultProps) {
549
+ var R = e.defaultProps;
550
+ for (f in R)
551
+ u[f] === void 0 && (u[f] = R[f]);
552
+ }
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);
556
+ }
557
+ return or(e, i, y, s, a, me.current, u);
558
+ }
559
+ }
560
+ var H = x.ReactCurrentOwner, _e = x.ReactDebugCurrentFrame;
561
+ function k(e) {
562
+ if (e) {
563
+ var r = e._owner, n = B(e.type, e._source, r ? r.type : null);
564
+ _e.setExtraStackFrame(n);
565
+ } else
566
+ _e.setExtraStackFrame(null);
567
+ }
568
+ var Z;
569
+ Z = !1;
570
+ function Q(e) {
571
+ return typeof e == "object" && e !== null && e.$$typeof === o;
572
+ }
573
+ function Ce() {
574
+ {
575
+ if (H.current) {
576
+ var e = O(H.current.type);
577
+ if (e)
578
+ return `
579
+
580
+ Check the render method of \`` + e + "`.";
581
+ }
582
+ return "";
583
+ }
584
+ }
585
+ function ur(e) {
586
+ return "";
587
+ }
588
+ var Te = {};
589
+ function lr(e) {
590
+ {
591
+ var r = Ce();
592
+ if (!r) {
593
+ var n = typeof e == "string" ? e : e.displayName || e.name;
594
+ n && (r = `
595
+
596
+ Check the top-level render call using <` + n + ">.");
597
+ }
598
+ return r;
599
+ }
600
+ }
601
+ function Oe(e, r) {
602
+ {
603
+ if (!e._store || e._store.validated || e.key != null)
604
+ return;
605
+ e._store.validated = !0;
606
+ var n = lr(r);
607
+ if (Te[n])
608
+ return;
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);
612
+ }
613
+ }
614
+ function Se(e, r) {
615
+ {
616
+ if (typeof e != "object")
617
+ return;
618
+ if (X(e))
619
+ for (var n = 0; n < e.length; n++) {
620
+ var a = e[n];
621
+ Q(a) && Oe(a, r);
622
+ }
623
+ else if (Q(e))
624
+ e._store && (e._store.validated = !0);
625
+ else if (e) {
626
+ var s = Ae(e);
627
+ if (typeof s == "function" && s !== e.entries)
628
+ for (var f = s.call(e), u; !(u = f.next()).done; )
629
+ Q(u.value) && Oe(u.value, r);
630
+ }
631
+ }
632
+ }
633
+ function sr(e) {
634
+ {
635
+ var r = e.type;
636
+ if (r == null || typeof r == "string")
637
+ return;
638
+ var n;
639
+ if (typeof r == "function")
640
+ n = r.propTypes;
641
+ else if (typeof r == "object" && (r.$$typeof === p || // Note: Memo only checks outer props here.
642
+ // Inner props are checked in the reconciler.
643
+ r.$$typeof === T))
644
+ n = r.propTypes;
645
+ else
646
+ return;
647
+ if (n) {
648
+ var a = O(r);
649
+ ze(n, e.props, "prop", a, e);
650
+ } else if (r.PropTypes !== void 0 && !Z) {
651
+ Z = !0;
652
+ var s = O(r);
653
+ m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", s || "Unknown");
654
+ }
655
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
656
+ }
657
+ }
658
+ function cr(e) {
659
+ {
660
+ for (var r = Object.keys(e.props), n = 0; n < r.length; n++) {
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);
664
+ break;
665
+ }
666
+ }
667
+ e.ref !== null && (k(e), m("Invalid attribute `ref` supplied to `React.Fragment`."), k(null));
668
+ }
669
+ }
670
+ var we = {};
671
+ function Pe(e, r, n, a, s, f) {
672
+ {
673
+ var u = Le(e);
674
+ if (!u) {
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);
681
+ }
682
+ var b = ir(e, r, n, s, f);
683
+ if (b == null)
684
+ return b;
685
+ if (u) {
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);
693
+ } else
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.");
695
+ else
696
+ Se(C, e);
697
+ }
698
+ if (V.call(r, "key")) {
699
+ var P = O(e), E = Object.keys(r).filter(function(Rr) {
700
+ return Rr !== "key";
701
+ }), ee = E.length > 0 ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}";
702
+ if (!we[P + ee]) {
703
+ var hr = E.length > 0 ? "{" + E.join(": ..., ") + ": ...}" : "{}";
704
+ m(`A props object containing a "key" prop is being spread into JSX:
705
+ let props = %s;
706
+ <%s {...props} />
707
+ React keys must be passed directly to JSX without using spread:
708
+ let props = %s;
709
+ <%s key={someKey} {...props} />`, ee, P, hr, P), we[P + ee] = !0;
710
+ }
711
+ }
712
+ return e === d ? cr(b) : sr(b), b;
713
+ }
714
+ }
715
+ function fr(e, r, n) {
716
+ return Pe(e, r, n, !0);
717
+ }
718
+ function dr(e, r, n) {
719
+ return Pe(e, r, n, !1);
720
+ }
721
+ var vr = dr, gr = fr;
722
+ U.Fragment = d, U.jsx = vr, U.jsxs = gr;
723
+ })()), U;
724
+ }
725
+ var xe;
726
+ function Cr() {
727
+ return xe || (xe = 1, process.env.NODE_ENV === "production" ? q.exports = Er() : q.exports = _r()), q.exports;
728
+ }
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, {
738
+ shouldTouch: !0,
739
+ shouldMarkDirty: !0
740
+ });
741
+ },
742
+ onFocus() {
743
+ l.touch();
744
+ },
745
+ onBlur() {
746
+ (t.form.hookConfigs?.validateMode === "onBlur" || t.form.hookConfigs?.validateMode === "onChange") && t.form.controller.validateField(t.path);
747
+ }
748
+ };
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);
754
+ })
755
+ );
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,
760
+ value: l.value,
761
+ handlers: d,
762
+ field: l
763
+ }) });
764
+ }
765
+ export {
766
+ Fr as FieldRenderer,
767
+ Sr as useForm,
768
+ Pr as useFormErrorObserver,
769
+ mr as useFormField,
770
+ wr as useFormValuesObserver,
771
+ J as useRenderControl
772
+ };
773
+ //# sourceMappingURL=index.js.map