@orbitcommerce/constellation-docs 0.0.0-stage → 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 (232) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +6 -2
  3. package/dist/docs.css +20787 -0
  4. package/dist/index.d.ts +33 -0
  5. package/dist/index.js +308 -0
  6. package/dist/pages/Playground-Mk1yIWXb.js +129 -0
  7. package/dist/pages/_address-data-L9BR499w.js +161 -0
  8. package/dist/pages/_builder-demo-C0eJUmPU.js +282 -0
  9. package/dist/pages/_card-art-0be5ncyV.js +18 -0
  10. package/dist/pages/_conversation-samples-Bq7cn-4d.js +70 -0
  11. package/dist/pages/_figures-data-DaDvB7Nm.js +606 -0
  12. package/dist/pages/_foundations-blXWyYh8.js +30 -0
  13. package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
  14. package/dist/pages/_overlays-specimens-bawR331Z.js +320 -0
  15. package/dist/pages/_preview-specimens-DKQC9HAo.js +153 -0
  16. package/dist/pages/accordion-Sg0TUqxB.js +1036 -0
  17. package/dist/pages/address-autocomplete-DP0PUOlK.js +360 -0
  18. package/dist/pages/address-block-BZOOOPA9.js +368 -0
  19. package/dist/pages/address-fields-CwSqro3W.js +277 -0
  20. package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
  21. package/dist/pages/alert-D3i7xZTU.js +914 -0
  22. package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
  23. package/dist/pages/app-shell-D4hdlHps.js +1558 -0
  24. package/dist/pages/area-chart-BEWFwiB2.js +718 -0
  25. package/dist/pages/avatar-BFEqQViw.js +895 -0
  26. package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
  27. package/dist/pages/badge-0-PyMrih.js +1035 -0
  28. package/dist/pages/bar-chart-DkLogYlt.js +1060 -0
  29. package/dist/pages/bar-fold-B-3XeIDZ.js +360 -0
  30. package/dist/pages/board-card-D2tZY_mU.js +415 -0
  31. package/dist/pages/brand-mark-BqiLvFSR.js +417 -0
  32. package/dist/pages/button-DAyfssDY.js +715 -0
  33. package/dist/pages/calendar-Ds7KsgSI.js +682 -0
  34. package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
  35. package/dist/pages/card-CQEM1_wc.js +1567 -0
  36. package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
  37. package/dist/pages/chart-legend-B20AbakD.js +724 -0
  38. package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
  39. package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
  40. package/dist/pages/checklist-card-DEyykVFS.js +783 -0
  41. package/dist/pages/chip-Ck-o3Ui6.js +839 -0
  42. package/dist/pages/chip-list-k1LxXuCi.js +414 -0
  43. package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
  44. package/dist/pages/coachmark-Be2ghobT.js +366 -0
  45. package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
  46. package/dist/pages/collab-field-CfqqK7d2.js +696 -0
  47. package/dist/pages/color-field-CZpfcA-A.js +1127 -0
  48. package/dist/pages/colour-q2ntvI0w.js +1974 -0
  49. package/dist/pages/column-mapper-TsTG39cl.js +502 -0
  50. package/dist/pages/combobox-DvK2j5tI.js +1334 -0
  51. package/dist/pages/command-palette-CJ7uBA04.js +1386 -0
  52. package/dist/pages/comment-box-CDSGYhr5.js +346 -0
  53. package/dist/pages/composer-D4B0NgpA.js +689 -0
  54. package/dist/pages/condition-builder-BZy2ZGXe.js +715 -0
  55. package/dist/pages/conflict-chooser-C--_9UIS.js +210 -0
  56. package/dist/pages/context-menu-F9DV30ia.js +487 -0
  57. package/dist/pages/copy-button-Cn7WiKRF.js +568 -0
  58. package/dist/pages/copy-field-D3Xt3Jq6.js +511 -0
  59. package/dist/pages/danger-zone-Db_UUeiP.js +564 -0
  60. package/dist/pages/date-input-GOW067EB.js +956 -0
  61. package/dist/pages/date-picker-GdBciR99.js +1569 -0
  62. package/dist/pages/date-time-BLKCXtVZ.js +678 -0
  63. package/dist/pages/delta-CNAGv8JY.js +779 -0
  64. package/dist/pages/description-list-BPeXn1eW.js +1268 -0
  65. package/dist/pages/device-switcher-BCaN99c1.js +554 -0
  66. package/dist/pages/dialog-CRpkRC98.js +3164 -0
  67. package/dist/pages/docs-lM2UBSir.js +520 -0
  68. package/dist/pages/doodle-nzkqi2UI.js +201 -0
  69. package/dist/pages/drag-ghost-B6kpzC3O.js +426 -0
  70. package/dist/pages/drill-menu-cskH5mol.js +490 -0
  71. package/dist/pages/dropzone-DOY_Rhw0.js +1069 -0
  72. package/dist/pages/element-toolbar-DZIhXlCJ.js +498 -0
  73. package/dist/pages/emoji-picker-CqaWaffD.js +235 -0
  74. package/dist/pages/empty-state-4U2txFpI.js +1113 -0
  75. package/dist/pages/facet-filters-McbBeY9e.js +353 -0
  76. package/dist/pages/figure-D-HF5vCj.js +563 -0
  77. package/dist/pages/figure-strip-BB3mNl7D.js +1364 -0
  78. package/dist/pages/figure-tabs-QOeQMY6N.js +578 -0
  79. package/dist/pages/file-chip-DMDjtlqQ.js +738 -0
  80. package/dist/pages/filter-pill-DzqNOsD4.js +1295 -0
  81. package/dist/pages/font-picker-Bqhu0QMh.js +416 -0
  82. package/dist/pages/form-grid-BfWCVlie.js +692 -0
  83. package/dist/pages/gallery-BBk2EOri.js +453 -0
  84. package/dist/pages/gif-picker-CnoDTCaL.js +270 -0
  85. package/dist/pages/gradient-editor-Bqxp7Fxj.js +378 -0
  86. package/dist/pages/grouped-checklist-gNZ0tBKU.js +477 -0
  87. package/dist/pages/heatmap-BohgIcNk.js +507 -0
  88. package/dist/pages/highlight-text-BfxzfmvS.js +287 -0
  89. package/dist/pages/home-dashboard-CxPmvduE.js +962 -0
  90. package/dist/pages/host-B6znjEgQ.js +109 -0
  91. package/dist/pages/hosted-embed-Jef3aIMP.js +163 -0
  92. package/dist/pages/hosted-field-BLh-53AE.js +208 -0
  93. package/dist/pages/hosted-field-DEpI4lVS.js +514 -0
  94. package/dist/pages/icon-button-Bu4Gj5sy.js +1200 -0
  95. package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
  96. package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
  97. package/dist/pages/icons-CJ9Aar3d.js +736 -0
  98. package/dist/pages/image-cropper-NyougqLH.js +466 -0
  99. package/dist/pages/image-field-7knBv4mJ.js +567 -0
  100. package/dist/pages/import-result-CmTtGXW_.js +486 -0
  101. package/dist/pages/inline-confirm-CEcI5Lxo.js +327 -0
  102. package/dist/pages/inline-edit-Ba39SzhM.js +1125 -0
  103. package/dist/pages/input-CzLCzfyx.js +2372 -0
  104. package/dist/pages/installation-C3UcpQJT.js +528 -0
  105. package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
  106. package/dist/pages/kanban-Dy9sPAI0.js +740 -0
  107. package/dist/pages/kbd-UNj4zqxn.js +545 -0
  108. package/dist/pages/layout-primitives-CPRaZeyt.js +483 -0
  109. package/dist/pages/line-chart-CntWxeMF.js +1117 -0
  110. package/dist/pages/link-CXqvAg9z.js +689 -0
  111. package/dist/pages/link-picker-BMFGCC67.js +478 -0
  112. package/dist/pages/link-row-x8yaUuWc.js +595 -0
  113. package/dist/pages/live-globe-95ROMhGQ.js +715 -0
  114. package/dist/pages/loading-overlay-BeGuXM9G.js +456 -0
  115. package/dist/pages/loading-state-BNbCo51C.js +556 -0
  116. package/dist/pages/log-viewer-BQz8I_a2.js +503 -0
  117. package/dist/pages/logo-B38rnzoq.js +571 -0
  118. package/dist/pages/lottie_light-CxEH8eiR.js +9116 -0
  119. package/dist/pages/markdown-Ied72vMT.js +237 -0
  120. package/dist/pages/markdown-field-BfnIEKZH.js +193 -0
  121. package/dist/pages/media-banner-DkStCia0.js +233 -0
  122. package/dist/pages/menu-NrLYKqKp.js +2132 -0
  123. package/dist/pages/message-thread-Bo4zbxqu.js +731 -0
  124. package/dist/pages/meta-line-D5p2TycR.js +371 -0
  125. package/dist/pages/model-viewer-BfokvHoc.js +60288 -0
  126. package/dist/pages/model-viewer-C8PFO8wk.js +577 -0
  127. package/dist/pages/month-calendar-T1vw9Rup.js +457 -0
  128. package/dist/pages/motion-CrXtiBvA.js +865 -0
  129. package/dist/pages/number-input-CuyMZg18.js +968 -0
  130. package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
  131. package/dist/pages/orbit-spinner-Dxv5qAhr.js +348 -0
  132. package/dist/pages/otp-input-CVRoX1mw.js +591 -0
  133. package/dist/pages/overview-LA9XRhZc.js +130 -0
  134. package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
  135. package/dist/pages/pagination-C1EgVtW4.js +294 -0
  136. package/dist/pages/palette-tile-X9ZXu2Z0.js +414 -0
  137. package/dist/pages/password-field-DHEQKyUC.js +912 -0
  138. package/dist/pages/person-cell-BmjbADBz.js +564 -0
  139. package/dist/pages/phone-input-B3G7Qpb2.js +747 -0
  140. package/dist/pages/plan-card-DRaA6RuB.js +621 -0
  141. package/dist/pages/plan-card-DtloWvMh.js +258 -0
  142. package/dist/pages/plan-comparison-BVIGTtbd.js +559 -0
  143. package/dist/pages/plan-grid-cfPVTB5V.js +251 -0
  144. package/dist/pages/point-list-BbPmZjsm.js +222 -0
  145. package/dist/pages/popover-C3Oar9D5.js +1198 -0
  146. package/dist/pages/presence-avatars-CRZIk8n9.js +328 -0
  147. package/dist/pages/preview-frame-Bcwk0y_Q.js +1631 -0
  148. package/dist/pages/price-CRBLoa9h.js +604 -0
  149. package/dist/pages/principles-pnDyfHpK.js +483 -0
  150. package/dist/pages/print-page-BkLv6bW8.js +513 -0
  151. package/dist/pages/profile-hero-CC9dUzuN.js +498 -0
  152. package/dist/pages/progress-CP_awmo4.js +904 -0
  153. package/dist/pages/progress-ring-JuOAwk2T.js +576 -0
  154. package/dist/pages/radio-group-C-4tg6FS.js +1639 -0
  155. package/dist/pages/radius-control-B2kRA2Ch.js +441 -0
  156. package/dist/pages/rating-CweKN2SX.js +471 -0
  157. package/dist/pages/record-layout-DUP_X0RL.js +719 -0
  158. package/dist/pages/record-pager-y9D7JFgb.js +278 -0
  159. package/dist/pages/registry-BZg-xAbi.js +594 -0
  160. package/dist/pages/release-Cs6tl16C.js +16 -0
  161. package/dist/pages/repeater-BRZYKRQa.js +1351 -0
  162. package/dist/pages/reply-feedback-BDnHprla.js +192 -0
  163. package/dist/pages/reveal-BygENBbL.js +460 -0
  164. package/dist/pages/rich-text-DOFQZEpT.js +156 -0
  165. package/dist/pages/rich-text-editor-BhIM20JI.js +1265 -0
  166. package/dist/pages/rolldown-runtime-CbKu08Hx.js +25 -0
  167. package/dist/pages/rolling-number-GR3Cyfpz.js +529 -0
  168. package/dist/pages/row-list-Dl6CYhC-.js +1565 -0
  169. package/dist/pages/rule-list-DTCmIMpT.js +648 -0
  170. package/dist/pages/save-status-B5KkyMZP.js +378 -0
  171. package/dist/pages/schedule-YycI95O1.js +243 -0
  172. package/dist/pages/scroll-area-B2sGm23Q.js +423 -0
  173. package/dist/pages/search-field-D1uG7R6A.js +693 -0
  174. package/dist/pages/search-menu-DMuXyUUW.js +580 -0
  175. package/dist/pages/secret-field-Dj9x3LL8.js +337 -0
  176. package/dist/pages/section-rail-BtTCETS5.js +637 -0
  177. package/dist/pages/section-v2Pubup9.js +639 -0
  178. package/dist/pages/segmented-control-D-FB1K1T.js +1190 -0
  179. package/dist/pages/select-DZ43NpOm.js +1434 -0
  180. package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
  181. package/dist/pages/separator-CFwqRvfO.js +428 -0
  182. package/dist/pages/serp-preview-BGwORjmo.js +346 -0
  183. package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
  184. package/dist/pages/shape-DzniHAVT.js +627 -0
  185. package/dist/pages/share-list-D4wgBxKN.js +926 -0
  186. package/dist/pages/side-panel-CCtkrZjs.js +811 -0
  187. package/dist/pages/site-preview-Dj1hM2Yo.js +353 -0
  188. package/dist/pages/skeleton-C1F5HkAu.js +1325 -0
  189. package/dist/pages/skip-link-BxznhSkz.js +252 -0
  190. package/dist/pages/slider-CAoPURKD.js +774 -0
  191. package/dist/pages/sortable-card-Sr44uCpI.js +424 -0
  192. package/dist/pages/sortable-list-DUAleYE1.js +1298 -0
  193. package/dist/pages/sortable-tree-BLzK-hTE.js +737 -0
  194. package/dist/pages/spacing-box-CtuvzxQu.js +550 -0
  195. package/dist/pages/sparkline-D3aavCly.js +947 -0
  196. package/dist/pages/split-bar-DYgZnFID.js +414 -0
  197. package/dist/pages/split-button-Be08-VI-.js +335 -0
  198. package/dist/pages/split-pane-lSNZgTKt.js +523 -0
  199. package/dist/pages/status-badge-DOdNhmzn.js +1074 -0
  200. package/dist/pages/status-checklist-CWkjCZIC.js +1152 -0
  201. package/dist/pages/status-dot-D99gAGsV.js +567 -0
  202. package/dist/pages/stepper-CxKTbEA-.js +1093 -0
  203. package/dist/pages/success-mark-CqFTOBEu.js +142 -0
  204. package/dist/pages/swatch-H_kNvHuC.js +565 -0
  205. package/dist/pages/switch-C93K6j9h.js +617 -0
  206. package/dist/pages/table-CL0vomno.js +3225 -0
  207. package/dist/pages/tabs-Dh0mUsLw.js +1690 -0
  208. package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
  209. package/dist/pages/task-card-Dv0sR1-w.js +295 -0
  210. package/dist/pages/textarea-CCM-SnGN.js +949 -0
  211. package/dist/pages/thumbnail-DwFJL_k1.js +1147 -0
  212. package/dist/pages/time-input-CA9-uZAa.js +442 -0
  213. package/dist/pages/time-zone-select-CEtMXVYO.js +296 -0
  214. package/dist/pages/timeline-BsMUTlpR.js +1798 -0
  215. package/dist/pages/toast-zXLRiMRT.js +1391 -0
  216. package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
  217. package/dist/pages/toolbar-B9l_fHKy.js +754 -0
  218. package/dist/pages/tooltip-LHtCUkF-.js +826 -0
  219. package/dist/pages/translation-field-CTRXiF2N.js +251 -0
  220. package/dist/pages/tree-checklist-CJj3OcLg.js +451 -0
  221. package/dist/pages/tree-select-DU1qXHy_.js +492 -0
  222. package/dist/pages/tree-view-g_RjLtAb.js +739 -0
  223. package/dist/pages/typography-BSijtiRl.js +876 -0
  224. package/dist/pages/unit-input-Dml4fjmK.js +659 -0
  225. package/dist/pages/upload-rules-yozEzSah.js +419 -0
  226. package/dist/pages/url-upload-input-SSnMgfpA.js +307 -0
  227. package/dist/pages/value-change-CnubDKyO.js +489 -0
  228. package/dist/pages/weekly-hours-i2EpsmTx.js +287 -0
  229. package/dist/pages/widget-preview-CUJMyZ_k.js +625 -0
  230. package/dist/pages/working-status-CENemSsw.js +389 -0
  231. package/manifest.json +13001 -0
  232. package/package.json +35 -4
@@ -0,0 +1,1639 @@
1
+ "use client";
2
+ import { t as DocLink } from "./host-B6znjEgQ.js";
3
+ import { a as DocTable, d as Section$1, i as DocPage, l as Note, m as ThemePair, o as Example, p as SubSection, r as DoDont, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
4
+ import { t as Playground } from "./Playground-Mk1yIWXb.js";
5
+ import { useState } from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ import { Badge, Button, ConfirmDialog, Field, Input, RadioCardSummary, RadioGroup, RadioGroupItem } from "@orbitcommerce/constellation";
8
+ import { CheckCircleIcon, CubeIcon, DownloadSimpleIcon, GiftIcon, PackageIcon, StackIcon } from "@orbitcommerce/constellation/icons";
9
+ //#region src/pages/components/_choice-card-examples.tsx
10
+ function ProductType() {
11
+ const [type, setType] = useState("physical");
12
+ return /* @__PURE__ */ jsx("div", {
13
+ className: "radio-stack",
14
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
15
+ "aria-label": "Product type",
16
+ variant: "card",
17
+ columns: 2,
18
+ value: type,
19
+ onValueChange: setType,
20
+ children: [
21
+ /* @__PURE__ */ jsx(RadioGroupItem, {
22
+ value: "physical",
23
+ label: "Physical product",
24
+ description: "Shipped or collected. Stock is counted.",
25
+ icon: /* @__PURE__ */ jsx(PackageIcon, {})
26
+ }),
27
+ /* @__PURE__ */ jsx(RadioGroupItem, {
28
+ value: "digital",
29
+ label: "Digital product",
30
+ description: "A download sent after payment.",
31
+ icon: /* @__PURE__ */ jsx(DownloadSimpleIcon, {})
32
+ }),
33
+ /* @__PURE__ */ jsx(RadioGroupItem, {
34
+ value: "bundle",
35
+ label: "Bundle",
36
+ description: "Several products sold as one.",
37
+ icon: /* @__PURE__ */ jsx(StackIcon, {}),
38
+ badge: /* @__PURE__ */ jsx(Badge, {
39
+ size: "sm",
40
+ tone: "accent",
41
+ children: "New"
42
+ })
43
+ }),
44
+ /* @__PURE__ */ jsx(RadioGroupItem, {
45
+ value: "gift-card",
46
+ label: "Gift card",
47
+ description: "A balance to spend in your shop.",
48
+ icon: /* @__PURE__ */ jsx(GiftIcon, {})
49
+ })
50
+ ]
51
+ })
52
+ });
53
+ }
54
+ function Sketch({ kind }) {
55
+ const block = (x, y, w, h, tone = "fill") => /* @__PURE__ */ jsx("rect", {
56
+ x,
57
+ y,
58
+ width: w,
59
+ height: h,
60
+ rx: 3,
61
+ className: tone === "ink" ? "radio-sketch__ink" : "radio-sketch__fill"
62
+ });
63
+ return /* @__PURE__ */ jsx("svg", {
64
+ viewBox: "0 0 160 96",
65
+ className: "radio-sketch",
66
+ role: "presentation",
67
+ children: kind === "gallery" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
68
+ block(10, 10, 84, 76),
69
+ block(102, 12, 48, 6, "ink"),
70
+ block(102, 24, 34, 4),
71
+ block(102, 34, 40, 4),
72
+ block(102, 70, 48, 14, "ink")
73
+ ] }) : kind === "stacked" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
74
+ block(10, 10, 140, 46),
75
+ block(10, 62, 60, 6, "ink"),
76
+ block(10, 74, 90, 4),
77
+ block(110, 66, 40, 14, "ink")
78
+ ] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
79
+ block(10, 10, 66, 76),
80
+ block(84, 10, 66, 36),
81
+ block(84, 54, 50, 6, "ink"),
82
+ block(84, 70, 66, 14, "ink")
83
+ ] })
84
+ });
85
+ }
86
+ function LayoutChooser() {
87
+ return /* @__PURE__ */ jsx("div", {
88
+ className: "radio-stack radio-stack--wide",
89
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
90
+ "aria-label": "Product page layout",
91
+ variant: "card",
92
+ columns: 3,
93
+ indicator: false,
94
+ defaultValue: "gallery",
95
+ children: [
96
+ /* @__PURE__ */ jsx(RadioGroupItem, {
97
+ value: "gallery",
98
+ label: "Gallery",
99
+ description: "Photos beside the details.",
100
+ media: /* @__PURE__ */ jsx(Sketch, { kind: "gallery" }),
101
+ selectedPill: true
102
+ }),
103
+ /* @__PURE__ */ jsx(RadioGroupItem, {
104
+ value: "stacked",
105
+ label: "Stacked",
106
+ description: "A wide photo, then the details.",
107
+ media: /* @__PURE__ */ jsx(Sketch, { kind: "stacked" }),
108
+ selectedPill: true
109
+ }),
110
+ /* @__PURE__ */ jsx(RadioGroupItem, {
111
+ value: "split",
112
+ label: "Split",
113
+ description: "Two photos and the details.",
114
+ media: /* @__PURE__ */ jsx(Sketch, { kind: "split" }),
115
+ selectedPill: true
116
+ })
117
+ ]
118
+ })
119
+ });
120
+ }
121
+ var PER_MONTH = {
122
+ unit: "/mo",
123
+ unitLabel: "per month"
124
+ };
125
+ var PLANS = [
126
+ {
127
+ value: "starter",
128
+ label: "Starter",
129
+ description: "One shop, up to 100 products.",
130
+ price: { free: true }
131
+ },
132
+ {
133
+ value: "growth",
134
+ label: "Growth",
135
+ description: "Unlimited products and two staff.",
136
+ price: {
137
+ amount: 25,
138
+ compareAt: 35,
139
+ ...PER_MONTH,
140
+ note: "14-day free trial"
141
+ }
142
+ },
143
+ {
144
+ value: "scale",
145
+ label: "Scale",
146
+ description: "Ten staff, B2B pricing and the API.",
147
+ price: {
148
+ amount: 129,
149
+ ...PER_MONTH
150
+ }
151
+ },
152
+ {
153
+ value: "enterprise",
154
+ label: "Enterprise",
155
+ description: "Several shops, single sign-on, a named contact.",
156
+ price: { onRequest: true }
157
+ }
158
+ ];
159
+ var pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
160
+ function PlanTiers() {
161
+ const [plan, setPlan] = useState("starter");
162
+ const [asking, setAsking] = useState(null);
163
+ const [busy, setBusy] = useState(false);
164
+ return /* @__PURE__ */ jsxs("div", {
165
+ className: "radio-stack",
166
+ children: [/* @__PURE__ */ jsx(RadioGroup, {
167
+ "aria-label": "Plan",
168
+ variant: "card",
169
+ activation: "manual",
170
+ busy,
171
+ value: plan,
172
+ onValueChange: setPlan,
173
+ onBeforeValueChange: (next) => new Promise((resolve) => setAsking({
174
+ next,
175
+ resolve
176
+ })),
177
+ children: PLANS.map((tier) => /* @__PURE__ */ jsx(RadioGroupItem, {
178
+ value: tier.value,
179
+ label: tier.label,
180
+ description: tier.description,
181
+ price: tier.price,
182
+ current: tier.value === "starter",
183
+ disabled: tier.value === "enterprise",
184
+ badge: tier.value === "starter" ? /* @__PURE__ */ jsx(Badge, {
185
+ size: "sm",
186
+ children: "Current"
187
+ }) : tier.value === "growth" ? /* @__PURE__ */ jsx(Badge, {
188
+ size: "sm",
189
+ tone: "accent",
190
+ children: "Recommended"
191
+ }) : null,
192
+ selectedPill: true
193
+ }, tier.value))
194
+ }), /* @__PURE__ */ jsx(ConfirmDialog, {
195
+ open: asking !== null,
196
+ onOpenChange: (open) => {
197
+ if (!open && asking) {
198
+ asking.resolve(false);
199
+ setAsking(null);
200
+ }
201
+ },
202
+ title: `Move to ${PLANS.find((tier) => tier.value === asking?.next)?.label ?? ""}?`,
203
+ description: "The new price starts on your next bill. You can move back at any time.",
204
+ confirmLabel: "Change plan",
205
+ onConfirm: async () => {
206
+ const answer = asking;
207
+ setAsking(null);
208
+ setBusy(true);
209
+ await pause(1200);
210
+ setBusy(false);
211
+ answer?.resolve(true);
212
+ }
213
+ })]
214
+ });
215
+ }
216
+ function PlanFigures() {
217
+ return /* @__PURE__ */ jsx("div", {
218
+ className: "radio-stack radio-stack--wide",
219
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
220
+ "aria-label": "Plan, by its figure",
221
+ variant: "card",
222
+ columns: 3,
223
+ defaultValue: "growth",
224
+ indicator: false,
225
+ children: [
226
+ /* @__PURE__ */ jsx(RadioGroupItem, {
227
+ value: "starter",
228
+ label: "Starter",
229
+ description: "One shop, up to 100 products.",
230
+ price: {
231
+ free: true,
232
+ size: "display"
233
+ },
234
+ selectedPill: true
235
+ }),
236
+ /* @__PURE__ */ jsx(RadioGroupItem, {
237
+ value: "growth",
238
+ label: "Growth",
239
+ description: "Unlimited products and two staff.",
240
+ price: {
241
+ amount: 25,
242
+ compareAt: 35,
243
+ ...PER_MONTH,
244
+ size: "display",
245
+ note: "Billed £300 a year"
246
+ },
247
+ badge: /* @__PURE__ */ jsx(Badge, {
248
+ size: "sm",
249
+ tone: "accent",
250
+ children: "Recommended"
251
+ }),
252
+ selectedPill: true
253
+ }),
254
+ /* @__PURE__ */ jsx(RadioGroupItem, {
255
+ value: "scale",
256
+ label: "Scale",
257
+ description: "Ten staff, B2B pricing and the API.",
258
+ price: {
259
+ amount: 99,
260
+ from: true,
261
+ ...PER_MONTH,
262
+ size: "display"
263
+ },
264
+ selectedPill: true
265
+ })
266
+ ]
267
+ })
268
+ });
269
+ }
270
+ function DeliveryPrices() {
271
+ return /* @__PURE__ */ jsx("div", {
272
+ className: "radio-stack",
273
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
274
+ "aria-label": "Delivery",
275
+ defaultValue: "standard",
276
+ children: [
277
+ /* @__PURE__ */ jsx(RadioGroupItem, {
278
+ value: "standard",
279
+ label: "Standard",
280
+ description: "3 to 5 working days",
281
+ price: { free: true }
282
+ }),
283
+ /* @__PURE__ */ jsx(RadioGroupItem, {
284
+ value: "next-day",
285
+ label: "Next day",
286
+ description: "Order by 2pm",
287
+ price: {
288
+ amount: 4.95,
289
+ compareAt: 6.95
290
+ }
291
+ }),
292
+ /* @__PURE__ */ jsx(RadioGroupItem, {
293
+ value: "timed",
294
+ label: "Timed slot",
295
+ description: "Choose a two-hour window",
296
+ price: { amount: 12 }
297
+ })
298
+ ]
299
+ })
300
+ });
301
+ }
302
+ function TypeSummary() {
303
+ return /* @__PURE__ */ jsxs("div", {
304
+ className: "radio-stack",
305
+ children: [/* @__PURE__ */ jsx(RadioCardSummary, {
306
+ title: "Physical product",
307
+ description: "Shipped or collected. Stock is counted.",
308
+ icon: /* @__PURE__ */ jsx(CubeIcon, {}),
309
+ badge: /* @__PURE__ */ jsx(Badge, {
310
+ size: "sm",
311
+ children: "Set when created"
312
+ })
313
+ }), /* @__PURE__ */ jsx(RadioCardSummary, {
314
+ title: "Growth",
315
+ description: "Unlimited products and two staff.",
316
+ price: {
317
+ amount: 25,
318
+ compareAt: 35,
319
+ unit: "/mo",
320
+ unitLabel: "per month"
321
+ },
322
+ action: /* @__PURE__ */ jsx(Button, {
323
+ size: "sm",
324
+ variant: "secondary",
325
+ children: "Change"
326
+ })
327
+ })]
328
+ });
329
+ }
330
+ //#endregion
331
+ //#region src/pages/components/radio-group.tsx
332
+ var SPEEDS = [
333
+ {
334
+ value: "standard",
335
+ label: "Standard delivery",
336
+ description: "2 to 4 working days",
337
+ hint: "£3.95"
338
+ },
339
+ {
340
+ value: "next-day",
341
+ label: "Next working day",
342
+ description: "Order by 2pm",
343
+ hint: "£6.95"
344
+ },
345
+ {
346
+ value: "collect",
347
+ label: "Click and collect",
348
+ description: "Ready in 2 hours at our Leeds shop",
349
+ hint: "Free"
350
+ }
351
+ ];
352
+ function Preview() {
353
+ return /* @__PURE__ */ jsx("div", {
354
+ className: "radio-group-preview",
355
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
356
+ "aria-label": "Delivery speed",
357
+ variant: "card",
358
+ size: "sm",
359
+ defaultValue: "next-day",
360
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
361
+ value: "standard",
362
+ label: "Standard delivery",
363
+ description: "2 to 4 working days"
364
+ }), /* @__PURE__ */ jsx(RadioGroupItem, {
365
+ value: "next-day",
366
+ label: "Next working day",
367
+ description: "Order by 2pm"
368
+ })]
369
+ })
370
+ });
371
+ }
372
+ var PLAYGROUND = [
373
+ {
374
+ prop: "variant",
375
+ type: "select",
376
+ options: ["list", "card"],
377
+ default: "list"
378
+ },
379
+ {
380
+ prop: "orientation",
381
+ type: "select",
382
+ options: ["vertical", "horizontal"],
383
+ default: "vertical"
384
+ },
385
+ {
386
+ prop: "size",
387
+ type: "select",
388
+ options: ["sm", "md"],
389
+ default: "md"
390
+ },
391
+ {
392
+ prop: "descriptions",
393
+ type: "boolean",
394
+ default: true,
395
+ toAttr: () => null
396
+ },
397
+ {
398
+ prop: "hints",
399
+ type: "boolean",
400
+ default: false,
401
+ toAttr: () => null
402
+ },
403
+ {
404
+ prop: "invalid",
405
+ type: "boolean",
406
+ default: false
407
+ },
408
+ {
409
+ prop: "disabled",
410
+ type: "boolean",
411
+ default: false
412
+ }
413
+ ];
414
+ var POLICIES = [
415
+ {
416
+ value: "stop",
417
+ label: "Stop selling",
418
+ description: "The product shows as sold out until you restock it."
419
+ },
420
+ {
421
+ value: "continue",
422
+ label: "Keep selling",
423
+ description: "Orders are taken at zero stock. Good for made-to-order items."
424
+ },
425
+ {
426
+ value: "hide",
427
+ label: "Hide it",
428
+ description: "It leaves collections and search until it is back in stock."
429
+ }
430
+ ];
431
+ function SoldOutPolicy() {
432
+ const [policy, setPolicy] = useState("stop");
433
+ return /* @__PURE__ */ jsx("div", {
434
+ className: "radio-group-stack",
435
+ children: /* @__PURE__ */ jsx(Field, {
436
+ label: "When the Arden ergonomic chair sells out",
437
+ children: /* @__PURE__ */ jsx(RadioGroup, {
438
+ value: policy,
439
+ onValueChange: setPolicy,
440
+ children: POLICIES.map((p) => /* @__PURE__ */ jsx(RadioGroupItem, {
441
+ value: p.value,
442
+ label: p.label,
443
+ description: p.description
444
+ }, p.value))
445
+ })
446
+ })
447
+ });
448
+ }
449
+ function AccountsChoice() {
450
+ const [accounts, setAccounts] = useState("optional");
451
+ return /* @__PURE__ */ jsx("div", {
452
+ className: "radio-group-cards",
453
+ children: /* @__PURE__ */ jsx(Field, {
454
+ label: "Customer accounts",
455
+ hint: "Applies to every checkout on Harbour Desk Co.",
456
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
457
+ variant: "card",
458
+ value: accounts,
459
+ onValueChange: setAccounts,
460
+ children: [
461
+ /* @__PURE__ */ jsx(RadioGroupItem, {
462
+ value: "guest",
463
+ label: "Guest checkout only",
464
+ description: "Customers check out with an email address. No passwords to forget."
465
+ }),
466
+ /* @__PURE__ */ jsx(RadioGroupItem, {
467
+ value: "optional",
468
+ label: /* @__PURE__ */ jsxs("span", {
469
+ className: "radio-group-title",
470
+ children: ["Accounts optional", /* @__PURE__ */ jsx(Badge, {
471
+ size: "sm",
472
+ tone: "accent",
473
+ children: "Recommended"
474
+ })]
475
+ }),
476
+ description: "Customers can create an account at checkout, or carry on as a guest."
477
+ }),
478
+ /* @__PURE__ */ jsx(RadioGroupItem, {
479
+ value: "required",
480
+ label: "Accounts required",
481
+ description: "Customers sign in before they can pay. Suits trade-only stores."
482
+ })
483
+ ]
484
+ })
485
+ })
486
+ });
487
+ }
488
+ function DeliverySpeed() {
489
+ const [speed, setSpeed] = useState("next-day");
490
+ return /* @__PURE__ */ jsx("div", {
491
+ className: "radio-group-stack",
492
+ children: /* @__PURE__ */ jsx(Field, {
493
+ label: "Delivery speed",
494
+ children: /* @__PURE__ */ jsx(RadioGroup, {
495
+ value: speed,
496
+ onValueChange: setSpeed,
497
+ children: SPEEDS.map((s) => /* @__PURE__ */ jsx(RadioGroupItem, {
498
+ value: s.value,
499
+ label: s.label,
500
+ description: s.description,
501
+ hint: s.hint
502
+ }, s.value))
503
+ })
504
+ })
505
+ });
506
+ }
507
+ var WINDOWS = [
508
+ {
509
+ value: "14",
510
+ label: "14 days",
511
+ description: "The legal minimum for online orders in the UK."
512
+ },
513
+ {
514
+ value: "30",
515
+ label: "30 days"
516
+ },
517
+ {
518
+ value: "60",
519
+ label: "60 days",
520
+ description: "Popular for gifts bought before Christmas."
521
+ }
522
+ ];
523
+ function ReturnWindow() {
524
+ const [value, setValue] = useState(null);
525
+ const [error, setError] = useState();
526
+ const [saved, setSaved] = useState(false);
527
+ const save = (event) => {
528
+ event.preventDefault();
529
+ if (!value) {
530
+ setError("Choose how long customers have to return an item");
531
+ setSaved(false);
532
+ return;
533
+ }
534
+ setSaved(true);
535
+ };
536
+ return /* @__PURE__ */ jsxs("form", {
537
+ noValidate: true,
538
+ onSubmit: save,
539
+ className: "radio-group-form",
540
+ children: [/* @__PURE__ */ jsx(Field, {
541
+ label: "Return window",
542
+ hint: "Counted from the day the order is delivered.",
543
+ error,
544
+ children: /* @__PURE__ */ jsx(RadioGroup, {
545
+ value,
546
+ onValueChange: (next) => {
547
+ setValue(next);
548
+ setError(void 0);
549
+ setSaved(false);
550
+ },
551
+ children: WINDOWS.map((w) => /* @__PURE__ */ jsx(RadioGroupItem, {
552
+ value: w.value,
553
+ label: w.label,
554
+ description: w.description
555
+ }, w.value))
556
+ })
557
+ }), /* @__PURE__ */ jsxs("div", {
558
+ className: "radio-group-form__footer",
559
+ children: [/* @__PURE__ */ jsx("span", {
560
+ role: "status",
561
+ className: "radio-group-status",
562
+ children: saved ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CheckCircleIcon, {
563
+ weight: "fill",
564
+ "aria-hidden": "true"
565
+ }), "Returns policy saved"] }) : null
566
+ }), /* @__PURE__ */ jsx(Button, {
567
+ type: "submit",
568
+ variant: "primary",
569
+ children: "Save"
570
+ })]
571
+ })]
572
+ });
573
+ }
574
+ var TEMPLATES = [
575
+ {
576
+ value: "name",
577
+ template: "[product_name]"
578
+ },
579
+ {
580
+ value: "name-brand",
581
+ template: "[product_name] by [brand]"
582
+ },
583
+ {
584
+ value: "name-colour",
585
+ template: "[product_name] in [colour]"
586
+ }
587
+ ];
588
+ function AltTextTemplate() {
589
+ const [choice, setChoice] = useState("name-brand");
590
+ const [custom, setCustom] = useState("[product_name], [material], from [brand]");
591
+ return /* @__PURE__ */ jsx("div", {
592
+ className: "radio-group-stack",
593
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
594
+ value: choice,
595
+ onValueChange: setChoice,
596
+ "aria-label": "Alt text for product images",
597
+ className: "radio-group-own",
598
+ children: [TEMPLATES.map((t) => /* @__PURE__ */ jsxs("div", {
599
+ className: "radio-group-own__row",
600
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
601
+ value: t.value,
602
+ id: `alt-${t.value}`
603
+ }), /* @__PURE__ */ jsx("label", {
604
+ htmlFor: `alt-${t.value}`,
605
+ className: "radio-group-own__label",
606
+ children: /* @__PURE__ */ jsx("code", { children: t.template })
607
+ })]
608
+ }, t.value)), /* @__PURE__ */ jsxs("div", {
609
+ className: "radio-group-own__row",
610
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
611
+ value: "custom",
612
+ id: "alt-custom"
613
+ }), /* @__PURE__ */ jsxs("div", {
614
+ className: "radio-group-own__custom",
615
+ children: [/* @__PURE__ */ jsx("label", {
616
+ htmlFor: "alt-custom",
617
+ className: "radio-group-own__label",
618
+ children: "Write my own template"
619
+ }), choice === "custom" ? /* @__PURE__ */ jsx(Input, {
620
+ size: "sm",
621
+ "aria-label": "Your alt text template",
622
+ value: custom,
623
+ onChange: (e) => setCustom(e.target.value)
624
+ }) : null]
625
+ })]
626
+ })]
627
+ })
628
+ });
629
+ }
630
+ function Page() {
631
+ return /* @__PURE__ */ jsxs(DocPage, {
632
+ title: "Radio group",
633
+ status: "new",
634
+ importNames: [
635
+ "RadioGroup",
636
+ "RadioGroupItem",
637
+ "RadioCardSummary"
638
+ ],
639
+ lead: "One choice out of a few, with every option in view: what happens when stock runs out, how long customers have to return an item. Options are rows beside their labels, or cards for settings that choose between richer options.",
640
+ children: [
641
+ /* @__PURE__ */ jsx(Section$1, {
642
+ id: "playground",
643
+ title: "Playground",
644
+ description: /* @__PURE__ */ jsxs("p", { children: [
645
+ "Change the props, then choose with the pointer, or Tab in and use the arrow keys. The code shows the group's own props; inside it are three ",
646
+ /* @__PURE__ */ jsx("code", { children: "RadioGroupItem" }),
647
+ "s, each with a ",
648
+ /* @__PURE__ */ jsx("code", { children: "label" }),
649
+ " and, when switched on, a",
650
+ " ",
651
+ /* @__PURE__ */ jsx("code", { children: "description" }),
652
+ " and a ",
653
+ /* @__PURE__ */ jsx("code", { children: "hint" }),
654
+ "."
655
+ ] }),
656
+ children: /* @__PURE__ */ jsx(Playground, {
657
+ component: "RadioGroup",
658
+ controls: PLAYGROUND,
659
+ minHeight: 280,
660
+ extraCode: () => ["aria-label=\"Delivery speed\"", "defaultValue=\"next-day\""],
661
+ render: (v) => /* @__PURE__ */ jsx("div", {
662
+ className: "radio-group-stage",
663
+ "data-orientation": String(v.orientation),
664
+ children: /* @__PURE__ */ jsx(RadioGroup, {
665
+ "aria-label": "Delivery speed",
666
+ defaultValue: "next-day",
667
+ variant: v.variant,
668
+ orientation: v.orientation,
669
+ size: v.size,
670
+ invalid: Boolean(v.invalid),
671
+ disabled: Boolean(v.disabled),
672
+ children: SPEEDS.map((s) => /* @__PURE__ */ jsx(RadioGroupItem, {
673
+ value: s.value,
674
+ label: s.label,
675
+ description: v.descriptions ? s.description : void 0,
676
+ hint: v.hints ? s.hint : void 0
677
+ }, s.value))
678
+ })
679
+ })
680
+ })
681
+ }),
682
+ /* @__PURE__ */ jsx(Section$1, {
683
+ id: "basics",
684
+ title: "Basics",
685
+ description: /* @__PURE__ */ jsxs("p", { children: [
686
+ "A ",
687
+ /* @__PURE__ */ jsx("code", { children: "RadioGroup" }),
688
+ " holds a ",
689
+ /* @__PURE__ */ jsx("code", { children: "RadioGroupItem" }),
690
+ " per option, each with a ",
691
+ /* @__PURE__ */ jsx("code", { children: "value" }),
692
+ " and a",
693
+ " ",
694
+ /* @__PURE__ */ jsx("code", { children: "label" }),
695
+ ". A ",
696
+ /* @__PURE__ */ jsx("code", { children: "description" }),
697
+ " under the label explains what the choice does. Put the group in a",
698
+ " ",
699
+ /* @__PURE__ */ jsx("code", { children: "Field" }),
700
+ " to name it, and control it with ",
701
+ /* @__PURE__ */ jsx("code", { children: "value" }),
702
+ " and ",
703
+ /* @__PURE__ */ jsx("code", { children: "onValueChange" }),
704
+ "."
705
+ ] }),
706
+ children: /* @__PURE__ */ jsx(Example, {
707
+ code: `
708
+ const [policy, setPolicy] = useState('stop')
709
+
710
+ <Field label="When the Arden ergonomic chair sells out">
711
+ <RadioGroup value={policy} onValueChange={setPolicy}>
712
+ <RadioGroupItem
713
+ value="stop"
714
+ label="Stop selling"
715
+ description="The product shows as sold out until you restock it."
716
+ />
717
+ <RadioGroupItem
718
+ value="continue"
719
+ label="Keep selling"
720
+ description="Orders are taken at zero stock. Good for made-to-order items."
721
+ />
722
+ <RadioGroupItem
723
+ value="hide"
724
+ label="Hide it"
725
+ description="It leaves collections and search until it is back in stock."
726
+ />
727
+ </RadioGroup>
728
+ </Field>`,
729
+ children: /* @__PURE__ */ jsx(SoldOutPolicy, {})
730
+ })
731
+ }),
732
+ /* @__PURE__ */ jsx(Section$1, {
733
+ id: "cards",
734
+ title: "Cards",
735
+ description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "variant=\"card\"" }), " turns each option into a tile, for settings that choose between richer options. The whole tile is the radio: clicking anywhere on it chooses, its edge takes the teal when chosen, and the focus ring goes round the tile. A label can carry a small Badge, as here."] }),
736
+ children: /* @__PURE__ */ jsx(Example, {
737
+ align: "fill",
738
+ code: `
739
+ <Field label="Customer accounts" hint="Applies to every checkout on Harbour Desk Co.">
740
+ <RadioGroup variant="card" value={accounts} onValueChange={setAccounts}>
741
+ <RadioGroupItem
742
+ value="guest"
743
+ label="Guest checkout only"
744
+ description="Customers check out with an email address. No passwords to forget."
745
+ />
746
+ <RadioGroupItem
747
+ value="optional"
748
+ label={<>Accounts optional <Badge size="sm" tone="accent">Recommended</Badge></>}
749
+ description="Customers can create an account at checkout, or carry on as a guest."
750
+ />
751
+ <RadioGroupItem
752
+ value="required"
753
+ label="Accounts required"
754
+ description="Customers sign in before they can pay. Suits trade-only stores."
755
+ />
756
+ </RadioGroup>
757
+ </Field>`,
758
+ children: /* @__PURE__ */ jsx(AccountsChoice, {})
759
+ })
760
+ }),
761
+ /* @__PURE__ */ jsx(Section$1, {
762
+ id: "hints",
763
+ title: "Hints",
764
+ description: /* @__PURE__ */ jsxs("p", { children: [
765
+ "A ",
766
+ /* @__PURE__ */ jsx("code", { children: "hint" }),
767
+ " sits at the end of the option: a price, a fee, \"Free\". In a list the row then spans the group, so the hints line up; on a card it is set firmer, in ink."
768
+ ] }),
769
+ children: /* @__PURE__ */ jsx(Example, {
770
+ align: "fill",
771
+ code: `
772
+ <Field label="Delivery speed">
773
+ <RadioGroup value={speed} onValueChange={setSpeed}>
774
+ <RadioGroupItem value="standard" label="Standard delivery" description="2 to 4 working days" hint="£3.95" />
775
+ <RadioGroupItem value="next-day" label="Next working day" description="Order by 2pm" hint="£6.95" />
776
+ <RadioGroupItem value="collect" label="Click and collect" description="Ready in 2 hours at our Leeds shop" hint="Free" />
777
+ </RadioGroup>
778
+ </Field>
779
+
780
+ <RadioGroup variant="card" aria-label="Delivery speed" defaultValue="next-day">
781
+ ...the same items
782
+ </RadioGroup>`,
783
+ children: /* @__PURE__ */ jsxs("div", {
784
+ className: "radio-group-split",
785
+ children: [/* @__PURE__ */ jsx(DeliverySpeed, {}), /* @__PURE__ */ jsx("div", {
786
+ className: "radio-group-stack",
787
+ children: /* @__PURE__ */ jsx(RadioGroup, {
788
+ variant: "card",
789
+ "aria-label": "Delivery speed",
790
+ defaultValue: "next-day",
791
+ children: SPEEDS.map((s) => /* @__PURE__ */ jsx(RadioGroupItem, {
792
+ value: s.value,
793
+ label: s.label,
794
+ description: s.description,
795
+ hint: s.hint
796
+ }, s.value))
797
+ })
798
+ })]
799
+ })
800
+ })
801
+ }),
802
+ /* @__PURE__ */ jsx(Section$1, {
803
+ id: "orientation",
804
+ title: "Horizontal",
805
+ description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "orientation=\"horizontal\"" }), " sets short options in a row that wraps when it runs out of room. Cards in a row share the width equally, and fall into a column on a phone. The arrow keys move between options whichever way they run."] }),
806
+ children: /* @__PURE__ */ jsx(Example, {
807
+ align: "fill",
808
+ code: `
809
+ <Field label="Weight unit">
810
+ <RadioGroup orientation="horizontal" defaultValue="kg">
811
+ <RadioGroupItem value="kg" label="Kilograms" />
812
+ <RadioGroupItem value="g" label="Grams" />
813
+ <RadioGroupItem value="lb" label="Pounds" />
814
+ <RadioGroupItem value="oz" label="Ounces" />
815
+ </RadioGroup>
816
+ </Field>
817
+
818
+ <Field label="Product image shape" hint="Images are cropped to fit, from the centre.">
819
+ <RadioGroup variant="card" orientation="horizontal" defaultValue="square">
820
+ <RadioGroupItem value="square" label="Square" description="1:1, for most catalogues" />
821
+ <RadioGroupItem value="portrait" label="Portrait" description="4:5, for clothing and prints" />
822
+ <RadioGroupItem value="landscape" label="Landscape" description="3:2, for furniture and rooms" />
823
+ </RadioGroup>
824
+ </Field>`,
825
+ children: /* @__PURE__ */ jsxs("div", {
826
+ className: "radio-group-rows",
827
+ children: [/* @__PURE__ */ jsx(Field, {
828
+ label: "Weight unit",
829
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
830
+ orientation: "horizontal",
831
+ defaultValue: "kg",
832
+ children: [
833
+ /* @__PURE__ */ jsx(RadioGroupItem, {
834
+ value: "kg",
835
+ label: "Kilograms"
836
+ }),
837
+ /* @__PURE__ */ jsx(RadioGroupItem, {
838
+ value: "g",
839
+ label: "Grams"
840
+ }),
841
+ /* @__PURE__ */ jsx(RadioGroupItem, {
842
+ value: "lb",
843
+ label: "Pounds"
844
+ }),
845
+ /* @__PURE__ */ jsx(RadioGroupItem, {
846
+ value: "oz",
847
+ label: "Ounces"
848
+ })
849
+ ]
850
+ })
851
+ }), /* @__PURE__ */ jsx(Field, {
852
+ label: "Product image shape",
853
+ hint: "Images are cropped to fit, from the centre.",
854
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
855
+ variant: "card",
856
+ orientation: "horizontal",
857
+ defaultValue: "square",
858
+ children: [
859
+ /* @__PURE__ */ jsx(RadioGroupItem, {
860
+ value: "square",
861
+ label: "Square",
862
+ description: "1:1, for most catalogues"
863
+ }),
864
+ /* @__PURE__ */ jsx(RadioGroupItem, {
865
+ value: "portrait",
866
+ label: "Portrait",
867
+ description: "4:5, for clothing and prints"
868
+ }),
869
+ /* @__PURE__ */ jsx(RadioGroupItem, {
870
+ value: "landscape",
871
+ label: "Landscape",
872
+ description: "3:2, for furniture and rooms"
873
+ })
874
+ ]
875
+ })
876
+ })]
877
+ })
878
+ })
879
+ }),
880
+ /* @__PURE__ */ jsxs(Section$1, {
881
+ id: "errors",
882
+ title: "In a field, with an error",
883
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
884
+ "Inside a ",
885
+ /* @__PURE__ */ jsx("code", { children: "Field" }),
886
+ ", the group is named by the Field's label and described by its hint or error. An error rings the radios in red and sets ",
887
+ /* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
888
+ " on the group."
889
+ ] }), /* @__PURE__ */ jsx("p", { children: "Start with nothing chosen only when there is no safe default, and check on save. Press Save to see the error, then choose a window to clear it." })] }),
890
+ children: [/* @__PURE__ */ jsx(Example, {
891
+ code: `
892
+ const [value, setValue] = useState<string | null>(null)
893
+ const [error, setError] = useState<string>()
894
+
895
+ <form noValidate onSubmit={save}>
896
+ <Field label="Return window" hint="Counted from the day the order is delivered." error={error}>
897
+ <RadioGroup value={value} onValueChange={(next) => { setValue(next); setError(undefined) }}>
898
+ <RadioGroupItem value="14" label="14 days" description="The legal minimum for online orders in the UK." />
899
+ <RadioGroupItem value="30" label="30 days" />
900
+ <RadioGroupItem value="60" label="60 days" description="Popular for gifts bought before Christmas." />
901
+ </RadioGroup>
902
+ </Field>
903
+ <Button type="submit" variant="primary">Save</Button>
904
+ </form>`,
905
+ children: /* @__PURE__ */ jsx(ReturnWindow, {})
906
+ }), /* @__PURE__ */ jsxs(Note, { children: [
907
+ /* @__PURE__ */ jsx("code", { children: "required" }),
908
+ " on the group reaches its hidden inputs, so screen readers announce it as required. The browser then shows its own message on submit unless the form has ",
909
+ /* @__PURE__ */ jsx("code", { children: "noValidate" }),
910
+ ": set it, check the value yourself and show the problem with the Field's ",
911
+ /* @__PURE__ */ jsx("code", { children: "error" }),
912
+ ", as here."
913
+ ] })]
914
+ }),
915
+ /* @__PURE__ */ jsxs(Section$1, {
916
+ id: "states",
917
+ title: "States",
918
+ description: /* @__PURE__ */ jsxs("p", { children: [
919
+ "Unchosen and chosen, an option that is off (",
920
+ /* @__PURE__ */ jsx("code", { children: "disabled" }),
921
+ " on the item, with the reason in its description), a whole group that is off, and an invalid group. Hover firms the ring; pressing sinks the radio a little; the dot drops in on the pop spring."
922
+ ] }),
923
+ children: [/* @__PURE__ */ jsx(Example, {
924
+ align: "fill",
925
+ code: `
926
+ <RadioGroup aria-label="Fulfilment" defaultValue="ship">
927
+ <RadioGroupItem value="ship" label="Ship to the customer" />
928
+ <RadioGroupItem value="collect" label="Click and collect" />
929
+ <RadioGroupItem value="local" label="Local delivery" description="Set it up in Shipping first" disabled />
930
+ </RadioGroup>
931
+
932
+ <RadioGroup aria-label="Fulfilment" defaultValue="ship" disabled>...</RadioGroup>
933
+
934
+ <RadioGroup aria-label="Fulfilment" invalid>...</RadioGroup>`,
935
+ caption: "An option that is off, a group that is off, and a group with an error.",
936
+ children: /* @__PURE__ */ jsxs("div", {
937
+ className: "radio-group-grid",
938
+ children: [
939
+ /* @__PURE__ */ jsxs(RadioGroup, {
940
+ "aria-label": "Fulfilment",
941
+ defaultValue: "ship",
942
+ children: [
943
+ /* @__PURE__ */ jsx(RadioGroupItem, {
944
+ value: "ship",
945
+ label: "Ship to the customer"
946
+ }),
947
+ /* @__PURE__ */ jsx(RadioGroupItem, {
948
+ value: "collect",
949
+ label: "Click and collect"
950
+ }),
951
+ /* @__PURE__ */ jsx(RadioGroupItem, {
952
+ value: "local",
953
+ label: "Local delivery",
954
+ description: "Set it up in Shipping first",
955
+ disabled: true
956
+ })
957
+ ]
958
+ }),
959
+ /* @__PURE__ */ jsxs(RadioGroup, {
960
+ "aria-label": "Fulfilment",
961
+ defaultValue: "ship",
962
+ disabled: true,
963
+ children: [
964
+ /* @__PURE__ */ jsx(RadioGroupItem, {
965
+ value: "ship",
966
+ label: "Ship to the customer"
967
+ }),
968
+ /* @__PURE__ */ jsx(RadioGroupItem, {
969
+ value: "collect",
970
+ label: "Click and collect"
971
+ }),
972
+ /* @__PURE__ */ jsx(RadioGroupItem, {
973
+ value: "local",
974
+ label: "Local delivery"
975
+ })
976
+ ]
977
+ }),
978
+ /* @__PURE__ */ jsxs(RadioGroup, {
979
+ "aria-label": "Fulfilment",
980
+ invalid: true,
981
+ children: [
982
+ /* @__PURE__ */ jsx(RadioGroupItem, {
983
+ value: "ship",
984
+ label: "Ship to the customer"
985
+ }),
986
+ /* @__PURE__ */ jsx(RadioGroupItem, {
987
+ value: "collect",
988
+ label: "Click and collect"
989
+ }),
990
+ /* @__PURE__ */ jsx(RadioGroupItem, {
991
+ value: "local",
992
+ label: "Local delivery"
993
+ })
994
+ ]
995
+ })
996
+ ]
997
+ })
998
+ }), /* @__PURE__ */ jsx(SubSection, {
999
+ title: "Long labels",
1000
+ description: /* @__PURE__ */ jsx("p", { children: "Labels and descriptions wrap beside the radio, which stays on the first line." }),
1001
+ children: /* @__PURE__ */ jsx(Example, {
1002
+ align: "fill",
1003
+ code: `<RadioGroupItem value="split" label="..." description="..." />`,
1004
+ children: /* @__PURE__ */ jsx("div", {
1005
+ className: "radio-group-stack",
1006
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
1007
+ "aria-label": "Part-paid orders",
1008
+ defaultValue: "split",
1009
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
1010
+ value: "split",
1011
+ label: "Send what is in stock now, and the rest when it arrives",
1012
+ description: "The customer gets two parcels and pays for delivery once. Their order stays open until the last item ships."
1013
+ }), /* @__PURE__ */ jsx(RadioGroupItem, {
1014
+ value: "wait",
1015
+ label: "Hold the order until everything is in stock",
1016
+ description: "One parcel, sent when the last item arrives."
1017
+ })]
1018
+ })
1019
+ })
1020
+ })
1021
+ })]
1022
+ }),
1023
+ /* @__PURE__ */ jsx(Section$1, {
1024
+ id: "own-labels",
1025
+ title: "Your own labels",
1026
+ description: /* @__PURE__ */ jsxs("p", { children: [
1027
+ "Without a ",
1028
+ /* @__PURE__ */ jsx("code", { children: "label" }),
1029
+ ", an item is just the radio, for a layout of your own: give it an ",
1030
+ /* @__PURE__ */ jsx("code", { children: "id" }),
1031
+ " and point a ",
1032
+ /* @__PURE__ */ jsx("code", { children: "<label htmlFor>" }),
1033
+ " at it (or give it an ",
1034
+ /* @__PURE__ */ jsx("code", { children: "aria-label" }),
1035
+ "). Here the last option shows a field of its own once it is chosen."
1036
+ ] }),
1037
+ children: /* @__PURE__ */ jsx(Example, {
1038
+ code: `
1039
+ <RadioGroup value={choice} onValueChange={setChoice} aria-label="Alt text for product images">
1040
+ <div className="row">
1041
+ <RadioGroupItem value="name-brand" id="alt-name-brand" />
1042
+ <label htmlFor="alt-name-brand"><code>[product_name] by [brand]</code></label>
1043
+ </div>
1044
+ {/* ...more templates */}
1045
+ <div className="row">
1046
+ <RadioGroupItem value="custom" id="alt-custom" />
1047
+ <div>
1048
+ <label htmlFor="alt-custom">Write my own template</label>
1049
+ {choice === 'custom' ? <Input size="sm" aria-label="Your alt text template" value={custom} onChange={...} /> : null}
1050
+ </div>
1051
+ </div>
1052
+ </RadioGroup>`,
1053
+ children: /* @__PURE__ */ jsx(AltTextTemplate, {})
1054
+ })
1055
+ }),
1056
+ /* @__PURE__ */ jsx(Section$1, {
1057
+ id: "sizes",
1058
+ title: "Sizes",
1059
+ description: /* @__PURE__ */ jsxs("p", { children: [
1060
+ /* @__PURE__ */ jsx("code", { children: "md" }),
1061
+ " radios are 16px (default) and ",
1062
+ /* @__PURE__ */ jsx("code", { children: "sm" }),
1063
+ " 14px, the Checkbox sizes; the hit area is at least 24px either way. Small cards also tighten their padding."
1064
+ ] }),
1065
+ children: /* @__PURE__ */ jsx(Example, {
1066
+ align: "fill",
1067
+ code: `
1068
+ <RadioGroup aria-label="Invoice layout" defaultValue="detailed">...</RadioGroup>
1069
+ <RadioGroup aria-label="Invoice layout" size="sm" defaultValue="detailed">...</RadioGroup>`,
1070
+ children: /* @__PURE__ */ jsx("div", {
1071
+ className: "radio-group-grid",
1072
+ children: ["md", "sm"].map((size) => /* @__PURE__ */ jsxs(RadioGroup, {
1073
+ "aria-label": "Invoice layout",
1074
+ size,
1075
+ defaultValue: "detailed",
1076
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
1077
+ value: "detailed",
1078
+ label: "Detailed",
1079
+ description: "Every line, with VAT per item"
1080
+ }), /* @__PURE__ */ jsx(RadioGroupItem, {
1081
+ value: "compact",
1082
+ label: "Compact",
1083
+ description: "Totals only"
1084
+ })]
1085
+ }, size))
1086
+ })
1087
+ })
1088
+ }),
1089
+ /* @__PURE__ */ jsxs(Section$1, {
1090
+ id: "choice-cards",
1091
+ title: "Choice cards",
1092
+ description: /* @__PURE__ */ jsxs("p", { children: [
1093
+ "Cards for choices that need more than a line: a product's type, a plan, a page layout. A card takes an",
1094
+ " ",
1095
+ /* @__PURE__ */ jsx("code", { children: "icon" }),
1096
+ " on a small tile that turns teal with the choice, or a ",
1097
+ /* @__PURE__ */ jsx("code", { children: "media" }),
1098
+ " picture above its words, a ",
1099
+ /* @__PURE__ */ jsx("code", { children: "badge" }),
1100
+ " beside its title (part of the radio's name), and a ",
1101
+ /* @__PURE__ */ jsx("code", { children: "selectedPill" }),
1102
+ " shown while it is chosen. The group sets them in ",
1103
+ /* @__PURE__ */ jsx("code", { children: "columns" }),
1104
+ ", as many as fit at 11.5rem, and",
1105
+ " ",
1106
+ /* @__PURE__ */ jsxs("code", { children: ["indicator=", "{false}"] }),
1107
+ " hides the radios where the edge and the pill say it."
1108
+ ] }),
1109
+ children: [
1110
+ /* @__PURE__ */ jsx(SubSection, {
1111
+ title: "Icon tiles and columns",
1112
+ children: /* @__PURE__ */ jsx(Example, {
1113
+ align: "fill",
1114
+ code: `
1115
+ <RadioGroup aria-label="Product type" variant="card" columns={2} value={type} onValueChange={setType}>
1116
+ <RadioGroupItem value="physical" label="Physical product" description="Shipped or collected. Stock is counted." icon={<PackageIcon />} />
1117
+ <RadioGroupItem value="digital" label="Digital product" description="A download sent after payment." icon={<DownloadSimpleIcon />} />
1118
+ <RadioGroupItem value="bundle" label="Bundle" description="Several products sold as one." icon={<StackIcon />}
1119
+ badge={<Badge size="sm" tone="accent">New</Badge>} />
1120
+ <RadioGroupItem value="gift-card" label="Gift card" description="A balance to spend in your shop." icon={<GiftIcon />} />
1121
+ </RadioGroup>`,
1122
+ children: /* @__PURE__ */ jsx(ProductType, {})
1123
+ })
1124
+ }),
1125
+ /* @__PURE__ */ jsx(SubSection, {
1126
+ title: "Pictures, no radios, a Selected pill",
1127
+ children: /* @__PURE__ */ jsx(Example, {
1128
+ align: "fill",
1129
+ code: `
1130
+ <RadioGroup aria-label="Product page layout" variant="card" columns={3} indicator={false} defaultValue="gallery">
1131
+ <RadioGroupItem value="gallery" label="Gallery" description="Photos beside the details." media={<GallerySketch />} selectedPill />
1132
+ <RadioGroupItem value="stacked" label="Stacked" description="A wide photo, then the details." media={<StackedSketch />} selectedPill />
1133
+ <RadioGroupItem value="split" label="Split" description="Two photos and the details." media={<SplitSketch />} selectedPill />
1134
+ </RadioGroup>`,
1135
+ children: /* @__PURE__ */ jsx(LayoutChooser, {})
1136
+ })
1137
+ }),
1138
+ /* @__PURE__ */ jsx(SubSection, {
1139
+ title: "Plans: prices, the current one, manual activation, a confirmation and a busy group",
1140
+ description: /* @__PURE__ */ jsxs("p", { children: [
1141
+ /* @__PURE__ */ jsx("code", { children: "activation=\"manual\"" }),
1142
+ " lets the arrow keys move between cards without choosing; Space or a press chooses. ",
1143
+ /* @__PURE__ */ jsx("code", { children: "onBeforeValueChange" }),
1144
+ " is asked first, with the new value and the current one: return or resolve ",
1145
+ /* @__PURE__ */ jsx("code", { children: "false" }),
1146
+ " to keep the current choice, here after a confirmation. The ",
1147
+ /* @__PURE__ */ jsx("code", { children: "current" }),
1148
+ " ",
1149
+ "option (the plan the shop is on) stays in the tab order with ",
1150
+ /* @__PURE__ */ jsx("code", { children: "aria-disabled" }),
1151
+ " but cannot be chosen; say so in its badge. ",
1152
+ /* @__PURE__ */ jsx("code", { children: "price" }),
1153
+ " draws the option's price with ",
1154
+ /* @__PURE__ */ jsx("code", { children: "Price" }),
1155
+ ", read after its name: Free, an amount with a struck compare-at price (\"Was £35, now £25 per month\") and a note line for a trial, From, or Price on request. ",
1156
+ /* @__PURE__ */ jsx("code", { children: "busy" }),
1157
+ " holds the whole group while the change is made on the server: nothing can be chosen and focus stays where it was. Change the plan here to see it."
1158
+ ] }),
1159
+ children: /* @__PURE__ */ jsx(Example, {
1160
+ align: "fill",
1161
+ code: `
1162
+ <RadioGroup
1163
+ aria-label="Plan"
1164
+ variant="card"
1165
+ activation="manual"
1166
+ busy={saving}
1167
+ value={plan}
1168
+ onValueChange={setPlan}
1169
+ onBeforeValueChange={(next) => confirmPlanChange(next)} // resolves true or false
1170
+ >
1171
+ <RadioGroupItem value="starter" label="Starter" description="One shop, up to 100 products."
1172
+ price={{ free: true }} current badge={<Badge size="sm">Current</Badge>} selectedPill />
1173
+ <RadioGroupItem value="growth" label="Growth" description="Unlimited products and two staff."
1174
+ price={{ amount: 25, compareAt: 35, unit: '/mo', unitLabel: 'per month', note: '14-day free trial' }}
1175
+ badge={<Badge size="sm" tone="accent">Recommended</Badge>} selectedPill />
1176
+ <RadioGroupItem value="scale" label="Scale" description="Ten staff, B2B pricing and the API."
1177
+ price={{ amount: 129, unit: '/mo', unitLabel: 'per month' }} selectedPill />
1178
+ <RadioGroupItem value="enterprise" label="Enterprise" description="Several shops, single sign-on, a named contact."
1179
+ price={{ onRequest: true }} disabled selectedPill />
1180
+ </RadioGroup>`,
1181
+ children: /* @__PURE__ */ jsx(PlanTiers, {})
1182
+ })
1183
+ }),
1184
+ /* @__PURE__ */ jsx(SubSection, {
1185
+ title: "A plan's figure, and prices in a list",
1186
+ description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "price={{ size: 'display' }}" }), " sets the plan's figure under its words, on the display face, for cards that sell a plan; a row's price stays at its end, lined up on the end edge, as in the delivery list. Whole amounts drop their pence."] }),
1187
+ children: /* @__PURE__ */ jsx(Example, {
1188
+ align: "fill",
1189
+ code: `
1190
+ <RadioGroup aria-label="Plan" variant="card" columns={3} defaultValue="growth" indicator={false}>
1191
+ <RadioGroupItem value="starter" label="Starter" price={{ free: true, size: 'display' }} selectedPill />
1192
+ <RadioGroupItem value="growth" label="Growth" badge={<Badge size="sm" tone="accent">Recommended</Badge>}
1193
+ price={{ amount: 25, compareAt: 35, unit: '/mo', unitLabel: 'per month', size: 'display', note: 'Billed £300 a year' }} selectedPill />
1194
+ <RadioGroupItem value="scale" label="Scale" price={{ amount: 99, from: true, unit: '/mo', unitLabel: 'per month', size: 'display' }} selectedPill />
1195
+ </RadioGroup>
1196
+
1197
+ <RadioGroup aria-label="Delivery" defaultValue="standard">
1198
+ <RadioGroupItem value="standard" label="Standard" description="3 to 5 working days" price={{ free: true }} />
1199
+ <RadioGroupItem value="next-day" label="Next day" description="Order by 2pm" price={{ amount: 4.95, compareAt: 6.95 }} />
1200
+ <RadioGroupItem value="timed" label="Timed slot" description="Choose a two-hour window" price={{ amount: 12 }} />
1201
+ </RadioGroup>`,
1202
+ children: /* @__PURE__ */ jsxs("div", {
1203
+ className: "radio-stack radio-stack--wide radio-stack--apart",
1204
+ children: [/* @__PURE__ */ jsx(PlanFigures, {}), /* @__PURE__ */ jsx(DeliveryPrices, {})]
1205
+ })
1206
+ })
1207
+ }),
1208
+ /* @__PURE__ */ jsx(SubSection, {
1209
+ title: "A summary of the choice",
1210
+ description: /* @__PURE__ */ jsxs("p", { children: [
1211
+ /* @__PURE__ */ jsx("code", { children: "RadioCardSummary" }),
1212
+ " shows the chosen option in the card's look with no radio: a choice fixed once made (a product's type, on edit), or one changed elsewhere, with an ",
1213
+ /* @__PURE__ */ jsx("code", { children: "action" }),
1214
+ " such as Change."
1215
+ ] }),
1216
+ children: /* @__PURE__ */ jsx(Example, {
1217
+ align: "fill",
1218
+ code: `
1219
+ <RadioCardSummary title="Physical product" description="Shipped or collected. Stock is counted." icon={<CubeIcon />}
1220
+ badge={<Badge size="sm">Set when created</Badge>} />
1221
+ <RadioCardSummary title="Growth" description="Unlimited products and two staff."
1222
+ price={{ amount: 25, compareAt: 35, unit: '/mo', unitLabel: 'per month' }}
1223
+ action={<Button size="sm" variant="secondary">Change</Button>} />`,
1224
+ children: /* @__PURE__ */ jsx(TypeSummary, {})
1225
+ })
1226
+ })
1227
+ ]
1228
+ }),
1229
+ /* @__PURE__ */ jsx(Section$1, {
1230
+ id: "both-themes",
1231
+ title: "In both themes",
1232
+ description: /* @__PURE__ */ jsx("p", { children: "A list with a chosen option and one that is off, and cards with a chosen tile, light and dark side by side." }),
1233
+ children: /* @__PURE__ */ jsx(ThemePair, {
1234
+ align: "fill",
1235
+ children: /* @__PURE__ */ jsxs("div", {
1236
+ className: "radio-group-pair",
1237
+ children: [/* @__PURE__ */ jsxs(RadioGroup, {
1238
+ "aria-label": "When stock runs out",
1239
+ defaultValue: "stop",
1240
+ children: [
1241
+ /* @__PURE__ */ jsx(RadioGroupItem, {
1242
+ value: "stop",
1243
+ label: "Stop selling",
1244
+ description: "Shows as sold out"
1245
+ }),
1246
+ /* @__PURE__ */ jsx(RadioGroupItem, {
1247
+ value: "continue",
1248
+ label: "Keep selling"
1249
+ }),
1250
+ /* @__PURE__ */ jsx(RadioGroupItem, {
1251
+ value: "hide",
1252
+ label: "Hide it",
1253
+ disabled: true
1254
+ })
1255
+ ]
1256
+ }), /* @__PURE__ */ jsxs(RadioGroup, {
1257
+ "aria-label": "Delivery speed",
1258
+ variant: "card",
1259
+ defaultValue: "next-day",
1260
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
1261
+ value: "standard",
1262
+ label: "Standard delivery",
1263
+ description: "2 to 4 working days",
1264
+ hint: "£3.95"
1265
+ }), /* @__PURE__ */ jsx(RadioGroupItem, {
1266
+ value: "next-day",
1267
+ label: "Next working day",
1268
+ description: "Order by 2pm",
1269
+ hint: "£6.95"
1270
+ })]
1271
+ })]
1272
+ })
1273
+ })
1274
+ }),
1275
+ /* @__PURE__ */ jsxs(Section$1, {
1276
+ id: "guidelines",
1277
+ title: "Guidelines",
1278
+ children: [
1279
+ /* @__PURE__ */ jsx(DoDont, {
1280
+ do: {
1281
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
1282
+ "aria-label": "Delivery speed",
1283
+ defaultValue: "standard",
1284
+ children: [
1285
+ /* @__PURE__ */ jsx(RadioGroupItem, {
1286
+ value: "standard",
1287
+ label: "Standard delivery"
1288
+ }),
1289
+ /* @__PURE__ */ jsx(RadioGroupItem, {
1290
+ value: "next-day",
1291
+ label: "Next working day"
1292
+ }),
1293
+ /* @__PURE__ */ jsx(RadioGroupItem, {
1294
+ value: "collect",
1295
+ label: "Click and collect"
1296
+ })
1297
+ ]
1298
+ }),
1299
+ caption: "Two to five options, all worth seeing before choosing."
1300
+ },
1301
+ dont: {
1302
+ children: /* @__PURE__ */ jsx(RadioGroup, {
1303
+ "aria-label": "Country",
1304
+ defaultValue: "england",
1305
+ className: "radio-group-squash",
1306
+ children: [
1307
+ "England",
1308
+ "Scotland",
1309
+ "Wales",
1310
+ "Northern Ireland",
1311
+ "Ireland",
1312
+ "France",
1313
+ "Germany"
1314
+ ].map((c) => /* @__PURE__ */ jsx(RadioGroupItem, {
1315
+ value: c.toLowerCase().replace(/ /g, "-"),
1316
+ label: c
1317
+ }, c))
1318
+ }),
1319
+ caption: "A long list that only needs the chosen one in view. Use a Select."
1320
+ }
1321
+ }),
1322
+ /* @__PURE__ */ jsx(DoDont, {
1323
+ do: {
1324
+ children: /* @__PURE__ */ jsx("div", {
1325
+ className: "radio-group-dodont",
1326
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
1327
+ "aria-label": "Customer accounts",
1328
+ variant: "card",
1329
+ size: "sm",
1330
+ defaultValue: "optional",
1331
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
1332
+ value: "optional",
1333
+ label: "Accounts optional",
1334
+ description: "Create one at checkout, or not"
1335
+ }), /* @__PURE__ */ jsx(RadioGroupItem, {
1336
+ value: "required",
1337
+ label: "Accounts required",
1338
+ description: "Sign in before paying"
1339
+ })]
1340
+ })
1341
+ }),
1342
+ caption: "Cards for a setting whose options need a sentence each to tell apart."
1343
+ },
1344
+ dont: {
1345
+ children: /* @__PURE__ */ jsx("div", {
1346
+ className: "radio-group-dodont",
1347
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
1348
+ "aria-label": "Weight unit",
1349
+ variant: "card",
1350
+ size: "sm",
1351
+ orientation: "horizontal",
1352
+ defaultValue: "kg",
1353
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
1354
+ value: "kg",
1355
+ label: "kg"
1356
+ }), /* @__PURE__ */ jsx(RadioGroupItem, {
1357
+ value: "lb",
1358
+ label: "lb"
1359
+ })]
1360
+ })
1361
+ }),
1362
+ caption: "Cards for a one-word choice: plain radios or a Segmented control say it with less."
1363
+ }
1364
+ }),
1365
+ /* @__PURE__ */ jsx(Guidelines, { items: [
1366
+ "Write labels as the outcome, in sentence case, and keep them parallel: \"Stop selling\", \"Keep selling\", \"Hide it\".",
1367
+ "Order options by how often they are chosen, or by a natural order (fastest to slowest, smallest to largest). Put a safe default first and choose it.",
1368
+ "Use descriptions for consequences people would otherwise have to guess, not to repeat the label.",
1369
+ "Changing a radio should not save on its own: settings with radios apply when the form is saved."
1370
+ ] }),
1371
+ /* @__PURE__ */ jsx(DocTable, {
1372
+ columns: ["To choose", "Use"],
1373
+ rows: [
1374
+ ["One of two to five, applied when the form is saved", "Radio group"],
1375
+ ["One of a few views or ranges, applied at once", /* @__PURE__ */ jsx(DocLink, {
1376
+ to: "/components/segmented-control",
1377
+ children: "Segmented control"
1378
+ })],
1379
+ ["One of many, or a list that grows", /* @__PURE__ */ jsx(DocLink, {
1380
+ to: "/components/select",
1381
+ children: "Select"
1382
+ })],
1383
+ ["Several independent choices", /* @__PURE__ */ jsx(DocLink, {
1384
+ to: "/components/checkbox",
1385
+ children: "Checkbox"
1386
+ })],
1387
+ ["On or off, straight away", /* @__PURE__ */ jsx(DocLink, {
1388
+ to: "/components/switch",
1389
+ children: "Switch"
1390
+ })]
1391
+ ]
1392
+ })
1393
+ ]
1394
+ }),
1395
+ /* @__PURE__ */ jsx(Section$1, {
1396
+ id: "accessibility",
1397
+ title: "Accessibility",
1398
+ children: /* @__PURE__ */ jsx(Guidelines, { items: [
1399
+ "Built on Radix RadioGroup: the group is one tab stop, landing on the chosen option. The arrow keys move between options and choose as they go; disabled options are skipped.",
1400
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1401
+ "Name the group: put it in a ",
1402
+ /* @__PURE__ */ jsx("code", { children: "Field" }),
1403
+ " (the group points ",
1404
+ /* @__PURE__ */ jsx("code", { children: "aria-labelledby" }),
1405
+ " at the Field's label), or pass ",
1406
+ /* @__PURE__ */ jsx("code", { children: "aria-label" }),
1407
+ " or ",
1408
+ /* @__PURE__ */ jsx("code", { children: "aria-labelledby" }),
1409
+ "."
1410
+ ] }),
1411
+ "Each radio is named by its label alone, and its description and hint are read after it.",
1412
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1413
+ "A hidden radio input goes with each option, so ",
1414
+ /* @__PURE__ */ jsx("code", { children: "name" }),
1415
+ " and ",
1416
+ /* @__PURE__ */ jsx("code", { children: "required" }),
1417
+ " work in forms, and resetting the form brings back the starting value."
1418
+ ] }),
1419
+ "The hit area round a 16px radio is at least 24px square, and clicking the label chooses too. A card is all hit area.",
1420
+ "Focus shows as a teal ring round the radio, or round the whole card.",
1421
+ "Under reduced motion the dot fades in at full size, and nothing sinks when pressed."
1422
+ ] })
1423
+ }),
1424
+ /* @__PURE__ */ jsxs(Section$1, {
1425
+ id: "props",
1426
+ title: "Props",
1427
+ children: [
1428
+ /* @__PURE__ */ jsx(PropsTable, {
1429
+ title: "RadioGroup",
1430
+ rows: [
1431
+ {
1432
+ name: "value",
1433
+ type: "string | null",
1434
+ description: "Controlled value. null for no choice yet."
1435
+ },
1436
+ {
1437
+ name: "defaultValue",
1438
+ type: "string",
1439
+ description: "Starting value when uncontrolled. Leave it out to start with nothing chosen."
1440
+ },
1441
+ {
1442
+ name: "onValueChange",
1443
+ type: "(value: string) => void",
1444
+ description: "Called with the chosen value. A typed value keeps it typed."
1445
+ },
1446
+ {
1447
+ name: "variant",
1448
+ type: "'list' | 'card'",
1449
+ default: "'list'",
1450
+ description: "Radios beside labels, or a tile per option."
1451
+ },
1452
+ {
1453
+ name: "orientation",
1454
+ type: "'vertical' | 'horizontal'",
1455
+ default: "'vertical'",
1456
+ description: "A column, or a row that wraps. Cards in a row share the width."
1457
+ },
1458
+ {
1459
+ name: "size",
1460
+ type: "'sm' | 'md'",
1461
+ default: "'md'",
1462
+ description: "14 or 16px radios."
1463
+ },
1464
+ {
1465
+ name: "invalid",
1466
+ type: "boolean",
1467
+ description: "Red rings and aria-invalid. In a Field, follows its error."
1468
+ },
1469
+ {
1470
+ name: "disabled",
1471
+ type: "boolean",
1472
+ default: "false",
1473
+ description: "Every option off."
1474
+ },
1475
+ {
1476
+ name: "name, required, form",
1477
+ type: "string, boolean, string",
1478
+ description: "For the hidden radio inputs that forms submit."
1479
+ },
1480
+ {
1481
+ name: "columns",
1482
+ type: "1 | 2 | 3 | 4",
1483
+ description: "Up to this many columns, as many as fit at 11.5rem."
1484
+ },
1485
+ {
1486
+ name: "activation",
1487
+ type: "'automatic' | 'manual'",
1488
+ default: "'automatic'",
1489
+ description: "Manual: the arrows only move; Space or a press chooses."
1490
+ },
1491
+ {
1492
+ name: "indicator",
1493
+ type: "boolean",
1494
+ default: "true",
1495
+ description: "Draws the cards' radios."
1496
+ },
1497
+ {
1498
+ name: "onBeforeValueChange",
1499
+ type: "(next, current) => boolean | void | Promise<boolean | void>",
1500
+ description: "Asked before a choice lands: false keeps the current one."
1501
+ },
1502
+ {
1503
+ name: "busy",
1504
+ type: "boolean",
1505
+ default: "false",
1506
+ description: "A call runs against the choice: every option held (aria-disabled), focus kept, the group aria-busy."
1507
+ }
1508
+ ]
1509
+ }),
1510
+ /* @__PURE__ */ jsx(PropsTable, {
1511
+ title: "RadioGroupItem",
1512
+ rows: [
1513
+ {
1514
+ name: "value",
1515
+ type: "string",
1516
+ required: true,
1517
+ description: "Unique within the group."
1518
+ },
1519
+ {
1520
+ name: "label",
1521
+ type: "ReactNode",
1522
+ description: "The option's name. Without it, the item is the bare radio, for a label of your own."
1523
+ },
1524
+ {
1525
+ name: "description",
1526
+ type: "ReactNode",
1527
+ description: "A quieter line under the label."
1528
+ },
1529
+ {
1530
+ name: "hint",
1531
+ type: "ReactNode",
1532
+ description: "Trailing detail, such as a price."
1533
+ },
1534
+ {
1535
+ name: "variant",
1536
+ type: "'list' | 'card'",
1537
+ description: "This option's look, whatever the group's variant."
1538
+ },
1539
+ {
1540
+ name: "id",
1541
+ type: "string",
1542
+ description: "The radio button's id, for a <label htmlFor> of your own. Generated when omitted."
1543
+ },
1544
+ {
1545
+ name: "disabled",
1546
+ type: "boolean",
1547
+ description: "This option off. Say why in its description."
1548
+ },
1549
+ {
1550
+ name: "icon",
1551
+ type: "ReactNode",
1552
+ description: "Card: a mark on a small tile that turns teal with the choice."
1553
+ },
1554
+ {
1555
+ name: "media",
1556
+ type: "ReactNode",
1557
+ description: "Card: a picture or sketch above the words."
1558
+ },
1559
+ {
1560
+ name: "badge",
1561
+ type: "ReactNode",
1562
+ description: "A badge beside the label, part of the radio's name."
1563
+ },
1564
+ {
1565
+ name: "selectedPill",
1566
+ type: "ReactNode | true",
1567
+ description: "Card: a pill while chosen; true says \"Selected\"."
1568
+ },
1569
+ {
1570
+ name: "indicator",
1571
+ type: "boolean",
1572
+ description: "Card: draws this card's radio, whatever the group says."
1573
+ },
1574
+ {
1575
+ name: "current",
1576
+ type: "boolean",
1577
+ default: "false",
1578
+ description: "The option there is now: focusable, aria-disabled, never chosen."
1579
+ },
1580
+ {
1581
+ name: "price",
1582
+ type: "Omit<PriceProps, 'align'>",
1583
+ description: "The option's price, drawn by Price and read after the name: at the end (size row), or under the words (size display)."
1584
+ }
1585
+ ]
1586
+ }),
1587
+ /* @__PURE__ */ jsx(PropsTable, {
1588
+ title: "RadioCardSummary",
1589
+ rows: [
1590
+ {
1591
+ name: "title",
1592
+ type: "ReactNode",
1593
+ required: true,
1594
+ description: "The chosen option's name."
1595
+ },
1596
+ {
1597
+ name: "description, hint, icon, media, badge",
1598
+ type: "ReactNode",
1599
+ description: "As on a card."
1600
+ },
1601
+ {
1602
+ name: "price",
1603
+ type: "Omit<PriceProps, 'align'>",
1604
+ description: "As on a card."
1605
+ },
1606
+ {
1607
+ name: "action",
1608
+ type: "ReactNode",
1609
+ description: "A control at the end, such as Change."
1610
+ },
1611
+ {
1612
+ name: "size",
1613
+ type: "'sm' | 'md'",
1614
+ default: "'md'",
1615
+ description: "The card's padding."
1616
+ }
1617
+ ]
1618
+ }),
1619
+ /* @__PURE__ */ jsxs("p", {
1620
+ className: "doc-section__description",
1621
+ children: [
1622
+ "On an item, ",
1623
+ /* @__PURE__ */ jsx("code", { children: "ref" }),
1624
+ " and native props go to the radio button; ",
1625
+ /* @__PURE__ */ jsx("code", { children: "className" }),
1626
+ " and",
1627
+ " ",
1628
+ /* @__PURE__ */ jsx("code", { children: "style" }),
1629
+ " go to the outer element (the card itself, for a card)."
1630
+ ]
1631
+ }),
1632
+ /* @__PURE__ */ jsx(Fragment$1, {})
1633
+ ]
1634
+ })
1635
+ ]
1636
+ });
1637
+ }
1638
+ //#endregion
1639
+ export { Page, Preview };