@web-my-money/primitives 1.0.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/accordion/index.d.mts +9 -0
- package/dist/accordion/index.d.ts +9 -0
- package/dist/accordion/index.js +99 -0
- package/dist/accordion/index.mjs +14 -0
- package/dist/alert-dialog/index.d.mts +22 -0
- package/dist/alert-dialog/index.d.ts +22 -0
- package/dist/alert-dialog/index.js +206 -0
- package/dist/alert-dialog/index.mjs +29 -0
- package/dist/avatar/index.d.mts +23 -0
- package/dist/avatar/index.d.ts +23 -0
- package/dist/avatar/index.js +133 -0
- package/dist/avatar/index.mjs +10 -0
- package/dist/badge/index.d.mts +15 -0
- package/dist/badge/index.d.ts +15 -0
- package/dist/badge/index.js +96 -0
- package/dist/badge/index.mjs +10 -0
- package/dist/breadcrumb/index.d.mts +20 -0
- package/dist/breadcrumb/index.d.ts +20 -0
- package/dist/breadcrumb/index.js +126 -0
- package/dist/breadcrumb/index.mjs +20 -0
- package/dist/button/index.d.mts +12 -0
- package/dist/button/index.d.ts +12 -0
- package/dist/button/index.js +88 -0
- package/dist/button/index.mjs +10 -0
- package/dist/calendar/index.d.mts +29 -0
- package/dist/calendar/index.d.ts +29 -0
- package/dist/calendar/index.js +191 -0
- package/dist/calendar/index.mjs +9 -0
- package/dist/card/index.d.mts +13 -0
- package/dist/card/index.d.ts +13 -0
- package/dist/card/index.js +141 -0
- package/dist/card/index.mjs +19 -0
- package/dist/carousel/index.d.mts +20 -0
- package/dist/carousel/index.d.ts +20 -0
- package/dist/carousel/index.js +236 -0
- package/dist/carousel/index.mjs +19 -0
- package/dist/checkbox/index.d.mts +6 -0
- package/dist/checkbox/index.d.ts +6 -0
- package/dist/checkbox/index.js +63 -0
- package/dist/checkbox/index.mjs +8 -0
- package/dist/chunk-32LEHNCH.mjs +155 -0
- package/dist/chunk-3ZJ4L43B.mjs +92 -0
- package/dist/chunk-4KQNZMKT.mjs +47 -0
- package/dist/chunk-4W6U222X.mjs +113 -0
- package/dist/chunk-556SM2PJ.mjs +40 -0
- package/dist/chunk-5LYTCNI6.mjs +127 -0
- package/dist/chunk-5N7LGYZK.mjs +137 -0
- package/dist/chunk-6OG237U6.mjs +54 -0
- package/dist/chunk-7TMIJ7HZ.mjs +149 -0
- package/dist/chunk-DTENOVQN.mjs +44 -0
- package/dist/chunk-DUGW62XX.mjs +143 -0
- package/dist/chunk-DWLKKYIU.mjs +156 -0
- package/dist/chunk-DYCSGLM5.mjs +32 -0
- package/dist/chunk-DZPJV6MN.mjs +66 -0
- package/dist/chunk-FT72MNAV.mjs +25 -0
- package/dist/chunk-FV6JTZAK.mjs +30 -0
- package/dist/chunk-GLD4KQD3.mjs +90 -0
- package/dist/chunk-GWVW5OI6.mjs +106 -0
- package/dist/chunk-JWCA4M7E.mjs +160 -0
- package/dist/chunk-K4UYYX45.mjs +199 -0
- package/dist/chunk-KVQKOJNU.mjs +52 -0
- package/dist/chunk-LPMRBQLR.mjs +120 -0
- package/dist/chunk-M6HSM6GV.mjs +68 -0
- package/dist/chunk-NE5LEVMC.mjs +201 -0
- package/dist/chunk-NGWDLZ6E.mjs +33 -0
- package/dist/chunk-NH5ZVHAV.mjs +36 -0
- package/dist/chunk-PFXSPRVI.mjs +65 -0
- package/dist/chunk-PJO7WJ4G.mjs +10 -0
- package/dist/chunk-PTXZWR7Y.mjs +76 -0
- package/dist/chunk-SG747CBC.mjs +34 -0
- package/dist/chunk-UDQDW22Y.mjs +71 -0
- package/dist/chunk-UGOA6M4S.mjs +120 -0
- package/dist/chunk-UXU54FBX.mjs +63 -0
- package/dist/chunk-WYBX5VJ4.mjs +49 -0
- package/dist/chunk-Y7DNVOKO.mjs +57 -0
- package/dist/chunk-YNOS3JA2.mjs +29 -0
- package/dist/chunk-YPTARV3T.mjs +57 -0
- package/dist/chunk-YYFQVSPV.mjs +17 -0
- package/dist/chunk-ZR3J34NX.mjs +85 -0
- package/dist/collapsible/index.d.mts +8 -0
- package/dist/collapsible/index.d.ts +8 -0
- package/dist/collapsible/index.js +64 -0
- package/dist/collapsible/index.mjs +12 -0
- package/dist/combobox/index.d.mts +18 -0
- package/dist/combobox/index.d.ts +18 -0
- package/dist/combobox/index.js +198 -0
- package/dist/combobox/index.mjs +32 -0
- package/dist/context-menu/index.d.mts +16 -0
- package/dist/context-menu/index.d.ts +16 -0
- package/dist/context-menu/index.js +177 -0
- package/dist/context-menu/index.mjs +28 -0
- package/dist/date-range-input/index.d.mts +17 -0
- package/dist/date-range-input/index.d.ts +17 -0
- package/dist/date-range-input/index.js +284 -0
- package/dist/date-range-input/index.mjs +11 -0
- package/dist/dialog/index.d.mts +19 -0
- package/dist/dialog/index.d.ts +19 -0
- package/dist/dialog/index.js +240 -0
- package/dist/dialog/index.mjs +27 -0
- package/dist/dropdown-menu/index.d.mts +16 -0
- package/dist/dropdown-menu/index.d.ts +16 -0
- package/dist/dropdown-menu/index.js +189 -0
- package/dist/dropdown-menu/index.mjs +28 -0
- package/dist/field/index.d.mts +24 -0
- package/dist/field/index.d.ts +24 -0
- package/dist/field/index.js +88 -0
- package/dist/field/index.mjs +16 -0
- package/dist/hover-card/index.d.mts +8 -0
- package/dist/hover-card/index.d.ts +8 -0
- package/dist/hover-card/index.js +79 -0
- package/dist/hover-card/index.mjs +12 -0
- package/dist/index.d.mts +73 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +3167 -0
- package/dist/index.mjs +452 -0
- package/dist/input/index.d.mts +5 -0
- package/dist/input/index.d.ts +5 -0
- package/dist/input/index.js +54 -0
- package/dist/input/index.mjs +7 -0
- package/dist/kbd/index.d.mts +8 -0
- package/dist/kbd/index.d.ts +8 -0
- package/dist/kbd/index.js +64 -0
- package/dist/kbd/index.mjs +9 -0
- package/dist/lightbox/index.d.mts +17 -0
- package/dist/lightbox/index.d.ts +17 -0
- package/dist/lightbox/index.js +151 -0
- package/dist/lightbox/index.mjs +24 -0
- package/dist/pagination/index.d.mts +33 -0
- package/dist/pagination/index.d.ts +33 -0
- package/dist/pagination/index.js +212 -0
- package/dist/pagination/index.mjs +25 -0
- package/dist/popover/index.d.mts +11 -0
- package/dist/popover/index.d.ts +11 -0
- package/dist/popover/index.js +120 -0
- package/dist/popover/index.mjs +18 -0
- package/dist/progress/index.d.mts +6 -0
- package/dist/progress/index.d.ts +6 -0
- package/dist/progress/index.js +60 -0
- package/dist/progress/index.mjs +8 -0
- package/dist/radio-group/index.d.mts +8 -0
- package/dist/radio-group/index.d.ts +8 -0
- package/dist/radio-group/index.js +71 -0
- package/dist/radio-group/index.mjs +10 -0
- package/dist/resizable/index.d.mts +10 -0
- package/dist/resizable/index.d.ts +10 -0
- package/dist/resizable/index.js +80 -0
- package/dist/resizable/index.mjs +12 -0
- package/dist/scroll-area/index.d.mts +6 -0
- package/dist/scroll-area/index.d.ts +6 -0
- package/dist/scroll-area/index.js +74 -0
- package/dist/scroll-area/index.mjs +8 -0
- package/dist/select/index.d.mts +17 -0
- package/dist/select/index.d.ts +17 -0
- package/dist/select/index.js +238 -0
- package/dist/select/index.mjs +26 -0
- package/dist/separator/index.d.mts +6 -0
- package/dist/separator/index.d.ts +6 -0
- package/dist/separator/index.js +59 -0
- package/dist/separator/index.mjs +8 -0
- package/dist/sheet/index.d.mts +38 -0
- package/dist/sheet/index.d.ts +38 -0
- package/dist/sheet/index.js +212 -0
- package/dist/sheet/index.mjs +27 -0
- package/dist/skeleton/index.d.mts +17 -0
- package/dist/skeleton/index.d.ts +17 -0
- package/dist/skeleton/index.js +80 -0
- package/dist/skeleton/index.mjs +11 -0
- package/dist/slide-over/index.d.mts +92 -0
- package/dist/slide-over/index.d.ts +92 -0
- package/dist/slide-over/index.js +298 -0
- package/dist/slide-over/index.mjs +31 -0
- package/dist/slider/index.d.mts +6 -0
- package/dist/slider/index.d.ts +6 -0
- package/dist/slider/index.js +47 -0
- package/dist/slider/index.mjs +8 -0
- package/dist/switch/index.d.mts +8 -0
- package/dist/switch/index.d.ts +8 -0
- package/dist/switch/index.js +66 -0
- package/dist/switch/index.mjs +8 -0
- package/dist/tabs/index.d.mts +9 -0
- package/dist/tabs/index.d.ts +9 -0
- package/dist/tabs/index.js +96 -0
- package/dist/tabs/index.mjs +14 -0
- package/dist/toast/index.d.mts +19 -0
- package/dist/toast/index.d.ts +19 -0
- package/dist/toast/index.js +107 -0
- package/dist/toast/index.mjs +10 -0
- package/dist/toggle/index.d.mts +14 -0
- package/dist/toggle/index.d.ts +14 -0
- package/dist/toggle/index.js +89 -0
- package/dist/toggle/index.mjs +12 -0
- package/dist/tooltip/index.d.mts +9 -0
- package/dist/tooltip/index.d.ts +9 -0
- package/dist/tooltip/index.js +101 -0
- package/dist/tooltip/index.mjs +14 -0
- package/package.json +235 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-PJO7WJ4G.mjs";
|
|
4
|
+
|
|
5
|
+
// src/collapsible/index.tsx
|
|
6
|
+
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
function Collapsible({ ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible", ...props });
|
|
10
|
+
}
|
|
11
|
+
function CollapsibleTrigger({ ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(CollapsiblePrimitive.Trigger, { "data-slot": "collapsible-trigger", ...props });
|
|
13
|
+
}
|
|
14
|
+
function CollapsibleContent({
|
|
15
|
+
className,
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
CollapsiblePrimitive.Panel,
|
|
20
|
+
{
|
|
21
|
+
"data-slot": "collapsible-content",
|
|
22
|
+
className: cn("wmm-collapsible-panel", className),
|
|
23
|
+
...props
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
Collapsible,
|
|
30
|
+
CollapsibleTrigger,
|
|
31
|
+
CollapsibleContent
|
|
32
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-PJO7WJ4G.mjs";
|
|
4
|
+
|
|
5
|
+
// src/accordion/index.tsx
|
|
6
|
+
import { Accordion as AccordionPrimitive } from "@base-ui/react/accordion";
|
|
7
|
+
import { ChevronDown } from "lucide-react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var Accordion = AccordionPrimitive.Root;
|
|
10
|
+
var AccordionItem = ({
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}) => /* @__PURE__ */ jsx(
|
|
14
|
+
AccordionPrimitive.Item,
|
|
15
|
+
{
|
|
16
|
+
className: cn("border-b border-border last:border-0", className),
|
|
17
|
+
...props
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
var AccordionTrigger = ({
|
|
21
|
+
className,
|
|
22
|
+
children,
|
|
23
|
+
...props
|
|
24
|
+
}) => /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
|
|
25
|
+
AccordionPrimitive.Trigger,
|
|
26
|
+
{
|
|
27
|
+
className: cn(
|
|
28
|
+
"flex flex-1 cursor-pointer items-center justify-between py-4 text-sm font-medium",
|
|
29
|
+
"transition-all outline-none select-none",
|
|
30
|
+
"hover:underline hover:text-foreground",
|
|
31
|
+
"focus-visible:ring-2 focus-visible:ring-ring rounded-sm",
|
|
32
|
+
"[&[data-panel-open]>svg]:rotate-180",
|
|
33
|
+
className
|
|
34
|
+
),
|
|
35
|
+
...props,
|
|
36
|
+
children: [
|
|
37
|
+
children,
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
ChevronDown,
|
|
40
|
+
{
|
|
41
|
+
className: "size-4 shrink-0 text-muted-foreground transition-transform duration-200",
|
|
42
|
+
"aria-hidden": true
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
) });
|
|
48
|
+
var AccordionContent = ({
|
|
49
|
+
className,
|
|
50
|
+
children,
|
|
51
|
+
...props
|
|
52
|
+
}) => /* @__PURE__ */ jsx(
|
|
53
|
+
AccordionPrimitive.Panel,
|
|
54
|
+
{
|
|
55
|
+
className: "wmm-accordion-panel text-sm",
|
|
56
|
+
...props,
|
|
57
|
+
children: /* @__PURE__ */ jsx("div", { className: cn("pb-4 pt-0 text-muted-foreground", className), children })
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
Accordion,
|
|
63
|
+
AccordionItem,
|
|
64
|
+
AccordionTrigger,
|
|
65
|
+
AccordionContent
|
|
66
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-PJO7WJ4G.mjs";
|
|
4
|
+
|
|
5
|
+
// src/input/index.tsx
|
|
6
|
+
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
function Input({ className, type, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
InputPrimitive,
|
|
11
|
+
{
|
|
12
|
+
type,
|
|
13
|
+
"data-slot": "input",
|
|
14
|
+
className: cn(
|
|
15
|
+
"h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
16
|
+
className
|
|
17
|
+
),
|
|
18
|
+
...props
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
Input
|
|
25
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-PJO7WJ4G.mjs";
|
|
4
|
+
|
|
5
|
+
// src/progress/index.tsx
|
|
6
|
+
import { Progress as ProgressPrimitive } from "@base-ui/react/progress";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
function Progress({
|
|
9
|
+
className,
|
|
10
|
+
value,
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
13
|
+
return /* @__PURE__ */ jsx(ProgressPrimitive.Root, { "data-slot": "progress", value, ...props, children: /* @__PURE__ */ jsx(
|
|
14
|
+
ProgressPrimitive.Track,
|
|
15
|
+
{
|
|
16
|
+
className: cn("relative h-2 w-full overflow-hidden rounded-full bg-muted", className),
|
|
17
|
+
children: /* @__PURE__ */ jsx(
|
|
18
|
+
ProgressPrimitive.Indicator,
|
|
19
|
+
{
|
|
20
|
+
"data-slot": "progress-indicator",
|
|
21
|
+
className: "h-full rounded-full bg-primary transition-[width] duration-300 ease-out"
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
) });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
Progress
|
|
30
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-PJO7WJ4G.mjs";
|
|
4
|
+
|
|
5
|
+
// src/breadcrumb/index.tsx
|
|
6
|
+
import { MoreHorizontal, ChevronRight } from "lucide-react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
function Breadcrumb({ ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...props });
|
|
10
|
+
}
|
|
11
|
+
function BreadcrumbList({ className, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
"ol",
|
|
14
|
+
{
|
|
15
|
+
"data-slot": "breadcrumb-list",
|
|
16
|
+
className: cn(
|
|
17
|
+
"flex flex-wrap items-center gap-1.5 text-sm text-muted-foreground sm:gap-2.5",
|
|
18
|
+
className
|
|
19
|
+
),
|
|
20
|
+
...props
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
"li",
|
|
27
|
+
{
|
|
28
|
+
"data-slot": "breadcrumb-item",
|
|
29
|
+
className: cn("inline-flex items-center gap-1.5", className),
|
|
30
|
+
...props
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function BreadcrumbLink({ className, href, renderLink, children, ...props }) {
|
|
35
|
+
const cls = cn("transition-colors hover:text-foreground", className);
|
|
36
|
+
if (renderLink) return /* @__PURE__ */ jsx(Fragment, { children: renderLink({ href, className: cls, children }) });
|
|
37
|
+
return /* @__PURE__ */ jsx("a", { "data-slot": "breadcrumb-link", href, className: cls, ...props, children });
|
|
38
|
+
}
|
|
39
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
"span",
|
|
42
|
+
{
|
|
43
|
+
"data-slot": "breadcrumb-page",
|
|
44
|
+
role: "link",
|
|
45
|
+
"aria-disabled": "true",
|
|
46
|
+
"aria-current": "page",
|
|
47
|
+
className: cn("font-medium text-foreground", className),
|
|
48
|
+
...props
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function BreadcrumbSeparator({ children, className, ...props }) {
|
|
53
|
+
return /* @__PURE__ */ jsx(
|
|
54
|
+
"li",
|
|
55
|
+
{
|
|
56
|
+
"data-slot": "breadcrumb-separator",
|
|
57
|
+
role: "presentation",
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
className: cn("[&>svg]:size-3.5", className),
|
|
60
|
+
...props,
|
|
61
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronRight, {})
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
function BreadcrumbEllipsis({ className, ...props }) {
|
|
66
|
+
return /* @__PURE__ */ jsxs(
|
|
67
|
+
"span",
|
|
68
|
+
{
|
|
69
|
+
"data-slot": "breadcrumb-ellipsis",
|
|
70
|
+
role: "presentation",
|
|
71
|
+
"aria-hidden": "true",
|
|
72
|
+
className: cn("flex size-6 items-center justify-center", className),
|
|
73
|
+
...props,
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsx(MoreHorizontal, { className: "size-4" }),
|
|
76
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "More" })
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
Breadcrumb,
|
|
84
|
+
BreadcrumbList,
|
|
85
|
+
BreadcrumbItem,
|
|
86
|
+
BreadcrumbLink,
|
|
87
|
+
BreadcrumbPage,
|
|
88
|
+
BreadcrumbSeparator,
|
|
89
|
+
BreadcrumbEllipsis
|
|
90
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-PJO7WJ4G.mjs";
|
|
4
|
+
|
|
5
|
+
// src/card/index.tsx
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function Card({
|
|
8
|
+
className,
|
|
9
|
+
size = "default",
|
|
10
|
+
...props
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
"data-slot": "card",
|
|
16
|
+
"data-size": size,
|
|
17
|
+
className: cn(
|
|
18
|
+
"group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
|
19
|
+
className
|
|
20
|
+
),
|
|
21
|
+
...props
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
function CardHeader({ className, ...props }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
"data-slot": "card-header",
|
|
30
|
+
className: cn(
|
|
31
|
+
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",
|
|
32
|
+
className
|
|
33
|
+
),
|
|
34
|
+
...props
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function CardTitle({ className, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
"data-slot": "card-title",
|
|
43
|
+
className: cn(
|
|
44
|
+
"font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
|
|
45
|
+
className
|
|
46
|
+
),
|
|
47
|
+
...props
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function CardDescription({ className, ...props }) {
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
"data-slot": "card-description",
|
|
56
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
57
|
+
...props
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
function CardAction({ className, ...props }) {
|
|
62
|
+
return /* @__PURE__ */ jsx(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
"data-slot": "card-action",
|
|
66
|
+
className: cn(
|
|
67
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
68
|
+
className
|
|
69
|
+
),
|
|
70
|
+
...props
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
function CardContent({ className, ...props }) {
|
|
75
|
+
return /* @__PURE__ */ jsx(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
"data-slot": "card-content",
|
|
79
|
+
className: cn("px-4 group-data-[size=sm]/card:px-3", className),
|
|
80
|
+
...props
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
function CardFooter({ className, ...props }) {
|
|
85
|
+
return /* @__PURE__ */ jsx(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
"data-slot": "card-footer",
|
|
89
|
+
className: cn(
|
|
90
|
+
"flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3",
|
|
91
|
+
className
|
|
92
|
+
),
|
|
93
|
+
...props
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export {
|
|
99
|
+
Card,
|
|
100
|
+
CardHeader,
|
|
101
|
+
CardTitle,
|
|
102
|
+
CardDescription,
|
|
103
|
+
CardAction,
|
|
104
|
+
CardContent,
|
|
105
|
+
CardFooter
|
|
106
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buttonVariants
|
|
3
|
+
} from "./chunk-YPTARV3T.mjs";
|
|
4
|
+
import {
|
|
5
|
+
cn
|
|
6
|
+
} from "./chunk-PJO7WJ4G.mjs";
|
|
7
|
+
|
|
8
|
+
// src/carousel/index.tsx
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
var CarouselContext = React.createContext(null);
|
|
13
|
+
function useCarousel() {
|
|
14
|
+
const ctx = React.useContext(CarouselContext);
|
|
15
|
+
if (!ctx) throw new Error("Carousel parts must be used within <Carousel>");
|
|
16
|
+
return ctx;
|
|
17
|
+
}
|
|
18
|
+
function Carousel({ orientation = "horizontal", className, children, ...props }) {
|
|
19
|
+
const trackRef = React.useRef(null);
|
|
20
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
21
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
22
|
+
const updateScrollState = React.useCallback(() => {
|
|
23
|
+
const el = trackRef.current;
|
|
24
|
+
if (!el) return;
|
|
25
|
+
if (orientation === "horizontal") {
|
|
26
|
+
setCanScrollPrev(el.scrollLeft > 4);
|
|
27
|
+
setCanScrollNext(el.scrollLeft < el.scrollWidth - el.clientWidth - 4);
|
|
28
|
+
} else {
|
|
29
|
+
setCanScrollPrev(el.scrollTop > 4);
|
|
30
|
+
setCanScrollNext(el.scrollTop < el.scrollHeight - el.clientHeight - 4);
|
|
31
|
+
}
|
|
32
|
+
}, [orientation]);
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
const el = trackRef.current;
|
|
35
|
+
if (!el) return;
|
|
36
|
+
updateScrollState();
|
|
37
|
+
el.addEventListener("scroll", updateScrollState, { passive: true });
|
|
38
|
+
const ro = new ResizeObserver(updateScrollState);
|
|
39
|
+
ro.observe(el);
|
|
40
|
+
return () => {
|
|
41
|
+
el.removeEventListener("scroll", updateScrollState);
|
|
42
|
+
ro.disconnect();
|
|
43
|
+
};
|
|
44
|
+
}, [updateScrollState]);
|
|
45
|
+
const scrollByAmount = React.useCallback(
|
|
46
|
+
(dir) => {
|
|
47
|
+
const el = trackRef.current;
|
|
48
|
+
if (!el) return;
|
|
49
|
+
const amount = (orientation === "horizontal" ? el.clientWidth : el.clientHeight) * 0.9 * dir;
|
|
50
|
+
el.scrollBy(
|
|
51
|
+
orientation === "horizontal" ? { left: amount, behavior: "smooth" } : { top: amount, behavior: "smooth" }
|
|
52
|
+
);
|
|
53
|
+
},
|
|
54
|
+
[orientation]
|
|
55
|
+
);
|
|
56
|
+
const onKeyDown = (e) => {
|
|
57
|
+
if (orientation === "horizontal" && e.key === "ArrowLeft") scrollByAmount(-1);
|
|
58
|
+
else if (orientation === "horizontal" && e.key === "ArrowRight") scrollByAmount(1);
|
|
59
|
+
else if (orientation === "vertical" && e.key === "ArrowUp") scrollByAmount(-1);
|
|
60
|
+
else if (orientation === "vertical" && e.key === "ArrowDown") scrollByAmount(1);
|
|
61
|
+
else return;
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ jsx(CarouselContext.Provider, { value: { trackRef, orientation, scrollByAmount, canScrollPrev, canScrollNext }, children: /* @__PURE__ */ jsx(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
"data-slot": "carousel",
|
|
68
|
+
role: "region",
|
|
69
|
+
"aria-roledescription": "carousel",
|
|
70
|
+
className: cn("relative", className),
|
|
71
|
+
onKeyDownCapture: onKeyDown,
|
|
72
|
+
...props,
|
|
73
|
+
children
|
|
74
|
+
}
|
|
75
|
+
) });
|
|
76
|
+
}
|
|
77
|
+
function CarouselContent({ className, ...props }) {
|
|
78
|
+
const { trackRef, orientation } = useCarousel();
|
|
79
|
+
return /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
ref: trackRef,
|
|
83
|
+
"data-slot": "carousel-content",
|
|
84
|
+
className: cn(
|
|
85
|
+
"flex snap-x snap-mandatory overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
86
|
+
orientation === "vertical" && "snap-y flex-col overflow-y-auto",
|
|
87
|
+
className
|
|
88
|
+
),
|
|
89
|
+
...props
|
|
90
|
+
}
|
|
91
|
+
) });
|
|
92
|
+
}
|
|
93
|
+
function CarouselItem({ className, ...props }) {
|
|
94
|
+
const { orientation } = useCarousel();
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
"data-slot": "carousel-item",
|
|
99
|
+
role: "group",
|
|
100
|
+
"aria-roledescription": "slide",
|
|
101
|
+
className: cn(
|
|
102
|
+
"min-w-0 shrink-0 grow-0 snap-start basis-full",
|
|
103
|
+
orientation === "vertical" && "basis-auto",
|
|
104
|
+
className
|
|
105
|
+
),
|
|
106
|
+
...props
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
function CarouselPrevious({ className, ...props }) {
|
|
111
|
+
const { scrollByAmount, canScrollPrev, orientation } = useCarousel();
|
|
112
|
+
return /* @__PURE__ */ jsx(
|
|
113
|
+
"button",
|
|
114
|
+
{
|
|
115
|
+
type: "button",
|
|
116
|
+
"data-slot": "carousel-previous",
|
|
117
|
+
"aria-label": "Previous slide",
|
|
118
|
+
disabled: !canScrollPrev,
|
|
119
|
+
onClick: () => scrollByAmount(-1),
|
|
120
|
+
className: cn(
|
|
121
|
+
buttonVariants({ variant: "outline", size: "icon-sm" }),
|
|
122
|
+
"absolute rounded-full",
|
|
123
|
+
orientation === "horizontal" ? "top-1/2 left-2 -translate-y-1/2" : "top-2 left-1/2 -translate-x-1/2 rotate-90",
|
|
124
|
+
className
|
|
125
|
+
),
|
|
126
|
+
...props,
|
|
127
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" })
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
function CarouselNext({ className, ...props }) {
|
|
132
|
+
const { scrollByAmount, canScrollNext, orientation } = useCarousel();
|
|
133
|
+
return /* @__PURE__ */ jsx(
|
|
134
|
+
"button",
|
|
135
|
+
{
|
|
136
|
+
type: "button",
|
|
137
|
+
"data-slot": "carousel-next",
|
|
138
|
+
"aria-label": "Next slide",
|
|
139
|
+
disabled: !canScrollNext,
|
|
140
|
+
onClick: () => scrollByAmount(1),
|
|
141
|
+
className: cn(
|
|
142
|
+
buttonVariants({ variant: "outline", size: "icon-sm" }),
|
|
143
|
+
"absolute rounded-full",
|
|
144
|
+
orientation === "horizontal" ? "top-1/2 right-2 -translate-y-1/2" : "bottom-2 left-1/2 -translate-x-1/2 rotate-90",
|
|
145
|
+
className
|
|
146
|
+
),
|
|
147
|
+
...props,
|
|
148
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-4" })
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export {
|
|
154
|
+
useCarousel,
|
|
155
|
+
Carousel,
|
|
156
|
+
CarouselContent,
|
|
157
|
+
CarouselItem,
|
|
158
|
+
CarouselPrevious,
|
|
159
|
+
CarouselNext
|
|
160
|
+
};
|