@nexub/react 1.5.1 → 1.7.0
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/chunk-24ZFAXB2.js +101 -0
- package/dist/{chunk-XR4NBY54.js → chunk-2DYKENBM.js} +10 -10
- package/dist/{chunk-SVQCINRE.js → chunk-2I7FIU6R.js} +5 -2
- package/dist/{chunk-S46W2QER.js → chunk-37L5ERUJ.js} +17 -11
- package/dist/{chunk-CWS37T3K.js → chunk-3E7X3YK3.js} +4 -2
- package/dist/{chunk-EZ23IA3H.js → chunk-3LTB6TGN.js} +4 -4
- package/dist/chunk-3QD76BKT.js +80 -0
- package/dist/{chunk-PQ6GU7SG.js → chunk-4HQFOIZW.js} +20 -14
- package/dist/{chunk-RLE5RN3T.js → chunk-4NFUBFYK.js} +15 -11
- package/dist/{chunk-B54WADL4.js → chunk-4P2JJ2FH.js} +12 -12
- package/dist/{chunk-I4BHRVRL.js → chunk-4UBVU53C.js} +9 -5
- package/dist/chunk-52ZVJPF7.js +1 -0
- package/dist/chunk-5QEARXY3.js +55 -0
- package/dist/chunk-643EYCLL.js +54 -0
- package/dist/{chunk-CNNJFWFA.js → chunk-6BGUZQAX.js} +4 -4
- package/dist/{chunk-LDYD7WL3.js → chunk-6ECOCGZG.js} +4 -3
- package/dist/{chunk-3AXIMXDU.js → chunk-6JBQAJJD.js} +6 -12
- package/dist/{chunk-YRDCY6BI.js → chunk-6UKNUI46.js} +0 -19
- package/dist/chunk-77LYWSJW.js +85 -0
- package/dist/{chunk-NCRFKPA4.js → chunk-7MSIOYJZ.js} +6 -8
- package/dist/{chunk-GIGOTRXX.js → chunk-7VJABRKB.js} +3 -10
- package/dist/{chunk-6QLLH6ID.js → chunk-7XWJCFWI.js} +8 -17
- package/dist/chunk-A3O23F2B.js +1 -0
- package/dist/chunk-AGYGWU6C.js +88 -0
- package/dist/chunk-AT2DSFP3.js +47 -0
- package/dist/{chunk-IIPYF6ZQ.js → chunk-B254JXS7.js} +16 -13
- package/dist/{chunk-GRB6T2TT.js → chunk-BSL62LBX.js} +19 -13
- package/dist/{chunk-GHCV6UXG.js → chunk-BTYDDKRQ.js} +5 -5
- package/dist/chunk-C6JRJ6JW.js +167 -0
- package/dist/chunk-CAOLGXA5.js +1 -0
- package/dist/{chunk-OJ2TLWYD.js → chunk-CKFRMCZ7.js} +5 -3
- package/dist/{chunk-LZB3KTSH.js → chunk-CQWYZPPJ.js} +1 -1
- package/dist/{chunk-6RBNM5RO.js → chunk-CUOASXI7.js} +10 -10
- package/dist/{chunk-HG6HTUWU.js → chunk-CV5ZKED7.js} +2 -2
- package/dist/{chunk-HJERFB7J.js → chunk-DDRYT3SY.js} +2 -2
- package/dist/chunk-DGCAM2UJ.js +60 -0
- package/dist/{chunk-FD7YU53N.js → chunk-DT3QGFXB.js} +4 -4
- package/dist/chunk-F73DTG2V.js +123 -0
- package/dist/{chunk-Z3IG5WRA.js → chunk-FJUVYRNT.js} +3 -3
- package/dist/{chunk-KQPLFVFR.js → chunk-FLZD7HQY.js} +0 -2
- package/dist/chunk-GG54WBLA.js +134 -0
- package/dist/{chunk-64JDZWCV.js → chunk-GRKCUQG4.js} +6 -5
- package/dist/{chunk-YPHNHQYQ.js → chunk-GWDEKW7P.js} +6 -2
- package/dist/{chunk-4I5ULCYG.js → chunk-HFTS5AN7.js} +3 -3
- package/dist/{chunk-GUB7YKG2.js → chunk-I4U36P54.js} +6 -3
- package/dist/{chunk-BTRTORKU.js → chunk-I6CAF7C5.js} +6 -7
- package/dist/{chunk-TJCHA3OI.js → chunk-J65MK3N4.js} +7 -4
- package/dist/{chunk-IK23Q2OF.js → chunk-JHVYI5GK.js} +3 -3
- package/dist/{chunk-J6TU45KP.js → chunk-JSBNYRO4.js} +26 -12
- package/dist/chunk-K5FKEAAK.js +94 -0
- package/dist/{chunk-5URGARPH.js → chunk-KE4YVG5Q.js} +6 -10
- package/dist/{chunk-QCNLE27O.js → chunk-KRCLK5O4.js} +11 -7
- package/dist/{chunk-A4IMFAZX.js → chunk-LESI7J7B.js} +3 -3
- package/dist/chunk-MLT7SA3T.js +171 -0
- package/dist/chunk-MNEXMMLM.js +23 -0
- package/dist/{chunk-PVTACENM.js → chunk-MTK3GHDQ.js} +2 -2
- package/dist/chunk-MYP5ZTC3.js +169 -0
- package/dist/chunk-NA5UMOE5.js +55 -0
- package/dist/chunk-NAJKIBU2.js +163 -0
- package/dist/{chunk-WESZPFBZ.js → chunk-NERAWEIQ.js} +7 -4
- package/dist/{chunk-YJ3JQYAN.js → chunk-NGQKBDHA.js} +5 -13
- package/dist/{chunk-7Q7ZF6BY.js → chunk-NNIFOMIH.js} +18 -8
- package/dist/{chunk-7L3CGIRA.js → chunk-NQPGELMP.js} +8 -19
- package/dist/{chunk-5O34ZNC3.js → chunk-NYWD5SI4.js} +19 -13
- package/dist/chunk-NZR4UGUZ.js +143 -0
- package/dist/{chunk-6J3QTWKC.js → chunk-NZT4TTNV.js} +18 -9
- package/dist/{chunk-JSD3H7WV.js → chunk-OYCK6BRG.js} +6 -6
- package/dist/{chunk-2555JXCP.js → chunk-PBPUSRTJ.js} +19 -11
- package/dist/{chunk-QD7H3WV3.js → chunk-PGDXFBKT.js} +8 -8
- package/dist/{chunk-NIX4SEKM.js → chunk-PREMZMLU.js} +7 -4
- package/dist/{chunk-4SSUM4CL.js → chunk-QUNH4BFR.js} +9 -6
- package/dist/{chunk-FHFVBOF3.js → chunk-QUYOV2ZJ.js} +6 -4
- package/dist/{chunk-KM6Z3VTI.js → chunk-QVTVDL6Y.js} +1 -1
- package/dist/{chunk-XI63BK3S.js → chunk-RATKKN3F.js} +3 -3
- package/dist/chunk-RM7MTOT5.js +339 -0
- package/dist/{chunk-DJZZ3FIP.js → chunk-RUR57JZQ.js} +5 -14
- package/dist/{chunk-ZV3AF5CL.js → chunk-S2CTBFLN.js} +13 -2
- package/dist/{chunk-72I7EVOL.js → chunk-SYZADSLI.js} +10 -6
- package/dist/{chunk-W2NEXOTG.js → chunk-T7RLPFGX.js} +2 -2
- package/dist/chunk-TAVVXXGO.js +131 -0
- package/dist/{chunk-BFRX6X4O.js → chunk-TZ6KJIR4.js} +23 -17
- package/dist/{chunk-V3TETH4J.js → chunk-U2ZYPPRG.js} +17 -16
- package/dist/{chunk-AHT35UWY.js → chunk-UTLKZPKJ.js} +10 -6
- package/dist/{chunk-OJRSPDNJ.js → chunk-VD4RFTNV.js} +8 -14
- package/dist/chunk-VLQGQFW7.js +110 -0
- package/dist/{chunk-RTDUTWJ4.js → chunk-VMT7Y3AT.js} +5 -8
- package/dist/{chunk-AXOKFS4K.js → chunk-W3KO3JNZ.js} +20 -4
- package/dist/{chunk-LGQ737BP.js → chunk-WHTLXQB6.js} +1 -1
- package/dist/chunk-WLRRMT6W.js +1 -0
- package/dist/{chunk-2FCSWBSM.js → chunk-WMWX6DPB.js} +3 -3
- package/dist/{chunk-UMC64NCT.js → chunk-WVBGQCYC.js} +6 -3
- package/dist/{chunk-TEOLG3N2.js → chunk-X4BQHXLB.js} +10 -6
- package/dist/{chunk-SY6V3HAK.js → chunk-XDU27NRX.js} +3 -3
- package/dist/{chunk-KA2J5OBA.js → chunk-XQDD76EF.js} +4 -7
- package/dist/chunk-XTATJMY6.js +64 -0
- package/dist/chunk-XYXMPHND.js +1 -0
- package/dist/{chunk-7ZWBHHRK.js → chunk-YNU6VRD5.js} +23 -32
- package/dist/{chunk-6SJPVQQW.js → chunk-Z3HF6XJ3.js} +1 -1
- package/dist/{chunk-I4URNMI7.js → chunk-ZC4MZAEX.js} +9 -7
- package/dist/{chunk-PWBPHGM3.js → chunk-ZCEUVK2R.js} +2 -2
- package/dist/{chunk-NQVRF4RB.js → chunk-ZMJ54TG6.js} +16 -13
- package/dist/chunk-ZT3NWE5U.js +1 -0
- package/dist/{chunk-RHOYF7MO.js → chunk-ZTLALVWA.js} +6 -15
- package/dist/components/Accordion/index.js +1 -1
- package/dist/components/Alert/index.js +2 -1
- package/dist/components/AlertDialog/index.js +3 -3
- package/dist/components/Amount/index.js +3 -1
- package/dist/components/AspectRatio/index.js +1 -1
- package/dist/components/Autocomplete/index.js +3 -2
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/AvatarGroup/index.js +3 -2
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Banner/index.js +2 -1
- package/dist/components/Breadcrumb/index.js +2 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/ButtonGroup/index.js +1 -1
- package/dist/components/Callout/index.js +1 -1
- package/dist/components/Card/index.js +3 -1
- package/dist/components/CheckList/index.js +1 -1
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/CheckboxCard/index.js +9 -0
- package/dist/components/Chip/index.js +2 -1
- package/dist/components/Citation/index.js +17 -0
- package/dist/components/Code/index.js +1 -1
- package/dist/components/Combobox/index.js +1 -1
- package/dist/components/CommandPalette/index.js +3 -2
- package/dist/components/ContextMenu/index.js +2 -2
- package/dist/components/CountryBadge/index.js +1 -1
- package/dist/components/DataTable/index.js +2 -1
- package/dist/components/DatePicker/index.js +5 -1
- package/dist/components/DateRangePicker/index.js +5 -1
- package/dist/components/Dialog/index.js +2 -2
- package/dist/components/Drawer/index.js +2 -2
- package/dist/components/DropdownMenu/index.js +2 -2
- package/dist/components/EmptyState/index.js +1 -1
- package/dist/components/ErrorState/index.js +2 -1
- package/dist/components/EyebrowChip/index.js +4 -1
- package/dist/components/FileUpload/index.js +2 -1
- package/dist/components/FilterChip/index.js +3 -1
- package/dist/components/Flex/index.js +2 -1
- package/dist/components/FormError/index.js +1 -1
- package/dist/components/FormField/index.js +7 -4
- package/dist/components/GradientDivider/index.js +1 -1
- package/dist/components/Grid/index.js +2 -1
- package/dist/components/Heading/index.js +4 -1
- package/dist/components/HelperText/index.js +4 -1
- package/dist/components/HoverCard/index.js +3 -2
- package/dist/components/IconButton/index.js +2 -1
- package/dist/components/Input/index.js +1 -1
- package/dist/components/Kbd/index.js +1 -1
- package/dist/components/KeyboardShortcut/index.js +2 -2
- package/dist/components/Label/index.js +4 -1
- package/dist/components/Link/index.js +1 -1
- package/dist/components/Logo/index.js +1 -1
- package/dist/components/MediaCard/index.js +9 -0
- package/dist/components/Menubar/index.js +2 -2
- package/dist/components/MessageBubble/index.js +18 -0
- package/dist/components/MoneyInput/index.js +3 -2
- package/dist/components/NavigationMenu/index.js +2 -2
- package/dist/components/NavigationRail/index.js +2 -1
- package/dist/components/NexubProvider/index.js +14 -0
- package/dist/components/NumberInput/index.js +3 -2
- package/dist/components/NumberTicker/index.js +10 -0
- package/dist/components/PageHeader/index.js +1 -1
- package/dist/components/Pagination/index.js +3 -1
- package/dist/components/PasswordInput/index.js +3 -2
- package/dist/components/Popover/index.js +2 -2
- package/dist/components/Progress/index.js +2 -1
- package/dist/components/PromptInput/index.js +15 -0
- package/dist/components/RadioCard/index.js +11 -0
- package/dist/components/RadioGroup/index.js +1 -1
- package/dist/components/Rating/index.js +2 -1
- package/dist/components/ScrollArea/index.js +1 -1
- package/dist/components/SearchInput/index.js +3 -2
- package/dist/components/Section/index.js +1 -1
- package/dist/components/SegmentedControl/index.js +3 -2
- package/dist/components/Select/index.js +2 -2
- package/dist/components/Separator/index.js +1 -1
- package/dist/components/Sidebar/index.js +2 -1
- package/dist/components/Skeleton/index.js +1 -1
- package/dist/components/Spinner/index.js +2 -1
- package/dist/components/SplitButton/index.js +5 -5
- package/dist/components/Stack/index.js +2 -1
- package/dist/components/StatusPill/index.js +1 -1
- package/dist/components/StreamingText/index.js +8 -0
- package/dist/components/Switch/index.js +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Tabs/index.js +3 -2
- package/dist/components/Tag/index.js +1 -1
- package/dist/components/Text/index.js +1 -1
- package/dist/components/Textarea/index.js +1 -1
- package/dist/components/ThinkingIndicator/index.js +9 -0
- package/dist/components/Toast/index.js +3 -1
- package/dist/components/Tooltip/index.js +2 -1
- package/dist/components/TopNav/index.js +2 -1
- package/dist/index.d.ts +440 -24
- package/dist/index.js +225 -146
- package/package.json +52 -50
- package/dist/chunk-63DPMUMR.js +0 -67
- package/dist/chunk-CHGPGRML.js +0 -115
- package/dist/chunk-H2W7IYVY.js +0 -155
- package/dist/chunk-J2T4GFFS.js +0 -85
- package/dist/chunk-LH3BSAIS.js +0 -119
- package/dist/chunk-LMPGHWUA.js +0 -114
- package/dist/chunk-NMH5WSZG.js +0 -72
- package/dist/chunk-P44EROBX.js +0 -55
- package/dist/chunk-TYTW4F3B.js +0 -178
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import {
|
|
3
|
+
useNexubMessages
|
|
4
|
+
} from "./chunk-24ZFAXB2.js";
|
|
2
5
|
import {
|
|
3
6
|
cn
|
|
4
7
|
} from "./chunk-Q7G5WGYV.js";
|
|
@@ -8,7 +11,7 @@ import * as React from "react";
|
|
|
8
11
|
import { ChevronRight, MoreHorizontal } from "@nexub/icons";
|
|
9
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
13
|
var Root = React.forwardRef(
|
|
11
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsx("nav", { ref, "aria-label":
|
|
14
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("nav", { ref, "aria-label": useNexubMessages().breadcrumb, className: cn("", className), ...props })
|
|
12
15
|
);
|
|
13
16
|
Root.displayName = "Breadcrumb.Root";
|
|
14
17
|
var List = React.forwardRef(
|
|
@@ -17,7 +20,7 @@ var List = React.forwardRef(
|
|
|
17
20
|
{
|
|
18
21
|
ref,
|
|
19
22
|
className: cn(
|
|
20
|
-
"flex flex-wrap items-center gap-1.5 text-sm text-[var(--color-
|
|
23
|
+
"flex flex-wrap items-center gap-1.5 text-sm text-[var(--color-on-surface-muted)] sm:gap-2.5",
|
|
21
24
|
className
|
|
22
25
|
),
|
|
23
26
|
...props
|
|
@@ -33,7 +36,7 @@ var Link = React.forwardRef(({ className, children, ...props }, ref) => /* @__PU
|
|
|
33
36
|
"a",
|
|
34
37
|
{
|
|
35
38
|
ref,
|
|
36
|
-
className: cn("transition-colors hover:text-[var(--color-
|
|
39
|
+
className: cn("transition-colors hover:text-[var(--color-on-surface)]", className),
|
|
37
40
|
...props,
|
|
38
41
|
children
|
|
39
42
|
}
|
|
@@ -47,7 +50,7 @@ var Page = React.forwardRef(
|
|
|
47
50
|
role: "link",
|
|
48
51
|
"aria-current": "page",
|
|
49
52
|
"aria-disabled": "true",
|
|
50
|
-
className: cn("font-normal text-[var(--color-
|
|
53
|
+
className: cn("font-normal text-[var(--color-on-surface)]", className),
|
|
51
54
|
...props
|
|
52
55
|
}
|
|
53
56
|
)
|
|
@@ -62,7 +65,7 @@ var Separator = ({
|
|
|
62
65
|
role: "presentation",
|
|
63
66
|
"aria-hidden": "true",
|
|
64
67
|
className: cn("[&>svg]:h-3.5 [&>svg]:w-3.5", className),
|
|
65
|
-
children: children ?? /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true" })
|
|
68
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true", className: "rtl:-scale-x-100" })
|
|
66
69
|
}
|
|
67
70
|
);
|
|
68
71
|
Separator.displayName = "Breadcrumb.Separator";
|
|
@@ -75,7 +78,7 @@ var Ellipsis = ({ className, ...props }) => /* @__PURE__ */ jsxs(
|
|
|
75
78
|
...props,
|
|
76
79
|
children: [
|
|
77
80
|
/* @__PURE__ */ jsx(MoreHorizontal, { size: "sm", "aria-hidden": "true" }),
|
|
78
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children:
|
|
81
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: useNexubMessages().breadcrumbMore })
|
|
79
82
|
]
|
|
80
83
|
}
|
|
81
84
|
);
|
|
@@ -8,7 +8,7 @@ import * as React from "react";
|
|
|
8
8
|
import { cva } from "class-variance-authority";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
var avatarVariants = cva(
|
|
11
|
-
"relative inline-flex items-center justify-center shrink-0 rounded-full overflow-hidden bg-[var(--color-
|
|
11
|
+
"relative inline-flex items-center justify-center shrink-0 rounded-full overflow-hidden bg-[var(--color-surface-container-high)] text-[var(--color-on-surface-muted)] font-medium select-none",
|
|
12
12
|
{
|
|
13
13
|
variants: {
|
|
14
14
|
size: {
|
|
@@ -52,13 +52,15 @@ var Avatar = React.forwardRef(
|
|
|
52
52
|
const [imgError, setImgError] = React.useState(false);
|
|
53
53
|
const showImage = Boolean(src) && !imgError;
|
|
54
54
|
const initials = name ? getInitials(name) : null;
|
|
55
|
+
const labelled = Boolean(name || props["aria-label"] || props["aria-labelledby"]);
|
|
55
56
|
return /* @__PURE__ */ jsxs(
|
|
56
57
|
"span",
|
|
57
58
|
{
|
|
58
59
|
ref,
|
|
59
60
|
className: cn(avatarVariants({ size }), className),
|
|
60
61
|
"aria-label": name ?? void 0,
|
|
61
|
-
role: "img",
|
|
62
|
+
role: labelled ? "img" : void 0,
|
|
63
|
+
"aria-hidden": labelled ? void 0 : true,
|
|
62
64
|
...props,
|
|
63
65
|
children: [
|
|
64
66
|
showImage ? /* @__PURE__ */ jsx(
|
|
@@ -86,9 +88,9 @@ var Avatar = React.forwardRef(
|
|
|
86
88
|
"span",
|
|
87
89
|
{
|
|
88
90
|
className: cn(
|
|
89
|
-
"absolute bottom-0
|
|
91
|
+
"absolute bottom-0 end-0 rounded-full ring-2 ring-[var(--color-surface)]",
|
|
90
92
|
badgeSizeMap[size ?? "md"],
|
|
91
|
-
badgeColor ?? "bg-[var(--color-
|
|
93
|
+
badgeColor ?? "bg-[var(--color-success)]"
|
|
92
94
|
),
|
|
93
95
|
"aria-hidden": "true"
|
|
94
96
|
}
|
|
@@ -15,7 +15,7 @@ var FormError = React.forwardRef(
|
|
|
15
15
|
ref,
|
|
16
16
|
role: "alert",
|
|
17
17
|
className: cn(
|
|
18
|
-
"flex items-center gap-1.5 text-sm text-[var(--color-
|
|
18
|
+
"flex items-center gap-1.5 text-sm text-[var(--color-on-error-container)] leading-snug",
|
|
19
19
|
className
|
|
20
20
|
),
|
|
21
21
|
...props,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
Label
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PREMZMLU.js";
|
|
5
5
|
import {
|
|
6
6
|
FormError
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QVTVDL6Y.js";
|
|
8
8
|
import {
|
|
9
9
|
HelperText
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WVBGQCYC.js";
|
|
11
11
|
import {
|
|
12
12
|
cn
|
|
13
13
|
} from "./chunk-Q7G5WGYV.js";
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
useIsomorphicLayoutEffect
|
|
4
|
+
} from "./chunk-NHUQLIHL.js";
|
|
5
|
+
import {
|
|
6
|
+
useLocale,
|
|
7
|
+
useNexubMessages
|
|
8
|
+
} from "./chunk-24ZFAXB2.js";
|
|
9
|
+
import {
|
|
10
|
+
cn
|
|
11
|
+
} from "./chunk-Q7G5WGYV.js";
|
|
12
|
+
|
|
13
|
+
// src/components/Toast/Toast.tsx
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import * as RadixToast from "@radix-ui/react-toast";
|
|
16
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
|
+
function Provider2({ swipeDirection, ...props }) {
|
|
18
|
+
const { dir } = useLocale();
|
|
19
|
+
return /* @__PURE__ */ jsx(RadixToast.Provider, { swipeDirection: swipeDirection ?? (dir === "rtl" ? "left" : "right"), ...props });
|
|
20
|
+
}
|
|
21
|
+
Provider2.displayName = "Toast.Provider";
|
|
22
|
+
var Viewport2 = React.forwardRef(
|
|
23
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
24
|
+
RadixToast.Viewport,
|
|
25
|
+
{
|
|
26
|
+
ref,
|
|
27
|
+
className: cn(
|
|
28
|
+
"fixed top-0 end-0 z-[var(--z-toast,2000)] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-sm gap-2",
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
...props
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
Viewport2.displayName = "Toast.Viewport";
|
|
36
|
+
var Root2 = React.forwardRef(
|
|
37
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
38
|
+
RadixToast.Root,
|
|
39
|
+
{
|
|
40
|
+
ref,
|
|
41
|
+
className: cn(
|
|
42
|
+
// Snackbar: the inverse surface stands out from any page, light or dark.
|
|
43
|
+
"group pointer-events-auto relative flex w-full items-center justify-between gap-3 overflow-hidden rounded-shape-container bg-[var(--color-inverse-surface)] py-3 ps-4 pe-2 text-[var(--color-inverse-on-surface)] shadow-elevation-2",
|
|
44
|
+
"duration-spatial-default ease-spatial-default data-[state=closed]:duration-effects-fast",
|
|
45
|
+
// Follow the finger (Radix's signed swipe offsets), snap back on cancel, leave from where it was let go.
|
|
46
|
+
"data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none",
|
|
47
|
+
// Enter/exit slide from the right edge, where the viewport sits.
|
|
48
|
+
"nx-motion [--nx-x:calc(100%+1rem)] rtl:[--nx-x:calc(-100%-1rem)]",
|
|
49
|
+
className
|
|
50
|
+
),
|
|
51
|
+
...props
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
Root2.displayName = "Toast.Root";
|
|
56
|
+
var Title2 = React.forwardRef(
|
|
57
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(RadixToast.Title, { ref, className: cn("text-title-sm", className), ...props })
|
|
58
|
+
);
|
|
59
|
+
Title2.displayName = "Toast.Title";
|
|
60
|
+
var Description2 = React.forwardRef(
|
|
61
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
62
|
+
RadixToast.Description,
|
|
63
|
+
{
|
|
64
|
+
ref,
|
|
65
|
+
className: cn("text-body-sm text-[color-mix(in_srgb,var(--color-inverse-on-surface)_80%,transparent)]", className),
|
|
66
|
+
...props
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
);
|
|
70
|
+
Description2.displayName = "Toast.Description";
|
|
71
|
+
var Action2 = React.forwardRef(
|
|
72
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
73
|
+
RadixToast.Action,
|
|
74
|
+
{
|
|
75
|
+
ref,
|
|
76
|
+
className: cn(
|
|
77
|
+
"nx-state-layer relative inline-flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center rounded-shape-control px-3 text-label-lg text-[var(--color-inverse-primary)]",
|
|
78
|
+
className
|
|
79
|
+
),
|
|
80
|
+
...props
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
Action2.displayName = "Toast.Action";
|
|
85
|
+
var Close2 = React.forwardRef(
|
|
86
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(RadixToast.Close, { ref, className: cn("nx-state-layer relative grid h-8 w-8 place-items-center rounded-full", className), ...props })
|
|
87
|
+
);
|
|
88
|
+
Close2.displayName = "Toast.Close";
|
|
89
|
+
var Toast = { Provider: Provider2, Viewport: Viewport2, Root: Root2, Title: Title2, Description: Description2, Action: Action2, Close: Close2 };
|
|
90
|
+
|
|
91
|
+
// src/components/Toast/Toaster.tsx
|
|
92
|
+
import * as React2 from "react";
|
|
93
|
+
import * as RadixToast2 from "@radix-ui/react-toast";
|
|
94
|
+
import { X } from "@nexub/icons";
|
|
95
|
+
|
|
96
|
+
// src/components/Toast/useToast.ts
|
|
97
|
+
import { useState, useEffect } from "react";
|
|
98
|
+
var g = typeof window !== "undefined" ? (() => {
|
|
99
|
+
const _g = globalThis;
|
|
100
|
+
_g.__nexub_toast_items ??= [];
|
|
101
|
+
_g.__nexub_toast_listeners ??= /* @__PURE__ */ new Set();
|
|
102
|
+
_g.__nexub_toast_counter ??= 0;
|
|
103
|
+
return _g;
|
|
104
|
+
})() : { __nexub_toast_items: [], __nexub_toast_listeners: /* @__PURE__ */ new Set(), __nexub_toast_counter: 0 };
|
|
105
|
+
function notify() {
|
|
106
|
+
g.__nexub_toast_listeners.forEach((l) => l([...g.__nexub_toast_items]));
|
|
107
|
+
}
|
|
108
|
+
function add(item) {
|
|
109
|
+
const id = String(++g.__nexub_toast_counter);
|
|
110
|
+
g.__nexub_toast_items = [...g.__nexub_toast_items, { ...item, id }];
|
|
111
|
+
notify();
|
|
112
|
+
return id;
|
|
113
|
+
}
|
|
114
|
+
function useToastStore() {
|
|
115
|
+
const [state, setState] = useState([...g.__nexub_toast_items]);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
g.__nexub_toast_listeners.add(setState);
|
|
118
|
+
return () => {
|
|
119
|
+
g.__nexub_toast_listeners.delete(setState);
|
|
120
|
+
};
|
|
121
|
+
}, []);
|
|
122
|
+
return state;
|
|
123
|
+
}
|
|
124
|
+
var closeFired = /* @__PURE__ */ new Set();
|
|
125
|
+
function fireToastClose(item) {
|
|
126
|
+
if (closeFired.has(item.id)) return;
|
|
127
|
+
closeFired.add(item.id);
|
|
128
|
+
item.onClose?.();
|
|
129
|
+
}
|
|
130
|
+
function dismiss(id) {
|
|
131
|
+
const removed = id ? g.__nexub_toast_items.filter((i) => i.id === id) : g.__nexub_toast_items;
|
|
132
|
+
g.__nexub_toast_items = id ? g.__nexub_toast_items.filter((i) => i.id !== id) : [];
|
|
133
|
+
notify();
|
|
134
|
+
for (const item of removed) {
|
|
135
|
+
fireToastClose(item);
|
|
136
|
+
closeFired.delete(item.id);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function undoable(title, { onUndo, onCommit, undoLabel, description, duration }) {
|
|
140
|
+
let undone = false;
|
|
141
|
+
return add({
|
|
142
|
+
title,
|
|
143
|
+
tone: "neutral",
|
|
144
|
+
description,
|
|
145
|
+
duration,
|
|
146
|
+
undo: { label: undoLabel, onUndo: () => {
|
|
147
|
+
undone = true;
|
|
148
|
+
onUndo();
|
|
149
|
+
} },
|
|
150
|
+
onClose: () => {
|
|
151
|
+
if (!undone) onCommit?.();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
var toast = {
|
|
156
|
+
success: (title, opts) => add({ title, tone: "success", ...opts }),
|
|
157
|
+
error: (title, opts) => add({ title, tone: "error", ...opts }),
|
|
158
|
+
info: (title, opts) => add({ title, tone: "info", ...opts }),
|
|
159
|
+
warning: (title, opts) => add({ title, tone: "warning", ...opts }),
|
|
160
|
+
custom: (title, opts) => add({ title, tone: "neutral", ...opts }),
|
|
161
|
+
/** A toast with an Undo action: Undo calls `onUndo`; any other close calls `onCommit`, once. */
|
|
162
|
+
undoable,
|
|
163
|
+
dismiss
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// src/components/Toast/Toaster.tsx
|
|
167
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
168
|
+
var toneMap = {
|
|
169
|
+
success: "border-s-4 border-[var(--color-success)]",
|
|
170
|
+
error: "border-s-4 border-[var(--color-error)]",
|
|
171
|
+
warning: "border-s-4 border-[var(--color-warning)]",
|
|
172
|
+
info: "border-s-4 border-[var(--color-info)]",
|
|
173
|
+
neutral: ""
|
|
174
|
+
};
|
|
175
|
+
var GAP = 8;
|
|
176
|
+
function Toaster({ expand = false, visibleToasts = 3 }) {
|
|
177
|
+
const toasts = useToastStore();
|
|
178
|
+
const messages = useNexubMessages();
|
|
179
|
+
const { dir } = useLocale();
|
|
180
|
+
const [closed, setClosed] = React2.useState(() => /* @__PURE__ */ new Set());
|
|
181
|
+
const [hovered, setHovered] = React2.useState(false);
|
|
182
|
+
const [focused, setFocused] = React2.useState(false);
|
|
183
|
+
const order = toasts.filter((t) => !closed.has(t.id)).map((t) => t.id).reverse();
|
|
184
|
+
const expanded = expand || order.length > 0 && (hovered || focused);
|
|
185
|
+
const viewportRef = React2.useRef(null);
|
|
186
|
+
const heights = React2.useRef(/* @__PURE__ */ new Map());
|
|
187
|
+
const state = React2.useRef({ order, expanded, visibleToasts });
|
|
188
|
+
state.current = { order, expanded, visibleToasts };
|
|
189
|
+
const layout = React2.useCallback(() => {
|
|
190
|
+
const ol = viewportRef.current;
|
|
191
|
+
if (!ol) return;
|
|
192
|
+
const { order: order2, expanded: expanded2, visibleToasts: visibleToasts2 } = state.current;
|
|
193
|
+
let offset = 0;
|
|
194
|
+
let front = 0;
|
|
195
|
+
let stack = 0;
|
|
196
|
+
order2.forEach((id, i) => {
|
|
197
|
+
const el = ol.querySelector(`[data-toast-id="${id}"]`);
|
|
198
|
+
if (!el) return;
|
|
199
|
+
if (i === 0 || expanded2 || !heights.current.has(id)) heights.current.set(id, el.offsetHeight);
|
|
200
|
+
const h = heights.current.get(id);
|
|
201
|
+
el.style.setProperty("--nx-toast-index", String(i));
|
|
202
|
+
el.style.setProperty("--nx-toast-offset", `${offset}px`);
|
|
203
|
+
if (i === 0) front = h;
|
|
204
|
+
if (i < visibleToasts2) stack = offset + h;
|
|
205
|
+
offset += h + GAP;
|
|
206
|
+
});
|
|
207
|
+
ol.style.setProperty("--nx-front-height", `${front}px`);
|
|
208
|
+
ol.style.setProperty("--nx-stack-height", `${expanded2 ? stack : front}px`);
|
|
209
|
+
}, []);
|
|
210
|
+
useIsomorphicLayoutEffect(layout);
|
|
211
|
+
useIsomorphicLayoutEffect(() => {
|
|
212
|
+
const ol = viewportRef.current;
|
|
213
|
+
if (!ol) return;
|
|
214
|
+
const ro = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(layout);
|
|
215
|
+
const observe = () => {
|
|
216
|
+
for (const li of Array.from(ol.children)) ro?.observe(li);
|
|
217
|
+
layout();
|
|
218
|
+
};
|
|
219
|
+
const mo = new MutationObserver(observe);
|
|
220
|
+
mo.observe(ol, { childList: true });
|
|
221
|
+
observe();
|
|
222
|
+
const region = ol.parentElement ?? ol;
|
|
223
|
+
const enter = () => setHovered(true);
|
|
224
|
+
const leave = () => setHovered(false);
|
|
225
|
+
const focusIn = () => setFocused(true);
|
|
226
|
+
const focusOut = (e) => {
|
|
227
|
+
if (!region.contains(e.relatedTarget)) setFocused(false);
|
|
228
|
+
};
|
|
229
|
+
region.addEventListener("pointermove", enter);
|
|
230
|
+
region.addEventListener("pointerleave", leave);
|
|
231
|
+
region.addEventListener("focusin", focusIn);
|
|
232
|
+
region.addEventListener("focusout", focusOut);
|
|
233
|
+
return () => {
|
|
234
|
+
mo.disconnect();
|
|
235
|
+
ro?.disconnect();
|
|
236
|
+
region.removeEventListener("pointermove", enter);
|
|
237
|
+
region.removeEventListener("pointerleave", leave);
|
|
238
|
+
region.removeEventListener("focusin", focusIn);
|
|
239
|
+
region.removeEventListener("focusout", focusOut);
|
|
240
|
+
};
|
|
241
|
+
}, [layout]);
|
|
242
|
+
React2.useEffect(() => {
|
|
243
|
+
if (order.length === 0) {
|
|
244
|
+
setHovered(false);
|
|
245
|
+
setFocused(false);
|
|
246
|
+
}
|
|
247
|
+
}, [order.length]);
|
|
248
|
+
return /* @__PURE__ */ jsxs(RadixToast2.Provider, { swipeDirection: dir === "rtl" ? "left" : "right", children: [
|
|
249
|
+
toasts.map((t) => {
|
|
250
|
+
const i = order.indexOf(t.id);
|
|
251
|
+
const action = t.action ?? (t.undo && { label: t.undo.label ?? messages.undo, onClick: t.undo.onUndo });
|
|
252
|
+
return /* @__PURE__ */ jsxs(
|
|
253
|
+
RadixToast2.Root,
|
|
254
|
+
{
|
|
255
|
+
"data-toast-id": t.id,
|
|
256
|
+
"data-front": i === -1 ? void 0 : i === 0,
|
|
257
|
+
"data-hidden": i === -1 ? void 0 : i >= visibleToasts,
|
|
258
|
+
onOpenChange: (open) => {
|
|
259
|
+
if (open) return;
|
|
260
|
+
fireToastClose(t);
|
|
261
|
+
setClosed((s) => new Set(s).add(t.id));
|
|
262
|
+
setTimeout(() => {
|
|
263
|
+
toast.dismiss(t.id);
|
|
264
|
+
setClosed((s) => {
|
|
265
|
+
const next = new Set(s);
|
|
266
|
+
next.delete(t.id);
|
|
267
|
+
return next;
|
|
268
|
+
});
|
|
269
|
+
}, 1e3);
|
|
270
|
+
},
|
|
271
|
+
className: cn(
|
|
272
|
+
"group pointer-events-auto absolute inset-x-4 top-4 flex items-center justify-between gap-3 overflow-hidden rounded-shape-container bg-[var(--color-inverse-surface)] py-3 ps-4 pe-2 text-[var(--color-inverse-on-surface)] shadow-elevation-2",
|
|
273
|
+
// Stack: older toasts sit behind, scaled from their bottom edge so it peeks out.
|
|
274
|
+
// Transition-only timing: duration-*/ease-* utilities would also retime nx-motion's enter/exit keyframes.
|
|
275
|
+
"origin-bottom transition-[transform,opacity] [transition-duration:var(--motion-spring-spatial-default-duration)] [transition-timing-function:var(--motion-spring-spatial-default-easing)]",
|
|
276
|
+
"translate-y-[calc(var(--nx-toast-index,0)*var(--nx-toast-step))] scale-[calc(1_-_var(--nx-toast-index,0)*var(--nx-toast-shrink))]",
|
|
277
|
+
"group-data-[expanded=true]/toaster:translate-y-[var(--nx-toast-offset,0px)] group-data-[expanded=true]/toaster:scale-100",
|
|
278
|
+
// Collapsing settles faster than expanding.
|
|
279
|
+
"group-data-[expanded=false]/toaster:[transition-duration:var(--motion-spring-effects-fast-duration)] group-data-[expanded=false]/toaster:[transition-timing-function:var(--motion-spring-effects-fast-easing)]",
|
|
280
|
+
"group-data-[expanded=false]/toaster:data-[front=false]:h-[var(--nx-front-height)]",
|
|
281
|
+
// Collapsed, older toasts show only their edge: hide their content until expanded.
|
|
282
|
+
"[&>*]:transition-opacity [&>*]:duration-effects-fast group-data-[expanded=false]/toaster:[&[data-front=false]>*]:opacity-0",
|
|
283
|
+
// Beyond visibleToasts: visually hidden, still in the DOM and its live region.
|
|
284
|
+
"data-[hidden=true]:pointer-events-none data-[hidden=true]:opacity-0",
|
|
285
|
+
// Reduced motion: no travel or scale (step/shrink are 0); collapsed shows only the front.
|
|
286
|
+
"motion-reduce:[transition-property:opacity] motion-reduce:group-data-[expanded=false]/toaster:data-[front=false]:pointer-events-none motion-reduce:group-data-[expanded=false]/toaster:data-[front=false]:opacity-0",
|
|
287
|
+
"data-[state=closed]:duration-effects-fast",
|
|
288
|
+
"data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none",
|
|
289
|
+
"nx-motion [--nx-x:calc(100%+1rem)] rtl:[--nx-x:calc(-100%-1rem)]",
|
|
290
|
+
toneMap[t.tone ?? "neutral"]
|
|
291
|
+
),
|
|
292
|
+
duration: t.duration ?? 5e3,
|
|
293
|
+
children: [
|
|
294
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-1", children: [
|
|
295
|
+
/* @__PURE__ */ jsx2(RadixToast2.Title, { className: "text-title-sm", children: t.title }),
|
|
296
|
+
t.description && /* @__PURE__ */ jsx2(RadixToast2.Description, { className: "text-body-sm text-[color-mix(in_srgb,var(--color-inverse-on-surface)_80%,transparent)]", children: t.description })
|
|
297
|
+
] }),
|
|
298
|
+
action && /* @__PURE__ */ jsx2(
|
|
299
|
+
RadixToast2.Action,
|
|
300
|
+
{
|
|
301
|
+
altText: action.label,
|
|
302
|
+
onClick: action.onClick,
|
|
303
|
+
className: "nx-state-layer relative inline-flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center rounded-shape-control px-3 text-label-lg text-[var(--color-inverse-primary)]",
|
|
304
|
+
children: action.label
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
/* @__PURE__ */ jsxs(RadixToast2.Close, { className: "nx-state-layer relative grid h-8 w-8 place-items-center rounded-full transition-opacity [@media(hover:hover)]:opacity-0 group-hover:opacity-100 focus-visible:opacity-100", children: [
|
|
308
|
+
/* @__PURE__ */ jsx2(X, { size: "sm", "aria-hidden": "true" }),
|
|
309
|
+
/* @__PURE__ */ jsx2("span", { className: "sr-only", children: messages.close })
|
|
310
|
+
] })
|
|
311
|
+
]
|
|
312
|
+
},
|
|
313
|
+
t.id
|
|
314
|
+
);
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ jsx2(
|
|
317
|
+
RadixToast2.Viewport,
|
|
318
|
+
{
|
|
319
|
+
ref: viewportRef,
|
|
320
|
+
label: messages.notifications,
|
|
321
|
+
"data-expanded": expanded,
|
|
322
|
+
className: cn(
|
|
323
|
+
"group/toaster fixed top-0 end-0 z-[var(--z-toast,2000)] max-h-screen w-full p-4 sm:max-w-sm",
|
|
324
|
+
// Collapsed: the front toast's height (older edges peek below); expanded: the whole list.
|
|
325
|
+
"h-[calc(var(--nx-stack-height,0px)+2rem)]",
|
|
326
|
+
"[--nx-toast-step:10px] [--nx-toast-shrink:0.05] motion-reduce:[--nx-toast-step:0px] motion-reduce:[--nx-toast-shrink:0]"
|
|
327
|
+
)
|
|
328
|
+
}
|
|
329
|
+
)
|
|
330
|
+
] });
|
|
331
|
+
}
|
|
332
|
+
Toaster.displayName = "Toaster";
|
|
333
|
+
|
|
334
|
+
export {
|
|
335
|
+
Toast,
|
|
336
|
+
useToastStore,
|
|
337
|
+
toast,
|
|
338
|
+
Toaster
|
|
339
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
|
-
enterExit,
|
|
4
3
|
overlaySurface,
|
|
5
4
|
scrim
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FLZD7HQY.js";
|
|
7
6
|
import {
|
|
8
7
|
glassSurfaceClass
|
|
9
8
|
} from "./chunk-DEIBF3P7.js";
|
|
@@ -26,11 +25,8 @@ var Overlay2 = React.forwardRef(
|
|
|
26
25
|
{
|
|
27
26
|
ref,
|
|
28
27
|
className: cn(
|
|
29
|
-
"fixed inset-0 z-[var(--z-modal)]",
|
|
28
|
+
"fixed inset-0 z-[var(--z-modal)] nx-motion",
|
|
30
29
|
scrim,
|
|
31
|
-
enterExit,
|
|
32
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
33
|
-
"data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0",
|
|
34
30
|
className
|
|
35
31
|
),
|
|
36
32
|
...props
|
|
@@ -54,14 +50,9 @@ var Content2 = React.forwardRef(
|
|
|
54
50
|
ref,
|
|
55
51
|
className: cn(
|
|
56
52
|
"fixed left-1/2 top-1/2 z-[var(--z-modal)] w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2",
|
|
53
|
+
"nx-motion nx-dialog",
|
|
57
54
|
overlaySurface,
|
|
58
|
-
enterExit,
|
|
59
55
|
"max-h-[90vh] overflow-y-auto p-6 focus:outline-none",
|
|
60
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
61
|
-
"data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
62
|
-
"data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
63
|
-
"data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
|
|
64
|
-
"data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]",
|
|
65
56
|
sizeMap[size],
|
|
66
57
|
surface === "glass" && glassSurfaceClass,
|
|
67
58
|
className
|
|
@@ -81,7 +72,7 @@ var Title2 = React.forwardRef(
|
|
|
81
72
|
RadixDialog.Title,
|
|
82
73
|
{
|
|
83
74
|
ref,
|
|
84
|
-
className: cn("text-lg font-semibold text-[var(--color-
|
|
75
|
+
className: cn("text-lg font-semibold text-[var(--color-on-surface)]", className),
|
|
85
76
|
...props
|
|
86
77
|
}
|
|
87
78
|
);
|
|
@@ -94,7 +85,7 @@ var Description2 = React.forwardRef(
|
|
|
94
85
|
RadixDialog.Description,
|
|
95
86
|
{
|
|
96
87
|
ref,
|
|
97
|
-
className: cn("mt-1 text-sm text-[var(--color-
|
|
88
|
+
className: cn("mt-1 text-sm text-[var(--color-on-surface-muted)]", className),
|
|
98
89
|
...props
|
|
99
90
|
}
|
|
100
91
|
);
|
|
@@ -6,14 +6,25 @@ import {
|
|
|
6
6
|
// src/components/AspectRatio/AspectRatio.tsx
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var RATIO_CLASS = {
|
|
10
|
+
"1.0000": "aspect-square",
|
|
11
|
+
"1.7778": "aspect-video",
|
|
12
|
+
"1.3333": "aspect-[4/3]",
|
|
13
|
+
"1.5000": "aspect-[3/2]",
|
|
14
|
+
"2.3333": "aspect-[21/9]",
|
|
15
|
+
"0.5625": "aspect-[9/16]",
|
|
16
|
+
"0.7500": "aspect-[3/4]",
|
|
17
|
+
"0.6667": "aspect-[2/3]"
|
|
18
|
+
};
|
|
9
19
|
var AspectRatio = React.forwardRef(
|
|
10
20
|
({ ratio = 16 / 9, className, children, style, ...rest }, ref) => {
|
|
21
|
+
const ratioClass = RATIO_CLASS[ratio.toFixed(4)];
|
|
11
22
|
return /* @__PURE__ */ jsx(
|
|
12
23
|
"div",
|
|
13
24
|
{
|
|
14
25
|
ref,
|
|
15
|
-
className: cn("relative w-full overflow-hidden", className),
|
|
16
|
-
style: { aspectRatio: String(ratio), ...style },
|
|
26
|
+
className: cn("relative w-full overflow-hidden", ratioClass, className),
|
|
27
|
+
style: ratioClass ? style : { aspectRatio: String(ratio), ...style },
|
|
17
28
|
...rest,
|
|
18
29
|
children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 h-full w-full", children })
|
|
19
30
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import {
|
|
3
|
+
pressable
|
|
4
|
+
} from "./chunk-7SXR4PGO.js";
|
|
2
5
|
import {
|
|
3
6
|
cn
|
|
4
7
|
} from "./chunk-Q7G5WGYV.js";
|
|
@@ -10,15 +13,15 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
10
13
|
var toneConfig = {
|
|
11
14
|
error: {
|
|
12
15
|
icon: /* @__PURE__ */ jsx(AlertCircle, { size: "xl", "aria-hidden": "true" }),
|
|
13
|
-
color: "text-[var(--color-
|
|
16
|
+
color: "text-[var(--color-error)]"
|
|
14
17
|
},
|
|
15
18
|
warning: {
|
|
16
19
|
icon: /* @__PURE__ */ jsx(AlertTriangle, { size: "xl", "aria-hidden": "true" }),
|
|
17
|
-
color: "text-[var(--color-
|
|
20
|
+
color: "text-[var(--color-warning)]"
|
|
18
21
|
},
|
|
19
22
|
info: {
|
|
20
23
|
icon: /* @__PURE__ */ jsx(Info, { size: "xl", "aria-hidden": "true" }),
|
|
21
|
-
color: "text-[var(--color-
|
|
24
|
+
color: "text-[var(--color-info)]"
|
|
22
25
|
}
|
|
23
26
|
};
|
|
24
27
|
var ErrorState = React.forwardRef(
|
|
@@ -36,14 +39,15 @@ var ErrorState = React.forwardRef(
|
|
|
36
39
|
children: [
|
|
37
40
|
/* @__PURE__ */ jsx("span", { className: color, children: icon }),
|
|
38
41
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
39
|
-
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-[var(--color-
|
|
40
|
-
description && /* @__PURE__ */ jsx("p", { className: "max-w-sm text-sm text-[var(--color-
|
|
42
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-[var(--color-on-surface)]", children: title }),
|
|
43
|
+
description && /* @__PURE__ */ jsx("p", { className: "max-w-sm text-sm text-[var(--color-on-surface-muted)]", children: description })
|
|
41
44
|
] }),
|
|
42
45
|
onRetry && /* @__PURE__ */ jsx(
|
|
43
46
|
"button",
|
|
44
47
|
{
|
|
48
|
+
type: "button",
|
|
45
49
|
onClick: onRetry,
|
|
46
|
-
className: "inline-flex h-9 items-center justify-center
|
|
50
|
+
className: cn(pressable, "inline-flex h-9 items-center justify-center bg-[var(--color-primary)] px-4 text-label-lg text-[var(--color-on-primary)]"),
|
|
47
51
|
children: "Try again"
|
|
48
52
|
}
|
|
49
53
|
)
|
|
@@ -13,7 +13,7 @@ var Root2 = React.forwardRef(
|
|
|
13
13
|
RadixAccordion.Root,
|
|
14
14
|
{
|
|
15
15
|
ref,
|
|
16
|
-
className: cn("divide-y divide-[var(--color-
|
|
16
|
+
className: cn("divide-y divide-[var(--color-outline-variant)]", className),
|
|
17
17
|
...props
|
|
18
18
|
}
|
|
19
19
|
)
|
|
@@ -30,7 +30,7 @@ var Trigger2 = React.forwardRef(
|
|
|
30
30
|
ref,
|
|
31
31
|
className: cn(
|
|
32
32
|
"flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all",
|
|
33
|
-
"hover:underline
|
|
33
|
+
"hover:underline",
|
|
34
34
|
"[&[data-state=open]>svg]:rotate-180",
|
|
35
35
|
className
|
|
36
36
|
),
|