@logicplanes/kaeso-ui 0.4.6 → 0.4.8

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