@epam/ai-dial-react-pdf-highlighter 0.2.0-dev.3 → 0.2.0-dev.30

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.
@@ -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"),L=require("@epam/pdf-highlighter-kit"),t=require("react"),k=require("@tabler/icons-react"),z="auto",A="page-fit",V=[{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%"}],X={maxWidth:104,format:"image/jpeg",quality:.85},$=15,le="application/pdf",oe=".pdf",Y=({pdf:a,highlights:r,selectedHighlightId:u,autoFocusFirstHighlight:l=!1,selectedPageNumber:d,zoom:c,containerClassName:v,onTotalPagesChange:b,onViewerReady:N,selectedPages:m,viewerOptions:y})=>{const f=t.useRef(null),n=t.useRef(null),[h,E]=t.useState(!1),[w,I]=t.useState(!1),T=t.useRef(b),O=t.useRef(N),_=t.useRef(y);t.useEffect(()=>{T.current=b},[b]),t.useEffect(()=>{O.current=N},[N]),t.useEffect(()=>{_.current=y},[y]);const j=t.useCallback(s=>n.current?.goToHighlight(s),[]);return t.useEffect(()=>{if(!f.current)return;E(!1),I(!1),n.current&&(n.current.destroy(),n.current=null);let s=null,x=!0;const p=()=>{x&&I(!0)};return(async()=>{try{if(s=new L.PDFHighlightViewer,await s.init(f.current,{enableTextSelection:!0,enableVirtualScrolling:!0,bboxOrigin:"top-left",..._.current}),!x){s.destroy();return}if(s.addEventListener("zoomChanged",p),await s.loadPDF(a,{selectedPages:m}),!x){s.destroy();return}const C=s.getTotalPages?.();typeof C=="number"&&C>0&&T.current?.(C),x&&(n.current=s,E(!0))}catch(C){if(!x)return;console.error("Error in initViewer:",C)}})(),()=>{x=!1,s&&(s.removeEventListener("zoomChanged",p),s.destroy())}},[a,m]),t.useEffect(()=>{!h||!n.current||(n.current.loadHighlights(r),l&&r&&r[0]&&j(r[0].id))},[l,j,r,h]),t.useEffect(()=>{h&&w&&u&&j(u)},[j,h,w,u]),t.useEffect(()=>{if(!(!h||!c))if(c===z)n.current?.setZoom?.(L.ZoomMode.AUTO);else if(c===A)n.current?.setZoom?.(L.ZoomMode.PAGE_FIT);else{const s=parseFloat(c);!Number.isNaN(s)&&s>0&&n.current?.setZoom?.(s)}},[h,c]),t.useEffect(()=>{h&&d&&n.current?.setPage?.(d)},[h,d]),t.useEffect(()=>{if(!h||!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,S)=>s.setPageDisplayRotation(x,p,S),getPageDisplayRotation:x=>s.getPageDisplayRotation(x)})},[h]),e.jsx("div",{ref:f,className:i.mergeClasses("grow min-w-0 overflow-auto bg-layer-raised",v)})},P="h-4 rounded-[120px] bg-gradient-to-r from-layer-sunken via-layer-raised to-layer-sunken bg-[length:200%_100%] animate-skeleton-wave",J=({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-raised",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-sunken via-layer-raised to-layer-sunken 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]")})]})]})}),Q=t.createContext(null),ee=()=>t.useContext(Q),D=V.filter(({value:a})=>{const r=Number.parseFloat(a);return!Number.isNaN(r)&&r>0}),ce=[...D].reverse(),te=(a,r,u)=>{if(D.length===0)return a;const l=Number.parseFloat(a),d=!Number.isNaN(l)&&l>0?l:u,c=typeof d=="number"&&d>0?d:Number.parseFloat(D[0].value);return r===1?(D.find(({value:v})=>Number.parseFloat(v)>c)??D[D.length-1]).value:(ce.find(({value:v})=>Number.parseFloat(v)<c)??D[0]).value};function q(a,r){const u=(a??"").toLowerCase();return(r??"").toLowerCase()===le||u.endsWith(oe)}const W=V.map(a=>({value:a.value,label:a.label})),ae=({fileUrl:a,fileName:r,loadFileCb:u,highlights:l,selectedPageNumber:d,onTotalPagesChange:c,thumbnailPageNumbers:v,onThumbnailsLoaded:b,onViewerReady:N,showLoaderOverlay:m=!1,selectedPages:y})=>{const f=ee(),n=t.useRef(null),[h,E]=t.useState(!1),[w,I]=t.useState(0),[T,O]=t.useState(!1),[_,j]=t.useState(null),[s,x]=t.useState(null),[p,S]=t.useState(z),C=t.useMemo(()=>{if(r)return q(r.toLowerCase());let o;try{o=new URL(a).pathname}catch{o=a.split("?")[0].split("#")[0]}const g=o.split("/").pop()??"";return!g.includes(".")||q(g.toLowerCase())},[r,a]),B=t.useCallback(o=>{I((w+o+l.length)%l.length)},[w,l.length]),U=t.useCallback(o=>{const g=n.current;!g?.getZoom||!o||S(te(p,o,g.getZoom()))},[p]),R=t.useMemo(()=>{if(!(p===z||p===A||V.some(g=>g.value===p))){const g=parseFloat(p);if(!Number.isNaN(g)&&g>0)return[...W,{value:p,label:`${Math.round(g*100)}%`}]}return W},[p]);t.useEffect(()=>{let o=!1;if(j(!0),O(!1),x(null),E(!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,E(!0),N?.(o)},[N]);return t.useEffect(()=>{const o=v??[],g=n.current?.getThumbnailsDataUrl;if(!o.length||!g||!s||!b||!h)return;let Z=!1;return(async()=>{const K=new Map;for(let F=0;F<o.length&&!Z;F+=$){const se=o.slice(F,F+$);try{const H=await g(se,X);if(Z)break;H.forEach((re,ne)=>K.set(ne,re)),b(new Map(K))}catch(H){console.warn("Thumbnail batch load failed:",H);break}}})(),()=>{Z=!0}},[v,s,b,h]),{file:s,isLoading:_,isError:T,isSupportedFile:C,activeHighlightIndex:w,zoom:p,setZoom:S,zoomSelectOptions:R,viewerApiRef:n,showLoader:!T&&(!!_||m),changeIndex:B,handleZoomChange:U,handleViewerReady:M}},ie=({fileUrl:a,fileName:r,errorLabel:u,occurrencesLabel:l,unsupportedLabel:d,highlights:c,loadFileCb:v,showOccurrences:b=!0,selectedPageNumber:N,containerClassName:m,pdfViewerClassName:y,onTotalPagesChange:f,title:n,thumbnailPageNumbers:h,onThumbnailsLoaded:E,onViewerReady:w,showLoaderOverlay:I=!1,selectedPages:T,selectedHighlightId:O,viewerOptions:_})=>{const{file:j,isError:s,isSupportedFile:x,activeHighlightIndex:p,zoom:S,setZoom:C,zoomSelectOptions:B,showLoader:U,changeIndex:R,handleZoomChange:M,handleViewerReady:G}=ae({fileUrl:a,fileName:r,loadFileCb:v,highlights:c,selectedPageNumber:N,onTotalPagesChange:f,thumbnailPageNumbers:h,onThumbnailsLoaded:E,onViewerReady:w,showLoaderOverlay:I,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-sunken",m),children:[r&&e.jsx("div",{className:"shrink-0 min-h-0 w-full",children:e.jsx(i.EllipsisTooltip,{className:"dial-tiny-text text-secondary",text:r})}),e.jsxs("div",{className:i.mergeClasses("flex w-full justify-between items-center",b&&n?"gap-2":""),children:[e.jsx("div",{children:b?e.jsxs("div",{className:"flex gap-1 py-0.5 px-1.5 min-h-[26px] items-center bg-layer-raised 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.IconButton,{className:"p-0 text-primary !h-6.5",size:i.ElementSize.Small,icon:e.jsx(k.IconChevronDown,{size:16}),"aria-label":"Next occurrence",onClick:()=>R(1)}),e.jsx(i.IconButton,{className:"p-0 text-primary !h-6.5",size:i.ElementSize.Small,icon:e.jsx(k.IconChevronUp,{size:16}),"aria-label":"Previous occurrence",onClick:()=>R(-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.EllipsisTooltip,{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.Select,{size:i.ElementSize.Small,ariaLabel:"Zoom",fieldClassName:"bg-control-neutral !py-0 h-6 min-h-6 dial-small-text max-h-full border-transparent hover:border-accent-alpha rounded",options:B,value:S,onChange:o=>C(o)})}),e.jsx(i.IconButton,{className:"py-0 rounded text-primary bg-control-neutral border border-transparent hover:border-accent-alpha",icon:e.jsx(k.IconMinus,{size:16}),"aria-label":"Zoom out",size:i.ElementSize.Small,onClick:()=>M(-1)}),e.jsx(i.IconButton,{className:"py-0 rounded text-primary bg-control-neutral border border-transparent hover:border-accent-alpha",icon:e.jsx(k.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(Y,{pdf:j,highlights:c,selectedHighlightId:b?c[p]?.id:O,selectedPageNumber:N,zoom:S,onTotalPagesChange:f,onViewerReady:G,containerClassName:y,selectedPages:T,viewerOptions:_}),U&&e.jsx(J,{className:"absolute inset-0 z-10"}),s&&e.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-layer-raised",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 p-10",children:[e.jsx(k.IconAlertTriangle,{size:60,stroke:2,className:"text-secondary"}),e.jsx("div",{className:"text-center dial-small-text whitespace-pre-wrap",children:!x&&d?d:u??"Failed to load document."})]})})]})]})},ue=1200*1e3,de=20,me=({children:a,ttlMs:r=ue,maxEntries:u=de})=>{const l=t.useRef(new Map),d=t.useCallback((m,y)=>{l.current.delete(m),l.current.set(m,y)},[]),c=t.useCallback(()=>{const m=Date.now();for(const[y,f]of l.current.entries())f.file&&m-f.timestamp>r&&l.current.delete(y)},[r]),v=t.useCallback(()=>{for(;l.current.size>u;){const m=l.current.keys().next().value;m&&l.current.delete(m)}},[u]),b=t.useCallback(()=>{l.current.clear()},[]),N=t.useCallback(async(m,y)=>{c();const f=l.current.get(m);if(f){if(d(m,{...f,timestamp:Date.now()}),f.file)return f.file;if(f.promise)return f.promise}const n=Date.now(),h=y().then(w=>{const I={file:w,timestamp:Date.now()};return d(m,I),v(),w}).catch(w=>{throw l.current.delete(m),w});return d(m,{promise:h,timestamp:n}),v(),h},[v,c,d]);return t.useEffect(()=>()=>b(),[b]),e.jsx(Q.Provider,{value:{getFile:N,clearCache:b},children:a})},fe=({pageNum:a,onSelectPage:r,isSelected:u,isLoading:l,isMultiselect:d,thumbnailUrl:c,className:v})=>e.jsxs("button",{type:"button","aria-label":`Page ${a}`,"aria-pressed":u,onClick:b=>{d&&b.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-control-accent-alpha-hover rounded-sm",u&&(d?"border border-accent bg-control-accent-alpha":"border border-primary"),v),children:[e.jsxs("div",{className:"relative w-[104px] h-[146px] bg-layer-raised 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,d&&e.jsx("div",{className:"absolute left-1 top-1 z-10","data-checkbox-wrapper":!0,children:e.jsx(i.Checkbox,{id:`page-thumbnail-${a}`,isSelected:u,onChange:()=>r(a),"aria-label":`Select page ${a}`})}),l&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-backdrop rounded-sm",children:e.jsx(i.Spinner,{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:()=>L.RotationDirection});exports.AUTO_ZOOM_ID=z;exports.DocumentPreview=ie;exports.DocumentPreviewCacheProvider=me;exports.FIT_ZOOM_ID=A;exports.PDFViewer=Y;exports.PageThumbnail=fe;exports.PdfPreviewLoader=J;exports.THUMBNAIL_BATCH_SIZE=$;exports.THUMBNAIL_IMAGE_OPTIONS=X;exports.ZOOM_OPTIONS=V;exports.getStepZoomOptionValue=te;exports.isPdfFile=q;exports.useDocumentPreview=ae;exports.useDocumentPreviewCache=ee;
@@ -1,10 +1,11 @@
1
- import { jsx as e, jsxs as v, Fragment as le } from "react/jsx-runtime";
2
- import { mergeClasses as S, DialEllipsisTooltip as K, DialButton as j, ElementSize as B, DialSelect as oe, SelectSize as se, DialCheckbox as ce, DialLoader as ie } from "@epam/ai-dial-ui-kit";
3
- import { ZoomMode as Y, PDFHighlightViewer as ue } from "@epam/pdf-highlighter-kit";
4
- import { useRef as F, useState as E, useEffect as y, useCallback as O, createContext as me, useContext as de, useMemo as J } from "react";
5
- import { IconChevronDown as fe, IconChevronUp as pe, IconMinus as ve, IconPlus as be, IconAlertTriangle as he } from "@tabler/icons-react";
6
- const H = "auto", G = "page-fit", X = [
7
- { value: H, label: "Auto" },
1
+ import { jsx as e, jsxs as x, Fragment as se } from "react/jsx-runtime";
2
+ import { mergeClasses as S, EllipsisTooltip as Y, IconButton as B, ElementSize as M, Select as ce, Checkbox as ie, Spinner as ue } from "@epam/ai-dial-ui-kit";
3
+ import { ZoomMode as J, PDFHighlightViewer as de } from "@epam/pdf-highlighter-kit";
4
+ import { RotationDirection as je } from "@epam/pdf-highlighter-kit";
5
+ import { useRef as F, useState as Z, useEffect as y, useCallback as I, createContext as me, useContext as fe, useMemo as Q } from "react";
6
+ import { IconChevronDown as pe, IconChevronUp as he, IconMinus as ve, 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,135 +14,142 @@ 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
- ], xe = {
17
+ ], ge = {
17
18
  maxWidth: 104,
18
19
  format: "image/jpeg",
19
20
  quality: 0.85
20
- }, Q = 15, we = "application/pdf", ye = ".pdf", ge = ({
21
+ }, ee = 15, we = "application/pdf", ye = ".pdf", Ne = ({
21
22
  pdf: t,
22
- highlights: a,
23
- selectedHighlightId: i,
24
- autoFocusFirstHighlight: n = !1,
25
- selectedPageNumber: u,
23
+ highlights: r,
24
+ selectedHighlightId: c,
25
+ autoFocusFirstHighlight: o = !1,
26
+ selectedPageNumber: i,
26
27
  zoom: s,
27
- containerClassName: f,
28
- onTotalPagesChange: d,
29
- onViewerReady: g,
30
- selectedPages: m
28
+ containerClassName: v,
29
+ onTotalPagesChange: h,
30
+ onViewerReady: N,
31
+ selectedPages: u,
32
+ viewerOptions: w
31
33
  }) => {
32
- const h = F(null), r = F(null), [o, T] = E(!1), [_, b] = E(!1), D = F(d), z = F(g);
34
+ const d = F(null), n = F(null), [p, _] = Z(!1), [g, E] = Z(!1), O = F(h), D = F(N), k = F(w);
33
35
  y(() => {
34
- D.current = d;
35
- }, [d]), y(() => {
36
- z.current = g;
37
- }, [g]);
38
- const N = O(
39
- (l) => r.current?.goToHighlight(l),
36
+ O.current = h;
37
+ }, [h]), y(() => {
38
+ D.current = N;
39
+ }, [N]), y(() => {
40
+ k.current = w;
41
+ }, [w]);
42
+ const C = I(
43
+ (a) => n.current?.goToHighlight(a),
40
44
  []
41
45
  );
42
46
  return y(() => {
43
- if (!h.current) return;
44
- T(!1), b(!1), r.current && (r.current.destroy(), r.current = null);
45
- let l = null, p = !0;
47
+ if (!d.current) return;
48
+ _(!1), E(!1), n.current && (n.current.destroy(), n.current = null);
49
+ let a = null, m = !0;
50
+ const f = () => {
51
+ m && E(!0);
52
+ };
46
53
  return (async () => {
47
54
  try {
48
- if (l = new ue(), await l.init(h.current, {
55
+ if (a = new de(), await a.init(d.current, {
49
56
  enableTextSelection: !0,
50
57
  enableVirtualScrolling: !0,
51
- bboxOrigin: "top-left"
52
- }), !p) {
53
- l.destroy();
58
+ bboxOrigin: "top-left",
59
+ ...k.current
60
+ }), !m) {
61
+ a.destroy();
54
62
  return;
55
63
  }
56
- if (await l.loadPDF(t, { selectedPages: m }), !p) {
57
- l.destroy();
64
+ if (a.addEventListener("zoomChanged", f), await a.loadPDF(t, { selectedPages: u }), !m) {
65
+ a.destroy();
58
66
  return;
59
67
  }
60
- const x = l.getTotalPages?.();
61
- typeof x == "number" && x > 0 && D.current?.(x), p && (r.current = l, T(!0));
62
- } catch (x) {
63
- if (!p)
68
+ const P = a.getTotalPages?.();
69
+ typeof P == "number" && P > 0 && O.current?.(P), m && (n.current = a, _(!0));
70
+ } catch (P) {
71
+ if (!m)
64
72
  return;
65
- console.error("Error in initViewer:", x);
73
+ console.error("Error in initViewer:", P);
66
74
  }
67
75
  })(), () => {
68
- p = !1, l && l.destroy();
76
+ m = !1, a && (a.removeEventListener("zoomChanged", f), a.destroy());
69
77
  };
70
- }, [t, m]), y(() => {
71
- !o || !r.current || (r.current.loadHighlights(a), n && a && a[0] && N(a[0].id));
72
- }, [n, N, a, o]), y(() => {
73
- b(!0);
74
- }, [a]), y(() => {
75
- o && _ && i && N(i);
76
- }, [N, o, _, i]), y(() => {
77
- if (!(!o || !s))
78
- if (s === H)
79
- r.current?.setZoom?.(Y.AUTO);
78
+ }, [t, u]), y(() => {
79
+ !p || !n.current || (n.current.loadHighlights(r), o && r && r[0] && C(r[0].id));
80
+ }, [o, C, r, p]), y(() => {
81
+ p && g && c && C(c);
82
+ }, [C, p, g, c]), y(() => {
83
+ if (!(!p || !s))
84
+ if (s === $)
85
+ n.current?.setZoom?.(J.AUTO);
80
86
  else if (s === G)
81
- r.current?.setZoom?.(Y.PAGE_FIT);
87
+ n.current?.setZoom?.(J.PAGE_FIT);
82
88
  else {
83
- const l = parseFloat(s);
84
- !Number.isNaN(l) && l > 0 && r.current?.setZoom?.(l);
89
+ const a = parseFloat(s);
90
+ !Number.isNaN(a) && a > 0 && n.current?.setZoom?.(a);
85
91
  }
86
- }, [o, s]), y(() => {
87
- o && u && r.current?.setPage?.(u);
88
- }, [o, u]), y(() => {
89
- if (!o || !r.current) return;
90
- const l = r.current;
91
- z.current?.({
92
- getThumbnailsDataUrl: (p, P) => l.getThumbnailsDataUrl(p, P),
93
- zoomIn: () => l.zoomIn(),
94
- zoomOut: () => l.zoomOut(),
95
- getZoom: () => l.getZoom(),
96
- navigateToPage: (p) => l.setPage?.(p)
92
+ }, [p, s]), y(() => {
93
+ p && i && n.current?.setPage?.(i);
94
+ }, [p, i]), y(() => {
95
+ if (!p || !n.current) return;
96
+ const a = n.current;
97
+ D.current?.({
98
+ getThumbnailsDataUrl: (m, f) => a.getThumbnailsDataUrl(m, f),
99
+ zoomIn: () => a.zoomIn(),
100
+ zoomOut: () => a.zoomOut(),
101
+ getZoom: () => a.getZoom(),
102
+ navigateToPage: (m) => a.setPage?.(m),
103
+ setPageDisplayRotation: (m, f, z) => a.setPageDisplayRotation(m, f, z),
104
+ getPageDisplayRotation: (m) => a.getPageDisplayRotation(m)
97
105
  });
98
- }, [o]), /* @__PURE__ */ e(
106
+ }, [p]), /* @__PURE__ */ e(
99
107
  "div",
100
108
  {
101
- ref: h,
109
+ ref: d,
102
110
  className: S(
103
- "grow min-w-0 overflow-auto bg-layer-3",
104
- f
111
+ "grow min-w-0 overflow-auto bg-layer-raised",
112
+ v
105
113
  )
106
114
  }
107
115
  );
108
- }, C = "h-4 rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave", Ne = ({
116
+ }, T = "h-4 rounded-[120px] bg-gradient-to-r from-layer-sunken via-layer-raised to-layer-sunken bg-[length:200%_100%] animate-skeleton-wave", Ce = ({
109
117
  className: t,
110
- ariaLabel: a = "pdf preview loading"
118
+ ariaLabel: r = "pdf preview loading"
111
119
  }) => /* @__PURE__ */ e(
112
120
  "div",
113
121
  {
114
122
  role: "status",
115
- "aria-label": a,
123
+ "aria-label": r,
116
124
  "aria-live": "polite",
117
- className: S("h-full w-full bg-layer-3", t),
118
- children: /* @__PURE__ */ v("div", { className: "flex h-full w-full flex-col gap-10 px-[60px] pt-10", children: [
119
- /* @__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__ */ v("div", { className: "flex flex-col gap-4", children: [
121
- /* @__PURE__ */ e("div", { className: C }),
122
- /* @__PURE__ */ e("div", { className: C }),
123
- /* @__PURE__ */ e("div", { className: C }),
124
- /* @__PURE__ */ e("div", { className: C }),
125
+ className: S("h-full w-full bg-layer-raised", t),
126
+ children: /* @__PURE__ */ x("div", { className: "flex h-full w-full flex-col gap-10 px-[60px] pt-10", children: [
127
+ /* @__PURE__ */ e("div", { className: "mx-auto h-4 w-[208px] max-w-[40%] rounded-[120px] bg-gradient-to-r from-layer-sunken via-layer-raised to-layer-sunken bg-[length:200%_100%] animate-skeleton-wave" }),
128
+ /* @__PURE__ */ x("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
- C,
137
+ T,
130
138
  "w-[28%] max-w-[320px]"
131
139
  )
132
140
  }
133
141
  )
134
142
  ] }),
135
- /* @__PURE__ */ v("div", { className: "flex flex-col gap-4", children: [
136
- /* @__PURE__ */ e("div", { className: C }),
137
- /* @__PURE__ */ e("div", { className: C }),
138
- /* @__PURE__ */ e("div", { className: C }),
139
- /* @__PURE__ */ e("div", { className: C }),
143
+ /* @__PURE__ */ x("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
- C,
152
+ T,
145
153
  "w-[58%] max-w-[520px]"
146
154
  )
147
155
  }
@@ -149,110 +157,112 @@ const H = "auto", G = "page-fit", X = [
149
157
  ] })
150
158
  ] })
151
159
  }
152
- ), te = me(null), Ie = () => de(te), Z = X.filter(({ value: t }) => {
153
- const a = Number.parseFloat(t);
154
- return !Number.isNaN(a) && a > 0;
155
- }), Te = [...Z].reverse(), Ce = (t, a, i) => {
156
- if (Z.length === 0)
160
+ ), re = me(null), Pe = () => fe(re), R = X.filter(({ value: t }) => {
161
+ const r = Number.parseFloat(t);
162
+ return !Number.isNaN(r) && r > 0;
163
+ }), Te = [...R].reverse(), Ie = (t, r, c) => {
164
+ if (R.length === 0)
157
165
  return t;
158
- const n = Number.parseFloat(t), u = !Number.isNaN(n) && n > 0 ? n : i, s = typeof u == "number" && u > 0 ? u : Number.parseFloat(Z[0].value);
159
- return a === 1 ? (Z.find(
160
- ({ value: f }) => Number.parseFloat(f) > s
161
- ) ?? Z[Z.length - 1]).value : (Te.find(
162
- ({ value: f }) => Number.parseFloat(f) < s
163
- ) ?? Z[0]).value;
166
+ const o = Number.parseFloat(t), i = !Number.isNaN(o) && o > 0 ? o : c, s = typeof i == "number" && i > 0 ? i : Number.parseFloat(R[0].value);
167
+ return r === 1 ? (R.find(
168
+ ({ value: v }) => Number.parseFloat(v) > s
169
+ ) ?? R[R.length - 1]).value : (Te.find(
170
+ ({ value: v }) => Number.parseFloat(v) < s
171
+ ) ?? R[0]).value;
164
172
  };
165
- function Pe(t, a) {
166
- const i = (t ?? "").toLowerCase();
167
- return (a ?? "").toLowerCase() === we || i.endsWith(ye);
173
+ function te(t, r) {
174
+ const c = (t ?? "").toLowerCase();
175
+ return (r ?? "").toLowerCase() === we || c.endsWith(ye);
168
176
  }
169
- const ee = X.map((t) => ({
177
+ const ae = X.map((t) => ({
170
178
  value: t.value,
171
179
  label: t.label
172
- })), Oe = ({
180
+ })), _e = ({
173
181
  fileUrl: t,
174
- fileName: a,
175
- loadFileCb: i,
176
- highlights: n,
177
- selectedPageNumber: u,
182
+ fileName: r,
183
+ loadFileCb: c,
184
+ highlights: o,
185
+ selectedPageNumber: i,
178
186
  onTotalPagesChange: s,
179
- thumbnailPageNumbers: f,
180
- onThumbnailsLoaded: d,
181
- onViewerReady: g,
182
- showLoaderOverlay: m = !1,
183
- selectedPages: h
187
+ thumbnailPageNumbers: v,
188
+ onThumbnailsLoaded: h,
189
+ onViewerReady: N,
190
+ showLoaderOverlay: u = !1,
191
+ selectedPages: w
184
192
  }) => {
185
- const r = Ie(), o = F(null), [T, _] = E(!1), [b, D] = E(0), [z, N] = E(!1), [l, p] = E(null), [P, x] = E(null), [I, A] = E(H), k = J(() => {
186
- let c = a || t;
187
- if (!a)
188
- try {
189
- c = new URL(t).pathname;
190
- } catch {
191
- c = t.split("?")[0].split("#")[0];
192
- }
193
- return Pe(c.toLowerCase());
194
- }, [a, t]), M = O(
195
- (c) => {
196
- D(
197
- (b + c + n.length) % n.length
193
+ const d = Pe(), n = F(null), [p, _] = Z(!1), [g, E] = Z(0), [O, D] = Z(!1), [k, C] = Z(null), [a, m] = Z(null), [f, z] = Z($), P = Q(() => {
194
+ if (r)
195
+ return te(r.toLowerCase());
196
+ let l;
197
+ try {
198
+ l = new URL(t).pathname;
199
+ } catch {
200
+ l = t.split("?")[0].split("#")[0];
201
+ }
202
+ const b = l.split("/").pop() ?? "";
203
+ return !b.includes(".") || te(b.toLowerCase());
204
+ }, [r, t]), U = I(
205
+ (l) => {
206
+ E(
207
+ (g + l + o.length) % o.length
198
208
  );
199
209
  },
200
- [b, n.length]
201
- ), R = O(
202
- (c) => {
203
- const w = o.current;
204
- !w?.getZoom || !c || A(Ce(I, c, w.getZoom()));
210
+ [g, o.length]
211
+ ), H = I(
212
+ (l) => {
213
+ const b = n.current;
214
+ !b?.getZoom || !l || z(Ie(f, l, b.getZoom()));
205
215
  },
206
- [I]
207
- ), $ = J(() => {
208
- if (!(I === H || I === G || X.some((w) => w.value === I))) {
209
- const w = parseFloat(I);
210
- if (!Number.isNaN(w) && w > 0)
216
+ [f]
217
+ ), A = Q(() => {
218
+ if (!(f === $ || f === G || X.some((b) => b.value === f))) {
219
+ const b = parseFloat(f);
220
+ if (!Number.isNaN(b) && b > 0)
211
221
  return [
212
- ...ee,
213
- { value: I, label: `${Math.round(w * 100)}%` }
222
+ ...ae,
223
+ { value: f, label: `${Math.round(b * 100)}%` }
214
224
  ];
215
225
  }
216
- return ee;
217
- }, [I]);
226
+ return ae;
227
+ }, [f]);
218
228
  y(() => {
219
- let c = !1;
220
- if (p(!0), N(!1), x(null), _(!1), o.current = null, !k) {
221
- N(!0), p(!1);
229
+ let l = !1;
230
+ if (C(!0), D(!1), m(null), _(!1), n.current = null, !P) {
231
+ D(!0), C(!1);
222
232
  return;
223
233
  }
224
234
  return (async () => {
225
235
  try {
226
- const L = await (r ? r.getFile(t, () => i(t)) : i(t));
227
- c || x(L);
236
+ const L = await (d ? d.getFile(t, () => c(t)) : c(t));
237
+ l || m(L);
228
238
  } catch {
229
- c || (N(!0), x(null));
239
+ l || (D(!0), m(null));
230
240
  } finally {
231
- c || p(!1);
241
+ l || C(!1);
232
242
  }
233
243
  })(), () => {
234
- c = !0;
244
+ l = !0;
235
245
  };
236
- }, [t, r, i, k]);
237
- const U = O(
238
- (c) => {
239
- o.current = c, _(!0), g?.(c);
246
+ }, [t, d, c, P]);
247
+ const V = I(
248
+ (l) => {
249
+ n.current = l, _(!0), N?.(l);
240
250
  },
241
- [g]
251
+ [N]
242
252
  );
243
253
  return y(() => {
244
- const c = f ?? [], w = o.current?.getThumbnailsDataUrl;
245
- if (!c.length || !w || !P || !d || !T)
254
+ const l = v ?? [], b = n.current?.getThumbnailsDataUrl;
255
+ if (!l.length || !b || !a || !h || !p)
246
256
  return;
247
257
  let L = !1;
248
258
  return (async () => {
249
- const q = /* @__PURE__ */ new Map();
250
- for (let V = 0; V < c.length && !L; V += Q) {
251
- const re = c.slice(V, V + Q);
259
+ const K = /* @__PURE__ */ new Map();
260
+ for (let j = 0; j < l.length && !L; j += ee) {
261
+ const ne = l.slice(j, j + ee);
252
262
  try {
253
- const W = await w(re, xe);
263
+ const W = await b(ne, ge);
254
264
  if (L) break;
255
- W.forEach((ae, ne) => q.set(ne, ae)), d(new Map(q));
265
+ W.forEach((oe, le) => K.set(le, oe)), h(new Map(K));
256
266
  } catch (W) {
257
267
  console.warn("Thumbnail batch load failed:", W);
258
268
  break;
@@ -261,162 +271,165 @@ const ee = X.map((t) => ({
261
271
  })(), () => {
262
272
  L = !0;
263
273
  };
264
- }, [f, P, d, T]), {
265
- file: P,
266
- isLoading: l,
267
- isError: z,
268
- isSupportedFile: k,
269
- activeHighlightIndex: b,
270
- zoom: I,
271
- setZoom: A,
272
- zoomSelectOptions: $,
273
- viewerApiRef: o,
274
- showLoader: !z && (!!l || m),
275
- changeIndex: M,
276
- handleZoomChange: R,
277
- handleViewerReady: U
274
+ }, [v, a, h, p]), {
275
+ file: a,
276
+ isLoading: k,
277
+ isError: O,
278
+ isSupportedFile: P,
279
+ activeHighlightIndex: g,
280
+ zoom: f,
281
+ setZoom: z,
282
+ zoomSelectOptions: A,
283
+ viewerApiRef: n,
284
+ showLoader: !O && (!!k || u),
285
+ changeIndex: U,
286
+ handleZoomChange: H,
287
+ handleViewerReady: V
278
288
  };
279
- }, Ae = ({
289
+ }, Fe = ({
280
290
  fileUrl: t,
281
- fileName: a,
282
- errorLabel: i,
283
- occurrencesLabel: n,
284
- unsupportedLabel: u,
291
+ fileName: r,
292
+ errorLabel: c,
293
+ occurrencesLabel: o,
294
+ unsupportedLabel: i,
285
295
  highlights: s,
286
- loadFileCb: f,
287
- showOccurrences: d = !0,
288
- selectedPageNumber: g,
289
- containerClassName: m,
290
- pdfViewerClassName: h,
291
- onTotalPagesChange: r,
292
- title: o,
293
- thumbnailPageNumbers: T,
296
+ loadFileCb: v,
297
+ showOccurrences: h = !0,
298
+ selectedPageNumber: N,
299
+ containerClassName: u,
300
+ pdfViewerClassName: w,
301
+ onTotalPagesChange: d,
302
+ title: n,
303
+ thumbnailPageNumbers: p,
294
304
  onThumbnailsLoaded: _,
295
- onViewerReady: b,
296
- showLoaderOverlay: D = !1,
297
- selectedPages: z
305
+ onViewerReady: g,
306
+ showLoaderOverlay: E = !1,
307
+ selectedPages: O,
308
+ selectedHighlightId: D,
309
+ viewerOptions: k
298
310
  }) => {
299
311
  const {
300
- file: N,
301
- isError: l,
302
- isSupportedFile: p,
303
- activeHighlightIndex: P,
304
- zoom: x,
305
- setZoom: I,
306
- zoomSelectOptions: A,
307
- showLoader: k,
308
- changeIndex: M,
309
- handleZoomChange: R,
310
- handleViewerReady: $
311
- } = Oe({
312
+ file: C,
313
+ isError: a,
314
+ isSupportedFile: m,
315
+ activeHighlightIndex: f,
316
+ zoom: z,
317
+ setZoom: P,
318
+ zoomSelectOptions: U,
319
+ showLoader: H,
320
+ changeIndex: A,
321
+ handleZoomChange: V,
322
+ handleViewerReady: q
323
+ } = _e({
312
324
  fileUrl: t,
313
- fileName: a,
314
- loadFileCb: f,
325
+ fileName: r,
326
+ loadFileCb: v,
315
327
  highlights: s,
316
- selectedPageNumber: g,
317
- onTotalPagesChange: r,
318
- thumbnailPageNumbers: T,
328
+ selectedPageNumber: N,
329
+ onTotalPagesChange: d,
330
+ thumbnailPageNumbers: p,
319
331
  onThumbnailsLoaded: _,
320
- onViewerReady: b,
321
- showLoaderOverlay: D,
322
- selectedPages: z
332
+ onViewerReady: g,
333
+ showLoaderOverlay: E,
334
+ selectedPages: O
323
335
  });
324
- return /* @__PURE__ */ v(
336
+ return /* @__PURE__ */ x(
325
337
  "div",
326
338
  {
327
339
  className: S(
328
- "flex flex-col self-center gap-4 py-3 px-6 h-full w-full bg-layer-2",
329
- m
340
+ "flex flex-col self-center gap-4 py-3 px-6 h-full w-full bg-layer-sunken",
341
+ u
330
342
  ),
331
343
  children: [
332
- a && /* @__PURE__ */ e("div", { className: "shrink-0 min-h-0 w-full", children: /* @__PURE__ */ e(
333
- K,
344
+ r && /* @__PURE__ */ e("div", { className: "shrink-0 min-h-0 w-full", children: /* @__PURE__ */ e(
345
+ Y,
334
346
  {
335
347
  className: "dial-tiny-text text-secondary",
336
- text: a
348
+ text: r
337
349
  }
338
350
  ) }),
339
- /* @__PURE__ */ v(
351
+ /* @__PURE__ */ x(
340
352
  "div",
341
353
  {
342
354
  className: S(
343
355
  "flex w-full justify-between items-center",
344
- d && o ? "gap-2" : ""
356
+ h && n ? "gap-2" : ""
345
357
  ),
346
358
  children: [
347
- /* @__PURE__ */ e("div", { children: d ? /* @__PURE__ */ v("div", { className: "flex gap-1 py-0.5 px-1.5 min-h-[26px] items-center bg-layer-4 rounded w-fit", children: [
348
- /* @__PURE__ */ v("span", { className: "dial-small-text", children: [
349
- n ?? "Occurrences",
359
+ /* @__PURE__ */ e("div", { children: h ? /* @__PURE__ */ x("div", { className: "flex gap-1 py-0.5 px-1.5 min-h-[26px] items-center bg-layer-raised rounded w-fit", children: [
360
+ /* @__PURE__ */ x("span", { className: "dial-small-text", children: [
361
+ o ?? "Occurrences",
350
362
  ":",
351
- /* @__PURE__ */ e("span", { className: "pl-0.5 min-w-3 inline-block text-right", children: s.length > 0 ? `${P + 1}/${s.length}` : "0" })
363
+ /* @__PURE__ */ e("span", { className: "pl-0.5 min-w-3 inline-block text-right", children: s.length > 0 ? `${f + 1}/${s.length}` : "0" })
352
364
  ] }),
353
- s.length > 0 && /* @__PURE__ */ v(le, { children: [
365
+ s.length > 0 && /* @__PURE__ */ x(se, { children: [
354
366
  /* @__PURE__ */ e(
355
- j,
367
+ B,
356
368
  {
357
369
  className: "p-0 text-primary !h-6.5",
358
- size: B.Small,
359
- iconAfter: /* @__PURE__ */ e(fe, { size: 16 }),
370
+ size: M.Small,
371
+ icon: /* @__PURE__ */ e(pe, { size: 16 }),
360
372
  "aria-label": "Next occurrence",
361
- onClick: () => M(1)
373
+ onClick: () => A(1)
362
374
  }
363
375
  ),
364
376
  /* @__PURE__ */ e(
365
- j,
377
+ B,
366
378
  {
367
379
  className: "p-0 text-primary !h-6.5",
368
- size: B.Small,
369
- iconAfter: /* @__PURE__ */ e(pe, { size: 16 }),
380
+ size: M.Small,
381
+ icon: /* @__PURE__ */ e(he, { size: 16 }),
370
382
  "aria-label": "Previous occurrence",
371
- onClick: () => M(-1)
383
+ onClick: () => A(-1)
372
384
  }
373
385
  )
374
386
  ] })
375
387
  ] }) : /* @__PURE__ */ e("div", {}) }),
376
- /* @__PURE__ */ v(
388
+ /* @__PURE__ */ x(
377
389
  "div",
378
390
  {
379
391
  className: S(
380
392
  "flex flex-1 items-center gap-4 min-w-0",
381
- o != null && o !== "" ? "justify-between" : "justify-end"
393
+ n != null && n !== "" ? "justify-between" : "justify-end"
382
394
  ),
383
395
  children: [
384
- o != null && o !== "" && /* @__PURE__ */ e(
385
- K,
396
+ n != null && n !== "" && /* @__PURE__ */ e(
397
+ Y,
386
398
  {
387
- text: o,
399
+ text: n,
388
400
  className: "dial-body-semi-text text-primary min-w-0"
389
401
  }
390
402
  ),
391
- /* @__PURE__ */ v("div", { className: "flex gap-0.5 items-center shrink-0", children: [
403
+ /* @__PURE__ */ x("div", { className: "flex gap-0.5 items-center shrink-0", children: [
392
404
  /* @__PURE__ */ e("div", { className: "h-6", children: /* @__PURE__ */ e(
393
- oe,
405
+ ce,
394
406
  {
395
- size: se.Sm,
396
- 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: A,
398
- value: x,
399
- onChange: (U) => I(U)
407
+ size: M.Small,
408
+ ariaLabel: "Zoom",
409
+ fieldClassName: "bg-control-neutral !py-0 h-6 min-h-6 dial-small-text max-h-full border-transparent hover:border-accent-alpha rounded",
410
+ options: U,
411
+ value: z,
412
+ onChange: (l) => P(l)
400
413
  }
401
414
  ) }),
402
415
  /* @__PURE__ */ e(
403
- j,
416
+ B,
404
417
  {
405
- className: "py-0 flex items-center justify-center rounded text-primary bg-layer-4 border border-transparent hover:border-hover",
406
- iconAfter: /* @__PURE__ */ e(ve, { size: 16 }),
418
+ className: "py-0 rounded text-primary bg-control-neutral border border-transparent hover:border-accent-alpha",
419
+ icon: /* @__PURE__ */ e(ve, { size: 16 }),
407
420
  "aria-label": "Zoom out",
408
- size: B.Small,
409
- onClick: () => R(-1)
421
+ size: M.Small,
422
+ onClick: () => V(-1)
410
423
  }
411
424
  ),
412
425
  /* @__PURE__ */ e(
413
- j,
426
+ B,
414
427
  {
415
- className: "py-0 flex items-center justify-center rounded text-primary bg-layer-4 border border-transparent hover:border-hover",
416
- iconAfter: /* @__PURE__ */ e(be, { size: 16 }),
428
+ className: "py-0 rounded text-primary bg-control-neutral border border-transparent hover:border-accent-alpha",
429
+ icon: /* @__PURE__ */ e(be, { size: 16 }),
417
430
  "aria-label": "Zoom in",
418
- size: B.Small,
419
- onClick: () => R(1)
431
+ size: M.Small,
432
+ onClick: () => V(1)
420
433
  }
421
434
  )
422
435
  ] })
@@ -426,100 +439,101 @@ const ee = X.map((t) => ({
426
439
  ]
427
440
  }
428
441
  ),
429
- /* @__PURE__ */ v("div", { className: "relative flex min-h-0 flex-1", children: [
430
- N && /* @__PURE__ */ e(
431
- ge,
442
+ /* @__PURE__ */ x("div", { className: "relative flex min-h-0 flex-1", children: [
443
+ C && /* @__PURE__ */ e(
444
+ Ne,
432
445
  {
433
- pdf: N,
446
+ pdf: C,
434
447
  highlights: s,
435
- selectedHighlightId: d ? s[P]?.id : void 0,
436
- selectedPageNumber: g,
437
- zoom: x,
438
- onTotalPagesChange: r,
439
- onViewerReady: $,
440
- containerClassName: h,
441
- selectedPages: z
448
+ selectedHighlightId: h ? s[f]?.id : D,
449
+ selectedPageNumber: N,
450
+ zoom: z,
451
+ onTotalPagesChange: d,
452
+ onViewerReady: q,
453
+ containerClassName: w,
454
+ selectedPages: O,
455
+ viewerOptions: k
442
456
  }
443
457
  ),
444
- k && /* @__PURE__ */ e(Ne, { className: "absolute inset-0 z-10" }),
445
- l && /* @__PURE__ */ e("div", { className: "absolute inset-0 z-20 flex items-center justify-center bg-layer-3", children: /* @__PURE__ */ v("div", { className: "flex flex-col items-center gap-6 p-10", children: [
458
+ H && /* @__PURE__ */ e(Ce, { className: "absolute inset-0 z-10" }),
459
+ a && /* @__PURE__ */ e("div", { className: "absolute inset-0 z-20 flex items-center justify-center bg-layer-raised", children: /* @__PURE__ */ x("div", { className: "flex flex-col items-center gap-6 p-10", children: [
446
460
  /* @__PURE__ */ e(
447
- he,
461
+ xe,
448
462
  {
449
463
  size: 60,
450
464
  stroke: 2,
451
465
  className: "text-secondary"
452
466
  }
453
467
  ),
454
- /* @__PURE__ */ e("div", { className: "text-center dial-small-text whitespace-pre-wrap", children: !p && u ? u : i ?? "Failed to load document." })
468
+ /* @__PURE__ */ e("div", { className: "text-center dial-small-text whitespace-pre-wrap", children: !m && i ? i : c ?? "Failed to load document." })
455
469
  ] }) })
456
470
  ] })
457
471
  ]
458
472
  }
459
473
  );
460
- }, _e = 1200 * 1e3, De = 20, Me = ({
474
+ }, Ee = 1200 * 1e3, Oe = 20, Le = ({
461
475
  children: t,
462
- ttlMs: a = _e,
463
- maxEntries: i = De
476
+ ttlMs: r = Ee,
477
+ maxEntries: c = Oe
464
478
  }) => {
465
- const n = F(/* @__PURE__ */ new Map()), u = O((m, h) => {
466
- n.current.delete(m), n.current.set(m, h);
467
- }, []), s = O(() => {
468
- const m = Date.now();
469
- for (const [h, r] of n.current.entries())
470
- r.file && m - r.timestamp > a && n.current.delete(h);
471
- }, [a]), f = O(() => {
472
- for (; n.current.size > i; ) {
473
- const m = n.current.keys().next().value;
474
- m && n.current.delete(m);
479
+ const o = F(/* @__PURE__ */ new Map()), i = I((u, w) => {
480
+ o.current.delete(u), o.current.set(u, w);
481
+ }, []), s = I(() => {
482
+ const u = Date.now();
483
+ for (const [w, d] of o.current.entries())
484
+ d.file && u - d.timestamp > r && o.current.delete(w);
485
+ }, [r]), v = I(() => {
486
+ for (; o.current.size > c; ) {
487
+ const u = o.current.keys().next().value;
488
+ u && o.current.delete(u);
475
489
  }
476
- }, [i]), d = O(() => {
477
- n.current.clear();
478
- }, []), g = O(
479
- async (m, h) => {
490
+ }, [c]), h = I(() => {
491
+ o.current.clear();
492
+ }, []), N = I(
493
+ async (u, w) => {
480
494
  s();
481
- const r = n.current.get(m);
482
- if (r) {
483
- if (u(m, { ...r, timestamp: Date.now() }), r.file)
484
- return r.file;
485
- if (r.promise)
486
- return r.promise;
495
+ const d = o.current.get(u);
496
+ if (d) {
497
+ if (i(u, { ...d, timestamp: Date.now() }), d.file)
498
+ return d.file;
499
+ if (d.promise)
500
+ return d.promise;
487
501
  }
488
- const o = Date.now(), T = h().then((b) => {
489
- const D = { file: b, timestamp: Date.now() };
490
- return u(m, D), f(), b;
491
- }).catch((b) => {
492
- throw n.current.delete(m), b;
502
+ const n = Date.now(), p = w().then((g) => {
503
+ const E = { file: g, timestamp: Date.now() };
504
+ return i(u, E), v(), g;
505
+ }).catch((g) => {
506
+ throw o.current.delete(u), g;
493
507
  });
494
- return u(m, { promise: T, timestamp: o }), f(), T;
508
+ return i(u, { promise: p, timestamp: n }), v(), p;
495
509
  },
496
- [f, s, u]
510
+ [v, s, i]
497
511
  );
498
- return y(() => () => d(), [d]), /* @__PURE__ */ e(te.Provider, { value: { getFile: g, clearCache: d }, children: t });
499
- }, Re = ({
512
+ return y(() => () => h(), [h]), /* @__PURE__ */ e(re.Provider, { value: { getFile: N, clearCache: h }, children: t });
513
+ }, Me = ({
500
514
  pageNum: t,
501
- onSelectPage: a,
502
- isSelected: i,
503
- isLoading: n,
504
- isMultiselect: u,
515
+ onSelectPage: r,
516
+ isSelected: c,
517
+ isLoading: o,
518
+ isMultiselect: i,
505
519
  thumbnailUrl: s,
506
- className: f
507
- }) => /* @__PURE__ */ v(
520
+ className: v
521
+ }) => /* @__PURE__ */ x(
508
522
  "button",
509
523
  {
510
524
  type: "button",
511
525
  "aria-label": `Page ${t}`,
512
- "aria-pressed": i,
513
- onClick: (d) => {
514
- u && d.target.closest("[data-checkbox-wrapper]") || a(t);
526
+ "aria-pressed": c,
527
+ onClick: (h) => {
528
+ i && h.target.closest("[data-checkbox-wrapper]") || r(t);
515
529
  },
516
530
  className: S(
517
- "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
- i && (u ? "border border-accent-primary bg-accent-primary-alpha" : "border border-primary"),
519
- f
531
+ "flex flex-col gap-2 p-2 h-[186px] w-[120px] items-center justify-center cursor-pointer transition-colors hover:bg-control-accent-alpha-hover rounded-sm",
532
+ c && (i ? "border border-accent bg-control-accent-alpha" : "border border-primary"),
533
+ v
520
534
  ),
521
535
  children: [
522
- /* @__PURE__ */ v("div", { className: "relative w-[104px] h-[146px] bg-model-icon rounded-sm overflow-hidden", children: [
536
+ /* @__PURE__ */ x("div", { className: "relative w-[104px] h-[146px] bg-layer-raised rounded-sm overflow-hidden", children: [
523
537
  s ? /* @__PURE__ */ e(
524
538
  "img",
525
539
  {
@@ -528,17 +542,17 @@ const ee = X.map((t) => ({
528
542
  className: "w-full h-full object-cover rounded-sm"
529
543
  }
530
544
  ) : null,
531
- u && /* @__PURE__ */ e("div", { className: "absolute left-1 top-1 z-10", "data-checkbox-wrapper": !0, children: /* @__PURE__ */ e(
532
- ce,
545
+ i && /* @__PURE__ */ e("div", { className: "absolute left-1 top-1 z-10", "data-checkbox-wrapper": !0, children: /* @__PURE__ */ e(
546
+ ie,
533
547
  {
534
548
  id: `page-thumbnail-${t}`,
535
- checked: i,
536
- onChange: () => a(t),
537
- className: "before:border-primary before:bg-model-icon bg-model-icon"
549
+ isSelected: c,
550
+ onChange: () => r(t),
551
+ "aria-label": `Select page ${t}`
538
552
  }
539
553
  ) }),
540
- n && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-blackout rounded-sm", children: /* @__PURE__ */ e(
541
- ie,
554
+ o && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-backdrop rounded-sm", children: /* @__PURE__ */ e(
555
+ ue,
542
556
  {
543
557
  size: 24,
544
558
  fullWidth: !1,
@@ -551,18 +565,19 @@ const ee = X.map((t) => ({
551
565
  }
552
566
  );
553
567
  export {
554
- H as AUTO_ZOOM_ID,
555
- Ae as DocumentPreview,
556
- Me as DocumentPreviewCacheProvider,
568
+ $ as AUTO_ZOOM_ID,
569
+ Fe as DocumentPreview,
570
+ Le as DocumentPreviewCacheProvider,
557
571
  G as FIT_ZOOM_ID,
558
- ge as PDFViewer,
559
- Re as PageThumbnail,
560
- Ne as PdfPreviewLoader,
561
- Q as THUMBNAIL_BATCH_SIZE,
562
- xe as THUMBNAIL_IMAGE_OPTIONS,
572
+ Ne as PDFViewer,
573
+ Me as PageThumbnail,
574
+ Ce as PdfPreviewLoader,
575
+ je as RotationDirection,
576
+ ee as THUMBNAIL_BATCH_SIZE,
577
+ ge as THUMBNAIL_IMAGE_OPTIONS,
563
578
  X as ZOOM_OPTIONS,
564
- Ce as getStepZoomOptionValue,
565
- Pe as isPdfFile,
566
- Oe as useDocumentPreview,
567
- Ie as useDocumentPreviewCache
579
+ Ie as getStepZoomOptionValue,
580
+ te as isPdfFile,
581
+ _e as useDocumentPreview,
582
+ Pe as useDocumentPreviewCache
568
583
  };
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: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:769px){.container{max-width:769px}}@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{border-color:var(--stroke-accent,#1d4ed8)}.border-primary{border-color:var(--stroke-primary,#57647a)}.border-tertiary{border-color:var(--stroke-tertiary,#e0e6f0)}.border-transparent{border-color:transparent}.bg-backdrop{background-color:var(--bg-backdrop,#161b2d4d)}.bg-control-accent-alpha{background-color:var(--bg-control-accent-alpha,#2764d90f)}.bg-control-neutral{background-color:var(--bg-control-neutral,#fcfcfc)}.bg-layer-base{background-color:var(--bg-layer-base,#f5f7fa)}.bg-layer-raised{background-color:var(--bg-layer-raised,#fcfcfc)}.bg-layer-sunken{background-color:var(--bg-layer-sunken,#eef1f7)}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-layer-sunken{--tw-gradient-from:var(--bg-layer-sunken,#eef1f7) 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-raised{--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--bg-layer-raised,#fcfcfc) var(--tw-gradient-via-position),var(--tw-gradient-to)}.to-layer-sunken{--tw-gradient-to:var(--bg-layer-sunken,#eef1f7) 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{color:var(--text-accent,#1d4ed8)}.text-primary{color:var(--text-primary,#161b2d)}.text-secondary{color:var(--text-secondary,#57647a)}.outline{outline-style:solid;outline-width:1px}.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}.hover\:border-accent-alpha:hover{border-color:var(--stroke-accent-alpha,#2764d933)}.hover\:bg-control-accent-alpha-hover:hover{background-color:var(--bg-control-accent-alpha-hover,#2764d924)}
@@ -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`.
@@ -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",
3
+ "version": "0.2.0-dev.30",
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",
@@ -48,7 +48,7 @@
48
48
  "build-storybook": "concurrently \"npm run build-storybook:css\" \"storybook build\"",
49
49
  "build-storybook:css": "tailwindcss -m -i ./src/styles/tailwind-entry.scss -o ./src/index.css",
50
50
  "prepare": "husky",
51
- "publish": "node tools/publish-lib.mjs",
51
+ "publish:npm": "node tools/publish-lib.mjs",
52
52
  "publish:dry": "node tools/publish-lib.mjs --dry",
53
53
  "test": "vitest --coverage"
54
54
  },
@@ -58,9 +58,9 @@
58
58
  ]
59
59
  },
60
60
  "peerDependencies": {
61
- "@epam/ai-dial-ui-kit": ">=0.8.0-0 || >=0.9.0-rc.0",
62
- "@epam/pdf-highlighter-kit": ">=0.0.13",
63
- "@tabler/icons-react": "^3.0.0",
61
+ "@epam/ai-dial-ui-kit": ">=0.14.0-0",
62
+ "@epam/pdf-highlighter-kit": ">=0.0.18",
63
+ "@tabler/icons-react": "^3.44.0",
64
64
  "pdfjs-dist": ">=4.0.0",
65
65
  "react": ">=18",
66
66
  "react-dom": ">=18"
@@ -73,21 +73,26 @@
73
73
  "overrides": {
74
74
  "minimatch": ">=3.1.4",
75
75
  "picomatch": ">=2.3.2",
76
- "tar": ">=7.5.11"
76
+ "tar": ">=7.5.11",
77
+ "brace-expansion": ">=5.0.9",
78
+ "ip-address": ">=10.3.1",
79
+ "@eslint/eslintrc": {
80
+ "minimatch": "5.1.6"
81
+ }
77
82
  },
78
83
  "devDependencies": {
79
- "@chromatic-com/storybook": "^4.1.3",
80
- "@epam/ai-dial-ui-kit": "0.9.0-rc.20",
81
- "@epam/pdf-highlighter-kit": "^0.0.13",
84
+ "@chromatic-com/storybook": "^5.2.1",
85
+ "@epam/ai-dial-ui-kit": "^0.14.0-dev.4",
86
+ "@epam/pdf-highlighter-kit": "^0.0.18",
82
87
  "@eslint/compat": "^1.3.1",
83
88
  "@eslint/eslintrc": "^3.3.1",
84
89
  "@eslint/js": "^9.31.0",
85
90
  "@modelcontextprotocol/sdk": "^1.29.0",
86
- "@storybook/addon-a11y": "^10.2.17",
87
- "@storybook/addon-docs": "^10.2.17",
88
- "@storybook/addon-vitest": "^10.2.17",
89
- "@storybook/react-vite": "^10.2.17",
90
- "@tabler/icons-react": "^3.36.1",
91
+ "@storybook/addon-a11y": "^10.4.6",
92
+ "@storybook/addon-docs": "^10.4.6",
93
+ "@storybook/addon-vitest": "^10.4.6",
94
+ "@storybook/react-vite": "^10.4.6",
95
+ "@tabler/icons-react": "^3.44.0",
91
96
  "@testing-library/dom": "^10.4.0",
92
97
  "@testing-library/react": "^16.3.0",
93
98
  "@types/node": "^22.15.30",
@@ -104,7 +109,7 @@
104
109
  "eslint-plugin-react": "7.37.5",
105
110
  "eslint-plugin-react-hooks": "^5.2.0",
106
111
  "eslint-plugin-react-refresh": "^0.4.20",
107
- "eslint-plugin-storybook": "^10.2.17",
112
+ "eslint-plugin-storybook": "^10.4.6",
108
113
  "globals": "^16.3.0",
109
114
  "husky": "^9.1.7",
110
115
  "jsdom": "^26.1.0",
@@ -114,7 +119,7 @@
114
119
  "postcss-import": "^16.1.1",
115
120
  "prettier": "3.6.2",
116
121
  "sass": "^1.89.2",
117
- "storybook": "^10.2.17",
122
+ "storybook": "^10.4.6",
118
123
  "tailwindcss": "^3.4.17",
119
124
  "typescript": "~5.9.3",
120
125
  "typescript-eslint": "^8.48.0",