@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,591 @@
|
|
|
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 { t as Playground } from "./Playground-Mk1yIWXb.js";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Button, Field, Link, OtpInput } from "@orbitcommerce/constellation";
|
|
8
|
+
import { CheckCircleIcon } from "@orbitcommerce/constellation/icons";
|
|
9
|
+
//#region src/pages/components/otp-input.tsx
|
|
10
|
+
function Preview() {
|
|
11
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12
|
+
style: { width: 232 },
|
|
13
|
+
children: /* @__PURE__ */ jsx(OtpInput, {
|
|
14
|
+
"aria-label": "Verification code",
|
|
15
|
+
variant: "segmented",
|
|
16
|
+
size: "sm",
|
|
17
|
+
defaultValue: "482"
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
var PLAYGROUND = [
|
|
22
|
+
{
|
|
23
|
+
prop: "variant",
|
|
24
|
+
type: "select",
|
|
25
|
+
options: ["single", "segmented"],
|
|
26
|
+
default: "single"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
prop: "length",
|
|
30
|
+
type: "select",
|
|
31
|
+
options: [
|
|
32
|
+
"4",
|
|
33
|
+
"6",
|
|
34
|
+
"8"
|
|
35
|
+
],
|
|
36
|
+
default: "6",
|
|
37
|
+
toAttr: (v) => v === "6" ? null : `length={${String(v)}}`
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
prop: "charset",
|
|
41
|
+
type: "select",
|
|
42
|
+
options: ["numeric", "alphanumeric"],
|
|
43
|
+
default: "numeric"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
prop: "size",
|
|
47
|
+
type: "select",
|
|
48
|
+
options: [
|
|
49
|
+
"sm",
|
|
50
|
+
"md",
|
|
51
|
+
"lg"
|
|
52
|
+
],
|
|
53
|
+
default: "md"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
prop: "invalid",
|
|
57
|
+
type: "boolean",
|
|
58
|
+
default: false
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
prop: "disabled",
|
|
62
|
+
type: "boolean",
|
|
63
|
+
default: false
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
prop: "readOnly",
|
|
67
|
+
type: "boolean",
|
|
68
|
+
default: false
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
var RIGHT_CODE = "482913";
|
|
72
|
+
/** A two-factor challenge. The check is the app's; OtpInput says when the code is whole. */
|
|
73
|
+
function Challenge({ variant }) {
|
|
74
|
+
const [code, setCode] = useState("");
|
|
75
|
+
const [outcome, setOutcome] = useState("idle");
|
|
76
|
+
const check = (candidate) => setOutcome(candidate === RIGHT_CODE ? "right" : "wrong");
|
|
77
|
+
return /* @__PURE__ */ jsxs("form", {
|
|
78
|
+
noValidate: true,
|
|
79
|
+
className: "otp-form",
|
|
80
|
+
onSubmit: (event) => {
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
if (code.length === 6) check(code);
|
|
83
|
+
},
|
|
84
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
85
|
+
label: "Authenticator code",
|
|
86
|
+
hint: "Enter the 6-digit code from your authenticator app",
|
|
87
|
+
error: outcome === "wrong" ? "That code is not right. Check the app and try again" : void 0,
|
|
88
|
+
labelAside: /* @__PURE__ */ jsx(Link, {
|
|
89
|
+
href: "#challenge",
|
|
90
|
+
size: "sm",
|
|
91
|
+
onClick: (event) => event.preventDefault(),
|
|
92
|
+
children: "Use a backup code"
|
|
93
|
+
}),
|
|
94
|
+
children: /* @__PURE__ */ jsx(OtpInput, {
|
|
95
|
+
variant,
|
|
96
|
+
value: code,
|
|
97
|
+
onValueChange: (next) => {
|
|
98
|
+
setCode(next);
|
|
99
|
+
setOutcome("idle");
|
|
100
|
+
},
|
|
101
|
+
onComplete: check,
|
|
102
|
+
autoComplete: "one-time-code"
|
|
103
|
+
})
|
|
104
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
105
|
+
className: "otp-actions",
|
|
106
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
107
|
+
role: "status",
|
|
108
|
+
className: "otp-status",
|
|
109
|
+
children: outcome === "right" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CheckCircleIcon, {
|
|
110
|
+
weight: "fill",
|
|
111
|
+
"aria-hidden": "true"
|
|
112
|
+
}), "Signed in"] }) : null
|
|
113
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
114
|
+
type: "submit",
|
|
115
|
+
variant: "primary",
|
|
116
|
+
disabled: code.length !== 6,
|
|
117
|
+
children: "Verify"
|
|
118
|
+
})]
|
|
119
|
+
})]
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function BackupCode({ variant }) {
|
|
123
|
+
const [code, setCode] = useState("");
|
|
124
|
+
return /* @__PURE__ */ jsx("div", {
|
|
125
|
+
className: "otp-form",
|
|
126
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
127
|
+
label: "Backup code",
|
|
128
|
+
hint: "Each backup code works once",
|
|
129
|
+
children: /* @__PURE__ */ jsx(OtpInput, {
|
|
130
|
+
variant,
|
|
131
|
+
length: 8,
|
|
132
|
+
charset: "alphanumeric",
|
|
133
|
+
value: code,
|
|
134
|
+
onValueChange: setCode
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function Complete() {
|
|
140
|
+
const [done, setDone] = useState();
|
|
141
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
142
|
+
className: "otp-form",
|
|
143
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
144
|
+
label: "Verification code",
|
|
145
|
+
children: /* @__PURE__ */ jsx(OtpInput, {
|
|
146
|
+
variant: "segmented",
|
|
147
|
+
onComplete: setDone,
|
|
148
|
+
onValueChange: () => setDone(void 0)
|
|
149
|
+
})
|
|
150
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
151
|
+
className: "otp-report",
|
|
152
|
+
role: "status",
|
|
153
|
+
children: done ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
154
|
+
/* @__PURE__ */ jsx("code", { children: "onComplete" }),
|
|
155
|
+
" was called with ",
|
|
156
|
+
/* @__PURE__ */ jsxs("code", { children: [
|
|
157
|
+
"\"",
|
|
158
|
+
done,
|
|
159
|
+
"\""
|
|
160
|
+
] })
|
|
161
|
+
] }) : "Type or paste six digits."
|
|
162
|
+
})]
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function Page() {
|
|
166
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
167
|
+
title: "One-time code",
|
|
168
|
+
status: "new",
|
|
169
|
+
importNames: ["OtpInput"],
|
|
170
|
+
lead: "A field for the code from an authenticator app, a text message or a list of backup codes. Draw it as one centred field, or as a box for each character. A pasted or auto-filled code is taken whole, and a phone is asked to offer the code it just received.",
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
173
|
+
id: "playground",
|
|
174
|
+
title: "Playground",
|
|
175
|
+
description: /* @__PURE__ */ jsx("p", { children: "Type a few digits and paste a whole code (try 482 913). Switch variant to segmented for a box for each character, where Backspace on an empty box goes back. Change the props to see each state." }),
|
|
176
|
+
children: /* @__PURE__ */ jsx(Playground, {
|
|
177
|
+
component: "OtpInput",
|
|
178
|
+
controls: PLAYGROUND,
|
|
179
|
+
render: (v) => /* @__PURE__ */ jsx("div", {
|
|
180
|
+
className: "otp-stage",
|
|
181
|
+
children: /* @__PURE__ */ jsx(OtpInput, {
|
|
182
|
+
"aria-label": "Verification code",
|
|
183
|
+
variant: v.variant,
|
|
184
|
+
length: Number(v.length),
|
|
185
|
+
charset: v.charset,
|
|
186
|
+
size: v.size,
|
|
187
|
+
invalid: Boolean(v.invalid),
|
|
188
|
+
disabled: Boolean(v.disabled),
|
|
189
|
+
readOnly: Boolean(v.readOnly)
|
|
190
|
+
}, `${String(v.variant)}-${String(v.length)}-${String(v.charset)}`)
|
|
191
|
+
})
|
|
192
|
+
})
|
|
193
|
+
}),
|
|
194
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
195
|
+
id: "single",
|
|
196
|
+
title: "One field",
|
|
197
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
198
|
+
"The default: one centred monospace field, 18px with 0.05em tracking and \"000000\" as its placeholder, as the vendor dashboard's two-factor screens draw it. It cleans what is typed to the digits, calls",
|
|
199
|
+
" ",
|
|
200
|
+
/* @__PURE__ */ jsx("code", { children: "onComplete" }),
|
|
201
|
+
" when the code reaches its length, and asks the phone to offer the code it just received. A paste is cleaned before the browser can cut it at six characters, so \"482 913\" works."
|
|
202
|
+
] }), /* @__PURE__ */ jsx("p", { children: "Try it: a correct code is 482913. Type a wrong one and the Field's error appears; change a digit and it clears." })] }),
|
|
203
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
204
|
+
minHeight: 260,
|
|
205
|
+
code: `
|
|
206
|
+
const [code, setCode] = useState('')
|
|
207
|
+
|
|
208
|
+
<Field label="Authenticator code" hint="Enter the 6-digit code from your authenticator app" error={wrong ? 'That code is not right. Check the app and try again' : undefined}>
|
|
209
|
+
<OtpInput value={code} onValueChange={setCode} onComplete={verify} />
|
|
210
|
+
</Field>
|
|
211
|
+
<Button type="submit" variant="primary" disabled={code.length !== 6}>Verify</Button>`,
|
|
212
|
+
children: /* @__PURE__ */ jsx(Challenge, { variant: "single" })
|
|
213
|
+
})
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
216
|
+
id: "segmented",
|
|
217
|
+
title: "A box for each character",
|
|
218
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
219
|
+
/* @__PURE__ */ jsx("code", { children: "variant=\"segmented\"" }),
|
|
220
|
+
" draws a box for each character. Typing moves on to the next box; Backspace clears a box, and on an empty box goes back and removes the character before it; the arrow keys, Home and End move between boxes. A box selects its character when it gains focus, so the next key replaces it.",
|
|
221
|
+
" ",
|
|
222
|
+
/* @__PURE__ */ jsx("code", { children: "onComplete" }),
|
|
223
|
+
" is called when the code reaches its length, and again if a character of a full code is changed."
|
|
224
|
+
] }),
|
|
225
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
226
|
+
minHeight: 260,
|
|
227
|
+
code: `<OtpInput variant="segmented" value={code} onValueChange={setCode} onComplete={verify} />`,
|
|
228
|
+
children: /* @__PURE__ */ jsx(Challenge, { variant: "segmented" })
|
|
229
|
+
})
|
|
230
|
+
}),
|
|
231
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
232
|
+
id: "backup",
|
|
233
|
+
title: "Backup codes",
|
|
234
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
235
|
+
/* @__PURE__ */ jsx("code", { children: "charset=\"alphanumeric\"" }),
|
|
236
|
+
" takes letters and digits and brings up the ordinary keyboard instead of the numeric one. Give it the code's ",
|
|
237
|
+
/* @__PURE__ */ jsx("code", { children: "length" }),
|
|
238
|
+
". Eight boxes shrink together on a phone rather than overflow."
|
|
239
|
+
] }),
|
|
240
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
241
|
+
code: `
|
|
242
|
+
<OtpInput length={8} charset="alphanumeric" />
|
|
243
|
+
<OtpInput variant="segmented" length={8} charset="alphanumeric" />`,
|
|
244
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
245
|
+
className: "otp-pair",
|
|
246
|
+
children: [/* @__PURE__ */ jsx(BackupCode, { variant: "single" }), /* @__PURE__ */ jsx(BackupCode, { variant: "segmented" })]
|
|
247
|
+
})
|
|
248
|
+
})
|
|
249
|
+
}),
|
|
250
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
251
|
+
id: "paste",
|
|
252
|
+
title: "Paste and auto-fill",
|
|
253
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("p", { children: "A paste lands wherever the cursor is. A whole code replaces everything, whichever box it landed in, and a shorter one overwrites from that box. Spaces and dashes are dropped, so \"482 913\" and \"482-913\" both work, and what the code does not take (letters in a numeric code) is ignored." }), /* @__PURE__ */ jsxs("p", { children: [
|
|
254
|
+
"Every box says ",
|
|
255
|
+
/* @__PURE__ */ jsx("code", { children: "autocomplete=\"one-time-code\"" }),
|
|
256
|
+
" and takes no ",
|
|
257
|
+
/* @__PURE__ */ jsx("code", { children: "maxlength" }),
|
|
258
|
+
", which is how a phone offers the code from a text message and then writes all of it into the box that has focus: the field spreads it across the rest. The single field says the same and takes the whole code at once."
|
|
259
|
+
] })] }),
|
|
260
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
261
|
+
code: `<OtpInput variant="segmented" onComplete={(code) => console.log(code)} />`,
|
|
262
|
+
children: /* @__PURE__ */ jsx(Complete, {})
|
|
263
|
+
}), /* @__PURE__ */ jsx(Note, {
|
|
264
|
+
title: "Test it on a phone",
|
|
265
|
+
children: "Auto-fill from a text message is the phone's own, and cannot be driven from a desktop browser. Check it on a real iPhone and Android phone with a real code before you rely on it for sign-in."
|
|
266
|
+
})]
|
|
267
|
+
}),
|
|
268
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
269
|
+
id: "sizes",
|
|
270
|
+
title: "Sizes",
|
|
271
|
+
description: /* @__PURE__ */ jsx("p", { children: "The single field follows an Input: 30, 36 (default) or 44px tall, with the digits at 16, 18 and 20px. Segmented boxes are 32 x 36, 40 x 44 (default) and 48 x 52." }),
|
|
272
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
273
|
+
align: "fill",
|
|
274
|
+
code: `
|
|
275
|
+
<OtpInput size="sm" />
|
|
276
|
+
<OtpInput />
|
|
277
|
+
<OtpInput size="lg" />
|
|
278
|
+
|
|
279
|
+
<OtpInput variant="segmented" size="sm" />
|
|
280
|
+
<OtpInput variant="segmented" />
|
|
281
|
+
<OtpInput variant="segmented" size="lg" />`,
|
|
282
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
283
|
+
className: "otp-sizes",
|
|
284
|
+
children: [
|
|
285
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
286
|
+
"aria-label": "Small code",
|
|
287
|
+
size: "sm",
|
|
288
|
+
defaultValue: "482913"
|
|
289
|
+
}),
|
|
290
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
291
|
+
"aria-label": "Default code",
|
|
292
|
+
defaultValue: "482913"
|
|
293
|
+
}),
|
|
294
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
295
|
+
"aria-label": "Large code",
|
|
296
|
+
size: "lg",
|
|
297
|
+
defaultValue: "482913"
|
|
298
|
+
}),
|
|
299
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
300
|
+
"aria-label": "Small code in boxes",
|
|
301
|
+
variant: "segmented",
|
|
302
|
+
size: "sm",
|
|
303
|
+
defaultValue: "482913"
|
|
304
|
+
}),
|
|
305
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
306
|
+
"aria-label": "Default code in boxes",
|
|
307
|
+
variant: "segmented",
|
|
308
|
+
defaultValue: "482913"
|
|
309
|
+
}),
|
|
310
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
311
|
+
"aria-label": "Large code in boxes",
|
|
312
|
+
variant: "segmented",
|
|
313
|
+
size: "lg",
|
|
314
|
+
defaultValue: "482913"
|
|
315
|
+
})
|
|
316
|
+
]
|
|
317
|
+
})
|
|
318
|
+
})
|
|
319
|
+
}),
|
|
320
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
321
|
+
id: "states",
|
|
322
|
+
title: "States",
|
|
323
|
+
description: /* @__PURE__ */ jsx("p", { children: "Empty, partly typed, complete, invalid, disabled and read-only, in both themes. The field and each box are an Input frame, so hover firms the hairline, focus turns it teal with a halo, and an error turns it red." }),
|
|
324
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
325
|
+
align: "fill",
|
|
326
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
327
|
+
className: "otp-states",
|
|
328
|
+
children: [
|
|
329
|
+
/* @__PURE__ */ jsx(OtpInput, { "aria-label": "Empty field" }),
|
|
330
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
331
|
+
"aria-label": "Complete field",
|
|
332
|
+
defaultValue: "482913"
|
|
333
|
+
}),
|
|
334
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
335
|
+
"aria-label": "Invalid field",
|
|
336
|
+
defaultValue: "482913",
|
|
337
|
+
invalid: true
|
|
338
|
+
}),
|
|
339
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
340
|
+
"aria-label": "Disabled field",
|
|
341
|
+
defaultValue: "482",
|
|
342
|
+
disabled: true
|
|
343
|
+
}),
|
|
344
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
345
|
+
"aria-label": "Empty code",
|
|
346
|
+
variant: "segmented"
|
|
347
|
+
}),
|
|
348
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
349
|
+
"aria-label": "Partly typed code",
|
|
350
|
+
variant: "segmented",
|
|
351
|
+
defaultValue: "48"
|
|
352
|
+
}),
|
|
353
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
354
|
+
"aria-label": "Complete code",
|
|
355
|
+
variant: "segmented",
|
|
356
|
+
defaultValue: "482913"
|
|
357
|
+
}),
|
|
358
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
359
|
+
"aria-label": "Invalid code",
|
|
360
|
+
variant: "segmented",
|
|
361
|
+
defaultValue: "482913",
|
|
362
|
+
invalid: true
|
|
363
|
+
}),
|
|
364
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
365
|
+
"aria-label": "Disabled code",
|
|
366
|
+
variant: "segmented",
|
|
367
|
+
defaultValue: "482",
|
|
368
|
+
disabled: true
|
|
369
|
+
}),
|
|
370
|
+
/* @__PURE__ */ jsx(OtpInput, {
|
|
371
|
+
"aria-label": "Read-only code",
|
|
372
|
+
variant: "segmented",
|
|
373
|
+
defaultValue: "482913",
|
|
374
|
+
readOnly: true
|
|
375
|
+
})
|
|
376
|
+
]
|
|
377
|
+
})
|
|
378
|
+
})
|
|
379
|
+
}),
|
|
380
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
381
|
+
id: "guidelines",
|
|
382
|
+
title: "Guidelines",
|
|
383
|
+
children: [/* @__PURE__ */ jsx(DoDont, {
|
|
384
|
+
do: {
|
|
385
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
386
|
+
className: "otp-narrow",
|
|
387
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
388
|
+
label: "Authenticator code",
|
|
389
|
+
hint: "Enter the 6-digit code from your authenticator app",
|
|
390
|
+
children: /* @__PURE__ */ jsx(OtpInput, {
|
|
391
|
+
size: "sm",
|
|
392
|
+
defaultValue: "48"
|
|
393
|
+
})
|
|
394
|
+
})
|
|
395
|
+
}),
|
|
396
|
+
caption: "Say where the code comes from and how long it is."
|
|
397
|
+
},
|
|
398
|
+
dont: {
|
|
399
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
400
|
+
className: "otp-narrow",
|
|
401
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
402
|
+
label: "Code",
|
|
403
|
+
children: /* @__PURE__ */ jsx(OtpInput, {
|
|
404
|
+
size: "sm",
|
|
405
|
+
defaultValue: "48"
|
|
406
|
+
})
|
|
407
|
+
})
|
|
408
|
+
}),
|
|
409
|
+
caption: "A bare \"Code\" does not say where the code comes from or how long it is, so people guess."
|
|
410
|
+
}
|
|
411
|
+
}), /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
412
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
413
|
+
"Verify when the code is complete (",
|
|
414
|
+
/* @__PURE__ */ jsx("code", { children: "onComplete" }),
|
|
415
|
+
"), and keep a Verify button for people who prefer it. Do not clear the code on a wrong one, in a field or in boxes: let the person fix the digit."
|
|
416
|
+
] }),
|
|
417
|
+
"Offer a way to get another code, and another way in (a backup code), beside the field, not hidden behind the error.",
|
|
418
|
+
/* @__PURE__ */ jsx(Fragment$1, { children: "For a code someone must type by hand from a screen, a single field is easier to edit; boxes are better for codes that arrive by text and are pasted or filled for you." }),
|
|
419
|
+
"Do not lock people out silently. Say how many tries are left, or when they can try again."
|
|
420
|
+
] })]
|
|
421
|
+
}),
|
|
422
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
423
|
+
id: "accessibility",
|
|
424
|
+
title: "Accessibility",
|
|
425
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
426
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
427
|
+
"Segmented, the boxes are a group named by the Field's label (or ",
|
|
428
|
+
/* @__PURE__ */ jsx("code", { children: "aria-label" }),
|
|
429
|
+
", or \"Verification code\"), and each box has its own name: \"Digit 1 of 6\", or \"Character 1 of 8\" for letters and digits. Say them in your language with ",
|
|
430
|
+
/* @__PURE__ */ jsx("code", { children: "boxLabel" }),
|
|
431
|
+
" and ",
|
|
432
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
433
|
+
"."
|
|
434
|
+
] }),
|
|
435
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
436
|
+
"The Field's label focuses the first box; its hint and error describe the group, not every box, so a screen reader says them once. An error also marks every box ",
|
|
437
|
+
/* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
|
|
438
|
+
", and a required Field marks each ",
|
|
439
|
+
/* @__PURE__ */ jsx("code", { children: "aria-required" }),
|
|
440
|
+
"."
|
|
441
|
+
] }),
|
|
442
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
443
|
+
"The keyboard is the right one: ",
|
|
444
|
+
/* @__PURE__ */ jsx("code", { children: "inputmode=\"numeric\"" }),
|
|
445
|
+
" for digits, the ordinary keyboard for letters, with autocorrect and capitals off. Every box asks for ",
|
|
446
|
+
/* @__PURE__ */ jsx("code", { children: "one-time-code" }),
|
|
447
|
+
"."
|
|
448
|
+
] }),
|
|
449
|
+
"Tab walks through the boxes and out; the arrow keys, Home and End move between them without leaving. Each box selects its character on focus, so the next key replaces it.",
|
|
450
|
+
"The boxes read left to right whatever the page direction, as a code does."
|
|
451
|
+
] })
|
|
452
|
+
}),
|
|
453
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
454
|
+
id: "props",
|
|
455
|
+
title: "Props",
|
|
456
|
+
children: [
|
|
457
|
+
/* @__PURE__ */ jsx(PropsTable, { rows: [
|
|
458
|
+
{
|
|
459
|
+
name: "value, defaultValue, onValueChange",
|
|
460
|
+
type: "string, string, (value: string) => void",
|
|
461
|
+
description: "The code, controlled or not. onValueChange gets the code already cleaned of what it does not take; it is not called for a form reset."
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
name: "onComplete",
|
|
465
|
+
type: "(code: string) => void",
|
|
466
|
+
description: "Called when the code reaches its length, and again when a character of a full code is changed."
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
name: "length",
|
|
470
|
+
type: "number",
|
|
471
|
+
default: "6",
|
|
472
|
+
description: "How many characters the code has."
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
name: "charset",
|
|
476
|
+
type: "'numeric' | 'alphanumeric'",
|
|
477
|
+
default: "'numeric'",
|
|
478
|
+
description: "Digits only, or letters and digits (backup codes)."
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
name: "variant",
|
|
482
|
+
type: "'single' | 'segmented'",
|
|
483
|
+
default: "'single'",
|
|
484
|
+
description: "One centred monospace field, or a box for each character."
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
name: "size",
|
|
488
|
+
type: "'sm' | 'md' | 'lg'",
|
|
489
|
+
default: "'md'",
|
|
490
|
+
description: "The single field 30, 36 or 44px tall; boxes 32 x 36, 40 x 44, 48 x 52."
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
name: "invalid",
|
|
494
|
+
type: "boolean",
|
|
495
|
+
description: "The error treatment. Inside a Field, follows the Field's error."
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
name: "disabled, readOnly, required",
|
|
499
|
+
type: "boolean",
|
|
500
|
+
description: "As an input; on every box."
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
name: "autoFocus",
|
|
504
|
+
type: "boolean",
|
|
505
|
+
description: "Puts the cursor in the first empty box (or the field) when it appears."
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
name: "name",
|
|
509
|
+
type: "string",
|
|
510
|
+
description: "Name for a form. A hidden field carries the whole code when segmented; like a disabled input, it is left out of a submit while the code is disabled."
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
name: "placeholder",
|
|
514
|
+
type: "string",
|
|
515
|
+
description: "One character for an empty box, or the single field's text. A numeric single field shows zeros by default."
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
name: "autoComplete",
|
|
519
|
+
type: "string",
|
|
520
|
+
default: "'one-time-code'",
|
|
521
|
+
description: "Has a phone offer the code it received."
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
name: "boxLabel",
|
|
525
|
+
type: "(position: number, length: number) => string",
|
|
526
|
+
default: "\"Digit 1 of 6\"",
|
|
527
|
+
description: "Name of each box for assistive tech. Segmented only."
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
name: "label",
|
|
531
|
+
type: "string",
|
|
532
|
+
default: "'Verification code'",
|
|
533
|
+
description: "Name of the whole code when a Field or aria-label does not give one."
|
|
534
|
+
}
|
|
535
|
+
] }),
|
|
536
|
+
/* @__PURE__ */ jsxs("p", {
|
|
537
|
+
className: "doc-section__description",
|
|
538
|
+
children: [
|
|
539
|
+
/* @__PURE__ */ jsx("code", { children: "ref" }),
|
|
540
|
+
" goes to the first input, so ",
|
|
541
|
+
/* @__PURE__ */ jsx("code", { children: "ref.current.focus()" }),
|
|
542
|
+
" works for either variant. Other attributes (",
|
|
543
|
+
/* @__PURE__ */ jsx("code", { children: "className" }),
|
|
544
|
+
", ",
|
|
545
|
+
/* @__PURE__ */ jsx("code", { children: "style" }),
|
|
546
|
+
", ",
|
|
547
|
+
/* @__PURE__ */ jsx("code", { children: "data-*" }),
|
|
548
|
+
") go to the wrapper, which says",
|
|
549
|
+
" ",
|
|
550
|
+
/* @__PURE__ */ jsx("code", { children: "data-variant" }),
|
|
551
|
+
", ",
|
|
552
|
+
/* @__PURE__ */ jsx("code", { children: "data-size" }),
|
|
553
|
+
", ",
|
|
554
|
+
/* @__PURE__ */ jsx("code", { children: "data-invalid" }),
|
|
555
|
+
" and ",
|
|
556
|
+
/* @__PURE__ */ jsx("code", { children: "data-disabled" }),
|
|
557
|
+
" for both variants. A code that keeps its own value goes back to its default when its form is reset (a reset button, or the reset after a form action); a controlled one is put back by its host. A reset is not reported to",
|
|
558
|
+
" ",
|
|
559
|
+
/* @__PURE__ */ jsx("code", { children: "onValueChange" }),
|
|
560
|
+
", as nothing was typed: a host that mirrors an uncontrolled code listens for the form's ",
|
|
561
|
+
/* @__PURE__ */ jsx("code", { children: "reset" }),
|
|
562
|
+
" event, or controls the code. A form that cancels the reset keeps the code as it is, like its other controls. Put it in a",
|
|
563
|
+
" ",
|
|
564
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
565
|
+
to: "/components/input#field",
|
|
566
|
+
children: "Field"
|
|
567
|
+
}),
|
|
568
|
+
" for its label, hint and error."
|
|
569
|
+
]
|
|
570
|
+
}),
|
|
571
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
572
|
+
title: "Keys",
|
|
573
|
+
children: /* @__PURE__ */ jsx(DocTable, {
|
|
574
|
+
columns: ["Key", "In a box"],
|
|
575
|
+
rows: [
|
|
576
|
+
["A character the code takes", "Writes it, replacing what is there, and moves to the next box"],
|
|
577
|
+
["Backspace", "Clears the box and stays; on an empty box, goes back and removes the character before"],
|
|
578
|
+
["Delete", "Clears the box and closes the gap"],
|
|
579
|
+
["Left, Right, Home, End", "Move between the boxes"],
|
|
580
|
+
["Paste", "Spreads the code from this box, or whole if it is as long as the code"]
|
|
581
|
+
]
|
|
582
|
+
})
|
|
583
|
+
})
|
|
584
|
+
]
|
|
585
|
+
}),
|
|
586
|
+
/* @__PURE__ */ jsx(Fragment$1, {})
|
|
587
|
+
]
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
//#endregion
|
|
591
|
+
export { Page, Preview };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { t as DocLink } from "./host-B6znjEgQ.js";
|
|
3
|
-
import { o as pagesIn, t as CATEGORIES } from "./registry-
|
|
4
|
-
import { c as ImportLine, i as DocPage } from "./docs-
|
|
3
|
+
import { o as pagesIn, t as CATEGORIES } from "./registry-BZg-xAbi.js";
|
|
4
|
+
import { c as ImportLine, i as DocPage } from "./docs-lM2UBSir.js";
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { Button } from "@orbitcommerce/constellation";
|
|
@@ -28,7 +28,7 @@ function usePreviews(pages) {
|
|
|
28
28
|
var COMPONENT_PAGES = pagesIn("components");
|
|
29
29
|
var PATTERN_PAGES = pagesIn("patterns");
|
|
30
30
|
var ALL = [...COMPONENT_PAGES, ...PATTERN_PAGES];
|
|
31
|
-
function Gallery() {
|
|
31
|
+
function Gallery$1() {
|
|
32
32
|
const previews = usePreviews(ALL);
|
|
33
33
|
const families = [
|
|
34
34
|
...CATEGORIES.map((c) => ({
|
|
@@ -122,7 +122,7 @@ function Page() {
|
|
|
122
122
|
})
|
|
123
123
|
]
|
|
124
124
|
}),
|
|
125
|
-
/* @__PURE__ */ jsx(Gallery, {})
|
|
125
|
+
/* @__PURE__ */ jsx(Gallery$1, {})
|
|
126
126
|
]
|
|
127
127
|
});
|
|
128
128
|
}
|