@alfadocs/ui-kit 1.3.6 → 1.3.7

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.
@@ -2247,19 +2247,30 @@ function xt({
2247
2247
  ]
2248
2248
  }
2249
2249
  ) : null,
2250
- T ? /* @__PURE__ */ t(
2251
- X,
2252
- {
2253
- ref: S,
2254
- id: v,
2255
- intent: E ? "primary" : "outline",
2256
- "data-testid": "anamnesis-compare-toggle",
2257
- "aria-pressed": E,
2258
- "aria-expanded": E,
2259
- "aria-controls": C,
2260
- onClick: () => R(($) => !$),
2261
- children: a(E ? "anamnesis.compare.stop" : "anamnesis.compare.start")
2262
- }
2250
+ T ? (
2251
+ // The picker beside it is a FormField — label, control, then
2252
+ // description. A bare button in an `items-start` row top-aligns
2253
+ // with that LABEL and reads as floating above the control it acts
2254
+ // on, so reserve one label line above it. Sized from the same type
2255
+ // token as the real label, so it tracks the accessible theme's
2256
+ // larger type instead of a hardcoded offset.
2257
+ /* @__PURE__ */ d("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
2258
+ /* @__PURE__ */ t("span", { "aria-hidden": "true", className: "type-label ds:invisible", children: " " }),
2259
+ /* @__PURE__ */ t(
2260
+ X,
2261
+ {
2262
+ ref: S,
2263
+ id: v,
2264
+ intent: E ? "primary" : "outline",
2265
+ "data-testid": "anamnesis-compare-toggle",
2266
+ "aria-pressed": E,
2267
+ "aria-expanded": E,
2268
+ "aria-controls": C,
2269
+ onClick: () => R(($) => !$),
2270
+ children: a(E ? "anamnesis.compare.stop" : "anamnesis.compare.start")
2271
+ }
2272
+ )
2273
+ ] })
2263
2274
  ) : null
2264
2275
  ]
2265
2276
  }
@@ -8859,4 +8870,4 @@ export {
8859
8870
  rl as r,
8860
8871
  il as s
8861
8872
  };
8862
- //# sourceMappingURL=anamnesis-i18n-DqRbWU2L.js.map
8873
+ //# sourceMappingURL=anamnesis-i18n-S0cCfFg9.js.map
@@ -0,0 +1,417 @@
1
+ import { jsx as s, jsxs as r } from "react/jsx-runtime";
2
+ import { forwardRef as ge, useRef as j, useState as y, useEffect as Q } from "react";
3
+ import { useTranslation as fe } from "react-i18next";
4
+ import { D as m } from "./dialog-UbKJCi1X.js";
5
+ import { B as z } from "./button-CPGiR_bH.js";
6
+ import { I as xe } from "./icon-button-C_kbcd7I.js";
7
+ import { C as Y } from "./checkbox-BuZ1u__2.js";
8
+ import { a as Re } from "./whatsapp-button-BIy6NaJK.js";
9
+ import { S as Z } from "./select-BW5ecXlX.js";
10
+ import { S as be } from "./switch-OILsBLWo.js";
11
+ import { A as _ } from "./alert-CiJT540z.js";
12
+ import { I as Ne } from "./info-tip-Bxk3w6UM.js";
13
+ import { S as we } from "./separator-CYU_bGFn.js";
14
+ import { A as ee } from "./avatar-BNQNhoyL.js";
15
+ import { c as ne } from "./createLucideIcon-DhHxpK9K.js";
16
+ import { P as Ce } from "./plus-DzMQ_c6b.js";
17
+ import { X as Ie } from "./x-B5YnXwCz.js";
18
+ import { P as Se } from "./pen-line-D0De5zdl.js";
19
+ import { M as ke } from "./mail-BqXVF2zH.js";
20
+ import { M as qe } from "./message-square-Bye4ATvx.js";
21
+ /**
22
+ * @license lucide-react v1.22.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */
27
+ const ye = [
28
+ ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
29
+ ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
30
+ ], ze = ne("tablet", ye);
31
+ /**
32
+ * @license lucide-react v1.22.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */
37
+ const _e = [
38
+ ["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
39
+ ["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }],
40
+ ["line", { x1: "19", x2: "19", y1: "8", y2: "14", key: "1bvyxn" }],
41
+ ["line", { x1: "22", x2: "16", y1: "11", y2: "11", key: "1shjgl" }]
42
+ ], De = ne("user-plus", _e), v = "__assign-later__", se = [
43
+ "sms",
44
+ "email",
45
+ "whatsapp",
46
+ "on-device"
47
+ ];
48
+ function ae(h, D) {
49
+ var c;
50
+ return ((c = h.find((o) => o.value === D)) == null ? void 0 : c.label) ?? "";
51
+ }
52
+ const Me = ge(
53
+ ({
54
+ open: h,
55
+ onOpenChange: D,
56
+ operators: c,
57
+ signerOptions: o,
58
+ currentOperatorId: M,
59
+ allowAssignLater: T = !0,
60
+ requireOperator: g = !0,
61
+ requirePatient: f = !0,
62
+ initialOperatorId: E,
63
+ initialOperatorChannel: F,
64
+ initialSigners: A,
65
+ maxSigners: le = 2,
66
+ busy: i = !1,
67
+ error: H,
68
+ title: te,
69
+ description: re,
70
+ onRequestSignature: ie,
71
+ contentProps: de
72
+ }, ce) => {
73
+ const { t: n } = fe(), P = j(0), U = j(null), V = (e) => {
74
+ var t;
75
+ const a = (t = o.find(
76
+ (d) => d.value === e
77
+ )) == null ? void 0 : t.availableChannels;
78
+ return a && a.length > 0 ? se.filter((d) => a.includes(d)) : se;
79
+ }, O = (e, a) => {
80
+ const t = V(e);
81
+ return t.includes(a) ? a : t[0];
82
+ }, W = () => {
83
+ var e, a;
84
+ return E === null ? T ? v : ((e = c[0]) == null ? void 0 : e.value) ?? v : E ?? ((a = c[0]) == null ? void 0 : a.value) ?? (T ? v : "");
85
+ }, G = () => (A && A.length > 0 ? A : o.length > 0 ? [
86
+ {
87
+ signerId: o[0].value,
88
+ channel: O(o[0].value, "on-device")
89
+ }
90
+ ] : []).map((a) => ({ ...a, rowId: P.current++ })), x = (e) => {
91
+ var a;
92
+ return ((a = c.find((t) => t.value === e)) == null ? void 0 : a.defaultChannel) ?? "email";
93
+ }, X = (e, a) => F === "on-device" ? a.some((t) => t.channel === "on-device") ? "on-device" : x(e) : F ?? x(e), [p, B] = y(W), [u, w] = y(G), [C, R] = y(
94
+ () => X(p, u)
95
+ ), [$, b] = y(null), J = j(h);
96
+ Q(() => {
97
+ if (h && !J.current) {
98
+ const e = W(), a = G();
99
+ B(e), w(a), R(X(e, a)), b(null);
100
+ }
101
+ J.current = h;
102
+ }, [h]);
103
+ const I = u.some(
104
+ (e) => e.channel === "on-device"
105
+ );
106
+ Q(() => {
107
+ if (C === "on-device" && !I) {
108
+ const e = x(p);
109
+ R(e), b(e);
110
+ }
111
+ }, [C, I, p]);
112
+ const oe = T ? [
113
+ ...c,
114
+ { value: v, label: n("signatureRequest.assignLater") }
115
+ ] : c, S = p === v, N = {
116
+ sms: {
117
+ label: n("signatureRequest.viaSms"),
118
+ icon: /* @__PURE__ */ s(qe, { className: "ds:size-4", "aria-hidden": !0 })
119
+ },
120
+ email: {
121
+ label: n("signatureRequest.viaEmail"),
122
+ icon: /* @__PURE__ */ s(ke, { className: "ds:size-4", "aria-hidden": !0 })
123
+ },
124
+ whatsapp: {
125
+ label: n("signatureRequest.viaWhatsapp"),
126
+ icon: /* @__PURE__ */ s(Re, { className: "ds:size-4", "aria-hidden": !0 })
127
+ },
128
+ "on-device": {
129
+ label: n("signatureRequest.onThisDevice"),
130
+ icon: /* @__PURE__ */ s(ze, { className: "ds:size-4", "aria-hidden": !0 })
131
+ }
132
+ }, ue = [
133
+ { value: "sms", ...N.sms },
134
+ { value: "email", ...N.email },
135
+ {
136
+ value: "on-device",
137
+ ...N["on-device"],
138
+ disabled: !I,
139
+ hint: I ? void 0 : n("signatureRequest.onDeviceUnavailableHint")
140
+ }
141
+ ], K = u.map((e) => e.signerId), k = o.find(
142
+ (e) => !K.includes(e.value)
143
+ ), me = !i && u.length < le && k !== void 0, L = (e, a) => {
144
+ w(
145
+ (t) => t.map(
146
+ (d) => d.rowId === e ? { ...d, ...a } : d
147
+ )
148
+ );
149
+ }, he = () => {
150
+ k && w((e) => [
151
+ ...e,
152
+ {
153
+ signerId: k.value,
154
+ channel: O(k.value, "sms"),
155
+ rowId: P.current++
156
+ }
157
+ ]);
158
+ }, pe = (e) => {
159
+ var a;
160
+ (a = U.current) == null || a.focus(), w(
161
+ (t) => t.filter((d) => d.rowId !== e)
162
+ );
163
+ }, ve = () => {
164
+ ie({
165
+ operatorId: !g || S ? null : p,
166
+ operatorChannel: !g || S ? null : C,
167
+ signers: f ? u.map(({ rowId: e, ...a }) => a) : []
168
+ });
169
+ };
170
+ return /* @__PURE__ */ s("div", { ref: ce, className: "ds:contents", "data-component": "signature-request", children: /* @__PURE__ */ s(m, { open: h, onOpenChange: D, children: /* @__PURE__ */ r(m.Content, { size: "lg", hideCloseButton: !0, ...de, children: [
171
+ /* @__PURE__ */ r(m.Header, { children: [
172
+ /* @__PURE__ */ s(m.Title, { children: te ?? n("signatureRequest.title") }),
173
+ /* @__PURE__ */ s(m.Description, { children: re ?? n("signatureRequest.noSignedVersions") })
174
+ ] }),
175
+ /* @__PURE__ */ r(m.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
176
+ g ? /* @__PURE__ */ r("section", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
177
+ /* @__PURE__ */ r("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
178
+ /* @__PURE__ */ s("p", { className: "type-eyebrow ds:text-start ds:text-[color:var(--muted-foreground)]", children: n("signatureRequest.operatorSection") }),
179
+ M !== void 0 ? /* @__PURE__ */ s(
180
+ z,
181
+ {
182
+ intent: "primary",
183
+ size: "sm",
184
+ startIcon: /* @__PURE__ */ s(De, {}),
185
+ disabled: i,
186
+ onClick: () => {
187
+ B(M), R(
188
+ x(M)
189
+ ), b(null);
190
+ },
191
+ children: n("signatureRequest.assignToMe")
192
+ }
193
+ ) : null
194
+ ] }),
195
+ /* @__PURE__ */ r("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
196
+ /* @__PURE__ */ s(
197
+ ee,
198
+ {
199
+ "aria-hidden": "true",
200
+ name: S ? void 0 : ae(c, p),
201
+ size: "sm"
202
+ }
203
+ ),
204
+ /* @__PURE__ */ s("div", { className: "ds:min-w-0 ds:flex-1 ds:text-start", children: /* @__PURE__ */ s(
205
+ Z,
206
+ {
207
+ options: oe,
208
+ value: p,
209
+ onValueChange: (e) => {
210
+ e && (B(e), R(
211
+ e === v ? "email" : x(e)
212
+ ), b(null));
213
+ },
214
+ required: !0,
215
+ disabled: i,
216
+ placeholder: n("signatureRequest.operatorPlaceholder"),
217
+ "aria-label": n("signatureRequest.operatorSection")
218
+ }
219
+ ) })
220
+ ] }),
221
+ S ? null : /* @__PURE__ */ s(
222
+ "div",
223
+ {
224
+ role: "group",
225
+ "aria-label": n("signatureRequest.operatorChannelLabel"),
226
+ 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)]",
227
+ children: ue.map((e) => /* @__PURE__ */ r(
228
+ "span",
229
+ {
230
+ className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]",
231
+ children: [
232
+ /* @__PURE__ */ s(
233
+ Y,
234
+ {
235
+ checked: C === e.value,
236
+ disabled: i || e.disabled,
237
+ onCheckedChange: (a) => {
238
+ a === !0 && (R(e.value), b(null));
239
+ },
240
+ label: /* @__PURE__ */ r("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
241
+ /* @__PURE__ */ s(
242
+ "span",
243
+ {
244
+ "aria-hidden": "true",
245
+ className: "ds:text-[var(--accent)]",
246
+ children: e.icon
247
+ }
248
+ ),
249
+ e.label
250
+ ] })
251
+ }
252
+ ),
253
+ e.hint ? /* @__PURE__ */ s(Ne, { size: "sm", content: e.hint }) : null
254
+ ]
255
+ },
256
+ e.value
257
+ ))
258
+ }
259
+ ),
260
+ /* @__PURE__ */ s("span", { role: "status", className: "ds:sr-only", children: $ ? n("signatureRequest.operatorChannelReverted", {
261
+ channel: N[$].label
262
+ }) : null })
263
+ ] }) : null,
264
+ g && f ? /* @__PURE__ */ s(we, { decorative: !0 }) : null,
265
+ f ? /* @__PURE__ */ r("section", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:text-start", children: [
266
+ /* @__PURE__ */ r("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
267
+ /* @__PURE__ */ s("p", { className: "type-eyebrow ds:text-[color:var(--muted-foreground)]", children: n("signatureRequest.signersSection") }),
268
+ /* @__PURE__ */ s(
269
+ z,
270
+ {
271
+ ref: U,
272
+ intent: "primary",
273
+ size: "sm",
274
+ startIcon: /* @__PURE__ */ s(Ce, {}),
275
+ disabled: !me,
276
+ onClick: he,
277
+ children: n("signatureRequest.addSigner")
278
+ }
279
+ )
280
+ ] }),
281
+ u.map((e) => {
282
+ const a = o.filter(
283
+ (l) => l.value === e.signerId || !K.includes(l.value)
284
+ ), t = ae(o, e.signerId), d = V(e.signerId).map(
285
+ (l) => ({
286
+ value: l,
287
+ ...N[l]
288
+ })
289
+ );
290
+ return /* @__PURE__ */ r(
291
+ "div",
292
+ {
293
+ role: "group",
294
+ "aria-label": t,
295
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
296
+ children: [
297
+ /* @__PURE__ */ r("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
298
+ /* @__PURE__ */ s(
299
+ ee,
300
+ {
301
+ "aria-hidden": "true",
302
+ name: t,
303
+ size: "sm"
304
+ }
305
+ ),
306
+ /* @__PURE__ */ s("div", { className: "ds:min-w-0 ds:flex-1", children: /* @__PURE__ */ s(
307
+ Z,
308
+ {
309
+ options: a,
310
+ value: e.signerId,
311
+ onValueChange: (l) => {
312
+ if (!l) return;
313
+ const q = O(
314
+ l,
315
+ e.channel
316
+ );
317
+ L(e.rowId, {
318
+ signerId: l,
319
+ channel: q,
320
+ skipOtp: q === "on-device" ? e.skipOtp : void 0
321
+ });
322
+ },
323
+ required: !0,
324
+ disabled: i,
325
+ placeholder: n(
326
+ "signatureRequest.signerPlaceholder"
327
+ ),
328
+ "aria-label": n(
329
+ "signatureRequest.signerPlaceholder"
330
+ )
331
+ }
332
+ ) }),
333
+ u.length > 1 ? /* @__PURE__ */ s(
334
+ xe,
335
+ {
336
+ intent: "ghost",
337
+ size: "sm",
338
+ icon: /* @__PURE__ */ s(Ie, {}),
339
+ disabled: i,
340
+ "aria-label": n("signatureRequest.removeSigner"),
341
+ onClick: () => pe(e.rowId)
342
+ }
343
+ ) : null
344
+ ] }),
345
+ /* @__PURE__ */ s(
346
+ "div",
347
+ {
348
+ role: "group",
349
+ "aria-label": n("signatureRequest.channelLabel"),
350
+ 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)]",
351
+ children: d.map((l) => /* @__PURE__ */ s(
352
+ Y,
353
+ {
354
+ checked: e.channel === l.value,
355
+ disabled: i,
356
+ onCheckedChange: (q) => q === !0 && L(e.rowId, {
357
+ channel: l.value,
358
+ skipOtp: void 0
359
+ }),
360
+ label: /* @__PURE__ */ r("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
361
+ /* @__PURE__ */ s(
362
+ "span",
363
+ {
364
+ "aria-hidden": "true",
365
+ className: "ds:text-[var(--accent)]",
366
+ children: l.icon
367
+ }
368
+ ),
369
+ l.label
370
+ ] })
371
+ },
372
+ l.value
373
+ ))
374
+ }
375
+ ),
376
+ e.channel === "on-device" ? /* @__PURE__ */ s("div", { className: "ds:ps-[var(--spacing-xl)]", children: /* @__PURE__ */ s(
377
+ be,
378
+ {
379
+ label: n("signatureRequest.noOtp"),
380
+ checked: e.skipOtp === !0,
381
+ disabled: i,
382
+ onCheckedChange: (l) => L(e.rowId, { skipOtp: l })
383
+ }
384
+ ) }) : null
385
+ ]
386
+ },
387
+ e.rowId
388
+ );
389
+ })
390
+ ] }) : null,
391
+ u.some(
392
+ (e) => e.channel === "on-device" && e.skipOtp === !0
393
+ ) ? /* @__PURE__ */ s(_, { variant: "warning", children: /* @__PURE__ */ s(_.Description, { children: n("signatureRequest.noOtpWarning") }) }) : null,
394
+ H ? /* @__PURE__ */ s(_, { variant: "error", children: /* @__PURE__ */ s(_.Description, { children: H }) }) : null
395
+ ] }),
396
+ /* @__PURE__ */ r(m.Footer, { children: [
397
+ /* @__PURE__ */ s(
398
+ z,
399
+ {
400
+ intent: "primary",
401
+ startIcon: /* @__PURE__ */ s(Se, {}),
402
+ onClick: ve,
403
+ disabled: i || f && u.length === 0 || !f && !g,
404
+ loading: i,
405
+ children: n("signatureRequest.requestSignature")
406
+ }
407
+ ),
408
+ /* @__PURE__ */ s(m.Close, { asChild: !0, children: /* @__PURE__ */ s(z, { intent: "outline", disabled: i, children: n("signatureRequest.close") }) })
409
+ ] })
410
+ ] }) }) });
411
+ }
412
+ );
413
+ Me.displayName = "SignatureRequestModal";
414
+ export {
415
+ Me as S
416
+ };
417
+ //# sourceMappingURL=signature-request-CrRj64Nz.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "1.3.6",
3
+ "packageVersion": "1.3.7",
4
4
  "components": [
5
5
  {
6
6
  "kind": "component",
package/dist/index.js CHANGED
@@ -214,10 +214,10 @@ import { T as Og } from "./_chunks/transaction-chip-DJCstquX.js";
214
214
  import { W as yg, a as kg } from "./_chunks/whatsapp-button-BIy6NaJK.js";
215
215
  import { C as vg, W as Gg, a as Hg, b as wg, c as Vg, i as Ug, l as Wg, m as Kg, r as Yg, w as Xg, d as qg, e as zg, f as jg } from "./_chunks/workflow-map-BVMeVHkV.js";
216
216
  import { A as Jg, a as Zg, b as $g, c as aC } from "./_chunks/alia-sidebar-DzNz1gDf.js";
217
- import { A as rC, a as sC, L as oC, P as tC, S as nC, T as iC, b as pC, c as mC, d as lC, e as dC, f as AC, g as cC, h as fC, i as gC, j as CC, k as SC, l as xC, m as TC, r as uC, n as PC, s as IC, o as EC } from "./_chunks/anamnesis-i18n-DqRbWU2L.js";
217
+ import { A as rC, a as sC, L as oC, P as tC, S as nC, T as iC, b as pC, c as mC, d as lC, e as dC, f as AC, g as cC, h as fC, i as gC, j as CC, k as SC, l as xC, m as TC, r as uC, n as PC, s as IC, o as EC } from "./_chunks/anamnesis-i18n-S0cCfFg9.js";
218
218
  import { C as RC, M as _C, P as NC } from "./_chunks/marketplace-app-shell-DwcFMxzp.js";
219
219
  import { P as DC } from "./_chunks/payment-automation-upsell-D_x880pr.js";
220
- import { S as MC } from "./_chunks/signature-request-DZEFtbER.js";
220
+ import { S as MC } from "./_chunks/signature-request-CrRj64Nz.js";
221
221
  import { D as LC, d as yC } from "./_chunks/dependent-selector-DyFpdzZV.js";
222
222
  import { D as BC, d as vC } from "./_chunks/document-preview-D3gg4MXB.js";
223
223
  import { D as HC, d as wC } from "./_chunks/document-scanner-D8ASqxif.js";
@@ -1,4 +1,4 @@
1
- import { A as e, a as i, L as n, P as r, S as o, T as l, b as t, c as d, d as g, e as A, f as E, g as c, h as m, i as P, j as f, k as S, l as T, m as h, r as u, n as N, s as _, o as C } from "../../_chunks/anamnesis-i18n-DqRbWU2L.js";
1
+ import { A as e, a as i, L as n, P as r, S as o, T as l, b as t, c as d, d as g, e as A, f as E, g as c, h as m, i as P, j as f, k as S, l as T, m as h, r as u, n as N, s as _, o as C } from "../../_chunks/anamnesis-i18n-S0cCfFg9.js";
2
2
  export {
3
3
  e as Anamnesis,
4
4
  i as AnamnesisConfigEditor,
@@ -1,4 +1,4 @@
1
- import { S as o } from "../../_chunks/signature-request-DZEFtbER.js";
1
+ import { S as o } from "../../_chunks/signature-request-CrRj64Nz.js";
2
2
  export {
3
3
  o as SignatureRequestModal
4
4
  };
@@ -95,6 +95,20 @@ export interface SignatureRequestModalProps {
95
95
  initialSigners?: SignerRequest[];
96
96
  /** Cap on roster size. Default `2`. */
97
97
  maxSigners?: number;
98
+ /**
99
+ * Whether an operator must counter-sign. `false` drops the operator
100
+ * section entirely and submits `operatorId: null` — a host whose document
101
+ * does not require a counter-signature must not be asked for one. Default
102
+ * `true`.
103
+ */
104
+ requireOperator?: boolean;
105
+ /**
106
+ * Whether the patient side signs at all. `false` drops the signer roster
107
+ * and submits an empty `signers` array — for documents only an operator
108
+ * signs. Default `true`. Setting BOTH this and `requireOperator` to false
109
+ * leaves nothing to request, so the primary action stays disabled.
110
+ */
111
+ requirePatient?: boolean;
98
112
  /** Disables all inputs and shows the primary action as loading. */
99
113
  busy?: boolean;
100
114
  /** Consumer-translated error shown above the footer (e.g. server failure). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
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,403 +0,0 @@
1
- import { jsx as a, jsxs as r } from "react/jsx-runtime";
2
- import { forwardRef as pe, useRef as A, useState as S, useEffect as J } from "react";
3
- import { useTranslation as ve } from "react-i18next";
4
- import { D as m } from "./dialog-UbKJCi1X.js";
5
- import { B as k } from "./button-CPGiR_bH.js";
6
- import { I as ge } from "./icon-button-C_kbcd7I.js";
7
- import { C as K } from "./checkbox-BuZ1u__2.js";
8
- import { a as fe } from "./whatsapp-button-BIy6NaJK.js";
9
- import { S as Q } from "./select-BW5ecXlX.js";
10
- import { S as xe } from "./switch-OILsBLWo.js";
11
- import { A as y } from "./alert-CiJT540z.js";
12
- import { I as Re } from "./info-tip-Bxk3w6UM.js";
13
- import { S as be } from "./separator-CYU_bGFn.js";
14
- import { A as Y } from "./avatar-BNQNhoyL.js";
15
- import { c as ae } from "./createLucideIcon-DhHxpK9K.js";
16
- import { P as qe } from "./plus-DzMQ_c6b.js";
17
- import { X as Ne } from "./x-B5YnXwCz.js";
18
- import { P as we } from "./pen-line-D0De5zdl.js";
19
- import { M as Ce } from "./mail-BqXVF2zH.js";
20
- import { M as Ie } from "./message-square-Bye4ATvx.js";
21
- /**
22
- * @license lucide-react v1.22.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */
27
- const Se = [
28
- ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
29
- ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
30
- ], ke = ae("tablet", Se);
31
- /**
32
- * @license lucide-react v1.22.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */
37
- const ye = [
38
- ["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
39
- ["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }],
40
- ["line", { x1: "19", x2: "19", y1: "8", y2: "14", key: "1bvyxn" }],
41
- ["line", { x1: "22", x2: "16", y1: "11", y2: "11", key: "1shjgl" }]
42
- ], ze = ae("user-plus", ye), v = "__assign-later__", Z = [
43
- "sms",
44
- "email",
45
- "whatsapp",
46
- "on-device"
47
- ];
48
- function ee(h, z) {
49
- var c;
50
- return ((c = h.find((o) => o.value === z)) == null ? void 0 : c.label) ?? "";
51
- }
52
- const Oe = pe(
53
- ({
54
- open: h,
55
- onOpenChange: z,
56
- operators: c,
57
- signerOptions: o,
58
- currentOperatorId: O,
59
- allowAssignLater: _ = !0,
60
- initialOperatorId: B,
61
- initialOperatorChannel: L,
62
- initialSigners: D,
63
- maxSigners: se = 2,
64
- busy: i = !1,
65
- error: j,
66
- title: ne,
67
- description: te,
68
- onRequestSignature: le,
69
- contentProps: re
70
- }, ie) => {
71
- const { t: n } = ve(), E = A(0), F = A(null), H = (e) => {
72
- var l;
73
- const s = (l = o.find(
74
- (d) => d.value === e
75
- )) == null ? void 0 : l.availableChannels;
76
- return s && s.length > 0 ? Z.filter((d) => s.includes(d)) : Z;
77
- }, M = (e, s) => {
78
- const l = H(e);
79
- return l.includes(s) ? s : l[0];
80
- }, U = () => {
81
- var e, s;
82
- return B === null ? _ ? v : ((e = c[0]) == null ? void 0 : e.value) ?? v : B ?? ((s = c[0]) == null ? void 0 : s.value) ?? (_ ? v : "");
83
- }, V = () => (D && D.length > 0 ? D : o.length > 0 ? [
84
- {
85
- signerId: o[0].value,
86
- channel: M(o[0].value, "on-device")
87
- }
88
- ] : []).map((s) => ({ ...s, rowId: E.current++ })), g = (e) => {
89
- var s;
90
- return ((s = c.find((l) => l.value === e)) == null ? void 0 : s.defaultChannel) ?? "email";
91
- }, W = (e, s) => L === "on-device" ? s.some((l) => l.channel === "on-device") ? "on-device" : g(e) : L ?? g(e), [p, T] = S(U), [u, b] = S(V), [q, f] = S(
92
- () => W(p, u)
93
- ), [G, x] = S(null), X = A(h);
94
- J(() => {
95
- if (h && !X.current) {
96
- const e = U(), s = V();
97
- T(e), b(s), f(W(e, s)), x(null);
98
- }
99
- X.current = h;
100
- }, [h]);
101
- const N = u.some(
102
- (e) => e.channel === "on-device"
103
- );
104
- J(() => {
105
- if (q === "on-device" && !N) {
106
- const e = g(p);
107
- f(e), x(e);
108
- }
109
- }, [q, N, p]);
110
- const de = _ ? [
111
- ...c,
112
- { value: v, label: n("signatureRequest.assignLater") }
113
- ] : c, w = p === v, R = {
114
- sms: {
115
- label: n("signatureRequest.viaSms"),
116
- icon: /* @__PURE__ */ a(Ie, { className: "ds:size-4", "aria-hidden": !0 })
117
- },
118
- email: {
119
- label: n("signatureRequest.viaEmail"),
120
- icon: /* @__PURE__ */ a(Ce, { className: "ds:size-4", "aria-hidden": !0 })
121
- },
122
- whatsapp: {
123
- label: n("signatureRequest.viaWhatsapp"),
124
- icon: /* @__PURE__ */ a(fe, { className: "ds:size-4", "aria-hidden": !0 })
125
- },
126
- "on-device": {
127
- label: n("signatureRequest.onThisDevice"),
128
- icon: /* @__PURE__ */ a(ke, { className: "ds:size-4", "aria-hidden": !0 })
129
- }
130
- }, ce = [
131
- { value: "sms", ...R.sms },
132
- { value: "email", ...R.email },
133
- {
134
- value: "on-device",
135
- ...R["on-device"],
136
- disabled: !N,
137
- hint: N ? void 0 : n("signatureRequest.onDeviceUnavailableHint")
138
- }
139
- ], $ = u.map((e) => e.signerId), C = o.find(
140
- (e) => !$.includes(e.value)
141
- ), oe = !i && u.length < se && C !== void 0, P = (e, s) => {
142
- b(
143
- (l) => l.map(
144
- (d) => d.rowId === e ? { ...d, ...s } : d
145
- )
146
- );
147
- }, ue = () => {
148
- C && b((e) => [
149
- ...e,
150
- {
151
- signerId: C.value,
152
- channel: M(C.value, "sms"),
153
- rowId: E.current++
154
- }
155
- ]);
156
- }, me = (e) => {
157
- var s;
158
- (s = F.current) == null || s.focus(), b(
159
- (l) => l.filter((d) => d.rowId !== e)
160
- );
161
- }, he = () => {
162
- le({
163
- operatorId: w ? null : p,
164
- operatorChannel: w ? null : q,
165
- signers: u.map(({ rowId: e, ...s }) => s)
166
- });
167
- };
168
- return /* @__PURE__ */ a("div", { ref: ie, className: "ds:contents", "data-component": "signature-request", children: /* @__PURE__ */ a(m, { open: h, onOpenChange: z, children: /* @__PURE__ */ r(m.Content, { size: "lg", hideCloseButton: !0, ...re, children: [
169
- /* @__PURE__ */ r(m.Header, { children: [
170
- /* @__PURE__ */ a(m.Title, { children: ne ?? n("signatureRequest.title") }),
171
- /* @__PURE__ */ a(m.Description, { children: te ?? n("signatureRequest.noSignedVersions") })
172
- ] }),
173
- /* @__PURE__ */ r(m.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
174
- /* @__PURE__ */ r("section", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
175
- /* @__PURE__ */ r("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
176
- /* @__PURE__ */ a("p", { className: "type-eyebrow ds:text-start ds:text-[color:var(--muted-foreground)]", children: n("signatureRequest.operatorSection") }),
177
- O !== void 0 ? /* @__PURE__ */ a(
178
- k,
179
- {
180
- intent: "primary",
181
- size: "sm",
182
- startIcon: /* @__PURE__ */ a(ze, {}),
183
- disabled: i,
184
- onClick: () => {
185
- T(O), f(
186
- g(O)
187
- ), x(null);
188
- },
189
- children: n("signatureRequest.assignToMe")
190
- }
191
- ) : null
192
- ] }),
193
- /* @__PURE__ */ r("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
194
- /* @__PURE__ */ a(
195
- Y,
196
- {
197
- "aria-hidden": "true",
198
- name: w ? void 0 : ee(c, p),
199
- size: "sm"
200
- }
201
- ),
202
- /* @__PURE__ */ a("div", { className: "ds:min-w-0 ds:flex-1 ds:text-start", children: /* @__PURE__ */ a(
203
- Q,
204
- {
205
- options: de,
206
- value: p,
207
- onValueChange: (e) => {
208
- e && (T(e), f(
209
- e === v ? "email" : g(e)
210
- ), x(null));
211
- },
212
- required: !0,
213
- disabled: i,
214
- placeholder: n("signatureRequest.operatorPlaceholder"),
215
- "aria-label": n("signatureRequest.operatorSection")
216
- }
217
- ) })
218
- ] }),
219
- w ? null : /* @__PURE__ */ a(
220
- "div",
221
- {
222
- role: "group",
223
- "aria-label": n("signatureRequest.operatorChannelLabel"),
224
- 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)]",
225
- children: ce.map((e) => /* @__PURE__ */ r(
226
- "span",
227
- {
228
- className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]",
229
- children: [
230
- /* @__PURE__ */ a(
231
- K,
232
- {
233
- checked: q === e.value,
234
- disabled: i || e.disabled,
235
- onCheckedChange: (s) => {
236
- s === !0 && (f(e.value), x(null));
237
- },
238
- label: /* @__PURE__ */ r("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
239
- /* @__PURE__ */ a(
240
- "span",
241
- {
242
- "aria-hidden": "true",
243
- className: "ds:text-[var(--accent)]",
244
- children: e.icon
245
- }
246
- ),
247
- e.label
248
- ] })
249
- }
250
- ),
251
- e.hint ? /* @__PURE__ */ a(Re, { size: "sm", content: e.hint }) : null
252
- ]
253
- },
254
- e.value
255
- ))
256
- }
257
- ),
258
- /* @__PURE__ */ a("span", { role: "status", className: "ds:sr-only", children: G ? n("signatureRequest.operatorChannelReverted", {
259
- channel: R[G].label
260
- }) : null })
261
- ] }),
262
- /* @__PURE__ */ a(be, { decorative: !0 }),
263
- /* @__PURE__ */ r("section", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:text-start", children: [
264
- /* @__PURE__ */ r("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
265
- /* @__PURE__ */ a("p", { className: "type-eyebrow ds:text-[color:var(--muted-foreground)]", children: n("signatureRequest.signersSection") }),
266
- /* @__PURE__ */ a(
267
- k,
268
- {
269
- ref: F,
270
- intent: "primary",
271
- size: "sm",
272
- startIcon: /* @__PURE__ */ a(qe, {}),
273
- disabled: !oe,
274
- onClick: ue,
275
- children: n("signatureRequest.addSigner")
276
- }
277
- )
278
- ] }),
279
- u.map((e) => {
280
- const s = o.filter(
281
- (t) => t.value === e.signerId || !$.includes(t.value)
282
- ), l = ee(o, e.signerId), d = H(e.signerId).map(
283
- (t) => ({ value: t, ...R[t] })
284
- );
285
- return /* @__PURE__ */ r(
286
- "div",
287
- {
288
- role: "group",
289
- "aria-label": l,
290
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
291
- children: [
292
- /* @__PURE__ */ r("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
293
- /* @__PURE__ */ a(Y, { "aria-hidden": "true", name: l, size: "sm" }),
294
- /* @__PURE__ */ a("div", { className: "ds:min-w-0 ds:flex-1", children: /* @__PURE__ */ a(
295
- Q,
296
- {
297
- options: s,
298
- value: e.signerId,
299
- onValueChange: (t) => {
300
- if (!t) return;
301
- const I = M(
302
- t,
303
- e.channel
304
- );
305
- P(e.rowId, {
306
- signerId: t,
307
- channel: I,
308
- skipOtp: I === "on-device" ? e.skipOtp : void 0
309
- });
310
- },
311
- required: !0,
312
- disabled: i,
313
- placeholder: n(
314
- "signatureRequest.signerPlaceholder"
315
- ),
316
- "aria-label": n("signatureRequest.signerPlaceholder")
317
- }
318
- ) }),
319
- u.length > 1 ? /* @__PURE__ */ a(
320
- ge,
321
- {
322
- intent: "ghost",
323
- size: "sm",
324
- icon: /* @__PURE__ */ a(Ne, {}),
325
- disabled: i,
326
- "aria-label": n("signatureRequest.removeSigner"),
327
- onClick: () => me(e.rowId)
328
- }
329
- ) : null
330
- ] }),
331
- /* @__PURE__ */ a(
332
- "div",
333
- {
334
- role: "group",
335
- "aria-label": n("signatureRequest.channelLabel"),
336
- 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)]",
337
- children: d.map((t) => /* @__PURE__ */ a(
338
- K,
339
- {
340
- checked: e.channel === t.value,
341
- disabled: i,
342
- onCheckedChange: (I) => I === !0 && P(e.rowId, {
343
- channel: t.value,
344
- skipOtp: void 0
345
- }),
346
- label: /* @__PURE__ */ r("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
347
- /* @__PURE__ */ a(
348
- "span",
349
- {
350
- "aria-hidden": "true",
351
- className: "ds:text-[var(--accent)]",
352
- children: t.icon
353
- }
354
- ),
355
- t.label
356
- ] })
357
- },
358
- t.value
359
- ))
360
- }
361
- ),
362
- e.channel === "on-device" ? /* @__PURE__ */ a("div", { className: "ds:ps-[var(--spacing-xl)]", children: /* @__PURE__ */ a(
363
- xe,
364
- {
365
- label: n("signatureRequest.noOtp"),
366
- checked: e.skipOtp === !0,
367
- disabled: i,
368
- onCheckedChange: (t) => P(e.rowId, { skipOtp: t })
369
- }
370
- ) }) : null
371
- ]
372
- },
373
- e.rowId
374
- );
375
- })
376
- ] }),
377
- u.some(
378
- (e) => e.channel === "on-device" && e.skipOtp === !0
379
- ) ? /* @__PURE__ */ a(y, { variant: "warning", children: /* @__PURE__ */ a(y.Description, { children: n("signatureRequest.noOtpWarning") }) }) : null,
380
- j ? /* @__PURE__ */ a(y, { variant: "error", children: /* @__PURE__ */ a(y.Description, { children: j }) }) : null
381
- ] }),
382
- /* @__PURE__ */ r(m.Footer, { children: [
383
- /* @__PURE__ */ a(
384
- k,
385
- {
386
- intent: "primary",
387
- startIcon: /* @__PURE__ */ a(we, {}),
388
- onClick: he,
389
- disabled: i || u.length === 0,
390
- loading: i,
391
- children: n("signatureRequest.requestSignature")
392
- }
393
- ),
394
- /* @__PURE__ */ a(m.Close, { asChild: !0, children: /* @__PURE__ */ a(k, { intent: "outline", disabled: i, children: n("signatureRequest.close") }) })
395
- ] })
396
- ] }) }) });
397
- }
398
- );
399
- Oe.displayName = "SignatureRequestModal";
400
- export {
401
- Oe as S
402
- };
403
- //# sourceMappingURL=signature-request-DZEFtbER.js.map