howone 0.0.3 → 0.0.5
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/package.json +1 -1
- package/templates/nextjs/.prettierignore +7 -0
- package/templates/nextjs/.prettierrc +11 -0
- package/templates/nextjs/README.md +12 -27
- package/templates/nextjs/app/globals.css +123 -40
- package/templates/nextjs/app/layout.tsx +19 -19
- package/templates/nextjs/app/page.tsx +13 -60
- package/templates/nextjs/bun.lock +925 -53
- package/templates/nextjs/components/.gitkeep +0 -0
- package/templates/nextjs/components/theme-provider.tsx +71 -0
- package/templates/nextjs/components/ui/accordion.tsx +81 -0
- package/templates/nextjs/components/ui/alert-dialog.tsx +199 -0
- package/templates/nextjs/components/ui/alert.tsx +76 -0
- package/templates/nextjs/components/ui/aspect-ratio.tsx +11 -0
- package/templates/nextjs/components/ui/avatar.tsx +112 -0
- package/templates/nextjs/components/ui/badge.tsx +49 -0
- package/templates/nextjs/components/ui/breadcrumb.tsx +122 -0
- package/templates/nextjs/components/ui/button-group.tsx +83 -0
- package/templates/nextjs/components/ui/button.tsx +67 -0
- package/templates/nextjs/components/ui/calendar.tsx +222 -0
- package/templates/nextjs/components/ui/card.tsx +103 -0
- package/templates/nextjs/components/ui/carousel.tsx +242 -0
- package/templates/nextjs/components/ui/chart.tsx +373 -0
- package/templates/nextjs/components/ui/checkbox.tsx +33 -0
- package/templates/nextjs/components/ui/collapsible.tsx +33 -0
- package/templates/nextjs/components/ui/combobox.tsx +299 -0
- package/templates/nextjs/components/ui/command.tsx +195 -0
- package/templates/nextjs/components/ui/context-menu.tsx +263 -0
- package/templates/nextjs/components/ui/dialog.tsx +168 -0
- package/templates/nextjs/components/ui/direction.tsx +22 -0
- package/templates/nextjs/components/ui/drawer.tsx +134 -0
- package/templates/nextjs/components/ui/dropdown-menu.tsx +269 -0
- package/templates/nextjs/components/ui/empty.tsx +104 -0
- package/templates/nextjs/components/ui/field.tsx +238 -0
- package/templates/nextjs/components/ui/hover-card.tsx +44 -0
- package/templates/nextjs/components/ui/input-group.tsx +156 -0
- package/templates/nextjs/components/ui/input-otp.tsx +87 -0
- package/templates/nextjs/components/ui/input.tsx +19 -0
- package/templates/nextjs/components/ui/item.tsx +196 -0
- package/templates/nextjs/components/ui/kbd.tsx +26 -0
- package/templates/nextjs/components/ui/label.tsx +24 -0
- package/templates/nextjs/components/ui/menubar.tsx +280 -0
- package/templates/nextjs/components/ui/native-select.tsx +61 -0
- package/templates/nextjs/components/ui/navigation-menu.tsx +164 -0
- package/templates/nextjs/components/ui/pagination.tsx +129 -0
- package/templates/nextjs/components/ui/popover.tsx +89 -0
- package/templates/nextjs/components/ui/progress.tsx +31 -0
- package/templates/nextjs/components/ui/radio-group.tsx +44 -0
- package/templates/nextjs/components/ui/resizable.tsx +50 -0
- package/templates/nextjs/components/ui/scroll-area.tsx +55 -0
- package/templates/nextjs/components/ui/select.tsx +192 -0
- package/templates/nextjs/components/ui/separator.tsx +28 -0
- package/templates/nextjs/components/ui/sheet.tsx +147 -0
- package/templates/nextjs/components/ui/sidebar.tsx +702 -0
- package/templates/nextjs/components/ui/skeleton.tsx +13 -0
- package/templates/nextjs/components/ui/slider.tsx +59 -0
- package/templates/nextjs/components/ui/sonner.tsx +49 -0
- package/templates/nextjs/components/ui/spinner.tsx +10 -0
- package/templates/nextjs/components/ui/switch.tsx +33 -0
- package/templates/nextjs/components/ui/table.tsx +116 -0
- package/templates/nextjs/components/ui/tabs.tsx +90 -0
- package/templates/nextjs/components/ui/textarea.tsx +18 -0
- package/templates/nextjs/components/ui/toggle-group.tsx +89 -0
- package/templates/nextjs/components/ui/toggle.tsx +47 -0
- package/templates/nextjs/components/ui/tooltip.tsx +57 -0
- package/templates/nextjs/components.json +25 -0
- package/templates/nextjs/hooks/.gitkeep +0 -0
- package/templates/nextjs/hooks/use-mobile.ts +19 -0
- package/templates/nextjs/lib/.gitkeep +0 -0
- package/templates/nextjs/lib/sdk.ts +7 -0
- package/templates/nextjs/lib/utils.ts +6 -0
- package/templates/nextjs/next.config.mjs +4 -0
- package/templates/vite/.prettierignore +7 -0
- package/templates/vite/.prettierrc +11 -0
- package/templates/vite/AGENTS.md +0 -0
- package/templates/vite/README.md +12 -64
- package/templates/vite/bun.lock +1478 -0
- package/templates/vite/components.json +25 -0
- package/templates/vite/eslint.config.js +1 -0
- package/templates/vite/index.html +2 -2
- package/templates/vite/package.json +39 -13
- package/templates/vite/public/vite.svg +1 -0
- package/templates/vite/src/App.tsx +6 -115
- package/templates/vite/src/components/theme-provider.tsx +230 -0
- package/templates/vite/src/components/ui/accordion.tsx +79 -0
- package/templates/vite/src/components/ui/alert-dialog.tsx +197 -0
- package/templates/vite/src/components/ui/alert.tsx +76 -0
- package/templates/vite/src/components/ui/aspect-ratio.tsx +11 -0
- package/templates/vite/src/components/ui/avatar.tsx +110 -0
- package/templates/vite/src/components/ui/badge.tsx +49 -0
- package/templates/vite/src/components/ui/breadcrumb.tsx +122 -0
- package/templates/vite/src/components/ui/button-group.tsx +83 -0
- package/templates/vite/src/components/ui/button.tsx +67 -0
- package/templates/vite/src/components/ui/calendar.tsx +222 -0
- package/templates/vite/src/components/ui/card.tsx +103 -0
- package/templates/vite/src/components/ui/carousel.tsx +240 -0
- package/templates/vite/src/components/ui/chart.tsx +373 -0
- package/templates/vite/src/components/ui/checkbox.tsx +31 -0
- package/templates/vite/src/components/ui/collapsible.tsx +33 -0
- package/templates/vite/src/components/ui/combobox.tsx +299 -0
- package/templates/vite/src/components/ui/command.tsx +193 -0
- package/templates/vite/src/components/ui/context-menu.tsx +261 -0
- package/templates/vite/src/components/ui/dialog.tsx +168 -0
- package/templates/vite/src/components/ui/direction.tsx +22 -0
- package/templates/vite/src/components/ui/drawer.tsx +132 -0
- package/templates/vite/src/components/ui/dropdown-menu.tsx +269 -0
- package/templates/vite/src/components/ui/empty.tsx +104 -0
- package/templates/vite/src/components/ui/field.tsx +238 -0
- package/templates/vite/src/components/ui/hover-card.tsx +42 -0
- package/templates/vite/src/components/ui/input-group.tsx +154 -0
- package/templates/vite/src/components/ui/input-otp.tsx +87 -0
- package/templates/vite/src/components/ui/input.tsx +19 -0
- package/templates/vite/src/components/ui/item.tsx +196 -0
- package/templates/vite/src/components/ui/kbd.tsx +26 -0
- package/templates/vite/src/components/ui/label.tsx +22 -0
- package/templates/vite/src/components/ui/menubar.tsx +280 -0
- package/templates/vite/src/components/ui/native-select.tsx +61 -0
- package/templates/vite/src/components/ui/navigation-menu.tsx +164 -0
- package/templates/vite/src/components/ui/pagination.tsx +129 -0
- package/templates/vite/src/components/ui/popover.tsx +87 -0
- package/templates/vite/src/components/ui/progress.tsx +31 -0
- package/templates/vite/src/components/ui/radio-group.tsx +42 -0
- package/templates/vite/src/components/ui/resizable.tsx +50 -0
- package/templates/vite/src/components/ui/scroll-area.tsx +53 -0
- package/templates/vite/src/components/ui/select.tsx +192 -0
- package/templates/vite/src/components/ui/separator.tsx +26 -0
- package/templates/vite/src/components/ui/sheet.tsx +145 -0
- package/templates/vite/src/components/ui/sidebar.tsx +700 -0
- package/templates/vite/src/components/ui/skeleton.tsx +13 -0
- package/templates/vite/src/components/ui/slider.tsx +59 -0
- package/templates/vite/src/components/ui/sonner.tsx +47 -0
- package/templates/vite/src/components/ui/spinner.tsx +10 -0
- package/templates/vite/src/components/ui/switch.tsx +33 -0
- package/templates/vite/src/components/ui/table.tsx +114 -0
- package/templates/vite/src/components/ui/tabs.tsx +90 -0
- package/templates/vite/src/components/ui/textarea.tsx +18 -0
- package/templates/vite/src/components/ui/toggle-group.tsx +89 -0
- package/templates/vite/src/components/ui/toggle.tsx +45 -0
- package/templates/vite/src/components/ui/tooltip.tsx +57 -0
- package/templates/vite/src/hooks/use-mobile.ts +19 -0
- package/templates/vite/src/index.css +125 -103
- package/templates/vite/src/lib/sdk.ts +7 -0
- package/templates/vite/src/lib/utils.ts +6 -0
- package/templates/vite/src/main.tsx +11 -7
- package/templates/vite/tsconfig.app.json +11 -4
- package/templates/vite/tsconfig.json +7 -1
- package/templates/vite/tsconfig.node.json +5 -3
- package/templates/vite/vite.config.ts +10 -3
- package/templates/nextjs/AGENTS.md +0 -5
- package/templates/nextjs/CLAUDE.md +0 -1
- package/templates/nextjs/app/page.module.css +0 -142
- package/templates/nextjs/gitignore +0 -41
- package/templates/nextjs/next-env.d.ts +0 -6
- package/templates/nextjs/next.config.ts +0 -7
- package/templates/nextjs/package.json +0 -32
- package/templates/nextjs/public/file.svg +0 -1
- package/templates/nextjs/public/globe.svg +0 -1
- package/templates/nextjs/public/next.svg +0 -1
- package/templates/nextjs/public/vercel.svg +0 -1
- package/templates/nextjs/public/window.svg +0 -1
- package/templates/nextjs/tsconfig.json +0 -34
- package/templates/vite/gitignore +0 -24
- package/templates/vite/public/favicon.svg +0 -1
- package/templates/vite/public/icons.svg +0 -24
- package/templates/vite/src/App.css +0 -184
- package/templates/vite/src/assets/hero.png +0 -0
- package/templates/vite/src/assets/vite.svg +0 -1
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Combobox as ComboboxPrimitive } from "@base-ui/react"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
import { Button } from "@/components/ui/button"
|
|
8
|
+
import {
|
|
9
|
+
InputGroup,
|
|
10
|
+
InputGroupAddon,
|
|
11
|
+
InputGroupButton,
|
|
12
|
+
InputGroupInput,
|
|
13
|
+
} from "@/components/ui/input-group"
|
|
14
|
+
import { ChevronDownIcon, XIcon, CheckIcon } from "lucide-react"
|
|
15
|
+
|
|
16
|
+
const Combobox = ComboboxPrimitive.Root
|
|
17
|
+
|
|
18
|
+
function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {
|
|
19
|
+
return <ComboboxPrimitive.Value data-slot="combobox-value" {...props} />
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ComboboxTrigger({
|
|
23
|
+
className,
|
|
24
|
+
children,
|
|
25
|
+
...props
|
|
26
|
+
}: ComboboxPrimitive.Trigger.Props) {
|
|
27
|
+
return (
|
|
28
|
+
<ComboboxPrimitive.Trigger
|
|
29
|
+
data-slot="combobox-trigger"
|
|
30
|
+
className={cn("[&_svg:not([class*='size-'])]:size-4", className)}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
<ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
|
|
35
|
+
</ComboboxPrimitive.Trigger>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {
|
|
40
|
+
return (
|
|
41
|
+
<ComboboxPrimitive.Clear
|
|
42
|
+
data-slot="combobox-clear"
|
|
43
|
+
render={<InputGroupButton variant="ghost" size="icon-xs" />}
|
|
44
|
+
className={cn(className)}
|
|
45
|
+
{...props}
|
|
46
|
+
>
|
|
47
|
+
<XIcon className="pointer-events-none" />
|
|
48
|
+
</ComboboxPrimitive.Clear>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function ComboboxInput({
|
|
53
|
+
className,
|
|
54
|
+
children,
|
|
55
|
+
disabled = false,
|
|
56
|
+
showTrigger = true,
|
|
57
|
+
showClear = false,
|
|
58
|
+
...props
|
|
59
|
+
}: ComboboxPrimitive.Input.Props & {
|
|
60
|
+
showTrigger?: boolean
|
|
61
|
+
showClear?: boolean
|
|
62
|
+
}) {
|
|
63
|
+
return (
|
|
64
|
+
<InputGroup className={cn("w-auto", className)}>
|
|
65
|
+
<ComboboxPrimitive.Input
|
|
66
|
+
render={<InputGroupInput disabled={disabled} />}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
<InputGroupAddon align="inline-end">
|
|
70
|
+
{showTrigger && (
|
|
71
|
+
<InputGroupButton
|
|
72
|
+
size="icon-xs"
|
|
73
|
+
variant="ghost"
|
|
74
|
+
asChild
|
|
75
|
+
data-slot="input-group-button"
|
|
76
|
+
className="group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent"
|
|
77
|
+
disabled={disabled}
|
|
78
|
+
>
|
|
79
|
+
<ComboboxTrigger />
|
|
80
|
+
</InputGroupButton>
|
|
81
|
+
)}
|
|
82
|
+
{showClear && <ComboboxClear disabled={disabled} />}
|
|
83
|
+
</InputGroupAddon>
|
|
84
|
+
{children}
|
|
85
|
+
</InputGroup>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function ComboboxContent({
|
|
90
|
+
className,
|
|
91
|
+
side = "bottom",
|
|
92
|
+
sideOffset = 6,
|
|
93
|
+
align = "start",
|
|
94
|
+
alignOffset = 0,
|
|
95
|
+
anchor,
|
|
96
|
+
...props
|
|
97
|
+
}: ComboboxPrimitive.Popup.Props &
|
|
98
|
+
Pick<
|
|
99
|
+
ComboboxPrimitive.Positioner.Props,
|
|
100
|
+
"side" | "align" | "sideOffset" | "alignOffset" | "anchor"
|
|
101
|
+
>) {
|
|
102
|
+
return (
|
|
103
|
+
<ComboboxPrimitive.Portal>
|
|
104
|
+
<ComboboxPrimitive.Positioner
|
|
105
|
+
side={side}
|
|
106
|
+
sideOffset={sideOffset}
|
|
107
|
+
align={align}
|
|
108
|
+
alignOffset={alignOffset}
|
|
109
|
+
anchor={anchor}
|
|
110
|
+
className="isolate z-50"
|
|
111
|
+
>
|
|
112
|
+
<ComboboxPrimitive.Popup
|
|
113
|
+
data-slot="combobox-content"
|
|
114
|
+
data-chips={!!anchor}
|
|
115
|
+
className={cn("group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )}
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
</ComboboxPrimitive.Positioner>
|
|
119
|
+
</ComboboxPrimitive.Portal>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {
|
|
124
|
+
return (
|
|
125
|
+
<ComboboxPrimitive.List
|
|
126
|
+
data-slot="combobox-list"
|
|
127
|
+
className={cn(
|
|
128
|
+
"no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0",
|
|
129
|
+
className
|
|
130
|
+
)}
|
|
131
|
+
{...props}
|
|
132
|
+
/>
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function ComboboxItem({
|
|
137
|
+
className,
|
|
138
|
+
children,
|
|
139
|
+
...props
|
|
140
|
+
}: ComboboxPrimitive.Item.Props) {
|
|
141
|
+
return (
|
|
142
|
+
<ComboboxPrimitive.Item
|
|
143
|
+
data-slot="combobox-item"
|
|
144
|
+
className={cn(
|
|
145
|
+
"relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**: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",
|
|
146
|
+
className
|
|
147
|
+
)}
|
|
148
|
+
{...props}
|
|
149
|
+
>
|
|
150
|
+
{children}
|
|
151
|
+
<ComboboxPrimitive.ItemIndicator
|
|
152
|
+
render={
|
|
153
|
+
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
|
|
154
|
+
}
|
|
155
|
+
>
|
|
156
|
+
<CheckIcon className="pointer-events-none" />
|
|
157
|
+
</ComboboxPrimitive.ItemIndicator>
|
|
158
|
+
</ComboboxPrimitive.Item>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {
|
|
163
|
+
return (
|
|
164
|
+
<ComboboxPrimitive.Group
|
|
165
|
+
data-slot="combobox-group"
|
|
166
|
+
className={cn(className)}
|
|
167
|
+
{...props}
|
|
168
|
+
/>
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function ComboboxLabel({
|
|
173
|
+
className,
|
|
174
|
+
...props
|
|
175
|
+
}: ComboboxPrimitive.GroupLabel.Props) {
|
|
176
|
+
return (
|
|
177
|
+
<ComboboxPrimitive.GroupLabel
|
|
178
|
+
data-slot="combobox-label"
|
|
179
|
+
className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
|
|
180
|
+
{...props}
|
|
181
|
+
/>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {
|
|
186
|
+
return (
|
|
187
|
+
<ComboboxPrimitive.Collection data-slot="combobox-collection" {...props} />
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {
|
|
192
|
+
return (
|
|
193
|
+
<ComboboxPrimitive.Empty
|
|
194
|
+
data-slot="combobox-empty"
|
|
195
|
+
className={cn(
|
|
196
|
+
"hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex",
|
|
197
|
+
className
|
|
198
|
+
)}
|
|
199
|
+
{...props}
|
|
200
|
+
/>
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function ComboboxSeparator({
|
|
205
|
+
className,
|
|
206
|
+
...props
|
|
207
|
+
}: ComboboxPrimitive.Separator.Props) {
|
|
208
|
+
return (
|
|
209
|
+
<ComboboxPrimitive.Separator
|
|
210
|
+
data-slot="combobox-separator"
|
|
211
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
212
|
+
{...props}
|
|
213
|
+
/>
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function ComboboxChips({
|
|
218
|
+
className,
|
|
219
|
+
...props
|
|
220
|
+
}: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &
|
|
221
|
+
ComboboxPrimitive.Chips.Props) {
|
|
222
|
+
return (
|
|
223
|
+
<ComboboxPrimitive.Chips
|
|
224
|
+
data-slot="combobox-chips"
|
|
225
|
+
className={cn(
|
|
226
|
+
"flex min-h-8 flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40",
|
|
227
|
+
className
|
|
228
|
+
)}
|
|
229
|
+
{...props}
|
|
230
|
+
/>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function ComboboxChip({
|
|
235
|
+
className,
|
|
236
|
+
children,
|
|
237
|
+
showRemove = true,
|
|
238
|
+
...props
|
|
239
|
+
}: ComboboxPrimitive.Chip.Props & {
|
|
240
|
+
showRemove?: boolean
|
|
241
|
+
}) {
|
|
242
|
+
return (
|
|
243
|
+
<ComboboxPrimitive.Chip
|
|
244
|
+
data-slot="combobox-chip"
|
|
245
|
+
className={cn(
|
|
246
|
+
"flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0",
|
|
247
|
+
className
|
|
248
|
+
)}
|
|
249
|
+
{...props}
|
|
250
|
+
>
|
|
251
|
+
{children}
|
|
252
|
+
{showRemove && (
|
|
253
|
+
<ComboboxPrimitive.ChipRemove
|
|
254
|
+
render={<Button variant="ghost" size="icon-xs" />}
|
|
255
|
+
className="-ml-1 opacity-50 hover:opacity-100"
|
|
256
|
+
data-slot="combobox-chip-remove"
|
|
257
|
+
>
|
|
258
|
+
<XIcon className="pointer-events-none" />
|
|
259
|
+
</ComboboxPrimitive.ChipRemove>
|
|
260
|
+
)}
|
|
261
|
+
</ComboboxPrimitive.Chip>
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function ComboboxChipsInput({
|
|
266
|
+
className,
|
|
267
|
+
...props
|
|
268
|
+
}: ComboboxPrimitive.Input.Props) {
|
|
269
|
+
return (
|
|
270
|
+
<ComboboxPrimitive.Input
|
|
271
|
+
data-slot="combobox-chip-input"
|
|
272
|
+
className={cn("min-w-16 flex-1 outline-none", className)}
|
|
273
|
+
{...props}
|
|
274
|
+
/>
|
|
275
|
+
)
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function useComboboxAnchor() {
|
|
279
|
+
return React.useRef<HTMLDivElement | null>(null)
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export {
|
|
283
|
+
Combobox,
|
|
284
|
+
ComboboxInput,
|
|
285
|
+
ComboboxContent,
|
|
286
|
+
ComboboxList,
|
|
287
|
+
ComboboxItem,
|
|
288
|
+
ComboboxGroup,
|
|
289
|
+
ComboboxLabel,
|
|
290
|
+
ComboboxCollection,
|
|
291
|
+
ComboboxEmpty,
|
|
292
|
+
ComboboxSeparator,
|
|
293
|
+
ComboboxChips,
|
|
294
|
+
ComboboxChip,
|
|
295
|
+
ComboboxChipsInput,
|
|
296
|
+
ComboboxTrigger,
|
|
297
|
+
ComboboxValue,
|
|
298
|
+
useComboboxAnchor,
|
|
299
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Command as CommandPrimitive } from "cmdk"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
import {
|
|
6
|
+
Dialog,
|
|
7
|
+
DialogContent,
|
|
8
|
+
DialogDescription,
|
|
9
|
+
DialogHeader,
|
|
10
|
+
DialogTitle,
|
|
11
|
+
} from "@/components/ui/dialog"
|
|
12
|
+
import {
|
|
13
|
+
InputGroup,
|
|
14
|
+
InputGroupAddon,
|
|
15
|
+
} from "@/components/ui/input-group"
|
|
16
|
+
import { SearchIcon, CheckIcon } from "lucide-react"
|
|
17
|
+
|
|
18
|
+
function Command({
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof CommandPrimitive>) {
|
|
22
|
+
return (
|
|
23
|
+
<CommandPrimitive
|
|
24
|
+
data-slot="command"
|
|
25
|
+
className={cn(
|
|
26
|
+
"flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",
|
|
27
|
+
className
|
|
28
|
+
)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function CommandDialog({
|
|
35
|
+
title = "Command Palette",
|
|
36
|
+
description = "Search for a command to run...",
|
|
37
|
+
children,
|
|
38
|
+
className,
|
|
39
|
+
showCloseButton = false,
|
|
40
|
+
...props
|
|
41
|
+
}: React.ComponentProps<typeof Dialog> & {
|
|
42
|
+
title?: string
|
|
43
|
+
description?: string
|
|
44
|
+
className?: string
|
|
45
|
+
showCloseButton?: boolean
|
|
46
|
+
}) {
|
|
47
|
+
return (
|
|
48
|
+
<Dialog {...props}>
|
|
49
|
+
<DialogHeader className="sr-only">
|
|
50
|
+
<DialogTitle>{title}</DialogTitle>
|
|
51
|
+
<DialogDescription>{description}</DialogDescription>
|
|
52
|
+
</DialogHeader>
|
|
53
|
+
<DialogContent
|
|
54
|
+
className={cn(
|
|
55
|
+
"top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0",
|
|
56
|
+
className
|
|
57
|
+
)}
|
|
58
|
+
showCloseButton={showCloseButton}
|
|
59
|
+
>
|
|
60
|
+
{children}
|
|
61
|
+
</DialogContent>
|
|
62
|
+
</Dialog>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function CommandInput({
|
|
67
|
+
className,
|
|
68
|
+
...props
|
|
69
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
70
|
+
return (
|
|
71
|
+
<div data-slot="command-input-wrapper" className="p-1 pb-0">
|
|
72
|
+
<InputGroup className="h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!">
|
|
73
|
+
<CommandPrimitive.Input
|
|
74
|
+
data-slot="command-input"
|
|
75
|
+
className={cn(
|
|
76
|
+
"w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
77
|
+
className
|
|
78
|
+
)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
<InputGroupAddon>
|
|
82
|
+
<SearchIcon className="size-4 shrink-0 opacity-50" />
|
|
83
|
+
</InputGroupAddon>
|
|
84
|
+
</InputGroup>
|
|
85
|
+
</div>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function CommandList({
|
|
90
|
+
className,
|
|
91
|
+
...props
|
|
92
|
+
}: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
93
|
+
return (
|
|
94
|
+
<CommandPrimitive.List
|
|
95
|
+
data-slot="command-list"
|
|
96
|
+
className={cn(
|
|
97
|
+
"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",
|
|
98
|
+
className
|
|
99
|
+
)}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function CommandEmpty({
|
|
106
|
+
className,
|
|
107
|
+
...props
|
|
108
|
+
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
109
|
+
return (
|
|
110
|
+
<CommandPrimitive.Empty
|
|
111
|
+
data-slot="command-empty"
|
|
112
|
+
className={cn("py-6 text-center text-sm", className)}
|
|
113
|
+
{...props}
|
|
114
|
+
/>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function CommandGroup({
|
|
119
|
+
className,
|
|
120
|
+
...props
|
|
121
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
122
|
+
return (
|
|
123
|
+
<CommandPrimitive.Group
|
|
124
|
+
data-slot="command-group"
|
|
125
|
+
className={cn(
|
|
126
|
+
"overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",
|
|
127
|
+
className
|
|
128
|
+
)}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function CommandSeparator({
|
|
135
|
+
className,
|
|
136
|
+
...props
|
|
137
|
+
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
138
|
+
return (
|
|
139
|
+
<CommandPrimitive.Separator
|
|
140
|
+
data-slot="command-separator"
|
|
141
|
+
className={cn("-mx-1 h-px bg-border", className)}
|
|
142
|
+
{...props}
|
|
143
|
+
/>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function CommandItem({
|
|
148
|
+
className,
|
|
149
|
+
children,
|
|
150
|
+
...props
|
|
151
|
+
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
152
|
+
return (
|
|
153
|
+
<CommandPrimitive.Item
|
|
154
|
+
data-slot="command-item"
|
|
155
|
+
className={cn(
|
|
156
|
+
"group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",
|
|
157
|
+
className
|
|
158
|
+
)}
|
|
159
|
+
{...props}
|
|
160
|
+
>
|
|
161
|
+
{children}
|
|
162
|
+
<CheckIcon className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
|
|
163
|
+
</CommandPrimitive.Item>
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function CommandShortcut({
|
|
168
|
+
className,
|
|
169
|
+
...props
|
|
170
|
+
}: React.ComponentProps<"span">) {
|
|
171
|
+
return (
|
|
172
|
+
<span
|
|
173
|
+
data-slot="command-shortcut"
|
|
174
|
+
className={cn(
|
|
175
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground",
|
|
176
|
+
className
|
|
177
|
+
)}
|
|
178
|
+
{...props}
|
|
179
|
+
/>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export {
|
|
184
|
+
Command,
|
|
185
|
+
CommandDialog,
|
|
186
|
+
CommandInput,
|
|
187
|
+
CommandList,
|
|
188
|
+
CommandEmpty,
|
|
189
|
+
CommandGroup,
|
|
190
|
+
CommandItem,
|
|
191
|
+
CommandShortcut,
|
|
192
|
+
CommandSeparator,
|
|
193
|
+
}
|