@skiddph/prui 0.9.0 → 0.10.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/dist/app.js +1 -1
- package/dist/chunks/{auth-shell-DQJ4UmUv.js → auth-shell-a-3J0_PB.js} +131 -131
- package/dist/core/input.d.ts +4 -0
- package/dist/core/input.js +40 -27
- package/dist/core/modal.js +133 -126
- package/dist/core/select.d.ts +25 -9
- package/dist/core/select.js +236 -153
- package/dist/core/toast.js +73 -64
- package/dist/index.js +1 -1
- package/dist/prui-utilities.css +1 -1
- package/dist/prui.css +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as e, jsxs as f, Fragment as Oe } from "react/jsx-runtime";
|
|
2
2
|
import * as l from "react";
|
|
3
3
|
import { createPortal as ut } from "react-dom";
|
|
4
|
-
import { Routes as dt, Route as ke, Navigate as mt, MemoryRouter as pt, BrowserRouter as ft, useLocation as De, useNavigate as
|
|
4
|
+
import { Routes as dt, Route as ke, Navigate as mt, MemoryRouter as pt, BrowserRouter as ft, useLocation as De, useNavigate as Ae, Outlet as ht, Link as bt, NavLink as vt } from "react-router-dom";
|
|
5
5
|
import { ChevronsRight as Se, ChevronsLeft as Te, X as gt, Menu as xt, Search as yt, Palette as wt, ChevronDown as Nt, Pencil as kt, Trash2 as St, Plus as Tt, Clock as Ct } from "lucide-react";
|
|
6
6
|
import { cn as C } from "../core/cn.js";
|
|
7
7
|
import { Dropdown as Rt } from "../core/dropdown.js";
|
|
8
8
|
import { Button as K } from "../core/button.js";
|
|
9
|
-
import { useOverlay as
|
|
10
|
-
import { endIndex as
|
|
11
|
-
import { resolveThemeName as Ot, themeMode as Dt, readPersistedTheme as
|
|
9
|
+
import { useOverlay as ze, Portal as $e, useOverlayStack as Et, useEscapeKey as jt } from "../core/overlay.js";
|
|
10
|
+
import { endIndex as Mt, homeIndex as Pt, moveIndex as Ce } from "../core/list-nav.js";
|
|
11
|
+
import { resolveThemeName as Ot, themeMode as Dt, readPersistedTheme as At, applyTheme as Re, listThemes as zt, clearAppliedTokens as $t } from "../theme.js";
|
|
12
12
|
import { usePruiI18n as J } from "../i18n.js";
|
|
13
13
|
import { Modal as Fe, confirmModal as Ft } from "../core/modal.js";
|
|
14
14
|
import { b as It, D as Lt, a as Kt } from "./data-table-toolbar-B-5J2Ozl.js";
|
|
@@ -32,10 +32,10 @@ const Vt = [
|
|
|
32
32
|
{ path: "/admin-setup", name: "adminSetup" }
|
|
33
33
|
];
|
|
34
34
|
function qt({ mode: t, config: a, children: n }) {
|
|
35
|
-
const r = t === "auth" || t === "auth+utility", o = t === "utility" || t === "auth+utility",
|
|
35
|
+
const r = t === "auth" || t === "auth+utility", o = t === "utility" || t === "auth+utility", m = [
|
|
36
36
|
...r ? Vt : [],
|
|
37
37
|
...o ? _t : []
|
|
38
|
-
], [
|
|
38
|
+
], [d, T] = l.useState(null);
|
|
39
39
|
return l.useEffect(() => {
|
|
40
40
|
let k = !1;
|
|
41
41
|
return import("../pages.js").then((x) => {
|
|
@@ -43,9 +43,9 @@ function qt({ mode: t, config: a, children: n }) {
|
|
|
43
43
|
}), () => {
|
|
44
44
|
k = !0;
|
|
45
45
|
};
|
|
46
|
-
}, []),
|
|
47
|
-
|
|
48
|
-
const y =
|
|
46
|
+
}, []), d ? /* @__PURE__ */ f(dt, { children: [
|
|
47
|
+
m.map(({ path: k, name: x }) => {
|
|
48
|
+
const y = d[x];
|
|
49
49
|
return y ? /* @__PURE__ */ e(ke, { path: k, element: /* @__PURE__ */ e(y, { ...(a == null ? void 0 : a[x]) ?? {} }) }, k) : null;
|
|
50
50
|
}),
|
|
51
51
|
n,
|
|
@@ -56,15 +56,15 @@ const Ht = l.lazy(
|
|
|
56
56
|
() => Promise.resolve().then(() => or).then((t) => ({ default: t.SessionTimeout }))
|
|
57
57
|
);
|
|
58
58
|
function Jt(t) {
|
|
59
|
-
const a = t !== !1, n = typeof t == "object" ? t : {}, r = n.persist !== !1, o = Ot(n.default ?? "control"),
|
|
59
|
+
const a = t !== !1, n = typeof t == "object" ? t : {}, r = n.persist !== !1, o = Ot(n.default ?? "control"), m = Dt(o), [d, T] = l.useState(() => (r ? At() : null) ?? { theme: o, mode: m }), k = l.useCallback(
|
|
60
60
|
(x) => {
|
|
61
61
|
T(x), Re({ theme: x.theme, mode: x.mode, storageKey: r ? "prui:theme" : null });
|
|
62
62
|
},
|
|
63
63
|
[r]
|
|
64
64
|
);
|
|
65
65
|
return l.useEffect(() => {
|
|
66
|
-
Re({ theme:
|
|
67
|
-
}, [
|
|
66
|
+
Re({ theme: d.theme, mode: d.mode, storageKey: r ? "prui:theme" : null });
|
|
67
|
+
}, [d, r]), { enabled: a, state: d, setTheme: k };
|
|
68
68
|
}
|
|
69
69
|
function Yt({ config: t }) {
|
|
70
70
|
const { enabled: a, state: n, setTheme: r } = Jt(t), { t: o } = J();
|
|
@@ -83,10 +83,10 @@ function Yt({ config: t }) {
|
|
|
83
83
|
children: /* @__PURE__ */ e(wt, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
84
84
|
}
|
|
85
85
|
),
|
|
86
|
-
items:
|
|
87
|
-
label: `${
|
|
86
|
+
items: zt().map((m) => ({
|
|
87
|
+
label: `${m}${m === n.theme ? " (active)" : ""}`,
|
|
88
88
|
onSelect: () => {
|
|
89
|
-
$t(), r({ theme:
|
|
89
|
+
$t(), r({ theme: m, mode: m === "daylight" ? "light" : "dark" });
|
|
90
90
|
}
|
|
91
91
|
}))
|
|
92
92
|
}
|
|
@@ -97,19 +97,19 @@ function se(t, a) {
|
|
|
97
97
|
}
|
|
98
98
|
function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
|
|
99
99
|
var O;
|
|
100
|
-
const { pathname: o } = De(),
|
|
100
|
+
const { pathname: o } = De(), m = Ae(), d = (t.items ?? []).some(
|
|
101
101
|
(v) => v.href ? se(o, v.href) : (v.items ?? []).some((i) => i.href && se(o, i.href))
|
|
102
|
-
), [T, k] = l.useState(
|
|
102
|
+
), [T, k] = l.useState(d || n !== void 0 && o === n);
|
|
103
103
|
l.useEffect(() => {
|
|
104
|
-
|
|
105
|
-
}, [
|
|
106
|
-
const x = t.icon, [y, R] = l.useState(!1), [w, P] = l.useState(null), g = l.useRef(null), u = l.useRef(null), [b, E] = l.useState(-1),
|
|
104
|
+
d && k(!0);
|
|
105
|
+
}, [d]);
|
|
106
|
+
const x = t.icon, [y, R] = l.useState(!1), [w, P] = l.useState(null), g = l.useRef(null), u = l.useRef(null), [b, E] = l.useState(-1), j = l.useCallback(() => {
|
|
107
107
|
var i, S;
|
|
108
108
|
R(!1), E(-1);
|
|
109
109
|
const v = document.activeElement;
|
|
110
110
|
v && ((i = u.current) != null && i.contains(v)) && ((S = g.current) == null || S.focus());
|
|
111
|
-
}, []), { setElement: $, isTop:
|
|
112
|
-
if (
|
|
111
|
+
}, []), { setElement: $, isTop: z } = Et(y);
|
|
112
|
+
if (jt(y, z, () => j()), l.useEffect(() => {
|
|
113
113
|
var v;
|
|
114
114
|
y && ((v = u.current) == null || v.focus());
|
|
115
115
|
}, [y]), r) {
|
|
@@ -149,10 +149,10 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
|
|
|
149
149
|
c.preventDefault(), N(Pt(h));
|
|
150
150
|
break;
|
|
151
151
|
case "End":
|
|
152
|
-
c.preventDefault(), N(
|
|
152
|
+
c.preventDefault(), N(Mt(h));
|
|
153
153
|
break;
|
|
154
154
|
case "Tab":
|
|
155
|
-
|
|
155
|
+
j();
|
|
156
156
|
break;
|
|
157
157
|
}
|
|
158
158
|
};
|
|
@@ -172,14 +172,14 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
|
|
|
172
172
|
"data-testid": "rail-group-trigger",
|
|
173
173
|
className: C(
|
|
174
174
|
"flex w-full items-center justify-center rounded-[var(--prui-radius)] px-2.5 py-1.5 text-sm cursor-pointer",
|
|
175
|
-
|
|
175
|
+
d || y ? "text-[var(--prui-brand)]" : "text-[var(--prui-dim)] hover:text-[var(--prui-fg)]"
|
|
176
176
|
),
|
|
177
177
|
children: x ? /* @__PURE__ */ e(x, { className: "h-4 w-4 shrink-0", "aria-hidden": !0 }) : /* @__PURE__ */ e("span", { className: "prui-nav-mono text-[10px] font-semibold", children: t.label.slice(0, 2).toUpperCase() })
|
|
178
178
|
}
|
|
179
179
|
),
|
|
180
180
|
y && w ? ut(
|
|
181
181
|
/* @__PURE__ */ f(Oe, { children: [
|
|
182
|
-
/* @__PURE__ */ e("div", { className: "fixed inset-0 z-[var(--prui-z-flyout)]", onClick: () =>
|
|
182
|
+
/* @__PURE__ */ e("div", { className: "fixed inset-0 z-[var(--prui-z-flyout)]", onClick: () => j(), "data-testid": "rail-flyout-backdrop" }),
|
|
183
183
|
/* @__PURE__ */ f(
|
|
184
184
|
"div",
|
|
185
185
|
{
|
|
@@ -208,7 +208,7 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
|
|
|
208
208
|
c.href && se(o, c.href) ? "bg-[var(--prui-brand)]/15 text-[var(--prui-brand)]" : "text-[var(--prui-fg)] hover:bg-[var(--prui-raise)] focus-visible:bg-[var(--prui-raise)] outline-none"
|
|
209
209
|
),
|
|
210
210
|
onClick: () => {
|
|
211
|
-
|
|
211
|
+
j(), a == null || a(), c.href && m(c.href);
|
|
212
212
|
},
|
|
213
213
|
children: c.label
|
|
214
214
|
},
|
|
@@ -232,7 +232,7 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
|
|
|
232
232
|
onClick: () => k((v) => !v),
|
|
233
233
|
className: C(
|
|
234
234
|
"flex w-full items-center gap-2 rounded-[var(--prui-radius)] px-2.5 py-1.5 text-sm cursor-pointer",
|
|
235
|
-
|
|
235
|
+
d ? "text-[var(--prui-fg)]" : "text-[var(--prui-dim)] hover:text-[var(--prui-fg)]"
|
|
236
236
|
),
|
|
237
237
|
children: [
|
|
238
238
|
x ? /* @__PURE__ */ e(x, { className: "h-4 w-4 shrink-0", "aria-hidden": !0 }) : /* @__PURE__ */ e("span", { className: C("prui-nav-mono text-[10px] font-semibold"), children: t.label.slice(0, 2).toUpperCase() }),
|
|
@@ -253,10 +253,10 @@ function qe({ item: t, onNavigate: a, nested: n, expandAllOn: r, collapsed: o })
|
|
|
253
253
|
{
|
|
254
254
|
to: t.href,
|
|
255
255
|
onClick: a,
|
|
256
|
-
className: ({ isActive:
|
|
256
|
+
className: ({ isActive: m }) => C(
|
|
257
257
|
"flex items-center gap-2 rounded-[var(--prui-radius)] px-2.5 py-1.5 text-sm",
|
|
258
258
|
n && "pl-2.5",
|
|
259
|
-
|
|
259
|
+
m ? "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)]"
|
|
260
260
|
),
|
|
261
261
|
children: [
|
|
262
262
|
t.icon && !n ? /* @__PURE__ */ e(t.icon, { className: "h-4 w-4 shrink-0", "aria-hidden": !0 }) : o ? /* @__PURE__ */ e("span", { className: C("prui-nav-mono text-[10px] font-semibold"), children: t.label.slice(0, 2).toUpperCase() }) : null,
|
|
@@ -267,9 +267,9 @@ function qe({ item: t, onNavigate: a, nested: n, expandAllOn: r, collapsed: o })
|
|
|
267
267
|
}
|
|
268
268
|
function Ee({ nav: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
|
|
269
269
|
const { t: o } = J();
|
|
270
|
-
return /* @__PURE__ */ e("nav", { "aria-label": o.mainNavigation, className: "prui-app-nav", children: /* @__PURE__ */ e("ul", { className: "flex flex-col gap-0.5", children: t.map((
|
|
270
|
+
return /* @__PURE__ */ e("nav", { "aria-label": o.mainNavigation, className: "prui-app-nav", children: /* @__PURE__ */ e("ul", { className: "flex flex-col gap-0.5", children: t.map((m) => /* @__PURE__ */ e(qe, { item: m, onNavigate: a, expandAllOn: n, collapsed: r }, m.href ?? m.label)) }) });
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function je({ brand: t }) {
|
|
273
273
|
if (!t) return null;
|
|
274
274
|
const a = /* @__PURE__ */ f(Oe, { children: [
|
|
275
275
|
t.mark ? /* @__PURE__ */ e("img", { src: t.mark, alt: "", className: "h-6 w-6 rounded-[var(--prui-radius-1)] object-cover" }) : null,
|
|
@@ -284,12 +284,12 @@ function Gt({
|
|
|
284
284
|
placeholder: r,
|
|
285
285
|
onNavigate: o
|
|
286
286
|
}) {
|
|
287
|
-
const { t:
|
|
288
|
-
const u =
|
|
287
|
+
const { t: m } = J(), [d, T] = l.useState(""), [k, x] = l.useState(0), y = l.useRef(null), R = r ?? m.commandPlaceholder, w = l.useMemo(() => {
|
|
288
|
+
const u = d.trim().toLowerCase();
|
|
289
289
|
return u ? n.filter((b) => b.label.toLowerCase().includes(u)) : n;
|
|
290
|
-
}, [n,
|
|
291
|
-
l.useEffect(() => x(0), [
|
|
292
|
-
const { ref: P } =
|
|
290
|
+
}, [n, d]);
|
|
291
|
+
l.useEffect(() => x(0), [d]);
|
|
292
|
+
const { ref: P } = ze({
|
|
293
293
|
open: t,
|
|
294
294
|
onEscape: () => a(!1),
|
|
295
295
|
initialFocus: y
|
|
@@ -324,7 +324,7 @@ function Gt({
|
|
|
324
324
|
"aria-label": "Command palette search",
|
|
325
325
|
"aria-activedescendant": w[k] ? `palette-option-${k}` : void 0,
|
|
326
326
|
placeholder: R,
|
|
327
|
-
value:
|
|
327
|
+
value: d,
|
|
328
328
|
onChange: (u) => T(u.target.value),
|
|
329
329
|
onKeyDown: (u) => {
|
|
330
330
|
if (u.key === "ArrowDown" && (u.preventDefault(), x((b) => Math.min(b + 1, w.length - 1))), u.key === "ArrowUp" && (u.preventDefault(), x((b) => Math.max(b - 1, 0))), u.key === "Home" && w.length > 0 && (u.preventDefault(), x(0)), u.key === "End" && w.length > 0 && (u.preventDefault(), x(w.length - 1)), u.key === "Enter") {
|
|
@@ -335,7 +335,7 @@ function Gt({
|
|
|
335
335
|
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)]"
|
|
336
336
|
}
|
|
337
337
|
),
|
|
338
|
-
/* @__PURE__ */ e("ul", { id: "prui-palette-listbox", role: "listbox", "aria-label": "Commands", className: "max-h-64 overflow-auto p-1", children: w.length === 0 ? /* @__PURE__ */ e("li", { className: "px-3 py-2 text-sm text-[var(--prui-dim)]", role: "option", "aria-selected": "false", "aria-disabled": "true", children:
|
|
338
|
+
/* @__PURE__ */ e("ul", { id: "prui-palette-listbox", role: "listbox", "aria-label": "Commands", className: "max-h-64 overflow-auto p-1", children: w.length === 0 ? /* @__PURE__ */ e("li", { className: "px-3 py-2 text-sm text-[var(--prui-dim)]", role: "option", "aria-selected": "false", "aria-disabled": "true", children: m.commandNoMatches }) : w.map((u, b) => /* @__PURE__ */ f(
|
|
339
339
|
"li",
|
|
340
340
|
{
|
|
341
341
|
id: `palette-option-${b}`,
|
|
@@ -366,8 +366,8 @@ function Qt(t) {
|
|
|
366
366
|
nav: n = [],
|
|
367
367
|
search: r = !0,
|
|
368
368
|
theme: o = !0,
|
|
369
|
-
auth:
|
|
370
|
-
sidebar:
|
|
369
|
+
auth: m = !1,
|
|
370
|
+
sidebar: d = {},
|
|
371
371
|
header: T,
|
|
372
372
|
pages: k,
|
|
373
373
|
pagesConfig: x,
|
|
@@ -376,37 +376,37 @@ function Qt(t) {
|
|
|
376
376
|
sidebarHeader: w,
|
|
377
377
|
sidebarFooter: P,
|
|
378
378
|
children: g
|
|
379
|
-
} = t, { t: u } = J(), b = typeof r == "object" ? r : { enabled: r !== !1 }, E = b.enabled !== !1,
|
|
380
|
-
() =>
|
|
381
|
-
[
|
|
379
|
+
} = t, { t: u } = J(), b = typeof r == "object" ? r : { enabled: r !== !1 }, E = b.enabled !== !1, j = b.hotkey ?? "/", $ = d.collapsible !== !1, [z, O] = l.useState(d.defaultOpen === !0), [v, i] = l.useState(!0), [S, N] = l.useState(!1), p = De(), c = Ae(), h = l.useMemo(
|
|
380
|
+
() => m === !1 ? null : m === !0 ? {} : m,
|
|
381
|
+
[m]
|
|
382
382
|
), B = l.useCallback(() => {
|
|
383
383
|
h != null && h.onTimeout ? h.onTimeout() : c((h == null ? void 0 : h.loginPath) ?? "/login");
|
|
384
384
|
}, [h, c]), L = l.useMemo(() => {
|
|
385
385
|
const F = [];
|
|
386
|
-
for (const
|
|
387
|
-
if (
|
|
388
|
-
for (const I of
|
|
389
|
-
I.href && F.push({ label: `${
|
|
390
|
-
else
|
|
386
|
+
for (const M of n)
|
|
387
|
+
if (M.items)
|
|
388
|
+
for (const I of M.items)
|
|
389
|
+
I.href && F.push({ label: `${M.label} / ${I.label}`, href: I.href, group: M.label });
|
|
390
|
+
else M.href && F.push({ label: M.label, href: M.href });
|
|
391
391
|
return F;
|
|
392
392
|
}, [n]);
|
|
393
393
|
l.useEffect(() => {
|
|
394
394
|
if (!E) return;
|
|
395
|
-
const F = (
|
|
396
|
-
const I =
|
|
397
|
-
|
|
395
|
+
const F = (M) => {
|
|
396
|
+
const I = M.target, q = I && (I.tagName === "INPUT" || I.tagName === "TEXTAREA" || I.isContentEditable);
|
|
397
|
+
M.key === j && !q && !M.metaKey && !M.ctrlKey && !M.altKey && (M.preventDefault(), N(!0));
|
|
398
398
|
};
|
|
399
399
|
return document.addEventListener("keydown", F), () => document.removeEventListener("keydown", F);
|
|
400
|
-
}, [
|
|
400
|
+
}, [j, E]);
|
|
401
401
|
const V = l.useRef(p.pathname);
|
|
402
402
|
l.useEffect(() => {
|
|
403
403
|
V.current !== p.pathname && (V.current = p.pathname, O(!1));
|
|
404
404
|
}, [p.pathname]);
|
|
405
|
-
const Y = l.useRef(null), { ref: re } =
|
|
406
|
-
open:
|
|
405
|
+
const Y = l.useRef(null), { ref: re } = ze({
|
|
406
|
+
open: z,
|
|
407
407
|
onEscape: () => O(!1),
|
|
408
408
|
initialFocus: Y
|
|
409
|
-
}), ae =
|
|
409
|
+
}), ae = d.width ?? 240, D = !v && R !== "D";
|
|
410
410
|
return /* @__PURE__ */ f(
|
|
411
411
|
"div",
|
|
412
412
|
{
|
|
@@ -438,7 +438,7 @@ function Qt(t) {
|
|
|
438
438
|
}
|
|
439
439
|
) }) : null
|
|
440
440
|
] }),
|
|
441
|
-
|
|
441
|
+
z ? /* @__PURE__ */ e($e, { children: /* @__PURE__ */ f("div", { ref: re, className: "md:hidden fixed inset-0 z-[var(--prui-z-drawer)]", "data-testid": "mobile-drawer", children: [
|
|
442
442
|
/* @__PURE__ */ e(
|
|
443
443
|
"div",
|
|
444
444
|
{
|
|
@@ -477,7 +477,7 @@ function Qt(t) {
|
|
|
477
477
|
{
|
|
478
478
|
"data-testid": "sidebar-header",
|
|
479
479
|
className: "prui-shell-sidehead hidden h-14 items-center gap-2 border-b border-[var(--prui-line)] bg-[var(--prui-surface)] px-4 md:flex",
|
|
480
|
-
children: w ?? /* @__PURE__ */ e(
|
|
480
|
+
children: w ?? /* @__PURE__ */ e(je, { brand: a })
|
|
481
481
|
}
|
|
482
482
|
) : null,
|
|
483
483
|
/* @__PURE__ */ f(
|
|
@@ -510,7 +510,7 @@ function Qt(t) {
|
|
|
510
510
|
children: D ? /* @__PURE__ */ e(Se, { className: "h-4 w-4", "aria-hidden": !0 }) : /* @__PURE__ */ e(Te, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
511
511
|
}
|
|
512
512
|
) : null,
|
|
513
|
-
/* @__PURE__ */ e("div", { className: "min-w-0 justify-self-start", children: /* @__PURE__ */ e(
|
|
513
|
+
/* @__PURE__ */ e("div", { className: "min-w-0 justify-self-start", children: /* @__PURE__ */ e(je, { brand: a }) }),
|
|
514
514
|
E ? /* @__PURE__ */ f(
|
|
515
515
|
"button",
|
|
516
516
|
{
|
|
@@ -521,7 +521,7 @@ function Qt(t) {
|
|
|
521
521
|
children: [
|
|
522
522
|
/* @__PURE__ */ e(yt, { className: "h-4 w-4", "aria-hidden": !0 }),
|
|
523
523
|
/* @__PURE__ */ e("span", { className: "flex-1 text-left", children: b.placeholder ?? `${u.search}...` }),
|
|
524
|
-
/* @__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:
|
|
524
|
+
/* @__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: j })
|
|
525
525
|
]
|
|
526
526
|
}
|
|
527
527
|
) : null,
|
|
@@ -585,7 +585,7 @@ function er(t) {
|
|
|
585
585
|
if (t)
|
|
586
586
|
return t.map((a) => typeof a == "string" || typeof a == "number" ? { label: String(a), value: String(a) } : a);
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function Me(t, a) {
|
|
589
589
|
const n = {};
|
|
590
590
|
for (const r of t.fields)
|
|
591
591
|
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] = "";
|
|
@@ -597,16 +597,16 @@ function tr({
|
|
|
597
597
|
defaultValues: n,
|
|
598
598
|
onSubmit: r,
|
|
599
599
|
onCancel: o,
|
|
600
|
-
cancelLabel:
|
|
601
|
-
submitting:
|
|
600
|
+
cancelLabel: m,
|
|
601
|
+
submitting: d = !1,
|
|
602
602
|
error: T,
|
|
603
603
|
className: k
|
|
604
604
|
}) {
|
|
605
|
-
const { t: x } = J(), y = l.useMemo(() => Zt(t), [t]), R = a ?? n, [w, P] = l.useState(() =>
|
|
605
|
+
const { t: x } = J(), y = l.useMemo(() => Zt(t), [t]), R = a ?? n, [w, P] = l.useState(() => Me(y, R)), [g, u] = l.useState({}), [b, E] = l.useState(null), [j, $] = l.useState(!1);
|
|
606
606
|
l.useEffect(() => {
|
|
607
|
-
P(
|
|
607
|
+
P(Me(y, R));
|
|
608
608
|
}, [JSON.stringify(y), JSON.stringify(R ?? {})]);
|
|
609
|
-
const
|
|
609
|
+
const z = (i, S) => {
|
|
610
610
|
P((N) => ({ ...N, [i]: S })), u((N) => {
|
|
611
611
|
if (!N[i]) return N;
|
|
612
612
|
const p = { ...N };
|
|
@@ -635,7 +635,7 @@ function tr({
|
|
|
635
635
|
$(!1);
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
|
-
}, v =
|
|
638
|
+
}, v = d || j;
|
|
639
639
|
return /* @__PURE__ */ f("form", { onSubmit: O, className: C("prui-form flex flex-col gap-4", k), noValidate: !0, children: [
|
|
640
640
|
/* @__PURE__ */ e("div", { className: C("grid gap-4", y.columns === 2 && "md:grid-cols-2"), children: y.fields.map((i) => {
|
|
641
641
|
const S = g[i.name], N = {
|
|
@@ -655,7 +655,7 @@ function tr({
|
|
|
655
655
|
placeholder: i.placeholder,
|
|
656
656
|
disabled: i.disabled || v,
|
|
657
657
|
value: String(w[i.name] ?? ""),
|
|
658
|
-
onChange: (p) =>
|
|
658
|
+
onChange: (p) => z(i.name, p.target.value)
|
|
659
659
|
}
|
|
660
660
|
) : i.type === "select" ? /* @__PURE__ */ e(
|
|
661
661
|
Ie,
|
|
@@ -665,7 +665,7 @@ function tr({
|
|
|
665
665
|
placeholder: i.placeholder,
|
|
666
666
|
disabled: i.disabled || v,
|
|
667
667
|
value: String(w[i.name] ?? ""),
|
|
668
|
-
onChange: (p) =>
|
|
668
|
+
onChange: (p) => z(i.name, p)
|
|
669
669
|
}
|
|
670
670
|
) : i.type === "date" ? /* @__PURE__ */ e(
|
|
671
671
|
ie,
|
|
@@ -675,7 +675,7 @@ function tr({
|
|
|
675
675
|
placeholder: i.placeholder,
|
|
676
676
|
disabled: i.disabled || v,
|
|
677
677
|
value: String(w[i.name] ?? ""),
|
|
678
|
-
onChange: (p) =>
|
|
678
|
+
onChange: (p) => z(i.name, p.target.value)
|
|
679
679
|
}
|
|
680
680
|
) : i.type === "boolean" ? /* @__PURE__ */ e(
|
|
681
681
|
Le,
|
|
@@ -683,7 +683,7 @@ function tr({
|
|
|
683
683
|
...N,
|
|
684
684
|
disabled: i.disabled || v,
|
|
685
685
|
checked: !!w[i.name],
|
|
686
|
-
onChange: (p) =>
|
|
686
|
+
onChange: (p) => z(i.name, p)
|
|
687
687
|
}
|
|
688
688
|
) : /* @__PURE__ */ e(
|
|
689
689
|
ie,
|
|
@@ -693,7 +693,7 @@ function tr({
|
|
|
693
693
|
placeholder: i.placeholder,
|
|
694
694
|
disabled: i.disabled || v,
|
|
695
695
|
value: String(w[i.name] ?? ""),
|
|
696
|
-
onChange: (p) =>
|
|
696
|
+
onChange: (p) => z(i.name, i.type === "number" ? p.target.value === "" ? "" : Number(p.target.value) : p.target.value)
|
|
697
697
|
}
|
|
698
698
|
),
|
|
699
699
|
S ? /* @__PURE__ */ e("p", { id: `prui-form-${i.name}-error`, role: "alert", className: "text-xs text-[var(--prui-danger)]", children: S }) : null
|
|
@@ -701,12 +701,12 @@ function tr({
|
|
|
701
701
|
}) }),
|
|
702
702
|
T ?? b ? /* @__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: T ?? b }) : null,
|
|
703
703
|
/* @__PURE__ */ f("div", { className: "flex items-center justify-end gap-2", children: [
|
|
704
|
-
o ? /* @__PURE__ */ e(K, { type: "button", variant: "ghost", onClick: o, disabled: v, children:
|
|
704
|
+
o ? /* @__PURE__ */ e(K, { type: "button", variant: "ghost", onClick: o, disabled: v, children: m ?? x.cancel }) : null,
|
|
705
705
|
/* @__PURE__ */ e(K, { type: "submit", variant: "primary", loading: v, children: y.submitLabel ?? "Submit" })
|
|
706
706
|
] })
|
|
707
707
|
] });
|
|
708
708
|
}
|
|
709
|
-
const
|
|
709
|
+
const jr = {
|
|
710
710
|
name: "Form",
|
|
711
711
|
props: [
|
|
712
712
|
{ name: "schema", type: "FormSchema", default: null, control: "object" },
|
|
@@ -728,7 +728,7 @@ function rr(t, a) {
|
|
|
728
728
|
name: r.key,
|
|
729
729
|
label: typeof r.label == "string" ? r.label : r.key,
|
|
730
730
|
type: ar(r, a),
|
|
731
|
-
options: (o = He(r.filterOptions ?? r.options)) == null ? void 0 : o.map((
|
|
731
|
+
options: (o = He(r.filterOptions ?? r.options)) == null ? void 0 : o.map((m) => ({ label: m.label, value: m.value })),
|
|
732
732
|
required: !1
|
|
733
733
|
};
|
|
734
734
|
}), submitLabel: a ? "Save" : "Create" };
|
|
@@ -736,14 +736,14 @@ function rr(t, a) {
|
|
|
736
736
|
function ar(t, a) {
|
|
737
737
|
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";
|
|
738
738
|
}
|
|
739
|
-
function
|
|
739
|
+
function Mr({
|
|
740
740
|
name: t,
|
|
741
741
|
columns: a,
|
|
742
742
|
list: n,
|
|
743
743
|
create: r,
|
|
744
744
|
update: o,
|
|
745
|
-
remove:
|
|
746
|
-
delete:
|
|
745
|
+
remove: m,
|
|
746
|
+
delete: d,
|
|
747
747
|
actions: T,
|
|
748
748
|
form: k,
|
|
749
749
|
formSchema: x,
|
|
@@ -755,9 +755,9 @@ function jr({
|
|
|
755
755
|
onStateChange: u,
|
|
756
756
|
onPageChange: b,
|
|
757
757
|
onFilterChange: E,
|
|
758
|
-
onSortChange:
|
|
758
|
+
onSortChange: j,
|
|
759
759
|
onSearchChange: $,
|
|
760
|
-
onPageSizeChange:
|
|
760
|
+
onPageSizeChange: z,
|
|
761
761
|
onSelectionChange: O,
|
|
762
762
|
selectable: v,
|
|
763
763
|
renderExpandedRow: i,
|
|
@@ -765,7 +765,7 @@ function jr({
|
|
|
765
765
|
searchDebounce: N = 250,
|
|
766
766
|
className: p
|
|
767
767
|
}) {
|
|
768
|
-
const { t: c } = J(), h =
|
|
768
|
+
const { t: c } = J(), h = m ?? d, B = T ?? ["create", "edit", "delete"], L = (s) => B.includes(s) && (s === "create" ? !!r : s === "edit" ? !!o : !!h), V = l.useMemo(
|
|
769
769
|
() => ({
|
|
770
770
|
page: 1,
|
|
771
771
|
pageSize: w ?? (g == null ? void 0 : g.pageSize) ?? 20,
|
|
@@ -782,8 +782,8 @@ function jr({
|
|
|
782
782
|
[Y, P]
|
|
783
783
|
), D = l.useCallback(
|
|
784
784
|
(s) => {
|
|
785
|
-
re((
|
|
786
|
-
const U = { ...
|
|
785
|
+
re((A) => {
|
|
786
|
+
const U = { ...A }, X = P;
|
|
787
787
|
for (const [G, ct] of Object.entries(s))
|
|
788
788
|
X && G in X && X[G] !== void 0 || (U[G] = ct);
|
|
789
789
|
const te = { ...U, ...Object.fromEntries(Object.entries(P ?? {}).filter(([, G]) => G !== void 0)) };
|
|
@@ -791,7 +791,7 @@ function jr({
|
|
|
791
791
|
});
|
|
792
792
|
},
|
|
793
793
|
[P, u]
|
|
794
|
-
), { page: F, pageSize:
|
|
794
|
+
), { page: F, pageSize: M, search: I, filters: q, sort: ne, selection: Je, expandedRows: Ye } = ae, [We, oe] = l.useState([]), [ce, ue] = l.useState(null), [Xe, de] = l.useState([null]), [Ge, me] = l.useState(!0), [pe, fe] = l.useState(null), [_, he] = l.useState(null), [Qe, W] = l.useState(!1), [be, ve] = l.useState(!1), [le, Ze] = l.useState(I);
|
|
795
795
|
l.useEffect(() => {
|
|
796
796
|
const s = setTimeout(() => Ze(I), N);
|
|
797
797
|
return () => clearTimeout(s);
|
|
@@ -799,19 +799,19 @@ function jr({
|
|
|
799
799
|
const ge = Xe[F - 1] ?? null, xe = JSON.stringify(q), Q = l.useCallback(async () => {
|
|
800
800
|
me(!0), fe(null);
|
|
801
801
|
try {
|
|
802
|
-
const s = await n({ search: le, cursor: ge, pageSize:
|
|
802
|
+
const s = await n({ search: le, cursor: ge, pageSize: M, sort: ne, filters: q });
|
|
803
803
|
oe(s.rows), ue(s.nextCursor ?? s.cursor ?? null);
|
|
804
804
|
} catch (s) {
|
|
805
805
|
fe(s instanceof Error ? s.message : String(s)), oe([]), ue(null);
|
|
806
806
|
} finally {
|
|
807
807
|
me(!1);
|
|
808
808
|
}
|
|
809
|
-
}, [le, ge,
|
|
809
|
+
}, [le, ge, M, ne, xe, n]);
|
|
810
810
|
l.useEffect(() => {
|
|
811
811
|
Q();
|
|
812
812
|
}, [Q]), l.useEffect(() => {
|
|
813
813
|
D({ page: 1 }), de([null]);
|
|
814
|
-
}, [le,
|
|
814
|
+
}, [le, M, xe]);
|
|
815
815
|
const et = l.useMemo(
|
|
816
816
|
() => a.filter((s) => s.filter).map((s) => ({
|
|
817
817
|
key: s.key,
|
|
@@ -820,15 +820,15 @@ function jr({
|
|
|
820
820
|
options: He(s.filterOptions ?? s.options)
|
|
821
821
|
})),
|
|
822
822
|
[a]
|
|
823
|
-
), tt = (s,
|
|
824
|
-
const U = { ...q, [s]:
|
|
823
|
+
), tt = (s, A) => {
|
|
824
|
+
const U = { ...q, [s]: A };
|
|
825
825
|
D({ filters: U }), E == null || E(U);
|
|
826
826
|
}, rt = (s) => {
|
|
827
827
|
D({ search: s }), $ == null || $(s);
|
|
828
828
|
}, at = (s) => {
|
|
829
|
-
D({ sort: s }),
|
|
830
|
-
}, nt = (s,
|
|
831
|
-
if (
|
|
829
|
+
D({ sort: s }), j == null || j(s);
|
|
830
|
+
}, nt = (s, A) => {
|
|
831
|
+
if (A === "next") {
|
|
832
832
|
const U = ce;
|
|
833
833
|
de((X) => {
|
|
834
834
|
const te = [...X];
|
|
@@ -846,12 +846,12 @@ function jr({
|
|
|
846
846
|
align: "right",
|
|
847
847
|
render: (s) => /* @__PURE__ */ f("div", { className: "flex items-center justify-end gap-1", children: [
|
|
848
848
|
L("edit") ? /* @__PURE__ */ e(K, { variant: "ghost", size: "icon", "aria-label": "Edit", onClick: () => {
|
|
849
|
-
var
|
|
850
|
-
return (
|
|
849
|
+
var A;
|
|
850
|
+
return (A = Z.current) == null ? void 0 : A.call(Z, s);
|
|
851
851
|
}, "data-testid": "resource-edit", children: /* @__PURE__ */ e(kt, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) }) : null,
|
|
852
852
|
L("delete") ? /* @__PURE__ */ e(K, { variant: "ghost", size: "icon", "aria-label": "Delete", disabled: be, onClick: () => {
|
|
853
|
-
var
|
|
854
|
-
return void ((
|
|
853
|
+
var A;
|
|
854
|
+
return void ((A = ee.current) == null ? void 0 : A.call(ee, s));
|
|
855
855
|
}, "data-testid": "resource-delete", children: /* @__PURE__ */ e(St, { className: "h-3.5 w-3.5 text-[var(--prui-danger)]", "aria-hidden": !0 }) }) : null
|
|
856
856
|
] })
|
|
857
857
|
}
|
|
@@ -883,7 +883,7 @@ function jr({
|
|
|
883
883
|
const ee = l.useRef(we);
|
|
884
884
|
ee.current = we;
|
|
885
885
|
const it = l.useCallback(
|
|
886
|
-
(s,
|
|
886
|
+
(s, A) => String(y ? y(s, A) : s.id ?? A),
|
|
887
887
|
[y]
|
|
888
888
|
), Ne = x ?? rr(a, _), ot = _ ? Object.fromEntries(
|
|
889
889
|
Ne.fields.map((s) => [s.name, _[s.name] ?? ""])
|
|
@@ -917,8 +917,8 @@ function jr({
|
|
|
917
917
|
loading: Ge,
|
|
918
918
|
selectable: v,
|
|
919
919
|
selectedRowKeys: Je,
|
|
920
|
-
onSelectionChange: (s,
|
|
921
|
-
D({ selection: s }), O == null || O(s,
|
|
920
|
+
onSelectionChange: (s, A) => {
|
|
921
|
+
D({ selection: s }), O == null || O(s, A);
|
|
922
922
|
},
|
|
923
923
|
renderExpandedRow: i,
|
|
924
924
|
expandedRowKeys: Ye,
|
|
@@ -930,12 +930,12 @@ function jr({
|
|
|
930
930
|
Kt,
|
|
931
931
|
{
|
|
932
932
|
page: F,
|
|
933
|
-
pageSize:
|
|
933
|
+
pageSize: M,
|
|
934
934
|
hasNextPage: ce != null,
|
|
935
935
|
hasPreviousPage: F > 1,
|
|
936
936
|
onPageChange: nt,
|
|
937
937
|
onPageSizeChange: (s) => {
|
|
938
|
-
D({ pageSize: s }),
|
|
938
|
+
D({ pageSize: s }), z == null || z(s);
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
941
|
),
|
|
@@ -1024,38 +1024,38 @@ function nr(t) {
|
|
|
1024
1024
|
function lr({ field: t }) {
|
|
1025
1025
|
const { name: a, type: n, value: r, onChange: o } = t;
|
|
1026
1026
|
if (!n || !a) return null;
|
|
1027
|
-
const
|
|
1028
|
-
return n === "switch" ? /* @__PURE__ */ e("label", { className: "flex items-center gap-2", htmlFor:
|
|
1027
|
+
const m = `prui-settings-${a}`;
|
|
1028
|
+
return n === "switch" ? /* @__PURE__ */ e("label", { className: "flex items-center gap-2", htmlFor: m, children: /* @__PURE__ */ e(
|
|
1029
1029
|
Le,
|
|
1030
1030
|
{
|
|
1031
|
-
id:
|
|
1031
|
+
id: m,
|
|
1032
1032
|
checked: !!r,
|
|
1033
|
-
onChange: (
|
|
1033
|
+
onChange: (d) => o == null ? void 0 : o(d),
|
|
1034
1034
|
"aria-label": t.label
|
|
1035
1035
|
}
|
|
1036
1036
|
) }) : n === "select" ? /* @__PURE__ */ e(
|
|
1037
1037
|
Ie,
|
|
1038
1038
|
{
|
|
1039
|
-
id:
|
|
1039
|
+
id: m,
|
|
1040
1040
|
className: "w-56",
|
|
1041
1041
|
options: nr(t.options) ?? [],
|
|
1042
1042
|
value: String(r ?? ""),
|
|
1043
|
-
onChange: (
|
|
1043
|
+
onChange: (d) => o == null ? void 0 : o(Array.isArray(d) ? d.join(",") : d),
|
|
1044
1044
|
"aria-label": t.label
|
|
1045
1045
|
}
|
|
1046
1046
|
) : /* @__PURE__ */ e(
|
|
1047
1047
|
ie,
|
|
1048
1048
|
{
|
|
1049
|
-
id:
|
|
1049
|
+
id: m,
|
|
1050
1050
|
type: n === "number" ? "number" : "text",
|
|
1051
1051
|
className: "h-8 w-56",
|
|
1052
1052
|
value: String(r ?? ""),
|
|
1053
|
-
onChange: (
|
|
1053
|
+
onChange: (d) => o == null ? void 0 : o(n === "number" ? d.target.value === "" ? "" : Number(d.target.value) : d.target.value),
|
|
1054
1054
|
"aria-label": t.label
|
|
1055
1055
|
}
|
|
1056
1056
|
);
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function Ar({ title: t = "Settings", sections: a, className: n }) {
|
|
1059
1059
|
return /* @__PURE__ */ f("div", { className: C("prui-settings mx-auto flex w-full max-w-4xl flex-col gap-6", n), children: [
|
|
1060
1060
|
/* @__PURE__ */ e("h1", { className: "text-xl font-semibold text-[var(--prui-fg)]", children: t }),
|
|
1061
1061
|
/* @__PURE__ */ f("div", { className: "flex flex-col gap-6 md:flex-row", children: [
|
|
@@ -1072,18 +1072,18 @@ function zr({ title: t = "Settings", sections: a, className: n }) {
|
|
|
1072
1072
|
/* @__PURE__ */ e(Ve, { children: r.title ?? r.label ?? r.id }),
|
|
1073
1073
|
r.description ? /* @__PURE__ */ e(Ue, { children: r.description }) : null
|
|
1074
1074
|
] }),
|
|
1075
|
-
/* @__PURE__ */ e(_e, { children: r.content ?? /* @__PURE__ */ e("dl", { className: "flex flex-col divide-y divide-[var(--prui-line)]", children: (r.fields ?? []).map((o,
|
|
1075
|
+
/* @__PURE__ */ e(_e, { children: r.content ?? /* @__PURE__ */ e("dl", { className: "flex flex-col divide-y divide-[var(--prui-line)]", children: (r.fields ?? []).map((o, m) => /* @__PURE__ */ f("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: [
|
|
1076
1076
|
/* @__PURE__ */ f("div", { className: "min-w-0", children: [
|
|
1077
1077
|
/* @__PURE__ */ e("dt", { className: "text-sm font-medium text-[var(--prui-fg)]", children: o.label }),
|
|
1078
1078
|
o.description ? /* @__PURE__ */ e("dd", { className: "text-xs text-[var(--prui-dim)]", children: o.description }) : null
|
|
1079
1079
|
] }),
|
|
1080
1080
|
/* @__PURE__ */ e("div", { className: "shrink-0", children: o.control ?? /* @__PURE__ */ e(lr, { field: o }) })
|
|
1081
|
-
] }, `${o.label}-${
|
|
1081
|
+
] }, `${o.label}-${m}`)) }) })
|
|
1082
1082
|
] }, r.id)) })
|
|
1083
1083
|
] })
|
|
1084
1084
|
] });
|
|
1085
1085
|
}
|
|
1086
|
-
const
|
|
1086
|
+
const zr = {
|
|
1087
1087
|
name: "Settings",
|
|
1088
1088
|
props: [
|
|
1089
1089
|
{ name: "title", type: "string", default: "'Settings'", control: "text" },
|
|
@@ -1096,33 +1096,33 @@ function sr({
|
|
|
1096
1096
|
onTimeout: n,
|
|
1097
1097
|
onExtend: r,
|
|
1098
1098
|
title: o = "Session expiring soon",
|
|
1099
|
-
message:
|
|
1099
|
+
message: m = "Your session is about to expire due to inactivity."
|
|
1100
1100
|
}) {
|
|
1101
|
-
const
|
|
1101
|
+
const d = Math.max(0, t) * 6e4, T = Math.min(Math.max(0, a) * 6e4, d), [k, x] = l.useState(!1), [y, R] = l.useState(T), w = l.useRef(null), P = l.useRef(null), g = l.useRef(null), u = l.useRef(!1), b = l.useCallback(() => {
|
|
1102
1102
|
for (const i of [w, P, g])
|
|
1103
1103
|
i.current != null && (clearInterval(i.current), clearTimeout(i.current), i.current = null);
|
|
1104
1104
|
}, []), E = l.useCallback(() => {
|
|
1105
1105
|
b(), x(!1), n == null || n();
|
|
1106
|
-
}, [b, n]),
|
|
1106
|
+
}, [b, n]), j = l.useCallback(() => {
|
|
1107
1107
|
b(), x(!1), u.current = !1, w.current = window.setTimeout(() => {
|
|
1108
1108
|
u.current = !0, R(T), x(!0), g.current = window.setInterval(() => {
|
|
1109
1109
|
R((i) => i <= 1e3 ? (E(), 0) : i - 1e3);
|
|
1110
1110
|
}, 1e3);
|
|
1111
|
-
},
|
|
1112
|
-
}, [b, E,
|
|
1111
|
+
}, d - T), P.current = window.setTimeout(E, d);
|
|
1112
|
+
}, [b, E, d, T]);
|
|
1113
1113
|
l.useEffect(() => {
|
|
1114
1114
|
const i = () => {
|
|
1115
|
-
u.current ||
|
|
1115
|
+
u.current || j();
|
|
1116
1116
|
};
|
|
1117
1117
|
for (const S of Pe) document.addEventListener(S, i, { passive: !0 });
|
|
1118
|
-
return
|
|
1118
|
+
return j(), () => {
|
|
1119
1119
|
b();
|
|
1120
1120
|
for (const S of Pe) document.removeEventListener(S, i);
|
|
1121
1121
|
};
|
|
1122
|
-
}, [
|
|
1122
|
+
}, [j, b]);
|
|
1123
1123
|
const $ = () => {
|
|
1124
|
-
r == null || r(),
|
|
1125
|
-
},
|
|
1124
|
+
r == null || r(), j();
|
|
1125
|
+
}, z = Math.floor(y / 6e4), O = Math.floor(y % 6e4 / 1e3), v = `${z}:${String(O).padStart(2, "0")}`;
|
|
1126
1126
|
return /* @__PURE__ */ f(
|
|
1127
1127
|
Fe,
|
|
1128
1128
|
{
|
|
@@ -1134,7 +1134,7 @@ function sr({
|
|
|
1134
1134
|
/* @__PURE__ */ f("div", { className: "flex flex-col items-center gap-1 px-8 pb-2 pt-8 text-center", children: [
|
|
1135
1135
|
/* @__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(Ct, { className: "h-6 w-6 text-[var(--prui-warn)]", "aria-hidden": !0 }) }),
|
|
1136
1136
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: o }),
|
|
1137
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-[var(--prui-dim)]", children:
|
|
1137
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-[var(--prui-dim)]", children: m }),
|
|
1138
1138
|
/* @__PURE__ */ e("div", { className: "py-4 font-mono text-4xl font-bold text-[var(--prui-fg)]", "data-testid": "session-countdown", children: v })
|
|
1139
1139
|
] }),
|
|
1140
1140
|
/* @__PURE__ */ f("div", { className: "flex flex-col gap-2 px-8 pb-8 sm:flex-row", children: [
|
|
@@ -1158,8 +1158,8 @@ const ir = {
|
|
|
1158
1158
|
SessionTimeout: sr,
|
|
1159
1159
|
sessionTimeoutPropsMeta: ir
|
|
1160
1160
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1161
|
-
function $r({ title: t, description: a, brand: n, width: r = "max-w-sm", footer: o, children:
|
|
1162
|
-
return /* @__PURE__ */ e("div", { className: C("prui-auth-shell flex min-h-[100dvh] items-center justify-center bg-[var(--prui-background)] p-4",
|
|
1161
|
+
function $r({ title: t, description: a, brand: n, width: r = "max-w-sm", footer: o, children: m, className: d }) {
|
|
1162
|
+
return /* @__PURE__ */ e("div", { className: C("prui-auth-shell flex min-h-[100dvh] items-center justify-center bg-[var(--prui-background)] p-4", d), "data-testid": "auth-shell", children: /* @__PURE__ */ f("div", { className: C("w-full", r), children: [
|
|
1163
1163
|
n ? /* @__PURE__ */ f("div", { className: "mb-6 flex items-center justify-center gap-2", "data-testid": "auth-shell-brand", children: [
|
|
1164
1164
|
n.mark ? /* @__PURE__ */ e("img", { src: n.mark, alt: "", className: "h-8 w-8 rounded-[var(--prui-radius-1)] object-cover" }) : null,
|
|
1165
1165
|
/* @__PURE__ */ e("span", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: n.name })
|
|
@@ -1169,7 +1169,7 @@ function $r({ title: t, description: a, brand: n, width: r = "max-w-sm", footer:
|
|
|
1169
1169
|
/* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: t }),
|
|
1170
1170
|
a ? /* @__PURE__ */ e("p", { className: "text-sm text-[var(--prui-dim)]", children: a }) : null
|
|
1171
1171
|
] }),
|
|
1172
|
-
|
|
1172
|
+
m,
|
|
1173
1173
|
o ? /* @__PURE__ */ e("div", { className: "mt-4 text-center text-sm text-[var(--prui-dim)]", children: o }) : null
|
|
1174
1174
|
] })
|
|
1175
1175
|
] }) });
|
|
@@ -1189,18 +1189,18 @@ export {
|
|
|
1189
1189
|
Rr as A,
|
|
1190
1190
|
Gt as C,
|
|
1191
1191
|
tr as F,
|
|
1192
|
-
|
|
1192
|
+
Mr as R,
|
|
1193
1193
|
sr as S,
|
|
1194
1194
|
Qt as a,
|
|
1195
1195
|
$r as b,
|
|
1196
1196
|
qt as c,
|
|
1197
|
-
|
|
1197
|
+
Ar as d,
|
|
1198
1198
|
Ee as e,
|
|
1199
1199
|
Or as f,
|
|
1200
1200
|
Er as g,
|
|
1201
1201
|
Fr as h,
|
|
1202
|
-
|
|
1203
|
-
|
|
1202
|
+
jr as i,
|
|
1203
|
+
zr as j,
|
|
1204
1204
|
Dr as k,
|
|
1205
1205
|
Pr as r,
|
|
1206
1206
|
ir as s,
|