@lateralus-ai/shipping-ui 1.4.3 → 1.4.5

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/index.esm.js CHANGED
@@ -20601,7 +20601,7 @@ const P5 = ({
20601
20601
  "div",
20602
20602
  {
20603
20603
  className: uo(
20604
- "col-start-1 row-start-1 bg-gray-200 h-full overflow-hidden select-none p-8",
20604
+ "col-start-1 row-start-1 bg-gray-200 h-full overflow-hidden select-none p-8 flex justify-center items-center",
20605
20605
  g ? "cursor-grabbing" : "cursor-grab"
20606
20606
  ),
20607
20607
  onMouseDown: y.handleMouseDown,
@@ -20617,7 +20617,8 @@ const P5 = ({
20617
20617
  style: {
20618
20618
  transform: `translate(${p.x}px, ${p.y}px)`,
20619
20619
  transition: g ? "none" : "transform 0.1s",
20620
- pointerEvents: "none"
20620
+ pointerEvents: "none",
20621
+ maxWidth: "650px"
20621
20622
  },
20622
20623
  children: /* @__PURE__ */ ve.jsx(
20623
20624
  QS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lateralus-ai/shipping-ui",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "Shared UI theme and components for Lateralus shipping applications",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.esm.js",
@@ -1,24 +1,29 @@
1
- import { IconButton, ButtonGroup, Tooltip } from "@material-tailwind/react";
2
- import { Document, Page, pdfjs } from "react-pdf";
3
- import { ModalPanel } from "../ModalPanel";
4
- import ExpandIcon from "../icons/ExpandIcon";
5
- import { Icon } from "@iconify/react";
6
- import { cn } from "../../utils/cn";
7
- import "react-pdf/dist/Page/AnnotationLayer.css";
8
- import "react-pdf/dist/Page/TextLayer.css";
9
- import { useState, ChangeEvent, useMemo, MouseEvent as ReactMouseEvent } from "react";
10
- import { useZoom } from "./useZoom";
11
- import { useRotation } from "./useRotation";
12
- import { usePageManagement } from "./usePageManagement";
13
- import { usePanning } from "./usePanning";
1
+ import { IconButton, ButtonGroup, Tooltip } from "@material-tailwind/react"
2
+ import { Document, Page, pdfjs } from "react-pdf"
3
+ import { ModalPanel } from "../ModalPanel"
4
+ import ExpandIcon from "../icons/ExpandIcon"
5
+ import { Icon } from "@iconify/react"
6
+ import { cn } from "../../utils/cn"
7
+ import "react-pdf/dist/Page/AnnotationLayer.css"
8
+ import "react-pdf/dist/Page/TextLayer.css"
9
+ import {
10
+ useState,
11
+ ChangeEvent,
12
+ useMemo,
13
+ MouseEvent as ReactMouseEvent,
14
+ } from "react"
15
+ import { useZoom } from "./useZoom"
16
+ import { useRotation } from "./useRotation"
17
+ import { usePageManagement } from "./usePageManagement"
18
+ import { usePanning } from "./usePanning"
14
19
 
15
- pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
20
+ pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`
16
21
 
17
22
  interface PdfViewerProps extends React.HTMLProps<HTMLDivElement> {
18
- onClose: () => void;
19
- src: string;
20
- title?: string;
21
- onOpen?: (event: ReactMouseEvent<HTMLButtonElement>) => void;
23
+ onClose: () => void
24
+ src: string
25
+ title?: string
26
+ onOpen?: (event: ReactMouseEvent<HTMLButtonElement>) => void
22
27
  }
23
28
 
24
29
  export const PdfViewer = ({
@@ -28,39 +33,39 @@ export const PdfViewer = ({
28
33
  className,
29
34
  onOpen,
30
35
  }: PdfViewerProps) => {
31
- const [zoom, zoomActions] = useZoom();
32
- const [rotation, rotationActions] = useRotation();
33
- const [{ currentPage, totalPages }, pageActions] = usePageManagement();
34
- const [{ pan, isDragging }, panActions] = usePanning();
36
+ const [zoom, zoomActions] = useZoom()
37
+ const [rotation, rotationActions] = useRotation()
38
+ const [{ currentPage, totalPages }, pageActions] = usePageManagement()
39
+ const [{ pan, isDragging }, panActions] = usePanning()
35
40
 
36
41
  const handleOpen = (event: ReactMouseEvent<HTMLButtonElement>) => {
37
42
  if (onOpen) {
38
43
  console.debug("[PdfViewer] onOpen callback triggered", {
39
44
  hasHandler: true,
40
- });
41
- onOpen(event);
45
+ })
46
+ onOpen(event)
42
47
  } else {
43
48
  console.debug("[PdfViewer] open button clicked", {
44
49
  hasHandler: false,
45
- });
50
+ })
46
51
  }
47
52
  if (event.defaultPrevented) {
48
- return;
53
+ return
49
54
  }
50
55
 
51
56
  if (!src) {
52
- event.preventDefault();
53
- return;
57
+ event.preventDefault()
58
+ return
54
59
  }
55
60
 
56
- window.open(src, "_blank", "noopener,noreferrer");
57
- };
61
+ window.open(src, "_blank", "noopener,noreferrer")
62
+ }
58
63
 
59
64
  const rightButtons = (
60
65
  <IconButton variant="text" color="gray" onClick={handleOpen}>
61
66
  <ExpandIcon className="size-4" />
62
67
  </IconButton>
63
- );
68
+ )
64
69
 
65
70
  return (
66
71
  <div className={cn("shadow rounded-t-lg flex flex-col h-full", className)}>
@@ -71,7 +76,7 @@ export const PdfViewer = ({
71
76
  <div className="grid grow h-full overflow-hidden">
72
77
  <div
73
78
  className={cn(
74
- "col-start-1 row-start-1 bg-gray-200 h-full overflow-hidden select-none p-8",
79
+ "col-start-1 row-start-1 bg-gray-200 h-full overflow-hidden select-none p-8 flex justify-center items-center",
75
80
  isDragging ? "cursor-grabbing" : "cursor-grab"
76
81
  )}
77
82
  onMouseDown={panActions.handleMouseDown}
@@ -79,14 +84,15 @@ export const PdfViewer = ({
79
84
  onMouseUp={panActions.handleMouseUp}
80
85
  onMouseLeave={panActions.handleMouseUp}
81
86
  style={{
82
- userSelect: 'none',
87
+ userSelect: "none",
83
88
  }}
84
89
  >
85
90
  <div
86
91
  style={{
87
92
  transform: `translate(${pan.x}px, ${pan.y}px)`,
88
- transition: isDragging ? 'none' : 'transform 0.1s',
89
- pointerEvents: 'none',
93
+ transition: isDragging ? "none" : "transform 0.1s",
94
+ pointerEvents: "none",
95
+ maxWidth: "650px",
90
96
  }}
91
97
  >
92
98
  <Document
@@ -94,7 +100,7 @@ export const PdfViewer = ({
94
100
  externalLinkTarget="_blank"
95
101
  file={src}
96
102
  onLoadSuccess={({ numPages }) => {
97
- pageActions.setTotalPages(numPages);
103
+ pageActions.setTotalPages(numPages)
98
104
  }}
99
105
  scale={zoom / 100}
100
106
  rotate={rotation}
@@ -122,8 +128,8 @@ export const PdfViewer = ({
122
128
  <button
123
129
  className="!bg-white text-center cursor-pointer w-[60px]"
124
130
  onClick={() => {
125
- zoomActions.reset();
126
- panActions.reset();
131
+ zoomActions.reset()
132
+ panActions.reset()
127
133
  }}
128
134
  >
129
135
  {zoom}%
@@ -171,9 +177,9 @@ export const PdfViewer = ({
171
177
  className="bg-white pl-4 flex items-center w-[50px] text-center focus:outline-none w-[60px]"
172
178
  value={currentPage}
173
179
  onChange={(e: ChangeEvent<HTMLInputElement>) => {
174
- const page = parseInt(e.target.value);
180
+ const page = parseInt(e.target.value)
175
181
  if (!isNaN(page)) {
176
- pageActions.goToPage(page);
182
+ pageActions.goToPage(page)
177
183
  }
178
184
  }}
179
185
  type="number"
@@ -196,5 +202,5 @@ export const PdfViewer = ({
196
202
  </div>
197
203
  </div>
198
204
  </div>
199
- );
200
- };
205
+ )
206
+ }