@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.
- package/README.md +28 -8
- package/dist-lib/base/shell/AuthShell.js +39 -0
- package/dist-lib/base/shell/BasicShell.js +207 -0
- package/dist-lib/base/shell/ImmersiveShell.js +55 -0
- package/dist-lib/base/shell/partials/InspectorContext.js +60 -0
- package/dist-lib/base/shell/partials/InspectorPanel.js +22 -0
- package/dist-lib/base/shell/partials/NavErrorBoundary.js +66 -0
- package/dist-lib/base/shell/partials/OverlayScreen.js +36 -0
- package/dist-lib/base/shell/partials/PageActionButton.js +4 -0
- package/dist-lib/base/theme/appearance.js +39 -0
- package/dist-lib/base/theme/host-layout-detector.js +39 -0
- package/dist-lib/base/theme/host-theme-detector.js +131 -0
- package/dist-lib/base/theme/sidebar-safelist.txt +20 -0
- package/dist-lib/base/theme/tailwind-theme.css +136 -0
- package/dist-lib/base/theme/theme-bridge.css +164 -0
- package/dist-lib/base/theme/theme-context.js +103 -0
- package/dist-lib/base/theme/themes/classic.css +174 -0
- package/dist-lib/base/theme/tokens.css +290 -0
- package/dist-lib/base/theme/useHostTheme.js +34 -0
- package/dist-lib/base/utils/clipboard.js +16 -0
- package/dist-lib/base/utils/conditions.js +13 -0
- package/dist-lib/base/utils/icon-registry.js +16 -0
- package/dist-lib/base/utils/icons.js +11 -0
- package/dist-lib/base/utils/interpolate.js +6 -0
- package/dist-lib/base/utils/register-default-icons.js +9 -0
- package/dist-lib/base/utils/storage.js +30 -0
- package/dist-lib/base/utils/time.js +59 -0
- package/dist-lib/chunks/subpath-BD_PKGUX.js +146 -0
- package/dist-lib/chunks/subpath-DLFO_UGQ.js +604 -0
- package/dist-lib/components/reui/accordion.js +43 -0
- package/dist-lib/components/reui/alert-dialog.js +101 -0
- package/dist-lib/components/reui/alert.js +55 -0
- package/dist-lib/components/reui/aspect-ratio.js +11 -0
- package/dist-lib/components/reui/autocomplete.js +170 -0
- package/dist-lib/components/reui/avatar.js +51 -0
- package/dist-lib/components/reui/badge.js +64 -0
- package/dist-lib/components/reui/breadcrumb.js +69 -0
- package/dist-lib/components/reui/button-group.js +38 -0
- package/dist-lib/components/reui/button.js +47 -0
- package/dist-lib/components/reui/calendar.js +89 -0
- package/dist-lib/components/reui/card.js +55 -0
- package/dist-lib/components/reui/carousel.js +110 -0
- package/dist-lib/components/reui/chart.js +130 -0
- package/dist-lib/components/reui/checkbox.js +20 -0
- package/dist-lib/components/reui/collapsible.js +23 -0
- package/dist-lib/components/reui/combobox.js +166 -0
- package/dist-lib/components/reui/command.js +85 -0
- package/dist-lib/components/reui/context-menu.js +121 -0
- package/dist-lib/components/reui/data-grid/data-grid-column-filter.js +108 -0
- package/dist-lib/components/reui/data-grid/data-grid-column-header.js +217 -0
- package/dist-lib/components/reui/data-grid/data-grid-column-visibility.js +25 -0
- package/dist-lib/components/reui/data-grid/data-grid-pagination.js +132 -0
- package/dist-lib/components/reui/data-grid/data-grid-scroll-area.js +183 -0
- package/dist-lib/components/reui/data-grid/data-grid-table-dnd-rows.js +125 -0
- package/dist-lib/components/reui/data-grid/data-grid-table-dnd.js +130 -0
- package/dist-lib/components/reui/data-grid/data-grid-table-virtual.js +156 -0
- package/dist-lib/components/reui/data-grid/data-grid-table.js +546 -0
- package/dist-lib/components/reui/data-grid/data-grid.js +113 -0
- package/dist-lib/components/reui/data-grid-pagination.js +131 -0
- package/dist-lib/components/reui/date-selector.js +642 -0
- package/dist-lib/components/reui/dialog.js +94 -0
- package/dist-lib/components/reui/drawer.js +77 -0
- package/dist-lib/components/reui/dropdown-menu.js +123 -0
- package/dist-lib/components/reui/empty.js +59 -0
- package/dist-lib/components/reui/field.js +115 -0
- package/dist-lib/components/reui/filters.js +873 -0
- package/dist-lib/components/reui/frame.js +97 -0
- package/dist-lib/components/reui/hover-card.js +31 -0
- package/dist-lib/components/reui/icon-placeholder.js +14 -0
- package/dist-lib/components/reui/index.js +18 -0
- package/dist-lib/components/reui/input-group.js +78 -0
- package/dist-lib/components/reui/input-otp.js +44 -0
- package/dist-lib/components/reui/input.js +14 -0
- package/dist-lib/components/reui/item.js +116 -0
- package/dist-lib/components/reui/kanban.js +316 -0
- package/dist-lib/components/reui/kbd.js +19 -0
- package/dist-lib/components/reui/label.js +14 -0
- package/dist-lib/components/reui/menubar.js +132 -0
- package/dist-lib/components/reui/native-select.js +37 -0
- package/dist-lib/components/reui/navigation-menu.js +80 -0
- package/dist-lib/components/reui/number-field.js +126 -0
- package/dist-lib/components/reui/pagination.js +78 -0
- package/dist-lib/components/reui/phone-input.js +124 -0
- package/dist-lib/components/reui/popover.js +55 -0
- package/dist-lib/components/reui/progress.js +20 -0
- package/dist-lib/components/reui/radio-group.js +27 -0
- package/dist-lib/components/reui/rating.js +81 -0
- package/dist-lib/components/reui/resizable.js +31 -0
- package/dist-lib/components/reui/scroll-area.js +36 -0
- package/dist-lib/components/reui/scrollspy.js +104 -0
- package/dist-lib/components/reui/select.js +97 -0
- package/dist-lib/components/reui/separator.js +17 -0
- package/dist-lib/components/reui/sheet.js +81 -0
- package/dist-lib/components/reui/sidebar.js +350 -0
- package/dist-lib/components/reui/skeleton.js +12 -0
- package/dist-lib/components/reui/slider.js +35 -0
- package/dist-lib/components/reui/sonner.js +28 -0
- package/dist-lib/components/reui/sortable.js +172 -0
- package/dist-lib/components/reui/spinner.js +14 -0
- package/dist-lib/components/reui/stepper.js +193 -0
- package/dist-lib/components/reui/svgs/claudeAiIcon.js +13 -0
- package/dist-lib/components/reui/svgs/gemini.js +257 -0
- package/dist-lib/components/reui/svgs/openai.js +10 -0
- package/dist-lib/components/reui/svgs/openaiDark.js +13 -0
- package/dist-lib/components/reui/switch.js +19 -0
- package/dist-lib/components/reui/table.js +66 -0
- package/dist-lib/components/reui/tabs.js +47 -0
- package/dist-lib/components/reui/textarea.js +13 -0
- package/dist-lib/components/reui/timeline.js +84 -0
- package/dist-lib/components/reui/toggle-group.js +48 -0
- package/dist-lib/components/reui/toggle.js +36 -0
- package/dist-lib/components/reui/tooltip.js +35 -0
- package/dist-lib/components/reui/tree.js +102 -0
- package/dist-lib/i18n/I18nProvider.js +23 -0
- package/dist-lib/i18n/host-resolver.js +10 -0
- package/dist-lib/i18n/instance.js +2 -0
- package/dist-lib/i18n/locales/en/ui.json +266 -0
- package/dist-lib/i18n/locales/en/validators.json +13 -0
- package/dist-lib/i18n/locales/pt-BR/ui.json +266 -0
- package/dist-lib/i18n/locales/pt-BR/validators.json +13 -0
- package/dist-lib/i18n/register-strings.js +7 -0
- package/dist-lib/i18n/render-label.js +13 -0
- package/dist-lib/i18n/resolve-field-error.js +10 -0
- package/dist-lib/i18n/useHostString.js +31 -0
- package/dist-lib/i18n/useTranslation.js +48 -0
- package/dist-lib/lib/actions/resolve-action-target.js +48 -0
- package/dist-lib/lib/hooks/use-copy-to-clipboard.js +18 -0
- package/dist-lib/lib/hooks/use-file-upload.js +171 -0
- package/dist-lib/lib/hooks/use-mobile.js +18 -0
- package/dist-lib/lib/portal-container.js +7 -0
- package/dist-lib/lib/utils.js +8 -0
- package/dist-lib/middag-react.css +1 -1
- 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 };
|