@skiddph/prui 0.10.1 → 0.10.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.
package/dist/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Link as e, NavLink as t, Navigate as o, Outlet as r, Route as p, Routes as u } from "react-router-dom";
2
- import { A as m, a as P, b as S, c as l, C as h, F as n, R as M, S as R, d as g, e as A, f, g as c, h as d, i as k, r as v, s as N, j as T, k as b, u as w } from "./chunks/auth-shell-CAIorrrl.js";
2
+ import { A as m, a as P, b as S, c as l, C as h, F as n, R as M, S as R, d as g, e as A, f, g as c, h as d, i as k, r as v, s as N, j as T, k as b, u as w } from "./chunks/auth-shell-BudxZ4__.js";
3
3
  export {
4
4
  m as App,
5
5
  P as AppShell,
@@ -1,18 +1,18 @@
1
- import { jsx as e, jsxs as f, Fragment as Me } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as p, Fragment as Me } from "react/jsx-runtime";
2
2
  import * as l from "react";
3
3
  import { createPortal as ot } from "react-dom";
4
- import { Routes as ct, Route as ke, Navigate as ut, MemoryRouter as dt, BrowserRouter as mt, useLocation as Pe, useNavigate as Oe, Outlet as pt, Link as ft, NavLink as ht } from "react-router-dom";
4
+ import { Routes as ct, Route as Se, Navigate as ut, MemoryRouter as dt, BrowserRouter as mt, useLocation as Pe, useNavigate as Oe, Outlet as pt, Link as ft, NavLink as ht } from "react-router-dom";
5
5
  import { ChevronsRight as bt, ChevronsLeft as vt, 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 B } from "../core/button.js";
9
9
  import { useOverlay as De, Portal as Ae, useOverlayStack as Et, useEscapeKey as jt } from "../core/overlay.js";
10
- import { endIndex as Mt, homeIndex as Pt, moveIndex as Se } from "../core/list-nav.js";
11
- import { resolveThemeName as Ot, themeMode as Dt, readPersistedTheme as At, applyTheme as Te, listThemes as zt, clearAppliedTokens as $t } from "../theme.js";
10
+ import { endIndex as Mt, homeIndex as Pt, moveIndex as Te } from "../core/list-nav.js";
11
+ import { resolveThemeName as Ot, themeMode as Dt, readPersistedTheme as At, applyTheme as Ce, listThemes as zt, clearAppliedTokens as $t } from "../theme.js";
12
12
  import { usePruiI18n as J } from "../i18n.js";
13
13
  import { Modal as ze, 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";
15
- import { Textarea as Bt, Input as ie } from "../core/input.js";
15
+ import { Textarea as Bt, Input as oe } from "../core/input.js";
16
16
  import { Label as Ut } from "../core/label.js";
17
17
  import { Select as $e } from "../core/select.js";
18
18
  import { Switch as Fe } from "../core/switch.js";
@@ -31,9 +31,9 @@ const Vt = [
31
31
  { path: "/settings", name: "settings" },
32
32
  { path: "/admin-setup", name: "adminSetup" }
33
33
  ];
34
- function qt({ mode: t, config: a, children: n }) {
35
- const r = t === "auth" || t === "auth+utility", o = t === "utility" || t === "auth+utility", m = [
36
- ...r ? Vt : [],
34
+ function qt({ mode: t, config: r, children: n }) {
35
+ const a = t === "auth" || t === "auth+utility", o = t === "utility" || t === "auth+utility", m = [
36
+ ...a ? Vt : [],
37
37
  ...o ? _t : []
38
38
  ], [d, T] = l.useState(null);
39
39
  return l.useEffect(() => {
@@ -43,32 +43,32 @@ function qt({ mode: t, config: a, children: n }) {
43
43
  }), () => {
44
44
  k = !0;
45
45
  };
46
- }, []), d ? /* @__PURE__ */ f(ct, { children: [
46
+ }, []), d ? /* @__PURE__ */ p(ct, { children: [
47
47
  m.map(({ path: k, name: x }) => {
48
48
  const y = d[x];
49
- return y ? /* @__PURE__ */ e(ke, { path: k, element: /* @__PURE__ */ e(y, { ...(a == null ? void 0 : a[x]) ?? {} }) }, k) : null;
49
+ return y ? /* @__PURE__ */ e(Se, { path: k, element: /* @__PURE__ */ e(y, { ...(r == null ? void 0 : r[x]) ?? {} }) }, k) : null;
50
50
  }),
51
51
  n,
52
- r ? /* @__PURE__ */ e(ke, { path: "*", element: /* @__PURE__ */ e(ut, { to: "/login", replace: !0 }) }) : null
52
+ a ? /* @__PURE__ */ e(Se, { path: "*", element: /* @__PURE__ */ e(ut, { to: "/login", replace: !0 }) }) : null
53
53
  ] }) : /* @__PURE__ */ e("div", { className: "p-8 text-center text-sm text-[var(--prui-dim)]", children: "Loading…" });
54
54
  }
55
55
  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"), m = Dt(o), [d, T] = l.useState(() => (r ? At() : null) ?? { theme: o, mode: m }), k = l.useCallback(
59
+ const r = t !== !1, n = typeof t == "object" ? t : {}, a = n.persist !== !1, o = Ot(n.default ?? "control"), m = Dt(o), [d, T] = l.useState(() => (a ? At() : null) ?? { theme: o, mode: m }), k = l.useCallback(
60
60
  (x) => {
61
- T(x), Te({ theme: x.theme, mode: x.mode, storageKey: r ? "prui:theme" : null });
61
+ T(x), Ce({ theme: x.theme, mode: x.mode, storageKey: a ? "prui:theme" : null });
62
62
  },
63
- [r]
63
+ [a]
64
64
  );
65
65
  return l.useEffect(() => {
66
- Te({ theme: d.theme, mode: d.mode, storageKey: r ? "prui:theme" : null });
67
- }, [d, r]), { enabled: a, state: d, setTheme: k };
66
+ Ce({ theme: d.theme, mode: d.mode, storageKey: a ? "prui:theme" : null });
67
+ }, [d, a]), { enabled: r, state: d, setTheme: k };
68
68
  }
69
69
  function Yt({ config: t }) {
70
- const { enabled: a, state: n, setTheme: r } = Jt(t), { t: o } = J();
71
- return a ? /* @__PURE__ */ e(
70
+ const { enabled: r, state: n, setTheme: a } = Jt(t), { t: o } = J();
71
+ return r ? /* @__PURE__ */ e(
72
72
  Rt,
73
73
  {
74
74
  align: "end",
@@ -86,16 +86,16 @@ function Yt({ config: t }) {
86
86
  items: zt().map((m) => ({
87
87
  label: `${m}${m === n.theme ? " (active)" : ""}`,
88
88
  onSelect: () => {
89
- $t(), r({ theme: m, mode: m === "daylight" ? "light" : "dark" });
89
+ $t(), a({ theme: m, mode: m === "daylight" ? "light" : "dark" });
90
90
  }
91
91
  }))
92
92
  }
93
93
  ) : null;
94
94
  }
95
- function se(t, a) {
96
- return a === "/" ? t === "/" : t === a || t.startsWith(a + "/");
95
+ function se(t, r) {
96
+ return r === "/" ? t === "/" : t === r || t.startsWith(r + "/");
97
97
  }
98
- function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
98
+ function Wt({ item: t, onNavigate: r, expandAllOn: n, collapsed: a }) {
99
99
  var O;
100
100
  const { pathname: o } = Pe(), m = Oe(), d = (t.items ?? []).some(
101
101
  (v) => v.href ? se(o, v.href) : (v.items ?? []).some((i) => i.href && se(o, i.href))
@@ -112,7 +112,7 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
112
112
  if (jt(y, A, () => E()), l.useEffect(() => {
113
113
  var v;
114
114
  y && ((v = u.current) == null || v.focus());
115
- }, [y]), r) {
115
+ }, [y]), a) {
116
116
  const v = [];
117
117
  for (const c of t.items ?? [])
118
118
  if ((O = c.items) != null && O.length) {
@@ -136,14 +136,14 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
136
136
  const h = (L = u.current) == null ? void 0 : L.querySelectorAll("[role='menuitem']");
137
137
  if (!h) return;
138
138
  (V = Array.from(h)[c]) == null || V.focus();
139
- }, p = (c) => {
139
+ }, f = (c) => {
140
140
  const h = i.length;
141
141
  switch (c.key) {
142
142
  case "ArrowDown":
143
- c.preventDefault(), N(Se(b, 1, h));
143
+ c.preventDefault(), N(Te(b, 1, h));
144
144
  break;
145
145
  case "ArrowUp":
146
- c.preventDefault(), N(Se(b, -1, h));
146
+ c.preventDefault(), N(Te(b, -1, h));
147
147
  break;
148
148
  case "Home":
149
149
  c.preventDefault(), N(Pt(h));
@@ -156,7 +156,7 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
156
156
  break;
157
157
  }
158
158
  };
159
- return /* @__PURE__ */ f("li", { "data-testid": "nav-group", children: [
159
+ return /* @__PURE__ */ p("li", { "data-testid": "nav-group", children: [
160
160
  /* @__PURE__ */ e(
161
161
  "button",
162
162
  {
@@ -178,9 +178,9 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
178
178
  }
179
179
  ),
180
180
  y && w ? ot(
181
- /* @__PURE__ */ f(Me, { children: [
181
+ /* @__PURE__ */ p(Me, { children: [
182
182
  /* @__PURE__ */ e("div", { className: "fixed inset-0 z-[var(--prui-z-flyout)]", onClick: () => E(), "data-testid": "rail-flyout-backdrop" }),
183
- /* @__PURE__ */ f(
183
+ /* @__PURE__ */ p(
184
184
  "div",
185
185
  {
186
186
  ref: (c) => {
@@ -189,7 +189,7 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
189
189
  role: "menu",
190
190
  "aria-label": t.label,
191
191
  tabIndex: -1,
192
- onKeyDown: p,
192
+ onKeyDown: f,
193
193
  "data-testid": "rail-flyout",
194
194
  className: "fixed z-[calc(var(--prui-z-flyout)+1)] flex w-56 max-h-80 flex-col overflow-y-auto rounded-[var(--prui-radius)] border border-[var(--prui-line)] bg-[var(--prui-surface)] py-1.5 shadow-[var(--prui-shadow-lg)] outline-none",
195
195
  style: { top: w.top, left: w.left },
@@ -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
- E(), a == null || a(), c.href && m(c.href);
211
+ E(), r == null || r(), c.href && m(c.href);
212
212
  },
213
213
  children: c.label
214
214
  },
@@ -223,8 +223,8 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
223
223
  ) : null
224
224
  ] });
225
225
  }
226
- return /* @__PURE__ */ f("li", { "data-testid": "nav-group", children: [
227
- /* @__PURE__ */ f(
226
+ return /* @__PURE__ */ p("li", { "data-testid": "nav-group", children: [
227
+ /* @__PURE__ */ p(
228
228
  "button",
229
229
  {
230
230
  type: "button",
@@ -241,18 +241,18 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
241
241
  ]
242
242
  }
243
243
  ),
244
- T ? /* @__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((v) => /* @__PURE__ */ e(Ve, { item: v, onNavigate: a, nested: !0, expandAllOn: n, collapsed: r }, v.href ?? v.label)) }) : null
244
+ T ? /* @__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((v) => /* @__PURE__ */ e(Ve, { item: v, onNavigate: r, nested: !0, expandAllOn: n, collapsed: a }, v.href ?? v.label)) }) : null
245
245
  ] });
246
246
  }
247
247
  function Xt({ label: t }) {
248
248
  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 });
249
249
  }
250
- function Ve({ item: t, onNavigate: a, nested: n, expandAllOn: r, collapsed: o }) {
251
- return t.items && t.items.length > 0 ? /* @__PURE__ */ e(Wt, { item: t, onNavigate: a, expandAllOn: r, collapsed: o }) : t.heading || !t.href && !t.items ? o ? null : /* @__PURE__ */ e(Xt, { label: t.label }) : t.href ? /* @__PURE__ */ e("li", { children: /* @__PURE__ */ f(
250
+ function Ve({ item: t, onNavigate: r, nested: n, expandAllOn: a, collapsed: o }) {
251
+ return t.items && t.items.length > 0 ? /* @__PURE__ */ e(Wt, { item: t, onNavigate: r, expandAllOn: a, collapsed: o }) : t.heading || !t.href && !t.items ? o ? null : /* @__PURE__ */ e(Xt, { label: t.label }) : t.href ? /* @__PURE__ */ e("li", { children: /* @__PURE__ */ p(
252
252
  ht,
253
253
  {
254
254
  to: t.href,
255
- onClick: a,
255
+ onClick: r,
256
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",
@@ -265,36 +265,36 @@ function Ve({ item: t, onNavigate: a, nested: n, expandAllOn: r, collapsed: o })
265
265
  }
266
266
  ) }) : null;
267
267
  }
268
- function Ce({ nav: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
268
+ function Re({ nav: t, onNavigate: r, expandAllOn: n, collapsed: a }) {
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((m) => /* @__PURE__ */ e(Ve, { item: m, onNavigate: a, expandAllOn: n, collapsed: r }, m.href ?? m.label)) }) });
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(Ve, { item: m, onNavigate: r, expandAllOn: n, collapsed: a }, m.href ?? m.label)) }) });
271
271
  }
272
- function Re({ brand: t }) {
272
+ function ie({ brand: t }) {
273
273
  if (!t) return null;
274
- const a = /* @__PURE__ */ f(Me, { children: [
274
+ const r = /* @__PURE__ */ p(Me, { 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,
276
276
  /* @__PURE__ */ e("span", { className: "prui-nav-label truncate font-semibold text-[var(--prui-fg)]", children: t.name })
277
277
  ] }), n = "flex items-center gap-2 px-1 py-1 min-w-0";
278
- return t.href === null ? /* @__PURE__ */ e("div", { className: n, children: a }) : /* @__PURE__ */ e(ft, { to: t.href ?? "/", className: n, "aria-label": t.name, children: a });
278
+ return t.href === null ? /* @__PURE__ */ e("div", { className: n, children: r }) : /* @__PURE__ */ e(ft, { to: t.href ?? "/", className: n, "aria-label": t.name, children: r });
279
279
  }
280
280
  function Gt({
281
281
  open: t,
282
- onOpenChange: a,
282
+ onOpenChange: r,
283
283
  entries: n,
284
- placeholder: r,
284
+ placeholder: a,
285
285
  onNavigate: o
286
286
  }) {
287
- const { t: m } = J(), [d, T] = l.useState(""), [k, x] = l.useState(0), y = l.useRef(null), M = r ?? m.commandPlaceholder, w = l.useMemo(() => {
287
+ const { t: m } = J(), [d, T] = l.useState(""), [k, x] = l.useState(0), y = l.useRef(null), M = a ?? m.commandPlaceholder, w = l.useMemo(() => {
288
288
  const u = d.trim().toLowerCase();
289
289
  return u ? n.filter((b) => b.label.toLowerCase().includes(u)) : n;
290
290
  }, [n, d]);
291
291
  l.useEffect(() => x(0), [d]);
292
292
  const { ref: P } = De({
293
293
  open: t,
294
- onEscape: () => a(!1),
294
+ onEscape: () => r(!1),
295
295
  initialFocus: y
296
296
  }), g = (u) => {
297
- a(!1), u.onSelect ? u.onSelect() : u.href && (o == null || o(u.href));
297
+ r(!1), u.onSelect ? u.onSelect() : u.href && (o == null || o(u.href));
298
298
  };
299
299
  return t ? /* @__PURE__ */ e(Ae, { children: /* @__PURE__ */ e("div", { ref: P, children: /* @__PURE__ */ e(
300
300
  "div",
@@ -302,9 +302,9 @@ function Gt({
302
302
  className: "prui-dialog-overlay fixed inset-0 z-[var(--prui-z-overlay)] flex items-start justify-center pt-24",
303
303
  style: { backgroundColor: "var(--prui-scrim)" },
304
304
  onMouseDown: (u) => {
305
- u.target === u.currentTarget && a(!1);
305
+ u.target === u.currentTarget && r(!1);
306
306
  },
307
- children: /* @__PURE__ */ f(
307
+ children: /* @__PURE__ */ p(
308
308
  "div",
309
309
  {
310
310
  role: "dialog",
@@ -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: m.commandNoMatches }) : w.map((u, b) => /* @__PURE__ */ f(
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__ */ p(
339
339
  "li",
340
340
  {
341
341
  id: `palette-option-${b}`,
@@ -362,9 +362,9 @@ function Gt({
362
362
  }
363
363
  function Qt(t) {
364
364
  const {
365
- brand: a,
365
+ brand: r,
366
366
  nav: n = [],
367
- search: r = !0,
367
+ search: a = !0,
368
368
  theme: o = !0,
369
369
  auth: m = !1,
370
370
  sidebar: d = {},
@@ -376,7 +376,7 @@ 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 }, R = b.enabled !== !1, E = b.hotkey ?? "/", $ = d.collapsible !== !1, [A, O] = l.useState(d.defaultOpen === !0), [v, i] = l.useState(!0), [S, N] = l.useState(!1), p = Pe(), c = Oe(), h = l.useMemo(
379
+ } = t, { t: u } = J(), b = typeof a == "object" ? a : { enabled: a !== !1 }, R = b.enabled !== !1, E = b.hotkey ?? "/", $ = d.collapsible !== !1, [A, O] = l.useState(d.defaultOpen === !0), [v, i] = l.useState(!0), [S, N] = l.useState(!1), f = Pe(), c = Oe(), h = l.useMemo(
380
380
  () => m === !1 ? null : m === !0 ? {} : m,
381
381
  [m]
382
382
  ), K = l.useCallback(() => {
@@ -398,16 +398,16 @@ function Qt(t) {
398
398
  };
399
399
  return document.addEventListener("keydown", I), () => document.removeEventListener("keydown", I);
400
400
  }, [E, R]);
401
- const V = l.useRef(p.pathname);
401
+ const V = l.useRef(f.pathname);
402
402
  l.useEffect(() => {
403
- V.current !== p.pathname && (V.current = p.pathname, O(!1));
404
- }, [p.pathname]);
403
+ V.current !== f.pathname && (V.current = f.pathname, O(!1));
404
+ }, [f.pathname]);
405
405
  const Y = l.useRef(null), { ref: re } = De({
406
406
  open: A,
407
407
  onEscape: () => O(!1),
408
408
  initialFocus: Y
409
409
  }), ae = d.width ?? 240, z = !v && M !== "D";
410
- return /* @__PURE__ */ f(
410
+ return /* @__PURE__ */ p(
411
411
  "div",
412
412
  {
413
413
  className: "prui-app prui-shell min-h-dvh bg-[var(--prui-background)] text-[var(--prui-fg)]",
@@ -415,8 +415,8 @@ function Qt(t) {
415
415
  "data-collapsed": z ? "true" : void 0,
416
416
  style: { "--prui-shell-sidebar": z ? "var(--prui-rail-width, 64px)" : `${ae}px` },
417
417
  children: [
418
- /* @__PURE__ */ f("aside", { "data-testid": "sidebar", className: "prui-shell-sidebar hidden md:flex md:flex-col md:min-h-0", children: [
419
- /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto p-2 pt-4 scrollbar-thin", children: /* @__PURE__ */ e(Ce, { nav: n, expandAllOn: y, collapsed: z }) }),
418
+ /* @__PURE__ */ p("aside", { "data-testid": "sidebar", className: "prui-shell-sidebar hidden md:flex md:flex-col md:min-h-0", children: [
419
+ /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto p-2 pt-4 scrollbar-thin", children: /* @__PURE__ */ e(Re, { nav: n, expandAllOn: y, collapsed: z }) }),
420
420
  P ? /* @__PURE__ */ e(
421
421
  "div",
422
422
  {
@@ -438,7 +438,7 @@ function Qt(t) {
438
438
  }
439
439
  ) }) : null
440
440
  ] }),
441
- A ? /* @__PURE__ */ e(Ae, { children: /* @__PURE__ */ f("div", { ref: re, className: "md:hidden fixed inset-0 z-[var(--prui-z-drawer)]", "data-testid": "mobile-drawer", children: [
441
+ A ? /* @__PURE__ */ e(Ae, { children: /* @__PURE__ */ p("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
  {
@@ -448,7 +448,7 @@ function Qt(t) {
448
448
  "data-testid": "drawer-backdrop"
449
449
  }
450
450
  ),
451
- /* @__PURE__ */ f(
451
+ /* @__PURE__ */ p(
452
452
  "aside",
453
453
  {
454
454
  className: "absolute left-0 top-0 h-full w-64 overflow-y-auto border-r border-[var(--prui-line)] bg-[var(--prui-surface)] p-2",
@@ -456,18 +456,21 @@ function Qt(t) {
456
456
  "aria-modal": "true",
457
457
  "aria-label": "Navigation",
458
458
  children: [
459
- /* @__PURE__ */ e("div", { className: "mb-2 flex h-10 items-center justify-end px-1", children: /* @__PURE__ */ e(
460
- "button",
461
- {
462
- type: "button",
463
- ref: Y,
464
- "aria-label": u.closeNavigation,
465
- onClick: () => O(!1),
466
- className: "rounded-[var(--prui-radius)] p-1 text-[var(--prui-dim)] hover:text-[var(--prui-fg)] cursor-pointer",
467
- children: /* @__PURE__ */ e(gt, { className: "h-4 w-4", "aria-hidden": !0 })
468
- }
469
- ) }),
470
- /* @__PURE__ */ e(Ce, { nav: n, onNavigate: () => O(!1), expandAllOn: y, collapsed: !1 })
459
+ /* @__PURE__ */ p("div", { className: C("mb-2 flex h-10 items-center gap-2 px-1", r ? "justify-between" : "justify-end"), children: [
460
+ r ? /* @__PURE__ */ e("div", { className: "min-w-0", onClick: () => O(!1), children: /* @__PURE__ */ e(ie, { brand: r }) }) : null,
461
+ /* @__PURE__ */ e(
462
+ "button",
463
+ {
464
+ type: "button",
465
+ ref: Y,
466
+ "aria-label": u.closeNavigation,
467
+ onClick: () => O(!1),
468
+ className: "rounded-[var(--prui-radius)] p-1 text-[var(--prui-dim)] hover:text-[var(--prui-fg)] cursor-pointer",
469
+ children: /* @__PURE__ */ e(gt, { className: "h-4 w-4", "aria-hidden": !0 })
470
+ }
471
+ )
472
+ ] }),
473
+ /* @__PURE__ */ e(Re, { nav: n, onNavigate: () => O(!1), expandAllOn: y, collapsed: !1 })
471
474
  ]
472
475
  }
473
476
  )
@@ -477,10 +480,10 @@ function Qt(t) {
477
480
  {
478
481
  "data-testid": "sidebar-header",
479
482
  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(Re, { brand: a })
483
+ children: w ?? /* @__PURE__ */ e(ie, { brand: r })
481
484
  }
482
485
  ) : null,
483
- /* @__PURE__ */ f(
486
+ /* @__PURE__ */ p(
484
487
  "header",
485
488
  {
486
489
  "data-testid": "app-header",
@@ -498,8 +501,8 @@ function Qt(t) {
498
501
  children: /* @__PURE__ */ e(xt, { className: "h-4 w-4", "aria-hidden": !0 })
499
502
  }
500
503
  ) : null,
501
- /* @__PURE__ */ e("div", { className: "min-w-0 justify-self-start", children: /* @__PURE__ */ e(Re, { brand: a }) }),
502
- R ? /* @__PURE__ */ f(
504
+ /* @__PURE__ */ e("div", { className: "min-w-0 justify-self-start", children: /* @__PURE__ */ e(ie, { brand: r }) }),
505
+ R ? /* @__PURE__ */ p(
503
506
  "button",
504
507
  {
505
508
  type: "button",
@@ -513,7 +516,7 @@ function Qt(t) {
513
516
  ]
514
517
  }
515
518
  ) : null,
516
- /* @__PURE__ */ f("div", { className: "flex items-center gap-2 justify-self-end", children: [
519
+ /* @__PURE__ */ p("div", { className: "flex items-center gap-2 justify-self-end", children: [
517
520
  T,
518
521
  /* @__PURE__ */ e(Yt, { config: o })
519
522
  ] })
@@ -543,8 +546,8 @@ function Qt(t) {
543
546
  );
544
547
  }
545
548
  function Rr(t) {
546
- const { router: a = "browser", initialEntries: n } = t;
547
- return /* @__PURE__ */ e(a === "memory" ? dt : mt, { initialEntries: n, children: /* @__PURE__ */ e(Qt, { ...t }) });
549
+ const { router: r = "browser", initialEntries: n } = t;
550
+ return /* @__PURE__ */ e(r === "memory" ? dt : mt, { initialEntries: n, children: /* @__PURE__ */ e(Qt, { ...t }) });
548
551
  }
549
552
  const Er = {
550
553
  name: "App",
@@ -571,68 +574,68 @@ function Zt(t) {
571
574
  }
572
575
  function er(t) {
573
576
  if (t)
574
- return t.map((a) => typeof a == "string" || typeof a == "number" ? { label: String(a), value: String(a) } : a);
577
+ return t.map((r) => typeof r == "string" || typeof r == "number" ? { label: String(r), value: String(r) } : r);
575
578
  }
576
- function Ee(t, a) {
579
+ function Ee(t, r) {
577
580
  const n = {};
578
- for (const r of t.fields)
579
- 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] = "";
581
+ for (const a of t.fields)
582
+ r && a.name in r ? n[a.name] = r[a.name] : a.defaultValue !== void 0 ? n[a.name] = a.defaultValue : a.type === "boolean" ? n[a.name] = !1 : n[a.name] = "";
580
583
  return n;
581
584
  }
582
585
  function tr({
583
586
  schema: t,
584
- initialValues: a,
587
+ initialValues: r,
585
588
  defaultValues: n,
586
- onSubmit: r,
589
+ onSubmit: a,
587
590
  onCancel: o,
588
591
  cancelLabel: m,
589
592
  submitting: d = !1,
590
593
  error: T,
591
594
  className: k
592
595
  }) {
593
- const { t: x } = J(), y = l.useMemo(() => Zt(t), [t]), M = a ?? n, [w, P] = l.useState(() => Ee(y, M)), [g, u] = l.useState({}), [b, R] = l.useState(null), [E, $] = l.useState(!1);
596
+ const { t: x } = J(), y = l.useMemo(() => Zt(t), [t]), M = r ?? n, [w, P] = l.useState(() => Ee(y, M)), [g, u] = l.useState({}), [b, R] = l.useState(null), [E, $] = l.useState(!1);
594
597
  l.useEffect(() => {
595
598
  P(Ee(y, M));
596
599
  }, [JSON.stringify(y), JSON.stringify(M ?? {})]);
597
600
  const A = (i, S) => {
598
601
  P((N) => ({ ...N, [i]: S })), u((N) => {
599
602
  if (!N[i]) return N;
600
- const p = { ...N };
601
- return delete p[i], p;
603
+ const f = { ...N };
604
+ return delete f[i], f;
602
605
  });
603
606
  }, O = async (i) => {
604
607
  var N;
605
608
  i.preventDefault();
606
609
  const S = {};
607
- for (const p of y.fields) {
608
- if (p.required) {
609
- const h = w[p.name];
610
- (h === "" || h == null || Array.isArray(h) && h.length === 0) && (S[p.name] = x.requiredField.replace("{label}", p.label));
610
+ for (const f of y.fields) {
611
+ if (f.required) {
612
+ const h = w[f.name];
613
+ (h === "" || h == null || Array.isArray(h) && h.length === 0) && (S[f.name] = x.requiredField.replace("{label}", f.label));
611
614
  }
612
- const c = (N = p.validate) == null ? void 0 : N.call(p, w[p.name], w);
613
- c && (S[p.name] = c);
615
+ const c = (N = f.validate) == null ? void 0 : N.call(f, w[f.name], w);
616
+ c && (S[f.name] = c);
614
617
  }
615
618
  if (u(S), !(Object.keys(S).length > 0)) {
616
619
  R(null);
617
620
  try {
618
- const p = r == null ? void 0 : r({ ...w });
619
- p && typeof p.then == "function" && ($(!0), await p);
620
- } catch (p) {
621
- R(p instanceof Error ? p.message : String(p));
621
+ const f = a == null ? void 0 : a({ ...w });
622
+ f && typeof f.then == "function" && ($(!0), await f);
623
+ } catch (f) {
624
+ R(f instanceof Error ? f.message : String(f));
622
625
  } finally {
623
626
  $(!1);
624
627
  }
625
628
  }
626
629
  }, v = d || E;
627
- return /* @__PURE__ */ f("form", { onSubmit: O, className: C("prui-form flex flex-col gap-4", k), noValidate: !0, children: [
630
+ return /* @__PURE__ */ p("form", { onSubmit: O, className: C("prui-form flex flex-col gap-4", k), noValidate: !0, children: [
628
631
  /* @__PURE__ */ e("div", { className: C("grid gap-4", y.columns === 2 && "md:grid-cols-2"), children: y.fields.map((i) => {
629
632
  const S = g[i.name], N = {
630
633
  id: `prui-form-${i.name}`,
631
634
  "aria-invalid": S ? !0 : void 0,
632
635
  "aria-describedby": S ? `prui-form-${i.name}-error` : void 0
633
636
  };
634
- return /* @__PURE__ */ f("div", { className: C("flex flex-col gap-1.5", i.colSpan === 2 && "md:col-span-2", i.className), children: [
635
- /* @__PURE__ */ f(Ut, { htmlFor: N.id, children: [
637
+ return /* @__PURE__ */ p("div", { className: C("flex flex-col gap-1.5", i.colSpan === 2 && "md:col-span-2", i.className), children: [
638
+ /* @__PURE__ */ p(Ut, { htmlFor: N.id, children: [
636
639
  i.label,
637
640
  i.required ? /* @__PURE__ */ e("span", { className: "ml-0.5 text-[var(--prui-danger)]", children: "*" }) : null
638
641
  ] }),
@@ -643,7 +646,7 @@ function tr({
643
646
  placeholder: i.placeholder,
644
647
  disabled: i.disabled || v,
645
648
  value: String(w[i.name] ?? ""),
646
- onChange: (p) => A(i.name, p.target.value)
649
+ onChange: (f) => A(i.name, f.target.value)
647
650
  }
648
651
  ) : i.type === "select" ? /* @__PURE__ */ e(
649
652
  $e,
@@ -653,17 +656,17 @@ function tr({
653
656
  placeholder: i.placeholder,
654
657
  disabled: i.disabled || v,
655
658
  value: String(w[i.name] ?? ""),
656
- onChange: (p) => A(i.name, p)
659
+ onChange: (f) => A(i.name, f)
657
660
  }
658
661
  ) : i.type === "date" ? /* @__PURE__ */ e(
659
- ie,
662
+ oe,
660
663
  {
661
664
  ...N,
662
665
  type: "date",
663
666
  placeholder: i.placeholder,
664
667
  disabled: i.disabled || v,
665
668
  value: String(w[i.name] ?? ""),
666
- onChange: (p) => A(i.name, p.target.value)
669
+ onChange: (f) => A(i.name, f.target.value)
667
670
  }
668
671
  ) : i.type === "boolean" ? /* @__PURE__ */ e(
669
672
  Fe,
@@ -671,24 +674,24 @@ function tr({
671
674
  ...N,
672
675
  disabled: i.disabled || v,
673
676
  checked: !!w[i.name],
674
- onChange: (p) => A(i.name, p)
677
+ onChange: (f) => A(i.name, f)
675
678
  }
676
679
  ) : /* @__PURE__ */ e(
677
- ie,
680
+ oe,
678
681
  {
679
682
  ...N,
680
683
  type: i.type ?? "text",
681
684
  placeholder: i.placeholder,
682
685
  disabled: i.disabled || v,
683
686
  value: String(w[i.name] ?? ""),
684
- onChange: (p) => A(i.name, i.type === "number" ? p.target.value === "" ? "" : Number(p.target.value) : p.target.value)
687
+ onChange: (f) => A(i.name, i.type === "number" ? f.target.value === "" ? "" : Number(f.target.value) : f.target.value)
685
688
  }
686
689
  ),
687
690
  S ? /* @__PURE__ */ e("p", { id: `prui-form-${i.name}-error`, role: "alert", className: "text-xs text-[var(--prui-danger)]", children: S }) : null
688
691
  ] }, i.name);
689
692
  }) }),
690
693
  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,
691
- /* @__PURE__ */ f("div", { className: "flex items-center justify-end gap-2", children: [
694
+ /* @__PURE__ */ p("div", { className: "flex items-center justify-end gap-2", children: [
692
695
  o ? /* @__PURE__ */ e(B, { type: "button", variant: "ghost", onClick: o, disabled: v, children: m ?? x.cancel }) : null,
693
696
  /* @__PURE__ */ e(B, { type: "submit", variant: "primary", loading: v, children: y.submitLabel ?? "Submit" })
694
697
  ] })
@@ -707,28 +710,28 @@ const jr = {
707
710
  };
708
711
  function _e(t) {
709
712
  if (t)
710
- return t.map((a) => typeof a == "string" || typeof a == "number" ? { label: String(a), value: String(a) } : a);
713
+ return t.map((r) => typeof r == "string" || typeof r == "number" ? { label: String(r), value: String(r) } : r);
711
714
  }
712
- function rr(t, a) {
713
- return { fields: t.filter((r) => r.formField !== !1 && !r.hidden).filter((r) => r.key !== "id" && r.key !== "actions").map((r) => {
715
+ function rr(t, r) {
716
+ return { fields: t.filter((a) => a.formField !== !1 && !a.hidden).filter((a) => a.key !== "id" && a.key !== "actions").map((a) => {
714
717
  var o;
715
718
  return {
716
- name: r.key,
717
- label: typeof r.label == "string" ? r.label : r.key,
718
- type: ar(r, a),
719
- options: (o = _e(r.filterOptions ?? r.options)) == null ? void 0 : o.map((m) => ({ label: m.label, value: m.value })),
719
+ name: a.key,
720
+ label: typeof a.label == "string" ? a.label : a.key,
721
+ type: ar(a, r),
722
+ options: (o = _e(a.filterOptions ?? a.options)) == null ? void 0 : o.map((m) => ({ label: m.label, value: m.value })),
720
723
  required: !1
721
724
  };
722
- }), submitLabel: a ? "Save" : "Create" };
725
+ }), submitLabel: r ? "Save" : "Create" };
723
726
  }
724
- function ar(t, a) {
725
- 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";
727
+ function ar(t, r) {
728
+ return t.filter === "select" ? "select" : typeof (r == null ? void 0 : r[t.key]) == "number" || t.filter === "number" || t.filter === "numberrange" || t.filter === "price" ? "number" : t.filter === "date" || t.filter === "daterange" ? "date" : "text";
726
729
  }
727
730
  function Mr({
728
731
  name: t,
729
- columns: a,
732
+ columns: r,
730
733
  list: n,
731
- create: r,
734
+ create: a,
732
735
  update: o,
733
736
  remove: m,
734
737
  delete: d,
@@ -751,9 +754,9 @@ function Mr({
751
754
  renderExpandedRow: i,
752
755
  virtualized: S,
753
756
  searchDebounce: N = 250,
754
- className: p
757
+ className: f
755
758
  }) {
756
- const { t: c } = J(), h = m ?? d, K = T ?? ["create", "edit", "delete"], L = (s) => K.includes(s) && (s === "create" ? !!r : s === "edit" ? !!o : !!h), V = l.useMemo(
759
+ const { t: c } = J(), h = m ?? d, K = T ?? ["create", "edit", "delete"], L = (s) => K.includes(s) && (s === "create" ? !!a : s === "edit" ? !!o : !!h), V = l.useMemo(
757
760
  () => ({
758
761
  page: 1,
759
762
  pageSize: w ?? (g == null ? void 0 : g.pageSize) ?? 20,
@@ -779,35 +782,35 @@ function Mr({
779
782
  });
780
783
  },
781
784
  [P, u]
782
- ), { page: I, pageSize: j, search: F, filters: q, sort: ne, selection: qe, expandedRows: He } = ae, [Je, oe] = l.useState([]), [ce, ue] = l.useState(null), [Ye, de] = l.useState([null]), [We, me] = l.useState(!0), [pe, fe] = l.useState(null), [_, he] = l.useState(null), [Xe, W] = l.useState(!1), [be, ve] = l.useState(!1), [le, Ge] = l.useState(F);
785
+ ), { page: I, pageSize: j, search: F, filters: q, sort: ne, selection: qe, expandedRows: He } = ae, [Je, ce] = l.useState([]), [ue, de] = l.useState(null), [Ye, me] = l.useState([null]), [We, pe] = l.useState(!0), [fe, he] = l.useState(null), [_, be] = l.useState(null), [Xe, W] = l.useState(!1), [ve, ge] = l.useState(!1), [le, Ge] = l.useState(F);
783
786
  l.useEffect(() => {
784
787
  const s = setTimeout(() => Ge(F), N);
785
788
  return () => clearTimeout(s);
786
789
  }, [F, N]);
787
- const ge = Ye[I - 1] ?? null, xe = JSON.stringify(q), Q = l.useCallback(async () => {
788
- me(!0), fe(null);
790
+ const xe = Ye[I - 1] ?? null, ye = JSON.stringify(q), Q = l.useCallback(async () => {
791
+ pe(!0), he(null);
789
792
  try {
790
- const s = await n({ search: le, cursor: ge, pageSize: j, sort: ne, filters: q });
791
- oe(s.rows), ue(s.nextCursor ?? s.cursor ?? null);
793
+ const s = await n({ search: le, cursor: xe, pageSize: j, sort: ne, filters: q });
794
+ ce(s.rows), de(s.nextCursor ?? s.cursor ?? null);
792
795
  } catch (s) {
793
- fe(s instanceof Error ? s.message : String(s)), oe([]), ue(null);
796
+ he(s instanceof Error ? s.message : String(s)), ce([]), de(null);
794
797
  } finally {
795
- me(!1);
798
+ pe(!1);
796
799
  }
797
- }, [le, ge, j, ne, xe, n]);
800
+ }, [le, xe, j, ne, ye, n]);
798
801
  l.useEffect(() => {
799
802
  Q();
800
803
  }, [Q]), l.useEffect(() => {
801
- z({ page: 1 }), de([null]);
802
- }, [le, j, xe]);
804
+ z({ page: 1 }), me([null]);
805
+ }, [le, j, ye]);
803
806
  const Qe = l.useMemo(
804
- () => a.filter((s) => s.filter).map((s) => ({
807
+ () => r.filter((s) => s.filter).map((s) => ({
805
808
  key: s.key,
806
809
  label: typeof s.label == "string" ? s.label : s.key,
807
810
  type: s.filter === "numberrange" ? "number" : s.filter,
808
811
  options: _e(s.filterOptions ?? s.options)
809
812
  })),
810
- [a]
813
+ [r]
811
814
  ), Ze = (s, D) => {
812
815
  const U = { ...q, [s]: D };
813
816
  z({ filters: U }), R == null || R(U);
@@ -817,8 +820,8 @@ function Mr({
817
820
  z({ sort: s }), E == null || E(s);
818
821
  }, rt = (s, D) => {
819
822
  if (D === "next") {
820
- const U = ce;
821
- de((X) => {
823
+ const U = ue;
824
+ me((X) => {
822
825
  const te = [...X];
823
826
  return te[s - 1] = U, te;
824
827
  });
@@ -826,18 +829,18 @@ function Mr({
826
829
  z({ page: s }), b == null || b(s);
827
830
  }, at = l.useMemo(
828
831
  () => [
829
- ...a.filter((s) => !s.hidden),
832
+ ...r.filter((s) => !s.hidden),
830
833
  ...L("edit") || L("delete") ? [
831
834
  {
832
835
  key: "actions",
833
836
  label: "",
834
837
  align: "right",
835
- render: (s) => /* @__PURE__ */ f("div", { className: "flex items-center justify-end gap-1", children: [
838
+ render: (s) => /* @__PURE__ */ p("div", { className: "flex items-center justify-end gap-1", children: [
836
839
  L("edit") ? /* @__PURE__ */ e(B, { variant: "ghost", size: "icon", "aria-label": "Edit", onClick: () => {
837
840
  var D;
838
841
  return (D = Z.current) == null ? void 0 : D.call(Z, s);
839
842
  }, "data-testid": "resource-edit", children: /* @__PURE__ */ e(kt, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) }) : null,
840
- L("delete") ? /* @__PURE__ */ e(B, { variant: "ghost", size: "icon", "aria-label": "Delete", disabled: be, onClick: () => {
843
+ L("delete") ? /* @__PURE__ */ e(B, { variant: "ghost", size: "icon", "aria-label": "Delete", disabled: ve, onClick: () => {
841
844
  var D;
842
845
  return void ((D = ee.current) == null ? void 0 : D.call(ee, s));
843
846
  }, "data-testid": "resource-delete", children: /* @__PURE__ */ e(St, { className: "h-3.5 w-3.5 text-[var(--prui-danger)]", "aria-hidden": !0 }) }) : null
@@ -846,12 +849,12 @@ function Mr({
846
849
  ] : []
847
850
  ],
848
851
  // eslint-disable-next-line react-hooks/exhaustive-deps -- can() depends only on the action functions
849
- [a, r, o, h, be]
852
+ [r, a, o, h, ve]
850
853
  ), nt = () => {
851
- he(null), W(!0);
852
- }, ye = (s) => {
853
- he(s), W(!0);
854
- }, we = async (s) => {
854
+ be(null), W(!0);
855
+ }, we = (s) => {
856
+ be(s), W(!0);
857
+ }, Ne = async (s) => {
855
858
  if (!(!await Ft({
856
859
  title: `${c.delete} ${H}?`,
857
860
  message: c.deleteConfirmMessage,
@@ -859,24 +862,24 @@ function Mr({
859
862
  cancelText: c.cancel,
860
863
  type: "danger"
861
864
  }) || !h)) {
862
- ve(!0);
865
+ ge(!0);
863
866
  try {
864
867
  await h(s), await Q();
865
868
  } finally {
866
- ve(!1);
869
+ ge(!1);
867
870
  }
868
871
  }
869
- }, Z = l.useRef(ye);
870
- Z.current = ye;
871
- const ee = l.useRef(we);
872
- ee.current = we;
872
+ }, Z = l.useRef(we);
873
+ Z.current = we;
874
+ const ee = l.useRef(Ne);
875
+ ee.current = Ne;
873
876
  const lt = l.useCallback(
874
877
  (s, D) => String(y ? y(s, D) : s.id ?? D),
875
878
  [y]
876
- ), Ne = x ?? rr(a, _), st = _ ? Object.fromEntries(
877
- Ne.fields.map((s) => [s.name, _[s.name] ?? ""])
879
+ ), ke = x ?? rr(r, _), st = _ ? Object.fromEntries(
880
+ ke.fields.map((s) => [s.name, _[s.name] ?? ""])
878
881
  ) : void 0, H = t.replace(/s$/, "");
879
- return /* @__PURE__ */ f("div", { className: C("prui-resource flex flex-col gap-2", p), "data-testid": "resource", children: [
882
+ return /* @__PURE__ */ p("div", { className: C("prui-resource flex flex-col gap-2", f), "data-testid": "resource", children: [
880
883
  /* @__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 }) }),
881
884
  /* @__PURE__ */ e(
882
885
  It,
@@ -887,13 +890,13 @@ function Mr({
887
890
  filters: Qe,
888
891
  filterValues: q,
889
892
  onFilterChange: Ze,
890
- actions: L("create") ? /* @__PURE__ */ f(B, { variant: "primary", size: "sm", onClick: nt, "data-testid": "resource-create", children: [
893
+ actions: L("create") ? /* @__PURE__ */ p(B, { variant: "primary", size: "sm", onClick: nt, "data-testid": "resource-create", children: [
891
894
  /* @__PURE__ */ e(Tt, { className: "h-4 w-4", "aria-hidden": !0 }),
892
895
  c.newEntity.replace("{name}", H)
893
896
  ] }) : void 0
894
897
  }
895
898
  ),
896
- pe ? /* @__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: pe }) : null,
899
+ fe ? /* @__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: fe }) : null,
897
900
  /* @__PURE__ */ e(
898
901
  Lt,
899
902
  {
@@ -919,7 +922,7 @@ function Mr({
919
922
  {
920
923
  page: I,
921
924
  pageSize: j,
922
- hasNextPage: ce != null,
925
+ hasNextPage: ue != null,
923
926
  hasPreviousPage: I > 1,
924
927
  onPageChange: rt,
925
928
  onPageSizeChange: (s) => {
@@ -927,16 +930,16 @@ function Mr({
927
930
  }
928
931
  }
929
932
  ),
930
- /* @__PURE__ */ f(ze, { open: Xe, onClose: () => W(!1), size: "sm", ariaLabel: _ ? c.editEntity.replace("{name}", H) : c.newEntity.replace("{name}", H), noPadding: !0, children: [
933
+ /* @__PURE__ */ p(ze, { open: Xe, onClose: () => W(!1), size: "sm", ariaLabel: _ ? c.editEntity.replace("{name}", H) : c.newEntity.replace("{name}", H), noPadding: !0, children: [
931
934
  /* @__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: _ ? c.editEntity.replace("{name}", H) : c.newEntity.replace("{name}", H) }) }),
932
935
  /* @__PURE__ */ e("div", { className: "px-8 pb-8", children: k ?? /* @__PURE__ */ e(
933
936
  tr,
934
937
  {
935
- schema: Ne,
938
+ schema: ke,
936
939
  initialValues: st,
937
940
  onCancel: () => W(!1),
938
941
  onSubmit: async (s) => {
939
- _ ? await (o == null ? void 0 : o(_, s)) : await (r == null ? void 0 : r(s)), W(!1), await Q();
942
+ _ ? await (o == null ? void 0 : o(_, s)) : await (a == null ? void 0 : a(s)), W(!1), await Q();
940
943
  }
941
944
  }
942
945
  ) })
@@ -972,12 +975,12 @@ const Pr = {
972
975
  { name: "searchDebounce", type: "number (ms)", default: "250", control: "number" }
973
976
  ]
974
977
  };
975
- function Or({ items: t, className: a }) {
976
- return /* @__PURE__ */ e("div", { className: C("prui-stat-row grid gap-3 sm:grid-cols-2 lg:grid-cols-4", a), children: t.map((n, r) => {
978
+ function Or({ items: t, className: r }) {
979
+ return /* @__PURE__ */ e("div", { className: C("prui-stat-row grid gap-3 sm:grid-cols-2 lg:grid-cols-4", r), children: t.map((n, a) => {
977
980
  const o = n.icon;
978
- return /* @__PURE__ */ f(Ie, { "data-testid": "stat-card", children: [
979
- /* @__PURE__ */ f(Le, { className: "pb-2", children: [
980
- /* @__PURE__ */ f(Ke, { className: "flex items-center gap-1.5 text-xs", children: [
981
+ return /* @__PURE__ */ p(Ie, { "data-testid": "stat-card", children: [
982
+ /* @__PURE__ */ p(Le, { className: "pb-2", children: [
983
+ /* @__PURE__ */ p(Ke, { className: "flex items-center gap-1.5 text-xs", children: [
981
984
  o ? /* @__PURE__ */ e(o, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) : null,
982
985
  n.label
983
986
  ] }),
@@ -995,7 +998,7 @@ function Or({ items: t, className: a }) {
995
998
  children: n.delta
996
999
  }
997
1000
  ) }) : null
998
- ] }, `${n.label}-${r}`);
1001
+ ] }, `${n.label}-${a}`);
999
1002
  }) });
1000
1003
  }
1001
1004
  const Dr = {
@@ -1007,17 +1010,17 @@ const Dr = {
1007
1010
  };
1008
1011
  function nr(t) {
1009
1012
  if (t)
1010
- return t.map((a) => typeof a == "string" || typeof a == "number" ? { label: String(a), value: String(a) } : a);
1013
+ return t.map((r) => typeof r == "string" || typeof r == "number" ? { label: String(r), value: String(r) } : r);
1011
1014
  }
1012
1015
  function lr({ field: t }) {
1013
- const { name: a, type: n, value: r, onChange: o } = t;
1014
- if (!n || !a) return null;
1015
- const m = `prui-settings-${a}`;
1016
+ const { name: r, type: n, value: a, onChange: o } = t;
1017
+ if (!n || !r) return null;
1018
+ const m = `prui-settings-${r}`;
1016
1019
  return n === "switch" ? /* @__PURE__ */ e("label", { className: "flex items-center gap-2", htmlFor: m, children: /* @__PURE__ */ e(
1017
1020
  Fe,
1018
1021
  {
1019
1022
  id: m,
1020
- checked: !!r,
1023
+ checked: !!a,
1021
1024
  onChange: (d) => o == null ? void 0 : o(d),
1022
1025
  "aria-label": t.label
1023
1026
  }
@@ -1027,47 +1030,47 @@ function lr({ field: t }) {
1027
1030
  id: m,
1028
1031
  className: "w-56",
1029
1032
  options: nr(t.options) ?? [],
1030
- value: String(r ?? ""),
1033
+ value: String(a ?? ""),
1031
1034
  onChange: (d) => o == null ? void 0 : o(Array.isArray(d) ? d.join(",") : d),
1032
1035
  "aria-label": t.label
1033
1036
  }
1034
1037
  ) : /* @__PURE__ */ e(
1035
- ie,
1038
+ oe,
1036
1039
  {
1037
1040
  id: m,
1038
1041
  type: n === "number" ? "number" : "text",
1039
1042
  className: "h-8 w-56",
1040
- value: String(r ?? ""),
1043
+ value: String(a ?? ""),
1041
1044
  onChange: (d) => o == null ? void 0 : o(n === "number" ? d.target.value === "" ? "" : Number(d.target.value) : d.target.value),
1042
1045
  "aria-label": t.label
1043
1046
  }
1044
1047
  );
1045
1048
  }
1046
- function Ar({ title: t = "Settings", sections: a, className: n }) {
1047
- return /* @__PURE__ */ f("div", { className: C("prui-settings mx-auto flex w-full max-w-4xl flex-col gap-6", n), children: [
1049
+ function Ar({ title: t = "Settings", sections: r, className: n }) {
1050
+ return /* @__PURE__ */ p("div", { className: C("prui-settings mx-auto flex w-full max-w-4xl flex-col gap-6", n), children: [
1048
1051
  /* @__PURE__ */ e("h1", { className: "text-xl font-semibold text-[var(--prui-fg)]", children: t }),
1049
- /* @__PURE__ */ f("div", { className: "flex flex-col gap-6 md:flex-row", children: [
1050
- /* @__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(
1052
+ /* @__PURE__ */ p("div", { className: "flex flex-col gap-6 md:flex-row", children: [
1053
+ /* @__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: r.map((a) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1051
1054
  "a",
1052
1055
  {
1053
- href: `#settings-${r.id}`,
1056
+ href: `#settings-${a.id}`,
1054
1057
  className: "block rounded-[var(--prui-radius)] px-2.5 py-1.5 text-sm text-[var(--prui-dim)] hover:bg-[var(--prui-raise)] hover:text-[var(--prui-fg)]",
1055
- children: r.title ?? r.label ?? r.id
1058
+ children: a.title ?? a.label ?? a.id
1056
1059
  }
1057
- ) }, r.id)) }) }),
1058
- /* @__PURE__ */ e("div", { className: "flex min-w-0 flex-1 flex-col gap-4", children: a.map((r) => /* @__PURE__ */ f(Ie, { id: `settings-${r.id}`, "data-testid": "settings-section", children: [
1059
- /* @__PURE__ */ f(Le, { children: [
1060
- /* @__PURE__ */ e(Be, { children: r.title ?? r.label ?? r.id }),
1061
- r.description ? /* @__PURE__ */ e(Ke, { children: r.description }) : null
1060
+ ) }, a.id)) }) }),
1061
+ /* @__PURE__ */ e("div", { className: "flex min-w-0 flex-1 flex-col gap-4", children: r.map((a) => /* @__PURE__ */ p(Ie, { id: `settings-${a.id}`, "data-testid": "settings-section", children: [
1062
+ /* @__PURE__ */ p(Le, { children: [
1063
+ /* @__PURE__ */ e(Be, { children: a.title ?? a.label ?? a.id }),
1064
+ a.description ? /* @__PURE__ */ e(Ke, { children: a.description }) : null
1062
1065
  ] }),
1063
- /* @__PURE__ */ e(Ue, { 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: [
1064
- /* @__PURE__ */ f("div", { className: "min-w-0", children: [
1066
+ /* @__PURE__ */ e(Ue, { children: a.content ?? /* @__PURE__ */ e("dl", { className: "flex flex-col divide-y divide-[var(--prui-line)]", children: (a.fields ?? []).map((o, m) => /* @__PURE__ */ p("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: [
1067
+ /* @__PURE__ */ p("div", { className: "min-w-0", children: [
1065
1068
  /* @__PURE__ */ e("dt", { className: "text-sm font-medium text-[var(--prui-fg)]", children: o.label }),
1066
1069
  o.description ? /* @__PURE__ */ e("dd", { className: "text-xs text-[var(--prui-dim)]", children: o.description }) : null
1067
1070
  ] }),
1068
1071
  /* @__PURE__ */ e("div", { className: "shrink-0", children: o.control ?? /* @__PURE__ */ e(lr, { field: o }) })
1069
1072
  ] }, `${o.label}-${m}`)) }) })
1070
- ] }, r.id)) })
1073
+ ] }, a.id)) })
1071
1074
  ] })
1072
1075
  ] });
1073
1076
  }
@@ -1080,13 +1083,13 @@ const zr = {
1080
1083
  }, je = ["mousedown", "keydown", "scroll", "touchstart", "click"];
1081
1084
  function sr({
1082
1085
  timeout: t = 15,
1083
- warningTime: a = 2,
1086
+ warningTime: r = 2,
1084
1087
  onTimeout: n,
1085
- onExtend: r,
1088
+ onExtend: a,
1086
1089
  title: o = "Session expiring soon",
1087
1090
  message: m = "Your session is about to expire due to inactivity."
1088
1091
  }) {
1089
- const d = Math.max(0, t) * 6e4, T = Math.min(Math.max(0, a) * 6e4, d), [k, x] = l.useState(!1), [y, M] = l.useState(T), w = l.useRef(null), P = l.useRef(null), g = l.useRef(null), u = l.useRef(!1), b = l.useCallback(() => {
1092
+ const d = Math.max(0, t) * 6e4, T = Math.min(Math.max(0, r) * 6e4, d), [k, x] = l.useState(!1), [y, M] = l.useState(T), w = l.useRef(null), P = l.useRef(null), g = l.useRef(null), u = l.useRef(!1), b = l.useCallback(() => {
1090
1093
  for (const i of [w, P, g])
1091
1094
  i.current != null && (clearInterval(i.current), clearTimeout(i.current), i.current = null);
1092
1095
  }, []), R = l.useCallback(() => {
@@ -1109,9 +1112,9 @@ function sr({
1109
1112
  };
1110
1113
  }, [E, b]);
1111
1114
  const $ = () => {
1112
- r == null || r(), E();
1115
+ a == null || a(), E();
1113
1116
  }, A = Math.floor(y / 6e4), O = Math.floor(y % 6e4 / 1e3), v = `${A}:${String(O).padStart(2, "0")}`;
1114
- return /* @__PURE__ */ f(
1117
+ return /* @__PURE__ */ p(
1115
1118
  ze,
1116
1119
  {
1117
1120
  open: k,
@@ -1119,13 +1122,13 @@ function sr({
1119
1122
  size: "sm",
1120
1123
  ariaLabel: o,
1121
1124
  children: [
1122
- /* @__PURE__ */ f("div", { className: "flex flex-col items-center gap-1 px-8 pb-2 pt-8 text-center", children: [
1125
+ /* @__PURE__ */ p("div", { className: "flex flex-col items-center gap-1 px-8 pb-2 pt-8 text-center", children: [
1123
1126
  /* @__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 }) }),
1124
1127
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: o }),
1125
1128
  /* @__PURE__ */ e("p", { className: "text-sm text-[var(--prui-dim)]", children: m }),
1126
1129
  /* @__PURE__ */ e("div", { className: "py-4 font-mono text-4xl font-bold text-[var(--prui-fg)]", "data-testid": "session-countdown", children: v })
1127
1130
  ] }),
1128
- /* @__PURE__ */ f("div", { className: "flex flex-col gap-2 px-8 pb-8 sm:flex-row", children: [
1131
+ /* @__PURE__ */ p("div", { className: "flex flex-col gap-2 px-8 pb-8 sm:flex-row", children: [
1129
1132
  /* @__PURE__ */ e(B, { variant: "default", className: "flex-1", onClick: R, "data-testid": "session-logout", children: "Log out now" }),
1130
1133
  /* @__PURE__ */ e(B, { variant: "primary", className: "flex-1", onClick: $, "data-testid": "session-extend", children: "Continue session" })
1131
1134
  ] })
@@ -1146,16 +1149,16 @@ const ir = {
1146
1149
  SessionTimeout: sr,
1147
1150
  sessionTimeoutPropsMeta: ir
1148
1151
  }, Symbol.toStringTag, { value: "Module" }));
1149
- function $r({ title: t, description: a, brand: n, width: r = "max-w-sm", footer: o, children: m, className: d }) {
1150
- 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: [
1151
- n ? /* @__PURE__ */ f("div", { className: "mb-6 flex items-center justify-center gap-2", "data-testid": "auth-shell-brand", children: [
1152
+ function $r({ title: t, description: r, brand: n, width: a = "max-w-sm", footer: o, children: m, className: d }) {
1153
+ 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__ */ p("div", { className: C("w-full", a), children: [
1154
+ n ? /* @__PURE__ */ p("div", { className: "mb-6 flex items-center justify-center gap-2", "data-testid": "auth-shell-brand", children: [
1152
1155
  n.mark ? /* @__PURE__ */ e("img", { src: n.mark, alt: "", className: "h-8 w-8 rounded-[var(--prui-radius-1)] object-cover" }) : null,
1153
1156
  /* @__PURE__ */ e("span", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: n.name })
1154
1157
  ] }) : null,
1155
- /* @__PURE__ */ f("div", { className: "rounded-[var(--prui-radius)] border border-[var(--prui-line)] bg-[var(--prui-surface)] p-6", children: [
1156
- /* @__PURE__ */ f("div", { className: "mb-4 flex flex-col gap-1 text-center", children: [
1158
+ /* @__PURE__ */ p("div", { className: "rounded-[var(--prui-radius)] border border-[var(--prui-line)] bg-[var(--prui-surface)] p-6", children: [
1159
+ /* @__PURE__ */ p("div", { className: "mb-4 flex flex-col gap-1 text-center", children: [
1157
1160
  /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: t }),
1158
- a ? /* @__PURE__ */ e("p", { className: "text-sm text-[var(--prui-dim)]", children: a }) : null
1161
+ r ? /* @__PURE__ */ e("p", { className: "text-sm text-[var(--prui-dim)]", children: r }) : null
1159
1162
  ] }),
1160
1163
  m,
1161
1164
  o ? /* @__PURE__ */ e("div", { className: "mt-4 text-center text-sm text-[var(--prui-dim)]", children: o }) : null
@@ -1183,7 +1186,7 @@ export {
1183
1186
  $r as b,
1184
1187
  qt as c,
1185
1188
  Ar as d,
1186
- Ce as e,
1189
+ Re as e,
1187
1190
  Or as f,
1188
1191
  Er as g,
1189
1192
  Fr as h,
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ import { TimePanel as Wo, TimePicker as Xo, TimeRangePicker as Yo, timePickerPro
35
35
  import { FileUpload as or, fileUploadPropsMeta as rr } from "./core/file-upload.js";
36
36
  import { D as tr, a as sr, b as pr, c as ir, d as Pr, F as mr, N as lr, P as nr, T as dr, e as Mr, f as gr, g as cr } from "./chunks/data-table-toolbar-B-5J2Ozl.js";
37
37
  import { Link as fr, NavLink as xr, Navigate as Tr, Outlet as Sr, Route as br, Routes as hr } from "react-router-dom";
38
- import { A as Fr, a as Rr, b as kr, c as yr, C as Ar, F as vr, R as Ir, S as Cr, d as wr, e as Br, f as Nr, g as Er, h as Or, i as Lr, r as Kr, s as Ur, j as Gr, k as _r, u as Hr } from "./chunks/auth-shell-CAIorrrl.js";
38
+ import { A as Fr, a as Rr, b as kr, c as yr, C as Ar, F as vr, R as Ir, S as Cr, d as wr, e as Br, f as Nr, g as Er, h as Or, i as Lr, r as Kr, s as Ur, j as Gr, k as _r, u as Hr } from "./chunks/auth-shell-BudxZ4__.js";
39
39
  import { AdminSetup as jr, EmptyState as qr, ErrorPage as zr, ForgotPasswordPage as Jr, LoginPage as Qr, LogoutPage as Wr, NotFoundPage as Xr, OtpPage as Yr, PagesRegistry as Zr, ProfilePage as $r, RegisterPage as ea, ResetPasswordPage as oa, SettingsPage as ra, adminSetupPropsMeta as aa, emptyStatePropsMeta as ta, errorPagePropsMeta as sa, forgotPasswordPagePropsMeta as pa, loginPagePropsMeta as ia, logoutPagePropsMeta as Pa, notFoundPagePropsMeta as ma, otpPagePropsMeta as la, profilePagePropsMeta as na, registerPagePropsMeta as da, resetPasswordPagePropsMeta as Ma, settingsPagePropsMeta as ga } from "./pages.js";
40
40
  import { PRUI_BREAKPOINTS as ua, PRUI_DESIGN_TOKENS as fa, PRUI_THEMES as xa, PRUI_TOKENS as Ta, applyTheme as Sa, applyThemeTokens as ba, clearAppliedTokens as ha, defineTheme as Da, isDarkTheme as Fa, isLightTheme as Ra, listThemes as ka, nextTheme as ya, readPersistedTheme as Aa, resolveThemeName as va, restoreAppliedTokens as Ia, themeMeta as Ca, themeMode as wa, useBreakpointAtLeast as Ba } from "./theme.js";
41
41
  import { PruiProvider as Ea, defaultDictionary as Oa, getPruiDictionary as La, resetPruiDictionary as Ka, setPruiDictionary as Ua, usePruiI18n as Ga } from "./i18n.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skiddph/prui",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "PRUI component system: primitives, app-layer super-components, pages, and themes",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",