@alfadocs/ui-kit 1.9.3 → 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-x8kS41M7.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",
@@ -320,7 +305,7 @@ function Ze(e, i = {}) {
320
305
  href: l,
321
306
  // When no detail href is supplied the cell renders a button; route its
322
307
  // click through the same `show` row action.
323
- onClick: o ? (t) => o(
308
+ onClick: r ? (t) => r(
324
309
  { id: "show", label: e("patientTable.actions.show") },
325
310
  t
326
311
  ) : void 0
@@ -340,8 +325,8 @@ function Ze(e, i = {}) {
340
325
  responsiveTier: "P1",
341
326
  // The primary phone number string (prefix + number).
342
327
  valueGetter: (t) => {
343
- var n, r, h;
344
- 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) ?? "";
345
330
  },
346
331
  filter: b,
347
332
  floatingFilterComponent: p,
@@ -354,7 +339,7 @@ function Ze(e, i = {}) {
354
339
  headerName: a("nextAppointment"),
355
340
  responsiveTier: "P1",
356
341
  field: "nextAppointment",
357
- cellRenderer: Ke,
342
+ cellRenderer: ze,
358
343
  filter: _,
359
344
  floatingFilterComponent: L,
360
345
  minWidth: 160,
@@ -367,7 +352,9 @@ function Ze(e, i = {}) {
367
352
  responsiveTier: "P1",
368
353
  field: "unpaidAmount",
369
354
  type: "numericColumn",
370
- cellRenderer: Ge,
355
+ // The kit's financial-state pill: `debt` while anything is owed, `settled` at zero.
356
+ cellRenderer: J,
357
+ cellRendererParams: { positiveState: "debt" },
371
358
  filter: H,
372
359
  floatingFilterComponent: U,
373
360
  // Money is integer cents; the inRange filter compares cents directly.
@@ -384,7 +371,7 @@ function Ze(e, i = {}) {
384
371
  // Emit `hide` ONLY when masking (never a literal `hide: false`). A static
385
372
  // `hide: false` is re-applied by AG Grid on every `columnDefs` reconcile,
386
373
  // clobbering a runtime hide from the ViewSwitcher / responsive hook.
387
- hide: c || void 0,
374
+ hide: d || void 0,
388
375
  filter: b,
389
376
  floatingFilterComponent: p,
390
377
  minWidth: 200,
@@ -396,7 +383,7 @@ function Ze(e, i = {}) {
396
383
  headerName: a("carePlanStatus"),
397
384
  responsiveTier: "P2",
398
385
  field: "carePlanStatus",
399
- cellRenderer: Ue,
386
+ cellRenderer: Ge,
400
387
  filter: R,
401
388
  floatingFilterComponent: F,
402
389
  filterParams: {
@@ -436,8 +423,8 @@ function Ze(e, i = {}) {
436
423
  // header + cell) is for ledger figures, not a 2-digit age. Sort stays
437
424
  // numeric because the valueGetter returns a number.
438
425
  valueGetter: (t) => {
439
- var n;
440
- 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;
441
428
  },
442
429
  filter: H,
443
430
  floatingFilterComponent: U,
@@ -451,16 +438,16 @@ function Ze(e, i = {}) {
451
438
  responsiveTier: "P3",
452
439
  // Map the raw code to a localised label for both cell + set filter.
453
440
  valueGetter: (t) => {
454
- var n;
455
- 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;
456
443
  },
457
444
  filter: R,
458
445
  floatingFilterComponent: F,
459
446
  filterParams: {
460
447
  options: [
461
- { value: d.m, label: d.m },
462
- { value: d.f, label: d.f },
463
- { 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 }
464
451
  ]
465
452
  },
466
453
  minWidth: 110,
@@ -473,14 +460,14 @@ function Ze(e, i = {}) {
473
460
  responsiveTier: "P3",
474
461
  // TagListCellRenderer expects an array; wrap the resolved source string.
475
462
  valueGetter: (t) => {
476
- var r, h;
477
- const n = ((r = t.data) == null ? void 0 : r.source) ?? ((h = t.data) == null ? void 0 : h.customSource);
478
- 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] : [];
479
466
  },
480
- cellRenderer: ie,
467
+ cellRenderer: ae,
481
468
  filterValueGetter: (t) => {
482
- var n, r;
483
- 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) ?? "";
484
471
  },
485
472
  filter: R,
486
473
  floatingFilterComponent: F,
@@ -527,8 +514,8 @@ function Ze(e, i = {}) {
527
514
  headerName: a("smsReminders"),
528
515
  hide: !0,
529
516
  valueGetter: (t) => {
530
- var n;
531
- return !!((n = t.data) != null && n.smsReminderEligible);
517
+ var i;
518
+ return !!((i = t.data) != null && i.smsReminderEligible);
532
519
  },
533
520
  valueFormatter: (t) => t.value === !0 ? B : W,
534
521
  filter: R,
@@ -547,8 +534,8 @@ function Ze(e, i = {}) {
547
534
  headerName: a("emailReminders"),
548
535
  hide: !0,
549
536
  valueGetter: (t) => {
550
- var n;
551
- return !!((n = t.data) != null && n.emailReminderEligible);
537
+ var i;
538
+ return !!((i = t.data) != null && i.emailReminderEligible);
552
539
  },
553
540
  valueFormatter: (t) => t.value === !0 ? B : W,
554
541
  filter: R,
@@ -591,14 +578,15 @@ function Ze(e, i = {}) {
591
578
  headerName: a("billableAmount"),
592
579
  hide: !0,
593
580
  type: "numericColumn",
594
- cellRenderer: Te,
595
- // Cents major unit at the render boundary. No `field` the valueGetter
596
- // takes precedence over `field` in AG Grid for both cell + sort, so a
597
- // `field: 'billableAmount'` would be dead (and misleadingly imply the raw
598
- // cents drive the renderer).
599
- 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" },
600
587
  filter: H,
601
588
  floatingFilterComponent: U,
589
+ filterParams: { defaultOperator: "inRange", min: 0 },
602
590
  minWidth: 140,
603
591
  width: 160
604
592
  },
@@ -641,13 +629,13 @@ function Ze(e, i = {}) {
641
629
  hide: !0,
642
630
  cellRenderer: Ie,
643
631
  valueGetter: (t) => {
644
- var n;
645
- 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;
646
634
  },
647
- 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) ?? ""),
648
636
  filterValueGetter: (t) => {
649
- var n;
650
- return ((n = t.data) == null ? void 0 : n.personalAssistant) ?? "";
637
+ var i;
638
+ return ((i = t.data) == null ? void 0 : i.personalAssistant) ?? "";
651
639
  },
652
640
  filter: Re,
653
641
  floatingFilterComponent: Fe,
@@ -669,13 +657,13 @@ function Ze(e, i = {}) {
669
657
  colId: "marketingConsent",
670
658
  headerName: a("marketingConsent"),
671
659
  hide: !0,
672
- cellRenderer: ye,
660
+ cellRenderer: Pe,
673
661
  cellRendererParams: {
674
662
  variantMap: C
675
663
  },
676
664
  valueGetter: (t) => {
677
- var n;
678
- switch ((n = t.data) == null ? void 0 : n.marketingConsent) {
665
+ var i;
666
+ switch ((i = t.data) == null ? void 0 : i.marketingConsent) {
679
667
  case 1:
680
668
  return m.yes;
681
669
  case 0:
@@ -707,8 +695,8 @@ function Ze(e, i = {}) {
707
695
  // `YYYY/N` yearly numbering.
708
696
  valueGetter: (t) => {
709
697
  var h, v;
710
- const n = (h = t.data) == null ? void 0 : h.yearlyNumberingYear, r = (v = t.data) == null ? void 0 : v.yearlyNumberingNumber;
711
- 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}` : "";
712
700
  },
713
701
  filter: b,
714
702
  floatingFilterComponent: p,
@@ -720,8 +708,8 @@ function Ze(e, i = {}) {
720
708
  headerName: a("portal"),
721
709
  hide: !0,
722
710
  valueGetter: (t) => {
723
- var n;
724
- return !!((n = t.data) != null && n.mydentista);
711
+ var i;
712
+ return !!((i = t.data) != null && i.mydentista);
725
713
  },
726
714
  valueFormatter: (t) => t.value === !0 ? B : W,
727
715
  filter: R,
@@ -799,7 +787,7 @@ function Ze(e, i = {}) {
799
787
  width: 220
800
788
  },
801
789
  /* ── Custom fields (per-practice, dynamic) — appended, hidden ──── */
802
- ...Je(u),
790
+ ...qe(u),
803
791
  /* ── Actions (P0, pinned-end) ──────────────────────────────────── */
804
792
  {
805
793
  colId: "actions",
@@ -815,7 +803,7 @@ function Ze(e, i = {}) {
815
803
  // other column — no right-aligned header (the actions still sit at the
816
804
  // pinned inline-end edge, the group just starts at the cell's leading edge).
817
805
  cellClass: "ds:justify-start ag-cell-graphic",
818
- cellRenderer: be,
806
+ cellRenderer: ge,
819
807
  cellRendererParams: {
820
808
  actions: f,
821
809
  intent: "ghost",
@@ -829,119 +817,119 @@ function Ze(e, i = {}) {
829
817
  // The renderer collapses to a single overflow trigger via
830
818
  // `getActionsCompact`; the expanded width is DERIVED from the action count
831
819
  // so a row showing every action can't clip — 88px collapsed → fits-all.
832
- width: ne(f.length),
820
+ width: ie(f.length),
833
821
  minWidth: 88
834
822
  // Anchor — never auto-hidden (no tier).
835
823
  }
836
824
  ];
837
825
  }
838
- const et = [
826
+ const Xe = [
839
827
  { minWidth: 0, tier: "P0" },
840
828
  { minWidth: 640, tier: "P1" },
841
829
  { minWidth: 900, tier: "P2" },
842
830
  { minWidth: 1200, tier: "P3" }
843
831
  ];
844
- function Z(e, i) {
845
- const c = /* @__PURE__ */ new Set();
846
- for (const s of i)
847
- e >= s.minWidth && c.add(s.tier);
848
- 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;
849
837
  }
850
- function tt(e, i) {
838
+ function Je(e, n) {
851
839
  const {
852
- containerRef: c,
840
+ containerRef: d,
853
841
  enabled: s = !0,
854
- breakpoints: o = et
855
- } = i, l = k(/* @__PURE__ */ new Set()), u = k(!1);
856
- return ee(() => {
857
- const d = c.current;
858
- 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;
859
847
  const m = () => {
860
- var r;
861
- return (r = e.current) == null ? void 0 : r.getRawApi();
862
- }, C = (r) => {
863
- if (u.current || r.source === "api") return;
864
- 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] : []);
865
853
  for (const v of h)
866
854
  l.current.add(v.getColId());
867
855
  };
868
856
  let a = !1;
869
- const w = (r) => {
857
+ const T = (o) => {
870
858
  if (a) return;
871
859
  a = !0;
872
- 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);
873
861
  if (h)
874
- for (const T of h) {
875
- const I = q(T.getColDef());
876
- 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());
877
865
  }
878
- r.addEventListener("columnVisible", C);
866
+ o.addEventListener("columnVisible", C);
879
867
  }, t = () => {
880
- const r = m();
881
- if (!r) return;
882
- w(r);
883
- const h = r.getColumns();
868
+ const o = m();
869
+ if (!o) return;
870
+ T(o);
871
+ const h = o.getColumns();
884
872
  if (!h) return;
885
- const v = d.getBoundingClientRect().width, D = Z(v, o), T = [], I = [];
873
+ const v = c.getBoundingClientRect().width, D = ee(v, r), w = [], I = [];
886
874
  for (const S of h) {
887
875
  const V = S.getColId();
888
876
  if (l.current.has(V)) continue;
889
877
  const A = q(S.getColDef());
890
878
  if (!A) continue;
891
879
  const E = D.has(A);
892
- 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);
893
881
  }
894
- if (!(T.length === 0 && I.length === 0)) {
882
+ if (!(w.length === 0 && I.length === 0)) {
895
883
  u.current = !0;
896
884
  try {
897
- 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);
898
886
  } finally {
899
887
  u.current = !1;
900
888
  }
901
889
  }
902
- }, n = new ResizeObserver(() => t());
903
- return n.observe(d), t(), () => {
904
- var r;
905
- 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);
906
894
  };
907
- }, [c, s, o, e]), { lockColumns: z((d) => {
908
- 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);
909
897
  }, []) };
910
898
  }
911
- function nt(e) {
912
- var i;
913
- 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;
914
902
  }
915
- function it(e) {
903
+ function et(e) {
916
904
  return e.data.id;
917
905
  }
918
- function at({
906
+ function tt({
919
907
  views: e,
920
- handleRef: i,
921
- lockColumns: c,
908
+ handleRef: n,
909
+ lockColumns: d,
922
910
  label: s
923
911
  }) {
924
- const [o, l] = te(""), u = Y(
912
+ const [r, l] = ne(""), u = Y(
925
913
  () => e.map((m) => ({ value: m.id, label: m.label })),
926
914
  [e]
927
915
  ), f = z(
928
916
  (m) => {
929
- const C = e.find((t) => t.id === m), a = i.current;
917
+ const C = e.find((t) => t.id === m), a = n.current;
930
918
  if (!C || !a) return;
931
- const w = a.getRawApi();
932
- if (w) {
933
- const t = new Set(C.columns), n = [], r = [];
934
- 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() ?? []) {
935
923
  if (q(h.getColDef()) === void 0) continue;
936
924
  const v = h.getColId();
937
- t.has(v) ? n.push(v) : r.push(v);
925
+ t.has(v) ? i.push(v) : o.push(v);
938
926
  }
939
- 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);
940
928
  }
941
- 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();
942
930
  },
943
- [e, i, c]
944
- ), d = z(
931
+ [e, n, d]
932
+ ), c = z(
945
933
  (m) => {
946
934
  l(m), m && f(m);
947
935
  },
@@ -952,63 +940,63 @@ function at({
952
940
  // the Select's intrinsic `w-full` trigger sizes to a compact, legible width
953
941
  // instead of absorbing the whole FilterBar row.
954
942
  /* @__PURE__ */ g("div", { className: "ds:w-[12rem] ds:max-w-full ds:min-w-0 ds:shrink-0", children: /* @__PURE__ */ g(
955
- Ce,
943
+ ve,
956
944
  {
957
945
  options: u,
958
- value: o,
959
- onValueChange: d,
946
+ value: r,
947
+ onValueChange: c,
960
948
  size: "sm",
961
949
  "aria-label": s
962
950
  }
963
951
  ) })
964
952
  );
965
953
  }
966
- const lt = he(
954
+ const nt = pe(
967
955
  function({
968
- rowData: i,
969
- columns: c,
956
+ rowData: n,
957
+ columns: d,
970
958
  gridId: s,
971
- density: o,
959
+ density: r,
972
960
  actionsCompact: l,
973
961
  heightClass: u,
974
962
  responsive: f = !0,
975
- views: d,
963
+ views: c,
976
964
  onRowAction: m,
977
965
  bulkActions: C,
978
966
  loading: a = !1,
979
- toolbar: w,
967
+ toolbar: T,
980
968
  hideQuickSearch: t = !1,
981
- pagination: n = !1,
982
- paginationPageSizeSelector: r,
969
+ pagination: i = !1,
970
+ paginationPageSizeSelector: o,
983
971
  hideDetails: h = !1,
984
972
  identityHref: v,
985
973
  customFields: D,
986
- "aria-label": T,
974
+ "aria-label": w,
987
975
  className: I
988
976
  }, S) {
989
- const { t: V } = $("ui"), A = k(null), E = k(null), [M, le] = te(null);
990
- pe(
977
+ const { t: V } = $("ui"), A = k(null), E = k(null), [M, re] = ne(null);
978
+ be(
991
979
  S,
992
980
  () => M ?? A.current,
993
981
  [M]
994
982
  );
995
- const { lockColumns: re } = tt(A, {
983
+ const { lockColumns: oe } = Je(A, {
996
984
  containerRef: E,
997
985
  enabled: f
998
- }), G = l ?? o === "compact", Q = k(G), X = z(() => Q.current, []);
999
- ee(() => {
1000
- var y;
986
+ }), G = l ?? r === "compact", Q = k(G), X = z(() => Q.current, []);
987
+ te(() => {
988
+ var P;
1001
989
  Q.current = G;
1002
- const N = (y = A.current) == null ? void 0 : y.getRawApi();
990
+ const N = (P = A.current) == null ? void 0 : P.getRawApi();
1003
991
  N && (N.setColumnWidths([
1004
992
  {
1005
993
  key: "actions",
1006
- newWidth: G ? 88 : ne(Ye)
994
+ newWidth: G ? 88 : ie($e)
1007
995
  }
1008
996
  ]), N.refreshCells({ force: !0 }));
1009
997
  }, [G, M]);
1010
- const oe = Y(
1011
- () => c ?? Ze(V, {
998
+ const se = Y(
999
+ () => d ?? Qe(V, {
1012
1000
  hideDetails: h,
1013
1001
  onRowAction: m,
1014
1002
  identityHref: v,
@@ -1016,7 +1004,7 @@ const lt = he(
1016
1004
  getActionsCompact: X
1017
1005
  }),
1018
1006
  [
1019
- c,
1007
+ d,
1020
1008
  V,
1021
1009
  h,
1022
1010
  m,
@@ -1024,40 +1012,40 @@ const lt = he(
1024
1012
  D,
1025
1013
  X
1026
1014
  ]
1027
- ), se = ((d == null ? void 0 : d.length) ?? 0) > 0, de = /* @__PURE__ */ O(P.Toolbar, { children: [
1028
- /* @__PURE__ */ O(P.Toolbar.FilterBar, { children: [
1029
- se && d ? /* @__PURE__ */ g(
1030
- 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,
1031
1019
  {
1032
- views: d,
1020
+ views: c,
1033
1021
  handleRef: A,
1034
- lockColumns: re,
1022
+ lockColumns: oe,
1035
1023
  label: V("patientTable.views.label")
1036
1024
  }
1037
1025
  ) : null,
1038
- t ? null : /* @__PURE__ */ g(P.Toolbar.QuickSearch, {}),
1039
- /* @__PURE__ */ g(P.Toolbar.FilterChips, {})
1026
+ t ? null : /* @__PURE__ */ g(y.Toolbar.QuickSearch, {}),
1027
+ /* @__PURE__ */ g(y.Toolbar.FilterChips, {})
1040
1028
  ] }),
1041
- /* @__PURE__ */ O(P.Toolbar.Actions, { children: [
1029
+ /* @__PURE__ */ O(y.Toolbar.Actions, { children: [
1042
1030
  C == null ? void 0 : C.map((N) => /* @__PURE__ */ g(
1043
- P.Toolbar.BulkAction,
1031
+ y.Toolbar.BulkAction,
1044
1032
  {
1045
1033
  label: N.label,
1046
1034
  icon: N.icon,
1047
1035
  variant: N.variant,
1048
- onClick: (y) => {
1049
- const fe = (y == null ? void 0 : y.getSelectedNodes().map((j) => j.id).filter((j) => j != null)) ?? [];
1050
- 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);
1051
1039
  }
1052
1040
  },
1053
1041
  N.id
1054
1042
  )),
1055
- /* @__PURE__ */ g(P.Toolbar.ColumnToggle, {}),
1056
- /* @__PURE__ */ g(P.Toolbar.ExportMenu, {})
1043
+ /* @__PURE__ */ g(y.Toolbar.ColumnToggle, {}),
1044
+ /* @__PURE__ */ g(y.Toolbar.ExportMenu, {})
1057
1045
  ] })
1058
- ] }), ce = w ?? de, ue = a ? void 0 : i, me = Y(() => ({ getRowId: it }), []);
1059
- return ve(
1060
- ge,
1046
+ ] }), ue = T ?? ce, me = a ? void 0 : n, fe = Y(() => ({ getRowId: et }), []);
1047
+ return Ne(
1048
+ Ce,
1061
1049
  M,
1062
1050
  s
1063
1051
  ), /* @__PURE__ */ g(
@@ -1065,45 +1053,68 @@ const lt = he(
1065
1053
  {
1066
1054
  ref: E,
1067
1055
  role: "region",
1068
- "aria-label": T ?? V("patientTable.regionLabel"),
1056
+ "aria-label": w ?? V("patientTable.regionLabel"),
1069
1057
  "data-component": "patient-table",
1070
1058
  "data-component-id": s,
1071
1059
  className: "ds:flex ds:w-full ds:min-h-0 ds:flex-1 ds:flex-col",
1072
1060
  children: /* @__PURE__ */ g(
1073
- P,
1061
+ y,
1074
1062
  {
1075
1063
  ref: (N) => {
1076
- A.current = N, le(
1077
- (y) => y === N ? y : N
1064
+ A.current = N, re(
1065
+ (P) => P === N ? P : N
1078
1066
  );
1079
1067
  },
1080
1068
  gridId: s,
1081
- columnDefs: oe,
1082
- rowData: ue,
1069
+ columnDefs: se,
1070
+ rowData: me,
1083
1071
  rowSelection: "multiple",
1084
- pagination: n,
1072
+ pagination: i,
1085
1073
  ...u !== void 0 ? { heightClass: u } : {},
1086
- ...r !== void 0 ? { paginationPageSizeSelector: r } : {},
1087
- density: o,
1088
- getRowClass: nt,
1089
- gridOptions: me,
1074
+ ...o !== void 0 ? { paginationPageSizeSelector: o } : {},
1075
+ density: r,
1076
+ getRowClass: Ze,
1077
+ gridOptions: fe,
1090
1078
  className: I,
1091
- children: ce
1079
+ children: ue
1092
1080
  }
1093
1081
  )
1094
1082
  }
1095
1083
  );
1096
1084
  }
1097
1085
  );
1098
- 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
+ }
1099
1109
  export {
1100
- Ge as B,
1101
- Ue as C,
1102
- Ke as N,
1103
- Ye as P,
1104
- lt as a,
1105
- 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,
1106
1117
  q as g,
1107
- tt as u
1118
+ Je as u
1108
1119
  };
1109
- //# sourceMappingURL=patient-table-S77TBCEB.js.map
1120
+ //# sourceMappingURL=balance-badge-cell-DHTiSFyD.js.map