@alfadocs/ui-kit 0.19.0 → 0.20.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 (62) hide show
  1. package/dist/_chunks/_commonjsHelpers-DaMA6jEr.js +9 -0
  2. package/dist/_chunks/{ai-prompt-input-B-w5Rx3V.js → ai-prompt-input-B5MdixzR.js} +2 -2
  3. package/dist/_chunks/{leo-sidebar-DIsiTju3.js → alia-sidebar-Bof6TlFx.js} +211 -211
  4. package/dist/_chunks/{chat-message-g3lxpXM_.js → chat-message-ChOnwqf_.js} +5 -5
  5. package/dist/_chunks/editable-currency-cell-renderer-CqMs0Y8L.js +1590 -0
  6. package/dist/_chunks/{email-input-DKN5JERd.js → email-input-DvJ_kPKL.js} +2 -2
  7. package/dist/_chunks/exceljs.min-DUJ-5CGx.js +23045 -0
  8. package/dist/_chunks/file-spreadsheet-zUkY8rJ2.js +25 -0
  9. package/dist/_chunks/{file-upload-nMh-1jDD.js → file-upload-DxAQprcU.js} +103 -122
  10. package/dist/_chunks/html2canvas.esm-dgT_1dIT.js +4872 -0
  11. package/dist/_chunks/{index-CFoBa86t.js → index-BcMWc8W2.js} +2 -2
  12. package/dist/_chunks/index.es-B8zMZ1wV.js +6694 -0
  13. package/dist/_chunks/jspdf.es.min-DaapWjR1.js +10007 -0
  14. package/dist/_chunks/jspdf.plugin.autotable-CSiDNyPn.js +1088 -0
  15. package/dist/_chunks/{map-view-DVP-Kp9l.js → map-view-CcwycFQX.js} +2 -2
  16. package/dist/_chunks/{purify.es-DpIUMBYC.js → purify.es-Cm3utOpm.js} +2 -2
  17. package/dist/_chunks/{rich-text-editor-C7TCIlQO.js → rich-text-editor-J-wAz9eN.js} +22 -22
  18. package/dist/_chunks/{suggestion-chip-C4Jz0LrM.js → suggestion-chip-C4kxWUIs.js} +2 -2
  19. package/dist/agent-catalog.json +1 -1
  20. package/dist/components/ai-prompt-input/index.js +1 -1
  21. package/dist/components/app-frame/app-frame.d.ts +1 -1
  22. package/dist/components/chat-container/chat-container.d.ts +1 -1
  23. package/dist/components/chat-message/chat-message.d.ts +1 -1
  24. package/dist/components/chat-message/index.js +1 -1
  25. package/dist/components/data-table/cell-renderers/editable-currency-cell-renderer.d.ts +23 -0
  26. package/dist/components/data-table/cell-renderers/editable-text-cell-renderer.d.ts +11 -0
  27. package/dist/components/data-table/cell-renderers/image-cell-renderer.d.ts +19 -0
  28. package/dist/components/data-table/cell-renderers/toggle-cell-renderer.d.ts +15 -3
  29. package/dist/components/data-table/data-table.d.ts +30 -3
  30. package/dist/components/data-table/filters/date-range-filter.d.ts +22 -0
  31. package/dist/components/data-table/index.d.ts +9 -2
  32. package/dist/components/data-table/index.js +18 -13
  33. package/dist/components/data-table/toolbar.d.ts +80 -1
  34. package/dist/components/email-input/index.js +1 -1
  35. package/dist/components/file-upload/index.js +1 -1
  36. package/dist/components/index.d.ts +1 -1
  37. package/dist/components/map-view/index.js +1 -1
  38. package/dist/components/rich-text-editor/index.js +1 -1
  39. package/dist/components/suggestion-chip/index.js +1 -1
  40. package/dist/i18n/config.js +47 -9
  41. package/dist/i18n/resources.d.ts +47 -9
  42. package/dist/index.js +395 -390
  43. package/dist/locales/de.json +3 -3
  44. package/dist/locales/en.json +22 -3
  45. package/dist/locales/it.json +22 -3
  46. package/dist/patterns/alia-assistant/alia-chat-surface.d.ts +3 -0
  47. package/dist/patterns/alia-assistant/alia-embedded.d.ts +13 -0
  48. package/dist/patterns/{leo-assistant/leo-popout.d.ts → alia-assistant/alia-popout.d.ts} +4 -4
  49. package/dist/patterns/{leo-assistant/leo-sidebar.d.ts → alia-assistant/alia-sidebar.d.ts} +10 -10
  50. package/dist/patterns/{leo-assistant/leo-types.d.ts → alia-assistant/alia-types.d.ts} +23 -23
  51. package/dist/patterns/alia-assistant/index.d.ts +20 -0
  52. package/dist/patterns/alia-assistant/index.js +8 -0
  53. package/dist/patterns/patient-shell/patient-shell.d.ts +1 -1
  54. package/dist/safe-html/index.js +6 -6
  55. package/dist/tokens.css +1 -1
  56. package/package.json +7 -4
  57. package/dist/_chunks/_commonjsHelpers-C6fGbg64.js +0 -7
  58. package/dist/_chunks/balance-cell-renderer-DJB6WDPe.js +0 -1015
  59. package/dist/patterns/leo-assistant/index.d.ts +0 -20
  60. package/dist/patterns/leo-assistant/index.js +0 -8
  61. package/dist/patterns/leo-assistant/leo-chat-surface.d.ts +0 -3
  62. package/dist/patterns/leo-assistant/leo-embedded.d.ts +0 -13
@@ -1,1015 +0,0 @@
1
- import { jsx as r, jsxs as w } from "react/jsx-runtime";
2
- import { useMemo as R, forwardRef as x, useState as G, useEffect as X, useCallback as C, createContext as _e, useContext as je, isValidElement as Q, cloneElement as Y, useRef as ee, useImperativeHandle as Le, useLayoutEffect as Me } from "react";
3
- import { S as $e } from "./skeleton-CZbwyJAA.js";
4
- import { E as Ke } from "./empty-state-3CLJIXSj.js";
5
- import { c as Ve } from "./index-D2ZczOXr.js";
6
- import { useTranslation as T } from "react-i18next";
7
- import { AgGridReact as He } from "ag-grid-react";
8
- import { ModuleRegistry as qe, AllCommunityModule as We } from "ag-grid-community";
9
- import { B as Ue } from "./button-DD_0Xdmr.js";
10
- import { I as P } from "./icon-button-C4CGcYuz.js";
11
- import { P as E } from "./popover--derJ_wq.js";
12
- import { C as Je } from "./checkbox-mwbrPZDY.js";
13
- import { c as te } from "./createLucideIcon-CrFbzy84.js";
14
- import { P as Ze } from "./printer-CeVEWfQq.js";
15
- import { F as Xe } from "./file-text-DSNuv2B8.js";
16
- import { u as Qe } from "./registry-C9nwlNyL.js";
17
- import { B as Ye } from "./badge-cLYVGlMh.js";
18
- import { A as et } from "./avatar-I10iCDs8.js";
19
- import { T as q } from "./tag-CQmHRM4Y.js";
20
- import { T as tt } from "./tooltip-DHik5yRI.js";
21
- import { T as W } from "./timestamp-BV2lC-wV.js";
22
- import { S as at } from "./square-check-big-Jr-0202D.js";
23
- import { S as nt } from "./square-CZoGU14v.js";
24
- /**
25
- * @license lucide-react v1.8.0 - ISC
26
- *
27
- * This source code is licensed under the ISC license.
28
- * See the LICENSE file in the root directory of this source tree.
29
- */
30
- const rt = [
31
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
32
- ["path", { d: "M12 3v18", key: "108xh3" }]
33
- ], st = te("columns-2", rt);
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 ot = [
41
- ["path", { d: "M12 15V3", key: "m9g1x1" }],
42
- ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
43
- ["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
44
- ], it = te("download", ot);
45
- function lt(e) {
46
- if (!Q(e)) return e;
47
- const t = e, a = t.props.className ?? "", n = /\bsize-|\bw-|\bh-/.test(a) ? a : `${a} ds:size-4`.trim();
48
- return Y(t, { className: n, size: t.props.size ?? 16 });
49
- }
50
- const ae = _e(null);
51
- function z(e) {
52
- const t = je(ae);
53
- if (!t)
54
- throw new Error(
55
- `${e} must be rendered inside <DataTable.Toolbar> as a descendant of <DataTable>.`
56
- );
57
- return t;
58
- }
59
- function dt({
60
- getApi: e,
61
- selectionCount: t,
62
- onPrint: a,
63
- children: n
64
- }) {
65
- const l = R(
66
- () => ({ getApi: e, selectionCount: t, onPrint: a }),
67
- [e, t, a]
68
- );
69
- return /* @__PURE__ */ r(ae.Provider, { value: l, children: n });
70
- }
71
- const ct = [
72
- "data-table-toolbar",
73
- "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
74
- "ds:pb-[var(--spacing-sm)]"
75
- ].join(" "), ne = x(
76
- ({ className: e, children: t, ...a }, n) => /* @__PURE__ */ r(
77
- "div",
78
- {
79
- ref: n,
80
- role: "toolbar",
81
- className: [ct, e ?? ""].join(" ").trim(),
82
- ...a,
83
- children: t
84
- }
85
- )
86
- );
87
- ne.displayName = "DataTable.Toolbar";
88
- const re = x(
89
- ({ className: e, children: t, ...a }, n) => /* @__PURE__ */ r(
90
- "div",
91
- {
92
- ref: n,
93
- className: [
94
- "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
95
- "ds:grow",
96
- e ?? ""
97
- ].join(" ").trim(),
98
- ...a,
99
- children: t
100
- }
101
- )
102
- );
103
- re.displayName = "DataTable.Toolbar.FilterBar";
104
- const se = x(
105
- ({ className: e, children: t, ...a }, n) => /* @__PURE__ */ r(
106
- "div",
107
- {
108
- ref: n,
109
- className: [
110
- "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]",
111
- "ds:ms-auto",
112
- e ?? ""
113
- ].join(" ").trim(),
114
- ...a,
115
- children: t
116
- }
117
- )
118
- );
119
- se.displayName = "DataTable.Toolbar.Actions";
120
- const oe = x(
121
- ({ label: e, onExport: t, intent: a = "outline", ...n }, l) => {
122
- const { t: m } = T(), { getApi: u } = z("DataTable.Toolbar.ExportCsv"), d = C(() => {
123
- const o = u();
124
- o && (t ? t(o) : o.exportDataAsCsv());
125
- }, [u, t]);
126
- return /* @__PURE__ */ r(
127
- P,
128
- {
129
- ref: l,
130
- type: "button",
131
- intent: a,
132
- icon: /* @__PURE__ */ r(it, { "aria-hidden": !0 }),
133
- tooltip: e ?? m("dataTable.exportCsv"),
134
- onClick: d,
135
- ...n
136
- }
137
- );
138
- }
139
- );
140
- oe.displayName = "DataTable.Toolbar.ExportCsv";
141
- const ie = x(
142
- ({ label: e, onClick: t, intent: a = "outline", ...n }, l) => {
143
- const { t: m } = T(), { getApi: u } = z("DataTable.Toolbar.ExportPdf");
144
- return /* @__PURE__ */ r(
145
- P,
146
- {
147
- ref: l,
148
- type: "button",
149
- intent: a,
150
- icon: /* @__PURE__ */ r(Xe, { "aria-hidden": !0 }),
151
- tooltip: e ?? m("dataTable.exportPdf"),
152
- onClick: () => t(u()),
153
- ...n
154
- }
155
- );
156
- }
157
- );
158
- ie.displayName = "DataTable.Toolbar.ExportPdf";
159
- const le = x(
160
- ({ label: e, intent: t = "outline", ...a }, n) => {
161
- const { t: l } = T(), { onPrint: m } = z("DataTable.Toolbar.Print");
162
- return /* @__PURE__ */ r(
163
- P,
164
- {
165
- ref: n,
166
- type: "button",
167
- intent: t,
168
- icon: /* @__PURE__ */ r(Ze, { "aria-hidden": !0 }),
169
- tooltip: e ?? l("dataTable.print"),
170
- onClick: m,
171
- ...a
172
- }
173
- );
174
- }
175
- );
176
- le.displayName = "DataTable.Toolbar.Print";
177
- function ut(e) {
178
- return e ? (e.getColumns() ?? []).map((a) => a.getColDef().hide === void 0 && a.getColId().startsWith("ag-Grid-") ? null : {
179
- colId: a.getColId(),
180
- displayName: e.getDisplayNameForColumn(a, null) || a.getColId(),
181
- visible: a.isVisible()
182
- }).filter((a) => a !== null) : [];
183
- }
184
- const de = ({ label: e }) => {
185
- const { t } = T(), { getApi: a } = z("DataTable.Toolbar.ColumnToggle"), [n, l] = G(!1), [m, u] = G([]);
186
- X(() => {
187
- n && u(ut(a()));
188
- }, [n, a]);
189
- const d = C(
190
- (c, f) => {
191
- const y = a();
192
- y && (y.setColumnsVisible([c], f), u(
193
- (D) => D.map(
194
- (S) => S.colId === c ? { ...S, visible: f } : S
195
- )
196
- ));
197
- },
198
- [a]
199
- ), o = e ?? t("dataTable.columnToggle");
200
- return /* @__PURE__ */ w(E.Root, { open: n, onOpenChange: l, children: [
201
- /* @__PURE__ */ r(E.Trigger, { asChild: !0, children: /* @__PURE__ */ r(
202
- P,
203
- {
204
- type: "button",
205
- intent: "outline",
206
- icon: /* @__PURE__ */ r(st, { "aria-hidden": !0 }),
207
- "aria-label": o,
208
- "aria-haspopup": "dialog"
209
- }
210
- ) }),
211
- /* @__PURE__ */ w(E.Content, { size: "sm", align: "end", children: [
212
- /* @__PURE__ */ r(E.Heading, { children: o }),
213
- /* @__PURE__ */ r(
214
- "ul",
215
- {
216
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
217
- "aria-label": o,
218
- children: m.map((c) => /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(
219
- Je,
220
- {
221
- label: c.displayName,
222
- checked: c.visible,
223
- onCheckedChange: (f) => d(c.colId, f === !0)
224
- }
225
- ) }, c.colId))
226
- }
227
- )
228
- ] })
229
- ] });
230
- };
231
- de.displayName = "DataTable.Toolbar.ColumnToggle";
232
- const ce = x(
233
- ({ label: e, icon: t, onClick: a, variant: n = "default", size: l = "sm", ...m }, u) => {
234
- const { t: d } = T(), { getApi: o, selectionCount: c } = z(
235
- "DataTable.Toolbar.BulkAction"
236
- );
237
- return c === 0 ? null : /* @__PURE__ */ w(
238
- Ue,
239
- {
240
- ref: u,
241
- type: "button",
242
- intent: n === "destructive" ? "destructive" : "secondary",
243
- size: l,
244
- startIcon: lt(t),
245
- onClick: () => a(o()),
246
- "aria-label": `${e} (${d("dataTable.bulkAction", { count: c })})`,
247
- ...m,
248
- children: [
249
- /* @__PURE__ */ r("span", { children: e }),
250
- /* @__PURE__ */ r(
251
- "span",
252
- {
253
- "aria-hidden": "true",
254
- className: "ds:ms-[var(--spacing-xs)] ds:opacity-80",
255
- children: d("dataTable.bulkAction", { count: c })
256
- }
257
- )
258
- ]
259
- }
260
- );
261
- }
262
- );
263
- ce.displayName = "DataTable.Toolbar.BulkAction";
264
- const B = Object.assign(ne, {
265
- FilterBar: re,
266
- Actions: se,
267
- ExportCsv: oe,
268
- ExportPdf: ie,
269
- Print: le,
270
- ColumnToggle: de,
271
- BulkAction: ce
272
- }), mt = {
273
- id: "data-table",
274
- capabilities: [
275
- "select_single",
276
- "select_multiple",
277
- "range_pick",
278
- "filter",
279
- "sort",
280
- "paginate"
281
- ],
282
- state: {
283
- selection: {
284
- type: "string[]",
285
- descriptionKey: "ui.agent.dataTable.state.selection",
286
- description: "Row ids of currently-selected rows.",
287
- read: (e) => e.getSelection()
288
- },
289
- filter: {
290
- type: "object",
291
- descriptionKey: "ui.agent.dataTable.state.filter",
292
- description: "Current ag-grid filter model, keyed by column id.",
293
- read: (e) => e.getFilter()
294
- },
295
- sort: {
296
- type: "Array<{ colId, sort }>",
297
- descriptionKey: "ui.agent.dataTable.state.sort",
298
- description: "Active sort, in priority order.",
299
- read: (e) => e.getSort()
300
- },
301
- currentPage: {
302
- type: "number",
303
- descriptionKey: "ui.agent.dataTable.state.currentPage",
304
- description: "Zero-indexed page number.",
305
- read: (e) => e.getCurrentPage()
306
- }
307
- },
308
- actions: {
309
- select_rows: {
310
- safety: "read",
311
- argsType: "{ ids: string[] }",
312
- descriptionKey: "ui.agent.dataTable.actions.selectRows",
313
- description: "Replace the current selection with the given row ids.",
314
- invoke: (e, t) => {
315
- e.setSelection(t.ids);
316
- }
317
- },
318
- select_range: {
319
- safety: "read",
320
- argsType: "{ fromId: string, toId: string }",
321
- descriptionKey: "ui.agent.dataTable.actions.selectRange",
322
- description: "Select every row between fromId and toId, inclusive, in current sort order.",
323
- invoke: (e, t) => {
324
- e.selectRange(t.fromId, t.toId);
325
- }
326
- },
327
- clear_selection: {
328
- safety: "read",
329
- descriptionKey: "ui.agent.dataTable.actions.clearSelection",
330
- description: "Deselect all rows.",
331
- invoke: (e) => {
332
- e.clearSelection();
333
- }
334
- },
335
- apply_filter: {
336
- safety: "read",
337
- argsType: "{ model: Record<string, unknown> }",
338
- descriptionKey: "ui.agent.dataTable.actions.applyFilter",
339
- description: "Replace the filter model with the given object.",
340
- invoke: (e, t) => {
341
- e.setFilter(t.model);
342
- }
343
- },
344
- sort_by: {
345
- safety: "read",
346
- argsType: "{ model: DataTableSortEntry[] }",
347
- descriptionKey: "ui.agent.dataTable.actions.sortBy",
348
- description: "Replace the active sort with the given list (priority order).",
349
- invoke: (e, t) => {
350
- e.setSort(t.model);
351
- }
352
- },
353
- go_to_page: {
354
- safety: "read",
355
- argsType: "{ page: number }",
356
- descriptionKey: "ui.agent.dataTable.actions.goToPage",
357
- description: "Navigate to the given zero-indexed page.",
358
- invoke: (e, t) => {
359
- e.goToPage(t.page);
360
- }
361
- }
362
- },
363
- domHooks: {
364
- root: {
365
- attr: "data-component",
366
- value: "data-table",
367
- description: "Marks the DataTable wrapper."
368
- },
369
- instanceId: {
370
- attr: "data-component-id",
371
- sourceProp: "gridId",
372
- description: "Sourced from the gridId prop. Required to address a specific table from the agent."
373
- },
374
- item: {
375
- attr: "row-id",
376
- description: "Native ag-grid row-id attribute on each rendered row. Selection is performed via the curated handle, not by DOM mutation."
377
- }
378
- }
379
- };
380
- qe.registerModules([We]);
381
- const pt = Ve("ag-theme-alfadocs ds:w-full", {
382
- variants: {
383
- density: {
384
- default: "",
385
- compact: "data-table-compact",
386
- expanded: "data-table-expanded"
387
- },
388
- bordered: {
389
- true: "",
390
- false: "ds:[--ag-borders:none]"
391
- }
392
- },
393
- defaultVariants: {
394
- density: "default",
395
- bordered: !0
396
- }
397
- });
398
- function ft() {
399
- const { t: e } = T();
400
- return R(
401
- () => ({
402
- // Filter strings
403
- contains: e("dataTable.agGrid.contains"),
404
- notContains: e("dataTable.agGrid.notContains"),
405
- equals: e("dataTable.agGrid.equals"),
406
- notEqual: e("dataTable.agGrid.notEqual"),
407
- startsWith: e("dataTable.agGrid.startsWith"),
408
- endsWith: e("dataTable.agGrid.endsWith"),
409
- lessThan: e("dataTable.agGrid.lessThan"),
410
- greaterThan: e("dataTable.agGrid.greaterThan"),
411
- inRange: e("dataTable.agGrid.inRange"),
412
- blank: e("dataTable.agGrid.blank"),
413
- notBlank: e("dataTable.agGrid.notBlank"),
414
- filterOoo: e("dataTable.agGrid.filterOoo"),
415
- applyFilter: e("dataTable.agGrid.applyFilter"),
416
- resetFilter: e("dataTable.agGrid.resetFilter"),
417
- noRowsToShow: e("dataTable.agGrid.noRowsToShow"),
418
- selectAll: e("dataTable.agGrid.selectAll"),
419
- // Pagination
420
- page: e("dataTable.page"),
421
- of: e("dataTable.of"),
422
- to: e("dataTable.to"),
423
- nextPage: e("dataTable.nextPage"),
424
- previousPage: e("dataTable.previousPage"),
425
- firstPage: e("dataTable.firstPage"),
426
- lastPage: e("dataTable.lastPage"),
427
- pageSize: e("dataTable.pageSize")
428
- }),
429
- [e]
430
- );
431
- }
432
- function gt() {
433
- return /* @__PURE__ */ r(
434
- "div",
435
- {
436
- role: "status",
437
- "aria-live": "polite",
438
- className: "ds:flex ds:w-full ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]",
439
- children: Array.from({ length: 5 }).map((e, t) => /* @__PURE__ */ r(
440
- $e,
441
- {
442
- variant: "rectangular",
443
- className: "ds:h-[var(--min-target-size)] ds:w-full"
444
- },
445
- t
446
- ))
447
- }
448
- );
449
- }
450
- function bt() {
451
- const { t: e } = T();
452
- return /* @__PURE__ */ r(
453
- Ke,
454
- {
455
- variant: "no-results",
456
- size: "sm",
457
- title: e("dataTable.noRows"),
458
- description: e("dataTable.noRowsDescription")
459
- }
460
- );
461
- }
462
- function ht(e) {
463
- try {
464
- const t = localStorage.getItem(`data-table-col-state:${e}`);
465
- return t ? JSON.parse(t) : null;
466
- } catch {
467
- return null;
468
- }
469
- }
470
- function vt(e, t) {
471
- try {
472
- localStorage.setItem(
473
- `data-table-col-state:${e}`,
474
- JSON.stringify(t.getColumnState())
475
- );
476
- } catch {
477
- }
478
- }
479
- function yt(e, t) {
480
- const {
481
- columnDefs: a,
482
- rowData: n,
483
- rowSelection: l,
484
- pagination: m = !1,
485
- paginationPageSize: u = 25,
486
- serverSideDatasource: d,
487
- gridId: o,
488
- onSelectionChanged: c,
489
- onSortChanged: f,
490
- onFilterChanged: y,
491
- noRowsOverlay: D,
492
- loadingOverlay: S,
493
- gridOptions: O,
494
- density: H,
495
- bordered: me,
496
- heightClass: pe = "ds:h-[500px]",
497
- className: fe,
498
- getRowClass: ge,
499
- pinnedBottomRowData: be,
500
- printMode: k = !1,
501
- children: he
502
- } = e, { t: F, i18n: ve } = T(), g = ee(null), [_, ye] = G(0), [j, L] = G(""), Te = ft(), M = R(
503
- () => ({
504
- getSelection: () => {
505
- var p;
506
- const s = (p = g.current) == null ? void 0 : p.api;
507
- if (!s) return [];
508
- const i = [];
509
- for (const h of s.getSelectedNodes())
510
- h.id != null && i.push(h.id);
511
- return i;
512
- },
513
- setSelection: (s) => {
514
- var h;
515
- const i = (h = g.current) == null ? void 0 : h.api;
516
- if (!i) return;
517
- const p = new Set(s);
518
- i.forEachNode((b) => {
519
- b.id != null && b.setSelected(p.has(b.id));
520
- });
521
- },
522
- selectRange: (s, i) => {
523
- var I;
524
- const p = (I = g.current) == null ? void 0 : I.api;
525
- if (!p) return;
526
- const h = [];
527
- p.forEachNodeAfterFilterAndSort((A) => {
528
- A.id != null && h.push(A.id);
529
- });
530
- const b = h.indexOf(s), v = h.indexOf(i);
531
- if (b < 0 || v < 0) return;
532
- const [N, K] = b <= v ? [b, v] : [v, b], V = new Set(h.slice(N, K + 1));
533
- p.forEachNode((A) => {
534
- A.id != null && A.setSelected(V.has(A.id));
535
- });
536
- },
537
- clearSelection: () => {
538
- var s, i;
539
- (i = (s = g.current) == null ? void 0 : s.api) == null || i.deselectAll();
540
- },
541
- getFilter: () => {
542
- var s, i;
543
- return ((i = (s = g.current) == null ? void 0 : s.api) == null ? void 0 : i.getFilterModel()) ?? {};
544
- },
545
- setFilter: (s) => {
546
- var i, p;
547
- (p = (i = g.current) == null ? void 0 : i.api) == null || p.setFilterModel(s);
548
- },
549
- getSort: () => {
550
- var i;
551
- const s = (i = g.current) == null ? void 0 : i.api;
552
- return s ? s.getColumnState().filter((p) => p.sort === "asc" || p.sort === "desc").map((p) => ({ colId: p.colId, sort: p.sort })) : [];
553
- },
554
- setSort: (s) => {
555
- var h;
556
- const i = (h = g.current) == null ? void 0 : h.api;
557
- if (!i) return;
558
- const p = i.getColumnState().map((b) => {
559
- const v = s.find((N) => N.colId === b.colId);
560
- return { ...b, sort: v ? v.sort : null };
561
- });
562
- i.applyColumnState({ state: p, defaultState: { sort: null } });
563
- },
564
- getCurrentPage: () => {
565
- var s, i;
566
- return ((i = (s = g.current) == null ? void 0 : s.api) == null ? void 0 : i.paginationGetCurrentPage()) ?? 0;
567
- },
568
- goToPage: (s) => {
569
- var i, p;
570
- (p = (i = g.current) == null ? void 0 : i.api) == null || p.paginationGoToPage(s);
571
- },
572
- getRawApi: () => {
573
- var s;
574
- return (s = g.current) == null ? void 0 : s.api;
575
- }
576
- }),
577
- []
578
- );
579
- Le(t, () => M, [M]), Qe(mt, M, o);
580
- const Ce = ve.dir() === "rtl", we = n === void 0, xe = R(
581
- () => window.matchMedia("(prefers-reduced-motion: reduce)").matches,
582
- []
583
- ), Se = R(
584
- () => document.documentElement.classList.contains("theme-accessible"),
585
- []
586
- ) && H === "compact" ? "default" : H, Ne = R(() => {
587
- if (l)
588
- return l === "single" ? { mode: "singleRow" } : {
589
- mode: "multiRow",
590
- headerCheckbox: !0,
591
- checkboxes: !0
592
- };
593
- }, [l]), Re = d ? "serverSide" : "clientSide", ke = C(() => {
594
- var i;
595
- if (!o || !((i = g.current) != null && i.api)) return;
596
- const s = ht(o);
597
- s && g.current.api.applyColumnState({
598
- state: s,
599
- applyOrder: !0
600
- });
601
- }, [o]), $ = C(() => {
602
- var s;
603
- o && ((s = g.current) != null && s.api) && vt(o, g.current.api);
604
- }, [o]), Ae = C(() => {
605
- var p;
606
- const s = (p = g.current) == null ? void 0 : p.api;
607
- if (!s) return;
608
- const i = s.getSelectedRows();
609
- ye(i.length), c == null || c(i);
610
- }, [c]), De = C(
611
- (s) => {
612
- var p;
613
- const i = (p = g.current) == null ? void 0 : p.api;
614
- if (i) {
615
- const b = i.getColumnState().find((v) => v.sort);
616
- if (b) {
617
- const v = b.colId, N = a.find(
618
- (I) => I.field === v || I.colId === v
619
- ), K = (N == null ? void 0 : N.headerName) ?? v, V = b.sort === "asc" ? "dataTable.sortAscending" : "dataTable.sortDescending";
620
- L(
621
- F("dataTable.sortAnnounce", {
622
- column: K,
623
- direction: F(V)
624
- })
625
- );
626
- } else
627
- L("");
628
- }
629
- f == null || f(s);
630
- },
631
- [a, f, F]
632
- ), Ie = C(
633
- (s) => {
634
- y == null || y(s);
635
- },
636
- [y]
637
- );
638
- X(() => {
639
- if (!j) return;
640
- const s = setTimeout(() => L(""), 3e3);
641
- return () => clearTimeout(s);
642
- }, [j]);
643
- const Pe = D ?? bt, ze = S ?? gt, Fe = C(
644
- () => {
645
- var s;
646
- return (s = g.current) == null ? void 0 : s.api;
647
- },
648
- []
649
- ), Ee = C(() => {
650
- typeof window < "u" && window.print();
651
- }, []), Be = pt({
652
- density: Se,
653
- bordered: me,
654
- className: fe
655
- }), Ge = he ?? /* @__PURE__ */ r(B, { children: /* @__PURE__ */ r(B.Actions, { children: /* @__PURE__ */ r(B.ExportCsv, {}) }) }), Oe = k ? !1 : m;
656
- return /* @__PURE__ */ w(
657
- "div",
658
- {
659
- className: "ds:flex ds:w-full ds:flex-col ds:gap-[var(--spacing-sm)]",
660
- "aria-busy": we ? "true" : void 0,
661
- "data-component": "data-table",
662
- "data-component-id": o,
663
- "data-print-mode": k ? "true" : void 0,
664
- children: [
665
- !k && /* @__PURE__ */ r(
666
- dt,
667
- {
668
- getApi: Fe,
669
- selectionCount: _,
670
- onPrint: Ee,
671
- children: Ge
672
- }
673
- ),
674
- /* @__PURE__ */ r(
675
- "div",
676
- {
677
- className: [Be, k ? "" : pe].join(" ").trim(),
678
- children: /* @__PURE__ */ r(
679
- He,
680
- {
681
- ref: g,
682
- theme: "legacy",
683
- columnDefs: a,
684
- rowData: n,
685
- rowModelType: Re,
686
- serverSideDatasource: d,
687
- rowSelection: Ne,
688
- pagination: Oe,
689
- paginationPageSize: u,
690
- animateRows: !xe,
691
- enableRtl: Ce,
692
- ensureDomOrder: !0,
693
- suppressCellFocus: !1,
694
- rowBuffer: 10,
695
- localeText: Te,
696
- noRowsOverlayComponent: Pe,
697
- loadingOverlayComponent: ze,
698
- getRowClass: ge,
699
- pinnedBottomRowData: be,
700
- domLayout: k ? "autoHeight" : void 0,
701
- onGridReady: ke,
702
- onColumnMoved: $,
703
- onColumnResized: $,
704
- onColumnPinned: $,
705
- onSortChanged: De,
706
- onFilterChanged: Ie,
707
- onSelectionChanged: Ae,
708
- ...O
709
- }
710
- )
711
- }
712
- ),
713
- !k && /* @__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: F("dataTable.selected", { count: _ }) }) : /* @__PURE__ */ r("span", {}) }),
714
- /* @__PURE__ */ r("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: j })
715
- ]
716
- }
717
- );
718
- }
719
- const ue = x(yt);
720
- ue.displayName = "DataTable";
721
- const ta = Object.assign(ue, {
722
- Toolbar: B
723
- });
724
- function aa(e, t, a) {
725
- return R(() => {
726
- const n = {};
727
- for (const l of t) {
728
- let m = 0;
729
- for (const u of e ?? []) {
730
- const d = u[l], o = typeof d == "number" ? d : Number(d);
731
- Number.isFinite(o) && (m += o);
732
- }
733
- n[l] = m;
734
- }
735
- return a != null && a.labelField && a.labelValue !== void 0 && (n[a.labelField] = a.labelValue), n;
736
- }, [e, t, a == null ? void 0 : a.labelField, a == null ? void 0 : a.labelValue]);
737
- }
738
- function na(e) {
739
- const { value: t, variantMap: a } = e, n = (a == null ? void 0 : a[t]) ?? "neutral";
740
- return /* @__PURE__ */ r(Ye, { variant: n, withDot: !0, size: "sm", children: String(t ?? "") });
741
- }
742
- function ra(e) {
743
- const { value: t } = e;
744
- return t ? /* @__PURE__ */ w("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
745
- /* @__PURE__ */ r(et, { name: t.name, src: t.src, size: "sm" }),
746
- /* @__PURE__ */ r("span", { children: t.name })
747
- ] }) : null;
748
- }
749
- function sa(e) {
750
- const { value: t, maxVisible: a = 3 } = e, { t: n } = T();
751
- if (!Array.isArray(t) || t.length === 0) return null;
752
- const l = t.slice(0, a), m = t.length - a;
753
- return /* @__PURE__ */ w("span", { className: "ds:inline-flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
754
- l.map((u) => /* @__PURE__ */ r(q, { label: u, size: "sm" }, u)),
755
- m > 0 && /* @__PURE__ */ r(tt, { label: t.slice(a).join(", "), children: /* @__PURE__ */ r(
756
- q,
757
- {
758
- label: n("inputs.multiSelect.overflow", { count: m }),
759
- size: "sm",
760
- variant: "neutral",
761
- fill: "outline"
762
- }
763
- ) })
764
- ] });
765
- }
766
- const Tt = {
767
- date: { year: "numeric", month: "short", day: "numeric" },
768
- time: { hour: "2-digit", minute: "2-digit" },
769
- datetime: {
770
- year: "numeric",
771
- month: "short",
772
- day: "numeric",
773
- hour: "2-digit",
774
- minute: "2-digit"
775
- }
776
- };
777
- function oa(e) {
778
- const { value: t, format: a = "date", options: n } = e;
779
- return t == null || t === "" ? null : a === "relative" && !n ? /* @__PURE__ */ r(W, { value: t, shape: "bare" }) : /* @__PURE__ */ r(
780
- W,
781
- {
782
- value: t,
783
- format: "absolute",
784
- shape: "bare",
785
- absoluteFormat: n ?? Tt[a === "relative" ? "date" : a]
786
- }
787
- );
788
- }
789
- function Ct(e) {
790
- if (e == null || e === "") return null;
791
- const t = typeof e == "number" ? e : Number(e);
792
- return Number.isFinite(t) ? t : null;
793
- }
794
- function ia(e) {
795
- const {
796
- value: t,
797
- currency: a = "EUR",
798
- colorNegative: n,
799
- strikethrough: l,
800
- options: m
801
- } = e, { i18n: u } = T(), d = Ct(t);
802
- if (d === null) return null;
803
- const o = u.language || "en", c = new Intl.NumberFormat(o, {
804
- style: "currency",
805
- currency: a,
806
- ...m
807
- }).format(d), f = ["ds:tabular-nums"];
808
- return n && d < 0 && f.push("ds:text-[color:var(--destructive)]"), l && f.push("line-through"), /* @__PURE__ */ r("span", { className: f.join(" "), children: c });
809
- }
810
- function wt(e) {
811
- if (!Q(e)) return e;
812
- const t = e, a = t.props.className ?? "", n = /\bsize-|\bw-|\bh-/.test(a) ? a : `${a} size-4`.trim();
813
- return Y(t, { className: n, size: t.props.size ?? 16 });
814
- }
815
- function U(e, t) {
816
- return typeof e == "function" ? e(t) : !!e;
817
- }
818
- function la(e) {
819
- const { data: t, actions: a } = e;
820
- return t ? /* @__PURE__ */ r("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: a.map((n, l) => {
821
- if (U(n.hidden, t)) return null;
822
- const m = U(n.disabled, t), u = m && n.disabledReason ? n.disabledReason : n.label, d = n.variant === "destructive";
823
- return /* @__PURE__ */ r(
824
- P,
825
- {
826
- size: "sm",
827
- intent: "ghost",
828
- icon: wt(n.icon),
829
- tooltip: u,
830
- "aria-label": n.label,
831
- disabled: m,
832
- onClick: (o) => {
833
- o.stopPropagation(), n.onClick(t);
834
- },
835
- className: d ? "ds:text-[color:var(--destructive)] ds:hover:text-[color:var(--destructive-hover)]" : void 0
836
- },
837
- l
838
- );
839
- }) }) : null;
840
- }
841
- function J(e, t) {
842
- return typeof e == "function" ? e(t) : e;
843
- }
844
- function xt(e) {
845
- return /^(https?:\/\/|\/|#|mailto:|tel:)/i.test(e) ? e : "#";
846
- }
847
- function da(e) {
848
- const { value: t, data: a, href: n, onClick: l, secondary: m } = e;
849
- if (!a) return null;
850
- const u = J(n, a), d = J(m, a), o = t == null || t === "" ? "" : String(t), c = [
851
- "ds:text-[color:var(--primary)]",
852
- "ds:hover:underline",
853
- "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
854
- "ds:focus-visible:outline-solid",
855
- "ds:focus-visible:outline-[color:var(--ring)]",
856
- "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
857
- "ds:rounded-[var(--radius-sm)]"
858
- ].join(" "), f = (y) => {
859
- l && (u || y.preventDefault(), y.stopPropagation(), l(a));
860
- };
861
- return /* @__PURE__ */ w("span", { className: "ds:flex ds:flex-col ds:leading-tight", children: [
862
- u ? /* @__PURE__ */ r(
863
- "a",
864
- {
865
- href: xt(u),
866
- onClick: f,
867
- className: c,
868
- children: o
869
- }
870
- ) : /* @__PURE__ */ r(
871
- "button",
872
- {
873
- type: "button",
874
- onClick: f,
875
- className: [
876
- "ds:appearance-none ds:bg-transparent ds:p-0 ds:text-start",
877
- c
878
- ].join(" "),
879
- children: o
880
- }
881
- ),
882
- d ? /* @__PURE__ */ r("span", { className: "type-meta ds:text-[color:var(--muted-foreground)]", children: d }) : null
883
- ] });
884
- }
885
- function ca(e) {
886
- const {
887
- value: t,
888
- data: a,
889
- onToggle: n,
890
- trueIcon: l,
891
- falseIcon: m,
892
- trueClass: u = "ds:text-[color:var(--success)]",
893
- falseClass: d = "ds:text-[color:var(--muted-foreground)]",
894
- label: o
895
- } = e, { t: c } = T();
896
- if (!a) return null;
897
- const f = !!t, y = f ? l ?? /* @__PURE__ */ r(at, { "aria-hidden": !0, className: "ds:size-4" }) : m ?? /* @__PURE__ */ r(nt, { "aria-hidden": !0, className: "ds:size-4" }), D = f ? u : d, S = o ?? c(f ? "inputs.switch.on" : "inputs.switch.off");
898
- return /* @__PURE__ */ r(
899
- "button",
900
- {
901
- type: "button",
902
- role: "switch",
903
- "aria-checked": f,
904
- "aria-label": S,
905
- onClick: (O) => {
906
- O.stopPropagation(), n(a, !f);
907
- },
908
- className: [
909
- "ds:inline-flex ds:items-center ds:justify-center",
910
- "ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]",
911
- "ds:appearance-none ds:bg-transparent ds:p-[var(--spacing-xs)]",
912
- "ds:rounded-[var(--radius-sm)]",
913
- "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
914
- "ds:focus-visible:outline-solid",
915
- "ds:focus-visible:outline-[color:var(--ring)]",
916
- "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
917
- D
918
- ].join(" "),
919
- children: y
920
- }
921
- );
922
- }
923
- const St = {
924
- sm: "ds:size-[var(--icon-size-sm)]",
925
- md: "ds:size-[var(--icon-size-md)]",
926
- lg: "ds:size-[var(--icon-size-lg)]"
927
- };
928
- function Z(e, t) {
929
- if (!e || typeof e != "object") return;
930
- const a = e[t];
931
- return typeof a == "string" ? a : void 0;
932
- }
933
- const Nt = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i, Rt = /^rgba?\(\s*[\d.\s,%/]+\)$/i, kt = /^hsla?\(\s*[\d.\s,%/]+\)$/i, At = /^var\(--[a-z0-9-]+(?:,\s*[^)]+)?\)$/i;
934
- function Dt(e) {
935
- if (!e) return;
936
- const t = e.trim();
937
- if (Nt.test(t) || Rt.test(t) || kt.test(t) || At.test(t))
938
- return t;
939
- }
940
- function ua(e) {
941
- const { data: t, colorField: a, size: n = "md", labelField: l } = e, m = ee(null), u = t ? Z(t, a) : void 0, d = Dt(u), o = t && l ? Z(t, l) : void 0;
942
- return Me(() => {
943
- const c = m.current;
944
- c && (d ? c.style.setProperty("--data-table-dot-color", d) : c.style.removeProperty("--data-table-dot-color"));
945
- }, [d]), d ? /* @__PURE__ */ w("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
946
- /* @__PURE__ */ r(
947
- "span",
948
- {
949
- ref: m,
950
- "aria-hidden": "true",
951
- className: [
952
- "ds:inline-block ds:shrink-0 ds:rounded-[var(--radius-full)]",
953
- "ds:bg-[var(--data-table-dot-color)]",
954
- "ds:border ds:border-[color:var(--border)]",
955
- St[n]
956
- ].join(" ")
957
- }
958
- ),
959
- o ? /* @__PURE__ */ r("span", { children: o }) : null
960
- ] }) : null;
961
- }
962
- function It(e, t) {
963
- if (!e || typeof e != "object") return null;
964
- const a = e[t], n = typeof a == "number" ? a : Number(a);
965
- return Number.isFinite(n) ? n : null;
966
- }
967
- function ma(e) {
968
- const { data: t, lines: a, currency: n = "EUR", highlightNegative: l } = e, { i18n: m } = T();
969
- if (!t) return null;
970
- const u = m.language || "en";
971
- 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((d) => {
972
- const o = It(t, d.valueField);
973
- if (o === null) return null;
974
- let c;
975
- switch (d.format ?? "number") {
976
- case "currency":
977
- c = new Intl.NumberFormat(u, {
978
- style: "currency",
979
- currency: n
980
- }).format(o);
981
- break;
982
- case "percent":
983
- c = new Intl.NumberFormat(u, {
984
- style: "percent",
985
- maximumFractionDigits: 1
986
- }).format(o / 100);
987
- break;
988
- default:
989
- c = new Intl.NumberFormat(u).format(o);
990
- }
991
- const f = ["ds:tabular-nums", "ds:text-end", "ds:font-medium"];
992
- return l && o < 0 && f.push("ds:text-[color:var(--destructive)]"), /* @__PURE__ */ w("div", { className: "ds:contents", children: [
993
- /* @__PURE__ */ r("dt", { className: "ds:text-[color:var(--muted-foreground)]", children: d.label }),
994
- /* @__PURE__ */ r("dd", { className: f.join(" "), children: c })
995
- ] }, d.valueField);
996
- }) });
997
- }
998
- export {
999
- la as A,
1000
- ma as B,
1001
- ua as C,
1002
- ta as D,
1003
- da as L,
1004
- na as S,
1005
- sa as T,
1006
- ra as U,
1007
- ia as a,
1008
- oa as b,
1009
- ca as c,
1010
- B as d,
1011
- dt as e,
1012
- mt as f,
1013
- aa as u
1014
- };
1015
- //# sourceMappingURL=balance-cell-renderer-DJB6WDPe.js.map