@dmsi/wedgekit-react 0.0.503 → 0.0.504
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/{chunk-VOSQMHNF.js → chunk-U5V2IRZX.js} +4 -29
- package/dist/{chunk-S5ZJ3Q7P.js → chunk-VJVY6NPF.js} +3 -3
- package/dist/components/CalendarRange.cjs +75 -128
- package/dist/components/CalendarRange.js +1 -7
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +33 -86
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +1 -7
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +43 -96
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +1 -7
- package/dist/components/DataGrid/PinnedColumns.cjs +58 -111
- package/dist/components/DataGrid/PinnedColumns.js +1 -7
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +34 -87
- package/dist/components/DataGrid/TableBody/LoadingCell.js +1 -7
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +40 -93
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +1 -7
- package/dist/components/DataGrid/TableBody/index.cjs +55 -108
- package/dist/components/DataGrid/TableBody/index.js +1 -7
- package/dist/components/DataGrid/index.cjs +144 -197
- package/dist/components/DataGrid/index.js +1 -7
- package/dist/components/DataGrid/utils.cjs +34 -87
- package/dist/components/DataGrid/utils.js +1 -7
- package/dist/components/DateInput.cjs +94 -147
- package/dist/components/DateInput.js +1 -7
- package/dist/components/DateRangeInput.cjs +94 -147
- package/dist/components/DateRangeInput.js +1 -7
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +41 -94
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +1 -7
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +49 -102
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +1 -7
- package/dist/components/MobileDataGrid/index.cjs +868 -921
- package/dist/components/MobileDataGrid/index.js +1 -7
- package/dist/components/PDFViewer/PDFElement.cjs +5 -31
- package/dist/components/PDFViewer/PDFElement.js +2 -3
- package/dist/components/PDFViewer/PDFPage.cjs +3 -3
- package/dist/components/PDFViewer/PDFPage.js +1 -1
- package/dist/components/PDFViewer/index.cjs +5 -35
- package/dist/components/PDFViewer/index.js +111 -8
- package/dist/components/index.cjs +56 -402
- package/dist/components/index.js +1 -10
- package/package.json +1 -1
- package/src/components/PDFViewer/PDFElement.tsx +3 -38
- package/src/components/PDFViewer/PDFPage.tsx +2 -4
- package/src/components/PDFViewer/index.tsx +1 -9
- package/src/components/index.ts +0 -1
- package/dist/chunk-6XLESQ2U.js +0 -119
- /package/dist/{chunk-C2YTC2CN.js → chunk-JWVZOEF5.js} +0 -0
package/dist/components/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
DataGrid,
|
|
3
3
|
DateInput,
|
|
4
4
|
MobileDataGrid
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-JWVZOEF5.js";
|
|
6
6
|
import "../chunk-M7INAUAJ.js";
|
|
7
7
|
import "../chunk-ELXVDRWS.js";
|
|
8
8
|
import "../chunk-3UUCDNX3.js";
|
|
@@ -13,12 +13,6 @@ import "../chunk-BQNPOGD5.js";
|
|
|
13
13
|
import {
|
|
14
14
|
SearchResultImage
|
|
15
15
|
} from "../chunk-Y5GD2FJA.js";
|
|
16
|
-
import {
|
|
17
|
-
PDFViewer
|
|
18
|
-
} from "../chunk-6XLESQ2U.js";
|
|
19
|
-
import "../chunk-VOSQMHNF.js";
|
|
20
|
-
import "../chunk-YJGDVWTH.js";
|
|
21
|
-
import "../chunk-S5ZJ3Q7P.js";
|
|
22
16
|
import "../chunk-MBZ55T2D.js";
|
|
23
17
|
import "../chunk-2IKT6IHB.js";
|
|
24
18
|
import "../chunk-YCDDBSVU.js";
|
|
@@ -28,7 +22,6 @@ import "../chunk-5YNEY3WO.js";
|
|
|
28
22
|
import "../chunk-5IFPG6TS.js";
|
|
29
23
|
import "../chunk-AJ5M6MVX.js";
|
|
30
24
|
import "../chunk-UI7P5J5S.js";
|
|
31
|
-
import "../chunk-56RPZLV7.js";
|
|
32
25
|
import {
|
|
33
26
|
Tooltip
|
|
34
27
|
} from "../chunk-MDB26F6T.js";
|
|
@@ -58,7 +51,6 @@ import "../chunk-AKJUBFJK.js";
|
|
|
58
51
|
import {
|
|
59
52
|
ListGroup
|
|
60
53
|
} from "../chunk-SUSUNSVZ.js";
|
|
61
|
-
import "../chunk-SBRRNFOP.js";
|
|
62
54
|
import "../chunk-Y2GK27RX.js";
|
|
63
55
|
import "../chunk-QVWYTQKL.js";
|
|
64
56
|
import {
|
|
@@ -145,7 +137,6 @@ export {
|
|
|
145
137
|
MenuOption,
|
|
146
138
|
MobileDataGrid,
|
|
147
139
|
OrderCheckIcon,
|
|
148
|
-
PDFViewer,
|
|
149
140
|
Pagination,
|
|
150
141
|
Paragraph,
|
|
151
142
|
ProductImagePreview,
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { useEffect, useRef, useState } from "react";
|
|
1
|
+
import { usePdf } from "@mikecousins/react-pdf";
|
|
2
|
+
import { useRef } from "react";
|
|
4
3
|
import { Spinner } from "../Spinner";
|
|
5
4
|
import { Stack } from "../Stack";
|
|
6
5
|
import { PdfPage } from "./PDFPage";
|
|
@@ -16,43 +15,10 @@ export function PDFElement({
|
|
|
16
15
|
testid?: string;
|
|
17
16
|
isMobile?: boolean;
|
|
18
17
|
error?: React.ReactNode;
|
|
19
|
-
}) {
|
|
20
|
-
const [pdfHook, setPDFHook] = useState<typeof usePdf | null>(null);
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
import("@mikecousins/react-pdf").then((m) => setPDFHook(m.usePdf));
|
|
23
|
-
}, []);
|
|
24
|
-
|
|
25
|
-
if (pdfHook === null) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<PDFElementInternal
|
|
31
|
-
b64={b64}
|
|
32
|
-
testid={testid}
|
|
33
|
-
isMobile={isMobile}
|
|
34
|
-
error={error}
|
|
35
|
-
usePDF={pdfHook}
|
|
36
|
-
/>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function PDFElementInternal({
|
|
41
|
-
b64,
|
|
42
|
-
testid,
|
|
43
|
-
isMobile,
|
|
44
|
-
error,
|
|
45
|
-
usePDF,
|
|
46
|
-
}: {
|
|
47
|
-
b64: string;
|
|
48
|
-
testid?: string;
|
|
49
|
-
isMobile?: boolean;
|
|
50
|
-
error?: React.ReactNode;
|
|
51
|
-
usePDF: typeof usePdf;
|
|
52
18
|
}) {
|
|
53
19
|
const canvasRef = useRef<HTMLCanvasElement>(null);
|
|
54
20
|
|
|
55
|
-
const { pdfDocument } =
|
|
21
|
+
const { pdfDocument } = usePdf({
|
|
56
22
|
file: `data:application/pdf;base64,${b64}`,
|
|
57
23
|
workerSrc: "/scripts/pdf.worker.min.mjs",
|
|
58
24
|
scale: isMobile ? 1 : 1.3,
|
|
@@ -85,7 +51,6 @@ function PDFElementInternal({
|
|
|
85
51
|
)}
|
|
86
52
|
>
|
|
87
53
|
<PdfPage
|
|
88
|
-
usePDF={usePDF}
|
|
89
54
|
testid={testid ? `${testid}-pdf_page_${i + 1}` : undefined}
|
|
90
55
|
file={`data:application/pdf;base64,${b64}`}
|
|
91
56
|
pageNumber={i + 1}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { usePdf } from "@mikecousins/react-pdf";
|
|
2
2
|
import { useRef } from "react";
|
|
3
3
|
|
|
4
4
|
export function PdfPage({
|
|
@@ -6,17 +6,15 @@ export function PdfPage({
|
|
|
6
6
|
pageNumber,
|
|
7
7
|
testid,
|
|
8
8
|
isMobile,
|
|
9
|
-
usePDF,
|
|
10
9
|
}: {
|
|
11
10
|
file: string;
|
|
12
11
|
pageNumber: number;
|
|
13
12
|
testid?: string;
|
|
14
13
|
isMobile?: boolean;
|
|
15
|
-
usePDF: typeof usePdf;
|
|
16
14
|
}) {
|
|
17
15
|
const canvasRef = useRef<HTMLCanvasElement>(null);
|
|
18
16
|
|
|
19
|
-
const { pdfDocument } =
|
|
17
|
+
const { pdfDocument } = usePdf({
|
|
20
18
|
file,
|
|
21
19
|
page: pageNumber,
|
|
22
20
|
canvasRef,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { useCallback,
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
4
|
import { Modal } from "../Modal";
|
|
5
5
|
import { PDFElement } from "./PDFElement";
|
|
6
6
|
import { DownloadIcon } from "./DownloadIcon";
|
|
@@ -35,12 +35,6 @@ export function PDFViewer(props: PDFViewerProps) {
|
|
|
35
35
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
36
36
|
const [isDownloading, setIsDownloading] = useState(false);
|
|
37
37
|
|
|
38
|
-
const [isMounted, setIsMounted] = useState(false);
|
|
39
|
-
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
setIsMounted(true);
|
|
42
|
-
}, []);
|
|
43
|
-
|
|
44
38
|
const handleDownload = useCallback(() => {
|
|
45
39
|
setIsDownloading(true);
|
|
46
40
|
const link = document.createElement("a");
|
|
@@ -79,8 +73,6 @@ export function PDFViewer(props: PDFViewerProps) {
|
|
|
79
73
|
onClose();
|
|
80
74
|
}
|
|
81
75
|
|
|
82
|
-
if (!isMounted) return null;
|
|
83
|
-
|
|
84
76
|
return (
|
|
85
77
|
<Modal
|
|
86
78
|
testid={testid}
|
package/src/components/index.ts
CHANGED
|
@@ -25,7 +25,6 @@ export { MobileDataGrid } from "./MobileDataGrid";
|
|
|
25
25
|
export { ProductImagePreview } from "./ProductImagePreview";
|
|
26
26
|
export { CompactImagesPreview } from "./CompactImagesPreview";
|
|
27
27
|
export { SimpleTable } from "./SimpleTable";
|
|
28
|
-
export { PDFViewer } from "./PDFViewer";
|
|
29
28
|
export { ListGroup } from "./ListGroup";
|
|
30
29
|
export { Pagination } from "./Pagination";
|
|
31
30
|
export { SkeletonParagraph } from "./SkeletonParagraph";
|
package/dist/chunk-6XLESQ2U.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PDFElement
|
|
3
|
-
} from "./chunk-VOSQMHNF.js";
|
|
4
|
-
import {
|
|
5
|
-
PdfNavigation
|
|
6
|
-
} from "./chunk-YJGDVWTH.js";
|
|
7
|
-
import {
|
|
8
|
-
DownloadIcon
|
|
9
|
-
} from "./chunk-56RPZLV7.js";
|
|
10
|
-
import {
|
|
11
|
-
Modal
|
|
12
|
-
} from "./chunk-BMPL6LCR.js";
|
|
13
|
-
|
|
14
|
-
// src/components/PDFViewer/index.tsx
|
|
15
|
-
import { useCallback, useEffect, useState } from "react";
|
|
16
|
-
import { jsx } from "react/jsx-runtime";
|
|
17
|
-
function PDFViewer(props) {
|
|
18
|
-
const {
|
|
19
|
-
isOpen,
|
|
20
|
-
onClose,
|
|
21
|
-
encodedPdfs,
|
|
22
|
-
customActions,
|
|
23
|
-
testid,
|
|
24
|
-
isMobile,
|
|
25
|
-
title,
|
|
26
|
-
customFooter = false,
|
|
27
|
-
withPagination = true,
|
|
28
|
-
error
|
|
29
|
-
} = props;
|
|
30
|
-
const [currentIndex, setCurrentIndex] = useState(0);
|
|
31
|
-
const [isDownloading, setIsDownloading] = useState(false);
|
|
32
|
-
const [isMounted, setIsMounted] = useState(false);
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
setIsMounted(true);
|
|
35
|
-
}, []);
|
|
36
|
-
const handleDownload = useCallback(() => {
|
|
37
|
-
setIsDownloading(true);
|
|
38
|
-
const link = document.createElement("a");
|
|
39
|
-
const currentPdf = encodedPdfs[currentIndex];
|
|
40
|
-
if (!currentPdf) {
|
|
41
|
-
setIsDownloading(false);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
link.href = `data:application/pdf;base64,${currentPdf.base64}`;
|
|
45
|
-
link.download = currentPdf.fileName.endsWith(".pdf") ? currentPdf.fileName : `${currentPdf.fileName}.pdf`;
|
|
46
|
-
document.body.appendChild(link);
|
|
47
|
-
link.click();
|
|
48
|
-
document.body.removeChild(link);
|
|
49
|
-
setIsDownloading(false);
|
|
50
|
-
}, [currentIndex, encodedPdfs]);
|
|
51
|
-
if (!encodedPdfs.length) return null;
|
|
52
|
-
function handleNextFile() {
|
|
53
|
-
if (currentIndex < encodedPdfs.length - 1) {
|
|
54
|
-
setCurrentIndex((prev) => prev + 1);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function handlePreviousFile() {
|
|
58
|
-
if (currentIndex > 0) {
|
|
59
|
-
setCurrentIndex((prev) => prev - 1);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function handleClose() {
|
|
63
|
-
setCurrentIndex(0);
|
|
64
|
-
setIsDownloading(false);
|
|
65
|
-
onClose();
|
|
66
|
-
}
|
|
67
|
-
if (!isMounted) return null;
|
|
68
|
-
return /* @__PURE__ */ jsx(
|
|
69
|
-
Modal,
|
|
70
|
-
{
|
|
71
|
-
testid,
|
|
72
|
-
open: isOpen,
|
|
73
|
-
customFooter,
|
|
74
|
-
onClose: handleClose,
|
|
75
|
-
noWrapper: true,
|
|
76
|
-
showButtons: isMobile && customFooter ? !!customActions : !!encodedPdfs.length,
|
|
77
|
-
customActions: !!encodedPdfs.length && !isMobile && withPagination ? /* @__PURE__ */ jsx(
|
|
78
|
-
PdfNavigation,
|
|
79
|
-
{
|
|
80
|
-
testid,
|
|
81
|
-
currentIndex,
|
|
82
|
-
total: encodedPdfs.length,
|
|
83
|
-
onPrev: handlePreviousFile,
|
|
84
|
-
onNext: handleNextFile,
|
|
85
|
-
disablePrev: currentIndex === 0,
|
|
86
|
-
disableNext: currentIndex === encodedPdfs.length - 1,
|
|
87
|
-
extraActions: customActions,
|
|
88
|
-
fileName: encodedPdfs[currentIndex].fileName
|
|
89
|
-
}
|
|
90
|
-
) : customActions,
|
|
91
|
-
fixedHeightScrolling: true,
|
|
92
|
-
headerIconAlign: "right",
|
|
93
|
-
headerIcon: !isMobile ? /* @__PURE__ */ jsx(
|
|
94
|
-
DownloadIcon,
|
|
95
|
-
{
|
|
96
|
-
testid: testid ? `${testid}-download-icon` : void 0,
|
|
97
|
-
onClick: handleDownload,
|
|
98
|
-
isDownloading
|
|
99
|
-
}
|
|
100
|
-
) : void 0,
|
|
101
|
-
title: isMobile ? title != null ? title : encodedPdfs[currentIndex].fileName : void 0,
|
|
102
|
-
size: isMobile ? "screen" : "large",
|
|
103
|
-
headerClassname: "bg-brand-400 desktop:bg-background-grouped-primary-normal p-mobile-layout-padding text-brand-text-action-primary-normal",
|
|
104
|
-
children: /* @__PURE__ */ jsx(
|
|
105
|
-
PDFElement,
|
|
106
|
-
{
|
|
107
|
-
testid,
|
|
108
|
-
b64: encodedPdfs[currentIndex].base64,
|
|
109
|
-
isMobile,
|
|
110
|
-
error
|
|
111
|
-
}
|
|
112
|
-
)
|
|
113
|
-
}
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export {
|
|
118
|
-
PDFViewer
|
|
119
|
-
};
|
|
File without changes
|