@alfadocs/ui-kit 1.9.3 → 1.10.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.
@@ -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";
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";
1
+ import { jsx as v, jsxs as k } from "react/jsx-runtime";
2
+ import { createElement as E, useRef as G, useEffect as te, useCallback as j, forwardRef as he, useState as ne, useImperativeHandle as pe, useMemo as Q } from "react";
3
+ import { useTranslation as K } from "react-i18next";
4
+ import { a as g, T as C, A as be, d as ie, D as S, e as ge } from "./actions-cell-renderer-BbzCqcld.js";
5
5
  import { S as Ce } from "./select-BW5ecXlX.js";
6
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";
7
+ import { I as Te, L as we, b as _, a as z, c as H, N as $, d as R, S as I, T as ae, D as q, g as Ne, f as Fe, U as Re, e as Ie } from "./link-cell-renderer-Cp2MSlJl.js";
8
+ import { T as Pe } from "./transaction-chip-DJCstquX.js";
9
+ import { B as re } from "./badge-sTusUqZD.js";
10
+ import { c as ye } from "./index-D2ZczOXr.js";
11
+ import { T as Se } from "./timestamp-BV2lC-wV.js";
12
+ import { C as We } from "./calendar-clock-hbObjfGY.js";
12
13
  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" };
21
- }
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;
14
+ import { P as De } from "./pencil-B1sKKyuT.js";
15
+ import { M as Be } from "./mail-BqXVF2zH.js";
16
+ import { M as xe } from "./message-square-Bye4ATvx.js";
17
+ import { U as Ve } from "./users-BjS_Gg1E.js";
18
+ import { T as Oe } from "./trash-2-uumy3fy1.js";
19
+ function Z(e) {
20
+ const { value: n, positiveState: s, showLabel: o = !0 } = e, l = typeof n == "number" && Number.isFinite(n) ? n : null;
21
+ if (l === null) return null;
22
+ const r = l > 0 ? s : "settled";
23
+ return /* @__PURE__ */ v(Pe, { state: r, amount: l / 100, showLabel: o });
26
24
  }
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 Ee = {
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 ke(e) {
34
+ const { t: n } = K("ui"), { data: s, value: o, size: l = "sm" } = e, r = (s == null ? void 0 : s.carePlanStatus) ?? o;
35
+ if (!Me(r)) return null;
36
+ const c = Ee[r];
37
+ return /* @__PURE__ */ v(re, { variant: c, withDot: !0, size: l, children: n(`patientTable.carePlanStatus.${r}`) });
53
38
  }
54
- const J = Pe(
39
+ const ee = ye(
55
40
  "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] ds:whitespace-nowrap",
56
41
  {
57
42
  variants: {
@@ -66,199 +51,199 @@ const J = Pe(
66
51
  },
67
52
  defaultVariants: { tone: "default" }
68
53
  }
69
- ), He = 1440 * 60 * 1e3, ze = 7;
70
- function $e(e) {
54
+ ), Ge = 1440 * 60 * 1e3, Le = 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 _e(e, n) {
61
+ if (n <= 0) return "default";
62
+ const s = e - Date.now();
63
+ return s < 0 ? "default" : s <= n * Ge ? "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);
82
- 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" })
65
+ function ze(e) {
66
+ const { t: n } = K("ui"), { data: s, value: o, soonWithinDays: l = Le } = e, r = Ue((s == null ? void 0 : s.nextAppointment) ?? o);
67
+ if (r === null)
68
+ return /* @__PURE__ */ v("span", { className: ee({ tone: "empty" }), children: n("patientTable.nextAppointment.none") });
69
+ const c = _e(r, l);
70
+ return /* @__PURE__ */ k("span", { className: ee({ tone: c }), children: [
71
+ c === "soon" ? /* @__PURE__ */ v(We, { "aria-hidden": "true", className: "ds:size-3.5 ds:shrink-0" }) : null,
72
+ /* @__PURE__ */ v(Se, { value: r, format: "relative", shape: "bare" })
88
73
  ] });
89
74
  }
90
- function q(e) {
75
+ function le(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),
102
- ...l
78
+ const He = 6;
79
+ function $e(e, n) {
80
+ const s = (l) => (r) => {
81
+ n == null || n(l, r);
82
+ }, o = (l, r) => ({
83
+ icon: l.icon,
84
+ label: l.label,
85
+ variant: l.variant,
86
+ onClick: s(l),
87
+ ...r
103
88
  });
104
89
  return [
105
- s(
90
+ o(
106
91
  {
107
92
  id: "show",
108
93
  label: e("patientTable.actions.show"),
109
- icon: x(Ae, { "aria-hidden": "true" })
94
+ icon: E(Ae, { "aria-hidden": "true" })
110
95
  },
111
96
  {}
112
97
  ),
113
- s(
98
+ o(
114
99
  {
115
100
  id: "edit",
116
101
  label: e("patientTable.actions.edit"),
117
- icon: x(Be, { "aria-hidden": "true" })
102
+ icon: E(De, { "aria-hidden": "true" })
118
103
  },
119
104
  {}
120
105
  ),
121
- s(
106
+ o(
122
107
  {
123
108
  id: "sendEmailReminder",
124
109
  label: e("patientTable.actions.sendEmailReminder"),
125
- icon: x(De, { "aria-hidden": "true" })
110
+ icon: E(Be, { "aria-hidden": "true" })
126
111
  },
127
112
  // Hidden when the patient has email contact disabled (spec).
128
- { hidden: (o) => !o.emailEnabled }
113
+ { hidden: (l) => !l.emailEnabled }
129
114
  ),
130
- s(
115
+ o(
131
116
  {
132
117
  id: "sendSmsReminder",
133
118
  label: e("patientTable.actions.sendSmsReminder"),
134
- icon: x(Ve, { "aria-hidden": "true" })
119
+ icon: E(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: (l) => !(l.phoneNumbers ?? []).some((r) => r.smsEnabled)
139
124
  }
140
125
  ),
141
- s(
126
+ o(
142
127
  {
143
128
  id: "reassign",
144
129
  label: e("patientTable.actions.reassign"),
145
- icon: x(xe, { "aria-hidden": "true" })
130
+ icon: E(Ve, { "aria-hidden": "true" })
146
131
  },
147
132
  {}
148
133
  ),
149
- s(
134
+ o(
150
135
  {
151
136
  id: "delete",
152
137
  label: e("patientTable.actions.delete"),
153
- icon: x(Ee, { "aria-hidden": "true" }),
138
+ icon: E(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: (l) => !!l.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 je = () => !1, A = "✓", W = "—";
151
+ function Ke(e) {
167
152
  if (!e) return null;
168
- const i = new Date(e), c = i.getTime();
169
- if (Number.isNaN(c)) return null;
170
- 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;
153
+ const n = new Date(e), s = n.getTime();
154
+ if (Number.isNaN(s)) return null;
155
+ const o = /* @__PURE__ */ new Date();
156
+ let l = o.getFullYear() - n.getFullYear();
157
+ const r = o.getMonth() - n.getMonth();
158
+ return (r < 0 || r === 0 && o.getDate() < n.getDate()) && (l -= 1), l >= 0 ? l : null;
174
159
  }
175
- function Je(e) {
176
- return e.map((i) => {
177
- var o;
178
- const s = {
179
- colId: `custom:${i.fieldName}`,
180
- headerName: i.label,
160
+ function Ye(e) {
161
+ return e.map((n) => {
162
+ var l;
163
+ const o = {
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" ? {
185
- ...s,
186
- valueGetter: (l) => {
187
- var u, f;
188
- return ((f = (u = l.data) == null ? void 0 : u.customFields) == null ? void 0 : f[i.fieldName]) === !0;
169
+ return n.type === "checkbox" ? {
170
+ ...o,
171
+ valueGetter: (r) => {
172
+ var c, h;
173
+ return ((h = (c = r.data) == null ? void 0 : c.customFields) == null ? void 0 : h[n.fieldName]) === !0;
189
174
  },
190
- valueFormatter: (l) => l.value === !0 ? B : W,
191
- filter: R,
192
- floatingFilterComponent: F,
175
+ valueFormatter: (r) => r.value === !0 ? A : W,
176
+ filter: I,
177
+ floatingFilterComponent: R,
193
178
  filterParams: {
194
179
  options: [
195
- { value: !0, label: B },
180
+ { value: !0, label: A },
196
181
  { value: !1, label: W }
197
182
  ]
198
183
  },
199
184
  minWidth: 110,
200
185
  width: 130
201
- } : i.type === "dropdown" ? {
202
- ...s,
186
+ } : n.type === "dropdown" ? {
187
+ ...o,
203
188
  // TagListCellRenderer expects an array; wrap the single value.
204
- valueGetter: (l) => {
205
- var f, d;
206
- const u = (d = (f = l.data) == null ? void 0 : f.customFields) == null ? void 0 : d[i.fieldName];
207
- return typeof u == "string" && u ? [u] : [];
189
+ valueGetter: (r) => {
190
+ var h, d;
191
+ const c = (d = (h = r.data) == null ? void 0 : h.customFields) == null ? void 0 : d[n.fieldName];
192
+ return typeof c == "string" && c ? [c] : [];
208
193
  },
209
- cellRenderer: ie,
210
- filterValueGetter: (l) => {
211
- var f, d;
212
- const u = (d = (f = l.data) == null ? void 0 : f.customFields) == null ? void 0 : d[i.fieldName];
213
- return typeof u == "string" ? u : "";
194
+ cellRenderer: ae,
195
+ filterValueGetter: (r) => {
196
+ var h, d;
197
+ const c = (d = (h = r.data) == null ? void 0 : h.customFields) == null ? void 0 : d[n.fieldName];
198
+ return typeof c == "string" ? c : "";
214
199
  },
215
- filter: R,
216
- floatingFilterComponent: F,
200
+ filter: I,
201
+ floatingFilterComponent: R,
217
202
  filterParams: {
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) => ({
222
- value: l,
223
- label: l
206
+ options: (l = n.options) == null ? void 0 : l.map((r) => ({
207
+ value: r,
208
+ label: r
224
209
  }))
225
210
  },
226
211
  sortable: !1,
227
212
  minWidth: 130,
228
213
  width: 160
229
214
  } : {
230
- ...s,
231
- valueGetter: (l) => {
232
- var f, d;
233
- const u = (d = (f = l.data) == null ? void 0 : f.customFields) == null ? void 0 : d[i.fieldName];
234
- return typeof u == "string" ? u : "";
215
+ ...o,
216
+ valueGetter: (r) => {
217
+ var h, d;
218
+ const c = (d = (h = r.data) == null ? void 0 : h.customFields) == null ? void 0 : d[n.fieldName];
219
+ return typeof c == "string" ? c : "";
235
220
  },
236
- filter: b,
237
- floatingFilterComponent: p,
221
+ filter: C,
222
+ floatingFilterComponent: g,
238
223
  minWidth: 140,
239
224
  width: 170
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,
248
- identityHref: l,
249
- customFields: u = []
250
- } = i, f = qe(e, o), d = {
230
+ hideDetails: s = !1,
231
+ getActionsCompact: o = je,
232
+ onRowAction: l,
233
+ identityHref: r,
234
+ customFields: c = []
235
+ } = n, h = $e(e, l), d = {
251
236
  m: e("patientTable.gender.m"),
252
237
  f: e("patientTable.gender.f"),
253
238
  x: e("patientTable.gender.x")
254
- }, m = {
239
+ }, u = {
255
240
  yes: e("patientTable.consent.yes"),
256
241
  no: e("patientTable.consent.no"),
257
242
  notSpecified: e("patientTable.consent.notSpecified")
258
- }, C = {
259
- [m.yes]: "success",
260
- [m.no]: "error",
261
- [m.notSpecified]: "neutral"
243
+ }, p = {
244
+ [u.yes]: "success",
245
+ [u.no]: "error",
246
+ [u.notSpecified]: "neutral"
262
247
  }, a = (t) => e(`patientTable.column.${t}`);
263
248
  return [
264
249
  /* ── Avatar (P0, pinned-start) ─────────────────────────────────── */
@@ -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",
@@ -301,8 +286,8 @@ function Ze(e, i = {}) {
301
286
  headerName: a("firstName"),
302
287
  pinned: "left",
303
288
  field: "firstName",
304
- filter: b,
305
- floatingFilterComponent: p,
289
+ filter: C,
290
+ floatingFilterComponent: g,
306
291
  // Size to content: width === minWidth so the pinned column sits tight with
307
292
  // no dead space before the next pinned column (pinned columns can't flex).
308
293
  width: 140,
@@ -317,16 +302,16 @@ function Ze(e, i = {}) {
317
302
  field: "lastName",
318
303
  cellRenderer: we,
319
304
  cellRendererParams: {
320
- href: l,
305
+ href: r,
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: l ? (t) => l(
324
309
  { id: "show", label: e("patientTable.actions.show") },
325
310
  t
326
311
  ) : void 0
327
312
  },
328
- filter: b,
329
- floatingFilterComponent: p,
313
+ filter: C,
314
+ floatingFilterComponent: g,
330
315
  // Size to content: a modest pinned width with no stretched default, so the
331
316
  // avatar + first + last group ends tight against the scrollable columns.
332
317
  width: 150,
@@ -340,11 +325,11 @@ 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, f, b;
329
+ return ((b = (f = (i = t.data) == null ? void 0 : i.phoneNumbers) == null ? void 0 : f[0]) == null ? void 0 : b.number) ?? "";
345
330
  },
346
- filter: b,
347
- floatingFilterComponent: p,
331
+ filter: C,
332
+ floatingFilterComponent: g,
348
333
  minWidth: 160,
349
334
  width: 180
350
335
  },
@@ -354,9 +339,9 @@ function Ze(e, i = {}) {
354
339
  headerName: a("nextAppointment"),
355
340
  responsiveTier: "P1",
356
341
  field: "nextAppointment",
357
- cellRenderer: Ke,
358
- filter: _,
359
- floatingFilterComponent: L,
342
+ cellRenderer: ze,
343
+ filter: z,
344
+ floatingFilterComponent: _,
360
345
  minWidth: 160,
361
346
  width: 180
362
347
  },
@@ -367,9 +352,11 @@ function Ze(e, i = {}) {
367
352
  responsiveTier: "P1",
368
353
  field: "unpaidAmount",
369
354
  type: "numericColumn",
370
- cellRenderer: Ge,
371
- filter: H,
372
- floatingFilterComponent: U,
355
+ // The kit's financial-state pill: `debt` while anything is owed, `settled` at zero.
356
+ cellRenderer: Z,
357
+ cellRendererParams: { positiveState: "debt" },
358
+ filter: $,
359
+ floatingFilterComponent: H,
373
360
  // Money is integer cents; the inRange filter compares cents directly.
374
361
  filterParams: { defaultOperator: "inRange", min: 0 },
375
362
  minWidth: 150,
@@ -384,9 +371,9 @@ 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,
388
- filter: b,
389
- floatingFilterComponent: p,
374
+ hide: s || void 0,
375
+ filter: C,
376
+ floatingFilterComponent: g,
390
377
  minWidth: 200,
391
378
  width: 240
392
379
  },
@@ -396,9 +383,9 @@ function Ze(e, i = {}) {
396
383
  headerName: a("carePlanStatus"),
397
384
  responsiveTier: "P2",
398
385
  field: "carePlanStatus",
399
- cellRenderer: Ue,
400
- filter: R,
401
- floatingFilterComponent: F,
386
+ cellRenderer: ke,
387
+ filter: I,
388
+ floatingFilterComponent: R,
402
389
  filterParams: {
403
390
  options: [
404
391
  {
@@ -422,8 +409,8 @@ function Ze(e, i = {}) {
422
409
  headerName: a("fiscalCode"),
423
410
  responsiveTier: "P3",
424
411
  field: "italianFiscalCode",
425
- filter: b,
426
- floatingFilterComponent: p,
412
+ filter: C,
413
+ floatingFilterComponent: g,
427
414
  minWidth: 160,
428
415
  width: 180
429
416
  },
@@ -436,11 +423,11 @@ 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 Ke((i = t.data) == null ? void 0 : i.dateOfBirth) ?? void 0;
441
428
  },
442
- filter: H,
443
- floatingFilterComponent: U,
429
+ filter: $,
430
+ floatingFilterComponent: H,
444
431
  minWidth: 90,
445
432
  width: 110
446
433
  },
@@ -451,11 +438,11 @@ 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 ? d[t.data.gender] : W;
456
443
  },
457
- filter: R,
458
- floatingFilterComponent: F,
444
+ filter: I,
445
+ floatingFilterComponent: R,
459
446
  filterParams: {
460
447
  options: [
461
448
  { value: d.m, label: d.m },
@@ -473,17 +460,17 @@ 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 f, b;
464
+ const i = ((f = t.data) == null ? void 0 : f.source) ?? ((b = t.data) == null ? void 0 : b.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, f;
470
+ return ((i = t.data) == null ? void 0 : i.source) ?? ((f = t.data) == null ? void 0 : f.customSource) ?? "";
484
471
  },
485
- filter: R,
486
- floatingFilterComponent: F,
472
+ filter: I,
473
+ floatingFilterComponent: R,
487
474
  sortable: !1,
488
475
  minWidth: 120,
489
476
  width: 150
@@ -494,10 +481,10 @@ function Ze(e, i = {}) {
494
481
  headerName: a("dateOfBirth"),
495
482
  hide: !0,
496
483
  field: "dateOfBirth",
497
- cellRenderer: K,
484
+ cellRenderer: q,
498
485
  cellRendererParams: { format: "date" },
499
- filter: _,
500
- floatingFilterComponent: L,
486
+ filter: z,
487
+ floatingFilterComponent: _,
501
488
  minWidth: 140,
502
489
  width: 160
503
490
  },
@@ -506,8 +493,8 @@ function Ze(e, i = {}) {
506
493
  headerName: a("placeOfBirth"),
507
494
  hide: !0,
508
495
  field: "placeOfBirth",
509
- filter: b,
510
- floatingFilterComponent: p,
496
+ filter: C,
497
+ floatingFilterComponent: g,
511
498
  minWidth: 140,
512
499
  width: 160
513
500
  },
@@ -516,8 +503,8 @@ function Ze(e, i = {}) {
516
503
  headerName: a("countryOfBirth"),
517
504
  hide: !0,
518
505
  field: "countryOfBirth",
519
- filter: b,
520
- floatingFilterComponent: p,
506
+ filter: C,
507
+ floatingFilterComponent: g,
521
508
  minWidth: 130,
522
509
  width: 150
523
510
  },
@@ -527,15 +514,15 @@ 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
- valueFormatter: (t) => t.value === !0 ? B : W,
534
- filter: R,
535
- floatingFilterComponent: F,
520
+ valueFormatter: (t) => t.value === !0 ? A : W,
521
+ filter: I,
522
+ floatingFilterComponent: R,
536
523
  filterParams: {
537
524
  options: [
538
- { value: !0, label: B },
525
+ { value: !0, label: A },
539
526
  { value: !1, label: W }
540
527
  ]
541
528
  },
@@ -547,15 +534,15 @@ 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
- valueFormatter: (t) => t.value === !0 ? B : W,
554
- filter: R,
555
- floatingFilterComponent: F,
540
+ valueFormatter: (t) => t.value === !0 ? A : W,
541
+ filter: I,
542
+ floatingFilterComponent: R,
556
543
  filterParams: {
557
544
  options: [
558
- { value: !0, label: B },
545
+ { value: !0, label: A },
559
546
  { value: !1, label: W }
560
547
  ]
561
548
  },
@@ -567,8 +554,8 @@ function Ze(e, i = {}) {
567
554
  headerName: a("pec"),
568
555
  hide: !0,
569
556
  field: "pecAddress",
570
- filter: b,
571
- floatingFilterComponent: p,
557
+ filter: C,
558
+ floatingFilterComponent: g,
572
559
  minWidth: 200,
573
560
  width: 240
574
561
  },
@@ -578,10 +565,10 @@ function Ze(e, i = {}) {
578
565
  headerName: a("lastVisit"),
579
566
  hide: !0,
580
567
  field: "lastAppointment",
581
- cellRenderer: K,
568
+ cellRenderer: q,
582
569
  cellRendererParams: { format: "relative" },
583
- filter: _,
584
- floatingFilterComponent: L,
570
+ filter: z,
571
+ floatingFilterComponent: _,
585
572
  minWidth: 140,
586
573
  width: 160
587
574
  },
@@ -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,
600
- filter: H,
601
- floatingFilterComponent: U,
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: Z,
586
+ cellRendererParams: { positiveState: "to-invoice" },
587
+ filter: $,
588
+ floatingFilterComponent: H,
589
+ filterParams: { defaultOperator: "inRange", min: 0 },
602
590
  minWidth: 140,
603
591
  width: 160
604
592
  },
@@ -609,8 +597,8 @@ function Ze(e, i = {}) {
609
597
  field: "defaultDiscount",
610
598
  type: "numericColumn",
611
599
  valueFormatter: (t) => t.value == null ? "" : `${t.value}%`,
612
- filter: H,
613
- floatingFilterComponent: U,
600
+ filter: $,
601
+ floatingFilterComponent: H,
614
602
  minWidth: 110,
615
603
  width: 130
616
604
  },
@@ -620,8 +608,8 @@ function Ze(e, i = {}) {
620
608
  headerName: a("diagnosis"),
621
609
  hide: !0,
622
610
  field: "diagnosis",
623
- filter: b,
624
- floatingFilterComponent: p,
611
+ filter: C,
612
+ floatingFilterComponent: g,
625
613
  minWidth: 180,
626
614
  width: 220
627
615
  },
@@ -630,8 +618,8 @@ function Ze(e, i = {}) {
630
618
  headerName: a("insurance"),
631
619
  hide: !0,
632
620
  field: "defaultInsurance",
633
- filter: R,
634
- floatingFilterComponent: F,
621
+ filter: I,
622
+ floatingFilterComponent: R,
635
623
  minWidth: 140,
636
624
  width: 160
637
625
  },
@@ -639,18 +627,18 @@ function Ze(e, i = {}) {
639
627
  colId: "assignedTo",
640
628
  headerName: a("assignedTo"),
641
629
  hide: !0,
642
- cellRenderer: Ie,
630
+ cellRenderer: Re,
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
- filter: Re,
653
- floatingFilterComponent: Fe,
640
+ filter: Fe,
641
+ floatingFilterComponent: Ne,
654
642
  minWidth: 160,
655
643
  width: 180
656
644
  },
@@ -659,8 +647,8 @@ function Ze(e, i = {}) {
659
647
  headerName: a("job"),
660
648
  hide: !0,
661
649
  field: "job",
662
- filter: b,
663
- floatingFilterComponent: p,
650
+ filter: C,
651
+ floatingFilterComponent: g,
664
652
  minWidth: 140,
665
653
  width: 160
666
654
  },
@@ -669,30 +657,30 @@ function Ze(e, i = {}) {
669
657
  colId: "marketingConsent",
670
658
  headerName: a("marketingConsent"),
671
659
  hide: !0,
672
- cellRenderer: ye,
660
+ cellRenderer: Ie,
673
661
  cellRendererParams: {
674
- variantMap: C
662
+ variantMap: p
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
- return m.yes;
668
+ return u.yes;
681
669
  case 0:
682
- return m.no;
670
+ return u.no;
683
671
  default:
684
- return m.notSpecified;
672
+ return u.notSpecified;
685
673
  }
686
674
  },
687
- filter: R,
688
- floatingFilterComponent: F,
675
+ filter: I,
676
+ floatingFilterComponent: R,
689
677
  filterParams: {
690
678
  options: [
691
- { value: m.yes, label: m.yes },
692
- { value: m.no, label: m.no },
679
+ { value: u.yes, label: u.yes },
680
+ { value: u.no, label: u.no },
693
681
  {
694
- value: m.notSpecified,
695
- label: m.notSpecified
682
+ value: u.notSpecified,
683
+ label: u.notSpecified
696
684
  }
697
685
  ]
698
686
  },
@@ -706,12 +694,12 @@ function Ze(e, i = {}) {
706
694
  hide: !0,
707
695
  // `YYYY/N` yearly numbering.
708
696
  valueGetter: (t) => {
709
- 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}` : "";
697
+ var b, m;
698
+ const i = (b = t.data) == null ? void 0 : b.yearlyNumberingYear, f = (m = t.data) == null ? void 0 : m.yearlyNumberingNumber;
699
+ return i != null && f != null ? `${i}/${f}` : "";
712
700
  },
713
- filter: b,
714
- floatingFilterComponent: p,
701
+ filter: C,
702
+ floatingFilterComponent: g,
715
703
  minWidth: 120,
716
704
  width: 140
717
705
  },
@@ -720,15 +708,15 @@ 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
- valueFormatter: (t) => t.value === !0 ? B : W,
727
- filter: R,
728
- floatingFilterComponent: F,
714
+ valueFormatter: (t) => t.value === !0 ? A : W,
715
+ filter: I,
716
+ floatingFilterComponent: R,
729
717
  filterParams: {
730
718
  options: [
731
- { value: !0, label: B },
719
+ { value: !0, label: A },
732
720
  { value: !1, label: W }
733
721
  ]
734
722
  },
@@ -740,10 +728,10 @@ function Ze(e, i = {}) {
740
728
  headerName: a("createdAt"),
741
729
  hide: !0,
742
730
  field: "createdAt",
743
- cellRenderer: K,
731
+ cellRenderer: q,
744
732
  cellRendererParams: { format: "date" },
745
- filter: _,
746
- floatingFilterComponent: L,
733
+ filter: z,
734
+ floatingFilterComponent: _,
747
735
  minWidth: 140,
748
736
  width: 160
749
737
  },
@@ -753,8 +741,8 @@ function Ze(e, i = {}) {
753
741
  headerName: a("city"),
754
742
  hide: !0,
755
743
  field: "city",
756
- filter: b,
757
- floatingFilterComponent: p,
744
+ filter: C,
745
+ floatingFilterComponent: g,
758
746
  minWidth: 120,
759
747
  width: 150
760
748
  },
@@ -763,8 +751,8 @@ function Ze(e, i = {}) {
763
751
  headerName: a("province"),
764
752
  hide: !0,
765
753
  field: "province",
766
- filter: b,
767
- floatingFilterComponent: p,
754
+ filter: C,
755
+ floatingFilterComponent: g,
768
756
  minWidth: 100,
769
757
  width: 120
770
758
  },
@@ -773,8 +761,8 @@ function Ze(e, i = {}) {
773
761
  headerName: a("postcode"),
774
762
  hide: !0,
775
763
  field: "postcode",
776
- filter: b,
777
- floatingFilterComponent: p,
764
+ filter: C,
765
+ floatingFilterComponent: g,
778
766
  minWidth: 110,
779
767
  width: 130
780
768
  },
@@ -783,8 +771,8 @@ function Ze(e, i = {}) {
783
771
  headerName: a("country"),
784
772
  hide: !0,
785
773
  field: "countryCode",
786
- filter: b,
787
- floatingFilterComponent: p,
774
+ filter: C,
775
+ floatingFilterComponent: g,
788
776
  minWidth: 110,
789
777
  width: 130
790
778
  },
@@ -793,13 +781,13 @@ function Ze(e, i = {}) {
793
781
  headerName: a("street"),
794
782
  hide: !0,
795
783
  field: "street",
796
- filter: b,
797
- floatingFilterComponent: p,
784
+ filter: C,
785
+ floatingFilterComponent: g,
798
786
  minWidth: 180,
799
787
  width: 220
800
788
  },
801
789
  /* ── Custom fields (per-practice, dynamic) — appended, hidden ──── */
802
- ...Je(u),
790
+ ...Ye(c),
803
791
  /* ── Actions (P0, pinned-end) ──────────────────────────────────── */
804
792
  {
805
793
  colId: "actions",
@@ -817,11 +805,11 @@ function Ze(e, i = {}) {
817
805
  cellClass: "ds:justify-start ag-cell-graphic",
818
806
  cellRenderer: be,
819
807
  cellRendererParams: {
820
- actions: f,
808
+ actions: h,
821
809
  intent: "ghost",
822
810
  group: !0,
823
811
  label: e("patientTable.actions.group"),
824
- collapsed: s
812
+ collapsed: o
825
813
  },
826
814
  sortable: !1,
827
815
  filter: !1,
@@ -829,265 +817,286 @@ 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(h.length),
833
821
  minWidth: 88
834
822
  // Anchor — never auto-hidden (no tier).
835
823
  }
836
824
  ];
837
825
  }
838
- const et = [
826
+ const Qe = /* @__PURE__ */ new Set([
827
+ "api",
828
+ "flex",
829
+ "gridInitializing",
830
+ "gridOptionsChanged",
831
+ "autosizeColumns",
832
+ "sizeColumnsToFit",
833
+ "rowDataUpdated",
834
+ "rowModelUpdated"
835
+ ]), Xe = [
839
836
  { minWidth: 0, tier: "P0" },
840
837
  { minWidth: 640, tier: "P1" },
841
838
  { minWidth: 900, tier: "P2" },
842
839
  { minWidth: 1200, tier: "P3" }
843
840
  ];
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;
841
+ function Je(e, n) {
842
+ const s = /* @__PURE__ */ new Set();
843
+ for (const o of n)
844
+ e >= o.minWidth && s.add(o.tier);
845
+ return s.add("P0"), s;
849
846
  }
850
- function tt(e, i) {
847
+ function Ze(e, n) {
851
848
  const {
852
- containerRef: c,
853
- 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;
859
- 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] : []);
865
- for (const v of h)
866
- l.current.add(v.getColId());
849
+ containerRef: s,
850
+ enabled: o = !0,
851
+ breakpoints: l = Xe
852
+ } = n, r = G(/* @__PURE__ */ new Set()), c = G(!1);
853
+ return te(() => {
854
+ const d = s.current;
855
+ if (!o || !d) return;
856
+ const u = () => {
857
+ var m;
858
+ return (m = e.current) == null ? void 0 : m.getRawApi();
867
859
  };
868
- let a = !1;
869
- const w = (r) => {
870
- if (a) return;
871
- a = !0;
872
- const h = r.getColumns(), v = d.getBoundingClientRect().width, D = Z(v, o);
873
- 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());
877
- }
878
- r.addEventListener("columnVisible", C);
879
- }, t = () => {
880
- const r = m();
881
- if (!r) return;
882
- w(r);
883
- const h = r.getColumns();
884
- if (!h) return;
885
- const v = d.getBoundingClientRect().width, D = Z(v, o), T = [], I = [];
886
- for (const S of h) {
887
- const V = S.getColId();
888
- if (l.current.has(V)) continue;
889
- const A = q(S.getColDef());
890
- if (!A) continue;
891
- const E = D.has(A);
892
- E && !S.isVisible() ? T.push(S) : !E && S.isVisible() && I.push(S);
860
+ let p;
861
+ const a = () => {
862
+ p === void 0 && (p = window.setTimeout(() => {
863
+ p = void 0, f();
864
+ }, 0));
865
+ }, T = (m) => {
866
+ var O;
867
+ if (c.current) return;
868
+ if (Qe.has(m.source)) {
869
+ a();
870
+ return;
893
871
  }
894
- if (!(T.length === 0 && I.length === 0)) {
895
- u.current = !0;
872
+ const V = (m.columns ?? (m.column ? [m.column] : [])).map((D) => D.getColId());
873
+ for (const D of V) r.current.add(D);
874
+ (O = e.current) == null || O.markColumnsUserTouched(V);
875
+ };
876
+ let t = !1;
877
+ const i = (m) => {
878
+ t || (t = !0, m.addEventListener("columnVisible", T));
879
+ }, f = () => {
880
+ var M;
881
+ const m = u();
882
+ if (!m) return;
883
+ i(m);
884
+ const x = m.getColumns();
885
+ if (!x) return;
886
+ const V = d.getBoundingClientRect().width, O = Je(V, l), D = new Set(
887
+ ((M = e.current) == null ? void 0 : M.getUserTouchedColumns()) ?? []
888
+ ), P = [], F = [];
889
+ for (const N of x) {
890
+ const L = N.getColId();
891
+ if (r.current.has(L) || D.has(L))
892
+ continue;
893
+ const U = le(N.getColDef());
894
+ if (!U) continue;
895
+ const B = O.has(U);
896
+ B && !N.isVisible() ? P.push(N) : !B && N.isVisible() && F.push(N);
897
+ }
898
+ if (!(P.length === 0 && F.length === 0)) {
899
+ c.current = !0;
896
900
  try {
897
- T.length > 0 && r.setColumnsVisible(T, !0), I.length > 0 && r.setColumnsVisible(I, !1);
901
+ P.length > 0 && m.setColumnsVisible(P, !0), F.length > 0 && m.setColumnsVisible(F, !1);
898
902
  } finally {
899
- u.current = !1;
903
+ c.current = !1;
900
904
  }
901
905
  }
902
- }, n = new ResizeObserver(() => t());
903
- return n.observe(d), t(), () => {
904
- var r;
905
- n.disconnect(), (r = m()) == null || r.removeEventListener("columnVisible", C);
906
+ }, b = new ResizeObserver(() => f());
907
+ return b.observe(d), f(), () => {
908
+ var m;
909
+ b.disconnect(), p !== void 0 && window.clearTimeout(p), (m = u()) == null || m.removeEventListener("columnVisible", T);
906
910
  };
907
- }, [c, s, o, e]), { lockColumns: z((d) => {
908
- for (const m of d) l.current.add(m);
909
- }, []) };
911
+ }, [s, o, l, e]), { lockColumns: j(
912
+ (d) => {
913
+ var u;
914
+ for (const p of d) r.current.add(p);
915
+ (u = e.current) == null || u.markColumnsUserTouched(d);
916
+ },
917
+ [e]
918
+ ) };
910
919
  }
911
- function nt(e) {
912
- var i;
913
- return (i = e.data) != null && i.isArchived ? "data-table-row-archived" : void 0;
920
+ function et(e) {
921
+ var n;
922
+ return (n = e.data) != null && n.isArchived ? "data-table-row-archived" : void 0;
914
923
  }
915
- function it(e) {
924
+ function tt(e) {
916
925
  return e.data.id;
917
926
  }
918
- function at({
927
+ function nt({
919
928
  views: e,
920
- handleRef: i,
921
- lockColumns: c,
922
- label: s
929
+ handleRef: n,
930
+ lockColumns: s,
931
+ label: o
923
932
  }) {
924
- const [o, l] = te(""), u = Y(
925
- () => e.map((m) => ({ value: m.id, label: m.label })),
933
+ const [l, r] = ne(""), c = Q(
934
+ () => e.map((u) => ({ value: u.id, label: u.label })),
926
935
  [e]
927
- ), f = z(
928
- (m) => {
929
- const C = e.find((t) => t.id === m), a = i.current;
930
- 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() ?? []) {
935
- if (q(h.getColDef()) === void 0) continue;
936
- const v = h.getColId();
937
- t.has(v) ? n.push(v) : r.push(v);
936
+ ), h = j(
937
+ (u) => {
938
+ const p = e.find((t) => t.id === u), a = n.current;
939
+ if (!p || !a) return;
940
+ const T = a.getRawApi();
941
+ if (T) {
942
+ const t = new Set(p.columns), i = [], f = [];
943
+ for (const b of T.getColumns() ?? []) {
944
+ if (le(b.getColDef()) === void 0) continue;
945
+ const m = b.getColId();
946
+ t.has(m) ? i.push(m) : f.push(m);
938
947
  }
939
- c([...n, ...r]), n.length > 0 && w.setColumnsVisible(n, !0), r.length > 0 && w.setColumnsVisible(r, !1);
948
+ s([...i, ...f]), i.length > 0 && T.setColumnsVisible(i, !0), f.length > 0 && T.setColumnsVisible(f, !1);
940
949
  }
941
- a.setFilter(C.filterModel), a.setSort(C.sortModel), w == null || w.onFilterChanged();
950
+ a.setFilter(p.filterModel), a.setSort(p.sortModel), T == null || T.onFilterChanged();
942
951
  },
943
- [e, i, c]
944
- ), d = z(
945
- (m) => {
946
- l(m), m && f(m);
952
+ [e, n, s]
953
+ ), d = j(
954
+ (u) => {
955
+ r(u), u && h(u);
947
956
  },
948
- [f]
957
+ [h]
949
958
  );
950
959
  return (
951
960
  // Width-constraining wrapper (same pattern as the toolbar's QuickSearch) so
952
961
  // the Select's intrinsic `w-full` trigger sizes to a compact, legible width
953
962
  // instead of absorbing the whole FilterBar row.
954
- /* @__PURE__ */ g("div", { className: "ds:w-[12rem] ds:max-w-full ds:min-w-0 ds:shrink-0", children: /* @__PURE__ */ g(
963
+ /* @__PURE__ */ v("div", { className: "ds:w-[12rem] ds:max-w-full ds:min-w-0 ds:shrink-0", children: /* @__PURE__ */ v(
955
964
  Ce,
956
965
  {
957
- options: u,
958
- value: o,
966
+ options: c,
967
+ value: l,
959
968
  onValueChange: d,
960
969
  size: "sm",
961
- "aria-label": s
970
+ "aria-label": o
962
971
  }
963
972
  ) })
964
973
  );
965
974
  }
966
- const lt = he(
975
+ const it = he(
967
976
  function({
968
- rowData: i,
969
- columns: c,
970
- gridId: s,
971
- density: o,
972
- actionsCompact: l,
973
- heightClass: u,
974
- responsive: f = !0,
977
+ rowData: n,
978
+ columns: s,
979
+ gridId: o,
980
+ density: l,
981
+ actionsCompact: r,
982
+ heightClass: c,
983
+ responsive: h = !0,
975
984
  views: d,
976
- onRowAction: m,
977
- bulkActions: C,
985
+ onRowAction: u,
986
+ bulkActions: p,
978
987
  loading: a = !1,
979
- toolbar: w,
988
+ toolbar: T,
980
989
  hideQuickSearch: t = !1,
981
- pagination: n = !1,
982
- paginationPageSizeSelector: r,
983
- hideDetails: h = !1,
984
- identityHref: v,
985
- customFields: D,
986
- "aria-label": T,
987
- className: I
988
- }, S) {
989
- const { t: V } = $("ui"), A = k(null), E = k(null), [M, le] = te(null);
990
+ pagination: i = !1,
991
+ paginationPageSizeSelector: f,
992
+ hideDetails: b = !1,
993
+ identityHref: m,
994
+ customFields: x,
995
+ "aria-label": V,
996
+ className: O
997
+ }, D) {
998
+ const { t: P } = K("ui"), F = G(null), M = G(null), [N, L] = ne(null);
990
999
  pe(
991
- S,
992
- () => M ?? A.current,
993
- [M]
1000
+ D,
1001
+ () => N ?? F.current,
1002
+ [N]
994
1003
  );
995
- const { lockColumns: re } = tt(A, {
996
- containerRef: E,
997
- enabled: f
998
- }), G = l ?? o === "compact", Q = k(G), X = z(() => Q.current, []);
999
- ee(() => {
1004
+ const { lockColumns: U } = Ze(F, {
1005
+ containerRef: M,
1006
+ enabled: h
1007
+ }), B = r ?? l === "compact", X = G(B), J = j(() => X.current, []);
1008
+ te(() => {
1000
1009
  var y;
1001
- Q.current = G;
1002
- const N = (y = A.current) == null ? void 0 : y.getRawApi();
1003
- N && (N.setColumnWidths([
1010
+ X.current = B;
1011
+ const w = (y = F.current) == null ? void 0 : y.getRawApi();
1012
+ w && (w.setColumnWidths([
1004
1013
  {
1005
1014
  key: "actions",
1006
- newWidth: G ? 88 : ne(Ye)
1015
+ newWidth: B ? 88 : ie(He)
1007
1016
  }
1008
- ]), N.refreshCells({ force: !0 }));
1009
- }, [G, M]);
1010
- const oe = Y(
1011
- () => c ?? Ze(V, {
1012
- hideDetails: h,
1013
- onRowAction: m,
1014
- identityHref: v,
1015
- customFields: D,
1016
- getActionsCompact: X
1017
+ ]), w.refreshCells({ force: !0 }));
1018
+ }, [B, N]);
1019
+ const oe = Q(
1020
+ () => s ?? qe(P, {
1021
+ hideDetails: b,
1022
+ onRowAction: u,
1023
+ identityHref: m,
1024
+ customFields: x,
1025
+ getActionsCompact: J
1017
1026
  }),
1018
1027
  [
1019
- c,
1020
- V,
1021
- h,
1028
+ s,
1029
+ P,
1030
+ b,
1031
+ u,
1022
1032
  m,
1023
- v,
1024
- D,
1025
- X
1033
+ x,
1034
+ J
1026
1035
  ]
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,
1036
+ ), se = ((d == null ? void 0 : d.length) ?? 0) > 0, de = /* @__PURE__ */ k(S.Toolbar, { children: [
1037
+ /* @__PURE__ */ k(S.Toolbar.FilterBar, { children: [
1038
+ se && d ? /* @__PURE__ */ v(
1039
+ nt,
1031
1040
  {
1032
1041
  views: d,
1033
- handleRef: A,
1034
- lockColumns: re,
1035
- label: V("patientTable.views.label")
1042
+ handleRef: F,
1043
+ lockColumns: U,
1044
+ label: P("patientTable.views.label")
1036
1045
  }
1037
1046
  ) : null,
1038
- t ? null : /* @__PURE__ */ g(P.Toolbar.QuickSearch, {}),
1039
- /* @__PURE__ */ g(P.Toolbar.FilterChips, {})
1047
+ t ? null : /* @__PURE__ */ v(S.Toolbar.QuickSearch, {}),
1048
+ /* @__PURE__ */ v(S.Toolbar.FilterChips, {})
1040
1049
  ] }),
1041
- /* @__PURE__ */ O(P.Toolbar.Actions, { children: [
1042
- C == null ? void 0 : C.map((N) => /* @__PURE__ */ g(
1043
- P.Toolbar.BulkAction,
1050
+ /* @__PURE__ */ k(S.Toolbar.Actions, { children: [
1051
+ p == null ? void 0 : p.map((w) => /* @__PURE__ */ v(
1052
+ S.Toolbar.BulkAction,
1044
1053
  {
1045
- label: N.label,
1046
- icon: N.icon,
1047
- variant: N.variant,
1054
+ label: w.label,
1055
+ icon: w.icon,
1056
+ variant: w.variant,
1048
1057
  onClick: (y) => {
1049
- const fe = (y == null ? void 0 : y.getSelectedNodes().map((j) => j.id).filter((j) => j != null)) ?? [];
1050
- N.onSelect(fe);
1058
+ const fe = (y == null ? void 0 : y.getSelectedNodes().map((Y) => Y.id).filter((Y) => Y != null)) ?? [];
1059
+ w.onSelect(fe);
1051
1060
  }
1052
1061
  },
1053
- N.id
1062
+ w.id
1054
1063
  )),
1055
- /* @__PURE__ */ g(P.Toolbar.ColumnToggle, {}),
1056
- /* @__PURE__ */ g(P.Toolbar.ExportMenu, {})
1064
+ /* @__PURE__ */ v(S.Toolbar.ColumnToggle, {}),
1065
+ /* @__PURE__ */ v(S.Toolbar.ExportMenu, {})
1057
1066
  ] })
1058
- ] }), ce = w ?? de, ue = a ? void 0 : i, me = Y(() => ({ getRowId: it }), []);
1067
+ ] }), ce = T ?? de, ue = a ? void 0 : n, me = Q(() => ({ getRowId: tt }), []);
1059
1068
  return ve(
1060
1069
  ge,
1061
- M,
1062
- s
1063
- ), /* @__PURE__ */ g(
1070
+ N,
1071
+ o
1072
+ ), /* @__PURE__ */ v(
1064
1073
  "div",
1065
1074
  {
1066
- ref: E,
1075
+ ref: M,
1067
1076
  role: "region",
1068
- "aria-label": T ?? V("patientTable.regionLabel"),
1077
+ "aria-label": V ?? P("patientTable.regionLabel"),
1069
1078
  "data-component": "patient-table",
1070
- "data-component-id": s,
1079
+ "data-component-id": o,
1071
1080
  className: "ds:flex ds:w-full ds:min-h-0 ds:flex-1 ds:flex-col",
1072
- children: /* @__PURE__ */ g(
1073
- P,
1081
+ children: /* @__PURE__ */ v(
1082
+ S,
1074
1083
  {
1075
- ref: (N) => {
1076
- A.current = N, le(
1077
- (y) => y === N ? y : N
1084
+ ref: (w) => {
1085
+ F.current = w, L(
1086
+ (y) => y === w ? y : w
1078
1087
  );
1079
1088
  },
1080
- gridId: s,
1089
+ gridId: o,
1081
1090
  columnDefs: oe,
1082
1091
  rowData: ue,
1083
1092
  rowSelection: "multiple",
1084
- pagination: n,
1085
- ...u !== void 0 ? { heightClass: u } : {},
1086
- ...r !== void 0 ? { paginationPageSizeSelector: r } : {},
1087
- density: o,
1088
- getRowClass: nt,
1093
+ pagination: i,
1094
+ ...c !== void 0 ? { heightClass: c } : {},
1095
+ ...f !== void 0 ? { paginationPageSizeSelector: f } : {},
1096
+ density: l,
1097
+ getRowClass: et,
1089
1098
  gridOptions: me,
1090
- className: I,
1099
+ className: O,
1091
1100
  children: ce
1092
1101
  }
1093
1102
  )
@@ -1095,15 +1104,38 @@ const lt = he(
1095
1104
  );
1096
1105
  }
1097
1106
  );
1098
- lt.displayName = "PatientTable";
1107
+ it.displayName = "PatientTable";
1108
+ const at = 5e4;
1109
+ function rt(e) {
1110
+ return e === 0 ? { variant: "success", statusKey: "settled" } : e <= at ? { variant: "warning", statusKey: "pending" } : { variant: "error", statusKey: "overdue" };
1111
+ }
1112
+ function lt(e) {
1113
+ if (e == null || e === "") return null;
1114
+ const n = typeof e == "number" ? e : Number(e);
1115
+ return Number.isFinite(n) ? n : null;
1116
+ }
1117
+ function It(e) {
1118
+ const { value: n, currency: s = "EUR", options: o } = e, { t: l, i18n: r } = K("ui"), c = lt(n);
1119
+ if (c === null) return null;
1120
+ const h = r.language || "en", d = new Intl.NumberFormat(h, {
1121
+ style: "currency",
1122
+ currency: s,
1123
+ ...o
1124
+ }).format(c / 100), { variant: u, statusKey: p } = rt(c), a = l(`patientTable.balance.status.${p}`);
1125
+ return /* @__PURE__ */ k(re, { variant: u, withDot: !0, size: "sm", className: "ds:tabular-nums", children: [
1126
+ /* @__PURE__ */ v("span", { children: d }),
1127
+ /* @__PURE__ */ v("span", { className: "ds:sr-only", children: a })
1128
+ ] });
1129
+ }
1099
1130
  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,
1106
- q as g,
1107
- tt as u
1131
+ It as B,
1132
+ ke as C,
1133
+ ze as N,
1134
+ He as P,
1135
+ Z as T,
1136
+ it as a,
1137
+ qe as b,
1138
+ le as g,
1139
+ Ze as u
1108
1140
  };
1109
- //# sourceMappingURL=patient-table-S77TBCEB.js.map
1141
+ //# sourceMappingURL=balance-badge-cell-DK9wxCxW.js.map