@mateosuarezdev/react-ui 1.0.9 → 1.0.13

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,12 +1,12 @@
1
1
  import { jsx as f, jsxs as w, Fragment as Te } from "react/jsx-runtime";
2
- import { useRef as N, useEffect as j, useState as L, useSyncExternalStore as Ke, useCallback as K, useId as xe, forwardRef as H, memo as Be, useContext as ve, createContext as we } from "react";
2
+ import { useRef as N, useEffect as I, useState as D, useSyncExternalStore as Ke, useCallback as K, useId as ve, forwardRef as H, memo as Be, useContext as xe, createContext as we } from "react";
3
3
  import { createPortal as ye } from "react-dom";
4
4
  import { clsx as Ve } from "clsx";
5
5
  import { twMerge as Xe } from "tailwind-merge";
6
6
  import { atom as Ue } from "@mateosuarezdev/atoms";
7
- import { appendErrors as ke, FormProvider as Ze, useForm as Pe, useFormContext as W, Controller as R } from "react-hook-form";
7
+ import { appendErrors as ke, FormProvider as Ze, useForm as Pe, useFormContext as R, Controller as W } from "react-hook-form";
8
8
  import { validateFieldsNatively as me, toNestErrors as be } from "@hookform/resolvers";
9
- import { Check as Ne, Minus as Ye, DollarSign as qe, CheckIcon as J, EyeOffIcon as Ge, Eye as Je, XIcon as Qe, ChevronDownIcon as He, X as We, Plus as Re } from "lucide-react";
9
+ import { Check as Ne, Minus as Ye, DollarSign as qe, CheckIcon as J, EyeOffIcon as Ge, Eye as Je, XIcon as Qe, ChevronDownIcon as He, X as Re, Plus as We } from "lucide-react";
10
10
  import { AnimatePresence as et, motion as tt } from "framer-motion";
11
11
  const p = (...e) => Xe(Ve(e));
12
12
  function ae(e, n = 100) {
@@ -115,7 +115,7 @@ const Q = (e) => {
115
115
  deps: i = []
116
116
  } = {}) => {
117
117
  const l = N(null);
118
- return j(() => {
118
+ return I(() => {
119
119
  if (!l.current || !t) return;
120
120
  let s = !1;
121
121
  const a = ae(() => {
@@ -138,8 +138,8 @@ const Q = (e) => {
138
138
  enabled: r = !0,
139
139
  deps: t = []
140
140
  } = {}) => {
141
- const i = N(null), [l, s] = L(null);
142
- return j(() => {
141
+ const i = N(null), [l, s] = D(null);
142
+ return I(() => {
143
143
  if (!i.current || !r) return;
144
144
  let o = !1;
145
145
  const c = ae(() => {
@@ -195,7 +195,7 @@ const Q = (e) => {
195
195
  t
196
196
  ),
197
197
  children: /* @__PURE__ */ w(
198
- vt,
198
+ xt,
199
199
  {
200
200
  size: r === "xs" ? 16 : r === "sm" ? 20 : 24,
201
201
  fill: "none",
@@ -239,7 +239,7 @@ const pe = ae(() => {
239
239
  le.set(window.innerWidth > 1024);
240
240
  });
241
241
  typeof window < "u" && (se && (window.removeEventListener("resize", pe), se = !1), window.addEventListener("resize", pe), se = !0);
242
- const lt = () => (j(() => {
242
+ const lt = () => (I(() => {
243
243
  le.set(window.innerWidth > 1024);
244
244
  }, []), ot(le));
245
245
  function it(...e) {
@@ -290,10 +290,10 @@ const at = (e = !0, n) => {
290
290
  onOpen: o,
291
291
  onClose: a
292
292
  } = {}) => {
293
- const [c, u] = L(!1), [d, b] = L({
293
+ const [c, u] = D(!1), [d, b] = D({
294
294
  width: 192,
295
295
  height: 300
296
- }), m = N(null), g = N(null), x = N({
296
+ }), m = N(null), g = N(null), v = N({
297
297
  left: 0,
298
298
  right: 0,
299
299
  top: 0,
@@ -302,9 +302,9 @@ const at = (e = !0, n) => {
302
302
  y: 0,
303
303
  width: 0,
304
304
  height: 0
305
- }), v = N(null), A = xe(), F = K(
305
+ }), x = N(null), A = ve(), F = K(
306
306
  (E) => {
307
- const z = E ?? x.current;
307
+ const z = E ?? v.current;
308
308
  if (!z) return { x: 0, top: 0, bottom: void 0 };
309
309
  const _ = d.width, B = d.height;
310
310
  return ut({
@@ -318,18 +318,18 @@ const at = (e = !0, n) => {
318
318
  avoidCollisions: l
319
319
  });
320
320
  },
321
- [x.current, d, n, r]
321
+ [v.current, d, n, r]
322
322
  );
323
- j(() => {
324
- if (!c || !e || (v.current = document.getElementById(e), !v.current)) return;
323
+ I(() => {
324
+ if (!c || !e || (x.current = document.getElementById(e), !x.current)) return;
325
325
  c && O();
326
326
  const E = () => {
327
- v.current && (u(!1), o?.(), v.current.removeEventListener("scroll", E));
327
+ x.current && (u(!1), o?.(), x.current.removeEventListener("scroll", E));
328
328
  };
329
- return s && v.current.addEventListener("scroll", E, {
329
+ return s && x.current.addEventListener("scroll", E, {
330
330
  passive: !0
331
331
  }), () => {
332
- v.current && v.current.removeEventListener("scroll", E);
332
+ x.current && x.current.removeEventListener("scroll", E);
333
333
  };
334
334
  }, [c, e]);
335
335
  const O = () => {
@@ -340,7 +340,7 @@ const at = (e = !0, n) => {
340
340
  }, S = K(() => {
341
341
  if (!m.current) return;
342
342
  const E = m.current.getBoundingClientRect();
343
- x.current = {
343
+ v.current = {
344
344
  left: E.left,
345
345
  right: E.right,
346
346
  top: E.top,
@@ -387,25 +387,25 @@ const at = (e = !0, n) => {
387
387
  let c = 0, u = 0;
388
388
  if (o) {
389
389
  if (i === "right") {
390
- const m = e.right + l, g = e.left - n - l, x = Math.max(
390
+ const m = e.right + l, g = e.left - n - l, v = Math.max(
391
391
  0,
392
392
  m + n - (a.width - s)
393
- ), v = Math.max(0, s - g);
394
- x <= v ? (c = m, x > 0 && (c = a.width - n - s)) : (c = g, v > 0 && (c = s)), u = e.top, u + r > a.height - s && (u = a.height - r - s), u < s && (u = s);
393
+ ), x = Math.max(0, s - g);
394
+ v <= x ? (c = m, v > 0 && (c = a.width - n - s)) : (c = g, x > 0 && (c = s)), u = e.top, u + r > a.height - s && (u = a.height - r - s), u < s && (u = s);
395
395
  } else if (i === "left") {
396
- const m = e.left - n - l, g = e.right + l, x = Math.max(0, s - m), v = Math.max(
396
+ const m = e.left - n - l, g = e.right + l, v = Math.max(0, s - m), x = Math.max(
397
397
  0,
398
398
  g + n - (a.width - s)
399
399
  );
400
- x <= v ? (c = m, x > 0 && (c = s)) : (c = g, v > 0 && (c = a.width - n - s)), u = e.top, u + r > a.height - s && (u = a.height - r - s), u < s && (u = s);
400
+ v <= x ? (c = m, v > 0 && (c = s)) : (c = g, x > 0 && (c = a.width - n - s)), u = e.top, u + r > a.height - s && (u = a.height - r - s), u < s && (u = s);
401
401
  } else if (i === "bottom") {
402
402
  const m = a.height - e.bottom, g = e.top;
403
403
  m >= r + l ? u = e.bottom + l : g >= r + l ? u = e.top - r - l : (u = e.bottom + l, u = Math.min(u, a.height - r - s));
404
- const x = a.width - e.left, v = e.right;
404
+ const v = a.width - e.left, x = e.right;
405
405
  if (t === "start")
406
- c = e.left, c + n > a.width - s && (v >= n ? c = e.right - n : c = a.width - n - s);
406
+ c = e.left, c + n > a.width - s && (x >= n ? c = e.right - n : c = a.width - n - s);
407
407
  else if (t === "end")
408
- c = e.right - n, c < s && (x >= n ? c = e.left : c = s);
408
+ c = e.right - n, c < s && (v >= n ? c = e.left : c = s);
409
409
  else {
410
410
  const A = e.left + e.width / 2 - n / 2;
411
411
  A >= s && A + n <= a.width - s ? c = A : A < s ? c = s : c = a.width - n - s;
@@ -413,11 +413,11 @@ const at = (e = !0, n) => {
413
413
  } else {
414
414
  const m = e.top, g = a.height - e.bottom;
415
415
  m >= r + l ? u = e.top - r - l : g >= r + l ? u = e.bottom + l : (u = e.top - r - l, u = Math.max(s, u));
416
- const x = a.width - e.left, v = e.right;
416
+ const v = a.width - e.left, x = e.right;
417
417
  if (t === "start")
418
- c = e.left, c + n > a.width - s && (v >= n ? c = e.right - n : c = a.width - n - s);
418
+ c = e.left, c + n > a.width - s && (x >= n ? c = e.right - n : c = a.width - n - s);
419
419
  else if (t === "end")
420
- c = e.right - n, c < s && (x >= n ? c = e.left : c = s);
420
+ c = e.right - n, c < s && (v >= n ? c = e.left : c = s);
421
421
  else {
422
422
  const A = e.left + e.width / 2 - n / 2;
423
423
  A >= s && A + n <= a.width - s ? c = A : A < s ? c = s : c = a.width - n - s;
@@ -437,7 +437,7 @@ const at = (e = !0, n) => {
437
437
  };
438
438
  function ar(e) {
439
439
  const n = N(null);
440
- return j(() => {
440
+ return I(() => {
441
441
  const r = (t) => {
442
442
  n.current && !n.current.contains(t.target) && e();
443
443
  };
@@ -452,7 +452,7 @@ function cr(e, n = {}) {
452
452
  events: t = ["mousedown", "touchstart"],
453
453
  excludeRefs: i = []
454
454
  } = n, l = N(null);
455
- return j(() => {
455
+ return I(() => {
456
456
  if (!r) return;
457
457
  const s = (o) => {
458
458
  const a = o.target;
@@ -470,7 +470,7 @@ function cr(e, n = {}) {
470
470
  }, [e, r, t, i]), l;
471
471
  }
472
472
  function ft(e, n, r = !0) {
473
- j(() => {
473
+ I(() => {
474
474
  if (!r) return;
475
475
  const t = (i) => {
476
476
  e.current && !e.current.contains(i.target) && n(i);
@@ -480,6 +480,21 @@ function ft(e, n, r = !0) {
480
480
  };
481
481
  }, [e, n, r]);
482
482
  }
483
+ function ur(e, { target: n = window, event: r = "keydown", enabled: t } = {}) {
484
+ const i = N(e);
485
+ I(() => {
486
+ i.current = e;
487
+ }, [e]), I(() => {
488
+ if (!t) return;
489
+ const l = (s) => {
490
+ const o = s.key, a = i.current[o];
491
+ a && a(s);
492
+ };
493
+ return n.addEventListener(r, l), () => {
494
+ n.removeEventListener(r, l);
495
+ };
496
+ }, [n, r, t]);
497
+ }
483
498
  const dt = "relative shrink-0 select-none transition outline-none duration-200 ease-out focus:ring-border-brand-light flex items-center justify-center cursor-pointer", ht = {
484
499
  xs: "text-xs px-1 gap-x-0.5 py-1",
485
500
  sm: "text-sm px-2.5 gap-x-1 py-1.5",
@@ -532,7 +547,7 @@ const dt = "relative shrink-0 select-none transition outline-none duration-200 e
532
547
  danger: "bg-red-4 text-red-9 lg:hover:bg-red-5 focus:ring-red-9 border border-transparent",
533
548
  dangersolid: "bg-red-9 text-base-1 dark-theme:text-base-12 lg:hover:bg-red-8 focus:ring-base-6 border border-transparent",
534
549
  disabled: "bg-base-3 text-base-11 border border-transparent"
535
- }, xt = {
550
+ }, vt = {
536
551
  enabled: "",
537
552
  disabled: "opacity-75",
538
553
  loading: ""
@@ -553,8 +568,8 @@ const dt = "relative shrink-0 select-none transition outline-none duration-200 e
553
568
  type: b = "button",
554
569
  ...m
555
570
  }, g) => {
556
- const [x, v] = L(!1), A = ($) => {
557
- i === "enabled" && (d ? (v(!0), l && l($), setTimeout(() => v(!1), 1e3)) : l && l($));
571
+ const [v, x] = D(!1), A = ($) => {
572
+ i === "enabled" && (d ? (x(!0), l && l($), setTimeout(() => x(!1), 1e3)) : l && l($));
558
573
  }, { ref: F, ripple: O } = at(
559
574
  a,
560
575
  e === "contrast" || c
@@ -566,7 +581,7 @@ const dt = "relative shrink-0 select-none transition outline-none duration-200 e
566
581
  type: b,
567
582
  disabled: m.disabled ? m.disabled : i === "disabled" || i === "loading",
568
583
  onMouseDown: O,
569
- onClick: ($) => x ? null : A($),
584
+ onClick: ($) => v ? null : A($),
570
585
  className: p(
571
586
  dt,
572
587
  ht[n],
@@ -574,7 +589,7 @@ const dt = "relative shrink-0 select-none transition outline-none duration-200 e
574
589
  pt[t],
575
590
  mt[u],
576
591
  gt[e],
577
- xt[i],
592
+ vt[i],
578
593
  m.disabled && "opacity-50",
579
594
  s
580
595
  ),
@@ -585,7 +600,7 @@ const dt = "relative shrink-0 select-none transition outline-none duration-200 e
585
600
  }
586
601
  );
587
602
  ie.displayName = "Button";
588
- const ur = ({ className: e }) => /* @__PURE__ */ f("div", { className: p("w-full h-px bg-base-4", e) }), vt = ({
603
+ const fr = ({ className: e }) => /* @__PURE__ */ f("div", { className: p("w-full h-px bg-base-4", e) }), xt = ({
589
604
  children: e,
590
605
  size: n = 24,
591
606
  strokeWidth: r = 2,
@@ -757,7 +772,7 @@ function zt(e, n) {
757
772
  }
758
773
  return r;
759
774
  }
760
- function Dt(e, n, r) {
775
+ function Lt(e, n, r) {
761
776
  if (r === void 0 && (r = {}), (function(t) {
762
777
  return "_def" in t && typeof t._def == "object" && "typeName" in t._def;
763
778
  })(e)) return function(t, i, l) {
@@ -796,7 +811,7 @@ function Dt(e, n, r) {
796
811
  };
797
812
  throw new Error("Invalid input: not a Zod schema");
798
813
  }
799
- function fr({
814
+ function dr({
800
815
  methods: e,
801
816
  onSubmit: n,
802
817
  onError: r,
@@ -812,7 +827,7 @@ function fr({
812
827
  l
813
828
  ),
814
829
  onSubmit: e.handleSubmit(
815
- (s) => n(s),
830
+ (s) => n(s, e),
816
831
  (s) => {
817
832
  i && console.log(s), r?.(s);
818
833
  }
@@ -821,9 +836,9 @@ function fr({
821
836
  }
822
837
  ) });
823
838
  }
824
- function dr(e, n) {
839
+ function hr(e, n) {
825
840
  return Pe({
826
- resolver: Dt(e),
841
+ resolver: Lt(e),
827
842
  defaultValues: n
828
843
  });
829
844
  }
@@ -832,7 +847,7 @@ const G = {
832
847
  checked: "bg-brand lg:hover:bg-brand-hover text-brand-text",
833
848
  uncheckedDisabled: "bg-base-3 border-base-4",
834
849
  checkedDisabled: "bg-base-3 border-base-4 text-base-10"
835
- }, Lt = H(
850
+ }, Dt = H(
836
851
  ({
837
852
  checked: e = !1,
838
853
  onCheckedChange: n,
@@ -847,8 +862,8 @@ const G = {
847
862
  }, u) => {
848
863
  const d = () => {
849
864
  r || n?.(e === "indeterminate" ? !0 : !e);
850
- }, b = (x) => {
851
- (x.key === " " || x.key === "Enter") && (x.preventDefault(), d());
865
+ }, b = (v) => {
866
+ (v.key === " " || v.key === "Enter") && (v.preventDefault(), d());
852
867
  }, m = {
853
868
  xs: "h-3.5 w-3.5",
854
869
  sm: "h-4 w-4",
@@ -924,11 +939,11 @@ const G = {
924
939
  ] });
925
940
  }
926
941
  );
927
- Lt.displayName = "Checkbox";
928
- const Mt = {
942
+ Dt.displayName = "Checkbox";
943
+ const It = {
929
944
  solid: "bg-base-3 border border-base-4 drop-shadow-sm dark-theme:drop-shadow-none",
930
945
  outline: "border border-base-6"
931
- }, It = {
946
+ }, Mt = {
932
947
  brand: "ring-1 ring-brand",
933
948
  solid: "ring-1 ring-base-6"
934
949
  }, ze = H(
@@ -948,11 +963,11 @@ const Mt = {
948
963
  containerClassName: b,
949
964
  className: m,
950
965
  type: g = "text",
951
- value: x,
952
- ...v
966
+ value: v,
967
+ ...x
953
968
  }, A) => {
954
- const F = N(null), O = N(!1), [S, $] = L(!1), [E, z] = L(!1), _ = g === "password", B = _ && S ? "text" : c ? "number" : g, U = x !== "" && x !== null && x !== void 0;
955
- return j(() => {
969
+ const F = N(null), O = N(!1), [S, $] = D(!1), [E, z] = D(!1), _ = g === "password", B = _ && S ? "text" : c ? "number" : g, U = v !== "" && v !== null && v !== void 0;
970
+ return I(() => {
956
971
  if (!O.current) {
957
972
  O.current = !0;
958
973
  return;
@@ -971,10 +986,10 @@ const Mt = {
971
986
  {
972
987
  className: p(
973
988
  "rounded-6 transition cursor-text relative",
974
- Mt[t],
989
+ It[t],
975
990
  {
976
991
  "pt-[22px] pb-1.5": r === "floating",
977
- [It[i]]: !o && E,
992
+ [Mt[i]]: !o && E,
978
993
  "bg-red-4 text-red-9": !!o,
979
994
  "ring-1 ring-red-9": !!o && E
980
995
  },
@@ -1025,11 +1040,11 @@ const Mt = {
1025
1040
  },
1026
1041
  m
1027
1042
  ),
1028
- value: x,
1043
+ value: v,
1029
1044
  placeholder: l,
1030
1045
  onFocus: () => z(!0),
1031
1046
  onBlur: () => z(!1),
1032
- ...v
1047
+ ...x
1033
1048
  }
1034
1049
  )
1035
1050
  ]
@@ -1072,14 +1087,14 @@ const Mt = {
1072
1087
  }
1073
1088
  );
1074
1089
  ze.displayName = "Input";
1075
- const hr = ({
1090
+ const mr = ({
1076
1091
  name: e,
1077
1092
  customRead: n,
1078
1093
  customSet: r,
1079
1094
  withNullSet: t = !0,
1080
1095
  ...i
1081
1096
  }) => {
1082
- const { control: l } = W(), s = K(
1097
+ const { control: l } = R(), s = K(
1083
1098
  (a) => n ? n(a) : a === null ? Ce(a) : a,
1084
1099
  [n]
1085
1100
  ), o = K(
@@ -1087,7 +1102,7 @@ const hr = ({
1087
1102
  [r]
1088
1103
  );
1089
1104
  return l ? /* @__PURE__ */ f(
1090
- R,
1105
+ W,
1091
1106
  {
1092
1107
  name: e,
1093
1108
  control: l,
@@ -1110,7 +1125,7 @@ const hr = ({
1110
1125
  }, jt = {
1111
1126
  brand: "ring-1 ring-brand",
1112
1127
  solid: "ring-1 ring-base-6"
1113
- }, De = H(
1128
+ }, Le = H(
1114
1129
  ({
1115
1130
  label: e,
1116
1131
  labelPosition: n = "default",
@@ -1122,7 +1137,7 @@ const hr = ({
1122
1137
  rows: o = 3,
1123
1138
  ...a
1124
1139
  }, c) => {
1125
- const [u, d] = L(!1), b = s !== "" && s !== null && s !== void 0;
1140
+ const [u, d] = D(!1), b = s !== "" && s !== null && s !== void 0;
1126
1141
  return /* @__PURE__ */ w("div", { className: "relative", children: [
1127
1142
  n === "default" ? /* @__PURE__ */ f(
1128
1143
  "label",
@@ -1186,14 +1201,14 @@ const hr = ({
1186
1201
  ] });
1187
1202
  }
1188
1203
  );
1189
- De.displayName = "TextArea";
1190
- const mr = ({
1204
+ Le.displayName = "TextArea";
1205
+ const br = ({
1191
1206
  name: e,
1192
1207
  customRead: n,
1193
1208
  customSet: r,
1194
1209
  ...t
1195
1210
  }) => {
1196
- const { control: i } = W(), l = K(
1211
+ const { control: i } = R(), l = K(
1197
1212
  (o) => n ? n(o) : o === null ? Ce(o) : o,
1198
1213
  [n]
1199
1214
  ), s = K(
@@ -1201,13 +1216,13 @@ const mr = ({
1201
1216
  [r]
1202
1217
  );
1203
1218
  return i ? /* @__PURE__ */ f(
1204
- R,
1219
+ W,
1205
1220
  {
1206
1221
  name: e,
1207
1222
  control: i,
1208
1223
  render: ({ field: o, fieldState: a }) => /* @__PURE__ */ w("div", { children: [
1209
1224
  /* @__PURE__ */ f(
1210
- De,
1225
+ Le,
1211
1226
  {
1212
1227
  value: l(o.value),
1213
1228
  onChange: (c) => o.onChange(s(c.target.value)),
@@ -1235,14 +1250,14 @@ const mr = ({
1235
1250
  maxTags: a,
1236
1251
  validateTag: c
1237
1252
  }) => {
1238
- const [u, d] = L(""), [b, m] = L(!1), [g, x] = L(null), v = N(null), A = N(null), F = N([]), O = t.length > 0, S = N(
1253
+ const [u, d] = D(""), [b, m] = D(!1), [g, v] = D(null), x = N(null), A = N(null), F = N([]), O = t.length > 0, S = N(
1239
1254
  `taginput-${Math.random().toString(36).substr(2, 9)}`
1240
1255
  ).current, $ = N(
1241
1256
  `label-${Math.random().toString(36).substr(2, 9)}`
1242
1257
  ).current, E = N(
1243
1258
  `error-${Math.random().toString(36).substr(2, 9)}`
1244
1259
  ).current;
1245
- j(() => {
1260
+ I(() => {
1246
1261
  F.current = F.current.slice(0, t.length);
1247
1262
  }, [t.length]);
1248
1263
  const z = (k) => {
@@ -1250,24 +1265,24 @@ const mr = ({
1250
1265
  k.preventDefault();
1251
1266
  const C = u.trim();
1252
1267
  if (a && t.length >= a) {
1253
- x(`Maximum of ${a} tags allowed`);
1268
+ v(`Maximum of ${a} tags allowed`);
1254
1269
  return;
1255
1270
  }
1256
1271
  if (t.includes(C)) {
1257
- x("Tag already exists");
1272
+ v("Tag already exists");
1258
1273
  return;
1259
1274
  }
1260
1275
  if (c) {
1261
- const I = c(C);
1262
- if (typeof I == "string") {
1263
- x(I);
1276
+ const j = c(C);
1277
+ if (typeof j == "string") {
1278
+ v(j);
1264
1279
  return;
1265
- } else if (I === !1) {
1266
- x("Invalid tag");
1280
+ } else if (j === !1) {
1281
+ v("Invalid tag");
1267
1282
  return;
1268
1283
  }
1269
1284
  }
1270
- i([...t, C]), d(""), x(null), M(`Added tag ${C}`);
1285
+ i([...t, C]), d(""), v(null), M(`Added tag ${C}`);
1271
1286
  } else if (k.key === "Backspace" && !u && t.length > 0) {
1272
1287
  const C = t[t.length - 1];
1273
1288
  i(t.slice(0, -1)), M(`Removed tag ${C}`);
@@ -1275,19 +1290,19 @@ const mr = ({
1275
1290
  }, _ = (k, C) => {
1276
1291
  if (k.key === "Backspace" || k.key === "Delete") {
1277
1292
  k.preventDefault();
1278
- const I = t[C], Z = [...t];
1293
+ const j = t[C], Z = [...t];
1279
1294
  Z.splice(C, 1), i(Z), setTimeout(() => {
1280
- v.current && v.current.focus();
1281
- }, 0), M(`Removed tag ${I}`);
1282
- } else k.key === "ArrowRight" ? (k.preventDefault(), C < t.length - 1 ? F.current[C + 1]?.focus() : v.current?.focus()) : k.key === "ArrowLeft" && (k.preventDefault(), C > 0 && F.current[C - 1]?.focus());
1295
+ x.current && x.current.focus();
1296
+ }, 0), M(`Removed tag ${j}`);
1297
+ } else k.key === "ArrowRight" ? (k.preventDefault(), C < t.length - 1 ? F.current[C + 1]?.focus() : x.current?.focus()) : k.key === "ArrowLeft" && (k.preventDefault(), C > 0 && F.current[C - 1]?.focus());
1283
1298
  }, B = (k, C) => {
1284
- i(t.filter((I) => I !== k)), setTimeout(() => {
1285
- C < t.length - 1 ? F.current[C]?.focus() : C > 0 ? F.current[C - 1]?.focus() : v.current?.focus();
1299
+ i(t.filter((j) => j !== k)), setTimeout(() => {
1300
+ C < t.length - 1 ? F.current[C]?.focus() : C > 0 ? F.current[C - 1]?.focus() : x.current?.focus();
1286
1301
  }, 0), M(`Removed tag ${k}`);
1287
1302
  }, U = (k) => {
1288
- d(k.target.value), x(null);
1303
+ d(k.target.value), v(null);
1289
1304
  }, V = () => {
1290
- v.current && v.current.focus();
1305
+ x.current && x.current.focus();
1291
1306
  }, M = (k) => {
1292
1307
  console.log(`Accessibility announcement: ${k}`);
1293
1308
  };
@@ -1356,8 +1371,8 @@ const mr = ({
1356
1371
  t.map((k, C) => /* @__PURE__ */ w(
1357
1372
  "div",
1358
1373
  {
1359
- ref: (I) => {
1360
- F.current[C] = I;
1374
+ ref: (j) => {
1375
+ F.current[C] = j;
1361
1376
  },
1362
1377
  className: p(
1363
1378
  "line-clamp-1 text-brand rounded-full px-2 text-sm flex items-center",
@@ -1369,7 +1384,7 @@ const mr = ({
1369
1384
  tabIndex: 0,
1370
1385
  role: "button",
1371
1386
  "aria-label": `${k}, press delete or backspace to remove`,
1372
- onKeyDown: (I) => _(I, C),
1387
+ onKeyDown: (j) => _(j, C),
1373
1388
  children: [
1374
1389
  k,
1375
1390
  /* @__PURE__ */ f(
@@ -1390,7 +1405,7 @@ const mr = ({
1390
1405
  "input",
1391
1406
  {
1392
1407
  id: S,
1393
- ref: v,
1408
+ ref: x,
1394
1409
  type: "text",
1395
1410
  className: "flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm placeholder:text-secondarytext",
1396
1411
  value: u,
@@ -1425,10 +1440,10 @@ const mr = ({
1425
1440
  ),
1426
1441
  /* @__PURE__ */ f("div", { className: "sr-only", "aria-live": "polite", "aria-atomic": "true", children: t.length > 0 ? `Current tags: ${t.join(", ")}` : "No tags added yet" })
1427
1442
  ] });
1428
- }, br = ({ name: e, ...n }) => {
1429
- const { control: r } = W();
1443
+ }, pr = ({ name: e, ...n }) => {
1444
+ const { control: r } = R();
1430
1445
  return r ? /* @__PURE__ */ f(
1431
- R,
1446
+ W,
1432
1447
  {
1433
1448
  name: e,
1434
1449
  control: r,
@@ -1463,7 +1478,7 @@ const mr = ({
1463
1478
  disabled: m = !1,
1464
1479
  className: g
1465
1480
  }) => {
1466
- const [x, v] = L(""), [A, F] = L(!1), [O, S] = L(-1), $ = N(null), E = N(null), z = N([]), {
1481
+ const [v, x] = D(""), [A, F] = D(!1), [O, S] = D(-1), $ = N(null), E = N(null), z = N([]), {
1467
1482
  triggerRef: _,
1468
1483
  triggerProps: B,
1469
1484
  popoverRef: U,
@@ -1479,9 +1494,9 @@ const mr = ({
1479
1494
  F(!0), b && $.current && setTimeout(() => $.current?.focus(), 10);
1480
1495
  },
1481
1496
  onClose: () => {
1482
- F(!1), v(""), S(-1);
1497
+ F(!1), x(""), S(-1);
1483
1498
  }
1484
- }), I = N(
1499
+ }), j = N(
1485
1500
  `multiselect-${Math.random().toString(36).substr(2, 9)}`
1486
1501
  ).current, Z = N(
1487
1502
  `label-${Math.random().toString(36).substr(2, 9)}`
@@ -1490,11 +1505,11 @@ const mr = ({
1490
1505
  ).current, ee = N(
1491
1506
  `listbox-${Math.random().toString(36).substr(2, 9)}`
1492
1507
  ).current, T = o ? t.map((h) => r.find(
1493
- (D) => l(D) === h || l(D) === l(h)
1508
+ (L) => l(L) === h || l(L) === l(h)
1494
1509
  )).filter(Boolean) : t, te = T.length > 0, X = b ? r.filter(
1495
- (h) => s(h).toLowerCase().includes(x.toLowerCase())
1510
+ (h) => s(h).toLowerCase().includes(v.toLowerCase())
1496
1511
  ) : r;
1497
- j(() => {
1512
+ I(() => {
1498
1513
  z.current = z.current.slice(0, X.length);
1499
1514
  }, [X.length]);
1500
1515
  const ue = (h) => o ? t.some(
@@ -1506,13 +1521,13 @@ const mr = ({
1506
1521
  if (ue(h)) {
1507
1522
  let y;
1508
1523
  if (o) {
1509
- const D = l(h);
1524
+ const L = l(h);
1510
1525
  y = t.filter(
1511
- (P) => P !== D && l(P) !== D
1526
+ (P) => P !== L && l(P) !== L
1512
1527
  );
1513
1528
  } else
1514
1529
  y = t.filter(
1515
- (D) => l(D) !== l(h)
1530
+ (L) => l(L) !== l(h)
1516
1531
  );
1517
1532
  i(y), Y(`Removed ${s(h)}`);
1518
1533
  } else {
@@ -1527,13 +1542,13 @@ const mr = ({
1527
1542
  if (m) return;
1528
1543
  let y;
1529
1544
  if (o) {
1530
- const D = l(h);
1545
+ const L = l(h);
1531
1546
  y = t.filter(
1532
- (P) => P !== D && l(P) !== D
1547
+ (P) => P !== L && l(P) !== L
1533
1548
  );
1534
1549
  } else
1535
1550
  y = t.filter(
1536
- (D) => l(D) !== l(h)
1551
+ (L) => l(L) !== l(h)
1537
1552
  );
1538
1553
  i(y), Y(`Removed ${s(h)}`);
1539
1554
  }, he = (h) => {
@@ -1560,14 +1575,14 @@ const mr = ({
1560
1575
  }
1561
1576
  break;
1562
1577
  case "Backspace":
1563
- if (b && x === "" && T.length > 0) {
1578
+ if (b && v === "" && T.length > 0) {
1564
1579
  const y = T[T.length - 1];
1565
1580
  de(y);
1566
1581
  }
1567
1582
  break;
1568
1583
  }
1569
- }, Ie = (h) => {
1570
- v(h.target.value), S(-1);
1584
+ }, Me = (h) => {
1585
+ x(h.target.value), S(-1);
1571
1586
  }, je = () => {
1572
1587
  m || (b && $.current && $.current.focus(), k());
1573
1588
  }, Y = (h) => {
@@ -1620,7 +1635,7 @@ const mr = ({
1620
1635
  "label",
1621
1636
  {
1622
1637
  id: Z,
1623
- htmlFor: I,
1638
+ htmlFor: j,
1624
1639
  className: p(
1625
1640
  "absolute transition-all duration-200 pointer-events-none",
1626
1641
  "text-base top-4 font-semibold left-3",
@@ -1674,11 +1689,11 @@ const mr = ({
1674
1689
  "input",
1675
1690
  {
1676
1691
  ref: $,
1677
- id: I,
1692
+ id: j,
1678
1693
  type: "text",
1679
1694
  className: "flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm",
1680
- value: x,
1681
- onChange: Ie,
1695
+ value: v,
1696
+ onChange: Me,
1682
1697
  onKeyDown: he,
1683
1698
  placeholder: te ? "" : u,
1684
1699
  disabled: m,
@@ -1730,8 +1745,8 @@ const mr = ({
1730
1745
  role: "listbox",
1731
1746
  id: ee,
1732
1747
  "aria-labelledby": Z,
1733
- children: X.length === 0 ? /* @__PURE__ */ f("div", { className: "px-3 py-2 text-sm text-secondarytext", children: x ? "No results found" : "No options available" }) : X.map((h, y) => {
1734
- const D = ue(h);
1748
+ children: X.length === 0 ? /* @__PURE__ */ f("div", { className: "px-3 py-2 text-sm text-secondarytext", children: v ? "No results found" : "No options available" }) : X.map((h, y) => {
1749
+ const L = ue(h);
1735
1750
  return /* @__PURE__ */ w(
1736
1751
  "div",
1737
1752
  {
@@ -1745,16 +1760,16 @@ const mr = ({
1745
1760
  // !selected && "pl-9",
1746
1761
  {
1747
1762
  "bg-base-3 dark-theme:bg-base-4": y === O,
1748
- "bg-brandfadedbg text-brand": D
1763
+ "bg-brandfadedbg text-brand": L
1749
1764
  }
1750
1765
  ),
1751
1766
  onClick: () => fe(h),
1752
1767
  role: "option",
1753
- "aria-selected": D,
1768
+ "aria-selected": L,
1754
1769
  onMouseEnter: () => S(y),
1755
1770
  children: [
1756
1771
  /* @__PURE__ */ f("span", { children: s(h) }),
1757
- D && /* @__PURE__ */ f(J, { size: 16 })
1772
+ L && /* @__PURE__ */ f(J, { size: 16 })
1758
1773
  ]
1759
1774
  },
1760
1775
  l(h)
@@ -1773,13 +1788,13 @@ const mr = ({
1773
1788
  ),
1774
1789
  /* @__PURE__ */ f("div", { className: "sr-only", "aria-live": "polite", "aria-atomic": "true", children: T.length > 0 ? `Selected: ${T.map(s).join(", ")}` : "No selections" })
1775
1790
  ] });
1776
- }, pr = ({
1791
+ }, gr = ({
1777
1792
  name: e,
1778
1793
  ...n
1779
1794
  }) => {
1780
- const { control: r } = W();
1795
+ const { control: r } = R();
1781
1796
  return r ? /* @__PURE__ */ f(
1782
- R,
1797
+ W,
1783
1798
  {
1784
1799
  name: e,
1785
1800
  control: r,
@@ -1797,7 +1812,7 @@ const mr = ({
1797
1812
  "Form control missing for field: ",
1798
1813
  e
1799
1814
  ] }));
1800
- }, gr = ({
1815
+ }, vr = ({
1801
1816
  isEditable: e,
1802
1817
  isDeletable: n = !0,
1803
1818
  createUpdateLoading: r,
@@ -1809,7 +1824,7 @@ const mr = ({
1809
1824
  deleteText: a = "Eliminar",
1810
1825
  className: c
1811
1826
  }) => {
1812
- const [u, d] = L(!1);
1827
+ const [u, d] = D(!1);
1813
1828
  return /* @__PURE__ */ w("div", { className: `w-full grid grid-cols-2 gap-4 col-span-full ${c}`, children: [
1814
1829
  e && n ? /* @__PURE__ */ w(
1815
1830
  ie,
@@ -1820,7 +1835,7 @@ const mr = ({
1820
1835
  l ? u ? i?.() : d(!0) : i?.();
1821
1836
  },
1822
1837
  children: [
1823
- /* @__PURE__ */ f(We, { size: 18 }),
1838
+ /* @__PURE__ */ f(Re, { size: 18 }),
1824
1839
  l && u ? "Confirmar" : a
1825
1840
  ]
1826
1841
  }
@@ -1833,7 +1848,7 @@ const mr = ({
1833
1848
  state: r ? "loading" : t ? "disabled" : "enabled",
1834
1849
  type: "submit",
1835
1850
  children: [
1836
- r ? /* @__PURE__ */ f(wt, {}) : e ? /* @__PURE__ */ f(Ne, { size: 18 }) : /* @__PURE__ */ f(Re, { size: 18 }),
1851
+ r ? /* @__PURE__ */ f(wt, {}) : e ? /* @__PURE__ */ f(Ne, { size: 18 }) : /* @__PURE__ */ f(We, { size: 18 }),
1837
1852
  e ? o : s
1838
1853
  ]
1839
1854
  }
@@ -1848,7 +1863,7 @@ function xr({
1848
1863
  required: i,
1849
1864
  className: l = ""
1850
1865
  }) {
1851
- const s = xe();
1866
+ const s = ve();
1852
1867
  return /* @__PURE__ */ w(
1853
1868
  "button",
1854
1869
  {
@@ -1902,16 +1917,16 @@ function xr({
1902
1917
  }
1903
1918
  );
1904
1919
  }
1905
- const Le = we(null), Kt = ({
1920
+ const De = we(null), Kt = ({
1906
1921
  children: e,
1907
1922
  value: n
1908
- }) => /* @__PURE__ */ f(Le.Provider, { value: n, children: e }), Bt = () => {
1909
- const e = ve(Le);
1923
+ }) => /* @__PURE__ */ f(De.Provider, { value: n, children: e }), Bt = () => {
1924
+ const e = xe(De);
1910
1925
  if (!e)
1911
1926
  throw new Error("useAliveScope must be wrapped within AliveScopeProvider");
1912
1927
  return e;
1913
- }, vr = ({ children: e }) => {
1914
- const [n, r] = L({}), t = N(
1928
+ }, wr = ({ children: e }) => {
1929
+ const [n, r] = D({}), t = N(
1915
1930
  {}
1916
1931
  ), i = N(
1917
1932
  {}
@@ -1953,16 +1968,16 @@ const Le = we(null), Kt = ({
1953
1968
  ]
1954
1969
  }
1955
1970
  );
1956
- }, Me = we(
1971
+ }, Ie = we(
1957
1972
  null
1958
1973
  ), Vt = ({
1959
1974
  children: e,
1960
1975
  value: n
1961
- }) => /* @__PURE__ */ f(Me.Provider, { value: n, children: e }), Xt = Be(({ id: e, onMountCallbacks: n, onDropCallbacks: r, children: t, element: i }) => /* @__PURE__ */ f(
1976
+ }) => /* @__PURE__ */ f(Ie.Provider, { value: n, children: e }), Xt = Be(({ id: e, onMountCallbacks: n, onDropCallbacks: r, children: t, element: i }) => /* @__PURE__ */ f(
1962
1977
  Vt,
1963
1978
  {
1964
1979
  value: { keepAliveId: e, onKeepAliveMount: (o, a = { runOnFirstMount: !1 }) => {
1965
- j(() => {
1980
+ I(() => {
1966
1981
  const c = () => {
1967
1982
  if (document.getElementById(e))
1968
1983
  o(e);
@@ -1983,7 +1998,7 @@ const Le = we(null), Kt = ({
1983
1998
  };
1984
1999
  }, []);
1985
2000
  }, onKeepAliveDrop: (o) => {
1986
- j(() => (r.current[e].push(o), () => {
2001
+ I(() => (r.current[e].push(o), () => {
1987
2002
  r.current[e] = r.current[e].filter(
1988
2003
  (a) => a !== o
1989
2004
  );
@@ -1991,47 +2006,47 @@ const Le = we(null), Kt = ({
1991
2006
  } },
1992
2007
  children: ye(t, i, e)
1993
2008
  }
1994
- )), wr = () => {
1995
- const e = ve(Me);
2009
+ )), yr = () => {
2010
+ const e = xe(Ie);
1996
2011
  if (!e)
1997
2012
  throw new Error("useKeepAlive must be used within KeepAliveProvider");
1998
2013
  return e;
1999
- }, yr = ({
2014
+ }, kr = ({
2000
2015
  aliveKey: e,
2001
2016
  children: n,
2002
2017
  enabled: r = !0,
2003
2018
  ...t
2004
2019
  }) => {
2005
2020
  const i = N(null), { getPortalElement: l } = Bt();
2006
- return j(() => {
2021
+ return I(() => {
2007
2022
  const s = l(e, n, t.className);
2008
2023
  return r && i.current && i.current.replaceWith(s), () => {
2009
2024
  };
2010
2025
  }, [e, n, r, t]), /* @__PURE__ */ f("div", { ...t, ref: i, children: n });
2011
2026
  };
2012
2027
  export {
2013
- vr as AliveScope,
2028
+ wr as AliveScope,
2014
2029
  lr as Avatar,
2015
2030
  ir as AvatarsGroup,
2016
2031
  ie as Button,
2017
- Lt as Checkbox,
2032
+ Dt as Checkbox,
2018
2033
  nr as FocusTrap,
2019
- fr as Form,
2020
- hr as FormInput,
2021
- pr as FormMultiSelect,
2022
- gr as FormSubmit,
2023
- br as FormTags,
2024
- mr as FormTextArea,
2025
- vt as Icon,
2034
+ dr as Form,
2035
+ mr as FormInput,
2036
+ gr as FormMultiSelect,
2037
+ vr as FormSubmit,
2038
+ pr as FormTags,
2039
+ br as FormTextArea,
2040
+ xt as Icon,
2026
2041
  ze as Input,
2027
- yr as KeepAlive,
2042
+ kr as KeepAlive,
2028
2043
  Tt as MultiSelect,
2029
2044
  yt as Portal,
2030
- ur as Separator,
2045
+ fr as Separator,
2031
2046
  wt as Spinner,
2032
2047
  xr as Switch,
2033
2048
  _t as Tags,
2034
- De as TextArea,
2049
+ Le as TextArea,
2035
2050
  ut as calculatePopoverPosition,
2036
2051
  Q as checkOverflow,
2037
2052
  p as cn,
@@ -2047,10 +2062,11 @@ export {
2047
2062
  ar as useClickAway,
2048
2063
  cr as useClickAwayAdvanced,
2049
2064
  ft as useClickAwayWithRef,
2050
- wr as useKeepAlive,
2065
+ yr as useKeepAlive,
2066
+ ur as useKeyListener,
2051
2067
  lt as useLargeScreen,
2052
2068
  it as useMergedRef,
2053
- dr as useMethods,
2069
+ hr as useMethods,
2054
2070
  sr as useOverflow,
2055
2071
  or as useOverflowState,
2056
2072
  ct as usePopover,