@e-llm-studio/citation 0.0.141 → 0.0.142
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/README.md +21 -26
- package/dist/assests/svg/PdfViewerIcons.js +2 -0
- package/dist/assests/svg/PdfViewerIcons.js.map +1 -0
- package/dist/cjs/assests/svg/PdfViewerIcons.js +2 -0
- package/dist/cjs/assests/svg/PdfViewerIcons.js.map +1 -0
- package/dist/cjs/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfStyle.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/features/PdfViewer/PdfStyle.js +1 -1
- package/dist/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/types/src/PdfViewerTest.d.ts.map +1 -1
- package/dist/types/src/assests/svg/PdfViewerIcons.d.ts +5 -0
- package/dist/types/src/assests/svg/PdfViewerIcons.d.ts.map +1 -0
- package/dist/types/src/features/PdfViewer/PdfContainer.d.ts +3 -1
- package/dist/types/src/features/PdfViewer/PdfContainer.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfStyle.d.ts +29 -1
- package/dist/types/src/features/PdfViewer/PdfStyle.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts +10 -1
- package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts +34 -1
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1086,32 +1086,29 @@ import PaginatedTable from '@e-llm-studio/citation/PaginatedTable'
|
|
|
1086
1086
|
|
|
1087
1087
|
|
|
1088
1088
|
## PdfViewer
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
PdfViewer is a specialized React component designed to render PDF documents with built-in capabilities for text highlighting and highlight navigation. It is built on top of the @react-pdf-viewer library and is optimized for review workflows. It takes a specific list of keywords to highlight and a list of relevant pages, allowing users to "jump" directly between pages that contain relevant information.
|
|
1093
|
-
|
|
1094
|
-
### Features
|
|
1095
|
-
|
|
1096
|
-
- **Text highlighting** - Automatically highlight keywords within the document
|
|
1097
|
-
- **Highlight navigation** - Jump between pages with relevant content
|
|
1098
|
-
- **Zoom controls** - In/out zoom and popover zoom options
|
|
1099
|
-
- **Page navigation** - Navigate between highlighted pages
|
|
1100
|
-
- **Custom toolbar** - Sticky header with navigation controls
|
|
1101
|
-
- **Responsive design** - Works well on various screen sizes
|
|
1089
|
+
### Overview
|
|
1090
|
+
PdfViewer is a specialized, highly customizable React component designed to render PDF documents with built-in capabilities for text highlighting and highlight navigation. It is built on top of the @react-pdf-viewer library and is optimized for review workflows. It takes a specific list of keywords to highlight and a list of relevant pages, allowing users to "jump" directly between pages that contain relevant information. It supports deep UI overrides via custom classes, styles, and icons to fit seamlessly into any theme.FeaturesText highlighting - Automatically highlight keywords within the documentHighlight navigation - Jump between pages with relevant contentZoom controls - In/out zoom and popover zoom optionsPage navigation - Navigate between highlighted pagesCustom toolbar - Sticky header with navigation controlsDeep UI Customization - Extensive customization through customStyles, customClasses, and customIcons propsResponsive design - Works well on various screen sizesUsageTypeScriptimport PdfViewer from '@e-llm-studio/citation/PdfViewer'
|
|
1102
1091
|
|
|
1103
1092
|
### Usage
|
|
1104
|
-
|
|
1105
1093
|
```tsx
|
|
1106
1094
|
import PdfViewer from '@e-llm-studio/citation/PdfViewer'
|
|
1107
|
-
|
|
1108
1095
|
<PdfViewer
|
|
1109
1096
|
pdfUrl="https://example.com/contract.pdf"
|
|
1110
1097
|
highlightText={["confidential", "termination", "liability"]}
|
|
1111
1098
|
highlightPages={[3, 8, 12]}
|
|
1112
1099
|
jumpToPageValue={3}
|
|
1100
|
+
// Optional Customization Hooks
|
|
1101
|
+
customStyles={{
|
|
1102
|
+
pdfIconWrapper: { background: "#ffe4e6", border: "6px solid #fff1f2" },
|
|
1103
|
+
pdfName: { color: "#e11d48", fontWeight: "bold" },
|
|
1104
|
+
}}
|
|
1105
|
+
customClasses={{
|
|
1106
|
+
actionButton: "p-2 hover:bg-red-100 rounded-lg transition-colors text-red-500",
|
|
1107
|
+
}}
|
|
1108
|
+
customIcons={{
|
|
1109
|
+
pdfIcon: <MyCustomIcon />
|
|
1110
|
+
}}
|
|
1113
1111
|
/>
|
|
1114
|
-
```
|
|
1115
1112
|
|
|
1116
1113
|
### Navigation Behavior
|
|
1117
1114
|
- "Next" button jumps to next page with highlights
|
|
@@ -1119,17 +1116,15 @@ import PdfViewer from '@e-llm-studio/citation/PdfViewer'
|
|
|
1119
1116
|
- Direct page navigation based on highlightPages array
|
|
1120
1117
|
- Auto-zoom to actual size on load
|
|
1121
1118
|
|
|
1122
|
-
|
|
1123
1119
|
### Props
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
---
|
|
1120
|
+
Prop Name Type Description
|
|
1121
|
+
pdfUrl - string - The direct URL to the PDF file to be rendered
|
|
1122
|
+
highlightText - string[] - An array of keywords or phrases to automatically highlight
|
|
1123
|
+
highlightPages - number[] - An object of page numbers (1-based) where highlights appear
|
|
1124
|
+
jumpToPageValue - number - The specific page number to open the document at initially
|
|
1125
|
+
customStyles - CustomStylesType - Optional object to override default inline styles for elements like the viewer wrapper, header, or icons
|
|
1126
|
+
customClasses - CustomClassesType - Optional object to inject custom CSS or Tailwind classes
|
|
1127
|
+
customIcons - CustomIconsType - Optional object to replace default SVG icons (pdfIcon, fullScreenIcon, downloadIcon, closeIcon)
|
|
1133
1128
|
|
|
1134
1129
|
## ProjectAccordion
|
|
1135
1130
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as n,jsxs as i}from"react/jsx-runtime";var t=function(){return n("svg",e({xmlns:"http://www.w3.org/2000/svg",style:{width:"12px",height:"15px"},viewBox:"0 0 14 17",fill:"none"},{children:n("path",{d:"M8.25 0.952148V4.05005C8.25 4.47009 8.25 4.68011 8.33175 4.84055C8.40365 4.98167 8.51839 5.0964 8.65951 5.16831C8.81994 5.25005 9.02996 5.25005 9.45 5.25005H12.5479M9.75 9H3.75M9.75 12H3.75M5.25 6H3.75M8.25 0.75H4.35C3.08988 0.75 2.45982 0.75 1.97852 0.995235C1.55516 1.21095 1.21095 1.55516 0.995235 1.97852C0.75 2.45982 0.75 3.08988 0.75 4.35V12.15C0.75 13.4101 0.75 14.0402 0.995235 14.5215C1.21095 14.9448 1.55516 15.289 1.97852 15.5048C2.45982 15.75 3.08988 15.75 4.35 15.75H9.15C10.4101 15.75 11.0402 15.75 11.5215 15.5048C11.9448 15.289 12.289 14.9448 12.5048 14.5215C12.75 14.0402 12.75 13.4101 12.75 12.15V5.25L8.25 0.75Z",stroke:"#0019FF",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))},o=function(){return n("svg",e({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})}))},r=function(){return i("svg",e({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n("polyline",{points:"7 10 12 15 17 10"}),n("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}))},h=function(){return i("svg",e({width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}))};export{h as DefaultCloseIcon,r as DefaultDownloadIcon,o as DefaultFullScreenIcon,t as DefaultPdfIcon};
|
|
2
|
+
//# sourceMappingURL=PdfViewerIcons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdfViewerIcons.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime");exports.DefaultCloseIcon=function(){return n.jsxs("svg",e.__assign({width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}))},exports.DefaultDownloadIcon=function(){return n.jsxs("svg",e.__assign({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n.jsx("polyline",{points:"7 10 12 15 17 10"}),n.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}))},exports.DefaultFullScreenIcon=function(){return n.jsx("svg",e.__assign({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})}))},exports.DefaultPdfIcon=function(){return n.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",style:{width:"12px",height:"15px"},viewBox:"0 0 14 17",fill:"none"},{children:n.jsx("path",{d:"M8.25 0.952148V4.05005C8.25 4.47009 8.25 4.68011 8.33175 4.84055C8.40365 4.98167 8.51839 5.0964 8.65951 5.16831C8.81994 5.25005 9.02996 5.25005 9.45 5.25005H12.5479M9.75 9H3.75M9.75 12H3.75M5.25 6H3.75M8.25 0.75H4.35C3.08988 0.75 2.45982 0.75 1.97852 0.995235C1.55516 1.21095 1.21095 1.55516 0.995235 1.97852C0.75 2.45982 0.75 3.08988 0.75 4.35V12.15C0.75 13.4101 0.75 14.0402 0.995235 14.5215C1.21095 14.9448 1.55516 15.289 1.97852 15.5048C2.45982 15.75 3.08988 15.75 4.35 15.75H9.15C10.4101 15.75 11.0402 15.75 11.5215 15.5048C11.9448 15.289 12.289 14.9448 12.5048 14.5215C12.75 14.0402 12.75 13.4101 12.75 12.15V5.25L8.25 0.75Z",stroke:"#0019FF",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))};
|
|
2
|
+
//# sourceMappingURL=PdfViewerIcons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdfViewerIcons.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),s=require("@react-pdf-viewer/core"),i=require("./PdfStyle.js"),t="https://unpkg.com/pdfjs-dist@3.11.174/build/pdf.worker.min.js";exports.default=function(l){var n=l.pdfUrl,o=l.plugins,d=l.onLoad,u=l.customStyles;return r.jsx("div",e.__assign({style:e.__assign(e.__assign({},i.pdfStyles.pdfConatiner),null==u?void 0:u.pdfContainer)},{children:r.jsx(s.Worker,e.__assign({workerUrl:t},{children:r.jsx(s.Viewer,{fileUrl:n,defaultScale:s.SpecialZoomLevel.ActualSize,plugins:o,onDocumentLoad:d})}))}))},exports.pdfWorker=t;
|
|
2
2
|
//# sourceMappingURL=PdfContainer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.pdfStyles={pdfViewer:{borderRadius:"12px",padding:"16px",width:"100%",height:"100%"},card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.pdfStyles={pdfViewer:{borderRadius:"12px",padding:"16px",width:"100%",height:"100%"},card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",width:"100%"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",position:"relative"},title:{fontSize:"14px",fontWeight:600,color:"#60A3F8",fontFamily:'Roboto, "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif'},toolbar:{display:"flex",alignItems:"center",gap:"8px",position:"relative"},button:{border:"1px solid #DFE5EC",borderRadius:"6px",padding:"4px 8px",fontSize:"14px",cursor:"pointer",backgroundColor:"#FFFFFF"},buttonDisabled:{opacity:.4,cursor:"not-allowed"},counter:{fontSize:"13px",color:"#64748B",margin:"0 6px"},viewerWrapper:{height:"30rem",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center",border:"1px solid #DEE4EB",borderRadius:"8px"},emptyState:{fontSize:"14px",color:"#EF4444"},pdfConatiner:{height:"100%",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center"}};
|
|
2
2
|
//# sourceMappingURL=PdfStyle.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),n=require("./PdfStyle.js"),t=require("../../assests/svg/PdfViewerIcons.js");exports.default=function(l){l.highlightIndex,l.totalHighlights;var o=l.controls;l.currentPosition;var r=l.pdfName,i=l.onClose,a=l.pdfUrl,c=l.viewerRef,d=l.customStyles,u=l.customClasses,x=l.customIcons,g=o.ZoomInButton,m=o.ZoomOutButton,f=o.ZoomPopover;o.goToPrevious,o.goToNext;var _=(null==u?void 0:u.actionButton)||"p-1 hover:bg-gray-200 rounded-md transition-colors";return s.jsxs("div",e.__assign({className:(null==u?void 0:u.header)||"flex items-center justify-between mb-3 bg-[#FAFAFA] border-b border-gray-100 rounded-t-xl",style:e.__assign(e.__assign({},n.pdfStyles.header),null==d?void 0:d.header)},{children:[s.jsxs("div",e.__assign({className:"flex items-center gap-3"},{children:[s.jsx("div",e.__assign({style:e.__assign(e.__assign({},{borderRadius:"21px",border:"6px solid #E8F3FF",background:"#D5E8FF",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",boxSizing:"content-box"}),null==d?void 0:d.pdfIconWrapper)},{children:(null==x?void 0:x.pdfIcon)||s.jsx(t.DefaultPdfIcon,{})})),s.jsx("span",e.__assign({className:(null==u?void 0:u.pdfName)||"text-gray-800 text-sm",style:e.__assign({fontWeight:500},null==d?void 0:d.pdfName)},{children:r}))]})),s.jsxs("div",e.__assign({className:"flex items-center gap-4 text-gray-600"},{children:[s.jsxs("div",e.__assign({className:"flex items-center gap-1"},{children:[s.jsx(m,{}),s.jsx("div",e.__assign({className:"text-sm font-medium w-14 text-center"},{children:s.jsx(f,{})})),s.jsx(g,{})]})),s.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1"}),s.jsxs("div",e.__assign({className:"flex items-center gap-2"},{children:[s.jsx("button",e.__assign({onClick:function(){var e=null==c?void 0:c.current;e&&(document.fullscreenElement?document.exitFullscreen():e.requestFullscreen().catch(function(e){console.error("Error attempting to enable fullscreen: ".concat(e.message))}))},className:_,title:"Full Screen"},{children:(null==x?void 0:x.fullScreenIcon)||s.jsx(t.DefaultFullScreenIcon,{})})),a&&s.jsx("a",e.__assign({href:a,target:"_blank",rel:"noopener noreferrer",className:_,title:"Open in new tab"},{children:(null==x?void 0:x.downloadIcon)||s.jsx(t.DefaultDownloadIcon,{})})),i&&s.jsx("button",e.__assign({onClick:i,className:"".concat(_," ml-1"),title:"Close"},{children:(null==x?void 0:x.closeIcon)||s.jsx(t.DefaultCloseIcon,{})}))]}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=PdfToolbar.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),i=require("@react-pdf-viewer/core"),r=require("./PdfContainer.js"),t=require("./PdfToolbar.js"),l=require("./PdfStyle.js"),o=require("./usePdfHighlight.js");require("@react-pdf-viewer/zoom/lib/styles/index.css"),require("@react-pdf-viewer/page-navigation/lib/styles/index.css"),require("@react-pdf-viewer/core/lib/styles/index.css"),require("@react-pdf-viewer/search/lib/styles/index.css");var a=require("react");exports.default=function(n){var u=n.pdfUrl,d=n.highlightText,c=n.highlightPages,f=n.jumpToPageValue,g=void 0===f?0:f,p=n.pdfName,h=n.onClose,m=n.customStyles,v=n.customClasses,x=n.customIcons,y=o.PdfHighlightControls(d,c),_=y.highlightIndex,q=y.cursorIndex,j=y.setCursorIndex,P=y.orderedKeys,w=y.totalHighlights,S=y.getValidPosition,b=y.tryJump,C=y.jumpToPage,I=y.zoomTo,A=y.plugins,F=y.controls,T=S(q),V=a.useRef(null);if(!u)return s.jsx("div",e.__assign({style:e.__assign(e.__assign({},l.pdfStyles.emptyState),null==m?void 0:m.emptyState)},{children:"PDF is not available for this selection"}));return s.jsxs("div",e.__assign({ref:V,className:(null==v?void 0:v.pdfViewerWrapper)||"",style:e.__assign(e.__assign(e.__assign({},l.pdfStyles.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==m?void 0:m.pdfViewer)},{children:[s.jsx(t.default,{highlightIndex:_,totalHighlights:w,controls:F,currentPosition:T,pdfName:p,onClose:h,pdfUrl:u,viewerRef:V,customStyles:m,customClasses:v,customIcons:x}),s.jsx(r.default,{pdfUrl:u,plugins:A,customStyles:m,onLoad:function(){if(I(i.SpecialZoomLevel.ActualSize),g>0){var e=g-1,s=P[e],r=c[s];j(e),r>0&&C(r-1)}requestAnimationFrame(b)}})]}))};
|
|
2
2
|
//# sourceMappingURL=PdfViewer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as r}from"tslib";import{jsx as
|
|
1
|
+
import{__assign as r}from"tslib";import{jsx as t}from"react/jsx-runtime";import{Worker as e,Viewer as o,SpecialZoomLevel as i}from"@react-pdf-viewer/core";import{pdfStyles as l}from"./PdfStyle.js";var n="https://unpkg.com/pdfjs-dist@3.11.174/build/pdf.worker.min.js",d=function(d){var f=d.pdfUrl,p=d.plugins,a=d.onLoad,m=d.customStyles;return t("div",r({style:r(r({},l.pdfConatiner),null==m?void 0:m.pdfContainer)},{children:t(e,r({workerUrl:n},{children:t(o,{fileUrl:f,defaultScale:i.ActualSize,plugins:p,onDocumentLoad:a})}))}))};export{d as default,n as pdfWorker};
|
|
2
2
|
//# sourceMappingURL=PdfContainer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e={pdfViewer:{borderRadius:"12px",padding:"16px",width:"100%",height:"100%"},card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",
|
|
1
|
+
var e={pdfViewer:{borderRadius:"12px",padding:"16px",width:"100%",height:"100%"},card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",width:"100%"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",position:"relative"},title:{fontSize:"14px",fontWeight:600,color:"#60A3F8",fontFamily:'Roboto, "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif'},toolbar:{display:"flex",alignItems:"center",gap:"8px",position:"relative"},button:{border:"1px solid #DFE5EC",borderRadius:"6px",padding:"4px 8px",fontSize:"14px",cursor:"pointer",backgroundColor:"#FFFFFF"},buttonDisabled:{opacity:.4,cursor:"not-allowed"},counter:{fontSize:"13px",color:"#64748B",margin:"0 6px"},viewerWrapper:{height:"30rem",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center",border:"1px solid #DEE4EB",borderRadius:"8px"},emptyState:{fontSize:"14px",color:"#EF4444"},pdfConatiner:{height:"100%",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center"}};export{e as pdfStyles};
|
|
2
2
|
//# sourceMappingURL=PdfStyle.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as t,jsx as n}from"react/jsx-runtime";import{pdfStyles as l}from"./PdfStyle.js";import{DefaultPdfIcon as o,DefaultFullScreenIcon as r,DefaultDownloadIcon as i,DefaultCloseIcon as s}from"../../assests/svg/PdfViewerIcons.js";var c=function(c){c.highlightIndex,c.totalHighlights;var a=c.controls;c.currentPosition;var d=c.pdfName,m=c.onClose,u=c.pdfUrl,f=c.viewerRef,p=c.customStyles,v=c.customClasses,g=c.customIcons,h=a.ZoomInButton,x=a.ZoomOutButton,b=a.ZoomPopover;a.goToPrevious,a.goToNext;var N=(null==v?void 0:v.actionButton)||"p-1 hover:bg-gray-200 rounded-md transition-colors";return t("div",e({className:(null==v?void 0:v.header)||"flex items-center justify-between mb-3 bg-[#FAFAFA] border-b border-gray-100 rounded-t-xl",style:e(e({},l.header),null==p?void 0:p.header)},{children:[t("div",e({className:"flex items-center gap-3"},{children:[n("div",e({style:e(e({},{borderRadius:"21px",border:"6px solid #E8F3FF",background:"#D5E8FF",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",boxSizing:"content-box"}),null==p?void 0:p.pdfIconWrapper)},{children:(null==g?void 0:g.pdfIcon)||n(o,{})})),n("span",e({className:(null==v?void 0:v.pdfName)||"text-gray-800 text-sm",style:e({fontWeight:500},null==p?void 0:p.pdfName)},{children:d}))]})),t("div",e({className:"flex items-center gap-4 text-gray-600"},{children:[t("div",e({className:"flex items-center gap-1"},{children:[n(x,{}),n("div",e({className:"text-sm font-medium w-14 text-center"},{children:n(b,{})})),n(h,{})]})),n("div",{className:"w-px h-5 bg-gray-300 mx-1"}),t("div",e({className:"flex items-center gap-2"},{children:[n("button",e({onClick:function(){var e=null==f?void 0:f.current;e&&(document.fullscreenElement?document.exitFullscreen():e.requestFullscreen().catch(function(e){console.error("Error attempting to enable fullscreen: ".concat(e.message))}))},className:N,title:"Full Screen"},{children:(null==g?void 0:g.fullScreenIcon)||n(r,{})})),u&&n("a",e({href:u,target:"_blank",rel:"noopener noreferrer",className:N,title:"Open in new tab"},{children:(null==g?void 0:g.downloadIcon)||n(i,{})})),m&&n("button",e({onClick:m,className:"".concat(N," ml-1"),title:"Close"},{children:(null==g?void 0:g.closeIcon)||n(s,{})}))]}))]}))]}))};export{c as default};
|
|
2
2
|
//# sourceMappingURL=PdfToolbar.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{SpecialZoomLevel as o}from"@react-pdf-viewer/core";import r from"./PdfContainer.js";import s from"./PdfToolbar.js";import{pdfStyles as l}from"./PdfStyle.js";import{PdfHighlightControls as n}from"./usePdfHighlight.js";import"@react-pdf-viewer/zoom/lib/styles/index.css";import"@react-pdf-viewer/page-navigation/lib/styles/index.css";import"@react-pdf-viewer/core/lib/styles/index.css";import"@react-pdf-viewer/search/lib/styles/index.css";import{useRef as a}from"react";var d=function(d){var m=d.pdfUrl,c=d.highlightText,p=d.highlightPages,f=d.jumpToPageValue,u=void 0===f?0:f,h=d.pdfName,g=d.onClose,v=d.customStyles,y=d.customClasses,x=d.customIcons,w=n(c,p),P=w.highlightIndex,b=w.cursorIndex,j=w.setCursorIndex,C=w.orderedKeys,S=w.totalHighlights,I=w.getValidPosition,A=w.tryJump,F=w.jumpToPage,T=w.zoomTo,V=w.plugins,z=w.controls,H=I(b),N=a(null);if(!m)return t("div",e({style:e(e({},l.emptyState),null==v?void 0:v.emptyState)},{children:"PDF is not available for this selection"}));return i("div",e({ref:N,className:(null==y?void 0:y.pdfViewerWrapper)||"",style:e(e(e({},l.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==v?void 0:v.pdfViewer)},{children:[t(s,{highlightIndex:P,totalHighlights:S,controls:z,currentPosition:H,pdfName:h,onClose:g,pdfUrl:m,viewerRef:N,customStyles:v,customClasses:y,customIcons:x}),t(r,{pdfUrl:m,plugins:V,customStyles:v,onLoad:function(){if(T(o.ActualSize),u>0){var e=u-1,t=C[e],i=p[t];j(e),i>0&&F(i-1)}requestAnimationFrame(A)}})]}))};export{d as default};
|
|
2
2
|
//# sourceMappingURL=PdfViewer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdfViewerTest.d.ts","sourceRoot":"","sources":["../../../src/PdfViewerTest.tsx"],"names":[],"mappings":"AAcA,QAAA,MAAM,aAAa,+
|
|
1
|
+
{"version":3,"file":"PdfViewerTest.d.ts","sourceRoot":"","sources":["../../../src/PdfViewerTest.tsx"],"names":[],"mappings":"AAcA,QAAA,MAAM,aAAa,+CAwClB,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const DefaultPdfIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const DefaultFullScreenIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const DefaultDownloadIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const DefaultCloseIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=PdfViewerIcons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdfViewerIcons.d.ts","sourceRoot":"","sources":["../../../../../src/assests/svg/PdfViewerIcons.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,+CAI1B,CAAC;AAEF,eAAO,MAAM,qBAAqB,+CAIjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,+CAM/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAK5B,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { CustomStylesType } from "./PdfViewer";
|
|
1
2
|
export declare const pdfWorker: string;
|
|
2
3
|
type Props = {
|
|
3
4
|
pdfUrl: string;
|
|
4
5
|
plugins: any[];
|
|
5
6
|
onLoad: () => void;
|
|
7
|
+
customStyles?: CustomStylesType;
|
|
6
8
|
};
|
|
7
|
-
declare const PdfContainer: ({ pdfUrl, plugins, onLoad }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const PdfContainer: ({ pdfUrl, plugins, onLoad, customStyles }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
export default PdfContainer;
|
|
9
11
|
//# sourceMappingURL=PdfContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdfContainer.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/PdfContainer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PdfContainer.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/PdfContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,eAAO,MAAM,SAAS,EAAE,MAAwE,CAAC;AAEjG,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF,QAAA,MAAM,YAAY,8CAA+C,KAAK,4CAarE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,4 +1,32 @@
|
|
|
1
|
-
import { CSSProperties } from "react";
|
|
1
|
+
import { CSSProperties, ReactNode } from "react";
|
|
2
|
+
export interface PdfCustomIcons {
|
|
3
|
+
pdfIcon?: ReactNode;
|
|
4
|
+
fullScreenIcon?: ReactNode;
|
|
5
|
+
downloadIcon?: ReactNode;
|
|
6
|
+
closeIcon?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface PdfCustomStyles {
|
|
9
|
+
pdfViewer?: CSSProperties;
|
|
10
|
+
card?: CSSProperties;
|
|
11
|
+
header?: CSSProperties;
|
|
12
|
+
title?: CSSProperties;
|
|
13
|
+
toolbar?: CSSProperties;
|
|
14
|
+
button?: CSSProperties;
|
|
15
|
+
buttonDisabled?: CSSProperties;
|
|
16
|
+
counter?: CSSProperties;
|
|
17
|
+
viewerWrapper?: CSSProperties;
|
|
18
|
+
emptyState?: CSSProperties;
|
|
19
|
+
pdfContainer?: CSSProperties;
|
|
20
|
+
}
|
|
21
|
+
export interface PdfCustomClasses {
|
|
22
|
+
pdfViewer?: string;
|
|
23
|
+
header?: string;
|
|
24
|
+
headerLeft?: string;
|
|
25
|
+
headerRight?: string;
|
|
26
|
+
pdfContainer?: string;
|
|
27
|
+
emptyState?: string;
|
|
28
|
+
iconButton?: string;
|
|
29
|
+
}
|
|
2
30
|
export declare const pdfStyles: {
|
|
3
31
|
[key: string]: CSSProperties;
|
|
4
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdfStyle.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/PdfStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PdfStyle.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/PdfStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjD,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,YAAY,CAAC,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,SAAS,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CA8ErD,CAAC"}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CustomIconsType, CustomStylesType, CustomClassesType } from "./PdfViewer";
|
|
1
3
|
type Props = {
|
|
2
4
|
highlightIndex: number;
|
|
3
5
|
totalHighlights: number;
|
|
4
6
|
controls: any;
|
|
5
7
|
currentPosition: any;
|
|
8
|
+
pdfName?: string;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
pdfUrl?: string;
|
|
11
|
+
viewerRef?: React.RefObject<HTMLDivElement>;
|
|
12
|
+
customStyles?: CustomStylesType;
|
|
13
|
+
customClasses?: CustomClassesType;
|
|
14
|
+
customIcons?: CustomIconsType;
|
|
6
15
|
};
|
|
7
|
-
declare const PdfToolbar: ({ highlightIndex, totalHighlights, controls, currentPosition }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare const PdfToolbar: ({ highlightIndex, totalHighlights, controls, currentPosition, pdfName, onClose, pdfUrl, viewerRef, customStyles, customClasses, customIcons }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
17
|
export default PdfToolbar;
|
|
9
18
|
//# sourceMappingURL=PdfToolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdfToolbar.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/PdfToolbar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PdfToolbar.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/PdfToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGnF,KAAK,KAAK,GAAG;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,GAAG,CAAC;IACd,eAAe,EAAE,GAAG,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC5C,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B,CAAC;AAEF,QAAA,MAAM,UAAU,kJAYb,KAAK,4CAwFP,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -2,6 +2,39 @@ import "@react-pdf-viewer/zoom/lib/styles/index.css";
|
|
|
2
2
|
import "@react-pdf-viewer/page-navigation/lib/styles/index.css";
|
|
3
3
|
import "@react-pdf-viewer/core/lib/styles/index.css";
|
|
4
4
|
import "@react-pdf-viewer/search/lib/styles/index.css";
|
|
5
|
-
|
|
5
|
+
import React from "react";
|
|
6
|
+
export type CustomIconsType = {
|
|
7
|
+
pdfIcon?: React.ReactNode;
|
|
8
|
+
fullScreenIcon?: React.ReactNode;
|
|
9
|
+
downloadIcon?: React.ReactNode;
|
|
10
|
+
closeIcon?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export type CustomStylesType = {
|
|
13
|
+
pdfViewer?: React.CSSProperties;
|
|
14
|
+
header?: React.CSSProperties;
|
|
15
|
+
pdfIconWrapper?: React.CSSProperties;
|
|
16
|
+
pdfName?: React.CSSProperties;
|
|
17
|
+
pdfContainer?: React.CSSProperties;
|
|
18
|
+
emptyState?: React.CSSProperties;
|
|
19
|
+
};
|
|
20
|
+
export type CustomClassesType = {
|
|
21
|
+
header?: string;
|
|
22
|
+
pdfName?: string;
|
|
23
|
+
actionButton?: string;
|
|
24
|
+
pdfViewerWrapper?: string;
|
|
25
|
+
};
|
|
26
|
+
interface PdfViewerProps {
|
|
27
|
+
pdfUrl?: string;
|
|
28
|
+
highlightText: string[];
|
|
29
|
+
highlightPages?: any;
|
|
30
|
+
jumpToPageValue?: number;
|
|
31
|
+
pdfName?: string;
|
|
32
|
+
onClose?: () => void;
|
|
33
|
+
item?: any;
|
|
34
|
+
customStyles?: CustomStylesType;
|
|
35
|
+
customClasses?: CustomClassesType;
|
|
36
|
+
customIcons?: CustomIconsType;
|
|
37
|
+
}
|
|
38
|
+
declare const PdfViewer: ({ pdfUrl, highlightText, highlightPages, jumpToPageValue, pdfName, onClose, customStyles, customClasses, customIcons, }: PdfViewerProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
39
|
export default PdfViewer;
|
|
7
40
|
//# sourceMappingURL=PdfViewer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdfViewer.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/PdfViewer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PdfViewer.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/PdfViewer.tsx"],"names":[],"mappings":"AAKA,OAAO,6CAA6C,CAAC;AACrD,OAAO,wDAAwD,CAAC;AAChE,OAAO,6CAA6C,CAAC;AACrD,OAAO,+CAA+C,CAAC;AACvD,OAAO,KAAiB,MAAM,OAAO,CAAC;AAEtC,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAChC,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC7B,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACnC,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED,QAAA,MAAM,SAAS,4HAUZ,cAAc,4CAsFhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|