@lateralus-ai/shipping-ui 1.0.4 → 1.1.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/ModalPanel.d.ts +2 -1
- package/dist/components/PdfViewer/ImageViewer.d.ts +1 -1
- package/dist/components/PdfViewer/PdfViewer.d.ts +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/index.cjs +10 -10
- package/dist/index.esm.js +1086 -790
- package/package.json +1 -1
- package/src/components/ModalPanel.tsx +6 -1
- package/src/components/PdfViewer/ImageViewer.tsx +3 -3
- package/src/components/PdfViewer/PdfViewer.tsx +8 -6
- package/src/components/index.ts +1 -0
- package/src/stories/PDFViewer.stories.tsx +6 -6
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { IconButton } from "@material-tailwind/react";
|
|
2
2
|
import XIcon from "./icons/XIcon";
|
|
3
|
+
import { PropsWithChildren } from "react";
|
|
3
4
|
|
|
4
5
|
interface HeaderProps {
|
|
5
6
|
onClose: () => void;
|
|
6
7
|
right?: React.ReactNode;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
const Header = ({
|
|
10
|
+
const Header = ({
|
|
11
|
+
onClose,
|
|
12
|
+
right,
|
|
13
|
+
children,
|
|
14
|
+
}: PropsWithChildren<HeaderProps>) => {
|
|
10
15
|
return (
|
|
11
16
|
<div className="bg-gray-50 flex gap-2 items-center px-2 py-3 rounded-t-xl">
|
|
12
17
|
<div className="grow text-subheader-em">{children}</div>
|
|
@@ -12,7 +12,7 @@ interface ImageViewerProps {
|
|
|
12
12
|
onClose: () => void;
|
|
13
13
|
totalPages: number;
|
|
14
14
|
getImageSrc: (page: number) => string;
|
|
15
|
-
title
|
|
15
|
+
title?: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export const ImageViewer = ({
|
|
@@ -38,10 +38,10 @@ export const ImageViewer = ({
|
|
|
38
38
|
{title}
|
|
39
39
|
</ModalPanel.Header>
|
|
40
40
|
|
|
41
|
-
<div className="grid">
|
|
41
|
+
<div className="flex-1 grid">
|
|
42
42
|
<div className="grid relative">
|
|
43
43
|
<div
|
|
44
|
-
className="overflow-hidden col-start-1 row-start-1 bg-gray-200 h-
|
|
44
|
+
className="overflow-hidden col-start-1 row-start-1 bg-gray-200 h-full relative"
|
|
45
45
|
onMouseMove={panActions.handleMouseMove}
|
|
46
46
|
onMouseUp={panActions.handleMouseUp}
|
|
47
47
|
onMouseLeave={panActions.handleMouseUp}
|
|
@@ -3,17 +3,19 @@ import { IconButton } from "@material-tailwind/react";
|
|
|
3
3
|
import { ModalPanel } from "../ModalPanel";
|
|
4
4
|
import ExpandIcon from "../icons/ExpandIcon";
|
|
5
5
|
import { useRefDimensions } from "./useRefDimensions";
|
|
6
|
+
import { cn } from "../../utils/cn";
|
|
6
7
|
|
|
7
8
|
interface PdfViewerProps {
|
|
8
9
|
onClose: () => void;
|
|
9
10
|
src: string;
|
|
10
|
-
title
|
|
11
|
+
title?: string;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export const PdfViewer = ({
|
|
14
15
|
onClose,
|
|
15
16
|
src,
|
|
16
17
|
title = "PDF Viewer",
|
|
18
|
+
className,
|
|
17
19
|
}: PdfViewerProps) => {
|
|
18
20
|
const containerRef = useRef(null);
|
|
19
21
|
const dimensions = useRefDimensions(containerRef);
|
|
@@ -27,22 +29,22 @@ export const PdfViewer = ({
|
|
|
27
29
|
);
|
|
28
30
|
|
|
29
31
|
return (
|
|
30
|
-
<div className="shadow rounded-t-lg">
|
|
32
|
+
<div className={cn("shadow rounded-t-lg flex flex-col h-full", className)}>
|
|
31
33
|
<ModalPanel.Header onClose={onClose} right={rightButtons}>
|
|
32
34
|
{title}
|
|
33
35
|
</ModalPanel.Header>
|
|
34
36
|
|
|
35
|
-
<div className="grid">
|
|
37
|
+
<div className="flex-1 grid">
|
|
36
38
|
<div className="grid relative">
|
|
37
39
|
<div
|
|
38
40
|
ref={containerRef}
|
|
39
|
-
className="overflow-hidden col-start-1 row-start-1 bg-gray-200 h-
|
|
41
|
+
className="overflow-hidden col-start-1 row-start-1 bg-gray-200 h-full relative"
|
|
40
42
|
>
|
|
41
43
|
<embed
|
|
42
44
|
src={`${src}#view=FitH&navpanes=0&scrollbar=0`}
|
|
43
45
|
type="application/pdf"
|
|
44
|
-
width=
|
|
45
|
-
height=
|
|
46
|
+
width="100%"
|
|
47
|
+
height="100%"
|
|
46
48
|
style={{ border: "none" }}
|
|
47
49
|
/>
|
|
48
50
|
</div>
|
package/src/components/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { ImageViewer, PdfViewer } from "../components
|
|
2
|
+
import { ImageViewer, PdfViewer } from "../components";
|
|
3
3
|
|
|
4
4
|
const StoryPage = () => {
|
|
5
5
|
return (
|
|
@@ -13,11 +13,11 @@ const StoryPage = () => {
|
|
|
13
13
|
}
|
|
14
14
|
/>
|
|
15
15
|
</div>
|
|
16
|
-
<div
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/>
|
|
16
|
+
<div
|
|
17
|
+
className="w-[600px] h-[800px] p-8 flex flex-col"
|
|
18
|
+
title="Document Viewer"
|
|
19
|
+
>
|
|
20
|
+
<PdfViewer src="https://www.antennahouse.com/hubfs/xsl-fo-sample/pdf/basic-link-1.pdf" />
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
23
|
);
|