@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.
- package/COPY-PASTE.md +109 -0
- package/README.md +9 -75
- package/dist/app/components/Dashboard/dashboardRegistry.cjs +1 -1
- package/dist/app/components/Dashboard/dashboardRegistry.mjs +202 -201
- package/dist/app/components/Table/DataTable.cjs +1 -1
- package/dist/app/components/Table/DataTable.mjs +46 -49
- package/dist/app/components/ai/ConfidenceSuggestions/ConfidenceSuggestions.cjs +1 -1
- package/dist/app/components/ai/ConfidenceSuggestions/ConfidenceSuggestions.mjs +53 -53
- package/dist/app/components/ai/ProposalCard/ProposalCard.cjs +1 -1
- package/dist/app/components/ai/ProposalCard/ProposalCard.mjs +227 -227
- package/dist/app/components/ai/ReviewTable/ReviewTable.cjs +1 -1
- package/dist/app/components/ai/ReviewTable/ReviewTable.mjs +81 -81
- package/dist/app/components/ai/SuggestionChecklist/SuggestionChecklist.cjs +1 -1
- package/dist/app/components/ai/SuggestionChecklist/SuggestionChecklist.mjs +15 -14
- package/dist/app/components/ui/AuthSection/AuthSection.cjs +1 -1
- package/dist/app/components/ui/AuthSection/AuthSection.mjs +19 -18
- package/dist/app/components/ui/Checkbox/Checkbox.cjs +1 -0
- package/dist/app/components/ui/Checkbox/Checkbox.css +1 -0
- package/dist/app/components/ui/Checkbox/Checkbox.mjs +87 -0
- package/dist/app/components/ui/DataGrid/DataGrid.cjs +1 -1
- package/dist/app/components/ui/DataGrid/DataGrid.mjs +196 -199
- package/dist/app/components/ui/PreviewConfirmDialog/PreviewConfirmDialog.cjs +1 -1
- package/dist/app/components/ui/PreviewConfirmDialog/PreviewConfirmDialog.mjs +47 -48
- package/dist/browser/pixstella.esm.js +70 -70
- package/dist/browser/pixstella.standalone.js +72 -72
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.mjs +2886 -2884
- package/dist/registry/files/174512e8f294ad2f +101 -0
- package/dist/registry/files/4c7e419c8caf02c3 +119 -0
- package/dist/registry/files/{f23e788832b45fc0 → 67ac8b4abe3fc564} +2 -1
- package/dist/registry/files/{e84f443f3fc3f261 → 995feaa023211faf} +4 -8
- package/dist/registry/files/{5ba71aa83263995e → a27872a7d58aeb58} +4 -5
- package/dist/registry/files/{162078d04cb26276 → df919b524be27e88} +4 -5
- package/dist/registry/index.json +1 -1
- package/dist/styles.css +3 -0
- package/package.json +3 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsxs as g, Fragment as
|
|
2
|
-
import { useId as
|
|
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
|
|
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
|
-
|
|
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
|
|
56
|
-
function
|
|
56
|
+
const ze = /* @__PURE__ */ new Map();
|
|
57
|
+
function ya(a, i) {
|
|
57
58
|
const r = a + JSON.stringify(i);
|
|
58
|
-
return
|
|
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
|
|
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
|
|
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
|
|
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
|
|
78
|
-
const r = String(a ?? ""), l = i?.[r] ?? i?.[r.toLowerCase()] ??
|
|
79
|
-
return
|
|
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
|
|
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
|
|
94
|
-
return ye(o, { style: "currency", currency:
|
|
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
|
|
98
|
-
return ye(o, { style: "percent", maximumFractionDigits: l.decimals ?? 1 }).format(
|
|
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
|
|
102
|
-
return `${
|
|
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
|
|
106
|
-
if (!
|
|
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
|
|
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
|
|
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 (
|
|
130
|
-
if (a.type === "date") return
|
|
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
|
|
139
|
-
function
|
|
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,
|
|
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
|
|
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,
|
|
153
|
-
const c = Math.max(0, Math.min(1, l -
|
|
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
|
-
] },
|
|
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
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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--${
|
|
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 =
|
|
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" }) :
|
|
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" ?
|
|
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" ?
|
|
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(
|
|
212
|
+
return /* @__PURE__ */ t(Da, { values: l, mode: o.color ?? "accent" });
|
|
212
213
|
case "rating":
|
|
213
|
-
return /* @__PURE__ */ t(
|
|
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${
|
|
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:
|
|
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
|
-
|
|
233
|
-
y && /* @__PURE__ */ t(
|
|
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(
|
|
240
|
-
|
|
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 ?
|
|
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
|
-
|
|
251
|
-
|
|
252
|
-
o.current && (o.current.indeterminate = !!i);
|
|
253
|
-
}, [i]), /* @__PURE__ */ t(
|
|
254
|
-
"input",
|
|
251
|
+
return /* @__PURE__ */ t(
|
|
252
|
+
ha,
|
|
255
253
|
{
|
|
256
|
-
|
|
257
|
-
type: "checkbox",
|
|
254
|
+
size: "sm",
|
|
258
255
|
className: "data-grid__check",
|
|
259
256
|
checked: !!a,
|
|
260
|
-
|
|
257
|
+
indeterminate: !!i,
|
|
261
258
|
"aria-label": l,
|
|
262
259
|
onChange: r,
|
|
263
|
-
onClick: (
|
|
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: (
|
|
271
|
-
/* @__PURE__ */ t(
|
|
267
|
+
/* @__PURE__ */ t("select", { value: a, onChange: (u) => i(u.target.value), children: l }),
|
|
268
|
+
/* @__PURE__ */ t(Sa, {})
|
|
272
269
|
] });
|
|
273
270
|
}
|
|
274
|
-
const
|
|
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
|
|
307
|
-
if (i <= 7) return Array.from({ length: i }, (
|
|
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((
|
|
310
|
-
const l = [...r].filter((
|
|
311
|
-
return l.forEach((
|
|
312
|
-
c > 0 &&
|
|
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
|
|
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:
|
|
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:
|
|
333
|
+
responsive: Be = "scroll",
|
|
337
334
|
caption: ne,
|
|
338
|
-
className:
|
|
339
|
-
onBulkAction:
|
|
340
|
-
onAction:
|
|
335
|
+
className: wt = "",
|
|
336
|
+
onBulkAction: Dt,
|
|
337
|
+
onAction: Ke,
|
|
341
338
|
onRowClick: q,
|
|
342
|
-
onSelectionChange:
|
|
343
|
-
onSortChange:
|
|
339
|
+
onSelectionChange: Et,
|
|
340
|
+
onSortChange: Ue,
|
|
344
341
|
// ---- controlled / server-side mode
|
|
345
342
|
serverSide: E = !1,
|
|
346
|
-
page:
|
|
347
|
-
pageCount:
|
|
348
|
-
onPageChange:
|
|
343
|
+
page: Mt,
|
|
344
|
+
pageCount: Ve,
|
|
345
|
+
onPageChange: Ge,
|
|
349
346
|
totalRows: re,
|
|
350
347
|
selected: se,
|
|
351
|
-
onSelectedChange:
|
|
348
|
+
onSelectedChange: Ot,
|
|
352
349
|
// ---- rows
|
|
353
|
-
rowTone:
|
|
354
|
-
rowHighlighted:
|
|
355
|
-
rowHref:
|
|
356
|
-
renderLink:
|
|
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:
|
|
357
|
+
loadingRows: Ft,
|
|
361
358
|
error: N,
|
|
362
|
-
onRetry:
|
|
363
|
-
empty:
|
|
359
|
+
onRetry: Ze,
|
|
360
|
+
empty: Tt,
|
|
364
361
|
// ---- phones
|
|
365
362
|
stickyFirstColumn: Ne = "narrow",
|
|
366
|
-
mobile:
|
|
367
|
-
renderCard:
|
|
368
|
-
labels:
|
|
363
|
+
mobile: Rt = "scroll",
|
|
364
|
+
renderCard: Qe,
|
|
365
|
+
labels: Wt
|
|
369
366
|
}) {
|
|
370
|
-
const zt =
|
|
371
|
-
|
|
372
|
-
c > 0 &&
|
|
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
|
|
375
|
-
|
|
376
|
-
const e =
|
|
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
|
|
380
|
-
|
|
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),
|
|
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
|
|
391
|
-
return Array.isArray(
|
|
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 ??
|
|
394
|
-
return
|
|
395
|
-
for (const
|
|
396
|
-
return e ? n.some((
|
|
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
|
-
}, [
|
|
395
|
+
}, [z, k, V, oe, o, r]), ue = H(() => {
|
|
399
396
|
if (E) return de;
|
|
400
|
-
const e = C &&
|
|
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" ? (
|
|
403
|
-
return de.map((
|
|
404
|
-
}, [de, C,
|
|
405
|
-
(ce ? se : []).forEach((e) => ge.set(String(e), e)),
|
|
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 ||
|
|
404
|
+
ce || jt(e);
|
|
408
405
|
const n = Ae([...e]);
|
|
409
|
-
|
|
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
|
-
},
|
|
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
|
-
},
|
|
417
|
-
const n =
|
|
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 || (
|
|
420
|
-
},
|
|
421
|
-
|
|
422
|
-
},
|
|
423
|
-
le(""),
|
|
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 ||
|
|
426
|
-
},
|
|
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
|
-
|
|
432
|
-
|
|
428
|
+
Be === "stack" && "data-grid--stack",
|
|
429
|
+
pt && `data-grid--sticky-first-${pt}`,
|
|
433
430
|
Me && "data-grid--cards",
|
|
434
|
-
|
|
435
|
-
].filter(Boolean).join(" "), he = (e) => e.align ?? (Re.has(e.type) || e.numeric ? "right" : "left"), Oe = k[0]?.key,
|
|
436
|
-
const n = typeof
|
|
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
|
-
},
|
|
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:
|
|
442
|
-
] }), Q = (e, n) => k.find((s) => s.card === e) ?? (n ? k.find((s) => s.card !== !1 && n(s)) : void 0),
|
|
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"),
|
|
445
|
-
|
|
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,
|
|
449
|
-
const s = ie(e, O + n),
|
|
450
|
-
if (typeof
|
|
451
|
-
const { titleCol: p, subtitleCol: j, metaCol: b, valueCol: v, badgeCol: X } =
|
|
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(
|
|
459
|
-
badge: X ? /* @__PURE__ */ t(
|
|
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:
|
|
463
|
-
href: typeof
|
|
464
|
-
renderLink:
|
|
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:
|
|
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,
|
|
474
|
-
return typeof m.range == "function" ? m.range(s,
|
|
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
|
-
|
|
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(
|
|
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
|
-
})(),
|
|
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
|
|
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:
|
|
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: () =>
|
|
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: () =>
|
|
521
|
+
onClick: () => Ke?.(e.label)
|
|
525
522
|
},
|
|
526
523
|
n
|
|
527
524
|
)) })
|
|
528
525
|
] }),
|
|
529
|
-
|
|
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:
|
|
538
|
-
"aria-label":
|
|
534
|
+
placeholder: mt,
|
|
535
|
+
"aria-label": mt.replace(/…$/, ""),
|
|
539
536
|
onChange: (e) => {
|
|
540
|
-
le(e.target.value),
|
|
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(
|
|
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(
|
|
549
|
-
return
|
|
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: () =>
|
|
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 === "" ?
|
|
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
|
-
|
|
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(":"),
|
|
567
|
-
E || (
|
|
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
|
-
|
|
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,
|
|
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: () =>
|
|
589
|
-
/* @__PURE__ */ t(fe, { variant: "ghost", size: "sm", onClick:
|
|
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
|
-
|
|
592
|
-
!N && /* @__PURE__ */ t("div", { className: `data-grid__frame${
|
|
588
|
+
ta,
|
|
589
|
+
!N && /* @__PURE__ */ t("div", { className: `data-grid__frame${Bt}`, children: /* @__PURE__ */ t(
|
|
593
590
|
"div",
|
|
594
591
|
{
|
|
595
|
-
ref:
|
|
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:
|
|
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,
|
|
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":
|
|
615
|
-
children: s ? /* @__PURE__ */ g("button", { type: "button", className: "data-grid__sort", onClick: () =>
|
|
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(
|
|
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:
|
|
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,
|
|
627
|
-
] }, `sk-${n}`)) : P.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { className: "data-grid__td data-grid__empty", colSpan:
|
|
628
|
-
const s = ie(e, O + n),
|
|
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
|
-
|
|
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 ?
|
|
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:
|
|
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(
|
|
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 &&
|
|
674
|
-
/* @__PURE__ */ t(_e, { checked: Y, indeterminate:
|
|
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(
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
711
|
+
value: String(tt),
|
|
715
712
|
onChange: (e) => {
|
|
716
|
-
|
|
713
|
+
at(Number(e)), I(0);
|
|
717
714
|
},
|
|
718
|
-
children:
|
|
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
|
-
|
|
726
|
+
ea
|
|
730
727
|
] });
|
|
731
728
|
}
|
|
732
729
|
export {
|
|
733
|
-
|
|
734
|
-
|
|
730
|
+
Ma as DATA_GRID_LABELS,
|
|
731
|
+
Qa as default
|
|
735
732
|
};
|