react-hook-form-next-ui 3.0.7 → 3.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +0 -2
  2. package/dist/index.js +41 -42
  3. package/package.json +18 -5
package/README.md CHANGED
@@ -120,5 +120,3 @@ const schema = yup
120
120
  export default schema
121
121
  ```
122
122
 
123
- NPM TOKEN
124
- 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
package/dist/index.js CHANGED
@@ -538,18 +538,18 @@ function A(e, n = "ISO8601", t = "device") {
538
538
  ["ss", 0]
539
539
  ]);
540
540
  let f = null, h = "";
541
- d.forEach((b) => {
542
- if (b.partName === "literal")
541
+ d.forEach((y) => {
542
+ if (y.partName === "literal")
543
543
  return;
544
- if (b.token === b.value)
544
+ if (y.token === y.value)
545
545
  return i();
546
- const q = Number(b.value);
547
- if (u.has(b.token))
548
- u.set(b.token, q);
549
- else if (b.token === "YY")
550
- u.set("YYYY", Pt(b.value));
546
+ const q = Number(y.value);
547
+ if (u.has(y.token))
548
+ u.set(y.token, q);
549
+ else if (y.token === "YY")
550
+ u.set("YYYY", Pt(y.value));
551
551
  else {
552
- const D = b.token;
552
+ const D = y.token;
553
553
  if (D.startsWith("d"))
554
554
  return;
555
555
  if (D === "D")
@@ -559,11 +559,11 @@ function A(e, n = "ISO8601", t = "device") {
559
559
  else if (D === "M")
560
560
  u.set("MM", q);
561
561
  else if (D === "a" || D === "A")
562
- f = b.value.toLowerCase() === z("am", t).toLowerCase();
562
+ f = y.value.toLowerCase() === z("am", t).toLowerCase();
563
563
  else if (D === "Z" || D === "ZZ")
564
- h = Ue(b.value, D);
564
+ h = Ue(y.value, D);
565
565
  else {
566
- const W = _e(D, t, o).indexOf(b.value);
566
+ const W = _e(D, t, o).indexOf(y.value);
567
567
  if (W !== -1)
568
568
  switch (D) {
569
569
  case "MMM":
@@ -576,13 +576,13 @@ function A(e, n = "ISO8601", t = "device") {
576
576
  });
577
577
  let p = u.get("HH") || 0;
578
578
  f === !1 ? (p += p === 12 ? 0 : 12, u.set("HH", p === 24 ? 0 : p)) : f === !0 && p === 12 && u.set("HH", 0), u.set("MM", (u.get("MM") || 1) - 1);
579
- let [w, k, M, Y, y, $] = Array.from(u.values());
579
+ let [w, k, M, Y, x, $] = Array.from(u.values());
580
580
  const N = je(/* @__PURE__ */ new Date(`${se(w)}-${L(k + 1)}-10`));
581
581
  if (N < M && s === "throw")
582
582
  throw new Error(`Invalid date ${se(w)}-${L(k + 1)}-${L(M)}`);
583
583
  M = s === "backward" ? Math.min(M, N) : M;
584
584
  const U = `${se(w)}-${L(k + 1)}-${L(M)}T${L(Y)}:${L(
585
- y
585
+ x
586
586
  )}:${L($)}${h}`, F = new Date(U);
587
587
  return isFinite(+F) ? F : i();
588
588
  }
@@ -693,27 +693,26 @@ const Bt = () => /* @__PURE__ */ c.createElement("svg", { xmlns: "http://www.w3.
693
693
  rowsPerPageOptions: h = { default: 10, options: [5, 10, 15] },
694
694
  ...p
695
695
  }) => {
696
- const [w, k] = B(""), [M, Y] = B(h.default), [y, $] = B(1), [N, U] = B(/* @__PURE__ */ new Set()), [F, b] = B(p.sortDescriptor ?? { column: "", direction: "ascending" });
696
+ const [w, k] = B(""), [M, Y] = B(h.default), [x, $] = B(1), [N, U] = B(/* @__PURE__ */ new Set()), [F, y] = B({ column: "", direction: "ascending" });
697
697
  ne(() => {
698
- const g = Math.ceil(d.length / M);
699
- y > g && $(1), U(/* @__PURE__ */ new Set());
698
+ $(1), U(/* @__PURE__ */ new Set());
700
699
  }, [d]);
701
700
  const D = !!pt(w, 500), pe = R((g) => {
702
701
  U(g);
703
- let x = [];
704
- a === "single" ? x = d.find((E) => E[u] == [...g][0]) : g === "all" ? (x = d, U(new Set(d.map((E) => E[u])))) : x = d.filter((E) => [...g].includes(E[u])), r && r(x);
702
+ let b = [];
703
+ a === "single" ? b = d.find((E) => E[u] == [...g][0]) : g === "all" ? (b = d, U(new Set(d.map((E) => E[u])))) : b = d.filter((E) => [...g].includes(E[u])), r && r(b);
705
704
  }, [r, d, a, u]), W = P(() => {
706
705
  let g = [...d];
707
706
  return D && (g = g.filter(
708
- (x) => Object.values(x).some(
707
+ (b) => Object.values(b).some(
709
708
  (E, S) => {
710
- const H = Object.keys(x)[S];
709
+ const H = Object.keys(b)[S];
711
710
  return !l.map((j) => j.key).includes(H) || E == null || !E ? !1 : E.toString().toLowerCase().includes(w.toLowerCase());
712
711
  }
713
712
  )
714
713
  )), g;
715
- }, [w, D, d, l]), _ = Math.ceil(W.length / M) || 1, re = P(() => [...W].sort((g, x) => {
716
- const E = g[F.column], S = x[F.column];
714
+ }, [w, D, d, l]), _ = Math.ceil(W.length / M) || 1, re = P(() => [...W].sort((g, b) => {
715
+ const E = g[F.column], S = b[F.column];
717
716
  let H = 0;
718
717
  if (!E && !S && (H = 0), E || (H = -1), S || (H = 1), typeof E == "number" && typeof S == "number" && (H = E - S), typeof E == "string" && typeof S == "string") {
719
718
  const O = l.find((j) => j.key === F.column);
@@ -730,36 +729,36 @@ const Bt = () => /* @__PURE__ */ c.createElement("svg", { xmlns: "http://www.w3.
730
729
  return F.direction === "descending" ? -H : H;
731
730
  }), [F, W, l]), Oe = P(() => {
732
731
  if (t) return re;
733
- const g = (y - 1) * M, x = g + M;
734
- return re.slice(g, x);
735
- }, [re, y, M, t]), Me = R(() => {
732
+ const g = (x - 1) * M, b = g + M;
733
+ return re.slice(g, b);
734
+ }, [re, x, M, t]), Me = R(() => {
736
735
  k(""), $(1);
737
736
  }, []), ve = R(() => {
738
- y < _ && $(y + 1);
739
- }, [y, _]), Ee = R(() => {
740
- y > 1 && $(y - 1);
741
- }, [y]), we = R((g) => {
737
+ x < _ && $(x + 1);
738
+ }, [x, _]), Ee = R(() => {
739
+ x > 1 && $(x - 1);
740
+ }, [x]), we = R((g) => {
742
741
  Y(Number(g.target.value)), $(1);
743
742
  }, []), ye = R((g) => {
744
743
  g ? (k(g), $(1)) : k("");
745
- }, []), ze = R((g, x) => {
746
- const E = l.find((S) => S.key === x);
744
+ }, []), ze = R((g, b) => {
745
+ const E = l.find((S) => S.key === b);
747
746
  return E.format ? /* @__PURE__ */ c.createElement("div", null, E.format({
748
- value: g[x],
747
+ value: g[b],
749
748
  row: g
750
- })) : /* @__PURE__ */ c.createElement("p", { title: g[x] }, g[x]);
749
+ })) : /* @__PURE__ */ c.createElement("p", { title: g[b] }, g[b]);
751
750
  }, [l]), Ge = P(() => /* @__PURE__ */ c.createElement("div", { className: "py-2 px-2 mt-2 flex justify-between items-center" }, /* @__PURE__ */ c.createElement("span", { className: "w-[30%] text-small text-default-400" }, [...N].length > 0 && /* @__PURE__ */ c.createElement(c.Fragment, null, [...N].length, " ", [...N].length === 1 ? "fila seleccionada" : "filas seleccionadas")), !t && /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement(
752
751
  Qe,
753
752
  {
754
753
  isCompact: !0,
755
754
  showControls: !0,
756
755
  showShadow: !0,
757
- page: y,
756
+ page: x,
758
757
  total: _,
759
758
  onChange: $,
760
759
  color: p.color
761
760
  }
762
- ), /* @__PURE__ */ c.createElement("div", { className: "hidden sm:flex w-[30%] justify-end gap-2" }, /* @__PURE__ */ c.createElement(Q, { isDisabled: _ === 1, size: "sm", variant: "flat", onPress: Ee }, "Atrás"), /* @__PURE__ */ c.createElement(Q, { isDisabled: _ === 1, size: "sm", variant: "flat", onPress: ve }, "Siguiente")))), [y, _, ve, Ee, N, p.color, t]), qe = P(() => /* @__PURE__ */ c.createElement("div", { className: "flex flex-col gap-4 relative pb-2" }, /* @__PURE__ */ c.createElement("div", { className: "flex justify-between gap-3 items-end" }, !e && /* @__PURE__ */ c.createElement(
761
+ ), /* @__PURE__ */ c.createElement("div", { className: "hidden sm:flex w-[30%] justify-end gap-2" }, /* @__PURE__ */ c.createElement(Q, { isDisabled: _ === 1, size: "sm", variant: "flat", onPress: Ee }, "Atrás"), /* @__PURE__ */ c.createElement(Q, { isDisabled: _ === 1, size: "sm", variant: "flat", onPress: ve }, "Siguiente")))), [x, _, ve, Ee, N, p.color, t]), qe = P(() => /* @__PURE__ */ c.createElement("div", { className: "flex flex-col gap-4 relative pb-2" }, /* @__PURE__ */ c.createElement("div", { className: "flex justify-between gap-3 items-end" }, !e && /* @__PURE__ */ c.createElement(
763
762
  Ze,
764
763
  {
765
764
  ...s,
@@ -803,13 +802,13 @@ const Bt = () => /* @__PURE__ */ c.createElement("svg", { xmlns: "http://www.w3.
803
802
  "aria-label": "Tabla de datos",
804
803
  isVirtualized: t,
805
804
  sortDescriptor: F,
806
- onSortChange: b,
805
+ onSortChange: y,
807
806
  selectedKeys: N,
808
807
  onSelectionChange: pe,
809
808
  selectionMode: a
810
809
  },
811
810
  /* @__PURE__ */ c.createElement(Ne, { columns: l }, (g) => /* @__PURE__ */ c.createElement(Fe, { ...g, children: void 0, key: g.key })),
812
- /* @__PURE__ */ c.createElement(Se, { emptyContent: "No hay datos.", items: Oe }, (g) => /* @__PURE__ */ c.createElement(Ie, { key: g[u] }, (x) => /* @__PURE__ */ c.createElement(Pe, { className: m }, ze(g, x))))
811
+ /* @__PURE__ */ c.createElement(Se, { emptyContent: "No hay datos.", items: Oe }, (g) => /* @__PURE__ */ c.createElement(Ie, { key: g[u] }, (b) => /* @__PURE__ */ c.createElement(Pe, { className: m }, ze(g, b))))
813
812
  ), Ge));
814
813
  }, Kt = ({ children: e, title: n, color: t = "primary" }) => /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement("header", { className: `bg-${t} w-full text-center text-white py-5` }, /* @__PURE__ */ c.createElement("h1", { className: "font-bold text-lg" }, n)), /* @__PURE__ */ c.createElement(He, null), /* @__PURE__ */ c.createElement("main", { className: "p-5 2xl:px-16 2xl:py-5 mx-auto" }, e)), Ut = () => /* @__PURE__ */ c.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "size-6" }, /* @__PURE__ */ c.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m4.5 18.75 7.5-7.5 7.5 7.5" }), /* @__PURE__ */ c.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m4.5 12.75 7.5-7.5 7.5 7.5" })), Wt = () => /* @__PURE__ */ c.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "size-6" }, /* @__PURE__ */ c.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m4.5 5.25 7.5 7.5 7.5-7.5m-15 6 7.5 7.5 7.5-7.5" })), en = ({ title: e, color: n = "default", children: t, collapse: r = !1 }) => {
815
814
  const [a, s] = B(!0);
@@ -954,13 +953,13 @@ const Bt = () => /* @__PURE__ */ c.createElement("svg", { xmlns: "http://www.w3.
954
953
  [n, i, h]
955
954
  ), w = R((M) => {
956
955
  setTimeout(() => {
957
- const Y = new Set(M), y = new Set(a), $ = Y.has("all");
956
+ const Y = new Set(M), x = new Set(a), $ = Y.has("all");
958
957
  let N = M;
959
958
  if ($ && h)
960
959
  if (Y.size - 1 === n.length)
961
960
  f(e, ""), N = /* @__PURE__ */ new Set();
962
961
  else {
963
- const F = n.filter((b) => !y.has(b.key)).map((b) => b.key);
962
+ const F = n.filter((y) => !x.has(y.key)).map((y) => y.key);
964
963
  f(e, F.toString()), N = new Set(F);
965
964
  }
966
965
  m == null || m(N);
@@ -974,7 +973,7 @@ const Bt = () => /* @__PURE__ */ c.createElement("svg", { xmlns: "http://www.w3.
974
973
  name: e,
975
974
  defaultValue: (r == null ? void 0 : r.toString()) ?? void 0,
976
975
  render: ({ field: M, formState: { errors: Y } }) => {
977
- var y;
976
+ var x;
978
977
  return /* @__PURE__ */ c.createElement(
979
978
  nt,
980
979
  {
@@ -982,7 +981,7 @@ const Bt = () => /* @__PURE__ */ c.createElement("svg", { xmlns: "http://www.w3.
982
981
  ...M,
983
982
  items: p,
984
983
  selectedKeys: M.value ? M.value.split(",") : [],
985
- errorMessage: ((y = Y[e]) == null ? void 0 : y.message) || "",
984
+ errorMessage: ((x = Y[e]) == null ? void 0 : x.message) || "",
986
985
  selectionMode: d,
987
986
  onSelectionChange: ($) => w($),
988
987
  isInvalid: !!Y[e],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-hook-form-next-ui",
3
3
  "type": "module",
4
- "version": "3.0.7",
4
+ "version": "3.0.50",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
7
7
  "keywords": [
@@ -32,7 +32,9 @@
32
32
  "dev": "vite",
33
33
  "build": "tsc -b && vite build",
34
34
  "lint": "eslint .",
35
- "preview": "vite preview"
35
+ "preview": "vite preview",
36
+ "storybook": "storybook dev -p 6006",
37
+ "build-storybook": "storybook build"
36
38
  },
37
39
  "peerDependencies": {
38
40
  "@heroui/react": ">=2.6.7",
@@ -43,12 +45,20 @@
43
45
  "yup": ">=1.0.0"
44
46
  },
45
47
  "devDependencies": {
48
+ "@chromatic-com/storybook": "^3.2.2",
46
49
  "@eslint/js": "^9.9.0",
47
50
  "@faker-js/faker": "^9.3.0",
48
51
  "@formkit/tempo": "^0.1.2",
49
52
  "@heroui/react": "^2.6.14",
50
53
  "@hookform/devtools": "^4.3.1",
51
- "@hookform/resolvers": "^4.1.3",
54
+ "@hookform/resolvers": "^4.1.3",
55
+ "@storybook/addon-essentials": "^8.4.7",
56
+ "@storybook/addon-interactions": "^8.4.7",
57
+ "@storybook/addon-onboarding": "^8.4.7",
58
+ "@storybook/blocks": "^8.4.0",
59
+ "@storybook/react": "^8.4.0",
60
+ "@storybook/react-vite": "^8.4.7",
61
+ "@storybook/test": "^8.4.0",
52
62
  "@types/node": "^22.10.1",
53
63
  "@types/react": "^19.0.1",
54
64
  "@types/react-dom": "^19.0.2",
@@ -63,6 +73,7 @@
63
73
  "react": "^19.0.0",
64
74
  "react-dom": "^19.0.0",
65
75
  "react-hook-form": "^7.54.0",
76
+ "storybook": "^8.4.7",
66
77
  "tailwindcss": "^3.4.16",
67
78
  "typescript": "^5.7.2",
68
79
  "typescript-eslint": "^8.18.0",
@@ -72,9 +83,11 @@
72
83
  "yup": "^1.5.0"
73
84
  },
74
85
  "eslintConfig": {
75
- "extends": []
86
+ "extends": [
87
+ "plugin:storybook/recommended"
88
+ ]
76
89
  },
77
90
  "dependencies": {
78
91
  "globals": "^16.0.0"
79
92
  }
80
- }
93
+ }