@logicplanes/kaeso-ui 0.4.5 → 0.4.7
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/ai/component-guides.md +1 -1
- package/ai/component-registry.json +1 -1
- package/ai/component-registry.md +1 -1
- package/ai/icons.md +1 -1
- package/ai/tokens.md +1 -1
- package/dist/blocks/pages.js +2 -2
- package/dist/blocks/resource-list.js +1 -1
- package/dist/chunks/{app-frame-DysOel2X.js → app-frame-CfJ7s3Q0.js} +2 -2
- package/dist/chunks/{app-frame-DysOel2X.js.map → app-frame-CfJ7s3Q0.js.map} +1 -1
- package/dist/chunks/{core-CmK-8ObW.js → core-B0bULn-t.js} +9 -8
- package/dist/chunks/core-B0bULn-t.js.map +1 -0
- package/dist/chunks/data-table-z7z6DqMJ.js +602 -0
- package/dist/chunks/data-table-z7z6DqMJ.js.map +1 -0
- package/dist/chunks/{domain-obd_w9xk.js → domain-BsM9UmAg.js} +2 -2
- package/dist/chunks/{domain-obd_w9xk.js.map → domain-BsM9UmAg.js.map} +1 -1
- package/dist/chunks/{identity-3Foi5F8w.js → identity-BQoh-UpW.js} +7 -3
- package/dist/chunks/identity-BQoh-UpW.js.map +1 -0
- package/dist/chunks/{list-B4G-sWwV.js → list-CU_AoVY3.js} +115 -92
- package/dist/chunks/list-CU_AoVY3.js.map +1 -0
- package/dist/chunks/{page-header-kS5tdmvb.js → page-header-BQijP6Rp.js} +2 -2
- package/dist/chunks/{page-header-kS5tdmvb.js.map → page-header-BQijP6Rp.js.map} +1 -1
- package/dist/chunks/{theme-provider-DJhORMlc.js → theme-provider-BjXTggqM.js} +6 -2
- package/dist/chunks/theme-provider-BjXTggqM.js.map +1 -0
- package/dist/chunks/{timeseries-Ck-q0wWn.js → timeseries-nDviPxvQ.js} +3 -3
- package/dist/chunks/{timeseries-Ck-q0wWn.js.map → timeseries-nDviPxvQ.js.map} +1 -1
- package/dist/components/app-frame.js +1 -1
- package/dist/components/charts/bar.js +2 -2
- package/dist/components/charts/donut.js +1 -1
- package/dist/components/charts/gauge.js +1 -1
- package/dist/components/charts/heatmap.js +1 -1
- package/dist/components/charts/sankey.js +2 -2
- package/dist/components/charts/timeseries.js +1 -1
- package/dist/components/charts.js +2 -2
- package/dist/components/data-table.js +1 -1
- package/dist/components/kaeso/identity.js +1 -1
- package/dist/components/kaeso/usage.js +1 -1
- package/dist/components/kaeso.js +3 -3
- package/dist/components/kaeso.js.map +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/page-header.js +1 -1
- package/dist/components/playground.js +1 -1
- package/dist/components/theme-menu.js +1 -1
- package/dist/components/theme-select.js +1 -1
- package/dist/components/toast.js +40 -38
- package/dist/components/toast.js.map +1 -1
- package/dist/index.js +8 -8
- package/dist/kaeso.css +8 -0
- package/dist/styles.css +1 -1
- package/dist/theme.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/core-CmK-8ObW.js.map +0 -1
- package/dist/chunks/data-table-CqY8_6IS.js +0 -581
- package/dist/chunks/data-table-CqY8_6IS.js.map +0 -1
- package/dist/chunks/identity-3Foi5F8w.js.map +0 -1
- package/dist/chunks/list-B4G-sWwV.js.map +0 -1
- package/dist/chunks/theme-provider-DJhORMlc.js.map +0 -1
|
@@ -1,581 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { t as e } from "./cn-BjnOAUrA.js";
|
|
3
|
-
import { a as t, i as n, o as r } from "./inset-BUzyXLK4.js";
|
|
4
|
-
import { i } from "./context-BELWW79w.js";
|
|
5
|
-
import { formatDate as a, formatDuration as o, formatNumber as s, formatRelative as c, formatTokens as l, formatUSD as u } from "../format.js";
|
|
6
|
-
import { t as ee } from "./icon-CBzOwqrX.js";
|
|
7
|
-
import { r as d } from "./tooltip-Tkm-urbi.js";
|
|
8
|
-
import { t as te } from "./observe-resize-DhxhmoyB.js";
|
|
9
|
-
import { r as ne } from "./text-DkKdTVUf.js";
|
|
10
|
-
import { n as re } from "./button-IblhXUyZ.js";
|
|
11
|
-
import { n as ie } from "./checkbox-9tbimmF3.js";
|
|
12
|
-
import { t as f } from "./menu-Clvv6ftq.js";
|
|
13
|
-
import { r as ae } from "./skeleton-D-qk3mes.js";
|
|
14
|
-
import { r as oe } from "./pagination-D7fAm8qg.js";
|
|
15
|
-
import { t as se } from "./empty-BpiUgGzm.js";
|
|
16
|
-
import { t as p } from "./truncated-d1afmUJT.js";
|
|
17
|
-
import { i as m } from "./status-dot-CP6runiC.js";
|
|
18
|
-
import { t as ce } from "./use-scroll-fade-uc8mWSDX.js";
|
|
19
|
-
import { t as h } from "./avatar-CYNMK7uY.js";
|
|
20
|
-
import { n as le, t as ue } from "./use-coarse-pointer-Ml5oE6oX.js";
|
|
21
|
-
import { t as de } from "./tone-CWpsHPb6.js";
|
|
22
|
-
import { t as fe } from "./use-scroll-margin-atRtf0v_.js";
|
|
23
|
-
import { forwardRef as pe, useLayoutEffect as g, useMemo as me, useRef as _, useState as v } from "react";
|
|
24
|
-
import { Fragment as he, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
25
|
-
import { ArrowDown01Icon as ge, ArrowUp01Icon as _e } from "@hugeicons/core-free-icons";
|
|
26
|
-
import { useVirtualizer as ve } from "@tanstack/react-virtual";
|
|
27
|
-
import { flexRender as ye, getCoreRowModel as be, getSortedRowModel as xe, useReactTable as Se } from "@tanstack/react-table";
|
|
28
|
-
//#region src/components/data-table/time-columns.ts
|
|
29
|
-
var x = /* @__PURE__ */ new WeakSet(), S = { density: {
|
|
30
|
-
compact: { classes: "h-36 coarse:h-44" },
|
|
31
|
-
default: { classes: "h-40 coarse:h-44" },
|
|
32
|
-
comfortable: { classes: "h-48" }
|
|
33
|
-
} }, Ce = { density: "default" }, we = {
|
|
34
|
-
compact: 36,
|
|
35
|
-
default: 40,
|
|
36
|
-
comfortable: 48
|
|
37
|
-
}, Te = 136;
|
|
38
|
-
function Ee(e, t, n = 48) {
|
|
39
|
-
if (!t) return {
|
|
40
|
-
hidden: [],
|
|
41
|
-
tight: !1,
|
|
42
|
-
overflow: !1
|
|
43
|
-
};
|
|
44
|
-
let r = [...e].sort((e, t) => e.priority - t.priority), i = n, a = /* @__PURE__ */ new Set();
|
|
45
|
-
for (let e of r) i += e.size, (i <= t || e.priority <= 1 || e.fixed) && a.add(e.id);
|
|
46
|
-
let o = e.filter((e) => a.has(e.id)), s = o.reduce((e, t) => e + t.size, n), c = o.reduce((e, t) => e + (t.grow ? Ne(t) : t.size), 0);
|
|
47
|
-
if (c > t && o.some((e) => e.grow)) {
|
|
48
|
-
let e = o[o.length - 1];
|
|
49
|
-
for (let n of [...o].reverse()) {
|
|
50
|
-
if (c <= t) break;
|
|
51
|
-
n.grow || n.fixed || n === e || (a.delete(n.id), c -= n.size);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
hidden: e.filter((e) => !a.has(e.id)).map((e) => e.id),
|
|
56
|
-
tight: s > t,
|
|
57
|
-
overflow: c > t
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function De(e) {
|
|
61
|
-
let t = getComputedStyle(e);
|
|
62
|
-
return e.getBoundingClientRect().width - (parseFloat(t.paddingLeft) || 0) - (parseFloat(t.paddingRight) || 0);
|
|
63
|
-
}
|
|
64
|
-
function Oe(e) {
|
|
65
|
-
let t = e.filter((e) => e.id && e.meta?.text && e.meta.align !== "end");
|
|
66
|
-
return t.find((e) => !x.has(e)) ?? t[0] ?? e[0];
|
|
67
|
-
}
|
|
68
|
-
function ke(e, t) {
|
|
69
|
-
if (!e?.id) return;
|
|
70
|
-
let n = e.meta?.text?.(t.original);
|
|
71
|
-
if (n) return n;
|
|
72
|
-
let r = t.getValue(e.id);
|
|
73
|
-
return typeof r == "string" && r ? r : void 0;
|
|
74
|
-
}
|
|
75
|
-
var C = "a[href], button, input, select, textarea, [tabindex], [contenteditable=true]", Ae = "input:not([type=checkbox]):not([type=radio]), textarea, select, [contenteditable=true]";
|
|
76
|
-
function je(e) {
|
|
77
|
-
return [...e.querySelectorAll(C)].filter((e) => !e.closest("[role=checkbox], [aria-hidden=true], [hidden]") && !e.matches(":disabled, input[type=checkbox]"));
|
|
78
|
-
}
|
|
79
|
-
function w(e) {
|
|
80
|
-
return e ? [...e.querySelectorAll("[role=columnheader]")].flatMap((e) => {
|
|
81
|
-
let t = e.querySelector("[role=checkbox], button") ?? e.querySelector("[role=separator]");
|
|
82
|
-
return t ? [t] : [];
|
|
83
|
-
}) : [];
|
|
84
|
-
}
|
|
85
|
-
function Me(t, n) {
|
|
86
|
-
return n ? e("controls-on-fill", t ? "bg-raised-pressed hover:raised-selected-hover active:raised-selected-hover" : "bg-fill-2 hover:bg-fill-3 active:bg-fill-3") : t ? "hover:bg-raised-hover active:bg-raised-pressed hover:controls-on-fill" : "hover:bg-fill-1 active:bg-fill-2 hover:controls-on-fill";
|
|
87
|
-
}
|
|
88
|
-
var Ne = (e) => Math.min(e.size, e.minWidth ?? 136);
|
|
89
|
-
function T({ data: a, columns: o, getRowId: s, density: c = "default", onRowClick: l, rowMenu: u, selectable: d, canSelectRow: m, selection: h, onSelectionChange: pe, sorting: x, onSortingChange: Ce, manualSorting: Te, loading: T, error: E, onRetry: D, empty: O, hasMore: k, loadingMore: Pe, onLoadMore: Fe, stickyFirstColumn: Ie, virtualizeAbove: Le = 100, className: Re, activeRowId: ze, freshRowIds: Be, onHiddenColumnsChange: Ve, "aria-label": He, "data-force-row": Ue }, A) {
|
|
90
|
-
let j = t(), We = r(), Ge = n(), M = i(), [Ke, qe] = v([]), [Je, Ye] = v({}), [Xe, Ze] = v(0), [Qe, N] = v("body"), [$e, et] = v(0), P = _(null), tt = x ?? Ke, F = h ?? Je, nt = me(() => d ? [{
|
|
91
|
-
id: "__select",
|
|
92
|
-
size: 44,
|
|
93
|
-
enableSorting: !1,
|
|
94
|
-
enableResizing: !1,
|
|
95
|
-
meta: { priority: 1 },
|
|
96
|
-
header: ({ table: e }) => /* @__PURE__ */ y(ie, {
|
|
97
|
-
"aria-label": M("dataTable.selectAllRows", "Select all rows"),
|
|
98
|
-
checked: e.getIsAllRowsSelected(),
|
|
99
|
-
indeterminate: e.getIsSomeRowsSelected() && !e.getIsAllRowsSelected(),
|
|
100
|
-
onCheckedChange: (t) => e.toggleAllRowsSelected(t)
|
|
101
|
-
}),
|
|
102
|
-
cell: ({ row: e }) => {
|
|
103
|
-
let t = ke(Oe(o), e);
|
|
104
|
-
return /* @__PURE__ */ y(ie, {
|
|
105
|
-
"aria-label": t ? M("dataTable.selectNamed", "Select {name}", { name: t }) : M("dataTable.selectRow", "Select row"),
|
|
106
|
-
checked: e.getIsSelected(),
|
|
107
|
-
disabled: !e.getCanSelect(),
|
|
108
|
-
onCheckedChange: (t) => e.toggleSelected(t)
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}, ...o] : o, [
|
|
112
|
-
o,
|
|
113
|
-
d,
|
|
114
|
-
M
|
|
115
|
-
]), I = Se({
|
|
116
|
-
data: a,
|
|
117
|
-
columns: nt,
|
|
118
|
-
state: {
|
|
119
|
-
sorting: tt,
|
|
120
|
-
rowSelection: F
|
|
121
|
-
},
|
|
122
|
-
onSortingChange: (e) => {
|
|
123
|
-
let t = typeof e == "function" ? e(tt) : e;
|
|
124
|
-
P.current = null, x || qe(t), Ce?.(t);
|
|
125
|
-
},
|
|
126
|
-
onRowSelectionChange: (e) => {
|
|
127
|
-
let t = typeof e == "function" ? e(F) : e;
|
|
128
|
-
h || Ye(t), pe?.(t);
|
|
129
|
-
},
|
|
130
|
-
getCoreRowModel: be(),
|
|
131
|
-
getSortedRowModel: xe(),
|
|
132
|
-
manualSorting: !!Te,
|
|
133
|
-
enableRowSelection: d ? m ? (e) => m(e.original) : !0 : !1,
|
|
134
|
-
columnResizeMode: "onChange",
|
|
135
|
-
...s ? { getRowId: (e) => s(e) } : {},
|
|
136
|
-
defaultColumn: {
|
|
137
|
-
size: 140,
|
|
138
|
-
minSize: 64,
|
|
139
|
-
maxSize: 640
|
|
140
|
-
}
|
|
141
|
-
}), L = _(null), R = _(null), z = _(null), rt = I.getVisibleLeafColumns(), it = rt.map((e) => ({
|
|
142
|
-
id: e.id,
|
|
143
|
-
size: e.getSize(),
|
|
144
|
-
priority: e.columnDef.meta?.priority ?? 2,
|
|
145
|
-
grow: !!e.columnDef.meta?.grow,
|
|
146
|
-
minWidth: e.columnDef.meta?.minWidth,
|
|
147
|
-
fixed: e.id === "__select"
|
|
148
|
-
})), at = JSON.stringify(it), ot = (e) => {
|
|
149
|
-
let t = Ee(it, e, j ? 48 : 0);
|
|
150
|
-
return `${t.tight ? "!" : ""}${t.overflow ? ">" : ""}|${t.hidden.join(" ")}`;
|
|
151
|
-
}, B = _(ot);
|
|
152
|
-
B.current = ot;
|
|
153
|
-
let [st, ct] = v("|");
|
|
154
|
-
g(() => {
|
|
155
|
-
let e = L.current;
|
|
156
|
-
if (e) return te([e], ([e]) => ct(B.current(Math.round(e?.contentRect.width ?? 0))));
|
|
157
|
-
}, []), g(() => {
|
|
158
|
-
L.current && ct(B.current(Math.round(De(L.current))));
|
|
159
|
-
}, [at]);
|
|
160
|
-
let [lt = "", ut = ""] = st.split("|"), dt = lt.includes("!"), ft = lt.includes(">"), V = me(() => new Set(ut.split(" ").filter(Boolean)), [ut]), pt = _(Ve);
|
|
161
|
-
pt.current = Ve, g(() => {
|
|
162
|
-
pt.current?.([...V]);
|
|
163
|
-
}, [V]);
|
|
164
|
-
let H = rt.filter((e) => !V.has(e.id)), mt = (e) => e.columnDef.meta?.grow && dt ? Ne({
|
|
165
|
-
size: e.getSize(),
|
|
166
|
-
minWidth: e.columnDef.meta.minWidth
|
|
167
|
-
}) : e.getSize(), U = {
|
|
168
|
-
gridTemplateColumns: H.map((e) => e.columnDef.meta?.grow ? `minmax(${mt(e)}px, 1fr)` : `${e.getSize()}px`).join(" "),
|
|
169
|
-
minWidth: H.reduce((e, t) => e + mt(t), 0)
|
|
170
|
-
}, ht = ft && H.length > 1 && !H[H.length - 1]?.columnDef.meta?.grow, W = I.getRowModel().rows, G = W.length > Le, gt = Math.max(we[c], ue() ? 44 : 0), K = () => le(L.current), _t = fe(z, K, W.length, G), q = ve({
|
|
171
|
-
count: W.length,
|
|
172
|
-
getScrollElement: K,
|
|
173
|
-
estimateSize: () => gt,
|
|
174
|
-
overscan: 16,
|
|
175
|
-
enabled: G,
|
|
176
|
-
scrollMargin: _t
|
|
177
|
-
}), J = (t) => e("flex min-w-0 items-center px-12", j && t === 0 && "pl-20", j && t === H.length - 1 && "pr-20"), Y = j || We, X = (t, n = !1, r = !1) => (Ie && t === 0 || ht && t === H.length - 1) && e("sticky z-10", n ? Y ? "bg-raised" : "bg-panel" : r ? "bg-inherit" : Y ? "bg-raised group-hover/tr:bg-raised-hover group-active/tr:bg-raised-pressed" : "bg-panel group-hover/tr:bg-fill-1 group-active/tr:bg-fill-2", t === 0 ? "left-0" : "right-0", !j && !n && (t === 0 ? "rounded-l-item" : "rounded-r-item")), Z = !!l || !!d, vt = Z && W.length > 0 && Qe === "body", yt = Math.min(Xe, Math.max(W.length - 1, 0)), bt = (e) => {
|
|
178
|
-
let t = Math.max(0, Math.min(W.length - 1, e));
|
|
179
|
-
N("body"), Ze(t), G && q.scrollToIndex(t, { align: "auto" });
|
|
180
|
-
let n = () => z.current?.querySelector(`[data-row-index="${t}"]`), r = n();
|
|
181
|
-
r ? r.focus() : requestAnimationFrame(() => n()?.focus());
|
|
182
|
-
}, xt = (e) => {
|
|
183
|
-
let t = w(R.current), n = t[Math.max(0, Math.min(t.length - 1, e))];
|
|
184
|
-
return n ? (N("head"), et(t.indexOf(n)), n.focus(), !0) : !1;
|
|
185
|
-
}, Q = _(() => {});
|
|
186
|
-
Q.current = () => {
|
|
187
|
-
let e = w(R.current), t = Math.min($e, e.length - 1);
|
|
188
|
-
for (let n of R.current?.querySelectorAll(C) ?? []) {
|
|
189
|
-
let r = e.indexOf(n) === t && !vt ? "0" : "-1";
|
|
190
|
-
n.getAttribute("tabindex") !== r && n.setAttribute("tabindex", r);
|
|
191
|
-
}
|
|
192
|
-
}, g(() => Q.current()), g(() => {
|
|
193
|
-
let e = R.current;
|
|
194
|
-
if (!e) return;
|
|
195
|
-
let t = new MutationObserver(() => Q.current());
|
|
196
|
-
return t.observe(e, {
|
|
197
|
-
subtree: !0,
|
|
198
|
-
childList: !0,
|
|
199
|
-
attributes: !0,
|
|
200
|
-
attributeFilter: ["tabindex"]
|
|
201
|
-
}), () => t.disconnect();
|
|
202
|
-
}, []), g(() => {
|
|
203
|
-
let e = z.current;
|
|
204
|
-
if (!e || !Z) return;
|
|
205
|
-
let t = () => {
|
|
206
|
-
for (let t of e.querySelectorAll("[data-row-index]")) for (let e of t.querySelectorAll(C)) e.getAttribute("tabindex") !== "-1" && e.setAttribute("tabindex", "-1");
|
|
207
|
-
};
|
|
208
|
-
t();
|
|
209
|
-
let n = new MutationObserver(t);
|
|
210
|
-
return n.observe(e, {
|
|
211
|
-
subtree: !0,
|
|
212
|
-
childList: !0,
|
|
213
|
-
attributes: !0,
|
|
214
|
-
attributeFilter: ["tabindex"]
|
|
215
|
-
}), () => n.disconnect();
|
|
216
|
-
}, [Z]), ce(z, "[role=row]");
|
|
217
|
-
let $ = (e, t) => {
|
|
218
|
-
let n = e ? I.getColumn(e) : void 0;
|
|
219
|
-
if (!n?.getCanResize()) return !1;
|
|
220
|
-
let r = n.columnDef.minSize ?? 64, i = n.columnDef.maxSize ?? 640;
|
|
221
|
-
return I.setColumnSizing((e) => ({
|
|
222
|
-
...e,
|
|
223
|
-
[n.id]: Math.max(r, Math.min(i, n.getSize() + t))
|
|
224
|
-
})), !0;
|
|
225
|
-
}, St = (e) => {
|
|
226
|
-
if (e.altKey || e.metaKey || e.ctrlKey) return;
|
|
227
|
-
let t = w(R.current), n = t.indexOf(e.target);
|
|
228
|
-
if (n < 0) return;
|
|
229
|
-
let r = {
|
|
230
|
-
ArrowLeft: -16,
|
|
231
|
-
ArrowRight: 16
|
|
232
|
-
}[e.key];
|
|
233
|
-
if (e.shiftKey) {
|
|
234
|
-
r !== void 0 && $(e.target.closest("[role=columnheader]")?.dataset.col, r) && e.preventDefault();
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
let i = {
|
|
238
|
-
ArrowLeft: n - 1,
|
|
239
|
-
ArrowRight: n + 1,
|
|
240
|
-
Home: 0,
|
|
241
|
-
End: t.length - 1
|
|
242
|
-
}[e.key];
|
|
243
|
-
i === void 0 ? e.key === "ArrowDown" && Z && W.length && (e.preventDefault(), bt(yt)) : (e.preventDefault(), i >= 0 && i < t.length && xt(i));
|
|
244
|
-
}, Ct = () => Math.max(1, Math.floor((K()?.clientHeight ?? 400) / gt) - 1), wt = (e, t) => {
|
|
245
|
-
let n = P.current ? W.findIndex((e) => e.id === P.current?.id) : -1;
|
|
246
|
-
n < 0 && (P.current = {
|
|
247
|
-
id: W[e].id,
|
|
248
|
-
base: F
|
|
249
|
-
});
|
|
250
|
-
let r = n < 0 ? e : n, i = { ...P.current?.base };
|
|
251
|
-
for (let e of W.slice(Math.min(r, t), Math.max(r, t) + 1)) e.getCanSelect() && (i[e.id] = !0);
|
|
252
|
-
I.setRowSelection(i);
|
|
253
|
-
}, Tt = (e, t, n) => {
|
|
254
|
-
let r = e.currentTarget, i = e.target;
|
|
255
|
-
if (i !== r) {
|
|
256
|
-
if (e.altKey || e.metaKey || e.ctrlKey || i.closest(Ae)) return;
|
|
257
|
-
let t = je(r), n = t.indexOf(i);
|
|
258
|
-
if (n < 0) return;
|
|
259
|
-
if (e.key === "Escape" && !i.closest("[data-popup-open], [aria-expanded=true]")) e.preventDefault(), r.focus();
|
|
260
|
-
else if (e.defaultPrevented) return;
|
|
261
|
-
else e.key === "ArrowRight" && t[n + 1] ? (e.preventDefault(), t[n + 1]?.focus()) : e.key === "ArrowLeft" && (e.preventDefault(), (t[n - 1] ?? r).focus());
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
if (e.altKey) return;
|
|
265
|
-
if (e.metaKey || e.ctrlKey) {
|
|
266
|
-
e.key.toLowerCase() === "a" && d && !e.shiftKey && (e.preventDefault(), P.current = null, I.toggleAllRowsSelected(!0));
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
let a = {
|
|
270
|
-
ArrowDown: n + 1,
|
|
271
|
-
ArrowUp: n - 1,
|
|
272
|
-
Home: 0,
|
|
273
|
-
End: W.length - 1,
|
|
274
|
-
PageDown: n + Ct(),
|
|
275
|
-
PageUp: n - Ct()
|
|
276
|
-
}[e.key];
|
|
277
|
-
if (a !== void 0) {
|
|
278
|
-
if (e.preventDefault(), e.key === "ArrowUp" && !e.shiftKey && a < 0 && xt($e)) return;
|
|
279
|
-
let t = Math.max(0, Math.min(W.length - 1, a));
|
|
280
|
-
e.shiftKey && d ? wt(n, t) : P.current = null, bt(t);
|
|
281
|
-
} else if (e.shiftKey) return;
|
|
282
|
-
else if (e.key === "ArrowRight") {
|
|
283
|
-
let t = je(r)[0];
|
|
284
|
-
if (!t) return;
|
|
285
|
-
e.preventDefault(), t.focus();
|
|
286
|
-
} else e.key === "Enter" ? (e.preventDefault(), l?.(t.original)) : (e.key === " " || e.key === "x") && d ? (e.preventDefault(), P.current = null, t.getCanSelect() && t.toggleSelected()) : e.key === "Escape" && d && Object.keys(F).length && (e.preventDefault(), P.current = null, I.toggleAllRowsSelected(!1));
|
|
287
|
-
}, Et = (t, n, r) => {
|
|
288
|
-
let i = t.getVisibleCells().filter((e) => !V.has(e.column.id)), a = t.id === ze, o = a || !!d && t.getIsSelected(), s = /* @__PURE__ */ y("div", {
|
|
289
|
-
role: "row",
|
|
290
|
-
"aria-rowindex": n + 2,
|
|
291
|
-
"aria-selected": d ? t.getIsSelected() : void 0,
|
|
292
|
-
"aria-current": a || void 0,
|
|
293
|
-
"data-active": a || void 0,
|
|
294
|
-
"data-fresh": Be?.has(t.id) || void 0,
|
|
295
|
-
"data-row-index": n,
|
|
296
|
-
...Ue && n === 0 ? { "data-force": Ue } : {},
|
|
297
|
-
tabIndex: Z ? vt && n === yt ? 0 : -1 : void 0,
|
|
298
|
-
onFocus: (e) => {
|
|
299
|
-
e.target === e.currentTarget && (N("body"), n !== Xe && Ze(n));
|
|
300
|
-
},
|
|
301
|
-
onClick: (e) => {
|
|
302
|
-
P.current = null, !e.target.closest("button, a, [role=checkbox]") && l?.(t.original);
|
|
303
|
-
},
|
|
304
|
-
onKeyDown: (e) => Tt(e, t, n),
|
|
305
|
-
style: {
|
|
306
|
-
...U,
|
|
307
|
-
...r
|
|
308
|
-
},
|
|
309
|
-
className: e("group/tr grid w-full text-body text-fg transition-control focus-ring-inset", !j && "rounded-item", S.density[c].classes, l && "cursor-pointer", Me(Y, o), "data-fresh:animate-row-fresh", "forced-colors:data-active:outline-2 forced-colors:data-active:-outline-offset-2 forced-colors:data-active:outline-solid"),
|
|
310
|
-
children: i.map((n, r) => {
|
|
311
|
-
let i = n.column.columnDef.meta, a = ye(n.column.columnDef.cell, n.getContext()), s = n.getValue(), c = i?.text ? i.text(t.original) : typeof s == "string" ? s : void 0, l = i?.tone?.(t.original);
|
|
312
|
-
return /* @__PURE__ */ y("div", {
|
|
313
|
-
role: "cell",
|
|
314
|
-
className: e(J(r), i?.align === "end" && "justify-end text-right tabular", i?.mono && "mono text-small", l && de[l], X(r, !1, o)),
|
|
315
|
-
children: c !== void 0 && typeof a != "object" ? /* @__PURE__ */ y(ne, {
|
|
316
|
-
truncate: !0,
|
|
317
|
-
tone: l ?? "default",
|
|
318
|
-
className: e("min-w-0", i?.mono && "text-small"),
|
|
319
|
-
mono: !!i?.mono,
|
|
320
|
-
children: c
|
|
321
|
-
}) : n.column.id === "__select" ? /* @__PURE__ */ y("span", {
|
|
322
|
-
className: "flex",
|
|
323
|
-
children: a
|
|
324
|
-
}) : /* @__PURE__ */ y(p, {
|
|
325
|
-
className: e("min-w-0 cell-fit", i?.grow && "flex-1"),
|
|
326
|
-
children: a
|
|
327
|
-
})
|
|
328
|
-
}, n.id);
|
|
329
|
-
})
|
|
330
|
-
});
|
|
331
|
-
return u ? /* @__PURE__ */ b(f, { children: [/* @__PURE__ */ y(f.Trigger, { children: s }), /* @__PURE__ */ y(f.Content, { children: u(t.original) })] }, t.id) : /* @__PURE__ */ y("div", { children: s }, t.id);
|
|
332
|
-
}, Dt = (t, n) => {
|
|
333
|
-
let r = t.column.columnDef.meta, i = t.column.getCanSort(), a = t.column.getCanResize(), o = t.column.getIsSorted(), s = ye(t.column.columnDef.header, t.getContext()), c = /* @__PURE__ */ b(he, { children: [i ? /* @__PURE__ */ b("button", {
|
|
334
|
-
type: "button",
|
|
335
|
-
onClick: t.column.getToggleSortingHandler(),
|
|
336
|
-
className: e("relative -mx-6 inline-flex h-28 min-w-0 cursor-pointer items-center gap-4 rounded-pill px-6 text-caption font-medium transition-control focus-ring tap-target", Y ? "hover:bg-raised-hover active:bg-raised-pressed" : "hover:bg-fill-1 active:bg-fill-2", "hover:text-fg", o ? "text-fg" : "text-fg-secondary", r?.align === "end" && "flex-row-reverse"),
|
|
337
|
-
children: [/* @__PURE__ */ y(p, { children: s }), /* @__PURE__ */ y(ee, {
|
|
338
|
-
icon: o === "desc" ? ge : _e,
|
|
339
|
-
size: "xs",
|
|
340
|
-
className: e("shrink-0 transition-control", o ? "opacity-100" : "opacity-0 group-hover/th:opacity-60")
|
|
341
|
-
})]
|
|
342
|
-
}) : /* @__PURE__ */ y(p, {
|
|
343
|
-
className: "text-caption font-medium text-fg-secondary",
|
|
344
|
-
children: s
|
|
345
|
-
}), a && /* @__PURE__ */ y("div", {
|
|
346
|
-
role: "separator",
|
|
347
|
-
"aria-orientation": "vertical",
|
|
348
|
-
"aria-label": M("dataTable.resizeColumn", "Resize column"),
|
|
349
|
-
"aria-valuenow": t.column.getSize(),
|
|
350
|
-
"aria-valuemin": t.column.columnDef.minSize ?? 64,
|
|
351
|
-
"aria-valuemax": t.column.columnDef.maxSize ?? 640,
|
|
352
|
-
tabIndex: -1,
|
|
353
|
-
onMouseDown: t.getResizeHandler(),
|
|
354
|
-
onTouchStart: t.getResizeHandler(),
|
|
355
|
-
onDoubleClick: () => t.column.resetSize(),
|
|
356
|
-
className: "absolute inset-y-0 -right-8 z-10 w-16 cursor-col-resize after:absolute after:inset-y-8 after:right-8 after:w-1 after:bg-transparent after:transition-control group-hover/th:after:bg-line-strong coarse:after:bg-line focus-ring-inset"
|
|
357
|
-
})] });
|
|
358
|
-
return /* @__PURE__ */ y("div", {
|
|
359
|
-
role: "columnheader",
|
|
360
|
-
"data-col": t.column.id,
|
|
361
|
-
"aria-sort": o === "asc" ? "ascending" : o === "desc" ? "descending" : i ? "none" : void 0,
|
|
362
|
-
className: e("group/th relative", J(n), r?.align === "end" && "justify-end", X(n, !0), X(n, !0) && "hairline-b-strong"),
|
|
363
|
-
children: a ? /* @__PURE__ */ b(f, { children: [/* @__PURE__ */ y(f.Trigger, {
|
|
364
|
-
className: e("flex min-w-0 flex-1 items-center self-stretch", r?.align === "end" && "justify-end"),
|
|
365
|
-
children: c
|
|
366
|
-
}), /* @__PURE__ */ b(f.Content, { children: [
|
|
367
|
-
/* @__PURE__ */ y(f.Item, {
|
|
368
|
-
onClick: () => $(t.column.id, 32),
|
|
369
|
-
children: M("dataTable.widenColumn", "Widen column")
|
|
370
|
-
}),
|
|
371
|
-
/* @__PURE__ */ y(f.Item, {
|
|
372
|
-
onClick: () => $(t.column.id, -32),
|
|
373
|
-
children: M("dataTable.narrowColumn", "Narrow column")
|
|
374
|
-
}),
|
|
375
|
-
/* @__PURE__ */ y(f.Item, {
|
|
376
|
-
onClick: () => t.column.resetSize(),
|
|
377
|
-
children: M("dataTable.resetWidth", "Reset width")
|
|
378
|
-
})
|
|
379
|
-
] })] }) : c
|
|
380
|
-
}, t.id);
|
|
381
|
-
};
|
|
382
|
-
return /* @__PURE__ */ b("div", {
|
|
383
|
-
ref: (e) => {
|
|
384
|
-
L.current = e, typeof A == "function" ? A(e) : A && (A.current = e);
|
|
385
|
-
},
|
|
386
|
-
className: e("relative w-full min-w-0", !j && !Ge && "px-24", Re),
|
|
387
|
-
children: [/* @__PURE__ */ b("div", {
|
|
388
|
-
role: "table",
|
|
389
|
-
"aria-label": He,
|
|
390
|
-
"aria-rowcount": W.length + 1,
|
|
391
|
-
"aria-busy": T || void 0,
|
|
392
|
-
className: e("w-full overflow-clip", j && "rounded-group bg-raised shadow-xs"),
|
|
393
|
-
children: [/* @__PURE__ */ y("div", {
|
|
394
|
-
ref: R,
|
|
395
|
-
role: "rowgroup",
|
|
396
|
-
className: e("sticky top-0 z-20 overflow-hidden", Y ? "bg-raised" : "bg-panel"),
|
|
397
|
-
onKeyDown: St,
|
|
398
|
-
onFocus: (e) => {
|
|
399
|
-
let t = w(R.current).indexOf(e.target);
|
|
400
|
-
t < 0 || (P.current = null, N("head"), et(t));
|
|
401
|
-
},
|
|
402
|
-
onScroll: (e) => {
|
|
403
|
-
z.current && z.current.scrollLeft !== e.currentTarget.scrollLeft && (z.current.scrollLeft = e.currentTarget.scrollLeft);
|
|
404
|
-
},
|
|
405
|
-
children: I.getHeaderGroups().map((e) => /* @__PURE__ */ y("div", {
|
|
406
|
-
role: "row",
|
|
407
|
-
"aria-rowindex": 1,
|
|
408
|
-
className: "grid h-36 hairline-b-strong",
|
|
409
|
-
style: U,
|
|
410
|
-
children: e.headers.filter((e) => !V.has(e.column.id)).map(Dt)
|
|
411
|
-
}, e.id))
|
|
412
|
-
}), /* @__PURE__ */ y("div", {
|
|
413
|
-
ref: z,
|
|
414
|
-
role: "rowgroup",
|
|
415
|
-
className: "overflow-x-auto scrollbar-quiet scroll-fade-x",
|
|
416
|
-
onScroll: (e) => {
|
|
417
|
-
R.current && R.current.scrollLeft !== e.currentTarget.scrollLeft && (R.current.scrollLeft = e.currentTarget.scrollLeft);
|
|
418
|
-
},
|
|
419
|
-
children: E ? /* @__PURE__ */ y("div", {
|
|
420
|
-
role: "row",
|
|
421
|
-
children: /* @__PURE__ */ y("div", {
|
|
422
|
-
role: "cell",
|
|
423
|
-
"aria-colspan": H.length,
|
|
424
|
-
className: "block",
|
|
425
|
-
children: /* @__PURE__ */ y("div", {
|
|
426
|
-
role: "alert",
|
|
427
|
-
children: /* @__PURE__ */ y(se, {
|
|
428
|
-
size: "compact",
|
|
429
|
-
title: M("dataTable.loadFailed", "Couldn't load these rows"),
|
|
430
|
-
...D ? {} : { description: M("dataTable.reloadToRetry", "Reload the page to try again.") },
|
|
431
|
-
actions: D && /* @__PURE__ */ y(re, {
|
|
432
|
-
size: "sm",
|
|
433
|
-
onClick: D,
|
|
434
|
-
children: M("dataTable.tryAgain", "Try again")
|
|
435
|
-
})
|
|
436
|
-
})
|
|
437
|
-
})
|
|
438
|
-
})
|
|
439
|
-
}) : T && W.length === 0 ? Array.from({ length: 8 }, (t, n) => /* @__PURE__ */ y("div", {
|
|
440
|
-
role: "row",
|
|
441
|
-
className: e("grid", S.density[c].classes),
|
|
442
|
-
style: U,
|
|
443
|
-
children: H.map((t, r) => /* @__PURE__ */ y("div", {
|
|
444
|
-
role: "cell",
|
|
445
|
-
className: e(J(r), t.columnDef.meta?.align === "end" && "justify-end"),
|
|
446
|
-
children: /* @__PURE__ */ y(ae, {
|
|
447
|
-
shape: "line",
|
|
448
|
-
style: { width: `${40 + (n * 7 + r * 13) % 45}%` }
|
|
449
|
-
})
|
|
450
|
-
}, t.id))
|
|
451
|
-
}, n)) : W.length === 0 ? /* @__PURE__ */ y("div", {
|
|
452
|
-
role: "row",
|
|
453
|
-
children: /* @__PURE__ */ y("div", {
|
|
454
|
-
role: "cell",
|
|
455
|
-
"aria-colspan": H.length,
|
|
456
|
-
className: "block",
|
|
457
|
-
children: O ?? /* @__PURE__ */ y(se, {
|
|
458
|
-
size: "compact",
|
|
459
|
-
title: M("dataTable.noRows", "No rows")
|
|
460
|
-
})
|
|
461
|
-
})
|
|
462
|
-
}) : G ? /* @__PURE__ */ y("div", {
|
|
463
|
-
className: "relative",
|
|
464
|
-
style: { height: q.getTotalSize() },
|
|
465
|
-
children: q.getVirtualItems().map((e) => Et(W[e.index], e.index, {
|
|
466
|
-
position: "absolute",
|
|
467
|
-
top: 0,
|
|
468
|
-
left: 0,
|
|
469
|
-
transform: `translateY(${Math.round(e.start - _t)}px)`
|
|
470
|
-
}))
|
|
471
|
-
}) : W.map((e, t) => Et(e, t))
|
|
472
|
-
})]
|
|
473
|
-
}), /* @__PURE__ */ y(oe, {
|
|
474
|
-
variant: "load-more",
|
|
475
|
-
hasMore: !!k,
|
|
476
|
-
loading: Pe,
|
|
477
|
-
onLoadMore: Fe
|
|
478
|
-
})]
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
var E = /* @__PURE__ */ pe(T);
|
|
482
|
-
process.env.NODE_ENV !== "production" && (E.displayName = "DataTable");
|
|
483
|
-
var D = E;
|
|
484
|
-
//#endregion
|
|
485
|
-
//#region src/components/data-table/columns.tsx
|
|
486
|
-
function O(e) {
|
|
487
|
-
return x.add(e), e;
|
|
488
|
-
}
|
|
489
|
-
function k(e, t, n, r = {}, i) {
|
|
490
|
-
return {
|
|
491
|
-
id: e.id,
|
|
492
|
-
header: () => e.header,
|
|
493
|
-
accessorFn: t,
|
|
494
|
-
cell: (e) => n(e.getValue(), e.row.original),
|
|
495
|
-
...e.size ? { size: e.size } : {},
|
|
496
|
-
...i ? { sortingFn: i } : {},
|
|
497
|
-
meta: {
|
|
498
|
-
...e.priority === void 0 ? {} : { priority: e.priority },
|
|
499
|
-
...e.grow ? { grow: !0 } : {},
|
|
500
|
-
...e.minWidth === void 0 ? {} : { minWidth: e.minWidth },
|
|
501
|
-
...e.tone ? { tone: e.tone } : {},
|
|
502
|
-
...r
|
|
503
|
-
}
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
function Pe({ value: e }) {
|
|
507
|
-
let t = i()("dataTable.tokenCount", "{count} tokens", { count: s(e) });
|
|
508
|
-
return /* @__PURE__ */ y(d, {
|
|
509
|
-
content: t,
|
|
510
|
-
children: /* @__PURE__ */ b("span", { children: [/* @__PURE__ */ y("span", {
|
|
511
|
-
"aria-hidden": !0,
|
|
512
|
-
children: l(e)
|
|
513
|
-
}), /* @__PURE__ */ y("span", {
|
|
514
|
-
className: "sr-only",
|
|
515
|
-
children: t
|
|
516
|
-
})] })
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
|
-
function Fe({ value: e, now: t }) {
|
|
520
|
-
let n = a(e, {
|
|
521
|
-
time: !0,
|
|
522
|
-
seconds: !0
|
|
523
|
-
});
|
|
524
|
-
return /* @__PURE__ */ y(d, {
|
|
525
|
-
content: `${n} · ${a(e, {
|
|
526
|
-
time: !0,
|
|
527
|
-
utc: !0
|
|
528
|
-
})}`,
|
|
529
|
-
shape: "multiline",
|
|
530
|
-
children: /* @__PURE__ */ b("span", {
|
|
531
|
-
className: "text-fg-secondary",
|
|
532
|
-
children: [/* @__PURE__ */ y("time", {
|
|
533
|
-
dateTime: new Date(e).toISOString(),
|
|
534
|
-
children: c(e, t)
|
|
535
|
-
}), /* @__PURE__ */ b("span", {
|
|
536
|
-
className: "sr-only",
|
|
537
|
-
children: [" ", n]
|
|
538
|
-
})]
|
|
539
|
-
})
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
var Ie = {
|
|
543
|
-
text: (e, t) => k(e, t, (e) => e, { text: (e) => t(e) }),
|
|
544
|
-
mono: (e, t) => k(e, t, (e) => e, {
|
|
545
|
-
mono: !0,
|
|
546
|
-
text: (e) => t(e)
|
|
547
|
-
}),
|
|
548
|
-
number: (e, t) => k(e, t, (e) => s(e), { align: "end" }),
|
|
549
|
-
money: (e, t, n = {}) => k(e, t, (e) => u(e, n.decimals === void 0 ? {} : { decimals: n.decimals }), {
|
|
550
|
-
align: "end",
|
|
551
|
-
mono: !1
|
|
552
|
-
}, (e, t, n) => Number(e.getValue(n)) - Number(t.getValue(n))),
|
|
553
|
-
tokens: (e, t) => k(e, t, (e) => /* @__PURE__ */ y(Pe, { value: e }), { align: "end" }),
|
|
554
|
-
duration: (e, t) => k(e, t, (e) => o(e), { align: "end" }),
|
|
555
|
-
date: (e, t) => O(k(e, t, (e) => /* @__PURE__ */ y("time", {
|
|
556
|
-
dateTime: new Date(e).toISOString(),
|
|
557
|
-
children: a(e, { time: !0 })
|
|
558
|
-
}), { text: (e) => a(t(e), { time: !0 }) }, "datetime")),
|
|
559
|
-
relative: (e, t, n = {}) => O(k(e, t, (e) => /* @__PURE__ */ y(Fe, {
|
|
560
|
-
value: e,
|
|
561
|
-
now: n.now ?? Date.now()
|
|
562
|
-
}), { text: (e) => a(t(e), { time: !0 }) }, (e, t, n) => new Date(e.getValue(n)).getTime() - new Date(t.getValue(n)).getTime())),
|
|
563
|
-
status: (e, t) => k(e, t, (e) => /* @__PURE__ */ y(m, {
|
|
564
|
-
tone: e.tone,
|
|
565
|
-
children: e.label
|
|
566
|
-
}), { text: void 0 }),
|
|
567
|
-
avatar: (e, t) => k(e, t, (e) => /* @__PURE__ */ b("span", {
|
|
568
|
-
className: "inline-flex min-w-0 items-center gap-8",
|
|
569
|
-
children: [/* @__PURE__ */ y(h, {
|
|
570
|
-
name: e.name,
|
|
571
|
-
...e.src ? { src: e.src } : {},
|
|
572
|
-
size: 24,
|
|
573
|
-
decorative: !0
|
|
574
|
-
}), /* @__PURE__ */ y(p, { children: e.name })]
|
|
575
|
-
}), { text: (e) => t(e).name }),
|
|
576
|
-
custom: (e, t, n, r = {}) => k(e, t, n, r)
|
|
577
|
-
};
|
|
578
|
-
//#endregion
|
|
579
|
-
export { S as a, Ce as i, Te as n, Ee as o, D as r, Ie as t };
|
|
580
|
-
|
|
581
|
-
//# sourceMappingURL=data-table-CqY8_6IS.js.map
|