@alfadocs/ui-kit 0.55.0 → 0.57.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.
@@ -0,0 +1,147 @@
1
+ import { useRef as E, useEffect as B, useState as h, useMemo as I, useCallback as g } from "react";
2
+ function R(o) {
3
+ return o != null && o.current ? o.current : typeof document > "u" ? null : document;
4
+ }
5
+ function T(o, s) {
6
+ const r = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(o) : (
7
+ // SSR / jsdom fallback — drop every character that's
8
+ // significant in a CSS attribute selector. Conservative but
9
+ // robust enough for the test environment.
10
+ o.replace(/["'\\[\]]/g, "")
11
+ ), c = `[data-error-anchor="${r}"], [name="${r}"], [name$="[${r}]"]`, l = Array.from(s.querySelectorAll(c));
12
+ return l.length === 0 ? null : l.find((f) => f.offsetParent !== null) ?? l[0];
13
+ }
14
+ function q(o, s, r = {}) {
15
+ const {
16
+ scope: c,
17
+ scrollOptions: l = { behavior: "smooth", block: "center" },
18
+ focus: p = !0,
19
+ skipInitialMount: f = !0
20
+ } = r, t = E(!1), a = E(null), i = s.find((m) => !!o[m]) ?? null;
21
+ B(() => {
22
+ if (f && !t.current) {
23
+ t.current = !0, a.current = i;
24
+ return;
25
+ }
26
+ if (!i) {
27
+ a.current = null;
28
+ return;
29
+ }
30
+ if (i === a.current || typeof window > "u") return;
31
+ const m = window.requestAnimationFrame(() => {
32
+ const F = R(c);
33
+ if (!F) return;
34
+ const S = T(i, F);
35
+ S && (S.scrollIntoView(l), p && S.focus({ preventScroll: !0 }), a.current = i);
36
+ });
37
+ return () => window.cancelAnimationFrame(m);
38
+ }, [i]);
39
+ }
40
+ function k(o, s = !1) {
41
+ const r = {};
42
+ for (const c of o)
43
+ r[c.id] = { signed: s ? !1 : !!c.signed };
44
+ return r;
45
+ }
46
+ function M(o) {
47
+ const [s, r] = h(
48
+ () => k(o)
49
+ ), [c, l] = h(null), [p, f] = h(
50
+ () => {
51
+ var n;
52
+ return ((n = o[0]) == null ? void 0 : n.id) ?? null;
53
+ }
54
+ ), t = I(
55
+ () => o.map((n) => {
56
+ const e = s[n.id];
57
+ return {
58
+ ...n,
59
+ signed: e ? e.signed : !!n.signed,
60
+ payload: e == null ? void 0 : e.payload
61
+ };
62
+ }),
63
+ [o, s]
64
+ ), a = I(
65
+ () => t.reduce((n, e) => e.signed ? n + 1 : n, 0),
66
+ [t]
67
+ ), i = t.length, m = i > 0 && a === i, F = g((n) => {
68
+ l(n);
69
+ }, []), S = g(() => {
70
+ l(null);
71
+ }, []), v = g((n, e) => {
72
+ r((u) => ({ ...u, [n]: { signed: !0, payload: e } })), l((u) => u === n ? null : u);
73
+ }, []), w = g(
74
+ (n) => {
75
+ var e;
76
+ return !!((e = s[n]) != null && e.signed);
77
+ },
78
+ [s]
79
+ ), y = g(() => {
80
+ var n;
81
+ r(k(o, !0)), l(null), f(((n = o[0]) == null ? void 0 : n.id) ?? null);
82
+ }, [o]), C = g(() => {
83
+ f((n) => {
84
+ const e = t.length;
85
+ if (e === 0) return null;
86
+ const u = n ? t.findIndex((d) => d.id === n) : -1;
87
+ return t[(u + 1 + e) % e].id;
88
+ });
89
+ }, [t]), x = g(() => {
90
+ f((n) => {
91
+ const e = t.length;
92
+ if (e === 0) return null;
93
+ const u = n ? t.findIndex((d) => d.id === n) : 0;
94
+ return t[(u - 1 + e) % e].id;
95
+ });
96
+ }, [t]), b = g(() => {
97
+ f((n) => {
98
+ const e = t.length;
99
+ if (e === 0) return n;
100
+ const u = n ? t.findIndex((d) => d.id === n) : -1;
101
+ for (let d = 1; d <= e; d += 1) {
102
+ const A = t[(u + d) % e];
103
+ if (!A.signed) return A.id;
104
+ }
105
+ return n;
106
+ });
107
+ }, [t]);
108
+ return I(
109
+ () => ({
110
+ fields: t,
111
+ signedCount: a,
112
+ total: i,
113
+ isComplete: m,
114
+ activeFieldId: c,
115
+ openField: F,
116
+ closeField: S,
117
+ markSigned: v,
118
+ isFieldSigned: w,
119
+ reset: y,
120
+ cursorFieldId: p,
121
+ goToNextField: C,
122
+ goToPreviousField: x,
123
+ goToNextUnsigned: b
124
+ }),
125
+ [
126
+ t,
127
+ a,
128
+ i,
129
+ m,
130
+ c,
131
+ F,
132
+ S,
133
+ v,
134
+ w,
135
+ y,
136
+ p,
137
+ C,
138
+ x,
139
+ b
140
+ ]
141
+ );
142
+ }
143
+ export {
144
+ M as a,
145
+ q as u
146
+ };
147
+ //# sourceMappingURL=use-signing-session-CyOZWinp.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.55.0",
3
+ "packageVersion": "0.57.0",
4
4
  "components": [
5
5
  {
6
6
  "kind": "component",
@@ -1,4 +1,4 @@
1
- import { P as p, p as a } from "../../_chunks/pdf-viewer-4odMFuFW.js";
1
+ import { P as p, p as a } from "../../_chunks/pdf-viewer-XxWdtKfD.js";
2
2
  export {
3
3
  p as PDFViewer,
4
4
  a as pdfViewerAgent
@@ -1,4 +1,4 @@
1
- import { P as r, p } from "../../_chunks/public-header.agent-DyVpPwmv.js";
1
+ import { P as r, p } from "../../_chunks/public-header.agent-CYQK6T6F.js";
2
2
  export {
3
3
  r as PublicHeader,
4
4
  p as publicHeaderAgent
@@ -24,6 +24,14 @@ export interface PublicHeaderProps extends Omit<ComponentPropsWithoutRef<'header
24
24
  menuLabel?: string;
25
25
  /** Override the navigation landmark label (`t('publicHeader.primaryNavLabel')`). */
26
26
  navLabel?: string;
27
+ /**
28
+ * Keep `actionsSlot` visible inline at every breakpoint instead of
29
+ * collapsing it into the mobile menu. When there is no `navSlot`, the
30
+ * mobile menu trigger is omitted entirely (nothing left to collapse) — use
31
+ * this for a header whose only action is a single always-relevant control,
32
+ * e.g. a public signer's "Sign out". Default `false`.
33
+ */
34
+ persistActions?: boolean;
27
35
  /** Consumer-supplied instance id, surfaced as `data-component-id`. */
28
36
  id?: string;
29
37
  }
@@ -1,4 +1,4 @@
1
- import { S as o, s } from "../../_chunks/sign-document-BzHTjMVC.js";
1
+ import { S as o, s } from "../../_chunks/sign-document-BmAT0kKD.js";
2
2
  export {
3
3
  o as SignDocument,
4
4
  s as signDocumentAgent
@@ -1,4 +1,4 @@
1
- import { S as r, s as t } from "../../_chunks/signature-capture-CHbrKoA_.js";
1
+ import { S as r, s as t } from "../../_chunks/signature-capture-COi0Uiqu.js";
2
2
  export {
3
3
  r as SignatureCapture,
4
4
  t as signatureCaptureAgent
@@ -1,6 +1,6 @@
1
1
  import { u as v } from "../_chunks/use-prefers-reduced-motion-BMwIQRjB.js";
2
2
  import { u as D } from "../_chunks/use-media-query-CcAx5SMM.js";
3
- import { u as g, a as _ } from "../_chunks/use-signing-session-C5evzYmo.js";
3
+ import { u as g, a as _ } from "../_chunks/use-signing-session-CyOZWinp.js";
4
4
  import { u as O } from "../_chunks/use-count-up-BLLetaZ8.js";
5
5
  import { u as k } from "../_chunks/use-locale-BkCIHujH.js";
6
6
  import { A as K, T as H, a as M, r as Y, t as q, u as B } from "../_chunks/use-theme-CAuo6EYT.js";
@@ -31,6 +31,14 @@ export interface UseSigningSessionReturn<TField extends SigningFieldBase, TPaylo
31
31
  isFieldSigned: (id: string) => boolean;
32
32
  /** Clear all signatures and close any open field. */
33
33
  reset: () => void;
34
+ /** The field currently targeted by next/previous navigation, or `null`. */
35
+ cursorFieldId: string | null;
36
+ /** Move the navigation cursor to the next field (input order, cycling). */
37
+ goToNextField: () => void;
38
+ /** Move the navigation cursor to the previous field (cycling). */
39
+ goToPreviousField: () => void;
40
+ /** Move the cursor to the next still-unsigned field (cycling); no-op if all signed. */
41
+ goToNextUnsigned: () => void;
34
42
  }
35
43
  export declare function useSigningSession<TField extends SigningFieldBase, TPayload = unknown>(fields: TField[]): UseSigningSessionReturn<TField, TPayload>;
36
44
  //# sourceMappingURL=use-signing-session.d.ts.map
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { u as r } from "./_chunks/use-prefers-reduced-motion-BMwIQRjB.js";
2
2
  import { u as t } from "./_chunks/use-media-query-CcAx5SMM.js";
3
- import { u as n, a as i } from "./_chunks/use-signing-session-C5evzYmo.js";
3
+ import { u as n, a as i } from "./_chunks/use-signing-session-CyOZWinp.js";
4
4
  import { u as m } from "./_chunks/use-locale-BkCIHujH.js";
5
5
  import { A as d, T as c, a as f, r as g, t as A, u as x } from "./_chunks/use-theme-CAuo6EYT.js";
6
6
  import { u } from "./_chunks/use-persistent-state-i23OWy6G.js";
@@ -86,7 +86,7 @@ import { S as Kt } from "./_chunks/skip-link-BaSMtPwB.js";
86
86
  import { L as qt } from "./_chunks/link-DrD_cRUg.js";
87
87
  import { P as jt, a as zt, b as Xt, c as Jt, d as Zt, e as $t, f as as, g as es, p as rs } from "./_chunks/pagination-DQOgnxxw.js";
88
88
  import { D as ts, a as ss, P as ns, S as is, c as ps, p as ms } from "./_chunks/public-footer.agent-CfXuW1x6.js";
89
- import { P as ds, p as cs } from "./_chunks/public-header.agent-DyVpPwmv.js";
89
+ import { P as ds, p as cs } from "./_chunks/public-header.agent-CYQK6T6F.js";
90
90
  import { S as gs, f as As, s as xs } from "./_chunks/search-bar-CvN_S0jW.js";
91
91
  import { S as us, a as Ss, b as Ts, c as bs, d as Ps, e as Is, f as Rs, g as Es, h as hs, i as Fs, j as Ns, k as _s, l as Ls, m as Ds, n as ys, o as Os, p as Bs, q as Ms, s as ks, u as Hs } from "./_chunks/sidebar-DPEHzxLZ.js";
92
92
  import { S as vs } from "./_chunks/stepper-accordion-Dki6r9ZE.js";
@@ -160,12 +160,12 @@ import { C as Mm, a as km, b as Hm, c as wm } from "./_chunks/contact-profile-ca
160
160
  import { P as Vm, p as Gm } from "./_chunks/practice-results-CtfciF2v.js";
161
161
  import { P as Um, a as Km, p as Ym, b as qm } from "./_chunks/payment-request-card-B_lyobd0.js";
162
162
  import { P as jm, f as zm, p as Xm, a as Jm, s as Zm, b as $m, c as al } from "./_chunks/payment-form-DJ9vnzrT.js";
163
- import { P as rl, p as ol } from "./_chunks/pdf-viewer-4odMFuFW.js";
163
+ import { P as rl, p as ol } from "./_chunks/pdf-viewer-XxWdtKfD.js";
164
164
  import { R as sl, r as nl } from "./_chunks/reviews-panel-CPrXu5TX.js";
165
165
  import { R as pl, e as ml, r as ll, t as dl, a as cl, w as fl } from "./_chunks/rich-text-editor-DhGIBd4a.js";
166
- import { S as Al, s as xl } from "./_chunks/signature-capture-CHbrKoA_.js";
166
+ import { S as Al, s as xl } from "./_chunks/signature-capture-COi0Uiqu.js";
167
167
  import { S as ul, s as Sl } from "./_chunks/signature-field-DhscKdgk.js";
168
- import { S as bl, s as Pl } from "./_chunks/sign-document-BzHTjMVC.js";
168
+ import { S as bl, s as Pl } from "./_chunks/sign-document-BmAT0kKD.js";
169
169
  import { S as Rl, f as El, i as hl } from "./_chunks/slot-grid-BlHHP9Qy.js";
170
170
  import { C as Nl, a as _l, b as Ll, F as Dl, c as yl, d as Ol, P as Bl, e as Ml, T as kl, f as Hl, g as wl, h as vl, l as Vl, i as Gl, t as Wl, r as Ul } from "./_chunks/tooth-scheme-CxlsLjfN.js";
171
171
  import { T as Yl } from "./_chunks/transaction-chip-BZCa6XDn.js";