@alfadocs/ui-kit 1.9.2 → 1.9.4

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.
@@ -1,57 +1,42 @@
1
- import { jsxs as O, jsx as g } from "react/jsx-runtime";
2
- import { createElement as x, useRef as k, useEffect as ee, useCallback as z, forwardRef as he, useState as te, useImperativeHandle as pe, useMemo as Y } from "react";
1
+ import { jsx as g, jsxs as O } from "react/jsx-runtime";
2
+ import { createElement as x, useRef as k, useEffect as te, useCallback as z, forwardRef as pe, useState as ne, useImperativeHandle as be, useMemo as Y } from "react";
3
3
  import { useTranslation as $ } from "react-i18next";
4
- import { a as p, T as b, A as be, d as ne, D as P, e as ge } from "./actions-cell-renderer-B2pw6iH8.js";
5
- import { S as Ce } from "./select-BW5ecXlX.js";
6
- import { u as ve } from "./registry-DvAUVLHh.js";
7
- import { I as Ne, L as we, b as L, a as _, c as U, N as H, d as F, S as R, T as ie, D as K, C as Te, g as Fe, f as Re, U as Ie, e as ye } from "./link-cell-renderer-BqO66pIA.js";
8
- import { B as ae } from "./badge-sTusUqZD.js";
9
- import { c as Pe } from "./index-D2ZczOXr.js";
10
- import { T as We } from "./timestamp-BV2lC-wV.js";
11
- import { C as Se } from "./calendar-clock-hbObjfGY.js";
12
- import { E as Ae } from "./eye-BjhN2nYf.js";
13
- import { P as Be } from "./pencil-B1sKKyuT.js";
14
- import { M as De } from "./mail-BqXVF2zH.js";
15
- import { M as Ve } from "./message-square-Bye4ATvx.js";
16
- import { U as xe } from "./users-BjS_Gg1E.js";
17
- import { T as Ee } from "./trash-2-uumy3fy1.js";
18
- const Oe = 5e4;
19
- function ke(e) {
20
- return e === 0 ? { variant: "success", statusKey: "settled" } : e <= Oe ? { variant: "warning", statusKey: "pending" } : { variant: "error", statusKey: "overdue" };
4
+ import { a as p, T as b, A as ge, d as ie, D as y, e as Ce } from "./actions-cell-renderer-WUTyAes8.js";
5
+ import { S as ve } from "./select-BW5ecXlX.js";
6
+ import { u as Ne } from "./registry-DvAUVLHh.js";
7
+ import { I as Te, L as we, b as L, a as _, c as U, N as H, d as F, S as R, T as ae, D as K, g as Fe, f as Re, U as Ie, e as Pe } from "./link-cell-renderer-Cp2MSlJl.js";
8
+ import { T as ye } from "./transaction-chip-DJCstquX.js";
9
+ import { B as le } from "./badge-sTusUqZD.js";
10
+ import { c as We } from "./index-D2ZczOXr.js";
11
+ import { T as Se } from "./timestamp-BV2lC-wV.js";
12
+ import { C as Ae } from "./calendar-clock-hbObjfGY.js";
13
+ import { E as Be } from "./eye-BjhN2nYf.js";
14
+ import { P as De } from "./pencil-B1sKKyuT.js";
15
+ import { M as Ve } from "./mail-BqXVF2zH.js";
16
+ import { M as xe } from "./message-square-Bye4ATvx.js";
17
+ import { U as Ee } from "./users-BjS_Gg1E.js";
18
+ import { T as Oe } from "./trash-2-uumy3fy1.js";
19
+ function J(e) {
20
+ const { value: n, positiveState: d, showLabel: s = !0 } = e, r = typeof n == "number" && Number.isFinite(n) ? n : null;
21
+ if (r === null) return null;
22
+ const l = r > 0 ? d : "settled";
23
+ return /* @__PURE__ */ g(ye, { state: l, amount: r / 100, showLabel: s });
21
24
  }
22
- function Me(e) {
23
- if (e == null || e === "") return null;
24
- const i = typeof e == "number" ? e : Number(e);
25
- return Number.isFinite(i) ? i : null;
26
- }
27
- function Ge(e) {
28
- const { value: i, currency: c = "EUR", options: s } = e, { t: o, i18n: l } = $("ui"), u = Me(i);
29
- if (u === null) return null;
30
- const f = l.language || "en", d = new Intl.NumberFormat(f, {
31
- style: "currency",
32
- currency: c,
33
- ...s
34
- }).format(u / 100), { variant: m, statusKey: C } = ke(u), a = o(`patientTable.balance.status.${C}`);
35
- return /* @__PURE__ */ O(ae, { variant: m, withDot: !0, size: "sm", className: "ds:tabular-nums", children: [
36
- /* @__PURE__ */ g("span", { children: d }),
37
- /* @__PURE__ */ g("span", { className: "ds:sr-only", children: a })
38
- ] });
39
- }
40
- const Le = {
25
+ const ke = {
41
26
  accepted: "success",
42
27
  estimate: "info",
43
28
  none: "neutral"
44
29
  };
45
- function _e(e) {
30
+ function Me(e) {
46
31
  return e === "accepted" || e === "estimate" || e === "none";
47
32
  }
48
- function Ue(e) {
49
- const { t: i } = $("ui"), { data: c, value: s, size: o = "sm" } = e, l = (c == null ? void 0 : c.carePlanStatus) ?? s;
50
- if (!_e(l)) return null;
51
- const u = Le[l];
52
- return /* @__PURE__ */ g(ae, { variant: u, withDot: !0, size: o, children: i(`patientTable.carePlanStatus.${l}`) });
33
+ function Ge(e) {
34
+ const { t: n } = $("ui"), { data: d, value: s, size: r = "sm" } = e, l = (d == null ? void 0 : d.carePlanStatus) ?? s;
35
+ if (!Me(l)) return null;
36
+ const u = ke[l];
37
+ return /* @__PURE__ */ g(le, { variant: u, withDot: !0, size: r, children: n(`patientTable.carePlanStatus.${l}`) });
53
38
  }
54
- const J = Pe(
39
+ const Z = We(
55
40
  "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] ds:whitespace-nowrap",
56
41
  {
57
42
  variants: {
@@ -66,39 +51,39 @@ const J = Pe(
66
51
  },
67
52
  defaultVariants: { tone: "default" }
68
53
  }
69
- ), He = 1440 * 60 * 1e3, ze = 7;
70
- function $e(e) {
54
+ ), Le = 1440 * 60 * 1e3, _e = 7;
55
+ function Ue(e) {
71
56
  if (e == null || e === "") return null;
72
- const i = e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(String(e)).getTime();
73
- return Number.isNaN(i) ? null : i;
57
+ const n = e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(String(e)).getTime();
58
+ return Number.isNaN(n) ? null : n;
74
59
  }
75
- function je(e, i) {
76
- if (i <= 0) return "default";
77
- const c = e - Date.now();
78
- return c < 0 ? "default" : c <= i * He ? "soon" : "default";
60
+ function He(e, n) {
61
+ if (n <= 0) return "default";
62
+ const d = e - Date.now();
63
+ return d < 0 ? "default" : d <= n * Le ? "soon" : "default";
79
64
  }
80
- function Ke(e) {
81
- const { t: i } = $("ui"), { data: c, value: s, soonWithinDays: o = ze } = e, l = $e((c == null ? void 0 : c.nextAppointment) ?? s);
65
+ function ze(e) {
66
+ const { t: n } = $("ui"), { data: d, value: s, soonWithinDays: r = _e } = e, l = Ue((d == null ? void 0 : d.nextAppointment) ?? s);
82
67
  if (l === null)
83
- return /* @__PURE__ */ g("span", { className: J({ tone: "empty" }), children: i("patientTable.nextAppointment.none") });
84
- const u = je(l, o);
85
- return /* @__PURE__ */ O("span", { className: J({ tone: u }), children: [
86
- u === "soon" ? /* @__PURE__ */ g(Se, { "aria-hidden": "true", className: "ds:size-3.5 ds:shrink-0" }) : null,
87
- /* @__PURE__ */ g(We, { value: l, format: "relative", shape: "bare" })
68
+ return /* @__PURE__ */ g("span", { className: Z({ tone: "empty" }), children: n("patientTable.nextAppointment.none") });
69
+ const u = He(l, r);
70
+ return /* @__PURE__ */ O("span", { className: Z({ tone: u }), children: [
71
+ u === "soon" ? /* @__PURE__ */ g(Ae, { "aria-hidden": "true", className: "ds:size-3.5 ds:shrink-0" }) : null,
72
+ /* @__PURE__ */ g(Se, { value: l, format: "relative", shape: "bare" })
88
73
  ] });
89
74
  }
90
75
  function q(e) {
91
76
  return e.responsiveTier;
92
77
  }
93
- const Ye = 6;
94
- function qe(e, i) {
95
- const c = (o) => (l) => {
96
- i == null || i(o, l);
97
- }, s = (o, l) => ({
98
- icon: o.icon,
99
- label: o.label,
100
- variant: o.variant,
101
- onClick: c(o),
78
+ const $e = 6;
79
+ function je(e, n) {
80
+ const d = (r) => (l) => {
81
+ n == null || n(r, l);
82
+ }, s = (r, l) => ({
83
+ icon: r.icon,
84
+ label: r.label,
85
+ variant: r.variant,
86
+ onClick: d(r),
102
87
  ...l
103
88
  });
104
89
  return [
@@ -106,7 +91,7 @@ function qe(e, i) {
106
91
  {
107
92
  id: "show",
108
93
  label: e("patientTable.actions.show"),
109
- icon: x(Ae, { "aria-hidden": "true" })
94
+ icon: x(Be, { "aria-hidden": "true" })
110
95
  },
111
96
  {}
112
97
  ),
@@ -114,7 +99,7 @@ function qe(e, i) {
114
99
  {
115
100
  id: "edit",
116
101
  label: e("patientTable.actions.edit"),
117
- icon: x(Be, { "aria-hidden": "true" })
102
+ icon: x(De, { "aria-hidden": "true" })
118
103
  },
119
104
  {}
120
105
  ),
@@ -122,27 +107,27 @@ function qe(e, i) {
122
107
  {
123
108
  id: "sendEmailReminder",
124
109
  label: e("patientTable.actions.sendEmailReminder"),
125
- icon: x(De, { "aria-hidden": "true" })
110
+ icon: x(Ve, { "aria-hidden": "true" })
126
111
  },
127
112
  // Hidden when the patient has email contact disabled (spec).
128
- { hidden: (o) => !o.emailEnabled }
113
+ { hidden: (r) => !r.emailEnabled }
129
114
  ),
130
115
  s(
131
116
  {
132
117
  id: "sendSmsReminder",
133
118
  label: e("patientTable.actions.sendSmsReminder"),
134
- icon: x(Ve, { "aria-hidden": "true" })
119
+ icon: x(xe, { "aria-hidden": "true" })
135
120
  },
136
121
  // Hidden when no phone number is SMS-enabled (spec).
137
122
  {
138
- hidden: (o) => !(o.phoneNumbers ?? []).some((l) => l.smsEnabled)
123
+ hidden: (r) => !(r.phoneNumbers ?? []).some((l) => l.smsEnabled)
139
124
  }
140
125
  ),
141
126
  s(
142
127
  {
143
128
  id: "reassign",
144
129
  label: e("patientTable.actions.reassign"),
145
- icon: x(xe, { "aria-hidden": "true" })
130
+ icon: x(Ee, { "aria-hidden": "true" })
146
131
  },
147
132
  {}
148
133
  ),
@@ -150,42 +135,42 @@ function qe(e, i) {
150
135
  {
151
136
  id: "delete",
152
137
  label: e("patientTable.actions.delete"),
153
- icon: x(Ee, { "aria-hidden": "true" }),
138
+ icon: x(Oe, { "aria-hidden": "true" }),
154
139
  variant: "destructive"
155
140
  },
156
141
  // Disabled (with a reason) for archived patients — the row model's
157
142
  // closest "cannot delete" signal. Surfaced as the inline tooltip.
158
143
  {
159
- disabled: (o) => !!o.isArchived,
144
+ disabled: (r) => !!r.isArchived,
160
145
  disabledReason: e("patientTable.actions.deleteLocked")
161
146
  }
162
147
  )
163
148
  ];
164
149
  }
165
- const Qe = () => !1, B = "✓", W = "—";
166
- function Xe(e) {
150
+ const Ke = () => !1, B = "✓", W = "—";
151
+ function Ye(e) {
167
152
  if (!e) return null;
168
- const i = new Date(e), c = i.getTime();
169
- if (Number.isNaN(c)) return null;
153
+ const n = new Date(e), d = n.getTime();
154
+ if (Number.isNaN(d)) return null;
170
155
  const s = /* @__PURE__ */ new Date();
171
- let o = s.getFullYear() - i.getFullYear();
172
- const l = s.getMonth() - i.getMonth();
173
- return (l < 0 || l === 0 && s.getDate() < i.getDate()) && (o -= 1), o >= 0 ? o : null;
156
+ let r = s.getFullYear() - n.getFullYear();
157
+ const l = s.getMonth() - n.getMonth();
158
+ return (l < 0 || l === 0 && s.getDate() < n.getDate()) && (r -= 1), r >= 0 ? r : null;
174
159
  }
175
- function Je(e) {
176
- return e.map((i) => {
177
- var o;
160
+ function qe(e) {
161
+ return e.map((n) => {
162
+ var r;
178
163
  const s = {
179
- colId: `custom:${i.fieldName}`,
180
- headerName: i.label,
164
+ colId: `custom:${n.fieldName}`,
165
+ headerName: n.label,
181
166
  hide: !0
182
167
  // No tier — custom fields are opt-in via ColumnToggle only.
183
168
  };
184
- return i.type === "checkbox" ? {
169
+ return n.type === "checkbox" ? {
185
170
  ...s,
186
171
  valueGetter: (l) => {
187
172
  var u, f;
188
- return ((f = (u = l.data) == null ? void 0 : u.customFields) == null ? void 0 : f[i.fieldName]) === !0;
173
+ return ((f = (u = l.data) == null ? void 0 : u.customFields) == null ? void 0 : f[n.fieldName]) === !0;
189
174
  },
190
175
  valueFormatter: (l) => l.value === !0 ? B : W,
191
176
  filter: R,
@@ -198,18 +183,18 @@ function Je(e) {
198
183
  },
199
184
  minWidth: 110,
200
185
  width: 130
201
- } : i.type === "dropdown" ? {
186
+ } : n.type === "dropdown" ? {
202
187
  ...s,
203
188
  // TagListCellRenderer expects an array; wrap the single value.
204
189
  valueGetter: (l) => {
205
- var f, d;
206
- const u = (d = (f = l.data) == null ? void 0 : f.customFields) == null ? void 0 : d[i.fieldName];
190
+ var f, c;
191
+ const u = (c = (f = l.data) == null ? void 0 : f.customFields) == null ? void 0 : c[n.fieldName];
207
192
  return typeof u == "string" && u ? [u] : [];
208
193
  },
209
- cellRenderer: ie,
194
+ cellRenderer: ae,
210
195
  filterValueGetter: (l) => {
211
- var f, d;
212
- const u = (d = (f = l.data) == null ? void 0 : f.customFields) == null ? void 0 : d[i.fieldName];
196
+ var f, c;
197
+ const u = (c = (f = l.data) == null ? void 0 : f.customFields) == null ? void 0 : c[n.fieldName];
213
198
  return typeof u == "string" ? u : "";
214
199
  },
215
200
  filter: R,
@@ -218,7 +203,7 @@ function Je(e) {
218
203
  // Undefined (not []) when the field declares no options, so the
219
204
  // filter derives its choices from the rows. An empty array would
220
205
  // mean "this column has no facets" and leave the filter unusable.
221
- options: (o = i.options) == null ? void 0 : o.map((l) => ({
206
+ options: (r = n.options) == null ? void 0 : r.map((l) => ({
222
207
  value: l,
223
208
  label: l
224
209
  }))
@@ -229,8 +214,8 @@ function Je(e) {
229
214
  } : {
230
215
  ...s,
231
216
  valueGetter: (l) => {
232
- var f, d;
233
- const u = (d = (f = l.data) == null ? void 0 : f.customFields) == null ? void 0 : d[i.fieldName];
217
+ var f, c;
218
+ const u = (c = (f = l.data) == null ? void 0 : f.customFields) == null ? void 0 : c[n.fieldName];
234
219
  return typeof u == "string" ? u : "";
235
220
  },
236
221
  filter: b,
@@ -240,14 +225,14 @@ function Je(e) {
240
225
  };
241
226
  });
242
227
  }
243
- function Ze(e, i = {}) {
228
+ function Qe(e, n = {}) {
244
229
  const {
245
- hideDetails: c = !1,
246
- getActionsCompact: s = Qe,
247
- onRowAction: o,
230
+ hideDetails: d = !1,
231
+ getActionsCompact: s = Ke,
232
+ onRowAction: r,
248
233
  identityHref: l,
249
234
  customFields: u = []
250
- } = i, f = qe(e, o), d = {
235
+ } = n, f = je(e, r), c = {
251
236
  m: e("patientTable.gender.m"),
252
237
  f: e("patientTable.gender.f"),
253
238
  x: e("patientTable.gender.x")
@@ -272,7 +257,7 @@ function Ze(e, i = {}) {
272
257
  headerName: a("avatar"),
273
258
  headerClass: "sr-only-th",
274
259
  pinned: "left",
275
- cellRenderer: Ne,
260
+ cellRenderer: Te,
276
261
  cellRendererParams: {
277
262
  srcField: "avatarUrl",
278
263
  fallbackField: "lastName",
@@ -282,6 +267,7 @@ function Ze(e, i = {}) {
282
267
  sortable: !1,
283
268
  filter: !1,
284
269
  resizable: !1,
270
+ cellClass: "ag-cell-graphic",
285
271
  // Hug the 32px (size="sm") avatar + cell padding — a tight fixed column,
286
272
  // not a wide empty one. width === minWidth === maxWidth pins it to size so
287
273
  // the pinned group can't stretch it (pinned columns never flex).
@@ -319,7 +305,7 @@ function Ze(e, i = {}) {
319
305
  href: l,
320
306
  // When no detail href is supplied the cell renders a button; route its
321
307
  // click through the same `show` row action.
322
- onClick: o ? (t) => o(
308
+ onClick: r ? (t) => r(
323
309
  { id: "show", label: e("patientTable.actions.show") },
324
310
  t
325
311
  ) : void 0
@@ -339,8 +325,8 @@ function Ze(e, i = {}) {
339
325
  responsiveTier: "P1",
340
326
  // The primary phone number string (prefix + number).
341
327
  valueGetter: (t) => {
342
- var n, r, h;
343
- return ((h = (r = (n = t.data) == null ? void 0 : n.phoneNumbers) == null ? void 0 : r[0]) == null ? void 0 : h.number) ?? "";
328
+ var i, o, h;
329
+ return ((h = (o = (i = t.data) == null ? void 0 : i.phoneNumbers) == null ? void 0 : o[0]) == null ? void 0 : h.number) ?? "";
344
330
  },
345
331
  filter: b,
346
332
  floatingFilterComponent: p,
@@ -353,7 +339,7 @@ function Ze(e, i = {}) {
353
339
  headerName: a("nextAppointment"),
354
340
  responsiveTier: "P1",
355
341
  field: "nextAppointment",
356
- cellRenderer: Ke,
342
+ cellRenderer: ze,
357
343
  filter: _,
358
344
  floatingFilterComponent: L,
359
345
  minWidth: 160,
@@ -366,7 +352,9 @@ function Ze(e, i = {}) {
366
352
  responsiveTier: "P1",
367
353
  field: "unpaidAmount",
368
354
  type: "numericColumn",
369
- cellRenderer: Ge,
355
+ // The kit's financial-state pill: `debt` while anything is owed, `settled` at zero.
356
+ cellRenderer: J,
357
+ cellRendererParams: { positiveState: "debt" },
370
358
  filter: H,
371
359
  floatingFilterComponent: U,
372
360
  // Money is integer cents; the inRange filter compares cents directly.
@@ -383,7 +371,7 @@ function Ze(e, i = {}) {
383
371
  // Emit `hide` ONLY when masking (never a literal `hide: false`). A static
384
372
  // `hide: false` is re-applied by AG Grid on every `columnDefs` reconcile,
385
373
  // clobbering a runtime hide from the ViewSwitcher / responsive hook.
386
- hide: c || void 0,
374
+ hide: d || void 0,
387
375
  filter: b,
388
376
  floatingFilterComponent: p,
389
377
  minWidth: 200,
@@ -395,7 +383,7 @@ function Ze(e, i = {}) {
395
383
  headerName: a("carePlanStatus"),
396
384
  responsiveTier: "P2",
397
385
  field: "carePlanStatus",
398
- cellRenderer: Ue,
386
+ cellRenderer: Ge,
399
387
  filter: R,
400
388
  floatingFilterComponent: F,
401
389
  filterParams: {
@@ -435,8 +423,8 @@ function Ze(e, i = {}) {
435
423
  // header + cell) is for ledger figures, not a 2-digit age. Sort stays
436
424
  // numeric because the valueGetter returns a number.
437
425
  valueGetter: (t) => {
438
- var n;
439
- return Xe((n = t.data) == null ? void 0 : n.dateOfBirth) ?? void 0;
426
+ var i;
427
+ return Ye((i = t.data) == null ? void 0 : i.dateOfBirth) ?? void 0;
440
428
  },
441
429
  filter: H,
442
430
  floatingFilterComponent: U,
@@ -450,16 +438,16 @@ function Ze(e, i = {}) {
450
438
  responsiveTier: "P3",
451
439
  // Map the raw code to a localised label for both cell + set filter.
452
440
  valueGetter: (t) => {
453
- var n;
454
- return (n = t.data) != null && n.gender ? d[t.data.gender] : W;
441
+ var i;
442
+ return (i = t.data) != null && i.gender ? c[t.data.gender] : W;
455
443
  },
456
444
  filter: R,
457
445
  floatingFilterComponent: F,
458
446
  filterParams: {
459
447
  options: [
460
- { value: d.m, label: d.m },
461
- { value: d.f, label: d.f },
462
- { value: d.x, label: d.x }
448
+ { value: c.m, label: c.m },
449
+ { value: c.f, label: c.f },
450
+ { value: c.x, label: c.x }
463
451
  ]
464
452
  },
465
453
  minWidth: 110,
@@ -472,14 +460,14 @@ function Ze(e, i = {}) {
472
460
  responsiveTier: "P3",
473
461
  // TagListCellRenderer expects an array; wrap the resolved source string.
474
462
  valueGetter: (t) => {
475
- var r, h;
476
- const n = ((r = t.data) == null ? void 0 : r.source) ?? ((h = t.data) == null ? void 0 : h.customSource);
477
- return n ? [n] : [];
463
+ var o, h;
464
+ const i = ((o = t.data) == null ? void 0 : o.source) ?? ((h = t.data) == null ? void 0 : h.customSource);
465
+ return i ? [i] : [];
478
466
  },
479
- cellRenderer: ie,
467
+ cellRenderer: ae,
480
468
  filterValueGetter: (t) => {
481
- var n, r;
482
- return ((n = t.data) == null ? void 0 : n.source) ?? ((r = t.data) == null ? void 0 : r.customSource) ?? "";
469
+ var i, o;
470
+ return ((i = t.data) == null ? void 0 : i.source) ?? ((o = t.data) == null ? void 0 : o.customSource) ?? "";
483
471
  },
484
472
  filter: R,
485
473
  floatingFilterComponent: F,
@@ -526,8 +514,8 @@ function Ze(e, i = {}) {
526
514
  headerName: a("smsReminders"),
527
515
  hide: !0,
528
516
  valueGetter: (t) => {
529
- var n;
530
- return !!((n = t.data) != null && n.smsReminderEligible);
517
+ var i;
518
+ return !!((i = t.data) != null && i.smsReminderEligible);
531
519
  },
532
520
  valueFormatter: (t) => t.value === !0 ? B : W,
533
521
  filter: R,
@@ -546,8 +534,8 @@ function Ze(e, i = {}) {
546
534
  headerName: a("emailReminders"),
547
535
  hide: !0,
548
536
  valueGetter: (t) => {
549
- var n;
550
- return !!((n = t.data) != null && n.emailReminderEligible);
537
+ var i;
538
+ return !!((i = t.data) != null && i.emailReminderEligible);
551
539
  },
552
540
  valueFormatter: (t) => t.value === !0 ? B : W,
553
541
  filter: R,
@@ -590,14 +578,15 @@ function Ze(e, i = {}) {
590
578
  headerName: a("billableAmount"),
591
579
  hide: !0,
592
580
  type: "numericColumn",
593
- cellRenderer: Te,
594
- // Cents major unit at the render boundary. No `field` the valueGetter
595
- // takes precedence over `field` in AG Grid for both cell + sort, so a
596
- // `field: 'billableAmount'` would be dead (and misleadingly imply the raw
597
- // cents drive the renderer).
598
- valueGetter: (t) => t.data ? t.data.billableAmount / 100 : void 0,
581
+ field: "billableAmount",
582
+ // "Fatturabile" is the chip's own `to-invoice` state; `settled` at zero.
583
+ // Same shape as unpaidBalance: the cell value stays in cents and the
584
+ // renderer converts, so the inRange filter compares cents directly.
585
+ cellRenderer: J,
586
+ cellRendererParams: { positiveState: "to-invoice" },
599
587
  filter: H,
600
588
  floatingFilterComponent: U,
589
+ filterParams: { defaultOperator: "inRange", min: 0 },
601
590
  minWidth: 140,
602
591
  width: 160
603
592
  },
@@ -640,13 +629,13 @@ function Ze(e, i = {}) {
640
629
  hide: !0,
641
630
  cellRenderer: Ie,
642
631
  valueGetter: (t) => {
643
- var n;
644
- return (n = t.data) != null && n.personalAssistant ? { name: t.data.personalAssistant } : null;
632
+ var i;
633
+ return (i = t.data) != null && i.personalAssistant ? { name: t.data.personalAssistant } : null;
645
634
  },
646
- comparator: (t, n) => ((t == null ? void 0 : t.name) ?? "").localeCompare((n == null ? void 0 : n.name) ?? ""),
635
+ comparator: (t, i) => ((t == null ? void 0 : t.name) ?? "").localeCompare((i == null ? void 0 : i.name) ?? ""),
647
636
  filterValueGetter: (t) => {
648
- var n;
649
- return ((n = t.data) == null ? void 0 : n.personalAssistant) ?? "";
637
+ var i;
638
+ return ((i = t.data) == null ? void 0 : i.personalAssistant) ?? "";
650
639
  },
651
640
  filter: Re,
652
641
  floatingFilterComponent: Fe,
@@ -668,13 +657,13 @@ function Ze(e, i = {}) {
668
657
  colId: "marketingConsent",
669
658
  headerName: a("marketingConsent"),
670
659
  hide: !0,
671
- cellRenderer: ye,
660
+ cellRenderer: Pe,
672
661
  cellRendererParams: {
673
662
  variantMap: C
674
663
  },
675
664
  valueGetter: (t) => {
676
- var n;
677
- switch ((n = t.data) == null ? void 0 : n.marketingConsent) {
665
+ var i;
666
+ switch ((i = t.data) == null ? void 0 : i.marketingConsent) {
678
667
  case 1:
679
668
  return m.yes;
680
669
  case 0:
@@ -706,8 +695,8 @@ function Ze(e, i = {}) {
706
695
  // `YYYY/N` yearly numbering.
707
696
  valueGetter: (t) => {
708
697
  var h, v;
709
- const n = (h = t.data) == null ? void 0 : h.yearlyNumberingYear, r = (v = t.data) == null ? void 0 : v.yearlyNumberingNumber;
710
- return n != null && r != null ? `${n}/${r}` : "";
698
+ const i = (h = t.data) == null ? void 0 : h.yearlyNumberingYear, o = (v = t.data) == null ? void 0 : v.yearlyNumberingNumber;
699
+ return i != null && o != null ? `${i}/${o}` : "";
711
700
  },
712
701
  filter: b,
713
702
  floatingFilterComponent: p,
@@ -719,8 +708,8 @@ function Ze(e, i = {}) {
719
708
  headerName: a("portal"),
720
709
  hide: !0,
721
710
  valueGetter: (t) => {
722
- var n;
723
- return !!((n = t.data) != null && n.mydentista);
711
+ var i;
712
+ return !!((i = t.data) != null && i.mydentista);
724
713
  },
725
714
  valueFormatter: (t) => t.value === !0 ? B : W,
726
715
  filter: R,
@@ -798,7 +787,7 @@ function Ze(e, i = {}) {
798
787
  width: 220
799
788
  },
800
789
  /* ── Custom fields (per-practice, dynamic) — appended, hidden ──── */
801
- ...Je(u),
790
+ ...qe(u),
802
791
  /* ── Actions (P0, pinned-end) ──────────────────────────────────── */
803
792
  {
804
793
  colId: "actions",
@@ -813,8 +802,8 @@ function Ze(e, i = {}) {
813
802
  // Header + action group left-aligned (justify-start), consistent with every
814
803
  // other column — no right-aligned header (the actions still sit at the
815
804
  // pinned inline-end edge, the group just starts at the cell's leading edge).
816
- cellClass: "ds:justify-start",
817
- cellRenderer: be,
805
+ cellClass: "ds:justify-start ag-cell-graphic",
806
+ cellRenderer: ge,
818
807
  cellRendererParams: {
819
808
  actions: f,
820
809
  intent: "ghost",
@@ -828,119 +817,119 @@ function Ze(e, i = {}) {
828
817
  // The renderer collapses to a single overflow trigger via
829
818
  // `getActionsCompact`; the expanded width is DERIVED from the action count
830
819
  // so a row showing every action can't clip — 88px collapsed → fits-all.
831
- width: ne(f.length),
820
+ width: ie(f.length),
832
821
  minWidth: 88
833
822
  // Anchor — never auto-hidden (no tier).
834
823
  }
835
824
  ];
836
825
  }
837
- const et = [
826
+ const Xe = [
838
827
  { minWidth: 0, tier: "P0" },
839
828
  { minWidth: 640, tier: "P1" },
840
829
  { minWidth: 900, tier: "P2" },
841
830
  { minWidth: 1200, tier: "P3" }
842
831
  ];
843
- function Z(e, i) {
844
- const c = /* @__PURE__ */ new Set();
845
- for (const s of i)
846
- e >= s.minWidth && c.add(s.tier);
847
- return c.add("P0"), c;
832
+ function ee(e, n) {
833
+ const d = /* @__PURE__ */ new Set();
834
+ for (const s of n)
835
+ e >= s.minWidth && d.add(s.tier);
836
+ return d.add("P0"), d;
848
837
  }
849
- function tt(e, i) {
838
+ function Je(e, n) {
850
839
  const {
851
- containerRef: c,
840
+ containerRef: d,
852
841
  enabled: s = !0,
853
- breakpoints: o = et
854
- } = i, l = k(/* @__PURE__ */ new Set()), u = k(!1);
855
- return ee(() => {
856
- const d = c.current;
857
- if (!s || !d) return;
842
+ breakpoints: r = Xe
843
+ } = n, l = k(/* @__PURE__ */ new Set()), u = k(!1);
844
+ return te(() => {
845
+ const c = d.current;
846
+ if (!s || !c) return;
858
847
  const m = () => {
859
- var r;
860
- return (r = e.current) == null ? void 0 : r.getRawApi();
861
- }, C = (r) => {
862
- if (u.current || r.source === "api") return;
863
- const h = r.columns ?? (r.column ? [r.column] : []);
848
+ var o;
849
+ return (o = e.current) == null ? void 0 : o.getRawApi();
850
+ }, C = (o) => {
851
+ if (u.current || o.source === "api") return;
852
+ const h = o.columns ?? (o.column ? [o.column] : []);
864
853
  for (const v of h)
865
854
  l.current.add(v.getColId());
866
855
  };
867
856
  let a = !1;
868
- const w = (r) => {
857
+ const T = (o) => {
869
858
  if (a) return;
870
859
  a = !0;
871
- const h = r.getColumns(), v = d.getBoundingClientRect().width, D = Z(v, o);
860
+ const h = o.getColumns(), v = c.getBoundingClientRect().width, D = ee(v, r);
872
861
  if (h)
873
- for (const T of h) {
874
- const I = q(T.getColDef());
875
- I && !T.isVisible() && D.has(I) && l.current.add(T.getColId());
862
+ for (const w of h) {
863
+ const I = q(w.getColDef());
864
+ I && !w.isVisible() && D.has(I) && l.current.add(w.getColId());
876
865
  }
877
- r.addEventListener("columnVisible", C);
866
+ o.addEventListener("columnVisible", C);
878
867
  }, t = () => {
879
- const r = m();
880
- if (!r) return;
881
- w(r);
882
- const h = r.getColumns();
868
+ const o = m();
869
+ if (!o) return;
870
+ T(o);
871
+ const h = o.getColumns();
883
872
  if (!h) return;
884
- const v = d.getBoundingClientRect().width, D = Z(v, o), T = [], I = [];
873
+ const v = c.getBoundingClientRect().width, D = ee(v, r), w = [], I = [];
885
874
  for (const S of h) {
886
875
  const V = S.getColId();
887
876
  if (l.current.has(V)) continue;
888
877
  const A = q(S.getColDef());
889
878
  if (!A) continue;
890
879
  const E = D.has(A);
891
- E && !S.isVisible() ? T.push(S) : !E && S.isVisible() && I.push(S);
880
+ E && !S.isVisible() ? w.push(S) : !E && S.isVisible() && I.push(S);
892
881
  }
893
- if (!(T.length === 0 && I.length === 0)) {
882
+ if (!(w.length === 0 && I.length === 0)) {
894
883
  u.current = !0;
895
884
  try {
896
- T.length > 0 && r.setColumnsVisible(T, !0), I.length > 0 && r.setColumnsVisible(I, !1);
885
+ w.length > 0 && o.setColumnsVisible(w, !0), I.length > 0 && o.setColumnsVisible(I, !1);
897
886
  } finally {
898
887
  u.current = !1;
899
888
  }
900
889
  }
901
- }, n = new ResizeObserver(() => t());
902
- return n.observe(d), t(), () => {
903
- var r;
904
- n.disconnect(), (r = m()) == null || r.removeEventListener("columnVisible", C);
890
+ }, i = new ResizeObserver(() => t());
891
+ return i.observe(c), t(), () => {
892
+ var o;
893
+ i.disconnect(), (o = m()) == null || o.removeEventListener("columnVisible", C);
905
894
  };
906
- }, [c, s, o, e]), { lockColumns: z((d) => {
907
- for (const m of d) l.current.add(m);
895
+ }, [d, s, r, e]), { lockColumns: z((c) => {
896
+ for (const m of c) l.current.add(m);
908
897
  }, []) };
909
898
  }
910
- function nt(e) {
911
- var i;
912
- return (i = e.data) != null && i.isArchived ? "data-table-row-archived" : void 0;
899
+ function Ze(e) {
900
+ var n;
901
+ return (n = e.data) != null && n.isArchived ? "data-table-row-archived" : void 0;
913
902
  }
914
- function it(e) {
903
+ function et(e) {
915
904
  return e.data.id;
916
905
  }
917
- function at({
906
+ function tt({
918
907
  views: e,
919
- handleRef: i,
920
- lockColumns: c,
908
+ handleRef: n,
909
+ lockColumns: d,
921
910
  label: s
922
911
  }) {
923
- const [o, l] = te(""), u = Y(
912
+ const [r, l] = ne(""), u = Y(
924
913
  () => e.map((m) => ({ value: m.id, label: m.label })),
925
914
  [e]
926
915
  ), f = z(
927
916
  (m) => {
928
- const C = e.find((t) => t.id === m), a = i.current;
917
+ const C = e.find((t) => t.id === m), a = n.current;
929
918
  if (!C || !a) return;
930
- const w = a.getRawApi();
931
- if (w) {
932
- const t = new Set(C.columns), n = [], r = [];
933
- for (const h of w.getColumns() ?? []) {
919
+ const T = a.getRawApi();
920
+ if (T) {
921
+ const t = new Set(C.columns), i = [], o = [];
922
+ for (const h of T.getColumns() ?? []) {
934
923
  if (q(h.getColDef()) === void 0) continue;
935
924
  const v = h.getColId();
936
- t.has(v) ? n.push(v) : r.push(v);
925
+ t.has(v) ? i.push(v) : o.push(v);
937
926
  }
938
- c([...n, ...r]), n.length > 0 && w.setColumnsVisible(n, !0), r.length > 0 && w.setColumnsVisible(r, !1);
927
+ d([...i, ...o]), i.length > 0 && T.setColumnsVisible(i, !0), o.length > 0 && T.setColumnsVisible(o, !1);
939
928
  }
940
- a.setFilter(C.filterModel), a.setSort(C.sortModel), w == null || w.onFilterChanged();
929
+ a.setFilter(C.filterModel), a.setSort(C.sortModel), T == null || T.onFilterChanged();
941
930
  },
942
- [e, i, c]
943
- ), d = z(
931
+ [e, n, d]
932
+ ), c = z(
944
933
  (m) => {
945
934
  l(m), m && f(m);
946
935
  },
@@ -951,63 +940,63 @@ function at({
951
940
  // the Select's intrinsic `w-full` trigger sizes to a compact, legible width
952
941
  // instead of absorbing the whole FilterBar row.
953
942
  /* @__PURE__ */ g("div", { className: "ds:w-[12rem] ds:max-w-full ds:min-w-0 ds:shrink-0", children: /* @__PURE__ */ g(
954
- Ce,
943
+ ve,
955
944
  {
956
945
  options: u,
957
- value: o,
958
- onValueChange: d,
946
+ value: r,
947
+ onValueChange: c,
959
948
  size: "sm",
960
949
  "aria-label": s
961
950
  }
962
951
  ) })
963
952
  );
964
953
  }
965
- const lt = he(
954
+ const nt = pe(
966
955
  function({
967
- rowData: i,
968
- columns: c,
956
+ rowData: n,
957
+ columns: d,
969
958
  gridId: s,
970
- density: o,
959
+ density: r,
971
960
  actionsCompact: l,
972
961
  heightClass: u,
973
962
  responsive: f = !0,
974
- views: d,
963
+ views: c,
975
964
  onRowAction: m,
976
965
  bulkActions: C,
977
966
  loading: a = !1,
978
- toolbar: w,
967
+ toolbar: T,
979
968
  hideQuickSearch: t = !1,
980
- pagination: n = !1,
981
- paginationPageSizeSelector: r,
969
+ pagination: i = !1,
970
+ paginationPageSizeSelector: o,
982
971
  hideDetails: h = !1,
983
972
  identityHref: v,
984
973
  customFields: D,
985
- "aria-label": T,
974
+ "aria-label": w,
986
975
  className: I
987
976
  }, S) {
988
- const { t: V } = $("ui"), A = k(null), E = k(null), [M, le] = te(null);
989
- pe(
977
+ const { t: V } = $("ui"), A = k(null), E = k(null), [M, re] = ne(null);
978
+ be(
990
979
  S,
991
980
  () => M ?? A.current,
992
981
  [M]
993
982
  );
994
- const { lockColumns: re } = tt(A, {
983
+ const { lockColumns: oe } = Je(A, {
995
984
  containerRef: E,
996
985
  enabled: f
997
- }), G = l ?? o === "compact", Q = k(G), X = z(() => Q.current, []);
998
- ee(() => {
999
- var y;
986
+ }), G = l ?? r === "compact", Q = k(G), X = z(() => Q.current, []);
987
+ te(() => {
988
+ var P;
1000
989
  Q.current = G;
1001
- const N = (y = A.current) == null ? void 0 : y.getRawApi();
990
+ const N = (P = A.current) == null ? void 0 : P.getRawApi();
1002
991
  N && (N.setColumnWidths([
1003
992
  {
1004
993
  key: "actions",
1005
- newWidth: G ? 88 : ne(Ye)
994
+ newWidth: G ? 88 : ie($e)
1006
995
  }
1007
996
  ]), N.refreshCells({ force: !0 }));
1008
997
  }, [G, M]);
1009
- const oe = Y(
1010
- () => c ?? Ze(V, {
998
+ const se = Y(
999
+ () => d ?? Qe(V, {
1011
1000
  hideDetails: h,
1012
1001
  onRowAction: m,
1013
1002
  identityHref: v,
@@ -1015,7 +1004,7 @@ const lt = he(
1015
1004
  getActionsCompact: X
1016
1005
  }),
1017
1006
  [
1018
- c,
1007
+ d,
1019
1008
  V,
1020
1009
  h,
1021
1010
  m,
@@ -1023,40 +1012,40 @@ const lt = he(
1023
1012
  D,
1024
1013
  X
1025
1014
  ]
1026
- ), se = ((d == null ? void 0 : d.length) ?? 0) > 0, de = /* @__PURE__ */ O(P.Toolbar, { children: [
1027
- /* @__PURE__ */ O(P.Toolbar.FilterBar, { children: [
1028
- se && d ? /* @__PURE__ */ g(
1029
- at,
1015
+ ), de = ((c == null ? void 0 : c.length) ?? 0) > 0, ce = /* @__PURE__ */ O(y.Toolbar, { children: [
1016
+ /* @__PURE__ */ O(y.Toolbar.FilterBar, { children: [
1017
+ de && c ? /* @__PURE__ */ g(
1018
+ tt,
1030
1019
  {
1031
- views: d,
1020
+ views: c,
1032
1021
  handleRef: A,
1033
- lockColumns: re,
1022
+ lockColumns: oe,
1034
1023
  label: V("patientTable.views.label")
1035
1024
  }
1036
1025
  ) : null,
1037
- t ? null : /* @__PURE__ */ g(P.Toolbar.QuickSearch, {}),
1038
- /* @__PURE__ */ g(P.Toolbar.FilterChips, {})
1026
+ t ? null : /* @__PURE__ */ g(y.Toolbar.QuickSearch, {}),
1027
+ /* @__PURE__ */ g(y.Toolbar.FilterChips, {})
1039
1028
  ] }),
1040
- /* @__PURE__ */ O(P.Toolbar.Actions, { children: [
1029
+ /* @__PURE__ */ O(y.Toolbar.Actions, { children: [
1041
1030
  C == null ? void 0 : C.map((N) => /* @__PURE__ */ g(
1042
- P.Toolbar.BulkAction,
1031
+ y.Toolbar.BulkAction,
1043
1032
  {
1044
1033
  label: N.label,
1045
1034
  icon: N.icon,
1046
1035
  variant: N.variant,
1047
- onClick: (y) => {
1048
- const fe = (y == null ? void 0 : y.getSelectedNodes().map((j) => j.id).filter((j) => j != null)) ?? [];
1049
- N.onSelect(fe);
1036
+ onClick: (P) => {
1037
+ const he = (P == null ? void 0 : P.getSelectedNodes().map((j) => j.id).filter((j) => j != null)) ?? [];
1038
+ N.onSelect(he);
1050
1039
  }
1051
1040
  },
1052
1041
  N.id
1053
1042
  )),
1054
- /* @__PURE__ */ g(P.Toolbar.ColumnToggle, {}),
1055
- /* @__PURE__ */ g(P.Toolbar.ExportMenu, {})
1043
+ /* @__PURE__ */ g(y.Toolbar.ColumnToggle, {}),
1044
+ /* @__PURE__ */ g(y.Toolbar.ExportMenu, {})
1056
1045
  ] })
1057
- ] }), ce = w ?? de, ue = a ? void 0 : i, me = Y(() => ({ getRowId: it }), []);
1058
- return ve(
1059
- ge,
1046
+ ] }), ue = T ?? ce, me = a ? void 0 : n, fe = Y(() => ({ getRowId: et }), []);
1047
+ return Ne(
1048
+ Ce,
1060
1049
  M,
1061
1050
  s
1062
1051
  ), /* @__PURE__ */ g(
@@ -1064,45 +1053,68 @@ const lt = he(
1064
1053
  {
1065
1054
  ref: E,
1066
1055
  role: "region",
1067
- "aria-label": T ?? V("patientTable.regionLabel"),
1056
+ "aria-label": w ?? V("patientTable.regionLabel"),
1068
1057
  "data-component": "patient-table",
1069
1058
  "data-component-id": s,
1070
1059
  className: "ds:flex ds:w-full ds:min-h-0 ds:flex-1 ds:flex-col",
1071
1060
  children: /* @__PURE__ */ g(
1072
- P,
1061
+ y,
1073
1062
  {
1074
1063
  ref: (N) => {
1075
- A.current = N, le(
1076
- (y) => y === N ? y : N
1064
+ A.current = N, re(
1065
+ (P) => P === N ? P : N
1077
1066
  );
1078
1067
  },
1079
1068
  gridId: s,
1080
- columnDefs: oe,
1081
- rowData: ue,
1069
+ columnDefs: se,
1070
+ rowData: me,
1082
1071
  rowSelection: "multiple",
1083
- pagination: n,
1072
+ pagination: i,
1084
1073
  ...u !== void 0 ? { heightClass: u } : {},
1085
- ...r !== void 0 ? { paginationPageSizeSelector: r } : {},
1086
- density: o,
1087
- getRowClass: nt,
1088
- gridOptions: me,
1074
+ ...o !== void 0 ? { paginationPageSizeSelector: o } : {},
1075
+ density: r,
1076
+ getRowClass: Ze,
1077
+ gridOptions: fe,
1089
1078
  className: I,
1090
- children: ce
1079
+ children: ue
1091
1080
  }
1092
1081
  )
1093
1082
  }
1094
1083
  );
1095
1084
  }
1096
1085
  );
1097
- lt.displayName = "PatientTable";
1086
+ nt.displayName = "PatientTable";
1087
+ const it = 5e4;
1088
+ function at(e) {
1089
+ return e === 0 ? { variant: "success", statusKey: "settled" } : e <= it ? { variant: "warning", statusKey: "pending" } : { variant: "error", statusKey: "overdue" };
1090
+ }
1091
+ function lt(e) {
1092
+ if (e == null || e === "") return null;
1093
+ const n = typeof e == "number" ? e : Number(e);
1094
+ return Number.isFinite(n) ? n : null;
1095
+ }
1096
+ function Rt(e) {
1097
+ const { value: n, currency: d = "EUR", options: s } = e, { t: r, i18n: l } = $("ui"), u = lt(n);
1098
+ if (u === null) return null;
1099
+ const f = l.language || "en", c = new Intl.NumberFormat(f, {
1100
+ style: "currency",
1101
+ currency: d,
1102
+ ...s
1103
+ }).format(u / 100), { variant: m, statusKey: C } = at(u), a = r(`patientTable.balance.status.${C}`);
1104
+ return /* @__PURE__ */ O(le, { variant: m, withDot: !0, size: "sm", className: "ds:tabular-nums", children: [
1105
+ /* @__PURE__ */ g("span", { children: c }),
1106
+ /* @__PURE__ */ g("span", { className: "ds:sr-only", children: a })
1107
+ ] });
1108
+ }
1098
1109
  export {
1099
- Ge as B,
1100
- Ue as C,
1101
- Ke as N,
1102
- Ye as P,
1103
- lt as a,
1104
- Ze as b,
1110
+ Rt as B,
1111
+ Ge as C,
1112
+ ze as N,
1113
+ $e as P,
1114
+ J as T,
1115
+ nt as a,
1116
+ Qe as b,
1105
1117
  q as g,
1106
- tt as u
1118
+ Je as u
1107
1119
  };
1108
- //# sourceMappingURL=patient-table-6XnaWimB.js.map
1120
+ //# sourceMappingURL=balance-badge-cell-DHTiSFyD.js.map