@moloodev/ui 0.0.0-stage → 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/package.json +139 -3
- package/registry/components.ts +135 -0
- package/registry/fonts.css +81 -0
- package/registry/suit-OFL.txt +94 -0
- package/registry/wanted-sans-OFL.txt +93 -0
- package/src/components/ui/accordion.tsx +74 -0
- package/src/components/ui/alert-dialog.tsx +187 -0
- package/src/components/ui/alert.tsx +83 -0
- package/src/components/ui/aspect-ratio.tsx +22 -0
- package/src/components/ui/attachment.tsx +207 -0
- package/src/components/ui/avatar.tsx +109 -0
- package/src/components/ui/badge.tsx +54 -0
- package/src/components/ui/breadcrumb.tsx +126 -0
- package/src/components/ui/bubble.tsx +128 -0
- package/src/components/ui/button-group.tsx +103 -0
- package/src/components/ui/button.tsx +68 -0
- package/src/components/ui/calendar.tsx +222 -0
- package/src/components/ui/card.tsx +103 -0
- package/src/components/ui/carousel.tsx +242 -0
- package/src/components/ui/chart.tsx +398 -0
- package/src/components/ui/checkbox.tsx +28 -0
- package/src/components/ui/collapsible.tsx +40 -0
- package/src/components/ui/combobox.tsx +299 -0
- package/src/components/ui/command.tsx +218 -0
- package/src/components/ui/context-menu.tsx +271 -0
- package/src/components/ui/data-table.tsx +919 -0
- package/src/components/ui/date-picker.tsx +65 -0
- package/src/components/ui/dialog.tsx +224 -0
- package/src/components/ui/drawer.tsx +231 -0
- package/src/components/ui/dropdown-menu.tsx +268 -0
- package/src/components/ui/dropzone.tsx +186 -0
- package/src/components/ui/empty.tsx +101 -0
- package/src/components/ui/field.tsx +238 -0
- package/src/components/ui/form.tsx +83 -0
- package/src/components/ui/highlighted-source.tsx +200 -0
- package/src/components/ui/hover-card.tsx +51 -0
- package/src/components/ui/image-field.tsx +796 -0
- package/src/components/ui/input-group.tsx +149 -0
- package/src/components/ui/input-otp.tsx +86 -0
- package/src/components/ui/input-step.ts +19 -0
- package/src/components/ui/input.tsx +100 -0
- package/src/components/ui/item.tsx +201 -0
- package/src/components/ui/kbd.tsx +91 -0
- package/src/components/ui/kind-icon-glob.ts +24 -0
- package/src/components/ui/kind-icon-load.ts +52 -0
- package/src/components/ui/kind-icon-static.ts +46 -0
- package/src/components/ui/kind-icon.tsx +84 -0
- package/src/components/ui/kind-mark.tsx +65 -0
- package/src/components/ui/label.tsx +29 -0
- package/src/components/ui/marker.tsx +71 -0
- package/src/components/ui/menubar.tsx +277 -0
- package/src/components/ui/message-scroller.tsx +137 -0
- package/src/components/ui/message.tsx +92 -0
- package/src/components/ui/moloo-logo.tsx +45 -0
- package/src/components/ui/native-select.tsx +61 -0
- package/src/components/ui/navigation-menu.tsx +168 -0
- package/src/components/ui/outline-list.tsx +73 -0
- package/src/components/ui/pagination.tsx +130 -0
- package/src/components/ui/panel.tsx +108 -0
- package/src/components/ui/popover.tsx +90 -0
- package/src/components/ui/progress.tsx +117 -0
- package/src/components/ui/radio-group.tsx +38 -0
- package/src/components/ui/resizable.tsx +52 -0
- package/src/components/ui/scroll-area.tsx +54 -0
- package/src/components/ui/select.tsx +205 -0
- package/src/components/ui/separator.tsx +25 -0
- package/src/components/ui/sheet.tsx +140 -0
- package/src/components/ui/sidebar.tsx +746 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/slider.tsx +52 -0
- package/src/components/ui/spinner.tsx +18 -0
- package/src/components/ui/switch.tsx +32 -0
- package/src/components/ui/table.tsx +116 -0
- package/src/components/ui/tabs.tsx +83 -0
- package/src/components/ui/tag-list-input.tsx +194 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/timeline.tsx +265 -0
- package/src/components/ui/toast.tsx +237 -0
- package/src/components/ui/toggle-group.tsx +90 -0
- package/src/components/ui/toggle.tsx +45 -0
- package/src/components/ui/tooltip.tsx +66 -0
- package/src/css.d.ts +1 -0
- package/src/hooks/use-clipboard.ts +82 -0
- package/src/hooks/use-mobile.ts +21 -0
- package/src/index.ts +106 -0
- package/src/kind-icon.ts +4 -0
- package/src/lib/format-relative-time.ts +41 -0
- package/src/lib/list-selection.ts +61 -0
- package/src/lib/utils.ts +6 -0
- package/src/moloo.css +360 -0
- package/src/styles.css +36 -0
- package/src/typeset.css +518 -0
- package/README.md +0 -3
|
@@ -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 "./button"
|
|
8
|
+
import {
|
|
9
|
+
InputGroup,
|
|
10
|
+
InputGroupAddon,
|
|
11
|
+
InputGroupButton,
|
|
12
|
+
InputGroupInput,
|
|
13
|
+
} from "./input-group"
|
|
14
|
+
import { IconChevronDown, IconX, IconCheck } from "@tabler/icons-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(
|
|
31
|
+
"group/combobox-trigger inline-flex items-center justify-center [&_svg:not([class*='size-'])]:size-4",
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
<IconChevronDown className="pointer-events-none size-4 text-muted-foreground transition-transform duration-200 group-data-popup-open/combobox-trigger:rotate-180" />
|
|
38
|
+
</ComboboxPrimitive.Trigger>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {
|
|
43
|
+
return (
|
|
44
|
+
<ComboboxPrimitive.Clear
|
|
45
|
+
data-slot="combobox-clear"
|
|
46
|
+
render={<InputGroupButton variant="ghost" size="icon-xs" />}
|
|
47
|
+
className={cn(className)}
|
|
48
|
+
{...props}
|
|
49
|
+
>
|
|
50
|
+
<IconX className="pointer-events-none" />
|
|
51
|
+
</ComboboxPrimitive.Clear>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function ComboboxInput({
|
|
56
|
+
className,
|
|
57
|
+
children,
|
|
58
|
+
disabled = false,
|
|
59
|
+
showTrigger = true,
|
|
60
|
+
showClear = false,
|
|
61
|
+
...props
|
|
62
|
+
}: ComboboxPrimitive.Input.Props & {
|
|
63
|
+
showTrigger?: boolean
|
|
64
|
+
showClear?: boolean
|
|
65
|
+
}) {
|
|
66
|
+
return (
|
|
67
|
+
<InputGroup className={cn("w-auto", className)}>
|
|
68
|
+
<ComboboxPrimitive.Input
|
|
69
|
+
render={<InputGroupInput disabled={disabled} />}
|
|
70
|
+
{...props}
|
|
71
|
+
/>
|
|
72
|
+
<InputGroupAddon align="inline-end">
|
|
73
|
+
{showTrigger && (
|
|
74
|
+
<IconChevronDown
|
|
75
|
+
aria-hidden="true"
|
|
76
|
+
className="pointer-events-none size-4 shrink-0 text-muted-foreground transition-transform duration-200 in-data-[popup-open]:rotate-180 group-has-data-[slot=combobox-clear]/input-group:hidden"
|
|
77
|
+
/>
|
|
78
|
+
)}
|
|
79
|
+
{showClear && <ComboboxClear disabled={disabled} />}
|
|
80
|
+
</InputGroupAddon>
|
|
81
|
+
{children}
|
|
82
|
+
</InputGroup>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function ComboboxContent({
|
|
87
|
+
className,
|
|
88
|
+
side = "bottom",
|
|
89
|
+
sideOffset = 6,
|
|
90
|
+
align = "start",
|
|
91
|
+
alignOffset = 0,
|
|
92
|
+
anchor,
|
|
93
|
+
...props
|
|
94
|
+
}: ComboboxPrimitive.Popup.Props &
|
|
95
|
+
Pick<
|
|
96
|
+
ComboboxPrimitive.Positioner.Props,
|
|
97
|
+
"side" | "align" | "sideOffset" | "alignOffset" | "anchor"
|
|
98
|
+
>) {
|
|
99
|
+
return (
|
|
100
|
+
<ComboboxPrimitive.Portal>
|
|
101
|
+
<ComboboxPrimitive.Positioner
|
|
102
|
+
side={side}
|
|
103
|
+
sideOffset={sideOffset}
|
|
104
|
+
align={align}
|
|
105
|
+
alignOffset={alignOffset}
|
|
106
|
+
anchor={anchor}
|
|
107
|
+
className="isolate z-50"
|
|
108
|
+
>
|
|
109
|
+
<ComboboxPrimitive.Popup
|
|
110
|
+
data-slot="combobox-content"
|
|
111
|
+
data-chips={!!anchor}
|
|
112
|
+
className={cn(
|
|
113
|
+
"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-md moloo-surface bg-popover text-sm text-popover-foreground 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-9 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",
|
|
114
|
+
className
|
|
115
|
+
)}
|
|
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
|
+
"moloo-focus no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain 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-2 pr-8 pl-2 text-sm font-semibold 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
|
+
<IconCheck 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-2 text-sm 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 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
|
+
"moloo-field moloo-focus-within flex min-h-9 flex-wrap items-center gap-1 bg-clip-padding px-2.5 py-1 text-sm transition-colors outline-none has-aria-invalid:border-destructive has-aria-invalid:shadow-[var(--moloo-invalid-shadow)] has-data-[slot=combobox-chip]:px-1",
|
|
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-md bg-muted px-1.5 text-sm 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
|
+
<IconX 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,218 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Command as CommandPrimitive } from "cmdk"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
import {
|
|
8
|
+
Dialog,
|
|
9
|
+
DialogContent,
|
|
10
|
+
DialogDescription,
|
|
11
|
+
DialogHeader,
|
|
12
|
+
DialogTitle,
|
|
13
|
+
} from "./dialog"
|
|
14
|
+
import { IconSearch, IconCheck } from "@tabler/icons-react"
|
|
15
|
+
import { Kbd, KbdGroup, kbdKey } from "./kbd"
|
|
16
|
+
|
|
17
|
+
function Command({
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<typeof CommandPrimitive>) {
|
|
21
|
+
return (
|
|
22
|
+
<CommandPrimitive
|
|
23
|
+
data-slot="command"
|
|
24
|
+
className={cn(
|
|
25
|
+
"flex size-full flex-col overflow-hidden moloo-surface bg-popover text-popover-foreground",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function CommandDialog({
|
|
34
|
+
title = "Command Palette",
|
|
35
|
+
description = "Search for a command to run...",
|
|
36
|
+
children,
|
|
37
|
+
className,
|
|
38
|
+
showCloseButton = false,
|
|
39
|
+
closeLabel = "Close",
|
|
40
|
+
...props
|
|
41
|
+
}: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
|
|
42
|
+
title?: string
|
|
43
|
+
description?: string
|
|
44
|
+
className?: string
|
|
45
|
+
showCloseButton?: boolean
|
|
46
|
+
closeLabel?: string
|
|
47
|
+
children: React.ReactNode
|
|
48
|
+
}) {
|
|
49
|
+
return (
|
|
50
|
+
<Dialog {...props}>
|
|
51
|
+
<DialogHeader className="sr-only">
|
|
52
|
+
<DialogTitle>{title}</DialogTitle>
|
|
53
|
+
<DialogDescription>{description}</DialogDescription>
|
|
54
|
+
</DialogHeader>
|
|
55
|
+
<DialogContent
|
|
56
|
+
className={cn(
|
|
57
|
+
"top-1/3 translate-y-0 overflow-hidden p-0 sm:max-w-lg",
|
|
58
|
+
// Dialog already provides moloo-surface; strip nested Command chrome.
|
|
59
|
+
"*:data-[slot=command]:rounded-none *:data-[slot=command]:border-0 *:data-[slot=command]:shadow-none",
|
|
60
|
+
className
|
|
61
|
+
)}
|
|
62
|
+
showCloseButton={showCloseButton}
|
|
63
|
+
closeLabel={closeLabel}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
</DialogContent>
|
|
67
|
+
</Dialog>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function CommandInput({
|
|
72
|
+
className,
|
|
73
|
+
...props
|
|
74
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
data-slot="command-input-wrapper"
|
|
78
|
+
className="moloo-focus-within-inset flex h-9 items-center gap-2 border-b border-border px-3 outline-none"
|
|
79
|
+
>
|
|
80
|
+
<IconSearch className="size-4 shrink-0 opacity-50" />
|
|
81
|
+
<CommandPrimitive.Input
|
|
82
|
+
data-slot="command-input"
|
|
83
|
+
className={cn(
|
|
84
|
+
"h-full min-w-0 flex-1 bg-transparent text-sm font-semibold text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
85
|
+
className
|
|
86
|
+
)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function CommandList({
|
|
94
|
+
className,
|
|
95
|
+
...props
|
|
96
|
+
}: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
97
|
+
return (
|
|
98
|
+
<CommandPrimitive.List
|
|
99
|
+
data-slot="command-list"
|
|
100
|
+
className={cn(
|
|
101
|
+
"no-scrollbar max-h-72 scroll-py-0 overflow-x-hidden overflow-y-auto outline-none",
|
|
102
|
+
className
|
|
103
|
+
)}
|
|
104
|
+
{...props}
|
|
105
|
+
/>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function CommandEmpty({
|
|
110
|
+
className,
|
|
111
|
+
...props
|
|
112
|
+
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
113
|
+
return (
|
|
114
|
+
<CommandPrimitive.Empty
|
|
115
|
+
data-slot="command-empty"
|
|
116
|
+
className={cn("py-6 text-center text-sm", className)}
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function CommandGroup({
|
|
123
|
+
className,
|
|
124
|
+
...props
|
|
125
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
126
|
+
return (
|
|
127
|
+
<CommandPrimitive.Group
|
|
128
|
+
data-slot="command-group"
|
|
129
|
+
className={cn(
|
|
130
|
+
"overflow-hidden text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-sm **:[[cmdk-group-heading]]:text-muted-foreground",
|
|
131
|
+
className
|
|
132
|
+
)}
|
|
133
|
+
{...props}
|
|
134
|
+
/>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function CommandSeparator({
|
|
139
|
+
className,
|
|
140
|
+
...props
|
|
141
|
+
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
142
|
+
return (
|
|
143
|
+
<CommandPrimitive.Separator
|
|
144
|
+
data-slot="command-separator"
|
|
145
|
+
className={cn("-mx-1 h-px bg-border", className)}
|
|
146
|
+
{...props}
|
|
147
|
+
/>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function CommandItem({
|
|
152
|
+
className,
|
|
153
|
+
children,
|
|
154
|
+
...props
|
|
155
|
+
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
156
|
+
return (
|
|
157
|
+
<CommandPrimitive.Item
|
|
158
|
+
data-slot="command-item"
|
|
159
|
+
className={cn(
|
|
160
|
+
"group/command-item relative flex cursor-pointer items-center gap-2 rounded-md px-2 py-2 text-sm font-semibold outline-hidden select-none in-data-[slot=dialog-content]:rounded-md! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-accent data-selected:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-accent-foreground",
|
|
161
|
+
className
|
|
162
|
+
)}
|
|
163
|
+
{...props}
|
|
164
|
+
>
|
|
165
|
+
{children}
|
|
166
|
+
<IconCheck className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
|
|
167
|
+
</CommandPrimitive.Item>
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function CommandShortcut({
|
|
172
|
+
keys,
|
|
173
|
+
className,
|
|
174
|
+
children,
|
|
175
|
+
...props
|
|
176
|
+
}: Omit<React.ComponentProps<"div">, "children"> & {
|
|
177
|
+
/** Key ids rendered with `kbdKey` (for example `["cmd", "K"]`). */
|
|
178
|
+
keys?: readonly string[]
|
|
179
|
+
children?: React.ReactNode
|
|
180
|
+
}) {
|
|
181
|
+
if (keys && keys.length > 0) {
|
|
182
|
+
return (
|
|
183
|
+
<KbdGroup
|
|
184
|
+
data-slot="command-shortcut"
|
|
185
|
+
className={cn("ml-auto shrink-0", className)}
|
|
186
|
+
{...props}
|
|
187
|
+
>
|
|
188
|
+
{keys.map((key) => (
|
|
189
|
+
<Kbd key={key}>{kbdKey(key)}</Kbd>
|
|
190
|
+
))}
|
|
191
|
+
</KbdGroup>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (!children) return null
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<KbdGroup
|
|
199
|
+
data-slot="command-shortcut"
|
|
200
|
+
className={cn("ml-auto shrink-0", className)}
|
|
201
|
+
{...props}
|
|
202
|
+
>
|
|
203
|
+
{children}
|
|
204
|
+
</KbdGroup>
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export {
|
|
209
|
+
Command,
|
|
210
|
+
CommandDialog,
|
|
211
|
+
CommandInput,
|
|
212
|
+
CommandList,
|
|
213
|
+
CommandEmpty,
|
|
214
|
+
CommandGroup,
|
|
215
|
+
CommandItem,
|
|
216
|
+
CommandShortcut,
|
|
217
|
+
CommandSeparator,
|
|
218
|
+
}
|