@dimasbaguspm/versaur 0.0.33 → 0.0.34

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,6 +1,7 @@
1
1
  import { c as cva, j as jsxRuntimeExports, a as cn } from "./index-DOdDlCoL.js";
2
2
  import * as React from "react";
3
3
  import React__default, { forwardRef, useState, useEffect, useCallback, useRef, useId, cloneElement, createContext, useContext } from "react";
4
+ import ReactDOM from "react-dom";
4
5
  import { EllipsisVerticalIcon, X, XIcon, ImageOff } from "lucide-react";
5
6
  import { S as Skeleton } from "./skeleton-BNZyaRjo.js";
6
7
  const alertVariants = cva(
@@ -148,10 +149,10 @@ const alertVariants = cva(
148
149
  className: s,
149
150
  children: i,
150
151
  ...o
151
- }, a) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
152
+ }, n) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
152
153
  "div",
153
154
  {
154
- ref: a,
155
+ ref: n,
155
156
  role: "alert",
156
157
  className: cn(alertVariants({ variant: e, color: t }), s),
157
158
  ...o,
@@ -228,16 +229,16 @@ const alertVariants = cva(
228
229
  fontSize: s = "base",
229
230
  fontWeight: i = "medium",
230
231
  quiet: o = !1,
231
- ...a
232
- }, n) => /* @__PURE__ */ jsxRuntimeExports.jsx(
232
+ ...n
233
+ }, a) => /* @__PURE__ */ jsxRuntimeExports.jsx(
233
234
  "a",
234
235
  {
235
- ref: n,
236
+ ref: a,
236
237
  className: cn(
237
238
  anchorVariants({ color: r, fontSize: s, fontWeight: i, quiet: o }),
238
239
  t
239
240
  ),
240
- ...a,
241
+ ...n,
241
242
  children: e
242
243
  }
243
244
  )
@@ -318,15 +319,15 @@ const alertVariants = cva(
318
319
  isCapitalize: s = !1,
319
320
  align: i = "left",
320
321
  italic: o = !1,
321
- clamp: a = "none",
322
- ellipsis: n = !1,
322
+ clamp: n = "none",
323
+ ellipsis: a = !1,
323
324
  fontSize: l,
324
- fontWeight: c,
325
- className: u,
326
- children: g,
325
+ fontWeight: u,
326
+ className: c,
327
+ children: f,
327
328
  ...d
328
- }, m) => {
329
- const w = [
329
+ }, b) => {
330
+ const h = [
330
331
  "h1",
331
332
  "h2",
332
333
  "h3",
@@ -336,11 +337,11 @@ const alertVariants = cva(
336
337
  "p",
337
338
  "span",
338
339
  "label"
339
- ].includes(e) ? e : "span", p = l ? `text-${l}` : "", v = c ? `font-${c}` : "";
340
+ ].includes(e) ? e : "span", y = l ? `text-${l}` : "", v = u ? `font-${u}` : "";
340
341
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
341
342
  e,
342
343
  {
343
- ref: m,
344
+ ref: b,
344
345
  className: cn(
345
346
  textVariants({
346
347
  color: t,
@@ -348,17 +349,17 @@ const alertVariants = cva(
348
349
  isCapitalize: s,
349
350
  align: i,
350
351
  italic: o,
351
- clamp: a,
352
- ellipsis: n,
352
+ clamp: n,
353
+ ellipsis: a,
353
354
  // @ts-expect-error - `as` is not a valid variant
354
- as: w
355
+ as: h
355
356
  }),
356
- p,
357
+ y,
357
358
  v,
358
- u
359
+ c
359
360
  ),
360
361
  ...d,
361
- children: g
362
+ children: f
362
363
  }
363
364
  );
364
365
  }
@@ -440,17 +441,17 @@ function getGridCols(e = 4) {
440
441
  return "grid-cols-4";
441
442
  }
442
443
  }
443
- const AttributeListItem = forwardRef(function({ children: t, className: r, span: s = 1, title: i, ...o }, a) {
444
- const n = getColSpan(s);
445
- return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { ref: a, className: cn(n, r), ...o, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Attribute, { title: i, children: t }) });
444
+ const AttributeListItem = forwardRef(function({ children: t, className: r, span: s = 1, title: i, ...o }, n) {
445
+ const a = getColSpan(s);
446
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { ref: n, className: cn(a, r), ...o, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Attribute, { title: i, children: t }) });
446
447
  }), AttributeListRoot = forwardRef(
447
448
  function({ children: t, className: r, columns: s = 4, ...i }, o) {
448
- const a = getGridCols(s);
449
+ const n = getGridCols(s);
449
450
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
450
451
  "ul",
451
452
  {
452
453
  ref: o,
453
- className: cn("grid gap-4", a, r),
454
+ className: cn("grid gap-4", n, r),
454
455
  ...i,
455
456
  children: t
456
457
  }
@@ -504,10 +505,10 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
504
505
  className: s,
505
506
  children: i,
506
507
  ...o
507
- }, a) => /* @__PURE__ */ jsxRuntimeExports.jsx(
508
+ }, n) => /* @__PURE__ */ jsxRuntimeExports.jsx(
508
509
  "div",
509
510
  {
510
- ref: a,
511
+ ref: n,
511
512
  className: cn(avatarVariants({ variant: e, size: t, shape: r }), s),
512
513
  ...o,
513
514
  children: i
@@ -515,17 +516,17 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
515
516
  )
516
517
  ), AvatarImage = forwardRef(
517
518
  ({ src: e, alt: t, className: r, onError: s, ...i }, o) => {
518
- const [a, n] = useState(!1);
519
+ const [n, a] = useState(!1);
519
520
  useEffect(() => {
520
- n(!1);
521
+ a(!1);
521
522
  }, [e]);
522
523
  const l = useCallback(
523
- (c) => {
524
- n(!0), s?.(c);
524
+ (u) => {
525
+ a(!0), s?.(u);
525
526
  },
526
527
  [s]
527
528
  );
528
- return a ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
529
+ return n ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
529
530
  "img",
530
531
  {
531
532
  ref: o,
@@ -703,15 +704,15 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
703
704
  size: s = "md",
704
705
  iconLeft: i,
705
706
  iconRight: o,
706
- className: a,
707
- children: n,
707
+ className: n,
708
+ children: a,
708
709
  ...l
709
- }, c) => {
710
- const d = !(n != null && n !== "") && !!(i || o);
710
+ }, u) => {
711
+ const d = !(a != null && a !== "") && !!(i || o);
711
712
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
712
713
  "span",
713
714
  {
714
- ref: c,
715
+ ref: u,
715
716
  className: cn(
716
717
  badgeVariants({
717
718
  variant: e,
@@ -720,7 +721,7 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
720
721
  size: s,
721
722
  iconOnly: d
722
723
  }),
723
- a
724
+ n
724
725
  ),
725
726
  ...l,
726
727
  children: d ? (
@@ -730,7 +731,7 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
730
731
  // Normal mode: display icon(s) and text
731
732
  /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
732
733
  i,
733
- n,
734
+ a,
734
735
  o
735
736
  ] })
736
737
  )
@@ -833,8 +834,8 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
833
834
  size: s = "md",
834
835
  disabled: i = !1,
835
836
  type: o = "button",
836
- children: a,
837
- ...n
837
+ children: n,
838
+ ...a
838
839
  }, l) {
839
840
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
840
841
  "button",
@@ -845,13 +846,21 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
845
846
  disabled: i,
846
847
  "aria-disabled": i,
847
848
  inert: i ? !0 : void 0,
848
- ...n,
849
- children: a
849
+ ...a,
850
+ children: n
850
851
  }
851
852
  );
852
853
  }
853
- ), menuVariants = cva(
854
- "absolute z-70 min-w-40 bg-background rounded-lg border border-border transition-all duration-200 ease-out will-change-transform shadow-lg",
854
+ ), OverlayPortal = ({
855
+ container: e,
856
+ children: t
857
+ }) => {
858
+ if (typeof window > "u" || typeof document > "u")
859
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: t });
860
+ const r = e ?? document.body;
861
+ return r ? ReactDOM.createPortal(t, r) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: t });
862
+ }, menuVariants = cva(
863
+ "z-70 min-w-40 bg-background rounded-lg border border-border transition-all duration-200 ease-out will-change-transform shadow-lg",
855
864
  {
856
865
  variants: {
857
866
  size: {
@@ -878,73 +887,86 @@ function useMenuOutsideClick(e, t, r, s) {
878
887
  return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
879
888
  }, [e, s, t, r]);
880
889
  }
881
- function useMenuEscapeClose(e, t) {
882
- useEffect(() => {
883
- if (!e) return;
884
- const r = (s) => {
885
- s.key === "Escape" && t();
886
- };
887
- return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
888
- }, [e, t]);
889
- }
890
890
  function useMenuPosition(e, t, r, s = "bottom-start", i) {
891
- const [o, a] = useState({});
891
+ const [o, n] = useState({ isReady: !1 });
892
892
  return useEffect(() => {
893
- if (!e || !t.current || !r.current) {
894
- a({});
893
+ if (!e || !t.current) {
894
+ n({ isReady: !1 });
895
895
  return;
896
896
  }
897
- const n = t.current, l = r.current, c = i || document.documentElement, u = n.getBoundingClientRect(), g = c.getBoundingClientRect(), d = l.style.visibility, m = l.style.position;
898
- l.style.visibility = "hidden", l.style.position = "absolute";
899
- const h = l.getBoundingClientRect();
900
- l.style.visibility = d, l.style.position = m;
901
- const w = g.bottom - u.bottom - 8, p = u.top - g.top - 8, v = g.right - u.left - 8, y = u.right - g.left - 8;
902
- let b = s;
903
- s === "auto" && (w >= h.height && v >= h.width ? b = "bottom-start" : w >= h.height && y >= h.width ? b = "bottom-end" : p >= h.height && v >= h.width ? b = "top-start" : p >= h.height && y >= h.width ? b = "top-end" : b = w >= p ? "bottom-start" : "top-start");
904
- const f = {};
905
- switch (b) {
906
- case "bottom-start":
907
- f.top = u.height + 4, f.left = 0;
908
- break;
909
- case "bottom-end":
910
- f.top = u.height + 4, f.right = 0;
911
- break;
912
- case "top-start":
913
- f.bottom = u.height + 4, f.left = 0;
914
- break;
915
- case "top-end":
916
- f.bottom = u.height + 4, f.right = 0;
917
- break;
897
+ if (!r.current) {
898
+ const w = setTimeout(() => {
899
+ n({ isReady: !1 });
900
+ }, 0);
901
+ return () => clearTimeout(w);
918
902
  }
903
+ const a = t.current, l = r.current, u = i || document.documentElement, c = a.getBoundingClientRect(), f = u.getBoundingClientRect(), d = l.style.visibility, b = l.style.position, p = l.style.opacity;
904
+ l.style.visibility = "hidden", l.style.position = "absolute", l.style.opacity = "0";
905
+ const h = l.getBoundingClientRect();
906
+ l.style.visibility = d, l.style.position = b, l.style.opacity = p;
907
+ const y = f.bottom - c.bottom - 8, v = c.top - f.top - 8, R = f.right - c.left - 8, j = c.right - f.left - 8;
908
+ let x = s;
909
+ s === "auto" && (y >= h.height && R >= h.width ? x = "bottom-start" : y >= h.height && j >= h.width ? x = "bottom-end" : v >= h.height && R >= h.width ? x = "top-start" : v >= h.height && j >= h.width ? x = "top-end" : x = y >= v ? "bottom-start" : "top-start");
910
+ const g = {};
911
+ if (i)
912
+ switch (g.position = "fixed", x) {
913
+ case "bottom-start":
914
+ g.top = c.bottom + 4, g.left = c.left;
915
+ break;
916
+ case "bottom-end":
917
+ g.top = c.bottom + 4, g.right = window.innerWidth - c.right;
918
+ break;
919
+ case "top-start":
920
+ g.bottom = window.innerHeight - c.top + 4, g.left = c.left;
921
+ break;
922
+ case "top-end":
923
+ g.bottom = window.innerHeight - c.top + 4, g.right = window.innerWidth - c.right;
924
+ break;
925
+ }
926
+ else
927
+ switch (g.position = "absolute", x) {
928
+ case "bottom-start":
929
+ g.top = c.height + 4, g.left = 0;
930
+ break;
931
+ case "bottom-end":
932
+ g.top = c.height + 4, g.right = 0;
933
+ break;
934
+ case "top-start":
935
+ g.bottom = c.height + 4, g.left = 0;
936
+ break;
937
+ case "top-end":
938
+ g.bottom = c.height + 4, g.right = 0;
939
+ break;
940
+ }
919
941
  if (i) {
920
- const R = {
921
- top: b.startsWith("bottom") ? u.bottom + 4 : u.top - h.height - 4,
922
- left: b.endsWith("start") ? u.left : u.right - h.width,
942
+ const w = {
943
+ top: x.startsWith("bottom") ? c.bottom + 4 : c.top - h.height - 4,
944
+ left: x.endsWith("start") ? c.left : c.right - h.width,
923
945
  width: h.width,
924
946
  height: h.height
925
947
  };
926
- if (R.left < g.left + 8) {
927
- const x = g.left + 8 - R.left;
928
- b.endsWith("start") ? f.left = (f.left || 0) + x : f.right = (f.right || 0) - x;
929
- } else if (R.left + R.width > g.right - 8) {
930
- const x = R.left + R.width - (g.right - 8);
931
- b.endsWith("start") ? f.left = (f.left || 0) - x : f.right = (f.right || 0) + x;
948
+ if (w.left < f.left + 8) {
949
+ const m = f.left + 8 - w.left;
950
+ x.endsWith("start") ? g.left = (g.left || 0) + m : g.right = (g.right || 0) - m;
951
+ } else if (w.left + w.width > f.right - 8) {
952
+ const m = w.left + w.width - (f.right - 8);
953
+ x.endsWith("start") ? g.left = (g.left || 0) - m : g.right = (g.right || 0) + m;
932
954
  }
933
- if (b.startsWith("bottom")) {
934
- const x = Math.max(
955
+ if (x.startsWith("bottom")) {
956
+ const m = Math.max(
935
957
  50,
936
- g.bottom - u.bottom - 16
958
+ f.bottom - c.bottom - 16
937
959
  );
938
- h.height > x && (f.maxHeight = x);
960
+ h.height > m && (g.maxHeight = m);
939
961
  } else {
940
- const x = Math.max(
962
+ const m = Math.max(
941
963
  50,
942
- u.top - g.top - 16
964
+ c.top - f.top - 16
943
965
  );
944
- h.height > x && (f.maxHeight = x);
966
+ h.height > m && (g.maxHeight = m);
945
967
  }
946
968
  }
947
- a(f);
969
+ g.isReady = !0, n(g);
948
970
  }, [e, s, i, t, r]), o;
949
971
  }
950
972
  const MenuContent = forwardRef(
@@ -959,48 +981,81 @@ const MenuContent = forwardRef(
959
981
  children: e
960
982
  }
961
983
  ) })
962
- ), MenuRoot = ({
984
+ );
985
+ function useEscapeClose(e, t, r) {
986
+ const s = useRef(null);
987
+ return useEffect(() => {
988
+ s.current && s.current.focus();
989
+ }, []), useEffect(() => {
990
+ const i = (o) => {
991
+ o.key === "Escape" && e && s.current && s.current.contains(document.activeElement) && !r && t();
992
+ };
993
+ return e && (document.addEventListener("keydown", i), document.body.style.overflow = "hidden"), () => {
994
+ document.removeEventListener("keydown", i), document.body.style.overflow = "unset";
995
+ };
996
+ }, [e, t, r, s]), s;
997
+ }
998
+ const MenuRoot = ({
963
999
  isOpen: e,
964
1000
  onOutsideClick: t,
965
1001
  size: r = "md",
966
1002
  content: s,
967
1003
  children: i,
968
1004
  placement: o = "bottom-start",
969
- container: a
1005
+ container: n
970
1006
  }) => {
971
- const n = useRef(null), l = useRef(null), c = useId();
972
- useMenuOutsideClick(e, l, n, t), useMenuEscapeClose(e, t);
973
- const u = useMenuPosition(
1007
+ const a = useRef(null), l = useRef(null), u = useId();
1008
+ useMenuOutsideClick(e, l, a, t), useEscapeClose(e, t);
1009
+ const c = useMenuPosition(
974
1010
  e,
975
- n,
1011
+ a,
976
1012
  l,
977
1013
  o,
978
- a
979
- ), g = {
980
- ...u,
981
- overflowY: u.maxHeight ? "auto" : void 0,
982
- overflowX: u.maxWidth ? "auto" : void 0
983
- };
1014
+ n
1015
+ ), f = {
1016
+ ...c,
1017
+ position: c.position || "absolute",
1018
+ overflowY: c.maxHeight ? "auto" : void 0,
1019
+ overflowX: c.maxWidth ? "auto" : void 0
1020
+ }, d = e && c.isReady, b = /* @__PURE__ */ jsxRuntimeExports.jsx(
1021
+ "div",
1022
+ {
1023
+ id: u,
1024
+ ref: l,
1025
+ className: cn(menuVariants({ size: r, open: d })),
1026
+ style: f,
1027
+ role: "menu",
1028
+ "aria-hidden": !d,
1029
+ children: s
1030
+ }
1031
+ );
984
1032
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative w-fit", children: [
985
1033
  cloneElement(i, {
986
1034
  // @ts-expect-error: ref is valid for button or forwardRef components
987
- ref: n,
1035
+ ref: a,
988
1036
  "aria-haspopup": "menu",
989
1037
  "aria-expanded": e,
990
- "aria-controls": c
1038
+ "aria-controls": u
991
1039
  }),
992
- e && /* @__PURE__ */ jsxRuntimeExports.jsx(
993
- "div",
994
- {
995
- id: c,
996
- ref: l,
997
- className: cn(menuVariants({ size: r, open: e })),
998
- style: g,
999
- role: "menu",
1000
- "aria-hidden": !e,
1001
- children: s
1002
- }
1003
- )
1040
+ e && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1041
+ !c.isReady && /* @__PURE__ */ jsxRuntimeExports.jsx(
1042
+ "div",
1043
+ {
1044
+ ref: l,
1045
+ className: cn(menuVariants({ size: r, open: !1 })),
1046
+ style: {
1047
+ position: "absolute",
1048
+ visibility: "hidden",
1049
+ opacity: 0,
1050
+ pointerEvents: "none"
1051
+ },
1052
+ role: "menu",
1053
+ "aria-hidden": !0,
1054
+ children: s
1055
+ }
1056
+ ),
1057
+ c.isReady && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: c.position === "fixed" ? /* @__PURE__ */ jsxRuntimeExports.jsx(OverlayPortal, { children: b }) : b })
1058
+ ] })
1004
1059
  ] });
1005
1060
  }, Menu = Object.assign(MenuRoot, {
1006
1061
  Content: MenuContent,
@@ -1123,11 +1178,11 @@ const buttonIconVariants = cva(
1123
1178
  size: "md",
1124
1179
  color: "primary"
1125
1180
  }
1126
- }), Icon = React__default.forwardRef(function({ as: t, color: r = "primary", size: s = "md", className: i, ...o }, a) {
1181
+ }), Icon = React__default.forwardRef(function({ as: t, color: r = "primary", size: s = "md", className: i, ...o }, n) {
1127
1182
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1128
1183
  t,
1129
1184
  {
1130
- ref: a,
1185
+ ref: n,
1131
1186
  className: iconVariants({ color: r, size: s, className: i }),
1132
1187
  ...o
1133
1188
  }
@@ -1139,14 +1194,14 @@ const buttonIconVariants = cva(
1139
1194
  size: s = "md",
1140
1195
  shape: i = "rounded",
1141
1196
  disabled: o = !1,
1142
- as: a,
1143
- "aria-label": n,
1197
+ as: n,
1198
+ "aria-label": a,
1144
1199
  ...l
1145
- }, c) {
1200
+ }, u) {
1146
1201
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1147
1202
  "button",
1148
1203
  {
1149
- ref: c,
1204
+ ref: u,
1150
1205
  type: "button",
1151
1206
  className: cn(
1152
1207
  buttonIconVariants({
@@ -1158,13 +1213,13 @@ const buttonIconVariants = cva(
1158
1213
  ),
1159
1214
  disabled: o,
1160
1215
  "aria-disabled": o,
1161
- "aria-label": n,
1216
+ "aria-label": a,
1162
1217
  inert: o ? !0 : void 0,
1163
1218
  ...l,
1164
1219
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1165
1220
  Icon,
1166
1221
  {
1167
- as: a,
1222
+ as: n,
1168
1223
  size: "sm",
1169
1224
  color: getIconColorFromVariant(r)
1170
1225
  }
@@ -1179,24 +1234,28 @@ const buttonIconVariants = cva(
1179
1234
  children: s,
1180
1235
  onOpenChange: i,
1181
1236
  onClick: o,
1182
- ...a
1183
- } = e ?? {}, [n, l] = useState(!1);
1237
+ placement: n = "bottom-start",
1238
+ container: a,
1239
+ ...l
1240
+ } = e ?? {}, [u, c] = useState(!1);
1184
1241
  useEffect(() => {
1185
- i?.(n);
1186
- }, [n, i]);
1187
- const c = () => {
1188
- l(!1);
1189
- }, u = (g) => {
1190
- l((d) => !d), o?.(g);
1242
+ i?.(u);
1243
+ }, [u, i]);
1244
+ const f = () => {
1245
+ c(!1);
1246
+ }, d = (b) => {
1247
+ c((p) => !p), o?.(b);
1191
1248
  };
1192
1249
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1193
1250
  Menu,
1194
1251
  {
1195
- isOpen: n,
1196
- onOutsideClick: c,
1252
+ isOpen: u,
1253
+ onOutsideClick: f,
1197
1254
  size: "md",
1255
+ placement: n,
1256
+ container: a,
1198
1257
  content: /* @__PURE__ */ jsxRuntimeExports.jsx(Menu.Content, { children: s }),
1199
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonIcon, { ref: t, as: r, onClick: u, ...a })
1258
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonIcon, { ref: t, as: r, onClick: d, ...l })
1200
1259
  }
1201
1260
  );
1202
1261
  }
@@ -1270,35 +1329,35 @@ const buttonIconVariants = cva(
1270
1329
  }
1271
1330
  );
1272
1331
  function useFloatingPosition(e, t = "1rem") {
1273
- const r = useRef(null), [s, i] = useState({}), [o, a] = useState("fixed bottom-4 right-4"), n = useCallback(() => {
1274
- const c = r.current;
1275
- if (!c) return;
1276
- const g = c.getBoundingClientRect().height > window.innerHeight;
1277
- let d = {}, m = "";
1278
- g ? (d = {
1332
+ const r = useRef(null), [s, i] = useState({}), [o, n] = useState("fixed bottom-4 right-4"), a = useCallback(() => {
1333
+ const u = r.current;
1334
+ if (!u) return;
1335
+ const f = u.getBoundingClientRect().height > window.innerHeight;
1336
+ let d = {}, b = "";
1337
+ f ? (d = {
1279
1338
  position: "fixed",
1280
1339
  bottom: t,
1281
1340
  zIndex: 50,
1282
- transform: `translateY(${c.scrollTop}px)`
1283
- }, m = `fixed bottom-4 ${e}-4`) : (d = {
1341
+ transform: `translateY(${u.scrollTop}px)`
1342
+ }, b = `fixed bottom-4 ${e}-4`) : (d = {
1284
1343
  position: "fixed",
1285
1344
  bottom: t,
1286
1345
  zIndex: 50
1287
- }, m = `fixed bottom-4 ${e}-4`), i(d), a(m);
1346
+ }, b = `fixed bottom-4 ${e}-4`), i(d), n(b);
1288
1347
  }, [e, t]);
1289
1348
  return useEffect(() => {
1290
- n();
1291
- const c = r.current;
1292
- return c && c.addEventListener("scroll", n), window.addEventListener("resize", n), () => {
1293
- c && c.removeEventListener("scroll", n), window.removeEventListener("resize", n);
1349
+ a();
1350
+ const u = r.current;
1351
+ return u && u.addEventListener("scroll", a), window.addEventListener("resize", a), () => {
1352
+ u && u.removeEventListener("scroll", a), window.removeEventListener("resize", a);
1294
1353
  };
1295
- }, [n]), useEffect(() => {
1296
- r.current && n();
1297
- }, [e, t, n]), [useCallback(
1298
- (c) => {
1299
- r.current = c, c && n();
1354
+ }, [a]), useEffect(() => {
1355
+ r.current && a();
1356
+ }, [e, t, a]), [useCallback(
1357
+ (u) => {
1358
+ r.current = u, u && a();
1300
1359
  },
1301
- [n]
1360
+ [a]
1302
1361
  ), s, o];
1303
1362
  }
1304
1363
  const ButtonFloat = forwardRef(
@@ -1308,27 +1367,27 @@ const ButtonFloat = forwardRef(
1308
1367
  size: s = "md",
1309
1368
  side: i = "right",
1310
1369
  offset: o = "1rem",
1311
- ...a
1312
- }, n) {
1313
- const [l, c, u] = useFloatingPosition(
1370
+ ...n
1371
+ }, a) {
1372
+ const [l, u, c] = useFloatingPosition(
1314
1373
  i,
1315
1374
  o
1316
- ), [g, d] = useState(!1);
1375
+ ), [f, d] = useState(!1);
1317
1376
  return useEffect(() => {
1318
1377
  d(!0);
1319
1378
  }, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: l, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1320
1379
  "button",
1321
1380
  {
1322
- ref: n,
1323
- type: a.type || "button",
1381
+ ref: a,
1382
+ type: n.type || "button",
1324
1383
  className: cn(
1325
1384
  buttonFloatVariants({ variant: r, size: s }),
1326
- u,
1327
- g && "animate-fab-in",
1385
+ c,
1386
+ f && "animate-fab-in",
1328
1387
  t
1329
1388
  ),
1330
- style: c,
1331
- ...a
1389
+ style: u,
1390
+ ...n
1332
1391
  }
1333
1392
  ) });
1334
1393
  }
@@ -1450,7 +1509,7 @@ const BUTTONS = [
1450
1509
  className: s,
1451
1510
  "aria-label": i
1452
1511
  }, o) => {
1453
- const { input: a, inputRef: n, handleButton: l, handleInput: c } = useCalculator({
1512
+ const { input: n, inputRef: a, handleButton: l, handleInput: u } = useCalculator({
1454
1513
  initialValue: e,
1455
1514
  disabled: r,
1456
1515
  onChange: t
@@ -1466,16 +1525,16 @@ const BUTTONS = [
1466
1525
  /* @__PURE__ */ jsxRuntimeExports.jsx(
1467
1526
  "input",
1468
1527
  {
1469
- ref: n,
1528
+ ref: a,
1470
1529
  className: "w-full mb-3 px-3 py-2 rounded border border-[var(--color-neutral)] bg-[var(--color-neutral-soft)] text-right text-xl font-mono focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]",
1471
- value: a,
1472
- onChange: c,
1530
+ value: n,
1531
+ onChange: u,
1473
1532
  disabled: r,
1474
1533
  inputMode: "decimal",
1475
1534
  "aria-label": "Calculator input"
1476
1535
  }
1477
1536
  ),
1478
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-3", children: BUTTONS.map((u, g) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full", children: u.map((d) => d === "⌫" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
1537
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-3", children: BUTTONS.map((c, f) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full", children: c.map((d) => d === "⌫" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
1479
1538
  ButtonIcon,
1480
1539
  {
1481
1540
  as: X,
@@ -1496,7 +1555,7 @@ const BUTTONS = [
1496
1555
  children: d
1497
1556
  },
1498
1557
  d
1499
- )) }, g)) })
1558
+ )) }, f)) })
1500
1559
  ]
1501
1560
  }
1502
1561
  );
@@ -1548,16 +1607,16 @@ const cardVariants = cva(
1548
1607
  title: s,
1549
1608
  subtitle: i,
1550
1609
  badge: o,
1551
- supplementaryInfo: a,
1552
- bordered: n = !1,
1610
+ supplementaryInfo: n,
1611
+ bordered: a = !1,
1553
1612
  className: l,
1554
- ...c
1555
- }, u) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1613
+ ...u
1614
+ }, c) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1556
1615
  "button",
1557
1616
  {
1558
- ref: u,
1559
- className: cn(cardVariants({ size: e, shape: t, bordered: n }), l),
1560
- ...c,
1617
+ ref: c,
1618
+ className: cn(cardVariants({ size: e, shape: t, bordered: a }), l),
1619
+ ...u,
1561
1620
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-4", children: [
1562
1621
  r && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0", children: r }),
1563
1622
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full", children: [
@@ -1565,9 +1624,9 @@ const cardVariants = cva(
1565
1624
  s && /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "h3", fontSize: "base", fontWeight: "semibold", children: s }),
1566
1625
  i && /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "p", fontSize: "sm", color: "gray", children: i })
1567
1626
  ] }),
1568
- (o || a) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center", children: [
1627
+ (o || n) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center", children: [
1569
1628
  o,
1570
- typeof a == "string" ? /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "p", fontSize: "sm", color: "gray", children: a }) : a
1629
+ typeof n == "string" ? /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "p", fontSize: "sm", color: "gray", children: n }) : n
1571
1630
  ] })
1572
1631
  ] })
1573
1632
  ] })
@@ -1621,19 +1680,19 @@ const cardVariants = cva(
1621
1680
  size: s = "md",
1622
1681
  disabled: i = !1,
1623
1682
  children: o,
1624
- ...a
1625
- }, n) {
1683
+ ...n
1684
+ }, a) {
1626
1685
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1627
1686
  "button",
1628
1687
  {
1629
- ref: n,
1688
+ ref: a,
1630
1689
  type: "button",
1631
1690
  className: cn(filterChipVariants({ variant: r, size: s }), t),
1632
1691
  disabled: i,
1633
1692
  "aria-disabled": i,
1634
1693
  "aria-label": `${o}, removable`,
1635
1694
  inert: i ? !0 : void 0,
1636
- ...a,
1695
+ ...n,
1637
1696
  children: [
1638
1697
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex-shrink-0", children: o }),
1639
1698
  /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { as: XIcon, color: "inherit", size: s === "lg" ? "md" : "sm" })
@@ -1663,15 +1722,15 @@ const cardVariants = cva(
1663
1722
  ), noResultsHeaderVariants = cva(
1664
1723
  "flex flex-row items-center gap-3 mb-2"
1665
1724
  ), NoResults = React__default.forwardRef(
1666
- function e({ icon: t, title: r, subtitle: s, action: i, className: o, hasGrayBackground: a, ...n }, l) {
1725
+ function e({ icon: t, title: r, subtitle: s, action: i, className: o, hasGrayBackground: n, ...a }, l) {
1667
1726
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1668
1727
  "section",
1669
1728
  {
1670
1729
  ref: l,
1671
- className: cn(noResultsVariants({ hasGrayBackground: a }), o),
1730
+ className: cn(noResultsVariants({ hasGrayBackground: n }), o),
1672
1731
  role: "status",
1673
1732
  "aria-label": "No results found",
1674
- ...n,
1733
+ ...a,
1675
1734
  children: [
1676
1735
  /* @__PURE__ */ jsxRuntimeExports.jsxs("header", { className: noResultsHeaderVariants(), children: [
1677
1736
  /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { as: t, size: "lg", color: "ghost", "aria-hidden": "true" }),
@@ -1816,14 +1875,14 @@ const getTableColumnClass = (e) => {
1816
1875
  );
1817
1876
  }
1818
1877
  ), TableColumn = forwardRef(
1819
- ({ as: e = "td", span: t, align: r = "left", children: s, className: i, ...o }, a) => {
1820
- const n = e === "th" ? "columnheader" : "cell";
1878
+ ({ as: e = "td", span: t, align: r = "left", children: s, className: i, ...o }, n) => {
1879
+ const a = e === "th" ? "columnheader" : "cell";
1821
1880
  let l = "text-left";
1822
1881
  return r === "center" ? l = "text-center" : r === "right" && (l = "text-right"), /* @__PURE__ */ jsxRuntimeExports.jsx(
1823
1882
  "div",
1824
1883
  {
1825
- ref: a,
1826
- role: n,
1884
+ ref: n,
1885
+ role: a,
1827
1886
  className: cn(
1828
1887
  "px-4 py-2",
1829
1888
  "[&:not(:last-child)]:border-r [&:not(:last-child)]:border-border",
@@ -1934,9 +1993,9 @@ const getTableColumnClass = (e) => {
1934
1993
  )
1935
1994
  );
1936
1995
  function useImage({ src: e }) {
1937
- const [t, r] = useState(!1), [s, i] = useState(!1), o = useRef(!1), a = () => {
1996
+ const [t, r] = useState(!1), [s, i] = useState(!1), o = useRef(!1), n = () => {
1938
1997
  r(!0);
1939
- }, n = () => {
1998
+ }, a = () => {
1940
1999
  i(!0);
1941
2000
  };
1942
2001
  return useEffect(() => {
@@ -1952,8 +2011,8 @@ function useImage({ src: e }) {
1952
2011
  }, [e]), {
1953
2012
  loaded: t,
1954
2013
  errored: s,
1955
- handleLoad: a,
1956
- handleError: n
2014
+ handleLoad: n,
2015
+ handleError: a
1957
2016
  };
1958
2017
  }
1959
2018
  const imageVariants = cva("block object-cover", {
@@ -2031,12 +2090,12 @@ function BaseImageFallback({
2031
2090
  className: s,
2032
2091
  style: i,
2033
2092
  shape: o,
2034
- size: a
2093
+ size: n
2035
2094
  }) {
2036
2095
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
2037
2096
  "div",
2038
2097
  {
2039
- className: imageAtomVariants({ shape: o, size: a, className: s }),
2098
+ className: imageAtomVariants({ shape: o, size: n, className: s }),
2040
2099
  style: { width: t, height: r, ...i },
2041
2100
  "aria-label": e,
2042
2101
  role: "img",
@@ -2062,30 +2121,30 @@ const BaseImage = forwardRef(
2062
2121
  onError: s,
2063
2122
  width: i,
2064
2123
  height: o,
2065
- loading: a = "lazy",
2066
- position: n = "cover",
2124
+ loading: n = "lazy",
2125
+ position: a = "cover",
2067
2126
  size: l = "auto",
2068
- shape: c,
2069
- className: u,
2070
- ...g
2127
+ shape: u,
2128
+ className: c,
2129
+ ...f
2071
2130
  }, d) => {
2072
- const { loaded: m, errored: h, handleLoad: w, handleError: p } = useImage({
2131
+ const { loaded: b, errored: p, handleLoad: h, handleError: y } = useImage({
2073
2132
  src: e
2074
- }), v = typeof i == "number" ? i : Number(i), y = typeof o == "number" ? o : Number(o);
2075
- return !m && !h ? /* @__PURE__ */ jsxRuntimeExports.jsx(
2133
+ }), v = typeof i == "number" ? i : Number(i), R = typeof o == "number" ? o : Number(o);
2134
+ return !b && !p ? /* @__PURE__ */ jsxRuntimeExports.jsx(
2076
2135
  BaseImageSkeleton,
2077
2136
  {
2078
- shape: c,
2137
+ shape: u,
2079
2138
  width: v,
2080
- height: y
2139
+ height: R
2081
2140
  }
2082
- ) : h ? /* @__PURE__ */ jsxRuntimeExports.jsx(
2141
+ ) : p ? /* @__PURE__ */ jsxRuntimeExports.jsx(
2083
2142
  BaseImageFallback,
2084
2143
  {
2085
- shape: c,
2144
+ shape: u,
2086
2145
  alt: t,
2087
2146
  width: v,
2088
- height: y
2147
+ height: R
2089
2148
  }
2090
2149
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
2091
2150
  "img",
@@ -2094,23 +2153,23 @@ const BaseImage = forwardRef(
2094
2153
  src: e,
2095
2154
  alt: t,
2096
2155
  width: v,
2097
- height: y,
2098
- loading: a,
2156
+ height: R,
2157
+ loading: n,
2099
2158
  className: cn(
2100
2159
  imageVariants({
2101
- position: n,
2160
+ position: a,
2102
2161
  size: l,
2103
- shape: c
2162
+ shape: u
2104
2163
  }),
2105
- u
2164
+ c
2106
2165
  ),
2107
- onLoad: (b) => {
2108
- w(), r?.(b);
2166
+ onLoad: (j) => {
2167
+ h(), r?.(j);
2109
2168
  },
2110
- onError: (b) => {
2111
- p(), s?.(b);
2169
+ onError: (j) => {
2170
+ y(), s?.(j);
2112
2171
  },
2113
- ...g
2172
+ ...f
2114
2173
  }
2115
2174
  );
2116
2175
  }
@@ -2123,6 +2182,7 @@ export {
2123
2182
  Icon as I,
2124
2183
  Menu as M,
2125
2184
  NoResults as N,
2185
+ OverlayPortal as O,
2126
2186
  Table as T,
2127
2187
  Anchor as a,
2128
2188
  Attribute as b,
@@ -2139,5 +2199,6 @@ export {
2139
2199
  ImageCircle as m,
2140
2200
  ImageSquare as n,
2141
2201
  ImageRectangle as o,
2142
- BaseImage as p
2202
+ BaseImage as p,
2203
+ useEscapeClose as u
2143
2204
  };