@monkey-mini-app/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/components.json +23 -0
- package/dist/globals.css +2 -0
- package/dist/index.js +138 -0
- package/dist/manifest.json +11 -0
- package/dist/src/blocks/activity-feed.tsx +9 -0
- package/dist/src/blocks/app-shell.tsx +37 -0
- package/dist/src/blocks/attachment-gallery.tsx +30 -0
- package/dist/src/blocks/bar-chart.tsx +33 -0
- package/dist/src/blocks/comment-thread.tsx +30 -0
- package/dist/src/blocks/description-list.tsx +16 -0
- package/dist/src/blocks/detail-panel.tsx +43 -0
- package/dist/src/blocks/donut-chart.tsx +38 -0
- package/dist/src/blocks/env-badge.tsx +23 -0
- package/dist/src/blocks/file-tree.tsx +5 -0
- package/dist/src/blocks/filter-bar.tsx +21 -0
- package/dist/src/blocks/gauge.tsx +13 -0
- package/dist/src/blocks/notification-center.tsx +22 -0
- package/dist/src/blocks/page-header.tsx +30 -0
- package/dist/src/blocks/progress-ring.tsx +25 -0
- package/dist/src/blocks/radar-chart.tsx +31 -0
- package/dist/src/blocks/request-inspector.tsx +34 -0
- package/dist/src/blocks/run-timeline.tsx +5 -0
- package/dist/src/blocks/scrollspy.tsx +42 -0
- package/dist/src/blocks/severity-chip.tsx +27 -0
- package/dist/src/blocks/sparkline.tsx +19 -0
- package/dist/src/blocks/stat-card.tsx +49 -0
- package/dist/src/blocks/status-badge.tsx +39 -0
- package/dist/src/blocks/terminal.tsx +10 -0
- package/dist/src/blocks/test-step-list.tsx +19 -0
- package/dist/src/blocks/trend-card.tsx +51 -0
- package/dist/src/components/accordion.tsx +72 -0
- package/dist/src/components/alert-dialog.tsx +185 -0
- package/dist/src/components/alert.tsx +76 -0
- package/dist/src/components/aspect-ratio.tsx +22 -0
- package/dist/src/components/attachment.tsx +207 -0
- package/dist/src/components/avatar.tsx +107 -0
- package/dist/src/components/badge.tsx +52 -0
- package/dist/src/components/breadcrumb.tsx +125 -0
- package/dist/src/components/bubble.tsx +128 -0
- package/dist/src/components/button-group.tsx +87 -0
- package/dist/src/components/button.tsx +58 -0
- package/dist/src/components/calendar.tsx +221 -0
- package/dist/src/components/card.tsx +103 -0
- package/dist/src/components/chart.tsx +371 -0
- package/dist/src/components/checkbox.tsx +29 -0
- package/dist/src/components/collapsible.tsx +19 -0
- package/dist/src/components/combobox.tsx +295 -0
- package/dist/src/components/command.tsx +196 -0
- package/dist/src/components/context-menu.tsx +271 -0
- package/dist/src/components/dialog.tsx +158 -0
- package/dist/src/components/drawer.tsx +226 -0
- package/dist/src/components/dropdown-menu.tsx +268 -0
- package/dist/src/components/empty.tsx +123 -0
- package/dist/src/components/field.tsx +236 -0
- package/dist/src/components/hover-card.tsx +49 -0
- package/dist/src/components/input-group.tsx +158 -0
- package/dist/src/components/input.tsx +20 -0
- package/dist/src/components/item.tsx +201 -0
- package/dist/src/components/kbd.tsx +26 -0
- package/dist/src/components/label.tsx +20 -0
- package/dist/src/components/marker.tsx +71 -0
- package/dist/src/components/menubar.tsx +280 -0
- package/dist/src/components/message-scroller.tsx +129 -0
- package/dist/src/components/message.tsx +92 -0
- package/dist/src/components/native-select.tsx +61 -0
- package/dist/src/components/navigation-menu.tsx +168 -0
- package/dist/src/components/pagination.tsx +135 -0
- package/dist/src/components/popover.tsx +88 -0
- package/dist/src/components/progress.tsx +83 -0
- package/dist/src/components/questionnaire.tsx +329 -0
- package/dist/src/components/radio-group.tsx +36 -0
- package/dist/src/components/resizable.tsx +50 -0
- package/dist/src/components/scroll-area.tsx +52 -0
- package/dist/src/components/select.tsx +201 -0
- package/dist/src/components/separator.tsx +23 -0
- package/dist/src/components/sheet.tsx +136 -0
- package/dist/src/components/sidebar.tsx +721 -0
- package/dist/src/components/skeleton.tsx +13 -0
- package/dist/src/components/slider.tsx +52 -0
- package/dist/src/components/spinner.tsx +10 -0
- package/dist/src/components/switch.tsx +32 -0
- package/dist/src/components/table.tsx +114 -0
- package/dist/src/components/tabs.tsx +82 -0
- package/dist/src/components/textarea.tsx +18 -0
- package/dist/src/components/toast.tsx +234 -0
- package/dist/src/components/toggle-group.tsx +89 -0
- package/dist/src/components/toggle.tsx +43 -0
- package/dist/src/components/tooltip.tsx +66 -0
- package/dist/src/composites/autocomplete.tsx +55 -0
- package/dist/src/composites/cascader.tsx +46 -0
- package/dist/src/composites/color-picker.tsx +19 -0
- package/dist/src/composites/confirm-dialog.tsx +56 -0
- package/dist/src/composites/copyable.tsx +37 -0
- package/dist/src/composites/currency-input.tsx +31 -0
- package/dist/src/composites/date-chrome.tsx +157 -0
- package/dist/src/composites/date-picker.tsx +91 -0
- package/dist/src/composites/date-range-picker.tsx +96 -0
- package/dist/src/composites/date-time-picker.tsx +115 -0
- package/dist/src/composites/date-time-range-picker.tsx +51 -0
- package/dist/src/composites/duration-input.tsx +122 -0
- package/dist/src/composites/mini-calendar.tsx +24 -0
- package/dist/src/composites/number-field.tsx +53 -0
- package/dist/src/composites/password-field.tsx +44 -0
- package/dist/src/composites/phone-input.tsx +22 -0
- package/dist/src/composites/rating.tsx +39 -0
- package/dist/src/composites/relative-date-picker.tsx +62 -0
- package/dist/src/composites/search-input.tsx +49 -0
- package/dist/src/composites/slider-range.tsx +30 -0
- package/dist/src/composites/tag-input.tsx +56 -0
- package/dist/src/composites/time-picker.tsx +199 -0
- package/dist/src/composites/time-range-picker.tsx +25 -0
- package/dist/src/composites/timezone-select.tsx +251 -0
- package/dist/src/composites/transfer.tsx +52 -0
- package/dist/src/composites/user-picker.tsx +40 -0
- package/dist/src/hooks/use-mobile.ts +19 -0
- package/dist/src/i18n/context.tsx +72 -0
- package/dist/src/i18n/en.ts +168 -0
- package/dist/src/i18n/zh.ts +160 -0
- package/dist/src/index.ts +134 -0
- package/dist/src/lib/icons.tsx +16 -0
- package/dist/src/lib/illustrations.tsx +573 -0
- package/dist/src/lib/utils.ts +6 -0
- package/dist/src/products/cells.tsx +18 -0
- package/dist/src/products/code-block.tsx +75 -0
- package/dist/src/products/code-editor.tsx +49 -0
- package/dist/src/products/column-meta.d.ts +9 -0
- package/dist/src/products/data-grid.tsx +689 -0
- package/dist/src/products/diff-viewer.tsx +129 -0
- package/dist/src/products/event-calendar.tsx +845 -0
- package/dist/src/products/export-csv.ts +25 -0
- package/dist/src/products/file-dropzone.tsx +41 -0
- package/dist/src/products/gantt.tsx +41 -0
- package/dist/src/products/jira-wiki-parse.ts +197 -0
- package/dist/src/products/jira-wiki.tsx +285 -0
- package/dist/src/products/jql-input.tsx +62 -0
- package/dist/src/products/jql-language.ts +70 -0
- package/dist/src/products/json-viewer.tsx +37 -0
- package/dist/src/products/kanban-issue-panel.tsx +98 -0
- package/dist/src/products/kanban.tsx +245 -0
- package/dist/src/products/log-viewer.tsx +33 -0
- package/dist/src/products/markdown-editor.tsx +63 -0
- package/dist/src/products/markdown.tsx +26 -0
- package/dist/src/products/rich-text-editor.tsx +84 -0
- package/dist/src/products/sortable-list.tsx +61 -0
- package/dist/src/products/stepper.tsx +89 -0
- package/dist/src/products/timeline.tsx +32 -0
- package/dist/src/products/tree-view.tsx +56 -0
- package/dist/src/styles/globals.css +352 -0
- package/package.json +100 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Combobox as ComboboxPrimitive } from "@base-ui/react"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
5
|
+
import { Button } from "@monkey-mini-app/ui/components/button"
|
|
6
|
+
import {
|
|
7
|
+
InputGroup,
|
|
8
|
+
InputGroupAddon,
|
|
9
|
+
InputGroupButton,
|
|
10
|
+
InputGroupInput,
|
|
11
|
+
} from "@monkey-mini-app/ui/components/input-group"
|
|
12
|
+
import { ChevronDownIcon, XIcon, CheckIcon } from "lucide-react"
|
|
13
|
+
|
|
14
|
+
const Combobox = ComboboxPrimitive.Root
|
|
15
|
+
|
|
16
|
+
function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {
|
|
17
|
+
return <ComboboxPrimitive.Value data-slot="combobox-value" {...props} />
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function ComboboxTrigger({
|
|
21
|
+
className,
|
|
22
|
+
children,
|
|
23
|
+
...props
|
|
24
|
+
}: ComboboxPrimitive.Trigger.Props) {
|
|
25
|
+
return (
|
|
26
|
+
<ComboboxPrimitive.Trigger
|
|
27
|
+
data-slot="combobox-trigger"
|
|
28
|
+
className={cn("[&_svg:not([class*='size-'])]:size-4", className)}
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
<ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
|
|
33
|
+
</ComboboxPrimitive.Trigger>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {
|
|
38
|
+
return (
|
|
39
|
+
<ComboboxPrimitive.Clear
|
|
40
|
+
data-slot="combobox-clear"
|
|
41
|
+
render={<InputGroupButton variant="ghost" size="icon-xs" />}
|
|
42
|
+
className={cn(className)}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
<XIcon className="pointer-events-none" />
|
|
46
|
+
</ComboboxPrimitive.Clear>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function ComboboxInput({
|
|
51
|
+
className,
|
|
52
|
+
children,
|
|
53
|
+
disabled = false,
|
|
54
|
+
showTrigger = true,
|
|
55
|
+
showClear = false,
|
|
56
|
+
...props
|
|
57
|
+
}: ComboboxPrimitive.Input.Props & {
|
|
58
|
+
showTrigger?: boolean
|
|
59
|
+
showClear?: boolean
|
|
60
|
+
}) {
|
|
61
|
+
return (
|
|
62
|
+
<InputGroup className={cn("w-auto", className)}>
|
|
63
|
+
<ComboboxPrimitive.Input
|
|
64
|
+
render={<InputGroupInput disabled={disabled} />}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
<InputGroupAddon align="inline-end">
|
|
68
|
+
{showTrigger && (
|
|
69
|
+
<InputGroupButton
|
|
70
|
+
size="icon-xs"
|
|
71
|
+
variant="ghost"
|
|
72
|
+
render={<ComboboxTrigger />}
|
|
73
|
+
data-slot="input-group-button"
|
|
74
|
+
className="group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent"
|
|
75
|
+
disabled={disabled}
|
|
76
|
+
/>
|
|
77
|
+
)}
|
|
78
|
+
{showClear && <ComboboxClear disabled={disabled} />}
|
|
79
|
+
</InputGroupAddon>
|
|
80
|
+
{children}
|
|
81
|
+
</InputGroup>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function ComboboxContent({
|
|
86
|
+
className,
|
|
87
|
+
side = "bottom",
|
|
88
|
+
sideOffset = 6,
|
|
89
|
+
align = "start",
|
|
90
|
+
alignOffset = 0,
|
|
91
|
+
anchor,
|
|
92
|
+
...props
|
|
93
|
+
}: ComboboxPrimitive.Popup.Props &
|
|
94
|
+
Pick<
|
|
95
|
+
ComboboxPrimitive.Positioner.Props,
|
|
96
|
+
"side" | "align" | "sideOffset" | "alignOffset" | "anchor"
|
|
97
|
+
>) {
|
|
98
|
+
return (
|
|
99
|
+
<ComboboxPrimitive.Portal>
|
|
100
|
+
<ComboboxPrimitive.Positioner
|
|
101
|
+
side={side}
|
|
102
|
+
sideOffset={sideOffset}
|
|
103
|
+
align={align}
|
|
104
|
+
alignOffset={alignOffset}
|
|
105
|
+
anchor={anchor}
|
|
106
|
+
className="isolate z-50"
|
|
107
|
+
>
|
|
108
|
+
<ComboboxPrimitive.Popup
|
|
109
|
+
data-slot="combobox-content"
|
|
110
|
+
data-chips={!!anchor}
|
|
111
|
+
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 )}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
</ComboboxPrimitive.Positioner>
|
|
115
|
+
</ComboboxPrimitive.Portal>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {
|
|
120
|
+
return (
|
|
121
|
+
<ComboboxPrimitive.List
|
|
122
|
+
data-slot="combobox-list"
|
|
123
|
+
className={cn(
|
|
124
|
+
"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",
|
|
125
|
+
className
|
|
126
|
+
)}
|
|
127
|
+
{...props}
|
|
128
|
+
/>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function ComboboxItem({
|
|
133
|
+
className,
|
|
134
|
+
children,
|
|
135
|
+
...props
|
|
136
|
+
}: ComboboxPrimitive.Item.Props) {
|
|
137
|
+
return (
|
|
138
|
+
<ComboboxPrimitive.Item
|
|
139
|
+
data-slot="combobox-item"
|
|
140
|
+
className={cn(
|
|
141
|
+
"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",
|
|
142
|
+
className
|
|
143
|
+
)}
|
|
144
|
+
{...props}
|
|
145
|
+
>
|
|
146
|
+
{children}
|
|
147
|
+
<ComboboxPrimitive.ItemIndicator
|
|
148
|
+
render={
|
|
149
|
+
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
|
|
150
|
+
}
|
|
151
|
+
>
|
|
152
|
+
<CheckIcon className="pointer-events-none" />
|
|
153
|
+
</ComboboxPrimitive.ItemIndicator>
|
|
154
|
+
</ComboboxPrimitive.Item>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {
|
|
159
|
+
return (
|
|
160
|
+
<ComboboxPrimitive.Group
|
|
161
|
+
data-slot="combobox-group"
|
|
162
|
+
className={cn(className)}
|
|
163
|
+
{...props}
|
|
164
|
+
/>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function ComboboxLabel({
|
|
169
|
+
className,
|
|
170
|
+
...props
|
|
171
|
+
}: ComboboxPrimitive.GroupLabel.Props) {
|
|
172
|
+
return (
|
|
173
|
+
<ComboboxPrimitive.GroupLabel
|
|
174
|
+
data-slot="combobox-label"
|
|
175
|
+
className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
|
|
176
|
+
{...props}
|
|
177
|
+
/>
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {
|
|
182
|
+
return (
|
|
183
|
+
<ComboboxPrimitive.Collection data-slot="combobox-collection" {...props} />
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {
|
|
188
|
+
return (
|
|
189
|
+
<ComboboxPrimitive.Empty
|
|
190
|
+
data-slot="combobox-empty"
|
|
191
|
+
className={cn(
|
|
192
|
+
"hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex",
|
|
193
|
+
className
|
|
194
|
+
)}
|
|
195
|
+
{...props}
|
|
196
|
+
/>
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function ComboboxSeparator({
|
|
201
|
+
className,
|
|
202
|
+
...props
|
|
203
|
+
}: ComboboxPrimitive.Separator.Props) {
|
|
204
|
+
return (
|
|
205
|
+
<ComboboxPrimitive.Separator
|
|
206
|
+
data-slot="combobox-separator"
|
|
207
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
208
|
+
{...props}
|
|
209
|
+
/>
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function ComboboxChips({
|
|
214
|
+
className,
|
|
215
|
+
...props
|
|
216
|
+
}: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &
|
|
217
|
+
ComboboxPrimitive.Chips.Props) {
|
|
218
|
+
return (
|
|
219
|
+
<ComboboxPrimitive.Chips
|
|
220
|
+
data-slot="combobox-chips"
|
|
221
|
+
className={cn(
|
|
222
|
+
"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",
|
|
223
|
+
className
|
|
224
|
+
)}
|
|
225
|
+
{...props}
|
|
226
|
+
/>
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function ComboboxChip({
|
|
231
|
+
className,
|
|
232
|
+
children,
|
|
233
|
+
showRemove = true,
|
|
234
|
+
...props
|
|
235
|
+
}: ComboboxPrimitive.Chip.Props & {
|
|
236
|
+
showRemove?: boolean
|
|
237
|
+
}) {
|
|
238
|
+
return (
|
|
239
|
+
<ComboboxPrimitive.Chip
|
|
240
|
+
data-slot="combobox-chip"
|
|
241
|
+
className={cn(
|
|
242
|
+
"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",
|
|
243
|
+
className
|
|
244
|
+
)}
|
|
245
|
+
{...props}
|
|
246
|
+
>
|
|
247
|
+
{children}
|
|
248
|
+
{showRemove && (
|
|
249
|
+
<ComboboxPrimitive.ChipRemove
|
|
250
|
+
render={<Button variant="ghost" size="icon-xs" />}
|
|
251
|
+
className="-ml-1 opacity-50 hover:opacity-100"
|
|
252
|
+
data-slot="combobox-chip-remove"
|
|
253
|
+
>
|
|
254
|
+
<XIcon className="pointer-events-none" />
|
|
255
|
+
</ComboboxPrimitive.ChipRemove>
|
|
256
|
+
)}
|
|
257
|
+
</ComboboxPrimitive.Chip>
|
|
258
|
+
)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function ComboboxChipsInput({
|
|
262
|
+
className,
|
|
263
|
+
...props
|
|
264
|
+
}: ComboboxPrimitive.Input.Props) {
|
|
265
|
+
return (
|
|
266
|
+
<ComboboxPrimitive.Input
|
|
267
|
+
data-slot="combobox-chip-input"
|
|
268
|
+
className={cn("min-w-16 flex-1 outline-none", className)}
|
|
269
|
+
{...props}
|
|
270
|
+
/>
|
|
271
|
+
)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function useComboboxAnchor() {
|
|
275
|
+
return React.useRef<HTMLDivElement | null>(null)
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export {
|
|
279
|
+
Combobox,
|
|
280
|
+
ComboboxInput,
|
|
281
|
+
ComboboxContent,
|
|
282
|
+
ComboboxList,
|
|
283
|
+
ComboboxItem,
|
|
284
|
+
ComboboxGroup,
|
|
285
|
+
ComboboxLabel,
|
|
286
|
+
ComboboxCollection,
|
|
287
|
+
ComboboxEmpty,
|
|
288
|
+
ComboboxSeparator,
|
|
289
|
+
ComboboxChips,
|
|
290
|
+
ComboboxChip,
|
|
291
|
+
ComboboxChipsInput,
|
|
292
|
+
ComboboxTrigger,
|
|
293
|
+
ComboboxValue,
|
|
294
|
+
useComboboxAnchor,
|
|
295
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Command as CommandPrimitive } from "cmdk"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
7
|
+
import {
|
|
8
|
+
Dialog,
|
|
9
|
+
DialogContent,
|
|
10
|
+
DialogDescription,
|
|
11
|
+
DialogHeader,
|
|
12
|
+
DialogTitle,
|
|
13
|
+
} from "@monkey-mini-app/ui/components/dialog"
|
|
14
|
+
import {
|
|
15
|
+
InputGroup,
|
|
16
|
+
InputGroupAddon,
|
|
17
|
+
} from "@monkey-mini-app/ui/components/input-group"
|
|
18
|
+
import { SearchIcon, CheckIcon } from "lucide-react"
|
|
19
|
+
|
|
20
|
+
function Command({
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof CommandPrimitive>) {
|
|
24
|
+
return (
|
|
25
|
+
<CommandPrimitive
|
|
26
|
+
data-slot="command"
|
|
27
|
+
className={cn(
|
|
28
|
+
"flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",
|
|
29
|
+
className
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function CommandDialog({
|
|
37
|
+
title = "Command Palette",
|
|
38
|
+
description = "Search for a command to run...",
|
|
39
|
+
children,
|
|
40
|
+
className,
|
|
41
|
+
showCloseButton = false,
|
|
42
|
+
...props
|
|
43
|
+
}: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
|
|
44
|
+
title?: string
|
|
45
|
+
description?: string
|
|
46
|
+
className?: string
|
|
47
|
+
showCloseButton?: boolean
|
|
48
|
+
children: React.ReactNode
|
|
49
|
+
}) {
|
|
50
|
+
return (
|
|
51
|
+
<Dialog {...props}>
|
|
52
|
+
<DialogHeader className="sr-only">
|
|
53
|
+
<DialogTitle>{title}</DialogTitle>
|
|
54
|
+
<DialogDescription>{description}</DialogDescription>
|
|
55
|
+
</DialogHeader>
|
|
56
|
+
<DialogContent
|
|
57
|
+
className={cn(
|
|
58
|
+
"top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0",
|
|
59
|
+
className
|
|
60
|
+
)}
|
|
61
|
+
showCloseButton={showCloseButton}
|
|
62
|
+
>
|
|
63
|
+
{children}
|
|
64
|
+
</DialogContent>
|
|
65
|
+
</Dialog>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function CommandInput({
|
|
70
|
+
className,
|
|
71
|
+
...props
|
|
72
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
73
|
+
return (
|
|
74
|
+
<div data-slot="command-input-wrapper" className="p-1 pb-0">
|
|
75
|
+
<InputGroup className="h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!">
|
|
76
|
+
<CommandPrimitive.Input
|
|
77
|
+
data-slot="command-input"
|
|
78
|
+
className={cn(
|
|
79
|
+
"w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
80
|
+
className
|
|
81
|
+
)}
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
<InputGroupAddon>
|
|
85
|
+
<SearchIcon className="size-4 shrink-0 opacity-50" />
|
|
86
|
+
</InputGroupAddon>
|
|
87
|
+
</InputGroup>
|
|
88
|
+
</div>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function CommandList({
|
|
93
|
+
className,
|
|
94
|
+
...props
|
|
95
|
+
}: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
96
|
+
return (
|
|
97
|
+
<CommandPrimitive.List
|
|
98
|
+
data-slot="command-list"
|
|
99
|
+
className={cn(
|
|
100
|
+
"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",
|
|
101
|
+
className
|
|
102
|
+
)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function CommandEmpty({
|
|
109
|
+
className,
|
|
110
|
+
...props
|
|
111
|
+
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
112
|
+
return (
|
|
113
|
+
<CommandPrimitive.Empty
|
|
114
|
+
data-slot="command-empty"
|
|
115
|
+
className={cn("py-6 text-center text-sm", className)}
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function CommandGroup({
|
|
122
|
+
className,
|
|
123
|
+
...props
|
|
124
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
125
|
+
return (
|
|
126
|
+
<CommandPrimitive.Group
|
|
127
|
+
data-slot="command-group"
|
|
128
|
+
className={cn(
|
|
129
|
+
"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",
|
|
130
|
+
className
|
|
131
|
+
)}
|
|
132
|
+
{...props}
|
|
133
|
+
/>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function CommandSeparator({
|
|
138
|
+
className,
|
|
139
|
+
...props
|
|
140
|
+
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
141
|
+
return (
|
|
142
|
+
<CommandPrimitive.Separator
|
|
143
|
+
data-slot="command-separator"
|
|
144
|
+
className={cn("-mx-1 h-px bg-border", className)}
|
|
145
|
+
{...props}
|
|
146
|
+
/>
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function CommandItem({
|
|
151
|
+
className,
|
|
152
|
+
children,
|
|
153
|
+
...props
|
|
154
|
+
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
155
|
+
return (
|
|
156
|
+
<CommandPrimitive.Item
|
|
157
|
+
data-slot="command-item"
|
|
158
|
+
className={cn(
|
|
159
|
+
"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",
|
|
160
|
+
className
|
|
161
|
+
)}
|
|
162
|
+
{...props}
|
|
163
|
+
>
|
|
164
|
+
{children}
|
|
165
|
+
<CheckIcon className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
|
|
166
|
+
</CommandPrimitive.Item>
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function CommandShortcut({
|
|
171
|
+
className,
|
|
172
|
+
...props
|
|
173
|
+
}: React.ComponentProps<"span">) {
|
|
174
|
+
return (
|
|
175
|
+
<span
|
|
176
|
+
data-slot="command-shortcut"
|
|
177
|
+
className={cn(
|
|
178
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground",
|
|
179
|
+
className
|
|
180
|
+
)}
|
|
181
|
+
{...props}
|
|
182
|
+
/>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export {
|
|
187
|
+
Command,
|
|
188
|
+
CommandDialog,
|
|
189
|
+
CommandInput,
|
|
190
|
+
CommandList,
|
|
191
|
+
CommandEmpty,
|
|
192
|
+
CommandGroup,
|
|
193
|
+
CommandItem,
|
|
194
|
+
CommandShortcut,
|
|
195
|
+
CommandSeparator,
|
|
196
|
+
}
|