@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,1618 @@
1
+ "use client";
2
+ import { t as DocLink } from "./host-B6znjEgQ.js";
3
+ import { a as DocTable, d as Section, i as DocPage, l as Note, m as ThemePair, o as Example, p as SubSection, r as DoDont, s as Guidelines, u as PropsTable } from "./docs-BNOb7AqR.js";
4
+ import { a as MenuSheet, c as SpecimenFrame, i as MenuRule, n as MenuHeading, r as MenuRow } from "./_overlays-specimens-Dpn6oiyH.js";
5
+ import { useRef, useState } from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ import { Avatar, Badge, Button, ConfirmDialog, IconButton, Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuHeader, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger } from "@orbitcommerce/constellation";
8
+ import { ArchiveIcon, ArrowCounterClockwiseIcon, ArrowSquareOutIcon, ArrowsDownUpIcon, BarcodeIcon, CaretDownIcon, CircleHalfIcon, ColumnsIcon, CopyIcon, DotsThreeIcon, DownloadSimpleIcon, EnvelopeSimpleIcon, EyeIcon, FilePdfIcon, GearSixIcon, KeyboardIcon, MonitorIcon, MoonIcon, PencilSimpleIcon, PlusIcon, PrinterIcon, QuestionIcon, ReceiptIcon, SignOutIcon, SlidersHorizontalIcon, StorefrontIcon, SunIcon, TrashIcon, TruckIcon, UserIcon, XCircleIcon } from "@orbitcommerce/constellation/icons";
9
+ //#region src/pages/components/menu.tsx
10
+ var wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
11
+ function Preview() {
12
+ return /* @__PURE__ */ jsxs(MenuSheet, {
13
+ width: 210,
14
+ children: [
15
+ /* @__PURE__ */ jsx(MenuRow, {
16
+ icon: /* @__PURE__ */ jsx(EyeIcon, {}),
17
+ children: "View order"
18
+ }),
19
+ /* @__PURE__ */ jsx(MenuRow, {
20
+ icon: /* @__PURE__ */ jsx(PrinterIcon, {}),
21
+ shortcut: ["mod", "P"],
22
+ highlighted: true,
23
+ children: "Print slip"
24
+ }),
25
+ /* @__PURE__ */ jsx(MenuRule, {}),
26
+ /* @__PURE__ */ jsx(MenuRow, {
27
+ icon: /* @__PURE__ */ jsx(XCircleIcon, {}),
28
+ tone: "critical",
29
+ children: "Cancel order"
30
+ })
31
+ ]
32
+ });
33
+ }
34
+ function OrderRowActions() {
35
+ const [cancelOpen, setCancelOpen] = useState(false);
36
+ const trigger = useRef(null);
37
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
38
+ className: "menu-order-row",
39
+ children: [
40
+ /* @__PURE__ */ jsx("span", {
41
+ className: "menu-order-row__id",
42
+ children: "#1043"
43
+ }),
44
+ /* @__PURE__ */ jsx("span", {
45
+ className: "menu-order-row__name",
46
+ children: "Sarah Whitfield"
47
+ }),
48
+ /* @__PURE__ */ jsx(Badge, {
49
+ tone: "positive",
50
+ children: "Paid"
51
+ }),
52
+ /* @__PURE__ */ jsx("span", {
53
+ className: "menu-order-row__total",
54
+ children: "£240.00"
55
+ }),
56
+ /* @__PURE__ */ jsx(OrderActionsMenu, {
57
+ triggerRef: trigger,
58
+ onCancel: () => setCancelOpen(true)
59
+ })
60
+ ]
61
+ }), /* @__PURE__ */ jsx(ConfirmDialog, {
62
+ open: cancelOpen,
63
+ onOpenChange: (open) => {
64
+ setCancelOpen(open);
65
+ if (!open) requestAnimationFrame(() => trigger.current?.focus());
66
+ },
67
+ tone: "critical",
68
+ title: "Cancel order #1043?",
69
+ description: "Sarah Whitfield gets £240.00 back on her card and an email to say so. The stock goes back on sale.",
70
+ confirmLabel: "Cancel order",
71
+ cancelLabel: "Keep order",
72
+ onConfirm: () => wait(1200)
73
+ })] });
74
+ }
75
+ function OrderActionsMenu({ onCancel, triggerRef }) {
76
+ return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
77
+ asChild: true,
78
+ children: /* @__PURE__ */ jsx(IconButton, {
79
+ ref: triggerRef,
80
+ label: "Actions for order #1043",
81
+ children: /* @__PURE__ */ jsx(DotsThreeIcon, { weight: "bold" })
82
+ })
83
+ }), /* @__PURE__ */ jsxs(MenuContent, {
84
+ align: "end",
85
+ children: [
86
+ /* @__PURE__ */ jsx(MenuItem, {
87
+ icon: /* @__PURE__ */ jsx(EyeIcon, {}),
88
+ children: "View order"
89
+ }),
90
+ /* @__PURE__ */ jsx(MenuItem, {
91
+ icon: /* @__PURE__ */ jsx(PrinterIcon, {}),
92
+ shortcut: ["mod", "P"],
93
+ children: "Print packing slip"
94
+ }),
95
+ /* @__PURE__ */ jsx(MenuItem, {
96
+ icon: /* @__PURE__ */ jsx(TruckIcon, {}),
97
+ children: "Mark as fulfilled"
98
+ }),
99
+ /* @__PURE__ */ jsx(MenuItem, {
100
+ icon: /* @__PURE__ */ jsx(FilePdfIcon, {}),
101
+ hint: "PDF",
102
+ children: "Download invoice"
103
+ }),
104
+ /* @__PURE__ */ jsx(MenuSeparator, {}),
105
+ /* @__PURE__ */ jsx(MenuItem, {
106
+ icon: /* @__PURE__ */ jsx(ArrowCounterClockwiseIcon, {}),
107
+ children: "Refund"
108
+ }),
109
+ /* @__PURE__ */ jsx(MenuItem, {
110
+ icon: /* @__PURE__ */ jsx(XCircleIcon, {}),
111
+ tone: "critical",
112
+ onSelect: onCancel,
113
+ children: "Cancel order"
114
+ })
115
+ ]
116
+ })] });
117
+ }
118
+ function ProductActions() {
119
+ return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
120
+ asChild: true,
121
+ children: /* @__PURE__ */ jsx(Button, {
122
+ iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
123
+ children: "More actions"
124
+ })
125
+ }), /* @__PURE__ */ jsxs(MenuContent, { children: [
126
+ /* @__PURE__ */ jsx(MenuItem, {
127
+ icon: /* @__PURE__ */ jsx(PencilSimpleIcon, {}),
128
+ shortcut: ["E"],
129
+ children: "Edit product"
130
+ }),
131
+ /* @__PURE__ */ jsx(MenuItem, {
132
+ icon: /* @__PURE__ */ jsx(CopyIcon, {}),
133
+ shortcut: ["mod", "D"],
134
+ children: "Duplicate"
135
+ }),
136
+ /* @__PURE__ */ jsx(MenuItem, {
137
+ icon: /* @__PURE__ */ jsx(DownloadSimpleIcon, {}),
138
+ hint: "CSV",
139
+ children: "Export"
140
+ }),
141
+ /* @__PURE__ */ jsx(MenuItem, {
142
+ icon: /* @__PURE__ */ jsx(BarcodeIcon, {}),
143
+ hint: "Add a SKU first",
144
+ disabled: true,
145
+ children: "Print barcodes"
146
+ }),
147
+ /* @__PURE__ */ jsx(MenuItem, {
148
+ asChild: true,
149
+ icon: /* @__PURE__ */ jsx(StorefrontIcon, {}),
150
+ hint: /* @__PURE__ */ jsx(ArrowSquareOutIcon, {}),
151
+ children: /* @__PURE__ */ jsx("a", {
152
+ href: "#rows",
153
+ children: "View on your store"
154
+ })
155
+ }),
156
+ /* @__PURE__ */ jsx(MenuSeparator, {}),
157
+ /* @__PURE__ */ jsx(MenuItem, {
158
+ icon: /* @__PURE__ */ jsx(ArchiveIcon, {}),
159
+ children: "Archive"
160
+ }),
161
+ /* @__PURE__ */ jsx(MenuItem, {
162
+ icon: /* @__PURE__ */ jsx(TrashIcon, {}),
163
+ tone: "critical",
164
+ children: "Delete product"
165
+ })
166
+ ] })] });
167
+ }
168
+ var COLUMNS = [
169
+ {
170
+ id: "customer",
171
+ label: "Customer"
172
+ },
173
+ {
174
+ id: "channel",
175
+ label: "Sales channel"
176
+ },
177
+ {
178
+ id: "payment",
179
+ label: "Payment"
180
+ },
181
+ {
182
+ id: "fulfilment",
183
+ label: "Fulfilment"
184
+ },
185
+ {
186
+ id: "items",
187
+ label: "Items"
188
+ },
189
+ {
190
+ id: "total",
191
+ label: "Total"
192
+ }
193
+ ];
194
+ function ColumnsMenu() {
195
+ const [shown, setShown] = useState({
196
+ customer: true,
197
+ channel: false,
198
+ payment: true,
199
+ fulfilment: true,
200
+ items: false,
201
+ total: true
202
+ });
203
+ const count = Object.values(shown).filter(Boolean).length;
204
+ return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
205
+ asChild: true,
206
+ children: /* @__PURE__ */ jsx(Button, {
207
+ icon: /* @__PURE__ */ jsx(ColumnsIcon, {}),
208
+ iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
209
+ children: "Columns"
210
+ })
211
+ }), /* @__PURE__ */ jsxs(MenuContent, { children: [/* @__PURE__ */ jsxs(MenuLabel, { children: [
212
+ "Showing ",
213
+ count,
214
+ " of ",
215
+ COLUMNS.length
216
+ ] }), COLUMNS.map((column) => /* @__PURE__ */ jsx(MenuCheckboxItem, {
217
+ checked: shown[column.id],
218
+ onCheckedChange: (checked) => setShown((s) => ({
219
+ ...s,
220
+ [column.id]: checked
221
+ })),
222
+ onSelect: (event) => event.preventDefault(),
223
+ children: column.label
224
+ }, column.id))] })] });
225
+ }
226
+ var SORTS = [
227
+ {
228
+ value: "newest",
229
+ label: "Newest first"
230
+ },
231
+ {
232
+ value: "oldest",
233
+ label: "Oldest first"
234
+ },
235
+ {
236
+ value: "total-high",
237
+ label: "Highest total"
238
+ },
239
+ {
240
+ value: "total-low",
241
+ label: "Lowest total"
242
+ },
243
+ {
244
+ value: "customer",
245
+ label: "Customer name"
246
+ }
247
+ ];
248
+ function SortMenu() {
249
+ const [sort, setSort] = useState("newest");
250
+ const label = SORTS.find((s) => s.value === sort)?.label;
251
+ return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
252
+ asChild: true,
253
+ children: /* @__PURE__ */ jsx(Button, {
254
+ icon: /* @__PURE__ */ jsx(ArrowsDownUpIcon, {}),
255
+ iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
256
+ children: label
257
+ })
258
+ }), /* @__PURE__ */ jsxs(MenuContent, { children: [/* @__PURE__ */ jsx(MenuLabel, { children: "Sort orders by" }), /* @__PURE__ */ jsx(MenuRadioGroup, {
259
+ value: sort,
260
+ onValueChange: setSort,
261
+ children: SORTS.map((s) => /* @__PURE__ */ jsx(MenuRadioItem, {
262
+ value: s.value,
263
+ children: s.label
264
+ }, s.value))
265
+ })] })] });
266
+ }
267
+ function ViewMenu() {
268
+ const [sort, setSort] = useState("newest");
269
+ const [customer, setCustomer] = useState(true);
270
+ const [channel, setChannel] = useState(false);
271
+ const [total, setTotal] = useState(true);
272
+ const keepOpen = (event) => event.preventDefault();
273
+ return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
274
+ asChild: true,
275
+ children: /* @__PURE__ */ jsx(Button, {
276
+ icon: /* @__PURE__ */ jsx(SlidersHorizontalIcon, {}),
277
+ children: "View"
278
+ })
279
+ }), /* @__PURE__ */ jsxs(MenuContent, { children: [
280
+ /* @__PURE__ */ jsxs(MenuGroup, { children: [/* @__PURE__ */ jsx(MenuLabel, { children: "Sort by" }), /* @__PURE__ */ jsxs(MenuRadioGroup, {
281
+ value: sort,
282
+ onValueChange: setSort,
283
+ children: [
284
+ /* @__PURE__ */ jsx(MenuRadioItem, {
285
+ value: "newest",
286
+ onSelect: keepOpen,
287
+ children: "Newest first"
288
+ }),
289
+ /* @__PURE__ */ jsx(MenuRadioItem, {
290
+ value: "oldest",
291
+ onSelect: keepOpen,
292
+ children: "Oldest first"
293
+ }),
294
+ /* @__PURE__ */ jsx(MenuRadioItem, {
295
+ value: "total",
296
+ onSelect: keepOpen,
297
+ children: "Highest total"
298
+ })
299
+ ]
300
+ })] }),
301
+ /* @__PURE__ */ jsx(MenuSeparator, {}),
302
+ /* @__PURE__ */ jsxs(MenuGroup, { children: [
303
+ /* @__PURE__ */ jsx(MenuLabel, { children: "Show columns" }),
304
+ /* @__PURE__ */ jsx(MenuCheckboxItem, {
305
+ checked: customer,
306
+ onCheckedChange: setCustomer,
307
+ onSelect: keepOpen,
308
+ children: "Customer"
309
+ }),
310
+ /* @__PURE__ */ jsx(MenuCheckboxItem, {
311
+ checked: channel,
312
+ onCheckedChange: setChannel,
313
+ onSelect: keepOpen,
314
+ children: "Sales channel"
315
+ }),
316
+ /* @__PURE__ */ jsx(MenuCheckboxItem, {
317
+ checked: total,
318
+ onCheckedChange: setTotal,
319
+ onSelect: keepOpen,
320
+ children: "Total"
321
+ })
322
+ ] })
323
+ ] })] });
324
+ }
325
+ var APPEARANCE = {
326
+ light: "Light",
327
+ dark: "Dark",
328
+ system: "Match device"
329
+ };
330
+ function AccountMenu() {
331
+ const [appearance, setAppearance] = useState("system");
332
+ const [logOutOpen, setLogOutOpen] = useState(false);
333
+ const trigger = useRef(null);
334
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
335
+ asChild: true,
336
+ children: /* @__PURE__ */ jsx(IconButton, {
337
+ ref: trigger,
338
+ label: "Account",
339
+ children: /* @__PURE__ */ jsx(Avatar, { name: "Priya Shah" })
340
+ })
341
+ }), /* @__PURE__ */ jsxs(MenuContent, {
342
+ align: "end",
343
+ width: 264,
344
+ children: [
345
+ /* @__PURE__ */ jsxs(MenuHeader, { children: [/* @__PURE__ */ jsx(Avatar, {
346
+ name: "Priya Shah",
347
+ size: "lg"
348
+ }), /* @__PURE__ */ jsxs("span", {
349
+ className: "menu-person",
350
+ children: [/* @__PURE__ */ jsx("span", {
351
+ className: "menu-person__name",
352
+ children: "Priya Shah"
353
+ }), /* @__PURE__ */ jsx("span", {
354
+ className: "menu-person__meta",
355
+ children: "priya@harbourdesk.co.uk"
356
+ })]
357
+ })] }),
358
+ /* @__PURE__ */ jsx(MenuSeparator, {}),
359
+ /* @__PURE__ */ jsx(MenuItem, {
360
+ icon: /* @__PURE__ */ jsx(UserIcon, {}),
361
+ children: "Your profile"
362
+ }),
363
+ /* @__PURE__ */ jsx(MenuItem, {
364
+ icon: /* @__PURE__ */ jsx(GearSixIcon, {}),
365
+ shortcut: ["mod", ","],
366
+ children: "Settings"
367
+ }),
368
+ /* @__PURE__ */ jsxs(MenuSub, { children: [/* @__PURE__ */ jsx(MenuSubTrigger, {
369
+ icon: /* @__PURE__ */ jsx(CircleHalfIcon, {}),
370
+ hint: APPEARANCE[appearance],
371
+ children: "Appearance"
372
+ }), /* @__PURE__ */ jsx(MenuSubContent, { children: /* @__PURE__ */ jsxs(MenuRadioGroup, {
373
+ value: appearance,
374
+ onValueChange: (v) => setAppearance(v),
375
+ children: [
376
+ /* @__PURE__ */ jsx(MenuRadioItem, {
377
+ value: "light",
378
+ icon: /* @__PURE__ */ jsx(SunIcon, {}),
379
+ children: "Light"
380
+ }),
381
+ /* @__PURE__ */ jsx(MenuRadioItem, {
382
+ value: "dark",
383
+ icon: /* @__PURE__ */ jsx(MoonIcon, {}),
384
+ children: "Dark"
385
+ }),
386
+ /* @__PURE__ */ jsx(MenuRadioItem, {
387
+ value: "system",
388
+ icon: /* @__PURE__ */ jsx(MonitorIcon, {}),
389
+ children: "Match device"
390
+ })
391
+ ]
392
+ }) })] }),
393
+ /* @__PURE__ */ jsx(MenuItem, {
394
+ icon: /* @__PURE__ */ jsx(KeyboardIcon, {}),
395
+ shortcut: ["?"],
396
+ children: "Keyboard shortcuts"
397
+ }),
398
+ /* @__PURE__ */ jsx(MenuItem, {
399
+ asChild: true,
400
+ icon: /* @__PURE__ */ jsx(QuestionIcon, {}),
401
+ hint: /* @__PURE__ */ jsx(ArrowSquareOutIcon, {}),
402
+ children: /* @__PURE__ */ jsx("a", {
403
+ href: "#submenus",
404
+ children: "Help centre"
405
+ })
406
+ }),
407
+ /* @__PURE__ */ jsx(MenuSeparator, {}),
408
+ /* @__PURE__ */ jsx(MenuItem, {
409
+ icon: /* @__PURE__ */ jsx(SignOutIcon, {}),
410
+ tone: "critical",
411
+ onSelect: () => setLogOutOpen(true),
412
+ children: "Log out"
413
+ })
414
+ ]
415
+ })] }), /* @__PURE__ */ jsx(ConfirmDialog, {
416
+ open: logOutOpen,
417
+ onOpenChange: (open) => {
418
+ setLogOutOpen(open);
419
+ if (!open) requestAnimationFrame(() => trigger.current?.focus());
420
+ },
421
+ tone: "critical",
422
+ title: "Log out of Orbit?",
423
+ description: "You will be signed out of Harbour Desk Co on this device.",
424
+ confirmLabel: "Log out",
425
+ onConfirm: () => wait(900)
426
+ })] });
427
+ }
428
+ function CustomerMenu() {
429
+ return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
430
+ asChild: true,
431
+ children: /* @__PURE__ */ jsx(IconButton, {
432
+ label: "Actions for Eleanor Price",
433
+ variant: "secondary",
434
+ children: /* @__PURE__ */ jsx(DotsThreeIcon, { weight: "bold" })
435
+ })
436
+ }), /* @__PURE__ */ jsxs(MenuContent, {
437
+ align: "end",
438
+ width: 264,
439
+ children: [
440
+ /* @__PURE__ */ jsxs(MenuHeader, { children: [/* @__PURE__ */ jsx(Avatar, { name: "Eleanor Price" }), /* @__PURE__ */ jsxs("span", {
441
+ className: "menu-person",
442
+ children: [/* @__PURE__ */ jsx("span", {
443
+ className: "menu-person__name",
444
+ children: "Eleanor Price"
445
+ }), /* @__PURE__ */ jsx("span", {
446
+ className: "menu-person__meta",
447
+ children: "4 orders · Edinburgh"
448
+ })]
449
+ })] }),
450
+ /* @__PURE__ */ jsx(MenuSeparator, {}),
451
+ /* @__PURE__ */ jsx(MenuItem, {
452
+ icon: /* @__PURE__ */ jsx(EnvelopeSimpleIcon, {}),
453
+ children: "Email customer"
454
+ }),
455
+ /* @__PURE__ */ jsx(MenuItem, {
456
+ icon: /* @__PURE__ */ jsx(ReceiptIcon, {}),
457
+ hint: "4",
458
+ children: "View orders"
459
+ }),
460
+ /* @__PURE__ */ jsx(MenuItem, {
461
+ icon: /* @__PURE__ */ jsx(PlusIcon, {}),
462
+ children: "Create order"
463
+ }),
464
+ /* @__PURE__ */ jsx(MenuSeparator, {}),
465
+ /* @__PURE__ */ jsx(MenuItem, {
466
+ icon: /* @__PURE__ */ jsx(TrashIcon, {}),
467
+ tone: "critical",
468
+ children: "Erase personal data"
469
+ })
470
+ ]
471
+ })] });
472
+ }
473
+ function ShortRows() {
474
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
475
+ /* @__PURE__ */ jsx(MenuItem, {
476
+ icon: /* @__PURE__ */ jsx(PencilSimpleIcon, {}),
477
+ children: "Rename"
478
+ }),
479
+ /* @__PURE__ */ jsx(MenuItem, {
480
+ icon: /* @__PURE__ */ jsx(CopyIcon, {}),
481
+ children: "Duplicate"
482
+ }),
483
+ /* @__PURE__ */ jsx(MenuItem, {
484
+ icon: /* @__PURE__ */ jsx(TrashIcon, {}),
485
+ tone: "critical",
486
+ children: "Delete"
487
+ })
488
+ ] });
489
+ }
490
+ var RANGES = [
491
+ "Today",
492
+ "Yesterday",
493
+ "Last 7 days",
494
+ "Last 30 days",
495
+ "Last 12 months"
496
+ ];
497
+ function RangeMenu() {
498
+ const [range, setRange] = useState("Last 30 days");
499
+ return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
500
+ asChild: true,
501
+ children: /* @__PURE__ */ jsx(Button, {
502
+ className: "menu-range-trigger",
503
+ iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
504
+ children: range
505
+ })
506
+ }), /* @__PURE__ */ jsx(MenuContent, {
507
+ width: "trigger",
508
+ children: /* @__PURE__ */ jsx(MenuRadioGroup, {
509
+ value: range,
510
+ onValueChange: setRange,
511
+ children: RANGES.map((r) => /* @__PURE__ */ jsx(MenuRadioItem, {
512
+ value: r,
513
+ children: r
514
+ }, r))
515
+ })
516
+ })] });
517
+ }
518
+ function PlacementMenu({ label, align, side }) {
519
+ return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
520
+ asChild: true,
521
+ children: /* @__PURE__ */ jsx(Button, {
522
+ iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
523
+ children: label
524
+ })
525
+ }), /* @__PURE__ */ jsx(MenuContent, {
526
+ align,
527
+ side,
528
+ children: /* @__PURE__ */ jsx(ShortRows, {})
529
+ })] });
530
+ }
531
+ function HeldOpen() {
532
+ return /* @__PURE__ */ jsxs(SpecimenFrame, {
533
+ className: "menu-stills",
534
+ children: [/* @__PURE__ */ jsxs("div", {
535
+ className: "menu-still",
536
+ children: [/* @__PURE__ */ jsx(Button, {
537
+ icon: /* @__PURE__ */ jsx(SlidersHorizontalIcon, {}),
538
+ "aria-haspopup": "menu",
539
+ "data-state": "open",
540
+ children: "View"
541
+ }), /* @__PURE__ */ jsxs(MenuSheet, { children: [
542
+ /* @__PURE__ */ jsx(MenuHeading, { children: "Sort by" }),
543
+ /* @__PURE__ */ jsx(MenuRow, {
544
+ kind: "radio",
545
+ checked: true,
546
+ children: "Newest first"
547
+ }),
548
+ /* @__PURE__ */ jsx(MenuRow, {
549
+ kind: "radio",
550
+ children: "Oldest first"
551
+ }),
552
+ /* @__PURE__ */ jsx(MenuRow, {
553
+ kind: "radio",
554
+ children: "Highest total"
555
+ }),
556
+ /* @__PURE__ */ jsx(MenuRule, {}),
557
+ /* @__PURE__ */ jsx(MenuHeading, { children: "Show columns" }),
558
+ /* @__PURE__ */ jsx(MenuRow, {
559
+ kind: "checkbox",
560
+ checked: true,
561
+ highlighted: true,
562
+ children: "Customer"
563
+ }),
564
+ /* @__PURE__ */ jsx(MenuRow, {
565
+ kind: "checkbox",
566
+ children: "Sales channel"
567
+ }),
568
+ /* @__PURE__ */ jsx(MenuRow, {
569
+ kind: "checkbox",
570
+ checked: true,
571
+ children: "Total"
572
+ })
573
+ ] })]
574
+ }), /* @__PURE__ */ jsxs("div", {
575
+ className: "menu-still",
576
+ "data-align": "end",
577
+ children: [/* @__PURE__ */ jsx(IconButton, {
578
+ label: "Account",
579
+ "aria-haspopup": "menu",
580
+ "data-state": "open",
581
+ children: /* @__PURE__ */ jsx(Avatar, { name: "Priya Shah" })
582
+ }), /* @__PURE__ */ jsxs("div", {
583
+ className: "menu-still__with-sub",
584
+ children: [/* @__PURE__ */ jsxs(MenuSheet, {
585
+ sub: true,
586
+ children: [
587
+ /* @__PURE__ */ jsx(MenuRow, {
588
+ icon: /* @__PURE__ */ jsx(SunIcon, {}),
589
+ kind: "radio",
590
+ children: "Light"
591
+ }),
592
+ /* @__PURE__ */ jsx(MenuRow, {
593
+ icon: /* @__PURE__ */ jsx(MoonIcon, {}),
594
+ kind: "radio",
595
+ children: "Dark"
596
+ }),
597
+ /* @__PURE__ */ jsx(MenuRow, {
598
+ icon: /* @__PURE__ */ jsx(MonitorIcon, {}),
599
+ kind: "radio",
600
+ checked: true,
601
+ highlighted: true,
602
+ children: "Match device"
603
+ })
604
+ ]
605
+ }), /* @__PURE__ */ jsxs(MenuSheet, {
606
+ width: 264,
607
+ children: [
608
+ /* @__PURE__ */ jsxs("div", {
609
+ className: "o-menu__header",
610
+ children: [/* @__PURE__ */ jsx(Avatar, {
611
+ name: "Priya Shah",
612
+ size: "lg"
613
+ }), /* @__PURE__ */ jsxs("span", {
614
+ className: "menu-person",
615
+ children: [/* @__PURE__ */ jsx("span", {
616
+ className: "menu-person__name",
617
+ children: "Priya Shah"
618
+ }), /* @__PURE__ */ jsx("span", {
619
+ className: "menu-person__meta",
620
+ children: "priya@harbourdesk.co.uk"
621
+ })]
622
+ })]
623
+ }),
624
+ /* @__PURE__ */ jsx(MenuRule, {}),
625
+ /* @__PURE__ */ jsx(MenuRow, {
626
+ icon: /* @__PURE__ */ jsx(UserIcon, {}),
627
+ children: "Your profile"
628
+ }),
629
+ /* @__PURE__ */ jsx(MenuRow, {
630
+ icon: /* @__PURE__ */ jsx(GearSixIcon, {}),
631
+ shortcut: ["mod", ","],
632
+ children: "Settings"
633
+ }),
634
+ /* @__PURE__ */ jsx(MenuRow, {
635
+ icon: /* @__PURE__ */ jsx(CircleHalfIcon, {}),
636
+ hint: "Match device",
637
+ submenu: true,
638
+ open: true,
639
+ children: "Appearance"
640
+ }),
641
+ /* @__PURE__ */ jsx(MenuRow, {
642
+ icon: /* @__PURE__ */ jsx(KeyboardIcon, {}),
643
+ shortcut: ["?"],
644
+ children: "Keyboard shortcuts"
645
+ }),
646
+ /* @__PURE__ */ jsx(MenuRow, {
647
+ icon: /* @__PURE__ */ jsx(QuestionIcon, {}),
648
+ hint: /* @__PURE__ */ jsx(ArrowSquareOutIcon, {}),
649
+ children: "Help centre"
650
+ }),
651
+ /* @__PURE__ */ jsx(MenuRule, {}),
652
+ /* @__PURE__ */ jsx(MenuRow, {
653
+ icon: /* @__PURE__ */ jsx(SignOutIcon, {}),
654
+ tone: "critical",
655
+ children: "Log out"
656
+ })
657
+ ]
658
+ })]
659
+ })]
660
+ })]
661
+ });
662
+ }
663
+ function DoDontStill({ children }) {
664
+ return /* @__PURE__ */ jsx(SpecimenFrame, {
665
+ className: "menu-dodont-still",
666
+ children
667
+ });
668
+ }
669
+ function Page() {
670
+ return /* @__PURE__ */ jsxs(DocPage, {
671
+ title: "Menu",
672
+ status: "stable",
673
+ importNames: [
674
+ "Menu",
675
+ "MenuTrigger",
676
+ "MenuContent",
677
+ "MenuItem"
678
+ ],
679
+ lead: "A short list of actions or choices that opens from a button. Reach for it when a row, a record or the page has more actions than fit on screen, or for a quick choice such as how a list is sorted.",
680
+ children: [
681
+ /* @__PURE__ */ jsx(Section, {
682
+ id: "basics",
683
+ title: "Basics",
684
+ description: /* @__PURE__ */ jsxs("p", { children: [
685
+ "A menu is a trigger and a sheet of rows. Wrap a ",
686
+ /* @__PURE__ */ jsx("code", { children: "Button" }),
687
+ " or ",
688
+ /* @__PURE__ */ jsx("code", { children: "IconButton" }),
689
+ " in",
690
+ " ",
691
+ /* @__PURE__ */ jsx("code", { children: "MenuTrigger asChild" }),
692
+ ", and give each row an ",
693
+ /* @__PURE__ */ jsx("code", { children: "onSelect" }),
694
+ ": it runs the action and closes the menu. The sheet grows out of its trigger on a spring and its rows settle in just behind it. Here, the actions for one order, from the button at the end of its row."
695
+ ] }),
696
+ children: /* @__PURE__ */ jsx(Example, {
697
+ align: "fill",
698
+ minHeight: 300,
699
+ code: `
700
+ const [cancelOpen, setCancelOpen] = useState(false)
701
+ const trigger = useRef<HTMLButtonElement>(null)
702
+
703
+ <Menu>
704
+ <MenuTrigger asChild>
705
+ <IconButton ref={trigger} label="Actions for order #1043">
706
+ <DotsThreeIcon weight="bold" />
707
+ </IconButton>
708
+ </MenuTrigger>
709
+ <MenuContent align="end">
710
+ <MenuItem icon={<EyeIcon />}>View order</MenuItem>
711
+ <MenuItem icon={<PrinterIcon />} shortcut={['mod', 'P']}>Print packing slip</MenuItem>
712
+ <MenuItem icon={<TruckIcon />}>Mark as fulfilled</MenuItem>
713
+ <MenuItem icon={<FilePdfIcon />} hint="PDF">Download invoice</MenuItem>
714
+ <MenuSeparator />
715
+ <MenuItem icon={<ArrowCounterClockwiseIcon />}>Refund</MenuItem>
716
+ <MenuItem icon={<XCircleIcon />} tone="critical" onSelect={() => setCancelOpen(true)}>
717
+ Cancel order
718
+ </MenuItem>
719
+ </MenuContent>
720
+ </Menu>
721
+
722
+ <ConfirmDialog
723
+ open={cancelOpen}
724
+ onOpenChange={(open) => {
725
+ setCancelOpen(open)
726
+ // ConfirmDialog has no trigger of its own: hand focus back to the menu's trigger.
727
+ if (!open) requestAnimationFrame(() => trigger.current?.focus())
728
+ }}
729
+ tone="critical"
730
+ title="Cancel order #1043?"
731
+ description="Sarah Whitfield gets £240.00 back on her card and an email to say so. The stock goes back on sale."
732
+ confirmLabel="Cancel order"
733
+ cancelLabel="Keep order"
734
+ onConfirm={cancelOrder}
735
+ />`,
736
+ children: /* @__PURE__ */ jsx(OrderRowActions, {})
737
+ })
738
+ }),
739
+ /* @__PURE__ */ jsxs(Section, {
740
+ id: "both-themes",
741
+ title: "In both themes",
742
+ description: /* @__PURE__ */ jsx("p", { children: "Held open for review: the account menu with its Appearance submenu out, and a view menu with radio and checkbox rows, light above dark. The sheet is the canvas colour in light and lifts to graphite in dark, with a faint ring so its edge holds on a dark page." }),
743
+ children: [/* @__PURE__ */ jsx("div", {
744
+ className: "overlays-stack",
745
+ children: /* @__PURE__ */ jsx(ThemePair, {
746
+ align: "fill",
747
+ caption: "A still of the open sheets, drawn with the menu's own classes so both themes sit side by side. The menus below and on the rest of this page are live.",
748
+ children: /* @__PURE__ */ jsx(HeldOpen, {})
749
+ })
750
+ }), /* @__PURE__ */ jsx(SubSection, {
751
+ title: "Open them for real",
752
+ description: /* @__PURE__ */ jsx("p", { children: "Each trigger opens its menu in the theme of its own side." }),
753
+ children: /* @__PURE__ */ jsxs(ThemePair, {
754
+ minHeight: 180,
755
+ children: [
756
+ /* @__PURE__ */ jsx(OrderActionsMenu, {}),
757
+ /* @__PURE__ */ jsx(SortMenu, {}),
758
+ /* @__PURE__ */ jsx(AccountMenu, {})
759
+ ]
760
+ })
761
+ })]
762
+ }),
763
+ /* @__PURE__ */ jsxs(Section, {
764
+ id: "rows",
765
+ title: "Rows",
766
+ description: /* @__PURE__ */ jsxs("p", { children: [
767
+ "Every action is a ",
768
+ /* @__PURE__ */ jsx("code", { children: "MenuItem" }),
769
+ ". Its ",
770
+ /* @__PURE__ */ jsx("code", { children: "icon" }),
771
+ " is 16px and stays muted until the row is highlighted. ",
772
+ /* @__PURE__ */ jsx("code", { children: "hint" }),
773
+ " is a quiet detail at the end, such as a file format or why a row is off.",
774
+ " ",
775
+ /* @__PURE__ */ jsx("code", { children: "shortcut" }),
776
+ " draws keycaps that read right on every platform (",
777
+ /* @__PURE__ */ jsx("code", { children: "mod" }),
778
+ " is ⌘ on a Mac and Ctrl elsewhere); it only draws them, so bind the keys in the app."
779
+ ] }),
780
+ children: [/* @__PURE__ */ jsx(Example, {
781
+ align: "fill",
782
+ minHeight: 380,
783
+ code: `
784
+ <Menu>
785
+ <MenuTrigger asChild>
786
+ <Button iconEnd={<CaretDownIcon />}>More actions</Button>
787
+ </MenuTrigger>
788
+ <MenuContent>
789
+ <MenuItem icon={<PencilSimpleIcon />} shortcut={['E']}>Edit product</MenuItem>
790
+ <MenuItem icon={<CopyIcon />} shortcut={['mod', 'D']}>Duplicate</MenuItem>
791
+ <MenuItem icon={<DownloadSimpleIcon />} hint="CSV">Export</MenuItem>
792
+ <MenuItem icon={<BarcodeIcon />} hint="Add a SKU first" disabled>Print barcodes</MenuItem>
793
+ <MenuItem asChild icon={<StorefrontIcon />} hint={<ArrowSquareOutIcon />}>
794
+ <a href={storeUrl} target="_blank" rel="noreferrer">View on your store</a>
795
+ </MenuItem>
796
+ <MenuSeparator />
797
+ <MenuItem icon={<ArchiveIcon />}>Archive</MenuItem>
798
+ <MenuItem icon={<TrashIcon />} tone="critical">Delete product</MenuItem>
799
+ </MenuContent>
800
+ </Menu>`,
801
+ children: /* @__PURE__ */ jsx("div", {
802
+ className: "overlays-top",
803
+ children: /* @__PURE__ */ jsx(ProductActions, {})
804
+ })
805
+ }), /* @__PURE__ */ jsx(DocTable, {
806
+ columns: ["Row", "How"],
807
+ rows: [
808
+ ["Critical", /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("code", { children: "tone=\"critical\"" }), " turns the row red and its highlight into a red wash. For actions that destroy something or sign out; keep them last, after a separator."] })],
809
+ ["Disabled", /* @__PURE__ */ jsxs(Fragment$1, { children: [
810
+ /* @__PURE__ */ jsx("code", { children: "disabled" }),
811
+ " dims the row to 45% and the arrow keys skip it. Say why in the ",
812
+ /* @__PURE__ */ jsx("code", { children: "hint" }),
813
+ "."
814
+ ] })],
815
+ ["Link", /* @__PURE__ */ jsxs(Fragment$1, { children: [
816
+ /* @__PURE__ */ jsx("code", { children: "asChild" }),
817
+ " renders your link as the row (a router ",
818
+ /* @__PURE__ */ jsx("code", { children: "Link" }),
819
+ " or an ",
820
+ /* @__PURE__ */ jsx("code", { children: "a" }),
821
+ "), so it keeps link behaviour such as opening in a new tab. A trailing arrow-out hint means it leaves Orbit."
822
+ ] })],
823
+ ["Keep open", /* @__PURE__ */ jsxs(Fragment$1, { children: [
824
+ "Call ",
825
+ /* @__PURE__ */ jsx("code", { children: "event.preventDefault()" }),
826
+ " in ",
827
+ /* @__PURE__ */ jsx("code", { children: "onSelect" }),
828
+ " and the menu stays open after the row runs."
829
+ ] })]
830
+ ]
831
+ })]
832
+ }),
833
+ /* @__PURE__ */ jsx(Section, {
834
+ id: "checkbox-items",
835
+ title: "Checkbox items",
836
+ description: /* @__PURE__ */ jsxs("p", { children: [
837
+ /* @__PURE__ */ jsx("code", { children: "MenuCheckboxItem" }),
838
+ " is a setting that toggles. The teal check draws itself in along its own path. Choosing a row closes the menu, so when people usually change several at once, keep it open with",
839
+ " ",
840
+ /* @__PURE__ */ jsxs("code", { children: ["onSelect=", "{(event) => event.preventDefault()}"] }),
841
+ "."
842
+ ] }),
843
+ children: /* @__PURE__ */ jsx(Example, {
844
+ align: "fill",
845
+ minHeight: 360,
846
+ code: `
847
+ const [shown, setShown] = useState({ customer: true, channel: false, payment: true, ... })
848
+
849
+ <Menu>
850
+ <MenuTrigger asChild>
851
+ <Button icon={<ColumnsIcon />} iconEnd={<CaretDownIcon />}>Columns</Button>
852
+ </MenuTrigger>
853
+ <MenuContent>
854
+ <MenuLabel>Showing {count} of 6</MenuLabel>
855
+ {COLUMNS.map((column) => (
856
+ <MenuCheckboxItem
857
+ key={column.id}
858
+ checked={shown[column.id]}
859
+ onCheckedChange={(checked) => setShown((s) => ({ ...s, [column.id]: checked }))}
860
+ onSelect={(event) => event.preventDefault()}
861
+ >
862
+ {column.label}
863
+ </MenuCheckboxItem>
864
+ ))}
865
+ </MenuContent>
866
+ </Menu>`,
867
+ children: /* @__PURE__ */ jsx("div", {
868
+ className: "overlays-top",
869
+ children: /* @__PURE__ */ jsx(ColumnsMenu, {})
870
+ })
871
+ })
872
+ }),
873
+ /* @__PURE__ */ jsx(Section, {
874
+ id: "radio-groups",
875
+ title: "Radio groups",
876
+ description: /* @__PURE__ */ jsxs("p", { children: [
877
+ "One choice from a few. ",
878
+ /* @__PURE__ */ jsx("code", { children: "MenuRadioGroup" }),
879
+ " holds the value; each ",
880
+ /* @__PURE__ */ jsx("code", { children: "MenuRadioItem" }),
881
+ " is one option, and the chosen row carries a teal satellite that drops into its ring. Show the current choice on the trigger, so nobody has to open the menu to find out."
882
+ ] }),
883
+ children: /* @__PURE__ */ jsx(Example, {
884
+ align: "fill",
885
+ minHeight: 330,
886
+ code: `
887
+ const [sort, setSort] = useState('newest')
888
+
889
+ <Menu>
890
+ <MenuTrigger asChild>
891
+ <Button icon={<ArrowsDownUpIcon />} iconEnd={<CaretDownIcon />}>{label}</Button>
892
+ </MenuTrigger>
893
+ <MenuContent>
894
+ <MenuLabel>Sort orders by</MenuLabel>
895
+ <MenuRadioGroup value={sort} onValueChange={setSort}>
896
+ <MenuRadioItem value="newest">Newest first</MenuRadioItem>
897
+ <MenuRadioItem value="oldest">Oldest first</MenuRadioItem>
898
+ <MenuRadioItem value="total-high">Highest total</MenuRadioItem>
899
+ <MenuRadioItem value="total-low">Lowest total</MenuRadioItem>
900
+ <MenuRadioItem value="customer">Customer name</MenuRadioItem>
901
+ </MenuRadioGroup>
902
+ </MenuContent>
903
+ </Menu>`,
904
+ children: /* @__PURE__ */ jsx("div", {
905
+ className: "overlays-top",
906
+ children: /* @__PURE__ */ jsx(SortMenu, {})
907
+ })
908
+ })
909
+ }),
910
+ /* @__PURE__ */ jsx(Section, {
911
+ id: "structure",
912
+ title: "Labels, groups and separators",
913
+ description: /* @__PURE__ */ jsxs("p", { children: [
914
+ /* @__PURE__ */ jsx("code", { children: "MenuLabel" }),
915
+ " is a quiet heading for the rows under it, in sentence case.",
916
+ " ",
917
+ /* @__PURE__ */ jsx("code", { children: "MenuSeparator" }),
918
+ " is a hairline between groups. ",
919
+ /* @__PURE__ */ jsx("code", { children: "MenuGroup" }),
920
+ " ties rows together for assistive tech and has no look of its own. A view menu for the orders list mixes a radio group and checkboxes, and stays open while you change it."
921
+ ] }),
922
+ children: /* @__PURE__ */ jsx(Example, {
923
+ align: "fill",
924
+ minHeight: 400,
925
+ code: `
926
+ const keepOpen = (event: Event) => event.preventDefault()
927
+
928
+ <Menu>
929
+ <MenuTrigger asChild>
930
+ <Button icon={<SlidersHorizontalIcon />}>View</Button>
931
+ </MenuTrigger>
932
+ <MenuContent>
933
+ <MenuGroup>
934
+ <MenuLabel>Sort by</MenuLabel>
935
+ <MenuRadioGroup value={sort} onValueChange={setSort}>
936
+ <MenuRadioItem value="newest" onSelect={keepOpen}>Newest first</MenuRadioItem>
937
+ <MenuRadioItem value="oldest" onSelect={keepOpen}>Oldest first</MenuRadioItem>
938
+ <MenuRadioItem value="total" onSelect={keepOpen}>Highest total</MenuRadioItem>
939
+ </MenuRadioGroup>
940
+ </MenuGroup>
941
+ <MenuSeparator />
942
+ <MenuGroup>
943
+ <MenuLabel>Show columns</MenuLabel>
944
+ <MenuCheckboxItem checked={customer} onCheckedChange={setCustomer} onSelect={keepOpen}>
945
+ Customer
946
+ </MenuCheckboxItem>
947
+ <MenuCheckboxItem checked={channel} onCheckedChange={setChannel} onSelect={keepOpen}>
948
+ Sales channel
949
+ </MenuCheckboxItem>
950
+ <MenuCheckboxItem checked={total} onCheckedChange={setTotal} onSelect={keepOpen}>
951
+ Total
952
+ </MenuCheckboxItem>
953
+ </MenuGroup>
954
+ </MenuContent>
955
+ </Menu>`,
956
+ children: /* @__PURE__ */ jsx("div", {
957
+ className: "overlays-top",
958
+ children: /* @__PURE__ */ jsx(ViewMenu, {})
959
+ })
960
+ })
961
+ }),
962
+ /* @__PURE__ */ jsx(Section, {
963
+ id: "submenus",
964
+ title: "Submenus",
965
+ description: /* @__PURE__ */ jsxs("p", { children: [
966
+ "A ",
967
+ /* @__PURE__ */ jsx("code", { children: "MenuSub" }),
968
+ " holds a ",
969
+ /* @__PURE__ */ jsx("code", { children: "MenuSubTrigger" }),
970
+ " and a ",
971
+ /* @__PURE__ */ jsx("code", { children: "MenuSubContent" }),
972
+ ". The submenu opens on hover, on click, or with the arrow key towards it. It sits 4px clear of the sheet with its first row level with the trigger, and slides 4px out from the side it opens on. Put the current choice in the trigger's ",
973
+ /* @__PURE__ */ jsx("code", { children: "hint" }),
974
+ ". Here, the account menu from the header."
975
+ ] }),
976
+ children: /* @__PURE__ */ jsx(Example, {
977
+ align: "fill",
978
+ minHeight: 420,
979
+ code: `
980
+ const [appearance, setAppearance] = useState('system')
981
+
982
+ <Menu>
983
+ <MenuTrigger asChild>
984
+ <IconButton label="Account">
985
+ <Avatar name="Priya Shah" />
986
+ </IconButton>
987
+ </MenuTrigger>
988
+ <MenuContent align="end" width={264}>
989
+ <MenuHeader>
990
+ <Avatar name="Priya Shah" size="lg" />
991
+ <span>Priya Shah<br />priya@harbourdesk.co.uk</span>
992
+ </MenuHeader>
993
+ <MenuSeparator />
994
+ <MenuItem icon={<UserIcon />}>Your profile</MenuItem>
995
+ <MenuItem icon={<GearSixIcon />} shortcut={['mod', ',']}>Settings</MenuItem>
996
+ <MenuSub>
997
+ <MenuSubTrigger icon={<CircleHalfIcon />} hint={APPEARANCE[appearance]}>
998
+ Appearance
999
+ </MenuSubTrigger>
1000
+ <MenuSubContent>
1001
+ <MenuRadioGroup value={appearance} onValueChange={setAppearance}>
1002
+ <MenuRadioItem value="light" icon={<SunIcon />}>Light</MenuRadioItem>
1003
+ <MenuRadioItem value="dark" icon={<MoonIcon />}>Dark</MenuRadioItem>
1004
+ <MenuRadioItem value="system" icon={<MonitorIcon />}>Match device</MenuRadioItem>
1005
+ </MenuRadioGroup>
1006
+ </MenuSubContent>
1007
+ </MenuSub>
1008
+ <MenuItem icon={<KeyboardIcon />} shortcut={['?']}>Keyboard shortcuts</MenuItem>
1009
+ <MenuItem asChild icon={<QuestionIcon />} hint={<ArrowSquareOutIcon />}>
1010
+ <a href={helpUrl} target="_blank" rel="noreferrer">Help centre</a>
1011
+ </MenuItem>
1012
+ <MenuSeparator />
1013
+ <MenuItem icon={<SignOutIcon />} tone="critical" onSelect={() => setLogOutOpen(true)}>
1014
+ Log out
1015
+ </MenuItem>
1016
+ </MenuContent>
1017
+ </Menu>`,
1018
+ children: /* @__PURE__ */ jsx("div", {
1019
+ className: "overlays-top",
1020
+ children: /* @__PURE__ */ jsx(AccountMenu, {})
1021
+ })
1022
+ })
1023
+ }),
1024
+ /* @__PURE__ */ jsx(Section, {
1025
+ id: "header",
1026
+ title: "Header",
1027
+ description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "MenuHeader" }), " is a free-form block at the top of the sheet: who is signed in, or the record the menu acts on. It is not a row, so it cannot be focused and the arrow keys pass over it. Follow it with a separator."] }),
1028
+ children: /* @__PURE__ */ jsx(Example, {
1029
+ align: "fill",
1030
+ minHeight: 340,
1031
+ code: `
1032
+ <Menu>
1033
+ <MenuTrigger asChild>
1034
+ <IconButton label="Actions for Eleanor Price" variant="secondary">
1035
+ <DotsThreeIcon weight="bold" />
1036
+ </IconButton>
1037
+ </MenuTrigger>
1038
+ <MenuContent align="end" width={264}>
1039
+ <MenuHeader>
1040
+ <Avatar name="Eleanor Price" />
1041
+ <span>Eleanor Price<br />4 orders · Edinburgh</span>
1042
+ </MenuHeader>
1043
+ <MenuSeparator />
1044
+ <MenuItem icon={<EnvelopeSimpleIcon />}>Email customer</MenuItem>
1045
+ <MenuItem icon={<ReceiptIcon />} hint="4">View orders</MenuItem>
1046
+ <MenuItem icon={<PlusIcon />}>Create order</MenuItem>
1047
+ <MenuSeparator />
1048
+ <MenuItem icon={<TrashIcon />} tone="critical">Erase personal data</MenuItem>
1049
+ </MenuContent>
1050
+ </Menu>`,
1051
+ children: /* @__PURE__ */ jsx("div", {
1052
+ className: "overlays-top",
1053
+ children: /* @__PURE__ */ jsx(CustomerMenu, {})
1054
+ })
1055
+ })
1056
+ }),
1057
+ /* @__PURE__ */ jsx(Section, {
1058
+ id: "width",
1059
+ title: "Width",
1060
+ description: /* @__PURE__ */ jsxs("p", { children: [
1061
+ "By default the sheet fits its rows, and is never narrower than 220px. Pass ",
1062
+ /* @__PURE__ */ jsx("code", { children: "width" }),
1063
+ " in pixels (or any CSS length) to fix it, or ",
1064
+ /* @__PURE__ */ jsx("code", { children: "'trigger'" }),
1065
+ " to match the button that opened it, which suits a menu standing in for a select. Long labels truncate with an ellipsis rather than wrap."
1066
+ ] }),
1067
+ children: /* @__PURE__ */ jsx(Example, {
1068
+ align: "fill",
1069
+ minHeight: 300,
1070
+ code: `
1071
+ <MenuContent>…</MenuContent> {/* fits its rows, 220px at least */}
1072
+ <MenuContent width={300}>…</MenuContent> {/* fixed */}
1073
+ <MenuContent width="trigger">…</MenuContent> {/* as wide as its trigger */}`,
1074
+ children: /* @__PURE__ */ jsxs("div", {
1075
+ className: "overlays-top",
1076
+ children: [
1077
+ /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
1078
+ asChild: true,
1079
+ children: /* @__PURE__ */ jsx(Button, {
1080
+ iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
1081
+ children: "Fits its rows"
1082
+ })
1083
+ }), /* @__PURE__ */ jsx(MenuContent, { children: /* @__PURE__ */ jsx(ShortRows, {}) })] }),
1084
+ /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
1085
+ asChild: true,
1086
+ children: /* @__PURE__ */ jsx(Button, {
1087
+ iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
1088
+ children: "300px"
1089
+ })
1090
+ }), /* @__PURE__ */ jsx(MenuContent, {
1091
+ width: 300,
1092
+ children: /* @__PURE__ */ jsx(ShortRows, {})
1093
+ })] }),
1094
+ /* @__PURE__ */ jsx(RangeMenu, {})
1095
+ ]
1096
+ })
1097
+ })
1098
+ }),
1099
+ /* @__PURE__ */ jsx(Section, {
1100
+ id: "placement",
1101
+ title: "Alignment and side",
1102
+ description: /* @__PURE__ */ jsxs("p", { children: [
1103
+ "The sheet opens below its trigger (",
1104
+ /* @__PURE__ */ jsx("code", { children: "side=\"bottom\"" }),
1105
+ "), 6px away, lined up with the trigger's start edge (",
1106
+ /* @__PURE__ */ jsx("code", { children: "align=\"start\"" }),
1107
+ "). Use ",
1108
+ /* @__PURE__ */ jsx("code", { children: "align=\"end\"" }),
1109
+ " for triggers at the end of a row or the right of a header. When there is no room it flips to the other side and slides along to stay 8px inside the window."
1110
+ ] }),
1111
+ children: /* @__PURE__ */ jsxs(Example, {
1112
+ minHeight: 380,
1113
+ code: `
1114
+ <MenuContent>…</MenuContent> {/* align="start", side="bottom" */}
1115
+ <MenuContent align="center">…</MenuContent>
1116
+ <MenuContent align="end">…</MenuContent>
1117
+ <MenuContent side="top">…</MenuContent>`,
1118
+ children: [
1119
+ /* @__PURE__ */ jsx(PlacementMenu, { label: "Start" }),
1120
+ /* @__PURE__ */ jsx(PlacementMenu, {
1121
+ label: "Centre",
1122
+ align: "center"
1123
+ }),
1124
+ /* @__PURE__ */ jsx(PlacementMenu, {
1125
+ label: "End",
1126
+ align: "end"
1127
+ }),
1128
+ /* @__PURE__ */ jsx(PlacementMenu, {
1129
+ label: "Above",
1130
+ side: "top"
1131
+ })
1132
+ ]
1133
+ })
1134
+ }),
1135
+ /* @__PURE__ */ jsxs(Section, {
1136
+ id: "guidelines",
1137
+ title: "Guidelines",
1138
+ children: [
1139
+ /* @__PURE__ */ jsx(DoDont, {
1140
+ do: {
1141
+ children: /* @__PURE__ */ jsx(DoDontStill, { children: /* @__PURE__ */ jsxs(MenuSheet, { children: [
1142
+ /* @__PURE__ */ jsx(MenuRow, {
1143
+ icon: /* @__PURE__ */ jsx(PencilSimpleIcon, {}),
1144
+ children: "Edit product"
1145
+ }),
1146
+ /* @__PURE__ */ jsx(MenuRow, {
1147
+ icon: /* @__PURE__ */ jsx(CopyIcon, {}),
1148
+ children: "Duplicate"
1149
+ }),
1150
+ /* @__PURE__ */ jsx(MenuRule, {}),
1151
+ /* @__PURE__ */ jsx(MenuRow, {
1152
+ icon: /* @__PURE__ */ jsx(TrashIcon, {}),
1153
+ tone: "critical",
1154
+ children: "Delete product"
1155
+ })
1156
+ ] }) }),
1157
+ caption: "Critical rows go last, after a separator, so nobody lands on one while reaching for another row."
1158
+ },
1159
+ dont: {
1160
+ children: /* @__PURE__ */ jsx(DoDontStill, { children: /* @__PURE__ */ jsxs(MenuSheet, { children: [
1161
+ /* @__PURE__ */ jsx(MenuRow, {
1162
+ icon: /* @__PURE__ */ jsx(PencilSimpleIcon, {}),
1163
+ children: "Edit product"
1164
+ }),
1165
+ /* @__PURE__ */ jsx(MenuRow, {
1166
+ icon: /* @__PURE__ */ jsx(TrashIcon, {}),
1167
+ tone: "critical",
1168
+ children: "Delete product"
1169
+ }),
1170
+ /* @__PURE__ */ jsx(MenuRow, {
1171
+ icon: /* @__PURE__ */ jsx(CopyIcon, {}),
1172
+ children: "Duplicate"
1173
+ })
1174
+ ] }) }),
1175
+ caption: "A destructive row between everyday ones is one slip of the pointer away from a mistake."
1176
+ }
1177
+ }),
1178
+ /* @__PURE__ */ jsx(DoDont, {
1179
+ do: {
1180
+ children: /* @__PURE__ */ jsx(DoDontStill, { children: /* @__PURE__ */ jsxs(MenuSheet, { children: [/* @__PURE__ */ jsx(MenuRow, {
1181
+ icon: /* @__PURE__ */ jsx(CircleHalfIcon, {}),
1182
+ hint: "Dark",
1183
+ submenu: true,
1184
+ children: "Appearance"
1185
+ }), /* @__PURE__ */ jsx(MenuRow, {
1186
+ icon: /* @__PURE__ */ jsx(ArrowsDownUpIcon, {}),
1187
+ hint: "Newest first",
1188
+ submenu: true,
1189
+ children: "Sort by"
1190
+ })] }) }),
1191
+ caption: "Show the current choice as the submenu trigger's hint."
1192
+ },
1193
+ dont: {
1194
+ children: /* @__PURE__ */ jsx(DoDontStill, { children: /* @__PURE__ */ jsxs(MenuSheet, { children: [/* @__PURE__ */ jsx(MenuRow, {
1195
+ icon: /* @__PURE__ */ jsx(CircleHalfIcon, {}),
1196
+ submenu: true,
1197
+ children: "Appearance"
1198
+ }), /* @__PURE__ */ jsx(MenuRow, {
1199
+ icon: /* @__PURE__ */ jsx(ArrowsDownUpIcon, {}),
1200
+ submenu: true,
1201
+ children: "Sort by"
1202
+ })] }) }),
1203
+ caption: "Without it, people open the submenu just to find out what is set."
1204
+ }
1205
+ }),
1206
+ /* @__PURE__ */ jsx(Guidelines, { items: [
1207
+ "Start each row with a verb and name the thing it acts on: \"Print packing slip\", not \"Slip\".",
1208
+ "Keep menus short. Past about seven rows, group them under labels; past a dozen, the choice probably wants its own screen.",
1209
+ "One level of submenu at most, and only for a set of choices, like appearance or a status.",
1210
+ "A menu holds actions and quick choices. For typing, use a Popover; for a task with several fields or steps, a Dialog.",
1211
+ "Give every row in a group an icon, or none of them, so the labels line up.",
1212
+ "Name icon-only triggers for what the actions are about: \"Actions for order #1043\", not \"More\".",
1213
+ "Only show a shortcut when the app really binds it."
1214
+ ] })
1215
+ ]
1216
+ }),
1217
+ /* @__PURE__ */ jsxs(Section, {
1218
+ id: "accessibility",
1219
+ title: "Accessibility",
1220
+ children: [/* @__PURE__ */ jsx(Guidelines, { items: [
1221
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1222
+ "Built on Radix DropdownMenu. The trigger carries ",
1223
+ /* @__PURE__ */ jsx("code", { children: "aria-haspopup=\"menu\"" }),
1224
+ " and",
1225
+ " ",
1226
+ /* @__PURE__ */ jsx("code", { children: "aria-expanded" }),
1227
+ "; rows are ",
1228
+ /* @__PURE__ */ jsx("code", { children: "menuitem" }),
1229
+ ", ",
1230
+ /* @__PURE__ */ jsx("code", { children: "menuitemcheckbox" }),
1231
+ " or",
1232
+ " ",
1233
+ /* @__PURE__ */ jsx("code", { children: "menuitemradio" }),
1234
+ " with ",
1235
+ /* @__PURE__ */ jsx("code", { children: "aria-checked" }),
1236
+ "."
1237
+ ] }),
1238
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1239
+ "Enter, Space or the down arrow opens the menu from the trigger and focus moves into it. The arrow keys move between rows and wrap round at the ends (",
1240
+ /* @__PURE__ */ jsx("code", { children: "loop" }),
1241
+ " is on), Home and End jump, and typing a few letters jumps to the row that starts with them. Hints and keycaps are left out of that matching."
1242
+ ] }),
1243
+ "The right arrow opens a submenu and the left arrow closes it again. Escape closes the menu and hands focus back to the trigger.",
1244
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1245
+ "While a menu is open (",
1246
+ /* @__PURE__ */ jsx("code", { children: "modal" }),
1247
+ ", the default) the page behind ignores the pointer, does not scroll, and is hidden from screen readers."
1248
+ ] }),
1249
+ "Icons are hidden from assistive tech. A hint and a shortcut are read as part of the row, with symbol keys spoken by name (\"Command P\").",
1250
+ "Highlight is a tint, never colour alone: the chosen radio and checked rows also carry a mark.",
1251
+ "With reduced motion the sheet and its rows fade in without growing or rising, and the check and satellite appear without moving."
1252
+ ] }), /* @__PURE__ */ jsxs(Note, {
1253
+ title: "Tooltips on menu triggers",
1254
+ children: [
1255
+ "An icon-only trigger can carry a tooltip. Pass the tooltip ",
1256
+ /* @__PURE__ */ jsx("code", { children: "disabled" }),
1257
+ " while the menu is open, so it does not sit on top of the sheet. See ",
1258
+ /* @__PURE__ */ jsx(DocLink, {
1259
+ to: "/components/tooltip#disabled",
1260
+ children: "Tooltip"
1261
+ }),
1262
+ "."
1263
+ ]
1264
+ })]
1265
+ }),
1266
+ /* @__PURE__ */ jsxs(Section, {
1267
+ id: "props",
1268
+ title: "Props",
1269
+ description: /* @__PURE__ */ jsx("p", { children: "Every part also accepts the matching Radix DropdownMenu props." }),
1270
+ children: [
1271
+ /* @__PURE__ */ jsx(PropsTable, {
1272
+ title: "Menu",
1273
+ rows: [
1274
+ {
1275
+ name: "open",
1276
+ type: "boolean",
1277
+ description: "Controlled open state."
1278
+ },
1279
+ {
1280
+ name: "defaultOpen",
1281
+ type: "boolean",
1282
+ default: "false",
1283
+ description: "Starting state when uncontrolled."
1284
+ },
1285
+ {
1286
+ name: "onOpenChange",
1287
+ type: "(open: boolean) => void",
1288
+ description: "Called when the menu opens or closes."
1289
+ },
1290
+ {
1291
+ name: "modal",
1292
+ type: "boolean",
1293
+ default: "true",
1294
+ description: "While open, the rest of the page ignores the pointer, does not scroll and is hidden from screen readers."
1295
+ }
1296
+ ]
1297
+ }),
1298
+ /* @__PURE__ */ jsx(PropsTable, {
1299
+ title: "MenuTrigger",
1300
+ rows: [{
1301
+ name: "asChild",
1302
+ type: "boolean",
1303
+ default: "false",
1304
+ description: "Render your Button or IconButton as the trigger. Almost always on."
1305
+ }, {
1306
+ name: "disabled",
1307
+ type: "boolean",
1308
+ default: "false",
1309
+ description: "The trigger cannot open the menu."
1310
+ }]
1311
+ }),
1312
+ /* @__PURE__ */ jsx(PropsTable, {
1313
+ title: "MenuContent",
1314
+ rows: [
1315
+ {
1316
+ name: "width",
1317
+ type: "number | string | 'trigger'",
1318
+ description: "Fixed width in px, any CSS length, or 'trigger' to match the trigger. By default it fits its rows, 220px at least."
1319
+ },
1320
+ {
1321
+ name: "align",
1322
+ type: "'start' | 'center' | 'end'",
1323
+ default: "'start'",
1324
+ description: "Which edge of the trigger the sheet lines up with."
1325
+ },
1326
+ {
1327
+ name: "side",
1328
+ type: "'top' | 'right' | 'bottom' | 'left'",
1329
+ default: "'bottom'",
1330
+ description: "Preferred side. Flips when there is no room."
1331
+ },
1332
+ {
1333
+ name: "sideOffset",
1334
+ type: "number",
1335
+ default: "6",
1336
+ description: "Gap from the trigger in px."
1337
+ },
1338
+ {
1339
+ name: "alignOffset",
1340
+ type: "number",
1341
+ default: "0",
1342
+ description: "Nudge along the aligned edge in px."
1343
+ },
1344
+ {
1345
+ name: "collisionPadding",
1346
+ type: "number",
1347
+ default: "8",
1348
+ description: "Space kept from the edges of the window."
1349
+ },
1350
+ {
1351
+ name: "loop",
1352
+ type: "boolean",
1353
+ default: "true",
1354
+ description: "The arrow keys wrap round from the last row to the first."
1355
+ },
1356
+ {
1357
+ name: "container",
1358
+ type: "HTMLElement | null",
1359
+ default: "document.body",
1360
+ description: "Where the sheet is portalled."
1361
+ },
1362
+ {
1363
+ name: "onCloseAutoFocus",
1364
+ type: "(event: Event) => void",
1365
+ description: "Runs as focus goes back to the trigger. Prevent it to send focus elsewhere."
1366
+ }
1367
+ ]
1368
+ }),
1369
+ /* @__PURE__ */ jsx(PropsTable, {
1370
+ title: "MenuItem",
1371
+ rows: [
1372
+ {
1373
+ name: "children",
1374
+ type: "ReactNode",
1375
+ required: true,
1376
+ description: "The label."
1377
+ },
1378
+ {
1379
+ name: "onSelect",
1380
+ type: "(event: Event) => void",
1381
+ description: "Runs the action. The menu closes after it unless you call event.preventDefault()."
1382
+ },
1383
+ {
1384
+ name: "icon",
1385
+ type: "ReactNode",
1386
+ description: "Leading 16px icon, muted until the row is highlighted."
1387
+ },
1388
+ {
1389
+ name: "hint",
1390
+ type: "ReactNode",
1391
+ description: "Muted detail at the end, such as a format or why a row is disabled."
1392
+ },
1393
+ {
1394
+ name: "shortcut",
1395
+ type: "string[]",
1396
+ description: "Keycaps via Kbd, e.g. ['mod', 'shift', 'C']. Drawn only; bind the keys yourself."
1397
+ },
1398
+ {
1399
+ name: "tone",
1400
+ type: "'critical'",
1401
+ description: "Red, for actions that destroy something or sign out."
1402
+ },
1403
+ {
1404
+ name: "disabled",
1405
+ type: "boolean",
1406
+ default: "false",
1407
+ description: "Dimmed and skipped by the arrow keys."
1408
+ },
1409
+ {
1410
+ name: "asChild",
1411
+ type: "boolean",
1412
+ default: "false",
1413
+ description: "Render a link (router Link or a) as the row."
1414
+ },
1415
+ {
1416
+ name: "textValue",
1417
+ type: "string",
1418
+ description: "Text for typing to jump to the row. Defaults to the label."
1419
+ }
1420
+ ]
1421
+ }),
1422
+ /* @__PURE__ */ jsx(PropsTable, {
1423
+ title: "MenuCheckboxItem",
1424
+ rows: [
1425
+ {
1426
+ name: "checked",
1427
+ type: "boolean",
1428
+ description: "Controlled state."
1429
+ },
1430
+ {
1431
+ name: "onCheckedChange",
1432
+ type: "(checked: boolean) => void",
1433
+ description: "Called with the new state."
1434
+ },
1435
+ {
1436
+ name: "onSelect",
1437
+ type: "(event: Event) => void",
1438
+ description: "Prevent the event to keep the menu open."
1439
+ },
1440
+ {
1441
+ name: "icon, hint, shortcut",
1442
+ type: "ReactNode, ReactNode, string[]",
1443
+ description: "As on MenuItem. The check sits at the end."
1444
+ },
1445
+ {
1446
+ name: "disabled",
1447
+ type: "boolean",
1448
+ default: "false",
1449
+ description: "Dimmed and skipped by the arrow keys."
1450
+ }
1451
+ ]
1452
+ }),
1453
+ /* @__PURE__ */ jsx(PropsTable, {
1454
+ title: "MenuRadioGroup",
1455
+ rows: [{
1456
+ name: "value",
1457
+ type: "string",
1458
+ description: "The chosen value."
1459
+ }, {
1460
+ name: "onValueChange",
1461
+ type: "(value: string) => void",
1462
+ description: "Called with the newly chosen value."
1463
+ }]
1464
+ }),
1465
+ /* @__PURE__ */ jsx(PropsTable, {
1466
+ title: "MenuRadioItem",
1467
+ rows: [
1468
+ {
1469
+ name: "value",
1470
+ type: "string",
1471
+ required: true,
1472
+ description: "The value this row stands for."
1473
+ },
1474
+ {
1475
+ name: "onSelect",
1476
+ type: "(event: Event) => void",
1477
+ description: "Prevent the event to keep the menu open."
1478
+ },
1479
+ {
1480
+ name: "icon, hint, shortcut",
1481
+ type: "ReactNode, ReactNode, string[]",
1482
+ description: "As on MenuItem. The ring and satellite sit at the end."
1483
+ },
1484
+ {
1485
+ name: "disabled",
1486
+ type: "boolean",
1487
+ default: "false",
1488
+ description: "Dimmed and skipped by the arrow keys."
1489
+ }
1490
+ ]
1491
+ }),
1492
+ /* @__PURE__ */ jsx(PropsTable, {
1493
+ title: "MenuSub",
1494
+ rows: [
1495
+ {
1496
+ name: "open",
1497
+ type: "boolean",
1498
+ description: "Controlled open state of the submenu."
1499
+ },
1500
+ {
1501
+ name: "defaultOpen",
1502
+ type: "boolean",
1503
+ default: "false",
1504
+ description: "Starting state when uncontrolled."
1505
+ },
1506
+ {
1507
+ name: "onOpenChange",
1508
+ type: "(open: boolean) => void",
1509
+ description: "Called when the submenu opens or closes."
1510
+ }
1511
+ ]
1512
+ }),
1513
+ /* @__PURE__ */ jsx(PropsTable, {
1514
+ title: "MenuSubTrigger",
1515
+ rows: [
1516
+ {
1517
+ name: "children",
1518
+ type: "ReactNode",
1519
+ required: true,
1520
+ description: "The label."
1521
+ },
1522
+ {
1523
+ name: "icon",
1524
+ type: "ReactNode",
1525
+ description: "Leading 16px icon."
1526
+ },
1527
+ {
1528
+ name: "hint",
1529
+ type: "ReactNode",
1530
+ description: "Muted detail before the chevron: the current choice inside."
1531
+ },
1532
+ {
1533
+ name: "disabled",
1534
+ type: "boolean",
1535
+ default: "false",
1536
+ description: "The submenu cannot open."
1537
+ }
1538
+ ]
1539
+ }),
1540
+ /* @__PURE__ */ jsx(PropsTable, {
1541
+ title: "MenuSubContent",
1542
+ rows: [
1543
+ {
1544
+ name: "width",
1545
+ type: "number | string | 'trigger'",
1546
+ description: "As on MenuContent."
1547
+ },
1548
+ {
1549
+ name: "sideOffset",
1550
+ type: "number",
1551
+ default: "10",
1552
+ description: "Measured from the trigger row, so the sheet sits 4px clear of its parent."
1553
+ },
1554
+ {
1555
+ name: "alignOffset",
1556
+ type: "number",
1557
+ default: "-6",
1558
+ description: "Lines the first row up with the trigger row."
1559
+ },
1560
+ {
1561
+ name: "collisionPadding",
1562
+ type: "number",
1563
+ default: "8",
1564
+ description: "Space kept from the edges of the window."
1565
+ },
1566
+ {
1567
+ name: "loop",
1568
+ type: "boolean",
1569
+ default: "true",
1570
+ description: "The arrow keys wrap round."
1571
+ },
1572
+ {
1573
+ name: "container",
1574
+ type: "HTMLElement | null",
1575
+ default: "document.body",
1576
+ description: "Where the sheet is portalled."
1577
+ }
1578
+ ]
1579
+ }),
1580
+ /* @__PURE__ */ jsx(PropsTable, {
1581
+ title: "MenuLabel",
1582
+ rows: [{
1583
+ name: "children",
1584
+ type: "ReactNode",
1585
+ description: "A quiet heading for the rows below it, in sentence case. Not focusable."
1586
+ }]
1587
+ }),
1588
+ /* @__PURE__ */ jsx(PropsTable, {
1589
+ title: "MenuGroup",
1590
+ rows: [{
1591
+ name: "children",
1592
+ type: "ReactNode",
1593
+ description: "The rows it groups for assistive tech. It has no look of its own."
1594
+ }]
1595
+ }),
1596
+ /* @__PURE__ */ jsx(PropsTable, {
1597
+ title: "MenuSeparator",
1598
+ rows: [{
1599
+ name: "className",
1600
+ type: "string",
1601
+ description: "A hairline between groups. It has no props of its own beyond the usual element attributes."
1602
+ }]
1603
+ }),
1604
+ /* @__PURE__ */ jsx(PropsTable, {
1605
+ title: "MenuHeader",
1606
+ rows: [{
1607
+ name: "children",
1608
+ type: "ReactNode",
1609
+ description: "Free-form content, laid out in a row with a 10px gap. Accepts every div attribute."
1610
+ }]
1611
+ })
1612
+ ]
1613
+ })
1614
+ ]
1615
+ });
1616
+ }
1617
+ //#endregion
1618
+ export { Page, Preview };