@alfadocs/ui-kit 1.13.0 → 1.15.0

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 (110) hide show
  1. package/dist/_chunks/actions-cell-renderer-yy03OgRL.js +137 -0
  2. package/dist/_chunks/{balance-badge-cell--iQ_gtmi.js → balance-badge-cell-CgkxYO96.js} +7 -6
  3. package/dist/_chunks/{calendar-B4Gnyu1C.js → calendar-CHT9Rm3M.js} +2 -2
  4. package/dist/_chunks/{calendar-event-card-Bjdbik8G.js → calendar-event-card-BjdHZaqz.js} +18 -14
  5. package/dist/_chunks/calendar-plus-BFrIRE4r.js +19 -0
  6. package/dist/_chunks/calendar-workspace-CGuY4kmv.js +7480 -0
  7. package/dist/_chunks/clipboard-list-rSzfIYZB.js +25 -0
  8. package/dist/_chunks/{color-picker-oZ6zYks8.js → color-picker-CU303VjY.js} +4 -2
  9. package/dist/_chunks/data-table-DC5rO3Ty.js +1817 -0
  10. package/dist/_chunks/{field-value-DG8zaZvo.js → field-value-D-vkX9uL.js} +120 -140
  11. package/dist/_chunks/{file-manager-UsD8e_AB.js → file-manager-DJMeB3V8.js} +138 -153
  12. package/dist/_chunks/folder-plus-CutOs4DP.js +22 -0
  13. package/dist/_chunks/hourglass-BEAzW1wE.js +26 -0
  14. package/dist/_chunks/{notes-panel-CymneXtl.js → notes-panel-DYAtlq_i.js} +2 -2
  15. package/dist/_chunks/{patient-details-BQaUzPqp.js → patient-details-BfzvFnxQ.js} +73 -92
  16. package/dist/_chunks/{patient-summary-card-CvDxhbBR.js → patient-summary-card-D5Vfa321.js} +2 -2
  17. package/dist/_chunks/{practice-results-D7ygCj_W.js → practice-results-DL_ExLYE.js} +159 -172
  18. package/dist/_chunks/{rich-text-editor-BDfFtK4H.js → rich-text-editor-DtbcA6s1.js} +2 -2
  19. package/dist/_chunks/signature-CpFNpsVK.js +21 -0
  20. package/dist/_chunks/{signature-field-0rFODJlW.js → signature-field-CEiPe-vX.js} +19 -34
  21. package/dist/_chunks/smartphone-C0rFF2if.js +15 -0
  22. package/dist/_chunks/{toast.agent-D1tdg6DS.js → toast-YZz2sBzB.js} +160 -212
  23. package/dist/_chunks/toast.agent-DNQ0JYGv.js +56 -0
  24. package/dist/_chunks/{workflow-map-wcw3t6g4.js → workflow-map-dNzJjBWG.js} +103 -112
  25. package/dist/agent-catalog.json +867 -1
  26. package/dist/agent-i18n/en.json +27 -0
  27. package/dist/components/calendar/index.js +1 -1
  28. package/dist/components/calendar-event-card/index.js +1 -1
  29. package/dist/components/color-picker/index.js +1 -1
  30. package/dist/components/data-table/index.js +39 -38
  31. package/dist/components/file-manager/index.js +1 -1
  32. package/dist/components/index.d.ts +1 -0
  33. package/dist/components/notes-panel/index.js +1 -1
  34. package/dist/components/patient-details/index.js +1 -1
  35. package/dist/components/patient-summary-card/index.js +1 -1
  36. package/dist/components/patient-table/index.js +1 -1
  37. package/dist/components/practice-results/index.js +1 -1
  38. package/dist/components/rich-text-editor/index.js +1 -1
  39. package/dist/components/signature-field/index.js +1 -1
  40. package/dist/components/toast/index.js +7 -6
  41. package/dist/components/workflow/index.js +1 -1
  42. package/dist/i18n/locales/ar.d.ts +680 -0
  43. package/dist/i18n/locales/ar.js +680 -0
  44. package/dist/i18n/locales/de.d.ts +680 -0
  45. package/dist/i18n/locales/de.js +680 -0
  46. package/dist/i18n/locales/el.d.ts +680 -0
  47. package/dist/i18n/locales/el.js +680 -0
  48. package/dist/i18n/locales/en.d.ts +680 -0
  49. package/dist/i18n/locales/en.js +680 -0
  50. package/dist/i18n/locales/es.d.ts +680 -0
  51. package/dist/i18n/locales/es.js +680 -0
  52. package/dist/i18n/locales/fr.d.ts +680 -0
  53. package/dist/i18n/locales/fr.js +680 -0
  54. package/dist/i18n/locales/hi.d.ts +680 -0
  55. package/dist/i18n/locales/hi.js +680 -0
  56. package/dist/i18n/locales/it.d.ts +680 -0
  57. package/dist/i18n/locales/it.js +680 -0
  58. package/dist/i18n/locales/ja.d.ts +680 -0
  59. package/dist/i18n/locales/ja.js +680 -0
  60. package/dist/i18n/locales/nl.d.ts +680 -0
  61. package/dist/i18n/locales/nl.js +680 -0
  62. package/dist/i18n/locales/pl.d.ts +680 -0
  63. package/dist/i18n/locales/pl.js +680 -0
  64. package/dist/i18n/locales/pt.d.ts +680 -0
  65. package/dist/i18n/locales/pt.js +680 -0
  66. package/dist/i18n/locales/ro.d.ts +680 -0
  67. package/dist/i18n/locales/ro.js +680 -0
  68. package/dist/i18n/locales/ru.d.ts +680 -0
  69. package/dist/i18n/locales/ru.js +680 -0
  70. package/dist/i18n/locales/sq.d.ts +680 -0
  71. package/dist/i18n/locales/sq.js +680 -0
  72. package/dist/i18n/locales/sv.d.ts +680 -0
  73. package/dist/i18n/locales/sv.js +680 -0
  74. package/dist/i18n/locales/tr.d.ts +680 -0
  75. package/dist/i18n/locales/tr.js +680 -0
  76. package/dist/i18n/locales/zh.d.ts +680 -0
  77. package/dist/i18n/locales/zh.js +680 -0
  78. package/dist/index.js +821 -803
  79. package/dist/locales/ar.json +680 -0
  80. package/dist/locales/de.json +680 -0
  81. package/dist/locales/el.json +680 -0
  82. package/dist/locales/en.json +680 -0
  83. package/dist/locales/es.json +680 -0
  84. package/dist/locales/fr.json +680 -0
  85. package/dist/locales/hi.json +680 -0
  86. package/dist/locales/it.json +680 -0
  87. package/dist/locales/ja.json +680 -0
  88. package/dist/locales/nl.json +680 -0
  89. package/dist/locales/pl.json +680 -0
  90. package/dist/locales/pt.json +680 -0
  91. package/dist/locales/ro.json +680 -0
  92. package/dist/locales/ru.json +680 -0
  93. package/dist/locales/sq.json +680 -0
  94. package/dist/locales/sv.json +680 -0
  95. package/dist/locales/tr.json +680 -0
  96. package/dist/locales/zh.json +680 -0
  97. package/dist/patterns/calendar/calendar-workspace.d.ts +82 -0
  98. package/dist/patterns/calendar/calendar-workspace.model.d.ts +380 -0
  99. package/dist/patterns/calendar/calendar.data.d.ts +122 -0
  100. package/dist/patterns/calendar/calendar.host.d.ts +10 -0
  101. package/dist/patterns/calendar/calendar.journey.d.ts +119 -0
  102. package/dist/patterns/calendar/calendar.model.d.ts +684 -0
  103. package/dist/patterns/calendar/calendar.preferences.d.ts +74 -0
  104. package/dist/patterns/calendar/calendar.sheets.d.ts +398 -0
  105. package/dist/patterns/calendar/calendar.surface.d.ts +85 -0
  106. package/dist/patterns/calendar/calendar.types.d.ts +413 -0
  107. package/dist/patterns/calendar/index.d.ts +13 -0
  108. package/dist/patterns/calendar/index.js +19 -0
  109. package/package.json +5 -1
  110. package/dist/_chunks/actions-cell-renderer-ReurEy5i.js +0 -1945
@@ -1,1945 +0,0 @@
1
- import { jsx as s, jsxs as P } from "react/jsx-runtime";
2
- import { useMemo as j, forwardRef as B, useState as G, useCallback as N, useEffect as H, useRef as K, createContext as Se, useContext as Ie, isValidElement as He, cloneElement as Ve, useImperativeHandle as Gt } from "react";
3
- import { S as Lt } from "./skeleton-CZbwyJAA.js";
4
- import { E as jt } from "./empty-state-X0sVPfVo.js";
5
- import { c as qt } from "./index-D2ZczOXr.js";
6
- import { useTranslation as A } from "react-i18next";
7
- import { useGridFilter as Bt, AgGridReact as Wt } from "ag-grid-react";
8
- import { ModuleRegistry as $t, AllCommunityModule as Kt } from "ag-grid-community";
9
- import { I as Ue } from "./icon-button-group-VCCod3Hz.js";
10
- import { B as ce } from "./button-nJaPh_HC.js";
11
- import { I as U } from "./icon-button-DA2CAGHZ.js";
12
- import { P as ge } from "./popover-Cqcjx-Ny.js";
13
- import { C as Ht } from "./checkbox-BuZ1u__2.js";
14
- import { T as Ee } from "./text-input-CUvCb6ST.js";
15
- import { T as $e } from "./tag-3wgkwwDB.js";
16
- import { D as q } from "./dropdown-menu-DU-Hrf33.js";
17
- import { X as Xe } from "./x-B5YnXwCz.js";
18
- import { R as Vt } from "./refresh-cw-DnI0cLFC.js";
19
- import { S as Ne } from "./search-QbWPlY5f.js";
20
- import { c as Ut } from "./createLucideIcon-DhHxpK9K.js";
21
- import { G as Xt } from "./grip-vertical-onSb1JXO.js";
22
- import { P as Qt } from "./printer-rkK0T1gi.js";
23
- import { F as Qe } from "./file-text-5yv6r2ls.js";
24
- import { D as ye } from "./download-CfYKJO_j.js";
25
- import { F as Jt } from "./file-spreadsheet-DmwyfV4O.js";
26
- import Zt from "i18next";
27
- import { S as Yt } from "./select-Bi8zril7.js";
28
- import { u as er } from "./registry-DvAUVLHh.js";
29
- import { u as tr } from "./use-prefers-reduced-motion-BMwIQRjB.js";
30
- import { u as rr } from "./use-theme-CAuo6EYT.js";
31
- import { E as Je } from "./ellipsis-dRo9ouSU.js";
32
- /**
33
- * @license lucide-react v1.22.0 - ISC
34
- *
35
- * This source code is licensed under the ISC license.
36
- * See the LICENSE file in the root directory of this source tree.
37
- */
38
- const nr = [
39
- ["path", { d: "M10.5 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.5", key: "1g2yzs" }],
40
- ["path", { d: "m14.3 19.6 1-.4", key: "11sv9r" }],
41
- ["path", { d: "M15 3v7.5", key: "7lm50a" }],
42
- ["path", { d: "m15.2 16.9-.9-.3", key: "1t7mvx" }],
43
- ["path", { d: "m16.6 21.7.3-.9", key: "1j67ps" }],
44
- ["path", { d: "m16.8 15.3-.4-1", key: "1ei7r6" }],
45
- ["path", { d: "m19.1 15.2.3-.9", key: "18r7jp" }],
46
- ["path", { d: "m19.6 21.7-.4-1", key: "z2vh2" }],
47
- ["path", { d: "m20.7 16.8 1-.4", key: "19m87a" }],
48
- ["path", { d: "m21.7 19.4-.9-.3", key: "1qgwi9" }],
49
- ["path", { d: "M9 3v18", key: "fh3hqa" }],
50
- ["circle", { cx: "18", cy: "18", r: "3", key: "1xkwt0" }]
51
- ], ar = Ut("columns-3-cog", nr);
52
- function or(e) {
53
- if (!He(e)) return e;
54
- const t = e, a = t.props.className ?? "", r = /\bsize-|\bw-|\bh-/.test(a) ? a : `${a} ds:size-4`.trim();
55
- return Ve(t, { className: r, size: t.props.size ?? 16 });
56
- }
57
- const Ze = Se(null);
58
- function X(e) {
59
- const t = Ie(Ze);
60
- if (!t)
61
- throw new Error(
62
- `${e} must be rendered inside <DataTable.Toolbar> as a descendant of <DataTable>.`
63
- );
64
- return t;
65
- }
66
- function ir({
67
- getApi: e,
68
- selectionCount: t,
69
- onPrint: a,
70
- markColumnsUserTouched: r,
71
- children: i
72
- }) {
73
- const d = j(
74
- () => ({ getApi: e, selectionCount: t, onPrint: a, markColumnsUserTouched: r }),
75
- [e, t, a, r]
76
- );
77
- return /* @__PURE__ */ s(Ze.Provider, { value: d, children: i });
78
- }
79
- const sr = [
80
- "data-table-toolbar",
81
- // Mobile (<sm) keeps `flex-wrap` so a wide QuickSearch can flow above the
82
- // Actions cluster on narrow screens. From `sm` (≥640px) we switch to
83
- // `flex-nowrap` + `min-w-0` so the row stays single-line at every common
84
- // desktop width (1024 / 1280 / 1440) — the QuickSearch slot shrinks via
85
- // its own `min-w-0` instead of pushing the trailing Actions to a new row.
86
- "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
87
- "ds:sm:flex-nowrap ds:min-w-0"
88
- // No card surface: the toolbar sits directly on the page background,
89
- // matching the header-tools layout the Patients / Care Plan List
90
- // patterns established (the old bg-card + border + shadow bar is gone).
91
- ].join(" "), Ye = B(
92
- ({ className: e, children: t, ...a }, r) => /* @__PURE__ */ s(
93
- "div",
94
- {
95
- ref: r,
96
- role: "toolbar",
97
- className: [sr, e ?? ""].join(" ").trim(),
98
- ...a,
99
- children: t
100
- }
101
- )
102
- );
103
- Ye.displayName = "DataTable.Toolbar";
104
- const et = B(
105
- ({ className: e, children: t, ...a }, r) => /* @__PURE__ */ s(
106
- "div",
107
- {
108
- ref: r,
109
- className: [
110
- "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
111
- // `grow` lets FilterBar absorb the free space; `min-w-0` lets the
112
- // QuickSearch slot inside shrink below its intrinsic width when the
113
- // toolbar runs `flex-nowrap` at `sm` and above, so the trailing
114
- // Actions cluster stays pinned on a single row.
115
- "ds:grow ds:min-w-0",
116
- e ?? ""
117
- ].join(" ").trim(),
118
- ...a,
119
- children: t
120
- }
121
- )
122
- );
123
- et.displayName = "DataTable.Toolbar.FilterBar";
124
- const tt = B(
125
- ({ className: e, children: t, ...a }, r) => /* @__PURE__ */ s(
126
- "div",
127
- {
128
- ref: r,
129
- className: [
130
- "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]",
131
- "ds:ms-auto",
132
- e ?? ""
133
- ].join(" ").trim(),
134
- ...a,
135
- children: t
136
- }
137
- )
138
- );
139
- tt.displayName = "DataTable.Toolbar.Actions";
140
- const De = B(
141
- ({ label: e, onExport: t, intent: a = "outline", ...r }, i) => {
142
- const { t: d } = A(), { getApi: g } = X("DataTable.Toolbar.ExportCsv"), p = N(() => {
143
- const f = g();
144
- f && (t ? t(f) : f.exportDataAsCsv());
145
- }, [g, t]);
146
- return /* @__PURE__ */ s(
147
- U,
148
- {
149
- ref: i,
150
- type: "button",
151
- intent: a,
152
- icon: /* @__PURE__ */ s(ye, { "aria-hidden": !0 }),
153
- tooltip: e ?? d("dataTable.exportCsv"),
154
- onClick: p,
155
- ...r
156
- }
157
- );
158
- }
159
- );
160
- De.displayName = "DataTable.Toolbar.ExportCsv";
161
- function oe(e, t = [30, 30, 30]) {
162
- if (typeof document > "u") return t;
163
- const a = document.createElement("span");
164
- a.style.color = `hsl(var(${e}))`, a.style.position = "absolute", a.style.visibility = "hidden", document.body.appendChild(a);
165
- const r = getComputedStyle(a).color;
166
- document.body.removeChild(a);
167
- const i = r.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);
168
- return i ? [Number(i[1]), Number(i[2]), Number(i[3])] : t;
169
- }
170
- async function rt(e, t) {
171
- if (!e) return;
172
- const [{ jsPDF: a }, { default: r }] = await Promise.all([
173
- import("./jspdf.es.min-DaapWjR1.js").then((v) => v.j),
174
- import("./jspdf.plugin.autotable-CSiDNyPn.js")
175
- ]), d = (e.getColumns() ?? []).filter((v) => v.isVisible()), g = [
176
- d.map((v) => e.getDisplayNameForColumn(v, null) ?? "")
177
- ], p = [];
178
- e.forEachNodeAfterFilterAndSort((v) => {
179
- if (!v.data) return;
180
- const u = d.map((l) => {
181
- const b = e.getCellValue({
182
- rowNode: v,
183
- colKey: l,
184
- useFormatter: !0
185
- });
186
- return b == null ? "" : String(b);
187
- });
188
- p.push(u);
189
- });
190
- const f = oe("--muted", [240, 240, 240]), h = oe("--foreground", [30, 30, 30]), m = oe("--card-foreground", [30, 30, 30]), x = oe("--card", [250, 250, 250]), R = new a({ orientation: "landscape" });
191
- r(R, {
192
- head: g,
193
- body: p,
194
- headStyles: { fillColor: f, textColor: h },
195
- bodyStyles: { textColor: m },
196
- alternateRowStyles: { fillColor: x },
197
- styles: {
198
- font: "helvetica",
199
- fontSize: 10,
200
- cellPadding: 4
201
- }
202
- }), R.save(t.fileName);
203
- }
204
- const ke = B(
205
- ({ label: e, onClick: t, fileName: a, intent: r = "outline", ...i }, d) => {
206
- const { t: g } = A(), { getApi: p } = X("DataTable.Toolbar.ExportPdf"), f = N(() => {
207
- const h = p();
208
- if (t) {
209
- t(h);
210
- return;
211
- }
212
- rt(h, {
213
- fileName: a ?? "data-table-export.pdf"
214
- });
215
- }, [p, t, a]);
216
- return /* @__PURE__ */ s(
217
- U,
218
- {
219
- ref: d,
220
- type: "button",
221
- intent: r,
222
- icon: /* @__PURE__ */ s(Qe, { "aria-hidden": !0 }),
223
- tooltip: e ?? g("dataTable.exportPdf"),
224
- onClick: f,
225
- ...i
226
- }
227
- );
228
- }
229
- );
230
- ke.displayName = "DataTable.Toolbar.ExportPdf";
231
- const Fe = B(
232
- ({ label: e, intent: t = "outline", ...a }, r) => {
233
- const { t: i } = A(), { onPrint: d } = X("DataTable.Toolbar.Print");
234
- return /* @__PURE__ */ s(
235
- U,
236
- {
237
- ref: r,
238
- type: "button",
239
- intent: t,
240
- icon: /* @__PURE__ */ s(Qt, { "aria-hidden": !0 }),
241
- tooltip: e ?? i("dataTable.print"),
242
- onClick: d,
243
- ...a
244
- }
245
- );
246
- }
247
- );
248
- Fe.displayName = "DataTable.Toolbar.Print";
249
- const nt = ({ placeholder: e, debounceMs: t = 150 }) => {
250
- const { t: a } = A(), { getApi: r } = X("DataTable.Toolbar.QuickSearch"), [i, d] = G(""), g = K(void 0);
251
- return H(() => (g.current && window.clearTimeout(g.current), g.current = window.setTimeout(() => {
252
- const p = r();
253
- p && p.setGridOption("quickFilterText", i);
254
- }, t), () => {
255
- g.current && window.clearTimeout(g.current);
256
- }), [i, t, r]), // Slot wrapper caps the search at a sensible legible width on desktop —
257
- // without this, TextInput's `w-full` lets the QuickSearch absorb the
258
- // entire FilterBar row and push trailing Actions onto a second line at
259
- // 1024 / 1280 / 1440. `min-w-0` lets the slot shrink below `24rem` when
260
- // the toolbar is squeezed on narrow viewports. There is no
261
- // `--toolbar-search-max` token in the kit yet — see this component's
262
- // summary for a follow-up note recommending we add one.
263
- /* @__PURE__ */ s("div", { className: "ds:w-full ds:max-w-[24rem] ds:min-w-0", children: /* @__PURE__ */ s(
264
- Ee,
265
- {
266
- type: "search",
267
- size: "sm",
268
- value: i,
269
- onChange: (p) => d(p.target.value),
270
- placeholder: e ?? a("dataTable.quickSearch.placeholder", "Search…"),
271
- startAdornment: /* @__PURE__ */ s(Ne, { "aria-hidden": !0, className: "ds:size-4" }),
272
- clearable: !0,
273
- onClear: () => d(""),
274
- "aria-label": a("dataTable.quickSearch.label", "Quick search")
275
- }
276
- ) });
277
- };
278
- nt.displayName = "DataTable.Toolbar.QuickSearch";
279
- const Ae = B(
280
- ({ onRefresh: e, label: t, intent: a = "outline", ...r }, i) => {
281
- const { t: d } = A();
282
- return /* @__PURE__ */ s(
283
- U,
284
- {
285
- ref: i,
286
- type: "button",
287
- intent: a,
288
- icon: /* @__PURE__ */ s(Vt, { "aria-hidden": !0 }),
289
- tooltip: t ?? d("dataTable.refresh", "Refresh"),
290
- onClick: e,
291
- ...r
292
- }
293
- );
294
- }
295
- );
296
- Ae.displayName = "DataTable.Toolbar.Refresh";
297
- function lr(e, t) {
298
- if (!e || typeof e != "object") return "";
299
- const a = e;
300
- if (typeof a.filter == "string" || typeof a.filter == "number") {
301
- const r = typeof a.type == "string" ? a.type : "", i = typeof a.filterTo == "string" || typeof a.filterTo == "number" ? String(a.filterTo) : "";
302
- return r === "inRange" && i ? `${a.filter} – ${i}` : r ? `${t(`dataTable.agGrid.${r}`, r)} ${a.filter}` : String(a.filter);
303
- }
304
- return typeof a.dateFrom == "string" ? typeof a.dateTo == "string" && a.dateTo ? `${a.dateFrom} – ${a.dateTo}` : String(a.dateFrom) : Array.isArray(a.values) ? a.values.map(String).join(", ") : "";
305
- }
306
- const at = () => {
307
- const { t: e } = A(), { getApi: t } = X("DataTable.Toolbar.FilterChips"), [a, r] = G([]), [i, d] = G(""), g = N(() => {
308
- const m = t();
309
- if (!m) {
310
- r([]), d("");
311
- return;
312
- }
313
- const x = m.getFilterModel() ?? {}, R = m.getColumns() ?? [], v = [];
314
- for (const l of Object.keys(x)) {
315
- const b = R.find((S) => S.getColId() === l), y = m.getDisplayNameForColumn(b, null) ?? l;
316
- v.push({
317
- colId: l,
318
- headerName: y,
319
- text: lr(x[l], e)
320
- });
321
- }
322
- r(v);
323
- const u = m.getGridOption("quickFilterText");
324
- d(typeof u == "string" ? u : "");
325
- }, [t, e]);
326
- if (H(() => {
327
- let m;
328
- const x = (u) => g(), R = (u) => {
329
- u.addEventListener("filterChanged", x), g(), m = () => u.removeEventListener("filterChanged", x);
330
- }, v = t();
331
- if (v)
332
- R(v);
333
- else {
334
- const u = window.setInterval(() => {
335
- const l = t();
336
- l && (window.clearInterval(u), R(l));
337
- }, 50);
338
- m = () => window.clearInterval(u);
339
- }
340
- return () => m == null ? void 0 : m();
341
- }, [t, g]), a.length + (i ? 1 : 0) === 0) return null;
342
- function f(m) {
343
- const x = t();
344
- x && x.destroyFilter(m);
345
- }
346
- function h() {
347
- const m = t();
348
- m && (m.setFilterModel(null), m.setGridOption("quickFilterText", ""), d(""));
349
- }
350
- return /* @__PURE__ */ P(
351
- "div",
352
- {
353
- role: "group",
354
- "aria-label": e("dataTable.filterChips.label", "Active filters"),
355
- className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
356
- children: [
357
- i && /* @__PURE__ */ s(
358
- $e,
359
- {
360
- label: `${e("dataTable.quickSearch.label", "Quick search")}: ${i}`,
361
- size: "sm",
362
- fill: "outline",
363
- onRemove: () => {
364
- const m = t();
365
- m == null || m.setGridOption("quickFilterText", ""), d("");
366
- }
367
- }
368
- ),
369
- a.map((m) => /* @__PURE__ */ s(
370
- $e,
371
- {
372
- label: m.text ? `${m.headerName}: ${m.text}` : m.headerName,
373
- size: "sm",
374
- fill: "outline",
375
- onRemove: () => f(m.colId)
376
- },
377
- m.colId
378
- )),
379
- /* @__PURE__ */ s(
380
- ce,
381
- {
382
- type: "button",
383
- intent: "ghost",
384
- size: "sm",
385
- onClick: h,
386
- startIcon: /* @__PURE__ */ s(Xe, { "aria-hidden": !0, className: "ds:size-4" }),
387
- children: e("dataTable.filterChips.clearAll", "Clear all")
388
- }
389
- )
390
- ]
391
- }
392
- );
393
- };
394
- at.displayName = "DataTable.Toolbar.FilterChips";
395
- const ot = ({
396
- field: e,
397
- options: t,
398
- label: a
399
- }) => {
400
- const { t: r } = A(), { getApi: i } = X("DataTable.Toolbar.FacetFilter"), [d, g] = G(null);
401
- function p(f) {
402
- g(f);
403
- const h = i();
404
- if (h) {
405
- if (f === null) {
406
- h.destroyFilter(e);
407
- return;
408
- }
409
- h.setColumnFilterModel(e, {
410
- type: "equals",
411
- filter: f
412
- }), h.onFilterChanged();
413
- }
414
- }
415
- return /* @__PURE__ */ s(
416
- "div",
417
- {
418
- role: "group",
419
- "aria-label": a ?? r("dataTable.facetFilter.label", "Filter"),
420
- className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]",
421
- children: t.map((f) => {
422
- const h = d === f.value;
423
- return /* @__PURE__ */ s(
424
- ce,
425
- {
426
- type: "button",
427
- size: "sm",
428
- intent: h ? "primary" : "secondary",
429
- "aria-pressed": h,
430
- onClick: () => p(f.value),
431
- children: f.label
432
- },
433
- String(f.value)
434
- );
435
- })
436
- }
437
- );
438
- };
439
- ot.displayName = "DataTable.Toolbar.FacetFilter";
440
- const dr = ["csv", "xlsx", "pdf"];
441
- async function cr(e, t) {
442
- if (!e) return;
443
- const a = await import("./exceljs.min-D2MHbJsF.js").then((l) => l.e), r = new a.Workbook(), i = r.addWorksheet("Sheet1"), g = (e.getColumns() ?? []).filter((l) => l.isVisible());
444
- i.addRow(
445
- g.map(
446
- (l) => e.getDisplayNameForColumn(l, null) ?? l.getColId()
447
- )
448
- ), e.forEachNodeAfterFilterAndSort((l) => {
449
- l.data && i.addRow(
450
- g.map((b) => {
451
- const y = e.getCellValue({
452
- rowNode: l,
453
- colKey: b,
454
- useFormatter: !0
455
- });
456
- return y ?? "";
457
- })
458
- );
459
- });
460
- const p = oe("--muted", [240, 240, 240]), f = oe("--foreground", [30, 30, 30]), h = i.getRow(1), m = ([l, b, y]) => `${l.toString(16).padStart(2, "0")}${b.toString(16).padStart(2, "0")}${y.toString(16).padStart(2, "0")}`.toUpperCase();
461
- h.eachCell((l) => {
462
- l.font = { bold: !0, color: { argb: `FF${m(f)}` } }, l.fill = {
463
- type: "pattern",
464
- pattern: "solid",
465
- fgColor: { argb: `FF${m(p)}` }
466
- };
467
- });
468
- const x = await r.xlsx.writeBuffer(), R = new Blob([x], {
469
- type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
470
- }), v = URL.createObjectURL(R), u = document.createElement("a");
471
- u.href = v, u.download = t.fileName, document.body.appendChild(u), u.click(), document.body.removeChild(u), URL.revokeObjectURL(v);
472
- }
473
- const it = Se(null);
474
- function ur() {
475
- const e = Ie(it);
476
- if (!e)
477
- throw new Error(
478
- "DataTable.Toolbar.ExportMenu.Item must be rendered inside DataTable.Toolbar.ExportMenu."
479
- );
480
- return e;
481
- }
482
- const Pe = B(
483
- ({ children: e, label: t, intent: a = "outline", ...r }, i) => {
484
- const { t: d } = A(), { getApi: g } = X("DataTable.Toolbar.ExportMenu"), p = j(() => ({ getApi: g }), [g]), f = e ?? dr.map((h) => /* @__PURE__ */ s(Oe, { format: h }, h));
485
- return /* @__PURE__ */ s(it.Provider, { value: p, children: /* @__PURE__ */ P(q.Root, { children: [
486
- /* @__PURE__ */ s(q.Trigger, { asChild: !0, children: /* @__PURE__ */ s(
487
- U,
488
- {
489
- ref: i,
490
- type: "button",
491
- intent: a,
492
- icon: /* @__PURE__ */ s(ye, { "aria-hidden": !0 }),
493
- tooltip: t ?? d("dataTable.export.menu", "Export"),
494
- "aria-label": t ?? d("dataTable.export.menu", "Export"),
495
- "aria-haspopup": "menu",
496
- ...r
497
- }
498
- ) }),
499
- /* @__PURE__ */ s(q.Content, { align: "end", sideOffset: 4, children: f })
500
- ] }) });
501
- }
502
- );
503
- Pe.displayName = "DataTable.Toolbar.ExportMenu";
504
- function pr(e, t) {
505
- return t === "csv" ? e("dataTable.export.csv", "Export CSV") : t === "xlsx" ? e("dataTable.export.xlsx", "Export Excel") : t === "pdf" ? e("dataTable.export.pdf", "Export PDF") : e("dataTable.export.custom", "Export");
506
- }
507
- function fr(e) {
508
- return e === "csv" ? /* @__PURE__ */ s(ye, { "aria-hidden": !0, className: "ds:size-4" }) : e === "xlsx" ? /* @__PURE__ */ s(Jt, { "aria-hidden": !0, className: "ds:size-4" }) : e === "pdf" ? /* @__PURE__ */ s(Qe, { "aria-hidden": !0, className: "ds:size-4" }) : /* @__PURE__ */ s(ye, { "aria-hidden": !0, className: "ds:size-4" });
509
- }
510
- const Oe = ({
511
- format: e,
512
- label: t,
513
- onClick: a,
514
- fileName: r
515
- }) => {
516
- const { t: i } = A(), { getApi: d } = ur(), g = N(() => {
517
- const p = d();
518
- if (e === "csv") {
519
- p == null || p.exportDataAsCsv();
520
- return;
521
- }
522
- if (e === "pdf") {
523
- rt(p, {
524
- fileName: r ?? "data-table-export.pdf"
525
- });
526
- return;
527
- }
528
- if (e === "xlsx") {
529
- cr(p, {
530
- fileName: r ?? "data-table-export.xlsx"
531
- });
532
- return;
533
- }
534
- a == null || a(p);
535
- }, [e, r, a, d]);
536
- return /* @__PURE__ */ s(q.Item, { onSelect: g, children: /* @__PURE__ */ P("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
537
- fr(e),
538
- /* @__PURE__ */ s("span", { children: t ?? pr(i, e) })
539
- ] }) });
540
- };
541
- Oe.displayName = "DataTable.Toolbar.ExportMenu.Item";
542
- function mr(e) {
543
- if (!e) return [];
544
- const t = (r) => r.getPinned() === "left" ? 0 : r.getPinned() === "right" ? 2 : 1;
545
- return [...e.getAllGridColumns() ?? []].sort(
546
- (r, i) => t(r) - t(i)
547
- ).map((r) => r.getColDef().hide === void 0 && r.getColId().startsWith("ag-Grid-") ? null : {
548
- colId: r.getColId(),
549
- displayName: e.getDisplayNameForColumn(r, null) || r.getColId(),
550
- visible: r.isVisible()
551
- }).filter((r) => r !== null);
552
- }
553
- const ze = B(
554
- function({ label: t, icon: a, footer: r, header: i, intent: d = "outline", ...g }, p) {
555
- const { t: f } = A(), { getApi: h, markColumnsUserTouched: m } = X(
556
- "DataTable.Toolbar.ColumnToggle"
557
- ), [x, R] = G(!1), [v, u] = G([]), [l, b] = G(null), [y, S] = G(null);
558
- H(() => {
559
- x && u(mr(h()));
560
- }, [x, h]);
561
- const I = N(
562
- (C, z) => {
563
- const M = h();
564
- M && (M.setColumnsVisible([C], z), m == null || m([C]), u(
565
- (k) => k.map(
566
- (D) => D.colId === C ? { ...D, visible: z } : D
567
- )
568
- ));
569
- },
570
- [h, m]
571
- ), re = N(
572
- (C, z) => {
573
- if (C === z) return;
574
- const M = h();
575
- if (!M) return;
576
- u((_) => {
577
- const E = _.findIndex((Z) => Z.colId === C), se = _.findIndex((Z) => Z.colId === z);
578
- if (E < 0 || se < 0) return _;
579
- const J = [..._], [ve] = J.splice(E, 1);
580
- return J.splice(se, 0, ve), J;
581
- });
582
- const k = M.getAllGridColumns(), D = k.find((_) => _.getColId() === C), W = k.find((_) => _.getColId() === z);
583
- if (!D || !W) return;
584
- D.getPinned() !== W.getPinned() && M.setColumnsPinned([C], W.getPinned() ?? null);
585
- const Q = M.getAllGridColumns().findIndex((_) => _.getColId() === z);
586
- Q >= 0 && M.moveColumns([C], Q);
587
- },
588
- [h]
589
- ), L = t ?? f("dataTable.columnToggle");
590
- return /* @__PURE__ */ P(ge.Root, { open: x, onOpenChange: R, children: [
591
- /* @__PURE__ */ s(ge.Trigger, { asChild: !0, children: /* @__PURE__ */ s(
592
- U,
593
- {
594
- ref: p,
595
- type: "button",
596
- intent: d,
597
- icon: a ?? /* @__PURE__ */ s(ar, { "aria-hidden": !0 }),
598
- tooltip: L,
599
- "aria-label": L,
600
- "aria-haspopup": "dialog",
601
- ...g
602
- }
603
- ) }),
604
- /* @__PURE__ */ P(
605
- ge.Content,
606
- {
607
- size: "sm",
608
- align: "end",
609
- className: "ds:flex ds:max-h-[var(--radix-popover-content-available-height)] ds:flex-col",
610
- children: [
611
- /* @__PURE__ */ s(ge.Heading, { children: L }),
612
- i ? /* @__PURE__ */ s("div", { className: "ds:mb-[var(--spacing-xs)] ds:border-b ds:border-[color:var(--border)] ds:pb-[var(--spacing-sm)]", children: i }) : null,
613
- /* @__PURE__ */ s(
614
- "ul",
615
- {
616
- className: "ds:flex ds:min-h-0 ds:flex-col ds:gap-[var(--spacing-xs)] ds:overflow-y-auto",
617
- "aria-label": L,
618
- children: v.map((C) => {
619
- const z = l === C.colId, M = y === C.colId && l !== C.colId;
620
- return /* @__PURE__ */ P(
621
- "li",
622
- {
623
- draggable: !0,
624
- onDragStart: (k) => {
625
- b(C.colId), k.dataTransfer.effectAllowed = "move", k.dataTransfer.setData("text/plain", C.colId);
626
- },
627
- onDragOver: (k) => {
628
- k.preventDefault(), k.dataTransfer.dropEffect = "move", S(C.colId);
629
- },
630
- onDragLeave: () => {
631
- S(
632
- (k) => k === C.colId ? null : k
633
- );
634
- },
635
- onDrop: (k) => {
636
- k.preventDefault();
637
- const D = k.dataTransfer.getData("text/plain");
638
- D && re(D, C.colId), b(null), S(null);
639
- },
640
- onDragEnd: () => {
641
- b(null), S(null);
642
- },
643
- className: [
644
- "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-xs)] ds:py-[var(--spacing-2xs,var(--spacing-xs))] ds:transition-colors",
645
- z ? "ds:opacity-50" : "",
646
- M ? "ds:bg-[color:color-mix(in_srgb,var(--primary)_8%,transparent)]" : ""
647
- ].filter(Boolean).join(" "),
648
- children: [
649
- /* @__PURE__ */ s(
650
- "span",
651
- {
652
- "aria-hidden": "true",
653
- className: "ds:cursor-grab ds:text-[color:var(--muted-foreground)] ds:active:cursor-grabbing",
654
- children: /* @__PURE__ */ s(Xt, { className: "ds:size-4" })
655
- }
656
- ),
657
- /* @__PURE__ */ s(
658
- Ht,
659
- {
660
- label: C.displayName,
661
- checked: C.visible,
662
- onCheckedChange: (k) => I(C.colId, k === !0)
663
- }
664
- )
665
- ]
666
- },
667
- C.colId
668
- );
669
- })
670
- }
671
- ),
672
- r ? /* @__PURE__ */ s("div", { className: "ds:mt-[var(--spacing-xs)] ds:border-t ds:border-[color:var(--border)] ds:pt-[var(--spacing-sm)]", children: r }) : null
673
- ]
674
- }
675
- )
676
- ] });
677
- }
678
- );
679
- ze.displayName = "DataTable.Toolbar.ColumnToggle";
680
- const st = B(
681
- ({ label: e, icon: t, onClick: a, variant: r = "default", size: i = "sm", ...d }, g) => {
682
- const { t: p } = A(), { getApi: f, selectionCount: h } = X(
683
- "DataTable.Toolbar.BulkAction"
684
- );
685
- return h === 0 ? null : /* @__PURE__ */ P(
686
- ce,
687
- {
688
- ref: g,
689
- type: "button",
690
- intent: r === "destructive" ? "destructive" : "secondary",
691
- size: i,
692
- startIcon: or(t),
693
- onClick: () => a(f()),
694
- "aria-label": `${e} (${p("dataTable.bulkAction", { count: h })})`,
695
- ...d,
696
- children: [
697
- /* @__PURE__ */ s("span", { children: e }),
698
- /* @__PURE__ */ s(
699
- "span",
700
- {
701
- "aria-hidden": "true",
702
- className: "ds:ms-[var(--spacing-xs)] ds:opacity-80",
703
- children: p("dataTable.bulkAction", { count: h })
704
- }
705
- )
706
- ]
707
- }
708
- );
709
- }
710
- );
711
- st.displayName = "DataTable.Toolbar.BulkAction";
712
- for (const e of [
713
- De,
714
- ke,
715
- Fe,
716
- Ae,
717
- Pe,
718
- ze
719
- ])
720
- e.rendersIconButton = !0;
721
- const gr = Object.assign(Pe, {
722
- Item: Oe
723
- }), be = Object.assign(Ye, {
724
- FilterBar: et,
725
- Actions: tt,
726
- /** @deprecated Use `Toolbar.ExportMenu` with a `csv` item. */
727
- ExportCsv: De,
728
- /** @deprecated Use `Toolbar.ExportMenu` with a `pdf` item. */
729
- ExportPdf: ke,
730
- Print: Fe,
731
- ColumnToggle: ze,
732
- BulkAction: st,
733
- QuickSearch: nt,
734
- Refresh: Ae,
735
- FilterChips: at,
736
- FacetFilter: ot,
737
- ExportMenu: gr
738
- }), hr = [
739
- "contains",
740
- "equals",
741
- "startsWith",
742
- "endsWith",
743
- "notContains"
744
- ];
745
- function br(e) {
746
- const t = new Intl.Collator(e, {
747
- sensitivity: "base",
748
- usage: "search"
749
- });
750
- function a(r, i) {
751
- if (i.length === 0) return 0;
752
- if (i.length > r.length) return -1;
753
- for (let d = 0; d <= r.length - i.length; d += 1)
754
- if (t.compare(r.slice(d, d + i.length), i) === 0)
755
- return d;
756
- return -1;
757
- }
758
- return {
759
- equals: (r, i) => t.compare(r, i) === 0,
760
- contains: (r, i) => a(r, i) !== -1,
761
- startsWith: (r, i) => i.length <= r.length && t.compare(r.slice(0, i.length), i) === 0,
762
- endsWith: (r, i) => i.length <= r.length && t.compare(
763
- r.slice(r.length - i.length),
764
- i
765
- ) === 0
766
- };
767
- }
768
- function xr(e) {
769
- return e == null ? null : typeof e == "string" ? e : String(e);
770
- }
771
- function yr(e) {
772
- const { model: t, onModelChange: a, getValue: r, placeholder: i, defaultOperator: d } = e, { t: g } = A("ui"), p = (t == null ? void 0 : t.type) ?? d ?? "contains", [f, h] = G(p), [m, x] = G((t == null ? void 0 : t.filter) ?? "");
773
- H(() => {
774
- h((t == null ? void 0 : t.type) ?? d ?? "contains"), x((t == null ? void 0 : t.filter) ?? "");
775
- }, [t, d]);
776
- const R = j(() => br(Zt.language), []);
777
- Bt({
778
- doesFilterPass: (y) => {
779
- const S = t;
780
- if (!S || S.filter === "") return !0;
781
- const I = xr(r(y.node));
782
- if (I === null) return !1;
783
- switch (S.type) {
784
- case "equals":
785
- return R.equals(I, S.filter);
786
- case "contains":
787
- return R.contains(I, S.filter);
788
- case "startsWith":
789
- return R.startsWith(I, S.filter);
790
- case "endsWith":
791
- return R.endsWith(I, S.filter);
792
- case "notContains":
793
- return !R.contains(I, S.filter);
794
- default:
795
- return !0;
796
- }
797
- }
798
- });
799
- function v() {
800
- if (m.trim() === "") {
801
- a(null);
802
- return;
803
- }
804
- a({ type: f, filter: m });
805
- }
806
- function u() {
807
- x(""), h(d ?? "contains"), a(null);
808
- }
809
- const l = hr.map(
810
- (y) => ({
811
- value: y,
812
- label: g(`dataTable.textFilter.operators.${y}`)
813
- })
814
- ), b = i ?? g("dataTable.textFilter.placeholder");
815
- return /* @__PURE__ */ P(
816
- "div",
817
- {
818
- "data-component": "text-filter",
819
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)] ds:min-w-[240px]",
820
- children: [
821
- /* @__PURE__ */ s(
822
- Yt,
823
- {
824
- size: "sm",
825
- options: l,
826
- value: f,
827
- onValueChange: (y) => {
828
- y !== "" && h(y);
829
- },
830
- "aria-label": g("dataTable.textFilter.operators.contains")
831
- }
832
- ),
833
- /* @__PURE__ */ s(
834
- Ee,
835
- {
836
- size: "sm",
837
- value: m,
838
- onChange: (y) => x(y.target.value),
839
- onKeyDown: (y) => {
840
- y.key === "Enter" && (y.preventDefault(), v());
841
- },
842
- placeholder: b,
843
- "aria-label": b,
844
- startAdornment: /* @__PURE__ */ s(Ne, { "aria-hidden": "true", className: "ds:size-4" })
845
- }
846
- ),
847
- /* @__PURE__ */ P("div", { className: "ds:flex ds:items-center ds:justify-end ds:gap-[var(--spacing-xs)] ds:pt-[var(--spacing-xs)] ds:border-t ds:border-[var(--border)]", children: [
848
- /* @__PURE__ */ s(ce, { intent: "ghost", size: "sm", onClick: u, type: "button", children: g("dataTable.textFilter.clear") }),
849
- /* @__PURE__ */ s(ce, { intent: "primary", size: "sm", onClick: v, type: "button", children: g("dataTable.textFilter.apply") })
850
- ] })
851
- ]
852
- }
853
- );
854
- }
855
- function vr(e) {
856
- var x, R;
857
- const { model: t, onModelChange: a, column: r } = e, { t: i } = A("ui"), d = ((R = (x = r == null ? void 0 : r.getColDef) == null ? void 0 : x.call(r)) == null ? void 0 : R.filterParams) ?? {}, g = d.defaultOperator ?? "contains", p = d.placeholder ?? i("dataTable.textFilter.placeholder"), [f, h] = G((t == null ? void 0 : t.filter) ?? "");
858
- H(() => {
859
- h((t == null ? void 0 : t.filter) ?? "");
860
- }, [t == null ? void 0 : t.filter]), H(() => {
861
- if (f === ((t == null ? void 0 : t.filter) ?? "")) return;
862
- const v = setTimeout(() => {
863
- if (f === "") {
864
- t && a(null);
865
- return;
866
- }
867
- a({ type: g, filter: f });
868
- }, 200);
869
- return () => clearTimeout(v);
870
- }, [f, g, t, a]);
871
- function m() {
872
- h(""), t && a(null);
873
- }
874
- return /* @__PURE__ */ s("div", { "data-component": "text-floating-filter", className: "ds:w-full", children: /* @__PURE__ */ s(
875
- Ee,
876
- {
877
- size: "sm",
878
- value: f,
879
- onChange: (v) => h(v.target.value),
880
- placeholder: p,
881
- "aria-label": p,
882
- startAdornment: /* @__PURE__ */ s(Ne, { "aria-hidden": "true", className: "ds:size-4" }),
883
- endAdornment: f.length > 0 ? /* @__PURE__ */ s(
884
- "button",
885
- {
886
- type: "button",
887
- "aria-label": i("dataTable.textFilter.clear"),
888
- onClick: m,
889
- className: "ds:pointer-events-auto ds:flex ds:items-center ds:text-[var(--muted-foreground)] ds:hover:text-[var(--foreground)] ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
890
- children: /* @__PURE__ */ s(Xe, { "aria-hidden": "true", className: "ds:size-4" })
891
- }
892
- ) : void 0
893
- }
894
- ) });
895
- }
896
- const Tr = /* @__PURE__ */ new Set(["presentation", "none"]), Ke = '[role="presentation"][aria-hidden], [role="none"][aria-hidden]';
897
- function he(e) {
898
- const t = e.getAttribute("role");
899
- t === null || !Tr.has(t) || e.getAttribute("aria-hidden") === "false" && e.removeAttribute("aria-hidden");
900
- }
901
- function wr(e, t = !0) {
902
- H(() => {
903
- const a = e.current;
904
- if (!t || !a || typeof MutationObserver > "u") return;
905
- (() => {
906
- for (const d of a.querySelectorAll(Ke)) he(d);
907
- })();
908
- const i = new MutationObserver((d) => {
909
- for (const g of d)
910
- if (g.type === "attributes")
911
- he(g.target);
912
- else
913
- for (const p of g.addedNodes)
914
- if (p instanceof Element) {
915
- he(p);
916
- for (const f of p.querySelectorAll(Ke))
917
- he(f);
918
- }
919
- });
920
- return i.observe(a, {
921
- subtree: !0,
922
- childList: !0,
923
- attributes: !0,
924
- attributeFilter: ["aria-hidden"]
925
- }), () => i.disconnect();
926
- }, [e, t]);
927
- }
928
- const ie = "__dsDetailOf", Cr = "ds-data-table-expanded-row", lt = "::detail", Rr = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
929
- function $(e) {
930
- return typeof e == "object" && e !== null && typeof e[ie] == "string";
931
- }
932
- function Sr(e) {
933
- return `${e}${lt}`;
934
- }
935
- function vn(e) {
936
- return e.endsWith(lt);
937
- }
938
- function Ir(e, t) {
939
- return { ...e, [ie]: t };
940
- }
941
- const dt = Se(
942
- null
943
- );
944
- function Er(e) {
945
- var u;
946
- const t = Ie(
947
- dt
948
- ), { t: a } = A(), r = K(null), { data: i, node: d, api: g } = e, p = $(i), f = t == null ? void 0 : t.heights, h = d.id, m = K(t);
949
- if (m.current = t, H(() => {
950
- const l = r.current;
951
- if (!l || !p || !f || h == null) return;
952
- let b = f.get(h) ?? 0;
953
- const y = () => {
954
- const I = Math.ceil(l.getBoundingClientRect().height);
955
- I <= 0 || I === b || (b = I, f.set(h, I), d.setRowHeight(I), g.onRowHeightChanged());
956
- };
957
- y();
958
- const S = new ResizeObserver(y);
959
- return S.observe(l), () => S.disconnect();
960
- }, [g, h, f, p, d]), H(() => {
961
- const l = r.current, b = l == null ? void 0 : l.parentElement;
962
- if (!l || !b || !p) return;
963
- const y = (S) => {
964
- var I, re;
965
- S.target !== b || S.defaultPrevented || (S.key === "Escape" ? (S.stopPropagation(), (re = (I = m.current) == null ? void 0 : I.onExpandedRowChange) == null || re.call(I, null)) : S.key === "Enter" && (S.preventDefault(), (l.querySelector(Rr) ?? l).focus()));
966
- };
967
- return b.addEventListener("keydown", y), () => b.removeEventListener("keydown", y);
968
- }, [p]), !p) {
969
- const l = t == null ? void 0 : t.fallbackRenderer;
970
- return l ? /* @__PURE__ */ s(l, { ...e }) : null;
971
- }
972
- const x = i[ie];
973
- let R;
974
- if (t != null && t.expanded && t.expanded.id === x)
975
- R = t.expanded.row;
976
- else {
977
- const { [ie]: l, ...b } = i;
978
- R = b;
979
- }
980
- return /* @__PURE__ */ P(
981
- "div",
982
- {
983
- ref: r,
984
- role: "gridcell",
985
- tabIndex: -1,
986
- "data-component": "data-table-expanded-row",
987
- "data-expanded-row-of": x,
988
- className: "ds-data-table-expanded-row-surface",
989
- onKeyDown: (l) => {
990
- var b;
991
- l.key !== "Escape" || l.defaultPrevented || (l.stopPropagation(), (b = t == null ? void 0 : t.onExpandedRowChange) == null || b.call(t, null));
992
- },
993
- children: [
994
- /* @__PURE__ */ s("span", { className: "ds:sr-only", children: a("dataTable.expandedRow") }),
995
- (u = t == null ? void 0 : t.renderExpandedRow) == null ? void 0 : u.call(t, R)
996
- ]
997
- }
998
- );
999
- }
1000
- const Nr = {
1001
- id: "data-table",
1002
- capabilities: [
1003
- "select_single",
1004
- "select_multiple",
1005
- "range_pick",
1006
- "filter",
1007
- "sort",
1008
- "paginate"
1009
- ],
1010
- state: {
1011
- selection: {
1012
- type: "string[]",
1013
- descriptionKey: "ui.agent.dataTable.state.selection",
1014
- description: "Row ids of currently-selected rows.",
1015
- read: (e) => e.getSelection()
1016
- },
1017
- filter: {
1018
- type: "object",
1019
- descriptionKey: "ui.agent.dataTable.state.filter",
1020
- description: "Current ag-grid filter model, keyed by column id.",
1021
- read: (e) => e.getFilter()
1022
- },
1023
- sort: {
1024
- type: "Array<{ colId, sort }>",
1025
- descriptionKey: "ui.agent.dataTable.state.sort",
1026
- description: "Active sort, in priority order.",
1027
- read: (e) => e.getSort()
1028
- },
1029
- currentPage: {
1030
- type: "number",
1031
- descriptionKey: "ui.agent.dataTable.state.currentPage",
1032
- description: "Zero-indexed page number.",
1033
- read: (e) => e.getCurrentPage()
1034
- },
1035
- expandedRowId: {
1036
- type: "string | null",
1037
- descriptionKey: "ui.agent.dataTable.state.expandedRowId",
1038
- description: "Id of the row whose inline detail is open (expandable row), or null.",
1039
- read: (e) => e.getExpandedRowId()
1040
- }
1041
- },
1042
- actions: {
1043
- select_rows: {
1044
- // Transient grid selection (data-table convention) — stays read.
1045
- safety: "read",
1046
- argsType: "{ ids: string[] }",
1047
- argsSchema: {
1048
- type: "object",
1049
- properties: {
1050
- ids: {
1051
- type: "array",
1052
- items: { type: "string" },
1053
- description: "Row ids to select (replaces the current selection)."
1054
- }
1055
- },
1056
- required: ["ids"]
1057
- },
1058
- idempotent: !0,
1059
- descriptionKey: "ui.agent.dataTable.actions.selectRows",
1060
- description: "Replace the current selection with the given row ids.",
1061
- examples: [
1062
- { args: { ids: ["r-1", "r-2"] }, note: "Select the first two rows." }
1063
- ],
1064
- invoke: (e, t) => {
1065
- e.setSelection(t.ids);
1066
- }
1067
- },
1068
- select_range: {
1069
- safety: "read",
1070
- argsType: "{ fromId: string, toId: string }",
1071
- argsSchema: {
1072
- type: "object",
1073
- properties: {
1074
- fromId: { type: "string", description: "Start row id (inclusive)." },
1075
- toId: { type: "string", description: "End row id (inclusive)." }
1076
- },
1077
- required: ["fromId", "toId"]
1078
- },
1079
- idempotent: !0,
1080
- descriptionKey: "ui.agent.dataTable.actions.selectRange",
1081
- description: "Select every row between fromId and toId, inclusive, in current sort order.",
1082
- invoke: (e, t) => {
1083
- e.selectRange(t.fromId, t.toId);
1084
- }
1085
- },
1086
- clear_selection: {
1087
- safety: "read",
1088
- idempotent: !0,
1089
- descriptionKey: "ui.agent.dataTable.actions.clearSelection",
1090
- description: "Deselect all rows.",
1091
- invoke: (e) => {
1092
- e.clearSelection();
1093
- }
1094
- },
1095
- get_selection: {
1096
- safety: "read",
1097
- returns: "string[]",
1098
- returnsSchema: { type: "array", items: { type: "string" } },
1099
- idempotent: !0,
1100
- descriptionKey: "ui.agent.dataTable.actions.getSelection",
1101
- description: "Return the row ids of the currently-selected rows.",
1102
- invoke: (e) => e.getSelection()
1103
- },
1104
- apply_filter: {
1105
- safety: "read",
1106
- argsType: "{ model: Record<string, unknown> }",
1107
- argsSchema: {
1108
- type: "object",
1109
- properties: {
1110
- model: {
1111
- type: "object",
1112
- description: "ag-grid filter model keyed by column id. Opaque per-column filter shapes; replaces the current model.",
1113
- additionalProperties: !0
1114
- }
1115
- },
1116
- required: ["model"]
1117
- },
1118
- idempotent: !0,
1119
- descriptionKey: "ui.agent.dataTable.actions.applyFilter",
1120
- description: "Replace the filter model with the given object.",
1121
- invoke: (e, t) => {
1122
- e.setFilter(t.model);
1123
- }
1124
- },
1125
- sort_by: {
1126
- safety: "read",
1127
- argsType: "{ model: DataTableSortEntry[] }",
1128
- argsSchema: {
1129
- type: "object",
1130
- properties: {
1131
- model: {
1132
- type: "array",
1133
- description: "Sort entries in priority order.",
1134
- items: {
1135
- type: "object",
1136
- properties: {
1137
- colId: { type: "string", description: "Column id to sort by." },
1138
- sort: { enum: ["asc", "desc"], description: "Sort direction." }
1139
- },
1140
- required: ["colId", "sort"]
1141
- }
1142
- }
1143
- },
1144
- required: ["model"]
1145
- },
1146
- idempotent: !0,
1147
- descriptionKey: "ui.agent.dataTable.actions.sortBy",
1148
- description: "Replace the active sort with the given list (priority order).",
1149
- examples: [
1150
- {
1151
- args: { model: [{ colId: "name", sort: "asc" }] },
1152
- note: "Sort by name ascending."
1153
- }
1154
- ],
1155
- invoke: (e, t) => {
1156
- e.setSort(t.model);
1157
- }
1158
- },
1159
- go_to_page: {
1160
- safety: "read",
1161
- argsType: "{ page: number }",
1162
- argsSchema: {
1163
- type: "object",
1164
- properties: {
1165
- page: {
1166
- type: "integer",
1167
- minimum: 0,
1168
- description: "Zero-indexed page number."
1169
- }
1170
- },
1171
- required: ["page"]
1172
- },
1173
- idempotent: !0,
1174
- descriptionKey: "ui.agent.dataTable.actions.goToPage",
1175
- description: "Navigate to the given zero-indexed page.",
1176
- invoke: (e, t) => {
1177
- e.goToPage(t.page);
1178
- }
1179
- }
1180
- },
1181
- domHooks: {
1182
- root: {
1183
- attr: "data-component",
1184
- value: "data-table",
1185
- description: "Marks the DataTable wrapper."
1186
- },
1187
- instanceId: {
1188
- attr: "data-component-id",
1189
- sourceProp: "gridId",
1190
- description: "Sourced from the gridId prop. Required to address a specific table from the agent."
1191
- },
1192
- item: {
1193
- attr: "row-id",
1194
- description: 'Native ag-grid row-id attribute on each rendered record row. When an expandable row is open, one extra full-width row with row-id `<parentId>::detail` is the accordion detail, not a record — its cell carries data-component="data-table-expanded-row" and data-expanded-row-of="<parentId>"; skip it when enumerating rows (isExpandedRowDetailId). Selection is performed via the curated handle, not by DOM mutation.'
1195
- }
1196
- }
1197
- };
1198
- $t.registerModules([Kt]);
1199
- const Dr = qt("ag-theme-alfadocs ds:w-full", {
1200
- variants: {
1201
- density: {
1202
- default: "",
1203
- compact: "data-table-compact",
1204
- expanded: "data-table-expanded"
1205
- },
1206
- bordered: {
1207
- true: "",
1208
- false: "ds:[--ag-borders:none]"
1209
- }
1210
- },
1211
- defaultVariants: {
1212
- density: "default",
1213
- bordered: !0
1214
- }
1215
- });
1216
- function kr() {
1217
- const { t: e } = A();
1218
- return j(
1219
- () => ({
1220
- // Filter strings
1221
- contains: e("dataTable.agGrid.contains"),
1222
- notContains: e("dataTable.agGrid.notContains"),
1223
- equals: e("dataTable.agGrid.equals"),
1224
- notEqual: e("dataTable.agGrid.notEqual"),
1225
- startsWith: e("dataTable.agGrid.startsWith"),
1226
- endsWith: e("dataTable.agGrid.endsWith"),
1227
- lessThan: e("dataTable.agGrid.lessThan"),
1228
- greaterThan: e("dataTable.agGrid.greaterThan"),
1229
- inRange: e("dataTable.agGrid.inRange"),
1230
- blank: e("dataTable.agGrid.blank"),
1231
- notBlank: e("dataTable.agGrid.notBlank"),
1232
- filterOoo: e("dataTable.agGrid.filterOoo"),
1233
- applyFilter: e("dataTable.agGrid.applyFilter"),
1234
- resetFilter: e("dataTable.agGrid.resetFilter"),
1235
- noRowsToShow: e("dataTable.agGrid.noRowsToShow"),
1236
- selectAll: e("dataTable.agGrid.selectAll"),
1237
- // Pagination
1238
- page: e("dataTable.page"),
1239
- of: e("dataTable.of"),
1240
- to: e("dataTable.to"),
1241
- nextPage: e("dataTable.nextPage"),
1242
- previousPage: e("dataTable.previousPage"),
1243
- firstPage: e("dataTable.firstPage"),
1244
- lastPage: e("dataTable.lastPage"),
1245
- pageSize: e("dataTable.pageSize")
1246
- }),
1247
- [e]
1248
- );
1249
- }
1250
- function Fr() {
1251
- return /* @__PURE__ */ s(
1252
- "div",
1253
- {
1254
- role: "status",
1255
- "aria-live": "polite",
1256
- className: "ds:flex ds:w-full ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]",
1257
- children: Array.from({ length: 5 }).map((e, t) => /* @__PURE__ */ s(
1258
- Lt,
1259
- {
1260
- variant: "rectangular",
1261
- className: "ds:h-[var(--min-target-size)] ds:w-full"
1262
- },
1263
- t
1264
- ))
1265
- }
1266
- );
1267
- }
1268
- function Ar() {
1269
- const { t: e } = A();
1270
- return /* @__PURE__ */ s(
1271
- jt,
1272
- {
1273
- variant: "no-results",
1274
- size: "sm",
1275
- title: e("dataTable.noRows"),
1276
- description: e("dataTable.noRowsDescription")
1277
- }
1278
- );
1279
- }
1280
- function Pr(e) {
1281
- return e.map(({ pinned: t, ...a }) => a);
1282
- }
1283
- function Or(e) {
1284
- return e.map(({ hide: t, pinned: a, ...r }) => r);
1285
- }
1286
- function zr(e, t) {
1287
- try {
1288
- const a = localStorage.getItem(`data-table-col-state:${e}`);
1289
- if (!a) return null;
1290
- const r = JSON.parse(a);
1291
- if (Array.isArray(r))
1292
- return {
1293
- state: Or(r),
1294
- touched: []
1295
- };
1296
- if (typeof r != "object" || r === null) return null;
1297
- const i = r;
1298
- return i.v !== 2 || !Array.isArray(i.state) ? null : {
1299
- state: i.dir === t ? i.state : Pr(i.state),
1300
- touched: Array.isArray(i.touched) ? i.touched.filter((d) => typeof d == "string") : []
1301
- };
1302
- } catch {
1303
- return null;
1304
- }
1305
- }
1306
- function Mr(e, t, a, r) {
1307
- try {
1308
- const i = {
1309
- v: 2,
1310
- dir: a,
1311
- state: t.getColumnState(),
1312
- touched: [...r]
1313
- };
1314
- localStorage.setItem(
1315
- `data-table-col-state:${e}`,
1316
- JSON.stringify(i)
1317
- );
1318
- } catch {
1319
- }
1320
- }
1321
- const _r = /* @__PURE__ */ new Set([
1322
- "api",
1323
- "flex",
1324
- "gridInitializing",
1325
- "gridOptionsChanged",
1326
- "autosizeColumns",
1327
- "sizeColumnsToFit"
1328
- ]);
1329
- function Gr(e, t) {
1330
- const {
1331
- columnDefs: a,
1332
- rowData: r,
1333
- rowSelection: i,
1334
- pagination: d = !1,
1335
- paginationPageSize: g = 25,
1336
- paginationPageSizeSelector: p = [10, 25, 50, 100],
1337
- gridId: f,
1338
- onSelectionChanged: h,
1339
- onSortChanged: m,
1340
- onFilterChanged: x,
1341
- noRowsOverlay: R,
1342
- loadingOverlay: v,
1343
- gridOptions: u,
1344
- density: l,
1345
- bordered: b,
1346
- heightClass: y = "ds:h-[500px]",
1347
- className: S,
1348
- getRowClass: I,
1349
- pinnedBottomRowData: re,
1350
- printMode: L = !1,
1351
- expandedRowId: C,
1352
- renderExpandedRow: z,
1353
- onExpandedRowChange: M,
1354
- children: k
1355
- } = e, D = C !== void 0 || z !== void 0, W = u == null ? void 0 : u.getRowId;
1356
- if (D && !W)
1357
- throw new Error(
1358
- "DataTable: `expandedRowId` / `renderExpandedRow` require `gridOptions.getRowId` — the expanded row is addressed by row id, not by index."
1359
- );
1360
- const { t: Q, i18n: _ } = A(), E = K(null), se = K(null);
1361
- wr(se);
1362
- const [J, ve] = G(0), [Z, Te] = G(""), ut = kr(), Me = K(C);
1363
- Me.current = C;
1364
- const we = j(
1365
- () => ({
1366
- getSelection: () => {
1367
- var c;
1368
- const n = (c = E.current) == null ? void 0 : c.api;
1369
- if (!n) return [];
1370
- const o = [];
1371
- for (const T of n.getSelectedNodes())
1372
- T.id != null && !$(T.data) && o.push(T.id);
1373
- return o;
1374
- },
1375
- setSelection: (n) => {
1376
- var T;
1377
- const o = (T = E.current) == null ? void 0 : T.api;
1378
- if (!o) return;
1379
- const c = new Set(n);
1380
- o.forEachNode((w) => {
1381
- w.id != null && w.setSelected(c.has(w.id));
1382
- });
1383
- },
1384
- selectRange: (n, o) => {
1385
- var We;
1386
- const c = (We = E.current) == null ? void 0 : We.api;
1387
- if (!c) return;
1388
- const T = [];
1389
- c.forEachNodeAfterFilterAndSort((te) => {
1390
- te.id != null && !$(te.data) && T.push(te.id);
1391
- });
1392
- const w = T.indexOf(n), F = T.indexOf(o);
1393
- if (w < 0 || F < 0) return;
1394
- const [O, ae] = w <= F ? [w, F] : [F, w], ee = new Set(T.slice(O, ae + 1));
1395
- c.forEachNode((te) => {
1396
- te.id != null && te.setSelected(ee.has(te.id));
1397
- });
1398
- },
1399
- clearSelection: () => {
1400
- var n, o;
1401
- (o = (n = E.current) == null ? void 0 : n.api) == null || o.deselectAll();
1402
- },
1403
- getFilter: () => {
1404
- var n, o;
1405
- return ((o = (n = E.current) == null ? void 0 : n.api) == null ? void 0 : o.getFilterModel()) ?? {};
1406
- },
1407
- setFilter: (n) => {
1408
- var o, c;
1409
- (c = (o = E.current) == null ? void 0 : o.api) == null || c.setFilterModel(n);
1410
- },
1411
- getSort: () => {
1412
- var o;
1413
- const n = (o = E.current) == null ? void 0 : o.api;
1414
- return n ? n.getColumnState().filter((c) => c.sort === "asc" || c.sort === "desc").map((c) => ({ colId: c.colId, sort: c.sort })) : [];
1415
- },
1416
- setSort: (n) => {
1417
- var T;
1418
- const o = (T = E.current) == null ? void 0 : T.api;
1419
- if (!o) return;
1420
- const c = o.getColumnState().map((w) => {
1421
- const F = n.find((O) => O.colId === w.colId);
1422
- return { ...w, sort: F ? F.sort : null };
1423
- });
1424
- o.applyColumnState({ state: c, defaultState: { sort: null } });
1425
- },
1426
- getCurrentPage: () => {
1427
- var n, o;
1428
- return ((o = (n = E.current) == null ? void 0 : n.api) == null ? void 0 : o.paginationGetCurrentPage()) ?? 0;
1429
- },
1430
- goToPage: (n) => {
1431
- var o, c;
1432
- (c = (o = E.current) == null ? void 0 : o.api) == null || c.paginationGoToPage(n);
1433
- },
1434
- getExpandedRowId: () => Me.current ?? null,
1435
- getUserTouchedColumns: () => [...ne.current],
1436
- markColumnsUserTouched: (n) => _e.current(n),
1437
- getRawApi: () => {
1438
- var n;
1439
- return (n = E.current) == null ? void 0 : n.api;
1440
- }
1441
- }),
1442
- []
1443
- ), ue = K(/* @__PURE__ */ new Map()), ne = K(/* @__PURE__ */ new Set()), _e = K(
1444
- () => {
1445
- }
1446
- );
1447
- Gt(t, () => we, [we]), er(Nr, we, f);
1448
- const Ge = _.dir() === "rtl", pt = r === void 0, ft = tr(), { resolvedTheme: Le } = rr(), mt = (Le === "light-accessible" || Le === "dark-accessible") && l === "compact" ? "default" : l, gt = j(() => {
1449
- if (!i) return;
1450
- const n = (o) => !$(o.data);
1451
- return i === "single" ? { mode: "singleRow", isRowSelectable: n } : {
1452
- mode: "multiRow",
1453
- headerCheckbox: !0,
1454
- checkboxes: !0,
1455
- isRowSelectable: n
1456
- };
1457
- }, [i]), pe = Ge ? "rtl" : "ltr", V = N(
1458
- (n, o, c) => {
1459
- const T = new Set(o);
1460
- for (const w of n.getColumnState()) {
1461
- if (!T.has(w.colId)) continue;
1462
- const F = ue.current.get(w.colId) ?? {};
1463
- for (const O of c) F[O] = w[O];
1464
- ue.current.set(w.colId, F);
1465
- }
1466
- },
1467
- []
1468
- ), le = N(
1469
- (n) => {
1470
- f && Mr(f, n, pe, ne.current);
1471
- },
1472
- [f, pe]
1473
- ), je = N(
1474
- (n) => {
1475
- var c;
1476
- for (const T of n) ne.current.add(T);
1477
- const o = (c = E.current) == null ? void 0 : c.api;
1478
- o && (V(o, n, ["hide"]), le(o));
1479
- },
1480
- [le, V]
1481
- );
1482
- _e.current = je;
1483
- const ht = N(() => {
1484
- var c;
1485
- if (!((c = E.current) != null && c.api)) return;
1486
- const n = E.current.api, o = f ? zr(f, pe) : null;
1487
- if (o) {
1488
- for (const T of o.touched) ne.current.add(T);
1489
- n.applyColumnState({
1490
- state: o.state,
1491
- applyOrder: !0
1492
- }), V(n, o.touched, ["hide"]);
1493
- }
1494
- }, [f, pe, V]), bt = N(
1495
- (n) => {
1496
- var c;
1497
- if (n.source !== "gridOptionsChanged") return;
1498
- const o = (c = E.current) == null ? void 0 : c.api;
1499
- !o || ue.current.size === 0 || o.applyColumnState({
1500
- state: [...ue.current].map(([T, w]) => ({
1501
- colId: T,
1502
- ...w
1503
- }))
1504
- });
1505
- },
1506
- []
1507
- ), fe = N(
1508
- (n) => {
1509
- var T;
1510
- const o = (T = E.current) == null ? void 0 : T.api;
1511
- if (!o) return;
1512
- const c = (n.columns ?? (n.column ? [n.column] : [])).map((w) => w.getColId());
1513
- if (n.source && _r.has(n.source)) {
1514
- if (n.source === "api" && "visible" in n) {
1515
- const w = c.filter(
1516
- (F) => ne.current.has(F)
1517
- );
1518
- w.length > 0 && (V(o, w, ["hide"]), le(o));
1519
- }
1520
- return;
1521
- }
1522
- if ("visible" in n) {
1523
- for (const w of c) ne.current.add(w);
1524
- V(o, c, ["hide"]);
1525
- } else "pinned" in n ? V(o, c, ["pinned"]) : "flexColumns" in n && V(o, c, ["width", "flex"]);
1526
- le(o);
1527
- },
1528
- [le, V]
1529
- ), xt = j(() => {
1530
- if (!u) return;
1531
- const n = { ...u };
1532
- return delete n.defaultColDef, D && (delete n.getRowId, delete n.isFullWidthRow, delete n.fullWidthCellRenderer, delete n.getRowHeight, delete n.postSortRows, delete n.getRowClass, delete n.defaultCsvExportParams, delete n.defaultExcelExportParams), n;
1533
- }, [D, u]), qe = K(/* @__PURE__ */ new Map()), de = K(u);
1534
- de.current = u;
1535
- const Be = N(
1536
- (n) => {
1537
- var o;
1538
- return W == null ? void 0 : W({
1539
- data: n,
1540
- level: 0,
1541
- api: (o = E.current) == null ? void 0 : o.api,
1542
- context: u == null ? void 0 : u.context
1543
- });
1544
- },
1545
- [W, u == null ? void 0 : u.context]
1546
- ), Y = j(() => {
1547
- if (!D || C == null || !r) return null;
1548
- const n = r.find((o) => Be(o) === C);
1549
- return n === void 0 ? null : { id: C, row: n };
1550
- }, [D, C, Be, r]), yt = j(() => {
1551
- if (!Y || !r) return r;
1552
- const n = r.indexOf(Y.row), o = Ir(Y.row, Y.id);
1553
- return [
1554
- ...r.slice(0, n + 1),
1555
- o,
1556
- ...r.slice(n + 1)
1557
- ];
1558
- }, [Y, r]), vt = N(
1559
- (n) => $(n.data) ? Sr(n.data[ie]) : W(n),
1560
- [W]
1561
- ), Tt = N(
1562
- (n) => {
1563
- var o, c;
1564
- return $(n.rowNode.data) || (((c = (o = de.current) == null ? void 0 : o.isFullWidthRow) == null ? void 0 : c.call(o, n)) ?? !1);
1565
- },
1566
- []
1567
- ), wt = N(
1568
- (n) => {
1569
- var o, c;
1570
- return $(n.data) ? qe.current.get(n.node.id ?? "") : (c = (o = de.current) == null ? void 0 : o.getRowHeight) == null ? void 0 : c.call(o, n);
1571
- },
1572
- []
1573
- ), Ct = N(
1574
- (n) => {
1575
- var O, ae;
1576
- (ae = (O = de.current) == null ? void 0 : O.postSortRows) == null || ae.call(O, n);
1577
- const { nodes: o } = n, c = o.findIndex((ee) => $(ee.data));
1578
- if (c < 0) return;
1579
- const [T] = o.splice(c, 1), w = T.data[ie], F = o.findIndex((ee) => ee.id === w);
1580
- o.splice(F < 0 ? o.length : F + 1, 0, T);
1581
- },
1582
- []
1583
- ), Rt = N(
1584
- (n) => {
1585
- var o, c;
1586
- return $(n.data) ? Cr : ((c = (o = de.current) == null ? void 0 : o.getRowClass) == null ? void 0 : c.call(o, n)) ?? (I == null ? void 0 : I(n));
1587
- },
1588
- [I]
1589
- ), me = N(
1590
- (n) => $(n.node.data),
1591
- []
1592
- ), St = j(() => {
1593
- if (!D) return;
1594
- const n = u == null ? void 0 : u.defaultCsvExportParams;
1595
- return {
1596
- ...n,
1597
- shouldRowBeSkipped: (o) => {
1598
- var c;
1599
- return me(o) || (((c = n == null ? void 0 : n.shouldRowBeSkipped) == null ? void 0 : c.call(n, o)) ?? !1);
1600
- }
1601
- };
1602
- }, [D, u == null ? void 0 : u.defaultCsvExportParams, me]), It = j(() => {
1603
- if (!D) return;
1604
- const n = u == null ? void 0 : u.defaultExcelExportParams;
1605
- return {
1606
- ...n,
1607
- shouldRowBeSkipped: (o) => {
1608
- var c;
1609
- return me(o) || (((c = n == null ? void 0 : n.shouldRowBeSkipped) == null ? void 0 : c.call(n, o)) ?? !1);
1610
- }
1611
- };
1612
- }, [D, u == null ? void 0 : u.defaultExcelExportParams, me]), Ce = u == null ? void 0 : u.fullWidthCellRenderer, Et = j(
1613
- () => ({
1614
- renderExpandedRow: z,
1615
- onExpandedRowChange: M,
1616
- expanded: Y,
1617
- heights: qe.current,
1618
- fallbackRenderer: typeof Ce == "function" ? Ce : void 0
1619
- }),
1620
- [
1621
- Ce,
1622
- Y,
1623
- M,
1624
- z
1625
- ]
1626
- ), Nt = N(() => {
1627
- var c;
1628
- const n = (c = E.current) == null ? void 0 : c.api;
1629
- if (!n) return;
1630
- const o = n.getSelectedRows().filter((T) => !$(T));
1631
- ve(o.length), h == null || h(o);
1632
- }, [h]), Dt = N(
1633
- (n) => {
1634
- var c;
1635
- const o = (c = E.current) == null ? void 0 : c.api;
1636
- if (o) {
1637
- const w = o.getColumnState().find((F) => F.sort);
1638
- if (w) {
1639
- const F = w.colId, O = o.getColumnDef(F), ae = (O == null ? void 0 : O.headerName) ?? F, ee = w.sort === "asc" ? "dataTable.sortAscending" : "dataTable.sortDescending";
1640
- Te(
1641
- Q("dataTable.sortAnnounce", {
1642
- column: ae,
1643
- direction: Q(ee)
1644
- })
1645
- );
1646
- } else
1647
- Te("");
1648
- }
1649
- m == null || m(n);
1650
- },
1651
- [m, Q]
1652
- ), kt = N(
1653
- (n) => {
1654
- x == null || x(n);
1655
- },
1656
- [x]
1657
- );
1658
- H(() => {
1659
- if (!Z) return;
1660
- const n = setTimeout(() => Te(""), 3e3);
1661
- return () => clearTimeout(n);
1662
- }, [Z]);
1663
- const Ft = R ?? Ar, At = v ?? Fr, Pt = N(
1664
- () => {
1665
- var n;
1666
- return (n = E.current) == null ? void 0 : n.api;
1667
- },
1668
- []
1669
- ), Ot = N(() => {
1670
- typeof window < "u" && window.print();
1671
- }, []), zt = Dr({
1672
- density: mt,
1673
- bordered: b,
1674
- className: S
1675
- }), Mt = k ?? /* @__PURE__ */ s("div", { className: "data-table-toolbar ds:flex ds:justify-end", children: /* @__PURE__ */ P(
1676
- Ue,
1677
- {
1678
- role: "toolbar",
1679
- "aria-label": Q("dataTable.tableActions"),
1680
- className: "ds:bg-[var(--background)]",
1681
- children: [
1682
- /* @__PURE__ */ s(be.ExportMenu, {}),
1683
- /* @__PURE__ */ s(be.Print, {}),
1684
- /* @__PURE__ */ s(be.ColumnToggle, {})
1685
- ]
1686
- }
1687
- ) }), _t = L ? !1 : d;
1688
- return /* @__PURE__ */ P(
1689
- "div",
1690
- {
1691
- className: "ds:flex ds:w-full ds:min-h-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-sm)]",
1692
- "aria-busy": pt ? "true" : void 0,
1693
- "data-component": "data-table",
1694
- "data-component-id": f,
1695
- "data-print-mode": L ? "true" : void 0,
1696
- children: [
1697
- !L && /* @__PURE__ */ s(
1698
- ir,
1699
- {
1700
- getApi: Pt,
1701
- selectionCount: J,
1702
- onPrint: Ot,
1703
- markColumnsUserTouched: je,
1704
- children: Mt
1705
- }
1706
- ),
1707
- /* @__PURE__ */ s(
1708
- "div",
1709
- {
1710
- ref: se,
1711
- className: [zt, L ? "" : y].join(" ").trim(),
1712
- children: /* @__PURE__ */ s(
1713
- dt.Provider,
1714
- {
1715
- value: Et,
1716
- children: /* @__PURE__ */ s(
1717
- Wt,
1718
- {
1719
- ref: E,
1720
- theme: "legacy",
1721
- columnDefs: a,
1722
- rowData: yt,
1723
- defaultColDef: {
1724
- sortable: !0,
1725
- // Default filter = DS-styled text filter so untyped columns
1726
- // (no explicit `filter:` override) inherit the kit's form
1727
- // language instead of AG Grid's stock browser-skinned input.
1728
- // Number / date / select columns opt into their dedicated
1729
- // wrapper per-column.
1730
- filter: yr,
1731
- floatingFilterComponent: vr,
1732
- resizable: !0,
1733
- floatingFilter: !0,
1734
- // §13d — faint sort icon advertises which columns are
1735
- // sortable. v33+ moved this from grid-level to defaultColDef.
1736
- unSortIcon: !0,
1737
- ...u == null ? void 0 : u.defaultColDef
1738
- },
1739
- rowSelection: gt,
1740
- pagination: _t,
1741
- paginationPageSize: g,
1742
- paginationPageSizeSelector: p,
1743
- paginationNumberFormatter: (n) => new Intl.NumberFormat(_.language).format(n.value),
1744
- animateRows: !ft,
1745
- enableRtl: Ge,
1746
- ensureDomOrder: !0,
1747
- enableCellSpan: !0,
1748
- enableCellTextSelection: !0,
1749
- copyHeadersToClipboard: !0,
1750
- accentedSort: !0,
1751
- multiSortKey: "ctrl",
1752
- suppressDragLeaveHidesColumns: !0,
1753
- suppressRowClickSelection: i ? !0 : void 0,
1754
- tooltipShowDelay: 500,
1755
- tooltipHideDelay: 5e3,
1756
- tooltipInteraction: !0,
1757
- stopEditingWhenCellsLoseFocus: !0,
1758
- maintainColumnOrder: !0,
1759
- undoRedoCellEditing: !0,
1760
- undoRedoCellEditingLimit: 20,
1761
- suppressCellFocus: !1,
1762
- rowBuffer: 10,
1763
- localeText: ut,
1764
- noRowsOverlayComponent: Ft,
1765
- loadingOverlayComponent: At,
1766
- getRowClass: D ? Rt : I,
1767
- pinnedBottomRowData: re,
1768
- domLayout: L ? "autoHeight" : void 0,
1769
- onGridReady: ht,
1770
- onNewColumnsLoaded: bt,
1771
- onColumnMoved: fe,
1772
- onColumnResized: fe,
1773
- onColumnPinned: fe,
1774
- onColumnVisible: fe,
1775
- onSortChanged: Dt,
1776
- onFilterChanged: kt,
1777
- onSelectionChanged: Nt,
1778
- ...xt,
1779
- ...D ? {
1780
- getRowId: vt,
1781
- isFullWidthRow: Tt,
1782
- fullWidthCellRenderer: Er,
1783
- getRowHeight: wt,
1784
- postSortRows: Ct,
1785
- defaultCsvExportParams: St,
1786
- defaultExcelExportParams: It
1787
- } : {}
1788
- }
1789
- )
1790
- }
1791
- )
1792
- }
1793
- ),
1794
- !L && /* @__PURE__ */ s("div", { className: "ds:flex ds:items-center ds:justify-between type-body-sm ds:text-[color:var(--muted-foreground)]", children: J > 0 ? /* @__PURE__ */ s("span", { children: Q("dataTable.selected", { count: J }) }) : /* @__PURE__ */ s("span", {}) }),
1795
- /* @__PURE__ */ s("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: Z })
1796
- ]
1797
- }
1798
- );
1799
- }
1800
- const ct = B(Gr);
1801
- ct.displayName = "DataTable";
1802
- const Tn = Object.assign(ct, {
1803
- Toolbar: be
1804
- });
1805
- function Re(e) {
1806
- if (!He(e)) return e;
1807
- const t = e, a = t.props.className ?? "", r = /\bsize-|\bw-|\bh-/.test(a) ? a : `${a} size-4`.trim();
1808
- return Ve(t, { className: r, size: t.props.size ?? 16 });
1809
- }
1810
- function wn(e) {
1811
- return Math.max(1, e) * 32 + 28;
1812
- }
1813
- function xe(e, t) {
1814
- return typeof e == "function" ? e(t) : !!e;
1815
- }
1816
- const Lr = "ds:text-[color:var(--destructive)] ds:hover:text-[color:var(--destructive-hover)]";
1817
- function Cn(e) {
1818
- const {
1819
- data: t,
1820
- actions: a,
1821
- intent: r = "ghost",
1822
- group: i,
1823
- label: d,
1824
- collapsed: g,
1825
- maxInline: p
1826
- } = e, { t: f } = A();
1827
- if (!t) return null;
1828
- const h = a.filter((l) => !xe(l.hidden, t)), m = typeof g == "function" ? g() : !!g, x = p === void 0 ? h : h.slice(0, Math.max(0, p)), R = p === void 0 ? [] : h.slice(Math.max(0, p));
1829
- if (m)
1830
- return /* @__PURE__ */ P(q.Root, { children: [
1831
- /* @__PURE__ */ s(q.Trigger, { asChild: !0, children: /* @__PURE__ */ s(
1832
- U,
1833
- {
1834
- size: "sm",
1835
- intent: r,
1836
- icon: /* @__PURE__ */ s(Je, { "aria-hidden": !0 }),
1837
- "aria-label": d ?? f("dataTable.actions", "Actions")
1838
- }
1839
- ) }),
1840
- /* @__PURE__ */ s(q.Content, { align: "end", children: h.map((l, b) => /* @__PURE__ */ s(
1841
- q.Item,
1842
- {
1843
- startIcon: Re(l.icon),
1844
- disabled: xe(l.disabled, t),
1845
- onSelect: () => l.onClick(t),
1846
- className: l.variant === "destructive" ? "ds:text-[color:var(--destructive)]" : void 0,
1847
- children: l.label
1848
- },
1849
- b
1850
- )) })
1851
- ] });
1852
- const v = x.map((l, b) => {
1853
- const y = xe(l.disabled, t), S = y && l.disabledReason ? l.disabledReason : l.label;
1854
- return /* @__PURE__ */ s(
1855
- U,
1856
- {
1857
- size: "sm",
1858
- intent: r,
1859
- icon: Re(l.icon),
1860
- tooltip: S,
1861
- "aria-label": l.label,
1862
- disabled: y,
1863
- onClick: (I) => {
1864
- I.stopPropagation(), l.onClick(t);
1865
- },
1866
- className: l.variant === "destructive" ? Lr : void 0
1867
- },
1868
- b
1869
- );
1870
- }), u = R.length > 0 ? /* @__PURE__ */ s(
1871
- jr,
1872
- {
1873
- data: t,
1874
- actions: R,
1875
- intent: r,
1876
- label: d ?? f("dataTable.actions", "Actions")
1877
- },
1878
- "overflow"
1879
- ) : null;
1880
- return i ? /* @__PURE__ */ P(
1881
- Ue,
1882
- {
1883
- "aria-label": d ?? f("dataTable.actions", "Actions"),
1884
- size: "sm",
1885
- children: [
1886
- v,
1887
- u
1888
- ]
1889
- }
1890
- ) : /* @__PURE__ */ P("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
1891
- v,
1892
- u
1893
- ] });
1894
- }
1895
- const jr = B(function({
1896
- data: t,
1897
- actions: a,
1898
- label: r,
1899
- intent: i = "ghost",
1900
- ...d
1901
- }, g) {
1902
- return /* @__PURE__ */ P(q.Root, { children: [
1903
- /* @__PURE__ */ s(q.Trigger, { asChild: !0, children: /* @__PURE__ */ s(
1904
- U,
1905
- {
1906
- ref: g,
1907
- type: "button",
1908
- size: "sm",
1909
- intent: i,
1910
- icon: /* @__PURE__ */ s(Je, { "aria-hidden": !0 }),
1911
- tooltip: r,
1912
- "aria-label": r,
1913
- onClick: (p) => p.stopPropagation(),
1914
- ...d
1915
- }
1916
- ) }),
1917
- /* @__PURE__ */ s(q.Content, { align: "end", children: a.map((p, f) => /* @__PURE__ */ s(
1918
- q.Item,
1919
- {
1920
- startIcon: Re(p.icon),
1921
- disabled: xe(p.disabled, t),
1922
- onSelect: () => p.onClick(t),
1923
- className: p.variant === "destructive" ? "ds:text-[color:var(--destructive)]" : void 0,
1924
- children: p.label
1925
- },
1926
- f
1927
- )) })
1928
- ] });
1929
- });
1930
- export {
1931
- Cn as A,
1932
- Tn as D,
1933
- Cr as E,
1934
- yr as T,
1935
- vr as a,
1936
- be as b,
1937
- ir as c,
1938
- wn as d,
1939
- Nr as e,
1940
- rt as f,
1941
- Sr as g,
1942
- vn as h,
1943
- $ as i
1944
- };
1945
- //# sourceMappingURL=actions-cell-renderer-ReurEy5i.js.map