@dimasbaguspm/versaur 0.0.18 → 0.0.20
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/js/bottom-sheet-DbtyWwsy.js +493 -0
- package/dist/js/{email-input-BIbrfs5q.js → bottom-sheet-input-C7cYfBaK.js} +789 -504
- package/dist/js/forms/index.js +21 -16
- package/dist/js/{description-list-DZQF212Z.js → image-rectangle-DH7v2xvp.js} +415 -323
- package/dist/js/index.js +63 -50
- package/dist/js/layouts/index.js +5 -4
- package/dist/js/overlays/index.js +6 -4
- package/dist/js/primitive/index.js +21 -16
- package/dist/js/side-bar-CHhcp0yS.js +397 -0
- package/dist/js/text-CRsIInRA.js +127 -0
- package/dist/js/tooltip-CDdl1U3A.js +148 -0
- package/dist/types/forms/bottom-sheet-input/bottom-sheet-input.d.ts +7 -0
- package/dist/types/forms/bottom-sheet-input/index.d.ts +2 -0
- package/dist/types/forms/bottom-sheet-input/types.d.ts +17 -0
- package/dist/types/forms/drawer-input/drawer-input.d.ts +6 -0
- package/dist/types/forms/drawer-input/index.d.ts +2 -0
- package/dist/types/forms/drawer-input/types.d.ts +18 -0
- package/dist/types/forms/index.d.ts +5 -0
- package/dist/types/forms/modal-input/index.d.ts +2 -0
- package/dist/types/forms/modal-input/modal-input.d.ts +6 -0
- package/dist/types/forms/modal-input/types.d.ts +18 -0
- package/dist/types/forms/selectable-multiple-input/index.d.ts +2 -0
- package/dist/types/forms/selectable-multiple-input/selectable-multiple-input.d.ts +6 -0
- package/dist/types/forms/selectable-multiple-input/types.d.ts +18 -0
- package/dist/types/forms/selectable-single-input/index.d.ts +2 -0
- package/dist/types/forms/selectable-single-input/selectable-single-input.d.ts +6 -0
- package/dist/types/forms/selectable-single-input/types.d.ts +18 -0
- package/dist/types/layouts/index.d.ts +1 -0
- package/dist/types/layouts/side-bar/index.d.ts +2 -0
- package/dist/types/layouts/side-bar/side-bar.atoms.d.ts +3 -0
- package/dist/types/layouts/side-bar/side-bar.d.ts +5 -0
- package/dist/types/layouts/side-bar/types.d.ts +42 -0
- package/dist/types/overlays/bottom-sheet/types.d.ts +2 -1
- package/dist/types/overlays/drawer/types.d.ts +2 -1
- package/dist/types/overlays/index.d.ts +1 -0
- package/dist/types/overlays/menu/menu.atoms.d.ts +5 -10
- package/dist/types/overlays/menu/menu.d.ts +2 -6
- package/dist/types/overlays/menu/types.d.ts +9 -14
- package/dist/types/overlays/menu/use-menu.d.ts +0 -1
- package/dist/types/overlays/modal/modal.d.ts +14 -5
- package/dist/types/overlays/modal/types.d.ts +7 -20
- package/dist/types/overlays/tooltip/index.d.ts +2 -0
- package/dist/types/overlays/tooltip/tooltip.d.ts +5 -0
- package/dist/types/overlays/tooltip/types.d.ts +33 -0
- package/dist/types/overlays/tooltip/use-tooltip-position.d.ts +8 -0
- package/dist/types/primitive/image/base-image.atoms.d.ts +6 -0
- package/dist/types/primitive/image/base-image.d.ts +6 -0
- package/dist/types/primitive/image/image-circle.d.ts +6 -0
- package/dist/types/primitive/image/image-rectangle.d.ts +6 -0
- package/dist/types/primitive/image/image-square.d.ts +6 -0
- package/dist/types/primitive/image/index.d.ts +5 -0
- package/dist/types/primitive/image/types.d.ts +48 -0
- package/dist/types/primitive/image/use-image.d.ts +13 -0
- package/dist/types/primitive/index.d.ts +1 -0
- package/dist/types/primitive/table/table.atoms.d.ts +4 -6
- package/dist/types/primitive/table/table.d.ts +2 -1
- package/dist/types/primitive/table/types.d.ts +7 -4
- package/dist/utils/enforce-subpath-import.js +11 -0
- package/package.json +1 -1
- package/dist/js/bottom-sheet-BRv-oJL-.js +0 -646
- package/dist/js/form-layout-4ASWdXn8.js +0 -302
- package/dist/types/overlays/modal/use-escape-close.d.ts +0 -6
- package/dist/types/overlays/modal/use-focus-trap.d.ts +0 -6
|
@@ -1,43 +1,10 @@
|
|
|
1
1
|
import { c as cva, j as jsxRuntimeExports, a as cn } from "./index-DOdDlCoL.js";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import React__default, { forwardRef, useState, useEffect, useCallback, useRef, createContext, useContext
|
|
4
|
-
import { X, ChevronLeft, ChevronRight } from "lucide-react";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
xs: "w-3 h-3",
|
|
9
|
-
sm: "w-4 h-4",
|
|
10
|
-
md: "w-5 h-5",
|
|
11
|
-
lg: "w-6 h-6",
|
|
12
|
-
xl: "w-8 h-8"
|
|
13
|
-
},
|
|
14
|
-
color: {
|
|
15
|
-
primary: "text-primary",
|
|
16
|
-
secondary: "text-secondary",
|
|
17
|
-
tertiary: "text-tertiary",
|
|
18
|
-
ghost: "text-ghost",
|
|
19
|
-
neutral: "text-neutral",
|
|
20
|
-
success: "text-success",
|
|
21
|
-
info: "text-info",
|
|
22
|
-
warning: "text-warning",
|
|
23
|
-
danger: "text-danger",
|
|
24
|
-
inherit: ""
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
defaultVariants: {
|
|
28
|
-
size: "md",
|
|
29
|
-
color: "primary"
|
|
30
|
-
}
|
|
31
|
-
}), Icon = React__default.forwardRef(function({ as: t, color: r = "primary", size: s = "md", className: n, ...o }, i) {
|
|
32
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
33
|
-
t,
|
|
34
|
-
{
|
|
35
|
-
ref: i,
|
|
36
|
-
className: iconVariants({ color: r, size: s, className: n }),
|
|
37
|
-
...o
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
}), alertVariants = cva(
|
|
3
|
+
import React__default, { forwardRef, useState, useEffect, useCallback, useRef, createContext, useContext } from "react";
|
|
4
|
+
import { X, ChevronLeft, ChevronRight, ImageOff } from "lucide-react";
|
|
5
|
+
import { T as Text } from "./text-CRsIInRA.js";
|
|
6
|
+
import { S as Skeleton } from "./skeleton-BNZyaRjo.js";
|
|
7
|
+
const alertVariants = cva(
|
|
41
8
|
"relative flex items-center gap-2 rounded-md p-2 text-sm transition-all duration-200",
|
|
42
9
|
{
|
|
43
10
|
variants: {
|
|
@@ -180,18 +147,18 @@ const iconVariants = cva("inline-flex items-center justify-center", {
|
|
|
180
147
|
color: t = "neutral",
|
|
181
148
|
icon: r,
|
|
182
149
|
className: s,
|
|
183
|
-
children:
|
|
184
|
-
...
|
|
150
|
+
children: o,
|
|
151
|
+
...n
|
|
185
152
|
}, i) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
186
153
|
"div",
|
|
187
154
|
{
|
|
188
155
|
ref: i,
|
|
189
156
|
role: "alert",
|
|
190
157
|
className: cn(alertVariants({ variant: e, color: t }), s),
|
|
191
|
-
...
|
|
158
|
+
...n,
|
|
192
159
|
children: [
|
|
193
160
|
r && /* @__PURE__ */ jsxRuntimeExports.jsx(AlertIcon, { children: r }),
|
|
194
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children:
|
|
161
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: o })
|
|
195
162
|
]
|
|
196
163
|
}
|
|
197
164
|
)
|
|
@@ -260,15 +227,15 @@ const iconVariants = cva("inline-flex items-center justify-center", {
|
|
|
260
227
|
className: t,
|
|
261
228
|
color: r = "primary",
|
|
262
229
|
fontSize: s = "base",
|
|
263
|
-
fontWeight:
|
|
264
|
-
quiet:
|
|
230
|
+
fontWeight: o = "medium",
|
|
231
|
+
quiet: n = !1,
|
|
265
232
|
...i
|
|
266
233
|
}, a) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
267
234
|
"a",
|
|
268
235
|
{
|
|
269
236
|
ref: a,
|
|
270
237
|
className: cn(
|
|
271
|
-
anchorVariants({ color: r, fontSize: s, fontWeight:
|
|
238
|
+
anchorVariants({ color: r, fontSize: s, fontWeight: o, quiet: n }),
|
|
272
239
|
t
|
|
273
240
|
),
|
|
274
241
|
...i,
|
|
@@ -319,24 +286,24 @@ const iconVariants = cva("inline-flex items-center justify-center", {
|
|
|
319
286
|
size: t = "md",
|
|
320
287
|
shape: r = "circle",
|
|
321
288
|
className: s,
|
|
322
|
-
children:
|
|
323
|
-
...
|
|
289
|
+
children: o,
|
|
290
|
+
...n
|
|
324
291
|
}, i) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
325
292
|
"div",
|
|
326
293
|
{
|
|
327
294
|
ref: i,
|
|
328
295
|
className: cn(avatarVariants({ variant: e, size: t, shape: r }), s),
|
|
329
|
-
...
|
|
330
|
-
children:
|
|
296
|
+
...n,
|
|
297
|
+
children: o
|
|
331
298
|
}
|
|
332
299
|
)
|
|
333
300
|
), AvatarImage = forwardRef(
|
|
334
|
-
({ src: e, alt: t, className: r, onError: s, ...
|
|
301
|
+
({ src: e, alt: t, className: r, onError: s, ...o }, n) => {
|
|
335
302
|
const [i, a] = useState(!1);
|
|
336
303
|
useEffect(() => {
|
|
337
304
|
a(!1);
|
|
338
305
|
}, [e]);
|
|
339
|
-
const
|
|
306
|
+
const g = useCallback(
|
|
340
307
|
(c) => {
|
|
341
308
|
a(!0), s?.(c);
|
|
342
309
|
},
|
|
@@ -345,12 +312,12 @@ const iconVariants = cva("inline-flex items-center justify-center", {
|
|
|
345
312
|
return i ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
346
313
|
"img",
|
|
347
314
|
{
|
|
348
|
-
ref:
|
|
315
|
+
ref: n,
|
|
349
316
|
src: e,
|
|
350
317
|
alt: t,
|
|
351
318
|
className: cn(avatarImageVariants(), r),
|
|
352
|
-
onError:
|
|
353
|
-
...
|
|
319
|
+
onError: g,
|
|
320
|
+
...o
|
|
354
321
|
}
|
|
355
322
|
);
|
|
356
323
|
}
|
|
@@ -518,13 +485,13 @@ const iconVariants = cva("inline-flex items-center justify-center", {
|
|
|
518
485
|
shape: t = "square",
|
|
519
486
|
color: r = "primary",
|
|
520
487
|
size: s = "md",
|
|
521
|
-
iconLeft:
|
|
522
|
-
iconRight:
|
|
488
|
+
iconLeft: o,
|
|
489
|
+
iconRight: n,
|
|
523
490
|
className: i,
|
|
524
491
|
children: a,
|
|
525
|
-
...
|
|
492
|
+
...g
|
|
526
493
|
}, c) => {
|
|
527
|
-
const f = !(a != null && a !== "") && !!(
|
|
494
|
+
const f = !(a != null && a !== "") && !!(o || n);
|
|
528
495
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
529
496
|
"span",
|
|
530
497
|
{
|
|
@@ -539,16 +506,16 @@ const iconVariants = cva("inline-flex items-center justify-center", {
|
|
|
539
506
|
}),
|
|
540
507
|
i
|
|
541
508
|
),
|
|
542
|
-
...
|
|
509
|
+
...g,
|
|
543
510
|
children: f ? (
|
|
544
511
|
// Icon-only mode: display only the icon
|
|
545
|
-
|
|
512
|
+
o || n
|
|
546
513
|
) : (
|
|
547
514
|
// Normal mode: display icon(s) and text
|
|
548
515
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
549
|
-
|
|
516
|
+
o,
|
|
550
517
|
a,
|
|
551
|
-
|
|
518
|
+
n
|
|
552
519
|
] })
|
|
553
520
|
)
|
|
554
521
|
}
|
|
@@ -571,13 +538,13 @@ const SvgSpenicleSquare = (e) => /* @__PURE__ */ React.createElement("svg", { wi
|
|
|
571
538
|
}
|
|
572
539
|
}), BrandLogo = forwardRef(
|
|
573
540
|
({ shape: e = "square", size: t, ...r }, s) => {
|
|
574
|
-
const
|
|
541
|
+
const n = {
|
|
575
542
|
square: SvgSpenicleSquare,
|
|
576
543
|
rounded: SvgSpenicleRounded,
|
|
577
544
|
circle: SvgSpenicleCircle
|
|
578
545
|
}[e] || SvgSpenicleSquare;
|
|
579
546
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
580
|
-
|
|
547
|
+
n,
|
|
581
548
|
{
|
|
582
549
|
ref: s,
|
|
583
550
|
...r,
|
|
@@ -586,10 +553,10 @@ const SvgSpenicleSquare = (e) => /* @__PURE__ */ React.createElement("svg", { wi
|
|
|
586
553
|
);
|
|
587
554
|
}
|
|
588
555
|
), Brand = forwardRef(
|
|
589
|
-
({ name: e = "spenicle", size: t = "md", shape: r, ...s },
|
|
556
|
+
({ name: e = "spenicle", size: t = "md", shape: r, ...s }, o) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
590
557
|
"span",
|
|
591
558
|
{
|
|
592
|
-
ref:
|
|
559
|
+
ref: o,
|
|
593
560
|
className: cn("inline-flex items-center gap-2"),
|
|
594
561
|
...s,
|
|
595
562
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(BrandLogo, { shape: r, size: t, "aria-hidden": "true" })
|
|
@@ -650,20 +617,20 @@ const SvgSpenicleSquare = (e) => /* @__PURE__ */ React.createElement("svg", { wi
|
|
|
650
617
|
className: t,
|
|
651
618
|
variant: r = "primary",
|
|
652
619
|
size: s = "md",
|
|
653
|
-
disabled:
|
|
654
|
-
type:
|
|
620
|
+
disabled: o = !1,
|
|
621
|
+
type: n = "button",
|
|
655
622
|
children: i,
|
|
656
623
|
...a
|
|
657
|
-
},
|
|
624
|
+
}, g) {
|
|
658
625
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
659
626
|
"button",
|
|
660
627
|
{
|
|
661
|
-
ref:
|
|
662
|
-
type:
|
|
628
|
+
ref: g,
|
|
629
|
+
type: n,
|
|
663
630
|
className: cn(buttonVariants({ variant: r, size: s }), t),
|
|
664
|
-
disabled:
|
|
665
|
-
"aria-disabled":
|
|
666
|
-
inert:
|
|
631
|
+
disabled: o,
|
|
632
|
+
"aria-disabled": o,
|
|
633
|
+
inert: o ? !0 : void 0,
|
|
667
634
|
...a,
|
|
668
635
|
children: i
|
|
669
636
|
}
|
|
@@ -737,21 +704,21 @@ const SvgSpenicleSquare = (e) => /* @__PURE__ */ React.createElement("svg", { wi
|
|
|
737
704
|
}
|
|
738
705
|
);
|
|
739
706
|
function useFloatingPosition(e, t = "1rem") {
|
|
740
|
-
const r = useRef(null), [s,
|
|
707
|
+
const r = useRef(null), [s, o] = useState({}), [n, i] = useState("fixed bottom-4 right-4"), a = useCallback(() => {
|
|
741
708
|
const c = r.current;
|
|
742
709
|
if (!c) return;
|
|
743
710
|
const b = c.getBoundingClientRect().height > window.innerHeight;
|
|
744
|
-
let f = {},
|
|
711
|
+
let f = {}, p = "";
|
|
745
712
|
b ? (f = {
|
|
746
713
|
position: "fixed",
|
|
747
714
|
bottom: t,
|
|
748
715
|
zIndex: 50,
|
|
749
716
|
transform: `translateY(${c.scrollTop}px)`
|
|
750
|
-
},
|
|
717
|
+
}, p = `fixed bottom-4 ${e}-4`) : (f = {
|
|
751
718
|
position: "fixed",
|
|
752
719
|
bottom: t,
|
|
753
720
|
zIndex: 50
|
|
754
|
-
},
|
|
721
|
+
}, p = `fixed bottom-4 ${e}-4`), o(f), i(p);
|
|
755
722
|
}, [e, t]);
|
|
756
723
|
return useEffect(() => {
|
|
757
724
|
a();
|
|
@@ -766,31 +733,31 @@ function useFloatingPosition(e, t = "1rem") {
|
|
|
766
733
|
r.current = c, c && a();
|
|
767
734
|
},
|
|
768
735
|
[a]
|
|
769
|
-
), s,
|
|
736
|
+
), s, n];
|
|
770
737
|
}
|
|
771
738
|
const ButtonFloat = forwardRef(
|
|
772
739
|
function({
|
|
773
740
|
className: t,
|
|
774
741
|
variant: r = "primary",
|
|
775
742
|
size: s = "md",
|
|
776
|
-
side:
|
|
777
|
-
offset:
|
|
743
|
+
side: o = "right",
|
|
744
|
+
offset: n = "1rem",
|
|
778
745
|
...i
|
|
779
746
|
}, a) {
|
|
780
|
-
const [
|
|
781
|
-
|
|
782
|
-
|
|
747
|
+
const [g, c, m] = useFloatingPosition(
|
|
748
|
+
o,
|
|
749
|
+
n
|
|
783
750
|
), [b, f] = useState(!1);
|
|
784
751
|
return useEffect(() => {
|
|
785
752
|
f(!0);
|
|
786
|
-
}, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref:
|
|
753
|
+
}, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: g, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
787
754
|
"button",
|
|
788
755
|
{
|
|
789
756
|
ref: a,
|
|
790
757
|
type: i.type || "button",
|
|
791
758
|
className: cn(
|
|
792
759
|
buttonFloatVariants({ variant: r, size: s }),
|
|
793
|
-
|
|
760
|
+
m,
|
|
794
761
|
b && "animate-fab-in",
|
|
795
762
|
t
|
|
796
763
|
),
|
|
@@ -893,16 +860,51 @@ const buttonIconVariants = cva(
|
|
|
893
860
|
shape: "rounded"
|
|
894
861
|
}
|
|
895
862
|
}
|
|
896
|
-
),
|
|
863
|
+
), iconVariants = cva("inline-flex items-center justify-center", {
|
|
864
|
+
variants: {
|
|
865
|
+
size: {
|
|
866
|
+
xs: "w-3 h-3",
|
|
867
|
+
sm: "w-4 h-4",
|
|
868
|
+
md: "w-5 h-5",
|
|
869
|
+
lg: "w-6 h-6",
|
|
870
|
+
xl: "w-8 h-8"
|
|
871
|
+
},
|
|
872
|
+
color: {
|
|
873
|
+
primary: "text-primary",
|
|
874
|
+
secondary: "text-secondary",
|
|
875
|
+
tertiary: "text-tertiary",
|
|
876
|
+
ghost: "text-ghost",
|
|
877
|
+
neutral: "text-neutral",
|
|
878
|
+
success: "text-success",
|
|
879
|
+
info: "text-info",
|
|
880
|
+
warning: "text-warning",
|
|
881
|
+
danger: "text-danger",
|
|
882
|
+
inherit: ""
|
|
883
|
+
}
|
|
884
|
+
},
|
|
885
|
+
defaultVariants: {
|
|
886
|
+
size: "md",
|
|
887
|
+
color: "primary"
|
|
888
|
+
}
|
|
889
|
+
}), Icon = React__default.forwardRef(function({ as: t, color: r = "primary", size: s = "md", className: o, ...n }, i) {
|
|
890
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
891
|
+
t,
|
|
892
|
+
{
|
|
893
|
+
ref: i,
|
|
894
|
+
className: iconVariants({ color: r, size: s, className: o }),
|
|
895
|
+
...n
|
|
896
|
+
}
|
|
897
|
+
);
|
|
898
|
+
}), ButtonIcon = React__default.forwardRef(
|
|
897
899
|
function({
|
|
898
900
|
className: t,
|
|
899
901
|
variant: r = "primary",
|
|
900
902
|
size: s = "md",
|
|
901
|
-
shape:
|
|
902
|
-
disabled:
|
|
903
|
+
shape: o = "rounded",
|
|
904
|
+
disabled: n = !1,
|
|
903
905
|
as: i,
|
|
904
906
|
"aria-label": a,
|
|
905
|
-
...
|
|
907
|
+
...g
|
|
906
908
|
}, c) {
|
|
907
909
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
908
910
|
"button",
|
|
@@ -913,15 +915,15 @@ const buttonIconVariants = cva(
|
|
|
913
915
|
buttonIconVariants({
|
|
914
916
|
variant: r,
|
|
915
917
|
size: s,
|
|
916
|
-
shape:
|
|
918
|
+
shape: o
|
|
917
919
|
}),
|
|
918
920
|
t
|
|
919
921
|
),
|
|
920
|
-
disabled:
|
|
921
|
-
"aria-disabled":
|
|
922
|
+
disabled: n,
|
|
923
|
+
"aria-disabled": n,
|
|
922
924
|
"aria-label": a,
|
|
923
|
-
inert:
|
|
924
|
-
...
|
|
925
|
+
inert: n ? !0 : void 0,
|
|
926
|
+
...g,
|
|
925
927
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
926
928
|
Icon,
|
|
927
929
|
{
|
|
@@ -1049,9 +1051,9 @@ const BUTTONS = [
|
|
|
1049
1051
|
onChange: t,
|
|
1050
1052
|
disabled: r,
|
|
1051
1053
|
className: s,
|
|
1052
|
-
"aria-label":
|
|
1053
|
-
},
|
|
1054
|
-
const { input: i, inputRef: a, handleButton:
|
|
1054
|
+
"aria-label": o
|
|
1055
|
+
}, n) => {
|
|
1056
|
+
const { input: i, inputRef: a, handleButton: g, handleInput: c } = useCalculator({
|
|
1055
1057
|
initialValue: e,
|
|
1056
1058
|
disabled: r,
|
|
1057
1059
|
onChange: t
|
|
@@ -1059,9 +1061,9 @@ const BUTTONS = [
|
|
|
1059
1061
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1060
1062
|
"div",
|
|
1061
1063
|
{
|
|
1062
|
-
ref:
|
|
1064
|
+
ref: n,
|
|
1063
1065
|
className: cn(calculatorRootVariants({ disabled: r }), s),
|
|
1064
|
-
"aria-label":
|
|
1066
|
+
"aria-label": o || "Calculator",
|
|
1065
1067
|
role: "region",
|
|
1066
1068
|
children: [
|
|
1067
1069
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -1076,14 +1078,14 @@ const BUTTONS = [
|
|
|
1076
1078
|
"aria-label": "Calculator input"
|
|
1077
1079
|
}
|
|
1078
1080
|
),
|
|
1079
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-3", children: BUTTONS.map((
|
|
1081
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-3", children: BUTTONS.map((m, b) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full", children: m.map((f) => f === "⌫" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1080
1082
|
ButtonIcon,
|
|
1081
1083
|
{
|
|
1082
1084
|
as: X,
|
|
1083
1085
|
variant: "danger-ghost",
|
|
1084
1086
|
"aria-label": "Backspace",
|
|
1085
1087
|
size: "md",
|
|
1086
|
-
onClick: () =>
|
|
1088
|
+
onClick: () => g("⌫"),
|
|
1087
1089
|
disabled: r
|
|
1088
1090
|
},
|
|
1089
1091
|
"backspace"
|
|
@@ -1091,7 +1093,7 @@ const BUTTONS = [
|
|
|
1091
1093
|
CalculatorButton,
|
|
1092
1094
|
{
|
|
1093
1095
|
variant: f === "=" ? "action" : f === "C" ? "danger" : ["/", "*", "-", "+", "/"].includes(f) ? "operator" : "default",
|
|
1094
|
-
onClick: () =>
|
|
1096
|
+
onClick: () => g(f),
|
|
1095
1097
|
disabled: r,
|
|
1096
1098
|
"aria-label": f,
|
|
1097
1099
|
children: f
|
|
@@ -1104,128 +1106,7 @@ const BUTTONS = [
|
|
|
1104
1106
|
}
|
|
1105
1107
|
);
|
|
1106
1108
|
Calculator.displayName = "Calculator";
|
|
1107
|
-
const
|
|
1108
|
-
variants: {
|
|
1109
|
-
color: {
|
|
1110
|
-
primary: "text-primary",
|
|
1111
|
-
secondary: "text-secondary",
|
|
1112
|
-
tertiary: "text-tertiary",
|
|
1113
|
-
ghost: "text-ghost",
|
|
1114
|
-
neutral: "text-ghost",
|
|
1115
|
-
success: "text-success",
|
|
1116
|
-
info: "text-info",
|
|
1117
|
-
warning: "text-warning",
|
|
1118
|
-
danger: "text-danger",
|
|
1119
|
-
inherit: "",
|
|
1120
|
-
gray: "text-gray-500",
|
|
1121
|
-
black: "text-black",
|
|
1122
|
-
white: "text-white"
|
|
1123
|
-
},
|
|
1124
|
-
hasUnderline: {
|
|
1125
|
-
true: "underline",
|
|
1126
|
-
false: ""
|
|
1127
|
-
},
|
|
1128
|
-
isCapitalize: {
|
|
1129
|
-
true: "capitalize",
|
|
1130
|
-
false: ""
|
|
1131
|
-
},
|
|
1132
|
-
align: {
|
|
1133
|
-
left: "text-left",
|
|
1134
|
-
center: "text-center",
|
|
1135
|
-
right: "text-right",
|
|
1136
|
-
justify: "text-justify"
|
|
1137
|
-
},
|
|
1138
|
-
italic: {
|
|
1139
|
-
true: "italic",
|
|
1140
|
-
false: ""
|
|
1141
|
-
},
|
|
1142
|
-
clamp: {
|
|
1143
|
-
1: "line-clamp-1",
|
|
1144
|
-
2: "line-clamp-2",
|
|
1145
|
-
3: "line-clamp-3",
|
|
1146
|
-
4: "line-clamp-4",
|
|
1147
|
-
5: "line-clamp-5",
|
|
1148
|
-
none: ""
|
|
1149
|
-
},
|
|
1150
|
-
ellipsis: {
|
|
1151
|
-
true: "truncate",
|
|
1152
|
-
false: ""
|
|
1153
|
-
},
|
|
1154
|
-
as: {
|
|
1155
|
-
h1: "font-bold text-4xl leading-loose",
|
|
1156
|
-
h2: "font-semibold text-3xl leading-relaxed",
|
|
1157
|
-
h3: "font-medium text-2xl leading-relaxed",
|
|
1158
|
-
h4: "font-bold text-xl leading-normal",
|
|
1159
|
-
h5: "font-semibold text-lg leading-normal",
|
|
1160
|
-
h6: "font-medium text-base leading-normal",
|
|
1161
|
-
p: "font-normal text-base leading-normal",
|
|
1162
|
-
span: "font-normal text-base leading-normal",
|
|
1163
|
-
label: "font-normal text-xs leading-normal"
|
|
1164
|
-
}
|
|
1165
|
-
},
|
|
1166
|
-
defaultVariants: {
|
|
1167
|
-
color: "neutral",
|
|
1168
|
-
hasUnderline: !1,
|
|
1169
|
-
isCapitalize: !1,
|
|
1170
|
-
align: "left",
|
|
1171
|
-
italic: !1,
|
|
1172
|
-
clamp: "none",
|
|
1173
|
-
ellipsis: !1,
|
|
1174
|
-
as: "span"
|
|
1175
|
-
}
|
|
1176
|
-
}), Text = forwardRef(
|
|
1177
|
-
({
|
|
1178
|
-
as: e = "span",
|
|
1179
|
-
color: t = "ghost",
|
|
1180
|
-
hasUnderline: r = !1,
|
|
1181
|
-
isCapitalize: s = !1,
|
|
1182
|
-
align: n = "left",
|
|
1183
|
-
italic: o = !1,
|
|
1184
|
-
clamp: i = "none",
|
|
1185
|
-
ellipsis: a = !1,
|
|
1186
|
-
fontSize: u,
|
|
1187
|
-
fontWeight: c,
|
|
1188
|
-
className: x,
|
|
1189
|
-
children: b,
|
|
1190
|
-
...f
|
|
1191
|
-
}, w) => {
|
|
1192
|
-
const d = [
|
|
1193
|
-
"h1",
|
|
1194
|
-
"h2",
|
|
1195
|
-
"h3",
|
|
1196
|
-
"h4",
|
|
1197
|
-
"h5",
|
|
1198
|
-
"h6",
|
|
1199
|
-
"p",
|
|
1200
|
-
"span",
|
|
1201
|
-
"label"
|
|
1202
|
-
].includes(e) ? e : "span", v = u ? `text-${u}` : "", p = c ? `font-${c}` : "";
|
|
1203
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1204
|
-
e,
|
|
1205
|
-
{
|
|
1206
|
-
ref: w,
|
|
1207
|
-
className: cn(
|
|
1208
|
-
textVariants({
|
|
1209
|
-
color: t,
|
|
1210
|
-
hasUnderline: r,
|
|
1211
|
-
isCapitalize: s,
|
|
1212
|
-
align: n,
|
|
1213
|
-
italic: o,
|
|
1214
|
-
clamp: i,
|
|
1215
|
-
ellipsis: a,
|
|
1216
|
-
// @ts-expect-error - `as` is not a valid variant
|
|
1217
|
-
as: d
|
|
1218
|
-
}),
|
|
1219
|
-
v,
|
|
1220
|
-
p,
|
|
1221
|
-
x
|
|
1222
|
-
),
|
|
1223
|
-
...f,
|
|
1224
|
-
children: b
|
|
1225
|
-
}
|
|
1226
|
-
);
|
|
1227
|
-
}
|
|
1228
|
-
), CalendarContext = createContext(null);
|
|
1109
|
+
const CalendarContext = createContext(null);
|
|
1229
1110
|
function useCalendarContext() {
|
|
1230
1111
|
const e = useContext(CalendarContext);
|
|
1231
1112
|
if (!e)
|
|
@@ -1268,27 +1149,27 @@ const CalendarHeader = () => {
|
|
|
1268
1149
|
] })
|
|
1269
1150
|
] });
|
|
1270
1151
|
}, CalendarWeekdays = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-7 px-4 text-ghost-500 mb-3", children: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((e) => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { fontSize: "xs", color: "ghost", align: "center", children: e }, e)) }), CalendarDaysSingle = () => {
|
|
1271
|
-
const e = useCalendarContext(), { year: t, month: r, value: s, onChange:
|
|
1272
|
-
for (let
|
|
1273
|
-
const
|
|
1152
|
+
const e = useCalendarContext(), { year: t, month: r, value: s, onChange: o, setMonth: n, setYear: i } = e, a = (u, x) => new Date(u, x + 1, 0).getDate(), c = ((u, x) => new Date(u, x, 1).getDay())(t, r), m = a(t, r), b = r - 1 < 0 ? 11 : r - 1, f = r === 0 ? t - 1 : t, p = a(t, b), y = r === 11 ? 0 : r + 1, d = r === 11 ? t + 1 : t, v = [];
|
|
1153
|
+
for (let u = 0; u < c; u++) {
|
|
1154
|
+
const x = p - c + u + 1;
|
|
1274
1155
|
v.push(
|
|
1275
1156
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1276
1157
|
ButtonIcon,
|
|
1277
1158
|
{
|
|
1278
|
-
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children:
|
|
1159
|
+
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: x }),
|
|
1279
1160
|
size: "sm",
|
|
1280
1161
|
"aria-label": "Previous month day",
|
|
1281
1162
|
variant: "ghost",
|
|
1282
1163
|
onClick: () => {
|
|
1283
|
-
|
|
1164
|
+
o?.(new Date(f, b, x)), n(b), i(f);
|
|
1284
1165
|
}
|
|
1285
1166
|
},
|
|
1286
|
-
"prev-" +
|
|
1167
|
+
"prev-" + u
|
|
1287
1168
|
)
|
|
1288
1169
|
);
|
|
1289
1170
|
}
|
|
1290
|
-
for (let
|
|
1291
|
-
const
|
|
1171
|
+
for (let u = 1; u <= m; u++) {
|
|
1172
|
+
const x = s instanceof Date && s.getFullYear() === t && s.getMonth() === r && s.getDate() === u;
|
|
1292
1173
|
v.push(
|
|
1293
1174
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1294
1175
|
ButtonIcon,
|
|
@@ -1298,53 +1179,53 @@ const CalendarHeader = () => {
|
|
|
1298
1179
|
{
|
|
1299
1180
|
as: "span",
|
|
1300
1181
|
fontSize: "sm",
|
|
1301
|
-
color:
|
|
1302
|
-
className:
|
|
1303
|
-
children:
|
|
1182
|
+
color: x ? "inherit" : "ghost",
|
|
1183
|
+
className: x ? "bg-primary text-white rounded-full" : "",
|
|
1184
|
+
children: u
|
|
1304
1185
|
}
|
|
1305
1186
|
),
|
|
1306
|
-
variant:
|
|
1187
|
+
variant: x ? "primary" : "ghost",
|
|
1307
1188
|
size: "sm",
|
|
1308
|
-
"aria-label": `Select ${t}-${r + 1}-${
|
|
1309
|
-
"aria-current":
|
|
1189
|
+
"aria-label": `Select ${t}-${r + 1}-${u}`,
|
|
1190
|
+
"aria-current": x ? "date" : void 0,
|
|
1310
1191
|
onClick: () => {
|
|
1311
|
-
|
|
1192
|
+
o?.(new Date(t, r, u));
|
|
1312
1193
|
}
|
|
1313
1194
|
},
|
|
1314
|
-
|
|
1195
|
+
u
|
|
1315
1196
|
)
|
|
1316
1197
|
);
|
|
1317
1198
|
}
|
|
1318
|
-
const
|
|
1319
|
-
for (let
|
|
1199
|
+
const w = c + m;
|
|
1200
|
+
for (let u = 0; u < (w % 7 === 0 ? 0 : 7 - w % 7); u++)
|
|
1320
1201
|
v.push(
|
|
1321
1202
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1322
1203
|
ButtonIcon,
|
|
1323
1204
|
{
|
|
1324
|
-
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children:
|
|
1205
|
+
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: u + 1 }),
|
|
1325
1206
|
size: "sm",
|
|
1326
1207
|
"aria-label": "Next month day",
|
|
1327
1208
|
variant: "ghost",
|
|
1328
1209
|
onClick: () => {
|
|
1329
|
-
|
|
1210
|
+
o?.(new Date(d, y, u + 1)), n(y), i(d);
|
|
1330
1211
|
}
|
|
1331
1212
|
},
|
|
1332
|
-
"next-" +
|
|
1213
|
+
"next-" + u
|
|
1333
1214
|
)
|
|
1334
1215
|
);
|
|
1335
1216
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-7 gap-2 px-4 pb-4", children: v });
|
|
1336
1217
|
}, CalendarDaysRange = () => {
|
|
1337
|
-
const { year: e, month: t, value: r, onChange: s, setMonth:
|
|
1218
|
+
const { year: e, month: t, value: r, onChange: s, setMonth: o, setYear: n } = useCalendarContext(), i = (l, h) => new Date(l, h + 1, 0).getDate(), g = ((l, h) => new Date(l, h, 1).getDay())(e, t), c = i(e, t), m = t - 1 < 0 ? 11 : t - 1, b = t === 0 ? e - 1 : e, f = i(e, m), p = t === 11 ? 0 : t + 1, y = t === 11 ? e + 1 : e, d = [], v = () => {
|
|
1338
1219
|
if (!Array.isArray(r)) return [null, null];
|
|
1339
1220
|
const [l, h] = r;
|
|
1340
1221
|
return !l && !h ? [null, null] : l && h ? l <= h ? [l, h] : [h, l] : [l, h];
|
|
1341
|
-
}, [
|
|
1342
|
-
if (!
|
|
1222
|
+
}, [w, u] = v(), x = (l) => {
|
|
1223
|
+
if (!w || !u) return !1;
|
|
1343
1224
|
const h = new Date(e, t, l);
|
|
1344
|
-
return h >=
|
|
1345
|
-
},
|
|
1346
|
-
for (let l = 0; l <
|
|
1347
|
-
const h = f -
|
|
1225
|
+
return h >= w && h <= u;
|
|
1226
|
+
}, S = (l) => w ? w.getFullYear() === e && w.getMonth() === t && w.getDate() === l : !1, N = (l) => u ? u.getFullYear() === e && u.getMonth() === t && u.getDate() === l : !1;
|
|
1227
|
+
for (let l = 0; l < g; l++) {
|
|
1228
|
+
const h = f - g + l + 1;
|
|
1348
1229
|
d.push(
|
|
1349
1230
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1350
1231
|
ButtonIcon,
|
|
@@ -1354,7 +1235,7 @@ const CalendarHeader = () => {
|
|
|
1354
1235
|
"aria-label": "Previous month day",
|
|
1355
1236
|
variant: "ghost",
|
|
1356
1237
|
onClick: () => {
|
|
1357
|
-
s?.([null, null]),
|
|
1238
|
+
s?.([null, null]), o(m), n(b);
|
|
1358
1239
|
}
|
|
1359
1240
|
},
|
|
1360
1241
|
"prev-" + l
|
|
@@ -1362,7 +1243,7 @@ const CalendarHeader = () => {
|
|
|
1362
1243
|
);
|
|
1363
1244
|
}
|
|
1364
1245
|
for (let l = 1; l <= c; l++) {
|
|
1365
|
-
const h =
|
|
1246
|
+
const h = x(l), E = S(l), C = N(l);
|
|
1366
1247
|
d.push(
|
|
1367
1248
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1368
1249
|
ButtonIcon,
|
|
@@ -1372,19 +1253,19 @@ const CalendarHeader = () => {
|
|
|
1372
1253
|
{
|
|
1373
1254
|
as: "span",
|
|
1374
1255
|
fontSize: "sm",
|
|
1375
|
-
color: h ||
|
|
1256
|
+
color: h || E || C ? "inherit" : "ghost",
|
|
1376
1257
|
className: cn(
|
|
1377
1258
|
h && " bg-primary text-white",
|
|
1378
|
-
|
|
1379
|
-
|
|
1259
|
+
E && "rounded-l-full bg-primary text-white",
|
|
1260
|
+
C && "rounded-r-full bg-primary text-white"
|
|
1380
1261
|
),
|
|
1381
1262
|
children: l
|
|
1382
1263
|
}
|
|
1383
1264
|
),
|
|
1384
|
-
variant:
|
|
1265
|
+
variant: E || C || h ? "primary" : "ghost",
|
|
1385
1266
|
size: "sm",
|
|
1386
1267
|
"aria-label": `Select ${e}-${t + 1}-${l}`,
|
|
1387
|
-
"aria-current":
|
|
1268
|
+
"aria-current": E || C ? "date" : void 0,
|
|
1388
1269
|
onClick: () => {
|
|
1389
1270
|
if (!Array.isArray(r) || !r[0] || r[0] && r[1])
|
|
1390
1271
|
s?.([new Date(e, t, l), null]);
|
|
@@ -1398,8 +1279,8 @@ const CalendarHeader = () => {
|
|
|
1398
1279
|
)
|
|
1399
1280
|
);
|
|
1400
1281
|
}
|
|
1401
|
-
const
|
|
1402
|
-
for (let l = 0; l < (
|
|
1282
|
+
const I = g + c;
|
|
1283
|
+
for (let l = 0; l < (I % 7 === 0 ? 0 : 7 - I % 7); l++)
|
|
1403
1284
|
d.push(
|
|
1404
1285
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1405
1286
|
ButtonIcon,
|
|
@@ -1409,7 +1290,7 @@ const CalendarHeader = () => {
|
|
|
1409
1290
|
"aria-label": "Next month day",
|
|
1410
1291
|
variant: "ghost",
|
|
1411
1292
|
onClick: () => {
|
|
1412
|
-
s?.([null, null]),
|
|
1293
|
+
s?.([null, null]), o(p), n(y);
|
|
1413
1294
|
}
|
|
1414
1295
|
},
|
|
1415
1296
|
"next-" + l
|
|
@@ -1425,35 +1306,35 @@ function useCalendar({
|
|
|
1425
1306
|
type: t,
|
|
1426
1307
|
onChange: r,
|
|
1427
1308
|
initialYear: s,
|
|
1428
|
-
initialMonth:
|
|
1309
|
+
initialMonth: o
|
|
1429
1310
|
}) {
|
|
1430
|
-
const [
|
|
1311
|
+
const [n, i] = useState(o), [a, g] = useState(s), [c, m] = useState([
|
|
1431
1312
|
null,
|
|
1432
1313
|
null
|
|
1433
1314
|
]);
|
|
1434
1315
|
let b = e;
|
|
1435
1316
|
t === "range" && !e && (b = c);
|
|
1436
1317
|
const f = useCallback(() => {
|
|
1437
|
-
const d =
|
|
1438
|
-
i(d),
|
|
1439
|
-
}, [
|
|
1440
|
-
const d =
|
|
1441
|
-
i(d),
|
|
1442
|
-
}, [
|
|
1318
|
+
const d = n === 0 ? 11 : n - 1, v = n === 0 ? a - 1 : a;
|
|
1319
|
+
i(d), g(v), t === "single" && r?.(new Date(v, d, 1));
|
|
1320
|
+
}, [n, a, t, r]), p = useCallback(() => {
|
|
1321
|
+
const d = n === 11 ? 0 : n + 1, v = n === 11 ? a + 1 : a;
|
|
1322
|
+
i(d), g(v), t === "single" && r?.(new Date(v, d, 1));
|
|
1323
|
+
}, [n, a, t, r]), y = useCallback(
|
|
1443
1324
|
(d) => {
|
|
1444
|
-
t === "single" ? r?.(d) : t === "range" && (
|
|
1325
|
+
t === "single" ? r?.(d) : t === "range" && (m(d), r?.(d));
|
|
1445
1326
|
},
|
|
1446
1327
|
[t, r]
|
|
1447
1328
|
);
|
|
1448
1329
|
return {
|
|
1449
1330
|
year: a,
|
|
1450
|
-
month:
|
|
1331
|
+
month: n,
|
|
1451
1332
|
value: b,
|
|
1452
1333
|
setMonth: i,
|
|
1453
|
-
setYear:
|
|
1334
|
+
setYear: g,
|
|
1454
1335
|
onChange: y,
|
|
1455
1336
|
handlePrevMonth: f,
|
|
1456
|
-
handleNextMonth:
|
|
1337
|
+
handleNextMonth: p
|
|
1457
1338
|
};
|
|
1458
1339
|
}
|
|
1459
1340
|
const CalendarRoot = ({
|
|
@@ -1461,14 +1342,14 @@ const CalendarRoot = ({
|
|
|
1461
1342
|
onChange: t,
|
|
1462
1343
|
className: r,
|
|
1463
1344
|
type: s = "single",
|
|
1464
|
-
...
|
|
1345
|
+
...o
|
|
1465
1346
|
}) => {
|
|
1466
|
-
const
|
|
1347
|
+
const n = /* @__PURE__ */ new Date(), i = useCalendar({
|
|
1467
1348
|
value: e,
|
|
1468
1349
|
onChange: t,
|
|
1469
1350
|
type: s,
|
|
1470
|
-
initialYear:
|
|
1471
|
-
initialMonth:
|
|
1351
|
+
initialYear: n.getFullYear(),
|
|
1352
|
+
initialMonth: n.getMonth()
|
|
1472
1353
|
});
|
|
1473
1354
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1474
1355
|
CalendarContext.Provider,
|
|
@@ -1482,7 +1363,7 @@ const CalendarRoot = ({
|
|
|
1482
1363
|
setYear: i.setYear,
|
|
1483
1364
|
onChange: i.onChange
|
|
1484
1365
|
},
|
|
1485
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("select-none", r), ...
|
|
1366
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("select-none", r), ...o, children: [
|
|
1486
1367
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarHeader, {}),
|
|
1487
1368
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarWeekdays, {}),
|
|
1488
1369
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarDays, {})
|
|
@@ -1560,7 +1441,7 @@ const getTableColumnClass = (e) => {
|
|
|
1560
1441
|
}
|
|
1561
1442
|
}, TableHeader = forwardRef(
|
|
1562
1443
|
({ children: e, className: t, ...r }, s) => {
|
|
1563
|
-
const {
|
|
1444
|
+
const { columns: o } = useTableContext();
|
|
1564
1445
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1565
1446
|
"div",
|
|
1566
1447
|
{
|
|
@@ -1572,7 +1453,7 @@ const getTableColumnClass = (e) => {
|
|
|
1572
1453
|
"div",
|
|
1573
1454
|
{
|
|
1574
1455
|
role: "row",
|
|
1575
|
-
className: cn("grid gap-4", getTableColumnClass(
|
|
1456
|
+
className: cn("grid gap-4", getTableColumnClass(o)),
|
|
1576
1457
|
children: e
|
|
1577
1458
|
}
|
|
1578
1459
|
)
|
|
@@ -1583,7 +1464,7 @@ const getTableColumnClass = (e) => {
|
|
|
1583
1464
|
({ children: e, className: t, ...r }, s) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { role: "rowgroup", ref: s, className: cn(t), ...r, children: e })
|
|
1584
1465
|
), TableFooter = forwardRef(
|
|
1585
1466
|
({ children: e, className: t, ...r }, s) => {
|
|
1586
|
-
const {
|
|
1467
|
+
const { columns: o } = useTableContext();
|
|
1587
1468
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1588
1469
|
"div",
|
|
1589
1470
|
{
|
|
@@ -1595,7 +1476,7 @@ const getTableColumnClass = (e) => {
|
|
|
1595
1476
|
"div",
|
|
1596
1477
|
{
|
|
1597
1478
|
role: "row",
|
|
1598
|
-
className: cn("grid gap-4", getTableColumnClass(
|
|
1479
|
+
className: cn("grid gap-4", getTableColumnClass(o)),
|
|
1599
1480
|
children: e
|
|
1600
1481
|
}
|
|
1601
1482
|
)
|
|
@@ -1604,14 +1485,14 @@ const getTableColumnClass = (e) => {
|
|
|
1604
1485
|
}
|
|
1605
1486
|
), TableRow = forwardRef(
|
|
1606
1487
|
({ children: e, className: t, ...r }, s) => {
|
|
1607
|
-
const {
|
|
1488
|
+
const { columns: o } = useTableContext();
|
|
1608
1489
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1609
1490
|
"div",
|
|
1610
1491
|
{
|
|
1611
1492
|
role: "row",
|
|
1612
1493
|
className: cn(
|
|
1613
1494
|
"grid gap-4",
|
|
1614
|
-
getTableColumnClass(
|
|
1495
|
+
getTableColumnClass(o),
|
|
1615
1496
|
"border-b border-border last:border-0",
|
|
1616
1497
|
t
|
|
1617
1498
|
),
|
|
@@ -1622,10 +1503,10 @@ const getTableColumnClass = (e) => {
|
|
|
1622
1503
|
);
|
|
1623
1504
|
}
|
|
1624
1505
|
), TableColumn = forwardRef(
|
|
1625
|
-
({ as: e = "td", span: t, align: r = "left", children: s, className:
|
|
1506
|
+
({ as: e = "td", span: t, align: r = "left", children: s, className: o, ...n }, i) => {
|
|
1626
1507
|
const a = e === "th" ? "columnheader" : "cell";
|
|
1627
|
-
let
|
|
1628
|
-
return r === "center" ?
|
|
1508
|
+
let g = "text-left";
|
|
1509
|
+
return r === "center" ? g = "text-center" : r === "right" && (g = "text-right"), /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1629
1510
|
"div",
|
|
1630
1511
|
{
|
|
1631
1512
|
ref: i,
|
|
@@ -1634,40 +1515,66 @@ const getTableColumnClass = (e) => {
|
|
|
1634
1515
|
"px-4 py-2",
|
|
1635
1516
|
"[&:not(:last-child)]:border-r [&:not(:last-child)]:border-border",
|
|
1636
1517
|
getRowSpanClass(t),
|
|
1637
|
-
|
|
1638
|
-
|
|
1518
|
+
g,
|
|
1519
|
+
"truncate overflow-hidden whitespace-nowrap",
|
|
1520
|
+
o
|
|
1639
1521
|
),
|
|
1640
|
-
...
|
|
1522
|
+
...n,
|
|
1641
1523
|
children: s
|
|
1642
1524
|
}
|
|
1643
1525
|
);
|
|
1644
1526
|
}
|
|
1527
|
+
), TableRowItem = forwardRef(
|
|
1528
|
+
(e, t) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1529
|
+
TableColumn,
|
|
1530
|
+
{
|
|
1531
|
+
...e,
|
|
1532
|
+
as: "td",
|
|
1533
|
+
ref: t,
|
|
1534
|
+
className: cn(
|
|
1535
|
+
"truncate overflow-hidden whitespace-nowrap",
|
|
1536
|
+
e.className
|
|
1537
|
+
)
|
|
1538
|
+
}
|
|
1539
|
+
)
|
|
1540
|
+
), TableHeaderItem = forwardRef(
|
|
1541
|
+
(e, t) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1542
|
+
TableColumn,
|
|
1543
|
+
{
|
|
1544
|
+
...e,
|
|
1545
|
+
as: "th",
|
|
1546
|
+
ref: t,
|
|
1547
|
+
className: cn(
|
|
1548
|
+
"truncate overflow-hidden whitespace-nowrap",
|
|
1549
|
+
e.className
|
|
1550
|
+
)
|
|
1551
|
+
}
|
|
1552
|
+
)
|
|
1645
1553
|
), TableRoot = forwardRef(
|
|
1646
|
-
({ children: e, className: t,
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
) });
|
|
1664
|
-
}
|
|
1554
|
+
({ children: e, className: t, columns: r = 12, ...s }, o) => /* @__PURE__ */ jsxRuntimeExports.jsx(TableProvider, { value: { columns: r }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1555
|
+
"div",
|
|
1556
|
+
{
|
|
1557
|
+
ref: o,
|
|
1558
|
+
role: "table",
|
|
1559
|
+
className: cn(
|
|
1560
|
+
// Versaur design system: border, background, shadow, rounded, spacing
|
|
1561
|
+
"w-full overflow-x-auto border border-border bg-background rounded-lg ",
|
|
1562
|
+
"text-foreground",
|
|
1563
|
+
"sm:rounded-xl",
|
|
1564
|
+
"transition-colors",
|
|
1565
|
+
t
|
|
1566
|
+
),
|
|
1567
|
+
...s,
|
|
1568
|
+
children: e
|
|
1569
|
+
}
|
|
1570
|
+
) })
|
|
1665
1571
|
), Table = Object.assign(TableRoot, {
|
|
1666
1572
|
Header: TableHeader,
|
|
1573
|
+
HeaderItem: TableHeaderItem,
|
|
1667
1574
|
Body: TableBody,
|
|
1668
1575
|
Footer: TableFooter,
|
|
1669
1576
|
Row: TableRow,
|
|
1670
|
-
|
|
1577
|
+
RowItem: TableRowItem
|
|
1671
1578
|
}), tileVariants = cva(
|
|
1672
1579
|
// Base classes
|
|
1673
1580
|
"block transition-colors duration-200",
|
|
@@ -1704,12 +1611,12 @@ const getTableColumnClass = (e) => {
|
|
|
1704
1611
|
}
|
|
1705
1612
|
}
|
|
1706
1613
|
), Tile = forwardRef(
|
|
1707
|
-
({ variant: e = "white", size: t = "md", shape: r = "rounded", className: s, ...
|
|
1614
|
+
({ variant: e = "white", size: t = "md", shape: r = "rounded", className: s, ...o }, n) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1708
1615
|
"div",
|
|
1709
1616
|
{
|
|
1710
|
-
ref:
|
|
1617
|
+
ref: n,
|
|
1711
1618
|
className: cn(tileVariants({ variant: e, size: t, shape: r }), s),
|
|
1712
|
-
...
|
|
1619
|
+
...o
|
|
1713
1620
|
}
|
|
1714
1621
|
)
|
|
1715
1622
|
);
|
|
@@ -1743,19 +1650,19 @@ function getColSpan(e = 4) {
|
|
|
1743
1650
|
return "col-span-4";
|
|
1744
1651
|
}
|
|
1745
1652
|
}
|
|
1746
|
-
const DescriptionListItem = forwardRef(function e({ children: t, className: r, span: s = 4, ...
|
|
1653
|
+
const DescriptionListItem = forwardRef(function e({ children: t, className: r, span: s = 4, ...o }, n) {
|
|
1747
1654
|
const i = getColSpan(s);
|
|
1748
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref:
|
|
1655
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: n, className: cn(i, r), ...o, children: t });
|
|
1749
1656
|
}), DescriptionListTerm = forwardRef(function e({ children: t, ...r }, s) {
|
|
1750
1657
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("dt", { ref: s, ...r, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", fontWeight: "medium", color: "gray", children: t }) });
|
|
1751
|
-
}), DescriptionListDetails = forwardRef(function e({ children: t, color: r = "black", ...s },
|
|
1752
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("dd", { ref:
|
|
1658
|
+
}), DescriptionListDetails = forwardRef(function e({ children: t, color: r = "black", ...s }, o) {
|
|
1659
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("dd", { ref: o, ...s, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "base", fontWeight: "medium", color: r, children: t }) });
|
|
1753
1660
|
}), DescriptionListRoot = forwardRef(
|
|
1754
|
-
function e({ children: t, className: r, ...s },
|
|
1661
|
+
function e({ children: t, className: r, ...s }, o) {
|
|
1755
1662
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1756
1663
|
"dl",
|
|
1757
1664
|
{
|
|
1758
|
-
ref:
|
|
1665
|
+
ref: o,
|
|
1759
1666
|
className: cn("grid grid-cols-12 gap-y-4", r),
|
|
1760
1667
|
...s,
|
|
1761
1668
|
children: t
|
|
@@ -1767,6 +1674,188 @@ const DescriptionListItem = forwardRef(function e({ children: t, className: r, s
|
|
|
1767
1674
|
Term: DescriptionListTerm,
|
|
1768
1675
|
Details: DescriptionListDetails
|
|
1769
1676
|
});
|
|
1677
|
+
function useImage({ src: e }) {
|
|
1678
|
+
const [t, r] = useState(!1), [s, o] = useState(!1), n = useRef(!1), i = () => {
|
|
1679
|
+
r(!0);
|
|
1680
|
+
}, a = () => {
|
|
1681
|
+
o(!0);
|
|
1682
|
+
};
|
|
1683
|
+
return useEffect(() => {
|
|
1684
|
+
if (!e) return;
|
|
1685
|
+
const g = new Image();
|
|
1686
|
+
return g.src = e, g.onload = () => {
|
|
1687
|
+
n.current || r(!0);
|
|
1688
|
+
}, g.onerror = () => {
|
|
1689
|
+
n.current || o(!0);
|
|
1690
|
+
}, () => {
|
|
1691
|
+
n.current = !0;
|
|
1692
|
+
};
|
|
1693
|
+
}, [e]), {
|
|
1694
|
+
loaded: t,
|
|
1695
|
+
errored: s,
|
|
1696
|
+
handleLoad: i,
|
|
1697
|
+
handleError: a
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1700
|
+
const imageVariants = cva("block object-cover", {
|
|
1701
|
+
variants: {
|
|
1702
|
+
position: {
|
|
1703
|
+
cover: "object-cover",
|
|
1704
|
+
contain: "object-contain",
|
|
1705
|
+
center: "object-center",
|
|
1706
|
+
top: "object-top",
|
|
1707
|
+
bottom: "object-bottom",
|
|
1708
|
+
left: "object-left",
|
|
1709
|
+
right: "object-right",
|
|
1710
|
+
none: ""
|
|
1711
|
+
},
|
|
1712
|
+
size: {
|
|
1713
|
+
sm: "w-16 h-16",
|
|
1714
|
+
md: "w-32 h-32",
|
|
1715
|
+
lg: "w-48 h-48",
|
|
1716
|
+
full: "w-full h-full",
|
|
1717
|
+
auto: ""
|
|
1718
|
+
},
|
|
1719
|
+
shape: {
|
|
1720
|
+
rectangle: "rounded",
|
|
1721
|
+
square: "aspect-square rounded",
|
|
1722
|
+
circle: "rounded-full aspect-square"
|
|
1723
|
+
}
|
|
1724
|
+
},
|
|
1725
|
+
defaultVariants: {
|
|
1726
|
+
position: "cover",
|
|
1727
|
+
size: "auto",
|
|
1728
|
+
shape: "rectangle"
|
|
1729
|
+
}
|
|
1730
|
+
}), imageAtomVariants = cva(
|
|
1731
|
+
"flex items-center justify-center bg-neutral-soft text-ghost border border-border",
|
|
1732
|
+
{
|
|
1733
|
+
variants: {
|
|
1734
|
+
shape: {
|
|
1735
|
+
rectangle: "rounded",
|
|
1736
|
+
square: "aspect-square rounded",
|
|
1737
|
+
circle: "rounded-full aspect-square"
|
|
1738
|
+
},
|
|
1739
|
+
size: {
|
|
1740
|
+
sm: "w-16 h-16",
|
|
1741
|
+
md: "w-32 h-32",
|
|
1742
|
+
lg: "w-48 h-48",
|
|
1743
|
+
full: "w-full h-full",
|
|
1744
|
+
auto: "w-full h-full"
|
|
1745
|
+
}
|
|
1746
|
+
},
|
|
1747
|
+
defaultVariants: {
|
|
1748
|
+
shape: "rectangle",
|
|
1749
|
+
size: "auto"
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
);
|
|
1753
|
+
function BaseImageSkeleton({
|
|
1754
|
+
className: e,
|
|
1755
|
+
shape: t,
|
|
1756
|
+
size: r,
|
|
1757
|
+
height: s,
|
|
1758
|
+
width: o
|
|
1759
|
+
}) {
|
|
1760
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1761
|
+
Skeleton,
|
|
1762
|
+
{
|
|
1763
|
+
className: cn(imageAtomVariants({ shape: t, size: r }), e),
|
|
1764
|
+
style: { height: s, width: o }
|
|
1765
|
+
}
|
|
1766
|
+
);
|
|
1767
|
+
}
|
|
1768
|
+
function BaseImageFallback({
|
|
1769
|
+
alt: e,
|
|
1770
|
+
width: t,
|
|
1771
|
+
height: r,
|
|
1772
|
+
className: s,
|
|
1773
|
+
style: o,
|
|
1774
|
+
shape: n,
|
|
1775
|
+
size: i
|
|
1776
|
+
}) {
|
|
1777
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1778
|
+
"div",
|
|
1779
|
+
{
|
|
1780
|
+
className: imageAtomVariants({ shape: n, size: i, className: s }),
|
|
1781
|
+
style: { width: t, height: r, ...o },
|
|
1782
|
+
"aria-label": e,
|
|
1783
|
+
role: "img",
|
|
1784
|
+
children: [
|
|
1785
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1786
|
+
ImageOff,
|
|
1787
|
+
{
|
|
1788
|
+
size: 32,
|
|
1789
|
+
style: { opacity: 0.5, marginRight: 4 },
|
|
1790
|
+
"aria-hidden": "true"
|
|
1791
|
+
}
|
|
1792
|
+
),
|
|
1793
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { opacity: 0.7 }, children: e })
|
|
1794
|
+
]
|
|
1795
|
+
}
|
|
1796
|
+
);
|
|
1797
|
+
}
|
|
1798
|
+
const BaseImage = forwardRef(
|
|
1799
|
+
({
|
|
1800
|
+
src: e,
|
|
1801
|
+
alt: t,
|
|
1802
|
+
onLoad: r,
|
|
1803
|
+
onError: s,
|
|
1804
|
+
width: o,
|
|
1805
|
+
height: n,
|
|
1806
|
+
loading: i = "lazy",
|
|
1807
|
+
position: a = "cover",
|
|
1808
|
+
size: g = "auto",
|
|
1809
|
+
shape: c,
|
|
1810
|
+
className: m,
|
|
1811
|
+
...b
|
|
1812
|
+
}, f) => {
|
|
1813
|
+
const { loaded: p, errored: y, handleLoad: d, handleError: v } = useImage({
|
|
1814
|
+
src: e
|
|
1815
|
+
}), w = typeof o == "number" ? o : Number(o), u = typeof n == "number" ? n : Number(n);
|
|
1816
|
+
return !p && !y ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1817
|
+
BaseImageSkeleton,
|
|
1818
|
+
{
|
|
1819
|
+
shape: c,
|
|
1820
|
+
width: w,
|
|
1821
|
+
height: u
|
|
1822
|
+
}
|
|
1823
|
+
) : y ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1824
|
+
BaseImageFallback,
|
|
1825
|
+
{
|
|
1826
|
+
shape: c,
|
|
1827
|
+
alt: t,
|
|
1828
|
+
width: w,
|
|
1829
|
+
height: u
|
|
1830
|
+
}
|
|
1831
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1832
|
+
"img",
|
|
1833
|
+
{
|
|
1834
|
+
ref: f,
|
|
1835
|
+
src: e,
|
|
1836
|
+
alt: t,
|
|
1837
|
+
width: w,
|
|
1838
|
+
height: u,
|
|
1839
|
+
loading: i,
|
|
1840
|
+
className: cn(
|
|
1841
|
+
imageVariants({
|
|
1842
|
+
position: a,
|
|
1843
|
+
size: g,
|
|
1844
|
+
shape: c
|
|
1845
|
+
}),
|
|
1846
|
+
m
|
|
1847
|
+
),
|
|
1848
|
+
onLoad: (x) => {
|
|
1849
|
+
d(), r?.(x);
|
|
1850
|
+
},
|
|
1851
|
+
onError: (x) => {
|
|
1852
|
+
v(), s?.(x);
|
|
1853
|
+
},
|
|
1854
|
+
...b
|
|
1855
|
+
}
|
|
1856
|
+
);
|
|
1857
|
+
}
|
|
1858
|
+
), ImageCircle = forwardRef((e, t) => /* @__PURE__ */ jsxRuntimeExports.jsx(BaseImage, { ref: t, ...e, shape: "circle" })), ImageSquare = forwardRef((e, t) => /* @__PURE__ */ jsxRuntimeExports.jsx(BaseImage, { ref: t, ...e, shape: "square" })), ImageRectangle = forwardRef((e, t) => /* @__PURE__ */ jsxRuntimeExports.jsx(BaseImage, { ref: t, ...e, shape: "rectangle" }));
|
|
1770
1859
|
export {
|
|
1771
1860
|
Alert as A,
|
|
1772
1861
|
Badge as B,
|
|
@@ -1781,6 +1870,9 @@ export {
|
|
|
1781
1870
|
ButtonFloat as e,
|
|
1782
1871
|
ButtonIcon as f,
|
|
1783
1872
|
Calendar as g,
|
|
1784
|
-
|
|
1785
|
-
|
|
1873
|
+
Tile as h,
|
|
1874
|
+
ImageCircle as i,
|
|
1875
|
+
ImageSquare as j,
|
|
1876
|
+
ImageRectangle as k,
|
|
1877
|
+
BaseImage as l
|
|
1786
1878
|
};
|