@bearmenu/ui 0.1.0
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/chunk-2CUFS5LF.js +80 -0
- package/dist/chunk-3GWWZKX7.js +33 -0
- package/dist/chunk-3VMDCCCX.js +10 -0
- package/dist/chunk-4AVS6CV4.js +89 -0
- package/dist/chunk-4JOV7FXW.js +17 -0
- package/dist/chunk-4KOMHDZD.js +89 -0
- package/dist/chunk-4UO73SKC.js +26 -0
- package/dist/chunk-7H54PTVH.js +116 -0
- package/dist/chunk-CW24PLDW.js +24 -0
- package/dist/chunk-EBAMCZDW.js +112 -0
- package/dist/chunk-ERMIA7NP.js +106 -0
- package/dist/chunk-ESO2EM3L.js +46 -0
- package/dist/chunk-EUHEIWHZ.js +32 -0
- package/dist/chunk-FEK5XGZW.js +8 -0
- package/dist/chunk-NKHH23YK.js +31 -0
- package/dist/chunk-R47NEOSI.js +78 -0
- package/dist/chunk-UXAYXRFN.js +69 -0
- package/dist/chunk-X6GATUI2.js +19 -0
- package/dist/components/accordion.d.ts +9 -0
- package/dist/components/accordion.js +53 -0
- package/dist/components/alert-dialog.d.ts +23 -0
- package/dist/components/alert-dialog.js +98 -0
- package/dist/components/alert.d.ts +11 -0
- package/dist/components/alert.js +52 -0
- package/dist/components/aspect-ratio.d.ts +6 -0
- package/dist/components/aspect-ratio.js +2 -0
- package/dist/components/avatar.d.ts +8 -0
- package/dist/components/avatar.js +47 -0
- package/dist/components/badge.d.ts +13 -0
- package/dist/components/badge.js +3 -0
- package/dist/components/breadcrumb.d.ts +14 -0
- package/dist/components/breadcrumb.js +96 -0
- package/dist/components/button.d.ts +16 -0
- package/dist/components/button.js +4 -0
- package/dist/components/calendar.d.ts +11 -0
- package/dist/components/calendar.js +56 -0
- package/dist/components/card.d.ts +13 -0
- package/dist/components/card.js +4 -0
- package/dist/components/carousel.d.ts +24 -0
- package/dist/components/carousel.js +198 -0
- package/dist/components/checkbox.d.ts +6 -0
- package/dist/components/checkbox.js +25 -0
- package/dist/components/collapsible.d.ts +8 -0
- package/dist/components/collapsible.js +26 -0
- package/dist/components/command.d.ts +84 -0
- package/dist/components/command.js +4 -0
- package/dist/components/currency-input.d.ts +17 -0
- package/dist/components/currency-input.js +121 -0
- package/dist/components/dialog.d.ts +22 -0
- package/dist/components/dialog.js +3 -0
- package/dist/components/drawer.d.ts +27 -0
- package/dist/components/drawer.js +85 -0
- package/dist/components/dropdown-menu.d.ts +28 -0
- package/dist/components/dropdown-menu.js +211 -0
- package/dist/components/empty-state.d.ts +22 -0
- package/dist/components/empty-state.js +81 -0
- package/dist/components/form.d.ts +28 -0
- package/dist/components/form.js +97 -0
- package/dist/components/haptic-button.d.ts +12 -0
- package/dist/components/haptic-button.js +17 -0
- package/dist/components/input-otp.d.ts +14 -0
- package/dist/components/input-otp.js +62 -0
- package/dist/components/input.d.ts +6 -0
- package/dist/components/input.js +3 -0
- package/dist/components/label.d.ts +8 -0
- package/dist/components/label.js +3 -0
- package/dist/components/lazy-markdown.d.ts +11 -0
- package/dist/components/lazy-markdown.js +13 -0
- package/dist/components/link-button.d.ts +30 -0
- package/dist/components/link-button.js +17 -0
- package/dist/components/markdown-renderer.d.ts +11 -0
- package/dist/components/markdown-renderer.js +10 -0
- package/dist/components/multi-select-combobox.d.ts +23 -0
- package/dist/components/multi-select-combobox.js +114 -0
- package/dist/components/pagination.d.ts +18 -0
- package/dist/components/pagination.js +101 -0
- package/dist/components/popover.d.ts +8 -0
- package/dist/components/popover.js +3 -0
- package/dist/components/progress.d.ts +6 -0
- package/dist/components/progress.js +30 -0
- package/dist/components/radio-group.d.ts +7 -0
- package/dist/components/radio-group.js +30 -0
- package/dist/components/rating.d.ts +15 -0
- package/dist/components/rating.js +120 -0
- package/dist/components/scroll-area.d.ts +7 -0
- package/dist/components/scroll-area.js +44 -0
- package/dist/components/search-bar.d.ts +17 -0
- package/dist/components/search-bar.js +92 -0
- package/dist/components/searchable-select.d.ts +22 -0
- package/dist/components/searchable-select.js +104 -0
- package/dist/components/select.d.ts +15 -0
- package/dist/components/select.js +129 -0
- package/dist/components/separator.d.ts +6 -0
- package/dist/components/separator.js +25 -0
- package/dist/components/sheet.d.ts +29 -0
- package/dist/components/sheet.js +96 -0
- package/dist/components/skeleton-card.d.ts +13 -0
- package/dist/components/skeleton-card.js +154 -0
- package/dist/components/skeleton.d.ts +6 -0
- package/dist/components/skeleton.js +3 -0
- package/dist/components/slider.d.ts +6 -0
- package/dist/components/slider.js +24 -0
- package/dist/components/sliding-panels.d.ts +19 -0
- package/dist/components/sliding-panels.js +75 -0
- package/dist/components/sonner.d.ts +6 -0
- package/dist/components/sonner.js +23 -0
- package/dist/components/sticky-container.d.ts +44 -0
- package/dist/components/sticky-container.js +39 -0
- package/dist/components/switch.d.ts +6 -0
- package/dist/components/switch.js +31 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +81 -0
- package/dist/components/tabs.d.ts +12 -0
- package/dist/components/tabs.js +55 -0
- package/dist/components/text.d.ts +31 -0
- package/dist/components/text.js +3 -0
- package/dist/components/textarea.d.ts +6 -0
- package/dist/components/textarea.js +23 -0
- package/dist/components/toast.d.ts +18 -0
- package/dist/components/toast.js +3 -0
- package/dist/components/toaster.d.ts +5 -0
- package/dist/components/toaster.js +25 -0
- package/dist/components/toggle-group.d.ts +12 -0
- package/dist/components/toggle-group.js +72 -0
- package/dist/components/toggle.d.ts +13 -0
- package/dist/components/toggle.js +3 -0
- package/dist/components/tooltip.d.ts +9 -0
- package/dist/components/tooltip.js +26 -0
- package/dist/components/use-mobile.d.ts +3 -0
- package/dist/components/use-mobile.js +19 -0
- package/dist/components/use-toast.d.ts +42 -0
- package/dist/components/use-toast.js +2 -0
- package/dist/hooks/use-haptic.d.ts +22 -0
- package/dist/hooks/use-haptic.js +2 -0
- package/dist/hooks/use-mobile.d.ts +3 -0
- package/dist/hooks/use-mobile.js +19 -0
- package/dist/hooks/use-mounted-theme.d.ts +6 -0
- package/dist/hooks/use-mounted-theme.js +18 -0
- package/dist/hooks/use-sticky.d.ts +18 -0
- package/dist/hooks/use-sticky.js +2 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +2 -0
- package/package.json +203 -0
- package/src/components/accordion.tsx +57 -0
- package/src/components/alert-dialog.tsx +116 -0
- package/src/components/alert.tsx +57 -0
- package/src/components/aspect-ratio.tsx +9 -0
- package/src/components/avatar.tsx +49 -0
- package/src/components/badge.tsx +38 -0
- package/src/components/breadcrumb.tsx +102 -0
- package/src/components/button.tsx +94 -0
- package/src/components/calendar.tsx +60 -0
- package/src/components/card.tsx +67 -0
- package/src/components/carousel.tsx +230 -0
- package/src/components/checkbox.tsx +27 -0
- package/src/components/collapsible.tsx +28 -0
- package/src/components/command.tsx +148 -0
- package/src/components/currency-input.tsx +158 -0
- package/src/components/dialog.tsx +103 -0
- package/src/components/drawer.tsx +99 -0
- package/src/components/dropdown-menu.tsx +228 -0
- package/src/components/empty-state.tsx +118 -0
- package/src/components/form.tsx +152 -0
- package/src/components/haptic-button.tsx +19 -0
- package/src/components/input-otp.tsx +70 -0
- package/src/components/input.tsx +23 -0
- package/src/components/label.tsx +20 -0
- package/src/components/lazy-markdown.tsx +20 -0
- package/src/components/link-button.tsx +40 -0
- package/src/components/markdown-renderer.tsx +20 -0
- package/src/components/multi-select-combobox.tsx +148 -0
- package/src/components/pagination.tsx +106 -0
- package/src/components/popover.tsx +30 -0
- package/src/components/progress.tsx +27 -0
- package/src/components/radio-group.tsx +37 -0
- package/src/components/rating.tsx +136 -0
- package/src/components/scroll-area.tsx +45 -0
- package/src/components/search-bar.tsx +113 -0
- package/src/components/searchable-select.tsx +134 -0
- package/src/components/select.tsx +152 -0
- package/src/components/separator.tsx +25 -0
- package/src/components/sheet.tsx +121 -0
- package/src/components/skeleton-card.tsx +282 -0
- package/src/components/skeleton.tsx +17 -0
- package/src/components/slider.tsx +24 -0
- package/src/components/sliding-panels.tsx +99 -0
- package/src/components/sonner.tsx +25 -0
- package/src/components/sticky-container.tsx +88 -0
- package/src/components/switch.tsx +28 -0
- package/src/components/table.tsx +90 -0
- package/src/components/tabs.tsx +72 -0
- package/src/components/text.test.tsx +192 -0
- package/src/components/text.tsx +114 -0
- package/src/components/textarea.tsx +22 -0
- package/src/components/toast.tsx +129 -0
- package/src/components/toaster.tsx +31 -0
- package/src/components/toggle-group.tsx +69 -0
- package/src/components/toggle.tsx +46 -0
- package/src/components/tooltip.tsx +29 -0
- package/src/components/use-mobile.tsx +19 -0
- package/src/components/use-toast.ts +180 -0
- package/src/globals.css +409 -0
- package/src/hooks/use-haptic.ts +118 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/hooks/use-mounted-theme.ts +20 -0
- package/src/hooks/use-sticky.ts +47 -0
- package/src/lib/utils.ts +6 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5
|
+
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
import { cn } from "../lib/utils";
|
|
8
|
+
|
|
9
|
+
function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
|
|
10
|
+
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function DropdownMenuPortal({
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
|
|
16
|
+
return <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function DropdownMenuTrigger({
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
|
|
22
|
+
return <DropdownMenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function DropdownMenuContent({
|
|
26
|
+
className,
|
|
27
|
+
sideOffset = 4,
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
|
|
30
|
+
return (
|
|
31
|
+
<DropdownMenuPrimitive.Portal>
|
|
32
|
+
<DropdownMenuPrimitive.Content
|
|
33
|
+
data-slot="dropdown-menu-content"
|
|
34
|
+
sideOffset={sideOffset}
|
|
35
|
+
className={cn(
|
|
36
|
+
"bg-card text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 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-xl border border-border p-1 shadow-lg",
|
|
37
|
+
className
|
|
38
|
+
)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
</DropdownMenuPrimitive.Portal>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
|
|
46
|
+
return <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function DropdownMenuItem({
|
|
50
|
+
className,
|
|
51
|
+
inset,
|
|
52
|
+
variant = "default",
|
|
53
|
+
...props
|
|
54
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
55
|
+
inset?: boolean;
|
|
56
|
+
variant?: "default" | "destructive";
|
|
57
|
+
}) {
|
|
58
|
+
return (
|
|
59
|
+
<DropdownMenuPrimitive.Item
|
|
60
|
+
data-slot="dropdown-menu-item"
|
|
61
|
+
data-inset={inset}
|
|
62
|
+
data-variant={variant}
|
|
63
|
+
className={cn(
|
|
64
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
65
|
+
className
|
|
66
|
+
)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function DropdownMenuCheckboxItem({
|
|
73
|
+
className,
|
|
74
|
+
children,
|
|
75
|
+
checked,
|
|
76
|
+
...props
|
|
77
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
|
|
78
|
+
return (
|
|
79
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
80
|
+
data-slot="dropdown-menu-checkbox-item"
|
|
81
|
+
className={cn(
|
|
82
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
83
|
+
className
|
|
84
|
+
)}
|
|
85
|
+
checked={checked}
|
|
86
|
+
{...props}
|
|
87
|
+
>
|
|
88
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
89
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
90
|
+
<CheckIcon className="size-4" />
|
|
91
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
92
|
+
</span>
|
|
93
|
+
{children}
|
|
94
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function DropdownMenuRadioGroup({
|
|
99
|
+
...props
|
|
100
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
|
|
101
|
+
return <DropdownMenuPrimitive.RadioGroup data-slot="dropdown-menu-radio-group" {...props} />;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function DropdownMenuRadioItem({
|
|
105
|
+
className,
|
|
106
|
+
children,
|
|
107
|
+
...props
|
|
108
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
|
|
109
|
+
return (
|
|
110
|
+
<DropdownMenuPrimitive.RadioItem
|
|
111
|
+
data-slot="dropdown-menu-radio-item"
|
|
112
|
+
className={cn(
|
|
113
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
114
|
+
className
|
|
115
|
+
)}
|
|
116
|
+
{...props}
|
|
117
|
+
>
|
|
118
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
119
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
120
|
+
<CircleIcon className="size-2 fill-current" />
|
|
121
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
122
|
+
</span>
|
|
123
|
+
{children}
|
|
124
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function DropdownMenuLabel({
|
|
129
|
+
className,
|
|
130
|
+
inset,
|
|
131
|
+
...props
|
|
132
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
133
|
+
inset?: boolean;
|
|
134
|
+
}) {
|
|
135
|
+
return (
|
|
136
|
+
<DropdownMenuPrimitive.Label
|
|
137
|
+
data-slot="dropdown-menu-label"
|
|
138
|
+
data-inset={inset}
|
|
139
|
+
className={cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className)}
|
|
140
|
+
{...props}
|
|
141
|
+
/>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function DropdownMenuSeparator({
|
|
146
|
+
className,
|
|
147
|
+
...props
|
|
148
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
|
149
|
+
return (
|
|
150
|
+
<DropdownMenuPrimitive.Separator
|
|
151
|
+
data-slot="dropdown-menu-separator"
|
|
152
|
+
className={cn("bg-border -mx-1 my-1 h-px", className)}
|
|
153
|
+
{...props}
|
|
154
|
+
/>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">) {
|
|
159
|
+
return (
|
|
160
|
+
<span
|
|
161
|
+
data-slot="dropdown-menu-shortcut"
|
|
162
|
+
className={cn("text-muted-foreground ml-auto text-xs tracking-widest", className)}
|
|
163
|
+
{...props}
|
|
164
|
+
/>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
|
|
169
|
+
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function DropdownMenuSubTrigger({
|
|
173
|
+
className,
|
|
174
|
+
inset,
|
|
175
|
+
children,
|
|
176
|
+
...props
|
|
177
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
178
|
+
inset?: boolean;
|
|
179
|
+
}) {
|
|
180
|
+
return (
|
|
181
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
182
|
+
data-slot="dropdown-menu-sub-trigger"
|
|
183
|
+
data-inset={inset}
|
|
184
|
+
className={cn(
|
|
185
|
+
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",
|
|
186
|
+
className
|
|
187
|
+
)}
|
|
188
|
+
{...props}
|
|
189
|
+
>
|
|
190
|
+
{children}
|
|
191
|
+
<ChevronRightIcon className="ml-auto size-4" />
|
|
192
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function DropdownMenuSubContent({
|
|
197
|
+
className,
|
|
198
|
+
...props
|
|
199
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
|
200
|
+
return (
|
|
201
|
+
<DropdownMenuPrimitive.SubContent
|
|
202
|
+
data-slot="dropdown-menu-sub-content"
|
|
203
|
+
className={cn(
|
|
204
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
|
|
205
|
+
className
|
|
206
|
+
)}
|
|
207
|
+
{...props}
|
|
208
|
+
/>
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export {
|
|
213
|
+
DropdownMenu,
|
|
214
|
+
DropdownMenuPortal,
|
|
215
|
+
DropdownMenuTrigger,
|
|
216
|
+
DropdownMenuContent,
|
|
217
|
+
DropdownMenuGroup,
|
|
218
|
+
DropdownMenuLabel,
|
|
219
|
+
DropdownMenuItem,
|
|
220
|
+
DropdownMenuCheckboxItem,
|
|
221
|
+
DropdownMenuRadioGroup,
|
|
222
|
+
DropdownMenuRadioItem,
|
|
223
|
+
DropdownMenuSeparator,
|
|
224
|
+
DropdownMenuShortcut,
|
|
225
|
+
DropdownMenuSub,
|
|
226
|
+
DropdownMenuSubTrigger,
|
|
227
|
+
DropdownMenuSubContent,
|
|
228
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
import { Button } from "./button";
|
|
6
|
+
import { Text } from "./text";
|
|
7
|
+
import { Search, AlertCircle, FileX } from "lucide-react";
|
|
8
|
+
|
|
9
|
+
type EmptyStateAction = {
|
|
10
|
+
label: string;
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
interface EmptyStateProps {
|
|
15
|
+
title: string;
|
|
16
|
+
description: string;
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
illustration?: React.ReactNode;
|
|
19
|
+
action?: EmptyStateAction;
|
|
20
|
+
secondaryAction?: EmptyStateAction;
|
|
21
|
+
variant?: "default" | "search" | "error";
|
|
22
|
+
size?: "sm" | "md" | "lg";
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const sizeStyles = {
|
|
27
|
+
sm: "py-8 px-4",
|
|
28
|
+
md: "py-12 px-6",
|
|
29
|
+
lg: "py-16 px-8",
|
|
30
|
+
} as const;
|
|
31
|
+
|
|
32
|
+
const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
|
|
33
|
+
(
|
|
34
|
+
{
|
|
35
|
+
title,
|
|
36
|
+
description,
|
|
37
|
+
icon,
|
|
38
|
+
illustration,
|
|
39
|
+
action,
|
|
40
|
+
secondaryAction,
|
|
41
|
+
variant = "default",
|
|
42
|
+
size = "md",
|
|
43
|
+
className,
|
|
44
|
+
...props
|
|
45
|
+
},
|
|
46
|
+
ref
|
|
47
|
+
) => {
|
|
48
|
+
const getDefaultIcon = () => {
|
|
49
|
+
switch (variant) {
|
|
50
|
+
case "search":
|
|
51
|
+
return <Search className="h-12 w-12 text-muted-foreground/50" />;
|
|
52
|
+
case "error":
|
|
53
|
+
return <AlertCircle className="h-12 w-12 text-destructive/50" />;
|
|
54
|
+
default:
|
|
55
|
+
return <FileX className="h-12 w-12 text-muted-foreground/50" />;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const textColor = variant === "error" ? "destructive" : "muted";
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div
|
|
63
|
+
ref={ref}
|
|
64
|
+
role="status"
|
|
65
|
+
className={cn(
|
|
66
|
+
"flex flex-col items-center justify-center text-center",
|
|
67
|
+
sizeStyles[size],
|
|
68
|
+
className
|
|
69
|
+
)}
|
|
70
|
+
{...props}
|
|
71
|
+
>
|
|
72
|
+
{illustration ? (
|
|
73
|
+
<div className="mb-6">{illustration}</div>
|
|
74
|
+
) : (
|
|
75
|
+
<div className="mb-4">{icon || getDefaultIcon()}</div>
|
|
76
|
+
)}
|
|
77
|
+
|
|
78
|
+
<Text as="h3" weight="semibold" color={textColor} className="text-lg mb-2">
|
|
79
|
+
{title}
|
|
80
|
+
</Text>
|
|
81
|
+
|
|
82
|
+
<Text as="p" color={textColor} className="text-sm max-w-md mb-6">
|
|
83
|
+
{description}
|
|
84
|
+
</Text>
|
|
85
|
+
|
|
86
|
+
{(action || secondaryAction) && (
|
|
87
|
+
<div className="flex items-center gap-3">
|
|
88
|
+
{action && (
|
|
89
|
+
<Button onClick={action.onClick} variant="default" className="glass-hover">
|
|
90
|
+
{action.label}
|
|
91
|
+
</Button>
|
|
92
|
+
)}
|
|
93
|
+
{secondaryAction && (
|
|
94
|
+
<Button onClick={secondaryAction.onClick} variant="outline" className="glass-hover">
|
|
95
|
+
{secondaryAction.label}
|
|
96
|
+
</Button>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
)}
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
EmptyState.displayName = "EmptyState";
|
|
106
|
+
|
|
107
|
+
const SearchEmptyState = React.forwardRef<
|
|
108
|
+
HTMLDivElement,
|
|
109
|
+
Omit<EmptyStateProps, "variant" | "icon">
|
|
110
|
+
>((props, ref) => <EmptyState ref={ref} variant="search" {...props} />);
|
|
111
|
+
SearchEmptyState.displayName = "SearchEmptyState";
|
|
112
|
+
|
|
113
|
+
const ErrorEmptyState = React.forwardRef<HTMLDivElement, Omit<EmptyStateProps, "variant" | "icon">>(
|
|
114
|
+
(props, ref) => <EmptyState ref={ref} variant="error" {...props} />
|
|
115
|
+
);
|
|
116
|
+
ErrorEmptyState.displayName = "ErrorEmptyState";
|
|
117
|
+
|
|
118
|
+
export { EmptyState, SearchEmptyState, ErrorEmptyState };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
5
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
6
|
+
import {
|
|
7
|
+
Controller,
|
|
8
|
+
FormProvider,
|
|
9
|
+
useFormContext,
|
|
10
|
+
useFormState,
|
|
11
|
+
type ControllerProps,
|
|
12
|
+
type FieldPath,
|
|
13
|
+
type FieldValues,
|
|
14
|
+
} from "react-hook-form";
|
|
15
|
+
|
|
16
|
+
import { cn } from "../lib/utils";
|
|
17
|
+
import { Label } from "./label";
|
|
18
|
+
|
|
19
|
+
const Form = FormProvider;
|
|
20
|
+
|
|
21
|
+
type FormFieldContextValue<
|
|
22
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
23
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
24
|
+
> = {
|
|
25
|
+
name: TName;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue);
|
|
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>({} as FormItemContextValue);
|
|
71
|
+
|
|
72
|
+
function FormItem({ className, ...props }: React.ComponentProps<"div">) {
|
|
73
|
+
const id = React.useId();
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<FormItemContext.Provider value={{ id }}>
|
|
77
|
+
<div data-slot="form-item" className={cn("grid gap-2", className)} {...props} />
|
|
78
|
+
</FormItemContext.Provider>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function FormLabel({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
83
|
+
const { error, formItemId } = useFormField();
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Label
|
|
87
|
+
data-slot="form-label"
|
|
88
|
+
data-error={!!error}
|
|
89
|
+
className={cn("data-[error=true]:text-destructive", className)}
|
|
90
|
+
htmlFor={formItemId}
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function FormControl({ ...props }: React.ComponentProps<typeof Slot>) {
|
|
97
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<Slot
|
|
101
|
+
data-slot="form-control"
|
|
102
|
+
id={formItemId}
|
|
103
|
+
aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}
|
|
104
|
+
aria-invalid={!!error}
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function FormDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
111
|
+
const { formDescriptionId } = useFormField();
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<p
|
|
115
|
+
data-slot="form-description"
|
|
116
|
+
id={formDescriptionId}
|
|
117
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
118
|
+
{...props}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function FormMessage({ className, ...props }: React.ComponentProps<"p">) {
|
|
124
|
+
const { error, formMessageId } = useFormField();
|
|
125
|
+
const body = error ? String(error?.message ?? "") : props.children;
|
|
126
|
+
|
|
127
|
+
if (!body) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<p
|
|
133
|
+
data-slot="form-message"
|
|
134
|
+
id={formMessageId}
|
|
135
|
+
className={cn("text-destructive text-sm", className)}
|
|
136
|
+
{...props}
|
|
137
|
+
>
|
|
138
|
+
{body}
|
|
139
|
+
</p>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export {
|
|
144
|
+
useFormField,
|
|
145
|
+
Form,
|
|
146
|
+
FormItem,
|
|
147
|
+
FormLabel,
|
|
148
|
+
FormControl,
|
|
149
|
+
FormDescription,
|
|
150
|
+
FormMessage,
|
|
151
|
+
FormField,
|
|
152
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Button, type ButtonProps } from "./button";
|
|
4
|
+
import { useHaptic } from "../hooks/use-haptic";
|
|
5
|
+
|
|
6
|
+
interface HapticButtonProps extends ButtonProps {
|
|
7
|
+
hapticStyle?: "light" | "medium" | "heavy";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function HapticButton({ hapticStyle = "light", onClick, ...props }: HapticButtonProps) {
|
|
11
|
+
const { trigger } = useHaptic();
|
|
12
|
+
|
|
13
|
+
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
14
|
+
trigger(hapticStyle);
|
|
15
|
+
onClick?.(e);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return <Button onClick={handleClick} {...props} />;
|
|
19
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { OTPInput, OTPInputContext } from "input-otp";
|
|
5
|
+
import { MinusIcon } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
import { cn } from "../lib/utils";
|
|
8
|
+
|
|
9
|
+
function InputOTP({
|
|
10
|
+
className,
|
|
11
|
+
containerClassName,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof OTPInput> & {
|
|
14
|
+
containerClassName?: string;
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<OTPInput
|
|
18
|
+
data-slot="input-otp"
|
|
19
|
+
containerClassName={cn("flex items-center gap-2 has-disabled:opacity-50", containerClassName)}
|
|
20
|
+
className={cn("disabled:cursor-not-allowed", className)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
27
|
+
return (
|
|
28
|
+
<div data-slot="input-otp-group" className={cn("flex items-center", className)} {...props} />
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function InputOTPSlot({
|
|
33
|
+
index,
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}: React.ComponentProps<"div"> & {
|
|
37
|
+
index: number;
|
|
38
|
+
}) {
|
|
39
|
+
const inputOTPContext = React.useContext(OTPInputContext);
|
|
40
|
+
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
data-slot="input-otp-slot"
|
|
45
|
+
data-active={isActive}
|
|
46
|
+
className={cn(
|
|
47
|
+
"data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-base shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",
|
|
48
|
+
className
|
|
49
|
+
)}
|
|
50
|
+
{...props}
|
|
51
|
+
>
|
|
52
|
+
{char}
|
|
53
|
+
{hasFakeCaret && (
|
|
54
|
+
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
55
|
+
<div className="animate-caret-blink bg-foreground h-4 w-px duration-1000" />
|
|
56
|
+
</div>
|
|
57
|
+
)}
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
|
|
63
|
+
return (
|
|
64
|
+
<div data-slot="input-otp-separator" role="separator" {...props}>
|
|
65
|
+
<MinusIcon />
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "../lib/utils";
|
|
3
|
+
|
|
4
|
+
export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
|
|
5
|
+
|
|
6
|
+
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
7
|
+
({ className, type, ...props }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<input
|
|
10
|
+
type={type}
|
|
11
|
+
className={cn(
|
|
12
|
+
"flex h-11 w-full rounded-xl border border-border bg-input/50 backdrop-blur-md px-4 py-2 text-base transition-all duration-300 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:bg-input focus-visible:border-accent-foreground/30 focus-visible:shadow-lg focus-visible:shadow-accent/10 disabled:cursor-not-allowed disabled:opacity-50",
|
|
13
|
+
className
|
|
14
|
+
)}
|
|
15
|
+
ref={ref}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
Input.displayName = "Input";
|
|
22
|
+
|
|
23
|
+
export { Input };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
5
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
|
+
import { cn } from "../lib/utils";
|
|
7
|
+
|
|
8
|
+
const labelVariants = cva(
|
|
9
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 transition-all duration-200"
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const Label = React.forwardRef<
|
|
13
|
+
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
14
|
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>
|
|
15
|
+
>(({ className, ...props }, ref) => (
|
|
16
|
+
<LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />
|
|
17
|
+
));
|
|
18
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
19
|
+
|
|
20
|
+
export { Label };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import dynamic from "next/dynamic";
|
|
4
|
+
import type { Components } from "react-markdown";
|
|
5
|
+
|
|
6
|
+
// Dynamically imported to keep react-markdown + remark-gfm out of the initial bundle.
|
|
7
|
+
const MarkdownRendererDynamic = dynamic(
|
|
8
|
+
() => import("./markdown-renderer").then((m) => m.MarkdownRenderer),
|
|
9
|
+
{ ssr: false }
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
type LazyMarkdownProps = {
|
|
13
|
+
content: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
components?: Components;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function LazyMarkdown(props: LazyMarkdownProps) {
|
|
19
|
+
return <MarkdownRendererDynamic {...props} />;
|
|
20
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import { Button, ButtonProps } from "./button";
|
|
4
|
+
|
|
5
|
+
export interface LinkButtonProps extends Omit<ButtonProps, "asChild"> {
|
|
6
|
+
href: string;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* LinkButton - A semantically correct button that navigates using Next.js Link
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* Combines the visual styling of Button with proper link semantics for navigation.
|
|
15
|
+
* Use this instead of Button with onClick for navigation to get:
|
|
16
|
+
* - Proper HTML semantics (<a> tag)
|
|
17
|
+
* - Right-click "Open in new tab"
|
|
18
|
+
* - Cmd/Ctrl+click to open in new tab
|
|
19
|
+
* - Better SEO and accessibility
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <LinkButton href="/menu/dishes/123" variant="default" size="sm">
|
|
24
|
+
* View Details
|
|
25
|
+
* </LinkButton>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export const LinkButton = React.forwardRef<HTMLAnchorElement, LinkButtonProps>(
|
|
29
|
+
({ href, children, ...buttonProps }, ref) => {
|
|
30
|
+
return (
|
|
31
|
+
<Button {...buttonProps} asChild>
|
|
32
|
+
<Link href={href} ref={ref}>
|
|
33
|
+
{children}
|
|
34
|
+
</Link>
|
|
35
|
+
</Button>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
LinkButton.displayName = "LinkButton";
|