@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.
Files changed (235) hide show
  1. package/dist/docs.css +14764 -2237
  2. package/dist/index.js +2 -2
  3. package/dist/pages/{Playground-CNbBbErC.js → Playground-Mk1yIWXb.js} +2 -2
  4. package/dist/pages/_address-data-L9BR499w.js +161 -0
  5. package/dist/pages/_builder-demo-C0eJUmPU.js +282 -0
  6. package/dist/pages/_card-art-0be5ncyV.js +18 -0
  7. package/dist/pages/_conversation-samples-Bq7cn-4d.js +70 -0
  8. package/dist/pages/{_figures-data-BDmScEny.js → _figures-data-DaDvB7Nm.js} +5 -5
  9. package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
  10. package/dist/pages/{_overlays-specimens-Dpn6oiyH.js → _overlays-specimens-bawR331Z.js} +33 -23
  11. package/dist/pages/_preview-specimens-DKQC9HAo.js +153 -0
  12. package/dist/pages/accordion-Sg0TUqxB.js +1036 -0
  13. package/dist/pages/address-autocomplete-DP0PUOlK.js +360 -0
  14. package/dist/pages/address-block-BZOOOPA9.js +368 -0
  15. package/dist/pages/address-fields-CwSqro3W.js +277 -0
  16. package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
  17. package/dist/pages/{alert-BD4e6QTh.js → alert-D3i7xZTU.js} +195 -50
  18. package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
  19. package/dist/pages/{app-shell-KbA-nRqZ.js → app-shell-D4hdlHps.js} +133 -54
  20. package/dist/pages/{area-chart-B91dLcGo.js → area-chart-BEWFwiB2.js} +183 -27
  21. package/dist/pages/{avatar-DPPHXJAu.js → avatar-BFEqQViw.js} +194 -12
  22. package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
  23. package/dist/pages/{badge-C9JR0thI.js → badge-0-PyMrih.js} +441 -135
  24. package/dist/pages/bar-chart-DkLogYlt.js +1060 -0
  25. package/dist/pages/bar-fold-B-3XeIDZ.js +360 -0
  26. package/dist/pages/board-card-D2tZY_mU.js +415 -0
  27. package/dist/pages/brand-mark-BqiLvFSR.js +417 -0
  28. package/dist/pages/{button-D3V912P4.js → button-DAyfssDY.js} +276 -79
  29. package/dist/pages/{calendar-DSDZ9nRH.js → calendar-Ds7KsgSI.js} +69 -17
  30. package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
  31. package/dist/pages/card-CQEM1_wc.js +1567 -0
  32. package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
  33. package/dist/pages/chart-legend-B20AbakD.js +724 -0
  34. package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
  35. package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
  36. package/dist/pages/checklist-card-DEyykVFS.js +783 -0
  37. package/dist/pages/chip-Ck-o3Ui6.js +839 -0
  38. package/dist/pages/chip-list-k1LxXuCi.js +414 -0
  39. package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
  40. package/dist/pages/coachmark-Be2ghobT.js +366 -0
  41. package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
  42. package/dist/pages/collab-field-CfqqK7d2.js +696 -0
  43. package/dist/pages/color-field-CZpfcA-A.js +1127 -0
  44. package/dist/pages/{colour-BwuO8xAv.js → colour-q2ntvI0w.js} +496 -20
  45. package/dist/pages/column-mapper-TsTG39cl.js +502 -0
  46. package/dist/pages/combobox-DvK2j5tI.js +1334 -0
  47. package/dist/pages/{command-palette-xAD7fOg6.js → command-palette-CJ7uBA04.js} +201 -58
  48. package/dist/pages/comment-box-CDSGYhr5.js +346 -0
  49. package/dist/pages/composer-D4B0NgpA.js +689 -0
  50. package/dist/pages/condition-builder-BZy2ZGXe.js +715 -0
  51. package/dist/pages/conflict-chooser-C--_9UIS.js +210 -0
  52. package/dist/pages/context-menu-F9DV30ia.js +487 -0
  53. package/dist/pages/copy-button-Cn7WiKRF.js +568 -0
  54. package/dist/pages/copy-field-D3Xt3Jq6.js +511 -0
  55. package/dist/pages/danger-zone-Db_UUeiP.js +564 -0
  56. package/dist/pages/date-input-GOW067EB.js +956 -0
  57. package/dist/pages/{date-picker-BYSa816m.js → date-picker-GdBciR99.js} +186 -38
  58. package/dist/pages/date-time-BLKCXtVZ.js +678 -0
  59. package/dist/pages/{delta-CtAo0eIM.js → delta-CNAGv8JY.js} +266 -61
  60. package/dist/pages/description-list-BPeXn1eW.js +1268 -0
  61. package/dist/pages/device-switcher-BCaN99c1.js +554 -0
  62. package/dist/pages/dialog-CRpkRC98.js +3164 -0
  63. package/dist/pages/{docs-BNOb7AqR.js → docs-lM2UBSir.js} +20 -15
  64. package/dist/pages/doodle-nzkqi2UI.js +201 -0
  65. package/dist/pages/drag-ghost-B6kpzC3O.js +426 -0
  66. package/dist/pages/drill-menu-cskH5mol.js +490 -0
  67. package/dist/pages/dropzone-DOY_Rhw0.js +1069 -0
  68. package/dist/pages/element-toolbar-DZIhXlCJ.js +498 -0
  69. package/dist/pages/emoji-picker-CqaWaffD.js +235 -0
  70. package/dist/pages/empty-state-4U2txFpI.js +1113 -0
  71. package/dist/pages/facet-filters-McbBeY9e.js +353 -0
  72. package/dist/pages/figure-D-HF5vCj.js +563 -0
  73. package/dist/pages/figure-strip-BB3mNl7D.js +1364 -0
  74. package/dist/pages/{figure-tabs-CoPFzzKz.js → figure-tabs-QOeQMY6N.js} +153 -35
  75. package/dist/pages/file-chip-DMDjtlqQ.js +738 -0
  76. package/dist/pages/filter-pill-DzqNOsD4.js +1295 -0
  77. package/dist/pages/font-picker-Bqhu0QMh.js +416 -0
  78. package/dist/pages/form-grid-BfWCVlie.js +692 -0
  79. package/dist/pages/gallery-BBk2EOri.js +453 -0
  80. package/dist/pages/gif-picker-CnoDTCaL.js +270 -0
  81. package/dist/pages/gradient-editor-Bqxp7Fxj.js +378 -0
  82. package/dist/pages/grouped-checklist-gNZ0tBKU.js +477 -0
  83. package/dist/pages/heatmap-BohgIcNk.js +507 -0
  84. package/dist/pages/highlight-text-BfxzfmvS.js +287 -0
  85. package/dist/pages/{home-dashboard-CFQwDtC9.js → home-dashboard-CxPmvduE.js} +21 -18
  86. package/dist/pages/hosted-embed-Jef3aIMP.js +163 -0
  87. package/dist/pages/hosted-field-BLh-53AE.js +208 -0
  88. package/dist/pages/hosted-field-DEpI4lVS.js +514 -0
  89. package/dist/pages/{icon-button-C9eSVPPW.js → icon-button-Bu4Gj5sy.js} +370 -31
  90. package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
  91. package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
  92. package/dist/pages/{icons-sxkTs5Ob.js → icons-CJ9Aar3d.js} +315 -52
  93. package/dist/pages/image-cropper-NyougqLH.js +466 -0
  94. package/dist/pages/image-field-7knBv4mJ.js +567 -0
  95. package/dist/pages/import-result-CmTtGXW_.js +486 -0
  96. package/dist/pages/inline-confirm-CEcI5Lxo.js +327 -0
  97. package/dist/pages/inline-edit-Ba39SzhM.js +1125 -0
  98. package/dist/pages/input-CzLCzfyx.js +2372 -0
  99. package/dist/pages/{installation-DpsX8G_n.js → installation-C3UcpQJT.js} +112 -29
  100. package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
  101. package/dist/pages/kanban-Dy9sPAI0.js +740 -0
  102. package/dist/pages/{kbd-cNfDoikz.js → kbd-UNj4zqxn.js} +15 -14
  103. package/dist/pages/layout-primitives-CPRaZeyt.js +483 -0
  104. package/dist/pages/line-chart-CntWxeMF.js +1117 -0
  105. package/dist/pages/link-CXqvAg9z.js +689 -0
  106. package/dist/pages/link-picker-BMFGCC67.js +478 -0
  107. package/dist/pages/link-row-x8yaUuWc.js +595 -0
  108. package/dist/pages/{live-globe-ClvLn9Lb.js → live-globe-95ROMhGQ.js} +191 -47
  109. package/dist/pages/loading-overlay-BeGuXM9G.js +456 -0
  110. package/dist/pages/loading-state-BNbCo51C.js +556 -0
  111. package/dist/pages/log-viewer-BQz8I_a2.js +503 -0
  112. package/dist/pages/{logo-BfGF1Pq9.js → logo-B38rnzoq.js} +13 -13
  113. package/dist/pages/lottie_light-CxEH8eiR.js +9116 -0
  114. package/dist/pages/markdown-Ied72vMT.js +237 -0
  115. package/dist/pages/markdown-field-BfnIEKZH.js +193 -0
  116. package/dist/pages/media-banner-DkStCia0.js +233 -0
  117. package/dist/pages/{menu-by2sgQ09.js → menu-NrLYKqKp.js} +623 -109
  118. package/dist/pages/message-thread-Bo4zbxqu.js +731 -0
  119. package/dist/pages/meta-line-D5p2TycR.js +371 -0
  120. package/dist/pages/model-viewer-BfokvHoc.js +60288 -0
  121. package/dist/pages/model-viewer-C8PFO8wk.js +577 -0
  122. package/dist/pages/month-calendar-T1vw9Rup.js +457 -0
  123. package/dist/pages/{motion-BvTGc2Dk.js → motion-CrXtiBvA.js} +20 -10
  124. package/dist/pages/number-input-CuyMZg18.js +968 -0
  125. package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
  126. package/dist/pages/{orbit-spinner-Dil1Z3Oy.js → orbit-spinner-Dxv5qAhr.js} +30 -14
  127. package/dist/pages/otp-input-CVRoX1mw.js +591 -0
  128. package/dist/pages/{overview-BPEbZQ6g.js → overview-LA9XRhZc.js} +4 -4
  129. package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
  130. package/dist/pages/{pagination-BBUnGvv5.js → pagination-C1EgVtW4.js} +74 -29
  131. package/dist/pages/palette-tile-X9ZXu2Z0.js +414 -0
  132. package/dist/pages/password-field-DHEQKyUC.js +912 -0
  133. package/dist/pages/person-cell-BmjbADBz.js +564 -0
  134. package/dist/pages/phone-input-B3G7Qpb2.js +747 -0
  135. package/dist/pages/plan-card-DRaA6RuB.js +621 -0
  136. package/dist/pages/plan-card-DtloWvMh.js +258 -0
  137. package/dist/pages/plan-comparison-BVIGTtbd.js +559 -0
  138. package/dist/pages/plan-grid-cfPVTB5V.js +251 -0
  139. package/dist/pages/point-list-BbPmZjsm.js +222 -0
  140. package/dist/pages/{popover-Db1gLDpb.js → popover-C3Oar9D5.js} +76 -14
  141. package/dist/pages/presence-avatars-CRZIk8n9.js +328 -0
  142. package/dist/pages/preview-frame-Bcwk0y_Q.js +1631 -0
  143. package/dist/pages/price-CRBLoa9h.js +604 -0
  144. package/dist/pages/{principles-CeAIOIdt.js → principles-pnDyfHpK.js} +9 -9
  145. package/dist/pages/print-page-BkLv6bW8.js +513 -0
  146. package/dist/pages/profile-hero-CC9dUzuN.js +498 -0
  147. package/dist/pages/progress-CP_awmo4.js +904 -0
  148. package/dist/pages/progress-ring-JuOAwk2T.js +576 -0
  149. package/dist/pages/{radio-group-CkdBWWfG.js → radio-group-C-4tg6FS.js} +580 -18
  150. package/dist/pages/radius-control-B2kRA2Ch.js +441 -0
  151. package/dist/pages/rating-CweKN2SX.js +471 -0
  152. package/dist/pages/record-layout-DUP_X0RL.js +719 -0
  153. package/dist/pages/record-pager-y9D7JFgb.js +278 -0
  154. package/dist/pages/registry-BZg-xAbi.js +594 -0
  155. package/dist/pages/{release-Dvo684UJ.js → release-Cs6tl16C.js} +4 -1
  156. package/dist/pages/repeater-BRZYKRQa.js +1351 -0
  157. package/dist/pages/reply-feedback-BDnHprla.js +192 -0
  158. package/dist/pages/reveal-BygENBbL.js +460 -0
  159. package/dist/pages/rich-text-DOFQZEpT.js +156 -0
  160. package/dist/pages/rich-text-editor-BhIM20JI.js +1265 -0
  161. package/dist/pages/rolldown-runtime-CbKu08Hx.js +25 -0
  162. package/dist/pages/{rolling-number-qmvH84Mq.js → rolling-number-GR3Cyfpz.js} +12 -12
  163. package/dist/pages/row-list-Dl6CYhC-.js +1565 -0
  164. package/dist/pages/rule-list-DTCmIMpT.js +648 -0
  165. package/dist/pages/save-status-B5KkyMZP.js +378 -0
  166. package/dist/pages/schedule-YycI95O1.js +243 -0
  167. package/dist/pages/scroll-area-B2sGm23Q.js +423 -0
  168. package/dist/pages/{search-field-BN7MWGQ4.js → search-field-D1uG7R6A.js} +15 -15
  169. package/dist/pages/search-menu-DMuXyUUW.js +580 -0
  170. package/dist/pages/secret-field-Dj9x3LL8.js +337 -0
  171. package/dist/pages/section-rail-BtTCETS5.js +637 -0
  172. package/dist/pages/section-v2Pubup9.js +639 -0
  173. package/dist/pages/{segmented-control-CTbIpRBW.js → segmented-control-D-FB1K1T.js} +450 -37
  174. package/dist/pages/{select-DguELoRR.js → select-DZ43NpOm.js} +22 -17
  175. package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
  176. package/dist/pages/{separator-CPZub9pv.js → separator-CFwqRvfO.js} +99 -22
  177. package/dist/pages/serp-preview-BGwORjmo.js +346 -0
  178. package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
  179. package/dist/pages/{shape-DKvA0YKr.js → shape-DzniHAVT.js} +10 -10
  180. package/dist/pages/share-list-D4wgBxKN.js +926 -0
  181. package/dist/pages/side-panel-CCtkrZjs.js +811 -0
  182. package/dist/pages/site-preview-Dj1hM2Yo.js +353 -0
  183. package/dist/pages/skeleton-C1F5HkAu.js +1325 -0
  184. package/dist/pages/skip-link-BxznhSkz.js +252 -0
  185. package/dist/pages/slider-CAoPURKD.js +774 -0
  186. package/dist/pages/sortable-card-Sr44uCpI.js +424 -0
  187. package/dist/pages/sortable-list-DUAleYE1.js +1298 -0
  188. package/dist/pages/sortable-tree-BLzK-hTE.js +737 -0
  189. package/dist/pages/spacing-box-CtuvzxQu.js +550 -0
  190. package/dist/pages/{sparkline-DMMYGbHn.js → sparkline-D3aavCly.js} +301 -22
  191. package/dist/pages/split-bar-DYgZnFID.js +414 -0
  192. package/dist/pages/split-button-Be08-VI-.js +335 -0
  193. package/dist/pages/split-pane-lSNZgTKt.js +523 -0
  194. package/dist/pages/status-badge-DOdNhmzn.js +1074 -0
  195. package/dist/pages/status-checklist-CWkjCZIC.js +1152 -0
  196. package/dist/pages/status-dot-D99gAGsV.js +567 -0
  197. package/dist/pages/stepper-CxKTbEA-.js +1093 -0
  198. package/dist/pages/success-mark-CqFTOBEu.js +142 -0
  199. package/dist/pages/swatch-H_kNvHuC.js +565 -0
  200. package/dist/pages/{switch-B-Qe4kcT.js → switch-C93K6j9h.js} +151 -51
  201. package/dist/pages/table-CL0vomno.js +3225 -0
  202. package/dist/pages/{tabs-B4M-usCV.js → tabs-Dh0mUsLw.js} +256 -21
  203. package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
  204. package/dist/pages/task-card-Dv0sR1-w.js +295 -0
  205. package/dist/pages/{textarea-fTuUZRQb.js → textarea-CCM-SnGN.js} +271 -15
  206. package/dist/pages/thumbnail-DwFJL_k1.js +1147 -0
  207. package/dist/pages/time-input-CA9-uZAa.js +442 -0
  208. package/dist/pages/time-zone-select-CEtMXVYO.js +296 -0
  209. package/dist/pages/timeline-BsMUTlpR.js +1798 -0
  210. package/dist/pages/{toast-CKP03zjy.js → toast-zXLRiMRT.js} +240 -25
  211. package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
  212. package/dist/pages/toolbar-B9l_fHKy.js +754 -0
  213. package/dist/pages/{tooltip-CBYil3kt.js → tooltip-LHtCUkF-.js} +162 -33
  214. package/dist/pages/translation-field-CTRXiF2N.js +251 -0
  215. package/dist/pages/tree-checklist-CJj3OcLg.js +451 -0
  216. package/dist/pages/tree-select-DU1qXHy_.js +492 -0
  217. package/dist/pages/tree-view-g_RjLtAb.js +739 -0
  218. package/dist/pages/{typography-PCbg8Bhg.js → typography-BSijtiRl.js} +153 -12
  219. package/dist/pages/unit-input-Dml4fjmK.js +659 -0
  220. package/dist/pages/upload-rules-yozEzSah.js +419 -0
  221. package/dist/pages/url-upload-input-SSnMgfpA.js +307 -0
  222. package/dist/pages/value-change-CnubDKyO.js +489 -0
  223. package/dist/pages/weekly-hours-i2EpsmTx.js +287 -0
  224. package/dist/pages/widget-preview-CUJMyZ_k.js +625 -0
  225. package/dist/pages/working-status-CENemSsw.js +389 -0
  226. package/manifest.json +10984 -1108
  227. package/package.json +2 -2
  228. package/dist/pages/card-DUggbis3.js +0 -659
  229. package/dist/pages/checkbox-DwimQaK3.js +0 -365
  230. package/dist/pages/dialog-BRAf4LMh.js +0 -1451
  231. package/dist/pages/empty-state-C-mLrXW2.js +0 -417
  232. package/dist/pages/input-KF9Gkawf.js +0 -1093
  233. package/dist/pages/registry-CroHzK9I.js +0 -244
  234. package/dist/pages/skeleton-DLuBhP46.js +0 -561
  235. package/dist/pages/table-AMoODng4.js +0 -607
@@ -0,0 +1,2372 @@
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 { useEffect, useRef, useState } from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ import { Button, ColorField, Field, FieldHelp, FieldHelpProvider, IconButton, Input, Link, SearchField, Select, Switch, Tooltip, useFieldControl } from "@orbitcommerce/constellation";
8
+ import { CheckCircleIcon, CheckIcon, CopySimpleIcon, DesktopIcon, DeviceMobileIcon, EnvelopeSimpleIcon, TagIcon } from "@orbitcommerce/constellation/icons";
9
+ //#region src/pages/components/input.tsx
10
+ function Preview() {
11
+ return /* @__PURE__ */ jsx("div", {
12
+ style: { width: 216 },
13
+ children: /* @__PURE__ */ jsx(Field, {
14
+ label: "Price",
15
+ hint: "Includes VAT at 20%",
16
+ children: /* @__PURE__ */ jsx(Input, {
17
+ prefix: "£",
18
+ inputMode: "decimal",
19
+ defaultValue: "18.00"
20
+ })
21
+ })
22
+ });
23
+ }
24
+ var quote = (v) => String(v).replace(/"/g, """);
25
+ var PLAYGROUND = [
26
+ {
27
+ prop: "aria-label",
28
+ type: "text",
29
+ default: "Product title",
30
+ toAttr: (v) => `aria-label="${quote(v)}"`
31
+ },
32
+ {
33
+ prop: "placeholder",
34
+ type: "text",
35
+ default: "e.g. Arden ergonomic chair",
36
+ toAttr: (v) => v ? `placeholder="${quote(v)}"` : null
37
+ },
38
+ {
39
+ prop: "size",
40
+ type: "select",
41
+ options: [
42
+ "sm",
43
+ "md",
44
+ "lg"
45
+ ],
46
+ default: "md"
47
+ },
48
+ {
49
+ prop: "icon",
50
+ type: "boolean",
51
+ default: false,
52
+ toAttr: (v) => v ? "icon={<TagIcon />}" : null
53
+ },
54
+ {
55
+ prop: "prefix",
56
+ type: "select",
57
+ options: [
58
+ "none",
59
+ "£",
60
+ "https://"
61
+ ],
62
+ default: "none",
63
+ toAttr: (v) => v === "none" ? null : `prefix="${v}"`
64
+ },
65
+ {
66
+ prop: "suffix",
67
+ type: "select",
68
+ options: [
69
+ "none",
70
+ "kg",
71
+ "GBP"
72
+ ],
73
+ default: "none",
74
+ toAttr: (v) => v === "none" ? null : `suffix="${v}"`
75
+ },
76
+ {
77
+ prop: "status",
78
+ type: "select",
79
+ options: [
80
+ "idle",
81
+ "checking",
82
+ "valid",
83
+ "invalid"
84
+ ],
85
+ default: "idle"
86
+ },
87
+ {
88
+ prop: "invalid",
89
+ type: "boolean",
90
+ default: false
91
+ },
92
+ {
93
+ prop: "readOnly",
94
+ type: "boolean",
95
+ default: false
96
+ },
97
+ {
98
+ prop: "disabled",
99
+ type: "boolean",
100
+ default: false
101
+ }
102
+ ];
103
+ var WEIGHT_UNITS = [
104
+ {
105
+ value: "kg",
106
+ label: "kg"
107
+ },
108
+ {
109
+ value: "g",
110
+ label: "g"
111
+ },
112
+ {
113
+ value: "lb",
114
+ label: "lb"
115
+ },
116
+ {
117
+ value: "oz",
118
+ label: "oz"
119
+ }
120
+ ];
121
+ function CopyAddress() {
122
+ const [copied, setCopied] = useState(false);
123
+ const address = "harbourdesk.co.uk";
124
+ return /* @__PURE__ */ jsx(Input, {
125
+ readOnly: true,
126
+ "aria-label": "Store address",
127
+ value: address,
128
+ suffix: /* @__PURE__ */ jsx(Tooltip, {
129
+ content: "Copy address",
130
+ children: /* @__PURE__ */ jsx(IconButton, {
131
+ label: "Copy address",
132
+ size: "xs",
133
+ onClick: () => {
134
+ navigator.clipboard?.writeText(address);
135
+ setCopied(true);
136
+ window.setTimeout(() => setCopied(false), 1400);
137
+ },
138
+ children: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopySimpleIcon, {})
139
+ })
140
+ })
141
+ });
142
+ }
143
+ var EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
144
+ function InviteForm() {
145
+ const [email, setEmail] = useState("priya@harbourdesk");
146
+ const [error, setError] = useState();
147
+ const [sentTo, setSentTo] = useState();
148
+ const ref = useRef(null);
149
+ const sendInvite = (event) => {
150
+ event.preventDefault();
151
+ const value = email.trim();
152
+ const problem = !value ? "Enter their email address" : !EMAIL.test(value) ? "Enter an email address in the correct format, like name@example.com" : void 0;
153
+ setError(problem);
154
+ setSentTo(problem ? void 0 : value);
155
+ if (problem) ref.current?.focus();
156
+ };
157
+ return /* @__PURE__ */ jsxs("form", {
158
+ noValidate: true,
159
+ onSubmit: sendInvite,
160
+ className: "input-invite",
161
+ children: [/* @__PURE__ */ jsx(Field, {
162
+ label: "Staff email",
163
+ hint: "We will email them a link to join your store.",
164
+ error,
165
+ children: /* @__PURE__ */ jsx(Input, {
166
+ ref,
167
+ type: "email",
168
+ icon: /* @__PURE__ */ jsx(EnvelopeSimpleIcon, {}),
169
+ value: email,
170
+ onChange: (e) => {
171
+ setEmail(e.target.value);
172
+ setError(void 0);
173
+ setSentTo(void 0);
174
+ }
175
+ })
176
+ }), /* @__PURE__ */ jsxs("div", {
177
+ className: "input-invite__footer",
178
+ children: [/* @__PURE__ */ jsx("span", {
179
+ role: "status",
180
+ className: "input-status",
181
+ children: sentTo ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
182
+ /* @__PURE__ */ jsx(CheckCircleIcon, {
183
+ weight: "fill",
184
+ "aria-hidden": "true"
185
+ }),
186
+ "Invite sent to ",
187
+ sentTo
188
+ ] }) : null
189
+ }), /* @__PURE__ */ jsx(Button, {
190
+ type: "submit",
191
+ variant: "primary",
192
+ children: "Send invite"
193
+ })]
194
+ })]
195
+ });
196
+ }
197
+ var MONEY = /^\d+(\.\d{1,2})?$/;
198
+ function checkProduct(v) {
199
+ const errors = {};
200
+ if (!v.price.trim()) errors.price = "Enter a price";
201
+ else if (!MONEY.test(v.price.trim())) errors.price = "Enter a price in pounds and pence, like 18.00";
202
+ if (v.compareAt.trim()) {
203
+ if (!MONEY.test(v.compareAt.trim())) errors.compareAt = "Enter an amount in pounds and pence, like 24.00";
204
+ else if (!errors.price && Number(v.compareAt) <= Number(v.price)) errors.compareAt = "Make it higher than the price, or leave it empty";
205
+ }
206
+ if (v.cost.trim() && !MONEY.test(v.cost.trim())) errors.cost = "Enter a cost in pounds and pence, like 9.40";
207
+ if (!v.sku.trim()) errors.sku = "Enter a SKU, like ARD-CHR-BLK";
208
+ else if (!/^[A-Za-z0-9-]+$/.test(v.sku.trim())) errors.sku = "Use letters, numbers and dashes only";
209
+ if (v.barcode.trim() && !/^\d{8,14}$/.test(v.barcode.trim())) errors.barcode = "Enter the 8 to 14 digits under the barcode";
210
+ if (!v.weight.trim() || !/^\d+(\.\d+)?$/.test(v.weight.trim())) errors.weight = "Enter a weight in kilograms, like 12.5";
211
+ return errors;
212
+ }
213
+ var ORDER = [
214
+ "price",
215
+ "compareAt",
216
+ "cost",
217
+ "sku",
218
+ "barcode",
219
+ "weight"
220
+ ];
221
+ function ProductForm() {
222
+ const [values, setValues] = useState({
223
+ price: "249.00",
224
+ compareAt: "",
225
+ cost: "118.50",
226
+ sku: "",
227
+ barcode: "",
228
+ weight: "14.2"
229
+ });
230
+ const [errors, setErrors] = useState({});
231
+ const [saving, setSaving] = useState(false);
232
+ const [saved, setSaved] = useState(false);
233
+ const refs = useRef({});
234
+ const bind = (key) => ({
235
+ ref: (el) => {
236
+ refs.current[key] = el;
237
+ },
238
+ value: values[key],
239
+ onChange: (e) => {
240
+ setValues((v) => ({
241
+ ...v,
242
+ [key]: e.target.value
243
+ }));
244
+ setErrors((x) => ({
245
+ ...x,
246
+ [key]: void 0
247
+ }));
248
+ setSaved(false);
249
+ }
250
+ });
251
+ const save = (event) => {
252
+ event.preventDefault();
253
+ const found = checkProduct(values);
254
+ setErrors(found);
255
+ const first = ORDER.find((k) => found[k]);
256
+ if (first) {
257
+ setSaved(false);
258
+ refs.current[first]?.focus();
259
+ return;
260
+ }
261
+ setSaving(true);
262
+ window.setTimeout(() => {
263
+ setSaving(false);
264
+ setSaved(true);
265
+ }, 900);
266
+ };
267
+ return /* @__PURE__ */ jsxs("form", {
268
+ noValidate: true,
269
+ onSubmit: save,
270
+ className: "input-form",
271
+ children: [
272
+ /* @__PURE__ */ jsxs("fieldset", {
273
+ className: "input-form__group",
274
+ children: [/* @__PURE__ */ jsx("legend", {
275
+ className: "input-form__legend",
276
+ children: "Pricing"
277
+ }), /* @__PURE__ */ jsxs("div", {
278
+ className: "input-form__grid",
279
+ children: [
280
+ /* @__PURE__ */ jsx(Field, {
281
+ label: "Price",
282
+ required: true,
283
+ hint: "Includes VAT at 20%",
284
+ error: errors.price,
285
+ children: /* @__PURE__ */ jsx(Input, {
286
+ prefix: "£",
287
+ inputMode: "decimal",
288
+ placeholder: "0.00",
289
+ ...bind("price")
290
+ })
291
+ }),
292
+ /* @__PURE__ */ jsx(Field, {
293
+ label: "Compare-at price",
294
+ optional: true,
295
+ hint: "Shown crossed out beside the price",
296
+ error: errors.compareAt,
297
+ children: /* @__PURE__ */ jsx(Input, {
298
+ prefix: "£",
299
+ inputMode: "decimal",
300
+ placeholder: "0.00",
301
+ ...bind("compareAt")
302
+ })
303
+ }),
304
+ /* @__PURE__ */ jsx(Field, {
305
+ label: "Cost per item",
306
+ optional: true,
307
+ hint: "Customers will not see this",
308
+ error: errors.cost,
309
+ children: /* @__PURE__ */ jsx(Input, {
310
+ prefix: "£",
311
+ inputMode: "decimal",
312
+ placeholder: "0.00",
313
+ ...bind("cost")
314
+ })
315
+ })
316
+ ]
317
+ })]
318
+ }),
319
+ /* @__PURE__ */ jsxs("fieldset", {
320
+ className: "input-form__group",
321
+ children: [/* @__PURE__ */ jsx("legend", {
322
+ className: "input-form__legend",
323
+ children: "Inventory and delivery"
324
+ }), /* @__PURE__ */ jsxs("div", {
325
+ className: "input-form__grid",
326
+ children: [
327
+ /* @__PURE__ */ jsx(Field, {
328
+ label: "SKU",
329
+ required: true,
330
+ hint: "Letters, numbers and dashes",
331
+ error: errors.sku,
332
+ children: /* @__PURE__ */ jsx(Input, {
333
+ icon: /* @__PURE__ */ jsx(TagIcon, {}),
334
+ placeholder: "e.g. ARD-CHR-BLK",
335
+ ...bind("sku")
336
+ })
337
+ }),
338
+ /* @__PURE__ */ jsx(Field, {
339
+ label: "Barcode",
340
+ optional: true,
341
+ hint: "GTIN, EAN or UPC",
342
+ error: errors.barcode,
343
+ children: /* @__PURE__ */ jsx(Input, {
344
+ inputMode: "numeric",
345
+ ...bind("barcode")
346
+ })
347
+ }),
348
+ /* @__PURE__ */ jsx(Field, {
349
+ label: "Weight",
350
+ required: true,
351
+ help: "Used to work out delivery rates. Weigh the item in its box.",
352
+ error: errors.weight,
353
+ children: /* @__PURE__ */ jsx(Input, {
354
+ suffix: "kg",
355
+ inputMode: "decimal",
356
+ ...bind("weight")
357
+ })
358
+ })
359
+ ]
360
+ })]
361
+ }),
362
+ /* @__PURE__ */ jsxs("div", {
363
+ className: "input-form__footer",
364
+ children: [/* @__PURE__ */ jsx("span", {
365
+ role: "status",
366
+ className: "input-status",
367
+ children: saved ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CheckCircleIcon, {
368
+ weight: "fill",
369
+ "aria-hidden": "true"
370
+ }), "Arden ergonomic chair saved"] }) : null
371
+ }), /* @__PURE__ */ jsx(Button, {
372
+ type: "submit",
373
+ variant: "primary",
374
+ loading: saving,
375
+ children: "Save product"
376
+ })]
377
+ })
378
+ ]
379
+ });
380
+ }
381
+ /** A custom control: a textarea that picks up the Field's wiring. */
382
+ function DescriptionBox(props) {
383
+ const field = useFieldControl();
384
+ return /* @__PURE__ */ jsx("textarea", {
385
+ id: field?.id,
386
+ "aria-describedby": field?.describedBy,
387
+ "aria-invalid": field?.invalid || void 0,
388
+ "aria-required": field?.required || void 0,
389
+ className: "input-textarea",
390
+ ...props
391
+ });
392
+ }
393
+ var LIMIT = 160;
394
+ function SearchDescription() {
395
+ const [text, setText] = useState("The Arden ergonomic chair in black mesh, with adjustable lumbar support and 4D arms. Free UK delivery on orders over £50.");
396
+ const over = text.length > LIMIT;
397
+ return /* @__PURE__ */ jsx("div", {
398
+ className: "input-stack",
399
+ children: /* @__PURE__ */ jsx(Field, {
400
+ label: "Search engine description",
401
+ hint: `${text.length} of ${LIMIT} characters. Shown under the page title in search results.`,
402
+ error: over ? `Shorten it to ${LIMIT} characters or fewer, so search engines show all of it` : void 0,
403
+ children: /* @__PURE__ */ jsx(DescriptionBox, {
404
+ rows: 4,
405
+ value: text,
406
+ onChange: (e) => setText(e.target.value)
407
+ })
408
+ })
409
+ });
410
+ }
411
+ /** The check is the app's (an 800ms wait, then a lookup). Field and Input draw what it found. */
412
+ var TAKEN = [
413
+ "harbourdesk",
414
+ "orbit",
415
+ "shop"
416
+ ];
417
+ function StoreAddressCheck() {
418
+ const [value, setValue] = useState("harbourdesk");
419
+ const [status, setStatus] = useState("idle");
420
+ const [messages, setMessages] = useState([]);
421
+ useEffect(() => {
422
+ const name = value.trim().toLowerCase();
423
+ if (!name) {
424
+ setStatus("idle");
425
+ setMessages([]);
426
+ return;
427
+ }
428
+ if (!/^[a-z0-9-]+$/.test(name)) {
429
+ setStatus("invalid");
430
+ setMessages([{
431
+ tone: "error",
432
+ text: "Use lower-case letters, numbers and dashes only"
433
+ }]);
434
+ return;
435
+ }
436
+ setStatus("checking");
437
+ setMessages([]);
438
+ const timer = window.setTimeout(() => {
439
+ if (TAKEN.includes(name)) {
440
+ setStatus("invalid");
441
+ setMessages([{
442
+ tone: "error",
443
+ text: `${name}.myorbit.example is taken`
444
+ }, {
445
+ tone: "info",
446
+ text: `Try ${name}-shop or ${name}-uk`
447
+ }]);
448
+ } else {
449
+ setStatus("valid");
450
+ setMessages([{
451
+ tone: "success",
452
+ text: `${name}.myorbit.example is available`
453
+ }]);
454
+ }
455
+ }, 800);
456
+ return () => window.clearTimeout(timer);
457
+ }, [value]);
458
+ return /* @__PURE__ */ jsx("div", {
459
+ className: "input-stack",
460
+ children: /* @__PURE__ */ jsx(Field, {
461
+ label: "Store address",
462
+ required: true,
463
+ hint: "Letters, numbers and dashes.",
464
+ messages,
465
+ children: /* @__PURE__ */ jsx(Input, {
466
+ value,
467
+ onChange: (e) => setValue(e.target.value),
468
+ suffix: ".myorbit.example",
469
+ status,
470
+ autoComplete: "off",
471
+ spellCheck: false
472
+ })
473
+ })
474
+ });
475
+ }
476
+ function HelpTips() {
477
+ const [tips, setTips] = useState(true);
478
+ return /* @__PURE__ */ jsxs("div", {
479
+ className: "input-stack",
480
+ children: [/* @__PURE__ */ jsx(Switch, {
481
+ label: "Show help tips",
482
+ checked: tips,
483
+ onCheckedChange: setTips
484
+ }), /* @__PURE__ */ jsxs(FieldHelpProvider, {
485
+ enabled: tips,
486
+ children: [/* @__PURE__ */ jsx(Field, {
487
+ label: "Compare-at price",
488
+ optional: true,
489
+ help: "Shown crossed out beside your price, so it has to be higher than the price.",
490
+ children: /* @__PURE__ */ jsx(Input, {
491
+ prefix: "£",
492
+ inputMode: "decimal",
493
+ placeholder: "0.00"
494
+ })
495
+ }), /* @__PURE__ */ jsx(Field, {
496
+ label: "Tax class",
497
+ help: "Decides the VAT rate charged on this product. Most furniture is standard rated at 20%.",
498
+ helpActions: /* @__PURE__ */ jsx(Link, {
499
+ href: "#help",
500
+ external: true,
501
+ size: "sm",
502
+ onClick: (event) => event.preventDefault(),
503
+ children: "About tax classes"
504
+ }),
505
+ children: /* @__PURE__ */ jsx(Select, {
506
+ placeholder: "Choose a tax class",
507
+ options: [
508
+ {
509
+ value: "standard",
510
+ label: "Standard rate (20%)"
511
+ },
512
+ {
513
+ value: "reduced",
514
+ label: "Reduced rate (5%)"
515
+ },
516
+ {
517
+ value: "zero",
518
+ label: "Zero rate (0%)"
519
+ }
520
+ ]
521
+ })
522
+ })]
523
+ })]
524
+ });
525
+ }
526
+ function CharacterCount() {
527
+ const [text, setText] = useState("Ergonomic chair in black mesh with 4D arms.");
528
+ return /* @__PURE__ */ jsx("div", {
529
+ className: "input-stack",
530
+ children: /* @__PURE__ */ jsx(Field, {
531
+ label: "Page title",
532
+ labelAside: `${text.length}/60`,
533
+ error: text.length > 60 ? "Shorten it to 60 characters or fewer" : void 0,
534
+ children: /* @__PURE__ */ jsx(Input, {
535
+ value: text,
536
+ onChange: (e) => setText(e.target.value)
537
+ })
538
+ })
539
+ });
540
+ }
541
+ function DeviceSwitch() {
542
+ const [device, setDevice] = useState("desktop");
543
+ return /* @__PURE__ */ jsx(Tooltip, {
544
+ content: device === "desktop" ? "Editing desktop. Switch to mobile" : "Editing mobile. Switch to desktop",
545
+ children: /* @__PURE__ */ jsx(IconButton, {
546
+ size: "xs",
547
+ variant: "ghost",
548
+ label: device === "desktop" ? "Editing desktop, switch to mobile" : "Editing mobile, switch to desktop",
549
+ onClick: () => setDevice(device === "desktop" ? "mobile" : "desktop"),
550
+ children: device === "desktop" ? /* @__PURE__ */ jsx(DesktopIcon, {}) : /* @__PURE__ */ jsx(DeviceMobileIcon, {})
551
+ })
552
+ });
553
+ }
554
+ function Inspector({ width }) {
555
+ return /* @__PURE__ */ jsxs("div", {
556
+ className: "input-inspector",
557
+ style: { width },
558
+ children: [
559
+ /* @__PURE__ */ jsxs("span", {
560
+ className: "input-inspector__title",
561
+ children: [width, "px inspector"]
562
+ }),
563
+ /* @__PURE__ */ jsx(Field, {
564
+ label: "Text colour",
565
+ orientation: "inline",
566
+ size: "sm",
567
+ children: /* @__PURE__ */ jsx(ColorField, {
568
+ compact: true,
569
+ defaultValue: "#1F2A2E"
570
+ })
571
+ }),
572
+ /* @__PURE__ */ jsx(Field, {
573
+ label: "Font size",
574
+ orientation: "inline",
575
+ size: "sm",
576
+ labelAside: /* @__PURE__ */ jsx(DeviceSwitch, {}),
577
+ children: /* @__PURE__ */ jsx(Input, {
578
+ inputMode: "numeric",
579
+ suffix: "px",
580
+ defaultValue: "16"
581
+ })
582
+ }),
583
+ /* @__PURE__ */ jsx(Field, {
584
+ label: "Letter spacing",
585
+ orientation: "inline",
586
+ size: "sm",
587
+ error: "Use a number from -5 to 10",
588
+ children: /* @__PURE__ */ jsx(Input, {
589
+ inputMode: "decimal",
590
+ suffix: "px",
591
+ defaultValue: "12"
592
+ })
593
+ }),
594
+ /* @__PURE__ */ jsx(Field, {
595
+ label: "Corner radius",
596
+ orientation: "inline",
597
+ size: "sm",
598
+ description: "Of every button in the theme",
599
+ children: /* @__PURE__ */ jsx(Input, {
600
+ inputMode: "numeric",
601
+ suffix: "px",
602
+ defaultValue: "999"
603
+ })
604
+ }),
605
+ /* @__PURE__ */ jsx(Field, {
606
+ label: "Show on mobile",
607
+ orientation: "inline",
608
+ size: "sm",
609
+ children: /* @__PURE__ */ jsx(Switch, { defaultChecked: true })
610
+ })
611
+ ]
612
+ });
613
+ }
614
+ function SeoFields() {
615
+ const [title, setTitle] = useState("Arden ergonomic chair in black mesh with 4D arms and a sliding seat");
616
+ return /* @__PURE__ */ jsxs("div", {
617
+ className: "input-addons",
618
+ children: [/* @__PURE__ */ jsx(Field, {
619
+ label: "URL handle",
620
+ hint: "Lowercase letters, numbers and hyphens",
621
+ children: /* @__PURE__ */ jsx(Input, {
622
+ showCount: true,
623
+ maxLength: 40,
624
+ defaultValue: "arden-ergonomic-chair"
625
+ })
626
+ }), /* @__PURE__ */ jsx(Field, {
627
+ label: "Page title",
628
+ hint: "Search engines show about 60 characters.",
629
+ children: /* @__PURE__ */ jsx(Input, {
630
+ recommendedLength: 60,
631
+ value: title,
632
+ onChange: (e) => setTitle(e.target.value)
633
+ })
634
+ })]
635
+ });
636
+ }
637
+ function AddressForm() {
638
+ return /* @__PURE__ */ jsx("form", {
639
+ noValidate: true,
640
+ onSubmit: (event) => event.preventDefault(),
641
+ className: "input-form",
642
+ children: /* @__PURE__ */ jsxs("div", {
643
+ className: "input-form__grid",
644
+ children: [
645
+ /* @__PURE__ */ jsx(Field, {
646
+ label: "Full name",
647
+ required: true,
648
+ children: /* @__PURE__ */ jsx(Input, { autoComplete: "name" })
649
+ }),
650
+ /* @__PURE__ */ jsx(Field, {
651
+ label: "Email",
652
+ required: true,
653
+ children: /* @__PURE__ */ jsx(Input, {
654
+ type: "email",
655
+ autoComplete: "email",
656
+ icon: /* @__PURE__ */ jsx(EnvelopeSimpleIcon, {})
657
+ })
658
+ }),
659
+ /* @__PURE__ */ jsx(Field, {
660
+ label: "Address line 1",
661
+ required: true,
662
+ children: /* @__PURE__ */ jsx(Input, { autoComplete: "address-line1" })
663
+ }),
664
+ /* @__PURE__ */ jsx(Field, {
665
+ label: "Postcode",
666
+ required: true,
667
+ children: /* @__PURE__ */ jsx(Input, { autoComplete: "postal-code" })
668
+ })
669
+ ]
670
+ })
671
+ });
672
+ }
673
+ function Page() {
674
+ return /* @__PURE__ */ jsxs(DocPage, {
675
+ title: "Input and field",
676
+ status: "stable",
677
+ importNames: [
678
+ "Input",
679
+ "Field",
680
+ "FieldHelp",
681
+ "useFieldControl"
682
+ ],
683
+ lead: "Input is the single-line text field, for names, prices, SKUs and anything else typed on one line. Field gives a control its label, a required star or Optional, a help button, a description, a hint or error and messages, and wires them together for screen readers.",
684
+ children: [
685
+ /* @__PURE__ */ jsx(Section$1, {
686
+ id: "playground",
687
+ title: "Playground",
688
+ description: /* @__PURE__ */ jsx("p", { children: "Change the props, then click into the field to see the teal focus edge and its halo." }),
689
+ children: /* @__PURE__ */ jsx(Playground, {
690
+ component: "Input",
691
+ controls: PLAYGROUND,
692
+ render: (v) => /* @__PURE__ */ jsx("div", {
693
+ className: "input-stage",
694
+ children: /* @__PURE__ */ jsx(Input, {
695
+ "aria-label": String(v["aria-label"]),
696
+ placeholder: String(v.placeholder),
697
+ size: v.size,
698
+ icon: v.icon ? /* @__PURE__ */ jsx(TagIcon, {}) : void 0,
699
+ prefix: v.prefix === "none" ? void 0 : String(v.prefix),
700
+ suffix: v.suffix === "none" ? void 0 : String(v.suffix),
701
+ status: v.status,
702
+ invalid: Boolean(v.invalid),
703
+ readOnly: Boolean(v.readOnly),
704
+ disabled: Boolean(v.disabled)
705
+ })
706
+ })
707
+ })
708
+ }),
709
+ /* @__PURE__ */ jsxs(Section$1, {
710
+ id: "field",
711
+ title: "With a field",
712
+ description: /* @__PURE__ */ jsxs("p", { children: [
713
+ "Put one control inside a ",
714
+ /* @__PURE__ */ jsx("code", { children: "Field" }),
715
+ " to give it a label above and a hint below. The label points at the control, so clicking it focuses the field, and the hint becomes the control's description. Every field needs a label; an Input on its own needs an ",
716
+ /* @__PURE__ */ jsx("code", { children: "aria-label" }),
717
+ ". A field can carry more, each described below: a required star or \"Optional\", a help button, an aside, a description and messages."
718
+ ] }),
719
+ children: [/* @__PURE__ */ jsx(Example, {
720
+ code: `
721
+ <Field label="Product title" hint="Shown on the product page and in search results.">
722
+ <Input placeholder="e.g. Arden ergonomic chair" />
723
+ </Field>`,
724
+ children: /* @__PURE__ */ jsx("div", {
725
+ className: "input-stack",
726
+ children: /* @__PURE__ */ jsx(Field, {
727
+ label: "Product title",
728
+ hint: "Shown on the product page and in search results.",
729
+ children: /* @__PURE__ */ jsx(Input, { placeholder: "e.g. Arden ergonomic chair" })
730
+ })
731
+ })
732
+ }), /* @__PURE__ */ jsx(DocTable, {
733
+ columns: ["Part", "What it does"],
734
+ rows: [
735
+ ["Label", "13px at 550, 7px above the control. Always visible, in sentence case. Hide it with hideLabel when the page already names the field: it still names the control."],
736
+ ["Marks", "A red star when the field is required, or a quiet \"Optional\". Beside the label, so the control keeps a plain name."],
737
+ ["Help", "An (i) button after the label that opens a popover of explanation."],
738
+ ["Aside", "Whatever sits at the far end of the label row: a link, a character count."],
739
+ ["Description", "What the field is for, between the label and the control."],
740
+ ["Control", "An Input, a SearchField, a Select, a Textarea, a RadioGroup, or your own control reading useFieldControl."],
741
+ ["Hint", "12.5px in quiet slate: what to enter, or how it is used. Hidden while there is an error."],
742
+ ["Error", "12.5px in red with an icon: what is wrong and how to fix it. Replaces the hint and marks the control invalid."],
743
+ ["Messages", "One-line feedback in four tones under the control: error, warning, success and info."]
744
+ ]
745
+ })]
746
+ }),
747
+ /* @__PURE__ */ jsxs(Section$1, {
748
+ id: "required",
749
+ title: "Required and optional",
750
+ description: /* @__PURE__ */ jsxs("p", { children: [
751
+ "Most fields in a form are required, so mark the ones that are. ",
752
+ /* @__PURE__ */ jsx("code", { children: "required" }),
753
+ " draws a red star after the label and sets ",
754
+ /* @__PURE__ */ jsx("code", { children: "aria-required" }),
755
+ " on the control, which is how screen readers hear it: the star itself is hidden from them. A few fields can be left empty, and ",
756
+ /* @__PURE__ */ jsx("code", { children: "optional" }),
757
+ " says so in quiet words after the label. A field is one or the other; ",
758
+ /* @__PURE__ */ jsx("code", { children: "required" }),
759
+ " wins."
760
+ ] }),
761
+ children: [
762
+ /* @__PURE__ */ jsx(Example, {
763
+ code: `
764
+ <Field label="SKU" required hint="Letters, numbers and dashes">
765
+ <Input placeholder="e.g. ARD-CHR-BLK" />
766
+ </Field>
767
+ <Field label="Barcode" optional hint="GTIN, EAN or UPC">
768
+ <Input inputMode="numeric" />
769
+ </Field>
770
+ <Field label="Supplier code" optional="If you have one">
771
+ <Input />
772
+ </Field>`,
773
+ children: /* @__PURE__ */ jsxs("div", {
774
+ className: "input-stack",
775
+ children: [
776
+ /* @__PURE__ */ jsx(Field, {
777
+ label: "SKU",
778
+ required: true,
779
+ hint: "Letters, numbers and dashes",
780
+ children: /* @__PURE__ */ jsx(Input, { placeholder: "e.g. ARD-CHR-BLK" })
781
+ }),
782
+ /* @__PURE__ */ jsx(Field, {
783
+ label: "Barcode",
784
+ optional: true,
785
+ hint: "GTIN, EAN or UPC",
786
+ children: /* @__PURE__ */ jsx(Input, { inputMode: "numeric" })
787
+ }),
788
+ /* @__PURE__ */ jsx(Field, {
789
+ label: "Supplier code",
790
+ optional: "If you have one",
791
+ children: /* @__PURE__ */ jsx(Input, {})
792
+ })
793
+ ]
794
+ })
795
+ }),
796
+ /* @__PURE__ */ jsx(DocTable, {
797
+ columns: ["Control", "Hears \"required\" from the Field"],
798
+ rows: [
799
+ ["Input, SearchField, Textarea", "Yes: aria-required on the field."],
800
+ ["Select", "Yes: on the trigger."],
801
+ ["RadioGroup", "Yes: on the group."],
802
+ ["DatePicker", "No. Its trigger is a button, and ARIA has no required button. Say it in the label or the hint."],
803
+ ["Your own control", /* @__PURE__ */ jsxs(Fragment$1, { children: [
804
+ "Read ",
805
+ /* @__PURE__ */ jsx("code", { children: "required" }),
806
+ " from ",
807
+ /* @__PURE__ */ jsx("code", { children: "useFieldControl()" }),
808
+ " and set ",
809
+ /* @__PURE__ */ jsx("code", { children: "aria-required" }),
810
+ " on the element that takes focus."
811
+ ] })]
812
+ ]
813
+ }),
814
+ /* @__PURE__ */ jsxs(Note, {
815
+ title: "Browser validation",
816
+ children: [
817
+ "A Field's ",
818
+ /* @__PURE__ */ jsx("code", { children: "required" }),
819
+ " marks the field and tells screen readers; it does not switch on the browser's own validation, so no native message pops up over your own. Check the values yourself and show the problem with ",
820
+ /* @__PURE__ */ jsx("code", { children: "error" }),
821
+ ", as the examples on this page do. Pass ",
822
+ /* @__PURE__ */ jsx("code", { children: "required" }),
823
+ " to the control too if you want the browser to check as well (and then give the form ",
824
+ /* @__PURE__ */ jsx("code", { children: "noValidate" }),
825
+ " if you do not want its message)."
826
+ ]
827
+ })
828
+ ]
829
+ }),
830
+ /* @__PURE__ */ jsxs(Section$1, {
831
+ id: "help",
832
+ title: "Help beside the label",
833
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
834
+ "Pass ",
835
+ /* @__PURE__ */ jsx("code", { children: "help" }),
836
+ " and the label gets a small (i) button. Pressing it opens a popover with the explanation, which stays until Escape or a press elsewhere. It is a popover, not a tooltip, so a link inside it can be reached and used."
837
+ ] }), /* @__PURE__ */ jsxs("p", { children: [
838
+ /* @__PURE__ */ jsx("code", { children: "helpActions" }),
839
+ " adds a footer under a hairline for links or buttons. Inside a Field the button is named with the field (\"Learn more about this field Compare-at price\"), so a page of them can be told apart. Change the first words with ",
840
+ /* @__PURE__ */ jsx("code", { children: "helpLabel" }),
841
+ ". Try the switch: ",
842
+ /* @__PURE__ */ jsx("code", { children: "FieldHelpProvider" }),
843
+ " lets an app turn every tip off."
844
+ ] })] }),
845
+ children: [
846
+ /* @__PURE__ */ jsx(Example, {
847
+ minHeight: 420,
848
+ code: `
849
+ const [tips, setTips] = useState(true)
850
+
851
+ <Switch label="Show help tips" checked={tips} onCheckedChange={setTips} />
852
+ <FieldHelpProvider enabled={tips}>
853
+ <Field
854
+ label="Compare-at price"
855
+ optional
856
+ help="Shown crossed out beside your price, so it has to be higher than the price."
857
+ >
858
+ <Input prefix="£" inputMode="decimal" placeholder="0.00" />
859
+ </Field>
860
+ <Field
861
+ label="Tax class"
862
+ help="Decides the VAT rate charged on this product. Most furniture is standard rated at 20%."
863
+ helpActions={<Link href="/help/tax-classes" external size="sm">About tax classes</Link>}
864
+ >
865
+ <Select placeholder="Choose a tax class" options={taxClasses} />
866
+ </Field>
867
+ </FieldHelpProvider>`,
868
+ children: /* @__PURE__ */ jsx(HelpTips, {})
869
+ }),
870
+ /* @__PURE__ */ jsx(SubSection, {
871
+ title: "On its own",
872
+ description: /* @__PURE__ */ jsx("p", { children: "FieldHelp is a component in its own right, for a label that is not a Field's: a switch, a heading, a table column." }),
873
+ children: /* @__PURE__ */ jsx(Example, {
874
+ minHeight: 220,
875
+ code: `
876
+ <Switch label="Make this my default address" defaultChecked />
877
+ <FieldHelp content="We will use it for new orders unless you pick another at checkout." />`,
878
+ children: /* @__PURE__ */ jsxs("div", {
879
+ className: "input-help-row",
880
+ children: [/* @__PURE__ */ jsx(Switch, {
881
+ label: "Make this my default address",
882
+ defaultChecked: true
883
+ }), /* @__PURE__ */ jsx(FieldHelp, { content: "We will use it for new orders unless you pick another at checkout." })]
884
+ })
885
+ })
886
+ }),
887
+ /* @__PURE__ */ jsx(Note, { children: "Help is for the reason behind a field, not for repeating the label. Keep it to a sentence or two, and link out for more. Anything that must be read to fill the field in belongs in a description or a hint, which are always in view." })
888
+ ]
889
+ }),
890
+ /* @__PURE__ */ jsxs(Section$1, {
891
+ id: "label-row",
892
+ title: "The label row and description",
893
+ description: /* @__PURE__ */ jsxs("p", { children: [
894
+ /* @__PURE__ */ jsx("code", { children: "labelAside" }),
895
+ " sits at the far end of the label row: a link such as \"Forgot password?\", or a count. It is outside the label, so it does not become part of the control's name. ",
896
+ /* @__PURE__ */ jsx("code", { children: "description" }),
897
+ " says what the field is for, between the label and the control, and is linked to the control like a hint. Where a hint is the format or an example below the control, a description is the explanation above it."
898
+ ] }),
899
+ children: [/* @__PURE__ */ jsx(Example, {
900
+ align: "fill",
901
+ code: `
902
+ <Field label="Password" labelAside={<Link href="/forgot" size="sm">Forgot password?</Link>}>
903
+ <Input type="password" />
904
+ </Field>
905
+
906
+ <Field label="Page title" labelAside={\`\${title.length}/60\`} error={title.length > 60 ? 'Shorten it to 60 characters or fewer' : undefined}>
907
+ <Input value={title} onChange={(e) => setTitle(e.target.value)} />
908
+ </Field>
909
+
910
+ <Field
911
+ label="Store name"
912
+ required
913
+ description="Shown to customers at checkout, on invoices and in emails."
914
+ hint="Up to 40 characters."
915
+ >
916
+ <Input defaultValue="Harbour Desk Co" />
917
+ </Field>`,
918
+ children: /* @__PURE__ */ jsxs("div", {
919
+ className: "input-grid",
920
+ children: [
921
+ /* @__PURE__ */ jsx(Field, {
922
+ label: "Password",
923
+ labelAside: /* @__PURE__ */ jsx(Link, {
924
+ href: "#label-row",
925
+ size: "sm",
926
+ onClick: (event) => event.preventDefault(),
927
+ children: "Forgot password?"
928
+ }),
929
+ children: /* @__PURE__ */ jsx(Input, {
930
+ type: "password",
931
+ defaultValue: "correct-horse"
932
+ })
933
+ }),
934
+ /* @__PURE__ */ jsx(CharacterCount, {}),
935
+ /* @__PURE__ */ jsx(Field, {
936
+ label: "Store name",
937
+ required: true,
938
+ description: "Shown to customers at checkout, on invoices and in emails.",
939
+ hint: "Up to 40 characters.",
940
+ children: /* @__PURE__ */ jsx(Input, { defaultValue: "Harbour Desk Co" })
941
+ })
942
+ ]
943
+ })
944
+ }), /* @__PURE__ */ jsx(SubSection, {
945
+ title: "A hidden label",
946
+ description: /* @__PURE__ */ jsxs("p", { children: [
947
+ "When the page already shows what a field is for, as a search above a table does, ",
948
+ /* @__PURE__ */ jsx("code", { children: "hideLabel" }),
949
+ " ",
950
+ "keeps the label for screen readers and takes it out of view. The field still gets its hint, error and messages."
951
+ ] }),
952
+ children: /* @__PURE__ */ jsx(Example, {
953
+ code: `
954
+ <Field label="Search orders" hideLabel>
955
+ <SearchField placeholder="Search orders" />
956
+ </Field>`,
957
+ children: /* @__PURE__ */ jsx("div", {
958
+ className: "input-stack",
959
+ children: /* @__PURE__ */ jsx(Field, {
960
+ label: "Search orders",
961
+ hideLabel: true,
962
+ children: /* @__PURE__ */ jsx(SearchField, { placeholder: "Search orders" })
963
+ })
964
+ })
965
+ })
966
+ })]
967
+ }),
968
+ /* @__PURE__ */ jsx(Section$1, {
969
+ id: "inline",
970
+ title: "Inline and dense",
971
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "orientation=\"inline\"" }), " sets the label at the start of one row and the control at the end, in the row's other half: a builder inspector's colour, size and spacing rows. A control with a width of its own (a switch, a swatch) sits at the end; a field fills the half. The description stays under the label, and the hint, the error and the messages run under the whole row. It never stacks: it holds in a 288px inspector and at 320px."] }), /* @__PURE__ */ jsxs("p", { children: [
972
+ /* @__PURE__ */ jsx("code", { children: "size=\"sm\"" }),
973
+ " is for dense inspectors: a 12px label and messages, a tighter gap, and small controls inside, since an Input or a Textarea in a small Field takes ",
974
+ /* @__PURE__ */ jsx("code", { children: "sm" }),
975
+ " unless it sets its own size. The label aside is where a device switch goes, to pick which screen's value is edited."
976
+ ] })] }),
977
+ children: /* @__PURE__ */ jsx(Example, {
978
+ code: `
979
+ <div className="inspector">
980
+ <Field label="Text colour" orientation="inline" size="sm">
981
+ <ColorField compact defaultValue="#1F2A2E" />
982
+ </Field>
983
+ <Field label="Font size" orientation="inline" size="sm" labelAside={<DeviceSwitch />}>
984
+ <Input inputMode="numeric" suffix="px" defaultValue="16" />
985
+ </Field>
986
+ <Field label="Letter spacing" orientation="inline" size="sm" error="Use a number from -5 to 10">
987
+ <Input inputMode="decimal" suffix="px" defaultValue="12" />
988
+ </Field>
989
+ <Field label="Corner radius" orientation="inline" size="sm" description="Of every button in the theme">
990
+ <Input inputMode="numeric" suffix="px" defaultValue="999" />
991
+ </Field>
992
+ <Field label="Show on mobile" orientation="inline" size="sm">
993
+ <Switch defaultChecked />
994
+ </Field>
995
+ </div>`,
996
+ children: /* @__PURE__ */ jsxs("div", {
997
+ className: "input-inspectors",
998
+ children: [/* @__PURE__ */ jsx(Inspector, { width: 288 }), /* @__PURE__ */ jsx(Inspector, { width: 240 })]
999
+ })
1000
+ })
1001
+ }),
1002
+ /* @__PURE__ */ jsx(Section$1, {
1003
+ id: "sizes",
1004
+ title: "Sizes",
1005
+ description: /* @__PURE__ */ jsxs("p", { children: [
1006
+ /* @__PURE__ */ jsx("code", { children: "sm" }),
1007
+ " 30px, ",
1008
+ /* @__PURE__ */ jsx("code", { children: "md" }),
1009
+ " 36px (default) and ",
1010
+ /* @__PURE__ */ jsx("code", { children: "lg" }),
1011
+ " 44px: the same heights as buttons, so a field and its button share a line. Text is 13, 14 and 15px; icons are 15, 16 and 18px."
1012
+ ] }),
1013
+ children: /* @__PURE__ */ jsx(Example, {
1014
+ code: `
1015
+ <Input size="sm" aria-label="Discount code" placeholder="Discount code" />
1016
+ <Button size="sm">Apply</Button>
1017
+
1018
+ <Input aria-label="Discount code" placeholder="Discount code" />
1019
+ <Button>Apply</Button>
1020
+
1021
+ <Input size="lg" aria-label="Discount code" placeholder="Discount code" />
1022
+ <Button size="lg">Apply</Button>`,
1023
+ children: /* @__PURE__ */ jsxs("div", {
1024
+ className: "input-sizes",
1025
+ children: [
1026
+ /* @__PURE__ */ jsxs("div", {
1027
+ className: "input-sizes__row",
1028
+ children: [/* @__PURE__ */ jsx(Input, {
1029
+ size: "sm",
1030
+ "aria-label": "Discount code",
1031
+ placeholder: "Discount code"
1032
+ }), /* @__PURE__ */ jsx(Button, {
1033
+ size: "sm",
1034
+ children: "Apply"
1035
+ })]
1036
+ }),
1037
+ /* @__PURE__ */ jsxs("div", {
1038
+ className: "input-sizes__row",
1039
+ children: [/* @__PURE__ */ jsx(Input, {
1040
+ "aria-label": "Discount code",
1041
+ placeholder: "Discount code"
1042
+ }), /* @__PURE__ */ jsx(Button, { children: "Apply" })]
1043
+ }),
1044
+ /* @__PURE__ */ jsxs("div", {
1045
+ className: "input-sizes__row",
1046
+ children: [/* @__PURE__ */ jsx(Input, {
1047
+ size: "lg",
1048
+ "aria-label": "Discount code",
1049
+ placeholder: "Discount code"
1050
+ }), /* @__PURE__ */ jsx(Button, {
1051
+ size: "lg",
1052
+ children: "Apply"
1053
+ })]
1054
+ })
1055
+ ]
1056
+ })
1057
+ })
1058
+ }),
1059
+ /* @__PURE__ */ jsx(Section$1, {
1060
+ id: "adornments",
1061
+ title: "Icon, prefix and suffix",
1062
+ description: /* @__PURE__ */ jsxs("p", { children: [
1063
+ /* @__PURE__ */ jsx("code", { children: "icon" }),
1064
+ " leads, muted until the field has focus. ",
1065
+ /* @__PURE__ */ jsx("code", { children: "prefix" }),
1066
+ " is text set tight against the value, so a price reads £18.00, never £ 18.00. ",
1067
+ /* @__PURE__ */ jsx("code", { children: "suffix" }),
1068
+ " trails: a unit, a status or a small button. Clicking the icon, the prefix or the padding focuses the input; a button in the suffix keeps its own click."
1069
+ ] }),
1070
+ children: /* @__PURE__ */ jsx(Example, {
1071
+ align: "fill",
1072
+ code: `
1073
+ <Input type="email" icon={<EnvelopeSimpleIcon />} aria-label="Email" placeholder="name@example.com" />
1074
+ <Input prefix="£" inputMode="decimal" aria-label="Price" defaultValue="18.00" />
1075
+ <Input prefix="https://" aria-label="Website" defaultValue="harbourdesk.co.uk" />
1076
+ <Input suffix="kg" inputMode="decimal" aria-label="Weight" defaultValue="14.2" />
1077
+ <Input
1078
+ readOnly
1079
+ aria-label="Store address"
1080
+ value="harbourdesk.co.uk"
1081
+ suffix={
1082
+ <Tooltip content="Copy address">
1083
+ <IconButton label="Copy address" size="xs" onClick={copy}><CopySimpleIcon /></IconButton>
1084
+ </Tooltip>
1085
+ }
1086
+ />`,
1087
+ children: /* @__PURE__ */ jsxs("div", {
1088
+ className: "input-grid",
1089
+ children: [
1090
+ /* @__PURE__ */ jsx(Input, {
1091
+ type: "email",
1092
+ icon: /* @__PURE__ */ jsx(EnvelopeSimpleIcon, {}),
1093
+ "aria-label": "Email",
1094
+ placeholder: "name@example.com"
1095
+ }),
1096
+ /* @__PURE__ */ jsx(Input, {
1097
+ prefix: "£",
1098
+ inputMode: "decimal",
1099
+ "aria-label": "Price",
1100
+ defaultValue: "18.00"
1101
+ }),
1102
+ /* @__PURE__ */ jsx(Input, {
1103
+ prefix: "https://",
1104
+ "aria-label": "Website",
1105
+ defaultValue: "harbourdesk.co.uk"
1106
+ }),
1107
+ /* @__PURE__ */ jsx(Input, {
1108
+ suffix: "kg",
1109
+ inputMode: "decimal",
1110
+ "aria-label": "Weight",
1111
+ defaultValue: "14.2"
1112
+ }),
1113
+ /* @__PURE__ */ jsx(CopyAddress, {})
1114
+ ]
1115
+ })
1116
+ })
1117
+ }),
1118
+ /* @__PURE__ */ jsxs(Section$1, {
1119
+ id: "addons",
1120
+ title: "Addons",
1121
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
1122
+ "An addon is a cell joined to the start or end of the frame, outside it: the domain after a subdomain, the mail domain after a mailbox name, a protocol, a unit to choose, an Upload button. ",
1123
+ /* @__PURE__ */ jsx("code", { children: "addonStart" }),
1124
+ " ",
1125
+ "and ",
1126
+ /* @__PURE__ */ jsx("code", { children: "addonEnd" }),
1127
+ " take text or a small control. Frame and cell share one hairline and one halo, so they read as one field; a text cell sits on the well in quiet slate, and pressing it focuses the input."
1128
+ ] }), /* @__PURE__ */ jsxs("p", { children: [
1129
+ "Where ",
1130
+ /* @__PURE__ */ jsx("code", { children: "prefix" }),
1131
+ " and ",
1132
+ /* @__PURE__ */ jsx("code", { children: "suffix" }),
1133
+ " are inside the box, set against the value, an addon is part of the field's shape: what the value will be joined to. A text addon is read as part of the field's description, so a screen reader hears \"Subdomain, .myorbitcommerce.net\". A control in a cell is a control of its own: give it an ",
1134
+ /* @__PURE__ */ jsx("code", { children: "aria-label" }),
1135
+ ". With an addon, ",
1136
+ /* @__PURE__ */ jsx("code", { children: "className" }),
1137
+ " and",
1138
+ " ",
1139
+ /* @__PURE__ */ jsx("code", { children: "style" }),
1140
+ " go to the group around the frame and its cells."
1141
+ ] })] }),
1142
+ children: [
1143
+ /* @__PURE__ */ jsx(Example, {
1144
+ align: "fill",
1145
+ code: `
1146
+ <Field label="Subdomain" hint="Lowercase letters, numbers and hyphens">
1147
+ <Input addonEnd=".myorbitcommerce.net" defaultValue="harbour-desk" />
1148
+ </Field>
1149
+ <Field label="Mailbox">
1150
+ <Input addonEnd="@harbourdesk.co.uk" placeholder="info" />
1151
+ </Field>
1152
+ <Field label="Website">
1153
+ <Input addonStart="https://" placeholder="harbourdesk.co.uk" />
1154
+ </Field>
1155
+ <Field label="Weight">
1156
+ <Input
1157
+ inputMode="decimal"
1158
+ defaultValue="14.2"
1159
+ addonEnd={<Select aria-label="Weight unit" defaultValue="kg" options={WEIGHT_UNITS} />}
1160
+ />
1161
+ </Field>`,
1162
+ children: /* @__PURE__ */ jsxs("div", {
1163
+ className: "input-addons",
1164
+ children: [
1165
+ /* @__PURE__ */ jsx(Field, {
1166
+ label: "Subdomain",
1167
+ hint: "Lowercase letters, numbers and hyphens",
1168
+ children: /* @__PURE__ */ jsx(Input, {
1169
+ addonEnd: ".myorbitcommerce.net",
1170
+ defaultValue: "harbour-desk"
1171
+ })
1172
+ }),
1173
+ /* @__PURE__ */ jsx(Field, {
1174
+ label: "Mailbox",
1175
+ children: /* @__PURE__ */ jsx(Input, {
1176
+ addonEnd: "@harbourdesk.co.uk",
1177
+ placeholder: "info"
1178
+ })
1179
+ }),
1180
+ /* @__PURE__ */ jsx(Field, {
1181
+ label: "Website",
1182
+ children: /* @__PURE__ */ jsx(Input, {
1183
+ addonStart: "https://",
1184
+ placeholder: "harbourdesk.co.uk"
1185
+ })
1186
+ }),
1187
+ /* @__PURE__ */ jsx(Field, {
1188
+ label: "Weight",
1189
+ children: /* @__PURE__ */ jsx(Input, {
1190
+ inputMode: "decimal",
1191
+ defaultValue: "14.2",
1192
+ addonEnd: /* @__PURE__ */ jsx(Select, {
1193
+ "aria-label": "Weight unit",
1194
+ defaultValue: "kg",
1195
+ options: WEIGHT_UNITS
1196
+ })
1197
+ })
1198
+ })
1199
+ ]
1200
+ })
1201
+ }),
1202
+ /* @__PURE__ */ jsx(SubSection, {
1203
+ title: "States",
1204
+ description: /* @__PURE__ */ jsx("p", { children: "The cells follow the frame: a firmer hairline on hover, teal while the input has focus, red when invalid, and the well when read-only or disabled." }),
1205
+ children: /* @__PURE__ */ jsx(Example, {
1206
+ align: "fill",
1207
+ code: `
1208
+ <Field label="Subdomain" error="harbour-desk is taken. Try another.">
1209
+ <Input addonEnd=".myorbitcommerce.net" defaultValue="harbour-desk" />
1210
+ </Field>
1211
+ <Field label="Subdomain" hint="Set when the store was made">
1212
+ <Input addonEnd=".myorbitcommerce.net" value="harbour-desk" readOnly />
1213
+ </Field>
1214
+ <Field label="Subdomain">
1215
+ <Input addonEnd=".myorbitcommerce.net" defaultValue="harbour-desk" disabled />
1216
+ </Field>
1217
+ <Field label="Mailbox (small)">
1218
+ <Input size="sm" addonEnd="@harbourdesk.co.uk" placeholder="info" />
1219
+ </Field>`,
1220
+ children: /* @__PURE__ */ jsxs("div", {
1221
+ className: "input-addons",
1222
+ children: [
1223
+ /* @__PURE__ */ jsx(Field, {
1224
+ label: "Subdomain",
1225
+ error: "harbour-desk is taken. Try another.",
1226
+ children: /* @__PURE__ */ jsx(Input, {
1227
+ addonEnd: ".myorbitcommerce.net",
1228
+ defaultValue: "harbour-desk"
1229
+ })
1230
+ }),
1231
+ /* @__PURE__ */ jsx(Field, {
1232
+ label: "Subdomain",
1233
+ hint: "Set when the store was made",
1234
+ children: /* @__PURE__ */ jsx(Input, {
1235
+ addonEnd: ".myorbitcommerce.net",
1236
+ value: "harbour-desk",
1237
+ readOnly: true
1238
+ })
1239
+ }),
1240
+ /* @__PURE__ */ jsx(Field, {
1241
+ label: "Subdomain",
1242
+ children: /* @__PURE__ */ jsx(Input, {
1243
+ addonEnd: ".myorbitcommerce.net",
1244
+ defaultValue: "harbour-desk",
1245
+ disabled: true
1246
+ })
1247
+ }),
1248
+ /* @__PURE__ */ jsx(Field, {
1249
+ label: "Mailbox (small)",
1250
+ children: /* @__PURE__ */ jsx(Input, {
1251
+ size: "sm",
1252
+ addonEnd: "@harbourdesk.co.uk",
1253
+ placeholder: "info"
1254
+ })
1255
+ })
1256
+ ]
1257
+ })
1258
+ })
1259
+ }),
1260
+ /* @__PURE__ */ jsxs(Note, { children: [
1261
+ "A URL that can also be uploaded is its own control: ",
1262
+ /* @__PURE__ */ jsx(DocLink, {
1263
+ to: "/components/url-upload-input",
1264
+ children: "UrlUploadInput"
1265
+ }),
1266
+ " ",
1267
+ "is a URL field with an Upload cell, the chosen file's name and Clear."
1268
+ ] })
1269
+ ]
1270
+ }),
1271
+ /* @__PURE__ */ jsxs(Section$1, {
1272
+ id: "count",
1273
+ title: "Character count",
1274
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
1275
+ /* @__PURE__ */ jsx("code", { children: "showCount" }),
1276
+ " puts a count at the end of the field, as the Textarea has in its corner: the characters typed, out of ",
1277
+ /* @__PURE__ */ jsx("code", { children: "maxLength" }),
1278
+ " when there is one. It stays quiet until the last tenth of the limit, then takes the warning wash, and screen readers hear what is left with the field."
1279
+ ] }), /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "recommendedLength" }), " is a soft limit, for a length a search engine or a feed prefers rather than one the data must keep. The count runs against it, typing goes on past it, and once over it the count turns red and the field reads as invalid, as the page title below is. Shorten it to see the count go quiet."] })] }),
1280
+ children: [
1281
+ /* @__PURE__ */ jsx(Example, {
1282
+ align: "fill",
1283
+ code: `
1284
+ <Field label="URL handle" hint="Lowercase letters, numbers and hyphens">
1285
+ <Input showCount maxLength={40} defaultValue="arden-ergonomic-chair" />
1286
+ </Field>
1287
+ <Field label="Page title" hint="Search engines show about 60 characters.">
1288
+ <Input recommendedLength={60} value={title} onChange={(e) => setTitle(e.target.value)} />
1289
+ </Field>`,
1290
+ children: /* @__PURE__ */ jsx(SeoFields, {})
1291
+ }),
1292
+ /* @__PURE__ */ jsx(DocTable, {
1293
+ columns: [
1294
+ "Count",
1295
+ "Looks",
1296
+ "Screen readers"
1297
+ ],
1298
+ rows: [
1299
+ [
1300
+ "Up to 90% of the limit",
1301
+ "Quiet slate digits",
1302
+ "Read with the field: \"19 characters left\", or \"38 of 60 characters used\""
1303
+ ],
1304
+ [
1305
+ "The last 10%",
1306
+ "Digits on the warning wash",
1307
+ "Announced politely as they change"
1308
+ ],
1309
+ [
1310
+ "At maxLength",
1311
+ "Digits on the warning wash; the browser stops typing",
1312
+ "\"Maximum of 40 characters reached\""
1313
+ ],
1314
+ [
1315
+ "Past recommendedLength",
1316
+ "Digits on a red wash, a red edge, aria-invalid",
1317
+ "\"4 characters over the recommended 60\""
1318
+ ]
1319
+ ]
1320
+ }),
1321
+ /* @__PURE__ */ jsxs(Note, { children: [
1322
+ "The spoken words come from ",
1323
+ /* @__PURE__ */ jsx("code", { children: "countLabel" }),
1324
+ " (against ",
1325
+ /* @__PURE__ */ jsx("code", { children: "maxLength" }),
1326
+ ") and",
1327
+ " ",
1328
+ /* @__PURE__ */ jsx("code", { children: "recommendedLabel" }),
1329
+ " (against ",
1330
+ /* @__PURE__ */ jsx("code", { children: "recommendedLength" }),
1331
+ "), functions of the length and the limit. Pass your own to translate them. A count in the label row (",
1332
+ /* @__PURE__ */ jsx("code", { children: "labelAside" }),
1333
+ ") still works for a layout that wants it there."
1334
+ ] })
1335
+ ]
1336
+ }),
1337
+ /* @__PURE__ */ jsxs(Section$1, {
1338
+ id: "states",
1339
+ title: "States",
1340
+ description: /* @__PURE__ */ jsx("p", { children: "Hover firms the hairline. Focus turns it teal and grows a soft 3px halo: click into any field to see it. An error swaps the teal for red. Read-only and disabled fields sink into the well." }),
1341
+ children: [/* @__PURE__ */ jsx(Example, {
1342
+ align: "fill",
1343
+ code: `
1344
+ <Field label="Product title">
1345
+ <Input placeholder="e.g. Arden ergonomic chair" />
1346
+ </Field>
1347
+ <Field label="Product title">
1348
+ <Input defaultValue="Arden ergonomic chair" />
1349
+ </Field>
1350
+ <Field label="Customer email" error="Enter an email address in the correct format, like name@example.com">
1351
+ <Input type="email" defaultValue="priya@harbourdesk" />
1352
+ </Field>
1353
+ <Field label="Order number" hint="Set when the order was placed">
1354
+ <Input readOnly value="#1042" />
1355
+ </Field>
1356
+ <Field label="Sale price" hint="Turn on Put on sale to set a sale price">
1357
+ <Input disabled prefix="£" placeholder="0.00" />
1358
+ </Field>`,
1359
+ caption: "Empty, filled, invalid, read-only and disabled.",
1360
+ children: /* @__PURE__ */ jsxs("div", {
1361
+ className: "input-grid",
1362
+ children: [
1363
+ /* @__PURE__ */ jsx(Field, {
1364
+ label: "Product title",
1365
+ children: /* @__PURE__ */ jsx(Input, { placeholder: "e.g. Arden ergonomic chair" })
1366
+ }),
1367
+ /* @__PURE__ */ jsx(Field, {
1368
+ label: "Product title",
1369
+ children: /* @__PURE__ */ jsx(Input, { defaultValue: "Arden ergonomic chair" })
1370
+ }),
1371
+ /* @__PURE__ */ jsx(Field, {
1372
+ label: "Customer email",
1373
+ error: "Enter an email address in the correct format, like name@example.com",
1374
+ children: /* @__PURE__ */ jsx(Input, {
1375
+ type: "email",
1376
+ defaultValue: "priya@harbourdesk"
1377
+ })
1378
+ }),
1379
+ /* @__PURE__ */ jsx(Field, {
1380
+ label: "Order number",
1381
+ hint: "Set when the order was placed",
1382
+ children: /* @__PURE__ */ jsx(Input, {
1383
+ readOnly: true,
1384
+ value: "#1042"
1385
+ })
1386
+ }),
1387
+ /* @__PURE__ */ jsx(Field, {
1388
+ label: "Sale price",
1389
+ hint: "Turn on Put on sale to set a sale price",
1390
+ children: /* @__PURE__ */ jsx(Input, {
1391
+ disabled: true,
1392
+ prefix: "£",
1393
+ placeholder: "0.00"
1394
+ })
1395
+ })
1396
+ ]
1397
+ })
1398
+ }), /* @__PURE__ */ jsx(SubSection, {
1399
+ title: "Read-only or disabled?",
1400
+ children: /* @__PURE__ */ jsx(DocTable, {
1401
+ columns: [
1402
+ "Behaviour",
1403
+ "Read-only",
1404
+ "Disabled"
1405
+ ],
1406
+ rows: [
1407
+ [
1408
+ "Focus and copy",
1409
+ "Yes: it can be tabbed to, selected and copied.",
1410
+ "No: Tab skips it."
1411
+ ],
1412
+ [
1413
+ "Sent with the form",
1414
+ "Yes",
1415
+ "No"
1416
+ ],
1417
+ [
1418
+ "Use it for",
1419
+ "Values people can see but not change here: an order number, a store address.",
1420
+ "A field that is off because of another setting. Say which one nearby."
1421
+ ]
1422
+ ]
1423
+ })
1424
+ })]
1425
+ }),
1426
+ /* @__PURE__ */ jsx(Section$1, {
1427
+ id: "errors",
1428
+ title: "Hints and errors",
1429
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
1430
+ "A hint says what to enter or how it will be used. An error says what is wrong and how to fix it: it replaces the hint, turns the edge red, sets ",
1431
+ /* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
1432
+ " on the control and settles 3px down into place."
1433
+ ] }), /* @__PURE__ */ jsx("p", { children: "Check when the form is sent, not on every keystroke, and clear the error as soon as the person starts fixing it. Press Send invite to try it." })] }),
1434
+ children: /* @__PURE__ */ jsx(Example, {
1435
+ code: `
1436
+ const [email, setEmail] = useState('priya@harbourdesk')
1437
+ const [error, setError] = useState<string>()
1438
+
1439
+ <form noValidate onSubmit={sendInvite}>
1440
+ <Field label="Staff email" hint="We will email them a link to join your store." error={error}>
1441
+ <Input
1442
+ type="email"
1443
+ icon={<EnvelopeSimpleIcon />}
1444
+ value={email}
1445
+ onChange={(e) => {
1446
+ setEmail(e.target.value)
1447
+ setError(undefined)
1448
+ }}
1449
+ />
1450
+ </Field>
1451
+ <Button type="submit" variant="primary">Send invite</Button>
1452
+ </form>`,
1453
+ children: /* @__PURE__ */ jsx(InviteForm, {})
1454
+ })
1455
+ }),
1456
+ /* @__PURE__ */ jsxs(Section$1, {
1457
+ id: "tones",
1458
+ title: "Messages and tones",
1459
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
1460
+ "A message is one line of feedback with a mark and a tone, under the control. ",
1461
+ /* @__PURE__ */ jsx("code", { children: "messageTone" }),
1462
+ " ",
1463
+ "gives the hint a tone, for a note that is always there. ",
1464
+ /* @__PURE__ */ jsx("code", { children: "messages" }),
1465
+ " is for what a check or a rule finds: several can show at once, each in its own tone."
1466
+ ] }), /* @__PURE__ */ jsxs("p", { children: [
1467
+ "A message in the ",
1468
+ /* @__PURE__ */ jsx("code", { children: "error" }),
1469
+ " tone is the field's error: it marks the control invalid and the hint gives way, exactly as ",
1470
+ /* @__PURE__ */ jsx("code", { children: "error" }),
1471
+ " does. The other tones leave the field valid and the hint where it is. Words are ink deepened with the tone, and the mark carries the colour."
1472
+ ] })] }),
1473
+ children: [/* @__PURE__ */ jsx(Example, {
1474
+ align: "fill",
1475
+ code: `
1476
+ <Field label="Handle" hint="Changing this breaks links people have saved." messageTone="warning">
1477
+ <Input defaultValue="harbour-desk" />
1478
+ </Field>
1479
+
1480
+ <Field
1481
+ label="Email"
1482
+ messages={[
1483
+ { tone: 'warning', text: 'This looks like a personal address' },
1484
+ { tone: 'info', text: 'Did you mean priya@harbourdesk.co.uk?' },
1485
+ ]}
1486
+ >
1487
+ <Input type="email" defaultValue="priya@harbourdesk.co" />
1488
+ </Field>
1489
+
1490
+ <Field label="Discount code" messages={[{ tone: 'success', text: 'SPRING10 takes 10% off orders over £50' }]}>
1491
+ <Input defaultValue="SPRING10" />
1492
+ </Field>
1493
+
1494
+ <Field
1495
+ label="Address"
1496
+ messages={[
1497
+ { tone: 'error', text: 'Enter a postcode' },
1498
+ { tone: 'info', text: 'We deliver to UK addresses only' },
1499
+ ]}
1500
+ >
1501
+ <Input defaultValue="14 Quay Street" />
1502
+ </Field>`,
1503
+ children: /* @__PURE__ */ jsxs("div", {
1504
+ className: "input-grid",
1505
+ children: [
1506
+ /* @__PURE__ */ jsx(Field, {
1507
+ label: "Handle",
1508
+ hint: "Changing this breaks links people have saved.",
1509
+ messageTone: "warning",
1510
+ children: /* @__PURE__ */ jsx(Input, { defaultValue: "harbour-desk" })
1511
+ }),
1512
+ /* @__PURE__ */ jsx(Field, {
1513
+ label: "Email",
1514
+ messages: [{
1515
+ tone: "warning",
1516
+ text: "This looks like a personal address"
1517
+ }, {
1518
+ tone: "info",
1519
+ text: "Did you mean priya@harbourdesk.co.uk?"
1520
+ }],
1521
+ children: /* @__PURE__ */ jsx(Input, {
1522
+ type: "email",
1523
+ defaultValue: "priya@harbourdesk.co"
1524
+ })
1525
+ }),
1526
+ /* @__PURE__ */ jsx(Field, {
1527
+ label: "Discount code",
1528
+ messages: [{
1529
+ tone: "success",
1530
+ text: "SPRING10 takes 10% off orders over £50"
1531
+ }],
1532
+ children: /* @__PURE__ */ jsx(Input, { defaultValue: "SPRING10" })
1533
+ }),
1534
+ /* @__PURE__ */ jsx(Field, {
1535
+ label: "Address",
1536
+ messages: [{
1537
+ tone: "error",
1538
+ text: "Enter a postcode"
1539
+ }, {
1540
+ tone: "info",
1541
+ text: "We deliver to UK addresses only"
1542
+ }],
1543
+ children: /* @__PURE__ */ jsx(Input, { defaultValue: "14 Quay Street" })
1544
+ })
1545
+ ]
1546
+ })
1547
+ }), /* @__PURE__ */ jsx(DocTable, {
1548
+ columns: [
1549
+ "Tone",
1550
+ "Use it for",
1551
+ "Marks the field invalid"
1552
+ ],
1553
+ rows: [
1554
+ [
1555
+ /* @__PURE__ */ jsx("code", { children: "error" }, "e"),
1556
+ "What is wrong and must be fixed before the form can be saved.",
1557
+ "Yes"
1558
+ ],
1559
+ [
1560
+ /* @__PURE__ */ jsx("code", { children: "warning" }, "w"),
1561
+ "A value that is accepted but worth a second look.",
1562
+ "No"
1563
+ ],
1564
+ [
1565
+ /* @__PURE__ */ jsx("code", { children: "success" }, "s"),
1566
+ "A check that passed: an address is free, a code is valid.",
1567
+ "No"
1568
+ ],
1569
+ [
1570
+ /* @__PURE__ */ jsx("code", { children: "info" }, "i"),
1571
+ "A suggestion or a fact: \"Did you mean...\", a limit.",
1572
+ "No"
1573
+ ]
1574
+ ]
1575
+ })]
1576
+ }),
1577
+ /* @__PURE__ */ jsxs(Section$1, {
1578
+ id: "checks",
1579
+ title: "Checking a value as it is typed",
1580
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
1581
+ "When a value needs a lookup (is this address free? does this domain exist?), Input's ",
1582
+ /* @__PURE__ */ jsx("code", { children: "status" }),
1583
+ " ",
1584
+ "shows where the check has got to at the end of the field: a spinner while it runs, a tick or a cross when it is done. Only the mark is coloured; the edge keeps to its own states, apart from the red a cross brings."
1585
+ ] }), /* @__PURE__ */ jsxs("p", { children: [
1586
+ "The waiting is yours: when to start (after the person stops typing, or on blur), the request, and cancelling a stale one. Field's ",
1587
+ /* @__PURE__ */ jsx("code", { children: "messages" }),
1588
+ " says what was found. The list is a live region and is announced politely when it changes, so give it ",
1589
+ /* @__PURE__ */ jsx("code", { children: "[]" }),
1590
+ " while you check, not ",
1591
+ /* @__PURE__ */ jsx("code", { children: "undefined" }),
1592
+ ". Type a new address below: harbourdesk and orbit are taken."
1593
+ ] })] }),
1594
+ children: [
1595
+ /* @__PURE__ */ jsx(Example, {
1596
+ minHeight: 200,
1597
+ code: `
1598
+ const [status, setStatus] = useState<InputStatus>('idle')
1599
+ const [messages, setMessages] = useState<FieldMessage[]>([])
1600
+
1601
+ // ...debounce 800ms, look it up, then:
1602
+ // setStatus('checking'); setMessages([])
1603
+ // setStatus('valid'); setMessages([{ tone: 'success', text: 'harbourdesk-uk.myorbit.example is available' }])
1604
+ // setStatus('invalid'); setMessages([{ tone: 'error', text: 'harbourdesk.myorbit.example is taken' }])
1605
+
1606
+ <Field label="Store address" required hint="Letters, numbers and dashes." messages={messages}>
1607
+ <Input value={value} onChange={...} suffix=".myorbit.example" status={status} autoComplete="off" />
1608
+ </Field>`,
1609
+ children: /* @__PURE__ */ jsx(StoreAddressCheck, {})
1610
+ }),
1611
+ /* @__PURE__ */ jsx(DocTable, {
1612
+ columns: [
1613
+ "status",
1614
+ "Mark",
1615
+ "Field state",
1616
+ "Hidden text"
1617
+ ],
1618
+ rows: [
1619
+ [
1620
+ /* @__PURE__ */ jsx("code", { children: "idle" }, "1"),
1621
+ "None",
1622
+ "Unchanged",
1623
+ "None"
1624
+ ],
1625
+ [
1626
+ /* @__PURE__ */ jsx("code", { children: "checking" }, "2"),
1627
+ "Spinner in teal",
1628
+ "Unchanged",
1629
+ "Checking"
1630
+ ],
1631
+ [
1632
+ /* @__PURE__ */ jsx("code", { children: "valid" }, "3"),
1633
+ "Green tick",
1634
+ "Unchanged",
1635
+ "Valid"
1636
+ ],
1637
+ [
1638
+ /* @__PURE__ */ jsx("code", { children: "invalid" }, "4"),
1639
+ "Red cross",
1640
+ "Red edge and aria-invalid",
1641
+ "Not valid"
1642
+ ]
1643
+ ]
1644
+ }),
1645
+ /* @__PURE__ */ jsxs("p", {
1646
+ className: "doc-section__description",
1647
+ children: [
1648
+ "The hidden text joins the control's description. Replace it with ",
1649
+ /* @__PURE__ */ jsx("code", { children: "statusLabel" }),
1650
+ ", and put the real words, such as \"harbourdesk is taken\", in the Field's messages."
1651
+ ]
1652
+ })
1653
+ ]
1654
+ }),
1655
+ /* @__PURE__ */ jsx(Section$1, {
1656
+ id: "form",
1657
+ title: "In a form",
1658
+ description: /* @__PURE__ */ jsx("p", { children: "Pricing and inventory for a product. Fields sit two to a row on wide screens and stack on phones. Press Save product while the SKU is empty: every problem shows at once and focus moves to the first one, so a screen reader reads its error straight away." }),
1659
+ children: /* @__PURE__ */ jsx(Example, {
1660
+ align: "fill",
1661
+ code: `
1662
+ <form noValidate onSubmit={save}>
1663
+ <fieldset>
1664
+ <legend>Pricing</legend>
1665
+ <Field label="Price" required hint="Includes VAT at 20%" error={errors.price}>
1666
+ <Input prefix="£" inputMode="decimal" placeholder="0.00" value={price} onChange={...} />
1667
+ </Field>
1668
+ <Field label="Compare-at price" optional hint="Shown crossed out beside the price" error={errors.compareAt}>
1669
+ <Input prefix="£" inputMode="decimal" placeholder="0.00" value={compareAt} onChange={...} />
1670
+ </Field>
1671
+ {/* Cost per item follows the same pattern */}
1672
+ </fieldset>
1673
+ <fieldset>
1674
+ <legend>Inventory and delivery</legend>
1675
+ <Field label="SKU" required hint="Letters, numbers and dashes" error={errors.sku}>
1676
+ <Input icon={<TagIcon />} placeholder="e.g. ARD-CHR-BLK" value={sku} onChange={...} />
1677
+ </Field>
1678
+ {/* Barcode takes optional; Weight takes required and help="…", with suffix="kg" on its Input */}
1679
+ </fieldset>
1680
+ <Button type="submit" variant="primary" loading={saving}>Save product</Button>
1681
+ </form>`,
1682
+ children: /* @__PURE__ */ jsx(ProductForm, {})
1683
+ })
1684
+ }),
1685
+ /* @__PURE__ */ jsxs(Section$1, {
1686
+ id: "custom-controls",
1687
+ title: "Custom controls",
1688
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
1689
+ "Field works with any single control. Input and SearchField pick up its wiring on their own; for anything else, call ",
1690
+ /* @__PURE__ */ jsx("code", { children: "useFieldControl()" }),
1691
+ " inside the control and put the id, description, invalid state and required mark on the element that takes focus."
1692
+ ] }), /* @__PURE__ */ jsx("p", { children: "For a real multi-line field use Textarea, which does this for you. Here a plain textarea, styled for this page, shows the wiring by hand. Type past 160 characters to see the error arrive." })] }),
1693
+ children: [
1694
+ /* @__PURE__ */ jsx(Example, {
1695
+ code: `
1696
+ function DescriptionBox(props: TextareaHTMLAttributes<HTMLTextAreaElement>) {
1697
+ const field = useFieldControl()
1698
+ return (
1699
+ <textarea
1700
+ id={field?.id}
1701
+ aria-describedby={field?.describedBy}
1702
+ aria-invalid={field?.invalid || undefined}
1703
+ aria-required={field?.required || undefined}
1704
+ {...props}
1705
+ />
1706
+ )
1707
+ }
1708
+
1709
+ <Field
1710
+ label="Search engine description"
1711
+ hint={\`\${text.length} of 160 characters. Shown under the page title in search results.\`}
1712
+ error={text.length > 160 ? 'Shorten it to 160 characters or fewer, so search engines show all of it' : undefined}
1713
+ >
1714
+ <DescriptionBox rows={4} value={text} onChange={(e) => setText(e.target.value)} />
1715
+ </Field>`,
1716
+ children: /* @__PURE__ */ jsx(SearchDescription, {})
1717
+ }),
1718
+ /* @__PURE__ */ jsx(DocTable, {
1719
+ columns: [
1720
+ "useFieldControl() returns",
1721
+ "Type",
1722
+ "Put it on"
1723
+ ],
1724
+ rows: [
1725
+ [
1726
+ /* @__PURE__ */ jsx("code", { children: "id" }),
1727
+ /* @__PURE__ */ jsx("code", { children: "string" }),
1728
+ "The focusable element, so the label points at it."
1729
+ ],
1730
+ [
1731
+ /* @__PURE__ */ jsx("code", { children: "labelId" }),
1732
+ /* @__PURE__ */ jsx("code", { children: "string" }),
1733
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1734
+ "Its ",
1735
+ /* @__PURE__ */ jsx("code", { children: "aria-labelledby" }),
1736
+ ", when a label element cannot name it (a div with a role)."
1737
+ ] })
1738
+ ],
1739
+ [
1740
+ /* @__PURE__ */ jsx("code", { children: "describedBy" }),
1741
+ /* @__PURE__ */ jsx("code", { children: "string | undefined" }),
1742
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1743
+ "Its ",
1744
+ /* @__PURE__ */ jsx("code", { children: "aria-describedby" }),
1745
+ ": the id of the hint or the error."
1746
+ ] })
1747
+ ],
1748
+ [
1749
+ /* @__PURE__ */ jsx("code", { children: "invalid" }),
1750
+ /* @__PURE__ */ jsx("code", { children: "boolean" }),
1751
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1752
+ "Its ",
1753
+ /* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
1754
+ ", and your own error styling."
1755
+ ] })
1756
+ ]
1757
+ ]
1758
+ }),
1759
+ /* @__PURE__ */ jsxs(Note, { children: [
1760
+ "The hook returns ",
1761
+ /* @__PURE__ */ jsx("code", { children: "null" }),
1762
+ " outside a Field, so a control that can stand alone should fall back to its own ",
1763
+ /* @__PURE__ */ jsx("code", { children: "aria-label" }),
1764
+ "."
1765
+ ] })
1766
+ ]
1767
+ }),
1768
+ /* @__PURE__ */ jsxs(Section$1, {
1769
+ id: "autofill",
1770
+ title: "Browser autofill",
1771
+ description: /* @__PURE__ */ jsx("p", { children: "Browsers paint an autofilled field in their own colour (Safari's yellow, Chrome's blue-grey) and mark it important, so it can only be covered, not changed. Input and SearchField cover it with the field's own background, keep the ink text and the teal caret, and stop the text box a pixel short of the frame so the hairline stays whole, whether or not the field has focus. Nothing to switch on. To see it, use a browser with saved details: this form asks for them by the standard names." }),
1772
+ children: [/* @__PURE__ */ jsx(Example, {
1773
+ align: "fill",
1774
+ code: `<Input autoComplete="email" type="email" /> {/* autoComplete names the kind of answer */}`,
1775
+ children: /* @__PURE__ */ jsx(AddressForm, {})
1776
+ }), /* @__PURE__ */ jsxs(Note, { children: [
1777
+ "Give each field its autocomplete name (",
1778
+ /* @__PURE__ */ jsx("code", { children: "name" }),
1779
+ ", ",
1780
+ /* @__PURE__ */ jsx("code", { children: "email" }),
1781
+ ", ",
1782
+ /* @__PURE__ */ jsx("code", { children: "address-line1" }),
1783
+ ",",
1784
+ " ",
1785
+ /* @__PURE__ */ jsx("code", { children: "postal-code" }),
1786
+ ", ",
1787
+ /* @__PURE__ */ jsx("code", { children: "one-time-code" }),
1788
+ ", ",
1789
+ /* @__PURE__ */ jsx("code", { children: "new-password" }),
1790
+ ") so browsers and password managers know what to offer. It is also a WCAG requirement for fields that ask for the person's own details."
1791
+ ] })]
1792
+ }),
1793
+ /* @__PURE__ */ jsx(Section$1, {
1794
+ id: "both-themes",
1795
+ title: "In both themes",
1796
+ description: /* @__PURE__ */ jsx("p", { children: "A required field with a tick, an error, messages in three tones and a disabled field, light and dark side by side." }),
1797
+ children: /* @__PURE__ */ jsx(ThemePair, {
1798
+ align: "fill",
1799
+ children: /* @__PURE__ */ jsxs("div", {
1800
+ className: "input-stack",
1801
+ children: [
1802
+ /* @__PURE__ */ jsx(Field, {
1803
+ label: "Price",
1804
+ required: true,
1805
+ help: "Customers see this price at checkout.",
1806
+ hint: "Includes VAT at 20%",
1807
+ children: /* @__PURE__ */ jsx(Input, {
1808
+ prefix: "£",
1809
+ inputMode: "decimal",
1810
+ defaultValue: "249.00",
1811
+ status: "valid"
1812
+ })
1813
+ }),
1814
+ /* @__PURE__ */ jsx(Field, {
1815
+ label: "SKU",
1816
+ error: "Use letters, numbers and dashes only",
1817
+ children: /* @__PURE__ */ jsx(Input, {
1818
+ icon: /* @__PURE__ */ jsx(TagIcon, {}),
1819
+ defaultValue: "ARD CHR/BLK"
1820
+ })
1821
+ }),
1822
+ /* @__PURE__ */ jsx(Field, {
1823
+ label: "Email",
1824
+ optional: true,
1825
+ messages: [
1826
+ {
1827
+ tone: "warning",
1828
+ text: "This looks like a personal address"
1829
+ },
1830
+ {
1831
+ tone: "info",
1832
+ text: "Did you mean priya@harbourdesk.co.uk?"
1833
+ },
1834
+ {
1835
+ tone: "success",
1836
+ text: "We can send mail to this domain"
1837
+ }
1838
+ ],
1839
+ children: /* @__PURE__ */ jsx(Input, {
1840
+ type: "email",
1841
+ defaultValue: "priya@harbourdesk.co"
1842
+ })
1843
+ }),
1844
+ /* @__PURE__ */ jsx(Field, {
1845
+ label: "Sale price",
1846
+ hint: "Turn on Put on sale to set a sale price",
1847
+ children: /* @__PURE__ */ jsx(Input, {
1848
+ disabled: true,
1849
+ prefix: "£",
1850
+ placeholder: "0.00"
1851
+ })
1852
+ })
1853
+ ]
1854
+ })
1855
+ })
1856
+ }),
1857
+ /* @__PURE__ */ jsxs(Section$1, {
1858
+ id: "guidelines",
1859
+ title: "Guidelines",
1860
+ children: [
1861
+ /* @__PURE__ */ jsx(DoDont, {
1862
+ do: {
1863
+ children: /* @__PURE__ */ jsx("div", {
1864
+ style: {
1865
+ width: "100%",
1866
+ maxWidth: 260
1867
+ },
1868
+ children: /* @__PURE__ */ jsx(Field, {
1869
+ label: "Product title",
1870
+ children: /* @__PURE__ */ jsx(Input, { placeholder: "e.g. Arden ergonomic chair" })
1871
+ })
1872
+ }),
1873
+ caption: "A label that stays put, and a placeholder that only gives an example."
1874
+ },
1875
+ dont: {
1876
+ children: /* @__PURE__ */ jsx("div", {
1877
+ style: {
1878
+ width: "100%",
1879
+ maxWidth: 260
1880
+ },
1881
+ children: /* @__PURE__ */ jsx(Input, {
1882
+ "aria-label": "Product title",
1883
+ placeholder: "Product title"
1884
+ })
1885
+ }),
1886
+ caption: "A placeholder as the label vanishes as soon as someone types, and it is too faint to rely on."
1887
+ }
1888
+ }),
1889
+ /* @__PURE__ */ jsx(DoDont, {
1890
+ do: {
1891
+ children: /* @__PURE__ */ jsx("div", {
1892
+ style: {
1893
+ width: "100%",
1894
+ maxWidth: 260
1895
+ },
1896
+ children: /* @__PURE__ */ jsx(Field, {
1897
+ label: "Price",
1898
+ error: "Enter a price in pounds and pence, like 18.00",
1899
+ children: /* @__PURE__ */ jsx(Input, {
1900
+ prefix: "£",
1901
+ inputMode: "decimal",
1902
+ defaultValue: "18.0.0"
1903
+ })
1904
+ })
1905
+ }),
1906
+ caption: "Say what went wrong and how to put it right, in the words of the label."
1907
+ },
1908
+ dont: {
1909
+ children: /* @__PURE__ */ jsx("div", {
1910
+ style: {
1911
+ width: "100%",
1912
+ maxWidth: 260
1913
+ },
1914
+ children: /* @__PURE__ */ jsx(Field, {
1915
+ label: "Price",
1916
+ error: "Invalid input",
1917
+ children: /* @__PURE__ */ jsx(Input, {
1918
+ prefix: "£",
1919
+ inputMode: "decimal",
1920
+ defaultValue: "18.0.0"
1921
+ })
1922
+ })
1923
+ }),
1924
+ caption: "\"Invalid input\" tells people they failed without telling them what to do next."
1925
+ }
1926
+ }),
1927
+ /* @__PURE__ */ jsx(DoDont, {
1928
+ do: {
1929
+ children: /* @__PURE__ */ jsxs("div", {
1930
+ className: "input-stack",
1931
+ style: { maxWidth: 260 },
1932
+ children: [/* @__PURE__ */ jsx(Field, {
1933
+ label: "Name",
1934
+ required: true,
1935
+ children: /* @__PURE__ */ jsx(Input, {})
1936
+ }), /* @__PURE__ */ jsx(Field, {
1937
+ label: "Phone",
1938
+ optional: true,
1939
+ children: /* @__PURE__ */ jsx(Input, {})
1940
+ })]
1941
+ }),
1942
+ caption: "In a form where most fields are required, mark the few that are not."
1943
+ },
1944
+ dont: {
1945
+ children: /* @__PURE__ */ jsxs("div", {
1946
+ className: "input-stack",
1947
+ style: { maxWidth: 260 },
1948
+ children: [/* @__PURE__ */ jsx(Field, {
1949
+ label: "Name",
1950
+ required: true,
1951
+ children: /* @__PURE__ */ jsx(Input, {})
1952
+ }), /* @__PURE__ */ jsx(Field, {
1953
+ label: "Phone (optional)",
1954
+ required: true,
1955
+ children: /* @__PURE__ */ jsx(Input, {})
1956
+ })]
1957
+ }),
1958
+ caption: "A star and \"optional\" on one form, or both on one field, leave people unsure which to believe."
1959
+ }
1960
+ }),
1961
+ /* @__PURE__ */ jsx(Guidelines, { items: [
1962
+ "Size the field to the answer: a postcode field is short, a product title long.",
1963
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1964
+ "Units go in ",
1965
+ /* @__PURE__ */ jsx("code", { children: "prefix" }),
1966
+ " or ",
1967
+ /* @__PURE__ */ jsx("code", { children: "suffix" }),
1968
+ ", not the label: \"Price\" with £, not \"Price (£)\"."
1969
+ ] }),
1970
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1971
+ "For money and weights use ",
1972
+ /* @__PURE__ */ jsx("code", { children: "inputMode=\"decimal\"" }),
1973
+ " rather than ",
1974
+ /* @__PURE__ */ jsx("code", { children: "type=\"number\"" }),
1975
+ ": phones show a number pad, without the spinner arrows or scroll-wheel surprises."
1976
+ ] }),
1977
+ "Labels are nouns in sentence case. Hints are one short sentence, and never repeat the label.",
1978
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1979
+ "Mark required ",
1980
+ /* @__PURE__ */ jsx("em", { children: "or" }),
1981
+ " optional, whichever is rarer on the form. Never both on the form, and never put \"(optional)\" in the label text: use ",
1982
+ /* @__PURE__ */ jsx("code", { children: "optional" }),
1983
+ "."
1984
+ ] }),
1985
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1986
+ "A message says what was found, in a sentence, and what to do about it if there is something to do. Use",
1987
+ " ",
1988
+ /* @__PURE__ */ jsx("code", { children: "error" }),
1989
+ " only for what blocks the form, not for advice."
1990
+ ] }),
1991
+ /* @__PURE__ */ jsx(Fragment$1, { children: "Check a value after the person stops typing, or on blur, never on each key press. Show the tick or the cross only once a check has finished." })
1992
+ ] })
1993
+ ]
1994
+ }),
1995
+ /* @__PURE__ */ jsx(Section$1, {
1996
+ id: "accessibility",
1997
+ title: "Accessibility",
1998
+ children: /* @__PURE__ */ jsx(Guidelines, { items: [
1999
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
2000
+ "Field renders a real ",
2001
+ /* @__PURE__ */ jsx("code", { children: "label" }),
2002
+ " pointing at the control's id (generated when you do not pass one), so screen readers read it as the name and clicking it focuses the control."
2003
+ ] }),
2004
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
2005
+ "The description, the hint or error, and any messages are linked with ",
2006
+ /* @__PURE__ */ jsx("code", { children: "aria-describedby" }),
2007
+ ", in that order, alongside any of your own. An error also sets ",
2008
+ /* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
2009
+ ". The marks' icons are hidden; the words carry the message."
2010
+ ] }),
2011
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
2012
+ "The required star is hidden from assistive tech. The requirement is in ",
2013
+ /* @__PURE__ */ jsx("code", { children: "aria-required" }),
2014
+ " on the control, or the native ",
2015
+ /* @__PURE__ */ jsx("code", { children: "required" }),
2016
+ " if you set it (it never sets both). \"Optional\" and the aside are outside the label, so the name stays the plain words."
2017
+ ] }),
2018
+ /* @__PURE__ */ jsx(Fragment$1, { children: "The help button is a real button named \"Learn more about this field\" plus the field's label. The popover opens on a press or Enter, is a dialog named by the same words, closes on Escape and puts focus back on the button. Its links and buttons are reached with Tab." }),
2019
+ /* @__PURE__ */ jsx(Fragment$1, { children: "Errors and hints are not announced as they appear. After a failed submit, move focus to the first field with a problem, and it is read with its error. Messages are different: the list is a polite live region, so the result of a check is heard when it lands." }),
2020
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
2021
+ "A check's status is conveyed beyond colour and shape: the mark's hidden text (\"Checking\", \"Valid\", \"Not valid\") is part of the control's description, and a failed check sets ",
2022
+ /* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
2023
+ ". The control is not marked ",
2024
+ /* @__PURE__ */ jsx("code", { children: "aria-busy" }),
2025
+ " while it runs: it is the field the person is typing in, and some screen readers hold back what changes in a busy element. The result is heard through the Field's messages."
2026
+ ] }),
2027
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
2028
+ "Without a Field, give the Input an ",
2029
+ /* @__PURE__ */ jsx("code", { children: "aria-label" }),
2030
+ " or ",
2031
+ /* @__PURE__ */ jsx("code", { children: "aria-labelledby" }),
2032
+ "."
2033
+ ] }),
2034
+ "Focus shows as a teal edge with a soft halo round the whole frame, not an outline on the text.",
2035
+ "Message words hold at least 5.1:1 on any surface in light and 6.9:1 in dark (warning, success and info hold 6.3:1 or more in light); the marks hold at least 4.6:1.",
2036
+ "Numerals in the field are tabular, so amounts line up as they are typed.",
2037
+ "Under reduced motion the error and messages fade in without the 3px drop, and a tick or cross fades in without the pop."
2038
+ ] })
2039
+ }),
2040
+ /* @__PURE__ */ jsxs(Section$1, {
2041
+ id: "props",
2042
+ title: "Props",
2043
+ children: [
2044
+ /* @__PURE__ */ jsx(PropsTable, {
2045
+ title: "Input",
2046
+ rows: [
2047
+ {
2048
+ name: "size",
2049
+ type: "'sm' | 'md' | 'lg'",
2050
+ default: "'md'",
2051
+ description: "Height from the control scale: 30, 36 or 44px, the same as buttons."
2052
+ },
2053
+ {
2054
+ name: "icon",
2055
+ type: "ReactNode",
2056
+ description: "Leading icon. Muted, it wakes up while the field has focus."
2057
+ },
2058
+ {
2059
+ name: "prefix",
2060
+ type: "ReactNode",
2061
+ description: "Leading text set tight against the value, such as £ or https://."
2062
+ },
2063
+ {
2064
+ name: "suffix",
2065
+ type: "ReactNode",
2066
+ description: "Trailing unit or small button."
2067
+ },
2068
+ {
2069
+ name: "status",
2070
+ type: "'idle' | 'checking' | 'valid' | 'invalid'",
2071
+ default: "'idle'",
2072
+ description: "The result of a check, drawn at the end of the field after any suffix. invalid also sets aria-invalid."
2073
+ },
2074
+ {
2075
+ name: "statusLabel",
2076
+ type: "string",
2077
+ description: "Replaces the status mark's hidden text: \"Checking\", \"Valid\" or \"Not valid\"."
2078
+ },
2079
+ {
2080
+ name: "showCount",
2081
+ type: "boolean",
2082
+ default: "false",
2083
+ description: "A character count at the end of the field, out of maxLength when set."
2084
+ },
2085
+ {
2086
+ name: "countLabel",
2087
+ type: "(length, maxLength) => string",
2088
+ description: "Words screen readers hear for a count against maxLength. Defaults to \"12 characters left\"."
2089
+ },
2090
+ {
2091
+ name: "recommendedLength",
2092
+ type: "number",
2093
+ description: "A soft limit: the count runs against it, typing goes past it, and past it the field reads as invalid."
2094
+ },
2095
+ {
2096
+ name: "recommendedLabel",
2097
+ type: "(length, recommended) => string",
2098
+ description: "Words for a count against recommendedLength. Defaults to \"42 of 70 characters used\"."
2099
+ },
2100
+ {
2101
+ name: "addonStart",
2102
+ type: "ReactNode",
2103
+ description: "A cell joined to the start of the frame, outside it: text such as https://, or a small control. Text is read as part of the description."
2104
+ },
2105
+ {
2106
+ name: "addonEnd",
2107
+ type: "ReactNode",
2108
+ description: "A cell joined to the end of the frame: .myorbitcommerce.net, @harbourdesk.co.uk, a unit Select, an Upload button."
2109
+ },
2110
+ {
2111
+ name: "invalid",
2112
+ type: "boolean",
2113
+ description: "Red edge and aria-invalid. Inside a Field, follows the Field's error unless set."
2114
+ },
2115
+ {
2116
+ name: "readOnly",
2117
+ type: "boolean",
2118
+ description: "Sinks into the well; still focusable and copyable."
2119
+ },
2120
+ {
2121
+ name: "disabled",
2122
+ type: "boolean",
2123
+ description: "Sinks into the well and dims; skipped by Tab."
2124
+ }
2125
+ ]
2126
+ }),
2127
+ /* @__PURE__ */ jsxs("p", {
2128
+ className: "doc-section__description",
2129
+ children: [
2130
+ "Every other native input attribute, and the ",
2131
+ /* @__PURE__ */ jsx("code", { children: "ref" }),
2132
+ ", go to the ",
2133
+ /* @__PURE__ */ jsx("code", { children: "input" }),
2134
+ ".",
2135
+ " ",
2136
+ /* @__PURE__ */ jsx("code", { children: "className" }),
2137
+ " and ",
2138
+ /* @__PURE__ */ jsx("code", { children: "style" }),
2139
+ " go to the frame around it, or to the group round the frame and its cells when there is an addon."
2140
+ ]
2141
+ }),
2142
+ /* @__PURE__ */ jsx(PropsTable, {
2143
+ title: "Field",
2144
+ rows: [
2145
+ {
2146
+ name: "label",
2147
+ type: "ReactNode",
2148
+ required: true,
2149
+ description: "The visible label above the control."
2150
+ },
2151
+ {
2152
+ name: "hideLabel",
2153
+ type: "boolean",
2154
+ default: "false",
2155
+ description: "Keeps the label for assistive tech and takes it out of view."
2156
+ },
2157
+ {
2158
+ name: "required",
2159
+ type: "boolean",
2160
+ default: "false",
2161
+ description: "A red star after the label, and aria-required on the control. Does not turn on browser validation."
2162
+ },
2163
+ {
2164
+ name: "optional",
2165
+ type: "boolean | string",
2166
+ description: "A quiet \"Optional\" after the label, or your own words. Ignored when required."
2167
+ },
2168
+ {
2169
+ name: "help",
2170
+ type: "ReactNode",
2171
+ description: "Explanation for an (i) button beside the label, opened in a popover."
2172
+ },
2173
+ {
2174
+ name: "helpLabel",
2175
+ type: "string",
2176
+ default: "'Learn more about this field'",
2177
+ description: "Accessible name of the (i) button, read together with the field's label."
2178
+ },
2179
+ {
2180
+ name: "helpActions",
2181
+ type: "ReactNode",
2182
+ description: "A footer for the help popover: links or buttons."
2183
+ },
2184
+ {
2185
+ name: "labelAside",
2186
+ type: "ReactNode",
2187
+ description: "Sits at the far end of the label row, outside the label."
2188
+ },
2189
+ {
2190
+ name: "description",
2191
+ type: "ReactNode",
2192
+ description: "What the field is for, between the label and the control. Linked to the control."
2193
+ },
2194
+ {
2195
+ name: "hint",
2196
+ type: "ReactNode",
2197
+ description: "Help below the control. Hidden while there is an error."
2198
+ },
2199
+ {
2200
+ name: "messageTone",
2201
+ type: "'default' | 'success' | 'warning' | 'info'",
2202
+ default: "'default'",
2203
+ description: "Gives the hint a tone, with a matching mark."
2204
+ },
2205
+ {
2206
+ name: "error",
2207
+ type: "ReactNode",
2208
+ description: "What is wrong and how to fix it. Replaces the hint and marks the control invalid."
2209
+ },
2210
+ {
2211
+ name: "messages",
2212
+ type: "FieldMessage[]",
2213
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
2214
+ "Feedback lines: ",
2215
+ /* @__PURE__ */ jsx("code", { children: "{ tone: 'error' | 'warning' | 'success' | 'info'; text: ReactNode }" }),
2216
+ ". A live region; pass ",
2217
+ /* @__PURE__ */ jsx("code", { children: "[]" }),
2218
+ ", not undefined, while there is nothing to say yet. An error-tone message marks the control invalid."
2219
+ ] })
2220
+ },
2221
+ {
2222
+ name: "id",
2223
+ type: "string",
2224
+ description: "Id for the control inside. Generated when omitted."
2225
+ },
2226
+ {
2227
+ name: "orientation",
2228
+ type: "'stacked' | 'inline'",
2229
+ default: "'stacked'",
2230
+ description: "inline: the label at the start of one row, the control at the end in its other half. Never stacks."
2231
+ },
2232
+ {
2233
+ name: "size",
2234
+ type: "'sm' | 'md'",
2235
+ default: "'md'",
2236
+ description: "sm for dense inspectors: 12px words, a tighter gap, and sm controls inside unless they set their own."
2237
+ },
2238
+ {
2239
+ name: "children",
2240
+ type: "ReactNode",
2241
+ required: true,
2242
+ description: "One control: Input, SearchField, Select, Textarea, RadioGroup, or anything reading useFieldControl()."
2243
+ }
2244
+ ]
2245
+ }),
2246
+ /* @__PURE__ */ jsx("p", {
2247
+ className: "doc-section__description",
2248
+ children: "Other attributes go to the Field's outer element, which carries data-invalid and data-required."
2249
+ }),
2250
+ /* @__PURE__ */ jsx(PropsTable, {
2251
+ title: "FieldHelp",
2252
+ rows: [
2253
+ {
2254
+ name: "content",
2255
+ type: "ReactNode",
2256
+ required: true,
2257
+ description: "The explanation, in a sentence or two."
2258
+ },
2259
+ {
2260
+ name: "actions",
2261
+ type: "ReactNode",
2262
+ description: "A footer under a hairline for links and buttons. Wrap a button in PopoverClose asChild to close the popover with it."
2263
+ },
2264
+ {
2265
+ name: "label",
2266
+ type: "string",
2267
+ default: "'Learn more about this field'",
2268
+ description: "Accessible name. Inside a Field it is read with the field's label."
2269
+ },
2270
+ {
2271
+ name: "icon",
2272
+ type: "ReactNode",
2273
+ description: "Replaces the (i) glyph, e.g. with your own icon set. An svg."
2274
+ },
2275
+ {
2276
+ name: "size",
2277
+ type: "'sm' | 'md'",
2278
+ default: "'md'",
2279
+ description: "The icon: 14px or 16px."
2280
+ },
2281
+ {
2282
+ name: "side",
2283
+ type: "'top' | 'right' | 'bottom' | 'left'",
2284
+ default: "'bottom'",
2285
+ description: "Which side of the button the popover opens on."
2286
+ },
2287
+ {
2288
+ name: "align",
2289
+ type: "'start' | 'center' | 'end'",
2290
+ default: "'start'",
2291
+ description: "Where along that side it lines up."
2292
+ },
2293
+ {
2294
+ name: "maxWidth",
2295
+ type: "number",
2296
+ default: "340",
2297
+ description: "The widest the popover grows, in px."
2298
+ }
2299
+ ]
2300
+ }),
2301
+ /* @__PURE__ */ jsx(PropsTable, {
2302
+ title: "FieldHelpProvider",
2303
+ rows: [{
2304
+ name: "enabled",
2305
+ type: "boolean",
2306
+ default: "true",
2307
+ description: "false hides every FieldHelp and Field help inside, for an app with a \"Show help tips\" setting."
2308
+ }]
2309
+ }),
2310
+ /* @__PURE__ */ jsx(DocTable, {
2311
+ columns: [
2312
+ "useFieldControl() returns",
2313
+ "Type",
2314
+ "Put it on"
2315
+ ],
2316
+ rows: [
2317
+ [
2318
+ /* @__PURE__ */ jsx("code", { children: "id" }, "1"),
2319
+ /* @__PURE__ */ jsx("code", { children: "string" }, "2"),
2320
+ "The focusable element, so the label points at it."
2321
+ ],
2322
+ [
2323
+ /* @__PURE__ */ jsx("code", { children: "labelId" }, "3"),
2324
+ /* @__PURE__ */ jsx("code", { children: "string" }, "4"),
2325
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
2326
+ "Its ",
2327
+ /* @__PURE__ */ jsx("code", { children: "aria-labelledby" }),
2328
+ ", when a label element cannot name it (a div with a role)."
2329
+ ] })
2330
+ ],
2331
+ [
2332
+ /* @__PURE__ */ jsx("code", { children: "describedBy" }, "5"),
2333
+ /* @__PURE__ */ jsx("code", { children: "string | undefined" }, "6"),
2334
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
2335
+ "Its ",
2336
+ /* @__PURE__ */ jsx("code", { children: "aria-describedby" }),
2337
+ ": the ids of the description, the hint or error, and the messages."
2338
+ ] })
2339
+ ],
2340
+ [
2341
+ /* @__PURE__ */ jsx("code", { children: "invalid" }, "7"),
2342
+ /* @__PURE__ */ jsx("code", { children: "boolean" }, "8"),
2343
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
2344
+ "Its ",
2345
+ /* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
2346
+ ", and your own error styling."
2347
+ ] })
2348
+ ],
2349
+ [
2350
+ /* @__PURE__ */ jsx("code", { children: "required" }, "9"),
2351
+ /* @__PURE__ */ jsx("code", { children: "boolean | undefined" }, "10"),
2352
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
2353
+ "Its ",
2354
+ /* @__PURE__ */ jsx("code", { children: "aria-required" }),
2355
+ ", when the element can take it."
2356
+ ] })
2357
+ ],
2358
+ [
2359
+ /* @__PURE__ */ jsx("code", { children: "size" }, "11"),
2360
+ /* @__PURE__ */ jsx("code", { children: "'sm' | 'md' | undefined" }, "12"),
2361
+ /* @__PURE__ */ jsx(Fragment$1, { children: "The Field's size when it set one: take it as the control's default size." })
2362
+ ]
2363
+ ]
2364
+ })
2365
+ ]
2366
+ }),
2367
+ /* @__PURE__ */ jsx(Fragment$1, {})
2368
+ ]
2369
+ });
2370
+ }
2371
+ //#endregion
2372
+ export { Page, Preview };