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