@alfadocs/ui-kit 0.77.0 → 0.79.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 (86) hide show
  1. package/dist/_chunks/{alia-sidebar-w6B0TEx7.js → alia-sidebar-DzNz1gDf.js} +2 -2
  2. package/dist/_chunks/calendar-4dXTvsCz.js +1136 -0
  3. package/dist/_chunks/calendar-event-card-C6qGtywL.js +257 -0
  4. package/dist/_chunks/{chat-input-BTCDqUDX.js → chat-input-QpHxBEnN.js} +32 -31
  5. package/dist/_chunks/document-preview-nwfulDEs.js +290 -0
  6. package/dist/_chunks/{fiscal-code-input-DWA6C8x8.js → fiscal-code-input-QP9gkyDE.js} +2 -2
  7. package/dist/_chunks/{patient-details-zy76MRh7.js → patient-details-COvYWp2e.js} +2 -2
  8. package/dist/_chunks/signature-request-CEOrCDyk.js +341 -0
  9. package/dist/agent-catalog.json +1 -1
  10. package/dist/components/_shared/contrast-warning.d.ts +46 -0
  11. package/dist/components/calendar/calendar.d.ts +284 -7
  12. package/dist/components/calendar/index.d.ts +1 -1
  13. package/dist/components/calendar/index.js +1 -1
  14. package/dist/components/calendar-event-card/calendar-event-card.d.ts +103 -0
  15. package/dist/components/calendar-event-card/index.d.ts +3 -0
  16. package/dist/components/calendar-event-card/index.js +5 -0
  17. package/dist/components/chat-input/index.js +1 -1
  18. package/dist/components/document-preview/document-preview.d.ts +10 -0
  19. package/dist/components/document-preview/index.js +1 -1
  20. package/dist/components/fiscal-code-input/index.js +1 -1
  21. package/dist/components/index.d.ts +1 -0
  22. package/dist/components/patient-details/index.js +1 -1
  23. package/dist/i18n/locales/ar.d.ts +6 -0
  24. package/dist/i18n/locales/ar.js +6 -0
  25. package/dist/i18n/locales/de.d.ts +6 -0
  26. package/dist/i18n/locales/de.js +6 -0
  27. package/dist/i18n/locales/el.d.ts +6 -0
  28. package/dist/i18n/locales/el.js +6 -0
  29. package/dist/i18n/locales/en.d.ts +6 -0
  30. package/dist/i18n/locales/en.js +6 -0
  31. package/dist/i18n/locales/es.d.ts +6 -0
  32. package/dist/i18n/locales/es.js +6 -0
  33. package/dist/i18n/locales/fr.d.ts +6 -0
  34. package/dist/i18n/locales/fr.js +6 -0
  35. package/dist/i18n/locales/hi.d.ts +6 -0
  36. package/dist/i18n/locales/hi.js +6 -0
  37. package/dist/i18n/locales/it.d.ts +6 -0
  38. package/dist/i18n/locales/it.js +6 -0
  39. package/dist/i18n/locales/ja.d.ts +6 -0
  40. package/dist/i18n/locales/ja.js +6 -0
  41. package/dist/i18n/locales/nl.d.ts +6 -0
  42. package/dist/i18n/locales/nl.js +6 -0
  43. package/dist/i18n/locales/pl.d.ts +6 -0
  44. package/dist/i18n/locales/pl.js +6 -0
  45. package/dist/i18n/locales/pt.d.ts +6 -0
  46. package/dist/i18n/locales/pt.js +6 -0
  47. package/dist/i18n/locales/ro.d.ts +6 -0
  48. package/dist/i18n/locales/ro.js +6 -0
  49. package/dist/i18n/locales/ru.d.ts +6 -0
  50. package/dist/i18n/locales/ru.js +6 -0
  51. package/dist/i18n/locales/sq.d.ts +6 -0
  52. package/dist/i18n/locales/sq.js +6 -0
  53. package/dist/i18n/locales/sv.d.ts +6 -0
  54. package/dist/i18n/locales/sv.js +6 -0
  55. package/dist/i18n/locales/tr.d.ts +6 -0
  56. package/dist/i18n/locales/tr.js +6 -0
  57. package/dist/i18n/locales/zh.d.ts +6 -0
  58. package/dist/i18n/locales/zh.js +6 -0
  59. package/dist/index.js +252 -250
  60. package/dist/locales/ar.json +6 -0
  61. package/dist/locales/de.json +6 -0
  62. package/dist/locales/el.json +6 -0
  63. package/dist/locales/en.json +6 -0
  64. package/dist/locales/es.json +6 -0
  65. package/dist/locales/fr.json +6 -0
  66. package/dist/locales/hi.json +6 -0
  67. package/dist/locales/it.json +6 -0
  68. package/dist/locales/ja.json +6 -0
  69. package/dist/locales/nl.json +6 -0
  70. package/dist/locales/pl.json +6 -0
  71. package/dist/locales/pt.json +6 -0
  72. package/dist/locales/ro.json +6 -0
  73. package/dist/locales/ru.json +6 -0
  74. package/dist/locales/sq.json +6 -0
  75. package/dist/locales/sv.json +6 -0
  76. package/dist/locales/tr.json +6 -0
  77. package/dist/locales/zh.json +6 -0
  78. package/dist/patterns/alia-assistant/index.js +1 -1
  79. package/dist/patterns/signature-request/index.js +1 -1
  80. package/dist/patterns/signature-request/signature-request.d.ts +7 -0
  81. package/dist/tokens.css +9 -5
  82. package/package.json +5 -1
  83. package/dist/_chunks/calendar-DeAlFPsF.js +0 -1050
  84. package/dist/_chunks/document-preview-CvHnHf6T.js +0 -243
  85. package/dist/_chunks/signature-request-C-mskXwi.js +0 -318
  86. package/dist/components/calendar/contrast-warning.d.ts +0 -20
@@ -0,0 +1,257 @@
1
+ import { jsxs as g, jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as H } from "react";
3
+ import { useTranslation as T } from "react-i18next";
4
+ import { c as h } from "./index-D2ZczOXr.js";
5
+ import { c as d } from "./createLucideIcon-DhHxpK9K.js";
6
+ import { C as V } from "./check-DrFSN__t.js";
7
+ import { S as $ } from "./stethoscope-sZXGC43m.js";
8
+ import { C as O } from "./clock-Drd4Wtis.js";
9
+ import { G as C } from "./globe-sHBW1JN5.js";
10
+ import { T as U } from "./triangle-alert-CBnO6nq_.js";
11
+ import { H as q } from "./heart-pulse-BCppJyN2.js";
12
+ import { V as B } from "./video-BheNGvsu.js";
13
+ /**
14
+ * @license lucide-react v1.22.0 - ISC
15
+ *
16
+ * This source code is licensed under the ISC license.
17
+ * See the LICENSE file in the root directory of this source tree.
18
+ */
19
+ const G = [
20
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
21
+ ["path", { d: "M4.929 4.929 19.07 19.071", key: "196cmz" }]
22
+ ], Z = d("ban", G);
23
+ /**
24
+ * @license lucide-react v1.22.0 - ISC
25
+ *
26
+ * This source code is licensed under the ISC license.
27
+ * See the LICENSE file in the root directory of this source tree.
28
+ */
29
+ const K = [
30
+ ["path", { d: "M4 10h12", key: "1y6xl8" }],
31
+ ["path", { d: "M4 14h9", key: "1loblj" }],
32
+ [
33
+ "path",
34
+ {
35
+ d: "M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2",
36
+ key: "1j6lzo"
37
+ }
38
+ ]
39
+ ], P = d("euro", K);
40
+ /**
41
+ * @license lucide-react v1.22.0 - ISC
42
+ *
43
+ * This source code is licensed under the ISC license.
44
+ * See the LICENSE file in the root directory of this source tree.
45
+ */
46
+ const R = [
47
+ [
48
+ "path",
49
+ {
50
+ d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",
51
+ key: "emmmcr"
52
+ }
53
+ ],
54
+ ["path", { d: "M7 10v12", key: "1qc93n" }]
55
+ ], W = d("thumbs-up", R);
56
+ /**
57
+ * @license lucide-react v1.22.0 - ISC
58
+ *
59
+ * This source code is licensed under the ISC license.
60
+ * See the LICENSE file in the root directory of this source tree.
61
+ */
62
+ const Y = [
63
+ [
64
+ "path",
65
+ {
66
+ d: "M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",
67
+ key: "1xq2db"
68
+ }
69
+ ]
70
+ ], D = d("zap", Y);
71
+ function F(t) {
72
+ if (typeof t != "string") return null;
73
+ const n = t.trim();
74
+ if (!n.startsWith("#")) return null;
75
+ const e = n.slice(1);
76
+ let s, o, a;
77
+ if (e.length === 3) {
78
+ if (!/^[0-9a-f]{3}$/i.test(e)) return null;
79
+ s = parseInt(e[0] + e[0], 16), o = parseInt(e[1] + e[1], 16), a = parseInt(e[2] + e[2], 16);
80
+ } else if (e.length === 6) {
81
+ if (!/^[0-9a-f]{6}$/i.test(e)) return null;
82
+ s = parseInt(e.slice(0, 2), 16), o = parseInt(e.slice(2, 4), 16), a = parseInt(e.slice(4, 6), 16);
83
+ } else
84
+ return null;
85
+ return [s / 255, o / 255, a / 255];
86
+ }
87
+ function J([t, n, e]) {
88
+ const s = (o) => o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4);
89
+ return 0.2126 * s(t) + 0.7152 * s(n) + 0.0722 * s(e);
90
+ }
91
+ function ge(t, n, e) {
92
+ }
93
+ function Q(t) {
94
+ const n = F(t);
95
+ return n ? J(n) > 0.1791 ? "on-light" : "on-dark" : null;
96
+ }
97
+ const X = {
98
+ confirmed: W,
99
+ waiting: O,
100
+ in_care: $,
101
+ done: V,
102
+ cancelled: Z,
103
+ absent: D
104
+ }, ee = {
105
+ confirmed: "calendar.status.confirmed",
106
+ waiting: "calendar.status.waiting",
107
+ in_care: "calendar.status.inCare",
108
+ done: "calendar.status.done",
109
+ cancelled: "calendar.status.cancelled",
110
+ absent: "calendar.status.absent"
111
+ }, ae = h(
112
+ [
113
+ // layout — verbatim from the Calendar's former eventCardVariants base,
114
+ // plus ds:relative for the accent bar's positioning context
115
+ "ds:relative ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
116
+ "ds:w-full ds:h-full",
117
+ "ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)]",
118
+ "ds:rounded-[var(--radius-sm)]",
119
+ "ds:text-[length:var(--font-size-sm)]",
120
+ "ds:font-[var(--font-weight-medium)]",
121
+ "ds:overflow-hidden",
122
+ // kept verbatim from the former base (inert on a non-focusable div
123
+ // inside FC; harmless)
124
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
125
+ "ds:focus-visible:outline-[var(--ring)]",
126
+ "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
127
+ // SINGLE PAINTED SURFACE — always present, never conditional. One
128
+ // declaration per paint channel; value chain = "caller custom prop,
129
+ // else token". This structurally eliminates the CVA-vs-override
130
+ // specificity race (the old double-paint bug) — stylesheet order
131
+ // becomes irrelevant.
132
+ "ds:[background-color:var(--calendar-event-bg,var(--primary))]",
133
+ "ds:[color:var(--calendar-event-text,var(--primary-foreground))]",
134
+ "ds:border ds:[border-color:var(--calendar-event-border,transparent)]"
135
+ ].join(" "),
136
+ {
137
+ variants: {
138
+ // Do not add colour classes to this axis — status is icon + accent
139
+ // + aria only; a unit test asserts identical computed background
140
+ // across all six statuses.
141
+ status: {
142
+ none: "",
143
+ confirmed: "",
144
+ waiting: "",
145
+ in_care: "",
146
+ done: "",
147
+ cancelled: "ds:line-through",
148
+ absent: ""
149
+ },
150
+ bookedOnline: {
151
+ // class name kept as a stable inert DOM hook; the stripe paint
152
+ // lives here (moved from fullcalendar-theme.css) so it works in
153
+ // the card's own stories, outside .fc-theme-alfadocs.
154
+ // currentcolor = resolved ink, so stripes stay visible over any
155
+ // picker colour.
156
+ true: "event-booked-online ds:bg-[image:repeating-linear-gradient(45deg,transparent,transparent_4px,color-mix(in_srgb,currentcolor_10%,transparent)_4px,color-mix(in_srgb,currentcolor_10%,transparent)_8px)]",
157
+ false: ""
158
+ }
159
+ },
160
+ defaultVariants: { status: "none", bookedOnline: !1 }
161
+ }
162
+ ), ne = h(
163
+ "ds:absolute ds:inset-y-0 ds:start-0 ds:w-[3px]",
164
+ {
165
+ variants: {
166
+ status: {
167
+ confirmed: "ds:[background-color:var(--success)]",
168
+ waiting: "ds:[background-color:var(--info)]",
169
+ in_care: "ds:[background-color:var(--primary)]",
170
+ done: "ds:[background-color:var(--success)]",
171
+ cancelled: "ds:[background-color:var(--destructive)]",
172
+ absent: "ds:[background-color:var(--warning)]"
173
+ }
174
+ }
175
+ }
176
+ ), te = H(
177
+ ({
178
+ title: t,
179
+ suffix: n,
180
+ rangeText: e,
181
+ showTime: s = !0,
182
+ allDay: o = !1,
183
+ status: a,
184
+ statusAccent: b = !0,
185
+ backgroundColor: i,
186
+ textColor: l,
187
+ borderColor: c,
188
+ isBookedOnline: f = !1,
189
+ hasUnassignedPatient: x,
190
+ hasHighlightedAnamnesis: k,
191
+ hasBillableAmount: _,
192
+ isTelehealth: y,
193
+ resourceLabel: w,
194
+ eventId: z,
195
+ className: N,
196
+ style: m,
197
+ "aria-label": I,
198
+ ...A
199
+ }, L) => {
200
+ const { t: S } = T(), p = a ? X[a] : null, M = a ? S(ee[a]) : void 0, j = I ?? [t, e, w, M].filter(Boolean).join(", "), u = !l && i ? Q(i) : null, v = i || l || c ? {
201
+ ...i ? { "--calendar-event-bg": i } : {},
202
+ ...l ? { "--calendar-event-text": l } : u === "on-light" ? { "--calendar-event-text": "var(--event-ink-on-light)" } : u === "on-dark" ? { "--calendar-event-text": "var(--event-ink-on-dark)" } : {},
203
+ ...c ? { "--calendar-event-border": c } : {}
204
+ } : void 0, E = m || v ? { ...m, ...v } : void 0;
205
+ return /* @__PURE__ */ g(
206
+ "div",
207
+ {
208
+ ref: L,
209
+ ...A,
210
+ className: ae({
211
+ status: a ?? "none",
212
+ bookedOnline: f,
213
+ className: N
214
+ }),
215
+ style: E,
216
+ "aria-label": j,
217
+ "data-component": "calendar-event-card",
218
+ "data-event-id": z,
219
+ "data-status": a ?? "none",
220
+ "data-contrast": l ? "custom" : u ?? "default",
221
+ children: [
222
+ a && b ? /* @__PURE__ */ r(
223
+ "span",
224
+ {
225
+ "aria-hidden": "true",
226
+ "data-slot": "status-accent",
227
+ className: ne({ status: a })
228
+ }
229
+ ) : null,
230
+ /* @__PURE__ */ g("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:self-end", children: [
231
+ p ? /* @__PURE__ */ r(p, { size: 14, "aria-hidden": "true" }) : null,
232
+ f ? /* @__PURE__ */ r(C, { size: 12, "aria-hidden": "true" }) : null,
233
+ x ? /* @__PURE__ */ r(U, { size: 12, "aria-hidden": "true" }) : null,
234
+ k ? /* @__PURE__ */ r(q, { size: 12, "aria-hidden": "true" }) : null,
235
+ _ ? /* @__PURE__ */ r(P, { size: 12, "aria-hidden": "true" }) : null,
236
+ y ? /* @__PURE__ */ r(B, { size: 12, "aria-hidden": "true" }) : null
237
+ ] }),
238
+ s && !o && e ? (
239
+ // No opacity here — composing 70% over saturated bgs drops
240
+ // effective contrast below WCAG AA. The smaller font-size-xs vs
241
+ // the title's font-weight-semibold provides sufficient visual
242
+ // hierarchy.
243
+ /* @__PURE__ */ r("span", { className: "ds:text-[length:var(--font-size-xs)]", children: e })
244
+ ) : null,
245
+ /* @__PURE__ */ r("span", { className: "ds:font-[var(--font-weight-semibold)] ds:truncate ds:text-start", children: t }),
246
+ n ? /* @__PURE__ */ r("span", { className: "ds:truncate ds:text-start ds:text-[length:var(--font-size-xs)]", children: n }) : null
247
+ ]
248
+ }
249
+ );
250
+ }
251
+ );
252
+ te.displayName = "CalendarEventCard";
253
+ export {
254
+ te as C,
255
+ ge as w
256
+ };
257
+ //# sourceMappingURL=calendar-event-card-C6qGtywL.js.map
@@ -1,5 +1,5 @@
1
1
  import { jsxs as v, jsx as i, Fragment as ge } from "react/jsx-runtime";
2
- import { forwardRef as ve, useId as ye, useRef as k, useCallback as W, useImperativeHandle as be, useMemo as xe } from "react";
2
+ import { forwardRef as ve, useId as ye, useRef as w, useCallback as W, useImperativeHandle as be, useMemo as xe } from "react";
3
3
  import { c as Ie } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as ke } from "react-i18next";
5
5
  import { I as q } from "./icon-button-C_kbcd7I.js";
@@ -132,9 +132,9 @@ function Me(t, n) {
132
132
  if (typeof Intl < "u" && typeof Intl.Segmenter == "function")
133
133
  try {
134
134
  const l = new Intl.Segmenter(n, { granularity: "grapheme" });
135
- let s = 0;
136
- for (const y of l.segment(t)) s += 1;
137
- return s;
135
+ let r = 0;
136
+ for (const y of l.segment(t)) r += 1;
137
+ return r;
138
138
  } catch {
139
139
  }
140
140
  return Array.from(t).length;
@@ -149,15 +149,15 @@ function Fe(t, n, l) {
149
149
  return d.length === t.length ? t : d;
150
150
  } catch {
151
151
  }
152
- const s = Array.from(t);
153
- return s.length <= n ? t : s.slice(0, n).join("");
152
+ const r = Array.from(t);
153
+ return r.length <= n ? t : r.slice(0, n).join("");
154
154
  }
155
155
  const Ke = ve(
156
156
  ({
157
157
  size: t = "md",
158
158
  value: n,
159
159
  defaultValue: l,
160
- maxLength: s,
160
+ maxLength: r,
161
161
  submitOnEnter: y = !1,
162
162
  minRows: o = 1,
163
163
  maxRows: d = 8,
@@ -169,22 +169,22 @@ const Ke = ve(
169
169
  label: T,
170
170
  placeholder: U,
171
171
  className: Y,
172
- onChange: w,
173
- onKeyDown: C,
174
- onCompositionStart: N,
175
- onCompositionEnd: V,
176
- id: j,
172
+ onChange: C,
173
+ onKeyDown: N,
174
+ onCompositionStart: V,
175
+ onCompositionEnd: j,
176
+ id: z,
177
177
  ...J
178
178
  }, L) => {
179
- const { t: c, i18n: E } = ke(), O = ye(), p = k(!1), M = k(null), z = k(null), Q = W((e) => {
180
- z.current = e;
179
+ const { t: c, i18n: E } = ke(), O = ye(), p = w(!1), M = w(null), I = w(null), Q = W((e) => {
180
+ I.current = e;
181
181
  }, []), [X, m] = we({
182
182
  value: n === void 0 ? void 0 : String(n),
183
183
  defaultValue: String(l ?? "")
184
- }), a = X ?? "", H = Me(a, E.language), f = typeof s == "number" && s > 0, Z = f ? Math.max(0, s - H) : 0, D = f && H > s * 0.9, h = f && H >= s, F = W(() => {
185
- const e = z.current;
184
+ }), a = X ?? "", H = Me(a, E.language), f = typeof r == "number" && r > 0, Z = f ? Math.max(0, r - H) : 0, D = f && H > r * 0.9, h = f && H >= r, F = W(() => {
185
+ const e = I.current;
186
186
  if (!e) return;
187
- const r = window.getComputedStyle(e), I = parseFloat(r.lineHeight) || 24, de = parseFloat(r.paddingTop) || 0, ue = parseFloat(r.paddingBottom) || 0, pe = parseFloat(r.borderTopWidth) || 0, me = parseFloat(r.borderBottomWidth) || 0, _ = de + ue + pe + me, fe = I * o + _, $ = I * d + _;
187
+ const s = window.getComputedStyle(e), k = parseFloat(s.lineHeight) || 24, de = parseFloat(s.paddingTop) || 0, ue = parseFloat(s.paddingBottom) || 0, pe = parseFloat(s.borderTopWidth) || 0, me = parseFloat(s.borderBottomWidth) || 0, _ = de + ue + pe + me, fe = k * o + _, $ = k * d + _;
188
188
  e.style.height = "auto";
189
189
  const he = Math.max(fe, Math.min(e.scrollHeight, $));
190
190
  e.style.height = `${he}px`, e.style.overflowY = e.scrollHeight > $ ? "auto" : "hidden";
@@ -193,15 +193,16 @@ const Ke = ve(
193
193
  F();
194
194
  }, [F, a]);
195
195
  const ee = (e) => {
196
- let r = e.target.value;
197
- f && !p.current && (r = Fe(r, s, E.language)), m(r), !p.current && (w == null || w(e));
196
+ let s = e.target.value;
197
+ f && !p.current && (s = Fe(s, r, E.language)), m(s), !p.current && (C == null || C(e));
198
198
  }, te = (e) => {
199
- p.current = !0, N == null || N(e);
199
+ p.current = !0, V == null || V(e);
200
200
  }, se = (e) => {
201
- p.current = !1, V == null || V(e);
201
+ p.current = !1, j == null || j(e);
202
202
  }, re = (e) => e.nativeEvent.isComposing || e.keyCode === 229 || p.current, S = () => {
203
- !a.trim() || x || h || (u == null || u(a), m(""));
204
- }, K = k(null);
203
+ var s;
204
+ !a.trim() || x || h || (u == null || u(a), m(""), (s = I.current) == null || s.focus());
205
+ }, K = w(null);
205
206
  be(L, () => K.current, []);
206
207
  const ne = xe(
207
208
  () => ({
@@ -218,7 +219,7 @@ const Ke = ve(
218
219
  },
219
220
  focus: () => {
220
221
  var e;
221
- (e = z.current) == null || e.focus();
222
+ (e = I.current) == null || e.focus();
222
223
  }
223
224
  }),
224
225
  // `submit` is a local closure that always sees the latest currentValue
@@ -227,24 +228,24 @@ const Ke = ve(
227
228
  // eslint-disable-next-line react-hooks/exhaustive-deps
228
229
  [a, m]
229
230
  );
230
- Ne(Te, ne, j);
231
+ Ne(Te, ne, z);
231
232
  const ae = (e) => {
232
- if (C == null || C(e), !e.defaultPrevented && !re(e) && e.key === "Enter") {
233
- const r = e.metaKey || e.ctrlKey, I = y && !e.shiftKey;
234
- (r || I) && (e.preventDefault(), S());
233
+ if (N == null || N(e), !e.defaultPrevented && !re(e) && e.key === "Enter") {
234
+ const s = e.metaKey || e.ctrlKey, k = y && !e.shiftKey;
235
+ (s || k) && (e.preventDefault(), S());
235
236
  }
236
237
  }, ie = () => {
237
238
  var e;
238
239
  (e = M.current) == null || e.click();
239
240
  }, oe = (e) => {
240
241
  e.target.files && e.target.files.length > 0 && (b == null || b(e.target.files)), e.target.value = "";
241
- }, g = j ?? O, R = `${g}-label`, B = f ? `${g}-counter` : void 0, P = `${g}-hint`, ce = U ?? c("chat.input.placeholder"), le = T ?? c("chat.prompt");
242
+ }, g = z ?? O, R = `${g}-label`, B = f ? `${g}-counter` : void 0, P = `${g}-hint`, ce = U ?? c("chat.input.placeholder"), le = T ?? c("chat.prompt");
242
243
  return /* @__PURE__ */ v(
243
244
  "div",
244
245
  {
245
246
  ref: K,
246
247
  "data-component": "chat-input",
247
- "data-component-id": j,
248
+ "data-component-id": z,
248
249
  className: Ee({ size: t, className: Y }),
249
250
  children: [
250
251
  /* @__PURE__ */ i(
@@ -365,4 +366,4 @@ export {
365
366
  Se as P,
366
367
  Te as c
367
368
  };
368
- //# sourceMappingURL=chat-input-BTCDqUDX.js.map
369
+ //# sourceMappingURL=chat-input-QpHxBEnN.js.map
@@ -0,0 +1,290 @@
1
+ import { jsxs as m, Fragment as W, jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as j, useMemo as I, useState as q, useImperativeHandle as E, Fragment as H } from "react";
3
+ import { c as $ } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as U } from "react-i18next";
5
+ import { B as b } from "./badge-DCOqV9mI.js";
6
+ import { C as B } from "./card-DPmk26CL.js";
7
+ import { E as G } from "./empty-state-CrLsi0XI.js";
8
+ import { P as Y } from "./panel-header-D313n_9-.js";
9
+ import { P as J } from "./pdf-viewer-DF3VMaPo.js";
10
+ import { T as O, b as Q, c as X, a as Z } from "./tabs-CVTukWRD.js";
11
+ import { u as ee } from "./registry-DvAUVLHh.js";
12
+ import { F as ie, a as te } from "./file-Cwe9VC1A.js";
13
+ import { F as se } from "./file-text-5yv6r2ls.js";
14
+ import { c as ne } from "./createLucideIcon-DhHxpK9K.js";
15
+ /**
16
+ * @license lucide-react v1.22.0 - ISC
17
+ *
18
+ * This source code is licensed under the ISC license.
19
+ * See the LICENSE file in the root directory of this source tree.
20
+ */
21
+ const ae = [
22
+ ["path", { d: "M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8", key: "14sh0y" }],
23
+ [
24
+ "path",
25
+ {
26
+ d: "M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",
27
+ key: "1970lx"
28
+ }
29
+ ],
30
+ ["path", { d: "M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1", key: "l4dndm" }]
31
+ ], re = ne("files", ae), de = {
32
+ id: "document-preview",
33
+ capabilities: [],
34
+ state: {
35
+ kind: {
36
+ type: "'pdf' | 'image' | 'metadata' | 'empty'",
37
+ descriptionKey: "ui.agent.documentPreview.state.kind",
38
+ description: "Which render branch is active: pdf, image, metadata (no inline preview), or empty (no document). Structural — never the document name.",
39
+ read: (a) => a.getKind()
40
+ }
41
+ },
42
+ actions: {
43
+ get_name: {
44
+ // phi (not read): resolves the document display name, which can identify
45
+ // patients. PRS §26 — phi outranks read so the host gates it behind
46
+ // stricter confirm + audit. The always-on kind slot stays name-free.
47
+ safety: "phi",
48
+ returns: "string | undefined",
49
+ returnsSchema: { type: ["string", "null"] },
50
+ idempotent: !0,
51
+ descriptionKey: "ui.agent.documentPreview.actions.getName",
52
+ description: "Read the display name of the previewed document. May identify a patient (PHI).",
53
+ invoke: (a) => a.getName()
54
+ }
55
+ },
56
+ domHooks: {
57
+ root: {
58
+ attr: "data-component",
59
+ value: "document-preview",
60
+ description: "Marks the DocumentPreview region."
61
+ },
62
+ instanceId: {
63
+ attr: "data-component-id",
64
+ sourceProp: "id",
65
+ description: "Sourced from the id prop."
66
+ }
67
+ }
68
+ }, le = $(
69
+ [
70
+ "ds:flex ds:h-full ds:min-h-0 ds:min-w-0 ds:flex-col ds:overflow-auto",
71
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
72
+ "ds:focus-visible:outline-solid",
73
+ "ds:focus-visible:outline-ring"
74
+ ].join(" ")
75
+ ), oe = {
76
+ signed: "success",
77
+ pending: "warning"
78
+ };
79
+ function z(a, r, u) {
80
+ if (!a) return "empty";
81
+ const l = r ?? "";
82
+ return l === "application/pdf" && u ? "pdf" : l.startsWith("image/") && u ? "image" : "metadata";
83
+ }
84
+ function N(a) {
85
+ const r = a ?? "";
86
+ return r.startsWith("image/") ? ie : r === "application/pdf" || r.startsWith("text/") || r.includes("word") ? se : te;
87
+ }
88
+ const ce = [
89
+ "documentPreview.units.bytes",
90
+ "documentPreview.units.kilobytes",
91
+ "documentPreview.units.megabytes",
92
+ "documentPreview.units.gigabytes"
93
+ ], S = ["B", "KB", "MB", "GB"];
94
+ function me(a, r, u) {
95
+ let l = a, o = 0;
96
+ for (; l >= 1024 && o < S.length - 1; )
97
+ l /= 1024, o++;
98
+ return `${new Intl.NumberFormat(r, {
99
+ maximumFractionDigits: o === 0 ? 0 : 1
100
+ }).format(l)} ${u(ce[o], S[o])}`;
101
+ }
102
+ const ue = j(({ id: a, name: r, mimeType: u, src: l, metadata: o, documents: h, className: F }, M) => {
103
+ const { t: s, i18n: T } = U(), c = I(() => h && h.length > 0 ? h : r ? [{ id: a ?? r, name: r, mimeType: u, src: l, metadata: o }] : [], [h, a, r, u, l, o]), P = c.length > 1, [R, C] = q(void 0), n = c.find((t) => t.id === R) ?? c[0], x = I(
104
+ () => ({
105
+ getKind: () => n ? z(n.name, n.mimeType, n.src) : "empty",
106
+ getName: () => n == null ? void 0 : n.name
107
+ }),
108
+ [n]
109
+ );
110
+ E(M, () => x, [x]), ee(de, x, a);
111
+ const A = (t) => {
112
+ const w = z(t.name, t.mimeType, t.src), e = t.metadata, _ = N(t.mimeType);
113
+ let y;
114
+ w === "pdf" && t.src ? y = /* @__PURE__ */ i(
115
+ J,
116
+ {
117
+ src: t.src,
118
+ toolbarVariant: "minimal",
119
+ ariaLabel: t.name,
120
+ className: "ds:h-full ds:w-full"
121
+ }
122
+ ) : w === "image" && t.src ? y = /* @__PURE__ */ i(
123
+ "img",
124
+ {
125
+ src: t.src,
126
+ alt: s("documentPreview.imageAlt", "Preview of {{name}}", {
127
+ name: t.name
128
+ }),
129
+ className: "ds:max-h-full ds:max-w-full ds:object-contain"
130
+ }
131
+ ) : y = /* @__PURE__ */ m("span", { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:text-muted-foreground", children: [
132
+ /* @__PURE__ */ i(_, { "aria-hidden": "true", className: "ds:size-10" }),
133
+ /* @__PURE__ */ i("span", { className: "type-body-sm", children: s("documentPreview.noPreview", "No preview available.") })
134
+ ] });
135
+ const p = e == null ? void 0 : e.signatureStatus, k = !!(e != null && e.documentType) || !!(e != null && e.clinical) || p !== void 0 && p !== "none", f = (v) => new Intl.DateTimeFormat(T.language, { dateStyle: "medium" }).format(
136
+ new Date(v)
137
+ ), d = [];
138
+ e != null && e.createdBy && d.push({
139
+ key: "createdBy",
140
+ label: s("documentPreview.fields.createdBy", "Created by"),
141
+ value: e.createdBy
142
+ }), e != null && e.createdAt && d.push({
143
+ key: "created",
144
+ label: s("documentPreview.fields.created", "Created"),
145
+ value: f(e.createdAt)
146
+ }), e != null && e.updatedAt && d.push({
147
+ key: "modified",
148
+ label: s("documentPreview.fields.modified", "Modified"),
149
+ value: f(e.updatedAt)
150
+ }), e != null && e.signatureRequestedAt && d.push({
151
+ key: "signatureRequested",
152
+ label: s(
153
+ "documentPreview.fields.signatureRequested",
154
+ "Signature requested"
155
+ ),
156
+ value: f(e.signatureRequestedAt)
157
+ }), e != null && e.signedAt && d.push({
158
+ key: "signed",
159
+ label: s("documentPreview.fields.signed", "Signed"),
160
+ value: f(e.signedAt)
161
+ }), e != null && e.sharedAt && d.push({
162
+ key: "sharedWithPatient",
163
+ label: s(
164
+ "documentPreview.fields.sharedWithPatient",
165
+ "Shared with patient"
166
+ ),
167
+ value: f(e.sharedAt)
168
+ }), (e == null ? void 0 : e.size) !== void 0 && d.push({
169
+ key: "size",
170
+ label: s("documentPreview.fields.size", "Size"),
171
+ value: me(e.size, T.language, s)
172
+ }), e != null && e.expiresAt && d.push({
173
+ key: "expires",
174
+ label: s("documentPreview.fields.expires", "Expires"),
175
+ value: f(e.expiresAt)
176
+ });
177
+ const V = k || d.length > 0;
178
+ return /* @__PURE__ */ i("div", { className: "ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ m(
179
+ B,
180
+ {
181
+ variant: "elevated",
182
+ className: "ds:flex ds:flex-col ds:overflow-hidden",
183
+ children: [
184
+ /* @__PURE__ */ i("div", { className: "ds:flex ds:aspect-[4/3] ds:min-h-0 ds:items-center ds:justify-center ds:overflow-hidden ds:border-b ds:border-[color:var(--card-border)] ds:bg-muted", children: y }),
185
+ V && /* @__PURE__ */ m(B.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
186
+ /* @__PURE__ */ i("h3", { className: "type-eyebrow ds:m-0 ds:text-muted-foreground", children: s("documentPreview.detailsTitle", "Details") }),
187
+ k && /* @__PURE__ */ m("span", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
188
+ (e == null ? void 0 : e.documentType) && /* @__PURE__ */ i(b, { variant: "neutral", size: "sm", children: e.documentType }),
189
+ (e == null ? void 0 : e.clinical) && /* @__PURE__ */ i(b, { variant: "info", size: "sm", children: s("documentPreview.clinical", "Clinical") }),
190
+ p && p !== "none" && /* @__PURE__ */ i(
191
+ b,
192
+ {
193
+ variant: oe[p],
194
+ size: "sm",
195
+ withDot: !0,
196
+ children: s(`documentPreview.signature.${p}`, p)
197
+ }
198
+ )
199
+ ] }),
200
+ d.length > 0 && /* @__PURE__ */ i("dl", { className: "ds:grid ds:grid-cols-[auto_1fr] ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] type-body-sm", children: d.map((v) => /* @__PURE__ */ m(H, { children: [
201
+ /* @__PURE__ */ i("dt", { className: "ds:text-muted-foreground", children: v.label }),
202
+ /* @__PURE__ */ i("dd", { className: "ds:m-0", children: v.value })
203
+ ] }, v.key)) })
204
+ ] })
205
+ ]
206
+ }
207
+ ) });
208
+ }, D = N(n == null ? void 0 : n.mimeType), K = P ? /* @__PURE__ */ i(re, { "aria-hidden": "true" }) : /* @__PURE__ */ i(D, { "aria-hidden": "true" }), L = P ? /* @__PURE__ */ m(W, { children: [
209
+ s("documentPreview.multiTitle", "Documents"),
210
+ /* @__PURE__ */ i(b, { variant: "neutral", size: "sm", children: c.length })
211
+ ] }) : n == null ? void 0 : n.name;
212
+ let g;
213
+ return c.length === 0 ? g = /* @__PURE__ */ i(
214
+ G,
215
+ {
216
+ variant: "first-use",
217
+ size: "sm",
218
+ title: s("documentPreview.emptyTitle", "No document selected"),
219
+ description: s(
220
+ "documentPreview.emptyDescription",
221
+ "Select a document to preview it here."
222
+ )
223
+ }
224
+ ) : P ? g = /* @__PURE__ */ m(
225
+ O,
226
+ {
227
+ value: (n == null ? void 0 : n.id) ?? "",
228
+ onValueChange: C,
229
+ variant: "underlined",
230
+ size: "sm",
231
+ className: "ds:min-h-0 ds:flex-1 ds:pt-[var(--spacing-sm)]",
232
+ children: [
233
+ /* @__PURE__ */ i(
234
+ Q,
235
+ {
236
+ "aria-label": s("documentPreview.tabsLabel", "Selected documents"),
237
+ className: "ds:gap-[var(--spacing-sm)]",
238
+ children: c.map((t) => {
239
+ const w = N(t.mimeType);
240
+ return /* @__PURE__ */ i(
241
+ X,
242
+ {
243
+ value: t.id,
244
+ icon: /* @__PURE__ */ i(
245
+ w,
246
+ {
247
+ "aria-hidden": "true",
248
+ className: "ds:size-4 ds:text-[color:var(--accent)]"
249
+ }
250
+ ),
251
+ className: "ds:[min-inline-size:0]",
252
+ children: /* @__PURE__ */ i("span", { className: "ds:block ds:truncate ds:[min-inline-size:0]", children: t.name })
253
+ },
254
+ t.id
255
+ );
256
+ })
257
+ }
258
+ ),
259
+ c.map((t) => /* @__PURE__ */ i(
260
+ Z,
261
+ {
262
+ value: t.id,
263
+ className: "ds:min-h-0 ds:flex-1",
264
+ children: A(t)
265
+ },
266
+ t.id
267
+ ))
268
+ ]
269
+ }
270
+ ) : g = A(n), /* @__PURE__ */ m(
271
+ "section",
272
+ {
273
+ "data-component": "document-preview",
274
+ "data-component-id": a,
275
+ tabIndex: 0,
276
+ "aria-label": s("documentPreview.regionLabel", "Document preview"),
277
+ className: le({ className: F }),
278
+ children: [
279
+ c.length > 0 && /* @__PURE__ */ i(Y, { sticky: !0, icon: K, title: L }),
280
+ g
281
+ ]
282
+ }
283
+ );
284
+ });
285
+ ue.displayName = "DocumentPreview";
286
+ export {
287
+ ue as D,
288
+ de as d
289
+ };
290
+ //# sourceMappingURL=document-preview-nwfulDEs.js.map