@superdoc-dev/esign 1.0.0-next.3 → 1.0.1
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/README.md +84 -399
- package/dist/defaults/CheckboxInput.d.ts +4 -0
- package/dist/defaults/CheckboxInput.d.ts.map +1 -0
- package/dist/defaults/SignatureInput.d.ts.map +1 -1
- package/dist/defaults/index.d.ts +1 -1
- package/dist/defaults/index.d.ts.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.mjs +296 -309
- package/dist/types.d.ts +12 -15
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -3
- package/dist/defaults/ConsentCheckbox.d.ts +0 -4
- package/dist/defaults/ConsentCheckbox.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
1
|
+
import ce, { forwardRef as ue, useState as N, useRef as Z, useCallback as P, useEffect as re, useImperativeHandle as de } from "react";
|
|
2
|
+
var Q = { exports: {} }, L = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.js
|
|
@@ -9,27 +9,27 @@ var Z = { exports: {} }, $ = {};
|
|
|
9
9
|
* This source code is licensed under the MIT license found in the
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
var
|
|
19
|
-
if (c !== void 0 && (
|
|
12
|
+
var ne;
|
|
13
|
+
function fe() {
|
|
14
|
+
if (ne) return L;
|
|
15
|
+
ne = 1;
|
|
16
|
+
var f = Symbol.for("react.transitional.element"), g = Symbol.for("react.fragment");
|
|
17
|
+
function m(s, o, c) {
|
|
18
|
+
var v = null;
|
|
19
|
+
if (c !== void 0 && (v = "" + c), o.key !== void 0 && (v = "" + o.key), "key" in o) {
|
|
20
20
|
c = {};
|
|
21
|
-
for (var
|
|
22
|
-
|
|
21
|
+
for (var _ in o)
|
|
22
|
+
_ !== "key" && (c[_] = o[_]);
|
|
23
23
|
} else c = o;
|
|
24
24
|
return o = c.ref, {
|
|
25
|
-
$$typeof:
|
|
26
|
-
type:
|
|
27
|
-
key:
|
|
25
|
+
$$typeof: f,
|
|
26
|
+
type: s,
|
|
27
|
+
key: v,
|
|
28
28
|
ref: o !== void 0 ? o : null,
|
|
29
29
|
props: c
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return L.Fragment = g, L.jsx = m, L.jsxs = m, L;
|
|
33
33
|
}
|
|
34
34
|
var U = {};
|
|
35
35
|
/**
|
|
@@ -41,58 +41,58 @@ var U = {};
|
|
|
41
41
|
* This source code is licensed under the MIT license found in the
|
|
42
42
|
* LICENSE file in the root directory of this source tree.
|
|
43
43
|
*/
|
|
44
|
-
var
|
|
45
|
-
function
|
|
46
|
-
return
|
|
47
|
-
function
|
|
44
|
+
var oe;
|
|
45
|
+
function pe() {
|
|
46
|
+
return oe || (oe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
47
|
+
function f(e) {
|
|
48
48
|
if (e == null) return null;
|
|
49
49
|
if (typeof e == "function")
|
|
50
|
-
return e.$$typeof ===
|
|
50
|
+
return e.$$typeof === ee ? null : e.displayName || e.name || null;
|
|
51
51
|
if (typeof e == "string") return e;
|
|
52
52
|
switch (e) {
|
|
53
|
-
case S:
|
|
54
|
-
return "Fragment";
|
|
55
53
|
case y:
|
|
54
|
+
return "Fragment";
|
|
55
|
+
case h:
|
|
56
56
|
return "Profiler";
|
|
57
|
-
case
|
|
57
|
+
case V:
|
|
58
58
|
return "StrictMode";
|
|
59
|
-
case
|
|
59
|
+
case S:
|
|
60
60
|
return "Suspense";
|
|
61
61
|
case J:
|
|
62
62
|
return "SuspenseList";
|
|
63
|
-
case
|
|
63
|
+
case H:
|
|
64
64
|
return "Activity";
|
|
65
65
|
}
|
|
66
66
|
if (typeof e == "object")
|
|
67
67
|
switch (typeof e.tag == "number" && console.error(
|
|
68
68
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
69
|
), e.$$typeof) {
|
|
70
|
-
case
|
|
70
|
+
case K:
|
|
71
71
|
return "Portal";
|
|
72
|
-
case
|
|
72
|
+
case w:
|
|
73
73
|
return e.displayName || "Context";
|
|
74
|
-
case B:
|
|
75
|
-
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
74
|
case z:
|
|
75
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
|
+
case B:
|
|
77
77
|
var n = e.render;
|
|
78
78
|
return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
-
case
|
|
80
|
-
return n = e.displayName || null, n !== null ? n :
|
|
81
|
-
case
|
|
79
|
+
case M:
|
|
80
|
+
return n = e.displayName || null, n !== null ? n : f(e.type) || "Memo";
|
|
81
|
+
case C:
|
|
82
82
|
n = e._payload, e = e._init;
|
|
83
83
|
try {
|
|
84
|
-
return
|
|
84
|
+
return f(e(n));
|
|
85
85
|
} catch {
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function g(e) {
|
|
91
91
|
return "" + e;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function m(e) {
|
|
94
94
|
try {
|
|
95
|
-
|
|
95
|
+
g(e);
|
|
96
96
|
var n = !1;
|
|
97
97
|
} catch {
|
|
98
98
|
n = !0;
|
|
@@ -104,37 +104,37 @@ function ue() {
|
|
|
104
104
|
n,
|
|
105
105
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
106
|
u
|
|
107
|
-
),
|
|
107
|
+
), g(e);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
if (e ===
|
|
112
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
110
|
+
function s(e) {
|
|
111
|
+
if (e === y) return "<>";
|
|
112
|
+
if (typeof e == "object" && e !== null && e.$$typeof === C)
|
|
113
113
|
return "<...>";
|
|
114
114
|
try {
|
|
115
|
-
var n =
|
|
115
|
+
var n = f(e);
|
|
116
116
|
return n ? "<" + n + ">" : "<...>";
|
|
117
117
|
} catch {
|
|
118
118
|
return "<...>";
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
function o() {
|
|
122
|
-
var e =
|
|
122
|
+
var e = T.A;
|
|
123
123
|
return e === null ? null : e.getOwner();
|
|
124
124
|
}
|
|
125
125
|
function c() {
|
|
126
126
|
return Error("react-stack-top-frame");
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
if (
|
|
128
|
+
function v(e) {
|
|
129
|
+
if (E.call(e, "key")) {
|
|
130
130
|
var n = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
131
131
|
if (n && n.isReactWarning) return !1;
|
|
132
132
|
}
|
|
133
133
|
return e.key !== void 0;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function _(e, n) {
|
|
136
136
|
function l() {
|
|
137
|
-
|
|
137
|
+
k || (k = !0, console.error(
|
|
138
138
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
139
|
n
|
|
140
140
|
));
|
|
@@ -144,23 +144,23 @@ function ue() {
|
|
|
144
144
|
configurable: !0
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
var e =
|
|
149
|
-
return
|
|
147
|
+
function D() {
|
|
148
|
+
var e = f(this.type);
|
|
149
|
+
return G[e] || (G[e] = !0, console.error(
|
|
150
150
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
151
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
152
152
|
}
|
|
153
|
-
function q(e, n, l, u,
|
|
154
|
-
var
|
|
153
|
+
function q(e, n, l, u, O, $) {
|
|
154
|
+
var t = l.ref;
|
|
155
155
|
return e = {
|
|
156
|
-
$$typeof:
|
|
156
|
+
$$typeof: W,
|
|
157
157
|
type: e,
|
|
158
158
|
key: n,
|
|
159
159
|
props: l,
|
|
160
160
|
_owner: u
|
|
161
|
-
}, (
|
|
161
|
+
}, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", {
|
|
162
162
|
enumerable: !1,
|
|
163
|
-
get:
|
|
163
|
+
get: D
|
|
164
164
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
165
165
|
configurable: !1,
|
|
166
166
|
enumerable: !1,
|
|
@@ -175,33 +175,33 @@ function ue() {
|
|
|
175
175
|
configurable: !1,
|
|
176
176
|
enumerable: !1,
|
|
177
177
|
writable: !0,
|
|
178
|
-
value:
|
|
178
|
+
value: O
|
|
179
179
|
}), Object.defineProperty(e, "_debugTask", {
|
|
180
180
|
configurable: !1,
|
|
181
181
|
enumerable: !1,
|
|
182
182
|
writable: !0,
|
|
183
|
-
value:
|
|
183
|
+
value: $
|
|
184
184
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
185
185
|
}
|
|
186
|
-
function F(e, n, l, u,
|
|
187
|
-
var
|
|
188
|
-
if (
|
|
186
|
+
function F(e, n, l, u, O, $) {
|
|
187
|
+
var t = n.children;
|
|
188
|
+
if (t !== void 0)
|
|
189
189
|
if (u)
|
|
190
|
-
if (
|
|
191
|
-
for (u = 0; u <
|
|
192
|
-
I(
|
|
193
|
-
Object.freeze && Object.freeze(
|
|
190
|
+
if (te(t)) {
|
|
191
|
+
for (u = 0; u < t.length; u++)
|
|
192
|
+
I(t[u]);
|
|
193
|
+
Object.freeze && Object.freeze(t);
|
|
194
194
|
} else
|
|
195
195
|
console.error(
|
|
196
196
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
197
197
|
);
|
|
198
|
-
else I(
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
var
|
|
202
|
-
return
|
|
198
|
+
else I(t);
|
|
199
|
+
if (E.call(n, "key")) {
|
|
200
|
+
t = f(e);
|
|
201
|
+
var r = Object.keys(n).filter(function(d) {
|
|
202
|
+
return d !== "key";
|
|
203
203
|
});
|
|
204
|
-
u = 0 <
|
|
204
|
+
u = 0 < r.length ? "{key: someKey, " + r.join(": ..., ") + ": ...}" : "{key: someKey}", X[t + u] || (r = 0 < r.length ? "{" + r.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
205
205
|
`A props object containing a "key" prop is being spread into JSX:
|
|
206
206
|
let props = %s;
|
|
207
207
|
<%s {...props} />
|
|
@@ -209,35 +209,35 @@ React keys must be passed directly to JSX without using spread:
|
|
|
209
209
|
let props = %s;
|
|
210
210
|
<%s key={someKey} {...props} />`,
|
|
211
211
|
u,
|
|
212
|
+
t,
|
|
212
213
|
r,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
), M[r + u] = !0);
|
|
214
|
+
t
|
|
215
|
+
), X[t + u] = !0);
|
|
216
216
|
}
|
|
217
|
-
if (
|
|
217
|
+
if (t = null, l !== void 0 && (m(l), t = "" + l), v(n) && (m(n.key), t = "" + n.key), "key" in n) {
|
|
218
218
|
l = {};
|
|
219
|
-
for (var
|
|
220
|
-
|
|
219
|
+
for (var a in n)
|
|
220
|
+
a !== "key" && (l[a] = n[a]);
|
|
221
221
|
} else l = n;
|
|
222
|
-
return
|
|
222
|
+
return t && _(
|
|
223
223
|
l,
|
|
224
224
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
225
225
|
), q(
|
|
226
226
|
e,
|
|
227
|
-
|
|
227
|
+
t,
|
|
228
228
|
l,
|
|
229
229
|
o(),
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
O,
|
|
231
|
+
$
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
234
|
function I(e) {
|
|
235
|
-
|
|
235
|
+
b(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === C && (e._payload.status === "fulfilled" ? b(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
236
236
|
}
|
|
237
|
-
function
|
|
238
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
237
|
+
function b(e) {
|
|
238
|
+
return typeof e == "object" && e !== null && e.$$typeof === W;
|
|
239
239
|
}
|
|
240
|
-
var A =
|
|
240
|
+
var A = ce, W = Symbol.for("react.transitional.element"), K = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), V = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), w = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), S = Symbol.for("react.suspense"), J = Symbol.for("react.suspense_list"), M = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), H = Symbol.for("react.activity"), ee = Symbol.for("react.client.reference"), T = A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, E = Object.prototype.hasOwnProperty, te = Array.isArray, x = console.createTask ? console.createTask : function() {
|
|
241
241
|
return null;
|
|
242
242
|
};
|
|
243
243
|
A = {
|
|
@@ -245,103 +245,92 @@ React keys must be passed directly to JSX without using spread:
|
|
|
245
245
|
return e();
|
|
246
246
|
}
|
|
247
247
|
};
|
|
248
|
-
var
|
|
248
|
+
var k, G = {}, Y = A.react_stack_bottom_frame.bind(
|
|
249
249
|
A,
|
|
250
250
|
c
|
|
251
|
-
)(),
|
|
252
|
-
U.Fragment =
|
|
253
|
-
var u = 1e4 >
|
|
251
|
+
)(), j = x(s(c)), X = {};
|
|
252
|
+
U.Fragment = y, U.jsx = function(e, n, l) {
|
|
253
|
+
var u = 1e4 > T.recentlyCreatedOwnerStacks++;
|
|
254
254
|
return F(
|
|
255
255
|
e,
|
|
256
256
|
n,
|
|
257
257
|
l,
|
|
258
258
|
!1,
|
|
259
|
-
u ? Error("react-stack-top-frame") :
|
|
260
|
-
u ?
|
|
259
|
+
u ? Error("react-stack-top-frame") : Y,
|
|
260
|
+
u ? x(s(e)) : j
|
|
261
261
|
);
|
|
262
262
|
}, U.jsxs = function(e, n, l) {
|
|
263
|
-
var u = 1e4 >
|
|
263
|
+
var u = 1e4 > T.recentlyCreatedOwnerStacks++;
|
|
264
264
|
return F(
|
|
265
265
|
e,
|
|
266
266
|
n,
|
|
267
267
|
l,
|
|
268
268
|
!0,
|
|
269
|
-
u ? Error("react-stack-top-frame") :
|
|
270
|
-
u ?
|
|
269
|
+
u ? Error("react-stack-top-frame") : Y,
|
|
270
|
+
u ? x(s(e)) : j
|
|
271
271
|
);
|
|
272
272
|
};
|
|
273
273
|
})()), U;
|
|
274
274
|
}
|
|
275
275
|
var ae;
|
|
276
|
-
function
|
|
277
|
-
return ae || (ae = 1, process.env.NODE_ENV === "production" ?
|
|
276
|
+
function me() {
|
|
277
|
+
return ae || (ae = 1, process.env.NODE_ENV === "production" ? Q.exports = fe() : Q.exports = pe()), Q.exports;
|
|
278
278
|
}
|
|
279
|
-
var
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
value: i,
|
|
299
|
-
onChange: (g) => c(g.target.value),
|
|
300
|
-
disabled: E,
|
|
301
|
-
placeholder: "Type your full name",
|
|
302
|
-
style: {
|
|
303
|
-
width: "100%",
|
|
304
|
-
padding: "12px",
|
|
305
|
-
fontSize: "18px",
|
|
306
|
-
fontFamily: "cursive",
|
|
307
|
-
borderBottom: "2px solid #333"
|
|
308
|
-
}
|
|
279
|
+
var p = me();
|
|
280
|
+
const ge = ({
|
|
281
|
+
value: f,
|
|
282
|
+
onChange: g,
|
|
283
|
+
isDisabled: m,
|
|
284
|
+
label: s
|
|
285
|
+
}) => /* @__PURE__ */ p.jsxs("div", { className: "superdoc-esign-signature-input", style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
286
|
+
s && /* @__PURE__ */ p.jsx("label", { children: s }),
|
|
287
|
+
/* @__PURE__ */ p.jsx(
|
|
288
|
+
"input",
|
|
289
|
+
{
|
|
290
|
+
type: "text",
|
|
291
|
+
value: String(f || ""),
|
|
292
|
+
onChange: (o) => g(o.target.value),
|
|
293
|
+
disabled: m,
|
|
294
|
+
placeholder: "Type your full name",
|
|
295
|
+
style: {
|
|
296
|
+
fontFamily: "cursive",
|
|
297
|
+
fontSize: "18px"
|
|
309
298
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
},
|
|
313
|
-
value:
|
|
314
|
-
onChange:
|
|
315
|
-
isDisabled:
|
|
316
|
-
label:
|
|
317
|
-
}) => /* @__PURE__ */
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
] }), ve = ({
|
|
302
|
+
value: f,
|
|
303
|
+
onChange: g,
|
|
304
|
+
isDisabled: m,
|
|
305
|
+
label: s
|
|
306
|
+
}) => /* @__PURE__ */ p.jsxs(
|
|
318
307
|
"label",
|
|
319
308
|
{
|
|
320
|
-
className: "superdoc-esign-
|
|
309
|
+
className: "superdoc-esign-checkbox-input",
|
|
321
310
|
style: { display: "flex", gap: "8px" },
|
|
322
311
|
children: [
|
|
323
|
-
/* @__PURE__ */
|
|
312
|
+
/* @__PURE__ */ p.jsx(
|
|
324
313
|
"input",
|
|
325
314
|
{
|
|
326
315
|
type: "checkbox",
|
|
327
|
-
checked: !!
|
|
328
|
-
onChange: (o) =>
|
|
329
|
-
disabled:
|
|
316
|
+
checked: !!f,
|
|
317
|
+
onChange: (o) => g(o.target.checked),
|
|
318
|
+
disabled: m
|
|
330
319
|
}
|
|
331
320
|
),
|
|
332
|
-
/* @__PURE__ */
|
|
321
|
+
/* @__PURE__ */ p.jsx("span", { children: s })
|
|
333
322
|
]
|
|
334
323
|
}
|
|
335
|
-
),
|
|
336
|
-
onClick:
|
|
337
|
-
fileName:
|
|
324
|
+
), be = (f) => ({
|
|
325
|
+
onClick: m,
|
|
326
|
+
fileName: s,
|
|
338
327
|
isDisabled: o
|
|
339
328
|
}) => {
|
|
340
|
-
const c =
|
|
341
|
-
return /* @__PURE__ */
|
|
329
|
+
const c = f?.label || "Download";
|
|
330
|
+
return /* @__PURE__ */ p.jsxs(
|
|
342
331
|
"button",
|
|
343
332
|
{
|
|
344
|
-
onClick:
|
|
333
|
+
onClick: m,
|
|
345
334
|
disabled: o,
|
|
346
335
|
className: "superdoc-esign-btn",
|
|
347
336
|
style: {
|
|
@@ -358,22 +347,22 @@ const fe = ({
|
|
|
358
347
|
children: [
|
|
359
348
|
c,
|
|
360
349
|
" ",
|
|
361
|
-
|
|
350
|
+
s && `(${s})`
|
|
362
351
|
]
|
|
363
352
|
}
|
|
364
353
|
);
|
|
365
|
-
},
|
|
366
|
-
onClick:
|
|
367
|
-
isValid:
|
|
354
|
+
}, he = (f) => ({
|
|
355
|
+
onClick: m,
|
|
356
|
+
isValid: s,
|
|
368
357
|
isDisabled: o,
|
|
369
358
|
isSubmitting: c
|
|
370
359
|
}) => {
|
|
371
|
-
const
|
|
372
|
-
return /* @__PURE__ */
|
|
360
|
+
const v = () => f?.label || "Submit";
|
|
361
|
+
return /* @__PURE__ */ p.jsx(
|
|
373
362
|
"button",
|
|
374
363
|
{
|
|
375
|
-
onClick:
|
|
376
|
-
disabled: !
|
|
364
|
+
onClick: m,
|
|
365
|
+
disabled: !s || o || c,
|
|
377
366
|
className: "superdoc-esign-btn",
|
|
378
367
|
style: {
|
|
379
368
|
padding: "12px 24px",
|
|
@@ -381,286 +370,284 @@ const fe = ({
|
|
|
381
370
|
border: "none",
|
|
382
371
|
background: "#007bff",
|
|
383
372
|
color: "#fff",
|
|
384
|
-
cursor: !
|
|
385
|
-
opacity: !
|
|
373
|
+
cursor: !s || o ? "not-allowed" : "pointer",
|
|
374
|
+
opacity: !s || o ? 0.5 : 1,
|
|
386
375
|
fontSize: "16px",
|
|
387
376
|
fontWeight: "bold"
|
|
388
377
|
},
|
|
389
|
-
children:
|
|
378
|
+
children: v()
|
|
390
379
|
}
|
|
391
380
|
);
|
|
392
|
-
},
|
|
393
|
-
(
|
|
381
|
+
}, Ee = ue(
|
|
382
|
+
(f, g) => {
|
|
394
383
|
const {
|
|
395
|
-
eventId:
|
|
396
|
-
document:
|
|
384
|
+
eventId: m,
|
|
385
|
+
document: s,
|
|
397
386
|
fields: o = {},
|
|
398
387
|
download: c,
|
|
399
|
-
submit:
|
|
400
|
-
onSubmit:
|
|
401
|
-
onDownload:
|
|
388
|
+
submit: v,
|
|
389
|
+
onSubmit: _,
|
|
390
|
+
onDownload: D,
|
|
402
391
|
onStateChange: q,
|
|
403
392
|
onFieldChange: F,
|
|
404
393
|
onFieldsDiscovered: I,
|
|
405
|
-
isDisabled:
|
|
394
|
+
isDisabled: b = !1,
|
|
406
395
|
className: A,
|
|
407
|
-
style:
|
|
408
|
-
documentHeight:
|
|
409
|
-
} =
|
|
410
|
-
!
|
|
411
|
-
), [
|
|
412
|
-
|
|
413
|
-
const
|
|
414
|
-
if (!
|
|
415
|
-
const r =
|
|
416
|
-
|
|
417
|
-
|
|
396
|
+
style: W,
|
|
397
|
+
documentHeight: K = "600px"
|
|
398
|
+
} = f, [y, V] = N(
|
|
399
|
+
!s.validation?.scroll?.required
|
|
400
|
+
), [h, z] = N(/* @__PURE__ */ new Map()), [w, B] = N(!1), [S, J] = N(!1), [M, C] = N([]), [H, ee] = N(!1), T = Z(null), E = Z(null), te = Z(Date.now()), x = Z(o);
|
|
401
|
+
x.current = o;
|
|
402
|
+
const k = P((t) => {
|
|
403
|
+
if (!E.current?.activeEditor) return;
|
|
404
|
+
const r = E.current.activeEditor, a = x.current.signer?.find((i) => i.id === t.id);
|
|
405
|
+
let d;
|
|
406
|
+
a?.type === "signature" && t.value ? d = {
|
|
418
407
|
json: {
|
|
419
408
|
type: "image",
|
|
420
|
-
attrs: {
|
|
421
|
-
src: t.value,
|
|
422
|
-
alt: "Signature"
|
|
423
|
-
}
|
|
409
|
+
attrs: { src: typeof t.value == "string" && t.value.startsWith("data:image/") ? t.value : G(String(t.value)), alt: "Signature" }
|
|
424
410
|
}
|
|
425
|
-
} : { text: String(t.value ?? "") }
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
v
|
|
411
|
+
} : d = { text: String(t.value ?? "") }, t.id && r.commands.updateStructuredContentById(
|
|
412
|
+
t.id,
|
|
413
|
+
d
|
|
429
414
|
);
|
|
430
|
-
}, [])
|
|
415
|
+
}, []);
|
|
416
|
+
function G(t) {
|
|
417
|
+
const r = globalThis.document.createElement("canvas"), a = r.getContext("2d"), d = 30;
|
|
418
|
+
a.font = `italic ${d}px cursive`;
|
|
419
|
+
const R = a.measureText(t).width, se = d * 1.3, ie = 4, le = 6;
|
|
420
|
+
return r.width = Math.ceil(R + ie * 2) + 20, r.height = Math.ceil(se + le * 2), a.font = `italic ${d}px cursive`, a.fillStyle = "black", a.textAlign = "center", a.textBaseline = "middle", a.fillText(
|
|
421
|
+
t,
|
|
422
|
+
r.width / 2,
|
|
423
|
+
r.height / 2
|
|
424
|
+
), r.toDataURL("image/png");
|
|
425
|
+
}
|
|
426
|
+
const Y = P(
|
|
431
427
|
(t) => {
|
|
432
428
|
if (!t) return;
|
|
433
429
|
const r = t.helpers.structuredContentCommands.getStructuredContentTags(
|
|
434
430
|
t.state
|
|
435
|
-
),
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}),
|
|
439
|
-
|
|
431
|
+
), a = /* @__PURE__ */ new Map();
|
|
432
|
+
x.current.document?.forEach((i) => {
|
|
433
|
+
i.id && a.set(i.id, i.value);
|
|
434
|
+
}), x.current.signer?.forEach((i) => {
|
|
435
|
+
i.value !== void 0 && a.set(i.id, i.value);
|
|
440
436
|
});
|
|
441
|
-
const
|
|
442
|
-
id:
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
...
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
alias: _.alias,
|
|
454
|
-
value: _.value
|
|
437
|
+
const d = r.map(({ node: i }) => ({
|
|
438
|
+
id: i.attrs.id,
|
|
439
|
+
label: i.attrs.label,
|
|
440
|
+
value: a.get(i.attrs.id) ?? i.textContent ?? ""
|
|
441
|
+
})).filter((i) => i.id);
|
|
442
|
+
d.length > 0 && (I?.(d), [
|
|
443
|
+
...x.current.document || [],
|
|
444
|
+
...x.current.signer || []
|
|
445
|
+
].filter((R) => R.value !== void 0).forEach(
|
|
446
|
+
(R) => k({
|
|
447
|
+
id: R.id,
|
|
448
|
+
value: R.value
|
|
455
449
|
})
|
|
456
450
|
));
|
|
457
451
|
},
|
|
458
|
-
[I,
|
|
459
|
-
),
|
|
452
|
+
[I, k]
|
|
453
|
+
), j = (t) => {
|
|
460
454
|
const r = {
|
|
461
455
|
...t,
|
|
462
456
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
463
457
|
};
|
|
464
|
-
|
|
458
|
+
C((a) => [...a, r]);
|
|
465
459
|
};
|
|
466
|
-
|
|
467
|
-
const { SuperDoc: r } = await import("superdoc"),
|
|
468
|
-
selector:
|
|
469
|
-
document:
|
|
460
|
+
re(() => T.current ? ((async () => {
|
|
461
|
+
const { SuperDoc: r } = await import("superdoc"), a = new r({
|
|
462
|
+
selector: T.current,
|
|
463
|
+
document: s.source,
|
|
470
464
|
documentMode: "viewing",
|
|
471
465
|
onReady: () => {
|
|
472
|
-
|
|
466
|
+
a.activeEditor && Y(a.activeEditor), j({ type: "ready" }), ee(!0);
|
|
473
467
|
}
|
|
474
468
|
});
|
|
475
|
-
|
|
469
|
+
E.current = a;
|
|
476
470
|
})(), () => {
|
|
477
|
-
|
|
478
|
-
}) : void 0, [
|
|
479
|
-
if (!
|
|
480
|
-
const t =
|
|
471
|
+
E.current && (E.current.destroy(), E.current = null);
|
|
472
|
+
}) : void 0, [s.source, s.mode, Y]), re(() => {
|
|
473
|
+
if (!s.validation?.scroll?.required || !H) return;
|
|
474
|
+
const t = T.current;
|
|
481
475
|
if (!t) return;
|
|
482
476
|
const r = () => {
|
|
483
|
-
const { scrollTop:
|
|
484
|
-
(
|
|
477
|
+
const { scrollTop: a, scrollHeight: d, clientHeight: i } = t, R = a / (d - i);
|
|
478
|
+
(R >= 0.95 || d <= i) && (V(!0), j({
|
|
485
479
|
type: "scroll",
|
|
486
|
-
data: { percent: Math.round(
|
|
480
|
+
data: { percent: Math.round(R * 100) }
|
|
487
481
|
}));
|
|
488
482
|
};
|
|
489
483
|
return t.addEventListener("scroll", r), r(), () => t.removeEventListener("scroll", r);
|
|
490
|
-
}, [
|
|
491
|
-
const
|
|
484
|
+
}, [s.validation?.scroll?.required, H]);
|
|
485
|
+
const X = P(
|
|
492
486
|
(t, r) => {
|
|
493
|
-
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
const _ = h.current.signer?.find(
|
|
497
|
-
(oe) => oe.id === t
|
|
498
|
-
);
|
|
499
|
-
return j({
|
|
487
|
+
z((a) => {
|
|
488
|
+
const d = a.get(t), i = new Map(a);
|
|
489
|
+
return i.set(t, r), k({
|
|
500
490
|
id: t,
|
|
501
|
-
alias: _?.alias,
|
|
502
491
|
value: r
|
|
503
|
-
}),
|
|
492
|
+
}), j({
|
|
504
493
|
type: "field_change",
|
|
505
|
-
data: { fieldId: t, value: r, previousValue:
|
|
494
|
+
data: { fieldId: t, value: r, previousValue: d }
|
|
506
495
|
}), F?.({
|
|
507
496
|
id: t,
|
|
508
497
|
value: r,
|
|
509
|
-
previousValue:
|
|
510
|
-
}),
|
|
498
|
+
previousValue: d
|
|
499
|
+
}), i;
|
|
511
500
|
});
|
|
512
501
|
},
|
|
513
|
-
[F,
|
|
514
|
-
),
|
|
502
|
+
[F, k]
|
|
503
|
+
), e = P(() => s.validation?.scroll?.required && !y ? !1 : (o.signer || []).every((t) => {
|
|
515
504
|
if (!t.validation?.required) return !0;
|
|
516
|
-
const r =
|
|
505
|
+
const r = h.get(t.id);
|
|
517
506
|
return r && (typeof r != "string" || r.trim());
|
|
518
|
-
}), [
|
|
519
|
-
|
|
520
|
-
const t =
|
|
521
|
-
|
|
522
|
-
scrolled:
|
|
523
|
-
fields:
|
|
507
|
+
}), [y, o.signer, h, s.validation?.scroll?.required]);
|
|
508
|
+
re(() => {
|
|
509
|
+
const t = e();
|
|
510
|
+
B(t), q?.({
|
|
511
|
+
scrolled: y,
|
|
512
|
+
fields: h,
|
|
524
513
|
isValid: t,
|
|
525
|
-
isSubmitting:
|
|
514
|
+
isSubmitting: S
|
|
526
515
|
});
|
|
527
|
-
}, [
|
|
528
|
-
const
|
|
529
|
-
if (
|
|
530
|
-
const t = await
|
|
516
|
+
}, [y, h, S, e, q]);
|
|
517
|
+
const n = P(async () => {
|
|
518
|
+
if (b) return;
|
|
519
|
+
const t = await E.current?.export({
|
|
531
520
|
exportType: ["pdf"],
|
|
532
521
|
isFinalDoc: !0,
|
|
533
522
|
triggerDownload: !1
|
|
534
523
|
});
|
|
535
|
-
if (t &&
|
|
536
|
-
|
|
524
|
+
if (t && D)
|
|
525
|
+
D(t, c?.fileName || "document.pdf");
|
|
537
526
|
else if (t) {
|
|
538
|
-
const r = URL.createObjectURL(t),
|
|
539
|
-
|
|
527
|
+
const r = URL.createObjectURL(t), a = globalThis.document.createElement("a");
|
|
528
|
+
a.href = r, a.download = c?.fileName || "document.pdf", a.click(), URL.revokeObjectURL(r);
|
|
540
529
|
}
|
|
541
|
-
}, [
|
|
542
|
-
if (!
|
|
543
|
-
J(!0),
|
|
530
|
+
}, [b, c, D]), l = P(async () => {
|
|
531
|
+
if (!w || b || S) return;
|
|
532
|
+
J(!0), j({ type: "submit" });
|
|
544
533
|
const t = {
|
|
545
|
-
eventId:
|
|
534
|
+
eventId: m,
|
|
546
535
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
547
|
-
duration: Math.floor((Date.now() -
|
|
548
|
-
auditTrail:
|
|
536
|
+
duration: Math.floor((Date.now() - te.current) / 1e3),
|
|
537
|
+
auditTrail: M,
|
|
549
538
|
documentFields: o.document || [],
|
|
550
539
|
signerFields: (o.signer || []).map((r) => ({
|
|
551
540
|
id: r.id,
|
|
552
|
-
|
|
553
|
-
value: y.get(r.id) ?? null
|
|
541
|
+
value: h.get(r.id) ?? null
|
|
554
542
|
})),
|
|
555
|
-
isFullyCompleted:
|
|
543
|
+
isFullyCompleted: w
|
|
556
544
|
};
|
|
557
545
|
try {
|
|
558
|
-
await
|
|
546
|
+
await _(t);
|
|
559
547
|
} finally {
|
|
560
548
|
J(!1);
|
|
561
549
|
}
|
|
562
550
|
}, [
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
551
|
+
w,
|
|
552
|
+
b,
|
|
553
|
+
S,
|
|
554
|
+
m,
|
|
555
|
+
M,
|
|
568
556
|
o,
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
]),
|
|
572
|
-
const r = t.component ||
|
|
573
|
-
return /* @__PURE__ */
|
|
557
|
+
h,
|
|
558
|
+
_
|
|
559
|
+
]), u = (t) => {
|
|
560
|
+
const r = t.component || O(t.type);
|
|
561
|
+
return /* @__PURE__ */ p.jsx(
|
|
574
562
|
r,
|
|
575
563
|
{
|
|
576
|
-
value:
|
|
577
|
-
onChange: (
|
|
578
|
-
isDisabled:
|
|
564
|
+
value: h.get(t.id) ?? null,
|
|
565
|
+
onChange: (a) => X(t.id, a),
|
|
566
|
+
isDisabled: b,
|
|
579
567
|
label: t.label
|
|
580
568
|
},
|
|
581
569
|
t.id
|
|
582
570
|
);
|
|
583
|
-
},
|
|
571
|
+
}, O = (t) => {
|
|
584
572
|
switch (t) {
|
|
585
573
|
case "signature":
|
|
586
574
|
case "text":
|
|
587
|
-
return
|
|
588
|
-
case "consent":
|
|
575
|
+
return ge;
|
|
589
576
|
case "checkbox":
|
|
590
|
-
return
|
|
577
|
+
return ve;
|
|
591
578
|
}
|
|
592
|
-
},
|
|
593
|
-
const t = c?.component ||
|
|
594
|
-
return /* @__PURE__ */
|
|
579
|
+
}, $ = () => {
|
|
580
|
+
const t = c?.component || be(c), r = v?.component || he(v);
|
|
581
|
+
return /* @__PURE__ */ p.jsxs(
|
|
595
582
|
"div",
|
|
596
583
|
{
|
|
597
584
|
className: "superdoc-esign-actions",
|
|
598
585
|
style: { display: "flex", gap: "10px" },
|
|
599
586
|
children: [
|
|
600
|
-
|
|
587
|
+
s.mode !== "download" && /* @__PURE__ */ p.jsx(
|
|
601
588
|
r,
|
|
602
589
|
{
|
|
603
|
-
onClick:
|
|
604
|
-
isValid:
|
|
605
|
-
isDisabled:
|
|
606
|
-
isSubmitting:
|
|
590
|
+
onClick: l,
|
|
591
|
+
isValid: w,
|
|
592
|
+
isDisabled: b,
|
|
593
|
+
isSubmitting: S
|
|
607
594
|
}
|
|
608
595
|
),
|
|
609
|
-
/* @__PURE__ */
|
|
596
|
+
/* @__PURE__ */ p.jsx(
|
|
610
597
|
t,
|
|
611
598
|
{
|
|
612
|
-
onClick:
|
|
599
|
+
onClick: n,
|
|
613
600
|
fileName: c?.fileName,
|
|
614
|
-
isDisabled:
|
|
601
|
+
isDisabled: b
|
|
615
602
|
}
|
|
616
603
|
)
|
|
617
604
|
]
|
|
618
605
|
}
|
|
619
606
|
);
|
|
620
607
|
};
|
|
621
|
-
return
|
|
608
|
+
return de(g, () => ({
|
|
622
609
|
getState: () => ({
|
|
623
|
-
scrolled:
|
|
624
|
-
fields:
|
|
625
|
-
isValid:
|
|
626
|
-
isSubmitting:
|
|
610
|
+
scrolled: y,
|
|
611
|
+
fields: h,
|
|
612
|
+
isValid: w,
|
|
613
|
+
isSubmitting: S
|
|
627
614
|
}),
|
|
628
|
-
getAuditTrail: () =>
|
|
615
|
+
getAuditTrail: () => M,
|
|
629
616
|
reset: () => {
|
|
630
|
-
|
|
617
|
+
V(!s.validation?.scroll?.required), z(/* @__PURE__ */ new Map()), B(!1), C([]);
|
|
631
618
|
}
|
|
632
|
-
})), /* @__PURE__ */
|
|
619
|
+
})), /* @__PURE__ */ p.jsxs(
|
|
633
620
|
"div",
|
|
634
621
|
{
|
|
635
622
|
className: `superdoc-esign-container ${A || ""}`,
|
|
636
|
-
style:
|
|
623
|
+
style: W,
|
|
637
624
|
children: [
|
|
638
|
-
/* @__PURE__ */
|
|
625
|
+
/* @__PURE__ */ p.jsx("div", { className: "superdoc-esign-document", children: /* @__PURE__ */ p.jsx(
|
|
639
626
|
"div",
|
|
640
627
|
{
|
|
641
|
-
ref:
|
|
642
|
-
style: { height:
|
|
628
|
+
ref: T,
|
|
629
|
+
style: { height: K, overflow: "auto" }
|
|
643
630
|
}
|
|
644
631
|
) }),
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
-
o.signer && o.signer.length > 0 && /* @__PURE__ */
|
|
632
|
+
/* @__PURE__ */ p.jsxs("div", { className: "superdoc-esign-controls", style: { marginTop: "20px" }, children: [
|
|
633
|
+
o.signer && o.signer.length > 0 && /* @__PURE__ */ p.jsx(
|
|
647
634
|
"div",
|
|
648
635
|
{
|
|
649
636
|
className: "superdoc-esign-fields",
|
|
650
637
|
style: { marginBottom: "20px" },
|
|
651
|
-
children: o.signer.map(
|
|
638
|
+
children: o.signer.map(u)
|
|
652
639
|
}
|
|
653
640
|
),
|
|
654
|
-
|
|
641
|
+
$()
|
|
655
642
|
] })
|
|
656
643
|
]
|
|
657
644
|
}
|
|
658
645
|
);
|
|
659
646
|
}
|
|
660
647
|
);
|
|
661
|
-
|
|
648
|
+
Ee.displayName = "SuperDocESign";
|
|
662
649
|
export {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
650
|
+
ve as CheckboxInput,
|
|
651
|
+
ge as SignatureInput,
|
|
652
|
+
Ee as default
|
|
666
653
|
};
|