@multicomma/arkcn 0.1.2 → 0.1.3
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/registry/index.json +1 -1
- package/registry/items/accordion.json +302 -0
- package/registry/items/activity-feed.json +408 -0
- package/registry/items/alert-dialog.json +676 -0
- package/registry/items/alert.json +113 -0
- package/registry/items/angle-slider.json +378 -0
- package/registry/items/app-shell.json +2654 -1
- package/registry/items/aspect-ratio.json +36 -0
- package/registry/items/attachment.json +299 -1
- package/registry/items/avatar.json +213 -0
- package/registry/items/badge.json +44 -0
- package/registry/items/breadcrumb.json +191 -0
- package/registry/items/bubble.json +146 -0
- package/registry/items/button-group.json +110 -0
- package/registry/items/button.json +52 -0
- package/registry/items/calendar.json +499 -1
- package/registry/items/canvas.json +446 -1
- package/registry/items/card.json +192 -0
- package/registry/items/carousel.json +208 -1
- package/registry/items/cascader.json +797 -1
- package/registry/items/chart.json +1764 -1
- package/registry/items/chat.json +993 -0
- package/registry/items/checkbox.json +503 -0
- package/registry/items/clipboard.json +308 -0
- package/registry/items/collapsible.json +226 -0
- package/registry/items/color-picker.json +1261 -0
- package/registry/items/combobox.json +1123 -1
- package/registry/items/command.json +837 -1
- package/registry/items/comment-thread.json +952 -1
- package/registry/items/context-menu.json +1344 -1
- package/registry/items/data-grid.json +449 -1
- package/registry/items/data-table.json +1310 -1
- package/registry/items/date-input.json +476 -0
- package/registry/items/dialog.json +592 -0
- package/registry/items/direction.json +29 -1
- package/registry/items/drawer.json +797 -0
- package/registry/items/dropdown-menu.json +1311 -1
- package/registry/items/editable.json +503 -0
- package/registry/items/empty.json +166 -0
- package/registry/items/field.json +286 -1
- package/registry/items/file-upload.json +638 -0
- package/registry/items/floating-panel.json +720 -0
- package/registry/items/floating-toolbar.json +43 -0
- package/registry/items/format.json +109 -0
- package/registry/items/gantt.json +773 -1
- package/registry/items/hooks/use-mobile.json +1 -0
- package/registry/items/hotkeys.json +99 -1
- package/registry/items/hover-card.json +357 -0
- package/registry/items/image-cropper.json +431 -0
- package/registry/items/input-group.json +189 -0
- package/registry/items/input-otp.json +181 -0
- package/registry/items/input.json +28 -0
- package/registry/items/item.json +308 -0
- package/registry/items/json-tree-view.json +336 -0
- package/registry/items/kanban.json +624 -1
- package/registry/items/kbd.json +54 -0
- package/registry/items/label.json +28 -0
- package/registry/items/lib/controllable.json +1 -0
- package/registry/items/lib/data-table-adapter.json +1 -0
- package/registry/items/lib/drag-preview.json +1 -0
- package/registry/items/lib/form.json +1 -0
- package/registry/items/lib/history.json +1 -0
- package/registry/items/lib/row-layout.json +1 -0
- package/registry/items/lib/table.json +1 -0
- package/registry/items/lib/time.json +1 -0
- package/registry/items/lib/utils.json +1 -0
- package/registry/items/live-region.json +43 -0
- package/registry/items/marker.json +96 -0
- package/registry/items/marquee.json +300 -0
- package/registry/items/menubar.json +1282 -1
- package/registry/items/message.json +166 -0
- package/registry/items/navigation-menu.json +561 -1
- package/registry/items/node-graph.json +1037 -1
- package/registry/items/number-input.json +519 -0
- package/registry/items/pagination.json +244 -1
- package/registry/items/password-input.json +311 -0
- package/registry/items/popconfirm.json +566 -0
- package/registry/items/popover.json +615 -0
- package/registry/items/progress.json +516 -0
- package/registry/items/qr-code.json +249 -0
- package/registry/items/query-builder.json +1368 -1
- package/registry/items/radio-group.json +362 -0
- package/registry/items/rating-group.json +304 -0
- package/registry/items/resizable.json +242 -1
- package/registry/items/rich-text-editor.json +934 -1
- package/registry/items/scheduler.json +1013 -1
- package/registry/items/scroll-area.json +227 -0
- package/registry/items/segment-group.json +363 -0
- package/registry/items/select.json +956 -0
- package/registry/items/separator.json +45 -1
- package/registry/items/sheet.json +592 -0
- package/registry/items/sidebar.json +785 -1
- package/registry/items/signature-pad.json +330 -0
- package/registry/items/skeleton.json +28 -0
- package/registry/items/slider.json +799 -0
- package/registry/items/sonner.json +135 -0
- package/registry/items/spinner.json +28 -0
- package/registry/items/steps.json +483 -0
- package/registry/items/swap.json +107 -0
- package/registry/items/switch.json +362 -0
- package/registry/items/table.json +210 -0
- package/registry/items/tabs.json +326 -0
- package/registry/items/tags-input.json +640 -0
- package/registry/items/textarea.json +28 -0
- package/registry/items/timer.json +289 -0
- package/registry/items/toc.json +372 -0
- package/registry/items/toggle-group.json +214 -1
- package/registry/items/toggle.json +124 -0
- package/registry/items/tooltip.json +417 -0
- package/registry/items/tour.json +498 -0
- package/registry/items/transfer-list.json +609 -1
- package/registry/items/tree-select.json +742 -1
- package/registry/items/tree-view.json +794 -0
- package/registry/items/virtual-list.json +214 -1
- package/src/components/ui/app-shell.tsx +11 -0
- package/src/components/ui/attachment.tsx +1 -0
- package/src/components/ui/calendar.tsx +1 -0
- package/src/components/ui/canvas.tsx +8 -0
- package/src/components/ui/carousel.tsx +3 -0
- package/src/components/ui/cascader.tsx +1 -0
- package/src/components/ui/chart.tsx +10 -0
- package/src/components/ui/combobox.tsx +3 -0
- package/src/components/ui/command.tsx +1 -0
- package/src/components/ui/comment-thread.tsx +11 -0
- package/src/components/ui/context-menu.tsx +6 -0
- package/src/components/ui/data-grid.tsx +8 -0
- package/src/components/ui/data-table.tsx +6 -0
- package/src/components/ui/direction.tsx +2 -0
- package/src/components/ui/dropdown-menu.tsx +6 -0
- package/src/components/ui/field.tsx +1 -0
- package/src/components/ui/gantt.tsx +15 -0
- package/src/components/ui/hotkeys.tsx +3 -0
- package/src/components/ui/kanban.tsx +3 -0
- package/src/components/ui/menubar.tsx +6 -0
- package/src/components/ui/navigation-menu.tsx +1 -0
- package/src/components/ui/node-graph.tsx +23 -0
- package/src/components/ui/pagination.tsx +1 -0
- package/src/components/ui/query-builder.tsx +7 -0
- package/src/components/ui/resizable.tsx +1 -0
- package/src/components/ui/rich-text-editor.tsx +54 -0
- package/src/components/ui/scheduler.tsx +26 -0
- package/src/components/ui/separator.tsx +1 -0
- package/src/components/ui/sidebar.tsx +5 -0
- package/src/components/ui/toggle-group.tsx +3 -0
- package/src/components/ui/transfer-list.tsx +11 -0
- package/src/components/ui/tree-select.tsx +5 -0
- package/src/components/ui/virtual-list.tsx +7 -0
|
@@ -21,6 +21,842 @@
|
|
|
21
21
|
"useFilter",
|
|
22
22
|
"useListCollection"
|
|
23
23
|
],
|
|
24
|
+
"parts": [
|
|
25
|
+
{
|
|
26
|
+
"name": "Command",
|
|
27
|
+
"props": [
|
|
28
|
+
{
|
|
29
|
+
"name": "collection",
|
|
30
|
+
"type": "ListCollection<T>",
|
|
31
|
+
"required": true,
|
|
32
|
+
"description": "The collection of items",
|
|
33
|
+
"from": "@ark-ui/react"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "asChild",
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"required": false,
|
|
39
|
+
"description": "Use the provided child element as the default rendered element, combining their props and behavior.",
|
|
40
|
+
"from": "@ark-ui/react"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "children",
|
|
44
|
+
"type": "ReactNode",
|
|
45
|
+
"required": false,
|
|
46
|
+
"description": "Content rendered inside the part.",
|
|
47
|
+
"from": "@types/react"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "className",
|
|
51
|
+
"type": "string",
|
|
52
|
+
"required": false,
|
|
53
|
+
"description": "Extra classes merged into the part's own classes with `cn`.",
|
|
54
|
+
"from": "@types/react"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "defaultHighlightedValue",
|
|
58
|
+
"type": "string | null",
|
|
59
|
+
"required": false,
|
|
60
|
+
"description": "The initial value of the highlighted item when opened.\nUse when you don't need to control the highlighted value of the listbox.",
|
|
61
|
+
"from": "@zag-js/listbox"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "defaultValue",
|
|
65
|
+
"type": "string[]",
|
|
66
|
+
"required": false,
|
|
67
|
+
"default": "[]",
|
|
68
|
+
"description": "The initial default value of the listbox when rendered.\nUse when you don't need to control the value of the listbox.",
|
|
69
|
+
"from": "@zag-js/listbox"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "deselectable",
|
|
73
|
+
"type": "boolean",
|
|
74
|
+
"required": false,
|
|
75
|
+
"description": "Whether to disallow empty selection",
|
|
76
|
+
"from": "@zag-js/listbox"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "disabled",
|
|
80
|
+
"type": "boolean",
|
|
81
|
+
"required": false,
|
|
82
|
+
"description": "Whether the listbox is disabled",
|
|
83
|
+
"from": "@zag-js/listbox"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "disallowSelectAll",
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"required": false,
|
|
89
|
+
"description": "Whether to disallow selecting all items when `meta+a` is pressed",
|
|
90
|
+
"from": "@zag-js/listbox"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "highlightedValue",
|
|
94
|
+
"type": "string | null",
|
|
95
|
+
"required": false,
|
|
96
|
+
"description": "The controlled key of the highlighted item",
|
|
97
|
+
"from": "@zag-js/listbox"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "id",
|
|
101
|
+
"type": "string",
|
|
102
|
+
"required": false,
|
|
103
|
+
"description": "The unique identifier of the machine.",
|
|
104
|
+
"from": "@zag-js/types"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "ids",
|
|
108
|
+
"type": "ElementIds",
|
|
109
|
+
"required": false,
|
|
110
|
+
"description": "The ids of the elements in the listbox. Useful for composition.",
|
|
111
|
+
"from": "@zag-js/listbox"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "loopFocus",
|
|
115
|
+
"type": "boolean",
|
|
116
|
+
"required": false,
|
|
117
|
+
"default": "false",
|
|
118
|
+
"description": "Whether to loop the keyboard navigation through the options",
|
|
119
|
+
"from": "@zag-js/listbox"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "onHighlightChange",
|
|
123
|
+
"type": "((details: HighlightChangeDetails<T>) => void)",
|
|
124
|
+
"required": false,
|
|
125
|
+
"description": "The callback fired when the highlighted item changes.",
|
|
126
|
+
"from": "@zag-js/listbox"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "onSelect",
|
|
130
|
+
"type": "((details: SelectionDetails) => void)",
|
|
131
|
+
"required": false,
|
|
132
|
+
"description": "Function called when an item is selected",
|
|
133
|
+
"from": "@zag-js/listbox"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "onValueChange",
|
|
137
|
+
"type": "((details: ValueChangeDetails<T>) => void)",
|
|
138
|
+
"required": false,
|
|
139
|
+
"description": "The callback fired when the selected item changes.",
|
|
140
|
+
"from": "@zag-js/listbox"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "orientation",
|
|
144
|
+
"type": "\"horizontal\" | \"vertical\"",
|
|
145
|
+
"required": false,
|
|
146
|
+
"default": "\"vertical\"",
|
|
147
|
+
"description": "The orientation of the listbox.",
|
|
148
|
+
"from": "@zag-js/listbox"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "scrollToIndexFn",
|
|
152
|
+
"type": "((details: ScrollToIndexDetails) => void)",
|
|
153
|
+
"required": false,
|
|
154
|
+
"description": "Function to scroll to a specific index",
|
|
155
|
+
"from": "@zag-js/listbox"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"name": "selectionMode",
|
|
159
|
+
"type": "SelectionMode",
|
|
160
|
+
"required": false,
|
|
161
|
+
"default": "\"single\"",
|
|
162
|
+
"description": "How multiple selection should behave in the listbox.\n\n- `single`: The user can select a single item.\n- `multiple`: The user can select multiple items without using modifier keys.\n- `extended`: The user can select multiple items by using modifier keys.",
|
|
163
|
+
"from": "@zag-js/listbox"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"name": "selectOnHighlight",
|
|
167
|
+
"type": "boolean",
|
|
168
|
+
"required": false,
|
|
169
|
+
"description": "Whether to select the item when it is highlighted",
|
|
170
|
+
"from": "@zag-js/listbox"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "style",
|
|
174
|
+
"type": "CSSProperties",
|
|
175
|
+
"required": false,
|
|
176
|
+
"description": "Inline styles applied to the rendered element.",
|
|
177
|
+
"from": "@types/react"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "typeahead",
|
|
181
|
+
"type": "boolean",
|
|
182
|
+
"required": false,
|
|
183
|
+
"description": "Whether to enable typeahead on the listbox",
|
|
184
|
+
"from": "@zag-js/listbox"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"name": "value",
|
|
188
|
+
"type": "string[]",
|
|
189
|
+
"required": false,
|
|
190
|
+
"description": "The controlled keys of the selected items",
|
|
191
|
+
"from": "@zag-js/listbox"
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"name": "CommandContext",
|
|
197
|
+
"props": [
|
|
198
|
+
{
|
|
199
|
+
"name": "children",
|
|
200
|
+
"type": "(context: UseListboxContext<unknown>) => ReactNode",
|
|
201
|
+
"required": true,
|
|
202
|
+
"description": "Content rendered inside the part.",
|
|
203
|
+
"from": "@ark-ui/react"
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"name": "CommandDialog",
|
|
209
|
+
"props": [
|
|
210
|
+
{
|
|
211
|
+
"name": "className",
|
|
212
|
+
"type": "string",
|
|
213
|
+
"required": false,
|
|
214
|
+
"description": "Extra classes merged into the part's own classes with `cn`.",
|
|
215
|
+
"from": "arkcn"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"name": "description",
|
|
219
|
+
"type": "string",
|
|
220
|
+
"required": false,
|
|
221
|
+
"default": "\"Search for a command to run...\"",
|
|
222
|
+
"description": "Description text.",
|
|
223
|
+
"from": "arkcn"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"name": "showCloseButton",
|
|
227
|
+
"type": "boolean",
|
|
228
|
+
"required": false,
|
|
229
|
+
"default": "false",
|
|
230
|
+
"description": "Render the close button.",
|
|
231
|
+
"from": "arkcn"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"name": "title",
|
|
235
|
+
"type": "string",
|
|
236
|
+
"required": false,
|
|
237
|
+
"default": "\"Command Palette\"",
|
|
238
|
+
"description": "Title text.",
|
|
239
|
+
"from": "arkcn"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"name": "aria-label",
|
|
243
|
+
"type": "string",
|
|
244
|
+
"required": false,
|
|
245
|
+
"description": "Human readable label for the dialog, in event the dialog title is not rendered",
|
|
246
|
+
"from": "@zag-js/dialog"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"name": "children",
|
|
250
|
+
"type": "ReactNode",
|
|
251
|
+
"required": false,
|
|
252
|
+
"description": "Content rendered inside the part.",
|
|
253
|
+
"from": "@ark-ui/react"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"name": "closeOnEscape",
|
|
257
|
+
"type": "boolean",
|
|
258
|
+
"required": false,
|
|
259
|
+
"default": "true",
|
|
260
|
+
"description": "Whether to close the dialog when the escape key is pressed",
|
|
261
|
+
"from": "@zag-js/dialog"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"name": "closeOnInteractOutside",
|
|
265
|
+
"type": "boolean",
|
|
266
|
+
"required": false,
|
|
267
|
+
"default": "true",
|
|
268
|
+
"description": "Whether to close the dialog when the outside is clicked",
|
|
269
|
+
"from": "@zag-js/dialog"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"name": "defaultOpen",
|
|
273
|
+
"type": "boolean",
|
|
274
|
+
"required": false,
|
|
275
|
+
"default": "false",
|
|
276
|
+
"description": "The initial open state of the dialog when rendered.\nUse when you don't need to control the open state of the dialog.",
|
|
277
|
+
"from": "@zag-js/dialog"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"name": "defaultTriggerValue",
|
|
281
|
+
"type": "string | null",
|
|
282
|
+
"required": false,
|
|
283
|
+
"description": "The initial active trigger value when rendered.\nUse when you don't need to control the active trigger value.",
|
|
284
|
+
"from": "@zag-js/dialog"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"name": "finalFocusEl",
|
|
288
|
+
"type": "(() => MaybeElement)",
|
|
289
|
+
"required": false,
|
|
290
|
+
"description": "Element to receive focus when the dialog is closed",
|
|
291
|
+
"from": "@zag-js/dialog"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"name": "hideMode",
|
|
295
|
+
"type": "HideMode",
|
|
296
|
+
"required": false,
|
|
297
|
+
"default": "'display-none'",
|
|
298
|
+
"description": "How to hide content when mounted but not present.\n- `'display-none'`: HTML `hidden` attribute. Effects stay alive.\n- `'activity'`: React 19 `<Activity mode=\"hidden\">`. Effects pause. Requires React 19+.",
|
|
299
|
+
"from": "@ark-ui/react"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"name": "id",
|
|
303
|
+
"type": "string",
|
|
304
|
+
"required": false,
|
|
305
|
+
"description": "The unique identifier of the machine.",
|
|
306
|
+
"from": "@zag-js/types"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"name": "ids",
|
|
310
|
+
"type": "ElementIds",
|
|
311
|
+
"required": false,
|
|
312
|
+
"description": "The ids of the elements in the dialog. Useful for composition.",
|
|
313
|
+
"from": "@zag-js/dialog"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"name": "immediate",
|
|
317
|
+
"type": "boolean",
|
|
318
|
+
"required": false,
|
|
319
|
+
"description": "Whether to synchronize the present change immediately or defer it to the next frame",
|
|
320
|
+
"from": "@zag-js/presence"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"name": "initialFocusEl",
|
|
324
|
+
"type": "(() => MaybeElement)",
|
|
325
|
+
"required": false,
|
|
326
|
+
"description": "Element to receive focus when the dialog is opened",
|
|
327
|
+
"from": "@zag-js/dialog"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"name": "lazyMount",
|
|
331
|
+
"type": "boolean",
|
|
332
|
+
"required": false,
|
|
333
|
+
"default": "false",
|
|
334
|
+
"description": "Whether to enable lazy mounting",
|
|
335
|
+
"from": "@ark-ui/react"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"name": "modal",
|
|
339
|
+
"type": "boolean",
|
|
340
|
+
"required": false,
|
|
341
|
+
"default": "true",
|
|
342
|
+
"description": "Whether to prevent pointer interaction outside the element and hide all content below it",
|
|
343
|
+
"from": "@zag-js/dialog"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"name": "onEnterComplete",
|
|
347
|
+
"type": "VoidFunction",
|
|
348
|
+
"required": false,
|
|
349
|
+
"description": "Function called when the animation ends in the open state",
|
|
350
|
+
"from": "@zag-js/presence"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"name": "onEscapeKeyDown",
|
|
354
|
+
"type": "((event: KeyboardEvent) => void)",
|
|
355
|
+
"required": false,
|
|
356
|
+
"description": "Function called when the escape key is pressed",
|
|
357
|
+
"from": "@zag-js/dismissable"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"name": "onExitComplete",
|
|
361
|
+
"type": "VoidFunction",
|
|
362
|
+
"required": false,
|
|
363
|
+
"description": "Function called when the animation ends in the closed state",
|
|
364
|
+
"from": "@zag-js/presence"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"name": "onFocusOutside",
|
|
368
|
+
"type": "((event: FocusOutsideEvent) => void)",
|
|
369
|
+
"required": false,
|
|
370
|
+
"description": "Function called when the focus is moved outside the component",
|
|
371
|
+
"from": "@zag-js/interact-outside"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"name": "onInteractOutside",
|
|
375
|
+
"type": "((event: InteractOutsideEvent) => void)",
|
|
376
|
+
"required": false,
|
|
377
|
+
"description": "Function called when an interaction happens outside the component",
|
|
378
|
+
"from": "@zag-js/interact-outside"
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"name": "onOpenChange",
|
|
382
|
+
"type": "((details: OpenChangeDetails) => void)",
|
|
383
|
+
"required": false,
|
|
384
|
+
"description": "Function to call when the dialog's open state changes",
|
|
385
|
+
"from": "@zag-js/dialog"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"name": "onPointerDownOutside",
|
|
389
|
+
"type": "((event: PointerDownOutsideEvent) => void)",
|
|
390
|
+
"required": false,
|
|
391
|
+
"description": "Function called when the pointer is pressed down outside the component",
|
|
392
|
+
"from": "@zag-js/interact-outside"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"name": "onRequestDismiss",
|
|
396
|
+
"type": "((event: LayerDismissEvent) => void)",
|
|
397
|
+
"required": false,
|
|
398
|
+
"description": "Function called when this layer is closed due to a parent layer being closed",
|
|
399
|
+
"from": "@zag-js/dismissable"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
"name": "onTriggerValueChange",
|
|
403
|
+
"type": "((details: TriggerValueChangeDetails) => void)",
|
|
404
|
+
"required": false,
|
|
405
|
+
"description": "Function to call when the active trigger changes",
|
|
406
|
+
"from": "@zag-js/dialog"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"name": "open",
|
|
410
|
+
"type": "boolean",
|
|
411
|
+
"required": false,
|
|
412
|
+
"description": "The controlled open state of the dialog",
|
|
413
|
+
"from": "@zag-js/dialog"
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"name": "persistentElements",
|
|
417
|
+
"type": "(() => Element | null)[]",
|
|
418
|
+
"required": false,
|
|
419
|
+
"description": "Returns the persistent elements that:\n- should not have pointer-events disabled\n- should not trigger the dismiss event",
|
|
420
|
+
"from": "@zag-js/dismissable"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"name": "present",
|
|
424
|
+
"type": "boolean",
|
|
425
|
+
"required": false,
|
|
426
|
+
"description": "Whether the node is present (controlled by the user)",
|
|
427
|
+
"from": "@zag-js/presence"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"name": "preventScroll",
|
|
431
|
+
"type": "boolean",
|
|
432
|
+
"required": false,
|
|
433
|
+
"default": "true",
|
|
434
|
+
"description": "Whether to prevent scrolling behind the dialog when it's opened",
|
|
435
|
+
"from": "@zag-js/dialog"
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"name": "restoreFocus",
|
|
439
|
+
"type": "boolean",
|
|
440
|
+
"required": false,
|
|
441
|
+
"description": "Whether to restore focus to the element that had focus before the dialog was opened",
|
|
442
|
+
"from": "@zag-js/dialog"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"name": "role",
|
|
446
|
+
"type": "\"dialog\" | \"alertdialog\"",
|
|
447
|
+
"required": false,
|
|
448
|
+
"default": "\"dialog\"",
|
|
449
|
+
"description": "The dialog's role",
|
|
450
|
+
"from": "@zag-js/dialog"
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"name": "skipAnimationOnMount",
|
|
454
|
+
"type": "boolean",
|
|
455
|
+
"required": false,
|
|
456
|
+
"default": "false",
|
|
457
|
+
"description": "Whether to allow the initial presence animation.",
|
|
458
|
+
"from": "@ark-ui/react"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
"name": "trapFocus",
|
|
462
|
+
"type": "boolean",
|
|
463
|
+
"required": false,
|
|
464
|
+
"default": "true",
|
|
465
|
+
"description": "Whether to trap focus inside the dialog when it's opened",
|
|
466
|
+
"from": "@zag-js/dialog"
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"name": "triggerValue",
|
|
470
|
+
"type": "string | null",
|
|
471
|
+
"required": false,
|
|
472
|
+
"description": "The controlled active trigger value",
|
|
473
|
+
"from": "@zag-js/dialog"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"name": "unmountOnExit",
|
|
477
|
+
"type": "boolean",
|
|
478
|
+
"required": false,
|
|
479
|
+
"default": "false",
|
|
480
|
+
"description": "Whether to unmount on exit.",
|
|
481
|
+
"from": "@ark-ui/react"
|
|
482
|
+
}
|
|
483
|
+
]
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"name": "CommandEmpty",
|
|
487
|
+
"props": [
|
|
488
|
+
{
|
|
489
|
+
"name": "asChild",
|
|
490
|
+
"type": "boolean",
|
|
491
|
+
"required": false,
|
|
492
|
+
"description": "Use the provided child element as the default rendered element, combining their props and behavior.",
|
|
493
|
+
"from": "@ark-ui/react"
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
"name": "children",
|
|
497
|
+
"type": "ReactNode",
|
|
498
|
+
"required": false,
|
|
499
|
+
"description": "Content rendered inside the part.",
|
|
500
|
+
"from": "@types/react"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"name": "className",
|
|
504
|
+
"type": "string",
|
|
505
|
+
"required": false,
|
|
506
|
+
"description": "Extra classes merged into the part's own classes with `cn`.",
|
|
507
|
+
"from": "@types/react"
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"name": "style",
|
|
511
|
+
"type": "CSSProperties",
|
|
512
|
+
"required": false,
|
|
513
|
+
"description": "Inline styles applied to the rendered element.",
|
|
514
|
+
"from": "@types/react"
|
|
515
|
+
}
|
|
516
|
+
]
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
"name": "CommandGroup",
|
|
520
|
+
"props": [
|
|
521
|
+
{
|
|
522
|
+
"name": "heading",
|
|
523
|
+
"type": "ReactNode",
|
|
524
|
+
"required": false,
|
|
525
|
+
"description": "Group heading text.",
|
|
526
|
+
"from": "arkcn"
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
"name": "asChild",
|
|
530
|
+
"type": "boolean",
|
|
531
|
+
"required": false,
|
|
532
|
+
"description": "Use the provided child element as the default rendered element, combining their props and behavior.",
|
|
533
|
+
"from": "@ark-ui/react"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
"name": "children",
|
|
537
|
+
"type": "ReactNode",
|
|
538
|
+
"required": false,
|
|
539
|
+
"description": "Content rendered inside the part.",
|
|
540
|
+
"from": "@types/react"
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"name": "className",
|
|
544
|
+
"type": "string",
|
|
545
|
+
"required": false,
|
|
546
|
+
"description": "Extra classes merged into the part's own classes with `cn`.",
|
|
547
|
+
"from": "@types/react"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
"name": "style",
|
|
551
|
+
"type": "CSSProperties",
|
|
552
|
+
"required": false,
|
|
553
|
+
"description": "Inline styles applied to the rendered element.",
|
|
554
|
+
"from": "@types/react"
|
|
555
|
+
}
|
|
556
|
+
]
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
"name": "CommandGroupLabel",
|
|
560
|
+
"props": [
|
|
561
|
+
{
|
|
562
|
+
"name": "asChild",
|
|
563
|
+
"type": "boolean",
|
|
564
|
+
"required": false,
|
|
565
|
+
"description": "Use the provided child element as the default rendered element, combining their props and behavior.",
|
|
566
|
+
"from": "@ark-ui/react"
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
"name": "children",
|
|
570
|
+
"type": "ReactNode",
|
|
571
|
+
"required": false,
|
|
572
|
+
"description": "Content rendered inside the part.",
|
|
573
|
+
"from": "@types/react"
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
"name": "className",
|
|
577
|
+
"type": "string",
|
|
578
|
+
"required": false,
|
|
579
|
+
"description": "Extra classes merged into the part's own classes with `cn`.",
|
|
580
|
+
"from": "@types/react"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
"name": "style",
|
|
584
|
+
"type": "CSSProperties",
|
|
585
|
+
"required": false,
|
|
586
|
+
"description": "Inline styles applied to the rendered element.",
|
|
587
|
+
"from": "@types/react"
|
|
588
|
+
}
|
|
589
|
+
]
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
"name": "CommandInput",
|
|
593
|
+
"props": [
|
|
594
|
+
{
|
|
595
|
+
"name": "onValueChange",
|
|
596
|
+
"type": "((value: string) => void)",
|
|
597
|
+
"required": false,
|
|
598
|
+
"description": "Called with the input text on every change. Wire it to your collection's `filter`.",
|
|
599
|
+
"from": "arkcn"
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
"name": "asChild",
|
|
603
|
+
"type": "boolean",
|
|
604
|
+
"required": false,
|
|
605
|
+
"description": "Use the provided child element as the default rendered element, combining their props and behavior.",
|
|
606
|
+
"from": "@ark-ui/react"
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
"name": "autoHighlight",
|
|
610
|
+
"type": "boolean",
|
|
611
|
+
"required": false,
|
|
612
|
+
"default": "true",
|
|
613
|
+
"description": "Whether to automatically highlight the item when typing",
|
|
614
|
+
"from": "@zag-js/listbox"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"name": "children",
|
|
618
|
+
"type": "ReactNode",
|
|
619
|
+
"required": false,
|
|
620
|
+
"description": "Content rendered inside the part.",
|
|
621
|
+
"from": "@types/react"
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
"name": "className",
|
|
625
|
+
"type": "string",
|
|
626
|
+
"required": false,
|
|
627
|
+
"description": "Extra classes merged into the part's own classes with `cn`.",
|
|
628
|
+
"from": "@types/react"
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
"name": "keyboardPriority",
|
|
632
|
+
"type": "\"navigate\" | \"caret\"",
|
|
633
|
+
"required": false,
|
|
634
|
+
"default": "\"caret\"",
|
|
635
|
+
"description": "Determines how keyboard conflicts in the input are resolved.\n- \"caret\": keep native text-editing behavior\n- \"navigate\": forward supported keys to listbox navigation",
|
|
636
|
+
"from": "@zag-js/listbox"
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
"name": "style",
|
|
640
|
+
"type": "CSSProperties",
|
|
641
|
+
"required": false,
|
|
642
|
+
"description": "Inline styles applied to the rendered element.",
|
|
643
|
+
"from": "@types/react"
|
|
644
|
+
}
|
|
645
|
+
]
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"name": "CommandItem",
|
|
649
|
+
"props": [
|
|
650
|
+
{
|
|
651
|
+
"name": "item",
|
|
652
|
+
"type": "any",
|
|
653
|
+
"required": false,
|
|
654
|
+
"description": "The collection item. Falls back to `value` for string collections.",
|
|
655
|
+
"from": "arkcn"
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
"name": "onSelect",
|
|
659
|
+
"type": "SelectHandler",
|
|
660
|
+
"required": false,
|
|
661
|
+
"description": "Called with the item's value when it is selected by click or Enter.",
|
|
662
|
+
"from": "arkcn"
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
"name": "value",
|
|
666
|
+
"type": "string",
|
|
667
|
+
"required": false,
|
|
668
|
+
"description": "The controlled value.",
|
|
669
|
+
"from": "arkcn"
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
"name": "asChild",
|
|
673
|
+
"type": "boolean",
|
|
674
|
+
"required": false,
|
|
675
|
+
"description": "Use the provided child element as the default rendered element, combining their props and behavior.",
|
|
676
|
+
"from": "@ark-ui/react"
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
"name": "children",
|
|
680
|
+
"type": "ReactNode",
|
|
681
|
+
"required": false,
|
|
682
|
+
"description": "Content rendered inside the part.",
|
|
683
|
+
"from": "@types/react"
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
"name": "className",
|
|
687
|
+
"type": "string",
|
|
688
|
+
"required": false,
|
|
689
|
+
"description": "Extra classes merged into the part's own classes with `cn`.",
|
|
690
|
+
"from": "@types/react"
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
"name": "highlightOnHover",
|
|
694
|
+
"type": "boolean",
|
|
695
|
+
"required": false,
|
|
696
|
+
"description": "Whether to highlight the item on hover",
|
|
697
|
+
"from": "@zag-js/listbox"
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
"name": "style",
|
|
701
|
+
"type": "CSSProperties",
|
|
702
|
+
"required": false,
|
|
703
|
+
"description": "Inline styles applied to the rendered element.",
|
|
704
|
+
"from": "@types/react"
|
|
705
|
+
}
|
|
706
|
+
]
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
"name": "CommandItemIndicator",
|
|
710
|
+
"props": [
|
|
711
|
+
{
|
|
712
|
+
"name": "asChild",
|
|
713
|
+
"type": "boolean",
|
|
714
|
+
"required": false,
|
|
715
|
+
"description": "Use the provided child element as the default rendered element, combining their props and behavior.",
|
|
716
|
+
"from": "@ark-ui/react"
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"name": "children",
|
|
720
|
+
"type": "ReactNode",
|
|
721
|
+
"required": false,
|
|
722
|
+
"description": "Content rendered inside the part.",
|
|
723
|
+
"from": "@types/react"
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
"name": "className",
|
|
727
|
+
"type": "string",
|
|
728
|
+
"required": false,
|
|
729
|
+
"description": "Extra classes merged into the part's own classes with `cn`.",
|
|
730
|
+
"from": "@types/react"
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
"name": "style",
|
|
734
|
+
"type": "CSSProperties",
|
|
735
|
+
"required": false,
|
|
736
|
+
"description": "Inline styles applied to the rendered element.",
|
|
737
|
+
"from": "@types/react"
|
|
738
|
+
}
|
|
739
|
+
]
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
"name": "CommandItemText",
|
|
743
|
+
"props": [
|
|
744
|
+
{
|
|
745
|
+
"name": "asChild",
|
|
746
|
+
"type": "boolean",
|
|
747
|
+
"required": false,
|
|
748
|
+
"description": "Use the provided child element as the default rendered element, combining their props and behavior.",
|
|
749
|
+
"from": "@ark-ui/react"
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
"name": "children",
|
|
753
|
+
"type": "ReactNode",
|
|
754
|
+
"required": false,
|
|
755
|
+
"description": "Content rendered inside the part.",
|
|
756
|
+
"from": "@types/react"
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
"name": "className",
|
|
760
|
+
"type": "string",
|
|
761
|
+
"required": false,
|
|
762
|
+
"description": "Extra classes merged into the part's own classes with `cn`.",
|
|
763
|
+
"from": "@types/react"
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
"name": "style",
|
|
767
|
+
"type": "CSSProperties",
|
|
768
|
+
"required": false,
|
|
769
|
+
"description": "Inline styles applied to the rendered element.",
|
|
770
|
+
"from": "@types/react"
|
|
771
|
+
}
|
|
772
|
+
]
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
"name": "CommandList",
|
|
776
|
+
"props": [
|
|
777
|
+
{
|
|
778
|
+
"name": "asChild",
|
|
779
|
+
"type": "boolean",
|
|
780
|
+
"required": false,
|
|
781
|
+
"description": "Use the provided child element as the default rendered element, combining their props and behavior.",
|
|
782
|
+
"from": "@ark-ui/react"
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
"name": "children",
|
|
786
|
+
"type": "ReactNode",
|
|
787
|
+
"required": false,
|
|
788
|
+
"description": "Content rendered inside the part.",
|
|
789
|
+
"from": "@types/react"
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
"name": "className",
|
|
793
|
+
"type": "string",
|
|
794
|
+
"required": false,
|
|
795
|
+
"description": "Extra classes merged into the part's own classes with `cn`.",
|
|
796
|
+
"from": "@types/react"
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
"name": "style",
|
|
800
|
+
"type": "CSSProperties",
|
|
801
|
+
"required": false,
|
|
802
|
+
"description": "Inline styles applied to the rendered element.",
|
|
803
|
+
"from": "@types/react"
|
|
804
|
+
}
|
|
805
|
+
]
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
"name": "CommandSeparator",
|
|
809
|
+
"props": [
|
|
810
|
+
{
|
|
811
|
+
"name": "children",
|
|
812
|
+
"type": "ReactNode",
|
|
813
|
+
"required": false,
|
|
814
|
+
"description": "Content rendered inside the part.",
|
|
815
|
+
"from": "@types/react"
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
"name": "className",
|
|
819
|
+
"type": "string",
|
|
820
|
+
"required": false,
|
|
821
|
+
"description": "Extra classes merged into the part's own classes with `cn`.",
|
|
822
|
+
"from": "@types/react"
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
"name": "style",
|
|
826
|
+
"type": "CSSProperties",
|
|
827
|
+
"required": false,
|
|
828
|
+
"description": "Inline styles applied to the rendered element.",
|
|
829
|
+
"from": "@types/react"
|
|
830
|
+
}
|
|
831
|
+
]
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
"name": "CommandShortcut",
|
|
835
|
+
"props": [
|
|
836
|
+
{
|
|
837
|
+
"name": "children",
|
|
838
|
+
"type": "ReactNode",
|
|
839
|
+
"required": false,
|
|
840
|
+
"description": "Content rendered inside the part.",
|
|
841
|
+
"from": "@types/react"
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
"name": "className",
|
|
845
|
+
"type": "string",
|
|
846
|
+
"required": false,
|
|
847
|
+
"description": "Extra classes merged into the part's own classes with `cn`.",
|
|
848
|
+
"from": "@types/react"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
"name": "style",
|
|
852
|
+
"type": "CSSProperties",
|
|
853
|
+
"required": false,
|
|
854
|
+
"description": "Inline styles applied to the rendered element.",
|
|
855
|
+
"from": "@types/react"
|
|
856
|
+
}
|
|
857
|
+
]
|
|
858
|
+
}
|
|
859
|
+
],
|
|
24
860
|
"dependencies": {
|
|
25
861
|
"@ark-ui/react": "^5.39.1",
|
|
26
862
|
"lucide-react": "^1.41.0"
|
|
@@ -33,7 +869,7 @@
|
|
|
33
869
|
"files": [
|
|
34
870
|
{
|
|
35
871
|
"path": "components/ui/command.tsx",
|
|
36
|
-
"content": "import * as React from \"react\"\nimport {\n Listbox as CommandPrimitive,\n createListCollection,\n useFilter,\n useListCollection,\n type CollectionItem,\n type ListCollection,\n} from \"@ark-ui/react\"\nimport { cn } from \"@/lib/utils\"\n\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from \"@/components/ui/dialog\"\nimport { InputGroup, InputGroupAddon } from \"@/components/ui/input-group\"\nimport { SearchIcon, CheckIcon } from \"lucide-react\"\n\n/**\n * Backed by Ark UI's Listbox. Ark has no built-in fuzzy filter: pass a\n * `collection` and filter it yourself (see `useListCollection` and\n * `useFilter`, re-exported below), wiring `CommandInput`'s `onValueChange`\n * to the collection's `filter`.\n */\n\ntype SelectHandler = (value: string) => void\n\nconst CommandSelectContext = React.createContext<{\n register: (value: string, handler: SelectHandler) => () => void\n} | null>(null)\n\nfunction Command<T extends CollectionItem>({\n className,\n selectionMode = \"single\",\n onSelect,\n defaultHighlightedValue,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Root<T>>) {\n // Like cmdk, highlight the first item on mount so Enter works immediately.\n const initialHighlight = defaultHighlightedValue ?? props.collection.firstValue\n const handlers = React.useRef(new Map<string, SelectHandler>())\n const register = React.useCallback((value: string, handler: SelectHandler) => {\n handlers.current.set(value, handler)\n return () => {\n handlers.current.delete(value)\n }\n }, [])\n const ctx = React.useMemo(() => ({ register }), [register])\n return (\n <CommandSelectContext.Provider value={ctx}>\n <CommandPrimitive.Root\n data-slot=\"command\"\n selectionMode={selectionMode}\n defaultHighlightedValue={initialHighlight}\n onSelect={(details) => {\n handlers.current.get(details.value)?.(details.value)\n onSelect?.(details)\n }}\n className={cn(\n \"flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground\",\n className\n )}\n {...props}\n />\n </CommandSelectContext.Provider>\n )\n}\n\nfunction CommandContext({ ...props }: React.ComponentProps<typeof CommandPrimitive.Context>) {\n return <CommandPrimitive.Context {...props} />\n}\n\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = false,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n title?: string\n description?: string\n className?: string\n showCloseButton?: boolean\n}) {\n return (\n <Dialog {...props}>\n <DialogContent className={cn(\"overflow-hidden rounded-xl! p-0\", className)} showCloseButton={showCloseButton}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n {children}\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput({\n className,\n autoHighlight = true,\n onValueChange,\n onChange,\n onFocus,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input> & {\n /** Called with the input text on every change. Wire it to your collection's `filter`. */\n onValueChange?: (value: string) => void\n}) {\n const settled = React.useRef(false)\n return (\n <div data-slot=\"command-input-wrapper\" className=\"p-1 pb-0\">\n <InputGroup className=\"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!\">\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n autoHighlight={autoHighlight}\n onFocus={(event) => {\n onFocus?.(event)\n // When a Dialog focuses this input in the same tick it mounts, the\n // listbox machine has not entered its ready state yet and drops the\n // focus event, leaving the highlighted item invisible. Re-issue the\n // focus once, on the next tick, so the listbox registers it.\n if (settled.current) return\n settled.current = true\n const el = event.currentTarget\n setTimeout(() => {\n if (document.activeElement !== el) return\n el.blur()\n el.focus({ preventScroll: true })\n }, 0)\n }}\n className={cn(\"w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50\", className)}\n onChange={(event) => {\n onChange?.(event)\n onValueChange?.(event.currentTarget.value)\n }}\n {...props}\n />\n <InputGroupAddon>\n <SearchIcon className=\"size-4 shrink-0 opacity-50\" />\n </InputGroupAddon>\n </InputGroup>\n </div>\n )\n}\n\nfunction CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Content>) {\n return (\n <CommandPrimitive.Content\n data-slot=\"command-list\"\n className={cn(\"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className={cn(\"py-6 text-center text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandGroup({\n className,\n heading,\n children,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.ItemGroup> & {\n heading?: React.ReactNode\n}) {\n return (\n <CommandPrimitive.ItemGroup\n data-slot=\"command-group\"\n className={cn(\"overflow-hidden p-1 text-foreground\", className)}\n {...props}\n >\n {heading != null && <CommandGroupLabel>{heading}</CommandGroupLabel>}\n {children}\n </CommandPrimitive.ItemGroup>\n )\n}\n\nfunction CommandGroupLabel({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.ItemGroupLabel>) {\n return (\n <CommandPrimitive.ItemGroupLabel\n data-slot=\"command-group-label\"\n className={cn(\"px-2 py-1.5 text-xs font-medium text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n role=\"separator\"\n aria-orientation=\"horizontal\"\n data-slot=\"command-separator\"\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({\n className,\n children,\n item,\n value,\n onSelect,\n ...props\n}: Omit<React.ComponentProps<typeof CommandPrimitive.Item>, \"item\" | \"onSelect\"> & {\n /** The collection item. Falls back to `value` for string collections. */\n item?: CollectionItem\n value?: string\n /** Called with the item's value when it is selected by click or Enter. */\n onSelect?: SelectHandler\n}) {\n const ctx = React.useContext(CommandSelectContext)\n const resolvedItem = item ?? value\n const itemValue =\n typeof resolvedItem === \"string\" ? resolvedItem : ((resolvedItem as { value?: string } | undefined)?.value ?? value)\n React.useEffect(() => {\n if (!ctx || !onSelect || itemValue == null) return\n return ctx.register(itemValue, onSelect)\n }, [ctx, onSelect, itemValue])\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n item={resolvedItem}\n className={cn(\n \"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-highlighted:bg-muted data-highlighted:text-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-highlighted:*:[svg]:text-foreground\",\n className\n )}\n {...props}\n >\n {children}\n <CommandItemIndicator>\n <CheckIcon />\n </CommandItemIndicator>\n </CommandPrimitive.Item>\n )\n}\n\nfunction CommandItemText({ ...props }: React.ComponentProps<typeof CommandPrimitive.ItemText>) {\n return <CommandPrimitive.ItemText data-slot=\"command-item-text\" {...props} />\n}\n\nfunction CommandItemIndicator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.ItemIndicator>) {\n return (\n <CommandPrimitive.ItemIndicator\n data-slot=\"command-item-indicator\"\n className={cn(\"ml-auto group-has-data-[slot=command-shortcut]/command-item:hidden\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandShortcut({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground group-data-highlighted/command-item:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandContext,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandGroupLabel,\n CommandInput,\n CommandItem,\n CommandItemIndicator,\n CommandItemText,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n createListCollection,\n useFilter,\n useListCollection,\n type CollectionItem,\n type ListCollection,\n}\n"
|
|
872
|
+
"content": "import * as React from \"react\"\nimport {\n Listbox as CommandPrimitive,\n createListCollection,\n useFilter,\n useListCollection,\n type CollectionItem,\n type ListCollection,\n} from \"@ark-ui/react\"\nimport { cn } from \"@/lib/utils\"\n\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from \"@/components/ui/dialog\"\nimport { InputGroup, InputGroupAddon } from \"@/components/ui/input-group\"\nimport { SearchIcon, CheckIcon } from \"lucide-react\"\n\n/**\n * Backed by Ark UI's Listbox. Ark has no built-in fuzzy filter: pass a\n * `collection` and filter it yourself (see `useListCollection` and\n * `useFilter`, re-exported below), wiring `CommandInput`'s `onValueChange`\n * to the collection's `filter`.\n */\n\ntype SelectHandler = (value: string) => void\n\nconst CommandSelectContext = React.createContext<{\n register: (value: string, handler: SelectHandler) => () => void\n} | null>(null)\n\nfunction Command<T extends CollectionItem>({\n className,\n selectionMode = \"single\",\n onSelect,\n defaultHighlightedValue,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Root<T>>) {\n // Like cmdk, highlight the first item on mount so Enter works immediately.\n const initialHighlight = defaultHighlightedValue ?? props.collection.firstValue\n const handlers = React.useRef(new Map<string, SelectHandler>())\n const register = React.useCallback((value: string, handler: SelectHandler) => {\n handlers.current.set(value, handler)\n return () => {\n handlers.current.delete(value)\n }\n }, [])\n const ctx = React.useMemo(() => ({ register }), [register])\n return (\n <CommandSelectContext.Provider value={ctx}>\n <CommandPrimitive.Root\n data-slot=\"command\"\n selectionMode={selectionMode}\n defaultHighlightedValue={initialHighlight}\n onSelect={(details) => {\n handlers.current.get(details.value)?.(details.value)\n onSelect?.(details)\n }}\n className={cn(\n \"flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground\",\n className\n )}\n {...props}\n />\n </CommandSelectContext.Provider>\n )\n}\n\nfunction CommandContext({ ...props }: React.ComponentProps<typeof CommandPrimitive.Context>) {\n return <CommandPrimitive.Context {...props} />\n}\n\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = false,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n title?: string\n description?: string\n className?: string\n showCloseButton?: boolean\n}) {\n return (\n <Dialog {...props}>\n <DialogContent className={cn(\"overflow-hidden rounded-xl! p-0\", className)} showCloseButton={showCloseButton}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n {children}\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput({\n className,\n autoHighlight = true,\n onValueChange,\n onChange,\n onFocus,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input> & {\n /** Called with the input text on every change. Wire it to your collection's `filter`. */\n onValueChange?: (value: string) => void\n}) {\n const settled = React.useRef(false)\n return (\n <div data-slot=\"command-input-wrapper\" className=\"p-1 pb-0\">\n <InputGroup className=\"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!\">\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n autoHighlight={autoHighlight}\n onFocus={(event) => {\n onFocus?.(event)\n // When a Dialog focuses this input in the same tick it mounts, the\n // listbox machine has not entered its ready state yet and drops the\n // focus event, leaving the highlighted item invisible. Re-issue the\n // focus once, on the next tick, so the listbox registers it.\n if (settled.current) return\n settled.current = true\n const el = event.currentTarget\n setTimeout(() => {\n if (document.activeElement !== el) return\n el.blur()\n el.focus({ preventScroll: true })\n }, 0)\n }}\n className={cn(\"w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50\", className)}\n onChange={(event) => {\n onChange?.(event)\n onValueChange?.(event.currentTarget.value)\n }}\n {...props}\n />\n <InputGroupAddon>\n <SearchIcon className=\"size-4 shrink-0 opacity-50\" />\n </InputGroupAddon>\n </InputGroup>\n </div>\n )\n}\n\nfunction CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Content>) {\n return (\n <CommandPrimitive.Content\n data-slot=\"command-list\"\n className={cn(\"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className={cn(\"py-6 text-center text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandGroup({\n className,\n heading,\n children,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.ItemGroup> & {\n /** Group heading text. */\n heading?: React.ReactNode\n}) {\n return (\n <CommandPrimitive.ItemGroup\n data-slot=\"command-group\"\n className={cn(\"overflow-hidden p-1 text-foreground\", className)}\n {...props}\n >\n {heading != null && <CommandGroupLabel>{heading}</CommandGroupLabel>}\n {children}\n </CommandPrimitive.ItemGroup>\n )\n}\n\nfunction CommandGroupLabel({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.ItemGroupLabel>) {\n return (\n <CommandPrimitive.ItemGroupLabel\n data-slot=\"command-group-label\"\n className={cn(\"px-2 py-1.5 text-xs font-medium text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n role=\"separator\"\n aria-orientation=\"horizontal\"\n data-slot=\"command-separator\"\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({\n className,\n children,\n item,\n value,\n onSelect,\n ...props\n}: Omit<React.ComponentProps<typeof CommandPrimitive.Item>, \"item\" | \"onSelect\"> & {\n /** The collection item. Falls back to `value` for string collections. */\n item?: CollectionItem\n value?: string\n /** Called with the item's value when it is selected by click or Enter. */\n onSelect?: SelectHandler\n}) {\n const ctx = React.useContext(CommandSelectContext)\n const resolvedItem = item ?? value\n const itemValue =\n typeof resolvedItem === \"string\" ? resolvedItem : ((resolvedItem as { value?: string } | undefined)?.value ?? value)\n React.useEffect(() => {\n if (!ctx || !onSelect || itemValue == null) return\n return ctx.register(itemValue, onSelect)\n }, [ctx, onSelect, itemValue])\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n item={resolvedItem}\n className={cn(\n \"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-highlighted:bg-muted data-highlighted:text-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-highlighted:*:[svg]:text-foreground\",\n className\n )}\n {...props}\n >\n {children}\n <CommandItemIndicator>\n <CheckIcon />\n </CommandItemIndicator>\n </CommandPrimitive.Item>\n )\n}\n\nfunction CommandItemText({ ...props }: React.ComponentProps<typeof CommandPrimitive.ItemText>) {\n return <CommandPrimitive.ItemText data-slot=\"command-item-text\" {...props} />\n}\n\nfunction CommandItemIndicator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.ItemIndicator>) {\n return (\n <CommandPrimitive.ItemIndicator\n data-slot=\"command-item-indicator\"\n className={cn(\"ml-auto group-has-data-[slot=command-shortcut]/command-item:hidden\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandShortcut({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground group-data-highlighted/command-item:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandContext,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandGroupLabel,\n CommandInput,\n CommandItem,\n CommandItemIndicator,\n CommandItemText,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n createListCollection,\n useFilter,\n useListCollection,\n type CollectionItem,\n type ListCollection,\n}\n"
|
|
37
873
|
}
|
|
38
874
|
],
|
|
39
875
|
"docs": "## Porting rules\n- **Feature parity** with the shadcn original: same exported names, same props surface\n where Ark supports it, same visual result, same variants.\n- **Ark's tree wins** where the structure differs (e.g. `Positioner` wrappers,\n `Control`/`HiddenInput` splits, `ItemGroup`/`ItemGroupLabel`, `Backdrop` vs `Overlay`).\n Export the extra Ark parts as their own composable pieces; do not fold them away.\n- **Stay compositional.** Every part is its own exported component. No collapsing\n parts into a single \"smart\" component, no dropping sub-parts to simplify.\n- **Styling:** `cn` from `@/lib/utils` and `cva` from `class-variance-authority`.\n Style state via Ark's data attributes (`data-state`, `data-open`, `data-disabled`,\n `data-highlighted`, `data-placement`, `data-orientation`, ...). Keep `data-slot`\n attributes on every part, as shadcn does.\n- `command.tsx` runs on Ark's Listbox and `drawer.tsx` on Ark's Drawer; `cmdk`, `vaul`,\n `radix-ui`, `@base-ui/react`, and every shadcn package (`shadcn` CLI, `@shadcn/react`,\n `cn`) are removed. Do not reintroduce them. `cn` is clsx + tailwind-merge in\n `src/lib/utils.ts`. Base variants, keyframes, and utilities live in `src/index.css`\n (keyframes at the end of the `@theme inline` block); there is no `components.json`.\n- `questionnaire.tsx` and `message-scroller.tsx` were removed because they depended on\n the `@shadcn/react` runtime. Rebuild from scratch if they are wanted.\n- Components with no Ark equivalent (calendar, carousel, chart, resizable, input-otp,\n sonner/toast) keep their current libraries. Separator, Label, AspectRatio, Direction\n are plain React."
|