@aereamart/design-system 0.3.5 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cn.d.ts +2 -1
- package/dist/cn.js +4 -2
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/index.d.ts +48 -37
- package/dist/index.js +48 -37
- package/dist/ui/accordion.d.ts +7 -0
- package/dist/ui/accordion.js +17 -0
- package/dist/ui/alert-dialog.d.ts +18 -0
- package/dist/ui/alert-dialog.js +42 -0
- package/dist/ui/alert.d.ts +9 -0
- package/dist/ui/alert.js +24 -0
- package/dist/ui/aspect-ratio.d.ts +3 -0
- package/dist/ui/aspect-ratio.js +6 -0
- package/dist/ui/avatar.d.ts +11 -0
- package/dist/ui/avatar.js +23 -0
- package/dist/ui/badge.d.ts +9 -0
- package/dist/ui/badge.js +24 -0
- package/dist/ui/breadcrumb.d.ts +11 -0
- package/dist/ui/breadcrumb.js +27 -0
- package/dist/ui/button.d.ts +10 -0
- package/dist/ui/button.js +35 -0
- package/dist/ui/calendar.d.ts +8 -0
- package/dist/ui/calendar.js +75 -0
- package/dist/ui/card.d.ts +9 -0
- package/dist/ui/card.js +24 -0
- package/dist/ui/carousel.d.ts +19 -0
- package/dist/ui/carousel.js +91 -0
- package/dist/ui/chart.d.ts +44 -0
- package/dist/ui/chart.js +132 -0
- package/dist/ui/checkbox.d.ts +4 -0
- package/dist/ui/checkbox.js +8 -0
- package/dist/ui/collapsible.d.ts +5 -0
- package/dist/ui/collapsible.js +13 -0
- package/dist/ui/command.d.ts +18 -0
- package/dist/ui/command.js +34 -0
- package/dist/ui/context-menu.d.ts +25 -0
- package/dist/ui/context-menu.js +51 -0
- package/dist/ui/dialog.d.ts +17 -0
- package/dist/ui/dialog.js +36 -0
- package/dist/ui/drawer.d.ts +13 -0
- package/dist/ui/drawer.js +35 -0
- package/dist/ui/dropdown-menu.d.ts +25 -0
- package/dist/ui/dropdown-menu.js +50 -0
- package/dist/ui/form.d.ts +24 -0
- package/dist/ui/form.js +58 -0
- package/dist/ui/hover-card.d.ts +6 -0
- package/dist/ui/hover-card.js +13 -0
- package/dist/ui/input-otp.d.ts +11 -0
- package/dist/ui/input-otp.js +21 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.js +6 -0
- package/dist/ui/label.d.ts +4 -0
- package/dist/ui/label.js +8 -0
- package/dist/ui/menubar.d.ts +26 -0
- package/dist/ui/menubar.js +53 -0
- package/dist/ui/navigation-menu.d.ts +14 -0
- package/dist/ui/navigation-menu.js +31 -0
- package/dist/ui/pagination.d.ts +13 -0
- package/dist/ui/pagination.js +29 -0
- package/dist/ui/popover.d.ts +10 -0
- package/dist/ui/popover.js +26 -0
- package/dist/ui/progress.d.ts +4 -0
- package/dist/ui/progress.js +7 -0
- package/dist/ui/radio-group.d.ts +5 -0
- package/dist/ui/radio-group.js +12 -0
- package/dist/ui/resizable.d.ts +7 -0
- package/dist/ui/resizable.js +14 -0
- package/dist/ui/scroll-area.d.ts +5 -0
- package/dist/ui/scroll-area.js +12 -0
- package/dist/ui/select.d.ts +15 -0
- package/dist/ui/select.js +38 -0
- package/dist/ui/separator.d.ts +4 -0
- package/dist/ui/separator.js +7 -0
- package/dist/ui/sheet.d.ts +14 -0
- package/dist/ui/sheet.js +40 -0
- package/dist/ui/sidebar.d.ts +69 -0
- package/dist/ui/sidebar.js +211 -0
- package/dist/ui/skeleton.d.ts +2 -0
- package/dist/ui/skeleton.js +6 -0
- package/dist/ui/slider.d.ts +4 -0
- package/dist/ui/slider.js +13 -0
- package/dist/ui/sonner.d.ts +3 -0
- package/dist/ui/sonner.js +21 -0
- package/dist/ui/switch.d.ts +6 -0
- package/dist/ui/switch.js +7 -0
- package/dist/ui/table.d.ts +10 -0
- package/dist/ui/table.js +28 -0
- package/dist/ui/tabs.d.ts +11 -0
- package/dist/ui/tabs.js +28 -0
- package/dist/ui/textarea.d.ts +3 -0
- package/dist/ui/textarea.js +6 -0
- package/dist/ui/toggle-group.d.ts +9 -0
- package/dist/ui/toggle-group.js +22 -0
- package/dist/ui/toggle.d.ts +9 -0
- package/dist/ui/toggle.js +26 -0
- package/dist/ui/tooltip.d.ts +7 -0
- package/dist/ui/tooltip.js +16 -0
- package/package.json +28 -4
- package/src/cn.ts +5 -2
- package/src/hooks/use-mobile.ts +19 -0
- package/src/index.css +140 -0
- package/src/index.ts +48 -37
- package/src/ui/accordion.tsx +63 -0
- package/src/ui/alert-dialog.tsx +196 -0
- package/src/ui/alert.tsx +65 -0
- package/src/ui/aspect-ratio.tsx +9 -0
- package/src/ui/avatar.tsx +108 -0
- package/src/ui/badge.tsx +47 -0
- package/src/ui/breadcrumb.tsx +108 -0
- package/src/ui/button.tsx +63 -0
- package/src/ui/calendar.tsx +218 -0
- package/src/ui/card.tsx +91 -0
- package/src/ui/carousel.tsx +241 -0
- package/src/ui/chart.tsx +371 -0
- package/src/ui/checkbox.tsx +29 -0
- package/src/ui/collapsible.tsx +33 -0
- package/src/ui/command.tsx +184 -0
- package/src/ui/context-menu.tsx +251 -0
- package/src/ui/dialog.tsx +156 -0
- package/src/ui/drawer.tsx +134 -0
- package/src/ui/dropdown-menu.tsx +254 -0
- package/src/ui/form.tsx +165 -0
- package/src/ui/hover-card.tsx +41 -0
- package/src/ui/input-otp.tsx +76 -0
- package/src/ui/input.tsx +20 -0
- package/src/ui/label.tsx +23 -0
- package/src/ui/menubar.tsx +273 -0
- package/src/ui/navigation-menu.tsx +167 -0
- package/src/ui/pagination.tsx +127 -0
- package/src/ui/popover.tsx +88 -0
- package/src/ui/progress.tsx +28 -0
- package/src/ui/radio-group.tsx +44 -0
- package/src/ui/resizable.tsx +50 -0
- package/src/ui/scroll-area.tsx +55 -0
- package/src/ui/select.tsx +189 -0
- package/src/ui/separator.tsx +25 -0
- package/src/ui/sheet.tsx +142 -0
- package/src/ui/sidebar.tsx +724 -0
- package/src/ui/skeleton.tsx +13 -0
- package/src/ui/slider.tsx +60 -0
- package/src/ui/sonner.tsx +40 -0
- package/src/ui/switch.tsx +32 -0
- package/src/ui/table.tsx +115 -0
- package/src/ui/tabs.tsx +88 -0
- package/src/ui/textarea.tsx +17 -0
- package/src/ui/toggle-group.tsx +83 -0
- package/src/ui/toggle.tsx +46 -0
- package/src/ui/tooltip.tsx +54 -0
- package/dist/Accordion.d.ts +0 -10
- package/dist/Accordion.js +0 -12
- package/dist/AlertBanner.d.ts +0 -9
- package/dist/AlertBanner.js +0 -21
- package/dist/AppBar.d.ts +0 -7
- package/dist/AppBar.js +0 -5
- package/dist/Avatar.d.ts +0 -6
- package/dist/Avatar.js +0 -20
- package/dist/Badge.d.ts +0 -6
- package/dist/Badge.js +0 -11
- package/dist/BottomSheet.d.ts +0 -8
- package/dist/BottomSheet.js +0 -24
- package/dist/Breadcrumb.d.ts +0 -8
- package/dist/Breadcrumb.js +0 -9
- package/dist/Button.d.ts +0 -9
- package/dist/Button.js +0 -18
- package/dist/Card.d.ts +0 -7
- package/dist/Card.js +0 -6
- package/dist/Checkbox.d.ts +0 -5
- package/dist/Checkbox.js +0 -5
- package/dist/Chip.d.ts +0 -7
- package/dist/Chip.js +0 -15
- package/dist/DataTable.d.ts +0 -15
- package/dist/DataTable.js +0 -7
- package/dist/DatePicker.d.ts +0 -5
- package/dist/DatePicker.js +0 -11
- package/dist/Divider.d.ts +0 -5
- package/dist/Divider.js +0 -11
- package/dist/Drawer.d.ts +0 -10
- package/dist/Drawer.js +0 -24
- package/dist/EmptyState.d.ts +0 -7
- package/dist/EmptyState.js +0 -6
- package/dist/Input.d.ts +0 -5
- package/dist/Input.js +0 -7
- package/dist/Link.d.ts +0 -4
- package/dist/Link.js +0 -6
- package/dist/Menu.d.ts +0 -14
- package/dist/Menu.js +0 -29
- package/dist/Modal.d.ts +0 -9
- package/dist/Modal.js +0 -24
- package/dist/NavigationBar.d.ts +0 -14
- package/dist/NavigationBar.js +0 -22
- package/dist/Pagination.d.ts +0 -7
- package/dist/Pagination.js +0 -24
- package/dist/Popover.d.ts +0 -7
- package/dist/Popover.js +0 -9
- package/dist/Progress.d.ts +0 -8
- package/dist/Progress.js +0 -15
- package/dist/Radio.d.ts +0 -15
- package/dist/Radio.js +0 -8
- package/dist/SegmentedControl.d.ts +0 -13
- package/dist/SegmentedControl.js +0 -18
- package/dist/Select.d.ts +0 -5
- package/dist/Select.js +0 -7
- package/dist/Sidebar.d.ts +0 -16
- package/dist/Sidebar.js +0 -19
- package/dist/Slider.d.ts +0 -5
- package/dist/Slider.js +0 -5
- package/dist/Snackbar.d.ts +0 -12
- package/dist/Snackbar.js +0 -20
- package/dist/Spinner.d.ts +0 -3
- package/dist/Spinner.js +0 -5
- package/dist/Switch.d.ts +0 -4
- package/dist/Switch.js +0 -5
- package/dist/Tabs.d.ts +0 -14
- package/dist/Tabs.js +0 -24
- package/dist/Tag.d.ts +0 -6
- package/dist/Tag.js +0 -11
- package/dist/Textarea.d.ts +0 -5
- package/dist/Textarea.js +0 -7
- package/dist/Tooltip.d.ts +0 -7
- package/dist/Tooltip.js +0 -5
- package/dist/TreeView.d.ts +0 -12
- package/dist/TreeView.js +0 -34
- package/src/Accordion.tsx +0 -58
- package/src/AlertBanner.tsx +0 -62
- package/src/AppBar.tsx +0 -29
- package/src/Avatar.tsx +0 -42
- package/src/Badge.tsx +0 -27
- package/src/BottomSheet.tsx +0 -60
- package/src/Breadcrumb.tsx +0 -48
- package/src/Button.tsx +0 -54
- package/src/Card.tsx +0 -39
- package/src/Checkbox.tsx +0 -31
- package/src/Chip.tsx +0 -44
- package/src/DataTable.tsx +0 -64
- package/src/DatePicker.tsx +0 -44
- package/src/Divider.tsx +0 -33
- package/src/Drawer.tsx +0 -71
- package/src/EmptyState.tsx +0 -37
- package/src/Input.tsx +0 -30
- package/src/Link.tsx +0 -22
- package/src/Menu.tsx +0 -73
- package/src/Modal.tsx +0 -62
- package/src/NavigationBar.tsx +0 -68
- package/src/Pagination.tsx +0 -69
- package/src/Popover.tsx +0 -34
- package/src/Progress.tsx +0 -53
- package/src/Radio.tsx +0 -49
- package/src/SegmentedControl.tsx +0 -63
- package/src/Select.tsx +0 -32
- package/src/Sidebar.tsx +0 -73
- package/src/Slider.tsx +0 -33
- package/src/Snackbar.tsx +0 -72
- package/src/Spinner.tsx +0 -19
- package/src/Switch.tsx +0 -40
- package/src/Tabs.tsx +0 -77
- package/src/Tag.tsx +0 -29
- package/src/Textarea.tsx +0 -30
- package/src/Tooltip.tsx +0 -25
- package/src/TreeView.tsx +0 -105
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cn } from "../cn"
|
|
5
|
+
import { Drawer as DrawerPrimitive } from "vaul"
|
|
6
|
+
|
|
7
|
+
function Drawer({
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Root>) {
|
|
10
|
+
return <DrawerPrimitive.Root data-slot="drawer" {...props} />
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function DrawerTrigger({
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
|
|
16
|
+
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function DrawerPortal({
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
22
|
+
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function DrawerClose({
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
28
|
+
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function DrawerOverlay({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
|
|
35
|
+
return (
|
|
36
|
+
<DrawerPrimitive.Overlay
|
|
37
|
+
data-slot="drawer-overlay"
|
|
38
|
+
className={cn(
|
|
39
|
+
"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function DrawerContent({
|
|
48
|
+
className,
|
|
49
|
+
children,
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Content>) {
|
|
52
|
+
return (
|
|
53
|
+
<DrawerPortal data-slot="drawer-portal">
|
|
54
|
+
<DrawerOverlay />
|
|
55
|
+
<DrawerPrimitive.Content
|
|
56
|
+
data-slot="drawer-content"
|
|
57
|
+
className={cn(
|
|
58
|
+
"group/drawer-content fixed z-50 flex h-auto flex-col bg-background",
|
|
59
|
+
"data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
|
|
60
|
+
"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
|
|
61
|
+
"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
|
|
62
|
+
"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
|
|
63
|
+
className
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
>
|
|
67
|
+
<div className="mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
|
|
68
|
+
{children}
|
|
69
|
+
</DrawerPrimitive.Content>
|
|
70
|
+
</DrawerPortal>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
data-slot="drawer-header"
|
|
78
|
+
className={cn(
|
|
79
|
+
"flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
|
|
80
|
+
className
|
|
81
|
+
)}
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
88
|
+
return (
|
|
89
|
+
<div
|
|
90
|
+
data-slot="drawer-footer"
|
|
91
|
+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
92
|
+
{...props}
|
|
93
|
+
/>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function DrawerTitle({
|
|
98
|
+
className,
|
|
99
|
+
...props
|
|
100
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Title>) {
|
|
101
|
+
return (
|
|
102
|
+
<DrawerPrimitive.Title
|
|
103
|
+
data-slot="drawer-title"
|
|
104
|
+
className={cn("font-semibold text-foreground", className)}
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function DrawerDescription({
|
|
111
|
+
className,
|
|
112
|
+
...props
|
|
113
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Description>) {
|
|
114
|
+
return (
|
|
115
|
+
<DrawerPrimitive.Description
|
|
116
|
+
data-slot="drawer-description"
|
|
117
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
118
|
+
{...props}
|
|
119
|
+
/>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export {
|
|
124
|
+
Drawer,
|
|
125
|
+
DrawerPortal,
|
|
126
|
+
DrawerOverlay,
|
|
127
|
+
DrawerTrigger,
|
|
128
|
+
DrawerClose,
|
|
129
|
+
DrawerContent,
|
|
130
|
+
DrawerHeader,
|
|
131
|
+
DrawerFooter,
|
|
132
|
+
DrawerTitle,
|
|
133
|
+
DrawerDescription,
|
|
134
|
+
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "../cn"
|
|
3
|
+
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
|
|
4
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
function DropdownMenu({
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
|
|
9
|
+
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function DropdownMenuPortal({
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
|
|
15
|
+
return (
|
|
16
|
+
<DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function DropdownMenuTrigger({
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
|
|
23
|
+
return (
|
|
24
|
+
<DropdownMenuPrimitive.Trigger
|
|
25
|
+
data-slot="dropdown-menu-trigger"
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function DropdownMenuContent({
|
|
32
|
+
className,
|
|
33
|
+
sideOffset = 4,
|
|
34
|
+
...props
|
|
35
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
|
|
36
|
+
return (
|
|
37
|
+
<DropdownMenuPrimitive.Portal>
|
|
38
|
+
<DropdownMenuPrimitive.Content
|
|
39
|
+
data-slot="dropdown-menu-content"
|
|
40
|
+
sideOffset={sideOffset}
|
|
41
|
+
className={cn(
|
|
42
|
+
"z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
43
|
+
className
|
|
44
|
+
)}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
</DropdownMenuPrimitive.Portal>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function DropdownMenuGroup({
|
|
52
|
+
...props
|
|
53
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
|
|
54
|
+
return (
|
|
55
|
+
<DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function DropdownMenuItem({
|
|
60
|
+
className,
|
|
61
|
+
inset,
|
|
62
|
+
variant = "default",
|
|
63
|
+
...props
|
|
64
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
65
|
+
inset?: boolean
|
|
66
|
+
variant?: "default" | "destructive"
|
|
67
|
+
}) {
|
|
68
|
+
return (
|
|
69
|
+
<DropdownMenuPrimitive.Item
|
|
70
|
+
data-slot="dropdown-menu-item"
|
|
71
|
+
data-inset={inset}
|
|
72
|
+
data-variant={variant}
|
|
73
|
+
className={cn(
|
|
74
|
+
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
|
|
75
|
+
className
|
|
76
|
+
)}
|
|
77
|
+
{...props}
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function DropdownMenuCheckboxItem({
|
|
83
|
+
className,
|
|
84
|
+
children,
|
|
85
|
+
checked,
|
|
86
|
+
...props
|
|
87
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
|
|
88
|
+
return (
|
|
89
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
90
|
+
data-slot="dropdown-menu-checkbox-item"
|
|
91
|
+
className={cn(
|
|
92
|
+
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent 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",
|
|
93
|
+
className
|
|
94
|
+
)}
|
|
95
|
+
checked={checked}
|
|
96
|
+
{...props}
|
|
97
|
+
>
|
|
98
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
99
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
100
|
+
<CheckIcon className="size-4" />
|
|
101
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
102
|
+
</span>
|
|
103
|
+
{children}
|
|
104
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function DropdownMenuRadioGroup({
|
|
109
|
+
...props
|
|
110
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
|
|
111
|
+
return (
|
|
112
|
+
<DropdownMenuPrimitive.RadioGroup
|
|
113
|
+
data-slot="dropdown-menu-radio-group"
|
|
114
|
+
{...props}
|
|
115
|
+
/>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function DropdownMenuRadioItem({
|
|
120
|
+
className,
|
|
121
|
+
children,
|
|
122
|
+
...props
|
|
123
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
|
|
124
|
+
return (
|
|
125
|
+
<DropdownMenuPrimitive.RadioItem
|
|
126
|
+
data-slot="dropdown-menu-radio-item"
|
|
127
|
+
className={cn(
|
|
128
|
+
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent 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",
|
|
129
|
+
className
|
|
130
|
+
)}
|
|
131
|
+
{...props}
|
|
132
|
+
>
|
|
133
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
134
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
135
|
+
<CircleIcon className="size-2 fill-current" />
|
|
136
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
137
|
+
</span>
|
|
138
|
+
{children}
|
|
139
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function DropdownMenuLabel({
|
|
144
|
+
className,
|
|
145
|
+
inset,
|
|
146
|
+
...props
|
|
147
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
148
|
+
inset?: boolean
|
|
149
|
+
}) {
|
|
150
|
+
return (
|
|
151
|
+
<DropdownMenuPrimitive.Label
|
|
152
|
+
data-slot="dropdown-menu-label"
|
|
153
|
+
data-inset={inset}
|
|
154
|
+
className={cn(
|
|
155
|
+
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
156
|
+
className
|
|
157
|
+
)}
|
|
158
|
+
{...props}
|
|
159
|
+
/>
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function DropdownMenuSeparator({
|
|
164
|
+
className,
|
|
165
|
+
...props
|
|
166
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
|
167
|
+
return (
|
|
168
|
+
<DropdownMenuPrimitive.Separator
|
|
169
|
+
data-slot="dropdown-menu-separator"
|
|
170
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
171
|
+
{...props}
|
|
172
|
+
/>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function DropdownMenuShortcut({
|
|
177
|
+
className,
|
|
178
|
+
...props
|
|
179
|
+
}: React.ComponentProps<"span">) {
|
|
180
|
+
return (
|
|
181
|
+
<span
|
|
182
|
+
data-slot="dropdown-menu-shortcut"
|
|
183
|
+
className={cn(
|
|
184
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
185
|
+
className
|
|
186
|
+
)}
|
|
187
|
+
{...props}
|
|
188
|
+
/>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function DropdownMenuSub({
|
|
193
|
+
...props
|
|
194
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
|
|
195
|
+
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function DropdownMenuSubTrigger({
|
|
199
|
+
className,
|
|
200
|
+
inset,
|
|
201
|
+
children,
|
|
202
|
+
...props
|
|
203
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
204
|
+
inset?: boolean
|
|
205
|
+
}) {
|
|
206
|
+
return (
|
|
207
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
208
|
+
data-slot="dropdown-menu-sub-trigger"
|
|
209
|
+
data-inset={inset}
|
|
210
|
+
className={cn(
|
|
211
|
+
"flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
212
|
+
className
|
|
213
|
+
)}
|
|
214
|
+
{...props}
|
|
215
|
+
>
|
|
216
|
+
{children}
|
|
217
|
+
<ChevronRightIcon className="ml-auto size-4" />
|
|
218
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function DropdownMenuSubContent({
|
|
223
|
+
className,
|
|
224
|
+
...props
|
|
225
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
|
226
|
+
return (
|
|
227
|
+
<DropdownMenuPrimitive.SubContent
|
|
228
|
+
data-slot="dropdown-menu-sub-content"
|
|
229
|
+
className={cn(
|
|
230
|
+
"z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
231
|
+
className
|
|
232
|
+
)}
|
|
233
|
+
{...props}
|
|
234
|
+
/>
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export {
|
|
239
|
+
DropdownMenu,
|
|
240
|
+
DropdownMenuPortal,
|
|
241
|
+
DropdownMenuTrigger,
|
|
242
|
+
DropdownMenuContent,
|
|
243
|
+
DropdownMenuGroup,
|
|
244
|
+
DropdownMenuLabel,
|
|
245
|
+
DropdownMenuItem,
|
|
246
|
+
DropdownMenuCheckboxItem,
|
|
247
|
+
DropdownMenuRadioGroup,
|
|
248
|
+
DropdownMenuRadioItem,
|
|
249
|
+
DropdownMenuSeparator,
|
|
250
|
+
DropdownMenuShortcut,
|
|
251
|
+
DropdownMenuSub,
|
|
252
|
+
DropdownMenuSubTrigger,
|
|
253
|
+
DropdownMenuSubContent,
|
|
254
|
+
}
|
package/src/ui/form.tsx
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "../cn"
|
|
3
|
+
import type { Label as LabelPrimitive } from "radix-ui"
|
|
4
|
+
import { Slot } from "radix-ui"
|
|
5
|
+
import {
|
|
6
|
+
Controller,
|
|
7
|
+
FormProvider,
|
|
8
|
+
useFormContext,
|
|
9
|
+
useFormState,
|
|
10
|
+
type ControllerProps,
|
|
11
|
+
type FieldPath,
|
|
12
|
+
type FieldValues,
|
|
13
|
+
} from "react-hook-form"
|
|
14
|
+
|
|
15
|
+
import { Label } from "./label"
|
|
16
|
+
|
|
17
|
+
const Form = FormProvider
|
|
18
|
+
|
|
19
|
+
type FormFieldContextValue<
|
|
20
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
21
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
22
|
+
> = {
|
|
23
|
+
name: TName
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const FormFieldContext = React.createContext<FormFieldContextValue>(
|
|
27
|
+
{} as FormFieldContextValue
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
const FormField = <
|
|
31
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
32
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
33
|
+
>({
|
|
34
|
+
...props
|
|
35
|
+
}: ControllerProps<TFieldValues, TName>) => {
|
|
36
|
+
return (
|
|
37
|
+
<FormFieldContext.Provider value={{ name: props.name }}>
|
|
38
|
+
<Controller {...props} />
|
|
39
|
+
</FormFieldContext.Provider>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const useFormField = () => {
|
|
44
|
+
const fieldContext = React.useContext(FormFieldContext)
|
|
45
|
+
const itemContext = React.useContext(FormItemContext)
|
|
46
|
+
const { getFieldState } = useFormContext()
|
|
47
|
+
const formState = useFormState({ name: fieldContext.name })
|
|
48
|
+
const fieldState = getFieldState(fieldContext.name, formState)
|
|
49
|
+
|
|
50
|
+
if (!fieldContext) {
|
|
51
|
+
throw new Error("useFormField should be used within <FormField>")
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { id } = itemContext
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
id,
|
|
58
|
+
name: fieldContext.name,
|
|
59
|
+
formItemId: `${id}-form-item`,
|
|
60
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
61
|
+
formMessageId: `${id}-form-item-message`,
|
|
62
|
+
...fieldState,
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type FormItemContextValue = {
|
|
67
|
+
id: string
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const FormItemContext = React.createContext<FormItemContextValue>(
|
|
71
|
+
{} as FormItemContextValue
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
function FormItem({ className, ...props }: React.ComponentProps<"div">) {
|
|
75
|
+
const id = React.useId()
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<FormItemContext.Provider value={{ id }}>
|
|
79
|
+
<div
|
|
80
|
+
data-slot="form-item"
|
|
81
|
+
className={cn("grid gap-2", className)}
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
</FormItemContext.Provider>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function FormLabel({
|
|
89
|
+
className,
|
|
90
|
+
...props
|
|
91
|
+
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
92
|
+
const { error, formItemId } = useFormField()
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Label
|
|
96
|
+
data-slot="form-label"
|
|
97
|
+
data-error={!!error}
|
|
98
|
+
className={cn("data-[error=true]:text-destructive", className)}
|
|
99
|
+
htmlFor={formItemId}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function FormControl({ ...props }: React.ComponentProps<typeof Slot.Root>) {
|
|
106
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<Slot.Root
|
|
110
|
+
data-slot="form-control"
|
|
111
|
+
id={formItemId}
|
|
112
|
+
aria-describedby={
|
|
113
|
+
!error
|
|
114
|
+
? `${formDescriptionId}`
|
|
115
|
+
: `${formDescriptionId} ${formMessageId}`
|
|
116
|
+
}
|
|
117
|
+
aria-invalid={!!error}
|
|
118
|
+
{...props}
|
|
119
|
+
/>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function FormDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
124
|
+
const { formDescriptionId } = useFormField()
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<p
|
|
128
|
+
data-slot="form-description"
|
|
129
|
+
id={formDescriptionId}
|
|
130
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
131
|
+
{...props}
|
|
132
|
+
/>
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function FormMessage({ className, ...props }: React.ComponentProps<"p">) {
|
|
137
|
+
const { error, formMessageId } = useFormField()
|
|
138
|
+
const body = error ? String(error?.message ?? "") : props.children
|
|
139
|
+
|
|
140
|
+
if (!body) {
|
|
141
|
+
return null
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<p
|
|
146
|
+
data-slot="form-message"
|
|
147
|
+
id={formMessageId}
|
|
148
|
+
className={cn("text-sm text-destructive", className)}
|
|
149
|
+
{...props}
|
|
150
|
+
>
|
|
151
|
+
{body}
|
|
152
|
+
</p>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export {
|
|
157
|
+
useFormField,
|
|
158
|
+
Form,
|
|
159
|
+
FormItem,
|
|
160
|
+
FormLabel,
|
|
161
|
+
FormControl,
|
|
162
|
+
FormDescription,
|
|
163
|
+
FormMessage,
|
|
164
|
+
FormField,
|
|
165
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "../cn"
|
|
3
|
+
import { HoverCard as HoverCardPrimitive } from "radix-ui"
|
|
4
|
+
|
|
5
|
+
function HoverCard({
|
|
6
|
+
...props
|
|
7
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
|
|
8
|
+
return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function HoverCardTrigger({
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
|
|
14
|
+
return (
|
|
15
|
+
<HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function HoverCardContent({
|
|
20
|
+
className,
|
|
21
|
+
align = "center",
|
|
22
|
+
sideOffset = 4,
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
|
|
25
|
+
return (
|
|
26
|
+
<HoverCardPrimitive.Portal data-slot="hover-card-portal">
|
|
27
|
+
<HoverCardPrimitive.Content
|
|
28
|
+
data-slot="hover-card-content"
|
|
29
|
+
align={align}
|
|
30
|
+
sideOffset={sideOffset}
|
|
31
|
+
className={cn(
|
|
32
|
+
"z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
33
|
+
className
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
</HoverCardPrimitive.Portal>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent }
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cn } from "../cn"
|
|
5
|
+
import { OTPInput, OTPInputContext } from "input-otp"
|
|
6
|
+
import { MinusIcon } from "lucide-react"
|
|
7
|
+
|
|
8
|
+
function InputOTP({
|
|
9
|
+
className,
|
|
10
|
+
containerClassName,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof OTPInput> & {
|
|
13
|
+
containerClassName?: string
|
|
14
|
+
}) {
|
|
15
|
+
return (
|
|
16
|
+
<OTPInput
|
|
17
|
+
data-slot="input-otp"
|
|
18
|
+
containerClassName={cn(
|
|
19
|
+
"flex items-center gap-2 has-disabled:opacity-50",
|
|
20
|
+
containerClassName
|
|
21
|
+
)}
|
|
22
|
+
className={cn("disabled:cursor-not-allowed", className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
data-slot="input-otp-group"
|
|
32
|
+
className={cn("flex items-center", className)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function InputOTPSlot({
|
|
39
|
+
index,
|
|
40
|
+
className,
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<"div"> & {
|
|
43
|
+
index: number
|
|
44
|
+
}) {
|
|
45
|
+
const inputOTPContext = React.useContext(OTPInputContext)
|
|
46
|
+
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
data-slot="input-otp-slot"
|
|
51
|
+
data-active={isActive}
|
|
52
|
+
className={cn(
|
|
53
|
+
"relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-[3px] data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40",
|
|
54
|
+
className
|
|
55
|
+
)}
|
|
56
|
+
{...props}
|
|
57
|
+
>
|
|
58
|
+
{char}
|
|
59
|
+
{hasFakeCaret && (
|
|
60
|
+
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
61
|
+
<div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
|
|
69
|
+
return (
|
|
70
|
+
<div data-slot="input-otp-separator" role="separator" {...props}>
|
|
71
|
+
<MinusIcon />
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
|
package/src/ui/input.tsx
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "../cn"
|
|
3
|
+
|
|
4
|
+
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
5
|
+
return (
|
|
6
|
+
<input
|
|
7
|
+
type={type}
|
|
8
|
+
data-slot="input"
|
|
9
|
+
className={cn(
|
|
10
|
+
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
|
|
11
|
+
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
12
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
13
|
+
className
|
|
14
|
+
)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { Input }
|