@alfadocs/ui-kit-debug 0.78.0 → 0.80.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 (50) hide show
  1. package/dist/_chunks/{alia-sidebar-w6B0TEx7.js → alia-sidebar-DzNz1gDf.js} +2 -2
  2. package/dist/_chunks/{alia-sidebar-w6B0TEx7.js.map → alia-sidebar-DzNz1gDf.js.map} +1 -1
  3. package/dist/_chunks/calendar-4dXTvsCz.js +1136 -0
  4. package/dist/_chunks/calendar-4dXTvsCz.js.map +1 -0
  5. package/dist/_chunks/calendar-event-card-C6qGtywL.js +257 -0
  6. package/dist/_chunks/calendar-event-card-C6qGtywL.js.map +1 -0
  7. package/dist/_chunks/{chat-input-BTCDqUDX.js → chat-input-QpHxBEnN.js} +32 -31
  8. package/dist/_chunks/chat-input-QpHxBEnN.js.map +1 -0
  9. package/dist/_chunks/{fiscal-code-input-DWA6C8x8.js → fiscal-code-input-QP9gkyDE.js} +2 -2
  10. package/dist/_chunks/fiscal-code-input-QP9gkyDE.js.map +1 -0
  11. package/dist/_chunks/{patient-details-zy76MRh7.js → patient-details-COvYWp2e.js} +2 -2
  12. package/dist/_chunks/{patient-details-zy76MRh7.js.map → patient-details-COvYWp2e.js.map} +1 -1
  13. package/dist/_chunks/signature-request-CEOrCDyk.js +341 -0
  14. package/dist/_chunks/signature-request-CEOrCDyk.js.map +1 -0
  15. package/dist/agent-catalog.json +1 -1
  16. package/dist/components/_shared/contrast-warning.d.ts +46 -0
  17. package/dist/components/_shared/contrast-warning.d.ts.map +1 -0
  18. package/dist/components/calendar/calendar.d.ts +284 -7
  19. package/dist/components/calendar/calendar.d.ts.map +1 -1
  20. package/dist/components/calendar/index.d.ts +1 -1
  21. package/dist/components/calendar/index.d.ts.map +1 -1
  22. package/dist/components/calendar/index.js +1 -1
  23. package/dist/components/calendar-event-card/calendar-event-card.d.ts +103 -0
  24. package/dist/components/calendar-event-card/calendar-event-card.d.ts.map +1 -0
  25. package/dist/components/calendar-event-card/index.d.ts +3 -0
  26. package/dist/components/calendar-event-card/index.d.ts.map +1 -0
  27. package/dist/components/calendar-event-card/index.js +5 -0
  28. package/dist/components/calendar-event-card/index.js.map +1 -0
  29. package/dist/components/chat-input/chat-input.d.ts.map +1 -1
  30. package/dist/components/chat-input/index.js +1 -1
  31. package/dist/components/fiscal-code-input/index.js +1 -1
  32. package/dist/components/index.d.ts +1 -0
  33. package/dist/components/index.d.ts.map +1 -1
  34. package/dist/components/patient-details/index.js +1 -1
  35. package/dist/index.js +252 -250
  36. package/dist/index.js.map +1 -1
  37. package/dist/patterns/alia-assistant/index.js +1 -1
  38. package/dist/patterns/signature-request/index.js +1 -1
  39. package/dist/patterns/signature-request/signature-request.d.ts +7 -0
  40. package/dist/patterns/signature-request/signature-request.d.ts.map +1 -1
  41. package/dist/tokens.css +8 -5
  42. package/package.json +5 -1
  43. package/dist/_chunks/calendar-DeAlFPsF.js +0 -1050
  44. package/dist/_chunks/calendar-DeAlFPsF.js.map +0 -1
  45. package/dist/_chunks/chat-input-BTCDqUDX.js.map +0 -1
  46. package/dist/_chunks/fiscal-code-input-DWA6C8x8.js.map +0 -1
  47. package/dist/_chunks/signature-request-C-mskXwi.js +0 -318
  48. package/dist/_chunks/signature-request-C-mskXwi.js.map +0 -1
  49. package/dist/components/calendar/contrast-warning.d.ts +0 -20
  50. package/dist/components/calendar/contrast-warning.d.ts.map +0 -1
@@ -0,0 +1,341 @@
1
+ import { jsx as s, jsxs as i } from "react/jsx-runtime";
2
+ import { forwardRef as ne, useRef as C, useState as H, useEffect as te } from "react";
3
+ import { useTranslation as re } from "react-i18next";
4
+ import { D as u } from "./dialog-UbKJCi1X.js";
5
+ import { B as q } from "./button-CPGiR_bH.js";
6
+ import { I as ie } from "./icon-button-C_kbcd7I.js";
7
+ import { C as le } from "./checkbox-BuZ1u__2.js";
8
+ import { a as de } from "./whatsapp-button-BIy6NaJK.js";
9
+ import { S as L } from "./select-BW5ecXlX.js";
10
+ import { S as ce } from "./switch-OILsBLWo.js";
11
+ import { A as p } from "./alert-KJbsPYkI.js";
12
+ import { S as oe } from "./separator-CYU_bGFn.js";
13
+ import { A as F } from "./avatar-BNQNhoyL.js";
14
+ import { c as _ } from "./createLucideIcon-DhHxpK9K.js";
15
+ import { P as ue } from "./plus-DzMQ_c6b.js";
16
+ import { X as me } from "./x-B5YnXwCz.js";
17
+ import { P as he } from "./pen-line-D0De5zdl.js";
18
+ import { M as pe } from "./mail-BqXVF2zH.js";
19
+ /**
20
+ * @license lucide-react v1.22.0 - ISC
21
+ *
22
+ * This source code is licensed under the ISC license.
23
+ * See the LICENSE file in the root directory of this source tree.
24
+ */
25
+ const ge = [
26
+ [
27
+ "path",
28
+ {
29
+ d: "M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",
30
+ key: "18887p"
31
+ }
32
+ ],
33
+ ["path", { d: "M7 11h10", key: "1twpyw" }],
34
+ ["path", { d: "M7 15h6", key: "d9of3u" }],
35
+ ["path", { d: "M7 7h8", key: "af5zfr" }]
36
+ ], ve = _("message-square-text", ge);
37
+ /**
38
+ * @license lucide-react v1.22.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */
43
+ const fe = [
44
+ ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
45
+ ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
46
+ ], xe = _("tablet", fe);
47
+ /**
48
+ * @license lucide-react v1.22.0 - ISC
49
+ *
50
+ * This source code is licensed under the ISC license.
51
+ * See the LICENSE file in the root directory of this source tree.
52
+ */
53
+ const Re = [
54
+ ["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
55
+ ["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }],
56
+ ["line", { x1: "19", x2: "19", y1: "8", y2: "14", key: "1bvyxn" }],
57
+ ["line", { x1: "22", x2: "16", y1: "11", y2: "11", key: "1shjgl" }]
58
+ ], qe = _("user-plus", Re), g = "__assign-later__", V = [
59
+ "sms",
60
+ "email",
61
+ "whatsapp",
62
+ "on-device"
63
+ ];
64
+ function W(m, w) {
65
+ var o;
66
+ return ((o = m.find((c) => c.value === w)) == null ? void 0 : o.label) ?? "";
67
+ }
68
+ const we = ne(
69
+ ({
70
+ open: m,
71
+ onOpenChange: w,
72
+ operators: o,
73
+ signerOptions: c,
74
+ currentOperatorId: z,
75
+ allowAssignLater: N = !0,
76
+ initialOperatorId: M,
77
+ initialSigners: b,
78
+ maxSigners: G = 2,
79
+ busy: d = !1,
80
+ error: A,
81
+ title: U,
82
+ description: $,
83
+ onRequestSignature: X,
84
+ contentProps: J
85
+ }, K) => {
86
+ const { t: a } = re(), D = C(0), O = C(null), P = (e) => {
87
+ var r;
88
+ const n = (r = c.find(
89
+ (l) => l.value === e
90
+ )) == null ? void 0 : r.availableChannels;
91
+ return n && n.length > 0 ? V.filter((l) => n.includes(l)) : V;
92
+ }, y = (e, n) => {
93
+ const r = P(e);
94
+ return r.includes(n) ? n : r[0];
95
+ }, T = () => {
96
+ var e, n;
97
+ return M === null ? N ? g : ((e = o[0]) == null ? void 0 : e.value) ?? g : M ?? ((n = o[0]) == null ? void 0 : n.value) ?? (N ? g : "");
98
+ }, B = () => (b && b.length > 0 ? b : c.length > 0 ? [
99
+ {
100
+ signerId: c[0].value,
101
+ channel: y(c[0].value, "on-device")
102
+ }
103
+ ] : []).map((n) => ({ ...n, rowId: D.current++ })), [v, I] = H(T), [h, f] = H(B), j = C(m);
104
+ te(() => {
105
+ m && !j.current && (I(T()), f(B())), j.current = m;
106
+ }, [m]);
107
+ const Q = N ? [
108
+ ...o,
109
+ { value: g, label: a("signatureRequest.assignLater") }
110
+ ] : o, k = v === g, Y = {
111
+ sms: {
112
+ label: a("signatureRequest.viaSms"),
113
+ icon: /* @__PURE__ */ s(ve, { className: "ds:size-4", "aria-hidden": !0 })
114
+ },
115
+ email: {
116
+ label: a("signatureRequest.viaEmail"),
117
+ icon: /* @__PURE__ */ s(pe, { className: "ds:size-4", "aria-hidden": !0 })
118
+ },
119
+ whatsapp: {
120
+ label: a("signatureRequest.viaWhatsapp"),
121
+ icon: /* @__PURE__ */ s(de, { className: "ds:size-4", "aria-hidden": !0 })
122
+ },
123
+ "on-device": {
124
+ label: a("signatureRequest.onThisDevice"),
125
+ icon: /* @__PURE__ */ s(xe, { className: "ds:size-4", "aria-hidden": !0 })
126
+ }
127
+ }, E = h.map((e) => e.signerId), x = c.find(
128
+ (e) => !E.includes(e.value)
129
+ ), Z = !d && h.length < G && x !== void 0, S = (e, n) => {
130
+ f(
131
+ (r) => r.map(
132
+ (l) => l.rowId === e ? { ...l, ...n } : l
133
+ )
134
+ );
135
+ }, ee = () => {
136
+ x && f((e) => [
137
+ ...e,
138
+ {
139
+ signerId: x.value,
140
+ channel: y(x.value, "sms"),
141
+ rowId: D.current++
142
+ }
143
+ ]);
144
+ }, se = (e) => {
145
+ var n;
146
+ (n = O.current) == null || n.focus(), f(
147
+ (r) => r.filter((l) => l.rowId !== e)
148
+ );
149
+ }, ae = () => {
150
+ X({
151
+ operatorId: k ? null : v,
152
+ signers: h.map(({ rowId: e, ...n }) => n)
153
+ });
154
+ };
155
+ return /* @__PURE__ */ s("div", { ref: K, className: "ds:contents", "data-component": "signature-request", children: /* @__PURE__ */ s(u, { open: m, onOpenChange: w, children: /* @__PURE__ */ i(u.Content, { size: "lg", hideCloseButton: !0, ...J, children: [
156
+ /* @__PURE__ */ i(u.Header, { children: [
157
+ /* @__PURE__ */ s(u.Title, { children: U ?? a("signatureRequest.title") }),
158
+ /* @__PURE__ */ s(u.Description, { children: $ ?? a("signatureRequest.noSignedVersions") })
159
+ ] }),
160
+ /* @__PURE__ */ i(u.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
161
+ /* @__PURE__ */ i("section", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
162
+ /* @__PURE__ */ i("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
163
+ /* @__PURE__ */ s("p", { className: "type-eyebrow ds:text-start ds:text-[color:var(--muted-foreground)]", children: a("signatureRequest.operatorSection") }),
164
+ z !== void 0 ? /* @__PURE__ */ s(
165
+ q,
166
+ {
167
+ intent: "primary",
168
+ size: "sm",
169
+ startIcon: /* @__PURE__ */ s(qe, {}),
170
+ disabled: d,
171
+ onClick: () => I(z),
172
+ children: a("signatureRequest.assignToMe")
173
+ }
174
+ ) : null
175
+ ] }),
176
+ /* @__PURE__ */ i("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
177
+ /* @__PURE__ */ s(
178
+ F,
179
+ {
180
+ "aria-hidden": "true",
181
+ name: k ? void 0 : W(o, v),
182
+ size: "sm"
183
+ }
184
+ ),
185
+ /* @__PURE__ */ s("div", { className: "ds:min-w-0 ds:flex-1 ds:text-start", children: /* @__PURE__ */ s(
186
+ L,
187
+ {
188
+ options: Q,
189
+ value: v,
190
+ onValueChange: (e) => e && I(e),
191
+ required: !0,
192
+ disabled: d,
193
+ placeholder: a("signatureRequest.operatorPlaceholder"),
194
+ "aria-label": a("signatureRequest.operatorSection")
195
+ }
196
+ ) })
197
+ ] }),
198
+ k ? null : /* @__PURE__ */ s(p, { variant: "info", children: /* @__PURE__ */ s(p.Description, { children: a("signatureRequest.operatorHint") }) })
199
+ ] }),
200
+ /* @__PURE__ */ s(oe, { decorative: !0 }),
201
+ /* @__PURE__ */ i("section", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:text-start", children: [
202
+ /* @__PURE__ */ i("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
203
+ /* @__PURE__ */ s("p", { className: "type-eyebrow ds:text-[color:var(--muted-foreground)]", children: a("signatureRequest.signersSection") }),
204
+ /* @__PURE__ */ s(
205
+ q,
206
+ {
207
+ ref: O,
208
+ intent: "primary",
209
+ size: "sm",
210
+ startIcon: /* @__PURE__ */ s(ue, {}),
211
+ disabled: !Z,
212
+ onClick: ee,
213
+ children: a("signatureRequest.addSigner")
214
+ }
215
+ )
216
+ ] }),
217
+ h.map((e) => {
218
+ const n = c.filter(
219
+ (t) => t.value === e.signerId || !E.includes(t.value)
220
+ ), r = W(c, e.signerId), l = P(e.signerId).map(
221
+ (t) => ({ value: t, ...Y[t] })
222
+ );
223
+ return /* @__PURE__ */ i(
224
+ "div",
225
+ {
226
+ role: "group",
227
+ "aria-label": r,
228
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
229
+ children: [
230
+ /* @__PURE__ */ i("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
231
+ /* @__PURE__ */ s(F, { "aria-hidden": "true", name: r, size: "sm" }),
232
+ /* @__PURE__ */ s("div", { className: "ds:min-w-0 ds:flex-1", children: /* @__PURE__ */ s(
233
+ L,
234
+ {
235
+ options: n,
236
+ value: e.signerId,
237
+ onValueChange: (t) => {
238
+ if (!t) return;
239
+ const R = y(
240
+ t,
241
+ e.channel
242
+ );
243
+ S(e.rowId, {
244
+ signerId: t,
245
+ channel: R,
246
+ skipOtp: R === "on-device" ? e.skipOtp : void 0
247
+ });
248
+ },
249
+ required: !0,
250
+ disabled: d,
251
+ placeholder: a(
252
+ "signatureRequest.signerPlaceholder"
253
+ ),
254
+ "aria-label": a("signatureRequest.signerPlaceholder")
255
+ }
256
+ ) }),
257
+ h.length > 1 ? /* @__PURE__ */ s(
258
+ ie,
259
+ {
260
+ intent: "ghost",
261
+ size: "sm",
262
+ icon: /* @__PURE__ */ s(me, {}),
263
+ disabled: d,
264
+ "aria-label": a("signatureRequest.removeSigner"),
265
+ onClick: () => se(e.rowId)
266
+ }
267
+ ) : null
268
+ ] }),
269
+ /* @__PURE__ */ s(
270
+ "div",
271
+ {
272
+ role: "group",
273
+ "aria-label": a("signatureRequest.channelLabel"),
274
+ className: "ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-lg)] ds:gap-y-[var(--spacing-sm)] ds:ps-[var(--spacing-xl)]",
275
+ children: l.map((t) => /* @__PURE__ */ s(
276
+ le,
277
+ {
278
+ checked: e.channel === t.value,
279
+ disabled: d,
280
+ onCheckedChange: (R) => R === !0 && S(e.rowId, {
281
+ channel: t.value,
282
+ skipOtp: void 0
283
+ }),
284
+ label: /* @__PURE__ */ i("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
285
+ /* @__PURE__ */ s(
286
+ "span",
287
+ {
288
+ "aria-hidden": "true",
289
+ className: "ds:text-[var(--accent)]",
290
+ children: t.icon
291
+ }
292
+ ),
293
+ t.label
294
+ ] })
295
+ },
296
+ t.value
297
+ ))
298
+ }
299
+ ),
300
+ e.channel === "on-device" ? /* @__PURE__ */ s("div", { className: "ds:ps-[var(--spacing-xl)]", children: /* @__PURE__ */ s(
301
+ ce,
302
+ {
303
+ label: a("signatureRequest.noOtp"),
304
+ checked: e.skipOtp === !0,
305
+ disabled: d,
306
+ onCheckedChange: (t) => S(e.rowId, { skipOtp: t })
307
+ }
308
+ ) }) : null
309
+ ]
310
+ },
311
+ e.rowId
312
+ );
313
+ })
314
+ ] }),
315
+ h.some(
316
+ (e) => e.channel === "on-device" && e.skipOtp === !0
317
+ ) ? /* @__PURE__ */ s(p, { variant: "warning", children: /* @__PURE__ */ s(p.Description, { children: a("signatureRequest.noOtpWarning") }) }) : null,
318
+ A ? /* @__PURE__ */ s(p, { variant: "error", children: /* @__PURE__ */ s(p.Description, { children: A }) }) : null
319
+ ] }),
320
+ /* @__PURE__ */ i(u.Footer, { children: [
321
+ /* @__PURE__ */ s(
322
+ q,
323
+ {
324
+ intent: "primary",
325
+ startIcon: /* @__PURE__ */ s(he, {}),
326
+ onClick: ae,
327
+ disabled: d || h.length === 0,
328
+ loading: d,
329
+ children: a("signatureRequest.requestSignature")
330
+ }
331
+ ),
332
+ /* @__PURE__ */ s(u.Close, { asChild: !0, children: /* @__PURE__ */ s(q, { intent: "outline", disabled: d, children: a("signatureRequest.close") }) })
333
+ ] })
334
+ ] }) }) });
335
+ }
336
+ );
337
+ we.displayName = "SignatureRequestModal";
338
+ export {
339
+ we as S
340
+ };
341
+ //# sourceMappingURL=signature-request-CEOrCDyk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signature-request-CEOrCDyk.js","sources":["../../node_modules/lucide-react/dist/esm/icons/message-square-text.mjs","../../node_modules/lucide-react/dist/esm/icons/tablet.mjs","../../node_modules/lucide-react/dist/esm/icons/user-plus.mjs","../../src/patterns/signature-request/signature-request.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z\",\n key: \"18887p\"\n }\n ],\n [\"path\", { d: \"M7 11h10\", key: \"1twpyw\" }],\n [\"path\", { d: \"M7 15h6\", key: \"d9of3u\" }],\n [\"path\", { d: \"M7 7h8\", key: \"af5zfr\" }]\n];\nconst MessageSquareText = createLucideIcon(\"message-square-text\", __iconNode);\n\nexport { __iconNode, MessageSquareText as default };\n//# sourceMappingURL=message-square-text.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"rect\", { width: \"16\", height: \"20\", x: \"4\", y: \"2\", rx: \"2\", ry: \"2\", key: \"76otgf\" }],\n [\"line\", { x1: \"12\", x2: \"12.01\", y1: \"18\", y2: \"18\", key: \"1dp563\" }]\n];\nconst Tablet = createLucideIcon(\"tablet\", __iconNode);\n\nexport { __iconNode, Tablet as default };\n//# sourceMappingURL=tablet.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\", key: \"1yyitq\" }],\n [\"circle\", { cx: \"9\", cy: \"7\", r: \"4\", key: \"nufk8\" }],\n [\"line\", { x1: \"19\", x2: \"19\", y1: \"8\", y2: \"14\", key: \"1bvyxn\" }],\n [\"line\", { x1: \"22\", x2: \"16\", y1: \"11\", y2: \"11\", key: \"1shjgl\" }]\n];\nconst UserPlus = createLucideIcon(\"user-plus\", __iconNode);\n\nexport { __iconNode, UserPlus as default };\n//# sourceMappingURL=user-plus.mjs.map\n","/**\n * SignatureRequestModal — the practice-side \"Documenti firmati\" modal that\n * dispatches a document-signature request: assign the operator who must\n * counter-sign (or leave the request unassigned), build the patient-side\n * signer roster (up to `maxSigners`, each with their own delivery channel\n * and, for on-device signing, an OTP waiver), and send.\n *\n * Runtime pattern: real consuming apps mount this in production (surfaced via\n * `src/patterns/index.ts` and the `./patterns/signature-request` subpath).\n * The component owns the form state — re-seeded from the `initial*` props\n * every time `open` flips back to `true` — while the host owns `open`, the\n * option lists, and what happens on submit. Multiple on-device signers sign\n * sequentially in roster order — the execution side is the Signing pattern's\n * multi-signer flow; this modal only encodes the intents.\n */\nimport {\n forwardRef,\n useEffect,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n Mail,\n MessageSquareText,\n PenLine,\n Plus,\n Tablet,\n UserPlus,\n X,\n} from 'lucide-react';\nimport { Dialog } from '../../components/dialog';\nimport { Button } from '../../components/button';\nimport { IconButton } from '../../components/icon-button';\nimport { Checkbox } from '../../components/checkbox';\nimport { WhatsAppGlyph } from '../../components/whatsapp-button';\nimport { Select } from '../../components/select';\nimport { Switch } from '../../components/switch';\nimport { Alert } from '../../components/alert';\nimport { Separator } from '../../components/separator';\nimport { Avatar } from '../../components/avatar';\n\n/** Delivery channel for one signer's signature request. */\nexport type SignatureChannel = 'sms' | 'email' | 'whatsapp' | 'on-device';\n\n/** One selectable person/role for the operator or signer selects. */\nexport interface SignerOption {\n value: string;\n label: string;\n /**\n * Delivery channels this person can actually receive. Omit (or pass an\n * empty list) to offer every channel. Hosts gate this from per-patient\n * capability flags — e.g. a patient with no mobile number drops `'sms'`\n * and `'whatsapp'`. Only meaningful for signer options, not operators.\n */\n availableChannels?: SignatureChannel[];\n}\n\n/** One patient-side signer row in the submission. */\nexport interface SignerRequest {\n signerId: string;\n channel: SignatureChannel;\n /** Only meaningful when `channel` is `'on-device'`. */\n skipOtp?: boolean;\n}\n\n/** Payload handed to `onRequestSignature`. */\nexport interface SignatureRequestSubmission {\n /** `null` when the counter-signing operator is left unassigned. */\n operatorId: string | null;\n /** 1..N signers; on-device signers sign sequentially in this order. */\n signers: SignerRequest[];\n}\n\nexport interface SignatureRequestModalProps {\n /** Controlled open state. Reopening re-seeds the form from `initial*`. */\n open: boolean;\n /**\n * Fires when the dialog requests a state change (<kbd>Esc</kbd> or the\n * footer Close button). `false` is the dismiss signal — hosts typically\n * persist a \"dismissed this session\" flag there.\n */\n onOpenChange: (open: boolean) => void;\n /** Operators offered as the counter-signing signer. */\n operators: SignerOption[];\n /** Patient-side people/roles offered in each signer row. */\n signerOptions: SignerOption[];\n /** Enables the \"Assign to me\" shortcut targeting this operator. */\n currentOperatorId?: string;\n /** Offer an \"Assign later\" option in the operator select. Default `true`. */\n allowAssignLater?: boolean;\n /**\n * Preselected operator; `null` preselects \"Assign later\" (honoured only\n * while `allowAssignLater` — otherwise the first operator is seeded).\n */\n initialOperatorId?: string | null;\n /** Seed the signer roster. Defaults to the first option, on-device. */\n initialSigners?: SignerRequest[];\n /** Cap on roster size. Default `2`. */\n maxSigners?: number;\n /** Disables all inputs and shows the primary action as loading. */\n busy?: boolean;\n /** Consumer-translated error shown above the footer (e.g. server failure). */\n error?: string;\n /** Override the dialog title. Defaults to the `ui.*` string. */\n title?: string;\n /** Override the dialog description. Defaults to the `ui.*` string. */\n description?: string;\n /** Receives the completed submission. The host closes via `onOpenChange`. */\n onRequestSignature: (submission: SignatureRequestSubmission) => void;\n /**\n * Extra attributes for the portaled dialog surface (e.g. `dir`/`lang`\n * when the host pins a locale below `<html>`, or a test id).\n */\n contentProps?: ComponentPropsWithoutRef<'div'>;\n}\n\nconst ASSIGN_LATER = '__assign-later__';\n\n/** Canonical channel display order; per-signer availability filters this. */\nconst CHANNEL_ORDER: SignatureChannel[] = [\n 'sms',\n 'email',\n 'whatsapp',\n 'on-device',\n];\n\n/** Internal roster row — `rowId` keys the DOM so editing a row's person\n * never remounts the row (which would drop keyboard focus). */\ninterface RosterRow extends SignerRequest {\n rowId: number;\n}\n\nfunction labelFor(options: SignerOption[], value: string): string {\n return options.find((option) => option.value === value)?.label ?? '';\n}\n\nexport const SignatureRequestModal = forwardRef<\n HTMLDivElement,\n SignatureRequestModalProps\n>(\n (\n {\n open,\n onOpenChange,\n operators,\n signerOptions,\n currentOperatorId,\n allowAssignLater = true,\n initialOperatorId,\n initialSigners,\n maxSigners = 2,\n busy = false,\n error,\n title,\n description,\n onRequestSignature,\n contentProps,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n\n const nextRowId = useRef(0);\n const addButtonRef = useRef<HTMLButtonElement>(null);\n\n // Channels a given signer can receive on — the person's `availableChannels`\n // filtered into canonical order; omitted/empty means every channel.\n const channelsFor = (signerId: string): SignatureChannel[] => {\n const allowed = signerOptions.find(\n (option) => option.value === signerId,\n )?.availableChannels;\n return allowed && allowed.length > 0\n ? CHANNEL_ORDER.filter((channel) => allowed.includes(channel))\n : CHANNEL_ORDER;\n };\n\n // First available channel for a signer, preferring `preferred` when offered.\n const resolveChannel = (\n signerId: string,\n preferred: SignatureChannel,\n ): SignatureChannel => {\n const available = channelsFor(signerId);\n return available.includes(preferred) ? preferred : available[0];\n };\n\n const seedOperator = () => {\n if (initialOperatorId === null) {\n return allowAssignLater\n ? ASSIGN_LATER\n : (operators[0]?.value ?? ASSIGN_LATER);\n }\n return (\n initialOperatorId ??\n operators[0]?.value ??\n (allowAssignLater ? ASSIGN_LATER : '')\n );\n };\n const seedRows = (): RosterRow[] => {\n const seed =\n initialSigners && initialSigners.length > 0\n ? initialSigners\n : signerOptions.length > 0\n ? [\n {\n signerId: signerOptions[0].value,\n channel: resolveChannel(signerOptions[0].value, 'on-device'),\n },\n ]\n : [];\n return seed.map((signer) => ({ ...signer, rowId: nextRowId.current++ }));\n };\n\n const [operator, setOperator] = useState<string>(seedOperator);\n const [signers, setSigners] = useState<RosterRow[]>(seedRows);\n\n // Re-seed the form whenever the host reopens the (still-mounted) modal,\n // so a previous request's choices never leak into the next one.\n const wasOpen = useRef(open);\n useEffect(() => {\n if (open && !wasOpen.current) {\n setOperator(seedOperator());\n setSigners(seedRows());\n }\n wasOpen.current = open;\n // The seeds intentionally read the render-time props on the rising\n // edge only — prop changes while open (or closed) don't reset input.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open]);\n\n const operatorSelectOptions = allowAssignLater\n ? [\n ...operators,\n { value: ASSIGN_LATER, label: t('signatureRequest.assignLater') },\n ]\n : operators;\n const isUnassigned = operator === ASSIGN_LATER;\n\n const channelMeta: Record<\n SignatureChannel,\n { label: string; icon: React.ReactNode }\n > = {\n sms: {\n label: t('signatureRequest.viaSms'),\n icon: <MessageSquareText className=\"ds:size-4\" aria-hidden />,\n },\n email: {\n label: t('signatureRequest.viaEmail'),\n icon: <Mail className=\"ds:size-4\" aria-hidden />,\n },\n whatsapp: {\n label: t('signatureRequest.viaWhatsapp'),\n icon: <WhatsAppGlyph className=\"ds:size-4\" aria-hidden />,\n },\n 'on-device': {\n label: t('signatureRequest.onThisDevice'),\n icon: <Tablet className=\"ds:size-4\" aria-hidden />,\n },\n };\n\n const chosenIds = signers.map((signer) => signer.signerId);\n const nextFreeOption = signerOptions.find(\n (option) => !chosenIds.includes(option.value),\n );\n const canAddSigner =\n !busy && signers.length < maxSigners && nextFreeOption !== undefined;\n\n const patchSigner = (rowId: number, patch: Partial<SignerRequest>) => {\n setSigners((current) =>\n current.map((signer) =>\n signer.rowId === rowId ? { ...signer, ...patch } : signer,\n ),\n );\n };\n\n const addSigner = () => {\n if (!nextFreeOption) return;\n setSigners((current) => [\n ...current,\n {\n signerId: nextFreeOption.value,\n channel: resolveChannel(nextFreeOption.value, 'sms'),\n rowId: nextRowId.current++,\n },\n ]);\n };\n\n const removeSigner = (rowId: number) => {\n // Move focus BEFORE the row (and the focused remove button) unmounts —\n // otherwise Radix's focus scope dumps focus on the dialog container.\n addButtonRef.current?.focus();\n setSigners((current) =>\n current.filter((signer) => signer.rowId !== rowId),\n );\n };\n\n const handleRequest = () => {\n onRequestSignature({\n operatorId: isUnassigned ? null : operator,\n signers: signers.map(({ rowId: _rowId, ...signer }) => signer),\n });\n };\n\n return (\n <div ref={ref} className=\"ds:contents\" data-component=\"signature-request\">\n <Dialog open={open} onOpenChange={onOpenChange}>\n <Dialog.Content size=\"lg\" hideCloseButton {...contentProps}>\n <Dialog.Header>\n <Dialog.Title>\n {title ?? t('signatureRequest.title')}\n </Dialog.Title>\n <Dialog.Description>\n {description ?? t('signatureRequest.noSignedVersions')}\n </Dialog.Description>\n </Dialog.Header>\n\n <Dialog.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <section className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]\">\n <p className=\"type-eyebrow ds:text-start ds:text-[color:var(--muted-foreground)]\">\n {t('signatureRequest.operatorSection')}\n </p>\n {currentOperatorId !== undefined ? (\n <Button\n intent=\"primary\"\n size=\"sm\"\n startIcon={<UserPlus />}\n disabled={busy}\n onClick={() => setOperator(currentOperatorId)}\n >\n {t('signatureRequest.assignToMe')}\n </Button>\n ) : null}\n </div>\n\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n {/* Mirrors the select value — decorative for AT. No name →\n Avatar's built-in placeholder-icon fallback. */}\n <Avatar\n aria-hidden=\"true\"\n name={\n isUnassigned ? undefined : labelFor(operators, operator)\n }\n size=\"sm\"\n />\n <div className=\"ds:min-w-0 ds:flex-1 ds:text-start\">\n <Select\n options={operatorSelectOptions}\n value={operator}\n onValueChange={(value) => value && setOperator(value)}\n required\n disabled={busy}\n placeholder={t('signatureRequest.operatorPlaceholder')}\n aria-label={t('signatureRequest.operatorSection')}\n />\n </div>\n </div>\n\n {isUnassigned ? null : (\n <Alert variant=\"info\">\n <Alert.Description>\n {t('signatureRequest.operatorHint')}\n </Alert.Description>\n </Alert>\n )}\n </section>\n\n <Separator decorative />\n\n <section className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:text-start\">\n <div className=\"ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]\">\n <p className=\"type-eyebrow ds:text-[color:var(--muted-foreground)]\">\n {t('signatureRequest.signersSection')}\n </p>\n <Button\n ref={addButtonRef}\n intent=\"primary\"\n size=\"sm\"\n startIcon={<Plus />}\n disabled={!canAddSigner}\n onClick={addSigner}\n >\n {t('signatureRequest.addSigner')}\n </Button>\n </div>\n\n {signers.map((signer) => {\n const rowOptions = signerOptions.filter(\n (option) =>\n option.value === signer.signerId ||\n !chosenIds.includes(option.value),\n );\n const rowLabel = labelFor(signerOptions, signer.signerId);\n const rowChannelOptions = channelsFor(signer.signerId).map(\n (channel) => ({ value: channel, ...channelMeta[channel] }),\n );\n return (\n <div\n key={signer.rowId}\n role=\"group\"\n aria-label={rowLabel}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\"\n >\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n {/* Mirrors the select value — decorative for AT. */}\n <Avatar aria-hidden=\"true\" name={rowLabel} size=\"sm\" />\n <div className=\"ds:min-w-0 ds:flex-1\">\n <Select\n options={rowOptions}\n value={signer.signerId}\n onValueChange={(value) => {\n if (!value) return;\n const channel = resolveChannel(\n value,\n signer.channel,\n );\n patchSigner(signer.rowId, {\n signerId: value,\n channel,\n skipOtp:\n channel === 'on-device'\n ? signer.skipOtp\n : undefined,\n });\n }}\n required\n disabled={busy}\n placeholder={t(\n 'signatureRequest.signerPlaceholder',\n )}\n aria-label={t('signatureRequest.signerPlaceholder')}\n />\n </div>\n {signers.length > 1 ? (\n <IconButton\n intent=\"ghost\"\n size=\"sm\"\n icon={<X />}\n disabled={busy}\n aria-label={t('signatureRequest.removeSigner')}\n onClick={() => removeSigner(signer.rowId)}\n />\n ) : null}\n </div>\n\n {/* One channel per signer — checkbox visuals, but the\n choice is mutually exclusive: checking a channel\n unchecks the others, and the active one can't be\n unchecked. */}\n <div\n role=\"group\"\n aria-label={t('signatureRequest.channelLabel')}\n className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-lg)] ds:gap-y-[var(--spacing-sm)] ds:ps-[var(--spacing-xl)]\"\n >\n {rowChannelOptions.map((option) => (\n <Checkbox\n key={option.value}\n checked={signer.channel === option.value}\n disabled={busy}\n onCheckedChange={(checked) =>\n checked === true &&\n patchSigner(signer.rowId, {\n channel: option.value,\n skipOtp: undefined,\n })\n }\n label={\n <span className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n <span\n aria-hidden=\"true\"\n className=\"ds:text-[var(--accent)]\"\n >\n {option.icon}\n </span>\n {option.label}\n </span>\n }\n />\n ))}\n </div>\n\n {signer.channel === 'on-device' ? (\n <div className=\"ds:ps-[var(--spacing-xl)]\">\n <Switch\n label={t('signatureRequest.noOtp')}\n checked={signer.skipOtp === true}\n disabled={busy}\n onCheckedChange={(checked) =>\n patchSigner(signer.rowId, { skipOtp: checked })\n }\n />\n </div>\n ) : null}\n </div>\n );\n })}\n </section>\n\n {/* Dedicated alert area — one warning regardless of how many\n signers waive OTP, stacked with any submission error, all at\n the same full width as the operator hint. */}\n {signers.some(\n (signer) =>\n signer.channel === 'on-device' && signer.skipOtp === true,\n ) ? (\n <Alert variant=\"warning\">\n <Alert.Description>\n {t('signatureRequest.noOtpWarning')}\n </Alert.Description>\n </Alert>\n ) : null}\n {error ? (\n <Alert variant=\"error\">\n <Alert.Description>{error}</Alert.Description>\n </Alert>\n ) : null}\n </Dialog.Body>\n\n <Dialog.Footer>\n <Button\n intent=\"primary\"\n startIcon={<PenLine />}\n onClick={handleRequest}\n disabled={busy || signers.length === 0}\n loading={busy}\n >\n {t('signatureRequest.requestSignature')}\n </Button>\n <Dialog.Close asChild>\n <Button intent=\"outline\" disabled={busy}>\n {t('signatureRequest.close')}\n </Button>\n </Dialog.Close>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n </div>\n );\n },\n);\nSignatureRequestModal.displayName = 'SignatureRequestModal';\n"],"names":["__iconNode","MessageSquareText","createLucideIcon","Tablet","UserPlus","ASSIGN_LATER","CHANNEL_ORDER","labelFor","options","value","_a","option","SignatureRequestModal","forwardRef","open","onOpenChange","operators","signerOptions","currentOperatorId","allowAssignLater","initialOperatorId","initialSigners","maxSigners","busy","error","title","description","onRequestSignature","contentProps","ref","t","useTranslation","nextRowId","useRef","addButtonRef","channelsFor","signerId","allowed","channel","resolveChannel","preferred","available","seedOperator","_b","seedRows","signer","operator","setOperator","useState","signers","setSigners","wasOpen","useEffect","operatorSelectOptions","isUnassigned","channelMeta","jsx","Mail","WhatsAppGlyph","chosenIds","nextFreeOption","canAddSigner","patchSigner","rowId","patch","current","addSigner","removeSigner","handleRequest","_rowId","Dialog","jsxs","Button","Avatar","Select","Alert","Separator","Plus","rowOptions","rowLabel","rowChann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,UAAA,gBAAAnB,EAACmB,EAAM,aAAN,EAAmB,UAAAnD,EAAA,CAAM,EAAA,CAC5B,IACE;AAAA,MAAA,GACN;AAAA,MAEA,gBAAA+C,EAACD,EAAO,QAAP,EACC,UAAA;AAAA,QAAA,gBAAAd;AAAA,UAACgB;AAAA,UAAA;AAAA,YACC,QAAO;AAAA,YACP,6BAAYc,IAAA,EAAQ;AAAA,YACpB,SAASlB;AAAA,YACT,UAAU7C,KAAQ0B,EAAQ,WAAW;AAAA,YACrC,SAAS1B;AAAA,YAER,YAAE,mCAAmC;AAAA,UAAA;AAAA,QAAA;AAAA,QAExC,gBAAAiC,EAACc,EAAO,OAAP,EAAa,SAAO,IACnB,UAAA,gBAAAd,EAACgB,GAAA,EAAO,QAAO,WAAU,UAAUjD,GAChC,UAAAO,EAAE,wBAAwB,GAC7B,EAAA,CACF;AAAA,MAAA,EAAA,CACF;AAAA,IAAA,EAAA,CACF,GACF,GACF;AAAA,EAEJ;AACF;AACAlB,GAAsB,cAAc;","x_google_ignoreList":[0,1,2]}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.78.0",
3
+ "packageVersion": "0.80.0",
4
4
  "components": [
5
5
  {
6
6
  "kind": "component",
@@ -0,0 +1,46 @@
1
+ /** Reset the dedup set — intended for use between tests. */
2
+ export declare function resetContrastWarnings(): void;
3
+ /**
4
+ * DEV-only WCAG AA guardrail for caller-supplied hex pairs.
5
+ *
6
+ * - No-op when `import.meta.env.DEV` is false.
7
+ * - No-op when either half of the pair is missing (the "fg missing →
8
+ * inherits DS token" case is a docs concern; the DS token isn't a
9
+ * hex at runtime so we can't check it here).
10
+ * - No-op when either hex can't be parsed (silent — not the helper's
11
+ * concern to police malformed input).
12
+ * - Deduplicated by `(bgHex, fgHex, contextLabel)` tuple so moving a
13
+ * ratio-bad event around the calendar doesn't spam the console.
14
+ *
15
+ * @param bgHex - Caller-supplied background hex (e.g. `'#c2185b'`)
16
+ * @param fgHex - Caller-supplied foreground hex (e.g. `'#ffffff'`)
17
+ * @param contextLabel - Short description for the warning (e.g. `'event e1'`).
18
+ */
19
+ export declare function warnLowContrast(bgHex: string | undefined, fgHex: string | undefined, contextLabel: string): void;
20
+ export type EventInk = 'on-light' | 'on-dark';
21
+ /**
22
+ * Pick the ink for an arbitrary opaque bg hex. Returns `null` when the
23
+ * input can't be parsed (`#rgb` / `#rrggbb` only).
24
+ *
25
+ * The threshold 0.1791 is the relative luminance at which
26
+ * `contrast(bg, #fff) === contrast(bg, #000)`; the better of the two
27
+ * always yields ≥ 4.58:1 (the minimum, at a mid-grey ≈ `#757575`) —
28
+ * provably WCAG AA-safe for any opaque background.
29
+ */
30
+ export declare function resolveInk(bgHex: string): EventInk | null;
31
+ /**
32
+ * DEV-only, one-shot warning for a caller `backgroundColor` the kit can't
33
+ * parse (`rgb(…)`, keywords, malformed hex). The browser can still paint
34
+ * it, but the text falls back to the token default and contrast can't be
35
+ * verified. Deduplicated by `(bgHex, contextLabel)`.
36
+ */
37
+ export declare function warnUnparseableBackground(bgHex: string, contextLabel: string): void;
38
+ /**
39
+ * DEV-only, one-shot warning for a near-white `backgroundColor`
40
+ * (relative luminance > 0.9) supplied without a `borderColor` — the
41
+ * event may be invisible against the calendar grid. The kit warns, it
42
+ * does not repaint (delineation is decorative under WCAG 1.4.11 and the
43
+ * consumer owns the picker colour). Deduplicated by `(bgHex, contextLabel)`.
44
+ */
45
+ export declare function warnLowDelineation(bgHex: string, contextLabel: string): void;
46
+ //# sourceMappingURL=contrast-warning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contrast-warning.d.ts","sourceRoot":"","sources":["../../../src/components/_shared/contrast-warning.ts"],"names":[],"mappings":"AAqBA,4DAA4D;AAC5D,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AA0DD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,YAAY,EAAE,MAAM,GACnB,IAAI,CAuBN;AAMD,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAE9C;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAKzD;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,GACnB,IAAI,CAaN;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAgB5E"}