@dimasbaguspm/versaur 0.0.19 → 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/{selectable-multiple-input-CJXfqy1Z.js → bottom-sheet-input-C7cYfBaK.js} +591 -476
- package/dist/js/forms/index.js +20 -17
- package/dist/js/{image-rectangle-CLU-GVtw.js → image-rectangle-DH7v2xvp.js} +300 -395
- package/dist/js/index.js +63 -56
- package/dist/js/layouts/index.js +5 -4
- package/dist/js/overlays/index.js +6 -4
- package/dist/js/primitive/index.js +10 -9
- 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 +3 -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/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/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 +5 -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,44 +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
|
|
3
|
+
import React__default, { forwardRef, useState, useEffect, useCallback, useRef, createContext, useContext } from "react";
|
|
4
4
|
import { X, ChevronLeft, ChevronRight, ImageOff } from "lucide-react";
|
|
5
|
+
import { T as Text } from "./text-CRsIInRA.js";
|
|
5
6
|
import { S as Skeleton } from "./skeleton-BNZyaRjo.js";
|
|
6
|
-
const
|
|
7
|
-
variants: {
|
|
8
|
-
size: {
|
|
9
|
-
xs: "w-3 h-3",
|
|
10
|
-
sm: "w-4 h-4",
|
|
11
|
-
md: "w-5 h-5",
|
|
12
|
-
lg: "w-6 h-6",
|
|
13
|
-
xl: "w-8 h-8"
|
|
14
|
-
},
|
|
15
|
-
color: {
|
|
16
|
-
primary: "text-primary",
|
|
17
|
-
secondary: "text-secondary",
|
|
18
|
-
tertiary: "text-tertiary",
|
|
19
|
-
ghost: "text-ghost",
|
|
20
|
-
neutral: "text-neutral",
|
|
21
|
-
success: "text-success",
|
|
22
|
-
info: "text-info",
|
|
23
|
-
warning: "text-warning",
|
|
24
|
-
danger: "text-danger",
|
|
25
|
-
inherit: ""
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
defaultVariants: {
|
|
29
|
-
size: "md",
|
|
30
|
-
color: "primary"
|
|
31
|
-
}
|
|
32
|
-
}), Icon = React__default.forwardRef(function({ as: t, color: r = "primary", size: s = "md", className: n, ...o }, i) {
|
|
33
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
34
|
-
t,
|
|
35
|
-
{
|
|
36
|
-
ref: i,
|
|
37
|
-
className: iconVariants({ color: r, size: s, className: n }),
|
|
38
|
-
...o
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
}), alertVariants = cva(
|
|
7
|
+
const alertVariants = cva(
|
|
42
8
|
"relative flex items-center gap-2 rounded-md p-2 text-sm transition-all duration-200",
|
|
43
9
|
{
|
|
44
10
|
variants: {
|
|
@@ -181,18 +147,18 @@ const iconVariants = cva("inline-flex items-center justify-center", {
|
|
|
181
147
|
color: t = "neutral",
|
|
182
148
|
icon: r,
|
|
183
149
|
className: s,
|
|
184
|
-
children:
|
|
185
|
-
...
|
|
150
|
+
children: o,
|
|
151
|
+
...n
|
|
186
152
|
}, i) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
187
153
|
"div",
|
|
188
154
|
{
|
|
189
155
|
ref: i,
|
|
190
156
|
role: "alert",
|
|
191
157
|
className: cn(alertVariants({ variant: e, color: t }), s),
|
|
192
|
-
...
|
|
158
|
+
...n,
|
|
193
159
|
children: [
|
|
194
160
|
r && /* @__PURE__ */ jsxRuntimeExports.jsx(AlertIcon, { children: r }),
|
|
195
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children:
|
|
161
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: o })
|
|
196
162
|
]
|
|
197
163
|
}
|
|
198
164
|
)
|
|
@@ -261,15 +227,15 @@ const iconVariants = cva("inline-flex items-center justify-center", {
|
|
|
261
227
|
className: t,
|
|
262
228
|
color: r = "primary",
|
|
263
229
|
fontSize: s = "base",
|
|
264
|
-
fontWeight:
|
|
265
|
-
quiet:
|
|
230
|
+
fontWeight: o = "medium",
|
|
231
|
+
quiet: n = !1,
|
|
266
232
|
...i
|
|
267
233
|
}, a) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
268
234
|
"a",
|
|
269
235
|
{
|
|
270
236
|
ref: a,
|
|
271
237
|
className: cn(
|
|
272
|
-
anchorVariants({ color: r, fontSize: s, fontWeight:
|
|
238
|
+
anchorVariants({ color: r, fontSize: s, fontWeight: o, quiet: n }),
|
|
273
239
|
t
|
|
274
240
|
),
|
|
275
241
|
...i,
|
|
@@ -320,38 +286,38 @@ const iconVariants = cva("inline-flex items-center justify-center", {
|
|
|
320
286
|
size: t = "md",
|
|
321
287
|
shape: r = "circle",
|
|
322
288
|
className: s,
|
|
323
|
-
children:
|
|
324
|
-
...
|
|
289
|
+
children: o,
|
|
290
|
+
...n
|
|
325
291
|
}, i) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
326
292
|
"div",
|
|
327
293
|
{
|
|
328
294
|
ref: i,
|
|
329
295
|
className: cn(avatarVariants({ variant: e, size: t, shape: r }), s),
|
|
330
|
-
...
|
|
331
|
-
children:
|
|
296
|
+
...n,
|
|
297
|
+
children: o
|
|
332
298
|
}
|
|
333
299
|
)
|
|
334
300
|
), AvatarImage = forwardRef(
|
|
335
|
-
({ src: e, alt: t, className: r, onError: s, ...
|
|
301
|
+
({ src: e, alt: t, className: r, onError: s, ...o }, n) => {
|
|
336
302
|
const [i, a] = useState(!1);
|
|
337
303
|
useEffect(() => {
|
|
338
304
|
a(!1);
|
|
339
305
|
}, [e]);
|
|
340
|
-
const
|
|
341
|
-
(
|
|
342
|
-
a(!0), s?.(
|
|
306
|
+
const g = useCallback(
|
|
307
|
+
(c) => {
|
|
308
|
+
a(!0), s?.(c);
|
|
343
309
|
},
|
|
344
310
|
[s]
|
|
345
311
|
);
|
|
346
312
|
return i ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
347
313
|
"img",
|
|
348
314
|
{
|
|
349
|
-
ref:
|
|
315
|
+
ref: n,
|
|
350
316
|
src: e,
|
|
351
317
|
alt: t,
|
|
352
318
|
className: cn(avatarImageVariants(), r),
|
|
353
|
-
onError:
|
|
354
|
-
...
|
|
319
|
+
onError: g,
|
|
320
|
+
...o
|
|
355
321
|
}
|
|
356
322
|
);
|
|
357
323
|
}
|
|
@@ -519,17 +485,17 @@ const iconVariants = cva("inline-flex items-center justify-center", {
|
|
|
519
485
|
shape: t = "square",
|
|
520
486
|
color: r = "primary",
|
|
521
487
|
size: s = "md",
|
|
522
|
-
iconLeft:
|
|
523
|
-
iconRight:
|
|
488
|
+
iconLeft: o,
|
|
489
|
+
iconRight: n,
|
|
524
490
|
className: i,
|
|
525
491
|
children: a,
|
|
526
|
-
...
|
|
527
|
-
},
|
|
528
|
-
const f = !(a != null && a !== "") && !!(
|
|
492
|
+
...g
|
|
493
|
+
}, c) => {
|
|
494
|
+
const f = !(a != null && a !== "") && !!(o || n);
|
|
529
495
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
530
496
|
"span",
|
|
531
497
|
{
|
|
532
|
-
ref:
|
|
498
|
+
ref: c,
|
|
533
499
|
className: cn(
|
|
534
500
|
badgeVariants({
|
|
535
501
|
variant: e,
|
|
@@ -540,16 +506,16 @@ const iconVariants = cva("inline-flex items-center justify-center", {
|
|
|
540
506
|
}),
|
|
541
507
|
i
|
|
542
508
|
),
|
|
543
|
-
...
|
|
509
|
+
...g,
|
|
544
510
|
children: f ? (
|
|
545
511
|
// Icon-only mode: display only the icon
|
|
546
|
-
|
|
512
|
+
o || n
|
|
547
513
|
) : (
|
|
548
514
|
// Normal mode: display icon(s) and text
|
|
549
515
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
550
|
-
|
|
516
|
+
o,
|
|
551
517
|
a,
|
|
552
|
-
|
|
518
|
+
n
|
|
553
519
|
] })
|
|
554
520
|
)
|
|
555
521
|
}
|
|
@@ -572,13 +538,13 @@ const SvgSpenicleSquare = (e) => /* @__PURE__ */ React.createElement("svg", { wi
|
|
|
572
538
|
}
|
|
573
539
|
}), BrandLogo = forwardRef(
|
|
574
540
|
({ shape: e = "square", size: t, ...r }, s) => {
|
|
575
|
-
const
|
|
541
|
+
const n = {
|
|
576
542
|
square: SvgSpenicleSquare,
|
|
577
543
|
rounded: SvgSpenicleRounded,
|
|
578
544
|
circle: SvgSpenicleCircle
|
|
579
545
|
}[e] || SvgSpenicleSquare;
|
|
580
546
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
581
|
-
|
|
547
|
+
n,
|
|
582
548
|
{
|
|
583
549
|
ref: s,
|
|
584
550
|
...r,
|
|
@@ -587,10 +553,10 @@ const SvgSpenicleSquare = (e) => /* @__PURE__ */ React.createElement("svg", { wi
|
|
|
587
553
|
);
|
|
588
554
|
}
|
|
589
555
|
), Brand = forwardRef(
|
|
590
|
-
({ name: e = "spenicle", size: t = "md", shape: r, ...s },
|
|
556
|
+
({ name: e = "spenicle", size: t = "md", shape: r, ...s }, o) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
591
557
|
"span",
|
|
592
558
|
{
|
|
593
|
-
ref:
|
|
559
|
+
ref: o,
|
|
594
560
|
className: cn("inline-flex items-center gap-2"),
|
|
595
561
|
...s,
|
|
596
562
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(BrandLogo, { shape: r, size: t, "aria-hidden": "true" })
|
|
@@ -651,20 +617,20 @@ const SvgSpenicleSquare = (e) => /* @__PURE__ */ React.createElement("svg", { wi
|
|
|
651
617
|
className: t,
|
|
652
618
|
variant: r = "primary",
|
|
653
619
|
size: s = "md",
|
|
654
|
-
disabled:
|
|
655
|
-
type:
|
|
620
|
+
disabled: o = !1,
|
|
621
|
+
type: n = "button",
|
|
656
622
|
children: i,
|
|
657
623
|
...a
|
|
658
|
-
},
|
|
624
|
+
}, g) {
|
|
659
625
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
660
626
|
"button",
|
|
661
627
|
{
|
|
662
|
-
ref:
|
|
663
|
-
type:
|
|
628
|
+
ref: g,
|
|
629
|
+
type: n,
|
|
664
630
|
className: cn(buttonVariants({ variant: r, size: s }), t),
|
|
665
|
-
disabled:
|
|
666
|
-
"aria-disabled":
|
|
667
|
-
inert:
|
|
631
|
+
disabled: o,
|
|
632
|
+
"aria-disabled": o,
|
|
633
|
+
inert: o ? !0 : void 0,
|
|
668
634
|
...a,
|
|
669
635
|
children: i
|
|
670
636
|
}
|
|
@@ -738,64 +704,64 @@ const SvgSpenicleSquare = (e) => /* @__PURE__ */ React.createElement("svg", { wi
|
|
|
738
704
|
}
|
|
739
705
|
);
|
|
740
706
|
function useFloatingPosition(e, t = "1rem") {
|
|
741
|
-
const r = useRef(null), [s,
|
|
742
|
-
const
|
|
743
|
-
if (!
|
|
744
|
-
const
|
|
707
|
+
const r = useRef(null), [s, o] = useState({}), [n, i] = useState("fixed bottom-4 right-4"), a = useCallback(() => {
|
|
708
|
+
const c = r.current;
|
|
709
|
+
if (!c) return;
|
|
710
|
+
const b = c.getBoundingClientRect().height > window.innerHeight;
|
|
745
711
|
let f = {}, p = "";
|
|
746
|
-
|
|
712
|
+
b ? (f = {
|
|
747
713
|
position: "fixed",
|
|
748
714
|
bottom: t,
|
|
749
715
|
zIndex: 50,
|
|
750
|
-
transform: `translateY(${
|
|
716
|
+
transform: `translateY(${c.scrollTop}px)`
|
|
751
717
|
}, p = `fixed bottom-4 ${e}-4`) : (f = {
|
|
752
718
|
position: "fixed",
|
|
753
719
|
bottom: t,
|
|
754
720
|
zIndex: 50
|
|
755
|
-
}, p = `fixed bottom-4 ${e}-4`),
|
|
721
|
+
}, p = `fixed bottom-4 ${e}-4`), o(f), i(p);
|
|
756
722
|
}, [e, t]);
|
|
757
723
|
return useEffect(() => {
|
|
758
724
|
a();
|
|
759
|
-
const
|
|
760
|
-
return
|
|
761
|
-
|
|
725
|
+
const c = r.current;
|
|
726
|
+
return c && c.addEventListener("scroll", a), window.addEventListener("resize", a), () => {
|
|
727
|
+
c && c.removeEventListener("scroll", a), window.removeEventListener("resize", a);
|
|
762
728
|
};
|
|
763
729
|
}, [a]), useEffect(() => {
|
|
764
730
|
r.current && a();
|
|
765
731
|
}, [e, t, a]), [useCallback(
|
|
766
|
-
(
|
|
767
|
-
r.current =
|
|
732
|
+
(c) => {
|
|
733
|
+
r.current = c, c && a();
|
|
768
734
|
},
|
|
769
735
|
[a]
|
|
770
|
-
), s,
|
|
736
|
+
), s, n];
|
|
771
737
|
}
|
|
772
738
|
const ButtonFloat = forwardRef(
|
|
773
739
|
function({
|
|
774
740
|
className: t,
|
|
775
741
|
variant: r = "primary",
|
|
776
742
|
size: s = "md",
|
|
777
|
-
side:
|
|
778
|
-
offset:
|
|
743
|
+
side: o = "right",
|
|
744
|
+
offset: n = "1rem",
|
|
779
745
|
...i
|
|
780
746
|
}, a) {
|
|
781
|
-
const [
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
), [
|
|
747
|
+
const [g, c, m] = useFloatingPosition(
|
|
748
|
+
o,
|
|
749
|
+
n
|
|
750
|
+
), [b, f] = useState(!1);
|
|
785
751
|
return useEffect(() => {
|
|
786
752
|
f(!0);
|
|
787
|
-
}, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref:
|
|
753
|
+
}, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: g, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
788
754
|
"button",
|
|
789
755
|
{
|
|
790
756
|
ref: a,
|
|
791
757
|
type: i.type || "button",
|
|
792
758
|
className: cn(
|
|
793
759
|
buttonFloatVariants({ variant: r, size: s }),
|
|
794
|
-
|
|
795
|
-
|
|
760
|
+
m,
|
|
761
|
+
b && "animate-fab-in",
|
|
796
762
|
t
|
|
797
763
|
),
|
|
798
|
-
style:
|
|
764
|
+
style: c,
|
|
799
765
|
...i
|
|
800
766
|
}
|
|
801
767
|
) });
|
|
@@ -894,35 +860,70 @@ const buttonIconVariants = cva(
|
|
|
894
860
|
shape: "rounded"
|
|
895
861
|
}
|
|
896
862
|
}
|
|
897
|
-
),
|
|
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(
|
|
898
899
|
function({
|
|
899
900
|
className: t,
|
|
900
901
|
variant: r = "primary",
|
|
901
902
|
size: s = "md",
|
|
902
|
-
shape:
|
|
903
|
-
disabled:
|
|
903
|
+
shape: o = "rounded",
|
|
904
|
+
disabled: n = !1,
|
|
904
905
|
as: i,
|
|
905
906
|
"aria-label": a,
|
|
906
|
-
...
|
|
907
|
-
},
|
|
907
|
+
...g
|
|
908
|
+
}, c) {
|
|
908
909
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
909
910
|
"button",
|
|
910
911
|
{
|
|
911
|
-
ref:
|
|
912
|
+
ref: c,
|
|
912
913
|
type: "button",
|
|
913
914
|
className: cn(
|
|
914
915
|
buttonIconVariants({
|
|
915
916
|
variant: r,
|
|
916
917
|
size: s,
|
|
917
|
-
shape:
|
|
918
|
+
shape: o
|
|
918
919
|
}),
|
|
919
920
|
t
|
|
920
921
|
),
|
|
921
|
-
disabled:
|
|
922
|
-
"aria-disabled":
|
|
922
|
+
disabled: n,
|
|
923
|
+
"aria-disabled": n,
|
|
923
924
|
"aria-label": a,
|
|
924
|
-
inert:
|
|
925
|
-
...
|
|
925
|
+
inert: n ? !0 : void 0,
|
|
926
|
+
...g,
|
|
926
927
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
927
928
|
Icon,
|
|
928
929
|
{
|
|
@@ -1050,9 +1051,9 @@ const BUTTONS = [
|
|
|
1050
1051
|
onChange: t,
|
|
1051
1052
|
disabled: r,
|
|
1052
1053
|
className: s,
|
|
1053
|
-
"aria-label":
|
|
1054
|
-
},
|
|
1055
|
-
const { input: i, inputRef: a, handleButton:
|
|
1054
|
+
"aria-label": o
|
|
1055
|
+
}, n) => {
|
|
1056
|
+
const { input: i, inputRef: a, handleButton: g, handleInput: c } = useCalculator({
|
|
1056
1057
|
initialValue: e,
|
|
1057
1058
|
disabled: r,
|
|
1058
1059
|
onChange: t
|
|
@@ -1060,9 +1061,9 @@ const BUTTONS = [
|
|
|
1060
1061
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1061
1062
|
"div",
|
|
1062
1063
|
{
|
|
1063
|
-
ref:
|
|
1064
|
+
ref: n,
|
|
1064
1065
|
className: cn(calculatorRootVariants({ disabled: r }), s),
|
|
1065
|
-
"aria-label":
|
|
1066
|
+
"aria-label": o || "Calculator",
|
|
1066
1067
|
role: "region",
|
|
1067
1068
|
children: [
|
|
1068
1069
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -1071,20 +1072,20 @@ const BUTTONS = [
|
|
|
1071
1072
|
ref: a,
|
|
1072
1073
|
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)]",
|
|
1073
1074
|
value: i,
|
|
1074
|
-
onChange:
|
|
1075
|
+
onChange: c,
|
|
1075
1076
|
disabled: r,
|
|
1076
1077
|
inputMode: "decimal",
|
|
1077
1078
|
"aria-label": "Calculator input"
|
|
1078
1079
|
}
|
|
1079
1080
|
),
|
|
1080
|
-
/* @__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(
|
|
1081
1082
|
ButtonIcon,
|
|
1082
1083
|
{
|
|
1083
1084
|
as: X,
|
|
1084
1085
|
variant: "danger-ghost",
|
|
1085
1086
|
"aria-label": "Backspace",
|
|
1086
1087
|
size: "md",
|
|
1087
|
-
onClick: () =>
|
|
1088
|
+
onClick: () => g("⌫"),
|
|
1088
1089
|
disabled: r
|
|
1089
1090
|
},
|
|
1090
1091
|
"backspace"
|
|
@@ -1092,141 +1093,20 @@ const BUTTONS = [
|
|
|
1092
1093
|
CalculatorButton,
|
|
1093
1094
|
{
|
|
1094
1095
|
variant: f === "=" ? "action" : f === "C" ? "danger" : ["/", "*", "-", "+", "/"].includes(f) ? "operator" : "default",
|
|
1095
|
-
onClick: () =>
|
|
1096
|
+
onClick: () => g(f),
|
|
1096
1097
|
disabled: r,
|
|
1097
1098
|
"aria-label": f,
|
|
1098
1099
|
children: f
|
|
1099
1100
|
},
|
|
1100
1101
|
f
|
|
1101
|
-
)) },
|
|
1102
|
+
)) }, b)) })
|
|
1102
1103
|
]
|
|
1103
1104
|
}
|
|
1104
1105
|
);
|
|
1105
1106
|
}
|
|
1106
1107
|
);
|
|
1107
1108
|
Calculator.displayName = "Calculator";
|
|
1108
|
-
const
|
|
1109
|
-
variants: {
|
|
1110
|
-
color: {
|
|
1111
|
-
primary: "text-primary",
|
|
1112
|
-
secondary: "text-secondary",
|
|
1113
|
-
tertiary: "text-tertiary",
|
|
1114
|
-
ghost: "text-ghost",
|
|
1115
|
-
neutral: "text-ghost",
|
|
1116
|
-
success: "text-success",
|
|
1117
|
-
info: "text-info",
|
|
1118
|
-
warning: "text-warning",
|
|
1119
|
-
danger: "text-danger",
|
|
1120
|
-
inherit: "",
|
|
1121
|
-
gray: "text-gray-500",
|
|
1122
|
-
black: "text-black",
|
|
1123
|
-
white: "text-white"
|
|
1124
|
-
},
|
|
1125
|
-
hasUnderline: {
|
|
1126
|
-
true: "underline",
|
|
1127
|
-
false: ""
|
|
1128
|
-
},
|
|
1129
|
-
isCapitalize: {
|
|
1130
|
-
true: "capitalize",
|
|
1131
|
-
false: ""
|
|
1132
|
-
},
|
|
1133
|
-
align: {
|
|
1134
|
-
left: "text-left",
|
|
1135
|
-
center: "text-center",
|
|
1136
|
-
right: "text-right",
|
|
1137
|
-
justify: "text-justify"
|
|
1138
|
-
},
|
|
1139
|
-
italic: {
|
|
1140
|
-
true: "italic",
|
|
1141
|
-
false: ""
|
|
1142
|
-
},
|
|
1143
|
-
clamp: {
|
|
1144
|
-
1: "line-clamp-1",
|
|
1145
|
-
2: "line-clamp-2",
|
|
1146
|
-
3: "line-clamp-3",
|
|
1147
|
-
4: "line-clamp-4",
|
|
1148
|
-
5: "line-clamp-5",
|
|
1149
|
-
none: ""
|
|
1150
|
-
},
|
|
1151
|
-
ellipsis: {
|
|
1152
|
-
true: "truncate",
|
|
1153
|
-
false: ""
|
|
1154
|
-
},
|
|
1155
|
-
as: {
|
|
1156
|
-
h1: "font-bold text-4xl leading-loose",
|
|
1157
|
-
h2: "font-semibold text-3xl leading-relaxed",
|
|
1158
|
-
h3: "font-medium text-2xl leading-relaxed",
|
|
1159
|
-
h4: "font-bold text-xl leading-normal",
|
|
1160
|
-
h5: "font-semibold text-lg leading-normal",
|
|
1161
|
-
h6: "font-medium text-base leading-normal",
|
|
1162
|
-
p: "font-normal text-base leading-normal",
|
|
1163
|
-
span: "font-normal text-base leading-normal",
|
|
1164
|
-
label: "font-normal text-xs leading-normal"
|
|
1165
|
-
}
|
|
1166
|
-
},
|
|
1167
|
-
defaultVariants: {
|
|
1168
|
-
color: "neutral",
|
|
1169
|
-
hasUnderline: !1,
|
|
1170
|
-
isCapitalize: !1,
|
|
1171
|
-
align: "left",
|
|
1172
|
-
italic: !1,
|
|
1173
|
-
clamp: "none",
|
|
1174
|
-
ellipsis: !1,
|
|
1175
|
-
as: "span"
|
|
1176
|
-
}
|
|
1177
|
-
}), Text = forwardRef(
|
|
1178
|
-
({
|
|
1179
|
-
as: e = "span",
|
|
1180
|
-
color: t = "ghost",
|
|
1181
|
-
hasUnderline: r = !1,
|
|
1182
|
-
isCapitalize: s = !1,
|
|
1183
|
-
align: n = "left",
|
|
1184
|
-
italic: o = !1,
|
|
1185
|
-
clamp: i = "none",
|
|
1186
|
-
ellipsis: a = !1,
|
|
1187
|
-
fontSize: u,
|
|
1188
|
-
fontWeight: l,
|
|
1189
|
-
className: x,
|
|
1190
|
-
children: h,
|
|
1191
|
-
...f
|
|
1192
|
-
}, p) => {
|
|
1193
|
-
const d = [
|
|
1194
|
-
"h1",
|
|
1195
|
-
"h2",
|
|
1196
|
-
"h3",
|
|
1197
|
-
"h4",
|
|
1198
|
-
"h5",
|
|
1199
|
-
"h6",
|
|
1200
|
-
"p",
|
|
1201
|
-
"span",
|
|
1202
|
-
"label"
|
|
1203
|
-
].includes(e) ? e : "span", v = u ? `text-${u}` : "", w = l ? `font-${l}` : "";
|
|
1204
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1205
|
-
e,
|
|
1206
|
-
{
|
|
1207
|
-
ref: p,
|
|
1208
|
-
className: cn(
|
|
1209
|
-
textVariants({
|
|
1210
|
-
color: t,
|
|
1211
|
-
hasUnderline: r,
|
|
1212
|
-
isCapitalize: s,
|
|
1213
|
-
align: n,
|
|
1214
|
-
italic: o,
|
|
1215
|
-
clamp: i,
|
|
1216
|
-
ellipsis: a,
|
|
1217
|
-
// @ts-expect-error - `as` is not a valid variant
|
|
1218
|
-
as: d
|
|
1219
|
-
}),
|
|
1220
|
-
v,
|
|
1221
|
-
w,
|
|
1222
|
-
x
|
|
1223
|
-
),
|
|
1224
|
-
...f,
|
|
1225
|
-
children: h
|
|
1226
|
-
}
|
|
1227
|
-
);
|
|
1228
|
-
}
|
|
1229
|
-
), CalendarContext = createContext(null);
|
|
1109
|
+
const CalendarContext = createContext(null);
|
|
1230
1110
|
function useCalendarContext() {
|
|
1231
1111
|
const e = useContext(CalendarContext);
|
|
1232
1112
|
if (!e)
|
|
@@ -1269,27 +1149,27 @@ const CalendarHeader = () => {
|
|
|
1269
1149
|
] })
|
|
1270
1150
|
] });
|
|
1271
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 = () => {
|
|
1272
|
-
const e = useCalendarContext(), { year: t, month: r, value: s, onChange:
|
|
1273
|
-
for (let
|
|
1274
|
-
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;
|
|
1275
1155
|
v.push(
|
|
1276
1156
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1277
1157
|
ButtonIcon,
|
|
1278
1158
|
{
|
|
1279
|
-
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 }),
|
|
1280
1160
|
size: "sm",
|
|
1281
1161
|
"aria-label": "Previous month day",
|
|
1282
1162
|
variant: "ghost",
|
|
1283
1163
|
onClick: () => {
|
|
1284
|
-
|
|
1164
|
+
o?.(new Date(f, b, x)), n(b), i(f);
|
|
1285
1165
|
}
|
|
1286
1166
|
},
|
|
1287
|
-
"prev-" +
|
|
1167
|
+
"prev-" + u
|
|
1288
1168
|
)
|
|
1289
1169
|
);
|
|
1290
1170
|
}
|
|
1291
|
-
for (let
|
|
1292
|
-
const
|
|
1171
|
+
for (let u = 1; u <= m; u++) {
|
|
1172
|
+
const x = s instanceof Date && s.getFullYear() === t && s.getMonth() === r && s.getDate() === u;
|
|
1293
1173
|
v.push(
|
|
1294
1174
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1295
1175
|
ButtonIcon,
|
|
@@ -1299,71 +1179,71 @@ const CalendarHeader = () => {
|
|
|
1299
1179
|
{
|
|
1300
1180
|
as: "span",
|
|
1301
1181
|
fontSize: "sm",
|
|
1302
|
-
color:
|
|
1303
|
-
className:
|
|
1304
|
-
children:
|
|
1182
|
+
color: x ? "inherit" : "ghost",
|
|
1183
|
+
className: x ? "bg-primary text-white rounded-full" : "",
|
|
1184
|
+
children: u
|
|
1305
1185
|
}
|
|
1306
1186
|
),
|
|
1307
|
-
variant:
|
|
1187
|
+
variant: x ? "primary" : "ghost",
|
|
1308
1188
|
size: "sm",
|
|
1309
|
-
"aria-label": `Select ${t}-${r + 1}-${
|
|
1310
|
-
"aria-current":
|
|
1189
|
+
"aria-label": `Select ${t}-${r + 1}-${u}`,
|
|
1190
|
+
"aria-current": x ? "date" : void 0,
|
|
1311
1191
|
onClick: () => {
|
|
1312
|
-
|
|
1192
|
+
o?.(new Date(t, r, u));
|
|
1313
1193
|
}
|
|
1314
1194
|
},
|
|
1315
|
-
|
|
1195
|
+
u
|
|
1316
1196
|
)
|
|
1317
1197
|
);
|
|
1318
1198
|
}
|
|
1319
|
-
const w =
|
|
1320
|
-
for (let
|
|
1199
|
+
const w = c + m;
|
|
1200
|
+
for (let u = 0; u < (w % 7 === 0 ? 0 : 7 - w % 7); u++)
|
|
1321
1201
|
v.push(
|
|
1322
1202
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1323
1203
|
ButtonIcon,
|
|
1324
1204
|
{
|
|
1325
|
-
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 }),
|
|
1326
1206
|
size: "sm",
|
|
1327
1207
|
"aria-label": "Next month day",
|
|
1328
1208
|
variant: "ghost",
|
|
1329
1209
|
onClick: () => {
|
|
1330
|
-
|
|
1210
|
+
o?.(new Date(d, y, u + 1)), n(y), i(d);
|
|
1331
1211
|
}
|
|
1332
1212
|
},
|
|
1333
|
-
"next-" +
|
|
1213
|
+
"next-" + u
|
|
1334
1214
|
)
|
|
1335
1215
|
);
|
|
1336
1216
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-7 gap-2 px-4 pb-4", children: v });
|
|
1337
1217
|
}, CalendarDaysRange = () => {
|
|
1338
|
-
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 = () => {
|
|
1339
1219
|
if (!Array.isArray(r)) return [null, null];
|
|
1340
|
-
const [
|
|
1341
|
-
return !
|
|
1342
|
-
}, [w,
|
|
1343
|
-
if (!w || !
|
|
1344
|
-
const
|
|
1345
|
-
return
|
|
1346
|
-
},
|
|
1347
|
-
for (let
|
|
1348
|
-
const
|
|
1220
|
+
const [l, h] = r;
|
|
1221
|
+
return !l && !h ? [null, null] : l && h ? l <= h ? [l, h] : [h, l] : [l, h];
|
|
1222
|
+
}, [w, u] = v(), x = (l) => {
|
|
1223
|
+
if (!w || !u) return !1;
|
|
1224
|
+
const h = new Date(e, t, l);
|
|
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;
|
|
1349
1229
|
d.push(
|
|
1350
1230
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1351
1231
|
ButtonIcon,
|
|
1352
1232
|
{
|
|
1353
|
-
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children:
|
|
1233
|
+
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: h }),
|
|
1354
1234
|
size: "sm",
|
|
1355
1235
|
"aria-label": "Previous month day",
|
|
1356
1236
|
variant: "ghost",
|
|
1357
1237
|
onClick: () => {
|
|
1358
|
-
s?.([null, null]),
|
|
1238
|
+
s?.([null, null]), o(m), n(b);
|
|
1359
1239
|
}
|
|
1360
1240
|
},
|
|
1361
|
-
"prev-" +
|
|
1241
|
+
"prev-" + l
|
|
1362
1242
|
)
|
|
1363
1243
|
);
|
|
1364
1244
|
}
|
|
1365
|
-
for (let
|
|
1366
|
-
const
|
|
1245
|
+
for (let l = 1; l <= c; l++) {
|
|
1246
|
+
const h = x(l), E = S(l), C = N(l);
|
|
1367
1247
|
d.push(
|
|
1368
1248
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1369
1249
|
ButtonIcon,
|
|
@@ -1373,47 +1253,47 @@ const CalendarHeader = () => {
|
|
|
1373
1253
|
{
|
|
1374
1254
|
as: "span",
|
|
1375
1255
|
fontSize: "sm",
|
|
1376
|
-
color:
|
|
1256
|
+
color: h || E || C ? "inherit" : "ghost",
|
|
1377
1257
|
className: cn(
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1258
|
+
h && " bg-primary text-white",
|
|
1259
|
+
E && "rounded-l-full bg-primary text-white",
|
|
1260
|
+
C && "rounded-r-full bg-primary text-white"
|
|
1381
1261
|
),
|
|
1382
|
-
children:
|
|
1262
|
+
children: l
|
|
1383
1263
|
}
|
|
1384
1264
|
),
|
|
1385
|
-
variant:
|
|
1265
|
+
variant: E || C || h ? "primary" : "ghost",
|
|
1386
1266
|
size: "sm",
|
|
1387
|
-
"aria-label": `Select ${e}-${t + 1}-${
|
|
1388
|
-
"aria-current":
|
|
1267
|
+
"aria-label": `Select ${e}-${t + 1}-${l}`,
|
|
1268
|
+
"aria-current": E || C ? "date" : void 0,
|
|
1389
1269
|
onClick: () => {
|
|
1390
1270
|
if (!Array.isArray(r) || !r[0] || r[0] && r[1])
|
|
1391
|
-
s?.([new Date(e, t,
|
|
1271
|
+
s?.([new Date(e, t, l), null]);
|
|
1392
1272
|
else if (r[0] && !r[1]) {
|
|
1393
|
-
const j = r[0], R = new Date(e, t,
|
|
1273
|
+
const j = r[0], R = new Date(e, t, l);
|
|
1394
1274
|
j.getTime() === R.getTime() ? s?.([j, R]) : s?.(j < R ? [j, R] : [R, j]);
|
|
1395
1275
|
}
|
|
1396
1276
|
}
|
|
1397
1277
|
},
|
|
1398
|
-
|
|
1278
|
+
l
|
|
1399
1279
|
)
|
|
1400
1280
|
);
|
|
1401
1281
|
}
|
|
1402
|
-
const
|
|
1403
|
-
for (let
|
|
1282
|
+
const I = g + c;
|
|
1283
|
+
for (let l = 0; l < (I % 7 === 0 ? 0 : 7 - I % 7); l++)
|
|
1404
1284
|
d.push(
|
|
1405
1285
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1406
1286
|
ButtonIcon,
|
|
1407
1287
|
{
|
|
1408
|
-
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children:
|
|
1288
|
+
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: l + 1 }),
|
|
1409
1289
|
size: "sm",
|
|
1410
1290
|
"aria-label": "Next month day",
|
|
1411
1291
|
variant: "ghost",
|
|
1412
1292
|
onClick: () => {
|
|
1413
|
-
s?.([null, null]),
|
|
1293
|
+
s?.([null, null]), o(p), n(y);
|
|
1414
1294
|
}
|
|
1415
1295
|
},
|
|
1416
|
-
"next-" +
|
|
1296
|
+
"next-" + l
|
|
1417
1297
|
)
|
|
1418
1298
|
);
|
|
1419
1299
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-7 gap-2 px-4 pb-4", children: d });
|
|
@@ -1426,32 +1306,32 @@ function useCalendar({
|
|
|
1426
1306
|
type: t,
|
|
1427
1307
|
onChange: r,
|
|
1428
1308
|
initialYear: s,
|
|
1429
|
-
initialMonth:
|
|
1309
|
+
initialMonth: o
|
|
1430
1310
|
}) {
|
|
1431
|
-
const [
|
|
1311
|
+
const [n, i] = useState(o), [a, g] = useState(s), [c, m] = useState([
|
|
1432
1312
|
null,
|
|
1433
1313
|
null
|
|
1434
1314
|
]);
|
|
1435
|
-
let
|
|
1436
|
-
t === "range" && !e && (
|
|
1315
|
+
let b = e;
|
|
1316
|
+
t === "range" && !e && (b = c);
|
|
1437
1317
|
const f = useCallback(() => {
|
|
1438
|
-
const d =
|
|
1439
|
-
i(d),
|
|
1440
|
-
}, [
|
|
1441
|
-
const d =
|
|
1442
|
-
i(d),
|
|
1443
|
-
}, [
|
|
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(
|
|
1444
1324
|
(d) => {
|
|
1445
|
-
t === "single" ? r?.(d) : t === "range" && (
|
|
1325
|
+
t === "single" ? r?.(d) : t === "range" && (m(d), r?.(d));
|
|
1446
1326
|
},
|
|
1447
1327
|
[t, r]
|
|
1448
1328
|
);
|
|
1449
1329
|
return {
|
|
1450
1330
|
year: a,
|
|
1451
|
-
month:
|
|
1452
|
-
value:
|
|
1331
|
+
month: n,
|
|
1332
|
+
value: b,
|
|
1453
1333
|
setMonth: i,
|
|
1454
|
-
setYear:
|
|
1334
|
+
setYear: g,
|
|
1455
1335
|
onChange: y,
|
|
1456
1336
|
handlePrevMonth: f,
|
|
1457
1337
|
handleNextMonth: p
|
|
@@ -1462,14 +1342,14 @@ const CalendarRoot = ({
|
|
|
1462
1342
|
onChange: t,
|
|
1463
1343
|
className: r,
|
|
1464
1344
|
type: s = "single",
|
|
1465
|
-
...
|
|
1345
|
+
...o
|
|
1466
1346
|
}) => {
|
|
1467
|
-
const
|
|
1347
|
+
const n = /* @__PURE__ */ new Date(), i = useCalendar({
|
|
1468
1348
|
value: e,
|
|
1469
1349
|
onChange: t,
|
|
1470
1350
|
type: s,
|
|
1471
|
-
initialYear:
|
|
1472
|
-
initialMonth:
|
|
1351
|
+
initialYear: n.getFullYear(),
|
|
1352
|
+
initialMonth: n.getMonth()
|
|
1473
1353
|
});
|
|
1474
1354
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1475
1355
|
CalendarContext.Provider,
|
|
@@ -1483,7 +1363,7 @@ const CalendarRoot = ({
|
|
|
1483
1363
|
setYear: i.setYear,
|
|
1484
1364
|
onChange: i.onChange
|
|
1485
1365
|
},
|
|
1486
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("select-none", r), ...
|
|
1366
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("select-none", r), ...o, children: [
|
|
1487
1367
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarHeader, {}),
|
|
1488
1368
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarWeekdays, {}),
|
|
1489
1369
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarDays, {})
|
|
@@ -1561,7 +1441,7 @@ const getTableColumnClass = (e) => {
|
|
|
1561
1441
|
}
|
|
1562
1442
|
}, TableHeader = forwardRef(
|
|
1563
1443
|
({ children: e, className: t, ...r }, s) => {
|
|
1564
|
-
const {
|
|
1444
|
+
const { columns: o } = useTableContext();
|
|
1565
1445
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1566
1446
|
"div",
|
|
1567
1447
|
{
|
|
@@ -1573,7 +1453,7 @@ const getTableColumnClass = (e) => {
|
|
|
1573
1453
|
"div",
|
|
1574
1454
|
{
|
|
1575
1455
|
role: "row",
|
|
1576
|
-
className: cn("grid gap-4", getTableColumnClass(
|
|
1456
|
+
className: cn("grid gap-4", getTableColumnClass(o)),
|
|
1577
1457
|
children: e
|
|
1578
1458
|
}
|
|
1579
1459
|
)
|
|
@@ -1584,7 +1464,7 @@ const getTableColumnClass = (e) => {
|
|
|
1584
1464
|
({ children: e, className: t, ...r }, s) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { role: "rowgroup", ref: s, className: cn(t), ...r, children: e })
|
|
1585
1465
|
), TableFooter = forwardRef(
|
|
1586
1466
|
({ children: e, className: t, ...r }, s) => {
|
|
1587
|
-
const {
|
|
1467
|
+
const { columns: o } = useTableContext();
|
|
1588
1468
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1589
1469
|
"div",
|
|
1590
1470
|
{
|
|
@@ -1596,7 +1476,7 @@ const getTableColumnClass = (e) => {
|
|
|
1596
1476
|
"div",
|
|
1597
1477
|
{
|
|
1598
1478
|
role: "row",
|
|
1599
|
-
className: cn("grid gap-4", getTableColumnClass(
|
|
1479
|
+
className: cn("grid gap-4", getTableColumnClass(o)),
|
|
1600
1480
|
children: e
|
|
1601
1481
|
}
|
|
1602
1482
|
)
|
|
@@ -1605,14 +1485,14 @@ const getTableColumnClass = (e) => {
|
|
|
1605
1485
|
}
|
|
1606
1486
|
), TableRow = forwardRef(
|
|
1607
1487
|
({ children: e, className: t, ...r }, s) => {
|
|
1608
|
-
const {
|
|
1488
|
+
const { columns: o } = useTableContext();
|
|
1609
1489
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1610
1490
|
"div",
|
|
1611
1491
|
{
|
|
1612
1492
|
role: "row",
|
|
1613
1493
|
className: cn(
|
|
1614
1494
|
"grid gap-4",
|
|
1615
|
-
getTableColumnClass(
|
|
1495
|
+
getTableColumnClass(o),
|
|
1616
1496
|
"border-b border-border last:border-0",
|
|
1617
1497
|
t
|
|
1618
1498
|
),
|
|
@@ -1623,10 +1503,10 @@ const getTableColumnClass = (e) => {
|
|
|
1623
1503
|
);
|
|
1624
1504
|
}
|
|
1625
1505
|
), TableColumn = forwardRef(
|
|
1626
|
-
({ 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) => {
|
|
1627
1507
|
const a = e === "th" ? "columnheader" : "cell";
|
|
1628
|
-
let
|
|
1629
|
-
return r === "center" ?
|
|
1508
|
+
let g = "text-left";
|
|
1509
|
+
return r === "center" ? g = "text-center" : r === "right" && (g = "text-right"), /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1630
1510
|
"div",
|
|
1631
1511
|
{
|
|
1632
1512
|
ref: i,
|
|
@@ -1635,40 +1515,66 @@ const getTableColumnClass = (e) => {
|
|
|
1635
1515
|
"px-4 py-2",
|
|
1636
1516
|
"[&:not(:last-child)]:border-r [&:not(:last-child)]:border-border",
|
|
1637
1517
|
getRowSpanClass(t),
|
|
1638
|
-
|
|
1639
|
-
|
|
1518
|
+
g,
|
|
1519
|
+
"truncate overflow-hidden whitespace-nowrap",
|
|
1520
|
+
o
|
|
1640
1521
|
),
|
|
1641
|
-
...
|
|
1522
|
+
...n,
|
|
1642
1523
|
children: s
|
|
1643
1524
|
}
|
|
1644
1525
|
);
|
|
1645
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
|
+
)
|
|
1646
1553
|
), TableRoot = forwardRef(
|
|
1647
|
-
({ children: e, className: t,
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
) });
|
|
1665
|
-
}
|
|
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
|
+
) })
|
|
1666
1571
|
), Table = Object.assign(TableRoot, {
|
|
1667
1572
|
Header: TableHeader,
|
|
1573
|
+
HeaderItem: TableHeaderItem,
|
|
1668
1574
|
Body: TableBody,
|
|
1669
1575
|
Footer: TableFooter,
|
|
1670
1576
|
Row: TableRow,
|
|
1671
|
-
|
|
1577
|
+
RowItem: TableRowItem
|
|
1672
1578
|
}), tileVariants = cva(
|
|
1673
1579
|
// Base classes
|
|
1674
1580
|
"block transition-colors duration-200",
|
|
@@ -1705,12 +1611,12 @@ const getTableColumnClass = (e) => {
|
|
|
1705
1611
|
}
|
|
1706
1612
|
}
|
|
1707
1613
|
), Tile = forwardRef(
|
|
1708
|
-
({ 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(
|
|
1709
1615
|
"div",
|
|
1710
1616
|
{
|
|
1711
|
-
ref:
|
|
1617
|
+
ref: n,
|
|
1712
1618
|
className: cn(tileVariants({ variant: e, size: t, shape: r }), s),
|
|
1713
|
-
...
|
|
1619
|
+
...o
|
|
1714
1620
|
}
|
|
1715
1621
|
)
|
|
1716
1622
|
);
|
|
@@ -1744,19 +1650,19 @@ function getColSpan(e = 4) {
|
|
|
1744
1650
|
return "col-span-4";
|
|
1745
1651
|
}
|
|
1746
1652
|
}
|
|
1747
|
-
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) {
|
|
1748
1654
|
const i = getColSpan(s);
|
|
1749
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref:
|
|
1655
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: n, className: cn(i, r), ...o, children: t });
|
|
1750
1656
|
}), DescriptionListTerm = forwardRef(function e({ children: t, ...r }, s) {
|
|
1751
1657
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("dt", { ref: s, ...r, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", fontWeight: "medium", color: "gray", children: t }) });
|
|
1752
|
-
}), DescriptionListDetails = forwardRef(function e({ children: t, color: r = "black", ...s },
|
|
1753
|
-
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 }) });
|
|
1754
1660
|
}), DescriptionListRoot = forwardRef(
|
|
1755
|
-
function e({ children: t, className: r, ...s },
|
|
1661
|
+
function e({ children: t, className: r, ...s }, o) {
|
|
1756
1662
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1757
1663
|
"dl",
|
|
1758
1664
|
{
|
|
1759
|
-
ref:
|
|
1665
|
+
ref: o,
|
|
1760
1666
|
className: cn("grid grid-cols-12 gap-y-4", r),
|
|
1761
1667
|
...s,
|
|
1762
1668
|
children: t
|
|
@@ -1769,20 +1675,20 @@ const DescriptionListItem = forwardRef(function e({ children: t, className: r, s
|
|
|
1769
1675
|
Details: DescriptionListDetails
|
|
1770
1676
|
});
|
|
1771
1677
|
function useImage({ src: e }) {
|
|
1772
|
-
const [t, r] = useState(!1), [s,
|
|
1678
|
+
const [t, r] = useState(!1), [s, o] = useState(!1), n = useRef(!1), i = () => {
|
|
1773
1679
|
r(!0);
|
|
1774
1680
|
}, a = () => {
|
|
1775
|
-
|
|
1681
|
+
o(!0);
|
|
1776
1682
|
};
|
|
1777
1683
|
return useEffect(() => {
|
|
1778
1684
|
if (!e) return;
|
|
1779
|
-
const
|
|
1780
|
-
return
|
|
1781
|
-
|
|
1782
|
-
},
|
|
1783
|
-
|
|
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);
|
|
1784
1690
|
}, () => {
|
|
1785
|
-
|
|
1691
|
+
n.current = !0;
|
|
1786
1692
|
};
|
|
1787
1693
|
}, [e]), {
|
|
1788
1694
|
loaded: t,
|
|
@@ -1849,13 +1755,13 @@ function BaseImageSkeleton({
|
|
|
1849
1755
|
shape: t,
|
|
1850
1756
|
size: r,
|
|
1851
1757
|
height: s,
|
|
1852
|
-
width:
|
|
1758
|
+
width: o
|
|
1853
1759
|
}) {
|
|
1854
1760
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1855
1761
|
Skeleton,
|
|
1856
1762
|
{
|
|
1857
1763
|
className: cn(imageAtomVariants({ shape: t, size: r }), e),
|
|
1858
|
-
style: { height: s, width:
|
|
1764
|
+
style: { height: s, width: o }
|
|
1859
1765
|
}
|
|
1860
1766
|
);
|
|
1861
1767
|
}
|
|
@@ -1864,15 +1770,15 @@ function BaseImageFallback({
|
|
|
1864
1770
|
width: t,
|
|
1865
1771
|
height: r,
|
|
1866
1772
|
className: s,
|
|
1867
|
-
style:
|
|
1868
|
-
shape:
|
|
1773
|
+
style: o,
|
|
1774
|
+
shape: n,
|
|
1869
1775
|
size: i
|
|
1870
1776
|
}) {
|
|
1871
1777
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1872
1778
|
"div",
|
|
1873
1779
|
{
|
|
1874
|
-
className: imageAtomVariants({ shape:
|
|
1875
|
-
style: { width: t, height: r, ...
|
|
1780
|
+
className: imageAtomVariants({ shape: n, size: i, className: s }),
|
|
1781
|
+
style: { width: t, height: r, ...o },
|
|
1876
1782
|
"aria-label": e,
|
|
1877
1783
|
role: "img",
|
|
1878
1784
|
children: [
|
|
@@ -1895,32 +1801,32 @@ const BaseImage = forwardRef(
|
|
|
1895
1801
|
alt: t,
|
|
1896
1802
|
onLoad: r,
|
|
1897
1803
|
onError: s,
|
|
1898
|
-
width:
|
|
1899
|
-
height:
|
|
1804
|
+
width: o,
|
|
1805
|
+
height: n,
|
|
1900
1806
|
loading: i = "lazy",
|
|
1901
1807
|
position: a = "cover",
|
|
1902
|
-
size:
|
|
1903
|
-
shape:
|
|
1904
|
-
className:
|
|
1905
|
-
...
|
|
1808
|
+
size: g = "auto",
|
|
1809
|
+
shape: c,
|
|
1810
|
+
className: m,
|
|
1811
|
+
...b
|
|
1906
1812
|
}, f) => {
|
|
1907
1813
|
const { loaded: p, errored: y, handleLoad: d, handleError: v } = useImage({
|
|
1908
1814
|
src: e
|
|
1909
|
-
}), w = typeof
|
|
1815
|
+
}), w = typeof o == "number" ? o : Number(o), u = typeof n == "number" ? n : Number(n);
|
|
1910
1816
|
return !p && !y ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1911
1817
|
BaseImageSkeleton,
|
|
1912
1818
|
{
|
|
1913
|
-
shape:
|
|
1819
|
+
shape: c,
|
|
1914
1820
|
width: w,
|
|
1915
|
-
height:
|
|
1821
|
+
height: u
|
|
1916
1822
|
}
|
|
1917
1823
|
) : y ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1918
1824
|
BaseImageFallback,
|
|
1919
1825
|
{
|
|
1920
|
-
shape:
|
|
1826
|
+
shape: c,
|
|
1921
1827
|
alt: t,
|
|
1922
1828
|
width: w,
|
|
1923
|
-
height:
|
|
1829
|
+
height: u
|
|
1924
1830
|
}
|
|
1925
1831
|
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1926
1832
|
"img",
|
|
@@ -1929,23 +1835,23 @@ const BaseImage = forwardRef(
|
|
|
1929
1835
|
src: e,
|
|
1930
1836
|
alt: t,
|
|
1931
1837
|
width: w,
|
|
1932
|
-
height:
|
|
1838
|
+
height: u,
|
|
1933
1839
|
loading: i,
|
|
1934
1840
|
className: cn(
|
|
1935
1841
|
imageVariants({
|
|
1936
1842
|
position: a,
|
|
1937
|
-
size:
|
|
1938
|
-
shape:
|
|
1843
|
+
size: g,
|
|
1844
|
+
shape: c
|
|
1939
1845
|
}),
|
|
1940
|
-
|
|
1846
|
+
m
|
|
1941
1847
|
),
|
|
1942
|
-
onLoad: (
|
|
1943
|
-
d(), r?.(
|
|
1848
|
+
onLoad: (x) => {
|
|
1849
|
+
d(), r?.(x);
|
|
1944
1850
|
},
|
|
1945
|
-
onError: (
|
|
1946
|
-
v(), s?.(
|
|
1851
|
+
onError: (x) => {
|
|
1852
|
+
v(), s?.(x);
|
|
1947
1853
|
},
|
|
1948
|
-
...
|
|
1854
|
+
...b
|
|
1949
1855
|
}
|
|
1950
1856
|
);
|
|
1951
1857
|
}
|
|
@@ -1964,10 +1870,9 @@ export {
|
|
|
1964
1870
|
ButtonFloat as e,
|
|
1965
1871
|
ButtonIcon as f,
|
|
1966
1872
|
Calendar as g,
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
BaseImage as m
|
|
1873
|
+
Tile as h,
|
|
1874
|
+
ImageCircle as i,
|
|
1875
|
+
ImageSquare as j,
|
|
1876
|
+
ImageRectangle as k,
|
|
1877
|
+
BaseImage as l
|
|
1973
1878
|
};
|