@middag-io/react 0.33.0 → 0.34.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 (131) hide show
  1. package/README.md +2 -2
  2. package/dist-lib/base/shell/AuthShell.js +39 -0
  3. package/dist-lib/base/shell/BasicShell.js +207 -0
  4. package/dist-lib/base/shell/ImmersiveShell.js +55 -0
  5. package/dist-lib/base/shell/partials/InspectorContext.js +60 -0
  6. package/dist-lib/base/shell/partials/InspectorPanel.js +22 -0
  7. package/dist-lib/base/shell/partials/NavErrorBoundary.js +66 -0
  8. package/dist-lib/base/shell/partials/OverlayScreen.js +36 -0
  9. package/dist-lib/base/shell/partials/PageActionButton.js +4 -0
  10. package/dist-lib/base/theme/appearance.js +39 -0
  11. package/dist-lib/base/theme/host-layout-detector.js +39 -0
  12. package/dist-lib/base/theme/host-theme-detector.js +131 -0
  13. package/dist-lib/base/theme/sidebar-safelist.txt +20 -0
  14. package/dist-lib/base/theme/theme-bridge.css +164 -0
  15. package/dist-lib/base/theme/theme-context.js +103 -0
  16. package/dist-lib/base/theme/themes/classic.css +174 -0
  17. package/dist-lib/base/theme/tokens.css +290 -0
  18. package/dist-lib/base/theme/useHostTheme.js +34 -0
  19. package/dist-lib/base/utils/clipboard.js +16 -0
  20. package/dist-lib/base/utils/conditions.js +13 -0
  21. package/dist-lib/base/utils/icon-registry.js +16 -0
  22. package/dist-lib/base/utils/icons.js +11 -0
  23. package/dist-lib/base/utils/interpolate.js +6 -0
  24. package/dist-lib/base/utils/register-default-icons.js +9 -0
  25. package/dist-lib/base/utils/storage.js +30 -0
  26. package/dist-lib/base/utils/time.js +59 -0
  27. package/dist-lib/chunks/subpath-BD_PKGUX.js +146 -0
  28. package/dist-lib/chunks/subpath-DLFO_UGQ.js +604 -0
  29. package/dist-lib/components/reui/accordion.js +43 -0
  30. package/dist-lib/components/reui/alert-dialog.js +101 -0
  31. package/dist-lib/components/reui/alert.js +55 -0
  32. package/dist-lib/components/reui/aspect-ratio.js +11 -0
  33. package/dist-lib/components/reui/autocomplete.js +170 -0
  34. package/dist-lib/components/reui/avatar.js +51 -0
  35. package/dist-lib/components/reui/badge.js +64 -0
  36. package/dist-lib/components/reui/breadcrumb.js +69 -0
  37. package/dist-lib/components/reui/button-group.js +38 -0
  38. package/dist-lib/components/reui/button.js +47 -0
  39. package/dist-lib/components/reui/calendar.js +89 -0
  40. package/dist-lib/components/reui/card.js +55 -0
  41. package/dist-lib/components/reui/carousel.js +110 -0
  42. package/dist-lib/components/reui/chart.js +130 -0
  43. package/dist-lib/components/reui/checkbox.js +20 -0
  44. package/dist-lib/components/reui/collapsible.js +23 -0
  45. package/dist-lib/components/reui/combobox.js +166 -0
  46. package/dist-lib/components/reui/command.js +85 -0
  47. package/dist-lib/components/reui/context-menu.js +121 -0
  48. package/dist-lib/components/reui/data-grid/data-grid-column-filter.js +108 -0
  49. package/dist-lib/components/reui/data-grid/data-grid-column-header.js +217 -0
  50. package/dist-lib/components/reui/data-grid/data-grid-column-visibility.js +25 -0
  51. package/dist-lib/components/reui/data-grid/data-grid-pagination.js +132 -0
  52. package/dist-lib/components/reui/data-grid/data-grid-scroll-area.js +183 -0
  53. package/dist-lib/components/reui/data-grid/data-grid-table-dnd-rows.js +125 -0
  54. package/dist-lib/components/reui/data-grid/data-grid-table-dnd.js +130 -0
  55. package/dist-lib/components/reui/data-grid/data-grid-table-virtual.js +156 -0
  56. package/dist-lib/components/reui/data-grid/data-grid-table.js +546 -0
  57. package/dist-lib/components/reui/data-grid/data-grid.js +113 -0
  58. package/dist-lib/components/reui/data-grid-pagination.js +131 -0
  59. package/dist-lib/components/reui/date-selector.js +642 -0
  60. package/dist-lib/components/reui/dialog.js +94 -0
  61. package/dist-lib/components/reui/drawer.js +77 -0
  62. package/dist-lib/components/reui/dropdown-menu.js +123 -0
  63. package/dist-lib/components/reui/empty.js +59 -0
  64. package/dist-lib/components/reui/field.js +115 -0
  65. package/dist-lib/components/reui/filters.js +873 -0
  66. package/dist-lib/components/reui/frame.js +97 -0
  67. package/dist-lib/components/reui/hover-card.js +31 -0
  68. package/dist-lib/components/reui/icon-placeholder.js +14 -0
  69. package/dist-lib/components/reui/index.js +18 -0
  70. package/dist-lib/components/reui/input-group.js +78 -0
  71. package/dist-lib/components/reui/input-otp.js +44 -0
  72. package/dist-lib/components/reui/input.js +14 -0
  73. package/dist-lib/components/reui/item.js +116 -0
  74. package/dist-lib/components/reui/kanban.js +316 -0
  75. package/dist-lib/components/reui/kbd.js +19 -0
  76. package/dist-lib/components/reui/label.js +14 -0
  77. package/dist-lib/components/reui/menubar.js +132 -0
  78. package/dist-lib/components/reui/native-select.js +37 -0
  79. package/dist-lib/components/reui/navigation-menu.js +80 -0
  80. package/dist-lib/components/reui/number-field.js +126 -0
  81. package/dist-lib/components/reui/pagination.js +78 -0
  82. package/dist-lib/components/reui/phone-input.js +124 -0
  83. package/dist-lib/components/reui/popover.js +55 -0
  84. package/dist-lib/components/reui/progress.js +20 -0
  85. package/dist-lib/components/reui/radio-group.js +27 -0
  86. package/dist-lib/components/reui/rating.js +81 -0
  87. package/dist-lib/components/reui/resizable.js +31 -0
  88. package/dist-lib/components/reui/scroll-area.js +36 -0
  89. package/dist-lib/components/reui/scrollspy.js +104 -0
  90. package/dist-lib/components/reui/select.js +97 -0
  91. package/dist-lib/components/reui/separator.js +17 -0
  92. package/dist-lib/components/reui/sheet.js +81 -0
  93. package/dist-lib/components/reui/sidebar.js +350 -0
  94. package/dist-lib/components/reui/skeleton.js +12 -0
  95. package/dist-lib/components/reui/slider.js +35 -0
  96. package/dist-lib/components/reui/sonner.js +28 -0
  97. package/dist-lib/components/reui/sortable.js +172 -0
  98. package/dist-lib/components/reui/spinner.js +14 -0
  99. package/dist-lib/components/reui/stepper.js +193 -0
  100. package/dist-lib/components/reui/svgs/claudeAiIcon.js +13 -0
  101. package/dist-lib/components/reui/svgs/gemini.js +257 -0
  102. package/dist-lib/components/reui/svgs/openai.js +10 -0
  103. package/dist-lib/components/reui/svgs/openaiDark.js +13 -0
  104. package/dist-lib/components/reui/switch.js +19 -0
  105. package/dist-lib/components/reui/table.js +66 -0
  106. package/dist-lib/components/reui/tabs.js +47 -0
  107. package/dist-lib/components/reui/textarea.js +13 -0
  108. package/dist-lib/components/reui/timeline.js +84 -0
  109. package/dist-lib/components/reui/toggle-group.js +48 -0
  110. package/dist-lib/components/reui/toggle.js +36 -0
  111. package/dist-lib/components/reui/tooltip.js +35 -0
  112. package/dist-lib/components/reui/tree.js +102 -0
  113. package/dist-lib/i18n/I18nProvider.js +23 -0
  114. package/dist-lib/i18n/host-resolver.js +10 -0
  115. package/dist-lib/i18n/instance.js +2 -0
  116. package/dist-lib/i18n/locales/en/ui.json +266 -0
  117. package/dist-lib/i18n/locales/en/validators.json +13 -0
  118. package/dist-lib/i18n/locales/pt-BR/ui.json +266 -0
  119. package/dist-lib/i18n/locales/pt-BR/validators.json +13 -0
  120. package/dist-lib/i18n/register-strings.js +7 -0
  121. package/dist-lib/i18n/render-label.js +13 -0
  122. package/dist-lib/i18n/resolve-field-error.js +10 -0
  123. package/dist-lib/i18n/useHostString.js +31 -0
  124. package/dist-lib/i18n/useTranslation.js +48 -0
  125. package/dist-lib/lib/actions/resolve-action-target.js +48 -0
  126. package/dist-lib/lib/hooks/use-copy-to-clipboard.js +18 -0
  127. package/dist-lib/lib/hooks/use-file-upload.js +171 -0
  128. package/dist-lib/lib/hooks/use-mobile.js +18 -0
  129. package/dist-lib/lib/portal-container.js +7 -0
  130. package/dist-lib/lib/utils.js +8 -0
  131. package/package.json +39 -7
@@ -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,34 @@
1
+ import { OBSERVED_ATTRIBUTES as e, detectHostTheme as t } from "./host-theme-detector.js";
2
+ import { useCallback as n, useEffect as r, useState as i } from "react";
3
+ //#region src/base/theme/useHostTheme.ts
4
+ function a(e, t) {
5
+ return t === "auto" ? e === "dark" ? "dark" : "light" : t;
6
+ }
7
+ function o(o = "auto") {
8
+ let [s, c] = i(o), [l, u] = i(() => t()), d = n(() => {
9
+ u(t());
10
+ }, []);
11
+ return r(() => {
12
+ if (typeof document > "u") return;
13
+ let t = new MutationObserver(d), n = {
14
+ attributes: !0,
15
+ attributeFilter: e
16
+ };
17
+ t.observe(document.documentElement, n), document.body && t.observe(document.body, n);
18
+ let r = window.matchMedia("(prefers-color-scheme: dark)"), i = () => d();
19
+ r.addEventListener("change", i);
20
+ let a = (e) => {
21
+ (e.key === null || e.key.includes("dark") || e.key.includes("theme") || e.key.includes("mode") || e.key.includes("color") || e.key.includes("appearance")) && d();
22
+ };
23
+ return window.addEventListener("storage", a), () => {
24
+ t.disconnect(), r.removeEventListener("change", i), window.removeEventListener("storage", a);
25
+ };
26
+ }, [d]), {
27
+ theme: a(l, s),
28
+ detected: l,
29
+ override: s,
30
+ setOverride: c
31
+ };
32
+ }
33
+ //#endregion
34
+ export { o as useHostTheme };
@@ -0,0 +1,16 @@
1
+ //#region src/base/utils/clipboard.ts
2
+ async function e(e) {
3
+ if (navigator.clipboard?.writeText) try {
4
+ return await navigator.clipboard.writeText(e), !0;
5
+ } catch {}
6
+ try {
7
+ let t = document.createElement("textarea");
8
+ t.value = e, t.style.position = "fixed", t.style.left = "-9999px", t.style.top = "-9999px", t.style.opacity = "0", document.body.appendChild(t), t.select();
9
+ let n = document.execCommand("copy");
10
+ return document.body.removeChild(t), n;
11
+ } catch {
12
+ return !1;
13
+ }
14
+ }
15
+ //#endregion
16
+ export { e as copyToClipboard };
@@ -0,0 +1,13 @@
1
+ //#region src/base/utils/conditions.ts
2
+ function e(e, t) {
3
+ let n = t[e.field], r = e.value;
4
+ switch (e.operator) {
5
+ case "equals": return String(n) === String(r);
6
+ case "not_equals": return String(n) !== String(r);
7
+ case "in": return Array.isArray(r) && r.includes(String(n));
8
+ case "not_in": return Array.isArray(r) && !r.includes(String(n));
9
+ default: return !0;
10
+ }
11
+ }
12
+ //#endregion
13
+ export { e as evaluateCondition };
@@ -0,0 +1,16 @@
1
+ //#region src/base/utils/icon-registry.ts
2
+ var e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
3
+ function n(t, n) {
4
+ e.set(t, n);
5
+ }
6
+ function r(e, n) {
7
+ t.set(e, n);
8
+ }
9
+ function i(t) {
10
+ return e.get(t);
11
+ }
12
+ function a(e) {
13
+ return t.get(e);
14
+ }
15
+ //#endregion
16
+ export { r as registerEntityIcon, n as registerIcon, a as resolveEntityIcon, i as resolveIcon };
@@ -0,0 +1,11 @@
1
+ import { resolveIcon as e } from "./icon-registry.js";
2
+ import { InboxIcon as t } from "@hugeicons/core-free-icons";
3
+ //#region src/base/utils/icons.ts
4
+ function n(n) {
5
+ return e(n) ?? t;
6
+ }
7
+ function r(t) {
8
+ return e(t) !== void 0;
9
+ }
10
+ //#endregion
11
+ export { n as getIcon, r as hasIcon };
@@ -0,0 +1,6 @@
1
+ //#region src/base/utils/interpolate.ts
2
+ function e(e, t) {
3
+ return e.replace(/\{(\w+)\}/g, (e, n) => String(t[n] ?? ""));
4
+ }
5
+ //#endregion
6
+ export { e as interpolate };
@@ -0,0 +1,9 @@
1
+ import { registerEntityIcon as e, registerIcon as t } from "./icon-registry.js";
2
+ import { Activity01Icon as ee, AlertCircleIcon as te, ArrowDown01Icon as n, ArrowRight01Icon as r, ArrowUp01Icon as i, Calendar03Icon as a, Cancel01Icon as o, ChartLineData01Icon as s, CheckmarkCircle01Icon as c, CheckmarkSquare01Icon as l, Clock01Icon as u, CloudIcon as d, CodeIcon as f, Copy01Icon as p, DashboardBrowsingIcon as m, Database01Icon as ne, Delete02Icon as h, Download01Icon as g, Edit02Icon as _, File01Icon as v, FileExportIcon as y, FilterIcon as b, FolderOpenIcon as x, GitBranchIcon as S, Globe02Icon as C, GraduationScrollIcon as w, HelpCircleIcon as T, Home01Icon as E, InboxIcon as D, LayersLogoIcon as O, Link01Icon as k, LockIcon as A, MailAtSign01Icon as j, Menu01Icon as M, MonitorDotIcon as N, MoreHorizontalIcon as P, Notification03Icon as F, PieChart01Icon as re, Plug01Icon as I, PuzzleIcon as L, RefreshIcon as R, RssIcon as z, Search01Icon as B, Settings01Icon as V, Settings02Icon as H, ShieldKeyIcon as U, ShoppingCart01Icon as W, SquareIcon as G, StarIcon as K, Tag01Icon as q, Target01Icon as J, TerminalIcon as Y, Upload01Icon as X, UserGroupIcon as ie, UserIcon as ae, ViewIcon as Z, WorkflowSquare06Icon as Q, Wrench01Icon as oe, ZapIcon as se } from "@hugeicons/core-free-icons";
3
+ //#region src/base/utils/register-default-icons.ts
4
+ var $ = !1;
5
+ function ce() {
6
+ $ || ($ = !0, t("inbox", D), t("square", G), t("arrow-up", i), t("arrow-down", n), t("arrow-right", r), t("check-circle", c), t("check", l), t("circle-x", o), t("alert-circle", te), t("search", B), t("menu", M), t("settings", V), t("settings-2", H), t("plug", I), t("filter", b), t("layout-dashboard", m), t("dashboard", m), t("puzzle", L), t("git-branch", S), t("shield", U), t("lock", A), t("users", ie), t("user", ae), t("chart", s), t("calendar", a), t("mail", j), t("bell", F), t("cloud", d), t("link", k), t("workflow", Q), t("database", ne), t("code", f), t("file-export", y), t("tag", q), t("layers", O), t("segment", b), t("edit", _), t("delete", h), t("trash", h), t("copy", p), t("view", Z), t("eye", Z), t("download", g), t("upload", X), t("refresh", R), t("clock", u), t("star", K), t("folder", x), t("file", v), t("globe", C), t("more-horizontal", P), t("external-link", C), t("sliders-horizontal", b), t("home", E), t("shopping-cart", W), t("zap", se), t("graduation-cap", w), t("wrench", oe), t("terminal", Y), t("target", J), t("pie-chart", re), t("activity", ee), t("monitor", N), t("file-text", v), t("rss", z), t("help-circle", T), e("connector", I), e("workflow", Q), e("segment", b), e("instancegroup", O), e("condition", S), e("compliance", U), e("offering", q), e("order", W), e("course", w), e("form", v), e("certificate", y));
7
+ }
8
+ //#endregion
9
+ export { ce as registerDefaultIcons };
@@ -0,0 +1,30 @@
1
+ //#region src/base/utils/storage.ts
2
+ var e = "middag";
3
+ function t(t) {
4
+ e = t;
5
+ }
6
+ function n() {
7
+ return e;
8
+ }
9
+ function r(t) {
10
+ return `${e}-${t}`;
11
+ }
12
+ function i(e) {
13
+ try {
14
+ return localStorage.getItem(r(e));
15
+ } catch {
16
+ return null;
17
+ }
18
+ }
19
+ function a(e, t) {
20
+ try {
21
+ localStorage.setItem(r(e), t);
22
+ } catch {}
23
+ }
24
+ function o(e) {
25
+ try {
26
+ localStorage.removeItem(r(e));
27
+ } catch {}
28
+ }
29
+ //#endregion
30
+ export { i as getStorageItem, n as getStoragePrefix, o as removeStorageItem, a as setStorageItem, t as setStoragePrefix, r as storageKey };
@@ -0,0 +1,59 @@
1
+ //#region src/base/utils/time.ts
2
+ var e = 60, t = 3600, n = 86400, r = "en";
3
+ function i(e, t) {
4
+ return new Intl.DateTimeFormat(t, { timeStyle: "short" }).format(e);
5
+ }
6
+ function a(e, t) {
7
+ return new Intl.DateTimeFormat(t, {
8
+ day: "numeric",
9
+ month: "short"
10
+ }).format(e);
11
+ }
12
+ function o(e, t) {
13
+ return new Intl.DateTimeFormat(t, {
14
+ day: "numeric",
15
+ month: "short",
16
+ year: "numeric"
17
+ }).format(e);
18
+ }
19
+ function s(e, t, n) {
20
+ return new Intl.RelativeTimeFormat(n, { numeric: "auto" }).format(e, t);
21
+ }
22
+ function c(e, t) {
23
+ let n = new Date(t);
24
+ return n.setDate(n.getDate() - 1), e.getDate() === n.getDate() && e.getMonth() === n.getMonth() && e.getFullYear() === n.getFullYear();
25
+ }
26
+ function l(l, u = r) {
27
+ if (!Number.isFinite(l)) return "";
28
+ let d = Date.now() / 1e3, f = Math.floor(d - l), p = /* @__PURE__ */ new Date(l * 1e3), m = /* @__PURE__ */ new Date();
29
+ if (f < e) return s(0, "second", u);
30
+ if (f < t) {
31
+ let t = Math.floor(f / e);
32
+ return new Intl.RelativeTimeFormat(u, { numeric: "always" }).format(-t, "minute");
33
+ }
34
+ return f < n ? i(p, u) : c(p, m) ? `${s(-1, "day", u)}, ${i(p, u)}` : f < n * 30 ? `${a(p, u)}, ${i(p, u)}` : o(p, u);
35
+ }
36
+ function u(e) {
37
+ return Number.isFinite(e) ? (/* @__PURE__ */ new Date(e * 1e3)).toISOString() : "";
38
+ }
39
+ function d(e, t = "relative", n = r) {
40
+ if (!Number.isFinite(e)) return "";
41
+ let i = /* @__PURE__ */ new Date(e * 1e3);
42
+ switch (t) {
43
+ case "iso": return i.toISOString();
44
+ case "date": return new Intl.DateTimeFormat(n, { dateStyle: "medium" }).format(i);
45
+ case "time": return new Intl.DateTimeFormat(n, { timeStyle: "short" }).format(i);
46
+ case "datetime": return new Intl.DateTimeFormat(n, {
47
+ dateStyle: "medium",
48
+ timeStyle: "short"
49
+ }).format(i);
50
+ default: return l(e, n);
51
+ }
52
+ }
53
+ function f(e, t = r) {
54
+ if (!Number.isFinite(e)) return "";
55
+ let n = /* @__PURE__ */ new Date(e * 1e3), i = /* @__PURE__ */ new Date();
56
+ return n.getDate() === i.getDate() && n.getMonth() === i.getMonth() && n.getFullYear() === i.getFullYear() ? s(0, "day", t) : c(n, i) ? s(-1, "day", t) : o(n, t);
57
+ }
58
+ //#endregion
59
+ export { f as formatDateGroupLabel, u as formatISO, l as formatRelativeTime, d as formatTimestamp };
@@ -0,0 +1,146 @@
1
+ import { Button as e } from "../components/reui/button.js";
2
+ import { Dialog as t, DialogContent as n, DialogDescription as r, DialogFooter as i, DialogHeader as a, DialogTitle as o } from "../components/reui/dialog.js";
3
+ import { renderLabel as s } from "../i18n/render-label.js";
4
+ import { useTranslation as c } from "../i18n/useTranslation.js";
5
+ import { resolveActionTarget as l } from "../lib/actions/resolve-action-target.js";
6
+ import { useCallback as u, useState as d } from "react";
7
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
8
+ import { Link as h } from "@inertiajs/react";
9
+ import { router as g } from "@inertiajs/core";
10
+ //#region src/base/partials/ConfirmationDialog/index.tsx
11
+ function _({ className: e }) {
12
+ return /* @__PURE__ */ m("svg", {
13
+ className: `animate-spin ${e ?? ""}`,
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ fill: "none",
16
+ viewBox: "0 0 24 24",
17
+ children: [/* @__PURE__ */ p("circle", {
18
+ className: "opacity-25",
19
+ cx: "12",
20
+ cy: "12",
21
+ r: "10",
22
+ stroke: "currentColor",
23
+ strokeWidth: "4"
24
+ }), /* @__PURE__ */ p("path", {
25
+ className: "opacity-75",
26
+ fill: "currentColor",
27
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
28
+ })]
29
+ });
30
+ }
31
+ function v({ open: s, onClose: l, onConfirm: u, title: d, message: f, intent: h = "default", confirmLabel: g, cancelLabel: v, waiting: y = !1, waitingMessage: b }) {
32
+ let { t: x } = c(), S = h === "danger" ? "destructive" : "default";
33
+ return /* @__PURE__ */ p(t, {
34
+ open: s,
35
+ onOpenChange: (e) => {
36
+ !e && !y && l();
37
+ },
38
+ children: /* @__PURE__ */ m(n, { children: [
39
+ /* @__PURE__ */ m(a, { children: [/* @__PURE__ */ p(o, { children: d }), /* @__PURE__ */ p(r, { children: /* @__PURE__ */ p("span", { dangerouslySetInnerHTML: { __html: f } }) })] }),
40
+ y && b && /* @__PURE__ */ m("div", {
41
+ className: "text-muted-foreground flex items-center gap-2 py-2",
42
+ children: [/* @__PURE__ */ p(_, { className: "size-4" }), /* @__PURE__ */ p("span", {
43
+ className: "text-sm",
44
+ children: b
45
+ })]
46
+ }),
47
+ /* @__PURE__ */ m(i, { children: [/* @__PURE__ */ p(e, {
48
+ type: "button",
49
+ variant: "outline",
50
+ onClick: l,
51
+ disabled: y,
52
+ children: v ?? x("middag.ui.cancel")
53
+ }), /* @__PURE__ */ m(e, {
54
+ type: "button",
55
+ variant: S,
56
+ onClick: u,
57
+ disabled: y,
58
+ children: [y && /* @__PURE__ */ p(_, { className: "mr-2 size-4" }), g ?? x("middag.ui.confirm")]
59
+ })] })
60
+ ] })
61
+ });
62
+ }
63
+ //#endregion
64
+ //#region src/base/shell/partials/PageActionButton.tsx
65
+ var y = {
66
+ primary: "default",
67
+ secondary: "outline",
68
+ danger: "destructive",
69
+ ghost: "ghost"
70
+ };
71
+ function b({ action: t }) {
72
+ let { t: n } = c(), [r, i] = d(!1), [a, o] = d(!1), [_, b] = d(!1), x = l(t), S = y[t.intent] ?? "outline", C = x.kind === "link", w = r || t.loading === !0, T = u(() => {
73
+ if (!x.url) return;
74
+ if (C) {
75
+ g.visit(x.url);
76
+ return;
77
+ }
78
+ i(!0);
79
+ let e = {
80
+ preserveState: !0,
81
+ preserveScroll: !0,
82
+ onFinish: () => {
83
+ t.confirmation?.waitForPolling || i(!1);
84
+ }
85
+ };
86
+ x.method === "delete" ? g.delete(x.url, e) : g[x.method](x.url, {}, e), t.confirmation?.waitForPolling && b(!0);
87
+ }, [
88
+ t,
89
+ x,
90
+ C
91
+ ]), E = t.confirmation, D = u(() => {
92
+ E ? o(!0) : T();
93
+ }, [E, T]), O = u(() => {
94
+ T(), t.confirmation?.waitForPolling || o(!1);
95
+ }, [t, T]), k = u(() => {
96
+ o(!1), b(!1), r || i(!1);
97
+ }, [r]), A = s(t.label, n);
98
+ return C && x.url && !E && !t.loading ? /* @__PURE__ */ p(e, {
99
+ variant: S,
100
+ size: "sm",
101
+ asChild: !0,
102
+ disabled: t.disabled,
103
+ "aria-disabled": t.disabled,
104
+ children: /* @__PURE__ */ p(h, {
105
+ href: x.url,
106
+ children: A
107
+ })
108
+ }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m(e, {
109
+ variant: S,
110
+ size: "sm",
111
+ onClick: D,
112
+ disabled: t.disabled || w,
113
+ "aria-disabled": t.disabled || w,
114
+ children: [w && /* @__PURE__ */ m("svg", {
115
+ className: "mr-2 size-3.5 animate-spin",
116
+ xmlns: "http://www.w3.org/2000/svg",
117
+ fill: "none",
118
+ viewBox: "0 0 24 24",
119
+ children: [/* @__PURE__ */ p("circle", {
120
+ className: "opacity-25",
121
+ cx: "12",
122
+ cy: "12",
123
+ r: "10",
124
+ stroke: "currentColor",
125
+ strokeWidth: "4"
126
+ }), /* @__PURE__ */ p("path", {
127
+ className: "opacity-75",
128
+ fill: "currentColor",
129
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
130
+ })]
131
+ }), A]
132
+ }), E && /* @__PURE__ */ p(v, {
133
+ open: a,
134
+ onClose: k,
135
+ onConfirm: O,
136
+ title: s(E.title, n),
137
+ message: s(E.message, n),
138
+ intent: E.intent,
139
+ confirmLabel: E.confirmLabel ? s(E.confirmLabel, n) : void 0,
140
+ cancelLabel: E.cancelLabel ? s(E.cancelLabel, n) : void 0,
141
+ waiting: _,
142
+ waitingMessage: E.waitingMessage ? s(E.waitingMessage, n) : void 0
143
+ })] });
144
+ }
145
+ //#endregion
146
+ export { b as t };