@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,319 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { VariantProps } from "#/lib/utils";
|
|
4
|
+
import { cn } from "#/lib/utils";
|
|
5
|
+
import type { ComponentProps, JSX } from "react";
|
|
6
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
7
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
8
|
+
|
|
9
|
+
import { buttonVariants } from "#/variants/button";
|
|
10
|
+
|
|
11
|
+
/* -----------------------------------------------------------------------------
|
|
12
|
+
* Component: Select
|
|
13
|
+
* -------------------------------------------------------------------------- */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @since 0.3.16-canary.0
|
|
17
|
+
*/
|
|
18
|
+
type SelectProps = ComponentProps<typeof SelectPrimitive.Root>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @since 0.3.16-canary.0
|
|
22
|
+
*/
|
|
23
|
+
function Select({ ...props }: SelectProps): JSX.Element {
|
|
24
|
+
return <SelectPrimitive.Root data-slot="select" {...props} />;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* -----------------------------------------------------------------------------
|
|
28
|
+
* Component: SelectGroup
|
|
29
|
+
* -------------------------------------------------------------------------- */
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @since 0.3.16-canary.0
|
|
33
|
+
*/
|
|
34
|
+
type SelectGroupProps = ComponentProps<typeof SelectPrimitive.Group>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @since 0.3.16-canary.0
|
|
38
|
+
*/
|
|
39
|
+
function SelectGroup({ ...props }: SelectGroupProps): JSX.Element {
|
|
40
|
+
return <SelectPrimitive.Group data-slot="select-group" {...props} />;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* -----------------------------------------------------------------------------
|
|
44
|
+
* Component: SelectValue
|
|
45
|
+
* -------------------------------------------------------------------------- */
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @since 0.3.16-canary.0
|
|
49
|
+
*/
|
|
50
|
+
type SelectValueProps = ComponentProps<typeof SelectPrimitive.Value>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @since 0.3.16-canary.0
|
|
54
|
+
*/
|
|
55
|
+
function SelectValue({ ...props }: SelectValueProps): JSX.Element {
|
|
56
|
+
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* -----------------------------------------------------------------------------
|
|
60
|
+
* Component: SelectTrigger
|
|
61
|
+
* -------------------------------------------------------------------------- */
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @since 0.3.16-canary.0
|
|
65
|
+
*/
|
|
66
|
+
interface SelectTriggerProps extends ComponentProps<typeof SelectPrimitive.Trigger> {
|
|
67
|
+
size?: VariantProps<typeof buttonVariants>["size"];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @since 0.3.16-canary.0
|
|
72
|
+
*/
|
|
73
|
+
function SelectTrigger({ children, className, size, ...props }: SelectTriggerProps): JSX.Element {
|
|
74
|
+
return (
|
|
75
|
+
<SelectPrimitive.Trigger
|
|
76
|
+
className={buttonVariants({
|
|
77
|
+
className: [
|
|
78
|
+
"[&_svg:not([class*='text-'])]:text-muted-foreground focus:ring-ring/50 focus:border-ring w-fit justify-between px-3 font-normal focus:ring-3 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 *:data-[slot=select-value]:truncate",
|
|
79
|
+
className,
|
|
80
|
+
],
|
|
81
|
+
size,
|
|
82
|
+
variant: "outline",
|
|
83
|
+
})}
|
|
84
|
+
data-size={size}
|
|
85
|
+
data-slot="select-trigger"
|
|
86
|
+
{...props}
|
|
87
|
+
>
|
|
88
|
+
{children}
|
|
89
|
+
<SelectPrimitive.Icon asChild className={cn("size-4 shrink-0", "opacity-50")}>
|
|
90
|
+
<ChevronDownIcon />
|
|
91
|
+
</SelectPrimitive.Icon>
|
|
92
|
+
</SelectPrimitive.Trigger>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* -----------------------------------------------------------------------------
|
|
97
|
+
* Component: SelectScrollUpButton
|
|
98
|
+
* -------------------------------------------------------------------------- */
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @since 0.3.16-canary.0
|
|
102
|
+
*/
|
|
103
|
+
type SelectScrollUpButtonProps = ComponentProps<typeof SelectPrimitive.ScrollUpButton>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @since 0.3.16-canary.0
|
|
107
|
+
*/
|
|
108
|
+
function SelectScrollUpButton({ className, ...props }: SelectScrollUpButtonProps): JSX.Element {
|
|
109
|
+
return (
|
|
110
|
+
<SelectPrimitive.ScrollUpButton
|
|
111
|
+
className={cn("flex items-center justify-center", "py-1", "text-muted-foreground", className)}
|
|
112
|
+
data-slot="select-scroll-up-button"
|
|
113
|
+
{...props}
|
|
114
|
+
>
|
|
115
|
+
<ChevronUpIcon size={16} />
|
|
116
|
+
</SelectPrimitive.ScrollUpButton>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* -----------------------------------------------------------------------------
|
|
121
|
+
* Component: SelectScrollDownButton
|
|
122
|
+
* -------------------------------------------------------------------------- */
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @since 0.3.16-canary.0
|
|
126
|
+
*/
|
|
127
|
+
type SelectScrollDownButtonProps = ComponentProps<typeof SelectPrimitive.ScrollDownButton>;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @since 0.3.16-canary.0
|
|
131
|
+
*/
|
|
132
|
+
function SelectScrollDownButton({ className, ...props }: SelectScrollDownButtonProps): JSX.Element {
|
|
133
|
+
return (
|
|
134
|
+
<SelectPrimitive.ScrollDownButton
|
|
135
|
+
className={cn("flex items-center justify-center", "py-1", "text-muted-foreground", className)}
|
|
136
|
+
data-slot="select-scroll-down-button"
|
|
137
|
+
{...props}
|
|
138
|
+
>
|
|
139
|
+
<ChevronDownIcon size={16} />
|
|
140
|
+
</SelectPrimitive.ScrollDownButton>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* -----------------------------------------------------------------------------
|
|
145
|
+
* Component: SelectContent
|
|
146
|
+
* -------------------------------------------------------------------------- */
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @since 0.3.16-canary.0
|
|
150
|
+
*/
|
|
151
|
+
type SelectContentProps = ComponentProps<typeof SelectPrimitive.Content>;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @since 0.3.16-canary.0
|
|
155
|
+
*/
|
|
156
|
+
function SelectContent({
|
|
157
|
+
children,
|
|
158
|
+
className,
|
|
159
|
+
position = "item-aligned",
|
|
160
|
+
...props
|
|
161
|
+
}: SelectContentProps): JSX.Element {
|
|
162
|
+
return (
|
|
163
|
+
<SelectPrimitive.Portal>
|
|
164
|
+
<SelectPrimitive.Content
|
|
165
|
+
className={cn(
|
|
166
|
+
"relative z-50",
|
|
167
|
+
"max-h-(--radix-select-content-available-height) min-w-32 overflow-hidden",
|
|
168
|
+
"rounded-lg border",
|
|
169
|
+
"bg-popover text-popover-foreground shadow-lg",
|
|
170
|
+
"ease-ui data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",
|
|
171
|
+
"data-open:data-side-top:slide-in-from-bottom-2",
|
|
172
|
+
"data-open:data-side-right:slide-in-from-left-2",
|
|
173
|
+
"data-open:data-side-bottom:slide-in-from-top-2",
|
|
174
|
+
"data-open:data-side-left:slide-in-from-right-2",
|
|
175
|
+
"data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
176
|
+
"data-closed:data-side-top:slide-out-to-bottom-2",
|
|
177
|
+
"data-closed:data-side-right:slide-out-to-left-2",
|
|
178
|
+
"data-closed:data-side-bottom:slide-out-to-top-2",
|
|
179
|
+
"data-closed:data-side-left:slide-out-to-right-2",
|
|
180
|
+
"motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0",
|
|
181
|
+
"origin-(--radix-select-content-transform-origin)",
|
|
182
|
+
position === "popper" &&
|
|
183
|
+
"data-side-top:-translate-y-1 data-side-right:translate-x-1 data-side-bottom:translate-y-1 data-side-left:-translate-x-1",
|
|
184
|
+
className,
|
|
185
|
+
)}
|
|
186
|
+
data-slot="select-content"
|
|
187
|
+
position={position}
|
|
188
|
+
{...props}
|
|
189
|
+
>
|
|
190
|
+
<SelectScrollUpButton />
|
|
191
|
+
<SelectPrimitive.Viewport
|
|
192
|
+
className={cn(
|
|
193
|
+
"p-1",
|
|
194
|
+
position === "popper" &&
|
|
195
|
+
"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1",
|
|
196
|
+
)}
|
|
197
|
+
>
|
|
198
|
+
{children}
|
|
199
|
+
</SelectPrimitive.Viewport>
|
|
200
|
+
<SelectScrollDownButton />
|
|
201
|
+
</SelectPrimitive.Content>
|
|
202
|
+
</SelectPrimitive.Portal>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/* -----------------------------------------------------------------------------
|
|
207
|
+
* Component: SelectLabel
|
|
208
|
+
* -------------------------------------------------------------------------- */
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @since 0.3.16-canary.0
|
|
212
|
+
*/
|
|
213
|
+
type SelectLabelProps = ComponentProps<typeof SelectPrimitive.Label>;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @since 0.3.16-canary.0
|
|
217
|
+
*/
|
|
218
|
+
function SelectLabel({ className, ...props }: SelectLabelProps): JSX.Element {
|
|
219
|
+
return (
|
|
220
|
+
<SelectPrimitive.Label
|
|
221
|
+
className={cn("flex items-center gap-x-2", "px-2 py-1.5", "text-sm font-semibold", className)}
|
|
222
|
+
data-slot="select-label"
|
|
223
|
+
{...props}
|
|
224
|
+
/>
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* -----------------------------------------------------------------------------
|
|
229
|
+
* Component: SelectItem
|
|
230
|
+
* -------------------------------------------------------------------------- */
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @since 0.3.16-canary.0
|
|
234
|
+
*/
|
|
235
|
+
type SelectItemProps = ComponentProps<typeof SelectPrimitive.Item>;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @since 0.3.16-canary.0
|
|
239
|
+
*/
|
|
240
|
+
function SelectItem({ children, className, ...props }: SelectItemProps): JSX.Element {
|
|
241
|
+
return (
|
|
242
|
+
<SelectPrimitive.Item
|
|
243
|
+
className={cn(
|
|
244
|
+
"relative flex w-full items-center py-1.5 pr-8 pl-2",
|
|
245
|
+
"rounded-sm outline-hidden",
|
|
246
|
+
"text-sm",
|
|
247
|
+
"cursor-default select-none",
|
|
248
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
249
|
+
"aria-disabled:opacity-50",
|
|
250
|
+
"data-[variant=destructive]:[&_svg:not([class*='text-'])]:text-destructive/80",
|
|
251
|
+
"*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
252
|
+
"[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
253
|
+
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
254
|
+
className,
|
|
255
|
+
)}
|
|
256
|
+
data-slot="select-item"
|
|
257
|
+
{...props}
|
|
258
|
+
>
|
|
259
|
+
<span className={cn("absolute flex items-center justify-center", "right-2")}>
|
|
260
|
+
<SelectPrimitive.ItemIndicator>
|
|
261
|
+
<CheckIcon className="size-4" />
|
|
262
|
+
</SelectPrimitive.ItemIndicator>
|
|
263
|
+
</span>
|
|
264
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
265
|
+
</SelectPrimitive.Item>
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* -----------------------------------------------------------------------------
|
|
270
|
+
* Component: SelectSeparator
|
|
271
|
+
* -------------------------------------------------------------------------- */
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* @since 0.3.16-canary.0
|
|
275
|
+
*/
|
|
276
|
+
type SelectSeparatorProps = ComponentProps<typeof SelectPrimitive.Separator>;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* @since 0.3.16-canary.0
|
|
280
|
+
*/
|
|
281
|
+
function SelectSeparator({ className, ...props }: SelectSeparatorProps): JSX.Element {
|
|
282
|
+
return (
|
|
283
|
+
<SelectPrimitive.Separator
|
|
284
|
+
className={cn("mx-2 my-1 h-px", "bg-border", className)}
|
|
285
|
+
data-slot="select-separator"
|
|
286
|
+
{...props}
|
|
287
|
+
/>
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/* -----------------------------------------------------------------------------
|
|
292
|
+
* Exports
|
|
293
|
+
* -------------------------------------------------------------------------- */
|
|
294
|
+
|
|
295
|
+
export {
|
|
296
|
+
Select,
|
|
297
|
+
SelectContent,
|
|
298
|
+
SelectGroup,
|
|
299
|
+
SelectItem,
|
|
300
|
+
SelectLabel,
|
|
301
|
+
SelectScrollDownButton,
|
|
302
|
+
SelectScrollUpButton,
|
|
303
|
+
SelectSeparator,
|
|
304
|
+
SelectTrigger,
|
|
305
|
+
SelectValue,
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
export type {
|
|
309
|
+
SelectContentProps,
|
|
310
|
+
SelectGroupProps,
|
|
311
|
+
SelectItemProps,
|
|
312
|
+
SelectLabelProps,
|
|
313
|
+
SelectProps,
|
|
314
|
+
SelectScrollDownButtonProps,
|
|
315
|
+
SelectScrollUpButtonProps,
|
|
316
|
+
SelectSeparatorProps,
|
|
317
|
+
SelectTriggerProps,
|
|
318
|
+
SelectValueProps,
|
|
319
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { SeparatorVariants } from "#/variants/separator";
|
|
4
|
+
import type { ComponentProps, JSX } from "react";
|
|
5
|
+
|
|
6
|
+
import { cn } from "#/lib/utils";
|
|
7
|
+
|
|
8
|
+
import { separatorVariants } from "#/variants/separator";
|
|
9
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
10
|
+
|
|
11
|
+
/* -----------------------------------------------------------------------------
|
|
12
|
+
* Component: Separator
|
|
13
|
+
* -------------------------------------------------------------------------- */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @since 0.3.16-canary.0
|
|
17
|
+
*/
|
|
18
|
+
interface SeparatorProps
|
|
19
|
+
extends ComponentProps<typeof SeparatorPrimitive.Root>, Omit<SeparatorVariants, "orientation"> {}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @since 0.3.16-canary.0
|
|
23
|
+
*/
|
|
24
|
+
function Separator({
|
|
25
|
+
align,
|
|
26
|
+
className,
|
|
27
|
+
decorative = true,
|
|
28
|
+
orientation,
|
|
29
|
+
...props
|
|
30
|
+
}: SeparatorProps): JSX.Element {
|
|
31
|
+
return (
|
|
32
|
+
<SeparatorPrimitive.Root
|
|
33
|
+
className={separatorVariants({ align, className, orientation })}
|
|
34
|
+
data-slot="separator"
|
|
35
|
+
decorative={decorative}
|
|
36
|
+
orientation={orientation}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* -----------------------------------------------------------------------------
|
|
43
|
+
* Component: SeparatorItem
|
|
44
|
+
* -------------------------------------------------------------------------- */
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @since 0.3.16-canary.0
|
|
48
|
+
*/
|
|
49
|
+
type SeparatorItemProps = ComponentProps<"div">;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @since 0.3.16-canary.0
|
|
53
|
+
*/
|
|
54
|
+
function SeparatorItem({ className, ...props }: SeparatorItemProps): JSX.Element {
|
|
55
|
+
return (
|
|
56
|
+
<div
|
|
57
|
+
className={cn(
|
|
58
|
+
"absolute",
|
|
59
|
+
"mx-2 px-2",
|
|
60
|
+
"bg-background text-sm text-muted-foreground",
|
|
61
|
+
className,
|
|
62
|
+
)}
|
|
63
|
+
data-slot="separator-item"
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* -----------------------------------------------------------------------------
|
|
70
|
+
* Exports
|
|
71
|
+
* -------------------------------------------------------------------------- */
|
|
72
|
+
|
|
73
|
+
export { Separator, SeparatorItem };
|
|
74
|
+
export type { SeparatorItemProps, SeparatorProps };
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ButtonVariants } from "#/variants/button";
|
|
4
|
+
import { buttonVariants } from "#/variants/button";
|
|
5
|
+
import type { SheetContentVariants } from "#/variants/sheet";
|
|
6
|
+
import { sheetContentVariants } from "#/variants/sheet";
|
|
7
|
+
import type { ComponentProps, JSX } from "react";
|
|
8
|
+
|
|
9
|
+
import { cn } from "#/lib/utils";
|
|
10
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
11
|
+
import { XIcon } from "lucide-react";
|
|
12
|
+
|
|
13
|
+
/* -----------------------------------------------------------------------------
|
|
14
|
+
* Component: Sheet
|
|
15
|
+
* -------------------------------------------------------------------------- */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @since 0.3.16-canary.0
|
|
19
|
+
*/
|
|
20
|
+
type SheetProps = ComponentProps<typeof SheetPrimitive.Root>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @since 0.3.16-canary.0
|
|
24
|
+
*/
|
|
25
|
+
function Sheet({ children, ...props }: SheetProps): JSX.Element {
|
|
26
|
+
return (
|
|
27
|
+
<SheetPrimitive.Root data-slot="sheet" {...props}>
|
|
28
|
+
{children}
|
|
29
|
+
</SheetPrimitive.Root>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* -----------------------------------------------------------------------------
|
|
34
|
+
* Component: SheetTrigger
|
|
35
|
+
* -------------------------------------------------------------------------- */
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @since 0.3.16-canary.0
|
|
39
|
+
*/
|
|
40
|
+
type SheetTriggerProps = ComponentProps<typeof SheetPrimitive.Trigger>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @since 0.3.16-canary.0
|
|
44
|
+
*/
|
|
45
|
+
function SheetTrigger({ ...props }: SheetTriggerProps): JSX.Element {
|
|
46
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* -----------------------------------------------------------------------------
|
|
50
|
+
* Component: SheetContent
|
|
51
|
+
* -------------------------------------------------------------------------- */
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @since 0.3.16-canary.0
|
|
55
|
+
*/
|
|
56
|
+
interface SheetContentProps
|
|
57
|
+
extends ComponentProps<typeof SheetPrimitive.Content>, SheetContentVariants {
|
|
58
|
+
classNames?: {
|
|
59
|
+
close?: string;
|
|
60
|
+
content?: string;
|
|
61
|
+
overlay?: string;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @since 0.3.16-canary.0
|
|
67
|
+
*/
|
|
68
|
+
function SheetContent({
|
|
69
|
+
children,
|
|
70
|
+
className,
|
|
71
|
+
classNames,
|
|
72
|
+
side = "right",
|
|
73
|
+
...props
|
|
74
|
+
}: SheetContentProps): JSX.Element {
|
|
75
|
+
return (
|
|
76
|
+
<SheetPrimitive.Portal>
|
|
77
|
+
<SheetPrimitive.Overlay
|
|
78
|
+
className={cn(
|
|
79
|
+
"fixed inset-0 z-50",
|
|
80
|
+
"bg-black/40 backdrop-blur-sm",
|
|
81
|
+
"ease-gentle data-open:animate-in data-open:animation-duration-380 data-open:fade-in-0",
|
|
82
|
+
"data-closed:animate-out data-closed:animation-duration-280 data-closed:fade-out-0",
|
|
83
|
+
"motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0",
|
|
84
|
+
classNames?.overlay,
|
|
85
|
+
)}
|
|
86
|
+
data-slot="sheet-overlay"
|
|
87
|
+
/>
|
|
88
|
+
<SheetPrimitive.Content
|
|
89
|
+
className={sheetContentVariants({ className: [classNames?.content, className], side })}
|
|
90
|
+
data-slot="sheet-content"
|
|
91
|
+
{...props}
|
|
92
|
+
>
|
|
93
|
+
{children}
|
|
94
|
+
<SheetPrimitive.Close
|
|
95
|
+
className={buttonVariants({
|
|
96
|
+
className: ["absolute top-4 right-4 size-7", classNames?.close],
|
|
97
|
+
size: "icon",
|
|
98
|
+
variant: "ghost",
|
|
99
|
+
})}
|
|
100
|
+
data-slot="sheet-close"
|
|
101
|
+
>
|
|
102
|
+
<XIcon className="size-4" />
|
|
103
|
+
<span className="sr-only">Close</span>
|
|
104
|
+
</SheetPrimitive.Close>
|
|
105
|
+
</SheetPrimitive.Content>
|
|
106
|
+
</SheetPrimitive.Portal>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* -----------------------------------------------------------------------------
|
|
111
|
+
* Component: SheetHeader
|
|
112
|
+
* -------------------------------------------------------------------------- */
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @since 0.3.16-canary.0
|
|
116
|
+
*/
|
|
117
|
+
type SheetHeaderProps = ComponentProps<"div">;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @since 0.3.16-canary.0
|
|
121
|
+
*/
|
|
122
|
+
function SheetHeader({ className, ...props }: SheetHeaderProps): JSX.Element {
|
|
123
|
+
return (
|
|
124
|
+
<header
|
|
125
|
+
className={cn(
|
|
126
|
+
"flex shrink-0 flex-col gap-1.5 px-6 pt-6 pb-4 text-center",
|
|
127
|
+
"sm:text-left",
|
|
128
|
+
className,
|
|
129
|
+
)}
|
|
130
|
+
data-slot="sheet-header"
|
|
131
|
+
{...props}
|
|
132
|
+
/>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* -----------------------------------------------------------------------------
|
|
137
|
+
* Component: SheetBody
|
|
138
|
+
* -------------------------------------------------------------------------- */
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @since 0.3.16-canary.0
|
|
142
|
+
*/
|
|
143
|
+
type SheetBodyProps = ComponentProps<"div">;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @since 0.3.16-canary.0
|
|
147
|
+
*/
|
|
148
|
+
function SheetBody({ className, ...props }: SheetBodyProps): JSX.Element {
|
|
149
|
+
return (
|
|
150
|
+
<main
|
|
151
|
+
className={cn("overflow-auto", "px-6 py-2", className)}
|
|
152
|
+
data-slot="sheet-body"
|
|
153
|
+
{...props}
|
|
154
|
+
/>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* -----------------------------------------------------------------------------
|
|
159
|
+
* Component: SheetFooter
|
|
160
|
+
* -------------------------------------------------------------------------- */
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @since 0.3.16-canary.0
|
|
164
|
+
*/
|
|
165
|
+
type SheetFooterProps = ComponentProps<"div">;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @since 0.3.16-canary.0
|
|
169
|
+
*/
|
|
170
|
+
function SheetFooter({ className, ...props }: SheetFooterProps): JSX.Element {
|
|
171
|
+
return (
|
|
172
|
+
<footer
|
|
173
|
+
className={cn(
|
|
174
|
+
"flex shrink-0 flex-col-reverse gap-2 px-6 pt-4 pb-6",
|
|
175
|
+
"sm:flex-row sm:justify-end",
|
|
176
|
+
className,
|
|
177
|
+
)}
|
|
178
|
+
data-slot="sheet-footer"
|
|
179
|
+
{...props}
|
|
180
|
+
/>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* -----------------------------------------------------------------------------
|
|
185
|
+
* Component: SheetTitle
|
|
186
|
+
* -------------------------------------------------------------------------- */
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @since 0.3.16-canary.0
|
|
190
|
+
*/
|
|
191
|
+
type SheetTitleProps = ComponentProps<typeof SheetPrimitive.Title>;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @since 0.3.16-canary.0
|
|
195
|
+
*/
|
|
196
|
+
function SheetTitle({ className, ...props }: SheetTitleProps): JSX.Element {
|
|
197
|
+
return (
|
|
198
|
+
<SheetPrimitive.Title
|
|
199
|
+
className={cn("text-lg font-semibold text-foreground", className)}
|
|
200
|
+
data-slot="sheet-title"
|
|
201
|
+
{...props}
|
|
202
|
+
/>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/* -----------------------------------------------------------------------------
|
|
207
|
+
* Component: SheetDescription
|
|
208
|
+
* -------------------------------------------------------------------------- */
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @since 0.3.16-canary.0
|
|
212
|
+
*/
|
|
213
|
+
type SheetDescriptionProps = ComponentProps<typeof SheetPrimitive.Description>;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @since 0.3.16-canary.0
|
|
217
|
+
*/
|
|
218
|
+
function SheetDescription({ className, ...props }: SheetDescriptionProps): JSX.Element {
|
|
219
|
+
return (
|
|
220
|
+
<SheetPrimitive.Description
|
|
221
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
222
|
+
data-slot="sheet-description"
|
|
223
|
+
{...props}
|
|
224
|
+
/>
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* -----------------------------------------------------------------------------
|
|
229
|
+
* Component: SheetClose
|
|
230
|
+
* -------------------------------------------------------------------------- */
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @since 0.3.16-canary.0
|
|
234
|
+
*/
|
|
235
|
+
interface SheetCloseProps extends ComponentProps<typeof SheetPrimitive.Close> {
|
|
236
|
+
size?: ButtonVariants["size"];
|
|
237
|
+
variant?: ButtonVariants["variant"];
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @since 0.3.16-canary.0
|
|
242
|
+
*/
|
|
243
|
+
function SheetClose({ className, size, variant, ...props }: SheetCloseProps): JSX.Element {
|
|
244
|
+
return (
|
|
245
|
+
<SheetPrimitive.Close
|
|
246
|
+
className={buttonVariants({ className, size, variant })}
|
|
247
|
+
data-slot="sheet-close"
|
|
248
|
+
{...props}
|
|
249
|
+
/>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/* -----------------------------------------------------------------------------
|
|
254
|
+
* Exports
|
|
255
|
+
* -------------------------------------------------------------------------- */
|
|
256
|
+
|
|
257
|
+
export {
|
|
258
|
+
Sheet,
|
|
259
|
+
SheetBody,
|
|
260
|
+
SheetClose,
|
|
261
|
+
SheetContent,
|
|
262
|
+
SheetDescription,
|
|
263
|
+
SheetFooter,
|
|
264
|
+
SheetHeader,
|
|
265
|
+
SheetTitle,
|
|
266
|
+
SheetTrigger,
|
|
267
|
+
};
|
|
268
|
+
export type {
|
|
269
|
+
SheetBodyProps,
|
|
270
|
+
SheetCloseProps,
|
|
271
|
+
SheetContentProps,
|
|
272
|
+
SheetDescriptionProps,
|
|
273
|
+
SheetFooterProps,
|
|
274
|
+
SheetHeaderProps,
|
|
275
|
+
SheetProps,
|
|
276
|
+
SheetTitleProps,
|
|
277
|
+
SheetTriggerProps,
|
|
278
|
+
};
|