@orbitcommerce/constellation-docs 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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-BZOOOPA9.js +368 -0
- package/dist/pages/address-fields-CwSqro3W.js +277 -0
- package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
- package/dist/pages/{alert-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-CQEM1_wc.js +1567 -0
- package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
- package/dist/pages/chart-legend-B20AbakD.js +724 -0
- package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
- package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
- package/dist/pages/checklist-card-DEyykVFS.js +783 -0
- package/dist/pages/chip-Ck-o3Ui6.js +839 -0
- package/dist/pages/chip-list-k1LxXuCi.js +414 -0
- package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
- package/dist/pages/coachmark-Be2ghobT.js +366 -0
- package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
- package/dist/pages/collab-field-CfqqK7d2.js +696 -0
- package/dist/pages/color-field-CZpfcA-A.js +1127 -0
- package/dist/pages/{colour-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-BB3mNl7D.js +1364 -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-C3UcpQJT.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-B38rnzoq.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-LA9XRhZc.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-cfPVTB5V.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-C-4tg6FS.js} +580 -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-BZg-xAbi.js +594 -0
- package/dist/pages/{release-Dvo684UJ.js → release-Cs6tl16C.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-CL0vomno.js +3225 -0
- package/dist/pages/{tabs-B4M-usCV.js → tabs-Dh0mUsLw.js} +256 -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 +10984 -1108
- package/package.json +2 -2
- 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,1093 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as DocLink } from "./host-B6znjEgQ.js";
|
|
3
|
+
import { a as DocTable, d as Section$1, i as DocPage, l as Note, m as ThemePair, o as Example, p as SubSection, r as DoDont, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Button, Checkbox, Dialog, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Field, Input, RadioGroup, RadioGroupItem, SegmentedControl, Stepper } from "@orbitcommerce/constellation";
|
|
7
|
+
//#region src/pages/components/stepper.tsx
|
|
8
|
+
/** Invented steps of one checkout, so the demos have somewhere to go. */
|
|
9
|
+
var CHECKOUT_STEPS = [
|
|
10
|
+
{
|
|
11
|
+
key: "details",
|
|
12
|
+
label: "Details",
|
|
13
|
+
description: "Who is buying"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: "delivery",
|
|
17
|
+
label: "Delivery",
|
|
18
|
+
description: "Where and how fast"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
key: "payment",
|
|
22
|
+
label: "Payment",
|
|
23
|
+
description: "How they pay"
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
var ERROR_STEPS = [
|
|
27
|
+
{
|
|
28
|
+
key: "details",
|
|
29
|
+
label: "Details",
|
|
30
|
+
description: "Who is buying"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: "delivery",
|
|
34
|
+
label: "Delivery",
|
|
35
|
+
description: "No rate for this address",
|
|
36
|
+
status: "error"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: "payment",
|
|
40
|
+
label: "Payment",
|
|
41
|
+
description: "How they pay"
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
var OPTIONAL_STEPS = [
|
|
45
|
+
{
|
|
46
|
+
key: "details",
|
|
47
|
+
label: "Details",
|
|
48
|
+
description: "Who is buying"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: "delivery",
|
|
52
|
+
label: "Delivery",
|
|
53
|
+
description: "Where and how fast"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: "gift",
|
|
57
|
+
label: "Gift note",
|
|
58
|
+
description: "A message for the parcel",
|
|
59
|
+
optional: true
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
var DISABLED_STEPS = [
|
|
63
|
+
{
|
|
64
|
+
key: "details",
|
|
65
|
+
label: "Details",
|
|
66
|
+
description: "Who is buying"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
key: "delivery",
|
|
70
|
+
label: "Delivery",
|
|
71
|
+
description: "Coming soon for this address",
|
|
72
|
+
disabled: true
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: "payment",
|
|
76
|
+
label: "Payment",
|
|
77
|
+
description: "How they pay"
|
|
78
|
+
}
|
|
79
|
+
];
|
|
80
|
+
var DELIVERY_OPTIONS = [
|
|
81
|
+
{
|
|
82
|
+
value: "standard",
|
|
83
|
+
label: "Standard"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
value: "express",
|
|
87
|
+
label: "Express"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
value: "collect",
|
|
91
|
+
label: "Collect"
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
function Preview() {
|
|
95
|
+
return /* @__PURE__ */ jsx(Stepper, {
|
|
96
|
+
className: "stepper-preview",
|
|
97
|
+
steps: [{
|
|
98
|
+
key: "details",
|
|
99
|
+
label: "Details"
|
|
100
|
+
}, {
|
|
101
|
+
key: "delivery",
|
|
102
|
+
label: "Delivery"
|
|
103
|
+
}],
|
|
104
|
+
current: "delivery",
|
|
105
|
+
footer: false
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/** The full three-step checkout: a panel of fields per step, Back and Next, and Finish at the end. */
|
|
109
|
+
function Checkout() {
|
|
110
|
+
const [current, setCurrent] = useState("details");
|
|
111
|
+
const [name, setName] = useState("Sarah Whitfield");
|
|
112
|
+
const [email, setEmail] = useState("sarah.whitfield@harbourdesk.example");
|
|
113
|
+
const [delivery, setDelivery] = useState("standard");
|
|
114
|
+
const [placed, setPlaced] = useState("");
|
|
115
|
+
const step = CHECKOUT_STEPS.find((each) => each.key === current);
|
|
116
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
117
|
+
className: "stepper-stage",
|
|
118
|
+
children: /* @__PURE__ */ jsxs(Stepper, {
|
|
119
|
+
steps: CHECKOUT_STEPS,
|
|
120
|
+
current,
|
|
121
|
+
onCurrentChange: setCurrent,
|
|
122
|
+
onFinish: () => setPlaced("Order #1044 placed for Sarah Whitfield."),
|
|
123
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
124
|
+
className: "stepper-panel-title",
|
|
125
|
+
children: step?.label
|
|
126
|
+
}), current === "details" ? /* @__PURE__ */ jsxs("div", {
|
|
127
|
+
className: "stepper-fields",
|
|
128
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
129
|
+
label: "Name",
|
|
130
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
131
|
+
value: name,
|
|
132
|
+
onChange: (event) => setName(event.target.value)
|
|
133
|
+
})
|
|
134
|
+
}), /* @__PURE__ */ jsx(Field, {
|
|
135
|
+
label: "Email",
|
|
136
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
137
|
+
type: "email",
|
|
138
|
+
value: email,
|
|
139
|
+
onChange: (event) => setEmail(event.target.value)
|
|
140
|
+
})
|
|
141
|
+
})]
|
|
142
|
+
}) : current === "delivery" ? /* @__PURE__ */ jsx("div", {
|
|
143
|
+
className: "stepper-fields",
|
|
144
|
+
children: /* @__PURE__ */ jsx(SegmentedControl, {
|
|
145
|
+
"aria-label": "Delivery speed",
|
|
146
|
+
fullWidth: true,
|
|
147
|
+
value: delivery,
|
|
148
|
+
onValueChange: setDelivery,
|
|
149
|
+
options: DELIVERY_OPTIONS
|
|
150
|
+
})
|
|
151
|
+
}) : /* @__PURE__ */ jsxs("p", {
|
|
152
|
+
className: "stepper-text",
|
|
153
|
+
children: [
|
|
154
|
+
"Card ending 4242, billed to ",
|
|
155
|
+
name,
|
|
156
|
+
"."
|
|
157
|
+
]
|
|
158
|
+
})]
|
|
159
|
+
})
|
|
160
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
161
|
+
className: "stepper-status",
|
|
162
|
+
"aria-live": "polite",
|
|
163
|
+
children: placed
|
|
164
|
+
})] });
|
|
165
|
+
}
|
|
166
|
+
/** A short host for the states: the panel is the step's own words, so the step list is what is being shown. */
|
|
167
|
+
function Wizard({ steps, start, orientation }) {
|
|
168
|
+
const [current, setCurrent] = useState(start ?? steps[0]?.key ?? "");
|
|
169
|
+
const step = steps.find((each) => each.key === current);
|
|
170
|
+
return /* @__PURE__ */ jsx("div", {
|
|
171
|
+
className: "stepper-stage",
|
|
172
|
+
children: /* @__PURE__ */ jsxs(Stepper, {
|
|
173
|
+
steps,
|
|
174
|
+
current,
|
|
175
|
+
onCurrentChange: setCurrent,
|
|
176
|
+
orientation,
|
|
177
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
178
|
+
className: "stepper-panel-title",
|
|
179
|
+
children: step?.label
|
|
180
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
181
|
+
className: "stepper-text",
|
|
182
|
+
children: step?.description ?? "…"
|
|
183
|
+
})]
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
/** Next is held until the step is valid. */
|
|
188
|
+
function HeldCheckout() {
|
|
189
|
+
const [current, setCurrent] = useState("details");
|
|
190
|
+
const [name, setName] = useState("");
|
|
191
|
+
const [email, setEmail] = useState("");
|
|
192
|
+
const valid = name.trim() !== "" && email.trim() !== "";
|
|
193
|
+
const step = CHECKOUT_STEPS.find((each) => each.key === current);
|
|
194
|
+
return /* @__PURE__ */ jsx("div", {
|
|
195
|
+
className: "stepper-stage",
|
|
196
|
+
children: /* @__PURE__ */ jsxs(Stepper, {
|
|
197
|
+
steps: CHECKOUT_STEPS,
|
|
198
|
+
current,
|
|
199
|
+
onCurrentChange: setCurrent,
|
|
200
|
+
nextDisabled: current === "details" && !valid,
|
|
201
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
202
|
+
className: "stepper-panel-title",
|
|
203
|
+
children: step?.label
|
|
204
|
+
}), current === "details" ? /* @__PURE__ */ jsxs("div", {
|
|
205
|
+
className: "stepper-fields",
|
|
206
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
207
|
+
label: "Name",
|
|
208
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
209
|
+
value: name,
|
|
210
|
+
placeholder: "Sarah Whitfield",
|
|
211
|
+
onChange: (event) => setName(event.target.value)
|
|
212
|
+
})
|
|
213
|
+
}), /* @__PURE__ */ jsx(Field, {
|
|
214
|
+
label: "Email",
|
|
215
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
216
|
+
type: "email",
|
|
217
|
+
value: email,
|
|
218
|
+
placeholder: "name@example.com",
|
|
219
|
+
onChange: (event) => setEmail(event.target.value)
|
|
220
|
+
})
|
|
221
|
+
})]
|
|
222
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
223
|
+
className: "stepper-text",
|
|
224
|
+
children: step?.description
|
|
225
|
+
})]
|
|
226
|
+
})
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/** Next spins while the step is saved, then the stepper moves on. */
|
|
230
|
+
function BusyCheckout() {
|
|
231
|
+
const [current, setCurrent] = useState("details");
|
|
232
|
+
const [saving, setSaving] = useState(false);
|
|
233
|
+
const step = CHECKOUT_STEPS.find((each) => each.key === current);
|
|
234
|
+
const save = () => {
|
|
235
|
+
setSaving(true);
|
|
236
|
+
window.setTimeout(() => {
|
|
237
|
+
setSaving(false);
|
|
238
|
+
setCurrent((key) => key === "details" ? "delivery" : "payment");
|
|
239
|
+
}, 1200);
|
|
240
|
+
};
|
|
241
|
+
return /* @__PURE__ */ jsx("div", {
|
|
242
|
+
className: "stepper-stage",
|
|
243
|
+
children: /* @__PURE__ */ jsxs(Stepper, {
|
|
244
|
+
steps: CHECKOUT_STEPS,
|
|
245
|
+
current,
|
|
246
|
+
onNext: save,
|
|
247
|
+
busy: saving,
|
|
248
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
249
|
+
className: "stepper-panel-title",
|
|
250
|
+
children: step?.label
|
|
251
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
252
|
+
className: "stepper-text",
|
|
253
|
+
children: "Saving this step before it moves on."
|
|
254
|
+
})]
|
|
255
|
+
})
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
var SIGN_UP_STEPS = [
|
|
259
|
+
{
|
|
260
|
+
key: "email",
|
|
261
|
+
label: "Your email",
|
|
262
|
+
nextLabel: "Continue"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
key: "store",
|
|
266
|
+
label: "Your store"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
key: "location",
|
|
270
|
+
label: "Where you trade"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
key: "confirm",
|
|
274
|
+
label: "Check and confirm",
|
|
275
|
+
nextLabel: "Create my store"
|
|
276
|
+
}
|
|
277
|
+
];
|
|
278
|
+
/** A sign-up: the compact header, a lone Continue first, a live email check a press waits for, and Enter to move on. */
|
|
279
|
+
function SignUp() {
|
|
280
|
+
const [current, setCurrent] = useState("email");
|
|
281
|
+
const [email, setEmail] = useState("");
|
|
282
|
+
const [checking, setChecking] = useState(false);
|
|
283
|
+
const [store, setStore] = useState("");
|
|
284
|
+
const [city, setCity] = useState("");
|
|
285
|
+
const [terms, setTerms] = useState(false);
|
|
286
|
+
const [errorsFor, setErrorsFor] = useState(null);
|
|
287
|
+
const [done, setDone] = useState("");
|
|
288
|
+
const showErrors = errorsFor === current;
|
|
289
|
+
useEffect(() => {
|
|
290
|
+
if (!email.includes("@")) return void 0;
|
|
291
|
+
setChecking(true);
|
|
292
|
+
const timer = window.setTimeout(() => setChecking(false), 900);
|
|
293
|
+
return () => window.clearTimeout(timer);
|
|
294
|
+
}, [email]);
|
|
295
|
+
const missing = (key) => key === "email" ? !email.includes("@") : key === "store" ? store.trim() === "" : key === "location" ? city.trim() === "" : !terms;
|
|
296
|
+
const restart = () => {
|
|
297
|
+
setEmail("");
|
|
298
|
+
setStore("");
|
|
299
|
+
setCity("");
|
|
300
|
+
setTerms(false);
|
|
301
|
+
setErrorsFor(null);
|
|
302
|
+
setDone("");
|
|
303
|
+
setCurrent("email");
|
|
304
|
+
};
|
|
305
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
306
|
+
className: "stepper-stage stepper-stage--narrow",
|
|
307
|
+
children: [/* @__PURE__ */ jsx(Stepper, {
|
|
308
|
+
variant: "compact",
|
|
309
|
+
footerLayout: "fill",
|
|
310
|
+
advanceOnEnter: true,
|
|
311
|
+
steps: SIGN_UP_STEPS,
|
|
312
|
+
current,
|
|
313
|
+
onCurrentChange: setCurrent,
|
|
314
|
+
checking: current === "email" && checking,
|
|
315
|
+
headerAction: current !== "email" ? /* @__PURE__ */ jsx(Button, {
|
|
316
|
+
variant: "ghost",
|
|
317
|
+
size: "xs",
|
|
318
|
+
onClick: restart,
|
|
319
|
+
children: "Restart registration"
|
|
320
|
+
}) : null,
|
|
321
|
+
validate: (key) => {
|
|
322
|
+
if (!missing(key)) return true;
|
|
323
|
+
setErrorsFor(key);
|
|
324
|
+
return false;
|
|
325
|
+
},
|
|
326
|
+
onFinish: () => setDone(`${store} is set up. We have sent a link to ${email}.`),
|
|
327
|
+
children: current === "email" ? /* @__PURE__ */ jsx(Field, {
|
|
328
|
+
label: "Work email",
|
|
329
|
+
hint: checking ? "Checking the address is free" : void 0,
|
|
330
|
+
error: showErrors && missing("email") ? "Enter an email address, like name@example.com" : void 0,
|
|
331
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
332
|
+
type: "email",
|
|
333
|
+
value: email,
|
|
334
|
+
placeholder: "name@example.com",
|
|
335
|
+
onChange: (event) => setEmail(event.target.value)
|
|
336
|
+
})
|
|
337
|
+
}) : current === "store" ? /* @__PURE__ */ jsx(Field, {
|
|
338
|
+
label: "Store name",
|
|
339
|
+
error: showErrors && missing("store") ? "Give your store a name" : void 0,
|
|
340
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
341
|
+
value: store,
|
|
342
|
+
placeholder: "Harbour Desk Co",
|
|
343
|
+
onChange: (event) => setStore(event.target.value)
|
|
344
|
+
})
|
|
345
|
+
}) : current === "location" ? /* @__PURE__ */ jsx(Field, {
|
|
346
|
+
label: "Town or city",
|
|
347
|
+
error: showErrors && missing("location") ? "Say where you trade from" : void 0,
|
|
348
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
349
|
+
value: city,
|
|
350
|
+
placeholder: "Bristol",
|
|
351
|
+
onChange: (event) => setCity(event.target.value)
|
|
352
|
+
})
|
|
353
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
354
|
+
className: "stepper-fields",
|
|
355
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
356
|
+
className: "stepper-text",
|
|
357
|
+
children: [
|
|
358
|
+
store || "Your store",
|
|
359
|
+
", trading from ",
|
|
360
|
+
city || "your town",
|
|
361
|
+
", for ",
|
|
362
|
+
email || "your email",
|
|
363
|
+
"."
|
|
364
|
+
]
|
|
365
|
+
}), /* @__PURE__ */ jsx(Field, {
|
|
366
|
+
label: "Terms",
|
|
367
|
+
hideLabel: true,
|
|
368
|
+
error: showErrors && missing("confirm") ? "Accept the terms to carry on" : void 0,
|
|
369
|
+
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
370
|
+
label: "I accept the terms of service",
|
|
371
|
+
checked: terms,
|
|
372
|
+
onCheckedChange: (next) => setTerms(next === true)
|
|
373
|
+
})
|
|
374
|
+
})]
|
|
375
|
+
})
|
|
376
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
377
|
+
className: "stepper-status",
|
|
378
|
+
"aria-live": "polite",
|
|
379
|
+
children: done
|
|
380
|
+
})]
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
var CANCEL_STEPS = [
|
|
384
|
+
{
|
|
385
|
+
key: "keep",
|
|
386
|
+
label: "We are sorry to see you go",
|
|
387
|
+
nextLabel: "Continue"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
key: "reason",
|
|
391
|
+
label: "Help us improve",
|
|
392
|
+
nextLabel: "Continue"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
key: "confirm",
|
|
396
|
+
label: "Confirm cancellation",
|
|
397
|
+
nextLabel: "Yes, cancel my plan"
|
|
398
|
+
}
|
|
399
|
+
];
|
|
400
|
+
var REASONS = [
|
|
401
|
+
{
|
|
402
|
+
value: "cost",
|
|
403
|
+
label: "It costs too much"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
value: "features",
|
|
407
|
+
label: "Missing features I need"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
value: "closed",
|
|
411
|
+
label: "Business closed or paused"
|
|
412
|
+
}
|
|
413
|
+
];
|
|
414
|
+
/** A cancel-plan dialog: no steps drawn (the subtitle names the step), a way out first, a critical Next, the footer in the dialog's. */
|
|
415
|
+
function CancelPlan() {
|
|
416
|
+
const [open, setOpen] = useState(false);
|
|
417
|
+
const [current, setCurrent] = useState("keep");
|
|
418
|
+
const [reason, setReason] = useState("");
|
|
419
|
+
const [cancelled, setCancelled] = useState(false);
|
|
420
|
+
const step = CANCEL_STEPS.find((each) => each.key === current);
|
|
421
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs(Dialog, {
|
|
422
|
+
open,
|
|
423
|
+
onOpenChange: (next) => {
|
|
424
|
+
setOpen(next);
|
|
425
|
+
if (next) {
|
|
426
|
+
setCurrent("keep");
|
|
427
|
+
setReason("");
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
children: [/* @__PURE__ */ jsx(DialogTrigger, {
|
|
431
|
+
asChild: true,
|
|
432
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
433
|
+
variant: "critical-outline",
|
|
434
|
+
children: cancelled ? "Plan cancelled" : "Cancel plan"
|
|
435
|
+
})
|
|
436
|
+
}), /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Cancel your plan" }), /* @__PURE__ */ jsx(DialogDescription, { children: step?.label })] }), /* @__PURE__ */ jsx(Stepper, {
|
|
437
|
+
variant: "headless",
|
|
438
|
+
tone: "critical",
|
|
439
|
+
className: "stepper-dialog",
|
|
440
|
+
steps: CANCEL_STEPS,
|
|
441
|
+
current,
|
|
442
|
+
onCurrentChange: setCurrent,
|
|
443
|
+
exitAction: {
|
|
444
|
+
label: "Keep my plan",
|
|
445
|
+
onClick: () => setOpen(false)
|
|
446
|
+
},
|
|
447
|
+
nextDisabled: current === "reason" && reason === "",
|
|
448
|
+
footer: (actions) => /* @__PURE__ */ jsx(DialogFooter, { children: actions }),
|
|
449
|
+
onFinish: () => {
|
|
450
|
+
setCancelled(true);
|
|
451
|
+
setOpen(false);
|
|
452
|
+
},
|
|
453
|
+
children: /* @__PURE__ */ jsx(DialogBody, { children: current === "keep" ? /* @__PURE__ */ jsx("p", {
|
|
454
|
+
className: "stepper-text",
|
|
455
|
+
children: "Your shop stays open until the end of the paid period, 14 November."
|
|
456
|
+
}) : current === "reason" ? /* @__PURE__ */ jsx(RadioGroup, {
|
|
457
|
+
"aria-label": "Why are you cancelling?",
|
|
458
|
+
value: reason,
|
|
459
|
+
onValueChange: setReason,
|
|
460
|
+
children: REASONS.map((each) => /* @__PURE__ */ jsx(RadioGroupItem, {
|
|
461
|
+
value: each.value,
|
|
462
|
+
label: each.label
|
|
463
|
+
}, each.value))
|
|
464
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
465
|
+
className: "stepper-text",
|
|
466
|
+
children: "Harbour Desk Co moves to the free plan on 14 November. You can keep your plan any time before then."
|
|
467
|
+
}) })
|
|
468
|
+
})] })]
|
|
469
|
+
}) });
|
|
470
|
+
}
|
|
471
|
+
function Page() {
|
|
472
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
473
|
+
title: "Stepper",
|
|
474
|
+
status: "new",
|
|
475
|
+
importNames: ["Stepper", "stepperLabels"],
|
|
476
|
+
lead: "The numbered steps across the top of a wizard: a panel for the current step and Back and Next below it. Reach for it when a task has to be done in order, in a known number of steps, and the person should see how far along they are.",
|
|
477
|
+
children: [
|
|
478
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
479
|
+
id: "basics",
|
|
480
|
+
title: "A wizard's steps",
|
|
481
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
482
|
+
"A ",
|
|
483
|
+
/* @__PURE__ */ jsx("code", { children: "Stepper" }),
|
|
484
|
+
" draws the steps, a panel for the current one and a footer with Back and Next; you keep the steps' content. The step named by ",
|
|
485
|
+
/* @__PURE__ */ jsx("code", { children: "current" }),
|
|
486
|
+
" is the current one, the steps before it are done and the ones after are upcoming. Back and Next move to the previous and next step for you, and Finish appears on the last one and calls ",
|
|
487
|
+
/* @__PURE__ */ jsx("code", { children: "onFinish" }),
|
|
488
|
+
"."
|
|
489
|
+
] }), /* @__PURE__ */ jsxs("p", { children: [
|
|
490
|
+
"Reach for it when a task is done in order and the count matters: a checkout, a new-role flow, a first-run setup. When the steps are independent settings rather than a sequence, put them in",
|
|
491
|
+
" ",
|
|
492
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
493
|
+
to: "/components/record-layout",
|
|
494
|
+
children: "sections on the page"
|
|
495
|
+
}),
|
|
496
|
+
", and when the whole task is one short form, use a ",
|
|
497
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
498
|
+
to: "/components/dialog",
|
|
499
|
+
children: "dialog"
|
|
500
|
+
}),
|
|
501
|
+
". A wizard belongs on a page, not in a dialog."
|
|
502
|
+
] })] }),
|
|
503
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
504
|
+
align: "fill",
|
|
505
|
+
code: `
|
|
506
|
+
const [current, setCurrent] = useState('details')
|
|
507
|
+
|
|
508
|
+
<Stepper steps={steps} current={current} onCurrentChange={setCurrent} onFinish={placeOrder}>
|
|
509
|
+
<h3>{step.label}</h3>
|
|
510
|
+
{current === 'details' ? <DetailsFields /> : null}
|
|
511
|
+
{current === 'delivery' ? <DeliveryOptions /> : null}
|
|
512
|
+
{current === 'payment' ? <PaymentSummary /> : null}
|
|
513
|
+
</Stepper>`,
|
|
514
|
+
caption: "Move through the three steps, then Finish. A done step can be clicked back to; focus moves to the panel's heading as the step changes.",
|
|
515
|
+
children: /* @__PURE__ */ jsx(Checkout, {})
|
|
516
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
517
|
+
title: "The steps are a frame; the fields are yours",
|
|
518
|
+
children: [
|
|
519
|
+
"The Stepper keeps the step list, the footer and the focus. What each step holds, and whether Next may be pressed yet, is the page's: pass ",
|
|
520
|
+
/* @__PURE__ */ jsx("code", { children: "nextDisabled" }),
|
|
521
|
+
" while a step is invalid, and put the fields in the panel as ",
|
|
522
|
+
/* @__PURE__ */ jsx("code", { children: "children" }),
|
|
523
|
+
", one set per step."
|
|
524
|
+
]
|
|
525
|
+
})]
|
|
526
|
+
}),
|
|
527
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
528
|
+
id: "states",
|
|
529
|
+
title: "States",
|
|
530
|
+
description: /* @__PURE__ */ jsx("p", { children: "Every state a step can be in, and the props that reach it." }),
|
|
531
|
+
children: [
|
|
532
|
+
/* @__PURE__ */ jsxs(SubSection, {
|
|
533
|
+
title: "A step with a problem",
|
|
534
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
535
|
+
align: "fill",
|
|
536
|
+
code: `// The step itself: { key: 'delivery', label: 'Delivery', status: 'error' }
|
|
537
|
+
<Stepper steps={steps} current="payment" onCurrentChange={setCurrent} />`,
|
|
538
|
+
children: /* @__PURE__ */ jsx(Wizard, {
|
|
539
|
+
steps: ERROR_STEPS,
|
|
540
|
+
start: "payment"
|
|
541
|
+
})
|
|
542
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
543
|
+
className: "stepper-prose",
|
|
544
|
+
children: [
|
|
545
|
+
/* @__PURE__ */ jsx("code", { children: "status: 'error'" }),
|
|
546
|
+
" marks a step with a problem: the marker turns to a warning, and a screen reader hears ",
|
|
547
|
+
/* @__PURE__ */ jsx("em", { children: "Has a problem" }),
|
|
548
|
+
" after the label. The step stays where ",
|
|
549
|
+
/* @__PURE__ */ jsx("code", { children: "current" }),
|
|
550
|
+
" puts it: press Back here and the step with the problem is the current one, marked as such; from a later step it is a done step you can click back to, to fix it. Use it for a step that could not be finished, not for one that is merely empty."
|
|
551
|
+
]
|
|
552
|
+
})]
|
|
553
|
+
}),
|
|
554
|
+
/* @__PURE__ */ jsxs(SubSection, {
|
|
555
|
+
title: "An optional step",
|
|
556
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
557
|
+
align: "fill",
|
|
558
|
+
code: `// { key: 'gift', label: 'Gift note', optional: true }
|
|
559
|
+
<Stepper steps={steps} current="delivery" onCurrentChange={setCurrent} />`,
|
|
560
|
+
children: /* @__PURE__ */ jsx(Wizard, {
|
|
561
|
+
steps: OPTIONAL_STEPS,
|
|
562
|
+
start: "delivery"
|
|
563
|
+
})
|
|
564
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
565
|
+
className: "stepper-prose",
|
|
566
|
+
children: [
|
|
567
|
+
/* @__PURE__ */ jsx("code", { children: "optional" }),
|
|
568
|
+
" adds the word ",
|
|
569
|
+
/* @__PURE__ */ jsx("em", { children: "Optional" }),
|
|
570
|
+
" under the label, for a step that may be skipped. It is a hint, not a rule: nothing stops the person using it, or leaving it."
|
|
571
|
+
]
|
|
572
|
+
})]
|
|
573
|
+
}),
|
|
574
|
+
/* @__PURE__ */ jsxs(SubSection, {
|
|
575
|
+
title: "A step that cannot be reached",
|
|
576
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
577
|
+
align: "fill",
|
|
578
|
+
code: `// { key: 'delivery', label: 'Delivery', disabled: true }
|
|
579
|
+
<Stepper steps={steps} current="details" onCurrentChange={setCurrent} />`,
|
|
580
|
+
children: /* @__PURE__ */ jsx(Wizard, {
|
|
581
|
+
steps: DISABLED_STEPS,
|
|
582
|
+
start: "details"
|
|
583
|
+
})
|
|
584
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
585
|
+
className: "stepper-prose",
|
|
586
|
+
children: [
|
|
587
|
+
"A ",
|
|
588
|
+
/* @__PURE__ */ jsx("code", { children: "disabled" }),
|
|
589
|
+
" step is skipped by Next and Back and cannot be clicked back to. Use it for a step that does not apply on this route, rather than hiding it and changing the count."
|
|
590
|
+
]
|
|
591
|
+
})]
|
|
592
|
+
}),
|
|
593
|
+
/* @__PURE__ */ jsxs(SubSection, {
|
|
594
|
+
title: "Held while the step is invalid",
|
|
595
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
596
|
+
align: "fill",
|
|
597
|
+
code: `<Stepper steps={steps} current={current} onCurrentChange={setCurrent} nextDisabled={!valid} />`,
|
|
598
|
+
children: /* @__PURE__ */ jsx(HeldCheckout, {})
|
|
599
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
600
|
+
className: "stepper-prose",
|
|
601
|
+
children: [/* @__PURE__ */ jsx("code", { children: "nextDisabled" }), " holds Next (or Finish) off, so a person cannot leave a step that is not ready. It is native: the button cannot be Tabbed to, so the step is read before it is passed. Fill both fields above to unlock Next."]
|
|
602
|
+
})]
|
|
603
|
+
}),
|
|
604
|
+
/* @__PURE__ */ jsxs(SubSection, {
|
|
605
|
+
title: "Busy while the step saves",
|
|
606
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
607
|
+
align: "fill",
|
|
608
|
+
code: `<Stepper steps={steps} current={current} onNext={save} busy={saving} />`,
|
|
609
|
+
children: /* @__PURE__ */ jsx(BusyCheckout, {})
|
|
610
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
611
|
+
className: "stepper-prose",
|
|
612
|
+
children: [
|
|
613
|
+
/* @__PURE__ */ jsx("code", { children: "busy" }),
|
|
614
|
+
" puts the kit Button's loading state on Next (or Finish): the comet runs and a second press does nothing until the work is done. Pair it with your own ",
|
|
615
|
+
/* @__PURE__ */ jsx("code", { children: "onNext" }),
|
|
616
|
+
" when the step saves before moving on."
|
|
617
|
+
]
|
|
618
|
+
})]
|
|
619
|
+
}),
|
|
620
|
+
/* @__PURE__ */ jsxs(SubSection, {
|
|
621
|
+
title: "Vertical",
|
|
622
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
623
|
+
align: "fill",
|
|
624
|
+
code: `<Stepper steps={steps} current={current} onCurrentChange={setCurrent} orientation="vertical" />`,
|
|
625
|
+
children: /* @__PURE__ */ jsx(Wizard, {
|
|
626
|
+
steps: CHECKOUT_STEPS,
|
|
627
|
+
start: "delivery",
|
|
628
|
+
orientation: "vertical"
|
|
629
|
+
})
|
|
630
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
631
|
+
className: "stepper-prose",
|
|
632
|
+
children: [/* @__PURE__ */ jsx("code", { children: "orientation=\"vertical\"" }), " runs the steps down the start side with the panel beside them and Back and Next across the foot, for a wizard with more room for words or a taller panel. The Stepper folds by its own width, not the window's: narrower than 40rem (a side panel, a pane, a phone) the detail lines go, the horizontal steps keep only the markers and the current step's words, and vertical steps stack above the panel."]
|
|
633
|
+
})]
|
|
634
|
+
})
|
|
635
|
+
]
|
|
636
|
+
}),
|
|
637
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
638
|
+
id: "compact",
|
|
639
|
+
title: "Compact, for a sign-up",
|
|
640
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
641
|
+
/* @__PURE__ */ jsx("code", { children: "variant=\"compact\"" }),
|
|
642
|
+
" draws \"Step 2 of 4\" over a thin bar in place of the numbered list, with an end action (",
|
|
643
|
+
/* @__PURE__ */ jsx("code", { children: "headerAction" }),
|
|
644
|
+
": \"Restart registration\"). ",
|
|
645
|
+
/* @__PURE__ */ jsx("code", { children: "footerLayout=\"fill\"" }),
|
|
646
|
+
" shares the footer's width between Back and Next, and a lone Continue on the first step takes all of it. A step's own ",
|
|
647
|
+
/* @__PURE__ */ jsx("code", { children: "nextLabel" }),
|
|
648
|
+
" renames Next (\"Continue\", \"Create my store\")."
|
|
649
|
+
] }),
|
|
650
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
651
|
+
code: `
|
|
652
|
+
<Stepper
|
|
653
|
+
variant="compact"
|
|
654
|
+
footerLayout="fill"
|
|
655
|
+
advanceOnEnter
|
|
656
|
+
steps={[
|
|
657
|
+
{ key: 'email', label: 'Your email', nextLabel: 'Continue' },
|
|
658
|
+
{ key: 'store', label: 'Your store' },
|
|
659
|
+
{ key: 'location', label: 'Where you trade' },
|
|
660
|
+
{ key: 'confirm', label: 'Check and confirm', nextLabel: 'Create my store' },
|
|
661
|
+
]}
|
|
662
|
+
current={current}
|
|
663
|
+
onCurrentChange={setCurrent}
|
|
664
|
+
checking={emailCheckIsOut}
|
|
665
|
+
headerAction={current !== 'email' ? <Button variant="ghost" size="xs" onClick={restart}>Restart registration</Button> : null}
|
|
666
|
+
validate={(key) => {
|
|
667
|
+
if (!missing(key)) return true
|
|
668
|
+
setErrorsFor(key)
|
|
669
|
+
return false
|
|
670
|
+
}}
|
|
671
|
+
onFinish={createStore}
|
|
672
|
+
>
|
|
673
|
+
{fieldsFor(current)}
|
|
674
|
+
</Stepper>`,
|
|
675
|
+
children: /* @__PURE__ */ jsx(SignUp, {})
|
|
676
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
677
|
+
title: "Checking a step",
|
|
678
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
679
|
+
"Next stays pressable on a step that is not ready: ",
|
|
680
|
+
/* @__PURE__ */ jsx("code", { children: "validate" }),
|
|
681
|
+
" is asked as it is pressed, and a",
|
|
682
|
+
" ",
|
|
683
|
+
/* @__PURE__ */ jsx("code", { children: "false" }),
|
|
684
|
+
" keeps the step, the host shows the errors, and focus goes to the first invalid field (one marked",
|
|
685
|
+
" ",
|
|
686
|
+
/* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
|
|
687
|
+
", as a Field with an error marks its control). A promise keeps Next busy until it answers.",
|
|
688
|
+
" ",
|
|
689
|
+
/* @__PURE__ */ jsx("code", { children: "checking" }),
|
|
690
|
+
" is a check already out (the email above is checked as it is typed): a press waits, busy, and carries on as soon as the check ends. ",
|
|
691
|
+
/* @__PURE__ */ jsx("code", { children: "advanceOnEnter" }),
|
|
692
|
+
" lets Enter in a text field press Next, but not in a combobox, a checkbox or a textarea. Press Continue with the field empty, then type an address and press Enter at once."
|
|
693
|
+
] })
|
|
694
|
+
})]
|
|
695
|
+
}),
|
|
696
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
697
|
+
id: "headless",
|
|
698
|
+
title: "Headless, in a dialog",
|
|
699
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
700
|
+
/* @__PURE__ */ jsx("code", { children: "variant=\"headless\"" }),
|
|
701
|
+
" draws no steps, for a dialog whose subtitle names the step. ",
|
|
702
|
+
/* @__PURE__ */ jsx("code", { children: "exitAction" }),
|
|
703
|
+
" ",
|
|
704
|
+
"takes Back's place on the first step (\"Keep my plan\" closes the dialog), ",
|
|
705
|
+
/* @__PURE__ */ jsx("code", { children: "tone=\"critical\"" }),
|
|
706
|
+
" draws Next and Finish as the critical fill, and a ",
|
|
707
|
+
/* @__PURE__ */ jsx("code", { children: "footer" }),
|
|
708
|
+
" function hands the buttons to the dialog's own footer, which then draws the room round them."
|
|
709
|
+
] }),
|
|
710
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
711
|
+
code: `
|
|
712
|
+
<DialogContent>
|
|
713
|
+
<DialogHeader>
|
|
714
|
+
<DialogTitle>Cancel your plan</DialogTitle>
|
|
715
|
+
<DialogDescription>{step.label}</DialogDescription>
|
|
716
|
+
</DialogHeader>
|
|
717
|
+
<Stepper
|
|
718
|
+
variant="headless"
|
|
719
|
+
tone="critical"
|
|
720
|
+
steps={steps}
|
|
721
|
+
current={current}
|
|
722
|
+
onCurrentChange={setCurrent}
|
|
723
|
+
exitAction={{ label: 'Keep my plan', onClick: () => setOpen(false) }}
|
|
724
|
+
footer={(actions) => <DialogFooter>{actions}</DialogFooter>}
|
|
725
|
+
onFinish={cancelPlan}
|
|
726
|
+
>
|
|
727
|
+
<DialogBody>{bodyFor(current)}</DialogBody>
|
|
728
|
+
</Stepper>
|
|
729
|
+
</DialogContent>`,
|
|
730
|
+
children: /* @__PURE__ */ jsx(CancelPlan, {})
|
|
731
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
732
|
+
title: "Where the footer goes",
|
|
733
|
+
children: [
|
|
734
|
+
"A placed footer is the same buttons with no hairline or room of its own, so an auth card's pinned actions take it as well: ",
|
|
735
|
+
/* @__PURE__ */ jsx("code", { children: `footer={(actions) => <AuthActions>{actions}</AuthActions>}` }),
|
|
736
|
+
"."
|
|
737
|
+
]
|
|
738
|
+
})]
|
|
739
|
+
}),
|
|
740
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
741
|
+
id: "both-themes",
|
|
742
|
+
title: "In both themes",
|
|
743
|
+
description: /* @__PURE__ */ jsx("p", { children: "A checkout, light and dark side by side. The markers carry the colour; the panel is the page." }),
|
|
744
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
745
|
+
align: "fill",
|
|
746
|
+
children: /* @__PURE__ */ jsx(Wizard, {
|
|
747
|
+
steps: CHECKOUT_STEPS,
|
|
748
|
+
start: "delivery"
|
|
749
|
+
})
|
|
750
|
+
})
|
|
751
|
+
}),
|
|
752
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
753
|
+
id: "accessibility",
|
|
754
|
+
title: "Accessibility",
|
|
755
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
756
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
757
|
+
"The steps are an ordered list named ",
|
|
758
|
+
/* @__PURE__ */ jsx("em", { children: "Steps" }),
|
|
759
|
+
", so a screen reader reads \"3 items\" as it enters it, then each step. The current step carries ",
|
|
760
|
+
/* @__PURE__ */ jsx("code", { children: "aria-current=\"step\"" }),
|
|
761
|
+
"."
|
|
762
|
+
] }),
|
|
763
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
764
|
+
"A done step is a button named by its label, with ",
|
|
765
|
+
/* @__PURE__ */ jsx("em", { children: "Done" }),
|
|
766
|
+
" announced after it; the current and upcoming steps are plain text. The number or tick in the marker is hidden from assistive technology: the place in the list carries it."
|
|
767
|
+
] }),
|
|
768
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
769
|
+
"As the step changes, a polite status announces ",
|
|
770
|
+
/* @__PURE__ */ jsx("em", { children: "Step 2 of 3: Delivery" }),
|
|
771
|
+
", and focus moves to the panel's heading (",
|
|
772
|
+
/* @__PURE__ */ jsx("code", { children: "h2" }),
|
|
773
|
+
" or ",
|
|
774
|
+
/* @__PURE__ */ jsx("code", { children: "h3" }),
|
|
775
|
+
") if it has one, or to the panel itself. It is never moved on the first render."
|
|
776
|
+
] }),
|
|
777
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
778
|
+
"An error step announces ",
|
|
779
|
+
/* @__PURE__ */ jsx("em", { children: "Has a problem" }),
|
|
780
|
+
" after its label, and an optional step shows the word",
|
|
781
|
+
/* @__PURE__ */ jsx("em", { children: "Optional" }),
|
|
782
|
+
" under it."
|
|
783
|
+
] }),
|
|
784
|
+
"Tab moves through the steps and the footer; a done step is a button (Enter or Space to go back), and Next or Finish is the primary. There is no arrow-key roving to learn.",
|
|
785
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
786
|
+
"Compact and headless steppers draw no list, but the current step's name is still in the page, hidden, so the panel is named by it and the status still says ",
|
|
787
|
+
/* @__PURE__ */ jsx("em", { children: "Step 2 of 4: Your store" }),
|
|
788
|
+
" as it changes. The compact bar is hidden from assistive tech: the count beside it says the same."
|
|
789
|
+
] }),
|
|
790
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
791
|
+
"With ",
|
|
792
|
+
/* @__PURE__ */ jsx("code", { children: "validate" }),
|
|
793
|
+
", Next is never held off for a step that is not ready: pressing it says what is missing under each field and puts focus in the first of them, so a keyboard or screen reader user lands on the problem. While a check is out, Next is busy (still focusable) and the press is kept."
|
|
794
|
+
] })
|
|
795
|
+
] })
|
|
796
|
+
}),
|
|
797
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
798
|
+
id: "guidelines",
|
|
799
|
+
title: "Guidelines",
|
|
800
|
+
children: [/* @__PURE__ */ jsx(DoDont, {
|
|
801
|
+
do: {
|
|
802
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
803
|
+
className: "stepper-dd",
|
|
804
|
+
children: /* @__PURE__ */ jsx(Wizard, {
|
|
805
|
+
steps: CHECKOUT_STEPS.slice(0, 3),
|
|
806
|
+
start: "delivery"
|
|
807
|
+
})
|
|
808
|
+
}),
|
|
809
|
+
caption: "Three named steps, the current one marked."
|
|
810
|
+
},
|
|
811
|
+
dont: {
|
|
812
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
813
|
+
className: "stepper-dd",
|
|
814
|
+
children: /* @__PURE__ */ jsx(Wizard, {
|
|
815
|
+
steps: [{
|
|
816
|
+
key: "all",
|
|
817
|
+
label: "Everything"
|
|
818
|
+
}],
|
|
819
|
+
start: "all"
|
|
820
|
+
})
|
|
821
|
+
}),
|
|
822
|
+
caption: "One step called Everything. If the task is a single form, it is a form, not a wizard."
|
|
823
|
+
}
|
|
824
|
+
}), /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
825
|
+
"Use a wizard for a task done in order, with a known set of steps. Independent settings belong in sections on the page.",
|
|
826
|
+
"Keep it short: three to five steps. Past that the person loses the shape of the task.",
|
|
827
|
+
"Name steps after the thing (\"Delivery\", \"Payment\"), not the number, so the step list reads as an outline.",
|
|
828
|
+
"Hold Next while a step is invalid (nextDisabled) rather than letting the person on and failing later.",
|
|
829
|
+
"Mark a step error only for a real problem, and optional for a step that may be skipped.",
|
|
830
|
+
"Leave the steps' own content to the page; the Stepper is the frame, the footer and the focus.",
|
|
831
|
+
"Keep a wizard on a page, not in a dialog or a drawer, and not as the app’s navigation."
|
|
832
|
+
] })]
|
|
833
|
+
}),
|
|
834
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
835
|
+
id: "props",
|
|
836
|
+
title: "Props",
|
|
837
|
+
description: /* @__PURE__ */ jsx("p", { children: "Stepper also accepts every native div attribute. Each step is a StepperStep." }),
|
|
838
|
+
children: [
|
|
839
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
840
|
+
title: "Stepper",
|
|
841
|
+
rows: [
|
|
842
|
+
{
|
|
843
|
+
name: "steps",
|
|
844
|
+
type: "StepperStep[]",
|
|
845
|
+
required: true,
|
|
846
|
+
description: "The steps, in order."
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
name: "current",
|
|
850
|
+
type: "string",
|
|
851
|
+
required: true,
|
|
852
|
+
description: "The current step's key (controlled). Steps before it are done, after it upcoming."
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
name: "onCurrentChange",
|
|
856
|
+
type: "(key: string) => void",
|
|
857
|
+
description: "Called with a step’s key when a done step is clicked, or when Back or Next moves without its own handler."
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
name: "children",
|
|
861
|
+
type: "ReactNode",
|
|
862
|
+
description: "The current step’s content, in the panel."
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
name: "footer",
|
|
866
|
+
type: "boolean | ((footer: ReactNode) => ReactNode)",
|
|
867
|
+
default: "true",
|
|
868
|
+
description: "Draw the footer with Back and Next (Finish on the last step). A function places it, as a dialog footer or pinned actions."
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
name: "onBack",
|
|
872
|
+
type: "() => void",
|
|
873
|
+
description: "What Back does. Defaults to going to the previous enabled step."
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
name: "onNext",
|
|
877
|
+
type: "() => void",
|
|
878
|
+
description: "What Next does. Defaults to going to the next enabled step."
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
name: "onFinish",
|
|
882
|
+
type: "() => void",
|
|
883
|
+
description: "What the last step’s Finish does."
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
name: "nextDisabled",
|
|
887
|
+
type: "boolean",
|
|
888
|
+
default: "false",
|
|
889
|
+
description: "Holds Next (or Finish) off, e.g. while the step is invalid."
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
name: "busy",
|
|
893
|
+
type: "boolean",
|
|
894
|
+
default: "false",
|
|
895
|
+
description: "Next or Finish is busy: the kit Button’s loading."
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
name: "allowBack",
|
|
899
|
+
type: "boolean",
|
|
900
|
+
default: "true",
|
|
901
|
+
description: "Done steps can be clicked to go back to them."
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
name: "orientation",
|
|
905
|
+
type: "'horizontal' | 'vertical'",
|
|
906
|
+
default: "'horizontal'",
|
|
907
|
+
description: "Across the top, or down the start side with the panel beside it."
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
name: "variant",
|
|
911
|
+
type: "'numbered' | 'compact' | 'headless'",
|
|
912
|
+
default: "'numbered'",
|
|
913
|
+
description: "The numbered list, a \"Step 2 of 4\" line with a thin bar, or no steps drawn."
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
name: "headerAction",
|
|
917
|
+
type: "ReactNode",
|
|
918
|
+
description: "At the end of the compact line: \"Restart registration\"."
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
name: "footerLayout",
|
|
922
|
+
type: "'split' | 'fill'",
|
|
923
|
+
default: "'split'",
|
|
924
|
+
description: "Back at the start and Next at the end, or sharing the width (a lone Next takes all of it)."
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
name: "exitAction",
|
|
928
|
+
type: "{ label: ReactNode; onClick: () => void }",
|
|
929
|
+
description: "On the first step, in Back's place: a way out (\"Keep my plan\")."
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
name: "validate",
|
|
933
|
+
type: "(key: string) => boolean | void | Promise<boolean | void>",
|
|
934
|
+
description: "Checks the step as Next is pressed: false stays and focuses the first invalid field; a promise keeps Next busy."
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
name: "checking",
|
|
938
|
+
type: "boolean",
|
|
939
|
+
default: "false",
|
|
940
|
+
description: "A check is out: a press of Next waits, busy, and carries on when it ends."
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
name: "advanceOnEnter",
|
|
944
|
+
type: "boolean",
|
|
945
|
+
default: "false",
|
|
946
|
+
description: "Enter in a text field presses Next. Not in a combobox, a checkbox or a textarea."
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
name: "tone",
|
|
950
|
+
type: "'critical'",
|
|
951
|
+
description: "Next and Finish as the critical fill."
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
name: "labels",
|
|
955
|
+
type: "Partial<StepperLabels>",
|
|
956
|
+
description: "Your words for everything the Stepper says."
|
|
957
|
+
}
|
|
958
|
+
]
|
|
959
|
+
}),
|
|
960
|
+
/* @__PURE__ */ jsx(DocTable, {
|
|
961
|
+
columns: [
|
|
962
|
+
"StepperStep",
|
|
963
|
+
"Type",
|
|
964
|
+
"What it is"
|
|
965
|
+
],
|
|
966
|
+
rows: [
|
|
967
|
+
[
|
|
968
|
+
"key",
|
|
969
|
+
"string",
|
|
970
|
+
"Identifies the step: what current and onCurrentChange name."
|
|
971
|
+
],
|
|
972
|
+
[
|
|
973
|
+
"label",
|
|
974
|
+
"ReactNode",
|
|
975
|
+
"The step’s name, e.g. \"Delivery\"."
|
|
976
|
+
],
|
|
977
|
+
[
|
|
978
|
+
"description",
|
|
979
|
+
"ReactNode",
|
|
980
|
+
"A line under the label, hidden when the stepper is narrower than 40rem."
|
|
981
|
+
],
|
|
982
|
+
[
|
|
983
|
+
"status",
|
|
984
|
+
"'error'",
|
|
985
|
+
"Marks a step with a problem. It stays the current step, or a done step that can be clicked back to."
|
|
986
|
+
],
|
|
987
|
+
[
|
|
988
|
+
"disabled",
|
|
989
|
+
"boolean",
|
|
990
|
+
"A step that cannot be reached or clicked back to."
|
|
991
|
+
],
|
|
992
|
+
[
|
|
993
|
+
"optional",
|
|
994
|
+
"boolean",
|
|
995
|
+
"Shows the optional word under the label, for a step that may be skipped."
|
|
996
|
+
],
|
|
997
|
+
[
|
|
998
|
+
"nextLabel",
|
|
999
|
+
"ReactNode",
|
|
1000
|
+
"Next’s words on this step (\"Continue\"), or Finish’s on the last."
|
|
1001
|
+
],
|
|
1002
|
+
[
|
|
1003
|
+
"actions",
|
|
1004
|
+
"ReactNode",
|
|
1005
|
+
"Buttons of this step’s own in the footer, before Next (\"Skip for now\")."
|
|
1006
|
+
]
|
|
1007
|
+
]
|
|
1008
|
+
}),
|
|
1009
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1010
|
+
title: "StepperLabels",
|
|
1011
|
+
rows: [
|
|
1012
|
+
{
|
|
1013
|
+
name: "progress",
|
|
1014
|
+
type: "(position: number, total: number, label: string) => string",
|
|
1015
|
+
default: "(p, t, l) => `Step ${p} of ${t}: ${l}`",
|
|
1016
|
+
description: "The progress summary a screen reader hears as the step changes."
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
name: "back",
|
|
1020
|
+
type: "string",
|
|
1021
|
+
default: "'Back'",
|
|
1022
|
+
description: "The Back button. Hidden on the first step."
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
name: "next",
|
|
1026
|
+
type: "string",
|
|
1027
|
+
default: "'Next'",
|
|
1028
|
+
description: "The Next button."
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
name: "finish",
|
|
1032
|
+
type: "string",
|
|
1033
|
+
default: "'Finish'",
|
|
1034
|
+
description: "The Next button on the last step."
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
name: "optional",
|
|
1038
|
+
type: "string",
|
|
1039
|
+
default: "'Optional'",
|
|
1040
|
+
description: "The word under a step that optional marks."
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
name: "done",
|
|
1044
|
+
type: "string",
|
|
1045
|
+
default: "'Done'",
|
|
1046
|
+
description: "Announced after a done step’s label. Not shown."
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
name: "error",
|
|
1050
|
+
type: "string",
|
|
1051
|
+
default: "'Has a problem'",
|
|
1052
|
+
description: "Announced after a step that status=\"error\" marks. Not shown."
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
name: "steps",
|
|
1056
|
+
type: "string",
|
|
1057
|
+
default: "'Steps'",
|
|
1058
|
+
description: "Names the step list for a screen reader."
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
name: "stepOf",
|
|
1062
|
+
type: "(position: number, total: number) => string",
|
|
1063
|
+
default: "(p, t) => `Step ${p} of ${t}`",
|
|
1064
|
+
description: "The compact line’s count."
|
|
1065
|
+
}
|
|
1066
|
+
]
|
|
1067
|
+
}),
|
|
1068
|
+
/* @__PURE__ */ jsx(DocTable, {
|
|
1069
|
+
columns: ["To do this", "Use"],
|
|
1070
|
+
rows: [
|
|
1071
|
+
["A task done in order, in steps", "Stepper"],
|
|
1072
|
+
["Independent settings on one page", /* @__PURE__ */ jsx(DocLink, {
|
|
1073
|
+
to: "/components/record-layout",
|
|
1074
|
+
children: "Record layout"
|
|
1075
|
+
})],
|
|
1076
|
+
["A side nav for a long page", /* @__PURE__ */ jsx(DocLink, {
|
|
1077
|
+
to: "/components/section-rail",
|
|
1078
|
+
children: "Section rail"
|
|
1079
|
+
})],
|
|
1080
|
+
["Tabs that switch panels without an order", /* @__PURE__ */ jsx(DocLink, {
|
|
1081
|
+
to: "/components/tabs",
|
|
1082
|
+
children: "Tabs"
|
|
1083
|
+
})]
|
|
1084
|
+
]
|
|
1085
|
+
})
|
|
1086
|
+
]
|
|
1087
|
+
}),
|
|
1088
|
+
/* @__PURE__ */ jsx(Fragment$1, {})
|
|
1089
|
+
]
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
//#endregion
|
|
1093
|
+
export { Page, Preview };
|