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