@orbitcommerce/constellation-docs 0.0.0-stage → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +6 -0
- package/README.md +6 -2
- package/dist/docs.css +20787 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +308 -0
- package/dist/pages/Playground-Mk1yIWXb.js +129 -0
- package/dist/pages/_address-data-L9BR499w.js +161 -0
- package/dist/pages/_builder-demo-C0eJUmPU.js +282 -0
- package/dist/pages/_card-art-0be5ncyV.js +18 -0
- package/dist/pages/_conversation-samples-Bq7cn-4d.js +70 -0
- package/dist/pages/_figures-data-DaDvB7Nm.js +606 -0
- package/dist/pages/_foundations-blXWyYh8.js +30 -0
- package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
- package/dist/pages/_overlays-specimens-bawR331Z.js +320 -0
- package/dist/pages/_preview-specimens-DKQC9HAo.js +153 -0
- package/dist/pages/accordion-Sg0TUqxB.js +1036 -0
- package/dist/pages/address-autocomplete-DP0PUOlK.js +360 -0
- package/dist/pages/address-block-BZOOOPA9.js +368 -0
- package/dist/pages/address-fields-CwSqro3W.js +277 -0
- package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
- package/dist/pages/alert-D3i7xZTU.js +914 -0
- package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
- package/dist/pages/app-shell-D4hdlHps.js +1558 -0
- package/dist/pages/area-chart-BEWFwiB2.js +718 -0
- package/dist/pages/avatar-BFEqQViw.js +895 -0
- package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
- package/dist/pages/badge-0-PyMrih.js +1035 -0
- package/dist/pages/bar-chart-DkLogYlt.js +1060 -0
- package/dist/pages/bar-fold-B-3XeIDZ.js +360 -0
- package/dist/pages/board-card-D2tZY_mU.js +415 -0
- package/dist/pages/brand-mark-BqiLvFSR.js +417 -0
- package/dist/pages/button-DAyfssDY.js +715 -0
- package/dist/pages/calendar-Ds7KsgSI.js +682 -0
- package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
- package/dist/pages/card-CQEM1_wc.js +1567 -0
- package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
- package/dist/pages/chart-legend-B20AbakD.js +724 -0
- package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
- package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
- package/dist/pages/checklist-card-DEyykVFS.js +783 -0
- package/dist/pages/chip-Ck-o3Ui6.js +839 -0
- package/dist/pages/chip-list-k1LxXuCi.js +414 -0
- package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
- package/dist/pages/coachmark-Be2ghobT.js +366 -0
- package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
- package/dist/pages/collab-field-CfqqK7d2.js +696 -0
- package/dist/pages/color-field-CZpfcA-A.js +1127 -0
- package/dist/pages/colour-q2ntvI0w.js +1974 -0
- package/dist/pages/column-mapper-TsTG39cl.js +502 -0
- package/dist/pages/combobox-DvK2j5tI.js +1334 -0
- package/dist/pages/command-palette-CJ7uBA04.js +1386 -0
- package/dist/pages/comment-box-CDSGYhr5.js +346 -0
- package/dist/pages/composer-D4B0NgpA.js +689 -0
- package/dist/pages/condition-builder-BZy2ZGXe.js +715 -0
- package/dist/pages/conflict-chooser-C--_9UIS.js +210 -0
- package/dist/pages/context-menu-F9DV30ia.js +487 -0
- package/dist/pages/copy-button-Cn7WiKRF.js +568 -0
- package/dist/pages/copy-field-D3Xt3Jq6.js +511 -0
- package/dist/pages/danger-zone-Db_UUeiP.js +564 -0
- package/dist/pages/date-input-GOW067EB.js +956 -0
- package/dist/pages/date-picker-GdBciR99.js +1569 -0
- package/dist/pages/date-time-BLKCXtVZ.js +678 -0
- package/dist/pages/delta-CNAGv8JY.js +779 -0
- package/dist/pages/description-list-BPeXn1eW.js +1268 -0
- package/dist/pages/device-switcher-BCaN99c1.js +554 -0
- package/dist/pages/dialog-CRpkRC98.js +3164 -0
- package/dist/pages/docs-lM2UBSir.js +520 -0
- package/dist/pages/doodle-nzkqi2UI.js +201 -0
- package/dist/pages/drag-ghost-B6kpzC3O.js +426 -0
- package/dist/pages/drill-menu-cskH5mol.js +490 -0
- package/dist/pages/dropzone-DOY_Rhw0.js +1069 -0
- package/dist/pages/element-toolbar-DZIhXlCJ.js +498 -0
- package/dist/pages/emoji-picker-CqaWaffD.js +235 -0
- package/dist/pages/empty-state-4U2txFpI.js +1113 -0
- package/dist/pages/facet-filters-McbBeY9e.js +353 -0
- package/dist/pages/figure-D-HF5vCj.js +563 -0
- package/dist/pages/figure-strip-BB3mNl7D.js +1364 -0
- package/dist/pages/figure-tabs-QOeQMY6N.js +578 -0
- package/dist/pages/file-chip-DMDjtlqQ.js +738 -0
- package/dist/pages/filter-pill-DzqNOsD4.js +1295 -0
- package/dist/pages/font-picker-Bqhu0QMh.js +416 -0
- package/dist/pages/form-grid-BfWCVlie.js +692 -0
- package/dist/pages/gallery-BBk2EOri.js +453 -0
- package/dist/pages/gif-picker-CnoDTCaL.js +270 -0
- package/dist/pages/gradient-editor-Bqxp7Fxj.js +378 -0
- package/dist/pages/grouped-checklist-gNZ0tBKU.js +477 -0
- package/dist/pages/heatmap-BohgIcNk.js +507 -0
- package/dist/pages/highlight-text-BfxzfmvS.js +287 -0
- package/dist/pages/home-dashboard-CxPmvduE.js +962 -0
- package/dist/pages/host-B6znjEgQ.js +109 -0
- package/dist/pages/hosted-embed-Jef3aIMP.js +163 -0
- package/dist/pages/hosted-field-BLh-53AE.js +208 -0
- package/dist/pages/hosted-field-DEpI4lVS.js +514 -0
- package/dist/pages/icon-button-Bu4Gj5sy.js +1200 -0
- package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
- package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
- package/dist/pages/icons-CJ9Aar3d.js +736 -0
- package/dist/pages/image-cropper-NyougqLH.js +466 -0
- package/dist/pages/image-field-7knBv4mJ.js +567 -0
- package/dist/pages/import-result-CmTtGXW_.js +486 -0
- package/dist/pages/inline-confirm-CEcI5Lxo.js +327 -0
- package/dist/pages/inline-edit-Ba39SzhM.js +1125 -0
- package/dist/pages/input-CzLCzfyx.js +2372 -0
- package/dist/pages/installation-C3UcpQJT.js +528 -0
- package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
- package/dist/pages/kanban-Dy9sPAI0.js +740 -0
- package/dist/pages/kbd-UNj4zqxn.js +545 -0
- package/dist/pages/layout-primitives-CPRaZeyt.js +483 -0
- package/dist/pages/line-chart-CntWxeMF.js +1117 -0
- package/dist/pages/link-CXqvAg9z.js +689 -0
- package/dist/pages/link-picker-BMFGCC67.js +478 -0
- package/dist/pages/link-row-x8yaUuWc.js +595 -0
- package/dist/pages/live-globe-95ROMhGQ.js +715 -0
- package/dist/pages/loading-overlay-BeGuXM9G.js +456 -0
- package/dist/pages/loading-state-BNbCo51C.js +556 -0
- package/dist/pages/log-viewer-BQz8I_a2.js +503 -0
- package/dist/pages/logo-B38rnzoq.js +571 -0
- package/dist/pages/lottie_light-CxEH8eiR.js +9116 -0
- package/dist/pages/markdown-Ied72vMT.js +237 -0
- package/dist/pages/markdown-field-BfnIEKZH.js +193 -0
- package/dist/pages/media-banner-DkStCia0.js +233 -0
- package/dist/pages/menu-NrLYKqKp.js +2132 -0
- package/dist/pages/message-thread-Bo4zbxqu.js +731 -0
- package/dist/pages/meta-line-D5p2TycR.js +371 -0
- package/dist/pages/model-viewer-BfokvHoc.js +60288 -0
- package/dist/pages/model-viewer-C8PFO8wk.js +577 -0
- package/dist/pages/month-calendar-T1vw9Rup.js +457 -0
- package/dist/pages/motion-CrXtiBvA.js +865 -0
- package/dist/pages/number-input-CuyMZg18.js +968 -0
- package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
- package/dist/pages/orbit-spinner-Dxv5qAhr.js +348 -0
- package/dist/pages/otp-input-CVRoX1mw.js +591 -0
- package/dist/pages/overview-LA9XRhZc.js +130 -0
- package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
- package/dist/pages/pagination-C1EgVtW4.js +294 -0
- package/dist/pages/palette-tile-X9ZXu2Z0.js +414 -0
- package/dist/pages/password-field-DHEQKyUC.js +912 -0
- package/dist/pages/person-cell-BmjbADBz.js +564 -0
- package/dist/pages/phone-input-B3G7Qpb2.js +747 -0
- package/dist/pages/plan-card-DRaA6RuB.js +621 -0
- package/dist/pages/plan-card-DtloWvMh.js +258 -0
- package/dist/pages/plan-comparison-BVIGTtbd.js +559 -0
- package/dist/pages/plan-grid-cfPVTB5V.js +251 -0
- package/dist/pages/point-list-BbPmZjsm.js +222 -0
- package/dist/pages/popover-C3Oar9D5.js +1198 -0
- package/dist/pages/presence-avatars-CRZIk8n9.js +328 -0
- package/dist/pages/preview-frame-Bcwk0y_Q.js +1631 -0
- package/dist/pages/price-CRBLoa9h.js +604 -0
- package/dist/pages/principles-pnDyfHpK.js +483 -0
- package/dist/pages/print-page-BkLv6bW8.js +513 -0
- package/dist/pages/profile-hero-CC9dUzuN.js +498 -0
- package/dist/pages/progress-CP_awmo4.js +904 -0
- package/dist/pages/progress-ring-JuOAwk2T.js +576 -0
- package/dist/pages/radio-group-C-4tg6FS.js +1639 -0
- package/dist/pages/radius-control-B2kRA2Ch.js +441 -0
- package/dist/pages/rating-CweKN2SX.js +471 -0
- package/dist/pages/record-layout-DUP_X0RL.js +719 -0
- package/dist/pages/record-pager-y9D7JFgb.js +278 -0
- package/dist/pages/registry-BZg-xAbi.js +594 -0
- package/dist/pages/release-Cs6tl16C.js +16 -0
- package/dist/pages/repeater-BRZYKRQa.js +1351 -0
- package/dist/pages/reply-feedback-BDnHprla.js +192 -0
- package/dist/pages/reveal-BygENBbL.js +460 -0
- package/dist/pages/rich-text-DOFQZEpT.js +156 -0
- package/dist/pages/rich-text-editor-BhIM20JI.js +1265 -0
- package/dist/pages/rolldown-runtime-CbKu08Hx.js +25 -0
- package/dist/pages/rolling-number-GR3Cyfpz.js +529 -0
- package/dist/pages/row-list-Dl6CYhC-.js +1565 -0
- package/dist/pages/rule-list-DTCmIMpT.js +648 -0
- package/dist/pages/save-status-B5KkyMZP.js +378 -0
- package/dist/pages/schedule-YycI95O1.js +243 -0
- package/dist/pages/scroll-area-B2sGm23Q.js +423 -0
- package/dist/pages/search-field-D1uG7R6A.js +693 -0
- package/dist/pages/search-menu-DMuXyUUW.js +580 -0
- package/dist/pages/secret-field-Dj9x3LL8.js +337 -0
- package/dist/pages/section-rail-BtTCETS5.js +637 -0
- package/dist/pages/section-v2Pubup9.js +639 -0
- package/dist/pages/segmented-control-D-FB1K1T.js +1190 -0
- package/dist/pages/select-DZ43NpOm.js +1434 -0
- package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
- package/dist/pages/separator-CFwqRvfO.js +428 -0
- package/dist/pages/serp-preview-BGwORjmo.js +346 -0
- package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
- package/dist/pages/shape-DzniHAVT.js +627 -0
- package/dist/pages/share-list-D4wgBxKN.js +926 -0
- package/dist/pages/side-panel-CCtkrZjs.js +811 -0
- package/dist/pages/site-preview-Dj1hM2Yo.js +353 -0
- package/dist/pages/skeleton-C1F5HkAu.js +1325 -0
- package/dist/pages/skip-link-BxznhSkz.js +252 -0
- package/dist/pages/slider-CAoPURKD.js +774 -0
- package/dist/pages/sortable-card-Sr44uCpI.js +424 -0
- package/dist/pages/sortable-list-DUAleYE1.js +1298 -0
- package/dist/pages/sortable-tree-BLzK-hTE.js +737 -0
- package/dist/pages/spacing-box-CtuvzxQu.js +550 -0
- package/dist/pages/sparkline-D3aavCly.js +947 -0
- package/dist/pages/split-bar-DYgZnFID.js +414 -0
- package/dist/pages/split-button-Be08-VI-.js +335 -0
- package/dist/pages/split-pane-lSNZgTKt.js +523 -0
- package/dist/pages/status-badge-DOdNhmzn.js +1074 -0
- package/dist/pages/status-checklist-CWkjCZIC.js +1152 -0
- package/dist/pages/status-dot-D99gAGsV.js +567 -0
- package/dist/pages/stepper-CxKTbEA-.js +1093 -0
- package/dist/pages/success-mark-CqFTOBEu.js +142 -0
- package/dist/pages/swatch-H_kNvHuC.js +565 -0
- package/dist/pages/switch-C93K6j9h.js +617 -0
- package/dist/pages/table-CL0vomno.js +3225 -0
- package/dist/pages/tabs-Dh0mUsLw.js +1690 -0
- package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
- package/dist/pages/task-card-Dv0sR1-w.js +295 -0
- package/dist/pages/textarea-CCM-SnGN.js +949 -0
- package/dist/pages/thumbnail-DwFJL_k1.js +1147 -0
- package/dist/pages/time-input-CA9-uZAa.js +442 -0
- package/dist/pages/time-zone-select-CEtMXVYO.js +296 -0
- package/dist/pages/timeline-BsMUTlpR.js +1798 -0
- package/dist/pages/toast-zXLRiMRT.js +1391 -0
- package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
- package/dist/pages/toolbar-B9l_fHKy.js +754 -0
- package/dist/pages/tooltip-LHtCUkF-.js +826 -0
- package/dist/pages/translation-field-CTRXiF2N.js +251 -0
- package/dist/pages/tree-checklist-CJj3OcLg.js +451 -0
- package/dist/pages/tree-select-DU1qXHy_.js +492 -0
- package/dist/pages/tree-view-g_RjLtAb.js +739 -0
- package/dist/pages/typography-BSijtiRl.js +876 -0
- package/dist/pages/unit-input-Dml4fjmK.js +659 -0
- package/dist/pages/upload-rules-yozEzSah.js +419 -0
- package/dist/pages/url-upload-input-SSnMgfpA.js +307 -0
- package/dist/pages/value-change-CnubDKyO.js +489 -0
- package/dist/pages/weekly-hours-i2EpsmTx.js +287 -0
- package/dist/pages/widget-preview-CUJMyZ_k.js +625 -0
- package/dist/pages/working-status-CENemSsw.js +389 -0
- package/manifest.json +13001 -0
- package/package.json +35 -4
|
@@ -0,0 +1,2132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as DocLink } from "./host-B6znjEgQ.js";
|
|
3
|
+
import { a as DocTable, d as Section$1, i as DocPage, l as Note, m as ThemePair, n as CodeBlock$1, o as Example, p as SubSection, r as DoDont, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
|
|
4
|
+
import { a as MenuSheet, c as SpecimenFrame, i as MenuRule, n as MenuHeading, r as MenuRow } from "./_overlays-specimens-bawR331Z.js";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Avatar, Badge, Button, ConfirmDialog, IconButton, Menu, MenuCheckboxItem, MenuChipTrigger, MenuContent, MenuGroup, MenuHeader, MenuInlineSub, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger } from "@orbitcommerce/constellation";
|
|
8
|
+
import { ArchiveIcon, ArrowCounterClockwiseIcon, ArrowSquareOutIcon, ArrowsDownUpIcon, BarcodeIcon, CaretDownIcon, CircleHalfIcon, ColumnsIcon, CopyIcon, CpuIcon, DotsThreeIcon, DownloadSimpleIcon, EnvelopeSimpleIcon, EyeIcon, FilePdfIcon, FileTextIcon, GaugeIcon, GearSixIcon, KeyboardIcon, MagicWandIcon, MonitorIcon, MoonIcon, PenNibIcon, PencilSimpleIcon, PlusIcon, PrinterIcon, QuestionIcon, ReceiptIcon, SignOutIcon, SlidersHorizontalIcon, SparkleIcon, StorefrontIcon, SunIcon, TranslateIcon, 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
|
+
var storeUrl = "https://harbourdesk.example";
|
|
12
|
+
var helpUrl = "https://help.example.com";
|
|
13
|
+
function Preview() {
|
|
14
|
+
return /* @__PURE__ */ jsxs(MenuSheet, {
|
|
15
|
+
width: 210,
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
18
|
+
icon: /* @__PURE__ */ jsx(EyeIcon, {}),
|
|
19
|
+
children: "View order"
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
22
|
+
icon: /* @__PURE__ */ jsx(PrinterIcon, {}),
|
|
23
|
+
shortcut: ["mod", "P"],
|
|
24
|
+
highlighted: true,
|
|
25
|
+
children: "Print slip"
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ jsx(MenuRule, {}),
|
|
28
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
29
|
+
icon: /* @__PURE__ */ jsx(XCircleIcon, {}),
|
|
30
|
+
tone: "critical",
|
|
31
|
+
children: "Cancel order"
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function OrderRowActions() {
|
|
37
|
+
const [cancelOpen, setCancelOpen] = useState(false);
|
|
38
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
|
|
39
|
+
className: "menu-order-row",
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsx("span", {
|
|
42
|
+
className: "menu-order-row__id",
|
|
43
|
+
children: "#1043"
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsx("span", {
|
|
46
|
+
className: "menu-order-row__name",
|
|
47
|
+
children: "Sarah Whitfield"
|
|
48
|
+
}),
|
|
49
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
50
|
+
tone: "positive",
|
|
51
|
+
children: "Paid"
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ jsx("span", {
|
|
54
|
+
className: "menu-order-row__total",
|
|
55
|
+
children: "£240.00"
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsx(OrderActionsMenu, { onCancel: () => setCancelOpen(true) })
|
|
58
|
+
]
|
|
59
|
+
}), /* @__PURE__ */ jsx(ConfirmDialog, {
|
|
60
|
+
open: cancelOpen,
|
|
61
|
+
onOpenChange: setCancelOpen,
|
|
62
|
+
tone: "critical",
|
|
63
|
+
title: "Cancel order #1043?",
|
|
64
|
+
description: "Sarah Whitfield gets £240.00 back on her card and an email to say so. The stock goes back on sale.",
|
|
65
|
+
confirmLabel: "Cancel order",
|
|
66
|
+
cancelLabel: "Keep order",
|
|
67
|
+
onConfirm: () => wait(1200)
|
|
68
|
+
})] });
|
|
69
|
+
}
|
|
70
|
+
function OrderActionsMenu({ onCancel, triggerRef }) {
|
|
71
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
72
|
+
asChild: true,
|
|
73
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
74
|
+
ref: triggerRef,
|
|
75
|
+
label: "Actions for order #1043",
|
|
76
|
+
children: /* @__PURE__ */ jsx(DotsThreeIcon, { weight: "bold" })
|
|
77
|
+
})
|
|
78
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
79
|
+
align: "end",
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
82
|
+
icon: /* @__PURE__ */ jsx(EyeIcon, {}),
|
|
83
|
+
children: "View order"
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
86
|
+
icon: /* @__PURE__ */ jsx(PrinterIcon, {}),
|
|
87
|
+
shortcut: ["mod", "P"],
|
|
88
|
+
children: "Print packing slip"
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
91
|
+
icon: /* @__PURE__ */ jsx(TruckIcon, {}),
|
|
92
|
+
children: "Mark as fulfilled"
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
95
|
+
icon: /* @__PURE__ */ jsx(FilePdfIcon, {}),
|
|
96
|
+
hint: "PDF",
|
|
97
|
+
children: "Download invoice"
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
100
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
101
|
+
icon: /* @__PURE__ */ jsx(ArrowCounterClockwiseIcon, {}),
|
|
102
|
+
children: "Refund"
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
105
|
+
icon: /* @__PURE__ */ jsx(XCircleIcon, {}),
|
|
106
|
+
tone: "critical",
|
|
107
|
+
onSelect: onCancel,
|
|
108
|
+
children: "Cancel order"
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
})] });
|
|
112
|
+
}
|
|
113
|
+
function ProductActions() {
|
|
114
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
115
|
+
asChild: true,
|
|
116
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
117
|
+
iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
|
|
118
|
+
children: "More actions"
|
|
119
|
+
})
|
|
120
|
+
}), /* @__PURE__ */ jsxs(MenuContent, { children: [
|
|
121
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
122
|
+
icon: /* @__PURE__ */ jsx(PencilSimpleIcon, {}),
|
|
123
|
+
shortcut: ["E"],
|
|
124
|
+
children: "Edit product"
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
127
|
+
icon: /* @__PURE__ */ jsx(CopyIcon, {}),
|
|
128
|
+
shortcut: ["mod", "D"],
|
|
129
|
+
children: "Duplicate"
|
|
130
|
+
}),
|
|
131
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
132
|
+
icon: /* @__PURE__ */ jsx(DownloadSimpleIcon, {}),
|
|
133
|
+
hint: "CSV",
|
|
134
|
+
children: "Export"
|
|
135
|
+
}),
|
|
136
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
137
|
+
icon: /* @__PURE__ */ jsx(BarcodeIcon, {}),
|
|
138
|
+
hint: "Add a SKU first",
|
|
139
|
+
disabled: true,
|
|
140
|
+
children: "Print barcodes"
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
143
|
+
asChild: true,
|
|
144
|
+
icon: /* @__PURE__ */ jsx(StorefrontIcon, {}),
|
|
145
|
+
hint: /* @__PURE__ */ jsx(ArrowSquareOutIcon, {}),
|
|
146
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
147
|
+
href: storeUrl,
|
|
148
|
+
target: "_blank",
|
|
149
|
+
rel: "noreferrer",
|
|
150
|
+
children: "View on your store"
|
|
151
|
+
})
|
|
152
|
+
}),
|
|
153
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
154
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
155
|
+
icon: /* @__PURE__ */ jsx(ArchiveIcon, {}),
|
|
156
|
+
children: "Archive"
|
|
157
|
+
}),
|
|
158
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
159
|
+
icon: /* @__PURE__ */ jsx(TrashIcon, {}),
|
|
160
|
+
tone: "critical",
|
|
161
|
+
children: "Delete product"
|
|
162
|
+
})
|
|
163
|
+
] })] });
|
|
164
|
+
}
|
|
165
|
+
var COLUMNS = [
|
|
166
|
+
{
|
|
167
|
+
id: "customer",
|
|
168
|
+
label: "Customer"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: "channel",
|
|
172
|
+
label: "Sales channel"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
id: "payment",
|
|
176
|
+
label: "Payment"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: "fulfilment",
|
|
180
|
+
label: "Fulfilment"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: "items",
|
|
184
|
+
label: "Items"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
id: "total",
|
|
188
|
+
label: "Total"
|
|
189
|
+
}
|
|
190
|
+
];
|
|
191
|
+
function ColumnsMenu() {
|
|
192
|
+
const [shown, setShown] = useState({
|
|
193
|
+
customer: true,
|
|
194
|
+
channel: false,
|
|
195
|
+
payment: true,
|
|
196
|
+
fulfilment: true,
|
|
197
|
+
items: false,
|
|
198
|
+
total: true
|
|
199
|
+
});
|
|
200
|
+
const count = Object.values(shown).filter(Boolean).length;
|
|
201
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
202
|
+
asChild: true,
|
|
203
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
204
|
+
icon: /* @__PURE__ */ jsx(ColumnsIcon, {}),
|
|
205
|
+
iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
|
|
206
|
+
children: "Columns"
|
|
207
|
+
})
|
|
208
|
+
}), /* @__PURE__ */ jsxs(MenuContent, { children: [/* @__PURE__ */ jsxs(MenuLabel, { children: [
|
|
209
|
+
"Showing ",
|
|
210
|
+
count,
|
|
211
|
+
" of ",
|
|
212
|
+
COLUMNS.length
|
|
213
|
+
] }), COLUMNS.map((column) => /* @__PURE__ */ jsx(MenuCheckboxItem, {
|
|
214
|
+
checked: shown[column.id],
|
|
215
|
+
onCheckedChange: (checked) => setShown((s) => ({
|
|
216
|
+
...s,
|
|
217
|
+
[column.id]: checked
|
|
218
|
+
})),
|
|
219
|
+
onSelect: (event) => event.preventDefault(),
|
|
220
|
+
children: column.label
|
|
221
|
+
}, column.id))] })] });
|
|
222
|
+
}
|
|
223
|
+
var SORTS = [
|
|
224
|
+
{
|
|
225
|
+
value: "newest",
|
|
226
|
+
label: "Newest first"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
value: "oldest",
|
|
230
|
+
label: "Oldest first"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
value: "total-high",
|
|
234
|
+
label: "Highest total"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
value: "total-low",
|
|
238
|
+
label: "Lowest total"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
value: "customer",
|
|
242
|
+
label: "Customer name"
|
|
243
|
+
}
|
|
244
|
+
];
|
|
245
|
+
function SortMenu() {
|
|
246
|
+
const [sort, setSort] = useState("newest");
|
|
247
|
+
const label = SORTS.find((s) => s.value === sort)?.label;
|
|
248
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
249
|
+
asChild: true,
|
|
250
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
251
|
+
icon: /* @__PURE__ */ jsx(ArrowsDownUpIcon, {}),
|
|
252
|
+
iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
|
|
253
|
+
children: label
|
|
254
|
+
})
|
|
255
|
+
}), /* @__PURE__ */ jsx(MenuContent, { children: /* @__PURE__ */ jsx(MenuRadioGroup, {
|
|
256
|
+
label: "Sort orders by",
|
|
257
|
+
value: sort,
|
|
258
|
+
onValueChange: setSort,
|
|
259
|
+
children: SORTS.map((s) => /* @__PURE__ */ jsx(MenuRadioItem, {
|
|
260
|
+
value: s.value,
|
|
261
|
+
children: s.label
|
|
262
|
+
}, s.value))
|
|
263
|
+
}) })] });
|
|
264
|
+
}
|
|
265
|
+
function ViewMenu() {
|
|
266
|
+
const [sort, setSort] = useState("newest");
|
|
267
|
+
const [customer, setCustomer] = useState(true);
|
|
268
|
+
const [channel, setChannel] = useState(false);
|
|
269
|
+
const [total, setTotal] = useState(true);
|
|
270
|
+
const keepOpen = (event) => event.preventDefault();
|
|
271
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
272
|
+
asChild: true,
|
|
273
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
274
|
+
icon: /* @__PURE__ */ jsx(SlidersHorizontalIcon, {}),
|
|
275
|
+
children: "View"
|
|
276
|
+
})
|
|
277
|
+
}), /* @__PURE__ */ jsxs(MenuContent, { children: [
|
|
278
|
+
/* @__PURE__ */ jsxs(MenuRadioGroup, {
|
|
279
|
+
label: "Sort by",
|
|
280
|
+
value: sort,
|
|
281
|
+
onValueChange: setSort,
|
|
282
|
+
children: [
|
|
283
|
+
/* @__PURE__ */ jsx(MenuRadioItem, {
|
|
284
|
+
value: "newest",
|
|
285
|
+
onSelect: keepOpen,
|
|
286
|
+
children: "Newest first"
|
|
287
|
+
}),
|
|
288
|
+
/* @__PURE__ */ jsx(MenuRadioItem, {
|
|
289
|
+
value: "oldest",
|
|
290
|
+
onSelect: keepOpen,
|
|
291
|
+
children: "Oldest first"
|
|
292
|
+
}),
|
|
293
|
+
/* @__PURE__ */ jsx(MenuRadioItem, {
|
|
294
|
+
value: "total",
|
|
295
|
+
onSelect: keepOpen,
|
|
296
|
+
children: "Highest total"
|
|
297
|
+
})
|
|
298
|
+
]
|
|
299
|
+
}),
|
|
300
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
301
|
+
/* @__PURE__ */ jsxs(MenuGroup, {
|
|
302
|
+
label: "Show columns",
|
|
303
|
+
children: [
|
|
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
|
+
}
|
|
326
|
+
var APPEARANCE = {
|
|
327
|
+
light: "Light",
|
|
328
|
+
dark: "Dark",
|
|
329
|
+
system: "Match device"
|
|
330
|
+
};
|
|
331
|
+
function AccountMenu() {
|
|
332
|
+
const [appearance, setAppearance] = useState("system");
|
|
333
|
+
const [logOutOpen, setLogOutOpen] = useState(false);
|
|
334
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
335
|
+
asChild: true,
|
|
336
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
337
|
+
label: "Account",
|
|
338
|
+
children: /* @__PURE__ */ jsx(Avatar, { name: "Priya Shah" })
|
|
339
|
+
})
|
|
340
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
341
|
+
align: "end",
|
|
342
|
+
width: 264,
|
|
343
|
+
children: [
|
|
344
|
+
/* @__PURE__ */ jsxs(MenuHeader, { children: [/* @__PURE__ */ jsx(Avatar, {
|
|
345
|
+
name: "Priya Shah",
|
|
346
|
+
size: "lg"
|
|
347
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
348
|
+
className: "menu-person",
|
|
349
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
350
|
+
className: "menu-person__name",
|
|
351
|
+
children: "Priya Shah"
|
|
352
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
353
|
+
className: "menu-person__meta",
|
|
354
|
+
children: "priya@harbourdesk.co.uk"
|
|
355
|
+
})]
|
|
356
|
+
})] }),
|
|
357
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
358
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
359
|
+
icon: /* @__PURE__ */ jsx(UserIcon, {}),
|
|
360
|
+
children: "Your profile"
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
363
|
+
icon: /* @__PURE__ */ jsx(GearSixIcon, {}),
|
|
364
|
+
shortcut: ["mod", ","],
|
|
365
|
+
children: "Settings"
|
|
366
|
+
}),
|
|
367
|
+
/* @__PURE__ */ jsxs(MenuSub, { children: [/* @__PURE__ */ jsx(MenuSubTrigger, {
|
|
368
|
+
icon: /* @__PURE__ */ jsx(CircleHalfIcon, {}),
|
|
369
|
+
hint: APPEARANCE[appearance],
|
|
370
|
+
children: "Appearance"
|
|
371
|
+
}), /* @__PURE__ */ jsx(MenuSubContent, { children: /* @__PURE__ */ jsxs(MenuRadioGroup, {
|
|
372
|
+
value: appearance,
|
|
373
|
+
onValueChange: (v) => setAppearance(v),
|
|
374
|
+
children: [
|
|
375
|
+
/* @__PURE__ */ jsx(MenuRadioItem, {
|
|
376
|
+
value: "light",
|
|
377
|
+
icon: /* @__PURE__ */ jsx(SunIcon, {}),
|
|
378
|
+
children: "Light"
|
|
379
|
+
}),
|
|
380
|
+
/* @__PURE__ */ jsx(MenuRadioItem, {
|
|
381
|
+
value: "dark",
|
|
382
|
+
icon: /* @__PURE__ */ jsx(MoonIcon, {}),
|
|
383
|
+
children: "Dark"
|
|
384
|
+
}),
|
|
385
|
+
/* @__PURE__ */ jsx(MenuRadioItem, {
|
|
386
|
+
value: "system",
|
|
387
|
+
icon: /* @__PURE__ */ jsx(MonitorIcon, {}),
|
|
388
|
+
children: "Match device"
|
|
389
|
+
})
|
|
390
|
+
]
|
|
391
|
+
}) })] }),
|
|
392
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
393
|
+
icon: /* @__PURE__ */ jsx(KeyboardIcon, {}),
|
|
394
|
+
shortcut: ["?"],
|
|
395
|
+
children: "Keyboard shortcuts"
|
|
396
|
+
}),
|
|
397
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
398
|
+
asChild: true,
|
|
399
|
+
icon: /* @__PURE__ */ jsx(QuestionIcon, {}),
|
|
400
|
+
hint: /* @__PURE__ */ jsx(ArrowSquareOutIcon, {}),
|
|
401
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
402
|
+
href: helpUrl,
|
|
403
|
+
target: "_blank",
|
|
404
|
+
rel: "noreferrer",
|
|
405
|
+
children: "Help centre"
|
|
406
|
+
})
|
|
407
|
+
}),
|
|
408
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
409
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
410
|
+
icon: /* @__PURE__ */ jsx(SignOutIcon, {}),
|
|
411
|
+
tone: "critical",
|
|
412
|
+
onSelect: () => setLogOutOpen(true),
|
|
413
|
+
children: "Log out"
|
|
414
|
+
})
|
|
415
|
+
]
|
|
416
|
+
})] }), /* @__PURE__ */ jsx(ConfirmDialog, {
|
|
417
|
+
open: logOutOpen,
|
|
418
|
+
onOpenChange: setLogOutOpen,
|
|
419
|
+
tone: "critical",
|
|
420
|
+
title: "Log out of Orbit?",
|
|
421
|
+
description: "You will be signed out of Harbour Desk Co on this device.",
|
|
422
|
+
confirmLabel: "Log out",
|
|
423
|
+
onConfirm: () => wait(900)
|
|
424
|
+
})] });
|
|
425
|
+
}
|
|
426
|
+
function CustomerMenu() {
|
|
427
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
428
|
+
asChild: true,
|
|
429
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
430
|
+
label: "Actions for Eleanor Price",
|
|
431
|
+
variant: "secondary",
|
|
432
|
+
children: /* @__PURE__ */ jsx(DotsThreeIcon, { weight: "bold" })
|
|
433
|
+
})
|
|
434
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
435
|
+
align: "end",
|
|
436
|
+
width: 264,
|
|
437
|
+
children: [
|
|
438
|
+
/* @__PURE__ */ jsxs(MenuHeader, { children: [/* @__PURE__ */ jsx(Avatar, { name: "Eleanor Price" }), /* @__PURE__ */ jsxs("span", {
|
|
439
|
+
className: "menu-person",
|
|
440
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
441
|
+
className: "menu-person__name",
|
|
442
|
+
children: "Eleanor Price"
|
|
443
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
444
|
+
className: "menu-person__meta",
|
|
445
|
+
children: "4 orders · Edinburgh"
|
|
446
|
+
})]
|
|
447
|
+
})] }),
|
|
448
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
449
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
450
|
+
icon: /* @__PURE__ */ jsx(EnvelopeSimpleIcon, {}),
|
|
451
|
+
children: "Email customer"
|
|
452
|
+
}),
|
|
453
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
454
|
+
icon: /* @__PURE__ */ jsx(ReceiptIcon, {}),
|
|
455
|
+
hint: "4",
|
|
456
|
+
children: "View orders"
|
|
457
|
+
}),
|
|
458
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
459
|
+
icon: /* @__PURE__ */ jsx(PlusIcon, {}),
|
|
460
|
+
children: "Create order"
|
|
461
|
+
}),
|
|
462
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
463
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
464
|
+
icon: /* @__PURE__ */ jsx(TrashIcon, {}),
|
|
465
|
+
tone: "critical",
|
|
466
|
+
children: "Erase personal data"
|
|
467
|
+
})
|
|
468
|
+
]
|
|
469
|
+
})] });
|
|
470
|
+
}
|
|
471
|
+
function ShortRows() {
|
|
472
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
473
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
474
|
+
icon: /* @__PURE__ */ jsx(PencilSimpleIcon, {}),
|
|
475
|
+
children: "Rename"
|
|
476
|
+
}),
|
|
477
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
478
|
+
icon: /* @__PURE__ */ jsx(CopyIcon, {}),
|
|
479
|
+
children: "Duplicate"
|
|
480
|
+
}),
|
|
481
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
482
|
+
icon: /* @__PURE__ */ jsx(TrashIcon, {}),
|
|
483
|
+
tone: "critical",
|
|
484
|
+
children: "Delete"
|
|
485
|
+
})
|
|
486
|
+
] });
|
|
487
|
+
}
|
|
488
|
+
var RANGES = [
|
|
489
|
+
"Today",
|
|
490
|
+
"Yesterday",
|
|
491
|
+
"Last 7 days",
|
|
492
|
+
"Last 30 days",
|
|
493
|
+
"Last 12 months"
|
|
494
|
+
];
|
|
495
|
+
function RangeMenu() {
|
|
496
|
+
const [range, setRange] = useState("Last 30 days");
|
|
497
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
498
|
+
asChild: true,
|
|
499
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
500
|
+
className: "menu-range-trigger",
|
|
501
|
+
iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
|
|
502
|
+
children: range
|
|
503
|
+
})
|
|
504
|
+
}), /* @__PURE__ */ jsx(MenuContent, {
|
|
505
|
+
width: "trigger",
|
|
506
|
+
children: /* @__PURE__ */ jsx(MenuRadioGroup, {
|
|
507
|
+
value: range,
|
|
508
|
+
onValueChange: setRange,
|
|
509
|
+
children: RANGES.map((r) => /* @__PURE__ */ jsx(MenuRadioItem, {
|
|
510
|
+
value: r,
|
|
511
|
+
children: r
|
|
512
|
+
}, r))
|
|
513
|
+
})
|
|
514
|
+
})] });
|
|
515
|
+
}
|
|
516
|
+
function PlacementMenu({ label, align, side }) {
|
|
517
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
518
|
+
asChild: true,
|
|
519
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
520
|
+
iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
|
|
521
|
+
children: label
|
|
522
|
+
})
|
|
523
|
+
}), /* @__PURE__ */ jsx(MenuContent, {
|
|
524
|
+
align,
|
|
525
|
+
side,
|
|
526
|
+
children: /* @__PURE__ */ jsx(ShortRows, {})
|
|
527
|
+
})] });
|
|
528
|
+
}
|
|
529
|
+
function HeldOpen() {
|
|
530
|
+
return /* @__PURE__ */ jsxs(SpecimenFrame, {
|
|
531
|
+
className: "menu-stills",
|
|
532
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
533
|
+
className: "menu-still",
|
|
534
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
535
|
+
icon: /* @__PURE__ */ jsx(SlidersHorizontalIcon, {}),
|
|
536
|
+
"aria-haspopup": "menu",
|
|
537
|
+
"aria-expanded": "true",
|
|
538
|
+
children: "View"
|
|
539
|
+
}), /* @__PURE__ */ jsxs(MenuSheet, { children: [
|
|
540
|
+
/* @__PURE__ */ jsx(MenuHeading, { children: "Sort by" }),
|
|
541
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
542
|
+
kind: "radio",
|
|
543
|
+
checked: true,
|
|
544
|
+
children: "Newest first"
|
|
545
|
+
}),
|
|
546
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
547
|
+
kind: "radio",
|
|
548
|
+
children: "Oldest first"
|
|
549
|
+
}),
|
|
550
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
551
|
+
kind: "radio",
|
|
552
|
+
children: "Highest total"
|
|
553
|
+
}),
|
|
554
|
+
/* @__PURE__ */ jsx(MenuRule, {}),
|
|
555
|
+
/* @__PURE__ */ jsx(MenuHeading, { children: "Show columns" }),
|
|
556
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
557
|
+
kind: "checkbox",
|
|
558
|
+
checked: true,
|
|
559
|
+
highlighted: true,
|
|
560
|
+
children: "Customer"
|
|
561
|
+
}),
|
|
562
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
563
|
+
kind: "checkbox",
|
|
564
|
+
children: "Sales channel"
|
|
565
|
+
}),
|
|
566
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
567
|
+
kind: "checkbox",
|
|
568
|
+
checked: true,
|
|
569
|
+
children: "Total"
|
|
570
|
+
})
|
|
571
|
+
] })]
|
|
572
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
573
|
+
className: "menu-still",
|
|
574
|
+
"data-align": "end",
|
|
575
|
+
children: [/* @__PURE__ */ jsx(IconButton, {
|
|
576
|
+
label: "Account",
|
|
577
|
+
"aria-haspopup": "menu",
|
|
578
|
+
"aria-expanded": "true",
|
|
579
|
+
children: /* @__PURE__ */ jsx(Avatar, { name: "Priya Shah" })
|
|
580
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
581
|
+
className: "menu-still__with-sub",
|
|
582
|
+
children: [/* @__PURE__ */ jsxs(MenuSheet, {
|
|
583
|
+
sub: true,
|
|
584
|
+
children: [
|
|
585
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
586
|
+
icon: /* @__PURE__ */ jsx(SunIcon, {}),
|
|
587
|
+
kind: "radio",
|
|
588
|
+
children: "Light"
|
|
589
|
+
}),
|
|
590
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
591
|
+
icon: /* @__PURE__ */ jsx(MoonIcon, {}),
|
|
592
|
+
kind: "radio",
|
|
593
|
+
children: "Dark"
|
|
594
|
+
}),
|
|
595
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
596
|
+
icon: /* @__PURE__ */ jsx(MonitorIcon, {}),
|
|
597
|
+
kind: "radio",
|
|
598
|
+
checked: true,
|
|
599
|
+
highlighted: true,
|
|
600
|
+
children: "Match device"
|
|
601
|
+
})
|
|
602
|
+
]
|
|
603
|
+
}), /* @__PURE__ */ jsxs(MenuSheet, {
|
|
604
|
+
width: 264,
|
|
605
|
+
children: [
|
|
606
|
+
/* @__PURE__ */ jsxs("div", {
|
|
607
|
+
className: "o-menu__header",
|
|
608
|
+
children: [/* @__PURE__ */ jsx(Avatar, {
|
|
609
|
+
name: "Priya Shah",
|
|
610
|
+
size: "lg"
|
|
611
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
612
|
+
className: "menu-person",
|
|
613
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
614
|
+
className: "menu-person__name",
|
|
615
|
+
children: "Priya Shah"
|
|
616
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
617
|
+
className: "menu-person__meta",
|
|
618
|
+
children: "priya@harbourdesk.co.uk"
|
|
619
|
+
})]
|
|
620
|
+
})]
|
|
621
|
+
}),
|
|
622
|
+
/* @__PURE__ */ jsx(MenuRule, {}),
|
|
623
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
624
|
+
icon: /* @__PURE__ */ jsx(UserIcon, {}),
|
|
625
|
+
children: "Your profile"
|
|
626
|
+
}),
|
|
627
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
628
|
+
icon: /* @__PURE__ */ jsx(GearSixIcon, {}),
|
|
629
|
+
shortcut: ["mod", ","],
|
|
630
|
+
children: "Settings"
|
|
631
|
+
}),
|
|
632
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
633
|
+
icon: /* @__PURE__ */ jsx(CircleHalfIcon, {}),
|
|
634
|
+
hint: "Match device",
|
|
635
|
+
submenu: true,
|
|
636
|
+
open: true,
|
|
637
|
+
children: "Appearance"
|
|
638
|
+
}),
|
|
639
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
640
|
+
icon: /* @__PURE__ */ jsx(KeyboardIcon, {}),
|
|
641
|
+
shortcut: ["?"],
|
|
642
|
+
children: "Keyboard shortcuts"
|
|
643
|
+
}),
|
|
644
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
645
|
+
icon: /* @__PURE__ */ jsx(QuestionIcon, {}),
|
|
646
|
+
hint: /* @__PURE__ */ jsx(ArrowSquareOutIcon, {}),
|
|
647
|
+
children: "Help centre"
|
|
648
|
+
}),
|
|
649
|
+
/* @__PURE__ */ jsx(MenuRule, {}),
|
|
650
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
651
|
+
icon: /* @__PURE__ */ jsx(SignOutIcon, {}),
|
|
652
|
+
tone: "critical",
|
|
653
|
+
children: "Log out"
|
|
654
|
+
})
|
|
655
|
+
]
|
|
656
|
+
})]
|
|
657
|
+
})]
|
|
658
|
+
})]
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
function DoDontStill({ children }) {
|
|
662
|
+
return /* @__PURE__ */ jsx(SpecimenFrame, {
|
|
663
|
+
className: "menu-dodont-still",
|
|
664
|
+
children
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
var MODELS = [
|
|
668
|
+
{
|
|
669
|
+
id: "sonnet",
|
|
670
|
+
label: "Sonnet 4.5",
|
|
671
|
+
tagline: "Fast and capable, for most of your work",
|
|
672
|
+
isDefault: true
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
id: "opus",
|
|
676
|
+
label: "Opus 4.5",
|
|
677
|
+
tagline: "The most capable, for long and careful tasks"
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
id: "haiku",
|
|
681
|
+
label: "Haiku 4.5",
|
|
682
|
+
tagline: "The quickest, for short answers"
|
|
683
|
+
}
|
|
684
|
+
];
|
|
685
|
+
var EFFORTS = [
|
|
686
|
+
{
|
|
687
|
+
id: "low",
|
|
688
|
+
label: "Low",
|
|
689
|
+
tagline: "Answers straight away"
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
id: "medium",
|
|
693
|
+
label: "Medium",
|
|
694
|
+
tagline: "Thinks a little first",
|
|
695
|
+
isDefault: true
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
id: "high",
|
|
699
|
+
label: "High",
|
|
700
|
+
tagline: "Thinks it through"
|
|
701
|
+
}
|
|
702
|
+
];
|
|
703
|
+
function ModelPicker({ size = "sm" }) {
|
|
704
|
+
const [model, setModel] = useState("sonnet");
|
|
705
|
+
const chosen = MODELS.find((each) => each.id === model);
|
|
706
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuChipTrigger, {
|
|
707
|
+
label: "Model",
|
|
708
|
+
icon: /* @__PURE__ */ jsx(CpuIcon, {}),
|
|
709
|
+
size,
|
|
710
|
+
children: chosen.label
|
|
711
|
+
}), /* @__PURE__ */ jsx(MenuContent, {
|
|
712
|
+
align: "start",
|
|
713
|
+
side: "top",
|
|
714
|
+
width: 272,
|
|
715
|
+
children: /* @__PURE__ */ jsx(MenuRadioGroup, {
|
|
716
|
+
label: "Model",
|
|
717
|
+
value: model,
|
|
718
|
+
onValueChange: setModel,
|
|
719
|
+
children: MODELS.map((each) => /* @__PURE__ */ jsx(MenuRadioItem, {
|
|
720
|
+
value: each.id,
|
|
721
|
+
description: each.tagline,
|
|
722
|
+
isDefault: each.isDefault,
|
|
723
|
+
children: each.label
|
|
724
|
+
}, each.id))
|
|
725
|
+
})
|
|
726
|
+
})] });
|
|
727
|
+
}
|
|
728
|
+
function EffortPicker({ size = "sm" }) {
|
|
729
|
+
const [effort, setEffort] = useState("medium");
|
|
730
|
+
const chosen = EFFORTS.find((each) => each.id === effort);
|
|
731
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuChipTrigger, {
|
|
732
|
+
label: "Effort",
|
|
733
|
+
icon: /* @__PURE__ */ jsx(GaugeIcon, {}),
|
|
734
|
+
size,
|
|
735
|
+
children: chosen.label
|
|
736
|
+
}), /* @__PURE__ */ jsx(MenuContent, {
|
|
737
|
+
align: "start",
|
|
738
|
+
side: "top",
|
|
739
|
+
width: 248,
|
|
740
|
+
children: /* @__PURE__ */ jsx(MenuRadioGroup, {
|
|
741
|
+
label: "Effort",
|
|
742
|
+
value: effort,
|
|
743
|
+
onValueChange: setEffort,
|
|
744
|
+
children: EFFORTS.map((each) => /* @__PURE__ */ jsx(MenuRadioItem, {
|
|
745
|
+
value: each.id,
|
|
746
|
+
description: each.tagline,
|
|
747
|
+
isDefault: each.isDefault,
|
|
748
|
+
disabledReason: each.id === "high" ? "Not on Haiku" : void 0,
|
|
749
|
+
children: each.label
|
|
750
|
+
}, each.id))
|
|
751
|
+
})
|
|
752
|
+
})] });
|
|
753
|
+
}
|
|
754
|
+
function Composer$1() {
|
|
755
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
756
|
+
className: "menu-composer",
|
|
757
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
758
|
+
className: "menu-composer__field",
|
|
759
|
+
children: "Ask Nebula about your orders"
|
|
760
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
761
|
+
className: "menu-composer__tools",
|
|
762
|
+
children: [/* @__PURE__ */ jsx(ModelPicker, {}), /* @__PURE__ */ jsx(EffortPicker, {})]
|
|
763
|
+
})]
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
function AssistMenu() {
|
|
767
|
+
const [text, setText] = useState("");
|
|
768
|
+
const [running, setRunning] = useState(null);
|
|
769
|
+
const run = (what) => {
|
|
770
|
+
setRunning(what);
|
|
771
|
+
window.setTimeout(() => setRunning(null), 1600);
|
|
772
|
+
};
|
|
773
|
+
const reason = text.trim() ? void 0 : "Type something first";
|
|
774
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
775
|
+
className: "menu-assist",
|
|
776
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
777
|
+
className: "menu-assist__field",
|
|
778
|
+
"aria-label": "Reply",
|
|
779
|
+
placeholder: "Write a reply, or let AI draft one",
|
|
780
|
+
value: text,
|
|
781
|
+
onChange: (event) => setText(event.target.value)
|
|
782
|
+
}), /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
783
|
+
asChild: true,
|
|
784
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
785
|
+
label: running ? `${running}…` : "AI assist",
|
|
786
|
+
loading: running !== null,
|
|
787
|
+
children: /* @__PURE__ */ jsx(SparkleIcon, {})
|
|
788
|
+
})
|
|
789
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
790
|
+
align: "end",
|
|
791
|
+
side: "top",
|
|
792
|
+
width: 252,
|
|
793
|
+
children: [
|
|
794
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
795
|
+
icon: /* @__PURE__ */ jsx(MagicWandIcon, {}),
|
|
796
|
+
onSelect: () => run("Drafting"),
|
|
797
|
+
children: "Draft a reply"
|
|
798
|
+
}),
|
|
799
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
800
|
+
icon: /* @__PURE__ */ jsx(PenNibIcon, {}),
|
|
801
|
+
disabledReason: reason,
|
|
802
|
+
onSelect: () => run("Polishing"),
|
|
803
|
+
children: "Polish"
|
|
804
|
+
}),
|
|
805
|
+
/* @__PURE__ */ jsxs(MenuInlineSub, {
|
|
806
|
+
label: "Translate",
|
|
807
|
+
icon: /* @__PURE__ */ jsx(TranslateIcon, {}),
|
|
808
|
+
disabledReason: reason,
|
|
809
|
+
children: [
|
|
810
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
811
|
+
onSelect: () => run("Translating"),
|
|
812
|
+
children: "French"
|
|
813
|
+
}),
|
|
814
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
815
|
+
onSelect: () => run("Translating"),
|
|
816
|
+
children: "German"
|
|
817
|
+
}),
|
|
818
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
819
|
+
onSelect: () => run("Translating"),
|
|
820
|
+
children: "Spanish"
|
|
821
|
+
})
|
|
822
|
+
]
|
|
823
|
+
}),
|
|
824
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
825
|
+
icon: /* @__PURE__ */ jsx(FileTextIcon, {}),
|
|
826
|
+
onSelect: () => run("Summarising"),
|
|
827
|
+
children: "Summarise the chat"
|
|
828
|
+
})
|
|
829
|
+
]
|
|
830
|
+
})] })]
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
function ExportMenu() {
|
|
834
|
+
const [busy, setBusy] = useState(false);
|
|
835
|
+
const exportAs = () => {
|
|
836
|
+
setBusy(true);
|
|
837
|
+
window.setTimeout(() => setBusy(false), 2e3);
|
|
838
|
+
};
|
|
839
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
840
|
+
asChild: true,
|
|
841
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
842
|
+
icon: /* @__PURE__ */ jsx(DownloadSimpleIcon, {}),
|
|
843
|
+
loading: busy,
|
|
844
|
+
children: busy ? "Exporting" : "Export"
|
|
845
|
+
})
|
|
846
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
847
|
+
width: 300,
|
|
848
|
+
children: [
|
|
849
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
850
|
+
onSelect: exportAs,
|
|
851
|
+
description: "Every turn that matches the filters above",
|
|
852
|
+
children: "CSV"
|
|
853
|
+
}),
|
|
854
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
855
|
+
onSelect: exportAs,
|
|
856
|
+
description: "The turns that failed, timed out or were marked unhelpful, by store",
|
|
857
|
+
children: "Gaps report"
|
|
858
|
+
}),
|
|
859
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
860
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
861
|
+
asChild: true,
|
|
862
|
+
icon: /* @__PURE__ */ jsx(ArrowSquareOutIcon, {}),
|
|
863
|
+
description: "Kept for 30 days, in the help centre",
|
|
864
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
865
|
+
href: helpUrl,
|
|
866
|
+
target: "_blank",
|
|
867
|
+
rel: "noreferrer",
|
|
868
|
+
children: "Past exports"
|
|
869
|
+
})
|
|
870
|
+
})
|
|
871
|
+
]
|
|
872
|
+
})] });
|
|
873
|
+
}
|
|
874
|
+
function Page() {
|
|
875
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
876
|
+
title: "Menu",
|
|
877
|
+
status: "stable",
|
|
878
|
+
importNames: [
|
|
879
|
+
"Menu",
|
|
880
|
+
"MenuTrigger",
|
|
881
|
+
"MenuContent",
|
|
882
|
+
"MenuItem"
|
|
883
|
+
],
|
|
884
|
+
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.",
|
|
885
|
+
children: [
|
|
886
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
887
|
+
id: "basics",
|
|
888
|
+
title: "Basics",
|
|
889
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
890
|
+
"A menu is a trigger and a sheet of rows. Wrap a ",
|
|
891
|
+
/* @__PURE__ */ jsx("code", { children: "Button" }),
|
|
892
|
+
" or ",
|
|
893
|
+
/* @__PURE__ */ jsx("code", { children: "IconButton" }),
|
|
894
|
+
" in",
|
|
895
|
+
" ",
|
|
896
|
+
/* @__PURE__ */ jsx("code", { children: "MenuTrigger asChild" }),
|
|
897
|
+
", and give each row an ",
|
|
898
|
+
/* @__PURE__ */ jsx("code", { children: "onSelect" }),
|
|
899
|
+
": 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."
|
|
900
|
+
] }),
|
|
901
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
902
|
+
align: "fill",
|
|
903
|
+
minHeight: 300,
|
|
904
|
+
code: `
|
|
905
|
+
const [cancelOpen, setCancelOpen] = useState(false)
|
|
906
|
+
|
|
907
|
+
<Menu>
|
|
908
|
+
<MenuTrigger asChild>
|
|
909
|
+
<IconButton label="Actions for order #1043">
|
|
910
|
+
<DotsThreeIcon weight="bold" />
|
|
911
|
+
</IconButton>
|
|
912
|
+
</MenuTrigger>
|
|
913
|
+
<MenuContent align="end">
|
|
914
|
+
<MenuItem icon={<EyeIcon />}>View order</MenuItem>
|
|
915
|
+
<MenuItem icon={<PrinterIcon />} shortcut={['mod', 'P']}>Print packing slip</MenuItem>
|
|
916
|
+
<MenuItem icon={<TruckIcon />}>Mark as fulfilled</MenuItem>
|
|
917
|
+
<MenuItem icon={<FilePdfIcon />} hint="PDF">Download invoice</MenuItem>
|
|
918
|
+
<MenuSeparator />
|
|
919
|
+
<MenuItem icon={<ArrowCounterClockwiseIcon />}>Refund</MenuItem>
|
|
920
|
+
<MenuItem icon={<XCircleIcon />} tone="critical" onSelect={() => setCancelOpen(true)}>
|
|
921
|
+
Cancel order
|
|
922
|
+
</MenuItem>
|
|
923
|
+
</MenuContent>
|
|
924
|
+
</Menu>
|
|
925
|
+
|
|
926
|
+
<ConfirmDialog
|
|
927
|
+
open={cancelOpen}
|
|
928
|
+
onOpenChange={setCancelOpen}
|
|
929
|
+
tone="critical"
|
|
930
|
+
title="Cancel order #1043?"
|
|
931
|
+
description="Sarah Whitfield gets £240.00 back on her card and an email to say so. The stock goes back on sale."
|
|
932
|
+
confirmLabel="Cancel order"
|
|
933
|
+
cancelLabel="Keep order"
|
|
934
|
+
onConfirm={cancelOrder}
|
|
935
|
+
/>`,
|
|
936
|
+
children: /* @__PURE__ */ jsx(OrderRowActions, {})
|
|
937
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
938
|
+
title: "Opening a dialog from a row",
|
|
939
|
+
children: [
|
|
940
|
+
"Set the dialog's ",
|
|
941
|
+
/* @__PURE__ */ jsx("code", { children: "open" }),
|
|
942
|
+
" from the row's ",
|
|
943
|
+
/* @__PURE__ */ jsx("code", { children: "onSelect" }),
|
|
944
|
+
", as here. The dialog waits for the menu to finish closing and, when it closes, hands focus back to this menu's button: no ref and no",
|
|
945
|
+
" ",
|
|
946
|
+
/* @__PURE__ */ jsx("code", { children: "onCloseAutoFocus" }),
|
|
947
|
+
" to wire. A row that starts something else which needs focus straight away, an inline field or a panel from another library, takes ",
|
|
948
|
+
/* @__PURE__ */ jsx("code", { children: "afterClose" }),
|
|
949
|
+
" instead of doing the work in",
|
|
950
|
+
" ",
|
|
951
|
+
/* @__PURE__ */ jsx("code", { children: "onSelect" }),
|
|
952
|
+
". It runs a moment after the click, so for something a browser only allows inside a click, such as opening a file chooser, test it in the browsers you support. See ",
|
|
953
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
954
|
+
to: "/components/dialog#from-a-menu",
|
|
955
|
+
children: "Dialog"
|
|
956
|
+
}),
|
|
957
|
+
"."
|
|
958
|
+
]
|
|
959
|
+
})]
|
|
960
|
+
}),
|
|
961
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
962
|
+
id: "both-themes",
|
|
963
|
+
title: "In both themes",
|
|
964
|
+
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." }),
|
|
965
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
966
|
+
className: "overlays-stack",
|
|
967
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
968
|
+
align: "fill",
|
|
969
|
+
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.",
|
|
970
|
+
children: /* @__PURE__ */ jsx(HeldOpen, {})
|
|
971
|
+
})
|
|
972
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
973
|
+
title: "Open them for real",
|
|
974
|
+
description: /* @__PURE__ */ jsx("p", { children: "Each trigger opens its menu in the theme of its own side." }),
|
|
975
|
+
children: /* @__PURE__ */ jsxs(ThemePair, {
|
|
976
|
+
minHeight: 180,
|
|
977
|
+
children: [
|
|
978
|
+
/* @__PURE__ */ jsx(OrderActionsMenu, {}),
|
|
979
|
+
/* @__PURE__ */ jsx(SortMenu, {}),
|
|
980
|
+
/* @__PURE__ */ jsx(AccountMenu, {})
|
|
981
|
+
]
|
|
982
|
+
})
|
|
983
|
+
})]
|
|
984
|
+
}),
|
|
985
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
986
|
+
id: "rows",
|
|
987
|
+
title: "Rows",
|
|
988
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
989
|
+
"Every action is a ",
|
|
990
|
+
/* @__PURE__ */ jsx("code", { children: "MenuItem" }),
|
|
991
|
+
". Its ",
|
|
992
|
+
/* @__PURE__ */ jsx("code", { children: "icon" }),
|
|
993
|
+
" is 16px and stays muted until the row is highlighted. ",
|
|
994
|
+
/* @__PURE__ */ jsx("code", { children: "hint" }),
|
|
995
|
+
" is a quiet detail at the end, such as a file format or, for people who can see it, why a row is off.",
|
|
996
|
+
" ",
|
|
997
|
+
/* @__PURE__ */ jsx("code", { children: "shortcut" }),
|
|
998
|
+
" draws keycaps that read right on every platform (",
|
|
999
|
+
/* @__PURE__ */ jsx("code", { children: "mod" }),
|
|
1000
|
+
" is ⌘ on a Mac and Ctrl elsewhere); it only draws them, so bind the keys in the app."
|
|
1001
|
+
] }),
|
|
1002
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
1003
|
+
align: "fill",
|
|
1004
|
+
minHeight: 380,
|
|
1005
|
+
code: `
|
|
1006
|
+
<Menu>
|
|
1007
|
+
<MenuTrigger asChild>
|
|
1008
|
+
<Button iconEnd={<CaretDownIcon />}>More actions</Button>
|
|
1009
|
+
</MenuTrigger>
|
|
1010
|
+
<MenuContent>
|
|
1011
|
+
<MenuItem icon={<PencilSimpleIcon />} shortcut={['E']}>Edit product</MenuItem>
|
|
1012
|
+
<MenuItem icon={<CopyIcon />} shortcut={['mod', 'D']}>Duplicate</MenuItem>
|
|
1013
|
+
<MenuItem icon={<DownloadSimpleIcon />} hint="CSV">Export</MenuItem>
|
|
1014
|
+
<MenuItem icon={<BarcodeIcon />} hint="Add a SKU first" disabled>Print barcodes</MenuItem>
|
|
1015
|
+
<MenuItem asChild icon={<StorefrontIcon />} hint={<ArrowSquareOutIcon />}>
|
|
1016
|
+
<a href={storeUrl} target="_blank" rel="noreferrer">View on your store</a>
|
|
1017
|
+
</MenuItem>
|
|
1018
|
+
<MenuSeparator />
|
|
1019
|
+
<MenuItem icon={<ArchiveIcon />}>Archive</MenuItem>
|
|
1020
|
+
<MenuItem icon={<TrashIcon />} tone="critical">Delete product</MenuItem>
|
|
1021
|
+
</MenuContent>
|
|
1022
|
+
</Menu>`,
|
|
1023
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1024
|
+
className: "overlays-top",
|
|
1025
|
+
children: /* @__PURE__ */ jsx(ProductActions, {})
|
|
1026
|
+
})
|
|
1027
|
+
}), /* @__PURE__ */ jsx(DocTable, {
|
|
1028
|
+
columns: ["Row", "How"],
|
|
1029
|
+
rows: [
|
|
1030
|
+
["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."] })],
|
|
1031
|
+
["Disabled", /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1032
|
+
/* @__PURE__ */ jsx("code", { children: "disabled" }),
|
|
1033
|
+
" dims the row's words, icon and keycaps and keeps its ",
|
|
1034
|
+
/* @__PURE__ */ jsx("code", { children: "hint" }),
|
|
1035
|
+
" clear, so say why there. The hint is for people who can see it: the arrow keys pass over the row, so a keyboard or screen reader user never meets it. For a row people must understand, give a",
|
|
1036
|
+
" ",
|
|
1037
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
1038
|
+
to: "/components/menu#disabled-reason",
|
|
1039
|
+
children: "disabledReason"
|
|
1040
|
+
}),
|
|
1041
|
+
" instead."
|
|
1042
|
+
] })],
|
|
1043
|
+
["Link", /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1044
|
+
/* @__PURE__ */ jsx("code", { children: "asChild" }),
|
|
1045
|
+
" renders your link as the row (a router ",
|
|
1046
|
+
/* @__PURE__ */ jsx("code", { children: "Link" }),
|
|
1047
|
+
" or an ",
|
|
1048
|
+
/* @__PURE__ */ jsx("code", { children: "a" }),
|
|
1049
|
+
"), so it keeps link behaviour such as opening in a new tab. A trailing arrow-out hint means it leaves Orbit."
|
|
1050
|
+
] })],
|
|
1051
|
+
["Keep open", /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1052
|
+
"Call ",
|
|
1053
|
+
/* @__PURE__ */ jsx("code", { children: "event.preventDefault()" }),
|
|
1054
|
+
" in ",
|
|
1055
|
+
/* @__PURE__ */ jsx("code", { children: "onSelect" }),
|
|
1056
|
+
" and the menu stays open after the row runs."
|
|
1057
|
+
] })]
|
|
1058
|
+
]
|
|
1059
|
+
})]
|
|
1060
|
+
}),
|
|
1061
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1062
|
+
id: "checkbox-items",
|
|
1063
|
+
title: "Checkbox items",
|
|
1064
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1065
|
+
/* @__PURE__ */ jsx("code", { children: "MenuCheckboxItem" }),
|
|
1066
|
+
" 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",
|
|
1067
|
+
" ",
|
|
1068
|
+
/* @__PURE__ */ jsxs("code", { children: ["onSelect=", "{(event) => event.preventDefault()}"] }),
|
|
1069
|
+
"."
|
|
1070
|
+
] }),
|
|
1071
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
1072
|
+
align: "fill",
|
|
1073
|
+
minHeight: 360,
|
|
1074
|
+
code: `
|
|
1075
|
+
const [shown, setShown] = useState({ customer: true, channel: false, payment: true, ... })
|
|
1076
|
+
|
|
1077
|
+
<Menu>
|
|
1078
|
+
<MenuTrigger asChild>
|
|
1079
|
+
<Button icon={<ColumnsIcon />} iconEnd={<CaretDownIcon />}>Columns</Button>
|
|
1080
|
+
</MenuTrigger>
|
|
1081
|
+
<MenuContent>
|
|
1082
|
+
<MenuLabel>Showing {count} of 6</MenuLabel>
|
|
1083
|
+
{COLUMNS.map((column) => (
|
|
1084
|
+
<MenuCheckboxItem
|
|
1085
|
+
key={column.id}
|
|
1086
|
+
checked={shown[column.id]}
|
|
1087
|
+
onCheckedChange={(checked) => setShown((s) => ({ ...s, [column.id]: checked }))}
|
|
1088
|
+
onSelect={(event) => event.preventDefault()}
|
|
1089
|
+
>
|
|
1090
|
+
{column.label}
|
|
1091
|
+
</MenuCheckboxItem>
|
|
1092
|
+
))}
|
|
1093
|
+
</MenuContent>
|
|
1094
|
+
</Menu>`,
|
|
1095
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1096
|
+
className: "overlays-top",
|
|
1097
|
+
children: /* @__PURE__ */ jsx(ColumnsMenu, {})
|
|
1098
|
+
})
|
|
1099
|
+
})
|
|
1100
|
+
}),
|
|
1101
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1102
|
+
id: "radio-groups",
|
|
1103
|
+
title: "Radio groups",
|
|
1104
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1105
|
+
"One choice from a few. ",
|
|
1106
|
+
/* @__PURE__ */ jsx("code", { children: "MenuRadioGroup" }),
|
|
1107
|
+
" holds the value; each ",
|
|
1108
|
+
/* @__PURE__ */ jsx("code", { children: "MenuRadioItem" }),
|
|
1109
|
+
" 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."
|
|
1110
|
+
] }),
|
|
1111
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
1112
|
+
align: "fill",
|
|
1113
|
+
minHeight: 330,
|
|
1114
|
+
code: `
|
|
1115
|
+
const [sort, setSort] = useState('newest')
|
|
1116
|
+
|
|
1117
|
+
<Menu>
|
|
1118
|
+
<MenuTrigger asChild>
|
|
1119
|
+
<Button icon={<ArrowsDownUpIcon />} iconEnd={<CaretDownIcon />}>{label}</Button>
|
|
1120
|
+
</MenuTrigger>
|
|
1121
|
+
<MenuContent>
|
|
1122
|
+
<MenuRadioGroup label="Sort orders by" value={sort} onValueChange={setSort}>
|
|
1123
|
+
<MenuRadioItem value="newest">Newest first</MenuRadioItem>
|
|
1124
|
+
<MenuRadioItem value="oldest">Oldest first</MenuRadioItem>
|
|
1125
|
+
<MenuRadioItem value="total-high">Highest total</MenuRadioItem>
|
|
1126
|
+
<MenuRadioItem value="total-low">Lowest total</MenuRadioItem>
|
|
1127
|
+
<MenuRadioItem value="customer">Customer name</MenuRadioItem>
|
|
1128
|
+
</MenuRadioGroup>
|
|
1129
|
+
</MenuContent>
|
|
1130
|
+
</Menu>`,
|
|
1131
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1132
|
+
className: "overlays-top",
|
|
1133
|
+
children: /* @__PURE__ */ jsx(SortMenu, {})
|
|
1134
|
+
})
|
|
1135
|
+
})
|
|
1136
|
+
}),
|
|
1137
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1138
|
+
id: "structure",
|
|
1139
|
+
title: "Labels, groups and separators",
|
|
1140
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1141
|
+
/* @__PURE__ */ jsx("code", { children: "MenuLabel" }),
|
|
1142
|
+
" is a quiet heading for the rows under it, in sentence case.",
|
|
1143
|
+
" ",
|
|
1144
|
+
/* @__PURE__ */ jsx("code", { children: "MenuSeparator" }),
|
|
1145
|
+
" is a hairline between groups. ",
|
|
1146
|
+
/* @__PURE__ */ jsx("code", { children: "MenuGroup" }),
|
|
1147
|
+
" ties rows together for assistive tech and has no look of its own. Give a group, or a ",
|
|
1148
|
+
/* @__PURE__ */ jsx("code", { children: "MenuRadioGroup" }),
|
|
1149
|
+
", a",
|
|
1150
|
+
" ",
|
|
1151
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
1152
|
+
" and it draws that heading and is named by it, so a screen reader reads \"Sort by\" with its rows; a ",
|
|
1153
|
+
/* @__PURE__ */ jsx("code", { children: "MenuLabel" }),
|
|
1154
|
+
" on its own is only seen. A view menu for the orders list mixes a radio group and checkboxes, and stays open while you change it."
|
|
1155
|
+
] }),
|
|
1156
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
1157
|
+
align: "fill",
|
|
1158
|
+
minHeight: 400,
|
|
1159
|
+
code: `
|
|
1160
|
+
const keepOpen = (event: Event) => event.preventDefault()
|
|
1161
|
+
|
|
1162
|
+
<Menu>
|
|
1163
|
+
<MenuTrigger asChild>
|
|
1164
|
+
<Button icon={<SlidersHorizontalIcon />}>View</Button>
|
|
1165
|
+
</MenuTrigger>
|
|
1166
|
+
<MenuContent>
|
|
1167
|
+
<MenuRadioGroup label="Sort by" value={sort} onValueChange={setSort}>
|
|
1168
|
+
<MenuRadioItem value="newest" onSelect={keepOpen}>Newest first</MenuRadioItem>
|
|
1169
|
+
<MenuRadioItem value="oldest" onSelect={keepOpen}>Oldest first</MenuRadioItem>
|
|
1170
|
+
<MenuRadioItem value="total" onSelect={keepOpen}>Highest total</MenuRadioItem>
|
|
1171
|
+
</MenuRadioGroup>
|
|
1172
|
+
<MenuSeparator />
|
|
1173
|
+
<MenuGroup label="Show columns">
|
|
1174
|
+
<MenuCheckboxItem checked={customer} onCheckedChange={setCustomer} onSelect={keepOpen}>
|
|
1175
|
+
Customer
|
|
1176
|
+
</MenuCheckboxItem>
|
|
1177
|
+
<MenuCheckboxItem checked={channel} onCheckedChange={setChannel} onSelect={keepOpen}>
|
|
1178
|
+
Sales channel
|
|
1179
|
+
</MenuCheckboxItem>
|
|
1180
|
+
<MenuCheckboxItem checked={total} onCheckedChange={setTotal} onSelect={keepOpen}>
|
|
1181
|
+
Total
|
|
1182
|
+
</MenuCheckboxItem>
|
|
1183
|
+
</MenuGroup>
|
|
1184
|
+
</MenuContent>
|
|
1185
|
+
</Menu>`,
|
|
1186
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1187
|
+
className: "overlays-top",
|
|
1188
|
+
children: /* @__PURE__ */ jsx(ViewMenu, {})
|
|
1189
|
+
})
|
|
1190
|
+
})
|
|
1191
|
+
}),
|
|
1192
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1193
|
+
id: "submenus",
|
|
1194
|
+
title: "Submenus",
|
|
1195
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1196
|
+
"A ",
|
|
1197
|
+
/* @__PURE__ */ jsx("code", { children: "MenuSub" }),
|
|
1198
|
+
" holds a ",
|
|
1199
|
+
/* @__PURE__ */ jsx("code", { children: "MenuSubTrigger" }),
|
|
1200
|
+
" and a ",
|
|
1201
|
+
/* @__PURE__ */ jsx("code", { children: "MenuSubContent" }),
|
|
1202
|
+
". 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 ",
|
|
1203
|
+
/* @__PURE__ */ jsx("code", { children: "hint" }),
|
|
1204
|
+
". Here, the account menu from the header."
|
|
1205
|
+
] }),
|
|
1206
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
1207
|
+
align: "fill",
|
|
1208
|
+
minHeight: 420,
|
|
1209
|
+
code: `
|
|
1210
|
+
const [appearance, setAppearance] = useState('system')
|
|
1211
|
+
|
|
1212
|
+
<Menu>
|
|
1213
|
+
<MenuTrigger asChild>
|
|
1214
|
+
<IconButton label="Account">
|
|
1215
|
+
<Avatar name="Priya Shah" />
|
|
1216
|
+
</IconButton>
|
|
1217
|
+
</MenuTrigger>
|
|
1218
|
+
<MenuContent align="end" width={264}>
|
|
1219
|
+
<MenuHeader>
|
|
1220
|
+
<Avatar name="Priya Shah" size="lg" />
|
|
1221
|
+
<span>Priya Shah<br />priya@harbourdesk.co.uk</span>
|
|
1222
|
+
</MenuHeader>
|
|
1223
|
+
<MenuSeparator />
|
|
1224
|
+
<MenuItem icon={<UserIcon />}>Your profile</MenuItem>
|
|
1225
|
+
<MenuItem icon={<GearSixIcon />} shortcut={['mod', ',']}>Settings</MenuItem>
|
|
1226
|
+
<MenuSub>
|
|
1227
|
+
<MenuSubTrigger icon={<CircleHalfIcon />} hint={APPEARANCE[appearance]}>
|
|
1228
|
+
Appearance
|
|
1229
|
+
</MenuSubTrigger>
|
|
1230
|
+
<MenuSubContent>
|
|
1231
|
+
<MenuRadioGroup value={appearance} onValueChange={setAppearance}>
|
|
1232
|
+
<MenuRadioItem value="light" icon={<SunIcon />}>Light</MenuRadioItem>
|
|
1233
|
+
<MenuRadioItem value="dark" icon={<MoonIcon />}>Dark</MenuRadioItem>
|
|
1234
|
+
<MenuRadioItem value="system" icon={<MonitorIcon />}>Match device</MenuRadioItem>
|
|
1235
|
+
</MenuRadioGroup>
|
|
1236
|
+
</MenuSubContent>
|
|
1237
|
+
</MenuSub>
|
|
1238
|
+
<MenuItem icon={<KeyboardIcon />} shortcut={['?']}>Keyboard shortcuts</MenuItem>
|
|
1239
|
+
<MenuItem asChild icon={<QuestionIcon />} hint={<ArrowSquareOutIcon />}>
|
|
1240
|
+
<a href={helpUrl} target="_blank" rel="noreferrer">Help centre</a>
|
|
1241
|
+
</MenuItem>
|
|
1242
|
+
<MenuSeparator />
|
|
1243
|
+
<MenuItem icon={<SignOutIcon />} tone="critical" onSelect={() => setLogOutOpen(true)}>
|
|
1244
|
+
Log out
|
|
1245
|
+
</MenuItem>
|
|
1246
|
+
</MenuContent>
|
|
1247
|
+
</Menu>`,
|
|
1248
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1249
|
+
className: "overlays-top",
|
|
1250
|
+
children: /* @__PURE__ */ jsx(AccountMenu, {})
|
|
1251
|
+
})
|
|
1252
|
+
})
|
|
1253
|
+
}),
|
|
1254
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1255
|
+
id: "header",
|
|
1256
|
+
title: "Header",
|
|
1257
|
+
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."] }),
|
|
1258
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
1259
|
+
align: "fill",
|
|
1260
|
+
minHeight: 340,
|
|
1261
|
+
code: `
|
|
1262
|
+
<Menu>
|
|
1263
|
+
<MenuTrigger asChild>
|
|
1264
|
+
<IconButton label="Actions for Eleanor Price" variant="secondary">
|
|
1265
|
+
<DotsThreeIcon weight="bold" />
|
|
1266
|
+
</IconButton>
|
|
1267
|
+
</MenuTrigger>
|
|
1268
|
+
<MenuContent align="end" width={264}>
|
|
1269
|
+
<MenuHeader>
|
|
1270
|
+
<Avatar name="Eleanor Price" />
|
|
1271
|
+
<span>Eleanor Price<br />4 orders · Edinburgh</span>
|
|
1272
|
+
</MenuHeader>
|
|
1273
|
+
<MenuSeparator />
|
|
1274
|
+
<MenuItem icon={<EnvelopeSimpleIcon />}>Email customer</MenuItem>
|
|
1275
|
+
<MenuItem icon={<ReceiptIcon />} hint="4">View orders</MenuItem>
|
|
1276
|
+
<MenuItem icon={<PlusIcon />}>Create order</MenuItem>
|
|
1277
|
+
<MenuSeparator />
|
|
1278
|
+
<MenuItem icon={<TrashIcon />} tone="critical">Erase personal data</MenuItem>
|
|
1279
|
+
</MenuContent>
|
|
1280
|
+
</Menu>`,
|
|
1281
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1282
|
+
className: "overlays-top",
|
|
1283
|
+
children: /* @__PURE__ */ jsx(CustomerMenu, {})
|
|
1284
|
+
})
|
|
1285
|
+
})
|
|
1286
|
+
}),
|
|
1287
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1288
|
+
id: "width",
|
|
1289
|
+
title: "Width",
|
|
1290
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1291
|
+
"By default the sheet fits its rows, and is never narrower than 220px. Pass ",
|
|
1292
|
+
/* @__PURE__ */ jsx("code", { children: "width" }),
|
|
1293
|
+
" in pixels (or any CSS length) to fix it, or ",
|
|
1294
|
+
/* @__PURE__ */ jsx("code", { children: "'trigger'" }),
|
|
1295
|
+
" 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."
|
|
1296
|
+
] }),
|
|
1297
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
1298
|
+
align: "fill",
|
|
1299
|
+
minHeight: 300,
|
|
1300
|
+
code: `
|
|
1301
|
+
<MenuContent>…</MenuContent> {/* fits its rows, 220px at least */}
|
|
1302
|
+
<MenuContent width={300}>…</MenuContent> {/* fixed */}
|
|
1303
|
+
<MenuContent width="trigger">…</MenuContent> {/* as wide as its trigger */}`,
|
|
1304
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1305
|
+
className: "overlays-top",
|
|
1306
|
+
children: [
|
|
1307
|
+
/* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
1308
|
+
asChild: true,
|
|
1309
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
1310
|
+
iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
|
|
1311
|
+
children: "Fits its rows"
|
|
1312
|
+
})
|
|
1313
|
+
}), /* @__PURE__ */ jsx(MenuContent, { children: /* @__PURE__ */ jsx(ShortRows, {}) })] }),
|
|
1314
|
+
/* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
1315
|
+
asChild: true,
|
|
1316
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
1317
|
+
iconEnd: /* @__PURE__ */ jsx(CaretDownIcon, {}),
|
|
1318
|
+
children: "300px"
|
|
1319
|
+
})
|
|
1320
|
+
}), /* @__PURE__ */ jsx(MenuContent, {
|
|
1321
|
+
width: 300,
|
|
1322
|
+
children: /* @__PURE__ */ jsx(ShortRows, {})
|
|
1323
|
+
})] }),
|
|
1324
|
+
/* @__PURE__ */ jsx(RangeMenu, {})
|
|
1325
|
+
]
|
|
1326
|
+
})
|
|
1327
|
+
})
|
|
1328
|
+
}),
|
|
1329
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1330
|
+
id: "placement",
|
|
1331
|
+
title: "Alignment and side",
|
|
1332
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1333
|
+
"The sheet opens below its trigger (",
|
|
1334
|
+
/* @__PURE__ */ jsx("code", { children: "side=\"bottom\"" }),
|
|
1335
|
+
"), 6px away, lined up with the trigger's start edge (",
|
|
1336
|
+
/* @__PURE__ */ jsx("code", { children: "align=\"start\"" }),
|
|
1337
|
+
"). Use ",
|
|
1338
|
+
/* @__PURE__ */ jsx("code", { children: "align=\"end\"" }),
|
|
1339
|
+
" 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."
|
|
1340
|
+
] }),
|
|
1341
|
+
children: /* @__PURE__ */ jsxs(Example, {
|
|
1342
|
+
minHeight: 380,
|
|
1343
|
+
code: `
|
|
1344
|
+
<MenuContent>…</MenuContent> {/* align="start", side="bottom" */}
|
|
1345
|
+
<MenuContent align="center">…</MenuContent>
|
|
1346
|
+
<MenuContent align="end">…</MenuContent>
|
|
1347
|
+
<MenuContent side="top">…</MenuContent>`,
|
|
1348
|
+
children: [
|
|
1349
|
+
/* @__PURE__ */ jsx(PlacementMenu, { label: "Start" }),
|
|
1350
|
+
/* @__PURE__ */ jsx(PlacementMenu, {
|
|
1351
|
+
label: "Centre",
|
|
1352
|
+
align: "center"
|
|
1353
|
+
}),
|
|
1354
|
+
/* @__PURE__ */ jsx(PlacementMenu, {
|
|
1355
|
+
label: "End",
|
|
1356
|
+
align: "end"
|
|
1357
|
+
}),
|
|
1358
|
+
/* @__PURE__ */ jsx(PlacementMenu, {
|
|
1359
|
+
label: "Above",
|
|
1360
|
+
side: "top"
|
|
1361
|
+
})
|
|
1362
|
+
]
|
|
1363
|
+
})
|
|
1364
|
+
}),
|
|
1365
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1366
|
+
id: "second-lines",
|
|
1367
|
+
title: "Second lines and the default",
|
|
1368
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1369
|
+
/* @__PURE__ */ jsx("code", { children: "description" }),
|
|
1370
|
+
" puts a quiet line under a row's label, on ",
|
|
1371
|
+
/* @__PURE__ */ jsx("code", { children: "MenuItem" }),
|
|
1372
|
+
",",
|
|
1373
|
+
" ",
|
|
1374
|
+
/* @__PURE__ */ jsx("code", { children: "MenuRadioItem" }),
|
|
1375
|
+
" and ",
|
|
1376
|
+
/* @__PURE__ */ jsx("code", { children: "MenuCheckboxItem" }),
|
|
1377
|
+
": what a choice does, a tagline. It wraps, the row lines its icon and its mark up with the first line, and a screen reader reads it as the row's description, after its name. ",
|
|
1378
|
+
/* @__PURE__ */ jsx("code", { children: "isDefault" }),
|
|
1379
|
+
" marks the choice the app falls back to with a quiet “Default” after the label (",
|
|
1380
|
+
/* @__PURE__ */ jsx("code", { children: "defaultLabel" }),
|
|
1381
|
+
" for other words). Here, a chat's model and effort pickers."
|
|
1382
|
+
] }),
|
|
1383
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
1384
|
+
align: "fill",
|
|
1385
|
+
minHeight: 320,
|
|
1386
|
+
code: `
|
|
1387
|
+
<Menu>
|
|
1388
|
+
<MenuChipTrigger label="Model" icon={<CpuIcon />}>{chosen.label}</MenuChipTrigger>
|
|
1389
|
+
<MenuContent side="top" width={272}>
|
|
1390
|
+
<MenuRadioGroup label="Model" value={model} onValueChange={setModel}>
|
|
1391
|
+
<MenuRadioItem value="sonnet" description="Fast and capable, for most of your work" isDefault>
|
|
1392
|
+
Sonnet 4.5
|
|
1393
|
+
</MenuRadioItem>
|
|
1394
|
+
<MenuRadioItem value="opus" description="The most capable, for long and careful tasks">
|
|
1395
|
+
Opus 4.5
|
|
1396
|
+
</MenuRadioItem>
|
|
1397
|
+
<MenuRadioItem value="haiku" description="The quickest, for short answers">Haiku 4.5</MenuRadioItem>
|
|
1398
|
+
</MenuRadioGroup>
|
|
1399
|
+
</MenuContent>
|
|
1400
|
+
</Menu>`,
|
|
1401
|
+
children: /* @__PURE__ */ jsx(Composer$1, {})
|
|
1402
|
+
})
|
|
1403
|
+
}),
|
|
1404
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1405
|
+
id: "disabled-reason",
|
|
1406
|
+
title: "A row that says why it is off",
|
|
1407
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1408
|
+
/* @__PURE__ */ jsx("code", { children: "disabledReason" }),
|
|
1409
|
+
" turns a row off and puts the reason on its second line. Unlike",
|
|
1410
|
+
" ",
|
|
1411
|
+
/* @__PURE__ */ jsx("code", { children: "disabled" }),
|
|
1412
|
+
", the row stays in reach of the arrow keys (it is ",
|
|
1413
|
+
/* @__PURE__ */ jsx("code", { children: "aria-disabled" }),
|
|
1414
|
+
"), so a keyboard or screen reader user meets the reason too; choosing it does nothing and leaves the menu open. Its words dim, the reason keeps its strength. Here, the chat's AI assist menu: with the reply empty, Polish and Translate say what they need. Type a word and they come on."
|
|
1415
|
+
] }),
|
|
1416
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
1417
|
+
align: "fill",
|
|
1418
|
+
minHeight: 320,
|
|
1419
|
+
code: `
|
|
1420
|
+
<MenuItem icon={<PenNibIcon />} disabledReason={text ? undefined : 'Type something first'} onSelect={polish}>
|
|
1421
|
+
Polish
|
|
1422
|
+
</MenuItem>`,
|
|
1423
|
+
children: /* @__PURE__ */ jsx(AssistMenu, {})
|
|
1424
|
+
})
|
|
1425
|
+
}),
|
|
1426
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1427
|
+
id: "inline-submenus",
|
|
1428
|
+
title: "Inline submenus",
|
|
1429
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1430
|
+
/* @__PURE__ */ jsx("code", { children: "MenuInlineSub" }),
|
|
1431
|
+
" opens its rows in place, under itself and indented, instead of in a second sheet: for a short set where a flyout would cover the menu it came from, or a narrow screen with no room beside it. Enter, Space or a click toggles it, the arrow towards its chevron opens it and walks in, and the arrow back closes it from any of its rows; its rows join the menu's own, so the up and down arrows walk on through them. It takes a ",
|
|
1432
|
+
/* @__PURE__ */ jsx("code", { children: "disabledReason" }),
|
|
1433
|
+
" too. Translate, in the assist menu above, is one."
|
|
1434
|
+
] }),
|
|
1435
|
+
children: /* @__PURE__ */ jsx(CodeBlock$1, { code: `
|
|
1436
|
+
<MenuInlineSub label="Translate" icon={<TranslateIcon />} disabledReason={reason}>
|
|
1437
|
+
<MenuItem onSelect={() => translate('fr')}>French</MenuItem>
|
|
1438
|
+
<MenuItem onSelect={() => translate('de')}>German</MenuItem>
|
|
1439
|
+
<MenuItem onSelect={() => translate('es')}>Spanish</MenuItem>
|
|
1440
|
+
</MenuInlineSub>` })
|
|
1441
|
+
}),
|
|
1442
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1443
|
+
id: "busy-trigger",
|
|
1444
|
+
title: "While a row's action runs",
|
|
1445
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1446
|
+
"Give the trigger's ",
|
|
1447
|
+
/* @__PURE__ */ jsx("code", { children: "Button" }),
|
|
1448
|
+
" its ",
|
|
1449
|
+
/* @__PURE__ */ jsx("code", { children: "loading" }),
|
|
1450
|
+
" while what a row started is running. It spins in its icon's place, keeps focus (the menu hands it back as it closes), and the menu will not open again until it is done. Choose an export below. The assist menu above does the same with its",
|
|
1451
|
+
" ",
|
|
1452
|
+
/* @__PURE__ */ jsx("code", { children: "IconButton" }),
|
|
1453
|
+
". A link row given through ",
|
|
1454
|
+
/* @__PURE__ */ jsx("code", { children: "asChild" }),
|
|
1455
|
+
" takes a ",
|
|
1456
|
+
/* @__PURE__ */ jsx("code", { children: "description" }),
|
|
1457
|
+
" ",
|
|
1458
|
+
"(and an ",
|
|
1459
|
+
/* @__PURE__ */ jsx("code", { children: "isDefault" }),
|
|
1460
|
+
" or a ",
|
|
1461
|
+
/* @__PURE__ */ jsx("code", { children: "disabledReason" }),
|
|
1462
|
+
") too, drawn inside the link."
|
|
1463
|
+
] }),
|
|
1464
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
1465
|
+
minHeight: 240,
|
|
1466
|
+
code: `
|
|
1467
|
+
const [busy, setBusy] = useState(false)
|
|
1468
|
+
|
|
1469
|
+
<Menu>
|
|
1470
|
+
<MenuTrigger asChild>
|
|
1471
|
+
<Button icon={<DownloadSimpleIcon />} loading={busy}>{busy ? 'Exporting' : 'Export'}</Button>
|
|
1472
|
+
</MenuTrigger>
|
|
1473
|
+
<MenuContent width={300}>
|
|
1474
|
+
<MenuItem onSelect={() => exportAs('csv')} description="Every turn that matches the filters above">CSV</MenuItem>
|
|
1475
|
+
<MenuItem onSelect={() => exportAs('gaps')} description="The turns that failed, timed out or were marked unhelpful, by store">
|
|
1476
|
+
Gaps report
|
|
1477
|
+
</MenuItem>
|
|
1478
|
+
<MenuSeparator />
|
|
1479
|
+
<MenuItem asChild icon={<ArrowSquareOutIcon />} description="Kept for 30 days, in the help centre">
|
|
1480
|
+
<a href={helpUrl} target="_blank" rel="noreferrer">Past exports</a>
|
|
1481
|
+
</MenuItem>
|
|
1482
|
+
</MenuContent>
|
|
1483
|
+
</Menu>`,
|
|
1484
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1485
|
+
className: "overlays-top",
|
|
1486
|
+
children: /* @__PURE__ */ jsx(ExportMenu, {})
|
|
1487
|
+
})
|
|
1488
|
+
})
|
|
1489
|
+
}),
|
|
1490
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1491
|
+
id: "chip-trigger",
|
|
1492
|
+
title: "Chip trigger",
|
|
1493
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1494
|
+
/* @__PURE__ */ jsx("code", { children: "MenuChipTrigger" }),
|
|
1495
|
+
" is a small pill that opens its menu and shows the current choice: an icon, the value and a caret. It suits a picker in a row of tools, such as the model and effort under a prompt. It takes the place of ",
|
|
1496
|
+
/* @__PURE__ */ jsx("code", { children: "MenuTrigger" }),
|
|
1497
|
+
", is named by its ",
|
|
1498
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
1499
|
+
" and its value (“Model Sonnet 4.5”), comes in ",
|
|
1500
|
+
/* @__PURE__ */ jsx("code", { children: "sm" }),
|
|
1501
|
+
" (24px) and ",
|
|
1502
|
+
/* @__PURE__ */ jsx("code", { children: "md" }),
|
|
1503
|
+
" (30px), and with ",
|
|
1504
|
+
/* @__PURE__ */ jsx("code", { children: "busy" }),
|
|
1505
|
+
" ",
|
|
1506
|
+
"spins in its icon's place and does not open."
|
|
1507
|
+
] }),
|
|
1508
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
1509
|
+
minHeight: 120,
|
|
1510
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1511
|
+
className: "menu-chips",
|
|
1512
|
+
children: [
|
|
1513
|
+
/* @__PURE__ */ jsx(ModelPicker, {}),
|
|
1514
|
+
/* @__PURE__ */ jsx(EffortPicker, {}),
|
|
1515
|
+
/* @__PURE__ */ jsx(ModelPicker, { size: "md" }),
|
|
1516
|
+
/* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuChipTrigger, {
|
|
1517
|
+
label: "Model",
|
|
1518
|
+
icon: /* @__PURE__ */ jsx(CpuIcon, {}),
|
|
1519
|
+
busy: true,
|
|
1520
|
+
children: "Opus 4.5"
|
|
1521
|
+
}), /* @__PURE__ */ jsx(MenuContent, { children: /* @__PURE__ */ jsx(MenuItem, { children: "Opus 4.5" }) })] })
|
|
1522
|
+
]
|
|
1523
|
+
})
|
|
1524
|
+
})
|
|
1525
|
+
}),
|
|
1526
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
1527
|
+
id: "guidelines",
|
|
1528
|
+
title: "Guidelines",
|
|
1529
|
+
children: [
|
|
1530
|
+
/* @__PURE__ */ jsx(DoDont, {
|
|
1531
|
+
do: {
|
|
1532
|
+
children: /* @__PURE__ */ jsx(DoDontStill, { children: /* @__PURE__ */ jsxs(MenuSheet, { children: [
|
|
1533
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
1534
|
+
icon: /* @__PURE__ */ jsx(PencilSimpleIcon, {}),
|
|
1535
|
+
children: "Edit product"
|
|
1536
|
+
}),
|
|
1537
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
1538
|
+
icon: /* @__PURE__ */ jsx(CopyIcon, {}),
|
|
1539
|
+
children: "Duplicate"
|
|
1540
|
+
}),
|
|
1541
|
+
/* @__PURE__ */ jsx(MenuRule, {}),
|
|
1542
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
1543
|
+
icon: /* @__PURE__ */ jsx(TrashIcon, {}),
|
|
1544
|
+
tone: "critical",
|
|
1545
|
+
children: "Delete product"
|
|
1546
|
+
})
|
|
1547
|
+
] }) }),
|
|
1548
|
+
caption: "Critical rows go last, after a separator, so nobody lands on one while reaching for another row."
|
|
1549
|
+
},
|
|
1550
|
+
dont: {
|
|
1551
|
+
children: /* @__PURE__ */ jsx(DoDontStill, { children: /* @__PURE__ */ jsxs(MenuSheet, { children: [
|
|
1552
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
1553
|
+
icon: /* @__PURE__ */ jsx(PencilSimpleIcon, {}),
|
|
1554
|
+
children: "Edit product"
|
|
1555
|
+
}),
|
|
1556
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
1557
|
+
icon: /* @__PURE__ */ jsx(TrashIcon, {}),
|
|
1558
|
+
tone: "critical",
|
|
1559
|
+
children: "Delete product"
|
|
1560
|
+
}),
|
|
1561
|
+
/* @__PURE__ */ jsx(MenuRow, {
|
|
1562
|
+
icon: /* @__PURE__ */ jsx(CopyIcon, {}),
|
|
1563
|
+
children: "Duplicate"
|
|
1564
|
+
})
|
|
1565
|
+
] }) }),
|
|
1566
|
+
caption: "A destructive row between everyday ones is one slip of the pointer away from a mistake."
|
|
1567
|
+
}
|
|
1568
|
+
}),
|
|
1569
|
+
/* @__PURE__ */ jsx(DoDont, {
|
|
1570
|
+
do: {
|
|
1571
|
+
children: /* @__PURE__ */ jsx(DoDontStill, { children: /* @__PURE__ */ jsxs(MenuSheet, { children: [/* @__PURE__ */ jsx(MenuRow, {
|
|
1572
|
+
icon: /* @__PURE__ */ jsx(CircleHalfIcon, {}),
|
|
1573
|
+
hint: "Dark",
|
|
1574
|
+
submenu: true,
|
|
1575
|
+
children: "Appearance"
|
|
1576
|
+
}), /* @__PURE__ */ jsx(MenuRow, {
|
|
1577
|
+
icon: /* @__PURE__ */ jsx(ArrowsDownUpIcon, {}),
|
|
1578
|
+
hint: "Newest first",
|
|
1579
|
+
submenu: true,
|
|
1580
|
+
children: "Sort by"
|
|
1581
|
+
})] }) }),
|
|
1582
|
+
caption: "Show the current choice as the submenu trigger's hint."
|
|
1583
|
+
},
|
|
1584
|
+
dont: {
|
|
1585
|
+
children: /* @__PURE__ */ jsx(DoDontStill, { children: /* @__PURE__ */ jsxs(MenuSheet, { children: [/* @__PURE__ */ jsx(MenuRow, {
|
|
1586
|
+
icon: /* @__PURE__ */ jsx(CircleHalfIcon, {}),
|
|
1587
|
+
submenu: true,
|
|
1588
|
+
children: "Appearance"
|
|
1589
|
+
}), /* @__PURE__ */ jsx(MenuRow, {
|
|
1590
|
+
icon: /* @__PURE__ */ jsx(ArrowsDownUpIcon, {}),
|
|
1591
|
+
submenu: true,
|
|
1592
|
+
children: "Sort by"
|
|
1593
|
+
})] }) }),
|
|
1594
|
+
caption: "Without it, people open the submenu just to find out what is set."
|
|
1595
|
+
}
|
|
1596
|
+
}),
|
|
1597
|
+
/* @__PURE__ */ jsx(Guidelines, { items: [
|
|
1598
|
+
"Start each row with a verb and name the thing it acts on: \"Print packing slip\", not \"Slip\".",
|
|
1599
|
+
"Keep menus short. Past about seven rows, group them under labels; past a dozen, the choice probably wants its own screen.",
|
|
1600
|
+
"One level of submenu at most, and only for a set of choices, like appearance or a status.",
|
|
1601
|
+
"A menu holds actions and quick choices. For typing, use a Popover; for a task with several fields or steps, a Dialog.",
|
|
1602
|
+
"Give every row in a group an icon, or none of them, so the labels line up.",
|
|
1603
|
+
"Name icon-only triggers for what the actions are about: \"Actions for order #1043\", not \"More\".",
|
|
1604
|
+
"Only show a shortcut when the app really binds it."
|
|
1605
|
+
] })
|
|
1606
|
+
]
|
|
1607
|
+
}),
|
|
1608
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
1609
|
+
id: "accessibility",
|
|
1610
|
+
title: "Accessibility",
|
|
1611
|
+
children: [/* @__PURE__ */ jsx(Guidelines, { items: [
|
|
1612
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1613
|
+
"Built on Radix DropdownMenu. The trigger carries ",
|
|
1614
|
+
/* @__PURE__ */ jsx("code", { children: "aria-haspopup=\"menu\"" }),
|
|
1615
|
+
" and",
|
|
1616
|
+
" ",
|
|
1617
|
+
/* @__PURE__ */ jsx("code", { children: "aria-expanded" }),
|
|
1618
|
+
"; rows are ",
|
|
1619
|
+
/* @__PURE__ */ jsx("code", { children: "menuitem" }),
|
|
1620
|
+
", ",
|
|
1621
|
+
/* @__PURE__ */ jsx("code", { children: "menuitemcheckbox" }),
|
|
1622
|
+
" or",
|
|
1623
|
+
" ",
|
|
1624
|
+
/* @__PURE__ */ jsx("code", { children: "menuitemradio" }),
|
|
1625
|
+
" with ",
|
|
1626
|
+
/* @__PURE__ */ jsx("code", { children: "aria-checked" }),
|
|
1627
|
+
"."
|
|
1628
|
+
] }),
|
|
1629
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1630
|
+
"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 (",
|
|
1631
|
+
/* @__PURE__ */ jsx("code", { children: "loop" }),
|
|
1632
|
+
" 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."
|
|
1633
|
+
] }),
|
|
1634
|
+
"The right arrow opens a submenu and the left arrow closes it again. Escape closes the menu and hands focus back to the trigger.",
|
|
1635
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1636
|
+
"While a menu is open (",
|
|
1637
|
+
/* @__PURE__ */ jsx("code", { children: "modal" }),
|
|
1638
|
+
", the default) the page behind ignores the pointer, does not scroll, and is hidden from screen readers."
|
|
1639
|
+
] }),
|
|
1640
|
+
"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\").",
|
|
1641
|
+
"Highlight is a tint, never colour alone: the chosen radio and checked rows also carry a mark.",
|
|
1642
|
+
"With reduced motion the sheet and its rows fade in without growing or rising, and the check and satellite appear without moving."
|
|
1643
|
+
] }), /* @__PURE__ */ jsxs(Note, {
|
|
1644
|
+
title: "Tooltips on menu triggers",
|
|
1645
|
+
children: [
|
|
1646
|
+
"An icon-only trigger can carry a tooltip. Pass the tooltip ",
|
|
1647
|
+
/* @__PURE__ */ jsx("code", { children: "disabled" }),
|
|
1648
|
+
" while the menu is open, so it does not sit on top of the sheet. See ",
|
|
1649
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
1650
|
+
to: "/components/tooltip#disabled",
|
|
1651
|
+
children: "Tooltip"
|
|
1652
|
+
}),
|
|
1653
|
+
"."
|
|
1654
|
+
]
|
|
1655
|
+
})]
|
|
1656
|
+
}),
|
|
1657
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
1658
|
+
id: "props",
|
|
1659
|
+
title: "Props",
|
|
1660
|
+
description: /* @__PURE__ */ jsx("p", { children: "Every part also accepts the matching Radix DropdownMenu props." }),
|
|
1661
|
+
children: [
|
|
1662
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1663
|
+
title: "Menu",
|
|
1664
|
+
rows: [
|
|
1665
|
+
{
|
|
1666
|
+
name: "open",
|
|
1667
|
+
type: "boolean",
|
|
1668
|
+
description: "Controlled open state."
|
|
1669
|
+
},
|
|
1670
|
+
{
|
|
1671
|
+
name: "defaultOpen",
|
|
1672
|
+
type: "boolean",
|
|
1673
|
+
default: "false",
|
|
1674
|
+
description: "Starting state when uncontrolled."
|
|
1675
|
+
},
|
|
1676
|
+
{
|
|
1677
|
+
name: "onOpenChange",
|
|
1678
|
+
type: "(open: boolean) => void",
|
|
1679
|
+
description: "Called when the menu opens or closes."
|
|
1680
|
+
},
|
|
1681
|
+
{
|
|
1682
|
+
name: "modal",
|
|
1683
|
+
type: "boolean",
|
|
1684
|
+
default: "true",
|
|
1685
|
+
description: "While open, the rest of the page ignores the pointer, does not scroll and is hidden from screen readers."
|
|
1686
|
+
}
|
|
1687
|
+
]
|
|
1688
|
+
}),
|
|
1689
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1690
|
+
title: "MenuTrigger",
|
|
1691
|
+
rows: [
|
|
1692
|
+
{
|
|
1693
|
+
name: "asChild",
|
|
1694
|
+
type: "boolean",
|
|
1695
|
+
default: "false",
|
|
1696
|
+
description: "Render your Button or IconButton as the trigger. Almost always on."
|
|
1697
|
+
},
|
|
1698
|
+
{
|
|
1699
|
+
name: "disabled",
|
|
1700
|
+
type: "boolean",
|
|
1701
|
+
default: "false",
|
|
1702
|
+
description: "The trigger cannot open the menu."
|
|
1703
|
+
},
|
|
1704
|
+
{
|
|
1705
|
+
name: "(busy)",
|
|
1706
|
+
type: "aria-disabled on the trigger",
|
|
1707
|
+
description: "While the Button is loading (or anything sets aria-disabled=\"true\"), the menu does not open and the trigger keeps focus."
|
|
1708
|
+
}
|
|
1709
|
+
]
|
|
1710
|
+
}),
|
|
1711
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1712
|
+
title: "MenuContent",
|
|
1713
|
+
rows: [
|
|
1714
|
+
{
|
|
1715
|
+
name: "width",
|
|
1716
|
+
type: "number | string | 'trigger'",
|
|
1717
|
+
description: "Fixed width in px, any CSS length, or 'trigger' to match the trigger. By default it fits its rows, 220px at least."
|
|
1718
|
+
},
|
|
1719
|
+
{
|
|
1720
|
+
name: "align",
|
|
1721
|
+
type: "'start' | 'center' | 'end'",
|
|
1722
|
+
default: "'start'",
|
|
1723
|
+
description: "Which edge of the trigger the sheet lines up with."
|
|
1724
|
+
},
|
|
1725
|
+
{
|
|
1726
|
+
name: "side",
|
|
1727
|
+
type: "'top' | 'right' | 'bottom' | 'left'",
|
|
1728
|
+
default: "'bottom'",
|
|
1729
|
+
description: "Preferred side. Flips when there is no room."
|
|
1730
|
+
},
|
|
1731
|
+
{
|
|
1732
|
+
name: "sideOffset",
|
|
1733
|
+
type: "number",
|
|
1734
|
+
default: "6",
|
|
1735
|
+
description: "Gap from the trigger in px."
|
|
1736
|
+
},
|
|
1737
|
+
{
|
|
1738
|
+
name: "alignOffset",
|
|
1739
|
+
type: "number",
|
|
1740
|
+
default: "0",
|
|
1741
|
+
description: "Nudge along the aligned edge in px."
|
|
1742
|
+
},
|
|
1743
|
+
{
|
|
1744
|
+
name: "collisionPadding",
|
|
1745
|
+
type: "number",
|
|
1746
|
+
default: "8",
|
|
1747
|
+
description: "Space kept from the edges of the window."
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
name: "loop",
|
|
1751
|
+
type: "boolean",
|
|
1752
|
+
default: "true",
|
|
1753
|
+
description: "The arrow keys wrap round from the last row to the first."
|
|
1754
|
+
},
|
|
1755
|
+
{
|
|
1756
|
+
name: "container",
|
|
1757
|
+
type: "HTMLElement | null",
|
|
1758
|
+
default: "document.body",
|
|
1759
|
+
description: "Where the sheet is portalled. Inside a dialog it opens in the dialog's layer; null keeps it on the page."
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
name: "onCloseAutoFocus",
|
|
1763
|
+
type: "(event: Event) => void",
|
|
1764
|
+
description: "Runs as focus goes back to the trigger. Prevent it to send focus elsewhere."
|
|
1765
|
+
}
|
|
1766
|
+
]
|
|
1767
|
+
}),
|
|
1768
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1769
|
+
title: "MenuItem",
|
|
1770
|
+
rows: [
|
|
1771
|
+
{
|
|
1772
|
+
name: "children",
|
|
1773
|
+
type: "ReactNode",
|
|
1774
|
+
required: true,
|
|
1775
|
+
description: "The label."
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
name: "onSelect",
|
|
1779
|
+
type: "(event: Event) => void",
|
|
1780
|
+
description: "Runs the action. The menu closes after it unless you call event.preventDefault()."
|
|
1781
|
+
},
|
|
1782
|
+
{
|
|
1783
|
+
name: "icon",
|
|
1784
|
+
type: "ReactNode",
|
|
1785
|
+
description: "Leading 16px icon, muted until the row is highlighted."
|
|
1786
|
+
},
|
|
1787
|
+
{
|
|
1788
|
+
name: "hint",
|
|
1789
|
+
type: "ReactNode",
|
|
1790
|
+
description: "Muted detail at the end, such as a format or why a row is disabled."
|
|
1791
|
+
},
|
|
1792
|
+
{
|
|
1793
|
+
name: "shortcut",
|
|
1794
|
+
type: "string[]",
|
|
1795
|
+
description: "Keycaps via Kbd, e.g. ['mod', 'shift', 'C']. Drawn only; bind the keys yourself."
|
|
1796
|
+
},
|
|
1797
|
+
{
|
|
1798
|
+
name: "tone",
|
|
1799
|
+
type: "'critical'",
|
|
1800
|
+
description: "Red, for actions that destroy something or sign out."
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
name: "afterClose",
|
|
1804
|
+
type: "() => void",
|
|
1805
|
+
description: "Runs once the menu has left the page and its button has its focus back, instead of inside the click. For a row that focuses an inline field or opens a panel from another library. It runs a moment after the click, not inside it. Not called when onSelect keeps the menu open."
|
|
1806
|
+
},
|
|
1807
|
+
{
|
|
1808
|
+
name: "disabled",
|
|
1809
|
+
type: "boolean",
|
|
1810
|
+
default: "false",
|
|
1811
|
+
description: "Dimmed and skipped by the arrow keys."
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
name: "description",
|
|
1815
|
+
type: "ReactNode",
|
|
1816
|
+
description: "A quiet second line under the label that wraps. Read as the row’s description. Not drawn on an asChild link."
|
|
1817
|
+
},
|
|
1818
|
+
{
|
|
1819
|
+
name: "isDefault",
|
|
1820
|
+
type: "boolean",
|
|
1821
|
+
default: "false",
|
|
1822
|
+
description: "A quiet “Default” after the label."
|
|
1823
|
+
},
|
|
1824
|
+
{
|
|
1825
|
+
name: "defaultLabel",
|
|
1826
|
+
type: "string",
|
|
1827
|
+
default: "'Default'",
|
|
1828
|
+
description: "The word isDefault draws."
|
|
1829
|
+
},
|
|
1830
|
+
{
|
|
1831
|
+
name: "disabledReason",
|
|
1832
|
+
type: "ReactNode",
|
|
1833
|
+
description: "Off, saying why on its second line. Stays in reach of the arrow keys (aria-disabled); choosing it does nothing."
|
|
1834
|
+
},
|
|
1835
|
+
{
|
|
1836
|
+
name: "asChild",
|
|
1837
|
+
type: "boolean",
|
|
1838
|
+
default: "false",
|
|
1839
|
+
description: "Render a link (router Link or a) as the row."
|
|
1840
|
+
},
|
|
1841
|
+
{
|
|
1842
|
+
name: "textValue",
|
|
1843
|
+
type: "string",
|
|
1844
|
+
description: "Text for typing to jump to the row. Defaults to the label."
|
|
1845
|
+
}
|
|
1846
|
+
]
|
|
1847
|
+
}),
|
|
1848
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1849
|
+
title: "MenuCheckboxItem",
|
|
1850
|
+
rows: [
|
|
1851
|
+
{
|
|
1852
|
+
name: "checked",
|
|
1853
|
+
type: "boolean",
|
|
1854
|
+
description: "Controlled state."
|
|
1855
|
+
},
|
|
1856
|
+
{
|
|
1857
|
+
name: "onCheckedChange",
|
|
1858
|
+
type: "(checked: boolean) => void",
|
|
1859
|
+
description: "Called with the new state."
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
name: "onSelect",
|
|
1863
|
+
type: "(event: Event) => void",
|
|
1864
|
+
description: "Prevent the event to keep the menu open."
|
|
1865
|
+
},
|
|
1866
|
+
{
|
|
1867
|
+
name: "icon, hint, shortcut",
|
|
1868
|
+
type: "ReactNode, ReactNode, string[]",
|
|
1869
|
+
description: "As on MenuItem. The check sits at the end."
|
|
1870
|
+
},
|
|
1871
|
+
{
|
|
1872
|
+
name: "description, isDefault, defaultLabel, disabledReason",
|
|
1873
|
+
type: "as on MenuItem",
|
|
1874
|
+
description: "A second line, the default’s word, and off with a reason (its state then does not change)."
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
name: "disabled",
|
|
1878
|
+
type: "boolean",
|
|
1879
|
+
default: "false",
|
|
1880
|
+
description: "Dimmed and skipped by the arrow keys."
|
|
1881
|
+
}
|
|
1882
|
+
]
|
|
1883
|
+
}),
|
|
1884
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1885
|
+
title: "MenuRadioGroup",
|
|
1886
|
+
rows: [
|
|
1887
|
+
{
|
|
1888
|
+
name: "value",
|
|
1889
|
+
type: "string",
|
|
1890
|
+
description: "The chosen value."
|
|
1891
|
+
},
|
|
1892
|
+
{
|
|
1893
|
+
name: "onValueChange",
|
|
1894
|
+
type: "(value: string) => void",
|
|
1895
|
+
description: "Called with the newly chosen value."
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
name: "label",
|
|
1899
|
+
type: "ReactNode",
|
|
1900
|
+
description: "A heading above the choices that also names the group for screen readers."
|
|
1901
|
+
}
|
|
1902
|
+
]
|
|
1903
|
+
}),
|
|
1904
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1905
|
+
title: "MenuRadioItem",
|
|
1906
|
+
rows: [
|
|
1907
|
+
{
|
|
1908
|
+
name: "value",
|
|
1909
|
+
type: "string",
|
|
1910
|
+
required: true,
|
|
1911
|
+
description: "The value this row stands for."
|
|
1912
|
+
},
|
|
1913
|
+
{
|
|
1914
|
+
name: "onSelect",
|
|
1915
|
+
type: "(event: Event) => void",
|
|
1916
|
+
description: "Prevent the event to keep the menu open."
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
name: "icon, hint, shortcut",
|
|
1920
|
+
type: "ReactNode, ReactNode, string[]",
|
|
1921
|
+
description: "As on MenuItem. The ring and satellite sit at the end."
|
|
1922
|
+
},
|
|
1923
|
+
{
|
|
1924
|
+
name: "description, isDefault, defaultLabel, disabledReason",
|
|
1925
|
+
type: "as on MenuItem",
|
|
1926
|
+
description: "A second line, the default’s word, and off with a reason (the group’s value then does not change)."
|
|
1927
|
+
},
|
|
1928
|
+
{
|
|
1929
|
+
name: "disabled",
|
|
1930
|
+
type: "boolean",
|
|
1931
|
+
default: "false",
|
|
1932
|
+
description: "Dimmed and skipped by the arrow keys."
|
|
1933
|
+
}
|
|
1934
|
+
]
|
|
1935
|
+
}),
|
|
1936
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1937
|
+
title: "MenuSub",
|
|
1938
|
+
rows: [
|
|
1939
|
+
{
|
|
1940
|
+
name: "open",
|
|
1941
|
+
type: "boolean",
|
|
1942
|
+
description: "Controlled open state of the submenu."
|
|
1943
|
+
},
|
|
1944
|
+
{
|
|
1945
|
+
name: "defaultOpen",
|
|
1946
|
+
type: "boolean",
|
|
1947
|
+
default: "false",
|
|
1948
|
+
description: "Starting state when uncontrolled."
|
|
1949
|
+
},
|
|
1950
|
+
{
|
|
1951
|
+
name: "onOpenChange",
|
|
1952
|
+
type: "(open: boolean) => void",
|
|
1953
|
+
description: "Called when the submenu opens or closes."
|
|
1954
|
+
}
|
|
1955
|
+
]
|
|
1956
|
+
}),
|
|
1957
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1958
|
+
title: "MenuSubTrigger",
|
|
1959
|
+
rows: [
|
|
1960
|
+
{
|
|
1961
|
+
name: "children",
|
|
1962
|
+
type: "ReactNode",
|
|
1963
|
+
required: true,
|
|
1964
|
+
description: "The label."
|
|
1965
|
+
},
|
|
1966
|
+
{
|
|
1967
|
+
name: "icon",
|
|
1968
|
+
type: "ReactNode",
|
|
1969
|
+
description: "Leading 16px icon."
|
|
1970
|
+
},
|
|
1971
|
+
{
|
|
1972
|
+
name: "hint",
|
|
1973
|
+
type: "ReactNode",
|
|
1974
|
+
description: "Muted detail before the chevron: the current choice inside."
|
|
1975
|
+
},
|
|
1976
|
+
{
|
|
1977
|
+
name: "disabled",
|
|
1978
|
+
type: "boolean",
|
|
1979
|
+
default: "false",
|
|
1980
|
+
description: "The submenu cannot open."
|
|
1981
|
+
}
|
|
1982
|
+
]
|
|
1983
|
+
}),
|
|
1984
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1985
|
+
title: "MenuSubContent",
|
|
1986
|
+
rows: [
|
|
1987
|
+
{
|
|
1988
|
+
name: "width",
|
|
1989
|
+
type: "number | string | 'trigger'",
|
|
1990
|
+
description: "As on MenuContent."
|
|
1991
|
+
},
|
|
1992
|
+
{
|
|
1993
|
+
name: "sideOffset",
|
|
1994
|
+
type: "number",
|
|
1995
|
+
default: "10",
|
|
1996
|
+
description: "Measured from the trigger row, so the sheet sits 4px clear of its parent."
|
|
1997
|
+
},
|
|
1998
|
+
{
|
|
1999
|
+
name: "alignOffset",
|
|
2000
|
+
type: "number",
|
|
2001
|
+
default: "-6",
|
|
2002
|
+
description: "Lines the first row up with the trigger row."
|
|
2003
|
+
},
|
|
2004
|
+
{
|
|
2005
|
+
name: "collisionPadding",
|
|
2006
|
+
type: "number",
|
|
2007
|
+
default: "8",
|
|
2008
|
+
description: "Space kept from the edges of the window."
|
|
2009
|
+
},
|
|
2010
|
+
{
|
|
2011
|
+
name: "loop",
|
|
2012
|
+
type: "boolean",
|
|
2013
|
+
default: "true",
|
|
2014
|
+
description: "The arrow keys wrap round."
|
|
2015
|
+
},
|
|
2016
|
+
{
|
|
2017
|
+
name: "container",
|
|
2018
|
+
type: "HTMLElement | null",
|
|
2019
|
+
default: "document.body",
|
|
2020
|
+
description: "Where the sheet is portalled. Inside a dialog it opens in the dialog's layer; null keeps it on the page."
|
|
2021
|
+
}
|
|
2022
|
+
]
|
|
2023
|
+
}),
|
|
2024
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
2025
|
+
title: "MenuInlineSub",
|
|
2026
|
+
rows: [
|
|
2027
|
+
{
|
|
2028
|
+
name: "label",
|
|
2029
|
+
type: "ReactNode",
|
|
2030
|
+
required: true,
|
|
2031
|
+
description: "The row’s words. Also names the rows it opens."
|
|
2032
|
+
},
|
|
2033
|
+
{
|
|
2034
|
+
name: "children",
|
|
2035
|
+
type: "ReactNode",
|
|
2036
|
+
required: true,
|
|
2037
|
+
description: "The rows it opens in place."
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
name: "icon, hint",
|
|
2041
|
+
type: "ReactNode",
|
|
2042
|
+
description: "As on MenuSubTrigger."
|
|
2043
|
+
},
|
|
2044
|
+
{
|
|
2045
|
+
name: "open / defaultOpen / onOpenChange",
|
|
2046
|
+
type: "boolean / boolean / (open) => void",
|
|
2047
|
+
description: "Controlled or uncontrolled open state."
|
|
2048
|
+
},
|
|
2049
|
+
{
|
|
2050
|
+
name: "description, disabledReason",
|
|
2051
|
+
type: "ReactNode",
|
|
2052
|
+
description: "As on MenuItem. Off, it does not open."
|
|
2053
|
+
}
|
|
2054
|
+
]
|
|
2055
|
+
}),
|
|
2056
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
2057
|
+
title: "MenuChipTrigger",
|
|
2058
|
+
rows: [
|
|
2059
|
+
{
|
|
2060
|
+
name: "label",
|
|
2061
|
+
type: "string",
|
|
2062
|
+
required: true,
|
|
2063
|
+
description: "What it chooses, for its name: “Model”. Not shown."
|
|
2064
|
+
},
|
|
2065
|
+
{
|
|
2066
|
+
name: "children",
|
|
2067
|
+
type: "ReactNode",
|
|
2068
|
+
required: true,
|
|
2069
|
+
description: "The current choice, shown."
|
|
2070
|
+
},
|
|
2071
|
+
{
|
|
2072
|
+
name: "icon",
|
|
2073
|
+
type: "ReactNode",
|
|
2074
|
+
description: "A leading glyph."
|
|
2075
|
+
},
|
|
2076
|
+
{
|
|
2077
|
+
name: "size",
|
|
2078
|
+
type: "'sm' | 'md'",
|
|
2079
|
+
default: "'sm'",
|
|
2080
|
+
description: "24px or 30px tall."
|
|
2081
|
+
},
|
|
2082
|
+
{
|
|
2083
|
+
name: "busy",
|
|
2084
|
+
type: "boolean",
|
|
2085
|
+
default: "false",
|
|
2086
|
+
description: "Spins in the icon’s place, stays focusable and does not open."
|
|
2087
|
+
}
|
|
2088
|
+
]
|
|
2089
|
+
}),
|
|
2090
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
2091
|
+
title: "MenuLabel",
|
|
2092
|
+
rows: [{
|
|
2093
|
+
name: "children",
|
|
2094
|
+
type: "ReactNode",
|
|
2095
|
+
description: "A quiet heading for the rows below it, in sentence case. Not focusable."
|
|
2096
|
+
}]
|
|
2097
|
+
}),
|
|
2098
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
2099
|
+
title: "MenuGroup",
|
|
2100
|
+
rows: [{
|
|
2101
|
+
name: "children",
|
|
2102
|
+
type: "ReactNode",
|
|
2103
|
+
description: "The rows it groups for assistive tech. It has no look of its own."
|
|
2104
|
+
}, {
|
|
2105
|
+
name: "label",
|
|
2106
|
+
type: "ReactNode",
|
|
2107
|
+
description: "A heading above the rows that also names the group for screen readers."
|
|
2108
|
+
}]
|
|
2109
|
+
}),
|
|
2110
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
2111
|
+
title: "MenuSeparator",
|
|
2112
|
+
rows: [{
|
|
2113
|
+
name: "className",
|
|
2114
|
+
type: "string",
|
|
2115
|
+
description: "A hairline between groups. It has no props of its own beyond the usual element attributes."
|
|
2116
|
+
}]
|
|
2117
|
+
}),
|
|
2118
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
2119
|
+
title: "MenuHeader",
|
|
2120
|
+
rows: [{
|
|
2121
|
+
name: "children",
|
|
2122
|
+
type: "ReactNode",
|
|
2123
|
+
description: "Free-form content, laid out in a row with a 10px gap. Accepts every div attribute."
|
|
2124
|
+
}]
|
|
2125
|
+
})
|
|
2126
|
+
]
|
|
2127
|
+
})
|
|
2128
|
+
]
|
|
2129
|
+
});
|
|
2130
|
+
}
|
|
2131
|
+
//#endregion
|
|
2132
|
+
export { Page, Preview };
|