@pixstella/components 0.3.0 → 0.3.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.
Files changed (38) hide show
  1. package/COPY-PASTE.md +109 -0
  2. package/README.md +9 -75
  3. package/dist/app/components/Dashboard/dashboardRegistry.cjs +1 -1
  4. package/dist/app/components/Dashboard/dashboardRegistry.mjs +202 -201
  5. package/dist/app/components/Table/DataTable.cjs +1 -1
  6. package/dist/app/components/Table/DataTable.mjs +46 -49
  7. package/dist/app/components/ai/ConfidenceSuggestions/ConfidenceSuggestions.cjs +1 -1
  8. package/dist/app/components/ai/ConfidenceSuggestions/ConfidenceSuggestions.mjs +53 -53
  9. package/dist/app/components/ai/ProposalCard/ProposalCard.cjs +1 -1
  10. package/dist/app/components/ai/ProposalCard/ProposalCard.mjs +227 -227
  11. package/dist/app/components/ai/ReviewTable/ReviewTable.cjs +1 -1
  12. package/dist/app/components/ai/ReviewTable/ReviewTable.mjs +81 -81
  13. package/dist/app/components/ai/SuggestionChecklist/SuggestionChecklist.cjs +1 -1
  14. package/dist/app/components/ai/SuggestionChecklist/SuggestionChecklist.mjs +15 -14
  15. package/dist/app/components/ui/AuthSection/AuthSection.cjs +1 -1
  16. package/dist/app/components/ui/AuthSection/AuthSection.mjs +19 -18
  17. package/dist/app/components/ui/Checkbox/Checkbox.cjs +1 -0
  18. package/dist/app/components/ui/Checkbox/Checkbox.css +1 -0
  19. package/dist/app/components/ui/Checkbox/Checkbox.mjs +87 -0
  20. package/dist/app/components/ui/DataGrid/DataGrid.cjs +1 -1
  21. package/dist/app/components/ui/DataGrid/DataGrid.mjs +196 -199
  22. package/dist/app/components/ui/PreviewConfirmDialog/PreviewConfirmDialog.cjs +1 -1
  23. package/dist/app/components/ui/PreviewConfirmDialog/PreviewConfirmDialog.mjs +47 -48
  24. package/dist/browser/pixstella.esm.js +70 -70
  25. package/dist/browser/pixstella.standalone.js +72 -72
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.d.cts +32 -1
  28. package/dist/index.d.ts +32 -1
  29. package/dist/index.mjs +2886 -2884
  30. package/dist/registry/files/174512e8f294ad2f +101 -0
  31. package/dist/registry/files/4c7e419c8caf02c3 +119 -0
  32. package/dist/registry/files/{f23e788832b45fc0 → 67ac8b4abe3fc564} +2 -1
  33. package/dist/registry/files/{e84f443f3fc3f261 → 995feaa023211faf} +4 -8
  34. package/dist/registry/files/{5ba71aa83263995e → a27872a7d58aeb58} +4 -5
  35. package/dist/registry/files/{162078d04cb26276 → df919b524be27e88} +4 -5
  36. package/dist/registry/index.json +1 -1
  37. package/dist/styles.css +3 -0
  38. package/package.json +3 -10
@@ -1,5 +1,5 @@
1
- import { jsxs as g, Fragment as kt, jsx as t } from "react/jsx-runtime";
2
- import { useId as na, useMemo as H, useState as B, useEffect as je, useRef as Ct } from "react";
1
+ import { jsxs as g, Fragment as vt, jsx as t } from "react/jsx-runtime";
2
+ import { useId as aa, useMemo as H, useState as B, useEffect as kt, useRef as na } from "react";
3
3
  import Nt from "../NavIcon/NavIcon.mjs";
4
4
  import ra from "../Alert/Alert.mjs";
5
5
  import { SkeletonRect as pe } from "../Skeleton/Skeleton.mjs";
@@ -11,10 +11,11 @@ import ee from "../IconButton/IconButton.mjs";
11
11
  import './DataGrid.css';/* empty css */
12
12
  import da from "../../../icons/glyphs/ArrowDownRight.mjs";
13
13
  import ua from "../../../icons/glyphs/ArrowUp.mjs";
14
- import $t from "../../../icons/glyphs/ArrowUpRight.mjs";
14
+ import Ct from "../../../icons/glyphs/ArrowUpRight.mjs";
15
15
  import ma from "../../../icons/glyphs/ChevronDown.mjs";
16
16
  import ga from "../../../icons/glyphs/Close.mjs";
17
- const Be = /* @__PURE__ */ new Set(["number", "currency", "money", "percent", "trend", "progress", "rating", "sparkline"]), Re = /* @__PURE__ */ new Set(["number", "currency", "money", "percent", "trend"]), ha = /* @__PURE__ */ new Set(["text", "badge", "avatar", "tags", "link", "code"]), At = /* @__PURE__ */ new Set(["success", "warning", "danger", "info", "neutral", "accent"]), pa = {
17
+ import { Checkbox as ha } from "../Checkbox/Checkbox.mjs";
18
+ const je = /* @__PURE__ */ new Set(["number", "currency", "money", "percent", "trend", "progress", "rating", "sparkline"]), Re = /* @__PURE__ */ new Set(["number", "currency", "money", "percent", "trend"]), pa = /* @__PURE__ */ new Set(["text", "badge", "avatar", "tags", "link", "code"]), $t = /* @__PURE__ */ new Set(["success", "warning", "danger", "info", "neutral", "accent"]), fa = {
18
19
  paid: "success",
19
20
  active: "success",
20
21
  done: "success",
@@ -52,33 +53,33 @@ function ye(a, i) {
52
53
  const r = a + JSON.stringify(i);
53
54
  return We.has(r) || We.set(r, new Intl.NumberFormat(a, i)), We.get(r);
54
55
  }
55
- const Ie = /* @__PURE__ */ new Map();
56
- function fa(a, i) {
56
+ const ze = /* @__PURE__ */ new Map();
57
+ function ya(a, i) {
57
58
  const r = a + JSON.stringify(i);
58
- return Ie.has(r) || Ie.set(r, new Intl.DateTimeFormat(a, i)), Ie.get(r);
59
+ return ze.has(r) || ze.set(r, new Intl.DateTimeFormat(a, i)), ze.get(r);
59
60
  }
60
61
  const ae = (a) => a == null || a === "" || Array.isArray(a) && a.length === 0, x = (a) => typeof a == "number" ? a : Number.parseFloat(a);
61
- function wt(a) {
62
+ function At(a) {
62
63
  if (a instanceof Date) return a;
63
64
  if (typeof a == "number") return new Date(a);
64
65
  if (typeof a != "string") return null;
65
66
  const i = new Date(/^\d{4}-\d{2}-\d{2}$/.test(a) ? `${a}T00:00:00Z` : a);
66
67
  return Number.isNaN(i.getTime()) ? null : i;
67
68
  }
68
- function ya(a) {
69
+ function _a(a) {
69
70
  const i = String(a ?? "").trim().split(/\s+/).filter(Boolean);
70
71
  return i.length ? i.length === 1 ? i[0].slice(0, 2).toUpperCase() : (i[0][0] + i[i.length - 1][0]).toUpperCase() : "?";
71
72
  }
72
- function _a(a) {
73
+ function ba(a) {
73
74
  let i = 0;
74
75
  for (let r = 0; r < a.length; r++) i = i * 31 + a.charCodeAt(r) | 0;
75
76
  return Math.abs(i);
76
77
  }
77
- function ba(a, i) {
78
- const r = String(a ?? ""), l = i?.[r] ?? i?.[r.toLowerCase()] ?? pa[r.toLowerCase()];
79
- return At.has(l) ? l : "neutral";
78
+ function va(a, i) {
79
+ const r = String(a ?? ""), l = i?.[r] ?? i?.[r.toLowerCase()] ?? fa[r.toLowerCase()];
80
+ return $t.has(l) ? l : "neutral";
80
81
  }
81
- const va = (a) => a && typeof a == "object" ? { value: a.value, label: a.label ?? String(a.value) } : { value: a, label: String(a) };
82
+ const ka = (a) => a && typeof a == "object" ? { value: a.value, label: a.label ?? String(a.value) } : { value: a, label: String(a) };
82
83
  function te(a, i) {
83
84
  const r = i?.[a.key], l = a.options ?? {};
84
85
  if (typeof a.format == "function" && !ae(r)) return String(a.format(r, i));
@@ -90,23 +91,23 @@ function te(a, i) {
90
91
  case "money":
91
92
  return oa(r, { currency: a.currency ?? l.currency ?? (l.currencyKey ? i[l.currencyKey] : void 0), locale: l.locale, options: l.intl });
92
93
  case "currency": {
93
- const d = a.currency ?? l.currency ?? (l.currencyKey ? i[l.currencyKey] : null) ?? "USD", c = l.decimals ?? 2;
94
- return ye(o, { style: "currency", currency: d, minimumFractionDigits: c, maximumFractionDigits: c, ...l.compact ? { notation: "compact" } : {} }).format(x(r));
94
+ const u = a.currency ?? l.currency ?? (l.currencyKey ? i[l.currencyKey] : null) ?? "USD", c = l.decimals ?? 2;
95
+ return ye(o, { style: "currency", currency: u, minimumFractionDigits: c, maximumFractionDigits: c, ...l.compact ? { notation: "compact" } : {} }).format(x(r));
95
96
  }
96
97
  case "percent": {
97
- const d = l.fraction ? x(r) : x(r) / 100;
98
- return ye(o, { style: "percent", maximumFractionDigits: l.decimals ?? 1 }).format(d);
98
+ const u = l.fraction ? x(r) : x(r) / 100;
99
+ return ye(o, { style: "percent", maximumFractionDigits: l.decimals ?? 1 }).format(u);
99
100
  }
100
101
  case "trend": {
101
- const d = x(r), c = ye(o, { maximumFractionDigits: l.decimals ?? 1, signDisplay: "never" }).format(d);
102
- return `${d > 0 ? "+" : d < 0 ? "−" : ""}${c}${l.suffix ?? "%"}`;
102
+ const u = x(r), c = ye(o, { maximumFractionDigits: l.decimals ?? 1, signDisplay: "never" }).format(u);
103
+ return `${u > 0 ? "+" : u < 0 ? "−" : ""}${c}${l.suffix ?? "%"}`;
103
104
  }
104
105
  case "date": {
105
- const d = wt(r);
106
- if (!d) return String(r);
106
+ const u = At(r);
107
+ if (!u) return String(r);
107
108
  const { locale: c, timeZone: y = "UTC", time: f, ...S } = l, $ = Object.keys(S).some((w) => ["dateStyle", "timeStyle", "year", "month", "day", "weekday", "hour", "minute"].includes(w)) ? S : { month: "short", day: "numeric", year: "numeric", ...f ? { hour: "numeric", minute: "2-digit" } : {} }, K = {};
108
109
  for (const w of ["dateStyle", "timeStyle", "year", "month", "day", "weekday", "hour", "minute", "hour12"]) $[w] != null && (K[w] = $[w]);
109
- return fa(o, { ...K, timeZone: y }).format(d);
110
+ return ya(o, { ...K, timeZone: y }).format(u);
110
111
  }
111
112
  case "avatar":
112
113
  return [r, l.subtitleKey ? i[l.subtitleKey] : null].filter(Boolean).join(" ");
@@ -122,12 +123,12 @@ function te(a, i) {
122
123
  return String(r);
123
124
  }
124
125
  }
125
- function ka(a, i) {
126
+ function Na(a, i) {
126
127
  const r = i?.[a.key];
127
128
  if (ae(r)) return null;
128
129
  if (a.type === "sparkline") return Array.isArray(r) ? x(r.at(-1)) : x(r);
129
- if (Be.has(a.type)) return x(r);
130
- if (a.type === "date") return wt(r)?.getTime() ?? null;
130
+ if (je.has(a.type)) return x(r);
131
+ if (a.type === "date") return At(r)?.getTime() ?? null;
131
132
  if (a.type === "tags") return (Array.isArray(r) ? r : [r]).join(", ").toLowerCase();
132
133
  if (a.type === "badge" && Array.isArray(a.options?.order)) {
133
134
  const l = a.options.order.indexOf(r);
@@ -135,35 +136,35 @@ function ka(a, i) {
135
136
  }
136
137
  return String(r).toLowerCase();
137
138
  }
138
- const Na = () => /* @__PURE__ */ t(ua, { className: "data-grid__sort-icon", trim: !0, size: null, strokeWidth: 2.4 }), xa = () => /* @__PURE__ */ t(ma, { trim: !0, size: null, strokeWidth: 2 }), Sa = () => /* @__PURE__ */ t(ga, { trim: !0, size: null, strokeWidth: 2.4 }), Ca = () => /* @__PURE__ */ t($t, { trim: !0, size: null, strokeWidth: 2.4 }), $a = () => /* @__PURE__ */ t(da, { trim: !0, size: null, strokeWidth: 2.4 }), Aa = () => /* @__PURE__ */ t($t, { trim: !0, size: null, strokeWidth: 2 }), xt = "M12 2.8l2.8 5.8 6.3.9-4.6 4.4 1.1 6.3L12 17.2l-5.6 3 1.1-6.3L2.9 9.5l6.3-.9z";
139
- function wa({ values: a, mode: i }) {
139
+ const xa = () => /* @__PURE__ */ t(ua, { className: "data-grid__sort-icon", trim: !0, size: null, strokeWidth: 2.4 }), Sa = () => /* @__PURE__ */ t(ma, { trim: !0, size: null, strokeWidth: 2 }), Ca = () => /* @__PURE__ */ t(ga, { trim: !0, size: null, strokeWidth: 2.4 }), $a = () => /* @__PURE__ */ t(Ct, { trim: !0, size: null, strokeWidth: 2.4 }), Aa = () => /* @__PURE__ */ t(da, { trim: !0, size: null, strokeWidth: 2.4 }), wa = () => /* @__PURE__ */ t(Ct, { trim: !0, size: null, strokeWidth: 2 }), xt = "M12 2.8l2.8 5.8 6.3.9-4.6 4.4 1.1 6.3L12 17.2l-5.6 3 1.1-6.3L2.9 9.5l6.3-.9z";
140
+ function Da({ values: a, mode: i }) {
140
141
  const r = (Array.isArray(a) ? a : []).map(x).filter(Number.isFinite);
141
142
  if (r.length < 2) return /* @__PURE__ */ t("span", { className: "data-grid__empty-val", children: "—" });
142
- const l = 84, o = 26, d = 3, c = Math.min(...r), f = Math.max(...r) - c || 1, S = r.map((A, W) => [d + W / (r.length - 1) * (l - d * 2), d + (1 - (A - c) / f) * (o - d * 2)]), $ = S.map(([A, W]) => `${A.toFixed(1)},${W.toFixed(1)}`).join(" "), K = `${d},${o} ${$} ${(l - d).toFixed(1)},${o}`, w = r.at(-1) >= r[0] ? "up" : "down", be = i === "trend" ? ` is-${w}` : "", [U, ve] = S.at(-1);
143
+ const l = 84, o = 26, u = 3, c = Math.min(...r), f = Math.max(...r) - c || 1, S = r.map((A, W) => [u + W / (r.length - 1) * (l - u * 2), u + (1 - (A - c) / f) * (o - u * 2)]), $ = S.map(([A, W]) => `${A.toFixed(1)},${W.toFixed(1)}`).join(" "), K = `${u},${o} ${$} ${(l - u).toFixed(1)},${o}`, w = r.at(-1) >= r[0] ? "up" : "down", be = i === "trend" ? ` is-${w}` : "", [U, ve] = S.at(-1);
143
144
  return /* @__PURE__ */ g("svg", { className: `data-grid__spark${be}`, viewBox: `0 0 ${l} ${o}`, role: "img", "aria-label": `Trend ${w}, from ${r[0]} to ${r.at(-1)}`, children: [
144
145
  /* @__PURE__ */ t("polygon", { points: K }),
145
146
  /* @__PURE__ */ t("polyline", { points: $ }),
146
147
  /* @__PURE__ */ t("circle", { cx: U, cy: ve, r: "2.2" })
147
148
  ] });
148
149
  }
149
- function Da({ value: a, max: i = 5, showValue: r }) {
150
+ function Ea({ value: a, max: i = 5, showValue: r }) {
150
151
  const l = Math.max(0, Math.min(i, x(a) || 0));
151
152
  return /* @__PURE__ */ g("span", { className: "data-grid__rating", role: "img", "aria-label": `${l} out of ${i}`, children: [
152
- Array.from({ length: i }, (o, d) => {
153
- const c = Math.max(0, Math.min(1, l - d));
153
+ Array.from({ length: i }, (o, u) => {
154
+ const c = Math.max(0, Math.min(1, l - u));
154
155
  return /* @__PURE__ */ g("svg", { viewBox: "0 0 24 24", "aria-hidden": !0, children: [
155
156
  /* @__PURE__ */ t("path", { className: "is-off", d: xt }),
156
157
  c > 0 && /* @__PURE__ */ t("path", { className: "is-on", d: xt, style: c < 1 ? { clipPath: `inset(0 ${((1 - c) * 100).toFixed(0)}% 0 0)` } : void 0 })
157
- ] }, d);
158
+ ] }, u);
158
159
  }),
159
160
  r !== !1 && /* @__PURE__ */ t("span", { className: "data-grid__rating-val", children: l.toFixed(1) })
160
161
  ] });
161
162
  }
162
- function ze({ col: a, row: i, index: r }) {
163
+ function Ie({ col: a, row: i, index: r }) {
163
164
  if (typeof a.cell == "function") return a.cell(i, r);
164
165
  const l = i?.[a.key], o = a.options ?? {};
165
166
  if (ae(l) && a.type !== "avatar") return /* @__PURE__ */ t("span", { className: "data-grid__empty-val", children: "—" });
166
- const d = te(a, i);
167
+ const u = te(a, i);
167
168
  switch (a.type) {
168
169
  case "money":
169
170
  return /* @__PURE__ */ t(
@@ -180,22 +181,22 @@ function ze({ col: a, row: i, index: r }) {
180
181
  }
181
182
  );
182
183
  case "code":
183
- return /* @__PURE__ */ t("span", { className: "data-grid__text is-mono data-grid__code", children: d });
184
+ return /* @__PURE__ */ t("span", { className: "data-grid__text is-mono data-grid__code", children: u });
184
185
  case "number":
185
186
  case "percent":
186
- return /* @__PURE__ */ t("span", { className: "data-grid__num", children: d });
187
+ return /* @__PURE__ */ t("span", { className: "data-grid__num", children: u });
187
188
  case "currency":
188
- return /* @__PURE__ */ t("span", { className: "data-grid__money", children: d });
189
+ return /* @__PURE__ */ t("span", { className: "data-grid__money", children: u });
189
190
  case "date":
190
- return /* @__PURE__ */ t("time", { className: "data-grid__text", dateTime: typeof l == "string" ? l : void 0, children: d });
191
+ return /* @__PURE__ */ t("time", { className: "data-grid__text", dateTime: typeof l == "string" ? l : void 0, children: u });
191
192
  case "badge":
192
- return /* @__PURE__ */ t("span", { className: `data-grid__badge data-grid__badge--${ba(l, o.tones)}`, children: d });
193
+ return /* @__PURE__ */ t("span", { className: `data-grid__badge data-grid__badge--${va(l, o.tones)}`, children: u });
193
194
  case "avatar": {
194
- const c = String(l ?? ""), y = o.subtitleKey ? i[o.subtitleKey] : null, f = o.imageKey ? i[o.imageKey] : null, S = _a(c) % 6 + 1;
195
+ const c = String(l ?? ""), y = o.subtitleKey ? i[o.subtitleKey] : null, f = o.imageKey ? i[o.imageKey] : null, S = ba(c) % 6 + 1;
195
196
  return /* @__PURE__ */ g("span", { className: "data-grid__person", children: [
196
- /* @__PURE__ */ t("span", { className: "data-grid__avatar", style: { "--c": `var(--chart-series-${S}, var(--dg-accent))` }, "aria-hidden": !0, children: f ? /* @__PURE__ */ t("img", { src: f, alt: "", loading: "lazy" }) : ya(c) }),
197
+ /* @__PURE__ */ t("span", { className: "data-grid__avatar", style: { "--c": `var(--chart-series-${S}, var(--dg-accent))` }, "aria-hidden": !0, children: f ? /* @__PURE__ */ t("img", { src: f, alt: "", loading: "lazy" }) : _a(c) }),
197
198
  /* @__PURE__ */ g("span", { className: "data-grid__person-text", children: [
198
- /* @__PURE__ */ t("span", { className: "data-grid__person-name", children: typeof a.format == "function" ? d : c || "—" }),
199
+ /* @__PURE__ */ t("span", { className: "data-grid__person-name", children: typeof a.format == "function" ? u : c || "—" }),
199
200
  y && /* @__PURE__ */ t("span", { className: "data-grid__person-sub", children: y })
200
201
  ] })
201
202
  ] });
@@ -204,19 +205,19 @@ function ze({ col: a, row: i, index: r }) {
204
205
  const c = o.max ?? 100, y = Math.max(0, Math.min(100, x(l) / c * 100 || 0));
205
206
  return /* @__PURE__ */ g("span", { className: "data-grid__progress", children: [
206
207
  /* @__PURE__ */ t("span", { className: "data-grid__progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": c, "aria-valuenow": x(l), "aria-label": a.label, children: /* @__PURE__ */ t("span", { className: `data-grid__progress-fill${y >= 100 ? " is-done" : ""}`, style: { width: `${y}%` } }) }),
207
- /* @__PURE__ */ t("span", { className: "data-grid__progress-val", children: typeof a.format == "function" ? d : `${Math.round(y)}%` })
208
+ /* @__PURE__ */ t("span", { className: "data-grid__progress-val", children: typeof a.format == "function" ? u : `${Math.round(y)}%` })
208
209
  ] });
209
210
  }
210
211
  case "sparkline":
211
- return /* @__PURE__ */ t(wa, { values: l, mode: o.color ?? "accent" });
212
+ return /* @__PURE__ */ t(Da, { values: l, mode: o.color ?? "accent" });
212
213
  case "rating":
213
- return /* @__PURE__ */ t(Da, { value: l, max: o.max ?? 5, showValue: o.showValue });
214
+ return /* @__PURE__ */ t(Ea, { value: l, max: o.max ?? 5, showValue: o.showValue });
214
215
  case "tags": {
215
216
  const c = Array.isArray(l) ? l : [l], y = o.max ?? 3, f = c.slice(0, y);
216
217
  return /* @__PURE__ */ g("span", { className: "data-grid__tags", children: [
217
218
  f.map((S) => {
218
219
  const $ = o.tones?.[S];
219
- return /* @__PURE__ */ t("span", { className: `data-grid__tag${At.has($) && $ !== "neutral" ? ` data-grid__tag--${$}` : ""}`, children: S }, S);
220
+ return /* @__PURE__ */ t("span", { className: `data-grid__tag${$t.has($) && $ !== "neutral" ? ` data-grid__tag--${$}` : ""}`, children: S }, S);
220
221
  }),
221
222
  c.length > y && /* @__PURE__ */ g("span", { className: "data-grid__tag is-more", title: c.slice(y).join(", "), children: [
222
223
  "+",
@@ -226,52 +227,48 @@ function ze({ col: a, row: i, index: r }) {
226
227
  }
227
228
  case "link": {
228
229
  const c = o.hrefKey ? i[o.hrefKey] : o.href;
229
- if (!c) return /* @__PURE__ */ t("span", { className: "data-grid__text is-strong", children: d });
230
+ if (!c) return /* @__PURE__ */ t("span", { className: "data-grid__text is-strong", children: u });
230
231
  const y = o.external ?? /^https?:\/\//.test(c);
231
232
  return /* @__PURE__ */ g("a", { className: "data-grid__link", href: c, ...y ? { target: "_blank", rel: "noreferrer noopener" } : {}, onClick: (f) => f.stopPropagation(), children: [
232
- d,
233
- y && /* @__PURE__ */ t(Aa, {})
233
+ u,
234
+ y && /* @__PURE__ */ t(wa, {})
234
235
  ] });
235
236
  }
236
237
  case "trend": {
237
238
  const c = x(l), y = o.invert ? c < 0 : c > 0;
238
239
  return /* @__PURE__ */ g("span", { className: `data-grid__trend${c === 0 ? "" : y ? " is-good" : " is-bad"}`, children: [
239
- c > 0 ? /* @__PURE__ */ t(Ca, {}) : c < 0 ? /* @__PURE__ */ t($a, {}) : null,
240
- d
240
+ c > 0 ? /* @__PURE__ */ t($a, {}) : c < 0 ? /* @__PURE__ */ t(Aa, {}) : null,
241
+ u
241
242
  ] });
242
243
  }
243
244
  default: {
244
245
  const c = ["data-grid__text", o.strong && "is-strong", o.mono && "is-mono", o.muted && "is-muted", o.maxWidth && "is-clamp"].filter(Boolean).join(" ");
245
- return /* @__PURE__ */ t("span", { className: c, style: o.maxWidth ? { "--dg-max": typeof o.maxWidth == "number" ? `${o.maxWidth}px` : o.maxWidth } : void 0, title: o.maxWidth ? d : void 0, children: d });
246
+ return /* @__PURE__ */ t("span", { className: c, style: o.maxWidth ? { "--dg-max": typeof o.maxWidth == "number" ? `${o.maxWidth}px` : o.maxWidth } : void 0, title: o.maxWidth ? u : void 0, children: u });
246
247
  }
247
248
  }
248
249
  }
249
250
  function _e({ checked: a, indeterminate: i, onChange: r, label: l }) {
250
- const o = Ct(null);
251
- return je(() => {
252
- o.current && (o.current.indeterminate = !!i);
253
- }, [i]), /* @__PURE__ */ t(
254
- "input",
251
+ return /* @__PURE__ */ t(
252
+ ha,
255
253
  {
256
- ref: o,
257
- type: "checkbox",
254
+ size: "sm",
258
255
  className: "data-grid__check",
259
256
  checked: !!a,
260
- "aria-checked": i ? "mixed" : !!a,
257
+ indeterminate: !!i,
261
258
  "aria-label": l,
262
259
  onChange: r,
263
- onClick: (d) => d.stopPropagation()
260
+ onClick: (o) => o.stopPropagation()
264
261
  }
265
262
  );
266
263
  }
267
264
  function Pe({ value: a, onChange: i, label: r, children: l, small: o }) {
268
265
  return /* @__PURE__ */ g("label", { className: `data-grid__select${o ? " data-grid__select--sm" : ""}`, children: [
269
266
  /* @__PURE__ */ t("span", { className: "data-grid__select-label", children: r }),
270
- /* @__PURE__ */ t("select", { value: a, onChange: (d) => i(d.target.value), children: l }),
271
- /* @__PURE__ */ t(xa, {})
267
+ /* @__PURE__ */ t("select", { value: a, onChange: (u) => i(u.target.value), children: l }),
268
+ /* @__PURE__ */ t(Sa, {})
272
269
  ] });
273
270
  }
274
- const Ea = {
271
+ const Ma = {
275
272
  search: "Search…",
276
273
  clearSearch: "Clear search",
277
274
  sortBy: "Sort by",
@@ -303,23 +300,23 @@ const Ea = {
303
300
  allOf: (a) => `All ${String(a).toLowerCase()}`,
304
301
  action: "Action"
305
302
  };
306
- function Ma(a, i) {
307
- if (i <= 7) return Array.from({ length: i }, (d, c) => c + 1);
303
+ function Oa(a, i) {
304
+ if (i <= 7) return Array.from({ length: i }, (u, c) => c + 1);
308
305
  const r = /* @__PURE__ */ new Set([1, i, a - 1, a, a + 1]);
309
- a <= 3 && [2, 3, 4].forEach((d) => r.add(d)), a >= i - 2 && [i - 1, i - 2, i - 3].forEach((d) => r.add(d));
310
- const l = [...r].filter((d) => d >= 1 && d <= i).sort((d, c) => d - c), o = [];
311
- return l.forEach((d, c) => {
312
- c > 0 && d - l[c - 1] > 1 && o.push(`gap-${d}`), o.push(d);
306
+ a <= 3 && [2, 3, 4].forEach((u) => r.add(u)), a >= i - 2 && [i - 1, i - 2, i - 3].forEach((u) => r.add(u));
307
+ const l = [...r].filter((u) => u >= 1 && u <= i).sort((u, c) => u - c), o = [];
308
+ return l.forEach((u, c) => {
309
+ c > 0 && u - l[c - 1] > 1 && o.push(`gap-${u}`), o.push(u);
313
310
  }), o;
314
311
  }
315
312
  const St = [72, 54, 86, 64, 48, 78, 60, 92];
316
- function Ja({
313
+ function Qa({
317
314
  columns: a = [],
318
315
  rows: i = [],
319
316
  rowKey: r = "id",
320
317
  searchable: l = !1,
321
318
  filters: o = [],
322
- sort: d,
319
+ sort: u,
323
320
  pageSize: c,
324
321
  pageSizeOptions: y,
325
322
  selectable: f = !1,
@@ -333,51 +330,51 @@ function Ja({
333
330
  title: A,
334
331
  subtitle: W,
335
332
  actions: ke = [],
336
- responsive: Ke = "scroll",
333
+ responsive: Be = "scroll",
337
334
  caption: ne,
338
- className: Dt = "",
339
- onBulkAction: Et,
340
- onAction: Ue,
335
+ className: wt = "",
336
+ onBulkAction: Dt,
337
+ onAction: Ke,
341
338
  onRowClick: q,
342
- onSelectionChange: Mt,
343
- onSortChange: Ve,
339
+ onSelectionChange: Et,
340
+ onSortChange: Ue,
344
341
  // ---- controlled / server-side mode
345
342
  serverSide: E = !1,
346
- page: Ot,
347
- pageCount: Ge,
348
- onPageChange: Ye,
343
+ page: Mt,
344
+ pageCount: Ve,
345
+ onPageChange: Ge,
349
346
  totalRows: re,
350
347
  selected: se,
351
- onSelectedChange: Lt,
348
+ onSelectedChange: Ot,
352
349
  // ---- rows
353
- rowTone: qe,
354
- rowHighlighted: Je,
355
- rowHref: Ze,
356
- renderLink: Ft,
350
+ rowTone: Ye,
351
+ rowHighlighted: qe,
352
+ rowHref: Je,
353
+ renderLink: Lt,
357
354
  // ---- slots and states
358
355
  bulkBar: J,
359
356
  loading: L = !1,
360
- loadingRows: Tt,
357
+ loadingRows: Ft,
361
358
  error: N,
362
- onRetry: Qe,
363
- empty: Rt,
359
+ onRetry: Ze,
360
+ empty: Tt,
364
361
  // ---- phones
365
362
  stickyFirstColumn: Ne = "narrow",
366
- mobile: Wt = "scroll",
367
- renderCard: Xe,
368
- labels: It
363
+ mobile: Rt = "scroll",
364
+ renderCard: Qe,
365
+ labels: Wt
369
366
  }) {
370
- const zt = na(), m = { ...Ea, ...It || {} }, k = H(() => (Array.isArray(a) ? a : []).filter((e) => e && e.key != null), [a]), I = Array.isArray(i) ? i : [], xe = (e, n) => (typeof r == "function" ? r(e, n) : e?.[r]) ?? n, ie = (e, n) => String(xe(e, n)), Se = (e) => typeof e.label == "string" ? e.label : typeof e.header == "string" ? e.header : String(e.key), He = (e) => e?.key ? { key: e.key, dir: e.dir === "desc" ? "desc" : "asc" } : null, [V, le] = B(""), [oe, et] = B({}), [Pt, tt] = B(() => He(d)), C = E ? He(d) : Pt, [at, nt] = B(c > 0 ? c : 0), [jt, z] = B(0), ce = Array.isArray(se), [rt, Bt] = B(() => new Set((S ?? []).map(String))), F = H(() => ce ? new Set(se.map(String)) : rt, [ce, se, rt]);
371
- je(() => {
372
- c > 0 && nt(c);
367
+ const zt = aa(), m = { ...Ma, ...Wt || {} }, k = H(() => (Array.isArray(a) ? a : []).filter((e) => e && e.key != null), [a]), z = Array.isArray(i) ? i : [], xe = (e, n) => (typeof r == "function" ? r(e, n) : e?.[r]) ?? n, ie = (e, n) => String(xe(e, n)), Se = (e) => typeof e.label == "string" ? e.label : typeof e.header == "string" ? e.header : String(e.key), Xe = (e) => e?.key ? { key: e.key, dir: e.dir === "desc" ? "desc" : "asc" } : null, [V, le] = B(""), [oe, He] = B({}), [It, et] = B(() => Xe(u)), C = E ? Xe(u) : It, [tt, at] = B(c > 0 ? c : 0), [Pt, I] = B(0), ce = Array.isArray(se), [nt, jt] = B(() => new Set((S ?? []).map(String))), F = H(() => ce ? new Set(se.map(String)) : nt, [ce, se, nt]);
368
+ kt(() => {
369
+ c > 0 && at(c);
373
370
  }, [c]);
374
- const st = Ct(null), [Kt, Ut] = B("");
375
- je(() => {
376
- const e = st.current;
371
+ const rt = na(null), [Bt, Kt] = B("");
372
+ kt(() => {
373
+ const e = rt.current;
377
374
  if (!e) return;
378
375
  const n = () => {
379
- const u = e.scrollWidth - e.clientWidth, h = u <= 1 ? "" : `${e.scrollLeft > 1 ? " is-left" : ""}${e.scrollLeft < u - 1 ? " is-right" : ""}`;
380
- Ut((p) => p === h ? p : h);
376
+ const d = e.scrollWidth - e.clientWidth, h = d <= 1 ? "" : `${e.scrollLeft > 1 ? " is-left" : ""}${e.scrollLeft < d - 1 ? " is-right" : ""}`;
377
+ Kt((p) => p === h ? p : h);
381
378
  };
382
379
  n(), e.addEventListener("scroll", n, { passive: !0 });
383
380
  const s = typeof ResizeObserver < "u" ? new ResizeObserver(n) : null;
@@ -385,97 +382,97 @@ function Ja({
385
382
  e.removeEventListener("scroll", n), s?.disconnect();
386
383
  };
387
384
  }, []);
388
- const Ce = (Array.isArray(o) ? o : []).filter((e) => e && e.key != null), it = H(() => Object.fromEntries(k.map((e) => [e.key, e])), [k]), lt = (e, n, s) => {
385
+ const Ce = (Array.isArray(o) ? o : []).filter((e) => e && e.key != null), st = H(() => Object.fromEntries(k.map((e) => [e.key, e])), [k]), it = (e, n, s) => {
389
386
  if (s === "" || s == null) return !0;
390
- const u = e?.[n.key];
391
- return Array.isArray(u) ? u.map(String).includes(String(s)) : String(u) === String(s);
387
+ const d = e?.[n.key];
388
+ return Array.isArray(d) ? d.map(String).includes(String(s)) : String(d) === String(s);
392
389
  }, de = H(() => {
393
- const e = V.trim().toLowerCase(), n = k.filter((s) => s.searchable ?? ha.has(s.type ?? "text"));
394
- return I.filter((s) => {
395
- for (const u of Ce) if (!lt(s, u, oe[u.key])) return !1;
396
- return e ? n.some((u) => te(u, s).toLowerCase().includes(e)) || String(typeof r == "function" ? r(s) : s?.[r] ?? "").toLowerCase().includes(e) : !0;
390
+ const e = V.trim().toLowerCase(), n = k.filter((s) => s.searchable ?? pa.has(s.type ?? "text"));
391
+ return z.filter((s) => {
392
+ for (const d of Ce) if (!it(s, d, oe[d.key])) return !1;
393
+ return e ? n.some((d) => te(d, s).toLowerCase().includes(e)) || String(typeof r == "function" ? r(s) : s?.[r] ?? "").toLowerCase().includes(e) : !0;
397
394
  });
398
- }, [I, k, V, oe, o, r]), ue = H(() => {
395
+ }, [z, k, V, oe, o, r]), ue = H(() => {
399
396
  if (E) return de;
400
- const e = C && it[C.key];
397
+ const e = C && st[C.key];
401
398
  if (!e) return de;
402
- const n = C.dir === "desc" ? -1 : 1, s = typeof e.sortValue == "function" ? (u) => e.sortValue(u) : (u) => ka(e, u);
403
- return de.map((u, h) => ({ row: u, i: h, v: s(u) })).sort((u, h) => u.v == null && h.v == null ? u.i - h.i : u.v == null ? 1 : h.v == null ? -1 : (typeof u.v == "number" && typeof h.v == "number" ? u.v - h.v : String(u.v).localeCompare(String(h.v), "en", { numeric: !0 })) * n || u.i - h.i).map((u) => u.row);
404
- }, [de, C, it, E]), D = Ge != null, T = ue.length, M = D ? 0 : at, R = D ? Math.max(1, Number(Ge) || 1) : M > 0 ? Math.max(1, Math.ceil(T / M)) : 1, _ = Math.min(D ? Math.max(0, (Number(Ot) || 1) - 1) : jt, R - 1), O = M > 0 ? _ * M : 0, P = M > 0 ? ue.slice(O, O + M) : ue, G = (E || D ? P : ue).map((e, n) => ie(e, n)), $e = G.filter((e) => F.has(e)).length, Y = G.length > 0 && $e === G.length, ot = $e > 0 && !Y, me = E || D ? F.size : $e, ge = /* @__PURE__ */ new Map();
405
- (ce ? se : []).forEach((e) => ge.set(String(e), e)), I.forEach((e, n) => ge.set(ie(e, n), xe(e, n)));
399
+ const n = C.dir === "desc" ? -1 : 1, s = typeof e.sortValue == "function" ? (d) => e.sortValue(d) : (d) => Na(e, d);
400
+ return de.map((d, h) => ({ row: d, i: h, v: s(d) })).sort((d, h) => d.v == null && h.v == null ? d.i - h.i : d.v == null ? 1 : h.v == null ? -1 : (typeof d.v == "number" && typeof h.v == "number" ? d.v - h.v : String(d.v).localeCompare(String(h.v), "en", { numeric: !0 })) * n || d.i - h.i).map((d) => d.row);
401
+ }, [de, C, st, E]), D = Ve != null, T = ue.length, M = D ? 0 : tt, R = D ? Math.max(1, Number(Ve) || 1) : M > 0 ? Math.max(1, Math.ceil(T / M)) : 1, _ = Math.min(D ? Math.max(0, (Number(Mt) || 1) - 1) : Pt, R - 1), O = M > 0 ? _ * M : 0, P = M > 0 ? ue.slice(O, O + M) : ue, G = (E || D ? P : ue).map((e, n) => ie(e, n)), $e = G.filter((e) => F.has(e)).length, Y = G.length > 0 && $e === G.length, lt = $e > 0 && !Y, me = E || D ? F.size : $e, ge = /* @__PURE__ */ new Map();
402
+ (ce ? se : []).forEach((e) => ge.set(String(e), e)), z.forEach((e, n) => ge.set(ie(e, n), xe(e, n)));
406
403
  const Ae = (e) => e.map((n) => ge.has(n) ? ge.get(n) : n), we = (e) => {
407
- ce || Bt(e);
404
+ ce || jt(e);
408
405
  const n = Ae([...e]);
409
- Mt?.(n), Lt?.(n);
406
+ Et?.(n), Ot?.(n);
410
407
  }, De = (e) => {
411
408
  const n = new Set(F);
412
409
  n.has(e) ? n.delete(e) : n.add(e), we(n);
413
- }, ct = () => {
410
+ }, ot = () => {
414
411
  const e = new Set(F);
415
412
  Y ? G.forEach((n) => e.delete(n)) : G.forEach((n) => e.add(n)), we(e);
416
- }, dt = () => we(/* @__PURE__ */ new Set()), ut = E || D ? [...F] : [...F].filter((e) => G.includes(e)), Vt = (e) => e.firstDir === "asc" || e.firstDir === "desc" ? e.firstDir : Be.has(e.type) || e.type === "date" || e.numeric ? "desc" : "asc", Gt = (e) => {
417
- const n = Vt(e);
413
+ }, ct = () => we(/* @__PURE__ */ new Set()), dt = E || D ? [...F] : [...F].filter((e) => G.includes(e)), Ut = (e) => e.firstDir === "asc" || e.firstDir === "desc" ? e.firstDir : je.has(e.type) || e.type === "date" || e.numeric ? "desc" : "asc", Vt = (e) => {
414
+ const n = Ut(e);
418
415
  let s;
419
- !C || C.key !== e.key ? s = { key: e.key, dir: n } : C.dir === n ? s = { key: e.key, dir: n === "asc" ? "desc" : "asc" } : s = E ? { key: e.key, dir: n } : null, E || (tt(s), z(0)), Ve?.(s, s?.key ?? null, s?.dir ?? null);
420
- }, mt = (e, n) => {
421
- et((s) => ({ ...s, [e]: n })), z(0);
422
- }, Yt = () => {
423
- le(""), et({}), z(0);
416
+ !C || C.key !== e.key ? s = { key: e.key, dir: n } : C.dir === n ? s = { key: e.key, dir: n === "asc" ? "desc" : "asc" } : s = E ? { key: e.key, dir: n } : null, E || (et(s), I(0)), Ue?.(s, s?.key ?? null, s?.dir ?? null);
417
+ }, ut = (e, n) => {
418
+ He((s) => ({ ...s, [e]: n })), I(0);
419
+ }, Gt = () => {
420
+ le(""), He({}), I(0);
424
421
  }, Z = (e) => {
425
- D || z(e), Ye?.(e + 1);
426
- }, qt = (e, n) => I.filter((s) => lt(s, e, n)).length, gt = typeof l == "string" ? l : m.search, Jt = l || Ce.length > 0, Ee = V.trim() !== "" || Object.values(oe).some((e) => e !== "" && e != null), ht = k.filter((e) => e.sortable !== !1), pt = [.../* @__PURE__ */ new Set([...(y ?? [c, 10, 25, 50]).filter((e) => e > 0)])].sort((e, n) => e - n), Zt = k.length + (f ? 1 : 0), Me = Wt === "cards", ft = Ne === !0 || Ne === "always" ? "always" : Ne === !1 || k[0]?.sticky === !1 ? null : "narrow", Qt = [
422
+ D || I(e), Ge?.(e + 1);
423
+ }, Yt = (e, n) => z.filter((s) => it(s, e, n)).length, mt = typeof l == "string" ? l : m.search, qt = l || Ce.length > 0, Ee = V.trim() !== "" || Object.values(oe).some((e) => e !== "" && e != null), gt = k.filter((e) => e.sortable !== !1), ht = [.../* @__PURE__ */ new Set([...(y ?? [c, 10, 25, 50]).filter((e) => e > 0)])].sort((e, n) => e - n), Jt = k.length + (f ? 1 : 0), Me = Rt === "cards", pt = Ne === !0 || Ne === "always" ? "always" : Ne === !1 || k[0]?.sticky === !1 ? null : "narrow", Zt = [
427
424
  "data-grid",
428
425
  `data-grid--${K === "compact" ? "compact" : "comfortable"}`,
429
426
  w && "data-grid--striped",
430
427
  be && "data-grid--sticky",
431
- Ke === "stack" && "data-grid--stack",
432
- ft && `data-grid--sticky-first-${ft}`,
428
+ Be === "stack" && "data-grid--stack",
429
+ pt && `data-grid--sticky-first-${pt}`,
433
430
  Me && "data-grid--cards",
434
- Dt
435
- ].filter(Boolean).join(" "), he = (e) => e.align ?? (Re.has(e.type) || e.numeric ? "right" : "left"), Oe = k[0]?.key, yt = (e) => {
436
- const n = typeof qe == "function" ? qe(e) : null;
431
+ wt
432
+ ].filter(Boolean).join(" "), he = (e) => e.align ?? (Re.has(e.type) || e.numeric ? "right" : "left"), Oe = k[0]?.key, ft = (e) => {
433
+ const n = typeof Ye == "function" ? Ye(e) : null;
437
434
  return n === "danger" || n === "warning" ? n : null;
438
- }, _t = (e) => typeof Je == "function" ? !!Je(e) : !1, Xt = !L && !N, bt = Math.max(1, Math.min(12, Tt ?? (M || c || 5))), vt = Rt ?? /* @__PURE__ */ g("div", { className: "data-grid__empty-inner", children: [
435
+ }, yt = (e) => typeof qe == "function" ? !!qe(e) : !1, Qt = !L && !N, _t = Math.max(1, Math.min(12, Ft ?? (M || c || 5))), bt = Tt ?? /* @__PURE__ */ g("div", { className: "data-grid__empty-inner", children: [
439
436
  /* @__PURE__ */ t("span", { className: "data-grid__empty-icon", children: /* @__PURE__ */ t(Nt, { name: Ee ? "search" : "inbox", size: 18 }) }),
440
437
  /* @__PURE__ */ t("p", { className: "data-grid__empty-text", children: ve }),
441
- Ee && /* @__PURE__ */ t(fe, { variant: "ghost", size: "sm", onClick: Yt, children: m.clearFilters })
442
- ] }), Q = (e, n) => k.find((s) => s.card === e) ?? (n ? k.find((s) => s.card !== !1 && n(s)) : void 0), Ht = (() => {
438
+ Ee && /* @__PURE__ */ t(fe, { variant: "ghost", size: "sm", onClick: Gt, children: m.clearFilters })
439
+ ] }), Q = (e, n) => k.find((s) => s.card === e) ?? (n ? k.find((s) => s.card !== !1 && n(s)) : void 0), Xt = (() => {
443
440
  if (!Me) return null;
444
- const e = Q("title") ?? k[0], n = Q("value", (b) => b !== e && (Re.has(b.type) || b.numeric)), s = Q("badge", (b) => b !== e && b.type === "badge"), u = /* @__PURE__ */ new Set([e, n, s]), h = (b) => !u.has(b) && !Be.has(b.type) && !b.numeric && b.type !== "badge" && b.type !== "tags", p = Q("subtitle", h);
445
- u.add(p);
441
+ const e = Q("title") ?? k[0], n = Q("value", (b) => b !== e && (Re.has(b.type) || b.numeric)), s = Q("badge", (b) => b !== e && b.type === "badge"), d = /* @__PURE__ */ new Set([e, n, s]), h = (b) => !d.has(b) && !je.has(b.type) && !b.numeric && b.type !== "badge" && b.type !== "tags", p = Q("subtitle", h);
442
+ d.add(p);
446
443
  const j = Q("meta", h);
447
444
  return { titleCol: e, subtitleCol: p, metaCol: j, valueCol: n, badgeCol: s };
448
- })(), Le = (e, n, s) => e ? typeof e.cell == "function" ? e.cell(n, s) : ae(n?.[e.key]) ? void 0 : te(e, n) : void 0, ea = (e, n) => {
449
- const s = ie(e, O + n), u = f && F.has(s), h = { index: O + n, key: xe(e, O + n), selected: u, toggle: () => De(s), tone: yt(e), highlighted: _t(e) };
450
- if (typeof Xe == "function") return /* @__PURE__ */ t("div", { children: Xe(e, h) }, s);
451
- const { titleCol: p, subtitleCol: j, metaCol: b, valueCol: v, badgeCol: X } = Ht, Te = te(p ?? { key: r }, e) || s;
445
+ })(), Le = (e, n, s) => e ? typeof e.cell == "function" ? e.cell(n, s) : ae(n?.[e.key]) ? void 0 : te(e, n) : void 0, Ht = (e, n) => {
446
+ const s = ie(e, O + n), d = f && F.has(s), h = { index: O + n, key: xe(e, O + n), selected: d, toggle: () => De(s), tone: ft(e), highlighted: yt(e) };
447
+ if (typeof Qe == "function") return /* @__PURE__ */ t("div", { children: Qe(e, h) }, s);
448
+ const { titleCol: p, subtitleCol: j, metaCol: b, valueCol: v, badgeCol: X } = Xt, Te = te(p ?? { key: r }, e) || s;
452
449
  return /* @__PURE__ */ t(
453
450
  sa,
454
451
  {
455
452
  title: Le(p, e, n) ?? s,
456
453
  subtitle: Le(j, e, n),
457
454
  meta: b ? Le(b, e, n) : void 0,
458
- value: v ? /* @__PURE__ */ t(ze, { col: v, row: e, index: n }) : void 0,
459
- badge: X ? /* @__PURE__ */ t(ze, { col: X, row: e, index: n }) : void 0,
455
+ value: v ? /* @__PURE__ */ t(Ie, { col: v, row: e, index: n }) : void 0,
456
+ badge: X ? /* @__PURE__ */ t(Ie, { col: X, row: e, index: n }) : void 0,
460
457
  tone: h.tone,
461
458
  highlighted: h.highlighted,
462
- selected: u,
463
- href: typeof Ze == "function" ? Ze(e) : void 0,
464
- renderLink: Ft,
459
+ selected: d,
460
+ href: typeof Je == "function" ? Je(e) : void 0,
461
+ renderLink: Lt,
465
462
  onClick: typeof q == "function" ? () => q(e) : void 0,
466
- leading: f ? /* @__PURE__ */ t(_e, { checked: u, onChange: () => De(s), label: typeof m.selectRow == "function" ? m.selectRow(Te) : m.selectRow }) : void 0
463
+ leading: f ? /* @__PURE__ */ t(_e, { checked: d, onChange: () => De(s), label: typeof m.selectRow == "function" ? m.selectRow(Te) : m.selectRow }) : void 0
467
464
  },
468
465
  s
469
466
  );
470
467
  }, Fe = (() => {
471
468
  if (D) {
472
469
  if (re != null && c > 0) {
473
- const s = T === 0 ? 0 : _ * c + 1, u = Math.min(_ * c + P.length, re);
474
- return typeof m.range == "function" ? m.range(s, u, re) : /* @__PURE__ */ g(kt, { children: [
470
+ const s = T === 0 ? 0 : _ * c + 1, d = Math.min(_ * c + P.length, re);
471
+ return typeof m.range == "function" ? m.range(s, d, re) : /* @__PURE__ */ g(vt, { children: [
475
472
  /* @__PURE__ */ g("strong", { children: [
476
473
  s,
477
474
  "–",
478
- u
475
+ d
479
476
  ] }),
480
477
  " ",
481
478
  m.of,
@@ -487,7 +484,7 @@ function Ja({
487
484
  }
488
485
  if (T === 0) return m.noResults;
489
486
  const e = O + 1, n = Math.min(O + M, T);
490
- return typeof m.range == "function" ? m.range(e, n, T) : /* @__PURE__ */ g(kt, { children: [
487
+ return typeof m.range == "function" ? m.range(e, n, T) : /* @__PURE__ */ g(vt, { children: [
491
488
  /* @__PURE__ */ g("strong", { children: [
492
489
  e,
493
490
  "–",
@@ -498,35 +495,35 @@ function Ja({
498
495
  " ",
499
496
  /* @__PURE__ */ t("strong", { children: T })
500
497
  ] });
501
- })(), ta = f && me > 0 && J != null ? typeof J == "function" ? J({ count: me, selected: Ae(ut), clear: dt }) : J : null, aa = N ? /* @__PURE__ */ t(
498
+ })(), ea = f && me > 0 && J != null ? typeof J == "function" ? J({ count: me, selected: Ae(dt), clear: ct }) : J : null, ta = N ? /* @__PURE__ */ t(
502
499
  ra,
503
500
  {
504
501
  tone: "danger",
505
502
  title: typeof N == "string" ? N : N?.message ?? m.error,
506
503
  description: typeof N == "object" && N && !(N instanceof Error) && !N.message ? N : void 0,
507
- actions: typeof Qe == "function" ? [{ label: m.retry, onClick: Qe }] : void 0,
504
+ actions: typeof Ze == "function" ? [{ label: m.retry, onClick: Ze }] : void 0,
508
505
  className: "data-grid__error"
509
506
  }
510
507
  ) : null;
511
- return /* @__PURE__ */ g("div", { className: Qt, children: [
508
+ return /* @__PURE__ */ g("div", { className: Zt, children: [
512
509
  (A || W || ke?.length > 0) && /* @__PURE__ */ g("div", { className: "data-grid__header", children: [
513
510
  /* @__PURE__ */ g("div", { className: "data-grid__titles", children: [
514
511
  A && /* @__PURE__ */ t("h3", { className: "data-grid__title", children: A }),
515
512
  W && /* @__PURE__ */ t("p", { className: "data-grid__subtitle", children: W })
516
513
  ] }),
517
- ke?.length > 0 && /* @__PURE__ */ t("div", { className: "data-grid__actions", children: ke.map((e, n) => e.label ? /* @__PURE__ */ t(fe, { size: "sm", variant: e.variant === "primary" ? "primary" : "secondary", icon: e.icon, onClick: () => Ue?.(e.label), children: e.label }, e.label ?? n) : /* @__PURE__ */ t(
514
+ ke?.length > 0 && /* @__PURE__ */ t("div", { className: "data-grid__actions", children: ke.map((e, n) => e.label ? /* @__PURE__ */ t(fe, { size: "sm", variant: e.variant === "primary" ? "primary" : "secondary", icon: e.icon, onClick: () => Ke?.(e.label), children: e.label }, e.label ?? n) : /* @__PURE__ */ t(
518
515
  ee,
519
516
  {
520
517
  size: "sm",
521
518
  variant: e.variant === "primary" ? "primary" : "secondary",
522
519
  icon: e.icon,
523
520
  label: e.ariaLabel ?? m.action,
524
- onClick: () => Ue?.(e.label)
521
+ onClick: () => Ke?.(e.label)
525
522
  },
526
523
  n
527
524
  )) })
528
525
  ] }),
529
- Jt && /* @__PURE__ */ g("div", { className: "data-grid__controls", children: [
526
+ qt && /* @__PURE__ */ g("div", { className: "data-grid__controls", children: [
530
527
  l && /* @__PURE__ */ g("div", { className: "data-grid__search", role: "search", children: [
531
528
  /* @__PURE__ */ t(Nt, { name: "search", size: 15 }),
532
529
  /* @__PURE__ */ t(
@@ -534,41 +531,41 @@ function Ja({
534
531
  {
535
532
  type: "search",
536
533
  value: V,
537
- placeholder: gt,
538
- "aria-label": gt.replace(/…$/, ""),
534
+ placeholder: mt,
535
+ "aria-label": mt.replace(/…$/, ""),
539
536
  onChange: (e) => {
540
- le(e.target.value), z(0);
537
+ le(e.target.value), I(0);
541
538
  },
542
539
  onKeyDown: (e) => e.key === "Escape" && V && (e.preventDefault(), le(""))
543
540
  }
544
541
  ),
545
- V && /* @__PURE__ */ t(ca, { icon: /* @__PURE__ */ t(Sa, {}), label: m.clearSearch, appearance: "clear", className: "data-grid__search-clear", onClick: () => le("") })
542
+ V && /* @__PURE__ */ t(ca, { icon: /* @__PURE__ */ t(Ca, {}), label: m.clearSearch, appearance: "clear", className: "data-grid__search-clear", onClick: () => le("") })
546
543
  ] }),
547
544
  Ce.map((e) => {
548
- const n = (e.options ?? []).map(va), s = oe[e.key] ?? "", u = e.type === "select" || e.type !== "pills" && n.length > 5, h = e.allLabel ?? (u ? typeof m.allOf == "function" ? m.allOf(e.label ?? e.key) : m.allOf : m.all);
549
- return u ? /* @__PURE__ */ g(Pe, { label: e.label ?? e.key, value: s, onChange: (p) => mt(e.key, p), children: [
545
+ const n = (e.options ?? []).map(ka), s = oe[e.key] ?? "", d = e.type === "select" || e.type !== "pills" && n.length > 5, h = e.allLabel ?? (d ? typeof m.allOf == "function" ? m.allOf(e.label ?? e.key) : m.allOf : m.all);
546
+ return d ? /* @__PURE__ */ g(Pe, { label: e.label ?? e.key, value: s, onChange: (p) => ut(e.key, p), children: [
550
547
  /* @__PURE__ */ t("option", { value: "", children: h }),
551
548
  n.map((p) => /* @__PURE__ */ t("option", { value: String(p.value), children: p.label }, String(p.value)))
552
549
  ] }, e.key) : /* @__PURE__ */ t("div", { className: "data-grid__pills", role: "group", "aria-label": e.label ?? e.key, children: [{ value: "", label: h }, ...n].map((p) => {
553
550
  const j = String(s) === String(p.value);
554
- return /* @__PURE__ */ g("button", { type: "button", className: "data-grid__pill", "aria-pressed": j, onClick: () => mt(e.key, p.value), children: [
551
+ return /* @__PURE__ */ g("button", { type: "button", className: "data-grid__pill", "aria-pressed": j, onClick: () => ut(e.key, p.value), children: [
555
552
  p.label,
556
- e.counts !== !1 && /* @__PURE__ */ t("span", { className: "data-grid__pill-count", children: p.value === "" ? I.length : qt(e, p.value) })
553
+ e.counts !== !1 && /* @__PURE__ */ t("span", { className: "data-grid__pill-count", children: p.value === "" ? z.length : Yt(e, p.value) })
557
554
  ] }, String(p.value));
558
555
  }) }, e.key);
559
556
  }),
560
- Ke === "stack" && ht.length > 0 && /* @__PURE__ */ t("span", { className: "data-grid__sort-mobile", children: /* @__PURE__ */ g(
557
+ Be === "stack" && gt.length > 0 && /* @__PURE__ */ t("span", { className: "data-grid__sort-mobile", children: /* @__PURE__ */ g(
561
558
  Pe,
562
559
  {
563
560
  label: m.sortBy,
564
561
  value: C ? `${C.key}:${C.dir}` : "",
565
562
  onChange: (e) => {
566
- const [n, s] = e.split(":"), u = n ? { key: n, dir: s } : null;
567
- E || (tt(u), z(0)), Ve?.(u, u?.key ?? null, u?.dir ?? null);
563
+ const [n, s] = e.split(":"), d = n ? { key: n, dir: s } : null;
564
+ E || (et(d), I(0)), Ue?.(d, d?.key ?? null, d?.dir ?? null);
568
565
  },
569
566
  children: [
570
567
  /* @__PURE__ */ t("option", { value: "", children: m.sortDefault }),
571
- ht.flatMap((e) => [
568
+ gt.flatMap((e) => [
572
569
  /* @__PURE__ */ g("option", { value: `${e.key}:asc`, children: [
573
570
  Se(e),
574
571
  " ↑"
@@ -581,18 +578,18 @@ function Ja({
581
578
  ]
582
579
  }
583
580
  ) }),
584
- Ee && /* @__PURE__ */ t("span", { className: "data-grid__result", "aria-live": "polite", children: typeof m.resultCount == "function" ? m.resultCount(T, I.length) : `${T} / ${I.length}` })
581
+ Ee && /* @__PURE__ */ t("span", { className: "data-grid__result", "aria-live": "polite", children: typeof m.resultCount == "function" ? m.resultCount(T, z.length) : `${T} / ${z.length}` })
585
582
  ] }),
586
583
  f && me > 0 && J == null && /* @__PURE__ */ g("div", { className: "data-grid__bulk", role: "region", "aria-label": m.bulkActions, children: [
587
584
  /* @__PURE__ */ t("span", { className: "data-grid__bulk-count", "aria-live": "polite", children: typeof m.selected == "function" ? m.selected(me) : m.selected }),
588
- ($ ?? []).map((e, n) => /* @__PURE__ */ t(fe, { size: "sm", tone: e.tone === "danger" ? "danger" : void 0, icon: e.icon, onClick: () => Et?.(e.label, Ae(ut)), children: e.label }, e.label ?? n)),
589
- /* @__PURE__ */ t(fe, { variant: "ghost", size: "sm", onClick: dt, children: m.clear })
585
+ ($ ?? []).map((e, n) => /* @__PURE__ */ t(fe, { size: "sm", tone: e.tone === "danger" ? "danger" : void 0, icon: e.icon, onClick: () => Dt?.(e.label, Ae(dt)), children: e.label }, e.label ?? n)),
586
+ /* @__PURE__ */ t(fe, { variant: "ghost", size: "sm", onClick: ct, children: m.clear })
590
587
  ] }),
591
- aa,
592
- !N && /* @__PURE__ */ t("div", { className: `data-grid__frame${Kt}`, children: /* @__PURE__ */ t(
588
+ ta,
589
+ !N && /* @__PURE__ */ t("div", { className: `data-grid__frame${Bt}`, children: /* @__PURE__ */ t(
593
590
  "div",
594
591
  {
595
- ref: st,
592
+ ref: rt,
596
593
  className: "data-grid__scroll",
597
594
  style: U ? { maxHeight: typeof U == "number" ? `${U}px` : U } : void 0,
598
595
  tabIndex: 0,
@@ -602,32 +599,32 @@ function Ja({
602
599
  children: /* @__PURE__ */ g("table", { className: "data-grid__table", children: [
603
600
  (ne || A) && /* @__PURE__ */ t("caption", { className: "data-grid__select-label", children: ne ?? A }),
604
601
  /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ g("tr", { children: [
605
- f && /* @__PURE__ */ t("th", { className: "data-grid__th data-grid__check-cell", scope: "col", children: /* @__PURE__ */ t(_e, { checked: Y, indeterminate: ot, onChange: ct, label: Y ? m.deselectAll : m.selectAll }) }),
602
+ f && /* @__PURE__ */ t("th", { className: "data-grid__th data-grid__check-cell", scope: "col", children: /* @__PURE__ */ t(_e, { checked: Y, indeterminate: lt, onChange: ot, label: Y ? m.deselectAll : m.selectAll }) }),
606
603
  k.map((e) => {
607
- const n = he(e), s = e.sortable !== !1, u = C?.key === e.key ? C.dir === "desc" ? "descending" : "ascending" : s ? "none" : void 0, h = e.width != null ? typeof e.width == "number" ? `${e.width}px` : e.width : void 0, p = e.minWidth != null ? typeof e.minWidth == "number" ? `${e.minWidth}px` : e.minWidth : h;
604
+ const n = he(e), s = e.sortable !== !1, d = C?.key === e.key ? C.dir === "desc" ? "descending" : "ascending" : s ? "none" : void 0, h = e.width != null ? typeof e.width == "number" ? `${e.width}px` : e.width : void 0, p = e.minWidth != null ? typeof e.minWidth == "number" ? `${e.minWidth}px` : e.minWidth : h;
608
605
  return /* @__PURE__ */ t(
609
606
  "th",
610
607
  {
611
608
  scope: "col",
612
609
  className: `data-grid__th${n !== "left" ? ` is-${n}` : ""}${e.key === Oe ? " is-primary" : ""}`,
613
610
  style: h || p ? { width: h, minWidth: p } : void 0,
614
- "aria-sort": u,
615
- children: s ? /* @__PURE__ */ g("button", { type: "button", className: "data-grid__sort", onClick: () => Gt(e), children: [
611
+ "aria-sort": d,
612
+ children: s ? /* @__PURE__ */ g("button", { type: "button", className: "data-grid__sort", onClick: () => Vt(e), children: [
616
613
  /* @__PURE__ */ t("span", { children: e.header ?? e.label ?? e.key }),
617
- /* @__PURE__ */ t(Na, {})
614
+ /* @__PURE__ */ t(xa, {})
618
615
  ] }) : e.header ?? e.label ?? e.key
619
616
  },
620
617
  e.key
621
618
  );
622
619
  })
623
620
  ] }) }),
624
- /* @__PURE__ */ t("tbody", { children: L ? Array.from({ length: bt }, (e, n) => /* @__PURE__ */ g("tr", { className: "data-grid__row data-grid__row--loading", "aria-hidden": "true", children: [
621
+ /* @__PURE__ */ t("tbody", { children: L ? Array.from({ length: _t }, (e, n) => /* @__PURE__ */ g("tr", { className: "data-grid__row data-grid__row--loading", "aria-hidden": "true", children: [
625
622
  f && /* @__PURE__ */ t("td", { className: "data-grid__td data-grid__check-cell", children: /* @__PURE__ */ t(pe, { width: 16, height: 16, radius: 5 }) }),
626
- k.map((s, u) => /* @__PURE__ */ t("td", { className: `data-grid__td${he(s) !== "left" ? ` is-${he(s)}` : ""}${s.key === Oe ? " is-primary" : ""}`, children: /* @__PURE__ */ t(pe, { width: `${St[(n + u) % St.length]}%`, height: 10, radius: 5, className: "data-grid__skeleton" }) }, s.key))
627
- ] }, `sk-${n}`)) : P.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { className: "data-grid__td data-grid__empty", colSpan: Zt, children: vt }) }) : P.map((e, n) => {
628
- const s = ie(e, O + n), u = f && F.has(s), h = typeof q == "function", p = yt(e), j = _t(e), b = [
623
+ k.map((s, d) => /* @__PURE__ */ t("td", { className: `data-grid__td${he(s) !== "left" ? ` is-${he(s)}` : ""}${s.key === Oe ? " is-primary" : ""}`, children: /* @__PURE__ */ t(pe, { width: `${St[(n + d) % St.length]}%`, height: 10, radius: 5, className: "data-grid__skeleton" }) }, s.key))
624
+ ] }, `sk-${n}`)) : P.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { className: "data-grid__td data-grid__empty", colSpan: Jt, children: bt }) }) : P.map((e, n) => {
625
+ const s = ie(e, O + n), d = f && F.has(s), h = typeof q == "function", p = ft(e), j = yt(e), b = [
629
626
  "data-grid__row",
630
- u && "is-selected",
627
+ d && "is-selected",
631
628
  h && "is-clickable",
632
629
  p && `is-tone-${p}`,
633
630
  j && "is-lit"
@@ -636,7 +633,7 @@ function Ja({
636
633
  "tr",
637
634
  {
638
635
  className: b,
639
- "aria-selected": f ? u : void 0,
636
+ "aria-selected": f ? d : void 0,
640
637
  tabIndex: h ? 0 : void 0,
641
638
  onClick: h ? () => q(e) : void 0,
642
639
  onKeyDown: h ? (v) => {
@@ -646,7 +643,7 @@ function Ja({
646
643
  f && /* @__PURE__ */ t("td", { className: "data-grid__td data-grid__check-cell", children: /* @__PURE__ */ t(
647
644
  _e,
648
645
  {
649
- checked: u,
646
+ checked: d,
650
647
  onChange: () => De(s),
651
648
  label: typeof m.selectRow == "function" ? m.selectRow(te(k[0] ?? { key: r }, e) || s) : m.selectRow
652
649
  }
@@ -659,7 +656,7 @@ function Ja({
659
656
  (v.numeric || Re.has(v.type)) && "is-num",
660
657
  v.wrap && "is-wrap"
661
658
  ].filter(Boolean).join(" ");
662
- return /* @__PURE__ */ t("td", { className: Te, "data-label": Se(v), children: /* @__PURE__ */ t(ze, { col: v, row: e, index: O + n }) }, v.key);
659
+ return /* @__PURE__ */ t("td", { className: Te, "data-label": Se(v), children: /* @__PURE__ */ t(Ie, { col: v, row: e, index: O + n }) }, v.key);
663
660
  })
664
661
  ]
665
662
  },
@@ -670,20 +667,20 @@ function Ja({
670
667
  }
671
668
  ) }),
672
669
  Me && !N && /* @__PURE__ */ g("div", { className: "data-grid__cards", "aria-busy": L || void 0, children: [
673
- f && Xt && P.length > 0 && /* @__PURE__ */ g("label", { className: "data-grid__cards-all", children: [
674
- /* @__PURE__ */ t(_e, { checked: Y, indeterminate: ot, onChange: ct, label: Y ? m.deselectAll : m.selectAll }),
670
+ f && Qt && P.length > 0 && /* @__PURE__ */ g("label", { className: "data-grid__cards-all", children: [
671
+ /* @__PURE__ */ t(_e, { checked: Y, indeterminate: lt, onChange: ot, label: Y ? m.deselectAll : m.selectAll }),
675
672
  /* @__PURE__ */ t("span", { "aria-hidden": "true", children: m.selectAllShort })
676
673
  ] }),
677
- L ? /* @__PURE__ */ t("div", { className: "data-grid__cards-loading", "aria-label": m.loading, children: Array.from({ length: Math.min(bt, 5) }, (e, n) => /* @__PURE__ */ g("div", { className: "data-grid__card-skeleton", "aria-hidden": "true", children: [
674
+ L ? /* @__PURE__ */ t("div", { className: "data-grid__cards-loading", "aria-label": m.loading, children: Array.from({ length: Math.min(_t, 5) }, (e, n) => /* @__PURE__ */ g("div", { className: "data-grid__card-skeleton", "aria-hidden": "true", children: [
678
675
  /* @__PURE__ */ t(pe, { width: "58%", height: 12, radius: 6 }),
679
676
  /* @__PURE__ */ t(pe, { width: "36%", height: 10, radius: 5 })
680
- ] }, n)) }) : P.length === 0 ? /* @__PURE__ */ t("div", { className: "data-grid__cards-empty", children: vt }) : /* @__PURE__ */ t(ia, { ariaLabel: A ?? ne ?? m.table, children: P.map((e, n) => ea(e, n)) })
677
+ ] }, n)) }) : P.length === 0 ? /* @__PURE__ */ t("div", { className: "data-grid__cards-empty", children: bt }) : /* @__PURE__ */ t(ia, { ariaLabel: A ?? ne ?? m.table, children: P.map((e, n) => Ht(e, n)) })
681
678
  ] }),
682
679
  D && R > 1 && !N && /* @__PURE__ */ g("nav", { className: "data-grid__footer data-grid__footer--center", "aria-label": m.pagination, children: [
683
680
  Fe != null && /* @__PURE__ */ t("span", { className: "data-grid__range", "aria-live": "polite", children: Fe }),
684
681
  /* @__PURE__ */ g("span", { className: "data-grid__page-btns", children: [
685
682
  /* @__PURE__ */ t(ee, { size: "sm", icon: "chevron-left", label: m.previous, tooltip: !1, disabled: _ === 0 || L, onClick: () => Z(_ - 1) }),
686
- Ma(_ + 1, R).map(
683
+ Oa(_ + 1, R).map(
687
684
  (e) => typeof e == "string" ? /* @__PURE__ */ t("span", { className: "data-grid__page-gap", "aria-hidden": "true", children: "…" }, e) : /* @__PURE__ */ t(
688
685
  "button",
689
686
  {
@@ -704,18 +701,18 @@ function Ja({
704
701
  !D && M > 0 && !N && /* @__PURE__ */ g("div", { className: "data-grid__footer", children: [
705
702
  /* @__PURE__ */ t("span", { className: "data-grid__range", "aria-live": "polite", children: Fe }),
706
703
  /* @__PURE__ */ g("div", { className: "data-grid__pager", children: [
707
- pt.length > 1 && /* @__PURE__ */ g("span", { className: "data-grid__per-page", children: [
704
+ ht.length > 1 && /* @__PURE__ */ g("span", { className: "data-grid__per-page", children: [
708
705
  /* @__PURE__ */ t("span", { className: "data-grid__per-page-label", "aria-hidden": !0, children: m.rowsPerPage }),
709
706
  /* @__PURE__ */ t(
710
707
  Pe,
711
708
  {
712
709
  small: !0,
713
710
  label: m.rowsPerPage,
714
- value: String(at),
711
+ value: String(tt),
715
712
  onChange: (e) => {
716
- nt(Number(e)), z(0);
713
+ at(Number(e)), I(0);
717
714
  },
718
- children: pt.map((e) => /* @__PURE__ */ t("option", { value: e, children: e }, e))
715
+ children: ht.map((e) => /* @__PURE__ */ t("option", { value: e, children: e }, e))
719
716
  }
720
717
  )
721
718
  ] }),
@@ -726,10 +723,10 @@ function Ja({
726
723
  ] })
727
724
  ] })
728
725
  ] }),
729
- ta
726
+ ea
730
727
  ] });
731
728
  }
732
729
  export {
733
- Ea as DATA_GRID_LABELS,
734
- Ja as default
730
+ Ma as DATA_GRID_LABELS,
731
+ Qa as default
735
732
  };