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