@adam-milo/ui 1.0.130 → 1.0.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +11 -9
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +1 -1
- package/dist/src/components/data-display/datatable/DataTable.component.d.ts.map +1 -1
- package/dist/src/components/data-display/datatable/DataTable.styles.d.ts +2 -0
- package/dist/src/components/data-display/datatable/DataTable.styles.d.ts.map +1 -1
- package/dist/src/components/data-display/datatable/DataTable.types.d.ts +50 -1
- package/dist/src/components/data-display/datatable/DataTable.types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index41.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),a=require("@adam-milo/icons"),r=require("./index67.cjs"),s=require("./index12.cjs"),l=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),a=require("@adam-milo/icons"),r=require("./index67.cjs"),s=require("./index12.cjs"),l=require("./index45.cjs"),d=require("./index48.cjs"),n=require("./index96.cjs"),c=["60%","75%","45%","55%","70%","50%"],o=t.forwardRef(({columns:o,data:i,striped:y=!1,hoverable:h=!1,headerLeft:u,headerRight:m,borderBreak:x=!1,onLoadMore:S,isLoadingMore:b=!1,hasMore:p=!1,loadingIndicator:$,skeletonRows:k=3,maxHeight:f,emptyStateText:j,selectable:v=!1,rowKey:g="id",selectedRows:B,onSelectionChange:N,onRowClick:w,footerBar:C,sortKey:E,sortDirection:L,onSortChange:R,filters:T,onFilterChange:F,className:q,"data-cy":I,"data-testid":A,...D},M)=>{const O=I||"datatable",H=A||"datatable",K=u||m,_=t.useRef(null),P=t.useRef(null),[W,z]=t.useState(!1);t.useEffect(()=>{const e=P.current;if(!e||!f)return;const t=()=>z(e.scrollTop>0);return e.addEventListener("scroll",t,{passive:!0}),()=>e.removeEventListener("scroll",t)},[f]);const G=t.useMemo(()=>B??new Set,[B]),J=i.map(e=>String(e[g]??"")),Q=v&&i.length>0&&J.every(e=>G.has(e)),U=v&&i.length>0&&J.some(e=>G.has(e)),V=t.useCallback(()=>{if(N)if(Q){const e=new Set(G);J.forEach(t=>e.delete(t)),N(e)}else{const e=new Set(G);J.forEach(t=>e.add(t)),N(e)}},[Q,J,G,N]),X=t.useCallback(e=>{if(!N)return;const t=new Set(G);t.has(e)?t.delete(e):t.add(e),N(t)},[G,N]),Y=v?o.length+1:o.length,Z=e=>{if(e.sortable)return E!==e.key?"none":"asc"===L?"ascending":"desc"===L?"descending":"none"},ee=t=>{const a="string"==typeof t.header?t.header:void 0;return e.jsxs("span",{className:n.headerCellContentStyles,children:[e.jsx("span",{className:n.headerLabelStyles,children:t.header}),t.sortable&&e.jsx(l.SortButton,{direction:E===t.key?L??"none":"none",onDirectionChange:e=>R?.(t.key,e),"aria-label":a?`Sort by ${a}`:"Sort column","data-cy":`${O}-sort-${t.key}`,"data-testid":`${H}-sort-${t.key}`}),t.filterable&&t.filterOptions&&e.jsx(d.CheckFilter,{mode:"multi",options:t.filterOptions,value:T?.[t.key],onApply:e=>F?.(t.key,e),title:t.filterTitle,searchable:t.filterSearchable,"aria-label":a?`Filter ${a}`:"Filter column","data-cy":`${O}-filter-${t.key}`,"data-testid":`${H}-filter-${t.key}`})]})},te=t.useCallback(e=>{const[t]=e;t.isIntersecting&&p&&!b&&S&&S()},[p,b,S]);t.useEffect(()=>{const e=_.current;if(!e||!S)return;const t=new IntersectionObserver(te,{root:f?P.current:null,rootMargin:"0px",threshold:.1});return t.observe(e),()=>t.disconnect()},[te,S,f]);const ae=e.jsxs(e.Fragment,{children:[e.jsxs("table",{ref:M,className:r.cn(n.tableBaseStyles,q),"aria-busy":b||void 0,"data-cy":O,"data-testid":H,...D,children:[e.jsx("thead",{className:r.cn(n.theadStyles,x&&n.theadBorderBreakStyles,f&&n.stickyTheadStyles,f&&W&&n.stickyTheadScrolledStyles),"data-cy":`${O}-head`,"data-testid":`${H}-head`,children:e.jsxs("tr",{children:[v&&e.jsx("th",{scope:"col",className:r.cn(n.checkboxCellStyles,x&&n.thBorderBreakStyles),"data-cy":`${O}-header-checkbox`,"data-testid":`${H}-header-checkbox`,children:e.jsx("label",{className:n.checkboxLabelStyles,children:e.jsx(s.Checkbox,{checked:Q,indeterminate:U&&!Q,onChange:V,"aria-label":"Select all rows","data-cy":`${O}-select-all`,"data-testid":`${H}-select-all`})})}),o.map(t=>e.jsx("th",{scope:"col","aria-sort":Z(t),className:r.cn(n.thStyles,x&&n.thBorderBreakStyles),"data-cy":`${O}-header-${t.key}`,"data-testid":`${H}-header-${t.key}`,children:ee(t)},t.key))]})}),e.jsxs("tbody",{"data-cy":`${O}-body`,"data-testid":`${H}-body`,children:[0!==i.length||b?i.map((t,a)=>e.jsxs("tr",{className:r.cn(n.trStripedStyles,x&&n.trBorderBreakStyles,h&&n.trHoverableStyles,y&&!x&&n.trStripedEvenStyles,w&&n.trClickableStyles,w&&x&&n.trClickableBorderBreakFocusStyles),tabIndex:w?0:void 0,style:w?{outline:"none",boxShadow:"none"}:void 0,onFocus:e=>e.currentTarget.setAttribute("data-focused","true"),onBlur:e=>e.currentTarget.removeAttribute("data-focused"),onClick:w?e=>{e.target.closest('button, a, input, label, [role="checkbox"]')||w(t,a)}:void 0,onKeyDown:w?e=>{if("Enter"===e.key||" "===e.key){if(e.target.closest('button, a, input, label, [role="checkbox"]'))return;e.preventDefault(),w(t,a)}}:void 0,"data-cy":`${O}-row-${a}`,"data-testid":`${H}-row-${a}`,children:[v&&e.jsx("td",{className:r.cn(n.checkboxCellStyles,x&&n.tdBorderBreakStyles),"data-cy":`${O}-cell-${a}-checkbox`,"data-testid":`${H}-cell-${a}-checkbox`,children:e.jsx("label",{className:n.checkboxLabelStyles,children:e.jsx(s.Checkbox,{checked:G.has(String(t[g]??"")),onChange:()=>X(String(t[g]??"")),"aria-label":`Select row ${a+1}`,"data-cy":`${O}-select-${a}`,"data-testid":`${H}-select-${a}`})})}),o.map(s=>e.jsx("td",{className:r.cn(n.tdStyles,x&&n.tdBorderBreakStyles),"data-cy":`${O}-cell-${a}-${s.key}`,"data-testid":`${H}-cell-${a}-${s.key}`,children:s.render?s.render(t[s.key],t,a):String(t[s.key]??"")},s.key))]},a)):e.jsx("tr",{children:e.jsx("td",{colSpan:Y,className:"p-0","data-cy":`${O}-empty`,"data-testid":`${H}-empty`,children:e.jsxs("div",{className:n.emptyStateWrapperStyles,children:[e.jsx("div",{className:n.emptyStateIconStyles,"aria-hidden":"true","data-cy":`${O}-empty-icon`,"data-testid":`${H}-empty-icon`,children:e.jsx(a.CustomEmptyBoxIcon,{width:"100%",height:"100%"})}),j&&e.jsx("p",{className:n.emptyStateTextStyles,"data-cy":`${O}-empty-text`,"data-testid":`${H}-empty-text`,children:j})]})})}),b&&($?e.jsx("tr",{children:e.jsx("td",{colSpan:Y,className:n.loadingRowStyles,"data-cy":`${O}-loading`,"data-testid":`${H}-loading`,children:$})}):Array.from({length:k}).map((t,a)=>e.jsxs("tr",{className:r.cn(n.trStripedStyles,x&&n.trBorderBreakStyles),"data-cy":`${O}-skeleton-${a}`,"data-testid":`${H}-skeleton-${a}`,children:[v&&e.jsx("td",{className:r.cn(n.checkboxCellStyles,x&&n.tdBorderBreakStyles),children:e.jsx("div",{className:n.checkboxLabelStyles,children:e.jsx("div",{className:"w-4 h-4 rounded-4 bg-[color-mix(in_srgb,var(--color-border)_40%,transparent)]"})})}),o.map((t,s)=>e.jsx("td",{className:r.cn(n.tdStyles,x&&n.tdBorderBreakStyles),children:e.jsx("div",{className:n.skeletonCellStyles,style:{width:c[(a+s)%c.length]}})},t.key))]},`skeleton-${a}`)))]})]}),S&&e.jsx("div",{ref:_,className:"h-4","data-cy":`${O}-sentinel`,"data-testid":`${H}-sentinel`,"aria-hidden":"true"})]}),re=e.jsxs("div",{className:r.cn(n.wrapperStyles,x&&(p?"overflow-hidden rounded-t-2xl":"overflow-hidden rounded-2xl")),tabIndex:-1,style:{outline:"none"},"data-cy":`${O}-wrapper`,"data-testid":`${H}-wrapper`,children:[K&&e.jsxs("div",{className:n.headerBarStyles,"data-cy":`${O}-header-bar`,"data-testid":`${H}-header-bar`,children:[e.jsx("div",{"data-cy":`${O}-header-left`,"data-testid":`${H}-header-left`,children:u}),e.jsx("div",{"data-cy":`${O}-header-right`,"data-testid":`${H}-header-right`,children:m})]}),f?e.jsx("div",{ref:P,className:n.scrollContainerStyles,tabIndex:-1,style:{maxHeight:f,outline:"none"},children:ae}):ae]}),se=C?e.jsx("div",{className:n.footerBarStyles,"data-cy":`${O}-footer-bar`,"data-testid":`${H}-footer-bar`,children:C}):null;return x?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:r.cn(n.wrapperBorderBreakStyles,p?n.wrapperBorderBreakFlatBottomStyles:n.wrapperBorderBreakRoundedStyles),children:re}),se]}):e.jsxs(e.Fragment,{children:[re,se]})});o.displayName="DataTable";const i=t.forwardRef(({children:a,className:s,style:l,...d},n)=>{const c=t.useRef(null),[o,i]=t.useState(!1);return t.useEffect(()=>{const e=c.current;if(!e)return;const t=e.closest("tr");if(!t)return;const a=()=>i(!0),r=()=>i(!1);return t.addEventListener("mouseenter",a),t.addEventListener("mouseleave",r),t.addEventListener("focusin",a),t.addEventListener("focusout",r),()=>{t.removeEventListener("mouseenter",a),t.removeEventListener("mouseleave",r),t.removeEventListener("focusin",a),t.removeEventListener("focusout",r)}},[]),e.jsx("span",{ref:e=>{c.current=e,"function"==typeof n?n(e):n&&(n.current=e)},className:r.cn("transition-opacity duration-200",o?"opacity-100":"opacity-0",s),style:l,...d,children:a})});i.displayName="RowAction",exports.DataTable=o,exports.RowAction=i;
|
package/dist/index41.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as t,jsx as a}from"react/jsx-runtime";import{forwardRef as r,useRef as
|
|
2
|
-
|
|
3
|
-
/* @__PURE__ */a("
|
|
4
|
-
/* @__PURE__ */e("
|
|
5
|
-
/* @__PURE__ */a("
|
|
6
|
-
/* @__PURE__ */a("
|
|
7
|
-
/* @__PURE__ */a("div",{"data-cy":`${
|
|
8
|
-
|
|
9
|
-
/* @__PURE__ */a("div",{
|
|
1
|
+
import{jsxs as e,Fragment as t,jsx as a}from"react/jsx-runtime";import{forwardRef as r,useRef as n,useState as d,useEffect as s,useMemo as i,useCallback as l}from"react";import{CustomEmptyBoxIcon as o}from"@adam-milo/icons";import{cn as c}from"./index67.js";import{Checkbox as h}from"./index12.js";import{SortButton as m}from"./index45.js";import{CheckFilter as y}from"./index48.js";import{checkboxLabelStyles as $,emptyStateWrapperStyles as u,emptyStateIconStyles as p,emptyStateTextStyles as f,loadingRowStyles as b,skeletonCellStyles as v,headerBarStyles as g,scrollContainerStyles as k,headerCellContentStyles as N,headerLabelStyles as x,thBorderBreakStyles as w,checkboxCellStyles as S,thStyles as E,stickyTheadScrolledStyles as L,stickyTheadStyles as C,theadBorderBreakStyles as j,theadStyles as I,tdBorderBreakStyles as T,tdStyles as A,trClickableBorderBreakFocusStyles as D,trClickableStyles as R,trStripedEvenStyles as F,trHoverableStyles as M,trBorderBreakStyles as B,trStripedStyles as K,tableBaseStyles as O,footerBarStyles as H,wrapperStyles as _,wrapperBorderBreakFlatBottomStyles as q,wrapperBorderBreakRoundedStyles as z,wrapperBorderBreakStyles as G}from"./index96.js";const J=["60%","75%","45%","55%","70%","50%"],P=r(({columns:r,data:P,striped:Q=!1,hoverable:U=!1,headerLeft:V,headerRight:W,borderBreak:X=!1,onLoadMore:Y,isLoadingMore:Z=!1,hasMore:ee=!1,loadingIndicator:te,skeletonRows:ae=3,maxHeight:re,emptyStateText:ne,selectable:de=!1,rowKey:se="id",selectedRows:ie,onSelectionChange:le,onRowClick:oe,footerBar:ce,sortKey:he,sortDirection:me,onSortChange:ye,filters:$e,onFilterChange:ue,className:pe,"data-cy":fe,"data-testid":be,...ve},ge)=>{const ke=fe||"datatable",Ne=be||"datatable",xe=V||W,we=n(null),Se=n(null),[Ee,Le]=d(!1);s(()=>{const e=Se.current;if(!e||!re)return;const t=()=>Le(e.scrollTop>0);return e.addEventListener("scroll",t,{passive:!0}),()=>e.removeEventListener("scroll",t)},[re]);const Ce=i(()=>ie??/* @__PURE__ */new Set,[ie]),je=P.map(e=>String(e[se]??"")),Ie=de&&P.length>0&&je.every(e=>Ce.has(e)),Te=de&&P.length>0&&je.some(e=>Ce.has(e)),Ae=l(()=>{if(le)if(Ie){const e=new Set(Ce);je.forEach(t=>e.delete(t)),le(e)}else{const e=new Set(Ce);je.forEach(t=>e.add(t)),le(e)}},[Ie,je,Ce,le]),De=l(e=>{if(!le)return;const t=new Set(Ce);t.has(e)?t.delete(e):t.add(e),le(t)},[Ce,le]),Re=de?r.length+1:r.length,Fe=e=>{if(e.sortable)return he!==e.key?"none":"asc"===me?"ascending":"desc"===me?"descending":"none"},Me=t=>{const r="string"==typeof t.header?t.header:void 0;/* @__PURE__ */
|
|
2
|
+
return e("span",{className:N,children:[
|
|
3
|
+
/* @__PURE__ */a("span",{className:x,children:t.header}),t.sortable&&/* @__PURE__ */a(m,{direction:he===t.key?me??"none":"none",onDirectionChange:e=>ye?.(t.key,e),"aria-label":r?`Sort by ${r}`:"Sort column","data-cy":`${ke}-sort-${t.key}`,"data-testid":`${Ne}-sort-${t.key}`}),t.filterable&&t.filterOptions&&/* @__PURE__ */a(y,{mode:"multi",options:t.filterOptions,value:$e?.[t.key],onApply:e=>ue?.(t.key,e),title:t.filterTitle,searchable:t.filterSearchable,"aria-label":r?`Filter ${r}`:"Filter column","data-cy":`${ke}-filter-${t.key}`,"data-testid":`${Ne}-filter-${t.key}`})]})},Be=l(e=>{const[t]=e;t.isIntersecting&&ee&&!Z&&Y&&Y()},[ee,Z,Y]);s(()=>{const e=we.current;if(!e||!Y)return;const t=new IntersectionObserver(Be,{root:re?Se.current:null,rootMargin:"0px",threshold:.1});return t.observe(e),()=>t.disconnect()},[Be,Y,re]);const Ke=/* @__PURE__ */e(t,{children:[
|
|
4
|
+
/* @__PURE__ */e("table",{ref:ge,className:c(O,pe),"aria-busy":Z||void 0,"data-cy":ke,"data-testid":Ne,...ve,children:[
|
|
5
|
+
/* @__PURE__ */a("thead",{className:c(I,X&&j,re&&C,re&&Ee&&L),"data-cy":`${ke}-head`,"data-testid":`${Ne}-head`,children:/* @__PURE__ */e("tr",{children:[de&&/* @__PURE__ */a("th",{scope:"col",className:c(S,X&&w),"data-cy":`${ke}-header-checkbox`,"data-testid":`${Ne}-header-checkbox`,children:/* @__PURE__ */a("label",{className:$,children:/* @__PURE__ */a(h,{checked:Ie,indeterminate:Te&&!Ie,onChange:Ae,"aria-label":"Select all rows","data-cy":`${ke}-select-all`,"data-testid":`${Ne}-select-all`})})}),r.map(e=>/* @__PURE__ */a("th",{scope:"col","aria-sort":Fe(e),className:c(E,X&&w),"data-cy":`${ke}-header-${e.key}`,"data-testid":`${Ne}-header-${e.key}`,children:Me(e)},e.key))]})}),
|
|
6
|
+
/* @__PURE__ */e("tbody",{"data-cy":`${ke}-body`,"data-testid":`${Ne}-body`,children:[0!==P.length||Z?P.map((t,n)=>/* @__PURE__ */e("tr",{className:c(K,X&&B,U&&M,Q&&!X&&F,oe&&R,oe&&X&&D),tabIndex:oe?0:void 0,style:oe?{outline:"none",boxShadow:"none"}:void 0,onFocus:e=>e.currentTarget.setAttribute("data-focused","true"),onBlur:e=>e.currentTarget.removeAttribute("data-focused"),onClick:oe?e=>{e.target.closest('button, a, input, label, [role="checkbox"]')||oe(t,n)}:void 0,onKeyDown:oe?e=>{if("Enter"===e.key||" "===e.key){if(e.target.closest('button, a, input, label, [role="checkbox"]'))return;e.preventDefault(),oe(t,n)}}:void 0,"data-cy":`${ke}-row-${n}`,"data-testid":`${Ne}-row-${n}`,children:[de&&/* @__PURE__ */a("td",{className:c(S,X&&T),"data-cy":`${ke}-cell-${n}-checkbox`,"data-testid":`${Ne}-cell-${n}-checkbox`,children:/* @__PURE__ */a("label",{className:$,children:/* @__PURE__ */a(h,{checked:Ce.has(String(t[se]??"")),onChange:()=>De(String(t[se]??"")),"aria-label":`Select row ${n+1}`,"data-cy":`${ke}-select-${n}`,"data-testid":`${Ne}-select-${n}`})})}),r.map(e=>/* @__PURE__ */a("td",{className:c(A,X&&T),"data-cy":`${ke}-cell-${n}-${e.key}`,"data-testid":`${Ne}-cell-${n}-${e.key}`,children:e.render?e.render(t[e.key],t,n):String(t[e.key]??"")},e.key))]},n)):/* @__PURE__ */a("tr",{children:/* @__PURE__ */a("td",{colSpan:Re,className:"p-0","data-cy":`${ke}-empty`,"data-testid":`${Ne}-empty`,children:/* @__PURE__ */e("div",{className:u,children:[
|
|
7
|
+
/* @__PURE__ */a("div",{className:p,"aria-hidden":"true","data-cy":`${ke}-empty-icon`,"data-testid":`${Ne}-empty-icon`,children:/* @__PURE__ */a(o,{width:"100%",height:"100%"})}),ne&&/* @__PURE__ */a("p",{className:f,"data-cy":`${ke}-empty-text`,"data-testid":`${Ne}-empty-text`,children:ne})]})})}),Z&&(te?/* @__PURE__ */a("tr",{children:/* @__PURE__ */a("td",{colSpan:Re,className:b,"data-cy":`${ke}-loading`,"data-testid":`${Ne}-loading`,children:te})}):Array.from({length:ae}).map((t,n)=>/* @__PURE__ */e("tr",{className:c(K,X&&B),"data-cy":`${ke}-skeleton-${n}`,"data-testid":`${Ne}-skeleton-${n}`,children:[de&&/* @__PURE__ */a("td",{className:c(S,X&&T),children:/* @__PURE__ */a("div",{className:$,children:/* @__PURE__ */a("div",{className:"w-4 h-4 rounded-4 bg-[color-mix(in_srgb,var(--color-border)_40%,transparent)]"})})}),r.map((e,t)=>/* @__PURE__ */a("td",{className:c(A,X&&T),children:/* @__PURE__ */a("div",{className:v,style:{width:J[(n+t)%J.length]}})},e.key))]},`skeleton-${n}`)))]})]}),Y&&/* @__PURE__ */a("div",{ref:we,className:"h-4","data-cy":`${ke}-sentinel`,"data-testid":`${Ne}-sentinel`,"aria-hidden":"true"})]}),Oe=/* @__PURE__ */e("div",{className:c(_,X&&(ee?"overflow-hidden rounded-t-2xl":"overflow-hidden rounded-2xl")),tabIndex:-1,style:{outline:"none"},"data-cy":`${ke}-wrapper`,"data-testid":`${Ne}-wrapper`,children:[xe&&/* @__PURE__ */e("div",{className:g,"data-cy":`${ke}-header-bar`,"data-testid":`${Ne}-header-bar`,children:[
|
|
8
|
+
/* @__PURE__ */a("div",{"data-cy":`${ke}-header-left`,"data-testid":`${Ne}-header-left`,children:V}),
|
|
9
|
+
/* @__PURE__ */a("div",{"data-cy":`${ke}-header-right`,"data-testid":`${Ne}-header-right`,children:W})]}),re?/* @__PURE__ */a("div",{ref:Se,className:k,tabIndex:-1,style:{maxHeight:re,outline:"none"},children:Ke}):Ke]}),He=ce?/* @__PURE__ */a("div",{className:H,"data-cy":`${ke}-footer-bar`,"data-testid":`${Ne}-footer-bar`,children:ce}):null;/* @__PURE__ */
|
|
10
|
+
return e(t,X?{children:[
|
|
11
|
+
/* @__PURE__ */a("div",{className:c(G,ee?q:z),children:Oe}),He]}:{children:[Oe,He]})});P.displayName="DataTable";const Q=r(({children:e,className:t,style:r,...i},l)=>{const o=n(null),[h,m]=d(!1);return s(()=>{const e=o.current;if(!e)return;const t=e.closest("tr");if(!t)return;const a=()=>m(!0),r=()=>m(!1);return t.addEventListener("mouseenter",a),t.addEventListener("mouseleave",r),t.addEventListener("focusin",a),t.addEventListener("focusout",r),()=>{t.removeEventListener("mouseenter",a),t.removeEventListener("mouseleave",r),t.removeEventListener("focusin",a),t.removeEventListener("focusout",r)}},[]),/* @__PURE__ */a("span",{ref:e=>{o.current=e,"function"==typeof l?l(e):l&&(l.current=e)},className:c("transition-opacity duration-200",h?"opacity-100":"opacity-0",t),style:r,...i,children:e})});Q.displayName="RowAction";export{P as DataTable,Q as RowAction};
|
package/dist/index96.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=["h-3 rounded-4","bg-[linear-gradient(90deg,color-mix(in_srgb,var(--color-border)_40%,transparent)_0%,color-mix(in_srgb,var(--color-grey-skeleton)_40%,transparent)_100%)]","relative overflow-hidden","after:absolute after:inset-0","after:bg-[linear-gradient(90deg,transparent_0%,color-mix(in_srgb,var(--color-white)_40%,transparent)_50%,transparent_100%)]","after:animate-[shimmer_1.5s_ease-in-out_infinite]","after:[background-size:200%_100%]"].join(" "),r=["sticky top-0 z-[5] !border-b-0","[&>tr>th]:transition-[background-color] [&>tr>th]:duration-500 [&>tr>th]:ease-in-out","after:absolute after:left-0 after:right-0 after:bottom-0 after:h-px after:bg-[color-mix(in_srgb,var(--color-teal)_25%,transparent)]"].join(" "),t=["[&>tr>th]:!bg-white","[&>tr>th:first-child]:rounded-tl-16","[&>tr>th:last-child]:rounded-tr-16"].join(" "),o=["fixed bottom-8 left-1/2 -translate-x-1/2 z-50","flex items-center justify-between","w-[46.875rem] max-w-[calc(100%-2rem)]","py-4 ps-8 pe-4","bg-white rounded-2xl","border border-solid border-[color-mix(in_srgb,var(--color-teal)_15%,transparent)]","shadow-[0_4px_24px_0_color-mix(in_srgb,var(--color-black)_8%,transparent)]"].join(" ");exports.checkboxCellStyles="w-[4.75rem] min-w-[4.75rem] max-w-[4.75rem] ps-6 pe-[0.75rem] py-0 max-sm:pe-2 max-sm:ps-2",exports.checkboxLabelStyles="flex items-center justify-center w-[2.5rem] h-[2.5rem] cursor-pointer",exports.emptyStateIconStyles="w-[11.875rem] h-[11.875rem] text-[var(--color-system-text)]",exports.emptyStateTextStyles="text-16 leading-24 font-normal text-[var(--color-system-text)] text-center max-w-[20rem]",exports.emptyStateWrapperStyles="flex flex-col items-center justify-center gap-4 py-16 px-6 max-sm:py-10",exports.footerBarStyles=o,exports.headerBarStyles="flex items-center justify-between p-6 max-sm:p-4",exports.loadingRowStyles="py-4 text-center",exports.scrollContainerStyles="overflow-y-auto datatable-scrollbar",exports.skeletonCellStyles=e,exports.stickyTheadScrolledStyles=t,exports.stickyTheadStyles=r,exports.tableBaseStyles="w-full border-collapse text-14 leading-normal text-[var(--color-text)]",exports.tdBorderBreakStyles="px-0 py-2.5 text-18 font-normal text-[var(--color-text)] first:ps-6 last:pe-6 h-[4.5rem]",exports.tdStyles="px-4 py-3 text-[var(--color-text)] max-sm:px-2 max-sm:py-2 max-sm:text-12",exports.thBorderBreakStyles="px-0 py-2.5 whitespace-nowrap text-[1.1875rem] font-bold text-[var(--color-slate)] first:ps-6 last:pe-6 h-[4.25rem]",exports.thStyles="px-4 py-3 text-start font-semibold text-[var(--color-system-text)] max-sm:px-2 max-sm:py-2 max-sm:text-12",exports.theadBorderBreakStyles="!bg-transparent border-b border-[color-mix(in_srgb,var(--color-teal)_25%,transparent)]",exports.theadStyles="border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",exports.trBorderBreakStyles="border-0 even:bg-transparent hover:bg-white h-[4.5rem]",exports.trClickableBorderBreakFocusStyles="focus:bg-white",exports.trClickableStyles="cursor-pointer focus:bg-[var(--color-bg)]",exports.trHoverableStyles="hover:bg-[var(--color-bg)]",exports.trStripedEvenStyles="even:bg-[var(--color-bg)]",exports.trStripedStyles="border-b border-[var(--color-border)]",exports.wrapperBorderBreakFlatBottomStyles="rounded-t-2xl card-border-break--flat-bottom",exports.wrapperBorderBreakRoundedStyles="rounded-2xl",exports.wrapperBorderBreakStyles="card-border-break bg-[var(--color-overlay-white-43)]",exports.wrapperStyles="w-full overflow-x-auto [-webkit-overflow-scrolling:touch] [scrollbar-width:thin] [scrollbar-color:var(--color-border)_var(--color-bg-secondary)]";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=["h-3 rounded-4","bg-[linear-gradient(90deg,color-mix(in_srgb,var(--color-border)_40%,transparent)_0%,color-mix(in_srgb,var(--color-grey-skeleton)_40%,transparent)_100%)]","relative overflow-hidden","after:absolute after:inset-0","after:bg-[linear-gradient(90deg,transparent_0%,color-mix(in_srgb,var(--color-white)_40%,transparent)_50%,transparent_100%)]","after:animate-[shimmer_1.5s_ease-in-out_infinite]","after:[background-size:200%_100%]"].join(" "),r=["sticky top-0 z-[5] !border-b-0","[&>tr>th]:transition-[background-color] [&>tr>th]:duration-500 [&>tr>th]:ease-in-out","after:absolute after:left-0 after:right-0 after:bottom-0 after:h-px after:bg-[color-mix(in_srgb,var(--color-teal)_25%,transparent)]"].join(" "),t=["[&>tr>th]:!bg-white","[&>tr>th:first-child]:rounded-tl-16","[&>tr>th:last-child]:rounded-tr-16"].join(" "),o=["fixed bottom-8 left-1/2 -translate-x-1/2 z-50","flex items-center justify-between","w-[46.875rem] max-w-[calc(100%-2rem)]","py-4 ps-8 pe-4","bg-white rounded-2xl","border border-solid border-[color-mix(in_srgb,var(--color-teal)_15%,transparent)]","shadow-[0_4px_24px_0_color-mix(in_srgb,var(--color-black)_8%,transparent)]"].join(" ");exports.checkboxCellStyles="w-[4.75rem] min-w-[4.75rem] max-w-[4.75rem] ps-6 pe-[0.75rem] py-0 max-sm:pe-2 max-sm:ps-2",exports.checkboxLabelStyles="flex items-center justify-center w-[2.5rem] h-[2.5rem] cursor-pointer",exports.emptyStateIconStyles="w-[11.875rem] h-[11.875rem] text-[var(--color-system-text)]",exports.emptyStateTextStyles="text-16 leading-24 font-normal text-[var(--color-system-text)] text-center max-w-[20rem]",exports.emptyStateWrapperStyles="flex flex-col items-center justify-center gap-4 py-16 px-6 max-sm:py-10",exports.footerBarStyles=o,exports.headerBarStyles="flex items-center justify-between p-6 max-sm:p-4",exports.headerCellContentStyles="flex items-center gap-1",exports.headerLabelStyles="whitespace-nowrap",exports.loadingRowStyles="py-4 text-center",exports.scrollContainerStyles="overflow-y-auto datatable-scrollbar",exports.skeletonCellStyles=e,exports.stickyTheadScrolledStyles=t,exports.stickyTheadStyles=r,exports.tableBaseStyles="w-full border-collapse text-14 leading-normal text-[var(--color-text)]",exports.tdBorderBreakStyles="px-0 py-2.5 text-18 font-normal text-[var(--color-text)] first:ps-6 last:pe-6 h-[4.5rem]",exports.tdStyles="px-4 py-3 text-[var(--color-text)] max-sm:px-2 max-sm:py-2 max-sm:text-12",exports.thBorderBreakStyles="px-0 py-2.5 whitespace-nowrap text-[1.1875rem] font-bold text-[var(--color-slate)] first:ps-6 last:pe-6 h-[4.25rem]",exports.thStyles="px-4 py-3 text-start font-semibold text-[var(--color-system-text)] max-sm:px-2 max-sm:py-2 max-sm:text-12",exports.theadBorderBreakStyles="!bg-transparent border-b border-[color-mix(in_srgb,var(--color-teal)_25%,transparent)]",exports.theadStyles="border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",exports.trBorderBreakStyles="border-0 even:bg-transparent hover:bg-white h-[4.5rem]",exports.trClickableBorderBreakFocusStyles="focus:bg-white",exports.trClickableStyles="cursor-pointer focus:bg-[var(--color-bg)]",exports.trHoverableStyles="hover:bg-[var(--color-bg)]",exports.trStripedEvenStyles="even:bg-[var(--color-bg)]",exports.trStripedStyles="border-b border-[var(--color-border)]",exports.wrapperBorderBreakFlatBottomStyles="rounded-t-2xl card-border-break--flat-bottom",exports.wrapperBorderBreakRoundedStyles="rounded-2xl",exports.wrapperBorderBreakStyles="card-border-break bg-[var(--color-overlay-white-43)]",exports.wrapperStyles="w-full overflow-x-auto [-webkit-overflow-scrolling:touch] [scrollbar-width:thin] [scrollbar-color:var(--color-border)_var(--color-bg-secondary)]";
|
package/dist/index96.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const r="w-full overflow-x-auto [-webkit-overflow-scrolling:touch] [scrollbar-width:thin] [scrollbar-color:var(--color-border)_var(--color-bg-secondary)]",e="card-border-break bg-[var(--color-overlay-white-43)]",t="rounded-2xl",o="rounded-t-2xl card-border-break--flat-bottom",a="w-full border-collapse text-14 leading-normal text-[var(--color-text)]",l="border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",n="!bg-transparent border-b border-[color-mix(in_srgb,var(--color-teal)_25%,transparent)]",s="px-4 py-3 text-start font-semibold text-[var(--color-system-text)] max-sm:px-2 max-sm:py-2 max-sm:text-12",i="px-0 py-2.5 whitespace-nowrap text-[1.1875rem] font-bold text-[var(--color-slate)] first:ps-6 last:pe-6 h-[4.25rem]",b="border-b border-[var(--color-border)]",
|
|
1
|
+
const r="w-full overflow-x-auto [-webkit-overflow-scrolling:touch] [scrollbar-width:thin] [scrollbar-color:var(--color-border)_var(--color-bg-secondary)]",e="card-border-break bg-[var(--color-overlay-white-43)]",t="rounded-2xl",o="rounded-t-2xl card-border-break--flat-bottom",a="w-full border-collapse text-14 leading-normal text-[var(--color-text)]",l="border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",n="!bg-transparent border-b border-[color-mix(in_srgb,var(--color-teal)_25%,transparent)]",s="px-4 py-3 text-start font-semibold text-[var(--color-system-text)] max-sm:px-2 max-sm:py-2 max-sm:text-12",i="px-0 py-2.5 whitespace-nowrap text-[1.1875rem] font-bold text-[var(--color-slate)] first:ps-6 last:pe-6 h-[4.25rem]",b="flex items-center gap-1",c="whitespace-nowrap",x="border-b border-[var(--color-border)]",m="border-0 even:bg-transparent hover:bg-white h-[4.5rem]",p="hover:bg-[var(--color-bg)]",d="even:bg-[var(--color-bg)]",f="px-4 py-3 text-[var(--color-text)] max-sm:px-2 max-sm:py-2 max-sm:text-12",g="px-0 py-2.5 text-18 font-normal text-[var(--color-text)] first:ps-6 last:pe-6 h-[4.5rem]",v="flex flex-col items-center justify-center gap-4 py-16 px-6 max-sm:py-10",h="w-[11.875rem] h-[11.875rem] text-[var(--color-system-text)]",w="text-16 leading-24 font-normal text-[var(--color-system-text)] text-center max-w-[20rem]",_="flex items-center justify-between p-6 max-sm:p-4",u="py-4 text-center",y=["h-3 rounded-4","bg-[linear-gradient(90deg,color-mix(in_srgb,var(--color-border)_40%,transparent)_0%,color-mix(in_srgb,var(--color-grey-skeleton)_40%,transparent)_100%)]","relative overflow-hidden","after:absolute after:inset-0","after:bg-[linear-gradient(90deg,transparent_0%,color-mix(in_srgb,var(--color-white)_40%,transparent)_50%,transparent_100%)]","after:animate-[shimmer_1.5s_ease-in-out_infinite]","after:[background-size:200%_100%]"].join(" "),j="overflow-y-auto datatable-scrollbar",k=["sticky top-0 z-[5] !border-b-0","[&>tr>th]:transition-[background-color] [&>tr>th]:duration-500 [&>tr>th]:ease-in-out","after:absolute after:left-0 after:right-0 after:bottom-0 after:h-px after:bg-[color-mix(in_srgb,var(--color-teal)_25%,transparent)]"].join(" "),z=["[&>tr>th]:!bg-white","[&>tr>th:first-child]:rounded-tl-16","[&>tr>th:last-child]:rounded-tr-16"].join(" "),q="w-[4.75rem] min-w-[4.75rem] max-w-[4.75rem] ps-6 pe-[0.75rem] py-0 max-sm:pe-2 max-sm:ps-2",A="flex items-center justify-center w-[2.5rem] h-[2.5rem] cursor-pointer",B="cursor-pointer focus:bg-[var(--color-bg)]",C="focus:bg-white",D=["fixed bottom-8 left-1/2 -translate-x-1/2 z-50","flex items-center justify-between","w-[46.875rem] max-w-[calc(100%-2rem)]","py-4 ps-8 pe-4","bg-white rounded-2xl","border border-solid border-[color-mix(in_srgb,var(--color-teal)_15%,transparent)]","shadow-[0_4px_24px_0_color-mix(in_srgb,var(--color-black)_8%,transparent)]"].join(" ");export{q as checkboxCellStyles,A as checkboxLabelStyles,h as emptyStateIconStyles,w as emptyStateTextStyles,v as emptyStateWrapperStyles,D as footerBarStyles,_ as headerBarStyles,b as headerCellContentStyles,c as headerLabelStyles,u as loadingRowStyles,j as scrollContainerStyles,y as skeletonCellStyles,z as stickyTheadScrolledStyles,k as stickyTheadStyles,a as tableBaseStyles,g as tdBorderBreakStyles,f as tdStyles,i as thBorderBreakStyles,s as thStyles,n as theadBorderBreakStyles,l as theadStyles,m as trBorderBreakStyles,C as trClickableBorderBreakFocusStyles,B as trClickableStyles,p as trHoverableStyles,d as trStripedEvenStyles,x as trStripedStyles,o as wrapperBorderBreakFlatBottomStyles,t as wrapperBorderBreakRoundedStyles,e as wrapperBorderBreakStyles,r as wrapperStyles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.component.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/datatable/DataTable.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DataTable.component.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/datatable/DataTable.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAMf,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAqCzE,eAAO,MAAM,SAAS,6GA6brB,CAAC;AAIF;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,eAAe,CAAC;IACrE,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,SAAS,4GAgDrB,CAAC;AAIF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -7,6 +7,8 @@ export declare const theadStyles = "border-b border-[var(--color-border)] bg-[va
|
|
|
7
7
|
export declare const theadBorderBreakStyles = "!bg-transparent border-b border-[color-mix(in_srgb,var(--color-teal)_25%,transparent)]";
|
|
8
8
|
export declare const thStyles = "px-4 py-3 text-start font-semibold text-[var(--color-system-text)] max-sm:px-2 max-sm:py-2 max-sm:text-12";
|
|
9
9
|
export declare const thBorderBreakStyles = "px-0 py-2.5 whitespace-nowrap text-[1.1875rem] font-bold text-[var(--color-slate)] first:ps-6 last:pe-6 h-[4.25rem]";
|
|
10
|
+
export declare const headerCellContentStyles = "flex items-center gap-1";
|
|
11
|
+
export declare const headerLabelStyles = "whitespace-nowrap";
|
|
10
12
|
export declare const trStripedStyles = "border-b border-[var(--color-border)]";
|
|
11
13
|
export declare const trBorderBreakStyles = "border-0 even:bg-transparent hover:bg-white h-[4.5rem]";
|
|
12
14
|
export declare const trHoverableStyles = "hover:bg-[var(--color-bg)]";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/datatable/DataTable.styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,qJAC0H,CAAC;AAErJ,eAAO,MAAM,wBAAwB,yDAAyD,CAAC;AAC/F,eAAO,MAAM,+BAA+B,gBAAgB,CAAC;AAC7D,eAAO,MAAM,kCAAkC,iDAAiD,CAAC;AAEjG,eAAO,MAAM,eAAe,2EAC8C,CAAC;AAE3E,eAAO,MAAM,WAAW,yEAAyE,CAAC;AAClG,eAAO,MAAM,sBAAsB,2FACuD,CAAC;AAE3F,eAAO,MAAM,QAAQ,8GACwF,CAAC;AAE9G,eAAO,MAAM,mBAAmB,wHACuF,CAAC;AAExH,eAAO,MAAM,eAAe,0CAA0C,CAAC;AACvE,eAAO,MAAM,mBAAmB,2DAA2D,CAAC;AAC5F,eAAO,MAAM,iBAAiB,+BAA+B,CAAC;AAC9D,eAAO,MAAM,mBAAmB,8BAA8B,CAAC;AAE/D,eAAO,MAAM,QAAQ,8EAA8E,CAAC;AAEpG,eAAO,MAAM,mBAAmB,6FAC4D,CAAC;AAE7F,eAAO,MAAM,eAAe,0EAC6C,CAAC;AAE1E,eAAO,MAAM,uBAAuB,4EACuC,CAAC;AAE5E,eAAO,MAAM,oBAAoB,gEAAgE,CAAC;AAElG,eAAO,MAAM,oBAAoB,6FAC2D,CAAC;AAE7F,eAAO,MAAM,eAAe,qDAAqD,CAAC;AAElF,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,eAAO,MAAM,kBAAkB,QAQpB,CAAC;AAEZ,eAAO,MAAM,qBAAqB,wCAAwC,CAAC;AAE3E,eAAO,MAAM,iBAAiB,QAInB,CAAC;AAEZ,eAAO,MAAM,yBAAyB,QAI3B,CAAC;AAEZ,eAAO,MAAM,kBAAkB,+FAC+D,CAAC;AAE/F,eAAO,MAAM,mBAAmB,0EACyC,CAAC;AAE1E,eAAO,MAAM,iBAAiB,8CAA8C,CAAC;AAC7E,eAAO,MAAM,iCAAiC,mBAAmB,CAAC;AAElE,eAAO,MAAM,eAAe,QAQjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"DataTable.styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/datatable/DataTable.styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,qJAC0H,CAAC;AAErJ,eAAO,MAAM,wBAAwB,yDAAyD,CAAC;AAC/F,eAAO,MAAM,+BAA+B,gBAAgB,CAAC;AAC7D,eAAO,MAAM,kCAAkC,iDAAiD,CAAC;AAEjG,eAAO,MAAM,eAAe,2EAC8C,CAAC;AAE3E,eAAO,MAAM,WAAW,yEAAyE,CAAC;AAClG,eAAO,MAAM,sBAAsB,2FACuD,CAAC;AAE3F,eAAO,MAAM,QAAQ,8GACwF,CAAC;AAE9G,eAAO,MAAM,mBAAmB,wHACuF,CAAC;AAExH,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AACjE,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,eAAO,MAAM,eAAe,0CAA0C,CAAC;AACvE,eAAO,MAAM,mBAAmB,2DAA2D,CAAC;AAC5F,eAAO,MAAM,iBAAiB,+BAA+B,CAAC;AAC9D,eAAO,MAAM,mBAAmB,8BAA8B,CAAC;AAE/D,eAAO,MAAM,QAAQ,8EAA8E,CAAC;AAEpG,eAAO,MAAM,mBAAmB,6FAC4D,CAAC;AAE7F,eAAO,MAAM,eAAe,0EAC6C,CAAC;AAE1E,eAAO,MAAM,uBAAuB,4EACuC,CAAC;AAE5E,eAAO,MAAM,oBAAoB,gEAAgE,CAAC;AAElG,eAAO,MAAM,oBAAoB,6FAC2D,CAAC;AAE7F,eAAO,MAAM,eAAe,qDAAqD,CAAC;AAElF,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,eAAO,MAAM,kBAAkB,QAQpB,CAAC;AAEZ,eAAO,MAAM,qBAAqB,wCAAwC,CAAC;AAE3E,eAAO,MAAM,iBAAiB,QAInB,CAAC;AAEZ,eAAO,MAAM,yBAAyB,QAI3B,CAAC;AAEZ,eAAO,MAAM,kBAAkB,+FAC+D,CAAC;AAE/F,eAAO,MAAM,mBAAmB,0EACyC,CAAC;AAE1E,eAAO,MAAM,iBAAiB,8CAA8C,CAAC;AAC7E,eAAO,MAAM,iCAAiC,mBAAmB,CAAC;AAElE,eAAO,MAAM,eAAe,QAQjB,CAAC"}
|
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
import { ReactNode, TableHTMLAttributes } from 'react';
|
|
2
|
+
import { SortDirection } from '../sort-button/SortButton.types';
|
|
3
|
+
import { CheckFilterOption } from '../check-filter/CheckFilter.types';
|
|
2
4
|
|
|
5
|
+
export type { SortDirection };
|
|
3
6
|
export interface DataTableColumn {
|
|
4
7
|
key: string;
|
|
5
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Header content. Accepts a plain string or any `ReactNode` (e.g. a label
|
|
10
|
+
* wrapped with an icon). Built-in sort/filter controls are appended after it
|
|
11
|
+
* automatically when `sortable`/`filterable` are set.
|
|
12
|
+
*/
|
|
13
|
+
header: ReactNode;
|
|
6
14
|
width?: string;
|
|
7
15
|
/** Custom render function for cell content. Receives the cell value and the full row data. */
|
|
8
16
|
render?: (value: unknown, row: Record<string, unknown>, rowIndex: number) => ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Show a sort control in this column's header. The table is presentational:
|
|
19
|
+
* it emits `onSortChange` and reflects `sortKey`/`sortDirection` — sort the
|
|
20
|
+
* `data` yourself in response.
|
|
21
|
+
*/
|
|
22
|
+
sortable?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Show a multi-select checkbox filter in this column's header. Requires
|
|
25
|
+
* `filterOptions`. Filtering is controlled via `filters`/`onFilterChange`.
|
|
26
|
+
*/
|
|
27
|
+
filterable?: boolean;
|
|
28
|
+
/** Options shown in the column's filter dropdown (required when `filterable`). */
|
|
29
|
+
filterOptions?: ReadonlyArray<CheckFilterOption>;
|
|
30
|
+
/** Render a search box above the filter options list. */
|
|
31
|
+
filterSearchable?: boolean;
|
|
32
|
+
/** Optional title rendered above the filter options list. */
|
|
33
|
+
filterTitle?: ReactNode;
|
|
9
34
|
}
|
|
10
35
|
export interface DataTableProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
11
36
|
columns: DataTableColumn[];
|
|
@@ -44,6 +69,30 @@ export interface DataTableProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
|
44
69
|
onRowClick?: (row: Record<string, unknown>, rowIndex: number) => void;
|
|
45
70
|
/** Content rendered as a sticky footer bar (e.g. selection actions) */
|
|
46
71
|
footerBar?: ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* Key of the currently sorted column (controlled). Only one column is sorted
|
|
74
|
+
* at a time; every other `sortable` column renders in the idle state.
|
|
75
|
+
*/
|
|
76
|
+
sortKey?: string | null;
|
|
77
|
+
/** Direction applied to the `sortKey` column. Defaults to `'none'`. */
|
|
78
|
+
sortDirection?: SortDirection;
|
|
79
|
+
/**
|
|
80
|
+
* Called when a sortable column's sort control is toggled. Receives the
|
|
81
|
+
* column key and its next direction (`none` → `asc` → `desc` → `none`). The
|
|
82
|
+
* table does not sort data itself — reorder `data` in response.
|
|
83
|
+
*/
|
|
84
|
+
onSortChange?: (key: string, direction: SortDirection) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Committed filter selections keyed by column key (controlled). A column is
|
|
87
|
+
* shown as "active" when its entry is a non-empty array.
|
|
88
|
+
*/
|
|
89
|
+
filters?: Record<string, string[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Called when a column's filter is applied or reset. Receives the column key
|
|
92
|
+
* and the selected option values. The table does not filter data itself —
|
|
93
|
+
* filter `data` in response.
|
|
94
|
+
*/
|
|
95
|
+
onFilterChange?: (key: string, values: string[]) => void;
|
|
47
96
|
'data-cy'?: string;
|
|
48
97
|
'data-testid'?: string;
|
|
49
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/datatable/DataTable.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DataTable.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/datatable/DataTable.types.ts"],"names":[],"mappings":"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"}
|