@orbitcommerce/constellation-docs 0.0.0-stage → 1.0.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.
Files changed (62) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +6 -2
  3. package/dist/docs.css +8260 -0
  4. package/dist/index.d.ts +33 -0
  5. package/dist/index.js +308 -0
  6. package/dist/pages/Playground-CNbBbErC.js +129 -0
  7. package/dist/pages/_figures-data-BDmScEny.js +606 -0
  8. package/dist/pages/_foundations-blXWyYh8.js +30 -0
  9. package/dist/pages/_overlays-specimens-Dpn6oiyH.js +310 -0
  10. package/dist/pages/alert-BD4e6QTh.js +769 -0
  11. package/dist/pages/app-shell-KbA-nRqZ.js +1479 -0
  12. package/dist/pages/area-chart-B91dLcGo.js +562 -0
  13. package/dist/pages/avatar-DPPHXJAu.js +713 -0
  14. package/dist/pages/badge-C9JR0thI.js +729 -0
  15. package/dist/pages/button-D3V912P4.js +518 -0
  16. package/dist/pages/calendar-DSDZ9nRH.js +630 -0
  17. package/dist/pages/card-DUggbis3.js +659 -0
  18. package/dist/pages/checkbox-DwimQaK3.js +365 -0
  19. package/dist/pages/colour-BwuO8xAv.js +1498 -0
  20. package/dist/pages/command-palette-xAD7fOg6.js +1243 -0
  21. package/dist/pages/date-picker-BYSa816m.js +1421 -0
  22. package/dist/pages/delta-CtAo0eIM.js +574 -0
  23. package/dist/pages/dialog-BRAf4LMh.js +1451 -0
  24. package/dist/pages/docs-BNOb7AqR.js +515 -0
  25. package/dist/pages/empty-state-C-mLrXW2.js +417 -0
  26. package/dist/pages/figure-tabs-CoPFzzKz.js +460 -0
  27. package/dist/pages/home-dashboard-CFQwDtC9.js +959 -0
  28. package/dist/pages/host-B6znjEgQ.js +109 -0
  29. package/dist/pages/icon-button-C9eSVPPW.js +861 -0
  30. package/dist/pages/icons-sxkTs5Ob.js +473 -0
  31. package/dist/pages/input-KF9Gkawf.js +1093 -0
  32. package/dist/pages/installation-DpsX8G_n.js +445 -0
  33. package/dist/pages/kbd-cNfDoikz.js +544 -0
  34. package/dist/pages/live-globe-ClvLn9Lb.js +571 -0
  35. package/dist/pages/logo-BfGF1Pq9.js +571 -0
  36. package/dist/pages/menu-by2sgQ09.js +1618 -0
  37. package/dist/pages/motion-BvTGc2Dk.js +855 -0
  38. package/dist/pages/orbit-spinner-Dil1Z3Oy.js +332 -0
  39. package/dist/pages/overview-BPEbZQ6g.js +130 -0
  40. package/dist/pages/pagination-BBUnGvv5.js +249 -0
  41. package/dist/pages/popover-Db1gLDpb.js +1136 -0
  42. package/dist/pages/principles-CeAIOIdt.js +483 -0
  43. package/dist/pages/radio-group-CkdBWWfG.js +1077 -0
  44. package/dist/pages/registry-CroHzK9I.js +244 -0
  45. package/dist/pages/release-Dvo684UJ.js +13 -0
  46. package/dist/pages/rolling-number-qmvH84Mq.js +529 -0
  47. package/dist/pages/search-field-BN7MWGQ4.js +693 -0
  48. package/dist/pages/segmented-control-CTbIpRBW.js +777 -0
  49. package/dist/pages/select-DguELoRR.js +1429 -0
  50. package/dist/pages/separator-CPZub9pv.js +351 -0
  51. package/dist/pages/shape-DKvA0YKr.js +627 -0
  52. package/dist/pages/skeleton-DLuBhP46.js +561 -0
  53. package/dist/pages/sparkline-DMMYGbHn.js +668 -0
  54. package/dist/pages/switch-B-Qe4kcT.js +517 -0
  55. package/dist/pages/table-AMoODng4.js +607 -0
  56. package/dist/pages/tabs-B4M-usCV.js +1455 -0
  57. package/dist/pages/textarea-fTuUZRQb.js +693 -0
  58. package/dist/pages/toast-CKP03zjy.js +1176 -0
  59. package/dist/pages/tooltip-CBYil3kt.js +697 -0
  60. package/dist/pages/typography-PCbg8Bhg.js +735 -0
  61. package/manifest.json +3125 -0
  62. package/package.json +35 -4
@@ -0,0 +1,1243 @@
1
+ "use client";
2
+ import { a as DocTable, d as Section, i as DocPage, l as Note, m as ThemePair, o as Example, p as SubSection, s as Guidelines, u as PropsTable } from "./docs-BNOb7AqR.js";
3
+ import { c as SpecimenFrame, o as PaletteStill } from "./_overlays-specimens-Dpn6oiyH.js";
4
+ import { useEffect, useRef, useState } from "react";
5
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
+ import { Avatar, Button, CommandEmpty, CommandGroup, CommandHints, CommandItem, CommandKey, CommandLoading, CommandPalette, CommandSeparator, IconButton, SearchTrigger } from "@orbitcommerce/constellation";
7
+ import { BellIcon, ChartLineUpIcon, FilePlusIcon, GearSixIcon, HouseIcon, MagnifyingGlassIcon, PackageIcon, PlusSquareIcon, QuestionIcon, ReceiptIcon, UserPlusIcon, UsersThreeIcon } from "@orbitcommerce/constellation/icons";
8
+ //#region src/pages/components/command-palette.tsx
9
+ var ORDERS = [
10
+ {
11
+ number: "1043",
12
+ customer: "Sarah Whitfield",
13
+ total: "£240.00",
14
+ status: "Paid"
15
+ },
16
+ {
17
+ number: "1042",
18
+ customer: "James Okafor",
19
+ total: "£89.50",
20
+ status: "Unfulfilled"
21
+ },
22
+ {
23
+ number: "1041",
24
+ customer: "Priya Shah",
25
+ total: "£1,120.00",
26
+ status: "Paid"
27
+ },
28
+ {
29
+ number: "1039",
30
+ customer: "Tom Hughes",
31
+ total: "£34.99",
32
+ status: "Refunded"
33
+ },
34
+ {
35
+ number: "1036",
36
+ customer: "Eleanor Price",
37
+ total: "£412.80",
38
+ status: "Fulfilled"
39
+ },
40
+ {
41
+ number: "1031",
42
+ customer: "Sarah Whitfield",
43
+ total: "£65.00",
44
+ status: "Fulfilled"
45
+ }
46
+ ];
47
+ var PRODUCTS = [
48
+ {
49
+ name: "White oak side table",
50
+ sku: "TBL-OAK-45",
51
+ price: "£149.00",
52
+ stock: "12 in stock"
53
+ },
54
+ {
55
+ name: "Arden ergonomic chair",
56
+ sku: "CHR-ARD-01",
57
+ price: "£229.00",
58
+ stock: "4 in stock"
59
+ },
60
+ {
61
+ name: "Walnut bookcase",
62
+ sku: "BKC-WAL-180",
63
+ price: "£389.00",
64
+ stock: "Out of stock"
65
+ },
66
+ {
67
+ name: "Walnut desk riser",
68
+ sku: "DSK-WAL-60",
69
+ price: "£84.00",
70
+ stock: "19 in stock"
71
+ },
72
+ {
73
+ name: "Brass desk lamp",
74
+ sku: "LMP-BRS-01",
75
+ price: "£72.00",
76
+ stock: "9 in stock"
77
+ },
78
+ {
79
+ name: "Sit-stand desk, 140cm",
80
+ sku: "DSK-SIT-140",
81
+ price: "£449.00",
82
+ stock: "6 in stock"
83
+ }
84
+ ];
85
+ var CUSTOMERS = [
86
+ {
87
+ name: "Sarah Whitfield",
88
+ email: "sarah.whitfield@example.co.uk",
89
+ city: "Leeds",
90
+ orders: 6
91
+ },
92
+ {
93
+ name: "Sam Whitaker",
94
+ email: "sam.whitaker@example.co.uk",
95
+ city: "York",
96
+ orders: 3
97
+ },
98
+ {
99
+ name: "James Okafor",
100
+ email: "james.okafor@example.co.uk",
101
+ city: "Manchester",
102
+ orders: 2
103
+ },
104
+ {
105
+ name: "Priya Shah",
106
+ email: "priya.shah@example.co.uk",
107
+ city: "Bristol",
108
+ orders: 9
109
+ },
110
+ {
111
+ name: "Eleanor Price",
112
+ email: "eleanor.price@example.co.uk",
113
+ city: "Edinburgh",
114
+ orders: 4
115
+ }
116
+ ];
117
+ /** The "server": a plain substring search over the sample data. */
118
+ function search(query) {
119
+ const q = query.toLowerCase();
120
+ const has = (...fields) => fields.some((f) => f.toLowerCase().includes(q));
121
+ return {
122
+ orders: ORDERS.filter((o) => has(`#${o.number}`, o.customer)).slice(0, 4),
123
+ products: PRODUCTS.filter((p) => has(p.name, p.sku)).slice(0, 4),
124
+ customers: CUSTOMERS.filter((c) => has(c.name, c.email, c.city)).slice(0, 4)
125
+ };
126
+ }
127
+ function countOf(results) {
128
+ return results ? results.orders.length + results.products.length + results.customers.length : 0;
129
+ }
130
+ /** Simulates a server search: results land `delay` ms after the last keystroke. */
131
+ function useServerSearch(query, delay) {
132
+ const [results, setResults] = useState(null);
133
+ const [loading, setLoading] = useState(false);
134
+ useEffect(() => {
135
+ const q = query.trim();
136
+ if (!q) {
137
+ setResults(null);
138
+ setLoading(false);
139
+ return;
140
+ }
141
+ setLoading(true);
142
+ const timer = window.setTimeout(() => {
143
+ setResults(search(q));
144
+ setLoading(false);
145
+ }, delay);
146
+ return () => window.clearTimeout(timer);
147
+ }, [query, delay]);
148
+ return {
149
+ results,
150
+ loading
151
+ };
152
+ }
153
+ var PAGES = [
154
+ {
155
+ label: "Home",
156
+ icon: /* @__PURE__ */ jsx(HouseIcon, {}),
157
+ keys: ["G", "H"]
158
+ },
159
+ {
160
+ label: "Orders",
161
+ icon: /* @__PURE__ */ jsx(ReceiptIcon, {}),
162
+ keys: ["G", "O"]
163
+ },
164
+ {
165
+ label: "Products",
166
+ icon: /* @__PURE__ */ jsx(PackageIcon, {}),
167
+ keys: ["G", "P"]
168
+ },
169
+ {
170
+ label: "Customers",
171
+ icon: /* @__PURE__ */ jsx(UsersThreeIcon, {}),
172
+ keys: ["G", "C"]
173
+ },
174
+ {
175
+ label: "Analytics",
176
+ icon: /* @__PURE__ */ jsx(ChartLineUpIcon, {}),
177
+ keys: ["G", "A"]
178
+ },
179
+ {
180
+ label: "Settings",
181
+ icon: /* @__PURE__ */ jsx(GearSixIcon, {}),
182
+ keys: ["G", "S"]
183
+ }
184
+ ];
185
+ var ACTIONS = [
186
+ {
187
+ label: "Create product",
188
+ icon: /* @__PURE__ */ jsx(PlusSquareIcon, {})
189
+ },
190
+ {
191
+ label: "Create order",
192
+ icon: /* @__PURE__ */ jsx(FilePlusIcon, {})
193
+ },
194
+ {
195
+ label: "Add customer",
196
+ icon: /* @__PURE__ */ jsx(UserPlusIcon, {})
197
+ }
198
+ ];
199
+ function initials(name) {
200
+ return name.split(" ").map((part) => part[0]).join("").slice(0, 2);
201
+ }
202
+ function LocalGroups({ onRun }) {
203
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
204
+ /* @__PURE__ */ jsx(CommandGroup, {
205
+ heading: "Pages",
206
+ children: PAGES.map((page) => /* @__PURE__ */ jsx(CommandItem, {
207
+ value: page.label,
208
+ icon: page.icon,
209
+ shortcut: page.keys,
210
+ onSelect: () => onRun(`Go to ${page.label}`),
211
+ children: page.label
212
+ }, page.label))
213
+ }),
214
+ /* @__PURE__ */ jsx(CommandSeparator, {}),
215
+ /* @__PURE__ */ jsx(CommandGroup, {
216
+ heading: "Quick actions",
217
+ children: ACTIONS.map((action) => /* @__PURE__ */ jsx(CommandItem, {
218
+ value: action.label,
219
+ icon: action.icon,
220
+ onSelect: () => onRun(action.label),
221
+ children: action.label
222
+ }, action.label))
223
+ })
224
+ ] });
225
+ }
226
+ function ServerGroups({ results, onRun }) {
227
+ if (!results) return null;
228
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
229
+ results.orders.length > 0 ? /* @__PURE__ */ jsx(CommandGroup, {
230
+ heading: "Orders",
231
+ children: results.orders.map((order) => /* @__PURE__ */ jsxs(CommandItem, {
232
+ value: `Order #${order.number} ${order.customer}`,
233
+ keywords: [order.status, order.total],
234
+ icon: /* @__PURE__ */ jsx(ReceiptIcon, {}),
235
+ hint: `${order.status} · ${order.total}`,
236
+ onSelect: () => onRun(`Open order #${order.number}`),
237
+ children: [
238
+ "#",
239
+ order.number,
240
+ " · ",
241
+ order.customer
242
+ ]
243
+ }, order.number))
244
+ }) : null,
245
+ results.products.length > 0 ? /* @__PURE__ */ jsx(CommandGroup, {
246
+ heading: "Products",
247
+ children: results.products.map((product) => /* @__PURE__ */ jsx(CommandItem, {
248
+ value: product.name,
249
+ keywords: [product.sku],
250
+ icon: /* @__PURE__ */ jsx(PackageIcon, {}),
251
+ hint: `${product.price} · ${product.stock}`,
252
+ onSelect: () => onRun(`Open ${product.name}`),
253
+ children: product.name
254
+ }, product.sku))
255
+ }) : null,
256
+ results.customers.length > 0 ? /* @__PURE__ */ jsx(CommandGroup, {
257
+ heading: "Customers",
258
+ children: results.customers.map((customer) => /* @__PURE__ */ jsx(CommandItem, {
259
+ value: customer.name,
260
+ keywords: [customer.email, customer.city],
261
+ icon: /* @__PURE__ */ jsx("span", { children: initials(customer.name) }),
262
+ hint: `${customer.city} · ${customer.orders} orders`,
263
+ onSelect: () => onRun(`Open ${customer.name}`),
264
+ children: customer.name
265
+ }, customer.email))
266
+ }) : null
267
+ ] });
268
+ }
269
+ function Status({ last, idle }) {
270
+ return /* @__PURE__ */ jsx("p", {
271
+ className: "command-palette-status",
272
+ "aria-live": "polite",
273
+ children: last ? /* @__PURE__ */ jsxs(Fragment$1, { children: ["Last command: ", /* @__PURE__ */ jsx("strong", { children: last })] }) : idle
274
+ });
275
+ }
276
+ var tileVars = {
277
+ "--o-command-row-h": "40px",
278
+ "--o-command-item-h": "28px",
279
+ "--o-command-tile": "22px",
280
+ "--o-command-input-fs": "13px",
281
+ fontSize: "12.5px"
282
+ };
283
+ function Preview() {
284
+ return /* @__PURE__ */ jsx(PaletteStill, {
285
+ query: "whit",
286
+ footer: false,
287
+ style: {
288
+ ...tileVars,
289
+ width: 224
290
+ },
291
+ groups: [{ items: [
292
+ {
293
+ icon: /* @__PURE__ */ jsx(ReceiptIcon, {}),
294
+ label: "#1043 · Sarah Whitfield",
295
+ selected: true
296
+ },
297
+ {
298
+ icon: /* @__PURE__ */ jsx(PackageIcon, {}),
299
+ label: "White oak side table"
300
+ },
301
+ {
302
+ icon: /* @__PURE__ */ jsx("span", { children: "SW" }),
303
+ label: "Sam Whitaker"
304
+ }
305
+ ] }]
306
+ });
307
+ }
308
+ function HeaderDemo() {
309
+ const [open, setOpen] = useState(false);
310
+ const [query, setQuery] = useState("");
311
+ const [last, setLast] = useState();
312
+ const { results, loading } = useServerSearch(query, 550);
313
+ const run = (what) => {
314
+ setLast(what);
315
+ setOpen(false);
316
+ };
317
+ const hasResults = countOf(results) > 0;
318
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
319
+ /* @__PURE__ */ jsxs("div", {
320
+ className: "command-palette-strip",
321
+ children: [
322
+ /* @__PURE__ */ jsx("div", {
323
+ className: "command-palette-strip__side",
324
+ children: /* @__PURE__ */ jsxs("span", {
325
+ className: "command-palette-store",
326
+ children: [/* @__PURE__ */ jsx(Avatar, {
327
+ name: "Harbour Desk Co",
328
+ shape: "square",
329
+ size: "sm"
330
+ }), /* @__PURE__ */ jsx("span", { children: "Harbour Desk Co" })]
331
+ })
332
+ }),
333
+ /* @__PURE__ */ jsx(SearchTrigger, {
334
+ hotkey: false,
335
+ width: "min(360px, 100%)",
336
+ onOpen: () => {
337
+ setQuery("");
338
+ setOpen(true);
339
+ }
340
+ }),
341
+ /* @__PURE__ */ jsxs("div", {
342
+ className: "command-palette-strip__side",
343
+ "data-end": "",
344
+ children: [/* @__PURE__ */ jsx(IconButton, {
345
+ label: "Help",
346
+ children: /* @__PURE__ */ jsx(QuestionIcon, {})
347
+ }), /* @__PURE__ */ jsx(IconButton, {
348
+ label: "Notifications",
349
+ children: /* @__PURE__ */ jsx(BellIcon, {})
350
+ })]
351
+ })
352
+ ]
353
+ }),
354
+ /* @__PURE__ */ jsx(Status, {
355
+ last,
356
+ idle: "Open the search pill and try \"whit\", \"1042\" or \"leeds\"."
357
+ }),
358
+ /* @__PURE__ */ jsxs(CommandPalette, {
359
+ open,
360
+ onOpenChange: setOpen,
361
+ value: query,
362
+ onValueChange: setQuery,
363
+ loading,
364
+ children: [
365
+ /* @__PURE__ */ jsx(LocalGroups, { onRun: run }),
366
+ loading && !hasResults ? /* @__PURE__ */ jsx(CommandLoading, { children: "Searching orders, products and customers" }) : null,
367
+ /* @__PURE__ */ jsx(ServerGroups, {
368
+ results,
369
+ onRun: run
370
+ }),
371
+ !loading ? /* @__PURE__ */ jsxs(CommandEmpty, {
372
+ description: "Try an order number, a product name or a customer's email.",
373
+ children: [
374
+ "No results for “",
375
+ query.trim(),
376
+ "”"
377
+ ]
378
+ }) : null
379
+ ]
380
+ })
381
+ ] });
382
+ }
383
+ function PillDemo({ width = 280 }) {
384
+ const [open, setOpen] = useState(false);
385
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SearchTrigger, {
386
+ hotkey: false,
387
+ width,
388
+ placeholder: "Search Harbour Desk Co",
389
+ onOpen: () => setOpen(true)
390
+ }), /* @__PURE__ */ jsxs(CommandPalette, {
391
+ open,
392
+ onOpenChange: setOpen,
393
+ children: [/* @__PURE__ */ jsx(LocalGroups, { onRun: () => setOpen(false) }), /* @__PURE__ */ jsx(CommandEmpty, {
394
+ description: "Try a page, like orders or settings.",
395
+ children: "No pages or actions match"
396
+ })]
397
+ })] });
398
+ }
399
+ function OriginsDemo() {
400
+ const [opener, setOpener] = useState(null);
401
+ const [last, setLast] = useState();
402
+ const iconRef = useRef(null);
403
+ const origin = opener === "icon" ? iconRef : opener === "centre" ? null : void 0;
404
+ const run = (what) => {
405
+ setLast(what);
406
+ setOpener(null);
407
+ };
408
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
409
+ /* @__PURE__ */ jsx(SearchTrigger, {
410
+ hotkey: false,
411
+ width: 280,
412
+ onOpen: () => setOpener("pill")
413
+ }),
414
+ /* @__PURE__ */ jsx(IconButton, {
415
+ ref: iconRef,
416
+ label: "Search",
417
+ variant: "secondary",
418
+ onClick: () => setOpener("icon"),
419
+ children: /* @__PURE__ */ jsx(MagnifyingGlassIcon, {})
420
+ }),
421
+ /* @__PURE__ */ jsx(Button, {
422
+ onClick: () => setOpener("centre"),
423
+ children: "Open from the centre"
424
+ }),
425
+ /* @__PURE__ */ jsx(Status, {
426
+ last,
427
+ idle: "Open it three ways, then close it with Esc to watch it fold back."
428
+ }),
429
+ /* @__PURE__ */ jsxs(CommandPalette, {
430
+ open: opener !== null,
431
+ onOpenChange: (open) => !open && setOpener(null),
432
+ origin,
433
+ children: [/* @__PURE__ */ jsx(LocalGroups, { onRun: run }), /* @__PURE__ */ jsx(CommandEmpty, {
434
+ description: "Try a page, like orders or settings.",
435
+ children: "No pages or actions match"
436
+ })]
437
+ })
438
+ ] });
439
+ }
440
+ function TriggersDemo() {
441
+ const [open, setOpen] = useState(false);
442
+ const show = () => setOpen(true);
443
+ return /* @__PURE__ */ jsxs("div", {
444
+ className: "command-palette-pills",
445
+ children: [
446
+ /* @__PURE__ */ jsxs("div", {
447
+ className: "command-palette-pill-row",
448
+ children: [/* @__PURE__ */ jsx(SearchTrigger, {
449
+ hotkey: false,
450
+ onOpen: show
451
+ }), /* @__PURE__ */ jsx("span", { children: "360px, the default" })]
452
+ }),
453
+ /* @__PURE__ */ jsxs("div", {
454
+ className: "command-palette-pill-row",
455
+ children: [/* @__PURE__ */ jsx(SearchTrigger, {
456
+ hotkey: false,
457
+ width: 240,
458
+ onOpen: show
459
+ }), /* @__PURE__ */ jsx("span", { children: "240px: the keycaps go first" })]
460
+ }),
461
+ /* @__PURE__ */ jsxs("div", {
462
+ className: "command-palette-pill-row",
463
+ children: [/* @__PURE__ */ jsx(SearchTrigger, {
464
+ hotkey: false,
465
+ width: 36,
466
+ placeholder: "Search",
467
+ onOpen: show
468
+ }), /* @__PURE__ */ jsx("span", { children: "36px: then the words, leaving a round button" })]
469
+ }),
470
+ /* @__PURE__ */ jsxs("div", {
471
+ className: "command-palette-pill-row",
472
+ children: [/* @__PURE__ */ jsx(SearchTrigger, {
473
+ hotkey: false,
474
+ width: 240,
475
+ shortcut: false,
476
+ placeholder: "Search products",
477
+ onOpen: show
478
+ }), /* @__PURE__ */ jsx("span", { children: "Own words, no keycaps" })]
479
+ }),
480
+ /* @__PURE__ */ jsxs("div", {
481
+ className: "command-palette-pill-row",
482
+ children: [/* @__PURE__ */ jsx(SearchTrigger, {
483
+ hotkey: false,
484
+ width: 240,
485
+ disabled: true,
486
+ onOpen: show
487
+ }), /* @__PURE__ */ jsx("span", { children: "Disabled" })]
488
+ }),
489
+ /* @__PURE__ */ jsxs(CommandPalette, {
490
+ open,
491
+ onOpenChange: setOpen,
492
+ children: [/* @__PURE__ */ jsx(LocalGroups, { onRun: () => setOpen(false) }), /* @__PURE__ */ jsx(CommandEmpty, {
493
+ description: "Try a page, like orders or settings.",
494
+ children: "No pages or actions match"
495
+ })]
496
+ })
497
+ ]
498
+ });
499
+ }
500
+ function ItemsDemo() {
501
+ const [open, setOpen] = useState(false);
502
+ const [last, setLast] = useState();
503
+ const run = (what) => {
504
+ setLast(what);
505
+ setOpen(false);
506
+ };
507
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
508
+ /* @__PURE__ */ jsx(SearchTrigger, {
509
+ hotkey: false,
510
+ width: 300,
511
+ placeholder: "Search Harbour Desk Co",
512
+ onOpen: () => setOpen(true)
513
+ }),
514
+ /* @__PURE__ */ jsx(Status, {
515
+ last,
516
+ idle: "Try typing an SKU (CHR-ARD) or an email (whitfield)."
517
+ }),
518
+ /* @__PURE__ */ jsxs(CommandPalette, {
519
+ open,
520
+ onOpenChange: setOpen,
521
+ footer: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CommandHints, {}), /* @__PURE__ */ jsx("span", {
522
+ className: "command-palette-footer-note",
523
+ children: "Searching Harbour Desk Co"
524
+ })] }),
525
+ children: [
526
+ /* @__PURE__ */ jsxs(CommandGroup, {
527
+ heading: "Go to",
528
+ children: [/* @__PURE__ */ jsx(CommandItem, {
529
+ icon: /* @__PURE__ */ jsx(ReceiptIcon, {}),
530
+ shortcut: ["G", "O"],
531
+ onSelect: () => run("Go to orders"),
532
+ children: "Orders"
533
+ }), /* @__PURE__ */ jsx(CommandItem, {
534
+ icon: /* @__PURE__ */ jsx(ChartLineUpIcon, {}),
535
+ hint: "Not on your plan",
536
+ disabled: true,
537
+ children: "Analytics"
538
+ })]
539
+ }),
540
+ /* @__PURE__ */ jsx(CommandGroup, {
541
+ heading: "Products",
542
+ children: /* @__PURE__ */ jsx(CommandItem, {
543
+ icon: /* @__PURE__ */ jsx(PackageIcon, {}),
544
+ hint: "£229.00 · 4 in stock",
545
+ keywords: ["CHR-ARD-01"],
546
+ onSelect: () => run("Open Arden ergonomic chair"),
547
+ children: "Arden ergonomic chair"
548
+ })
549
+ }),
550
+ /* @__PURE__ */ jsx(CommandGroup, {
551
+ heading: "Customers",
552
+ children: /* @__PURE__ */ jsx(CommandItem, {
553
+ icon: /* @__PURE__ */ jsx("span", { children: "SW" }),
554
+ hint: "Leeds · 6 orders",
555
+ keywords: ["sarah.whitfield@example.co.uk"],
556
+ onSelect: () => run("Open Sarah Whitfield"),
557
+ children: "Sarah Whitfield"
558
+ })
559
+ }),
560
+ /* @__PURE__ */ jsx(CommandEmpty, { children: "No results" })
561
+ ]
562
+ })
563
+ ] });
564
+ }
565
+ function SearchStateDemo({ label, query: startQuery, delay }) {
566
+ const [open, setOpen] = useState(false);
567
+ const [query, setQuery] = useState(startQuery);
568
+ const opener = useRef(null);
569
+ const { results, loading } = useServerSearch(open ? query : "", delay);
570
+ const hasResults = countOf(results) > 0;
571
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
572
+ ref: opener,
573
+ onClick: () => {
574
+ setQuery(startQuery);
575
+ setOpen(true);
576
+ },
577
+ children: label
578
+ }), /* @__PURE__ */ jsxs(CommandPalette, {
579
+ open,
580
+ onOpenChange: setOpen,
581
+ origin: opener,
582
+ value: query,
583
+ onValueChange: setQuery,
584
+ loading,
585
+ shouldFilter: false,
586
+ children: [
587
+ loading && !hasResults ? /* @__PURE__ */ jsx(CommandLoading, { children: "Searching orders, products and customers" }) : null,
588
+ /* @__PURE__ */ jsx(ServerGroups, {
589
+ results,
590
+ onRun: () => setOpen(false)
591
+ }),
592
+ !loading && results ? /* @__PURE__ */ jsxs(CommandEmpty, {
593
+ description: "Try an order number, a product name or a customer's email.",
594
+ children: [
595
+ "No results for “",
596
+ query.trim(),
597
+ "”"
598
+ ]
599
+ }) : null
600
+ ]
601
+ })] });
602
+ }
603
+ function HeldOpen() {
604
+ return /* @__PURE__ */ jsx(SpecimenFrame, {
605
+ style: {
606
+ display: "flex",
607
+ justifyContent: "center",
608
+ width: "100%"
609
+ },
610
+ children: /* @__PURE__ */ jsx(PaletteStill, {
611
+ query: "whit",
612
+ groups: [
613
+ {
614
+ heading: "Orders",
615
+ items: [{
616
+ icon: /* @__PURE__ */ jsx(ReceiptIcon, {}),
617
+ label: "#1043 · Sarah Whitfield",
618
+ hint: "Paid · £240.00",
619
+ selected: true
620
+ }, {
621
+ icon: /* @__PURE__ */ jsx(ReceiptIcon, {}),
622
+ label: "#1031 · Sarah Whitfield",
623
+ hint: "Fulfilled · £65.00"
624
+ }]
625
+ },
626
+ {
627
+ heading: "Products",
628
+ items: [{
629
+ icon: /* @__PURE__ */ jsx(PackageIcon, {}),
630
+ label: "White oak side table",
631
+ hint: "£149.00 · 12 in stock"
632
+ }]
633
+ },
634
+ {
635
+ heading: "Customers",
636
+ items: [{
637
+ icon: /* @__PURE__ */ jsx("span", { children: "SW" }),
638
+ label: "Sarah Whitfield",
639
+ hint: "Leeds · 6 orders"
640
+ }, {
641
+ icon: /* @__PURE__ */ jsx("span", { children: "SW" }),
642
+ label: "Sam Whitaker",
643
+ hint: "York · 3 orders"
644
+ }]
645
+ }
646
+ ]
647
+ })
648
+ });
649
+ }
650
+ function Page() {
651
+ return /* @__PURE__ */ jsxs(DocPage, {
652
+ title: "Command palette",
653
+ status: "stable",
654
+ importNames: [
655
+ "CommandPalette",
656
+ "CommandGroup",
657
+ "CommandItem",
658
+ "SearchTrigger"
659
+ ],
660
+ lead: "Search and commands in one place. It grows out of the search pill in the header, finds pages, actions and records as the merchant types, and folds back into the pill when they are done.",
661
+ children: [
662
+ /* @__PURE__ */ jsxs(Section, {
663
+ id: "basics",
664
+ title: "Basics",
665
+ description: /* @__PURE__ */ jsxs("p", { children: [
666
+ "A ",
667
+ /* @__PURE__ */ jsx("code", { children: "SearchTrigger" }),
668
+ " in the header opens a ",
669
+ /* @__PURE__ */ jsx("code", { children: "CommandPalette" }),
670
+ ". Inside, a",
671
+ " ",
672
+ /* @__PURE__ */ jsx("code", { children: "CommandGroup" }),
673
+ " holds ",
674
+ /* @__PURE__ */ jsx("code", { children: "CommandItem" }),
675
+ "s under a heading. Pages and quick actions are filtered right here as you type; orders, products and customers come from a (simulated) server half a second later, while a comet runs along the field."
676
+ ] }),
677
+ children: [/* @__PURE__ */ jsx(Example, {
678
+ align: "fill",
679
+ surface: "ground",
680
+ code: `
681
+ const [open, setOpen] = useState(false)
682
+ const [query, setQuery] = useState('')
683
+ const { results, loading } = useSearch(query) // your server search
684
+
685
+ <SearchTrigger
686
+ hotkey={false} // on by default; off here because these docs use ⌘K for their own search
687
+ onOpen={() => setOpen(true)}
688
+ />
689
+
690
+ <CommandPalette open={open} onOpenChange={setOpen} value={query} onValueChange={setQuery} loading={loading}>
691
+ <CommandGroup heading="Pages">
692
+ <CommandItem value="Orders" icon={<ReceiptIcon />} shortcut={['G', 'O']} onSelect={() => go('/orders')}>
693
+ Orders
694
+ </CommandItem>
695
+ …
696
+ </CommandGroup>
697
+ <CommandSeparator />
698
+ <CommandGroup heading="Quick actions">…</CommandGroup>
699
+
700
+ {loading && !results ? <CommandLoading>Searching orders, products and customers</CommandLoading> : null}
701
+
702
+ {results?.orders.length ? (
703
+ <CommandGroup heading="Orders">
704
+ {results.orders.map((order) => (
705
+ <CommandItem
706
+ key={order.number}
707
+ value={\`Order #\${order.number} \${order.customer}\`}
708
+ keywords={[order.status, order.total]}
709
+ icon={<ReceiptIcon />}
710
+ hint={\`\${order.status} · \${order.total}\`}
711
+ onSelect={() => openOrder(order)}
712
+ >
713
+ #{order.number} · {order.customer}
714
+ </CommandItem>
715
+ ))}
716
+ </CommandGroup>
717
+ ) : null}
718
+ …
719
+
720
+ {!loading ? (
721
+ <CommandEmpty description="Try an order number, a product name or a customer's email.">
722
+ No results for “{query}”
723
+ </CommandEmpty>
724
+ ) : null}
725
+ </CommandPalette>`,
726
+ children: /* @__PURE__ */ jsx(HeaderDemo, {})
727
+ }), /* @__PURE__ */ jsxs(Note, {
728
+ title: "⌘K is on by default",
729
+ children: [
730
+ "In the product, ",
731
+ /* @__PURE__ */ jsx("code", { children: "SearchTrigger" }),
732
+ " listens for ⌘K (Ctrl K on Windows and Linux) anywhere on the page and opens the palette, and the same keys close it again. These docs already use ⌘K for their own search, so every trigger on this page passes ",
733
+ /* @__PURE__ */ jsx("code", { children: "hotkey={false}" }),
734
+ ". Leave it on in the app."
735
+ ]
736
+ })]
737
+ }),
738
+ /* @__PURE__ */ jsxs(Section, {
739
+ id: "both-themes",
740
+ title: "In both themes",
741
+ description: /* @__PURE__ */ jsx("p", { children: "Held open for review, light above dark: a search for \"whit\" with the first order selected. The panel is 640px wide with 20px corners on the modal shadow. The selected row takes a hover tint, its icon tile turns teal, and a short teal mark on the rim marks it." }),
742
+ children: [/* @__PURE__ */ jsx("div", {
743
+ className: "overlays-stack",
744
+ children: /* @__PURE__ */ jsx(ThemePair, {
745
+ align: "fill",
746
+ caption: "A still of the open palette, drawn with its own classes so both themes sit side by side. Every palette on the rest of this page is live.",
747
+ children: /* @__PURE__ */ jsx(HeldOpen, {})
748
+ })
749
+ }), /* @__PURE__ */ jsx(SubSection, {
750
+ title: "Open them for real",
751
+ description: /* @__PURE__ */ jsx("p", { children: "Each pill opens the palette in the theme of its own side, and it grows out of that pill." }),
752
+ children: /* @__PURE__ */ jsx(ThemePair, {
753
+ minHeight: 150,
754
+ children: /* @__PURE__ */ jsx(PillDemo, { width: 280 })
755
+ })
756
+ })]
757
+ }),
758
+ /* @__PURE__ */ jsx(Section, {
759
+ id: "morph",
760
+ title: "Growing out of the pill",
761
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
762
+ "Opened from a ",
763
+ /* @__PURE__ */ jsx("code", { children: "SearchTrigger" }),
764
+ ", the palette grows out of it: the pill stretches into the panel as it glides to its place near the top of the window, the pill's words carry over into the field, and the results fade up behind them. The pill leaves the header while the palette is out. On closing, the panel folds back into the pill, a little faster and without a wobble."
765
+ ] }), /* @__PURE__ */ jsxs("p", { children: [
766
+ "The words hand straight over when the palette's ",
767
+ /* @__PURE__ */ jsx("code", { children: "placeholder" }),
768
+ " matches the pill's, which it does by default. ",
769
+ /* @__PURE__ */ jsx("code", { children: "origin" }),
770
+ " grows it out of any other element, such as a round search button in a phone header, and ",
771
+ /* @__PURE__ */ jsx("code", { children: "origin={null}" }),
772
+ " always scales it up from the centre. With no visible pill, or with reduced motion, it scales up from the centre or crossfades."
773
+ ] })] }),
774
+ children: /* @__PURE__ */ jsx(Example, {
775
+ align: "start",
776
+ code: `
777
+ <SearchTrigger hotkey={false} onOpen={() => setOpen(true)} /> {/* grows out of the pill */}
778
+
779
+ <IconButton ref={searchButton} label="Search" onClick={() => setOpen(true)}>
780
+ <MagnifyingGlassIcon />
781
+ </IconButton>
782
+ <CommandPalette origin={searchButton} …>…</CommandPalette> {/* out of the round button */}
783
+
784
+ <CommandPalette origin={null} …>…</CommandPalette> {/* up from the centre */}`,
785
+ children: /* @__PURE__ */ jsx(OriginsDemo, {})
786
+ })
787
+ }),
788
+ /* @__PURE__ */ jsx(Section, {
789
+ id: "search-trigger",
790
+ title: "Search trigger",
791
+ description: /* @__PURE__ */ jsx("p", { children: "The pill in the header. It looks like a field but is a button: pressing it opens the palette. It prefers 360px and shrinks with its container, dropping the keycaps first (below 260px) and then its words (below 96px), leaving a round search button. Its words become its accessible name, so it stays named when they are hidden." }),
792
+ children: /* @__PURE__ */ jsx(Example, {
793
+ align: "start",
794
+ surface: "ground",
795
+ code: `
796
+ <SearchTrigger hotkey={false} onOpen={open} />
797
+ <SearchTrigger hotkey={false} width={240} onOpen={open} />
798
+ <SearchTrigger hotkey={false} width={36} placeholder="Search" onOpen={open} />
799
+ <SearchTrigger hotkey={false} width={240} shortcut={false} placeholder="Search products" onOpen={open} />
800
+ <SearchTrigger hotkey={false} width={240} disabled onOpen={open} />`,
801
+ children: /* @__PURE__ */ jsx(TriggersDemo, {})
802
+ })
803
+ }),
804
+ /* @__PURE__ */ jsxs(Section, {
805
+ id: "items",
806
+ title: "Items",
807
+ description: /* @__PURE__ */ jsxs("p", { children: [
808
+ "A ",
809
+ /* @__PURE__ */ jsx("code", { children: "CommandItem" }),
810
+ " is one result. ",
811
+ /* @__PURE__ */ jsx("code", { children: "icon" }),
812
+ " sits in a rounded tile that turns teal when the row is selected; pass a Phosphor icon, or initials for a person. ",
813
+ /* @__PURE__ */ jsx("code", { children: "hint" }),
814
+ " is quiet text at the end, such as a price or a status, and ",
815
+ /* @__PURE__ */ jsx("code", { children: "shortcut" }),
816
+ " shows keycaps exactly as written.",
817
+ " ",
818
+ /* @__PURE__ */ jsx("code", { children: "keywords" }),
819
+ " are matched without being shown, like an SKU or an email. ",
820
+ /* @__PURE__ */ jsx("code", { children: "value" }),
821
+ " must be unique in the palette; it defaults to the item's text."
822
+ ] }),
823
+ children: [/* @__PURE__ */ jsx(Example, {
824
+ align: "start",
825
+ code: `
826
+ <CommandGroup heading="Go to">
827
+ <CommandItem icon={<ReceiptIcon />} shortcut={['G', 'O']} onSelect={goToOrders}>Orders</CommandItem>
828
+ <CommandItem icon={<ChartLineUpIcon />} hint="Not on your plan" disabled>Analytics</CommandItem>
829
+ </CommandGroup>
830
+ <CommandGroup heading="Products">
831
+ <CommandItem icon={<PackageIcon />} hint="£229.00 · 4 in stock" keywords={['CHR-ARD-01']} onSelect={…}>
832
+ Arden ergonomic chair
833
+ </CommandItem>
834
+ </CommandGroup>
835
+ <CommandGroup heading="Customers">
836
+ <CommandItem icon={<span>SW</span>} hint="Leeds · 6 orders" keywords={['sarah.whitfield@example.co.uk']} onSelect={…}>
837
+ Sarah Whitfield
838
+ </CommandItem>
839
+ </CommandGroup>`,
840
+ children: /* @__PURE__ */ jsx(ItemsDemo, {})
841
+ }), /* @__PURE__ */ jsx(DocTable, {
842
+ columns: ["Part", "What it does"],
843
+ rows: [
844
+ [/* @__PURE__ */ jsx("code", { children: "CommandGroup" }), /* @__PURE__ */ jsx(Fragment$1, { children: "A titled run of items. Headings are sentence case. A group hides itself when none of its items match." })],
845
+ [/* @__PURE__ */ jsx("code", { children: "CommandSeparator" }), /* @__PURE__ */ jsxs(Fragment$1, { children: [
846
+ "A hairline between groups. Hidden while there is a search, unless ",
847
+ /* @__PURE__ */ jsx("code", { children: "alwaysRender" }),
848
+ "."
849
+ ] })],
850
+ [/* @__PURE__ */ jsx("code", { children: "CommandKey" }), "A keycap, as used in item shortcuts and the footer. Use it in your own footer."],
851
+ [/* @__PURE__ */ jsx("code", { children: "CommandHints" }), "The default footer: arrows to move, Enter to open, Esc to close. Hidden on touch screens."]
852
+ ]
853
+ })]
854
+ }),
855
+ /* @__PURE__ */ jsxs(Section, {
856
+ id: "loading-and-empty",
857
+ title: "Loading and empty",
858
+ description: /* @__PURE__ */ jsxs("p", { children: [
859
+ "While results are on their way, ",
860
+ /* @__PURE__ */ jsx("code", { children: "loading" }),
861
+ " sends a comet along the bottom of the field and the list is marked busy. Show a ",
862
+ /* @__PURE__ */ jsx("code", { children: "CommandLoading" }),
863
+ " row while there is nothing else to show. Once results have arrived, ",
864
+ /* @__PURE__ */ jsx("code", { children: "CommandEmpty" }),
865
+ " appears by itself when nothing matches: an empty orbit, a line saying so and a ",
866
+ /* @__PURE__ */ jsx("code", { children: "description" }),
867
+ " of what to try. Render it only when loading is done, or it flashes up before the results."
868
+ ] }),
869
+ children: [/* @__PURE__ */ jsxs(Example, {
870
+ code: `
871
+ <CommandPalette value={query} onValueChange={setQuery} loading={loading} shouldFilter={false} …>
872
+ {loading && !results ? <CommandLoading>Searching orders, products and customers</CommandLoading> : null}
873
+ {results ? <Results results={results} /> : null}
874
+ {!loading && results ? (
875
+ <CommandEmpty description="Try an order number, a product name or a customer's email.">
876
+ No results for “{query}”
877
+ </CommandEmpty>
878
+ ) : null}
879
+ </CommandPalette>`,
880
+ caption: "The first searches a slow server for 2.5 seconds; the second finds nothing.",
881
+ children: [/* @__PURE__ */ jsx(SearchStateDemo, {
882
+ label: "Search a slow server",
883
+ query: "whit",
884
+ delay: 2500
885
+ }), /* @__PURE__ */ jsx(SearchStateDemo, {
886
+ label: "Search for something missing",
887
+ query: "walnut wardrobe",
888
+ delay: 600
889
+ })]
890
+ }), /* @__PURE__ */ jsxs(Note, {
891
+ title: "Server search",
892
+ children: [
893
+ "When a server does the matching, pass ",
894
+ /* @__PURE__ */ jsx("code", { children: "shouldFilter={false}" }),
895
+ " so the palette shows what it is given instead of filtering it again, and control the query with ",
896
+ /* @__PURE__ */ jsx("code", { children: "value" }),
897
+ " and ",
898
+ /* @__PURE__ */ jsx("code", { children: "onValueChange" }),
899
+ "."
900
+ ]
901
+ })]
902
+ }),
903
+ /* @__PURE__ */ jsxs(Section, {
904
+ id: "keyboard",
905
+ title: "Keyboard",
906
+ description: /* @__PURE__ */ jsx("p", { children: "The palette is built to be driven without the mouse." }),
907
+ children: [/* @__PURE__ */ jsx(DocTable, {
908
+ columns: ["Keys", "What happens"],
909
+ rows: [
910
+ [/* @__PURE__ */ jsxs("span", {
911
+ className: "command-palette-keys",
912
+ children: [
913
+ /* @__PURE__ */ jsx(CommandKey, {
914
+ "data-glyph": "",
915
+ children: "⌘"
916
+ }),
917
+ /* @__PURE__ */ jsx(CommandKey, { children: "K" }),
918
+ " or ",
919
+ /* @__PURE__ */ jsx(CommandKey, { children: "Ctrl" }),
920
+ /* @__PURE__ */ jsx(CommandKey, { children: "K" })
921
+ ]
922
+ }), /* @__PURE__ */ jsxs(Fragment$1, { children: [
923
+ "Opens it from anywhere on the page (",
924
+ /* @__PURE__ */ jsx("code", { children: "hotkey" }),
925
+ " on the ",
926
+ /* @__PURE__ */ jsx("code", { children: "SearchTrigger" }),
927
+ ", on by default), and closes it again from inside."
928
+ ] })],
929
+ ["Typing", "Filters and ranks the items as you type, matching their text and keywords loosely."],
930
+ [/* @__PURE__ */ jsxs("span", {
931
+ className: "command-palette-keys",
932
+ children: [/* @__PURE__ */ jsx(CommandKey, {
933
+ "aria-label": "Up",
934
+ children: "↑"
935
+ }), /* @__PURE__ */ jsx(CommandKey, {
936
+ "aria-label": "Down",
937
+ children: "↓"
938
+ })]
939
+ }), "Move the selection, wrapping round at the ends (loop)."],
940
+ [/* @__PURE__ */ jsx(CommandKey, {
941
+ "aria-label": "Enter",
942
+ children: "↵"
943
+ }), "Runs the selected item's onSelect."],
944
+ [/* @__PURE__ */ jsx(CommandKey, { children: "esc" }), "Closes it. So does the Esc keycap in the field."]
945
+ ]
946
+ }), /* @__PURE__ */ jsx(Guidelines, { items: [
947
+ "When it opens, focus goes straight to the field. When it closes, focus goes back to where it was, usually the pill.",
948
+ "Put the most likely destinations first, and keep the order stable so people learn where things are.",
949
+ "Name items as destinations or actions: \"Orders\", \"Create product\". Put the detail in the hint."
950
+ ] })]
951
+ }),
952
+ /* @__PURE__ */ jsx(Section, {
953
+ id: "accessibility",
954
+ title: "Accessibility",
955
+ children: /* @__PURE__ */ jsx(Guidelines, { items: [
956
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
957
+ "The palette is a Radix dialog: focus stays inside, the page behind cannot scroll and is hidden from screen readers. It is named by ",
958
+ /* @__PURE__ */ jsx("code", { children: "label" }),
959
+ " (\"Search\" by default), and its list of results is named \"Search results\"."
960
+ ] }),
961
+ "The field is a combobox and the results are a listbox of options, so screen readers announce the selected row as the arrows move (via cmdk).",
962
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
963
+ "While ",
964
+ /* @__PURE__ */ jsx("code", { children: "loading" }),
965
+ ", the list is marked ",
966
+ /* @__PURE__ */ jsx("code", { children: "aria-busy" }),
967
+ ", and ",
968
+ /* @__PURE__ */ jsx("code", { children: "CommandLoading" }),
969
+ " is a progress bar named by its text."
970
+ ] }),
971
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
972
+ /* @__PURE__ */ jsx("code", { children: "SearchTrigger" }),
973
+ " is a real button named by its words, with ",
974
+ /* @__PURE__ */ jsx("code", { children: "aria-haspopup=\"dialog\"" }),
975
+ " and, while the hotkey is on, ",
976
+ /* @__PURE__ */ jsx("code", { children: "aria-keyshortcuts" }),
977
+ "."
978
+ ] }),
979
+ "With reduced motion there is no morph: the palette crossfades, the loading comet parks and breathes, and the selection mark jumps instead of sliding."
980
+ ] })
981
+ }),
982
+ /* @__PURE__ */ jsxs(Section, {
983
+ id: "props",
984
+ title: "Props",
985
+ description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "CommandHints" }), " takes no props. Items, groups, empty and loading also accept the matching cmdk props."] }),
986
+ children: [
987
+ /* @__PURE__ */ jsx(PropsTable, {
988
+ title: "CommandPalette",
989
+ rows: [
990
+ {
991
+ name: "open",
992
+ type: "boolean",
993
+ required: true,
994
+ description: "Controlled open state."
995
+ },
996
+ {
997
+ name: "onOpenChange",
998
+ type: "(open: boolean) => void",
999
+ required: true,
1000
+ description: "Called when it opens or closes."
1001
+ },
1002
+ {
1003
+ name: "value",
1004
+ type: "string",
1005
+ description: "The query, controlled. Use it with onValueChange to search a server."
1006
+ },
1007
+ {
1008
+ name: "onValueChange",
1009
+ type: "(query: string) => void",
1010
+ description: "Called with the query as it changes."
1011
+ },
1012
+ {
1013
+ name: "loading",
1014
+ type: "boolean",
1015
+ default: "false",
1016
+ description: "Sends the comet along the field and marks the list busy."
1017
+ },
1018
+ {
1019
+ name: "placeholder",
1020
+ type: "string",
1021
+ description: "The field's placeholder. Defaults to the words of the pill it grows out of."
1022
+ },
1023
+ {
1024
+ name: "shouldFilter",
1025
+ type: "boolean",
1026
+ default: "true",
1027
+ description: "Set to false when a server does the filtering."
1028
+ },
1029
+ {
1030
+ name: "filter",
1031
+ type: "(value, search, keywords?) => number",
1032
+ description: "Custom ranking: 0 hides an item, 1 is a perfect match."
1033
+ },
1034
+ {
1035
+ name: "loop",
1036
+ type: "boolean",
1037
+ default: "true",
1038
+ description: "The arrow keys wrap round the list."
1039
+ },
1040
+ {
1041
+ name: "footer",
1042
+ type: "ReactNode",
1043
+ description: "Footer content. Defaults to CommandHints; pass null for no footer."
1044
+ },
1045
+ {
1046
+ name: "label",
1047
+ type: "string",
1048
+ default: "'Search'",
1049
+ description: "Accessible name of the dialog and its list."
1050
+ },
1051
+ {
1052
+ name: "origin",
1053
+ type: "HTMLElement | RefObject<HTMLElement> | null",
1054
+ description: "What it grows out of. Defaults to the SearchTrigger that opened it (or any visible one); null scales it up from the centre."
1055
+ },
1056
+ {
1057
+ name: "container",
1058
+ type: "HTMLElement | null",
1059
+ default: "document.body",
1060
+ description: "Where the palette is portalled."
1061
+ }
1062
+ ]
1063
+ }),
1064
+ /* @__PURE__ */ jsx(PropsTable, {
1065
+ title: "CommandGroup",
1066
+ rows: [
1067
+ {
1068
+ name: "heading",
1069
+ type: "ReactNode",
1070
+ description: "The group title, in sentence case."
1071
+ },
1072
+ {
1073
+ name: "value",
1074
+ type: "string",
1075
+ description: "A unique value for the group. Needed when there is no heading."
1076
+ },
1077
+ {
1078
+ name: "forceMount",
1079
+ type: "boolean",
1080
+ default: "false",
1081
+ description: "Show it whatever the search."
1082
+ }
1083
+ ]
1084
+ }),
1085
+ /* @__PURE__ */ jsx(PropsTable, {
1086
+ title: "CommandItem",
1087
+ rows: [
1088
+ {
1089
+ name: "children",
1090
+ type: "ReactNode",
1091
+ required: true,
1092
+ description: "The label."
1093
+ },
1094
+ {
1095
+ name: "onSelect",
1096
+ type: "(value: string) => void",
1097
+ description: "Runs on Enter or a click."
1098
+ },
1099
+ {
1100
+ name: "value",
1101
+ type: "string",
1102
+ description: "Unique in the palette. Defaults to the text of children."
1103
+ },
1104
+ {
1105
+ name: "keywords",
1106
+ type: "string[]",
1107
+ description: "Matched while searching but not shown, e.g. an SKU or an email."
1108
+ },
1109
+ {
1110
+ name: "icon",
1111
+ type: "ReactNode",
1112
+ description: "Shown in a rounded tile at the start. An icon, or initials."
1113
+ },
1114
+ {
1115
+ name: "hint",
1116
+ type: "ReactNode",
1117
+ description: "Quiet trailing text, e.g. a price or \"12 in stock\"."
1118
+ },
1119
+ {
1120
+ name: "shortcut",
1121
+ type: "string[]",
1122
+ description: "Keycaps at the end, shown as written, e.g. ['G', 'O']."
1123
+ },
1124
+ {
1125
+ name: "disabled",
1126
+ type: "boolean",
1127
+ default: "false",
1128
+ description: "Dimmed, and cannot be selected."
1129
+ },
1130
+ {
1131
+ name: "forceMount",
1132
+ type: "boolean",
1133
+ default: "false",
1134
+ description: "Show it whatever the search."
1135
+ }
1136
+ ]
1137
+ }),
1138
+ /* @__PURE__ */ jsx(PropsTable, {
1139
+ title: "CommandEmpty",
1140
+ rows: [
1141
+ {
1142
+ name: "children",
1143
+ type: "ReactNode",
1144
+ default: "'No results'",
1145
+ description: "The line saying nothing matched."
1146
+ },
1147
+ {
1148
+ name: "description",
1149
+ type: "ReactNode",
1150
+ description: "A quieter second line: what to try instead."
1151
+ },
1152
+ {
1153
+ name: "icon",
1154
+ type: "ReactNode",
1155
+ description: "Replaces the empty-orbit glyph. Pass null for none."
1156
+ }
1157
+ ]
1158
+ }),
1159
+ /* @__PURE__ */ jsx(PropsTable, {
1160
+ title: "CommandLoading",
1161
+ rows: [
1162
+ {
1163
+ name: "children",
1164
+ type: "ReactNode",
1165
+ default: "'Searching'",
1166
+ description: "What is being loaded, beside an orbit spinner."
1167
+ },
1168
+ {
1169
+ name: "label",
1170
+ type: "string",
1171
+ description: "Accessible name of the progress bar. Defaults to the text of children."
1172
+ },
1173
+ {
1174
+ name: "progress",
1175
+ type: "number",
1176
+ description: "How far along the load is, when you know."
1177
+ }
1178
+ ]
1179
+ }),
1180
+ /* @__PURE__ */ jsx(PropsTable, {
1181
+ title: "CommandSeparator",
1182
+ rows: [{
1183
+ name: "alwaysRender",
1184
+ type: "boolean",
1185
+ default: "false",
1186
+ description: "Show it while there is a search too."
1187
+ }]
1188
+ }),
1189
+ /* @__PURE__ */ jsx(PropsTable, {
1190
+ title: "CommandKey",
1191
+ rows: [{
1192
+ name: "children",
1193
+ type: "ReactNode",
1194
+ description: "The key, e.g. \"#\" or \"↵\". Accepts every kbd attribute."
1195
+ }]
1196
+ }),
1197
+ /* @__PURE__ */ jsx(PropsTable, {
1198
+ title: "SearchTrigger",
1199
+ rows: [
1200
+ {
1201
+ name: "onOpen",
1202
+ type: "() => void",
1203
+ description: "Called on a press and on the hotkey. Open the palette here."
1204
+ },
1205
+ {
1206
+ name: "placeholder",
1207
+ type: "string",
1208
+ default: "'Search orders, products, customers'",
1209
+ description: "The words in the pill, and its accessible name. The palette takes them as its placeholder."
1210
+ },
1211
+ {
1212
+ name: "hotkey",
1213
+ type: "boolean",
1214
+ default: "true",
1215
+ description: "Listen for ⌘K (Ctrl K elsewhere) anywhere on the page."
1216
+ },
1217
+ {
1218
+ name: "shortcut",
1219
+ type: "boolean",
1220
+ default: "true",
1221
+ description: "Show the ⌘ K or Ctrl K keycaps."
1222
+ },
1223
+ {
1224
+ name: "width",
1225
+ type: "number | string",
1226
+ default: "360",
1227
+ description: "Preferred width in px or any CSS length. It shrinks with its container."
1228
+ },
1229
+ {
1230
+ name: "disabled",
1231
+ type: "boolean",
1232
+ default: "false",
1233
+ description: "Native disabled. Also accepts every other button attribute."
1234
+ }
1235
+ ]
1236
+ })
1237
+ ]
1238
+ })
1239
+ ]
1240
+ });
1241
+ }
1242
+ //#endregion
1243
+ export { Page, Preview };