suprform 1.1.3 → 1.1.4

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.
@@ -1,5 +1,5 @@
1
1
  import { jsx as ee, jsxs as dt, Fragment as Qt } from "react/jsx-runtime";
2
- import b, { createContext as Gt, useContext as zt, useMemo as he, cloneElement as Ae, useImperativeHandle as bt, useEffect as Kt, Children as Yt, isValidElement as Jt } from "react";
2
+ import b, { createContext as Gt, useContext as zt, useMemo as he, cloneElement as Ae, useImperativeHandle as bt, Children as Kt, isValidElement as Yt, useEffect as Jt } from "react";
3
3
  var ve = (t) => t.type === "checkbox", le = (t) => t instanceof Date, G = (t) => t == null;
4
4
  const At = (t) => typeof t == "object";
5
5
  var P = (t) => !G(t) && !Array.isArray(t) && At(t) && !le(t), pt = (t) => P(t) && t.target ? ve(t.target) ? t.target.checked : t.target.value : t, Xt = (t) => t.substring(0, t.search(/\.\d+(\.|$)/)) || t, xt = (t, r) => t.has(Xt(r)), Zt = (t) => {
@@ -1343,56 +1343,6 @@ const pr = ({
1343
1343
  }) => {
1344
1344
  const e = he(() => typeof r == "boolean" ? [] : (r == null ? void 0 : r.conditions.map((i) => i.name)) || [], [r]), s = Je({ name: e }), u = he(() => typeof r == "boolean" ? r : !r || (r == null ? void 0 : r.conditions.length) === 0 ? !1 : Ut(e, s, r), [r, e, s]);
1345
1345
  return Ae(t, { ...t.props, disabled: u });
1346
- }, Nt = ({
1347
- children: t,
1348
- onSubmit: r = () => {
1349
- },
1350
- onError: e = () => {
1351
- },
1352
- style: s = {},
1353
- className: u = "",
1354
- formOptions: i,
1355
- showAsterisk: c,
1356
- ref: l,
1357
- onChange: V
1358
- }) => {
1359
- const v = Fr({
1360
- mode: "onSubmit",
1361
- reValidateMode: "onChange",
1362
- shouldFocusError: !0,
1363
- ...i
1364
- });
1365
- return bt(
1366
- l,
1367
- () => ({
1368
- setValue: v.setValue,
1369
- setError: v.setError,
1370
- clearErrors: v.clearErrors,
1371
- getValues: v.getValues,
1372
- reset: v.reset,
1373
- setFocus: v.setFocus,
1374
- resetField: v.resetField,
1375
- trigger: v.trigger,
1376
- unregister: v.unregister,
1377
- watch: v.watch,
1378
- handleSubmit: v.handleSubmit
1379
- }),
1380
- [v]
1381
- ), Kt(() => {
1382
- const x = v.watch((g) => {
1383
- V == null || V(g);
1384
- });
1385
- return () => x.unsubscribe();
1386
- }, [v.watch]), /* @__PURE__ */ ee(br, { showAsterisk: c, children: /* @__PURE__ */ ee(er, { ...v, children: /* @__PURE__ */ ee(
1387
- "form",
1388
- {
1389
- noValidate: !0,
1390
- onSubmit: v.handleSubmit(r, e),
1391
- style: s,
1392
- className: u,
1393
- children: t
1394
- }
1395
- ) }) });
1396
1346
  }, et = ({
1397
1347
  children: t,
1398
1348
  name: r,
@@ -1446,7 +1396,9 @@ const pr = ({
1446
1396
  )
1447
1397
  }
1448
1398
  ) }) });
1449
- }, Sr = ({
1399
+ };
1400
+ et.displayName = "SuprFormControl";
1401
+ const Sr = ({
1450
1402
  name: t,
1451
1403
  rules: r,
1452
1404
  ref: e,
@@ -1459,9 +1411,9 @@ const pr = ({
1459
1411
  rules: r
1460
1412
  });
1461
1413
  bt(e, () => c, [c]);
1462
- const l = (V, v) => Yt.map(V, (x) => {
1414
+ const l = (V, v) => Kt.map(V, (x) => {
1463
1415
  var L, w;
1464
- if (!Jt(x))
1416
+ if (!Yt(x))
1465
1417
  return x;
1466
1418
  const g = x.props, F = x.type;
1467
1419
  if (((F == null ? void 0 : F.displayName) === "SuprFormControl" || F === et || g.name !== void 0 && typeof F != "string") && g.name !== void 0) {
@@ -1503,8 +1455,57 @@ const pr = ({
1503
1455
  x
1504
1456
  );
1505
1457
  }) });
1458
+ }, Nt = ({
1459
+ children: t,
1460
+ onSubmit: r = () => {
1461
+ },
1462
+ onError: e = () => {
1463
+ },
1464
+ style: s = {},
1465
+ className: u = "",
1466
+ formOptions: i,
1467
+ showAsterisk: c,
1468
+ ref: l,
1469
+ onChange: V
1470
+ }) => {
1471
+ const v = Fr({
1472
+ mode: "onSubmit",
1473
+ reValidateMode: "onChange",
1474
+ shouldFocusError: !0,
1475
+ ...i
1476
+ });
1477
+ return bt(
1478
+ l,
1479
+ () => ({
1480
+ setValue: v.setValue,
1481
+ setError: v.setError,
1482
+ clearErrors: v.clearErrors,
1483
+ getValues: v.getValues,
1484
+ reset: v.reset,
1485
+ setFocus: v.setFocus,
1486
+ resetField: v.resetField,
1487
+ trigger: v.trigger,
1488
+ unregister: v.unregister,
1489
+ watch: v.watch,
1490
+ handleSubmit: v.handleSubmit
1491
+ }),
1492
+ [v]
1493
+ ), Jt(() => {
1494
+ const x = v.watch((g) => {
1495
+ V == null || V(g);
1496
+ });
1497
+ return () => x.unsubscribe();
1498
+ }, [v.watch]), /* @__PURE__ */ ee(br, { showAsterisk: c, children: /* @__PURE__ */ ee(er, { ...v, children: /* @__PURE__ */ ee(
1499
+ "form",
1500
+ {
1501
+ noValidate: !0,
1502
+ onSubmit: v.handleSubmit(r, e),
1503
+ style: s,
1504
+ className: u,
1505
+ children: t
1506
+ }
1507
+ ) }) });
1506
1508
  };
1507
- et.displayName = "SuprFormControl";
1508
1509
  Nt.Control = et;
1509
1510
  Nt.ControlArray = Sr;
1510
1511
  export {