@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,492 @@
1
+ "use client";
2
+ import { d as Section$1, i as DocPage, m as ThemePair, o as Example, p as SubSection, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
3
+ import { useState } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Button, Card, Field, TreeSelect, walkTree } from "@orbitcommerce/constellation";
6
+ //#region src/pages/components/tree-select.tsx
7
+ var TAXONOMY = [
8
+ {
9
+ id: "furniture",
10
+ label: "Furniture",
11
+ children: [
12
+ {
13
+ id: "seating",
14
+ label: "Seating",
15
+ children: [
16
+ {
17
+ id: "task-chairs",
18
+ label: "Task chairs",
19
+ keywords: "office swivel"
20
+ },
21
+ {
22
+ id: "lounge-chairs",
23
+ label: "Lounge chairs"
24
+ },
25
+ {
26
+ id: "stools",
27
+ label: "Stools"
28
+ }
29
+ ]
30
+ },
31
+ {
32
+ id: "desks",
33
+ label: "Desks",
34
+ children: [{
35
+ id: "standing-desks",
36
+ label: "Standing desks"
37
+ }, {
38
+ id: "corner-desks",
39
+ label: "Corner desks"
40
+ }]
41
+ },
42
+ {
43
+ id: "storage",
44
+ label: "Storage",
45
+ children: [{
46
+ id: "pedestals",
47
+ label: "Pedestals"
48
+ }, {
49
+ id: "bookcases",
50
+ label: "Bookcases"
51
+ }]
52
+ }
53
+ ]
54
+ },
55
+ {
56
+ id: "lighting",
57
+ label: "Lighting",
58
+ children: [{
59
+ id: "desk-lamps",
60
+ label: "Desk lamps"
61
+ }, {
62
+ id: "floor-lamps",
63
+ label: "Floor lamps"
64
+ }]
65
+ },
66
+ {
67
+ id: "accessories",
68
+ label: "Desk accessories",
69
+ children: [{
70
+ id: "monitor-arms",
71
+ label: "Monitor arms"
72
+ }, {
73
+ id: "cable-trays",
74
+ label: "Cable trays"
75
+ }]
76
+ },
77
+ {
78
+ id: "gift-cards",
79
+ label: "Gift cards"
80
+ }
81
+ ];
82
+ var INDEX = /* @__PURE__ */ new Map();
83
+ walkTree(TAXONOMY, (node, _depth, parent) => INDEX.set(node.id, {
84
+ node,
85
+ parent: parent ? parent.id : null
86
+ }));
87
+ var wait = (value, ms = 600) => new Promise((resolve) => window.setTimeout(() => resolve(value), ms));
88
+ var thin = ({ children, ...node }) => ({
89
+ ...node,
90
+ hasChildren: (children?.length ?? 0) > 0
91
+ });
92
+ var pathOf = (id) => {
93
+ const trail = [];
94
+ for (let at = id; at; at = INDEX.get(at)?.parent) trail.unshift(thin(INDEX.get(at).node));
95
+ return trail;
96
+ };
97
+ var server = {
98
+ children: (parentId) => wait((parentId === null ? TAXONOMY : INDEX.get(parentId)?.node.children ?? []).map(thin)),
99
+ path: (id) => wait(pathOf(id), 400),
100
+ search: (term) => {
101
+ const needle = term.toLowerCase();
102
+ const hits = [];
103
+ for (const [id, { node }] of INDEX) if (`${node.label} ${node.keywords ?? ""}`.toLowerCase().includes(needle)) hits.push({
104
+ ...thin(node),
105
+ ancestors: pathOf(id).slice(0, -1).map(({ id: stepId, label }) => ({
106
+ id: stepId,
107
+ label
108
+ }))
109
+ });
110
+ return wait(hits, 500);
111
+ }
112
+ };
113
+ function Preview() {
114
+ return /* @__PURE__ */ jsx("div", {
115
+ style: { width: 232 },
116
+ children: /* @__PURE__ */ jsx(TreeSelect, {
117
+ "aria-label": "Category",
118
+ size: "sm",
119
+ items: TAXONOMY,
120
+ defaultValue: "task-chairs"
121
+ })
122
+ });
123
+ }
124
+ function ServerExample() {
125
+ const [value, setValue] = useState("standing-desks");
126
+ return /* @__PURE__ */ jsxs("div", {
127
+ className: "tree-select-field",
128
+ children: [/* @__PURE__ */ jsx(Field, {
129
+ label: "Category",
130
+ hint: "Browse a level at a time, or type three letters to search every level.",
131
+ children: /* @__PURE__ */ jsx(TreeSelect, {
132
+ value,
133
+ onValueChange: setValue,
134
+ loadChildren: server.children,
135
+ loadPath: server.path,
136
+ onSearch: server.search,
137
+ placeholder: "Choose a category"
138
+ })
139
+ }), /* @__PURE__ */ jsxs("p", {
140
+ className: "tree-select-value",
141
+ children: ["Chosen: ", value ?? "none"]
142
+ })]
143
+ });
144
+ }
145
+ function InlineExample() {
146
+ const [value, setValue] = useState(null);
147
+ return /* @__PURE__ */ jsxs(Card, {
148
+ padding: "md",
149
+ className: "tree-select-dialog",
150
+ children: [
151
+ /* @__PURE__ */ jsx("h4", {
152
+ className: "tree-select-dialog__title",
153
+ children: "Set the category"
154
+ }),
155
+ /* @__PURE__ */ jsx(TreeSelect, {
156
+ presentation: "inline",
157
+ "aria-label": "Category",
158
+ items: TAXONOMY,
159
+ noneOption: true,
160
+ value,
161
+ onValueChange: setValue,
162
+ maxHeight: 260
163
+ }),
164
+ /* @__PURE__ */ jsxs("p", {
165
+ className: "tree-select-dialog__note",
166
+ children: [
167
+ "Changes ",
168
+ /* @__PURE__ */ jsx("strong", { children: "12 products" }),
169
+ " to ",
170
+ value ? INDEX.get(value)?.node.label : "no category",
171
+ "."
172
+ ]
173
+ }),
174
+ /* @__PURE__ */ jsxs("div", {
175
+ className: "tree-select-dialog__actions",
176
+ children: [/* @__PURE__ */ jsx(Button, {
177
+ variant: "secondary",
178
+ children: "Cancel"
179
+ }), /* @__PURE__ */ jsx(Button, {
180
+ variant: "primary",
181
+ children: "Update"
182
+ })]
183
+ })
184
+ ]
185
+ });
186
+ }
187
+ function Page() {
188
+ return /* @__PURE__ */ jsxs(DocPage, {
189
+ title: "Tree select",
190
+ status: "new",
191
+ importNames: ["TreeSelect"],
192
+ lead: "Picks one node of a tree, a category or a taxonomy, one level at a time. The field is the search box; the list under it shows one level, a row's chevron goes into it and the back row comes out. Any level can be picked, and three letters search every level.",
193
+ children: [
194
+ /* @__PURE__ */ jsx(Section$1, {
195
+ id: "basics",
196
+ title: "Basics",
197
+ description: /* @__PURE__ */ jsxs("p", { children: [
198
+ "Give it the tree as ",
199
+ /* @__PURE__ */ jsx("code", { children: "items" }),
200
+ ". The list opens on the top level, or on the level that holds the value. Press a row to pick it, whatever its level; press its chevron, or the right arrow, to see what is in it. The back row, the breadcrumb, the left arrow and Backspace in an empty field go back up. Fewer than three letters filter the level on show; three or more search the whole tree and list each hit with its path."
201
+ ] }),
202
+ children: /* @__PURE__ */ jsx(Example, {
203
+ align: "fill",
204
+ minHeight: 460,
205
+ code: `
206
+ <Field label="Category">
207
+ <TreeSelect items={taxonomy} value={categoryId} onValueChange={setCategoryId} placeholder="Choose a category" />
208
+ </Field>`,
209
+ children: /* @__PURE__ */ jsx("div", {
210
+ className: "tree-select-field",
211
+ children: /* @__PURE__ */ jsx(Field, {
212
+ label: "Category",
213
+ children: /* @__PURE__ */ jsx(TreeSelect, {
214
+ items: TAXONOMY,
215
+ defaultValue: "lounge-chairs",
216
+ placeholder: "Choose a category"
217
+ })
218
+ })
219
+ })
220
+ })
221
+ }),
222
+ /* @__PURE__ */ jsx(Section$1, {
223
+ id: "server",
224
+ title: "From a server, a level at a time",
225
+ description: /* @__PURE__ */ jsxs("p", { children: [
226
+ "For a taxonomy too big to send at once, ",
227
+ /* @__PURE__ */ jsx("code", { children: "loadChildren(parentId)" }),
228
+ " loads one level (the top when the id is ",
229
+ /* @__PURE__ */ jsx("code", { children: "null" }),
230
+ ") the first time it is shown, and keeps it. ",
231
+ /* @__PURE__ */ jsx("code", { children: "loadPath(id)" }),
232
+ " gives the nodes from the top down to a saved value, so the list can open where it sits, and ",
233
+ /* @__PURE__ */ jsx("code", { children: "valueLabel" }),
234
+ " names it before anything has loaded (without it, the field asks ",
235
+ /* @__PURE__ */ jsx("code", { children: "loadPath" }),
236
+ " for the name as the value appears, and says Loading meanwhile). ",
237
+ /* @__PURE__ */ jsx("code", { children: "loadChildren" }),
238
+ " is called as TreeView's and TreeChecklist's are, with the parent's id and the parent. ",
239
+ /* @__PURE__ */ jsx("code", { children: "onSearch(term, signal)" }),
240
+ " searches every level 300ms after the typing stops; give each hit its ",
241
+ /* @__PURE__ */ jsx("code", { children: "ancestors" }),
242
+ " for its path. A level or a search that fails says so with Try again (Enter from the keyboard)."
243
+ ] }),
244
+ children: /* @__PURE__ */ jsx(Example, {
245
+ align: "fill",
246
+ minHeight: 460,
247
+ code: `
248
+ <TreeSelect
249
+ value={categoryId}
250
+ valueLabel={product.categoryName}
251
+ onValueChange={setCategoryId}
252
+ loadChildren={(parentId) => api.taxonomies.children(parentId)}
253
+ loadPath={(id) => api.taxonomies.path(id)}
254
+ onSearch={(term, signal) => api.taxonomies.search(term, { signal })}
255
+ />`,
256
+ children: /* @__PURE__ */ jsx(ServerExample, {})
257
+ })
258
+ }),
259
+ /* @__PURE__ */ jsx(Section$1, {
260
+ id: "none",
261
+ title: "Clearing",
262
+ description: /* @__PURE__ */ jsxs("p", { children: [
263
+ "A chosen value has a clear button at the end of the closed field (",
264
+ /* @__PURE__ */ jsxs("code", { children: ["clearable=", "{false}"] }),
265
+ " takes it away). ",
266
+ /* @__PURE__ */ jsx("code", { children: "noneOption" }),
267
+ " leads the top level with \"None\", for a field where no category is a choice in its own right."
268
+ ] }),
269
+ children: /* @__PURE__ */ jsx(ThemePair, { children: /* @__PURE__ */ jsx("div", {
270
+ className: "tree-select-field",
271
+ children: /* @__PURE__ */ jsx(TreeSelect, {
272
+ "aria-label": "Parent category",
273
+ items: TAXONOMY,
274
+ defaultValue: "desks",
275
+ noneOption: true
276
+ })
277
+ }) })
278
+ }),
279
+ /* @__PURE__ */ jsx(Section$1, {
280
+ id: "inline",
281
+ title: "Inline, for a dialog",
282
+ description: /* @__PURE__ */ jsxs("p", { children: [
283
+ /* @__PURE__ */ jsx("code", { children: "presentation=\"inline\"" }),
284
+ " draws the whole tree in place under a filter, with \"None\" first, as a dialog that sets one category on many products does. It is a ",
285
+ /* @__PURE__ */ jsx("code", { children: "TreeView" }),
286
+ ": the arrows move through it, the right arrow opens a branch, Enter or a press chooses. The filter keeps the rows that match and the rows above them."
287
+ ] }),
288
+ children: /* @__PURE__ */ jsx(Example, {
289
+ align: "fill",
290
+ code: `
291
+ <TreeSelect presentation="inline" aria-label="Category" items={taxonomy} noneOption value={value} onValueChange={setValue} />`,
292
+ children: /* @__PURE__ */ jsx(InlineExample, {})
293
+ })
294
+ }),
295
+ /* @__PURE__ */ jsx(Section$1, {
296
+ id: "states",
297
+ title: "Waiting and failing",
298
+ description: /* @__PURE__ */ jsx("p", { children: "While a level is on its way the list holds placeholder rows; a level that failed says so with Try again. Both here are held still, inline: the first level never comes, the second fails. The attached list shows the same in its sheet, and a search on its way or failed says so there too." }),
299
+ children: /* @__PURE__ */ jsx(ThemePair, { children: /* @__PURE__ */ jsxs("div", {
300
+ className: "tree-select-sizes",
301
+ children: [/* @__PURE__ */ jsx(TreeSelect, {
302
+ presentation: "inline",
303
+ "aria-label": "Category, loading",
304
+ loadChildren: () => new Promise(() => {}),
305
+ maxHeight: 180
306
+ }), /* @__PURE__ */ jsx(TreeSelect, {
307
+ presentation: "inline",
308
+ "aria-label": "Category, failed",
309
+ loadChildren: () => Promise.reject(/* @__PURE__ */ new Error("offline")),
310
+ maxHeight: 180
311
+ })]
312
+ }) })
313
+ }),
314
+ /* @__PURE__ */ jsxs(Section$1, {
315
+ id: "sizes",
316
+ title: "Sizes and presentation",
317
+ children: [/* @__PURE__ */ jsx(SubSection, {
318
+ title: "Sizes",
319
+ description: /* @__PURE__ */ jsxs("p", { children: [
320
+ /* @__PURE__ */ jsx("code", { children: "sm" }),
321
+ ", ",
322
+ /* @__PURE__ */ jsx("code", { children: "md" }),
323
+ " and ",
324
+ /* @__PURE__ */ jsx("code", { children: "lg" }),
325
+ ", the Input's heights. ",
326
+ /* @__PURE__ */ jsx("code", { children: "presentation=\"popover\"" }),
327
+ " ",
328
+ "floats the list as a sheet a little below the field, as one under 280px wide always does."
329
+ ] }),
330
+ children: /* @__PURE__ */ jsx(ThemePair, { children: /* @__PURE__ */ jsxs("div", {
331
+ className: "tree-select-sizes",
332
+ children: [
333
+ /* @__PURE__ */ jsx(TreeSelect, {
334
+ "aria-label": "Small",
335
+ size: "sm",
336
+ items: TAXONOMY,
337
+ defaultValue: "stools"
338
+ }),
339
+ /* @__PURE__ */ jsx(TreeSelect, {
340
+ "aria-label": "Medium",
341
+ items: TAXONOMY,
342
+ defaultValue: "stools"
343
+ }),
344
+ /* @__PURE__ */ jsx(TreeSelect, {
345
+ "aria-label": "Large",
346
+ size: "lg",
347
+ items: TAXONOMY,
348
+ defaultValue: "stools",
349
+ presentation: "popover"
350
+ })
351
+ ]
352
+ }) })
353
+ }), /* @__PURE__ */ jsx(SubSection, {
354
+ title: "Disabled and invalid",
355
+ children: /* @__PURE__ */ jsx(ThemePair, { children: /* @__PURE__ */ jsxs("div", {
356
+ className: "tree-select-sizes",
357
+ children: [/* @__PURE__ */ jsx(TreeSelect, {
358
+ "aria-label": "Disabled",
359
+ items: TAXONOMY,
360
+ defaultValue: "stools",
361
+ disabled: true
362
+ }), /* @__PURE__ */ jsx(Field, {
363
+ label: "Category",
364
+ error: "Choose a category",
365
+ children: /* @__PURE__ */ jsx(TreeSelect, {
366
+ items: TAXONOMY,
367
+ placeholder: "Choose a category"
368
+ })
369
+ })]
370
+ }) })
371
+ })]
372
+ }),
373
+ /* @__PURE__ */ jsx(Section$1, {
374
+ id: "accessibility",
375
+ title: "Accessibility",
376
+ children: /* @__PURE__ */ jsx(Guidelines, { items: [
377
+ "It is the ARIA combobox: focus stays in the field, the list is a listbox, and the row the keyboard is on is its active descendant.",
378
+ "A row that holds more says so in its description; the right arrow goes in (the left on a right-to-left page), and the left arrow, or Backspace in an empty field, comes back out to the row it went in from.",
379
+ "Arriving at a level says its name and how many rows it holds; a search says how many it found; a pick says what was chosen as the list closes.",
380
+ "The chevrons, the back row and the breadcrumb are for a pointer: the keyboard has the arrows, so they stay out of the tab order and never put a control inside an option.",
381
+ "Inline, it is a tree with one stop in the tab order after the filter."
382
+ ] })
383
+ }),
384
+ /* @__PURE__ */ jsx(Section$1, {
385
+ id: "props",
386
+ title: "Props",
387
+ children: /* @__PURE__ */ jsx(PropsTable, { rows: [
388
+ {
389
+ name: "items",
390
+ type: "TreeNode[]",
391
+ description: "The tree, for one you hold."
392
+ },
393
+ {
394
+ name: "loadChildren",
395
+ type: "(parentId: string | null, parent?) => Promise<TreeNode[]>",
396
+ description: "Loads a level the first time it shows, and keeps it."
397
+ },
398
+ {
399
+ name: "loadPath",
400
+ type: "(id) => Promise<TreeNode[]>",
401
+ description: "The nodes from the top down to a value, so the list opens where it sits."
402
+ },
403
+ {
404
+ name: "onSearch",
405
+ type: "(term, signal) => Promise<TreeSelectHit[]>",
406
+ description: "Searches every level; without it the tree you hold is searched."
407
+ },
408
+ {
409
+ name: "minSearchLength",
410
+ type: "number",
411
+ default: "3",
412
+ description: "Letters before a search covers every level."
413
+ },
414
+ {
415
+ name: "searchDelay",
416
+ type: "number",
417
+ default: "300",
418
+ description: "Milliseconds after the typing stops."
419
+ },
420
+ {
421
+ name: "value / defaultValue",
422
+ type: "string | null",
423
+ description: "The chosen node’s id."
424
+ },
425
+ {
426
+ name: "onValueChange",
427
+ type: "(value, node?) => void",
428
+ description: "Called with the chosen id, or null."
429
+ },
430
+ {
431
+ name: "valueLabel",
432
+ type: "string",
433
+ description: "Names a value the tree has not loaded yet."
434
+ },
435
+ {
436
+ name: "noneOption",
437
+ type: "boolean",
438
+ default: "false",
439
+ description: "Leads the top level with None."
440
+ },
441
+ {
442
+ name: "clearable",
443
+ type: "boolean",
444
+ default: "true",
445
+ description: "A clear button in the closed field."
446
+ },
447
+ {
448
+ name: "presentation",
449
+ type: "'attached' | 'popover' | 'inline'",
450
+ default: "'attached'",
451
+ description: "Unfolds from the field, floats, or draws the tree in place."
452
+ },
453
+ {
454
+ name: "size",
455
+ type: "'sm' | 'md' | 'lg'",
456
+ default: "'md'",
457
+ description: "The Input’s heights."
458
+ },
459
+ {
460
+ name: "maxHeight",
461
+ type: "number | string",
462
+ default: "384",
463
+ description: "Inline: the tree’s height before it scrolls."
464
+ },
465
+ {
466
+ name: "name",
467
+ type: "string",
468
+ description: "A hidden input carries the value for a form."
469
+ },
470
+ {
471
+ name: "open / defaultOpen / onOpenChange",
472
+ type: "boolean",
473
+ description: "The list’s open state."
474
+ },
475
+ {
476
+ name: "labels",
477
+ type: "Partial<TreeSelectLabels>",
478
+ description: "Every word it says (treeSelectLabels)."
479
+ },
480
+ {
481
+ name: "locale",
482
+ type: "string",
483
+ default: "the runtime’s",
484
+ description: "The locale the figures in its words are written in (makeTreeSelectLabels)."
485
+ }
486
+ ] })
487
+ })
488
+ ]
489
+ });
490
+ }
491
+ //#endregion
492
+ export { Page, Preview };