@alepha/ui 0.27.1 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/dist/components/account/account-layout.d.ts.map +1 -1
  2. package/dist/components/account/account-layout.js +8 -2
  3. package/dist/components/account/account-layout.js.map +1 -1
  4. package/dist/components/admin/admin-analytics.d.ts +34 -5
  5. package/dist/components/admin/admin-analytics.d.ts.map +1 -1
  6. package/dist/components/admin/admin-analytics.js +69 -51
  7. package/dist/components/admin/admin-analytics.js.map +1 -1
  8. package/dist/components/admin/admin-audits.d.ts +14 -0
  9. package/dist/components/admin/admin-audits.d.ts.map +1 -1
  10. package/dist/components/admin/admin-audits.js +35 -8
  11. package/dist/components/admin/admin-audits.js.map +1 -1
  12. package/dist/components/admin/admin-files.d.ts.map +1 -1
  13. package/dist/components/admin/admin-files.js +2 -1
  14. package/dist/components/admin/admin-files.js.map +1 -1
  15. package/dist/components/admin/admin-jobs-executions-panel.js +1 -1
  16. package/dist/components/admin/admin-jobs.js +1 -1
  17. package/dist/components/admin/admin-keys.d.ts.map +1 -1
  18. package/dist/components/admin/admin-keys.js +2 -1
  19. package/dist/components/admin/admin-keys.js.map +1 -1
  20. package/dist/components/admin/admin-notifications.js +1 -1
  21. package/dist/components/admin/admin-parameters.d.ts.map +1 -1
  22. package/dist/components/admin/admin-parameters.js +108 -14
  23. package/dist/components/admin/admin-parameters.js.map +1 -1
  24. package/dist/components/admin/admin-payments.js +1 -1
  25. package/dist/components/admin/admin-sessions.d.ts.map +1 -1
  26. package/dist/components/admin/admin-sessions.js +126 -4
  27. package/dist/components/admin/admin-sessions.js.map +1 -1
  28. package/dist/components/admin/admin-user-avatar-control.d.ts +24 -0
  29. package/dist/components/admin/admin-user-avatar-control.d.ts.map +1 -0
  30. package/dist/components/admin/admin-user-avatar-control.js +84 -0
  31. package/dist/components/admin/admin-user-avatar-control.js.map +1 -0
  32. package/dist/components/admin/admin-user-detail.d.ts.map +1 -1
  33. package/dist/components/admin/admin-user-detail.js +13 -2
  34. package/dist/components/admin/admin-user-detail.js.map +1 -1
  35. package/dist/components/admin/admin-users.js +1 -1
  36. package/dist/components/admin/admin-workflows.js +1 -1
  37. package/dist/components/admin/analytics/AdvancedSection.d.ts +26 -0
  38. package/dist/components/admin/analytics/AdvancedSection.d.ts.map +1 -0
  39. package/dist/components/admin/analytics/AdvancedSection.js +143 -0
  40. package/dist/components/admin/analytics/AdvancedSection.js.map +1 -0
  41. package/dist/components/admin/analytics/AnalyticsChart.d.ts +20 -0
  42. package/dist/components/admin/analytics/AnalyticsChart.d.ts.map +1 -0
  43. package/dist/components/admin/analytics/AnalyticsChart.js +60 -0
  44. package/dist/components/admin/analytics/AnalyticsChart.js.map +1 -0
  45. package/dist/components/admin/analytics/AnalyticsChartBars.d.ts +19 -0
  46. package/dist/components/admin/analytics/AnalyticsChartBars.d.ts.map +1 -0
  47. package/dist/components/admin/analytics/AnalyticsChartBars.js +42 -0
  48. package/dist/components/admin/analytics/AnalyticsChartBars.js.map +1 -0
  49. package/dist/components/admin/analytics/AnalyticsChartDonut.d.ts +11 -0
  50. package/dist/components/admin/analytics/AnalyticsChartDonut.d.ts.map +1 -0
  51. package/dist/components/admin/analytics/AnalyticsChartDonut.js +78 -0
  52. package/dist/components/admin/analytics/AnalyticsChartDonut.js.map +1 -0
  53. package/dist/components/admin/analytics/AnalyticsChartHeader.d.ts +20 -0
  54. package/dist/components/admin/analytics/AnalyticsChartHeader.d.ts.map +1 -0
  55. package/dist/components/admin/analytics/AnalyticsChartHeader.js +105 -0
  56. package/dist/components/admin/analytics/AnalyticsChartHeader.js.map +1 -0
  57. package/dist/components/admin/analytics/AnalyticsChartHeat.d.ts +10 -0
  58. package/dist/components/admin/analytics/AnalyticsChartHeat.d.ts.map +1 -0
  59. package/dist/components/admin/analytics/AnalyticsChartHeat.js +58 -0
  60. package/dist/components/admin/analytics/AnalyticsChartHeat.js.map +1 -0
  61. package/dist/components/admin/analytics/AnalyticsChartLegend.d.ts +9 -0
  62. package/dist/components/admin/analytics/AnalyticsChartLegend.d.ts.map +1 -0
  63. package/dist/components/admin/analytics/AnalyticsChartLegend.js +21 -0
  64. package/dist/components/admin/analytics/AnalyticsChartLegend.js.map +1 -0
  65. package/dist/components/admin/analytics/AnalyticsChartLine.d.ts +13 -0
  66. package/dist/components/admin/analytics/AnalyticsChartLine.d.ts.map +1 -0
  67. package/dist/components/admin/analytics/AnalyticsChartLine.js +36 -0
  68. package/dist/components/admin/analytics/AnalyticsChartLine.js.map +1 -0
  69. package/dist/components/admin/analytics/AnalyticsChartRank.d.ts +13 -0
  70. package/dist/components/admin/analytics/AnalyticsChartRank.d.ts.map +1 -0
  71. package/dist/components/admin/analytics/AnalyticsChartRank.js +41 -0
  72. package/dist/components/admin/analytics/AnalyticsChartRank.js.map +1 -0
  73. package/dist/components/admin/analytics/AnalyticsChartTicks.d.ts +13 -0
  74. package/dist/components/admin/analytics/AnalyticsChartTicks.d.ts.map +1 -0
  75. package/dist/components/admin/analytics/AnalyticsChartTicks.js +26 -0
  76. package/dist/components/admin/analytics/AnalyticsChartTicks.js.map +1 -0
  77. package/dist/components/admin/analytics/AnalyticsEmpty.d.ts +16 -0
  78. package/dist/components/admin/analytics/AnalyticsEmpty.d.ts.map +1 -0
  79. package/dist/components/admin/analytics/AnalyticsEmpty.js +32 -0
  80. package/dist/components/admin/analytics/AnalyticsEmpty.js.map +1 -0
  81. package/dist/components/admin/analytics/ClauseLabel.d.ts +15 -0
  82. package/dist/components/admin/analytics/ClauseLabel.d.ts.map +1 -0
  83. package/dist/components/admin/analytics/ClauseLabel.js +19 -0
  84. package/dist/components/admin/analytics/ClauseLabel.js.map +1 -0
  85. package/dist/components/admin/analytics/CompareNote.d.ts +16 -0
  86. package/dist/components/admin/analytics/CompareNote.d.ts.map +1 -0
  87. package/dist/components/admin/analytics/CompareNote.js +33 -0
  88. package/dist/components/admin/analytics/CompareNote.js.map +1 -0
  89. package/dist/components/admin/analytics/DatasetSelect.d.ts +20 -0
  90. package/dist/components/admin/analytics/DatasetSelect.d.ts.map +1 -0
  91. package/dist/components/admin/analytics/DatasetSelect.js +63 -0
  92. package/dist/components/admin/analytics/DatasetSelect.js.map +1 -0
  93. package/dist/components/admin/analytics/FilterEditor.d.ts +24 -0
  94. package/dist/components/admin/analytics/FilterEditor.d.ts.map +1 -0
  95. package/dist/components/admin/analytics/FilterEditor.js +129 -0
  96. package/dist/components/admin/analytics/FilterEditor.js.map +1 -0
  97. package/dist/components/admin/analytics/FilterValuePicker.d.ts +19 -0
  98. package/dist/components/admin/analytics/FilterValuePicker.d.ts.map +1 -0
  99. package/dist/components/admin/analytics/FilterValuePicker.js +131 -0
  100. package/dist/components/admin/analytics/FilterValuePicker.js.map +1 -0
  101. package/dist/components/admin/analytics/GroupByChips.d.ts +26 -0
  102. package/dist/components/admin/analytics/GroupByChips.d.ts.map +1 -0
  103. package/dist/components/admin/analytics/GroupByChips.js +71 -0
  104. package/dist/components/admin/analytics/GroupByChips.js.map +1 -0
  105. package/dist/components/admin/analytics/MeasureChips.d.ts +18 -0
  106. package/dist/components/admin/analytics/MeasureChips.d.ts.map +1 -0
  107. package/dist/components/admin/analytics/MeasureChips.js +46 -0
  108. package/dist/components/admin/analytics/MeasureChips.js.map +1 -0
  109. package/dist/components/admin/analytics/QueryPanel.d.ts +27 -0
  110. package/dist/components/admin/analytics/QueryPanel.d.ts.map +1 -0
  111. package/dist/components/admin/analytics/QueryPanel.js +92 -0
  112. package/dist/components/admin/analytics/QueryPanel.js.map +1 -0
  113. package/dist/components/admin/analytics/RangeControl.d.ts +17 -0
  114. package/dist/components/admin/analytics/RangeControl.d.ts.map +1 -0
  115. package/dist/components/admin/analytics/RangeControl.js +43 -0
  116. package/dist/components/admin/analytics/RangeControl.js.map +1 -0
  117. package/dist/components/admin/analytics/RequestDialog.d.ts +24 -0
  118. package/dist/components/admin/analytics/RequestDialog.d.ts.map +1 -0
  119. package/dist/components/admin/analytics/RequestDialog.js +67 -0
  120. package/dist/components/admin/analytics/RequestDialog.js.map +1 -0
  121. package/dist/components/admin/analytics/ResultsPane.d.ts +15 -0
  122. package/dist/components/admin/analytics/ResultsPane.d.ts.map +1 -0
  123. package/dist/components/admin/analytics/ResultsPane.js +161 -0
  124. package/dist/components/admin/analytics/ResultsPane.js.map +1 -0
  125. package/dist/components/admin/analytics/ResultsTable.d.ts +17 -0
  126. package/dist/components/admin/analytics/ResultsTable.d.ts.map +1 -0
  127. package/dist/components/admin/analytics/ResultsTable.js +113 -0
  128. package/dist/components/admin/analytics/ResultsTable.js.map +1 -0
  129. package/dist/components/admin/analytics/RunFooter.d.ts +18 -0
  130. package/dist/components/admin/analytics/RunFooter.d.ts.map +1 -0
  131. package/dist/components/admin/analytics/RunFooter.js +78 -0
  132. package/dist/components/admin/analytics/RunFooter.js.map +1 -0
  133. package/dist/components/admin/analytics/SamplingBadge.d.ts +18 -0
  134. package/dist/components/admin/analytics/SamplingBadge.d.ts.map +1 -0
  135. package/dist/components/admin/analytics/SamplingBadge.js +35 -0
  136. package/dist/components/admin/analytics/SamplingBadge.js.map +1 -0
  137. package/dist/components/admin/analytics/ToggleChip.d.ts +28 -0
  138. package/dist/components/admin/analytics/ToggleChip.d.ts.map +1 -0
  139. package/dist/components/admin/analytics/ToggleChip.js +35 -0
  140. package/dist/components/admin/analytics/ToggleChip.js.map +1 -0
  141. package/dist/components/admin/analytics/TotalsCards.d.ts +19 -0
  142. package/dist/components/admin/analytics/TotalsCards.d.ts.map +1 -0
  143. package/dist/components/admin/analytics/TotalsCards.js +75 -0
  144. package/dist/components/admin/analytics/TotalsCards.js.map +1 -0
  145. package/dist/components/admin/analytics/TruncationBanner.d.ts +15 -0
  146. package/dist/components/admin/analytics/TruncationBanner.d.ts.map +1 -0
  147. package/dist/components/admin/analytics/TruncationBanner.js +52 -0
  148. package/dist/components/admin/analytics/TruncationBanner.js.map +1 -0
  149. package/dist/components/admin/analytics/analyticsModel.d.ts +98 -0
  150. package/dist/components/admin/analytics/analyticsModel.d.ts.map +1 -0
  151. package/dist/components/admin/analytics/analyticsModel.js +184 -0
  152. package/dist/components/admin/analytics/analyticsModel.js.map +1 -0
  153. package/dist/components/admin/analytics/analyticsTypes.d.ts +116 -0
  154. package/dist/components/admin/analytics/analyticsTypes.d.ts.map +1 -0
  155. package/dist/components/admin/analytics/analyticsTypes.js +0 -0
  156. package/dist/components/admin/analytics/chartModel.d.ts +149 -0
  157. package/dist/components/admin/analytics/chartModel.d.ts.map +1 -0
  158. package/dist/components/admin/analytics/chartModel.js +278 -0
  159. package/dist/components/admin/analytics/chartModel.js.map +1 -0
  160. package/dist/components/admin/analytics/useAnalyticsQuery.d.ts +62 -0
  161. package/dist/components/admin/analytics/useAnalyticsQuery.d.ts.map +1 -0
  162. package/dist/components/admin/analytics/useAnalyticsQuery.js +257 -0
  163. package/dist/components/admin/analytics/useAnalyticsQuery.js.map +1 -0
  164. package/dist/components/admin/analytics/useDismissable.d.ts +18 -0
  165. package/dist/components/admin/analytics/useDismissable.d.ts.map +1 -0
  166. package/dist/components/admin/analytics/useDismissable.js +37 -0
  167. package/dist/components/admin/analytics/useDismissable.js.map +1 -0
  168. package/dist/components/admin/analytics/useFilterValues.d.ts +37 -0
  169. package/dist/components/admin/analytics/useFilterValues.d.ts.map +1 -0
  170. package/dist/components/admin/analytics/useFilterValues.js +78 -0
  171. package/dist/components/admin/analytics/useFilterValues.js.map +1 -0
  172. package/dist/components/admin/analytics/usePanelWidth.d.ts +26 -0
  173. package/dist/components/admin/analytics/usePanelWidth.d.ts.map +1 -0
  174. package/dist/components/admin/analytics/usePanelWidth.js +61 -0
  175. package/dist/components/admin/analytics/usePanelWidth.js.map +1 -0
  176. package/dist/components/admin/analytics/useShapeLabels.d.ts +24 -0
  177. package/dist/components/admin/analytics/useShapeLabels.d.ts.map +1 -0
  178. package/dist/components/admin/analytics/useShapeLabels.js +41 -0
  179. package/dist/components/admin/analytics/useShapeLabels.js.map +1 -0
  180. package/dist/components/alepha-table/alepha-table-bulk-menu.d.ts +22 -0
  181. package/dist/components/alepha-table/alepha-table-bulk-menu.d.ts.map +1 -0
  182. package/dist/components/alepha-table/alepha-table-bulk-menu.js +117 -0
  183. package/dist/components/alepha-table/alepha-table-bulk-menu.js.map +1 -0
  184. package/dist/components/alepha-table/alepha-table.d.ts +148 -13
  185. package/dist/components/alepha-table/alepha-table.d.ts.map +1 -1
  186. package/dist/components/alepha-table/alepha-table.js +84 -17
  187. package/dist/components/alepha-table/alepha-table.js.map +1 -1
  188. package/dist/components/app-shell/app-shell.d.ts +30 -11
  189. package/dist/components/app-shell/app-shell.d.ts.map +1 -1
  190. package/dist/components/app-shell/app-shell.js +75 -67
  191. package/dist/components/app-shell/app-shell.js.map +1 -1
  192. package/dist/components/app-shell/navigation-progress.d.ts +40 -0
  193. package/dist/components/app-shell/navigation-progress.d.ts.map +1 -0
  194. package/dist/components/app-shell/navigation-progress.js +86 -0
  195. package/dist/components/app-shell/navigation-progress.js.map +1 -0
  196. package/dist/components/auth/auth-register.d.ts +35 -0
  197. package/dist/components/auth/auth-register.d.ts.map +1 -1
  198. package/dist/components/auth/auth-register.js +12 -8
  199. package/dist/components/auth/auth-register.js.map +1 -1
  200. package/dist/components/auto-form/auto-form.js +20 -17
  201. package/dist/components/auto-form/auto-form.js.map +1 -1
  202. package/dist/components/control/control.d.ts +39 -10
  203. package/dist/components/control/control.d.ts.map +1 -1
  204. package/dist/components/control/control.js +10 -4
  205. package/dist/components/control/control.js.map +1 -1
  206. package/dist/components/control-date/control-date.d.ts +8 -0
  207. package/dist/components/control-date/control-date.d.ts.map +1 -1
  208. package/dist/components/control-date/control-date.js +25 -9
  209. package/dist/components/control-date/control-date.js.map +1 -1
  210. package/dist/components/control-select/control-select.d.ts +57 -6
  211. package/dist/components/control-select/control-select.d.ts.map +1 -1
  212. package/dist/components/control-select/control-select.js +112 -32
  213. package/dist/components/control-select/control-select.js.map +1 -1
  214. package/dist/components/detail/detail-layout.d.ts.map +1 -1
  215. package/dist/components/detail/detail-layout.js +9 -6
  216. package/dist/components/detail/detail-layout.js.map +1 -1
  217. package/dist/components/markdown-view/diagram/MermaidFence.d.ts.map +1 -1
  218. package/dist/components/markdown-view/diagram/MermaidFence.js +1 -15
  219. package/dist/components/markdown-view/diagram/MermaidFence.js.map +1 -1
  220. package/dist/components/markdown-view/diagram/diagramKind.d.ts +18 -0
  221. package/dist/components/markdown-view/diagram/diagramKind.d.ts.map +1 -0
  222. package/dist/components/markdown-view/diagram/diagramKind.js +27 -0
  223. package/dist/components/markdown-view/diagram/diagramKind.js.map +1 -0
  224. package/dist/components/plate-layout/plate-layout.d.ts +50 -0
  225. package/dist/components/plate-layout/plate-layout.d.ts.map +1 -0
  226. package/dist/components/plate-layout/plate-layout.js +37 -0
  227. package/dist/components/plate-layout/plate-layout.js.map +1 -0
  228. package/dist/components/plate-layout/plate-tab-bar.d.ts +55 -0
  229. package/dist/components/plate-layout/plate-tab-bar.d.ts.map +1 -0
  230. package/dist/components/plate-layout/plate-tab-bar.js +52 -0
  231. package/dist/components/plate-layout/plate-tab-bar.js.map +1 -0
  232. package/dist/components/ui/button.js +1 -1
  233. package/dist/components/ui/button.js.map +1 -1
  234. package/dist/components/use-dialog/use-dialog.d.ts +7 -0
  235. package/dist/components/use-dialog/use-dialog.d.ts.map +1 -1
  236. package/dist/components/use-dialog/use-dialog.js +10 -1
  237. package/dist/components/use-dialog/use-dialog.js.map +1 -1
  238. package/dist/lib/i18n-fr.d.ts.map +1 -1
  239. package/dist/lib/i18n-fr.js +110 -7
  240. package/dist/lib/i18n-fr.js.map +1 -1
  241. package/dist/styles.css +45 -21
  242. package/package.json +9 -8
  243. package/src/components/account/__tests__/account-layout.browser.spec.tsx +127 -0
  244. package/src/components/account/account-layout.tsx +32 -2
  245. package/src/components/admin/__tests__/admin-audits-action-filter.browser.spec.tsx +53 -0
  246. package/src/components/admin/admin-analytics.tsx +97 -83
  247. package/src/components/admin/admin-audits.tsx +50 -8
  248. package/src/components/admin/admin-files.tsx +3 -0
  249. package/src/components/admin/admin-keys.tsx +2 -0
  250. package/src/components/admin/admin-parameters.tsx +165 -12
  251. package/src/components/admin/admin-sessions.tsx +164 -4
  252. package/src/components/admin/admin-user-avatar-control.tsx +130 -0
  253. package/src/components/admin/admin-user-detail.tsx +25 -3
  254. package/src/components/admin/analytics/AdvancedSection.tsx +162 -0
  255. package/src/components/admin/analytics/AnalyticsChart.tsx +69 -0
  256. package/src/components/admin/analytics/AnalyticsChartBars.tsx +86 -0
  257. package/src/components/admin/analytics/AnalyticsChartDonut.tsx +78 -0
  258. package/src/components/admin/analytics/AnalyticsChartHeader.tsx +135 -0
  259. package/src/components/admin/analytics/AnalyticsChartHeat.tsx +57 -0
  260. package/src/components/admin/analytics/AnalyticsChartLegend.tsx +26 -0
  261. package/src/components/admin/analytics/AnalyticsChartLine.tsx +37 -0
  262. package/src/components/admin/analytics/AnalyticsChartRank.tsx +43 -0
  263. package/src/components/admin/analytics/AnalyticsChartTicks.tsx +38 -0
  264. package/src/components/admin/analytics/AnalyticsEmpty.tsx +37 -0
  265. package/src/components/admin/analytics/ClauseLabel.tsx +26 -0
  266. package/src/components/admin/analytics/CompareNote.tsx +50 -0
  267. package/src/components/admin/analytics/DatasetSelect.tsx +79 -0
  268. package/src/components/admin/analytics/FilterEditor.tsx +173 -0
  269. package/src/components/admin/analytics/FilterValuePicker.tsx +154 -0
  270. package/src/components/admin/analytics/GroupByChips.tsx +82 -0
  271. package/src/components/admin/analytics/MeasureChips.tsx +53 -0
  272. package/src/components/admin/analytics/QueryPanel.tsx +113 -0
  273. package/src/components/admin/analytics/RangeControl.tsx +42 -0
  274. package/src/components/admin/analytics/RequestDialog.tsx +91 -0
  275. package/src/components/admin/analytics/ResultsPane.tsx +224 -0
  276. package/src/components/admin/analytics/ResultsTable.tsx +176 -0
  277. package/src/components/admin/analytics/RunFooter.tsx +90 -0
  278. package/src/components/admin/analytics/SamplingBadge.tsx +46 -0
  279. package/src/components/admin/analytics/ToggleChip.tsx +57 -0
  280. package/src/components/admin/analytics/TotalsCards.tsx +79 -0
  281. package/src/components/admin/analytics/TruncationBanner.tsx +60 -0
  282. package/src/components/admin/analytics/analyticsModel.spec.ts +266 -0
  283. package/src/components/admin/analytics/analyticsModel.ts +263 -0
  284. package/src/components/admin/analytics/analyticsTypes.ts +139 -0
  285. package/src/components/admin/analytics/chartModel.spec.ts +240 -0
  286. package/src/components/admin/analytics/chartModel.ts +427 -0
  287. package/src/components/admin/analytics/useAnalyticsQuery.ts +401 -0
  288. package/src/components/admin/analytics/useDismissable.ts +48 -0
  289. package/src/components/admin/analytics/useFilterValues.ts +113 -0
  290. package/src/components/admin/analytics/usePanelWidth.ts +85 -0
  291. package/src/components/admin/analytics/useShapeLabels.ts +73 -0
  292. package/src/components/alepha-table/__tests__/alepha-table-actions.browser.spec.tsx +117 -0
  293. package/src/components/alepha-table/__tests__/alepha-table-bulk-menu.browser.spec.tsx +177 -0
  294. package/src/components/alepha-table/__tests__/alepha-table-bulk-visible.browser.spec.tsx +125 -0
  295. package/src/components/alepha-table/alepha-table-bulk-menu.tsx +170 -0
  296. package/src/components/alepha-table/alepha-table.tsx +294 -55
  297. package/src/components/app-shell/__tests__/navigation-progress.browser.spec.tsx +122 -0
  298. package/src/components/app-shell/__tests__/sidebar-nav-auto-close.browser.spec.tsx +170 -0
  299. package/src/components/app-shell/app-shell.tsx +135 -110
  300. package/src/components/app-shell/navigation-progress.tsx +110 -0
  301. package/src/components/auth/auth-register.tsx +72 -9
  302. package/src/components/auto-form/__tests__/auto-form-fill-groups.browser.spec.tsx +104 -0
  303. package/src/components/auto-form/auto-form.tsx +13 -3
  304. package/src/components/control/control.tsx +63 -14
  305. package/src/components/control-date/control-date.tsx +55 -16
  306. package/src/components/control-select/__tests__/control-select-multi.browser.spec.tsx +196 -0
  307. package/src/components/control-select/__tests__/control-select-searchable.browser.spec.tsx +5 -1
  308. package/src/components/control-select/__tests__/control-select-size-minimal.browser.spec.tsx +119 -0
  309. package/src/components/control-select/__tests__/control-select-trigger-props.browser.spec.tsx +89 -0
  310. package/src/components/control-select/control-select.tsx +294 -97
  311. package/src/components/detail/__tests__/detail-layout.browser.spec.tsx +46 -0
  312. package/src/components/detail/detail-layout.tsx +37 -7
  313. package/src/components/markdown-view/diagram/MermaidFence.tsx +1 -23
  314. package/src/components/markdown-view/diagram/diagramKind.ts +31 -0
  315. package/src/components/plate-layout/__tests__/plate-layout.browser.spec.tsx +167 -0
  316. package/src/components/plate-layout/plate-layout.tsx +78 -0
  317. package/src/components/plate-layout/plate-tab-bar.tsx +122 -0
  318. package/src/components/ui/button.tsx +1 -1
  319. package/src/components/use-dialog/use-dialog.tsx +10 -0
  320. package/src/lib/i18n-fr.ts +121 -7
  321. package/src/styles.css +45 -21
  322. package/dist/components/admin/admin-analytics-query-panel.d.ts +0 -16
  323. package/dist/components/admin/admin-analytics-query-panel.d.ts.map +0 -1
  324. package/dist/components/admin/admin-analytics-query-panel.js +0 -117
  325. package/dist/components/admin/admin-analytics-query-panel.js.map +0 -1
  326. package/dist/components/admin/admin-analytics-results.d.ts +0 -15
  327. package/dist/components/admin/admin-analytics-results.d.ts.map +0 -1
  328. package/dist/components/admin/admin-analytics-results.js +0 -56
  329. package/dist/components/admin/admin-analytics-results.js.map +0 -1
  330. package/src/components/admin/admin-analytics-query-panel.tsx +0 -150
  331. package/src/components/admin/admin-analytics-results.tsx +0 -95
@@ -1 +1 @@
1
- {"version":3,"file":"auth-register.js","names":[],"sources":["../../../src/components/auth/auth-register.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { BrandIcon } from \"@alepha/ui/components/brand-icon/brand-icon\";\nimport {\n TurnstileWidget,\n type TurnstileWidgetHandle,\n} from \"@alepha/ui/components/captcha/turnstile-widget\";\nimport { iconFor } from \"@alepha/ui/components/control-base/icon-hint\";\nimport { Control } from \"@alepha/ui/components/control/control\";\nimport { Alert, AlertDescription } from \"@alepha/ui/components/ui/alert\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { Card, CardContent } from \"@alepha/ui/components/ui/card\";\nimport {\n InputOTP,\n InputOTPGroup,\n InputOTPSeparator,\n InputOTPSlot,\n} from \"@alepha/ui/components/ui/input-otp\";\nimport { Label } from \"@alepha/ui/components/ui/label\";\nimport { Separator } from \"@alepha/ui/components/ui/separator\";\nimport { SchemaValidationError, z } from \"alepha\";\nimport type {\n RealmConfig,\n RegistrationIntentResponse,\n UserController,\n} from \"alepha/api/users\";\nimport { useClient } from \"alepha/react\";\nimport { useAuth } from \"alepha/react/auth\";\nimport { useForm, useFormState } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useRouter } from \"alepha/react/router\";\nimport { AlertCircle, Check, Info, X } from \"lucide-react\";\nimport {\n type ReactNode,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport { safeRedirect } from \"./safe-redirect.ts\";\n\nexport interface AuthRegisterProps {\n /**\n * Realm configuration (drives required fields, verification step, OAuth buttons).\n */\n realmConfig: RealmConfig;\n /**\n * Custom logo node, rendered above the form. When provided, it replaces\n * the default `settings.logoUrl` <img>. Use this to inject a branded\n * component (e.g. with light/dark variants or an animation).\n */\n logo?: ReactNode;\n /**\n * Route to the login page. When set, a \"Sign in\" link is shown.\n */\n loginPath?: string;\n /**\n * Optional banner rendered above the registration form (form phase only).\n * Used to contextualize the flow when the user arrives via a CTA, e.g.\n * \"Before creating a campaign, create an account.\"\n */\n message?: ReactNode;\n /**\n * Where the \"Cancel\" button abandons to. Defaults to \"/\". This is\n * intentionally decoupled from the post-auth `?redirect=` target: cancelling\n * an unauthenticated registration must land somewhere public (home), not the\n * protected destination the user was *heading* to — which would only bounce\n * them back to this page.\n */\n cancelPath?: string;\n}\n\ntype Phase = \"form\" | \"verification\";\n\ninterface State {\n phase: Phase;\n intent?: RegistrationIntentResponse;\n credentials?: { identifier: string; password: string };\n}\n\nexport const AuthRegister = (props: AuthRegisterProps) => {\n const auth = useAuth();\n const userCtrl = useClient<UserController>();\n const router = useRouter();\n const { tr } = useI18n();\n const redirect = safeRedirect(router.query.redirect);\n // Surface upstream auth errors (e.g. failed OAuth callback redirects with\n // `?error=...`) — same pattern as AuthLogin. Without this the user lands on\n // a fresh-looking registration page with no clue why.\n const queryError =\n typeof router.query.error === \"string\" ? router.query.error : undefined;\n\n const [state, setState] = useState<State>({ phase: \"form\" });\n const [emailCode, setEmailCode] = useState(\"\");\n const [phoneCode, setPhoneCode] = useState(\"\");\n const [verifyError, setVerifyError] = useState<string | null>(null);\n const [submitting, setSubmitting] = useState(false);\n\n const captchaSiteKey = props.realmConfig.captchaSiteKey;\n const [captchaToken, setCaptchaToken] = useState<string | undefined>();\n const captchaRef = useRef<TurnstileWidgetHandle | null>(null);\n // The handler reads the token the widget issued last through a ref, so a\n // submit never posts a token captured by an earlier render.\n const captchaTokenRef = useRef<string | undefined>(undefined);\n useEffect(() => {\n captchaTokenRef.current = captchaToken;\n }, [captchaToken]);\n\n const credentialsProvider = props.realmConfig.authenticationMethods.find(\n (it) => it.type === \"CREDENTIALS\",\n );\n const settings = props.realmConfig.settings;\n const allowed = settings.registrationAllowed !== false;\n\n const schema = useMemo(() => {\n // Optionality is decided as each field is built, because that is the only\n // thing the form reads: `FormModel` derives both the required marker and\n // the pre-submit check from `z.schema.requiredKeys(schema)`, which asks\n // whether the field is optional or defaulted.\n //\n // This used to declare every field optional and then push the configured\n // names onto the array returned by `z.schema.requiredKeys(s)` — a TypeBox\n // habit, where a JSON Schema's `required` was a live array hanging off the\n // schema. The zod implementation computes a fresh array from the shape, so\n // the pushes mutated a detached value and vanished: a realm with\n // `email: \"required\"` still rendered Email with no asterisk and let an\n // empty one through to the server.\n const names = settings.firstNameLastName === \"required\";\n const shape = {\n firstName: names\n ? z.text({ trim: true, maxLength: 100 })\n : z.text({ trim: true, maxLength: 100 }).optional(),\n lastName: names\n ? z.text({ trim: true, maxLength: 100 })\n : z.text({ trim: true, maxLength: 100 }).optional(),\n username:\n settings.username === \"required\"\n ? z.text({ trim: true, pattern: settings.usernameRegExp })\n : z.text({ trim: true, pattern: settings.usernameRegExp }).optional(),\n email: settings.email === \"required\" ? z.email() : z.email().optional(),\n phoneNumber:\n settings.phoneNumber === \"required\" ? z.e164() : z.e164().optional(),\n password: z.string().min(settings.passwordPolicy?.minLength ?? 8),\n };\n\n // The runtime shape varies with the realm, but the *type* must not: every\n // consumer below reads `data.email`, `data.username` and the rest as\n // possibly-absent. Widening to the all-optional shape keeps one stable\n // type instead of a union of eight.\n return z.object(shape) as unknown as ReturnType<typeof registerFormSchema>;\n }, [settings]);\n\n const form = useForm({\n schema,\n handler: async (data) => {\n try {\n const intent = await userCtrl.createRegistrationIntent({\n query: { userRealmName: props.realmConfig.realmName },\n body: {\n firstName: data.firstName,\n lastName: data.lastName,\n username: data.username,\n email: data.email,\n phoneNumber: data.phoneNumber,\n password: data.password,\n captchaToken: captchaSiteKey ? captchaTokenRef.current : undefined,\n },\n });\n const identifier = data.username ?? data.email ?? data.phoneNumber;\n if (\n intent.expectEmailVerification ||\n intent.expectPhoneVerification ||\n intent.expectCaptcha\n ) {\n setState({\n phase: \"verification\",\n intent,\n credentials: identifier\n ? { identifier, password: data.password }\n : undefined,\n });\n return;\n }\n await userCtrl.createUserFromIntent({\n body: { intentId: intent.intentId },\n });\n if (identifier && credentialsProvider) {\n await auth.login(credentialsProvider.name, {\n username: identifier,\n password: data.password,\n realm: props.realmConfig.realmName,\n });\n }\n // `force: true` so parent-layout loaders re-run against the freshly\n // authenticated user — see the note in auth-login.tsx.\n await router.push(redirect, { force: true });\n } catch (err) {\n // Turnstile tokens are single-use — force a fresh challenge so the\n // user can retry after a server-side failure.\n captchaRef.current?.reset();\n throw err;\n }\n },\n });\n\n const formState = useFormState(form, [\"error\", \"values\", \"loading\"]);\n const formError =\n formState.error && !(formState.error instanceof SchemaValidationError)\n ? formState.error.message\n : undefined;\n const passwordValue = String(formState.values?.password ?? \"\");\n\n const firstFieldId =\n (settings.firstNameLastName !== \"none\" && form.input.firstName?.props.id) ||\n (settings.username !== \"none\" &&\n settings.username !== \"email\" &&\n form.input.username?.props.id) ||\n (settings.email !== \"none\" && form.input.email?.props.id) ||\n (settings.phoneNumber !== \"none\" && form.input.phoneNumber?.props.id) ||\n form.input.password.props.id;\n\n useEffect(() => {\n if (state.phase !== \"form\" || !firstFieldId) return;\n const el = document.getElementById(\n String(firstFieldId),\n ) as HTMLInputElement | null;\n el?.focus();\n }, [state.phase, firstFieldId]);\n\n const handleVerify = async () => {\n if (!state.intent) return;\n setSubmitting(true);\n setVerifyError(null);\n try {\n await userCtrl.createUserFromIntent({\n body: {\n intentId: state.intent.intentId,\n emailCode: state.intent.expectEmailVerification\n ? emailCode\n : undefined,\n phoneCode: state.intent.expectPhoneVerification\n ? phoneCode\n : undefined,\n },\n });\n if (state.credentials && credentialsProvider) {\n await auth.login(credentialsProvider.name, {\n username: state.credentials.identifier,\n password: state.credentials.password,\n realm: props.realmConfig.realmName,\n });\n }\n // `force: true` so parent-layout loaders re-run against the freshly\n // authenticated user — see the note in auth-login.tsx.\n await router.push(redirect, { force: true });\n } catch (err) {\n setVerifyError(\n err instanceof Error\n ? err.message\n : tr(\"auth.register.verifyFailed\", {\n default: \"Verification failed\",\n }),\n );\n } finally {\n setSubmitting(false);\n }\n };\n\n // Query appended to the \"already have an account? sign in\" link: the realm,\n // plus the post-auth redirect (`?redirect=`) so signing in returns the user\n // to wherever registering would have sent them (it's dropped otherwise).\n const realmBit = props.realmConfig.realmName\n ? `realm=${encodeURIComponent(props.realmConfig.realmName)}`\n : \"\";\n const redirectBit =\n typeof router.query.redirect === \"string\" && router.query.redirect\n ? `redirect=${encodeURIComponent(router.query.redirect)}`\n : \"\";\n const loginQ = [realmBit, redirectBit].filter(Boolean).join(\"&\");\n const realmQuery = loginQ ? `?${loginQ}` : \"\";\n\n const externalMethods = props.realmConfig.authenticationMethods.filter(\n (m) => m.type !== \"CREDENTIALS\",\n );\n const showDivider = credentialsProvider && externalMethods.length > 0;\n const isVerifying = state.phase === \"verification\" && state.intent;\n const canSubmitVerify =\n !isVerifying ||\n ((!state.intent!.expectEmailVerification || emailCode.length === 6) &&\n (!state.intent!.expectPhoneVerification || phoneCode.length === 6));\n\n const contentRef = useRef<HTMLDivElement>(null);\n const [contentHeight, setContentHeight] = useState<number | undefined>(\n undefined,\n );\n useLayoutEffect(() => {\n const el = contentRef.current;\n if (!el) return;\n setContentHeight(el.scrollHeight);\n const ro = new ResizeObserver(() => {\n setContentHeight(el.scrollHeight);\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n return (\n <Centered>\n {props.logo ?? (\n <RealmLogo\n settings={settings}\n realmName={props.realmConfig.realmName}\n />\n )}\n <Card className=\"w-full\">\n <CardContent\n className=\"overflow-hidden p-0 transition-[height] duration-300 ease-out\"\n style={\n contentHeight !== undefined ? { height: contentHeight } : undefined\n }\n >\n <div ref={contentRef}>\n <div\n key={state.phase}\n className=\"animate-in fade-in flex flex-col gap-4 px-6 duration-300\"\n >\n {isVerifying ? (\n <>\n <h2 className=\"text-center text-lg font-semibold\">\n {tr(\"auth.register.verifyTitle\", {\n default: \"Verify your account\",\n })}\n </h2>\n <p className=\"text-muted-foreground text-center text-sm\">\n {tr(\"auth.register.verifyHint\", {\n default:\n \"Please enter the verification code(s) sent to you.\",\n })}\n </p>\n {verifyError && (\n <Alert variant=\"destructive\">\n <AlertCircle className=\"size-4\" />\n <AlertDescription>{verifyError}</AlertDescription>\n </Alert>\n )}\n {state.intent!.expectEmailVerification && (\n <div className=\"flex flex-col items-center gap-2\">\n <Label htmlFor=\"emailCode\">\n {tr(\"auth.register.emailCode\", {\n default: \"Email verification code\",\n })}\n </Label>\n <InputOTP\n id=\"emailCode\"\n maxLength={6}\n autoComplete=\"one-time-code\"\n\n value={emailCode}\n onChange={setEmailCode}\n >\n <InputOTPGroup>\n <InputOTPSlot index={0} />\n <InputOTPSlot index={1} />\n <InputOTPSlot index={2} />\n </InputOTPGroup>\n <InputOTPSeparator />\n <InputOTPGroup>\n <InputOTPSlot index={3} />\n <InputOTPSlot index={4} />\n <InputOTPSlot index={5} />\n </InputOTPGroup>\n </InputOTP>\n </div>\n )}\n {state.intent!.expectPhoneVerification && (\n <div className=\"flex flex-col items-center gap-2\">\n <Label htmlFor=\"phoneCode\">\n {tr(\"auth.register.phoneCode\", {\n default: \"Phone verification code\",\n })}\n </Label>\n <InputOTP\n id=\"phoneCode\"\n maxLength={6}\n autoComplete=\"one-time-code\"\n\n value={phoneCode}\n onChange={setPhoneCode}\n >\n <InputOTPGroup>\n <InputOTPSlot index={0} />\n <InputOTPSlot index={1} />\n <InputOTPSlot index={2} />\n </InputOTPGroup>\n <InputOTPSeparator />\n <InputOTPGroup>\n <InputOTPSlot index={3} />\n <InputOTPSlot index={4} />\n <InputOTPSlot index={5} />\n </InputOTPGroup>\n </InputOTP>\n </div>\n )}\n <Button\n onClick={handleVerify}\n loading={submitting}\n disabled={!canSubmitVerify}\n >\n {tr(\"auth.register.verifySubmit\", {\n default: \"Complete registration\",\n })}\n </Button>\n <Button\n variant=\"ghost\"\n onClick={() => setState({ phase: \"form\" })}\n >\n {tr(\"auth.register.verifyBack\", {\n default: \"Back to registration\",\n })}\n </Button>\n </>\n ) : (\n <FormPhase\n allowed={allowed}\n form={form}\n formError={formError ?? queryError}\n loading={formState.loading}\n passwordValue={passwordValue}\n settings={settings}\n realmName={props.realmConfig.realmName}\n credentialsProvider={credentialsProvider}\n externalMethods={externalMethods}\n showDivider={showDivider}\n redirect={redirect}\n loginPath={props.loginPath}\n realmQuery={realmQuery}\n auth={auth}\n captchaSiteKey={captchaSiteKey}\n captchaToken={captchaToken}\n captchaRef={captchaRef}\n onCaptchaToken={setCaptchaToken}\n message={props.message}\n />\n )}\n </div>\n </div>\n </CardContent>\n </Card>\n {!isVerifying && (\n <Button\n variant=\"ghost\"\n nativeButton={false}\n render={<a href={props.cancelPath ?? \"/\"} />}\n >\n {tr(\"auth.register.cancel\", { default: \"Cancel\" })}\n </Button>\n )}\n </Centered>\n );\n};\n\nconst FormPhase = (props: {\n allowed: boolean;\n form: ReturnType<typeof useForm>;\n formError: string | undefined;\n loading: boolean;\n passwordValue: string;\n settings: RealmConfig[\"settings\"];\n realmName: string;\n credentialsProvider: any;\n externalMethods: Array<{ name: string; type: string }>;\n showDivider: boolean | undefined;\n redirect: string;\n loginPath: string | undefined;\n realmQuery: string;\n auth: ReturnType<typeof useAuth>;\n captchaSiteKey?: string;\n captchaToken?: string;\n captchaRef: React.RefObject<TurnstileWidgetHandle | null>;\n onCaptchaToken: (token: string | undefined) => void;\n message?: ReactNode;\n}) => {\n const { tr } = useI18n();\n const [passwordFieldFocused, setPasswordFieldFocused] = useState(false);\n const {\n allowed,\n form,\n formError,\n passwordValue,\n settings,\n credentialsProvider,\n externalMethods,\n showDivider,\n redirect,\n realmQuery,\n } = props;\n return (\n <>\n <RealmHeader settings={settings} realmName={props.realmName} />\n {!allowed ? (\n <>\n <Alert>\n <AlertCircle className=\"size-4\" />\n <AlertDescription>\n {tr(\"auth.register.disabled\", {\n default:\n \"Registration is not available. Please contact your administrator.\",\n })}\n </AlertDescription>\n </Alert>\n <Button\n render={\n <a href={`${props.loginPath ?? \"/auth/login\"}${realmQuery}`} />\n }\n >\n {tr(\"auth.register.backToSignIn\", { default: \"Back to sign in\" })}\n </Button>\n </>\n ) : (\n <>\n {props.message && (\n <Alert>\n <Info className=\"size-4\" />\n <AlertDescription>{props.message}</AlertDescription>\n </Alert>\n )}\n {formError && (\n <Alert variant=\"destructive\">\n <AlertCircle className=\"size-4\" />\n <AlertDescription>{formError}</AlertDescription>\n </Alert>\n )}\n {credentialsProvider && (\n <form {...form.props} className=\"flex flex-col gap-4\">\n {settings.firstNameLastName !== \"none\" &&\n form.input.firstName &&\n form.input.lastName && (\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <Control\n label={tr(\"auth.register.firstName\", {\n default: \"First name\",\n })}\n input={form.input.firstName}\n autoComplete=\"given-name\"\n />\n <Control\n label={tr(\"auth.register.lastName\", {\n default: \"Last name\",\n })}\n input={form.input.lastName}\n autoComplete=\"family-name\"\n />\n </div>\n )}\n {settings.username !== \"none\" &&\n settings.username !== \"email\" &&\n form.input.username && (\n <Control\n label={tr(\"auth.register.username\", {\n default: \"Username\",\n })}\n input={form.input.username}\n icon={iconFor(\"user\")}\n autoComplete=\"username\"\n />\n )}\n {settings.email !== \"none\" && form.input.email && (\n <Control\n label={tr(\"auth.register.email\", { default: \"Email\" })}\n description={\n settings.verifyEmailRequired\n ? tr(\"auth.register.email.verify\", {\n default:\n \"We'll send a verification code to confirm your email.\",\n })\n : undefined\n }\n input={form.input.email}\n icon={iconFor(\"email\")}\n />\n )}\n {settings.phoneNumber !== \"none\" && form.input.phoneNumber && (\n <Control\n label={tr(\"auth.register.phone\", {\n default: \"Phone number\",\n })}\n description={\n settings.verifyPhoneRequired\n ? tr(\"auth.register.phone.verify\", {\n default:\n \"We'll send a verification code to confirm your phone number.\",\n })\n : undefined\n }\n input={form.input.phoneNumber}\n icon={iconFor(\"phone\")}\n />\n )}\n {/* `onFocus`/`onBlur` bubble from the input + toggle inside —\n the rules stay visible while the user types or interacts\n with the password toggle, and only collapse once the field\n is blurred AND empty. */}\n <div\n onFocus={() => setPasswordFieldFocused(true)}\n onBlur={() => setPasswordFieldFocused(false)}\n >\n <Control\n label={tr(\"auth.register.password\", { default: \"Password\" })}\n input={form.input.password}\n password\n autoComplete=\"new-password\"\n />\n </div>\n {(passwordFieldFocused || passwordValue.length > 0) && (\n <PasswordRules\n policy={settings.passwordPolicy}\n value={passwordValue}\n />\n )}\n {props.captchaSiteKey && (\n <TurnstileWidget\n ref={props.captchaRef}\n siteKey={props.captchaSiteKey}\n onToken={props.onCaptchaToken}\n className=\"flex justify-center\"\n />\n )}\n <Button\n type=\"submit\"\n loading={props.loading}\n disabled={!!props.captchaSiteKey && !props.captchaToken}\n >\n {tr(\"auth.register.submit\", { default: \"Create account\" })}\n </Button>\n </form>\n )}\n {showDivider && (\n <div className=\"flex items-center gap-3\">\n <Separator className=\"flex-1\" />\n <span className=\"text-muted-foreground text-xs\">\n {tr(\"auth.register.or\", { default: \"OR\" })}\n </span>\n <Separator className=\"flex-1\" />\n </div>\n )}\n {externalMethods.map((method) => {\n const provider =\n method.name.charAt(0).toUpperCase() + method.name.slice(1);\n return (\n <Button\n key={method.name}\n variant=\"outline\"\n onClick={() =>\n props.auth.login(method.name as never, {\n redirect,\n realm: props.realmName,\n })\n }\n >\n <BrandIcon provider={method.name} />\n {tr(\"auth.register.continueWith\", {\n default: `Continue with ${provider}`,\n args: [provider],\n })}\n </Button>\n );\n })}\n <p className=\"text-muted-foreground text-center text-sm\">\n {tr(\"auth.register.haveAccount\", {\n default: \"Already have an account?\",\n })}{\" \"}\n <a\n href={`${props.loginPath ?? \"/auth/login\"}${realmQuery}`}\n className=\"text-foreground underline-offset-4 hover:underline\"\n >\n {tr(\"auth.register.signIn\", { default: \"Sign in\" })}\n </a>\n </p>\n </>\n )}\n </>\n );\n};\n\nconst Centered = (props: { children: React.ReactNode }) => {\n return (\n <div className=\"flex min-h-svh flex-1 items-center justify-center p-6\">\n <div className=\"flex w-full max-w-sm flex-col items-center gap-4\">\n {props.children}\n </div>\n </div>\n );\n};\n\nconst RealmHeader = (props: {\n settings: RealmConfig[\"settings\"];\n realmName: string;\n}) => {\n const s = props.settings;\n if (!s.displayName && !s.description) return null;\n return (\n <div className=\"flex flex-col items-center gap-1\">\n {s.displayName && (\n <h2 className=\"text-center text-lg font-semibold\">{s.displayName}</h2>\n )}\n {s.description && (\n <p className=\"text-muted-foreground text-center text-sm\">\n {s.description}\n </p>\n )}\n </div>\n );\n};\n\nconst PasswordRules = (props: {\n policy: RealmConfig[\"settings\"][\"passwordPolicy\"];\n value: string;\n}) => {\n const { tr } = useI18n();\n const policy = props.policy;\n const value = props.value;\n\n const rules: { ok: boolean; label: string }[] = [];\n\n if (policy?.minLength && policy.minLength > 0) {\n rules.push({\n ok: value.length >= policy.minLength,\n label: tr(\"auth.register.password.rule.minLength\", {\n default: `At least ${policy.minLength} characters`,\n args: [String(policy.minLength)],\n }),\n });\n }\n if (policy?.requireUppercase) {\n rules.push({\n ok: /[A-Z]/.test(value),\n label: tr(\"auth.register.password.rule.uppercase\", {\n default: \"One uppercase letter\",\n }),\n });\n }\n if (policy?.requireLowercase) {\n rules.push({\n ok: /[a-z]/.test(value),\n label: tr(\"auth.register.password.rule.lowercase\", {\n default: \"One lowercase letter\",\n }),\n });\n }\n if (policy?.requireNumbers) {\n rules.push({\n ok: /[0-9]/.test(value),\n label: tr(\"auth.register.password.rule.number\", {\n default: \"One number\",\n }),\n });\n }\n if (policy?.requireSpecialCharacters) {\n rules.push({\n ok: /[^A-Za-z0-9]/.test(value),\n label: tr(\"auth.register.password.rule.special\", {\n default: \"One special character\",\n }),\n });\n }\n\n if (rules.length === 0) return null;\n\n return (\n <ul className=\"text-muted-foreground -mt-2 flex flex-col gap-1 text-xs\">\n {rules.map((rule, idx) => (\n <li\n key={idx}\n className={`flex items-center gap-1.5 ${rule.ok ? \"text-emerald-600 dark:text-emerald-400\" : \"\"}`}\n >\n {rule.ok ? (\n <Check className=\"size-3.5\" />\n ) : (\n <X className=\"size-3.5 opacity-50\" />\n )}\n <span>{rule.label}</span>\n </li>\n ))}\n </ul>\n );\n};\n\nconst RealmLogo = (props: {\n settings: RealmConfig[\"settings\"];\n realmName: string;\n}) => {\n if (!props.settings.logoUrl) return null;\n return (\n <img\n src={props.settings.logoUrl}\n alt={props.settings.displayName || props.realmName}\n className=\"bg-muted size-16 rounded-xl border object-cover shadow-sm\"\n />\n );\n};\n\n/**\n * The reference shape of the registration form, with every configurable field\n * optional.\n *\n * `AuthRegister` builds its real schema from the realm settings, so which\n * fields are optional changes per realm. This exists purely to give that\n * schema one stable TypeScript type: the handler reads `data.email`,\n * `data.username` and `data.phoneNumber` as possibly-absent regardless of what\n * a given realm requires, which is the correct type for code that has to\n * compile against all of them.\n */\nconst registerFormSchema = () =>\n z.object({\n firstName: z.text({ trim: true, maxLength: 100 }).optional(),\n lastName: z.text({ trim: true, maxLength: 100 }).optional(),\n username: z.text({ trim: true }).optional(),\n email: z.email().optional(),\n phoneNumber: z.e164().optional(),\n password: z.string(),\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoFA,MAAa,gBAAgB,UAA6B;CACxD,MAAM,OAAO,QAAQ;CACrB,MAAM,WAAW,UAA0B;CAC3C,MAAM,SAAS,UAAU;CACzB,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,WAAW,aAAa,OAAO,MAAM,QAAQ;CAInD,MAAM,aACJ,OAAO,OAAO,MAAM,UAAU,WAAW,OAAO,MAAM,QAAQ,KAAA;CAEhE,MAAM,CAAC,OAAO,YAAY,SAAgB,EAAE,OAAO,OAAO,CAAC;CAC3D,MAAM,CAAC,WAAW,gBAAgB,SAAS,EAAE;CAC7C,MAAM,CAAC,WAAW,gBAAgB,SAAS,EAAE;CAC7C,MAAM,CAAC,aAAa,kBAAkB,SAAwB,IAAI;CAClE,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAElD,MAAM,iBAAiB,MAAM,YAAY;CACzC,MAAM,CAAC,cAAc,mBAAmB,SAA6B;CACrE,MAAM,aAAa,OAAqC,IAAI;CAG5D,MAAM,kBAAkB,OAA2B,KAAA,CAAS;CAC5D,gBAAgB;EACd,gBAAgB,UAAU;CAC5B,GAAG,CAAC,YAAY,CAAC;CAEjB,MAAM,sBAAsB,MAAM,YAAY,sBAAsB,MACjE,OAAO,GAAG,SAAS,aACtB;CACA,MAAM,WAAW,MAAM,YAAY;CACnC,MAAM,UAAU,SAAS,wBAAwB;CAwCjD,MAAM,OAAO,QAAQ;EACnB,QAvCa,cAAc;GAa3B,MAAM,QAAQ,SAAS,sBAAsB;GAC7C,MAAM,QAAQ;IACZ,WAAW,QACP,EAAE,KAAK;KAAE,MAAM;KAAM,WAAW;IAAI,CAAC,IACrC,EAA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,EAC/C,SAAS,wBACX,CAAC;CACH,CAAC;CAGH,IAAI,MAAM,WAAW,GAAG,OAAO;CAE/B,OACE,oBAAC,MAAD;EAAI,WAAU;EACX,UAAA,MAAM,KAAK,MAAM,QAChB,qBAAC,MAAD;GAEE,WAAW,6BAA6B,KAAK,KAAK,2CAA2C;GAF/F,UAAA,CAIG,KAAK,KACJ,oBAAC,OAAD,EAAO,WAAU,WAAY,CAAA,IAE7B,oBAAC,GAAD,EAAG,WAAU,sBAAuB,CAAA,GAEtC,oBAAC,QAAD,EAAA,UAAO,KAAK,MAAY,CAAA,CACtB;EATG,GAAA,GASH,CACL;CACC,CAAA;AAER;AAEA,MAAM,aAAa,UAGb;CACJ,IAAI,CAAC,MAAM,SAAS,SAAS,OAAO;CACpC,OACE,oBAAC,OAAD;EACE,KAAK,MAAM,SAAS;EACpB,KAAK,MAAM,SAAS,eAAe,MAAM;EACzC,WAAU;CACX,CAAA;AAEL"}
1
+ {"version":3,"file":"auth-register.js","names":[],"sources":["../../../src/components/auth/auth-register.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { BrandIcon } from \"@alepha/ui/components/brand-icon/brand-icon\";\nimport {\n TurnstileWidget,\n type TurnstileWidgetHandle,\n} from \"@alepha/ui/components/captcha/turnstile-widget\";\nimport { iconFor } from \"@alepha/ui/components/control-base/icon-hint\";\nimport { Control } from \"@alepha/ui/components/control/control\";\nimport { Alert, AlertDescription } from \"@alepha/ui/components/ui/alert\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { Card, CardContent } from \"@alepha/ui/components/ui/card\";\nimport {\n InputOTP,\n InputOTPGroup,\n InputOTPSeparator,\n InputOTPSlot,\n} from \"@alepha/ui/components/ui/input-otp\";\nimport { Label } from \"@alepha/ui/components/ui/label\";\nimport { Separator } from \"@alepha/ui/components/ui/separator\";\nimport { SchemaValidationError, z } from \"alepha\";\nimport type {\n RealmConfig,\n RegistrationIntentResponse,\n UserController,\n} from \"alepha/api/users\";\nimport { useClient } from \"alepha/react\";\nimport { useAuth } from \"alepha/react/auth\";\nimport { useForm, useFormState } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useRouter } from \"alepha/react/router\";\nimport { AlertCircle, Check, Info, X } from \"lucide-react\";\nimport {\n type ReactNode,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport { safeRedirect } from \"./safe-redirect.ts\";\n\nexport interface AuthRegisterProps {\n /**\n * Realm configuration (drives required fields, verification step, OAuth buttons).\n */\n realmConfig: RealmConfig;\n /**\n * Custom logo node, rendered above the form. When provided, it replaces\n * the default `settings.logoUrl` <img>. Use this to inject a branded\n * component (e.g. with light/dark variants or an animation).\n */\n logo?: ReactNode;\n /**\n * Route to the login page. When set, a \"Sign in\" link is shown.\n */\n loginPath?: string;\n /**\n * Optional banner rendered above the registration form (form phase only).\n * Used to contextualize the flow when the user arrives via a CTA, e.g.\n * \"Before creating a campaign, create an account.\"\n */\n message?: ReactNode;\n /**\n * Where the \"Cancel\" button abandons to. Defaults to \"/\". This is\n * intentionally decoupled from the post-auth `?redirect=` target: cancelling\n * an unauthenticated registration must land somewhere public (home), not the\n * protected destination the user was *heading* to — which would only bounce\n * them back to this page.\n */\n cancelPath?: string;\n /**\n * Render the form even though `settings.registrationAllowed` is `false`.\n *\n * For a visitor the application has already vouched for out of band - an\n * invitation link, a signup code - who would otherwise meet the closed\n * alert and stop. Presentation only: the server decides, through the\n * realm's `isPreAuthorized` seam, and refuses this submit like any other if\n * {@link preAuthToken} does not hold up.\n */\n preAuthorized?: boolean;\n /**\n * Pre-fill the email field and stop it being edited.\n *\n * Set it alongside {@link preAuthToken}, which is bound to one address:\n * letting the field be typed over only produces a server-side refusal the\n * visitor cannot act on.\n */\n lockedEmail?: string;\n /**\n * The application's opaque proof that this address may register into a\n * closed realm. Passed through to the register request untouched.\n */\n preAuthToken?: string;\n /**\n * Where a successful registration lands, overriding `?redirect=`.\n *\n * A prop rather than a URL param because the submit handler is built ONCE,\n * at mount, and closes over whatever `redirect` was then: a page that\n * decides the destination and seeds the query afterwards has already\n * missed it, and the user lands on the default with nothing to explain\n * why. A prop is read on the render that builds the handler.\n *\n * Sanitised like the query value, since the two are the same kind of thing.\n */\n redirect?: string;\n}\n\ntype Phase = \"form\" | \"verification\";\n\ninterface State {\n phase: Phase;\n intent?: RegistrationIntentResponse;\n credentials?: { identifier: string; password: string };\n}\n\nexport const AuthRegister = (props: AuthRegisterProps) => {\n const auth = useAuth();\n const userCtrl = useClient<UserController>();\n const router = useRouter();\n const { tr } = useI18n();\n const redirect = safeRedirect(props.redirect ?? router.query.redirect);\n // Surface upstream auth errors (e.g. failed OAuth callback redirects with\n // `?error=...`) — same pattern as AuthLogin. Without this the user lands on\n // a fresh-looking registration page with no clue why.\n const queryError =\n typeof router.query.error === \"string\" ? router.query.error : undefined;\n\n const [state, setState] = useState<State>({ phase: \"form\" });\n const [emailCode, setEmailCode] = useState(\"\");\n const [phoneCode, setPhoneCode] = useState(\"\");\n const [verifyError, setVerifyError] = useState<string | null>(null);\n const [submitting, setSubmitting] = useState(false);\n\n const captchaSiteKey = props.realmConfig.captchaSiteKey;\n const [captchaToken, setCaptchaToken] = useState<string | undefined>();\n const captchaRef = useRef<TurnstileWidgetHandle | null>(null);\n // The handler reads the token the widget issued last through a ref, so a\n // submit never posts a token captured by an earlier render.\n const captchaTokenRef = useRef<string | undefined>(undefined);\n useEffect(() => {\n captchaTokenRef.current = captchaToken;\n }, [captchaToken]);\n\n const credentialsProvider = props.realmConfig.authenticationMethods.find(\n (it) => it.type === \"CREDENTIALS\",\n );\n const settings = props.realmConfig.settings;\n // The realm decides, unless the application has already vouched for this\n // particular visitor. Both halves are presentation: the gate is\n // `RegistrationService`, which refuses a submit that the seam does not\n // recognise however the form got rendered.\n const allowed =\n props.preAuthorized === true || settings.registrationAllowed !== false;\n\n const schema = useMemo(() => {\n // Optionality is decided as each field is built, because that is the only\n // thing the form reads: `FormModel` derives both the required marker and\n // the pre-submit check from `z.schema.requiredKeys(schema)`, which asks\n // whether the field is optional or defaulted.\n //\n // This used to declare every field optional and then push the configured\n // names onto the array returned by `z.schema.requiredKeys(s)` — a TypeBox\n // habit, where a JSON Schema's `required` was a live array hanging off the\n // schema. The zod implementation computes a fresh array from the shape, so\n // the pushes mutated a detached value and vanished: a realm with\n // `email: \"required\"` still rendered Email with no asterisk and let an\n // empty one through to the server.\n const names = settings.firstNameLastName === \"required\";\n const shape = {\n firstName: names\n ? z.text({ trim: true, maxLength: 100 })\n : z.text({ trim: true, maxLength: 100 }).optional(),\n lastName: names\n ? z.text({ trim: true, maxLength: 100 })\n : z.text({ trim: true, maxLength: 100 }).optional(),\n username:\n settings.username === \"required\"\n ? z.text({ trim: true, pattern: settings.usernameRegExp })\n : z.text({ trim: true, pattern: settings.usernameRegExp }).optional(),\n email: settings.email === \"required\" ? z.email() : z.email().optional(),\n phoneNumber:\n settings.phoneNumber === \"required\" ? z.e164() : z.e164().optional(),\n password: z.string().min(settings.passwordPolicy?.minLength ?? 8),\n };\n\n // The runtime shape varies with the realm, but the *type* must not: every\n // consumer below reads `data.email`, `data.username` and the rest as\n // possibly-absent. Widening to the all-optional shape keeps one stable\n // type instead of a union of eight.\n return z.object(shape) as unknown as ReturnType<typeof registerFormSchema>;\n }, [settings]);\n\n const form = useForm({\n schema,\n // A locked address is the form's starting value, not a field the visitor\n // fills. It arrives before mount (the page resolves the token in its\n // loader), which is what lets `useForm` anchor it here.\n initialValues: props.lockedEmail\n ? ({ email: props.lockedEmail } as never)\n : undefined,\n handler: async (data) => {\n try {\n const intent = await userCtrl.createRegistrationIntent({\n query: { userRealmName: props.realmConfig.realmName },\n body: {\n firstName: data.firstName,\n lastName: data.lastName,\n username: data.username,\n // The locked address wins over whatever the field holds: it is\n // the one the token is bound to, and a disabled input is a\n // presentation fact rather than a guarantee.\n email: props.lockedEmail ?? data.email,\n phoneNumber: data.phoneNumber,\n password: data.password,\n captchaToken: captchaSiteKey ? captchaTokenRef.current : undefined,\n preAuthToken: props.preAuthToken,\n },\n });\n const identifier =\n data.username ?? props.lockedEmail ?? data.email ?? data.phoneNumber;\n if (\n intent.expectEmailVerification ||\n intent.expectPhoneVerification ||\n intent.expectCaptcha\n ) {\n setState({\n phase: \"verification\",\n intent,\n credentials: identifier\n ? { identifier, password: data.password }\n : undefined,\n });\n return;\n }\n await userCtrl.createUserFromIntent({\n body: { intentId: intent.intentId },\n });\n if (identifier && credentialsProvider) {\n await auth.login(credentialsProvider.name, {\n username: identifier,\n password: data.password,\n realm: props.realmConfig.realmName,\n });\n }\n // `force: true` so parent-layout loaders re-run against the freshly\n // authenticated user — see the note in auth-login.tsx.\n await router.push(redirect, { force: true });\n } catch (err) {\n // Turnstile tokens are single-use — force a fresh challenge so the\n // user can retry after a server-side failure.\n captchaRef.current?.reset();\n throw err;\n }\n },\n });\n\n const formState = useFormState(form, [\"error\", \"values\", \"loading\"]);\n const formError =\n formState.error && !(formState.error instanceof SchemaValidationError)\n ? formState.error.message\n : undefined;\n const passwordValue = String(formState.values?.password ?? \"\");\n\n const firstFieldId =\n (settings.firstNameLastName !== \"none\" && form.input.firstName?.props.id) ||\n (settings.username !== \"none\" &&\n settings.username !== \"email\" &&\n form.input.username?.props.id) ||\n (settings.email !== \"none\" && form.input.email?.props.id) ||\n (settings.phoneNumber !== \"none\" && form.input.phoneNumber?.props.id) ||\n form.input.password.props.id;\n\n useEffect(() => {\n if (state.phase !== \"form\" || !firstFieldId) return;\n const el = document.getElementById(\n String(firstFieldId),\n ) as HTMLInputElement | null;\n el?.focus();\n }, [state.phase, firstFieldId]);\n\n const handleVerify = async () => {\n if (!state.intent) return;\n setSubmitting(true);\n setVerifyError(null);\n try {\n await userCtrl.createUserFromIntent({\n body: {\n intentId: state.intent.intentId,\n emailCode: state.intent.expectEmailVerification\n ? emailCode\n : undefined,\n phoneCode: state.intent.expectPhoneVerification\n ? phoneCode\n : undefined,\n },\n });\n if (state.credentials && credentialsProvider) {\n await auth.login(credentialsProvider.name, {\n username: state.credentials.identifier,\n password: state.credentials.password,\n realm: props.realmConfig.realmName,\n });\n }\n // `force: true` so parent-layout loaders re-run against the freshly\n // authenticated user — see the note in auth-login.tsx.\n await router.push(redirect, { force: true });\n } catch (err) {\n setVerifyError(\n err instanceof Error\n ? err.message\n : tr(\"auth.register.verifyFailed\", {\n default: \"Verification failed\",\n }),\n );\n } finally {\n setSubmitting(false);\n }\n };\n\n // Query appended to the \"already have an account? sign in\" link: the realm,\n // plus the post-auth redirect (`?redirect=`) so signing in returns the user\n // to wherever registering would have sent them (it's dropped otherwise).\n const realmBit = props.realmConfig.realmName\n ? `realm=${encodeURIComponent(props.realmConfig.realmName)}`\n : \"\";\n const redirectBit =\n typeof router.query.redirect === \"string\" && router.query.redirect\n ? `redirect=${encodeURIComponent(router.query.redirect)}`\n : \"\";\n const loginQ = [realmBit, redirectBit].filter(Boolean).join(\"&\");\n const realmQuery = loginQ ? `?${loginQ}` : \"\";\n\n const externalMethods = props.realmConfig.authenticationMethods.filter(\n (m) => m.type !== \"CREDENTIALS\",\n );\n const showDivider = credentialsProvider && externalMethods.length > 0;\n const isVerifying = state.phase === \"verification\" && state.intent;\n const canSubmitVerify =\n !isVerifying ||\n ((!state.intent!.expectEmailVerification || emailCode.length === 6) &&\n (!state.intent!.expectPhoneVerification || phoneCode.length === 6));\n\n const contentRef = useRef<HTMLDivElement>(null);\n const [contentHeight, setContentHeight] = useState<number | undefined>(\n undefined,\n );\n useLayoutEffect(() => {\n const el = contentRef.current;\n if (!el) return;\n setContentHeight(el.scrollHeight);\n const ro = new ResizeObserver(() => {\n setContentHeight(el.scrollHeight);\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n return (\n <Centered>\n {props.logo ?? (\n <RealmLogo\n settings={settings}\n realmName={props.realmConfig.realmName}\n />\n )}\n <Card className=\"w-full\">\n <CardContent\n className=\"overflow-hidden p-0 transition-[height] duration-300 ease-out\"\n style={\n contentHeight !== undefined ? { height: contentHeight } : undefined\n }\n >\n <div ref={contentRef}>\n <div\n key={state.phase}\n className=\"animate-in fade-in flex flex-col gap-4 px-6 duration-300\"\n >\n {isVerifying ? (\n <>\n <h2 className=\"text-center text-lg font-semibold\">\n {tr(\"auth.register.verifyTitle\", {\n default: \"Verify your account\",\n })}\n </h2>\n <p className=\"text-muted-foreground text-center text-sm\">\n {tr(\"auth.register.verifyHint\", {\n default:\n \"Please enter the verification code(s) sent to you.\",\n })}\n </p>\n {verifyError && (\n <Alert variant=\"destructive\">\n <AlertCircle className=\"size-4\" />\n <AlertDescription>{verifyError}</AlertDescription>\n </Alert>\n )}\n {state.intent!.expectEmailVerification && (\n <div className=\"flex flex-col items-center gap-2\">\n <Label htmlFor=\"emailCode\">\n {tr(\"auth.register.emailCode\", {\n default: \"Email verification code\",\n })}\n </Label>\n <InputOTP\n id=\"emailCode\"\n maxLength={6}\n autoComplete=\"one-time-code\"\n\n value={emailCode}\n onChange={setEmailCode}\n >\n <InputOTPGroup>\n <InputOTPSlot index={0} />\n <InputOTPSlot index={1} />\n <InputOTPSlot index={2} />\n </InputOTPGroup>\n <InputOTPSeparator />\n <InputOTPGroup>\n <InputOTPSlot index={3} />\n <InputOTPSlot index={4} />\n <InputOTPSlot index={5} />\n </InputOTPGroup>\n </InputOTP>\n </div>\n )}\n {state.intent!.expectPhoneVerification && (\n <div className=\"flex flex-col items-center gap-2\">\n <Label htmlFor=\"phoneCode\">\n {tr(\"auth.register.phoneCode\", {\n default: \"Phone verification code\",\n })}\n </Label>\n <InputOTP\n id=\"phoneCode\"\n maxLength={6}\n autoComplete=\"one-time-code\"\n\n value={phoneCode}\n onChange={setPhoneCode}\n >\n <InputOTPGroup>\n <InputOTPSlot index={0} />\n <InputOTPSlot index={1} />\n <InputOTPSlot index={2} />\n </InputOTPGroup>\n <InputOTPSeparator />\n <InputOTPGroup>\n <InputOTPSlot index={3} />\n <InputOTPSlot index={4} />\n <InputOTPSlot index={5} />\n </InputOTPGroup>\n </InputOTP>\n </div>\n )}\n <Button\n onClick={handleVerify}\n loading={submitting}\n disabled={!canSubmitVerify}\n >\n {tr(\"auth.register.verifySubmit\", {\n default: \"Complete registration\",\n })}\n </Button>\n <Button\n variant=\"ghost\"\n onClick={() => setState({ phase: \"form\" })}\n >\n {tr(\"auth.register.verifyBack\", {\n default: \"Back to registration\",\n })}\n </Button>\n </>\n ) : (\n <FormPhase\n allowed={allowed}\n form={form}\n formError={formError ?? queryError}\n loading={formState.loading}\n passwordValue={passwordValue}\n settings={settings}\n realmName={props.realmConfig.realmName}\n credentialsProvider={credentialsProvider}\n externalMethods={externalMethods}\n showDivider={showDivider}\n redirect={redirect}\n loginPath={props.loginPath}\n realmQuery={realmQuery}\n auth={auth}\n captchaSiteKey={captchaSiteKey}\n captchaToken={captchaToken}\n captchaRef={captchaRef}\n onCaptchaToken={setCaptchaToken}\n message={props.message}\n lockedEmail={props.lockedEmail}\n />\n )}\n </div>\n </div>\n </CardContent>\n </Card>\n {!isVerifying && (\n <Button\n variant=\"ghost\"\n nativeButton={false}\n render={<a href={props.cancelPath ?? \"/\"} />}\n >\n {tr(\"auth.register.cancel\", { default: \"Cancel\" })}\n </Button>\n )}\n </Centered>\n );\n};\n\nconst FormPhase = (props: {\n allowed: boolean;\n form: ReturnType<typeof useForm>;\n formError: string | undefined;\n loading: boolean;\n passwordValue: string;\n settings: RealmConfig[\"settings\"];\n realmName: string;\n credentialsProvider: any;\n externalMethods: Array<{ name: string; type: string }>;\n showDivider: boolean | undefined;\n redirect: string;\n loginPath: string | undefined;\n realmQuery: string;\n auth: ReturnType<typeof useAuth>;\n captchaSiteKey?: string;\n captchaToken?: string;\n captchaRef: React.RefObject<TurnstileWidgetHandle | null>;\n onCaptchaToken: (token: string | undefined) => void;\n message?: ReactNode;\n lockedEmail?: string;\n}) => {\n const { tr } = useI18n();\n const [passwordFieldFocused, setPasswordFieldFocused] = useState(false);\n const {\n allowed,\n form,\n formError,\n passwordValue,\n settings,\n credentialsProvider,\n externalMethods,\n showDivider,\n redirect,\n realmQuery,\n } = props;\n return (\n <>\n <RealmHeader settings={settings} realmName={props.realmName} />\n {!allowed ? (\n <>\n <Alert>\n <AlertCircle className=\"size-4\" />\n <AlertDescription>\n {tr(\"auth.register.disabled\", {\n default:\n \"Registration is not available. Please contact your administrator.\",\n })}\n </AlertDescription>\n </Alert>\n <Button\n render={\n <a href={`${props.loginPath ?? \"/auth/login\"}${realmQuery}`} />\n }\n >\n {tr(\"auth.register.backToSignIn\", { default: \"Back to sign in\" })}\n </Button>\n </>\n ) : (\n <>\n {props.message && (\n <Alert>\n <Info className=\"size-4\" />\n <AlertDescription>{props.message}</AlertDescription>\n </Alert>\n )}\n {formError && (\n <Alert variant=\"destructive\">\n <AlertCircle className=\"size-4\" />\n <AlertDescription>{formError}</AlertDescription>\n </Alert>\n )}\n {credentialsProvider && (\n <form {...form.props} className=\"flex flex-col gap-4\">\n {settings.firstNameLastName !== \"none\" &&\n form.input.firstName &&\n form.input.lastName && (\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <Control\n label={tr(\"auth.register.firstName\", {\n default: \"First name\",\n })}\n input={form.input.firstName}\n autoComplete=\"given-name\"\n />\n <Control\n label={tr(\"auth.register.lastName\", {\n default: \"Last name\",\n })}\n input={form.input.lastName}\n autoComplete=\"family-name\"\n />\n </div>\n )}\n {settings.username !== \"none\" &&\n settings.username !== \"email\" &&\n form.input.username && (\n <Control\n label={tr(\"auth.register.username\", {\n default: \"Username\",\n })}\n input={form.input.username}\n icon={iconFor(\"user\")}\n autoComplete=\"username\"\n />\n )}\n {settings.email !== \"none\" && form.input.email && (\n <Control\n label={tr(\"auth.register.email\", { default: \"Email\" })}\n description={\n props.lockedEmail\n ? tr(\"auth.register.email.locked\", {\n default: \"This is the address you were invited with.\",\n })\n : settings.verifyEmailRequired\n ? tr(\"auth.register.email.verify\", {\n default:\n \"We'll send a verification code to confirm your email.\",\n })\n : undefined\n }\n input={form.input.email}\n icon={iconFor(\"email\")}\n // Locked, not hidden: the visitor has to be able to see\n // which address they are about to create an account for,\n // and it is often not the one they would have typed. The\n // value lives in the form model rather than the DOM, so\n // disabling the input does not drop it from the submit.\n disabled={!!props.lockedEmail}\n />\n )}\n {settings.phoneNumber !== \"none\" && form.input.phoneNumber && (\n <Control\n label={tr(\"auth.register.phone\", {\n default: \"Phone number\",\n })}\n description={\n settings.verifyPhoneRequired\n ? tr(\"auth.register.phone.verify\", {\n default:\n \"We'll send a verification code to confirm your phone number.\",\n })\n : undefined\n }\n input={form.input.phoneNumber}\n icon={iconFor(\"phone\")}\n />\n )}\n {/* `onFocus`/`onBlur` bubble from the input + toggle inside —\n the rules stay visible while the user types or interacts\n with the password toggle, and only collapse once the field\n is blurred AND empty. */}\n <div\n onFocus={() => setPasswordFieldFocused(true)}\n onBlur={() => setPasswordFieldFocused(false)}\n >\n <Control\n label={tr(\"auth.register.password\", { default: \"Password\" })}\n input={form.input.password}\n password\n autoComplete=\"new-password\"\n />\n </div>\n {(passwordFieldFocused || passwordValue.length > 0) && (\n <PasswordRules\n policy={settings.passwordPolicy}\n value={passwordValue}\n />\n )}\n {props.captchaSiteKey && (\n <TurnstileWidget\n ref={props.captchaRef}\n siteKey={props.captchaSiteKey}\n onToken={props.onCaptchaToken}\n className=\"flex justify-center\"\n />\n )}\n <Button\n type=\"submit\"\n loading={props.loading}\n disabled={!!props.captchaSiteKey && !props.captchaToken}\n >\n {tr(\"auth.register.submit\", { default: \"Create account\" })}\n </Button>\n </form>\n )}\n {showDivider && (\n <div className=\"flex items-center gap-3\">\n <Separator className=\"flex-1\" />\n <span className=\"text-muted-foreground text-xs\">\n {tr(\"auth.register.or\", { default: \"OR\" })}\n </span>\n <Separator className=\"flex-1\" />\n </div>\n )}\n {externalMethods.map((method) => {\n const provider =\n method.name.charAt(0).toUpperCase() + method.name.slice(1);\n return (\n <Button\n key={method.name}\n variant=\"outline\"\n onClick={() =>\n props.auth.login(method.name as never, {\n redirect,\n realm: props.realmName,\n })\n }\n >\n <BrandIcon provider={method.name} />\n {tr(\"auth.register.continueWith\", {\n default: `Continue with ${provider}`,\n args: [provider],\n })}\n </Button>\n );\n })}\n <p className=\"text-muted-foreground text-center text-sm\">\n {tr(\"auth.register.haveAccount\", {\n default: \"Already have an account?\",\n })}{\" \"}\n <a\n href={`${props.loginPath ?? \"/auth/login\"}${realmQuery}`}\n className=\"text-foreground underline-offset-4 hover:underline\"\n >\n {tr(\"auth.register.signIn\", { default: \"Sign in\" })}\n </a>\n </p>\n </>\n )}\n </>\n );\n};\n\nconst Centered = (props: { children: React.ReactNode }) => {\n return (\n <div className=\"flex min-h-svh flex-1 items-center justify-center p-6\">\n <div className=\"flex w-full max-w-sm flex-col items-center gap-4\">\n {props.children}\n </div>\n </div>\n );\n};\n\nconst RealmHeader = (props: {\n settings: RealmConfig[\"settings\"];\n realmName: string;\n}) => {\n const s = props.settings;\n if (!s.displayName && !s.description) return null;\n return (\n <div className=\"flex flex-col items-center gap-1\">\n {s.displayName && (\n <h2 className=\"text-center text-lg font-semibold\">{s.displayName}</h2>\n )}\n {s.description && (\n <p className=\"text-muted-foreground text-center text-sm\">\n {s.description}\n </p>\n )}\n </div>\n );\n};\n\nconst PasswordRules = (props: {\n policy: RealmConfig[\"settings\"][\"passwordPolicy\"];\n value: string;\n}) => {\n const { tr } = useI18n();\n const policy = props.policy;\n const value = props.value;\n\n const rules: { ok: boolean; label: string }[] = [];\n\n if (policy?.minLength && policy.minLength > 0) {\n rules.push({\n ok: value.length >= policy.minLength,\n label: tr(\"auth.register.password.rule.minLength\", {\n default: `At least ${policy.minLength} characters`,\n args: [String(policy.minLength)],\n }),\n });\n }\n if (policy?.requireUppercase) {\n rules.push({\n ok: /[A-Z]/.test(value),\n label: tr(\"auth.register.password.rule.uppercase\", {\n default: \"One uppercase letter\",\n }),\n });\n }\n if (policy?.requireLowercase) {\n rules.push({\n ok: /[a-z]/.test(value),\n label: tr(\"auth.register.password.rule.lowercase\", {\n default: \"One lowercase letter\",\n }),\n });\n }\n if (policy?.requireNumbers) {\n rules.push({\n ok: /[0-9]/.test(value),\n label: tr(\"auth.register.password.rule.number\", {\n default: \"One number\",\n }),\n });\n }\n if (policy?.requireSpecialCharacters) {\n rules.push({\n ok: /[^A-Za-z0-9]/.test(value),\n label: tr(\"auth.register.password.rule.special\", {\n default: \"One special character\",\n }),\n });\n }\n\n if (rules.length === 0) return null;\n\n return (\n <ul className=\"text-muted-foreground -mt-2 flex flex-col gap-1 text-xs\">\n {rules.map((rule, idx) => (\n <li\n key={idx}\n className={`flex items-center gap-1.5 ${rule.ok ? \"text-emerald-600 dark:text-emerald-400\" : \"\"}`}\n >\n {rule.ok ? (\n <Check className=\"size-3.5\" />\n ) : (\n <X className=\"size-3.5 opacity-50\" />\n )}\n <span>{rule.label}</span>\n </li>\n ))}\n </ul>\n );\n};\n\nconst RealmLogo = (props: {\n settings: RealmConfig[\"settings\"];\n realmName: string;\n}) => {\n if (!props.settings.logoUrl) return null;\n return (\n <img\n src={props.settings.logoUrl}\n alt={props.settings.displayName || props.realmName}\n className=\"bg-muted size-16 rounded-xl border object-cover shadow-sm\"\n />\n );\n};\n\n/**\n * The reference shape of the registration form, with every configurable field\n * optional.\n *\n * `AuthRegister` builds its real schema from the realm settings, so which\n * fields are optional changes per realm. This exists purely to give that\n * schema one stable TypeScript type: the handler reads `data.email`,\n * `data.username` and `data.phoneNumber` as possibly-absent regardless of what\n * a given realm requires, which is the correct type for code that has to\n * compile against all of them.\n */\nconst registerFormSchema = () =>\n z.object({\n firstName: z.text({ trim: true, maxLength: 100 }).optional(),\n lastName: z.text({ trim: true, maxLength: 100 }).optional(),\n username: z.text({ trim: true }).optional(),\n email: z.email().optional(),\n phoneNumber: z.e164().optional(),\n password: z.string(),\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuHA,MAAa,gBAAgB,UAA6B;CACxD,MAAM,OAAO,QAAQ;CACrB,MAAM,WAAW,UAA0B;CAC3C,MAAM,SAAS,UAAU;CAC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E/B,OACE,oBAAC,MAAD;EAAI,WAAU;EACX,UAAA,MAAM,KAAK,MAAM,QAChB,qBAAC,MAAD;GAEE,WAAW,6BAA6B,KAAK,KAAK,2CAA2C;GAF/F,UAAA,CAIG,KAAK,KACJ,oBAAC,OAAD,EAAO,WAAU,WAAY,CAAA,IAE7B,oBAAC,GAAD,EAAG,WAAU,sBAAuB,CAAA,GAEtC,oBAAC,QAAD,EAAA,UAAO,KAAK,MAAY,CAAA,CACtB;EATG,GAAA,GASH,CACL;CACC,CAAA;AAER;AAEA,MAAM,aAAa,UAGb;CACJ,IAAI,CAAC,MAAM,SAAS,SAAS,OAAO;CACpC,OACE,oBAAC,OAAD;EACE,KAAK,MAAM,SAAS;EACpB,KAAK,MAAM,SAAS,eAAe,MAAM;EACzC,WAAU;CACX,CAAA;AAEL"}
@@ -253,25 +253,28 @@ const GroupBlock = (props) => {
253
253
  }).filter(Boolean);
254
254
  if (!items.length && !props.multiGroup && !props.bottomBar) return null;
255
255
  const isNaked = !group.title && !Icon;
256
- if (props.layout === "row") return /* @__PURE__ */ jsxs("div", { children: [!!(group.title || group.description) && /* @__PURE__ */ jsxs("div", {
257
- className: "mb-2 flex items-start gap-2",
258
- children: [Icon && /* @__PURE__ */ jsx(Icon, { className: "text-muted-foreground mt-0.5 size-4 shrink-0" }), /* @__PURE__ */ jsx(SettingsHeading, {
259
- title: group.title,
260
- description: group.description
261
- })]
262
- }), /* @__PURE__ */ jsxs("div", {
263
- className: "bg-card divide-y rounded-lg border shadow-sm",
264
- children: [items.map((it) => /* @__PURE__ */ jsx(Control, {
265
- input: it.input,
266
- ...it.props,
267
- disabled: props.disabled || it.props.disabled
268
- }, it.name)), props.bottomBar && /* @__PURE__ */ jsx("div", {
269
- className: "px-4 py-3",
270
- children: props.bottomBar
256
+ if (props.layout === "row") return /* @__PURE__ */ jsxs("div", {
257
+ className: "shrink-0",
258
+ children: [!!(group.title || group.description) && /* @__PURE__ */ jsxs("div", {
259
+ className: "mb-2 flex items-start gap-2",
260
+ children: [Icon && /* @__PURE__ */ jsx(Icon, { className: "text-muted-foreground mt-0.5 size-4 shrink-0" }), /* @__PURE__ */ jsx(SettingsHeading, {
261
+ title: group.title,
262
+ description: group.description
263
+ })]
264
+ }), /* @__PURE__ */ jsxs("div", {
265
+ className: "bg-card divide-y rounded-lg border shadow-sm",
266
+ children: [items.map((it) => /* @__PURE__ */ jsx(Control, {
267
+ input: it.input,
268
+ ...it.props,
269
+ disabled: props.disabled || it.props.disabled
270
+ }, it.name)), props.bottomBar && /* @__PURE__ */ jsx("div", {
271
+ className: "px-4 py-3",
272
+ children: props.bottomBar
273
+ })]
271
274
  })]
272
- })] });
275
+ });
273
276
  return /* @__PURE__ */ jsxs("div", {
274
- className: props.multiGroup && !isNaked ? "border rounded-md overflow-hidden" : "",
277
+ className: cn("shrink-0", props.multiGroup && !isNaked && "overflow-hidden rounded-md border"),
275
278
  children: [props.multiGroup && !isNaked && /* @__PURE__ */ jsxs("div", {
276
279
  className: "bg-muted/40 flex items-center gap-2 border-b px-3 py-2",
277
280
  children: [Icon && /* @__PURE__ */ jsx(Icon, { className: "text-muted-foreground size-4" }), group.title && /* @__PURE__ */ jsx("span", {
@@ -1 +1 @@
1
- {"version":3,"file":"auto-form.js","names":[],"sources":["../../../src/components/auto-form/auto-form.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport {\n FormFieldAutoSaveProvider,\n FormFieldLayoutProvider,\n FormFieldRequiredMarkerProvider,\n} from \"@alepha/ui/components/control-base/form-field\";\nimport { spanClass, widthFor } from \"@alepha/ui/components/control-base/grid\";\nimport { iconFor } from \"@alepha/ui/components/control-base/icon-hint\";\nimport {\n Control,\n type ControlProps,\n} from \"@alepha/ui/components/control/control\";\nimport { SettingsHeading } from \"@alepha/ui/components/settings/settings-heading\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardTitle,\n} from \"@alepha/ui/components/ui/card\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@alepha/ui/components/ui/popover\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport { type ZObject, type ZType, z } from \"alepha\";\nimport { useAlepha } from \"alepha/react\";\nimport {\n type BaseInputField,\n type FormModel,\n isObjectOrUnionOfObjects,\n useFormState,\n} from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { AlertCircle, X } from \"lucide-react\";\nimport { type ReactNode, useEffect, useMemo, useState } from \"react\";\n\n/**\n * Detect a `z.string()` schema (incl. optional/nullable wrappers) so the\n * auto-save effect can skip keystroke commits on text fields.\n */\nfunction isStringSchema(schema: unknown): boolean {\n if (!schema || typeof schema !== \"object\") return false;\n // Zod, not JSON Schema: `z.string().optional()` has no `type: \"string\"`,\n // so the optional text fields of a form used to auto-save every keystroke.\n const inner = z.schema.unwrap(schema as ZType);\n if (z.schema.isString(inner)) return true;\n if (z.schema.isUnion(inner)) {\n return z.schema.options(inner).some(isStringSchema);\n }\n return false;\n}\n\n/**\n * Detect an enum schema (incl. optional/nullable wrappers). Enum fields\n * render as a `<Select>`, so they must auto-commit on change like any\n * other select — never get lumped in with free-text string fields.\n */\nfunction isEnumSchema(schema: unknown): boolean {\n if (!schema || typeof schema !== \"object\") return false;\n const inner = z.schema.unwrap(schema as ZType);\n if (z.schema.isEnum(inner)) return true;\n if (z.schema.isUnion(inner)) {\n return z.schema.options(inner).some(isEnumSchema);\n }\n return false;\n}\n\n/**\n * Resolve the effective `<Control>` config for a field, merging the\n * `fields` map with any per-field override carried on a `groups` entry —\n * the same precedence `GroupBlock` applies when rendering.\n */\nfunction resolveControlConfig(\n name: string,\n fields: Record<string, unknown> | undefined,\n groups: AutoFormGroup[] | undefined,\n): Record<string, unknown> {\n const fromMap = (fields?.[name] as Record<string, unknown>) ?? {};\n let fromGroup: Record<string, unknown> = {};\n for (const group of groups ?? []) {\n for (const field of group.fields) {\n if (typeof field === \"object\" && field.name === name) {\n fromGroup = field as Record<string, unknown>;\n }\n }\n }\n return { ...fromMap, ...fromGroup };\n}\n\nexport interface AutoFormGroup {\n /**\n * Group title shown in the header.\n */\n title?: string;\n /**\n * One line under the title, for context the fields should not each repeat.\n *\n * Only rendered in `layout=\"row\"`, where the heading sits above the card\n * and there is room for it — the boxed group bar the grid layout uses is a\n * single line by construction.\n */\n description?: string;\n /**\n * Icon name (lucide) for the group header.\n */\n icon?: string;\n /**\n * Visibility predicate. Group is omitted when this returns false.\n */\n can?: () => boolean;\n /**\n * Field names from the form schema. Each renders as a `<Control>`.\n * Use the object form `{ name, ...controlProps }` for per-field overrides\n * (width, icon, custom, etc.).\n */\n fields: Array<\n string | (Partial<Omit<ControlProps, \"input\">> & { name: string })\n >;\n}\n\nexport interface AutoFormAction {\n label: string;\n icon?: string;\n variant?: \"default\" | \"outline\" | \"ghost\" | \"destructive\" | \"secondary\";\n onClick: () => void | Promise<void>;\n disabled?: boolean;\n}\n\nexport interface AutoFormProps<T extends ZObject> {\n /**\n * Form model returned by `useForm()`. The schema drives every field.\n */\n form: FormModel<T>;\n\n /**\n * Header icon (lucide name).\n */\n icon?: string;\n /**\n * Header title.\n */\n title?: string;\n /**\n * Header description / subtitle.\n */\n description?: string;\n /**\n * Extra content rendered on the right of the header (e.g. a status badge).\n * In `card` mode it renders as the `CardAction`; otherwise it is pushed to\n * the right edge of the header box.\n */\n headerAction?: ReactNode;\n\n /**\n * Manual layout: list of groups, each with its own fields.\n * If neither `groups` nor `autoGroup` is set, every top-level schema\n * field is rendered in a single ungrouped column.\n */\n groups?: AutoFormGroup[];\n\n /**\n * Auto-group: scan the schema, primitive fields land in a \"General\"\n * group, each object/array-of-objects becomes its own group.\n */\n autoGroup?: boolean | { defaultTitle?: string; defaultIcon?: string };\n\n /**\n * Per-field control overrides keyed by field name (also works without groups).\n */\n fields?: Partial<\n Record<keyof T[\"shape\"] & string, Partial<Omit<ControlProps, \"input\">>>\n >;\n\n /**\n * Localize field labels the schema doesn't carry. When set, each field's\n * label is resolved from the app dictionary via\n * `tr(\\`${i18nPrefix}.${fieldName}\\`)` and its description via\n * `tr(\\`${i18nPrefix}.${fieldName}.desc\\`)`, falling back to the\n * schema-derived label/description when the key is absent. Lets a generic\n * AutoForm (e.g. the parameters admin, whose schemas rarely set `title`)\n * render translated labels without per-schema annotations. Explicit\n * `fields[name].label` overrides still win.\n */\n i18nPrefix?: string;\n\n /**\n * Submit button label.\n */\n submitLabel?: string;\n /**\n * Hide built-in submit button.\n */\n noSubmit?: boolean;\n /**\n * Disable submit when form is pristine (not dirty).\n */\n disabledIfPristine?: boolean;\n /**\n * Disable the entire form (cascades to controls).\n */\n disabled?: boolean;\n\n /**\n * Show the red `*` next to the label of every required field.\n *\n * Set `false` on a form where the marker is not news — one whose fields are\n * nearly all required, or where the one required field is self-evidently so\n * (a project's Name). A page of asterisks tells the reader nothing about\n * which field to be careful with, which is the only thing the marker is for.\n *\n * Purely visual. `aria-required` still comes from the schema, so a screen\n * reader announces the field as required either way — the marker itself is\n * `aria-hidden` and never carried that.\n *\n * @default true\n */\n requiredMarker?: boolean;\n\n /**\n * Cancel button — hidden when omitted.\n */\n onCancel?: () => void;\n /**\n * Skip the reset button in the bottom bar.\n */\n skipReset?: boolean;\n /**\n * Skip the entire bottom bar.\n */\n skipBottomBar?: boolean;\n\n /**\n * Extra action buttons in the bottom bar (left side).\n */\n actions?: AutoFormAction[];\n\n /**\n * Extra content rendered above the bottom bar.\n */\n footer?: ReactNode;\n\n /**\n * Extra classes applied to the form wrapper.\n */\n className?: string;\n\n /**\n * Override the column classes of each field group's grid. By default fields\n * lay out on a fixed 12-column grid and each field's span is derived from\n * width heuristics (`$control.width`, type, …).\n *\n * Pass responsive column classes — e.g.\n * `\"grid-cols-1 md:grid-cols-2 xl:grid-cols-3\"` — to get N equal columns per\n * breakpoint instead; when set, every field occupies a single cell and the\n * per-field width heuristics are ignored.\n */\n gridClassName?: string;\n\n /**\n * Wrap the form in a `<Card>`:\n * - the header (icon + title/description) renders as the `CardHeader`,\n * - the field groups render as the `CardContent`,\n * - the action bar (cancel / reset / actions / submit) renders as the\n * `CardFooter`.\n *\n * When omitted, the form uses its default chrome (a muted header box and a\n * standalone bottom bar). The footer is hidden in `autoSave` mode just like\n * the default bottom bar.\n *\n * Pass a string to override the `<Card>` className (e.g. `\"rounded-none\"` to\n * make the card sit flush against neighbouring panes).\n */\n card?: boolean | string;\n\n /**\n * Fill the available height: the card stretches to `100%` of its container\n * and the body (field groups) scrolls while the header and footer stay\n * pinned. Only meaningful in `card` mode.\n */\n fill?: boolean;\n\n /**\n * Visual layout for every nested Control.\n * - `\"stack\"` (default): label on top, control below — the classic form look.\n * - `\"row\"`: settings-style — each control sits on its own line with the\n * label/description on the left and the control on the right. Each\n * group renders as a bordered card with horizontal dividers.\n *\n * `\"row\"` **is** the settings-card shape, not an approximation of it: the\n * rows render the same markup as {@link SettingsRow}, the card the same as\n * {@link SettingsSection}, the heading through the same\n * {@link SettingsHeading}, and the action bar as the card's own last\n * divided row. So a settings card whose rows are form fields should be an\n * `AutoForm`, and reach for `SettingsSection` only for the rows that are\n * *not* fields — an avatar picker, a read-only value, a lone button.\n */\n layout?: \"stack\" | \"row\";\n\n /**\n * Auto-commit edits instead of showing a Save button.\n *\n * When enabled, every field change schedules a debounced `form.submit()`\n * and the bottom bar is hidden by default. Pass an options object to\n * customize the debounce delay (default 600ms).\n *\n * The `handler` you pass to `useForm` is the auto-commit target — it\n * runs once per quiescent edit, and any thrown error stops the loop\n * until the user edits again.\n */\n autoSave?: boolean | { delay?: number };\n}\n\n/**\n * Schema-driven form with optional grouping, header chrome, and bottom\n * bar. Every input field is resolved through `<Control>`, so schemas\n * carrying `$control` metadata configure themselves.\n */\nexport function AutoForm<T extends ZObject>(props: AutoFormProps<T>) {\n const { tr } = useI18n();\n const { dirty, loading } = useFormState(props.form, [\"dirty\", \"loading\"]);\n const inputs = props.form.input as Record<string, never>;\n\n // `z.object({})` rather than a hand-made `{ properties: {} }`: the latter\n // only ever worked because a prototype alias made `.properties` readable on\n // a schema, so a fake object with that key passed for one.\n const schema = (props.form.options.schema as ZObject) ?? z.object({});\n\n // ── Auto-save ─────────────────────────────────────────────────────\n // Text fields (string) are intentionally excluded: typing should not commit\n // on every keystroke. They commit via Enter (native submit) or the inline\n // tick button. Booleans / selects / uploads / etc. auto-commit on change.\n const autoSave = props.autoSave;\n const autoSaveDelay =\n typeof autoSave === \"object\" ? (autoSave?.delay ?? 600) : 600;\n const autoSaveEnabled = !!autoSave;\n const alepha = useAlepha();\n useEffect(() => {\n if (!autoSaveEnabled) return;\n let handle: ReturnType<typeof setTimeout> | undefined;\n const off = alepha.events.on(\"form:change\", (ev) => {\n if (ev.id !== props.form.id) return;\n if (ev.initial) return;\n // FormModel paths look like \"/title\" or \"/contacts/0/email\". The\n // top-level key is the first segment after the leading slash.\n const top = ev.path.replace(/^\\//, \"\").split(\"/\")[0];\n const fieldSchema = z.schema.shape(schema)[top];\n const fieldConfig = resolveControlConfig(\n top,\n props.fields as Record<string, unknown> | undefined,\n props.groups,\n );\n // Text fields (incl. optional/nullable wrappers) should NOT auto-commit\n // on keystroke; they commit via Enter or the inline tick button.\n // Uploads commit a uuid string when the upload finishes, and selects /\n // comboboxes / segmented controls commit a discrete value on change —\n // all of those MUST auto-save even though the field schema is a string.\n const rendersAsSelect =\n !!fieldConfig.select ||\n !!fieldConfig.combobox ||\n !!fieldConfig.segmented ||\n fieldConfig.items != null ||\n isEnumSchema(fieldSchema);\n if (\n !fieldConfig.upload &&\n !rendersAsSelect &&\n isStringSchema(fieldSchema)\n )\n return;\n if (handle) clearTimeout(handle);\n handle = setTimeout(() => props.form.submit(), autoSaveDelay);\n });\n return () => {\n off();\n if (handle) clearTimeout(handle);\n };\n }, [\n alepha,\n autoSaveEnabled,\n autoSaveDelay,\n props.form,\n props.fields,\n props.groups,\n schema,\n ]);\n const skipBottomBar = props.skipBottomBar ?? autoSaveEnabled;\n\n const resolvedGroups: AutoFormGroup[] = useMemo(() => {\n if (props.groups) return props.groups.filter((g) => g.can?.() !== false);\n if (props.autoGroup) {\n const opts = typeof props.autoGroup === \"object\" ? props.autoGroup : {};\n return autoGroupSchema(schema, { tr, ...opts });\n }\n return [\n {\n fields: Object.keys(z.schema.shape(schema)),\n },\n ];\n }, [props.groups, props.autoGroup, schema]);\n\n const HeaderIcon = props.icon ? iconFor(props.icon) : undefined;\n const hasHeader = !!(\n props.title ||\n props.description ||\n HeaderIcon ||\n props.headerAction\n );\n\n const layout = props.layout ?? \"stack\";\n\n const bottomBarProps = {\n form: props.form,\n dirty,\n loading,\n disabled: props.disabled,\n disabledIfPristine: props.disabledIfPristine,\n submitLabel: props.submitLabel,\n noSubmit: props.noSubmit,\n onCancel: props.onCancel,\n skipReset: props.skipReset,\n actions: props.actions,\n };\n\n // In row layout the action bar is the card's own last row, not a second\n // bordered box floating under it — see the `layout` prop's note. `card`\n // mode already owns its footer (`CardFooter`), and a form that resolved to\n // no groups at all has nothing to put the bar inside, so both fall back to\n // the standalone bar below.\n const inCardBottomBar =\n layout === \"row\" &&\n !props.card &&\n !skipBottomBar &&\n resolvedGroups.length ? (\n <BottomBar {...bottomBarProps} bare />\n ) : undefined;\n\n const fieldGroups = (\n <FormFieldLayoutProvider value={layout}>\n <FormFieldRequiredMarkerProvider value={props.requiredMarker ?? true}>\n <FormFieldAutoSaveProvider value={autoSaveEnabled}>\n {resolvedGroups.map((group, gi) => (\n <GroupBlock\n key={gi}\n group={group}\n inputs={inputs}\n disabled={props.disabled}\n fields={props.fields}\n i18nPrefix={props.i18nPrefix}\n multiGroup={resolvedGroups.length > 1}\n layout={layout}\n gridClassName={props.gridClassName}\n bottomBar={\n gi === resolvedGroups.length - 1 ? inCardBottomBar : undefined\n }\n />\n ))}\n </FormFieldAutoSaveProvider>\n </FormFieldRequiredMarkerProvider>\n </FormFieldLayoutProvider>\n );\n\n if (props.card) {\n const cardClassName =\n typeof props.card === \"string\" ? props.card : undefined;\n return (\n <form\n {...props.form.props}\n className={cn(\n props.fill && \"flex h-full min-h-0 flex-col\",\n props.className,\n )}\n >\n <Card\n className={cn(\n props.fill && \"min-h-0 flex-1\",\n // Header owns its bottom padding (pb-3); trim the card's top\n // padding to match so header top/bottom are an even 12px.\n hasHeader && \"pt-3\",\n cardClassName,\n )}\n >\n {hasHeader && (\n // Explicit flex header (not shadcn CardHeader): CardHeader's grid\n // adds a phantom second row + row-gap below the title whenever a\n // CardDescription is nested, making the bottom padding larger than\n // the top. A plain flex row keeps top/bottom padding symmetric.\n <div\n data-slot=\"card-header\"\n className=\"flex items-start justify-between gap-3 border-b px-4 pb-3\"\n >\n <div className=\"flex items-center gap-3\">\n {HeaderIcon && (\n <div className=\"bg-primary/10 text-primary flex size-10 shrink-0 items-center justify-center rounded-full\">\n <HeaderIcon className=\"size-5\" />\n </div>\n )}\n <div className=\"flex flex-col gap-0\">\n {props.title && <CardTitle>{props.title}</CardTitle>}\n {props.description && (\n <CardDescription>{props.description}</CardDescription>\n )}\n </div>\n </div>\n {props.headerAction && (\n <div className=\"shrink-0\">{props.headerAction}</div>\n )}\n </div>\n )}\n <CardContent\n className={cn(\n \"flex flex-col gap-4\",\n props.fill && \"min-h-0 flex-1 overflow-y-auto\",\n )}\n >\n {fieldGroups}\n {props.footer}\n </CardContent>\n {!skipBottomBar && (\n <CardFooter>\n <BottomBar {...bottomBarProps} bare />\n </CardFooter>\n )}\n </Card>\n </form>\n );\n }\n\n return (\n <form {...props.form.props} className={props.className}>\n <div className=\"flex flex-col gap-4\">\n {hasHeader && (\n <div className=\"bg-muted/40 flex items-start gap-3 rounded-md border p-4\">\n {HeaderIcon && (\n <div className=\"bg-primary/10 text-primary flex size-10 shrink-0 items-center justify-center rounded-full\">\n <HeaderIcon className=\"size-5\" />\n </div>\n )}\n <div className=\"flex flex-col gap-1\">\n {props.title && (\n <h2 className=\"text-base font-semibold\">{props.title}</h2>\n )}\n {props.description && (\n <p className=\"text-muted-foreground text-sm\">\n {props.description}\n </p>\n )}\n </div>\n {props.headerAction && (\n <div className=\"ml-auto\">{props.headerAction}</div>\n )}\n </div>\n )}\n\n {fieldGroups}\n\n {props.footer}\n\n {!skipBottomBar && !inCardBottomBar && (\n <BottomBar {...bottomBarProps} />\n )}\n </div>\n </form>\n );\n}\n\n// ──────────────────────────────────────────────────────────────────────\n\ninterface GroupBlockProps {\n group: AutoFormGroup;\n inputs: Record<string, never>;\n fields?: Partial<Record<string, Partial<Omit<ControlProps, \"input\">>>>;\n i18nPrefix?: string;\n disabled?: boolean;\n multiGroup?: boolean;\n layout: \"stack\" | \"row\";\n gridClassName?: string;\n /**\n * The form's action bar, rendered as this group's last divided row. Set by\n * `AutoForm` on the *last* group in `layout=\"row\"`; `undefined` everywhere\n * else, including every group in the grid layout.\n */\n bottomBar?: ReactNode;\n}\n\nconst GroupBlock = (props: GroupBlockProps) => {\n const { group } = props;\n const { tr } = useI18n();\n const Icon = group.icon ? iconFor(group.icon) : undefined;\n\n const items = group.fields\n .map((entry) => {\n const name = typeof entry === \"string\" ? entry : entry.name;\n const override =\n typeof entry === \"object\" ? (entry as Partial<ControlProps>) : {};\n const input = props.inputs[name];\n if (!input) return null;\n const fromMap = props.fields?.[name] ?? {};\n const merged: Partial<ControlProps> = {\n ...fromMap,\n ...override,\n };\n // i18nPrefix: fill label/description from the dictionary when neither\n // the override nor the schema already provides one. A missing key\n // makes `tr` echo the key back (an empty `default` is falsy, so the\n // provider can't substitute it) — guard with `!== key` so an absent\n // entry leaves the Control to fall back to `schema.title ??\n // prettyName(field)`, preserving current behaviour.\n if (props.i18nPrefix && merged.label === undefined) {\n const key = `${props.i18nPrefix}.${name}`;\n const label = tr(key, { default: \"\" });\n if (label && label !== key) merged.label = label;\n }\n if (props.i18nPrefix && merged.description === undefined) {\n const key = `${props.i18nPrefix}.${name}.desc`;\n const desc = tr(key, { default: \"\" });\n if (desc && desc !== key) merged.description = desc;\n }\n // Hand the extended prefix down so an object's children and an array's\n // item fields resolve their own labels/help\n // (`parameters.x.payg.dailyCapCents.desc`).\n if (props.i18nPrefix && merged.i18nPrefix === undefined) {\n merged.i18nPrefix = `${props.i18nPrefix}.${name}`;\n }\n return { name, input, props: merged };\n })\n .filter(Boolean) as Array<{\n name: string;\n input: BaseInputField;\n props: Partial<ControlProps>;\n }>;\n\n // `!props.bottomBar`: a group carrying the action bar still renders when it\n // has no resolvable fields, or the form would silently lose its submit\n // button rather than merely render empty.\n if (!items.length && !props.multiGroup && !props.bottomBar) return null;\n\n // Naked group: no title, no icon → no card chrome (lets solo complex\n // fields render with just their own header).\n const isNaked = !group.title && !Icon;\n\n // Row layout: each group becomes a divider-stacked card, every Control\n // takes a full row through its own FormField row layout (via context).\n if (props.layout === \"row\") {\n const hasHeading = !!(group.title || group.description);\n return (\n <div>\n {hasHeading && (\n // `SettingsHeading` rather than a local span pair: this is the same\n // heading `SettingsSection` renders, and the whole reason that\n // component exists is that there be exactly one of it. `items-start`\n // + `mt-0.5` keeps the icon on the title line when a description\n // wraps a second one under it.\n <div className=\"mb-2 flex items-start gap-2\">\n {Icon && (\n <Icon className=\"text-muted-foreground mt-0.5 size-4 shrink-0\" />\n )}\n <SettingsHeading\n title={group.title}\n description={group.description}\n />\n </div>\n )}\n <div className=\"bg-card divide-y rounded-lg border shadow-sm\">\n {items.map((it) => (\n <Control\n key={it.name}\n input={it.input}\n {...it.props}\n disabled={props.disabled || it.props.disabled}\n />\n ))}\n {props.bottomBar && (\n // Same `px-4 py-3` every row carries, so the action row sits on\n // the card's own rhythm and `divide-y` draws its rule flush.\n <div className=\"px-4 py-3\">{props.bottomBar}</div>\n )}\n </div>\n </div>\n );\n }\n\n const wrapperCls =\n props.multiGroup && !isNaked ? \"border rounded-md overflow-hidden\" : \"\";\n\n return (\n <div className={wrapperCls}>\n {props.multiGroup && !isNaked && (\n <div className=\"bg-muted/40 flex items-center gap-2 border-b px-3 py-2\">\n {Icon && <Icon className=\"text-muted-foreground size-4\" />}\n {group.title && (\n <span className=\"text-sm font-medium\">{group.title}</span>\n )}\n </div>\n )}\n <div\n className={cn(\n \"grid gap-3\",\n props.gridClassName ?? \"grid-cols-12\",\n !isNaked && \"p-3\",\n )}\n >\n {items.map((it) => (\n <div\n key={it.name}\n className={\n // Responsive grid: each field is one cell. Default: 12-col span\n // from width heuristics. A caller-supplied grid keeps its own\n // column count for scalars, but COMPLEX fields (an object card,\n // a list of object editors) still claim the whole row —\n // squeezing one into a third of a row is unreadable, and the\n // heuristic already knows which those are (width 100).\n props.gridClassName\n ? widthFor(it.input, it.props.width as number | undefined) >=\n 100\n ? \"col-span-full\"\n : undefined\n : spanClass(\n widthFor(it.input, it.props.width as number | undefined),\n )\n }\n >\n <Control\n input={it.input}\n {...it.props}\n disabled={props.disabled || it.props.disabled}\n />\n </div>\n ))}\n </div>\n </div>\n );\n};\n\n// ──────────────────────────────────────────────────────────────────────\n\ninterface BottomBarProps {\n form: FormModel<ZObject>;\n dirty?: boolean;\n loading?: boolean;\n disabled?: boolean;\n disabledIfPristine?: boolean;\n submitLabel?: string;\n noSubmit?: boolean;\n onCancel?: () => void;\n skipReset?: boolean;\n actions?: AutoFormAction[];\n /**\n * Drop the standalone chrome (border / rounded / background / padding) so\n * the bar slots into a `CardFooter`, which provides that chrome itself.\n */\n bare?: boolean;\n}\n\nconst BottomBar = (props: BottomBarProps) => {\n const { tr } = useI18n();\n return (\n <div\n className={\n props.bare\n ? \"flex w-full items-center gap-2\"\n : \"bg-card flex items-center gap-2 rounded-md border p-2\"\n }\n >\n {props.onCancel && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={props.onCancel}\n disabled={props.disabled}\n >\n <X className=\"mr-1 size-4\" />\n {tr(\"autoForm.cancel\", { default: \"Cancel\" })}\n </Button>\n )}\n {!props.skipReset && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => props.form.reset()}\n disabled={props.disabled || !props.dirty}\n >\n {/* No icon, deliberately. The submit button next to it carries none\n — a glyph would have to be either a dated floppy disk or a tick\n that reads as \"done\" rather than \"do it\" — and a bar where only\n some buttons are decorated reads as unfinished rather than as a\n hierarchy. `Button` still shows a spinner while submitting,\n which is the one icon here that carries information. */}\n {tr(\"autoForm.reset\", { default: \"Reset\" })}\n </Button>\n )}\n {props.actions?.map((action, i) => {\n const Icon = action.icon ? iconFor(action.icon) : undefined;\n return (\n <Button\n key={i}\n type=\"button\"\n variant={action.variant ?? \"ghost\"}\n onClick={() => action.onClick()}\n disabled={props.disabled || action.disabled}\n >\n {Icon && <Icon className=\"mr-1 size-4\" />}\n {action.label}\n </Button>\n );\n })}\n\n <div className=\"ml-auto flex items-center gap-2\">\n <FormErrorPopover form={props.form} />\n {!props.noSubmit && (\n <Button\n type=\"submit\"\n loading={props.loading}\n disabled={\n props.disabled || (props.disabledIfPristine && !props.dirty)\n }\n >\n {props.submitLabel ?? tr(\"autoForm.save\", { default: \"Save\" })}\n </Button>\n )}\n </div>\n </div>\n );\n};\n\n// ──────────────────────────────────────────────────────────────────────\n\ninterface FormErrorPopoverProps {\n form: FormModel<ZObject>;\n}\n\nconst FormErrorPopover = (props: FormErrorPopoverProps) => {\n const { error } = useFormState(props.form, [\"error\"]);\n const { tr } = useI18n();\n const [open, setOpen] = useState(false);\n // Close the popover when the error clears. Guarded on `open`, so it settles\n // in one pass and does not need an effect.\n if (!error && open) {\n setOpen(false);\n }\n\n if (!error) return null;\n\n const items = collectErrors(error);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n render={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={tr(\"autoForm.errors\", { default: \"Form errors\" })}\n className=\"text-destructive\"\n />\n }\n >\n <AlertCircle className=\"size-4\" />\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-80 p-2\">\n <p className=\"text-destructive px-2 py-1 text-sm font-medium\">\n {items.length === 1\n ? tr(\"autoForm.error\", { default: \"Error\" })\n : tr(\"autoForm.errors\", { default: \"Errors\" })}\n </p>\n <ul className=\"flex flex-col gap-1\">\n {items.map((it, i) => (\n <li key={i}>\n <button\n type=\"button\"\n onClick={() => focusError(it.path, props.form.id)}\n className=\"hover:bg-accent w-full rounded px-2 py-1 text-left text-xs\"\n >\n <span className=\"font-medium\">\n {it.path || tr(\"autoForm.formLabel\", { default: \"Form\" })}\n </span>\n <span className=\"text-muted-foreground\"> — {it.message}</span>\n </button>\n </li>\n ))}\n </ul>\n </PopoverContent>\n </Popover>\n );\n};\n\ninterface ErrorItem {\n path: string;\n message: string;\n}\n\nconst collectErrors = (error: Error): ErrorItem[] => {\n const anyErr = error as Error & {\n value?: { message?: string; path?: string };\n };\n const path = anyErr.value?.path ?? \"\";\n const message = anyErr.value?.message ?? error.message ?? \"Invalid\";\n return [{ path, message }];\n};\n\nconst focusError = (path: string, formId: string) => {\n const segments = path.split(\"/\").filter(Boolean);\n if (segments.length === 0) return;\n const dotted = segments.join(\".\");\n // ControlArray names its item fields `items[0].email` and joins their ids\n // with `-`; the dotted forms are what every other control renders.\n const bracketed = segments\n .map((segment, i) =>\n i === 0\n ? segment\n : /^\\d+$/.test(segment)\n ? `[${segment}]`\n : `.${segment}`,\n )\n .join(\"\");\n const el =\n document.getElementById(`${formId}-${dotted}`) ??\n document.getElementById(`${formId}-${segments.join(\"-\")}`) ??\n document.querySelector<HTMLElement>(`[name=\"${dotted}\"]`) ??\n document.querySelector<HTMLElement>(`[name=\"${bracketed}\"]`);\n el?.focus();\n};\n\n// ──────────────────────────────────────────────────────────────────────\n\nconst autoGroupSchema = (\n schema: ZObject,\n opts: {\n defaultTitle?: string;\n defaultIcon?: string;\n /**\n * Translator for the fallback group title (the helper is hook-free).\n */\n tr?: (key: string, options?: { default?: string }) => string;\n },\n): AutoFormGroup[] => {\n const general: AutoFormGroup = {\n title:\n opts.defaultTitle ??\n opts.tr?.(\"autoForm.general\", { default: \"General\" }) ??\n \"General\",\n icon: opts.defaultIcon ?? \"cog\",\n fields: [],\n };\n const groups: AutoFormGroup[] = [];\n\n for (const [key, prop] of Object.entries(z.schema.shape(schema))) {\n // Classify the unwrapped schema: an optional object is still an object.\n const inner = z.schema.unwrap(prop);\n const isObject = z.schema.isObject(inner);\n // An array of a UNION of objects is a complex field too — without this it\n // lands in the \"General\" grid and gets a third of a row to render a list\n // of object editors in.\n const isArrayOfObjects =\n z.schema.isArray(inner) &&\n isObjectOrUnionOfObjects(z.schema.element(inner));\n if (isObject || isArrayOfObjects) {\n // Solo complex fields render their own header (label + description +\n // chevron + add/init), so we skip the group bar to avoid a\n // duplicate title row.\n groups.push({ fields: [key] });\n } else {\n general.fields.push(key);\n }\n }\n\n if (general.fields.length === 0) return groups;\n return [general, ...groups];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8CA,SAAS,eAAe,QAA0B;CAChD,IAAI,CAAC,UAAU,OAAO,WAAW,UAAU,OAAO;CAGlD,MAAM,QAAQ,EAAE,OAAO,OAAO,MAAe;CAC7C,IAAI,EAAE,OAAO,SAAS,KAAK,GAAG,OAAO;CACrC,IAAI,EAAE,OAAO,QAAQ,KAAK,GACxB,OAAO,EAAE,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,cAAc;CAEpD,OAAO;AACT;;;;;;AAOA,SAAS,aAAa,QAA0B;CAC9C,IAAI,CAAC,UAAU,OAAO,WAAW,UAAU,OAAO;CAClD,MAAM,QAAQ,EAAE,OAAO,OAAO,MAAe;CAC7C,IAAI,EAAE,OAAO,OAAO,KAAK,GAAG,OAAO;CACnC,IAAI,EAAE,OAAO,QAAQ,KAAK,GACxB,OAAO,EAAE,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,YAAY;CAElD,OAAO;AACT;;;;;;AAOA,SAAS,qBACP,MACA,QACA,QACyB;CACzB,MAAM,UAAW,SAAS,SAAqC,CAAC;CAChE,IAAI,YAAqC,CAAC;CAC1C,KAAK,MAAM,SAAS,UAAU,CAAC,GAC7B,KAAK,MAAM,SAAS,MAAM,QACxB,IAAI,OAAO,UAAU,YAAY,MAAM,SAAS,MAC9C,YAAY;CAIlB,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,MAAM,mBACJ,EAAE,OAAO,QAAQ,KAAK,KACtB,yBAAyB,EAAE,OAAO,QAAQ,KAAK,CAAC;EAClD,IAAI,YAAY,kBAId,OAAO,KAAK,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;OAE7B,QAAQ,OAAO,KAAK,GAAG;CAE3B;CAEA,IAAI,QAAQ,OAAO,WAAW,GAAG,OAAO;CACxC,OAAO,CAAC,SAAS,GAAG,MAAM;AAC5B"}
1
+ {"version":3,"file":"auto-form.js","names":[],"sources":["../../../src/components/auto-form/auto-form.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport {\n FormFieldAutoSaveProvider,\n FormFieldLayoutProvider,\n FormFieldRequiredMarkerProvider,\n} from \"@alepha/ui/components/control-base/form-field\";\nimport { spanClass, widthFor } from \"@alepha/ui/components/control-base/grid\";\nimport { iconFor } from \"@alepha/ui/components/control-base/icon-hint\";\nimport {\n Control,\n type ControlProps,\n} from \"@alepha/ui/components/control/control\";\nimport { SettingsHeading } from \"@alepha/ui/components/settings/settings-heading\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardTitle,\n} from \"@alepha/ui/components/ui/card\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@alepha/ui/components/ui/popover\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport { type ZObject, type ZType, z } from \"alepha\";\nimport { useAlepha } from \"alepha/react\";\nimport {\n type BaseInputField,\n type FormModel,\n isObjectOrUnionOfObjects,\n useFormState,\n} from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { AlertCircle, X } from \"lucide-react\";\nimport { type ReactNode, useEffect, useMemo, useState } from \"react\";\n\n/**\n * Detect a `z.string()` schema (incl. optional/nullable wrappers) so the\n * auto-save effect can skip keystroke commits on text fields.\n */\nfunction isStringSchema(schema: unknown): boolean {\n if (!schema || typeof schema !== \"object\") return false;\n // Zod, not JSON Schema: `z.string().optional()` has no `type: \"string\"`,\n // so the optional text fields of a form used to auto-save every keystroke.\n const inner = z.schema.unwrap(schema as ZType);\n if (z.schema.isString(inner)) return true;\n if (z.schema.isUnion(inner)) {\n return z.schema.options(inner).some(isStringSchema);\n }\n return false;\n}\n\n/**\n * Detect an enum schema (incl. optional/nullable wrappers). Enum fields\n * render as a `<Select>`, so they must auto-commit on change like any\n * other select — never get lumped in with free-text string fields.\n */\nfunction isEnumSchema(schema: unknown): boolean {\n if (!schema || typeof schema !== \"object\") return false;\n const inner = z.schema.unwrap(schema as ZType);\n if (z.schema.isEnum(inner)) return true;\n if (z.schema.isUnion(inner)) {\n return z.schema.options(inner).some(isEnumSchema);\n }\n return false;\n}\n\n/**\n * Resolve the effective `<Control>` config for a field, merging the\n * `fields` map with any per-field override carried on a `groups` entry —\n * the same precedence `GroupBlock` applies when rendering.\n */\nfunction resolveControlConfig(\n name: string,\n fields: Record<string, unknown> | undefined,\n groups: AutoFormGroup[] | undefined,\n): Record<string, unknown> {\n const fromMap = (fields?.[name] as Record<string, unknown>) ?? {};\n let fromGroup: Record<string, unknown> = {};\n for (const group of groups ?? []) {\n for (const field of group.fields) {\n if (typeof field === \"object\" && field.name === name) {\n fromGroup = field as Record<string, unknown>;\n }\n }\n }\n return { ...fromMap, ...fromGroup };\n}\n\nexport interface AutoFormGroup {\n /**\n * Group title shown in the header.\n */\n title?: string;\n /**\n * One line under the title, for context the fields should not each repeat.\n *\n * Only rendered in `layout=\"row\"`, where the heading sits above the card\n * and there is room for it — the boxed group bar the grid layout uses is a\n * single line by construction.\n */\n description?: string;\n /**\n * Icon name (lucide) for the group header.\n */\n icon?: string;\n /**\n * Visibility predicate. Group is omitted when this returns false.\n */\n can?: () => boolean;\n /**\n * Field names from the form schema. Each renders as a `<Control>`.\n * Use the object form `{ name, ...controlProps }` for per-field overrides\n * (width, icon, custom, etc.).\n */\n fields: Array<\n string | (Partial<Omit<ControlProps, \"input\">> & { name: string })\n >;\n}\n\nexport interface AutoFormAction {\n label: string;\n icon?: string;\n variant?: \"default\" | \"outline\" | \"ghost\" | \"destructive\" | \"secondary\";\n onClick: () => void | Promise<void>;\n disabled?: boolean;\n}\n\nexport interface AutoFormProps<T extends ZObject> {\n /**\n * Form model returned by `useForm()`. The schema drives every field.\n */\n form: FormModel<T>;\n\n /**\n * Header icon (lucide name).\n */\n icon?: string;\n /**\n * Header title.\n */\n title?: string;\n /**\n * Header description / subtitle.\n */\n description?: string;\n /**\n * Extra content rendered on the right of the header (e.g. a status badge).\n * In `card` mode it renders as the `CardAction`; otherwise it is pushed to\n * the right edge of the header box.\n */\n headerAction?: ReactNode;\n\n /**\n * Manual layout: list of groups, each with its own fields.\n * If neither `groups` nor `autoGroup` is set, every top-level schema\n * field is rendered in a single ungrouped column.\n */\n groups?: AutoFormGroup[];\n\n /**\n * Auto-group: scan the schema, primitive fields land in a \"General\"\n * group, each object/array-of-objects becomes its own group.\n */\n autoGroup?: boolean | { defaultTitle?: string; defaultIcon?: string };\n\n /**\n * Per-field control overrides keyed by field name (also works without groups).\n */\n fields?: Partial<\n Record<keyof T[\"shape\"] & string, Partial<Omit<ControlProps, \"input\">>>\n >;\n\n /**\n * Localize field labels the schema doesn't carry. When set, each field's\n * label is resolved from the app dictionary via\n * `tr(\\`${i18nPrefix}.${fieldName}\\`)` and its description via\n * `tr(\\`${i18nPrefix}.${fieldName}.desc\\`)`, falling back to the\n * schema-derived label/description when the key is absent. Lets a generic\n * AutoForm (e.g. the parameters admin, whose schemas rarely set `title`)\n * render translated labels without per-schema annotations. Explicit\n * `fields[name].label` overrides still win.\n */\n i18nPrefix?: string;\n\n /**\n * Submit button label.\n */\n submitLabel?: string;\n /**\n * Hide built-in submit button.\n */\n noSubmit?: boolean;\n /**\n * Disable submit when form is pristine (not dirty).\n */\n disabledIfPristine?: boolean;\n /**\n * Disable the entire form (cascades to controls).\n */\n disabled?: boolean;\n\n /**\n * Show the red `*` next to the label of every required field.\n *\n * Set `false` on a form where the marker is not news — one whose fields are\n * nearly all required, or where the one required field is self-evidently so\n * (a project's Name). A page of asterisks tells the reader nothing about\n * which field to be careful with, which is the only thing the marker is for.\n *\n * Purely visual. `aria-required` still comes from the schema, so a screen\n * reader announces the field as required either way — the marker itself is\n * `aria-hidden` and never carried that.\n *\n * @default true\n */\n requiredMarker?: boolean;\n\n /**\n * Cancel button — hidden when omitted.\n */\n onCancel?: () => void;\n /**\n * Skip the reset button in the bottom bar.\n */\n skipReset?: boolean;\n /**\n * Skip the entire bottom bar.\n */\n skipBottomBar?: boolean;\n\n /**\n * Extra action buttons in the bottom bar (left side).\n */\n actions?: AutoFormAction[];\n\n /**\n * Extra content rendered above the bottom bar.\n */\n footer?: ReactNode;\n\n /**\n * Extra classes applied to the form wrapper.\n */\n className?: string;\n\n /**\n * Override the column classes of each field group's grid. By default fields\n * lay out on a fixed 12-column grid and each field's span is derived from\n * width heuristics (`$control.width`, type, …).\n *\n * Pass responsive column classes — e.g.\n * `\"grid-cols-1 md:grid-cols-2 xl:grid-cols-3\"` — to get N equal columns per\n * breakpoint instead; when set, every field occupies a single cell and the\n * per-field width heuristics are ignored.\n */\n gridClassName?: string;\n\n /**\n * Wrap the form in a `<Card>`:\n * - the header (icon + title/description) renders as the `CardHeader`,\n * - the field groups render as the `CardContent`,\n * - the action bar (cancel / reset / actions / submit) renders as the\n * `CardFooter`.\n *\n * When omitted, the form uses its default chrome (a muted header box and a\n * standalone bottom bar). The footer is hidden in `autoSave` mode just like\n * the default bottom bar.\n *\n * Pass a string to override the `<Card>` className (e.g. `\"rounded-none\"` to\n * make the card sit flush against neighbouring panes).\n */\n card?: boolean | string;\n\n /**\n * Fill the available height: the card stretches to `100%` of its container\n * and the body (field groups) scrolls while the header and footer stay\n * pinned. Only meaningful in `card` mode.\n */\n fill?: boolean;\n\n /**\n * Visual layout for every nested Control.\n * - `\"stack\"` (default): label on top, control below — the classic form look.\n * - `\"row\"`: settings-style — each control sits on its own line with the\n * label/description on the left and the control on the right. Each\n * group renders as a bordered card with horizontal dividers.\n *\n * `\"row\"` **is** the settings-card shape, not an approximation of it: the\n * rows render the same markup as {@link SettingsRow}, the card the same as\n * {@link SettingsSection}, the heading through the same\n * {@link SettingsHeading}, and the action bar as the card's own last\n * divided row. So a settings card whose rows are form fields should be an\n * `AutoForm`, and reach for `SettingsSection` only for the rows that are\n * *not* fields — an avatar picker, a read-only value, a lone button.\n */\n layout?: \"stack\" | \"row\";\n\n /**\n * Auto-commit edits instead of showing a Save button.\n *\n * When enabled, every field change schedules a debounced `form.submit()`\n * and the bottom bar is hidden by default. Pass an options object to\n * customize the debounce delay (default 600ms).\n *\n * The `handler` you pass to `useForm` is the auto-commit target — it\n * runs once per quiescent edit, and any thrown error stops the loop\n * until the user edits again.\n */\n autoSave?: boolean | { delay?: number };\n}\n\n/**\n * Schema-driven form with optional grouping, header chrome, and bottom\n * bar. Every input field is resolved through `<Control>`, so schemas\n * carrying `$control` metadata configure themselves.\n */\nexport function AutoForm<T extends ZObject>(props: AutoFormProps<T>) {\n const { tr } = useI18n();\n const { dirty, loading } = useFormState(props.form, [\"dirty\", \"loading\"]);\n const inputs = props.form.input as Record<string, never>;\n\n // `z.object({})` rather than a hand-made `{ properties: {} }`: the latter\n // only ever worked because a prototype alias made `.properties` readable on\n // a schema, so a fake object with that key passed for one.\n const schema = (props.form.options.schema as ZObject) ?? z.object({});\n\n // ── Auto-save ─────────────────────────────────────────────────────\n // Text fields (string) are intentionally excluded: typing should not commit\n // on every keystroke. They commit via Enter (native submit) or the inline\n // tick button. Booleans / selects / uploads / etc. auto-commit on change.\n const autoSave = props.autoSave;\n const autoSaveDelay =\n typeof autoSave === \"object\" ? (autoSave?.delay ?? 600) : 600;\n const autoSaveEnabled = !!autoSave;\n const alepha = useAlepha();\n useEffect(() => {\n if (!autoSaveEnabled) return;\n let handle: ReturnType<typeof setTimeout> | undefined;\n const off = alepha.events.on(\"form:change\", (ev) => {\n if (ev.id !== props.form.id) return;\n if (ev.initial) return;\n // FormModel paths look like \"/title\" or \"/contacts/0/email\". The\n // top-level key is the first segment after the leading slash.\n const top = ev.path.replace(/^\\//, \"\").split(\"/\")[0];\n const fieldSchema = z.schema.shape(schema)[top];\n const fieldConfig = resolveControlConfig(\n top,\n props.fields as Record<string, unknown> | undefined,\n props.groups,\n );\n // Text fields (incl. optional/nullable wrappers) should NOT auto-commit\n // on keystroke; they commit via Enter or the inline tick button.\n // Uploads commit a uuid string when the upload finishes, and selects /\n // comboboxes / segmented controls commit a discrete value on change —\n // all of those MUST auto-save even though the field schema is a string.\n const rendersAsSelect =\n !!fieldConfig.select ||\n !!fieldConfig.combobox ||\n !!fieldConfig.segmented ||\n fieldConfig.items != null ||\n isEnumSchema(fieldSchema);\n if (\n !fieldConfig.upload &&\n !rendersAsSelect &&\n isStringSchema(fieldSchema)\n )\n return;\n if (handle) clearTimeout(handle);\n handle = setTimeout(() => props.form.submit(), autoSaveDelay);\n });\n return () => {\n off();\n if (handle) clearTimeout(handle);\n };\n }, [\n alepha,\n autoSaveEnabled,\n autoSaveDelay,\n props.form,\n props.fields,\n props.groups,\n schema,\n ]);\n const skipBottomBar = props.skipBottomBar ?? autoSaveEnabled;\n\n const resolvedGroups: AutoFormGroup[] = useMemo(() => {\n if (props.groups) return props.groups.filter((g) => g.can?.() !== false);\n if (props.autoGroup) {\n const opts = typeof props.autoGroup === \"object\" ? props.autoGroup : {};\n return autoGroupSchema(schema, { tr, ...opts });\n }\n return [\n {\n fields: Object.keys(z.schema.shape(schema)),\n },\n ];\n }, [props.groups, props.autoGroup, schema]);\n\n const HeaderIcon = props.icon ? iconFor(props.icon) : undefined;\n const hasHeader = !!(\n props.title ||\n props.description ||\n HeaderIcon ||\n props.headerAction\n );\n\n const layout = props.layout ?? \"stack\";\n\n const bottomBarProps = {\n form: props.form,\n dirty,\n loading,\n disabled: props.disabled,\n disabledIfPristine: props.disabledIfPristine,\n submitLabel: props.submitLabel,\n noSubmit: props.noSubmit,\n onCancel: props.onCancel,\n skipReset: props.skipReset,\n actions: props.actions,\n };\n\n // In row layout the action bar is the card's own last row, not a second\n // bordered box floating under it — see the `layout` prop's note. `card`\n // mode already owns its footer (`CardFooter`), and a form that resolved to\n // no groups at all has nothing to put the bar inside, so both fall back to\n // the standalone bar below.\n const inCardBottomBar =\n layout === \"row\" &&\n !props.card &&\n !skipBottomBar &&\n resolvedGroups.length ? (\n <BottomBar {...bottomBarProps} bare />\n ) : undefined;\n\n const fieldGroups = (\n <FormFieldLayoutProvider value={layout}>\n <FormFieldRequiredMarkerProvider value={props.requiredMarker ?? true}>\n <FormFieldAutoSaveProvider value={autoSaveEnabled}>\n {resolvedGroups.map((group, gi) => (\n <GroupBlock\n key={gi}\n group={group}\n inputs={inputs}\n disabled={props.disabled}\n fields={props.fields}\n i18nPrefix={props.i18nPrefix}\n multiGroup={resolvedGroups.length > 1}\n layout={layout}\n gridClassName={props.gridClassName}\n bottomBar={\n gi === resolvedGroups.length - 1 ? inCardBottomBar : undefined\n }\n />\n ))}\n </FormFieldAutoSaveProvider>\n </FormFieldRequiredMarkerProvider>\n </FormFieldLayoutProvider>\n );\n\n if (props.card) {\n const cardClassName =\n typeof props.card === \"string\" ? props.card : undefined;\n return (\n <form\n {...props.form.props}\n className={cn(\n props.fill && \"flex h-full min-h-0 flex-col\",\n props.className,\n )}\n >\n <Card\n className={cn(\n props.fill && \"min-h-0 flex-1\",\n // Header owns its bottom padding (pb-3); trim the card's top\n // padding to match so header top/bottom are an even 12px.\n hasHeader && \"pt-3\",\n cardClassName,\n )}\n >\n {hasHeader && (\n // Explicit flex header (not shadcn CardHeader): CardHeader's grid\n // adds a phantom second row + row-gap below the title whenever a\n // CardDescription is nested, making the bottom padding larger than\n // the top. A plain flex row keeps top/bottom padding symmetric.\n <div\n data-slot=\"card-header\"\n className=\"flex items-start justify-between gap-3 border-b px-4 pb-3\"\n >\n <div className=\"flex items-center gap-3\">\n {HeaderIcon && (\n <div className=\"bg-primary/10 text-primary flex size-10 shrink-0 items-center justify-center rounded-full\">\n <HeaderIcon className=\"size-5\" />\n </div>\n )}\n <div className=\"flex flex-col gap-0\">\n {props.title && <CardTitle>{props.title}</CardTitle>}\n {props.description && (\n <CardDescription>{props.description}</CardDescription>\n )}\n </div>\n </div>\n {props.headerAction && (\n <div className=\"shrink-0\">{props.headerAction}</div>\n )}\n </div>\n )}\n <CardContent\n className={cn(\n \"flex flex-col gap-4\",\n props.fill && \"min-h-0 flex-1 overflow-y-auto\",\n )}\n >\n {fieldGroups}\n {props.footer}\n </CardContent>\n {!skipBottomBar && (\n <CardFooter>\n <BottomBar {...bottomBarProps} bare />\n </CardFooter>\n )}\n </Card>\n </form>\n );\n }\n\n return (\n <form {...props.form.props} className={props.className}>\n <div className=\"flex flex-col gap-4\">\n {hasHeader && (\n <div className=\"bg-muted/40 flex items-start gap-3 rounded-md border p-4\">\n {HeaderIcon && (\n <div className=\"bg-primary/10 text-primary flex size-10 shrink-0 items-center justify-center rounded-full\">\n <HeaderIcon className=\"size-5\" />\n </div>\n )}\n <div className=\"flex flex-col gap-1\">\n {props.title && (\n <h2 className=\"text-base font-semibold\">{props.title}</h2>\n )}\n {props.description && (\n <p className=\"text-muted-foreground text-sm\">\n {props.description}\n </p>\n )}\n </div>\n {props.headerAction && (\n <div className=\"ml-auto\">{props.headerAction}</div>\n )}\n </div>\n )}\n\n {fieldGroups}\n\n {props.footer}\n\n {!skipBottomBar && !inCardBottomBar && (\n <BottomBar {...bottomBarProps} />\n )}\n </div>\n </form>\n );\n}\n\n// ──────────────────────────────────────────────────────────────────────\n\ninterface GroupBlockProps {\n group: AutoFormGroup;\n inputs: Record<string, never>;\n fields?: Partial<Record<string, Partial<Omit<ControlProps, \"input\">>>>;\n i18nPrefix?: string;\n disabled?: boolean;\n multiGroup?: boolean;\n layout: \"stack\" | \"row\";\n gridClassName?: string;\n /**\n * The form's action bar, rendered as this group's last divided row. Set by\n * `AutoForm` on the *last* group in `layout=\"row\"`; `undefined` everywhere\n * else, including every group in the grid layout.\n */\n bottomBar?: ReactNode;\n}\n\nconst GroupBlock = (props: GroupBlockProps) => {\n const { group } = props;\n const { tr } = useI18n();\n const Icon = group.icon ? iconFor(group.icon) : undefined;\n\n const items = group.fields\n .map((entry) => {\n const name = typeof entry === \"string\" ? entry : entry.name;\n const override =\n typeof entry === \"object\" ? (entry as Partial<ControlProps>) : {};\n const input = props.inputs[name];\n if (!input) return null;\n const fromMap = props.fields?.[name] ?? {};\n const merged: Partial<ControlProps> = {\n ...fromMap,\n ...override,\n };\n // i18nPrefix: fill label/description from the dictionary when neither\n // the override nor the schema already provides one. A missing key\n // makes `tr` echo the key back (an empty `default` is falsy, so the\n // provider can't substitute it) — guard with `!== key` so an absent\n // entry leaves the Control to fall back to `schema.title ??\n // prettyName(field)`, preserving current behaviour.\n if (props.i18nPrefix && merged.label === undefined) {\n const key = `${props.i18nPrefix}.${name}`;\n const label = tr(key, { default: \"\" });\n if (label && label !== key) merged.label = label;\n }\n if (props.i18nPrefix && merged.description === undefined) {\n const key = `${props.i18nPrefix}.${name}.desc`;\n const desc = tr(key, { default: \"\" });\n if (desc && desc !== key) merged.description = desc;\n }\n // Hand the extended prefix down so an object's children and an array's\n // item fields resolve their own labels/help\n // (`parameters.x.payg.dailyCapCents.desc`).\n if (props.i18nPrefix && merged.i18nPrefix === undefined) {\n merged.i18nPrefix = `${props.i18nPrefix}.${name}`;\n }\n return { name, input, props: merged };\n })\n .filter(Boolean) as Array<{\n name: string;\n input: BaseInputField;\n props: Partial<ControlProps>;\n }>;\n\n // `!props.bottomBar`: a group carrying the action bar still renders when it\n // has no resolvable fields, or the form would silently lose its submit\n // button rather than merely render empty.\n if (!items.length && !props.multiGroup && !props.bottomBar) return null;\n\n // Naked group: no title, no icon → no card chrome (lets solo complex\n // fields render with just their own header).\n const isNaked = !group.title && !Icon;\n\n // Row layout: each group becomes a divider-stacked card, every Control\n // takes a full row through its own FormField row layout (via context).\n if (props.layout === \"row\") {\n const hasHeading = !!(group.title || group.description);\n return (\n <div className=\"shrink-0\">\n {hasHeading && (\n // `SettingsHeading` rather than a local span pair: this is the same\n // heading `SettingsSection` renders, and the whole reason that\n // component exists is that there be exactly one of it. `items-start`\n // + `mt-0.5` keeps the icon on the title line when a description\n // wraps a second one under it.\n <div className=\"mb-2 flex items-start gap-2\">\n {Icon && (\n <Icon className=\"text-muted-foreground mt-0.5 size-4 shrink-0\" />\n )}\n <SettingsHeading\n title={group.title}\n description={group.description}\n />\n </div>\n )}\n <div className=\"bg-card divide-y rounded-lg border shadow-sm\">\n {items.map((it) => (\n <Control\n key={it.name}\n input={it.input}\n {...it.props}\n disabled={props.disabled || it.props.disabled}\n />\n ))}\n {props.bottomBar && (\n // Same `px-4 py-3` every row carries, so the action row sits on\n // the card's own rhythm and `divide-y` draws its rule flush.\n <div className=\"px-4 py-3\">{props.bottomBar}</div>\n )}\n </div>\n </div>\n );\n }\n\n // `shrink-0` on every group root, titled or naked. Under `fill` the groups\n // are flex items of a `CardContent` that has a definite height, and per the\n // flexbox automatic-minimum-size rule an item whose computed `overflow` is\n // not `visible` gets an auto min size of 0. The titled group is the only one\n // carrying `overflow-hidden`, so it was the only child that could give way:\n // once the expanded object groups overflowed the card it absorbed all of it\n // and collapsed to nothing. `CardContent` already asked for `overflow-y-auto`\n // and now gets to do the scrolling itself.\n const wrapperCls = cn(\n \"shrink-0\",\n props.multiGroup && !isNaked && \"overflow-hidden rounded-md border\",\n );\n\n return (\n <div className={wrapperCls}>\n {props.multiGroup && !isNaked && (\n <div className=\"bg-muted/40 flex items-center gap-2 border-b px-3 py-2\">\n {Icon && <Icon className=\"text-muted-foreground size-4\" />}\n {group.title && (\n <span className=\"text-sm font-medium\">{group.title}</span>\n )}\n </div>\n )}\n <div\n className={cn(\n \"grid gap-3\",\n props.gridClassName ?? \"grid-cols-12\",\n !isNaked && \"p-3\",\n )}\n >\n {items.map((it) => (\n <div\n key={it.name}\n className={\n // Responsive grid: each field is one cell. Default: 12-col span\n // from width heuristics. A caller-supplied grid keeps its own\n // column count for scalars, but COMPLEX fields (an object card,\n // a list of object editors) still claim the whole row —\n // squeezing one into a third of a row is unreadable, and the\n // heuristic already knows which those are (width 100).\n props.gridClassName\n ? widthFor(it.input, it.props.width as number | undefined) >=\n 100\n ? \"col-span-full\"\n : undefined\n : spanClass(\n widthFor(it.input, it.props.width as number | undefined),\n )\n }\n >\n <Control\n input={it.input}\n {...it.props}\n disabled={props.disabled || it.props.disabled}\n />\n </div>\n ))}\n </div>\n </div>\n );\n};\n\n// ──────────────────────────────────────────────────────────────────────\n\ninterface BottomBarProps {\n form: FormModel<ZObject>;\n dirty?: boolean;\n loading?: boolean;\n disabled?: boolean;\n disabledIfPristine?: boolean;\n submitLabel?: string;\n noSubmit?: boolean;\n onCancel?: () => void;\n skipReset?: boolean;\n actions?: AutoFormAction[];\n /**\n * Drop the standalone chrome (border / rounded / background / padding) so\n * the bar slots into a `CardFooter`, which provides that chrome itself.\n */\n bare?: boolean;\n}\n\nconst BottomBar = (props: BottomBarProps) => {\n const { tr } = useI18n();\n return (\n <div\n className={\n props.bare\n ? \"flex w-full items-center gap-2\"\n : \"bg-card flex items-center gap-2 rounded-md border p-2\"\n }\n >\n {props.onCancel && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={props.onCancel}\n disabled={props.disabled}\n >\n <X className=\"mr-1 size-4\" />\n {tr(\"autoForm.cancel\", { default: \"Cancel\" })}\n </Button>\n )}\n {!props.skipReset && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => props.form.reset()}\n disabled={props.disabled || !props.dirty}\n >\n {/* No icon, deliberately. The submit button next to it carries none\n — a glyph would have to be either a dated floppy disk or a tick\n that reads as \"done\" rather than \"do it\" — and a bar where only\n some buttons are decorated reads as unfinished rather than as a\n hierarchy. `Button` still shows a spinner while submitting,\n which is the one icon here that carries information. */}\n {tr(\"autoForm.reset\", { default: \"Reset\" })}\n </Button>\n )}\n {props.actions?.map((action, i) => {\n const Icon = action.icon ? iconFor(action.icon) : undefined;\n return (\n <Button\n key={i}\n type=\"button\"\n variant={action.variant ?? \"ghost\"}\n onClick={() => action.onClick()}\n disabled={props.disabled || action.disabled}\n >\n {Icon && <Icon className=\"mr-1 size-4\" />}\n {action.label}\n </Button>\n );\n })}\n\n <div className=\"ml-auto flex items-center gap-2\">\n <FormErrorPopover form={props.form} />\n {!props.noSubmit && (\n <Button\n type=\"submit\"\n loading={props.loading}\n disabled={\n props.disabled || (props.disabledIfPristine && !props.dirty)\n }\n >\n {props.submitLabel ?? tr(\"autoForm.save\", { default: \"Save\" })}\n </Button>\n )}\n </div>\n </div>\n );\n};\n\n// ──────────────────────────────────────────────────────────────────────\n\ninterface FormErrorPopoverProps {\n form: FormModel<ZObject>;\n}\n\nconst FormErrorPopover = (props: FormErrorPopoverProps) => {\n const { error } = useFormState(props.form, [\"error\"]);\n const { tr } = useI18n();\n const [open, setOpen] = useState(false);\n // Close the popover when the error clears. Guarded on `open`, so it settles\n // in one pass and does not need an effect.\n if (!error && open) {\n setOpen(false);\n }\n\n if (!error) return null;\n\n const items = collectErrors(error);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n render={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={tr(\"autoForm.errors\", { default: \"Form errors\" })}\n className=\"text-destructive\"\n />\n }\n >\n <AlertCircle className=\"size-4\" />\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-80 p-2\">\n <p className=\"text-destructive px-2 py-1 text-sm font-medium\">\n {items.length === 1\n ? tr(\"autoForm.error\", { default: \"Error\" })\n : tr(\"autoForm.errors\", { default: \"Errors\" })}\n </p>\n <ul className=\"flex flex-col gap-1\">\n {items.map((it, i) => (\n <li key={i}>\n <button\n type=\"button\"\n onClick={() => focusError(it.path, props.form.id)}\n className=\"hover:bg-accent w-full rounded px-2 py-1 text-left text-xs\"\n >\n <span className=\"font-medium\">\n {it.path || tr(\"autoForm.formLabel\", { default: \"Form\" })}\n </span>\n <span className=\"text-muted-foreground\"> — {it.message}</span>\n </button>\n </li>\n ))}\n </ul>\n </PopoverContent>\n </Popover>\n );\n};\n\ninterface ErrorItem {\n path: string;\n message: string;\n}\n\nconst collectErrors = (error: Error): ErrorItem[] => {\n const anyErr = error as Error & {\n value?: { message?: string; path?: string };\n };\n const path = anyErr.value?.path ?? \"\";\n const message = anyErr.value?.message ?? error.message ?? \"Invalid\";\n return [{ path, message }];\n};\n\nconst focusError = (path: string, formId: string) => {\n const segments = path.split(\"/\").filter(Boolean);\n if (segments.length === 0) return;\n const dotted = segments.join(\".\");\n // ControlArray names its item fields `items[0].email` and joins their ids\n // with `-`; the dotted forms are what every other control renders.\n const bracketed = segments\n .map((segment, i) =>\n i === 0\n ? segment\n : /^\\d+$/.test(segment)\n ? `[${segment}]`\n : `.${segment}`,\n )\n .join(\"\");\n const el =\n document.getElementById(`${formId}-${dotted}`) ??\n document.getElementById(`${formId}-${segments.join(\"-\")}`) ??\n document.querySelector<HTMLElement>(`[name=\"${dotted}\"]`) ??\n document.querySelector<HTMLElement>(`[name=\"${bracketed}\"]`);\n el?.focus();\n};\n\n// ──────────────────────────────────────────────────────────────────────\n\nconst autoGroupSchema = (\n schema: ZObject,\n opts: {\n defaultTitle?: string;\n defaultIcon?: string;\n /**\n * Translator for the fallback group title (the helper is hook-free).\n */\n tr?: (key: string, options?: { default?: string }) => string;\n },\n): AutoFormGroup[] => {\n const general: AutoFormGroup = {\n title:\n opts.defaultTitle ??\n opts.tr?.(\"autoForm.general\", { default: \"General\" }) ??\n \"General\",\n icon: opts.defaultIcon ?? \"cog\",\n fields: [],\n };\n const groups: AutoFormGroup[] = [];\n\n for (const [key, prop] of Object.entries(z.schema.shape(schema))) {\n // Classify the unwrapped schema: an optional object is still an object.\n const inner = z.schema.unwrap(prop);\n const isObject = z.schema.isObject(inner);\n // An array of a UNION of objects is a complex field too — without this it\n // lands in the \"General\" grid and gets a third of a row to render a list\n // of object editors in.\n const isArrayOfObjects =\n z.schema.isArray(inner) &&\n isObjectOrUnionOfObjects(z.schema.element(inner));\n if (isObject || isArrayOfObjects) {\n // Solo complex fields render their own header (label + description +\n // chevron + add/init), so we skip the group bar to avoid a\n // duplicate title row.\n groups.push({ fields: [key] });\n } else {\n general.fields.push(key);\n }\n }\n\n if (general.fields.length === 0) return groups;\n return [general, ...groups];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8CA,SAAS,eAAe,QAA0B;CAChD,IAAI,CAAC,UAAU,OAAO,WAAW,UAAU,OAAO;CAGlD,MAAM,QAAQ,EAAE,OAAO,OAAO,MAAe;CAC7C,IAAI,EAAE,OAAO,SAAS,KAAK,GAAG,OAAO;CACrC,IAAI,EAAE,OAAO,QAAQ,KAAK,GACxB,OAAO,EAAE,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,cAAc;CAEpD,OAAO;AACT;;;;;;AAOA,SAAS,aAAa,QAA0B;CAC9C,IAAI,CAAC,UAAU,OAAO,WAAW,UAAU,OAAO;CAClD,MAAM,QAAQ,EAAE,OAAO,OAAO,MAAe;CAC7C,IAAI,EAAE,OAAO,OAAO,KAAK,GAAG,OAAO;CACnC,IAAI,EAAE,OAAO,QAAQ,KAAK,GACxB,OAAO,EAAE,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,YAAY;CAElD,OAAO;AACT;;;;;;AAOA,SAAS,qBACP,MACA,QACA,QACyB;CACzB,MAAM,UAAW,SAAS,SAAqC,CAAC;CAChE,IAAI,YAAqC,CAAC;CAC1C,KAAK,MAAM,SAAS,UAAU,CAAC,GAC7B,KAAK,MAAM,SAAS,MAAM,QACxB,IAAI,OAAO,UAAU,YAAY,MAAM,SAAS,MAC9C,YAAY;CAIlB,OAAO;EAAE,GAAG;EAAS,GAAG;CAAU;AACpC;;;;;;AAsOA,SAAgB,SAA4B,OAAyB;CACnE,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,EAAE,OAAO,YAAY,aAAa,MAAM,MAAM,CAAC,SAAS,SAAS,CAAC;CAC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,OAAO,KAAK,GAAG;CAE3B;CAEA,IAAI,QAAQ,OAAO,WAAW,GAAG,OAAO;CACxC,OAAO,CAAC,SAAS,GAAG,MAAM;AAC5B"}
@@ -1,5 +1,5 @@
1
1
  import { type IconComponent } from "@alepha/ui/components/control-base/icon-hint";
2
- import { type SelectOption } from "@alepha/ui/components/control-select/control-select";
2
+ import { type ControlSelectSize, type SelectOption } from "@alepha/ui/components/control-select/control-select";
3
3
  import { type ControlUploadProps } from "@alepha/ui/components/control-upload/control-upload";
4
4
  import { type BaseInputField } from "alepha/react/form";
5
5
  import { type ComponentType, type HTMLAttributes, type ReactNode } from "react";
@@ -61,8 +61,8 @@ export interface ControlProps {
61
61
  */
62
62
  combobox?: boolean;
63
63
  /**
64
- * Force the select's search input on or off. Defaults to "auto" — on above
65
- * ~20 options, off below.
64
+ * Force the select's search input on or off. Defaults to "auto" — on for an
65
+ * async list, when `createNewEntry` is set, or above ~50 options.
66
66
  */
67
67
  searchable?: boolean;
68
68
  /**
@@ -131,7 +131,9 @@ export interface ControlProps {
131
131
  */
132
132
  autoComplete?: string;
133
133
  /**
134
- * HTML `placeholder` passed to the underlying input.
134
+ * Placeholder text. On a text-shaped control this is the HTML
135
+ * `placeholder`; on a select it is the trigger text shown while nothing is
136
+ * picked.
135
137
  */
136
138
  placeholder?: string;
137
139
  /**
@@ -155,12 +157,21 @@ export interface ControlProps {
155
157
  rows?: number;
156
158
  /**
157
159
  * Escape hatch — extra native attributes (event handlers, `className`,
158
- * `aria-*`, `style`, …) forwarded to whichever element the control
159
- * actually renders (text input / textarea / password input). The form
160
- * bindings (`value`, `onChange`, `id`, `name`) always win and cannot be
161
- * overridden here.
162
- */
163
- inputProps?: HTMLAttributes<HTMLElement>;
160
+ * `aria-*`, `data-*`, `style`, …) forwarded to whichever element the
161
+ * control actually renders (text input / textarea / password input). The
162
+ * form bindings (`value`, `onChange`, `id`, `name`) always win and cannot
163
+ * be overridden here.
164
+ *
165
+ * `data-*` is spelled out because `HTMLAttributes` does not carry it:
166
+ * TypeScript special-cases dashed attributes in JSX only, so an object
167
+ * literal `{ "data-testid": … }` is an excess property and fails to
168
+ * compile. Without this a control cannot carry a test hook, which meant a
169
+ * surface with an e2e had to keep a raw `<input>` rather than adopt the
170
+ * shared control.
171
+ */
172
+ inputProps?: HTMLAttributes<HTMLElement> & {
173
+ [attribute: `data-${string}`]: string | number | boolean | undefined;
174
+ };
164
175
  /**
165
176
  * Allow user to create new entries in select / multi-select.
166
177
  */
@@ -188,11 +199,29 @@ export interface ControlProps {
188
199
  * used as the empty-state trigger placeholder. Defaults to "None".
189
200
  */
190
201
  clearLabel?: string;
202
+ /**
203
+ * Trigger text for a multi-select holding two or more values, e.g.
204
+ * `(n) => \`${n} status\``. One selection always shows the value itself, so
205
+ * this is only ever asked for the collapsed case. Defaults to
206
+ * `"{n} selected"`.
207
+ */
208
+ countLabel?: (count: number) => string;
191
209
  /**
192
210
  * Forwarded to `ControlSelect` — extra className on the trigger.
193
211
  * Useful for sizing filter chips inline.
194
212
  */
195
213
  triggerClassName?: string;
214
+ /**
215
+ * Trigger height and type scale, for the select-shaped controls. Defaults
216
+ * to `default`; `xs` is for a control that sits ON a row of text rather
217
+ * than in a form.
218
+ */
219
+ size?: ControlSelectSize;
220
+ /**
221
+ * Render the select trigger borderless and transparent, so it reads as the
222
+ * row it sits on rather than as a form field. Pairs with `size="xs"`.
223
+ */
224
+ minimal?: boolean;
196
225
  /**
197
226
  * Render a managed upload control (image preview, multi, drag-drop)
198
227
  * that calls `FileController.uploadFile` and stores the file ID(s) in
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../../src/components/control/control.tsx"],"names":[],"mappings":"AAcA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,8CAA8C,CAAC;AAKtD,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,qDAAqD,CAAC;AAO7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ACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,MAAM,CAAC,EACH,OAAO,GACP,IAAI,CACF,kBAAkB,EAClB,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CACpD,CAAC;CACP;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,UAAW,YAAY,cA4Z1C,CAAC"}
1
+ {"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../../src/components/control/control.tsx"],"names":[],"mappings":"AAcA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,8CAA8C,CAAC;AAKtD,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,qDAAqD,CAAC;AAO7D,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,Q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