@dimasbaguspm/versaur 0.0.30 → 0.0.32
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-DUcwK0Yd.js → bottom-sheet-DJgcgmgw.js} +146 -160
- package/dist/js/{bottom-sheet-input-Bzx0ecmU.js → bottom-sheet-input-lRqhqp7I.js} +7 -7
- package/dist/js/forms/index.js +1 -1
- package/dist/js/{image-rectangle-BMEGIW-6.js → image-rectangle-BS6j3xEC.js} +429 -618
- package/dist/js/index.js +46 -47
- package/dist/js/layouts/index.js +1 -1
- package/dist/js/navigation/index.js +1 -1
- package/dist/js/overlays/index.js +7 -6
- package/dist/js/primitive/index.js +21 -22
- package/dist/js/{tabs-CIWr5hdb.js → tabs-80jJFJ7W.js} +1 -1
- package/dist/js/tooltip-J7r2xoUk.js +81 -0
- package/dist/js/{top-bar-BdmaTpTp.js → top-bar-DJNgsR7X.js} +1 -1
- package/dist/types/overlays/menu/index.d.ts +1 -1
- package/dist/types/overlays/menu/menu.d.ts +4 -1
- package/dist/types/overlays/menu/types.d.ts +4 -2
- package/dist/types/overlays/menu/use-menu.d.ts +0 -1
- package/dist/types/primitive/button-menu-icon/button-menu-icon.d.ts +4 -0
- package/dist/types/primitive/button-menu-icon/index.d.ts +2 -0
- package/dist/types/primitive/button-menu-icon/types.d.ts +13 -0
- package/dist/types/primitive/card/card.atoms.d.ts +3 -0
- package/dist/types/primitive/card/card.d.ts +4 -23
- package/dist/types/primitive/card/types.d.ts +6 -0
- package/dist/types/primitive/index.d.ts +1 -2
- package/dist/utils/enforce-subpath-import.js +1 -2
- package/package.json +1 -1
- package/dist/js/tooltip-IazSAgsg.js +0 -148
- package/dist/types/primitive/calendar/calendar.atoms.d.ts +0 -13
- package/dist/types/primitive/calendar/calendar.d.ts +0 -8
- package/dist/types/primitive/calendar/index.d.ts +0 -2
- package/dist/types/primitive/calendar/types.d.ts +0 -54
- package/dist/types/primitive/calendar/use-calendar.d.ts +0 -18
- package/dist/types/primitive/description-list/description-list.atoms.d.ts +0 -13
- package/dist/types/primitive/description-list/description-list.d.ts +0 -6
- package/dist/types/primitive/description-list/index.d.ts +0 -2
- package/dist/types/primitive/description-list/types.d.ts +0 -46
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as cva, j as jsxRuntimeExports, a as cn } from "./index-DOdDlCoL.js";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import React__default, { forwardRef, useState, useEffect, useCallback, useRef, createContext, useContext } from "react";
|
|
4
|
-
import {
|
|
3
|
+
import React__default, { forwardRef, useState, useEffect, useCallback, useRef, useId, cloneElement, createContext, useContext } from "react";
|
|
4
|
+
import { EllipsisVerticalIcon, X, XIcon, ImageOff } from "lucide-react";
|
|
5
5
|
import { S as Skeleton } from "./skeleton-BNZyaRjo.js";
|
|
6
6
|
const alertVariants = cva(
|
|
7
7
|
"relative flex items-center gap-2 rounded-md p-2 text-sm transition-all duration-200",
|
|
@@ -147,14 +147,14 @@ const alertVariants = cva(
|
|
|
147
147
|
icon: r,
|
|
148
148
|
className: s,
|
|
149
149
|
children: i,
|
|
150
|
-
...
|
|
151
|
-
},
|
|
150
|
+
...o
|
|
151
|
+
}, a) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
152
152
|
"div",
|
|
153
153
|
{
|
|
154
|
-
ref:
|
|
154
|
+
ref: a,
|
|
155
155
|
role: "alert",
|
|
156
156
|
className: cn(alertVariants({ variant: e, color: t }), s),
|
|
157
|
-
...
|
|
157
|
+
...o,
|
|
158
158
|
children: [
|
|
159
159
|
r && /* @__PURE__ */ jsxRuntimeExports.jsx(AlertIcon, { children: r }),
|
|
160
160
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: i })
|
|
@@ -227,17 +227,17 @@ const alertVariants = cva(
|
|
|
227
227
|
color: r = "primary",
|
|
228
228
|
fontSize: s = "base",
|
|
229
229
|
fontWeight: i = "medium",
|
|
230
|
-
quiet:
|
|
231
|
-
...
|
|
232
|
-
},
|
|
230
|
+
quiet: o = !1,
|
|
231
|
+
...a
|
|
232
|
+
}, n) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
233
233
|
"a",
|
|
234
234
|
{
|
|
235
|
-
ref:
|
|
235
|
+
ref: n,
|
|
236
236
|
className: cn(
|
|
237
|
-
anchorVariants({ color: r, fontSize: s, fontWeight: i, quiet:
|
|
237
|
+
anchorVariants({ color: r, fontSize: s, fontWeight: i, quiet: o }),
|
|
238
238
|
t
|
|
239
239
|
),
|
|
240
|
-
...
|
|
240
|
+
...a,
|
|
241
241
|
children: e
|
|
242
242
|
}
|
|
243
243
|
)
|
|
@@ -317,16 +317,16 @@ const alertVariants = cva(
|
|
|
317
317
|
hasUnderline: r = !1,
|
|
318
318
|
isCapitalize: s = !1,
|
|
319
319
|
align: i = "left",
|
|
320
|
-
italic:
|
|
321
|
-
clamp:
|
|
322
|
-
ellipsis:
|
|
320
|
+
italic: o = !1,
|
|
321
|
+
clamp: a = "none",
|
|
322
|
+
ellipsis: n = !1,
|
|
323
323
|
fontSize: l,
|
|
324
324
|
fontWeight: c,
|
|
325
|
-
className:
|
|
326
|
-
children:
|
|
327
|
-
...
|
|
328
|
-
},
|
|
329
|
-
const
|
|
325
|
+
className: g,
|
|
326
|
+
children: d,
|
|
327
|
+
...u
|
|
328
|
+
}, f) => {
|
|
329
|
+
const x = [
|
|
330
330
|
"h1",
|
|
331
331
|
"h2",
|
|
332
332
|
"h3",
|
|
@@ -336,35 +336,35 @@ const alertVariants = cva(
|
|
|
336
336
|
"p",
|
|
337
337
|
"span",
|
|
338
338
|
"label"
|
|
339
|
-
].includes(e) ? e : "span",
|
|
339
|
+
].includes(e) ? e : "span", m = l ? `text-${l}` : "", h = c ? `font-${c}` : "";
|
|
340
340
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
341
341
|
e,
|
|
342
342
|
{
|
|
343
|
-
ref:
|
|
343
|
+
ref: f,
|
|
344
344
|
className: cn(
|
|
345
345
|
textVariants({
|
|
346
346
|
color: t,
|
|
347
347
|
hasUnderline: r,
|
|
348
348
|
isCapitalize: s,
|
|
349
349
|
align: i,
|
|
350
|
-
italic:
|
|
351
|
-
clamp:
|
|
352
|
-
ellipsis:
|
|
350
|
+
italic: o,
|
|
351
|
+
clamp: a,
|
|
352
|
+
ellipsis: n,
|
|
353
353
|
// @ts-expect-error - `as` is not a valid variant
|
|
354
|
-
as:
|
|
354
|
+
as: x
|
|
355
355
|
}),
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
356
|
+
m,
|
|
357
|
+
h,
|
|
358
|
+
g
|
|
359
359
|
),
|
|
360
|
-
...
|
|
361
|
-
children:
|
|
360
|
+
...u,
|
|
361
|
+
children: d
|
|
362
362
|
}
|
|
363
363
|
);
|
|
364
364
|
}
|
|
365
365
|
), Attribute = forwardRef(
|
|
366
|
-
function({ title: t, children: r, className: s, ...i },
|
|
367
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref:
|
|
366
|
+
function({ title: t, children: r, className: s, ...i }, o) {
|
|
367
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: o, className: cn("space-y-1", s), ...i, children: [
|
|
368
368
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
369
369
|
Text,
|
|
370
370
|
{
|
|
@@ -380,7 +380,7 @@ const alertVariants = cva(
|
|
|
380
380
|
] });
|
|
381
381
|
}
|
|
382
382
|
);
|
|
383
|
-
function getColSpan
|
|
383
|
+
function getColSpan(e = 1) {
|
|
384
384
|
switch (e) {
|
|
385
385
|
case 1:
|
|
386
386
|
return "col-span-1";
|
|
@@ -440,17 +440,17 @@ function getGridCols(e = 4) {
|
|
|
440
440
|
return "grid-cols-4";
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
const AttributeListItem = forwardRef(function({ children: t, className: r, span: s = 1, title: i, ...
|
|
444
|
-
const
|
|
445
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { ref:
|
|
443
|
+
const AttributeListItem = forwardRef(function({ children: t, className: r, span: s = 1, title: i, ...o }, a) {
|
|
444
|
+
const n = getColSpan(s);
|
|
445
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { ref: a, className: cn(n, r), ...o, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Attribute, { title: i, children: t }) });
|
|
446
446
|
}), AttributeListRoot = forwardRef(
|
|
447
|
-
function({ children: t, className: r, columns: s = 4, ...i },
|
|
448
|
-
const
|
|
447
|
+
function({ children: t, className: r, columns: s = 4, ...i }, o) {
|
|
448
|
+
const a = getGridCols(s);
|
|
449
449
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
450
450
|
"ul",
|
|
451
451
|
{
|
|
452
|
-
ref:
|
|
453
|
-
className: cn("grid gap-4",
|
|
452
|
+
ref: o,
|
|
453
|
+
className: cn("grid gap-4", a, r),
|
|
454
454
|
...i,
|
|
455
455
|
children: t
|
|
456
456
|
}
|
|
@@ -477,10 +477,10 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
|
|
|
477
477
|
},
|
|
478
478
|
size: {
|
|
479
479
|
xs: "h-6 w-6 text-xs",
|
|
480
|
-
sm: "h-
|
|
481
|
-
md: "h-
|
|
482
|
-
lg: "h-
|
|
483
|
-
xl: "h-
|
|
480
|
+
sm: "h-7 w-7 text-xs",
|
|
481
|
+
md: "h-9 w-9 text-sm",
|
|
482
|
+
lg: "h-10 w-10 text-base",
|
|
483
|
+
xl: "h-12 w-12 text-xl"
|
|
484
484
|
},
|
|
485
485
|
shape: {
|
|
486
486
|
circle: "rounded-full",
|
|
@@ -503,32 +503,32 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
|
|
|
503
503
|
shape: r = "circle",
|
|
504
504
|
className: s,
|
|
505
505
|
children: i,
|
|
506
|
-
...
|
|
507
|
-
},
|
|
506
|
+
...o
|
|
507
|
+
}, a) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
508
508
|
"div",
|
|
509
509
|
{
|
|
510
|
-
ref:
|
|
510
|
+
ref: a,
|
|
511
511
|
className: cn(avatarVariants({ variant: e, size: t, shape: r }), s),
|
|
512
|
-
...
|
|
512
|
+
...o,
|
|
513
513
|
children: i
|
|
514
514
|
}
|
|
515
515
|
)
|
|
516
516
|
), AvatarImage = forwardRef(
|
|
517
|
-
({ src: e, alt: t, className: r, onError: s, ...i },
|
|
518
|
-
const [
|
|
517
|
+
({ src: e, alt: t, className: r, onError: s, ...i }, o) => {
|
|
518
|
+
const [a, n] = useState(!1);
|
|
519
519
|
useEffect(() => {
|
|
520
|
-
|
|
520
|
+
n(!1);
|
|
521
521
|
}, [e]);
|
|
522
522
|
const l = useCallback(
|
|
523
523
|
(c) => {
|
|
524
|
-
|
|
524
|
+
n(!0), s?.(c);
|
|
525
525
|
},
|
|
526
526
|
[s]
|
|
527
527
|
);
|
|
528
|
-
return
|
|
528
|
+
return a ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
529
529
|
"img",
|
|
530
530
|
{
|
|
531
|
-
ref:
|
|
531
|
+
ref: o,
|
|
532
532
|
src: e,
|
|
533
533
|
alt: t,
|
|
534
534
|
className: cn(avatarImageVariants(), r),
|
|
@@ -702,12 +702,12 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
|
|
|
702
702
|
color: r = "primary",
|
|
703
703
|
size: s = "md",
|
|
704
704
|
iconLeft: i,
|
|
705
|
-
iconRight:
|
|
706
|
-
className:
|
|
707
|
-
children:
|
|
705
|
+
iconRight: o,
|
|
706
|
+
className: a,
|
|
707
|
+
children: n,
|
|
708
708
|
...l
|
|
709
709
|
}, c) => {
|
|
710
|
-
const
|
|
710
|
+
const u = !(n != null && n !== "") && !!(i || o);
|
|
711
711
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
712
712
|
"span",
|
|
713
713
|
{
|
|
@@ -718,20 +718,20 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
|
|
|
718
718
|
color: r,
|
|
719
719
|
shape: t,
|
|
720
720
|
size: s,
|
|
721
|
-
iconOnly:
|
|
721
|
+
iconOnly: u
|
|
722
722
|
}),
|
|
723
|
-
|
|
723
|
+
a
|
|
724
724
|
),
|
|
725
725
|
...l,
|
|
726
|
-
children:
|
|
726
|
+
children: u ? (
|
|
727
727
|
// Icon-only mode: display only the icon
|
|
728
|
-
i ||
|
|
728
|
+
i || o
|
|
729
729
|
) : (
|
|
730
730
|
// Normal mode: display icon(s) and text
|
|
731
731
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
732
732
|
i,
|
|
733
|
-
|
|
734
|
-
|
|
733
|
+
n,
|
|
734
|
+
o
|
|
735
735
|
] })
|
|
736
736
|
)
|
|
737
737
|
}
|
|
@@ -741,8 +741,8 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
|
|
|
741
741
|
variants: {
|
|
742
742
|
size: {
|
|
743
743
|
xs: "h-6 w-6",
|
|
744
|
-
sm: "h-
|
|
745
|
-
md: "h-
|
|
744
|
+
sm: "h-7 w-7",
|
|
745
|
+
md: "h-9 w-9",
|
|
746
746
|
lg: "h-10 w-10",
|
|
747
747
|
xl: "h-12 w-12"
|
|
748
748
|
}
|
|
@@ -752,13 +752,13 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
|
|
|
752
752
|
}
|
|
753
753
|
}), BrandLogo = forwardRef(
|
|
754
754
|
({ shape: e = "square", size: t, ...r }, s) => {
|
|
755
|
-
const
|
|
755
|
+
const o = {
|
|
756
756
|
square: SvgSpenicleSquare,
|
|
757
757
|
rounded: SvgSpenicleRounded,
|
|
758
758
|
circle: SvgSpenicleCircle
|
|
759
759
|
}[e] || SvgSpenicleSquare;
|
|
760
760
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
761
|
-
|
|
761
|
+
o,
|
|
762
762
|
{
|
|
763
763
|
ref: s,
|
|
764
764
|
...r,
|
|
@@ -832,155 +832,109 @@ const AttributeListItem = forwardRef(function({ children: t, className: r, span:
|
|
|
832
832
|
variant: r = "primary",
|
|
833
833
|
size: s = "md",
|
|
834
834
|
disabled: i = !1,
|
|
835
|
-
type:
|
|
836
|
-
children:
|
|
837
|
-
...
|
|
835
|
+
type: o = "button",
|
|
836
|
+
children: a,
|
|
837
|
+
...n
|
|
838
838
|
}, l) {
|
|
839
839
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
840
840
|
"button",
|
|
841
841
|
{
|
|
842
842
|
ref: l,
|
|
843
|
-
type:
|
|
843
|
+
type: o,
|
|
844
844
|
className: cn(buttonVariants({ variant: r, size: s }), t),
|
|
845
845
|
disabled: i,
|
|
846
846
|
"aria-disabled": i,
|
|
847
847
|
inert: i ? !0 : void 0,
|
|
848
|
-
...
|
|
849
|
-
children:
|
|
848
|
+
...n,
|
|
849
|
+
children: a
|
|
850
850
|
}
|
|
851
851
|
);
|
|
852
852
|
}
|
|
853
|
-
),
|
|
854
|
-
|
|
855
|
-
"inline-flex items-center justify-center gap-2",
|
|
856
|
-
"rounded-lg",
|
|
857
|
-
"font-medium",
|
|
858
|
-
"transition-all",
|
|
859
|
-
"duration-200",
|
|
860
|
-
"focus-visible:outline-none",
|
|
861
|
-
"focus-visible:ring-2",
|
|
862
|
-
"focus-visible:ring-offset-2",
|
|
863
|
-
"disabled:opacity-50",
|
|
864
|
-
"disabled:pointer-events-none",
|
|
865
|
-
"select-none",
|
|
866
|
-
"shadow-lg",
|
|
867
|
-
"transition-transform",
|
|
868
|
-
"transition-shadow",
|
|
869
|
-
"will-change-transform,opacity,box-shadow",
|
|
870
|
-
"hover:scale-105",
|
|
871
|
-
"active:scale-95",
|
|
872
|
-
"focus-visible:shadow-xl",
|
|
873
|
-
"hover:shadow-xl",
|
|
874
|
-
"active:shadow-md"
|
|
875
|
-
].join(" "),
|
|
853
|
+
), menuVariants = cva(
|
|
854
|
+
"absolute z-70 min-w-40 bg-background rounded-lg border border-border transition-all duration-200 ease-out will-change-transform",
|
|
876
855
|
{
|
|
877
856
|
variants: {
|
|
878
|
-
variant: {
|
|
879
|
-
primary: "bg-primary text-white hover:bg-primary/90 focus-visible:ring-primary-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
880
|
-
secondary: "bg-secondary text-white hover:bg-secondary/90 focus-visible:ring-secondary-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
881
|
-
tertiary: "bg-tertiary text-white hover:bg-tertiary/90 focus-visible:ring-tertiary-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
882
|
-
ghost: "bg-white text-foreground hover:bg-ghost-soft focus-visible:ring-ghost-light focus-visible:ring-offset-white",
|
|
883
|
-
neutral: "bg-neutral text-foreground border border-border hover:bg-neutral/80 focus-visible:ring-foreground-light focus-visible:ring-offset-white shadow-sm",
|
|
884
|
-
"primary-outline": "border border-primary text-primary bg-white hover:bg-primary hover:text-white focus-visible:ring-primary-light focus-visible:ring-offset-white transition-all",
|
|
885
|
-
"secondary-outline": "border border-secondary text-secondary bg-white hover:bg-secondary hover:text-white focus-visible:ring-secondary-light focus-visible:ring-offset-white transition-all",
|
|
886
|
-
"tertiary-outline": "border border-tertiary text-tertiary bg-white hover:bg-tertiary hover:text-white focus-visible:ring-tertiary-light focus-visible:ring-offset-white transition-all",
|
|
887
|
-
"ghost-outline": "border border-ghost text-ghost bg-white hover:bg-ghost hover:text-white focus-visible:ring-ghost-light focus-visible:ring-offset-white transition-all",
|
|
888
|
-
"neutral-outline": "border border-border text-foreground bg-white hover:bg-neutral hover:text-foreground focus-visible:ring-foreground-light focus-visible:ring-offset-white transition-all",
|
|
889
|
-
"primary-ghost": "text-primary bg-white hover:bg-primary/20 focus-visible:ring-primary focus-visible:ring-offset-white",
|
|
890
|
-
"secondary-ghost": "text-secondary bg-white hover:bg-secondary/20 focus-visible:ring-secondary focus-visible:ring-offset-white",
|
|
891
|
-
"tertiary-ghost": "text-tertiary bg-white hover:bg-tertiary/20 focus-visible:ring-tertiary focus-visible:ring-offset-white",
|
|
892
|
-
"neutral-ghost": "text-foreground bg-white hover:bg-neutral/50 focus-visible:ring-foreground focus-visible:ring-offset-white",
|
|
893
|
-
success: "bg-success text-white hover:bg-success/90 focus-visible:ring-success-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
894
|
-
"success-outline": "border border-success text-success bg-white hover:bg-success hover:text-white focus-visible:ring-success-light focus-visible:ring-offset-white transition-all",
|
|
895
|
-
"success-ghost": "text-success bg-white hover:bg-success/20 focus-visible:ring-success-light focus-visible:ring-offset-white",
|
|
896
|
-
info: "bg-info text-white hover:bg-info/90 focus-visible:ring-info-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
897
|
-
"info-outline": "border border-info text-info bg-white hover:bg-info hover:text-white focus-visible:ring-info-light focus-visible:ring-offset-white transition-all",
|
|
898
|
-
"info-ghost": "text-info bg-white hover:bg-info/20 focus-visible:ring-info-light focus-visible:ring-offset-white",
|
|
899
|
-
warning: "bg-warning text-white hover:bg-warning/90 focus-visible:ring-warning-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
900
|
-
"warning-outline": "border border-warning text-warning bg-white hover:bg-warning hover:text-white focus-visible:ring-warning-light focus-visible:ring-offset-white transition-all",
|
|
901
|
-
"warning-ghost": "text-warning bg-white hover:bg-warning/20 focus-visible:ring-warning-light focus-visible:ring-offset-white",
|
|
902
|
-
danger: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
903
|
-
"danger-outline": "border border-danger text-danger bg-white hover:bg-danger hover:text-white focus-visible:ring-danger-light focus-visible:ring-offset-white transition-all",
|
|
904
|
-
"danger-ghost": "text-danger bg-white hover:bg-danger/20 focus-visible:ring-danger-light focus-visible:ring-offset-white",
|
|
905
|
-
outline: "border border-border text-foreground bg-white hover:bg-accent-soft focus-visible:ring-accent-soft focus-visible:ring-offset-white transition-all",
|
|
906
|
-
destructive: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md"
|
|
907
|
-
},
|
|
908
857
|
size: {
|
|
909
|
-
sm: "
|
|
910
|
-
md: "
|
|
911
|
-
|
|
858
|
+
sm: "py-1.5 px-1",
|
|
859
|
+
md: "py-2 px-1"
|
|
860
|
+
},
|
|
861
|
+
open: {
|
|
862
|
+
true: "opacity-100 translate-y-1",
|
|
863
|
+
false: "opacity-0 pointer-events-none translate-y-3"
|
|
912
864
|
}
|
|
913
865
|
},
|
|
914
866
|
defaultVariants: {
|
|
915
|
-
|
|
916
|
-
|
|
867
|
+
size: "md",
|
|
868
|
+
open: !1
|
|
917
869
|
}
|
|
918
870
|
}
|
|
919
871
|
);
|
|
920
|
-
function
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
}, p = `fixed bottom-4 ${e}-4`) : (d = {
|
|
932
|
-
position: "fixed",
|
|
933
|
-
bottom: t,
|
|
934
|
-
zIndex: 50
|
|
935
|
-
}, p = `fixed bottom-4 ${e}-4`), i(d), o(p);
|
|
936
|
-
}, [e, t]);
|
|
872
|
+
function useMenuOutsideClick(e, t, r, s) {
|
|
873
|
+
useEffect(() => {
|
|
874
|
+
if (!e) return;
|
|
875
|
+
function i(o) {
|
|
876
|
+
!t.current?.contains(o.target) && !r.current?.contains(o.target) && s();
|
|
877
|
+
}
|
|
878
|
+
return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
|
|
879
|
+
}, [e, s, t, r]);
|
|
880
|
+
}
|
|
881
|
+
function useEscapeClose(e, t, r) {
|
|
882
|
+
const s = useRef(null);
|
|
937
883
|
return useEffect(() => {
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
884
|
+
s.current && s.current.focus();
|
|
885
|
+
}, []), useEffect(() => {
|
|
886
|
+
const i = (o) => {
|
|
887
|
+
o.key === "Escape" && e && s.current && s.current.contains(document.activeElement) && !r && t();
|
|
942
888
|
};
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
r.current = c, c && a();
|
|
948
|
-
},
|
|
949
|
-
[a]
|
|
950
|
-
), s, n];
|
|
889
|
+
return e && (document.addEventListener("keydown", i), document.body.style.overflow = "hidden"), () => {
|
|
890
|
+
document.removeEventListener("keydown", i), document.body.style.overflow = "unset";
|
|
891
|
+
};
|
|
892
|
+
}, [e, t, r, s]), s;
|
|
951
893
|
}
|
|
952
|
-
const
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
894
|
+
const MenuContent = forwardRef(
|
|
895
|
+
({ children: e }, t) => /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: t, className: "flex flex-col gap-1", children: e })
|
|
896
|
+
), MenuItem = forwardRef(
|
|
897
|
+
({ children: e, disabled: t, ...r }, s) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", { ref: s, ...r, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
898
|
+
Button,
|
|
899
|
+
{
|
|
900
|
+
variant: "ghost",
|
|
901
|
+
className: cn("block text-left w-full"),
|
|
902
|
+
disabled: t,
|
|
903
|
+
children: e
|
|
904
|
+
}
|
|
905
|
+
) })
|
|
906
|
+
), MenuRoot = ({
|
|
907
|
+
isOpen: e,
|
|
908
|
+
onOutsideClick: t,
|
|
909
|
+
size: r = "md",
|
|
910
|
+
content: s,
|
|
911
|
+
children: i
|
|
912
|
+
}) => {
|
|
913
|
+
const o = useRef(null), a = useRef(null), n = useId();
|
|
914
|
+
return useMenuOutsideClick(e, a, o, t), useEscapeClose(e, t), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative w-fit", children: [
|
|
915
|
+
cloneElement(i, {
|
|
916
|
+
// @ts-expect-error: ref is valid for button or forwardRef components
|
|
917
|
+
ref: o,
|
|
918
|
+
"aria-haspopup": "menu",
|
|
919
|
+
"aria-expanded": e,
|
|
920
|
+
"aria-controls": n
|
|
921
|
+
}),
|
|
922
|
+
e && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
923
|
+
"div",
|
|
969
924
|
{
|
|
925
|
+
id: n,
|
|
970
926
|
ref: a,
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
b && "animate-fab-in",
|
|
976
|
-
t
|
|
977
|
-
),
|
|
978
|
-
style: c,
|
|
979
|
-
...o
|
|
927
|
+
className: cn(menuVariants({ size: r, open: e })),
|
|
928
|
+
role: "menu",
|
|
929
|
+
"aria-hidden": !e,
|
|
930
|
+
children: s
|
|
980
931
|
}
|
|
981
|
-
)
|
|
982
|
-
}
|
|
983
|
-
|
|
932
|
+
)
|
|
933
|
+
] });
|
|
934
|
+
}, Menu = Object.assign(MenuRoot, {
|
|
935
|
+
Content: MenuContent,
|
|
936
|
+
Item: MenuItem
|
|
937
|
+
});
|
|
984
938
|
function getIconColorFromVariant(e = "primary") {
|
|
985
939
|
const t = e.split("-");
|
|
986
940
|
if (t.length === 1)
|
|
@@ -1017,7 +971,7 @@ function getIconColorFromVariant(e = "primary") {
|
|
|
1017
971
|
}
|
|
1018
972
|
}
|
|
1019
973
|
const buttonIconVariants = cva(
|
|
1020
|
-
"inline-flex items-center justify-center font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none active:scale-[0.98] select-none",
|
|
974
|
+
"inline-flex items-center justify-center font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none active:scale-[0.98] select-none cursor-pointer",
|
|
1021
975
|
{
|
|
1022
976
|
variants: {
|
|
1023
977
|
variant: {
|
|
@@ -1026,36 +980,36 @@ const buttonIconVariants = cva(
|
|
|
1026
980
|
tertiary: "bg-tertiary text-white hover:bg-tertiary/90 focus-visible:ring-tertiary-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
1027
981
|
ghost: "bg-white text-foreground hover:bg-ghost-soft focus-visible:ring-ghost-light focus-visible:ring-offset-white",
|
|
1028
982
|
neutral: "bg-neutral text-foreground border border-border hover:bg-neutral/80 focus-visible:ring-foreground-light focus-visible:ring-offset-white shadow-sm",
|
|
1029
|
-
"primary-outline": "border border-
|
|
1030
|
-
"secondary-outline": "border border-
|
|
1031
|
-
"tertiary-outline": "border border-
|
|
1032
|
-
"ghost-outline": "border border-
|
|
983
|
+
"primary-outline": "border border-border text-primary bg-white hover:bg-primary hover:text-white focus-visible:ring-primary-light focus-visible:ring-offset-white transition-all",
|
|
984
|
+
"secondary-outline": "border border-border text-secondary bg-white hover:bg-secondary hover:text-white focus-visible:ring-secondary-light focus-visible:ring-offset-white transition-all",
|
|
985
|
+
"tertiary-outline": "border border-border text-tertiary bg-white hover:bg-tertiary hover:text-white focus-visible:ring-tertiary-light focus-visible:ring-offset-white transition-all",
|
|
986
|
+
"ghost-outline": "border border-border text-ghost bg-white hover:bg-ghost hover:text-white focus-visible:ring-ghost-light focus-visible:ring-offset-white transition-all",
|
|
1033
987
|
"neutral-outline": "border border-border text-foreground bg-white hover:bg-neutral hover:text-foreground focus-visible:ring-foreground-light focus-visible:ring-offset-white transition-all",
|
|
1034
988
|
"primary-ghost": "text-primary bg-white hover:bg-primary/20 focus-visible:ring-primary focus-visible:ring-offset-white",
|
|
1035
989
|
"secondary-ghost": "text-secondary bg-white hover:bg-secondary/20 focus-visible:ring-secondary focus-visible:ring-offset-white",
|
|
1036
990
|
"tertiary-ghost": "text-tertiary bg-white hover:bg-tertiary/20 focus-visible:ring-tertiary focus-visible:ring-offset-white",
|
|
1037
991
|
"neutral-ghost": "text-foreground bg-white hover:bg-neutral/50 focus-visible:ring-foreground focus-visible:ring-offset-white",
|
|
1038
992
|
success: "bg-success text-white hover:bg-success/90 focus-visible:ring-success-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
1039
|
-
"success-outline": "border border-
|
|
993
|
+
"success-outline": "border border-border text-success bg-white hover:bg-success hover:text-white focus-visible:ring-success-light focus-visible:ring-offset-white transition-all",
|
|
1040
994
|
"success-ghost": "text-success bg-white hover:bg-success/20 focus-visible:ring-success-light focus-visible:ring-offset-white",
|
|
1041
995
|
info: "bg-info text-white hover:bg-info/90 focus-visible:ring-info-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
1042
|
-
"info-outline": "border border-
|
|
996
|
+
"info-outline": "border border-border text-info bg-white hover:bg-info hover:text-white focus-visible:ring-info-light focus-visible:ring-offset-white transition-all",
|
|
1043
997
|
"info-ghost": "text-info bg-white hover:bg-info/20 focus-visible:ring-info-light focus-visible:ring-offset-white",
|
|
1044
998
|
warning: "bg-warning text-white hover:bg-warning/90 focus-visible:ring-warning-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
1045
|
-
"warning-outline": "border border-
|
|
999
|
+
"warning-outline": "border border-border text-warning bg-white hover:bg-warning hover:text-white focus-visible:ring-warning-light focus-visible:ring-offset-white transition-all",
|
|
1046
1000
|
"warning-ghost": "text-warning bg-white hover:bg-warning/20 focus-visible:ring-warning-light focus-visible:ring-offset-white",
|
|
1047
1001
|
danger: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
1048
|
-
"danger-outline": "border border-
|
|
1002
|
+
"danger-outline": "border border-border text-danger bg-white hover:bg-danger hover:text-white focus-visible:ring-danger-light focus-visible:ring-offset-white transition-all",
|
|
1049
1003
|
"danger-ghost": "text-danger bg-white hover:bg-danger/20 focus-visible:ring-danger-light focus-visible:ring-offset-white",
|
|
1050
1004
|
outline: "border border-border text-foreground bg-white hover:bg-accent-soft focus-visible:ring-accent-soft focus-visible:ring-offset-white transition-all",
|
|
1051
1005
|
destructive: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md"
|
|
1052
1006
|
},
|
|
1053
1007
|
size: {
|
|
1054
1008
|
xs: "h-6 w-6",
|
|
1055
|
-
sm: "h-
|
|
1056
|
-
md: "h-
|
|
1057
|
-
lg: "h-
|
|
1058
|
-
xl: "h-
|
|
1009
|
+
sm: "h-7 w-7",
|
|
1010
|
+
md: "h-9 w-9",
|
|
1011
|
+
lg: "h-10 w-10",
|
|
1012
|
+
xl: "h-12 w-12"
|
|
1059
1013
|
},
|
|
1060
1014
|
shape: {
|
|
1061
1015
|
rounded: "rounded-md",
|
|
@@ -1098,13 +1052,13 @@ const buttonIconVariants = cva(
|
|
|
1098
1052
|
size: "md",
|
|
1099
1053
|
color: "primary"
|
|
1100
1054
|
}
|
|
1101
|
-
}), Icon = React__default.forwardRef(function({ as: t, color: r = "primary", size: s = "md", className: i, ...
|
|
1055
|
+
}), Icon = React__default.forwardRef(function({ as: t, color: r = "primary", size: s = "md", className: i, ...o }, a) {
|
|
1102
1056
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1103
1057
|
t,
|
|
1104
1058
|
{
|
|
1105
|
-
ref:
|
|
1059
|
+
ref: a,
|
|
1106
1060
|
className: iconVariants({ color: r, size: s, className: i }),
|
|
1107
|
-
...
|
|
1061
|
+
...o
|
|
1108
1062
|
}
|
|
1109
1063
|
);
|
|
1110
1064
|
}), ButtonIcon = React__default.forwardRef(
|
|
@@ -1113,9 +1067,9 @@ const buttonIconVariants = cva(
|
|
|
1113
1067
|
variant: r = "primary",
|
|
1114
1068
|
size: s = "md",
|
|
1115
1069
|
shape: i = "rounded",
|
|
1116
|
-
disabled:
|
|
1117
|
-
as:
|
|
1118
|
-
"aria-label":
|
|
1070
|
+
disabled: o = !1,
|
|
1071
|
+
as: a,
|
|
1072
|
+
"aria-label": n,
|
|
1119
1073
|
...l
|
|
1120
1074
|
}, c) {
|
|
1121
1075
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -1131,22 +1085,182 @@ const buttonIconVariants = cva(
|
|
|
1131
1085
|
}),
|
|
1132
1086
|
t
|
|
1133
1087
|
),
|
|
1134
|
-
disabled:
|
|
1135
|
-
"aria-disabled":
|
|
1136
|
-
"aria-label":
|
|
1137
|
-
inert:
|
|
1088
|
+
disabled: o,
|
|
1089
|
+
"aria-disabled": o,
|
|
1090
|
+
"aria-label": n,
|
|
1091
|
+
inert: o ? !0 : void 0,
|
|
1138
1092
|
...l,
|
|
1139
1093
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1140
1094
|
Icon,
|
|
1141
1095
|
{
|
|
1142
|
-
as:
|
|
1143
|
-
size:
|
|
1096
|
+
as: a,
|
|
1097
|
+
size: "sm",
|
|
1144
1098
|
color: getIconColorFromVariant(r)
|
|
1145
1099
|
}
|
|
1146
1100
|
)
|
|
1147
1101
|
}
|
|
1148
1102
|
);
|
|
1149
1103
|
}
|
|
1104
|
+
), ButtonMenuIconRoot = forwardRef(
|
|
1105
|
+
(e, t) => {
|
|
1106
|
+
const {
|
|
1107
|
+
as: r = EllipsisVerticalIcon,
|
|
1108
|
+
content: s,
|
|
1109
|
+
onOpenChange: i,
|
|
1110
|
+
onClick: o,
|
|
1111
|
+
...a
|
|
1112
|
+
} = e ?? {}, [n, l] = useState(!1);
|
|
1113
|
+
useEffect(() => {
|
|
1114
|
+
i?.(n);
|
|
1115
|
+
}, [n, i]);
|
|
1116
|
+
const c = () => {
|
|
1117
|
+
l(!1);
|
|
1118
|
+
}, g = (d) => {
|
|
1119
|
+
l((u) => !u), o?.(d);
|
|
1120
|
+
};
|
|
1121
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1122
|
+
Menu,
|
|
1123
|
+
{
|
|
1124
|
+
isOpen: n,
|
|
1125
|
+
onOutsideClick: c,
|
|
1126
|
+
size: "md",
|
|
1127
|
+
content: /* @__PURE__ */ jsxRuntimeExports.jsx(Menu.Content, { children: s }),
|
|
1128
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonIcon, { ref: t, as: r, onClick: g, ...a })
|
|
1129
|
+
}
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1132
|
+
), ButtonMenuIcon = Object.assign(ButtonMenuIconRoot, {
|
|
1133
|
+
Item: Menu.Item
|
|
1134
|
+
}), buttonFloatVariants = cva(
|
|
1135
|
+
[
|
|
1136
|
+
"inline-flex items-center justify-center gap-2",
|
|
1137
|
+
"rounded-lg",
|
|
1138
|
+
"font-medium",
|
|
1139
|
+
"transition-all",
|
|
1140
|
+
"duration-200",
|
|
1141
|
+
"focus-visible:outline-none",
|
|
1142
|
+
"focus-visible:ring-2",
|
|
1143
|
+
"focus-visible:ring-offset-2",
|
|
1144
|
+
"disabled:opacity-50",
|
|
1145
|
+
"disabled:pointer-events-none",
|
|
1146
|
+
"select-none",
|
|
1147
|
+
"shadow-lg",
|
|
1148
|
+
"transition-transform",
|
|
1149
|
+
"transition-shadow",
|
|
1150
|
+
"will-change-transform,opacity,box-shadow",
|
|
1151
|
+
"hover:scale-105",
|
|
1152
|
+
"active:scale-95",
|
|
1153
|
+
"focus-visible:shadow-xl",
|
|
1154
|
+
"hover:shadow-xl",
|
|
1155
|
+
"active:shadow-md"
|
|
1156
|
+
].join(" "),
|
|
1157
|
+
{
|
|
1158
|
+
variants: {
|
|
1159
|
+
variant: {
|
|
1160
|
+
primary: "bg-primary text-white hover:bg-primary/90 focus-visible:ring-primary-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
1161
|
+
secondary: "bg-secondary text-white hover:bg-secondary/90 focus-visible:ring-secondary-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
1162
|
+
tertiary: "bg-tertiary text-white hover:bg-tertiary/90 focus-visible:ring-tertiary-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
1163
|
+
ghost: "bg-white text-foreground hover:bg-ghost-soft focus-visible:ring-ghost-light focus-visible:ring-offset-white",
|
|
1164
|
+
neutral: "bg-neutral text-foreground border border-border hover:bg-neutral/80 focus-visible:ring-foreground-light focus-visible:ring-offset-white shadow-sm",
|
|
1165
|
+
"primary-outline": "border border-primary text-primary bg-white hover:bg-primary hover:text-white focus-visible:ring-primary-light focus-visible:ring-offset-white transition-all",
|
|
1166
|
+
"secondary-outline": "border border-secondary text-secondary bg-white hover:bg-secondary hover:text-white focus-visible:ring-secondary-light focus-visible:ring-offset-white transition-all",
|
|
1167
|
+
"tertiary-outline": "border border-tertiary text-tertiary bg-white hover:bg-tertiary hover:text-white focus-visible:ring-tertiary-light focus-visible:ring-offset-white transition-all",
|
|
1168
|
+
"ghost-outline": "border border-ghost text-ghost bg-white hover:bg-ghost hover:text-white focus-visible:ring-ghost-light focus-visible:ring-offset-white transition-all",
|
|
1169
|
+
"neutral-outline": "border border-border text-foreground bg-white hover:bg-neutral hover:text-foreground focus-visible:ring-foreground-light focus-visible:ring-offset-white transition-all",
|
|
1170
|
+
"primary-ghost": "text-primary bg-white hover:bg-primary/20 focus-visible:ring-primary focus-visible:ring-offset-white",
|
|
1171
|
+
"secondary-ghost": "text-secondary bg-white hover:bg-secondary/20 focus-visible:ring-secondary focus-visible:ring-offset-white",
|
|
1172
|
+
"tertiary-ghost": "text-tertiary bg-white hover:bg-tertiary/20 focus-visible:ring-tertiary focus-visible:ring-offset-white",
|
|
1173
|
+
"neutral-ghost": "text-foreground bg-white hover:bg-neutral/50 focus-visible:ring-foreground focus-visible:ring-offset-white",
|
|
1174
|
+
success: "bg-success text-white hover:bg-success/90 focus-visible:ring-success-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
1175
|
+
"success-outline": "border border-success text-success bg-white hover:bg-success hover:text-white focus-visible:ring-success-light focus-visible:ring-offset-white transition-all",
|
|
1176
|
+
"success-ghost": "text-success bg-white hover:bg-success/20 focus-visible:ring-success-light focus-visible:ring-offset-white",
|
|
1177
|
+
info: "bg-info text-white hover:bg-info/90 focus-visible:ring-info-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
1178
|
+
"info-outline": "border border-info text-info bg-white hover:bg-info hover:text-white focus-visible:ring-info-light focus-visible:ring-offset-white transition-all",
|
|
1179
|
+
"info-ghost": "text-info bg-white hover:bg-info/20 focus-visible:ring-info-light focus-visible:ring-offset-white",
|
|
1180
|
+
warning: "bg-warning text-white hover:bg-warning/90 focus-visible:ring-warning-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
1181
|
+
"warning-outline": "border border-warning text-warning bg-white hover:bg-warning hover:text-white focus-visible:ring-warning-light focus-visible:ring-offset-white transition-all",
|
|
1182
|
+
"warning-ghost": "text-warning bg-white hover:bg-warning/20 focus-visible:ring-warning-light focus-visible:ring-offset-white",
|
|
1183
|
+
danger: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-light focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
1184
|
+
"danger-outline": "border border-danger text-danger bg-white hover:bg-danger hover:text-white focus-visible:ring-danger-light focus-visible:ring-offset-white transition-all",
|
|
1185
|
+
"danger-ghost": "text-danger bg-white hover:bg-danger/20 focus-visible:ring-danger-light focus-visible:ring-offset-white",
|
|
1186
|
+
outline: "border border-border text-foreground bg-white hover:bg-accent-soft focus-visible:ring-accent-soft focus-visible:ring-offset-white transition-all",
|
|
1187
|
+
destructive: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md"
|
|
1188
|
+
},
|
|
1189
|
+
size: {
|
|
1190
|
+
sm: "h-12 w-12 min-w-12 min-h-12 text-base",
|
|
1191
|
+
md: "h-14 w-14 min-w-14 min-h-14 text-lg",
|
|
1192
|
+
lg: "h-16 w-16 min-w-16 min-h-16 text-xl"
|
|
1193
|
+
}
|
|
1194
|
+
},
|
|
1195
|
+
defaultVariants: {
|
|
1196
|
+
variant: "primary",
|
|
1197
|
+
size: "md"
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
);
|
|
1201
|
+
function useFloatingPosition(e, t = "1rem") {
|
|
1202
|
+
const r = useRef(null), [s, i] = useState({}), [o, a] = useState("fixed bottom-4 right-4"), n = useCallback(() => {
|
|
1203
|
+
const c = r.current;
|
|
1204
|
+
if (!c) return;
|
|
1205
|
+
const d = c.getBoundingClientRect().height > window.innerHeight;
|
|
1206
|
+
let u = {}, f = "";
|
|
1207
|
+
d ? (u = {
|
|
1208
|
+
position: "fixed",
|
|
1209
|
+
bottom: t,
|
|
1210
|
+
zIndex: 50,
|
|
1211
|
+
transform: `translateY(${c.scrollTop}px)`
|
|
1212
|
+
}, f = `fixed bottom-4 ${e}-4`) : (u = {
|
|
1213
|
+
position: "fixed",
|
|
1214
|
+
bottom: t,
|
|
1215
|
+
zIndex: 50
|
|
1216
|
+
}, f = `fixed bottom-4 ${e}-4`), i(u), a(f);
|
|
1217
|
+
}, [e, t]);
|
|
1218
|
+
return useEffect(() => {
|
|
1219
|
+
n();
|
|
1220
|
+
const c = r.current;
|
|
1221
|
+
return c && c.addEventListener("scroll", n), window.addEventListener("resize", n), () => {
|
|
1222
|
+
c && c.removeEventListener("scroll", n), window.removeEventListener("resize", n);
|
|
1223
|
+
};
|
|
1224
|
+
}, [n]), useEffect(() => {
|
|
1225
|
+
r.current && n();
|
|
1226
|
+
}, [e, t, n]), [useCallback(
|
|
1227
|
+
(c) => {
|
|
1228
|
+
r.current = c, c && n();
|
|
1229
|
+
},
|
|
1230
|
+
[n]
|
|
1231
|
+
), s, o];
|
|
1232
|
+
}
|
|
1233
|
+
const ButtonFloat = forwardRef(
|
|
1234
|
+
function({
|
|
1235
|
+
className: t,
|
|
1236
|
+
variant: r = "primary",
|
|
1237
|
+
size: s = "md",
|
|
1238
|
+
side: i = "right",
|
|
1239
|
+
offset: o = "1rem",
|
|
1240
|
+
...a
|
|
1241
|
+
}, n) {
|
|
1242
|
+
const [l, c, g] = useFloatingPosition(
|
|
1243
|
+
i,
|
|
1244
|
+
o
|
|
1245
|
+
), [d, u] = useState(!1);
|
|
1246
|
+
return useEffect(() => {
|
|
1247
|
+
u(!0);
|
|
1248
|
+
}, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: l, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1249
|
+
"button",
|
|
1250
|
+
{
|
|
1251
|
+
ref: n,
|
|
1252
|
+
type: a.type || "button",
|
|
1253
|
+
className: cn(
|
|
1254
|
+
buttonFloatVariants({ variant: r, size: s }),
|
|
1255
|
+
g,
|
|
1256
|
+
d && "animate-fab-in",
|
|
1257
|
+
t
|
|
1258
|
+
),
|
|
1259
|
+
style: c,
|
|
1260
|
+
...a
|
|
1261
|
+
}
|
|
1262
|
+
) });
|
|
1263
|
+
}
|
|
1150
1264
|
), calculatorRootVariants = cva(
|
|
1151
1265
|
"flex flex-col w-full max-w-xs rounded-lg bg-background",
|
|
1152
1266
|
{
|
|
@@ -1264,8 +1378,8 @@ const BUTTONS = [
|
|
|
1264
1378
|
disabled: r,
|
|
1265
1379
|
className: s,
|
|
1266
1380
|
"aria-label": i
|
|
1267
|
-
},
|
|
1268
|
-
const { input:
|
|
1381
|
+
}, o) => {
|
|
1382
|
+
const { input: a, inputRef: n, handleButton: l, handleInput: c } = useCalculator({
|
|
1269
1383
|
initialValue: e,
|
|
1270
1384
|
disabled: r,
|
|
1271
1385
|
onChange: t
|
|
@@ -1273,7 +1387,7 @@ const BUTTONS = [
|
|
|
1273
1387
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1274
1388
|
"div",
|
|
1275
1389
|
{
|
|
1276
|
-
ref:
|
|
1390
|
+
ref: o,
|
|
1277
1391
|
className: cn(calculatorRootVariants({ disabled: r }), s),
|
|
1278
1392
|
"aria-label": i || "Calculator",
|
|
1279
1393
|
role: "region",
|
|
@@ -1281,16 +1395,16 @@ const BUTTONS = [
|
|
|
1281
1395
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1282
1396
|
"input",
|
|
1283
1397
|
{
|
|
1284
|
-
ref:
|
|
1398
|
+
ref: n,
|
|
1285
1399
|
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)]",
|
|
1286
|
-
value:
|
|
1400
|
+
value: a,
|
|
1287
1401
|
onChange: c,
|
|
1288
1402
|
disabled: r,
|
|
1289
1403
|
inputMode: "decimal",
|
|
1290
1404
|
"aria-label": "Calculator input"
|
|
1291
1405
|
}
|
|
1292
1406
|
),
|
|
1293
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-3", children: BUTTONS.map((
|
|
1407
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-3", children: BUTTONS.map((g, d) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full", children: g.map((u) => u === "⌫" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1294
1408
|
ButtonIcon,
|
|
1295
1409
|
{
|
|
1296
1410
|
as: X,
|
|
@@ -1304,285 +1418,21 @@ const BUTTONS = [
|
|
|
1304
1418
|
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1305
1419
|
CalculatorButton,
|
|
1306
1420
|
{
|
|
1307
|
-
variant:
|
|
1308
|
-
onClick: () => l(
|
|
1421
|
+
variant: u === "=" ? "action" : u === "C" ? "danger" : ["/", "*", "-", "+", "/"].includes(u) ? "operator" : "default",
|
|
1422
|
+
onClick: () => l(u),
|
|
1309
1423
|
disabled: r,
|
|
1310
|
-
"aria-label":
|
|
1311
|
-
children:
|
|
1424
|
+
"aria-label": u,
|
|
1425
|
+
children: u
|
|
1312
1426
|
},
|
|
1313
|
-
|
|
1314
|
-
)) },
|
|
1427
|
+
u
|
|
1428
|
+
)) }, d)) })
|
|
1315
1429
|
]
|
|
1316
1430
|
}
|
|
1317
1431
|
);
|
|
1318
1432
|
}
|
|
1319
1433
|
);
|
|
1320
1434
|
Calculator.displayName = "Calculator";
|
|
1321
|
-
const
|
|
1322
|
-
function useCalendarContext() {
|
|
1323
|
-
const e = useContext(CalendarContext);
|
|
1324
|
-
if (!e)
|
|
1325
|
-
throw new Error(
|
|
1326
|
-
"useCalendarContext must be used within CalendarContext.Provider"
|
|
1327
|
-
);
|
|
1328
|
-
return e;
|
|
1329
|
-
}
|
|
1330
|
-
const CalendarHeader = () => {
|
|
1331
|
-
const { value: e, year: t, month: r, setMonth: s } = useCalendarContext();
|
|
1332
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between px-4 pt-4 pb-2", children: [
|
|
1333
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { fontSize: "base", fontWeight: "semibold", className: "ml-2", children: e ? e instanceof Date ? e.toLocaleDateString(void 0, {
|
|
1334
|
-
year: "numeric",
|
|
1335
|
-
month: "long"
|
|
1336
|
-
}) : Array.isArray(e) && e[0] ? e[0].toLocaleDateString(void 0, {
|
|
1337
|
-
year: "numeric",
|
|
1338
|
-
month: "long"
|
|
1339
|
-
}) : `${t} ${new Date(t, r).toLocaleString(void 0, { month: "long" })}` : `${t} ${new Date(t, r).toLocaleString(void 0, { month: "long" })}` }),
|
|
1340
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
|
|
1341
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1342
|
-
ButtonIcon,
|
|
1343
|
-
{
|
|
1344
|
-
as: ChevronLeft,
|
|
1345
|
-
variant: "ghost",
|
|
1346
|
-
size: "sm",
|
|
1347
|
-
"aria-label": "Previous month",
|
|
1348
|
-
onClick: () => s(r === 0 ? 11 : r - 1)
|
|
1349
|
-
}
|
|
1350
|
-
),
|
|
1351
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1352
|
-
ButtonIcon,
|
|
1353
|
-
{
|
|
1354
|
-
as: ChevronRight,
|
|
1355
|
-
variant: "ghost",
|
|
1356
|
-
size: "sm",
|
|
1357
|
-
"aria-label": "Next month",
|
|
1358
|
-
onClick: () => s(r === 11 ? 0 : r + 1)
|
|
1359
|
-
}
|
|
1360
|
-
)
|
|
1361
|
-
] })
|
|
1362
|
-
] });
|
|
1363
|
-
}, 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 = () => {
|
|
1364
|
-
const e = useCalendarContext(), { year: t, month: r, value: s, onChange: i, setMonth: n, setYear: o } = e, a = (g, m) => new Date(g, m + 1, 0).getDate(), c = ((g, m) => new Date(g, m, 1).getDay())(t, r), h = a(t, r), b = r - 1 < 0 ? 11 : r - 1, d = r === 0 ? t - 1 : t, p = a(t, b), y = r === 11 ? 0 : r + 1, f = r === 11 ? t + 1 : t, v = [];
|
|
1365
|
-
for (let g = 0; g < c; g++) {
|
|
1366
|
-
const m = p - c + g + 1;
|
|
1367
|
-
v.push(
|
|
1368
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1369
|
-
ButtonIcon,
|
|
1370
|
-
{
|
|
1371
|
-
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: m }),
|
|
1372
|
-
size: "sm",
|
|
1373
|
-
"aria-label": "Previous month day",
|
|
1374
|
-
variant: "ghost",
|
|
1375
|
-
onClick: () => {
|
|
1376
|
-
i?.(new Date(d, b, m)), n(b), o(d);
|
|
1377
|
-
}
|
|
1378
|
-
},
|
|
1379
|
-
"prev-" + g
|
|
1380
|
-
)
|
|
1381
|
-
);
|
|
1382
|
-
}
|
|
1383
|
-
for (let g = 1; g <= h; g++) {
|
|
1384
|
-
const m = s instanceof Date && s.getFullYear() === t && s.getMonth() === r && s.getDate() === g;
|
|
1385
|
-
v.push(
|
|
1386
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1387
|
-
ButtonIcon,
|
|
1388
|
-
{
|
|
1389
|
-
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1390
|
-
Text,
|
|
1391
|
-
{
|
|
1392
|
-
as: "span",
|
|
1393
|
-
fontSize: "sm",
|
|
1394
|
-
color: m ? "inherit" : "ghost",
|
|
1395
|
-
className: m ? "bg-primary text-white rounded-full" : "",
|
|
1396
|
-
children: g
|
|
1397
|
-
}
|
|
1398
|
-
),
|
|
1399
|
-
variant: m ? "primary" : "ghost",
|
|
1400
|
-
size: "sm",
|
|
1401
|
-
"aria-label": `Select ${t}-${r + 1}-${g}`,
|
|
1402
|
-
"aria-current": m ? "date" : void 0,
|
|
1403
|
-
onClick: () => {
|
|
1404
|
-
i?.(new Date(t, r, g));
|
|
1405
|
-
}
|
|
1406
|
-
},
|
|
1407
|
-
g
|
|
1408
|
-
)
|
|
1409
|
-
);
|
|
1410
|
-
}
|
|
1411
|
-
const w = c + h;
|
|
1412
|
-
for (let g = 0; g < (w % 7 === 0 ? 0 : 7 - w % 7); g++)
|
|
1413
|
-
v.push(
|
|
1414
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1415
|
-
ButtonIcon,
|
|
1416
|
-
{
|
|
1417
|
-
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: g + 1 }),
|
|
1418
|
-
size: "sm",
|
|
1419
|
-
"aria-label": "Next month day",
|
|
1420
|
-
variant: "ghost",
|
|
1421
|
-
onClick: () => {
|
|
1422
|
-
i?.(new Date(f, y, g + 1)), n(y), o(f);
|
|
1423
|
-
}
|
|
1424
|
-
},
|
|
1425
|
-
"next-" + g
|
|
1426
|
-
)
|
|
1427
|
-
);
|
|
1428
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-7 gap-2 px-4 pb-4", children: v });
|
|
1429
|
-
}, CalendarDaysRange = () => {
|
|
1430
|
-
const { year: e, month: t, value: r, onChange: s, setMonth: i, setYear: n } = useCalendarContext(), o = (u, x) => new Date(u, x + 1, 0).getDate(), l = ((u, x) => new Date(u, x, 1).getDay())(e, t), c = o(e, t), h = t - 1 < 0 ? 11 : t - 1, b = t === 0 ? e - 1 : e, d = o(e, h), p = t === 11 ? 0 : t + 1, y = t === 11 ? e + 1 : e, f = [], v = () => {
|
|
1431
|
-
if (!Array.isArray(r)) return [null, null];
|
|
1432
|
-
const [u, x] = r;
|
|
1433
|
-
return !u && !x ? [null, null] : u && x ? u <= x ? [u, x] : [x, u] : [u, x];
|
|
1434
|
-
}, [w, g] = v(), m = (u) => {
|
|
1435
|
-
if (!w || !g) return !1;
|
|
1436
|
-
const x = new Date(e, t, u);
|
|
1437
|
-
return x >= w && x <= g;
|
|
1438
|
-
}, S = (u) => w ? w.getFullYear() === e && w.getMonth() === t && w.getDate() === u : !1, I = (u) => g ? g.getFullYear() === e && g.getMonth() === t && g.getDate() === u : !1;
|
|
1439
|
-
for (let u = 0; u < l; u++) {
|
|
1440
|
-
const x = d - l + u + 1;
|
|
1441
|
-
f.push(
|
|
1442
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1443
|
-
ButtonIcon,
|
|
1444
|
-
{
|
|
1445
|
-
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: x }),
|
|
1446
|
-
size: "sm",
|
|
1447
|
-
"aria-label": "Previous month day",
|
|
1448
|
-
variant: "ghost",
|
|
1449
|
-
onClick: () => {
|
|
1450
|
-
s?.([null, null]), i(h), n(b);
|
|
1451
|
-
}
|
|
1452
|
-
},
|
|
1453
|
-
"prev-" + u
|
|
1454
|
-
)
|
|
1455
|
-
);
|
|
1456
|
-
}
|
|
1457
|
-
for (let u = 1; u <= c; u++) {
|
|
1458
|
-
const x = m(u), E = S(u), C = I(u);
|
|
1459
|
-
f.push(
|
|
1460
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1461
|
-
ButtonIcon,
|
|
1462
|
-
{
|
|
1463
|
-
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1464
|
-
Text,
|
|
1465
|
-
{
|
|
1466
|
-
as: "span",
|
|
1467
|
-
fontSize: "sm",
|
|
1468
|
-
color: x || E || C ? "inherit" : "ghost",
|
|
1469
|
-
className: cn(
|
|
1470
|
-
x && " bg-primary text-white",
|
|
1471
|
-
E && "rounded-l-full bg-primary text-white",
|
|
1472
|
-
C && "rounded-r-full bg-primary text-white"
|
|
1473
|
-
),
|
|
1474
|
-
children: u
|
|
1475
|
-
}
|
|
1476
|
-
),
|
|
1477
|
-
variant: E || C || x ? "primary" : "ghost",
|
|
1478
|
-
size: "sm",
|
|
1479
|
-
"aria-label": `Select ${e}-${t + 1}-${u}`,
|
|
1480
|
-
"aria-current": E || C ? "date" : void 0,
|
|
1481
|
-
onClick: () => {
|
|
1482
|
-
if (!Array.isArray(r) || !r[0] || r[0] && r[1])
|
|
1483
|
-
s?.([new Date(e, t, u), null]);
|
|
1484
|
-
else if (r[0] && !r[1]) {
|
|
1485
|
-
const j = r[0], R = new Date(e, t, u);
|
|
1486
|
-
j.getTime() === R.getTime() ? s?.([j, R]) : s?.(j < R ? [j, R] : [R, j]);
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
},
|
|
1490
|
-
u
|
|
1491
|
-
)
|
|
1492
|
-
);
|
|
1493
|
-
}
|
|
1494
|
-
const N = l + c;
|
|
1495
|
-
for (let u = 0; u < (N % 7 === 0 ? 0 : 7 - N % 7); u++)
|
|
1496
|
-
f.push(
|
|
1497
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1498
|
-
ButtonIcon,
|
|
1499
|
-
{
|
|
1500
|
-
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: u + 1 }),
|
|
1501
|
-
size: "sm",
|
|
1502
|
-
"aria-label": "Next month day",
|
|
1503
|
-
variant: "ghost",
|
|
1504
|
-
onClick: () => {
|
|
1505
|
-
s?.([null, null]), i(p), n(y);
|
|
1506
|
-
}
|
|
1507
|
-
},
|
|
1508
|
-
"next-" + u
|
|
1509
|
-
)
|
|
1510
|
-
);
|
|
1511
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-7 gap-2 px-4 pb-4", children: f });
|
|
1512
|
-
}, CalendarDays = () => {
|
|
1513
|
-
const { type: e } = useCalendarContext();
|
|
1514
|
-
return e === "range" ? /* @__PURE__ */ jsxRuntimeExports.jsx(CalendarDaysRange, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(CalendarDaysSingle, {});
|
|
1515
|
-
};
|
|
1516
|
-
function useCalendar({
|
|
1517
|
-
value: e,
|
|
1518
|
-
type: t,
|
|
1519
|
-
onChange: r,
|
|
1520
|
-
initialYear: s,
|
|
1521
|
-
initialMonth: i
|
|
1522
|
-
}) {
|
|
1523
|
-
const [n, o] = useState(i), [a, l] = useState(s), [c, h] = useState([
|
|
1524
|
-
null,
|
|
1525
|
-
null
|
|
1526
|
-
]);
|
|
1527
|
-
let b = e;
|
|
1528
|
-
t === "range" && !e && (b = c);
|
|
1529
|
-
const d = useCallback(() => {
|
|
1530
|
-
const f = n === 0 ? 11 : n - 1, v = n === 0 ? a - 1 : a;
|
|
1531
|
-
o(f), l(v), t === "single" && r?.(new Date(v, f, 1));
|
|
1532
|
-
}, [n, a, t, r]), p = useCallback(() => {
|
|
1533
|
-
const f = n === 11 ? 0 : n + 1, v = n === 11 ? a + 1 : a;
|
|
1534
|
-
o(f), l(v), t === "single" && r?.(new Date(v, f, 1));
|
|
1535
|
-
}, [n, a, t, r]), y = useCallback(
|
|
1536
|
-
(f) => {
|
|
1537
|
-
t === "single" ? r?.(f) : t === "range" && (h(f), r?.(f));
|
|
1538
|
-
},
|
|
1539
|
-
[t, r]
|
|
1540
|
-
);
|
|
1541
|
-
return {
|
|
1542
|
-
year: a,
|
|
1543
|
-
month: n,
|
|
1544
|
-
value: b,
|
|
1545
|
-
setMonth: o,
|
|
1546
|
-
setYear: l,
|
|
1547
|
-
onChange: y,
|
|
1548
|
-
handlePrevMonth: d,
|
|
1549
|
-
handleNextMonth: p
|
|
1550
|
-
};
|
|
1551
|
-
}
|
|
1552
|
-
const CalendarRoot = ({
|
|
1553
|
-
value: e,
|
|
1554
|
-
onChange: t,
|
|
1555
|
-
className: r,
|
|
1556
|
-
type: s = "single",
|
|
1557
|
-
...i
|
|
1558
|
-
}) => {
|
|
1559
|
-
const n = /* @__PURE__ */ new Date(), o = useCalendar({
|
|
1560
|
-
value: e,
|
|
1561
|
-
onChange: t,
|
|
1562
|
-
type: s,
|
|
1563
|
-
initialYear: n.getFullYear(),
|
|
1564
|
-
initialMonth: n.getMonth()
|
|
1565
|
-
});
|
|
1566
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1567
|
-
CalendarContext.Provider,
|
|
1568
|
-
{
|
|
1569
|
-
value: {
|
|
1570
|
-
year: o.year,
|
|
1571
|
-
month: o.month,
|
|
1572
|
-
value: o.value,
|
|
1573
|
-
type: s,
|
|
1574
|
-
setMonth: o.setMonth,
|
|
1575
|
-
setYear: o.setYear,
|
|
1576
|
-
onChange: o.onChange
|
|
1577
|
-
},
|
|
1578
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("select-none", r), ...i, children: [
|
|
1579
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarHeader, {}),
|
|
1580
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarWeekdays, {}),
|
|
1581
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarDays, {})
|
|
1582
|
-
] })
|
|
1583
|
-
}
|
|
1584
|
-
);
|
|
1585
|
-
}, Calendar = Object.assign(CalendarRoot, {}), cardVariants = cva(
|
|
1435
|
+
const cardVariants = cva(
|
|
1586
1436
|
"block transition-colors duration-200 cursor-pointer w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-light hover:bg-gray-50",
|
|
1587
1437
|
{
|
|
1588
1438
|
variants: {
|
|
@@ -1608,40 +1458,54 @@ const CalendarRoot = ({
|
|
|
1608
1458
|
bordered: !1
|
|
1609
1459
|
}
|
|
1610
1460
|
}
|
|
1611
|
-
),
|
|
1461
|
+
), CardList = forwardRef(
|
|
1462
|
+
({ children: e }, t) => /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: t, className: "inline-flex items-center", children: e })
|
|
1463
|
+
), CardListItem = forwardRef(
|
|
1464
|
+
({ children: e }, t) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1465
|
+
"li",
|
|
1466
|
+
{
|
|
1467
|
+
ref: t,
|
|
1468
|
+
className: "flex items-center after:content-[''] after:inline-block after:mx-2 after:w-1 after:h-1 after:rounded-full after:bg-ghost last:after:hidden",
|
|
1469
|
+
children: e
|
|
1470
|
+
}
|
|
1471
|
+
)
|
|
1472
|
+
), CardRoot = forwardRef(
|
|
1612
1473
|
({
|
|
1613
1474
|
size: e = "md",
|
|
1614
1475
|
shape: t = "rounded",
|
|
1615
1476
|
avatar: r,
|
|
1616
1477
|
title: s,
|
|
1617
1478
|
subtitle: i,
|
|
1618
|
-
badge:
|
|
1619
|
-
supplementaryInfo:
|
|
1620
|
-
bordered:
|
|
1479
|
+
badge: o,
|
|
1480
|
+
supplementaryInfo: a,
|
|
1481
|
+
bordered: n = !1,
|
|
1621
1482
|
className: l,
|
|
1622
1483
|
...c
|
|
1623
|
-
},
|
|
1484
|
+
}, g) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1624
1485
|
"button",
|
|
1625
1486
|
{
|
|
1626
|
-
ref:
|
|
1627
|
-
className: cn(cardVariants({ size: e, shape: t, bordered:
|
|
1487
|
+
ref: g,
|
|
1488
|
+
className: cn(cardVariants({ size: e, shape: t, bordered: n }), l),
|
|
1628
1489
|
...c,
|
|
1629
1490
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-4", children: [
|
|
1630
1491
|
r && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0", children: r }),
|
|
1631
1492
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full", children: [
|
|
1632
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className:
|
|
1633
|
-
s && /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "h3", fontSize: "
|
|
1634
|
-
i && /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "p", fontSize: "
|
|
1493
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2", children: [
|
|
1494
|
+
s && /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "h3", fontSize: "lg", fontWeight: "semibold", children: s }),
|
|
1495
|
+
i && /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "p", fontSize: "sm", color: "gray", children: i })
|
|
1635
1496
|
] }),
|
|
1636
|
-
(
|
|
1637
|
-
|
|
1638
|
-
|
|
1497
|
+
(o || a) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center", children: [
|
|
1498
|
+
o,
|
|
1499
|
+
typeof a == "string" ? /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "p", fontSize: "sm", color: "gray", children: a }) : a
|
|
1639
1500
|
] })
|
|
1640
1501
|
] })
|
|
1641
1502
|
] })
|
|
1642
1503
|
}
|
|
1643
1504
|
)
|
|
1644
|
-
),
|
|
1505
|
+
), Card = Object.assign(CardRoot, {
|
|
1506
|
+
List: CardList,
|
|
1507
|
+
ListItem: CardListItem
|
|
1508
|
+
}), filterChipVariants = cva(
|
|
1645
1509
|
"inline-flex items-center gap-1.5 rounded-full font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none select-none cursor-pointer text-sm leading-none",
|
|
1646
1510
|
{
|
|
1647
1511
|
variants: {
|
|
@@ -1685,22 +1549,22 @@ const CalendarRoot = ({
|
|
|
1685
1549
|
variant: r = "neutral-outline",
|
|
1686
1550
|
size: s = "md",
|
|
1687
1551
|
disabled: i = !1,
|
|
1688
|
-
children:
|
|
1689
|
-
...
|
|
1690
|
-
},
|
|
1552
|
+
children: o,
|
|
1553
|
+
...a
|
|
1554
|
+
}, n) {
|
|
1691
1555
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1692
1556
|
"button",
|
|
1693
1557
|
{
|
|
1694
|
-
ref:
|
|
1558
|
+
ref: n,
|
|
1695
1559
|
type: "button",
|
|
1696
1560
|
className: cn(filterChipVariants({ variant: r, size: s }), t),
|
|
1697
1561
|
disabled: i,
|
|
1698
1562
|
"aria-disabled": i,
|
|
1699
|
-
"aria-label": `${
|
|
1563
|
+
"aria-label": `${o}, removable`,
|
|
1700
1564
|
inert: i ? !0 : void 0,
|
|
1701
|
-
...
|
|
1565
|
+
...a,
|
|
1702
1566
|
children: [
|
|
1703
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex-shrink-0", children:
|
|
1567
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex-shrink-0", children: o }),
|
|
1704
1568
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { as: XIcon, color: "inherit", size: s === "lg" ? "md" : "sm" })
|
|
1705
1569
|
]
|
|
1706
1570
|
}
|
|
@@ -1728,15 +1592,15 @@ const CalendarRoot = ({
|
|
|
1728
1592
|
), noResultsHeaderVariants = cva(
|
|
1729
1593
|
"flex flex-row items-center gap-3 mb-2"
|
|
1730
1594
|
), NoResults = React__default.forwardRef(
|
|
1731
|
-
function e({ icon: t, title: r, subtitle: s, action: i, className:
|
|
1595
|
+
function e({ icon: t, title: r, subtitle: s, action: i, className: o, hasGrayBackground: a, ...n }, l) {
|
|
1732
1596
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1733
1597
|
"section",
|
|
1734
1598
|
{
|
|
1735
1599
|
ref: l,
|
|
1736
|
-
className: cn(noResultsVariants({ hasGrayBackground:
|
|
1600
|
+
className: cn(noResultsVariants({ hasGrayBackground: a }), o),
|
|
1737
1601
|
role: "status",
|
|
1738
1602
|
"aria-label": "No results found",
|
|
1739
|
-
...
|
|
1603
|
+
...n,
|
|
1740
1604
|
children: [
|
|
1741
1605
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("header", { className: noResultsHeaderVariants(), children: [
|
|
1742
1606
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { as: t, size: "lg", color: "ghost", "aria-hidden": "true" }),
|
|
@@ -1881,14 +1745,14 @@ const getTableColumnClass = (e) => {
|
|
|
1881
1745
|
);
|
|
1882
1746
|
}
|
|
1883
1747
|
), TableColumn = forwardRef(
|
|
1884
|
-
({ as: e = "td", span: t, align: r = "left", children: s, className: i, ...
|
|
1885
|
-
const
|
|
1748
|
+
({ as: e = "td", span: t, align: r = "left", children: s, className: i, ...o }, a) => {
|
|
1749
|
+
const n = e === "th" ? "columnheader" : "cell";
|
|
1886
1750
|
let l = "text-left";
|
|
1887
1751
|
return r === "center" ? l = "text-center" : r === "right" && (l = "text-right"), /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1888
1752
|
"div",
|
|
1889
1753
|
{
|
|
1890
|
-
ref:
|
|
1891
|
-
role:
|
|
1754
|
+
ref: a,
|
|
1755
|
+
role: n,
|
|
1892
1756
|
className: cn(
|
|
1893
1757
|
"px-4 py-2",
|
|
1894
1758
|
"[&:not(:last-child)]:border-r [&:not(:last-child)]:border-border",
|
|
@@ -1897,7 +1761,7 @@ const getTableColumnClass = (e) => {
|
|
|
1897
1761
|
"truncate overflow-hidden whitespace-nowrap",
|
|
1898
1762
|
i
|
|
1899
1763
|
),
|
|
1900
|
-
...
|
|
1764
|
+
...o,
|
|
1901
1765
|
children: s
|
|
1902
1766
|
}
|
|
1903
1767
|
);
|
|
@@ -1989,90 +1853,36 @@ const getTableColumnClass = (e) => {
|
|
|
1989
1853
|
}
|
|
1990
1854
|
}
|
|
1991
1855
|
), Tile = forwardRef(
|
|
1992
|
-
({ variant: e = "white", size: t = "md", shape: r = "rounded", className: s, ...i },
|
|
1856
|
+
({ variant: e = "white", size: t = "md", shape: r = "rounded", className: s, ...i }, o) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1993
1857
|
"div",
|
|
1994
1858
|
{
|
|
1995
|
-
ref:
|
|
1859
|
+
ref: o,
|
|
1996
1860
|
className: cn(tileVariants({ variant: e, size: t, shape: r }), s),
|
|
1997
1861
|
...i
|
|
1998
1862
|
}
|
|
1999
1863
|
)
|
|
2000
1864
|
);
|
|
2001
|
-
function getColSpan(e = 4) {
|
|
2002
|
-
switch (e) {
|
|
2003
|
-
case 1:
|
|
2004
|
-
return "col-span-1";
|
|
2005
|
-
case 2:
|
|
2006
|
-
return "col-span-2";
|
|
2007
|
-
case 3:
|
|
2008
|
-
return "col-span-3";
|
|
2009
|
-
case 4:
|
|
2010
|
-
return "col-span-4";
|
|
2011
|
-
case 5:
|
|
2012
|
-
return "col-span-5";
|
|
2013
|
-
case 6:
|
|
2014
|
-
return "col-span-6";
|
|
2015
|
-
case 7:
|
|
2016
|
-
return "col-span-7";
|
|
2017
|
-
case 8:
|
|
2018
|
-
return "col-span-8";
|
|
2019
|
-
case 9:
|
|
2020
|
-
return "col-span-9";
|
|
2021
|
-
case 10:
|
|
2022
|
-
return "col-span-10";
|
|
2023
|
-
case 11:
|
|
2024
|
-
return "col-span-11";
|
|
2025
|
-
case 12:
|
|
2026
|
-
return "col-span-12";
|
|
2027
|
-
default:
|
|
2028
|
-
return "col-span-4";
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
const DescriptionListItem = forwardRef(function e({ children: t, className: r, span: s = 4, ...i }, n) {
|
|
2032
|
-
const o = getColSpan(s);
|
|
2033
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: n, className: cn(o, r), ...i, children: t });
|
|
2034
|
-
}), DescriptionListTerm = forwardRef(function e({ children: t, ...r }, s) {
|
|
2035
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("dt", { ref: s, ...r, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", fontWeight: "medium", color: "gray", children: t }) });
|
|
2036
|
-
}), DescriptionListDetails = forwardRef(function e({ children: t, color: r = "black", ...s }, i) {
|
|
2037
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("dd", { ref: i, ...s, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "base", fontWeight: "medium", color: r, children: t }) });
|
|
2038
|
-
}), DescriptionListRoot = forwardRef(
|
|
2039
|
-
function e({ children: t, className: r, ...s }, i) {
|
|
2040
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2041
|
-
"dl",
|
|
2042
|
-
{
|
|
2043
|
-
ref: i,
|
|
2044
|
-
className: cn("grid grid-cols-12 gap-y-4", r),
|
|
2045
|
-
...s,
|
|
2046
|
-
children: t
|
|
2047
|
-
}
|
|
2048
|
-
);
|
|
2049
|
-
}
|
|
2050
|
-
), DescriptionList = Object.assign(DescriptionListRoot, {
|
|
2051
|
-
Item: DescriptionListItem,
|
|
2052
|
-
Term: DescriptionListTerm,
|
|
2053
|
-
Details: DescriptionListDetails
|
|
2054
|
-
});
|
|
2055
1865
|
function useImage({ src: e }) {
|
|
2056
|
-
const [t, r] = useState(!1), [s, i] = useState(!1),
|
|
1866
|
+
const [t, r] = useState(!1), [s, i] = useState(!1), o = useRef(!1), a = () => {
|
|
2057
1867
|
r(!0);
|
|
2058
|
-
},
|
|
1868
|
+
}, n = () => {
|
|
2059
1869
|
i(!0);
|
|
2060
1870
|
};
|
|
2061
1871
|
return useEffect(() => {
|
|
2062
1872
|
if (!e) return;
|
|
2063
1873
|
const l = new Image();
|
|
2064
1874
|
return l.src = e, l.onload = () => {
|
|
2065
|
-
|
|
1875
|
+
o.current || r(!0);
|
|
2066
1876
|
}, l.onerror = () => {
|
|
2067
|
-
|
|
1877
|
+
o.current || i(!0);
|
|
2068
1878
|
}, () => {
|
|
2069
|
-
|
|
1879
|
+
o.current = !0;
|
|
2070
1880
|
};
|
|
2071
1881
|
}, [e]), {
|
|
2072
1882
|
loaded: t,
|
|
2073
1883
|
errored: s,
|
|
2074
|
-
handleLoad:
|
|
2075
|
-
handleError:
|
|
1884
|
+
handleLoad: a,
|
|
1885
|
+
handleError: n
|
|
2076
1886
|
};
|
|
2077
1887
|
}
|
|
2078
1888
|
const imageVariants = cva("block object-cover", {
|
|
@@ -2149,13 +1959,13 @@ function BaseImageFallback({
|
|
|
2149
1959
|
height: r,
|
|
2150
1960
|
className: s,
|
|
2151
1961
|
style: i,
|
|
2152
|
-
shape:
|
|
2153
|
-
size:
|
|
1962
|
+
shape: o,
|
|
1963
|
+
size: a
|
|
2154
1964
|
}) {
|
|
2155
1965
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
2156
1966
|
"div",
|
|
2157
1967
|
{
|
|
2158
|
-
className: imageAtomVariants({ shape:
|
|
1968
|
+
className: imageAtomVariants({ shape: o, size: a, className: s }),
|
|
2159
1969
|
style: { width: t, height: r, ...i },
|
|
2160
1970
|
"aria-label": e,
|
|
2161
1971
|
role: "img",
|
|
@@ -2180,56 +1990,56 @@ const BaseImage = forwardRef(
|
|
|
2180
1990
|
onLoad: r,
|
|
2181
1991
|
onError: s,
|
|
2182
1992
|
width: i,
|
|
2183
|
-
height:
|
|
2184
|
-
loading:
|
|
2185
|
-
position:
|
|
1993
|
+
height: o,
|
|
1994
|
+
loading: a = "lazy",
|
|
1995
|
+
position: n = "cover",
|
|
2186
1996
|
size: l = "auto",
|
|
2187
1997
|
shape: c,
|
|
2188
|
-
className:
|
|
2189
|
-
...
|
|
2190
|
-
},
|
|
2191
|
-
const { loaded:
|
|
1998
|
+
className: g,
|
|
1999
|
+
...d
|
|
2000
|
+
}, u) => {
|
|
2001
|
+
const { loaded: f, errored: b, handleLoad: x, handleError: m } = useImage({
|
|
2192
2002
|
src: e
|
|
2193
|
-
}),
|
|
2194
|
-
return !
|
|
2003
|
+
}), h = typeof i == "number" ? i : Number(i), v = typeof o == "number" ? o : Number(o);
|
|
2004
|
+
return !f && !b ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2195
2005
|
BaseImageSkeleton,
|
|
2196
2006
|
{
|
|
2197
2007
|
shape: c,
|
|
2198
|
-
width:
|
|
2199
|
-
height:
|
|
2008
|
+
width: h,
|
|
2009
|
+
height: v
|
|
2200
2010
|
}
|
|
2201
|
-
) :
|
|
2011
|
+
) : b ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2202
2012
|
BaseImageFallback,
|
|
2203
2013
|
{
|
|
2204
2014
|
shape: c,
|
|
2205
2015
|
alt: t,
|
|
2206
|
-
width:
|
|
2207
|
-
height:
|
|
2016
|
+
width: h,
|
|
2017
|
+
height: v
|
|
2208
2018
|
}
|
|
2209
2019
|
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2210
2020
|
"img",
|
|
2211
2021
|
{
|
|
2212
|
-
ref:
|
|
2022
|
+
ref: u,
|
|
2213
2023
|
src: e,
|
|
2214
2024
|
alt: t,
|
|
2215
|
-
width:
|
|
2216
|
-
height:
|
|
2217
|
-
loading:
|
|
2025
|
+
width: h,
|
|
2026
|
+
height: v,
|
|
2027
|
+
loading: a,
|
|
2218
2028
|
className: cn(
|
|
2219
2029
|
imageVariants({
|
|
2220
|
-
position:
|
|
2030
|
+
position: n,
|
|
2221
2031
|
size: l,
|
|
2222
2032
|
shape: c
|
|
2223
2033
|
}),
|
|
2224
|
-
|
|
2034
|
+
g
|
|
2225
2035
|
),
|
|
2226
|
-
onLoad: (
|
|
2227
|
-
|
|
2036
|
+
onLoad: (w) => {
|
|
2037
|
+
x(), r?.(w);
|
|
2228
2038
|
},
|
|
2229
|
-
onError: (
|
|
2230
|
-
|
|
2039
|
+
onError: (w) => {
|
|
2040
|
+
m(), s?.(w);
|
|
2231
2041
|
},
|
|
2232
|
-
...
|
|
2042
|
+
...d
|
|
2233
2043
|
}
|
|
2234
2044
|
);
|
|
2235
2045
|
}
|
|
@@ -2238,9 +2048,9 @@ export {
|
|
|
2238
2048
|
Alert as A,
|
|
2239
2049
|
Badge as B,
|
|
2240
2050
|
Calculator as C,
|
|
2241
|
-
DescriptionList as D,
|
|
2242
2051
|
FilterChip as F,
|
|
2243
2052
|
Icon as I,
|
|
2053
|
+
Menu as M,
|
|
2244
2054
|
NoResults as N,
|
|
2245
2055
|
Table as T,
|
|
2246
2056
|
Anchor as a,
|
|
@@ -2249,14 +2059,15 @@ export {
|
|
|
2249
2059
|
Avatar as d,
|
|
2250
2060
|
Brand as e,
|
|
2251
2061
|
Button as f,
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2062
|
+
ButtonMenuIcon as g,
|
|
2063
|
+
ButtonFloat as h,
|
|
2064
|
+
ButtonIcon as i,
|
|
2255
2065
|
Card as j,
|
|
2256
2066
|
Text as k,
|
|
2257
2067
|
Tile as l,
|
|
2258
2068
|
ImageCircle as m,
|
|
2259
2069
|
ImageSquare as n,
|
|
2260
2070
|
ImageRectangle as o,
|
|
2261
|
-
BaseImage as p
|
|
2071
|
+
BaseImage as p,
|
|
2072
|
+
useEscapeClose as u
|
|
2262
2073
|
};
|