@codefast/ui 0.3.16-canary.1 → 0.3.16-canary.3
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 +30 -0
- package/README.md +1 -1
- package/dist/components/accordion.mjs +2 -2
- package/dist/components/alert-dialog.d.mts +1 -1
- package/dist/components/alert-dialog.mjs +4 -4
- package/dist/components/alert.d.mts +3 -13
- package/dist/components/alert.mjs +3 -23
- package/dist/components/badge.d.mts +3 -15
- package/dist/components/badge.mjs +2 -44
- package/dist/components/breadcrumb.mjs +1 -1
- package/dist/components/button-group.d.mts +3 -13
- package/dist/components/button-group.mjs +3 -24
- package/dist/components/button.d.mts +3 -25
- package/dist/components/button.mjs +2 -72
- package/dist/components/calendar.mjs +2 -1
- package/dist/components/carousel.d.mts +1 -2
- package/dist/components/chart.d.mts +2 -4
- package/dist/components/checkbox.mjs +2 -2
- package/dist/components/context-menu.mjs +2 -2
- package/dist/components/dialog.d.mts +1 -1
- package/dist/components/dialog.mjs +4 -4
- package/dist/components/drawer.d.mts +1 -1
- package/dist/components/drawer.mjs +2 -2
- package/dist/components/dropdown-menu.mjs +2 -2
- package/dist/components/empty.d.mts +3 -13
- package/dist/components/empty.mjs +3 -18
- package/dist/components/field.d.mts +3 -14
- package/dist/components/field.mjs +3 -32
- package/dist/components/form.d.mts +2 -4
- package/dist/components/hover-card.mjs +1 -1
- package/dist/components/input-group.d.mts +4 -31
- package/dist/components/input-group.mjs +3 -90
- package/dist/components/input-number.mjs +4 -4
- package/dist/components/input-otp.mjs +2 -2
- package/dist/components/input.mjs +1 -1
- package/dist/components/item.d.mts +4 -29
- package/dist/components/item.mjs +3 -56
- package/dist/components/menubar.mjs +2 -2
- package/dist/components/native-select.mjs +1 -1
- package/dist/components/navigation-menu.d.mts +1 -6
- package/dist/components/navigation-menu.mjs +8 -15
- package/dist/components/pagination.d.mts +1 -1
- package/dist/components/pagination.mjs +1 -1
- package/dist/components/popover.mjs +1 -1
- package/dist/components/progress-circle.d.mts +3 -47
- package/dist/components/progress-circle.mjs +2 -47
- package/dist/components/progress.mjs +1 -1
- package/dist/components/radio-group.mjs +1 -1
- package/dist/components/radio.mjs +1 -1
- package/dist/components/scroll-area.d.mts +3 -19
- package/dist/components/scroll-area.mjs +4 -61
- package/dist/components/select.d.mts +1 -1
- package/dist/components/select.mjs +3 -3
- package/dist/components/separator.d.mts +3 -18
- package/dist/components/separator.mjs +3 -23
- package/dist/components/sheet.d.mts +6 -18
- package/dist/components/sheet.mjs +6 -49
- package/dist/components/sidebar.d.mts +4 -19
- package/dist/components/sidebar.mjs +10 -46
- package/dist/components/skeleton.mjs +1 -1
- package/dist/components/slider.mjs +1 -1
- package/dist/components/spinner.mjs +1 -1
- package/dist/components/switch.mjs +2 -2
- package/dist/components/table.mjs +1 -1
- package/dist/components/tabs.mjs +1 -1
- package/dist/components/textarea.mjs +1 -1
- package/dist/components/toggle-group.d.mts +3 -2
- package/dist/components/toggle-group.mjs +1 -1
- package/dist/components/toggle.d.mts +2 -21
- package/dist/components/toggle.mjs +2 -39
- package/dist/components/tooltip.mjs +1 -1
- package/dist/index.d.mts +31 -16
- package/dist/index.mjs +30 -15
- package/dist/lib/utils.d.mts +1 -12
- package/dist/lib/utils.mjs +1 -9
- package/dist/primitives/checkbox-group.d.mts +1 -2
- package/dist/primitives/input-number.d.mts +1 -2
- package/dist/primitives/input.d.mts +1 -2
- package/dist/primitives/progress-circle.d.mts +1 -2
- package/dist/variants/alert.d.mts +18 -0
- package/dist/variants/alert.mjs +25 -0
- package/dist/variants/badge.d.mts +20 -0
- package/dist/variants/badge.mjs +46 -0
- package/dist/variants/button-group.d.mts +18 -0
- package/dist/variants/button-group.mjs +26 -0
- package/dist/variants/button.d.mts +30 -0
- package/dist/variants/button.mjs +76 -0
- package/dist/variants/empty.d.mts +18 -0
- package/dist/variants/empty.mjs +20 -0
- package/dist/variants/field.d.mts +19 -0
- package/dist/variants/field.mjs +34 -0
- package/dist/variants/input-group.d.mts +43 -0
- package/dist/variants/input-group.mjs +93 -0
- package/dist/variants/item.d.mts +37 -0
- package/dist/variants/item.mjs +60 -0
- package/dist/variants/navigation-menu.d.mts +13 -0
- package/dist/variants/navigation-menu.mjs +12 -0
- package/dist/variants/progress-circle.d.mts +52 -0
- package/dist/variants/progress-circle.mjs +49 -0
- package/dist/variants/scroll-area.d.mts +24 -0
- package/dist/variants/scroll-area.mjs +63 -0
- package/dist/variants/separator.d.mts +23 -0
- package/dist/variants/separator.mjs +25 -0
- package/dist/variants/sheet.d.mts +20 -0
- package/dist/variants/sheet.mjs +50 -0
- package/dist/variants/sidebar.d.mts +23 -0
- package/dist/variants/sidebar.mjs +42 -0
- package/dist/variants/toggle.d.mts +23 -0
- package/dist/variants/toggle.mjs +43 -0
- package/package.json +169 -21
- package/src/components/accordion.tsx +156 -0
- package/src/components/alert-dialog.tsx +314 -0
- package/src/components/alert.tsx +86 -0
- package/src/components/aspect-ratio.tsx +28 -0
- package/src/components/avatar.tsx +84 -0
- package/src/components/badge.tsx +38 -0
- package/src/components/breadcrumb.tsx +197 -0
- package/src/components/button-group.tsx +107 -0
- package/src/components/button.tsx +66 -0
- package/src/components/calendar.tsx +277 -0
- package/src/components/card.tsx +175 -0
- package/src/components/carousel.tsx +367 -0
- package/src/components/chart.tsx +587 -0
- package/src/components/checkbox-cards.tsx +92 -0
- package/src/components/checkbox-group.tsx +83 -0
- package/src/components/checkbox.tsx +65 -0
- package/src/components/collapsible.tsx +60 -0
- package/src/components/command.tsx +311 -0
- package/src/components/context-menu.tsx +489 -0
- package/src/components/dialog.tsx +295 -0
- package/src/components/drawer.tsx +271 -0
- package/src/components/dropdown-menu.tsx +498 -0
- package/src/components/empty.tsx +169 -0
- package/src/components/field.tsx +362 -0
- package/src/components/form.tsx +300 -0
- package/src/components/hover-card.tsx +116 -0
- package/src/components/input-group.tsx +224 -0
- package/src/components/input-number.tsx +161 -0
- package/src/components/input-otp.tsx +151 -0
- package/src/components/input-password.tsx +74 -0
- package/src/components/input-search.tsx +98 -0
- package/src/components/input.tsx +52 -0
- package/src/components/item.tsx +280 -0
- package/src/components/kbd.tsx +59 -0
- package/src/components/label.tsx +44 -0
- package/src/components/menubar.tsx +531 -0
- package/src/components/native-select.tsx +96 -0
- package/src/components/navigation-menu.tsx +295 -0
- package/src/components/pagination.tsx +204 -0
- package/src/components/popover.tsx +139 -0
- package/src/components/progress-circle.tsx +203 -0
- package/src/components/progress.tsx +54 -0
- package/src/components/radio-cards.tsx +85 -0
- package/src/components/radio-group.tsx +79 -0
- package/src/components/radio.tsx +61 -0
- package/src/components/resizable.tsx +99 -0
- package/src/components/scroll-area.tsx +115 -0
- package/src/components/select.tsx +319 -0
- package/src/components/separator.tsx +74 -0
- package/src/components/sheet.tsx +278 -0
- package/src/components/sidebar.tsx +1056 -0
- package/src/components/skeleton.tsx +37 -0
- package/src/components/slider.tsx +95 -0
- package/src/components/sonner.tsx +47 -0
- package/src/components/spinner.tsx +75 -0
- package/src/components/switch.tsx +66 -0
- package/src/components/table.tsx +200 -0
- package/src/components/tabs.tsx +128 -0
- package/src/components/textarea.tsx +49 -0
- package/src/components/toggle-group.tsx +141 -0
- package/src/components/toggle.tsx +39 -0
- package/src/components/tooltip.tsx +141 -0
- package/src/css/amber.css +59 -22
- package/src/css/blue.css +59 -22
- package/src/css/cyan.css +59 -22
- package/src/css/emerald.css +59 -22
- package/src/css/fuchsia.css +59 -22
- package/src/css/gray.css +59 -22
- package/src/css/green.css +59 -22
- package/src/css/indigo.css +59 -22
- package/src/css/lime.css +59 -22
- package/src/css/neutral.css +59 -22
- package/src/css/orange.css +59 -22
- package/src/css/pink.css +59 -22
- package/src/css/preset.css +32 -13
- package/src/css/purple.css +59 -22
- package/src/css/red.css +59 -22
- package/src/css/rose.css +59 -22
- package/src/css/sky.css +59 -22
- package/src/css/slate.css +59 -22
- package/src/css/stone.css +59 -22
- package/src/css/teal.css +59 -22
- package/src/css/violet.css +59 -22
- package/src/css/yellow.css +59 -22
- package/src/css/zinc.css +59 -22
- package/src/hooks/use-animated-value.ts +97 -0
- package/src/hooks/use-copy-to-clipboard.ts +63 -0
- package/src/hooks/use-is-mobile.ts +27 -0
- package/src/hooks/use-media-query.ts +71 -0
- package/src/hooks/use-mutation-observer.ts +54 -0
- package/src/hooks/use-pagination.ts +166 -0
- package/src/index.ts +720 -0
- package/src/lib/utils.ts +5 -0
- package/src/primitives/checkbox-group.tsx +360 -0
- package/src/primitives/input-number.tsx +1013 -0
- package/src/primitives/input.tsx +243 -0
- package/src/primitives/progress-circle.tsx +537 -0
- package/src/variants/alert.ts +45 -0
- package/src/variants/badge.ts +66 -0
- package/src/variants/button-group.ts +49 -0
- package/src/variants/button.ts +93 -0
- package/src/variants/empty.ts +43 -0
- package/src/variants/field.ts +50 -0
- package/src/variants/input-group.ts +132 -0
- package/src/variants/item.ts +90 -0
- package/src/variants/navigation-menu.ts +32 -0
- package/src/variants/progress-circle.ts +47 -0
- package/src/variants/scroll-area.ts +79 -0
- package/src/variants/separator.ts +41 -0
- package/src/variants/sheet.ts +70 -0
- package/src/variants/sidebar.ts +61 -0
- package/src/variants/toggle.ts +59 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, JSX } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "#/lib/utils";
|
|
6
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
7
|
+
import { CheckIcon, ChevronRightIcon, DotIcon } from "lucide-react";
|
|
8
|
+
|
|
9
|
+
/* -----------------------------------------------------------------------------
|
|
10
|
+
* Component: DropdownMenu
|
|
11
|
+
* -------------------------------------------------------------------------- */
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @since 0.3.16-canary.0
|
|
15
|
+
*/
|
|
16
|
+
type DropdownMenuProps = ComponentProps<typeof DropdownMenuPrimitive.Root>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @since 0.3.16-canary.0
|
|
20
|
+
*/
|
|
21
|
+
function DropdownMenu({ ...props }: DropdownMenuProps): JSX.Element {
|
|
22
|
+
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* -----------------------------------------------------------------------------
|
|
26
|
+
* Component: DropdownMenuTrigger
|
|
27
|
+
* -------------------------------------------------------------------------- */
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @since 0.3.16-canary.0
|
|
31
|
+
*/
|
|
32
|
+
type DropdownMenuTriggerProps = ComponentProps<typeof DropdownMenuPrimitive.Trigger>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @since 0.3.16-canary.0
|
|
36
|
+
*/
|
|
37
|
+
function DropdownMenuTrigger({ ...props }: DropdownMenuTriggerProps): JSX.Element {
|
|
38
|
+
return <DropdownMenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* -----------------------------------------------------------------------------
|
|
42
|
+
* Component: DropdownMenuGroup
|
|
43
|
+
* -------------------------------------------------------------------------- */
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @since 0.3.16-canary.0
|
|
47
|
+
*/
|
|
48
|
+
type DropdownMenuGroupProps = ComponentProps<typeof DropdownMenuPrimitive.Group>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @since 0.3.16-canary.0
|
|
52
|
+
*/
|
|
53
|
+
function DropdownMenuGroup({ ...props }: DropdownMenuGroupProps): JSX.Element {
|
|
54
|
+
return <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* -----------------------------------------------------------------------------
|
|
58
|
+
* Component: DropdownMenuSub
|
|
59
|
+
* -------------------------------------------------------------------------- */
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @since 0.3.16-canary.0
|
|
63
|
+
*/
|
|
64
|
+
type DropdownMenuSubProps = ComponentProps<typeof DropdownMenuPrimitive.Sub>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @since 0.3.16-canary.0
|
|
68
|
+
*/
|
|
69
|
+
function DropdownMenuSub({ ...props }: DropdownMenuSubProps): JSX.Element {
|
|
70
|
+
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* -----------------------------------------------------------------------------
|
|
74
|
+
* Component: DropdownMenuSubTrigger
|
|
75
|
+
* -------------------------------------------------------------------------- */
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @since 0.3.16-canary.0
|
|
79
|
+
*/
|
|
80
|
+
type DropdownMenuRadioGroupProps = ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @since 0.3.16-canary.0
|
|
84
|
+
*/
|
|
85
|
+
function DropdownMenuRadioGroup({ ...props }: DropdownMenuRadioGroupProps): JSX.Element {
|
|
86
|
+
return <DropdownMenuPrimitive.RadioGroup data-slot="dropdown-menu-radio-group" {...props} />;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* -----------------------------------------------------------------------------
|
|
90
|
+
* Component: DropdownMenuSubTrigger
|
|
91
|
+
* -------------------------------------------------------------------------- */
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @since 0.3.16-canary.0
|
|
95
|
+
*/
|
|
96
|
+
interface DropdownMenuSubTriggerProps extends ComponentProps<
|
|
97
|
+
typeof DropdownMenuPrimitive.SubTrigger
|
|
98
|
+
> {
|
|
99
|
+
inset?: boolean;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @since 0.3.16-canary.0
|
|
104
|
+
*/
|
|
105
|
+
function DropdownMenuSubTrigger({
|
|
106
|
+
children,
|
|
107
|
+
className,
|
|
108
|
+
inset,
|
|
109
|
+
...props
|
|
110
|
+
}: DropdownMenuSubTriggerProps): JSX.Element {
|
|
111
|
+
return (
|
|
112
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
113
|
+
className={cn(
|
|
114
|
+
"flex items-center gap-x-2",
|
|
115
|
+
"px-2 py-1.5",
|
|
116
|
+
"rounded-sm outline-hidden",
|
|
117
|
+
"text-sm",
|
|
118
|
+
"cursor-default select-none",
|
|
119
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
120
|
+
"data-inset:pl-8",
|
|
121
|
+
"data-open:bg-accent data-open:text-accent-foreground",
|
|
122
|
+
className,
|
|
123
|
+
)}
|
|
124
|
+
data-inset={inset}
|
|
125
|
+
data-slot="dropdown-menu-sub-trigger"
|
|
126
|
+
{...props}
|
|
127
|
+
>
|
|
128
|
+
{children}
|
|
129
|
+
<ChevronRightIcon className={cn("size-4", "ml-auto")} />
|
|
130
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* -----------------------------------------------------------------------------
|
|
135
|
+
* Component: DropdownMenuSubContent
|
|
136
|
+
* -------------------------------------------------------------------------- */
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @since 0.3.16-canary.0
|
|
140
|
+
*/
|
|
141
|
+
type DropdownMenuSubContentProps = ComponentProps<typeof DropdownMenuPrimitive.SubContent>;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @since 0.3.16-canary.0
|
|
145
|
+
*/
|
|
146
|
+
function DropdownMenuSubContent({ className, ...props }: DropdownMenuSubContentProps): JSX.Element {
|
|
147
|
+
return (
|
|
148
|
+
<DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal">
|
|
149
|
+
<DropdownMenuPrimitive.SubContent
|
|
150
|
+
className={cn(
|
|
151
|
+
"z-50",
|
|
152
|
+
"min-w-32 overflow-hidden p-1",
|
|
153
|
+
"rounded-lg border",
|
|
154
|
+
"bg-popover text-popover-foreground shadow-lg",
|
|
155
|
+
"ease-snappy data-open:animate-in data-open:duration-200 data-open:fade-in-0 data-open:zoom-in-95",
|
|
156
|
+
"data-open:data-side-top:slide-in-from-bottom-2",
|
|
157
|
+
"data-open:data-side-right:slide-in-from-left-2",
|
|
158
|
+
"data-open:data-side-bottom:slide-in-from-top-2",
|
|
159
|
+
"data-open:data-side-left:slide-in-from-right-2",
|
|
160
|
+
"data-closed:animate-out data-closed:duration-150 data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
161
|
+
"data-closed:data-side-top:slide-out-to-bottom-2",
|
|
162
|
+
"data-closed:data-side-right:slide-out-to-left-2",
|
|
163
|
+
"data-closed:data-side-bottom:slide-out-to-top-2",
|
|
164
|
+
"data-closed:data-side-left:slide-out-to-right-2",
|
|
165
|
+
"motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0",
|
|
166
|
+
"origin-(--radix-dropdown-menu-content-transform-origin)",
|
|
167
|
+
className,
|
|
168
|
+
)}
|
|
169
|
+
data-slot="dropdown-menu-sub-content"
|
|
170
|
+
{...props}
|
|
171
|
+
/>
|
|
172
|
+
</DropdownMenuPrimitive.Portal>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* -----------------------------------------------------------------------------
|
|
177
|
+
* Component: DropdownMenuContent
|
|
178
|
+
* -------------------------------------------------------------------------- */
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @since 0.3.16-canary.0
|
|
182
|
+
*/
|
|
183
|
+
type DropdownMenuContentProps = ComponentProps<typeof DropdownMenuPrimitive.Content>;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @since 0.3.16-canary.0
|
|
187
|
+
*/
|
|
188
|
+
function DropdownMenuContent({
|
|
189
|
+
className,
|
|
190
|
+
sideOffset = 4,
|
|
191
|
+
...props
|
|
192
|
+
}: DropdownMenuContentProps): JSX.Element {
|
|
193
|
+
return (
|
|
194
|
+
<DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal">
|
|
195
|
+
<DropdownMenuPrimitive.Content
|
|
196
|
+
className={cn(
|
|
197
|
+
"z-50",
|
|
198
|
+
"max-h-(--radix-dropdown-menu-content-available-height) min-w-32 overflow-x-hidden overflow-y-auto p-1",
|
|
199
|
+
"rounded-lg border",
|
|
200
|
+
"bg-popover text-popover-foreground shadow-lg",
|
|
201
|
+
"ease-snappy data-open:animate-in data-open:duration-200 data-open:fade-in-0 data-open:zoom-in-95",
|
|
202
|
+
"data-open:data-side-top:slide-in-from-bottom-2",
|
|
203
|
+
"data-open:data-side-right:slide-in-from-left-2",
|
|
204
|
+
"data-open:data-side-bottom:slide-in-from-top-2",
|
|
205
|
+
"data-open:data-side-left:slide-in-from-right-2",
|
|
206
|
+
"data-closed:animate-out data-closed:duration-150 data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
207
|
+
"data-closed:data-side-top:slide-out-to-bottom-2",
|
|
208
|
+
"data-closed:data-side-right:slide-out-to-left-2",
|
|
209
|
+
"data-closed:data-side-bottom:slide-out-to-top-2",
|
|
210
|
+
"data-closed:data-side-left:slide-out-to-right-2",
|
|
211
|
+
"motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0",
|
|
212
|
+
"origin-(--radix-dropdown-menu-content-transform-origin)",
|
|
213
|
+
className,
|
|
214
|
+
)}
|
|
215
|
+
data-slot="dropdown-menu-content"
|
|
216
|
+
sideOffset={sideOffset}
|
|
217
|
+
{...props}
|
|
218
|
+
/>
|
|
219
|
+
</DropdownMenuPrimitive.Portal>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* -----------------------------------------------------------------------------
|
|
224
|
+
* Component: DropdownMenuItem
|
|
225
|
+
* -------------------------------------------------------------------------- */
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* @since 0.3.16-canary.0
|
|
229
|
+
*/
|
|
230
|
+
interface DropdownMenuItemProps extends ComponentProps<typeof DropdownMenuPrimitive.Item> {
|
|
231
|
+
inset?: boolean;
|
|
232
|
+
variant?: "default" | "destructive";
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @since 0.3.16-canary.0
|
|
237
|
+
*/
|
|
238
|
+
function DropdownMenuItem({
|
|
239
|
+
className,
|
|
240
|
+
inset,
|
|
241
|
+
variant,
|
|
242
|
+
...props
|
|
243
|
+
}: DropdownMenuItemProps): JSX.Element {
|
|
244
|
+
return (
|
|
245
|
+
<DropdownMenuPrimitive.Item
|
|
246
|
+
className={cn(
|
|
247
|
+
"group/dropdown-menu-item relative flex items-center gap-x-2",
|
|
248
|
+
"px-2 py-1.5",
|
|
249
|
+
"rounded-sm outline-hidden",
|
|
250
|
+
"text-sm",
|
|
251
|
+
"cursor-default select-none",
|
|
252
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
253
|
+
"aria-disabled:opacity-50",
|
|
254
|
+
"data-inset:pl-8",
|
|
255
|
+
"data-[variant=destructive]:text-destructive",
|
|
256
|
+
"data-[variant=destructive]:focus:bg-destructive/10",
|
|
257
|
+
"dark:data-[variant=destructive]:focus:bg-destructive/20",
|
|
258
|
+
"data-[variant=destructive]:[&_svg:not([class*='text-'])]:text-destructive/80",
|
|
259
|
+
"[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
260
|
+
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
261
|
+
className,
|
|
262
|
+
)}
|
|
263
|
+
data-inset={inset}
|
|
264
|
+
data-slot="dropdown-menu-item"
|
|
265
|
+
data-variant={variant}
|
|
266
|
+
{...props}
|
|
267
|
+
/>
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/* -----------------------------------------------------------------------------
|
|
272
|
+
* Component: DropdownMenuCheckboxItem
|
|
273
|
+
* -------------------------------------------------------------------------- */
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* @since 0.3.16-canary.0
|
|
277
|
+
*/
|
|
278
|
+
type DropdownMenuCheckboxItemProps = ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @since 0.3.16-canary.0
|
|
282
|
+
*/
|
|
283
|
+
function DropdownMenuCheckboxItem({
|
|
284
|
+
checked,
|
|
285
|
+
children,
|
|
286
|
+
className,
|
|
287
|
+
...props
|
|
288
|
+
}: DropdownMenuCheckboxItemProps): JSX.Element {
|
|
289
|
+
return (
|
|
290
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
291
|
+
checked={checked}
|
|
292
|
+
className={cn(
|
|
293
|
+
"group/dropdown-menu-item relative flex items-center gap-x-2",
|
|
294
|
+
"py-1.5 pr-2 pl-8",
|
|
295
|
+
"rounded-sm outline-hidden",
|
|
296
|
+
"text-sm",
|
|
297
|
+
"cursor-default select-none",
|
|
298
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
299
|
+
"aria-disabled:opacity-50",
|
|
300
|
+
"[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
301
|
+
className,
|
|
302
|
+
)}
|
|
303
|
+
data-slot="dropdown-menu-checkbox-item"
|
|
304
|
+
{...props}
|
|
305
|
+
>
|
|
306
|
+
<span className={cn("absolute flex items-center justify-center", "left-2")}>
|
|
307
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
308
|
+
<CheckIcon className="size-4" />
|
|
309
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
310
|
+
</span>
|
|
311
|
+
{children}
|
|
312
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/* -----------------------------------------------------------------------------
|
|
317
|
+
* Component: DropdownMenuRadioItem
|
|
318
|
+
* -------------------------------------------------------------------------- */
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* @since 0.3.16-canary.0
|
|
322
|
+
*/
|
|
323
|
+
type DropdownMenuRadioItemProps = ComponentProps<typeof DropdownMenuPrimitive.RadioItem>;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* @since 0.3.16-canary.0
|
|
327
|
+
*/
|
|
328
|
+
function DropdownMenuRadioItem({
|
|
329
|
+
children,
|
|
330
|
+
className,
|
|
331
|
+
...props
|
|
332
|
+
}: DropdownMenuRadioItemProps): JSX.Element {
|
|
333
|
+
return (
|
|
334
|
+
<DropdownMenuPrimitive.RadioItem
|
|
335
|
+
className={cn(
|
|
336
|
+
"group/dropdown-menu-item relative flex items-center gap-x-2",
|
|
337
|
+
"py-1.5 pr-2 pl-8",
|
|
338
|
+
"rounded-sm outline-hidden",
|
|
339
|
+
"text-sm",
|
|
340
|
+
"cursor-default select-none",
|
|
341
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
342
|
+
"aria-disabled:opacity-50",
|
|
343
|
+
"[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
344
|
+
className,
|
|
345
|
+
)}
|
|
346
|
+
data-slot="dropdown-menu-radio-item"
|
|
347
|
+
{...props}
|
|
348
|
+
>
|
|
349
|
+
<span className={cn("absolute flex items-center justify-center", "left-2")}>
|
|
350
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
351
|
+
<DotIcon className={cn("size-4", "fill-current")} />
|
|
352
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
353
|
+
</span>
|
|
354
|
+
{children}
|
|
355
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/* -----------------------------------------------------------------------------
|
|
360
|
+
* Component: DropdownMenuLabel
|
|
361
|
+
* -------------------------------------------------------------------------- */
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* @since 0.3.16-canary.0
|
|
365
|
+
*/
|
|
366
|
+
interface DropdownMenuLabelProps extends ComponentProps<typeof DropdownMenuPrimitive.Label> {
|
|
367
|
+
inset?: boolean;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* @since 0.3.16-canary.0
|
|
372
|
+
*/
|
|
373
|
+
function DropdownMenuLabel({ className, inset, ...props }: DropdownMenuLabelProps): JSX.Element {
|
|
374
|
+
return (
|
|
375
|
+
<DropdownMenuPrimitive.Label
|
|
376
|
+
className={cn(
|
|
377
|
+
"flex items-center gap-x-2",
|
|
378
|
+
"px-2 py-1.5",
|
|
379
|
+
"text-sm font-semibold",
|
|
380
|
+
"data-inset:pl-8",
|
|
381
|
+
className,
|
|
382
|
+
)}
|
|
383
|
+
data-inset={inset}
|
|
384
|
+
data-slot="dropdown-menu-label"
|
|
385
|
+
{...props}
|
|
386
|
+
/>
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/* -----------------------------------------------------------------------------
|
|
391
|
+
* Component: DropdownMenuSeparator
|
|
392
|
+
* -------------------------------------------------------------------------- */
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* @since 0.3.16-canary.0
|
|
396
|
+
*/
|
|
397
|
+
type DropdownMenuSeparatorProps = ComponentProps<typeof DropdownMenuPrimitive.Separator>;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* @since 0.3.16-canary.0
|
|
401
|
+
*/
|
|
402
|
+
function DropdownMenuSeparator({ className, ...props }: DropdownMenuSeparatorProps): JSX.Element {
|
|
403
|
+
return (
|
|
404
|
+
<DropdownMenuPrimitive.Separator
|
|
405
|
+
className={cn("mx-2 my-1 h-px", "bg-border", className)}
|
|
406
|
+
data-slot="dropdown-menu-separator"
|
|
407
|
+
{...props}
|
|
408
|
+
/>
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/* -----------------------------------------------------------------------------
|
|
413
|
+
* Component: DropdownMenuShortcut
|
|
414
|
+
* -------------------------------------------------------------------------- */
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* @since 0.3.16-canary.0
|
|
418
|
+
*/
|
|
419
|
+
type DropdownMenuShortcutProps = ComponentProps<"span">;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* @since 0.3.16-canary.0
|
|
423
|
+
*/
|
|
424
|
+
function DropdownMenuShortcut({ className, ...props }: DropdownMenuShortcutProps): JSX.Element {
|
|
425
|
+
return (
|
|
426
|
+
<span
|
|
427
|
+
className={cn(
|
|
428
|
+
"ml-auto",
|
|
429
|
+
"text-xs tracking-widest text-muted-foreground",
|
|
430
|
+
"group-data-[variant=destructive]/dropdown-menu-item:text-destructive/80",
|
|
431
|
+
className,
|
|
432
|
+
)}
|
|
433
|
+
data-slot="dropdown-menu-shortcut"
|
|
434
|
+
{...props}
|
|
435
|
+
/>
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* -----------------------------------------------------------------------------
|
|
440
|
+
* Component: DropdownMenuArrow
|
|
441
|
+
* -------------------------------------------------------------------------- */
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* @since 0.3.16-canary.0
|
|
445
|
+
*/
|
|
446
|
+
type DropdownMenuArrowProps = ComponentProps<typeof DropdownMenuPrimitive.Arrow>;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* @since 0.3.16-canary.0
|
|
450
|
+
*/
|
|
451
|
+
function DropdownMenuArrow({ className, ...props }: DropdownMenuArrowProps): JSX.Element {
|
|
452
|
+
return (
|
|
453
|
+
<DropdownMenuPrimitive.Arrow
|
|
454
|
+
className={cn("fill-popover", className)}
|
|
455
|
+
data-slot="dropdown-menu-arrow"
|
|
456
|
+
{...props}
|
|
457
|
+
/>
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/* -----------------------------------------------------------------------------
|
|
462
|
+
* Exports
|
|
463
|
+
* -------------------------------------------------------------------------- */
|
|
464
|
+
|
|
465
|
+
export {
|
|
466
|
+
DropdownMenu,
|
|
467
|
+
DropdownMenuArrow,
|
|
468
|
+
DropdownMenuCheckboxItem,
|
|
469
|
+
DropdownMenuContent,
|
|
470
|
+
DropdownMenuGroup,
|
|
471
|
+
DropdownMenuItem,
|
|
472
|
+
DropdownMenuLabel,
|
|
473
|
+
DropdownMenuRadioGroup,
|
|
474
|
+
DropdownMenuRadioItem,
|
|
475
|
+
DropdownMenuSeparator,
|
|
476
|
+
DropdownMenuShortcut,
|
|
477
|
+
DropdownMenuSub,
|
|
478
|
+
DropdownMenuSubContent,
|
|
479
|
+
DropdownMenuSubTrigger,
|
|
480
|
+
DropdownMenuTrigger,
|
|
481
|
+
};
|
|
482
|
+
export type {
|
|
483
|
+
DropdownMenuArrowProps,
|
|
484
|
+
DropdownMenuCheckboxItemProps,
|
|
485
|
+
DropdownMenuContentProps,
|
|
486
|
+
DropdownMenuGroupProps,
|
|
487
|
+
DropdownMenuItemProps,
|
|
488
|
+
DropdownMenuLabelProps,
|
|
489
|
+
DropdownMenuProps,
|
|
490
|
+
DropdownMenuRadioGroupProps,
|
|
491
|
+
DropdownMenuRadioItemProps,
|
|
492
|
+
DropdownMenuSeparatorProps,
|
|
493
|
+
DropdownMenuShortcutProps,
|
|
494
|
+
DropdownMenuSubContentProps,
|
|
495
|
+
DropdownMenuSubProps,
|
|
496
|
+
DropdownMenuSubTriggerProps,
|
|
497
|
+
DropdownMenuTriggerProps,
|
|
498
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { EmptyMediaVariants } from "#/variants/empty";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "#/lib/utils";
|
|
5
|
+
|
|
6
|
+
import { emptyMediaVariants } from "#/variants/empty";
|
|
7
|
+
|
|
8
|
+
/* -----------------------------------------------------------------------------
|
|
9
|
+
* Component: Empty
|
|
10
|
+
* -------------------------------------------------------------------------- */
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @since 0.3.16-canary.0
|
|
14
|
+
*/
|
|
15
|
+
type EmptyProps = ComponentProps<"div">;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @since 0.3.16-canary.0
|
|
19
|
+
*/
|
|
20
|
+
function Empty({ className, ...props }: EmptyProps): JSX.Element {
|
|
21
|
+
return (
|
|
22
|
+
<div
|
|
23
|
+
className={cn(
|
|
24
|
+
"flex min-w-0 flex-1 flex-col items-center justify-center gap-6 p-6",
|
|
25
|
+
"rounded-xl border-dashed",
|
|
26
|
+
"text-center text-balance",
|
|
27
|
+
"md:p-12",
|
|
28
|
+
className,
|
|
29
|
+
)}
|
|
30
|
+
data-slot="empty"
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* -----------------------------------------------------------------------------
|
|
37
|
+
* Component: EmptyHeader
|
|
38
|
+
* -------------------------------------------------------------------------- */
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @since 0.3.16-canary.0
|
|
42
|
+
*/
|
|
43
|
+
type EmptyHeaderProps = ComponentProps<"div">;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @since 0.3.16-canary.0
|
|
47
|
+
*/
|
|
48
|
+
function EmptyHeader({ className, ...props }: EmptyHeaderProps): JSX.Element {
|
|
49
|
+
return (
|
|
50
|
+
<div
|
|
51
|
+
className={cn("flex max-w-sm flex-col items-center gap-2", "text-center", className)}
|
|
52
|
+
data-slot="empty-header"
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* -----------------------------------------------------------------------------
|
|
59
|
+
* Component: EmptyMedia
|
|
60
|
+
* -------------------------------------------------------------------------- */
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @since 0.3.16-canary.0
|
|
64
|
+
*/
|
|
65
|
+
type EmptyMediaProps = ComponentProps<"div"> & EmptyMediaVariants;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @since 0.3.16-canary.0
|
|
69
|
+
*/
|
|
70
|
+
function EmptyMedia({ className, variant = "default", ...props }: EmptyMediaProps): JSX.Element {
|
|
71
|
+
return (
|
|
72
|
+
<div
|
|
73
|
+
className={emptyMediaVariants({ className, variant })}
|
|
74
|
+
data-slot="empty-icon"
|
|
75
|
+
data-variant={variant}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* -----------------------------------------------------------------------------
|
|
82
|
+
* Component: EmptyTitle
|
|
83
|
+
* -------------------------------------------------------------------------- */
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @since 0.3.16-canary.0
|
|
87
|
+
*/
|
|
88
|
+
type EmptyTitleProps = ComponentProps<"div">;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @since 0.3.16-canary.0
|
|
92
|
+
*/
|
|
93
|
+
function EmptyTitle({ className, ...props }: EmptyTitleProps): JSX.Element {
|
|
94
|
+
return (
|
|
95
|
+
<div
|
|
96
|
+
className={cn("text-lg font-medium tracking-tight", className)}
|
|
97
|
+
data-slot="empty-title"
|
|
98
|
+
{...props}
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* -----------------------------------------------------------------------------
|
|
104
|
+
* Component: EmptyDescription
|
|
105
|
+
* -------------------------------------------------------------------------- */
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @since 0.3.16-canary.0
|
|
109
|
+
*/
|
|
110
|
+
type EmptyDescriptionProps = ComponentProps<"p">;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @since 0.3.16-canary.0
|
|
114
|
+
*/
|
|
115
|
+
function EmptyDescription({ className, ...props }: EmptyDescriptionProps): JSX.Element {
|
|
116
|
+
return (
|
|
117
|
+
<p
|
|
118
|
+
className={cn(
|
|
119
|
+
"text-sm/relaxed text-muted-foreground",
|
|
120
|
+
"[&>a]:underline [&>a]:underline-offset-4",
|
|
121
|
+
"[&>a:hover]:text-primary",
|
|
122
|
+
className,
|
|
123
|
+
)}
|
|
124
|
+
data-slot="empty-description"
|
|
125
|
+
{...props}
|
|
126
|
+
/>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* -----------------------------------------------------------------------------
|
|
131
|
+
* Component: EmptyContent
|
|
132
|
+
* -------------------------------------------------------------------------- */
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @since 0.3.16-canary.0
|
|
136
|
+
*/
|
|
137
|
+
type EmptyContentProps = ComponentProps<"div">;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @since 0.3.16-canary.0
|
|
141
|
+
*/
|
|
142
|
+
function EmptyContent({ className, ...props }: EmptyContentProps): JSX.Element {
|
|
143
|
+
return (
|
|
144
|
+
<div
|
|
145
|
+
className={cn(
|
|
146
|
+
"flex w-full max-w-sm min-w-0 flex-col items-center gap-4",
|
|
147
|
+
"text-sm text-balance",
|
|
148
|
+
className,
|
|
149
|
+
)}
|
|
150
|
+
data-slot="empty-content"
|
|
151
|
+
{...props}
|
|
152
|
+
/>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* -----------------------------------------------------------------------------
|
|
157
|
+
* Exports
|
|
158
|
+
* -------------------------------------------------------------------------- */
|
|
159
|
+
|
|
160
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle };
|
|
161
|
+
|
|
162
|
+
export type {
|
|
163
|
+
EmptyContentProps,
|
|
164
|
+
EmptyDescriptionProps,
|
|
165
|
+
EmptyHeaderProps,
|
|
166
|
+
EmptyMediaProps,
|
|
167
|
+
EmptyProps,
|
|
168
|
+
EmptyTitleProps,
|
|
169
|
+
};
|