@codefast/ui 0.3.16-canary.2 → 0.4.0-canary.4
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 +81 -0
- package/README.md +28 -17
- package/dist/components/accordion.d.mts +7 -22
- package/dist/components/accordion.mjs +26 -29
- package/dist/components/alert-dialog.d.mts +27 -26
- package/dist/components/alert-dialog.mjs +53 -45
- package/dist/components/alert.d.mts +14 -14
- package/dist/components/alert.mjs +17 -28
- package/dist/components/aspect-ratio.d.mts +2 -2
- package/dist/components/aspect-ratio.mjs +2 -3
- package/dist/components/avatar.d.mts +41 -5
- package/dist/components/avatar.mjs +40 -10
- package/dist/components/badge.d.mts +3 -15
- package/dist/components/badge.mjs +6 -48
- package/dist/components/breadcrumb.d.mts +1 -0
- package/dist/components/breadcrumb.mjs +11 -10
- package/dist/components/button-group.d.mts +3 -13
- package/dist/components/button-group.mjs +9 -31
- package/dist/components/button.d.mts +3 -26
- package/dist/components/button.mjs +9 -79
- package/dist/components/calendar.d.mts +6 -2
- package/dist/components/calendar.mjs +41 -44
- package/dist/components/card.d.mts +4 -2
- package/dist/components/card.mjs +9 -9
- package/dist/components/carousel.d.mts +16 -5
- package/dist/components/carousel.mjs +24 -11
- package/dist/components/chart.d.mts +9 -6
- package/dist/components/chart.mjs +21 -15
- package/dist/components/checkbox-cards.mjs +4 -4
- package/dist/components/checkbox-group.mjs +3 -4
- package/dist/components/checkbox.d.mts +2 -2
- package/dist/components/checkbox.mjs +6 -7
- package/dist/components/collapsible.d.mts +4 -4
- package/dist/components/collapsible.mjs +4 -5
- package/dist/components/command.d.mts +11 -1
- package/dist/components/command.mjs +35 -32
- package/dist/components/context-menu.d.mts +22 -15
- package/dist/components/context-menu.mjs +44 -39
- package/dist/components/dialog.d.mts +19 -23
- package/dist/components/dialog.mjs +48 -47
- package/dist/components/direction.d.mts +24 -0
- package/dist/components/direction.mjs +18 -0
- package/dist/components/drawer.d.mts +3 -21
- package/dist/components/drawer.mjs +19 -27
- package/dist/components/dropdown-menu.d.mts +22 -15
- package/dist/components/dropdown-menu.mjs +41 -37
- package/dist/components/empty.d.mts +3 -13
- package/dist/components/empty.mjs +8 -23
- package/dist/components/field.d.mts +3 -14
- package/dist/components/field.mjs +14 -44
- package/dist/components/form.d.mts +7 -10
- package/dist/components/form.mjs +6 -7
- package/dist/components/hover-card.d.mts +5 -5
- package/dist/components/hover-card.mjs +14 -12
- package/dist/components/input-group.d.mts +4 -31
- package/dist/components/input-group.mjs +14 -96
- package/dist/components/input-number.d.mts +3 -1
- package/dist/components/input-number.mjs +50 -28
- package/dist/components/input-otp.mjs +9 -7
- package/dist/components/input-password.mjs +1 -4
- package/dist/components/input-search.mjs +3 -5
- package/dist/components/input.mjs +1 -2
- package/dist/components/item.d.mts +4 -29
- package/dist/components/item.mjs +12 -65
- package/dist/components/kbd.mjs +1 -1
- package/dist/components/label.d.mts +2 -2
- package/dist/components/label.mjs +3 -4
- package/dist/components/menubar.d.mts +22 -16
- package/dist/components/menubar.mjs +54 -47
- package/dist/components/native-select.d.mts +5 -1
- package/dist/components/native-select.mjs +9 -6
- package/dist/components/navigation-menu.d.mts +30 -13
- package/dist/components/navigation-menu.mjs +35 -32
- package/dist/components/pagination.d.mts +7 -1
- package/dist/components/pagination.mjs +27 -12
- package/dist/components/popover.d.mts +40 -7
- package/dist/components/popover.mjs +46 -14
- package/dist/components/progress-circle.d.mts +3 -47
- package/dist/components/progress-circle.mjs +2 -48
- package/dist/components/progress.d.mts +2 -2
- package/dist/components/progress.mjs +5 -6
- package/dist/components/radio-cards.d.mts +3 -3
- package/dist/components/radio-cards.mjs +11 -11
- package/dist/components/radio-group.d.mts +3 -3
- package/dist/components/radio-group.mjs +9 -9
- package/dist/components/radio.mjs +2 -3
- package/dist/components/resizable.mjs +3 -8
- package/dist/components/scroll-area.d.mts +8 -24
- package/dist/components/scroll-area.mjs +16 -70
- package/dist/components/select.d.mts +14 -14
- package/dist/components/select.mjs +47 -47
- package/dist/components/separator.d.mts +4 -19
- package/dist/components/separator.mjs +6 -27
- package/dist/components/sheet.d.mts +18 -31
- package/dist/components/sheet.mjs +46 -87
- package/dist/components/sidebar.d.mts +3 -19
- package/dist/components/sidebar.mjs +48 -84
- package/dist/components/skeleton.mjs +1 -1
- package/dist/components/slider.d.mts +2 -2
- package/dist/components/slider.mjs +9 -11
- package/dist/components/sonner.mjs +11 -3
- package/dist/components/spinner.mjs +6 -7
- package/dist/components/switch.d.mts +5 -2
- package/dist/components/switch.mjs +7 -7
- package/dist/components/table.mjs +10 -10
- package/dist/components/tabs.d.mts +8 -5
- package/dist/components/tabs.mjs +18 -12
- package/dist/components/textarea.mjs +1 -1
- package/dist/components/toggle-group.d.mts +11 -7
- package/dist/components/toggle-group.mjs +20 -21
- package/dist/components/toggle.d.mts +4 -24
- package/dist/components/toggle.mjs +6 -45
- package/dist/components/tooltip.d.mts +7 -6
- package/dist/components/tooltip.mjs +19 -17
- package/dist/hooks/use-animated-value.mjs +0 -1
- package/dist/hooks/use-copy-to-clipboard.mjs +0 -1
- package/dist/hooks/use-is-mobile.mjs +0 -1
- package/dist/hooks/use-media-query.mjs +0 -1
- package/dist/hooks/use-mutation-observer.mjs +0 -1
- package/dist/hooks/use-pagination.mjs +0 -1
- package/dist/index.d.mts +38 -21
- package/dist/index.mjs +40 -23
- package/dist/lib/utils.d.mts +1 -12
- package/dist/lib/utils.mjs +1 -9
- package/dist/primitives/checkbox-group.d.mts +9 -11
- package/dist/primitives/checkbox-group.mjs +14 -19
- package/dist/primitives/input-number.d.mts +3 -4
- package/dist/primitives/input-number.mjs +3 -5
- package/dist/primitives/input.d.mts +4 -5
- package/dist/primitives/input.mjs +2 -3
- package/dist/primitives/progress-circle.d.mts +3 -4
- package/dist/primitives/progress-circle.mjs +2 -3
- package/dist/variants/alert.d.mts +18 -0
- package/dist/variants/alert.mjs +15 -0
- package/dist/variants/badge.d.mts +22 -0
- package/dist/variants/badge.mjs +19 -0
- package/dist/variants/button-group.d.mts +18 -0
- package/dist/variants/button-group.mjs +15 -0
- package/dist/variants/button.d.mts +32 -0
- package/dist/variants/button.mjs +34 -0
- package/dist/variants/empty.d.mts +18 -0
- package/dist/variants/empty.mjs +15 -0
- package/dist/variants/field.d.mts +19 -0
- package/dist/variants/field.mjs +16 -0
- package/dist/variants/input-group.d.mts +43 -0
- package/dist/variants/input-group.mjs +34 -0
- package/dist/variants/input-number.d.mts +45 -0
- package/dist/variants/input-number.mjs +40 -0
- package/dist/variants/item.d.mts +38 -0
- package/dist/variants/item.mjs +38 -0
- package/dist/variants/navigation-menu.d.mts +13 -0
- package/dist/variants/navigation-menu.mjs +8 -0
- package/dist/variants/progress-circle.d.mts +52 -0
- package/dist/variants/progress-circle.mjs +45 -0
- package/dist/variants/scroll-area.d.mts +24 -0
- package/dist/variants/scroll-area.mjs +58 -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 +17 -0
- package/dist/variants/sidebar.d.mts +23 -0
- package/dist/variants/sidebar.mjs +25 -0
- package/dist/variants/tabs.d.mts +18 -0
- package/dist/variants/tabs.mjs +15 -0
- package/dist/variants/toggle.d.mts +23 -0
- package/dist/variants/toggle.mjs +25 -0
- package/package.json +186 -55
- package/src/components/accordion.tsx +114 -0
- package/src/components/alert-dialog.tsx +298 -0
- package/src/components/alert.tsx +94 -0
- package/src/components/aspect-ratio.tsx +25 -0
- package/src/components/avatar.tsx +171 -0
- package/src/components/badge.tsx +35 -0
- package/src/components/breadcrumb.tsx +191 -0
- package/src/components/button-group.tsx +97 -0
- package/src/components/button.tsx +55 -0
- package/src/components/calendar.tsx +222 -0
- package/src/components/card.tsx +169 -0
- package/src/components/carousel.tsx +349 -0
- package/src/components/chart.tsx +536 -0
- package/src/components/checkbox-cards.tsx +72 -0
- package/src/components/checkbox-group.tsx +60 -0
- package/src/components/checkbox.tsx +44 -0
- package/src/components/collapsible.tsx +57 -0
- package/src/components/command.tsx +298 -0
- package/src/components/context-menu.tsx +410 -0
- package/src/components/dialog.tsx +243 -0
- package/src/components/direction.tsx +32 -0
- package/src/components/drawer.tsx +209 -0
- package/src/components/dropdown-menu.tsx +419 -0
- package/src/components/empty.tsx +155 -0
- package/src/components/field.tsx +329 -0
- package/src/components/form.tsx +258 -0
- package/src/components/hover-card.tsx +93 -0
- package/src/components/input-group.tsx +185 -0
- package/src/components/input-number.tsx +141 -0
- package/src/components/input-otp.tsx +132 -0
- package/src/components/input-password.tsx +50 -0
- package/src/components/input-search.tsx +81 -0
- package/src/components/input.tsx +36 -0
- package/src/components/item.tsx +266 -0
- package/src/components/kbd.tsx +47 -0
- package/src/components/label.tsx +36 -0
- package/src/components/menubar.tsx +440 -0
- package/src/components/native-select.tsx +87 -0
- package/src/components/navigation-menu.tsx +235 -0
- package/src/components/pagination.tsx +198 -0
- package/src/components/popover.tsx +170 -0
- package/src/components/progress-circle.tsx +185 -0
- package/src/components/progress.tsx +41 -0
- package/src/components/radio-cards.tsx +66 -0
- package/src/components/radio-group.tsx +59 -0
- package/src/components/radio.tsx +40 -0
- package/src/components/resizable.tsx +78 -0
- package/src/components/scroll-area.tsx +95 -0
- package/src/components/select.tsx +296 -0
- package/src/components/separator.tsx +60 -0
- package/src/components/sheet.tsx +241 -0
- package/src/components/sidebar.tsx +926 -0
- package/src/components/skeleton.tsx +35 -0
- package/src/components/slider.tsx +66 -0
- package/src/components/sonner.tsx +57 -0
- package/src/components/spinner.tsx +66 -0
- package/src/components/switch.tsx +44 -0
- package/src/components/table.tsx +183 -0
- package/src/components/tabs.tsx +110 -0
- package/src/components/textarea.tsx +35 -0
- package/src/components/toggle-group.tsx +137 -0
- package/src/components/toggle.tsx +30 -0
- package/src/components/tooltip.tsx +115 -0
- package/src/css/foundation/base.css +50 -0
- package/src/css/foundation/motion.css +36 -0
- package/src/css/foundation/source.css +3 -0
- package/src/css/foundation/tokens.css +71 -0
- package/src/css/foundation/variants.css +113 -0
- package/src/css/preset.css +5 -195
- package/src/css/style.css +1 -1
- package/src/css/{amber.css → themes/amber.css} +59 -22
- package/src/css/{blue.css → themes/blue.css} +59 -22
- package/src/css/{cyan.css → themes/cyan.css} +59 -22
- package/src/css/{emerald.css → themes/emerald.css} +59 -22
- package/src/css/{fuchsia.css → themes/fuchsia.css} +59 -22
- package/src/css/{gray.css → themes/gray.css} +59 -22
- package/src/css/{green.css → themes/green.css} +59 -22
- package/src/css/{indigo.css → themes/indigo.css} +59 -22
- package/src/css/{lime.css → themes/lime.css} +59 -22
- package/src/css/{neutral.css → themes/neutral.css} +59 -22
- package/src/css/{orange.css → themes/orange.css} +59 -22
- package/src/css/{pink.css → themes/pink.css} +59 -22
- package/src/css/{purple.css → themes/purple.css} +59 -22
- package/src/css/{red.css → themes/red.css} +59 -22
- package/src/css/{rose.css → themes/rose.css} +59 -22
- package/src/css/{sky.css → themes/sky.css} +59 -22
- package/src/css/{slate.css → themes/slate.css} +59 -22
- package/src/css/{stone.css → themes/stone.css} +59 -22
- package/src/css/{teal.css → themes/teal.css} +59 -22
- package/src/css/{violet.css → themes/violet.css} +59 -22
- package/src/css/{yellow.css → themes/yellow.css} +59 -22
- package/src/css/{zinc.css → themes/zinc.css} +59 -22
- package/src/hooks/use-animated-value.ts +91 -0
- package/src/hooks/use-copy-to-clipboard.ts +58 -0
- package/src/hooks/use-is-mobile.ts +25 -0
- package/src/hooks/use-media-query.ts +69 -0
- package/src/hooks/use-mutation-observer.ts +51 -0
- package/src/hooks/use-pagination.ts +164 -0
- package/src/index.ts +679 -0
- package/src/lib/utils.ts +5 -0
- package/src/primitives/checkbox-group.tsx +346 -0
- package/src/primitives/input-number.tsx +967 -0
- package/src/primitives/input.tsx +227 -0
- package/src/primitives/progress-circle.tsx +507 -0
- package/src/variants/alert.ts +34 -0
- package/src/variants/badge.ts +39 -0
- package/src/variants/button-group.ts +36 -0
- package/src/variants/button.ts +56 -0
- package/src/variants/empty.ts +34 -0
- package/src/variants/field.ts +37 -0
- package/src/variants/input-group.ts +80 -0
- package/src/variants/input-number.ts +65 -0
- package/src/variants/item.ts +68 -0
- package/src/variants/navigation-menu.ts +25 -0
- package/src/variants/progress-circle.ts +46 -0
- package/src/variants/scroll-area.ts +73 -0
- package/src/variants/separator.ts +40 -0
- package/src/variants/sheet.ts +37 -0
- package/src/variants/sidebar.ts +41 -0
- package/src/variants/tabs.ts +34 -0
- package/src/variants/toggle.ts +40 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
2
|
+
import { Select as SelectPrimitive } from "radix-ui";
|
|
3
|
+
import type { ComponentProps, JSX } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "#/lib/utils";
|
|
6
|
+
|
|
7
|
+
/* -----------------------------------------------------------------------------
|
|
8
|
+
* Component: Select
|
|
9
|
+
* -------------------------------------------------------------------------- */
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @since 0.3.16-canary.0
|
|
13
|
+
*/
|
|
14
|
+
type SelectProps = ComponentProps<typeof SelectPrimitive.Root>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @since 0.3.16-canary.0
|
|
18
|
+
*/
|
|
19
|
+
function Select({ ...props }: SelectProps): JSX.Element {
|
|
20
|
+
return <SelectPrimitive.Root data-slot="select" {...props} />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* -----------------------------------------------------------------------------
|
|
24
|
+
* Component: SelectGroup
|
|
25
|
+
* -------------------------------------------------------------------------- */
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @since 0.3.16-canary.0
|
|
29
|
+
*/
|
|
30
|
+
type SelectGroupProps = ComponentProps<typeof SelectPrimitive.Group>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @since 0.3.16-canary.0
|
|
34
|
+
*/
|
|
35
|
+
function SelectGroup({ className, ...props }: SelectGroupProps): JSX.Element {
|
|
36
|
+
return <SelectPrimitive.Group className={cn("scroll-my-1 p-1", className)} data-slot="select-group" {...props} />;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* -----------------------------------------------------------------------------
|
|
40
|
+
* Component: SelectValue
|
|
41
|
+
* -------------------------------------------------------------------------- */
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @since 0.3.16-canary.0
|
|
45
|
+
*/
|
|
46
|
+
type SelectValueProps = ComponentProps<typeof SelectPrimitive.Value>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @since 0.3.16-canary.0
|
|
50
|
+
*/
|
|
51
|
+
function SelectValue({ ...props }: SelectValueProps): JSX.Element {
|
|
52
|
+
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* -----------------------------------------------------------------------------
|
|
56
|
+
* Component: SelectTrigger
|
|
57
|
+
* -------------------------------------------------------------------------- */
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @since 0.3.16-canary.0
|
|
61
|
+
*/
|
|
62
|
+
interface SelectTriggerProps extends ComponentProps<typeof SelectPrimitive.Trigger> {
|
|
63
|
+
size?: "default" | "sm";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @since 0.3.16-canary.0
|
|
68
|
+
*/
|
|
69
|
+
function SelectTrigger({ children, className, size = "default", ...props }: SelectTriggerProps): JSX.Element {
|
|
70
|
+
return (
|
|
71
|
+
<SelectPrimitive.Trigger
|
|
72
|
+
className={cn(
|
|
73
|
+
"flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
74
|
+
className,
|
|
75
|
+
)}
|
|
76
|
+
data-size={size}
|
|
77
|
+
data-slot="select-trigger"
|
|
78
|
+
{...props}
|
|
79
|
+
>
|
|
80
|
+
{children}
|
|
81
|
+
<SelectPrimitive.Icon asChild>
|
|
82
|
+
<ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
|
|
83
|
+
</SelectPrimitive.Icon>
|
|
84
|
+
</SelectPrimitive.Trigger>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* -----------------------------------------------------------------------------
|
|
89
|
+
* Component: SelectScrollUpButton
|
|
90
|
+
* -------------------------------------------------------------------------- */
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @since 0.3.16-canary.0
|
|
94
|
+
*/
|
|
95
|
+
type SelectScrollUpButtonProps = ComponentProps<typeof SelectPrimitive.ScrollUpButton>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @since 0.3.16-canary.0
|
|
99
|
+
*/
|
|
100
|
+
function SelectScrollUpButton({ className, ...props }: SelectScrollUpButtonProps): JSX.Element {
|
|
101
|
+
return (
|
|
102
|
+
<SelectPrimitive.ScrollUpButton
|
|
103
|
+
className={cn(
|
|
104
|
+
"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
105
|
+
className,
|
|
106
|
+
)}
|
|
107
|
+
data-slot="select-scroll-up-button"
|
|
108
|
+
{...props}
|
|
109
|
+
>
|
|
110
|
+
<ChevronUpIcon />
|
|
111
|
+
</SelectPrimitive.ScrollUpButton>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* -----------------------------------------------------------------------------
|
|
116
|
+
* Component: SelectScrollDownButton
|
|
117
|
+
* -------------------------------------------------------------------------- */
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @since 0.3.16-canary.0
|
|
121
|
+
*/
|
|
122
|
+
type SelectScrollDownButtonProps = ComponentProps<typeof SelectPrimitive.ScrollDownButton>;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @since 0.3.16-canary.0
|
|
126
|
+
*/
|
|
127
|
+
function SelectScrollDownButton({ className, ...props }: SelectScrollDownButtonProps): JSX.Element {
|
|
128
|
+
return (
|
|
129
|
+
<SelectPrimitive.ScrollDownButton
|
|
130
|
+
className={cn(
|
|
131
|
+
"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
132
|
+
className,
|
|
133
|
+
)}
|
|
134
|
+
data-slot="select-scroll-down-button"
|
|
135
|
+
{...props}
|
|
136
|
+
>
|
|
137
|
+
<ChevronDownIcon />
|
|
138
|
+
</SelectPrimitive.ScrollDownButton>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* -----------------------------------------------------------------------------
|
|
143
|
+
* Component: SelectContent
|
|
144
|
+
* -------------------------------------------------------------------------- */
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @since 0.3.16-canary.0
|
|
148
|
+
*/
|
|
149
|
+
type SelectContentProps = ComponentProps<typeof SelectPrimitive.Content>;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @since 0.3.16-canary.0
|
|
153
|
+
*/
|
|
154
|
+
function SelectContent({
|
|
155
|
+
align = "center",
|
|
156
|
+
children,
|
|
157
|
+
className,
|
|
158
|
+
position = "item-aligned",
|
|
159
|
+
...props
|
|
160
|
+
}: SelectContentProps): JSX.Element {
|
|
161
|
+
return (
|
|
162
|
+
<SelectPrimitive.Portal data-slot="select-portal">
|
|
163
|
+
<SelectPrimitive.Content
|
|
164
|
+
align={align}
|
|
165
|
+
className={cn(
|
|
166
|
+
"relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 ease-snappy data-[align-trigger=true]:animate-none data-open:animate-in data-open:animation-duration-menu-in data-open:fade-in-0 data-open:zoom-in-95 data-open:data-side-top:slide-in-from-bottom-2 data-open:data-side-right:slide-in-from-left-2 data-open:data-side-bottom:slide-in-from-top-2 data-open:data-side-left:slide-in-from-right-2 data-closed:animate-out data-closed:ease-exit data-closed:animation-duration-menu-out data-closed:fade-out-0 data-closed:zoom-out-95 data-closed:data-side-top:slide-out-to-bottom-2 data-closed:data-side-right:slide-out-to-left-2 data-closed:data-side-bottom:slide-out-to-top-2 data-closed:data-side-left:slide-out-to-right-2",
|
|
167
|
+
position === "popper" &&
|
|
168
|
+
"data-side-top:-translate-y-1 data-side-right:translate-x-1 data-side-bottom:translate-y-1 data-side-left:-translate-x-1",
|
|
169
|
+
className,
|
|
170
|
+
)}
|
|
171
|
+
data-align-trigger={position === "item-aligned"}
|
|
172
|
+
data-slot="select-content"
|
|
173
|
+
position={position}
|
|
174
|
+
{...props}
|
|
175
|
+
>
|
|
176
|
+
<SelectScrollUpButton />
|
|
177
|
+
<SelectPrimitive.Viewport
|
|
178
|
+
className={cn(
|
|
179
|
+
"data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)",
|
|
180
|
+
position === "popper" && "",
|
|
181
|
+
)}
|
|
182
|
+
data-position={position}
|
|
183
|
+
>
|
|
184
|
+
{children}
|
|
185
|
+
</SelectPrimitive.Viewport>
|
|
186
|
+
<SelectScrollDownButton />
|
|
187
|
+
</SelectPrimitive.Content>
|
|
188
|
+
</SelectPrimitive.Portal>
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* -----------------------------------------------------------------------------
|
|
193
|
+
* Component: SelectLabel
|
|
194
|
+
* -------------------------------------------------------------------------- */
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @since 0.3.16-canary.0
|
|
198
|
+
*/
|
|
199
|
+
type SelectLabelProps = ComponentProps<typeof SelectPrimitive.Label>;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @since 0.3.16-canary.0
|
|
203
|
+
*/
|
|
204
|
+
function SelectLabel({ className, ...props }: SelectLabelProps): JSX.Element {
|
|
205
|
+
return (
|
|
206
|
+
<SelectPrimitive.Label
|
|
207
|
+
className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
|
|
208
|
+
data-slot="select-label"
|
|
209
|
+
{...props}
|
|
210
|
+
/>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* -----------------------------------------------------------------------------
|
|
215
|
+
* Component: SelectItem
|
|
216
|
+
* -------------------------------------------------------------------------- */
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* @since 0.3.16-canary.0
|
|
220
|
+
*/
|
|
221
|
+
type SelectItemProps = ComponentProps<typeof SelectPrimitive.Item>;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @since 0.3.16-canary.0
|
|
225
|
+
*/
|
|
226
|
+
function SelectItem({ children, className, ...props }: SelectItemProps): JSX.Element {
|
|
227
|
+
return (
|
|
228
|
+
<SelectPrimitive.Item
|
|
229
|
+
className={cn(
|
|
230
|
+
"relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
231
|
+
className,
|
|
232
|
+
)}
|
|
233
|
+
data-slot="select-item"
|
|
234
|
+
{...props}
|
|
235
|
+
>
|
|
236
|
+
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center">
|
|
237
|
+
<SelectPrimitive.ItemIndicator>
|
|
238
|
+
<CheckIcon className="pointer-events-none" />
|
|
239
|
+
</SelectPrimitive.ItemIndicator>
|
|
240
|
+
</span>
|
|
241
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
242
|
+
</SelectPrimitive.Item>
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* -----------------------------------------------------------------------------
|
|
247
|
+
* Component: SelectSeparator
|
|
248
|
+
* -------------------------------------------------------------------------- */
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* @since 0.3.16-canary.0
|
|
252
|
+
*/
|
|
253
|
+
type SelectSeparatorProps = ComponentProps<typeof SelectPrimitive.Separator>;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* @since 0.3.16-canary.0
|
|
257
|
+
*/
|
|
258
|
+
function SelectSeparator({ className, ...props }: SelectSeparatorProps): JSX.Element {
|
|
259
|
+
return (
|
|
260
|
+
<SelectPrimitive.Separator
|
|
261
|
+
className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
|
|
262
|
+
data-slot="select-separator"
|
|
263
|
+
{...props}
|
|
264
|
+
/>
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/* -----------------------------------------------------------------------------
|
|
269
|
+
* Exports
|
|
270
|
+
* -------------------------------------------------------------------------- */
|
|
271
|
+
|
|
272
|
+
export {
|
|
273
|
+
Select,
|
|
274
|
+
SelectContent,
|
|
275
|
+
SelectGroup,
|
|
276
|
+
SelectItem,
|
|
277
|
+
SelectLabel,
|
|
278
|
+
SelectScrollDownButton,
|
|
279
|
+
SelectScrollUpButton,
|
|
280
|
+
SelectSeparator,
|
|
281
|
+
SelectTrigger,
|
|
282
|
+
SelectValue,
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export type {
|
|
286
|
+
SelectContentProps,
|
|
287
|
+
SelectGroupProps,
|
|
288
|
+
SelectItemProps,
|
|
289
|
+
SelectLabelProps,
|
|
290
|
+
SelectProps,
|
|
291
|
+
SelectScrollDownButtonProps,
|
|
292
|
+
SelectScrollUpButtonProps,
|
|
293
|
+
SelectSeparatorProps,
|
|
294
|
+
SelectTriggerProps,
|
|
295
|
+
SelectValueProps,
|
|
296
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Separator as SeparatorPrimitive } from "radix-ui";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "#/lib/utils";
|
|
5
|
+
import type { SeparatorVariants } from "#/variants/separator";
|
|
6
|
+
import { separatorVariants } from "#/variants/separator";
|
|
7
|
+
|
|
8
|
+
/* -----------------------------------------------------------------------------
|
|
9
|
+
* Component: Separator
|
|
10
|
+
* -------------------------------------------------------------------------- */
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @since 0.3.16-canary.0
|
|
14
|
+
*/
|
|
15
|
+
interface SeparatorProps
|
|
16
|
+
extends ComponentProps<typeof SeparatorPrimitive.Root>, Omit<SeparatorVariants, "orientation"> {}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @since 0.3.16-canary.0
|
|
20
|
+
*/
|
|
21
|
+
function Separator({ align, className, decorative = true, orientation, ...props }: SeparatorProps): JSX.Element {
|
|
22
|
+
return (
|
|
23
|
+
<SeparatorPrimitive.Root
|
|
24
|
+
className={separatorVariants({ align, className, orientation })}
|
|
25
|
+
data-slot="separator"
|
|
26
|
+
decorative={decorative}
|
|
27
|
+
orientation={orientation}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* -----------------------------------------------------------------------------
|
|
34
|
+
* Component: SeparatorItem
|
|
35
|
+
* -------------------------------------------------------------------------- */
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @since 0.3.16-canary.0
|
|
39
|
+
*/
|
|
40
|
+
type SeparatorItemProps = ComponentProps<"div">;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @since 0.3.16-canary.0
|
|
44
|
+
*/
|
|
45
|
+
function SeparatorItem({ className, ...props }: SeparatorItemProps): JSX.Element {
|
|
46
|
+
return (
|
|
47
|
+
<div
|
|
48
|
+
className={cn("absolute mx-2 bg-background px-2 text-sm text-muted-foreground", className)}
|
|
49
|
+
data-slot="separator-item"
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* -----------------------------------------------------------------------------
|
|
56
|
+
* Exports
|
|
57
|
+
* -------------------------------------------------------------------------- */
|
|
58
|
+
|
|
59
|
+
export { Separator, SeparatorItem };
|
|
60
|
+
export type { SeparatorItemProps, SeparatorProps };
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { XIcon } from "lucide-react";
|
|
2
|
+
import { Dialog as SheetPrimitive } from "radix-ui";
|
|
3
|
+
import type { ComponentProps, JSX } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "#/lib/utils";
|
|
6
|
+
import type { ButtonVariants } from "#/variants/button";
|
|
7
|
+
import { buttonVariants } from "#/variants/button";
|
|
8
|
+
import type { SheetContentVariants } from "#/variants/sheet";
|
|
9
|
+
import { sheetContentVariants } from "#/variants/sheet";
|
|
10
|
+
|
|
11
|
+
/* -----------------------------------------------------------------------------
|
|
12
|
+
* Component: Sheet
|
|
13
|
+
* -------------------------------------------------------------------------- */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @since 0.3.16-canary.0
|
|
17
|
+
*/
|
|
18
|
+
type SheetProps = ComponentProps<typeof SheetPrimitive.Root>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @since 0.3.16-canary.0
|
|
22
|
+
*/
|
|
23
|
+
function Sheet({ ...props }: SheetProps): JSX.Element {
|
|
24
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* -----------------------------------------------------------------------------
|
|
28
|
+
* Component: SheetTrigger
|
|
29
|
+
* -------------------------------------------------------------------------- */
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @since 0.3.16-canary.0
|
|
33
|
+
*/
|
|
34
|
+
type SheetTriggerProps = ComponentProps<typeof SheetPrimitive.Trigger>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @since 0.3.16-canary.0
|
|
38
|
+
*/
|
|
39
|
+
function SheetTrigger({ ...props }: SheetTriggerProps): JSX.Element {
|
|
40
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* -----------------------------------------------------------------------------
|
|
44
|
+
* Component: SheetContent
|
|
45
|
+
* -------------------------------------------------------------------------- */
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @since 0.3.16-canary.0
|
|
49
|
+
*/
|
|
50
|
+
interface SheetContentProps extends ComponentProps<typeof SheetPrimitive.Content>, SheetContentVariants {
|
|
51
|
+
showCloseButton?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @since 0.3.16-canary.0
|
|
56
|
+
*/
|
|
57
|
+
function SheetContent({
|
|
58
|
+
children,
|
|
59
|
+
className,
|
|
60
|
+
showCloseButton = true,
|
|
61
|
+
side = "right",
|
|
62
|
+
...props
|
|
63
|
+
}: SheetContentProps): JSX.Element {
|
|
64
|
+
return (
|
|
65
|
+
<SheetPrimitive.Portal data-slot="sheet-portal">
|
|
66
|
+
<SheetPrimitive.Overlay
|
|
67
|
+
className={
|
|
68
|
+
"fixed inset-0 z-50 bg-black/10 ease-gentle supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:animation-duration-panel-in data-open:fade-in-0 data-closed:animate-out data-closed:ease-exit data-closed:animation-duration-panel-out data-closed:fade-out-0"
|
|
69
|
+
}
|
|
70
|
+
data-slot="sheet-overlay"
|
|
71
|
+
/>
|
|
72
|
+
<SheetPrimitive.Content
|
|
73
|
+
className={sheetContentVariants({ className, side })}
|
|
74
|
+
data-side={side}
|
|
75
|
+
data-slot="sheet-content"
|
|
76
|
+
{...props}
|
|
77
|
+
>
|
|
78
|
+
{children}
|
|
79
|
+
{showCloseButton ? (
|
|
80
|
+
<SheetPrimitive.Close
|
|
81
|
+
className={buttonVariants({
|
|
82
|
+
className: "absolute top-4 right-4",
|
|
83
|
+
size: "icon-sm",
|
|
84
|
+
variant: "ghost",
|
|
85
|
+
})}
|
|
86
|
+
data-slot="sheet-close"
|
|
87
|
+
>
|
|
88
|
+
<XIcon />
|
|
89
|
+
<span className="sr-only">Close</span>
|
|
90
|
+
</SheetPrimitive.Close>
|
|
91
|
+
) : null}
|
|
92
|
+
</SheetPrimitive.Content>
|
|
93
|
+
</SheetPrimitive.Portal>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* -----------------------------------------------------------------------------
|
|
98
|
+
* Component: SheetHeader
|
|
99
|
+
* -------------------------------------------------------------------------- */
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @since 0.3.16-canary.0
|
|
103
|
+
*/
|
|
104
|
+
type SheetHeaderProps = ComponentProps<"div">;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @since 0.3.16-canary.0
|
|
108
|
+
*/
|
|
109
|
+
function SheetHeader({ className, ...props }: SheetHeaderProps): JSX.Element {
|
|
110
|
+
return <div className={cn("flex shrink-0 flex-col gap-1.5 p-4", className)} data-slot="sheet-header" {...props} />;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* -----------------------------------------------------------------------------
|
|
114
|
+
* Component: SheetBody
|
|
115
|
+
* -------------------------------------------------------------------------- */
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Optional scrollable region for long content. When used, the Header and Footer
|
|
119
|
+
* stay pinned (shrink-0) and only this body scrolls. A codefast enhancement over
|
|
120
|
+
* radix-vega.
|
|
121
|
+
*
|
|
122
|
+
* @since 0.3.16-canary.0
|
|
123
|
+
*/
|
|
124
|
+
type SheetBodyProps = ComponentProps<"div">;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @since 0.3.16-canary.0
|
|
128
|
+
*/
|
|
129
|
+
function SheetBody({ className, ...props }: SheetBodyProps): JSX.Element {
|
|
130
|
+
return <div className={cn("min-h-0 flex-1 overflow-y-auto px-4", className)} data-slot="sheet-body" {...props} />;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* -----------------------------------------------------------------------------
|
|
134
|
+
* Component: SheetFooter
|
|
135
|
+
* -------------------------------------------------------------------------- */
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @since 0.3.16-canary.0
|
|
139
|
+
*/
|
|
140
|
+
type SheetFooterProps = ComponentProps<"div">;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @since 0.3.16-canary.0
|
|
144
|
+
*/
|
|
145
|
+
function SheetFooter({ className, ...props }: SheetFooterProps): JSX.Element {
|
|
146
|
+
return (
|
|
147
|
+
<div className={cn("mt-auto flex shrink-0 flex-col gap-2 p-4", className)} data-slot="sheet-footer" {...props} />
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* -----------------------------------------------------------------------------
|
|
152
|
+
* Component: SheetTitle
|
|
153
|
+
* -------------------------------------------------------------------------- */
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @since 0.3.16-canary.0
|
|
157
|
+
*/
|
|
158
|
+
type SheetTitleProps = ComponentProps<typeof SheetPrimitive.Title>;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @since 0.3.16-canary.0
|
|
162
|
+
*/
|
|
163
|
+
function SheetTitle({ className, ...props }: SheetTitleProps): JSX.Element {
|
|
164
|
+
return (
|
|
165
|
+
<SheetPrimitive.Title
|
|
166
|
+
className={cn("font-heading font-medium text-foreground", className)}
|
|
167
|
+
data-slot="sheet-title"
|
|
168
|
+
{...props}
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* -----------------------------------------------------------------------------
|
|
174
|
+
* Component: SheetDescription
|
|
175
|
+
* -------------------------------------------------------------------------- */
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @since 0.3.16-canary.0
|
|
179
|
+
*/
|
|
180
|
+
type SheetDescriptionProps = ComponentProps<typeof SheetPrimitive.Description>;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @since 0.3.16-canary.0
|
|
184
|
+
*/
|
|
185
|
+
function SheetDescription({ className, ...props }: SheetDescriptionProps): JSX.Element {
|
|
186
|
+
return (
|
|
187
|
+
<SheetPrimitive.Description
|
|
188
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
189
|
+
data-slot="sheet-description"
|
|
190
|
+
{...props}
|
|
191
|
+
/>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* -----------------------------------------------------------------------------
|
|
196
|
+
* Component: SheetClose
|
|
197
|
+
* -------------------------------------------------------------------------- */
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @since 0.3.16-canary.0
|
|
201
|
+
*/
|
|
202
|
+
interface SheetCloseProps extends ComponentProps<typeof SheetPrimitive.Close> {
|
|
203
|
+
size?: ButtonVariants["size"];
|
|
204
|
+
variant?: ButtonVariants["variant"];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @since 0.3.16-canary.0
|
|
209
|
+
*/
|
|
210
|
+
function SheetClose({ className, size, variant, ...props }: SheetCloseProps): JSX.Element {
|
|
211
|
+
return (
|
|
212
|
+
<SheetPrimitive.Close className={buttonVariants({ className, size, variant })} data-slot="sheet-close" {...props} />
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* -----------------------------------------------------------------------------
|
|
217
|
+
* Exports
|
|
218
|
+
* -------------------------------------------------------------------------- */
|
|
219
|
+
|
|
220
|
+
export {
|
|
221
|
+
Sheet,
|
|
222
|
+
SheetBody,
|
|
223
|
+
SheetClose,
|
|
224
|
+
SheetContent,
|
|
225
|
+
SheetDescription,
|
|
226
|
+
SheetFooter,
|
|
227
|
+
SheetHeader,
|
|
228
|
+
SheetTitle,
|
|
229
|
+
SheetTrigger,
|
|
230
|
+
};
|
|
231
|
+
export type {
|
|
232
|
+
SheetBodyProps,
|
|
233
|
+
SheetCloseProps,
|
|
234
|
+
SheetContentProps,
|
|
235
|
+
SheetDescriptionProps,
|
|
236
|
+
SheetFooterProps,
|
|
237
|
+
SheetHeaderProps,
|
|
238
|
+
SheetProps,
|
|
239
|
+
SheetTitleProps,
|
|
240
|
+
SheetTriggerProps,
|
|
241
|
+
};
|