@alfadocs/ui-kit 1.139.0 → 1.141.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/_chunks/{anamnesis-summary-rows-BgfBnjp0.js → anamnesis-summary-rows-YJGs2uWD.js} +2 -2
  2. package/dist/_chunks/{appointment-card-CaxFXtSn.js → appointment-card-r0OZm77v.js} +170 -168
  3. package/dist/_chunks/appointment-timeline-Bs-rTMzi.js +689 -0
  4. package/dist/_chunks/{appointment-tray-DPpeR9JT.js → appointment-tray-t_ltp-Yi.js} +2 -2
  5. package/dist/_chunks/{balance-badge-cell-CRrIv2hy.js → balance-badge-cell-CRStPNDd.js} +2 -2
  6. package/dist/_chunks/{bill-line-table-DCqxhode.js → bill-line-table-DTqXdBED.js} +2 -2
  7. package/dist/_chunks/{bmi-calculator-rri5vvMt.js → bmi-calculator-rq3ZsKp0.js} +2 -2
  8. package/dist/_chunks/{calendar-appointment-editor-dialog-GdnaPIOV.js → calendar-appointment-editor-dialog-CuXpgLCw.js} +5 -5
  9. package/dist/_chunks/{calendar-waiting-list-panel-CkZBAv_E.js → calendar-waiting-list-panel-BNQrUndD.js} +2 -2
  10. package/dist/_chunks/{calendar.sheets-B0jP2Yt0.js → calendar.sheets-DcW8A3DI.js} +3 -3
  11. package/dist/_chunks/calls-panel-CJNQm7r8.js +1446 -0
  12. package/dist/_chunks/{cycle-calculator-WFhMfJHt.js → cycle-calculator-Cb66X2Pf.js} +2 -2
  13. package/dist/_chunks/{data-grid-bQ6iFm10.js → data-grid-CRUSZcVT.js} +2 -2
  14. package/dist/_chunks/{default-tabs-Dm_vk6hd.js → default-tabs-CRbVCDSU.js} +3 -3
  15. package/dist/_chunks/{due-date-calculator-CALlODZe.js → due-date-calculator-Dlqegxx9.js} +2 -2
  16. package/dist/_chunks/{fetal-weight-D0KofJJw.js → fetal-weight-DWj-_ME8.js} +2 -2
  17. package/dist/_chunks/{hcg-doubling-Dhdt3Jyd.js → hcg-doubling-Dqbj6PQj.js} +2 -2
  18. package/dist/_chunks/{invoice-upload-list-Dz3CXHPP.js → invoice-upload-list-BR6vycF7.js} +3 -3
  19. package/dist/_chunks/{kit-extensions-BB_ksnVl.js → kit-extensions-QddOSnIq.js} +6 -6
  20. package/dist/_chunks/{link-cell-renderer-CSA0KKPe.js → link-cell-renderer-hAJplRFF.js} +2 -2
  21. package/dist/_chunks/medication-line-BohqbCYD.js +238 -0
  22. package/dist/_chunks/{notes-panel-CnmQqhwq.js → notes-panel-C4HSUudf.js} +2 -2
  23. package/dist/_chunks/{number-input-DUSvP7Dq.js → number-input-Bi5Yk6PX.js} +135 -133
  24. package/dist/_chunks/{optical-prescription-C4jpDFOE.js → optical-prescription-GzeK_2cf.js} +2 -2
  25. package/dist/_chunks/{patient-account-settings-DfEPHmCh.js → patient-account-settings-nSvNKKOL.js} +2 -2
  26. package/dist/_chunks/{patient-check-in-resume-TWs8CPQr.js → patient-check-in-resume-Cj2wg_NQ.js} +4 -4
  27. package/dist/_chunks/{patient-details-DQTxSWY4.js → patient-details-D0PjzALT.js} +2 -2
  28. package/dist/_chunks/{patient-field-row-CXuWQeQJ.js → patient-field-row-DlpIModg.js} +2 -2
  29. package/dist/_chunks/{patient-summary-card-j5u7c5Us.js → patient-summary-card-BP_K7g_q.js} +2 -2
  30. package/dist/_chunks/{portal-details-VfeOI4PB.js → portal-details-Cnyqf9kY.js} +2 -2
  31. package/dist/_chunks/{portal-documents-hGHlwmbv.js → portal-documents-g109Dl0O.js} +2 -2
  32. package/dist/_chunks/{portal-parts-C99CreYO.js → portal-parts-DgDFuED8.js} +2 -2
  33. package/dist/_chunks/{pregnancy-dating-C-3NLI6K.js → pregnancy-dating-a6WIg4oy.js} +2 -2
  34. package/dist/_chunks/{pregnancy-weight-gain-DkGcEc_l.js → pregnancy-weight-gain-DmrVHk9y.js} +2 -2
  35. package/dist/_chunks/prescription-history-Bp_JHhdF.js +1719 -0
  36. package/dist/_chunks/{print-sheet-CSeqkM3_.js → print-sheet-gaxObGcm.js} +110 -100
  37. package/dist/_chunks/{rich-text-editor-DFsH5RAj.js → rich-text-editor-orJ-hPgm.js} +1323 -1308
  38. package/dist/_chunks/{toolbar-Dz_hAUIZ.js → toolbar-B7UHCMSr.js} +2 -2
  39. package/dist/_chunks/{unit-converter-CBy7S4Tl.js → unit-converter-OBhSDXee.js} +2 -2
  40. package/dist/_chunks/{use-appointment-details-read-CBSpX4DI.js → use-appointment-details-read-DeQnmmZw.js} +2 -2
  41. package/dist/agent-catalog.json +141 -16
  42. package/dist/agent-i18n/en.json +11 -5
  43. package/dist/appointment-editor-panel/index.js +1 -1
  44. package/dist/browser-support.js +1 -1
  45. package/dist/components/appointment-card/appointment-card.d.ts +4 -0
  46. package/dist/components/appointment-card/index.js +2 -2
  47. package/dist/components/appointment-details-panel/index.js +1 -1
  48. package/dist/components/appointment-timeline/appointment-timeline.d.ts +51 -0
  49. package/dist/components/appointment-timeline/index.d.ts +1 -1
  50. package/dist/components/appointment-timeline/index.js +1 -1
  51. package/dist/components/bill-line-table/index.js +1 -1
  52. package/dist/components/bill-table/index.js +1 -1
  53. package/dist/components/bmi-calculator/index.js +1 -1
  54. package/dist/components/calls-panel/calls-panel.d.ts +91 -0
  55. package/dist/components/calls-panel/index.d.ts +1 -1
  56. package/dist/components/calls-panel/index.js +1 -1
  57. package/dist/components/cycle-calculator/index.js +1 -1
  58. package/dist/components/data-grid/index.js +2 -2
  59. package/dist/components/data-table/index.js +1 -1
  60. package/dist/components/due-date-calculator/index.js +1 -1
  61. package/dist/components/fetal-weight/index.js +1 -1
  62. package/dist/components/hcg-doubling/index.js +1 -1
  63. package/dist/components/invoice-upload-list/index.js +1 -1
  64. package/dist/components/medication-line/index.js +1 -1
  65. package/dist/components/medication-line/medication-line.d.ts +6 -0
  66. package/dist/components/notes-panel/index.js +1 -1
  67. package/dist/components/number-input/index.js +1 -1
  68. package/dist/components/optical-prescription/index.js +1 -1
  69. package/dist/components/patient-details/index.js +1 -1
  70. package/dist/components/patient-summary-card/index.js +1 -1
  71. package/dist/components/patient-table/index.js +1 -1
  72. package/dist/components/pregnancy-dating/index.js +1 -1
  73. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  74. package/dist/components/print-sheet/index.js +1 -1
  75. package/dist/components/print-sheet/print-sheet.d.ts +7 -0
  76. package/dist/components/rich-text-editor/index.js +2 -2
  77. package/dist/components/unit-converter/index.js +1 -1
  78. package/dist/core.css +1 -1
  79. package/dist/find-free-slots-panel/index.js +1 -1
  80. package/dist/host-compat.css +18 -1
  81. package/dist/i18n/locales/ar.d.ts +72 -10
  82. package/dist/i18n/locales/ar.js +76 -17
  83. package/dist/i18n/locales/de.d.ts +72 -10
  84. package/dist/i18n/locales/de.js +76 -17
  85. package/dist/i18n/locales/el.d.ts +72 -10
  86. package/dist/i18n/locales/el.js +79 -17
  87. package/dist/i18n/locales/en.d.ts +64 -10
  88. package/dist/i18n/locales/en.js +71 -17
  89. package/dist/i18n/locales/es.d.ts +72 -10
  90. package/dist/i18n/locales/es.js +76 -17
  91. package/dist/i18n/locales/fr.d.ts +72 -10
  92. package/dist/i18n/locales/fr.js +76 -17
  93. package/dist/i18n/locales/hi.d.ts +72 -10
  94. package/dist/i18n/locales/hi.js +79 -17
  95. package/dist/i18n/locales/it.d.ts +72 -10
  96. package/dist/i18n/locales/it.js +76 -17
  97. package/dist/i18n/locales/ja.d.ts +72 -10
  98. package/dist/i18n/locales/ja.js +79 -17
  99. package/dist/i18n/locales/nl.d.ts +72 -10
  100. package/dist/i18n/locales/nl.js +76 -17
  101. package/dist/i18n/locales/pl.d.ts +72 -10
  102. package/dist/i18n/locales/pl.js +79 -17
  103. package/dist/i18n/locales/pt.d.ts +72 -10
  104. package/dist/i18n/locales/pt.js +76 -17
  105. package/dist/i18n/locales/ro.d.ts +72 -10
  106. package/dist/i18n/locales/ro.js +76 -17
  107. package/dist/i18n/locales/ru.d.ts +72 -10
  108. package/dist/i18n/locales/ru.js +76 -17
  109. package/dist/i18n/locales/sq.d.ts +72 -10
  110. package/dist/i18n/locales/sq.js +79 -17
  111. package/dist/i18n/locales/sv.d.ts +72 -10
  112. package/dist/i18n/locales/sv.js +76 -17
  113. package/dist/i18n/locales/tr.d.ts +72 -10
  114. package/dist/i18n/locales/tr.js +76 -17
  115. package/dist/i18n/locales/zh.d.ts +72 -10
  116. package/dist/i18n/locales/zh.js +76 -17
  117. package/dist/index.js +37 -37
  118. package/dist/locales/ar.json +79 -17
  119. package/dist/locales/de.json +79 -17
  120. package/dist/locales/el.json +79 -17
  121. package/dist/locales/en.json +71 -17
  122. package/dist/locales/es.json +79 -17
  123. package/dist/locales/fr.json +79 -17
  124. package/dist/locales/hi.json +79 -17
  125. package/dist/locales/it.json +79 -17
  126. package/dist/locales/ja.json +79 -17
  127. package/dist/locales/nl.json +79 -17
  128. package/dist/locales/pl.json +79 -17
  129. package/dist/locales/pt.json +79 -17
  130. package/dist/locales/ro.json +79 -17
  131. package/dist/locales/ru.json +79 -17
  132. package/dist/locales/sq.json +79 -17
  133. package/dist/locales/sv.json +79 -17
  134. package/dist/locales/tr.json +79 -17
  135. package/dist/locales/zh.json +79 -17
  136. package/dist/online-bookings-panel/index.js +1 -1
  137. package/dist/patterns/anamnesis/index.js +1 -1
  138. package/dist/patterns/calendar/index.js +2 -2
  139. package/dist/patterns/patient-account-settings/index.js +1 -1
  140. package/dist/patterns/patient-check-in/index.js +1 -1
  141. package/dist/patterns/patient-portal/index.js +2 -2
  142. package/dist/patterns/prescription/index.d.ts +1 -1
  143. package/dist/patterns/prescription/index.js +1 -1
  144. package/dist/patterns/prescription/prescription-composer-item.d.ts +8 -1
  145. package/dist/patterns/prescription/prescription-composer.d.ts +14 -9
  146. package/dist/patterns/prescription/prescription-sheet.d.ts +23 -4
  147. package/dist/patterns/prescription/prescription-types.d.ts +35 -10
  148. package/dist/patterns/prescription/prescription-validation.d.ts +17 -11
  149. package/dist/tokens.css +1 -1
  150. package/dist/waiting-list-panel/index.js +2 -2
  151. package/package.json +1 -1
  152. package/dist/_chunks/appointment-timeline-BEwgbYyG.js +0 -455
  153. package/dist/_chunks/calls-panel-CtxJAzkJ.js +0 -1094
  154. package/dist/_chunks/medication-line-CHdlh-F7.js +0 -222
  155. package/dist/_chunks/prescription-history-748qDVwZ.js +0 -1544
@@ -4,8 +4,8 @@ import { useTranslation as K } from "react-i18next";
4
4
  import { d as s, b as L } from "../_chunks/toast-DQ1Zu1kk.js";
5
5
  import { a as M } from "../_chunks/tooltip-uEBdD1-5.js";
6
6
  import { C as Q } from "../_chunks/calendar-editor-guard-9fShhNIA.js";
7
- import { S as V } from "../_chunks/calendar.sheets-B0jP2Yt0.js";
8
- import { W as X } from "../_chunks/calendar-waiting-list-panel-CkZBAv_E.js";
7
+ import { S as V } from "../_chunks/calendar.sheets-DcW8A3DI.js";
8
+ import { W as X } from "../_chunks/calendar-waiting-list-panel-BNQrUndD.js";
9
9
  import { P as Y } from "../_chunks/privacy-mask-C2ZLKrMh.js";
10
10
  import { H as Z } from "../_chunks/hourglass-BEAzW1wE.js";
11
11
  const q = { open: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit",
3
- "version": "1.139.0",
3
+ "version": "1.141.0",
4
4
  "type": "module",
5
5
  "description": "AlfaDocs shared design system — tokens, components, patterns, and translations for platform, booking, and alfascribe.",
6
6
  "license": "BUSL-1.1",
@@ -1,455 +0,0 @@
1
- import { jsxs as x, jsx as o, Fragment as Me } from "react/jsx-runtime";
2
- import { forwardRef as Ne, useId as Fe, useMemo as j, useRef as y, useState as $, useEffect as _e, useCallback as b, useImperativeHandle as ze } from "react";
3
- import { c as Ae } from "./index-D2ZczOXr.js";
4
- import { useTranslation as Be } from "react-i18next";
5
- import { A as ae } from "./appointment-card-CaxFXtSn.js";
6
- import { B as P } from "./button-DohK_Ak_.js";
7
- import { B as Ke } from "./button-group-DuQuuulC.js";
8
- import { D as Ee } from "./date-picker-BmVBVpVu.js";
9
- import { P as Ye } from "./panel-header-CbtlTe85.js";
10
- import { S as $e } from "./skeleton-tTWJpvAq.js";
11
- import { E as Pe } from "./empty-state-DwJ5YNzz.js";
12
- import { u as ie } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
13
- import { u as We } from "./use-prefers-reduced-motion-BMwIQRjB.js";
14
- import { a as qe, u as Ge, R as Ve } from "./use-list-reflow-C7O4Uqnl.js";
15
- import { u as Le } from "./registry-DvAUVLHh.js";
16
- import { C as Oe } from "./calendar-days-BGWklvE-.js";
17
- const Qe = {
18
- id: "appointment-timeline",
19
- // 'pick' backs select_item (non-persisting activation through
20
- // onOpenAppointment); 'scroll' backs jump_to_today, which re-anchors the
21
- // scroll viewport (mirrors practice-results' scroll_to_result).
22
- capabilities: ["scroll", "pick"],
23
- state: {
24
- items: {
25
- type: "Array<{ id: string; state: string }>",
26
- descriptionKey: "ui.agent.appointmentTimeline.state.items",
27
- description: "Currently-rendered appointments. Ids + lifecycle state only — never patient identity.",
28
- read: (i) => i.getItems()
29
- }
30
- },
31
- actions: {
32
- select_item: {
33
- safety: "read",
34
- argsType: "{ id: string }",
35
- argsSchema: {
36
- type: "object",
37
- properties: { id: { type: "string" } },
38
- required: ["id"]
39
- },
40
- idempotent: !0,
41
- descriptionKey: "ui.agent.appointmentTimeline.actions.selectItem",
42
- description: "Activate the appointment with the given id.",
43
- invoke: (i, n) => {
44
- i.selectItem(n.id);
45
- }
46
- },
47
- jump_to_today: {
48
- safety: "read",
49
- idempotent: !0,
50
- descriptionKey: "ui.agent.appointmentTimeline.actions.jumpToToday",
51
- description: "Re-anchor the timeline scroll on today's appointments.",
52
- invoke: (i) => {
53
- i.jumpToToday();
54
- }
55
- }
56
- },
57
- domHooks: {
58
- root: {
59
- attr: "data-component",
60
- value: "appointment-timeline",
61
- description: "Marks the AppointmentTimeline wrapper."
62
- },
63
- instanceId: {
64
- attr: "data-component-id",
65
- sourceProp: "id",
66
- description: "Sourced from the id prop. Required to address a specific timeline from the agent."
67
- },
68
- item: {
69
- attr: "data-appointment-id",
70
- description: "Stable appointment id emitted on each rendered AppointmentCard inside the timeline."
71
- }
72
- }
73
- }, oe = 96, Ue = Ae(
74
- [
75
- "ds:flex ds:flex-col ds:h-full ds:min-h-0",
76
- "ds:bg-[color:var(--card)] ds:text-[color:var(--card-foreground)]"
77
- ].join(" "),
78
- { variants: { size: { sm: "", md: "" } }, defaultVariants: { size: "sm" } }
79
- ), Xe = [
80
- "ds:flex-1 ds:min-h-0 ds:overflow-y-auto",
81
- "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
82
- "ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-xs)]",
83
- "ds:[--atl-mask-top:black] ds:[--atl-mask-bottom:black]",
84
- "ds:data-[fade-top=true]:[--atl-mask-top:transparent]",
85
- "ds:data-[fade-bottom=true]:[--atl-mask-bottom:transparent]",
86
- "ds:[mask-image:var(--accessible-off,linear-gradient(to_bottom,var(--atl-mask-top)_0,black_var(--atl-fade-distance,var(--spacing-lg)),black_calc(100%-var(--atl-fade-distance,var(--spacing-lg))),var(--atl-mask-bottom)_100%))]",
87
- "ds:motion-reduce:[mask-image:none]",
88
- "ds:forced-colors:[mask-image:none]",
89
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
90
- "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:[outline-offset:-2px]",
91
- "ds:forced-colors:focus-visible:outline-[CanvasText]"
92
- ].join(" ");
93
- function k(i) {
94
- const n = `${i.getMonth() + 1}`.padStart(2, "0"), d = `${i.getDate()}`.padStart(2, "0");
95
- return `${i.getFullYear()}-${n}-${d}`;
96
- }
97
- function Ze(i) {
98
- const n = [...i].sort(
99
- (g, m) => +new Date(g.startIso) - +new Date(m.startIso)
100
- ), d = /* @__PURE__ */ new Map();
101
- for (const g of n) {
102
- const m = new Date(g.startIso), h = k(m);
103
- let r = d.get(h);
104
- r || (r = {
105
- key: h,
106
- date: new Date(m.getFullYear(), m.getMonth(), m.getDate()),
107
- items: []
108
- }, d.set(h, r)), r.items.push(g);
109
- }
110
- return [...d.values()];
111
- }
112
- const Je = Ne(
113
- ({
114
- id: i,
115
- items: n,
116
- nowIso: d,
117
- title: g,
118
- locale: m,
119
- currency: h,
120
- size: r = "sm",
121
- showPatient: C = !1,
122
- onOpenAppointment: v,
123
- selectedId: H,
124
- onLoadEarlier: f,
125
- onLoadLater: p,
126
- hasMoreEarlier: _,
127
- hasMoreLater: re,
128
- loadingEarlier: M = !1,
129
- loadingLater: N = !1,
130
- showFilters: le = !0,
131
- onJumpToDate: F,
132
- emptyTitle: ce,
133
- emptyDescription: de,
134
- className: me,
135
- "aria-label": pe,
136
- headerExtra: ue,
137
- hideDefaultStatus: fe = !1,
138
- wrapText: W = !1,
139
- ...ge
140
- }, he) => {
141
- const { t: l, i18n: ve } = Be("ui"), q = Fe(), z = We(), A = m ?? ve.language, G = g ?? l("appointmentTimeline.title"), c = j(
142
- () => d ? new Date(d) : /* @__PURE__ */ new Date(),
143
- [d]
144
- ), u = j(() => Ze(n), [n]), V = z || void 0, ye = j(
145
- () => u.flatMap((e) => e.items.map((t) => t.id)).join(),
146
- [u]
147
- ), { containerRef: ke } = qe({
148
- key: ye,
149
- reduceMotion: V
150
- }), L = Ge({ reduceMotion: V }), O = y(n), [Q, U] = $([]);
151
- _e(() => {
152
- const e = O.current;
153
- if (e === n) return;
154
- const t = new Set(n.map((a) => a.id)), s = e.filter((a) => !t.has(a.id));
155
- s.length > 0 && (U((a) => [...a, ...s]), s.forEach((a) => {
156
- L.leave(a.id, () => {
157
- U((Y) => Y.filter((S) => S.id !== a.id));
158
- });
159
- })), O.current = n;
160
- }, [n, L]);
161
- const X = _ ?? !!f, Z = re ?? !!p, B = j(() => {
162
- if (u.length === 0) return;
163
- const e = k(c), t = u.map((s) => s.key);
164
- return t.includes(e) ? e : t.find((s) => s >= e) ?? t[t.length - 1];
165
- }, [u, c]), D = y(null), R = y(/* @__PURE__ */ new Map()), J = y(!1), K = y(void 0), ee = y(0), [Te, be] = $(!1), [xe, De] = $(!1), w = b(() => {
166
- const e = D.current;
167
- if (!e) return;
168
- const { scrollTop: t, scrollHeight: s, clientHeight: a } = e;
169
- be(t > 1), De(t + a < s - 1);
170
- }, []), I = b(
171
- (e, t) => {
172
- const s = D.current;
173
- if (!s) return;
174
- let a = R.current.get(e);
175
- if (!a) {
176
- const S = [...R.current.keys()].sort(), ne = S.find((He) => He >= e) ?? S[S.length - 1];
177
- a = ne ? R.current.get(ne) : void 0;
178
- }
179
- if (!a) return;
180
- const Y = a.getBoundingClientRect().top - s.getBoundingClientRect().top;
181
- s.scrollTo({
182
- top: s.scrollTop + Y,
183
- behavior: t && !z ? "smooth" : "auto"
184
- });
185
- },
186
- [z]
187
- );
188
- ie(() => {
189
- var s;
190
- const e = D.current;
191
- if (!e) return;
192
- const t = (s = u[0]) == null ? void 0 : s.key;
193
- if (!J.current)
194
- u.length > 0 && B && (I(B, !1), J.current = !0);
195
- else if (K.current && t && t < K.current) {
196
- const a = e.scrollHeight - ee.current;
197
- a > 0 && (e.scrollTop += a);
198
- }
199
- K.current = t, ee.current = e.scrollHeight, w();
200
- }, [u, B, I, w]), ie(() => {
201
- const e = D.current;
202
- if (!e || typeof ResizeObserver > "u") return;
203
- const t = new ResizeObserver(w);
204
- return t.observe(e), () => t.disconnect();
205
- }, [w]);
206
- const Re = b(() => {
207
- w();
208
- const e = D.current;
209
- if (!e) return;
210
- const { scrollTop: t, scrollHeight: s, clientHeight: a } = e;
211
- f && X && !M && t <= oe && f(), p && Z && !N && s - t - a <= oe && p();
212
- }, [
213
- w,
214
- f,
215
- p,
216
- X,
217
- Z,
218
- M,
219
- N
220
- ]), T = b(
221
- (e) => {
222
- const t = k(e), s = R.current.has(t);
223
- I(t, !0), s || F == null || F(e.toISOString());
224
- },
225
- [I, F]
226
- ), we = b(() => T(c), [T, c]), Ie = b(() => {
227
- const e = new Date(c), t = (e.getDay() + 6) % 7;
228
- e.setDate(e.getDate() - t), T(e);
229
- }, [T, c]), Se = b(() => {
230
- T(new Date(c.getFullYear(), c.getMonth(), 1));
231
- }, [T, c]), E = y(n);
232
- E.current = n;
233
- const te = y(null);
234
- ze(he, () => te.current, []);
235
- const je = j(
236
- () => ({
237
- getItems: () => E.current.map((e) => ({ id: e.id, state: e.state ?? "" })),
238
- selectItem: (e) => {
239
- const t = E.current.find((s) => s.id === e);
240
- t && (v == null || v(t));
241
- },
242
- jumpToToday: () => I(k(c), !0)
243
- }),
244
- [v, I, c]
245
- );
246
- Le(Qe, je, i);
247
- const Ce = u.length === 0 && !M && !N, se = (e) => /* @__PURE__ */ o(
248
- "div",
249
- {
250
- "aria-hidden": "true",
251
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:py-[var(--spacing-xs)]",
252
- children: /* @__PURE__ */ o($e, { variant: "rectangular", height: "3.5rem" })
253
- },
254
- e
255
- );
256
- return /* @__PURE__ */ x(
257
- "section",
258
- {
259
- ref: te,
260
- "data-component": "appointment-timeline",
261
- "data-component-id": i,
262
- "aria-label": pe ?? G,
263
- className: Ue({ size: r, className: me }),
264
- ...ge,
265
- children: [
266
- /* @__PURE__ */ o(
267
- Ye,
268
- {
269
- icon: /* @__PURE__ */ o(Oe, {}),
270
- title: G,
271
- filters: le ? /* @__PURE__ */ x(Me, { children: [
272
- /* @__PURE__ */ x(Ke, { label: l("appointmentTimeline.filtersLabel"), children: [
273
- /* @__PURE__ */ o(P, { intent: "outline", size: "sm", onClick: we, children: l("appointmentTimeline.today") }),
274
- /* @__PURE__ */ o(P, { intent: "outline", size: "sm", onClick: Ie, children: l("appointmentTimeline.thisWeek") }),
275
- /* @__PURE__ */ o(P, { intent: "outline", size: "sm", onClick: Se, children: l("appointmentTimeline.thisMonth") })
276
- ] }),
277
- /* @__PURE__ */ o("label", { htmlFor: q, className: "ds:sr-only", children: l("appointmentTimeline.jumpToDate") }),
278
- /* @__PURE__ */ o(
279
- Ee,
280
- {
281
- id: q,
282
- size: "sm",
283
- placeholder: l("appointmentTimeline.jumpToDate"),
284
- onChange: (e) => {
285
- e && T(e);
286
- }
287
- }
288
- )
289
- ] }) : void 0
290
- }
291
- ),
292
- ue,
293
- Ce ? /* @__PURE__ */ o("div", { className: "ds:flex-1 ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ o(
294
- Pe,
295
- {
296
- variant: "first-use",
297
- size: "sm",
298
- title: ce ?? l("appointmentTimeline.empty.title"),
299
- description: de ?? l("appointmentTimeline.empty.description")
300
- }
301
- ) }) : /* @__PURE__ */ x(
302
- "div",
303
- {
304
- ref: D,
305
- tabIndex: 0,
306
- onScroll: Re,
307
- "data-fade-top": Te ? "true" : void 0,
308
- "data-fade-bottom": xe ? "true" : void 0,
309
- className: Xe,
310
- children: [
311
- M ? se("loading-earlier") : null,
312
- /* @__PURE__ */ x(
313
- "ol",
314
- {
315
- ref: ke,
316
- role: "list",
317
- className: "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-md)] ds:p-0",
318
- children: [
319
- u.map((e) => /* @__PURE__ */ x(
320
- "li",
321
- {
322
- ref: (t) => {
323
- t ? R.current.set(e.key, t) : R.current.delete(e.key);
324
- },
325
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
326
- children: [
327
- /* @__PURE__ */ o(
328
- et,
329
- {
330
- date: e.date,
331
- now: c,
332
- locale: A,
333
- todayLabel: l("appointmentTimeline.today"),
334
- tomorrowLabel: l("appointmentTimeline.tomorrow"),
335
- yesterdayLabel: l("appointmentTimeline.yesterday")
336
- }
337
- ),
338
- /* @__PURE__ */ o(
339
- "ul",
340
- {
341
- role: "list",
342
- className: "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-0",
343
- children: e.items.map((t) => /* @__PURE__ */ o(
344
- ae,
345
- {
346
- item: t,
347
- size: r,
348
- surface: "elevated",
349
- showPatient: C,
350
- locale: A,
351
- currency: h,
352
- onActivate: v,
353
- selected: t.id === H,
354
- hideDefaultStatus: fe,
355
- wrapText: W,
356
- "data-appointment-id": t.id,
357
- "data-reflow-id": t.id,
358
- className: Ve
359
- },
360
- t.id
361
- ))
362
- }
363
- )
364
- ]
365
- },
366
- e.key
367
- )),
368
- Q.length > 0 ? Q.map((e) => /* @__PURE__ */ o(
369
- ae,
370
- {
371
- item: e,
372
- size: r,
373
- surface: "elevated",
374
- showPatient: C,
375
- wrapText: W,
376
- locale: A,
377
- currency: h,
378
- "aria-hidden": "true",
379
- "data-leaving": !0,
380
- className: [
381
- "ds:opacity-0",
382
- "ds:transition-opacity",
383
- "ds:duration-[var(--animation-duration)]",
384
- "ds:ease-[var(--ease-out)]",
385
- "ds:motion-reduce:transition-none"
386
- ].join(" ")
387
- },
388
- `leaving-${e.id}`
389
- )) : null
390
- ]
391
- }
392
- ),
393
- N ? se("loading-later") : null
394
- ]
395
- }
396
- )
397
- ]
398
- }
399
- );
400
- }
401
- );
402
- Je.displayName = "AppointmentTimeline";
403
- function et({
404
- date: i,
405
- now: n,
406
- locale: d,
407
- todayLabel: g,
408
- tomorrowLabel: m,
409
- yesterdayLabel: h
410
- }) {
411
- const r = k(i), C = k(n), v = new Date(n);
412
- v.setDate(n.getDate() + 1);
413
- const H = new Date(n);
414
- H.setDate(n.getDate() - 1);
415
- const f = r === C;
416
- let p;
417
- if (f) p = g;
418
- else if (r === k(v)) p = m;
419
- else if (r === k(H)) p = h;
420
- else {
421
- const _ = i.getFullYear() === n.getFullYear();
422
- p = new Intl.DateTimeFormat(d, {
423
- weekday: "short",
424
- day: "numeric",
425
- month: "short",
426
- ..._ ? {} : { year: "numeric" }
427
- }).format(i);
428
- }
429
- return /* @__PURE__ */ x(
430
- "div",
431
- {
432
- "data-today": f ? "true" : void 0,
433
- className: [
434
- "ds:sticky ds:top-0 ds:z-[1] ds:bg-[color:var(--card)] ds:py-[var(--spacing-2xs)]",
435
- "ds:flex ds:items-center ds:gap-[var(--spacing-2xs)] type-eyebrow",
436
- f ? "ds:text-[color:var(--primary)] ds:font-semibold" : "ds:text-[color:var(--muted-foreground)]"
437
- ].join(" "),
438
- children: [
439
- f ? /* @__PURE__ */ o(
440
- "span",
441
- {
442
- "aria-hidden": "true",
443
- className: "ds:size-1.5 ds:shrink-0 ds:rounded-[var(--radius-full)] ds:bg-[color:var(--primary)]"
444
- }
445
- ) : null,
446
- p
447
- ]
448
- }
449
- );
450
- }
451
- export {
452
- Je as A,
453
- Qe as a
454
- };
455
- //# sourceMappingURL=appointment-timeline-BEwgbYyG.js.map