@superdoc-dev/esign 2.0.0 → 2.0.1-next.2
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 +11 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +184 -210
- package/dist/types.d.ts +1 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +25 -47
package/README.md
CHANGED
|
@@ -37,22 +37,22 @@ function App() {
|
|
|
37
37
|
|
|
38
38
|
fields={{
|
|
39
39
|
document: [
|
|
40
|
-
{ id: '
|
|
41
|
-
{ id: '
|
|
42
|
-
{ id: '
|
|
43
|
-
{ id: '
|
|
44
|
-
{ id: '
|
|
45
|
-
{ id: '
|
|
40
|
+
{ id: 'user_name', value: 'John Doe' },
|
|
41
|
+
{ id: 'agreement_date', value: new Date().toLocaleDateString() },
|
|
42
|
+
{ id: 'company_name', value: 'SuperDoc' },
|
|
43
|
+
{ id: 'service_type', value: 'Premium' },
|
|
44
|
+
{ id: 'agreement_jurisdiction', value: 'CA' },
|
|
45
|
+
{ id: 'company_address', value: '123 Main St, Anytown, USA' }
|
|
46
46
|
],
|
|
47
47
|
signer: [
|
|
48
48
|
{
|
|
49
|
-
id: '
|
|
49
|
+
id: 'signature',
|
|
50
50
|
type: 'signature',
|
|
51
51
|
validation: { required: true },
|
|
52
52
|
label: 'Type your full name'
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
id: '
|
|
55
|
+
id: 'accept_terms',
|
|
56
56
|
type: 'checkbox',
|
|
57
57
|
validation: { required: true },
|
|
58
58
|
label: 'I accept the terms'
|
|
@@ -118,11 +118,11 @@ See [Python, Node.js, and more examples](https://docs.superdoc.dev/solutions/esi
|
|
|
118
118
|
timestamp: "2024-01-15T10:30:00Z",
|
|
119
119
|
duration: 45000,
|
|
120
120
|
documentFields: [
|
|
121
|
-
{ id: "
|
|
121
|
+
{ id: "user_name", value: "John Doe" }
|
|
122
122
|
],
|
|
123
123
|
signerFields: [
|
|
124
|
-
{ id: "
|
|
125
|
-
{ id: "
|
|
124
|
+
{ id: "signature", value: "John Doe" },
|
|
125
|
+
{ id: "accept_terms", value: true }
|
|
126
126
|
],
|
|
127
127
|
auditTrail: [
|
|
128
128
|
{ type: "ready", timestamp: "..." },
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,aAAa,EAGd,MAAM,YAAY,CAAC;AAEpB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;AAIzC,QAAA,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,aAAa,EAGd,MAAM,YAAY,CAAC;AAEpB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;AAIzC,QAAA,MAAM,aAAa,gIAqclB,CAAC;AAIF,eAAe,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var ce=Object.create;var P=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty;var ge=(i,c,o,t)=>{if(c&&typeof c=="object"||typeof c=="function")for(let s of ue(c))!pe.call(i,s)&&s!==o&&P(i,s,{get:()=>c[s],enumerable:!(t=le(c,s))||t.enumerable});return i};var me=(i,c,o)=>(o=i!=null?ce(de(i)):{},ge(c||!i||!i.__esModule?P(o,"default",{value:i,enumerable:!0}):o,i));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),r=require("react"),W=i=>{const c=globalThis.document.createElement("canvas"),o=c.getContext("2d"),t=30;o.font=`italic ${t}px cursive`;const u=o.measureText(i).width,f=t*1.3,g=4,D=6;return c.width=Math.ceil(u+g*2)+20,c.height=Math.ceil(f+D*2),o.font=`italic ${t}px cursive`,o.fillStyle="black",o.textAlign="center",o.textBaseline="middle",o.fillText(i,c.width/2,c.height/2),c.toDataURL("image/png")},L=({value:i,onChange:c,isDisabled:o,label:t})=>l.jsxs("div",{className:"superdoc-esign-signature-input",style:{display:"flex",flexDirection:"column",gap:"8px"},children:[t&&l.jsx("label",{children:t}),l.jsx("input",{type:"text",value:String(i||""),onChange:s=>c(s.target.value),disabled:o,placeholder:"Type your full name",style:{fontFamily:"cursive",fontSize:"18px"}})]}),K=({value:i,onChange:c,isDisabled:o,label:t})=>l.jsxs("label",{className:"superdoc-esign-checkbox-input",style:{display:"flex",gap:"8px"},children:[l.jsx("input",{type:"checkbox",checked:!!i,onChange:s=>c(s.target.checked),disabled:o}),l.jsx("span",{children:t})]}),fe=i=>({onClick:o,fileName:t,isDisabled:s,isDownloading:u})=>{const f=i?.label||"Download",g=s||u;return l.jsxs("button",{onClick:o,disabled:g,className:`superdoc-esign-btn superdoc-esign-btn--download${u?" superdoc-esign-btn--loading":""}`,style:{padding:"8px 16px",borderRadius:"6px",border:"1px solid #d0d5dd",background:"#ffffff",color:"#333",cursor:g?"not-allowed":"pointer",opacity:g?.7:1,fontSize:"16px",fontWeight:"bold",display:"inline-flex",alignItems:"center",gap:"8px",transition:"opacity 0.2s ease"},children:[u&&l.jsx("span",{className:"superdoc-esign-spinner"}),u?"Downloading...":f,!u&&t&&` (${t})`]})},he=i=>({onClick:o,isValid:t,isDisabled:s,isSubmitting:u})=>{const f=i?.label||"Submit",g=!t||s||u;return l.jsxs("button",{onClick:o,disabled:g,className:`superdoc-esign-btn superdoc-esign-btn--submit${u?" superdoc-esign-btn--loading":""}`,style:{padding:"12px 24px",borderRadius:"6px",border:"none",background:"#007bff",color:"#fff",cursor:g?"not-allowed":"pointer",opacity:g&&!u?.5:1,fontSize:"16px",fontWeight:"bold",display:"inline-flex",alignItems:"center",gap:"8px",transition:"opacity 0.2s ease"},children:[u&&l.jsx("span",{className:"superdoc-esign-spinner superdoc-esign-spinner--light"}),u?"Submitting...":f]})},X=r.forwardRef((i,c)=>{const{eventId:o,document:t,fields:s={},download:u,submit:f,onSubmit:g,onDownload:D,onStateChange:E,onFieldChange:N,onFieldsDiscovered:T,isDisabled:h=!1,className:Y,style:G,documentHeight:J="600px"}=i,[y,F]=r.useState(!t.validation?.scroll?.required),[m,I]=r.useState(new Map),[b,q]=r.useState(!1),[x,A]=r.useState(!1),[k,_]=r.useState(!1),[V,B]=r.useState([]),[U,Q]=r.useState(!1),j=r.useRef(null),M=r.useRef(null),Z=r.useRef(Date.now()),S=r.useRef(s),w=r.useRef([]),$=r.useRef(T);S.current=s,$.current=T,r.useEffect(()=>{w.current=V},[V]);const C=r.useCallback(e=>{if(!M.current?.activeEditor)return;const n=M.current.activeEditor,d=S.current.signer?.find(a=>a.id===e.id);let p;d?.type==="signature"&&e.value?p={json:{type:"image",attrs:{src:typeof e.value=="string"&&e.value.startsWith("data:image/")?e.value:W(String(e.value)),alt:"Signature"}}}:p={text:String(e.value??"")},e.id&&n.commands.updateStructuredContentById?.(e.id,p)},[]),H=r.useCallback(e=>{if(!e)return;const n=e.helpers.structuredContentCommands.getStructuredContentTags(e.state),d=new Map;S.current.document?.forEach(a=>{a.id&&d.set(a.id,a.value)}),S.current.signer?.forEach(a=>{a.value!==void 0&&d.set(a.id,a.value)});const p=n.map(({node:a})=>({id:a.attrs.id,label:a.attrs.label,value:d.get(a.attrs.id)??a.textContent??""})).filter(a=>a.id);p.length>0&&($.current?.(p),[...S.current.document||[],...S.current.signer||[]].filter(v=>v.value!==void 0).forEach(v=>C({id:v.id,value:v.value})))},[C]),R=e=>{const n={...e,timestamp:new Date().toISOString()},d=globalThis?.__SUPERDOC_AUDIT_MOCK__;d&&d(n);const p=[...w.current,n];return w.current=p,B(p),p};r.useEffect(()=>{if(!j.current)return;let e=!1,n=null;return(async()=>{const{SuperDoc:p}=await import("superdoc");e||(n=new p({selector:j.current,document:t.source,documentMode:"viewing",modules:{comments:!1},layoutMode:t.layoutMode,layoutMargins:t.layoutMargins,onReady:()=>{e||(n?.activeEditor&&H(n.activeEditor),R({type:"ready"}),Q(!0))}}),M.current=n)})(),()=>{e=!0,n&&typeof n.destroy=="function"&&n.destroy(),M.current=null}},[t.source,t.mode,t.layoutMode,t.layoutMargins?.top,t.layoutMargins?.bottom,t.layoutMargins?.left,t.layoutMargins?.right,H]),r.useEffect(()=>{if(!t.validation?.scroll?.required||!U)return;const e=j.current;if(!e)return;const n=()=>{const{scrollTop:d,scrollHeight:p,clientHeight:a}=e,v=d/(p-a);(v>=.95||p<=a)&&(F(!0),R({type:"scroll",data:{percent:Math.round(v*100)}}))};return e.addEventListener("scroll",n),n(),()=>e.removeEventListener("scroll",n)},[t.validation?.scroll?.required,U]);const ee=r.useCallback((e,n)=>{I(d=>{const p=d.get(e),a=new Map(d);return a.set(e,n),C({id:e,value:n}),R({type:"field_change",data:{fieldId:e,value:n,previousValue:p}}),N?.({id:e,value:n,previousValue:p}),a})},[N,C]),O=r.useCallback(()=>t.validation?.scroll?.required&&!y?!1:(s.signer||[]).every(e=>{if(!e.validation?.required)return!0;const n=m.get(e.id);return n&&(typeof n!="string"||n.trim())}),[y,s.signer,m,t.validation?.scroll?.required]);r.useEffect(()=>{const e=O();q(e),E?.({scrolled:y,fields:m,isValid:e,isSubmitting:x})},[y,m,x,O,E]);const te=r.useCallback(async()=>{if(h||k)return;_(!0);const e={eventId:o,documentSource:t.source,fields:{document:s.document||[],signer:(s.signer||[]).map(n=>({id:n.id,value:m.get(n.id)??null}))},fileName:u?.fileName||"document.pdf"};try{await D?.(e)}finally{_(!1)}},[h,k,o,t.source,s,m,u,D]),ne=r.useCallback(async()=>{if(!b||h||x)return;A(!0);const e=R({type:"submit"}),n={eventId:o,timestamp:new Date().toISOString(),duration:Math.floor((Date.now()-Z.current)/1e3),auditTrail:e,documentFields:s.document||[],signerFields:(s.signer||[]).map(d=>({id:d.id,value:m.get(d.id)??null})),isFullyCompleted:b};try{await g(n)}finally{A(!1)}},[b,h,x,o,s,m,g]),se=e=>{const n=e.component||oe(e.type);return l.jsx(n,{value:m.get(e.id)??null,onChange:d=>ee(e.id,d),isDisabled:h,label:e.label},e.id)},oe=e=>{switch(e){case"signature":case"text":return L;case"checkbox":return K}},re=()=>{const e=u?.component||fe(u);return e?l.jsx(e,{onClick:te,fileName:u?.fileName,isDisabled:h,isDownloading:k}):null},ae=()=>{if(t.mode==="download")return null;const e=f?.component||he(f);return l.jsx("div",{className:"superdoc-esign-actions superdoc-esign-form-actions",children:l.jsx(e,{onClick:ne,isValid:b,isDisabled:h,isSubmitting:x})})},z=re(),ie=ae();return r.useImperativeHandle(c,()=>({getState:()=>({scrolled:y,fields:m,isValid:b,isSubmitting:x}),getAuditTrail:()=>w.current,reset:()=>{F(!t.validation?.scroll?.required),I(new Map),q(!1),w.current=[],B([])},updateFieldInDocument:C}),[y,m,b,x,t.validation?.scroll?.required,C]),l.jsxs("div",{className:`superdoc-esign-container ${Y||""}`,style:G,children:[l.jsxs("div",{className:"superdoc-esign-document","data-testid":"superdoc-esign-document",children:[z&&l.jsx("div",{className:"superdoc-esign-document-toolbar",children:l.jsx("div",{className:"superdoc-esign-document-controls",children:z})}),l.jsx("div",{ref:j,className:"superdoc-esign-document-viewer","data-testid":"superdoc-scroll-container",style:{height:J,overflow:"auto"}})]}),l.jsxs("div",{className:"superdoc-esign-controls","data-testid":"superdoc-esign-controls",children:[s.signer&&s.signer.length>0&&l.jsx("div",{className:"superdoc-esign-fields","data-testid":"superdoc-esign-fields",children:s.signer.map(se)}),ie]})]})});X.displayName="SuperDocESign";exports.CheckboxInput=K;exports.SignatureInput=L;exports.default=X;exports.textToImageDataUrl=W;
|
package/dist/index.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { jsxs as b, jsx as d } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
const
|
|
4
|
-
const l = globalThis.document.createElement("canvas"),
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
return l.width = Math.ceil(
|
|
8
|
-
},
|
|
2
|
+
import { forwardRef as ae, useState as y, useRef as D, useEffect as k, useCallback as M, useImperativeHandle as ce } from "react";
|
|
3
|
+
const le = (u) => {
|
|
4
|
+
const l = globalThis.document.createElement("canvas"), r = l.getContext("2d"), n = 30;
|
|
5
|
+
r.font = `italic ${n}px cursive`;
|
|
6
|
+
const i = r.measureText(u).width, m = n * 1.3, p = 4, T = 6;
|
|
7
|
+
return l.width = Math.ceil(i + p * 2) + 20, l.height = Math.ceil(m + T * 2), r.font = `italic ${n}px cursive`, r.fillStyle = "black", r.textAlign = "center", r.textBaseline = "middle", r.fillText(u, l.width / 2, l.height / 2), l.toDataURL("image/png");
|
|
8
|
+
}, de = ({
|
|
9
9
|
value: u,
|
|
10
10
|
onChange: l,
|
|
11
|
-
isDisabled:
|
|
12
|
-
label:
|
|
11
|
+
isDisabled: r,
|
|
12
|
+
label: n
|
|
13
13
|
}) => /* @__PURE__ */ b(
|
|
14
14
|
"div",
|
|
15
15
|
{
|
|
16
16
|
className: "superdoc-esign-signature-input",
|
|
17
17
|
style: { display: "flex", flexDirection: "column", gap: "8px" },
|
|
18
18
|
children: [
|
|
19
|
-
|
|
19
|
+
n && /* @__PURE__ */ d("label", { children: n }),
|
|
20
20
|
/* @__PURE__ */ d(
|
|
21
21
|
"input",
|
|
22
22
|
{
|
|
23
23
|
type: "text",
|
|
24
24
|
value: String(u || ""),
|
|
25
|
-
onChange: (
|
|
26
|
-
disabled:
|
|
25
|
+
onChange: (s) => l(s.target.value),
|
|
26
|
+
disabled: r,
|
|
27
27
|
placeholder: "Type your full name",
|
|
28
28
|
style: {
|
|
29
29
|
fontFamily: "cursive",
|
|
@@ -33,35 +33,35 @@ const be = (u) => {
|
|
|
33
33
|
)
|
|
34
34
|
]
|
|
35
35
|
}
|
|
36
|
-
),
|
|
36
|
+
), ue = ({
|
|
37
37
|
value: u,
|
|
38
38
|
onChange: l,
|
|
39
|
-
isDisabled:
|
|
40
|
-
label:
|
|
39
|
+
isDisabled: r,
|
|
40
|
+
label: n
|
|
41
41
|
}) => /* @__PURE__ */ b("label", { className: "superdoc-esign-checkbox-input", style: { display: "flex", gap: "8px" }, children: [
|
|
42
42
|
/* @__PURE__ */ d(
|
|
43
43
|
"input",
|
|
44
44
|
{
|
|
45
45
|
type: "checkbox",
|
|
46
46
|
checked: !!u,
|
|
47
|
-
onChange: (
|
|
48
|
-
disabled:
|
|
47
|
+
onChange: (s) => l(s.target.checked),
|
|
48
|
+
disabled: r
|
|
49
49
|
}
|
|
50
50
|
),
|
|
51
|
-
/* @__PURE__ */ d("span", { children:
|
|
52
|
-
] }),
|
|
53
|
-
onClick:
|
|
54
|
-
fileName:
|
|
55
|
-
isDisabled:
|
|
56
|
-
isDownloading:
|
|
51
|
+
/* @__PURE__ */ d("span", { children: n })
|
|
52
|
+
] }), pe = (u) => ({
|
|
53
|
+
onClick: r,
|
|
54
|
+
fileName: n,
|
|
55
|
+
isDisabled: s,
|
|
56
|
+
isDownloading: i
|
|
57
57
|
}) => {
|
|
58
|
-
const m = u?.label || "Download", p =
|
|
58
|
+
const m = u?.label || "Download", p = s || i;
|
|
59
59
|
return /* @__PURE__ */ b(
|
|
60
60
|
"button",
|
|
61
61
|
{
|
|
62
|
-
onClick:
|
|
62
|
+
onClick: r,
|
|
63
63
|
disabled: p,
|
|
64
|
-
className: `superdoc-esign-btn superdoc-esign-btn--download${
|
|
64
|
+
className: `superdoc-esign-btn superdoc-esign-btn--download${i ? " superdoc-esign-btn--loading" : ""}`,
|
|
65
65
|
style: {
|
|
66
66
|
padding: "8px 16px",
|
|
67
67
|
borderRadius: "6px",
|
|
@@ -78,25 +78,25 @@ const be = (u) => {
|
|
|
78
78
|
transition: "opacity 0.2s ease"
|
|
79
79
|
},
|
|
80
80
|
children: [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
!
|
|
81
|
+
i && /* @__PURE__ */ d("span", { className: "superdoc-esign-spinner" }),
|
|
82
|
+
i ? "Downloading..." : m,
|
|
83
|
+
!i && n && ` (${n})`
|
|
84
84
|
]
|
|
85
85
|
}
|
|
86
86
|
);
|
|
87
|
-
},
|
|
88
|
-
onClick:
|
|
89
|
-
isValid:
|
|
90
|
-
isDisabled:
|
|
91
|
-
isSubmitting:
|
|
87
|
+
}, ge = (u) => ({
|
|
88
|
+
onClick: r,
|
|
89
|
+
isValid: n,
|
|
90
|
+
isDisabled: s,
|
|
91
|
+
isSubmitting: i
|
|
92
92
|
}) => {
|
|
93
|
-
const m = u?.label || "Submit", p = !
|
|
93
|
+
const m = u?.label || "Submit", p = !n || s || i;
|
|
94
94
|
return /* @__PURE__ */ b(
|
|
95
95
|
"button",
|
|
96
96
|
{
|
|
97
|
-
onClick:
|
|
97
|
+
onClick: r,
|
|
98
98
|
disabled: p,
|
|
99
|
-
className: `superdoc-esign-btn superdoc-esign-btn--submit${
|
|
99
|
+
className: `superdoc-esign-btn superdoc-esign-btn--submit${i ? " superdoc-esign-btn--loading" : ""}`,
|
|
100
100
|
style: {
|
|
101
101
|
padding: "12px 24px",
|
|
102
102
|
borderRadius: "6px",
|
|
@@ -104,7 +104,7 @@ const be = (u) => {
|
|
|
104
104
|
background: "#007bff",
|
|
105
105
|
color: "#fff",
|
|
106
106
|
cursor: p ? "not-allowed" : "pointer",
|
|
107
|
-
opacity: p && !
|
|
107
|
+
opacity: p && !i ? 0.5 : 1,
|
|
108
108
|
fontSize: "16px",
|
|
109
109
|
fontWeight: "bold",
|
|
110
110
|
display: "inline-flex",
|
|
@@ -113,321 +113,295 @@ const be = (u) => {
|
|
|
113
113
|
transition: "opacity 0.2s ease"
|
|
114
114
|
},
|
|
115
115
|
children: [
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
i && /* @__PURE__ */ d("span", { className: "superdoc-esign-spinner superdoc-esign-spinner--light" }),
|
|
117
|
+
i ? "Submitting..." : m
|
|
118
118
|
]
|
|
119
119
|
}
|
|
120
120
|
);
|
|
121
|
-
},
|
|
121
|
+
}, me = ae(
|
|
122
122
|
(u, l) => {
|
|
123
123
|
const {
|
|
124
|
-
eventId:
|
|
125
|
-
document:
|
|
126
|
-
fields:
|
|
127
|
-
download:
|
|
124
|
+
eventId: r,
|
|
125
|
+
document: n,
|
|
126
|
+
fields: s = {},
|
|
127
|
+
download: i,
|
|
128
128
|
submit: m,
|
|
129
129
|
onSubmit: p,
|
|
130
|
-
onDownload:
|
|
131
|
-
onStateChange:
|
|
132
|
-
onFieldChange:
|
|
133
|
-
onFieldsDiscovered:
|
|
130
|
+
onDownload: T,
|
|
131
|
+
onStateChange: A,
|
|
132
|
+
onFieldChange: q,
|
|
133
|
+
onFieldsDiscovered: V,
|
|
134
134
|
isDisabled: f = !1,
|
|
135
|
-
className:
|
|
136
|
-
style:
|
|
137
|
-
documentHeight:
|
|
138
|
-
} = u, [x,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}, [
|
|
142
|
-
const
|
|
135
|
+
className: X,
|
|
136
|
+
style: Y,
|
|
137
|
+
documentHeight: G = "600px"
|
|
138
|
+
} = u, [x, B] = y(!n.validation?.scroll?.required), [g, _] = y(/* @__PURE__ */ new Map()), [S, U] = y(!1), [h, $] = y(!1), [I, H] = y(!1), [z, O] = y([]), [W, J] = y(!1), E = D(null), F = D(null), Q = D(Date.now()), w = D(s), N = D([]), j = D(V);
|
|
139
|
+
w.current = s, j.current = V, k(() => {
|
|
140
|
+
N.current = z;
|
|
141
|
+
}, [z]);
|
|
142
|
+
const C = M((e) => {
|
|
143
143
|
if (!F.current?.activeEditor) return;
|
|
144
|
-
const t = F.current.activeEditor,
|
|
145
|
-
if (e.type === "table" && Array.isArray(e.value)) {
|
|
146
|
-
const T = t.helpers?.structuredContentCommands?.getStructuredContentTablesById?.(e.id, t.state) || [];
|
|
147
|
-
if (T.length) {
|
|
148
|
-
const { node: B, pos: me } = T[0], Q = B.childCount;
|
|
149
|
-
if (Q > 1) {
|
|
150
|
-
let E = t.state.tr;
|
|
151
|
-
for (let I = Q - 1; I >= 1; I--) {
|
|
152
|
-
let Z = 1;
|
|
153
|
-
for (let V = 0; V < I; V++)
|
|
154
|
-
Z += B.child(V).nodeSize;
|
|
155
|
-
const fe = B.child(I), ee = me + Z, he = ee + fe.nodeSize;
|
|
156
|
-
E = E.delete(E.mapping.map(ee), E.mapping.map(he));
|
|
157
|
-
}
|
|
158
|
-
t.view?.dispatch(E);
|
|
159
|
-
}
|
|
160
|
-
t.commands?.appendRowsToStructuredContentTable?.({
|
|
161
|
-
id: e.id,
|
|
162
|
-
rows: e.value,
|
|
163
|
-
copyRowStyle: !0
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
144
|
+
const t = F.current.activeEditor, a = w.current.signer?.find((o) => o.id === e.id);
|
|
168
145
|
let c;
|
|
169
|
-
|
|
146
|
+
a?.type === "signature" && e.value ? c = {
|
|
170
147
|
json: {
|
|
171
148
|
type: "image",
|
|
172
|
-
attrs: { src: typeof e.value == "string" && e.value.startsWith("data:image/") ? e.value :
|
|
149
|
+
attrs: { src: typeof e.value == "string" && e.value.startsWith("data:image/") ? e.value : le(String(e.value)), alt: "Signature" }
|
|
173
150
|
}
|
|
174
|
-
} : c = { text: String(e.value ?? "") }, e.id && t.commands
|
|
175
|
-
}, []),
|
|
151
|
+
} : c = { text: String(e.value ?? "") }, e.id && t.commands.updateStructuredContentById?.(e.id, c);
|
|
152
|
+
}, []), L = M(
|
|
176
153
|
(e) => {
|
|
177
154
|
if (!e) return;
|
|
178
155
|
const t = e.helpers.structuredContentCommands.getStructuredContentTags(
|
|
179
156
|
e.state
|
|
180
|
-
),
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}),
|
|
184
|
-
|
|
157
|
+
), a = /* @__PURE__ */ new Map();
|
|
158
|
+
w.current.document?.forEach((o) => {
|
|
159
|
+
o.id && a.set(o.id, o.value);
|
|
160
|
+
}), w.current.signer?.forEach((o) => {
|
|
161
|
+
o.value !== void 0 && a.set(o.id, o.value);
|
|
185
162
|
});
|
|
186
|
-
const c = t.map(({ node:
|
|
187
|
-
id:
|
|
188
|
-
label:
|
|
189
|
-
value:
|
|
190
|
-
})).filter((
|
|
191
|
-
c.length > 0 && (
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
(n) => y({
|
|
199
|
-
id: n.id,
|
|
200
|
-
value: n.value
|
|
163
|
+
const c = t.map(({ node: o }) => ({
|
|
164
|
+
id: o.attrs.id,
|
|
165
|
+
label: o.attrs.label,
|
|
166
|
+
value: a.get(o.attrs.id) ?? o.textContent ?? ""
|
|
167
|
+
})).filter((o) => o.id);
|
|
168
|
+
c.length > 0 && (j.current?.(c), [
|
|
169
|
+
...w.current.document || [],
|
|
170
|
+
...w.current.signer || []
|
|
171
|
+
].filter((v) => v.value !== void 0).forEach(
|
|
172
|
+
(v) => C({
|
|
173
|
+
id: v.id,
|
|
174
|
+
value: v.value
|
|
201
175
|
})
|
|
202
176
|
));
|
|
203
177
|
},
|
|
204
|
-
[
|
|
205
|
-
),
|
|
178
|
+
[C]
|
|
179
|
+
), R = (e) => {
|
|
206
180
|
const t = {
|
|
207
181
|
...e,
|
|
208
182
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
const c = [...
|
|
212
|
-
return
|
|
183
|
+
}, a = globalThis?.__SUPERDOC_AUDIT_MOCK__;
|
|
184
|
+
a && a(t);
|
|
185
|
+
const c = [...N.current, t];
|
|
186
|
+
return N.current = c, O(c), c;
|
|
213
187
|
};
|
|
214
|
-
|
|
215
|
-
if (!
|
|
188
|
+
k(() => {
|
|
189
|
+
if (!E.current) return;
|
|
216
190
|
let e = !1, t = null;
|
|
217
191
|
return (async () => {
|
|
218
192
|
const { SuperDoc: c } = await import("superdoc");
|
|
219
193
|
e || (t = new c({
|
|
220
|
-
selector:
|
|
221
|
-
document:
|
|
194
|
+
selector: E.current,
|
|
195
|
+
document: n.source,
|
|
222
196
|
documentMode: "viewing",
|
|
223
197
|
modules: {
|
|
224
198
|
comments: !1
|
|
225
199
|
},
|
|
226
200
|
// @ts-expect-error - layoutMode is not supported in SuperDoc v1.1.0 yet
|
|
227
|
-
layoutMode:
|
|
228
|
-
layoutMargins:
|
|
201
|
+
layoutMode: n.layoutMode,
|
|
202
|
+
layoutMargins: n.layoutMargins,
|
|
229
203
|
onReady: () => {
|
|
230
|
-
e || (t?.activeEditor &&
|
|
204
|
+
e || (t?.activeEditor && L(t.activeEditor), R({ type: "ready" }), J(!0));
|
|
231
205
|
}
|
|
232
206
|
}), F.current = t);
|
|
233
207
|
})(), () => {
|
|
234
208
|
e = !0, t && typeof t.destroy == "function" && t.destroy(), F.current = null;
|
|
235
209
|
};
|
|
236
210
|
}, [
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
]),
|
|
246
|
-
if (!
|
|
247
|
-
const e =
|
|
211
|
+
n.source,
|
|
212
|
+
n.mode,
|
|
213
|
+
n.layoutMode,
|
|
214
|
+
n.layoutMargins?.top,
|
|
215
|
+
n.layoutMargins?.bottom,
|
|
216
|
+
n.layoutMargins?.left,
|
|
217
|
+
n.layoutMargins?.right,
|
|
218
|
+
L
|
|
219
|
+
]), k(() => {
|
|
220
|
+
if (!n.validation?.scroll?.required || !W) return;
|
|
221
|
+
const e = E.current;
|
|
248
222
|
if (!e) return;
|
|
249
223
|
const t = () => {
|
|
250
|
-
const { scrollTop:
|
|
251
|
-
(
|
|
224
|
+
const { scrollTop: a, scrollHeight: c, clientHeight: o } = e, v = a / (c - o);
|
|
225
|
+
(v >= 0.95 || c <= o) && (B(!0), R({
|
|
252
226
|
type: "scroll",
|
|
253
|
-
data: { percent: Math.round(
|
|
227
|
+
data: { percent: Math.round(v * 100) }
|
|
254
228
|
}));
|
|
255
229
|
};
|
|
256
230
|
return e.addEventListener("scroll", t), t(), () => e.removeEventListener("scroll", t);
|
|
257
|
-
}, [
|
|
258
|
-
const
|
|
231
|
+
}, [n.validation?.scroll?.required, W]);
|
|
232
|
+
const Z = M(
|
|
259
233
|
(e, t) => {
|
|
260
|
-
|
|
261
|
-
const c =
|
|
262
|
-
return
|
|
234
|
+
_((a) => {
|
|
235
|
+
const c = a.get(e), o = new Map(a);
|
|
236
|
+
return o.set(e, t), C({
|
|
263
237
|
id: e,
|
|
264
238
|
value: t
|
|
265
|
-
}),
|
|
239
|
+
}), R({
|
|
266
240
|
type: "field_change",
|
|
267
241
|
data: { fieldId: e, value: t, previousValue: c }
|
|
268
|
-
}),
|
|
242
|
+
}), q?.({
|
|
269
243
|
id: e,
|
|
270
244
|
value: t,
|
|
271
245
|
previousValue: c
|
|
272
|
-
}),
|
|
246
|
+
}), o;
|
|
273
247
|
});
|
|
274
248
|
},
|
|
275
|
-
[
|
|
276
|
-
),
|
|
249
|
+
[q, C]
|
|
250
|
+
), P = M(() => n.validation?.scroll?.required && !x ? !1 : (s.signer || []).every((e) => {
|
|
277
251
|
if (!e.validation?.required) return !0;
|
|
278
252
|
const t = g.get(e.id);
|
|
279
253
|
return t && (typeof t != "string" || t.trim());
|
|
280
|
-
}), [x,
|
|
281
|
-
|
|
282
|
-
const e =
|
|
283
|
-
|
|
254
|
+
}), [x, s.signer, g, n.validation?.scroll?.required]);
|
|
255
|
+
k(() => {
|
|
256
|
+
const e = P();
|
|
257
|
+
U(e), A?.({
|
|
284
258
|
scrolled: x,
|
|
285
259
|
fields: g,
|
|
286
260
|
isValid: e,
|
|
287
261
|
isSubmitting: h
|
|
288
262
|
});
|
|
289
|
-
}, [x, g, h,
|
|
290
|
-
const
|
|
291
|
-
if (f ||
|
|
292
|
-
|
|
263
|
+
}, [x, g, h, P, A]);
|
|
264
|
+
const ee = M(async () => {
|
|
265
|
+
if (f || I) return;
|
|
266
|
+
H(!0);
|
|
293
267
|
const e = {
|
|
294
|
-
eventId:
|
|
295
|
-
documentSource:
|
|
268
|
+
eventId: r,
|
|
269
|
+
documentSource: n.source,
|
|
296
270
|
fields: {
|
|
297
|
-
document:
|
|
298
|
-
signer: (
|
|
271
|
+
document: s.document || [],
|
|
272
|
+
signer: (s.signer || []).map((t) => ({
|
|
299
273
|
id: t.id,
|
|
300
274
|
value: g.get(t.id) ?? null
|
|
301
275
|
}))
|
|
302
276
|
},
|
|
303
|
-
fileName:
|
|
277
|
+
fileName: i?.fileName || "document.pdf"
|
|
304
278
|
};
|
|
305
279
|
try {
|
|
306
|
-
await
|
|
280
|
+
await T?.(e);
|
|
307
281
|
} finally {
|
|
308
|
-
|
|
282
|
+
H(!1);
|
|
309
283
|
}
|
|
310
284
|
}, [
|
|
311
285
|
f,
|
|
312
|
-
|
|
313
|
-
s,
|
|
314
|
-
o.source,
|
|
286
|
+
I,
|
|
315
287
|
r,
|
|
288
|
+
n.source,
|
|
289
|
+
s,
|
|
316
290
|
g,
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
]),
|
|
320
|
-
if (!
|
|
321
|
-
|
|
322
|
-
const e =
|
|
323
|
-
eventId:
|
|
291
|
+
i,
|
|
292
|
+
T
|
|
293
|
+
]), te = M(async () => {
|
|
294
|
+
if (!S || f || h) return;
|
|
295
|
+
$(!0);
|
|
296
|
+
const e = R({ type: "submit" }), t = {
|
|
297
|
+
eventId: r,
|
|
324
298
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
325
|
-
duration: Math.floor((Date.now() -
|
|
299
|
+
duration: Math.floor((Date.now() - Q.current) / 1e3),
|
|
326
300
|
auditTrail: e,
|
|
327
|
-
documentFields:
|
|
328
|
-
signerFields: (
|
|
329
|
-
id:
|
|
330
|
-
value: g.get(
|
|
301
|
+
documentFields: s.document || [],
|
|
302
|
+
signerFields: (s.signer || []).map((a) => ({
|
|
303
|
+
id: a.id,
|
|
304
|
+
value: g.get(a.id) ?? null
|
|
331
305
|
})),
|
|
332
|
-
isFullyCompleted:
|
|
306
|
+
isFullyCompleted: S
|
|
333
307
|
};
|
|
334
308
|
try {
|
|
335
309
|
await p(t);
|
|
336
310
|
} finally {
|
|
337
|
-
|
|
311
|
+
$(!1);
|
|
338
312
|
}
|
|
339
|
-
}, [
|
|
340
|
-
const t = e.component ||
|
|
313
|
+
}, [S, f, h, r, s, g, p]), ne = (e) => {
|
|
314
|
+
const t = e.component || oe(e.type);
|
|
341
315
|
return /* @__PURE__ */ d(
|
|
342
316
|
t,
|
|
343
317
|
{
|
|
344
318
|
value: g.get(e.id) ?? null,
|
|
345
|
-
onChange: (
|
|
319
|
+
onChange: (a) => Z(e.id, a),
|
|
346
320
|
isDisabled: f,
|
|
347
321
|
label: e.label
|
|
348
322
|
},
|
|
349
323
|
e.id
|
|
350
324
|
);
|
|
351
|
-
},
|
|
325
|
+
}, oe = (e) => {
|
|
352
326
|
switch (e) {
|
|
353
327
|
case "signature":
|
|
354
328
|
case "text":
|
|
355
|
-
return
|
|
329
|
+
return de;
|
|
356
330
|
case "checkbox":
|
|
357
|
-
return
|
|
331
|
+
return ue;
|
|
358
332
|
}
|
|
359
|
-
},
|
|
360
|
-
const e =
|
|
333
|
+
}, se = () => {
|
|
334
|
+
const e = i?.component || pe(i);
|
|
361
335
|
return e ? /* @__PURE__ */ d(
|
|
362
336
|
e,
|
|
363
337
|
{
|
|
364
|
-
onClick:
|
|
365
|
-
fileName:
|
|
338
|
+
onClick: ee,
|
|
339
|
+
fileName: i?.fileName,
|
|
366
340
|
isDisabled: f,
|
|
367
|
-
isDownloading:
|
|
341
|
+
isDownloading: I
|
|
368
342
|
}
|
|
369
343
|
) : null;
|
|
370
|
-
},
|
|
371
|
-
if (
|
|
344
|
+
}, re = () => {
|
|
345
|
+
if (n.mode === "download")
|
|
372
346
|
return null;
|
|
373
|
-
const e = m?.component ||
|
|
347
|
+
const e = m?.component || ge(m);
|
|
374
348
|
return /* @__PURE__ */ d("div", { className: "superdoc-esign-actions superdoc-esign-form-actions", children: /* @__PURE__ */ d(
|
|
375
349
|
e,
|
|
376
350
|
{
|
|
377
|
-
onClick:
|
|
378
|
-
isValid:
|
|
351
|
+
onClick: te,
|
|
352
|
+
isValid: S,
|
|
379
353
|
isDisabled: f,
|
|
380
354
|
isSubmitting: h
|
|
381
355
|
}
|
|
382
356
|
) });
|
|
383
|
-
},
|
|
384
|
-
return
|
|
357
|
+
}, K = se(), ie = re();
|
|
358
|
+
return ce(
|
|
385
359
|
l,
|
|
386
360
|
() => ({
|
|
387
361
|
getState: () => ({
|
|
388
362
|
scrolled: x,
|
|
389
363
|
fields: g,
|
|
390
|
-
isValid:
|
|
364
|
+
isValid: S,
|
|
391
365
|
isSubmitting: h
|
|
392
366
|
}),
|
|
393
|
-
getAuditTrail: () =>
|
|
367
|
+
getAuditTrail: () => N.current,
|
|
394
368
|
reset: () => {
|
|
395
|
-
|
|
369
|
+
B(!n.validation?.scroll?.required), _(/* @__PURE__ */ new Map()), U(!1), N.current = [], O([]);
|
|
396
370
|
},
|
|
397
|
-
updateFieldInDocument:
|
|
371
|
+
updateFieldInDocument: C
|
|
398
372
|
}),
|
|
399
373
|
[
|
|
400
374
|
x,
|
|
401
375
|
g,
|
|
402
|
-
|
|
376
|
+
S,
|
|
403
377
|
h,
|
|
404
|
-
|
|
405
|
-
|
|
378
|
+
n.validation?.scroll?.required,
|
|
379
|
+
C
|
|
406
380
|
]
|
|
407
|
-
), /* @__PURE__ */ b("div", { className: `superdoc-esign-container ${
|
|
381
|
+
), /* @__PURE__ */ b("div", { className: `superdoc-esign-container ${X || ""}`, style: Y, children: [
|
|
408
382
|
/* @__PURE__ */ b("div", { className: "superdoc-esign-document", "data-testid": "superdoc-esign-document", children: [
|
|
409
|
-
|
|
383
|
+
K && /* @__PURE__ */ d("div", { className: "superdoc-esign-document-toolbar", children: /* @__PURE__ */ d("div", { className: "superdoc-esign-document-controls", children: K }) }),
|
|
410
384
|
/* @__PURE__ */ d(
|
|
411
385
|
"div",
|
|
412
386
|
{
|
|
413
|
-
ref:
|
|
387
|
+
ref: E,
|
|
414
388
|
className: "superdoc-esign-document-viewer",
|
|
415
389
|
"data-testid": "superdoc-scroll-container",
|
|
416
|
-
style: { height:
|
|
390
|
+
style: { height: G, overflow: "auto" }
|
|
417
391
|
}
|
|
418
392
|
)
|
|
419
393
|
] }),
|
|
420
394
|
/* @__PURE__ */ b("div", { className: "superdoc-esign-controls", "data-testid": "superdoc-esign-controls", children: [
|
|
421
|
-
|
|
422
|
-
|
|
395
|
+
s.signer && s.signer.length > 0 && /* @__PURE__ */ d("div", { className: "superdoc-esign-fields", "data-testid": "superdoc-esign-fields", children: s.signer.map(ne) }),
|
|
396
|
+
ie
|
|
423
397
|
] })
|
|
424
398
|
] });
|
|
425
399
|
}
|
|
426
400
|
);
|
|
427
|
-
|
|
401
|
+
me.displayName = "SuperDocESign";
|
|
428
402
|
export {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
403
|
+
ue as CheckboxInput,
|
|
404
|
+
de as SignatureInput,
|
|
405
|
+
me as default,
|
|
406
|
+
le as textToImageDataUrl
|
|
433
407
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
export type FieldValue = string | boolean | number | null | undefined;
|
|
2
|
-
export type TableFieldValue = string[][];
|
|
3
2
|
export interface FieldReference {
|
|
4
3
|
id: string;
|
|
5
4
|
}
|
|
6
5
|
export interface DocumentField extends FieldReference {
|
|
7
|
-
|
|
8
|
-
value: FieldValue | TableFieldValue;
|
|
6
|
+
value: FieldValue;
|
|
9
7
|
}
|
|
10
8
|
export interface SignerField extends FieldReference {
|
|
11
9
|
type: 'signature' | 'checkbox' | 'text';
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/esign",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1-next.2",
|
|
4
4
|
"description": "React eSignature component for SuperDoc",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,25 +23,21 @@
|
|
|
23
23
|
"dev": "vite build --watch",
|
|
24
24
|
"build": "tsc && vite build",
|
|
25
25
|
"type-check": "tsc --noEmit",
|
|
26
|
-
"lint": "eslint src
|
|
27
|
-
"lint:fix": "eslint src
|
|
28
|
-
"
|
|
29
|
-
"format:check": "prettier --check \"src/**/*.{ts,tsx}\" \"demo/**/*.{ts,tsx}\"",
|
|
30
|
-
"test": "vitest",
|
|
26
|
+
"lint": "eslint src",
|
|
27
|
+
"lint:fix": "eslint src --fix",
|
|
28
|
+
"test": "vitest run",
|
|
31
29
|
"test:watch": "vitest --watch",
|
|
32
|
-
"
|
|
33
|
-
"release": "semantic-release",
|
|
34
|
-
"check:all": "pnpm run format:check && pnpm run lint && pnpm run type-check && pnpm run build"
|
|
30
|
+
"prepublishOnly": "pnpm run build"
|
|
35
31
|
},
|
|
36
32
|
"repository": {
|
|
37
33
|
"type": "git",
|
|
38
|
-
"url": "https://github.com/superdoc-dev/
|
|
34
|
+
"url": "git+https://github.com/superdoc-dev/superdoc.git",
|
|
35
|
+
"directory": "packages/esign"
|
|
39
36
|
},
|
|
40
37
|
"keywords": [
|
|
41
38
|
"superdoc",
|
|
42
39
|
"esign",
|
|
43
40
|
"esignature",
|
|
44
|
-
"electronic-signature",
|
|
45
41
|
"clickwrap",
|
|
46
42
|
"agreement",
|
|
47
43
|
"document",
|
|
@@ -51,49 +47,31 @@
|
|
|
51
47
|
"author": "SuperDoc Team",
|
|
52
48
|
"license": "AGPL-3.0",
|
|
53
49
|
"bugs": {
|
|
54
|
-
"url": "https://github.com/superdoc-dev/
|
|
50
|
+
"url": "https://github.com/superdoc-dev/superdoc/issues"
|
|
55
51
|
},
|
|
56
|
-
"homepage": "https://github.com/superdoc-dev/esign#readme",
|
|
52
|
+
"homepage": "https://github.com/superdoc-dev/superdoc/tree/main/packages/esign#readme",
|
|
57
53
|
"peerDependencies": {
|
|
58
54
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
59
55
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
60
56
|
"superdoc": "^1.9.0"
|
|
61
57
|
},
|
|
62
58
|
"devDependencies": {
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"@
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"jsdom": "^27.0.0",
|
|
80
|
-
"lint-staged": "^16.2.7",
|
|
81
|
-
"prettier": "^3.6.2",
|
|
82
|
-
"react": "^19.2.0",
|
|
83
|
-
"react-dom": "^19.2.0",
|
|
84
|
-
"semantic-release": "^24.2.9",
|
|
85
|
-
"superdoc": "1.9.0",
|
|
86
|
-
"typescript": "^5.9.2",
|
|
87
|
-
"typescript-eslint": "^8.44.1",
|
|
88
|
-
"vite": "^7.1.7",
|
|
89
|
-
"vite-plugin-dts": "^4.5.4",
|
|
90
|
-
"vitest": "^3.2.4"
|
|
91
|
-
},
|
|
92
|
-
"lint-staged": {
|
|
93
|
-
"*.{ts,tsx}": [
|
|
94
|
-
"prettier --write",
|
|
95
|
-
"eslint --fix"
|
|
96
|
-
]
|
|
59
|
+
"@testing-library/jest-dom": "catalog:",
|
|
60
|
+
"@testing-library/react": "catalog:",
|
|
61
|
+
"@testing-library/user-event": "catalog:",
|
|
62
|
+
"@types/react": "catalog:",
|
|
63
|
+
"@types/react-dom": "catalog:",
|
|
64
|
+
"@vitejs/plugin-react": "catalog:",
|
|
65
|
+
"eslint-plugin-react": "catalog:",
|
|
66
|
+
"eslint-plugin-react-hooks": "catalog:",
|
|
67
|
+
"react": "catalog:",
|
|
68
|
+
"react-dom": "catalog:",
|
|
69
|
+
"superdoc": "workspace:*",
|
|
70
|
+
"typescript": "catalog:",
|
|
71
|
+
"vite": "catalog:",
|
|
72
|
+
"vite-plugin-dts": "catalog:",
|
|
73
|
+
"vitest": "catalog:",
|
|
74
|
+
"jsdom": "catalog:"
|
|
97
75
|
},
|
|
98
76
|
"publishConfig": {
|
|
99
77
|
"access": "public"
|