@harpercollins/harpercollins-design-system 1.37.0 → 1.38.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,21 +1,25 @@
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)`
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"),m=require("styled-components"),T=require("../../../inputs/RadioButton/RadioButton.cjs"),M=require("../../../inputs/Textarea/Textarea.cjs"),E=require("../../../navigation/Dropdown/Dropdown.cjs"),k=require("../../../navigation/Menu/Menu.cjs"),H=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"),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/ListItem/ListItem.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/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"),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/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"),O=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{meta:a}=e.columnDef;if(a?.filterLabel)return a.filterLabel;const{header:n}=e.columnDef;if(typeof n=="string")return n;if(typeof n=="function"){const r=n({column:e});return typeof r=="string"?r:e.id}return e.id}const P=m(g)`
2
2
  padding: 12px;
3
3
  min-width: 250px;
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
  gap: 12px;
7
- `,P=y(g)`
7
+ `,N=m(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
- `,K=y(g)`
14
+ `,W=m(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: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;
21
+ `,Y=m(g)`
22
+ font-size: 12px;
23
+ color: var(--palette-text-tertiary);
24
+ margin-top: -6px;
25
+ `;function v({column:e,onApply:a,onClear:n,children:s}){const r=e.columnDef.meta?.filterHelpText;return t.jsxs(P,{children:[t.jsxs(N,{children:["Filter by ",S(e)]}),s,r&&t.jsx(Y,{children:r}),t.jsxs(W,{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:a,children:"Apply"})]})]})}function b({column:e,onClose:a}){const[n,s]=i.useState(e.getFilterValue()??""),r=()=>{e.setFilterValue(n||void 0),a?.()},o=()=>{s(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:r,onClear:o,children:t.jsx(h.default,{placeholder:"Search...",value:n,onChange:l=>s(l.target.value),onKeyDown:l=>{l.key==="Enter"&&r()},size:"sm",autoFocus:!0})})}function V({column:e,onClose:a}){const[n,s]=i.useState(e.getFilterValue()??""),r=()=>{e.setFilterValue(n.trim()||void 0),a?.()},o=()=>{s(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:r,onClear:o,children:t.jsx(M,{placeholder:"One term per line or comma-separated...",value:n,onChange:l=>s(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.metaKey||l.ctrlKey)&&(l.preventDefault(),r())},minRows:3,maxRows:6,size:"sm",autoFocus:!0})})}function w({column:e,onClose:a}){const n=e.getFilterValue(),[s,r]=i.useState(n?.min?.toString()??""),[o,l]=i.useState(n?.max?.toString()??""),f=i.useRef(null);i.useEffect(()=>{f.current?.focus({preventScroll:!0})},[]);const p=()=>{const d=s?parseFloat(s):void 0,c=o?parseFloat(o):void 0;d!==void 0||c!==void 0?e.setFilterValue({min:d,max:c}):e.setFilterValue(void 0),a?.()},u=()=>{r(""),l(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:p,onClear:u,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:s,onChange:d=>r(d.target.value),onKeyDown:d=>{d.key==="Enter"&&p()},size:"sm",sx:{flex:1}}),t.jsx("span",{children:"-"}),t.jsx(h.default,{placeholder:"Max",type:"number",value:o,onChange:d=>l(d.target.value),onKeyDown:d=>{d.key==="Enter"&&p()},size:"sm",sx:{flex:1}})]})})}function D({column:e,onClose:a}){const n=e.getFilterValue(),[s,r]=i.useState(n?.start?n.start.toISOString().split("T")[0]:""),[o,l]=i.useState(n?.end?n.end.toISOString().split("T")[0]:""),f=i.useRef(null),p=i.useRef(null);i.useEffect(()=>{p.current?.focus({preventScroll:!0})},[]);const u=()=>{const c=s?new Date(s):void 0,F=o?new Date(o):void 0;c!==void 0||F!==void 0?e.setFilterValue({start:c,end:F}):e.setFilterValue(void 0),a?.()},d=()=>{r(""),l(""),e.setFilterValue(void 0)};return t.jsx(v,{column:e,onApply:u,onClear:d,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:s,ref:p,onChange:c=>r(c.target.value),onKeyDown:c=>{c.key==="Enter"&&u()},size:"sm",slotProps:{input:{placeholder:"Start date"}},autoFocus:!0}),t.jsx(h.default,{type:"date",value:o,onChange:c=>l(c.target.value),onKeyDown:c=>{c.key==="Enter"&&u()},size:"sm",slotProps:{input:{placeholder:"End date"}}})]})})}function q({column:e,options:a,searchable:n=!1,onClose:s}){const[r,o]=i.useState(e.getFilterValue()??""),[l,f]=i.useState(""),p=i.useRef(null),u=i.useRef(null);i.useEffect(()=>{n?p.current?.focus({preventScroll:!0}):u.current?.focus({preventScroll:!0})},[n]);const d=i.useMemo(()=>l?a.filter(x=>x.label.toLowerCase().includes(l.toLowerCase())):a,[a,l]),c=()=>{e.setFilterValue(r||void 0),s?.()},F=()=>{o(""),f(""),e.setFilterValue(void 0)};return t.jsxs(v,{column:e,onApply:c,onClear:F,children:[n&&t.jsx(h.default,{slotProps:{input:{ref:p}},placeholder:"Search...",value:l,onChange:x=>f(x.target.value),size:"sm"}),t.jsxs(C.default,{ref:u,component:"ul",size:"sm",role:"group",tabIndex:0,sx:{maxHeight:n?"200px":"240px",overflowY:"auto",outline:"none","&:focus":{outline:"none"}},children:[d.map(x=>t.jsx(y.default,{component:"li",sx:{paddingLeft:0,paddingTop:0},children:t.jsx(T,{value:x.value,label:x.label,size:"sm",checked:r===x.value,onChange:A=>o(A.target.value),sx:{width:"100%"}})},x.value)),d.length===0&&t.jsx(y.default,{component:"li",sx:{color:"text.tertiary"},children:"No options match"})]})]})}function z({column:e,options:a,onClose:n}){const[s,r]=i.useState(e.getFilterValue()??[]),o=i.useRef(null);i.useEffect(()=>{o.current?.focus()},[]);const l=u=>{r(d=>d.includes(u)?d.filter(c=>c!==u):[...d,u])},f=()=>{e.setFilterValue(s.length>0?s:void 0),n?.()},p=()=>{r([]),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:a.map(u=>t.jsx(y.default,{component:"li",sx:{paddingLeft:0,paddingTop:0},children:t.jsx(L,{label:u.label,checked:s.includes(u.value),onChange:()=>l(u.value),size:"sm",sx:{width:"100%"}},u.value)},u.value))})})}const R={text:b,textarea:V,number:w,date:D,select:q,multiselect:z};function $({column:e,filterType:a="text",filterOptions:n=[],filterSearchable:s}){const[r,o]=i.useState(!1),l=()=>{o(!1)},f=R[a];return t.jsxs(E,{open:r,onOpenChange:(p,u)=>o(u),children:[t.jsx(K,{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 ${S(e)}`,slots:{root:O.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(H,{icon:I.faFilter,size:"xs"})})}),t.jsx(k,{placement:"bottom-start",children:t.jsx(f,{column:e,onClose:l,options:n,searchable:s})})]})}exports.ColumnFilter=$;exports.DateFilter=D;exports.MultiSelectFilter=z;exports.NumericFilter=w;exports.SelectFilter=q;exports.TextAreaFilter=V;exports.TextFilter=b;exports.filterComponentMap=R;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=(u,i,r)=>{const e=u.getValue(i);if(e==null)return!1;const t=String(e).toLowerCase(),n=String(r).toLowerCase();return t.includes(n)},a=(u,i,r)=>{const e=u.getValue(i);if(e==null)return!1;const t=Number(e);if(Number.isNaN(t))return!1;const{min:n,max:l}=r;return n!==void 0&&l!==void 0?t>=n&&t<=l:n!==void 0?t>=n:l!==void 0?t<=l:!0},o=(u,i,r)=>{const e=u.getValue(i);if(e==null)return!1;const t=e instanceof Date?e:new Date(e);if(Number.isNaN(t.getTime()))return!1;const{start:n,end:l}=r;return n&&l?t>=n&&t<=l:n?t>=n:l?t<=l:!0},c=(u,i,r)=>{const e=u.getValue(i);if(e==null)return!1;const t=String(e);return Array.isArray(r)?r.length===0||r.includes(t):r?t===r:!0},f=(u,i,r)=>{if(!Array.isArray(r)||r.length===0)return!0;const e=u.getValue(i);return e==null?!1:r.includes(String(e))};exports.dateFilter=o;exports.multiSelectFilter=f;exports.numericFilter=a;exports.selectFilter=c;exports.textFilter=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=(i,l,r)=>{const e=i.getValue(l);if(e==null)return!1;const t=String(e).toLowerCase(),u=String(r).toLowerCase();return t.includes(u)},a=(i,l,r)=>{const e=i.getValue(l);if(e==null)return!1;const t=String(r).split(/[\n,]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);if(t.length===0)return!0;const u=String(e).toLowerCase();return t.some(n=>u.includes(n))},o=(i,l,r)=>{const e=i.getValue(l);if(e==null)return!1;const t=Number(e);if(Number.isNaN(t))return!1;const{min:u,max:n}=r;return u!==void 0&&n!==void 0?t>=u&&t<=n:u!==void 0?t>=u:n!==void 0?t<=n:!0},c=(i,l,r)=>{const e=i.getValue(l);if(e==null)return!1;const t=e instanceof Date?e:new Date(e);if(Number.isNaN(t.getTime()))return!1;const{start:u,end:n}=r;return u&&n?t>=u&&t<=n:u?t>=u:n?t<=n:!0},f=(i,l,r)=>{const e=i.getValue(l);if(e==null)return!1;const t=String(e);return Array.isArray(r)?r.length===0||r.includes(t):r?t===r:!0},g=(i,l,r)=>{if(!Array.isArray(r)||r.length===0)return!0;const e=i.getValue(l);return e==null?!1:r.includes(String(e))};exports.dateFilter=c;exports.multiSelectFilter=g;exports.numericFilter=o;exports.selectFilter=f;exports.textFilter=s;exports.textareaFilter=a;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),ae=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"),n=require("react"),z=require("../../../../hooks/useLocalStorage.cjs"),U=require("../../../inputs/Checkbox/Checkbox.cjs"),c=require("../filters/filterFunctions.cjs"),a=require("../tableUrlUtils.cjs"),ge=require("./useInfiniteScroll.cjs"),M=require("../../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.cjs");function fe({table:i}){return P.jsx(U,{checked:i.getIsAllRowsSelected(),indeterminate:i.getIsSomeRowsSelected(),onChange:l=>i.toggleAllRowsSelected(l.target.checked),size:"md"})}function de({row:i}){return P.jsx(U,{checked:i.getIsSelected(),disabled:!i.getCanSelect(),onChange:l=>i.toggleSelected(l.target.checked),size:"md"})}function me({id:i,loading:l=!1,reactTableOptions:t,gridCheckboxes:m=!1,allSelected:b=!1,onSelectionChange:V,infiniteScroll:u,syncUrl:g=!1,urlParamPrefix:f="",initialWrapText:$=!1}){const{columns:r}=t,A=n.useRef(a.extractColumnFilterTypes(r)),[k,G]=n.useState(()=>{if(g&&typeof window<"u"){const e=new URLSearchParams(window.location.search);return a.parseSortingFromUrl(e,f)}return[]}),[p,W]=n.useState(()=>{if(g&&typeof window<"u"){const e=new URLSearchParams(window.location.search);return a.parseFiltersFromUrl(e,f,A.current)}return[]}),[S,q]=z.useLocalStorage(`table.${i}.wrapText`,$),K=n.useCallback(()=>{q(!S)},[S,q]),[_,J]=z.useLocalStorage(`table.${i}.columnSizing`,{}),Q=n.useRef(r),h=n.useMemo(()=>{const e={};return Q.current.forEach(s=>{const o=s.id??s.accessorKey;o&&s.meta?.hidden&&(e[o]=!1)}),e},[]),[C,d]=z.useLocalStorage(`table.${i}.columnVisibility`,h),X=n.useCallback(()=>{d(h)},[h,d]),Y=n.useCallback(e=>{d(typeof e=="function"?e(C):e)},[C,d]),[Z,T]=n.useState({}),O=n.useCallback(e=>{T(s=>{const o=typeof e=="function"?e(s):e;return V?.(o),o})},[V]),E=n.useRef(null),R=n.useRef(t.data),ee=l&&R.current.length>0?R.current:t.data;n.useEffect(()=>{!l&&t.data.length>0&&(R.current=t.data)},[l,t.data]);const w=n.useRef(null),te=n.useRef(null),ne=n.useMemo(()=>{const e=[],s=[];return r.forEach(o=>{o.meta?.pinned==="left"&&o.id?e.push(o.id):o.meta?.pinned==="right"&&o.id&&s.push(o.id)}),{left:e,right:s}},[r]),oe=n.useMemo(()=>{let e=[...r];return e=e.map(s=>{const o=s.meta?.filterType;if(o&&!s.filterFn){const x={text:c.textFilter,number:c.numericFilter,date:c.dateFilter,select:c.selectFilter,multiselect:c.multiSelectFilter};return{...s,filterFn:x[o]}}return s}),m&&(e=[{id:"select",size:32,enableSorting:!1,enableResizing:!1,meta:{noSortButton:!0},header:fe,cell:de},...e]),e},[m,r]),F=ae.useReactTable({columnResizeDirection:"ltr",defaultColumn:{size:200,minSize:20,maxSize:500},...t,getCoreRowModel:M.getCoreRowModel(),getSortedRowModel:M.getSortedRowModel(),getFilteredRowModel:M.getFilteredRowModel(),columns:oe,data:ee,enableSorting:t.enableSorting??!0,enableColumnResizing:t.enableColumnResizing??!0,columnResizeMode:t.columnResizeMode??"onChange",onColumnSizingChange:t.onColumnSizingChange??J,onSortingChange:t.onSortingChange??G,onColumnFiltersChange:t.onColumnFiltersChange??W,onColumnVisibilityChange:t.onColumnVisibilityChange??Y,enableRowSelection:m,onRowSelectionChange:t.onRowSelectionChange??O,state:{...t.state,rowSelection:t.state?.rowSelection??Z,sorting:t.state?.sorting??k,columnFilters:t.state?.columnFilters??p,columnSizing:_,columnPinning:ne,columnVisibility:t.state?.columnVisibility??C}}),{rows:v}=F.getRowModel(),{enabled:se,virtualItems:ie,paddingTop:le,paddingBottom:re,measureElement:ue}=ge.useInfiniteScroll(v.length,u,w),I=u?.enabled,L=u?.hasNextPage,N=u?.isFetchingNextPage,D=u?.fetchNextPage,ce=200,y=n.useCallback(e=>{if(!e||!I)return;const{scrollHeight:s,scrollTop:o,clientHeight:x}=e;s-o-x<ce&&!N&&L&&D?.()},[I,L,N,D]);n.useEffect(()=>{y(w.current)},[y]),E.current=F,n.useEffect(()=>{E.current?.toggleAllRowsSelected(b)},[b]);const H=t.state?.sorting??k,j=t.state?.columnFilters??p,B=n.useMemo(()=>a.extractColumnFilterTypes(r),[r]);return n.useEffect(()=>{!g||typeof window>"u"||a.syncStateToUrl(H,j,f,B)},[g,H,j,f,B]),{id:i,table:F,rows:v,isVirtual:se,virtualItems:ie,paddingTop:le,paddingBottom:re,measureElement:ue,wrapperRef:w,toolbarRef:te,loading:l,fetchMoreOnBottomReached:y,resetColumnVisibility:X,wrapText:S,toggleWrapText:K}}exports.useDataGrid=me;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),ae=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"),n=require("react"),z=require("../../../../hooks/useLocalStorage.cjs"),U=require("../../../inputs/Checkbox/Checkbox.cjs"),u=require("../filters/filterFunctions.cjs"),a=require("../tableUrlUtils.cjs"),ge=require("./useInfiniteScroll.cjs"),M=require("../../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.cjs");function fe({table:i}){return P.jsx(U,{checked:i.getIsAllRowsSelected(),indeterminate:i.getIsSomeRowsSelected(),onChange:l=>i.toggleAllRowsSelected(l.target.checked),size:"md"})}function de({row:i}){return P.jsx(U,{checked:i.getIsSelected(),disabled:!i.getCanSelect(),onChange:l=>i.toggleSelected(l.target.checked),size:"md"})}function me({id:i,loading:l=!1,reactTableOptions:t,gridCheckboxes:m=!1,allSelected:b=!1,onSelectionChange:V,infiniteScroll:c,syncUrl:g=!1,urlParamPrefix:f="",initialWrapText:$=!1}){const{columns:r}=t,A=n.useRef(a.extractColumnFilterTypes(r)),[k,G]=n.useState(()=>{if(g&&typeof window<"u"){const e=new URLSearchParams(window.location.search);return a.parseSortingFromUrl(e,f)}return[]}),[p,W]=n.useState(()=>{if(g&&typeof window<"u"){const e=new URLSearchParams(window.location.search);return a.parseFiltersFromUrl(e,f,A.current)}return[]}),[S,q]=z.useLocalStorage(`table.${i}.wrapText`,$),K=n.useCallback(()=>{q(!S)},[S,q]),[_,J]=z.useLocalStorage(`table.${i}.columnSizing`,{}),Q=n.useRef(r),h=n.useMemo(()=>{const e={};return Q.current.forEach(s=>{const o=s.id??s.accessorKey;o&&s.meta?.hidden&&(e[o]=!1)}),e},[]),[C,d]=z.useLocalStorage(`table.${i}.columnVisibility`,h),X=n.useCallback(()=>{d(h)},[h,d]),Y=n.useCallback(e=>{d(typeof e=="function"?e(C):e)},[C,d]),[Z,T]=n.useState({}),O=n.useCallback(e=>{T(s=>{const o=typeof e=="function"?e(s):e;return V?.(o),o})},[V]),E=n.useRef(null),R=n.useRef(t.data),ee=l&&R.current.length>0?R.current:t.data;n.useEffect(()=>{!l&&t.data.length>0&&(R.current=t.data)},[l,t.data]);const w=n.useRef(null),te=n.useRef(null),ne=n.useMemo(()=>{const e=[],s=[];return r.forEach(o=>{o.meta?.pinned==="left"&&o.id?e.push(o.id):o.meta?.pinned==="right"&&o.id&&s.push(o.id)}),{left:e,right:s}},[r]),oe=n.useMemo(()=>{let e=[...r];return e=e.map(s=>{const o=s.meta?.filterType;if(o&&!s.filterFn){const x={text:u.textFilter,textarea:u.textareaFilter,number:u.numericFilter,date:u.dateFilter,select:u.selectFilter,multiselect:u.multiSelectFilter};return{...s,filterFn:x[o]}}return s}),m&&(e=[{id:"select",size:32,enableSorting:!1,enableResizing:!1,meta:{noSortButton:!0},header:fe,cell:de},...e]),e},[m,r]),F=ae.useReactTable({columnResizeDirection:"ltr",defaultColumn:{size:200,minSize:20,maxSize:500},...t,getCoreRowModel:M.getCoreRowModel(),getSortedRowModel:M.getSortedRowModel(),getFilteredRowModel:M.getFilteredRowModel(),columns:oe,data:ee,enableSorting:t.enableSorting??!0,enableColumnResizing:t.enableColumnResizing??!0,columnResizeMode:t.columnResizeMode??"onChange",onColumnSizingChange:t.onColumnSizingChange??J,onSortingChange:t.onSortingChange??G,onColumnFiltersChange:t.onColumnFiltersChange??W,onColumnVisibilityChange:t.onColumnVisibilityChange??Y,enableRowSelection:m,onRowSelectionChange:t.onRowSelectionChange??O,state:{...t.state,rowSelection:t.state?.rowSelection??Z,sorting:t.state?.sorting??k,columnFilters:t.state?.columnFilters??p,columnSizing:_,columnPinning:ne,columnVisibility:t.state?.columnVisibility??C}}),{rows:v}=F.getRowModel(),{enabled:se,virtualItems:ie,paddingTop:le,paddingBottom:re,measureElement:ue}=ge.useInfiniteScroll(v.length,c,w),I=c?.enabled,L=c?.hasNextPage,N=c?.isFetchingNextPage,D=c?.fetchNextPage,ce=200,y=n.useCallback(e=>{if(!e||!I)return;const{scrollHeight:s,scrollTop:o,clientHeight:x}=e;s-o-x<ce&&!N&&L&&D?.()},[I,L,N,D]);n.useEffect(()=>{y(w.current)},[y]),E.current=F,n.useEffect(()=>{E.current?.toggleAllRowsSelected(b)},[b]);const H=t.state?.sorting??k,j=t.state?.columnFilters??p,B=n.useMemo(()=>a.extractColumnFilterTypes(r),[r]);return n.useEffect(()=>{!g||typeof window>"u"||a.syncStateToUrl(H,j,f,B)},[g,H,j,f,B]),{id:i,table:F,rows:v,isVirtual:se,virtualItems:ie,paddingTop:le,paddingBottom:re,measureElement:ue,wrapperRef:w,toolbarRef:te,loading:l,fetchMoreOnBottomReached:y,resetColumnVisibility:X,wrapText:S,toggleWrapText:K}}exports.useDataGrid=me;
@@ -61,7 +61,6 @@
61
61
  -webkit-line-clamp: 3;
62
62
  -webkit-box-orient: vertical;
63
63
  white-space: normal;
64
- font-size: 0.75rem;
65
64
  `,h=t.div`
66
65
  display: flex;
67
66
  align-items: center;
@@ -80,4 +79,4 @@
80
79
  align-items: flex-start;
81
80
  z-index: 1;
82
81
  padding-top: 10%;
83
- `,b=(e,o,n,a,r)=>({...e,tableLayout:"fixed",width:"100%",minWidth:`${o}px`,"& thead":{transition:"opacity 0.1s"},"& thead th":{backgroundColor:"background.body",fontWeight:"bold",fontSize:"sm",verticalAlign:"middle",position:"sticky",zIndex:1,top:!r&&a?"var(--header-top, 0px)":0},"& tfoot":{position:"sticky",zIndex:1,bottom:0},"& td, & td>div, & td>a":{whiteSpace:n?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"middle"},"& th[data-pinned='right'], & td[data-pinned='right']":{position:"sticky",right:0,background:"var(--palette-background-surface)",boxShadow:"-2px 0 4px rgba(0, 0, 0, 0.08)","&::before":{content:'""',position:"absolute",top:0,left:"-10px",width:"10px",height:"100%",background:"linear-gradient(to right, transparent, rgba(0, 0, 0, 0.05))",pointerEvents:"none"}},"& th[data-pinned='right']":{background:"var(--palette-background-surface)"},"& th[data-pinned='left'], & td[data-pinned='left']":{position:"sticky",left:0,background:"var(--palette-background-surface)",boxShadow:"2px 0 4px rgba(0, 0, 0, 0.08)","&::after":{content:'""',position:"absolute",top:0,right:"-10px",width:"10px",height:"100%",background:"linear-gradient(to left, transparent, rgba(0, 0, 0, 0.05))",pointerEvents:"none"}},"& th[data-pinned='left']":{background:"var(--palette-background-surface)",zIndex:2},"& .resizer":{position:"absolute",right:0,top:0,height:"100%",width:"3px",background:"var(--palette-primary-500)",cursor:"col-resize",userSelect:"none",touchAction:"none",zIndex:1,"@media (hover: hover)":{opacity:0}},"& .resizer.isResizing":{background:"var(--palette-primary-500)",opacity:1},"& *:hover > .resizer":{"@media (hover: hover)":{opacity:1}},"& th button":{display:"flex",alignItems:"center",flexWrap:"nowrap",gap:"2px",position:"relative",border:"none",cursor:"pointer",padding:0,textAlign:"left",fontWeight:"inherit",fontSize:"inherit",width:"100%",whiteSpace:"wrap",height:"100%",flex:0,"& i.fade":{opacity:0,transition:"opacity 0.2s ease-in-out"},"&:hover i.fade":{opacity:.5}}});exports.ColumnHeaderContainer=s;exports.HeaderContent=h;exports.HeaderLabel=c;exports.LoadingOverlay=g;exports.SortButton=i;exports.SortIcon=p;exports.TableWrapper=l;exports.getTableStyles=b;
82
+ `,b=(e,o,n,a,r)=>({...e,tableLayout:"fixed",width:"100%",minWidth:`${o}px`,"& thead":{transition:"opacity 0.1s"},"& thead th":{backgroundColor:"background.body",fontWeight:"bold",fontSize:"0.75rem",verticalAlign:"middle",position:"sticky",zIndex:1,top:!r&&a?"var(--header-top, 0px)":0},"& tfoot":{position:"sticky",zIndex:1,bottom:0},"& td, & td>div, & td>a":{whiteSpace:n?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"middle"},"& th[data-pinned='right'], & td[data-pinned='right']":{position:"sticky",right:0,background:"var(--palette-background-surface)",boxShadow:"-2px 0 4px rgba(0, 0, 0, 0.08)","&::before":{content:'""',position:"absolute",top:0,left:"-10px",width:"10px",height:"100%",background:"linear-gradient(to right, transparent, rgba(0, 0, 0, 0.05))",pointerEvents:"none"}},"& th[data-pinned='right']":{background:"var(--palette-background-surface)"},"& th[data-pinned='left'], & td[data-pinned='left']":{position:"sticky",left:0,background:"var(--palette-background-surface)",boxShadow:"2px 0 4px rgba(0, 0, 0, 0.08)","&::after":{content:'""',position:"absolute",top:0,right:"-10px",width:"10px",height:"100%",background:"linear-gradient(to left, transparent, rgba(0, 0, 0, 0.05))",pointerEvents:"none"}},"& th[data-pinned='left']":{background:"var(--palette-background-surface)",zIndex:2},"& .resizer":{position:"absolute",right:0,top:0,height:"100%",width:"3px",background:"var(--palette-primary-500)",cursor:"col-resize",userSelect:"none",touchAction:"none",zIndex:1,"@media (hover: hover)":{opacity:0}},"& .resizer.isResizing":{background:"var(--palette-primary-500)",opacity:1},"& *:hover > .resizer":{"@media (hover: hover)":{opacity:1}},"& th button":{display:"flex",alignItems:"center",flexWrap:"nowrap",gap:"2px",position:"relative",border:"none",cursor:"pointer",padding:0,textAlign:"left",fontWeight:"inherit",fontSize:"inherit",width:"100%",whiteSpace:"wrap",height:"100%",flex:0,"& i.fade":{opacity:0,transition:"opacity 0.2s ease-in-out"},"&:hover i.fade":{opacity:.5}}});exports.ColumnHeaderContainer=s;exports.HeaderContent=h;exports.HeaderLabel=c;exports.LoadingOverlay=g;exports.SortButton=i;exports.SortIcon=p;exports.TableWrapper=l;exports.getTableStyles=b;
@@ -1,153 +1,194 @@
1
- import { jsx as t, jsxs as m } from "react/jsx-runtime";
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";
1
+ import { jsx as r, jsxs as m } from "react/jsx-runtime";
2
+ import { faFilter as D } from "../../../../node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.js";
3
+ import i from "react";
4
+ import y from "styled-components";
5
5
  import z from "../../../inputs/RadioButton/RadioButton.js";
6
- import D from "../../../navigation/Dropdown/Dropdown.js";
7
- import A from "../../../navigation/Menu/Menu.js";
8
- import R from "../../Icon/Icon.js";
6
+ import A from "../../../inputs/Textarea/Textarea.js";
7
+ import I from "../../../navigation/Dropdown/Dropdown.js";
8
+ import R from "../../../navigation/Menu/Menu.js";
9
+ import E from "../../Icon/Icon.js";
9
10
  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
11
  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";
12
+ 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/ListItem/ListItem.js";
13
+ 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/Checkbox/Checkbox.js";
13
14
  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
15
  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";
16
+ import T 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";
17
+ import H 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";
18
+ 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
19
  function V(e) {
19
- const { header: i } = e.columnDef;
20
- return String(typeof i == "function" ? i({ column: e }) : i);
20
+ const { meta: o } = e.columnDef;
21
+ if (o?.filterLabel) return o.filterLabel;
22
+ const { header: t } = e.columnDef;
23
+ if (typeof t == "string") return t;
24
+ if (typeof t == "function") {
25
+ const l = t({ column: e });
26
+ return typeof l == "string" ? l : e.id;
27
+ }
28
+ return e.id;
21
29
  }
22
- const B = C(g)`
30
+ const L = y(g)`
23
31
  padding: 12px;
24
32
  min-width: 250px;
25
33
  display: flex;
26
34
  flex-direction: column;
27
35
  gap: 12px;
28
- `, H = C(g)`
36
+ `, K = y(g)`
29
37
  display: flex;
30
38
  justify-content: space-between;
31
39
  align-items: center;
32
40
  font-weight: 600;
33
41
  font-size: 14px;
34
42
  margin-bottom: 4px;
35
- `, T = C(g)`
43
+ `, B = y(g)`
36
44
  display: flex;
37
45
  gap: 8px;
38
46
  justify-content: flex-end;
39
47
  margin-top: 8px;
40
48
  padding-top: 8px;
41
49
  border-top: 1px solid var(--palette-divider);
50
+ `, O = y(g)`
51
+ font-size: 12px;
52
+ color: var(--palette-text-tertiary);
53
+ margin-top: -6px;
42
54
  `;
43
55
  function v({
44
56
  column: e,
45
- onApply: i,
46
- onClear: n,
47
- children: l
57
+ onApply: o,
58
+ onClear: t,
59
+ children: a
48
60
  }) {
49
- return /* @__PURE__ */ m(B, { children: [
50
- /* @__PURE__ */ m(H, { children: [
61
+ const l = e.columnDef.meta?.filterHelpText;
62
+ return /* @__PURE__ */ m(L, { children: [
63
+ /* @__PURE__ */ m(K, { children: [
51
64
  "Filter by ",
52
65
  V(e)
53
66
  ] }),
54
- l,
55
- /* @__PURE__ */ m(T, { children: [
56
- /* @__PURE__ */ t(
67
+ a,
68
+ l && /* @__PURE__ */ r(O, { children: l }),
69
+ /* @__PURE__ */ m(B, { children: [
70
+ /* @__PURE__ */ r(
57
71
  S,
58
72
  {
59
73
  "aria-label": "Clear filter",
60
74
  size: "sm",
61
75
  variant: "plain",
62
- onClick: n,
76
+ onClick: t,
63
77
  children: "Clear"
64
78
  }
65
79
  ),
66
- /* @__PURE__ */ t(
80
+ /* @__PURE__ */ r(
67
81
  S,
68
82
  {
69
83
  "aria-label": "Apply filter",
70
84
  size: "sm",
71
85
  variant: "solid",
72
86
  color: "primary",
73
- onClick: i,
87
+ onClick: o,
74
88
  children: "Apply"
75
89
  }
76
90
  )
77
91
  ] })
78
92
  ] });
79
93
  }
80
- function K({
94
+ function P({
81
95
  column: e,
82
- onClose: i
96
+ onClose: o
83
97
  }) {
84
- const [n, l] = r.useState(
98
+ const [t, a] = i.useState(
85
99
  e.getFilterValue() ?? ""
86
- ), p = () => {
87
- e.setFilterValue(n || void 0), i?.();
100
+ ), l = () => {
101
+ e.setFilterValue(t || void 0), o?.();
88
102
  };
89
- return /* @__PURE__ */ t(v, { column: e, onApply: p, onClear: () => {
90
- l(""), e.setFilterValue(void 0);
91
- }, children: /* @__PURE__ */ t(
103
+ return /* @__PURE__ */ r(v, { column: e, onApply: l, onClear: () => {
104
+ a(""), e.setFilterValue(void 0);
105
+ }, children: /* @__PURE__ */ r(
92
106
  x,
93
107
  {
94
108
  placeholder: "Search...",
95
- value: n,
96
- onChange: (a) => l(a.target.value),
97
- onKeyDown: (a) => {
98
- a.key === "Enter" && p();
109
+ value: t,
110
+ onChange: (n) => a(n.target.value),
111
+ onKeyDown: (n) => {
112
+ n.key === "Enter" && l();
99
113
  },
100
114
  size: "sm",
101
115
  autoFocus: !0
102
116
  }
103
117
  ) });
104
118
  }
105
- function O({
119
+ function j({
106
120
  column: e,
107
- onClose: i
121
+ onClose: o
108
122
  }) {
109
- const n = e.getFilterValue(), [l, p] = r.useState(
110
- n?.min?.toString() ?? ""
111
- ), [d, a] = r.useState(
112
- n?.max?.toString() ?? ""
113
- ), f = r.useRef(null);
114
- r.useEffect(() => {
123
+ const [t, a] = i.useState(
124
+ e.getFilterValue() ?? ""
125
+ ), l = () => {
126
+ e.setFilterValue(t.trim() || void 0), o?.();
127
+ };
128
+ return /* @__PURE__ */ r(v, { column: e, onApply: l, onClear: () => {
129
+ a(""), e.setFilterValue(void 0);
130
+ }, children: /* @__PURE__ */ r(
131
+ A,
132
+ {
133
+ placeholder: "One term per line or comma-separated...",
134
+ value: t,
135
+ onChange: (n) => a(n.target.value),
136
+ onKeyDown: (n) => {
137
+ n.key === "Enter" && (n.metaKey || n.ctrlKey) && (n.preventDefault(), l());
138
+ },
139
+ minRows: 3,
140
+ maxRows: 6,
141
+ size: "sm",
142
+ autoFocus: !0
143
+ }
144
+ ) });
145
+ }
146
+ function N({
147
+ column: e,
148
+ onClose: o
149
+ }) {
150
+ const t = e.getFilterValue(), [a, l] = i.useState(
151
+ t?.min?.toString() ?? ""
152
+ ), [d, n] = i.useState(
153
+ t?.max?.toString() ?? ""
154
+ ), f = i.useRef(null);
155
+ i.useEffect(() => {
115
156
  f.current?.focus({
116
157
  preventScroll: !0
117
158
  });
118
159
  }, []);
119
160
  const c = () => {
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?.();
161
+ const p = a ? parseFloat(a) : void 0, u = d ? parseFloat(d) : void 0;
162
+ p !== void 0 || u !== void 0 ? e.setFilterValue({ min: p, max: u }) : e.setFilterValue(void 0), o?.();
122
163
  };
123
- return /* @__PURE__ */ t(v, { column: e, onApply: c, onClear: () => {
124
- p(""), a(""), e.setFilterValue(void 0);
164
+ return /* @__PURE__ */ r(v, { column: e, onApply: c, onClear: () => {
165
+ l(""), n(""), e.setFilterValue(void 0);
125
166
  }, children: /* @__PURE__ */ m(g, { sx: { display: "flex", gap: 1, alignItems: "center" }, children: [
126
- /* @__PURE__ */ t(
167
+ /* @__PURE__ */ r(
127
168
  x,
128
169
  {
129
170
  slotProps: { input: { ref: f } },
130
171
  placeholder: "Min",
131
172
  type: "number",
132
- value: l,
133
- onChange: (s) => p(s.target.value),
134
- onKeyDown: (s) => {
135
- s.key === "Enter" && c();
173
+ value: a,
174
+ onChange: (p) => l(p.target.value),
175
+ onKeyDown: (p) => {
176
+ p.key === "Enter" && c();
136
177
  },
137
178
  size: "sm",
138
179
  sx: { flex: 1 }
139
180
  }
140
181
  ),
141
- /* @__PURE__ */ t("span", { children: "-" }),
142
- /* @__PURE__ */ t(
182
+ /* @__PURE__ */ r("span", { children: "-" }),
183
+ /* @__PURE__ */ r(
143
184
  x,
144
185
  {
145
186
  placeholder: "Max",
146
187
  type: "number",
147
188
  value: d,
148
- onChange: (s) => a(s.target.value),
149
- onKeyDown: (s) => {
150
- s.key === "Enter" && c();
189
+ onChange: (p) => n(p.target.value),
190
+ onKeyDown: (p) => {
191
+ p.key === "Enter" && c();
151
192
  },
152
193
  size: "sm",
153
194
  sx: { flex: 1 }
@@ -155,26 +196,26 @@ function O({
155
196
  )
156
197
  ] }) });
157
198
  }
158
- function P({
199
+ function W({
159
200
  column: e,
160
- onClose: i
201
+ onClose: o
161
202
  }) {
162
- const n = e.getFilterValue(), [l, p] = r.useState(
163
- n?.start ? n.start.toISOString().split("T")[0] : ""
164
- ), [d, a] = r.useState(
165
- n?.end ? n.end.toISOString().split("T")[0] : ""
166
- ), f = r.useRef(null), c = r.useRef(null);
167
- r.useEffect(() => {
203
+ const t = e.getFilterValue(), [a, l] = i.useState(
204
+ t?.start ? t.start.toISOString().split("T")[0] : ""
205
+ ), [d, n] = i.useState(
206
+ t?.end ? t.end.toISOString().split("T")[0] : ""
207
+ ), f = i.useRef(null), c = i.useRef(null);
208
+ i.useEffect(() => {
168
209
  c.current?.focus({
169
210
  preventScroll: !0
170
211
  });
171
212
  }, []);
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?.();
213
+ const s = () => {
214
+ const u = a ? new Date(a) : void 0, F = d ? new Date(d) : void 0;
215
+ u !== void 0 || F !== void 0 ? e.setFilterValue({ start: u, end: F }) : e.setFilterValue(void 0), o?.();
175
216
  };
176
- return /* @__PURE__ */ t(v, { column: e, onApply: o, onClear: () => {
177
- p(""), a(""), e.setFilterValue(void 0);
217
+ return /* @__PURE__ */ r(v, { column: e, onApply: s, onClear: () => {
218
+ l(""), n(""), e.setFilterValue(void 0);
178
219
  }, children: /* @__PURE__ */ m(
179
220
  g,
180
221
  {
@@ -190,15 +231,15 @@ function P({
190
231
  }
191
232
  },
192
233
  children: [
193
- /* @__PURE__ */ t(
234
+ /* @__PURE__ */ r(
194
235
  x,
195
236
  {
196
237
  type: "date",
197
- value: l,
238
+ value: a,
198
239
  ref: c,
199
- onChange: (u) => p(u.target.value),
240
+ onChange: (u) => l(u.target.value),
200
241
  onKeyDown: (u) => {
201
- u.key === "Enter" && o();
242
+ u.key === "Enter" && s();
202
243
  },
203
244
  size: "sm",
204
245
  slotProps: {
@@ -209,14 +250,14 @@ function P({
209
250
  autoFocus: !0
210
251
  }
211
252
  ),
212
- /* @__PURE__ */ t(
253
+ /* @__PURE__ */ r(
213
254
  x,
214
255
  {
215
256
  type: "date",
216
257
  value: d,
217
- onChange: (u) => a(u.target.value),
258
+ onChange: (u) => n(u.target.value),
218
259
  onKeyDown: (u) => {
219
- u.key === "Enter" && o();
260
+ u.key === "Enter" && s();
220
261
  },
221
262
  size: "sm",
222
263
  slotProps: {
@@ -230,35 +271,35 @@ function P({
230
271
  }
231
272
  ) });
232
273
  }
233
- function j({
274
+ function _({
234
275
  column: e,
235
- options: i,
236
- searchable: n = !1,
237
- onClose: l
276
+ options: o,
277
+ searchable: t = !1,
278
+ onClose: a
238
279
  }) {
239
- const [p, d] = r.useState(
280
+ const [l, d] = i.useState(
240
281
  e.getFilterValue() ?? ""
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
- }, [n]);
245
- const s = r.useMemo(
246
- () => a ? i.filter(
247
- (h) => h.label.toLowerCase().includes(a.toLowerCase())
248
- ) : i,
249
- [i, a]
282
+ ), [n, f] = i.useState(""), c = i.useRef(null), s = i.useRef(null);
283
+ i.useEffect(() => {
284
+ t ? c.current?.focus({ preventScroll: !0 }) : s.current?.focus({ preventScroll: !0 });
285
+ }, [t]);
286
+ const p = i.useMemo(
287
+ () => n ? o.filter(
288
+ (h) => h.label.toLowerCase().includes(n.toLowerCase())
289
+ ) : o,
290
+ [o, n]
250
291
  );
251
292
  return /* @__PURE__ */ m(v, { column: e, onApply: () => {
252
- e.setFilterValue(p || void 0), l?.();
293
+ e.setFilterValue(l || void 0), a?.();
253
294
  }, onClear: () => {
254
295
  d(""), f(""), e.setFilterValue(void 0);
255
296
  }, children: [
256
- n && /* @__PURE__ */ t(
297
+ t && /* @__PURE__ */ r(
257
298
  x,
258
299
  {
259
300
  slotProps: { input: { ref: c } },
260
301
  placeholder: "Search...",
261
- value: a,
302
+ value: n,
262
303
  onChange: (h) => f(h.target.value),
263
304
  size: "sm"
264
305
  }
@@ -266,30 +307,30 @@ function j({
266
307
  /* @__PURE__ */ m(
267
308
  b,
268
309
  {
269
- ref: o,
310
+ ref: s,
270
311
  component: "ul",
271
312
  size: "sm",
272
313
  role: "group",
273
314
  tabIndex: 0,
274
315
  sx: {
275
- maxHeight: n ? "200px" : "240px",
316
+ maxHeight: t ? "200px" : "240px",
276
317
  overflowY: "auto",
277
318
  outline: "none",
278
319
  "&:focus": { outline: "none" }
279
320
  },
280
321
  children: [
281
- s.map((h) => /* @__PURE__ */ t(
282
- F,
322
+ p.map((h) => /* @__PURE__ */ r(
323
+ C,
283
324
  {
284
325
  component: "li",
285
326
  sx: { paddingLeft: 0, paddingTop: 0 },
286
- children: /* @__PURE__ */ t(
327
+ children: /* @__PURE__ */ r(
287
328
  z,
288
329
  {
289
330
  value: h.value,
290
331
  label: h.label,
291
332
  size: "sm",
292
- checked: p === h.value,
333
+ checked: l === h.value,
293
334
  onChange: (w) => d(w.target.value),
294
335
  sx: {
295
336
  width: "100%"
@@ -299,33 +340,33 @@ function j({
299
340
  },
300
341
  h.value
301
342
  )),
302
- s.length === 0 && /* @__PURE__ */ t(F, { component: "li", sx: { color: "text.tertiary" }, children: "No options match" })
343
+ p.length === 0 && /* @__PURE__ */ r(C, { component: "li", sx: { color: "text.tertiary" }, children: "No options match" })
303
344
  ]
304
345
  }
305
346
  )
306
347
  ] });
307
348
  }
308
- function N({
349
+ function Y({
309
350
  column: e,
310
- options: i,
311
- onClose: n
351
+ options: o,
352
+ onClose: t
312
353
  }) {
313
- const [l, p] = r.useState(
354
+ const [a, l] = i.useState(
314
355
  e.getFilterValue() ?? []
315
- ), d = r.useRef(null);
316
- r.useEffect(() => {
356
+ ), d = i.useRef(null);
357
+ i.useEffect(() => {
317
358
  d.current?.focus();
318
359
  }, []);
319
- const a = (o) => {
320
- p(
321
- (s) => s.includes(o) ? s.filter((u) => u !== o) : [...s, o]
360
+ const n = (s) => {
361
+ l(
362
+ (p) => p.includes(s) ? p.filter((u) => u !== s) : [...p, s]
322
363
  );
323
364
  };
324
- return /* @__PURE__ */ t(v, { column: e, onApply: () => {
325
- e.setFilterValue(l.length > 0 ? l : void 0), n?.();
365
+ return /* @__PURE__ */ r(v, { column: e, onApply: () => {
366
+ e.setFilterValue(a.length > 0 ? a : void 0), t?.();
326
367
  }, onClear: () => {
327
- p([]), e.setFilterValue(void 0);
328
- }, children: /* @__PURE__ */ t(
368
+ l([]), e.setFilterValue(void 0);
369
+ }, children: /* @__PURE__ */ r(
329
370
  b,
330
371
  {
331
372
  ref: d,
@@ -341,49 +382,50 @@ function N({
341
382
  outline: "none"
342
383
  }
343
384
  },
344
- children: i.map((o) => /* @__PURE__ */ t(
345
- F,
385
+ children: o.map((s) => /* @__PURE__ */ r(
386
+ C,
346
387
  {
347
388
  component: "li",
348
389
  sx: { paddingLeft: 0, paddingTop: 0 },
349
- children: /* @__PURE__ */ t(
350
- E,
390
+ children: /* @__PURE__ */ r(
391
+ k,
351
392
  {
352
- label: o.label,
353
- checked: l.includes(o.value),
354
- onChange: () => a(o.value),
393
+ label: s.label,
394
+ checked: a.includes(s.value),
395
+ onChange: () => n(s.value),
355
396
  size: "sm",
356
397
  sx: {
357
398
  width: "100%"
358
399
  }
359
400
  },
360
- o.value
401
+ s.value
361
402
  )
362
403
  },
363
- o.value
404
+ s.value
364
405
  ))
365
406
  }
366
407
  ) });
367
408
  }
368
- const W = {
369
- text: K,
370
- number: O,
371
- date: P,
372
- select: j,
373
- multiselect: N
409
+ const $ = {
410
+ text: P,
411
+ textarea: j,
412
+ number: N,
413
+ date: W,
414
+ select: _,
415
+ multiselect: Y
374
416
  };
375
- function ae({
417
+ function ue({
376
418
  column: e,
377
- filterType: i = "text",
378
- filterOptions: n = [],
379
- filterSearchable: l
419
+ filterType: o = "text",
420
+ filterOptions: t = [],
421
+ filterSearchable: a
380
422
  }) {
381
- const [p, d] = r.useState(!1), a = () => {
423
+ const [l, d] = i.useState(!1), n = () => {
382
424
  d(!1);
383
- }, f = W[i];
384
- return /* @__PURE__ */ m(D, { open: p, onOpenChange: (c, o) => d(o), children: [
385
- /* @__PURE__ */ t(
386
- k,
425
+ }, f = $[o];
426
+ return /* @__PURE__ */ m(I, { open: l, onOpenChange: (c, s) => d(s), children: [
427
+ /* @__PURE__ */ r(
428
+ T,
387
429
  {
388
430
  badgeContent: "",
389
431
  invisible: !e.getIsFiltered(),
@@ -398,13 +440,13 @@ function ae({
398
440
  borderRadius: "50%"
399
441
  }
400
442
  },
401
- children: /* @__PURE__ */ t(
402
- M,
443
+ children: /* @__PURE__ */ r(
444
+ H,
403
445
  {
404
446
  "aria-label": `${e.getIsFiltered() ? "Filtered" : "Filter"} by ${V(
405
447
  e
406
448
  )}`,
407
- slots: { root: L },
449
+ slots: { root: M },
408
450
  slotProps: {
409
451
  root: {
410
452
  size: "sm",
@@ -425,28 +467,29 @@ function ae({
425
467
  }
426
468
  }
427
469
  },
428
- children: /* @__PURE__ */ t(R, { icon: I, size: "xs" })
470
+ children: /* @__PURE__ */ r(E, { icon: D, size: "xs" })
429
471
  }
430
472
  )
431
473
  }
432
474
  ),
433
- /* @__PURE__ */ t(A, { placement: "bottom-start", children: /* @__PURE__ */ t(
475
+ /* @__PURE__ */ r(R, { placement: "bottom-start", children: /* @__PURE__ */ r(
434
476
  f,
435
477
  {
436
478
  column: e,
437
- onClose: a,
438
- options: n,
439
- searchable: l
479
+ onClose: n,
480
+ options: t,
481
+ searchable: a
440
482
  }
441
483
  ) })
442
484
  ] });
443
485
  }
444
486
  export {
445
- ae as ColumnFilter,
446
- P as DateFilter,
447
- N as MultiSelectFilter,
448
- O as NumericFilter,
449
- j as SelectFilter,
450
- K as TextFilter,
451
- W as filterComponentMap
487
+ ue as ColumnFilter,
488
+ W as DateFilter,
489
+ Y as MultiSelectFilter,
490
+ N as NumericFilter,
491
+ _ as SelectFilter,
492
+ j as TextAreaFilter,
493
+ P as TextFilter,
494
+ $ as filterComponentMap
452
495
  };
@@ -1,36 +1,44 @@
1
- const l = (u, i, r) => {
2
- const e = u.getValue(i);
1
+ const l = (s, i, r) => {
2
+ const e = s.getValue(i);
3
3
  if (e == null) return !1;
4
- const t = String(e).toLowerCase(), n = String(r).toLowerCase();
5
- return t.includes(n);
6
- }, a = (u, i, r) => {
7
- const e = u.getValue(i);
4
+ const t = String(e).toLowerCase(), u = String(r).toLowerCase();
5
+ return t.includes(u);
6
+ }, a = (s, i, r) => {
7
+ const e = s.getValue(i);
8
+ if (e == null) return !1;
9
+ const t = String(r).split(/[\n,]/).map((n) => n.trim().toLowerCase()).filter((n) => n.length > 0);
10
+ if (t.length === 0) return !0;
11
+ const u = String(e).toLowerCase();
12
+ return t.some((n) => u.includes(n));
13
+ }, o = (s, i, r) => {
14
+ const e = s.getValue(i);
8
15
  if (e == null) return !1;
9
16
  const t = Number(e);
10
17
  if (Number.isNaN(t)) return !1;
11
- const { min: n, max: s } = r;
12
- return n !== void 0 && s !== void 0 ? t >= n && t <= s : n !== void 0 ? t >= n : s !== void 0 ? t <= s : !0;
13
- }, o = (u, i, r) => {
14
- const e = u.getValue(i);
18
+ const { min: u, max: n } = r;
19
+ return u !== void 0 && n !== void 0 ? t >= u && t <= n : u !== void 0 ? t >= u : n !== void 0 ? t <= n : !0;
20
+ }, c = (s, i, r) => {
21
+ const e = s.getValue(i);
15
22
  if (e == null) return !1;
16
23
  const t = e instanceof Date ? e : new Date(e);
17
24
  if (Number.isNaN(t.getTime())) return !1;
18
- const { start: n, end: s } = r;
19
- return n && s ? t >= n && t <= s : n ? t >= n : s ? t <= s : !0;
20
- }, c = (u, i, r) => {
21
- const e = u.getValue(i);
25
+ const { start: u, end: n } = r;
26
+ return u && n ? t >= u && t <= n : u ? t >= u : n ? t <= n : !0;
27
+ }, f = (s, i, r) => {
28
+ const e = s.getValue(i);
22
29
  if (e == null) return !1;
23
30
  const t = String(e);
24
31
  return Array.isArray(r) ? r.length === 0 || r.includes(t) : r ? t === r : !0;
25
- }, f = (u, i, r) => {
32
+ }, g = (s, i, r) => {
26
33
  if (!Array.isArray(r) || r.length === 0) return !0;
27
- const e = u.getValue(i);
34
+ const e = s.getValue(i);
28
35
  return e == null ? !1 : r.includes(String(e));
29
36
  };
30
37
  export {
31
- o as dateFilter,
32
- f as multiSelectFilter,
33
- a as numericFilter,
34
- c as selectFilter,
35
- l as textFilter
38
+ c as dateFilter,
39
+ g as multiSelectFilter,
40
+ o as numericFilter,
41
+ f as selectFilter,
42
+ l as textFilter,
43
+ a as textareaFilter
36
44
  };
@@ -3,11 +3,11 @@ import { useReactTable as ce } from "../../../../node_modules/.pnpm/@tanstack_re
3
3
  import n from "react";
4
4
  import { useLocalStorage as F } from "../../../../hooks/useLocalStorage.js";
5
5
  import P from "../../../inputs/Checkbox/Checkbox.js";
6
- import { multiSelectFilter as ue, selectFilter as ae, dateFilter as me, numericFilter as fe, textFilter as ge } from "../filters/filterFunctions.js";
7
- import { extractColumnFilterTypes as L, parseSortingFromUrl as de, parseFiltersFromUrl as he, syncStateToUrl as Ce } from "../tableUrlUtils.js";
8
- import { useInfiniteScroll as Re } from "./useInfiniteScroll.js";
9
- import { getFilteredRowModel as Se, getSortedRowModel as we, getCoreRowModel as Fe } from "../../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.js";
10
- function ye({ table: s }) {
6
+ import { multiSelectFilter as ue, selectFilter as ae, dateFilter as me, numericFilter as fe, textareaFilter as ge, textFilter as de } from "../filters/filterFunctions.js";
7
+ import { extractColumnFilterTypes as L, parseSortingFromUrl as he, parseFiltersFromUrl as Ce, syncStateToUrl as Re } from "../tableUrlUtils.js";
8
+ import { useInfiniteScroll as Se } from "./useInfiniteScroll.js";
9
+ import { getFilteredRowModel as we, getSortedRowModel as Fe, getCoreRowModel as ye } from "../../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.js";
10
+ function pe({ table: s }) {
11
11
  return /* @__PURE__ */ A(
12
12
  P,
13
13
  {
@@ -18,7 +18,7 @@ function ye({ table: s }) {
18
18
  }
19
19
  );
20
20
  }
21
- function pe({ row: s }) {
21
+ function xe({ row: s }) {
22
22
  return /* @__PURE__ */ A(
23
23
  P,
24
24
  {
@@ -29,7 +29,7 @@ function pe({ row: s }) {
29
29
  }
30
30
  );
31
31
  }
32
- function Ne({
32
+ function He({
33
33
  id: s,
34
34
  loading: l = !1,
35
35
  reactTableOptions: t,
@@ -43,17 +43,17 @@ function Ne({
43
43
  }) {
44
44
  const { columns: r } = t, $ = n.useRef(
45
45
  L(r)
46
- ), [z, U] = n.useState(() => {
46
+ ), [x, U] = n.useState(() => {
47
47
  if (u && typeof window < "u") {
48
48
  const e = new URLSearchParams(window.location.search);
49
- return de(e, a);
49
+ return he(e, a);
50
50
  }
51
51
  return [];
52
- }), [M, W] = n.useState(
52
+ }), [z, W] = n.useState(
53
53
  () => {
54
54
  if (u && typeof window < "u") {
55
55
  const e = new URLSearchParams(window.location.search);
56
- return he(
56
+ return Ce(
57
57
  e,
58
58
  a,
59
59
  $.current
@@ -61,12 +61,12 @@ function Ne({
61
61
  }
62
62
  return [];
63
63
  }
64
- ), [g, x] = F(
64
+ ), [g, M] = F(
65
65
  `table.${s}.wrapText`,
66
66
  _
67
67
  ), j = n.useCallback(() => {
68
- x(!g);
69
- }, [g, x]), [G, K] = F(
68
+ M(!g);
69
+ }, [g, M]), [G, K] = F(
70
70
  `table.${s}.columnSizing`,
71
71
  {}
72
72
  ), q = n.useRef(r), d = n.useMemo(() => {
@@ -111,7 +111,8 @@ function Ne({
111
111
  return o && !i.filterFn ? {
112
112
  ...i,
113
113
  filterFn: {
114
- text: ge,
114
+ text: de,
115
+ textarea: ge,
115
116
  number: fe,
116
117
  date: me,
117
118
  select: ae,
@@ -124,8 +125,8 @@ function Ne({
124
125
  enableSorting: !1,
125
126
  enableResizing: !1,
126
127
  meta: { noSortButton: !0 },
127
- header: ye,
128
- cell: pe
128
+ header: pe,
129
+ cell: xe
129
130
  }, ...e]), e;
130
131
  }, [f, r]), S = ce({
131
132
  // Overridable defaults
@@ -134,9 +135,9 @@ function Ne({
134
135
  // Consumer customisation
135
136
  ...t,
136
137
  // Values always controlled by this hook
137
- getCoreRowModel: Fe(),
138
- getSortedRowModel: we(),
139
- getFilteredRowModel: Se(),
138
+ getCoreRowModel: ye(),
139
+ getSortedRowModel: Fe(),
140
+ getFilteredRowModel: we(),
140
141
  columns: te,
141
142
  data: T,
142
143
  enableSorting: t.enableSorting ?? !0,
@@ -151,8 +152,8 @@ function Ne({
151
152
  state: {
152
153
  ...t.state,
153
154
  rowSelection: t.state?.rowSelection ?? X,
154
- sorting: t.state?.sorting ?? z,
155
- columnFilters: t.state?.columnFilters ?? M,
155
+ sorting: t.state?.sorting ?? x,
156
+ columnFilters: t.state?.columnFilters ?? z,
156
157
  columnSizing: G,
157
158
  columnPinning: ee,
158
159
  columnVisibility: t.state?.columnVisibility ?? h
@@ -163,7 +164,7 @@ function Ne({
163
164
  paddingTop: ie,
164
165
  paddingBottom: se,
165
166
  measureElement: le
166
- } = Re(V.length, c, R), k = c?.enabled, E = c?.hasNextPage, v = c?.isFetchingNextPage, I = c?.fetchNextPage, re = 200, w = n.useCallback(
167
+ } = Se(V.length, c, R), k = c?.enabled, E = c?.hasNextPage, v = c?.isFetchingNextPage, I = c?.fetchNextPage, re = 200, w = n.useCallback(
167
168
  (e) => {
168
169
  if (!e || !k) return;
169
170
  const { scrollHeight: i, scrollTop: o, clientHeight: D } = e;
@@ -176,14 +177,14 @@ function Ne({
176
177
  }, [w]), b.current = S, n.useEffect(() => {
177
178
  b.current?.toggleAllRowsSelected(y);
178
179
  }, [y]);
179
- const N = t.state?.sorting ?? z, H = t.state?.columnFilters ?? M, B = n.useMemo(
180
+ const N = t.state?.sorting ?? x, H = t.state?.columnFilters ?? z, B = n.useMemo(
180
181
  () => L(
181
182
  r
182
183
  ),
183
184
  [r]
184
185
  );
185
186
  return n.useEffect(() => {
186
- !u || typeof window > "u" || Ce(
187
+ !u || typeof window > "u" || Re(
187
188
  N,
188
189
  H,
189
190
  a,
@@ -214,5 +215,5 @@ function Ne({
214
215
  };
215
216
  }
216
217
  export {
217
- Ne as useDataGrid
218
+ He as useDataGrid
218
219
  };
@@ -63,7 +63,6 @@ const s = e.div`
63
63
  -webkit-line-clamp: 3;
64
64
  -webkit-box-orient: vertical;
65
65
  white-space: normal;
66
- font-size: 0.75rem;
67
66
  `, f = e.div`
68
67
  display: flex;
69
68
  align-items: center;
@@ -93,7 +92,7 @@ const s = e.div`
93
92
  "& thead th": {
94
93
  backgroundColor: "background.body",
95
94
  fontWeight: "bold",
96
- fontSize: "sm",
95
+ fontSize: "0.75rem",
97
96
  verticalAlign: "middle",
98
97
  position: "sticky",
99
98
  zIndex: 1,
package/dist/index.d.ts CHANGED
@@ -564,7 +564,7 @@ declare interface RelativeTimeProps {
564
564
  export declare function Select<TValue extends object>(props: SelectProps<TValue, false>): JSX_2.Element;
565
565
 
566
566
  /** Filter types that affect how URL params are serialized/deserialized. */
567
- export declare type ServerSideFilterType = "text" | "select" | "multiselect" | "date" | "number";
567
+ export declare type ServerSideFilterType = "text" | "textarea" | "select" | "multiselect" | "date" | "number";
568
568
 
569
569
  export declare function Sheet(props: SheetProps): JSX_2.Element;
570
570
 
@@ -907,7 +907,7 @@ export { }
907
907
 
908
908
  declare module "@tanstack/react-table" {
909
909
  interface ColumnMeta<TData, TValue> {
910
- filterType?: "text" | "number" | "date" | "select" | "multiselect";
910
+ filterType?: "text" | "textarea" | "number" | "date" | "select" | "multiselect";
911
911
  filterOptions?: {
912
912
  label: string;
913
913
  value: string;
@@ -923,5 +923,9 @@ declare module "@tanstack/react-table" {
923
923
  columnLabel?: string;
924
924
  /** Exclude this column from the Manage Columns dropdown entirely (e.g. action button columns). */
925
925
  excludeFromManageColumns?: boolean;
926
+ /** Label to display for the filter input. Falls back to the column label. */
927
+ filterLabel?: string;
928
+ /** Help text displayed below the filter input. */
929
+ filterHelpText?: string | React.ReactNode;
926
930
  }
927
931
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harpercollins/harpercollins-design-system",
3
- "version": "1.37.0",
3
+ "version": "1.38.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@ssh.dev.azure.com:v3/HarperCollinsUK/HCDesignSystem/HCDesignSystem"