@epam/ai-dial-react-pdf-highlighter 0.2.0-dev.5 → 0.2.0-dev.7
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/ai-dial-react-pdf-highlighter.cjs.js +1 -1
- package/dist/ai-dial-react-pdf-highlighter.es.js +311 -299
- package/dist/index.css +1 -1
- package/dist/src/components/DocumentPreview/DocumentPreview.d.ts +13 -1
- package/dist/src/components/PdfViewer/PdfViewer.d.ts +7 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/models/pdf-viewer.models.d.ts +5 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("@epam/ai-dial-ui-kit"),U=require("@epam/pdf-highlighter-kit"),t=require("react"),z=require("@tabler/icons-react"),Z="auto",A="page-fit",L=[{value:Z,label:"Auto"},{value:A,label:"Page Fit"},{value:"0.5",label:"50%"},{value:"0.75",label:"75%"},{value:"1",label:"100%"},{value:"1.25",label:"125%"},{value:"1.5",label:"150%"},{value:"2",label:"200%"},{value:"3",label:"300%"}],K={maxWidth:104,format:"image/jpeg",quality:.85},$=15,ne="application/pdf",le=".pdf",W=({pdf:s,highlights:a,selectedHighlightId:m,autoFocusFirstHighlight:n=!1,selectedPageNumber:d,zoom:c,containerClassName:p,onTotalPagesChange:x,onViewerReady:y,selectedPages:f})=>{const h=t.useRef(null),r=t.useRef(null),[o,C]=t.useState(!1),[O,v]=t.useState(!1),P=t.useRef(x),E=t.useRef(y);t.useEffect(()=>{P.current=x},[x]),t.useEffect(()=>{E.current=y},[y]);const N=t.useCallback(l=>r.current?.goToHighlight(l),[]);return t.useEffect(()=>{if(!h.current)return;C(!1),v(!1),r.current&&(r.current.destroy(),r.current=null);let l=null,b=!0;return(async()=>{try{if(l=new U.PDFHighlightViewer,await l.init(h.current,{enableTextSelection:!0,enableVirtualScrolling:!0,bboxOrigin:"top-left"}),!b){l.destroy();return}if(await l.loadPDF(s,{selectedPages:f}),!b){l.destroy();return}const g=l.getTotalPages?.();typeof g=="number"&&g>0&&P.current?.(g),b&&(r.current=l,C(!0))}catch(g){if(!b)return;console.error("Error in initViewer:",g)}})(),()=>{b=!1,l&&l.destroy()}},[s,f]),t.useEffect(()=>{!o||!r.current||(r.current.loadHighlights(a),n&&a&&a[0]&&N(a[0].id))},[n,N,a,o]),t.useEffect(()=>{v(!0)},[a]),t.useEffect(()=>{o&&O&&m&&N(m)},[N,o,O,m]),t.useEffect(()=>{if(!(!o||!c))if(c===Z)r.current?.setZoom?.(U.ZoomMode.AUTO);else if(c===A)r.current?.setZoom?.(U.ZoomMode.PAGE_FIT);else{const l=parseFloat(c);!Number.isNaN(l)&&l>0&&r.current?.setZoom?.(l)}},[o,c]),t.useEffect(()=>{o&&d&&r.current?.setPage?.(d)},[o,d]),t.useEffect(()=>{if(!o||!r.current)return;const l=r.current;E.current?.({getThumbnailsDataUrl:(b,I)=>l.getThumbnailsDataUrl(b,I),zoomIn:()=>l.zoomIn(),zoomOut:()=>l.zoomOut(),getZoom:()=>l.getZoom(),navigateToPage:b=>l.setPage?.(b)})},[o]),e.jsx("div",{ref:h,className:i.mergeClasses("grow min-w-0 overflow-auto bg-layer-3",p)})},T="h-4 rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave",X=({className:s,ariaLabel:a="pdf preview loading"})=>e.jsx("div",{role:"status","aria-label":a,"aria-live":"polite",className:i.mergeClasses("h-full w-full bg-layer-3",s),children:e.jsxs("div",{className:"flex h-full w-full flex-col gap-10 px-[60px] pt-10",children:[e.jsx("div",{className:"mx-auto h-4 w-[208px] max-w-[40%] rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave"}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:T}),e.jsx("div",{className:T}),e.jsx("div",{className:T}),e.jsx("div",{className:T}),e.jsx("div",{className:i.mergeClasses(T,"w-[28%] max-w-[320px]")})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:T}),e.jsx("div",{className:T}),e.jsx("div",{className:T}),e.jsx("div",{className:T}),e.jsx("div",{className:i.mergeClasses(T,"w-[58%] max-w-[520px]")})]})]})}),Y=t.createContext(null),J=()=>t.useContext(Y),S=L.filter(({value:s})=>{const a=Number.parseFloat(s);return!Number.isNaN(a)&&a>0}),oe=[...S].reverse(),Q=(s,a,m)=>{if(S.length===0)return s;const n=Number.parseFloat(s),d=!Number.isNaN(n)&&n>0?n:m,c=typeof d=="number"&&d>0?d:Number.parseFloat(S[0].value);return a===1?(S.find(({value:p})=>Number.parseFloat(p)>c)??S[S.length-1]).value:(oe.find(({value:p})=>Number.parseFloat(p)<c)??S[0]).value};function ee(s,a){const m=(s??"").toLowerCase();return(a??"").toLowerCase()===ne||m.endsWith(le)}const G=L.map(s=>({value:s.value,label:s.label})),te=({fileUrl:s,fileName:a,loadFileCb:m,highlights:n,selectedPageNumber:d,onTotalPagesChange:c,thumbnailPageNumbers:p,onThumbnailsLoaded:x,onViewerReady:y,showLoaderOverlay:f=!1,selectedPages:h})=>{const r=J(),o=t.useRef(null),[C,O]=t.useState(!1),[v,P]=t.useState(0),[E,N]=t.useState(!1),[l,b]=t.useState(null),[I,g]=t.useState(null),[j,k]=t.useState(Z),D=t.useMemo(()=>{let u=a||s;if(!a)try{u=new URL(s).pathname}catch{u=s.split("?")[0].split("#")[0]}return ee(u.toLowerCase())},[a,s]),M=t.useCallback(u=>{P((v+u+n.length)%n.length)},[v,n.length]),F=t.useCallback(u=>{const w=o.current;!w?.getZoom||!u||k(Q(j,u,w.getZoom()))},[j]),V=t.useMemo(()=>{if(!(j===Z||j===A||L.some(w=>w.value===j))){const w=parseFloat(j);if(!Number.isNaN(w)&&w>0)return[...G,{value:j,label:`${Math.round(w*100)}%`}]}return G},[j]);t.useEffect(()=>{let u=!1;if(b(!0),N(!1),g(null),O(!1),o.current=null,!D){N(!0),b(!1);return}return(async()=>{try{const _=await(r?r.getFile(s,()=>m(s)):m(s));u||g(_)}catch{u||(N(!0),g(null))}finally{u||b(!1)}})(),()=>{u=!0}},[s,r,m,D]);const B=t.useCallback(u=>{o.current=u,O(!0),y?.(u)},[y]);return t.useEffect(()=>{const u=p??[],w=o.current?.getThumbnailsDataUrl;if(!u.length||!w||!I||!x||!C)return;let _=!1;return(async()=>{const q=new Map;for(let R=0;R<u.length&&!_;R+=$){const se=u.slice(R,R+$);try{const H=await w(se,K);if(_)break;H.forEach((re,ae)=>q.set(ae,re)),x(new Map(q))}catch(H){console.warn("Thumbnail batch load failed:",H);break}}})(),()=>{_=!0}},[p,I,x,C]),{file:I,isLoading:l,isError:E,isSupportedFile:D,activeHighlightIndex:v,zoom:j,setZoom:k,zoomSelectOptions:V,viewerApiRef:o,showLoader:!E&&(!!l||f),changeIndex:M,handleZoomChange:F,handleViewerReady:B}},ce=({fileUrl:s,fileName:a,errorLabel:m,occurrencesLabel:n,unsupportedLabel:d,highlights:c,loadFileCb:p,showOccurrences:x=!0,selectedPageNumber:y,containerClassName:f,pdfViewerClassName:h,onTotalPagesChange:r,title:o,thumbnailPageNumbers:C,onThumbnailsLoaded:O,onViewerReady:v,showLoaderOverlay:P=!1,selectedPages:E})=>{const{file:N,isError:l,isSupportedFile:b,activeHighlightIndex:I,zoom:g,setZoom:j,zoomSelectOptions:k,showLoader:D,changeIndex:M,handleZoomChange:F,handleViewerReady:V}=te({fileUrl:s,fileName:a,loadFileCb:p,highlights:c,selectedPageNumber:y,onTotalPagesChange:r,thumbnailPageNumbers:C,onThumbnailsLoaded:O,onViewerReady:v,showLoaderOverlay:P,selectedPages:E});return e.jsxs("div",{className:i.mergeClasses("flex flex-col self-center gap-4 py-3 px-6 h-full w-full bg-layer-2",f),children:[a&&e.jsx("div",{className:"shrink-0 min-h-0 w-full",children:e.jsx(i.DialEllipsisTooltip,{className:"dial-tiny-text text-secondary",text:a})}),e.jsxs("div",{className:i.mergeClasses("flex w-full justify-between items-center",x&&o?"gap-2":""),children:[e.jsx("div",{children:x?e.jsxs("div",{className:"flex gap-1 py-0.5 px-1.5 min-h-[26px] items-center bg-layer-4 rounded w-fit",children:[e.jsxs("span",{className:"dial-small-text",children:[n??"Occurrences",":",e.jsx("span",{className:"pl-0.5 min-w-3 inline-block text-right",children:c.length>0?`${I+1}/${c.length}`:"0"})]}),c.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(i.DialButton,{className:"p-0 text-primary !h-6.5",size:i.ElementSize.Small,iconAfter:e.jsx(z.IconChevronDown,{size:16}),"aria-label":"Next occurrence",onClick:()=>M(1)}),e.jsx(i.DialButton,{className:"p-0 text-primary !h-6.5",size:i.ElementSize.Small,iconAfter:e.jsx(z.IconChevronUp,{size:16}),"aria-label":"Previous occurrence",onClick:()=>M(-1)})]})]}):e.jsx("div",{})}),e.jsxs("div",{className:i.mergeClasses("flex flex-1 items-center gap-4 min-w-0",o!=null&&o!==""?"justify-between":"justify-end"),children:[o!=null&&o!==""&&e.jsx(i.DialEllipsisTooltip,{text:o,className:"dial-body-semi-text text-primary min-w-0"}),e.jsxs("div",{className:"flex gap-0.5 items-center shrink-0",children:[e.jsx("div",{className:"h-6",children:e.jsx(i.DialSelect,{size:i.SelectSize.Sm,className:"bg-layer-4 !py-0 h-6 min-h-6 dial-small-text max-h-full border-transparent hover:border-hover rounded",options:k,value:g,onChange:B=>j(B)})}),e.jsx(i.DialButton,{className:"py-0 flex items-center justify-center rounded text-primary bg-layer-4 border border-transparent hover:border-hover",iconAfter:e.jsx(z.IconMinus,{size:16}),"aria-label":"Zoom out",size:i.ElementSize.Small,onClick:()=>F(-1)}),e.jsx(i.DialButton,{className:"py-0 flex items-center justify-center rounded text-primary bg-layer-4 border border-transparent hover:border-hover",iconAfter:e.jsx(z.IconPlus,{size:16}),"aria-label":"Zoom in",size:i.ElementSize.Small,onClick:()=>F(1)})]})]})]}),e.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[N&&e.jsx(W,{pdf:N,highlights:c,selectedHighlightId:x?c[I]?.id:void 0,selectedPageNumber:y,zoom:g,onTotalPagesChange:r,onViewerReady:V,containerClassName:h,selectedPages:E}),D&&e.jsx(X,{className:"absolute inset-0 z-10"}),l&&e.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-layer-3",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 p-10",children:[e.jsx(z.IconAlertTriangle,{size:60,stroke:2,className:"text-secondary"}),e.jsx("div",{className:"text-center dial-small-text whitespace-pre-wrap",children:!b&&d?d:m??"Failed to load document."})]})})]})]})},ie=1200*1e3,ue=20,me=({children:s,ttlMs:a=ie,maxEntries:m=ue})=>{const n=t.useRef(new Map),d=t.useCallback((f,h)=>{n.current.delete(f),n.current.set(f,h)},[]),c=t.useCallback(()=>{const f=Date.now();for(const[h,r]of n.current.entries())r.file&&f-r.timestamp>a&&n.current.delete(h)},[a]),p=t.useCallback(()=>{for(;n.current.size>m;){const f=n.current.keys().next().value;f&&n.current.delete(f)}},[m]),x=t.useCallback(()=>{n.current.clear()},[]),y=t.useCallback(async(f,h)=>{c();const r=n.current.get(f);if(r){if(d(f,{...r,timestamp:Date.now()}),r.file)return r.file;if(r.promise)return r.promise}const o=Date.now(),C=h().then(v=>{const P={file:v,timestamp:Date.now()};return d(f,P),p(),v}).catch(v=>{throw n.current.delete(f),v});return d(f,{promise:C,timestamp:o}),p(),C},[p,c,d]);return t.useEffect(()=>()=>x(),[x]),e.jsx(Y.Provider,{value:{getFile:y,clearCache:x},children:s})},de=({pageNum:s,onSelectPage:a,isSelected:m,isLoading:n,isMultiselect:d,thumbnailUrl:c,className:p})=>e.jsxs("button",{type:"button","aria-label":`Page ${s}`,"aria-pressed":m,onClick:x=>{d&&x.target.closest("[data-checkbox-wrapper]")||a(s)},className:i.mergeClasses("flex flex-col gap-2 p-2 h-[186px] w-[120px] items-center justify-center cursor-pointer transition-colors hover:bg-layer-4 rounded-sm",m&&(d?"border border-accent-primary bg-accent-primary-alpha":"border border-primary"),p),children:[e.jsxs("div",{className:"relative w-[104px] h-[146px] bg-model-icon rounded-sm overflow-hidden",children:[c?e.jsx("img",{src:c,alt:`Page ${s} thumbnail`,className:"w-full h-full object-cover rounded-sm"}):null,d&&e.jsx("div",{className:"absolute left-1 top-1 z-10","data-checkbox-wrapper":!0,children:e.jsx(i.DialCheckbox,{id:`page-thumbnail-${s}`,checked:m,onChange:()=>a(s),className:"before:border-primary before:bg-model-icon bg-model-icon"})}),n&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-blackout rounded-sm",children:e.jsx(i.DialLoader,{size:24,fullWidth:!1,ariaLabel:`Loading page ${s}`})})]}),e.jsx("span",{className:"dial-tiny-text text-primary",children:s})]});exports.AUTO_ZOOM_ID=Z;exports.DocumentPreview=ce;exports.DocumentPreviewCacheProvider=me;exports.FIT_ZOOM_ID=A;exports.PDFViewer=W;exports.PageThumbnail=de;exports.PdfPreviewLoader=X;exports.THUMBNAIL_BATCH_SIZE=$;exports.THUMBNAIL_IMAGE_OPTIONS=K;exports.ZOOM_OPTIONS=L;exports.getStepZoomOptionValue=Q;exports.isPdfFile=ee;exports.useDocumentPreview=te;exports.useDocumentPreviewCache=J;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("@epam/ai-dial-ui-kit"),F=require("@epam/pdf-highlighter-kit"),t=require("react"),z=require("@tabler/icons-react"),R="auto",L="page-fit",V=[{value:R,label:"Auto"},{value:L,label:"Page Fit"},{value:"0.5",label:"50%"},{value:"0.75",label:"75%"},{value:"1",label:"100%"},{value:"1.25",label:"125%"},{value:"1.5",label:"150%"},{value:"2",label:"200%"},{value:"3",label:"300%"}],W={maxWidth:104,format:"image/jpeg",quality:.85},$=15,le="application/pdf",oe=".pdf",X=({pdf:a,highlights:r,selectedHighlightId:u,autoFocusFirstHighlight:l=!1,selectedPageNumber:m,zoom:c,containerClassName:h,onTotalPagesChange:v,onViewerReady:N,selectedPages:d,viewerOptions:y})=>{const f=t.useRef(null),n=t.useRef(null),[b,D]=t.useState(!1),[g,E]=t.useState(!1),T=t.useRef(v),O=t.useRef(N),S=t.useRef(y);t.useEffect(()=>{T.current=v},[v]),t.useEffect(()=>{O.current=N},[N]),t.useEffect(()=>{S.current=y},[y]);const j=t.useCallback(s=>n.current?.goToHighlight(s),[]);return t.useEffect(()=>{if(!f.current)return;D(!1),E(!1),n.current&&(n.current.destroy(),n.current=null);let s=null,x=!0;const p=()=>{x&&E(!0)};return(async()=>{try{if(s=new F.PDFHighlightViewer,await s.init(f.current,{enableTextSelection:!0,enableVirtualScrolling:!0,bboxOrigin:"top-left",...S.current}),!x){s.destroy();return}if(s.addEventListener("zoomChanged",p),await s.loadPDF(a,{selectedPages:d}),!x){s.destroy();return}const C=s.getTotalPages?.();typeof C=="number"&&C>0&&T.current?.(C),x&&(n.current=s,D(!0))}catch(C){if(!x)return;console.error("Error in initViewer:",C)}})(),()=>{x=!1,s&&(s.removeEventListener("zoomChanged",p),s.destroy())}},[a,d]),t.useEffect(()=>{!b||!n.current||(n.current.loadHighlights(r),l&&r&&r[0]&&j(r[0].id))},[l,j,r,b]),t.useEffect(()=>{b&&g&&u&&j(u)},[j,b,g,u]),t.useEffect(()=>{if(!(!b||!c))if(c===R)n.current?.setZoom?.(F.ZoomMode.AUTO);else if(c===L)n.current?.setZoom?.(F.ZoomMode.PAGE_FIT);else{const s=parseFloat(c);!Number.isNaN(s)&&s>0&&n.current?.setZoom?.(s)}},[b,c]),t.useEffect(()=>{b&&m&&n.current?.setPage?.(m)},[b,m]),t.useEffect(()=>{if(!b||!n.current)return;const s=n.current;O.current?.({getThumbnailsDataUrl:(x,p)=>s.getThumbnailsDataUrl(x,p),zoomIn:()=>s.zoomIn(),zoomOut:()=>s.zoomOut(),getZoom:()=>s.getZoom(),navigateToPage:x=>s.setPage?.(x),setPageDisplayRotation:(x,p,I)=>s.setPageDisplayRotation(x,p,I),getPageDisplayRotation:x=>s.getPageDisplayRotation(x)})},[b]),e.jsx("div",{ref:f,className:i.mergeClasses("grow min-w-0 overflow-auto bg-layer-3",h)})},P="h-4 rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave",Y=({className:a,ariaLabel:r="pdf preview loading"})=>e.jsx("div",{role:"status","aria-label":r,"aria-live":"polite",className:i.mergeClasses("h-full w-full bg-layer-3",a),children:e.jsxs("div",{className:"flex h-full w-full flex-col gap-10 px-[60px] pt-10",children:[e.jsx("div",{className:"mx-auto h-4 w-[208px] max-w-[40%] rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave"}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:i.mergeClasses(P,"w-[28%] max-w-[320px]")})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:i.mergeClasses(P,"w-[58%] max-w-[520px]")})]})]})}),J=t.createContext(null),Q=()=>t.useContext(J),_=V.filter(({value:a})=>{const r=Number.parseFloat(a);return!Number.isNaN(r)&&r>0}),ce=[..._].reverse(),ee=(a,r,u)=>{if(_.length===0)return a;const l=Number.parseFloat(a),m=!Number.isNaN(l)&&l>0?l:u,c=typeof m=="number"&&m>0?m:Number.parseFloat(_[0].value);return r===1?(_.find(({value:h})=>Number.parseFloat(h)>c)??_[_.length-1]).value:(ce.find(({value:h})=>Number.parseFloat(h)<c)??_[0]).value};function te(a,r){const u=(a??"").toLowerCase();return(r??"").toLowerCase()===le||u.endsWith(oe)}const K=V.map(a=>({value:a.value,label:a.label})),ae=({fileUrl:a,fileName:r,loadFileCb:u,highlights:l,selectedPageNumber:m,onTotalPagesChange:c,thumbnailPageNumbers:h,onThumbnailsLoaded:v,onViewerReady:N,showLoaderOverlay:d=!1,selectedPages:y})=>{const f=Q(),n=t.useRef(null),[b,D]=t.useState(!1),[g,E]=t.useState(0),[T,O]=t.useState(!1),[S,j]=t.useState(null),[s,x]=t.useState(null),[p,I]=t.useState(R),C=t.useMemo(()=>{let o=r||a;if(!r)try{o=new URL(a).pathname}catch{o=a.split("?")[0].split("#")[0]}return te(o.toLowerCase())},[r,a]),B=t.useCallback(o=>{E((g+o+l.length)%l.length)},[g,l.length]),H=t.useCallback(o=>{const w=n.current;!w?.getZoom||!o||I(ee(p,o,w.getZoom()))},[p]),k=t.useMemo(()=>{if(!(p===R||p===L||V.some(w=>w.value===p))){const w=parseFloat(p);if(!Number.isNaN(w)&&w>0)return[...K,{value:p,label:`${Math.round(w*100)}%`}]}return K},[p]);t.useEffect(()=>{let o=!1;if(j(!0),O(!1),x(null),D(!1),n.current=null,!C){O(!0),j(!1);return}return(async()=>{try{const Z=await(f?f.getFile(a,()=>u(a)):u(a));o||x(Z)}catch{o||(O(!0),x(null))}finally{o||j(!1)}})(),()=>{o=!0}},[a,f,u,C]);const M=t.useCallback(o=>{n.current=o,D(!0),N?.(o)},[N]);return t.useEffect(()=>{const o=h??[],w=n.current?.getThumbnailsDataUrl;if(!o.length||!w||!s||!v||!b)return;let Z=!1;return(async()=>{const G=new Map;for(let A=0;A<o.length&&!Z;A+=$){const se=o.slice(A,A+$);try{const U=await w(se,W);if(Z)break;U.forEach((re,ne)=>G.set(ne,re)),v(new Map(G))}catch(U){console.warn("Thumbnail batch load failed:",U);break}}})(),()=>{Z=!0}},[h,s,v,b]),{file:s,isLoading:S,isError:T,isSupportedFile:C,activeHighlightIndex:g,zoom:p,setZoom:I,zoomSelectOptions:k,viewerApiRef:n,showLoader:!T&&(!!S||d),changeIndex:B,handleZoomChange:H,handleViewerReady:M}},ie=({fileUrl:a,fileName:r,errorLabel:u,occurrencesLabel:l,unsupportedLabel:m,highlights:c,loadFileCb:h,showOccurrences:v=!0,selectedPageNumber:N,containerClassName:d,pdfViewerClassName:y,onTotalPagesChange:f,title:n,thumbnailPageNumbers:b,onThumbnailsLoaded:D,onViewerReady:g,showLoaderOverlay:E=!1,selectedPages:T,selectedHighlightId:O,viewerOptions:S})=>{const{file:j,isError:s,isSupportedFile:x,activeHighlightIndex:p,zoom:I,setZoom:C,zoomSelectOptions:B,showLoader:H,changeIndex:k,handleZoomChange:M,handleViewerReady:q}=ae({fileUrl:a,fileName:r,loadFileCb:h,highlights:c,selectedPageNumber:N,onTotalPagesChange:f,thumbnailPageNumbers:b,onThumbnailsLoaded:D,onViewerReady:g,showLoaderOverlay:E,selectedPages:T});return e.jsxs("div",{className:i.mergeClasses("flex flex-col self-center gap-4 py-3 px-6 h-full w-full bg-layer-2",d),children:[r&&e.jsx("div",{className:"shrink-0 min-h-0 w-full",children:e.jsx(i.DialEllipsisTooltip,{className:"dial-tiny-text text-secondary",text:r})}),e.jsxs("div",{className:i.mergeClasses("flex w-full justify-between items-center",v&&n?"gap-2":""),children:[e.jsx("div",{children:v?e.jsxs("div",{className:"flex gap-1 py-0.5 px-1.5 min-h-[26px] items-center bg-layer-4 rounded w-fit",children:[e.jsxs("span",{className:"dial-small-text",children:[l??"Occurrences",":",e.jsx("span",{className:"pl-0.5 min-w-3 inline-block text-right",children:c.length>0?`${p+1}/${c.length}`:"0"})]}),c.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(i.DialButton,{className:"p-0 text-primary !h-6.5",size:i.ElementSize.Small,iconAfter:e.jsx(z.IconChevronDown,{size:16}),"aria-label":"Next occurrence",onClick:()=>k(1)}),e.jsx(i.DialButton,{className:"p-0 text-primary !h-6.5",size:i.ElementSize.Small,iconAfter:e.jsx(z.IconChevronUp,{size:16}),"aria-label":"Previous occurrence",onClick:()=>k(-1)})]})]}):e.jsx("div",{})}),e.jsxs("div",{className:i.mergeClasses("flex flex-1 items-center gap-4 min-w-0",n!=null&&n!==""?"justify-between":"justify-end"),children:[n!=null&&n!==""&&e.jsx(i.DialEllipsisTooltip,{text:n,className:"dial-body-semi-text text-primary min-w-0"}),e.jsxs("div",{className:"flex gap-0.5 items-center shrink-0",children:[e.jsx("div",{className:"h-6",children:e.jsx(i.DialSelect,{size:i.SelectSize.Sm,className:"bg-layer-4 !py-0 h-6 min-h-6 dial-small-text max-h-full border-transparent hover:border-hover rounded",options:B,value:I,onChange:o=>C(o)})}),e.jsx(i.DialButton,{className:"py-0 flex items-center justify-center rounded text-primary bg-layer-4 border border-transparent hover:border-hover",iconAfter:e.jsx(z.IconMinus,{size:16}),"aria-label":"Zoom out",size:i.ElementSize.Small,onClick:()=>M(-1)}),e.jsx(i.DialButton,{className:"py-0 flex items-center justify-center rounded text-primary bg-layer-4 border border-transparent hover:border-hover",iconAfter:e.jsx(z.IconPlus,{size:16}),"aria-label":"Zoom in",size:i.ElementSize.Small,onClick:()=>M(1)})]})]})]}),e.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[j&&e.jsx(X,{pdf:j,highlights:c,selectedHighlightId:v?c[p]?.id:O,selectedPageNumber:N,zoom:I,onTotalPagesChange:f,onViewerReady:q,containerClassName:y,selectedPages:T,viewerOptions:S}),H&&e.jsx(Y,{className:"absolute inset-0 z-10"}),s&&e.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-layer-3",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 p-10",children:[e.jsx(z.IconAlertTriangle,{size:60,stroke:2,className:"text-secondary"}),e.jsx("div",{className:"text-center dial-small-text whitespace-pre-wrap",children:!x&&m?m:u??"Failed to load document."})]})})]})]})},ue=1200*1e3,me=20,de=({children:a,ttlMs:r=ue,maxEntries:u=me})=>{const l=t.useRef(new Map),m=t.useCallback((d,y)=>{l.current.delete(d),l.current.set(d,y)},[]),c=t.useCallback(()=>{const d=Date.now();for(const[y,f]of l.current.entries())f.file&&d-f.timestamp>r&&l.current.delete(y)},[r]),h=t.useCallback(()=>{for(;l.current.size>u;){const d=l.current.keys().next().value;d&&l.current.delete(d)}},[u]),v=t.useCallback(()=>{l.current.clear()},[]),N=t.useCallback(async(d,y)=>{c();const f=l.current.get(d);if(f){if(m(d,{...f,timestamp:Date.now()}),f.file)return f.file;if(f.promise)return f.promise}const n=Date.now(),b=y().then(g=>{const E={file:g,timestamp:Date.now()};return m(d,E),h(),g}).catch(g=>{throw l.current.delete(d),g});return m(d,{promise:b,timestamp:n}),h(),b},[h,c,m]);return t.useEffect(()=>()=>v(),[v]),e.jsx(J.Provider,{value:{getFile:N,clearCache:v},children:a})},fe=({pageNum:a,onSelectPage:r,isSelected:u,isLoading:l,isMultiselect:m,thumbnailUrl:c,className:h})=>e.jsxs("button",{type:"button","aria-label":`Page ${a}`,"aria-pressed":u,onClick:v=>{m&&v.target.closest("[data-checkbox-wrapper]")||r(a)},className:i.mergeClasses("flex flex-col gap-2 p-2 h-[186px] w-[120px] items-center justify-center cursor-pointer transition-colors hover:bg-layer-4 rounded-sm",u&&(m?"border border-accent-primary bg-accent-primary-alpha":"border border-primary"),h),children:[e.jsxs("div",{className:"relative w-[104px] h-[146px] bg-model-icon rounded-sm overflow-hidden",children:[c?e.jsx("img",{src:c,alt:`Page ${a} thumbnail`,className:"w-full h-full object-cover rounded-sm"}):null,m&&e.jsx("div",{className:"absolute left-1 top-1 z-10","data-checkbox-wrapper":!0,children:e.jsx(i.DialCheckbox,{id:`page-thumbnail-${a}`,checked:u,onChange:()=>r(a),className:"before:border-primary before:bg-model-icon bg-model-icon"})}),l&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-blackout rounded-sm",children:e.jsx(i.DialLoader,{size:24,fullWidth:!1,ariaLabel:`Loading page ${a}`})})]}),e.jsx("span",{className:"dial-tiny-text text-primary",children:a})]});Object.defineProperty(exports,"RotationDirection",{enumerable:!0,get:()=>F.RotationDirection});exports.AUTO_ZOOM_ID=R;exports.DocumentPreview=ie;exports.DocumentPreviewCacheProvider=de;exports.FIT_ZOOM_ID=L;exports.PDFViewer=X;exports.PageThumbnail=fe;exports.PdfPreviewLoader=Y;exports.THUMBNAIL_BATCH_SIZE=$;exports.THUMBNAIL_IMAGE_OPTIONS=W;exports.ZOOM_OPTIONS=V;exports.getStepZoomOptionValue=ee;exports.isPdfFile=te;exports.useDocumentPreview=ae;exports.useDocumentPreviewCache=Q;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { mergeClasses as S, DialEllipsisTooltip as
|
|
3
|
-
import { ZoomMode as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx as e, jsxs as b, Fragment as le } from "react/jsx-runtime";
|
|
2
|
+
import { mergeClasses as S, DialEllipsisTooltip as Y, DialButton as j, ElementSize as B, DialSelect as se, SelectSize as ce, DialCheckbox as ie, DialLoader as ue } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { ZoomMode as J, PDFHighlightViewer as me } from "@epam/pdf-highlighter-kit";
|
|
4
|
+
import { RotationDirection as Be } from "@epam/pdf-highlighter-kit";
|
|
5
|
+
import { useRef as k, useState as Z, useEffect as w, useCallback as D, createContext as de, useContext as fe, useMemo as Q } from "react";
|
|
6
|
+
import { IconChevronDown as pe, IconChevronUp as ve, IconMinus as he, IconPlus as be, IconAlertTriangle as xe } from "@tabler/icons-react";
|
|
7
|
+
const $ = "auto", G = "page-fit", X = [
|
|
8
|
+
{ value: $, label: "Auto" },
|
|
8
9
|
{ value: G, label: "Page Fit" },
|
|
9
10
|
{ value: "0.5", label: "50%" },
|
|
10
11
|
{ value: "0.75", label: "75%" },
|
|
@@ -13,99 +14,106 @@ const H = "auto", G = "page-fit", X = [
|
|
|
13
14
|
{ value: "1.5", label: "150%" },
|
|
14
15
|
{ value: "2", label: "200%" },
|
|
15
16
|
{ value: "3", label: "300%" }
|
|
16
|
-
],
|
|
17
|
+
], ge = {
|
|
17
18
|
maxWidth: 104,
|
|
18
19
|
format: "image/jpeg",
|
|
19
20
|
quality: 0.85
|
|
20
|
-
},
|
|
21
|
+
}, ee = 15, ye = "application/pdf", we = ".pdf", Ne = ({
|
|
21
22
|
pdf: t,
|
|
22
23
|
highlights: a,
|
|
23
|
-
selectedHighlightId:
|
|
24
|
-
autoFocusFirstHighlight:
|
|
25
|
-
selectedPageNumber:
|
|
24
|
+
selectedHighlightId: c,
|
|
25
|
+
autoFocusFirstHighlight: o = !1,
|
|
26
|
+
selectedPageNumber: i,
|
|
26
27
|
zoom: s,
|
|
27
|
-
containerClassName:
|
|
28
|
-
onTotalPagesChange:
|
|
29
|
-
onViewerReady:
|
|
30
|
-
selectedPages:
|
|
28
|
+
containerClassName: h,
|
|
29
|
+
onTotalPagesChange: v,
|
|
30
|
+
onViewerReady: N,
|
|
31
|
+
selectedPages: u,
|
|
32
|
+
viewerOptions: g
|
|
31
33
|
}) => {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}, [
|
|
36
|
-
z.current =
|
|
34
|
+
const m = k(null), n = k(null), [p, I] = Z(!1), [x, _] = Z(!1), O = k(v), z = k(N), R = k(g);
|
|
35
|
+
w(() => {
|
|
36
|
+
O.current = v;
|
|
37
|
+
}, [v]), w(() => {
|
|
38
|
+
z.current = N;
|
|
39
|
+
}, [N]), w(() => {
|
|
40
|
+
R.current = g;
|
|
37
41
|
}, [g]);
|
|
38
|
-
const
|
|
39
|
-
(
|
|
42
|
+
const C = D(
|
|
43
|
+
(r) => n.current?.goToHighlight(r),
|
|
40
44
|
[]
|
|
41
45
|
);
|
|
42
|
-
return
|
|
43
|
-
if (!
|
|
44
|
-
|
|
45
|
-
let
|
|
46
|
+
return w(() => {
|
|
47
|
+
if (!m.current) return;
|
|
48
|
+
I(!1), _(!1), n.current && (n.current.destroy(), n.current = null);
|
|
49
|
+
let r = null, d = !0;
|
|
50
|
+
const f = () => {
|
|
51
|
+
d && _(!0);
|
|
52
|
+
};
|
|
46
53
|
return (async () => {
|
|
47
54
|
try {
|
|
48
|
-
if (
|
|
55
|
+
if (r = new me(), await r.init(m.current, {
|
|
49
56
|
enableTextSelection: !0,
|
|
50
57
|
enableVirtualScrolling: !0,
|
|
51
|
-
bboxOrigin: "top-left"
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
bboxOrigin: "top-left",
|
|
59
|
+
...R.current
|
|
60
|
+
}), !d) {
|
|
61
|
+
r.destroy();
|
|
54
62
|
return;
|
|
55
63
|
}
|
|
56
|
-
if (await
|
|
57
|
-
|
|
64
|
+
if (r.addEventListener("zoomChanged", f), await r.loadPDF(t, { selectedPages: u }), !d) {
|
|
65
|
+
r.destroy();
|
|
58
66
|
return;
|
|
59
67
|
}
|
|
60
|
-
const
|
|
61
|
-
typeof
|
|
62
|
-
} catch (
|
|
63
|
-
if (!
|
|
68
|
+
const P = r.getTotalPages?.();
|
|
69
|
+
typeof P == "number" && P > 0 && O.current?.(P), d && (n.current = r, I(!0));
|
|
70
|
+
} catch (P) {
|
|
71
|
+
if (!d)
|
|
64
72
|
return;
|
|
65
|
-
console.error("Error in initViewer:",
|
|
73
|
+
console.error("Error in initViewer:", P);
|
|
66
74
|
}
|
|
67
75
|
})(), () => {
|
|
68
|
-
|
|
76
|
+
d = !1, r && (r.removeEventListener("zoomChanged", f), r.destroy());
|
|
69
77
|
};
|
|
70
|
-
}, [t,
|
|
71
|
-
!
|
|
72
|
-
}, [
|
|
73
|
-
|
|
74
|
-
}, [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (s === H)
|
|
79
|
-
r.current?.setZoom?.(Y.AUTO);
|
|
78
|
+
}, [t, u]), w(() => {
|
|
79
|
+
!p || !n.current || (n.current.loadHighlights(a), o && a && a[0] && C(a[0].id));
|
|
80
|
+
}, [o, C, a, p]), w(() => {
|
|
81
|
+
p && x && c && C(c);
|
|
82
|
+
}, [C, p, x, c]), w(() => {
|
|
83
|
+
if (!(!p || !s))
|
|
84
|
+
if (s === $)
|
|
85
|
+
n.current?.setZoom?.(J.AUTO);
|
|
80
86
|
else if (s === G)
|
|
81
|
-
|
|
87
|
+
n.current?.setZoom?.(J.PAGE_FIT);
|
|
82
88
|
else {
|
|
83
|
-
const
|
|
84
|
-
!Number.isNaN(
|
|
89
|
+
const r = parseFloat(s);
|
|
90
|
+
!Number.isNaN(r) && r > 0 && n.current?.setZoom?.(r);
|
|
85
91
|
}
|
|
86
|
-
}, [
|
|
87
|
-
|
|
88
|
-
}, [
|
|
89
|
-
if (!
|
|
90
|
-
const
|
|
92
|
+
}, [p, s]), w(() => {
|
|
93
|
+
p && i && n.current?.setPage?.(i);
|
|
94
|
+
}, [p, i]), w(() => {
|
|
95
|
+
if (!p || !n.current) return;
|
|
96
|
+
const r = n.current;
|
|
91
97
|
z.current?.({
|
|
92
|
-
getThumbnailsDataUrl: (
|
|
93
|
-
zoomIn: () =>
|
|
94
|
-
zoomOut: () =>
|
|
95
|
-
getZoom: () =>
|
|
96
|
-
navigateToPage: (
|
|
98
|
+
getThumbnailsDataUrl: (d, f) => r.getThumbnailsDataUrl(d, f),
|
|
99
|
+
zoomIn: () => r.zoomIn(),
|
|
100
|
+
zoomOut: () => r.zoomOut(),
|
|
101
|
+
getZoom: () => r.getZoom(),
|
|
102
|
+
navigateToPage: (d) => r.setPage?.(d),
|
|
103
|
+
setPageDisplayRotation: (d, f, E) => r.setPageDisplayRotation(d, f, E),
|
|
104
|
+
getPageDisplayRotation: (d) => r.getPageDisplayRotation(d)
|
|
97
105
|
});
|
|
98
|
-
}, [
|
|
106
|
+
}, [p]), /* @__PURE__ */ e(
|
|
99
107
|
"div",
|
|
100
108
|
{
|
|
101
|
-
ref:
|
|
109
|
+
ref: m,
|
|
102
110
|
className: S(
|
|
103
111
|
"grow min-w-0 overflow-auto bg-layer-3",
|
|
104
|
-
|
|
112
|
+
h
|
|
105
113
|
)
|
|
106
114
|
}
|
|
107
115
|
);
|
|
108
|
-
},
|
|
116
|
+
}, T = "h-4 rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave", Ce = ({
|
|
109
117
|
className: t,
|
|
110
118
|
ariaLabel: a = "pdf preview loading"
|
|
111
119
|
}) => /* @__PURE__ */ e(
|
|
@@ -115,33 +123,33 @@ const H = "auto", G = "page-fit", X = [
|
|
|
115
123
|
"aria-label": a,
|
|
116
124
|
"aria-live": "polite",
|
|
117
125
|
className: S("h-full w-full bg-layer-3", t),
|
|
118
|
-
children: /* @__PURE__ */
|
|
126
|
+
children: /* @__PURE__ */ b("div", { className: "flex h-full w-full flex-col gap-10 px-[60px] pt-10", children: [
|
|
119
127
|
/* @__PURE__ */ e("div", { className: "mx-auto h-4 w-[208px] max-w-[40%] rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave" }),
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
/* @__PURE__ */ e("div", { className:
|
|
122
|
-
/* @__PURE__ */ e("div", { className:
|
|
123
|
-
/* @__PURE__ */ e("div", { className:
|
|
124
|
-
/* @__PURE__ */ e("div", { className:
|
|
128
|
+
/* @__PURE__ */ b("div", { className: "flex flex-col gap-4", children: [
|
|
129
|
+
/* @__PURE__ */ e("div", { className: T }),
|
|
130
|
+
/* @__PURE__ */ e("div", { className: T }),
|
|
131
|
+
/* @__PURE__ */ e("div", { className: T }),
|
|
132
|
+
/* @__PURE__ */ e("div", { className: T }),
|
|
125
133
|
/* @__PURE__ */ e(
|
|
126
134
|
"div",
|
|
127
135
|
{
|
|
128
136
|
className: S(
|
|
129
|
-
|
|
137
|
+
T,
|
|
130
138
|
"w-[28%] max-w-[320px]"
|
|
131
139
|
)
|
|
132
140
|
}
|
|
133
141
|
)
|
|
134
142
|
] }),
|
|
135
|
-
/* @__PURE__ */
|
|
136
|
-
/* @__PURE__ */ e("div", { className:
|
|
137
|
-
/* @__PURE__ */ e("div", { className:
|
|
138
|
-
/* @__PURE__ */ e("div", { className:
|
|
139
|
-
/* @__PURE__ */ e("div", { className:
|
|
143
|
+
/* @__PURE__ */ b("div", { className: "flex flex-col gap-4", children: [
|
|
144
|
+
/* @__PURE__ */ e("div", { className: T }),
|
|
145
|
+
/* @__PURE__ */ e("div", { className: T }),
|
|
146
|
+
/* @__PURE__ */ e("div", { className: T }),
|
|
147
|
+
/* @__PURE__ */ e("div", { className: T }),
|
|
140
148
|
/* @__PURE__ */ e(
|
|
141
149
|
"div",
|
|
142
150
|
{
|
|
143
151
|
className: S(
|
|
144
|
-
|
|
152
|
+
T,
|
|
145
153
|
"w-[58%] max-w-[520px]"
|
|
146
154
|
)
|
|
147
155
|
}
|
|
@@ -149,110 +157,110 @@ const H = "auto", G = "page-fit", X = [
|
|
|
149
157
|
] })
|
|
150
158
|
] })
|
|
151
159
|
}
|
|
152
|
-
),
|
|
160
|
+
), re = de(null), Pe = () => fe(re), F = X.filter(({ value: t }) => {
|
|
153
161
|
const a = Number.parseFloat(t);
|
|
154
162
|
return !Number.isNaN(a) && a > 0;
|
|
155
|
-
}), Te = [...
|
|
156
|
-
if (
|
|
163
|
+
}), Te = [...F].reverse(), De = (t, a, c) => {
|
|
164
|
+
if (F.length === 0)
|
|
157
165
|
return t;
|
|
158
|
-
const
|
|
159
|
-
return a === 1 ? (
|
|
160
|
-
({ value:
|
|
161
|
-
) ??
|
|
162
|
-
({ value:
|
|
163
|
-
) ??
|
|
166
|
+
const o = Number.parseFloat(t), i = !Number.isNaN(o) && o > 0 ? o : c, s = typeof i == "number" && i > 0 ? i : Number.parseFloat(F[0].value);
|
|
167
|
+
return a === 1 ? (F.find(
|
|
168
|
+
({ value: h }) => Number.parseFloat(h) > s
|
|
169
|
+
) ?? F[F.length - 1]).value : (Te.find(
|
|
170
|
+
({ value: h }) => Number.parseFloat(h) < s
|
|
171
|
+
) ?? F[0]).value;
|
|
164
172
|
};
|
|
165
|
-
function
|
|
166
|
-
const
|
|
167
|
-
return (a ?? "").toLowerCase() ===
|
|
173
|
+
function Ie(t, a) {
|
|
174
|
+
const c = (t ?? "").toLowerCase();
|
|
175
|
+
return (a ?? "").toLowerCase() === ye || c.endsWith(we);
|
|
168
176
|
}
|
|
169
|
-
const
|
|
177
|
+
const te = X.map((t) => ({
|
|
170
178
|
value: t.value,
|
|
171
179
|
label: t.label
|
|
172
|
-
})),
|
|
180
|
+
})), _e = ({
|
|
173
181
|
fileUrl: t,
|
|
174
182
|
fileName: a,
|
|
175
|
-
loadFileCb:
|
|
176
|
-
highlights:
|
|
177
|
-
selectedPageNumber:
|
|
183
|
+
loadFileCb: c,
|
|
184
|
+
highlights: o,
|
|
185
|
+
selectedPageNumber: i,
|
|
178
186
|
onTotalPagesChange: s,
|
|
179
|
-
thumbnailPageNumbers:
|
|
180
|
-
onThumbnailsLoaded:
|
|
181
|
-
onViewerReady:
|
|
182
|
-
showLoaderOverlay:
|
|
183
|
-
selectedPages:
|
|
187
|
+
thumbnailPageNumbers: h,
|
|
188
|
+
onThumbnailsLoaded: v,
|
|
189
|
+
onViewerReady: N,
|
|
190
|
+
showLoaderOverlay: u = !1,
|
|
191
|
+
selectedPages: g
|
|
184
192
|
}) => {
|
|
185
|
-
const
|
|
186
|
-
let
|
|
193
|
+
const m = Pe(), n = k(null), [p, I] = Z(!1), [x, _] = Z(0), [O, z] = Z(!1), [R, C] = Z(null), [r, d] = Z(null), [f, E] = Z($), P = Q(() => {
|
|
194
|
+
let l = a || t;
|
|
187
195
|
if (!a)
|
|
188
196
|
try {
|
|
189
|
-
|
|
197
|
+
l = new URL(t).pathname;
|
|
190
198
|
} catch {
|
|
191
|
-
|
|
199
|
+
l = t.split("?")[0].split("#")[0];
|
|
192
200
|
}
|
|
193
|
-
return
|
|
194
|
-
}, [a, t]),
|
|
195
|
-
(
|
|
196
|
-
|
|
197
|
-
(
|
|
201
|
+
return Ie(l.toLowerCase());
|
|
202
|
+
}, [a, t]), H = D(
|
|
203
|
+
(l) => {
|
|
204
|
+
_(
|
|
205
|
+
(x + l + o.length) % o.length
|
|
198
206
|
);
|
|
199
207
|
},
|
|
200
|
-
[
|
|
201
|
-
),
|
|
202
|
-
(
|
|
203
|
-
const
|
|
204
|
-
!
|
|
208
|
+
[x, o.length]
|
|
209
|
+
), U = D(
|
|
210
|
+
(l) => {
|
|
211
|
+
const y = n.current;
|
|
212
|
+
!y?.getZoom || !l || E(De(f, l, y.getZoom()));
|
|
205
213
|
},
|
|
206
|
-
[
|
|
207
|
-
),
|
|
208
|
-
if (!(
|
|
209
|
-
const
|
|
210
|
-
if (!Number.isNaN(
|
|
214
|
+
[f]
|
|
215
|
+
), A = Q(() => {
|
|
216
|
+
if (!(f === $ || f === G || X.some((y) => y.value === f))) {
|
|
217
|
+
const y = parseFloat(f);
|
|
218
|
+
if (!Number.isNaN(y) && y > 0)
|
|
211
219
|
return [
|
|
212
|
-
...
|
|
213
|
-
{ value:
|
|
220
|
+
...te,
|
|
221
|
+
{ value: f, label: `${Math.round(y * 100)}%` }
|
|
214
222
|
];
|
|
215
223
|
}
|
|
216
|
-
return
|
|
217
|
-
}, [
|
|
218
|
-
|
|
219
|
-
let
|
|
220
|
-
if (
|
|
221
|
-
|
|
224
|
+
return te;
|
|
225
|
+
}, [f]);
|
|
226
|
+
w(() => {
|
|
227
|
+
let l = !1;
|
|
228
|
+
if (C(!0), z(!1), d(null), I(!1), n.current = null, !P) {
|
|
229
|
+
z(!0), C(!1);
|
|
222
230
|
return;
|
|
223
231
|
}
|
|
224
232
|
return (async () => {
|
|
225
233
|
try {
|
|
226
|
-
const L = await (
|
|
227
|
-
|
|
234
|
+
const L = await (m ? m.getFile(t, () => c(t)) : c(t));
|
|
235
|
+
l || d(L);
|
|
228
236
|
} catch {
|
|
229
|
-
|
|
237
|
+
l || (z(!0), d(null));
|
|
230
238
|
} finally {
|
|
231
|
-
|
|
239
|
+
l || C(!1);
|
|
232
240
|
}
|
|
233
241
|
})(), () => {
|
|
234
|
-
|
|
242
|
+
l = !0;
|
|
235
243
|
};
|
|
236
|
-
}, [t,
|
|
237
|
-
const
|
|
238
|
-
(
|
|
239
|
-
|
|
244
|
+
}, [t, m, c, P]);
|
|
245
|
+
const M = D(
|
|
246
|
+
(l) => {
|
|
247
|
+
n.current = l, I(!0), N?.(l);
|
|
240
248
|
},
|
|
241
|
-
[
|
|
249
|
+
[N]
|
|
242
250
|
);
|
|
243
|
-
return
|
|
244
|
-
const
|
|
245
|
-
if (!
|
|
251
|
+
return w(() => {
|
|
252
|
+
const l = h ?? [], y = n.current?.getThumbnailsDataUrl;
|
|
253
|
+
if (!l.length || !y || !r || !v || !p)
|
|
246
254
|
return;
|
|
247
255
|
let L = !1;
|
|
248
256
|
return (async () => {
|
|
249
|
-
const
|
|
250
|
-
for (let V = 0; V <
|
|
251
|
-
const
|
|
257
|
+
const K = /* @__PURE__ */ new Map();
|
|
258
|
+
for (let V = 0; V < l.length && !L; V += ee) {
|
|
259
|
+
const ae = l.slice(V, V + ee);
|
|
252
260
|
try {
|
|
253
|
-
const W = await
|
|
261
|
+
const W = await y(ae, ge);
|
|
254
262
|
if (L) break;
|
|
255
|
-
W.forEach((
|
|
263
|
+
W.forEach((ne, oe) => K.set(oe, ne)), v(new Map(K));
|
|
256
264
|
} catch (W) {
|
|
257
265
|
console.warn("Thumbnail batch load failed:", W);
|
|
258
266
|
break;
|
|
@@ -261,104 +269,106 @@ const ee = X.map((t) => ({
|
|
|
261
269
|
})(), () => {
|
|
262
270
|
L = !0;
|
|
263
271
|
};
|
|
264
|
-
}, [
|
|
265
|
-
file:
|
|
266
|
-
isLoading:
|
|
267
|
-
isError:
|
|
268
|
-
isSupportedFile:
|
|
269
|
-
activeHighlightIndex:
|
|
270
|
-
zoom:
|
|
271
|
-
setZoom:
|
|
272
|
-
zoomSelectOptions:
|
|
273
|
-
viewerApiRef:
|
|
274
|
-
showLoader: !
|
|
275
|
-
changeIndex:
|
|
276
|
-
handleZoomChange:
|
|
277
|
-
handleViewerReady:
|
|
272
|
+
}, [h, r, v, p]), {
|
|
273
|
+
file: r,
|
|
274
|
+
isLoading: R,
|
|
275
|
+
isError: O,
|
|
276
|
+
isSupportedFile: P,
|
|
277
|
+
activeHighlightIndex: x,
|
|
278
|
+
zoom: f,
|
|
279
|
+
setZoom: E,
|
|
280
|
+
zoomSelectOptions: A,
|
|
281
|
+
viewerApiRef: n,
|
|
282
|
+
showLoader: !O && (!!R || u),
|
|
283
|
+
changeIndex: H,
|
|
284
|
+
handleZoomChange: U,
|
|
285
|
+
handleViewerReady: M
|
|
278
286
|
};
|
|
279
|
-
},
|
|
287
|
+
}, Le = ({
|
|
280
288
|
fileUrl: t,
|
|
281
289
|
fileName: a,
|
|
282
|
-
errorLabel:
|
|
283
|
-
occurrencesLabel:
|
|
284
|
-
unsupportedLabel:
|
|
290
|
+
errorLabel: c,
|
|
291
|
+
occurrencesLabel: o,
|
|
292
|
+
unsupportedLabel: i,
|
|
285
293
|
highlights: s,
|
|
286
|
-
loadFileCb:
|
|
287
|
-
showOccurrences:
|
|
288
|
-
selectedPageNumber:
|
|
289
|
-
containerClassName:
|
|
290
|
-
pdfViewerClassName:
|
|
291
|
-
onTotalPagesChange:
|
|
292
|
-
title:
|
|
293
|
-
thumbnailPageNumbers:
|
|
294
|
-
onThumbnailsLoaded:
|
|
295
|
-
onViewerReady:
|
|
296
|
-
showLoaderOverlay:
|
|
297
|
-
selectedPages:
|
|
294
|
+
loadFileCb: h,
|
|
295
|
+
showOccurrences: v = !0,
|
|
296
|
+
selectedPageNumber: N,
|
|
297
|
+
containerClassName: u,
|
|
298
|
+
pdfViewerClassName: g,
|
|
299
|
+
onTotalPagesChange: m,
|
|
300
|
+
title: n,
|
|
301
|
+
thumbnailPageNumbers: p,
|
|
302
|
+
onThumbnailsLoaded: I,
|
|
303
|
+
onViewerReady: x,
|
|
304
|
+
showLoaderOverlay: _ = !1,
|
|
305
|
+
selectedPages: O,
|
|
306
|
+
selectedHighlightId: z,
|
|
307
|
+
viewerOptions: R
|
|
298
308
|
}) => {
|
|
299
309
|
const {
|
|
300
|
-
file:
|
|
301
|
-
isError:
|
|
302
|
-
isSupportedFile:
|
|
303
|
-
activeHighlightIndex:
|
|
304
|
-
zoom:
|
|
305
|
-
setZoom:
|
|
306
|
-
zoomSelectOptions:
|
|
307
|
-
showLoader:
|
|
308
|
-
changeIndex:
|
|
309
|
-
handleZoomChange:
|
|
310
|
-
handleViewerReady:
|
|
311
|
-
} =
|
|
310
|
+
file: C,
|
|
311
|
+
isError: r,
|
|
312
|
+
isSupportedFile: d,
|
|
313
|
+
activeHighlightIndex: f,
|
|
314
|
+
zoom: E,
|
|
315
|
+
setZoom: P,
|
|
316
|
+
zoomSelectOptions: H,
|
|
317
|
+
showLoader: U,
|
|
318
|
+
changeIndex: A,
|
|
319
|
+
handleZoomChange: M,
|
|
320
|
+
handleViewerReady: q
|
|
321
|
+
} = _e({
|
|
312
322
|
fileUrl: t,
|
|
313
323
|
fileName: a,
|
|
314
|
-
loadFileCb:
|
|
324
|
+
loadFileCb: h,
|
|
315
325
|
highlights: s,
|
|
316
|
-
selectedPageNumber:
|
|
317
|
-
onTotalPagesChange:
|
|
318
|
-
thumbnailPageNumbers:
|
|
319
|
-
onThumbnailsLoaded:
|
|
320
|
-
onViewerReady:
|
|
321
|
-
showLoaderOverlay:
|
|
322
|
-
selectedPages:
|
|
326
|
+
selectedPageNumber: N,
|
|
327
|
+
onTotalPagesChange: m,
|
|
328
|
+
thumbnailPageNumbers: p,
|
|
329
|
+
onThumbnailsLoaded: I,
|
|
330
|
+
onViewerReady: x,
|
|
331
|
+
showLoaderOverlay: _,
|
|
332
|
+
selectedPages: O
|
|
323
333
|
});
|
|
324
|
-
return /* @__PURE__ */
|
|
334
|
+
return /* @__PURE__ */ b(
|
|
325
335
|
"div",
|
|
326
336
|
{
|
|
327
337
|
className: S(
|
|
328
338
|
"flex flex-col self-center gap-4 py-3 px-6 h-full w-full bg-layer-2",
|
|
329
|
-
|
|
339
|
+
u
|
|
330
340
|
),
|
|
331
341
|
children: [
|
|
332
342
|
a && /* @__PURE__ */ e("div", { className: "shrink-0 min-h-0 w-full", children: /* @__PURE__ */ e(
|
|
333
|
-
|
|
343
|
+
Y,
|
|
334
344
|
{
|
|
335
345
|
className: "dial-tiny-text text-secondary",
|
|
336
346
|
text: a
|
|
337
347
|
}
|
|
338
348
|
) }),
|
|
339
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ b(
|
|
340
350
|
"div",
|
|
341
351
|
{
|
|
342
352
|
className: S(
|
|
343
353
|
"flex w-full justify-between items-center",
|
|
344
|
-
|
|
354
|
+
v && n ? "gap-2" : ""
|
|
345
355
|
),
|
|
346
356
|
children: [
|
|
347
|
-
/* @__PURE__ */ e("div", { children:
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
-
|
|
357
|
+
/* @__PURE__ */ e("div", { children: v ? /* @__PURE__ */ b("div", { className: "flex gap-1 py-0.5 px-1.5 min-h-[26px] items-center bg-layer-4 rounded w-fit", children: [
|
|
358
|
+
/* @__PURE__ */ b("span", { className: "dial-small-text", children: [
|
|
359
|
+
o ?? "Occurrences",
|
|
350
360
|
":",
|
|
351
|
-
/* @__PURE__ */ e("span", { className: "pl-0.5 min-w-3 inline-block text-right", children: s.length > 0 ? `${
|
|
361
|
+
/* @__PURE__ */ e("span", { className: "pl-0.5 min-w-3 inline-block text-right", children: s.length > 0 ? `${f + 1}/${s.length}` : "0" })
|
|
352
362
|
] }),
|
|
353
|
-
s.length > 0 && /* @__PURE__ */
|
|
363
|
+
s.length > 0 && /* @__PURE__ */ b(le, { children: [
|
|
354
364
|
/* @__PURE__ */ e(
|
|
355
365
|
j,
|
|
356
366
|
{
|
|
357
367
|
className: "p-0 text-primary !h-6.5",
|
|
358
368
|
size: B.Small,
|
|
359
|
-
iconAfter: /* @__PURE__ */ e(
|
|
369
|
+
iconAfter: /* @__PURE__ */ e(pe, { size: 16 }),
|
|
360
370
|
"aria-label": "Next occurrence",
|
|
361
|
-
onClick: () =>
|
|
371
|
+
onClick: () => A(1)
|
|
362
372
|
}
|
|
363
373
|
),
|
|
364
374
|
/* @__PURE__ */ e(
|
|
@@ -366,47 +376,47 @@ const ee = X.map((t) => ({
|
|
|
366
376
|
{
|
|
367
377
|
className: "p-0 text-primary !h-6.5",
|
|
368
378
|
size: B.Small,
|
|
369
|
-
iconAfter: /* @__PURE__ */ e(
|
|
379
|
+
iconAfter: /* @__PURE__ */ e(ve, { size: 16 }),
|
|
370
380
|
"aria-label": "Previous occurrence",
|
|
371
|
-
onClick: () =>
|
|
381
|
+
onClick: () => A(-1)
|
|
372
382
|
}
|
|
373
383
|
)
|
|
374
384
|
] })
|
|
375
385
|
] }) : /* @__PURE__ */ e("div", {}) }),
|
|
376
|
-
/* @__PURE__ */
|
|
386
|
+
/* @__PURE__ */ b(
|
|
377
387
|
"div",
|
|
378
388
|
{
|
|
379
389
|
className: S(
|
|
380
390
|
"flex flex-1 items-center gap-4 min-w-0",
|
|
381
|
-
|
|
391
|
+
n != null && n !== "" ? "justify-between" : "justify-end"
|
|
382
392
|
),
|
|
383
393
|
children: [
|
|
384
|
-
|
|
385
|
-
|
|
394
|
+
n != null && n !== "" && /* @__PURE__ */ e(
|
|
395
|
+
Y,
|
|
386
396
|
{
|
|
387
|
-
text:
|
|
397
|
+
text: n,
|
|
388
398
|
className: "dial-body-semi-text text-primary min-w-0"
|
|
389
399
|
}
|
|
390
400
|
),
|
|
391
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ b("div", { className: "flex gap-0.5 items-center shrink-0", children: [
|
|
392
402
|
/* @__PURE__ */ e("div", { className: "h-6", children: /* @__PURE__ */ e(
|
|
393
|
-
|
|
403
|
+
se,
|
|
394
404
|
{
|
|
395
|
-
size:
|
|
405
|
+
size: ce.Sm,
|
|
396
406
|
className: "bg-layer-4 !py-0 h-6 min-h-6 dial-small-text max-h-full border-transparent hover:border-hover rounded",
|
|
397
|
-
options:
|
|
398
|
-
value:
|
|
399
|
-
onChange: (
|
|
407
|
+
options: H,
|
|
408
|
+
value: E,
|
|
409
|
+
onChange: (l) => P(l)
|
|
400
410
|
}
|
|
401
411
|
) }),
|
|
402
412
|
/* @__PURE__ */ e(
|
|
403
413
|
j,
|
|
404
414
|
{
|
|
405
415
|
className: "py-0 flex items-center justify-center rounded text-primary bg-layer-4 border border-transparent hover:border-hover",
|
|
406
|
-
iconAfter: /* @__PURE__ */ e(
|
|
416
|
+
iconAfter: /* @__PURE__ */ e(he, { size: 16 }),
|
|
407
417
|
"aria-label": "Zoom out",
|
|
408
418
|
size: B.Small,
|
|
409
|
-
onClick: () =>
|
|
419
|
+
onClick: () => M(-1)
|
|
410
420
|
}
|
|
411
421
|
),
|
|
412
422
|
/* @__PURE__ */ e(
|
|
@@ -416,7 +426,7 @@ const ee = X.map((t) => ({
|
|
|
416
426
|
iconAfter: /* @__PURE__ */ e(be, { size: 16 }),
|
|
417
427
|
"aria-label": "Zoom in",
|
|
418
428
|
size: B.Small,
|
|
419
|
-
onClick: () =>
|
|
429
|
+
onClick: () => M(1)
|
|
420
430
|
}
|
|
421
431
|
)
|
|
422
432
|
] })
|
|
@@ -426,100 +436,101 @@ const ee = X.map((t) => ({
|
|
|
426
436
|
]
|
|
427
437
|
}
|
|
428
438
|
),
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
|
|
431
|
-
|
|
439
|
+
/* @__PURE__ */ b("div", { className: "relative flex min-h-0 flex-1", children: [
|
|
440
|
+
C && /* @__PURE__ */ e(
|
|
441
|
+
Ne,
|
|
432
442
|
{
|
|
433
|
-
pdf:
|
|
443
|
+
pdf: C,
|
|
434
444
|
highlights: s,
|
|
435
|
-
selectedHighlightId:
|
|
436
|
-
selectedPageNumber:
|
|
437
|
-
zoom:
|
|
438
|
-
onTotalPagesChange:
|
|
439
|
-
onViewerReady:
|
|
440
|
-
containerClassName:
|
|
441
|
-
selectedPages:
|
|
445
|
+
selectedHighlightId: v ? s[f]?.id : z,
|
|
446
|
+
selectedPageNumber: N,
|
|
447
|
+
zoom: E,
|
|
448
|
+
onTotalPagesChange: m,
|
|
449
|
+
onViewerReady: q,
|
|
450
|
+
containerClassName: g,
|
|
451
|
+
selectedPages: O,
|
|
452
|
+
viewerOptions: R
|
|
442
453
|
}
|
|
443
454
|
),
|
|
444
|
-
|
|
445
|
-
|
|
455
|
+
U && /* @__PURE__ */ e(Ce, { className: "absolute inset-0 z-10" }),
|
|
456
|
+
r && /* @__PURE__ */ e("div", { className: "absolute inset-0 z-20 flex items-center justify-center bg-layer-3", children: /* @__PURE__ */ b("div", { className: "flex flex-col items-center gap-6 p-10", children: [
|
|
446
457
|
/* @__PURE__ */ e(
|
|
447
|
-
|
|
458
|
+
xe,
|
|
448
459
|
{
|
|
449
460
|
size: 60,
|
|
450
461
|
stroke: 2,
|
|
451
462
|
className: "text-secondary"
|
|
452
463
|
}
|
|
453
464
|
),
|
|
454
|
-
/* @__PURE__ */ e("div", { className: "text-center dial-small-text whitespace-pre-wrap", children: !
|
|
465
|
+
/* @__PURE__ */ e("div", { className: "text-center dial-small-text whitespace-pre-wrap", children: !d && i ? i : c ?? "Failed to load document." })
|
|
455
466
|
] }) })
|
|
456
467
|
] })
|
|
457
468
|
]
|
|
458
469
|
}
|
|
459
470
|
);
|
|
460
|
-
},
|
|
471
|
+
}, Oe = 1200 * 1e3, ze = 20, Ae = ({
|
|
461
472
|
children: t,
|
|
462
|
-
ttlMs: a =
|
|
463
|
-
maxEntries:
|
|
473
|
+
ttlMs: a = Oe,
|
|
474
|
+
maxEntries: c = ze
|
|
464
475
|
}) => {
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
}, []), s =
|
|
468
|
-
const
|
|
469
|
-
for (const [
|
|
470
|
-
|
|
471
|
-
}, [a]),
|
|
472
|
-
for (;
|
|
473
|
-
const
|
|
474
|
-
|
|
476
|
+
const o = k(/* @__PURE__ */ new Map()), i = D((u, g) => {
|
|
477
|
+
o.current.delete(u), o.current.set(u, g);
|
|
478
|
+
}, []), s = D(() => {
|
|
479
|
+
const u = Date.now();
|
|
480
|
+
for (const [g, m] of o.current.entries())
|
|
481
|
+
m.file && u - m.timestamp > a && o.current.delete(g);
|
|
482
|
+
}, [a]), h = D(() => {
|
|
483
|
+
for (; o.current.size > c; ) {
|
|
484
|
+
const u = o.current.keys().next().value;
|
|
485
|
+
u && o.current.delete(u);
|
|
475
486
|
}
|
|
476
|
-
}, [
|
|
477
|
-
|
|
478
|
-
}, []),
|
|
479
|
-
async (
|
|
487
|
+
}, [c]), v = D(() => {
|
|
488
|
+
o.current.clear();
|
|
489
|
+
}, []), N = D(
|
|
490
|
+
async (u, g) => {
|
|
480
491
|
s();
|
|
481
|
-
const
|
|
482
|
-
if (
|
|
483
|
-
if (u
|
|
484
|
-
return
|
|
485
|
-
if (
|
|
486
|
-
return
|
|
492
|
+
const m = o.current.get(u);
|
|
493
|
+
if (m) {
|
|
494
|
+
if (i(u, { ...m, timestamp: Date.now() }), m.file)
|
|
495
|
+
return m.file;
|
|
496
|
+
if (m.promise)
|
|
497
|
+
return m.promise;
|
|
487
498
|
}
|
|
488
|
-
const
|
|
489
|
-
const
|
|
490
|
-
return u
|
|
491
|
-
}).catch((
|
|
492
|
-
throw
|
|
499
|
+
const n = Date.now(), p = g().then((x) => {
|
|
500
|
+
const _ = { file: x, timestamp: Date.now() };
|
|
501
|
+
return i(u, _), h(), x;
|
|
502
|
+
}).catch((x) => {
|
|
503
|
+
throw o.current.delete(u), x;
|
|
493
504
|
});
|
|
494
|
-
return u
|
|
505
|
+
return i(u, { promise: p, timestamp: n }), h(), p;
|
|
495
506
|
},
|
|
496
|
-
[
|
|
507
|
+
[h, s, i]
|
|
497
508
|
);
|
|
498
|
-
return
|
|
499
|
-
},
|
|
509
|
+
return w(() => () => v(), [v]), /* @__PURE__ */ e(re.Provider, { value: { getFile: N, clearCache: v }, children: t });
|
|
510
|
+
}, Me = ({
|
|
500
511
|
pageNum: t,
|
|
501
512
|
onSelectPage: a,
|
|
502
|
-
isSelected:
|
|
503
|
-
isLoading:
|
|
504
|
-
isMultiselect:
|
|
513
|
+
isSelected: c,
|
|
514
|
+
isLoading: o,
|
|
515
|
+
isMultiselect: i,
|
|
505
516
|
thumbnailUrl: s,
|
|
506
|
-
className:
|
|
507
|
-
}) => /* @__PURE__ */
|
|
517
|
+
className: h
|
|
518
|
+
}) => /* @__PURE__ */ b(
|
|
508
519
|
"button",
|
|
509
520
|
{
|
|
510
521
|
type: "button",
|
|
511
522
|
"aria-label": `Page ${t}`,
|
|
512
|
-
"aria-pressed":
|
|
513
|
-
onClick: (
|
|
514
|
-
|
|
523
|
+
"aria-pressed": c,
|
|
524
|
+
onClick: (v) => {
|
|
525
|
+
i && v.target.closest("[data-checkbox-wrapper]") || a(t);
|
|
515
526
|
},
|
|
516
527
|
className: S(
|
|
517
528
|
"flex flex-col gap-2 p-2 h-[186px] w-[120px] items-center justify-center cursor-pointer transition-colors hover:bg-layer-4 rounded-sm",
|
|
518
|
-
|
|
519
|
-
|
|
529
|
+
c && (i ? "border border-accent-primary bg-accent-primary-alpha" : "border border-primary"),
|
|
530
|
+
h
|
|
520
531
|
),
|
|
521
532
|
children: [
|
|
522
|
-
/* @__PURE__ */
|
|
533
|
+
/* @__PURE__ */ b("div", { className: "relative w-[104px] h-[146px] bg-model-icon rounded-sm overflow-hidden", children: [
|
|
523
534
|
s ? /* @__PURE__ */ e(
|
|
524
535
|
"img",
|
|
525
536
|
{
|
|
@@ -528,17 +539,17 @@ const ee = X.map((t) => ({
|
|
|
528
539
|
className: "w-full h-full object-cover rounded-sm"
|
|
529
540
|
}
|
|
530
541
|
) : null,
|
|
531
|
-
|
|
532
|
-
|
|
542
|
+
i && /* @__PURE__ */ e("div", { className: "absolute left-1 top-1 z-10", "data-checkbox-wrapper": !0, children: /* @__PURE__ */ e(
|
|
543
|
+
ie,
|
|
533
544
|
{
|
|
534
545
|
id: `page-thumbnail-${t}`,
|
|
535
|
-
checked:
|
|
546
|
+
checked: c,
|
|
536
547
|
onChange: () => a(t),
|
|
537
548
|
className: "before:border-primary before:bg-model-icon bg-model-icon"
|
|
538
549
|
}
|
|
539
550
|
) }),
|
|
540
|
-
|
|
541
|
-
|
|
551
|
+
o && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-blackout rounded-sm", children: /* @__PURE__ */ e(
|
|
552
|
+
ue,
|
|
542
553
|
{
|
|
543
554
|
size: 24,
|
|
544
555
|
fullWidth: !1,
|
|
@@ -551,18 +562,19 @@ const ee = X.map((t) => ({
|
|
|
551
562
|
}
|
|
552
563
|
);
|
|
553
564
|
export {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
565
|
+
$ as AUTO_ZOOM_ID,
|
|
566
|
+
Le as DocumentPreview,
|
|
567
|
+
Ae as DocumentPreviewCacheProvider,
|
|
557
568
|
G as FIT_ZOOM_ID,
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
569
|
+
Ne as PDFViewer,
|
|
570
|
+
Me as PageThumbnail,
|
|
571
|
+
Ce as PdfPreviewLoader,
|
|
572
|
+
Be as RotationDirection,
|
|
573
|
+
ee as THUMBNAIL_BATCH_SIZE,
|
|
574
|
+
ge as THUMBNAIL_IMAGE_OPTIONS,
|
|
563
575
|
X as ZOOM_OPTIONS,
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
576
|
+
De as getStepZoomOptionValue,
|
|
577
|
+
Ie as isPdfFile,
|
|
578
|
+
_e as useDocumentPreview,
|
|
579
|
+
Pe as useDocumentPreviewCache
|
|
568
580
|
};
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.visible{visibility:visible}.static{position:static}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.left-1{left:.25rem}.top-1{top:.25rem}.z-10{z-index:10}.z-20{z-index:20}.mx-auto{margin-left:auto;margin-right:auto}.inline-block{display:inline-block}.flex{display:flex}.hidden{display:none}.h-4{height:1rem}.h-6{height:1.5rem}.h-\[146px\]{height:146px}.h-\[186px\]{height:186px}.h-\[600px\]{height:600px}.h-\[700px\]{height:700px}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-6{min-height:1.5rem}.min-h-\[26px\]{min-height:26px}.w-\[104px\]{width:104px}.w-\[120px\]{width:120px}.w-\[208px\]{width:208px}.w-\[28\%\]{width:28%}.w-\[500px\]{width:500px}.w-\[58\%\]{width:58%}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.min-w-0{min-width:0}.min-w-3{min-width:.75rem}.max-w-\[320px\]{max-width:320px}.max-w-\[40\%\]{max-width:40%}.max-w-\[520px\]{max-width:520px}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}@keyframes skeleton-wave{0%{background-position:200% 0}to{background-position:-200% 0}}.animate-skeleton-wave{animation:skeleton-wave 3.5s ease-in-out infinite}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.self-center{align-self:center}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:4px}.rounded-\[120px\]{border-radius:120px}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-accent-primary{border-color:var(--stroke-accent-primary,#7da4ff)}.border-primary{border-color:var(--stroke-primary,#696e7c)}.border-transparent{border-color:transparent}.bg-accent-primary-alpha{background-color:var(--bg-accent-primary-alpha,#7da4ff26)}.bg-blackout{background-color:var(--bg-blackout,#0c101db3)}.bg-layer-1{background-color:var(--bg-layer-1,#0c101d)}.bg-layer-2{background-color:var(--bg-layer-2,#161b2d)}.bg-layer-3{background-color:var(--bg-layer-3,#1d2439)}.bg-layer-4{background-color:var(--bg-layer-4,#242c42)}.bg-model-icon{background-color:var(--bg-model-icon,#fff)}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-layer-4{--tw-gradient-from:var(--bg-layer-4,#242c42) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.via-layer-3{--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--bg-layer-3,#1d2439) var(--tw-gradient-via-position),var(--tw-gradient-to)}.to-layer-4{--tw-gradient-to:var(--bg-layer-4,#242c42) var(--tw-gradient-to-position)}.bg-\[length\:200\%_100\%\]{background-size:200% 100%}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-4{padding:1rem}.\!py-0{padding-top:0!important;padding-bottom:0!important}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-\[60px\]{padding-left:60px;padding-right:60px}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pl-0\.5{padding-left:.125rem}.pt-10{padding-top:2.5rem}.text-center{text-align:center}.text-right{text-align:right}.text-xs{font-size:.75rem;line-height:1rem}.text-primary{color:var(--text-primary,#eef1f7)}.text-secondary{color:var(--text-secondary,#9fa6bd)}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.before\:border-primary:before{content:var(--tw-content);border-color:var(--stroke-primary,#696e7c)}.before\:bg-model-icon:before{content:var(--tw-content);background-color:var(--bg-model-icon,#fff)}.hover\:border-hover:hover{border-color:var(--stroke-hover,#eef1f7)}.hover\:bg-layer-4:hover{background-color:var(--bg-layer-4,#242c42)}
|
|
1
|
+
*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.visible{visibility:visible}.static{position:static}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.left-1{left:.25rem}.top-1{top:.25rem}.z-10{z-index:10}.z-20{z-index:20}.mx-auto{margin-left:auto;margin-right:auto}.inline-block{display:inline-block}.flex{display:flex}.table{display:table}.hidden{display:none}.h-4{height:1rem}.h-6{height:1.5rem}.h-\[146px\]{height:146px}.h-\[186px\]{height:186px}.h-\[600px\]{height:600px}.h-\[700px\]{height:700px}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-6{min-height:1.5rem}.min-h-\[26px\]{min-height:26px}.w-64{width:16rem}.w-\[104px\]{width:104px}.w-\[120px\]{width:120px}.w-\[208px\]{width:208px}.w-\[28\%\]{width:28%}.w-\[500px\]{width:500px}.w-\[58\%\]{width:58%}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.min-w-0{min-width:0}.min-w-3{min-width:.75rem}.max-w-\[320px\]{max-width:320px}.max-w-\[40\%\]{max-width:40%}.max-w-\[520px\]{max-width:520px}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}@keyframes skeleton-wave{0%{background-position:200% 0}to{background-position:-200% 0}}.animate-skeleton-wave{animation:skeleton-wave 3.5s ease-in-out infinite}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.\!justify-start{justify-content:flex-start!important}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.self-center{align-self:center}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:4px}.rounded-\[120px\]{border-radius:120px}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-r{border-right-width:1px}.border-accent-primary{border-color:var(--stroke-accent-primary,#7da4ff)}.border-primary{border-color:var(--stroke-primary,#696e7c)}.border-transparent{border-color:transparent}.bg-accent-primary-alpha{background-color:var(--bg-accent-primary-alpha,#7da4ff26)}.bg-blackout{background-color:var(--bg-blackout,#0c101db3)}.bg-layer-1{background-color:var(--bg-layer-1,#0c101d)}.bg-layer-2{background-color:var(--bg-layer-2,#161b2d)}.bg-layer-3{background-color:var(--bg-layer-3,#1d2439)}.bg-layer-4{background-color:var(--bg-layer-4,#242c42)}.bg-model-icon{background-color:var(--bg-model-icon,#fff)}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-layer-4{--tw-gradient-from:var(--bg-layer-4,#242c42) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.via-layer-3{--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--bg-layer-3,#1d2439) var(--tw-gradient-via-position),var(--tw-gradient-to)}.to-layer-4{--tw-gradient-to:var(--bg-layer-4,#242c42) var(--tw-gradient-to-position)}.bg-\[length\:200\%_100\%\]{background-size:200% 100%}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-4{padding:1rem}.\!py-0{padding-top:0!important;padding-bottom:0!important}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-\[60px\]{padding-left:60px;padding-right:60px}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pl-0\.5{padding-left:.125rem}.pt-10{padding-top:2.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-xs{font-size:.75rem;line-height:1rem}.uppercase{text-transform:uppercase}.tracking-wide{letter-spacing:.025em}.text-accent-primary{color:var(--text-accent-primary,#7da4ff)}.text-primary{color:var(--text-primary,#eef1f7)}.text-secondary{color:var(--text-secondary,#9fa6bd)}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.before\:border-primary:before{content:var(--tw-content);border-color:var(--stroke-primary,#696e7c)}.before\:bg-model-icon:before{content:var(--tw-content);background-color:var(--bg-model-icon,#fff)}.hover\:border-hover:hover{border-color:var(--stroke-hover,#eef1f7)}.hover\:bg-layer-4:hover{background-color:var(--bg-layer-4,#242c42)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InputHighlightData } from '@epam/pdf-highlighter-kit';
|
|
1
|
+
import { InputHighlightData, ViewerOptions } from '@epam/pdf-highlighter-kit';
|
|
2
2
|
import { FC, ReactNode } from 'react';
|
|
3
3
|
import { PdfViewerApi } from '../../models/pdf-viewer.models';
|
|
4
4
|
/**
|
|
@@ -47,6 +47,18 @@ export interface DocumentPreviewProps {
|
|
|
47
47
|
showLoaderOverlay?: boolean;
|
|
48
48
|
/** Restricts viewer loading to selected pages only. */
|
|
49
49
|
selectedPages?: number[];
|
|
50
|
+
/**
|
|
51
|
+
* Highlight id to navigate to. When `showOccurrences` is true the internal
|
|
52
|
+
* occurrence counter takes precedence; pass this when `showOccurrences` is
|
|
53
|
+
* false to drive navigation externally (e.g. from a results table).
|
|
54
|
+
*/
|
|
55
|
+
selectedHighlightId?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Override or extend low-level viewer initialization options passed to `PDFViewer`.
|
|
58
|
+
* Values are merged on top of the defaults (`enableTextSelection: true`,
|
|
59
|
+
* `enableVirtualScrolling: true`, `bboxOrigin: 'top-left'`).
|
|
60
|
+
*/
|
|
61
|
+
viewerOptions?: ViewerOptions;
|
|
50
62
|
}
|
|
51
63
|
/**
|
|
52
64
|
* High-level PDF preview component with toolbar, highlight navigation, zoom controls,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PDFSource, InputHighlightData } from '@epam/pdf-highlighter-kit';
|
|
1
|
+
import { PDFSource, ViewerOptions, InputHighlightData } from '@epam/pdf-highlighter-kit';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
import { PdfViewerApi } from '../../models/pdf-viewer.models';
|
|
4
4
|
/**
|
|
@@ -25,6 +25,12 @@ export interface PdfViewerProps {
|
|
|
25
25
|
onViewerReady?: (api: PdfViewerApi) => void;
|
|
26
26
|
/** Optional list of pages to load instead of the full document. */
|
|
27
27
|
selectedPages?: number[];
|
|
28
|
+
/**
|
|
29
|
+
* Override or extend low-level viewer initialization options.
|
|
30
|
+
* Values are merged on top of the defaults (`enableTextSelection: true`,
|
|
31
|
+
* `enableVirtualScrolling: true`, `bboxOrigin: 'top-left'`).
|
|
32
|
+
*/
|
|
33
|
+
viewerOptions?: ViewerOptions;
|
|
28
34
|
}
|
|
29
35
|
/**
|
|
30
36
|
* Low-level PDF viewer wrapper around `PDFHighlightViewer`.
|
package/dist/src/index.d.ts
CHANGED
|
@@ -12,5 +12,8 @@ export { PageThumbnail } from './components/PageThumbnail/PageThumbnail';
|
|
|
12
12
|
export type { PageThumbnailProps } from './components/PageThumbnail/PageThumbnail';
|
|
13
13
|
export type { PdfViewerApi } from './models/pdf-viewer.models';
|
|
14
14
|
export type { ZoomOption } from './models/pdf-viewer.models';
|
|
15
|
+
export type { ViewerOptions } from '@epam/pdf-highlighter-kit';
|
|
16
|
+
export { RotationDirection } from '@epam/pdf-highlighter-kit';
|
|
17
|
+
export type { PageRotationDegrees } from '@epam/pdf-highlighter-kit';
|
|
15
18
|
export { AUTO_ZOOM_ID, FIT_ZOOM_ID, THUMBNAIL_BATCH_SIZE, THUMBNAIL_IMAGE_OPTIONS, ZOOM_OPTIONS, } from './constants/pdf-viewer.constants';
|
|
16
19
|
export { getStepZoomOptionValue, isPdfFile } from './utils/pdf-viewer.utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ThumbnailOptions } from '@epam/pdf-highlighter-kit';
|
|
1
|
+
import { PageRotationDegrees, RotationDirection, ThumbnailOptions } from '@epam/pdf-highlighter-kit';
|
|
2
2
|
/**
|
|
3
3
|
* Imperative API exposed by {@link PDFViewer} through the `onViewerReady` callback.
|
|
4
4
|
*/
|
|
@@ -18,6 +18,10 @@ export interface PdfViewerApi {
|
|
|
18
18
|
getZoom: () => number;
|
|
19
19
|
/** Navigates to a specific 1-based page number. */
|
|
20
20
|
navigateToPage: (page: number) => void;
|
|
21
|
+
/** Sets extra clockwise display rotation for a 1-based page (on top of PDF `/Rotate`). */
|
|
22
|
+
setPageDisplayRotation: (pageNumber: number, degrees: PageRotationDegrees, direction?: RotationDirection) => void;
|
|
23
|
+
/** Returns extra clockwise display rotation for a 1-based page. */
|
|
24
|
+
getPageDisplayRotation: (pageNumber: number) => PageRotationDegrees;
|
|
21
25
|
}
|
|
22
26
|
export interface ZoomOption {
|
|
23
27
|
value: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-react-pdf-highlighter",
|
|
3
|
-
"version": "0.2.0-dev.
|
|
3
|
+
"version": "0.2.0-dev.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "React components for PDF viewing and highlighting, built on @epam/pdf-highlighter-kit",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@epam/ai-dial-ui-kit": ">=0.8.0-0 || >=0.9.0-rc.0",
|
|
62
|
-
"@epam/pdf-highlighter-kit": ">=0.0.
|
|
62
|
+
"@epam/pdf-highlighter-kit": ">=0.0.14",
|
|
63
63
|
"@tabler/icons-react": "^3.0.0",
|
|
64
64
|
"pdfjs-dist": ">=4.0.0",
|
|
65
65
|
"react": ">=18",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@chromatic-com/storybook": "^4.1.3",
|
|
80
80
|
"@epam/ai-dial-ui-kit": "0.9.0-rc.20",
|
|
81
|
-
"@epam/pdf-highlighter-kit": "^0.0.
|
|
81
|
+
"@epam/pdf-highlighter-kit": "^0.0.14",
|
|
82
82
|
"@eslint/compat": "^1.3.1",
|
|
83
83
|
"@eslint/eslintrc": "^3.3.1",
|
|
84
84
|
"@eslint/js": "^9.31.0",
|