@lateralus-ai/shipping-ui 1.3.1 → 1.3.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lateralus-ai/shipping-ui",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
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",
@@ -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<HTMLAnchorElement>) => void;
21
+ onOpen?: (event: ReactMouseEvent<HTMLButtonElement>) => void;
22
22
  }
23
23
 
24
24
  export const PdfViewer = ({
@@ -33,28 +33,32 @@ export const PdfViewer = ({
33
33
  const [{ currentPage, totalPages }, pageActions] = usePageManagement();
34
34
  const [{ pan, isDragging }, panActions] = usePanning();
35
35
 
36
- const handleOpen = (event: ReactMouseEvent<HTMLAnchorElement>) => {
37
- onOpen?.(event);
36
+ const handleOpen = (event: ReactMouseEvent<HTMLButtonElement>) => {
37
+ if (onOpen) {
38
+ console.debug("[PdfViewer] onOpen callback triggered", {
39
+ hasHandler: true,
40
+ });
41
+ onOpen(event);
42
+ } else {
43
+ console.debug("[PdfViewer] open button clicked", {
44
+ hasHandler: false,
45
+ });
46
+ }
38
47
  if (event.defaultPrevented) {
39
48
  return;
40
49
  }
41
50
 
42
- // Allow default anchor behavior when event isn't prevented
43
51
  if (!src) {
44
52
  event.preventDefault();
53
+ return;
45
54
  }
55
+
56
+ window.open(src, "_blank", "noopener,noreferrer");
46
57
  };
47
58
 
48
59
  const rightButtons = (
49
- <IconButton variant="text" color="gray">
50
- <a
51
- href={src}
52
- target="_blank"
53
- rel="noopener noreferrer"
54
- onClick={handleOpen}
55
- >
56
- <ExpandIcon className="size-4" />
57
- </a>
60
+ <IconButton variant="text" color="gray" onClick={handleOpen}>
61
+ <ExpandIcon className="size-4" />
58
62
  </IconButton>
59
63
  );
60
64