@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,1581 @@
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 { jsx, jsxs } from "react/jsx-runtime";
7
+ import { Badge, Button, Checkbox, CheckboxCard, CheckboxGroup, Field, Switch } from "@orbitcommerce/constellation";
8
+ import { BellIcon, DeviceMobileIcon, EnvelopeSimpleIcon, GiftIcon, TruckIcon, WrenchIcon } from "@orbitcommerce/constellation/icons";
9
+ //#region src/pages/components/_checkbox-group-examples.tsx
10
+ var BINS = [
11
+ "A1-01",
12
+ "A1-02",
13
+ "A1-03",
14
+ "A2-01",
15
+ "A2-02",
16
+ "A2-03",
17
+ "B1-01",
18
+ "B1-02",
19
+ "B1-03",
20
+ "B2-01",
21
+ "B2-02",
22
+ "B2-03",
23
+ "C1-01",
24
+ "C1-02"
25
+ ];
26
+ function BinsWell() {
27
+ const [value, setValue] = useState(["A1-02", "B1-01"]);
28
+ return /* @__PURE__ */ jsxs("div", {
29
+ className: "checkbox-stack",
30
+ children: [/* @__PURE__ */ jsx(CheckboxGroup, {
31
+ legend: "Bins (optional, all bins when none selected)",
32
+ columns: 2,
33
+ maxHeight: 192,
34
+ selectAll: true,
35
+ value,
36
+ onValueChange: setValue,
37
+ options: [...BINS.map((bin) => ({
38
+ value: bin,
39
+ label: bin
40
+ })), {
41
+ value: "none",
42
+ label: "No bin"
43
+ }]
44
+ }), /* @__PURE__ */ jsx(CheckboxGroup, {
45
+ legend: "Categories",
46
+ well: true,
47
+ options: [],
48
+ empty: "No categories yet. The count covers all physical products."
49
+ })]
50
+ });
51
+ }
52
+ var EXPORT_COLUMNS = [
53
+ "Order number",
54
+ "Order date",
55
+ "Customer name",
56
+ "Customer email",
57
+ "Delivery address",
58
+ "Delivery method",
59
+ "Items",
60
+ "Subtotal",
61
+ "VAT",
62
+ "Total",
63
+ "Payment status",
64
+ "Fulfilment status"
65
+ ];
66
+ function ExportColumns() {
67
+ const [value, setValue] = useState(EXPORT_COLUMNS.slice(0, 4));
68
+ return /* @__PURE__ */ jsx("div", {
69
+ className: "checkbox-stack",
70
+ children: /* @__PURE__ */ jsx(CheckboxGroup, {
71
+ legend: "Columns",
72
+ columns: 2,
73
+ maxHeight: 220,
74
+ summary: true,
75
+ min: 1,
76
+ keepMin: true,
77
+ shortcuts: [{
78
+ label: "Select all",
79
+ values: ({ all }) => all
80
+ }, {
81
+ label: "Minimal",
82
+ values: ["Order number"]
83
+ }],
84
+ value,
85
+ onValueChange: setValue,
86
+ options: EXPORT_COLUMNS.map((column) => ({
87
+ value: column,
88
+ label: column
89
+ }))
90
+ })
91
+ });
92
+ }
93
+ function OAuthScopes() {
94
+ const [value, setValue] = useState(["orders:read"]);
95
+ return /* @__PURE__ */ jsx("div", {
96
+ className: "checkbox-stack",
97
+ children: /* @__PURE__ */ jsx(CheckboxGroup, {
98
+ legend: "Scopes this app may use",
99
+ mono: true,
100
+ summary: true,
101
+ shortcuts: [{
102
+ label: "Select all read",
103
+ values: ({ all }) => all.filter((scope) => scope.endsWith(":read"))
104
+ }],
105
+ value,
106
+ onValueChange: setValue,
107
+ options: [
108
+ {
109
+ value: "orders:read",
110
+ label: "orders:read",
111
+ description: "See orders and their status."
112
+ },
113
+ {
114
+ value: "orders:write",
115
+ label: "orders:write",
116
+ description: "Change orders, refund and cancel.",
117
+ badge: /* @__PURE__ */ jsx(Badge, {
118
+ size: "sm",
119
+ tone: "warning",
120
+ children: "Sensitive"
121
+ })
122
+ },
123
+ {
124
+ value: "products:read",
125
+ label: "products:read",
126
+ description: "See products, prices and stock.",
127
+ meta: "Used by 2 apps"
128
+ },
129
+ {
130
+ value: "customers:read",
131
+ label: "customers:read",
132
+ description: "See names, emails and addresses."
133
+ }
134
+ ]
135
+ })
136
+ });
137
+ }
138
+ function VariantSections() {
139
+ const [value, setValue] = useState(["arden-oak"]);
140
+ return /* @__PURE__ */ jsx("div", {
141
+ className: "checkbox-stack",
142
+ children: /* @__PURE__ */ jsx(CheckboxGroup, {
143
+ legend: "Variants the discount applies to",
144
+ columns: 2,
145
+ well: true,
146
+ summary: true,
147
+ value,
148
+ onValueChange: setValue,
149
+ sections: [{
150
+ title: "Arden ergonomic chair",
151
+ options: [
152
+ {
153
+ value: "arden-oak",
154
+ label: "Oak",
155
+ code: "ARD-OAK"
156
+ },
157
+ {
158
+ value: "arden-ash",
159
+ label: "Ash",
160
+ code: "ARD-ASH"
161
+ },
162
+ {
163
+ value: "arden-walnut",
164
+ label: "Walnut",
165
+ code: "ARD-WAL"
166
+ }
167
+ ]
168
+ }, {
169
+ title: "Harbour standing desk",
170
+ options: [{
171
+ value: "harbour-120",
172
+ label: "120cm",
173
+ code: "HBR-120"
174
+ }, {
175
+ value: "harbour-140",
176
+ label: "140cm",
177
+ code: "HBR-140"
178
+ }]
179
+ }]
180
+ })
181
+ });
182
+ }
183
+ function ConsentTier() {
184
+ const [on, setOn] = useState(true);
185
+ const [value, setValue] = useState(["orders:write", "stock:write"]);
186
+ return /* @__PURE__ */ jsx("div", {
187
+ className: "checkbox-stack",
188
+ children: /* @__PURE__ */ jsx(CheckboxGroup, {
189
+ legend: "Live write",
190
+ gate: {
191
+ checked: on,
192
+ onCheckedChange: setOn,
193
+ description: "Change orders and stock as they happen, without asking each time."
194
+ },
195
+ collapsible: true,
196
+ columns: 2,
197
+ value,
198
+ onValueChange: setValue,
199
+ options: [
200
+ {
201
+ value: "orders:write",
202
+ label: "Change orders",
203
+ code: "orders:write"
204
+ },
205
+ {
206
+ value: "stock:write",
207
+ label: "Change stock levels",
208
+ code: "stock:write"
209
+ },
210
+ {
211
+ value: "prices:write",
212
+ label: "Change prices",
213
+ code: "prices:write",
214
+ disabled: true,
215
+ badge: /* @__PURE__ */ jsx(Badge, {
216
+ size: "sm",
217
+ children: "Not requested"
218
+ })
219
+ }
220
+ ]
221
+ })
222
+ });
223
+ }
224
+ function SystemRole() {
225
+ return /* @__PURE__ */ jsx("div", {
226
+ className: "checkbox-stack",
227
+ children: /* @__PURE__ */ jsx(CheckboxGroup, {
228
+ legend: "Store owner (a system role)",
229
+ readOnly: true,
230
+ summary: true,
231
+ defaultValue: [
232
+ "orders",
233
+ "customers",
234
+ "products"
235
+ ],
236
+ options: [
237
+ {
238
+ value: "orders",
239
+ label: "View and edit orders"
240
+ },
241
+ {
242
+ value: "customers",
243
+ label: "View customers"
244
+ },
245
+ {
246
+ value: "products",
247
+ label: "Edit products"
248
+ },
249
+ {
250
+ value: "billing",
251
+ label: "Change the plan"
252
+ }
253
+ ]
254
+ })
255
+ });
256
+ }
257
+ //#endregion
258
+ //#region src/pages/components/checkbox.tsx
259
+ function Preview() {
260
+ return /* @__PURE__ */ jsxs("div", {
261
+ className: "checkbox-preview",
262
+ children: [
263
+ /* @__PURE__ */ jsx(Checkbox, {
264
+ label: "Track stock",
265
+ defaultChecked: true
266
+ }),
267
+ /* @__PURE__ */ jsx(Checkbox, { label: "Continue selling when out of stock" }),
268
+ /* @__PURE__ */ jsx(Checkbox, {
269
+ label: "Show on the storefront",
270
+ checked: "indeterminate",
271
+ onCheckedChange: () => {}
272
+ })
273
+ ]
274
+ });
275
+ }
276
+ var CHANNELS = [
277
+ {
278
+ id: "store",
279
+ label: "Online store"
280
+ },
281
+ {
282
+ id: "google",
283
+ label: "Google Shopping"
284
+ },
285
+ {
286
+ id: "pos",
287
+ label: "Point of sale"
288
+ }
289
+ ];
290
+ function SelectAll() {
291
+ const [on, setOn] = useState({
292
+ store: true,
293
+ google: false,
294
+ pos: true
295
+ });
296
+ const count = Object.values(on).filter(Boolean).length;
297
+ const all = count === CHANNELS.length ? true : count === 0 ? false : "indeterminate";
298
+ return /* @__PURE__ */ jsxs("fieldset", {
299
+ className: "checkbox-fieldset",
300
+ children: [
301
+ /* @__PURE__ */ jsx("legend", {
302
+ className: "checkbox-legend",
303
+ children: "Sales channels"
304
+ }),
305
+ /* @__PURE__ */ jsx(Checkbox, {
306
+ label: "All channels",
307
+ checked: all,
308
+ onCheckedChange: (next) => setOn(Object.fromEntries(CHANNELS.map((c) => [c.id, next])))
309
+ }),
310
+ /* @__PURE__ */ jsx("div", {
311
+ className: "checkbox-children",
312
+ children: CHANNELS.map((c) => /* @__PURE__ */ jsx(Checkbox, {
313
+ label: c.label,
314
+ checked: !!on[c.id],
315
+ onCheckedChange: (next) => setOn((o) => ({
316
+ ...o,
317
+ [c.id]: next
318
+ }))
319
+ }, c.id))
320
+ })
321
+ ]
322
+ });
323
+ }
324
+ var PERMISSIONS = [
325
+ {
326
+ value: "orders",
327
+ label: "View orders",
328
+ description: "See every order and its status."
329
+ },
330
+ {
331
+ value: "customers",
332
+ label: "View customers",
333
+ description: "See names, addresses and order history."
334
+ },
335
+ {
336
+ value: "products",
337
+ label: "Edit products",
338
+ description: "Change prices, stock and descriptions."
339
+ },
340
+ {
341
+ value: "staff",
342
+ label: "Manage staff",
343
+ description: "Add or remove other people.",
344
+ disabled: true
345
+ }
346
+ ];
347
+ var NOTIFICATIONS = [
348
+ {
349
+ value: "email",
350
+ label: "Email",
351
+ description: "A daily summary at 7am.",
352
+ icon: /* @__PURE__ */ jsx(EnvelopeSimpleIcon, {})
353
+ },
354
+ {
355
+ value: "sms",
356
+ label: "Text message",
357
+ description: "A message when stock runs low.",
358
+ icon: /* @__PURE__ */ jsx(DeviceMobileIcon, {})
359
+ },
360
+ {
361
+ value: "push",
362
+ label: "Push",
363
+ description: "A notification in the Orbit app.",
364
+ icon: /* @__PURE__ */ jsx(BellIcon, {})
365
+ }
366
+ ];
367
+ var SALES_CHANNELS = [
368
+ {
369
+ value: "store",
370
+ label: "Online store"
371
+ },
372
+ {
373
+ value: "google",
374
+ label: "Google Shopping"
375
+ },
376
+ {
377
+ value: "pos",
378
+ label: "Point of sale"
379
+ }
380
+ ];
381
+ var ADD_ONS = [
382
+ {
383
+ value: "next-day",
384
+ title: "Next-day delivery",
385
+ description: "Order by 2pm and it arrives the next working day.",
386
+ meta: "£6.95",
387
+ icon: /* @__PURE__ */ jsx(TruckIcon, {})
388
+ },
389
+ {
390
+ value: "gift",
391
+ title: "Gift wrap",
392
+ description: "Wrapped in recycled paper with a handwritten note.",
393
+ meta: "£3.50",
394
+ icon: /* @__PURE__ */ jsx(GiftIcon, {})
395
+ },
396
+ {
397
+ value: "assembly",
398
+ title: "Assembly service",
399
+ description: "Two people build it in your room of choice.",
400
+ meta: "£45.00",
401
+ icon: /* @__PURE__ */ jsx(WrenchIcon, {})
402
+ }
403
+ ];
404
+ function Permissions() {
405
+ const [value, setValue] = useState(["orders"]);
406
+ return /* @__PURE__ */ jsx("div", {
407
+ className: "checkbox-stack",
408
+ children: /* @__PURE__ */ jsx(CheckboxGroup, {
409
+ legend: "Fulfilment permissions",
410
+ value,
411
+ onValueChange: setValue,
412
+ options: PERMISSIONS
413
+ })
414
+ });
415
+ }
416
+ function Notifications() {
417
+ return /* @__PURE__ */ jsx("div", {
418
+ className: "checkbox-stack",
419
+ children: /* @__PURE__ */ jsx(CheckboxGroup, {
420
+ legend: "Notifications",
421
+ variant: "card",
422
+ defaultValue: ["email"],
423
+ options: NOTIFICATIONS
424
+ })
425
+ });
426
+ }
427
+ function Formats() {
428
+ return /* @__PURE__ */ jsx("div", {
429
+ className: "checkbox-stack",
430
+ children: /* @__PURE__ */ jsx(CheckboxGroup, {
431
+ legend: "Invoice formats",
432
+ orientation: "horizontal",
433
+ defaultValue: ["paper"],
434
+ options: [
435
+ {
436
+ value: "paper",
437
+ label: "Paper"
438
+ },
439
+ {
440
+ value: "pdf",
441
+ label: "PDF"
442
+ },
443
+ {
444
+ value: "email",
445
+ label: "Email"
446
+ }
447
+ ]
448
+ })
449
+ });
450
+ }
451
+ function Limits() {
452
+ const [value, setValue] = useState([
453
+ "email",
454
+ "sms",
455
+ "push"
456
+ ]);
457
+ return /* @__PURE__ */ jsx("div", {
458
+ className: "checkbox-stack",
459
+ children: /* @__PURE__ */ jsx(CheckboxGroup, {
460
+ legend: "Notification channels",
461
+ min: 2,
462
+ max: 3,
463
+ value,
464
+ onValueChange: setValue,
465
+ options: [
466
+ {
467
+ value: "email",
468
+ label: "Email"
469
+ },
470
+ {
471
+ value: "sms",
472
+ label: "Text message"
473
+ },
474
+ {
475
+ value: "push",
476
+ label: "Push"
477
+ },
478
+ {
479
+ value: "post",
480
+ label: "Post"
481
+ }
482
+ ]
483
+ })
484
+ });
485
+ }
486
+ function ChannelsForm() {
487
+ const [value, setValue] = useState([]);
488
+ const [error, setError] = useState();
489
+ const [saved, setSaved] = useState(false);
490
+ const save = (event) => {
491
+ event.preventDefault();
492
+ if (value.length === 0) {
493
+ setError("Choose at least one channel");
494
+ setSaved(false);
495
+ return;
496
+ }
497
+ setSaved(true);
498
+ setError(void 0);
499
+ };
500
+ return /* @__PURE__ */ jsxs("form", {
501
+ noValidate: true,
502
+ onSubmit: save,
503
+ className: "checkbox-form",
504
+ children: [/* @__PURE__ */ jsx(Field, {
505
+ label: "Sales channels",
506
+ hint: "Where this product is sold.",
507
+ error,
508
+ children: /* @__PURE__ */ jsx(CheckboxGroup, {
509
+ value,
510
+ onValueChange: (next) => {
511
+ setValue(next);
512
+ setError(void 0);
513
+ setSaved(false);
514
+ },
515
+ options: SALES_CHANNELS
516
+ })
517
+ }), /* @__PURE__ */ jsxs("div", {
518
+ className: "checkbox-form__footer",
519
+ children: [/* @__PURE__ */ jsx("span", {
520
+ role: "status",
521
+ className: "checkbox-status",
522
+ children: saved ? "Sales channels saved" : null
523
+ }), /* @__PURE__ */ jsx(Button, {
524
+ type: "submit",
525
+ variant: "primary",
526
+ children: "Save"
527
+ })]
528
+ })]
529
+ });
530
+ }
531
+ function AddOns() {
532
+ const [chosen, setChosen] = useState(["gift"]);
533
+ return /* @__PURE__ */ jsx("div", {
534
+ className: "checkbox-stack",
535
+ children: ADD_ONS.map((addOn) => /* @__PURE__ */ jsx(CheckboxCard, {
536
+ title: addOn.title,
537
+ description: addOn.description,
538
+ meta: addOn.meta,
539
+ icon: addOn.icon,
540
+ checked: chosen.includes(addOn.value),
541
+ onCheckedChange: (next) => setChosen((list) => next ? [...list, addOn.value] : list.filter((each) => each !== addOn.value))
542
+ }, addOn.value))
543
+ });
544
+ }
545
+ function Invalid() {
546
+ return /* @__PURE__ */ jsxs("div", {
547
+ className: "checkbox-stack",
548
+ children: [/* @__PURE__ */ jsx(Checkbox, {
549
+ label: "Accept the terms of service",
550
+ invalid: true
551
+ }), /* @__PURE__ */ jsx(Field, {
552
+ label: "Marketing consent",
553
+ hint: "You can change this at any time.",
554
+ error: "Tick to continue",
555
+ children: /* @__PURE__ */ jsx(Checkbox, { label: "Send me offers by email" })
556
+ })]
557
+ });
558
+ }
559
+ var PLAYGROUND = [
560
+ {
561
+ prop: "label",
562
+ type: "text",
563
+ default: "Track stock"
564
+ },
565
+ {
566
+ prop: "description",
567
+ type: "text",
568
+ default: "Count units down as orders come in."
569
+ },
570
+ {
571
+ prop: "checked",
572
+ type: "select",
573
+ options: [
574
+ "false",
575
+ "true",
576
+ "indeterminate"
577
+ ],
578
+ default: "true",
579
+ toAttr: (v) => v === "false" ? "checked={false}" : v === "true" ? "checked" : "checked=\"indeterminate\""
580
+ },
581
+ {
582
+ prop: "size",
583
+ type: "select",
584
+ options: ["sm", "md"],
585
+ default: "md"
586
+ },
587
+ {
588
+ prop: "disabled",
589
+ type: "boolean",
590
+ default: false
591
+ }
592
+ ];
593
+ function Page() {
594
+ return /* @__PURE__ */ jsxs(DocPage, {
595
+ title: "Checkbox",
596
+ status: "new",
597
+ importNames: [
598
+ "Checkbox",
599
+ "CheckboxGroup",
600
+ "CheckboxCard"
601
+ ],
602
+ lead: "A box to tick: one of several independent choices, a row to act on in a table, or a setting that applies when the form is saved. A real checkbox underneath, with a tick that draws itself in.",
603
+ children: [
604
+ /* @__PURE__ */ jsx(Section$1, {
605
+ id: "playground",
606
+ title: "Playground",
607
+ children: /* @__PURE__ */ jsx(Playground, {
608
+ component: "Checkbox",
609
+ controls: PLAYGROUND,
610
+ render: (v) => /* @__PURE__ */ jsx(Checkbox, {
611
+ label: String(v.label) || void 0,
612
+ "aria-label": String(v.label) ? void 0 : "Track stock",
613
+ description: String(v.description) || void 0,
614
+ checked: v.checked === "indeterminate" ? "indeterminate" : v.checked === "true",
615
+ onCheckedChange: () => {},
616
+ size: v.size,
617
+ disabled: Boolean(v.disabled)
618
+ })
619
+ })
620
+ }),
621
+ /* @__PURE__ */ jsx(Section$1, {
622
+ id: "states",
623
+ title: "States",
624
+ description: /* @__PURE__ */ jsxs("p", { children: [
625
+ "Unticked, ticked and part-ticked (",
626
+ /* @__PURE__ */ jsx("code", { children: "checked=\"indeterminate\"" }),
627
+ ", for a parent whose children are mixed). Hover firms the edge; pressing sinks the box a little."
628
+ ] }),
629
+ children: /* @__PURE__ */ jsx(Example, {
630
+ align: "start",
631
+ code: `
632
+ <Checkbox label="Unticked" />
633
+ <Checkbox label="Ticked" defaultChecked />
634
+ <Checkbox label="Part-ticked" checked="indeterminate" onCheckedChange={toggleAll} />
635
+ <Checkbox label="Disabled" disabled />
636
+ <Checkbox label="Disabled and ticked" disabled defaultChecked />`,
637
+ children: /* @__PURE__ */ jsxs("div", {
638
+ className: "checkbox-grid",
639
+ children: [
640
+ /* @__PURE__ */ jsx(Checkbox, { label: "Unticked" }),
641
+ /* @__PURE__ */ jsx(Checkbox, {
642
+ label: "Ticked",
643
+ defaultChecked: true
644
+ }),
645
+ /* @__PURE__ */ jsx(Checkbox, {
646
+ label: "Part-ticked",
647
+ checked: "indeterminate",
648
+ onCheckedChange: () => {}
649
+ }),
650
+ /* @__PURE__ */ jsx(Checkbox, {
651
+ label: "Disabled",
652
+ disabled: true
653
+ }),
654
+ /* @__PURE__ */ jsx(Checkbox, {
655
+ label: "Disabled and ticked",
656
+ disabled: true,
657
+ defaultChecked: true
658
+ })
659
+ ]
660
+ })
661
+ })
662
+ }),
663
+ /* @__PURE__ */ jsx(Section$1, {
664
+ id: "description",
665
+ title: "With a description",
666
+ description: /* @__PURE__ */ jsx("p", { children: "A quieter second line explains the consequence. It is linked to the box for screen readers." }),
667
+ children: /* @__PURE__ */ jsx(Example, {
668
+ align: "start",
669
+ code: `
670
+ <Checkbox
671
+ label="Continue selling when out of stock"
672
+ description="Customers can still buy this product at zero stock. Useful for made-to-order items."
673
+ />`,
674
+ children: /* @__PURE__ */ jsx(Checkbox, {
675
+ label: "Continue selling when out of stock",
676
+ description: "Customers can still buy this product at zero stock. Useful for made-to-order items."
677
+ })
678
+ })
679
+ }),
680
+ /* @__PURE__ */ jsx(Section$1, {
681
+ id: "select-all",
682
+ title: "Select all",
683
+ description: /* @__PURE__ */ jsx("p", { children: "A parent box over a group shows part-ticked while its children are mixed. Ticking it ticks them all; unticking clears them." }),
684
+ children: /* @__PURE__ */ jsx(Example, {
685
+ align: "start",
686
+ code: `
687
+ const count = channels.filter((c) => on[c.id]).length
688
+ const all = count === channels.length ? true : count === 0 ? false : 'indeterminate'
689
+
690
+ <Checkbox label="All channels" checked={all} onCheckedChange={(next) => setAll(next)} />
691
+ {channels.map((c) => (
692
+ <Checkbox key={c.id} label={c.label} checked={on[c.id]} onCheckedChange={(next) => setOne(c.id, next)} />
693
+ ))}`,
694
+ children: /* @__PURE__ */ jsx(SelectAll, {})
695
+ })
696
+ }),
697
+ /* @__PURE__ */ jsx(Section$1, {
698
+ id: "in-a-table",
699
+ title: "In a table",
700
+ description: /* @__PURE__ */ jsxs("p", { children: [
701
+ "Without a ",
702
+ /* @__PURE__ */ jsx("code", { children: "label" }),
703
+ ", give the box an ",
704
+ /* @__PURE__ */ jsx("code", { children: "aria-label" }),
705
+ " that names the row (\"Select order #1043\"). See ",
706
+ /* @__PURE__ */ jsx(DocLink, {
707
+ to: "/components/table",
708
+ children: "Table"
709
+ }),
710
+ " for row selection."
711
+ ] }),
712
+ children: /* @__PURE__ */ jsx(Example, {
713
+ code: `<Checkbox aria-label="Select order #1043" checked={selected} onCheckedChange={setSelected} />`,
714
+ children: /* @__PURE__ */ jsx(Checkbox, {
715
+ "aria-label": "Select order #1043",
716
+ defaultChecked: true
717
+ })
718
+ })
719
+ }),
720
+ /* @__PURE__ */ jsxs(Section$1, {
721
+ id: "group",
722
+ title: "A group of checkboxes",
723
+ description: /* @__PURE__ */ jsxs("p", { children: [
724
+ /* @__PURE__ */ jsx("code", { children: "CheckboxGroup" }),
725
+ " takes one array of options and one value: several independent choices held under a legend, in a ",
726
+ /* @__PURE__ */ jsx("code", { children: "list" }),
727
+ " (boxes beside their labels, the default) or a ",
728
+ /* @__PURE__ */ jsx("code", { children: "card" }),
729
+ " (a tile per option), laid vertical or horizontal. Ticking reports the whole new array, in the options' order. It is the multi-choice counterpart of ",
730
+ /* @__PURE__ */ jsx(DocLink, {
731
+ to: "/components/radio-group",
732
+ children: "Radio group"
733
+ }),
734
+ "."
735
+ ] }),
736
+ children: [
737
+ /* @__PURE__ */ jsx(SubSection, {
738
+ title: "List (default)",
739
+ children: /* @__PURE__ */ jsx(Example, {
740
+ align: "fill",
741
+ code: `
742
+ const [value, setValue] = useState(['orders'])
743
+
744
+ <CheckboxGroup
745
+ legend="Fulfilment permissions"
746
+ value={value}
747
+ onValueChange={setValue}
748
+ options={[
749
+ { value: 'orders', label: 'View orders', description: 'See every order and its status.' },
750
+ { value: 'customers', label: 'View customers', description: 'See names, addresses and order history.' },
751
+ { value: 'products', label: 'Edit products', description: 'Change prices, stock and descriptions.' },
752
+ { value: 'staff', label: 'Manage staff', description: 'Add or remove other people.', disabled: true },
753
+ ]}
754
+ />`,
755
+ children: /* @__PURE__ */ jsx(Permissions, {})
756
+ })
757
+ }),
758
+ /* @__PURE__ */ jsx(SubSection, {
759
+ title: "Cards",
760
+ children: /* @__PURE__ */ jsx(Example, {
761
+ align: "fill",
762
+ code: `
763
+ <CheckboxGroup
764
+ legend="Notifications"
765
+ variant="card"
766
+ defaultValue={['email']}
767
+ options={[
768
+ { value: 'email', label: 'Email', description: 'A daily summary at 7am.', icon: <EnvelopeSimpleIcon /> },
769
+ { value: 'sms', label: 'Text message', description: 'A message when stock runs low.', icon: <DeviceMobileIcon /> },
770
+ { value: 'push', label: 'Push', description: 'A notification in the Orbit app.', icon: <BellIcon /> },
771
+ ]}
772
+ />`,
773
+ children: /* @__PURE__ */ jsx(Notifications, {})
774
+ })
775
+ }),
776
+ /* @__PURE__ */ jsx(SubSection, {
777
+ title: "Horizontal",
778
+ children: /* @__PURE__ */ jsx(Example, {
779
+ align: "fill",
780
+ code: `
781
+ <CheckboxGroup
782
+ legend="Invoice formats"
783
+ orientation="horizontal"
784
+ defaultValue={['paper']}
785
+ options={[
786
+ { value: 'paper', label: 'Paper' },
787
+ { value: 'pdf', label: 'PDF' },
788
+ { value: 'email', label: 'Email' },
789
+ ]}
790
+ />`,
791
+ children: /* @__PURE__ */ jsx(Formats, {})
792
+ })
793
+ }),
794
+ /* @__PURE__ */ jsxs(SubSection, {
795
+ title: "Min and max",
796
+ description: /* @__PURE__ */ jsxs("p", { children: [
797
+ /* @__PURE__ */ jsx("code", { children: "max" }),
798
+ " switches off the unchecked options once that many are ticked. ",
799
+ /* @__PURE__ */ jsx("code", { children: "min" }),
800
+ " marks the group",
801
+ " ",
802
+ /* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
803
+ " while fewer are, once it has been changed, and rings its boxes red as a Field's error does. Here three are ticked, so the fourth is off; clear one to free it again, and clear two to see the red."
804
+ ] }),
805
+ children: [/* @__PURE__ */ jsx(Example, {
806
+ align: "fill",
807
+ code: `
808
+ const [value, setValue] = useState(['email', 'sms', 'push'])
809
+
810
+ <CheckboxGroup
811
+ legend="Notification channels"
812
+ min={2}
813
+ max={3}
814
+ value={value}
815
+ onValueChange={setValue}
816
+ options={[
817
+ { value: 'email', label: 'Email' },
818
+ { value: 'sms', label: 'Text message' },
819
+ { value: 'push', label: 'Push' },
820
+ { value: 'post', label: 'Post' },
821
+ ]}
822
+ />`,
823
+ children: /* @__PURE__ */ jsx(Limits, {})
824
+ }), /* @__PURE__ */ jsxs(Note, {
825
+ title: "Min has no words of its own",
826
+ children: [
827
+ "Below ",
828
+ /* @__PURE__ */ jsx("code", { children: "min" }),
829
+ " the boxes ring red and the group is ",
830
+ /* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
831
+ ", so what a screen reader hears can be seen, but there is no message to say why. Check for it on save and show the Field's ",
832
+ /* @__PURE__ */ jsx("code", { children: "error" }),
833
+ ", as the example below does. ",
834
+ /* @__PURE__ */ jsx("code", { children: "max" }),
835
+ " does the work by itself: at the limit the rest are simply off."
836
+ ]
837
+ })]
838
+ }),
839
+ /* @__PURE__ */ jsx(SubSection, {
840
+ title: "In a Field, with an error",
841
+ description: /* @__PURE__ */ jsxs("p", { children: [
842
+ "In a ",
843
+ /* @__PURE__ */ jsx("code", { children: "Field" }),
844
+ " the group is named by the Field's label (no legend needed) and described by its hint or error. An error rings every box in red and sets ",
845
+ /* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
846
+ " on the group. Press Save with nothing ticked, then tick one to clear it."
847
+ ] }),
848
+ children: /* @__PURE__ */ jsx(Example, {
849
+ align: "fill",
850
+ code: `
851
+ const [value, setValue] = useState<string[]>([])
852
+ const [error, setError] = useState<string>()
853
+
854
+ const save = (event) => {
855
+ event.preventDefault()
856
+ if (value.length === 0) { setError('Choose at least one channel'); return }
857
+ setError(undefined)
858
+ }
859
+
860
+ <form noValidate onSubmit={save}>
861
+ <Field label="Sales channels" hint="Where this product is sold." error={error}>
862
+ <CheckboxGroup
863
+ value={value}
864
+ onValueChange={(next) => { setValue(next); setError(undefined) }}
865
+ options={[
866
+ { value: 'store', label: 'Online store' },
867
+ { value: 'google', label: 'Google Shopping' },
868
+ { value: 'pos', label: 'Point of sale' },
869
+ ]}
870
+ />
871
+ </Field>
872
+ <Button type="submit" variant="primary">Save</Button>
873
+ </form>`,
874
+ children: /* @__PURE__ */ jsx(ChannelsForm, {})
875
+ })
876
+ })
877
+ ]
878
+ }),
879
+ /* @__PURE__ */ jsx(Section$1, {
880
+ id: "cards",
881
+ title: "Checkbox cards",
882
+ description: /* @__PURE__ */ jsxs("p", { children: [
883
+ /* @__PURE__ */ jsx("code", { children: "CheckboxCard" }),
884
+ " is one checkbox drawn as a tile, for a choice that needs a sentence to tell it apart: a plan add-on, a permission, a delivery extra. The whole tile is the box, so a click anywhere ticks it; it takes a",
885
+ " ",
886
+ /* @__PURE__ */ jsx("code", { children: "title" }),
887
+ ", an optional ",
888
+ /* @__PURE__ */ jsx("code", { children: "description" }),
889
+ ", an ",
890
+ /* @__PURE__ */ jsx("code", { children: "icon" }),
891
+ " before the words and a",
892
+ " ",
893
+ /* @__PURE__ */ jsx("code", { children: "meta" }),
894
+ " figure at the end (a price, a count). For a set of them from one array, use",
895
+ " ",
896
+ /* @__PURE__ */ jsx("code", { children: "CheckboxGroup variant=\"card\"" }),
897
+ "; reach for the card directly when the options are not a group."
898
+ ] }),
899
+ children: /* @__PURE__ */ jsx(Example, {
900
+ align: "fill",
901
+ code: `
902
+ const [chosen, setChosen] = useState(['gift'])
903
+
904
+ {addOns.map((addOn) => (
905
+ <CheckboxCard
906
+ key={addOn.value}
907
+ title={addOn.title}
908
+ description={addOn.description}
909
+ meta={addOn.meta}
910
+ icon={addOn.icon}
911
+ checked={chosen.includes(addOn.value)}
912
+ onCheckedChange={(next) =>
913
+ setChosen((list) => (next ? [...list, addOn.value] : list.filter((each) => each !== addOn.value)))
914
+ }
915
+ />
916
+ ))}`,
917
+ children: /* @__PURE__ */ jsx(AddOns, {})
918
+ })
919
+ }),
920
+ /* @__PURE__ */ jsx(Section$1, {
921
+ id: "invalid",
922
+ title: "Invalid",
923
+ description: /* @__PURE__ */ jsxs("p", { children: [
924
+ "Give a box ",
925
+ /* @__PURE__ */ jsx("code", { children: "invalid" }),
926
+ " for the error look: a red edge on the box and ",
927
+ /* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
928
+ " on the input. A surrounding ",
929
+ /* @__PURE__ */ jsx("code", { children: "Field" }),
930
+ "'s error does the same, so a form usually sets it once on the Field rather than on each box."
931
+ ] }),
932
+ children: /* @__PURE__ */ jsx(Example, {
933
+ align: "fill",
934
+ code: `
935
+ <Checkbox label="Accept the terms of service" invalid />
936
+
937
+ <Field label="Marketing consent" hint="You can change this at any time." error="Tick to continue">
938
+ <Checkbox label="Send me offers by email" />
939
+ </Field>`,
940
+ children: /* @__PURE__ */ jsx(Invalid, {})
941
+ })
942
+ }),
943
+ /* @__PURE__ */ jsxs(Section$1, {
944
+ id: "long-lists",
945
+ title: "Long lists",
946
+ description: /* @__PURE__ */ jsx("p", { children: "A group with many options takes a few helpers of its own, so a dialog never builds them by hand: columns, a well that scrolls, a select-all row, a count with Clear all, shortcuts, sections that share one value, and a switch that turns the whole group on. Each is a prop; leave them out and the group is as above." }),
947
+ children: [
948
+ /* @__PURE__ */ jsx(SubSection, {
949
+ title: "Columns, a scrolling well and select all",
950
+ description: /* @__PURE__ */ jsxs("p", { children: [
951
+ /* @__PURE__ */ jsx("code", { children: "columns" }),
952
+ " sets the options in up to two or three columns, as many as fit at 12rem each, so a phone gets one. ",
953
+ /* @__PURE__ */ jsx("code", { children: "maxHeight" }),
954
+ " holds them in a hairline well that scrolls past that height, and",
955
+ " ",
956
+ /* @__PURE__ */ jsx("code", { children: "well" }),
957
+ " draws the well with no cap. ",
958
+ /* @__PURE__ */ jsx("code", { children: "selectAll" }),
959
+ " heads the list with a tri-state box that ticks or clears every option that can change. With no options, ",
960
+ /* @__PURE__ */ jsx("code", { children: "empty" }),
961
+ " says so in the well."
962
+ ] }),
963
+ children: /* @__PURE__ */ jsx(Example, {
964
+ align: "fill",
965
+ code: `
966
+ <CheckboxGroup
967
+ legend="Bins (optional, all bins when none selected)"
968
+ columns={2}
969
+ maxHeight={192}
970
+ selectAll
971
+ value={bins}
972
+ onValueChange={setBins}
973
+ options={binOptions}
974
+ />
975
+ <CheckboxGroup legend="Categories" well options={[]} empty="No categories yet. The count covers all physical products." />`,
976
+ children: /* @__PURE__ */ jsx(BinsWell, {})
977
+ })
978
+ }),
979
+ /* @__PURE__ */ jsx(SubSection, {
980
+ title: "A count, Clear all and shortcuts",
981
+ description: /* @__PURE__ */ jsxs("p", { children: [
982
+ /* @__PURE__ */ jsx("code", { children: "summary" }),
983
+ " adds a head line with how many are ticked and a Clear all button, which stays in place (and says it has nothing to do) when nothing is ticked, so focus is never dropped. ",
984
+ /* @__PURE__ */ jsx("code", { children: "shortcuts" }),
985
+ " are buttons that tick a set at once: a list of values, or a function of every option that can change. What a helper did is announced, since no box says it. Here ",
986
+ /* @__PURE__ */ jsxs("code", { children: ["min=", "{1}"] }),
987
+ " with ",
988
+ /* @__PURE__ */ jsx("code", { children: "keepMin" }),
989
+ " holds the last column: untick them all and the last one stays, with a quiet line saying why, not an error."
990
+ ] }),
991
+ children: /* @__PURE__ */ jsx(Example, {
992
+ align: "fill",
993
+ code: `
994
+ <CheckboxGroup
995
+ legend="Columns"
996
+ columns={2}
997
+ maxHeight={220}
998
+ summary
999
+ min={1}
1000
+ keepMin
1001
+ shortcuts={[
1002
+ { label: 'Select all', values: ({ all }) => all },
1003
+ { label: 'Minimal', values: ['Order number'] },
1004
+ ]}
1005
+ value={columns}
1006
+ onValueChange={setColumns}
1007
+ options={exportColumns}
1008
+ />`,
1009
+ children: /* @__PURE__ */ jsx(ExportColumns, {})
1010
+ })
1011
+ }),
1012
+ /* @__PURE__ */ jsx(SubSection, {
1013
+ title: "Codes, badges and a meta line",
1014
+ description: /* @__PURE__ */ jsxs("p", { children: [
1015
+ "An option can carry a ",
1016
+ /* @__PURE__ */ jsx("code", { children: "badge" }),
1017
+ " beside its label (part of the box's name, so it can say why an option is off), a ",
1018
+ /* @__PURE__ */ jsx("code", { children: "code" }),
1019
+ " in mono under it, and a quieter ",
1020
+ /* @__PURE__ */ jsx("code", { children: "meta" }),
1021
+ " line; both are read after the name. ",
1022
+ /* @__PURE__ */ jsx("code", { children: "mono" }),
1023
+ " sets the labels themselves in mono, for scopes and keys people read as code."
1024
+ ] }),
1025
+ children: /* @__PURE__ */ jsx(Example, {
1026
+ align: "fill",
1027
+ code: `
1028
+ <CheckboxGroup
1029
+ legend="Scopes this app may use"
1030
+ mono
1031
+ summary
1032
+ shortcuts={[{ label: 'Select all read', values: ({ all }) => all.filter((scope) => scope.endsWith(':read')) }]}
1033
+ value={scopes}
1034
+ onValueChange={setScopes}
1035
+ options={[
1036
+ { value: 'orders:read', label: 'orders:read', description: 'See orders and their status.' },
1037
+ { value: 'orders:write', label: 'orders:write', description: 'Change orders, refund and cancel.',
1038
+ badge: <Badge size="sm" tone="warning">Sensitive</Badge> },
1039
+ { value: 'products:read', label: 'products:read', description: 'See products, prices and stock.', meta: 'Used by 2 apps' },
1040
+ { value: 'customers:read', label: 'customers:read', description: 'See names, emails and addresses.' },
1041
+ ]}
1042
+ />`,
1043
+ children: /* @__PURE__ */ jsx(OAuthScopes, {})
1044
+ })
1045
+ }),
1046
+ /* @__PURE__ */ jsx(SubSection, {
1047
+ title: "Sections",
1048
+ description: /* @__PURE__ */ jsxs("p", { children: [
1049
+ /* @__PURE__ */ jsx("code", { children: "sections" }),
1050
+ ", in place of ",
1051
+ /* @__PURE__ */ jsx("code", { children: "options" }),
1052
+ ", sets titled groups in one group: each section is a small group of its own, named by its title, and they all share the one value, handed back in their order."
1053
+ ] }),
1054
+ children: /* @__PURE__ */ jsx(Example, {
1055
+ align: "fill",
1056
+ code: `
1057
+ <CheckboxGroup
1058
+ legend="Variants the discount applies to"
1059
+ columns={2}
1060
+ well
1061
+ summary
1062
+ value={variants}
1063
+ onValueChange={setVariants}
1064
+ sections={[
1065
+ { title: 'Arden ergonomic chair', options: [
1066
+ { value: 'arden-oak', label: 'Oak', code: 'ARD-OAK' },
1067
+ { value: 'arden-ash', label: 'Ash', code: 'ARD-ASH' },
1068
+ { value: 'arden-walnut', label: 'Walnut', code: 'ARD-WAL' },
1069
+ ] },
1070
+ { title: 'Harbour standing desk', options: [
1071
+ { value: 'harbour-120', label: '120cm', code: 'HBR-120' },
1072
+ { value: 'harbour-140', label: '140cm', code: 'HBR-140' },
1073
+ ] },
1074
+ ]}
1075
+ />`,
1076
+ children: /* @__PURE__ */ jsx(VariantSections, {})
1077
+ })
1078
+ }),
1079
+ /* @__PURE__ */ jsx(SubSection, {
1080
+ title: "A gate, and Show / Hide",
1081
+ description: /* @__PURE__ */ jsxs("p", { children: [
1082
+ /* @__PURE__ */ jsx("code", { children: "gate" }),
1083
+ " heads the group with a switch named by the legend, and draws the group as a card; its options are off while the switch is, so what turning it on gives can still be read. ",
1084
+ /* @__PURE__ */ jsx("code", { children: "collapsible" }),
1085
+ " ",
1086
+ "folds the list behind a toggle that counts the options; it starts open (",
1087
+ /* @__PURE__ */ jsx("code", { children: "defaultOpen" }),
1088
+ "), so what is granted is read before it is folded. An option that was not asked for is off, with a badge saying so."
1089
+ ] }),
1090
+ children: /* @__PURE__ */ jsx(Example, {
1091
+ align: "fill",
1092
+ code: `
1093
+ <CheckboxGroup
1094
+ legend="Live write"
1095
+ gate={{ checked: on, onCheckedChange: setOn, description: 'Change orders and stock as they happen, without asking each time.' }}
1096
+ collapsible
1097
+ columns={2}
1098
+ value={scopes}
1099
+ onValueChange={setScopes}
1100
+ options={[
1101
+ { value: 'orders:write', label: 'Change orders', code: 'orders:write' },
1102
+ { value: 'stock:write', label: 'Change stock levels', code: 'stock:write' },
1103
+ { value: 'prices:write', label: 'Change prices', code: 'prices:write', disabled: true,
1104
+ badge: <Badge size="sm">Not requested</Badge> },
1105
+ ]}
1106
+ />`,
1107
+ children: /* @__PURE__ */ jsx(ConsentTier, {})
1108
+ })
1109
+ }),
1110
+ /* @__PURE__ */ jsxs(SubSection, {
1111
+ title: "Read only",
1112
+ description: /* @__PURE__ */ jsxs("p", { children: [
1113
+ /* @__PURE__ */ jsx("code", { children: "readOnly" }),
1114
+ " shows what is ticked and changes nothing: a system role, a plan's fixed features. Unlike",
1115
+ " ",
1116
+ /* @__PURE__ */ jsx("code", { children: "disabled" }),
1117
+ ", every box stays in the tab order and at full strength, with ",
1118
+ /* @__PURE__ */ jsx("code", { children: "aria-readonly" }),
1119
+ ", and the helpers that would change it are left out. A lone ",
1120
+ /* @__PURE__ */ jsx("code", { children: "Checkbox" }),
1121
+ " takes ",
1122
+ /* @__PURE__ */ jsx("code", { children: "readOnly" }),
1123
+ " too."
1124
+ ] }),
1125
+ children: [/* @__PURE__ */ jsx(Example, {
1126
+ align: "fill",
1127
+ code: `
1128
+ <CheckboxGroup
1129
+ legend="Store owner (a system role)"
1130
+ readOnly
1131
+ summary
1132
+ defaultValue={['orders', 'customers', 'products']}
1133
+ options={[
1134
+ { value: 'orders', label: 'View and edit orders' },
1135
+ { value: 'customers', label: 'View customers' },
1136
+ { value: 'products', label: 'Edit products' },
1137
+ { value: 'billing', label: 'Change the plan' },
1138
+ ]}
1139
+ />`,
1140
+ children: /* @__PURE__ */ jsx(SystemRole, {})
1141
+ }), /* @__PURE__ */ jsxs(Note, {
1142
+ title: "Groups of permissions",
1143
+ children: [
1144
+ "For a role's permissions in collapsible groups, each with its own box and a search across them, use the",
1145
+ " ",
1146
+ /* @__PURE__ */ jsx(DocLink, {
1147
+ to: "/components/grouped-checklist",
1148
+ children: "Grouped checklist"
1149
+ }),
1150
+ "."
1151
+ ]
1152
+ })]
1153
+ })
1154
+ ]
1155
+ }),
1156
+ /* @__PURE__ */ jsx(Section$1, {
1157
+ id: "both-themes",
1158
+ title: "In both themes",
1159
+ children: /* @__PURE__ */ jsx(ThemePair, {
1160
+ align: "start",
1161
+ children: /* @__PURE__ */ jsxs("div", {
1162
+ className: "checkbox-pair",
1163
+ children: [
1164
+ /* @__PURE__ */ jsxs("div", {
1165
+ className: "checkbox-grid",
1166
+ children: [
1167
+ /* @__PURE__ */ jsx(Checkbox, { label: "Unticked" }),
1168
+ /* @__PURE__ */ jsx(Checkbox, {
1169
+ label: "Ticked",
1170
+ defaultChecked: true
1171
+ }),
1172
+ /* @__PURE__ */ jsx(Checkbox, {
1173
+ label: "Part-ticked",
1174
+ checked: "indeterminate",
1175
+ onCheckedChange: () => {}
1176
+ }),
1177
+ /* @__PURE__ */ jsx(Checkbox, {
1178
+ label: "Disabled",
1179
+ disabled: true
1180
+ })
1181
+ ]
1182
+ }),
1183
+ /* @__PURE__ */ jsx(CheckboxGroup, {
1184
+ legend: "Sales channels",
1185
+ defaultValue: ["store"],
1186
+ options: SALES_CHANNELS
1187
+ }),
1188
+ /* @__PURE__ */ jsx(CheckboxCard, {
1189
+ title: "Gift wrap",
1190
+ description: "Wrapped in recycled paper with a handwritten note.",
1191
+ meta: "£3.50",
1192
+ icon: /* @__PURE__ */ jsx(GiftIcon, {}),
1193
+ defaultChecked: true
1194
+ })
1195
+ ]
1196
+ })
1197
+ })
1198
+ }),
1199
+ /* @__PURE__ */ jsxs(Section$1, {
1200
+ id: "guidelines",
1201
+ title: "Guidelines",
1202
+ children: [
1203
+ /* @__PURE__ */ jsx(DoDont, {
1204
+ do: {
1205
+ children: /* @__PURE__ */ jsx(Checkbox, {
1206
+ label: "Add to newsletter",
1207
+ description: "Applies when you save the customer."
1208
+ }),
1209
+ caption: "A checkbox for a choice that takes effect when the form is saved."
1210
+ },
1211
+ dont: {
1212
+ children: /* @__PURE__ */ jsx(Checkbox, { label: "Store open" }),
1213
+ caption: "For a setting that applies the moment it is changed, use a Switch."
1214
+ }
1215
+ }),
1216
+ /* @__PURE__ */ jsx(DoDont, {
1217
+ do: {
1218
+ children: /* @__PURE__ */ jsx(Switch, {
1219
+ label: "Store open",
1220
+ defaultChecked: true
1221
+ }),
1222
+ caption: "Switch: on and off, straight away."
1223
+ },
1224
+ dont: {
1225
+ children: /* @__PURE__ */ jsxs("div", {
1226
+ className: "checkbox-grid",
1227
+ children: [/* @__PURE__ */ jsx(Checkbox, { label: "Standard delivery" }), /* @__PURE__ */ jsx(Checkbox, { label: "Next-day delivery" })]
1228
+ }),
1229
+ caption: "For one choice out of several, use a Segmented control or radios, not boxes."
1230
+ }
1231
+ }),
1232
+ /* @__PURE__ */ jsx(Guidelines, { items: ["Write the label as the thing that is true when ticked: \"Track stock\", not \"Don't track stock\".", "Put the box before its label, and keep groups in a column so the boxes line up."] })
1233
+ ]
1234
+ }),
1235
+ /* @__PURE__ */ jsx(Section$1, {
1236
+ id: "accessibility",
1237
+ title: "Accessibility",
1238
+ children: /* @__PURE__ */ jsx(Guidelines, { items: [
1239
+ "A native checkbox: Space toggles it, forms submit it, screen readers announce it. Part-ticked is announced as mixed.",
1240
+ "The label is the accessible name, and clicking it ticks the box. The description is linked with aria-describedby; on a card, so is the figure (the price), read after the description.",
1241
+ "The hit area is at least 24px square, even at the 14px size.",
1242
+ "Keyboard focus shows a teal ring round the box, or round the whole card; a click on a card does not ring it. With reduced motion the tick appears without drawing in.",
1243
+ "An option that is off dims its label by colour and fades its box, but keeps its description readable: say there why it is off."
1244
+ ] })
1245
+ }),
1246
+ /* @__PURE__ */ jsxs(Section$1, {
1247
+ id: "props",
1248
+ title: "Props",
1249
+ description: /* @__PURE__ */ jsx("p", { children: "Also accepts every native input attribute (name, value, required, aria-label)." }),
1250
+ children: [
1251
+ /* @__PURE__ */ jsx(PropsTable, { rows: [
1252
+ {
1253
+ name: "checked",
1254
+ type: "boolean | 'indeterminate'",
1255
+ description: "Controlled state."
1256
+ },
1257
+ {
1258
+ name: "defaultChecked",
1259
+ type: "boolean",
1260
+ default: "false",
1261
+ description: "Starting state when uncontrolled."
1262
+ },
1263
+ {
1264
+ name: "onCheckedChange",
1265
+ type: "(checked: boolean) => void",
1266
+ description: "Called with the new state."
1267
+ },
1268
+ {
1269
+ name: "label",
1270
+ type: "ReactNode",
1271
+ description: "Text to the right; the accessible name."
1272
+ },
1273
+ {
1274
+ name: "description",
1275
+ type: "ReactNode",
1276
+ description: "A quieter second line under the label."
1277
+ },
1278
+ {
1279
+ name: "size",
1280
+ type: "'sm' | 'md'",
1281
+ default: "'md'",
1282
+ description: "14 or 16px box."
1283
+ },
1284
+ {
1285
+ name: "invalid",
1286
+ type: "boolean",
1287
+ default: "false",
1288
+ description: "Red edge and aria-invalid. In a Field, follows its error."
1289
+ },
1290
+ {
1291
+ name: "disabled",
1292
+ type: "boolean",
1293
+ default: "false",
1294
+ description: "Cannot be changed; drops to 45%."
1295
+ },
1296
+ {
1297
+ name: "readOnly",
1298
+ type: "boolean",
1299
+ default: "false",
1300
+ description: "Shows the state and cannot be changed, but stays in the tab order with aria-readonly."
1301
+ }
1302
+ ] }),
1303
+ /* @__PURE__ */ jsx(DocTable, {
1304
+ columns: ["Use", "Instead of"],
1305
+ rows: [
1306
+ ["Several independent choices, applied on save", "Checkbox"],
1307
+ ["One setting that applies straight away", /* @__PURE__ */ jsx(DocLink, {
1308
+ to: "/components/switch",
1309
+ children: "Switch"
1310
+ })],
1311
+ ["One choice out of a few", /* @__PURE__ */ jsx(DocLink, {
1312
+ to: "/components/segmented-control",
1313
+ children: "Segmented control"
1314
+ })]
1315
+ ]
1316
+ }),
1317
+ /* @__PURE__ */ jsx(PropsTable, {
1318
+ title: "CheckboxGroup",
1319
+ rows: [
1320
+ {
1321
+ name: "options",
1322
+ type: "CheckboxGroupOption[]",
1323
+ description: "One entry per choice, in the order the values are handed back. Or give sections."
1324
+ },
1325
+ {
1326
+ name: "sections",
1327
+ type: "CheckboxGroupSection[]",
1328
+ description: "Titled sections ({ title, description, options }) in place of options, sharing one value."
1329
+ },
1330
+ {
1331
+ name: "legend",
1332
+ type: "ReactNode",
1333
+ description: "A visible legend above the options. Or name the group with aria-label, or a surrounding Field."
1334
+ },
1335
+ {
1336
+ name: "hideLegend",
1337
+ type: "boolean",
1338
+ default: "false",
1339
+ description: "Hides the legend from the eye, keeping it for assistive tech."
1340
+ },
1341
+ {
1342
+ name: "value",
1343
+ type: "string[]",
1344
+ description: "Controlled value: the checked options, in the options' order."
1345
+ },
1346
+ {
1347
+ name: "defaultValue",
1348
+ type: "string[]",
1349
+ description: "The options checked at first when uncontrolled."
1350
+ },
1351
+ {
1352
+ name: "onValueChange",
1353
+ type: "(value: string[]) => void",
1354
+ description: "Called with the new array of checked values, in the options' order."
1355
+ },
1356
+ {
1357
+ name: "variant",
1358
+ type: "'list' | 'card'",
1359
+ default: "'list'",
1360
+ description: "Boxes beside labels, or a tile per option."
1361
+ },
1362
+ {
1363
+ name: "orientation",
1364
+ type: "'vertical' | 'horizontal'",
1365
+ default: "'vertical'",
1366
+ description: "A column, or a row that wraps. Cards in a row share the width."
1367
+ },
1368
+ {
1369
+ name: "size",
1370
+ type: "'sm' | 'md'",
1371
+ default: "'md'",
1372
+ description: "14 or 16px boxes."
1373
+ },
1374
+ {
1375
+ name: "disabled",
1376
+ type: "boolean",
1377
+ default: "false",
1378
+ description: "Every option off."
1379
+ },
1380
+ {
1381
+ name: "invalid",
1382
+ type: "boolean",
1383
+ description: "Red boxes and aria-invalid. In a Field, follows its error."
1384
+ },
1385
+ {
1386
+ name: "name",
1387
+ type: "string",
1388
+ description: "One hidden input per checked value, for form submission."
1389
+ },
1390
+ {
1391
+ name: "min",
1392
+ type: "number",
1393
+ description: "At least this many: while fewer are, once it has been changed, the group is aria-invalid and its boxes ring red."
1394
+ },
1395
+ {
1396
+ name: "max",
1397
+ type: "number",
1398
+ description: "The unchecked options are switched off once this many are checked."
1399
+ },
1400
+ {
1401
+ name: "keepMin",
1402
+ type: "boolean",
1403
+ default: "false",
1404
+ description: "With min: holds the last min ticked boxes, saying why when one is pressed. Not an error."
1405
+ },
1406
+ {
1407
+ name: "columns",
1408
+ type: "1 | 2 | 3",
1409
+ description: "Up to this many columns, as many as fit at 12rem each."
1410
+ },
1411
+ {
1412
+ name: "maxHeight",
1413
+ type: "number | string",
1414
+ description: "Holds the options in a hairline well that scrolls past this height."
1415
+ },
1416
+ {
1417
+ name: "well",
1418
+ type: "boolean",
1419
+ default: "false",
1420
+ description: "Draws the well without a height cap."
1421
+ },
1422
+ {
1423
+ name: "empty",
1424
+ type: "ReactNode",
1425
+ description: "A quiet note in place of the options when there are none."
1426
+ },
1427
+ {
1428
+ name: "selectAll",
1429
+ type: "boolean | ReactNode",
1430
+ description: "A tri-state box heading the list that ticks and clears every option that can change. Text renames it."
1431
+ },
1432
+ {
1433
+ name: "summary",
1434
+ type: "boolean",
1435
+ default: "false",
1436
+ description: "A head line: \"N selected\" and Clear all."
1437
+ },
1438
+ {
1439
+ name: "shortcuts",
1440
+ type: "CheckboxGroupShortcut[]",
1441
+ description: "Helper buttons ({ label, values }) that tick a set at once; values is a list or a function of { all, value }."
1442
+ },
1443
+ {
1444
+ name: "mono",
1445
+ type: "boolean",
1446
+ default: "false",
1447
+ description: "Option labels in mono."
1448
+ },
1449
+ {
1450
+ name: "readOnly",
1451
+ type: "boolean",
1452
+ default: "false",
1453
+ description: "Shows what is ticked, changes nothing, leaves out the helpers."
1454
+ },
1455
+ {
1456
+ name: "gate",
1457
+ type: "CheckboxGroupGate",
1458
+ description: "A switch in the head ({ checked, defaultChecked, onCheckedChange, description, disabled, label }); the options are off while it is."
1459
+ },
1460
+ {
1461
+ name: "collapsible",
1462
+ type: "boolean",
1463
+ default: "false",
1464
+ description: "Folds the options behind a Show / Hide toggle that counts them."
1465
+ },
1466
+ {
1467
+ name: "defaultOpen",
1468
+ type: "boolean",
1469
+ default: "true",
1470
+ description: "With collapsible: whether the options start shown."
1471
+ },
1472
+ {
1473
+ name: "labels",
1474
+ type: "Partial<CheckboxGroupLabels>",
1475
+ description: "Its sentences in another language: selectAll, selected, clearAll, show, hide, held."
1476
+ }
1477
+ ]
1478
+ }),
1479
+ /* @__PURE__ */ jsx(PropsTable, {
1480
+ title: "CheckboxGroupOption",
1481
+ rows: [
1482
+ {
1483
+ name: "value",
1484
+ type: "string",
1485
+ required: true,
1486
+ description: "What the option is worth in the value array."
1487
+ },
1488
+ {
1489
+ name: "label",
1490
+ type: "ReactNode",
1491
+ required: true,
1492
+ description: "The option's name, and the box's accessible name."
1493
+ },
1494
+ {
1495
+ name: "description",
1496
+ type: "ReactNode",
1497
+ description: "A quieter line under the label."
1498
+ },
1499
+ {
1500
+ name: "disabled",
1501
+ type: "boolean",
1502
+ default: "false",
1503
+ description: "The option cannot be ticked."
1504
+ },
1505
+ {
1506
+ name: "icon",
1507
+ type: "ReactNode",
1508
+ description: "A mark at the start of a card option. Ignored by the list variant."
1509
+ },
1510
+ {
1511
+ name: "badge",
1512
+ type: "ReactNode",
1513
+ description: "A badge beside the label, part of the box's name: say why an option is off."
1514
+ },
1515
+ {
1516
+ name: "code",
1517
+ type: "ReactNode",
1518
+ description: "A code under the label, in mono, read after the name."
1519
+ },
1520
+ {
1521
+ name: "meta",
1522
+ type: "ReactNode",
1523
+ description: "A third, quieter line, read after the name."
1524
+ }
1525
+ ]
1526
+ }),
1527
+ /* @__PURE__ */ jsx(PropsTable, {
1528
+ title: "CheckboxCard",
1529
+ rows: [
1530
+ {
1531
+ name: "title",
1532
+ type: "ReactNode",
1533
+ required: true,
1534
+ description: "The card's name beside the box, and the input's accessible name."
1535
+ },
1536
+ {
1537
+ name: "description",
1538
+ type: "ReactNode",
1539
+ description: "A quieter line under the title, linked to the input."
1540
+ },
1541
+ {
1542
+ name: "icon",
1543
+ type: "ReactNode",
1544
+ description: "A mark at the start. Decorative, since the title says the same thing."
1545
+ },
1546
+ {
1547
+ name: "meta",
1548
+ type: "ReactNode",
1549
+ description: "Trailing detail, such as a price or a count. Read after the description."
1550
+ },
1551
+ {
1552
+ name: "checked, defaultChecked, onCheckedChange",
1553
+ type: "CheckboxProps",
1554
+ description: "The ticked state and its change, as on a Checkbox."
1555
+ },
1556
+ {
1557
+ name: "size",
1558
+ type: "'sm' | 'md'",
1559
+ default: "'md'",
1560
+ description: "14 or 16px box, and the card padding."
1561
+ },
1562
+ {
1563
+ name: "invalid",
1564
+ type: "boolean",
1565
+ description: "Red edge and aria-invalid. In a Field, follows its error."
1566
+ },
1567
+ {
1568
+ name: "disabled",
1569
+ type: "boolean",
1570
+ default: "false",
1571
+ description: "The card cannot be ticked."
1572
+ }
1573
+ ]
1574
+ })
1575
+ ]
1576
+ })
1577
+ ]
1578
+ });
1579
+ }
1580
+ //#endregion
1581
+ export { Page, Preview };