@skiddph/prui 0.10.0 → 0.10.1

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-a-3J0_PB.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-CAIorrrl.js";
3
3
  export {
4
4
  m as App,
5
5
  P as AppShell,
@@ -1,22 +1,22 @@
1
- import { jsx as e, jsxs as f, Fragment as Oe } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as f, Fragment as Me } from "react/jsx-runtime";
2
2
  import * as l from "react";
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 Ae, Outlet as ht, Link as bt, NavLink as vt } from "react-router-dom";
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";
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";
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
- import { Button as K } from "../core/button.js";
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";
8
+ import { Button as B } from "../core/button.js";
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";
12
12
  import { usePruiI18n as J } from "../i18n.js";
13
- import { Modal as Fe, confirmModal as Ft } from "../core/modal.js";
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
15
  import { Textarea as Bt, Input as ie } from "../core/input.js";
16
16
  import { Label as Ut } from "../core/label.js";
17
- import { Select as Ie } from "../core/select.js";
18
- import { Switch as Le } from "../core/switch.js";
19
- import { Card as Ke, CardHeader as Be, CardDescription as Ue, CardTitle as Ve, CardContent as _e } from "../core/card.js";
17
+ import { Select as $e } from "../core/select.js";
18
+ import { Switch as Fe } from "../core/switch.js";
19
+ import { Card as Ie, CardHeader as Le, CardDescription as Ke, CardTitle as Be, CardContent as Ue } from "../core/card.js";
20
20
  const Vt = [
21
21
  { path: "/login", name: "login" },
22
22
  { path: "/register", name: "register" },
@@ -43,13 +43,13 @@ function qt({ mode: t, config: a, children: n }) {
43
43
  }), () => {
44
44
  k = !0;
45
45
  };
46
- }, []), d ? /* @__PURE__ */ f(dt, { children: [
46
+ }, []), d ? /* @__PURE__ */ f(ct, { children: [
47
47
  m.map(({ path: k, name: x }) => {
48
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,
52
- r ? /* @__PURE__ */ e(ke, { path: "*", element: /* @__PURE__ */ e(mt, { to: "/login", replace: !0 }) }) : null
52
+ r ? /* @__PURE__ */ e(ke, { 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(
@@ -58,12 +58,12 @@ const Ht = l.lazy(
58
58
  function Jt(t) {
59
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
- T(x), Re({ theme: x.theme, mode: x.mode, storageKey: r ? "prui:theme" : null });
61
+ T(x), Te({ 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: d.theme, mode: d.mode, storageKey: r ? "prui:theme" : null });
66
+ Te({ theme: d.theme, mode: d.mode, storageKey: r ? "prui:theme" : null });
67
67
  }, [d, r]), { enabled: a, state: d, setTheme: k };
68
68
  }
69
69
  function Yt({ config: t }) {
@@ -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(), m = Ae(), d = (t.items ?? []).some(
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))
102
102
  ), [T, k] = l.useState(d || n !== void 0 && o === n);
103
103
  l.useEffect(() => {
104
104
  d && k(!0);
105
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(() => {
106
+ const x = t.icon, [y, M] = l.useState(!1), [w, P] = l.useState(null), g = l.useRef(null), u = l.useRef(null), [b, R] = l.useState(-1), E = l.useCallback(() => {
107
107
  var i, S;
108
- R(!1), E(-1);
108
+ M(!1), R(-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: z } = Et(y);
112
- if (jt(y, z, () => j()), l.useEffect(() => {
111
+ }, []), { setElement: $, isTop: A } = Et(y);
112
+ if (jt(y, A, () => E()), l.useEffect(() => {
113
113
  var v;
114
114
  y && ((v = u.current) == null || v.focus());
115
115
  }, [y]), r) {
@@ -123,16 +123,16 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
123
123
  var h;
124
124
  const c = (h = g.current) == null ? void 0 : h.getBoundingClientRect();
125
125
  if (c) {
126
- const B = Math.min(v.length * 32 + 40, 320);
126
+ const K = Math.min(v.length * 32 + 40, 320);
127
127
  P({
128
128
  left: c.right + 8,
129
- top: Math.max(8, Math.min(c.top, window.innerHeight - B - 8))
129
+ top: Math.max(8, Math.min(c.top, window.innerHeight - K - 8))
130
130
  });
131
131
  }
132
- R((B) => !B);
132
+ M((K) => !K);
133
133
  }, N = (c) => {
134
134
  var L, V;
135
- E(c);
135
+ R(c);
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();
@@ -140,10 +140,10 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
140
140
  const h = i.length;
141
141
  switch (c.key) {
142
142
  case "ArrowDown":
143
- c.preventDefault(), N(Ce(b, 1, h));
143
+ c.preventDefault(), N(Se(b, 1, h));
144
144
  break;
145
145
  case "ArrowUp":
146
- c.preventDefault(), N(Ce(b, -1, h));
146
+ c.preventDefault(), N(Se(b, -1, h));
147
147
  break;
148
148
  case "Home":
149
149
  c.preventDefault(), N(Pt(h));
@@ -152,7 +152,7 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
152
152
  c.preventDefault(), N(Mt(h));
153
153
  break;
154
154
  case "Tab":
155
- j();
155
+ E();
156
156
  break;
157
157
  }
158
158
  };
@@ -177,9 +177,9 @@ function Wt({ item: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
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
- y && w ? ut(
181
- /* @__PURE__ */ f(Oe, { children: [
182
- /* @__PURE__ */ e("div", { className: "fixed inset-0 z-[var(--prui-z-flyout)]", onClick: () => j(), "data-testid": "rail-flyout-backdrop" }),
180
+ y && w ? ot(
181
+ /* @__PURE__ */ f(Me, { children: [
182
+ /* @__PURE__ */ e("div", { className: "fixed inset-0 z-[var(--prui-z-flyout)]", onClick: () => E(), "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
- j(), a == null || a(), c.href && m(c.href);
211
+ E(), a == null || a(), c.href && m(c.href);
212
212
  },
213
213
  children: c.label
214
214
  },
@@ -241,15 +241,15 @@ 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(qe, { 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: a, nested: !0, expandAllOn: n, collapsed: r }, 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 qe({ item: t, onNavigate: a, nested: n, expandAllOn: r, collapsed: o }) {
250
+ function Ve({ item: t, onNavigate: a, nested: n, expandAllOn: r, collapsed: o }) {
251
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(
252
- vt,
252
+ ht,
253
253
  {
254
254
  to: t.href,
255
255
  onClick: a,
@@ -265,17 +265,17 @@ function qe({ item: t, onNavigate: a, nested: n, expandAllOn: r, collapsed: o })
265
265
  }
266
266
  ) }) : null;
267
267
  }
268
- function Ee({ nav: t, onNavigate: a, expandAllOn: n, collapsed: r }) {
268
+ function Ce({ 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((m) => /* @__PURE__ */ e(qe, { 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: a, expandAllOn: n, collapsed: r }, m.href ?? m.label)) }) });
271
271
  }
272
- function je({ brand: t }) {
272
+ function Re({ brand: t }) {
273
273
  if (!t) return null;
274
- const a = /* @__PURE__ */ f(Oe, { children: [
274
+ const a = /* @__PURE__ */ f(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(bt, { to: t.href ?? "/", className: n, "aria-label": t.name, children: a });
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 });
279
279
  }
280
280
  function Gt({
281
281
  open: t,
@@ -284,19 +284,19 @@ function Gt({
284
284
  placeholder: r,
285
285
  onNavigate: o
286
286
  }) {
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(() => {
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(() => {
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
- const { ref: P } = ze({
292
+ const { ref: P } = De({
293
293
  open: t,
294
294
  onEscape: () => a(!1),
295
295
  initialFocus: y
296
296
  }), g = (u) => {
297
297
  a(!1), u.onSelect ? u.onSelect() : u.href && (o == null || o(u.href));
298
298
  };
299
- return t ? /* @__PURE__ */ e($e, { children: /* @__PURE__ */ e("div", { ref: P, children: /* @__PURE__ */ e(
299
+ return t ? /* @__PURE__ */ e(Ae, { children: /* @__PURE__ */ e("div", { ref: P, children: /* @__PURE__ */ e(
300
300
  "div",
301
301
  {
302
302
  className: "prui-dialog-overlay fixed inset-0 z-[var(--prui-z-overlay)] flex items-start justify-center pt-24",
@@ -323,7 +323,7 @@ function Gt({
323
323
  "aria-controls": "prui-palette-listbox",
324
324
  "aria-label": "Command palette search",
325
325
  "aria-activedescendant": w[k] ? `palette-option-${k}` : void 0,
326
- placeholder: R,
326
+ placeholder: M,
327
327
  value: d,
328
328
  onChange: (u) => T(u.target.value),
329
329
  onKeyDown: (u) => {
@@ -372,73 +372,73 @@ function Qt(t) {
372
372
  pages: k,
373
373
  pagesConfig: x,
374
374
  expandAllOn: y,
375
- layoutType: R = "A",
375
+ layoutType: M = "A",
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, 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(
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(
380
380
  () => m === !1 ? null : m === !0 ? {} : m,
381
381
  [m]
382
- ), B = l.useCallback(() => {
382
+ ), K = 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
- const F = [];
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
- return F;
385
+ const I = [];
386
+ for (const j of n)
387
+ if (j.items)
388
+ for (const F of j.items)
389
+ F.href && I.push({ label: `${j.label} / ${F.label}`, href: F.href, group: j.label });
390
+ else j.href && I.push({ label: j.label, href: j.href });
391
+ return I;
392
392
  }, [n]);
393
393
  l.useEffect(() => {
394
- if (!E) return;
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));
394
+ if (!R) return;
395
+ const I = (j) => {
396
+ const F = j.target, q = F && (F.tagName === "INPUT" || F.tagName === "TEXTAREA" || F.isContentEditable);
397
+ j.key === E && !q && !j.metaKey && !j.ctrlKey && !j.altKey && (j.preventDefault(), N(!0));
398
398
  };
399
- return document.addEventListener("keydown", F), () => document.removeEventListener("keydown", F);
400
- }, [j, E]);
399
+ return document.addEventListener("keydown", I), () => document.removeEventListener("keydown", I);
400
+ }, [E, R]);
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 } = ze({
406
- open: z,
405
+ const Y = l.useRef(null), { ref: re } = De({
406
+ open: A,
407
407
  onEscape: () => O(!1),
408
408
  initialFocus: Y
409
- }), ae = d.width ?? 240, D = !v && R !== "D";
409
+ }), ae = d.width ?? 240, z = !v && M !== "D";
410
410
  return /* @__PURE__ */ f(
411
411
  "div",
412
412
  {
413
413
  className: "prui-app prui-shell min-h-dvh bg-[var(--prui-background)] text-[var(--prui-fg)]",
414
- "data-layout": R,
415
- "data-collapsed": D ? "true" : void 0,
416
- style: { "--prui-shell-sidebar": D ? "var(--prui-rail-width, 64px)" : `${ae}px` },
414
+ "data-layout": M,
415
+ "data-collapsed": z ? "true" : void 0,
416
+ style: { "--prui-shell-sidebar": z ? "var(--prui-rail-width, 64px)" : `${ae}px` },
417
417
  children: [
418
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(Ee, { nav: n, expandAllOn: y, collapsed: D }) }),
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 }) }),
420
420
  P ? /* @__PURE__ */ e(
421
421
  "div",
422
422
  {
423
- className: C("border-t border-[var(--prui-line)] p-2", D && "flex justify-center px-1"),
423
+ className: C("border-t border-[var(--prui-line)] p-2", z && "flex justify-center px-1"),
424
424
  "data-testid": "sidebar-footer",
425
425
  children: P
426
426
  }
427
427
  ) : null,
428
- R !== "D" ? /* @__PURE__ */ e("div", { className: "border-t border-[var(--prui-line)] p-2", children: /* @__PURE__ */ e(
429
- K,
428
+ M !== "D" ? /* @__PURE__ */ e("div", { className: "border-t border-[var(--prui-line)] p-2", children: /* @__PURE__ */ e(
429
+ B,
430
430
  {
431
431
  variant: "ghost",
432
432
  size: "sm",
433
433
  className: "w-full justify-center",
434
- "aria-label": D ? u.expandSidebar : u.collapseSidebar,
434
+ "aria-label": z ? u.expandSidebar : u.collapseSidebar,
435
435
  "data-testid": "sidebar-toggle",
436
- onClick: () => i((F) => !F),
437
- children: D ? /* @__PURE__ */ e(Se, { className: "h-4 w-4", "aria-hidden": !0 }) : /* @__PURE__ */ e(Te, { className: "h-4 w-4", "aria-hidden": !0 })
436
+ onClick: () => i((I) => !I),
437
+ children: z ? /* @__PURE__ */ e(bt, { className: "h-4 w-4", "aria-hidden": !0 }) : /* @__PURE__ */ e(vt, { className: "h-4 w-4", "aria-hidden": !0 })
438
438
  }
439
439
  ) }) : null
440
440
  ] }),
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: [
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: [
442
442
  /* @__PURE__ */ e(
443
443
  "div",
444
444
  {
@@ -467,17 +467,17 @@ function Qt(t) {
467
467
  children: /* @__PURE__ */ e(gt, { className: "h-4 w-4", "aria-hidden": !0 })
468
468
  }
469
469
  ) }),
470
- /* @__PURE__ */ e(Ee, { nav: n, onNavigate: () => O(!1), expandAllOn: y, collapsed: !1 })
470
+ /* @__PURE__ */ e(Ce, { nav: n, onNavigate: () => O(!1), expandAllOn: y, collapsed: !1 })
471
471
  ]
472
472
  }
473
473
  )
474
474
  ] }) }) : null,
475
- R === "C" ? /* @__PURE__ */ e(
475
+ M === "C" ? /* @__PURE__ */ e(
476
476
  "div",
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(je, { brand: a })
480
+ children: w ?? /* @__PURE__ */ e(Re, { brand: a })
481
481
  }
482
482
  ) : null,
483
483
  /* @__PURE__ */ f(
@@ -487,7 +487,7 @@ function Qt(t) {
487
487
  className: "prui-shell-header sticky top-0 z-[var(--prui-z-header)] grid h-14 grid-cols-[1fr_auto_1fr] items-center gap-4 border-b border-[var(--prui-line)] bg-[var(--prui-surface)] px-4 md:px-6",
488
488
  children: [
489
489
  $ ? /* @__PURE__ */ e(
490
- K,
490
+ B,
491
491
  {
492
492
  variant: "ghost",
493
493
  size: "icon",
@@ -498,20 +498,8 @@ function Qt(t) {
498
498
  children: /* @__PURE__ */ e(xt, { className: "h-4 w-4", "aria-hidden": !0 })
499
499
  }
500
500
  ) : null,
501
- $ && R !== "D" ? /* @__PURE__ */ e(
502
- K,
503
- {
504
- variant: "ghost",
505
- size: "icon",
506
- "aria-label": D ? u.expandSidebar : u.collapseSidebar,
507
- className: "md:hidden",
508
- onClick: () => i((F) => !F),
509
- "data-testid": "rail-toggle-mobile",
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
- }
512
- ) : null,
513
- /* @__PURE__ */ e("div", { className: "min-w-0 justify-self-start", children: /* @__PURE__ */ e(je, { brand: a }) }),
514
- E ? /* @__PURE__ */ f(
501
+ /* @__PURE__ */ e("div", { className: "min-w-0 justify-self-start", children: /* @__PURE__ */ e(Re, { brand: a }) }),
502
+ R ? /* @__PURE__ */ f(
515
503
  "button",
516
504
  {
517
505
  type: "button",
@@ -521,7 +509,7 @@ function Qt(t) {
521
509
  children: [
522
510
  /* @__PURE__ */ e(yt, { className: "h-4 w-4", "aria-hidden": !0 }),
523
511
  /* @__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: j })
512
+ /* @__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: E })
525
513
  ]
526
514
  }
527
515
  ) : null,
@@ -538,7 +526,7 @@ function Qt(t) {
538
526
  "data-testid": "app-content",
539
527
  tabIndex: 0,
540
528
  className: "prui-shell-content min-h-0 flex-1 p-4 outline-none md:p-6",
541
- children: k ? /* @__PURE__ */ e(qt, { mode: k, config: x, children: g }) : g ?? /* @__PURE__ */ e(ht, {})
529
+ children: k ? /* @__PURE__ */ e(qt, { mode: k, config: x, children: g }) : g ?? /* @__PURE__ */ e(pt, {})
542
530
  }
543
531
  ),
544
532
  h ? /* @__PURE__ */ e(l.Suspense, { fallback: null, children: /* @__PURE__ */ e(
@@ -546,17 +534,17 @@ function Qt(t) {
546
534
  {
547
535
  timeout: h.sessionTimeout,
548
536
  warningTime: h.warningTime,
549
- onTimeout: B
537
+ onTimeout: K
550
538
  }
551
539
  ) }) : null,
552
- E ? /* @__PURE__ */ e(Gt, { open: S, onOpenChange: N, entries: L, placeholder: b.placeholder, onNavigate: c }) : null
540
+ R ? /* @__PURE__ */ e(Gt, { open: S, onOpenChange: N, entries: L, placeholder: b.placeholder, onNavigate: c }) : null
553
541
  ]
554
542
  }
555
543
  );
556
544
  }
557
545
  function Rr(t) {
558
546
  const { router: a = "browser", initialEntries: n } = t;
559
- return /* @__PURE__ */ e(a === "memory" ? pt : ft, { initialEntries: n, children: /* @__PURE__ */ e(Qt, { ...t }) });
547
+ return /* @__PURE__ */ e(a === "memory" ? dt : mt, { initialEntries: n, children: /* @__PURE__ */ e(Qt, { ...t }) });
560
548
  }
561
549
  const Er = {
562
550
  name: "App",
@@ -585,7 +573,7 @@ function er(t) {
585
573
  if (t)
586
574
  return t.map((a) => typeof a == "string" || typeof a == "number" ? { label: String(a), value: String(a) } : a);
587
575
  }
588
- function Me(t, a) {
576
+ function Ee(t, a) {
589
577
  const n = {};
590
578
  for (const r of t.fields)
591
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] = "";
@@ -602,11 +590,11 @@ function tr({
602
590
  error: T,
603
591
  className: k
604
592
  }) {
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);
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);
606
594
  l.useEffect(() => {
607
- P(Me(y, R));
608
- }, [JSON.stringify(y), JSON.stringify(R ?? {})]);
609
- const z = (i, S) => {
595
+ P(Ee(y, M));
596
+ }, [JSON.stringify(y), JSON.stringify(M ?? {})]);
597
+ const A = (i, S) => {
610
598
  P((N) => ({ ...N, [i]: S })), u((N) => {
611
599
  if (!N[i]) return N;
612
600
  const p = { ...N };
@@ -625,17 +613,17 @@ function tr({
625
613
  c && (S[p.name] = c);
626
614
  }
627
615
  if (u(S), !(Object.keys(S).length > 0)) {
628
- E(null);
616
+ R(null);
629
617
  try {
630
618
  const p = r == null ? void 0 : r({ ...w });
631
619
  p && typeof p.then == "function" && ($(!0), await p);
632
620
  } catch (p) {
633
- E(p instanceof Error ? p.message : String(p));
621
+ R(p instanceof Error ? p.message : String(p));
634
622
  } finally {
635
623
  $(!1);
636
624
  }
637
625
  }
638
- }, v = d || j;
626
+ }, v = d || E;
639
627
  return /* @__PURE__ */ f("form", { onSubmit: O, className: C("prui-form flex flex-col gap-4", k), noValidate: !0, children: [
640
628
  /* @__PURE__ */ e("div", { className: C("grid gap-4", y.columns === 2 && "md:grid-cols-2"), children: y.fields.map((i) => {
641
629
  const S = g[i.name], N = {
@@ -655,17 +643,17 @@ function tr({
655
643
  placeholder: i.placeholder,
656
644
  disabled: i.disabled || v,
657
645
  value: String(w[i.name] ?? ""),
658
- onChange: (p) => z(i.name, p.target.value)
646
+ onChange: (p) => A(i.name, p.target.value)
659
647
  }
660
648
  ) : i.type === "select" ? /* @__PURE__ */ e(
661
- Ie,
649
+ $e,
662
650
  {
663
651
  ...N,
664
652
  options: er(i.options),
665
653
  placeholder: i.placeholder,
666
654
  disabled: i.disabled || v,
667
655
  value: String(w[i.name] ?? ""),
668
- onChange: (p) => z(i.name, p)
656
+ onChange: (p) => A(i.name, p)
669
657
  }
670
658
  ) : i.type === "date" ? /* @__PURE__ */ e(
671
659
  ie,
@@ -675,15 +663,15 @@ function tr({
675
663
  placeholder: i.placeholder,
676
664
  disabled: i.disabled || v,
677
665
  value: String(w[i.name] ?? ""),
678
- onChange: (p) => z(i.name, p.target.value)
666
+ onChange: (p) => A(i.name, p.target.value)
679
667
  }
680
668
  ) : i.type === "boolean" ? /* @__PURE__ */ e(
681
- Le,
669
+ Fe,
682
670
  {
683
671
  ...N,
684
672
  disabled: i.disabled || v,
685
673
  checked: !!w[i.name],
686
- onChange: (p) => z(i.name, p)
674
+ onChange: (p) => A(i.name, p)
687
675
  }
688
676
  ) : /* @__PURE__ */ e(
689
677
  ie,
@@ -693,7 +681,7 @@ function tr({
693
681
  placeholder: i.placeholder,
694
682
  disabled: i.disabled || v,
695
683
  value: String(w[i.name] ?? ""),
696
- onChange: (p) => z(i.name, i.type === "number" ? p.target.value === "" ? "" : Number(p.target.value) : p.target.value)
684
+ onChange: (p) => A(i.name, i.type === "number" ? p.target.value === "" ? "" : Number(p.target.value) : p.target.value)
697
685
  }
698
686
  ),
699
687
  S ? /* @__PURE__ */ e("p", { id: `prui-form-${i.name}-error`, role: "alert", className: "text-xs text-[var(--prui-danger)]", children: S }) : null
@@ -701,8 +689,8 @@ function tr({
701
689
  }) }),
702
690
  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
691
  /* @__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: m ?? x.cancel }) : null,
705
- /* @__PURE__ */ e(K, { type: "submit", variant: "primary", loading: v, children: y.submitLabel ?? "Submit" })
692
+ o ? /* @__PURE__ */ e(B, { type: "button", variant: "ghost", onClick: o, disabled: v, children: m ?? x.cancel }) : null,
693
+ /* @__PURE__ */ e(B, { type: "submit", variant: "primary", loading: v, children: y.submitLabel ?? "Submit" })
706
694
  ] })
707
695
  ] });
708
696
  }
@@ -717,7 +705,7 @@ const jr = {
717
705
  { name: "error", type: "string | null", default: "null", control: "text" }
718
706
  ]
719
707
  };
720
- function He(t) {
708
+ function _e(t) {
721
709
  if (t)
722
710
  return t.map((a) => typeof a == "string" || typeof a == "number" ? { label: String(a), value: String(a) } : a);
723
711
  }
@@ -728,7 +716,7 @@ function rr(t, a) {
728
716
  name: r.key,
729
717
  label: typeof r.label == "string" ? r.label : r.key,
730
718
  type: ar(r, a),
731
- options: (o = He(r.filterOptions ?? r.options)) == null ? void 0 : o.map((m) => ({ label: m.label, value: m.value })),
719
+ options: (o = _e(r.filterOptions ?? r.options)) == null ? void 0 : o.map((m) => ({ label: m.label, value: m.value })),
732
720
  required: !1
733
721
  };
734
722
  }), submitLabel: a ? "Save" : "Create" };
@@ -748,16 +736,16 @@ function Mr({
748
736
  form: k,
749
737
  formSchema: x,
750
738
  rowKey: y,
751
- searchPlaceholder: R,
739
+ searchPlaceholder: M,
752
740
  pageSize: w,
753
741
  state: P,
754
742
  defaultState: g,
755
743
  onStateChange: u,
756
744
  onPageChange: b,
757
- onFilterChange: E,
758
- onSortChange: j,
745
+ onFilterChange: R,
746
+ onSortChange: E,
759
747
  onSearchChange: $,
760
- onPageSizeChange: z,
748
+ onPageSizeChange: A,
761
749
  onSelectionChange: O,
762
750
  selectable: v,
763
751
  renderExpandedRow: i,
@@ -765,7 +753,7 @@ function Mr({
765
753
  searchDebounce: N = 250,
766
754
  className: p
767
755
  }) {
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(
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(
769
757
  () => ({
770
758
  page: 1,
771
759
  pageSize: w ?? (g == null ? void 0 : g.pageSize) ?? 20,
@@ -780,63 +768,63 @@ function Mr({
780
768
  ), [Y, re] = l.useState(V), ae = l.useMemo(
781
769
  () => ({ ...Y, ...Object.fromEntries(Object.entries(P ?? {}).filter(([, s]) => s !== void 0)) }),
782
770
  [Y, P]
783
- ), D = l.useCallback(
771
+ ), z = l.useCallback(
784
772
  (s) => {
785
- re((A) => {
786
- const U = { ...A }, X = P;
787
- for (const [G, ct] of Object.entries(s))
788
- X && G in X && X[G] !== void 0 || (U[G] = ct);
773
+ re((D) => {
774
+ const U = { ...D }, X = P;
775
+ for (const [G, it] of Object.entries(s))
776
+ X && G in X && X[G] !== void 0 || (U[G] = it);
789
777
  const te = { ...U, ...Object.fromEntries(Object.entries(P ?? {}).filter(([, G]) => G !== void 0)) };
790
778
  return u == null || u(te), U;
791
779
  });
792
780
  },
793
781
  [P, u]
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);
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);
795
783
  l.useEffect(() => {
796
- const s = setTimeout(() => Ze(I), N);
784
+ const s = setTimeout(() => Ge(F), N);
797
785
  return () => clearTimeout(s);
798
- }, [I, N]);
799
- const ge = Xe[F - 1] ?? null, xe = JSON.stringify(q), Q = l.useCallback(async () => {
786
+ }, [F, N]);
787
+ const ge = Ye[I - 1] ?? null, xe = JSON.stringify(q), Q = l.useCallback(async () => {
800
788
  me(!0), fe(null);
801
789
  try {
802
- const s = await n({ search: le, cursor: ge, pageSize: M, sort: ne, filters: q });
790
+ const s = await n({ search: le, cursor: ge, pageSize: j, sort: ne, filters: q });
803
791
  oe(s.rows), ue(s.nextCursor ?? s.cursor ?? null);
804
792
  } catch (s) {
805
793
  fe(s instanceof Error ? s.message : String(s)), oe([]), ue(null);
806
794
  } finally {
807
795
  me(!1);
808
796
  }
809
- }, [le, ge, M, ne, xe, n]);
797
+ }, [le, ge, j, ne, xe, n]);
810
798
  l.useEffect(() => {
811
799
  Q();
812
800
  }, [Q]), l.useEffect(() => {
813
- D({ page: 1 }), de([null]);
814
- }, [le, M, xe]);
815
- const et = l.useMemo(
801
+ z({ page: 1 }), de([null]);
802
+ }, [le, j, xe]);
803
+ const Qe = l.useMemo(
816
804
  () => a.filter((s) => s.filter).map((s) => ({
817
805
  key: s.key,
818
806
  label: typeof s.label == "string" ? s.label : s.key,
819
807
  type: s.filter === "numberrange" ? "number" : s.filter,
820
- options: He(s.filterOptions ?? s.options)
808
+ options: _e(s.filterOptions ?? s.options)
821
809
  })),
822
810
  [a]
823
- ), tt = (s, A) => {
824
- const U = { ...q, [s]: A };
825
- D({ filters: U }), E == null || E(U);
826
- }, rt = (s) => {
827
- D({ search: s }), $ == null || $(s);
828
- }, at = (s) => {
829
- D({ sort: s }), j == null || j(s);
830
- }, nt = (s, A) => {
831
- if (A === "next") {
811
+ ), Ze = (s, D) => {
812
+ const U = { ...q, [s]: D };
813
+ z({ filters: U }), R == null || R(U);
814
+ }, et = (s) => {
815
+ z({ search: s }), $ == null || $(s);
816
+ }, tt = (s) => {
817
+ z({ sort: s }), E == null || E(s);
818
+ }, rt = (s, D) => {
819
+ if (D === "next") {
832
820
  const U = ce;
833
821
  de((X) => {
834
822
  const te = [...X];
835
823
  return te[s - 1] = U, te;
836
824
  });
837
825
  }
838
- D({ page: s }), b == null || b(s);
839
- }, lt = l.useMemo(
826
+ z({ page: s }), b == null || b(s);
827
+ }, at = l.useMemo(
840
828
  () => [
841
829
  ...a.filter((s) => !s.hidden),
842
830
  ...L("edit") || L("delete") ? [
@@ -845,13 +833,13 @@ function Mr({
845
833
  label: "",
846
834
  align: "right",
847
835
  render: (s) => /* @__PURE__ */ f("div", { className: "flex items-center justify-end gap-1", children: [
848
- L("edit") ? /* @__PURE__ */ e(K, { variant: "ghost", size: "icon", "aria-label": "Edit", onClick: () => {
849
- var A;
850
- return (A = Z.current) == null ? void 0 : A.call(Z, s);
836
+ L("edit") ? /* @__PURE__ */ e(B, { variant: "ghost", size: "icon", "aria-label": "Edit", onClick: () => {
837
+ var D;
838
+ return (D = Z.current) == null ? void 0 : D.call(Z, s);
851
839
  }, "data-testid": "resource-edit", children: /* @__PURE__ */ e(kt, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) }) : null,
852
- L("delete") ? /* @__PURE__ */ e(K, { variant: "ghost", size: "icon", "aria-label": "Delete", disabled: be, onClick: () => {
853
- var A;
854
- return void ((A = ee.current) == null ? void 0 : A.call(ee, s));
840
+ L("delete") ? /* @__PURE__ */ e(B, { variant: "ghost", size: "icon", "aria-label": "Delete", disabled: be, onClick: () => {
841
+ var D;
842
+ return void ((D = ee.current) == null ? void 0 : D.call(ee, s));
855
843
  }, "data-testid": "resource-delete", children: /* @__PURE__ */ e(St, { className: "h-3.5 w-3.5 text-[var(--prui-danger)]", "aria-hidden": !0 }) }) : null
856
844
  ] })
857
845
  }
@@ -859,7 +847,7 @@ function Mr({
859
847
  ],
860
848
  // eslint-disable-next-line react-hooks/exhaustive-deps -- can() depends only on the action functions
861
849
  [a, r, o, h, be]
862
- ), st = () => {
850
+ ), nt = () => {
863
851
  he(null), W(!0);
864
852
  }, ye = (s) => {
865
853
  he(s), W(!0);
@@ -882,10 +870,10 @@ function Mr({
882
870
  Z.current = ye;
883
871
  const ee = l.useRef(we);
884
872
  ee.current = we;
885
- const it = l.useCallback(
886
- (s, A) => String(y ? y(s, A) : s.id ?? A),
873
+ const lt = l.useCallback(
874
+ (s, D) => String(y ? y(s, D) : s.id ?? D),
887
875
  [y]
888
- ), Ne = x ?? rr(a, _), ot = _ ? Object.fromEntries(
876
+ ), Ne = x ?? rr(a, _), st = _ ? Object.fromEntries(
889
877
  Ne.fields.map((s) => [s.name, _[s.name] ?? ""])
890
878
  ) : void 0, H = t.replace(/s$/, "");
891
879
  return /* @__PURE__ */ f("div", { className: C("prui-resource flex flex-col gap-2", p), "data-testid": "resource", children: [
@@ -893,13 +881,13 @@ function Mr({
893
881
  /* @__PURE__ */ e(
894
882
  It,
895
883
  {
896
- searchPlaceholder: R ?? c.searchEntity.replace("{name}", t),
897
- searchValue: I,
898
- onSearchChange: rt,
899
- filters: et,
884
+ searchPlaceholder: M ?? c.searchEntity.replace("{name}", t),
885
+ searchValue: F,
886
+ onSearchChange: et,
887
+ filters: Qe,
900
888
  filterValues: q,
901
- onFilterChange: tt,
902
- actions: L("create") ? /* @__PURE__ */ f(K, { variant: "primary", size: "sm", onClick: st, "data-testid": "resource-create", children: [
889
+ onFilterChange: Ze,
890
+ actions: L("create") ? /* @__PURE__ */ f(B, { variant: "primary", size: "sm", onClick: nt, "data-testid": "resource-create", children: [
903
891
  /* @__PURE__ */ e(Tt, { className: "h-4 w-4", "aria-hidden": !0 }),
904
892
  c.newEntity.replace("{name}", H)
905
893
  ] }) : void 0
@@ -909,43 +897,43 @@ function Mr({
909
897
  /* @__PURE__ */ e(
910
898
  Lt,
911
899
  {
912
- columns: lt,
913
- rows: We,
914
- rowKey: it,
900
+ columns: at,
901
+ rows: Je,
902
+ rowKey: lt,
915
903
  sort: ne,
916
- onSortChange: at,
917
- loading: Ge,
904
+ onSortChange: tt,
905
+ loading: We,
918
906
  selectable: v,
919
- selectedRowKeys: Je,
920
- onSelectionChange: (s, A) => {
921
- D({ selection: s }), O == null || O(s, A);
907
+ selectedRowKeys: qe,
908
+ onSelectionChange: (s, D) => {
909
+ z({ selection: s }), O == null || O(s, D);
922
910
  },
923
911
  renderExpandedRow: i,
924
- expandedRowKeys: Ye,
925
- onExpandedRowsChange: (s) => D({ expandedRows: s }),
912
+ expandedRowKeys: He,
913
+ onExpandedRowsChange: (s) => z({ expandedRows: s }),
926
914
  virtualized: S
927
915
  }
928
916
  ),
929
917
  /* @__PURE__ */ e(
930
918
  Kt,
931
919
  {
932
- page: F,
933
- pageSize: M,
920
+ page: I,
921
+ pageSize: j,
934
922
  hasNextPage: ce != null,
935
- hasPreviousPage: F > 1,
936
- onPageChange: nt,
923
+ hasPreviousPage: I > 1,
924
+ onPageChange: rt,
937
925
  onPageSizeChange: (s) => {
938
- D({ pageSize: s }), z == null || z(s);
926
+ z({ pageSize: s }), A == null || A(s);
939
927
  }
940
928
  }
941
929
  ),
942
- /* @__PURE__ */ f(Fe, { open: Qe, onClose: () => W(!1), size: "sm", ariaLabel: _ ? c.editEntity.replace("{name}", H) : c.newEntity.replace("{name}", H), noPadding: !0, children: [
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: [
943
931
  /* @__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) }) }),
944
932
  /* @__PURE__ */ e("div", { className: "px-8 pb-8", children: k ?? /* @__PURE__ */ e(
945
933
  tr,
946
934
  {
947
935
  schema: Ne,
948
- initialValues: ot,
936
+ initialValues: st,
949
937
  onCancel: () => W(!1),
950
938
  onSubmit: async (s) => {
951
939
  _ ? await (o == null ? void 0 : o(_, s)) : await (r == null ? void 0 : r(s)), W(!1), await Q();
@@ -987,15 +975,15 @@ const Pr = {
987
975
  function Or({ items: t, className: a }) {
988
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) => {
989
977
  const o = n.icon;
990
- return /* @__PURE__ */ f(Ke, { "data-testid": "stat-card", children: [
991
- /* @__PURE__ */ f(Be, { className: "pb-2", children: [
992
- /* @__PURE__ */ f(Ue, { className: "flex items-center gap-1.5 text-xs", children: [
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: [
993
981
  o ? /* @__PURE__ */ e(o, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) : null,
994
982
  n.label
995
983
  ] }),
996
- /* @__PURE__ */ e(Ve, { className: "text-2xl", children: n.value })
984
+ /* @__PURE__ */ e(Be, { className: "text-2xl", children: n.value })
997
985
  ] }),
998
- n.delta ? /* @__PURE__ */ e(_e, { className: "pb-3", children: /* @__PURE__ */ e(
986
+ n.delta ? /* @__PURE__ */ e(Ue, { className: "pb-3", children: /* @__PURE__ */ e(
999
987
  "span",
1000
988
  {
1001
989
  className: C(
@@ -1026,7 +1014,7 @@ function lr({ field: t }) {
1026
1014
  if (!n || !a) return null;
1027
1015
  const m = `prui-settings-${a}`;
1028
1016
  return n === "switch" ? /* @__PURE__ */ e("label", { className: "flex items-center gap-2", htmlFor: m, children: /* @__PURE__ */ e(
1029
- Le,
1017
+ Fe,
1030
1018
  {
1031
1019
  id: m,
1032
1020
  checked: !!r,
@@ -1034,7 +1022,7 @@ function lr({ field: t }) {
1034
1022
  "aria-label": t.label
1035
1023
  }
1036
1024
  ) }) : n === "select" ? /* @__PURE__ */ e(
1037
- Ie,
1025
+ $e,
1038
1026
  {
1039
1027
  id: m,
1040
1028
  className: "w-56",
@@ -1067,12 +1055,12 @@ function Ar({ title: t = "Settings", sections: a, className: n }) {
1067
1055
  children: r.title ?? r.label ?? r.id
1068
1056
  }
1069
1057
  ) }, r.id)) }) }),
1070
- /* @__PURE__ */ e("div", { className: "flex min-w-0 flex-1 flex-col gap-4", children: a.map((r) => /* @__PURE__ */ f(Ke, { id: `settings-${r.id}`, "data-testid": "settings-section", children: [
1071
- /* @__PURE__ */ f(Be, { children: [
1072
- /* @__PURE__ */ e(Ve, { children: r.title ?? r.label ?? r.id }),
1073
- r.description ? /* @__PURE__ */ e(Ue, { children: r.description }) : null
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
1074
1062
  ] }),
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: [
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: [
1076
1064
  /* @__PURE__ */ f("div", { className: "min-w-0", children: [
1077
1065
  /* @__PURE__ */ e("dt", { className: "text-sm font-medium text-[var(--prui-fg)]", children: o.label }),
1078
1066
  o.description ? /* @__PURE__ */ e("dd", { className: "text-xs text-[var(--prui-dim)]", children: o.description }) : null
@@ -1089,7 +1077,7 @@ const zr = {
1089
1077
  { name: "title", type: "string", default: "'Settings'", control: "text" },
1090
1078
  { name: "sections", type: "SettingsSection[]", default: null, control: "object" }
1091
1079
  ]
1092
- }, Pe = ["mousedown", "keydown", "scroll", "touchstart", "click"];
1080
+ }, je = ["mousedown", "keydown", "scroll", "touchstart", "click"];
1093
1081
  function sr({
1094
1082
  timeout: t = 15,
1095
1083
  warningTime: a = 2,
@@ -1098,33 +1086,33 @@ function sr({
1098
1086
  title: o = "Session expiring soon",
1099
1087
  message: m = "Your session is about to expire due to inactivity."
1100
1088
  }) {
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(() => {
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(() => {
1102
1090
  for (const i of [w, P, g])
1103
1091
  i.current != null && (clearInterval(i.current), clearTimeout(i.current), i.current = null);
1104
- }, []), E = l.useCallback(() => {
1092
+ }, []), R = l.useCallback(() => {
1105
1093
  b(), x(!1), n == null || n();
1106
- }, [b, n]), j = l.useCallback(() => {
1094
+ }, [b, n]), E = l.useCallback(() => {
1107
1095
  b(), x(!1), u.current = !1, w.current = window.setTimeout(() => {
1108
- u.current = !0, R(T), x(!0), g.current = window.setInterval(() => {
1109
- R((i) => i <= 1e3 ? (E(), 0) : i - 1e3);
1096
+ u.current = !0, M(T), x(!0), g.current = window.setInterval(() => {
1097
+ M((i) => i <= 1e3 ? (R(), 0) : i - 1e3);
1110
1098
  }, 1e3);
1111
- }, d - T), P.current = window.setTimeout(E, d);
1112
- }, [b, E, d, T]);
1099
+ }, d - T), P.current = window.setTimeout(R, d);
1100
+ }, [b, R, d, T]);
1113
1101
  l.useEffect(() => {
1114
1102
  const i = () => {
1115
- u.current || j();
1103
+ u.current || E();
1116
1104
  };
1117
- for (const S of Pe) document.addEventListener(S, i, { passive: !0 });
1118
- return j(), () => {
1105
+ for (const S of je) document.addEventListener(S, i, { passive: !0 });
1106
+ return E(), () => {
1119
1107
  b();
1120
- for (const S of Pe) document.removeEventListener(S, i);
1108
+ for (const S of je) document.removeEventListener(S, i);
1121
1109
  };
1122
- }, [j, b]);
1110
+ }, [E, b]);
1123
1111
  const $ = () => {
1124
- r == null || r(), j();
1125
- }, z = Math.floor(y / 6e4), O = Math.floor(y % 6e4 / 1e3), v = `${z}:${String(O).padStart(2, "0")}`;
1112
+ r == null || r(), E();
1113
+ }, A = Math.floor(y / 6e4), O = Math.floor(y % 6e4 / 1e3), v = `${A}:${String(O).padStart(2, "0")}`;
1126
1114
  return /* @__PURE__ */ f(
1127
- Fe,
1115
+ ze,
1128
1116
  {
1129
1117
  open: k,
1130
1118
  onClose: $,
@@ -1138,8 +1126,8 @@ function sr({
1138
1126
  /* @__PURE__ */ e("div", { className: "py-4 font-mono text-4xl font-bold text-[var(--prui-fg)]", "data-testid": "session-countdown", children: v })
1139
1127
  ] }),
1140
1128
  /* @__PURE__ */ f("div", { className: "flex flex-col gap-2 px-8 pb-8 sm:flex-row", children: [
1141
- /* @__PURE__ */ e(K, { variant: "default", className: "flex-1", onClick: E, "data-testid": "session-logout", children: "Log out now" }),
1142
- /* @__PURE__ */ e(K, { variant: "primary", className: "flex-1", onClick: $, "data-testid": "session-extend", children: "Continue session" })
1129
+ /* @__PURE__ */ e(B, { variant: "default", className: "flex-1", onClick: R, "data-testid": "session-logout", children: "Log out now" }),
1130
+ /* @__PURE__ */ e(B, { variant: "primary", className: "flex-1", onClick: $, "data-testid": "session-extend", children: "Continue session" })
1143
1131
  ] })
1144
1132
  ]
1145
1133
  }
@@ -1195,7 +1183,7 @@ export {
1195
1183
  $r as b,
1196
1184
  qt as c,
1197
1185
  Ar as d,
1198
- Ee as e,
1186
+ Ce as e,
1199
1187
  Or as f,
1200
1188
  Er as g,
1201
1189
  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-a-3J0_PB.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-CAIorrrl.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.0",
3
+ "version": "0.10.1",
4
4
  "description": "PRUI component system: primitives, app-layer super-components, pages, and themes",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",