@monolith-forensics/monolith-ui 1.2.56 → 1.2.57

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.
@@ -6,8 +6,8 @@ export type File = {
6
6
  url?: string;
7
7
  };
8
8
  export declare const FileViewer: React.FC<{
9
- file: File;
10
- open: boolean;
9
+ file?: File;
10
+ open?: boolean;
11
11
  isPending?: boolean;
12
12
  onClose: () => void;
13
13
  }>;
@@ -159,6 +159,8 @@ export const FileViewer = ({ file, open, isPending, onClose }) => {
159
159
  const [zoomFactor, setZoomFactor] = useState(1);
160
160
  if (!open)
161
161
  return null;
162
+ if (!file)
163
+ return null;
162
164
  const viewerType = resolveViewerType(file);
163
165
  const handleBackgroundClick = (e) => {
164
166
  onClose === null || onClose === void 0 ? void 0 : onClose();
@@ -43,9 +43,9 @@ export const PdfViewer = ({ file, zoomFactor = 1, isPending }) => {
43
43
  // viewport width
44
44
  const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) / 1.15;
45
45
  if (isPending) {
46
- return (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading PDF..." })] }));
46
+ return (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading File..." })] }));
47
47
  }
48
- return (_jsxs(StyledContainer, { className: "PdfViewer", children: [loading && (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading PDF..." })] })), _jsx(StyledDocument, { file: file.url, onLoadStart: () => setLoading(true), onLoadSuccess: onDocumentLoadSuccess, loading: _jsx(_Fragment, {}), onClick: (e) => {
48
+ return (_jsxs(StyledContainer, { className: "PdfViewer", children: [loading && (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading File..." })] })), _jsx(StyledDocument, { file: file.url, onLoadStart: () => setLoading(true), onLoadSuccess: onDocumentLoadSuccess, loading: _jsx(_Fragment, {}), onClick: (e) => {
49
49
  e.stopPropagation();
50
50
  }, children: Array.from(new Array(numPages), (el, index) => (_jsx(StyledPage, { pageNumber: index + 1, scale: zoomFactor, width: vw }, `page_${index + 1}`))) })] }));
51
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monolith-forensics/monolith-ui",
3
- "version": "1.2.56",
3
+ "version": "1.2.57",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Matt Danner (Monolith Forensics LLC)",