themelia-react-ui 2.0.5 → 2.0.6

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 (489) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/MIGRATION.md +119 -0
  3. package/README.md +13 -6
  4. package/dist/{accordion-B9MHG0cT.js → accordion-0tQUZ20r.js} +7 -7
  5. package/dist/accordion-0tQUZ20r.js.map +1 -0
  6. package/dist/{action-menu-Dr8K-ghE.js → action-menu-C0gjzLyE.js} +7 -7
  7. package/dist/{action-menu-Dr8K-ghE.js.map → action-menu-C0gjzLyE.js.map} +1 -1
  8. package/dist/{ai-artifact-C58tQcBy.js → ai-artifact-CGGpQryR.js} +172 -157
  9. package/dist/ai-artifact-CGGpQryR.js.map +1 -0
  10. package/dist/{app-shell-B_IuNWOo.js → app-shell-EHuuRDGy.js} +5 -5
  11. package/dist/{app-shell-B_IuNWOo.js.map → app-shell-EHuuRDGy.js.map} +1 -1
  12. package/dist/{attachment-Dg_69lPS.js → attachment-BCpA4e7i.js} +8 -8
  13. package/dist/{attachment-Dg_69lPS.js.map → attachment-BCpA4e7i.js.map} +1 -1
  14. package/dist/{auth-DTkkshS8.js → auth-B0girIk_.js} +15 -15
  15. package/dist/auth-B0girIk_.js.map +1 -0
  16. package/dist/{avatar-CeZaFmNH.js → avatar-B9Jnp-T-.js} +3 -3
  17. package/dist/{avatar-CeZaFmNH.js.map → avatar-B9Jnp-T-.js.map} +1 -1
  18. package/dist/{badge-xIiV_E7f.js → badge-wWauMgAt.js} +3 -3
  19. package/dist/{badge-xIiV_E7f.js.map → badge-wWauMgAt.js.map} +1 -1
  20. package/dist/base/accordion.js +1 -1
  21. package/dist/base/action-menu.js +1 -1
  22. package/dist/base/attachment.js +1 -1
  23. package/dist/base/avatar.js +1 -1
  24. package/dist/base/badge.js +1 -1
  25. package/dist/base/batch-action-bar.js +1 -1
  26. package/dist/base/buttons.js +1 -1
  27. package/dist/base/cards.js +2 -2
  28. package/dist/base/carousel.js +3 -3
  29. package/dist/base/cascader.js +1 -1
  30. package/dist/base/chart.js +1 -1
  31. package/dist/base/choice-inputs.js +2 -2
  32. package/dist/base/code-block.js +1 -1
  33. package/dist/base/combobox.js +1 -1
  34. package/dist/base/command.js +1 -1
  35. package/dist/base/copyable.js +1 -1
  36. package/dist/base/date-pickers.js +2 -2
  37. package/dist/base/display.js +6 -6
  38. package/dist/base/feedback.js +4 -4
  39. package/dist/base/forms-numeric.js +1 -1
  40. package/dist/base/forms.js +2 -2
  41. package/dist/base/inline-edit.js +8 -8
  42. package/dist/base/item.js +1 -1
  43. package/dist/base/media-gallery.js +1 -1
  44. package/dist/base/metadata-list.js +1 -1
  45. package/dist/base/navigation.js +6 -6
  46. package/dist/base/popover-menu.js +1 -1
  47. package/dist/base/popover.js +1 -1
  48. package/dist/base/qr-code.js +1 -1
  49. package/dist/base/repeaters.js +195 -188
  50. package/dist/base/repeaters.js.map +1 -1
  51. package/dist/base/sheet.js +1 -1
  52. package/dist/base/sidebar.js +2 -2
  53. package/dist/base/signature-pad.js +7 -7
  54. package/dist/base/skeleton.js +1 -1
  55. package/dist/base/spinner.js +5 -5
  56. package/dist/base/spinner.js.map +1 -1
  57. package/dist/base/structure.js +1 -1
  58. package/dist/base/table.js +1 -1
  59. package/dist/base/text-inputs.js +2 -2
  60. package/dist/base/toaster.js +1 -1
  61. package/dist/base/tree.js +1 -1
  62. package/dist/base/upload-queue.js +1 -1
  63. package/dist/base/upload.js +3 -3
  64. package/dist/base/value-inputs.js +1 -1
  65. package/dist/{batch-action-bar-Cb8cuvyy.js → batch-action-bar-BoqWIIpV.js} +5 -5
  66. package/dist/{batch-action-bar-Cb8cuvyy.js.map → batch-action-bar-BoqWIIpV.js.map} +1 -1
  67. package/dist/blocks/admin.js +17 -17
  68. package/dist/blocks/ai.js +227 -221
  69. package/dist/blocks/ai.js.map +1 -1
  70. package/dist/blocks/analytics/usage-card.js +1 -1
  71. package/dist/blocks/analytics.js +424 -449
  72. package/dist/blocks/analytics.js.map +1 -1
  73. package/dist/blocks/collaboration.js +1 -1
  74. package/dist/blocks/commerce/receipt.js +1 -1
  75. package/dist/blocks/commerce.js +225 -220
  76. package/dist/blocks/commerce.js.map +1 -1
  77. package/dist/blocks/data-display.js +2 -2
  78. package/dist/blocks/onboarding.js +5 -5
  79. package/dist/blocks/planning.js +11 -11
  80. package/dist/blocks/timelines.js +1 -1
  81. package/dist/{breadcrumbs-J-K2kl4c.js → breadcrumbs-Bp9Ke7kd.js} +4 -4
  82. package/dist/breadcrumbs-Bp9Ke7kd.js.map +1 -0
  83. package/dist/{button-S2Cubiiz.js → button-ChBovTx0.js} +2 -2
  84. package/dist/{button-S2Cubiiz.js.map → button-ChBovTx0.js.map} +1 -1
  85. package/dist/{buttons-BedGfygC.js → buttons-DeW0bQeK.js} +6 -6
  86. package/dist/{buttons-BedGfygC.js.map → buttons-DeW0bQeK.js.map} +1 -1
  87. package/dist/{cards-rNX1M4Xn.js → cards-CNXnmvV5.js} +8 -8
  88. package/dist/{cards-rNX1M4Xn.js.map → cards-CNXnmvV5.js.map} +1 -1
  89. package/dist/{cascader-B1MiqkBq.js → cascader-CrAl9zD5.js} +15 -15
  90. package/dist/{cascader-B1MiqkBq.js.map → cascader-CrAl9zD5.js.map} +1 -1
  91. package/dist/{chart-Darg_0Kv.js → chart-I7ROnsl8.js} +5 -5
  92. package/dist/{chart-Darg_0Kv.js.map → chart-I7ROnsl8.js.map} +1 -1
  93. package/dist/{checkbox-fflqmODR.js → checkbox-MoyHIAPs.js} +3 -3
  94. package/dist/{checkbox-fflqmODR.js.map → checkbox-MoyHIAPs.js.map} +1 -1
  95. package/dist/{choice-inputs-zUgBZfE4.js → choice-inputs-DHGtx0QV.js} +122 -110
  96. package/dist/choice-inputs-DHGtx0QV.js.map +1 -0
  97. package/dist/{code-block-BzmM9Eig.js → code-block-BSJyq9e-.js} +7 -7
  98. package/dist/{code-block-BzmM9Eig.js.map → code-block-BSJyq9e-.js.map} +1 -1
  99. package/dist/{collapsible-BkAI_XD4.js → collapsible-BzJ91LUG.js} +3 -3
  100. package/dist/{collapsible-BkAI_XD4.js.map → collapsible-BzJ91LUG.js.map} +1 -1
  101. package/dist/{collection-content-gDh1v6O4.js → collection-content-CSnwtOTH.js} +3 -3
  102. package/dist/{collection-content-gDh1v6O4.js.map → collection-content-CSnwtOTH.js.map} +1 -1
  103. package/dist/{combobox-BEx0vJgF.js → combobox-Bcvu5J8O.js} +11 -10
  104. package/dist/{combobox-BEx0vJgF.js.map → combobox-Bcvu5J8O.js.map} +1 -1
  105. package/dist/combobox-C2JiSQPc.js +915 -0
  106. package/dist/combobox-C2JiSQPc.js.map +1 -0
  107. package/dist/{command-CrlPIL6m.js → command-9e52NPgK.js} +6 -6
  108. package/dist/{command-CrlPIL6m.js.map → command-9e52NPgK.js.map} +1 -1
  109. package/dist/{comments-Dmpp0YIc.js → comments-BsgErEqd.js} +33 -28
  110. package/dist/comments-BsgErEqd.js.map +1 -0
  111. package/dist/components/base/choice-inputs/choice-types.d.ts +4 -0
  112. package/dist/components/base/choice-inputs/pill-radio-group.d.ts +7 -6
  113. package/dist/components/base/combobox/combobox-field.d.ts +2 -2
  114. package/dist/components/base/date-pickers/date-picker-internals.d.ts +3 -1
  115. package/dist/components/base/date-pickers/datepicker.types.d.ts +10 -4
  116. package/dist/components/base/date-pickers/time-picker.d.ts +17 -3
  117. package/dist/components/base/feedback/state-display.d.ts +5 -1
  118. package/dist/components/base/feedback/state-display.strings.d.ts +9 -0
  119. package/dist/components/base/forms/form-field.d.ts +7 -2
  120. package/dist/components/base/forms-numeric/coordinates-input.d.ts +4 -1
  121. package/dist/components/base/forms-numeric/decimal-input.d.ts +2 -2
  122. package/dist/components/base/forms-numeric/dimensions-input.d.ts +4 -1
  123. package/dist/components/base/forms-numeric/numeric-composite-field.d.ts +12 -0
  124. package/dist/components/base/forms-numeric/weight-input.d.ts +6 -1
  125. package/dist/components/base/navigation/language-switcher.d.ts +12 -4
  126. package/dist/components/base/repeaters/key-value-editor.d.ts +2 -1
  127. package/dist/components/base/sidebar/sidebar.d.ts +2 -0
  128. package/dist/components/base/upload/avatar-upload.d.ts +2 -1
  129. package/dist/components/base/upload/image-upload.d.ts +2 -1
  130. package/dist/components/blocks/ai/ai-citation/types.d.ts +2 -0
  131. package/dist/components/blocks/ai/ai-reasoning/types.d.ts +2 -0
  132. package/dist/components/blocks/ai/ai-sources/types.d.ts +2 -0
  133. package/dist/components/blocks/ai/ai-tool-call/types.d.ts +2 -0
  134. package/dist/components/blocks/analytics/metric/metric.d.ts +4 -0
  135. package/dist/components/blocks/analytics/metric-comparison/metric-comparison.d.ts +2 -0
  136. package/dist/components/blocks/analytics/metric-grid/metric-grid.d.ts +4 -5
  137. package/dist/components/blocks/analytics/types.d.ts +2 -2
  138. package/dist/components/blocks/commerce/order-status/types.d.ts +4 -0
  139. package/dist/components/blocks/data-display/empty-state/empty-state.types.d.ts +4 -3
  140. package/dist/components/features/activities/activities.types.d.ts +18 -11
  141. package/dist/components/features/activities/hooks/use-activity-resources.d.ts +2 -1
  142. package/dist/components/features/ai-chat/hooks/use-ai-chat-scroll.d.ts +1 -1
  143. package/dist/components/features/appointment-calendar/appointment-calendar.d.ts +1 -1
  144. package/dist/components/features/appointment-calendar/appointment-calendar.types.d.ts +4 -2
  145. package/dist/components/features/combobox/async-resource-combobox.d.ts +2 -2
  146. package/dist/components/features/combobox/combobox.d.ts +2 -2
  147. package/dist/components/features/combobox/hooks/use-combobox-core.d.ts +2 -1
  148. package/dist/components/features/combobox/hooks/use-combobox-state.d.ts +1 -0
  149. package/dist/components/features/combobox/hooks/use-load-more.d.ts +1 -0
  150. package/dist/components/features/combobox/types.d.ts +37 -8
  151. package/dist/components/features/email-composer/types.d.ts +3 -1
  152. package/dist/components/features/filters/facets/date-facet.d.ts +4 -2
  153. package/dist/components/features/filters/facets/range-facet.d.ts +12 -0
  154. package/dist/components/features/filters/filters.types.d.ts +3 -3
  155. package/dist/components/features/filters/partials/date-filter-content.d.ts +3 -2
  156. package/dist/components/features/filters/partials/filter-popover-content.d.ts +4 -2
  157. package/dist/components/features/filters/partials/range-filter-content.d.ts +12 -0
  158. package/dist/components/features/filters/utils/filter-utils.d.ts +5 -1
  159. package/dist/components/features/media-library/hooks/use-media-library.d.ts +1 -1
  160. package/dist/components/features/media-library/media-library.d.ts +1 -1
  161. package/dist/components/features/media-library/media-library.strings.d.ts +6 -0
  162. package/dist/components/features/media-library/media-library.types.d.ts +36 -8
  163. package/dist/components/features/media-library/partials/media-library-partials.d.ts +3 -3
  164. package/dist/components/features/mentions/hooks/use-mentions.d.ts +16 -1
  165. package/dist/components/features/mentions/partials/mention-inline-suggestions.d.ts +5 -1
  166. package/dist/components/features/mentions/utils/split-html-by-mentions.d.ts +1 -7
  167. package/dist/components/features/overlays/hooks/use-overlay-visibility.d.ts +2 -2
  168. package/dist/components/features/products/products.types.d.ts +2 -2
  169. package/dist/components/features/questionnaire/questionnaire.types.d.ts +3 -0
  170. package/dist/components/features/resource/resource.d.ts +1 -1
  171. package/dist/components/features/resource/resource.types.d.ts +2 -0
  172. package/dist/components/features/rich-text-editor/form-rich-text-editor.d.ts +1 -1
  173. package/dist/components/features/rich-text-editor/partials/caret-helpers.d.ts +1 -1
  174. package/dist/components/features/rich-text-editor/partials/editor-field-aria.d.ts +14 -0
  175. package/dist/components/features/rich-text-editor/partials/rich-text-editor-toolbar.d.ts +3 -1
  176. package/dist/components/features/rich-text-editor/rich-text-editor.recipes.d.ts +1 -1
  177. package/dist/components/features/rich-text-editor/rich-text-editor.types.d.ts +17 -3
  178. package/dist/components/features/schema-form/hooks/use-schema-form.d.ts +5 -1
  179. package/dist/components/features/schema-form/partials/schema-form-field.d.ts +3 -1
  180. package/dist/components/features/schema-form/schema-form.utils.d.ts +1 -1
  181. package/dist/components/features/suggestions/suggestions.types.d.ts +1 -1
  182. package/dist/components/features/table/data-table.d.ts +1 -1
  183. package/dist/components/features/table/index.d.ts +1 -0
  184. package/dist/components/features/table/table-body.d.ts +1 -1
  185. package/dist/components/features/table/table-helpers.d.ts +6 -3
  186. package/dist/components/features/table/table.strings.d.ts +3 -0
  187. package/dist/components/features/table/table.types.d.ts +17 -1
  188. package/dist/components/layout/header/header.types.d.ts +3 -2
  189. package/dist/components/layout/layout.types.d.ts +5 -3
  190. package/dist/components/layout/navigation/side-nav.d.ts +3 -2
  191. package/dist/components/layout/normalize-layout-path.d.ts +1 -0
  192. package/dist/components/layout/settings/settings.d.ts +1 -1
  193. package/dist/components/layout/sidebar/app-sidebar.d.ts +1 -1
  194. package/dist/components/layout/sidebar/sidebar-navigation-rail.d.ts +3 -1
  195. package/dist/components/layout/sidebar/sidebar.context.d.ts +1 -0
  196. package/dist/components/layout/sidebar/sidebar.types.d.ts +2 -0
  197. package/dist/components/primitives/link.d.ts +3 -2
  198. package/dist/components/primitives/money.d.ts +1 -1
  199. package/dist/components/primitives/number.d.ts +1 -1
  200. package/dist/components/typography/rich-text/rich-text-tree.d.ts +7 -5
  201. package/dist/{containers-CIxwbZt5.js → containers-CSdc32h9.js} +2 -2
  202. package/dist/{containers-CIxwbZt5.js.map → containers-CSdc32h9.js.map} +1 -1
  203. package/dist/{copyable-DIznBqiT.js → copyable-3fdHfMR3.js} +4 -4
  204. package/dist/{copyable-DIznBqiT.js.map → copyable-3fdHfMR3.js.map} +1 -1
  205. package/dist/{data-display-BdgCAw8T.js → data-display-Cmj-xZYl.js} +16 -15
  206. package/dist/data-display-Cmj-xZYl.js.map +1 -0
  207. package/dist/{date-Cq8ioE4o.js → date-Br0FicVv.js} +4 -4
  208. package/dist/{date-Cq8ioE4o.js.map → date-Br0FicVv.js.map} +1 -1
  209. package/dist/date-picker-CyQlFYsP.js +1617 -0
  210. package/dist/date-picker-CyQlFYsP.js.map +1 -0
  211. package/dist/date-pickers-tj2MXmXd.js +185 -0
  212. package/dist/date-pickers-tj2MXmXd.js.map +1 -0
  213. package/dist/{display-KsZLw9Ov.js → display-CT_N2a3w.js} +7 -7
  214. package/dist/{display-KsZLw9Ov.js.map → display-CT_N2a3w.js.map} +1 -1
  215. package/dist/{dropdown-menu-CLs8Lihj.js → dropdown-menu-C08iIugv.js} +6 -6
  216. package/dist/{dropdown-menu-CLs8Lihj.js.map → dropdown-menu-C08iIugv.js.map} +1 -1
  217. package/dist/features/activities.js +283 -270
  218. package/dist/features/activities.js.map +1 -1
  219. package/dist/features/ai-chat.js +40 -27
  220. package/dist/features/ai-chat.js.map +1 -1
  221. package/dist/features/appointment-calendar.js +126 -126
  222. package/dist/features/appointment-calendar.js.map +1 -1
  223. package/dist/features/async-preview.js +9 -9
  224. package/dist/features/combobox.js +1 -1
  225. package/dist/features/comments.js +1 -1
  226. package/dist/features/data-view.js +10 -10
  227. package/dist/features/email-composer.js +24 -19
  228. package/dist/features/email-composer.js.map +1 -1
  229. package/dist/features/event-calendar.js +129 -125
  230. package/dist/features/event-calendar.js.map +1 -1
  231. package/dist/features/filters.js +2 -2
  232. package/dist/features/global-search.js +16 -20
  233. package/dist/features/global-search.js.map +1 -1
  234. package/dist/features/kanban.js +18 -28
  235. package/dist/features/kanban.js.map +1 -1
  236. package/dist/features/map/style.css +15 -0
  237. package/dist/features/map.js +331 -314
  238. package/dist/features/map.js.map +1 -1
  239. package/dist/features/media-library.js +1044 -866
  240. package/dist/features/media-library.js.map +1 -1
  241. package/dist/features/mentions.js +2 -2
  242. package/dist/features/overlays.js +1 -1
  243. package/dist/features/products.js +978 -964
  244. package/dist/features/products.js.map +1 -1
  245. package/dist/features/questionnaire.js +159 -152
  246. package/dist/features/questionnaire.js.map +1 -1
  247. package/dist/features/resource-assignment.js +8 -8
  248. package/dist/features/resource.js +74 -71
  249. package/dist/features/resource.js.map +1 -1
  250. package/dist/features/rich-text-editor.js +28 -19
  251. package/dist/features/rich-text-editor.js.map +1 -1
  252. package/dist/features/schema-form.js +297 -256
  253. package/dist/features/schema-form.js.map +1 -1
  254. package/dist/features/suggestions.js +57 -50
  255. package/dist/features/suggestions.js.map +1 -1
  256. package/dist/features/sync.js +3 -3
  257. package/dist/features/table.js +1 -1
  258. package/dist/features/theme-tweaker.js +400 -399
  259. package/dist/features/theme-tweaker.js.map +1 -1
  260. package/dist/feedback-Dzo1xtAU.js +246 -0
  261. package/dist/feedback-Dzo1xtAU.js.map +1 -0
  262. package/dist/{field-affordance-recipes-DWcNcOjh.js → field-affordance-recipes-D6H7tVJi.js} +2 -2
  263. package/dist/{field-affordance-recipes-DWcNcOjh.js.map → field-affordance-recipes-D6H7tVJi.js.map} +1 -1
  264. package/dist/field-control-attributes-B6i335wr.js +18 -0
  265. package/dist/field-control-attributes-B6i335wr.js.map +1 -0
  266. package/dist/{field-state-recipes-BVA2CWHo.js → field-state-recipes-7sza8QbC.js} +4 -2
  267. package/dist/{field-state-recipes-BVA2CWHo.js.map → field-state-recipes-7sza8QbC.js.map} +1 -1
  268. package/dist/{filters-DzgSJpMK.js → filters-Dl80yYtN.js} +763 -605
  269. package/dist/filters-Dl80yYtN.js.map +1 -0
  270. package/dist/form-field-CAPdwdnZ.js +74 -0
  271. package/dist/form-field-CAPdwdnZ.js.map +1 -0
  272. package/dist/{form-sizing-Bs2qFUeE.js → form-sizing-CgcrUbLU.js} +2 -2
  273. package/dist/{form-sizing-Bs2qFUeE.js.map → form-sizing-CgcrUbLU.js.map} +1 -1
  274. package/dist/{forms-C0RGnJTe.js → forms-B3W8CH7-.js} +8 -8
  275. package/dist/{forms-C0RGnJTe.js.map → forms-B3W8CH7-.js.map} +1 -1
  276. package/dist/forms-numeric-CwjQJe-O.js +991 -0
  277. package/dist/forms-numeric-CwjQJe-O.js.map +1 -0
  278. package/dist/{header-DMMxG__r.js → header-ZIIsRKxP.js} +113 -113
  279. package/dist/header-ZIIsRKxP.js.map +1 -0
  280. package/dist/hooks/use-files.d.ts +2 -0
  281. package/dist/{hooks-DB6CJ4MR.js → hooks-BitHSh-Y.js} +3 -3
  282. package/dist/{hooks-DB6CJ4MR.js.map → hooks-BitHSh-Y.js.map} +1 -1
  283. package/dist/{icon-badge-DZF-YjQp.js → icon-badge-npxF1SLX.js} +2 -2
  284. package/dist/{icon-badge-DZF-YjQp.js.map → icon-badge-npxF1SLX.js.map} +1 -1
  285. package/dist/index.js +1 -1
  286. package/dist/{input-CvyDQlY7.js → input-7KAc7XQL.js} +6 -6
  287. package/dist/{input-CvyDQlY7.js.map → input-7KAc7XQL.js.map} +1 -1
  288. package/dist/{input-DMBwAZmr.js → input-DIREVYHs.js} +3 -3
  289. package/dist/{input-DMBwAZmr.js.map → input-DIREVYHs.js.map} +1 -1
  290. package/dist/{interaction-recipes-XR9ZpVYL.js → interaction-recipes-4wZ2tvfb.js} +2 -2
  291. package/dist/{interaction-recipes-XR9ZpVYL.js.map → interaction-recipes-4wZ2tvfb.js.map} +1 -1
  292. package/dist/{item-DjCcM18E.js → item-FfWnaYST.js} +99 -98
  293. package/dist/item-FfWnaYST.js.map +1 -0
  294. package/dist/layout/app-shell.js +1 -1
  295. package/dist/layout/auth.js +1 -1
  296. package/dist/layout/containers.js +1 -1
  297. package/dist/layout/header.js +1 -1
  298. package/dist/layout/hooks.js +1 -1
  299. package/dist/layout/navigation.js +1 -1
  300. package/dist/layout/page.js +1 -1
  301. package/dist/layout/settings.js +1 -1
  302. package/dist/layout/sidebar.js +2 -2
  303. package/dist/layout/workspace.js +1 -1
  304. package/dist/layout.js +11 -11
  305. package/dist/layout.types-E_GAApzO.js +30 -0
  306. package/dist/layout.types-E_GAApzO.js.map +1 -0
  307. package/dist/lib/field-control-attributes.d.ts +11 -0
  308. package/dist/lib/field-state-recipes.d.ts +2 -0
  309. package/dist/lib/format.d.ts +1 -0
  310. package/dist/lib/surface-recipes.d.ts +1 -1
  311. package/dist/lib/token-merge.generated.d.ts +6 -6
  312. package/dist/lib/utils.js +1 -1
  313. package/dist/{media-gallery-C-vChPmE.js → media-gallery-C81DAnKI.js} +6 -6
  314. package/dist/{media-gallery-C-vChPmE.js.map → media-gallery-C81DAnKI.js.map} +1 -1
  315. package/dist/{mentions-0_4nWuI-.js → mentions-qOnedSt4.js} +236 -167
  316. package/dist/mentions-qOnedSt4.js.map +1 -0
  317. package/dist/message-BJHnn43M.js +135 -0
  318. package/dist/message-BJHnn43M.js.map +1 -0
  319. package/dist/{metadata-list-C3MkU-Om.js → metadata-list-XkqZ_UXH.js} +11 -11
  320. package/dist/{metadata-list-C3MkU-Om.js.map → metadata-list-XkqZ_UXH.js.map} +1 -1
  321. package/dist/{navigation-DaRjthVk.js → navigation-BgtPJAhi.js} +119 -119
  322. package/dist/navigation-BgtPJAhi.js.map +1 -0
  323. package/dist/{navigation-C90-oQFq.js → navigation-Bt-v7rWP.js} +52 -46
  324. package/dist/navigation-Bt-v7rWP.js.map +1 -0
  325. package/dist/normalize-layout-path-BmEgg6fu.js +14 -0
  326. package/dist/normalize-layout-path-BmEgg6fu.js.map +1 -0
  327. package/dist/{number-CRU3kGuk.js → number-CYqBcrSj.js} +78 -86
  328. package/dist/number-CYqBcrSj.js.map +1 -0
  329. package/dist/{overflow-tab-bar-IVFVQFV6.js → overflow-tab-bar-BQCA2Zn2.js} +7 -7
  330. package/dist/{overflow-tab-bar-IVFVQFV6.js.map → overflow-tab-bar-BQCA2Zn2.js.map} +1 -1
  331. package/dist/{overlays-BSgCtM2v.js → overlays-CC8zI3Du.js} +264 -260
  332. package/dist/overlays-CC8zI3Du.js.map +1 -0
  333. package/dist/{page-DUUKDAjo.js → page-BoQ1VaFJ.js} +13 -13
  334. package/dist/{page-DUUKDAjo.js.map → page-BoQ1VaFJ.js.map} +1 -1
  335. package/dist/{page-header-commands-7P3sfE9u.js → page-header-commands-DIKspJfx.js} +4 -4
  336. package/dist/{page-header-commands-7P3sfE9u.js.map → page-header-commands-DIKspJfx.js.map} +1 -1
  337. package/dist/{pagination-CgCjElfu.js → pagination-Br8TdV9A.js} +4 -4
  338. package/dist/{pagination-CgCjElfu.js.map → pagination-Br8TdV9A.js.map} +1 -1
  339. package/dist/{popover-B85RenIl.js → popover-k8TdUcAt.js} +10 -10
  340. package/dist/popover-k8TdUcAt.js.map +1 -0
  341. package/dist/{popover-menu-DlnQ2zlR.js → popover-menu-yn-o0kyA.js} +7 -7
  342. package/dist/{popover-menu-DlnQ2zlR.js.map → popover-menu-yn-o0kyA.js.map} +1 -1
  343. package/dist/{popover.recipes-DdiEp0rd.js → popover.recipes-DJ0AkUan.js} +2 -2
  344. package/dist/{popover.recipes-DdiEp0rd.js.map → popover.recipes-DJ0AkUan.js.map} +1 -1
  345. package/dist/{portal-recipes-BpsV_iRw.js → portal-recipes-DyUXqUtD.js} +2 -2
  346. package/dist/{portal-recipes-BpsV_iRw.js.map → portal-recipes-DyUXqUtD.js.map} +1 -1
  347. package/dist/{primitives-ByWgGUgt.js → primitives-BkkQjYl7.js} +22 -17
  348. package/dist/primitives-BkkQjYl7.js.map +1 -0
  349. package/dist/primitives.js +4 -4
  350. package/dist/{progress-BJhQP9WX.js → progress-DZFXXzPs.js} +4 -4
  351. package/dist/{progress-BJhQP9WX.js.map → progress-DZFXXzPs.js.map} +1 -1
  352. package/dist/{receipt-tOc7B3hw.js → receipt-C7LhOg7Q.js} +6 -6
  353. package/dist/{receipt-tOc7B3hw.js.map → receipt-C7LhOg7Q.js.map} +1 -1
  354. package/dist/rich-text-BnTzZjIo.js +45 -0
  355. package/dist/rich-text-BnTzZjIo.js.map +1 -0
  356. package/dist/rich-text-editor-CAurDwT5.js +1273 -0
  357. package/dist/rich-text-editor-CAurDwT5.js.map +1 -0
  358. package/dist/{rich-text-editor-toolbar-laT3tpBT.js → rich-text-editor-toolbar-DbXig7Jk.js} +36 -35
  359. package/dist/rich-text-editor-toolbar-DbXig7Jk.js.map +1 -0
  360. package/dist/rich-text-tree-BqyQ_7-R.js +66 -0
  361. package/dist/rich-text-tree-BqyQ_7-R.js.map +1 -0
  362. package/dist/{sanitize-html-DsQmI48u.js → sanitize-html-BWkH4dLM.js} +29 -16
  363. package/dist/sanitize-html-BWkH4dLM.js.map +1 -0
  364. package/dist/{scroll-area-B0dB2cBi.js → scroll-area-Bj6CRUif.js} +2 -2
  365. package/dist/{scroll-area-B0dB2cBi.js.map → scroll-area-Bj6CRUif.js.map} +1 -1
  366. package/dist/{separator-Bb17I4pu.js → separator-B9ewiCGO.js} +2 -2
  367. package/dist/{separator-Bb17I4pu.js.map → separator-B9ewiCGO.js.map} +1 -1
  368. package/dist/{separator-Ct_WSWTJ.js → separator-DM6gs2vu.js} +3 -3
  369. package/dist/{separator-Ct_WSWTJ.js.map → separator-DM6gs2vu.js.map} +1 -1
  370. package/dist/services/actions.js +1 -1
  371. package/dist/settings-DZPHgpx4.js +155 -0
  372. package/dist/settings-DZPHgpx4.js.map +1 -0
  373. package/dist/{sheet-BGPERY55.js → sheet-C4DHsgLk.js} +6 -6
  374. package/dist/{sheet-BGPERY55.js.map → sheet-C4DHsgLk.js.map} +1 -1
  375. package/dist/sidebar-C8BnDwTH.js +709 -0
  376. package/dist/sidebar-C8BnDwTH.js.map +1 -0
  377. package/dist/{sidebar-f9gRWXIR.js → sidebar-CmD6a-HK.js} +16 -13
  378. package/dist/sidebar-CmD6a-HK.js.map +1 -0
  379. package/dist/{skeleton-BapcJd9C.js → skeleton-DDgdhmu9.js} +5 -5
  380. package/dist/{skeleton-BapcJd9C.js.map → skeleton-DDgdhmu9.js.map} +1 -1
  381. package/dist/{smart-card-CW0hjetE.js → smart-card-B6vLxqa_.js} +8 -8
  382. package/dist/{smart-card-CW0hjetE.js.map → smart-card-B6vLxqa_.js.map} +1 -1
  383. package/dist/{structure-DuxKl954.js → structure-DZJ2wbAU.js} +2 -2
  384. package/dist/{structure-DuxKl954.js.map → structure-DZJ2wbAU.js.map} +1 -1
  385. package/dist/style.css +1 -1
  386. package/dist/{surface-recipes-BKRVW8Os.js → surface-recipes-C8mNycaY.js} +2 -2
  387. package/dist/{surface-recipes-BKRVW8Os.js.map → surface-recipes-C8mNycaY.js.map} +1 -1
  388. package/dist/{table-CFOWY9pQ.js → table-CBonSdTp.js} +534 -486
  389. package/dist/table-CBonSdTp.js.map +1 -0
  390. package/dist/{table-B4TE7iOV.js → table-CXSPHH25.js} +75 -71
  391. package/dist/table-CXSPHH25.js.map +1 -0
  392. package/dist/{tabs-e7ko9S2o.js → tabs-C4Kr_hCr.js} +50 -49
  393. package/dist/tabs-C4Kr_hCr.js.map +1 -0
  394. package/dist/{text-inputs-B1culiSK.js → text-inputs-jdkS3ReG.js} +9 -9
  395. package/dist/{text-inputs-B1culiSK.js.map → text-inputs-jdkS3ReG.js.map} +1 -1
  396. package/dist/{timelines-D3Sl9ueq.js → timelines-CoPwdJP0.js} +10 -10
  397. package/dist/{timelines-D3Sl9ueq.js.map → timelines-CoPwdJP0.js.map} +1 -1
  398. package/dist/{tooltip-8wz5S_Zr.js → tooltip-31NwIpTo.js} +4 -4
  399. package/dist/{tooltip-8wz5S_Zr.js.map → tooltip-31NwIpTo.js.map} +1 -1
  400. package/dist/{tree-CzUJHnFs.js → tree-CeYVzdFE.js} +6 -6
  401. package/dist/{tree-CzUJHnFs.js.map → tree-CeYVzdFE.js.map} +1 -1
  402. package/dist/typography/rich-text.js +1 -1
  403. package/dist/{typography-BQnine1k.js → typography-C7-YMW1S.js} +2 -2
  404. package/dist/{typography-BQnine1k.js.map → typography-C7-YMW1S.js.map} +1 -1
  405. package/dist/typography.js +1 -1
  406. package/dist/{upload-BOW6U2tI.js → upload-Hdm5gObf.js} +303 -291
  407. package/dist/upload-Hdm5gObf.js.map +1 -0
  408. package/dist/{upload-queue-qUXn1ykN.js → upload-queue-D0sYPuqo.js} +8 -8
  409. package/dist/{upload-queue-qUXn1ykN.js.map → upload-queue-D0sYPuqo.js.map} +1 -1
  410. package/dist/{usage-card-BeSLY0i0.js → usage-card-9s8hLDfn.js} +9 -9
  411. package/dist/{usage-card-BeSLY0i0.js.map → usage-card-9s8hLDfn.js.map} +1 -1
  412. package/dist/{utils-B6kKb8jB.js → utils-DhuoqFy4.js} +31 -37
  413. package/dist/utils-DhuoqFy4.js.map +1 -0
  414. package/dist/{value-inputs-skdVB2zh.js → value-inputs-D3aPgq9H.js} +15 -15
  415. package/dist/{value-inputs-skdVB2zh.js.map → value-inputs-D3aPgq9H.js.map} +1 -1
  416. package/dist/{value-typography-uAmWUAL1.js → value-typography-uSzzG9Gf.js} +32 -26
  417. package/dist/value-typography-uSzzG9Gf.js.map +1 -0
  418. package/dist/{workspace-DHeHv0qw.js → workspace-CC8Vchiu.js} +12 -12
  419. package/dist/{workspace-DHeHv0qw.js.map → workspace-CC8Vchiu.js.map} +1 -1
  420. package/docs/consumer-skill/examples/edit.tsx +3 -3
  421. package/docs/consumer-skill/references/agents-md.md +19 -19
  422. package/docs/consumer-skill/references/analytics.md +15 -0
  423. package/docs/consumer-skill/references/component-contracts.json +14724 -13057
  424. package/docs/consumer-skill/references/composition.md +21 -4
  425. package/docs/consumer-skill/references/design-contract.md +1 -0
  426. package/docs/consumer-skill/references/installation.md +51 -8
  427. package/docs/consumer-skill/references/integration.md +24 -1
  428. package/docs/consumer-skill/references/public-api.json +172 -34
  429. package/docs/consumer-skill/references/review.md +51 -11
  430. package/docs/consumer-skill/references/rhf-workflows.md +72 -0
  431. package/docs/consumer-skill/references/theming.md +7 -2
  432. package/docs/consumer-skill/references/tokens.json +1 -1
  433. package/docs/consumer-skill/scripts/composition-policy.mjs +144 -30
  434. package/docs/consumer-skill/scripts/setup-skills.mjs +46 -9
  435. package/package.json +4 -2
  436. package/templates/admin-shell-template.tsx +1 -2
  437. package/templates/customers-template.tsx +18 -16
  438. package/dist/accordion-B9MHG0cT.js.map +0 -1
  439. package/dist/ai-artifact-C58tQcBy.js.map +0 -1
  440. package/dist/auth-DTkkshS8.js.map +0 -1
  441. package/dist/breadcrumbs-J-K2kl4c.js.map +0 -1
  442. package/dist/choice-inputs-zUgBZfE4.js.map +0 -1
  443. package/dist/combobox-BwzoXFSG.js +0 -884
  444. package/dist/combobox-BwzoXFSG.js.map +0 -1
  445. package/dist/comments-Dmpp0YIc.js.map +0 -1
  446. package/dist/data-display-BdgCAw8T.js.map +0 -1
  447. package/dist/date-picker-RlIzKom_.js +0 -1551
  448. package/dist/date-picker-RlIzKom_.js.map +0 -1
  449. package/dist/date-pickers-DY-CpXS1.js +0 -179
  450. package/dist/date-pickers-DY-CpXS1.js.map +0 -1
  451. package/dist/feedback-Dm4izqFn.js +0 -240
  452. package/dist/feedback-Dm4izqFn.js.map +0 -1
  453. package/dist/filters-DzgSJpMK.js.map +0 -1
  454. package/dist/form-field-BriWAXyg.js +0 -63
  455. package/dist/form-field-BriWAXyg.js.map +0 -1
  456. package/dist/forms-numeric-DIhghX1Q.js +0 -910
  457. package/dist/forms-numeric-DIhghX1Q.js.map +0 -1
  458. package/dist/header-DMMxG__r.js.map +0 -1
  459. package/dist/item-DjCcM18E.js.map +0 -1
  460. package/dist/layout.types-Cn7aUzJp.js +0 -20
  461. package/dist/layout.types-Cn7aUzJp.js.map +0 -1
  462. package/dist/mentions-0_4nWuI-.js.map +0 -1
  463. package/dist/message-g8p7eVtN.js +0 -128
  464. package/dist/message-g8p7eVtN.js.map +0 -1
  465. package/dist/navigation-C90-oQFq.js.map +0 -1
  466. package/dist/navigation-DaRjthVk.js.map +0 -1
  467. package/dist/number-CRU3kGuk.js.map +0 -1
  468. package/dist/overlays-BSgCtM2v.js.map +0 -1
  469. package/dist/popover-B85RenIl.js.map +0 -1
  470. package/dist/primitives-ByWgGUgt.js.map +0 -1
  471. package/dist/rich-text-Dth5E882.js +0 -78
  472. package/dist/rich-text-Dth5E882.js.map +0 -1
  473. package/dist/rich-text-editor-C1fOjBTd.js +0 -1195
  474. package/dist/rich-text-editor-C1fOjBTd.js.map +0 -1
  475. package/dist/rich-text-editor-toolbar-laT3tpBT.js.map +0 -1
  476. package/dist/safe-image-src-C6kQSMBZ.js +0 -17
  477. package/dist/safe-image-src-C6kQSMBZ.js.map +0 -1
  478. package/dist/sanitize-html-DsQmI48u.js.map +0 -1
  479. package/dist/settings-Bar5wiSo.js +0 -167
  480. package/dist/settings-Bar5wiSo.js.map +0 -1
  481. package/dist/sidebar-D-JYMMbY.js +0 -686
  482. package/dist/sidebar-D-JYMMbY.js.map +0 -1
  483. package/dist/sidebar-f9gRWXIR.js.map +0 -1
  484. package/dist/table-B4TE7iOV.js.map +0 -1
  485. package/dist/table-CFOWY9pQ.js.map +0 -1
  486. package/dist/tabs-e7ko9S2o.js.map +0 -1
  487. package/dist/upload-BOW6U2tI.js.map +0 -1
  488. package/dist/utils-B6kKb8jB.js.map +0 -1
  489. package/dist/value-typography-uAmWUAL1.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"schema-form.js","names":["Text","copyRoleProps","Stack","Card","compositionRhythm","Input","FormField","Textarea","ToggleField","CardCheckboxGroup","Select","SwitchCard","CardRadioGroup","ContentBlock","TagsInput","DecimalInput","EmptyState","SCHEMA_FORM_COLUMNS","SCHEMA_FORM_FIELD_WIDTH","isFieldHidden","field","values","error","onError","isFieldDisabled","getVisibleFields","fields","resolveSchemaSections","visibleFields","schema","fieldsByKey","usedKeys","sections","section","sectionFields","key","defaultColumns","unsectioned","defaultSectionTitle","toStringValue","value","toStringArray","item","toBooleanValue","parseNumberValue","trimmed","rawValue","parsed","integer","formatJsonValue","indent","parseJsonValue","getDefaultValues","defaultValue","shouldRequireValue","normalizeErrors","next","message","errors","useSchemaForm","externalErrors","isControlled","initialValues","useMemo","internalValues","setInternalValues","useState","validationErrors","setValidationErrors","mergedErrors","setValues","useCallback","nextValues","onValueChange","setFieldValue","fieldValue","current","onFieldChange","reset","validate","nextErrors","formatRequiredError","validators","validator","result","validationError","SchemaFormActions","cn","className","showReset","Button","disabled","resetDisabled","submitting","onReset","resetLabel","submitDisabled","submitLabel","SchemaFormEmpty","getFieldHint","getTextDisplayValue","parseTextValue","parseNumberFieldValue","parseJsonFieldValue","optionIconNode","option","Icon","JsonFieldControl","text","setText","parseError","setParseError","isFocused","setIsFocused","useEffect","commit","strings","fieldId","event","SchemaFormFieldRenderer","fieldType","commonFieldProps","controlClassName","describedBy","checked","displayValue","decimalPlaces","options","inputType","nativeInputProps","defaultSchemaFormStrings","label","toDomId","SectionHeading","SchemaForm","stringsProp","generatedId","useId","formId","id","useStrings","form","columns","hasFields","helpers","shouldShowActions","showActions","onSubmit","actionsSlot","resolvedSubmitLabel","resolvedResetLabel","renderFieldNode","fieldDisabled","context","nextValue","defaultField","fieldClassName","renderField","renderSectionFields","renderPlainSection","custom","renderSection","sectionClassName","Fragment","renderCardSection","actions","empty","emptySlot","layout","contentClassName","title","description","headerSlot","footerSlot"],"sources":["../../src/components/features/schema-form/schema-form.utils.ts","../../src/components/features/schema-form/hooks/use-schema-form.ts","../../src/components/features/schema-form/partials/schema-form-actions.tsx","../../src/components/features/schema-form/partials/schema-form-empty.tsx","../../src/components/features/schema-form/partials/schema-form-field.tsx","../../src/components/features/schema-form/schema-form.strings.ts","../../src/components/features/schema-form/schema-form.tsx"],"sourcesContent":["import type {\n\tResolvedSchemaFormSection,\n\tSchemaFormField,\n\tSchemaFormFieldWidth,\n\tSchemaFormSchema,\n\tSchemaFormValue,\n\tSchemaFormValues,\n} from './schema-form.types';\n\ntype SchemaFormErrorHandler = (error: unknown) => void;\n\n/*\n * Container widths, not viewport widths — a schema form is as often rendered in\n * a drawer or a side panel as at page width, and keyed to the screen it kept\n * three field columns inside a 320px drawer. 448/576 clears every width these\n * forms render at today (672-814px) while collapsing below a real drawer.\n */\nexport const SCHEMA_FORM_COLUMNS: Record<1 | 2 | 3, string> = {\n\t1: 'grid grid-cols-1 gap-space-xl',\n\t2: 'grid grid-cols-1 gap-space-xl @md/schema-form:grid-cols-2',\n\t3: 'grid grid-cols-1 gap-space-xl @md/schema-form:grid-cols-2 @xl/schema-form:grid-cols-3',\n};\n\nexport const SCHEMA_FORM_FIELD_WIDTH: Record<SchemaFormFieldWidth, string> = {\n\tauto: '',\n\thalf: '@md/schema-form:col-span-1',\n\tthird: '@xl/schema-form:col-span-1',\n\tfull: '@md/schema-form:col-span-full @xl/schema-form:col-span-full',\n};\n\nexport function isFieldHidden(\n\tfield: SchemaFormField,\n\tvalues: SchemaFormValues,\n\tonError?: SchemaFormErrorHandler,\n): boolean {\n\tif (typeof field.hidden === 'function') {\n\t\ttry {\n\t\t\treturn field.hidden(values);\n\t\t} catch (error) {\n\t\t\tonError?.(error);\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn field.hidden ?? false;\n}\n\nexport function isFieldDisabled(\n\tfield: SchemaFormField,\n\tvalues: SchemaFormValues,\n\tonError?: SchemaFormErrorHandler,\n): boolean {\n\tif (typeof field.disabled === 'function') {\n\t\ttry {\n\t\t\treturn field.disabled(values);\n\t\t} catch (error) {\n\t\t\tonError?.(error);\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn field.disabled ?? false;\n}\n\nexport function getVisibleFields(\n\tfields: SchemaFormField[],\n\tvalues: SchemaFormValues,\n\tonError?: SchemaFormErrorHandler,\n): SchemaFormField[] {\n\treturn fields.filter((field) => !isFieldHidden(field, values, onError));\n}\n\nexport function resolveSchemaSections(\n\tschema: SchemaFormSchema,\n\tvalues: SchemaFormValues,\n\tdefaultSectionTitle: string,\n\tdefaultColumns: 1 | 2 | 3,\n\tonError?: SchemaFormErrorHandler,\n): ResolvedSchemaFormSection[] {\n\tconst visibleFields = getVisibleFields(schema.fields, values, onError);\n\tconst fieldsByKey = new Map(visibleFields.map((field) => [field.key, field]));\n\tconst usedKeys = new Set<string>();\n\tconst sections: ResolvedSchemaFormSection[] = [];\n\n\tfor (const section of schema.sections ?? []) {\n\t\tconst sectionFields = section.fields\n\t\t\t? section.fields\n\t\t\t\t\t.map((key) => fieldsByKey.get(key))\n\t\t\t\t\t.filter((field): field is SchemaFormField => field !== undefined)\n\t\t\t: visibleFields.filter((field) => field.sectionId === section.id);\n\n\t\tfor (const field of sectionFields) {\n\t\t\tusedKeys.add(field.key);\n\t\t}\n\n\t\tsections.push({\n\t\t\tid: section.id,\n\t\t\ttitle: section.title,\n\t\t\tdescription: section.description,\n\t\t\ticon: section.icon,\n\t\t\tfields: sectionFields,\n\t\t\tcolumns: section.columns ?? defaultColumns,\n\t\t\tfooterSlot: section.footerSlot,\n\t\t\tclassName: section.className,\n\t\t});\n\t}\n\n\tconst unsectioned = visibleFields.filter((field) => !usedKeys.has(field.key));\n\tif (unsectioned.length > 0 || sections.length === 0) {\n\t\tsections.unshift({\n\t\t\tid: 'default',\n\t\t\ttitle: schema.sections?.length ? defaultSectionTitle : undefined,\n\t\t\tfields: unsectioned,\n\t\t\tcolumns: defaultColumns,\n\t\t});\n\t}\n\n\treturn sections.filter((section) => section.fields.length > 0);\n}\n\nexport function toStringValue(value: SchemaFormValue): string {\n\tif (value === undefined || value === null) return '';\n\tif (typeof value === 'string') return value;\n\tif (typeof value === 'number' || typeof value === 'boolean') return String(value);\n\treturn JSON.stringify(value);\n}\n\nexport function toStringArray(value: SchemaFormValue): string[] {\n\tif (!Array.isArray(value)) return [];\n\treturn value.map((item) => String(item));\n}\n\nexport function toBooleanValue(value: SchemaFormValue): boolean {\n\treturn value === true || value === 'true' || value === 1;\n}\n\nexport function parseNumberValue(rawValue: string, integer = false): number | null {\n\tconst trimmed = rawValue.trim();\n\tif (trimmed.length === 0) return null;\n\tconst parsed = integer ? Number.parseInt(trimmed, 10) : Number.parseFloat(trimmed);\n\treturn Number.isNaN(parsed) ? null : parsed;\n}\n\nexport function formatJsonValue(value: SchemaFormValue, indent = 2): string {\n\tif (value === undefined || value === null) return '';\n\tif (typeof value === 'string') return value;\n\ttry {\n\t\treturn JSON.stringify(value, null, indent);\n\t} catch {\n\t\treturn String(value);\n\t}\n}\n\nexport function parseJsonValue(rawValue: string): { value: SchemaFormValue; valid: boolean } {\n\tconst trimmed = rawValue.trim();\n\tif (trimmed.length === 0) return { value: null, valid: true };\n\n\ttry {\n\t\treturn { value: JSON.parse(trimmed) as SchemaFormValue, valid: true };\n\t} catch {\n\t\treturn { value: rawValue, valid: false };\n\t}\n}\n","import { useCallback, useMemo, useState } from 'react';\n\nimport type {\n\tSchemaFormErrors,\n\tSchemaFormField,\n\tSchemaFormSubmitHelpers,\n\tSchemaFormValue,\n\tSchemaFormValues,\n} from '../schema-form.types';\nimport { isFieldHidden } from '../schema-form.utils';\n\nexport interface UseSchemaFormOptions {\n\tfields: SchemaFormField[];\n\tvalue?: SchemaFormValues;\n\tdefaultValue?: SchemaFormValues;\n\terrors?: SchemaFormErrors;\n\tonValueChange?: (values: SchemaFormValues) => void;\n\tonFieldChange?: (key: string, value: SchemaFormValue, values: SchemaFormValues) => void;\n\tformatRequiredError: (label: string) => string;\n\tvalidationError: string;\n\tonError?: (error: unknown) => void;\n}\n\nexport interface UseSchemaFormResult extends SchemaFormSubmitHelpers {\n\tvalues: SchemaFormValues;\n\terrors: SchemaFormErrors;\n\tgetFieldError: (key: string) => string | undefined;\n\tgetFieldValue: (key: string) => SchemaFormValue;\n\tsetFieldValue: (key: string, value: SchemaFormValue) => void;\n\tsetValues: (values: SchemaFormValues) => void;\n\treset: () => SchemaFormValues;\n\tvalidate: () => boolean;\n}\n\nfunction getDefaultValues(fields: SchemaFormField[], defaultValue?: SchemaFormValues): SchemaFormValues {\n\tconst values: SchemaFormValues = { ...defaultValue };\n\n\tfor (const field of fields) {\n\t\tif (field.defaultValue !== undefined && values[field.key] === undefined) {\n\t\t\tvalues[field.key] = field.defaultValue;\n\t\t}\n\t}\n\n\treturn values;\n}\n\nfunction shouldRequireValue(value: SchemaFormValue): boolean {\n\tif (value === undefined || value === null) return true;\n\tif (typeof value === 'string') return value.trim().length === 0;\n\tif (Array.isArray(value)) return value.length === 0;\n\treturn false;\n}\n\nfunction normalizeErrors(errors?: SchemaFormErrors): SchemaFormErrors {\n\tconst next: SchemaFormErrors = {};\n\tfor (const [key, message] of Object.entries(errors ?? {})) {\n\t\tif (message) next[key] = message;\n\t}\n\treturn next;\n}\n\nexport function useSchemaForm({\n\tfields,\n\tvalue,\n\tdefaultValue,\n\terrors: externalErrors,\n\tonValueChange,\n\tonFieldChange,\n\tformatRequiredError,\n\tvalidationError,\n\tonError,\n}: UseSchemaFormOptions): UseSchemaFormResult {\n\tconst isControlled = value !== undefined;\n\tconst initialValues = useMemo(\n\t\t() => getDefaultValues(fields, defaultValue),\n\t\t[defaultValue, fields],\n\t);\n\tconst [internalValues, setInternalValues] = useState<SchemaFormValues>(() => initialValues);\n\tconst [validationErrors, setValidationErrors] = useState<SchemaFormErrors>({});\n\tconst values = useMemo(\n\t\t() => (isControlled ? { ...initialValues, ...value } : internalValues),\n\t\t[initialValues, internalValues, isControlled, value],\n\t);\n\n\tconst mergedErrors = useMemo(\n\t\t() => ({\n\t\t\t...validationErrors,\n\t\t\t...normalizeErrors(externalErrors),\n\t\t}),\n\t\t[externalErrors, validationErrors],\n\t);\n\n\tconst setValues = useCallback(\n\t\t(nextValues: SchemaFormValues) => {\n\t\t\tif (!isControlled) setInternalValues(nextValues);\n\t\t\tonValueChange?.(nextValues);\n\t\t},\n\t\t[isControlled, onValueChange],\n\t);\n\n\tconst setFieldValue = useCallback(\n\t\t(key: string, fieldValue: SchemaFormValue) => {\n\t\t\tconst nextValues = { ...values, [key]: fieldValue };\n\t\t\tif (!isControlled) setInternalValues(nextValues);\n\t\t\tsetValidationErrors((current) => {\n\t\t\t\tif (!current[key]) return current;\n\t\t\t\tconst next = { ...current };\n\t\t\t\tdelete next[key];\n\t\t\t\treturn next;\n\t\t\t});\n\t\t\tonFieldChange?.(key, fieldValue, nextValues);\n\t\t\tonValueChange?.(nextValues);\n\t\t},\n\t\t[isControlled, onFieldChange, onValueChange, values],\n\t);\n\n\tconst reset = useCallback(() => {\n\t\tconst nextValues = getDefaultValues(fields, defaultValue);\n\t\tif (!isControlled) setInternalValues(nextValues);\n\t\tsetValidationErrors({});\n\t\tonValueChange?.(nextValues);\n\t\treturn nextValues;\n\t}, [defaultValue, fields, isControlled, onValueChange]);\n\n\tconst validate = useCallback(() => {\n\t\tconst nextErrors: SchemaFormErrors = {};\n\n\t\tfor (const field of fields) {\n\t\t\tif (isFieldHidden(field, values, onError)) continue;\n\n\t\t\tconst fieldValue = values[field.key];\n\t\t\tif (field.required && shouldRequireValue(fieldValue)) {\n\t\t\t\tnextErrors[field.key] = formatRequiredError(field.label);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst validators = Array.isArray(field.validate)\n\t\t\t\t? field.validate\n\t\t\t\t: field.validate\n\t\t\t\t\t? [field.validate]\n\t\t\t\t\t: [];\n\n\t\t\tfor (const validator of validators) {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = validator(fieldValue, values, field);\n\t\t\t\t\tif (typeof result === 'string' && result.length > 0) {\n\t\t\t\t\t\tnextErrors[field.key] = result;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tonError?.(error);\n\t\t\t\t\tnextErrors[field.key] = validationError;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsetValidationErrors(nextErrors);\n\t\treturn Object.keys(nextErrors).length === 0;\n\t}, [fields, formatRequiredError, onError, validationError, values]);\n\n\tconst getFieldError = useCallback(\n\t\t(key: string) => mergedErrors[key],\n\t\t[mergedErrors],\n\t);\n\n\tconst getFieldValue = useCallback(\n\t\t(key: string) => values[key],\n\t\t[values],\n\t);\n\n\treturn {\n\t\tvalues,\n\t\terrors: mergedErrors,\n\t\tgetFieldError,\n\t\tgetFieldValue,\n\t\tsetFieldValue,\n\t\tsetValues,\n\t\treset,\n\t\tvalidate,\n\t};\n}\n","import { Button } from '../../../base/buttons';\nimport { Stack } from '../../../base/structure';\nimport {compositionRhythm} from '../../../base/structure/composition.recipes';\nimport { cn } from '../../../../lib/utils';\n\nexport interface SchemaFormActionsProps {\n\t/** Copy for the submit button. */\n\tsubmitLabel: string;\n\t/** Copy for the reset button. */\n\tresetLabel: string;\n\t/** Renders the reset. */\n\tshowReset?: boolean;\n\t/** Renders the entry as unselectable. */\n\tdisabled?: boolean;\n\t/** Disables the submit button. */\n\tsubmitDisabled?: boolean;\n\t/** Disables the reset button. */\n\tresetDisabled?: boolean;\n\t/** Shows the pending state on submit. */\n\tsubmitting?: boolean;\n\tonReset?: () => void;\n\t/** Merged onto the outermost node. */\n\tclassName?: string;\n}\n\nexport function SchemaFormActions({\n\tsubmitLabel,\n\tresetLabel,\n\tshowReset = false,\n\tdisabled = false,\n\tsubmitDisabled = false,\n\tresetDisabled = false,\n\tsubmitting = false,\n\tonReset,\n\tclassName,\n}: SchemaFormActionsProps) {\n\treturn (\n\t\t<Stack direction=\"horizontal\" align=\"center\" justify=\"end\" gap={compositionRhythm.commands} className={cn('schema-form-actions--component', className)}>\n\t\t\t{!!showReset && (\n\t\t\t\t<Button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\tbuttonStyle=\"outline\"\n\t\t\t\t\tdisabled={disabled || resetDisabled || submitting}\n\t\t\t\t\tonClick={onReset}\n\t\t\t\t>\n\t\t\t\t\t{resetLabel}\n\t\t\t\t</Button>\n\t\t\t)}\n\t\t\t<Button\n\t\t\t\ttype=\"submit\"\n\t\t\t\ttone=\"primary\"\n\t\t\t\tloading={submitting}\n\t\t\t\tdisabled={disabled || submitDisabled}\n\t\t\t>\n\t\t\t\t{submitLabel}\n\t\t\t</Button>\n\t\t</Stack>\n\t);\n}\n\nSchemaFormActions.displayName = 'SchemaFormActions';\n","import { EmptyState } from '../../../blocks/data-display';\nimport { cn } from '../../../../lib/utils';\n\nexport interface SchemaFormEmptyProps {\n\t/** Surface title. */\n\ttitle: string;\n\t/** Supporting copy shown under the label. */\n\tdescription: string;\n\t/** Merged onto the outermost node. */\n\tclassName?: string;\n}\n\nexport function SchemaFormEmpty({ title, description, className }: SchemaFormEmptyProps) {\n\treturn (\n\t\t<EmptyState\n\t\t\ttitle={title}\n\t\t\tdescription={description}\n\t\t\tpadding=\"md\"\n\t\t\tborder\n\t\t\tclassName={cn('schema-form-empty--component bg-muted/30', className)}\n\t\t/>\n\t);\n}\n\nSchemaFormEmpty.displayName = 'SchemaFormEmpty';\n","import { useEffect, useState, type ElementType } from 'react';\n\nimport { CardCheckboxGroup, CardRadioGroup, Select, SwitchCard, ToggleField } from '../../../base/choice-inputs';\nimport { FormField } from '../../../base/forms';\nimport { Input, Textarea } from '../../../base/text-inputs';\nimport { TagsInput } from '../../../base/value-inputs';\nimport { DecimalInput } from '../../../base/forms-numeric';\nimport { cn } from '../../../../lib/utils';\n\nimport type { SchemaFormStrings } from '../schema-form.strings';\nimport type {\n\tSchemaFormField,\n\tSchemaFormFieldContext,\n\tSchemaFormValue,\n\tSchemaFormValues,\n} from '../schema-form.types';\nimport {\n\tformatJsonValue,\n\tparseJsonValue,\n\tparseNumberValue,\n\ttoBooleanValue,\n\ttoStringArray,\n\ttoStringValue,\n} from '../schema-form.utils';\n\nexport interface SchemaFormFieldRendererProps extends SchemaFormFieldContext {\n\t/** Overrides this surface's own copy. */\n\tstrings: SchemaFormStrings;\n\t/** Merged onto the outermost node. */\n\tclassName?: string;\n}\n\nfunction getFieldHint(field: SchemaFormField): string | undefined {\n\treturn field.hint ?? field.description;\n}\n\nfunction getTextDisplayValue(\n\tfield: SchemaFormField,\n\tvalue: SchemaFormValue,\n\tvalues: SchemaFormValues,\n\tonError?: (error: unknown) => void,\n): string {\n\tif (field.formatValue) {\n\t\ttry {\n\t\t\treturn field.formatValue(value, values);\n\t\t} catch (error) {\n\t\t\tonError?.(error);\n\t\t}\n\t}\n\treturn toStringValue(value);\n}\n\nfunction parseTextValue(\n\tfield: SchemaFormField,\n\trawValue: string,\n\tvalues: SchemaFormValues,\n\tonError?: (error: unknown) => void,\n): SchemaFormValue {\n\tif (field.parseValue) {\n\t\ttry {\n\t\t\treturn field.parseValue(rawValue, values);\n\t\t} catch (error) {\n\t\t\tonError?.(error);\n\t\t}\n\t}\n\treturn rawValue;\n}\n\nfunction parseNumberFieldValue(\n\tfield: SchemaFormField,\n\trawValue: string,\n\tvalues: SchemaFormValues,\n\tinteger: boolean,\n\tonError?: (error: unknown) => void,\n): SchemaFormValue {\n\tif (field.parseValue) {\n\t\ttry {\n\t\t\treturn field.parseValue(rawValue, values);\n\t\t} catch (error) {\n\t\t\tonError?.(error);\n\t\t}\n\t}\n\treturn parseNumberValue(rawValue, integer);\n}\n\nfunction parseJsonFieldValue(\n\tfield: SchemaFormField,\n\trawValue: string,\n\tvalues: SchemaFormValues,\n\tonError?: (error: unknown) => void,\n): { value: SchemaFormValue; valid: boolean } {\n\tif (field.type === 'json' && field.parseValue) {\n\t\ttry {\n\t\t\treturn { value: field.parseValue(rawValue, values), valid: true };\n\t\t} catch (error) {\n\t\t\tonError?.(error);\n\t\t\treturn { value: rawValue, valid: false };\n\t\t}\n\t}\n\treturn parseJsonValue(rawValue);\n}\n\nfunction optionIconNode(option: { icon?: ElementType }) {\n\tif (!option.icon) return undefined;\n\tconst Icon = option.icon;\n\treturn <Icon className=\"size-icon\" aria-hidden=\"true\" />;\n}\n\nfunction JsonFieldControl({\n\tfield,\n\tvalue,\n\tvalues,\n\terror,\n\tdisabled,\n\tfieldId,\n\tonValueChange,\n\tonError,\n\tstrings,\n}: SchemaFormFieldContext & { strings: SchemaFormStrings }) {\n\tconst indent = field.type === 'json' ? field.jsonIndent ?? 2 : 2;\n\tconst [text, setText] = useState(() => formatJsonValue(value, indent));\n\tconst [parseError, setParseError] = useState<string | undefined>();\n\tconst [isFocused, setIsFocused] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (!isFocused) setText(formatJsonValue(value, indent));\n\t}, [indent, isFocused, value]);\n\n\tif (field.type !== 'json') return null;\n\n\tconst commit = (rawValue: string) => {\n\t\tconst parsed = parseJsonFieldValue(field, rawValue, values, onError);\n\t\tsetParseError(parsed.valid ? undefined : strings.jsonParseError);\n\t\tonValueChange(parsed.value);\n\t\treturn parsed;\n\t};\n\n\treturn (\n\t\t<FormField\n\t\t\tlabel={field.label}\n\t\t\trequired={field.required}\n\t\t\thint={getFieldHint(field)}\n\t\t\thelperText={field.helperText}\n\t\t\terror={error ?? parseError}\n\t\t\thtmlFor={fieldId}\n\t\t\tsupportingTextId={`${fieldId}-supporting`}\n\t\t\tclassName=\"schema-form-field--component schema-form-field--json\"\n\t\t>\n\t\t\t<Textarea\n\t\t\t\tid={fieldId}\n\t\t\t\tname={field.key}\n\t\t\t\tvalue={text}\n\t\t\t\trows={field.rows ?? 6}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tinvalid={Boolean(error ?? parseError)}\n\t\t\t\tplaceholder={field.placeholder}\n\t\t\t\tspellCheck={false}\n\t\t\t\tclassName={cn('font-mono', field.controlClassName)}\n\t\t\t\tonFocus={() => setIsFocused(true)}\n\t\t\t\tonChange={(event) => {\n\t\t\t\t\tconst next = event.target.value;\n\t\t\t\t\tsetText(next);\n\t\t\t\t\tconst parsed = parseJsonFieldValue(field, next, values, onError);\n\t\t\t\t\tsetParseError(parsed.valid ? undefined : strings.jsonParseError);\n\t\t\t\t\tonValueChange(parsed.value);\n\t\t\t\t}}\n\t\t\t\tonBlur={() => {\n\t\t\t\t\tsetIsFocused(false);\n\t\t\t\t\tconst parsed = commit(text);\n\t\t\t\t\tif (parsed.valid) setText(formatJsonValue(parsed.value, indent));\n\t\t\t\t}}\n\t\t\t\t{...field.textareaProps}\n\t\t\t\t\taria-describedby={[field.textareaProps?.['aria-describedby'], error || parseError || field.helperText || getFieldHint(field) ? `${fieldId}-supporting` : undefined].filter(Boolean).join(' ') || undefined}\n\t\t\t/>\n\t\t</FormField>\n\t);\n}\n\nexport function SchemaFormFieldRenderer({\n\tfield,\n\tvalue,\n\tvalues,\n\terror,\n\tdisabled,\n\trequired,\n\tfieldId,\n\tonValueChange,\n\tonError,\n\tstrings,\n\tclassName,\n}: SchemaFormFieldRendererProps) {\n\tconst fieldType = field.type ?? 'text';\n\tconst commonFieldProps = {\n\t\tlabel: field.label,\n\t\trequired,\n\t\thint: getFieldHint(field),\n\t\thelperText: field.helperText,\n\t\terror,\n\t\thtmlFor: fieldId,\n\t\tsupportingTextId: `${fieldId}-supporting`,\n\t\tclassName: cn('schema-form-field--component', className),\n\t};\n\n\tconst controlClassName = field.controlClassName;\n\tconst describedBy = error || field.helperText || getFieldHint(field) ? `${fieldId}-supporting` : undefined;\n\n\tif (fieldType === 'custom' && field.type === 'custom') {\n\t\treturn (\n\t\t\t<div className={cn('schema-form-field--component schema-form-field--custom', className)}>\n\t\t\t\t{field.render({ field, value, values, error, disabled, required, fieldId, onValueChange, onError })}\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif (fieldType === 'switch' && field.type === 'switch') {\n\t\tconst checked = toBooleanValue(value);\n\t\tif (field.switchStyle === 'card') {\n\t\t\treturn (\n\t\t\t\t<FormField error={error} supportingTextId={`${fieldId}-supporting`} className={cn('schema-form-field--component schema-form-field--switch-card', className)}>\n\t\t\t\t\t<SwitchCard\n\t\t\t\t\tlabel={field.label}\n\t\t\t\t\t\tdescription={field.description}\n\t\t\t\t\t\thint={field.hint}\n\t\t\t\t\t\tname={field.key}\n\t\t\t\t\t\tvalue={checked}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\t\tonValueChange={(next) => onValueChange(next)}\n\t\t\t\t\t\t{...field.switchCardProps}\n\t\t\t\t\taria-describedby={[field.switchCardProps?.['aria-describedby'], error ? `${fieldId}-supporting` : undefined].filter(Boolean).join(' ') || undefined}\n\t\t\t\t\t/>\n\t\t\t\t</FormField>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<FormField error={error} supportingTextId={`${fieldId}-supporting`} className={cn('schema-form-field--component schema-form-field--switch', className)}>\n\t\t\t\t<ToggleField\n\t\t\t\t\tlabel={field.label}\n\t\t\t\t\tdescription={field.description ?? field.hint}\n\t\t\t\t\tname={field.key}\n\t\t\t\t\tvalue={checked}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\tonValueChange={(next) => onValueChange(next)}\n\t\t\t\t\t{...field.switchProps}\n\t\t\t\t\taria-describedby={[field.switchProps?.['aria-describedby'], error ? `${fieldId}-supporting` : undefined].filter(Boolean).join(' ') || undefined}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tif (fieldType === 'json') {\n\t\treturn (\n\t\t\t<JsonFieldControl\n\t\t\t\tfield={field}\n\t\t\t\tvalue={value}\n\t\t\t\tvalues={values}\n\t\t\t\terror={error}\n\t\t\t\tdisabled={disabled}\n\t\t\t\trequired={required}\n\t\t\t\tfieldId={fieldId}\n\t\t\t\tonValueChange={onValueChange}\n\t\t\t\tonError={onError}\n\t\t\t\tstrings={strings}\n\t\t\t/>\n\t\t);\n\t}\n\n\tif (fieldType === 'textarea' && field.type === 'textarea') {\n\t\tconst displayValue = getTextDisplayValue(field, value, values, onError);\n\t\treturn (\n\t\t\t<FormField {...commonFieldProps}>\n\t\t\t\t<Textarea\n\t\t\t\t\taria-describedby={describedBy}\n\t\t\t\t\tid={fieldId}\n\t\t\t\t\tname={field.key}\n\t\t\t\t\tvalue={displayValue}\n\t\t\t\t\trows={field.rows}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tplaceholder={field.placeholder}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\tonChange={(event) => onValueChange(parseTextValue(field, event.target.value, values, onError))}\n\t\t\t\t\t{...field.textareaProps}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tif ((fieldType === 'number' || fieldType === 'integer' || fieldType === 'decimal') && (\n\t\tfield.type === 'number' || field.type === 'integer' || field.type === 'decimal'\n\t)) {\n\t\tconst displayValue = getTextDisplayValue(field, value, values, onError);\n\t\tconst integer = field.type === 'integer';\n\t\tconst decimalPlaces = integer ? 0 : field.decimalPlaces ?? (field.type === 'decimal' ? 2 : 4);\n\t\treturn (\n\t\t\t<FormField {...commonFieldProps}>\n\t\t\t\t<DecimalInput\n\t\t\t\t\tid={fieldId}\n\t\t\t\t\tname={field.key}\n\t\t\t\t\tvalue={displayValue}\n\t\t\t\t\tmin={field.min}\n\t\t\t\t\tmax={field.max}\n\t\t\t\t\tstep={field.step}\n\t\t\t\t\tdecimalPlaces={decimalPlaces}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tplaceholder={field.placeholder}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\tonChange={(event) => {\n\t\t\t\t\t\tconst rawValue = event.target.value;\n\t\t\t\t\t\tonValueChange(parseNumberFieldValue(field, rawValue, values, integer, onError));\n\t\t\t\t\t}}\n\t\t\t\t\t{...field.numberProps}\n\t\t\t\t\taria-describedby={[field.numberProps?.['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tif (fieldType === 'select' && field.type === 'select') {\n\t\tconst options = field.options.map((option) => ({\n\t\t\tvalue: option.value,\n\t\t\tlabel: option.label,\n\t\t\tdisabled: option.disabled,\n\t\t\ticon: optionIconNode(option),\n\t\t}));\n\n\t\treturn (\n\t\t\t<FormField {...commonFieldProps}>\n\t\t\t\t<Select\n\t\t\t\t\tname={field.key}\n\t\t\t\t\tvalue={toStringValue(value)}\n\t\t\t\t\toptions={options}\n\t\t\t\t\tallowClear={field.allowClear}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tplaceholder={field.placeholder}\n\t\t\t\t\taria-label={field.label}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\tonValueChange={(next) => onValueChange(next ?? null)}\n\t\t\t\t\t{...field.selectProps}\n\t\t\t\t\taria-describedby={[field.selectProps?.['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tif (fieldType === 'radio-cards' && field.type === 'radio-cards') {\n\t\treturn (\n\t\t\t<FormField {...commonFieldProps}>\n\t\t\t\t<CardRadioGroup\n\t\t\t\t\tname={field.key}\n\t\t\t\t\tvalue={toStringValue(value)}\n\t\t\t\t\toptions={field.options}\n\t\t\t\t\tcolumns={field.columns}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\tonValueChange={(next) => onValueChange(next)}\n\t\t\t\t\t{...field.radioProps}\n\t\t\t\t\taria-describedby={[field.radioProps?.['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tif (fieldType === 'checkbox-cards' && field.type === 'checkbox-cards') {\n\t\treturn (\n\t\t\t<FormField {...commonFieldProps}>\n\t\t\t\t<CardCheckboxGroup\n\t\t\t\t\tname={field.key}\n\t\t\t\t\tvalue={toStringArray(value)}\n\t\t\t\t\toptions={field.options}\n\t\t\t\t\tcolumns={field.columns}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\tonValueChange={(next) => onValueChange(next)}\n\t\t\t\t\t{...field.checkboxProps}\n\t\t\t\t\taria-describedby={[field.checkboxProps?.['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tif (fieldType === 'tags' && field.type === 'tags') {\n\t\treturn (\n\t\t\t<FormField {...commonFieldProps}>\n\t\t\t\t<TagsInput\n\t\t\t\t\tid={fieldId}\n\t\t\t\t\tvalue={toStringArray(value)}\n\t\t\t\t\trecommendations={field.recommendations}\n\t\t\t\t\tmaxTags={field.maxTags}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tplaceholder={field.placeholder}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\tonValueChange={(next) => onValueChange(next)}\n\t\t\t\t\t{...field.tagsProps}\n\t\t\t\t\taria-describedby={[field.tagsProps?.['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tconst inputType = fieldType === 'text' ? 'text' : fieldType;\n\tconst nativeInputProps = field.type === undefined || field.type === 'text' || field.type === 'email' || field.type === 'password' || field.type === 'url' || field.type === 'tel' || field.type === 'search' ? field.inputProps : undefined;\n\tconst displayValue = getTextDisplayValue(field, value, values, onError);\n\n\treturn (\n\t\t<FormField {...commonFieldProps}>\n\t\t\t<Input\n\t\t\t\tid={fieldId}\n\t\t\t\tname={field.key}\n\t\t\t\ttype={inputType}\n\t\t\t\tvalue={displayValue}\n\t\t\t\tdisabled={disabled}\n\t\t\t\trequired={required}\n\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\tplaceholder={field.placeholder}\n\t\t\t\tclassName={controlClassName}\n\t\t\t\tonChange={(event) => onValueChange(parseTextValue(field, event.target.value, values, onError))}\n\t\t\t\t{...nativeInputProps}\n\t\t\t\taria-describedby={[nativeInputProps?.['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined}\n\t\t\t/>\n\t\t</FormField>\n\t);\n}\n\nSchemaFormFieldRenderer.displayName = 'SchemaFormFieldRenderer';\n","export interface SchemaFormStrings {\n\tsubmitLabel: string;\n\tresetLabel: string;\n\tdefaultSectionTitle: string;\n\temptyTitle: string;\n\temptyDescription: string;\n\tjsonParseError: string;\n\tvalidationError: string;\n\tformatRequiredError: (label: string) => string;\n}\n\nexport const defaultSchemaFormStrings: SchemaFormStrings = {\n\tsubmitLabel: 'Save changes',\n\tresetLabel: 'Reset',\n\tdefaultSectionTitle: 'General',\n\temptyTitle: 'No fields configured',\n\temptyDescription: 'Add fields to the schema to render a form.',\n\tjsonParseError: 'Enter valid JSON.',\n\tvalidationError: 'Invalid value.',\n\tformatRequiredError: (label) => `${label} is required.`,\n};\n","import { Fragment, useId, useMemo } from 'react';\n\nimport { Card } from '../../base/cards';\nimport { ContentBlock } from '../../base/display';\nimport { Stack } from '../../base/structure';\nimport {compositionRhythm} from '../../base/structure/composition.recipes';\nimport { Text } from '../../typography';\nimport {copyRoleProps} from '../../typography/text.styles';\nimport { useStrings } from '../../../lib/strings';\nimport { cn } from '../../../lib/utils';\n\nimport { useSchemaForm } from './hooks';\nimport {\n\tSchemaFormActions,\n\tSchemaFormEmpty,\n\tSchemaFormFieldRenderer,\n} from './partials';\nimport {\n\tdefaultSchemaFormStrings,\n\ttype SchemaFormStrings,\n} from './schema-form.strings';\nimport type {\n\tResolvedSchemaFormSection,\n\tSchemaFormField,\n\tSchemaFormFieldContext,\n\tSchemaFormProps,\n\tSchemaFormSubmitHelpers,\n} from './schema-form.types';\nimport {\n\tSCHEMA_FORM_COLUMNS,\n\tSCHEMA_FORM_FIELD_WIDTH,\n\tisFieldDisabled,\n\tresolveSchemaSections,\n} from './schema-form.utils';\n\nfunction toDomId(value: string): string {\n\treturn value.replace(/[^a-zA-Z0-9_-]/g, '-');\n}\n\nfunction SectionHeading({ section }: { section: ResolvedSchemaFormSection }) {\n\tif (!section.title && !section.description) return null;\n\n\treturn (\n\t\t<Stack gap=\"normal\" className=\"schema-form--section-heading\">\n\t\t\t{!!section.title && (\n\t\t\t\t<Text {...copyRoleProps.subsection} className=\"schema-form--section-title\">\n\t\t\t\t\t{section.title}\n\t\t\t\t</Text>\n\t\t\t)}\n\t\t\t{!!section.description && (\n\t\t\t\t<Text {...copyRoleProps.structuralDescription} className=\"schema-form--section-description\">\n\t\t\t\t\t{section.description}\n\t\t\t\t</Text>\n\t\t\t)}\n\t\t</Stack>\n\t);\n}\n\nexport function SchemaForm({\n\tschema,\n\tvalue,\n\tdefaultValue,\n\terrors,\n\tdisabled = false,\n\tlayout = 'form',\n\tcolumns = 2,\n\tid,\n\tname,\n\ttitle,\n\tdescription,\n\theaderSlot,\n\tfooterSlot,\n\tactionsSlot,\n\temptySlot,\n\tshowActions,\n\tsubmitLabel,\n\tresetLabel,\n\tsubmitDisabled = false,\n\tresetDisabled = false,\n\tsubmitting = false,\n\tonValueChange,\n\tonFieldChange,\n\tonSubmit,\n\tonReset,\n\tonError,\n\trenderField,\n\trenderSection,\n\tstrings: stringsProp,\n\tclassName,\n\tcontentClassName,\n\tsectionClassName,\n\tfieldClassName,\n}: SchemaFormProps) {\n\tconst generatedId = useId();\n\tconst formId = id ?? `schema-form-${generatedId}`;\n\tconst strings: SchemaFormStrings = useStrings(defaultSchemaFormStrings, stringsProp);\n\tconst form = useSchemaForm({\n\t\tfields: schema.fields,\n\t\tvalue,\n\t\tdefaultValue,\n\t\terrors,\n\t\tonValueChange,\n\t\tonFieldChange,\n\t\tformatRequiredError: strings.formatRequiredError,\n\t\tvalidationError: strings.validationError,\n\t\tonError,\n\t});\n\n\tconst sections = useMemo(\n\t\t() => resolveSchemaSections(schema, form.values, strings.defaultSectionTitle, columns, onError),\n\t\t[columns, form.values, onError, schema, strings.defaultSectionTitle],\n\t);\n\tconst hasFields = sections.some((section) => section.fields.length > 0);\n\n\tconst helpers: SchemaFormSubmitHelpers = {\n\t\tsetFieldValue: form.setFieldValue,\n\t\tsetValues: form.setValues,\n\t\treset: form.reset,\n\t\tvalidate: form.validate,\n\t};\n\n\tconst shouldShowActions = showActions ?? Boolean(onSubmit || onReset || actionsSlot);\n\tconst resolvedSubmitLabel = submitLabel ?? strings.submitLabel;\n\tconst resolvedResetLabel = resetLabel ?? strings.resetLabel;\n\n\tconst renderFieldNode = (field: SchemaFormField) => {\n\t\tconst fieldId = `${formId}-${toDomId(field.key)}`;\n\t\tconst fieldDisabled = disabled || isFieldDisabled(field, form.values, onError);\n\t\tconst context: SchemaFormFieldContext = {\n\t\t\tfield,\n\t\t\tvalue: form.getFieldValue(field.key),\n\t\t\tvalues: form.values,\n\t\t\terror: form.getFieldError(field.key),\n\t\t\tdisabled: fieldDisabled,\n\t\t\trequired: Boolean(field.required),\n\t\t\tfieldId,\n\t\t\tonValueChange: (nextValue) => form.setFieldValue(field.key, nextValue),\n\t\t\tonError,\n\t\t};\n\t\tconst defaultField = (\n\t\t\t<SchemaFormFieldRenderer\n\t\t\t\t{...context}\n\t\t\t\tstrings={strings}\n\t\t\t/>\n\t\t);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tkey={field.key}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'schema-form--field',\n\t\t\t\t\tSCHEMA_FORM_FIELD_WIDTH[field.width ?? 'auto'],\n\t\t\t\t\tfield.className,\n\t\t\t\t\tfieldClassName,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{renderField?.({ ...context, defaultField }) ?? defaultField}\n\t\t\t</div>\n\t\t);\n\t};\n\n\tconst renderSectionFields = (section: ResolvedSchemaFormSection) => (\n\t\t<div className={cn('schema-form--section-fields', SCHEMA_FORM_COLUMNS[section.columns])}>\n\t\t\t{section.fields.map(renderFieldNode)}\n\t\t</div>\n\t);\n\n\tconst renderPlainSection = (section: ResolvedSchemaFormSection) => {\n\t\tconst fields = renderSectionFields(section);\n\t\tconst custom = renderSection?.({ section, fields, values: form.values });\n\t\tif (custom !== undefined && custom !== null) {\n\t\t\treturn <Fragment key={section.id}>{custom}</Fragment>;\n\t\t}\n\n\t\treturn (\n\t\t\t<Stack\n\t\t\t\tkey={section.id}\n\t\t\t\trender={<section />}\n\t\t\t\tgap=\"lg\"\n\t\t\t\tclassName={cn('schema-form--section', section.className, sectionClassName)}\n\t\t\t>\n\t\t\t\t<SectionHeading section={section} />\n\t\t\t\t{fields}\n\t\t\t\t{!!section.footerSlot && (\n\t\t\t\t\t<div className=\"schema-form--section-footer\">\n\t\t\t\t\t\t{section.footerSlot}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t);\n\t};\n\n\tconst renderCardSection = (section: ResolvedSchemaFormSection) => {\n\t\tconst fields = renderSectionFields(section);\n\t\tconst custom = renderSection?.({ section, fields, values: form.values });\n\t\tif (custom !== undefined && custom !== null) {\n\t\t\treturn <Fragment key={section.id}>{custom}</Fragment>;\n\t\t}\n\n\t\treturn (\n\t\t\t<ContentBlock\n\t\t\t\tkey={section.id}\n\t\t\t\tclassName={cn('schema-form--section-card', section.className, sectionClassName)}\n\t\t\t\ticon={section.icon}\n\t\t\t\ttitle={section.title}\n\t\t\t\tdescription={section.description}\n\t\t\t\tfooterSlot={section.footerSlot}\n\t\t\t>\n\t\t\t\t{fields}\n\t\t\t</ContentBlock>\n\t\t);\n\t};\n\n\tconst actions = actionsSlot ?? (\n\t\tshouldShowActions ? (\n\t\t\t<SchemaFormActions\n\t\t\t\tsubmitLabel={resolvedSubmitLabel}\n\t\t\t\tresetLabel={resolvedResetLabel}\n\t\t\t\tshowReset={Boolean(onReset)}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tsubmitDisabled={submitDisabled}\n\t\t\t\tresetDisabled={resetDisabled}\n\t\t\t\tsubmitting={submitting}\n\t\t\t\tonReset={() => {\n\t\t\t\t\tconst nextValues = form.reset();\n\t\t\t\t\tonReset?.(nextValues, helpers);\n\t\t\t\t}}\n\t\t\t/>\n\t\t) : null\n\t);\n\n\tconst empty = emptySlot ?? (\n\t\t<SchemaFormEmpty\n\t\t\ttitle={strings.emptyTitle}\n\t\t\tdescription={strings.emptyDescription}\n\t\t/>\n\t);\n\n\treturn (\n\t\t<form\n\t\t\tid={formId}\n\t\t\tname={name}\n\t\t\tnoValidate\n\t\t\tclassName={cn('schema-form--component @container/schema-form', className)}\n\t\t\tonSubmit={async (event) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif (disabled || submitDisabled || submitting) return;\n\t\t\t\tconst valid = form.validate();\n\t\t\t\tif (!valid) return;\n\t\t\t\ttry {\n\t\t\t\t\tawait onSubmit?.(form.values, helpers, event);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tonError?.(error);\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t{layout === 'cards' ? (\n\t\t\t\t<Stack gap={compositionRhythm.subjects} className={cn('schema-form--cards', contentClassName)}>\n\t\t\t\t\t{!!(title ?? schema.title ?? description ?? schema.description ?? headerSlot) && (\n\t\t\t\t\t\t<Stack direction=\"horizontal\" align=\"start\" justify=\"between\" gap=\"xl\" className=\"schema-form--header\">\n\t\t\t\t\t\t<Stack gap=\"normal\" className=\"min-w-0\">\n\t\t\t\t\t\t\t\t{!!(title ?? schema.title) && (\n\t\t\t\t\t\t\t\t\t<Text type=\"inherit\" size=\"base\" weight=\"semibold\" className=\"schema-form--title\">\n\t\t\t\t\t\t\t\t\t\t{title ?? schema.title}\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{!!(description ?? schema.description) && (\n\t\t\t\t\t\t\t\t\t<Text type=\"secondary\" className=\"schema-form--description\">\n\t\t\t\t\t\t\t\t\t\t{description ?? schema.description}\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t{headerSlot}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t)}\n\t\t\t\t\t{hasFields ? sections.map(renderCardSection) : empty}\n\t\t\t\t\t{footerSlot}\n\t\t\t\t\t{actions}\n\t\t\t\t</Stack>\n\t\t\t) : (\n\t\t\t\t\t<Card\n\t\t\t\t\t\tsurface=\"flat\"\n\t\t\t\t\t\tpadding=\"none\"\n\t\t\t\t\t\tclassName=\"schema-form--surface\"\n\t\t\t\t\t\tgap={compositionRhythm.subjects}\n\t\t\t\t\t\tcontentGap={compositionRhythm.subjects}\n\t\t\t\t\t\tcontentClassName={cn('schema-form--content', contentClassName)}\n\t\t\t\t\t\ttitle={title ?? schema.title}\n\t\t\t\t\t\tdescription={description ?? schema.description}\n\t\t\t\t\t\theaderEnd={headerSlot}\n\t\t\t\t\t\tfooterSlot={\n\t\t\t\t\t\t\tfooterSlot || actions ? (\n\t\t\t\t\t\t\t\t<Stack gap=\"lg\" className=\"schema-form--footer\">\n\t\t\t\t\t\t\t\t\t{footerSlot}\n\t\t\t\t\t\t\t\t\t{actions}\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{hasFields ? sections.map(renderPlainSection) : empty}\n\t\t\t\t\t</Card>\n\t\t\t)}\n\t\t</form>\n\t);\n}\n\nSchemaForm.displayName = 'SchemaForm';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiBA,IAAaiB,IAAiD;CAC7D,GAAG;CACH,GAAG;CACH,GAAG;AACJ,GAEaC,KAAgE;CAC5E,MAAM;CACN,MAAM;CACN,OAAO;CACP,MAAM;AACP;AAEA,SAAgBC,EACf,GACA,GACA,GACU;CACV,IAAI,OAAOC,EAAM,UAAW,YAC3B,IAAI;EACH,OAAOA,EAAM,OAAOC,CAAM;CAC3B,SAASC,GAAO;EAEf,OADAC,IAAUD,CAAK,GACR;CACR;CAED,OAAOF,EAAM,UAAU;AACxB;AAEA,SAAgBI,GACf,GACA,GACA,GACU;CACV,IAAI,OAAOJ,EAAM,YAAa,YAC7B,IAAI;EACH,OAAOA,EAAM,SAASC,CAAM;CAC7B,SAASC,GAAO;EAEf,OADAC,IAAUD,CAAK,GACR;CACR;CAED,OAAOF,EAAM,YAAY;AAC1B;AAEA,SAAgBK,GACf,GACA,GACA,GACoB;CACpB,OAAOC,EAAO,QAAQ,MAAU,CAACP,EAAcC,GAAOC,GAAQE,CAAO,CAAC;AACvE;AAEA,SAAgBI,GACf,GACA,GACA,GACA,GACA,GAC8B;CAC9B,IAAMC,IAAgBH,GAAiBI,EAAO,QAAQR,GAAQE,CAAO,GAC/DO,IAAc,IAAI,IAAIF,EAAc,KAAK,MAAU,CAACR,EAAM,KAAKA,CAAK,CAAC,CAAC,GACtEW,oBAAW,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ACnC,WAAW+I;GACX,YACCC,KAAcR,IACb,kBAACnK,GAAD;IAAO,KAAI;IAAK,WAAU;IAA1B,UAAA,CACE2K,GACAR,CACK;GACJ,CAAA,IAAA,KAAA;GAGJ,UAAAtB,KAAY/G,EAAS,IAAI+H,EAAkB,IAAIO;EAC3C,CAAA;CAEH,CAAA;AAER;AAEA,EAAW,cAAc"}
1
+ {"version":3,"file":"schema-form.js","names":["Text","copyRoleProps","Stack","Card","compositionRhythm","Input","FormField","Textarea","ToggleField","CardCheckboxGroup","Select","SwitchCard","CardRadioGroup","ContentBlock","TagsInput","DecimalInput","EmptyState","SCHEMA_FORM_COLUMNS","SCHEMA_FORM_FIELD_WIDTH","isFieldHidden","field","values","error","onError","isFieldDisabled","getVisibleFields","fields","resolveSchemaSections","visibleFields","schema","fieldsByKey","usedKeys","sections","section","sectionFields","key","defaultColumns","unsectioned","defaultSectionTitle","toStringValue","value","toStringArray","item","toBooleanValue","parseNumberValue","trimmed","rawValue","parsed","integer","formatJsonValue","quoteString","indent","parseJsonValue","getDefaultValues","defaultValue","shouldRequireValue","normalizeErrors","next","message","errors","useSchemaForm","externalErrors","options","isControlled","initialValues","useMemo","internalValues","setInternalValues","useState","validationErrors","setValidationErrors","invalidParsedFields","useRef","committedValues","currentValues","currentOptions","useLayoutEffect","mergedErrors","writeValues","useCallback","nextValues","setValues","setFieldValue","fieldValue","current","setFieldParseValidity","valid","reset","onValueChange","validate","nextErrors","hasParseError","formatRequiredError","validators","validator","result","validationError","min","max","SchemaFormActions","cn","className","showReset","Button","disabled","resetDisabled","submitting","onReset","resetLabel","submitDisabled","submitLabel","SchemaFormEmpty","getFieldHint","getTextDisplayValue","parseTextValue","parseNumberFieldValue","NumberFieldControl","inputProps","editing","draft","setDraft","acceptedDraft","onParseError","onFocus","event","onBlur","text","onParsedChange","parseJsonFieldValue","optionIconNode","option","Icon","JsonFieldControl","quoteParsedString","setText","parseError","setParseError","isFocused","setIsFocused","lastParse","useEffect","acceptedParse","onParseValidityChange","commit","strings","fieldId","SchemaFormFieldRenderer","fieldType","commonFieldProps","controlClassName","describedBy","checked","displayValue","decimalPlaces","inputType","nativeInputProps","defaultSchemaFormStrings","label","toDomId","SectionHeading","SchemaForm","stringsProp","generatedId","useId","formId","id","useStrings","form","columns","hasFields","helpers","shouldShowActions","showActions","onSubmit","actionsSlot","resolvedSubmitLabel","resolvedResetLabel","renderFieldNode","fieldDisabled","context","nextValue","defaultField","fieldClassName","renderField","renderSectionFields","renderPlainSection","custom","renderSection","sectionClassName","Fragment","renderCardSection","actions","empty","emptySlot","submittedValues","layout","contentClassName","title","description","headerSlot","footerSlot"],"sources":["../../src/components/features/schema-form/schema-form.utils.ts","../../src/components/features/schema-form/hooks/use-schema-form.ts","../../src/components/features/schema-form/partials/schema-form-actions.tsx","../../src/components/features/schema-form/partials/schema-form-empty.tsx","../../src/components/features/schema-form/partials/schema-form-field.tsx","../../src/components/features/schema-form/schema-form.strings.ts","../../src/components/features/schema-form/schema-form.tsx"],"sourcesContent":["import type {\n\tResolvedSchemaFormSection,\n\tSchemaFormField,\n\tSchemaFormFieldWidth,\n\tSchemaFormSchema,\n\tSchemaFormValue,\n\tSchemaFormValues,\n} from './schema-form.types';\n\ntype SchemaFormErrorHandler = (error: unknown) => void;\n\n/*\n * Container widths, not viewport widths — a schema form is as often rendered in\n * a drawer or a side panel as at page width, and keyed to the screen it kept\n * three field columns inside a 320px drawer. 448/576 clears every width these\n * forms render at today (672-814px) while collapsing below a real drawer.\n */\nexport const SCHEMA_FORM_COLUMNS: Record<1 | 2 | 3, string> = {\n\t1: 'grid grid-cols-1 gap-space-xl',\n\t2: 'grid grid-cols-1 gap-space-xl @md/schema-form:grid-cols-2',\n\t3: 'grid grid-cols-1 gap-space-xl @md/schema-form:grid-cols-2 @xl/schema-form:grid-cols-3',\n};\n\nexport const SCHEMA_FORM_FIELD_WIDTH: Record<SchemaFormFieldWidth, string> = {\n\tauto: '',\n\thalf: '@md/schema-form:col-span-1',\n\tthird: '@xl/schema-form:col-span-1',\n\tfull: '@md/schema-form:col-span-full @xl/schema-form:col-span-full',\n};\n\nexport function isFieldHidden(\n\tfield: SchemaFormField,\n\tvalues: SchemaFormValues,\n\tonError?: SchemaFormErrorHandler,\n): boolean {\n\tif (typeof field.hidden === 'function') {\n\t\ttry {\n\t\t\treturn field.hidden(values);\n\t\t} catch (error) {\n\t\t\tonError?.(error);\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn field.hidden ?? false;\n}\n\nexport function isFieldDisabled(\n\tfield: SchemaFormField,\n\tvalues: SchemaFormValues,\n\tonError?: SchemaFormErrorHandler,\n): boolean {\n\tif (typeof field.disabled === 'function') {\n\t\ttry {\n\t\t\treturn field.disabled(values);\n\t\t} catch (error) {\n\t\t\tonError?.(error);\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn field.disabled ?? false;\n}\n\nexport function getVisibleFields(\n\tfields: SchemaFormField[],\n\tvalues: SchemaFormValues,\n\tonError?: SchemaFormErrorHandler,\n): SchemaFormField[] {\n\treturn fields.filter((field) => !isFieldHidden(field, values, onError));\n}\n\nexport function resolveSchemaSections(\n\tschema: SchemaFormSchema,\n\tvalues: SchemaFormValues,\n\tdefaultSectionTitle: string,\n\tdefaultColumns: 1 | 2 | 3,\n\tonError?: SchemaFormErrorHandler,\n): ResolvedSchemaFormSection[] {\n\tconst visibleFields = getVisibleFields(schema.fields, values, onError);\n\tconst fieldsByKey = new Map(visibleFields.map((field) => [field.key, field]));\n\tconst usedKeys = new Set<string>();\n\tconst sections: ResolvedSchemaFormSection[] = [];\n\n\tfor (const section of schema.sections ?? []) {\n\t\tconst sectionFields = section.fields\n\t\t\t? section.fields\n\t\t\t\t\t.map((key) => fieldsByKey.get(key))\n\t\t\t\t\t.filter((field): field is SchemaFormField => field !== undefined)\n\t\t\t: visibleFields.filter((field) => field.sectionId === section.id);\n\n\t\tfor (const field of sectionFields) {\n\t\t\tusedKeys.add(field.key);\n\t\t}\n\n\t\tsections.push({\n\t\t\tid: section.id,\n\t\t\ttitle: section.title,\n\t\t\tdescription: section.description,\n\t\t\ticon: section.icon,\n\t\t\tfields: sectionFields,\n\t\t\tcolumns: section.columns ?? defaultColumns,\n\t\t\tfooterSlot: section.footerSlot,\n\t\t\tclassName: section.className,\n\t\t});\n\t}\n\n\tconst unsectioned = visibleFields.filter((field) => !usedKeys.has(field.key));\n\tif (unsectioned.length > 0 || sections.length === 0) {\n\t\tsections.unshift({\n\t\t\tid: 'default',\n\t\t\ttitle: schema.sections?.length ? defaultSectionTitle : undefined,\n\t\t\tfields: unsectioned,\n\t\t\tcolumns: defaultColumns,\n\t\t});\n\t}\n\n\treturn sections.filter((section) => section.fields.length > 0);\n}\n\nexport function toStringValue(value: SchemaFormValue): string {\n\tif (value === undefined || value === null) return '';\n\tif (typeof value === 'string') return value;\n\tif (typeof value === 'number' || typeof value === 'boolean') return String(value);\n\treturn JSON.stringify(value);\n}\n\nexport function toStringArray(value: SchemaFormValue): string[] {\n\tif (!Array.isArray(value)) return [];\n\treturn value.map((item) => String(item));\n}\n\nexport function toBooleanValue(value: SchemaFormValue): boolean {\n\treturn value === true || value === 'true' || value === 1;\n}\n\nexport function parseNumberValue(rawValue: string, integer = false): number | null {\n\tconst trimmed = rawValue.trim();\n\tif (trimmed.length === 0) return null;\n\tconst parsed = integer ? Number.parseInt(trimmed, 10) : Number.parseFloat(trimmed);\n\treturn Number.isNaN(parsed) ? null : parsed;\n}\n\nexport function formatJsonValue(value: SchemaFormValue, indent = 2, quoteString = false): string {\n\tif (value === undefined || value === null) return '';\n\tif (typeof value === 'string') return quoteString ? JSON.stringify(value) : value;\n\ttry {\n\t\treturn JSON.stringify(value, null, indent);\n\t} catch {\n\t\treturn String(value);\n\t}\n}\n\nexport function parseJsonValue(rawValue: string): { value: SchemaFormValue; valid: boolean } {\n\tconst trimmed = rawValue.trim();\n\tif (trimmed.length === 0) return { value: null, valid: true };\n\n\ttry {\n\t\treturn { value: JSON.parse(trimmed) as SchemaFormValue, valid: true };\n\t} catch {\n\t\treturn { value: rawValue, valid: false };\n\t}\n}\n","import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';\n\nimport type {\n\tSchemaFormErrors,\n\tSchemaFormField,\n\tSchemaFormSubmitHelpers,\n\tSchemaFormValue,\n\tSchemaFormValues,\n} from '../schema-form.types';\nimport { isFieldHidden } from '../schema-form.utils';\n\nexport interface UseSchemaFormOptions {\n\tfields: SchemaFormField[];\n\tvalue?: SchemaFormValues;\n\tdefaultValue?: SchemaFormValues;\n\terrors?: SchemaFormErrors;\n\tonValueChange?: (values: SchemaFormValues) => void;\n\tonFieldChange?: (key: string, value: SchemaFormValue, values: SchemaFormValues) => void;\n\tformatRequiredError: (label: string) => string;\n\tvalidationError: string;\n\tonError?: (error: unknown) => void;\n}\n\nexport interface UseSchemaFormResult extends SchemaFormSubmitHelpers {\n\tvalues: SchemaFormValues;\n\terrors: SchemaFormErrors;\n\tgetFieldError: (key: string) => string | undefined;\n\tgetFieldValue: (key: string) => SchemaFormValue;\n\t/** Reads the latest values, including writes made in the current event. */\n\tgetValues: () => SchemaFormValues;\n\tsetFieldValue: (key: string, value: SchemaFormValue) => void;\n\tsetValues: (values: SchemaFormValues) => void;\n\t/** Registers a field editor's current parse validity with form validation. */\n\tsetFieldParseValidity: (key: string, valid: boolean) => void;\n\treset: () => SchemaFormValues;\n\tvalidate: () => boolean;\n}\n\nfunction getDefaultValues(fields: SchemaFormField[], defaultValue?: SchemaFormValues): SchemaFormValues {\n\tconst values: SchemaFormValues = { ...defaultValue };\n\n\tfor (const field of fields) {\n\t\tif (field.defaultValue !== undefined && values[field.key] === undefined) {\n\t\t\tvalues[field.key] = field.defaultValue;\n\t\t}\n\t}\n\n\treturn values;\n}\n\nfunction shouldRequireValue(value: SchemaFormValue): boolean {\n\tif (value === undefined || value === null) return true;\n\tif (typeof value === 'string') return value.trim().length === 0;\n\tif (Array.isArray(value)) return value.length === 0;\n\treturn false;\n}\n\nfunction normalizeErrors(errors?: SchemaFormErrors): SchemaFormErrors {\n\tconst next: SchemaFormErrors = {};\n\tfor (const [key, message] of Object.entries(errors ?? {})) {\n\t\tif (message) next[key] = message;\n\t}\n\treturn next;\n}\n\nexport function useSchemaForm(options: UseSchemaFormOptions): UseSchemaFormResult {\n\tconst { fields, value, defaultValue, errors: externalErrors } = options;\n\tconst isControlled = value !== undefined;\n\tconst initialValues = useMemo(\n\t\t() => getDefaultValues(fields, defaultValue),\n\t\t[defaultValue, fields],\n\t);\n\tconst [internalValues, setInternalValues] = useState<SchemaFormValues>(() => initialValues);\n\tconst [validationErrors, setValidationErrors] = useState<SchemaFormErrors>({});\n\tconst invalidParsedFields = useRef(new Set<string>());\n\tconst values = useMemo(\n\t\t() => (isControlled ? { ...initialValues, ...value } : internalValues),\n\t\t[initialValues, internalValues, isControlled, value],\n\t);\n\tconst committedValues = useRef(values);\n\tconst currentValues = useRef(values);\n\tconst currentOptions = useRef(options);\n\tuseLayoutEffect(() => {\n\t\tcommittedValues.current = values;\n\t\tcurrentValues.current = values;\n\t}, [values]);\n\tuseLayoutEffect(() => {\n\t\tcurrentOptions.current = options;\n\t}, [options]);\n\n\tconst mergedErrors = useMemo(\n\t\t() => ({\n\t\t\t...validationErrors,\n\t\t\t...normalizeErrors(externalErrors),\n\t\t}),\n\t\t[externalErrors, validationErrors],\n\t);\n\n\tconst writeValues = useCallback((nextValues: SchemaFormValues) => {\n\t\tcurrentValues.current = nextValues;\n\t\tif (currentOptions.current.value === undefined) {\n\t\t\tsetInternalValues(nextValues);\n\t\t\treturn;\n\t\t}\n\t\t// Compose same-event controlled proposals. Later events read the\n\t\t// committed parent value if the owner declined the proposal.\n\t\tqueueMicrotask(() => {\n\t\t\tif (currentValues.current === nextValues) currentValues.current = committedValues.current;\n\t\t});\n\t}, []);\n\n\tconst setValues = useCallback(\n\t\t(nextValues: SchemaFormValues) => {\n\t\t\twriteValues(nextValues);\n\t\t\tcurrentOptions.current.onValueChange?.(nextValues);\n\t\t},\n\t\t[writeValues],\n\t);\n\n\tconst setFieldValue = useCallback(\n\t\t(key: string, fieldValue: SchemaFormValue) => {\n\t\t\tconst nextValues = { ...currentValues.current, [key]: fieldValue };\n\t\t\twriteValues(nextValues);\n\t\t\tsetValidationErrors((current) => {\n\t\t\t\tif (!current[key]) return current;\n\t\t\t\tconst next = { ...current };\n\t\t\t\tdelete next[key];\n\t\t\t\treturn next;\n\t\t\t});\n\t\t\tcurrentOptions.current.onFieldChange?.(key, fieldValue, nextValues);\n\t\t\tcurrentOptions.current.onValueChange?.(nextValues);\n\t\t},\n\t\t[writeValues],\n\t);\n\n\tconst setFieldParseValidity = useCallback((key: string, valid: boolean) => {\n\t\tif (valid) invalidParsedFields.current.delete(key);\n\t\telse invalidParsedFields.current.add(key);\n\t}, []);\n\n\tconst reset = useCallback(() => {\n\t\tconst { fields, defaultValue, onValueChange } = currentOptions.current;\n\t\tconst nextValues = getDefaultValues(fields, defaultValue);\n\t\twriteValues(nextValues);\n\t\tinvalidParsedFields.current.clear();\n\t\tsetValidationErrors({});\n\t\tonValueChange?.(nextValues);\n\t\treturn nextValues;\n\t}, [writeValues]);\n\n\tconst validate = useCallback(() => {\n\t\tconst { fields, formatRequiredError, onError, validationError } = currentOptions.current;\n\t\tconst values = currentValues.current;\n\t\tconst nextErrors: SchemaFormErrors = {};\n\t\tlet hasParseError = false;\n\n\t\tfor (const field of fields) {\n\t\t\tif (isFieldHidden(field, values, onError)) continue;\n\t\t\tif (field.type === 'json' && invalidParsedFields.current.has(field.key)) {\n\t\t\t\thasParseError = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fieldValue = values[field.key];\n\t\t\tif (field.required && shouldRequireValue(fieldValue)) {\n\t\t\t\tnextErrors[field.key] = formatRequiredError(field.label);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst validators = Array.isArray(field.validate)\n\t\t\t\t? field.validate\n\t\t\t\t: field.validate\n\t\t\t\t\t? [field.validate]\n\t\t\t\t\t: [];\n\n\t\t\tfor (const validator of validators) {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = validator(fieldValue, values, field);\n\t\t\t\t\tif (typeof result === 'string' && result.length > 0) {\n\t\t\t\t\t\tnextErrors[field.key] = result;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tonError?.(error);\n\t\t\t\t\tnextErrors[field.key] = validationError;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!nextErrors[field.key] && typeof fieldValue === 'number' &&\n\t\t\t\t(field.type === 'number' || field.type === 'integer' || field.type === 'decimal')) {\n\t\t\t\tconst { min, max } = { min: field.min, max: field.max, ...field.numberProps };\n\t\t\t\tif ((min !== undefined && fieldValue < min) || (max !== undefined && fieldValue > max)) {\n\t\t\t\t\tnextErrors[field.key] = validationError;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsetValidationErrors(nextErrors);\n\t\treturn !hasParseError && Object.keys(nextErrors).length === 0;\n\t}, []);\n\n\tconst getFieldError = useCallback(\n\t\t(key: string) => mergedErrors[key],\n\t\t[mergedErrors],\n\t);\n\n\tconst getFieldValue = useCallback(\n\t\t(key: string) => values[key],\n\t\t[values],\n\t);\n\tconst getValues = useCallback(() => currentValues.current, []);\n\n\treturn {\n\t\tvalues,\n\t\terrors: mergedErrors,\n\t\tgetFieldError,\n\t\tgetFieldValue,\n\t\tgetValues,\n\t\tsetFieldValue,\n\t\tsetValues,\n\t\tsetFieldParseValidity,\n\t\treset,\n\t\tvalidate,\n\t};\n}\n","import { Button } from '../../../base/buttons';\nimport { Stack } from '../../../base/structure';\nimport {compositionRhythm} from '../../../base/structure/composition.recipes';\nimport { cn } from '../../../../lib/utils';\n\nexport interface SchemaFormActionsProps {\n\t/** Copy for the submit button. */\n\tsubmitLabel: string;\n\t/** Copy for the reset button. */\n\tresetLabel: string;\n\t/** Renders the reset. */\n\tshowReset?: boolean;\n\t/** Renders the entry as unselectable. */\n\tdisabled?: boolean;\n\t/** Disables the submit button. */\n\tsubmitDisabled?: boolean;\n\t/** Disables the reset button. */\n\tresetDisabled?: boolean;\n\t/** Shows the pending state on submit. */\n\tsubmitting?: boolean;\n\tonReset?: () => void;\n\t/** Merged onto the outermost node. */\n\tclassName?: string;\n}\n\nexport function SchemaFormActions({\n\tsubmitLabel,\n\tresetLabel,\n\tshowReset = false,\n\tdisabled = false,\n\tsubmitDisabled = false,\n\tresetDisabled = false,\n\tsubmitting = false,\n\tonReset,\n\tclassName,\n}: SchemaFormActionsProps) {\n\treturn (\n\t\t<Stack direction=\"horizontal\" align=\"center\" justify=\"end\" gap={compositionRhythm.commands} className={cn('schema-form-actions--component', className)}>\n\t\t\t{!!showReset && (\n\t\t\t\t<Button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\ttone=\"secondary\"\n\t\t\t\t\tbuttonStyle=\"outline\"\n\t\t\t\t\tdisabled={disabled || resetDisabled || submitting}\n\t\t\t\t\tonClick={onReset}\n\t\t\t\t>\n\t\t\t\t\t{resetLabel}\n\t\t\t\t</Button>\n\t\t\t)}\n\t\t\t<Button\n\t\t\t\ttype=\"submit\"\n\t\t\t\ttone=\"primary\"\n\t\t\t\tloading={submitting}\n\t\t\t\tdisabled={disabled || submitDisabled}\n\t\t\t>\n\t\t\t\t{submitLabel}\n\t\t\t</Button>\n\t\t</Stack>\n\t);\n}\n\nSchemaFormActions.displayName = 'SchemaFormActions';\n","import { EmptyState } from '../../../blocks/data-display';\nimport { cn } from '../../../../lib/utils';\n\nexport interface SchemaFormEmptyProps {\n\t/** Surface title. */\n\ttitle: string;\n\t/** Supporting copy shown under the label. */\n\tdescription: string;\n\t/** Merged onto the outermost node. */\n\tclassName?: string;\n}\n\nexport function SchemaFormEmpty({ title, description, className }: SchemaFormEmptyProps) {\n\treturn (\n\t\t<EmptyState\n\t\t\ttitle={title}\n\t\t\tdescription={description}\n\t\t\tpadding=\"md\"\n\t\t\tborder\n\t\t\tclassName={cn('schema-form-empty--component bg-muted/30', className)}\n\t\t/>\n\t);\n}\n\nSchemaFormEmpty.displayName = 'SchemaFormEmpty';\n","import { useEffect, useRef, useState, type ElementType } from 'react';\n\nimport { CardCheckboxGroup, CardRadioGroup, Select, SwitchCard, ToggleField } from '../../../base/choice-inputs';\nimport { FormField } from '../../../base/forms';\nimport { Input, Textarea } from '../../../base/text-inputs';\nimport { TagsInput } from '../../../base/value-inputs';\nimport { DecimalInput, type DecimalInputProps } from '../../../base/forms-numeric';\nimport { cn } from '../../../../lib/utils';\n\nimport type { SchemaFormStrings } from '../schema-form.strings';\nimport type {\n\tSchemaFormField,\n\tSchemaFormFieldContext,\n\tSchemaFormNumberField,\n\tSchemaFormValue,\n\tSchemaFormValues,\n} from '../schema-form.types';\nimport {\n\tformatJsonValue,\n\tparseJsonValue,\n\tparseNumberValue,\n\ttoBooleanValue,\n\ttoStringArray,\n\ttoStringValue,\n} from '../schema-form.utils';\n\nexport interface SchemaFormFieldRendererProps extends SchemaFormFieldContext {\n\t/** Overrides this surface's own copy. */\n\tstrings: SchemaFormStrings;\n\t/** Merged onto the outermost node. */\n\tclassName?: string;\n\t/** Reports whether the JSON editor can parse its current draft. */\n\tonParseValidityChange?: (key: string, valid: boolean) => void;\n}\n\nfunction getFieldHint(field: SchemaFormField): string | undefined {\n\treturn field.hint ?? field.description;\n}\n\nfunction getTextDisplayValue(\n\tfield: SchemaFormField,\n\tvalue: SchemaFormValue,\n\tvalues: SchemaFormValues,\n\tonError?: (error: unknown) => void,\n): string {\n\tif (field.formatValue) {\n\t\ttry {\n\t\t\treturn field.formatValue(value, values);\n\t\t} catch (error) {\n\t\t\tonError?.(error);\n\t\t}\n\t}\n\treturn toStringValue(value);\n}\n\nfunction parseTextValue(\n\tfield: SchemaFormField,\n\trawValue: string,\n\tvalues: SchemaFormValues,\n\tonError?: (error: unknown) => void,\n): SchemaFormValue {\n\tif (field.parseValue) {\n\t\ttry {\n\t\t\treturn field.parseValue(rawValue, values);\n\t\t} catch (error) {\n\t\t\tonError?.(error);\n\t\t}\n\t}\n\treturn rawValue;\n}\n\nfunction parseNumberFieldValue(\n\tfield: SchemaFormField,\n\trawValue: string,\n\tvalues: SchemaFormValues,\n\tinteger: boolean,\n\tonError?: (error: unknown) => void,\n): SchemaFormValue {\n\tif (field.parseValue) {\n\t\ttry {\n\t\t\treturn field.parseValue(rawValue, values);\n\t\t} catch (error) {\n\t\t\tonError?.(error);\n\t\t}\n\t}\n\treturn parseNumberValue(rawValue, integer);\n}\n\nfunction NumberFieldControl({\n\tfield,\n\tvalue,\n\tvalues,\n\tonParsedChange,\n\tonParseError,\n\tonFocus,\n\tonBlur,\n\t...inputProps\n}: Pick<SchemaFormFieldContext, 'value' | 'values'>\n\t& {\n\t\tfield: SchemaFormNumberField;\n\t\tonParsedChange: SchemaFormFieldContext['onValueChange'];\n\t\tonParseError?: SchemaFormFieldContext['onError'];\n\t}\n\t& Omit<DecimalInputProps, 'value' | 'defaultValue' | 'onChange'>) {\n\tconst editing = useRef(false);\n\tconst [draft, setDraft] = useState<{ text: string; value: SchemaFormValue } | null>(null);\n\t// A parent can accept the parsed value or replace it. Only an accepted edit\n\t// can keep intermediate text such as \"1.\" or \"0.0\" in the field.\n\tconst acceptedDraft = draft && Object.is(draft.value, value) ? draft : null;\n\tif (draft && !acceptedDraft) setDraft(null);\n\n\treturn (\n\t\t<DecimalInput\n\t\t\t{...inputProps}\n\t\t\tvalue={acceptedDraft?.text ?? getTextDisplayValue(field, value, values, onParseError)}\n\t\t\tonFocus={(event) => {\n\t\t\t\tediting.current = true;\n\t\t\t\tonFocus?.(event);\n\t\t\t}}\n\t\t\tonBlur={(event) => {\n\t\t\t\tediting.current = false;\n\t\t\t\tsetDraft(null);\n\t\t\t\tonBlur?.(event);\n\t\t\t}}\n\t\t\tonChange={(event) => {\n\t\t\t\tconst text = event.target.value;\n\t\t\t\tconst next = parseNumberFieldValue(field, text, values, field.type === 'integer', onParseError);\n\t\t\t\tif (editing.current) setDraft({ text, value: next });\n\t\t\t\tonParsedChange(next);\n\t\t\t}}\n\t\t/>\n\t);\n}\n\nfunction parseJsonFieldValue(\n\tfield: SchemaFormField,\n\trawValue: string,\n\tvalues: SchemaFormValues,\n\tonError?: (error: unknown) => void,\n): { value: SchemaFormValue; valid: boolean } {\n\tif (field.type === 'json' && field.parseValue) {\n\t\ttry {\n\t\t\treturn { value: field.parseValue(rawValue, values), valid: true };\n\t\t} catch (error) {\n\t\t\tonError?.(error);\n\t\t\treturn { value: rawValue, valid: false };\n\t\t}\n\t}\n\treturn parseJsonValue(rawValue);\n}\n\nfunction optionIconNode(option: { icon?: ElementType }) {\n\tif (!option.icon) return undefined;\n\tconst Icon = option.icon;\n\treturn <Icon className=\"size-icon\" aria-hidden=\"true\" />;\n}\n\nfunction JsonFieldControl({\n\tfield,\n\tvalue,\n\tvalues,\n\terror,\n\tdisabled,\n\tfieldId,\n\tonValueChange,\n\tonError,\n\tstrings,\n\tonParseValidityChange,\n}: SchemaFormFieldRendererProps) {\n\tconst indent = field.type === 'json' ? field.jsonIndent ?? 2 : 2;\n\tconst quoteParsedString = !field.parseValue;\n\tconst [text, setText] = useState(() => formatJsonValue(value, indent));\n\tconst [parseError, setParseError] = useState<string | undefined>();\n\tconst [isFocused, setIsFocused] = useState(false);\n\tconst lastParse = useRef<ReturnType<typeof parseJsonFieldValue> | null>(null);\n\n\tuseEffect(() => {\n\t\tif (isFocused) return;\n\t\tconst acceptedParse = lastParse.current && Object.is(lastParse.current.value, value) ? lastParse.current : null;\n\t\tsetText(formatJsonValue(value, indent, quoteParsedString && !!acceptedParse?.valid));\n\t\tif (!acceptedParse && lastParse.current) {\n\t\t\tlastParse.current = null;\n\t\t\tsetParseError(undefined);\n\t\t\tonParseValidityChange?.(field.key, true);\n\t\t}\n\t}, [field.key, indent, isFocused, onParseValidityChange, quoteParsedString, value]);\n\n\tuseEffect(() => () => onParseValidityChange?.(field.key, true), [field.key, onParseValidityChange]);\n\n\tif (field.type !== 'json') return null;\n\n\tconst commit = (rawValue: string) => {\n\t\tconst parsed = parseJsonFieldValue(field, rawValue, values, onError);\n\t\tlastParse.current = parsed;\n\t\tsetParseError(parsed.valid ? undefined : strings.jsonParseError);\n\t\tonParseValidityChange?.(field.key, parsed.valid);\n\t\tonValueChange(parsed.value);\n\t\treturn parsed;\n\t};\n\n\treturn (\n\t\t<FormField\n\t\t\tlabel={field.label}\n\t\t\trequired={field.required}\n\t\t\thint={getFieldHint(field)}\n\t\t\thelperText={field.helperText}\n\t\t\terror={error ?? parseError}\n\t\t\thtmlFor={fieldId}\n\t\t\tsupportingTextId={`${fieldId}-supporting`}\n\t\t\tclassName=\"schema-form-field--component schema-form-field--json\"\n\t\t>\n\t\t\t<Textarea\n\t\t\t\tid={fieldId}\n\t\t\t\tname={field.key}\n\t\t\t\tvalue={text}\n\t\t\t\trows={field.rows ?? 6}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tinvalid={Boolean(error ?? parseError)}\n\t\t\t\tplaceholder={field.placeholder}\n\t\t\t\tspellCheck={false}\n\t\t\t\tclassName={cn('font-mono', field.controlClassName)}\n\t\t\t\tonFocus={() => setIsFocused(true)}\n\t\t\t\tonChange={(event) => {\n\t\t\t\t\tconst next = event.target.value;\n\t\t\t\t\tsetText(next);\n\t\t\t\t\tcommit(next);\n\t\t\t\t}}\n\t\t\t\tonBlur={() => {\n\t\t\t\t\tsetIsFocused(false);\n\t\t\t\t\tconst parsed = commit(text);\n\t\t\t\t\tif (parsed.valid) setText(formatJsonValue(parsed.value, indent, quoteParsedString));\n\t\t\t\t}}\n\t\t\t\t{...field.textareaProps}\n\t\t\t\t\taria-describedby={[field.textareaProps?.['aria-describedby'], error || parseError || field.helperText || getFieldHint(field) ? `${fieldId}-supporting` : undefined].filter(Boolean).join(' ') || undefined}\n\t\t\t/>\n\t\t</FormField>\n\t);\n}\n\nexport function SchemaFormFieldRenderer({\n\tfield,\n\tvalue,\n\tvalues,\n\terror,\n\tdisabled,\n\trequired,\n\tfieldId,\n\tonValueChange,\n\tonError,\n\tstrings,\n\tclassName,\n\tonParseValidityChange,\n}: SchemaFormFieldRendererProps) {\n\tconst fieldType = field.type ?? 'text';\n\tconst commonFieldProps = {\n\t\tlabel: field.label,\n\t\trequired,\n\t\thint: getFieldHint(field),\n\t\thelperText: field.helperText,\n\t\terror,\n\t\thtmlFor: fieldId,\n\t\tsupportingTextId: `${fieldId}-supporting`,\n\t\tclassName: cn('schema-form-field--component', className),\n\t};\n\n\tconst controlClassName = field.controlClassName;\n\tconst describedBy = error || field.helperText || getFieldHint(field) ? `${fieldId}-supporting` : undefined;\n\n\tif (fieldType === 'custom' && field.type === 'custom') {\n\t\treturn (\n\t\t\t<div className={cn('schema-form-field--component schema-form-field--custom', className)}>\n\t\t\t\t{field.render({ field, value, values, error, disabled, required, fieldId, onValueChange, onError })}\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif (fieldType === 'switch' && field.type === 'switch') {\n\t\tconst checked = toBooleanValue(value);\n\t\tif (field.switchStyle === 'card') {\n\t\t\treturn (\n\t\t\t\t<FormField error={error} supportingTextId={`${fieldId}-supporting`} className={cn('schema-form-field--component schema-form-field--switch-card', className)}>\n\t\t\t\t\t<SwitchCard\n\t\t\t\t\tlabel={field.label}\n\t\t\t\t\t\tdescription={field.description}\n\t\t\t\t\t\thint={field.hint}\n\t\t\t\t\t\tname={field.key}\n\t\t\t\t\t\tvalue={checked}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\t\tonValueChange={(next) => onValueChange(next)}\n\t\t\t\t\t\t{...field.switchCardProps}\n\t\t\t\t\taria-describedby={[field.switchCardProps?.['aria-describedby'], error ? `${fieldId}-supporting` : undefined].filter(Boolean).join(' ') || undefined}\n\t\t\t\t\t/>\n\t\t\t\t</FormField>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<FormField error={error} supportingTextId={`${fieldId}-supporting`} className={cn('schema-form-field--component schema-form-field--switch', className)}>\n\t\t\t\t<ToggleField\n\t\t\t\t\tlabel={field.label}\n\t\t\t\t\tdescription={field.description ?? field.hint}\n\t\t\t\t\tname={field.key}\n\t\t\t\t\tvalue={checked}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\tonValueChange={(next) => onValueChange(next)}\n\t\t\t\t\t{...field.switchProps}\n\t\t\t\t\taria-describedby={[field.switchProps?.['aria-describedby'], error ? `${fieldId}-supporting` : undefined].filter(Boolean).join(' ') || undefined}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tif (fieldType === 'json') {\n\t\treturn (\n\t\t\t<JsonFieldControl\n\t\t\t\tfield={field}\n\t\t\t\tvalue={value}\n\t\t\t\tvalues={values}\n\t\t\t\terror={error}\n\t\t\t\tdisabled={disabled}\n\t\t\t\trequired={required}\n\t\t\t\tfieldId={fieldId}\n\t\t\t\tonValueChange={onValueChange}\n\t\t\t\tonError={onError}\n\t\t\t\tstrings={strings}\n\t\t\t\tonParseValidityChange={onParseValidityChange}\n\t\t\t/>\n\t\t);\n\t}\n\n\tif (fieldType === 'textarea' && field.type === 'textarea') {\n\t\tconst displayValue = getTextDisplayValue(field, value, values, onError);\n\t\treturn (\n\t\t\t<FormField {...commonFieldProps}>\n\t\t\t\t<Textarea\n\t\t\t\t\taria-describedby={describedBy}\n\t\t\t\t\tid={fieldId}\n\t\t\t\t\tname={field.key}\n\t\t\t\t\tvalue={displayValue}\n\t\t\t\t\trows={field.rows}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tplaceholder={field.placeholder}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\tonChange={(event) => onValueChange(parseTextValue(field, event.target.value, values, onError))}\n\t\t\t\t\t{...field.textareaProps}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tif ((fieldType === 'number' || fieldType === 'integer' || fieldType === 'decimal') && (\n\t\tfield.type === 'number' || field.type === 'integer' || field.type === 'decimal'\n\t)) {\n\t\tconst integer = field.type === 'integer';\n\t\tconst decimalPlaces = integer ? 0 : field.decimalPlaces ?? (field.type === 'decimal' ? 2 : 4);\n\t\treturn (\n\t\t\t<FormField {...commonFieldProps}>\n\t\t\t\t<NumberFieldControl\n\t\t\t\t\tfield={field}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tvalues={values}\n\t\t\t\t\tonParsedChange={onValueChange}\n\t\t\t\t\tonParseError={onError}\n\t\t\t\t\tid={fieldId}\n\t\t\t\t\tname={field.key}\n\t\t\t\t\tmin={field.min}\n\t\t\t\t\tmax={field.max}\n\t\t\t\t\tstep={field.step}\n\t\t\t\t\tdecimalPlaces={decimalPlaces}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tplaceholder={field.placeholder}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\t{...field.numberProps}\n\t\t\t\t\taria-describedby={[field.numberProps?.['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tif (fieldType === 'select' && field.type === 'select') {\n\t\tconst options = field.options.map((option) => ({\n\t\t\tvalue: option.value,\n\t\t\tlabel: option.label,\n\t\t\tdisabled: option.disabled,\n\t\t\ticon: optionIconNode(option),\n\t\t}));\n\n\t\treturn (\n\t\t\t<FormField {...commonFieldProps}>\n\t\t\t\t<Select\n\t\t\t\t\tname={field.key}\n\t\t\t\t\tvalue={toStringValue(value)}\n\t\t\t\t\toptions={options}\n\t\t\t\t\tallowClear={field.allowClear}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tplaceholder={field.placeholder}\n\t\t\t\t\taria-label={field.label}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\tonValueChange={(next) => onValueChange(next ?? null)}\n\t\t\t\t\t{...field.selectProps}\n\t\t\t\t\taria-describedby={[field.selectProps?.['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tif (fieldType === 'radio-cards' && field.type === 'radio-cards') {\n\t\treturn (\n\t\t\t<FormField {...commonFieldProps}>\n\t\t\t\t<CardRadioGroup\n\t\t\t\t\tname={field.key}\n\t\t\t\t\tvalue={toStringValue(value)}\n\t\t\t\t\toptions={field.options}\n\t\t\t\t\tcolumns={field.columns}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\tonValueChange={(next) => onValueChange(next)}\n\t\t\t\t\t{...field.radioProps}\n\t\t\t\t\taria-describedby={[field.radioProps?.['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tif (fieldType === 'checkbox-cards' && field.type === 'checkbox-cards') {\n\t\treturn (\n\t\t\t<FormField {...commonFieldProps}>\n\t\t\t\t<CardCheckboxGroup\n\t\t\t\t\tname={field.key}\n\t\t\t\t\tvalue={toStringArray(value)}\n\t\t\t\t\toptions={field.options}\n\t\t\t\t\tcolumns={field.columns}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\tonValueChange={(next) => onValueChange(next)}\n\t\t\t\t\t{...field.checkboxProps}\n\t\t\t\t\taria-describedby={[field.checkboxProps?.['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tif (fieldType === 'tags' && field.type === 'tags') {\n\t\treturn (\n\t\t\t<FormField {...commonFieldProps}>\n\t\t\t\t<TagsInput\n\t\t\t\t\tid={fieldId}\n\t\t\t\t\tvalue={toStringArray(value)}\n\t\t\t\t\trecommendations={field.recommendations}\n\t\t\t\t\tmaxTags={field.maxTags}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\t\tplaceholder={field.placeholder}\n\t\t\t\t\tclassName={controlClassName}\n\t\t\t\t\tonValueChange={(next) => onValueChange(next)}\n\t\t\t\t\t{...field.tagsProps}\n\t\t\t\t\taria-describedby={[field.tagsProps?.['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined}\n\t\t\t\t/>\n\t\t\t</FormField>\n\t\t);\n\t}\n\n\tconst inputType = fieldType === 'text' ? 'text' : fieldType;\n\tconst nativeInputProps = field.type === undefined || field.type === 'text' || field.type === 'email' || field.type === 'password' || field.type === 'url' || field.type === 'tel' || field.type === 'search' ? field.inputProps : undefined;\n\tconst displayValue = getTextDisplayValue(field, value, values, onError);\n\n\treturn (\n\t\t<FormField {...commonFieldProps}>\n\t\t\t<Input\n\t\t\t\tid={fieldId}\n\t\t\t\tname={field.key}\n\t\t\t\ttype={inputType}\n\t\t\t\tvalue={displayValue}\n\t\t\t\tdisabled={disabled}\n\t\t\t\trequired={required}\n\t\t\t\tinvalid={Boolean(error)}\n\t\t\t\tplaceholder={field.placeholder}\n\t\t\t\tclassName={controlClassName}\n\t\t\t\tonChange={(event) => onValueChange(parseTextValue(field, event.target.value, values, onError))}\n\t\t\t\t{...nativeInputProps}\n\t\t\t\taria-describedby={[nativeInputProps?.['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined}\n\t\t\t/>\n\t\t</FormField>\n\t);\n}\n\nSchemaFormFieldRenderer.displayName = 'SchemaFormFieldRenderer';\n","export interface SchemaFormStrings {\n\tsubmitLabel: string;\n\tresetLabel: string;\n\tdefaultSectionTitle: string;\n\temptyTitle: string;\n\temptyDescription: string;\n\tjsonParseError: string;\n\tvalidationError: string;\n\tformatRequiredError: (label: string) => string;\n}\n\nexport const defaultSchemaFormStrings: SchemaFormStrings = {\n\tsubmitLabel: 'Save changes',\n\tresetLabel: 'Reset',\n\tdefaultSectionTitle: 'General',\n\temptyTitle: 'No fields configured',\n\temptyDescription: 'Add fields to the schema to render a form.',\n\tjsonParseError: 'Enter valid JSON.',\n\tvalidationError: 'Invalid value.',\n\tformatRequiredError: (label) => `${label} is required.`,\n};\n","import { Fragment, useId, useMemo } from 'react';\n\nimport { Card } from '../../base/cards';\nimport { ContentBlock } from '../../base/display';\nimport { Stack } from '../../base/structure';\nimport {compositionRhythm} from '../../base/structure/composition.recipes';\nimport { Text } from '../../typography';\nimport {copyRoleProps} from '../../typography/text.styles';\nimport { useStrings } from '../../../lib/strings';\nimport { cn } from '../../../lib/utils';\n\nimport { useSchemaForm } from './hooks';\nimport {\n\tSchemaFormActions,\n\tSchemaFormEmpty,\n\tSchemaFormFieldRenderer,\n} from './partials';\nimport {\n\tdefaultSchemaFormStrings,\n\ttype SchemaFormStrings,\n} from './schema-form.strings';\nimport type {\n\tResolvedSchemaFormSection,\n\tSchemaFormField,\n\tSchemaFormFieldContext,\n\tSchemaFormProps,\n\tSchemaFormSubmitHelpers,\n} from './schema-form.types';\nimport {\n\tSCHEMA_FORM_COLUMNS,\n\tSCHEMA_FORM_FIELD_WIDTH,\n\tisFieldDisabled,\n\tresolveSchemaSections,\n} from './schema-form.utils';\n\nfunction toDomId(value: string): string {\n\treturn value.replace(/[^a-zA-Z0-9_-]/g, '-');\n}\n\nfunction SectionHeading({ section }: { section: ResolvedSchemaFormSection }) {\n\tif (!section.title && !section.description) return null;\n\n\treturn (\n\t\t<Stack gap=\"normal\" className=\"schema-form--section-heading\">\n\t\t\t{!!section.title && (\n\t\t\t\t<Text {...copyRoleProps.subsection} className=\"schema-form--section-title\">\n\t\t\t\t\t{section.title}\n\t\t\t\t</Text>\n\t\t\t)}\n\t\t\t{!!section.description && (\n\t\t\t\t<Text {...copyRoleProps.structuralDescription} className=\"schema-form--section-description\">\n\t\t\t\t\t{section.description}\n\t\t\t\t</Text>\n\t\t\t)}\n\t\t</Stack>\n\t);\n}\n\nexport function SchemaForm({\n\tschema,\n\tvalue,\n\tdefaultValue,\n\terrors,\n\tdisabled = false,\n\tlayout = 'form',\n\tcolumns = 2,\n\tid,\n\tname,\n\ttitle,\n\tdescription,\n\theaderSlot,\n\tfooterSlot,\n\tactionsSlot,\n\temptySlot,\n\tshowActions,\n\tsubmitLabel,\n\tresetLabel,\n\tsubmitDisabled = false,\n\tresetDisabled = false,\n\tsubmitting = false,\n\tonValueChange,\n\tonFieldChange,\n\tonSubmit,\n\tonReset,\n\tonError,\n\trenderField,\n\trenderSection,\n\tstrings: stringsProp,\n\tclassName,\n\tcontentClassName,\n\tsectionClassName,\n\tfieldClassName,\n}: SchemaFormProps) {\n\tconst generatedId = useId();\n\tconst formId = id ?? `schema-form-${generatedId}`;\n\tconst strings: SchemaFormStrings = useStrings(defaultSchemaFormStrings, stringsProp);\n\tconst form = useSchemaForm({\n\t\tfields: schema.fields,\n\t\tvalue,\n\t\tdefaultValue,\n\t\terrors,\n\t\tonValueChange,\n\t\tonFieldChange,\n\t\tformatRequiredError: strings.formatRequiredError,\n\t\tvalidationError: strings.validationError,\n\t\tonError,\n\t});\n\n\tconst sections = useMemo(\n\t\t() => resolveSchemaSections(schema, form.values, strings.defaultSectionTitle, columns, onError),\n\t\t[columns, form.values, onError, schema, strings.defaultSectionTitle],\n\t);\n\tconst hasFields = sections.some((section) => section.fields.length > 0);\n\n\tconst helpers: SchemaFormSubmitHelpers = {\n\t\tsetFieldValue: form.setFieldValue,\n\t\tsetValues: form.setValues,\n\t\treset: form.reset,\n\t\tvalidate: form.validate,\n\t};\n\n\tconst shouldShowActions = showActions ?? Boolean(onSubmit || onReset || actionsSlot);\n\tconst resolvedSubmitLabel = submitLabel ?? strings.submitLabel;\n\tconst resolvedResetLabel = resetLabel ?? strings.resetLabel;\n\n\tconst renderFieldNode = (field: SchemaFormField) => {\n\t\tconst fieldId = `${formId}-${toDomId(field.key)}`;\n\t\tconst fieldDisabled = disabled || isFieldDisabled(field, form.values, onError);\n\t\tconst context: SchemaFormFieldContext = {\n\t\t\tfield,\n\t\t\tvalue: form.getFieldValue(field.key),\n\t\t\tvalues: form.values,\n\t\t\terror: form.getFieldError(field.key),\n\t\t\tdisabled: fieldDisabled,\n\t\t\trequired: Boolean(field.required),\n\t\t\tfieldId,\n\t\t\tonValueChange: (nextValue) => form.setFieldValue(field.key, nextValue),\n\t\t\tonError,\n\t\t};\n\t\tconst defaultField = (\n\t\t\t<SchemaFormFieldRenderer\n\t\t\t\t{...context}\n\t\t\t\tstrings={strings}\n\t\t\t\tonParseValidityChange={form.setFieldParseValidity}\n\t\t\t/>\n\t\t);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tkey={field.key}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'schema-form--field',\n\t\t\t\t\tSCHEMA_FORM_FIELD_WIDTH[field.width ?? 'auto'],\n\t\t\t\t\tfield.className,\n\t\t\t\t\tfieldClassName,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{renderField?.({ ...context, defaultField }) ?? defaultField}\n\t\t\t</div>\n\t\t);\n\t};\n\n\tconst renderSectionFields = (section: ResolvedSchemaFormSection) => (\n\t\t<div className={cn('schema-form--section-fields', SCHEMA_FORM_COLUMNS[section.columns])}>\n\t\t\t{section.fields.map(renderFieldNode)}\n\t\t</div>\n\t);\n\n\tconst renderPlainSection = (section: ResolvedSchemaFormSection) => {\n\t\tconst fields = renderSectionFields(section);\n\t\tconst custom = renderSection?.({ section, fields, values: form.values });\n\t\tif (custom !== undefined && custom !== null) {\n\t\t\treturn <Fragment key={section.id}>{custom}</Fragment>;\n\t\t}\n\n\t\treturn (\n\t\t\t<Stack\n\t\t\t\tkey={section.id}\n\t\t\t\trender={<section />}\n\t\t\t\tgap=\"lg\"\n\t\t\t\tclassName={cn('schema-form--section', section.className, sectionClassName)}\n\t\t\t>\n\t\t\t\t<SectionHeading section={section} />\n\t\t\t\t{fields}\n\t\t\t\t{!!section.footerSlot && (\n\t\t\t\t\t<div className=\"schema-form--section-footer\">\n\t\t\t\t\t\t{section.footerSlot}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t);\n\t};\n\n\tconst renderCardSection = (section: ResolvedSchemaFormSection) => {\n\t\tconst fields = renderSectionFields(section);\n\t\tconst custom = renderSection?.({ section, fields, values: form.values });\n\t\tif (custom !== undefined && custom !== null) {\n\t\t\treturn <Fragment key={section.id}>{custom}</Fragment>;\n\t\t}\n\n\t\treturn (\n\t\t\t<ContentBlock\n\t\t\t\tkey={section.id}\n\t\t\t\tclassName={cn('schema-form--section-card', section.className, sectionClassName)}\n\t\t\t\ticon={section.icon}\n\t\t\t\ttitle={section.title}\n\t\t\t\tdescription={section.description}\n\t\t\t\tfooterSlot={section.footerSlot}\n\t\t\t>\n\t\t\t\t{fields}\n\t\t\t</ContentBlock>\n\t\t);\n\t};\n\n\tconst actions = actionsSlot ?? (\n\t\tshouldShowActions ? (\n\t\t\t<SchemaFormActions\n\t\t\t\tsubmitLabel={resolvedSubmitLabel}\n\t\t\t\tresetLabel={resolvedResetLabel}\n\t\t\t\tshowReset={Boolean(onReset)}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tsubmitDisabled={submitDisabled}\n\t\t\t\tresetDisabled={resetDisabled}\n\t\t\t\tsubmitting={submitting}\n\t\t\t\tonReset={() => {\n\t\t\t\t\tconst nextValues = form.reset();\n\t\t\t\t\tonReset?.(nextValues, helpers);\n\t\t\t\t}}\n\t\t\t/>\n\t\t) : null\n\t);\n\n\tconst empty = emptySlot ?? (\n\t\t<SchemaFormEmpty\n\t\t\ttitle={strings.emptyTitle}\n\t\t\tdescription={strings.emptyDescription}\n\t\t/>\n\t);\n\n\treturn (\n\t\t<form\n\t\t\tid={formId}\n\t\t\tname={name}\n\t\t\tnoValidate\n\t\t\tclassName={cn('schema-form--component @container/schema-form', className)}\n\t\t\tonSubmit={async (event) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif (disabled || submitDisabled || submitting) return;\n\t\t\t\tconst submittedValues = form.getValues();\n\t\t\t\tconst valid = form.validate();\n\t\t\t\tif (!valid) return;\n\t\t\t\ttry {\n\t\t\t\t\tawait onSubmit?.(submittedValues, helpers, event);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tonError?.(error);\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t{layout === 'cards' ? (\n\t\t\t\t<Stack gap={compositionRhythm.subjects} className={cn('schema-form--cards', contentClassName)}>\n\t\t\t\t\t{!!(title ?? schema.title ?? description ?? schema.description ?? headerSlot) && (\n\t\t\t\t\t\t<Stack direction=\"horizontal\" align=\"start\" justify=\"between\" gap=\"xl\" className=\"schema-form--header\">\n\t\t\t\t\t\t<Stack gap=\"normal\" className=\"min-w-0\">\n\t\t\t\t\t\t\t\t{!!(title ?? schema.title) && (\n\t\t\t\t\t\t\t\t\t<Text type=\"inherit\" size=\"base\" weight=\"semibold\" className=\"schema-form--title\">\n\t\t\t\t\t\t\t\t\t\t{title ?? schema.title}\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{!!(description ?? schema.description) && (\n\t\t\t\t\t\t\t\t\t<Text type=\"secondary\" className=\"schema-form--description\">\n\t\t\t\t\t\t\t\t\t\t{description ?? schema.description}\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t{headerSlot}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t)}\n\t\t\t\t\t{hasFields ? sections.map(renderCardSection) : empty}\n\t\t\t\t\t{footerSlot}\n\t\t\t\t\t{actions}\n\t\t\t\t</Stack>\n\t\t\t) : (\n\t\t\t\t\t<Card\n\t\t\t\t\t\tsurface=\"flat\"\n\t\t\t\t\t\tpadding=\"none\"\n\t\t\t\t\t\tclassName=\"schema-form--surface\"\n\t\t\t\t\t\tgap={compositionRhythm.subjects}\n\t\t\t\t\t\tcontentGap={compositionRhythm.subjects}\n\t\t\t\t\t\tcontentClassName={cn('schema-form--content', contentClassName)}\n\t\t\t\t\t\ttitle={title ?? schema.title}\n\t\t\t\t\t\tdescription={description ?? schema.description}\n\t\t\t\t\t\theaderEnd={headerSlot}\n\t\t\t\t\t\tfooterSlot={\n\t\t\t\t\t\t\tfooterSlot || actions ? (\n\t\t\t\t\t\t\t\t<Stack gap=\"lg\" className=\"schema-form--footer\">\n\t\t\t\t\t\t\t\t\t{footerSlot}\n\t\t\t\t\t\t\t\t\t{actions}\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{hasFields ? sections.map(renderPlainSection) : empty}\n\t\t\t\t\t</Card>\n\t\t\t)}\n\t\t</form>\n\t);\n}\n\nSchemaForm.displayName = 'SchemaForm';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiBA,IAAaiB,KAAiD;CAC7D,GAAG;CACH,GAAG;CACH,GAAG;AACJ,GAEaC,KAAgE;CAC5E,MAAM;CACN,MAAM;CACN,OAAO;CACP,MAAM;AACP;AAEA,SAAgBC,EACf,GACA,GACA,GACU;CACV,IAAI,OAAOC,EAAM,UAAW,YAC3B,IAAI;EACH,OAAOA,EAAM,OAAOC,CAAM;CAC3B,SAASC,GAAO;EAEf,OADAC,IAAUD,CAAK,GACR;CACR;CAED,OAAOF,EAAM,UAAU;AACxB;AAEA,SAAgBI,GACf,GACA,GACA,GACU;CACV,IAAI,OAAOJ,EAAM,YAAa,YAC7B,IAAI;EACH,OAAOA,EAAM,SAASC,CAAM;CAC7B,SAASC,GAAO;EAEf,OADAC,IAAUD,CAAK,GACR;CACR;CAED,OAAOF,EAAM,YAAY;AAC1B;AAEA,SAAgBK,GACf,GACA,GACA,GACoB;C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AAD;GACC,SAAQ;GACR,SAAQ;GACR,WAAU;GACV,KAAKC,EAAkB;GACvB,YAAYA,EAAkB;GAC9B,kBAAkBgG,EAAG,wBAAwBgG,CAAgB;GAC7D,OAAOC,KAASxK,EAAO;GACvB,aAAayK,KAAezK,EAAO;GACnC,WAAW0K;GACX,YACCC,KAAcT,IACb,kBAAC7L,GAAD;IAAO,KAAI;IAAK,WAAU;IAA1B,UAAA,CACEsM,GACAT,CACK;GACJ,CAAA,IAAA,KAAA;GAGJ,UAAAtB,KAAYzI,EAAS,IAAIyJ,EAAkB,IAAIO;EAC3C,CAAA;CAEH,CAAA;AAER;AAEA,EAAW,cAAc"}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { useStrings as e } from "../lib/strings.js";
3
- import { t } from "../utils-B6kKb8jB.js";
4
- import { t as n } from "../feedback-Dm4izqFn.js";
3
+ import { t } from "../utils-DhuoqFy4.js";
4
+ import { t as n } from "../feedback-Dzo1xtAU.js";
5
5
  import { t as r } from "../use-debounced-callback-Cx1h-hdv.js";
6
- import { r as i } from "../combobox-BwzoXFSG.js";
6
+ import { r as i } from "../combobox-C2JiSQPc.js";
7
7
  import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
8
8
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
9
  //#region src/components/features/suggestions/hooks/use-suggestions.ts
@@ -86,60 +86,67 @@ var h = {
86
86
  //#endregion
87
87
  //#region src/components/features/suggestions/suggestions.tsx
88
88
  function g(r) {
89
- let { fetchData: a, itemKey: o, itemText: c, onValueChange: l, renderItem: f, minQueryLength: p = 1, debounceMs: g = 250, requestDelay: _ = 0, preload: v = !1, query: y, defaultQuery: b, onQueryChange: x, value: S, defaultValue: C, allowClear: w = !0, clearInputOnClose: T = !1, open: E, defaultOpen: D, onOpenChange: O, disabled: k = !1, className: A, onError: j, renderError: M, strings: N } = r, P = e(h, N), { items: F, isLoading: I, query: L, setQuery: R, value: z, setValue: B, open: V, setOpen: H, error: U, isError: W, retry: G } = m({
90
- fetchData: a,
91
- minQueryLength: p,
92
- debounceMs: g,
93
- requestDelay: _,
94
- preload: v,
95
- query: y,
96
- defaultQuery: b,
97
- onQueryChange: x,
98
- value: S,
99
- defaultValue: C,
100
- onValueChange: l,
101
- open: E,
102
- defaultOpen: D,
103
- onOpenChange: O,
104
- onError: j
105
- }), K = s(() => ({
106
- placeholder: P.placeholder,
107
- noResults: P.emptyMessage,
108
- searching: P.loadingMessage,
109
- typeToSearch: P.startTypingMessage
110
- }), [P]), q = W && U !== null ? M?.({
111
- error: U,
112
- query: L,
113
- retry: G
89
+ let { fetchData: o, itemKey: l, itemText: f, onValueChange: p, renderItem: g, minQueryLength: _ = 1, debounceMs: v = 250, requestDelay: y = 0, preload: b = !1, query: x, defaultQuery: S, onQueryChange: C, value: w, defaultValue: T, allowClear: E = !0, clearInputOnClose: D = !1, open: O, defaultOpen: k, onOpenChange: A, disabled: j = !1, className: M, onError: N, renderError: P, strings: F } = r, I = e(h, F), L = c(null), { items: R, isLoading: z, query: B, setQuery: V, value: H, setValue: U, open: W, setOpen: G, error: K, isError: q, retry: J } = m({
90
+ fetchData: o,
91
+ minQueryLength: _,
92
+ debounceMs: v,
93
+ requestDelay: y,
94
+ preload: b,
95
+ query: x,
96
+ defaultQuery: S,
97
+ onQueryChange: C,
98
+ value: w,
99
+ defaultValue: T,
100
+ onValueChange: p,
101
+ open: O,
102
+ defaultOpen: k,
103
+ onOpenChange: A,
104
+ onError: N
105
+ }), Y = s(() => ({
106
+ placeholder: I.placeholder,
107
+ noResults: I.emptyMessage,
108
+ searching: I.loadingMessage,
109
+ typeToSearch: I.startTypingMessage
110
+ }), [I]), X = a(() => {
111
+ W || G(!0), L.current?.focus(), J();
112
+ }, [
113
+ W,
114
+ J,
115
+ G
116
+ ]), Z = q && K !== null ? P?.({
117
+ error: K,
118
+ query: B,
119
+ retry: X
114
120
  }) ?? /* @__PURE__ */ u(n, {
115
121
  variant: "inline",
116
- title: P.errorMessage,
117
- onRetry: G,
118
- retryLabel: P.retry,
122
+ title: I.errorMessage,
123
+ onRetry: X,
124
+ retryLabel: I.retry,
119
125
  className: "suggestions-combobox--error"
120
126
  }) : null;
121
127
  return /* @__PURE__ */ d("div", {
122
- className: t("suggestions--component suggestions-combobox--component", A),
128
+ className: t("suggestions--component suggestions-combobox--component", M),
123
129
  children: [/* @__PURE__ */ u(i, {
130
+ ref: L,
124
131
  className: "suggestions-combobox--control",
125
- items: F,
126
- searchValue: L,
127
- onSearchValueChange: R,
128
- selectedValue: z,
129
- onSelectedValueChange: B,
130
- getItemLabel: c,
131
- getItemKey: (e) => String(o(e)),
132
- renderItem: f,
133
- minSearchLength: p,
134
- loading: I,
135
- strings: K,
136
- clearable: w,
137
- open: V,
138
- onOpenChange: (e) => {
139
- H(e), !e && T && R("");
140
- },
141
- disabled: k
142
- }), q]
132
+ items: R,
133
+ searchValue: B,
134
+ onSearchValueChange: V,
135
+ selectedValue: H,
136
+ onSelectedValueChange: U,
137
+ getItemLabel: f,
138
+ getItemKey: (e) => String(l(e)),
139
+ renderItem: g,
140
+ minSearchLength: _,
141
+ loading: !q && z,
142
+ showListContent: !q,
143
+ strings: Y,
144
+ clearable: E,
145
+ open: W,
146
+ onOpenChange: G,
147
+ clearSearchOnClose: D && !q,
148
+ disabled: j
149
+ }), Z]
143
150
  });
144
151
  }
145
152
  g.displayName = "SuggestionsCombobox";
@@ -1 +1 @@
1
- {"version":3,"file":"suggestions.js","names":["ErrorState","useDebouncedCallback","Combobox","wait","signal","timer","handleAbort","resolve","ms","isAbortError","error","useSuggestions","controlledQuery","controlledValue","controlledOpen","config","items","setItems","useState","internalQuery","setInternalQuery","defaultQuery","internalValue","setInternalValue","defaultValue","internalOpen","setInternalOpen","defaultOpen","isLoading","setIsLoading","setError","reloadTick","setReloadTick","fetchDataRef","useRef","fetchData","onErrorRef","onError","query","value","open","setQuery","useCallback","nextQuery","onQueryChange","setValue","nextValue","onValueChange","setOpen","nextOpen","onOpenChange","retry","current","runFetch","delayBeforeRequest","result","debounceMs","useEffect","controller","minQueryLength","preload","requestDelay","defaultSuggestionsStrings","SuggestionsCombobox","stringsProp","props","strings","useStrings","comboboxStrings","useMemo","errorNode","isError","renderError","cn","className","itemText","itemKey","item","allowClear","isOpen","clearInputOnClose"],"sources":["../../src/components/features/suggestions/hooks/use-suggestions.ts","../../src/components/features/suggestions/suggestions.strings.ts","../../src/components/features/suggestions/suggestions.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { DEFAULT_DEBOUNCE_MS, useDebouncedCallback } from '../../../../hooks/use-debounced-callback';\n\nimport type {\n\tUseSuggestionsConfig,\n\tUseSuggestionsResult,\n} from '../suggestions.types';\n\nconst wait = (ms: number, signal: AbortSignal): Promise<void> =>\n\tnew Promise((resolve) => {\n\t\tif (signal.aborted) {\n\t\t\tresolve();\n\t\t\treturn;\n\t\t}\n\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal.removeEventListener('abort', handleAbort);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tconst handleAbort = () => {\n\t\t\tclearTimeout(timer);\n\t\t\tresolve();\n\t\t};\n\t\tsignal.addEventListener('abort', handleAbort, { once: true });\n\t});\n\nfunction isAbortError(error: unknown): boolean {\n\treturn Boolean(error && (error as { name?: string }).name === 'AbortError');\n}\n\n/**\n * Headless data-fetching state machine for the suggestions feature.\n *\n * Returns the search/selection/open state plus the latest items + loading flag.\n * Consumers that want a different visual layer can build their own UI on top\n * of this hook without touching `<SuggestionsCombobox>`.\n */\nexport function useSuggestions<T>(\n\tconfig: UseSuggestionsConfig<T>,\n): UseSuggestionsResult<T> {\n\tconst {\n\t\tfetchData,\n\t\tminQueryLength = 1,\n\t\tdebounceMs = DEFAULT_DEBOUNCE_MS,\n\t\trequestDelay = 0,\n\t\tpreload = false,\n\t\tquery: controlledQuery,\n\t\tdefaultQuery = '',\n\t\tonQueryChange,\n\t\tvalue: controlledValue,\n\t\tdefaultValue = null,\n\t\tonValueChange,\n\t\topen: controlledOpen,\n\t\tdefaultOpen = false,\n\t\tonOpenChange,\n\t\tonError,\n\t} = config;\n\n\tconst [items, setItems] = useState<T[]>([]);\n\tconst [internalQuery, setInternalQuery] = useState(defaultQuery);\n\tconst [internalValue, setInternalValue] = useState<T | null>(defaultValue);\n\tconst [internalOpen, setInternalOpen] = useState(defaultOpen);\n\tconst [isLoading, setIsLoading] = useState<boolean>(false);\n\tconst [error, setError] = useState<unknown | null>(null);\n\tconst [reloadTick, setReloadTick] = useState(0);\n\tconst fetchDataRef = useRef(fetchData);\n\tconst onErrorRef = useRef(onError);\n\n\tfetchDataRef.current = fetchData;\n\tonErrorRef.current = onError;\n\n\tconst query = controlledQuery ?? internalQuery;\n\tconst value = controlledValue !== undefined ? controlledValue : internalValue;\n\tconst open = controlledOpen ?? internalOpen;\n\n\tconst setQuery = useCallback((nextQuery: string) => {\n\t\tif (controlledQuery === undefined) {\n\t\t\tsetInternalQuery(nextQuery);\n\t\t}\n\t\tonQueryChange?.(nextQuery);\n\t}, [controlledQuery, onQueryChange]);\n\n\tconst setValue = useCallback((nextValue: T | null) => {\n\t\tif (controlledValue === undefined) {\n\t\t\tsetInternalValue(nextValue);\n\t\t}\n\t\tonValueChange?.(nextValue);\n\t}, [controlledValue, onValueChange]);\n\n\tconst setOpen = useCallback((nextOpen: boolean) => {\n\t\tif (controlledOpen === undefined) {\n\t\t\tsetInternalOpen(nextOpen);\n\t\t}\n\t\tonOpenChange?.(nextOpen);\n\t}, [controlledOpen, onOpenChange]);\n\n\tconst retry = useCallback(() => {\n\t\tsetReloadTick((current) => current + 1);\n\t}, []);\n\n\tconst runFetch = useDebouncedCallback(\n\t\t(\n\t\t\tnextQuery: string,\n\t\t\tdelayBeforeRequest: number,\n\t\t\tsignal: AbortSignal,\n\t\t) => {\n\t\t\tvoid (async () => {\n\t\t\t\tsetIsLoading(true);\n\t\t\t\tsetError(null);\n\t\t\t\ttry {\n\t\t\t\t\tif (delayBeforeRequest > 0) {\n\t\t\t\t\t\tawait wait(delayBeforeRequest, signal);\n\t\t\t\t\t}\n\t\t\t\t\tif (signal.aborted) return;\n\n\t\t\t\t\tconst result = await fetchDataRef.current(nextQuery, { signal });\n\t\t\t\t\tif (!signal.aborted) {\n\t\t\t\t\t\tsetItems(Array.isArray(result) ? result : []);\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (!signal.aborted && !isAbortError(error)) {\n\t\t\t\t\t\tsetItems((current) => (current.length === 0 ? current : []));\n\t\t\t\t\t\tsetError(error);\n\t\t\t\t\t\tonErrorRef.current?.(error, nextQuery);\n\t\t\t\t\t}\n\t\t\t\t} finally {\n\t\t\t\t\tif (!signal.aborted) {\n\t\t\t\t\t\tsetIsLoading(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})();\n\t\t},\n\t\tdebounceMs,\n\t);\n\n\tuseEffect(() => {\n\t\tconst controller = new AbortController();\n\n\t\tconst shouldQuery =\n\t\t\tquery.length >= minQueryLength ||\n\t\t\t(preload && query.length === 0);\n\n\t\tif (!shouldQuery) {\n\t\t\tsetItems((current) => (current.length === 0 ? current : []));\n\t\t\tsetError(null);\n\t\t\tsetIsLoading(false);\n\t\t\treturn () => controller.abort();\n\t\t}\n\n\t\trunFetch(query, requestDelay, controller.signal);\n\n\t\treturn () => {\n\t\t\trunFetch.cancel();\n\t\t\tcontroller.abort();\n\t\t};\n\t}, [\n\t\tminQueryLength,\n\t\tpreload,\n\t\tquery,\n\t\treloadTick,\n\t\trequestDelay,\n\t\trunFetch,\n\t]);\n\n\treturn {\n\t\titems,\n\t\tisLoading,\n\t\terror,\n\t\tisError: error !== null,\n\t\tretry,\n\t\tquery,\n\t\tsetQuery,\n\t\tvalue,\n\t\tsetValue,\n\t\topen,\n\t\tsetOpen,\n\t};\n}\n","/**\n * Default user-facing strings for `<SuggestionsCombobox>`.\n *\n * Consumers wire backend i18n at the call site:\n *\n * <SuggestionsCombobox strings={{ emptyMessage: t('search.empty') }} … />\n */\n\nexport interface SuggestionsStrings {\n\tplaceholder: string;\n\temptyMessage: string;\n\tloadingMessage: string;\n\tstartTypingMessage: string;\n\terrorMessage: string;\n\tretry: string;\n}\n\nexport const defaultSuggestionsStrings: SuggestionsStrings = {\n\tplaceholder: 'Search...',\n\temptyMessage: 'No results found.',\n\tloadingMessage: 'Searching...',\n\tstartTypingMessage: 'Type to search.',\n\terrorMessage: 'Failed to load suggestions.',\n\tretry: 'Retry',\n};\n","import { useMemo } from 'react';\n\nimport { Combobox } from '../combobox';\nimport { ErrorState } from '../../base/feedback';\nimport { useStrings } from '../../../lib/strings';\nimport { cn } from '../../../lib/utils';\n\nimport { useSuggestions } from './hooks';\nimport { defaultSuggestionsStrings } from './suggestions.strings';\nimport type { SuggestionsComboboxProps } from './suggestions.types';\n\nexport function SuggestionsCombobox<T>(props: SuggestionsComboboxProps<T>) {\n\tconst {\n\t\tfetchData,\n\t\titemKey,\n\t\titemText,\n\t\tonValueChange,\n\t\trenderItem,\n\t\tminQueryLength = 1,\n\t\tdebounceMs = 250,\n\t\trequestDelay = 0,\n\t\tpreload = false,\n\t\tquery: controlledQuery,\n\t\tdefaultQuery,\n\t\tonQueryChange,\n\t\tvalue: controlledValue,\n\t\tdefaultValue,\n\t\tallowClear = true,\n\t\tclearInputOnClose = false,\n\t\topen: controlledOpen,\n\t\tdefaultOpen,\n\t\tonOpenChange,\n\t\tdisabled = false,\n\t\tclassName,\n\t\tonError,\n\t\trenderError,\n\t\tstrings: stringsProp,\n\t} = props;\n\n\tconst strings = useStrings(defaultSuggestionsStrings, stringsProp);\n\n\tconst {\n\t\titems,\n\t\tisLoading,\n\t\tquery,\n\t\tsetQuery,\n\t\tvalue,\n\t\tsetValue,\n\t\topen,\n\t\tsetOpen,\n\t\terror,\n\t\tisError,\n\t\tretry,\n\t} = useSuggestions<T>({\n\t\tfetchData,\n\t\tminQueryLength,\n\t\tdebounceMs,\n\t\trequestDelay,\n\t\tpreload,\n\t\tquery: controlledQuery,\n\t\tdefaultQuery,\n\t\tonQueryChange,\n\t\tvalue: controlledValue,\n\t\tdefaultValue,\n\t\tonValueChange,\n\t\topen: controlledOpen,\n\t\tdefaultOpen,\n\t\tonOpenChange,\n\t\tonError,\n\t});\n\n\tconst comboboxStrings = useMemo(\n\t\t() => ({\n\t\t\tplaceholder: strings.placeholder,\n\t\t\tnoResults: strings.emptyMessage,\n\t\t\tsearching: strings.loadingMessage,\n\t\t\ttypeToSearch: strings.startTypingMessage,\n\t\t}),\n\t\t[strings],\n\t);\n\n\tconst errorNode = isError && error !== null\n\t\t? renderError?.({ error, query, retry }) ?? (\n\t\t\t<ErrorState\n\t\t\t\tvariant=\"inline\"\n\t\t\t\ttitle={strings.errorMessage}\n\t\t\t\tonRetry={retry}\n\t\t\t\tretryLabel={strings.retry}\n\t\t\t\tclassName=\"suggestions-combobox--error\"\n\t\t\t/>\n\t\t)\n\t\t: null;\n\n\treturn (\n\t\t<div className={cn('suggestions--component suggestions-combobox--component', className)}>\n\t\t\t<Combobox<T>\n\t\t\t\tclassName=\"suggestions-combobox--control\"\n\t\t\t\titems={items}\n\t\t\t\tsearchValue={query}\n\t\t\t\tonSearchValueChange={setQuery}\n\t\t\t\tselectedValue={value}\n\t\t\t\tonSelectedValueChange={setValue}\n\t\t\t\tgetItemLabel={itemText}\n\t\t\t\tgetItemKey={(item) => String(itemKey(item))}\n\t\t\t\trenderItem={renderItem}\n\t\t\t\tminSearchLength={minQueryLength}\n\t\t\t\tloading={isLoading}\n\t\t\t\tstrings={comboboxStrings}\n\t\t\t\tclearable={allowClear}\n\t\t\t\topen={open}\n\t\t\t\tonOpenChange={(isOpen) => {\n\t\t\t\t\tsetOpen(isOpen);\n\t\t\t\t\tif (!isOpen && clearInputOnClose) {\n\t\t\t\t\t\tsetQuery('');\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tdisabled={disabled}\n\t\t\t/>\n\t\t\t{errorNode}\n\t\t</div>\n\t);\n}\n\nSuggest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,CAAS;EAAtF,UAAA,CACC,kBAACxE,GAAD;GACC,WAAU;GACH;GACP,aAAaoC;GACb,qBAAqBG;GACrB,eAAeF;GACf,uBAAuBM;GACvB,cAAc8B;GACd,aAAa,MAAS,OAAOC,EAAQC,CAAI,CAAC;GAC9B;GACZ,iBAAiBlB;GACjB,SAAS/B;GACT,SAASwC;GACT,WAAWU;GACL;GACN,eAAe,MAAW;IAEzB,AADA9B,EAAQ+B,CAAM,GACV,CAACA,KAAUC,KACdvC,EAAS,EAAE;GAEb;GACU;EACV,CAAA,GACA6B,CACG;;AAEP;AAEA,EAAoB,cAAc"}
1
+ {"version":3,"file":"suggestions.js","names":["ErrorState","useDebouncedCallback","Combobox","wait","signal","timer","handleAbort","resolve","ms","isAbortError","error","useSuggestions","controlledQuery","controlledValue","controlledOpen","config","items","setItems","useState","internalQuery","setInternalQuery","defaultQuery","internalValue","setInternalValue","defaultValue","internalOpen","setInternalOpen","defaultOpen","isLoading","setIsLoading","setError","reloadTick","setReloadTick","fetchDataRef","useRef","fetchData","onErrorRef","onError","query","value","open","setQuery","useCallback","nextQuery","onQueryChange","setValue","nextValue","onValueChange","setOpen","nextOpen","onOpenChange","retry","current","runFetch","delayBeforeRequest","result","debounceMs","useEffect","controller","minQueryLength","preload","requestDelay","defaultSuggestionsStrings","SuggestionsCombobox","stringsProp","props","strings","useStrings","inputRef","comboboxStrings","useMemo","retryQuery","errorNode","isError","renderError","cn","className","itemText","itemKey","item","allowClear","clearInputOnClose"],"sources":["../../src/components/features/suggestions/hooks/use-suggestions.ts","../../src/components/features/suggestions/suggestions.strings.ts","../../src/components/features/suggestions/suggestions.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { DEFAULT_DEBOUNCE_MS, useDebouncedCallback } from '../../../../hooks/use-debounced-callback';\n\nimport type {\n\tUseSuggestionsConfig,\n\tUseSuggestionsResult,\n} from '../suggestions.types';\n\nconst wait = (ms: number, signal: AbortSignal): Promise<void> =>\n\tnew Promise((resolve) => {\n\t\tif (signal.aborted) {\n\t\t\tresolve();\n\t\t\treturn;\n\t\t}\n\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal.removeEventListener('abort', handleAbort);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tconst handleAbort = () => {\n\t\t\tclearTimeout(timer);\n\t\t\tresolve();\n\t\t};\n\t\tsignal.addEventListener('abort', handleAbort, { once: true });\n\t});\n\nfunction isAbortError(error: unknown): boolean {\n\treturn Boolean(error && (error as { name?: string }).name === 'AbortError');\n}\n\n/**\n * Headless data-fetching state machine for the suggestions feature.\n *\n * Returns the search/selection/open state plus the latest items + loading flag.\n * Consumers that want a different visual layer can build their own UI on top\n * of this hook without touching `<SuggestionsCombobox>`.\n */\nexport function useSuggestions<T>(\n\tconfig: UseSuggestionsConfig<T>,\n): UseSuggestionsResult<T> {\n\tconst {\n\t\tfetchData,\n\t\tminQueryLength = 1,\n\t\tdebounceMs = DEFAULT_DEBOUNCE_MS,\n\t\trequestDelay = 0,\n\t\tpreload = false,\n\t\tquery: controlledQuery,\n\t\tdefaultQuery = '',\n\t\tonQueryChange,\n\t\tvalue: controlledValue,\n\t\tdefaultValue = null,\n\t\tonValueChange,\n\t\topen: controlledOpen,\n\t\tdefaultOpen = false,\n\t\tonOpenChange,\n\t\tonError,\n\t} = config;\n\n\tconst [items, setItems] = useState<T[]>([]);\n\tconst [internalQuery, setInternalQuery] = useState(defaultQuery);\n\tconst [internalValue, setInternalValue] = useState<T | null>(defaultValue);\n\tconst [internalOpen, setInternalOpen] = useState(defaultOpen);\n\tconst [isLoading, setIsLoading] = useState<boolean>(false);\n\tconst [error, setError] = useState<unknown | null>(null);\n\tconst [reloadTick, setReloadTick] = useState(0);\n\tconst fetchDataRef = useRef(fetchData);\n\tconst onErrorRef = useRef(onError);\n\n\tfetchDataRef.current = fetchData;\n\tonErrorRef.current = onError;\n\n\tconst query = controlledQuery ?? internalQuery;\n\tconst value = controlledValue !== undefined ? controlledValue : internalValue;\n\tconst open = controlledOpen ?? internalOpen;\n\n\tconst setQuery = useCallback((nextQuery: string) => {\n\t\tif (controlledQuery === undefined) {\n\t\t\tsetInternalQuery(nextQuery);\n\t\t}\n\t\tonQueryChange?.(nextQuery);\n\t}, [controlledQuery, onQueryChange]);\n\n\tconst setValue = useCallback((nextValue: T | null) => {\n\t\tif (controlledValue === undefined) {\n\t\t\tsetInternalValue(nextValue);\n\t\t}\n\t\tonValueChange?.(nextValue);\n\t}, [controlledValue, onValueChange]);\n\n\tconst setOpen = useCallback((nextOpen: boolean) => {\n\t\tif (controlledOpen === undefined) {\n\t\t\tsetInternalOpen(nextOpen);\n\t\t}\n\t\tonOpenChange?.(nextOpen);\n\t}, [controlledOpen, onOpenChange]);\n\n\tconst retry = useCallback(() => {\n\t\tsetReloadTick((current) => current + 1);\n\t}, []);\n\n\tconst runFetch = useDebouncedCallback(\n\t\t(\n\t\t\tnextQuery: string,\n\t\t\tdelayBeforeRequest: number,\n\t\t\tsignal: AbortSignal,\n\t\t) => {\n\t\t\tvoid (async () => {\n\t\t\t\tsetIsLoading(true);\n\t\t\t\tsetError(null);\n\t\t\t\ttry {\n\t\t\t\t\tif (delayBeforeRequest > 0) {\n\t\t\t\t\t\tawait wait(delayBeforeRequest, signal);\n\t\t\t\t\t}\n\t\t\t\t\tif (signal.aborted) return;\n\n\t\t\t\t\tconst result = await fetchDataRef.current(nextQuery, { signal });\n\t\t\t\t\tif (!signal.aborted) {\n\t\t\t\t\t\tsetItems(Array.isArray(result) ? result : []);\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (!signal.aborted && !isAbortError(error)) {\n\t\t\t\t\t\tsetItems((current) => (current.length === 0 ? current : []));\n\t\t\t\t\t\tsetError(error);\n\t\t\t\t\t\tonErrorRef.current?.(error, nextQuery);\n\t\t\t\t\t}\n\t\t\t\t} finally {\n\t\t\t\t\tif (!signal.aborted) {\n\t\t\t\t\t\tsetIsLoading(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})();\n\t\t},\n\t\tdebounceMs,\n\t);\n\n\tuseEffect(() => {\n\t\tconst controller = new AbortController();\n\n\t\tconst shouldQuery =\n\t\t\tquery.length >= minQueryLength ||\n\t\t\t(preload && query.length === 0);\n\n\t\tif (!shouldQuery) {\n\t\t\tsetItems((current) => (current.length === 0 ? current : []));\n\t\t\tsetError(null);\n\t\t\tsetIsLoading(false);\n\t\t\treturn () => controller.abort();\n\t\t}\n\n\t\trunFetch(query, requestDelay, controller.signal);\n\n\t\treturn () => {\n\t\t\trunFetch.cancel();\n\t\t\tcontroller.abort();\n\t\t};\n\t}, [\n\t\tminQueryLength,\n\t\tpreload,\n\t\tquery,\n\t\treloadTick,\n\t\trequestDelay,\n\t\trunFetch,\n\t]);\n\n\treturn {\n\t\titems,\n\t\tisLoading,\n\t\terror,\n\t\tisError: error !== null,\n\t\tretry,\n\t\tquery,\n\t\tsetQuery,\n\t\tvalue,\n\t\tsetValue,\n\t\topen,\n\t\tsetOpen,\n\t};\n}\n","/**\n * Default user-facing strings for `<SuggestionsCombobox>`.\n *\n * Consumers wire backend i18n at the call site:\n *\n * <SuggestionsCombobox strings={{ emptyMessage: t('search.empty') }} … />\n */\n\nexport interface SuggestionsStrings {\n\tplaceholder: string;\n\temptyMessage: string;\n\tloadingMessage: string;\n\tstartTypingMessage: string;\n\terrorMessage: string;\n\tretry: string;\n}\n\nexport const defaultSuggestionsStrings: SuggestionsStrings = {\n\tplaceholder: 'Search...',\n\temptyMessage: 'No results found.',\n\tloadingMessage: 'Searching...',\n\tstartTypingMessage: 'Type to search.',\n\terrorMessage: 'Failed to load suggestions.',\n\tretry: 'Retry',\n};\n","import { useCallback, useMemo, useRef } from 'react';\n\nimport { Combobox } from '../combobox';\nimport { ErrorState } from '../../base/feedback';\nimport { useStrings } from '../../../lib/strings';\nimport { cn } from '../../../lib/utils';\n\nimport { useSuggestions } from './hooks';\nimport { defaultSuggestionsStrings } from './suggestions.strings';\nimport type { SuggestionsComboboxProps } from './suggestions.types';\n\nexport function SuggestionsCombobox<T>(props: SuggestionsComboboxProps<T>) {\n\tconst {\n\t\tfetchData,\n\t\titemKey,\n\t\titemText,\n\t\tonValueChange,\n\t\trenderItem,\n\t\tminQueryLength = 1,\n\t\tdebounceMs = 250,\n\t\trequestDelay = 0,\n\t\tpreload = false,\n\t\tquery: controlledQuery,\n\t\tdefaultQuery,\n\t\tonQueryChange,\n\t\tvalue: controlledValue,\n\t\tdefaultValue,\n\t\tallowClear = true,\n\t\tclearInputOnClose = false,\n\t\topen: controlledOpen,\n\t\tdefaultOpen,\n\t\tonOpenChange,\n\t\tdisabled = false,\n\t\tclassName,\n\t\tonError,\n\t\trenderError,\n\t\tstrings: stringsProp,\n\t} = props;\n\n\tconst strings = useStrings(defaultSuggestionsStrings, stringsProp);\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\n\tconst {\n\t\titems,\n\t\tisLoading,\n\t\tquery,\n\t\tsetQuery,\n\t\tvalue,\n\t\tsetValue,\n\t\topen,\n\t\tsetOpen,\n\t\terror,\n\t\tisError,\n\t\tretry,\n\t} = useSuggestions<T>({\n\t\tfetchData,\n\t\tminQueryLength,\n\t\tdebounceMs,\n\t\trequestDelay,\n\t\tpreload,\n\t\tquery: controlledQuery,\n\t\tdefaultQuery,\n\t\tonQueryChange,\n\t\tvalue: controlledValue,\n\t\tdefaultValue,\n\t\tonValueChange,\n\t\topen: controlledOpen,\n\t\tdefaultOpen,\n\t\tonOpenChange,\n\t\tonError,\n\t});\n\n\tconst comboboxStrings = useMemo(\n\t\t() => ({\n\t\t\tplaceholder: strings.placeholder,\n\t\t\tnoResults: strings.emptyMessage,\n\t\t\tsearching: strings.loadingMessage,\n\t\t\ttypeToSearch: strings.startTypingMessage,\n\t\t}),\n\t\t[strings],\n\t);\n\tconst retryQuery = useCallback(() => {\n\t\tif (!open) setOpen(true);\n\t\tinputRef.current?.focus();\n\t\tretry();\n\t}, [open, retry, setOpen]);\n\n\tconst errorNode = isError && error !== null\n\t\t? renderError?.({ error, query, retry: retryQuery }) ?? (\n\t\t\t<ErrorState\n\t\t\t\tvariant=\"inline\"\n\t\t\t\ttitle={strings.errorMessage}\n\t\t\t\tonRetry={retryQuery}\n\t\t\t\tretryLabel={strings.retry}\n\t\t\t\tclassName=\"suggestions-combobox--error\"\n\t\t\t/>\n\t\t)\n\t\t: null;\n\n\treturn (\n\t\t<div className={cn('suggestions--component suggestions-combobox--component', className)}>\n\t\t\t<Combobox<T>\n\t\t\t\tref={inputRef}\n\t\t\t\tclassName=\"suggestions-combobox--control\"\n\t\t\t\titems={items}\n\t\t\t\tsearchValue={query}\n\t\t\t\tonSearchValueChange={setQuery}\n\t\t\t\tselectedValue={value}\n\t\t\t\tonSelectedValueChange={setValue}\n\t\t\t\tgetItemLabel={itemText}\n\t\t\t\tgetItemKey={(item) => String(itemKey(item))}\n\t\t\t\trenderItem={renderItem}\n\t\t\t\tminSearchLength={minQueryLength}\n\t\t\t\tloading={!isError && isLoading}\n\t\t\t\tshowListContent={!isError}\n\t\t\t\tstrings={comboboxStrings}\n\t\t\t\tclearable={allowClear}\n\t\t\t\topen={open}\n\t\t\t\tonOpenChange={setOpen}\n\t\t\t\tclearSearchOnClose={clearInputOnClose && !isError}\n\t\t\t\tdisabled={disabled}\n\t\t\t/>\n\t\t\t{errorNode}\n\t\t</div>\n\t);\n}\n\nSuggestionsCombobox.displayName = 'SuggestionsCombobox';\n"],"mappings":";;;;;;;;;AASA,IAAMG,KAAQ,GAAY,MACzB,IAAI,SAAS,MAAY;CACxB,IAAIC,EAAO,SAAS;EACnB,EAAQ;EACR;CACD;CAEA,IAAMC,IAAQ,iBAAiB;EAE9B,AADAD,EAAO,oBAAoB,SAASE,CAAW,GAC/CC,EAAQ;CACT,GAAGC,CAAE,GACCF,UAAoB;EAEzB,AADA,aAAaD,CAAK,GAClBE,EAAQ;CACT;CACA,EAAO,iBAAiB,SAASD,GAAa,EAAE,MAAM,GAAK,CAAC;AAC7D,CAAC;AA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BAAiBpB;GACjB,SAAS,CAACc,KAAW7C;GACrB,iBAAiB,CAAC6C;GAClB,SAASJ;GACT,WAAWW;GACL;GACN,cAAchC;GACd,oBAAoBiC,KAAqB,CAACR;GAChC;EACV,CAAA,GACAD,CACG;;AAEP;AAEA,EAAoB,cAAc"}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { useStrings as e } from "../lib/strings.js";
3
- import { a as t, c as n } from "../typography-BQnine1k.js";
4
- import { t as r } from "../structure-DuxKl954.js";
5
- import { i, r as a } from "../choice-inputs-zUgBZfE4.js";
3
+ import { a as t, c as n } from "../typography-C7-YMW1S.js";
4
+ import { t as r } from "../structure-DZJ2wbAU.js";
5
+ import { i, r as a } from "../choice-inputs-DHGtx0QV.js";
6
6
  import { useEffect as o, useMemo as s } from "react";
7
7
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
8
  import { Controller as u, useForm as d } from "react-hook-form";
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, j as v, k as y, l as b, m as x, n as S, o as C, p as w, r as T, s as E, t as D, u as O, v as k, w as A, x as j, y as M } from "../table-CFOWY9pQ.js";
2
+ import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, j as v, k as y, l as b, m as x, n as S, o as C, p as w, r as T, s as E, t as D, u as O, v as k, w as A, x as j, y as M } from "../table-CBonSdTp.js";
3
3
  export { D as AvatarCell, b as CellStack, O as CellValue, h as ColumnVisibilityToggle, S as CurrencyCell, m as DataTable, o as DataTableActions, k as DataTableBody, p as DataTableFilterBar, l as DataTableHeader, x as DataTableToolbar, T as DateCell, _ as DateMetaCell, g as FullscreenToggle, y as Pagination, E as ResourceCell, u as StatusCell, C as StatusClusterCell, f as TableLink, M as addSelectionColumn, d as createHeaderSelectionCheckbox, j as createRowSelectionCheckbox, e as defaultDataTableStrings, s as getCellClassName, i as getDataTableScrollContainer, t as getRowClassName, A as getSelectedRowsData, c as handleColumnVisibilityChange, r as handleRowSelectionChange, n as handleSortingChange, v as mergeDataTableStrings, a as useDataTableScrollState, w as useDataTableSize };