@alfadocs/ui-kit 0.55.0 → 0.56.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.
- package/dist/_chunks/{pdf-viewer-4odMFuFW.js → pdf-viewer-XxWdtKfD.js} +63 -58
- package/dist/_chunks/{sign-document-BzHTjMVC.js → sign-document-BmAT0kKD.js} +3 -3
- package/dist/_chunks/{signature-capture-CHbrKoA_.js → signature-capture-COi0Uiqu.js} +22 -7
- package/dist/_chunks/use-signing-session-CyOZWinp.js +147 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/signature-capture/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/use-signing-session.d.ts +8 -0
- package/dist/index.js +4 -4
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/use-signing-session-C5evzYmo.js +0 -108
package/package.json
CHANGED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { useRef as w, useEffect as C, useState as y, useMemo as F, useCallback as S } from "react";
|
|
2
|
-
function b(e) {
|
|
3
|
-
return e != null && e.current ? e.current : typeof document > "u" ? null : document;
|
|
4
|
-
}
|
|
5
|
-
function A(e, o) {
|
|
6
|
-
const r = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : (
|
|
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
|
-
e.replace(/["'\\[\]]/g, "")
|
|
11
|
-
), s = `[data-error-anchor="${r}"], [name="${r}"], [name$="[${r}]"]`, i = Array.from(o.querySelectorAll(s));
|
|
12
|
-
return i.length === 0 ? null : i.find((c) => c.offsetParent !== null) ?? i[0];
|
|
13
|
-
}
|
|
14
|
-
function k(e, o, r = {}) {
|
|
15
|
-
const {
|
|
16
|
-
scope: s,
|
|
17
|
-
scrollOptions: i = { behavior: "smooth", block: "center" },
|
|
18
|
-
focus: u = !0,
|
|
19
|
-
skipInitialMount: c = !0
|
|
20
|
-
} = r, a = w(!1), d = w(null), l = o.find((f) => !!e[f]) ?? null;
|
|
21
|
-
C(() => {
|
|
22
|
-
if (c && !a.current) {
|
|
23
|
-
a.current = !0, d.current = l;
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (!l) {
|
|
27
|
-
d.current = null;
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (l === d.current || typeof window > "u") return;
|
|
31
|
-
const f = window.requestAnimationFrame(() => {
|
|
32
|
-
const m = b(s);
|
|
33
|
-
if (!m) return;
|
|
34
|
-
const g = A(l, m);
|
|
35
|
-
g && (g.scrollIntoView(i), u && g.focus({ preventScroll: !0 }), d.current = l);
|
|
36
|
-
});
|
|
37
|
-
return () => window.cancelAnimationFrame(f);
|
|
38
|
-
}, [l]);
|
|
39
|
-
}
|
|
40
|
-
function v(e, o = !1) {
|
|
41
|
-
const r = {};
|
|
42
|
-
for (const s of e)
|
|
43
|
-
r[s.id] = { signed: o ? !1 : !!s.signed };
|
|
44
|
-
return r;
|
|
45
|
-
}
|
|
46
|
-
function B(e) {
|
|
47
|
-
const [o, r] = y(
|
|
48
|
-
() => v(e)
|
|
49
|
-
), [s, i] = y(null), u = F(
|
|
50
|
-
() => e.map((n) => {
|
|
51
|
-
const t = o[n.id];
|
|
52
|
-
return {
|
|
53
|
-
...n,
|
|
54
|
-
signed: t ? t.signed : !!n.signed,
|
|
55
|
-
payload: t == null ? void 0 : t.payload
|
|
56
|
-
};
|
|
57
|
-
}),
|
|
58
|
-
[e, o]
|
|
59
|
-
), c = F(
|
|
60
|
-
() => u.reduce((n, t) => t.signed ? n + 1 : n, 0),
|
|
61
|
-
[u]
|
|
62
|
-
), a = u.length, d = a > 0 && c === a, l = S((n) => {
|
|
63
|
-
i(n);
|
|
64
|
-
}, []), f = S(() => {
|
|
65
|
-
i(null);
|
|
66
|
-
}, []), m = S((n, t) => {
|
|
67
|
-
r((p) => ({ ...p, [n]: { signed: !0, payload: t } })), i((p) => p === n ? null : p);
|
|
68
|
-
}, []), g = S(
|
|
69
|
-
(n) => {
|
|
70
|
-
var t;
|
|
71
|
-
return !!((t = o[n]) != null && t.signed);
|
|
72
|
-
},
|
|
73
|
-
[o]
|
|
74
|
-
), h = S(() => {
|
|
75
|
-
r(v(e, !0)), i(null);
|
|
76
|
-
}, [e]);
|
|
77
|
-
return F(
|
|
78
|
-
() => ({
|
|
79
|
-
fields: u,
|
|
80
|
-
signedCount: c,
|
|
81
|
-
total: a,
|
|
82
|
-
isComplete: d,
|
|
83
|
-
activeFieldId: s,
|
|
84
|
-
openField: l,
|
|
85
|
-
closeField: f,
|
|
86
|
-
markSigned: m,
|
|
87
|
-
isFieldSigned: g,
|
|
88
|
-
reset: h
|
|
89
|
-
}),
|
|
90
|
-
[
|
|
91
|
-
u,
|
|
92
|
-
c,
|
|
93
|
-
a,
|
|
94
|
-
d,
|
|
95
|
-
s,
|
|
96
|
-
l,
|
|
97
|
-
f,
|
|
98
|
-
m,
|
|
99
|
-
g,
|
|
100
|
-
h
|
|
101
|
-
]
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
export {
|
|
105
|
-
B as a,
|
|
106
|
-
k as u
|
|
107
|
-
};
|
|
108
|
-
//# sourceMappingURL=use-signing-session-C5evzYmo.js.map
|