@orbitcommerce/constellation-docs 1.0.0 → 1.2.1
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/dist/docs.css +14764 -2237
- package/dist/index.js +2 -2
- package/dist/pages/{Playground-CNbBbErC.js → Playground-Mk1yIWXb.js} +2 -2
- 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-BDmScEny.js → _figures-data-DaDvB7Nm.js} +5 -5
- package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
- package/dist/pages/{_overlays-specimens-Dpn6oiyH.js → _overlays-specimens-bawR331Z.js} +33 -23
- 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-BvxQWBTy.js +403 -0
- package/dist/pages/address-fields-CwSqro3W.js +277 -0
- package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
- package/dist/pages/{alert-BD4e6QTh.js → alert-D3i7xZTU.js} +195 -50
- package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
- package/dist/pages/{app-shell-KbA-nRqZ.js → app-shell-D4hdlHps.js} +133 -54
- package/dist/pages/{area-chart-B91dLcGo.js → area-chart-BEWFwiB2.js} +183 -27
- package/dist/pages/{avatar-DPPHXJAu.js → avatar-BFEqQViw.js} +194 -12
- package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
- package/dist/pages/{badge-C9JR0thI.js → badge-0-PyMrih.js} +441 -135
- 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-D3V912P4.js → button-DAyfssDY.js} +276 -79
- package/dist/pages/{calendar-DSDZ9nRH.js → calendar-Ds7KsgSI.js} +69 -17
- package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
- package/dist/pages/card-CXZ3V1d4.js +1612 -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-BwuO8xAv.js → colour-q2ntvI0w.js} +496 -20
- package/dist/pages/column-mapper-TsTG39cl.js +502 -0
- package/dist/pages/combobox-DvK2j5tI.js +1334 -0
- package/dist/pages/{command-palette-xAD7fOg6.js → command-palette-CJ7uBA04.js} +201 -58
- 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-BYSa816m.js → date-picker-GdBciR99.js} +186 -38
- package/dist/pages/date-time-BLKCXtVZ.js +678 -0
- package/dist/pages/{delta-CtAo0eIM.js → delta-CNAGv8JY.js} +266 -61
- 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-BNOb7AqR.js → docs-lM2UBSir.js} +20 -15
- 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-hg7txTc3.js +1381 -0
- package/dist/pages/{figure-tabs-CoPFzzKz.js → figure-tabs-QOeQMY6N.js} +153 -35
- 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-CFQwDtC9.js → home-dashboard-CxPmvduE.js} +21 -18
- 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-C9eSVPPW.js → icon-button-Bu4Gj5sy.js} +370 -31
- package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
- package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
- package/dist/pages/{icons-sxkTs5Ob.js → icons-CJ9Aar3d.js} +315 -52
- 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-DpsX8G_n.js → installation-DRUWNVHP.js} +112 -29
- package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
- package/dist/pages/kanban-Dy9sPAI0.js +740 -0
- package/dist/pages/{kbd-cNfDoikz.js → kbd-UNj4zqxn.js} +15 -14
- 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-ClvLn9Lb.js → live-globe-95ROMhGQ.js} +191 -47
- 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-BfGF1Pq9.js → logo-D3a3QGKJ.js} +13 -13
- 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-by2sgQ09.js → menu-NrLYKqKp.js} +623 -109
- 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-BvTGc2Dk.js → motion-CrXtiBvA.js} +20 -10
- package/dist/pages/number-input-CuyMZg18.js +968 -0
- package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
- package/dist/pages/{orbit-spinner-Dil1Z3Oy.js → orbit-spinner-Dxv5qAhr.js} +30 -14
- package/dist/pages/otp-input-CVRoX1mw.js +591 -0
- package/dist/pages/{overview-BPEbZQ6g.js → overview-BSfEqHY8.js} +4 -4
- package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
- package/dist/pages/{pagination-BBUnGvv5.js → pagination-C1EgVtW4.js} +74 -29
- 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-BCPvtP8J.js +251 -0
- package/dist/pages/point-list-BbPmZjsm.js +222 -0
- package/dist/pages/{popover-Db1gLDpb.js → popover-C3Oar9D5.js} +76 -14
- 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-CeAIOIdt.js → principles-pnDyfHpK.js} +9 -9
- 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-CkdBWWfG.js → radio-group-CbiibLwn.js} +581 -18
- 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-CNR7zpf7.js +594 -0
- package/dist/pages/{release-Dvo684UJ.js → release-DYBCY7jm.js} +4 -1
- 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-qmvH84Mq.js → rolling-number-GR3Cyfpz.js} +12 -12
- 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-BN7MWGQ4.js → search-field-D1uG7R6A.js} +15 -15
- 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-CTbIpRBW.js → segmented-control-D-FB1K1T.js} +450 -37
- package/dist/pages/{select-DguELoRR.js → select-DZ43NpOm.js} +22 -17
- package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
- package/dist/pages/{separator-CPZub9pv.js → separator-CFwqRvfO.js} +99 -22
- package/dist/pages/serp-preview-BGwORjmo.js +346 -0
- package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
- package/dist/pages/{shape-DKvA0YKr.js → shape-DzniHAVT.js} +10 -10
- 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-DMMYGbHn.js → sparkline-D3aavCly.js} +301 -22
- 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-B-Qe4kcT.js → switch-C93K6j9h.js} +151 -51
- package/dist/pages/table-mq_pNXza.js +3232 -0
- package/dist/pages/{tabs-B4M-usCV.js → tabs-Cf4MZ8Fq.js} +257 -21
- package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
- package/dist/pages/task-card-Dv0sR1-w.js +295 -0
- package/dist/pages/{textarea-fTuUZRQb.js → textarea-CCM-SnGN.js} +271 -15
- 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-CKP03zjy.js → toast-zXLRiMRT.js} +240 -25
- package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
- package/dist/pages/toolbar-B9l_fHKy.js +754 -0
- package/dist/pages/{tooltip-CBYil3kt.js → tooltip-LHtCUkF-.js} +162 -33
- 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-PCbg8Bhg.js → typography-BSijtiRl.js} +153 -12
- 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 +10989 -1108
- package/package.json +3 -3
- package/dist/pages/card-DUggbis3.js +0 -659
- package/dist/pages/checkbox-DwimQaK3.js +0 -365
- package/dist/pages/dialog-BRAf4LMh.js +0 -1451
- package/dist/pages/empty-state-C-mLrXW2.js +0 -417
- package/dist/pages/input-KF9Gkawf.js +0 -1093
- package/dist/pages/registry-CroHzK9I.js +0 -244
- package/dist/pages/skeleton-DLuBhP46.js +0 -561
- package/dist/pages/table-AMoODng4.js +0 -607
|
@@ -0,0 +1,3164 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
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";
|
|
3
|
+
import { c as SpecimenFrame, t as DialogSheet } from "./_overlays-specimens-bawR331Z.js";
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Avatar, Badge, Button, Checkbox, ConfirmDialog, DatePicker, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogFrame, DialogHeader, DialogTitle, DialogTrigger, Field, IconButton, Input, Menu, MenuContent, MenuItem, MenuTrigger, Popover, PopoverContent, PopoverTrigger, SegmentedControl, Select, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, Switch } from "@orbitcommerce/constellation";
|
|
7
|
+
import { ArrowCounterClockwiseIcon, CheckIcon, CursorTextIcon, DotsThreeIcon, DownloadSimpleIcon, EnvelopeSimpleIcon, PaperPlaneTiltIcon, PencilSimpleIcon, SignOutIcon, TrashIcon, UploadSimpleIcon, UserPlusIcon } from "@orbitcommerce/constellation/icons";
|
|
8
|
+
//#region src/pages/components/_dialog-examples.tsx
|
|
9
|
+
var wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
10
|
+
var ACCESS_HINT = {
|
|
11
|
+
full: "Everything except billing and store ownership.",
|
|
12
|
+
orders: "Orders, customers and fulfilment. No settings.",
|
|
13
|
+
view: "Can look at everything and change nothing."
|
|
14
|
+
};
|
|
15
|
+
function InviteDialog() {
|
|
16
|
+
const [open, setOpen] = useState(false);
|
|
17
|
+
const [email, setEmail] = useState("");
|
|
18
|
+
const [error, setError] = useState();
|
|
19
|
+
const [access, setAccess] = useState("orders");
|
|
20
|
+
const [sending, setSending] = useState(false);
|
|
21
|
+
const submit = async (event) => {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
event.stopPropagation();
|
|
24
|
+
const value = email.trim();
|
|
25
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
26
|
+
setError(value ? "Enter an email address in the correct format, like name@example.com" : "Enter their email address");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
setError(void 0);
|
|
30
|
+
setSending(true);
|
|
31
|
+
await wait(1200);
|
|
32
|
+
setSending(false);
|
|
33
|
+
setOpen(false);
|
|
34
|
+
setEmail("");
|
|
35
|
+
};
|
|
36
|
+
return /* @__PURE__ */ jsxs(Dialog, {
|
|
37
|
+
open,
|
|
38
|
+
onOpenChange: (next) => {
|
|
39
|
+
setOpen(next);
|
|
40
|
+
if (!next) setError(void 0);
|
|
41
|
+
},
|
|
42
|
+
children: [/* @__PURE__ */ jsx(DialogTrigger, {
|
|
43
|
+
asChild: true,
|
|
44
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
45
|
+
variant: "primary",
|
|
46
|
+
icon: /* @__PURE__ */ jsx(UserPlusIcon, {}),
|
|
47
|
+
children: "Invite staff"
|
|
48
|
+
})
|
|
49
|
+
}), /* @__PURE__ */ jsx(DialogContent, {
|
|
50
|
+
busy: sending,
|
|
51
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
52
|
+
onSubmit: submit,
|
|
53
|
+
noValidate: true,
|
|
54
|
+
style: { display: "contents" },
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Invite a staff member" }), /* @__PURE__ */ jsx(DialogDescription, { children: "They get an email with a link to join Harbour Desk Co. Invites run out after 7 days." })] }),
|
|
57
|
+
/* @__PURE__ */ jsxs(DialogBody, {
|
|
58
|
+
className: "dialog-fields",
|
|
59
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
60
|
+
label: "Email address",
|
|
61
|
+
error,
|
|
62
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
63
|
+
type: "email",
|
|
64
|
+
icon: /* @__PURE__ */ jsx(EnvelopeSimpleIcon, {}),
|
|
65
|
+
placeholder: "name@example.com",
|
|
66
|
+
value: email,
|
|
67
|
+
onChange: (e) => {
|
|
68
|
+
setEmail(e.target.value);
|
|
69
|
+
if (error) setError(void 0);
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
73
|
+
className: "dialog-group",
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsx("span", {
|
|
76
|
+
className: "dialog-group__label",
|
|
77
|
+
"aria-hidden": "true",
|
|
78
|
+
children: "Access"
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ jsx(SegmentedControl, {
|
|
81
|
+
"aria-label": "Access",
|
|
82
|
+
fullWidth: true,
|
|
83
|
+
value: access,
|
|
84
|
+
onValueChange: setAccess,
|
|
85
|
+
options: [
|
|
86
|
+
{
|
|
87
|
+
value: "full",
|
|
88
|
+
label: "Full access"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
value: "orders",
|
|
92
|
+
label: "Orders only"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
value: "view",
|
|
96
|
+
label: "View only"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ jsx("span", {
|
|
101
|
+
className: "dialog-group__hint",
|
|
102
|
+
children: ACCESS_HINT[access]
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
})]
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
108
|
+
asChild: true,
|
|
109
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Cancel" })
|
|
110
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
111
|
+
type: "submit",
|
|
112
|
+
variant: "primary",
|
|
113
|
+
loading: sending,
|
|
114
|
+
children: "Send invite"
|
|
115
|
+
})] })
|
|
116
|
+
]
|
|
117
|
+
})
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function RenameDialog() {
|
|
122
|
+
return /* @__PURE__ */ jsxs(Dialog, { children: [/* @__PURE__ */ jsx(DialogTrigger, {
|
|
123
|
+
asChild: true,
|
|
124
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Rename collection" })
|
|
125
|
+
}), /* @__PURE__ */ jsxs(DialogContent, {
|
|
126
|
+
size: "sm",
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Rename collection" }), /* @__PURE__ */ jsx(DialogDescription, { children: "The collection's web address stays the same." })] }),
|
|
129
|
+
/* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsx(Field, {
|
|
130
|
+
label: "Name",
|
|
131
|
+
children: /* @__PURE__ */ jsx(Input, { defaultValue: "Home office" })
|
|
132
|
+
}) }),
|
|
133
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
134
|
+
asChild: true,
|
|
135
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Cancel" })
|
|
136
|
+
}), /* @__PURE__ */ jsx(DialogClose, {
|
|
137
|
+
asChild: true,
|
|
138
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
139
|
+
variant: "primary",
|
|
140
|
+
children: "Save"
|
|
141
|
+
})
|
|
142
|
+
})] })
|
|
143
|
+
]
|
|
144
|
+
})] });
|
|
145
|
+
}
|
|
146
|
+
function RateDialog() {
|
|
147
|
+
return /* @__PURE__ */ jsxs(Dialog, { children: [/* @__PURE__ */ jsx(DialogTrigger, {
|
|
148
|
+
asChild: true,
|
|
149
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Add delivery rate" })
|
|
150
|
+
}), /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
151
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Add a delivery rate" }), /* @__PURE__ */ jsx(DialogDescription, { children: "Customers in the UK mainland zone see it at checkout." })] }),
|
|
152
|
+
/* @__PURE__ */ jsxs(DialogBody, {
|
|
153
|
+
className: "dialog-fields",
|
|
154
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
155
|
+
label: "Name",
|
|
156
|
+
hint: "Shown at checkout",
|
|
157
|
+
children: /* @__PURE__ */ jsx(Input, { defaultValue: "Next working day" })
|
|
158
|
+
}), /* @__PURE__ */ jsx(Field, {
|
|
159
|
+
label: "Price",
|
|
160
|
+
hint: "Includes VAT at 20%",
|
|
161
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
162
|
+
prefix: "£",
|
|
163
|
+
inputMode: "decimal",
|
|
164
|
+
defaultValue: "7.95"
|
|
165
|
+
})
|
|
166
|
+
})]
|
|
167
|
+
}),
|
|
168
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
169
|
+
asChild: true,
|
|
170
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Cancel" })
|
|
171
|
+
}), /* @__PURE__ */ jsx(DialogClose, {
|
|
172
|
+
asChild: true,
|
|
173
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
174
|
+
variant: "primary",
|
|
175
|
+
children: "Add rate"
|
|
176
|
+
})
|
|
177
|
+
})] })
|
|
178
|
+
] })] });
|
|
179
|
+
}
|
|
180
|
+
function ZoneDialog() {
|
|
181
|
+
return /* @__PURE__ */ jsxs(Dialog, { children: [/* @__PURE__ */ jsx(DialogTrigger, {
|
|
182
|
+
asChild: true,
|
|
183
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Edit delivery zone" })
|
|
184
|
+
}), /* @__PURE__ */ jsxs(DialogContent, {
|
|
185
|
+
size: "lg",
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Edit delivery zone" }), /* @__PURE__ */ jsx(DialogDescription, { children: "Rates for Northern Ireland and the Scottish islands, where carriers charge more." })] }),
|
|
188
|
+
/* @__PURE__ */ jsxs(DialogBody, {
|
|
189
|
+
className: "dialog-fields",
|
|
190
|
+
"data-columns": "2",
|
|
191
|
+
children: [
|
|
192
|
+
/* @__PURE__ */ jsx(Field, {
|
|
193
|
+
label: "Zone name",
|
|
194
|
+
children: /* @__PURE__ */ jsx(Input, { defaultValue: "Highlands, islands and NI" })
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ jsx(Field, {
|
|
197
|
+
label: "Postcode areas",
|
|
198
|
+
hint: "Separate them with commas",
|
|
199
|
+
children: /* @__PURE__ */ jsx(Input, { defaultValue: "BT, HS, IV, KW, ZE" })
|
|
200
|
+
}),
|
|
201
|
+
/* @__PURE__ */ jsx(Field, {
|
|
202
|
+
label: "Rate",
|
|
203
|
+
hint: "Includes VAT at 20%",
|
|
204
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
205
|
+
prefix: "£",
|
|
206
|
+
inputMode: "decimal",
|
|
207
|
+
defaultValue: "14.50"
|
|
208
|
+
})
|
|
209
|
+
}),
|
|
210
|
+
/* @__PURE__ */ jsx(Field, {
|
|
211
|
+
label: "Free over",
|
|
212
|
+
hint: "Leave empty for no free delivery",
|
|
213
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
214
|
+
prefix: "£",
|
|
215
|
+
inputMode: "decimal",
|
|
216
|
+
defaultValue: "250.00"
|
|
217
|
+
})
|
|
218
|
+
})
|
|
219
|
+
]
|
|
220
|
+
}),
|
|
221
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
222
|
+
asChild: true,
|
|
223
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Cancel" })
|
|
224
|
+
}), /* @__PURE__ */ jsx(DialogClose, {
|
|
225
|
+
asChild: true,
|
|
226
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
227
|
+
variant: "primary",
|
|
228
|
+
children: "Save zone"
|
|
229
|
+
})
|
|
230
|
+
})] })
|
|
231
|
+
]
|
|
232
|
+
})] });
|
|
233
|
+
}
|
|
234
|
+
var IMPORT = [
|
|
235
|
+
[
|
|
236
|
+
"Arden ergonomic chair",
|
|
237
|
+
"CHR-ARD-01",
|
|
238
|
+
"£229.00",
|
|
239
|
+
"New"
|
|
240
|
+
],
|
|
241
|
+
[
|
|
242
|
+
"Arden chair, headrest",
|
|
243
|
+
"CHR-ARD-02",
|
|
244
|
+
"£259.00",
|
|
245
|
+
"New"
|
|
246
|
+
],
|
|
247
|
+
[
|
|
248
|
+
"Walnut desk riser",
|
|
249
|
+
"DSK-WAL-60",
|
|
250
|
+
"£84.00",
|
|
251
|
+
"Update"
|
|
252
|
+
],
|
|
253
|
+
[
|
|
254
|
+
"Brass desk lamp",
|
|
255
|
+
"LMP-BRS-01",
|
|
256
|
+
"£72.00",
|
|
257
|
+
"Update"
|
|
258
|
+
],
|
|
259
|
+
[
|
|
260
|
+
"Oak monitor shelf",
|
|
261
|
+
"SHF-OAK-80",
|
|
262
|
+
"£96.00",
|
|
263
|
+
"New"
|
|
264
|
+
],
|
|
265
|
+
[
|
|
266
|
+
"Felt desk pad, slate",
|
|
267
|
+
"PAD-FLT-SL",
|
|
268
|
+
"£28.00",
|
|
269
|
+
"New"
|
|
270
|
+
],
|
|
271
|
+
[
|
|
272
|
+
"Felt desk pad, moss",
|
|
273
|
+
"PAD-FLT-MS",
|
|
274
|
+
"£28.00",
|
|
275
|
+
"New"
|
|
276
|
+
],
|
|
277
|
+
[
|
|
278
|
+
"Linen cushion, sage",
|
|
279
|
+
"CSH-LIN-SG",
|
|
280
|
+
"£24.00",
|
|
281
|
+
"Update"
|
|
282
|
+
],
|
|
283
|
+
[
|
|
284
|
+
"Cable tidy tray",
|
|
285
|
+
"CBL-TRY-01",
|
|
286
|
+
"£19.00",
|
|
287
|
+
"New"
|
|
288
|
+
],
|
|
289
|
+
[
|
|
290
|
+
"Sit-stand desk, 140cm",
|
|
291
|
+
"DSK-SIT-140",
|
|
292
|
+
"£449.00",
|
|
293
|
+
"Update"
|
|
294
|
+
],
|
|
295
|
+
[
|
|
296
|
+
"Sit-stand desk, 160cm",
|
|
297
|
+
"DSK-SIT-160",
|
|
298
|
+
"£489.00",
|
|
299
|
+
"Update"
|
|
300
|
+
],
|
|
301
|
+
[
|
|
302
|
+
"Pedestal, three drawers",
|
|
303
|
+
"PED-3DR-01",
|
|
304
|
+
"£179.00",
|
|
305
|
+
"New"
|
|
306
|
+
]
|
|
307
|
+
];
|
|
308
|
+
function ImportDialog() {
|
|
309
|
+
return /* @__PURE__ */ jsxs(Dialog, { children: [/* @__PURE__ */ jsx(DialogTrigger, {
|
|
310
|
+
asChild: true,
|
|
311
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
312
|
+
icon: /* @__PURE__ */ jsx(UploadSimpleIcon, {}),
|
|
313
|
+
children: "Review import"
|
|
314
|
+
})
|
|
315
|
+
}), /* @__PURE__ */ jsxs(DialogContent, {
|
|
316
|
+
size: "lg",
|
|
317
|
+
children: [
|
|
318
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Import 12 products from Northgate Supply" }), /* @__PURE__ */ jsx(DialogDescription, { children: "7 are new to your catalogue and 5 update products you already sell." })] }),
|
|
319
|
+
/* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsx("ul", {
|
|
320
|
+
className: "dialog-import",
|
|
321
|
+
children: IMPORT.map(([name, sku, price, kind]) => /* @__PURE__ */ jsxs("li", { children: [
|
|
322
|
+
/* @__PURE__ */ jsx(Avatar, {
|
|
323
|
+
name,
|
|
324
|
+
shape: "square"
|
|
325
|
+
}),
|
|
326
|
+
/* @__PURE__ */ jsxs("span", {
|
|
327
|
+
className: "dialog-import__name",
|
|
328
|
+
children: [/* @__PURE__ */ jsx("span", { children: name }), /* @__PURE__ */ jsx("span", {
|
|
329
|
+
className: "dialog-import__sku",
|
|
330
|
+
children: sku
|
|
331
|
+
})]
|
|
332
|
+
}),
|
|
333
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
334
|
+
tone: kind === "New" ? "accent" : "neutral",
|
|
335
|
+
children: kind
|
|
336
|
+
}),
|
|
337
|
+
/* @__PURE__ */ jsx("span", {
|
|
338
|
+
className: "dialog-import__price",
|
|
339
|
+
children: price
|
|
340
|
+
})
|
|
341
|
+
] }, sku))
|
|
342
|
+
}) }),
|
|
343
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
344
|
+
asChild: true,
|
|
345
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Cancel" })
|
|
346
|
+
}), /* @__PURE__ */ jsx(DialogClose, {
|
|
347
|
+
asChild: true,
|
|
348
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
349
|
+
variant: "primary",
|
|
350
|
+
children: "Import 12 products"
|
|
351
|
+
})
|
|
352
|
+
})] })
|
|
353
|
+
]
|
|
354
|
+
})] });
|
|
355
|
+
}
|
|
356
|
+
function ExportDialog() {
|
|
357
|
+
const [format, setFormat] = useState("csv");
|
|
358
|
+
const [lines, setLines] = useState(true);
|
|
359
|
+
return /* @__PURE__ */ jsxs(Dialog, { children: [/* @__PURE__ */ jsx(DialogTrigger, {
|
|
360
|
+
asChild: true,
|
|
361
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
362
|
+
icon: /* @__PURE__ */ jsx(DownloadSimpleIcon, {}),
|
|
363
|
+
children: "Export orders"
|
|
364
|
+
})
|
|
365
|
+
}), /* @__PURE__ */ jsxs(DialogContent, {
|
|
366
|
+
size: "sm",
|
|
367
|
+
hideClose: true,
|
|
368
|
+
children: [
|
|
369
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Export 318 orders" }), /* @__PURE__ */ jsx(DialogDescription, { children: "Orders from the last 30 days, with the filters you have set." })] }),
|
|
370
|
+
/* @__PURE__ */ jsxs(DialogBody, {
|
|
371
|
+
className: "dialog-fields",
|
|
372
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
373
|
+
className: "dialog-group",
|
|
374
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
375
|
+
className: "dialog-group__label",
|
|
376
|
+
"aria-hidden": "true",
|
|
377
|
+
children: "Format"
|
|
378
|
+
}), /* @__PURE__ */ jsx(SegmentedControl, {
|
|
379
|
+
"aria-label": "Format",
|
|
380
|
+
fullWidth: true,
|
|
381
|
+
value: format,
|
|
382
|
+
onValueChange: setFormat,
|
|
383
|
+
options: [{
|
|
384
|
+
value: "csv",
|
|
385
|
+
label: "CSV"
|
|
386
|
+
}, {
|
|
387
|
+
value: "xlsx",
|
|
388
|
+
label: "Excel"
|
|
389
|
+
}]
|
|
390
|
+
})]
|
|
391
|
+
}), /* @__PURE__ */ jsx(Switch, {
|
|
392
|
+
label: "One row per line item",
|
|
393
|
+
checked: lines,
|
|
394
|
+
onCheckedChange: setLines
|
|
395
|
+
})]
|
|
396
|
+
}),
|
|
397
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
398
|
+
asChild: true,
|
|
399
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Cancel" })
|
|
400
|
+
}), /* @__PURE__ */ jsx(DialogClose, {
|
|
401
|
+
asChild: true,
|
|
402
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
403
|
+
variant: "primary",
|
|
404
|
+
icon: /* @__PURE__ */ jsx(DownloadSimpleIcon, {}),
|
|
405
|
+
children: "Export"
|
|
406
|
+
})
|
|
407
|
+
})] })
|
|
408
|
+
]
|
|
409
|
+
})] });
|
|
410
|
+
}
|
|
411
|
+
function ConfirmTones() {
|
|
412
|
+
const [status, setStatus] = useState("");
|
|
413
|
+
const [deleteOpen, setDeleteOpen] = useState(false);
|
|
414
|
+
const [logOutOpen, setLogOutOpen] = useState(false);
|
|
415
|
+
const [sendOpen, setSendOpen] = useState(false);
|
|
416
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
417
|
+
/* @__PURE__ */ jsx(Button, {
|
|
418
|
+
variant: "critical",
|
|
419
|
+
icon: /* @__PURE__ */ jsx(TrashIcon, {}),
|
|
420
|
+
onClick: () => setDeleteOpen(true),
|
|
421
|
+
children: "Delete 3 products"
|
|
422
|
+
}),
|
|
423
|
+
/* @__PURE__ */ jsx(Button, {
|
|
424
|
+
icon: /* @__PURE__ */ jsx(SignOutIcon, {}),
|
|
425
|
+
onClick: () => setLogOutOpen(true),
|
|
426
|
+
children: "Log out"
|
|
427
|
+
}),
|
|
428
|
+
/* @__PURE__ */ jsx(Button, {
|
|
429
|
+
icon: /* @__PURE__ */ jsx(PaperPlaneTiltIcon, {}),
|
|
430
|
+
onClick: () => setSendOpen(true),
|
|
431
|
+
children: "Send 12 invoices"
|
|
432
|
+
}),
|
|
433
|
+
/* @__PURE__ */ jsx("p", {
|
|
434
|
+
className: "dialog-status",
|
|
435
|
+
"aria-live": "polite",
|
|
436
|
+
children: status
|
|
437
|
+
}),
|
|
438
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
439
|
+
open: deleteOpen,
|
|
440
|
+
onOpenChange: setDeleteOpen,
|
|
441
|
+
tone: "critical",
|
|
442
|
+
title: "Delete 3 products?",
|
|
443
|
+
description: "Arden ergonomic chair, Walnut desk riser and Brass desk lamp leave your catalogue. Past orders keep their line items.",
|
|
444
|
+
confirmLabel: "Delete products",
|
|
445
|
+
onConfirm: () => wait(1400).then(() => setStatus("Deleted 3 products."))
|
|
446
|
+
}),
|
|
447
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
448
|
+
open: logOutOpen,
|
|
449
|
+
onOpenChange: setLogOutOpen,
|
|
450
|
+
tone: "critical",
|
|
451
|
+
title: "Log out of Orbit?",
|
|
452
|
+
description: "You will be signed out of Harbour Desk Co on this device.",
|
|
453
|
+
confirmLabel: "Log out",
|
|
454
|
+
onConfirm: () => wait(900).then(() => setStatus("Logged out. (Not really: this is the docs.)"))
|
|
455
|
+
}),
|
|
456
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
457
|
+
open: sendOpen,
|
|
458
|
+
onOpenChange: setSendOpen,
|
|
459
|
+
title: "Send 12 invoices?",
|
|
460
|
+
description: "Each customer gets their invoice by email, as a PDF.",
|
|
461
|
+
confirmLabel: "Send invoices",
|
|
462
|
+
onConfirm: () => setStatus("Sent 12 invoices.")
|
|
463
|
+
})
|
|
464
|
+
] });
|
|
465
|
+
}
|
|
466
|
+
function RefundConfirm() {
|
|
467
|
+
const [open, setOpen] = useState(false);
|
|
468
|
+
const [failed, setFailed] = useState(false);
|
|
469
|
+
const [error, setError] = useState();
|
|
470
|
+
const [done, setDone] = useState("");
|
|
471
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
472
|
+
/* @__PURE__ */ jsx(Button, {
|
|
473
|
+
onClick: () => {
|
|
474
|
+
setFailed(false);
|
|
475
|
+
setError(void 0);
|
|
476
|
+
setOpen(true);
|
|
477
|
+
},
|
|
478
|
+
children: "Refund £89.50"
|
|
479
|
+
}),
|
|
480
|
+
/* @__PURE__ */ jsx("p", {
|
|
481
|
+
className: "dialog-status",
|
|
482
|
+
"aria-live": "polite",
|
|
483
|
+
children: done
|
|
484
|
+
}),
|
|
485
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
486
|
+
open,
|
|
487
|
+
onOpenChange: setOpen,
|
|
488
|
+
title: "Refund £89.50 to James Okafor?",
|
|
489
|
+
description: "It goes back on the card he paid with and takes 5 to 10 working days to arrive.",
|
|
490
|
+
confirmLabel: "Refund £89.50",
|
|
491
|
+
onConfirm: async () => {
|
|
492
|
+
setError(void 0);
|
|
493
|
+
await wait(1100);
|
|
494
|
+
if (!failed) {
|
|
495
|
+
setFailed(true);
|
|
496
|
+
setError("The card issuer did not answer, so nothing was refunded. Try again.");
|
|
497
|
+
throw new Error("Refund failed");
|
|
498
|
+
}
|
|
499
|
+
setDone("Refunded £89.50.");
|
|
500
|
+
},
|
|
501
|
+
children: error ? /* @__PURE__ */ jsx("p", {
|
|
502
|
+
className: "dialog-error",
|
|
503
|
+
role: "alert",
|
|
504
|
+
children: error
|
|
505
|
+
}) : void 0
|
|
506
|
+
})
|
|
507
|
+
] });
|
|
508
|
+
}
|
|
509
|
+
function DeleteStoreConfirm() {
|
|
510
|
+
const [open, setOpen] = useState(false);
|
|
511
|
+
const [done, setDone] = useState("");
|
|
512
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
513
|
+
/* @__PURE__ */ jsx(Button, {
|
|
514
|
+
variant: "critical",
|
|
515
|
+
icon: /* @__PURE__ */ jsx(TrashIcon, {}),
|
|
516
|
+
onClick: () => setOpen(true),
|
|
517
|
+
children: "Delete store"
|
|
518
|
+
}),
|
|
519
|
+
/* @__PURE__ */ jsx("p", {
|
|
520
|
+
className: "dialog-status",
|
|
521
|
+
"aria-live": "polite",
|
|
522
|
+
children: done
|
|
523
|
+
}),
|
|
524
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
525
|
+
open,
|
|
526
|
+
onOpenChange: setOpen,
|
|
527
|
+
tone: "critical",
|
|
528
|
+
title: "Delete harbour-desk?",
|
|
529
|
+
description: "The store and its products leave Orbit. This cannot be undone.",
|
|
530
|
+
confirmPhrase: "harbour-desk",
|
|
531
|
+
confirmLabel: "Delete store",
|
|
532
|
+
onConfirm: () => setDone("Deleted harbour-desk.")
|
|
533
|
+
})
|
|
534
|
+
] });
|
|
535
|
+
}
|
|
536
|
+
function AcknowledgeNotice() {
|
|
537
|
+
const [open, setOpen] = useState(false);
|
|
538
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
539
|
+
onClick: () => setOpen(true),
|
|
540
|
+
children: "View the import"
|
|
541
|
+
}), /* @__PURE__ */ jsx(ConfirmDialog, {
|
|
542
|
+
open,
|
|
543
|
+
onOpenChange: setOpen,
|
|
544
|
+
title: "Products imported",
|
|
545
|
+
description: "12 products from Northgate Supply are now in your catalogue. 5 updated products you already sell.",
|
|
546
|
+
confirmLabel: "Got it",
|
|
547
|
+
showCancel: false,
|
|
548
|
+
onConfirm: () => {}
|
|
549
|
+
})] });
|
|
550
|
+
}
|
|
551
|
+
function CancelOrderConfirm() {
|
|
552
|
+
const [open, setOpen] = useState(false);
|
|
553
|
+
const [notify, setNotify] = useState(true);
|
|
554
|
+
const [restock, setRestock] = useState(true);
|
|
555
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
556
|
+
onClick: () => setOpen(true),
|
|
557
|
+
children: "Cancel order #1042"
|
|
558
|
+
}), /* @__PURE__ */ jsx(ConfirmDialog, {
|
|
559
|
+
open,
|
|
560
|
+
onOpenChange: setOpen,
|
|
561
|
+
tone: "critical",
|
|
562
|
+
title: "Cancel order #1042?",
|
|
563
|
+
description: "James Okafor gets £89.50 back on his card.",
|
|
564
|
+
confirmLabel: "Cancel order",
|
|
565
|
+
cancelLabel: "Keep order",
|
|
566
|
+
onConfirm: () => wait(1e3),
|
|
567
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
568
|
+
className: "dialog-switches",
|
|
569
|
+
children: [/* @__PURE__ */ jsx(Switch, {
|
|
570
|
+
label: "Email James to say so",
|
|
571
|
+
checked: notify,
|
|
572
|
+
onCheckedChange: setNotify
|
|
573
|
+
}), /* @__PURE__ */ jsx(Switch, {
|
|
574
|
+
label: "Put the 2 items back in stock",
|
|
575
|
+
checked: restock,
|
|
576
|
+
onCheckedChange: setRestock
|
|
577
|
+
})]
|
|
578
|
+
})
|
|
579
|
+
})] });
|
|
580
|
+
}
|
|
581
|
+
function PublishConfirm() {
|
|
582
|
+
const [open, setOpen] = useState(false);
|
|
583
|
+
const [publishing, setPublishing] = useState(false);
|
|
584
|
+
const publish = () => {
|
|
585
|
+
setPublishing(true);
|
|
586
|
+
window.setTimeout(() => {
|
|
587
|
+
setPublishing(false);
|
|
588
|
+
setOpen(false);
|
|
589
|
+
}, 1500);
|
|
590
|
+
};
|
|
591
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
592
|
+
variant: "inverse",
|
|
593
|
+
onClick: () => setOpen(true),
|
|
594
|
+
children: "Publish theme"
|
|
595
|
+
}), /* @__PURE__ */ jsx(ConfirmDialog, {
|
|
596
|
+
open,
|
|
597
|
+
onOpenChange: setOpen,
|
|
598
|
+
title: "Publish the Harbour theme?",
|
|
599
|
+
description: "Your store switches to it straight away. You can switch back from Themes at any time.",
|
|
600
|
+
confirmLabel: "Publish theme",
|
|
601
|
+
loading: publishing,
|
|
602
|
+
onConfirm: publish
|
|
603
|
+
})] });
|
|
604
|
+
}
|
|
605
|
+
function RenameFrame() {
|
|
606
|
+
const [open, setOpen] = useState(false);
|
|
607
|
+
const [name, setName] = useState("Home office");
|
|
608
|
+
const [saving, setSaving] = useState(false);
|
|
609
|
+
const [saved, setSaved] = useState("");
|
|
610
|
+
const save = async () => {
|
|
611
|
+
setSaving(true);
|
|
612
|
+
await wait(1400);
|
|
613
|
+
setSaving(false);
|
|
614
|
+
setSaved(`Renamed to "${name.trim()}".`);
|
|
615
|
+
setOpen(false);
|
|
616
|
+
};
|
|
617
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
618
|
+
/* @__PURE__ */ jsx(Button, {
|
|
619
|
+
onClick: () => setOpen(true),
|
|
620
|
+
children: "Rename collection"
|
|
621
|
+
}),
|
|
622
|
+
/* @__PURE__ */ jsx("p", {
|
|
623
|
+
className: "dialog-status",
|
|
624
|
+
"aria-live": "polite",
|
|
625
|
+
children: saved
|
|
626
|
+
}),
|
|
627
|
+
/* @__PURE__ */ jsx(DialogFrame, {
|
|
628
|
+
open,
|
|
629
|
+
onOpenChange: setOpen,
|
|
630
|
+
size: "sm",
|
|
631
|
+
title: "Rename collection",
|
|
632
|
+
description: "The collection's web address stays the same.",
|
|
633
|
+
busy: saving,
|
|
634
|
+
onSubmit: save,
|
|
635
|
+
actions: /* @__PURE__ */ jsx(Button, {
|
|
636
|
+
type: "submit",
|
|
637
|
+
variant: "primary",
|
|
638
|
+
loading: saving,
|
|
639
|
+
children: "Save"
|
|
640
|
+
}),
|
|
641
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
642
|
+
label: "Name",
|
|
643
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
644
|
+
value: name,
|
|
645
|
+
onChange: (event) => setName(event.target.value)
|
|
646
|
+
})
|
|
647
|
+
})
|
|
648
|
+
})
|
|
649
|
+
] });
|
|
650
|
+
}
|
|
651
|
+
/** More rows, so the bar example's list always outgrows the window and its body scrolls. */
|
|
652
|
+
var IMPORT_MORE = [
|
|
653
|
+
[
|
|
654
|
+
"Walnut monitor stand",
|
|
655
|
+
"STD-WAL-01",
|
|
656
|
+
"£64.00",
|
|
657
|
+
"New"
|
|
658
|
+
],
|
|
659
|
+
[
|
|
660
|
+
"Brass pen tray",
|
|
661
|
+
"PEN-BRS-01",
|
|
662
|
+
"£22.00",
|
|
663
|
+
"New"
|
|
664
|
+
],
|
|
665
|
+
[
|
|
666
|
+
"Oak laptop riser",
|
|
667
|
+
"RIS-OAK-01",
|
|
668
|
+
"£58.00",
|
|
669
|
+
"Update"
|
|
670
|
+
],
|
|
671
|
+
[
|
|
672
|
+
"Merino footrest",
|
|
673
|
+
"FTR-MER-01",
|
|
674
|
+
"£46.00",
|
|
675
|
+
"New"
|
|
676
|
+
],
|
|
677
|
+
[
|
|
678
|
+
"Leather desk mat",
|
|
679
|
+
"MAT-LTH-90",
|
|
680
|
+
"£69.00",
|
|
681
|
+
"Update"
|
|
682
|
+
],
|
|
683
|
+
[
|
|
684
|
+
"Ceramic plant pot, grey",
|
|
685
|
+
"PLT-CER-GR",
|
|
686
|
+
"£18.00",
|
|
687
|
+
"New"
|
|
688
|
+
],
|
|
689
|
+
[
|
|
690
|
+
"Acoustic panel, set of 4",
|
|
691
|
+
"ACO-PNL-04",
|
|
692
|
+
"£120.00",
|
|
693
|
+
"New"
|
|
694
|
+
],
|
|
695
|
+
[
|
|
696
|
+
"Task lamp, matt black",
|
|
697
|
+
"LMP-BLK-01",
|
|
698
|
+
"£54.00",
|
|
699
|
+
"Update"
|
|
700
|
+
]
|
|
701
|
+
];
|
|
702
|
+
/** An import review's rows. */
|
|
703
|
+
function ImportList({ rows = IMPORT }) {
|
|
704
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
705
|
+
className: "dialog-import",
|
|
706
|
+
children: rows.map(([name, sku, price, kind]) => /* @__PURE__ */ jsxs("li", { children: [
|
|
707
|
+
/* @__PURE__ */ jsx(Avatar, {
|
|
708
|
+
name,
|
|
709
|
+
shape: "square"
|
|
710
|
+
}),
|
|
711
|
+
/* @__PURE__ */ jsxs("span", {
|
|
712
|
+
className: "dialog-import__name",
|
|
713
|
+
children: [/* @__PURE__ */ jsx("span", { children: name }), /* @__PURE__ */ jsx("span", {
|
|
714
|
+
className: "dialog-import__sku",
|
|
715
|
+
children: sku
|
|
716
|
+
})]
|
|
717
|
+
}),
|
|
718
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
719
|
+
tone: kind === "New" ? "accent" : "neutral",
|
|
720
|
+
children: kind
|
|
721
|
+
}),
|
|
722
|
+
/* @__PURE__ */ jsx("span", {
|
|
723
|
+
className: "dialog-import__price",
|
|
724
|
+
children: price
|
|
725
|
+
})
|
|
726
|
+
] }, sku))
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
function BarDemo() {
|
|
730
|
+
const [bar, setBar] = useState("footer");
|
|
731
|
+
const [open, setOpen] = useState(false);
|
|
732
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
733
|
+
/* @__PURE__ */ jsx(SegmentedControl, {
|
|
734
|
+
"aria-label": "Bars",
|
|
735
|
+
value: bar,
|
|
736
|
+
onValueChange: (value) => setBar(value),
|
|
737
|
+
options: [
|
|
738
|
+
{
|
|
739
|
+
value: "none",
|
|
740
|
+
label: "No bars"
|
|
741
|
+
},
|
|
742
|
+
{
|
|
743
|
+
value: "footer",
|
|
744
|
+
label: "Footer bar"
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
value: "both",
|
|
748
|
+
label: "Header and footer"
|
|
749
|
+
}
|
|
750
|
+
]
|
|
751
|
+
}),
|
|
752
|
+
/* @__PURE__ */ jsx(Button, {
|
|
753
|
+
icon: /* @__PURE__ */ jsx(UploadSimpleIcon, {}),
|
|
754
|
+
onClick: () => setOpen(true),
|
|
755
|
+
children: "Review import"
|
|
756
|
+
}),
|
|
757
|
+
/* @__PURE__ */ jsx(DialogFrame, {
|
|
758
|
+
open,
|
|
759
|
+
onOpenChange: setOpen,
|
|
760
|
+
size: "lg",
|
|
761
|
+
bar: bar === "none" ? false : bar === "footer" ? "footer" : true,
|
|
762
|
+
title: "Import 20 products from Northgate Supply",
|
|
763
|
+
description: "12 are new to your catalogue and 8 update products you already sell.",
|
|
764
|
+
actions: /* @__PURE__ */ jsx(Button, {
|
|
765
|
+
variant: "primary",
|
|
766
|
+
onClick: () => setOpen(false),
|
|
767
|
+
children: "Import 20 products"
|
|
768
|
+
}),
|
|
769
|
+
children: /* @__PURE__ */ jsx(ImportList, { rows: [...IMPORT, ...IMPORT_MORE] })
|
|
770
|
+
})
|
|
771
|
+
] });
|
|
772
|
+
}
|
|
773
|
+
function ImportFrame() {
|
|
774
|
+
const [open, setOpen] = useState(false);
|
|
775
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
776
|
+
icon: /* @__PURE__ */ jsx(UploadSimpleIcon, {}),
|
|
777
|
+
onClick: () => setOpen(true),
|
|
778
|
+
children: "Import products"
|
|
779
|
+
}), /* @__PURE__ */ jsx(DialogFrame, {
|
|
780
|
+
open,
|
|
781
|
+
onOpenChange: setOpen,
|
|
782
|
+
size: "md",
|
|
783
|
+
bar: "footer",
|
|
784
|
+
title: "Import products",
|
|
785
|
+
description: "Upload a CSV file. Rows with a SKU you already sell update that product.",
|
|
786
|
+
start: /* @__PURE__ */ jsx(Button, {
|
|
787
|
+
variant: "ghost",
|
|
788
|
+
icon: /* @__PURE__ */ jsx(DownloadSimpleIcon, {}),
|
|
789
|
+
children: "Download sample"
|
|
790
|
+
}),
|
|
791
|
+
actions: /* @__PURE__ */ jsx(Button, {
|
|
792
|
+
variant: "primary",
|
|
793
|
+
icon: /* @__PURE__ */ jsx(UploadSimpleIcon, {}),
|
|
794
|
+
onClick: () => setOpen(false),
|
|
795
|
+
children: "Choose a file"
|
|
796
|
+
}),
|
|
797
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
798
|
+
className: "dialog-note",
|
|
799
|
+
children: "Columns can be in any order. Prices include VAT at 20%."
|
|
800
|
+
})
|
|
801
|
+
})] });
|
|
802
|
+
}
|
|
803
|
+
function CentredAcknowledgement() {
|
|
804
|
+
const [open, setOpen] = useState(false);
|
|
805
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
806
|
+
onClick: () => setOpen(true),
|
|
807
|
+
children: "Edit order #1043"
|
|
808
|
+
}), /* @__PURE__ */ jsx(DialogFrame, {
|
|
809
|
+
open,
|
|
810
|
+
onOpenChange: setOpen,
|
|
811
|
+
size: "sm",
|
|
812
|
+
align: "center",
|
|
813
|
+
hideClose: true,
|
|
814
|
+
title: "Priya is on this order",
|
|
815
|
+
description: "She opened it two minutes ago. If you both save, the last save wins.",
|
|
816
|
+
footer: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
817
|
+
onClick: () => setOpen(false),
|
|
818
|
+
children: "Wait"
|
|
819
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
820
|
+
variant: "primary",
|
|
821
|
+
onClick: () => setOpen(false),
|
|
822
|
+
children: "Carry on anyway"
|
|
823
|
+
})] })
|
|
824
|
+
})] });
|
|
825
|
+
}
|
|
826
|
+
function CollectionRow() {
|
|
827
|
+
const [name, setName] = useState("Home office");
|
|
828
|
+
const [editing, setEditing] = useState(false);
|
|
829
|
+
const [detailsOpen, setDetailsOpen] = useState(false);
|
|
830
|
+
const [deleteOpen, setDeleteOpen] = useState(false);
|
|
831
|
+
const field = useRef(null);
|
|
832
|
+
const actions = useRef(null);
|
|
833
|
+
useEffect(() => {
|
|
834
|
+
if (editing) field.current?.focus();
|
|
835
|
+
}, [editing]);
|
|
836
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
837
|
+
/* @__PURE__ */ jsxs("div", {
|
|
838
|
+
className: "dialog-row",
|
|
839
|
+
children: [
|
|
840
|
+
editing ? /* @__PURE__ */ jsx(Input, {
|
|
841
|
+
ref: field,
|
|
842
|
+
size: "sm",
|
|
843
|
+
"aria-label": "Collection name",
|
|
844
|
+
value: name,
|
|
845
|
+
onChange: (event) => setName(event.target.value),
|
|
846
|
+
onBlur: () => setEditing(false),
|
|
847
|
+
onKeyDown: (event) => {
|
|
848
|
+
if (event.key !== "Enter" && event.key !== "Escape") return;
|
|
849
|
+
actions.current?.focus();
|
|
850
|
+
setEditing(false);
|
|
851
|
+
}
|
|
852
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
853
|
+
className: "dialog-row__name",
|
|
854
|
+
children: name
|
|
855
|
+
}),
|
|
856
|
+
/* @__PURE__ */ jsx("span", {
|
|
857
|
+
className: "dialog-row__meta",
|
|
858
|
+
children: "24 products"
|
|
859
|
+
}),
|
|
860
|
+
/* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
861
|
+
asChild: true,
|
|
862
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
863
|
+
ref: actions,
|
|
864
|
+
label: `Actions for ${name}`,
|
|
865
|
+
size: "sm",
|
|
866
|
+
children: /* @__PURE__ */ jsx(DotsThreeIcon, { weight: "bold" })
|
|
867
|
+
})
|
|
868
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
869
|
+
align: "end",
|
|
870
|
+
children: [
|
|
871
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
872
|
+
icon: /* @__PURE__ */ jsx(PencilSimpleIcon, {}),
|
|
873
|
+
onSelect: () => setDetailsOpen(true),
|
|
874
|
+
children: "Edit details"
|
|
875
|
+
}),
|
|
876
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
877
|
+
icon: /* @__PURE__ */ jsx(CursorTextIcon, {}),
|
|
878
|
+
afterClose: () => setEditing(true),
|
|
879
|
+
children: "Rename here"
|
|
880
|
+
}),
|
|
881
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
882
|
+
icon: /* @__PURE__ */ jsx(TrashIcon, {}),
|
|
883
|
+
tone: "critical",
|
|
884
|
+
onSelect: () => setDeleteOpen(true),
|
|
885
|
+
children: "Delete collection"
|
|
886
|
+
})
|
|
887
|
+
]
|
|
888
|
+
})] })
|
|
889
|
+
]
|
|
890
|
+
}),
|
|
891
|
+
/* @__PURE__ */ jsx(DialogFrame, {
|
|
892
|
+
open: detailsOpen,
|
|
893
|
+
onOpenChange: setDetailsOpen,
|
|
894
|
+
size: "sm",
|
|
895
|
+
title: "Edit collection details",
|
|
896
|
+
description: "Shown on the collection page and in search results.",
|
|
897
|
+
actions: /* @__PURE__ */ jsx(Button, {
|
|
898
|
+
variant: "primary",
|
|
899
|
+
onClick: () => setDetailsOpen(false),
|
|
900
|
+
children: "Save"
|
|
901
|
+
}),
|
|
902
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
903
|
+
label: "Name",
|
|
904
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
905
|
+
value: name,
|
|
906
|
+
onChange: (event) => setName(event.target.value)
|
|
907
|
+
})
|
|
908
|
+
})
|
|
909
|
+
}),
|
|
910
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
911
|
+
open: deleteOpen,
|
|
912
|
+
onOpenChange: setDeleteOpen,
|
|
913
|
+
tone: "critical",
|
|
914
|
+
title: `Delete ${name}?`,
|
|
915
|
+
description: "The 24 products stay in your catalogue. Only the collection goes.",
|
|
916
|
+
confirmLabel: "Delete collection",
|
|
917
|
+
onConfirm: () => wait(1e3)
|
|
918
|
+
})
|
|
919
|
+
] });
|
|
920
|
+
}
|
|
921
|
+
var TAGS = [
|
|
922
|
+
"Sale",
|
|
923
|
+
"New in",
|
|
924
|
+
"Best seller",
|
|
925
|
+
"Walnut",
|
|
926
|
+
"Oak",
|
|
927
|
+
"Brass",
|
|
928
|
+
"Felt",
|
|
929
|
+
"Linen",
|
|
930
|
+
"Ergonomic",
|
|
931
|
+
"Standing desk",
|
|
932
|
+
"Lighting",
|
|
933
|
+
"Storage",
|
|
934
|
+
"Cable management",
|
|
935
|
+
"Gift idea",
|
|
936
|
+
"Back in stock",
|
|
937
|
+
"Last few",
|
|
938
|
+
"Made in the UK",
|
|
939
|
+
"Recycled",
|
|
940
|
+
"FSC certified",
|
|
941
|
+
"Home office",
|
|
942
|
+
"Studio",
|
|
943
|
+
"Boardroom"
|
|
944
|
+
];
|
|
945
|
+
function PickersDialog() {
|
|
946
|
+
const [open, setOpen] = useState(false);
|
|
947
|
+
const [zone, setZone] = useState("mainland");
|
|
948
|
+
const [day, setDay] = useState(null);
|
|
949
|
+
const [tags, setTags] = useState(["Sale"]);
|
|
950
|
+
const toggle = (tag, on) => setTags((current) => on ? [...current, tag] : current.filter((t) => t !== tag));
|
|
951
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
952
|
+
onClick: () => setOpen(true),
|
|
953
|
+
children: "Schedule a delivery"
|
|
954
|
+
}), /* @__PURE__ */ jsxs(DialogFrame, {
|
|
955
|
+
open,
|
|
956
|
+
onOpenChange: setOpen,
|
|
957
|
+
title: "Schedule a delivery",
|
|
958
|
+
description: "Choose where it goes and when it should leave the warehouse.",
|
|
959
|
+
bodyClassName: "dialog-fields",
|
|
960
|
+
actions: /* @__PURE__ */ jsx(Button, {
|
|
961
|
+
variant: "primary",
|
|
962
|
+
onClick: () => setOpen(false),
|
|
963
|
+
children: "Schedule"
|
|
964
|
+
}),
|
|
965
|
+
children: [
|
|
966
|
+
/* @__PURE__ */ jsx(Field, {
|
|
967
|
+
label: "Delivery zone",
|
|
968
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
969
|
+
value: zone,
|
|
970
|
+
onValueChange: setZone,
|
|
971
|
+
options: [
|
|
972
|
+
{
|
|
973
|
+
value: "mainland",
|
|
974
|
+
label: "UK mainland",
|
|
975
|
+
hint: "£7.95"
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
value: "highlands",
|
|
979
|
+
label: "Highlands and islands",
|
|
980
|
+
hint: "£14.50"
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
value: "ni",
|
|
984
|
+
label: "Northern Ireland",
|
|
985
|
+
hint: "£14.50"
|
|
986
|
+
}
|
|
987
|
+
]
|
|
988
|
+
})
|
|
989
|
+
}),
|
|
990
|
+
/* @__PURE__ */ jsx(Field, {
|
|
991
|
+
label: "Leaves the warehouse",
|
|
992
|
+
children: /* @__PURE__ */ jsx(DatePicker, {
|
|
993
|
+
value: day,
|
|
994
|
+
onChange: setDay,
|
|
995
|
+
placeholder: "Pick a day",
|
|
996
|
+
clearable: true
|
|
997
|
+
})
|
|
998
|
+
}),
|
|
999
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1000
|
+
className: "dialog-group",
|
|
1001
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1002
|
+
className: "dialog-group__label",
|
|
1003
|
+
"aria-hidden": "true",
|
|
1004
|
+
children: "Product tags"
|
|
1005
|
+
}), /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
1006
|
+
asChild: true,
|
|
1007
|
+
children: /* @__PURE__ */ jsx(Button, { children: tags.length ? `${tags.length} tagged` : "Add tags" })
|
|
1008
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
1009
|
+
padding: "sm",
|
|
1010
|
+
width: 260,
|
|
1011
|
+
"aria-label": "Product tags",
|
|
1012
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1013
|
+
className: "dialog-tags",
|
|
1014
|
+
children: TAGS.map((tag) => /* @__PURE__ */ jsx(Checkbox, {
|
|
1015
|
+
label: tag,
|
|
1016
|
+
checked: tags.includes(tag),
|
|
1017
|
+
onCheckedChange: (on) => toggle(tag, on)
|
|
1018
|
+
}, tag))
|
|
1019
|
+
})
|
|
1020
|
+
})] })]
|
|
1021
|
+
})
|
|
1022
|
+
]
|
|
1023
|
+
})] });
|
|
1024
|
+
}
|
|
1025
|
+
/** The same pickers in a sheet: it has a layer of its own, so they open inside it and scroll under the wheel. */
|
|
1026
|
+
function PickersSheet() {
|
|
1027
|
+
const [open, setOpen] = useState(false);
|
|
1028
|
+
const [zone, setZone] = useState("mainland");
|
|
1029
|
+
const [tags, setTags] = useState(["Sale"]);
|
|
1030
|
+
const toggle = (tag, on) => setTags((current) => on ? [...current, tag] : current.filter((t) => t !== tag));
|
|
1031
|
+
return /* @__PURE__ */ jsxs(Sheet, {
|
|
1032
|
+
open,
|
|
1033
|
+
onOpenChange: setOpen,
|
|
1034
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
1035
|
+
onClick: () => setOpen(true),
|
|
1036
|
+
children: "Filter the list"
|
|
1037
|
+
}), /* @__PURE__ */ jsxs(SheetContent, {
|
|
1038
|
+
size: "sm",
|
|
1039
|
+
children: [
|
|
1040
|
+
/* @__PURE__ */ jsxs(SheetHeader, { children: [/* @__PURE__ */ jsx(SheetTitle, { children: "Filter the list" }), /* @__PURE__ */ jsx(SheetDescription, { children: "Narrow the orders by where they go and what they hold." })] }),
|
|
1041
|
+
/* @__PURE__ */ jsxs(SheetBody, {
|
|
1042
|
+
className: "dialog-fields",
|
|
1043
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
1044
|
+
label: "Delivery zone",
|
|
1045
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
1046
|
+
value: zone,
|
|
1047
|
+
onValueChange: setZone,
|
|
1048
|
+
options: [
|
|
1049
|
+
{
|
|
1050
|
+
value: "mainland",
|
|
1051
|
+
label: "UK mainland",
|
|
1052
|
+
hint: "£7.95"
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
value: "highlands",
|
|
1056
|
+
label: "Highlands and islands",
|
|
1057
|
+
hint: "£14.50"
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
value: "ni",
|
|
1061
|
+
label: "Northern Ireland",
|
|
1062
|
+
hint: "£14.50"
|
|
1063
|
+
}
|
|
1064
|
+
]
|
|
1065
|
+
})
|
|
1066
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1067
|
+
className: "dialog-group",
|
|
1068
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1069
|
+
className: "dialog-group__label",
|
|
1070
|
+
"aria-hidden": "true",
|
|
1071
|
+
children: "Product tags"
|
|
1072
|
+
}), /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
1073
|
+
asChild: true,
|
|
1074
|
+
children: /* @__PURE__ */ jsx(Button, { children: tags.length ? `${tags.length} tagged` : "Add tags" })
|
|
1075
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
1076
|
+
padding: "sm",
|
|
1077
|
+
width: 260,
|
|
1078
|
+
"aria-label": "Product tags in the sheet",
|
|
1079
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1080
|
+
className: "dialog-tags",
|
|
1081
|
+
children: TAGS.map((tag) => /* @__PURE__ */ jsx(Checkbox, {
|
|
1082
|
+
label: tag,
|
|
1083
|
+
checked: tags.includes(tag),
|
|
1084
|
+
onCheckedChange: (on) => toggle(tag, on)
|
|
1085
|
+
}, tag))
|
|
1086
|
+
})
|
|
1087
|
+
})] })]
|
|
1088
|
+
})]
|
|
1089
|
+
}),
|
|
1090
|
+
/* @__PURE__ */ jsx(SheetFooter, { children: /* @__PURE__ */ jsx(SheetClose, {
|
|
1091
|
+
asChild: true,
|
|
1092
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
1093
|
+
variant: "primary",
|
|
1094
|
+
children: "Apply"
|
|
1095
|
+
})
|
|
1096
|
+
}) })
|
|
1097
|
+
]
|
|
1098
|
+
})]
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
function StillPage({ children }) {
|
|
1102
|
+
return /* @__PURE__ */ jsxs(SpecimenFrame, {
|
|
1103
|
+
className: "dialog-still",
|
|
1104
|
+
children: [
|
|
1105
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1106
|
+
className: "dialog-still__page",
|
|
1107
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1108
|
+
className: "dialog-still__bar",
|
|
1109
|
+
"data-strong": "",
|
|
1110
|
+
style: { width: "34%" }
|
|
1111
|
+
}), [
|
|
1112
|
+
62,
|
|
1113
|
+
48,
|
|
1114
|
+
55,
|
|
1115
|
+
40,
|
|
1116
|
+
58
|
|
1117
|
+
].map((w, i) => /* @__PURE__ */ jsxs("span", {
|
|
1118
|
+
className: "dialog-still__row",
|
|
1119
|
+
children: [/* @__PURE__ */ jsx("span", { className: "dialog-still__tile" }), /* @__PURE__ */ jsx("span", {
|
|
1120
|
+
className: "dialog-still__bar",
|
|
1121
|
+
style: { width: `${w}%` }
|
|
1122
|
+
})]
|
|
1123
|
+
}, i))]
|
|
1124
|
+
}),
|
|
1125
|
+
/* @__PURE__ */ jsx("div", { className: "o-dialog-overlay" }),
|
|
1126
|
+
children
|
|
1127
|
+
]
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
function ConfirmStill() {
|
|
1131
|
+
return /* @__PURE__ */ jsx(StillPage, { children: /* @__PURE__ */ jsxs(DialogSheet, {
|
|
1132
|
+
size: "sm",
|
|
1133
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1134
|
+
className: "o-dialog__header",
|
|
1135
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1136
|
+
className: "o-dialog__title",
|
|
1137
|
+
children: "Delete 3 products?"
|
|
1138
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
1139
|
+
className: "o-dialog__description",
|
|
1140
|
+
children: "Arden ergonomic chair, Walnut desk riser and Brass desk lamp leave your catalogue. Past orders keep their line items."
|
|
1141
|
+
})]
|
|
1142
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1143
|
+
className: "o-dialog__footer",
|
|
1144
|
+
children: [/* @__PURE__ */ jsx(Button, { children: "Cancel" }), /* @__PURE__ */ jsx(Button, {
|
|
1145
|
+
variant: "critical",
|
|
1146
|
+
children: "Delete products"
|
|
1147
|
+
})]
|
|
1148
|
+
})]
|
|
1149
|
+
}) });
|
|
1150
|
+
}
|
|
1151
|
+
function FormStill() {
|
|
1152
|
+
return /* @__PURE__ */ jsx(StillPage, { children: /* @__PURE__ */ jsxs(DialogSheet, {
|
|
1153
|
+
close: true,
|
|
1154
|
+
children: [
|
|
1155
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1156
|
+
className: "o-dialog__header",
|
|
1157
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1158
|
+
className: "o-dialog__title",
|
|
1159
|
+
children: "Invite a staff member"
|
|
1160
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
1161
|
+
className: "o-dialog__description",
|
|
1162
|
+
children: "They get an email with a link to join Harbour Desk Co. Invites run out after 7 days."
|
|
1163
|
+
})]
|
|
1164
|
+
}),
|
|
1165
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1166
|
+
className: "o-dialog__body dialog-fields",
|
|
1167
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
1168
|
+
label: "Email address",
|
|
1169
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
1170
|
+
type: "email",
|
|
1171
|
+
icon: /* @__PURE__ */ jsx(EnvelopeSimpleIcon, {}),
|
|
1172
|
+
defaultValue: "tom.hughes@example.co.uk"
|
|
1173
|
+
})
|
|
1174
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1175
|
+
className: "dialog-group",
|
|
1176
|
+
children: [
|
|
1177
|
+
/* @__PURE__ */ jsx("span", {
|
|
1178
|
+
className: "dialog-group__label",
|
|
1179
|
+
children: "Access"
|
|
1180
|
+
}),
|
|
1181
|
+
/* @__PURE__ */ jsx(SegmentedControl, {
|
|
1182
|
+
"aria-label": "Access",
|
|
1183
|
+
fullWidth: true,
|
|
1184
|
+
defaultValue: "orders",
|
|
1185
|
+
options: [
|
|
1186
|
+
{
|
|
1187
|
+
value: "full",
|
|
1188
|
+
label: "Full access"
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
value: "orders",
|
|
1192
|
+
label: "Orders only"
|
|
1193
|
+
},
|
|
1194
|
+
{
|
|
1195
|
+
value: "view",
|
|
1196
|
+
label: "View only"
|
|
1197
|
+
}
|
|
1198
|
+
]
|
|
1199
|
+
}),
|
|
1200
|
+
/* @__PURE__ */ jsx("span", {
|
|
1201
|
+
className: "dialog-group__hint",
|
|
1202
|
+
children: ACCESS_HINT.orders
|
|
1203
|
+
})
|
|
1204
|
+
]
|
|
1205
|
+
})]
|
|
1206
|
+
}),
|
|
1207
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1208
|
+
className: "o-dialog__footer",
|
|
1209
|
+
children: [/* @__PURE__ */ jsx(Button, { children: "Cancel" }), /* @__PURE__ */ jsx(Button, {
|
|
1210
|
+
variant: "primary",
|
|
1211
|
+
children: "Send invite"
|
|
1212
|
+
})]
|
|
1213
|
+
})
|
|
1214
|
+
]
|
|
1215
|
+
}) });
|
|
1216
|
+
}
|
|
1217
|
+
function RateFields() {
|
|
1218
|
+
return /* @__PURE__ */ jsxs(DialogBody, {
|
|
1219
|
+
className: "dialog-fields",
|
|
1220
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
1221
|
+
label: "Name",
|
|
1222
|
+
children: /* @__PURE__ */ jsx(Input, { defaultValue: "Next working day" })
|
|
1223
|
+
}), /* @__PURE__ */ jsx(Field, {
|
|
1224
|
+
label: "Price",
|
|
1225
|
+
hint: "Includes VAT at 20%",
|
|
1226
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
1227
|
+
prefix: "£",
|
|
1228
|
+
inputMode: "decimal",
|
|
1229
|
+
defaultValue: "7.95"
|
|
1230
|
+
})
|
|
1231
|
+
})]
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
function BarStill({ bar, label }) {
|
|
1235
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
1236
|
+
className: "dialog-variant",
|
|
1237
|
+
children: [/* @__PURE__ */ jsx(SpecimenFrame, { children: /* @__PURE__ */ jsxs(DialogSheet, {
|
|
1238
|
+
size: "sm",
|
|
1239
|
+
bar,
|
|
1240
|
+
close: true,
|
|
1241
|
+
width: "100%",
|
|
1242
|
+
style: { boxShadow: "var(--o-shadow-2)" },
|
|
1243
|
+
children: [
|
|
1244
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx("div", {
|
|
1245
|
+
className: "o-dialog__title",
|
|
1246
|
+
children: "Add a delivery rate"
|
|
1247
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
1248
|
+
className: "o-dialog__description",
|
|
1249
|
+
children: "Customers in the UK mainland zone see it at checkout."
|
|
1250
|
+
})] }),
|
|
1251
|
+
/* @__PURE__ */ jsx(RateFields, {}),
|
|
1252
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, { children: "Cancel" }), /* @__PURE__ */ jsx(Button, {
|
|
1253
|
+
variant: "primary",
|
|
1254
|
+
children: "Add rate"
|
|
1255
|
+
})] })
|
|
1256
|
+
]
|
|
1257
|
+
}) }), /* @__PURE__ */ jsx("figcaption", {
|
|
1258
|
+
className: "dialog-variant__label",
|
|
1259
|
+
children: label
|
|
1260
|
+
})]
|
|
1261
|
+
});
|
|
1262
|
+
}
|
|
1263
|
+
function BarStills() {
|
|
1264
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1265
|
+
className: "dialog-variants",
|
|
1266
|
+
children: [
|
|
1267
|
+
/* @__PURE__ */ jsx(BarStill, { label: "Plain, the default" }),
|
|
1268
|
+
/* @__PURE__ */ jsx(BarStill, {
|
|
1269
|
+
bar: "footer",
|
|
1270
|
+
label: "Footer bar"
|
|
1271
|
+
}),
|
|
1272
|
+
/* @__PURE__ */ jsx(BarStill, {
|
|
1273
|
+
bar: true,
|
|
1274
|
+
label: "Header and footer bars"
|
|
1275
|
+
})
|
|
1276
|
+
]
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1279
|
+
function FooterStill({ label, title, description, align, centred, phone, wide, start, children }) {
|
|
1280
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
1281
|
+
className: "dialog-variant",
|
|
1282
|
+
"data-wide": wide ? "" : void 0,
|
|
1283
|
+
children: [/* @__PURE__ */ jsx(SpecimenFrame, { children: /* @__PURE__ */ jsx("div", {
|
|
1284
|
+
className: phone ? "dialog-phone" : void 0,
|
|
1285
|
+
children: /* @__PURE__ */ jsxs(DialogSheet, {
|
|
1286
|
+
size: wide ? "md" : "sm",
|
|
1287
|
+
bar: "footer",
|
|
1288
|
+
width: phone ? 320 : "100%",
|
|
1289
|
+
style: {
|
|
1290
|
+
boxShadow: "var(--o-shadow-2)",
|
|
1291
|
+
marginInline: "auto"
|
|
1292
|
+
},
|
|
1293
|
+
children: [/* @__PURE__ */ jsxs(DialogHeader, {
|
|
1294
|
+
align: centred ? "center" : "start",
|
|
1295
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1296
|
+
className: "o-dialog__title",
|
|
1297
|
+
children: title
|
|
1298
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
1299
|
+
className: "o-dialog__description",
|
|
1300
|
+
children: description
|
|
1301
|
+
})]
|
|
1302
|
+
}), /* @__PURE__ */ jsx(DialogFooter, {
|
|
1303
|
+
align,
|
|
1304
|
+
start,
|
|
1305
|
+
children
|
|
1306
|
+
})]
|
|
1307
|
+
})
|
|
1308
|
+
}) }), /* @__PURE__ */ jsx("figcaption", {
|
|
1309
|
+
className: "dialog-variant__label",
|
|
1310
|
+
children: label
|
|
1311
|
+
})]
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1314
|
+
function FooterStills() {
|
|
1315
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1316
|
+
className: "dialog-variants",
|
|
1317
|
+
children: [
|
|
1318
|
+
/* @__PURE__ */ jsxs(FooterStill, {
|
|
1319
|
+
label: "End, the default",
|
|
1320
|
+
title: "Delete this rate?",
|
|
1321
|
+
description: "Customers stop seeing it at checkout.",
|
|
1322
|
+
children: [/* @__PURE__ */ jsx(Button, { children: "Keep it" }), /* @__PURE__ */ jsx(Button, {
|
|
1323
|
+
variant: "critical",
|
|
1324
|
+
children: "Delete rate"
|
|
1325
|
+
})]
|
|
1326
|
+
}),
|
|
1327
|
+
/* @__PURE__ */ jsxs(FooterStill, {
|
|
1328
|
+
label: "With a start slot",
|
|
1329
|
+
title: "Import products",
|
|
1330
|
+
description: "Upload a CSV file of up to 5,000 rows.",
|
|
1331
|
+
wide: true,
|
|
1332
|
+
start: /* @__PURE__ */ jsx(Button, {
|
|
1333
|
+
variant: "ghost",
|
|
1334
|
+
children: "Download sample"
|
|
1335
|
+
}),
|
|
1336
|
+
children: [/* @__PURE__ */ jsx(Button, { children: "Cancel" }), /* @__PURE__ */ jsx(Button, {
|
|
1337
|
+
variant: "primary",
|
|
1338
|
+
children: "Choose a file"
|
|
1339
|
+
})]
|
|
1340
|
+
}),
|
|
1341
|
+
/* @__PURE__ */ jsxs(FooterStill, {
|
|
1342
|
+
label: "Centred",
|
|
1343
|
+
title: "Priya is on this order",
|
|
1344
|
+
description: "If you both save, the last save wins.",
|
|
1345
|
+
align: "center",
|
|
1346
|
+
centred: true,
|
|
1347
|
+
children: [/* @__PURE__ */ jsx(Button, { children: "Wait" }), /* @__PURE__ */ jsx(Button, {
|
|
1348
|
+
variant: "primary",
|
|
1349
|
+
children: "Carry on anyway"
|
|
1350
|
+
})]
|
|
1351
|
+
}),
|
|
1352
|
+
/* @__PURE__ */ jsxs(FooterStill, {
|
|
1353
|
+
label: "Spread",
|
|
1354
|
+
title: "Delivery rates, step 2 of 3",
|
|
1355
|
+
description: "Name the rate and set its price.",
|
|
1356
|
+
align: "between",
|
|
1357
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
1358
|
+
variant: "ghost",
|
|
1359
|
+
children: "Back"
|
|
1360
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
1361
|
+
variant: "primary",
|
|
1362
|
+
children: "Next"
|
|
1363
|
+
})]
|
|
1364
|
+
}),
|
|
1365
|
+
/* @__PURE__ */ jsxs(FooterStill, {
|
|
1366
|
+
label: "On a phone",
|
|
1367
|
+
title: "Import products",
|
|
1368
|
+
description: "Upload a CSV file of up to 5,000 rows.",
|
|
1369
|
+
phone: true,
|
|
1370
|
+
start: /* @__PURE__ */ jsx(Button, {
|
|
1371
|
+
variant: "ghost",
|
|
1372
|
+
children: "Download sample"
|
|
1373
|
+
}),
|
|
1374
|
+
children: [/* @__PURE__ */ jsx(Button, { children: "Cancel" }), /* @__PURE__ */ jsx(Button, {
|
|
1375
|
+
variant: "primary",
|
|
1376
|
+
children: "Choose a file"
|
|
1377
|
+
})]
|
|
1378
|
+
})
|
|
1379
|
+
]
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
function DoDontSheet({ title, description, cancel, confirm }) {
|
|
1383
|
+
return /* @__PURE__ */ jsx(SpecimenFrame, {
|
|
1384
|
+
style: { width: "100%" },
|
|
1385
|
+
children: /* @__PURE__ */ jsxs(DialogSheet, {
|
|
1386
|
+
size: "sm",
|
|
1387
|
+
width: "100%",
|
|
1388
|
+
style: { boxShadow: "var(--o-shadow-2)" },
|
|
1389
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1390
|
+
className: "o-dialog__header",
|
|
1391
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1392
|
+
className: "o-dialog__title",
|
|
1393
|
+
children: title
|
|
1394
|
+
}), description ? /* @__PURE__ */ jsx("p", {
|
|
1395
|
+
className: "o-dialog__description",
|
|
1396
|
+
children: description
|
|
1397
|
+
}) : null]
|
|
1398
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1399
|
+
className: "o-dialog__footer",
|
|
1400
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
1401
|
+
size: "sm",
|
|
1402
|
+
children: cancel
|
|
1403
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
1404
|
+
size: "sm",
|
|
1405
|
+
variant: "critical",
|
|
1406
|
+
children: confirm
|
|
1407
|
+
})]
|
|
1408
|
+
})]
|
|
1409
|
+
})
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
function ConfirmTonesLite() {
|
|
1413
|
+
const [open, setOpen] = useState(false);
|
|
1414
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
1415
|
+
variant: "critical",
|
|
1416
|
+
icon: /* @__PURE__ */ jsx(TrashIcon, {}),
|
|
1417
|
+
onClick: () => setOpen(true),
|
|
1418
|
+
children: "Delete 3 products"
|
|
1419
|
+
}), /* @__PURE__ */ jsx(ConfirmDialog, {
|
|
1420
|
+
open,
|
|
1421
|
+
onOpenChange: setOpen,
|
|
1422
|
+
tone: "critical",
|
|
1423
|
+
title: "Delete 3 products?",
|
|
1424
|
+
description: "Arden ergonomic chair, Walnut desk riser and Brass desk lamp leave your catalogue. Past orders keep their line items.",
|
|
1425
|
+
confirmLabel: "Delete products",
|
|
1426
|
+
onConfirm: () => wait(1400)
|
|
1427
|
+
})] });
|
|
1428
|
+
}
|
|
1429
|
+
var TEMPLATES = [
|
|
1430
|
+
"Spring launch",
|
|
1431
|
+
"Clearance week",
|
|
1432
|
+
"Trade counter",
|
|
1433
|
+
"New arrivals",
|
|
1434
|
+
"Gift guide",
|
|
1435
|
+
"Summer sale"
|
|
1436
|
+
];
|
|
1437
|
+
function LibraryDialog() {
|
|
1438
|
+
const [open, setOpen] = useState(false);
|
|
1439
|
+
const [help, setHelp] = useState(false);
|
|
1440
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
1441
|
+
onClick: () => setOpen(true),
|
|
1442
|
+
children: "Open templates library"
|
|
1443
|
+
}), /* @__PURE__ */ jsxs(DialogFrame, {
|
|
1444
|
+
open,
|
|
1445
|
+
onOpenChange: setOpen,
|
|
1446
|
+
size: "xl",
|
|
1447
|
+
bar: true,
|
|
1448
|
+
title: "Templates library",
|
|
1449
|
+
description: "Start a page from one of Harbour Desk Co's templates.",
|
|
1450
|
+
maximisable: true,
|
|
1451
|
+
maximiseKey: "docs-templates-library",
|
|
1452
|
+
closeHint: true,
|
|
1453
|
+
headerActions: /* @__PURE__ */ jsx(Button, {
|
|
1454
|
+
size: "sm",
|
|
1455
|
+
variant: "ghost",
|
|
1456
|
+
onClick: () => setHelp((shown) => !shown),
|
|
1457
|
+
children: help ? "Hide help" : "Help"
|
|
1458
|
+
}),
|
|
1459
|
+
actions: /* @__PURE__ */ jsx(Button, {
|
|
1460
|
+
variant: "primary",
|
|
1461
|
+
onClick: () => setOpen(false),
|
|
1462
|
+
children: "Use template"
|
|
1463
|
+
}),
|
|
1464
|
+
children: [help ? /* @__PURE__ */ jsx("p", {
|
|
1465
|
+
className: "dialog-status",
|
|
1466
|
+
children: "Pick a template, then edit it like any page. Nothing is published until you say so."
|
|
1467
|
+
}) : null, /* @__PURE__ */ jsx("div", {
|
|
1468
|
+
className: "dialog-templates",
|
|
1469
|
+
children: TEMPLATES.map((name) => /* @__PURE__ */ jsxs("div", {
|
|
1470
|
+
className: "dialog-templates__tile",
|
|
1471
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1472
|
+
className: "dialog-templates__thumb",
|
|
1473
|
+
"aria-hidden": "true"
|
|
1474
|
+
}), name]
|
|
1475
|
+
}, name))
|
|
1476
|
+
})]
|
|
1477
|
+
})] });
|
|
1478
|
+
}
|
|
1479
|
+
function SuspendDialog() {
|
|
1480
|
+
const [open, setOpen] = useState(false);
|
|
1481
|
+
const [password, setPassword] = useState("");
|
|
1482
|
+
const [status, setStatus] = useState("");
|
|
1483
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1484
|
+
/* @__PURE__ */ jsx(Button, {
|
|
1485
|
+
variant: "critical-outline",
|
|
1486
|
+
onClick: () => setOpen(true),
|
|
1487
|
+
children: "Suspend supplier"
|
|
1488
|
+
}),
|
|
1489
|
+
/* @__PURE__ */ jsx("p", {
|
|
1490
|
+
className: "dialog-status",
|
|
1491
|
+
"aria-live": "polite",
|
|
1492
|
+
children: status
|
|
1493
|
+
}),
|
|
1494
|
+
/* @__PURE__ */ jsx(DialogFrame, {
|
|
1495
|
+
open,
|
|
1496
|
+
onOpenChange: (next) => {
|
|
1497
|
+
setOpen(next);
|
|
1498
|
+
if (!next) setPassword("");
|
|
1499
|
+
},
|
|
1500
|
+
size: "sm",
|
|
1501
|
+
title: "Suspend Arden Office Supply?",
|
|
1502
|
+
description: "Their listings come off every store until you restore them. Type orbit as the password to see it go through.",
|
|
1503
|
+
submitLabel: "Suspend supplier",
|
|
1504
|
+
submitTone: "critical",
|
|
1505
|
+
submitDisabled: password === "",
|
|
1506
|
+
dismissOnOutsideClick: false,
|
|
1507
|
+
noValidate: true,
|
|
1508
|
+
onSubmit: async () => {
|
|
1509
|
+
await wait(900);
|
|
1510
|
+
if (password !== "orbit") throw new Error("Incorrect password. Try again.");
|
|
1511
|
+
setStatus("Arden Office Supply suspended.");
|
|
1512
|
+
setOpen(false);
|
|
1513
|
+
setPassword("");
|
|
1514
|
+
},
|
|
1515
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
1516
|
+
label: "Your admin password",
|
|
1517
|
+
hint: "A step-up check: it confirms it is you, not a stolen session.",
|
|
1518
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
1519
|
+
type: "password",
|
|
1520
|
+
value: password,
|
|
1521
|
+
autoComplete: "current-password",
|
|
1522
|
+
onChange: (event) => setPassword(event.target.value)
|
|
1523
|
+
})
|
|
1524
|
+
})
|
|
1525
|
+
})
|
|
1526
|
+
] });
|
|
1527
|
+
}
|
|
1528
|
+
function ApiKeyDialog() {
|
|
1529
|
+
const [open, setOpen] = useState(false);
|
|
1530
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
1531
|
+
onClick: () => setOpen(true),
|
|
1532
|
+
children: "Create API key"
|
|
1533
|
+
}), /* @__PURE__ */ jsx(DialogFrame, {
|
|
1534
|
+
open,
|
|
1535
|
+
onOpenChange: setOpen,
|
|
1536
|
+
size: "sm",
|
|
1537
|
+
title: "Your new API key",
|
|
1538
|
+
description: "Copy it now: it is shown this once. Escape and a click outside will not close this dialog.",
|
|
1539
|
+
dismissable: false,
|
|
1540
|
+
hideCancel: true,
|
|
1541
|
+
submitLabel: "I have copied it",
|
|
1542
|
+
onSubmit: () => setOpen(false),
|
|
1543
|
+
children: /* @__PURE__ */ jsx("code", {
|
|
1544
|
+
className: "dialog-key",
|
|
1545
|
+
children: "orb_live_4f9c2a7e18b04d6c"
|
|
1546
|
+
})
|
|
1547
|
+
})] });
|
|
1548
|
+
}
|
|
1549
|
+
function RollbackConfirm() {
|
|
1550
|
+
const [open, setOpen] = useState(false);
|
|
1551
|
+
const [approve, setApprove] = useState(false);
|
|
1552
|
+
const [status, setStatus] = useState("");
|
|
1553
|
+
const tries = useRef(0);
|
|
1554
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1555
|
+
/* @__PURE__ */ jsx(Button, {
|
|
1556
|
+
variant: "warning-outline",
|
|
1557
|
+
icon: /* @__PURE__ */ jsx(ArrowCounterClockwiseIcon, {}),
|
|
1558
|
+
onClick: () => setOpen(true),
|
|
1559
|
+
children: "Roll back"
|
|
1560
|
+
}),
|
|
1561
|
+
/* @__PURE__ */ jsx(Button, {
|
|
1562
|
+
variant: "positive",
|
|
1563
|
+
icon: /* @__PURE__ */ jsx(CheckIcon, {}),
|
|
1564
|
+
onClick: () => setApprove(true),
|
|
1565
|
+
children: "Approve theme"
|
|
1566
|
+
}),
|
|
1567
|
+
/* @__PURE__ */ jsx("p", {
|
|
1568
|
+
className: "dialog-status",
|
|
1569
|
+
"aria-live": "polite",
|
|
1570
|
+
children: status
|
|
1571
|
+
}),
|
|
1572
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
1573
|
+
open,
|
|
1574
|
+
onOpenChange: setOpen,
|
|
1575
|
+
tone: "warning",
|
|
1576
|
+
title: "Roll back to version 4?",
|
|
1577
|
+
description: "The live theme returns to version 4. The first try fails here, so you can see what a failure says.",
|
|
1578
|
+
confirmLabel: "Roll back",
|
|
1579
|
+
onConfirm: () => wait(900).then(() => {
|
|
1580
|
+
tries.current += 1;
|
|
1581
|
+
if (tries.current % 2 === 1) throw new Error("Version 4 is still being published. Try again in a moment.");
|
|
1582
|
+
setStatus("Rolled back to version 4.");
|
|
1583
|
+
})
|
|
1584
|
+
}),
|
|
1585
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
1586
|
+
open: approve,
|
|
1587
|
+
onOpenChange: setApprove,
|
|
1588
|
+
tone: "positive",
|
|
1589
|
+
title: "Approve Concourse for the theme store?",
|
|
1590
|
+
description: "Merchants can install it from today.",
|
|
1591
|
+
confirmLabel: "Approve",
|
|
1592
|
+
onConfirm: () => wait(700).then(() => setStatus("Concourse approved."))
|
|
1593
|
+
})
|
|
1594
|
+
] });
|
|
1595
|
+
}
|
|
1596
|
+
//#endregion
|
|
1597
|
+
//#region src/pages/components/dialog.tsx
|
|
1598
|
+
function Preview() {
|
|
1599
|
+
return /* @__PURE__ */ jsxs(DialogSheet, {
|
|
1600
|
+
size: "sm",
|
|
1601
|
+
width: 224,
|
|
1602
|
+
style: {
|
|
1603
|
+
"--o-dialog-pad": "16px",
|
|
1604
|
+
"--o-dialog-title-fs": "1rem"
|
|
1605
|
+
},
|
|
1606
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1607
|
+
className: "o-dialog__header",
|
|
1608
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1609
|
+
className: "o-dialog__title",
|
|
1610
|
+
children: "Delete 3 products?"
|
|
1611
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
1612
|
+
className: "o-dialog__description",
|
|
1613
|
+
style: { fontSize: "var(--o-text-sm)" },
|
|
1614
|
+
children: "They leave your catalogue."
|
|
1615
|
+
})]
|
|
1616
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1617
|
+
className: "o-dialog__footer",
|
|
1618
|
+
style: {
|
|
1619
|
+
marginTop: 14,
|
|
1620
|
+
gap: 6
|
|
1621
|
+
},
|
|
1622
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
1623
|
+
size: "xs",
|
|
1624
|
+
tabIndex: -1,
|
|
1625
|
+
children: "Cancel"
|
|
1626
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
1627
|
+
size: "xs",
|
|
1628
|
+
variant: "critical",
|
|
1629
|
+
tabIndex: -1,
|
|
1630
|
+
children: "Delete"
|
|
1631
|
+
})]
|
|
1632
|
+
})]
|
|
1633
|
+
});
|
|
1634
|
+
}
|
|
1635
|
+
function Page() {
|
|
1636
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
1637
|
+
title: "Dialog",
|
|
1638
|
+
status: "stable",
|
|
1639
|
+
importNames: [
|
|
1640
|
+
"Dialog",
|
|
1641
|
+
"DialogTrigger",
|
|
1642
|
+
"DialogContent",
|
|
1643
|
+
"DialogHeader",
|
|
1644
|
+
"DialogTitle",
|
|
1645
|
+
"DialogFrame",
|
|
1646
|
+
"ConfirmDialog"
|
|
1647
|
+
],
|
|
1648
|
+
lead: "A focused task over a dimmed, softly blurred page. Reach for it when the merchant has to finish or dismiss something before carrying on: a short form, or a question before an action that matters.",
|
|
1649
|
+
children: [
|
|
1650
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
1651
|
+
id: "basics",
|
|
1652
|
+
title: "Basics",
|
|
1653
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1654
|
+
"A ",
|
|
1655
|
+
/* @__PURE__ */ jsx("code", { children: "DialogTrigger" }),
|
|
1656
|
+
" opens it and a ",
|
|
1657
|
+
/* @__PURE__ */ jsx("code", { children: "DialogContent" }),
|
|
1658
|
+
" holds the sheet: a",
|
|
1659
|
+
" ",
|
|
1660
|
+
/* @__PURE__ */ jsx("code", { children: "DialogHeader" }),
|
|
1661
|
+
" with the ",
|
|
1662
|
+
/* @__PURE__ */ jsx("code", { children: "DialogTitle" }),
|
|
1663
|
+
" and ",
|
|
1664
|
+
/* @__PURE__ */ jsx("code", { children: "DialogDescription" }),
|
|
1665
|
+
", a",
|
|
1666
|
+
" ",
|
|
1667
|
+
/* @__PURE__ */ jsx("code", { children: "DialogBody" }),
|
|
1668
|
+
", and a ",
|
|
1669
|
+
/* @__PURE__ */ jsx("code", { children: "DialogFooter" }),
|
|
1670
|
+
" of actions with the primary last. A close button sits in the top right. The sheet rises 16px and settles on the spring; it leaves in half the time. When it closes, focus goes back to what opened it."
|
|
1671
|
+
] }),
|
|
1672
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
1673
|
+
code: `
|
|
1674
|
+
<Dialog open={open} onOpenChange={setOpen}>
|
|
1675
|
+
<DialogTrigger asChild>
|
|
1676
|
+
<Button variant="primary" icon={<UserPlusIcon />}>Invite staff</Button>
|
|
1677
|
+
</DialogTrigger>
|
|
1678
|
+
<DialogContent busy={sending}>
|
|
1679
|
+
<form onSubmit={submit} noValidate style={{ display: 'contents' }}>
|
|
1680
|
+
<DialogHeader>
|
|
1681
|
+
<DialogTitle>Invite a staff member</DialogTitle>
|
|
1682
|
+
<DialogDescription>
|
|
1683
|
+
They get an email with a link to join Harbour Desk Co. Invites run out after 7 days.
|
|
1684
|
+
</DialogDescription>
|
|
1685
|
+
</DialogHeader>
|
|
1686
|
+
<DialogBody>
|
|
1687
|
+
<Field label="Email address" error={error}>
|
|
1688
|
+
<Input type="email" icon={<EnvelopeSimpleIcon />} placeholder="name@example.com" … />
|
|
1689
|
+
</Field>
|
|
1690
|
+
<SegmentedControl aria-label="Access" fullWidth options={access} … />
|
|
1691
|
+
</DialogBody>
|
|
1692
|
+
<DialogFooter>
|
|
1693
|
+
<DialogClose asChild>
|
|
1694
|
+
<Button>Cancel</Button>
|
|
1695
|
+
</DialogClose>
|
|
1696
|
+
<Button type="submit" variant="primary" loading={sending}>Send invite</Button>
|
|
1697
|
+
</DialogFooter>
|
|
1698
|
+
</form>
|
|
1699
|
+
</DialogContent>
|
|
1700
|
+
</Dialog>`,
|
|
1701
|
+
caption: "Press Send invite with the field empty to see the error, then with an address to see the busy state: Escape and the close button do nothing until it has sent.",
|
|
1702
|
+
children: /* @__PURE__ */ jsx(InviteDialog, {})
|
|
1703
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
1704
|
+
title: "A form around a dialog",
|
|
1705
|
+
children: [
|
|
1706
|
+
"A dialog is portalled out of the page, but React still passes its events up your component tree, a",
|
|
1707
|
+
" ",
|
|
1708
|
+
/* @__PURE__ */ jsx("code", { children: "submit" }),
|
|
1709
|
+
" included. If a ",
|
|
1710
|
+
/* @__PURE__ */ jsx("code", { children: "<form>" }),
|
|
1711
|
+
" wraps a dialog in your tree, a submit inside the dialog reaches it too, and Enter in the dialog can save the page behind it. ",
|
|
1712
|
+
/* @__PURE__ */ jsx("code", { children: "DialogFrame" }),
|
|
1713
|
+
"'s",
|
|
1714
|
+
" ",
|
|
1715
|
+
/* @__PURE__ */ jsx("code", { children: "onSubmit" }),
|
|
1716
|
+
" stops that for you. With a form of your own inside ",
|
|
1717
|
+
/* @__PURE__ */ jsx("code", { children: "DialogContent" }),
|
|
1718
|
+
", call",
|
|
1719
|
+
" ",
|
|
1720
|
+
/* @__PURE__ */ jsx("code", { children: "event.stopPropagation()" }),
|
|
1721
|
+
" next to ",
|
|
1722
|
+
/* @__PURE__ */ jsx("code", { children: "event.preventDefault()" }),
|
|
1723
|
+
"."
|
|
1724
|
+
]
|
|
1725
|
+
})]
|
|
1726
|
+
}),
|
|
1727
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
1728
|
+
id: "frame",
|
|
1729
|
+
title: "A dialog in one element",
|
|
1730
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1731
|
+
/* @__PURE__ */ jsx("code", { children: "DialogFrame" }),
|
|
1732
|
+
" takes the title, the description, the body and the actions as props, so a dialog is one element instead of eight. It is the same dialog: every part is the one above, and the rest of",
|
|
1733
|
+
" ",
|
|
1734
|
+
/* @__PURE__ */ jsx("code", { children: "DialogContent" }),
|
|
1735
|
+
"'s props (",
|
|
1736
|
+
/* @__PURE__ */ jsx("code", { children: "size" }),
|
|
1737
|
+
", ",
|
|
1738
|
+
/* @__PURE__ */ jsx("code", { children: "hideClose" }),
|
|
1739
|
+
",",
|
|
1740
|
+
" ",
|
|
1741
|
+
/* @__PURE__ */ jsx("code", { children: "closeLabel" }),
|
|
1742
|
+
", ",
|
|
1743
|
+
/* @__PURE__ */ jsx("code", { children: "bar" }),
|
|
1744
|
+
") work on it. It is always controlled, which is how it holds itself shut while it saves. Reach for the parts when the header or the body needs a layout the props do not give."
|
|
1745
|
+
] }),
|
|
1746
|
+
children: [
|
|
1747
|
+
/* @__PURE__ */ jsx(Example, {
|
|
1748
|
+
code: `
|
|
1749
|
+
const [open, setOpen] = useState(false)
|
|
1750
|
+
const [saving, setSaving] = useState(false)
|
|
1751
|
+
|
|
1752
|
+
<Button onClick={() => setOpen(true)}>Rename collection</Button>
|
|
1753
|
+
|
|
1754
|
+
<DialogFrame
|
|
1755
|
+
open={open}
|
|
1756
|
+
onOpenChange={setOpen}
|
|
1757
|
+
size="sm"
|
|
1758
|
+
title="Rename collection"
|
|
1759
|
+
description="The collection's web address stays the same."
|
|
1760
|
+
busy={saving}
|
|
1761
|
+
onSubmit={save}
|
|
1762
|
+
actions={<Button type="submit" variant="primary" loading={saving}>Save</Button>}
|
|
1763
|
+
>
|
|
1764
|
+
<Field label="Name">
|
|
1765
|
+
<Input value={name} onChange={(event) => setName(event.target.value)} />
|
|
1766
|
+
</Field>
|
|
1767
|
+
</DialogFrame>`,
|
|
1768
|
+
caption: "Press Save, then Escape: it holds until the save is done. Cancel comes from the frame; the primary action is yours.",
|
|
1769
|
+
children: /* @__PURE__ */ jsx(RenameFrame, {})
|
|
1770
|
+
}),
|
|
1771
|
+
/* @__PURE__ */ jsx(Fragment$1, {}),
|
|
1772
|
+
/* @__PURE__ */ jsx(DocTable, {
|
|
1773
|
+
columns: ["Prop", "What the frame does with it"],
|
|
1774
|
+
rows: [
|
|
1775
|
+
[/* @__PURE__ */ jsx("code", { children: "title" }), "The dialog's name, set in Sora, and what screen readers announce."],
|
|
1776
|
+
[/* @__PURE__ */ jsx("code", { children: "description" }), "A sentence or two under the title, announced with it."],
|
|
1777
|
+
[/* @__PURE__ */ jsx("code", { children: "children" }), "The body. It scrolls between the header and the footer."],
|
|
1778
|
+
[/* @__PURE__ */ jsx("code", { children: "actions" }), "The dialog's own buttons, primary last. A Cancel button comes first, from the frame (its words: cancelLabel)."],
|
|
1779
|
+
[/* @__PURE__ */ jsx("code", { children: "footer" }), "The whole footer instead, with no Cancel: for one button, or extra layout."],
|
|
1780
|
+
[/* @__PURE__ */ jsx("code", { children: "start" }), "A quiet action at the footer's start edge. See footer layouts."],
|
|
1781
|
+
[/* @__PURE__ */ jsx("code", { children: "onSubmit" }), "Wraps the body and footer in a form: Enter in a field submits it, a second submit is ignored while it is busy, and the submit never reaches a form above the dialog in your tree."],
|
|
1782
|
+
[/* @__PURE__ */ jsx("code", { children: "busy" }), "A save is running: nothing dismisses the dialog, and Cancel is off. See while it saves."],
|
|
1783
|
+
[/* @__PURE__ */ jsx("code", { children: "align" }), "center centres the title, the description and the actions, for an acknowledgement."]
|
|
1784
|
+
]
|
|
1785
|
+
})
|
|
1786
|
+
]
|
|
1787
|
+
}),
|
|
1788
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
1789
|
+
id: "both-themes",
|
|
1790
|
+
title: "In both themes",
|
|
1791
|
+
description: /* @__PURE__ */ jsx("p", { children: "Held open for review, light beside dark. The page behind dims to 34% near-black under a 3px blur (62% in dark), and the sheet has the system's widest corners (20px) on the modal shadow. In dark it lifts to graphite with a faint ring." }),
|
|
1792
|
+
children: [
|
|
1793
|
+
/* @__PURE__ */ jsx(ThemePair, {
|
|
1794
|
+
align: "fill",
|
|
1795
|
+
children: /* @__PURE__ */ jsx(ConfirmStill, {})
|
|
1796
|
+
}),
|
|
1797
|
+
/* @__PURE__ */ jsx("div", {
|
|
1798
|
+
className: "overlays-stack",
|
|
1799
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
1800
|
+
align: "fill",
|
|
1801
|
+
caption: "Stills of the open dialogs, drawn with their own classes so both themes can be compared at once. Every dialog on the rest of this page is live.",
|
|
1802
|
+
children: /* @__PURE__ */ jsx(FormStill, {})
|
|
1803
|
+
})
|
|
1804
|
+
}),
|
|
1805
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
1806
|
+
title: "Open them for real",
|
|
1807
|
+
description: /* @__PURE__ */ jsx("p", { children: "Each trigger opens its dialog in the theme of its own side." }),
|
|
1808
|
+
children: /* @__PURE__ */ jsxs(ThemePair, {
|
|
1809
|
+
minHeight: 160,
|
|
1810
|
+
children: [/* @__PURE__ */ jsx(InviteDialog, {}), /* @__PURE__ */ jsx(ConfirmTonesLite, {})]
|
|
1811
|
+
})
|
|
1812
|
+
})
|
|
1813
|
+
]
|
|
1814
|
+
}),
|
|
1815
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
1816
|
+
id: "sizes",
|
|
1817
|
+
title: "Sizes",
|
|
1818
|
+
description: /* @__PURE__ */ jsx("p", { children: "Five widths. On a screen narrower than the dialog it keeps 16px clear of each edge, and from 480px down its padding tightens to 20px and the footer stacks full width, in the order you wrote it." }),
|
|
1819
|
+
children: [/* @__PURE__ */ jsxs(Example, {
|
|
1820
|
+
code: `
|
|
1821
|
+
<DialogContent size="sm">…</DialogContent> {/* 400px */}
|
|
1822
|
+
<DialogContent>…</DialogContent> {/* 520px, the default */}
|
|
1823
|
+
<DialogContent size="lg">…</DialogContent> {/* 720px */}
|
|
1824
|
+
<DialogContent size="xl">…</DialogContent> {/* 960px */}
|
|
1825
|
+
<DialogContent size="full">…</DialogContent> {/* the window, less a 12px margin */}`,
|
|
1826
|
+
children: [
|
|
1827
|
+
/* @__PURE__ */ jsx(RenameDialog, {}),
|
|
1828
|
+
/* @__PURE__ */ jsx(RateDialog, {}),
|
|
1829
|
+
/* @__PURE__ */ jsx(ZoneDialog, {})
|
|
1830
|
+
]
|
|
1831
|
+
}), /* @__PURE__ */ jsx(DocTable, {
|
|
1832
|
+
columns: [
|
|
1833
|
+
"Size",
|
|
1834
|
+
"Width",
|
|
1835
|
+
"Use it for"
|
|
1836
|
+
],
|
|
1837
|
+
rows: [
|
|
1838
|
+
[
|
|
1839
|
+
/* @__PURE__ */ jsx("code", { children: "sm" }),
|
|
1840
|
+
"400px",
|
|
1841
|
+
"Confirmations, and forms of one or two fields."
|
|
1842
|
+
],
|
|
1843
|
+
[
|
|
1844
|
+
/* @__PURE__ */ jsx("code", { children: "md" }),
|
|
1845
|
+
"520px",
|
|
1846
|
+
"Short forms. The default."
|
|
1847
|
+
],
|
|
1848
|
+
[
|
|
1849
|
+
/* @__PURE__ */ jsx("code", { children: "lg" }),
|
|
1850
|
+
"720px",
|
|
1851
|
+
"Wider content: two columns of fields, a list to review, a small table."
|
|
1852
|
+
],
|
|
1853
|
+
[
|
|
1854
|
+
/* @__PURE__ */ jsx("code", { children: "xl" }),
|
|
1855
|
+
"960px",
|
|
1856
|
+
"Tables and previews that need the room."
|
|
1857
|
+
],
|
|
1858
|
+
[
|
|
1859
|
+
/* @__PURE__ */ jsx("code", { children: "full" }),
|
|
1860
|
+
"The window",
|
|
1861
|
+
"A long form or an editor. The header and the footer are always bars; the body scrolls between them."
|
|
1862
|
+
]
|
|
1863
|
+
]
|
|
1864
|
+
})]
|
|
1865
|
+
}),
|
|
1866
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1867
|
+
id: "long-content",
|
|
1868
|
+
title: "Long content",
|
|
1869
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1870
|
+
"The dialog never grows taller than the window less 48px. When its content would, only the",
|
|
1871
|
+
" ",
|
|
1872
|
+
/* @__PURE__ */ jsx("code", { children: "DialogBody" }),
|
|
1873
|
+
" scrolls: the title and the actions stay in view. The body runs to the sheet's edges, so its scrollbar sits at the edge and focus rings inside it are never clipped."
|
|
1874
|
+
] }),
|
|
1875
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
1876
|
+
code: `
|
|
1877
|
+
<DialogContent size="lg">
|
|
1878
|
+
<DialogHeader>
|
|
1879
|
+
<DialogTitle>Import 12 products from Northgate Supply</DialogTitle>
|
|
1880
|
+
<DialogDescription>7 are new to your catalogue and 5 update products you already sell.</DialogDescription>
|
|
1881
|
+
</DialogHeader>
|
|
1882
|
+
<DialogBody>
|
|
1883
|
+
<ul>{products.map((p) => <li key={p.sku}>…</li>)}</ul>
|
|
1884
|
+
</DialogBody>
|
|
1885
|
+
<DialogFooter>
|
|
1886
|
+
<DialogClose asChild><Button>Cancel</Button></DialogClose>
|
|
1887
|
+
<DialogClose asChild><Button variant="primary">Import 12 products</Button></DialogClose>
|
|
1888
|
+
</DialogFooter>
|
|
1889
|
+
</DialogContent>`,
|
|
1890
|
+
caption: "Make the window short to see the body scroll on its own.",
|
|
1891
|
+
children: /* @__PURE__ */ jsx(ImportDialog, {})
|
|
1892
|
+
})
|
|
1893
|
+
}),
|
|
1894
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
1895
|
+
id: "bars",
|
|
1896
|
+
title: "Bars",
|
|
1897
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1898
|
+
"Below ",
|
|
1899
|
+
/* @__PURE__ */ jsx("code", { children: "full" }),
|
|
1900
|
+
" a dialog is padding and spacing alone, which suits a short form. Give it",
|
|
1901
|
+
" ",
|
|
1902
|
+
/* @__PURE__ */ jsx("code", { children: "bar" }),
|
|
1903
|
+
" when the body scrolls or the footer carries several actions: hairlines run edge to edge under the header and over the footer, so the title and the buttons read as fixed while the body moves.",
|
|
1904
|
+
" ",
|
|
1905
|
+
/* @__PURE__ */ jsx("code", { children: "bar=\"footer\"" }),
|
|
1906
|
+
" keeps a plain header over a footer on a hairline. A ",
|
|
1907
|
+
/* @__PURE__ */ jsx("code", { children: "full" }),
|
|
1908
|
+
" ",
|
|
1909
|
+
"dialog always has both, so ",
|
|
1910
|
+
/* @__PURE__ */ jsx("code", { children: "bar=\"footer\"" }),
|
|
1911
|
+
" does nothing there. Put the content in a",
|
|
1912
|
+
" ",
|
|
1913
|
+
/* @__PURE__ */ jsx("code", { children: "DialogBody" }),
|
|
1914
|
+
": the body is what scrolls, with the footer pinned below it, and anything placed beside it is clipped by the sheet."
|
|
1915
|
+
] }),
|
|
1916
|
+
children: [
|
|
1917
|
+
/* @__PURE__ */ jsx("div", {
|
|
1918
|
+
className: "overlays-stack",
|
|
1919
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
1920
|
+
align: "fill",
|
|
1921
|
+
caption: "The same short form with no bars, a footer bar and bars at both ends. The sheet gives its padding to the parts, so the hairlines reach the edges.",
|
|
1922
|
+
children: /* @__PURE__ */ jsx(BarStills, {})
|
|
1923
|
+
})
|
|
1924
|
+
}),
|
|
1925
|
+
/* @__PURE__ */ jsx(Example, {
|
|
1926
|
+
code: `
|
|
1927
|
+
<DialogFrame bar="footer" size="lg" title="Import 20 products from Northgate Supply" … >
|
|
1928
|
+
{/* bar: boolean | 'footer'. true is a bar at both ends. */}
|
|
1929
|
+
</DialogFrame>
|
|
1930
|
+
|
|
1931
|
+
<DialogContent bar>…</DialogContent>`,
|
|
1932
|
+
caption: "Switch the bars, then review the import. The list is long enough to scroll: the body moves and the bars stay put.",
|
|
1933
|
+
children: /* @__PURE__ */ jsx(BarDemo, {})
|
|
1934
|
+
}),
|
|
1935
|
+
/* @__PURE__ */ jsx(Fragment$1, {})
|
|
1936
|
+
]
|
|
1937
|
+
}),
|
|
1938
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
1939
|
+
id: "footer",
|
|
1940
|
+
title: "Footer layouts",
|
|
1941
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1942
|
+
"Actions sit at the end, the primary last and Cancel before it. A ",
|
|
1943
|
+
/* @__PURE__ */ jsx("code", { children: "start" }),
|
|
1944
|
+
" slot holds a quiet action apart from them: Download sample, Back, Leave without saving.",
|
|
1945
|
+
" ",
|
|
1946
|
+
/* @__PURE__ */ jsx("code", { children: "align=\"center\"" }),
|
|
1947
|
+
" centres the actions under a centred header, for an acknowledgement, and ",
|
|
1948
|
+
/* @__PURE__ */ jsx("code", { children: "align=\"between\"" }),
|
|
1949
|
+
" spreads them across the row. On a screen 480px wide or less the footer stacks full width, one button under the other in the order of the markup: the start slot first, then Cancel, then the primary at the bottom, within thumb's reach. Tab and a screen reader move in that order too, so what is read first is shown first."
|
|
1950
|
+
] }),
|
|
1951
|
+
children: [
|
|
1952
|
+
/* @__PURE__ */ jsx("div", {
|
|
1953
|
+
className: "overlays-stack",
|
|
1954
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
1955
|
+
align: "fill",
|
|
1956
|
+
caption: "Each layout in both themes. The phone footer is drawn at 320px wide.",
|
|
1957
|
+
children: /* @__PURE__ */ jsx(FooterStills, {})
|
|
1958
|
+
})
|
|
1959
|
+
}),
|
|
1960
|
+
/* @__PURE__ */ jsxs(Example, {
|
|
1961
|
+
code: `
|
|
1962
|
+
<DialogFrame
|
|
1963
|
+
bar="footer"
|
|
1964
|
+
title="Import products"
|
|
1965
|
+
description="Upload a CSV file. Rows with a SKU you already sell update that product."
|
|
1966
|
+
start={<Button variant="ghost" icon={<DownloadSimpleIcon />}>Download sample</Button>}
|
|
1967
|
+
actions={<Button variant="primary" icon={<UploadSimpleIcon />}>Choose a file</Button>}
|
|
1968
|
+
…
|
|
1969
|
+
/>
|
|
1970
|
+
|
|
1971
|
+
<DialogFrame
|
|
1972
|
+
size="sm"
|
|
1973
|
+
align="center"
|
|
1974
|
+
hideClose
|
|
1975
|
+
title="Priya is on this order"
|
|
1976
|
+
description="She opened it two minutes ago. If you both save, the last save wins."
|
|
1977
|
+
footer={<><Button>Wait</Button><Button variant="primary">Carry on anyway</Button></>}
|
|
1978
|
+
…
|
|
1979
|
+
/>
|
|
1980
|
+
|
|
1981
|
+
{/* The same on the parts: */}
|
|
1982
|
+
<DialogHeader align="center">…</DialogHeader>
|
|
1983
|
+
<DialogFooter align="center" start={<Button variant="ghost">Back</Button>}>…</DialogFooter>`,
|
|
1984
|
+
children: [/* @__PURE__ */ jsx(ImportFrame, {}), /* @__PURE__ */ jsx(CentredAcknowledgement, {})]
|
|
1985
|
+
}),
|
|
1986
|
+
/* @__PURE__ */ jsx(Guidelines, { items: [
|
|
1987
|
+
"Cancel or the secondary action first, the primary or critical action last. The order is yours to keep: nothing enforces it.",
|
|
1988
|
+
"The start slot is for navigation and reversible actions. A destructive action is the last button, in a critical pill, never at the start.",
|
|
1989
|
+
"Centre the footer only under a centred header, and only for an acknowledgement with a choice of two."
|
|
1990
|
+
] })
|
|
1991
|
+
]
|
|
1992
|
+
}),
|
|
1993
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
1994
|
+
id: "busy",
|
|
1995
|
+
title: "While it saves",
|
|
1996
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1997
|
+
"Pass ",
|
|
1998
|
+
/* @__PURE__ */ jsx("code", { children: "busy" }),
|
|
1999
|
+
" while a save or a request runs, and the dialog cannot be dismissed by accident: half-saved work is the one thing a dialog must not lose. Pair it with ",
|
|
2000
|
+
/* @__PURE__ */ jsx("code", { children: "loading" }),
|
|
2001
|
+
" on the primary button, as the examples above do. ",
|
|
2002
|
+
/* @__PURE__ */ jsx("code", { children: "DialogFrame" }),
|
|
2003
|
+
" and ",
|
|
2004
|
+
/* @__PURE__ */ jsx("code", { children: "DialogContent" }),
|
|
2005
|
+
" both take it."
|
|
2006
|
+
] }),
|
|
2007
|
+
children: /* @__PURE__ */ jsx(DocTable, {
|
|
2008
|
+
columns: ["While busy", "What happens"],
|
|
2009
|
+
rows: [
|
|
2010
|
+
["Escape", /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2011
|
+
"Does nothing, and your own ",
|
|
2012
|
+
/* @__PURE__ */ jsx("code", { children: "onEscapeKeyDown" }),
|
|
2013
|
+
" is not called."
|
|
2014
|
+
] })],
|
|
2015
|
+
["A click on the dimmed page", /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2016
|
+
"Does nothing, and your own ",
|
|
2017
|
+
/* @__PURE__ */ jsx("code", { children: "onPointerDownOutside" }),
|
|
2018
|
+
" and ",
|
|
2019
|
+
/* @__PURE__ */ jsx("code", { children: "onInteractOutside" }),
|
|
2020
|
+
" are not called: a handler that asks before closing cannot ask mid-save."
|
|
2021
|
+
] })],
|
|
2022
|
+
["The close button", "Is switched off."],
|
|
2023
|
+
["Cancel in a DialogFrame", "Is switched off. Switch off your own Cancel on a composed dialog."],
|
|
2024
|
+
["Enter in a field of a DialogFrame form", "Does nothing: the form does not submit twice."],
|
|
2025
|
+
["Focus on a field that gets switched off", "Moves to the dialog itself, so a keyboard user is not dropped on the page behind."],
|
|
2026
|
+
["Focus on the page, in a dialog that is not modal", "Stays there: only focus that is lost, or on a control that was switched off, is brought back."],
|
|
2027
|
+
["Closing it yourself", /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2028
|
+
"Set ",
|
|
2029
|
+
/* @__PURE__ */ jsx("code", { children: "open" }),
|
|
2030
|
+
" to false when the work is done. Only the ways a person can dismiss it are held."
|
|
2031
|
+
] })]
|
|
2032
|
+
]
|
|
2033
|
+
})
|
|
2034
|
+
}),
|
|
2035
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
2036
|
+
id: "without-close",
|
|
2037
|
+
title: "Without the close button",
|
|
2038
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2039
|
+
/* @__PURE__ */ jsx("code", { children: "hideClose" }),
|
|
2040
|
+
" drops the top-right close button when the footer already offers a way out, as a Cancel does. Escape still closes it. ",
|
|
2041
|
+
/* @__PURE__ */ jsx("code", { children: "closeLabel" }),
|
|
2042
|
+
" renames the close button for screen readers, for example in another language."
|
|
2043
|
+
] }),
|
|
2044
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
2045
|
+
code: `
|
|
2046
|
+
<DialogContent size="sm" hideClose>
|
|
2047
|
+
<DialogHeader>
|
|
2048
|
+
<DialogTitle>Export 318 orders</DialogTitle>
|
|
2049
|
+
<DialogDescription>Orders from the last 30 days, with the filters you have set.</DialogDescription>
|
|
2050
|
+
</DialogHeader>
|
|
2051
|
+
<DialogBody>
|
|
2052
|
+
<SegmentedControl aria-label="Format" fullWidth options={formats} … />
|
|
2053
|
+
<Switch label="One row per line item" … />
|
|
2054
|
+
</DialogBody>
|
|
2055
|
+
<DialogFooter>
|
|
2056
|
+
<DialogClose asChild><Button>Cancel</Button></DialogClose>
|
|
2057
|
+
<DialogClose asChild><Button variant="primary" icon={<DownloadSimpleIcon />}>Export</Button></DialogClose>
|
|
2058
|
+
</DialogFooter>
|
|
2059
|
+
</DialogContent>`,
|
|
2060
|
+
children: /* @__PURE__ */ jsx(ExportDialog, {})
|
|
2061
|
+
})
|
|
2062
|
+
}),
|
|
2063
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
2064
|
+
id: "confirm-dialog",
|
|
2065
|
+
title: "Confirm dialog",
|
|
2066
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2067
|
+
/* @__PURE__ */ jsx("code", { children: "ConfirmDialog" }),
|
|
2068
|
+
" asks one question before an action that matters. Give it the question as the",
|
|
2069
|
+
" ",
|
|
2070
|
+
/* @__PURE__ */ jsx("code", { children: "title" }),
|
|
2071
|
+
", what will happen as the ",
|
|
2072
|
+
/* @__PURE__ */ jsx("code", { children: "description" }),
|
|
2073
|
+
", and the verb as the",
|
|
2074
|
+
" ",
|
|
2075
|
+
/* @__PURE__ */ jsx("code", { children: "confirmLabel" }),
|
|
2076
|
+
". It is an ",
|
|
2077
|
+
/* @__PURE__ */ jsx("code", { children: "alertdialog" }),
|
|
2078
|
+
": a click outside never closes it."
|
|
2079
|
+
] }),
|
|
2080
|
+
children: [
|
|
2081
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
2082
|
+
title: "Tones",
|
|
2083
|
+
description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "tone=\"critical\"" }), " is for actions that destroy something or sign out: the confirm pill turns red and first focus goes to Cancel, so Enter cannot destroy anything by accident. Without a tone the confirm pill is primary and takes first focus."] }),
|
|
2084
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
2085
|
+
code: `
|
|
2086
|
+
const [open, setOpen] = useState(false)
|
|
2087
|
+
|
|
2088
|
+
<Button variant="critical" icon={<TrashIcon />} onClick={() => setOpen(true)}>
|
|
2089
|
+
Delete 3 products
|
|
2090
|
+
</Button>
|
|
2091
|
+
<ConfirmDialog
|
|
2092
|
+
open={open}
|
|
2093
|
+
onOpenChange={setOpen}
|
|
2094
|
+
tone="critical"
|
|
2095
|
+
title="Delete 3 products?"
|
|
2096
|
+
description="Arden ergonomic chair, Walnut desk riser and Brass desk lamp leave your catalogue. Past orders keep their line items."
|
|
2097
|
+
confirmLabel="Delete products"
|
|
2098
|
+
onConfirm={() => deleteProducts(ids)}
|
|
2099
|
+
/>
|
|
2100
|
+
|
|
2101
|
+
<ConfirmDialog
|
|
2102
|
+
title="Send 12 invoices?"
|
|
2103
|
+
description="Each customer gets their invoice by email, as a PDF."
|
|
2104
|
+
confirmLabel="Send invoices"
|
|
2105
|
+
onConfirm={sendInvoices}
|
|
2106
|
+
…
|
|
2107
|
+
/>`,
|
|
2108
|
+
children: /* @__PURE__ */ jsx(ConfirmTones, {})
|
|
2109
|
+
})
|
|
2110
|
+
}),
|
|
2111
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
2112
|
+
title: "Waiting for the work",
|
|
2113
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2114
|
+
"Return a promise from ",
|
|
2115
|
+
/* @__PURE__ */ jsx("code", { children: "onConfirm" }),
|
|
2116
|
+
" and the dialog waits for it: the comet stays in orbit round the confirm pill, Cancel is off, and Escape does nothing until the work is done. It closes when the promise resolves and stays open when it rejects, so you can say what went wrong in its ",
|
|
2117
|
+
/* @__PURE__ */ jsx("code", { children: "children" }),
|
|
2118
|
+
". This refund fails the first time."
|
|
2119
|
+
] }),
|
|
2120
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
2121
|
+
code: `
|
|
2122
|
+
<ConfirmDialog
|
|
2123
|
+
open={open}
|
|
2124
|
+
onOpenChange={…}
|
|
2125
|
+
title="Refund £89.50 to James Okafor?"
|
|
2126
|
+
description="It goes back on the card he paid with and takes 5 to 10 working days to arrive."
|
|
2127
|
+
confirmLabel="Refund £89.50"
|
|
2128
|
+
onConfirm={async () => {
|
|
2129
|
+
setError(undefined)
|
|
2130
|
+
try {
|
|
2131
|
+
await refund(order)
|
|
2132
|
+
} catch (err) {
|
|
2133
|
+
setError('The card issuer did not answer, so nothing was refunded. Try again.')
|
|
2134
|
+
throw err // keeps the dialog open
|
|
2135
|
+
}
|
|
2136
|
+
}}
|
|
2137
|
+
>
|
|
2138
|
+
{error ? <p role="alert">{error}</p> : null}
|
|
2139
|
+
</ConfirmDialog>`,
|
|
2140
|
+
children: /* @__PURE__ */ jsx(RefundConfirm, {})
|
|
2141
|
+
})
|
|
2142
|
+
}),
|
|
2143
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
2144
|
+
title: "Extra content",
|
|
2145
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2146
|
+
"Anything passed as ",
|
|
2147
|
+
/* @__PURE__ */ jsx("code", { children: "children" }),
|
|
2148
|
+
" sits between the description and the actions: options that go with the action, or an error."
|
|
2149
|
+
] }),
|
|
2150
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
2151
|
+
code: `
|
|
2152
|
+
<ConfirmDialog
|
|
2153
|
+
tone="critical"
|
|
2154
|
+
title="Cancel order #1042?"
|
|
2155
|
+
description="James Okafor gets £89.50 back on his card."
|
|
2156
|
+
confirmLabel="Cancel order"
|
|
2157
|
+
cancelLabel="Keep order"
|
|
2158
|
+
onConfirm={cancelOrder}
|
|
2159
|
+
…
|
|
2160
|
+
>
|
|
2161
|
+
<Switch label="Email James to say so" checked={notify} onCheckedChange={setNotify} />
|
|
2162
|
+
<Switch label="Put the 2 items back in stock" checked={restock} onCheckedChange={setRestock} />
|
|
2163
|
+
</ConfirmDialog>`,
|
|
2164
|
+
children: /* @__PURE__ */ jsx(CancelOrderConfirm, {})
|
|
2165
|
+
})
|
|
2166
|
+
}),
|
|
2167
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
2168
|
+
title: "Managing the busy state yourself",
|
|
2169
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2170
|
+
"Pass ",
|
|
2171
|
+
/* @__PURE__ */ jsx("code", { children: "loading" }),
|
|
2172
|
+
" when the work is tracked somewhere else, such as a mutation. The dialog then shows the busy state while ",
|
|
2173
|
+
/* @__PURE__ */ jsx("code", { children: "loading" }),
|
|
2174
|
+
" is true and leaves closing to you."
|
|
2175
|
+
] }),
|
|
2176
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
2177
|
+
code: `
|
|
2178
|
+
const publish = useMutation({ mutationFn: publishTheme, onSuccess: () => setOpen(false) })
|
|
2179
|
+
|
|
2180
|
+
<ConfirmDialog
|
|
2181
|
+
open={open}
|
|
2182
|
+
onOpenChange={…}
|
|
2183
|
+
title="Publish the Harbour theme?"
|
|
2184
|
+
description="Your store switches to it straight away. You can switch back from Themes at any time."
|
|
2185
|
+
confirmLabel="Publish theme"
|
|
2186
|
+
loading={publish.isPending}
|
|
2187
|
+
onConfirm={() => publish.mutate()}
|
|
2188
|
+
/>`,
|
|
2189
|
+
children: /* @__PURE__ */ jsx(PublishConfirm, {})
|
|
2190
|
+
})
|
|
2191
|
+
}),
|
|
2192
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
2193
|
+
title: "Type to confirm",
|
|
2194
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2195
|
+
/* @__PURE__ */ jsx("code", { children: "confirmPhrase" }),
|
|
2196
|
+
" makes the person type the phrase before the confirm button works: it stays switched off until what they type matches, compared after trimming both ends, and Enter in the field confirms once it does. The field is named by ",
|
|
2197
|
+
/* @__PURE__ */ jsx("code", { children: "confirmPhraseLabel" }),
|
|
2198
|
+
" (the phrase set in mono, by default ",
|
|
2199
|
+
/* @__PURE__ */ jsx("em", { children: "Type harbour-desk to confirm" }),
|
|
2200
|
+
"), and ",
|
|
2201
|
+
/* @__PURE__ */ jsx("code", { children: "phraseMessages" }),
|
|
2202
|
+
" words the polite",
|
|
2203
|
+
" ",
|
|
2204
|
+
"\"that does not match yet\" and \"that matches\" feedback as they type.",
|
|
2205
|
+
" ",
|
|
2206
|
+
/* @__PURE__ */ jsx("code", { children: "phraseMatch=\"case-insensitive\"" }),
|
|
2207
|
+
" compares without case, for an email."
|
|
2208
|
+
] }),
|
|
2209
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
2210
|
+
code: `
|
|
2211
|
+
<ConfirmDialog
|
|
2212
|
+
open={open}
|
|
2213
|
+
onOpenChange={setOpen}
|
|
2214
|
+
tone="critical"
|
|
2215
|
+
title="Delete harbour-desk?"
|
|
2216
|
+
description="The store and its products leave Orbit. This cannot be undone."
|
|
2217
|
+
confirmPhrase="harbour-desk"
|
|
2218
|
+
confirmLabel="Delete store"
|
|
2219
|
+
onConfirm={deleteStore}
|
|
2220
|
+
/>`,
|
|
2221
|
+
caption: "Confirm is off until you type harbour-desk. Try something else first: the field says so, politely.",
|
|
2222
|
+
children: /* @__PURE__ */ jsx(DeleteStoreConfirm, {})
|
|
2223
|
+
})
|
|
2224
|
+
}),
|
|
2225
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
2226
|
+
title: "Acknowledge only",
|
|
2227
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2228
|
+
/* @__PURE__ */ jsxs("code", { children: ["showCancel=", false] }),
|
|
2229
|
+
" drops Cancel for an acknowledgement, where there is nothing to say no to: the dialog offers one button and confirming closes it. It is what a native ",
|
|
2230
|
+
/* @__PURE__ */ jsx("code", { children: "alert()" }),
|
|
2231
|
+
" becomes. A critical question with a phrase and no Cancel still has somewhere to put first focus: the field."
|
|
2232
|
+
] }),
|
|
2233
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
2234
|
+
code: `
|
|
2235
|
+
<ConfirmDialog
|
|
2236
|
+
open={open}
|
|
2237
|
+
onOpenChange={setOpen}
|
|
2238
|
+
title="Products imported"
|
|
2239
|
+
description="12 products from Northgate Supply are now in your catalogue."
|
|
2240
|
+
confirmLabel="Got it"
|
|
2241
|
+
showCancel={false}
|
|
2242
|
+
onConfirm={close}
|
|
2243
|
+
/>`,
|
|
2244
|
+
children: /* @__PURE__ */ jsx(AcknowledgeNotice, {})
|
|
2245
|
+
})
|
|
2246
|
+
}),
|
|
2247
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
2248
|
+
title: "When the confirm fails, and other tones",
|
|
2249
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2250
|
+
"When ",
|
|
2251
|
+
/* @__PURE__ */ jsx("code", { children: "onConfirm" }),
|
|
2252
|
+
" rejects, the dialog stays open and says why in a critical alert above its buttons: the rejection's message, or ",
|
|
2253
|
+
/* @__PURE__ */ jsx("code", { children: "failureMessage" }),
|
|
2254
|
+
". ",
|
|
2255
|
+
/* @__PURE__ */ jsx("code", { children: "error" }),
|
|
2256
|
+
" words a failure from work you ran yourself. ",
|
|
2257
|
+
/* @__PURE__ */ jsx("code", { children: "tone=\"warning\"" }),
|
|
2258
|
+
" is the amber pill for a risky step that is not a deletion (it starts on Cancel, as critical does), and ",
|
|
2259
|
+
/* @__PURE__ */ jsx("code", { children: "tone=\"positive\"" }),
|
|
2260
|
+
" the green one for an approval. The dialog holds its words while it animates out, so a page that clears its subject as it closes the question does not blank them mid-fade. Roll back fails the first time here."
|
|
2261
|
+
] }),
|
|
2262
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
2263
|
+
minHeight: 200,
|
|
2264
|
+
code: `
|
|
2265
|
+
<ConfirmDialog
|
|
2266
|
+
open={open}
|
|
2267
|
+
onOpenChange={setOpen}
|
|
2268
|
+
tone="warning"
|
|
2269
|
+
title="Roll back to version 4?"
|
|
2270
|
+
description="The live theme returns to version 4."
|
|
2271
|
+
confirmLabel="Roll back"
|
|
2272
|
+
onConfirm={() => api.rollBack(themeId, 4)} // a rejection is said above the buttons
|
|
2273
|
+
/>`,
|
|
2274
|
+
children: /* @__PURE__ */ jsx(RollbackConfirm, {})
|
|
2275
|
+
})
|
|
2276
|
+
})
|
|
2277
|
+
]
|
|
2278
|
+
}),
|
|
2279
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
2280
|
+
id: "form-dialog",
|
|
2281
|
+
title: "A form dialog",
|
|
2282
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2283
|
+
/* @__PURE__ */ jsx("code", { children: "DialogFrame" }),
|
|
2284
|
+
" with ",
|
|
2285
|
+
/* @__PURE__ */ jsx("code", { children: "onSubmit" }),
|
|
2286
|
+
" is a form. Return a promise and the dialog is busy until it settles, sends one request per submit however fast the double click, and stays open when it rejects, saying why in a critical alert above the footer. The submit shorthand draws the submit button last:",
|
|
2287
|
+
" ",
|
|
2288
|
+
/* @__PURE__ */ jsx("code", { children: "submitLabel" }),
|
|
2289
|
+
", ",
|
|
2290
|
+
/* @__PURE__ */ jsx("code", { children: "submitTone" }),
|
|
2291
|
+
", ",
|
|
2292
|
+
/* @__PURE__ */ jsx("code", { children: "submitDisabled" }),
|
|
2293
|
+
" (Enter sends nothing either) and",
|
|
2294
|
+
" ",
|
|
2295
|
+
/* @__PURE__ */ jsx("code", { children: "submitTestId" }),
|
|
2296
|
+
". ",
|
|
2297
|
+
/* @__PURE__ */ jsxs("code", { children: ["dismissOnOutsideClick=", "{false}"] }),
|
|
2298
|
+
" turns a press outside away; Escape and the close button still cancel. It never closes by itself: close it once the work has gone through."
|
|
2299
|
+
] }),
|
|
2300
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
2301
|
+
minHeight: 200,
|
|
2302
|
+
code: `
|
|
2303
|
+
<DialogFrame
|
|
2304
|
+
open={open}
|
|
2305
|
+
onOpenChange={setOpen}
|
|
2306
|
+
size="sm"
|
|
2307
|
+
title="Suspend Arden Office Supply?"
|
|
2308
|
+
submitLabel="Suspend supplier"
|
|
2309
|
+
submitTone="critical"
|
|
2310
|
+
submitDisabled={password === ''}
|
|
2311
|
+
dismissOnOutsideClick={false}
|
|
2312
|
+
onSubmit={async () => {
|
|
2313
|
+
await suspend({ password }) // rejects with "Incorrect password. Try again."
|
|
2314
|
+
setOpen(false)
|
|
2315
|
+
}}
|
|
2316
|
+
>
|
|
2317
|
+
<Field label="Your admin password">…</Field>
|
|
2318
|
+
</DialogFrame>`,
|
|
2319
|
+
children: /* @__PURE__ */ jsx(SuspendDialog, {})
|
|
2320
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
2321
|
+
title: "Shown once",
|
|
2322
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2323
|
+
/* @__PURE__ */ jsxs("code", { children: ["dismissable=", "{false}"] }),
|
|
2324
|
+
" drops the close button and turns Escape and a press outside away without asking your own handlers for them, and ",
|
|
2325
|
+
/* @__PURE__ */ jsx("code", { children: "hideCancel" }),
|
|
2326
|
+
" leaves Cancel out: the dialog's own button is the only way out. For a secret shown once."
|
|
2327
|
+
] }),
|
|
2328
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
2329
|
+
code: `<DialogFrame dismissable={false} hideCancel submitLabel="I have copied it" onSubmit={() => setOpen(false)} …>`,
|
|
2330
|
+
children: /* @__PURE__ */ jsx(ApiKeyDialog, {})
|
|
2331
|
+
})
|
|
2332
|
+
})]
|
|
2333
|
+
}),
|
|
2334
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
2335
|
+
id: "maximise",
|
|
2336
|
+
title: "Maximise, header actions and the Esc keycap",
|
|
2337
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2338
|
+
"For a dialog people work in (a media library, a templates library), ",
|
|
2339
|
+
/* @__PURE__ */ jsx("code", { children: "maximisable" }),
|
|
2340
|
+
" adds a toggle at the end of the header that grows the sheet to the whole window and back, named \"Maximise\" and \"Restore\";",
|
|
2341
|
+
" ",
|
|
2342
|
+
/* @__PURE__ */ jsx("code", { children: "maximiseKey" }),
|
|
2343
|
+
" remembers the choice, so it opens as it was left; without one it opens windowed each time. ",
|
|
2344
|
+
/* @__PURE__ */ jsx("code", { children: "headerActions" }),
|
|
2345
|
+
" sets controls of your own before it, and ",
|
|
2346
|
+
/* @__PURE__ */ jsx("code", { children: "closeHint" }),
|
|
2347
|
+
" an Esc keycap beside the close button, seen and not heard, which a touch screen leaves out. The title keeps clear of the whole row, and all of it comes after the content in the tab order."
|
|
2348
|
+
] }),
|
|
2349
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
2350
|
+
code: `
|
|
2351
|
+
<DialogFrame
|
|
2352
|
+
open={open}
|
|
2353
|
+
onOpenChange={setOpen}
|
|
2354
|
+
size="xl"
|
|
2355
|
+
bar
|
|
2356
|
+
title="Templates library"
|
|
2357
|
+
maximisable
|
|
2358
|
+
maximiseKey="templates-library"
|
|
2359
|
+
closeHint
|
|
2360
|
+
headerActions={<Button size="sm" variant="ghost">Help</Button>}
|
|
2361
|
+
actions={<Button variant="primary">Use template</Button>}
|
|
2362
|
+
>
|
|
2363
|
+
…
|
|
2364
|
+
</DialogFrame>`,
|
|
2365
|
+
children: /* @__PURE__ */ jsx(LibraryDialog, {})
|
|
2366
|
+
})
|
|
2367
|
+
}),
|
|
2368
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
2369
|
+
id: "from-a-menu",
|
|
2370
|
+
title: "Opened from a menu",
|
|
2371
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2372
|
+
"Most dialogs in a dashboard open from a row in an actions menu. Set ",
|
|
2373
|
+
/* @__PURE__ */ jsx("code", { children: "open" }),
|
|
2374
|
+
" from the row's",
|
|
2375
|
+
" ",
|
|
2376
|
+
/* @__PURE__ */ jsx("code", { children: "onSelect" }),
|
|
2377
|
+
" and the dialog does the rest: it waits until the menu has finished closing, so the two never hold focus at once, and when it closes focus goes back to the menu's button, not to the top of the page. Nothing else to wire: no ref, no ",
|
|
2378
|
+
/* @__PURE__ */ jsx("code", { children: "onCloseAutoFocus" }),
|
|
2379
|
+
"."
|
|
2380
|
+
] }),
|
|
2381
|
+
children: [
|
|
2382
|
+
/* @__PURE__ */ jsx(Example, {
|
|
2383
|
+
align: "fill",
|
|
2384
|
+
minHeight: 260,
|
|
2385
|
+
code: `
|
|
2386
|
+
<Menu>
|
|
2387
|
+
<MenuTrigger asChild>
|
|
2388
|
+
<IconButton label="Actions for Home office" size="sm"><DotsThreeIcon weight="bold" /></IconButton>
|
|
2389
|
+
</MenuTrigger>
|
|
2390
|
+
<MenuContent align="end">
|
|
2391
|
+
<MenuItem icon={<PencilSimpleIcon />} onSelect={() => setDetailsOpen(true)}>Edit details</MenuItem>
|
|
2392
|
+
<MenuItem icon={<CursorTextIcon />} afterClose={() => setEditing(true)}>Rename here</MenuItem>
|
|
2393
|
+
<MenuItem icon={<TrashIcon />} tone="critical" onSelect={() => setDeleteOpen(true)}>Delete collection</MenuItem>
|
|
2394
|
+
</MenuContent>
|
|
2395
|
+
</Menu>
|
|
2396
|
+
|
|
2397
|
+
<DialogFrame open={detailsOpen} onOpenChange={setDetailsOpen} title="Edit collection details" … />
|
|
2398
|
+
<ConfirmDialog open={deleteOpen} onOpenChange={setDeleteOpen} tone="critical" title="Delete Home office?" … />`,
|
|
2399
|
+
caption: "Open the menu with the keyboard and choose a row. Edit details and Delete open a dialog; close either and focus is back on the menu's button. Rename here edits in place.",
|
|
2400
|
+
children: /* @__PURE__ */ jsx(CollectionRow, {})
|
|
2401
|
+
}),
|
|
2402
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
2403
|
+
title: "When the row does something other than open a dialog",
|
|
2404
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2405
|
+
"A row that starts something needing focus straight away (an inline field, a panel from another library) should not do it inside the click: the menu is still closing, and hands focus back to its button as it goes, which takes focus from a field that has just appeared. Give the row",
|
|
2406
|
+
" ",
|
|
2407
|
+
/* @__PURE__ */ jsx("code", { children: "afterClose" }),
|
|
2408
|
+
" instead of doing the work in ",
|
|
2409
|
+
/* @__PURE__ */ jsx("code", { children: "onSelect" }),
|
|
2410
|
+
". It runs once the menu has left the page and the button has its focus back, so a field it focuses keeps focus and a dialog it opens notes the button as its opener. It does not run when ",
|
|
2411
|
+
/* @__PURE__ */ jsx("code", { children: "onSelect" }),
|
|
2412
|
+
" calls",
|
|
2413
|
+
" ",
|
|
2414
|
+
/* @__PURE__ */ jsx("code", { children: "event.preventDefault()" }),
|
|
2415
|
+
", which keeps the menu open."
|
|
2416
|
+
] }),
|
|
2417
|
+
children: /* @__PURE__ */ jsx(CodeBlock$1, { code: `<MenuItem icon={<CursorTextIcon />} afterClose={() => setEditing(true)}>
|
|
2418
|
+
Rename here
|
|
2419
|
+
</MenuItem>` })
|
|
2420
|
+
}),
|
|
2421
|
+
/* @__PURE__ */ jsxs(Note, {
|
|
2422
|
+
title: "The wait",
|
|
2423
|
+
children: [
|
|
2424
|
+
"Dialog, Sheet and ConfirmDialog hold themselves closed while any menu on the page is still closing: the menu's exit, about 150ms, and about two seconds at the very most. The menu leaves, then the dialog arrives, and the two never hold focus or the page's pointer lock at once. With the kit's menus and dialogs sharing one copy of Radix, opening straight from ",
|
|
2425
|
+
/* @__PURE__ */ jsx("code", { children: "onSelect" }),
|
|
2426
|
+
" also works; the wait is the guard for an app that ends up with a second copy of Radix beside the kit's, where the two fight over both. A dialog that is never opened from a menu is never held, and one that must appear the instant",
|
|
2427
|
+
" ",
|
|
2428
|
+
/* @__PURE__ */ jsx("code", { children: "open" }),
|
|
2429
|
+
" is set can pass ",
|
|
2430
|
+
/* @__PURE__ */ jsxs("code", { children: ["waitForMenus=", "{false}"] }),
|
|
2431
|
+
"."
|
|
2432
|
+
]
|
|
2433
|
+
})
|
|
2434
|
+
]
|
|
2435
|
+
}),
|
|
2436
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
2437
|
+
id: "pickers",
|
|
2438
|
+
title: "Pickers inside a dialog",
|
|
2439
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2440
|
+
"A popover, menu, select or date picker opened inside a dialog opens in a layer of the dialog itself, not on the page behind it. That keeps it inside the dialog's focus trap, lets its list scroll under the mouse wheel, and puts it in the right place in the Tab order. A ",
|
|
2441
|
+
/* @__PURE__ */ jsx("code", { children: "Sheet" }),
|
|
2442
|
+
" has a layer of its own and does the same, also when the sheet sits inside a dialog or a dialog inside the sheet: the nearest one wins. There is nothing to wire: the kit's own pickers find the layer. Name a ",
|
|
2443
|
+
/* @__PURE__ */ jsx("code", { children: "container" }),
|
|
2444
|
+
" ",
|
|
2445
|
+
"to send one somewhere else, or pass ",
|
|
2446
|
+
/* @__PURE__ */ jsxs("code", { children: ["container=", "{null}"] }),
|
|
2447
|
+
" to keep it on the page."
|
|
2448
|
+
] }),
|
|
2449
|
+
children: [
|
|
2450
|
+
/* @__PURE__ */ jsx(Example, {
|
|
2451
|
+
code: `
|
|
2452
|
+
<DialogFrame open={open} onOpenChange={setOpen} title="Schedule a delivery" … >
|
|
2453
|
+
<Select value={zone} onValueChange={setZone} options={zones} />
|
|
2454
|
+
<DatePicker value={day} onChange={setDay} placeholder="Pick a day" clearable />
|
|
2455
|
+
<Popover>
|
|
2456
|
+
<PopoverTrigger asChild><Button>{tags.length} tagged</Button></PopoverTrigger>
|
|
2457
|
+
<PopoverContent padding="sm" width={260} aria-label="Product tags">
|
|
2458
|
+
{/* 22 checkboxes: scroll them with the wheel */}
|
|
2459
|
+
</PopoverContent>
|
|
2460
|
+
</Popover>
|
|
2461
|
+
</DialogFrame>`,
|
|
2462
|
+
caption: "Open each picker in turn. The tag list is long: scroll it with the wheel, and press Tab to see focus stay in the dialog.",
|
|
2463
|
+
children: /* @__PURE__ */ jsx(PickersDialog, {})
|
|
2464
|
+
}),
|
|
2465
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
2466
|
+
title: "In a sheet",
|
|
2467
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2468
|
+
"A ",
|
|
2469
|
+
/* @__PURE__ */ jsx("code", { children: "Sheet" }),
|
|
2470
|
+
" publishes a layer in the same way, so the pickers in a drawer open inside it and scroll under the wheel too."
|
|
2471
|
+
] }),
|
|
2472
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
2473
|
+
code: `
|
|
2474
|
+
<Sheet open={open} onOpenChange={setOpen}>
|
|
2475
|
+
<SheetContent size="sm">
|
|
2476
|
+
<SheetHeader><SheetTitle>Filter the list</SheetTitle></SheetHeader>
|
|
2477
|
+
<SheetBody>
|
|
2478
|
+
<Select value={zone} onValueChange={setZone} options={zones} />
|
|
2479
|
+
<Popover>…</Popover>
|
|
2480
|
+
</SheetBody>
|
|
2481
|
+
</SheetContent>
|
|
2482
|
+
</Sheet>`,
|
|
2483
|
+
caption: "Open the tag list and scroll it with the wheel, as in the dialog.",
|
|
2484
|
+
children: /* @__PURE__ */ jsx(PickersSheet, {})
|
|
2485
|
+
})
|
|
2486
|
+
}),
|
|
2487
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
2488
|
+
title: "Your own picker",
|
|
2489
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2490
|
+
"A picker built by hand portals into the same layer with ",
|
|
2491
|
+
/* @__PURE__ */ jsx("code", { children: "useDialogPortalContainer()" }),
|
|
2492
|
+
", which gives the layer's element inside a dialog or a sheet and ",
|
|
2493
|
+
/* @__PURE__ */ jsx("code", { children: "null" }),
|
|
2494
|
+
" everywhere else."
|
|
2495
|
+
] }),
|
|
2496
|
+
children: /* @__PURE__ */ jsx(CodeBlock$1, { code: `import { useDialogPortalContainer } from '@orbitcommerce/constellation'
|
|
2497
|
+
import { createPortal } from 'react-dom'
|
|
2498
|
+
|
|
2499
|
+
function TagList({ children }) {
|
|
2500
|
+
const container = useDialogPortalContainer()
|
|
2501
|
+
return createPortal(<div className="tag-list">{children}</div>, container ?? document.body)
|
|
2502
|
+
}` })
|
|
2503
|
+
})
|
|
2504
|
+
]
|
|
2505
|
+
}),
|
|
2506
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
2507
|
+
id: "focus",
|
|
2508
|
+
title: "Focus and Escape",
|
|
2509
|
+
description: /* @__PURE__ */ jsx("p", { children: "What happens to focus, the keyboard and the page behind, from opening to closing." }),
|
|
2510
|
+
children: [/* @__PURE__ */ jsx(DocTable, {
|
|
2511
|
+
columns: [
|
|
2512
|
+
"",
|
|
2513
|
+
"Dialog",
|
|
2514
|
+
"ConfirmDialog"
|
|
2515
|
+
],
|
|
2516
|
+
rows: [
|
|
2517
|
+
[
|
|
2518
|
+
"Opening",
|
|
2519
|
+
"Focus moves to the first thing in the sheet that takes focus. The close button comes last in the page order, so it lands on your content: the email field above. initialFocus=\"dialog\" puts it on the sheet instead; so does an iframe as the first stop, which would swallow Escape.",
|
|
2520
|
+
"Focus goes to the typed-confirmation field when there is one; otherwise to Cancel when the tone is critical, and to the confirm button otherwise."
|
|
2521
|
+
],
|
|
2522
|
+
[
|
|
2523
|
+
"Tab",
|
|
2524
|
+
"Moves through the dialog and wraps round. It never reaches the page behind.",
|
|
2525
|
+
"The same."
|
|
2526
|
+
],
|
|
2527
|
+
[
|
|
2528
|
+
"Escape",
|
|
2529
|
+
"Closes it, except while busy.",
|
|
2530
|
+
"Closes it, except while the work is running."
|
|
2531
|
+
],
|
|
2532
|
+
[
|
|
2533
|
+
"Click on the dimmed page",
|
|
2534
|
+
"Closes it, except while busy.",
|
|
2535
|
+
"Does nothing."
|
|
2536
|
+
],
|
|
2537
|
+
[
|
|
2538
|
+
"Closing",
|
|
2539
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2540
|
+
"Focus goes back to what had it as the dialog opened: the ",
|
|
2541
|
+
/* @__PURE__ */ jsx("code", { children: "DialogTrigger" }),
|
|
2542
|
+
", the button that set ",
|
|
2543
|
+
/* @__PURE__ */ jsx("code", { children: "open" }),
|
|
2544
|
+
", or a menu's button for a dialog chosen from a menu. If that has left the page (a deleted row), to the heading of the section it sat in, then the page's main heading, never to the top of the page."
|
|
2545
|
+
] }),
|
|
2546
|
+
"The same."
|
|
2547
|
+
],
|
|
2548
|
+
[
|
|
2549
|
+
"While open",
|
|
2550
|
+
"The page behind cannot scroll and is hidden from screen readers.",
|
|
2551
|
+
"The same."
|
|
2552
|
+
]
|
|
2553
|
+
]
|
|
2554
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
2555
|
+
title: "Handing focus back",
|
|
2556
|
+
children: [
|
|
2557
|
+
"Radix returns focus only to its own ",
|
|
2558
|
+
/* @__PURE__ */ jsx("code", { children: "DialogTrigger" }),
|
|
2559
|
+
", and a dashboard opens almost every dialog from somewhere else, so the dialog does it. It notes what has focus as it opens (also in Safari, which never focuses a button a mouse lands on) and, when it closes, focuses that, or",
|
|
2560
|
+
" ",
|
|
2561
|
+
/* @__PURE__ */ jsx("code", { children: "returnFocusRef" }),
|
|
2562
|
+
" if you name one. An opener that is switched off while the work runs, a button that spins, gets focus once it is back on. Focus that has already been placed elsewhere, by you or by the next dialog, is left alone. ",
|
|
2563
|
+
/* @__PURE__ */ jsxs("code", { children: ["restoreFocus=", "{false}"] }),
|
|
2564
|
+
" turns it off, and your own",
|
|
2565
|
+
" ",
|
|
2566
|
+
/* @__PURE__ */ jsx("code", { children: "onCloseAutoFocus" }),
|
|
2567
|
+
" runs first and wins if it calls ",
|
|
2568
|
+
/* @__PURE__ */ jsx("code", { children: "preventDefault()" }),
|
|
2569
|
+
"."
|
|
2570
|
+
]
|
|
2571
|
+
})]
|
|
2572
|
+
}),
|
|
2573
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
2574
|
+
id: "guidelines",
|
|
2575
|
+
title: "Guidelines",
|
|
2576
|
+
children: [/* @__PURE__ */ jsx(DoDont, {
|
|
2577
|
+
do: {
|
|
2578
|
+
children: /* @__PURE__ */ jsx(DoDontSheet, {
|
|
2579
|
+
title: "Delete 3 products?",
|
|
2580
|
+
description: "They leave your catalogue. Past orders keep their line items.",
|
|
2581
|
+
cancel: "Cancel",
|
|
2582
|
+
confirm: "Delete products"
|
|
2583
|
+
}),
|
|
2584
|
+
caption: "Ask the real question, say what will happen, and name the action on the button."
|
|
2585
|
+
},
|
|
2586
|
+
dont: {
|
|
2587
|
+
children: /* @__PURE__ */ jsx(DoDontSheet, {
|
|
2588
|
+
title: "Are you sure?",
|
|
2589
|
+
cancel: "No",
|
|
2590
|
+
confirm: "OK"
|
|
2591
|
+
}),
|
|
2592
|
+
caption: "\"Are you sure?\" and \"OK\" make people read the page behind to find out what they are agreeing to."
|
|
2593
|
+
}
|
|
2594
|
+
}), /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
2595
|
+
"Title it with the task (\"Invite a staff member\") or the question (\"Delete 3 products?\"), never \"Confirm\" or \"Warning\".",
|
|
2596
|
+
"Keep the name of the action from the button that opened it to the button that confirms it: Delete 3 products, then Delete products.",
|
|
2597
|
+
"One primary, last in the footer. Use critical only for actions that destroy something or sign out.",
|
|
2598
|
+
"Keep dialogs short. A form that needs a scroll bar or more than a handful of fields wants its own page.",
|
|
2599
|
+
"Never open one dialog on top of another, and never open one on page load.",
|
|
2600
|
+
"After an action that is not reversible, confirm it happened with a quiet message on the page, not another dialog.",
|
|
2601
|
+
"Hold a dialog shut with busy while it saves, so a stray Escape cannot lose the work.",
|
|
2602
|
+
"Add bars when the body scrolls or the footer has several buttons; leave a short form plain.",
|
|
2603
|
+
"Ask for a typed confirmation only for what cannot be undone: deleting a store, erasing a customer. It slows everyone down, so keep it for the rare, irreversible action, never every delete."
|
|
2604
|
+
] })]
|
|
2605
|
+
}),
|
|
2606
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
2607
|
+
id: "accessibility",
|
|
2608
|
+
title: "Accessibility",
|
|
2609
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
2610
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2611
|
+
"Built on Radix Dialog. ",
|
|
2612
|
+
/* @__PURE__ */ jsx("code", { children: "DialogContent" }),
|
|
2613
|
+
" is a ",
|
|
2614
|
+
/* @__PURE__ */ jsx("code", { children: "dialog" }),
|
|
2615
|
+
" named by its",
|
|
2616
|
+
" ",
|
|
2617
|
+
/* @__PURE__ */ jsx("code", { children: "DialogTitle" }),
|
|
2618
|
+
" and described by its ",
|
|
2619
|
+
/* @__PURE__ */ jsx("code", { children: "DialogDescription" }),
|
|
2620
|
+
"; ",
|
|
2621
|
+
/* @__PURE__ */ jsx("code", { children: "ConfirmDialog" }),
|
|
2622
|
+
" is an ",
|
|
2623
|
+
/* @__PURE__ */ jsx("code", { children: "alertdialog" }),
|
|
2624
|
+
"."
|
|
2625
|
+
] }),
|
|
2626
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2627
|
+
"Every dialog needs a ",
|
|
2628
|
+
/* @__PURE__ */ jsx("code", { children: "DialogTitle" }),
|
|
2629
|
+
". Give it a ",
|
|
2630
|
+
/* @__PURE__ */ jsx("code", { children: "DialogDescription" }),
|
|
2631
|
+
" too, or pass",
|
|
2632
|
+
" ",
|
|
2633
|
+
/* @__PURE__ */ jsx("code", { children: "aria-describedby={undefined}" }),
|
|
2634
|
+
" to ",
|
|
2635
|
+
/* @__PURE__ */ jsx("code", { children: "DialogContent" }),
|
|
2636
|
+
": Radix warns in development when neither is there. Always give a ",
|
|
2637
|
+
/* @__PURE__ */ jsx("code", { children: "ConfirmDialog" }),
|
|
2638
|
+
" a ",
|
|
2639
|
+
/* @__PURE__ */ jsx("code", { children: "description" }),
|
|
2640
|
+
" for the same reason."
|
|
2641
|
+
] }),
|
|
2642
|
+
"Focus is trapped inside while it is open, the page behind cannot scroll, and the rest of the page is hidden from screen readers; aria-modal=\"true\" on the sheet says so to them (a Dialog with modal={false} has none).",
|
|
2643
|
+
"A failed submit or confirm is said in a critical alert (role=\"alert\") above the buttons, read as it arrives, with focus left on the button that will try again.",
|
|
2644
|
+
"The maximise toggle, the header actions and the Esc keycap come after the content with the close button, so first focus still lands on the content. The keycap is hidden from screen readers: the close button is what they name.",
|
|
2645
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2646
|
+
"The close button is named \"Close\" (",
|
|
2647
|
+
/* @__PURE__ */ jsx("code", { children: "closeLabel" }),
|
|
2648
|
+
" changes it) and comes last in the page order."
|
|
2649
|
+
] }),
|
|
2650
|
+
"While a dialog is busy it says so (aria-busy), its close button is switched off, and focus stays inside it even if the control that had it is switched off.",
|
|
2651
|
+
"On close, focus goes back to what opened the dialog, or to a heading when that has gone, so a keyboard or screen reader user keeps their place.",
|
|
2652
|
+
"A dialog chosen from a menu opens once the menu has gone, so focus is never in both at once.",
|
|
2653
|
+
"Pickers opened inside a dialog open in the dialog, so Tab stays inside its focus trap.",
|
|
2654
|
+
"With reduced motion the sheet fades in and out without rising or scaling."
|
|
2655
|
+
] })
|
|
2656
|
+
}),
|
|
2657
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
2658
|
+
id: "props",
|
|
2659
|
+
title: "Props",
|
|
2660
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
2661
|
+
"The parts also accept the matching Radix Dialog props, and ",
|
|
2662
|
+
/* @__PURE__ */ jsx("code", { children: "DialogFrame" }),
|
|
2663
|
+
" takes every",
|
|
2664
|
+
" ",
|
|
2665
|
+
/* @__PURE__ */ jsx("code", { children: "DialogContent" }),
|
|
2666
|
+
" prop (size, bar, hideClose, closeLabel, container, initialFocus, returnFocusRef, restoreFocus) as well as its own."
|
|
2667
|
+
] }),
|
|
2668
|
+
children: [
|
|
2669
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
2670
|
+
title: "Dialog",
|
|
2671
|
+
rows: [
|
|
2672
|
+
{
|
|
2673
|
+
name: "open",
|
|
2674
|
+
type: "boolean",
|
|
2675
|
+
description: "Controlled open state."
|
|
2676
|
+
},
|
|
2677
|
+
{
|
|
2678
|
+
name: "defaultOpen",
|
|
2679
|
+
type: "boolean",
|
|
2680
|
+
default: "false",
|
|
2681
|
+
description: "Starting state when uncontrolled."
|
|
2682
|
+
},
|
|
2683
|
+
{
|
|
2684
|
+
name: "onOpenChange",
|
|
2685
|
+
type: "(open: boolean) => void",
|
|
2686
|
+
description: "Called when it opens or closes."
|
|
2687
|
+
},
|
|
2688
|
+
{
|
|
2689
|
+
name: "modal",
|
|
2690
|
+
type: "boolean",
|
|
2691
|
+
default: "true",
|
|
2692
|
+
description: "Trap focus, lock scrolling and hide the page behind while open."
|
|
2693
|
+
},
|
|
2694
|
+
{
|
|
2695
|
+
name: "waitForMenus",
|
|
2696
|
+
type: "boolean",
|
|
2697
|
+
default: "true",
|
|
2698
|
+
description: "A controlled dialog opened from a menu row waits for that menu to finish closing before it appears. See opened from a menu."
|
|
2699
|
+
}
|
|
2700
|
+
]
|
|
2701
|
+
}),
|
|
2702
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
2703
|
+
title: "DialogTrigger, DialogClose",
|
|
2704
|
+
rows: [{
|
|
2705
|
+
name: "asChild",
|
|
2706
|
+
type: "boolean",
|
|
2707
|
+
default: "false",
|
|
2708
|
+
description: "Render your Button as the trigger or the close control."
|
|
2709
|
+
}]
|
|
2710
|
+
}),
|
|
2711
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
2712
|
+
title: "DialogContent",
|
|
2713
|
+
rows: [
|
|
2714
|
+
{
|
|
2715
|
+
name: "size",
|
|
2716
|
+
type: "'sm' | 'md' | 'lg' | 'xl' | 'full'",
|
|
2717
|
+
default: "'md'",
|
|
2718
|
+
description: "400px for confirmations, 520px for short forms, 720px for wider content, 960px for tables, and the window for a long form or an editor."
|
|
2719
|
+
},
|
|
2720
|
+
{
|
|
2721
|
+
name: "bar",
|
|
2722
|
+
type: "boolean | 'footer'",
|
|
2723
|
+
description: "Hairlines under the header and over the footer. true is both; footer is the footer only, under a plain header, and is ignored at size full, which always has both. Put the content in a DialogBody: it is what scrolls, and anything beside it is clipped."
|
|
2724
|
+
},
|
|
2725
|
+
{
|
|
2726
|
+
name: "busy",
|
|
2727
|
+
type: "boolean",
|
|
2728
|
+
default: "false",
|
|
2729
|
+
description: "A save is running: Escape, a click on the dimmed page and the close button no longer close it."
|
|
2730
|
+
},
|
|
2731
|
+
{
|
|
2732
|
+
name: "initialFocus",
|
|
2733
|
+
type: "'first' | 'dialog'",
|
|
2734
|
+
default: "'first'",
|
|
2735
|
+
description: "Where focus starts: the first thing that takes it, or the sheet itself."
|
|
2736
|
+
},
|
|
2737
|
+
{
|
|
2738
|
+
name: "returnFocusRef",
|
|
2739
|
+
type: "RefObject<HTMLElement>",
|
|
2740
|
+
description: "Where focus goes on close. Defaults to what had focus as the dialog opened."
|
|
2741
|
+
},
|
|
2742
|
+
{
|
|
2743
|
+
name: "restoreFocus",
|
|
2744
|
+
type: "boolean",
|
|
2745
|
+
default: "true",
|
|
2746
|
+
description: "Hand focus back on close. Turn it off to place focus yourself in onCloseAutoFocus."
|
|
2747
|
+
},
|
|
2748
|
+
{
|
|
2749
|
+
name: "hideClose",
|
|
2750
|
+
type: "boolean",
|
|
2751
|
+
default: "false",
|
|
2752
|
+
description: "Drop the top-right close button when the footer already offers a way out."
|
|
2753
|
+
},
|
|
2754
|
+
{
|
|
2755
|
+
name: "closeLabel",
|
|
2756
|
+
type: "string",
|
|
2757
|
+
default: "'Close'",
|
|
2758
|
+
description: "Accessible name of the close button."
|
|
2759
|
+
},
|
|
2760
|
+
{
|
|
2761
|
+
name: "container",
|
|
2762
|
+
type: "HTMLElement | null",
|
|
2763
|
+
default: "document.body",
|
|
2764
|
+
description: "Where the dialog is portalled. Menus, popovers and selects opened inside it have their own layer in the sheet, which a Sheet has too."
|
|
2765
|
+
},
|
|
2766
|
+
{
|
|
2767
|
+
name: "onOpenAutoFocus",
|
|
2768
|
+
type: "(event: Event) => void",
|
|
2769
|
+
description: "Runs as focus moves in. Prevent it and focus something yourself."
|
|
2770
|
+
},
|
|
2771
|
+
{
|
|
2772
|
+
name: "onCloseAutoFocus",
|
|
2773
|
+
type: "(event: Event) => void",
|
|
2774
|
+
description: "Runs as focus leaves. Prevent it to send focus somewhere other than the trigger."
|
|
2775
|
+
},
|
|
2776
|
+
{
|
|
2777
|
+
name: "onEscapeKeyDown",
|
|
2778
|
+
type: "(event: KeyboardEvent) => void",
|
|
2779
|
+
description: "Prevent it to keep the dialog open on Escape. Not called while busy."
|
|
2780
|
+
},
|
|
2781
|
+
{
|
|
2782
|
+
name: "onPointerDownOutside",
|
|
2783
|
+
type: "(event: Event) => void",
|
|
2784
|
+
description: "Prevent it to keep the dialog open on a click outside. Not called while busy."
|
|
2785
|
+
},
|
|
2786
|
+
{
|
|
2787
|
+
name: "headerActions",
|
|
2788
|
+
type: "ReactNode",
|
|
2789
|
+
description: "Controls of your own at the end of the header, before the maximise toggle and the close button. Small ones (size=\"sm\")."
|
|
2790
|
+
},
|
|
2791
|
+
{
|
|
2792
|
+
name: "maximisable",
|
|
2793
|
+
type: "boolean",
|
|
2794
|
+
default: "false",
|
|
2795
|
+
description: "A toggle that grows the dialog to the whole window and back, named Maximise and Restore."
|
|
2796
|
+
},
|
|
2797
|
+
{
|
|
2798
|
+
name: "defaultMaximised",
|
|
2799
|
+
type: "boolean",
|
|
2800
|
+
default: "false",
|
|
2801
|
+
description: "Opens maximised, each time it opens. With maximiseKey, what was last chosen wins."
|
|
2802
|
+
},
|
|
2803
|
+
{
|
|
2804
|
+
name: "maximised",
|
|
2805
|
+
type: "boolean",
|
|
2806
|
+
description: "Controlled maximised state, with onMaximisedChange."
|
|
2807
|
+
},
|
|
2808
|
+
{
|
|
2809
|
+
name: "onMaximisedChange",
|
|
2810
|
+
type: "(maximised: boolean) => void",
|
|
2811
|
+
description: "Called when the toggle asks to maximise or restore."
|
|
2812
|
+
},
|
|
2813
|
+
{
|
|
2814
|
+
name: "maximiseKey",
|
|
2815
|
+
type: "string",
|
|
2816
|
+
description: "Remembers the choice in localStorage under this key. Without one it opens windowed (or as defaultMaximised says) each time."
|
|
2817
|
+
},
|
|
2818
|
+
{
|
|
2819
|
+
name: "maximiseLabel",
|
|
2820
|
+
type: "string",
|
|
2821
|
+
default: "'Maximise'",
|
|
2822
|
+
description: "The toggle's name while windowed."
|
|
2823
|
+
},
|
|
2824
|
+
{
|
|
2825
|
+
name: "restoreLabel",
|
|
2826
|
+
type: "string",
|
|
2827
|
+
default: "'Restore'",
|
|
2828
|
+
description: "The toggle's name while maximised."
|
|
2829
|
+
},
|
|
2830
|
+
{
|
|
2831
|
+
name: "closeHint",
|
|
2832
|
+
type: "boolean | ReactNode",
|
|
2833
|
+
description: "An Esc keycap beside the close button: true for \"Esc\", or the key's own word. Seen, not heard; left out on a touch screen."
|
|
2834
|
+
}
|
|
2835
|
+
]
|
|
2836
|
+
}),
|
|
2837
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
2838
|
+
title: "DialogHeader, DialogBody, DialogFooter",
|
|
2839
|
+
rows: [
|
|
2840
|
+
{
|
|
2841
|
+
name: "children",
|
|
2842
|
+
type: "ReactNode",
|
|
2843
|
+
description: "Header: title and description, stacked. Body: scrolls on its own when the dialog meets the window. Footer: actions, right-aligned, primary last. Each accepts every div attribute."
|
|
2844
|
+
},
|
|
2845
|
+
{
|
|
2846
|
+
name: "align (DialogHeader)",
|
|
2847
|
+
type: "'start' | 'center'",
|
|
2848
|
+
default: "'start'",
|
|
2849
|
+
description: "center centres the title and description, for an acknowledgement."
|
|
2850
|
+
},
|
|
2851
|
+
{
|
|
2852
|
+
name: "scroll (DialogBody)",
|
|
2853
|
+
type: "boolean",
|
|
2854
|
+
default: "true",
|
|
2855
|
+
description: "Turn off when the content scrolls itself; the body then hands it the whole space between header and footer."
|
|
2856
|
+
},
|
|
2857
|
+
{
|
|
2858
|
+
name: "align (DialogFooter)",
|
|
2859
|
+
type: "'end' | 'center' | 'between'",
|
|
2860
|
+
default: "'end'",
|
|
2861
|
+
description: "Where the actions sit. On a phone they stack full width whatever this says."
|
|
2862
|
+
},
|
|
2863
|
+
{
|
|
2864
|
+
name: "start (DialogFooter)",
|
|
2865
|
+
type: "ReactNode",
|
|
2866
|
+
description: "A quiet action at the start edge, apart from the others. Joins the stack on a phone."
|
|
2867
|
+
}
|
|
2868
|
+
]
|
|
2869
|
+
}),
|
|
2870
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
2871
|
+
title: "DialogFrame",
|
|
2872
|
+
rows: [
|
|
2873
|
+
{
|
|
2874
|
+
name: "open",
|
|
2875
|
+
type: "boolean",
|
|
2876
|
+
required: true,
|
|
2877
|
+
description: "Controlled open state."
|
|
2878
|
+
},
|
|
2879
|
+
{
|
|
2880
|
+
name: "onOpenChange",
|
|
2881
|
+
type: "(open: boolean) => void",
|
|
2882
|
+
required: true,
|
|
2883
|
+
description: "Called when it asks to open or close. Not called to close while busy."
|
|
2884
|
+
},
|
|
2885
|
+
{
|
|
2886
|
+
name: "title",
|
|
2887
|
+
type: "ReactNode",
|
|
2888
|
+
description: "The task or the question. Leave it out only when the children carry a DialogTitle."
|
|
2889
|
+
},
|
|
2890
|
+
{
|
|
2891
|
+
name: "description",
|
|
2892
|
+
type: "ReactNode",
|
|
2893
|
+
description: "A sentence or two of context, announced with the title."
|
|
2894
|
+
},
|
|
2895
|
+
{
|
|
2896
|
+
name: "children",
|
|
2897
|
+
type: "ReactNode",
|
|
2898
|
+
description: "The body, which scrolls between the header and the footer."
|
|
2899
|
+
},
|
|
2900
|
+
{
|
|
2901
|
+
name: "actions",
|
|
2902
|
+
type: "ReactNode",
|
|
2903
|
+
description: "The dialog's own buttons, primary last. Cancel is added before them."
|
|
2904
|
+
},
|
|
2905
|
+
{
|
|
2906
|
+
name: "cancelLabel",
|
|
2907
|
+
type: "ReactNode",
|
|
2908
|
+
default: "'Cancel'",
|
|
2909
|
+
description: "Cancel's words."
|
|
2910
|
+
},
|
|
2911
|
+
{
|
|
2912
|
+
name: "footer",
|
|
2913
|
+
type: "ReactNode",
|
|
2914
|
+
description: "The whole footer, in place of Cancel and actions."
|
|
2915
|
+
},
|
|
2916
|
+
{
|
|
2917
|
+
name: "start",
|
|
2918
|
+
type: "ReactNode",
|
|
2919
|
+
description: "A quiet action at the footer's start edge."
|
|
2920
|
+
},
|
|
2921
|
+
{
|
|
2922
|
+
name: "align",
|
|
2923
|
+
type: "'start' | 'center'",
|
|
2924
|
+
default: "'start'",
|
|
2925
|
+
description: "center centres the header and the footer's actions."
|
|
2926
|
+
},
|
|
2927
|
+
{
|
|
2928
|
+
name: "onSubmit",
|
|
2929
|
+
type: "(event: FormEvent<HTMLFormElement>) => void | PromiseLike<unknown>",
|
|
2930
|
+
description: "Wraps the body and footer in a form. The frame stops the browser submitting and the event reaching a form above the dialog, and ignores a submit while busy. A promise keeps it busy until it settles; a rejection is said above the footer."
|
|
2931
|
+
},
|
|
2932
|
+
{
|
|
2933
|
+
name: "submitLabel",
|
|
2934
|
+
type: "ReactNode",
|
|
2935
|
+
description: "Draws the submit button last in the footer, the form's submit button."
|
|
2936
|
+
},
|
|
2937
|
+
{
|
|
2938
|
+
name: "submitTone",
|
|
2939
|
+
type: "'primary' | 'critical' | 'positive' | 'warning'",
|
|
2940
|
+
default: "'primary'",
|
|
2941
|
+
description: "The submit button's material."
|
|
2942
|
+
},
|
|
2943
|
+
{
|
|
2944
|
+
name: "submitDisabled",
|
|
2945
|
+
type: "boolean",
|
|
2946
|
+
default: "false",
|
|
2947
|
+
description: "The form is not ready: the submit button is off and Enter sends nothing."
|
|
2948
|
+
},
|
|
2949
|
+
{
|
|
2950
|
+
name: "submitTestId",
|
|
2951
|
+
type: "string",
|
|
2952
|
+
description: "A test id for the submit button."
|
|
2953
|
+
},
|
|
2954
|
+
{
|
|
2955
|
+
name: "hideCancel",
|
|
2956
|
+
type: "boolean",
|
|
2957
|
+
default: "false",
|
|
2958
|
+
description: "Leaves Cancel out."
|
|
2959
|
+
},
|
|
2960
|
+
{
|
|
2961
|
+
name: "error",
|
|
2962
|
+
type: "ReactNode",
|
|
2963
|
+
description: "A failure in your own words, as a critical alert above the footer. Wins over a rejection's message."
|
|
2964
|
+
},
|
|
2965
|
+
{
|
|
2966
|
+
name: "failureMessage",
|
|
2967
|
+
type: "ReactNode",
|
|
2968
|
+
default: "'Something went wrong. Try again.'",
|
|
2969
|
+
description: "Said for a rejection with no message of its own."
|
|
2970
|
+
},
|
|
2971
|
+
{
|
|
2972
|
+
name: "errorTestId",
|
|
2973
|
+
type: "string",
|
|
2974
|
+
description: "A test id for the failure's alert."
|
|
2975
|
+
},
|
|
2976
|
+
{
|
|
2977
|
+
name: "dismissable",
|
|
2978
|
+
type: "boolean",
|
|
2979
|
+
default: "true",
|
|
2980
|
+
description: "false: no close button, and Escape and a press outside are turned away, your own handlers for them unasked."
|
|
2981
|
+
},
|
|
2982
|
+
{
|
|
2983
|
+
name: "dismissOnOutsideClick",
|
|
2984
|
+
type: "boolean",
|
|
2985
|
+
default: "true",
|
|
2986
|
+
description: "false turns a press outside away; Escape and the close button still close it."
|
|
2987
|
+
},
|
|
2988
|
+
{
|
|
2989
|
+
name: "noValidate",
|
|
2990
|
+
type: "boolean",
|
|
2991
|
+
description: "Skip the browser's validation bubbles on that form."
|
|
2992
|
+
},
|
|
2993
|
+
{
|
|
2994
|
+
name: "busy",
|
|
2995
|
+
type: "boolean",
|
|
2996
|
+
default: "false",
|
|
2997
|
+
description: "Holds the dialog shut and switches Cancel off while a save runs."
|
|
2998
|
+
},
|
|
2999
|
+
{
|
|
3000
|
+
name: "scroll",
|
|
3001
|
+
type: "boolean",
|
|
3002
|
+
default: "true",
|
|
3003
|
+
description: "Whether the body scrolls. See DialogBody."
|
|
3004
|
+
},
|
|
3005
|
+
{
|
|
3006
|
+
name: "bodyClassName",
|
|
3007
|
+
type: "string",
|
|
3008
|
+
description: "A class on the body, e.g. a grid for the fields."
|
|
3009
|
+
},
|
|
3010
|
+
{
|
|
3011
|
+
name: "waitForMenus",
|
|
3012
|
+
type: "boolean",
|
|
3013
|
+
default: "true",
|
|
3014
|
+
description: "See Dialog."
|
|
3015
|
+
}
|
|
3016
|
+
]
|
|
3017
|
+
}),
|
|
3018
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
3019
|
+
title: "useDialogPortalContainer",
|
|
3020
|
+
rows: [{
|
|
3021
|
+
name: "returns",
|
|
3022
|
+
type: "HTMLElement | null",
|
|
3023
|
+
description: "The layer inside the nearest dialog or sheet that nested pickers portal to, or null outside one."
|
|
3024
|
+
}]
|
|
3025
|
+
}),
|
|
3026
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
3027
|
+
title: "DialogTitle, DialogDescription",
|
|
3028
|
+
rows: [{
|
|
3029
|
+
name: "children",
|
|
3030
|
+
type: "ReactNode",
|
|
3031
|
+
required: true,
|
|
3032
|
+
description: "Title: the task or question, set in Sora. Description: one or two sentences of context."
|
|
3033
|
+
}, {
|
|
3034
|
+
name: "asChild",
|
|
3035
|
+
type: "boolean",
|
|
3036
|
+
default: "false",
|
|
3037
|
+
description: "Render your own heading or paragraph element."
|
|
3038
|
+
}]
|
|
3039
|
+
}),
|
|
3040
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
3041
|
+
title: "ConfirmDialog",
|
|
3042
|
+
rows: [
|
|
3043
|
+
{
|
|
3044
|
+
name: "open",
|
|
3045
|
+
type: "boolean",
|
|
3046
|
+
required: true,
|
|
3047
|
+
description: "Controlled open state."
|
|
3048
|
+
},
|
|
3049
|
+
{
|
|
3050
|
+
name: "onOpenChange",
|
|
3051
|
+
type: "(open: boolean) => void",
|
|
3052
|
+
required: true,
|
|
3053
|
+
description: "Called when it asks to open or close. Ignored while busy."
|
|
3054
|
+
},
|
|
3055
|
+
{
|
|
3056
|
+
name: "title",
|
|
3057
|
+
type: "ReactNode",
|
|
3058
|
+
required: true,
|
|
3059
|
+
description: "The question, e.g. \"Log out of Orbit?\"."
|
|
3060
|
+
},
|
|
3061
|
+
{
|
|
3062
|
+
name: "description",
|
|
3063
|
+
type: "ReactNode",
|
|
3064
|
+
description: "What happens if they confirm, in a sentence or two."
|
|
3065
|
+
},
|
|
3066
|
+
{
|
|
3067
|
+
name: "confirmLabel",
|
|
3068
|
+
type: "ReactNode",
|
|
3069
|
+
required: true,
|
|
3070
|
+
description: "The verb that confirms, e.g. \"Delete products\". Never just \"OK\"."
|
|
3071
|
+
},
|
|
3072
|
+
{
|
|
3073
|
+
name: "cancelLabel",
|
|
3074
|
+
type: "ReactNode",
|
|
3075
|
+
default: "'Cancel'",
|
|
3076
|
+
description: "The way out. Change it when \"Cancel\" would be ambiguous, e.g. \"Keep order\"."
|
|
3077
|
+
},
|
|
3078
|
+
{
|
|
3079
|
+
name: "tone",
|
|
3080
|
+
type: "'critical' | 'warning' | 'positive'",
|
|
3081
|
+
description: "critical: the red pill; warning: the amber pill. Both put first focus on Cancel. positive: the green pill."
|
|
3082
|
+
},
|
|
3083
|
+
{
|
|
3084
|
+
name: "error",
|
|
3085
|
+
type: "ReactNode",
|
|
3086
|
+
description: "A failure in your own words, above the buttons: one from work you ran yourself."
|
|
3087
|
+
},
|
|
3088
|
+
{
|
|
3089
|
+
name: "failureMessage",
|
|
3090
|
+
type: "ReactNode",
|
|
3091
|
+
default: "'Something went wrong. Try again.'",
|
|
3092
|
+
description: "Said when onConfirm rejects with no message of its own."
|
|
3093
|
+
},
|
|
3094
|
+
{
|
|
3095
|
+
name: "errorTestId",
|
|
3096
|
+
type: "string",
|
|
3097
|
+
description: "A test id for the failure's alert."
|
|
3098
|
+
},
|
|
3099
|
+
{
|
|
3100
|
+
name: "confirmPhrase",
|
|
3101
|
+
type: "string",
|
|
3102
|
+
description: "The text the person must type before the confirm button works. Compared after trimming both ends. Draws a field under the dialog's content and gives it first focus."
|
|
3103
|
+
},
|
|
3104
|
+
{
|
|
3105
|
+
name: "confirmPhraseLabel",
|
|
3106
|
+
type: "ReactNode",
|
|
3107
|
+
default: "Type <phrase> to confirm",
|
|
3108
|
+
description: "The field's label. The phrase is set in mono by default."
|
|
3109
|
+
},
|
|
3110
|
+
{
|
|
3111
|
+
name: "phraseMatch",
|
|
3112
|
+
type: "'exact' | 'case-insensitive'",
|
|
3113
|
+
default: "'exact'",
|
|
3114
|
+
description: "How the typed text is compared with the phrase. Use case-insensitive for an email."
|
|
3115
|
+
},
|
|
3116
|
+
{
|
|
3117
|
+
name: "phraseMessages",
|
|
3118
|
+
type: "{ mismatch?: ReactNode; match?: ReactNode }",
|
|
3119
|
+
description: "The feedback under the field, once something is typed. Defaults \"That does not match yet.\" and \"That matches.\", announced politely."
|
|
3120
|
+
},
|
|
3121
|
+
{
|
|
3122
|
+
name: "confirmDisabled",
|
|
3123
|
+
type: "boolean",
|
|
3124
|
+
default: "false",
|
|
3125
|
+
description: "Holds the confirm button off whatever the phrase says, e.g. a password still empty."
|
|
3126
|
+
},
|
|
3127
|
+
{
|
|
3128
|
+
name: "showCancel",
|
|
3129
|
+
type: "boolean",
|
|
3130
|
+
default: "true",
|
|
3131
|
+
description: "false is an acknowledgement that offers only the confirm button."
|
|
3132
|
+
},
|
|
3133
|
+
{
|
|
3134
|
+
name: "onConfirm",
|
|
3135
|
+
type: "() => void | Promise<unknown>",
|
|
3136
|
+
required: true,
|
|
3137
|
+
description: "Runs on confirm. Return a promise to show the busy state: it closes when it resolves, and stays open and says why when it rejects. Return nothing and it closes straight away, unless you control loading."
|
|
3138
|
+
},
|
|
3139
|
+
{
|
|
3140
|
+
name: "loading",
|
|
3141
|
+
type: "boolean",
|
|
3142
|
+
description: "Controls the busy state yourself. You then close the dialog."
|
|
3143
|
+
},
|
|
3144
|
+
{
|
|
3145
|
+
name: "restoreFocus",
|
|
3146
|
+
type: "boolean",
|
|
3147
|
+
default: "true",
|
|
3148
|
+
description: "Hand focus back on close. Turn it off when the answer leaves the page (Log out), so focus goes to no one on the way out."
|
|
3149
|
+
},
|
|
3150
|
+
{
|
|
3151
|
+
name: "children",
|
|
3152
|
+
type: "ReactNode",
|
|
3153
|
+
description: "Extra content between the description and the actions."
|
|
3154
|
+
}
|
|
3155
|
+
]
|
|
3156
|
+
})
|
|
3157
|
+
]
|
|
3158
|
+
})
|
|
3159
|
+
]
|
|
3160
|
+
});
|
|
3161
|
+
}
|
|
3162
|
+
/** The critical confirmation on its own, for the side-by-side live pair. */
|
|
3163
|
+
//#endregion
|
|
3164
|
+
export { Page, Preview };
|