@middag-io/react 0.45.0 → 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 (320) hide show
  1. package/docs/public/schemas/ai-contract-manifest.json +1820 -0
  2. package/docs/public/schemas/blocks.json +445 -0
  3. package/docs/public/schemas/components.json +166 -0
  4. package/docs/public/schemas/connectors.json +97 -0
  5. package/docs/public/schemas/fragment.json +2329 -0
  6. package/docs/public/schemas/manifest.json +119 -0
  7. package/docs/public/schemas/navigation.json +72 -0
  8. package/docs/public/schemas/page-contract.json +2329 -0
  9. package/docs/public/schemas/shared-props.json +118 -0
  10. package/docs/public/schemas/theme-defaults.json +253 -0
  11. package/docs/public/schemas/theme.json +401 -0
  12. package/package.json +109 -3
  13. package/src/assets/lottie/calendar/schedule-1.json +1 -0
  14. package/src/assets/lottie/calendar/schedule-2.json +1 -0
  15. package/src/assets/lottie/celebration/confetti-1.json +1 -0
  16. package/src/assets/lottie/celebration/confetti-2.json +1 -0
  17. package/src/assets/lottie/celebration/confetti-3.json +1 -0
  18. package/src/assets/lottie/cloud/cloud-1.json +1 -0
  19. package/src/assets/lottie/cloud/cloud-2.json +1 -0
  20. package/src/assets/lottie/connection/network-1.json +1 -0
  21. package/src/assets/lottie/connection/network-2.json +1 -0
  22. package/src/assets/lottie/connection/network-3.json +1 -0
  23. package/src/assets/lottie/dashboard/analytics-1.json +1 -0
  24. package/src/assets/lottie/dashboard/analytics-2.json +1 -0
  25. package/src/assets/lottie/dashboard/analytics-3.json +1 -0
  26. package/src/assets/lottie/email/mail-1.json +1 -0
  27. package/src/assets/lottie/email/mail-2.json +1 -0
  28. package/src/assets/lottie/email/mail-3.json +1 -0
  29. package/src/assets/lottie/empty-state/empty-1.json +1 -0
  30. package/src/assets/lottie/empty-state/empty-2.json +1 -0
  31. package/src/assets/lottie/empty-state/empty-3.json +1 -0
  32. package/src/assets/lottie/error/warning-1.json +1 -0
  33. package/src/assets/lottie/error/warning-2.json +1 -0
  34. package/src/assets/lottie/error/warning-3.json +1 -0
  35. package/src/assets/lottie/index.ts +49 -0
  36. package/src/assets/lottie/loading/spinner-1.json +1 -0
  37. package/src/assets/lottie/loading/spinner-2.json +1 -0
  38. package/src/assets/lottie/loading/spinner-3.json +1 -0
  39. package/src/assets/lottie/maintenance/construction-1.json +1 -0
  40. package/src/assets/lottie/maintenance/construction-2.json +1 -0
  41. package/src/assets/lottie/maintenance/construction-3.json +1 -0
  42. package/src/assets/lottie/not-found/404-1.json +1 -0
  43. package/src/assets/lottie/not-found/404-2.json +1 -0
  44. package/src/assets/lottie/not-found/404-3.json +1 -0
  45. package/src/assets/lottie/notification/bell-1.json +1 -0
  46. package/src/assets/lottie/notification/bell-2.json +1 -0
  47. package/src/assets/lottie/notification/bell-3.json +1 -0
  48. package/src/assets/lottie/onboarding/welcome-1.json +1 -0
  49. package/src/assets/lottie/onboarding/welcome-2.json +1 -0
  50. package/src/assets/lottie/onboarding/welcome-3.json +1 -0
  51. package/src/assets/lottie/payment/wallet-1.json +1 -0
  52. package/src/assets/lottie/payment/wallet-2.json +1 -0
  53. package/src/assets/lottie/payment/wallet-3.json +1 -0
  54. package/src/assets/lottie/search/search-1.json +1 -0
  55. package/src/assets/lottie/search/search-2.json +1 -0
  56. package/src/assets/lottie/search/search-3.json +1 -0
  57. package/src/assets/lottie/security/lock-1.json +1 -0
  58. package/src/assets/lottie/security/lock-2.json +1 -0
  59. package/src/assets/lottie/security/lock-3.json +1 -0
  60. package/src/assets/lottie/settings/gear-1.json +1 -0
  61. package/src/assets/lottie/settings/gear-2.json +1 -0
  62. package/src/assets/lottie/settings/gear-3.json +1 -0
  63. package/src/assets/lottie/success/check-1.json +1 -0
  64. package/src/assets/lottie/success/check-2.json +1 -0
  65. package/src/assets/lottie/success/check-3.json +1 -0
  66. package/src/assets/lottie/upload/upload-1.json +1 -0
  67. package/src/assets/lottie/upload/upload-2.json +1 -0
  68. package/src/assets/lottie/upload/upload-3.json +1 -0
  69. package/src/assets/lottie/user/profile-1.json +1 -0
  70. package/src/assets/lottie/user/profile-2.json +1 -0
  71. package/src/assets/lottie/user/profile-3.json +1 -0
  72. package/src/base/blocks/ActionGridBlock.tsx +151 -0
  73. package/src/base/blocks/ActivityTimelineBlock.tsx +180 -0
  74. package/src/base/blocks/CardGridBlock.tsx +384 -0
  75. package/src/base/blocks/ChartBlock.tsx +81 -0
  76. package/src/base/blocks/DenseTableBlock.tsx +403 -0
  77. package/src/base/blocks/DetailPanelBlock.tsx +189 -0
  78. package/src/base/blocks/EmptyStateBlock.tsx +46 -0
  79. package/src/base/blocks/FormPanelBlock.lazy.tsx +38 -0
  80. package/src/base/blocks/FormPanelBlock.tsx +480 -0
  81. package/src/base/blocks/LinkListBlock.tsx +94 -0
  82. package/src/base/blocks/MarkdownPanelBlock.tsx +60 -0
  83. package/src/base/blocks/MetricCardBlock.tsx +128 -0
  84. package/src/base/blocks/StatusStripBlock.tsx +43 -0
  85. package/src/base/blocks/TabsBlock.tsx +94 -0
  86. package/src/base/form/FormField.tsx +607 -0
  87. package/src/base/form/fields/CheckboxField.tsx +56 -0
  88. package/src/base/form/fields/ColorField.tsx +76 -0
  89. package/src/base/form/fields/CurrencyField.tsx +126 -0
  90. package/src/base/form/fields/DateField.tsx +168 -0
  91. package/src/base/form/fields/DateRangeField.tsx +66 -0
  92. package/src/base/form/fields/DocumentField.tsx +222 -0
  93. package/src/base/form/fields/EntityPickerField.tsx +244 -0
  94. package/src/base/form/fields/FileUploadField.tsx +253 -0
  95. package/src/base/form/fields/MultiSelectField.tsx +286 -0
  96. package/src/base/form/fields/NativeSelectField.tsx +67 -0
  97. package/src/base/form/fields/NumberField.tsx +67 -0
  98. package/src/base/form/fields/OtpField.tsx +88 -0
  99. package/src/base/form/fields/PasswordField.tsx +69 -0
  100. package/src/base/form/fields/PhoneField.tsx +64 -0
  101. package/src/base/form/fields/RadioField.tsx +66 -0
  102. package/src/base/form/fields/RatingField.tsx +52 -0
  103. package/src/base/form/fields/SelectField.tsx +76 -0
  104. package/src/base/form/fields/SliderField.tsx +77 -0
  105. package/src/base/form/fields/SlugField.tsx +114 -0
  106. package/src/base/form/fields/StaticField.tsx +25 -0
  107. package/src/base/form/fields/SwitchField.tsx +56 -0
  108. package/src/base/form/fields/TagsField.tsx +128 -0
  109. package/src/base/form/fields/TextField.tsx +55 -0
  110. package/src/base/form/fields/TextareaField.tsx +55 -0
  111. package/src/base/form/fields/document-validation.ts +126 -0
  112. package/src/base/form/fields/field-registry.ts +53 -0
  113. package/src/base/form/fields/register-default-fields.ts +86 -0
  114. package/src/base/form/form-schema-builder.ts +192 -0
  115. package/src/base/form/form-utils.ts +71 -0
  116. package/src/base/hooks/useIsDark.ts +50 -0
  117. package/src/base/hooks/useLazyTabs.ts +98 -0
  118. package/src/base/hooks/usePolling.ts +43 -0
  119. package/src/base/hooks/useRemember.ts +58 -0
  120. package/src/base/hooks/useToast.ts +27 -0
  121. package/src/base/layout/BlockRegion.tsx +39 -0
  122. package/src/base/layout/DashboardLayout.tsx +110 -0
  123. package/src/base/layout/SidebarLayout.tsx +38 -0
  124. package/src/base/layout/StackLayout.tsx +32 -0
  125. package/src/base/layout/WizardLayout.tsx +49 -0
  126. package/src/base/partials/ActionBar/index.tsx +115 -0
  127. package/src/base/partials/ConfirmationDialog/index.tsx +128 -0
  128. package/src/base/partials/DataTable/cell-registry.ts +50 -0
  129. package/src/base/partials/DataTable/cell-renderers.tsx +372 -0
  130. package/src/base/partials/DataTable/index.tsx +1282 -0
  131. package/src/base/partials/DataTable/register-default-cells.ts +37 -0
  132. package/src/base/partials/DataTable/sanitize-html.ts +45 -0
  133. package/src/base/partials/DataTable/types.ts +229 -0
  134. package/src/base/partials/DetailSection/index.tsx +316 -0
  135. package/src/base/partials/EmptyPlaceholder/index.tsx +162 -0
  136. package/src/base/partials/EntityItem/index.tsx +154 -0
  137. package/src/base/partials/FilterBar/index.tsx +256 -0
  138. package/src/base/partials/FormSection/index.tsx +87 -0
  139. package/src/base/partials/LogViewer/JsonBlock.tsx +39 -0
  140. package/src/base/partials/LogViewer/LogEntry.tsx +68 -0
  141. package/src/base/partials/LogViewer/LogViewerToolbar.tsx +71 -0
  142. package/src/base/partials/LogViewer/index.tsx +110 -0
  143. package/src/base/partials/LogViewer/types.ts +28 -0
  144. package/src/base/partials/MarkdownContent/index.tsx +307 -0
  145. package/src/base/partials/MenuBar/index.tsx +80 -0
  146. package/src/base/partials/QuickRecordSheet/index.tsx +59 -0
  147. package/src/base/partials/ResizableSidebar/index.tsx +70 -0
  148. package/src/base/partials/StatRow/index.tsx +28 -0
  149. package/src/base/partials/StatusBar/index.tsx +126 -0
  150. package/src/base/partials/StatusIndicator/index.tsx +61 -0
  151. package/src/base/partials/StepIndicator/index.tsx +63 -0
  152. package/src/base/partials/TableOfContents/index.tsx +78 -0
  153. package/src/base/partials/TimelineList/index.tsx +273 -0
  154. package/src/base/partials/ToggleGroupControl/index.tsx +100 -0
  155. package/src/base/partials/TreeView/index.tsx +75 -0
  156. package/src/base/partials/index.ts +23 -0
  157. package/src/base/shell/AuthShell.tsx +54 -0
  158. package/src/base/shell/BasicShell.tsx +286 -0
  159. package/src/base/shell/ImmersiveShell.tsx +85 -0
  160. package/src/base/shell/partials/EditablePanelContext.tsx +82 -0
  161. package/src/base/shell/partials/EditablePanelProvider.tsx +122 -0
  162. package/src/base/shell/partials/InlineEditablePanel.tsx +239 -0
  163. package/src/base/shell/partials/InspectorContext.tsx +173 -0
  164. package/src/base/shell/partials/InspectorPanel.tsx +65 -0
  165. package/src/base/shell/partials/NavErrorBoundary.tsx +82 -0
  166. package/src/base/shell/partials/OverlayScreen.tsx +67 -0
  167. package/src/base/shell/partials/PageActionButton.tsx +203 -0
  168. package/src/base/theme/appearance.ts +133 -0
  169. package/src/base/theme/host-layout-detector.ts +119 -0
  170. package/src/base/theme/host-theme-detector.ts +146 -0
  171. package/src/base/theme/sidebar-safelist.txt +20 -0
  172. package/src/base/theme/tailwind-theme.css +136 -0
  173. package/src/base/theme/theme-bridge.css +164 -0
  174. package/src/base/theme/theme-context.tsx +142 -0
  175. package/src/base/theme/themes/classic.css +174 -0
  176. package/src/base/theme/tokens.css +290 -0
  177. package/src/base/theme/useHostTheme.ts +95 -0
  178. package/src/base/utils/clipboard.ts +39 -0
  179. package/src/base/utils/conditions.ts +27 -0
  180. package/src/base/utils/icon-registry.ts +78 -0
  181. package/src/base/utils/icons.ts +31 -0
  182. package/src/base/utils/interpolate.ts +9 -0
  183. package/src/base/utils/register-default-icons.ts +163 -0
  184. package/src/base/utils/storage.ts +65 -0
  185. package/src/base/utils/time.ts +139 -0
  186. package/src/contracts/block-data/actions.ts +73 -0
  187. package/src/contracts/block-data/data-display.ts +343 -0
  188. package/src/contracts/block-data/form.ts +164 -0
  189. package/src/contracts/block-data/index.ts +15 -0
  190. package/src/contracts/block-data/interactive.ts +34 -0
  191. package/src/contracts/block-data/shared.ts +44 -0
  192. package/src/contracts/connectors.ts +60 -0
  193. package/src/contracts/generated/contract-schema.ts +1237 -0
  194. package/src/contracts/generated/contract-types.ts +675 -0
  195. package/src/contracts/generated/index.ts +15 -0
  196. package/src/contracts/navigation.ts +59 -0
  197. package/src/contracts/page-contract-schema.ts +40 -0
  198. package/src/contracts/page-contract.ts +79 -0
  199. package/src/contracts/shared-props.ts +92 -0
  200. package/src/engine/ContractPage.tsx +178 -0
  201. package/src/engine/EntityRoutes.tsx +72 -0
  202. package/src/engine/HostSlot.tsx +126 -0
  203. package/src/engine/LazyBlock.tsx +92 -0
  204. package/src/engine/bootstrap.tsx +20 -0
  205. package/src/engine/providers/auth.tsx +87 -0
  206. package/src/engine/providers/error-reporter.tsx +89 -0
  207. package/src/engine/providers/flash.tsx +44 -0
  208. package/src/engine/providers/index.ts +18 -0
  209. package/src/engine/providers/inertia-error-reporter.tsx +61 -0
  210. package/src/engine/providers/progress.tsx +56 -0
  211. package/src/engine/providers/scope.tsx +51 -0
  212. package/src/engine/register-defaults.ts +88 -0
  213. package/src/engine/registries.ts +96 -0
  214. package/src/i18n/I18nProvider.tsx +53 -0
  215. package/src/i18n/MANIFEST.md +101 -0
  216. package/src/i18n/host-resolver.ts +18 -0
  217. package/src/i18n/instance.ts +69 -0
  218. package/src/i18n/locales/en/ui.json +277 -0
  219. package/src/i18n/locales/en/validators.json +13 -0
  220. package/src/i18n/locales/pt-BR/ui.json +277 -0
  221. package/src/i18n/locales/pt-BR/validators.json +13 -0
  222. package/src/i18n/register-strings.ts +10 -0
  223. package/src/i18n/render-label.ts +33 -0
  224. package/src/i18n/resolve-field-error.ts +29 -0
  225. package/src/i18n/useHostString.ts +50 -0
  226. package/src/i18n/useTranslation.ts +83 -0
  227. package/src/lib/actions/resolve-action-target.ts +151 -0
  228. package/src/lib/hooks/use-copy-to-clipboard.ts +37 -0
  229. package/src/lib/hooks/use-file-upload.ts +406 -0
  230. package/src/lib/hooks/use-mobile.ts +21 -0
  231. package/src/lib/host-pending.ts +76 -0
  232. package/src/lib/portal-container.ts +16 -0
  233. package/src/lib/test-ids.ts +40 -0
  234. package/src/lib/utils.ts +6 -0
  235. package/src/primitives/reui/MANIFEST.md +97 -0
  236. package/src/primitives/reui/accordion.tsx +64 -0
  237. package/src/primitives/reui/alert-dialog.tsx +196 -0
  238. package/src/primitives/reui/alert.tsx +92 -0
  239. package/src/primitives/reui/aspect-ratio.tsx +9 -0
  240. package/src/primitives/reui/autocomplete.tsx +343 -0
  241. package/src/primitives/reui/avatar.tsx +109 -0
  242. package/src/primitives/reui/badge.tsx +94 -0
  243. package/src/primitives/reui/breadcrumb.tsx +109 -0
  244. package/src/primitives/reui/button-group.tsx +83 -0
  245. package/src/primitives/reui/button.tsx +64 -0
  246. package/src/primitives/reui/calendar.tsx +220 -0
  247. package/src/primitives/reui/card.tsx +92 -0
  248. package/src/primitives/reui/carousel.tsx +239 -0
  249. package/src/primitives/reui/chart.tsx +388 -0
  250. package/src/primitives/reui/checkbox.tsx +30 -0
  251. package/src/primitives/reui/collapsible.tsx +31 -0
  252. package/src/primitives/reui/combobox.tsx +308 -0
  253. package/src/primitives/reui/command.tsx +182 -0
  254. package/src/primitives/reui/context-menu.tsx +250 -0
  255. package/src/primitives/reui/data-grid/data-grid-column-filter.tsx +172 -0
  256. package/src/primitives/reui/data-grid/data-grid-column-header.tsx +420 -0
  257. package/src/primitives/reui/data-grid/data-grid-column-visibility.tsx +51 -0
  258. package/src/primitives/reui/data-grid/data-grid-pagination.tsx +235 -0
  259. package/src/primitives/reui/data-grid/data-grid-scroll-area.tsx +427 -0
  260. package/src/primitives/reui/data-grid/data-grid-table-dnd-rows.tsx +308 -0
  261. package/src/primitives/reui/data-grid/data-grid-table-dnd.tsx +318 -0
  262. package/src/primitives/reui/data-grid/data-grid-table-virtual.tsx +491 -0
  263. package/src/primitives/reui/data-grid/data-grid-table.tsx +1430 -0
  264. package/src/primitives/reui/data-grid/data-grid.tsx +269 -0
  265. package/src/primitives/reui/data-grid-pagination.tsx +235 -0
  266. package/src/primitives/reui/date-selector.tsx +1353 -0
  267. package/src/primitives/reui/dialog.tsx +158 -0
  268. package/src/primitives/reui/drawer.tsx +133 -0
  269. package/src/primitives/reui/dropdown-menu.tsx +257 -0
  270. package/src/primitives/reui/empty.tsx +104 -0
  271. package/src/primitives/reui/field.tsx +246 -0
  272. package/src/primitives/reui/filters.tsx +1891 -0
  273. package/src/primitives/reui/frame.tsx +170 -0
  274. package/src/primitives/reui/hover-card.tsx +42 -0
  275. package/src/primitives/reui/icon-placeholder.tsx +39 -0
  276. package/src/primitives/reui/index.ts +98 -0
  277. package/src/primitives/reui/input-group.tsx +170 -0
  278. package/src/primitives/reui/input-otp.tsx +75 -0
  279. package/src/primitives/reui/input.tsx +21 -0
  280. package/src/primitives/reui/item.tsx +193 -0
  281. package/src/primitives/reui/kanban.tsx +743 -0
  282. package/src/primitives/reui/kbd.tsx +28 -0
  283. package/src/primitives/reui/label.tsx +22 -0
  284. package/src/primitives/reui/menubar.tsx +274 -0
  285. package/src/primitives/reui/native-select.tsx +62 -0
  286. package/src/primitives/reui/navigation-menu.tsx +168 -0
  287. package/src/primitives/reui/number-field.tsx +250 -0
  288. package/src/primitives/reui/pagination.tsx +127 -0
  289. package/src/primitives/reui/phone-input.tsx +231 -0
  290. package/src/primitives/reui/popover.tsx +87 -0
  291. package/src/primitives/reui/progress.tsx +31 -0
  292. package/src/primitives/reui/radio-group.tsx +43 -0
  293. package/src/primitives/reui/rating.tsx +177 -0
  294. package/src/primitives/reui/resizable.tsx +51 -0
  295. package/src/primitives/reui/scroll-area.tsx +58 -0
  296. package/src/primitives/reui/scrollspy.tsx +240 -0
  297. package/src/primitives/reui/select.tsx +188 -0
  298. package/src/primitives/reui/separator.tsx +28 -0
  299. package/src/primitives/reui/sheet.tsx +141 -0
  300. package/src/primitives/reui/sidebar.tsx +732 -0
  301. package/src/primitives/reui/skeleton.tsx +13 -0
  302. package/src/primitives/reui/slider.tsx +61 -0
  303. package/src/primitives/reui/sonner.tsx +47 -0
  304. package/src/primitives/reui/sortable.tsx +414 -0
  305. package/src/primitives/reui/spinner.tsx +16 -0
  306. package/src/primitives/reui/stepper.tsx +484 -0
  307. package/src/primitives/reui/svgs/claudeAiIcon.tsx +12 -0
  308. package/src/primitives/reui/svgs/gemini.tsx +171 -0
  309. package/src/primitives/reui/svgs/openai.tsx +9 -0
  310. package/src/primitives/reui/svgs/openaiDark.tsx +12 -0
  311. package/src/primitives/reui/switch.tsx +33 -0
  312. package/src/primitives/reui/table.tsx +114 -0
  313. package/src/primitives/reui/tabs.tsx +91 -0
  314. package/src/primitives/reui/textarea.tsx +18 -0
  315. package/src/primitives/reui/timeline.tsx +219 -0
  316. package/src/primitives/reui/toggle-group.tsx +83 -0
  317. package/src/primitives/reui/toggle.tsx +45 -0
  318. package/src/primitives/reui/tooltip.tsx +55 -0
  319. package/src/primitives/reui/tree.tsx +247 -0
  320. package/src/theme.css +71 -0
@@ -0,0 +1,290 @@
1
+ /**
2
+ * MIDDAG ReUI Maia — Design Tokens
3
+ *
4
+ * Source of truth for all visual tokens.
5
+ * Consumed by Tailwind CSS v4 via @theme in tailwind.css.
6
+ *
7
+ * @see NV-05-ux-design-system.md
8
+ */
9
+
10
+ :root {
11
+ /* ── Canvas ── */
12
+ --background: oklch(0.99 0.001 286);
13
+ --foreground: oklch(0.17 0.01 286);
14
+
15
+ /* ── Primary (Brand) ── */
16
+ --primary: oklch(0.21 0.034 264.06);
17
+ --primary-foreground: oklch(0.98 0 0);
18
+ --primary-subtle: oklch(0.95 0.012 264.06);
19
+ --primary-muted: oklch(0.88 0.02 264.06);
20
+
21
+ /* ── Secondary ── */
22
+ --secondary: oklch(0.97 0.001 286);
23
+ --secondary-foreground: oklch(0.45 0.01 286);
24
+
25
+ /* ── Destructive ── */
26
+ --destructive: oklch(0.577 0.245 27.33);
27
+ --destructive-foreground: oklch(0.98 0 0);
28
+ --destructive-subtle: oklch(0.95 0.05 27.33);
29
+ --destructive-muted: oklch(0.88 0.08 27.33);
30
+
31
+ /* ── Success ── */
32
+ --success: oklch(0.55 0.17 155);
33
+ --success-foreground: oklch(0.98 0 0);
34
+ --success-subtle: oklch(0.95 0.04 155);
35
+ --success-muted: oklch(0.88 0.06 155);
36
+
37
+ /* ── Warning ── */
38
+ --warning: oklch(0.75 0.18 75);
39
+ --warning-foreground: oklch(0.18 0.02 75);
40
+ --warning-subtle: oklch(0.96 0.04 75);
41
+ --warning-muted: oklch(0.9 0.06 75);
42
+
43
+ /* ── Info ── */
44
+ --info: oklch(0.58 0.16 250);
45
+ --info-foreground: oklch(0.98 0 0);
46
+ --info-subtle: oklch(0.95 0.04 250);
47
+ --info-muted: oklch(0.88 0.06 250);
48
+
49
+ /* ── Neutral (Surface & Structure) ── */
50
+ --muted: oklch(0.97 0.001 286);
51
+ --muted-foreground: oklch(0.58 0.008 286);
52
+ --accent: oklch(0.97 0.001 286);
53
+ --accent-foreground: oklch(0.21 0.014 285.82);
54
+
55
+ /* ── Structure ── */
56
+ --border: oklch(0.975 0.001 286);
57
+ --input: oklch(0.89 0.004 286);
58
+ --ring: oklch(0.708 0.028 256.85);
59
+
60
+ /* ── Overlays ── */
61
+ --popover: oklch(1 0 0);
62
+ --popover-foreground: oklch(0.145 0.014 285.82);
63
+ --card: oklch(1 0 0);
64
+ --card-foreground: oklch(0.145 0.014 285.82);
65
+
66
+ /* ── Sidebar ── */
67
+ --sidebar: oklch(0.975 0.002 286);
68
+ --sidebar-foreground: oklch(0.45 0.01 286);
69
+ --sidebar-primary: oklch(0.21 0.034 264.06);
70
+ --sidebar-primary-foreground: oklch(0.98 0 0);
71
+ --sidebar-accent: oklch(0.93 0.012 264);
72
+ --sidebar-accent-foreground: oklch(0.21 0.014 285.82);
73
+ --sidebar-hover: oklch(0.955 0.003 286);
74
+ --sidebar-border: oklch(0.91 0.005 286);
75
+
76
+ /* ── Chart ── */
77
+ --chart-1: oklch(0.646 0.222 41.116);
78
+ --chart-2: oklch(0.6 0.118 184.714);
79
+ --chart-3: oklch(0.398 0.07 227.392);
80
+ --chart-4: oklch(0.828 0.189 84.429);
81
+ --chart-5: oklch(0.769 0.188 70.08);
82
+
83
+ /* ── Typography ── */
84
+ --font-sans:
85
+ "Figtree Variable", "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
86
+ "Helvetica Neue", Arial, sans-serif;
87
+ --font-mono:
88
+ "JetBrains Mono", "Fira Code", ui-monospace, "Cascadia Mono", "Segoe UI Mono",
89
+ "Liberation Mono", Menlo, Monaco, monospace;
90
+
91
+ /* ── Invert (ReUI) ── */
92
+ --invert: oklch(0.21 0.014 285.82);
93
+ --invert-foreground: oklch(0.985 0 0);
94
+
95
+ /* ── Border Radius (Maia style) ── */
96
+ --radius: 0.625rem;
97
+
98
+ /* ── Shadows ── */
99
+ --shadow-xs: 0 1px 2px oklch(0 0 0 / 0.04);
100
+ --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.06), 0 1px 3px oklch(0 0 0 / 0.1);
101
+ --shadow-md: 0 4px 6px oklch(0 0 0 / 0.06), 0 2px 4px oklch(0 0 0 / 0.04);
102
+ --shadow-lg: 0 10px 15px oklch(0 0 0 / 0.08), 0 4px 6px oklch(0 0 0 / 0.04);
103
+ --shadow-xl: 0 20px 25px oklch(0 0 0 / 0.08), 0 8px 10px oklch(0 0 0 / 0.04);
104
+ --shadow-2xl: 0 25px 50px oklch(0 0 0 / 0.12);
105
+
106
+ /* ── Spacing (8px base grid) ── */
107
+ --space-0: 0px;
108
+ --space-0\.5: 2px;
109
+ --space-1: 4px;
110
+ --space-1\.5: 6px;
111
+ --space-2: 8px;
112
+ --space-3: 12px;
113
+ --space-4: 16px;
114
+ --space-5: 20px;
115
+ --space-6: 24px;
116
+ --space-8: 32px;
117
+ --space-10: 40px;
118
+ --space-12: 48px;
119
+ --space-16: 64px;
120
+ --space-20: 80px;
121
+
122
+ /* ── Typography Scale ── */
123
+ --text-display: clamp(1.75rem, 4vw, 2rem); /* 32px — hero, page title destaque */
124
+ --text-h1: 1.5rem; /* 24px — page title (1 per page) */
125
+ --text-h2: 1.25rem; /* 20px — section title */
126
+ --text-h3: 1.125rem; /* 18px — card title, panel header */
127
+ --text-h4: 1rem; /* 16px — sub-section, field group */
128
+ --text-body-l: 1rem; /* 16px — long reading, descriptions */
129
+ --text-body-m: 0.875rem; /* 14px — body default, table cells, labels */
130
+ --text-body-s: 0.75rem; /* 12px — captions, help text, timestamps */
131
+ --text-mono: 0.8125rem; /* 13px — code, IDs, technical values */
132
+ --text-overline: 0.6875rem; /* 11px — section labels (uppercase) */
133
+
134
+ /* ── Motion Duration Scale ── */
135
+ --duration-instant: 0ms;
136
+ --duration-fast: 100ms;
137
+ --duration-normal: 150ms;
138
+ --duration-moderate: 200ms;
139
+ --duration-slow: 300ms;
140
+ --duration-slower: 500ms;
141
+
142
+ /* ── Motion Easing Functions ── */
143
+ --ease-default: cubic-bezier(0.2, 0, 0, 1);
144
+ --ease-in: cubic-bezier(0.4, 0, 1, 1);
145
+ --ease-out: cubic-bezier(0, 0, 0.2, 1);
146
+ --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
147
+
148
+ /* ── Layout Dimensions ── */
149
+ --content-max-width: 1280px;
150
+ --content-narrow: 720px;
151
+ --content-wide: 1440px;
152
+ --sidebar-width: 260px;
153
+ --sidebar-width-collapsed: 60px;
154
+ --sidebar-width-mobile: 300px;
155
+
156
+ /* ── Breakpoints ── */
157
+ --breakpoint-sm: 640px;
158
+ --breakpoint-md: 768px;
159
+ --breakpoint-lg: 1024px;
160
+ --breakpoint-xl: 1280px;
161
+ --breakpoint-2xl: 1536px;
162
+
163
+ /* ── Component Sizing (touch targets) ── */
164
+ --size-button-sm: 32px;
165
+ --size-button-md: 36px;
166
+ --size-button-lg: 44px;
167
+ --size-input: 36px;
168
+ --size-table-row: 48px;
169
+ --size-sidebar-item: 40px;
170
+ --size-avatar-sm: 24px;
171
+ --size-avatar-md: 32px;
172
+ --size-avatar-lg: 40px;
173
+
174
+ /* ── Z-Index Scale ── */
175
+ --z-base: 0;
176
+ --z-sticky: 10;
177
+ --z-dropdown: 20;
178
+ --z-overlay: 30;
179
+ --z-popover: 40;
180
+ --z-modal: 50;
181
+ --z-toast: 60;
182
+ --z-command: 100;
183
+
184
+ /* ── Border Radius Scale (Maia) ── */
185
+ --radius-none: 0px;
186
+ --radius-sm: 4px;
187
+ --radius-md: 6px;
188
+ --radius-lg: 8px;
189
+ --radius-xl: 12px;
190
+ --radius-2xl: 16px;
191
+ --radius-full: 9999px;
192
+ }
193
+
194
+ :root.dark,
195
+ [data-theme="dark"] {
196
+ /* ── Canvas ── */
197
+ --background: oklch(0.13 0.01 285.82);
198
+ --foreground: oklch(0.93 0.005 285.82);
199
+
200
+ /* ── Primary (Brand) ── */
201
+ --primary: oklch(0.6 0.06 264.06);
202
+ --primary-foreground: oklch(0.1 0.01 264.06);
203
+ --primary-subtle: oklch(0.22 0.03 264.06);
204
+ --primary-muted: oklch(0.28 0.04 264.06);
205
+
206
+ /* ── Secondary ── */
207
+ --secondary: oklch(0.2 0.005 286.38);
208
+ --secondary-foreground: oklch(0.9 0.005 285.82);
209
+
210
+ /* ── Destructive ── */
211
+ --destructive: oklch(0.63 0.24 27.33);
212
+ --destructive-foreground: oklch(0.1 0.01 27.33);
213
+ --destructive-subtle: oklch(0.22 0.06 27.33);
214
+ --destructive-muted: oklch(0.28 0.08 27.33);
215
+
216
+ /* ── Success ── */
217
+ --success: oklch(0.62 0.17 155);
218
+ --success-foreground: oklch(0.1 0.01 155);
219
+ --success-subtle: oklch(0.2 0.04 155);
220
+ --success-muted: oklch(0.26 0.06 155);
221
+
222
+ /* ── Warning ── */
223
+ --warning: oklch(0.78 0.18 75);
224
+ --warning-foreground: oklch(0.15 0.02 75);
225
+ --warning-subtle: oklch(0.22 0.04 75);
226
+ --warning-muted: oklch(0.28 0.06 75);
227
+
228
+ /* ── Info ── */
229
+ --info: oklch(0.65 0.16 250);
230
+ --info-foreground: oklch(0.1 0.01 250);
231
+ --info-subtle: oklch(0.2 0.04 250);
232
+ --info-muted: oklch(0.26 0.06 250);
233
+
234
+ /* ── Neutral (Surface & Structure) ── */
235
+ --muted: oklch(0.2 0.005 286.38);
236
+ --muted-foreground: oklch(0.6 0.01 285.82);
237
+ --accent: oklch(0.22 0.005 286.38);
238
+ --accent-foreground: oklch(0.9 0.005 285.82);
239
+
240
+ /* ── Structure ── */
241
+ --border: oklch(0.24 0.004 286.32);
242
+ --input: oklch(0.32 0.005 286.32);
243
+ --ring: oklch(0.55 0.04 256.85);
244
+
245
+ /* ── Overlays ── */
246
+ --popover: oklch(0.18 0.008 285.82);
247
+ --popover-foreground: oklch(0.93 0.005 285.82);
248
+ --card: oklch(0.17 0.008 285.82);
249
+ --card-foreground: oklch(0.93 0.005 285.82);
250
+
251
+ /* ── Sidebar ── */
252
+ --sidebar: oklch(0.12 0.008 285.82);
253
+ --sidebar-foreground: oklch(0.7 0.01 264.06);
254
+ --sidebar-primary: oklch(0.6 0.06 264.06);
255
+ --sidebar-primary-foreground: oklch(0.1 0.01 264.06);
256
+ --sidebar-accent: oklch(0.22 0.02 264.06);
257
+ --sidebar-accent-foreground: oklch(0.9 0.005 285.82);
258
+ --sidebar-hover: oklch(0.185 0.006 286);
259
+ --sidebar-border: oklch(0.25 0.005 286.32);
260
+
261
+ /* ── Invert (ReUI) ── */
262
+ --invert: oklch(0.7 0.01 285.82);
263
+ --invert-foreground: oklch(0.13 0.01 285.82);
264
+
265
+ /* ── Chart ── */
266
+ --chart-1: oklch(0.7 0.2 41.116);
267
+ --chart-2: oklch(0.65 0.12 184.714);
268
+ --chart-3: oklch(0.5 0.07 227.392);
269
+ --chart-4: oklch(0.85 0.17 84.429);
270
+ --chart-5: oklch(0.8 0.17 70.08);
271
+
272
+ /* ── Shadows (higher opacity for dark surfaces) ── */
273
+ --shadow-xs: 0 1px 2px oklch(0 0 0 / 0.2);
274
+ --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.25), 0 1px 2px oklch(0 0 0 / 0.2);
275
+ --shadow-md: 0 4px 6px oklch(0 0 0 / 0.3), 0 2px 4px oklch(0 0 0 / 0.2);
276
+ --shadow-lg: 0 10px 15px oklch(0 0 0 / 0.35), 0 4px 6px oklch(0 0 0 / 0.2);
277
+ --shadow-xl: 0 20px 25px oklch(0 0 0 / 0.35), 0 8px 10px oklch(0 0 0 / 0.2);
278
+ --shadow-2xl: 0 25px 50px oklch(0 0 0 / 0.45);
279
+ }
280
+
281
+ /* ── Reduced Motion ── */
282
+ @media (prefers-reduced-motion: reduce) {
283
+ *,
284
+ *::before,
285
+ *::after {
286
+ animation-duration: 0.01ms !important;
287
+ animation-iteration-count: 1 !important;
288
+ transition-duration: 0.01ms !important;
289
+ }
290
+ }
@@ -0,0 +1,95 @@
1
+ /**
2
+ * useHostTheme — React hook that detects and tracks the host page's dark/light theme.
3
+ *
4
+ * Observes:
5
+ * - Class/attribute mutations on <html> and <body> (MutationObserver)
6
+ * - OS prefers-color-scheme changes (matchMedia)
7
+ * - localStorage changes from other tabs (storage event)
8
+ *
9
+ * Never modifies the host's DOM or localStorage.
10
+ * Applies theme to the MIDDAG root container via data-theme attribute.
11
+ *
12
+ * @param override Manual override: 'auto' (detect from host), 'dark', or 'light'.
13
+ */
14
+
15
+ import { useCallback, useEffect, useState } from "react";
16
+
17
+ import {
18
+ detectHostTheme,
19
+ OBSERVED_ATTRIBUTES,
20
+ type DetectedTheme,
21
+ } from "@/base/theme/host-theme-detector";
22
+
23
+ export type ThemeOverride = "auto" | "dark" | "light";
24
+
25
+ export interface UseHostThemeResult {
26
+ /** Resolved theme: always 'dark' or 'light' (never 'auto'). */
27
+ theme: "dark" | "light";
28
+ /** Raw detected value from host before override. */
29
+ detected: DetectedTheme;
30
+ /** Current override setting. */
31
+ override: ThemeOverride;
32
+ /** Change override at runtime. */
33
+ setOverride: (override: ThemeOverride) => void;
34
+ }
35
+
36
+ function resolveTheme(detected: DetectedTheme, override: ThemeOverride): "dark" | "light" {
37
+ if (override !== "auto") return override;
38
+ if (detected === "dark") return "dark";
39
+ return "light";
40
+ }
41
+
42
+ export function useHostTheme(initialOverride: ThemeOverride = "auto"): UseHostThemeResult {
43
+ const [override, setOverride] = useState<ThemeOverride>(initialOverride);
44
+ const [detected, setDetected] = useState<DetectedTheme>(() => detectHostTheme());
45
+
46
+ const redetect = useCallback(() => {
47
+ setDetected(detectHostTheme());
48
+ }, []);
49
+
50
+ useEffect(() => {
51
+ if (typeof document === "undefined") return;
52
+
53
+ // ── MutationObserver on <html> and <body> ───────────────────
54
+ const observer = new MutationObserver(redetect);
55
+ const config: MutationObserverInit = {
56
+ attributes: true,
57
+ attributeFilter: OBSERVED_ATTRIBUTES,
58
+ };
59
+
60
+ observer.observe(document.documentElement, config);
61
+ if (document.body) {
62
+ observer.observe(document.body, config);
63
+ }
64
+
65
+ // ── prefers-color-scheme listener ────────────────────────────
66
+ const mql = window.matchMedia("(prefers-color-scheme: dark)");
67
+ const mediaHandler = () => redetect();
68
+ mql.addEventListener("change", mediaHandler);
69
+
70
+ // ── storage event (other tabs changing localStorage) ────────
71
+ const storageHandler = (e: StorageEvent) => {
72
+ if (
73
+ e.key === null || // clear()
74
+ e.key.includes("dark") ||
75
+ e.key.includes("theme") ||
76
+ e.key.includes("mode") ||
77
+ e.key.includes("color") ||
78
+ e.key.includes("appearance")
79
+ ) {
80
+ redetect();
81
+ }
82
+ };
83
+ window.addEventListener("storage", storageHandler);
84
+
85
+ return () => {
86
+ observer.disconnect();
87
+ mql.removeEventListener("change", mediaHandler);
88
+ window.removeEventListener("storage", storageHandler);
89
+ };
90
+ }, [redetect]);
91
+
92
+ const theme = resolveTheme(detected, override);
93
+
94
+ return { theme, detected, override, setOverride };
95
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Clipboard utility — safe clipboard write with fallback.
3
+ *
4
+ * @see NV-05-ux-blocks.md §4.4 (copy-to-clipboard in DetailSection)
5
+ */
6
+
7
+ /**
8
+ * Copy text to clipboard.
9
+ * Returns true on success, false on failure.
10
+ * Falls back to execCommand when Clipboard API is unavailable.
11
+ */
12
+ export async function copyToClipboard(text: string): Promise<boolean> {
13
+ // Modern Clipboard API (requires HTTPS or localhost)
14
+ if (navigator.clipboard?.writeText) {
15
+ try {
16
+ await navigator.clipboard.writeText(text);
17
+ return true;
18
+ } catch {
19
+ // Clipboard API blocked — fall through to fallback
20
+ }
21
+ }
22
+
23
+ // Fallback: create temporary textarea and use execCommand
24
+ try {
25
+ const textarea = document.createElement("textarea");
26
+ textarea.value = text;
27
+ textarea.style.position = "fixed";
28
+ textarea.style.left = "-9999px";
29
+ textarea.style.top = "-9999px";
30
+ textarea.style.opacity = "0";
31
+ document.body.appendChild(textarea);
32
+ textarea.select();
33
+ const success = document.execCommand("copy");
34
+ document.body.removeChild(textarea);
35
+ return success;
36
+ } catch {
37
+ return false;
38
+ }
39
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Shared condition evaluation for FormPanelBlock and DenseTableBlock.
3
+ * Extracted from FormPanelBlock to enable reuse across block types.
4
+ */
5
+
6
+ import type { FormCondition } from "@/contracts/block-data";
7
+
8
+ export function evaluateCondition(
9
+ condition: FormCondition,
10
+ data: Record<string, unknown>,
11
+ ): boolean {
12
+ const fieldValue = data[condition.field];
13
+ const condValue = condition.value;
14
+
15
+ switch (condition.operator) {
16
+ case "equals":
17
+ return String(fieldValue) === String(condValue);
18
+ case "not_equals":
19
+ return String(fieldValue) !== String(condValue);
20
+ case "in":
21
+ return Array.isArray(condValue) && condValue.includes(String(fieldValue));
22
+ case "not_in":
23
+ return Array.isArray(condValue) && !condValue.includes(String(fieldValue));
24
+ default:
25
+ return true;
26
+ }
27
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Icon registry — maps kebab-case icon names to Hugeicons icon data.
3
+ *
4
+ * Analogous to fieldRegistry for form fields. Consumers can register custom
5
+ * icons without modifying icons.ts (Open/Closed principle).
6
+ *
7
+ * Default icons are registered by registerDefaultIcons().
8
+ */
9
+
10
+ import type { IconSvgElement } from "@hugeicons/react";
11
+
12
+ import type { NavigationEntityType } from "@/contracts/navigation";
13
+
14
+ /**
15
+ * The maps live on globalThis so the registry stays ONE registry even when this
16
+ * module is instantiated more than once.
17
+ *
18
+ * The package publishes this file twice: inlined into dist-lib/middag-react.js by
19
+ * the main build, and again as dist-lib/base/utils/icon-registry.js by the
20
+ * subpaths build — the copy every ./reui/* and ./shell/* subpath imports. A
21
+ * consumer that mixes `.` and subpath imports (anyone pairing this engine with
22
+ * @middag-io/react-pro or @middag-io/react-demo) loads both, and bundlers keep
23
+ * them apart: the barrel gets prebundled while the subpaths are served through a
24
+ * separate pipeline, so neither `resolve.dedupe` nor a shared relative path
25
+ * collapses them. registerDefaultIcons() would fill map A while the shell
26
+ * partials rendering the nav resolved against map B, and every nav item fell back
27
+ * to a single generic glyph.
28
+ *
29
+ * Keying off globalThis sidesteps module identity entirely — the same trick
30
+ * styled-components and the React DevTools hook use. The key carries the schema
31
+ * version: bump it only if the stored shape changes.
32
+ */
33
+ const REGISTRY_KEY = "__MIDDAG_ICON_REGISTRY_V1__";
34
+
35
+ interface IconRegistryStore {
36
+ icons: Map<string, IconSvgElement>;
37
+ entityIcons: Map<string, IconSvgElement>;
38
+ }
39
+
40
+ const globalScope = globalThis as typeof globalThis & {
41
+ [REGISTRY_KEY]?: IconRegistryStore;
42
+ };
43
+
44
+ const store: IconRegistryStore = (globalScope[REGISTRY_KEY] ??= {
45
+ icons: new Map<string, IconSvgElement>(),
46
+ entityIcons: new Map<string, IconSvgElement>(),
47
+ });
48
+
49
+ const iconMap = store.icons;
50
+ const entityIconMap = store.entityIcons;
51
+
52
+ /**
53
+ * Register an icon for a given kebab-case name.
54
+ */
55
+ export function registerIcon(name: string, icon: IconSvgElement): void {
56
+ iconMap.set(name, icon);
57
+ }
58
+
59
+ /**
60
+ * Register an icon for a given entity type (navigation entity resolution).
61
+ */
62
+ export function registerEntityIcon(entityType: NavigationEntityType, icon: IconSvgElement): void {
63
+ entityIconMap.set(entityType, icon);
64
+ }
65
+
66
+ /**
67
+ * Resolve an icon by kebab-case name. Returns undefined if not registered.
68
+ */
69
+ export function resolveIcon(name: string): IconSvgElement | undefined {
70
+ return iconMap.get(name);
71
+ }
72
+
73
+ /**
74
+ * Resolve an icon by entity type. Returns undefined if not registered.
75
+ */
76
+ export function resolveEntityIcon(entityType: string): IconSvgElement | undefined {
77
+ return entityIconMap.get(entityType);
78
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Icon resolution utility — resolves kebab-case icon names to Hugeicons icon data.
3
+ *
4
+ * Blocks receive icon names as strings from the server; this util resolves them.
5
+ * Delegates to the icon registry populated by registerDefaultIcons().
6
+ *
7
+ * @see NV-05-ux-blocks.md — blocks reference icons by kebab-case name
8
+ */
9
+
10
+ import { InboxIcon } from "@hugeicons/core-free-icons";
11
+ import type { IconSvgElement } from "@hugeicons/react";
12
+
13
+ import { resolveIcon } from "./icon-registry";
14
+
15
+ /** Hugeicons icon data type — same as IconSvgElement from @hugeicons/react */
16
+ export type IconData = IconSvgElement;
17
+
18
+ /**
19
+ * Resolve a Hugeicons icon from its kebab-case name.
20
+ * Falls back to InboxIcon if not found.
21
+ */
22
+ export function getIcon(name: string): IconData {
23
+ return resolveIcon(name) ?? InboxIcon;
24
+ }
25
+
26
+ /**
27
+ * Check if an icon name is registered.
28
+ */
29
+ export function hasIcon(name: string): boolean {
30
+ return resolveIcon(name) !== undefined;
31
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Interpolates {field} placeholders in a template string with values from a data record.
3
+ * Used for row action href and confirmation message interpolation.
4
+ * Example: interpolate('/api/{id}/process', { id: 42 }) -> '/api/42/process'
5
+ */
6
+
7
+ export function interpolate(template: string, data: Record<string, unknown>): string {
8
+ return template.replace(/\{(\w+)\}/g, (_, key: string) => String(data[key] ?? ""));
9
+ }