@codefast/ui 0.3.11-canary.1 → 0.3.11
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/CHANGELOG.md +36 -0
- package/README.md +34 -14
- package/dist/components/accordion.d.ts +29 -10
- package/dist/components/accordion.js +38 -37
- package/dist/components/alert-dialog.d.ts +60 -24
- package/dist/components/alert-dialog.js +69 -72
- package/dist/components/alert.d.ts +27 -15
- package/dist/components/alert.js +29 -31
- package/dist/components/aspect-ratio.d.ts +8 -4
- package/dist/components/aspect-ratio.js +7 -5
- package/dist/components/avatar.d.ts +17 -6
- package/dist/components/avatar.js +19 -17
- package/dist/components/badge.d.ts +21 -14
- package/dist/components/badge.js +19 -22
- package/dist/components/breadcrumb.d.ts +35 -12
- package/dist/components/breadcrumb.js +48 -54
- package/dist/components/button-group.d.ts +29 -14
- package/dist/components/button-group.js +27 -32
- package/dist/components/button.d.ts +35 -25
- package/dist/components/button.js +50 -48
- package/dist/components/calendar.d.ts +24 -9
- package/dist/components/calendar.js +92 -98
- package/dist/components/card.d.ts +34 -10
- package/dist/components/card.js +39 -37
- package/dist/components/carousel.d.ts +55 -24
- package/dist/components/carousel.js +113 -130
- package/dist/components/chart.d.ts +72 -36
- package/dist/components/chart.js +154 -166
- package/dist/components/checkbox-cards.d.ts +15 -8
- package/dist/components/checkbox-cards.js +22 -25
- package/dist/components/checkbox-group.d.ts +16 -8
- package/dist/components/checkbox-group.js +19 -19
- package/dist/components/checkbox.d.ts +9 -4
- package/dist/components/checkbox.js +14 -14
- package/dist/components/collapsible.d.ts +14 -6
- package/dist/components/collapsible.js +18 -16
- package/dist/components/command.d.ts +55 -23
- package/dist/components/command.js +70 -85
- package/dist/components/context-menu.d.ts +72 -22
- package/dist/components/context-menu.js +88 -109
- package/dist/components/dialog.d.ts +53 -22
- package/dist/components/dialog.js +71 -85
- package/dist/components/drawer.d.ts +60 -28
- package/dist/components/drawer.js +59 -67
- package/dist/components/dropdown-menu.d.ts +73 -22
- package/dist/components/dropdown-menu.js +95 -112
- package/dist/components/empty.d.ts +37 -15
- package/dist/components/empty.js +43 -45
- package/dist/components/field.d.ts +63 -25
- package/dist/components/field.js +88 -104
- package/dist/components/form.d.ts +37 -15
- package/dist/components/form.js +65 -70
- package/dist/components/hover-card.d.ts +21 -7
- package/dist/components/hover-card.js +24 -24
- package/dist/components/input-group.d.ts +53 -28
- package/dist/components/input-group.js +63 -77
- package/dist/components/input-number.d.ts +28 -7
- package/dist/components/input-number.js +55 -59
- package/dist/components/input-otp.d.ts +24 -10
- package/dist/components/input-otp.js +33 -37
- package/dist/components/input-password.d.ts +12 -5
- package/dist/components/input-password.js +31 -32
- package/dist/components/input-search.d.ts +18 -8
- package/dist/components/input-search.js +43 -41
- package/dist/components/input.d.ts +10 -4
- package/dist/components/input.js +9 -7
- package/dist/components/item.d.ts +69 -32
- package/dist/components/item.js +89 -92
- package/dist/components/kbd.d.ts +13 -5
- package/dist/components/kbd.js +13 -11
- package/dist/components/label.d.ts +9 -4
- package/dist/components/label.js +9 -7
- package/dist/components/menubar.d.ts +80 -23
- package/dist/components/menubar.js +97 -118
- package/dist/components/native-select.d.ts +16 -6
- package/dist/components/native-select.js +25 -26
- package/dist/components/navigation-menu.d.ts +36 -12
- package/dist/components/navigation-menu.js +60 -75
- package/dist/components/pagination.d.ts +35 -14
- package/dist/components/pagination.js +54 -69
- package/dist/components/popover.d.ts +24 -8
- package/dist/components/popover.js +28 -28
- package/dist/components/progress-circle.d.ts +106 -88
- package/dist/components/progress-circle.js +106 -138
- package/dist/components/progress.d.ts +10 -4
- package/dist/components/progress.js +14 -14
- package/dist/components/radio-cards.d.ts +10 -4
- package/dist/components/radio-cards.js +22 -23
- package/dist/components/radio-group.d.ts +13 -5
- package/dist/components/radio-group.js +18 -16
- package/dist/components/radio.d.ts +12 -5
- package/dist/components/radio.js +10 -8
- package/dist/components/resizable.d.ts +18 -7
- package/dist/components/resizable.js +22 -22
- package/dist/components/scroll-area.d.ts +33 -20
- package/dist/components/scroll-area.js +84 -88
- package/dist/components/select.d.ts +50 -16
- package/dist/components/select.js +77 -96
- package/dist/components/separator.d.ts +29 -19
- package/dist/components/separator.js +36 -34
- package/dist/components/sheet.d.ts +62 -29
- package/dist/components/sheet.js +79 -100
- package/dist/components/sidebar.d.ts +160 -66
- package/dist/components/sidebar.js +294 -336
- package/dist/components/skeleton.d.ts +9 -4
- package/dist/components/skeleton.js +8 -6
- package/dist/components/slider.d.ts +13 -4
- package/dist/components/slider.js +34 -40
- package/dist/components/sonner.d.ts +10 -7
- package/dist/components/sonner.js +16 -14
- package/dist/components/spinner.d.ts +12 -5
- package/dist/components/spinner.js +33 -35
- package/dist/components/switch.d.ts +9 -4
- package/dist/components/switch.js +13 -11
- package/dist/components/table.d.ts +37 -11
- package/dist/components/table.js +47 -45
- package/dist/components/tabs.d.ts +21 -7
- package/dist/components/tabs.js +24 -22
- package/dist/components/textarea.d.ts +9 -4
- package/dist/components/textarea.js +8 -6
- package/dist/components/toggle-group.d.ts +24 -9
- package/dist/components/toggle-group.js +41 -42
- package/dist/components/toggle.d.ts +25 -17
- package/dist/components/toggle.js +30 -28
- package/dist/components/tooltip.d.ts +24 -8
- package/dist/components/tooltip.js +29 -32
- package/dist/hooks/use-animated-value.d.ts +4 -1
- package/dist/hooks/use-animated-value.js +57 -36
- package/dist/hooks/use-copy-to-clipboard.d.ts +11 -5
- package/dist/hooks/use-copy-to-clipboard.js +39 -20
- package/dist/hooks/use-is-mobile.d.ts +4 -1
- package/dist/hooks/use-is-mobile.js +21 -1
- package/dist/hooks/use-media-query.d.ts +4 -1
- package/dist/hooks/use-media-query.js +45 -18
- package/dist/hooks/use-mutation-observer.d.ts +6 -2
- package/dist/hooks/use-mutation-observer.js +34 -16
- package/dist/hooks/use-pagination.d.ts +22 -14
- package/dist/hooks/use-pagination.js +100 -49
- package/dist/index.d.ts +69 -130
- package/dist/index.js +11 -11
- package/dist/primitives/checkbox-group.d.ts +105 -83
- package/dist/primitives/checkbox-group.js +111 -84
- package/dist/primitives/input-number.d.ts +51 -40
- package/dist/primitives/input-number.js +483 -350
- package/dist/primitives/input.d.ts +48 -42
- package/dist/primitives/input.js +65 -43
- package/dist/primitives/progress-circle.d.ts +79 -48
- package/dist/primitives/progress-circle.js +154 -105
- package/package.json +6 -7
|
@@ -1,143 +1,122 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { cn } from "@codefast/tailwind-variants";
|
|
4
|
-
import { Arrow, CheckboxItem, Content, Group, Item, ItemIndicator, Label, Portal, RadioGroup, RadioItem, Root, Separator, Sub, SubContent, SubTrigger, Trigger } from "@radix-ui/react-context-menu";
|
|
5
3
|
import { CheckIcon, ChevronRightIcon, DotIcon } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
6
|
+
//#region src/components/context-menu.tsx
|
|
6
7
|
function ContextMenu({ ...props }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
return /* @__PURE__ */ jsx(ContextMenuPrimitive.Root, {
|
|
9
|
+
"data-slot": "context-menu",
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
11
12
|
}
|
|
12
13
|
function ContextMenuTrigger({ ...props }) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
return /* @__PURE__ */ jsx(ContextMenuPrimitive.Trigger, {
|
|
15
|
+
"data-slot": "context-menu-trigger",
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
17
18
|
}
|
|
18
19
|
function ContextMenuGroup({ ...props }) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
return /* @__PURE__ */ jsx(ContextMenuPrimitive.Group, {
|
|
21
|
+
"data-slot": "context-menu-group",
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
23
24
|
}
|
|
24
25
|
function ContextMenuSub({ ...props }) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
return /* @__PURE__ */ jsx(ContextMenuPrimitive.Sub, {
|
|
27
|
+
"data-slot": "context-menu-sub",
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
29
30
|
}
|
|
30
31
|
function ContextMenuRadioGroup({ ...props }) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
return /* @__PURE__ */ jsx(ContextMenuPrimitive.RadioGroup, {
|
|
33
|
+
"data-slot": "context-menu-radio-group",
|
|
34
|
+
...props
|
|
35
|
+
});
|
|
35
36
|
}
|
|
36
37
|
function ContextMenuSubTrigger({ children, className, inset, ...props }) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/*#__PURE__*/ jsx(ChevronRightIcon, {
|
|
45
|
-
className: "ml-auto size-4"
|
|
46
|
-
})
|
|
47
|
-
]
|
|
48
|
-
});
|
|
38
|
+
return /* @__PURE__ */ jsxs(ContextMenuPrimitive.SubTrigger, {
|
|
39
|
+
className: cn("flex cursor-default items-center gap-x-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
40
|
+
"data-inset": inset,
|
|
41
|
+
"data-slot": "context-menu-sub-trigger",
|
|
42
|
+
...props,
|
|
43
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto size-4" })]
|
|
44
|
+
});
|
|
49
45
|
}
|
|
50
46
|
function ContextMenuSubContent({ className, ...props }) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
57
|
-
});
|
|
47
|
+
return /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.SubContent, {
|
|
48
|
+
className: cn("z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg ease-ui data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=left]:slide-out-to-right-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 data-[state=closed]:data-[side=top]:slide-out-to-bottom-2 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=top]:slide-in-from-bottom-2", className),
|
|
49
|
+
"data-slot": "context-menu-sub-content",
|
|
50
|
+
...props
|
|
51
|
+
}) });
|
|
58
52
|
}
|
|
59
53
|
function ContextMenuContent({ className, ...props }) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
})
|
|
66
|
-
});
|
|
54
|
+
return /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.Content, {
|
|
55
|
+
className: cn("z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg ease-ui data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=top]:slide-in-from-bottom-2", className),
|
|
56
|
+
"data-slot": "context-menu-content",
|
|
57
|
+
...props
|
|
58
|
+
}) });
|
|
67
59
|
}
|
|
68
60
|
function ContextMenuItem({ className, inset, variant, ...props }) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
61
|
+
return /* @__PURE__ */ jsx(ContextMenuPrimitive.Item, {
|
|
62
|
+
className: cn("group/context-menu-item relative flex cursor-default items-center gap-x-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground aria-disabled:opacity-50 data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:[&_svg:not([class*='text-'])]:text-destructive/80", className),
|
|
63
|
+
"data-inset": inset,
|
|
64
|
+
"data-slot": "context-menu-item",
|
|
65
|
+
"data-variant": variant,
|
|
66
|
+
...props
|
|
67
|
+
});
|
|
76
68
|
}
|
|
77
69
|
function ContextMenuCheckboxItem({ checked, children, className, ...props }) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
className: "size-4"
|
|
89
|
-
})
|
|
90
|
-
})
|
|
91
|
-
}),
|
|
92
|
-
children
|
|
93
|
-
]
|
|
94
|
-
});
|
|
70
|
+
return /* @__PURE__ */ jsxs(ContextMenuPrimitive.CheckboxItem, {
|
|
71
|
+
checked,
|
|
72
|
+
className: cn("group/context-menu-item relative flex cursor-default items-center gap-x-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground aria-disabled:opacity-50 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
73
|
+
"data-slot": "context-menu-checkbox-item",
|
|
74
|
+
...props,
|
|
75
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
76
|
+
className: "absolute left-2 flex items-center justify-center",
|
|
77
|
+
children: /* @__PURE__ */ jsx(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
|
|
78
|
+
}), children]
|
|
79
|
+
});
|
|
95
80
|
}
|
|
96
81
|
function ContextMenuRadioItem({ children, className, ...props }) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
className: "size-4 fill-current"
|
|
107
|
-
})
|
|
108
|
-
})
|
|
109
|
-
}),
|
|
110
|
-
children
|
|
111
|
-
]
|
|
112
|
-
});
|
|
82
|
+
return /* @__PURE__ */ jsxs(ContextMenuPrimitive.RadioItem, {
|
|
83
|
+
className: cn("group/context-menu-item relative flex cursor-default items-center gap-x-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground aria-disabled:opacity-50 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
84
|
+
"data-slot": "context-menu-radio-item",
|
|
85
|
+
...props,
|
|
86
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
87
|
+
className: "absolute left-2 flex items-center justify-center",
|
|
88
|
+
children: /* @__PURE__ */ jsx(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(DotIcon, { className: "size-4 fill-current" }) })
|
|
89
|
+
}), children]
|
|
90
|
+
});
|
|
113
91
|
}
|
|
114
92
|
function ContextMenuLabel({ className, inset, ...props }) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
93
|
+
return /* @__PURE__ */ jsx(ContextMenuPrimitive.Label, {
|
|
94
|
+
className: cn("flex items-center gap-x-2 px-2 py-1.5 text-sm font-semibold data-inset:pl-8", className),
|
|
95
|
+
"data-inset": inset,
|
|
96
|
+
"data-slot": "context-menu-label",
|
|
97
|
+
...props
|
|
98
|
+
});
|
|
121
99
|
}
|
|
122
100
|
function ContextMenuSeparator({ className, ...props }) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
101
|
+
return /* @__PURE__ */ jsx(ContextMenuPrimitive.Separator, {
|
|
102
|
+
className: cn("mx-2 my-1 h-px bg-border", className),
|
|
103
|
+
"data-slot": "context-menu-separator",
|
|
104
|
+
...props
|
|
105
|
+
});
|
|
128
106
|
}
|
|
129
107
|
function ContextMenuShortcut({ className, ...props }) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
108
|
+
return /* @__PURE__ */ jsx("span", {
|
|
109
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-data-[variant=destructive]/context-menu-item:text-destructive/80", className),
|
|
110
|
+
"data-slot": "context-menu-shortcut",
|
|
111
|
+
...props
|
|
112
|
+
});
|
|
135
113
|
}
|
|
136
114
|
function ContextMenuArrow({ className, ...props }) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
115
|
+
return /* @__PURE__ */ jsx(ContextMenuPrimitive.Arrow, {
|
|
116
|
+
className: cn("fill-popover", className),
|
|
117
|
+
"data-slot": "context-menu-arrow",
|
|
118
|
+
...props
|
|
119
|
+
});
|
|
142
120
|
}
|
|
121
|
+
//#endregion
|
|
143
122
|
export { ContextMenu, ContextMenuArrow, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger };
|
|
@@ -1,34 +1,65 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { buttonVariants } from "./button.js";
|
|
2
|
+
import { VariantProps } from "@codefast/tailwind-variants";
|
|
3
|
+
import { ComponentProps, JSX } from "react";
|
|
3
4
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
//#region src/components/dialog.d.ts
|
|
5
7
|
type DialogProps = ComponentProps<typeof DialogPrimitive.Root>;
|
|
6
|
-
declare function Dialog({
|
|
8
|
+
declare function Dialog({
|
|
9
|
+
...props
|
|
10
|
+
}: DialogProps): JSX.Element;
|
|
7
11
|
type DialogTriggerProps = ComponentProps<typeof DialogPrimitive.Trigger>;
|
|
8
|
-
declare function DialogTrigger({
|
|
12
|
+
declare function DialogTrigger({
|
|
13
|
+
...props
|
|
14
|
+
}: DialogTriggerProps): JSX.Element;
|
|
9
15
|
interface DialogContentProps extends ComponentProps<typeof DialogPrimitive.Content> {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
classNames?: {
|
|
17
|
+
close?: string;
|
|
18
|
+
content?: string;
|
|
19
|
+
overlay?: string;
|
|
20
|
+
wrapper?: string;
|
|
21
|
+
};
|
|
16
22
|
}
|
|
17
|
-
declare function DialogContent({
|
|
23
|
+
declare function DialogContent({
|
|
24
|
+
children,
|
|
25
|
+
className,
|
|
26
|
+
classNames,
|
|
27
|
+
...props
|
|
28
|
+
}: DialogContentProps): JSX.Element;
|
|
18
29
|
type DialogHeaderProps = ComponentProps<"div">;
|
|
19
|
-
declare function DialogHeader({
|
|
30
|
+
declare function DialogHeader({
|
|
31
|
+
className,
|
|
32
|
+
...props
|
|
33
|
+
}: DialogHeaderProps): JSX.Element;
|
|
20
34
|
type DialogBodyProps = ComponentProps<"div">;
|
|
21
|
-
declare function DialogBody({
|
|
35
|
+
declare function DialogBody({
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: DialogBodyProps): JSX.Element;
|
|
22
39
|
type DialogFooterProps = ComponentProps<"div">;
|
|
23
|
-
declare function DialogFooter({
|
|
40
|
+
declare function DialogFooter({
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}: DialogFooterProps): JSX.Element;
|
|
24
44
|
type DialogTitleProps = ComponentProps<typeof DialogPrimitive.Title>;
|
|
25
|
-
declare function DialogTitle({
|
|
45
|
+
declare function DialogTitle({
|
|
46
|
+
className,
|
|
47
|
+
...props
|
|
48
|
+
}: DialogTitleProps): JSX.Element;
|
|
26
49
|
type DialogDescriptionProps = ComponentProps<typeof DialogPrimitive.Description>;
|
|
27
|
-
declare function DialogDescription({
|
|
50
|
+
declare function DialogDescription({
|
|
51
|
+
className,
|
|
52
|
+
...props
|
|
53
|
+
}: DialogDescriptionProps): JSX.Element;
|
|
28
54
|
interface DialogCloseProps extends Omit<ComponentProps<typeof DialogPrimitive.Close>, "ref"> {
|
|
29
|
-
|
|
30
|
-
|
|
55
|
+
size?: VariantProps<typeof buttonVariants>["size"];
|
|
56
|
+
variant?: VariantProps<typeof buttonVariants>["variant"];
|
|
31
57
|
}
|
|
32
|
-
declare function DialogClose({
|
|
33
|
-
|
|
34
|
-
|
|
58
|
+
declare function DialogClose({
|
|
59
|
+
className,
|
|
60
|
+
size,
|
|
61
|
+
variant,
|
|
62
|
+
...props
|
|
63
|
+
}: DialogCloseProps): JSX.Element;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { Dialog, DialogBody, type DialogBodyProps, DialogClose, type DialogCloseProps, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, type DialogProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps };
|
|
@@ -1,107 +1,93 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { buttonVariants } from "./button.js";
|
|
3
3
|
import { cn } from "@codefast/tailwind-variants";
|
|
4
|
-
import { Close, Content, Description, Overlay, Portal, Root, Title, Trigger } from "@radix-ui/react-dialog";
|
|
5
4
|
import { XIcon } from "lucide-react";
|
|
6
|
-
import {
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
7
|
+
//#region src/components/dialog.tsx
|
|
7
8
|
function Dialog({ ...props }) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Root, {
|
|
10
|
+
"data-slot": "dialog",
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
12
13
|
}
|
|
13
14
|
function DialogTrigger({ ...props }) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, {
|
|
16
|
+
"data-slot": "dialog-trigger",
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
18
19
|
}
|
|
19
20
|
function DialogContent({ children, className, classNames, ...props }) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"data-slot": "dialog-close",
|
|
45
|
-
children: [
|
|
46
|
-
/*#__PURE__*/ jsx(XIcon, {
|
|
47
|
-
className: "size-4"
|
|
48
|
-
}),
|
|
49
|
-
/*#__PURE__*/ jsx("span", {
|
|
50
|
-
className: "sr-only",
|
|
51
|
-
children: "Close"
|
|
52
|
-
})
|
|
53
|
-
]
|
|
54
|
-
})
|
|
55
|
-
]
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
]
|
|
59
|
-
});
|
|
21
|
+
return /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [/* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
|
|
22
|
+
className: cn("fixed inset-0 z-50 bg-black/50 ease-ui data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", classNames?.overlay),
|
|
23
|
+
"data-slot": "dialog-overlay"
|
|
24
|
+
}), /* @__PURE__ */ jsx(DialogPrimitive.Content, {
|
|
25
|
+
className: cn("fixed inset-0 z-50 grid grid-rows-[1fr_auto] justify-items-center overflow-auto ease-ui data-[state=closed]:animate-out data-[state=open]:animate-in max-sm:data-[state=closed]:animation-duration-500 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=open]:animation-duration-500 max-sm:data-[state=open]:slide-in-from-bottom sm:grid-rows-[1fr_auto_3fr] sm:p-4 sm:data-[state=closed]:fade-out-0 sm:data-[state=closed]:zoom-out-95 sm:data-[state=open]:fade-in-0 sm:data-[state=open]:zoom-in-95", classNames?.wrapper),
|
|
26
|
+
"data-slot": "dialog-content-wrapper",
|
|
27
|
+
...props,
|
|
28
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: cn("relative row-start-2 flex w-full flex-col rounded-t-2xl border bg-popover text-popover-foreground shadow-lg sm:max-w-lg sm:rounded-2xl", classNames?.content, className),
|
|
30
|
+
"data-slot": "dialog-content",
|
|
31
|
+
children: [children, /* @__PURE__ */ jsxs(DialogPrimitive.Close, {
|
|
32
|
+
className: buttonVariants({
|
|
33
|
+
className: ["absolute top-2.5 right-2.5 size-7", classNames?.close],
|
|
34
|
+
size: "icon",
|
|
35
|
+
variant: "ghost"
|
|
36
|
+
}),
|
|
37
|
+
"data-slot": "dialog-close",
|
|
38
|
+
children: [/* @__PURE__ */ jsx(XIcon, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: "sr-only",
|
|
40
|
+
children: "Close"
|
|
41
|
+
})]
|
|
42
|
+
})]
|
|
43
|
+
})
|
|
44
|
+
})] });
|
|
60
45
|
}
|
|
61
46
|
function DialogHeader({ className, ...props }) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
47
|
+
return /* @__PURE__ */ jsx("header", {
|
|
48
|
+
className: cn("flex shrink-0 flex-col gap-1.5 px-6 pt-6 pb-2 text-center sm:text-left", className),
|
|
49
|
+
"data-slot": "dialog-header",
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
67
52
|
}
|
|
68
53
|
function DialogBody({ className, ...props }) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
54
|
+
return /* @__PURE__ */ jsx("main", {
|
|
55
|
+
className: cn("overflow-auto px-6 py-2", className),
|
|
56
|
+
"data-slot": "dialog-body",
|
|
57
|
+
...props
|
|
58
|
+
});
|
|
74
59
|
}
|
|
75
60
|
function DialogFooter({ className, ...props }) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
61
|
+
return /* @__PURE__ */ jsx("footer", {
|
|
62
|
+
className: cn("flex shrink-0 flex-col-reverse gap-2 px-6 pt-2 pb-6 sm:flex-row sm:justify-end", className),
|
|
63
|
+
"data-slot": "dialog-footer",
|
|
64
|
+
...props
|
|
65
|
+
});
|
|
81
66
|
}
|
|
82
67
|
function DialogTitle({ className, ...props }) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
68
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Title, {
|
|
69
|
+
className: cn("text-lg leading-none font-semibold tracking-tight", className),
|
|
70
|
+
"data-slot": "dialog-title",
|
|
71
|
+
...props
|
|
72
|
+
});
|
|
88
73
|
}
|
|
89
74
|
function DialogDescription({ className, ...props }) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
75
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Description, {
|
|
76
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
77
|
+
"data-slot": "dialog-description",
|
|
78
|
+
...props
|
|
79
|
+
});
|
|
95
80
|
}
|
|
96
81
|
function DialogClose({ className, size, variant = "outline", ...props }) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
82
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Close, {
|
|
83
|
+
className: buttonVariants({
|
|
84
|
+
className,
|
|
85
|
+
size,
|
|
86
|
+
variant
|
|
87
|
+
}),
|
|
88
|
+
"data-slot": "dialog-close",
|
|
89
|
+
...props
|
|
90
|
+
});
|
|
106
91
|
}
|
|
92
|
+
//#endregion
|
|
107
93
|
export { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger };
|
|
@@ -1,33 +1,65 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
type
|
|
8
|
-
declare function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { buttonVariants } from "./button.js";
|
|
2
|
+
import { VariantProps } from "@codefast/tailwind-variants";
|
|
3
|
+
import { ComponentProps, JSX } from "react";
|
|
4
|
+
import { Drawer as Drawer$1 } from "vaul";
|
|
5
|
+
|
|
6
|
+
//#region src/components/drawer.d.ts
|
|
7
|
+
type DrawerProps = ComponentProps<typeof Drawer$1.Root>;
|
|
8
|
+
declare function Drawer({
|
|
9
|
+
shouldScaleBackground,
|
|
10
|
+
...props
|
|
11
|
+
}: DrawerProps): JSX.Element;
|
|
12
|
+
type DrawerTriggerProps = ComponentProps<typeof Drawer$1.Trigger>;
|
|
13
|
+
declare function DrawerTrigger({
|
|
14
|
+
...props
|
|
15
|
+
}: DrawerTriggerProps): JSX.Element;
|
|
16
|
+
interface DrawerContentProps extends ComponentProps<typeof Drawer$1.Content> {
|
|
17
|
+
classNames?: {
|
|
18
|
+
content?: string;
|
|
19
|
+
handle?: string;
|
|
20
|
+
overlay?: string;
|
|
21
|
+
};
|
|
15
22
|
}
|
|
16
|
-
declare function DrawerContent({
|
|
23
|
+
declare function DrawerContent({
|
|
24
|
+
children,
|
|
25
|
+
className,
|
|
26
|
+
classNames,
|
|
27
|
+
...props
|
|
28
|
+
}: DrawerContentProps): JSX.Element;
|
|
17
29
|
type DrawerHeaderProps = ComponentProps<"div">;
|
|
18
|
-
declare function DrawerHeader({
|
|
30
|
+
declare function DrawerHeader({
|
|
31
|
+
className,
|
|
32
|
+
...props
|
|
33
|
+
}: DrawerHeaderProps): JSX.Element;
|
|
19
34
|
type DrawerBodyProps = ComponentProps<"div">;
|
|
20
|
-
declare function DrawerBody({
|
|
35
|
+
declare function DrawerBody({
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: DrawerBodyProps): JSX.Element;
|
|
21
39
|
type DrawerFooterProps = ComponentProps<"div">;
|
|
22
|
-
declare function DrawerFooter({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
declare function DrawerFooter({
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}: DrawerFooterProps): JSX.Element;
|
|
44
|
+
type DrawerTitleProps = ComponentProps<typeof Drawer$1.Title>;
|
|
45
|
+
declare function DrawerTitle({
|
|
46
|
+
className,
|
|
47
|
+
...props
|
|
48
|
+
}: DrawerTitleProps): JSX.Element;
|
|
49
|
+
type DrawerDescriptionProps = ComponentProps<typeof Drawer$1.Description>;
|
|
50
|
+
declare function DrawerDescription({
|
|
51
|
+
className,
|
|
52
|
+
...props
|
|
53
|
+
}: DrawerDescriptionProps): JSX.Element;
|
|
54
|
+
interface DrawerCloseProps extends ComponentProps<typeof Drawer$1.Close> {
|
|
55
|
+
size?: VariantProps<typeof buttonVariants>["size"];
|
|
56
|
+
variant?: VariantProps<typeof buttonVariants>["variant"];
|
|
30
57
|
}
|
|
31
|
-
declare function DrawerClose({
|
|
32
|
-
|
|
33
|
-
|
|
58
|
+
declare function DrawerClose({
|
|
59
|
+
className,
|
|
60
|
+
size,
|
|
61
|
+
variant,
|
|
62
|
+
...props
|
|
63
|
+
}: DrawerCloseProps): JSX.Element;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { Drawer, DrawerBody, type DrawerBodyProps, DrawerClose, type DrawerCloseProps, DrawerContent, type DrawerContentProps, DrawerDescription, type DrawerDescriptionProps, DrawerFooter, type DrawerFooterProps, DrawerHeader, type DrawerHeaderProps, type DrawerProps, DrawerTitle, type DrawerTitleProps, DrawerTrigger, type DrawerTriggerProps };
|