art-bd-ui 1.0.26 → 1.0.28
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/cjs/components/ui/pdf-content/pdf-content.js +7 -6
- package/dist/cjs/components/ui/pdf-viewer/pdf-field-types.js +2 -2
- package/dist/cjs/components/ui/pdf-viewer/pdf-viewer.js +1 -0
- package/dist/cjs/components/ui/pdf-viewer/pdf-worker-client.js +1 -1
- package/dist/cjs/components/ui/pdf-viewer/use-filled-pdf.js +5 -6
- package/dist/cjs/components/ui/pdf-viewer/utils.js +0 -1
- package/dist/cjs/index.js +4 -5
- package/dist/cjs/node_modules/react-resizable-panels/dist/react-resizable-panels.browser.js +2435 -0
- package/dist/cjs/node_modules/turndown/lib/turndown.browser.es.js +65 -0
- package/dist/esm/components/ui/pdf-content/pdf-content.js +5 -4
- package/dist/esm/components/ui/pdf-viewer/pdf-field-types.js +2 -2
- package/dist/esm/components/ui/pdf-viewer/pdf-viewer.js +1 -0
- package/dist/esm/components/ui/pdf-viewer/pdf-worker-client.js +1 -1
- package/dist/esm/components/ui/pdf-viewer/use-filled-pdf.js +5 -6
- package/dist/esm/components/ui/pdf-viewer/utils.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/node_modules/react-resizable-panels/dist/react-resizable-panels.browser.js +2405 -0
- package/dist/esm/node_modules/turndown/lib/turndown.browser.es.js +63 -0
- package/dist/types/index.d.ts +21 -26
- package/package.json +1 -1
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
require('../../../node_modules/react-pdf/dist/index.js');
|
|
6
|
-
require('../../../node_modules/react-pdf/dist/Page/AnnotationLayer.css.js');
|
|
7
|
-
require('../../../node_modules/react-pdf/dist/Page/TextLayer.css.js');
|
|
8
6
|
var pdfPage = require('./pdf-page.js');
|
|
9
7
|
var usePdfScale = require('./hooks/use-pdf-scale.js');
|
|
10
8
|
var usePageLayout = require('./hooks/use-page-layout.js');
|
|
11
9
|
var useVirtualPages = require('./hooks/use-virtual-pages.js');
|
|
12
|
-
var utils = require('./utils.js');
|
|
10
|
+
var utils$1 = require('./utils.js');
|
|
13
11
|
var empty = require('../../utility/empty/empty.js');
|
|
14
12
|
var icon = require('../../media/icon/icon.js');
|
|
15
13
|
var skeleton = require('../../utility/skeleton/skeleton.js');
|
|
16
14
|
var useResizeObserver = require('../../../hooks/use-resize-observer.js');
|
|
15
|
+
var utils = require('../../../lib/utils.js');
|
|
16
|
+
require('../../../node_modules/react-pdf/dist/Page/AnnotationLayer.css.js');
|
|
17
|
+
require('../../../node_modules/react-pdf/dist/Page/TextLayer.css.js');
|
|
17
18
|
var Document = require('../../../node_modules/react-pdf/dist/Document.js');
|
|
18
19
|
var pdf = require('../../../node_modules/pdfjs-dist/build/pdf.js');
|
|
19
20
|
|
|
@@ -26,7 +27,7 @@ function PDFSkeleton() {
|
|
|
26
27
|
function PDFEmptyState({ icon: icon$1, title, description }) {
|
|
27
28
|
return (jsxRuntime.jsxs(empty.EmptyState, { className: "py-12", children: [jsxRuntime.jsx(empty.EmptyMedia, { variant: "icon", children: jsxRuntime.jsx(icon.Icon, { name: icon$1 }) }), jsxRuntime.jsxs(empty.EmptyHeader, { children: [jsxRuntime.jsx(empty.EmptyTitle, { children: title }), jsxRuntime.jsx(empty.EmptyDescription, { children: description })] })] }));
|
|
28
29
|
}
|
|
29
|
-
const PDFContent = React.forwardRef(function PDFContent({ file, renderTextLayer = true, renderAnnotationLayer = true, initialScale = 1, minScale = 0.5, maxScale = 3,
|
|
30
|
+
const PDFContent = React.forwardRef(function PDFContent({ file, renderTextLayer = true, renderAnnotationLayer = true, initialScale = 1, minScale = 0.5, maxScale = 3, onDocumentLoad, onPageChange, onScaleChange, className, }, ref) {
|
|
30
31
|
var _a;
|
|
31
32
|
const containerRef = React.useRef(null);
|
|
32
33
|
const rect = useResizeObserver.useResizeObserver(containerRef);
|
|
@@ -51,7 +52,7 @@ const PDFContent = React.forwardRef(function PDFContent({ file, renderTextLayer
|
|
|
51
52
|
// Imperative scrollToPage
|
|
52
53
|
const scrollToPage = React.useCallback((page) => {
|
|
53
54
|
var _a;
|
|
54
|
-
const safe = utils.clamp(Number.isFinite(page) ? page : 1, 1, Math.max(1, numPages));
|
|
55
|
+
const safe = utils$1.clamp(Number.isFinite(page) ? page : 1, 1, Math.max(1, numPages));
|
|
55
56
|
const container = containerRef.current;
|
|
56
57
|
if (!container)
|
|
57
58
|
return;
|
|
@@ -82,7 +83,7 @@ const PDFContent = React.forwardRef(function PDFContent({ file, renderTextLayer
|
|
|
82
83
|
setNumPages(pdf.numPages);
|
|
83
84
|
onDocumentLoad === null || onDocumentLoad === void 0 ? void 0 : onDocumentLoad(pdf.numPages);
|
|
84
85
|
}, [onDocumentLoad]);
|
|
85
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, "data-pdf-stage": "root", className: "relative overflow-auto bg-muted/40",
|
|
86
|
+
return (jsxRuntime.jsx("div", { ref: containerRef, "data-pdf-stage": "root", className: utils.cn("relative overflow-auto bg-muted/40", className), onScroll: onScroll, children: jsxRuntime.jsx(Document.default, { file: file, onLoadSuccess: handleDocumentLoad, loading: jsxRuntime.jsx(PDFSkeleton, {}), error: jsxRuntime.jsx(PDFEmptyState, { icon: "alert-circle", title: "Failed to load PDF", description: "The PDF file could not be loaded." }), noData: jsxRuntime.jsx(PDFEmptyState, { icon: "file-text", title: "No PDF to display", description: "Provide a PDF file to preview it here." }), children: jsxRuntime.jsx("div", { className: "relative", style: { height: totalHeight }, children: renderedPages.map((pageNumber) => {
|
|
86
87
|
var _a;
|
|
87
88
|
return (jsxRuntime.jsx(pdfPage.PDFPage, { pageNumber: pageNumber, offsetY: (_a = pageOffsets[pageNumber - 1]) !== null && _a !== void 0 ? _a : 0, containerWidth: containerWidth, scale: scale, renderTextLayer: renderTextLayer, renderAnnotationLayer: renderAnnotationLayer, placeholderHeight: estimatePageHeight(pageNumber), onMeasured: onPageMeasured }, pageNumber));
|
|
88
89
|
}) }) }) }));
|
|
@@ -135,10 +135,10 @@ function getPDFFieldInfo(field) {
|
|
|
135
135
|
/**
|
|
136
136
|
* Returns field name plus type and options. Convenient for building UI from PDF form fields.
|
|
137
137
|
*/
|
|
138
|
-
function
|
|
138
|
+
function getPDFFieldInfoWithName(field) {
|
|
139
139
|
return Object.assign({ name: field.getName() }, getPDFFieldInfo(field));
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
exports.getPDFFieldInfo = getPDFFieldInfo;
|
|
143
|
+
exports.getPDFFieldInfoWithName = getPDFFieldInfoWithName;
|
|
143
144
|
exports.getPDFFieldType = getPDFFieldType;
|
|
144
|
-
exports.getPdfFieldInfoWithName = getPdfFieldInfoWithName;
|
|
@@ -14,7 +14,7 @@ function getPDFWorkerApi() {
|
|
|
14
14
|
return null;
|
|
15
15
|
if (api)
|
|
16
16
|
return api;
|
|
17
|
-
worker = new Worker(new URL("./pdf.worker.
|
|
17
|
+
worker = new Worker(new URL("./pdf.worker.ts", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('components/ui/pdf-viewer/pdf-worker-client.js', document.baseURI).href))), {
|
|
18
18
|
type: "module",
|
|
19
19
|
});
|
|
20
20
|
api = comlink.wrap(worker);
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
var tslib_es6 = require('../../../node_modules/tslib/tslib.es6.js');
|
|
4
5
|
var React = require('react');
|
|
5
|
-
var comlink = require('../../../node_modules/comlink/dist/esm/comlink.js');
|
|
6
6
|
var utils = require('./utils.js');
|
|
7
|
-
var pdfWorkerClient = require('./pdf-worker-client.js');
|
|
8
7
|
|
|
9
8
|
function fillPdfBytes(input) {
|
|
10
9
|
return tslib_es6.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
-
const api =
|
|
12
|
-
if (api) {
|
|
13
|
-
|
|
14
|
-
}
|
|
10
|
+
// const api = getPDFWorkerApi();
|
|
11
|
+
// if (api) {
|
|
12
|
+
// return api.fillPDFFormWithData(transfer(input, [input.pdfBytes.buffer]));
|
|
13
|
+
// }
|
|
15
14
|
return utils.fillPDFForm({
|
|
16
15
|
pdfBytes: input.pdfBytes,
|
|
17
16
|
formData: input.formData,
|
package/dist/cjs/index.js
CHANGED
|
@@ -372,11 +372,10 @@ exports.PaginationNext = pagination.PaginationNext;
|
|
|
372
372
|
exports.PaginationPrevious = pagination.PaginationPrevious;
|
|
373
373
|
exports.PDFContent = pdfContent.PDFContent;
|
|
374
374
|
exports.PDFViewer = pdfViewer.PDFViewer;
|
|
375
|
-
exports.
|
|
376
|
-
exports.
|
|
377
|
-
exports.
|
|
378
|
-
exports.
|
|
379
|
-
exports.getSignatureFieldPlacement = utils$1.getSignatureFieldPlacement;
|
|
375
|
+
exports.getPDFFieldInfo = pdfFieldTypes.getPDFFieldInfo;
|
|
376
|
+
exports.getPDFFieldInfoWithName = pdfFieldTypes.getPDFFieldInfoWithName;
|
|
377
|
+
exports.getPDFFieldType = pdfFieldTypes.getPDFFieldType;
|
|
378
|
+
exports.getPDFBytes = utils$1.getPDFBytes;
|
|
380
379
|
exports.useFilledPdf = useFilledPdf.useFilledPdf;
|
|
381
380
|
exports.PollBuilder = pollBuilder.PollBuilder;
|
|
382
381
|
exports.Progress = progress.Progress;
|