@harpercollins/harpercollins-design-system 1.31.0 → 1.32.0

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";const t=require("react/jsx-runtime"),C=require("../../../node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),m=require("../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tanstack/react-table/build/lib/index.cjs"),s=require("react"),Se=require("../../../hooks/useLocalStorage.cjs"),xe=require("../../feedback/Alert/Alert.cjs"),T=require("../../feedback/CircularProgress/CircularProgress.cjs"),B=require("../../inputs/Checkbox/Checkbox.cjs"),h=require("../Icon/Icon.cjs"),Ce=require("../Typography/Typography.cjs"),he=require("./StickyHorizontalScrollbar.cjs"),f=require("./Table.styles.cjs"),A=require("./Table.types.cjs"),Re=require("./TableBody.cjs"),ze=require("./TableToolbar.cjs"),pe=require("./filters/FilterComponents.cjs"),S=require("./filters/filterFunctions.cjs"),je=require("./hooks/useInfiniteScroll.cjs"),we=require("./hooks/useStickyHeader.cjs"),be=require("./hooks/useStickyScrollbar.cjs"),w=require("../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Box/Box.cjs"),Fe=require("../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Table/Table.cjs"),b=require("../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.cjs");function ye({table:l}){return t.jsx(B,{checked:l.getIsAllRowsSelected(),indeterminate:l.getIsSomeRowsSelected(),onChange:a=>l.toggleAllRowsSelected(a.target.checked),size:"md"})}function qe({row:l}){return t.jsx(B,{checked:l.getIsSelected(),disabled:!l.getCanSelect(),onChange:a=>l.toggleSelected(a.target.checked),size:"md"})}function De({id:l,loading:a=!1,maxHeight:F=!1,wrapText:E=!1,rowRender:L,reactTableOptions:r,gridCheckboxes:R=!1,allSelected:z=!1,onSelectionChange:y,showStickyScrollbar:V=!1,enableStickyHeader:W=!1,stickyHeaderOffset:_=0,infiniteScroll:u,toolbar:q,footer:U,isError:G=!1,errorMessage:J="An error occurred while loading data. Please try again."}){const[K,Q]=s.useState([]),[X,Y]=s.useState([]),[Z,O]=Se.useLocalStorage(`table.${l}.columnSizing`,{}),[ee,te]=s.useState({}),ne=s.useCallback(n=>{te(e=>{const o=typeof n=="function"?n(e):n;return y?.(o),o})},[y]),D=s.useRef(null),p=s.useRef(r.data),oe=a&&p.current.length>0?p.current:r.data;s.useEffect(()=>{!a&&r.data.length>0&&(p.current=r.data)},[a,r.data]);const d=s.useRef(null),k=s.useRef(null),H=s.useRef(null),re=be.useStickyScrollbar(d),se=we.useStickyHeader({enabled:W,stickyHeaderOffset:_,tableWrapperRef:d,theadRef:k,toolbarRef:H}),{columns:x}=r,le=s.useMemo(()=>{const n=[],e=[];return x.forEach(o=>{o.meta?.pinned==="left"&&o.id?n.push(o.id):o.meta?.pinned==="right"&&o.id&&e.push(o.id)}),{left:n,right:e}},[x]),ie=s.useMemo(()=>{let n=[...x];return n=n.map(e=>{const o=e.meta?.filterType;if(o&&!e.filterFn){const c={text:S.textFilter,number:S.numericFilter,date:S.dateFilter,select:S.selectFilter,multiselect:S.multiSelectFilter};return{...e,filterFn:c[o]}}return e}),R&&(n=[{id:"select",size:22,enableSorting:!1,enableResizing:!1,meta:{noSortButton:!0},header:ye,cell:qe},...n]),n},[R,x]),i=m.useReactTable({columnResizeDirection:"ltr",defaultColumn:{size:200,minSize:20,maxSize:500},...r,getCoreRowModel:b.getCoreRowModel(),getSortedRowModel:b.getSortedRowModel(),getFilteredRowModel:b.getFilteredRowModel(),columns:ie,data:oe,enableSorting:r.enableSorting??!0,enableColumnResizing:r.enableColumnResizing??!0,columnResizeMode:r.columnResizeMode??"onChange",onColumnSizingChange:r.onColumnSizingChange??O,onSortingChange:r.onSortingChange??Q,onColumnFiltersChange:r.onColumnFiltersChange??Y,enableRowSelection:R&&!z,onRowSelectionChange:r.onRowSelectionChange??ne,state:{...r.state,rowSelection:r.state?.rowSelection??ee,sorting:r.state?.sorting??K,columnFilters:r.state?.columnFilters??X,columnSizing:Z,columnPinning:le}}),{rows:M}=i.getRowModel(),{enabled:g,virtualItems:ce,paddingTop:ae,paddingBottom:ue,measureElement:de}=je.useInfiniteScroll(M.length,u,d),I=u?.enabled,$=u?.hasNextPage,v=u?.isFetchingNextPage,N=u?.fetchNextPage,ge=200,j=s.useCallback(n=>{if(!n||!I)return;const{scrollHeight:e,scrollTop:o,clientHeight:c}=n;e-o-c<ge&&!v&&$&&N?.()},[I,$,v,N]);s.useEffect(()=>{j(d.current)},[j]),D.current=i,s.useEffect(()=>{D.current?.toggleAllRowsSelected(z)},[z]);const me=()=>{const n=i.getFlatHeaders(),e={};for(let o=0;o<n.length;o+=1){const c=n[o];e[`--${l}-header-${c.id}-size`]=c.getSize(),e[`--${l}-col-${c.column.id}-size`]=c.column.getSize()}return e},fe=s.useMemo(()=>i.getFlatHeaders().reduce((e,o)=>e+o.getSize(),0),[i.getState().columnSizingInfo,i.getState().columnSizing]);return t.jsxs(t.Fragment,{children:[G&&t.jsx(xe,{color:"danger",sx:{marginBottom:1},children:J}),q?.enabled&&t.jsx(ze,{ref:H,toolbar:q,columnFilters:i.getState().columnFilters,table:i}),t.jsxs(w,{sx:{position:"relative"},children:[a&&t.jsx(w,{sx:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255, 255, 255, 0.7)",display:"flex",justifyContent:"center",alignItems:"flex-start",zIndex:1,paddingTop:"10%"},children:t.jsx(T,{})}),t.jsx(f.TableWrapper,{ref:d,"data-testid":"table-wrapper",$maxHeight:F,onScroll:n=>j(n.currentTarget),children:t.jsxs(Fe,{hoverRow:!0,"data-testid":l,sx:f.getTableStyles(me(),fe,E,se,F),children:[i.getHeaderGroups().map(n=>t.jsx("thead",{ref:k,children:t.jsx("tr",{children:n.headers.map((e,o)=>{const c=o===n.headers.length-1,P=e.column.getIsPinned();return t.jsxs("th",{colSpan:e.colSpan,"data-pinned":P||void 0,style:{width:!P&&c?"auto":`calc(var(--${l}-header-${e.id}-size) * 1px)`},children:[e.isPlaceholder?null:t.jsxs(f.HeaderContent,{children:[e.column.columnDef.meta?.noSortButton?m.flexRender(e.column.columnDef.header,e.getContext()):e.column.getCanSort()?t.jsxs(f.SortButton,{type:"button","aria-label":`Sort ${e.id} column`,onClick:e.column.getToggleSortingHandler(),title:e.column.getNextSortingOrder()===A.SortDirection.ASC?"Sort ascending":e.column.getNextSortingOrder()===A.SortDirection.DESC?"Sort descending":"Clear sort",children:[m.flexRender(e.column.columnDef.header,e.getContext()),{asc:t.jsx(h,{icon:C.faArrowUp,size:"sm"}),desc:t.jsx(h,{icon:C.faArrowDown,size:"sm"})}[e.column.getIsSorted()]??(e.column.getNextSortingOrder()==="desc"?t.jsx(h,{icon:C.faArrowDown,size:"sm",className:"fade"}):t.jsx(h,{icon:C.faArrowUp,size:"sm",className:"fade"}))]}):t.jsx(f.ColumnHeaderContainer,{children:m.flexRender(e.column.columnDef.header,e.getContext())}),e.column.getCanFilter()&&e.column.columnDef.meta?.filterType&&t.jsx(pe.ColumnFilter,{column:e.column,filterType:e.column.columnDef.meta.filterType,filterOptions:e.column.columnDef.meta?.filterOptions,filterSearchable:e.column.columnDef.meta?.filterSearchable})]}),e.column.getCanResize()&&t.jsx("button",{type:"button","aria-label":`Resize ${e.id} column`,onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:`resizer ${e.column.getIsResizing()?"isResizing":""}`})]},e.id)})})},n.id)),t.jsx(Re.TableBody,{rows:M,columns:i.getAllColumns(),rowRender:L,loading:a,rowSelectionState:i.getState().rowSelection,virtualItems:g?ce:void 0,paddingTop:g?ae:void 0,paddingBottom:g?ue:void 0,measureElement:g?de:void 0}),U&&i.getFooterGroups().length>0&&t.jsx("tfoot",{children:i.getFooterGroups().map(n=>t.jsx("tr",{children:n.headers.map(e=>t.jsx("td",{colSpan:e.colSpan,children:m.flexRender(e.column.columnDef.footer,e.getContext())},e.id))},n.id))})]})})]}),g&&u?.isFetchingNextPage&&t.jsxs(w,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:1,padding:1},children:[t.jsx(T,{size:"sm"}),t.jsx(Ce,{children:u.loadingText??"Loading more..."})]}),V&&t.jsx(he,{scrollContainerRef:d,visible:re,constrainToContainer:"main"})]})}module.exports=De;
1
+ "use strict";const t=require("react/jsx-runtime"),C=require("../../../node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),m=require("../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tanstack/react-table/build/lib/index.cjs"),s=require("react"),Se=require("../../../hooks/useLocalStorage.cjs"),xe=require("../../feedback/Alert/Alert.cjs"),T=require("../../feedback/CircularProgress/CircularProgress.cjs"),B=require("../../inputs/Checkbox/Checkbox.cjs"),h=require("../Icon/Icon.cjs"),Ce=require("../Typography/Typography.cjs"),he=require("./StickyHorizontalScrollbar.cjs"),f=require("./Table.styles.cjs"),A=require("./Table.types.cjs"),Re=require("./TableBody.cjs"),ze=require("./TableToolbar.cjs"),pe=require("./filters/FilterComponents.cjs"),S=require("./filters/filterFunctions.cjs"),je=require("./hooks/useInfiniteScroll.cjs"),we=require("./hooks/useStickyHeader.cjs"),be=require("./hooks/useStickyScrollbar.cjs"),j=require("../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Box/Box.cjs"),Fe=require("../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Table/Table.cjs"),w=require("../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.cjs");function ye({table:l}){return t.jsx(B,{checked:l.getIsAllRowsSelected(),indeterminate:l.getIsSomeRowsSelected(),onChange:a=>l.toggleAllRowsSelected(a.target.checked),size:"md"})}function qe({row:l}){return t.jsx(B,{checked:l.getIsSelected(),disabled:!l.getCanSelect(),onChange:a=>l.toggleSelected(a.target.checked),size:"md"})}function De({id:l,loading:a=!1,maxHeight:b=!1,wrapText:E=!1,rowRender:L,reactTableOptions:r,gridCheckboxes:R=!1,allSelected:F=!1,onSelectionChange:y,showStickyScrollbar:V=!1,enableStickyHeader:W=!1,stickyHeaderOffset:_=0,infiniteScroll:u,toolbar:q,footer:U,isError:G=!1,errorMessage:J="An error occurred while loading data. Please try again."}){const[K,Q]=s.useState([]),[X,Y]=s.useState([]),[Z,O]=Se.useLocalStorage(`table.${l}.columnSizing`,{}),[ee,te]=s.useState({}),ne=s.useCallback(n=>{te(e=>{const o=typeof n=="function"?n(e):n;return y?.(o),o})},[y]),D=s.useRef(null),z=s.useRef(r.data),oe=a&&z.current.length>0?z.current:r.data;s.useEffect(()=>{!a&&r.data.length>0&&(z.current=r.data)},[a,r.data]);const d=s.useRef(null),k=s.useRef(null),H=s.useRef(null),re=be.useStickyScrollbar(d),se=we.useStickyHeader({enabled:W,stickyHeaderOffset:_,tableWrapperRef:d,theadRef:k,toolbarRef:H}),{columns:x}=r,le=s.useMemo(()=>{const n=[],e=[];return x.forEach(o=>{o.meta?.pinned==="left"&&o.id?n.push(o.id):o.meta?.pinned==="right"&&o.id&&e.push(o.id)}),{left:n,right:e}},[x]),ie=s.useMemo(()=>{let n=[...x];return n=n.map(e=>{const o=e.meta?.filterType;if(o&&!e.filterFn){const c={text:S.textFilter,number:S.numericFilter,date:S.dateFilter,select:S.selectFilter,multiselect:S.multiSelectFilter};return{...e,filterFn:c[o]}}return e}),R&&(n=[{id:"select",size:22,enableSorting:!1,enableResizing:!1,meta:{noSortButton:!0},header:ye,cell:qe},...n]),n},[R,x]),i=m.useReactTable({columnResizeDirection:"ltr",defaultColumn:{size:200,minSize:20,maxSize:500},...r,getCoreRowModel:w.getCoreRowModel(),getSortedRowModel:w.getSortedRowModel(),getFilteredRowModel:w.getFilteredRowModel(),columns:ie,data:oe,enableSorting:r.enableSorting??!0,enableColumnResizing:r.enableColumnResizing??!0,columnResizeMode:r.columnResizeMode??"onChange",onColumnSizingChange:r.onColumnSizingChange??O,onSortingChange:r.onSortingChange??Q,onColumnFiltersChange:r.onColumnFiltersChange??Y,enableRowSelection:R,onRowSelectionChange:r.onRowSelectionChange??ne,state:{...r.state,rowSelection:r.state?.rowSelection??ee,sorting:r.state?.sorting??K,columnFilters:r.state?.columnFilters??X,columnSizing:Z,columnPinning:le}}),{rows:M}=i.getRowModel(),{enabled:g,virtualItems:ce,paddingTop:ae,paddingBottom:ue,measureElement:de}=je.useInfiniteScroll(M.length,u,d),I=u?.enabled,$=u?.hasNextPage,v=u?.isFetchingNextPage,N=u?.fetchNextPage,ge=200,p=s.useCallback(n=>{if(!n||!I)return;const{scrollHeight:e,scrollTop:o,clientHeight:c}=n;e-o-c<ge&&!v&&$&&N?.()},[I,$,v,N]);s.useEffect(()=>{p(d.current)},[p]),D.current=i,s.useEffect(()=>{D.current?.toggleAllRowsSelected(F)},[F]);const me=()=>{const n=i.getFlatHeaders(),e={};for(let o=0;o<n.length;o+=1){const c=n[o];e[`--${l}-header-${c.id}-size`]=c.getSize(),e[`--${l}-col-${c.column.id}-size`]=c.column.getSize()}return e},fe=s.useMemo(()=>i.getFlatHeaders().reduce((e,o)=>e+o.getSize(),0),[i.getState().columnSizingInfo,i.getState().columnSizing]);return t.jsxs(t.Fragment,{children:[G&&t.jsx(xe,{color:"danger",sx:{marginBottom:1},children:J}),q?.enabled&&t.jsx(ze,{ref:H,toolbar:q,columnFilters:i.getState().columnFilters,table:i}),t.jsxs(j,{sx:{position:"relative"},children:[a&&t.jsx(j,{sx:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255, 255, 255, 0.7)",display:"flex",justifyContent:"center",alignItems:"flex-start",zIndex:1,paddingTop:"10%"},children:t.jsx(T,{})}),t.jsx(f.TableWrapper,{ref:d,"data-testid":"table-wrapper",$maxHeight:b,onScroll:n=>p(n.currentTarget),children:t.jsxs(Fe,{hoverRow:!0,"data-testid":l,sx:f.getTableStyles(me(),fe,E,se,b),children:[i.getHeaderGroups().map(n=>t.jsx("thead",{ref:k,children:t.jsx("tr",{children:n.headers.map((e,o)=>{const c=o===n.headers.length-1,P=e.column.getIsPinned();return t.jsxs("th",{colSpan:e.colSpan,"data-pinned":P||void 0,style:{width:!P&&c?"auto":`calc(var(--${l}-header-${e.id}-size) * 1px)`},children:[e.isPlaceholder?null:t.jsxs(f.HeaderContent,{children:[e.column.columnDef.meta?.noSortButton?m.flexRender(e.column.columnDef.header,e.getContext()):e.column.getCanSort()?t.jsxs(f.SortButton,{type:"button","aria-label":`Sort ${e.id} column`,onClick:e.column.getToggleSortingHandler(),title:e.column.getNextSortingOrder()===A.SortDirection.ASC?"Sort ascending":e.column.getNextSortingOrder()===A.SortDirection.DESC?"Sort descending":"Clear sort",children:[m.flexRender(e.column.columnDef.header,e.getContext()),{asc:t.jsx(h,{icon:C.faArrowUp,size:"sm"}),desc:t.jsx(h,{icon:C.faArrowDown,size:"sm"})}[e.column.getIsSorted()]??(e.column.getNextSortingOrder()==="desc"?t.jsx(h,{icon:C.faArrowDown,size:"sm",className:"fade"}):t.jsx(h,{icon:C.faArrowUp,size:"sm",className:"fade"}))]}):t.jsx(f.ColumnHeaderContainer,{children:m.flexRender(e.column.columnDef.header,e.getContext())}),e.column.getCanFilter()&&e.column.columnDef.meta?.filterType&&t.jsx(pe.ColumnFilter,{column:e.column,filterType:e.column.columnDef.meta.filterType,filterOptions:e.column.columnDef.meta?.filterOptions,filterSearchable:e.column.columnDef.meta?.filterSearchable})]}),e.column.getCanResize()&&t.jsx("button",{type:"button","aria-label":`Resize ${e.id} column`,onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:`resizer ${e.column.getIsResizing()?"isResizing":""}`})]},e.id)})})},n.id)),t.jsx(Re.TableBody,{rows:M,columns:i.getAllColumns(),rowRender:L,loading:a,rowSelectionState:i.getState().rowSelection,virtualItems:g?ce:void 0,paddingTop:g?ae:void 0,paddingBottom:g?ue:void 0,measureElement:g?de:void 0}),U&&i.getFooterGroups().length>0&&t.jsx("tfoot",{children:i.getFooterGroups().map(n=>t.jsx("tr",{children:n.headers.map(e=>t.jsx("td",{colSpan:e.colSpan,children:m.flexRender(e.column.columnDef.footer,e.getContext())},e.id))},n.id))})]})})]}),g&&u?.isFetchingNextPage&&t.jsxs(j,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:1,padding:1},children:[t.jsx(T,{size:"sm"}),t.jsx(Ce,{children:u.loadingText??"Loading more..."})]}),V&&t.jsx(he,{scrollContainerRef:d,visible:re,constrainToContainer:"main"})]})}module.exports=De;
@@ -1,21 +1,21 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),I=require("../../../../node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),i=require("react"),F=require("styled-components"),R=require("../../../inputs/RadioButton/RadioButton.cjs"),A=require("../../../navigation/Dropdown/Dropdown.cjs"),M=require("../../../navigation/Menu/Menu.cjs"),E=require("../../Icon/Icon.cjs"),g=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Box/Box.cjs"),j=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/List/List.cjs"),m=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/ListItem/ListItem.cjs"),k=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Checkbox/Checkbox.cjs"),h=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Input/Input.cjs"),y=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Button/Button.cjs"),T=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Badge/Badge.cjs"),B=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/MenuButton/MenuButton.cjs"),L=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/IconButton/IconButton.cjs");function C(e){const{header:s}=e.columnDef;return String(typeof s=="function"?s({column:e}):s)}const H=F(g)`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),R=require("../../../../node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),s=require("react"),y=require("styled-components"),A=require("../../../inputs/RadioButton/RadioButton.cjs"),M=require("../../../navigation/Dropdown/Dropdown.cjs"),E=require("../../../navigation/Menu/Menu.cjs"),k=require("../../Icon/Icon.cjs"),g=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Box/Box.cjs"),C=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/List/List.cjs"),F=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/ListItem/ListItem.cjs"),T=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Checkbox/Checkbox.cjs"),h=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Input/Input.cjs"),j=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Button/Button.cjs"),B=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Badge/Badge.cjs"),L=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/MenuButton/MenuButton.cjs"),H=require("../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/IconButton/IconButton.cjs");function S(e){const{header:i}=e.columnDef;return String(typeof i=="function"?i({column:e}):i)}const O=y(g)`
2
2
  padding: 12px;
3
3
  min-width: 250px;
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
  gap: 12px;
7
- `,O=F(g)`
7
+ `,P=y(g)`
8
8
  display: flex;
9
9
  justify-content: space-between;
10
10
  align-items: center;
11
11
  font-weight: 600;
12
12
  font-size: 14px;
13
13
  margin-bottom: 4px;
14
- `,P=F(g)`
14
+ `,K=y(g)`
15
15
  display: flex;
16
16
  gap: 8px;
17
17
  justify-content: flex-end;
18
18
  margin-top: 8px;
19
19
  padding-top: 8px;
20
20
  border-top: 1px solid var(--palette-divider);
21
- `;function v({column:e,onApply:s,onClear:n,children:l}){return t.jsxs(H,{children:[t.jsxs(O,{children:["Filter by ",C(e)]}),l,t.jsxs(P,{children:[t.jsx(y.default,{"aria-label":"Clear filter",size:"sm",variant:"plain",onClick:n,children:"Clear"}),t.jsx(y.default,{"aria-label":"Apply filter",size:"sm",variant:"solid",color:"primary",onClick:s,children:"Apply"})]})]})}function S({column:e,onClose:s}){const[n,l]=i.useState(e.getFilterValue()??""),c=()=>{e.setFilterValue(n||void 0),s?.()},a=()=>{l(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:c,onClear:a,children:t.jsx(h.default,{placeholder:"Search...",value:n,onChange:o=>l(o.target.value),onKeyDown:o=>{o.key==="Enter"&&c()},size:"sm",autoFocus:!0})})}function b({column:e,onClose:s}){const n=e.getFilterValue(),[l,c]=i.useState(n?.min?.toString()??""),[a,o]=i.useState(n?.max?.toString()??""),x=i.useRef(null);i.useEffect(()=>{x.current?.focus({preventScroll:!0})},[]);const p=()=>{const u=l?parseFloat(l):void 0,d=a?parseFloat(a):void 0;u!==void 0||d!==void 0?e.setFilterValue({min:u,max:d}):e.setFilterValue(void 0),s?.()},r=()=>{c(""),o(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:p,onClear:r,children:t.jsxs(g,{sx:{display:"flex",gap:1,alignItems:"center"},children:[t.jsx(h.default,{slotProps:{input:{ref:x}},placeholder:"Min",type:"number",value:l,onChange:u=>c(u.target.value),onKeyDown:u=>{u.key==="Enter"&&p()},size:"sm",sx:{flex:1}}),t.jsx("span",{children:"-"}),t.jsx(h.default,{placeholder:"Max",type:"number",value:a,onChange:u=>o(u.target.value),onKeyDown:u=>{u.key==="Enter"&&p()},size:"sm",sx:{flex:1}})]})})}function V({column:e,onClose:s}){const n=e.getFilterValue(),[l,c]=i.useState(n?.start?n.start.toISOString().split("T")[0]:""),[a,o]=i.useState(n?.end?n.end.toISOString().split("T")[0]:""),x=i.useRef(null),p=i.useRef(null);i.useEffect(()=>{p.current?.focus({preventScroll:!0})},[]);const r=()=>{const d=l?new Date(l):void 0,f=a?new Date(a):void 0;d!==void 0||f!==void 0?e.setFilterValue({start:d,end:f}):e.setFilterValue(void 0),s?.()},u=()=>{c(""),o(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:r,onClear:u,children:t.jsxs(g,{ref:x,tabIndex:0,sx:{display:"flex",flexDirection:"column",gap:1,outline:"none","&:focus":{outline:"none"}},children:[t.jsx(h.default,{type:"date",value:l,ref:p,onChange:d=>c(d.target.value),onKeyDown:d=>{d.key==="Enter"&&r()},size:"sm",slotProps:{input:{placeholder:"Start date"}},autoFocus:!0}),t.jsx(h.default,{type:"date",value:a,onChange:d=>o(d.target.value),onKeyDown:d=>{d.key==="Enter"&&r()},size:"sm",slotProps:{input:{placeholder:"End date"}}})]})})}function w({column:e,options:s,searchable:n=!1,onClose:l}){const[c,a]=i.useState(e.getFilterValue()??""),[o,x]=i.useState(""),p=i.useRef(null);i.useEffect(()=>{n&&p.current?.focus({preventScroll:!0})},[n]);const r=i.useMemo(()=>o?s.filter(f=>f.label.toLowerCase().includes(o.toLowerCase())):s,[s,o]),u=()=>{e.setFilterValue(c||void 0),l?.()},d=()=>{a(""),x(""),e.setFilterValue(void 0)};return t.jsxs(v,{column:e,onApply:u,onClear:d,children:[n&&t.jsx(h.default,{slotProps:{input:{ref:p}},placeholder:"Search...",value:o,onChange:f=>x(f.target.value),size:"sm"}),t.jsxs(j.default,{component:"ul",size:"sm",role:"group",sx:{maxHeight:n?"200px":"240px",overflowY:"auto",outline:"none"},children:[r.map(f=>t.jsx(m.default,{component:"li",sx:{paddingLeft:0,paddingTop:0},children:t.jsx(R,{value:f.value,label:f.label,size:"sm",checked:c===f.value,onChange:z=>a(z.target.value),sx:{width:"100%"}})},f.value)),r.length===0&&t.jsx(m.default,{component:"li",sx:{color:"text.tertiary"},children:"No options match"})]})]})}function q({column:e,options:s,onClose:n}){const[l,c]=i.useState(e.getFilterValue()??[]),a=i.useRef(null);i.useEffect(()=>{a.current?.focus()},[]);const o=r=>{c(u=>u.includes(r)?u.filter(d=>d!==r):[...u,r])},x=()=>{e.setFilterValue(l.length>0?l:void 0),n?.()},p=()=>{c([]),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:x,onClear:p,children:t.jsx(j.default,{ref:a,component:"ul",size:"sm",tabIndex:0,role:"group",sx:{maxHeight:"240px",overflowY:"auto",outline:"none","&:focus":{outline:"none"}},children:s.map(r=>t.jsx(m.default,{component:"li",sx:{paddingLeft:0,paddingTop:0},children:t.jsx(k,{label:r.label,checked:l.includes(r.value),onChange:()=>o(r.value),size:"sm",sx:{width:"100%"}},r.value)},r.value))})})}const D={text:S,number:b,date:V,select:w,multiselect:q};function K({column:e,filterType:s="text",filterOptions:n=[],filterSearchable:l}){const[c,a]=i.useState(!1),o=()=>{a(!1)},x=D[s];return t.jsxs(A,{open:c,onOpenChange:(p,r)=>a(r),children:[t.jsx(T,{badgeContent:"",invisible:!e.getIsFiltered(),color:"primary",variant:"solid",size:"sm",sx:{"& .MuiBadge-badge":{minWidth:"8px",height:"8px",padding:0,borderRadius:"50%"}},children:t.jsx(B.default,{"aria-label":`${e.getIsFiltered()?"Filtered":"Filter"} by ${C(e)}`,slots:{root:L.default},slotProps:{root:{size:"sm",variant:e.getIsFiltered()?"solid":"plain",color:e.getIsFiltered()?"primary":"neutral",sx:{minWidth:"24px",minHeight:"24px",maxWidth:"24px",maxHeight:"24px",width:"24px",height:"24px",padding:"4px",flex:"0 0 auto","& svg":{color:e.getIsFiltered()?"var(--palette-common-white)":"inherit"}}}},children:t.jsx(E,{icon:I.faFilter,size:"xs"})})}),t.jsx(M,{placement:"bottom-start",children:t.jsx(x,{column:e,onClose:o,options:n,searchable:l})})]})}exports.ColumnFilter=K;exports.DateFilter=V;exports.MultiSelectFilter=q;exports.NumericFilter=b;exports.SelectFilter=w;exports.TextFilter=S;exports.filterComponentMap=D;
21
+ `;function v({column:e,onApply:i,onClear:n,children:l}){return t.jsxs(O,{children:[t.jsxs(P,{children:["Filter by ",S(e)]}),l,t.jsxs(K,{children:[t.jsx(j.default,{"aria-label":"Clear filter",size:"sm",variant:"plain",onClick:n,children:"Clear"}),t.jsx(j.default,{"aria-label":"Apply filter",size:"sm",variant:"solid",color:"primary",onClick:i,children:"Apply"})]})]})}function b({column:e,onClose:i}){const[n,l]=s.useState(e.getFilterValue()??""),c=()=>{e.setFilterValue(n||void 0),i?.()},o=()=>{l(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:c,onClear:o,children:t.jsx(h.default,{placeholder:"Search...",value:n,onChange:u=>l(u.target.value),onKeyDown:u=>{u.key==="Enter"&&c()},size:"sm",autoFocus:!0})})}function V({column:e,onClose:i}){const n=e.getFilterValue(),[l,c]=s.useState(n?.min?.toString()??""),[o,u]=s.useState(n?.max?.toString()??""),f=s.useRef(null);s.useEffect(()=>{f.current?.focus({preventScroll:!0})},[]);const p=()=>{const a=l?parseFloat(l):void 0,d=o?parseFloat(o):void 0;a!==void 0||d!==void 0?e.setFilterValue({min:a,max:d}):e.setFilterValue(void 0),i?.()},r=()=>{c(""),u(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:p,onClear:r,children:t.jsxs(g,{sx:{display:"flex",gap:1,alignItems:"center"},children:[t.jsx(h.default,{slotProps:{input:{ref:f}},placeholder:"Min",type:"number",value:l,onChange:a=>c(a.target.value),onKeyDown:a=>{a.key==="Enter"&&p()},size:"sm",sx:{flex:1}}),t.jsx("span",{children:"-"}),t.jsx(h.default,{placeholder:"Max",type:"number",value:o,onChange:a=>u(a.target.value),onKeyDown:a=>{a.key==="Enter"&&p()},size:"sm",sx:{flex:1}})]})})}function w({column:e,onClose:i}){const n=e.getFilterValue(),[l,c]=s.useState(n?.start?n.start.toISOString().split("T")[0]:""),[o,u]=s.useState(n?.end?n.end.toISOString().split("T")[0]:""),f=s.useRef(null),p=s.useRef(null);s.useEffect(()=>{p.current?.focus({preventScroll:!0})},[]);const r=()=>{const d=l?new Date(l):void 0,m=o?new Date(o):void 0;d!==void 0||m!==void 0?e.setFilterValue({start:d,end:m}):e.setFilterValue(void 0),i?.()},a=()=>{c(""),u(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:r,onClear:a,children:t.jsxs(g,{ref:f,tabIndex:0,sx:{display:"flex",flexDirection:"column",gap:1,outline:"none","&:focus":{outline:"none"}},children:[t.jsx(h.default,{type:"date",value:l,ref:p,onChange:d=>c(d.target.value),onKeyDown:d=>{d.key==="Enter"&&r()},size:"sm",slotProps:{input:{placeholder:"Start date"}},autoFocus:!0}),t.jsx(h.default,{type:"date",value:o,onChange:d=>u(d.target.value),onKeyDown:d=>{d.key==="Enter"&&r()},size:"sm",slotProps:{input:{placeholder:"End date"}}})]})})}function q({column:e,options:i,searchable:n=!1,onClose:l}){const[c,o]=s.useState(e.getFilterValue()??""),[u,f]=s.useState(""),p=s.useRef(null),r=s.useRef(null);s.useEffect(()=>{n?p.current?.focus({preventScroll:!0}):r.current?.focus({preventScroll:!0})},[n]);const a=s.useMemo(()=>u?i.filter(x=>x.label.toLowerCase().includes(u.toLowerCase())):i,[i,u]),d=()=>{e.setFilterValue(c||void 0),l?.()},m=()=>{o(""),f(""),e.setFilterValue(void 0)};return t.jsxs(v,{column:e,onApply:d,onClear:m,children:[n&&t.jsx(h.default,{slotProps:{input:{ref:p}},placeholder:"Search...",value:u,onChange:x=>f(x.target.value),size:"sm"}),t.jsxs(C.default,{ref:r,component:"ul",size:"sm",role:"group",tabIndex:0,sx:{maxHeight:n?"200px":"240px",overflowY:"auto",outline:"none","&:focus":{outline:"none"}},children:[a.map(x=>t.jsx(F.default,{component:"li",sx:{paddingLeft:0,paddingTop:0},children:t.jsx(A,{value:x.value,label:x.label,size:"sm",checked:c===x.value,onChange:z=>o(z.target.value),sx:{width:"100%"}})},x.value)),a.length===0&&t.jsx(F.default,{component:"li",sx:{color:"text.tertiary"},children:"No options match"})]})]})}function D({column:e,options:i,onClose:n}){const[l,c]=s.useState(e.getFilterValue()??[]),o=s.useRef(null);s.useEffect(()=>{o.current?.focus()},[]);const u=r=>{c(a=>a.includes(r)?a.filter(d=>d!==r):[...a,r])},f=()=>{e.setFilterValue(l.length>0?l:void 0),n?.()},p=()=>{c([]),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:f,onClear:p,children:t.jsx(C.default,{ref:o,component:"ul",size:"sm",tabIndex:0,role:"group",sx:{maxHeight:"240px",overflowY:"auto",outline:"none","&:focus":{outline:"none"}},children:i.map(r=>t.jsx(F.default,{component:"li",sx:{paddingLeft:0,paddingTop:0},children:t.jsx(T,{label:r.label,checked:l.includes(r.value),onChange:()=>u(r.value),size:"sm",sx:{width:"100%"}},r.value)},r.value))})})}const I={text:b,number:V,date:w,select:q,multiselect:D};function N({column:e,filterType:i="text",filterOptions:n=[],filterSearchable:l}){const[c,o]=s.useState(!1),u=()=>{o(!1)},f=I[i];return t.jsxs(M,{open:c,onOpenChange:(p,r)=>o(r),children:[t.jsx(B,{badgeContent:"",invisible:!e.getIsFiltered(),color:"primary",variant:"solid",size:"sm",sx:{"& .MuiBadge-badge":{minWidth:"8px",height:"8px",padding:0,borderRadius:"50%"}},children:t.jsx(L.default,{"aria-label":`${e.getIsFiltered()?"Filtered":"Filter"} by ${S(e)}`,slots:{root:H.default},slotProps:{root:{size:"sm",variant:e.getIsFiltered()?"solid":"plain",color:e.getIsFiltered()?"primary":"neutral",sx:{minWidth:"24px",minHeight:"24px",maxWidth:"24px",maxHeight:"24px",width:"24px",height:"24px",padding:"4px",flex:"0 0 auto","& svg":{color:e.getIsFiltered()?"var(--palette-common-white)":"inherit"}}}},children:t.jsx(k,{icon:R.faFilter,size:"xs"})})}),t.jsx(E,{placement:"bottom-start",children:t.jsx(f,{column:e,onClose:u,options:n,searchable:l})})]})}exports.ColumnFilter=N;exports.DateFilter=w;exports.MultiSelectFilter=D;exports.NumericFilter=V;exports.SelectFilter=q;exports.TextFilter=b;exports.filterComponentMap=I;
@@ -18,7 +18,7 @@ import { multiSelectFilter as He, selectFilter as ke, dateFilter as Ie, numericF
18
18
  import { useInfiniteScroll as Pe } from "./hooks/useInfiniteScroll.js";
19
19
  import { useStickyHeader as $e } from "./hooks/useStickyHeader.js";
20
20
  import { useStickyScrollbar as Be } from "./hooks/useStickyScrollbar.js";
21
- import x from "../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Box/Box.js";
21
+ import z from "../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Box/Box.js";
22
22
  import Te from "../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Table/Table.js";
23
23
  import { getFilteredRowModel as Ae, getSortedRowModel as Ee, getCoreRowModel as je } from "../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.js";
24
24
  function Le({ table: i }) {
@@ -46,12 +46,12 @@ function Ve({ row: i }) {
46
46
  function ut({
47
47
  id: i,
48
48
  loading: c = !1,
49
- maxHeight: w = !1,
49
+ maxHeight: x = !1,
50
50
  wrapText: j = !1,
51
51
  rowRender: L,
52
52
  reactTableOptions: r,
53
53
  gridCheckboxes: h = !1,
54
- allSelected: C = !1,
54
+ allSelected: w = !1,
55
55
  onSelectionChange: F,
56
56
  showStickyScrollbar: V = !1,
57
57
  enableStickyHeader: W = !1,
@@ -75,9 +75,9 @@ function ut({
75
75
  });
76
76
  },
77
77
  [F]
78
- ), y = l.useRef(null), R = l.useRef(r.data), oe = c && R.current.length > 0 ? R.current : r.data;
78
+ ), y = l.useRef(null), C = l.useRef(r.data), oe = c && C.current.length > 0 ? C.current : r.data;
79
79
  l.useEffect(() => {
80
- !c && r.data.length > 0 && (R.current = r.data);
80
+ !c && r.data.length > 0 && (C.current = r.data);
81
81
  }, [c, r.data]);
82
82
  const d = l.useRef(null), M = l.useRef(null), D = l.useRef(null), ne = Be(d), re = $e({
83
83
  enabled: W,
@@ -131,7 +131,7 @@ function ut({
131
131
  onColumnSizingChange: r.onColumnSizingChange ?? Z,
132
132
  onSortingChange: r.onSortingChange ?? K,
133
133
  onColumnFiltersChange: r.onColumnFiltersChange ?? X,
134
- enableRowSelection: h && !C,
134
+ enableRowSelection: h,
135
135
  onRowSelectionChange: r.onRowSelectionChange ?? te,
136
136
  state: {
137
137
  ...r.state,
@@ -147,7 +147,7 @@ function ut({
147
147
  paddingTop: ce,
148
148
  paddingBottom: ae,
149
149
  measureElement: me
150
- } = Pe(H.length, m, d), k = m?.enabled, I = m?.hasNextPage, v = m?.isFetchingNextPage, N = m?.fetchNextPage, ue = 200, z = l.useCallback(
150
+ } = Pe(H.length, m, d), k = m?.enabled, I = m?.hasNextPage, v = m?.isFetchingNextPage, N = m?.fetchNextPage, ue = 200, R = l.useCallback(
151
151
  (t) => {
152
152
  if (!t || !k) return;
153
153
  const { scrollHeight: e, scrollTop: n, clientHeight: a } = t;
@@ -156,10 +156,10 @@ function ut({
156
156
  [k, I, v, N]
157
157
  );
158
158
  l.useEffect(() => {
159
- z(d.current);
160
- }, [z]), y.current = s, l.useEffect(() => {
161
- y.current?.toggleAllRowsSelected(C);
162
- }, [C]);
159
+ R(d.current);
160
+ }, [R]), y.current = s, l.useEffect(() => {
161
+ y.current?.toggleAllRowsSelected(w);
162
+ }, [w]);
163
163
  const de = () => {
164
164
  const t = s.getFlatHeaders(), e = {};
165
165
  for (let n = 0; n < t.length; n += 1) {
@@ -179,9 +179,9 @@ function ut({
179
179
  table: s
180
180
  }
181
181
  ),
182
- /* @__PURE__ */ u(x, { sx: { position: "relative" }, children: [
182
+ /* @__PURE__ */ u(z, { sx: { position: "relative" }, children: [
183
183
  c && /* @__PURE__ */ o(
184
- x,
184
+ z,
185
185
  {
186
186
  sx: {
187
187
  position: "absolute",
@@ -204,8 +204,8 @@ function ut({
204
204
  {
205
205
  ref: d,
206
206
  "data-testid": "table-wrapper",
207
- $maxHeight: w,
208
- onScroll: (t) => z(t.currentTarget),
207
+ $maxHeight: x,
208
+ onScroll: (t) => R(t.currentTarget),
209
209
  children: /* @__PURE__ */ u(
210
210
  Te,
211
211
  {
@@ -216,7 +216,7 @@ function ut({
216
216
  ge,
217
217
  j,
218
218
  re,
219
- w
219
+ x
220
220
  ),
221
221
  children: [
222
222
  s.getHeaderGroups().map((t) => /* @__PURE__ */ o("thead", { ref: M, children: /* @__PURE__ */ o("tr", { children: t.headers.map((e, n) => {
@@ -323,7 +323,7 @@ function ut({
323
323
  )
324
324
  ] }),
325
325
  g && m?.isFetchingNextPage && /* @__PURE__ */ u(
326
- x,
326
+ z,
327
327
  {
328
328
  sx: {
329
329
  display: "flex",
@@ -1,38 +1,38 @@
1
1
  import { jsx as t, jsxs as m } from "react/jsx-runtime";
2
- import { faFilter as w } from "../../../../node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.js";
3
- import a from "react";
4
- import F from "styled-components";
2
+ import { faFilter as I } from "../../../../node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.js";
3
+ import r from "react";
4
+ import C from "styled-components";
5
5
  import z from "../../../inputs/RadioButton/RadioButton.js";
6
6
  import D from "../../../navigation/Dropdown/Dropdown.js";
7
- import I from "../../../navigation/Menu/Menu.js";
8
- import A from "../../Icon/Icon.js";
7
+ import A from "../../../navigation/Menu/Menu.js";
8
+ import R from "../../Icon/Icon.js";
9
9
  import g from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Box/Box.js";
10
- import S from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/List/List.js";
11
- import y from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/ListItem/ListItem.js";
12
- import R from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Checkbox/Checkbox.js";
10
+ import b from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/List/List.js";
11
+ import F from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/ListItem/ListItem.js";
12
+ import E from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Checkbox/Checkbox.js";
13
13
  import x from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Input/Input.js";
14
- import C from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Button/Button.js";
15
- import E from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Badge/Badge.js";
16
- import k from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/MenuButton/MenuButton.js";
17
- import M from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/IconButton/IconButton.js";
18
- function b(e) {
19
- const { header: r } = e.columnDef;
20
- return String(typeof r == "function" ? r({ column: e }) : r);
14
+ import S from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Button/Button.js";
15
+ import k from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Badge/Badge.js";
16
+ import M from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/MenuButton/MenuButton.js";
17
+ import L from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/IconButton/IconButton.js";
18
+ function V(e) {
19
+ const { header: i } = e.columnDef;
20
+ return String(typeof i == "function" ? i({ column: e }) : i);
21
21
  }
22
- const L = F(g)`
22
+ const B = C(g)`
23
23
  padding: 12px;
24
24
  min-width: 250px;
25
25
  display: flex;
26
26
  flex-direction: column;
27
27
  gap: 12px;
28
- `, B = F(g)`
28
+ `, H = C(g)`
29
29
  display: flex;
30
30
  justify-content: space-between;
31
31
  align-items: center;
32
32
  font-weight: 600;
33
33
  font-size: 14px;
34
34
  margin-bottom: 4px;
35
- `, H = F(g)`
35
+ `, T = C(g)`
36
36
  display: flex;
37
37
  gap: 8px;
38
38
  justify-content: flex-end;
@@ -42,19 +42,19 @@ const L = F(g)`
42
42
  `;
43
43
  function v({
44
44
  column: e,
45
- onApply: r,
45
+ onApply: i,
46
46
  onClear: n,
47
47
  children: l
48
48
  }) {
49
- return /* @__PURE__ */ m(L, { children: [
50
- /* @__PURE__ */ m(B, { children: [
49
+ return /* @__PURE__ */ m(B, { children: [
50
+ /* @__PURE__ */ m(H, { children: [
51
51
  "Filter by ",
52
- b(e)
52
+ V(e)
53
53
  ] }),
54
54
  l,
55
- /* @__PURE__ */ m(H, { children: [
55
+ /* @__PURE__ */ m(T, { children: [
56
56
  /* @__PURE__ */ t(
57
- C,
57
+ S,
58
58
  {
59
59
  "aria-label": "Clear filter",
60
60
  size: "sm",
@@ -64,75 +64,75 @@ function v({
64
64
  }
65
65
  ),
66
66
  /* @__PURE__ */ t(
67
- C,
67
+ S,
68
68
  {
69
69
  "aria-label": "Apply filter",
70
70
  size: "sm",
71
71
  variant: "solid",
72
72
  color: "primary",
73
- onClick: r,
73
+ onClick: i,
74
74
  children: "Apply"
75
75
  }
76
76
  )
77
77
  ] })
78
78
  ] });
79
79
  }
80
- function T({
80
+ function K({
81
81
  column: e,
82
- onClose: r
82
+ onClose: i
83
83
  }) {
84
- const [n, l] = a.useState(
84
+ const [n, l] = r.useState(
85
85
  e.getFilterValue() ?? ""
86
- ), d = () => {
87
- e.setFilterValue(n || void 0), r?.();
86
+ ), p = () => {
87
+ e.setFilterValue(n || void 0), i?.();
88
88
  };
89
- return /* @__PURE__ */ t(v, { column: e, onApply: d, onClear: () => {
89
+ return /* @__PURE__ */ t(v, { column: e, onApply: p, onClear: () => {
90
90
  l(""), e.setFilterValue(void 0);
91
91
  }, children: /* @__PURE__ */ t(
92
92
  x,
93
93
  {
94
94
  placeholder: "Search...",
95
95
  value: n,
96
- onChange: (o) => l(o.target.value),
97
- onKeyDown: (o) => {
98
- o.key === "Enter" && d();
96
+ onChange: (a) => l(a.target.value),
97
+ onKeyDown: (a) => {
98
+ a.key === "Enter" && p();
99
99
  },
100
100
  size: "sm",
101
101
  autoFocus: !0
102
102
  }
103
103
  ) });
104
104
  }
105
- function K({
105
+ function O({
106
106
  column: e,
107
- onClose: r
107
+ onClose: i
108
108
  }) {
109
- const n = e.getFilterValue(), [l, d] = a.useState(
109
+ const n = e.getFilterValue(), [l, p] = r.useState(
110
110
  n?.min?.toString() ?? ""
111
- ), [s, o] = a.useState(
111
+ ), [d, a] = r.useState(
112
112
  n?.max?.toString() ?? ""
113
- ), h = a.useRef(null);
114
- a.useEffect(() => {
115
- h.current?.focus({
113
+ ), f = r.useRef(null);
114
+ r.useEffect(() => {
115
+ f.current?.focus({
116
116
  preventScroll: !0
117
117
  });
118
118
  }, []);
119
119
  const c = () => {
120
- const p = l ? parseFloat(l) : void 0, u = s ? parseFloat(s) : void 0;
121
- p !== void 0 || u !== void 0 ? e.setFilterValue({ min: p, max: u }) : e.setFilterValue(void 0), r?.();
120
+ const s = l ? parseFloat(l) : void 0, u = d ? parseFloat(d) : void 0;
121
+ s !== void 0 || u !== void 0 ? e.setFilterValue({ min: s, max: u }) : e.setFilterValue(void 0), i?.();
122
122
  };
123
123
  return /* @__PURE__ */ t(v, { column: e, onApply: c, onClear: () => {
124
- d(""), o(""), e.setFilterValue(void 0);
124
+ p(""), a(""), e.setFilterValue(void 0);
125
125
  }, children: /* @__PURE__ */ m(g, { sx: { display: "flex", gap: 1, alignItems: "center" }, children: [
126
126
  /* @__PURE__ */ t(
127
127
  x,
128
128
  {
129
- slotProps: { input: { ref: h } },
129
+ slotProps: { input: { ref: f } },
130
130
  placeholder: "Min",
131
131
  type: "number",
132
132
  value: l,
133
- onChange: (p) => d(p.target.value),
134
- onKeyDown: (p) => {
135
- p.key === "Enter" && c();
133
+ onChange: (s) => p(s.target.value),
134
+ onKeyDown: (s) => {
135
+ s.key === "Enter" && c();
136
136
  },
137
137
  size: "sm",
138
138
  sx: { flex: 1 }
@@ -144,10 +144,10 @@ function K({
144
144
  {
145
145
  placeholder: "Max",
146
146
  type: "number",
147
- value: s,
148
- onChange: (p) => o(p.target.value),
149
- onKeyDown: (p) => {
150
- p.key === "Enter" && c();
147
+ value: d,
148
+ onChange: (s) => a(s.target.value),
149
+ onKeyDown: (s) => {
150
+ s.key === "Enter" && c();
151
151
  },
152
152
  size: "sm",
153
153
  sx: { flex: 1 }
@@ -155,30 +155,30 @@ function K({
155
155
  )
156
156
  ] }) });
157
157
  }
158
- function O({
158
+ function P({
159
159
  column: e,
160
- onClose: r
160
+ onClose: i
161
161
  }) {
162
- const n = e.getFilterValue(), [l, d] = a.useState(
162
+ const n = e.getFilterValue(), [l, p] = r.useState(
163
163
  n?.start ? n.start.toISOString().split("T")[0] : ""
164
- ), [s, o] = a.useState(
164
+ ), [d, a] = r.useState(
165
165
  n?.end ? n.end.toISOString().split("T")[0] : ""
166
- ), h = a.useRef(null), c = a.useRef(null);
167
- a.useEffect(() => {
166
+ ), f = r.useRef(null), c = r.useRef(null);
167
+ r.useEffect(() => {
168
168
  c.current?.focus({
169
169
  preventScroll: !0
170
170
  });
171
171
  }, []);
172
- const i = () => {
173
- const u = l ? new Date(l) : void 0, f = s ? new Date(s) : void 0;
174
- u !== void 0 || f !== void 0 ? e.setFilterValue({ start: u, end: f }) : e.setFilterValue(void 0), r?.();
172
+ const o = () => {
173
+ const u = l ? new Date(l) : void 0, y = d ? new Date(d) : void 0;
174
+ u !== void 0 || y !== void 0 ? e.setFilterValue({ start: u, end: y }) : e.setFilterValue(void 0), i?.();
175
175
  };
176
- return /* @__PURE__ */ t(v, { column: e, onApply: i, onClear: () => {
177
- d(""), o(""), e.setFilterValue(void 0);
176
+ return /* @__PURE__ */ t(v, { column: e, onApply: o, onClear: () => {
177
+ p(""), a(""), e.setFilterValue(void 0);
178
178
  }, children: /* @__PURE__ */ m(
179
179
  g,
180
180
  {
181
- ref: h,
181
+ ref: f,
182
182
  tabIndex: 0,
183
183
  sx: {
184
184
  display: "flex",
@@ -196,9 +196,9 @@ function O({
196
196
  type: "date",
197
197
  value: l,
198
198
  ref: c,
199
- onChange: (u) => d(u.target.value),
199
+ onChange: (u) => p(u.target.value),
200
200
  onKeyDown: (u) => {
201
- u.key === "Enter" && i();
201
+ u.key === "Enter" && o();
202
202
  },
203
203
  size: "sm",
204
204
  slotProps: {
@@ -213,10 +213,10 @@ function O({
213
213
  x,
214
214
  {
215
215
  type: "date",
216
- value: s,
217
- onChange: (u) => o(u.target.value),
216
+ value: d,
217
+ onChange: (u) => a(u.target.value),
218
218
  onKeyDown: (u) => {
219
- u.key === "Enter" && i();
219
+ u.key === "Enter" && o();
220
220
  },
221
221
  size: "sm",
222
222
  slotProps: {
@@ -230,102 +230,105 @@ function O({
230
230
  }
231
231
  ) });
232
232
  }
233
- function P({
233
+ function j({
234
234
  column: e,
235
- options: r,
235
+ options: i,
236
236
  searchable: n = !1,
237
237
  onClose: l
238
238
  }) {
239
- const [d, s] = a.useState(
239
+ const [p, d] = r.useState(
240
240
  e.getFilterValue() ?? ""
241
- ), [o, h] = a.useState(""), c = a.useRef(null);
242
- a.useEffect(() => {
243
- n && c.current?.focus({ preventScroll: !0 });
241
+ ), [a, f] = r.useState(""), c = r.useRef(null), o = r.useRef(null);
242
+ r.useEffect(() => {
243
+ n ? c.current?.focus({ preventScroll: !0 }) : o.current?.focus({ preventScroll: !0 });
244
244
  }, [n]);
245
- const i = a.useMemo(
246
- () => o ? r.filter(
247
- (f) => f.label.toLowerCase().includes(o.toLowerCase())
248
- ) : r,
249
- [r, o]
245
+ const s = r.useMemo(
246
+ () => a ? i.filter(
247
+ (h) => h.label.toLowerCase().includes(a.toLowerCase())
248
+ ) : i,
249
+ [i, a]
250
250
  );
251
251
  return /* @__PURE__ */ m(v, { column: e, onApply: () => {
252
- e.setFilterValue(d || void 0), l?.();
252
+ e.setFilterValue(p || void 0), l?.();
253
253
  }, onClear: () => {
254
- s(""), h(""), e.setFilterValue(void 0);
254
+ d(""), f(""), e.setFilterValue(void 0);
255
255
  }, children: [
256
256
  n && /* @__PURE__ */ t(
257
257
  x,
258
258
  {
259
259
  slotProps: { input: { ref: c } },
260
260
  placeholder: "Search...",
261
- value: o,
262
- onChange: (f) => h(f.target.value),
261
+ value: a,
262
+ onChange: (h) => f(h.target.value),
263
263
  size: "sm"
264
264
  }
265
265
  ),
266
266
  /* @__PURE__ */ m(
267
- S,
267
+ b,
268
268
  {
269
+ ref: o,
269
270
  component: "ul",
270
271
  size: "sm",
271
272
  role: "group",
273
+ tabIndex: 0,
272
274
  sx: {
273
275
  maxHeight: n ? "200px" : "240px",
274
276
  overflowY: "auto",
275
- outline: "none"
277
+ outline: "none",
278
+ "&:focus": { outline: "none" }
276
279
  },
277
280
  children: [
278
- i.map((f) => /* @__PURE__ */ t(
279
- y,
281
+ s.map((h) => /* @__PURE__ */ t(
282
+ F,
280
283
  {
281
284
  component: "li",
282
285
  sx: { paddingLeft: 0, paddingTop: 0 },
283
286
  children: /* @__PURE__ */ t(
284
287
  z,
285
288
  {
286
- value: f.value,
287
- label: f.label,
289
+ value: h.value,
290
+ label: h.label,
288
291
  size: "sm",
289
- checked: d === f.value,
290
- onChange: (V) => s(V.target.value),
292
+ checked: p === h.value,
293
+ onChange: (w) => d(w.target.value),
291
294
  sx: {
292
295
  width: "100%"
293
296
  }
294
297
  }
295
298
  )
296
299
  },
297
- f.value
300
+ h.value
298
301
  )),
299
- i.length === 0 && /* @__PURE__ */ t(y, { component: "li", sx: { color: "text.tertiary" }, children: "No options match" })
302
+ s.length === 0 && /* @__PURE__ */ t(F, { component: "li", sx: { color: "text.tertiary" }, children: "No options match" })
300
303
  ]
301
304
  }
302
305
  )
303
306
  ] });
304
307
  }
305
- function j({
308
+ function N({
306
309
  column: e,
307
- options: r,
310
+ options: i,
308
311
  onClose: n
309
312
  }) {
310
- const [l, d] = a.useState(
313
+ const [l, p] = r.useState(
311
314
  e.getFilterValue() ?? []
312
- ), s = a.useRef(null);
313
- a.useEffect(() => {
314
- s.current?.focus();
315
+ ), d = r.useRef(null);
316
+ r.useEffect(() => {
317
+ d.current?.focus();
315
318
  }, []);
316
- const o = (i) => {
317
- d(
318
- (p) => p.includes(i) ? p.filter((u) => u !== i) : [...p, i]
319
+ const a = (o) => {
320
+ p(
321
+ (s) => s.includes(o) ? s.filter((u) => u !== o) : [...s, o]
319
322
  );
320
323
  };
321
324
  return /* @__PURE__ */ t(v, { column: e, onApply: () => {
322
325
  e.setFilterValue(l.length > 0 ? l : void 0), n?.();
323
326
  }, onClear: () => {
324
- d([]), e.setFilterValue(void 0);
327
+ p([]), e.setFilterValue(void 0);
325
328
  }, children: /* @__PURE__ */ t(
326
- S,
329
+ b,
327
330
  {
328
- ref: s,
331
+ ref: d,
329
332
  component: "ul",
330
333
  size: "sm",
331
334
  tabIndex: 0,
@@ -338,49 +341,49 @@ function j({
338
341
  outline: "none"
339
342
  }
340
343
  },
341
- children: r.map((i) => /* @__PURE__ */ t(
342
- y,
344
+ children: i.map((o) => /* @__PURE__ */ t(
345
+ F,
343
346
  {
344
347
  component: "li",
345
348
  sx: { paddingLeft: 0, paddingTop: 0 },
346
349
  children: /* @__PURE__ */ t(
347
- R,
350
+ E,
348
351
  {
349
- label: i.label,
350
- checked: l.includes(i.value),
351
- onChange: () => o(i.value),
352
+ label: o.label,
353
+ checked: l.includes(o.value),
354
+ onChange: () => a(o.value),
352
355
  size: "sm",
353
356
  sx: {
354
357
  width: "100%"
355
358
  }
356
359
  },
357
- i.value
360
+ o.value
358
361
  )
359
362
  },
360
- i.value
363
+ o.value
361
364
  ))
362
365
  }
363
366
  ) });
364
367
  }
365
- const N = {
366
- text: T,
367
- number: K,
368
- date: O,
369
- select: P,
370
- multiselect: j
368
+ const W = {
369
+ text: K,
370
+ number: O,
371
+ date: P,
372
+ select: j,
373
+ multiselect: N
371
374
  };
372
375
  function ae({
373
376
  column: e,
374
- filterType: r = "text",
377
+ filterType: i = "text",
375
378
  filterOptions: n = [],
376
379
  filterSearchable: l
377
380
  }) {
378
- const [d, s] = a.useState(!1), o = () => {
379
- s(!1);
380
- }, h = N[r];
381
- return /* @__PURE__ */ m(D, { open: d, onOpenChange: (c, i) => s(i), children: [
381
+ const [p, d] = r.useState(!1), a = () => {
382
+ d(!1);
383
+ }, f = W[i];
384
+ return /* @__PURE__ */ m(D, { open: p, onOpenChange: (c, o) => d(o), children: [
382
385
  /* @__PURE__ */ t(
383
- E,
386
+ k,
384
387
  {
385
388
  badgeContent: "",
386
389
  invisible: !e.getIsFiltered(),
@@ -396,12 +399,12 @@ function ae({
396
399
  }
397
400
  },
398
401
  children: /* @__PURE__ */ t(
399
- k,
402
+ M,
400
403
  {
401
- "aria-label": `${e.getIsFiltered() ? "Filtered" : "Filter"} by ${b(
404
+ "aria-label": `${e.getIsFiltered() ? "Filtered" : "Filter"} by ${V(
402
405
  e
403
406
  )}`,
404
- slots: { root: M },
407
+ slots: { root: L },
405
408
  slotProps: {
406
409
  root: {
407
410
  size: "sm",
@@ -422,16 +425,16 @@ function ae({
422
425
  }
423
426
  }
424
427
  },
425
- children: /* @__PURE__ */ t(A, { icon: w, size: "xs" })
428
+ children: /* @__PURE__ */ t(R, { icon: I, size: "xs" })
426
429
  }
427
430
  )
428
431
  }
429
432
  ),
430
- /* @__PURE__ */ t(I, { placement: "bottom-start", children: /* @__PURE__ */ t(
431
- h,
433
+ /* @__PURE__ */ t(A, { placement: "bottom-start", children: /* @__PURE__ */ t(
434
+ f,
432
435
  {
433
436
  column: e,
434
- onClose: o,
437
+ onClose: a,
435
438
  options: n,
436
439
  searchable: l
437
440
  }
@@ -440,10 +443,10 @@ function ae({
440
443
  }
441
444
  export {
442
445
  ae as ColumnFilter,
443
- O as DateFilter,
444
- j as MultiSelectFilter,
445
- K as NumericFilter,
446
- P as SelectFilter,
447
- T as TextFilter,
448
- N as filterComponentMap
446
+ P as DateFilter,
447
+ N as MultiSelectFilter,
448
+ O as NumericFilter,
449
+ j as SelectFilter,
450
+ K as TextFilter,
451
+ W as filterComponentMap
449
452
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harpercollins/harpercollins-design-system",
3
- "version": "1.31.0",
3
+ "version": "1.32.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@ssh.dev.azure.com:v3/HarperCollinsUK/HCDesignSystem/HCDesignSystem"