@middag-io/react 0.44.1 → 0.45.2

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 (362) hide show
  1. package/README.md +7 -0
  2. package/dist-lib/{FormField-Bj43PjHH.js → FormField-Csx8hGAW.js} +1956 -1936
  3. package/dist-lib/{FormPanelBlock-C6eDfGoI.js → FormPanelBlock-Bmd0DpiX.js} +337 -337
  4. package/dist-lib/base/blocks/DenseTableBlock.d.ts.map +1 -1
  5. package/dist-lib/base/blocks/LinkListBlock.d.ts +2 -1
  6. package/dist-lib/base/blocks/LinkListBlock.d.ts.map +1 -1
  7. package/dist-lib/base/form/FormField.d.ts.map +1 -1
  8. package/dist-lib/base/layout/DashboardLayout.d.ts.map +1 -1
  9. package/dist-lib/base/partials/ConfirmationDialog/index.d.ts.map +1 -1
  10. package/dist-lib/base/partials/DataTable/cell-renderers.d.ts +1 -1
  11. package/dist-lib/base/partials/DataTable/cell-renderers.d.ts.map +1 -1
  12. package/dist-lib/base/partials/DataTable/index.d.ts +1 -1
  13. package/dist-lib/base/partials/DataTable/index.d.ts.map +1 -1
  14. package/dist-lib/base/partials/DataTable/sanitize-html.d.ts +17 -0
  15. package/dist-lib/base/partials/DataTable/sanitize-html.d.ts.map +1 -0
  16. package/dist-lib/base/partials/DataTable/types.d.ts +15 -0
  17. package/dist-lib/base/partials/DataTable/types.d.ts.map +1 -1
  18. package/dist-lib/base/partials/FilterBar/index.d.ts.map +1 -1
  19. package/dist-lib/base/shell/BasicShell.js +1 -1
  20. package/dist-lib/base/shell/partials/InlineEditablePanel.js +38 -24
  21. package/dist-lib/base/shell/partials/PageActionButton.d.ts.map +1 -1
  22. package/dist-lib/base/shell/partials/PageActionButton.js +1 -1
  23. package/dist-lib/chunks/subpath-Bh1MAmBT.js +165 -0
  24. package/dist-lib/chunks/{subpath-AeMdleNB.js → subpath-fEhy6n_U.js} +10 -6
  25. package/dist-lib/contracts/block-data/data-display.d.ts +51 -2
  26. package/dist-lib/contracts/block-data/data-display.d.ts.map +1 -1
  27. package/dist-lib/contracts/generated/contract-schema.d.ts +1 -1
  28. package/dist-lib/contracts/generated/contract-types.d.ts +4 -2
  29. package/dist-lib/contracts/generated/contract-types.d.ts.map +1 -1
  30. package/dist-lib/contracts/generated/index.d.ts +1 -1
  31. package/dist-lib/i18n/I18nProvider.js +1 -1
  32. package/dist-lib/i18n/instance.js +1 -1
  33. package/dist-lib/i18n/locales/en/ui.json +5 -3
  34. package/dist-lib/i18n/locales/pt-BR/ui.json +5 -3
  35. package/dist-lib/i18n/register-strings.js +1 -1
  36. package/dist-lib/index.d.ts +1 -1
  37. package/dist-lib/index.d.ts.map +1 -1
  38. package/dist-lib/middag-react.css +1 -1
  39. package/dist-lib/middag-react.js +18641 -13317
  40. package/dist-lib/primitives/reui/chart.d.ts.map +1 -1
  41. package/dist-lib/primitives/reui/chart.js +35 -31
  42. package/docs/public/schemas/ai-contract-manifest.json +1820 -0
  43. package/docs/public/schemas/blocks.json +445 -0
  44. package/docs/public/schemas/components.json +166 -0
  45. package/docs/public/schemas/connectors.json +97 -0
  46. package/docs/public/schemas/fragment.json +2329 -0
  47. package/docs/public/schemas/manifest.json +119 -0
  48. package/docs/public/schemas/navigation.json +72 -0
  49. package/docs/public/schemas/page-contract.json +2329 -0
  50. package/docs/public/schemas/shared-props.json +118 -0
  51. package/docs/public/schemas/theme-defaults.json +253 -0
  52. package/docs/public/schemas/theme.json +401 -0
  53. package/package.json +109 -3
  54. package/src/assets/lottie/calendar/schedule-1.json +1 -0
  55. package/src/assets/lottie/calendar/schedule-2.json +1 -0
  56. package/src/assets/lottie/celebration/confetti-1.json +1 -0
  57. package/src/assets/lottie/celebration/confetti-2.json +1 -0
  58. package/src/assets/lottie/celebration/confetti-3.json +1 -0
  59. package/src/assets/lottie/cloud/cloud-1.json +1 -0
  60. package/src/assets/lottie/cloud/cloud-2.json +1 -0
  61. package/src/assets/lottie/connection/network-1.json +1 -0
  62. package/src/assets/lottie/connection/network-2.json +1 -0
  63. package/src/assets/lottie/connection/network-3.json +1 -0
  64. package/src/assets/lottie/dashboard/analytics-1.json +1 -0
  65. package/src/assets/lottie/dashboard/analytics-2.json +1 -0
  66. package/src/assets/lottie/dashboard/analytics-3.json +1 -0
  67. package/src/assets/lottie/email/mail-1.json +1 -0
  68. package/src/assets/lottie/email/mail-2.json +1 -0
  69. package/src/assets/lottie/email/mail-3.json +1 -0
  70. package/src/assets/lottie/empty-state/empty-1.json +1 -0
  71. package/src/assets/lottie/empty-state/empty-2.json +1 -0
  72. package/src/assets/lottie/empty-state/empty-3.json +1 -0
  73. package/src/assets/lottie/error/warning-1.json +1 -0
  74. package/src/assets/lottie/error/warning-2.json +1 -0
  75. package/src/assets/lottie/error/warning-3.json +1 -0
  76. package/src/assets/lottie/index.ts +49 -0
  77. package/src/assets/lottie/loading/spinner-1.json +1 -0
  78. package/src/assets/lottie/loading/spinner-2.json +1 -0
  79. package/src/assets/lottie/loading/spinner-3.json +1 -0
  80. package/src/assets/lottie/maintenance/construction-1.json +1 -0
  81. package/src/assets/lottie/maintenance/construction-2.json +1 -0
  82. package/src/assets/lottie/maintenance/construction-3.json +1 -0
  83. package/src/assets/lottie/not-found/404-1.json +1 -0
  84. package/src/assets/lottie/not-found/404-2.json +1 -0
  85. package/src/assets/lottie/not-found/404-3.json +1 -0
  86. package/src/assets/lottie/notification/bell-1.json +1 -0
  87. package/src/assets/lottie/notification/bell-2.json +1 -0
  88. package/src/assets/lottie/notification/bell-3.json +1 -0
  89. package/src/assets/lottie/onboarding/welcome-1.json +1 -0
  90. package/src/assets/lottie/onboarding/welcome-2.json +1 -0
  91. package/src/assets/lottie/onboarding/welcome-3.json +1 -0
  92. package/src/assets/lottie/payment/wallet-1.json +1 -0
  93. package/src/assets/lottie/payment/wallet-2.json +1 -0
  94. package/src/assets/lottie/payment/wallet-3.json +1 -0
  95. package/src/assets/lottie/search/search-1.json +1 -0
  96. package/src/assets/lottie/search/search-2.json +1 -0
  97. package/src/assets/lottie/search/search-3.json +1 -0
  98. package/src/assets/lottie/security/lock-1.json +1 -0
  99. package/src/assets/lottie/security/lock-2.json +1 -0
  100. package/src/assets/lottie/security/lock-3.json +1 -0
  101. package/src/assets/lottie/settings/gear-1.json +1 -0
  102. package/src/assets/lottie/settings/gear-2.json +1 -0
  103. package/src/assets/lottie/settings/gear-3.json +1 -0
  104. package/src/assets/lottie/success/check-1.json +1 -0
  105. package/src/assets/lottie/success/check-2.json +1 -0
  106. package/src/assets/lottie/success/check-3.json +1 -0
  107. package/src/assets/lottie/upload/upload-1.json +1 -0
  108. package/src/assets/lottie/upload/upload-2.json +1 -0
  109. package/src/assets/lottie/upload/upload-3.json +1 -0
  110. package/src/assets/lottie/user/profile-1.json +1 -0
  111. package/src/assets/lottie/user/profile-2.json +1 -0
  112. package/src/assets/lottie/user/profile-3.json +1 -0
  113. package/src/base/blocks/ActionGridBlock.tsx +151 -0
  114. package/src/base/blocks/ActivityTimelineBlock.tsx +180 -0
  115. package/src/base/blocks/CardGridBlock.tsx +384 -0
  116. package/src/base/blocks/ChartBlock.tsx +81 -0
  117. package/src/base/blocks/DenseTableBlock.tsx +403 -0
  118. package/src/base/blocks/DetailPanelBlock.tsx +189 -0
  119. package/src/base/blocks/EmptyStateBlock.tsx +46 -0
  120. package/src/base/blocks/FormPanelBlock.lazy.tsx +38 -0
  121. package/src/base/blocks/FormPanelBlock.tsx +480 -0
  122. package/src/base/blocks/LinkListBlock.tsx +94 -0
  123. package/src/base/blocks/MarkdownPanelBlock.tsx +60 -0
  124. package/src/base/blocks/MetricCardBlock.tsx +128 -0
  125. package/src/base/blocks/StatusStripBlock.tsx +43 -0
  126. package/src/base/blocks/TabsBlock.tsx +94 -0
  127. package/src/base/form/FormField.tsx +607 -0
  128. package/src/base/form/fields/CheckboxField.tsx +56 -0
  129. package/src/base/form/fields/ColorField.tsx +76 -0
  130. package/src/base/form/fields/CurrencyField.tsx +126 -0
  131. package/src/base/form/fields/DateField.tsx +168 -0
  132. package/src/base/form/fields/DateRangeField.tsx +66 -0
  133. package/src/base/form/fields/DocumentField.tsx +222 -0
  134. package/src/base/form/fields/EntityPickerField.tsx +244 -0
  135. package/src/base/form/fields/FileUploadField.tsx +253 -0
  136. package/src/base/form/fields/MultiSelectField.tsx +286 -0
  137. package/src/base/form/fields/NativeSelectField.tsx +67 -0
  138. package/src/base/form/fields/NumberField.tsx +67 -0
  139. package/src/base/form/fields/OtpField.tsx +88 -0
  140. package/src/base/form/fields/PasswordField.tsx +69 -0
  141. package/src/base/form/fields/PhoneField.tsx +64 -0
  142. package/src/base/form/fields/RadioField.tsx +66 -0
  143. package/src/base/form/fields/RatingField.tsx +52 -0
  144. package/src/base/form/fields/SelectField.tsx +76 -0
  145. package/src/base/form/fields/SliderField.tsx +77 -0
  146. package/src/base/form/fields/SlugField.tsx +114 -0
  147. package/src/base/form/fields/StaticField.tsx +25 -0
  148. package/src/base/form/fields/SwitchField.tsx +56 -0
  149. package/src/base/form/fields/TagsField.tsx +128 -0
  150. package/src/base/form/fields/TextField.tsx +55 -0
  151. package/src/base/form/fields/TextareaField.tsx +55 -0
  152. package/src/base/form/fields/document-validation.ts +126 -0
  153. package/src/base/form/fields/field-registry.ts +53 -0
  154. package/src/base/form/fields/register-default-fields.ts +86 -0
  155. package/src/base/form/form-schema-builder.ts +192 -0
  156. package/src/base/form/form-utils.ts +71 -0
  157. package/src/base/hooks/useIsDark.ts +50 -0
  158. package/src/base/hooks/useLazyTabs.ts +98 -0
  159. package/src/base/hooks/usePolling.ts +43 -0
  160. package/src/base/hooks/useRemember.ts +58 -0
  161. package/src/base/hooks/useToast.ts +27 -0
  162. package/src/base/layout/BlockRegion.tsx +39 -0
  163. package/src/base/layout/DashboardLayout.tsx +110 -0
  164. package/src/base/layout/SidebarLayout.tsx +38 -0
  165. package/src/base/layout/StackLayout.tsx +32 -0
  166. package/src/base/layout/WizardLayout.tsx +49 -0
  167. package/src/base/partials/ActionBar/index.tsx +115 -0
  168. package/src/base/partials/ConfirmationDialog/index.tsx +128 -0
  169. package/src/base/partials/DataTable/cell-registry.ts +50 -0
  170. package/src/base/partials/DataTable/cell-renderers.tsx +372 -0
  171. package/src/base/partials/DataTable/index.tsx +1282 -0
  172. package/src/base/partials/DataTable/register-default-cells.ts +37 -0
  173. package/src/base/partials/DataTable/sanitize-html.ts +45 -0
  174. package/src/base/partials/DataTable/types.ts +229 -0
  175. package/src/base/partials/DetailSection/index.tsx +316 -0
  176. package/src/base/partials/EmptyPlaceholder/index.tsx +162 -0
  177. package/src/base/partials/EntityItem/index.tsx +154 -0
  178. package/src/base/partials/FilterBar/index.tsx +256 -0
  179. package/src/base/partials/FormSection/index.tsx +87 -0
  180. package/src/base/partials/LogViewer/JsonBlock.tsx +39 -0
  181. package/src/base/partials/LogViewer/LogEntry.tsx +68 -0
  182. package/src/base/partials/LogViewer/LogViewerToolbar.tsx +71 -0
  183. package/src/base/partials/LogViewer/index.tsx +110 -0
  184. package/src/base/partials/LogViewer/types.ts +28 -0
  185. package/src/base/partials/MarkdownContent/index.tsx +307 -0
  186. package/src/base/partials/MenuBar/index.tsx +80 -0
  187. package/src/base/partials/QuickRecordSheet/index.tsx +59 -0
  188. package/src/base/partials/ResizableSidebar/index.tsx +70 -0
  189. package/src/base/partials/StatRow/index.tsx +28 -0
  190. package/src/base/partials/StatusBar/index.tsx +126 -0
  191. package/src/base/partials/StatusIndicator/index.tsx +61 -0
  192. package/src/base/partials/StepIndicator/index.tsx +63 -0
  193. package/src/base/partials/TableOfContents/index.tsx +78 -0
  194. package/src/base/partials/TimelineList/index.tsx +273 -0
  195. package/src/base/partials/ToggleGroupControl/index.tsx +100 -0
  196. package/src/base/partials/TreeView/index.tsx +75 -0
  197. package/src/base/partials/index.ts +23 -0
  198. package/src/base/shell/AuthShell.tsx +54 -0
  199. package/src/base/shell/BasicShell.tsx +286 -0
  200. package/src/base/shell/ImmersiveShell.tsx +85 -0
  201. package/src/base/shell/partials/EditablePanelContext.tsx +82 -0
  202. package/src/base/shell/partials/EditablePanelProvider.tsx +122 -0
  203. package/src/base/shell/partials/InlineEditablePanel.tsx +239 -0
  204. package/src/base/shell/partials/InspectorContext.tsx +173 -0
  205. package/src/base/shell/partials/InspectorPanel.tsx +65 -0
  206. package/src/base/shell/partials/NavErrorBoundary.tsx +82 -0
  207. package/src/base/shell/partials/OverlayScreen.tsx +67 -0
  208. package/src/base/shell/partials/PageActionButton.tsx +203 -0
  209. package/src/base/theme/appearance.ts +133 -0
  210. package/src/base/theme/host-layout-detector.ts +119 -0
  211. package/src/base/theme/host-theme-detector.ts +146 -0
  212. package/src/base/theme/sidebar-safelist.txt +20 -0
  213. package/src/base/theme/tailwind-theme.css +136 -0
  214. package/src/base/theme/theme-bridge.css +164 -0
  215. package/src/base/theme/theme-context.tsx +142 -0
  216. package/src/base/theme/themes/classic.css +174 -0
  217. package/src/base/theme/tokens.css +290 -0
  218. package/src/base/theme/useHostTheme.ts +95 -0
  219. package/src/base/utils/clipboard.ts +39 -0
  220. package/src/base/utils/conditions.ts +27 -0
  221. package/src/base/utils/icon-registry.ts +78 -0
  222. package/src/base/utils/icons.ts +31 -0
  223. package/src/base/utils/interpolate.ts +9 -0
  224. package/src/base/utils/register-default-icons.ts +163 -0
  225. package/src/base/utils/storage.ts +65 -0
  226. package/src/base/utils/time.ts +139 -0
  227. package/src/contracts/block-data/actions.ts +73 -0
  228. package/src/contracts/block-data/data-display.ts +343 -0
  229. package/src/contracts/block-data/form.ts +164 -0
  230. package/src/contracts/block-data/index.ts +15 -0
  231. package/src/contracts/block-data/interactive.ts +34 -0
  232. package/src/contracts/block-data/shared.ts +44 -0
  233. package/src/contracts/connectors.ts +60 -0
  234. package/src/contracts/generated/contract-schema.ts +1237 -0
  235. package/src/contracts/generated/contract-types.ts +675 -0
  236. package/src/contracts/generated/index.ts +15 -0
  237. package/src/contracts/navigation.ts +59 -0
  238. package/src/contracts/page-contract-schema.ts +40 -0
  239. package/src/contracts/page-contract.ts +79 -0
  240. package/src/contracts/shared-props.ts +92 -0
  241. package/src/engine/ContractPage.tsx +178 -0
  242. package/src/engine/EntityRoutes.tsx +72 -0
  243. package/src/engine/HostSlot.tsx +126 -0
  244. package/src/engine/LazyBlock.tsx +92 -0
  245. package/src/engine/bootstrap.tsx +20 -0
  246. package/src/engine/providers/auth.tsx +87 -0
  247. package/src/engine/providers/error-reporter.tsx +89 -0
  248. package/src/engine/providers/flash.tsx +44 -0
  249. package/src/engine/providers/index.ts +18 -0
  250. package/src/engine/providers/inertia-error-reporter.tsx +61 -0
  251. package/src/engine/providers/progress.tsx +56 -0
  252. package/src/engine/providers/scope.tsx +51 -0
  253. package/src/engine/register-defaults.ts +88 -0
  254. package/src/engine/registries.ts +96 -0
  255. package/src/i18n/I18nProvider.tsx +53 -0
  256. package/src/i18n/MANIFEST.md +101 -0
  257. package/src/i18n/host-resolver.ts +18 -0
  258. package/src/i18n/instance.ts +69 -0
  259. package/src/i18n/locales/en/ui.json +277 -0
  260. package/src/i18n/locales/en/validators.json +13 -0
  261. package/src/i18n/locales/pt-BR/ui.json +277 -0
  262. package/src/i18n/locales/pt-BR/validators.json +13 -0
  263. package/src/i18n/register-strings.ts +10 -0
  264. package/src/i18n/render-label.ts +33 -0
  265. package/src/i18n/resolve-field-error.ts +29 -0
  266. package/src/i18n/useHostString.ts +50 -0
  267. package/src/i18n/useTranslation.ts +83 -0
  268. package/src/lib/actions/resolve-action-target.ts +151 -0
  269. package/src/lib/hooks/use-copy-to-clipboard.ts +37 -0
  270. package/src/lib/hooks/use-file-upload.ts +406 -0
  271. package/src/lib/hooks/use-mobile.ts +21 -0
  272. package/src/lib/host-pending.ts +76 -0
  273. package/src/lib/portal-container.ts +16 -0
  274. package/src/lib/test-ids.ts +40 -0
  275. package/src/lib/utils.ts +6 -0
  276. package/src/primitives/reui/MANIFEST.md +97 -0
  277. package/src/primitives/reui/accordion.tsx +64 -0
  278. package/src/primitives/reui/alert-dialog.tsx +196 -0
  279. package/src/primitives/reui/alert.tsx +92 -0
  280. package/src/primitives/reui/aspect-ratio.tsx +9 -0
  281. package/src/primitives/reui/autocomplete.tsx +343 -0
  282. package/src/primitives/reui/avatar.tsx +109 -0
  283. package/src/primitives/reui/badge.tsx +94 -0
  284. package/src/primitives/reui/breadcrumb.tsx +109 -0
  285. package/src/primitives/reui/button-group.tsx +83 -0
  286. package/src/primitives/reui/button.tsx +64 -0
  287. package/src/primitives/reui/calendar.tsx +220 -0
  288. package/src/primitives/reui/card.tsx +92 -0
  289. package/src/primitives/reui/carousel.tsx +239 -0
  290. package/src/primitives/reui/chart.tsx +388 -0
  291. package/src/primitives/reui/checkbox.tsx +30 -0
  292. package/src/primitives/reui/collapsible.tsx +31 -0
  293. package/src/primitives/reui/combobox.tsx +308 -0
  294. package/src/primitives/reui/command.tsx +182 -0
  295. package/src/primitives/reui/context-menu.tsx +250 -0
  296. package/src/primitives/reui/data-grid/data-grid-column-filter.tsx +172 -0
  297. package/src/primitives/reui/data-grid/data-grid-column-header.tsx +420 -0
  298. package/src/primitives/reui/data-grid/data-grid-column-visibility.tsx +51 -0
  299. package/src/primitives/reui/data-grid/data-grid-pagination.tsx +235 -0
  300. package/src/primitives/reui/data-grid/data-grid-scroll-area.tsx +427 -0
  301. package/src/primitives/reui/data-grid/data-grid-table-dnd-rows.tsx +308 -0
  302. package/src/primitives/reui/data-grid/data-grid-table-dnd.tsx +318 -0
  303. package/src/primitives/reui/data-grid/data-grid-table-virtual.tsx +491 -0
  304. package/src/primitives/reui/data-grid/data-grid-table.tsx +1430 -0
  305. package/src/primitives/reui/data-grid/data-grid.tsx +269 -0
  306. package/src/primitives/reui/data-grid-pagination.tsx +235 -0
  307. package/src/primitives/reui/date-selector.tsx +1353 -0
  308. package/src/primitives/reui/dialog.tsx +158 -0
  309. package/src/primitives/reui/drawer.tsx +133 -0
  310. package/src/primitives/reui/dropdown-menu.tsx +257 -0
  311. package/src/primitives/reui/empty.tsx +104 -0
  312. package/src/primitives/reui/field.tsx +246 -0
  313. package/src/primitives/reui/filters.tsx +1891 -0
  314. package/src/primitives/reui/frame.tsx +170 -0
  315. package/src/primitives/reui/hover-card.tsx +42 -0
  316. package/src/primitives/reui/icon-placeholder.tsx +39 -0
  317. package/src/primitives/reui/index.ts +98 -0
  318. package/src/primitives/reui/input-group.tsx +170 -0
  319. package/src/primitives/reui/input-otp.tsx +75 -0
  320. package/src/primitives/reui/input.tsx +21 -0
  321. package/src/primitives/reui/item.tsx +193 -0
  322. package/src/primitives/reui/kanban.tsx +743 -0
  323. package/src/primitives/reui/kbd.tsx +28 -0
  324. package/src/primitives/reui/label.tsx +22 -0
  325. package/src/primitives/reui/menubar.tsx +274 -0
  326. package/src/primitives/reui/native-select.tsx +62 -0
  327. package/src/primitives/reui/navigation-menu.tsx +168 -0
  328. package/src/primitives/reui/number-field.tsx +250 -0
  329. package/src/primitives/reui/pagination.tsx +127 -0
  330. package/src/primitives/reui/phone-input.tsx +231 -0
  331. package/src/primitives/reui/popover.tsx +87 -0
  332. package/src/primitives/reui/progress.tsx +31 -0
  333. package/src/primitives/reui/radio-group.tsx +43 -0
  334. package/src/primitives/reui/rating.tsx +177 -0
  335. package/src/primitives/reui/resizable.tsx +51 -0
  336. package/src/primitives/reui/scroll-area.tsx +58 -0
  337. package/src/primitives/reui/scrollspy.tsx +240 -0
  338. package/src/primitives/reui/select.tsx +188 -0
  339. package/src/primitives/reui/separator.tsx +28 -0
  340. package/src/primitives/reui/sheet.tsx +141 -0
  341. package/src/primitives/reui/sidebar.tsx +732 -0
  342. package/src/primitives/reui/skeleton.tsx +13 -0
  343. package/src/primitives/reui/slider.tsx +61 -0
  344. package/src/primitives/reui/sonner.tsx +47 -0
  345. package/src/primitives/reui/sortable.tsx +414 -0
  346. package/src/primitives/reui/spinner.tsx +16 -0
  347. package/src/primitives/reui/stepper.tsx +484 -0
  348. package/src/primitives/reui/svgs/claudeAiIcon.tsx +12 -0
  349. package/src/primitives/reui/svgs/gemini.tsx +171 -0
  350. package/src/primitives/reui/svgs/openai.tsx +9 -0
  351. package/src/primitives/reui/svgs/openaiDark.tsx +12 -0
  352. package/src/primitives/reui/switch.tsx +33 -0
  353. package/src/primitives/reui/table.tsx +114 -0
  354. package/src/primitives/reui/tabs.tsx +91 -0
  355. package/src/primitives/reui/textarea.tsx +18 -0
  356. package/src/primitives/reui/timeline.tsx +219 -0
  357. package/src/primitives/reui/toggle-group.tsx +83 -0
  358. package/src/primitives/reui/toggle.tsx +45 -0
  359. package/src/primitives/reui/tooltip.tsx +55 -0
  360. package/src/primitives/reui/tree.tsx +247 -0
  361. package/src/theme.css +71 -0
  362. package/dist-lib/chunks/subpath-q4Q2zg_p.js +0 -153
@@ -0,0 +1,403 @@
1
+ /**
2
+ * DenseTableBlock — contract-driven data table with sort, filter, pagination.
3
+ *
4
+ * Maps BlockDescriptor<DenseTableBlockData> to DataTable partial props.
5
+ * Server interactions use Inertia partial reload.
6
+ *
7
+ * @see NV-05-ux-blocks.md §1
8
+ */
9
+
10
+ import { useCallback, useEffect, useRef, useState, type ReactElement } from "react";
11
+ import { router } from "@inertiajs/core";
12
+
13
+ import { usePolling } from "@/base/hooks/usePolling";
14
+ import { ConfirmationDialog } from "@/base/partials/ConfirmationDialog";
15
+ import { DataTable } from "@/base/partials/DataTable";
16
+ import type { DataTableParamChange } from "@/base/partials/DataTable/types";
17
+ import { useEditablePanel } from "@/base/shell/partials/EditablePanelContext";
18
+ import { useInspector } from "@/base/shell/partials/InspectorContext";
19
+ import { evaluateCondition } from "@/base/utils/conditions";
20
+ import { interpolate } from "@/base/utils/interpolate";
21
+ import type { ActionConfirmation, DenseTableBlockData } from "@/contracts/block-data";
22
+ import type { BlockProps } from "@/engine/registries";
23
+ import { renderLabel } from "@/i18n/render-label";
24
+ import { useTranslation } from "@/i18n/useTranslation";
25
+ import { resolveActionTarget } from "@/lib/actions/resolve-action-target";
26
+
27
+ export function DenseTableBlock({ block }: BlockProps<DenseTableBlockData>): ReactElement {
28
+ const { t } = useTranslation();
29
+ const { data, key, meta } = block;
30
+ const isLoading = meta?.loading === true;
31
+ const clientSide = (meta as Record<string, unknown> | undefined)?.clientSide === true;
32
+ const rowKeyField = (meta?.rowKey as string) ?? "id";
33
+ const reloadKey = (meta?.partialReloadKey as string) ?? key;
34
+ // clientSide tables filter in-browser; seed the search box from the URL
35
+ // ?search= param so tag-chip links (e.g. /tickets?search=<tag>) and shareable
36
+ // search URLs actually filter on load. Server mode echoes search via the
37
+ // contract, so this only applies to clientSide.
38
+ const initialClientSearch =
39
+ clientSide && typeof window !== "undefined"
40
+ ? (new URLSearchParams(window.location.search).get("search") ?? "")
41
+ : "";
42
+
43
+ const { select, selectedId, enabled: inspectorEnabled } = useInspector();
44
+ const { open: openPanel, enabled: panelEnabled } = useEditablePanel();
45
+
46
+ usePolling(block.poll);
47
+
48
+ // Confirmation dialog state
49
+ const [confirmDialog, setConfirmDialog] = useState<{
50
+ open: boolean;
51
+ confirmation: ActionConfirmation;
52
+ row: Record<string, unknown>;
53
+ href?: string;
54
+ method?: string;
55
+ isNavigation?: boolean;
56
+ waiting: boolean;
57
+ /** Request body for bulk actions (e.g. { ids }); row actions leave this unset. */
58
+ payload?: Record<string, unknown>;
59
+ } | null>(null);
60
+
61
+ // Auto-close waitForPolling dialog when polling stops
62
+ const pollingEnabled = (block.poll?.intervalMs ?? 0) > 0;
63
+ const prevPollingRef = useRef(pollingEnabled);
64
+ useEffect(() => {
65
+ if (prevPollingRef.current && !pollingEnabled && confirmDialog?.waiting) {
66
+ setConfirmDialog(null);
67
+ }
68
+ prevPollingRef.current = pollingEnabled;
69
+ }, [pollingEnabled, confirmDialog?.waiting]);
70
+
71
+ const handleRowClick = useCallback(
72
+ (row: Record<string, unknown>) => {
73
+ if (inspectorEnabled) {
74
+ const id = row.id ?? row[rowKeyField];
75
+ if (id != null) select(id as string | number);
76
+ return;
77
+ }
78
+ if (data.rowHref) {
79
+ const href = interpolate(data.rowHref, row);
80
+ router.visit(href);
81
+ }
82
+ },
83
+ [inspectorEnabled, rowKeyField, select, data.rowHref],
84
+ );
85
+
86
+ // Auto-select first row once, when the inspector is enabled and the page
87
+ // first loads. Gated on a ref rather than `selectedId == null` — closing
88
+ // the drawer also sets selectedId back to null, and re-running on that
89
+ // would immediately re-select the first row, making the drawer's close
90
+ // button appear to do nothing.
91
+ const hasAutoSelectedRef = useRef(false);
92
+ useEffect(() => {
93
+ if (!hasAutoSelectedRef.current && inspectorEnabled && data.rows.length > 0) {
94
+ hasAutoSelectedRef.current = true;
95
+ const firstRow = data.rows[0];
96
+ const id = firstRow.id ?? firstRow[rowKeyField];
97
+ if (id != null) select(id as string | number);
98
+ }
99
+ }, [inspectorEnabled, data.rows, rowKeyField, select]);
100
+
101
+ const handleParamChange = useCallback(
102
+ (params: DataTableParamChange) => {
103
+ const queryParams: Record<string, string | number> = {};
104
+
105
+ // DataTable speaks 0-based pageIndex; the block contract is 1-based (see the
106
+ // `page - 1` when feeding `pagination` below, and `'page' => 1` for a first
107
+ // page in the PHP builders). Without this conversion the block read 1-based
108
+ // and wrote 0-based, so paging never advanced: the server echoed page N, the
109
+ // block rendered it as N-1, and the next click re-sent the same N.
110
+ if (params.page !== undefined) queryParams.page = params.page + 1;
111
+ if (params.perPage !== undefined) queryParams.per_page = params.perPage;
112
+ if (params.sort?.key) {
113
+ queryParams.sort = params.sort.key;
114
+ queryParams.direction = params.sort.direction;
115
+ }
116
+ if (params.search !== undefined) queryParams.search = params.search;
117
+ if (params.filters) {
118
+ // A filter the user just cleared has to be sent as an empty value, not
119
+ // left out. This request is a partial patch merged onto the query the
120
+ // server already holds, so a key that merely stops appearing is
121
+ // indistinguishable from one this request had no opinion about — the old
122
+ // value survives and clearing does nothing on screen. Removing the only
123
+ // active filter sends `filters: {}`, which used to produce no key at all.
124
+ // Seed every currently applied key as empty, then let the ones that
125
+ // survived overwrite their own entry.
126
+ Object.keys(data.filters?.applied ?? {}).forEach((k) => {
127
+ queryParams[`filter[${k}]`] = "";
128
+ });
129
+ Object.entries(params.filters).forEach(([k, v]) => {
130
+ queryParams[`filter[${k}]`] = Array.isArray(v) ? v.join(",") : v;
131
+ });
132
+ }
133
+
134
+ router.get(window.location.pathname, queryParams as Record<string, string>, {
135
+ preserveState: true,
136
+ preserveScroll: true,
137
+ only: [reloadKey],
138
+ });
139
+ },
140
+ [reloadKey, data.filters?.applied],
141
+ );
142
+
143
+ // The toolbar's star. The action comes from the contract already carrying the
144
+ // current view in its target, so the block does not have to know what a view
145
+ // is — it resolves the target the same way every other action here does.
146
+ const handleSaveView = useCallback(() => {
147
+ const action = data.saveViewAction;
148
+ if (!action) return;
149
+ const target = resolveActionTarget(action);
150
+ if (target.kind === "link") {
151
+ router.visit(target.url, { preserveState: true, preserveScroll: true });
152
+ return;
153
+ }
154
+ router[target.method as "post" | "put" | "patch" | "delete"](
155
+ target.url,
156
+ {},
157
+ { preserveState: true, preserveScroll: true },
158
+ );
159
+ }, [data.saveViewAction]);
160
+
161
+ const handleBulkAction = useCallback(
162
+ (actionId: string, selectedKeys: string[]) => {
163
+ const action = data.bulkActions?.find((a) => a.id === actionId);
164
+ if (!action) return;
165
+ const target = resolveActionTarget(action);
166
+ const method = (target.kind === "link" ? "post" : target.method) as
167
+ | "post"
168
+ | "put"
169
+ | "patch"
170
+ | "delete";
171
+
172
+ // Route through the confirmation dialog when the bulk action declares one
173
+ // — symmetry with row actions. Destructive bulk ops must not fire silently.
174
+ if (action.confirmation) {
175
+ setConfirmDialog({
176
+ open: true,
177
+ confirmation: action.confirmation,
178
+ row: { count: selectedKeys.length },
179
+ href: target.url,
180
+ method,
181
+ isNavigation: false,
182
+ waiting: false,
183
+ payload: { ids: selectedKeys },
184
+ });
185
+ return;
186
+ }
187
+
188
+ router[method](
189
+ target.url,
190
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Inertia router payload typing
191
+ { ids: selectedKeys } as Record<string, unknown> as any,
192
+ {
193
+ preserveState: true,
194
+ only: [reloadKey],
195
+ },
196
+ );
197
+ },
198
+ [reloadKey, data.bulkActions],
199
+ );
200
+
201
+ // Map block columns to DataTable columns
202
+ const columns = data.columns.map((col) => ({
203
+ key: col.key,
204
+ label: renderLabel(col.label, t),
205
+ type:
206
+ col.variant === "badge"
207
+ ? ("status" as const)
208
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any -- column variant passthrough
209
+ ((col.variant as any) ?? ("text" as const)),
210
+ timestampFormat: col.timestampFormat,
211
+ sortable: col.sortable,
212
+ minWidth: col.minWidth,
213
+ maxWidth: col.maxWidth,
214
+ statusMap: col.statusMap,
215
+ href: col.href,
216
+ entityType: col.entity?.type,
217
+ entityIdField: col.entity?.id,
218
+ }));
219
+
220
+ // Map sort
221
+ const sort = data.sort?.column
222
+ ? {
223
+ key: data.sort.column,
224
+ direction: data.sort.direction ?? ("asc" as const),
225
+ }
226
+ : undefined;
227
+
228
+ // Map row actions with condition evaluation and confirmation support
229
+ const rowActions = data.rowActions?.map((action) => {
230
+ const target = resolveActionTarget(action);
231
+ return {
232
+ id: action.id,
233
+ label: renderLabel(action.label, t),
234
+ icon: action.icon,
235
+ intent: action.intent === "danger" ? ("danger" as const) : ("default" as const),
236
+ variant: action.variant,
237
+ onAction: (row: Record<string, unknown>) => {
238
+ const resolvedHref = interpolate(target.url, row);
239
+
240
+ // Editable panel: open the side drawer for this row (data resolved from
241
+ // the page-level `editablePanel` config). No navigation, no confirmation.
242
+ if (target.kind === "panel") {
243
+ if (panelEnabled) {
244
+ const id = row[rowKeyField];
245
+ if (id != null) openPanel(id as string | number);
246
+ }
247
+ return;
248
+ }
249
+
250
+ if (action.confirmation) {
251
+ setConfirmDialog({
252
+ open: true,
253
+ confirmation: action.confirmation,
254
+ row,
255
+ href: resolvedHref,
256
+ method: target.method,
257
+ isNavigation: target.kind === "link",
258
+ waiting: false,
259
+ });
260
+ return;
261
+ }
262
+
263
+ // Execute directly (no confirmation)
264
+ if (target.kind === "link") {
265
+ router.visit(resolvedHref);
266
+ } else if (target.method === "delete") {
267
+ router.delete(resolvedHref, {
268
+ preserveState: true,
269
+ only: [reloadKey],
270
+ });
271
+ } else {
272
+ const method = target.method as "post" | "put" | "patch";
273
+ router[method](resolvedHref, {} as never, {
274
+ preserveState: true,
275
+ only: [reloadKey],
276
+ });
277
+ }
278
+ },
279
+ hidden: (row: Record<string, unknown>) => {
280
+ if (action.visible_when) {
281
+ return !evaluateCondition(action.visible_when, row);
282
+ }
283
+ return false;
284
+ },
285
+ disabled: (row: Record<string, unknown>) => {
286
+ if (action.loading_when && evaluateCondition(action.loading_when, row)) return true;
287
+ if (action.disabled_when && evaluateCondition(action.disabled_when, row)) return true;
288
+ return false;
289
+ },
290
+ loading: (row: Record<string, unknown>) => {
291
+ if (action.loading_when) return evaluateCondition(action.loading_when, row);
292
+ return false;
293
+ },
294
+ disabledReason: (row: Record<string, unknown>) => {
295
+ if (action.disabled_reason_field)
296
+ return String(row[action.disabled_reason_field] ?? "") || undefined;
297
+ return undefined;
298
+ },
299
+ };
300
+ });
301
+
302
+ // Confirmation dialog handlers
303
+ const handleConfirm = useCallback(() => {
304
+ if (!confirmDialog) return;
305
+ const { href, method, isNavigation, confirmation, payload } = confirmDialog;
306
+
307
+ if (confirmation.waitForPolling) {
308
+ setConfirmDialog((prev) => (prev ? { ...prev, waiting: true } : null));
309
+ } else {
310
+ setConfirmDialog(null);
311
+ }
312
+
313
+ if (href) {
314
+ if (isNavigation) {
315
+ router.visit(href);
316
+ } else if (method === "delete") {
317
+ // payload carries the bulk { ids } body, if any; row deletes have none.
318
+ router.delete(href, {
319
+ ...(payload ? { data: payload as never } : {}),
320
+ preserveState: true,
321
+ only: [reloadKey],
322
+ });
323
+ } else {
324
+ const reqMethod = (method ?? "post") as "post" | "put" | "patch";
325
+ router[reqMethod](href, (payload ?? {}) as never, {
326
+ preserveState: true,
327
+ only: [reloadKey],
328
+ });
329
+ }
330
+ }
331
+ }, [confirmDialog, reloadKey]);
332
+
333
+ const handleCloseConfirm = useCallback(() => {
334
+ setConfirmDialog(null);
335
+ }, []);
336
+
337
+ return (
338
+ <>
339
+ <DataTable
340
+ columns={columns}
341
+ rows={data.rows}
342
+ rowKey={rowKeyField}
343
+ pagination={
344
+ data.pagination
345
+ ? {
346
+ ...data.pagination,
347
+ page: Math.max(0, data.pagination.page - 1),
348
+ }
349
+ : undefined
350
+ }
351
+ sort={sort}
352
+ filters={data.filters?.available}
353
+ appliedFilters={data.filters?.applied}
354
+ rowActions={rowActions}
355
+ actionsAlwaysVisible={meta?.actionsAlwaysVisible === true}
356
+ bulkActions={data.bulkActions}
357
+ onRowClick={inspectorEnabled || data.rowHref ? handleRowClick : undefined}
358
+ selectedRowKey={inspectorEnabled && selectedId ? String(selectedId) : undefined}
359
+ isLoading={isLoading}
360
+ searchValue={initialClientSearch}
361
+ searchPlaceholder={data.searchPlaceholder}
362
+ emptyStateIcon={data.emptyState?.icon}
363
+ emptyStateTitle={data.emptyState?.title}
364
+ emptyStateDescription={data.emptyState?.description}
365
+ emptyStateCTA={
366
+ data.emptyState?.cta
367
+ ? {
368
+ label: data.emptyState.cta.label,
369
+ href: data.emptyState.cta.href,
370
+ }
371
+ : undefined
372
+ }
373
+ onParamChange={clientSide ? undefined : handleParamChange}
374
+ onBulkAction={handleBulkAction}
375
+ onSaveView={data.saveViewAction ? handleSaveView : undefined}
376
+ savedView={data.saveViewActive ?? false}
377
+ saveViewLabel={
378
+ data.saveViewAction ? renderLabel(data.saveViewAction.label, t) || undefined : undefined
379
+ }
380
+ remember={block.remember ?? false}
381
+ rememberKey={key}
382
+ clientSide={clientSide}
383
+ />
384
+ {confirmDialog && (
385
+ <ConfirmationDialog
386
+ open={confirmDialog.open}
387
+ onClose={handleCloseConfirm}
388
+ onConfirm={handleConfirm}
389
+ title={renderLabel(confirmDialog.confirmation.title, t)}
390
+ message={interpolate(
391
+ renderLabel(confirmDialog.confirmation.message, t),
392
+ confirmDialog.row,
393
+ )}
394
+ intent={confirmDialog.confirmation.intent}
395
+ confirmLabel={renderLabel(confirmDialog.confirmation.confirmLabel, t) || undefined}
396
+ cancelLabel={renderLabel(confirmDialog.confirmation.cancelLabel, t) || undefined}
397
+ waiting={confirmDialog.waiting}
398
+ waitingMessage={confirmDialog.confirmation.waitingMessage}
399
+ />
400
+ )}
401
+ </>
402
+ );
403
+ }
@@ -0,0 +1,189 @@
1
+ /**
2
+ * DetailPanelBlock — sectioned key-value detail panel.
3
+ *
4
+ * Delegates to DetailSection partial (created by partials-builder agent).
5
+ * Stub implementation until DetailSection is available — renders fields directly.
6
+ *
7
+ * @see NV-05-ux-blocks.md §4
8
+ */
9
+
10
+ import { useCallback, useState, type ReactElement } from "react";
11
+ import { CheckmarkCircle01Icon, Copy01Icon } from "@hugeicons/core-free-icons";
12
+ import { HugeiconsIcon } from "@hugeicons/react";
13
+ import { router } from "@inertiajs/core";
14
+ import type { TFunction } from "i18next";
15
+
16
+ import { ConfirmationDialog } from "@/base/partials/ConfirmationDialog";
17
+ import { getIcon } from "@/base/utils/icons";
18
+ import type {
19
+ DetailPanelBlockData,
20
+ DetailPanelFieldDef,
21
+ ExecutableAction,
22
+ } from "@/contracts/block-data";
23
+ import { EntityLink } from "@/engine/EntityRoutes";
24
+ import type { BlockProps } from "@/engine/registries";
25
+ import { renderLabel } from "@/i18n/render-label";
26
+ import { useTranslation } from "@/i18n/useTranslation";
27
+ import { resolveActionTarget } from "@/lib/actions/resolve-action-target";
28
+ import { Button } from "@/primitives/reui/button";
29
+ import { Skeleton } from "@/primitives/reui/skeleton";
30
+
31
+ export function DetailPanelBlock({ block }: BlockProps<DetailPanelBlockData>): ReactElement {
32
+ const { t } = useTranslation();
33
+ const { data, meta } = block;
34
+ const isLoading = meta?.loading === true;
35
+
36
+ if (isLoading) {
37
+ return (
38
+ <div className="space-y-6">
39
+ <Skeleton className="h-5 w-32" />
40
+ {[1, 2, 3, 4].map((i) => (
41
+ <div key={i} className="grid grid-cols-[1fr_2fr] gap-4">
42
+ <Skeleton className="h-4 w-20" />
43
+ <Skeleton className="h-4 w-40" />
44
+ </div>
45
+ ))}
46
+ </div>
47
+ );
48
+ }
49
+
50
+ const copyableText = meta?.copyableText as string | undefined;
51
+
52
+ return (
53
+ <div className="space-y-8">
54
+ {copyableText && <CopyReportButton text={copyableText} />}
55
+ {data.sections.map((section) => (
56
+ <section key={section.id} role="region" aria-label={renderLabel(section.title, t)}>
57
+ <div className="mb-4 flex items-center justify-between">
58
+ <h3 id={`${section.id}-heading`} className="text-foreground text-lg font-semibold">
59
+ {renderLabel(section.title, t)}
60
+ </h3>
61
+ {section.actions && section.actions.length > 0 && (
62
+ <div className="flex gap-2">
63
+ {section.actions.map((action) => (
64
+ <SectionActionButton key={action.id} action={action} />
65
+ ))}
66
+ </div>
67
+ )}
68
+ </div>
69
+ <dl className="grid gap-3 md:grid-cols-[1fr_2fr]">
70
+ {section.fields.map((field) => (
71
+ <div key={field.key} className="contents">
72
+ <dt className="text-muted-foreground text-sm md:text-right">
73
+ {renderLabel(field.label, t)}
74
+ </dt>
75
+ <dd className="text-foreground text-sm">
76
+ <FieldValue field={field} t={t} />
77
+ </dd>
78
+ </div>
79
+ ))}
80
+ </dl>
81
+ </section>
82
+ ))}
83
+ </div>
84
+ );
85
+ }
86
+
87
+ function SectionActionButton({ action }: { action: ExecutableAction }): ReactElement {
88
+ const { t } = useTranslation();
89
+ const [showConfirm, setShowConfirm] = useState(false);
90
+ const Icon = action.icon ? getIcon(action.icon) : undefined;
91
+
92
+ const executeAction = useCallback(() => {
93
+ const target = resolveActionTarget(action);
94
+ if (target.kind === "link") {
95
+ router.visit(target.url);
96
+ } else if (target.method === "delete") {
97
+ router.delete(target.url, { preserveState: true });
98
+ } else {
99
+ const method = target.method as "post" | "put" | "patch";
100
+ router[method](target.url, {} as never, { preserveState: true });
101
+ }
102
+ }, [action]);
103
+
104
+ const handleClick = useCallback(() => {
105
+ if (action.confirmation) {
106
+ setShowConfirm(true);
107
+ } else {
108
+ executeAction();
109
+ }
110
+ }, [action.confirmation, executeAction]);
111
+
112
+ const confirmation = action.confirmation;
113
+
114
+ return (
115
+ <>
116
+ <Button
117
+ variant={action.intent === "danger" ? "destructive" : "outline"}
118
+ size="sm"
119
+ onClick={handleClick}
120
+ disabled={action.disabled}
121
+ >
122
+ {Icon && <HugeiconsIcon icon={Icon} size={14} className="mr-1.5" />}
123
+ {renderLabel(action.label, t)}
124
+ </Button>
125
+ {confirmation && (
126
+ <ConfirmationDialog
127
+ open={showConfirm}
128
+ onClose={() => setShowConfirm(false)}
129
+ onConfirm={() => {
130
+ executeAction();
131
+ setShowConfirm(false);
132
+ }}
133
+ title={renderLabel(confirmation.title, t)}
134
+ message={renderLabel(confirmation.message, t)}
135
+ intent={confirmation.intent}
136
+ confirmLabel={
137
+ confirmation.confirmLabel ? renderLabel(confirmation.confirmLabel, t) : undefined
138
+ }
139
+ cancelLabel={
140
+ confirmation.cancelLabel ? renderLabel(confirmation.cancelLabel, t) : undefined
141
+ }
142
+ />
143
+ )}
144
+ </>
145
+ );
146
+ }
147
+
148
+ function FieldValue({ field, t }: { field: DetailPanelFieldDef; t: TFunction }): ReactElement {
149
+ if (field.value === null || field.value === undefined) {
150
+ return <span className="text-muted-foreground">&mdash;</span>;
151
+ }
152
+ if (typeof field.value === "boolean") {
153
+ return <>{field.value ? t("middag.ui.common.yes") : t("middag.ui.common.no")}</>;
154
+ }
155
+ const text = String(field.value);
156
+ // Entity link resolution
157
+ if (field.entity) {
158
+ return (
159
+ <EntityLink type={field.entity.type} id={field.entity.id}>
160
+ {text}
161
+ </EntityLink>
162
+ );
163
+ }
164
+ return <>{text}</>;
165
+ }
166
+
167
+ function CopyReportButton({ text }: { text: string }): ReactElement {
168
+ const { t } = useTranslation();
169
+ const [copied, setCopied] = useState(false);
170
+
171
+ async function handleCopy() {
172
+ try {
173
+ await navigator.clipboard.writeText(text);
174
+ setCopied(true);
175
+ setTimeout(() => setCopied(false), 2000);
176
+ } catch {
177
+ // Clipboard API may fail in insecure contexts.
178
+ }
179
+ }
180
+
181
+ return (
182
+ <div className="flex justify-end">
183
+ <Button variant="outline" size="sm" onClick={handleCopy}>
184
+ <HugeiconsIcon icon={copied ? CheckmarkCircle01Icon : Copy01Icon} size={14} />
185
+ {copied ? t("middag.ui.detail_panel.copied") : t("middag.ui.detail_panel.copy_report")}
186
+ </Button>
187
+ </div>
188
+ );
189
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * EmptyStateBlock — variant-aware empty state with icon, description, and CTA.
3
+ *
4
+ * Delegates to EmptyPlaceholder partial.
5
+ *
6
+ * @see NV-05-ux-blocks.md §7
7
+ */
8
+
9
+ import type { ReactElement } from "react";
10
+ import { router } from "@inertiajs/core";
11
+
12
+ import { EmptyPlaceholder } from "@/base/partials/EmptyPlaceholder";
13
+ import type { EmptyStateBlockData } from "@/contracts/block-data";
14
+ import type { BlockProps } from "@/engine/registries";
15
+ import { renderLabel } from "@/i18n/render-label";
16
+ import { useTranslation } from "@/i18n/useTranslation";
17
+
18
+ export function EmptyStateBlock({ block }: BlockProps<EmptyStateBlockData>): ReactElement {
19
+ const { t } = useTranslation();
20
+ const { data, title } = block;
21
+
22
+ return (
23
+ <div role="status">
24
+ <EmptyPlaceholder
25
+ variant={data.variant}
26
+ icon={data.icon}
27
+ lottieUrl={data.lottieUrl}
28
+ title={renderLabel(title ?? data.variant ?? t("middag.ui.empty_state.default_title"), t)}
29
+ description={data.description}
30
+ cta={
31
+ data.cta
32
+ ? {
33
+ label: data.cta.label,
34
+ href: data.cta.method === "post" ? undefined : data.cta.href,
35
+ onClick:
36
+ data.cta.method === "post" && data.cta.href
37
+ ? () => router.post(data.cta!.href!)
38
+ : undefined,
39
+ }
40
+ : undefined
41
+ }
42
+ ctaSecondary={data.ctaSecondary}
43
+ />
44
+ </div>
45
+ );
46
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * FormPanelBlock.lazy — Suspense wrapper that code-splits the heavy form_panel block.
3
+ *
4
+ * react-hook-form + zod (+ @hookform/resolvers) load only when a page actually
5
+ * renders a form_panel. register-defaults registers THIS wrapper, not the heavy
6
+ * module, keeping the engine's base bundle lean (mirrors the field lazies in
7
+ * FormField.tsx).
8
+ */
9
+
10
+ import { lazy, Suspense, type ReactElement } from "react";
11
+
12
+ import type { FormPanelBlockData } from "@/contracts/block-data";
13
+ import type { BlockProps } from "@/engine/registries";
14
+ import { Skeleton } from "@/primitives/reui/skeleton";
15
+
16
+ const LazyFormPanelBlock = lazy(() =>
17
+ import("@/base/blocks/FormPanelBlock").then((m) => ({ default: m.FormPanelBlock })),
18
+ );
19
+
20
+ /** Form-shaped placeholder shown while the heavy form_panel chunk loads. */
21
+ function FormSkeleton(): ReactElement {
22
+ return (
23
+ <div className="mx-auto max-w-[720px] space-y-6">
24
+ <Skeleton className="h-9 w-full rounded-md" />
25
+ <Skeleton className="h-9 w-full rounded-md" />
26
+ <Skeleton className="h-24 w-full rounded-md" />
27
+ <Skeleton className="h-9 w-40 rounded-md" />
28
+ </div>
29
+ );
30
+ }
31
+
32
+ export function FormPanelBlockLazy(props: BlockProps<FormPanelBlockData>): ReactElement {
33
+ return (
34
+ <Suspense fallback={<FormSkeleton />}>
35
+ <LazyFormPanelBlock {...props} />
36
+ </Suspense>
37
+ );
38
+ }