@middag-io/react 0.33.0 → 0.35.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 (133) hide show
  1. package/README.md +28 -8
  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/tailwind-theme.css +136 -0
  15. package/dist-lib/base/theme/theme-bridge.css +164 -0
  16. package/dist-lib/base/theme/theme-context.js +103 -0
  17. package/dist-lib/base/theme/themes/classic.css +174 -0
  18. package/dist-lib/base/theme/tokens.css +290 -0
  19. package/dist-lib/base/theme/useHostTheme.js +34 -0
  20. package/dist-lib/base/utils/clipboard.js +16 -0
  21. package/dist-lib/base/utils/conditions.js +13 -0
  22. package/dist-lib/base/utils/icon-registry.js +16 -0
  23. package/dist-lib/base/utils/icons.js +11 -0
  24. package/dist-lib/base/utils/interpolate.js +6 -0
  25. package/dist-lib/base/utils/register-default-icons.js +9 -0
  26. package/dist-lib/base/utils/storage.js +30 -0
  27. package/dist-lib/base/utils/time.js +59 -0
  28. package/dist-lib/chunks/subpath-BD_PKGUX.js +146 -0
  29. package/dist-lib/chunks/subpath-DLFO_UGQ.js +604 -0
  30. package/dist-lib/components/reui/accordion.js +43 -0
  31. package/dist-lib/components/reui/alert-dialog.js +101 -0
  32. package/dist-lib/components/reui/alert.js +55 -0
  33. package/dist-lib/components/reui/aspect-ratio.js +11 -0
  34. package/dist-lib/components/reui/autocomplete.js +170 -0
  35. package/dist-lib/components/reui/avatar.js +51 -0
  36. package/dist-lib/components/reui/badge.js +64 -0
  37. package/dist-lib/components/reui/breadcrumb.js +69 -0
  38. package/dist-lib/components/reui/button-group.js +38 -0
  39. package/dist-lib/components/reui/button.js +47 -0
  40. package/dist-lib/components/reui/calendar.js +89 -0
  41. package/dist-lib/components/reui/card.js +55 -0
  42. package/dist-lib/components/reui/carousel.js +110 -0
  43. package/dist-lib/components/reui/chart.js +130 -0
  44. package/dist-lib/components/reui/checkbox.js +20 -0
  45. package/dist-lib/components/reui/collapsible.js +23 -0
  46. package/dist-lib/components/reui/combobox.js +166 -0
  47. package/dist-lib/components/reui/command.js +85 -0
  48. package/dist-lib/components/reui/context-menu.js +121 -0
  49. package/dist-lib/components/reui/data-grid/data-grid-column-filter.js +108 -0
  50. package/dist-lib/components/reui/data-grid/data-grid-column-header.js +217 -0
  51. package/dist-lib/components/reui/data-grid/data-grid-column-visibility.js +25 -0
  52. package/dist-lib/components/reui/data-grid/data-grid-pagination.js +132 -0
  53. package/dist-lib/components/reui/data-grid/data-grid-scroll-area.js +183 -0
  54. package/dist-lib/components/reui/data-grid/data-grid-table-dnd-rows.js +125 -0
  55. package/dist-lib/components/reui/data-grid/data-grid-table-dnd.js +130 -0
  56. package/dist-lib/components/reui/data-grid/data-grid-table-virtual.js +156 -0
  57. package/dist-lib/components/reui/data-grid/data-grid-table.js +546 -0
  58. package/dist-lib/components/reui/data-grid/data-grid.js +113 -0
  59. package/dist-lib/components/reui/data-grid-pagination.js +131 -0
  60. package/dist-lib/components/reui/date-selector.js +642 -0
  61. package/dist-lib/components/reui/dialog.js +94 -0
  62. package/dist-lib/components/reui/drawer.js +77 -0
  63. package/dist-lib/components/reui/dropdown-menu.js +123 -0
  64. package/dist-lib/components/reui/empty.js +59 -0
  65. package/dist-lib/components/reui/field.js +115 -0
  66. package/dist-lib/components/reui/filters.js +873 -0
  67. package/dist-lib/components/reui/frame.js +97 -0
  68. package/dist-lib/components/reui/hover-card.js +31 -0
  69. package/dist-lib/components/reui/icon-placeholder.js +14 -0
  70. package/dist-lib/components/reui/index.js +18 -0
  71. package/dist-lib/components/reui/input-group.js +78 -0
  72. package/dist-lib/components/reui/input-otp.js +44 -0
  73. package/dist-lib/components/reui/input.js +14 -0
  74. package/dist-lib/components/reui/item.js +116 -0
  75. package/dist-lib/components/reui/kanban.js +316 -0
  76. package/dist-lib/components/reui/kbd.js +19 -0
  77. package/dist-lib/components/reui/label.js +14 -0
  78. package/dist-lib/components/reui/menubar.js +132 -0
  79. package/dist-lib/components/reui/native-select.js +37 -0
  80. package/dist-lib/components/reui/navigation-menu.js +80 -0
  81. package/dist-lib/components/reui/number-field.js +126 -0
  82. package/dist-lib/components/reui/pagination.js +78 -0
  83. package/dist-lib/components/reui/phone-input.js +124 -0
  84. package/dist-lib/components/reui/popover.js +55 -0
  85. package/dist-lib/components/reui/progress.js +20 -0
  86. package/dist-lib/components/reui/radio-group.js +27 -0
  87. package/dist-lib/components/reui/rating.js +81 -0
  88. package/dist-lib/components/reui/resizable.js +31 -0
  89. package/dist-lib/components/reui/scroll-area.js +36 -0
  90. package/dist-lib/components/reui/scrollspy.js +104 -0
  91. package/dist-lib/components/reui/select.js +97 -0
  92. package/dist-lib/components/reui/separator.js +17 -0
  93. package/dist-lib/components/reui/sheet.js +81 -0
  94. package/dist-lib/components/reui/sidebar.js +350 -0
  95. package/dist-lib/components/reui/skeleton.js +12 -0
  96. package/dist-lib/components/reui/slider.js +35 -0
  97. package/dist-lib/components/reui/sonner.js +28 -0
  98. package/dist-lib/components/reui/sortable.js +172 -0
  99. package/dist-lib/components/reui/spinner.js +14 -0
  100. package/dist-lib/components/reui/stepper.js +193 -0
  101. package/dist-lib/components/reui/svgs/claudeAiIcon.js +13 -0
  102. package/dist-lib/components/reui/svgs/gemini.js +257 -0
  103. package/dist-lib/components/reui/svgs/openai.js +10 -0
  104. package/dist-lib/components/reui/svgs/openaiDark.js +13 -0
  105. package/dist-lib/components/reui/switch.js +19 -0
  106. package/dist-lib/components/reui/table.js +66 -0
  107. package/dist-lib/components/reui/tabs.js +47 -0
  108. package/dist-lib/components/reui/textarea.js +13 -0
  109. package/dist-lib/components/reui/timeline.js +84 -0
  110. package/dist-lib/components/reui/toggle-group.js +48 -0
  111. package/dist-lib/components/reui/toggle.js +36 -0
  112. package/dist-lib/components/reui/tooltip.js +35 -0
  113. package/dist-lib/components/reui/tree.js +102 -0
  114. package/dist-lib/i18n/I18nProvider.js +23 -0
  115. package/dist-lib/i18n/host-resolver.js +10 -0
  116. package/dist-lib/i18n/instance.js +2 -0
  117. package/dist-lib/i18n/locales/en/ui.json +266 -0
  118. package/dist-lib/i18n/locales/en/validators.json +13 -0
  119. package/dist-lib/i18n/locales/pt-BR/ui.json +266 -0
  120. package/dist-lib/i18n/locales/pt-BR/validators.json +13 -0
  121. package/dist-lib/i18n/register-strings.js +7 -0
  122. package/dist-lib/i18n/render-label.js +13 -0
  123. package/dist-lib/i18n/resolve-field-error.js +10 -0
  124. package/dist-lib/i18n/useHostString.js +31 -0
  125. package/dist-lib/i18n/useTranslation.js +48 -0
  126. package/dist-lib/lib/actions/resolve-action-target.js +48 -0
  127. package/dist-lib/lib/hooks/use-copy-to-clipboard.js +18 -0
  128. package/dist-lib/lib/hooks/use-file-upload.js +171 -0
  129. package/dist-lib/lib/hooks/use-mobile.js +18 -0
  130. package/dist-lib/lib/portal-container.js +7 -0
  131. package/dist-lib/lib/utils.js +8 -0
  132. package/dist-lib/middag-react.css +1 -1
  133. package/package.json +41 -8
@@ -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 };