@skiddph/prui 0.4.0 → 0.4.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.
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
import { jsx as e, jsxs as d, Fragment as je } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { Routes as Me, Route as
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { Routes as Me, Route as ee, Navigate as $e, MemoryRouter as Oe, BrowserRouter as ze, useLocation as se, useNavigate as Ae, Outlet as De, Link as Fe, NavLink as Le } from "react-router-dom";
|
|
4
4
|
import { X as Ie, Menu as _e, Search as qe, Palette as Be, ChevronDown as Ke, Pencil as Ve, Trash2 as Ue, Plus as Je, Clock as Ye } from "lucide-react";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as E } from "../core/cn.js";
|
|
6
6
|
import { Dropdown as He } from "../core/dropdown.js";
|
|
7
|
-
import { Button as
|
|
8
|
-
import { resolveThemeName as We, themeMode as Xe, readPersistedTheme as Ge, applyTheme as
|
|
9
|
-
import { Modal as
|
|
10
|
-
import { b as
|
|
11
|
-
import { Textarea as
|
|
12
|
-
import { Label as
|
|
13
|
-
import { Select as
|
|
14
|
-
import { Switch as
|
|
15
|
-
import { Card as
|
|
16
|
-
const
|
|
7
|
+
import { Button as A } from "../core/button.js";
|
|
8
|
+
import { resolveThemeName as We, themeMode as Xe, readPersistedTheme as Ge, applyTheme as te, listThemes as Qe, clearAppliedTokens as Ze } from "../theme.js";
|
|
9
|
+
import { Modal as ie, confirmModal as et } from "../core/modal.js";
|
|
10
|
+
import { b as tt, D as rt, a as at } from "./data-table-toolbar-BUy2EWPy.js";
|
|
11
|
+
import { Textarea as nt, Input as V } from "../core/input.js";
|
|
12
|
+
import { Label as lt } from "../core/label.js";
|
|
13
|
+
import { Select as oe } from "../core/select.js";
|
|
14
|
+
import { Switch as ue } from "../core/switch.js";
|
|
15
|
+
import { Card as ce, CardHeader as de, CardDescription as me, CardTitle as pe, CardContent as fe } from "../core/card.js";
|
|
16
|
+
const st = [
|
|
17
17
|
{ path: "/login", name: "login" },
|
|
18
18
|
{ path: "/register", name: "register" },
|
|
19
19
|
{ path: "/forgot-password", name: "forgotPassword" },
|
|
20
20
|
{ path: "/reset-password", name: "resetPassword" },
|
|
21
21
|
{ path: "/otp", name: "otp" },
|
|
22
22
|
{ path: "/logout", name: "logout" }
|
|
23
|
-
],
|
|
23
|
+
], it = [
|
|
24
24
|
{ path: "/404", name: "notFound" },
|
|
25
25
|
{ path: "/error", name: "error" },
|
|
26
26
|
{ path: "/profile", name: "profile" },
|
|
27
27
|
{ path: "/settings", name: "settings" },
|
|
28
28
|
{ path: "/admin-setup", name: "adminSetup" }
|
|
29
29
|
];
|
|
30
|
-
function
|
|
31
|
-
const r = t === "auth" || t === "auth+utility", l = t === "utility" || t === "auth+utility",
|
|
32
|
-
...r ?
|
|
33
|
-
...l ?
|
|
34
|
-
], [
|
|
35
|
-
return
|
|
36
|
-
let
|
|
37
|
-
return import("../pages.js").then((
|
|
38
|
-
|
|
30
|
+
function ot({ mode: t, config: a, children: n }) {
|
|
31
|
+
const r = t === "auth" || t === "auth+utility", l = t === "utility" || t === "auth+utility", m = [
|
|
32
|
+
...r ? st : [],
|
|
33
|
+
...l ? it : []
|
|
34
|
+
], [p, v] = i.useState(null);
|
|
35
|
+
return i.useEffect(() => {
|
|
36
|
+
let h = !1;
|
|
37
|
+
return import("../pages.js").then((f) => {
|
|
38
|
+
h || v(f.PagesRegistry);
|
|
39
39
|
}), () => {
|
|
40
|
-
|
|
40
|
+
h = !0;
|
|
41
41
|
};
|
|
42
|
-
}, []),
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
return
|
|
42
|
+
}, []), p ? /* @__PURE__ */ d(Me, { children: [
|
|
43
|
+
m.map(({ path: h, name: f }) => {
|
|
44
|
+
const k = p[f];
|
|
45
|
+
return k ? /* @__PURE__ */ e(ee, { path: h, element: /* @__PURE__ */ e(k, { ...(a == null ? void 0 : a[f]) ?? {} }) }, h) : null;
|
|
46
46
|
}),
|
|
47
47
|
n,
|
|
48
|
-
r ? /* @__PURE__ */ e(
|
|
48
|
+
r ? /* @__PURE__ */ e(ee, { path: "*", element: /* @__PURE__ */ e($e, { to: "/login", replace: !0 }) }) : null
|
|
49
49
|
] }) : /* @__PURE__ */ e("div", { className: "p-8 text-center text-sm text-[var(--prui-dim)]", children: "Loading…" });
|
|
50
50
|
}
|
|
51
|
-
const
|
|
52
|
-
() => Promise.resolve().then(() =>
|
|
51
|
+
const ut = i.lazy(
|
|
52
|
+
() => Promise.resolve().then(() => Tt).then((t) => ({ default: t.SessionTimeout }))
|
|
53
53
|
);
|
|
54
|
-
function
|
|
55
|
-
const a = t !== !1, n = typeof t == "object" ? t : {}, r = n.persist !== !1, l = We(n.default ?? "control"),
|
|
56
|
-
(
|
|
57
|
-
f
|
|
54
|
+
function ct(t) {
|
|
55
|
+
const a = t !== !1, n = typeof t == "object" ? t : {}, r = n.persist !== !1, l = We(n.default ?? "control"), m = Xe(l), [p, v] = i.useState(() => (r ? Ge() : null) ?? { theme: l, mode: m }), h = i.useCallback(
|
|
56
|
+
(f) => {
|
|
57
|
+
v(f), te({ theme: f.theme, mode: f.mode, storageKey: r ? "prui:theme" : null });
|
|
58
58
|
},
|
|
59
59
|
[r]
|
|
60
60
|
);
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
}, [
|
|
61
|
+
return i.useEffect(() => {
|
|
62
|
+
te({ theme: p.theme, mode: p.mode, storageKey: r ? "prui:theme" : null });
|
|
63
|
+
}, [p, r]), { enabled: a, state: p, setTheme: h };
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
const { enabled: a, state: n, setTheme: r } =
|
|
65
|
+
function dt({ config: t }) {
|
|
66
|
+
const { enabled: a, state: n, setTheme: r } = ct(t);
|
|
67
67
|
return a ? /* @__PURE__ */ e(
|
|
68
68
|
He,
|
|
69
69
|
{
|
|
@@ -81,56 +81,58 @@ function ct({ config: t }) {
|
|
|
81
81
|
),
|
|
82
82
|
items: Qe().map((l) => ({
|
|
83
83
|
label: `${l}${l === n.theme ? " (active)" : ""}`,
|
|
84
|
-
onSelect: () =>
|
|
84
|
+
onSelect: () => {
|
|
85
|
+
Ze(), r({ theme: l, mode: l === "daylight" ? "light" : "dark" });
|
|
86
|
+
}
|
|
85
87
|
}))
|
|
86
88
|
}
|
|
87
89
|
) : null;
|
|
88
90
|
}
|
|
89
|
-
function
|
|
91
|
+
function re(t, a) {
|
|
90
92
|
return a === "/" ? t === "/" : t === a || t.startsWith(a + "/");
|
|
91
93
|
}
|
|
92
|
-
function
|
|
93
|
-
const { pathname:
|
|
94
|
-
(
|
|
95
|
-
), [
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}, [
|
|
99
|
-
const
|
|
94
|
+
function mt({ item: t, onNavigate: a, expandAllOn: n }) {
|
|
95
|
+
const { pathname: r } = se(), l = (t.items ?? []).some(
|
|
96
|
+
(h) => h.href ? re(r, h.href) : (h.items ?? []).some((f) => f.href && re(r, f.href))
|
|
97
|
+
), [m, p] = i.useState(l || n !== void 0 && r === n);
|
|
98
|
+
i.useEffect(() => {
|
|
99
|
+
l && p(!0);
|
|
100
|
+
}, [l]);
|
|
101
|
+
const v = t.icon;
|
|
100
102
|
return /* @__PURE__ */ d("li", { "data-testid": "nav-group", children: [
|
|
101
103
|
/* @__PURE__ */ d(
|
|
102
104
|
"button",
|
|
103
105
|
{
|
|
104
106
|
type: "button",
|
|
105
|
-
"aria-expanded":
|
|
106
|
-
onClick: () => p((
|
|
107
|
-
className:
|
|
107
|
+
"aria-expanded": m,
|
|
108
|
+
onClick: () => p((h) => !h),
|
|
109
|
+
className: E(
|
|
108
110
|
"flex w-full items-center gap-2 rounded-[var(--prui-radius)] px-2.5 py-1.5 text-sm cursor-pointer",
|
|
109
|
-
|
|
111
|
+
l ? "text-[var(--prui-fg)]" : "text-[var(--prui-dim)] hover:text-[var(--prui-fg)]"
|
|
110
112
|
),
|
|
111
113
|
children: [
|
|
112
|
-
|
|
114
|
+
v ? /* @__PURE__ */ e(v, { className: "h-4 w-4 shrink-0", "aria-hidden": !0 }) : null,
|
|
113
115
|
/* @__PURE__ */ e("span", { className: "flex-1 text-left truncate", children: t.label }),
|
|
114
|
-
/* @__PURE__ */ e(Ke, { className:
|
|
116
|
+
/* @__PURE__ */ e(Ke, { className: E("h-4 w-4 transition-transform", !m && "-rotate-90"), "aria-hidden": !0 })
|
|
115
117
|
]
|
|
116
118
|
}
|
|
117
119
|
),
|
|
118
|
-
|
|
120
|
+
m ? /* @__PURE__ */ e("ul", { className: "ml-4 mt-0.5 flex flex-col gap-0.5 border-l border-[var(--prui-line)] pl-2", children: (t.items ?? []).map((h) => /* @__PURE__ */ e(he, { item: h, onNavigate: a, nested: !0, expandAllOn: n }, h.href ?? h.label)) }) : null
|
|
119
121
|
] });
|
|
120
122
|
}
|
|
121
|
-
function
|
|
123
|
+
function pt({ label: t }) {
|
|
122
124
|
return /* @__PURE__ */ e("li", { className: "px-2.5 pb-1 pt-3 text-[10px] font-semibold uppercase tracking-[0.1em] text-[var(--prui-dim)]", "data-testid": "nav-subgroup", children: t });
|
|
123
125
|
}
|
|
124
|
-
function
|
|
125
|
-
return t.items && t.items.length > 0 ? /* @__PURE__ */ e(
|
|
126
|
+
function he({ item: t, onNavigate: a, nested: n, expandAllOn: r }) {
|
|
127
|
+
return t.items && t.items.length > 0 ? /* @__PURE__ */ e(mt, { item: t, onNavigate: a, expandAllOn: r }) : t.heading || !t.href && !t.items ? /* @__PURE__ */ e(pt, { label: t.label }) : t.href ? /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
|
|
126
128
|
Le,
|
|
127
129
|
{
|
|
128
130
|
to: t.href,
|
|
129
131
|
onClick: a,
|
|
130
|
-
className: ({ isActive:
|
|
132
|
+
className: ({ isActive: l }) => E(
|
|
131
133
|
"flex items-center gap-2 rounded-[var(--prui-radius)] px-2.5 py-1.5 text-sm",
|
|
132
134
|
n && "pl-2.5",
|
|
133
|
-
|
|
135
|
+
l ? "bg-[var(--prui-brand)]/15 text-[var(--prui-brand)] font-medium" : "text-[var(--prui-dim)] hover:text-[var(--prui-fg)] hover:bg-[var(--prui-raise)]"
|
|
134
136
|
),
|
|
135
137
|
children: [
|
|
136
138
|
t.icon && !n ? /* @__PURE__ */ e(t.icon, { className: "h-4 w-4 shrink-0", "aria-hidden": !0 }) : null,
|
|
@@ -139,10 +141,10 @@ function fe({ item: t, onNavigate: a, nested: n }) {
|
|
|
139
141
|
}
|
|
140
142
|
) }) : null;
|
|
141
143
|
}
|
|
142
|
-
function
|
|
143
|
-
return /* @__PURE__ */ e("nav", { "aria-label": "Main", className: "prui-app-nav", children: /* @__PURE__ */ e("ul", { className: "flex flex-col gap-0.5", children: t.map((
|
|
144
|
+
function ae({ nav: t, onNavigate: a, expandAllOn: n }) {
|
|
145
|
+
return /* @__PURE__ */ e("nav", { "aria-label": "Main", className: "prui-app-nav", children: /* @__PURE__ */ e("ul", { className: "flex flex-col gap-0.5", children: t.map((r) => /* @__PURE__ */ e(he, { item: r, onNavigate: a, expandAllOn: n }, r.href ?? r.label)) }) });
|
|
144
146
|
}
|
|
145
|
-
function
|
|
147
|
+
function ft({ brand: t }) {
|
|
146
148
|
if (!t) return null;
|
|
147
149
|
const a = /* @__PURE__ */ d(je, { children: [
|
|
148
150
|
t.mark ? /* @__PURE__ */ e("img", { src: t.mark, alt: "", className: "h-6 w-6 rounded-[var(--prui-radius-1)] object-cover" }) : null,
|
|
@@ -150,28 +152,28 @@ function pt({ brand: t }) {
|
|
|
150
152
|
] }), n = "flex items-center gap-2 px-1 py-1 min-w-0";
|
|
151
153
|
return t.href === null ? /* @__PURE__ */ e("div", { className: n, children: a }) : /* @__PURE__ */ e(Fe, { to: t.href ?? "/", className: n, "aria-label": t.name, children: a });
|
|
152
154
|
}
|
|
153
|
-
function
|
|
155
|
+
function ht({
|
|
154
156
|
open: t,
|
|
155
157
|
onOpenChange: a,
|
|
156
158
|
entries: n,
|
|
157
159
|
placeholder: r = "Type a command or search...",
|
|
158
160
|
onNavigate: l
|
|
159
161
|
}) {
|
|
160
|
-
const [
|
|
161
|
-
const
|
|
162
|
-
return
|
|
163
|
-
}, [n,
|
|
164
|
-
if (
|
|
165
|
-
const
|
|
166
|
-
a(!1),
|
|
162
|
+
const [m, p] = i.useState(""), [v, h] = i.useState(0), f = i.useMemo(() => {
|
|
163
|
+
const u = m.trim().toLowerCase();
|
|
164
|
+
return u ? n.filter((b) => b.label.toLowerCase().includes(u)) : n;
|
|
165
|
+
}, [n, m]);
|
|
166
|
+
if (i.useEffect(() => h(0), [m]), !t) return null;
|
|
167
|
+
const k = (u) => {
|
|
168
|
+
a(!1), u.onSelect ? u.onSelect() : u.href && (l == null || l(u.href));
|
|
167
169
|
};
|
|
168
170
|
return /* @__PURE__ */ e(
|
|
169
171
|
"div",
|
|
170
172
|
{
|
|
171
173
|
className: "fixed inset-0 z-50 flex items-start justify-center pt-24",
|
|
172
174
|
style: { backgroundColor: "rgba(0,0,0,0.55)" },
|
|
173
|
-
onMouseDown: (
|
|
174
|
-
|
|
175
|
+
onMouseDown: (u) => {
|
|
176
|
+
u.target === u.currentTarget && a(!1);
|
|
175
177
|
},
|
|
176
178
|
children: /* @__PURE__ */ d(
|
|
177
179
|
"div",
|
|
@@ -190,37 +192,37 @@ function ft({
|
|
|
190
192
|
role: "combobox",
|
|
191
193
|
"aria-expanded": "true",
|
|
192
194
|
"aria-label": "Command palette search",
|
|
193
|
-
"aria-activedescendant":
|
|
195
|
+
"aria-activedescendant": f[v] ? `palette-option-${v}` : void 0,
|
|
194
196
|
placeholder: r,
|
|
195
|
-
value:
|
|
196
|
-
onChange: (
|
|
197
|
-
onKeyDown: (
|
|
198
|
-
if (
|
|
199
|
-
const b =
|
|
197
|
+
value: m,
|
|
198
|
+
onChange: (u) => p(u.target.value),
|
|
199
|
+
onKeyDown: (u) => {
|
|
200
|
+
if (u.key === "Escape" && a(!1), u.key === "ArrowDown" && (u.preventDefault(), h((b) => Math.min(b + 1, f.length - 1))), u.key === "ArrowUp" && (u.preventDefault(), h((b) => Math.max(b - 1, 0))), u.key === "Enter") {
|
|
201
|
+
const b = f[v];
|
|
200
202
|
b && (a(!1), b.onSelect ? b.onSelect() : b.href && (l == null || l(b.href)));
|
|
201
203
|
}
|
|
202
204
|
},
|
|
203
205
|
className: "w-full bg-transparent px-4 py-3 text-sm text-[var(--prui-fg)] placeholder:text-[var(--prui-dim)] outline-none border-b border-[var(--prui-line)] rounded-t-[var(--prui-radius)]"
|
|
204
206
|
}
|
|
205
207
|
),
|
|
206
|
-
/* @__PURE__ */ e("ul", { role: "listbox", className: "max-h-64 overflow-auto p-1", children:
|
|
208
|
+
/* @__PURE__ */ e("ul", { role: "listbox", className: "max-h-64 overflow-auto p-1", children: f.length === 0 ? /* @__PURE__ */ e("li", { className: "px-3 py-2 text-sm text-[var(--prui-dim)]", children: "No matches." }) : f.map((u, b) => /* @__PURE__ */ d(
|
|
207
209
|
"li",
|
|
208
210
|
{
|
|
209
211
|
id: `palette-option-${b}`,
|
|
210
212
|
role: "option",
|
|
211
|
-
"aria-selected": b ===
|
|
212
|
-
onMouseEnter: () =>
|
|
213
|
-
onClick: () =>
|
|
214
|
-
className:
|
|
213
|
+
"aria-selected": b === v,
|
|
214
|
+
onMouseEnter: () => h(b),
|
|
215
|
+
onClick: () => k(u),
|
|
216
|
+
className: E(
|
|
215
217
|
"cursor-pointer rounded-[calc(var(--prui-radius)-1px)] px-3 py-2 text-sm text-[var(--prui-fg)]",
|
|
216
|
-
b ===
|
|
218
|
+
b === v && "bg-[var(--prui-raise)]"
|
|
217
219
|
),
|
|
218
220
|
children: [
|
|
219
|
-
|
|
220
|
-
|
|
221
|
+
u.group ? /* @__PURE__ */ e("span", { className: "mr-2 text-xs text-[var(--prui-dim)]", children: u.group }) : null,
|
|
222
|
+
u.label
|
|
221
223
|
]
|
|
222
224
|
},
|
|
223
|
-
`${
|
|
225
|
+
`${u.label}-${b}`
|
|
224
226
|
)) })
|
|
225
227
|
]
|
|
226
228
|
}
|
|
@@ -228,68 +230,69 @@ function ft({
|
|
|
228
230
|
}
|
|
229
231
|
);
|
|
230
232
|
}
|
|
231
|
-
function
|
|
233
|
+
function bt(t) {
|
|
232
234
|
const {
|
|
233
235
|
brand: a,
|
|
234
236
|
nav: n = [],
|
|
235
237
|
search: r = !0,
|
|
236
238
|
theme: l = !0,
|
|
237
|
-
auth:
|
|
238
|
-
sidebar:
|
|
239
|
-
header:
|
|
240
|
-
pages:
|
|
241
|
-
pagesConfig:
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
239
|
+
auth: m = !1,
|
|
240
|
+
sidebar: p = {},
|
|
241
|
+
header: v,
|
|
242
|
+
pages: h,
|
|
243
|
+
pagesConfig: f,
|
|
244
|
+
expandAllOn: k,
|
|
245
|
+
children: u
|
|
246
|
+
} = t, b = typeof r == "object" ? r : { enabled: r !== !1 }, M = b.enabled !== !1, P = b.hotkey ?? "/", O = p.collapsible !== !1, [y, T] = i.useState(p.defaultOpen === !0), [R, C] = i.useState(!1), $ = se(), w = Ae(), s = i.useMemo(
|
|
247
|
+
() => m === !1 ? null : m === !0 ? {} : m,
|
|
248
|
+
[m]
|
|
249
|
+
), g = i.useCallback(() => {
|
|
250
|
+
s != null && s.onTimeout ? s.onTimeout() : w((s == null ? void 0 : s.loginPath) ?? "/login");
|
|
251
|
+
}, [s, w]), x = i.useMemo(() => {
|
|
252
|
+
const N = [];
|
|
253
|
+
for (const S of n)
|
|
254
|
+
if (S.items)
|
|
255
|
+
for (const j of S.items)
|
|
256
|
+
j.href && N.push({ label: `${S.label} / ${j.label}`, href: j.href, group: S.label });
|
|
257
|
+
else S.href && N.push({ label: S.label, href: S.href });
|
|
258
|
+
return N;
|
|
256
259
|
}, [n]);
|
|
257
|
-
|
|
258
|
-
if (!
|
|
259
|
-
const
|
|
260
|
-
const j =
|
|
261
|
-
|
|
260
|
+
i.useEffect(() => {
|
|
261
|
+
if (!M) return;
|
|
262
|
+
const N = (S) => {
|
|
263
|
+
const j = S.target, q = j && (j.tagName === "INPUT" || j.tagName === "TEXTAREA" || j.isContentEditable);
|
|
264
|
+
S.key === P && !q && !S.metaKey && !S.ctrlKey && !S.altKey && (S.preventDefault(), C(!0));
|
|
262
265
|
};
|
|
263
|
-
return document.addEventListener("keydown",
|
|
264
|
-
}, [
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}, [
|
|
269
|
-
if (!
|
|
270
|
-
const
|
|
266
|
+
return document.addEventListener("keydown", N), () => document.removeEventListener("keydown", N);
|
|
267
|
+
}, [P, M]);
|
|
268
|
+
const c = i.useRef($.pathname);
|
|
269
|
+
i.useEffect(() => {
|
|
270
|
+
c.current !== $.pathname && (c.current = $.pathname, T(!1));
|
|
271
|
+
}, [$.pathname]), i.useEffect(() => {
|
|
272
|
+
if (!y) return;
|
|
273
|
+
const N = document.body.style.overflow;
|
|
271
274
|
return document.body.style.overflow = "hidden", () => {
|
|
272
|
-
document.body.style.overflow =
|
|
275
|
+
document.body.style.overflow = N;
|
|
273
276
|
};
|
|
274
|
-
}, [
|
|
275
|
-
const
|
|
277
|
+
}, [y]);
|
|
278
|
+
const z = p.width ?? 240;
|
|
276
279
|
return /* @__PURE__ */ d("div", { className: "prui-app flex min-h-screen bg-[var(--prui-background)] text-[var(--prui-fg)]", children: [
|
|
277
280
|
/* @__PURE__ */ e(
|
|
278
281
|
"aside",
|
|
279
282
|
{
|
|
280
283
|
"data-testid": "sidebar",
|
|
281
284
|
className: "hidden md:block md:fixed md:inset-y-0 md:left-0 md:z-30 md:w-[var(--prui-sidebar-width)] md:border-r md:border-[var(--prui-line)] md:bg-[var(--prui-surface)]",
|
|
282
|
-
style: { "--prui-sidebar-width": `${
|
|
283
|
-
children: /* @__PURE__ */ e("div", { className: "h-full overflow-y-auto p-2 pt-4 scrollbar-thin", children: /* @__PURE__ */ e(
|
|
285
|
+
style: { "--prui-sidebar-width": `${z}px` },
|
|
286
|
+
children: /* @__PURE__ */ e("div", { className: "h-full overflow-y-auto p-2 pt-4 scrollbar-thin", children: /* @__PURE__ */ e(ae, { nav: n, expandAllOn: k }) })
|
|
284
287
|
}
|
|
285
288
|
),
|
|
286
|
-
|
|
289
|
+
y ? /* @__PURE__ */ d("div", { className: "md:hidden fixed inset-0 z-40", "data-testid": "mobile-drawer", children: [
|
|
287
290
|
/* @__PURE__ */ e(
|
|
288
291
|
"div",
|
|
289
292
|
{
|
|
290
293
|
className: "absolute inset-0",
|
|
291
294
|
style: { backgroundColor: "rgba(0,0,0,0.55)" },
|
|
292
|
-
onClick: () =>
|
|
295
|
+
onClick: () => T(!1),
|
|
293
296
|
"data-testid": "drawer-backdrop"
|
|
294
297
|
}
|
|
295
298
|
),
|
|
@@ -306,37 +309,37 @@ function ht(t) {
|
|
|
306
309
|
{
|
|
307
310
|
type: "button",
|
|
308
311
|
"aria-label": "Close navigation",
|
|
309
|
-
onClick: () =>
|
|
312
|
+
onClick: () => T(!1),
|
|
310
313
|
className: "rounded-[var(--prui-radius)] p-1 text-[var(--prui-dim)] hover:text-[var(--prui-fg)] cursor-pointer",
|
|
311
314
|
children: /* @__PURE__ */ e(Ie, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
312
315
|
}
|
|
313
316
|
) }),
|
|
314
|
-
/* @__PURE__ */ e(
|
|
317
|
+
/* @__PURE__ */ e(ae, { nav: n, onNavigate: () => T(!1), expandAllOn: k })
|
|
315
318
|
]
|
|
316
319
|
}
|
|
317
320
|
)
|
|
318
321
|
] }) : null,
|
|
319
|
-
/* @__PURE__ */ d("div", { className: "flex min-w-0 flex-1 flex-col md:ml-[var(--prui-sidebar-width)]", style: { "--prui-sidebar-width": `${
|
|
322
|
+
/* @__PURE__ */ d("div", { className: "flex min-w-0 flex-1 flex-col md:ml-[var(--prui-sidebar-width)]", style: { "--prui-sidebar-width": `${z}px` }, children: [
|
|
320
323
|
/* @__PURE__ */ d(
|
|
321
324
|
"header",
|
|
322
325
|
{
|
|
323
326
|
"data-testid": "app-header",
|
|
324
327
|
className: "sticky top-0 z-30 grid h-14 grid-cols-[1fr_auto_1fr] items-center gap-4 border-b border-[var(--prui-line)] bg-[var(--prui-surface)] px-4 md:px-6",
|
|
325
328
|
children: [
|
|
326
|
-
|
|
327
|
-
|
|
329
|
+
O ? /* @__PURE__ */ e(
|
|
330
|
+
A,
|
|
328
331
|
{
|
|
329
332
|
variant: "ghost",
|
|
330
333
|
size: "icon",
|
|
331
334
|
"aria-label": "Open navigation",
|
|
332
335
|
className: "md:hidden",
|
|
333
|
-
onClick: () =>
|
|
336
|
+
onClick: () => T(!0),
|
|
334
337
|
"data-testid": "drawer-toggle",
|
|
335
338
|
children: /* @__PURE__ */ e(_e, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
336
339
|
}
|
|
337
340
|
) : null,
|
|
338
|
-
/* @__PURE__ */ e("div", { className: "min-w-0 justify-self-start", children: /* @__PURE__ */ e(
|
|
339
|
-
|
|
341
|
+
/* @__PURE__ */ e("div", { className: "min-w-0 justify-self-start", children: /* @__PURE__ */ e(ft, { brand: a }) }),
|
|
342
|
+
M ? /* @__PURE__ */ d(
|
|
340
343
|
"button",
|
|
341
344
|
{
|
|
342
345
|
type: "button",
|
|
@@ -345,36 +348,36 @@ function ht(t) {
|
|
|
345
348
|
className: "hidden h-8 w-[min(420px,34vw)] items-center gap-2 rounded-[var(--prui-radius)] border border-[var(--prui-line)] bg-[var(--prui-background)] px-3.5 text-sm text-[var(--prui-dim)] hover:border-[var(--prui-dim)] cursor-pointer md:flex",
|
|
346
349
|
children: [
|
|
347
350
|
/* @__PURE__ */ e(qe, { className: "h-4 w-4", "aria-hidden": !0 }),
|
|
348
|
-
/* @__PURE__ */ e("span", { className: "flex-1 text-left", children:
|
|
349
|
-
/* @__PURE__ */ e("kbd", { className: "ml-auto rounded-[var(--prui-radius-1)] border border-[var(--prui-line)] bg-[var(--prui-raise)] px-1.5 py-0.5 text-xs", children:
|
|
351
|
+
/* @__PURE__ */ e("span", { className: "flex-1 text-left", children: b.placeholder ?? "Search..." }),
|
|
352
|
+
/* @__PURE__ */ e("kbd", { className: "ml-auto rounded-[var(--prui-radius-1)] border border-[var(--prui-line)] bg-[var(--prui-raise)] px-1.5 py-0.5 text-xs", children: P })
|
|
350
353
|
]
|
|
351
354
|
}
|
|
352
355
|
) : null,
|
|
353
356
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2 justify-self-end", children: [
|
|
354
|
-
|
|
355
|
-
/* @__PURE__ */ e(
|
|
357
|
+
v,
|
|
358
|
+
/* @__PURE__ */ e(dt, { config: l })
|
|
356
359
|
] })
|
|
357
360
|
]
|
|
358
361
|
}
|
|
359
362
|
),
|
|
360
|
-
/* @__PURE__ */ e("main", { className: "flex-1 p-4 md:p-6", children:
|
|
363
|
+
/* @__PURE__ */ e("main", { className: "flex-1 p-4 md:p-6", children: h ? /* @__PURE__ */ e(ot, { mode: h, config: f, children: u }) : u ?? /* @__PURE__ */ e(De, {}) })
|
|
361
364
|
] }),
|
|
362
|
-
|
|
363
|
-
|
|
365
|
+
s ? /* @__PURE__ */ e(i.Suspense, { fallback: null, children: /* @__PURE__ */ e(
|
|
366
|
+
ut,
|
|
364
367
|
{
|
|
365
|
-
timeout:
|
|
366
|
-
warningTime:
|
|
367
|
-
onTimeout:
|
|
368
|
+
timeout: s.sessionTimeout,
|
|
369
|
+
warningTime: s.warningTime,
|
|
370
|
+
onTimeout: g
|
|
368
371
|
}
|
|
369
372
|
) }) : null,
|
|
370
|
-
|
|
373
|
+
M ? /* @__PURE__ */ e(ht, { open: R, onOpenChange: C, entries: x, placeholder: b.placeholder, onNavigate: w }) : null
|
|
371
374
|
] });
|
|
372
375
|
}
|
|
373
|
-
function
|
|
376
|
+
function qt(t) {
|
|
374
377
|
const { router: a = "browser", initialEntries: n } = t;
|
|
375
|
-
return /* @__PURE__ */ e(a === "memory" ? Oe : ze, { initialEntries: n, children: /* @__PURE__ */ e(
|
|
378
|
+
return /* @__PURE__ */ e(a === "memory" ? Oe : ze, { initialEntries: n, children: /* @__PURE__ */ e(bt, { ...t }) });
|
|
376
379
|
}
|
|
377
|
-
const
|
|
380
|
+
const Bt = {
|
|
378
381
|
name: "App",
|
|
379
382
|
props: [
|
|
380
383
|
{ name: "brand", type: "{ name, mark?, href? }", default: "undefined", control: "object" },
|
|
@@ -386,139 +389,140 @@ const qt = {
|
|
|
386
389
|
{ name: "router", type: "'browser' | 'memory'", default: "'browser'", control: "select", options: ["browser", "memory", "react-router"] },
|
|
387
390
|
{ name: "initialEntries", type: "string[]", default: "undefined", control: "object" },
|
|
388
391
|
{ name: "pages", type: "'auth' | 'utility' | 'auth+utility'", default: "undefined", control: "select", options: ["auth", "utility", "auth+utility"] },
|
|
392
|
+
{ name: "expandAllOn", type: "string (pathname)", default: "undefined", control: "text" },
|
|
389
393
|
{ name: "header", type: "ReactNode", default: null, control: "none" },
|
|
390
394
|
{ name: "children", type: "ReactNode", default: "Outlet", control: "none" }
|
|
391
395
|
]
|
|
392
396
|
};
|
|
393
|
-
function
|
|
397
|
+
function gt(t) {
|
|
394
398
|
return Array.isArray(t) ? { fields: t } : t;
|
|
395
399
|
}
|
|
396
|
-
function
|
|
400
|
+
function vt(t) {
|
|
397
401
|
if (t)
|
|
398
402
|
return t.map((a) => typeof a == "string" || typeof a == "number" ? { label: String(a), value: String(a) } : a);
|
|
399
403
|
}
|
|
400
|
-
function
|
|
404
|
+
function ne(t, a) {
|
|
401
405
|
const n = {};
|
|
402
406
|
for (const r of t.fields)
|
|
403
407
|
a && r.name in a ? n[r.name] = a[r.name] : r.defaultValue !== void 0 ? n[r.name] = r.defaultValue : r.type === "boolean" ? n[r.name] = !1 : n[r.name] = "";
|
|
404
408
|
return n;
|
|
405
409
|
}
|
|
406
|
-
function
|
|
410
|
+
function xt({
|
|
407
411
|
schema: t,
|
|
408
412
|
initialValues: a,
|
|
409
413
|
defaultValues: n,
|
|
410
414
|
onSubmit: r,
|
|
411
415
|
onCancel: l,
|
|
412
|
-
cancelLabel:
|
|
413
|
-
submitting:
|
|
414
|
-
error:
|
|
415
|
-
className:
|
|
416
|
+
cancelLabel: m = "Cancel",
|
|
417
|
+
submitting: p = !1,
|
|
418
|
+
error: v,
|
|
419
|
+
className: h
|
|
416
420
|
}) {
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
-
b(
|
|
420
|
-
}, [JSON.stringify(
|
|
421
|
-
const
|
|
422
|
-
b((
|
|
423
|
-
if (!
|
|
424
|
-
const c = { ...
|
|
425
|
-
return delete c[
|
|
421
|
+
const f = i.useMemo(() => gt(t), [t]), k = a ?? n, [u, b] = i.useState(() => ne(f, k)), [M, P] = i.useState({}), [O, y] = i.useState(null), [T, R] = i.useState(!1);
|
|
422
|
+
i.useEffect(() => {
|
|
423
|
+
b(ne(f, k));
|
|
424
|
+
}, [JSON.stringify(f), JSON.stringify(k ?? {})]);
|
|
425
|
+
const C = (s, g) => {
|
|
426
|
+
b((x) => ({ ...x, [s]: g })), P((x) => {
|
|
427
|
+
if (!x[s]) return x;
|
|
428
|
+
const c = { ...x };
|
|
429
|
+
return delete c[s], c;
|
|
426
430
|
});
|
|
427
|
-
},
|
|
428
|
-
var
|
|
429
|
-
|
|
431
|
+
}, $ = async (s) => {
|
|
432
|
+
var x;
|
|
433
|
+
s.preventDefault();
|
|
430
434
|
const g = {};
|
|
431
|
-
for (const c of
|
|
435
|
+
for (const c of f.fields) {
|
|
432
436
|
if (c.required) {
|
|
433
|
-
const N =
|
|
437
|
+
const N = u[c.name];
|
|
434
438
|
(N === "" || N == null || Array.isArray(N) && N.length === 0) && (g[c.name] = c.name === void 0 ? "Required" : `${c.label} is required.`);
|
|
435
439
|
}
|
|
436
|
-
const
|
|
437
|
-
|
|
440
|
+
const z = (x = c.validate) == null ? void 0 : x.call(c, u[c.name], u);
|
|
441
|
+
z && (g[c.name] = z);
|
|
438
442
|
}
|
|
439
|
-
if (
|
|
440
|
-
|
|
443
|
+
if (P(g), !(Object.keys(g).length > 0)) {
|
|
444
|
+
y(null);
|
|
441
445
|
try {
|
|
442
|
-
const c = r == null ? void 0 : r({ ...
|
|
443
|
-
c && typeof c.then == "function" && (
|
|
446
|
+
const c = r == null ? void 0 : r({ ...u });
|
|
447
|
+
c && typeof c.then == "function" && (R(!0), await c);
|
|
444
448
|
} catch (c) {
|
|
445
|
-
|
|
449
|
+
y(c instanceof Error ? c.message : String(c));
|
|
446
450
|
} finally {
|
|
447
|
-
|
|
451
|
+
R(!1);
|
|
448
452
|
}
|
|
449
453
|
}
|
|
450
|
-
},
|
|
451
|
-
return /* @__PURE__ */ d("form", { onSubmit:
|
|
452
|
-
/* @__PURE__ */ e("div", { className:
|
|
453
|
-
const g = M[
|
|
454
|
-
id: `prui-form-${
|
|
454
|
+
}, w = p || T;
|
|
455
|
+
return /* @__PURE__ */ d("form", { onSubmit: $, className: E("prui-form flex flex-col gap-4", h), noValidate: !0, children: [
|
|
456
|
+
/* @__PURE__ */ e("div", { className: E("grid gap-4", f.columns === 2 && "md:grid-cols-2"), children: f.fields.map((s) => {
|
|
457
|
+
const g = M[s.name], x = {
|
|
458
|
+
id: `prui-form-${s.name}`,
|
|
455
459
|
"aria-invalid": g ? !0 : void 0,
|
|
456
|
-
"aria-describedby": g ? `prui-form-${
|
|
460
|
+
"aria-describedby": g ? `prui-form-${s.name}-error` : void 0
|
|
457
461
|
};
|
|
458
|
-
return /* @__PURE__ */ d("div", { className:
|
|
459
|
-
/* @__PURE__ */ d(
|
|
460
|
-
|
|
461
|
-
|
|
462
|
+
return /* @__PURE__ */ d("div", { className: E("flex flex-col gap-1.5", s.colSpan === 2 && "md:col-span-2", s.className), children: [
|
|
463
|
+
/* @__PURE__ */ d(lt, { htmlFor: x.id, children: [
|
|
464
|
+
s.label,
|
|
465
|
+
s.required ? /* @__PURE__ */ e("span", { className: "ml-0.5 text-[var(--prui-danger)]", children: "*" }) : null
|
|
462
466
|
] }),
|
|
463
|
-
|
|
464
|
-
|
|
467
|
+
s.type === "textarea" ? /* @__PURE__ */ e(
|
|
468
|
+
nt,
|
|
465
469
|
{
|
|
466
|
-
...
|
|
467
|
-
placeholder:
|
|
468
|
-
disabled:
|
|
469
|
-
value: String(
|
|
470
|
-
onChange: (c) =>
|
|
470
|
+
...x,
|
|
471
|
+
placeholder: s.placeholder,
|
|
472
|
+
disabled: s.disabled || w,
|
|
473
|
+
value: String(u[s.name] ?? ""),
|
|
474
|
+
onChange: (c) => C(s.name, c.target.value)
|
|
471
475
|
}
|
|
472
|
-
) :
|
|
473
|
-
|
|
476
|
+
) : s.type === "select" ? /* @__PURE__ */ e(
|
|
477
|
+
oe,
|
|
474
478
|
{
|
|
475
|
-
...
|
|
476
|
-
options:
|
|
477
|
-
placeholder:
|
|
478
|
-
disabled:
|
|
479
|
-
value: String(
|
|
480
|
-
onChange: (c) =>
|
|
479
|
+
...x,
|
|
480
|
+
options: vt(s.options),
|
|
481
|
+
placeholder: s.placeholder,
|
|
482
|
+
disabled: s.disabled || w,
|
|
483
|
+
value: String(u[s.name] ?? ""),
|
|
484
|
+
onChange: (c) => C(s.name, c)
|
|
481
485
|
}
|
|
482
|
-
) :
|
|
483
|
-
|
|
486
|
+
) : s.type === "date" ? /* @__PURE__ */ e(
|
|
487
|
+
V,
|
|
484
488
|
{
|
|
485
|
-
...
|
|
489
|
+
...x,
|
|
486
490
|
type: "date",
|
|
487
|
-
placeholder:
|
|
488
|
-
disabled:
|
|
489
|
-
value: String(
|
|
490
|
-
onChange: (c) =>
|
|
491
|
+
placeholder: s.placeholder,
|
|
492
|
+
disabled: s.disabled || w,
|
|
493
|
+
value: String(u[s.name] ?? ""),
|
|
494
|
+
onChange: (c) => C(s.name, c.target.value)
|
|
491
495
|
}
|
|
492
|
-
) :
|
|
493
|
-
|
|
496
|
+
) : s.type === "boolean" ? /* @__PURE__ */ e(
|
|
497
|
+
ue,
|
|
494
498
|
{
|
|
495
|
-
...
|
|
496
|
-
disabled:
|
|
497
|
-
checked: !!
|
|
498
|
-
onChange: (c) =>
|
|
499
|
+
...x,
|
|
500
|
+
disabled: s.disabled || w,
|
|
501
|
+
checked: !!u[s.name],
|
|
502
|
+
onChange: (c) => C(s.name, c)
|
|
499
503
|
}
|
|
500
504
|
) : /* @__PURE__ */ e(
|
|
501
|
-
|
|
505
|
+
V,
|
|
502
506
|
{
|
|
503
|
-
...
|
|
504
|
-
type:
|
|
505
|
-
placeholder:
|
|
506
|
-
disabled:
|
|
507
|
-
value: String(
|
|
508
|
-
onChange: (c) =>
|
|
507
|
+
...x,
|
|
508
|
+
type: s.type ?? "text",
|
|
509
|
+
placeholder: s.placeholder,
|
|
510
|
+
disabled: s.disabled || w,
|
|
511
|
+
value: String(u[s.name] ?? ""),
|
|
512
|
+
onChange: (c) => C(s.name, s.type === "number" ? c.target.value === "" ? "" : Number(c.target.value) : c.target.value)
|
|
509
513
|
}
|
|
510
514
|
),
|
|
511
|
-
g ? /* @__PURE__ */ e("p", { id: `prui-form-${
|
|
512
|
-
] },
|
|
515
|
+
g ? /* @__PURE__ */ e("p", { id: `prui-form-${s.name}-error`, role: "alert", className: "text-xs text-[var(--prui-danger)]", children: g }) : null
|
|
516
|
+
] }, s.name);
|
|
513
517
|
}) }),
|
|
514
|
-
|
|
518
|
+
v ?? O ? /* @__PURE__ */ e("p", { role: "alert", "data-testid": "form-error", className: "rounded-[var(--prui-radius)] border border-[var(--prui-danger)]/40 bg-[var(--prui-danger)]/10 px-3 py-2 text-sm text-[var(--prui-danger)]", children: v ?? O }) : null,
|
|
515
519
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-end gap-2", children: [
|
|
516
|
-
l ? /* @__PURE__ */ e(
|
|
517
|
-
/* @__PURE__ */ e(
|
|
520
|
+
l ? /* @__PURE__ */ e(A, { type: "button", variant: "ghost", onClick: l, disabled: w, children: m }) : null,
|
|
521
|
+
/* @__PURE__ */ e(A, { type: "submit", variant: "primary", loading: w, children: f.submitLabel ?? "Submit" })
|
|
518
522
|
] })
|
|
519
523
|
] });
|
|
520
524
|
}
|
|
521
|
-
const
|
|
525
|
+
const Kt = {
|
|
522
526
|
name: "Form",
|
|
523
527
|
props: [
|
|
524
528
|
{ name: "schema", type: "FormSchema", default: null, control: "object" },
|
|
@@ -529,156 +533,156 @@ const Bt = {
|
|
|
529
533
|
{ name: "error", type: "string | null", default: "null", control: "text" }
|
|
530
534
|
]
|
|
531
535
|
};
|
|
532
|
-
function
|
|
536
|
+
function be(t) {
|
|
533
537
|
if (t)
|
|
534
538
|
return t.map((a) => typeof a == "string" || typeof a == "number" ? { label: String(a), value: String(a) } : a);
|
|
535
539
|
}
|
|
536
|
-
function
|
|
540
|
+
function yt(t, a) {
|
|
537
541
|
return { fields: t.filter((r) => r.formField !== !1 && !r.hidden).filter((r) => r.key !== "id" && r.key !== "actions").map((r) => {
|
|
538
542
|
var l;
|
|
539
543
|
return {
|
|
540
544
|
name: r.key,
|
|
541
545
|
label: typeof r.label == "string" ? r.label : r.key,
|
|
542
|
-
type:
|
|
543
|
-
options: (l =
|
|
546
|
+
type: Nt(r, a),
|
|
547
|
+
options: (l = be(r.filterOptions ?? r.options)) == null ? void 0 : l.map((m) => ({ label: m.label, value: m.value })),
|
|
544
548
|
required: !1
|
|
545
549
|
};
|
|
546
550
|
}), submitLabel: a ? "Save" : "Create" };
|
|
547
551
|
}
|
|
548
|
-
function
|
|
552
|
+
function Nt(t, a) {
|
|
549
553
|
return t.filter === "select" ? "select" : typeof (a == null ? void 0 : a[t.key]) == "number" || t.filter === "number" || t.filter === "numberrange" || t.filter === "price" ? "number" : t.filter === "date" || t.filter === "daterange" ? "date" : "text";
|
|
550
554
|
}
|
|
551
|
-
function
|
|
555
|
+
function Vt({
|
|
552
556
|
name: t,
|
|
553
557
|
columns: a,
|
|
554
558
|
list: n,
|
|
555
559
|
create: r,
|
|
556
560
|
update: l,
|
|
557
|
-
remove:
|
|
558
|
-
delete:
|
|
559
|
-
actions:
|
|
560
|
-
form:
|
|
561
|
-
formSchema:
|
|
562
|
-
rowKey:
|
|
563
|
-
searchPlaceholder:
|
|
561
|
+
remove: m,
|
|
562
|
+
delete: p,
|
|
563
|
+
actions: v,
|
|
564
|
+
form: h,
|
|
565
|
+
formSchema: f,
|
|
566
|
+
rowKey: k,
|
|
567
|
+
searchPlaceholder: u,
|
|
564
568
|
pageSize: b = 20,
|
|
565
569
|
className: M
|
|
566
570
|
}) {
|
|
567
|
-
const
|
|
568
|
-
|
|
571
|
+
const P = m ?? p, O = v ?? ["create", "edit", "delete"], y = (o) => O.includes(o) && (o === "create" ? !!r : o === "edit" ? !!l : !!P), [T, R] = i.useState([]), [C, $] = i.useState(null), [w, s] = i.useState(1), [g, x] = i.useState(b), [c, z] = i.useState([null]), [N, S] = i.useState(""), [j, q] = i.useState({}), [B, ge] = i.useState(null), [ve, U] = i.useState(!0), [J, Y] = i.useState(null), [D, H] = i.useState(null), [xe, L] = i.useState(!1), [ye, W] = i.useState(!1), X = c[w - 1] ?? null, G = JSON.stringify(j), I = i.useCallback(async () => {
|
|
572
|
+
U(!0), Y(null);
|
|
569
573
|
try {
|
|
570
|
-
const
|
|
571
|
-
|
|
572
|
-
} catch (
|
|
573
|
-
|
|
574
|
+
const o = await n({ search: N, cursor: X, pageSize: g, sort: B, filters: j });
|
|
575
|
+
R(o.rows), $(o.nextCursor ?? o.cursor ?? null);
|
|
576
|
+
} catch (o) {
|
|
577
|
+
Y(o instanceof Error ? o.message : String(o)), R([]), $(null);
|
|
574
578
|
} finally {
|
|
575
|
-
|
|
579
|
+
U(!1);
|
|
576
580
|
}
|
|
577
|
-
}, [N,
|
|
578
|
-
|
|
581
|
+
}, [N, X, g, B, G, n]);
|
|
582
|
+
i.useEffect(() => {
|
|
579
583
|
I();
|
|
580
|
-
}, [I]),
|
|
581
|
-
|
|
582
|
-
}, [N, g,
|
|
583
|
-
const Ne = a.filter((
|
|
584
|
-
key:
|
|
585
|
-
label: typeof
|
|
586
|
-
type:
|
|
587
|
-
options:
|
|
588
|
-
})), we = (
|
|
589
|
-
|
|
584
|
+
}, [I]), i.useEffect(() => {
|
|
585
|
+
s(1), z([null]);
|
|
586
|
+
}, [N, g, G]);
|
|
587
|
+
const Ne = a.filter((o) => o.filter).map((o) => ({
|
|
588
|
+
key: o.key,
|
|
589
|
+
label: typeof o.label == "string" ? o.label : o.key,
|
|
590
|
+
type: o.filter === "numberrange" ? "number" : o.filter,
|
|
591
|
+
options: be(o.filterOptions ?? o.options)
|
|
592
|
+
})), we = (o, _) => {
|
|
593
|
+
q((K) => ({ ...K, [o]: _ }));
|
|
590
594
|
}, Se = () => {
|
|
591
|
-
|
|
592
|
-
}, ke = (
|
|
593
|
-
|
|
594
|
-
}, Ce = async (
|
|
595
|
-
if (!(!await
|
|
596
|
-
title: `Delete ${
|
|
595
|
+
H(null), L(!0);
|
|
596
|
+
}, ke = (o) => {
|
|
597
|
+
H(o), L(!0);
|
|
598
|
+
}, Ce = async (o) => {
|
|
599
|
+
if (!(!await et({
|
|
600
|
+
title: `Delete ${F}?`,
|
|
597
601
|
message: "This action cannot be undone.",
|
|
598
602
|
confirmText: "Delete",
|
|
599
603
|
cancelText: "Cancel",
|
|
600
604
|
type: "danger"
|
|
601
|
-
}) || !
|
|
602
|
-
|
|
605
|
+
}) || !P)) {
|
|
606
|
+
W(!0);
|
|
603
607
|
try {
|
|
604
|
-
await
|
|
608
|
+
await P(o), await I();
|
|
605
609
|
} finally {
|
|
606
|
-
|
|
610
|
+
W(!1);
|
|
607
611
|
}
|
|
608
612
|
}
|
|
609
|
-
}, Te = (
|
|
613
|
+
}, Te = (o, _) => {
|
|
610
614
|
if (_ === "next") {
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
const
|
|
614
|
-
return
|
|
615
|
+
const K = C;
|
|
616
|
+
z((Re) => {
|
|
617
|
+
const Z = [...Re];
|
|
618
|
+
return Z[o - 1] = K, Z;
|
|
615
619
|
});
|
|
616
620
|
}
|
|
617
|
-
|
|
621
|
+
s(o);
|
|
618
622
|
}, Pe = [
|
|
619
|
-
...a.filter((
|
|
620
|
-
...
|
|
623
|
+
...a.filter((o) => !o.hidden),
|
|
624
|
+
...y("edit") || y("delete") ? [
|
|
621
625
|
{
|
|
622
626
|
key: "actions",
|
|
623
627
|
label: "",
|
|
624
628
|
align: "right",
|
|
625
|
-
render: (
|
|
626
|
-
|
|
627
|
-
|
|
629
|
+
render: (o) => /* @__PURE__ */ d("div", { className: "flex items-center justify-end gap-1", children: [
|
|
630
|
+
y("edit") ? /* @__PURE__ */ e(A, { variant: "ghost", size: "icon", "aria-label": "Edit", onClick: () => ke(o), "data-testid": "resource-edit", children: /* @__PURE__ */ e(Ve, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) }) : null,
|
|
631
|
+
y("delete") ? /* @__PURE__ */ e(A, { variant: "ghost", size: "icon", "aria-label": "Delete", disabled: ye, onClick: () => void Ce(o), "data-testid": "resource-delete", children: /* @__PURE__ */ e(Ue, { className: "h-3.5 w-3.5 text-[var(--prui-danger)]", "aria-hidden": !0 }) }) : null
|
|
628
632
|
] })
|
|
629
633
|
}
|
|
630
634
|
] : []
|
|
631
|
-
],
|
|
632
|
-
|
|
633
|
-
) : void 0,
|
|
634
|
-
return /* @__PURE__ */ d("div", { className:
|
|
635
|
+
], Q = f ?? yt(a, D), Ee = D ? Object.fromEntries(
|
|
636
|
+
Q.fields.map((o) => [o.name, D[o.name] ?? ""])
|
|
637
|
+
) : void 0, F = t.replace(/s$/, "");
|
|
638
|
+
return /* @__PURE__ */ d("div", { className: E("prui-resource flex flex-col gap-2", M), "data-testid": "resource", children: [
|
|
635
639
|
/* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ e("h1", { className: "text-xl font-semibold capitalize text-[var(--prui-fg)]", children: t }) }),
|
|
636
640
|
/* @__PURE__ */ e(
|
|
637
|
-
|
|
641
|
+
tt,
|
|
638
642
|
{
|
|
639
|
-
searchPlaceholder:
|
|
643
|
+
searchPlaceholder: u ?? `Search ${t}...`,
|
|
640
644
|
searchValue: N,
|
|
641
|
-
onSearchChange:
|
|
645
|
+
onSearchChange: S,
|
|
642
646
|
filters: Ne,
|
|
643
|
-
filterValues:
|
|
647
|
+
filterValues: j,
|
|
644
648
|
onFilterChange: we,
|
|
645
|
-
actions:
|
|
649
|
+
actions: y("create") ? /* @__PURE__ */ d(A, { variant: "primary", size: "sm", onClick: Se, "data-testid": "resource-create", children: [
|
|
646
650
|
/* @__PURE__ */ e(Je, { className: "h-4 w-4", "aria-hidden": !0 }),
|
|
647
651
|
"New ",
|
|
648
|
-
|
|
652
|
+
F
|
|
649
653
|
] }) : void 0
|
|
650
654
|
}
|
|
651
655
|
),
|
|
652
|
-
|
|
653
|
-
/* @__PURE__ */ e(
|
|
656
|
+
J ? /* @__PURE__ */ e("div", { role: "alert", "data-testid": "resource-error", className: "rounded-[var(--prui-radius)] border border-[var(--prui-danger)]/40 bg-[var(--prui-danger)]/10 px-3 py-2 text-sm text-[var(--prui-danger)]", children: J }) : null,
|
|
657
|
+
/* @__PURE__ */ e(rt, { columns: Pe, rows: T, rowKey: k, sort: B, onSortChange: ge, loading: ve }),
|
|
654
658
|
/* @__PURE__ */ e(
|
|
655
|
-
|
|
659
|
+
at,
|
|
656
660
|
{
|
|
657
|
-
page:
|
|
661
|
+
page: w,
|
|
658
662
|
pageSize: g,
|
|
659
|
-
hasNextPage:
|
|
660
|
-
hasPreviousPage:
|
|
663
|
+
hasNextPage: C != null,
|
|
664
|
+
hasPreviousPage: w > 1,
|
|
661
665
|
onPageChange: Te,
|
|
662
|
-
onPageSizeChange: (
|
|
666
|
+
onPageSizeChange: (o) => x(o)
|
|
663
667
|
}
|
|
664
668
|
),
|
|
665
|
-
/* @__PURE__ */ d(
|
|
666
|
-
/* @__PURE__ */ e("div", { className: "px-8 pt-8 pb-2", children: /* @__PURE__ */ e("h2", { className: "text-lg font-semibold", style: { color: "var(--prui-fg)" }, children:
|
|
667
|
-
/* @__PURE__ */ e("div", { className: "px-8 pb-8", children:
|
|
668
|
-
|
|
669
|
+
/* @__PURE__ */ d(ie, { open: xe, onClose: () => L(!1), size: "sm", ariaLabel: D ? `Edit ${F}` : `New ${F}`, noPadding: !0, children: [
|
|
670
|
+
/* @__PURE__ */ e("div", { className: "px-8 pt-8 pb-2", children: /* @__PURE__ */ e("h2", { className: "text-lg font-semibold", style: { color: "var(--prui-fg)" }, children: D ? `Edit ${F}` : `New ${F}` }) }),
|
|
671
|
+
/* @__PURE__ */ e("div", { className: "px-8 pb-8", children: h ?? /* @__PURE__ */ e(
|
|
672
|
+
xt,
|
|
669
673
|
{
|
|
670
|
-
schema:
|
|
674
|
+
schema: Q,
|
|
671
675
|
initialValues: Ee,
|
|
672
676
|
onCancel: () => L(!1),
|
|
673
|
-
onSubmit: async (
|
|
674
|
-
|
|
677
|
+
onSubmit: async (o) => {
|
|
678
|
+
D ? await (l == null ? void 0 : l(D, o)) : await (r == null ? void 0 : r(o)), L(!1), await I();
|
|
675
679
|
}
|
|
676
680
|
}
|
|
677
681
|
) })
|
|
678
682
|
] })
|
|
679
683
|
] });
|
|
680
684
|
}
|
|
681
|
-
const
|
|
685
|
+
const Ut = {
|
|
682
686
|
name: "Resource",
|
|
683
687
|
props: [
|
|
684
688
|
{ name: "name", type: "string", default: null, control: "text" },
|
|
@@ -694,21 +698,21 @@ const Vt = {
|
|
|
694
698
|
{ name: "pageSize", type: "number", default: "20", control: "number" }
|
|
695
699
|
]
|
|
696
700
|
};
|
|
697
|
-
function
|
|
698
|
-
return /* @__PURE__ */ e("div", { className:
|
|
701
|
+
function Jt({ items: t, className: a }) {
|
|
702
|
+
return /* @__PURE__ */ e("div", { className: E("prui-stat-row grid gap-3 sm:grid-cols-2 lg:grid-cols-4", a), children: t.map((n, r) => {
|
|
699
703
|
const l = n.icon;
|
|
700
|
-
return /* @__PURE__ */ d(
|
|
701
|
-
/* @__PURE__ */ d(
|
|
702
|
-
/* @__PURE__ */ d(
|
|
704
|
+
return /* @__PURE__ */ d(ce, { "data-testid": "stat-card", children: [
|
|
705
|
+
/* @__PURE__ */ d(de, { className: "pb-2", children: [
|
|
706
|
+
/* @__PURE__ */ d(me, { className: "flex items-center gap-1.5 text-xs", children: [
|
|
703
707
|
l ? /* @__PURE__ */ e(l, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) : null,
|
|
704
708
|
n.label
|
|
705
709
|
] }),
|
|
706
|
-
/* @__PURE__ */ e(
|
|
710
|
+
/* @__PURE__ */ e(pe, { className: "text-2xl", children: n.value })
|
|
707
711
|
] }),
|
|
708
|
-
n.delta ? /* @__PURE__ */ e(
|
|
712
|
+
n.delta ? /* @__PURE__ */ e(fe, { className: "pb-3", children: /* @__PURE__ */ e(
|
|
709
713
|
"span",
|
|
710
714
|
{
|
|
711
|
-
className:
|
|
715
|
+
className: E(
|
|
712
716
|
"text-xs font-medium",
|
|
713
717
|
n.trend === "up" && "text-[var(--prui-ok)]",
|
|
714
718
|
n.trend === "down" && "text-[var(--prui-danger)]",
|
|
@@ -720,53 +724,53 @@ function Ut({ items: t, className: a }) {
|
|
|
720
724
|
] }, `${n.label}-${r}`);
|
|
721
725
|
}) });
|
|
722
726
|
}
|
|
723
|
-
const
|
|
727
|
+
const Yt = {
|
|
724
728
|
name: "StatRow",
|
|
725
729
|
props: [
|
|
726
730
|
{ name: "items", type: "StatItem[]", default: null, control: "object" },
|
|
727
731
|
{ name: "className", type: "string", default: "undefined", control: "text" }
|
|
728
732
|
]
|
|
729
733
|
};
|
|
730
|
-
function
|
|
734
|
+
function wt(t) {
|
|
731
735
|
if (t)
|
|
732
736
|
return t.map((a) => typeof a == "string" || typeof a == "number" ? { label: String(a), value: String(a) } : a);
|
|
733
737
|
}
|
|
734
|
-
function
|
|
738
|
+
function St({ field: t }) {
|
|
735
739
|
const { name: a, type: n, value: r, onChange: l } = t;
|
|
736
740
|
if (!n || !a) return null;
|
|
737
|
-
const
|
|
738
|
-
return n === "switch" ? /* @__PURE__ */ e("label", { className: "flex items-center gap-2", htmlFor:
|
|
739
|
-
|
|
741
|
+
const m = `prui-settings-${a}`;
|
|
742
|
+
return n === "switch" ? /* @__PURE__ */ e("label", { className: "flex items-center gap-2", htmlFor: m, children: /* @__PURE__ */ e(
|
|
743
|
+
ue,
|
|
740
744
|
{
|
|
741
|
-
id:
|
|
745
|
+
id: m,
|
|
742
746
|
checked: !!r,
|
|
743
|
-
onChange: (
|
|
747
|
+
onChange: (p) => l == null ? void 0 : l(p),
|
|
744
748
|
"aria-label": t.label
|
|
745
749
|
}
|
|
746
750
|
) }) : n === "select" ? /* @__PURE__ */ e(
|
|
747
|
-
|
|
751
|
+
oe,
|
|
748
752
|
{
|
|
749
|
-
id:
|
|
753
|
+
id: m,
|
|
750
754
|
className: "w-56",
|
|
751
|
-
options:
|
|
755
|
+
options: wt(t.options) ?? [],
|
|
752
756
|
value: String(r ?? ""),
|
|
753
|
-
onChange: (
|
|
757
|
+
onChange: (p) => l == null ? void 0 : l(p),
|
|
754
758
|
"aria-label": t.label
|
|
755
759
|
}
|
|
756
760
|
) : /* @__PURE__ */ e(
|
|
757
|
-
|
|
761
|
+
V,
|
|
758
762
|
{
|
|
759
|
-
id:
|
|
763
|
+
id: m,
|
|
760
764
|
type: n === "number" ? "number" : "text",
|
|
761
765
|
className: "h-8 w-56",
|
|
762
766
|
value: String(r ?? ""),
|
|
763
|
-
onChange: (
|
|
767
|
+
onChange: (p) => l == null ? void 0 : l(n === "number" ? p.target.value === "" ? "" : Number(p.target.value) : p.target.value),
|
|
764
768
|
"aria-label": t.label
|
|
765
769
|
}
|
|
766
770
|
);
|
|
767
771
|
}
|
|
768
|
-
function
|
|
769
|
-
return /* @__PURE__ */ d("div", { className:
|
|
772
|
+
function Ht({ title: t = "Settings", sections: a, className: n }) {
|
|
773
|
+
return /* @__PURE__ */ d("div", { className: E("prui-settings mx-auto flex w-full max-w-4xl flex-col gap-6", n), children: [
|
|
770
774
|
/* @__PURE__ */ e("h1", { className: "text-xl font-semibold text-[var(--prui-fg)]", children: t }),
|
|
771
775
|
/* @__PURE__ */ d("div", { className: "flex flex-col gap-6 md:flex-row", children: [
|
|
772
776
|
/* @__PURE__ */ e("nav", { "aria-label": "Settings sections", className: "md:w-56 md:shrink-0", children: /* @__PURE__ */ e("ul", { className: "flex flex-row flex-wrap gap-1 md:flex-col", children: a.map((r) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
@@ -777,85 +781,85 @@ function Yt({ title: t = "Settings", sections: a, className: n }) {
|
|
|
777
781
|
children: r.title ?? r.label ?? r.id
|
|
778
782
|
}
|
|
779
783
|
) }, r.id)) }) }),
|
|
780
|
-
/* @__PURE__ */ e("div", { className: "flex min-w-0 flex-1 flex-col gap-4", children: a.map((r) => /* @__PURE__ */ d(
|
|
781
|
-
/* @__PURE__ */ d(
|
|
782
|
-
/* @__PURE__ */ e(
|
|
783
|
-
r.description ? /* @__PURE__ */ e(
|
|
784
|
+
/* @__PURE__ */ e("div", { className: "flex min-w-0 flex-1 flex-col gap-4", children: a.map((r) => /* @__PURE__ */ d(ce, { id: `settings-${r.id}`, "data-testid": "settings-section", children: [
|
|
785
|
+
/* @__PURE__ */ d(de, { children: [
|
|
786
|
+
/* @__PURE__ */ e(pe, { children: r.title ?? r.label ?? r.id }),
|
|
787
|
+
r.description ? /* @__PURE__ */ e(me, { children: r.description }) : null
|
|
784
788
|
] }),
|
|
785
|
-
/* @__PURE__ */ e(
|
|
789
|
+
/* @__PURE__ */ e(fe, { children: r.content ?? /* @__PURE__ */ e("dl", { className: "flex flex-col divide-y divide-[var(--prui-line)]", children: (r.fields ?? []).map((l, m) => /* @__PURE__ */ d("div", { className: "flex flex-col gap-2 py-3 first:pt-0 last:pb-0 sm:flex-row sm:items-center sm:justify-between", children: [
|
|
786
790
|
/* @__PURE__ */ d("div", { className: "min-w-0", children: [
|
|
787
791
|
/* @__PURE__ */ e("dt", { className: "text-sm font-medium text-[var(--prui-fg)]", children: l.label }),
|
|
788
792
|
l.description ? /* @__PURE__ */ e("dd", { className: "text-xs text-[var(--prui-dim)]", children: l.description }) : null
|
|
789
793
|
] }),
|
|
790
|
-
/* @__PURE__ */ e("div", { className: "shrink-0", children: l.control ?? /* @__PURE__ */ e(
|
|
791
|
-
] }, `${l.label}-${
|
|
794
|
+
/* @__PURE__ */ e("div", { className: "shrink-0", children: l.control ?? /* @__PURE__ */ e(St, { field: l }) })
|
|
795
|
+
] }, `${l.label}-${m}`)) }) })
|
|
792
796
|
] }, r.id)) })
|
|
793
797
|
] })
|
|
794
798
|
] });
|
|
795
799
|
}
|
|
796
|
-
const
|
|
800
|
+
const Wt = {
|
|
797
801
|
name: "Settings",
|
|
798
802
|
props: [
|
|
799
803
|
{ name: "title", type: "string", default: "'Settings'", control: "text" },
|
|
800
804
|
{ name: "sections", type: "SettingsSection[]", default: null, control: "object" }
|
|
801
805
|
]
|
|
802
|
-
},
|
|
803
|
-
function
|
|
806
|
+
}, le = ["mousedown", "keydown", "scroll", "touchstart", "click"];
|
|
807
|
+
function kt({
|
|
804
808
|
timeout: t = 15,
|
|
805
809
|
warningTime: a = 2,
|
|
806
810
|
onTimeout: n,
|
|
807
811
|
onExtend: r,
|
|
808
812
|
title: l = "Session expiring soon",
|
|
809
|
-
message:
|
|
813
|
+
message: m = "Your session is about to expire due to inactivity."
|
|
810
814
|
}) {
|
|
811
|
-
const
|
|
812
|
-
for (const g of [b, M,
|
|
815
|
+
const p = Math.max(0, t) * 6e4, v = Math.min(Math.max(0, a) * 6e4, p), [h, f] = i.useState(!1), [k, u] = i.useState(v), b = i.useRef(null), M = i.useRef(null), P = i.useRef(null), O = i.useRef(!1), y = i.useCallback(() => {
|
|
816
|
+
for (const g of [b, M, P])
|
|
813
817
|
g.current != null && (clearInterval(g.current), clearTimeout(g.current), g.current = null);
|
|
814
|
-
}, []),
|
|
815
|
-
|
|
816
|
-
}, [
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
818
|
+
}, []), T = i.useCallback(() => {
|
|
819
|
+
y(), f(!1), n == null || n();
|
|
820
|
+
}, [y, n]), R = i.useCallback(() => {
|
|
821
|
+
y(), f(!1), O.current = !1, b.current = window.setTimeout(() => {
|
|
822
|
+
O.current = !0, u(v), f(!0), P.current = window.setInterval(() => {
|
|
823
|
+
u((g) => g <= 1e3 ? (T(), 0) : g - 1e3);
|
|
820
824
|
}, 1e3);
|
|
821
|
-
},
|
|
822
|
-
}, [
|
|
823
|
-
|
|
825
|
+
}, p - v), M.current = window.setTimeout(T, p);
|
|
826
|
+
}, [y, T, p, v]);
|
|
827
|
+
i.useEffect(() => {
|
|
824
828
|
const g = () => {
|
|
825
|
-
|
|
829
|
+
O.current || R();
|
|
826
830
|
};
|
|
827
|
-
for (const
|
|
828
|
-
return
|
|
829
|
-
|
|
830
|
-
for (const
|
|
831
|
+
for (const x of le) document.addEventListener(x, g, { passive: !0 });
|
|
832
|
+
return R(), () => {
|
|
833
|
+
y();
|
|
834
|
+
for (const x of le) document.removeEventListener(x, g);
|
|
831
835
|
};
|
|
832
|
-
}, [
|
|
833
|
-
const
|
|
834
|
-
r == null || r(),
|
|
835
|
-
},
|
|
836
|
+
}, [R, y]);
|
|
837
|
+
const C = () => {
|
|
838
|
+
r == null || r(), R();
|
|
839
|
+
}, $ = Math.floor(k / 6e4), w = Math.floor(k % 6e4 / 1e3), s = `${$}:${String(w).padStart(2, "0")}`;
|
|
836
840
|
return /* @__PURE__ */ d(
|
|
837
|
-
|
|
841
|
+
ie,
|
|
838
842
|
{
|
|
839
|
-
open:
|
|
840
|
-
onClose:
|
|
843
|
+
open: h,
|
|
844
|
+
onClose: C,
|
|
841
845
|
size: "sm",
|
|
842
846
|
ariaLabel: l,
|
|
843
847
|
children: [
|
|
844
848
|
/* @__PURE__ */ d("div", { className: "flex flex-col items-center gap-1 px-8 pb-2 pt-8 text-center", children: [
|
|
845
849
|
/* @__PURE__ */ e("div", { className: "mb-2 flex h-12 w-12 items-center justify-center rounded-full bg-[var(--prui-warn)]/15", children: /* @__PURE__ */ e(Ye, { className: "h-6 w-6 text-[var(--prui-warn)]", "aria-hidden": !0 }) }),
|
|
846
850
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: l }),
|
|
847
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-[var(--prui-dim)]", children:
|
|
848
|
-
/* @__PURE__ */ e("div", { className: "py-4 font-mono text-4xl font-bold text-[var(--prui-fg)]", "data-testid": "session-countdown", children:
|
|
851
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-[var(--prui-dim)]", children: m }),
|
|
852
|
+
/* @__PURE__ */ e("div", { className: "py-4 font-mono text-4xl font-bold text-[var(--prui-fg)]", "data-testid": "session-countdown", children: s })
|
|
849
853
|
] }),
|
|
850
854
|
/* @__PURE__ */ d("div", { className: "flex flex-col gap-2 px-8 pb-8 sm:flex-row", children: [
|
|
851
|
-
/* @__PURE__ */ e(
|
|
852
|
-
/* @__PURE__ */ e(
|
|
855
|
+
/* @__PURE__ */ e(A, { variant: "default", className: "flex-1", onClick: T, "data-testid": "session-logout", children: "Log out now" }),
|
|
856
|
+
/* @__PURE__ */ e(A, { variant: "primary", className: "flex-1", onClick: C, "data-testid": "session-extend", children: "Continue session" })
|
|
853
857
|
] })
|
|
854
858
|
]
|
|
855
859
|
}
|
|
856
860
|
);
|
|
857
861
|
}
|
|
858
|
-
const
|
|
862
|
+
const Ct = {
|
|
859
863
|
name: "SessionTimeout",
|
|
860
864
|
props: [
|
|
861
865
|
{ name: "timeout", type: "number", default: "15", control: "number" },
|
|
@@ -863,13 +867,13 @@ const kt = {
|
|
|
863
867
|
{ name: "onTimeout", type: "() => void", default: null, control: "none" },
|
|
864
868
|
{ name: "onExtend", type: "() => void", default: null, control: "none" }
|
|
865
869
|
]
|
|
866
|
-
},
|
|
870
|
+
}, Tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
867
871
|
__proto__: null,
|
|
868
|
-
SessionTimeout:
|
|
869
|
-
sessionTimeoutPropsMeta:
|
|
872
|
+
SessionTimeout: kt,
|
|
873
|
+
sessionTimeoutPropsMeta: Ct
|
|
870
874
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
871
|
-
function
|
|
872
|
-
return /* @__PURE__ */ e("div", { className:
|
|
875
|
+
function Xt({ title: t, description: a, brand: n, width: r = "max-w-sm", footer: l, children: m, className: p }) {
|
|
876
|
+
return /* @__PURE__ */ e("div", { className: E("prui-auth-shell flex min-h-[100dvh] items-center justify-center bg-[var(--prui-background)] p-4", p), "data-testid": "auth-shell", children: /* @__PURE__ */ d("div", { className: E("w-full", r), children: [
|
|
873
877
|
n ? /* @__PURE__ */ d("div", { className: "mb-6 flex items-center justify-center gap-2", "data-testid": "auth-shell-brand", children: [
|
|
874
878
|
n.mark ? /* @__PURE__ */ e("img", { src: n.mark, alt: "", className: "h-8 w-8 rounded-[var(--prui-radius-1)] object-cover" }) : null,
|
|
875
879
|
/* @__PURE__ */ e("span", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: n.name })
|
|
@@ -879,12 +883,12 @@ function Wt({ title: t, description: a, brand: n, width: r = "max-w-sm", footer:
|
|
|
879
883
|
/* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: t }),
|
|
880
884
|
a ? /* @__PURE__ */ e("p", { className: "text-sm text-[var(--prui-dim)]", children: a }) : null
|
|
881
885
|
] }),
|
|
882
|
-
|
|
886
|
+
m,
|
|
883
887
|
l ? /* @__PURE__ */ e("div", { className: "mt-4 text-center text-sm text-[var(--prui-dim)]", children: l }) : null
|
|
884
888
|
] })
|
|
885
889
|
] }) });
|
|
886
890
|
}
|
|
887
|
-
const
|
|
891
|
+
const Gt = {
|
|
888
892
|
name: "AuthShell",
|
|
889
893
|
props: [
|
|
890
894
|
{ name: "title", type: "string", default: null, control: "text" },
|
|
@@ -896,23 +900,23 @@ const Xt = {
|
|
|
896
900
|
]
|
|
897
901
|
};
|
|
898
902
|
export {
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
903
|
+
qt as A,
|
|
904
|
+
ht as C,
|
|
905
|
+
xt as F,
|
|
906
|
+
Vt as R,
|
|
907
|
+
kt as S,
|
|
908
|
+
bt as a,
|
|
909
|
+
Xt as b,
|
|
910
|
+
ot as c,
|
|
911
|
+
Ht as d,
|
|
912
|
+
ae as e,
|
|
913
|
+
Jt as f,
|
|
914
|
+
Bt as g,
|
|
915
|
+
Gt as h,
|
|
916
|
+
Kt as i,
|
|
917
|
+
Wt as j,
|
|
918
|
+
Yt as k,
|
|
919
|
+
Ut as r,
|
|
920
|
+
Ct as s,
|
|
921
|
+
ct as u
|
|
918
922
|
};
|