@schnsrw/casual-sheets 0.2.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,716 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/signing/index.ts
21
+ var signing_exports = {};
22
+ __export(signing_exports, {
23
+ DrawnSignaturePad: () => DrawnSignaturePad,
24
+ SigningPane: () => SigningPane,
25
+ SigningProvider: () => SigningProvider,
26
+ TypedSignatureField: () => TypedSignatureField,
27
+ UploadedSignatureField: () => UploadedSignatureField,
28
+ createSigningController: () => createSigningController,
29
+ useSigning: () => useSigning
30
+ });
31
+ module.exports = __toCommonJS(signing_exports);
32
+
33
+ // src/signing/SigningProvider.tsx
34
+ var import_react = require("react");
35
+
36
+ // src/signing/controller.ts
37
+ function createSigningController(fields, mode) {
38
+ if (fields.length === 0) {
39
+ throw new Error("createSigningController: at least one field required");
40
+ }
41
+ const fieldIds = new Set(fields.map((f) => f.fieldId));
42
+ if (fieldIds.size !== fields.length) {
43
+ throw new Error("createSigningController: duplicate fieldId");
44
+ }
45
+ const signed = {};
46
+ let activeFieldIndex = nextRequiredIndex(fields, signed);
47
+ let isComplete = false;
48
+ let isCancelled = false;
49
+ const listeners = /* @__PURE__ */ new Set();
50
+ function emit() {
51
+ const snap = snapshotInternal();
52
+ for (const l of listeners) l(snap);
53
+ }
54
+ function snapshotInternal() {
55
+ return {
56
+ fields,
57
+ mode,
58
+ signed: { ...signed },
59
+ activeFieldIndex,
60
+ canComplete: allRequiredSigned(fields, signed),
61
+ isComplete,
62
+ isCancelled
63
+ };
64
+ }
65
+ return {
66
+ snapshot: snapshotInternal,
67
+ subscribe(listener) {
68
+ listeners.add(listener);
69
+ return () => {
70
+ listeners.delete(listener);
71
+ };
72
+ },
73
+ signField(payload) {
74
+ if (isComplete || isCancelled) return;
75
+ if (!fieldIds.has(payload.fieldId)) {
76
+ throw new Error(`signField: unknown fieldId ${payload.fieldId}`);
77
+ }
78
+ signed[payload.fieldId] = payload;
79
+ activeFieldIndex = nextRequiredIndex(fields, signed);
80
+ emit();
81
+ },
82
+ focusField(fieldId) {
83
+ if (isComplete || isCancelled) return;
84
+ const idx = fields.findIndex((f) => f.fieldId === fieldId);
85
+ if (idx < 0) return;
86
+ if (mode === "sequential") {
87
+ const next = nextRequiredIndex(fields, signed);
88
+ if (idx !== next) return;
89
+ }
90
+ activeFieldIndex = idx;
91
+ emit();
92
+ },
93
+ complete() {
94
+ if (!allRequiredSigned(fields, signed)) {
95
+ throw new Error("complete: required fields are still unsigned");
96
+ }
97
+ isComplete = true;
98
+ activeFieldIndex = -1;
99
+ emit();
100
+ return snapshotInternal();
101
+ },
102
+ cancel() {
103
+ if (isComplete || isCancelled) return;
104
+ isCancelled = true;
105
+ activeFieldIndex = -1;
106
+ emit();
107
+ }
108
+ };
109
+ }
110
+ function allRequiredSigned(fields, signed) {
111
+ return fields.every((f) => !f.required || signed[f.fieldId] !== void 0);
112
+ }
113
+ function nextRequiredIndex(fields, signed) {
114
+ for (let i = 0; i < fields.length; i++) {
115
+ if (fields[i].required && !signed[fields[i].fieldId]) return i;
116
+ }
117
+ for (let i = 0; i < fields.length; i++) {
118
+ if (!signed[fields[i].fieldId]) return i;
119
+ }
120
+ return -1;
121
+ }
122
+
123
+ // src/signing/SigningProvider.tsx
124
+ var import_jsx_runtime = require("react/jsx-runtime");
125
+ var SigningContext = (0, import_react.createContext)(null);
126
+ function SigningProvider({ session, documentBytes, children }) {
127
+ if (!session) {
128
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
129
+ }
130
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SigningProviderInner, { session, documentBytes, children });
131
+ }
132
+ function SigningProviderInner({
133
+ session,
134
+ documentBytes,
135
+ children
136
+ }) {
137
+ const controller = (0, import_react.useMemo)(
138
+ () => createSigningController(session.fields, session.mode),
139
+ // eslint-disable-next-line react-hooks/exhaustive-deps
140
+ [session.fields, session.mode]
141
+ );
142
+ const [snapshot, setSnapshot] = (0, import_react.useState)(() => controller.snapshot());
143
+ (0, import_react.useEffect)(() => {
144
+ const unsub = controller.subscribe(setSnapshot);
145
+ return unsub;
146
+ }, [controller]);
147
+ const value = (0, import_react.useMemo)(
148
+ () => ({
149
+ controller,
150
+ snapshot,
151
+ signField: async (payload) => {
152
+ controller.signField(payload);
153
+ await session.onFieldSigned?.(payload);
154
+ },
155
+ completeIfReady: async () => {
156
+ if (!controller.snapshot().canComplete) return;
157
+ const final = controller.complete();
158
+ const completePayload = {
159
+ fieldIds: final.fields.map((f) => f.fieldId).filter((id) => final.signed[id] !== void 0),
160
+ bytes: documentBytes ?? new ArrayBuffer(0),
161
+ fields: final.signed
162
+ };
163
+ await session.onComplete?.(completePayload);
164
+ },
165
+ cancel: (reason) => {
166
+ controller.cancel();
167
+ session.onCancel?.({ reason });
168
+ },
169
+ baseDocumentBytes: documentBytes
170
+ }),
171
+ [controller, snapshot, session, documentBytes]
172
+ );
173
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SigningContext.Provider, { value, children });
174
+ }
175
+ function useSigning() {
176
+ return (0, import_react.useContext)(SigningContext);
177
+ }
178
+
179
+ // src/signing/SigningPane.tsx
180
+ var import_react3 = require("react");
181
+
182
+ // src/signing/captures.tsx
183
+ var import_react2 = require("react");
184
+ var import_jsx_runtime2 = require("react/jsx-runtime");
185
+ function DrawnSignaturePad({
186
+ onCapture,
187
+ clearLabel = "Clear",
188
+ saveLabel = "Use this signature",
189
+ width = 480,
190
+ height = 160
191
+ }) {
192
+ const canvasRef = (0, import_react2.useRef)(null);
193
+ const drawingRef = (0, import_react2.useRef)(false);
194
+ const [hasInk, setHasInk] = (0, import_react2.useState)(false);
195
+ (0, import_react2.useEffect)(() => {
196
+ const canvas = canvasRef.current;
197
+ if (!canvas) return;
198
+ const ctx = canvas.getContext("2d");
199
+ if (!ctx) return;
200
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
201
+ ctx.strokeStyle = "#0f172a";
202
+ ctx.lineWidth = 2;
203
+ ctx.lineCap = "round";
204
+ ctx.lineJoin = "round";
205
+ }, []);
206
+ const start = (e) => {
207
+ const canvas = canvasRef.current;
208
+ if (!canvas) return;
209
+ const ctx = canvas.getContext("2d");
210
+ if (!ctx) return;
211
+ const { x, y } = pointerPos(e, canvas);
212
+ ctx.beginPath();
213
+ ctx.moveTo(x, y);
214
+ drawingRef.current = true;
215
+ canvas.setPointerCapture(e.pointerId);
216
+ };
217
+ const move = (e) => {
218
+ if (!drawingRef.current) return;
219
+ const canvas = canvasRef.current;
220
+ if (!canvas) return;
221
+ const ctx = canvas.getContext("2d");
222
+ if (!ctx) return;
223
+ const { x, y } = pointerPos(e, canvas);
224
+ ctx.lineTo(x, y);
225
+ ctx.stroke();
226
+ if (!hasInk) setHasInk(true);
227
+ };
228
+ const end = (e) => {
229
+ drawingRef.current = false;
230
+ canvasRef.current?.releasePointerCapture(e.pointerId);
231
+ };
232
+ const clear = () => {
233
+ const canvas = canvasRef.current;
234
+ if (!canvas) return;
235
+ const ctx = canvas.getContext("2d");
236
+ if (!ctx) return;
237
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
238
+ setHasInk(false);
239
+ };
240
+ const save = async () => {
241
+ const canvas = canvasRef.current;
242
+ if (!canvas || !hasInk) return;
243
+ const blob = await new Promise((resolve) => {
244
+ canvas.toBlob((b) => resolve(b), "image/png");
245
+ });
246
+ if (!blob) return;
247
+ const bytes = await blob.arrayBuffer();
248
+ onCapture({ bytes, mime: "image/png" });
249
+ clear();
250
+ };
251
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: padWrapStyle, "data-testid": "drawn-signature-pad", children: [
252
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
253
+ "canvas",
254
+ {
255
+ ref: canvasRef,
256
+ width,
257
+ height,
258
+ style: padCanvasStyle(width, height),
259
+ onPointerDown: start,
260
+ onPointerMove: move,
261
+ onPointerUp: end,
262
+ onPointerLeave: end,
263
+ "data-testid": "drawn-signature-canvas"
264
+ }
265
+ ),
266
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: padActionsStyle, children: [
267
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: clear, style: secondaryBtnStyle(false), children: clearLabel }),
268
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
269
+ "button",
270
+ {
271
+ type: "button",
272
+ onClick: save,
273
+ disabled: !hasInk,
274
+ style: primaryBtnStyle(!hasInk),
275
+ "data-testid": "drawn-signature-save",
276
+ children: saveLabel
277
+ }
278
+ )
279
+ ] })
280
+ ] });
281
+ }
282
+ function pointerPos(e, canvas) {
283
+ const rect = canvas.getBoundingClientRect();
284
+ const scaleX = canvas.width / rect.width;
285
+ const scaleY = canvas.height / rect.height;
286
+ return {
287
+ x: (e.clientX - rect.left) * scaleX,
288
+ y: (e.clientY - rect.top) * scaleY
289
+ };
290
+ }
291
+ function TypedSignatureField({
292
+ onCapture,
293
+ defaultText = "",
294
+ saveLabel = "Use this signature"
295
+ }) {
296
+ const [value, setValue] = (0, import_react2.useState)(defaultText);
297
+ const save = () => {
298
+ const trimmed = value.trim();
299
+ if (!trimmed) return;
300
+ const bytes = new TextEncoder().encode(trimmed).buffer;
301
+ onCapture({ bytes, mime: "text/plain" });
302
+ setValue("");
303
+ };
304
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: padWrapStyle, "data-testid": "typed-signature-field", children: [
305
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
306
+ "input",
307
+ {
308
+ type: "text",
309
+ value,
310
+ onChange: (e) => setValue(e.target.value),
311
+ placeholder: "Type your full name",
312
+ style: typedInputStyle,
313
+ "data-testid": "typed-signature-input",
314
+ autoFocus: true
315
+ }
316
+ ),
317
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: padActionsStyle, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
318
+ "button",
319
+ {
320
+ type: "button",
321
+ onClick: save,
322
+ disabled: !value.trim(),
323
+ style: primaryBtnStyle(!value.trim()),
324
+ "data-testid": "typed-signature-save",
325
+ children: saveLabel
326
+ }
327
+ ) })
328
+ ] });
329
+ }
330
+ function UploadedSignatureField({
331
+ onCapture,
332
+ accept = "image/png,image/jpeg,image/svg+xml"
333
+ }) {
334
+ const inputRef = (0, import_react2.useRef)(null);
335
+ const [fileName, setFileName] = (0, import_react2.useState)(null);
336
+ const onChange = async (e) => {
337
+ const file = e.target.files?.[0];
338
+ if (!file) return;
339
+ const bytes = await file.arrayBuffer();
340
+ onCapture({ bytes, mime: file.type || "application/octet-stream" });
341
+ setFileName(file.name);
342
+ if (inputRef.current) inputRef.current.value = "";
343
+ };
344
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: padWrapStyle, "data-testid": "uploaded-signature-field", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: uploadLabelStyle, children: [
345
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
346
+ "input",
347
+ {
348
+ ref: inputRef,
349
+ type: "file",
350
+ accept,
351
+ onChange,
352
+ style: { display: "none" },
353
+ "data-testid": "uploaded-signature-input"
354
+ }
355
+ ),
356
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: fileName ?? "Choose image\u2026" })
357
+ ] }) });
358
+ }
359
+ var padWrapStyle = {
360
+ display: "flex",
361
+ flexDirection: "column",
362
+ gap: 10
363
+ };
364
+ var padCanvasStyle = (w, h) => ({
365
+ width: w,
366
+ height: h,
367
+ maxWidth: "100%",
368
+ border: "1px dashed var(--doc-border, #cbd5e1)",
369
+ borderRadius: 8,
370
+ background: "var(--doc-surface, #fff)",
371
+ cursor: "crosshair",
372
+ touchAction: "none"
373
+ });
374
+ var padActionsStyle = {
375
+ display: "flex",
376
+ justifyContent: "flex-end",
377
+ gap: 8
378
+ };
379
+ var typedInputStyle = {
380
+ width: "100%",
381
+ padding: "10px 12px",
382
+ border: "1px solid var(--doc-border, #cbd5e1)",
383
+ borderRadius: 6,
384
+ fontSize: 18,
385
+ fontFamily: '"Caveat", "Dancing Script", "Brush Script MT", cursive',
386
+ background: "var(--doc-surface, #fff)",
387
+ color: "var(--doc-text, #0f172a)"
388
+ };
389
+ var uploadLabelStyle = {
390
+ display: "inline-flex",
391
+ padding: "8px 14px",
392
+ border: "1px dashed var(--doc-border, #cbd5e1)",
393
+ borderRadius: 6,
394
+ background: "var(--doc-surface, #fff)",
395
+ color: "var(--doc-text, #0f172a)",
396
+ fontSize: 13,
397
+ cursor: "pointer",
398
+ alignSelf: "flex-start"
399
+ };
400
+ function primaryBtnStyle(disabled) {
401
+ return {
402
+ padding: "8px 16px",
403
+ borderRadius: 6,
404
+ border: "1px solid transparent",
405
+ background: disabled ? "var(--doc-border, #cbd5e1)" : "var(--doc-accent, #2563eb)",
406
+ color: disabled ? "var(--doc-text-muted, #64748b)" : "#fff",
407
+ fontSize: 13,
408
+ fontWeight: 600,
409
+ cursor: disabled ? "not-allowed" : "pointer",
410
+ fontFamily: "inherit"
411
+ };
412
+ }
413
+ function secondaryBtnStyle(disabled) {
414
+ return {
415
+ padding: "8px 16px",
416
+ borderRadius: 6,
417
+ border: "1px solid var(--doc-border, #cbd5e1)",
418
+ background: "transparent",
419
+ color: "var(--doc-text, #0f172a)",
420
+ fontSize: 13,
421
+ fontWeight: 500,
422
+ cursor: disabled ? "not-allowed" : "pointer",
423
+ fontFamily: "inherit"
424
+ };
425
+ }
426
+
427
+ // src/signing/SigningPane.tsx
428
+ var import_jsx_runtime3 = require("react/jsx-runtime");
429
+ function SigningPane({ banner, testId = "signing-pane" }) {
430
+ const ctx = useSigning();
431
+ if (!ctx) return null;
432
+ const { snapshot, signField, completeIfReady, cancel } = ctx;
433
+ if (snapshot.isComplete || snapshot.isCancelled) return null;
434
+ const active = snapshot.activeFieldIndex >= 0 ? snapshot.fields[snapshot.activeFieldIndex] : null;
435
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("aside", { style: paneStyle, role: "region", "aria-label": "Signing pane", "data-testid": testId, children: [
436
+ banner && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: bannerStyle, "data-testid": `${testId}-banner`, children: banner }),
437
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: listStyle, "data-testid": `${testId}-fields`, children: snapshot.fields.map((f, i) => {
438
+ const isSigned = !!snapshot.signed[f.fieldId];
439
+ const isActive = i === snapshot.activeFieldIndex;
440
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
441
+ "div",
442
+ {
443
+ style: listItemStyle(isActive, isSigned),
444
+ "data-testid": `${testId}-field-${f.fieldId}`,
445
+ "data-state": isSigned ? "signed" : isActive ? "active" : "pending",
446
+ children: [
447
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: listIconStyle(isSigned), "aria-hidden": "true", children: isSigned ? "\u2713" : i + 1 }),
448
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: listLabelStyle, children: f.label }),
449
+ !f.required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: optionalChipStyle, "aria-label": "Optional", children: "optional" })
450
+ ]
451
+ },
452
+ f.fieldId
453
+ );
454
+ }) }),
455
+ active && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
456
+ ActiveFieldEditor,
457
+ {
458
+ field: active,
459
+ testId,
460
+ onCapture: async (cap, method) => {
461
+ const payload = {
462
+ fieldId: active.fieldId,
463
+ method,
464
+ bytes: cap.bytes,
465
+ mime: cap.mime,
466
+ signedAt: (/* @__PURE__ */ new Date()).toISOString()
467
+ };
468
+ await signField(payload);
469
+ }
470
+ }
471
+ ),
472
+ !active && snapshot.canComplete && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: completeBlockStyle, "data-testid": `${testId}-complete-block`, children: "All required signatures collected. Ready to finalise." }),
473
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("footer", { style: footerStyle, children: [
474
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
475
+ "button",
476
+ {
477
+ type: "button",
478
+ onClick: () => cancel("signer_cancelled"),
479
+ style: secondaryBtnStyle2(),
480
+ "data-testid": `${testId}-cancel`,
481
+ children: "Cancel"
482
+ }
483
+ ),
484
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
485
+ "button",
486
+ {
487
+ type: "button",
488
+ onClick: () => void completeIfReady(),
489
+ disabled: !snapshot.canComplete,
490
+ style: primaryBtnStyle2(!snapshot.canComplete),
491
+ "data-testid": `${testId}-complete`,
492
+ children: "Complete"
493
+ }
494
+ )
495
+ ] })
496
+ ] });
497
+ }
498
+ function ActiveFieldEditor({
499
+ field,
500
+ testId,
501
+ onCapture
502
+ }) {
503
+ const [method, setMethod] = (0, import_react3.useState)(field.methods[0]);
504
+ (0, import_react3.useEffect)(() => {
505
+ setMethod(field.methods[0]);
506
+ }, [field]);
507
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: editorStyle, "data-testid": `${testId}-editor`, children: [
508
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: editorHeaderStyle, children: [
509
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: editorLabelStyle, children: field.label }),
510
+ field.signer?.name && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: editorSignerStyle, children: field.signer.name })
511
+ ] }),
512
+ field.methods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: methodTabsStyle, role: "tablist", "data-testid": `${testId}-methods`, children: field.methods.map((m) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
513
+ "button",
514
+ {
515
+ type: "button",
516
+ role: "tab",
517
+ "aria-selected": method === m,
518
+ onClick: () => setMethod(m),
519
+ style: methodTabStyle(method === m),
520
+ "data-testid": `${testId}-method-${m}`,
521
+ children: methodLabel(m)
522
+ },
523
+ m
524
+ )) }),
525
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: captureWrapStyle, children: [
526
+ method === "drawn" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DrawnSignaturePad, { onCapture: (c) => onCapture(c, "drawn") }),
527
+ method === "typed" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
528
+ TypedSignatureField,
529
+ {
530
+ defaultText: field.signer?.name ?? "",
531
+ onCapture: (c) => onCapture(c, "typed")
532
+ }
533
+ ),
534
+ method === "uploaded" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(UploadedSignatureField, { onCapture: (c) => onCapture(c, "uploaded") })
535
+ ] })
536
+ ] });
537
+ }
538
+ function methodLabel(m) {
539
+ switch (m) {
540
+ case "drawn":
541
+ return "Draw";
542
+ case "typed":
543
+ return "Type";
544
+ case "uploaded":
545
+ return "Upload";
546
+ }
547
+ }
548
+ var paneStyle = {
549
+ position: "fixed",
550
+ top: 16,
551
+ right: 16,
552
+ bottom: 16,
553
+ width: 360,
554
+ maxWidth: "100vw",
555
+ display: "flex",
556
+ flexDirection: "column",
557
+ gap: 14,
558
+ padding: 16,
559
+ background: "var(--doc-surface, #fff)",
560
+ border: "1px solid var(--doc-border, #cbd5e1)",
561
+ borderRadius: 12,
562
+ boxShadow: "0 1px 1px rgba(0, 0, 0, 0.04), 0 6px 24px rgba(15, 23, 42, 0.12)",
563
+ fontFamily: "inherit",
564
+ zIndex: 9e3
565
+ };
566
+ var bannerStyle = {
567
+ padding: "8px 10px",
568
+ background: "var(--doc-surface-2, #f1f5f9)",
569
+ border: "1px solid var(--doc-border-light, #e2e8f0)",
570
+ borderRadius: 6,
571
+ fontSize: 12,
572
+ color: "var(--doc-text-muted, #475569)"
573
+ };
574
+ var listStyle = {
575
+ display: "flex",
576
+ flexDirection: "column",
577
+ gap: 4
578
+ };
579
+ function listItemStyle(active, signed) {
580
+ return {
581
+ display: "flex",
582
+ alignItems: "center",
583
+ gap: 10,
584
+ padding: "8px 10px",
585
+ borderRadius: 6,
586
+ background: active ? "var(--doc-surface-2, #f1f5f9)" : signed ? "transparent" : "transparent",
587
+ border: active ? "1px solid var(--doc-border, #cbd5e1)" : "1px solid transparent",
588
+ opacity: signed && !active ? 0.7 : 1
589
+ };
590
+ }
591
+ function listIconStyle(signed) {
592
+ return {
593
+ display: "inline-flex",
594
+ alignItems: "center",
595
+ justifyContent: "center",
596
+ width: 22,
597
+ height: 22,
598
+ borderRadius: "50%",
599
+ background: signed ? "var(--doc-accent, #2563eb)" : "var(--doc-surface-2, #f1f5f9)",
600
+ color: signed ? "#fff" : "var(--doc-text-muted, #475569)",
601
+ fontSize: 12,
602
+ fontWeight: 600,
603
+ flexShrink: 0
604
+ };
605
+ }
606
+ var listLabelStyle = {
607
+ flex: 1,
608
+ fontSize: 13,
609
+ color: "var(--doc-text, #0f172a)",
610
+ fontWeight: 500
611
+ };
612
+ var optionalChipStyle = {
613
+ fontSize: 11,
614
+ color: "var(--doc-text-muted, #64748b)",
615
+ padding: "2px 6px",
616
+ background: "var(--doc-surface-2, #f1f5f9)",
617
+ borderRadius: 4
618
+ };
619
+ var editorStyle = {
620
+ display: "flex",
621
+ flexDirection: "column",
622
+ gap: 12
623
+ };
624
+ var editorHeaderStyle = {
625
+ display: "flex",
626
+ flexDirection: "column",
627
+ gap: 2
628
+ };
629
+ var editorLabelStyle = {
630
+ fontSize: 13,
631
+ fontWeight: 600,
632
+ color: "var(--doc-text, #0f172a)"
633
+ };
634
+ var editorSignerStyle = {
635
+ fontSize: 12,
636
+ color: "var(--doc-text-muted, #64748b)"
637
+ };
638
+ var methodTabsStyle = {
639
+ display: "flex",
640
+ gap: 4,
641
+ padding: 2,
642
+ background: "var(--doc-surface-2, #f1f5f9)",
643
+ borderRadius: 6
644
+ };
645
+ function methodTabStyle(selected) {
646
+ return {
647
+ flex: 1,
648
+ padding: "6px 10px",
649
+ background: selected ? "var(--doc-surface, #fff)" : "transparent",
650
+ border: "none",
651
+ borderRadius: 4,
652
+ fontSize: 12,
653
+ fontWeight: 500,
654
+ color: selected ? "var(--doc-text, #0f172a)" : "var(--doc-text-muted, #475569)",
655
+ cursor: "pointer",
656
+ fontFamily: "inherit"
657
+ };
658
+ }
659
+ var captureWrapStyle = {
660
+ display: "flex",
661
+ flexDirection: "column",
662
+ gap: 8
663
+ };
664
+ var completeBlockStyle = {
665
+ padding: "10px 12px",
666
+ background: "rgba(34, 197, 94, 0.08)",
667
+ border: "1px solid rgba(34, 197, 94, 0.28)",
668
+ borderRadius: 6,
669
+ fontSize: 12,
670
+ color: "rgb(20, 83, 45)"
671
+ };
672
+ var footerStyle = {
673
+ display: "flex",
674
+ justifyContent: "flex-end",
675
+ gap: 8,
676
+ marginTop: "auto",
677
+ paddingTop: 12,
678
+ borderTop: "1px solid var(--doc-border-light, #e2e8f0)"
679
+ };
680
+ function primaryBtnStyle2(disabled) {
681
+ return {
682
+ padding: "8px 16px",
683
+ borderRadius: 6,
684
+ border: "1px solid transparent",
685
+ background: disabled ? "var(--doc-border, #cbd5e1)" : "var(--doc-accent, #2563eb)",
686
+ color: disabled ? "var(--doc-text-muted, #64748b)" : "#fff",
687
+ fontSize: 13,
688
+ fontWeight: 600,
689
+ cursor: disabled ? "not-allowed" : "pointer",
690
+ fontFamily: "inherit"
691
+ };
692
+ }
693
+ function secondaryBtnStyle2() {
694
+ return {
695
+ padding: "8px 16px",
696
+ borderRadius: 6,
697
+ border: "1px solid var(--doc-border, #cbd5e1)",
698
+ background: "transparent",
699
+ color: "var(--doc-text, #0f172a)",
700
+ fontSize: 13,
701
+ fontWeight: 500,
702
+ cursor: "pointer",
703
+ fontFamily: "inherit"
704
+ };
705
+ }
706
+ // Annotate the CommonJS export names for ESM import in node:
707
+ 0 && (module.exports = {
708
+ DrawnSignaturePad,
709
+ SigningPane,
710
+ SigningProvider,
711
+ TypedSignatureField,
712
+ UploadedSignatureField,
713
+ createSigningController,
714
+ useSigning
715
+ });
716
+ //# sourceMappingURL=signing.cjs.map