@alfadocs/ui-kit 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 (28) 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/{fiscal-code-input-DWA6C8x8.js → fiscal-code-input-QP9gkyDE.js} +2 -2
  6. package/dist/_chunks/{patient-details-zy76MRh7.js → patient-details-COvYWp2e.js} +2 -2
  7. package/dist/_chunks/signature-request-CEOrCDyk.js +341 -0
  8. package/dist/agent-catalog.json +1 -1
  9. package/dist/components/_shared/contrast-warning.d.ts +46 -0
  10. package/dist/components/calendar/calendar.d.ts +284 -7
  11. package/dist/components/calendar/index.d.ts +1 -1
  12. package/dist/components/calendar/index.js +1 -1
  13. package/dist/components/calendar-event-card/calendar-event-card.d.ts +103 -0
  14. package/dist/components/calendar-event-card/index.d.ts +3 -0
  15. package/dist/components/calendar-event-card/index.js +5 -0
  16. package/dist/components/chat-input/index.js +1 -1
  17. package/dist/components/fiscal-code-input/index.js +1 -1
  18. package/dist/components/index.d.ts +1 -0
  19. package/dist/components/patient-details/index.js +1 -1
  20. package/dist/index.js +252 -250
  21. package/dist/patterns/alia-assistant/index.js +1 -1
  22. package/dist/patterns/signature-request/index.js +1 -1
  23. package/dist/patterns/signature-request/signature-request.d.ts +7 -0
  24. package/dist/tokens.css +8 -5
  25. package/package.json +5 -1
  26. package/dist/_chunks/calendar-DeAlFPsF.js +0 -1050
  27. package/dist/_chunks/signature-request-C-mskXwi.js +0 -318
  28. package/dist/components/calendar/contrast-warning.d.ts +0 -20
@@ -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
@@ -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