@orbitcommerce/constellation-docs 1.0.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs.css +14764 -2237
- package/dist/index.js +2 -2
- package/dist/pages/{Playground-CNbBbErC.js → Playground-Mk1yIWXb.js} +2 -2
- package/dist/pages/_address-data-L9BR499w.js +161 -0
- package/dist/pages/_builder-demo-C0eJUmPU.js +282 -0
- package/dist/pages/_card-art-0be5ncyV.js +18 -0
- package/dist/pages/_conversation-samples-Bq7cn-4d.js +70 -0
- package/dist/pages/{_figures-data-BDmScEny.js → _figures-data-DaDvB7Nm.js} +5 -5
- package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
- package/dist/pages/{_overlays-specimens-Dpn6oiyH.js → _overlays-specimens-bawR331Z.js} +33 -23
- package/dist/pages/_preview-specimens-DKQC9HAo.js +153 -0
- package/dist/pages/accordion-Sg0TUqxB.js +1036 -0
- package/dist/pages/address-autocomplete-DP0PUOlK.js +360 -0
- package/dist/pages/address-block-BvxQWBTy.js +403 -0
- package/dist/pages/address-fields-CwSqro3W.js +277 -0
- package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
- package/dist/pages/{alert-BD4e6QTh.js → alert-D3i7xZTU.js} +195 -50
- package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
- package/dist/pages/{app-shell-KbA-nRqZ.js → app-shell-D4hdlHps.js} +133 -54
- package/dist/pages/{area-chart-B91dLcGo.js → area-chart-BEWFwiB2.js} +183 -27
- package/dist/pages/{avatar-DPPHXJAu.js → avatar-BFEqQViw.js} +194 -12
- package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
- package/dist/pages/{badge-C9JR0thI.js → badge-0-PyMrih.js} +441 -135
- package/dist/pages/bar-chart-DkLogYlt.js +1060 -0
- package/dist/pages/bar-fold-B-3XeIDZ.js +360 -0
- package/dist/pages/board-card-D2tZY_mU.js +415 -0
- package/dist/pages/brand-mark-BqiLvFSR.js +417 -0
- package/dist/pages/{button-D3V912P4.js → button-DAyfssDY.js} +276 -79
- package/dist/pages/{calendar-DSDZ9nRH.js → calendar-Ds7KsgSI.js} +69 -17
- package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
- package/dist/pages/card-CXZ3V1d4.js +1612 -0
- package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
- package/dist/pages/chart-legend-B20AbakD.js +724 -0
- package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
- package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
- package/dist/pages/checklist-card-DEyykVFS.js +783 -0
- package/dist/pages/chip-Ck-o3Ui6.js +839 -0
- package/dist/pages/chip-list-k1LxXuCi.js +414 -0
- package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
- package/dist/pages/coachmark-Be2ghobT.js +366 -0
- package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
- package/dist/pages/collab-field-CfqqK7d2.js +696 -0
- package/dist/pages/color-field-CZpfcA-A.js +1127 -0
- package/dist/pages/{colour-BwuO8xAv.js → colour-q2ntvI0w.js} +496 -20
- package/dist/pages/column-mapper-TsTG39cl.js +502 -0
- package/dist/pages/combobox-DvK2j5tI.js +1334 -0
- package/dist/pages/{command-palette-xAD7fOg6.js → command-palette-CJ7uBA04.js} +201 -58
- package/dist/pages/comment-box-CDSGYhr5.js +346 -0
- package/dist/pages/composer-D4B0NgpA.js +689 -0
- package/dist/pages/condition-builder-BZy2ZGXe.js +715 -0
- package/dist/pages/conflict-chooser-C--_9UIS.js +210 -0
- package/dist/pages/context-menu-F9DV30ia.js +487 -0
- package/dist/pages/copy-button-Cn7WiKRF.js +568 -0
- package/dist/pages/copy-field-D3Xt3Jq6.js +511 -0
- package/dist/pages/danger-zone-Db_UUeiP.js +564 -0
- package/dist/pages/date-input-GOW067EB.js +956 -0
- package/dist/pages/{date-picker-BYSa816m.js → date-picker-GdBciR99.js} +186 -38
- package/dist/pages/date-time-BLKCXtVZ.js +678 -0
- package/dist/pages/{delta-CtAo0eIM.js → delta-CNAGv8JY.js} +266 -61
- package/dist/pages/description-list-BPeXn1eW.js +1268 -0
- package/dist/pages/device-switcher-BCaN99c1.js +554 -0
- package/dist/pages/dialog-CRpkRC98.js +3164 -0
- package/dist/pages/{docs-BNOb7AqR.js → docs-lM2UBSir.js} +20 -15
- package/dist/pages/doodle-nzkqi2UI.js +201 -0
- package/dist/pages/drag-ghost-B6kpzC3O.js +426 -0
- package/dist/pages/drill-menu-cskH5mol.js +490 -0
- package/dist/pages/dropzone-DOY_Rhw0.js +1069 -0
- package/dist/pages/element-toolbar-DZIhXlCJ.js +498 -0
- package/dist/pages/emoji-picker-CqaWaffD.js +235 -0
- package/dist/pages/empty-state-4U2txFpI.js +1113 -0
- package/dist/pages/facet-filters-McbBeY9e.js +353 -0
- package/dist/pages/figure-D-HF5vCj.js +563 -0
- package/dist/pages/figure-strip-hg7txTc3.js +1381 -0
- package/dist/pages/{figure-tabs-CoPFzzKz.js → figure-tabs-QOeQMY6N.js} +153 -35
- package/dist/pages/file-chip-DMDjtlqQ.js +738 -0
- package/dist/pages/filter-pill-DzqNOsD4.js +1295 -0
- package/dist/pages/font-picker-Bqhu0QMh.js +416 -0
- package/dist/pages/form-grid-BfWCVlie.js +692 -0
- package/dist/pages/gallery-BBk2EOri.js +453 -0
- package/dist/pages/gif-picker-CnoDTCaL.js +270 -0
- package/dist/pages/gradient-editor-Bqxp7Fxj.js +378 -0
- package/dist/pages/grouped-checklist-gNZ0tBKU.js +477 -0
- package/dist/pages/heatmap-BohgIcNk.js +507 -0
- package/dist/pages/highlight-text-BfxzfmvS.js +287 -0
- package/dist/pages/{home-dashboard-CFQwDtC9.js → home-dashboard-CxPmvduE.js} +21 -18
- package/dist/pages/hosted-embed-Jef3aIMP.js +163 -0
- package/dist/pages/hosted-field-BLh-53AE.js +208 -0
- package/dist/pages/hosted-field-DEpI4lVS.js +514 -0
- package/dist/pages/{icon-button-C9eSVPPW.js → icon-button-Bu4Gj5sy.js} +370 -31
- package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
- package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
- package/dist/pages/{icons-sxkTs5Ob.js → icons-CJ9Aar3d.js} +315 -52
- package/dist/pages/image-cropper-NyougqLH.js +466 -0
- package/dist/pages/image-field-7knBv4mJ.js +567 -0
- package/dist/pages/import-result-CmTtGXW_.js +486 -0
- package/dist/pages/inline-confirm-CEcI5Lxo.js +327 -0
- package/dist/pages/inline-edit-Ba39SzhM.js +1125 -0
- package/dist/pages/input-CzLCzfyx.js +2372 -0
- package/dist/pages/{installation-DpsX8G_n.js → installation-DRUWNVHP.js} +112 -29
- package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
- package/dist/pages/kanban-Dy9sPAI0.js +740 -0
- package/dist/pages/{kbd-cNfDoikz.js → kbd-UNj4zqxn.js} +15 -14
- package/dist/pages/layout-primitives-CPRaZeyt.js +483 -0
- package/dist/pages/line-chart-CntWxeMF.js +1117 -0
- package/dist/pages/link-CXqvAg9z.js +689 -0
- package/dist/pages/link-picker-BMFGCC67.js +478 -0
- package/dist/pages/link-row-x8yaUuWc.js +595 -0
- package/dist/pages/{live-globe-ClvLn9Lb.js → live-globe-95ROMhGQ.js} +191 -47
- package/dist/pages/loading-overlay-BeGuXM9G.js +456 -0
- package/dist/pages/loading-state-BNbCo51C.js +556 -0
- package/dist/pages/log-viewer-BQz8I_a2.js +503 -0
- package/dist/pages/{logo-BfGF1Pq9.js → logo-D3a3QGKJ.js} +13 -13
- package/dist/pages/lottie_light-CxEH8eiR.js +9116 -0
- package/dist/pages/markdown-Ied72vMT.js +237 -0
- package/dist/pages/markdown-field-BfnIEKZH.js +193 -0
- package/dist/pages/media-banner-DkStCia0.js +233 -0
- package/dist/pages/{menu-by2sgQ09.js → menu-NrLYKqKp.js} +623 -109
- package/dist/pages/message-thread-Bo4zbxqu.js +731 -0
- package/dist/pages/meta-line-D5p2TycR.js +371 -0
- package/dist/pages/model-viewer-BfokvHoc.js +60288 -0
- package/dist/pages/model-viewer-C8PFO8wk.js +577 -0
- package/dist/pages/month-calendar-T1vw9Rup.js +457 -0
- package/dist/pages/{motion-BvTGc2Dk.js → motion-CrXtiBvA.js} +20 -10
- package/dist/pages/number-input-CuyMZg18.js +968 -0
- package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
- package/dist/pages/{orbit-spinner-Dil1Z3Oy.js → orbit-spinner-Dxv5qAhr.js} +30 -14
- package/dist/pages/otp-input-CVRoX1mw.js +591 -0
- package/dist/pages/{overview-BPEbZQ6g.js → overview-BSfEqHY8.js} +4 -4
- package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
- package/dist/pages/{pagination-BBUnGvv5.js → pagination-C1EgVtW4.js} +74 -29
- package/dist/pages/palette-tile-X9ZXu2Z0.js +414 -0
- package/dist/pages/password-field-DHEQKyUC.js +912 -0
- package/dist/pages/person-cell-BmjbADBz.js +564 -0
- package/dist/pages/phone-input-B3G7Qpb2.js +747 -0
- package/dist/pages/plan-card-DRaA6RuB.js +621 -0
- package/dist/pages/plan-card-DtloWvMh.js +258 -0
- package/dist/pages/plan-comparison-BVIGTtbd.js +559 -0
- package/dist/pages/plan-grid-BCPvtP8J.js +251 -0
- package/dist/pages/point-list-BbPmZjsm.js +222 -0
- package/dist/pages/{popover-Db1gLDpb.js → popover-C3Oar9D5.js} +76 -14
- package/dist/pages/presence-avatars-CRZIk8n9.js +328 -0
- package/dist/pages/preview-frame-Bcwk0y_Q.js +1631 -0
- package/dist/pages/price-CRBLoa9h.js +604 -0
- package/dist/pages/{principles-CeAIOIdt.js → principles-pnDyfHpK.js} +9 -9
- package/dist/pages/print-page-BkLv6bW8.js +513 -0
- package/dist/pages/profile-hero-CC9dUzuN.js +498 -0
- package/dist/pages/progress-CP_awmo4.js +904 -0
- package/dist/pages/progress-ring-JuOAwk2T.js +576 -0
- package/dist/pages/{radio-group-CkdBWWfG.js → radio-group-CbiibLwn.js} +581 -18
- package/dist/pages/radius-control-B2kRA2Ch.js +441 -0
- package/dist/pages/rating-CweKN2SX.js +471 -0
- package/dist/pages/record-layout-DUP_X0RL.js +719 -0
- package/dist/pages/record-pager-y9D7JFgb.js +278 -0
- package/dist/pages/registry-CNR7zpf7.js +594 -0
- package/dist/pages/{release-Dvo684UJ.js → release-DYBCY7jm.js} +4 -1
- package/dist/pages/repeater-BRZYKRQa.js +1351 -0
- package/dist/pages/reply-feedback-BDnHprla.js +192 -0
- package/dist/pages/reveal-BygENBbL.js +460 -0
- package/dist/pages/rich-text-DOFQZEpT.js +156 -0
- package/dist/pages/rich-text-editor-BhIM20JI.js +1265 -0
- package/dist/pages/rolldown-runtime-CbKu08Hx.js +25 -0
- package/dist/pages/{rolling-number-qmvH84Mq.js → rolling-number-GR3Cyfpz.js} +12 -12
- package/dist/pages/row-list-Dl6CYhC-.js +1565 -0
- package/dist/pages/rule-list-DTCmIMpT.js +648 -0
- package/dist/pages/save-status-B5KkyMZP.js +378 -0
- package/dist/pages/schedule-YycI95O1.js +243 -0
- package/dist/pages/scroll-area-B2sGm23Q.js +423 -0
- package/dist/pages/{search-field-BN7MWGQ4.js → search-field-D1uG7R6A.js} +15 -15
- package/dist/pages/search-menu-DMuXyUUW.js +580 -0
- package/dist/pages/secret-field-Dj9x3LL8.js +337 -0
- package/dist/pages/section-rail-BtTCETS5.js +637 -0
- package/dist/pages/section-v2Pubup9.js +639 -0
- package/dist/pages/{segmented-control-CTbIpRBW.js → segmented-control-D-FB1K1T.js} +450 -37
- package/dist/pages/{select-DguELoRR.js → select-DZ43NpOm.js} +22 -17
- package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
- package/dist/pages/{separator-CPZub9pv.js → separator-CFwqRvfO.js} +99 -22
- package/dist/pages/serp-preview-BGwORjmo.js +346 -0
- package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
- package/dist/pages/{shape-DKvA0YKr.js → shape-DzniHAVT.js} +10 -10
- package/dist/pages/share-list-D4wgBxKN.js +926 -0
- package/dist/pages/side-panel-CCtkrZjs.js +811 -0
- package/dist/pages/site-preview-Dj1hM2Yo.js +353 -0
- package/dist/pages/skeleton-C1F5HkAu.js +1325 -0
- package/dist/pages/skip-link-BxznhSkz.js +252 -0
- package/dist/pages/slider-CAoPURKD.js +774 -0
- package/dist/pages/sortable-card-Sr44uCpI.js +424 -0
- package/dist/pages/sortable-list-DUAleYE1.js +1298 -0
- package/dist/pages/sortable-tree-BLzK-hTE.js +737 -0
- package/dist/pages/spacing-box-CtuvzxQu.js +550 -0
- package/dist/pages/{sparkline-DMMYGbHn.js → sparkline-D3aavCly.js} +301 -22
- package/dist/pages/split-bar-DYgZnFID.js +414 -0
- package/dist/pages/split-button-Be08-VI-.js +335 -0
- package/dist/pages/split-pane-lSNZgTKt.js +523 -0
- package/dist/pages/status-badge-DOdNhmzn.js +1074 -0
- package/dist/pages/status-checklist-CWkjCZIC.js +1152 -0
- package/dist/pages/status-dot-D99gAGsV.js +567 -0
- package/dist/pages/stepper-CxKTbEA-.js +1093 -0
- package/dist/pages/success-mark-CqFTOBEu.js +142 -0
- package/dist/pages/swatch-H_kNvHuC.js +565 -0
- package/dist/pages/{switch-B-Qe4kcT.js → switch-C93K6j9h.js} +151 -51
- package/dist/pages/table-mq_pNXza.js +3232 -0
- package/dist/pages/{tabs-B4M-usCV.js → tabs-Cf4MZ8Fq.js} +257 -21
- package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
- package/dist/pages/task-card-Dv0sR1-w.js +295 -0
- package/dist/pages/{textarea-fTuUZRQb.js → textarea-CCM-SnGN.js} +271 -15
- package/dist/pages/thumbnail-DwFJL_k1.js +1147 -0
- package/dist/pages/time-input-CA9-uZAa.js +442 -0
- package/dist/pages/time-zone-select-CEtMXVYO.js +296 -0
- package/dist/pages/timeline-BsMUTlpR.js +1798 -0
- package/dist/pages/{toast-CKP03zjy.js → toast-zXLRiMRT.js} +240 -25
- package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
- package/dist/pages/toolbar-B9l_fHKy.js +754 -0
- package/dist/pages/{tooltip-CBYil3kt.js → tooltip-LHtCUkF-.js} +162 -33
- package/dist/pages/translation-field-CTRXiF2N.js +251 -0
- package/dist/pages/tree-checklist-CJj3OcLg.js +451 -0
- package/dist/pages/tree-select-DU1qXHy_.js +492 -0
- package/dist/pages/tree-view-g_RjLtAb.js +739 -0
- package/dist/pages/{typography-PCbg8Bhg.js → typography-BSijtiRl.js} +153 -12
- package/dist/pages/unit-input-Dml4fjmK.js +659 -0
- package/dist/pages/upload-rules-yozEzSah.js +419 -0
- package/dist/pages/url-upload-input-SSnMgfpA.js +307 -0
- package/dist/pages/value-change-CnubDKyO.js +489 -0
- package/dist/pages/weekly-hours-i2EpsmTx.js +287 -0
- package/dist/pages/widget-preview-CUJMyZ_k.js +625 -0
- package/dist/pages/working-status-CENemSsw.js +389 -0
- package/manifest.json +10989 -1108
- package/package.json +3 -3
- package/dist/pages/card-DUggbis3.js +0 -659
- package/dist/pages/checkbox-DwimQaK3.js +0 -365
- package/dist/pages/dialog-BRAf4LMh.js +0 -1451
- package/dist/pages/empty-state-C-mLrXW2.js +0 -417
- package/dist/pages/input-KF9Gkawf.js +0 -1093
- package/dist/pages/registry-CroHzK9I.js +0 -244
- package/dist/pages/skeleton-DLuBhP46.js +0 -561
- package/dist/pages/table-AMoODng4.js +0 -607
|
@@ -0,0 +1,1125 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as DocLink } from "./host-B6znjEgQ.js";
|
|
3
|
+
import { 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 { useRef, useState } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Card, IconButton, InlineEdit, Menu, MenuContent, MenuItem, MenuTrigger, SwatchPicker } from "@orbitcommerce/constellation";
|
|
7
|
+
import { DotsThreeIcon, PencilSimpleIcon, TrashIcon } from "@orbitcommerce/constellation/icons";
|
|
8
|
+
//#region src/pages/components/inline-edit.tsx
|
|
9
|
+
function Preview() {
|
|
10
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11
|
+
style: { width: 220 },
|
|
12
|
+
children: /* @__PURE__ */ jsx(InlineEdit, {
|
|
13
|
+
label: "Store name",
|
|
14
|
+
value: "Harbour Desk Co",
|
|
15
|
+
onSave: () => {}
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function StoreName() {
|
|
20
|
+
const [name, setName] = useState("Harbour Desk Co");
|
|
21
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: "inline-edit-stack",
|
|
23
|
+
children: [/* @__PURE__ */ jsx(InlineEdit, {
|
|
24
|
+
label: "Store name",
|
|
25
|
+
value: name,
|
|
26
|
+
onSave: (next) => setName(next)
|
|
27
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
28
|
+
role: "status",
|
|
29
|
+
className: "inline-edit-status",
|
|
30
|
+
children: [
|
|
31
|
+
"The page holds \"",
|
|
32
|
+
name,
|
|
33
|
+
"\""
|
|
34
|
+
]
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function SlowSave() {
|
|
39
|
+
const [name, setName] = useState("Harbour Desk Co");
|
|
40
|
+
return /* @__PURE__ */ jsx("div", {
|
|
41
|
+
className: "inline-edit-stack",
|
|
42
|
+
children: /* @__PURE__ */ jsx(InlineEdit, {
|
|
43
|
+
label: "Store name",
|
|
44
|
+
value: name,
|
|
45
|
+
onSave: (next) => new Promise((resolve) => setTimeout(() => {
|
|
46
|
+
setName(next);
|
|
47
|
+
resolve();
|
|
48
|
+
}, 900))
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function RefusedValue() {
|
|
53
|
+
const [name, setName] = useState("Harbour Desk Co");
|
|
54
|
+
return /* @__PURE__ */ jsx("div", {
|
|
55
|
+
className: "inline-edit-stack",
|
|
56
|
+
children: /* @__PURE__ */ jsx(InlineEdit, {
|
|
57
|
+
label: "Store name",
|
|
58
|
+
value: name,
|
|
59
|
+
onSave: (next) => setName(next),
|
|
60
|
+
validate: (next) => {
|
|
61
|
+
if (next.trim() === "") return "A store needs a name";
|
|
62
|
+
if (next.length > 24) return "Keep the name under 25 characters";
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function RejectedSave() {
|
|
69
|
+
const [name, setName] = useState("Harbour Desk Co");
|
|
70
|
+
return /* @__PURE__ */ jsx("div", {
|
|
71
|
+
className: "inline-edit-stack",
|
|
72
|
+
children: /* @__PURE__ */ jsx(InlineEdit, {
|
|
73
|
+
label: "Store name",
|
|
74
|
+
value: name,
|
|
75
|
+
onSave: () => new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("That name is already taken")), 900))
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function Price$1() {
|
|
80
|
+
const [price, setPrice] = useState("18.00");
|
|
81
|
+
return /* @__PURE__ */ jsx("div", {
|
|
82
|
+
className: "inline-edit-stack",
|
|
83
|
+
children: /* @__PURE__ */ jsx(InlineEdit, {
|
|
84
|
+
label: "Unit price",
|
|
85
|
+
value: price,
|
|
86
|
+
onSave: (next) => setPrice(next),
|
|
87
|
+
renderValue: (value) => `£${value}`
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function EmptyValue() {
|
|
92
|
+
const [note, setNote] = useState("");
|
|
93
|
+
return /* @__PURE__ */ jsx("div", {
|
|
94
|
+
className: "inline-edit-stack",
|
|
95
|
+
children: /* @__PURE__ */ jsx(InlineEdit, {
|
|
96
|
+
label: "Delivery note",
|
|
97
|
+
value: note,
|
|
98
|
+
onSave: (next) => setNote(next),
|
|
99
|
+
placeholder: "Add a delivery note"
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function Disabled() {
|
|
104
|
+
return /* @__PURE__ */ jsx("div", {
|
|
105
|
+
className: "inline-edit-stack",
|
|
106
|
+
children: /* @__PURE__ */ jsx(InlineEdit, {
|
|
107
|
+
label: "Store name",
|
|
108
|
+
value: "Harbour Desk Co",
|
|
109
|
+
onSave: () => {},
|
|
110
|
+
disabled: true
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function Sizes() {
|
|
115
|
+
return /* @__PURE__ */ jsx("div", {
|
|
116
|
+
className: "inline-edit-sizes",
|
|
117
|
+
children: [
|
|
118
|
+
"sm",
|
|
119
|
+
"md",
|
|
120
|
+
"lg"
|
|
121
|
+
].map((size) => /* @__PURE__ */ jsxs("div", {
|
|
122
|
+
className: "inline-edit-labelled",
|
|
123
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
124
|
+
className: "inline-edit-label",
|
|
125
|
+
children: size
|
|
126
|
+
}), /* @__PURE__ */ jsx(InlineEdit, {
|
|
127
|
+
label: "Store name",
|
|
128
|
+
value: "Harbour Desk Co",
|
|
129
|
+
size,
|
|
130
|
+
onSave: () => {}
|
|
131
|
+
})]
|
|
132
|
+
}, size))
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function Everything() {
|
|
136
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
137
|
+
className: "inline-edit-stack",
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ jsx(InlineEdit, {
|
|
140
|
+
label: "Store name",
|
|
141
|
+
value: "Harbour Desk Co",
|
|
142
|
+
onSave: () => {}
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ jsx(InlineEdit, {
|
|
145
|
+
trigger: "value",
|
|
146
|
+
label: "Page title",
|
|
147
|
+
value: "Summer sale on ergonomic chairs and standing desks",
|
|
148
|
+
onSave: () => {}
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ jsx(InlineEdit, {
|
|
151
|
+
trigger: "button",
|
|
152
|
+
mono: true,
|
|
153
|
+
label: "Your reference",
|
|
154
|
+
value: "SO-10482",
|
|
155
|
+
onSave: () => {}
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ jsx(InlineEdit, {
|
|
158
|
+
showActions: true,
|
|
159
|
+
label: "Your reference",
|
|
160
|
+
value: "SO-10482",
|
|
161
|
+
defaultEditing: true,
|
|
162
|
+
hint: "Printed on the PDF.",
|
|
163
|
+
onSave: () => {}
|
|
164
|
+
}),
|
|
165
|
+
/* @__PURE__ */ jsx(InlineEdit, {
|
|
166
|
+
label: "Unit price",
|
|
167
|
+
value: "18.00",
|
|
168
|
+
onSave: () => {},
|
|
169
|
+
renderValue: (value) => `£${value}`
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ jsx(InlineEdit, {
|
|
172
|
+
label: "Delivery note",
|
|
173
|
+
value: "",
|
|
174
|
+
onSave: () => {},
|
|
175
|
+
placeholder: "Add a delivery note"
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ jsx(InlineEdit, {
|
|
178
|
+
label: "Store name",
|
|
179
|
+
value: "Harbour Desk Co",
|
|
180
|
+
onSave: () => {},
|
|
181
|
+
disabled: true
|
|
182
|
+
})
|
|
183
|
+
]
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
function PageTitle() {
|
|
187
|
+
const [title, setTitle] = useState("Summer sale on ergonomic chairs and standing desks");
|
|
188
|
+
return /* @__PURE__ */ jsx("div", {
|
|
189
|
+
className: "inline-edit-bar",
|
|
190
|
+
children: /* @__PURE__ */ jsx(InlineEdit, {
|
|
191
|
+
trigger: "value",
|
|
192
|
+
className: "inline-edit-title",
|
|
193
|
+
label: "Page title",
|
|
194
|
+
value: title,
|
|
195
|
+
onSave: setTitle
|
|
196
|
+
})
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function Reference() {
|
|
200
|
+
const [reference, setReference] = useState("SO-10482");
|
|
201
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
202
|
+
className: "inline-edit-ref",
|
|
203
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
204
|
+
className: "inline-edit-ref__label",
|
|
205
|
+
children: "Your reference"
|
|
206
|
+
}), /* @__PURE__ */ jsx(InlineEdit, {
|
|
207
|
+
trigger: "button",
|
|
208
|
+
showActions: true,
|
|
209
|
+
mono: true,
|
|
210
|
+
label: "Your reference",
|
|
211
|
+
value: reference,
|
|
212
|
+
placeholder: "e.g. SO-10482",
|
|
213
|
+
maxLength: 100,
|
|
214
|
+
hint: "Printed on the PDF and used as the order reference in tracking updates.",
|
|
215
|
+
onSave: setReference
|
|
216
|
+
})]
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function LayerRow() {
|
|
220
|
+
const [name, setName] = useState("Hero banner");
|
|
221
|
+
const actions = useRef(null);
|
|
222
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
223
|
+
className: "inline-edit-layer",
|
|
224
|
+
children: [/* @__PURE__ */ jsx(InlineEdit, {
|
|
225
|
+
trigger: "none",
|
|
226
|
+
editOnDoubleClick: true,
|
|
227
|
+
actionsRef: actions,
|
|
228
|
+
className: "inline-edit-layer__name",
|
|
229
|
+
label: "Layer name",
|
|
230
|
+
value: name,
|
|
231
|
+
onSave: setName
|
|
232
|
+
}), /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
233
|
+
asChild: true,
|
|
234
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
235
|
+
label: "Layer actions",
|
|
236
|
+
variant: "ghost",
|
|
237
|
+
size: "sm",
|
|
238
|
+
children: /* @__PURE__ */ jsx(DotsThreeIcon, {})
|
|
239
|
+
})
|
|
240
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
241
|
+
align: "end",
|
|
242
|
+
children: [/* @__PURE__ */ jsx(MenuItem, {
|
|
243
|
+
icon: /* @__PURE__ */ jsx(PencilSimpleIcon, {}),
|
|
244
|
+
onSelect: () => actions.current?.edit(),
|
|
245
|
+
children: "Rename"
|
|
246
|
+
}), /* @__PURE__ */ jsx(MenuItem, {
|
|
247
|
+
icon: /* @__PURE__ */ jsx(TrashIcon, {}),
|
|
248
|
+
tone: "critical",
|
|
249
|
+
children: "Delete"
|
|
250
|
+
})]
|
|
251
|
+
})] })]
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
function Controlled() {
|
|
255
|
+
const [name, setName] = useState("Arden ergonomic chair");
|
|
256
|
+
const [editing, setEditing] = useState(false);
|
|
257
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
258
|
+
className: "inline-edit-stack",
|
|
259
|
+
children: [/* @__PURE__ */ jsx(InlineEdit, {
|
|
260
|
+
trigger: "button",
|
|
261
|
+
editOnDoubleClick: true,
|
|
262
|
+
label: "Element name",
|
|
263
|
+
value: name,
|
|
264
|
+
editing,
|
|
265
|
+
onEditingChange: setEditing,
|
|
266
|
+
onSave: setName
|
|
267
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
268
|
+
role: "status",
|
|
269
|
+
className: "inline-edit-status",
|
|
270
|
+
children: editing ? "Renaming" : "Not renaming"
|
|
271
|
+
})]
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
function Reply() {
|
|
275
|
+
const [reply, setReply] = useState("");
|
|
276
|
+
return /* @__PURE__ */ jsx("div", {
|
|
277
|
+
className: "inline-edit-stack inline-edit-stack--wide",
|
|
278
|
+
children: /* @__PURE__ */ jsx(InlineEdit, {
|
|
279
|
+
multiline: true,
|
|
280
|
+
label: "Public reply",
|
|
281
|
+
value: reply,
|
|
282
|
+
placeholder: "Write a public reply",
|
|
283
|
+
maxLength: 2e3,
|
|
284
|
+
labels: {
|
|
285
|
+
save: "Post reply",
|
|
286
|
+
empty: "No reply yet"
|
|
287
|
+
},
|
|
288
|
+
onSave: (next) => new Promise((resolve) => setTimeout(() => {
|
|
289
|
+
setReply(next);
|
|
290
|
+
resolve();
|
|
291
|
+
}, 700))
|
|
292
|
+
})
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function OrderNote() {
|
|
296
|
+
const [note, setNote] = useState("Leave with reception if no one answers.\nRing the bell twice.");
|
|
297
|
+
return /* @__PURE__ */ jsx(Card, {
|
|
298
|
+
className: "inline-edit-card",
|
|
299
|
+
children: /* @__PURE__ */ jsx(InlineEdit, {
|
|
300
|
+
heading: "Note",
|
|
301
|
+
multiline: true,
|
|
302
|
+
label: "Order note",
|
|
303
|
+
value: note,
|
|
304
|
+
placeholder: "Add a note for the team",
|
|
305
|
+
labels: {
|
|
306
|
+
save: "Save note",
|
|
307
|
+
cancel: "Cancel note edit",
|
|
308
|
+
empty: "No note"
|
|
309
|
+
},
|
|
310
|
+
onSave: setNote
|
|
311
|
+
})
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
var GROUP_COLOURS = [
|
|
315
|
+
{
|
|
316
|
+
value: "#336a65",
|
|
317
|
+
name: "Teal"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
value: "#5f3219",
|
|
321
|
+
name: "Copper"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
value: "#571a2a",
|
|
325
|
+
name: "Claret"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
value: "#3d4a5c",
|
|
329
|
+
name: "Slate"
|
|
330
|
+
}
|
|
331
|
+
];
|
|
332
|
+
function GroupRow({ locked = false, initialName, initialColour }) {
|
|
333
|
+
const [name, setName] = useState(initialName);
|
|
334
|
+
const [colour, setColour] = useState(initialColour);
|
|
335
|
+
const [draftColour, setDraftColour] = useState(initialColour);
|
|
336
|
+
return /* @__PURE__ */ jsx(InlineEdit, {
|
|
337
|
+
trigger: "button",
|
|
338
|
+
showActions: true,
|
|
339
|
+
textLocked: locked,
|
|
340
|
+
changed: draftColour !== colour,
|
|
341
|
+
label: locked ? "Group colour" : "Group name",
|
|
342
|
+
value: name,
|
|
343
|
+
hint: locked ? "A system group keeps its name. Its colour can change." : void 0,
|
|
344
|
+
renderValue: (value) => /* @__PURE__ */ jsxs("span", {
|
|
345
|
+
className: "inline-edit-group",
|
|
346
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
347
|
+
className: "inline-edit-group__dot",
|
|
348
|
+
style: { background: colour },
|
|
349
|
+
"aria-hidden": "true"
|
|
350
|
+
}), value]
|
|
351
|
+
}),
|
|
352
|
+
extras: /* @__PURE__ */ jsx(SwatchPicker, {
|
|
353
|
+
size: "sm",
|
|
354
|
+
"aria-label": "Group colour",
|
|
355
|
+
colors: GROUP_COLOURS,
|
|
356
|
+
value: draftColour,
|
|
357
|
+
onValueChange: setDraftColour
|
|
358
|
+
}),
|
|
359
|
+
onEditingChange: (open) => {
|
|
360
|
+
if (open) setDraftColour(colour);
|
|
361
|
+
},
|
|
362
|
+
onSave: (next) => {
|
|
363
|
+
setName(next);
|
|
364
|
+
setColour(draftColour);
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
function Groups() {
|
|
369
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
370
|
+
className: "inline-edit-stack inline-edit-stack--wide",
|
|
371
|
+
children: [/* @__PURE__ */ jsx(GroupRow, {
|
|
372
|
+
initialName: "Trade buyers",
|
|
373
|
+
initialColour: "#336a65"
|
|
374
|
+
}), /* @__PURE__ */ jsx(GroupRow, {
|
|
375
|
+
locked: true,
|
|
376
|
+
initialName: "Everyone",
|
|
377
|
+
initialColour: "#3d4a5c"
|
|
378
|
+
})]
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
function Page() {
|
|
382
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
383
|
+
title: "Inline edit",
|
|
384
|
+
status: "new",
|
|
385
|
+
importNames: ["InlineEdit"],
|
|
386
|
+
lead: "A value shown where it stands, with a quiet pencil beside it: a click or Enter turns the words into a field, Enter or leaving the field saves, and Escape cancels. Reach for it for a single short value that is read far more often than it is changed, such as a store name or a price.",
|
|
387
|
+
children: [
|
|
388
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
389
|
+
id: "basics",
|
|
390
|
+
title: "Basics",
|
|
391
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
392
|
+
"The value is drawn in the surrounding text; over it sits a transparent button, so a click or Enter anywhere on the value starts editing. The field takes focus with its text selected, ready to be typed over. Enter or leaving the field saves, and Escape cancels. The host owns the value: pass ",
|
|
393
|
+
/* @__PURE__ */ jsx("code", { children: "value" }),
|
|
394
|
+
" and update it in ",
|
|
395
|
+
/* @__PURE__ */ jsx("code", { children: "onSave" }),
|
|
396
|
+
". Click the store name below and change it."
|
|
397
|
+
] }),
|
|
398
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
399
|
+
align: "start",
|
|
400
|
+
code: `
|
|
401
|
+
const [name, setName] = useState('Harbour Desk Co')
|
|
402
|
+
|
|
403
|
+
<InlineEdit label="Store name" value={name} onSave={(next) => setName(next)} />
|
|
404
|
+
<span role="status">The page holds "{name}"</span>`,
|
|
405
|
+
children: /* @__PURE__ */ jsx(StoreName, {})
|
|
406
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
407
|
+
title: "When not to reach for it",
|
|
408
|
+
children: [
|
|
409
|
+
"An inline edit says a value is editable with no more than a quiet pencil beside it, so it suits a short value read far more often than changed. For a value that needs a label, a hint or an error in view, or that is one of several in a form, use a ",
|
|
410
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
411
|
+
to: "/components/input",
|
|
412
|
+
children: "Field and an Input"
|
|
413
|
+
}),
|
|
414
|
+
". For a long value (a returns policy, an address), a full field on the page is easier to edit and to read."
|
|
415
|
+
]
|
|
416
|
+
})]
|
|
417
|
+
}),
|
|
418
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
419
|
+
id: "states",
|
|
420
|
+
title: "The states",
|
|
421
|
+
description: /* @__PURE__ */ jsx("p", { children: "At rest the value is text with a quiet pencil beside it. Editing, it is the kit Input in the value's place; the box does not jump, because the rest state keeps the field's height, and the words stay where they were. A save that returns a promise keeps the field mounted and read-only, with the checking mark, until it settles; a refused or rejected save shows a Field's error line under the field." }),
|
|
422
|
+
children: [
|
|
423
|
+
/* @__PURE__ */ jsxs(SubSection, {
|
|
424
|
+
title: "A value that starts empty",
|
|
425
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
426
|
+
align: "start",
|
|
427
|
+
code: `
|
|
428
|
+
const [note, setNote] = useState('')
|
|
429
|
+
|
|
430
|
+
<InlineEdit label="Delivery note" value={note} onSave={(next) => setNote(next)} placeholder="Add a delivery note" />`,
|
|
431
|
+
children: /* @__PURE__ */ jsx(EmptyValue, {})
|
|
432
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
433
|
+
title: "Empty",
|
|
434
|
+
children: [
|
|
435
|
+
"An empty value shows the quiet words from ",
|
|
436
|
+
/* @__PURE__ */ jsx("code", { children: "labels.empty" }),
|
|
437
|
+
" (\"Not set\") until a ",
|
|
438
|
+
/* @__PURE__ */ jsx("code", { children: "placeholder" }),
|
|
439
|
+
" is given, which shows while editing instead. The host decides what empty means; the field only passes the string through."
|
|
440
|
+
]
|
|
441
|
+
})]
|
|
442
|
+
}),
|
|
443
|
+
/* @__PURE__ */ jsxs(SubSection, {
|
|
444
|
+
title: "Sizes",
|
|
445
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
446
|
+
align: "start",
|
|
447
|
+
code: `
|
|
448
|
+
<InlineEdit label="Store name" value="Harbour Desk Co" size="sm" onSave={save} />
|
|
449
|
+
<InlineEdit label="Store name" value="Harbour Desk Co" size="md" onSave={save} />
|
|
450
|
+
<InlineEdit label="Store name" value="Harbour Desk Co" size="lg" onSave={save} />`,
|
|
451
|
+
children: /* @__PURE__ */ jsx(Sizes, {})
|
|
452
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
453
|
+
title: "Sizes",
|
|
454
|
+
children: [
|
|
455
|
+
/* @__PURE__ */ jsx("code", { children: "size" }),
|
|
456
|
+
" sets the field it becomes, ",
|
|
457
|
+
/* @__PURE__ */ jsx("code", { children: "sm" }),
|
|
458
|
+
" (the default) 30px, ",
|
|
459
|
+
/* @__PURE__ */ jsx("code", { children: "md" }),
|
|
460
|
+
" 36px,",
|
|
461
|
+
" ",
|
|
462
|
+
/* @__PURE__ */ jsx("code", { children: "lg" }),
|
|
463
|
+
" 44px. The rest state keeps that height, the words keep the size of the text around them, and the field's frame reaches out by its own padding, so the text does not move when the field appears."
|
|
464
|
+
]
|
|
465
|
+
})]
|
|
466
|
+
}),
|
|
467
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
468
|
+
title: "Switched off",
|
|
469
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
470
|
+
align: "start",
|
|
471
|
+
code: `<InlineEdit label="Store name" value="Harbour Desk Co" onSave={() => {}} disabled />`,
|
|
472
|
+
children: /* @__PURE__ */ jsx(Disabled, {})
|
|
473
|
+
})
|
|
474
|
+
})
|
|
475
|
+
]
|
|
476
|
+
}),
|
|
477
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
478
|
+
id: "saving",
|
|
479
|
+
title: "A save that takes a second",
|
|
480
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
481
|
+
"Return a promise from ",
|
|
482
|
+
/* @__PURE__ */ jsx("code", { children: "onSave" }),
|
|
483
|
+
" and the field stays open while it is in flight: read-only, with the kit's checking mark, and the status says \"Saving\". When it settles the field closes, focus goes back to the pencil, and the status says \"Saved\". Change the name and press Enter to see it."
|
|
484
|
+
] }),
|
|
485
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
486
|
+
align: "start",
|
|
487
|
+
code: `
|
|
488
|
+
const [name, setName] = useState('Harbour Desk Co')
|
|
489
|
+
|
|
490
|
+
<InlineEdit
|
|
491
|
+
label="Store name"
|
|
492
|
+
value={name}
|
|
493
|
+
onSave={(next) =>
|
|
494
|
+
new Promise<void>((resolve) =>
|
|
495
|
+
setTimeout(() => {
|
|
496
|
+
setName(next)
|
|
497
|
+
resolve()
|
|
498
|
+
}, 900),
|
|
499
|
+
)
|
|
500
|
+
}
|
|
501
|
+
/>`,
|
|
502
|
+
children: /* @__PURE__ */ jsx(SlowSave, {})
|
|
503
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
504
|
+
title: "Leaving or cancelling",
|
|
505
|
+
children: [
|
|
506
|
+
"While the save is in flight the field ignores Escape and Enter, so a slow save is not restarted or abandoned by a stray key. Cancel with Escape before the save begins, or after it settles. A save with nothing changed closes without calling",
|
|
507
|
+
" ",
|
|
508
|
+
/* @__PURE__ */ jsx("code", { children: "onSave" }),
|
|
509
|
+
"."
|
|
510
|
+
]
|
|
511
|
+
})]
|
|
512
|
+
}),
|
|
513
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
514
|
+
id: "validation",
|
|
515
|
+
title: "A refused value",
|
|
516
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
517
|
+
/* @__PURE__ */ jsx("code", { children: "validate" }),
|
|
518
|
+
" is your check before the value is saved: given the draft text, return a message to refuse it or nothing to accept it. A refused value stays editing and shows the message under the field, with",
|
|
519
|
+
" ",
|
|
520
|
+
/* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
|
|
521
|
+
" on the input. Try an empty name or a very long one."
|
|
522
|
+
] }),
|
|
523
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
524
|
+
align: "start",
|
|
525
|
+
code: `
|
|
526
|
+
const [name, setName] = useState('Harbour Desk Co')
|
|
527
|
+
|
|
528
|
+
<InlineEdit
|
|
529
|
+
label="Store name"
|
|
530
|
+
value={name}
|
|
531
|
+
onSave={(next) => setName(next)}
|
|
532
|
+
validate={(next) => {
|
|
533
|
+
if (next.trim() === '') return 'A store needs a name'
|
|
534
|
+
if (next.length > 24) return 'Keep the name under 25 characters'
|
|
535
|
+
return null
|
|
536
|
+
}}
|
|
537
|
+
/>`,
|
|
538
|
+
children: /* @__PURE__ */ jsx(RefusedValue, {})
|
|
539
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
540
|
+
title: "An error from elsewhere",
|
|
541
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
542
|
+
"The ",
|
|
543
|
+
/* @__PURE__ */ jsx("code", { children: "error" }),
|
|
544
|
+
" prop shows a message of your own under the field while editing, for a problem the validator cannot see: a name already taken on the server, a value out of date. A rejected save fills it too, unless the rejection carries its own message."
|
|
545
|
+
] }),
|
|
546
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
547
|
+
align: "start",
|
|
548
|
+
code: `<InlineEdit label="Store name" value="Harbour Desk Co" onSave={retry} error="That name is already taken" />`,
|
|
549
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
550
|
+
className: "inline-edit-stack",
|
|
551
|
+
children: /* @__PURE__ */ jsx(InlineEdit, {
|
|
552
|
+
label: "Store name",
|
|
553
|
+
value: "Harbour Desk Co",
|
|
554
|
+
onSave: () => {},
|
|
555
|
+
error: "That name is already taken"
|
|
556
|
+
})
|
|
557
|
+
})
|
|
558
|
+
})
|
|
559
|
+
})]
|
|
560
|
+
}),
|
|
561
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
562
|
+
id: "rejected",
|
|
563
|
+
title: "A save that is rejected",
|
|
564
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
565
|
+
"If the promise ",
|
|
566
|
+
/* @__PURE__ */ jsx("code", { children: "onSave" }),
|
|
567
|
+
" returns rejects, the field stays editing and shows the rejection's message (its",
|
|
568
|
+
" ",
|
|
569
|
+
/* @__PURE__ */ jsx("code", { children: "Error" }),
|
|
570
|
+
" message, or a string), so the person can put it right and try again. Change the name and press Enter: the save is refused after a moment, as a server that already has that name would."
|
|
571
|
+
] }),
|
|
572
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
573
|
+
align: "start",
|
|
574
|
+
code: `
|
|
575
|
+
const [name, setName] = useState('Harbour Desk Co')
|
|
576
|
+
|
|
577
|
+
<InlineEdit
|
|
578
|
+
label="Store name"
|
|
579
|
+
value={name}
|
|
580
|
+
onSave={() =>
|
|
581
|
+
new Promise<void>((_, reject) => setTimeout(() => reject(new Error('That name is already taken')), 900))
|
|
582
|
+
}
|
|
583
|
+
/>`,
|
|
584
|
+
children: /* @__PURE__ */ jsx(RejectedSave, {})
|
|
585
|
+
})
|
|
586
|
+
}),
|
|
587
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
588
|
+
id: "render-value",
|
|
589
|
+
title: "Drawing the value your own way",
|
|
590
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
591
|
+
"At rest the field shows the value as text. Give it ",
|
|
592
|
+
/* @__PURE__ */ jsx("code", { children: "renderValue" }),
|
|
593
|
+
" to draw the value another way, such as a price with its currency sign, while the field it becomes still edits the raw string. Here the value is",
|
|
594
|
+
" ",
|
|
595
|
+
/* @__PURE__ */ jsx("code", { children: "18.00" }),
|
|
596
|
+
" and the rest state draws £18.00."
|
|
597
|
+
] }),
|
|
598
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
599
|
+
align: "start",
|
|
600
|
+
code: `
|
|
601
|
+
const [price, setPrice] = useState('18.00')
|
|
602
|
+
|
|
603
|
+
<InlineEdit
|
|
604
|
+
label="Unit price"
|
|
605
|
+
value={price}
|
|
606
|
+
onSave={(next) => setPrice(next)}
|
|
607
|
+
renderValue={(value) => \`£\${value}\`}
|
|
608
|
+
/>`,
|
|
609
|
+
children: /* @__PURE__ */ jsx(Price$1, {})
|
|
610
|
+
})
|
|
611
|
+
}),
|
|
612
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
613
|
+
id: "ways-in",
|
|
614
|
+
title: "Ways in",
|
|
615
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
616
|
+
/* @__PURE__ */ jsx("code", { children: "trigger" }),
|
|
617
|
+
" sets how editing starts. The default, ",
|
|
618
|
+
/* @__PURE__ */ jsx("code", { children: "pencil" }),
|
|
619
|
+
", is the value and a quiet pencil under one button. ",
|
|
620
|
+
/* @__PURE__ */ jsx("code", { children: "value" }),
|
|
621
|
+
" makes the value itself the button, for a title: one line, cut with an ellipsis where it runs out of room and shown whole in a tooltip while it is cut. ",
|
|
622
|
+
/* @__PURE__ */ jsx("code", { children: "button" }),
|
|
623
|
+
" keeps the words plain and puts an edit button that is always shown beside them, and ",
|
|
624
|
+
/* @__PURE__ */ jsx("code", { children: "none" }),
|
|
625
|
+
" draws no button at all, for a name that is renamed from a menu row or a double-click."
|
|
626
|
+
] }),
|
|
627
|
+
children: [
|
|
628
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
629
|
+
title: "The value as the button",
|
|
630
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
631
|
+
align: "start",
|
|
632
|
+
code: `<InlineEdit trigger="value" label="Page title" value={title} onSave={setTitle} />`,
|
|
633
|
+
children: /* @__PURE__ */ jsx(PageTitle, {})
|
|
634
|
+
})
|
|
635
|
+
}),
|
|
636
|
+
/* @__PURE__ */ jsxs(SubSection, {
|
|
637
|
+
title: "An edit button beside the words, with Save and Cancel, a hint and a mono value",
|
|
638
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
639
|
+
align: "start",
|
|
640
|
+
code: `
|
|
641
|
+
<InlineEdit
|
|
642
|
+
trigger="button"
|
|
643
|
+
showActions
|
|
644
|
+
mono
|
|
645
|
+
label="Your reference"
|
|
646
|
+
value={reference}
|
|
647
|
+
placeholder="e.g. SO-10482"
|
|
648
|
+
maxLength={100}
|
|
649
|
+
hint="Printed on the PDF and used as the order reference in tracking updates."
|
|
650
|
+
onSave={setReference}
|
|
651
|
+
/>`,
|
|
652
|
+
children: /* @__PURE__ */ jsx(Reference, {})
|
|
653
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
654
|
+
title: "Save and Cancel shown",
|
|
655
|
+
children: [
|
|
656
|
+
/* @__PURE__ */ jsx("code", { children: "showActions" }),
|
|
657
|
+
" sets a tick and a cross beside the field. With them in view, leaving the field keeps it open with the draft (a press elsewhere is not a save); pass ",
|
|
658
|
+
/* @__PURE__ */ jsx("code", { children: "saveOnBlur" }),
|
|
659
|
+
" to save on leaving as well. Moving from the field to the tick, the cross or the extras never counts as leaving."
|
|
660
|
+
]
|
|
661
|
+
})]
|
|
662
|
+
}),
|
|
663
|
+
/* @__PURE__ */ jsxs(SubSection, {
|
|
664
|
+
title: "Renamed from a menu row, or a double-click",
|
|
665
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
666
|
+
align: "start",
|
|
667
|
+
code: `
|
|
668
|
+
const actions = useRef<InlineEditActions>(null)
|
|
669
|
+
|
|
670
|
+
<InlineEdit trigger="none" editOnDoubleClick actionsRef={actions} label="Layer name" value={name} onSave={setName} />
|
|
671
|
+
<Menu>
|
|
672
|
+
<MenuTrigger asChild>
|
|
673
|
+
<IconButton label="Layer actions" variant="ghost" size="sm"><DotsThreeIcon /></IconButton>
|
|
674
|
+
</MenuTrigger>
|
|
675
|
+
<MenuContent align="end">
|
|
676
|
+
<MenuItem icon={<PencilSimpleIcon />} onSelect={() => actions.current?.edit()}>Rename</MenuItem>
|
|
677
|
+
</MenuContent>
|
|
678
|
+
</Menu>`,
|
|
679
|
+
children: /* @__PURE__ */ jsx(LayerRow, {})
|
|
680
|
+
}), /* @__PURE__ */ jsx(Note, {
|
|
681
|
+
title: "After a menu",
|
|
682
|
+
children: "Editing started from a menu row waits for the menu to finish closing, so the menu handing focus back to its trigger never closes the field. With no edit button of its own, the field gives focus back to what had it: the menu's trigger here."
|
|
683
|
+
})]
|
|
684
|
+
})
|
|
685
|
+
]
|
|
686
|
+
}),
|
|
687
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
688
|
+
id: "controlled",
|
|
689
|
+
title: "Opened from elsewhere",
|
|
690
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
691
|
+
/* @__PURE__ */ jsx("code", { children: "editing" }),
|
|
692
|
+
" with ",
|
|
693
|
+
/* @__PURE__ */ jsx("code", { children: "onEditingChange" }),
|
|
694
|
+
" holds whether the field is open, so the page can open it (a rename shortcut, a new item named as it is made) or know when it is: here the status says so. Each time it opens, the draft starts from the value. ",
|
|
695
|
+
/* @__PURE__ */ jsx("code", { children: "defaultEditing" }),
|
|
696
|
+
" starts it open, and takes no focus as it mounts."
|
|
697
|
+
] }),
|
|
698
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
699
|
+
align: "start",
|
|
700
|
+
code: `
|
|
701
|
+
const [editing, setEditing] = useState(false)
|
|
702
|
+
|
|
703
|
+
<InlineEdit
|
|
704
|
+
trigger="button"
|
|
705
|
+
editOnDoubleClick
|
|
706
|
+
label="Element name"
|
|
707
|
+
value={name}
|
|
708
|
+
editing={editing}
|
|
709
|
+
onEditingChange={setEditing}
|
|
710
|
+
onSave={setName}
|
|
711
|
+
/>`,
|
|
712
|
+
children: /* @__PURE__ */ jsx(Controlled, {})
|
|
713
|
+
})
|
|
714
|
+
}),
|
|
715
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
716
|
+
id: "multiline",
|
|
717
|
+
title: "Several lines",
|
|
718
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
719
|
+
/* @__PURE__ */ jsx("code", { children: "multiline" }),
|
|
720
|
+
" edits in a Textarea that grows with the text, with Cancel and Save under it. Enter starts a new line and Cmd or Ctrl+Enter saves; Escape cancels. Leaving keeps the draft. ",
|
|
721
|
+
/* @__PURE__ */ jsx("code", { children: "maxLength" }),
|
|
722
|
+
" counts the characters, and ",
|
|
723
|
+
/* @__PURE__ */ jsx("code", { children: "labels.save" }),
|
|
724
|
+
" names the action (\"Post reply\")."
|
|
725
|
+
] }),
|
|
726
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
727
|
+
align: "start",
|
|
728
|
+
code: `
|
|
729
|
+
<InlineEdit
|
|
730
|
+
multiline
|
|
731
|
+
label="Public reply"
|
|
732
|
+
value={reply}
|
|
733
|
+
placeholder="Write a public reply"
|
|
734
|
+
maxLength={2000}
|
|
735
|
+
labels={{ save: 'Post reply', empty: 'No reply yet' }}
|
|
736
|
+
onSave={postReply}
|
|
737
|
+
/>`,
|
|
738
|
+
children: /* @__PURE__ */ jsx(Reply, {})
|
|
739
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
740
|
+
title: "In a card head",
|
|
741
|
+
description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "heading" }), " draws a card head over the value: the heading at the start and the pencil at the end, which becomes a tick and a cross while editing, as an order's note does."] }),
|
|
742
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
743
|
+
align: "start",
|
|
744
|
+
code: `
|
|
745
|
+
<Card>
|
|
746
|
+
<InlineEdit
|
|
747
|
+
heading="Note"
|
|
748
|
+
multiline
|
|
749
|
+
label="Order note"
|
|
750
|
+
value={note}
|
|
751
|
+
labels={{ save: 'Save note', cancel: 'Cancel note edit', empty: 'No note' }}
|
|
752
|
+
onSave={setNote}
|
|
753
|
+
/>
|
|
754
|
+
</Card>`,
|
|
755
|
+
children: /* @__PURE__ */ jsx(OrderNote, {})
|
|
756
|
+
})
|
|
757
|
+
})]
|
|
758
|
+
}),
|
|
759
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
760
|
+
id: "extras",
|
|
761
|
+
title: "Extra controls and locked words",
|
|
762
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
763
|
+
/* @__PURE__ */ jsx("code", { children: "extras" }),
|
|
764
|
+
" sets controls before the field while editing, part of the same edit: a group's colour beside its name. The host holds their state and saves it in ",
|
|
765
|
+
/* @__PURE__ */ jsx("code", { children: "onSave" }),
|
|
766
|
+
"; ",
|
|
767
|
+
/* @__PURE__ */ jsx("code", { children: "changed" }),
|
|
768
|
+
" says something in them has moved, so Save saves though the words have not. ",
|
|
769
|
+
/* @__PURE__ */ jsx("code", { children: "textLocked" }),
|
|
770
|
+
" keeps the words read only, for a system group whose name stays while its colour can change."
|
|
771
|
+
] }),
|
|
772
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
773
|
+
align: "start",
|
|
774
|
+
code: `
|
|
775
|
+
<InlineEdit
|
|
776
|
+
trigger="button"
|
|
777
|
+
showActions
|
|
778
|
+
label="Group name"
|
|
779
|
+
value={name}
|
|
780
|
+
changed={draftColour !== colour}
|
|
781
|
+
extras={<SwatchPicker size="sm" aria-label="Group colour" colors={colours} value={draftColour} onValueChange={setDraftColour} />}
|
|
782
|
+
onSave={(next) => {
|
|
783
|
+
setName(next)
|
|
784
|
+
setColour(draftColour)
|
|
785
|
+
}}
|
|
786
|
+
/>
|
|
787
|
+
|
|
788
|
+
<InlineEdit textLocked hint="A system group keeps its name. Its colour can change." ... />`,
|
|
789
|
+
children: /* @__PURE__ */ jsx(Groups, {})
|
|
790
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
791
|
+
title: "Extras that open a popover",
|
|
792
|
+
children: [
|
|
793
|
+
"A popover one of the extras opens is drawn outside the edit, so moving into it counts as leaving the field. Give such extras Save and Cancel (",
|
|
794
|
+
/* @__PURE__ */ jsx("code", { children: "showActions" }),
|
|
795
|
+
"), where leaving keeps the draft, rather than ",
|
|
796
|
+
/* @__PURE__ */ jsx("code", { children: "saveOnBlur" }),
|
|
797
|
+
"."
|
|
798
|
+
]
|
|
799
|
+
})]
|
|
800
|
+
}),
|
|
801
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
802
|
+
id: "both-themes",
|
|
803
|
+
title: "In both themes",
|
|
804
|
+
description: /* @__PURE__ */ jsx("p", { children: "A value at rest, a title that is its own button, a mono reference with an edit button, a field open with its tick, cross and hint, a price drawn with a currency sign, an empty value and a switched-off field." }),
|
|
805
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
806
|
+
align: "start",
|
|
807
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
808
|
+
className: "inline-edit-theme",
|
|
809
|
+
children: /* @__PURE__ */ jsx(Everything, {})
|
|
810
|
+
})
|
|
811
|
+
})
|
|
812
|
+
}),
|
|
813
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
814
|
+
id: "accessibility",
|
|
815
|
+
title: "Accessibility",
|
|
816
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
817
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
818
|
+
"At rest the value is a button, named by ",
|
|
819
|
+
/* @__PURE__ */ jsx("code", { children: "labels.edit(label)" }),
|
|
820
|
+
" (\"Edit Store name\") and described by the value, so Tab hears what would be edited (\"Edit Store name, Harbour Desk Co\"). A screen reader hears those words, not a pencil; the pencil itself is hidden from assistive tech."
|
|
821
|
+
] }),
|
|
822
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
823
|
+
"Editing, the input is named by ",
|
|
824
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
825
|
+
" (\"Store name\"), so it is clear what is being changed. A refused or rejected message is a Field's error line, with its mark; it is linked to the input with",
|
|
826
|
+
" ",
|
|
827
|
+
/* @__PURE__ */ jsx("code", { children: "aria-describedby" }),
|
|
828
|
+
" and sets ",
|
|
829
|
+
/* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
|
|
830
|
+
"."
|
|
831
|
+
] }),
|
|
832
|
+
/* @__PURE__ */ jsx(Fragment$1, { children: "One polite status sits in the page from the first render and says \"Saving\" and then \"Saved\" as a promise save goes on, so the outcome is heard without moving focus." }),
|
|
833
|
+
/* @__PURE__ */ jsx(Fragment$1, { children: "Keyboard: Tab to the edit button, then Enter or Space to open (a button's own behaviour). The field takes focus with its text selected; Enter saves, Escape cancels and puts focus back on the button, and Tab leaves and saves." }),
|
|
834
|
+
"Focus is never dropped: when the field is taken away (on Enter, Escape or a settled save), the edit button takes focus back; a field with no edit button (trigger=\"none\") gives it back to what had it before, such as the menu it was renamed from.",
|
|
835
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
836
|
+
"With ",
|
|
837
|
+
/* @__PURE__ */ jsx("code", { children: "trigger=\"value\"" }),
|
|
838
|
+
" the title is the button, named \"Edit Page title\" and described by the title itself; its tooltip shows the whole title only while it is cut. With ",
|
|
839
|
+
/* @__PURE__ */ jsx("code", { children: "trigger=\"button\"" }),
|
|
840
|
+
" the edit button is always in view and is the one way in for a keyboard; a double-click is an extra for a pointer."
|
|
841
|
+
] }),
|
|
842
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
843
|
+
"The tick and the cross are named by ",
|
|
844
|
+
/* @__PURE__ */ jsx("code", { children: "labels.save" }),
|
|
845
|
+
" and ",
|
|
846
|
+
/* @__PURE__ */ jsx("code", { children: "labels.cancel" }),
|
|
847
|
+
", each with a tooltip of the same words. While a promise save runs the tick is busy and the cross held, both still focusable."
|
|
848
|
+
] }),
|
|
849
|
+
/* @__PURE__ */ jsx(Fragment$1, { children: "In a Textarea, Enter is a new line, Cmd or Ctrl+Enter saves and Escape cancels; its character count is read with the field. A hint is the field's description while editing, and an error takes its place." }),
|
|
850
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
851
|
+
"The words the component says itself (\"Edit\", \"Saving\", \"Saved\", \"Not set\") are English, and can be replaced through",
|
|
852
|
+
" ",
|
|
853
|
+
/* @__PURE__ */ jsx("code", { children: "labels" }),
|
|
854
|
+
"."
|
|
855
|
+
] })
|
|
856
|
+
] })
|
|
857
|
+
}),
|
|
858
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
859
|
+
id: "guidelines",
|
|
860
|
+
title: "Guidelines",
|
|
861
|
+
children: [/* @__PURE__ */ jsx(DoDont, {
|
|
862
|
+
do: {
|
|
863
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
864
|
+
className: "inline-edit-dd",
|
|
865
|
+
children: /* @__PURE__ */ jsx(InlineEdit, {
|
|
866
|
+
label: "Store name",
|
|
867
|
+
value: "Harbour Desk Co",
|
|
868
|
+
onSave: () => {}
|
|
869
|
+
})
|
|
870
|
+
}),
|
|
871
|
+
caption: "A short value, read often and changed now and then, edited where it stands."
|
|
872
|
+
},
|
|
873
|
+
dont: {
|
|
874
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
875
|
+
className: "inline-edit-dd",
|
|
876
|
+
children: /* @__PURE__ */ jsx(InlineEdit, {
|
|
877
|
+
label: "Returns policy",
|
|
878
|
+
value: "Most items can be returned within 30 days of delivery, in their original packaging and with the tags still attached.",
|
|
879
|
+
onSave: () => {}
|
|
880
|
+
})
|
|
881
|
+
}),
|
|
882
|
+
caption: "A long value: a full field on the page is easier to read and to edit than a line of text."
|
|
883
|
+
}
|
|
884
|
+
}), /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
885
|
+
"Use an inline edit for one short value. For a value that is part of a form, with a label, hint and error, use a Field.",
|
|
886
|
+
"Give it a label that names the value (\"Store name\"): it is the edit button's name and the field's label.",
|
|
887
|
+
"Saving is explicit: Enter or leaving the field saves, Escape cancels. Do not save on every keystroke.",
|
|
888
|
+
"For a save that takes a moment, return the promise and let the field say \"Saving\" and \"Saved\", rather than closing it and leaving people unsure.",
|
|
889
|
+
"Refuse a bad value with validate, so it never reaches the server; use error for a problem only the server knows.",
|
|
890
|
+
"Show the value in someone's own format with renderValue, but edit the raw value: a price shown as £18.00 is edited as 18.00."
|
|
891
|
+
] })]
|
|
892
|
+
}),
|
|
893
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
894
|
+
id: "props",
|
|
895
|
+
title: "Props",
|
|
896
|
+
description: /* @__PURE__ */ jsx("p", { children: "Also accepts every native div attribute except change; ref, className and native props go to the root." }),
|
|
897
|
+
children: [
|
|
898
|
+
/* @__PURE__ */ jsx(PropsTable, { rows: [
|
|
899
|
+
{
|
|
900
|
+
name: "value",
|
|
901
|
+
type: "string",
|
|
902
|
+
required: true,
|
|
903
|
+
description: "The value shown at rest, and the draft the field starts at."
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
name: "label",
|
|
907
|
+
type: "string",
|
|
908
|
+
required: true,
|
|
909
|
+
description: "Names the field: the edit button's name, and the input's label."
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
name: "onSave",
|
|
913
|
+
type: "(next: string) => void | Promise<void>",
|
|
914
|
+
required: true,
|
|
915
|
+
description: "Saves the new value. Return a promise to keep the field pending until it settles."
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
name: "onCancel",
|
|
919
|
+
type: "() => void",
|
|
920
|
+
description: "Called when editing is cancelled with Escape."
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
name: "validate",
|
|
924
|
+
type: "(next: string) => string | null | undefined",
|
|
925
|
+
description: "Refuses a value before saving: return a message to stay editing and show it."
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
name: "placeholder",
|
|
929
|
+
type: "string",
|
|
930
|
+
description: "Placeholder for the field while it is empty."
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
name: "renderValue",
|
|
934
|
+
type: "(value: string) => ReactNode",
|
|
935
|
+
description: "Draws the value at rest, when the words shown differ from the value itself (a price, a date)."
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
name: "disabled",
|
|
939
|
+
type: "boolean",
|
|
940
|
+
default: "false",
|
|
941
|
+
description: "Draws only the value: no edit button, and no way in."
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
name: "error",
|
|
945
|
+
type: "ReactNode",
|
|
946
|
+
description: "Shown under the field while editing."
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
name: "inputProps",
|
|
950
|
+
type: "InputHTMLAttributes",
|
|
951
|
+
description: "Extra attributes for the field, such as autoComplete or spellCheck."
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
name: "size",
|
|
955
|
+
type: "'sm' | 'md' | 'lg'",
|
|
956
|
+
default: "'sm'",
|
|
957
|
+
description: "The field it becomes, and the height the rest state keeps."
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
name: "labels",
|
|
961
|
+
type: "Partial<InlineEditLabels>",
|
|
962
|
+
description: "The words it says itself. inlineEditLabels is the English set."
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
name: "trigger",
|
|
966
|
+
type: "'pencil' | 'value' | 'button' | 'none'",
|
|
967
|
+
default: "'pencil'",
|
|
968
|
+
description: "How editing starts: the value with a quiet pencil, the value as its own button (a title), plain words with an edit button, or no button (a menu row or a double-click)."
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
name: "editOnDoubleClick",
|
|
972
|
+
type: "boolean",
|
|
973
|
+
default: "false",
|
|
974
|
+
description: "A double-click on the words starts editing too. For button and none."
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
name: "editing",
|
|
978
|
+
type: "boolean",
|
|
979
|
+
description: "Whether the field is open (controlled). Pair it with onEditingChange."
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
name: "defaultEditing",
|
|
983
|
+
type: "boolean",
|
|
984
|
+
default: "false",
|
|
985
|
+
description: "Starts open, uncontrolled, without taking focus."
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
name: "onEditingChange",
|
|
989
|
+
type: "(editing: boolean) => void",
|
|
990
|
+
description: "Called with true as editing starts and false as it stops."
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
name: "actionsRef",
|
|
994
|
+
type: "Ref<InlineEditActions>",
|
|
995
|
+
description: "Hands over edit() and cancel(), to start editing from a menu row or elsewhere."
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
name: "showActions",
|
|
999
|
+
type: "boolean",
|
|
1000
|
+
default: "multiline or heading",
|
|
1001
|
+
description: "Draws Save and Cancel: a tick and a cross beside a one-line field or in the head, words under a Textarea."
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
name: "saveOnBlur",
|
|
1005
|
+
type: "boolean",
|
|
1006
|
+
default: "!showActions",
|
|
1007
|
+
description: "Whether leaving the field saves it. Moving to the extras, the tick or the cross never does."
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
name: "multiline",
|
|
1011
|
+
type: "boolean",
|
|
1012
|
+
default: "false",
|
|
1013
|
+
description: "Edits in a Textarea that grows: Cmd or Ctrl+Enter saves, Enter is a new line."
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
name: "rows",
|
|
1017
|
+
type: "number",
|
|
1018
|
+
default: "3",
|
|
1019
|
+
description: "The rows a multi-line field starts at."
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
name: "maxLength",
|
|
1023
|
+
type: "number",
|
|
1024
|
+
description: "The most characters allowed. A multi-line field counts them."
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
name: "heading",
|
|
1028
|
+
type: "ReactNode",
|
|
1029
|
+
description: "A card head over the value, with the pencil, or the tick and the cross, at its end."
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
name: "hint",
|
|
1033
|
+
type: "ReactNode",
|
|
1034
|
+
description: "A quiet line under the field while editing. Hidden while there is an error."
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
name: "mono",
|
|
1038
|
+
type: "boolean",
|
|
1039
|
+
default: "false",
|
|
1040
|
+
description: "The value and the field in the mono face, for a code or a reference."
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
name: "extras",
|
|
1044
|
+
type: "ReactNode",
|
|
1045
|
+
description: "Controls set before the field while editing, part of the same edit (a colour)."
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
name: "changed",
|
|
1049
|
+
type: "boolean",
|
|
1050
|
+
default: "false",
|
|
1051
|
+
description: "Something in extras has changed, so Save saves though the words have not."
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
name: "textLocked",
|
|
1055
|
+
type: "boolean",
|
|
1056
|
+
default: "false",
|
|
1057
|
+
description: "The words are read only, while extras can still change."
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
name: "textareaProps",
|
|
1061
|
+
type: "TextareaHTMLAttributes",
|
|
1062
|
+
description: "Extra attributes for the Textarea, with multiline."
|
|
1063
|
+
}
|
|
1064
|
+
] }),
|
|
1065
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1066
|
+
title: "InlineEditLabels",
|
|
1067
|
+
rows: [
|
|
1068
|
+
{
|
|
1069
|
+
name: "edit",
|
|
1070
|
+
type: "(label: string) => string",
|
|
1071
|
+
default: "(label) => `Edit ${label}`",
|
|
1072
|
+
description: "The edit button's accessible name."
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
name: "saving",
|
|
1076
|
+
type: "string",
|
|
1077
|
+
default: "'Saving'",
|
|
1078
|
+
description: "What the status says while a save is in flight."
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
name: "saved",
|
|
1082
|
+
type: "string",
|
|
1083
|
+
default: "'Saved'",
|
|
1084
|
+
description: "What the status says once a save settles."
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
name: "empty",
|
|
1088
|
+
type: "string",
|
|
1089
|
+
default: "'Not set'",
|
|
1090
|
+
description: "Shown, quiet, in place of an empty value."
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
name: "save",
|
|
1094
|
+
type: "string",
|
|
1095
|
+
default: "'Save'",
|
|
1096
|
+
description: "Save's words under a Textarea, or the tick's name and tooltip."
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
name: "cancel",
|
|
1100
|
+
type: "string",
|
|
1101
|
+
default: "'Cancel'",
|
|
1102
|
+
description: "Cancel's words, or the cross's name and tooltip."
|
|
1103
|
+
}
|
|
1104
|
+
]
|
|
1105
|
+
}),
|
|
1106
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1107
|
+
title: "InlineEditActions",
|
|
1108
|
+
rows: [{
|
|
1109
|
+
name: "edit",
|
|
1110
|
+
type: "() => void",
|
|
1111
|
+
description: "Opens the field, as a press on the value does."
|
|
1112
|
+
}, {
|
|
1113
|
+
name: "cancel",
|
|
1114
|
+
type: "() => void",
|
|
1115
|
+
description: "Closes the field without saving, as Escape does."
|
|
1116
|
+
}]
|
|
1117
|
+
})
|
|
1118
|
+
]
|
|
1119
|
+
}),
|
|
1120
|
+
/* @__PURE__ */ jsx(Fragment$1, {})
|
|
1121
|
+
]
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
//#endregion
|
|
1125
|
+
export { Page, Preview };
|