@lateralus-ai/shipping-ui 1.3.1 → 1.3.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/dist/components/PdfViewer/PdfViewer.d.ts +1 -1
- package/dist/index.cjs +10 -10
- package/dist/index.esm.js +207 -210
- package/package.json +1 -1
- package/src/components/PdfViewer/PdfViewer.tsx +7 -12
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ interface PdfViewerProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
18
18
|
onClose: () => void;
|
|
19
19
|
src: string;
|
|
20
20
|
title?: string;
|
|
21
|
-
onOpen?: (event: ReactMouseEvent<
|
|
21
|
+
onOpen?: (event: ReactMouseEvent<HTMLButtonElement>) => void;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export const PdfViewer = ({
|
|
@@ -33,28 +33,23 @@ export const PdfViewer = ({
|
|
|
33
33
|
const [{ currentPage, totalPages }, pageActions] = usePageManagement();
|
|
34
34
|
const [{ pan, isDragging }, panActions] = usePanning();
|
|
35
35
|
|
|
36
|
-
const handleOpen = (event: ReactMouseEvent<
|
|
36
|
+
const handleOpen = (event: ReactMouseEvent<HTMLButtonElement>) => {
|
|
37
37
|
onOpen?.(event);
|
|
38
38
|
if (event.defaultPrevented) {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
// Allow default anchor behavior when event isn't prevented
|
|
43
42
|
if (!src) {
|
|
44
43
|
event.preventDefault();
|
|
44
|
+
return;
|
|
45
45
|
}
|
|
46
|
+
|
|
47
|
+
window.open(src, "_blank", "noopener,noreferrer");
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
const rightButtons = (
|
|
49
|
-
<IconButton variant="text" color="gray">
|
|
50
|
-
<
|
|
51
|
-
href={src}
|
|
52
|
-
target="_blank"
|
|
53
|
-
rel="noopener noreferrer"
|
|
54
|
-
onClick={handleOpen}
|
|
55
|
-
>
|
|
56
|
-
<ExpandIcon className="size-4" />
|
|
57
|
-
</a>
|
|
51
|
+
<IconButton variant="text" color="gray" onClick={handleOpen}>
|
|
52
|
+
<ExpandIcon className="size-4" />
|
|
58
53
|
</IconButton>
|
|
59
54
|
);
|
|
60
55
|
|