@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
package/README.md CHANGED
@@ -114,8 +114,8 @@ Blocks can defer data loading until they mount (useful for tabbed pages):
114
114
  Consumers can import ReUI primitives for custom components:
115
115
 
116
116
  ```tsx
117
- import { Tabs, TabsList, TabsTrigger, TabsContent } from '@middag-io/react/reui/tabs.tsx';
118
- import { Button } from '@middag-io/react/reui/button.tsx';
117
+ import { Tabs, TabsList, TabsTrigger, TabsContent } from '@middag-io/react/reui/tabs';
118
+ import { Button } from '@middag-io/react/reui/button';
119
119
  ```
120
120
 
121
121
  ### Custom blocks
@@ -0,0 +1,39 @@
1
+ import { Toaster as e } from "../../components/reui/sonner.js";
2
+ import { renderLabel as t } from "../../i18n/render-label.js";
3
+ import { useTranslation as n } from "../../i18n/useTranslation.js";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import { usePage as a } from "@inertiajs/react";
6
+ //#region src/base/shell/AuthShell.tsx
7
+ function o({ children: o }) {
8
+ let { t: s } = n(), { props: c } = a(), l = c.contract?.page ?? {
9
+ key: "unknown",
10
+ title: "",
11
+ breadcrumbs: [],
12
+ actions: []
13
+ }, u = t(l.title, s), d = t(l.subtitle, s);
14
+ return /* @__PURE__ */ i("div", {
15
+ className: "bg-muted/40 text-foreground flex min-h-screen flex-col items-center justify-center gap-6 p-4",
16
+ children: [/* @__PURE__ */ r("div", {
17
+ className: "w-full max-w-sm",
18
+ children: /* @__PURE__ */ i("div", {
19
+ className: "bg-card border-border rounded-xl border p-6 shadow-sm",
20
+ children: [
21
+ u ? /* @__PURE__ */ r("h1", {
22
+ className: "text-foreground text-base font-semibold",
23
+ children: u
24
+ }) : null,
25
+ d ? /* @__PURE__ */ r("p", {
26
+ className: "text-muted-foreground mt-1 mb-4 text-xs",
27
+ children: d
28
+ }) : null,
29
+ o
30
+ ]
31
+ })
32
+ }), /* @__PURE__ */ r(e, {
33
+ position: "bottom-right",
34
+ richColors: !0
35
+ })]
36
+ });
37
+ }
38
+ //#endregion
39
+ export { o as AuthShell };
@@ -0,0 +1,207 @@
1
+ import { Avatar as e, AvatarFallback as t, AvatarImage as n } from "../../components/reui/avatar.js";
2
+ import { DropdownMenu as r, DropdownMenuContent as i, DropdownMenuItem as a, DropdownMenuLabel as o, DropdownMenuSeparator as s, DropdownMenuTrigger as c } from "../../components/reui/dropdown-menu.js";
3
+ import { Sidebar as l, SidebarContent as u, SidebarFooter as d, SidebarGroup as f, SidebarGroupLabel as p, SidebarHeader as m, SidebarInset as h, SidebarMenu as g, SidebarMenuButton as _, SidebarMenuItem as v, SidebarProvider as y, SidebarTrigger as b } from "../../components/reui/sidebar.js";
4
+ import { setAppearance as x } from "../theme/appearance.js";
5
+ import { Toaster as S } from "../../components/reui/sonner.js";
6
+ import { renderLabel as C } from "../../i18n/render-label.js";
7
+ import { useTranslation as w } from "../../i18n/useTranslation.js";
8
+ import { t as T } from "../../chunks/subpath-BD_PKGUX.js";
9
+ import { useSyncExternalStore as E } from "react";
10
+ import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
11
+ import { Link as A, usePage as j } from "@inertiajs/react";
12
+ import { router as M } from "@inertiajs/core";
13
+ //#region src/base/hooks/useIsDark.ts
14
+ function N() {
15
+ return document.documentElement.classList.contains("dark");
16
+ }
17
+ function P() {
18
+ return !1;
19
+ }
20
+ var F = [], I = !1;
21
+ function L() {
22
+ I || (I = !0, new MutationObserver(() => {
23
+ F.forEach((e) => e());
24
+ }).observe(document.documentElement, {
25
+ attributes: !0,
26
+ attributeFilter: ["class"]
27
+ }));
28
+ }
29
+ function R(e) {
30
+ return F = [...F, e], L(), () => {
31
+ F = F.filter((t) => t !== e);
32
+ };
33
+ }
34
+ function z() {
35
+ return E(R, N, P);
36
+ }
37
+ //#endregion
38
+ //#region src/base/shell/BasicShell.tsx
39
+ var B = {
40
+ tree: [],
41
+ footer: [],
42
+ activeKey: ""
43
+ };
44
+ function V({ node: e, activeKey: t }) {
45
+ let { t: n } = w(), r = e.key === t, i = C(e.label, n);
46
+ return /* @__PURE__ */ O(v, { children: /* @__PURE__ */ O(_, {
47
+ asChild: !!e.href,
48
+ isActive: r,
49
+ children: e.href ? /* @__PURE__ */ O(A, {
50
+ href: e.href,
51
+ prefetch: "hover",
52
+ "aria-current": r ? "page" : void 0,
53
+ children: /* @__PURE__ */ O("span", {
54
+ className: "truncate",
55
+ children: i
56
+ })
57
+ }) : /* @__PURE__ */ O("span", {
58
+ className: "truncate",
59
+ children: i
60
+ })
61
+ }) });
62
+ }
63
+ function H({ auth: l, logoutUrl: u, csrfToken: d }) {
64
+ let { t: f } = w(), p = l.name.split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() ?? "").join("") || "?";
65
+ return /* @__PURE__ */ k(r, { children: [/* @__PURE__ */ O(c, {
66
+ asChild: !0,
67
+ children: /* @__PURE__ */ O("button", {
68
+ type: "button",
69
+ className: "focus-visible:ring-ring rounded-full transition-opacity hover:opacity-80 focus-visible:ring-2 focus-visible:outline-none",
70
+ "aria-label": l.name,
71
+ children: /* @__PURE__ */ k(e, {
72
+ className: "size-8",
73
+ children: [l.avatarUrl ? /* @__PURE__ */ O(n, {
74
+ src: l.avatarUrl,
75
+ alt: l.name
76
+ }) : null, /* @__PURE__ */ O(t, {
77
+ className: "text-xs",
78
+ children: p
79
+ })]
80
+ })
81
+ })
82
+ }), /* @__PURE__ */ k(i, {
83
+ align: "end",
84
+ className: "w-56",
85
+ children: [/* @__PURE__ */ O(o, { children: /* @__PURE__ */ k("div", {
86
+ className: "flex min-w-0 flex-col",
87
+ children: [/* @__PURE__ */ O("span", {
88
+ className: "truncate text-sm font-medium",
89
+ children: l.name
90
+ }), l.email ? /* @__PURE__ */ O("span", {
91
+ className: "text-muted-foreground truncate text-xs font-normal",
92
+ children: l.email
93
+ }) : null]
94
+ }) }), u ? /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(s, {}), /* @__PURE__ */ O(a, {
95
+ className: "text-destructive focus:text-destructive",
96
+ onSelect: () => M.post(u, d ? { _token: d } : {}),
97
+ children: f("middag.ui.auth.sign_out")
98
+ })] }) : null]
99
+ })] });
100
+ }
101
+ function U({ children: e }) {
102
+ let { t } = w(), { props: n } = j(), r = z(), i = n.navigation ?? B, a = n.contract?.page ?? {
103
+ key: "unknown",
104
+ title: "",
105
+ breadcrumbs: [],
106
+ actions: []
107
+ }, o = n.auth, s = a.actions ?? [], c = o?.logoutUrl ?? n.logoutUrl, _ = n.csrf_token;
108
+ return /* @__PURE__ */ k(y, { children: [
109
+ /* @__PURE__ */ k(l, {
110
+ collapsible: "offcanvas",
111
+ className: "border-sidebar-border bg-sidebar border-r",
112
+ children: [
113
+ /* @__PURE__ */ O(m, {
114
+ className: "border-sidebar-border border-b px-4 py-3",
115
+ children: /* @__PURE__ */ O("span", {
116
+ className: "text-sidebar-foreground text-sm font-semibold",
117
+ children: "MIDDAG"
118
+ })
119
+ }),
120
+ /* @__PURE__ */ k(u, { children: [(i.tree ?? []).map((e) => e.children?.length ? /* @__PURE__ */ k(f, { children: [/* @__PURE__ */ O(p, { children: C(e.label, t) }), /* @__PURE__ */ O(g, { children: e.children.map((e) => /* @__PURE__ */ O(V, {
121
+ node: e,
122
+ activeKey: i.activeKey
123
+ }, e.key)) })] }, e.key) : /* @__PURE__ */ O(f, { children: /* @__PURE__ */ O(g, { children: /* @__PURE__ */ O(V, {
124
+ node: e,
125
+ activeKey: i.activeKey
126
+ }) }) }, e.key)), (i.footer ?? []).length > 0 && /* @__PURE__ */ O(f, {
127
+ className: "mt-auto",
128
+ children: /* @__PURE__ */ O(g, { children: (i.footer ?? []).map((e) => /* @__PURE__ */ O(V, {
129
+ node: e,
130
+ activeKey: i.activeKey
131
+ }, e.key)) })
132
+ })] }),
133
+ /* @__PURE__ */ O(d, {
134
+ className: "border-sidebar-border border-t px-3 py-2",
135
+ children: /* @__PURE__ */ k("button", {
136
+ type: "button",
137
+ onClick: () => x(r ? "light" : "dark"),
138
+ className: "text-muted-foreground hover:bg-sidebar-hover hover:text-sidebar-foreground flex items-center gap-2 rounded-md px-2 py-1.5 text-xs transition-colors",
139
+ "aria-label": t("middag.ui.appearance.toggle"),
140
+ children: [/* @__PURE__ */ O("svg", {
141
+ viewBox: "0 0 24 24",
142
+ fill: "none",
143
+ stroke: "currentColor",
144
+ strokeWidth: 2,
145
+ className: "h-4 w-4",
146
+ children: r ? /* @__PURE__ */ O("circle", {
147
+ cx: "12",
148
+ cy: "12",
149
+ r: "5"
150
+ }) : /* @__PURE__ */ O("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79Z" })
151
+ }), /* @__PURE__ */ O("span", { children: t(r ? "middag.ui.appearance.light" : "middag.ui.appearance.dark") })]
152
+ })
153
+ })
154
+ ]
155
+ }),
156
+ /* @__PURE__ */ k(h, { children: [/* @__PURE__ */ k("header", {
157
+ className: "border-border flex h-14 shrink-0 items-center gap-3 border-b px-4",
158
+ children: [
159
+ /* @__PURE__ */ O(b, { className: "text-muted-foreground hover:text-foreground" }),
160
+ /* @__PURE__ */ k("div", {
161
+ className: "flex min-w-0 flex-col",
162
+ children: [a.breadcrumbs && a.breadcrumbs.length > 0 && /* @__PURE__ */ O("nav", {
163
+ "aria-label": "Breadcrumb",
164
+ className: "text-muted-foreground flex items-center gap-1 text-xs",
165
+ children: a.breadcrumbs.map((e, n) => /* @__PURE__ */ k("span", {
166
+ className: "flex items-center gap-1",
167
+ children: [n > 0 && /* @__PURE__ */ O("span", {
168
+ "aria-hidden": "true",
169
+ children: "/"
170
+ }), e.href ? /* @__PURE__ */ O(A, {
171
+ href: e.href,
172
+ className: "hover:text-foreground truncate",
173
+ children: C(e.label, t)
174
+ }) : /* @__PURE__ */ O("span", {
175
+ className: "truncate",
176
+ children: C(e.label, t)
177
+ })]
178
+ }, `${e.label}-${n}`))
179
+ }), a.title && /* @__PURE__ */ O("span", {
180
+ className: "text-foreground truncate text-sm font-medium",
181
+ children: C(a.title, t)
182
+ })]
183
+ }),
184
+ (s.length > 0 || o?.name) && /* @__PURE__ */ k("div", {
185
+ className: "ml-auto flex shrink-0 items-center gap-2",
186
+ children: [s.map((e, t) => /* @__PURE__ */ O(T, { action: e }, e.id ?? t)), o?.name ? /* @__PURE__ */ O(H, {
187
+ auth: o,
188
+ logoutUrl: c,
189
+ csrfToken: _
190
+ }) : null]
191
+ })
192
+ ]
193
+ }), /* @__PURE__ */ O("main", {
194
+ id: "middag-main-content",
195
+ className: "flex min-h-0 flex-1 flex-col overflow-auto",
196
+ "aria-live": "polite",
197
+ "aria-busy": "false",
198
+ children: e
199
+ })] }),
200
+ /* @__PURE__ */ O(S, {
201
+ position: "bottom-right",
202
+ richColors: !0
203
+ })
204
+ ] });
205
+ }
206
+ //#endregion
207
+ export { U as BasicShell };
@@ -0,0 +1,55 @@
1
+ import { Toaster as e } from "../../components/reui/sonner.js";
2
+ import { renderLabel as t } from "../../i18n/render-label.js";
3
+ import { useTranslation as n } from "../../i18n/useTranslation.js";
4
+ import { useCallback as r } from "react";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { router as o, usePage as s } from "@inertiajs/react";
7
+ //#region src/base/shell/ImmersiveShell.tsx
8
+ function c({ children: c }) {
9
+ let { t: l } = n(), { props: u } = s(), d = u.contract?.page ?? {
10
+ key: "unknown",
11
+ title: "",
12
+ breadcrumbs: [],
13
+ actions: []
14
+ }, f = d.breadcrumbs?.[d.breadcrumbs.length - 1]?.href;
15
+ return /* @__PURE__ */ a("div", {
16
+ className: "bg-background text-foreground flex min-h-screen flex-col",
17
+ children: [
18
+ /* @__PURE__ */ a("header", {
19
+ className: "border-border flex h-12 shrink-0 items-center gap-3 border-b px-4",
20
+ children: [/* @__PURE__ */ i("button", {
21
+ type: "button",
22
+ onClick: r(() => {
23
+ f ? o.visit(f) : window.history.back();
24
+ }, [f]),
25
+ className: "text-muted-foreground hover:text-foreground flex h-8 w-8 items-center justify-center rounded-md transition-colors",
26
+ "aria-label": l("middag.ui.close"),
27
+ children: /* @__PURE__ */ i("svg", {
28
+ viewBox: "0 0 24 24",
29
+ fill: "none",
30
+ stroke: "currentColor",
31
+ strokeWidth: 2,
32
+ className: "h-5 w-5",
33
+ children: /* @__PURE__ */ i("path", { d: "M18 6 6 18M6 6l12 12" })
34
+ })
35
+ }), d.title && /* @__PURE__ */ i("span", {
36
+ className: "text-foreground truncate text-sm font-medium",
37
+ children: t(d.title, l)
38
+ })]
39
+ }),
40
+ /* @__PURE__ */ i("main", {
41
+ id: "middag-main-content",
42
+ className: "flex min-h-0 flex-1 flex-col",
43
+ "aria-live": "polite",
44
+ "aria-busy": "false",
45
+ children: c
46
+ }),
47
+ /* @__PURE__ */ i(e, {
48
+ position: "bottom-right",
49
+ richColors: !0
50
+ })
51
+ ]
52
+ });
53
+ }
54
+ //#endregion
55
+ export { c as ImmersiveShell };
@@ -0,0 +1,60 @@
1
+ "use client";
2
+ import { createContext as e, useContext as t } from "react";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ //#region src/base/shell/partials/InspectorContext.tsx
5
+ var i = e({
6
+ selectedId: null,
7
+ select: () => {},
8
+ close: () => {},
9
+ enabled: !1,
10
+ data: null,
11
+ loading: !1,
12
+ width: 380
13
+ });
14
+ function a() {
15
+ return t(i);
16
+ }
17
+ function o({ field: e }) {
18
+ return e.value === null || e.value === "" ? /* @__PURE__ */ n("span", {
19
+ className: "text-muted-foreground",
20
+ children: "---"
21
+ }) : e.kind === "boolean" ? /* @__PURE__ */ n("span", { children: e.value ? "✓" : "✗" }) : e.kind === "status" || e.kind === "badge" ? /* @__PURE__ */ n("span", {
22
+ className: `inline-flex rounded-full px-2 py-0.5 text-[10px] font-semibold ${e.value === "active" || e.value === "granted" ? "bg-success-subtle text-success" : e.value === "failed" || e.value === "revoked" ? "bg-destructive-subtle text-destructive" : "bg-muted text-muted-foreground"}`,
23
+ children: String(e.value)
24
+ }) : e.kind === "timestamp" && typeof e.value == "number" ? /* @__PURE__ */ n("span", { children: (/* @__PURE__ */ new Date(e.value * 1e3)).toLocaleDateString() }) : e.kind === "code" ? /* @__PURE__ */ n("code", {
25
+ className: "bg-muted rounded-[3px] px-1.5 py-px font-mono text-xs",
26
+ children: String(e.value)
27
+ }) : e.kind === "link" && typeof e.value == "string" ? /* @__PURE__ */ n("a", {
28
+ href: e.value,
29
+ target: "_blank",
30
+ rel: "noopener noreferrer",
31
+ className: "text-primary truncate hover:underline",
32
+ children: e.value.replace(/^https?:\/\//, "")
33
+ }) : /* @__PURE__ */ n("span", { children: String(e.value) });
34
+ }
35
+ function s({ sections: e }) {
36
+ return /* @__PURE__ */ n("div", {
37
+ className: "divide-y",
38
+ children: e.map((e, t) => /* @__PURE__ */ r("div", {
39
+ className: "px-4 py-3.5",
40
+ children: [/* @__PURE__ */ n("dl", {
41
+ className: "space-y-3.5",
42
+ children: e.fields.map((e) => /* @__PURE__ */ r("div", { children: [/* @__PURE__ */ n("dt", {
43
+ className: "text-muted-foreground mb-0.5 text-[11px] font-medium tracking-[0.04em] uppercase",
44
+ children: e.label
45
+ }), /* @__PURE__ */ n("dd", {
46
+ className: "text-foreground text-[13px]",
47
+ children: /* @__PURE__ */ n(o, { field: e })
48
+ })] }, e.key))
49
+ }), e.actions && e.actions.length > 0 && /* @__PURE__ */ n("div", {
50
+ className: "mt-3.5 flex gap-1.5",
51
+ children: e.actions.map((e) => /* @__PURE__ */ n("button", {
52
+ className: "border-border text-secondary-foreground hover:bg-muted rounded-md border px-2.5 py-[5px] text-xs font-medium transition-colors",
53
+ children: e.label
54
+ }, e.id))
55
+ })]
56
+ }, `${e.id}-${t}`))
57
+ });
58
+ }
59
+ //#endregion
60
+ export { i as InspectorContext, o as InspectorFieldValue, s as InspectorSectionContent, a as useInspector };
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import { Sheet as e, SheetContent as t, SheetDescription as n, SheetHeader as r, SheetTitle as i } from "../../../components/reui/sheet.js";
3
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
4
+ //#region src/base/shell/partials/InspectorPanel.tsx
5
+ function s({ open: s, onClose: c, width: l = 440, title: u, description: d, children: f }) {
6
+ return /* @__PURE__ */ a(e, {
7
+ open: s,
8
+ onOpenChange: (e) => !e && c(),
9
+ children: /* @__PURE__ */ o(t, {
10
+ side: "right",
11
+ className: "inspector-panel flex flex-col",
12
+ style: { "--inspector-width": `${l}px` },
13
+ showCloseButton: !0,
14
+ children: [u && /* @__PURE__ */ o(r, { children: [/* @__PURE__ */ a(i, { children: u }), d && /* @__PURE__ */ a(n, { children: d })] }), /* @__PURE__ */ a("div", {
15
+ className: "flex-1 overflow-y-auto",
16
+ children: f
17
+ })]
18
+ })
19
+ });
20
+ }
21
+ //#endregion
22
+ export { s as InspectorPanel };
@@ -0,0 +1,66 @@
1
+ import { Component as e, createContext as t, useContext as n } from "react";
2
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
3
+ var a = t({
4
+ captureError: (e, t) => {
5
+ console.error("[MIDDAG]", e, t);
6
+ },
7
+ captureMessage: (e, t) => {
8
+ console.warn("[MIDDAG]", e, t);
9
+ }
10
+ });
11
+ function o() {
12
+ return n(a);
13
+ }
14
+ //#endregion
15
+ //#region src/base/shell/partials/NavErrorBoundary.tsx
16
+ function s() {
17
+ return /* @__PURE__ */ i("div", {
18
+ className: "flex min-h-[200px] flex-col items-center justify-center gap-3 p-6 text-center",
19
+ children: [
20
+ /* @__PURE__ */ r("span", {
21
+ className: "text-destructive",
22
+ "aria-hidden": "true",
23
+ children: "⚠"
24
+ }),
25
+ /* @__PURE__ */ r("p", {
26
+ className: "text-muted-foreground text-sm",
27
+ children: "Navigation failed to load."
28
+ }),
29
+ /* @__PURE__ */ r("button", {
30
+ onClick: () => window.location.reload(),
31
+ className: "text-primary text-sm underline hover:no-underline",
32
+ children: "Reload page"
33
+ })
34
+ ]
35
+ });
36
+ }
37
+ var c = class extends e {
38
+ constructor(e) {
39
+ super(e), this.state = { hasError: !1 };
40
+ }
41
+ static getDerivedStateFromError(e) {
42
+ return {
43
+ hasError: !0,
44
+ error: e
45
+ };
46
+ }
47
+ componentDidCatch(e, t) {
48
+ this.props.reporter ? this.props.reporter.captureError(e, {
49
+ component: "NavErrorBoundary",
50
+ action: "shell_render",
51
+ componentStack: t.componentStack ?? void 0
52
+ }) : console.error("[MIDDAG] Shell rendering error:", e, t.componentStack);
53
+ }
54
+ render() {
55
+ return this.state.hasError ? this.props.fallback ?? /* @__PURE__ */ r(s, {}) : this.props.children;
56
+ }
57
+ };
58
+ function l({ children: e, fallback: t }) {
59
+ return /* @__PURE__ */ r(c, {
60
+ reporter: o(),
61
+ fallback: t,
62
+ children: e
63
+ });
64
+ }
65
+ //#endregion
66
+ export { l as NavErrorBoundary };
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { useTranslation as e } from "../../../i18n/useTranslation.js";
3
+ import { useCallback as t, useEffect as n } from "react";
4
+ import { X as r } from "lucide-react";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ //#region src/base/shell/partials/OverlayScreen.tsx
7
+ function o({ children: o, onClose: s }) {
8
+ let { t: c } = e(), l = t(() => {
9
+ s ? s() : window.history.back();
10
+ }, [s]);
11
+ return n(() => {
12
+ let e = (e) => {
13
+ e.key === "Escape" && l();
14
+ };
15
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
16
+ }, [l]), n(() => {
17
+ let e = document.activeElement;
18
+ return () => {
19
+ e?.focus();
20
+ };
21
+ }, []), /* @__PURE__ */ a("div", {
22
+ className: "bg-background fixed inset-0 z-50 overflow-auto",
23
+ children: [/* @__PURE__ */ i("button", {
24
+ onClick: l,
25
+ className: "hover:bg-muted fixed top-4 right-4 z-[51] rounded-md p-2 transition-colors",
26
+ "aria-label": c("middag.ui.overlay.close"),
27
+ type: "button",
28
+ children: /* @__PURE__ */ i(r, { className: "h-5 w-5" })
29
+ }), /* @__PURE__ */ i("div", {
30
+ className: "min-h-screen p-6",
31
+ children: o
32
+ })]
33
+ });
34
+ }
35
+ //#endregion
36
+ export { o as OverlayScreen };
@@ -0,0 +1,4 @@
1
+ import "../../../i18n/render-label.js";
2
+ import "../../../i18n/useTranslation.js";
3
+ import { t as e } from "../../../chunks/subpath-BD_PKGUX.js";
4
+ export { e as PageActionButton };
@@ -0,0 +1,39 @@
1
+ import { detectHostTheme as e } from "./host-theme-detector.js";
2
+ import { getStorageItem as t, setStorageItem as n } from "../utils/storage.js";
3
+ //#region src/base/theme/appearance.ts
4
+ function r(t) {
5
+ if (t !== "system") return t;
6
+ let n = e();
7
+ return n === "dark" ? "dark" : n === "light" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
8
+ }
9
+ function i() {
10
+ let e = t("appearance");
11
+ return e === "light" || e === "dark" || e === "system" ? e : "system";
12
+ }
13
+ function a(e) {
14
+ document.documentElement.classList.toggle("dark", e === "dark"), document.documentElement.style.colorScheme = e, document.querySelectorAll(".middag-root").forEach((t) => {
15
+ t.setAttribute("data-theme", e);
16
+ });
17
+ }
18
+ function o(e) {
19
+ n("appearance", e), a(r(e));
20
+ }
21
+ function s() {
22
+ let e = i(), t = e === "system" ? "light" : e === "light" ? "dark" : "system";
23
+ return o(t), t;
24
+ }
25
+ function c() {
26
+ let e = document.documentElement, t = (e.dir || "ltr") === "ltr" ? "rtl" : "ltr";
27
+ return e.dir = t, n("dir", t), t;
28
+ }
29
+ function l() {
30
+ t("dir") === "rtl" && (document.documentElement.dir = "rtl");
31
+ }
32
+ function u(e) {
33
+ let t = window.matchMedia("(prefers-color-scheme: dark)"), n = () => {
34
+ i() === "system" && (a(r("system")), e?.());
35
+ };
36
+ return t.addEventListener("change", n), () => t.removeEventListener("change", n);
37
+ }
38
+ //#endregion
39
+ export { a as applyTheme, s as cycleAppearance, r as getEffectiveTheme, i as getStoredAppearance, l as initDir, u as onSystemThemeChange, o as setAppearance, c as toggleDir };
@@ -0,0 +1,39 @@
1
+ //#region src/base/theme/host-layout-detector.ts
2
+ var e = [
3
+ "#wpadminbar",
4
+ "nav.navbar",
5
+ "[data-region=\"navbar\"]",
6
+ "[data-host-header]"
7
+ ], t = null, n = null;
8
+ function r() {
9
+ if (typeof document > "u") return 0;
10
+ for (let t of e) {
11
+ let e = document.querySelector(t);
12
+ if (e) {
13
+ let t = e.getBoundingClientRect();
14
+ return Math.round(t.height);
15
+ }
16
+ }
17
+ return 0;
18
+ }
19
+ function i() {
20
+ let e = r(), t = document.documentElement.style.getPropertyValue("--host-header-height"), n = `${e}px`;
21
+ t !== n && document.documentElement.style.setProperty("--host-header-height", n);
22
+ }
23
+ function a() {
24
+ typeof document > "u" || (i(), n || (n = () => i(), window.addEventListener("resize", n, { passive: !0 })), t || (t = new MutationObserver(() => {
25
+ requestAnimationFrame(() => i());
26
+ }), t.observe(document.body, {
27
+ childList: !0,
28
+ subtree: !1,
29
+ attributes: !1
30
+ })));
31
+ }
32
+ function o(e) {
33
+ typeof document > "u" || document.documentElement.style.setProperty("--host-header-height", `${e}px`);
34
+ }
35
+ function s() {
36
+ n &&= (window.removeEventListener("resize", n), null), t &&= (t.disconnect(), null);
37
+ }
38
+ //#endregion
39
+ export { s as destroyHostHeaderHeight, a as initHostHeaderHeight, o as setHostHeaderHeight };