@harpercollins/harpercollins-design-system 1.8.17 → 1.8.20

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.
@@ -1369,5 +1369,5 @@ function wl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Obj
1369
1369
  }
1370
1370
  `,fs=Qt.div`
1371
1371
  position: relative;
1372
- `;let ps=1;const gs=e.forwardRef((({children:n,side:o,open:r=!1,showWarning:i,onClose:a=(()=>{})},l)=>{const s=e.useRef(null),c=e.useRef(null);s.current||(s.current=`modal-${ps}`,ps+=1),e.useEffect((()=>{document.body.style.overflow=r?"hidden":"auto"}),[r]),e.useEffect((()=>{const e=e=>{"Escape"===e.key&&(e.preventDefault(),a())};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[a]),e.useEffect((()=>{const e=e=>{c.current&&e.target instanceof HTMLElement&&!c.current.contains(e.target)&&(e.preventDefault(),a())};return document.body.addEventListener("mouseup",e),()=>{document.body.removeEventListener("mouseup",e)}}),[a]);const u=r?"open":"closing";return t.jsxs(t.Fragment,{children:[t.jsx(Ql,{className:u}),t.jsx(as,{role:"dialog","aria-modal":"true","aria-hidden":!r,className:`${o} ${u}`,children:t.jsx(Xl,{children:t.jsx("div",{children:t.jsx(ls,{children:t.jsxs(ss,{ref:c,children:[i&&t.jsxs(ds,{role:"alert","aria-live":"assertive",children:[t.jsx(Pn,{name:"fa/exclamation-triangle-solid"}),t.jsxs("p",{children:[t.jsx("strong",{children:"You have unsaved changes."})," Please save or cancel before closing."]})]}),t.jsx(fs,{ref:l,children:t.jsx(Zl,{children:n})})]})})})})})]})}));exports.Accordion=function({title:n,children:o,open:r=!1}){const[i,a]=e.useState(r);return t.jsxs(zn,{children:[t.jsx(Fn,{children:t.jsx(an,{as:"h3",children:t.jsxs(In,{type:"button","aria-expanded":i,onClick:()=>a(!i),"aria-controls":"accordion-content",children:[n,t.jsxs("span",{children:[i?t.jsx(Pn,{name:"fa/chevron-up-solid"}):t.jsx(Pn,{name:"fa/chevron-down-solid"})," "]})]})})}),t.jsx(Mn,{"aria-labelledby":"accordion-button",hidden:!i,role:"region",children:o})]})},exports.AppBar=function({apps:e,currentApp:n,leftSide:o,rightSide:r}){return t.jsxs(fa,{children:[t.jsx(pa,{href:"/",children:t.jsx(la,{})}),t.jsx(va,{apps:e,currentApp:n}),t.jsx(ha,{children:o}),t.jsx(ga,{children:r})]})},exports.Badge=function({children:e,...n}){return t.jsx(Tn,{...n,children:e})},exports.Breadcrumb=Ca,exports.Button=Qn,exports.Divider=_n,exports.DropDownMenu=da,exports.GlobalStyles=on,exports.Heading=an,exports.Icon=Pn,exports.Layout=function({children:e,header:n,footer:o}){return t.jsxs(ba,{children:[n,t.jsx(ya,{children:e}),o]})},exports.LoadingSpinner=function(e){return t.jsxs(Ln,{children:[t.jsx(Nn,{...e}),t.jsx($n,{children:"Loading"})]})},exports.Logo=la,exports.Modal=gs,exports.ProgressBar=function({ariaLabel:e,percentage:n}){return t.jsx(ea,{role:"progressbar","aria-label":e,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n,children:t.jsx(ta,{style:{width:`${n}%`}})})},exports.ProgressCircle=function({size:n="medium",value:o=0,kind:r="default",trafficLightRanges:i={red:{min:0,max:20,text:""},redLow:{min:20,max:40,text:""},orange:{min:40,max:60,text:""},green:{min:60,max:80,text:""},greenHigh:{min:80,max:100,text:""}}}){const a={mini:"0.8rem",tiny:"1rem",small:"1.2rem",medium:"1.6rem",large:"2rem"}[n],l={mini:50,tiny:75,small:100,medium:150,large:200}[n],s=(({kind:e,percentage:t,trafficLightRanges:n})=>{const o="var(--color--primary)",r="var(--color--danger)",i="var(--color--green-dark)",a="var(--color--red)",l="var(--color--orange-dark)",s="var(--color--green-dark)";return(()=>{if("traffic-light"===e){const e=Object.entries(n).find((([,e])=>t>=e.min&&t<=e.max))?.[0];return"red"===e||"redLow"===e?a:"orange"===e?l:"green"===e||"greenHigh"===e?s:"#d7d7d7"}return"danger"===e?r:"success"===e?i:"default"===e?o:"#d7d7d7"})()})({kind:r,percentage:Math.round(o),trafficLightRanges:i}),c=l/7,[u,d]=e.useState(0);e.useEffect((()=>{d(o)}),[o]);const f=(l-c)/2,p=f*Math.PI*2,g=u*p/100,h=`0 0 ${l} ${l}`;return t.jsxs("svg",{width:l,height:l,viewBox:h,children:[t.jsx("circle",{fill:"white",stroke:"#d7d7d7",cx:l/2,cy:l/2,r:f,strokeWidth:`${c}px`}),t.jsx("circle",{fill:"none",stroke:s,cx:l/2,cy:l/2,r:f,strokeWidth:`${c}px`,transform:`rotate(-90 ${l/2} ${l/2})`,strokeDasharray:`${g}, ${p-g}`,strokeLinecap:"round",style:{transition:"all 0.5s"}}),t.jsx("text",{fill:"black",fontSize:a,fontWeight:"bold",x:"50%",y:"50%",dy:"6%",textAnchor:"middle",children:(m=o,m>=0&&m<=100?`${o}%`:"-")})]});var m},exports.ReadMore=function({children:n,maxLines:o=3}){const[r,i]=e.useState(!1),a=e.useRef(null),[l,s]=e.useState(!1),c=()=>{const{offsetHeight:e,scrollHeight:t}=a.current||{};s(!!(e&&t&&e<t))};return e.useLayoutEffect((()=>(window.addEventListener("resize",c),()=>window.removeEventListener("resize",c))),[a]),e.useEffect((()=>{c()}),[]),t.jsxs(eo,{children:[t.jsx(to,{$maxLines:r?void 0:o,ref:a,children:n}),o&&l&&t.jsx(no,{type:"button",kind:"basic",onClick:()=>i(!r),children:r?"Read less":"Read more"})]})},exports.RelativeTime=function({time:n}){const[o,r]=e.useState((()=>new Date)),i=e.useMemo((()=>new Date(n)),[n]);e.useEffect((()=>{r(new Date)}),[n]),e.useEffect((()=>{if(Math.abs(i.getTime()/1e3-o.getTime()/1e3)<86400){const e=setTimeout((()=>{r(new Date)}),1e4);return()=>{clearTimeout(e)}}return()=>{}}),[o,i]);const a=e.useMemo((()=>{const e=Math.abs(i.getTime()/1e3-o.getTime()/1e3),t=i>o;if(e<60&&!t)return"just now";if(e>604800)return`${i.getDate()} ${oo[i.getMonth()]} ${i.getFullYear()}`;let n;return n=e<120?"a minute":e<2700?`${Math.ceil(e/60).toString()} minutes`:e<5400?"an hour":e<86400?`${Math.ceil(e/3600).toString()} hours`:e<172800?"one day":`${Math.ceil(e/86400).toString()} days`,t?`in ${n}`:`${n} ago`}),[i,o]);return t.jsx("time",{dateTime:i.toISOString(),title:i.toLocaleString(),children:a})},exports.StatusIcon=function({status:e="uploaded",size:n="medium"}){const o=e.charAt(0).toUpperCase()+e.slice(1),r={uploaded:t.jsx(Tr,{size:n}),running:t.jsx(Nr,{size:n}),processed:t.jsx(_r,{size:n}),reviewed:t.jsx(Ar,{size:n}),warning:t.jsx(Lr,{size:n}),failed:t.jsx($r,{size:n})};return t.jsx(Vr,{content:o,children:t.jsx(Hr,{status:e,"aria-label":o,children:r[e]})})},exports.Table=function({data:n,columns:o,pageCount:i,totalCount:a,next:l,previous:s,page:c,pageable:u,pageSize:d}){const[f,p]=e.useState((()=>[...n])),[g,h]=e.useState({pageIndex:0,pageSize:d||10}),m=function(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=r.useState((()=>({current:Ti(t)}))),[o,i]=r.useState((()=>n.current.initialState));return n.current.setOptions((t=>({...t,...e,state:{...o,...e.state},onStateChange:t=>{i(t),null==e.onStateChange||e.onStateChange(t)}}))),n.current}({columns:o,data:f,getCoreRowModel:e=>Ur((()=>[e.options.data]),(t=>{const n={rows:[],flatRows:[],rowsById:{}},o=function(t,r,i){void 0===r&&(r=0);const a=[];for(let s=0;s<t.length;s++){const c=Zr(e,e._getRowId(t[s],s,i),t[s],s,r,void 0,null==i?void 0:i.id);var l;n.flatRows.push(c),n.rowsById[c.id]=c,a.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(t[s],s),null!=(l=c.originalSubRows)&&l.length&&(c.subRows=o(c.originalSubRows,r+1,c)))}return a};return n.rows=o(t),n}),Wr(e.options,"debugTable","getRowModel",(()=>e._autoResetPageIndex()))),pageCount:i,state:{pagination:e.useMemo((()=>({pageIndex:g.pageIndex,pageSize:g.pageSize})),[g.pageIndex,g.pageSize])},onPaginationChange:h,manualPagination:!0});return e.useEffect((()=>{void 0!==c&&m.setPageIndex(Number(c-1))}),[c,m]),e.useEffect((()=>{p(n)}),[n]),t.jsxs(Ni,{children:[m.getHeaderGroups().map((e=>t.jsx("thead",{children:t.jsx("tr",{children:e.headers.map((e=>t.jsx("th",{key:e.id,colSpan:e.colSpan,style:{width:e.getSize()},children:e.isPlaceholder?null:_i(e.column.columnDef.header,e.getContext())})))},e.id)}))),t.jsx("tbody",{children:m.getRowModel().rows.map((e=>t.jsx("tr",{children:e.getVisibleCells().map((e=>t.jsx("td",{key:e.id,style:{width:e.column.getSize()},children:_i(e.column.columnDef.cell,e.getContext())})))},e.id)))}),t.jsx("tfoot",{children:t.jsxs(Li,{children:[void 0!==a?t.jsxs("div",{children:["Total: ",a]}):null,u?t.jsxs($i,{children:[t.jsx(Qn,{type:"link",href:m.getCanPreviousPage()?window.location.href:"",disabled:!m.getCanPreviousPage(),children:"<<"}),t.jsx(Qn,{type:"link",href:m.getCanPreviousPage()&&s?s:"",disabled:!m.getCanPreviousPage(),children:"<"}),t.jsx(Qn,{type:"link",href:m.getCanNextPage()&&l?l:"",disabled:!m.getCanNextPage(),children:">"}),t.jsx(Qn,{href:m.getCanNextPage()?`${window.location.href}?page=${String(i)}`:"",type:"link",disabled:!m.getCanNextPage(),children:">>"}),t.jsxs("span",{children:[t.jsx("div",{children:"Page"}),t.jsxs("strong",{children:[m.getState().pagination.pageIndex+1," of"," ",m.getPageCount()]})]})]}):null]})})]})},exports.Tabs=function({tabsConfig:n=[],defaultIndex:o=0}){const[r,i]=e.useState(o),a=e.useRef(null),l=e.useRef([]),[s,c]=e.useState(!1),[u,d]=e.useState({right:!1,left:!0}),f=e=>{if(!a.current)return;const t=l.current[e];t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})},p=e=>{const t=l.current[e];t&&t.focus(),f(e)},g=e=>{const t=n.length,o={ArrowRight:()=>p((r+1)%t),ArrowLeft:()=>p((r-1+t)%t),Home:()=>p(0),End:()=>p(t-1)}[e.key];o&&(e.preventDefault(),o())},h=(e,t)=>{if(!e)return;let n=0;const o=setInterval((()=>{e.scrollLeft+=t,n+=Math.abs(t),n>=100&&clearInterval(o)}),20);d({left:e.scrollLeft<=0,right:e.scrollLeft+e.offsetWidth>=e.scrollWidth})};return e.useEffect((()=>{a.current&&c(a.current.offsetWidth<a.current.scrollWidth)}),[]),e.useLayoutEffect((()=>{const e=()=>{if(!a.current)return;const{offsetWidth:e,scrollWidth:t}=a.current;c(e<t)};return window.addEventListener("resize",e,!1),()=>{window.removeEventListener("resize",e)}}),[]),t.jsxs(Hi,{children:[t.jsxs(Gi,{role:"tablist","aria-orientation":"horizontal",children:[s&&t.jsxs(Ui,{onClick:()=>a.current&&h(a.current,-30),className:"left-arrow","aria-label":"Left arrow",disabled:u.left,children:[t.jsx(Pn,{name:"fa/chevron-left-solid",size:"large"})," "]}),t.jsx(Bi,{ref:a,children:n.length>0?n.map(((e,n)=>t.jsx(qi,{type:"button",onClick:()=>(e=>{f(e),i(e)})(n),role:"tab",ref:e=>{e&&(l.current[n]=e)},"aria-controls":`panel-id-${n}`,"aria-selected":r===n,id:`tab-id-${n}`,onKeyDown:g,onFocus:()=>i(n),tabIndex:r===n?0:-1,children:e.label},`tab-${e.label}`))):t.jsx("div",{children:"No tab content to display"})}),s&&t.jsx(Ui,{onClick:()=>a.current&&h(a.current,30),className:"right-arrow","aria-label":"Right arrow",disabled:u.right,children:t.jsx(Pn,{name:"fa/chevron-right-solid",size:"large"})})]}),t.jsx(Wi,{children:n.map(((e,n)=>t.jsxs(Yi,{role:"tabpanel","aria-labelledby":`tab-id-${n}`,id:`panel-id-${n}`,$show:r===n,tabIndex:0,children:[e.label?t.jsx(an,{as:"h2",children:e.label}):null,e.content]},`tabpanel-${e.label}`)))})]})},exports.TextField=function({label:e,content:n,size:o,inline:r=!1}){return t.jsxs(Zi,{$inline:r,children:[e?t.jsx(Ki,{$size:o,children:e}):null,n?t.jsx(Ji,{$size:o,children:n}):null]})},exports.ToastMessages=function({messages:e}){return t.jsx(na,{children:t.jsx(oa,{style:{top:`-${55*e.length}px`},children:e.map((e=>t.jsx(ia,{message:e},String(e))))})})},exports.Tooltip=Vr;
1372
+ `;let ps=1;const gs=e.forwardRef((({children:n,side:o,open:r=!1,showWarning:i,onClose:a=(()=>{})},l)=>{const s=e.useRef(null),c=e.useRef(null);s.current||(s.current=`modal-${ps}`,ps+=1),e.useEffect((()=>{document.body.style.overflow=r?"hidden":"auto"}),[r]),e.useEffect((()=>{const e=e=>{"Escape"===e.key&&(e.preventDefault(),a())};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[a]),e.useEffect((()=>{const e=e=>{c.current&&e.target instanceof HTMLElement&&!c.current.contains(e.target)&&(e.preventDefault(),a())};return document.body.addEventListener("mouseup",e),()=>{document.body.removeEventListener("mouseup",e)}}),[a]);const u=r?"open":"closing";return t.jsxs(t.Fragment,{children:[t.jsx(Ql,{className:u}),t.jsx(as,{role:"dialog","aria-modal":"true","aria-hidden":!r,className:`${o} ${u}`,children:t.jsx(Xl,{children:t.jsx("div",{children:t.jsx(ls,{children:t.jsxs(ss,{ref:c,children:[i&&t.jsxs(ds,{role:"alert","aria-live":"assertive",children:[t.jsx(Pn,{name:"fa/exclamation-triangle-solid"}),t.jsxs("p",{children:[t.jsx("strong",{children:"You have unsaved changes."})," Please save or cancel before closing."]})]}),t.jsx(fs,{ref:l,children:t.jsx(Zl,{children:n})})]})})})})})]})}));exports.Accordion=function({title:n,children:o,open:r=!1}){const[i,a]=e.useState(r);return t.jsxs(zn,{children:[t.jsx(Fn,{children:t.jsx(an,{as:"h3",children:t.jsxs(In,{type:"button","aria-expanded":i,onClick:()=>a(!i),"aria-controls":"accordion-content",children:[n,t.jsxs("span",{children:[i?t.jsx(Pn,{name:"fa/chevron-up-solid"}):t.jsx(Pn,{name:"fa/chevron-down-solid"})," "]})]})})}),t.jsx(Mn,{"aria-labelledby":"accordion-button",hidden:!i,role:"region",children:o})]})},exports.AppBar=function({apps:e,currentApp:n,leftSide:o,rightSide:r}){return t.jsxs(fa,{children:[t.jsx(pa,{href:"/",children:t.jsx(la,{})}),t.jsx(va,{apps:e,currentApp:n}),t.jsx(ha,{children:o}),t.jsx(ga,{children:r})]})},exports.Badge=function({children:e,...n}){return t.jsx(Tn,{...n,children:e})},exports.Breadcrumb=Ca,exports.Button=Qn,exports.Divider=_n,exports.DropDownMenu=da,exports.GlobalStyles=on,exports.Heading=an,exports.Icon=Pn,exports.Layout=function({children:e,header:n,footer:o}){return t.jsxs(ba,{children:[t.jsx(on,{}),n,t.jsx(ya,{children:e}),o]})},exports.LoadingSpinner=function(e){return t.jsxs(Ln,{children:[t.jsx(Nn,{...e}),t.jsx($n,{children:"Loading"})]})},exports.Logo=la,exports.Modal=gs,exports.ProgressBar=function({ariaLabel:e,percentage:n}){return t.jsx(ea,{role:"progressbar","aria-label":e,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n,children:t.jsx(ta,{style:{width:`${n}%`}})})},exports.ProgressCircle=function({size:n="medium",value:o=0,kind:r="default",trafficLightRanges:i={red:{min:0,max:20,text:""},redLow:{min:20,max:40,text:""},orange:{min:40,max:60,text:""},green:{min:60,max:80,text:""},greenHigh:{min:80,max:100,text:""}}}){const a={mini:"0.8rem",tiny:"1rem",small:"1.2rem",medium:"1.6rem",large:"2rem"}[n],l={mini:50,tiny:75,small:100,medium:150,large:200}[n],s=(({kind:e,percentage:t,trafficLightRanges:n})=>{const o="var(--color--primary)",r="var(--color--danger)",i="var(--color--green-dark)",a="var(--color--red)",l="var(--color--orange-dark)",s="var(--color--green-dark)";return(()=>{if("traffic-light"===e){const e=Object.entries(n).find((([,e])=>t>=e.min&&t<=e.max))?.[0];return"red"===e||"redLow"===e?a:"orange"===e?l:"green"===e||"greenHigh"===e?s:"#d7d7d7"}return"danger"===e?r:"success"===e?i:"default"===e?o:"#d7d7d7"})()})({kind:r,percentage:Math.round(o),trafficLightRanges:i}),c=l/7,[u,d]=e.useState(0);e.useEffect((()=>{d(o)}),[o]);const f=(l-c)/2,p=f*Math.PI*2,g=u*p/100,h=`0 0 ${l} ${l}`;return t.jsxs("svg",{width:l,height:l,viewBox:h,children:[t.jsx("circle",{fill:"white",stroke:"#d7d7d7",cx:l/2,cy:l/2,r:f,strokeWidth:`${c}px`}),t.jsx("circle",{fill:"none",stroke:s,cx:l/2,cy:l/2,r:f,strokeWidth:`${c}px`,transform:`rotate(-90 ${l/2} ${l/2})`,strokeDasharray:`${g}, ${p-g}`,strokeLinecap:"round",style:{transition:"all 0.5s"}}),t.jsx("text",{fill:"black",fontSize:a,fontWeight:"bold",x:"50%",y:"50%",dy:"6%",textAnchor:"middle",children:(m=o,m>=0&&m<=100?`${o}%`:"-")})]});var m},exports.ReadMore=function({children:n,maxLines:o=3}){const[r,i]=e.useState(!1),a=e.useRef(null),[l,s]=e.useState(!1),c=()=>{const{offsetHeight:e,scrollHeight:t}=a.current||{};s(!!(e&&t&&e<t))};return e.useLayoutEffect((()=>(window.addEventListener("resize",c),()=>window.removeEventListener("resize",c))),[a]),e.useEffect((()=>{c()}),[]),t.jsxs(eo,{children:[t.jsx(to,{$maxLines:r?void 0:o,ref:a,children:n}),o&&l&&t.jsx(no,{type:"button",kind:"basic",onClick:()=>i(!r),children:r?"Read less":"Read more"})]})},exports.RelativeTime=function({time:n}){const[o,r]=e.useState((()=>new Date)),i=e.useMemo((()=>new Date(n)),[n]);e.useEffect((()=>{r(new Date)}),[n]),e.useEffect((()=>{if(Math.abs(i.getTime()/1e3-o.getTime()/1e3)<86400){const e=setTimeout((()=>{r(new Date)}),1e4);return()=>{clearTimeout(e)}}return()=>{}}),[o,i]);const a=e.useMemo((()=>{const e=Math.abs(i.getTime()/1e3-o.getTime()/1e3),t=i>o;if(e<60&&!t)return"just now";if(e>604800)return`${i.getDate()} ${oo[i.getMonth()]} ${i.getFullYear()}`;let n;return n=e<120?"a minute":e<2700?`${Math.ceil(e/60).toString()} minutes`:e<5400?"an hour":e<86400?`${Math.ceil(e/3600).toString()} hours`:e<172800?"one day":`${Math.ceil(e/86400).toString()} days`,t?`in ${n}`:`${n} ago`}),[i,o]);return t.jsx("time",{dateTime:i.toISOString(),title:i.toLocaleString(),children:a})},exports.StatusIcon=function({status:e="uploaded",size:n="medium"}){const o=e.charAt(0).toUpperCase()+e.slice(1),r={uploaded:t.jsx(Tr,{size:n}),running:t.jsx(Nr,{size:n}),processed:t.jsx(_r,{size:n}),reviewed:t.jsx(Ar,{size:n}),warning:t.jsx(Lr,{size:n}),failed:t.jsx($r,{size:n})};return t.jsx(Vr,{content:o,children:t.jsx(Hr,{status:e,"aria-label":o,children:r[e]})})},exports.Table=function({data:n,columns:o,pageCount:i,totalCount:a,next:l,previous:s,page:c,pageable:u,pageSize:d}){const[f,p]=e.useState((()=>[...n])),[g,h]=e.useState({pageIndex:0,pageSize:d||10}),m=function(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=r.useState((()=>({current:Ti(t)}))),[o,i]=r.useState((()=>n.current.initialState));return n.current.setOptions((t=>({...t,...e,state:{...o,...e.state},onStateChange:t=>{i(t),null==e.onStateChange||e.onStateChange(t)}}))),n.current}({columns:o,data:f,getCoreRowModel:e=>Ur((()=>[e.options.data]),(t=>{const n={rows:[],flatRows:[],rowsById:{}},o=function(t,r,i){void 0===r&&(r=0);const a=[];for(let s=0;s<t.length;s++){const c=Zr(e,e._getRowId(t[s],s,i),t[s],s,r,void 0,null==i?void 0:i.id);var l;n.flatRows.push(c),n.rowsById[c.id]=c,a.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(t[s],s),null!=(l=c.originalSubRows)&&l.length&&(c.subRows=o(c.originalSubRows,r+1,c)))}return a};return n.rows=o(t),n}),Wr(e.options,"debugTable","getRowModel",(()=>e._autoResetPageIndex()))),pageCount:i,state:{pagination:e.useMemo((()=>({pageIndex:g.pageIndex,pageSize:g.pageSize})),[g.pageIndex,g.pageSize])},onPaginationChange:h,manualPagination:!0});return e.useEffect((()=>{void 0!==c&&m.setPageIndex(Number(c-1))}),[c,m]),e.useEffect((()=>{p(n)}),[n]),t.jsxs(Ni,{children:[m.getHeaderGroups().map((e=>t.jsx("thead",{children:t.jsx("tr",{children:e.headers.map((e=>t.jsx("th",{key:e.id,colSpan:e.colSpan,style:{width:e.getSize()},children:e.isPlaceholder?null:_i(e.column.columnDef.header,e.getContext())})))},e.id)}))),t.jsx("tbody",{children:m.getRowModel().rows.map((e=>t.jsx("tr",{children:e.getVisibleCells().map((e=>t.jsx("td",{key:e.id,style:{width:e.column.getSize()},children:_i(e.column.columnDef.cell,e.getContext())})))},e.id)))}),t.jsx("tfoot",{children:t.jsxs(Li,{children:[void 0!==a?t.jsxs("div",{children:["Total: ",a]}):null,u?t.jsxs($i,{children:[t.jsx(Qn,{type:"link",href:m.getCanPreviousPage()?window.location.href:"",disabled:!m.getCanPreviousPage(),children:"<<"}),t.jsx(Qn,{type:"link",href:m.getCanPreviousPage()&&s?s:"",disabled:!m.getCanPreviousPage(),children:"<"}),t.jsx(Qn,{type:"link",href:m.getCanNextPage()&&l?l:"",disabled:!m.getCanNextPage(),children:">"}),t.jsx(Qn,{href:m.getCanNextPage()?`${window.location.href}?page=${String(i)}`:"",type:"link",disabled:!m.getCanNextPage(),children:">>"}),t.jsxs("span",{children:[t.jsx("div",{children:"Page"}),t.jsxs("strong",{children:[m.getState().pagination.pageIndex+1," of"," ",m.getPageCount()]})]})]}):null]})})]})},exports.Tabs=function({tabsConfig:n=[],defaultIndex:o=0}){const[r,i]=e.useState(o),a=e.useRef(null),l=e.useRef([]),[s,c]=e.useState(!1),[u,d]=e.useState({right:!1,left:!0}),f=e=>{if(!a.current)return;const t=l.current[e];t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})},p=e=>{const t=l.current[e];t&&t.focus(),f(e)},g=e=>{const t=n.length,o={ArrowRight:()=>p((r+1)%t),ArrowLeft:()=>p((r-1+t)%t),Home:()=>p(0),End:()=>p(t-1)}[e.key];o&&(e.preventDefault(),o())},h=(e,t)=>{if(!e)return;let n=0;const o=setInterval((()=>{e.scrollLeft+=t,n+=Math.abs(t),n>=100&&clearInterval(o)}),20);d({left:e.scrollLeft<=0,right:e.scrollLeft+e.offsetWidth>=e.scrollWidth})};return e.useEffect((()=>{a.current&&c(a.current.offsetWidth<a.current.scrollWidth)}),[]),e.useLayoutEffect((()=>{const e=()=>{if(!a.current)return;const{offsetWidth:e,scrollWidth:t}=a.current;c(e<t)};return window.addEventListener("resize",e,!1),()=>{window.removeEventListener("resize",e)}}),[]),t.jsxs(Hi,{children:[t.jsxs(Gi,{role:"tablist","aria-orientation":"horizontal",children:[s&&t.jsxs(Ui,{onClick:()=>a.current&&h(a.current,-30),className:"left-arrow","aria-label":"Left arrow",disabled:u.left,children:[t.jsx(Pn,{name:"fa/chevron-left-solid",size:"large"})," "]}),t.jsx(Bi,{ref:a,children:n.length>0?n.map(((e,n)=>t.jsx(qi,{type:"button",onClick:()=>(e=>{f(e),i(e)})(n),role:"tab",ref:e=>{e&&(l.current[n]=e)},"aria-controls":`panel-id-${n}`,"aria-selected":r===n,id:`tab-id-${n}`,onKeyDown:g,onFocus:()=>i(n),tabIndex:r===n?0:-1,children:e.label},`tab-${e.label}`))):t.jsx("div",{children:"No tab content to display"})}),s&&t.jsx(Ui,{onClick:()=>a.current&&h(a.current,30),className:"right-arrow","aria-label":"Right arrow",disabled:u.right,children:t.jsx(Pn,{name:"fa/chevron-right-solid",size:"large"})})]}),t.jsx(Wi,{children:n.map(((e,n)=>t.jsxs(Yi,{role:"tabpanel","aria-labelledby":`tab-id-${n}`,id:`panel-id-${n}`,$show:r===n,tabIndex:0,children:[e.label?t.jsx(an,{as:"h2",children:e.label}):null,e.content]},`tabpanel-${e.label}`)))})]})},exports.TextField=function({label:e,content:n,size:o,inline:r=!1}){return t.jsxs(Zi,{$inline:r,children:[e?t.jsx(Ki,{$size:o,children:e}):null,n?t.jsx(Ji,{$size:o,children:n}):null]})},exports.ToastMessages=function({messages:e}){return t.jsx(na,{children:t.jsx(oa,{style:{top:`-${55*e.length}px`},children:e.map((e=>t.jsx(ia,{message:e},String(e))))})})},exports.Tooltip=Vr,exports.useToggle=function(t){const[n,o]=e.useState(t);return{value:n,toggle:e.useCallback((()=>o((e=>!e))),[]),setTrue:e.useCallback((()=>o(!0)),[]),setFalse:e.useCallback((()=>o(!1)),[])}};
1373
1373
  //# sourceMappingURL=index.cjs.map