@skiddph/prui 0.10.0 → 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.
@@ -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 p, 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 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
+ 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 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
- 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
- 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
- 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" },
@@ -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(dt, { 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(mt, { 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), Re({ 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
- Re({ 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,33 +86,33 @@ 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
- 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
- }, [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) {
@@ -123,27 +123,27 @@ 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();
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(Ce(b, 1, h));
143
+ c.preventDefault(), N(Te(b, 1, h));
144
144
  break;
145
145
  case "ArrowUp":
146
- c.preventDefault(), N(Ce(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));
@@ -152,11 +152,11 @@ 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
  };
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
  {
@@ -177,10 +177,10 @@ 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" }),
183
- /* @__PURE__ */ f(
180
+ y && w ? ot(
181
+ /* @__PURE__ */ p(Me, { children: [
182
+ /* @__PURE__ */ e("div", { className: "fixed inset-0 z-[var(--prui-z-flyout)]", onClick: () => E(), "data-testid": "rail-flyout-backdrop" }),
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
- j(), 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(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: 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 qe({ 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(
252
- vt,
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
+ 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,46 +265,46 @@ 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 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(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: r, expandAllOn: n, collapsed: a }, m.href ?? m.label)) }) });
271
271
  }
272
- function je({ brand: t }) {
272
+ function ie({ brand: t }) {
273
273
  if (!t) return null;
274
- const a = /* @__PURE__ */ f(Oe, { 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(bt, { 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), 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 = 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
- const { ref: P } = ze({
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
- 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",
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",
@@ -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) => {
@@ -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 = {},
@@ -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 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
- ), 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]);
401
- const V = l.useRef(p.pathname);
399
+ return document.addEventListener("keydown", I), () => document.removeEventListener("keydown", I);
400
+ }, [E, R]);
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]);
405
- const Y = l.useRef(null), { ref: re } = ze({
406
- open: z,
403
+ V.current !== f.pathname && (V.current = f.pathname, O(!1));
404
+ }, [f.pathname]);
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";
410
- return /* @__PURE__ */ f(
409
+ }), ae = d.width ?? 240, z = !v && M !== "D";
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)]",
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
- /* @__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 }) }),
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
  {
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__ */ 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,38 +456,41 @@ 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(Ee, { 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
  )
474
477
  ] }) }) : null,
475
- R === "C" ? /* @__PURE__ */ e(
478
+ M === "C" ? /* @__PURE__ */ e(
476
479
  "div",
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(je, { 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",
487
490
  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
491
  children: [
489
492
  $ ? /* @__PURE__ */ e(
490
- K,
493
+ B,
491
494
  {
492
495
  variant: "ghost",
493
496
  size: "icon",
@@ -498,20 +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
- $ && 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(
504
+ /* @__PURE__ */ e("div", { className: "min-w-0 justify-self-start", children: /* @__PURE__ */ e(ie, { brand: r }) }),
505
+ R ? /* @__PURE__ */ p(
515
506
  "button",
516
507
  {
517
508
  type: "button",
@@ -521,11 +512,11 @@ function Qt(t) {
521
512
  children: [
522
513
  /* @__PURE__ */ e(yt, { className: "h-4 w-4", "aria-hidden": !0 }),
523
514
  /* @__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 })
515
+ /* @__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
516
  ]
526
517
  }
527
518
  ) : null,
528
- /* @__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: [
529
520
  T,
530
521
  /* @__PURE__ */ e(Yt, { config: o })
531
522
  ] })
@@ -538,7 +529,7 @@ function Qt(t) {
538
529
  "data-testid": "app-content",
539
530
  tabIndex: 0,
540
531
  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, {})
532
+ children: k ? /* @__PURE__ */ e(qt, { mode: k, config: x, children: g }) : g ?? /* @__PURE__ */ e(pt, {})
542
533
  }
543
534
  ),
544
535
  h ? /* @__PURE__ */ e(l.Suspense, { fallback: null, children: /* @__PURE__ */ e(
@@ -546,17 +537,17 @@ function Qt(t) {
546
537
  {
547
538
  timeout: h.sessionTimeout,
548
539
  warningTime: h.warningTime,
549
- onTimeout: B
540
+ onTimeout: K
550
541
  }
551
542
  ) }) : null,
552
- E ? /* @__PURE__ */ e(Gt, { open: S, onOpenChange: N, entries: L, placeholder: b.placeholder, onNavigate: c }) : null
543
+ R ? /* @__PURE__ */ e(Gt, { open: S, onOpenChange: N, entries: L, placeholder: b.placeholder, onNavigate: c }) : null
553
544
  ]
554
545
  }
555
546
  );
556
547
  }
557
548
  function Rr(t) {
558
- const { router: a = "browser", initialEntries: n } = t;
559
- return /* @__PURE__ */ e(a === "memory" ? pt : ft, { 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 }) });
560
551
  }
561
552
  const Er = {
562
553
  name: "App",
@@ -583,68 +574,68 @@ function Zt(t) {
583
574
  }
584
575
  function er(t) {
585
576
  if (t)
586
- 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);
587
578
  }
588
- function Me(t, a) {
579
+ function Ee(t, r) {
589
580
  const n = {};
590
- for (const r of t.fields)
591
- a && r.name in a ? n[r.name] = a[r.name] : r.defaultValue !== void 0 ? n[r.name] = r.defaultValue : r.type === "boolean" ? n[r.name] = !1 : n[r.name] = "";
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] = "";
592
583
  return n;
593
584
  }
594
585
  function tr({
595
586
  schema: t,
596
- initialValues: a,
587
+ initialValues: r,
597
588
  defaultValues: n,
598
- onSubmit: r,
589
+ onSubmit: a,
599
590
  onCancel: o,
600
591
  cancelLabel: m,
601
592
  submitting: d = !1,
602
593
  error: T,
603
594
  className: k
604
595
  }) {
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);
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);
606
597
  l.useEffect(() => {
607
- P(Me(y, R));
608
- }, [JSON.stringify(y), JSON.stringify(R ?? {})]);
609
- const z = (i, S) => {
598
+ P(Ee(y, M));
599
+ }, [JSON.stringify(y), JSON.stringify(M ?? {})]);
600
+ const A = (i, S) => {
610
601
  P((N) => ({ ...N, [i]: S })), u((N) => {
611
602
  if (!N[i]) return N;
612
- const p = { ...N };
613
- return delete p[i], p;
603
+ const f = { ...N };
604
+ return delete f[i], f;
614
605
  });
615
606
  }, O = async (i) => {
616
607
  var N;
617
608
  i.preventDefault();
618
609
  const S = {};
619
- for (const p of y.fields) {
620
- if (p.required) {
621
- const h = w[p.name];
622
- (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));
623
614
  }
624
- const c = (N = p.validate) == null ? void 0 : N.call(p, w[p.name], w);
625
- 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);
626
617
  }
627
618
  if (u(S), !(Object.keys(S).length > 0)) {
628
- E(null);
619
+ R(null);
629
620
  try {
630
- const p = r == null ? void 0 : r({ ...w });
631
- p && typeof p.then == "function" && ($(!0), await p);
632
- } catch (p) {
633
- E(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));
634
625
  } finally {
635
626
  $(!1);
636
627
  }
637
628
  }
638
- }, v = d || j;
639
- return /* @__PURE__ */ f("form", { onSubmit: O, className: C("prui-form flex flex-col gap-4", k), noValidate: !0, children: [
629
+ }, v = d || E;
630
+ return /* @__PURE__ */ p("form", { onSubmit: O, className: C("prui-form flex flex-col gap-4", k), noValidate: !0, children: [
640
631
  /* @__PURE__ */ e("div", { className: C("grid gap-4", y.columns === 2 && "md:grid-cols-2"), children: y.fields.map((i) => {
641
632
  const S = g[i.name], N = {
642
633
  id: `prui-form-${i.name}`,
643
634
  "aria-invalid": S ? !0 : void 0,
644
635
  "aria-describedby": S ? `prui-form-${i.name}-error` : void 0
645
636
  };
646
- return /* @__PURE__ */ f("div", { className: C("flex flex-col gap-1.5", i.colSpan === 2 && "md:col-span-2", i.className), children: [
647
- /* @__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: [
648
639
  i.label,
649
640
  i.required ? /* @__PURE__ */ e("span", { className: "ml-0.5 text-[var(--prui-danger)]", children: "*" }) : null
650
641
  ] }),
@@ -655,54 +646,54 @@ function tr({
655
646
  placeholder: i.placeholder,
656
647
  disabled: i.disabled || v,
657
648
  value: String(w[i.name] ?? ""),
658
- onChange: (p) => z(i.name, p.target.value)
649
+ onChange: (f) => A(i.name, f.target.value)
659
650
  }
660
651
  ) : i.type === "select" ? /* @__PURE__ */ e(
661
- Ie,
652
+ $e,
662
653
  {
663
654
  ...N,
664
655
  options: er(i.options),
665
656
  placeholder: i.placeholder,
666
657
  disabled: i.disabled || v,
667
658
  value: String(w[i.name] ?? ""),
668
- onChange: (p) => z(i.name, p)
659
+ onChange: (f) => A(i.name, f)
669
660
  }
670
661
  ) : i.type === "date" ? /* @__PURE__ */ e(
671
- ie,
662
+ oe,
672
663
  {
673
664
  ...N,
674
665
  type: "date",
675
666
  placeholder: i.placeholder,
676
667
  disabled: i.disabled || v,
677
668
  value: String(w[i.name] ?? ""),
678
- onChange: (p) => z(i.name, p.target.value)
669
+ onChange: (f) => A(i.name, f.target.value)
679
670
  }
680
671
  ) : i.type === "boolean" ? /* @__PURE__ */ e(
681
- Le,
672
+ Fe,
682
673
  {
683
674
  ...N,
684
675
  disabled: i.disabled || v,
685
676
  checked: !!w[i.name],
686
- onChange: (p) => z(i.name, p)
677
+ onChange: (f) => A(i.name, f)
687
678
  }
688
679
  ) : /* @__PURE__ */ e(
689
- ie,
680
+ oe,
690
681
  {
691
682
  ...N,
692
683
  type: i.type ?? "text",
693
684
  placeholder: i.placeholder,
694
685
  disabled: i.disabled || v,
695
686
  value: String(w[i.name] ?? ""),
696
- onChange: (p) => z(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)
697
688
  }
698
689
  ),
699
690
  S ? /* @__PURE__ */ e("p", { id: `prui-form-${i.name}-error`, role: "alert", className: "text-xs text-[var(--prui-danger)]", children: S }) : null
700
691
  ] }, i.name);
701
692
  }) }),
702
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,
703
- /* @__PURE__ */ f("div", { className: "flex items-center justify-end gap-2", children: [
704
- o ? /* @__PURE__ */ e(K, { type: "button", variant: "ghost", onClick: o, disabled: v, children: m ?? x.cancel }) : null,
705
- /* @__PURE__ */ e(K, { type: "submit", variant: "primary", loading: v, children: y.submitLabel ?? "Submit" })
694
+ /* @__PURE__ */ p("div", { className: "flex items-center justify-end gap-2", children: [
695
+ o ? /* @__PURE__ */ e(B, { type: "button", variant: "ghost", onClick: o, disabled: v, children: m ?? x.cancel }) : null,
696
+ /* @__PURE__ */ e(B, { type: "submit", variant: "primary", loading: v, children: y.submitLabel ?? "Submit" })
706
697
  ] })
707
698
  ] });
708
699
  }
@@ -717,30 +708,30 @@ const jr = {
717
708
  { name: "error", type: "string | null", default: "null", control: "text" }
718
709
  ]
719
710
  };
720
- function He(t) {
711
+ function _e(t) {
721
712
  if (t)
722
- 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);
723
714
  }
724
- function rr(t, a) {
725
- 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) => {
726
717
  var o;
727
718
  return {
728
- name: r.key,
729
- label: typeof r.label == "string" ? r.label : r.key,
730
- 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
+ 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 })),
732
723
  required: !1
733
724
  };
734
- }), submitLabel: a ? "Save" : "Create" };
725
+ }), submitLabel: r ? "Save" : "Create" };
735
726
  }
736
- function ar(t, a) {
737
- return t.filter === "select" ? "select" : typeof (a == null ? void 0 : a[t.key]) == "number" || t.filter === "number" || t.filter === "numberrange" || t.filter === "price" ? "number" : t.filter === "date" || t.filter === "daterange" ? "date" : "text";
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";
738
729
  }
739
730
  function Mr({
740
731
  name: t,
741
- columns: a,
732
+ columns: r,
742
733
  list: n,
743
- create: r,
734
+ create: a,
744
735
  update: o,
745
736
  remove: m,
746
737
  delete: d,
@@ -748,24 +739,24 @@ function Mr({
748
739
  form: k,
749
740
  formSchema: x,
750
741
  rowKey: y,
751
- searchPlaceholder: R,
742
+ searchPlaceholder: M,
752
743
  pageSize: w,
753
744
  state: P,
754
745
  defaultState: g,
755
746
  onStateChange: u,
756
747
  onPageChange: b,
757
- onFilterChange: E,
758
- onSortChange: j,
748
+ onFilterChange: R,
749
+ onSortChange: E,
759
750
  onSearchChange: $,
760
- onPageSizeChange: z,
751
+ onPageSizeChange: A,
761
752
  onSelectionChange: O,
762
753
  selectable: v,
763
754
  renderExpandedRow: i,
764
755
  virtualized: S,
765
756
  searchDebounce: N = 250,
766
- className: p
757
+ className: f
767
758
  }) {
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(
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(
769
760
  () => ({
770
761
  page: 1,
771
762
  pageSize: w ?? (g == null ? void 0 : g.pageSize) ?? 20,
@@ -780,90 +771,90 @@ function Mr({
780
771
  ), [Y, re] = l.useState(V), ae = l.useMemo(
781
772
  () => ({ ...Y, ...Object.fromEntries(Object.entries(P ?? {}).filter(([, s]) => s !== void 0)) }),
782
773
  [Y, P]
783
- ), D = l.useCallback(
774
+ ), z = l.useCallback(
784
775
  (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);
776
+ re((D) => {
777
+ const U = { ...D }, X = P;
778
+ for (const [G, it] of Object.entries(s))
779
+ X && G in X && X[G] !== void 0 || (U[G] = it);
789
780
  const te = { ...U, ...Object.fromEntries(Object.entries(P ?? {}).filter(([, G]) => G !== void 0)) };
790
781
  return u == null || u(te), U;
791
782
  });
792
783
  },
793
784
  [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);
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);
795
786
  l.useEffect(() => {
796
- const s = setTimeout(() => Ze(I), N);
787
+ const s = setTimeout(() => Ge(F), N);
797
788
  return () => clearTimeout(s);
798
- }, [I, N]);
799
- const ge = Xe[F - 1] ?? null, xe = JSON.stringify(q), Q = l.useCallback(async () => {
800
- me(!0), fe(null);
789
+ }, [F, N]);
790
+ const xe = Ye[I - 1] ?? null, ye = JSON.stringify(q), Q = l.useCallback(async () => {
791
+ pe(!0), he(null);
801
792
  try {
802
- const s = await n({ search: le, cursor: ge, pageSize: M, sort: ne, filters: q });
803
- 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);
804
795
  } catch (s) {
805
- fe(s instanceof Error ? s.message : String(s)), oe([]), ue(null);
796
+ he(s instanceof Error ? s.message : String(s)), ce([]), de(null);
806
797
  } finally {
807
- me(!1);
798
+ pe(!1);
808
799
  }
809
- }, [le, ge, M, ne, xe, n]);
800
+ }, [le, xe, j, ne, ye, n]);
810
801
  l.useEffect(() => {
811
802
  Q();
812
803
  }, [Q]), l.useEffect(() => {
813
- D({ page: 1 }), de([null]);
814
- }, [le, M, xe]);
815
- const et = l.useMemo(
816
- () => a.filter((s) => s.filter).map((s) => ({
804
+ z({ page: 1 }), me([null]);
805
+ }, [le, j, ye]);
806
+ const Qe = l.useMemo(
807
+ () => r.filter((s) => s.filter).map((s) => ({
817
808
  key: s.key,
818
809
  label: typeof s.label == "string" ? s.label : s.key,
819
810
  type: s.filter === "numberrange" ? "number" : s.filter,
820
- options: He(s.filterOptions ?? s.options)
811
+ options: _e(s.filterOptions ?? s.options)
821
812
  })),
822
- [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") {
832
- const U = ce;
833
- de((X) => {
813
+ [r]
814
+ ), Ze = (s, D) => {
815
+ const U = { ...q, [s]: D };
816
+ z({ filters: U }), R == null || R(U);
817
+ }, et = (s) => {
818
+ z({ search: s }), $ == null || $(s);
819
+ }, tt = (s) => {
820
+ z({ sort: s }), E == null || E(s);
821
+ }, rt = (s, D) => {
822
+ if (D === "next") {
823
+ const U = ue;
824
+ me((X) => {
834
825
  const te = [...X];
835
826
  return te[s - 1] = U, te;
836
827
  });
837
828
  }
838
- D({ page: s }), b == null || b(s);
839
- }, lt = l.useMemo(
829
+ z({ page: s }), b == null || b(s);
830
+ }, at = l.useMemo(
840
831
  () => [
841
- ...a.filter((s) => !s.hidden),
832
+ ...r.filter((s) => !s.hidden),
842
833
  ...L("edit") || L("delete") ? [
843
834
  {
844
835
  key: "actions",
845
836
  label: "",
846
837
  align: "right",
847
- 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);
838
+ render: (s) => /* @__PURE__ */ p("div", { className: "flex items-center justify-end gap-1", children: [
839
+ L("edit") ? /* @__PURE__ */ e(B, { variant: "ghost", size: "icon", "aria-label": "Edit", onClick: () => {
840
+ var D;
841
+ return (D = Z.current) == null ? void 0 : D.call(Z, s);
851
842
  }, "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));
843
+ L("delete") ? /* @__PURE__ */ e(B, { variant: "ghost", size: "icon", "aria-label": "Delete", disabled: ve, onClick: () => {
844
+ var D;
845
+ return void ((D = ee.current) == null ? void 0 : D.call(ee, s));
855
846
  }, "data-testid": "resource-delete", children: /* @__PURE__ */ e(St, { className: "h-3.5 w-3.5 text-[var(--prui-danger)]", "aria-hidden": !0 }) }) : null
856
847
  ] })
857
848
  }
858
849
  ] : []
859
850
  ],
860
851
  // eslint-disable-next-line react-hooks/exhaustive-deps -- can() depends only on the action functions
861
- [a, r, o, h, be]
862
- ), st = () => {
863
- he(null), W(!0);
864
- }, ye = (s) => {
865
- he(s), W(!0);
866
- }, we = async (s) => {
852
+ [r, a, o, h, ve]
853
+ ), nt = () => {
854
+ be(null), W(!0);
855
+ }, we = (s) => {
856
+ be(s), W(!0);
857
+ }, Ne = async (s) => {
867
858
  if (!(!await Ft({
868
859
  title: `${c.delete} ${H}?`,
869
860
  message: c.deleteConfirmMessage,
@@ -871,84 +862,84 @@ function Mr({
871
862
  cancelText: c.cancel,
872
863
  type: "danger"
873
864
  }) || !h)) {
874
- ve(!0);
865
+ ge(!0);
875
866
  try {
876
867
  await h(s), await Q();
877
868
  } finally {
878
- ve(!1);
869
+ ge(!1);
879
870
  }
880
871
  }
881
- }, Z = l.useRef(ye);
882
- Z.current = ye;
883
- const ee = l.useRef(we);
884
- ee.current = we;
885
- const it = l.useCallback(
886
- (s, A) => String(y ? y(s, A) : s.id ?? A),
872
+ }, Z = l.useRef(we);
873
+ Z.current = we;
874
+ const ee = l.useRef(Ne);
875
+ ee.current = Ne;
876
+ const lt = l.useCallback(
877
+ (s, D) => String(y ? y(s, D) : s.id ?? D),
887
878
  [y]
888
- ), Ne = x ?? rr(a, _), ot = _ ? Object.fromEntries(
889
- 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] ?? ""])
890
881
  ) : void 0, H = t.replace(/s$/, "");
891
- 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: [
892
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 }) }),
893
884
  /* @__PURE__ */ e(
894
885
  It,
895
886
  {
896
- searchPlaceholder: R ?? c.searchEntity.replace("{name}", t),
897
- searchValue: I,
898
- onSearchChange: rt,
899
- filters: et,
887
+ searchPlaceholder: M ?? c.searchEntity.replace("{name}", t),
888
+ searchValue: F,
889
+ onSearchChange: et,
890
+ filters: Qe,
900
891
  filterValues: q,
901
- onFilterChange: tt,
902
- actions: L("create") ? /* @__PURE__ */ f(K, { variant: "primary", size: "sm", onClick: st, "data-testid": "resource-create", children: [
892
+ onFilterChange: Ze,
893
+ actions: L("create") ? /* @__PURE__ */ p(B, { variant: "primary", size: "sm", onClick: nt, "data-testid": "resource-create", children: [
903
894
  /* @__PURE__ */ e(Tt, { className: "h-4 w-4", "aria-hidden": !0 }),
904
895
  c.newEntity.replace("{name}", H)
905
896
  ] }) : void 0
906
897
  }
907
898
  ),
908
- 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,
909
900
  /* @__PURE__ */ e(
910
901
  Lt,
911
902
  {
912
- columns: lt,
913
- rows: We,
914
- rowKey: it,
903
+ columns: at,
904
+ rows: Je,
905
+ rowKey: lt,
915
906
  sort: ne,
916
- onSortChange: at,
917
- loading: Ge,
907
+ onSortChange: tt,
908
+ loading: We,
918
909
  selectable: v,
919
- selectedRowKeys: Je,
920
- onSelectionChange: (s, A) => {
921
- D({ selection: s }), O == null || O(s, A);
910
+ selectedRowKeys: qe,
911
+ onSelectionChange: (s, D) => {
912
+ z({ selection: s }), O == null || O(s, D);
922
913
  },
923
914
  renderExpandedRow: i,
924
- expandedRowKeys: Ye,
925
- onExpandedRowsChange: (s) => D({ expandedRows: s }),
915
+ expandedRowKeys: He,
916
+ onExpandedRowsChange: (s) => z({ expandedRows: s }),
926
917
  virtualized: S
927
918
  }
928
919
  ),
929
920
  /* @__PURE__ */ e(
930
921
  Kt,
931
922
  {
932
- page: F,
933
- pageSize: M,
934
- hasNextPage: ce != null,
935
- hasPreviousPage: F > 1,
936
- onPageChange: nt,
923
+ page: I,
924
+ pageSize: j,
925
+ hasNextPage: ue != null,
926
+ hasPreviousPage: I > 1,
927
+ onPageChange: rt,
937
928
  onPageSizeChange: (s) => {
938
- D({ pageSize: s }), z == null || z(s);
929
+ z({ pageSize: s }), A == null || A(s);
939
930
  }
940
931
  }
941
932
  ),
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: [
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: [
943
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) }) }),
944
935
  /* @__PURE__ */ e("div", { className: "px-8 pb-8", children: k ?? /* @__PURE__ */ e(
945
936
  tr,
946
937
  {
947
- schema: Ne,
948
- initialValues: ot,
938
+ schema: ke,
939
+ initialValues: st,
949
940
  onCancel: () => W(!1),
950
941
  onSubmit: async (s) => {
951
- _ ? 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();
952
943
  }
953
944
  }
954
945
  ) })
@@ -984,18 +975,18 @@ const Pr = {
984
975
  { name: "searchDebounce", type: "number (ms)", default: "250", control: "number" }
985
976
  ]
986
977
  };
987
- function Or({ items: t, className: a }) {
988
- 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) => {
989
980
  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: [
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: [
993
984
  o ? /* @__PURE__ */ e(o, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) : null,
994
985
  n.label
995
986
  ] }),
996
- /* @__PURE__ */ e(Ve, { className: "text-2xl", children: n.value })
987
+ /* @__PURE__ */ e(Be, { className: "text-2xl", children: n.value })
997
988
  ] }),
998
- n.delta ? /* @__PURE__ */ e(_e, { className: "pb-3", children: /* @__PURE__ */ e(
989
+ n.delta ? /* @__PURE__ */ e(Ue, { className: "pb-3", children: /* @__PURE__ */ e(
999
990
  "span",
1000
991
  {
1001
992
  className: C(
@@ -1007,7 +998,7 @@ function Or({ items: t, className: a }) {
1007
998
  children: n.delta
1008
999
  }
1009
1000
  ) }) : null
1010
- ] }, `${n.label}-${r}`);
1001
+ ] }, `${n.label}-${a}`);
1011
1002
  }) });
1012
1003
  }
1013
1004
  const Dr = {
@@ -1019,67 +1010,67 @@ const Dr = {
1019
1010
  };
1020
1011
  function nr(t) {
1021
1012
  if (t)
1022
- 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);
1023
1014
  }
1024
1015
  function lr({ field: t }) {
1025
- const { name: a, type: n, value: r, onChange: o } = t;
1026
- if (!n || !a) return null;
1027
- 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}`;
1028
1019
  return n === "switch" ? /* @__PURE__ */ e("label", { className: "flex items-center gap-2", htmlFor: m, children: /* @__PURE__ */ e(
1029
- Le,
1020
+ Fe,
1030
1021
  {
1031
1022
  id: m,
1032
- checked: !!r,
1023
+ checked: !!a,
1033
1024
  onChange: (d) => o == null ? void 0 : o(d),
1034
1025
  "aria-label": t.label
1035
1026
  }
1036
1027
  ) }) : n === "select" ? /* @__PURE__ */ e(
1037
- Ie,
1028
+ $e,
1038
1029
  {
1039
1030
  id: m,
1040
1031
  className: "w-56",
1041
1032
  options: nr(t.options) ?? [],
1042
- value: String(r ?? ""),
1033
+ value: String(a ?? ""),
1043
1034
  onChange: (d) => o == null ? void 0 : o(Array.isArray(d) ? d.join(",") : d),
1044
1035
  "aria-label": t.label
1045
1036
  }
1046
1037
  ) : /* @__PURE__ */ e(
1047
- ie,
1038
+ oe,
1048
1039
  {
1049
1040
  id: m,
1050
1041
  type: n === "number" ? "number" : "text",
1051
1042
  className: "h-8 w-56",
1052
- value: String(r ?? ""),
1043
+ value: String(a ?? ""),
1053
1044
  onChange: (d) => o == null ? void 0 : o(n === "number" ? d.target.value === "" ? "" : Number(d.target.value) : d.target.value),
1054
1045
  "aria-label": t.label
1055
1046
  }
1056
1047
  );
1057
1048
  }
1058
- function Ar({ title: t = "Settings", sections: a, className: n }) {
1059
- 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: [
1060
1051
  /* @__PURE__ */ e("h1", { className: "text-xl font-semibold text-[var(--prui-fg)]", children: t }),
1061
- /* @__PURE__ */ f("div", { className: "flex flex-col gap-6 md:flex-row", children: [
1062
- /* @__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(
1063
1054
  "a",
1064
1055
  {
1065
- href: `#settings-${r.id}`,
1056
+ href: `#settings-${a.id}`,
1066
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)]",
1067
- children: r.title ?? r.label ?? r.id
1058
+ children: a.title ?? a.label ?? a.id
1068
1059
  }
1069
- ) }, 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
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
1074
1065
  ] }),
1075
- /* @__PURE__ */ e(_e, { children: r.content ?? /* @__PURE__ */ e("dl", { className: "flex flex-col divide-y divide-[var(--prui-line)]", children: (r.fields ?? []).map((o, m) => /* @__PURE__ */ f("div", { className: "flex flex-col gap-2 py-3 first:pt-0 last:pb-0 sm:flex-row sm:items-center sm:justify-between", children: [
1076
- /* @__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: [
1077
1068
  /* @__PURE__ */ e("dt", { className: "text-sm font-medium text-[var(--prui-fg)]", children: o.label }),
1078
1069
  o.description ? /* @__PURE__ */ e("dd", { className: "text-xs text-[var(--prui-dim)]", children: o.description }) : null
1079
1070
  ] }),
1080
1071
  /* @__PURE__ */ e("div", { className: "shrink-0", children: o.control ?? /* @__PURE__ */ e(lr, { field: o }) })
1081
1072
  ] }, `${o.label}-${m}`)) }) })
1082
- ] }, r.id)) })
1073
+ ] }, a.id)) })
1083
1074
  ] })
1084
1075
  ] });
1085
1076
  }
@@ -1089,57 +1080,57 @@ const zr = {
1089
1080
  { name: "title", type: "string", default: "'Settings'", control: "text" },
1090
1081
  { name: "sections", type: "SettingsSection[]", default: null, control: "object" }
1091
1082
  ]
1092
- }, Pe = ["mousedown", "keydown", "scroll", "touchstart", "click"];
1083
+ }, je = ["mousedown", "keydown", "scroll", "touchstart", "click"];
1093
1084
  function sr({
1094
1085
  timeout: t = 15,
1095
- warningTime: a = 2,
1086
+ warningTime: r = 2,
1096
1087
  onTimeout: n,
1097
- onExtend: r,
1088
+ onExtend: a,
1098
1089
  title: o = "Session expiring soon",
1099
1090
  message: m = "Your session is about to expire due to inactivity."
1100
1091
  }) {
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(() => {
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(() => {
1102
1093
  for (const i of [w, P, g])
1103
1094
  i.current != null && (clearInterval(i.current), clearTimeout(i.current), i.current = null);
1104
- }, []), E = l.useCallback(() => {
1095
+ }, []), R = l.useCallback(() => {
1105
1096
  b(), x(!1), n == null || n();
1106
- }, [b, n]), j = l.useCallback(() => {
1097
+ }, [b, n]), E = l.useCallback(() => {
1107
1098
  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);
1099
+ u.current = !0, M(T), x(!0), g.current = window.setInterval(() => {
1100
+ M((i) => i <= 1e3 ? (R(), 0) : i - 1e3);
1110
1101
  }, 1e3);
1111
- }, d - T), P.current = window.setTimeout(E, d);
1112
- }, [b, E, d, T]);
1102
+ }, d - T), P.current = window.setTimeout(R, d);
1103
+ }, [b, R, d, T]);
1113
1104
  l.useEffect(() => {
1114
1105
  const i = () => {
1115
- u.current || j();
1106
+ u.current || E();
1116
1107
  };
1117
- for (const S of Pe) document.addEventListener(S, i, { passive: !0 });
1118
- return j(), () => {
1108
+ for (const S of je) document.addEventListener(S, i, { passive: !0 });
1109
+ return E(), () => {
1119
1110
  b();
1120
- for (const S of Pe) document.removeEventListener(S, i);
1111
+ for (const S of je) document.removeEventListener(S, i);
1121
1112
  };
1122
- }, [j, b]);
1113
+ }, [E, b]);
1123
1114
  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")}`;
1126
- return /* @__PURE__ */ f(
1127
- Fe,
1115
+ a == null || a(), E();
1116
+ }, A = Math.floor(y / 6e4), O = Math.floor(y % 6e4 / 1e3), v = `${A}:${String(O).padStart(2, "0")}`;
1117
+ return /* @__PURE__ */ p(
1118
+ ze,
1128
1119
  {
1129
1120
  open: k,
1130
1121
  onClose: $,
1131
1122
  size: "sm",
1132
1123
  ariaLabel: o,
1133
1124
  children: [
1134
- /* @__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: [
1135
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 }) }),
1136
1127
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: o }),
1137
1128
  /* @__PURE__ */ e("p", { className: "text-sm text-[var(--prui-dim)]", children: m }),
1138
1129
  /* @__PURE__ */ e("div", { className: "py-4 font-mono text-4xl font-bold text-[var(--prui-fg)]", "data-testid": "session-countdown", children: v })
1139
1130
  ] }),
1140
- /* @__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" })
1131
+ /* @__PURE__ */ p("div", { className: "flex flex-col gap-2 px-8 pb-8 sm:flex-row", children: [
1132
+ /* @__PURE__ */ e(B, { variant: "default", className: "flex-1", onClick: R, "data-testid": "session-logout", children: "Log out now" }),
1133
+ /* @__PURE__ */ e(B, { variant: "primary", className: "flex-1", onClick: $, "data-testid": "session-extend", children: "Continue session" })
1143
1134
  ] })
1144
1135
  ]
1145
1136
  }
@@ -1158,16 +1149,16 @@ const ir = {
1158
1149
  SessionTimeout: sr,
1159
1150
  sessionTimeoutPropsMeta: ir
1160
1151
  }, Symbol.toStringTag, { value: "Module" }));
1161
- function $r({ title: t, description: a, brand: n, width: r = "max-w-sm", footer: o, children: m, className: d }) {
1162
- return /* @__PURE__ */ e("div", { className: C("prui-auth-shell flex min-h-[100dvh] items-center justify-center bg-[var(--prui-background)] p-4", d), "data-testid": "auth-shell", children: /* @__PURE__ */ f("div", { className: C("w-full", r), children: [
1163
- 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: [
1164
1155
  n.mark ? /* @__PURE__ */ e("img", { src: n.mark, alt: "", className: "h-8 w-8 rounded-[var(--prui-radius-1)] object-cover" }) : null,
1165
1156
  /* @__PURE__ */ e("span", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: n.name })
1166
1157
  ] }) : null,
1167
- /* @__PURE__ */ f("div", { className: "rounded-[var(--prui-radius)] border border-[var(--prui-line)] bg-[var(--prui-surface)] p-6", children: [
1168
- /* @__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: [
1169
1160
  /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: t }),
1170
- 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
1171
1162
  ] }),
1172
1163
  m,
1173
1164
  o ? /* @__PURE__ */ e("div", { className: "mt-4 text-center text-sm text-[var(--prui-dim)]", children: o }) : null
@@ -1195,7 +1186,7 @@ export {
1195
1186
  $r as b,
1196
1187
  qt as c,
1197
1188
  Ar as d,
1198
- Ee as e,
1189
+ Re as e,
1199
1190
  Or as f,
1200
1191
  Er as g,
1201
1192
  Fr as h,