@arbidocs/blocks 0.4.157 → 0.4.159
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/{ConnectedNativeDocxComparison-S25BPUH5.cjs → ConnectedNativeDocxComparison-R6RU5TZE.cjs} +8 -7
- package/dist/{ConnectedNativeDocxComparison-S25BPUH5.cjs.map → ConnectedNativeDocxComparison-R6RU5TZE.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-2PLOOXSH.js → ConnectedNativeDocxComparison-XMZ5KLD4.js} +7 -6
- package/dist/{ConnectedNativeDocxComparison-2PLOOXSH.js.map → ConnectedNativeDocxComparison-XMZ5KLD4.js.map} +1 -1
- package/dist/{ConnectedNativeDocxEditor-YA4HWLY4.cjs → ConnectedNativeDocxEditor-LBATSM3M.cjs} +7 -6
- package/dist/{ConnectedNativeDocxEditor-YA4HWLY4.cjs.map → ConnectedNativeDocxEditor-LBATSM3M.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxEditor-JJAGMHZC.js → ConnectedNativeDocxEditor-NGUK2AX6.js} +5 -4
- package/dist/{ConnectedNativeDocxEditor-JJAGMHZC.js.map → ConnectedNativeDocxEditor-NGUK2AX6.js.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-EXYZAU4Y.cjs → ConnectedStreamedWordArtifact-CWFR6A37.cjs} +8 -7
- package/dist/ConnectedStreamedWordArtifact-CWFR6A37.cjs.map +1 -0
- package/dist/{ConnectedStreamedWordArtifact-YAAXY5KY.js → ConnectedStreamedWordArtifact-IXRJ7MUE.js} +7 -6
- package/dist/{ConnectedStreamedWordArtifact-YAAXY5KY.js.map → ConnectedStreamedWordArtifact-IXRJ7MUE.js.map} +1 -1
- package/dist/{NativeDocxEditor-M3I776GD.cjs → NativeDocxEditor-T2PJIZMU.cjs} +9 -7
- package/dist/{NativeDocxEditor-M3I776GD.cjs.map → NativeDocxEditor-T2PJIZMU.cjs.map} +1 -1
- package/dist/{NativeDocxEditor-JBQMH3MP.js → NativeDocxEditor-TBTBD6TC.js} +5 -3
- package/dist/{NativeDocxEditor-JBQMH3MP.js.map → NativeDocxEditor-TBTBD6TC.js.map} +1 -1
- package/dist/{WorkspaceTableView-5OWX53R5.js → WorkspaceTableView-DWUE4VQF.js} +19 -9
- package/dist/WorkspaceTableView-DWUE4VQF.js.map +1 -0
- package/dist/{WorkspaceTableView-ZFMAYHUD.cjs → WorkspaceTableView-EYLEUZZT.cjs} +21 -11
- package/dist/WorkspaceTableView-EYLEUZZT.cjs.map +1 -0
- package/dist/{chunk-IJEISII2.cjs → chunk-2BHDRVVL.cjs} +17 -7
- package/dist/chunk-2BHDRVVL.cjs.map +1 -0
- package/dist/chunk-2R3GGNPA.js +151 -0
- package/dist/chunk-2R3GGNPA.js.map +1 -0
- package/dist/{chunk-F3EZDBDJ.js → chunk-3OCNUKGX.js} +4 -4
- package/dist/{chunk-F3EZDBDJ.js.map → chunk-3OCNUKGX.js.map} +1 -1
- package/dist/{chunk-D3WFIFRY.cjs → chunk-3VW7ZXQ6.cjs} +211 -5
- package/dist/chunk-3VW7ZXQ6.cjs.map +1 -0
- package/dist/{chunk-JSQEAPTC.cjs → chunk-4GITK3Q5.cjs} +398 -75
- package/dist/chunk-4GITK3Q5.cjs.map +1 -0
- package/dist/{chunk-2CWM2CFZ.js → chunk-7UENVUA6.js} +4 -4
- package/dist/{chunk-2CWM2CFZ.js.map → chunk-7UENVUA6.js.map} +1 -1
- package/dist/{chunk-EWCJXUBP.js → chunk-AVXRXPII.js} +3 -3
- package/dist/{chunk-EWCJXUBP.js.map → chunk-AVXRXPII.js.map} +1 -1
- package/dist/{chunk-7IRSCMNK.js → chunk-BGXWPVHR.js} +3 -3
- package/dist/{chunk-7IRSCMNK.js.map → chunk-BGXWPVHR.js.map} +1 -1
- package/dist/chunk-DAN7EJ4O.js +482 -0
- package/dist/chunk-DAN7EJ4O.js.map +1 -0
- package/dist/chunk-E4H5H2C3.cjs +18 -0
- package/dist/{chunk-OTU5KGQ6.cjs.map → chunk-E4H5H2C3.cjs.map} +1 -1
- package/dist/{chunk-VY4UFXTM.cjs → chunk-ETJFC6MO.cjs} +4 -4
- package/dist/{chunk-VY4UFXTM.cjs.map → chunk-ETJFC6MO.cjs.map} +1 -1
- package/dist/{chunk-TQIY2SVY.cjs → chunk-GFVIFXWT.cjs} +5 -5
- package/dist/{chunk-TQIY2SVY.cjs.map → chunk-GFVIFXWT.cjs.map} +1 -1
- package/dist/chunk-JPWPR6QU.cjs +485 -0
- package/dist/chunk-JPWPR6QU.cjs.map +1 -0
- package/dist/{chunk-KQYPP72K.js → chunk-JTJCCL2E.js} +212 -9
- package/dist/chunk-JTJCCL2E.js.map +1 -0
- package/dist/{chunk-PGOSIJ2I.js → chunk-KFMRBZQK.js} +15 -5
- package/dist/chunk-KFMRBZQK.js.map +1 -0
- package/dist/chunk-NMZI3K6R.cjs +159 -0
- package/dist/chunk-NMZI3K6R.cjs.map +1 -0
- package/dist/{chunk-53RCZPMR.cjs → chunk-P2YM67Y5.cjs} +5 -5
- package/dist/{chunk-53RCZPMR.cjs.map → chunk-P2YM67Y5.cjs.map} +1 -1
- package/dist/chunk-Q2XGM372.cjs +18 -0
- package/dist/{chunk-S74QMZVZ.cjs.map → chunk-Q2XGM372.cjs.map} +1 -1
- package/dist/{chunk-7HHYMDPE.js → chunk-RATEAOKT.js} +3 -3
- package/dist/{chunk-7HHYMDPE.js.map → chunk-RATEAOKT.js.map} +1 -1
- package/dist/{chunk-SN2GZ4ZM.cjs → chunk-TQUYWUEE.cjs} +10 -156
- package/dist/chunk-TQUYWUEE.cjs.map +1 -0
- package/dist/{chunk-ONTUMV74.js → chunk-XER3JLC7.js} +398 -78
- package/dist/chunk-XER3JLC7.js.map +1 -0
- package/dist/{chunk-HP2C4MD3.js → chunk-ZDOKJD44.js} +4 -143
- package/dist/chunk-ZDOKJD44.js.map +1 -0
- package/dist/connect/docx.cjs +11 -10
- package/dist/connect/docx.js +7 -6
- package/dist/connect/index.cjs +406 -384
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +69 -47
- package/dist/connect/index.js.map +1 -1
- package/dist/connect/viewer.cjs +41 -20
- package/dist/connect/viewer.cjs.map +1 -1
- package/dist/connect/viewer.js +29 -8
- package/dist/connect/viewer.js.map +1 -1
- package/dist/connection/viewer/ViewerPdfPane.d.ts +7 -1
- package/dist/connection/workspace-list/ConnectedWorkspaceList.d.ts +4 -2
- package/dist/connection/workspace-list/WorkspaceCardsView.d.ts +3 -2
- package/dist/connection/workspace-list/WorkspaceTableView.d.ts +3 -2
- package/dist/connection/workspace-list/index.d.ts +1 -1
- package/dist/connection/workspace-list/useConnectedWorkspaceList.d.ts +19 -0
- package/dist/connection/workspace-list/workspaceTable.d.ts +3 -1
- package/dist/connection/workspace-settings/ConnectedWorkspaceSettings.d.ts +3 -1
- package/dist/document-tools/AdoptSignatureDialog.d.ts +39 -4
- package/dist/document-tools/PlaceMySignatureButton.d.ts +16 -0
- package/dist/document-tools/SavedSignatureSettings.d.ts +10 -0
- package/dist/document-tools/index.cjs +37 -22
- package/dist/document-tools/index.d.ts +2 -0
- package/dist/document-tools/index.js +5 -2
- package/dist/document-tools/viewer/AnnotatedPdfViewer.d.ts +10 -1
- package/dist/document-tools/viewer/SignatureRequestEditor.d.ts +7 -4
- package/dist/document-tools/viewer/index.cjs +184 -18
- package/dist/document-tools/viewer/index.cjs.map +1 -1
- package/dist/document-tools/viewer/index.js +184 -18
- package/dist/document-tools/viewer/index.js.map +1 -1
- package/dist/docx/NativeDocxEditor.d.ts +5 -0
- package/dist/docx/index.cjs +61 -47
- package/dist/docx/index.d.ts +1 -0
- package/dist/docx/index.js +5 -3
- package/dist/docx/signatures/SignatureFields.d.ts +50 -0
- package/dist/settings/index.cjs +183 -182
- package/dist/settings/index.js +2 -1
- package/node_modules/@arbidocs/coedit/dist/commands.cjs +109 -16
- package/node_modules/@arbidocs/coedit/dist/commands.cjs.map +1 -1
- package/node_modules/@arbidocs/coedit/dist/commands.d.cts +84 -1
- package/node_modules/@arbidocs/coedit/dist/commands.d.ts +84 -1
- package/node_modules/@arbidocs/coedit/dist/commands.js +99 -17
- package/node_modules/@arbidocs/coedit/dist/commands.js.map +1 -1
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/src/docx/styles.css +50 -0
- package/dist/ConnectedStreamedWordArtifact-EXYZAU4Y.cjs.map +0 -1
- package/dist/WorkspaceTableView-5OWX53R5.js.map +0 -1
- package/dist/WorkspaceTableView-ZFMAYHUD.cjs.map +0 -1
- package/dist/chunk-6MG62I5B.cjs +0 -272
- package/dist/chunk-6MG62I5B.cjs.map +0 -1
- package/dist/chunk-D3WFIFRY.cjs.map +0 -1
- package/dist/chunk-EQB3WELX.js +0 -269
- package/dist/chunk-EQB3WELX.js.map +0 -1
- package/dist/chunk-HP2C4MD3.js.map +0 -1
- package/dist/chunk-IJEISII2.cjs.map +0 -1
- package/dist/chunk-JSQEAPTC.cjs.map +0 -1
- package/dist/chunk-KQYPP72K.js.map +0 -1
- package/dist/chunk-ONTUMV74.js.map +0 -1
- package/dist/chunk-OTU5KGQ6.cjs +0 -18
- package/dist/chunk-PGOSIJ2I.js.map +0 -1
- package/dist/chunk-S74QMZVZ.cjs +0 -18
- package/dist/chunk-SN2GZ4ZM.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useConnectedNativeDocxAdapter } from './chunk-
|
|
3
|
-
import { StreamedWordArtifact } from './chunk-
|
|
2
|
+
import { useConnectedNativeDocxAdapter } from './chunk-KFMRBZQK.js';
|
|
3
|
+
import { StreamedWordArtifact } from './chunk-BGXWPVHR.js';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
function ConnectedStreamedWordArtifact({
|
|
@@ -12,5 +12,5 @@ function ConnectedStreamedWordArtifact({
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export { ConnectedStreamedWordArtifact };
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
15
|
+
//# sourceMappingURL=chunk-7UENVUA6.js.map
|
|
16
|
+
//# sourceMappingURL=chunk-7UENVUA6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connection/docx/ConnectedStreamedWordArtifact.tsx"],"names":[],"mappings":";;;;AAMO,SAAS,6BAAA,CAA8B;AAAA,EAC5C,WAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA0E;AACxE,EAAA,MAAM,OAAA,GAAU,8BAA8B,WAAW,CAAA;AACzD,EAAA,uBAAO,GAAA,CAAC,oBAAA,EAAA,EAAsB,GAAG,KAAA,EAAO,OAAA,EAAkB,CAAA;AAC5D","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/connection/docx/ConnectedStreamedWordArtifact.tsx"],"names":[],"mappings":";;;;AAMO,SAAS,6BAAA,CAA8B;AAAA,EAC5C,WAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA0E;AACxE,EAAA,MAAM,OAAA,GAAU,8BAA8B,WAAW,CAAA;AACzD,EAAA,uBAAO,GAAA,CAAC,oBAAA,EAAA,EAAsB,GAAG,KAAA,EAAO,OAAA,EAAkB,CAAA;AAC5D","file":"chunk-7UENVUA6.js","sourcesContent":["import { useConnectedNativeDocxAdapter } from './ConnectedNativeDocxEditor'\nimport {\n StreamedWordArtifact,\n type StreamedWordArtifactProps,\n} from '../../docx/StreamedWordArtifact'\n\nexport function ConnectedStreamedWordArtifact({\n fontBaseUrl,\n ...props\n}: Omit<StreamedWordArtifactProps, 'adapter'> & { fontBaseUrl?: string }) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n return <StreamedWordArtifact {...props} adapter={adapter} />\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { NativeDocxEditor } from './chunk-
|
|
2
|
+
import { NativeDocxEditor } from './chunk-XER3JLC7.js';
|
|
3
3
|
import { useRef, useState, useEffect } from 'react';
|
|
4
4
|
import { parseVersionRef } from '@arbidocs/react/artifacts';
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
@@ -61,5 +61,5 @@ function NativeDocxComparison({
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export { NativeDocxComparison };
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
64
|
+
//# sourceMappingURL=chunk-AVXRXPII.js.map
|
|
65
|
+
//# sourceMappingURL=chunk-AVXRXPII.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/docx/NativeDocxComparison.tsx"],"names":["error"],"mappings":";;;;;AAaA,SAAS,YAAA,CAAa,QAAgB,SAAA,EAAoC;AACxE,EAAA,MAAM,IAAA,GAAO,gBAAgB,MAAM,CAAA;AACnC,EAAA,MAAM,OAAA,GAAU,gBAAgB,SAAS,CAAA;AACzC,EAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,EAAE,WAAA,EAAa,KAAK,KAAA,EAAO,cAAA,EAAgB,OAAA,CAAQ,KAAA,EAAO,CAAA;AAC5F,EAAA,IAAI,IAAA,CAAK,SAAS,KAAA,CAAM,GAAA,CAAI,gBAAgB,MAAA,CAAO,IAAA,CAAK,OAAO,CAAC,CAAA;AAChE,EAAA,IAAI,OAAA,CAAQ,SAAS,KAAA,CAAM,GAAA,CAAI,mBAAmB,MAAA,CAAO,OAAA,CAAQ,OAAO,CAAC,CAAA;AACzE,EAAA,OAAO,KAAA;AACT;AAGO,SAAS,oBAAA,CAAqB;AAAA,EACnC,OAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,EAA8B;AAC5B,EAAA,MAAM,IAAA,GAAO,MAAA,CAAO,EAAE,OAAA,EAAS,YAAY,CAAA;AAC3C,EAAA,IAAA,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A,KAAA;AAAA,IAHlC;AAAA,GAIP;AAEJ","file":"chunk-AVXRXPII.js","sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { parseVersionRef } from '@arbidocs/react/artifacts'\nimport { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\nexport interface NativeDocxComparisonProps {\n adapter: NativeDocxAdapter\n baseId: string\n revisedId: string\n title: string\n onCompared?: (documentId: string) => void | Promise<void>\n}\n\n/** A `doc-…@v{n}` side names an older version: the endpoint takes its document and version apart. */\nfunction redlineQuery(baseId: string, revisedId: string): URLSearchParams {\n const base = parseVersionRef(baseId)\n const revised = parseVersionRef(revisedId)\n const query = new URLSearchParams({ base_ext_id: base.docId, revised_ext_id: revised.docId })\n if (base.version) query.set('base_version', String(base.version))\n if (revised.version) query.set('revised_version', String(revised.version))\n return query\n}\n\n/** Word comparison through the host's authenticated transport and LibreOffice service. */\nexport function NativeDocxComparison({\n adapter,\n baseId,\n revisedId,\n title,\n onCompared,\n}: NativeDocxComparisonProps) {\n const host = useRef({ adapter, onCompared })\n host.current = { adapter, onCompared }\n const [documentId, setDocumentId] = useState('')\n const [error, setError] = useState('')\n const [attempt, setAttempt] = useState(0)\n useEffect(() => {\n let cancelled = false\n setDocumentId('')\n setError('')\n void host.current.adapter\n .request(`/redline?${redlineQuery(baseId, revisedId)}`, { method: 'POST' })\n .then((response) => response.json())\n .then((result: { document_ext_id: string }) => {\n if (!result.document_ext_id) throw new Error('Comparison did not return a Word document.')\n if (!cancelled) {\n setDocumentId(result.document_ext_id)\n void Promise.resolve(host.current.onCompared?.(result.document_ext_id)).catch(() => {})\n }\n })\n .catch((error) => {\n if (!cancelled) setError(error instanceof Error ? error.message : String(error))\n })\n return () => {\n cancelled = true\n }\n }, [baseId, revisedId, attempt])\n if (error)\n return (\n <div className=\"native-docx-error\" role=\"alert\">\n <p>{error}</p>\n <button onClick={() => setAttempt((value) => value + 1)}>Retry comparison</button>\n </div>\n )\n if (!documentId)\n return (\n <div className=\"native-docx-error\" role=\"status\">\n Comparing Word documents…\n </div>\n )\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={`${title.replace(/\\.[^.]+$/, '')} (redline).docx`}\n />\n )\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { NativeDocxEditor } from './chunk-
|
|
2
|
+
import { NativeDocxEditor } from './chunk-XER3JLC7.js';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
5
|
function StreamedWordArtifact({
|
|
@@ -37,5 +37,5 @@ function StreamedWordArtifact({
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export { StreamedWordArtifact };
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
40
|
+
//# sourceMappingURL=chunk-BGXWPVHR.js.map
|
|
41
|
+
//# sourceMappingURL=chunk-BGXWPVHR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/docx/StreamedWordArtifact.tsx"],"names":[],"mappings":";;;AAmBO,SAAS,oBAAA,CAAqB;AAAA,EACnC,OAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA,EAA8B;AAC5B,EAAA,IAAI,CAAC,QAAQ,UAAA,EAAY;AACvB,IAAA,uBACE,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QAEC,OAAA;AAAA,QACA,UAAA;AAAA,QACA,KAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAJK;AAAA,KAKP;AAAA,EAEJ;AACA,EAAA,uBACE,GAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MAEC,OAAA;AAAA,MACA,UAAA,EAAW,gBAAA;AAAA,MACX,KAAA;AAAA,MACA,YAAA,EAAa,EAAA;AAAA,MACb,MAAA,EAAQ,EAAE,OAAA,EAAS,IAAA,EAAM,KAAA;AAAM,KAAA;AAAA,IAL3B;AAAA,GAMN;AAEJ","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/docx/StreamedWordArtifact.tsx"],"names":[],"mappings":";;;AAmBO,SAAS,oBAAA,CAAqB;AAAA,EACnC,OAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA,EAA8B;AAC5B,EAAA,IAAI,CAAC,QAAQ,UAAA,EAAY;AACvB,IAAA,uBACE,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QAEC,OAAA;AAAA,QACA,UAAA;AAAA,QACA,KAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAJK;AAAA,KAKP;AAAA,EAEJ;AACA,EAAA,uBACE,GAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MAEC,OAAA;AAAA,MACA,UAAA,EAAW,gBAAA;AAAA,MACX,KAAA;AAAA,MACA,YAAA,EAAa,EAAA;AAAA,MACb,MAAA,EAAQ,EAAE,OAAA,EAAS,IAAA,EAAM,KAAA;AAAM,KAAA;AAAA,IAL3B;AAAA,GAMN;AAEJ","file":"chunk-BGXWPVHR.js","sourcesContent":["import { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\nexport interface StreamedWordArtifactProps {\n adapter: NativeDocxAdapter\n /** Streamed Markdown, shown as a read-only preview while the draft is generated. */\n content: string\n title: string\n busy: boolean\n error?: string | null\n /** The DOCX draft the server stored for this generation (`doc-…`), once known. */\n documentId?: string\n onSaved?: (documentId: string) => void\n}\n\n/**\n * One drafting surface for an AI document draft. The server stores every draft as DOCX, so\n * this component never creates a document: it previews the streamed Markdown until generation\n * ends and the stored DOCX is known, then opens that DOCX in the live collaborative editor.\n */\nexport function StreamedWordArtifact({\n adapter,\n content,\n title,\n busy,\n error,\n documentId,\n onSaved,\n}: StreamedWordArtifactProps) {\n if (!busy && documentId) {\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={title}\n onSaved={onSaved}\n />\n )\n }\n return (\n <NativeDocxEditor\n key=\"stream-preview\"\n adapter={adapter}\n documentId=\"stream-preview\"\n title={title}\n draftContent=\"\"\n stream={{ content, busy, error }}\n />\n )\n}\n"]}
|
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ModalScaffold } from './chunk-TX2ZICS7.js';
|
|
3
|
+
import { forwardRef, useRef, useCallback, useEffect, useImperativeHandle, useState } from 'react';
|
|
4
|
+
import { initialsOf, intentText } from '@arbidocs/react/document-tools';
|
|
5
|
+
import { cn, Label, Input, Tabs, TabsList, TabsTrigger, TabsContent, Button, Checkbox } from '@arbidocs/react/ui';
|
|
6
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var TYPED_SIGNATURE_STYLE = {
|
|
9
|
+
fontFamily: '"Times New Roman", Times, serif',
|
|
10
|
+
fontStyle: "italic",
|
|
11
|
+
color: "#0d1a59"
|
|
12
|
+
};
|
|
13
|
+
var SignaturePad = forwardRef(function SignaturePad2({ label, className, onInk, testId }, ref) {
|
|
14
|
+
const canvas = useRef(null);
|
|
15
|
+
const strokes = useRef([]);
|
|
16
|
+
const drawing = useRef(null);
|
|
17
|
+
const paint = useCallback(() => {
|
|
18
|
+
const c = canvas.current;
|
|
19
|
+
const ctx = c?.getContext("2d");
|
|
20
|
+
if (!c || !ctx) return;
|
|
21
|
+
const ratio = window.devicePixelRatio || 1;
|
|
22
|
+
const width = c.width / ratio;
|
|
23
|
+
const height = c.height / ratio;
|
|
24
|
+
ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
|
|
25
|
+
ctx.clearRect(0, 0, width, height);
|
|
26
|
+
ctx.lineWidth = Math.min(4, Math.max(2, height * 0.018));
|
|
27
|
+
ctx.lineCap = "round";
|
|
28
|
+
ctx.lineJoin = "round";
|
|
29
|
+
ctx.strokeStyle = TYPED_SIGNATURE_STYLE.color;
|
|
30
|
+
for (const stroke of strokes.current) {
|
|
31
|
+
if (!stroke.length) continue;
|
|
32
|
+
ctx.beginPath();
|
|
33
|
+
ctx.moveTo(stroke[0].x * width, stroke[0].y * height);
|
|
34
|
+
if (stroke.length === 1) ctx.lineTo(stroke[0].x * width + 0.1, stroke[0].y * height);
|
|
35
|
+
for (const p of stroke.slice(1)) ctx.lineTo(p.x * width, p.y * height);
|
|
36
|
+
ctx.stroke();
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
const c = canvas.current;
|
|
41
|
+
if (!c) return;
|
|
42
|
+
const fit = () => {
|
|
43
|
+
const rect = c.getBoundingClientRect();
|
|
44
|
+
const ratio = window.devicePixelRatio || 1;
|
|
45
|
+
const width = Math.max(1, Math.round(rect.width * ratio));
|
|
46
|
+
const height = Math.max(1, Math.round(rect.height * ratio));
|
|
47
|
+
if (c.width !== width || c.height !== height) {
|
|
48
|
+
c.width = width;
|
|
49
|
+
c.height = height;
|
|
50
|
+
}
|
|
51
|
+
paint();
|
|
52
|
+
};
|
|
53
|
+
fit();
|
|
54
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(fit);
|
|
55
|
+
observer?.observe(c);
|
|
56
|
+
return () => observer?.disconnect();
|
|
57
|
+
}, [paint]);
|
|
58
|
+
useImperativeHandle(
|
|
59
|
+
ref,
|
|
60
|
+
() => ({
|
|
61
|
+
isBlank: () => strokes.current.every((s) => s.length === 0),
|
|
62
|
+
toDataUrl: () => strokes.current.some((s) => s.length) ? canvas.current?.toDataURL("image/png") ?? null : null,
|
|
63
|
+
clear: () => {
|
|
64
|
+
strokes.current = [];
|
|
65
|
+
paint();
|
|
66
|
+
onInk(false);
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
[paint, onInk]
|
|
70
|
+
);
|
|
71
|
+
const at = (e) => {
|
|
72
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
73
|
+
return {
|
|
74
|
+
x: Math.min(1, Math.max(0, (e.clientX - r.left) / (r.width || 1))),
|
|
75
|
+
y: Math.min(1, Math.max(0, (e.clientY - r.top) / (r.height || 1)))
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
return /* @__PURE__ */ jsx(
|
|
79
|
+
"canvas",
|
|
80
|
+
{
|
|
81
|
+
ref: canvas,
|
|
82
|
+
className: cn(
|
|
83
|
+
"block touch-none rounded-md border bg-white select-none [overscroll-behavior:contain]",
|
|
84
|
+
className
|
|
85
|
+
),
|
|
86
|
+
style: { touchAction: "none" },
|
|
87
|
+
"aria-label": label,
|
|
88
|
+
role: "img",
|
|
89
|
+
onPointerDown: (e) => {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
92
|
+
drawing.current = [at(e)];
|
|
93
|
+
strokes.current.push(drawing.current);
|
|
94
|
+
paint();
|
|
95
|
+
onInk(true);
|
|
96
|
+
},
|
|
97
|
+
onPointerMove: (e) => {
|
|
98
|
+
if (!drawing.current) return;
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
const native = e.nativeEvent;
|
|
101
|
+
const samples = native.getCoalescedEvents?.() ?? [];
|
|
102
|
+
if (samples.length) {
|
|
103
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
104
|
+
for (const s of samples)
|
|
105
|
+
drawing.current.push({
|
|
106
|
+
x: Math.min(1, Math.max(0, (s.clientX - r.left) / (r.width || 1))),
|
|
107
|
+
y: Math.min(1, Math.max(0, (s.clientY - r.top) / (r.height || 1)))
|
|
108
|
+
});
|
|
109
|
+
} else drawing.current.push(at(e));
|
|
110
|
+
paint();
|
|
111
|
+
},
|
|
112
|
+
onPointerUp: () => drawing.current = null,
|
|
113
|
+
onPointerCancel: () => drawing.current = null,
|
|
114
|
+
"data-testid": testId
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
async function uploadedPng(file) {
|
|
119
|
+
const url = URL.createObjectURL(file);
|
|
120
|
+
try {
|
|
121
|
+
const img = new Image();
|
|
122
|
+
await new Promise((resolve, reject) => {
|
|
123
|
+
img.onload = () => resolve();
|
|
124
|
+
img.onerror = () => reject(new Error("That file is not an image"));
|
|
125
|
+
img.src = url;
|
|
126
|
+
});
|
|
127
|
+
const canvas = document.createElement("canvas");
|
|
128
|
+
canvas.width = 900;
|
|
129
|
+
canvas.height = 300;
|
|
130
|
+
const ctx = canvas.getContext("2d");
|
|
131
|
+
const scale = Math.min(canvas.width / img.width, canvas.height / img.height);
|
|
132
|
+
const w = img.width * scale;
|
|
133
|
+
const h = img.height * scale;
|
|
134
|
+
ctx.drawImage(img, (canvas.width - w) / 2, (canvas.height - h) / 2, w, h);
|
|
135
|
+
const pixels = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
|
136
|
+
for (let i = 0; i < pixels.data.length; i += 4) {
|
|
137
|
+
const [r, g, b] = [pixels.data[i], pixels.data[i + 1], pixels.data[i + 2]];
|
|
138
|
+
if (r > 225 && g > 225 && b > 225) pixels.data[i + 3] = 0;
|
|
139
|
+
}
|
|
140
|
+
ctx.putImageData(pixels, 0, 0);
|
|
141
|
+
return canvas.toDataURL("image/png");
|
|
142
|
+
} finally {
|
|
143
|
+
URL.revokeObjectURL(url);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
var base64Of = (dataUrl) => dataUrl.slice(dataUrl.indexOf(",") + 1);
|
|
147
|
+
var dataUrlOf = (png) => `data:image/png;base64,${png}`;
|
|
148
|
+
function typedPng(text, height = 120) {
|
|
149
|
+
const canvas = document.createElement("canvas");
|
|
150
|
+
const ctx = canvas.getContext("2d");
|
|
151
|
+
if (!ctx) return "";
|
|
152
|
+
const font = `italic ${Math.round(height * 0.6)}px ${TYPED_SIGNATURE_STYLE.fontFamily}`;
|
|
153
|
+
ctx.font = font;
|
|
154
|
+
const width = Math.max(height, Math.ceil(ctx.measureText(text).width + height * 0.4));
|
|
155
|
+
canvas.width = width;
|
|
156
|
+
canvas.height = height;
|
|
157
|
+
ctx.font = font;
|
|
158
|
+
ctx.fillStyle = TYPED_SIGNATURE_STYLE.color;
|
|
159
|
+
ctx.textBaseline = "middle";
|
|
160
|
+
ctx.fillText(text, height * 0.2, height / 2);
|
|
161
|
+
return base64Of(canvas.toDataURL("image/png"));
|
|
162
|
+
}
|
|
163
|
+
var PAD_SIGNATURE = "-mx-6 w-[calc(100%+3rem)] h-[44vw] min-h-36 sm:mx-0 sm:w-full sm:h-56";
|
|
164
|
+
var PAD_INITIALS = "-mx-6 w-[calc(100%+3rem)] h-[34vw] min-h-28 sm:mx-0 sm:w-80 sm:h-40";
|
|
165
|
+
function AdoptSignatureDialog({
|
|
166
|
+
open,
|
|
167
|
+
onOpenChange,
|
|
168
|
+
defaultName,
|
|
169
|
+
onAdopt,
|
|
170
|
+
saved = null,
|
|
171
|
+
onSave,
|
|
172
|
+
mode = "adopt"
|
|
173
|
+
}) {
|
|
174
|
+
const saving = mode === "save";
|
|
175
|
+
const [saveToAccount, setSaveToAccount] = useState(false);
|
|
176
|
+
const [busy, setBusy] = useState(false);
|
|
177
|
+
const [savedDrawing, setSavedDrawing] = useState(null);
|
|
178
|
+
const [savedInitials, setSavedInitials] = useState(null);
|
|
179
|
+
const [name, setName] = useState(defaultName);
|
|
180
|
+
const [initials, setInitials] = useState(() => initialsOf(defaultName));
|
|
181
|
+
const [style, setStyle] = useState("typed");
|
|
182
|
+
const [initialsStyle, setInitialsStyle] = useState("typed");
|
|
183
|
+
const [hasInk, setHasInk] = useState(false);
|
|
184
|
+
const [hasInitialsInk, setHasInitialsInk] = useState(false);
|
|
185
|
+
const [upload, setUpload] = useState(null);
|
|
186
|
+
const [error, setError] = useState(null);
|
|
187
|
+
const signaturePad = useRef(null);
|
|
188
|
+
const initialsPad = useRef(null);
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
if (!open) return;
|
|
191
|
+
setSaveToAccount(false);
|
|
192
|
+
setError(null);
|
|
193
|
+
if (saved) {
|
|
194
|
+
setName(saved.name);
|
|
195
|
+
setInitials(saved.initials);
|
|
196
|
+
setStyle(saved.style);
|
|
197
|
+
setInitialsStyle(saved.initials_style);
|
|
198
|
+
setSavedDrawing(saved.style === "drawn" ? dataUrlOf(saved.signature_png) : null);
|
|
199
|
+
setUpload(saved.style === "uploaded" ? dataUrlOf(saved.signature_png) : null);
|
|
200
|
+
setSavedInitials(saved.initials_style === "drawn" ? dataUrlOf(saved.initials_png) : null);
|
|
201
|
+
} else {
|
|
202
|
+
setName(defaultName);
|
|
203
|
+
setInitials(initialsOf(defaultName));
|
|
204
|
+
}
|
|
205
|
+
}, [open, defaultName, saved]);
|
|
206
|
+
const adopt = async () => {
|
|
207
|
+
setError(null);
|
|
208
|
+
if (!name.trim() || !initials.trim()) return;
|
|
209
|
+
let signatureUrl = null;
|
|
210
|
+
if (style === "drawn") {
|
|
211
|
+
signatureUrl = signaturePad.current?.toDataUrl() ?? (hasInk ? null : savedDrawing);
|
|
212
|
+
if (!signatureUrl) return setError("Draw your signature first.");
|
|
213
|
+
} else if (style === "uploaded") {
|
|
214
|
+
signatureUrl = upload;
|
|
215
|
+
if (!signatureUrl) return setError("Choose an image first.");
|
|
216
|
+
}
|
|
217
|
+
let initialsUrl = null;
|
|
218
|
+
if (initialsStyle === "drawn") {
|
|
219
|
+
initialsUrl = initialsPad.current?.toDataUrl() ?? (hasInitialsInk ? null : savedInitials);
|
|
220
|
+
if (!initialsUrl) return setError("Draw your initials first.");
|
|
221
|
+
}
|
|
222
|
+
if (onSave && (saving || saveToAccount)) {
|
|
223
|
+
setBusy(true);
|
|
224
|
+
try {
|
|
225
|
+
await onSave({
|
|
226
|
+
name: name.trim(),
|
|
227
|
+
initials: initials.trim(),
|
|
228
|
+
style,
|
|
229
|
+
initials_style: initialsStyle,
|
|
230
|
+
signature_png: signatureUrl ? base64Of(signatureUrl) : typedPng(name.trim()),
|
|
231
|
+
initials_png: initialsUrl ? base64Of(initialsUrl) : typedPng(initials.trim())
|
|
232
|
+
});
|
|
233
|
+
} catch (err) {
|
|
234
|
+
setError(err instanceof Error ? err.message : "Your signature could not be saved");
|
|
235
|
+
return;
|
|
236
|
+
} finally {
|
|
237
|
+
setBusy(false);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
onAdopt({
|
|
241
|
+
adopted: {
|
|
242
|
+
name: name.trim(),
|
|
243
|
+
initials: initials.trim(),
|
|
244
|
+
style,
|
|
245
|
+
...signatureUrl ? { signature_image: base64Of(signatureUrl) } : {},
|
|
246
|
+
...initialsUrl ? { initials_image: base64Of(initialsUrl) } : {}
|
|
247
|
+
},
|
|
248
|
+
signatureUrl,
|
|
249
|
+
initialsUrl
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
return /* @__PURE__ */ jsxs(
|
|
253
|
+
ModalScaffold,
|
|
254
|
+
{
|
|
255
|
+
open,
|
|
256
|
+
onOpenChange,
|
|
257
|
+
title: saving ? "Your signature" : "Adopt your signature",
|
|
258
|
+
description: saving ? "Saved to your account, sealed with your own key, for placing in documents yourself." : "You adopt it once and apply it at each place you are asked to sign.",
|
|
259
|
+
showDescription: true,
|
|
260
|
+
size: "lg",
|
|
261
|
+
testId: "adopt-signature-dialog",
|
|
262
|
+
children: [
|
|
263
|
+
/* @__PURE__ */ jsxs(ModalScaffold.Body, { children: [
|
|
264
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[1fr_7rem] gap-3", children: [
|
|
265
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
266
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "adopt-name", children: "Full name" }),
|
|
267
|
+
/* @__PURE__ */ jsx(
|
|
268
|
+
Input,
|
|
269
|
+
{
|
|
270
|
+
id: "adopt-name",
|
|
271
|
+
value: name,
|
|
272
|
+
onChange: (e) => {
|
|
273
|
+
setName(e.target.value);
|
|
274
|
+
setInitials(initialsOf(e.target.value));
|
|
275
|
+
},
|
|
276
|
+
"data-testid": "adopt-signature-name"
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
] }),
|
|
280
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
281
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "adopt-initials", children: "Initials" }),
|
|
282
|
+
/* @__PURE__ */ jsx(
|
|
283
|
+
Input,
|
|
284
|
+
{
|
|
285
|
+
id: "adopt-initials",
|
|
286
|
+
value: initials,
|
|
287
|
+
maxLength: 12,
|
|
288
|
+
onChange: (e) => setInitials(e.target.value),
|
|
289
|
+
"data-testid": "adopt-signature-initials"
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
] })
|
|
293
|
+
] }),
|
|
294
|
+
/* @__PURE__ */ jsxs("section", { className: "space-y-1.5", "aria-label": "Signature", children: [
|
|
295
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: "Signature" }),
|
|
296
|
+
/* @__PURE__ */ jsxs(
|
|
297
|
+
Tabs,
|
|
298
|
+
{
|
|
299
|
+
value: style,
|
|
300
|
+
onValueChange: (v) => {
|
|
301
|
+
setStyle(v);
|
|
302
|
+
setError(null);
|
|
303
|
+
},
|
|
304
|
+
children: [
|
|
305
|
+
/* @__PURE__ */ jsxs(TabsList, { className: "grid w-full grid-cols-3", children: [
|
|
306
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "typed", "data-testid": "adopt-tab-typed", children: "Type" }),
|
|
307
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "drawn", "data-testid": "adopt-tab-drawn", children: "Draw" }),
|
|
308
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "uploaded", "data-testid": "adopt-tab-uploaded", children: "Upload" })
|
|
309
|
+
] }),
|
|
310
|
+
/* @__PURE__ */ jsx(TabsContent, { value: "typed", children: /* @__PURE__ */ jsx(
|
|
311
|
+
"div",
|
|
312
|
+
{
|
|
313
|
+
className: "flex h-28 items-center justify-center overflow-hidden rounded-md border bg-white px-4 text-4xl whitespace-nowrap",
|
|
314
|
+
style: TYPED_SIGNATURE_STYLE,
|
|
315
|
+
"data-testid": "adopt-signature-typed-preview",
|
|
316
|
+
children: name.trim() || "Your name"
|
|
317
|
+
}
|
|
318
|
+
) }),
|
|
319
|
+
/* @__PURE__ */ jsxs(TabsContent, { value: "drawn", forceMount: true, hidden: style !== "drawn", children: [
|
|
320
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
321
|
+
/* @__PURE__ */ jsx(
|
|
322
|
+
SignaturePad,
|
|
323
|
+
{
|
|
324
|
+
ref: signaturePad,
|
|
325
|
+
label: "Draw your signature",
|
|
326
|
+
className: PAD_SIGNATURE,
|
|
327
|
+
onInk: setHasInk,
|
|
328
|
+
testId: "adopt-signature-canvas"
|
|
329
|
+
}
|
|
330
|
+
),
|
|
331
|
+
savedDrawing && !hasInk && /* @__PURE__ */ jsx(
|
|
332
|
+
"img",
|
|
333
|
+
{
|
|
334
|
+
src: savedDrawing,
|
|
335
|
+
alt: "Your saved signature",
|
|
336
|
+
className: "pointer-events-none absolute inset-0 h-full w-full object-contain p-2",
|
|
337
|
+
"data-testid": "adopt-signature-saved"
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
] }),
|
|
341
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pt-1 text-xs text-muted-foreground", children: [
|
|
342
|
+
/* @__PURE__ */ jsx("span", { children: "Sign with your finger, a pen or the mouse." }),
|
|
343
|
+
/* @__PURE__ */ jsx(
|
|
344
|
+
Button,
|
|
345
|
+
{
|
|
346
|
+
type: "button",
|
|
347
|
+
variant: "ghost",
|
|
348
|
+
size: "sm",
|
|
349
|
+
onClick: () => signaturePad.current?.clear(),
|
|
350
|
+
disabled: !hasInk,
|
|
351
|
+
"data-testid": "adopt-signature-clear",
|
|
352
|
+
children: "Clear"
|
|
353
|
+
}
|
|
354
|
+
)
|
|
355
|
+
] })
|
|
356
|
+
] }),
|
|
357
|
+
/* @__PURE__ */ jsxs(TabsContent, { value: "uploaded", forceMount: true, hidden: style !== "uploaded", children: [
|
|
358
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-28 items-center justify-center rounded-md border bg-white", children: upload ? /* @__PURE__ */ jsx("img", { src: upload, alt: "Uploaded signature", className: "h-full object-contain" }) : /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: "No image chosen" }) }),
|
|
359
|
+
/* @__PURE__ */ jsx(
|
|
360
|
+
Input,
|
|
361
|
+
{
|
|
362
|
+
type: "file",
|
|
363
|
+
accept: "image/png,image/jpeg,image/webp",
|
|
364
|
+
className: "mt-2",
|
|
365
|
+
onChange: async (e) => {
|
|
366
|
+
const file = e.target.files?.[0];
|
|
367
|
+
if (!file) return;
|
|
368
|
+
try {
|
|
369
|
+
setUpload(await uploadedPng(file));
|
|
370
|
+
setError(null);
|
|
371
|
+
} catch (err) {
|
|
372
|
+
setError(err instanceof Error ? err.message : "The image could not be read");
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
"data-testid": "adopt-signature-upload"
|
|
376
|
+
}
|
|
377
|
+
)
|
|
378
|
+
] })
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
)
|
|
382
|
+
] }),
|
|
383
|
+
/* @__PURE__ */ jsxs("section", { className: "space-y-1.5", "aria-label": "Initials", children: [
|
|
384
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: "Initials" }),
|
|
385
|
+
/* @__PURE__ */ jsxs(
|
|
386
|
+
Tabs,
|
|
387
|
+
{
|
|
388
|
+
value: initialsStyle,
|
|
389
|
+
onValueChange: (v) => {
|
|
390
|
+
setInitialsStyle(v);
|
|
391
|
+
setError(null);
|
|
392
|
+
},
|
|
393
|
+
children: [
|
|
394
|
+
/* @__PURE__ */ jsxs(TabsList, { className: "grid w-full grid-cols-2 sm:w-80", children: [
|
|
395
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "typed", "data-testid": "adopt-initials-tab-typed", children: "Type" }),
|
|
396
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "drawn", "data-testid": "adopt-initials-tab-drawn", children: "Draw" })
|
|
397
|
+
] }),
|
|
398
|
+
/* @__PURE__ */ jsx(TabsContent, { value: "typed", children: /* @__PURE__ */ jsx(
|
|
399
|
+
"div",
|
|
400
|
+
{
|
|
401
|
+
className: "flex h-20 items-center justify-center rounded-md border bg-white px-4 text-3xl sm:w-80",
|
|
402
|
+
style: TYPED_SIGNATURE_STYLE,
|
|
403
|
+
"data-testid": "adopt-initials-typed-preview",
|
|
404
|
+
children: initials.trim() || "AB"
|
|
405
|
+
}
|
|
406
|
+
) }),
|
|
407
|
+
/* @__PURE__ */ jsxs(TabsContent, { value: "drawn", forceMount: true, hidden: initialsStyle !== "drawn", children: [
|
|
408
|
+
/* @__PURE__ */ jsxs("div", { className: "relative sm:w-80", children: [
|
|
409
|
+
/* @__PURE__ */ jsx(
|
|
410
|
+
SignaturePad,
|
|
411
|
+
{
|
|
412
|
+
ref: initialsPad,
|
|
413
|
+
label: "Draw your initials",
|
|
414
|
+
className: PAD_INITIALS,
|
|
415
|
+
onInk: setHasInitialsInk,
|
|
416
|
+
testId: "adopt-initials-canvas"
|
|
417
|
+
}
|
|
418
|
+
),
|
|
419
|
+
savedInitials && !hasInitialsInk && /* @__PURE__ */ jsx(
|
|
420
|
+
"img",
|
|
421
|
+
{
|
|
422
|
+
src: savedInitials,
|
|
423
|
+
alt: "Your saved initials",
|
|
424
|
+
className: "pointer-events-none absolute inset-0 h-full w-full object-contain p-2"
|
|
425
|
+
}
|
|
426
|
+
)
|
|
427
|
+
] }),
|
|
428
|
+
/* @__PURE__ */ jsx(
|
|
429
|
+
Button,
|
|
430
|
+
{
|
|
431
|
+
type: "button",
|
|
432
|
+
variant: "ghost",
|
|
433
|
+
size: "sm",
|
|
434
|
+
onClick: () => initialsPad.current?.clear(),
|
|
435
|
+
disabled: !hasInitialsInk,
|
|
436
|
+
children: "Clear"
|
|
437
|
+
}
|
|
438
|
+
)
|
|
439
|
+
] })
|
|
440
|
+
]
|
|
441
|
+
}
|
|
442
|
+
)
|
|
443
|
+
] }),
|
|
444
|
+
onSave && !saving && /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
445
|
+
/* @__PURE__ */ jsx(
|
|
446
|
+
Checkbox,
|
|
447
|
+
{
|
|
448
|
+
checked: saveToAccount,
|
|
449
|
+
onCheckedChange: (c) => setSaveToAccount(c === true),
|
|
450
|
+
"data-testid": "adopt-signature-save"
|
|
451
|
+
}
|
|
452
|
+
),
|
|
453
|
+
"Save to my account for future use"
|
|
454
|
+
] }),
|
|
455
|
+
name.trim() && !saving && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
456
|
+
"By adopting it you agree to sign electronically: \u201C",
|
|
457
|
+
intentText({ name }),
|
|
458
|
+
"\u201D"
|
|
459
|
+
] }),
|
|
460
|
+
error && /* @__PURE__ */ jsx("p", { className: "text-sm text-red-text", role: "alert", children: error })
|
|
461
|
+
] }),
|
|
462
|
+
/* @__PURE__ */ jsxs(ModalScaffold.Footer, { children: [
|
|
463
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
464
|
+
/* @__PURE__ */ jsx(
|
|
465
|
+
Button,
|
|
466
|
+
{
|
|
467
|
+
type: "button",
|
|
468
|
+
onClick: () => void adopt(),
|
|
469
|
+
disabled: busy || !name.trim() || !initials.trim(),
|
|
470
|
+
"data-testid": "adopt-signature-submit",
|
|
471
|
+
children: saving ? "Save" : "Adopt and sign"
|
|
472
|
+
}
|
|
473
|
+
)
|
|
474
|
+
] })
|
|
475
|
+
]
|
|
476
|
+
}
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
export { AdoptSignatureDialog, TYPED_SIGNATURE_STYLE };
|
|
481
|
+
//# sourceMappingURL=chunk-DAN7EJ4O.js.map
|
|
482
|
+
//# sourceMappingURL=chunk-DAN7EJ4O.js.map
|