@harpercollins/harpercollins-design-system 1.1.0 → 1.2.1
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/cjs/index.js +20 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/Table/Table.d.ts +8 -6
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/Table/Table.d.ts +8 -6
- package/dist/index.d.ts +9 -7
- package/package.json +1 -1
|
@@ -2,11 +2,13 @@ import { ColumnDef } from "@tanstack/react-table";
|
|
|
2
2
|
interface TableProps {
|
|
3
3
|
data: unknown[];
|
|
4
4
|
columns: ColumnDef<unknown, unknown>[];
|
|
5
|
-
pageCount
|
|
6
|
-
totalCount
|
|
7
|
-
next
|
|
8
|
-
previous
|
|
9
|
-
page
|
|
5
|
+
pageCount?: number;
|
|
6
|
+
totalCount?: number;
|
|
7
|
+
next?: string;
|
|
8
|
+
previous?: string;
|
|
9
|
+
page?: number;
|
|
10
|
+
pageable?: boolean;
|
|
11
|
+
pageSize?: number;
|
|
10
12
|
}
|
|
11
|
-
declare function Table({ data: tableData, columns, pageCount, totalCount, next, previous, page, }: TableProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function Table({ data: tableData, columns, pageCount, totalCount, next, previous, page, pageable, pageSize, }: TableProps): import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
export default Table;
|
package/dist/esm/index.js
CHANGED
|
@@ -537,6 +537,7 @@ function Zi(e,t){return e?function(e){return"function"==typeof e&&(()=>{const t=
|
|
|
537
537
|
padding: var(--spacing--small);
|
|
538
538
|
display: table-cell;
|
|
539
539
|
vertical-align: middle;
|
|
540
|
+
word-wrap: break-word;
|
|
540
541
|
|
|
541
542
|
&.name {
|
|
542
543
|
font-weight: 500;
|
|
@@ -559,8 +560,7 @@ function Zi(e,t){return e?function(e){return"function"==typeof e&&(()=>{const t=
|
|
|
559
560
|
}
|
|
560
561
|
}
|
|
561
562
|
|
|
562
|
-
.
|
|
563
|
-
.reviewed {
|
|
563
|
+
.flex--column {
|
|
564
564
|
display: flex;
|
|
565
565
|
flex-direction: column;
|
|
566
566
|
}
|
|
@@ -614,7 +614,7 @@ function Zi(e,t){return e?function(e){return"function"==typeof e&&(()=>{const t=
|
|
|
614
614
|
pointer-events: none;
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
`;function tl({data:r,columns:i,pageCount:l,totalCount:a,next:s,previous:c,page:u}){const[
|
|
617
|
+
`;function tl({data:r,columns:i,pageCount:l,totalCount:a,next:s,previous:c,page:u,pageable:d,pageSize:g}){const[p,f]=o.useState((()=>[...r])),[m,h]=o.useState({pageIndex:0,pageSize:g||10}),v=function(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[o]=n.useState((()=>({current:Ki(t)}))),[r,i]=n.useState((()=>o.current.initialState));return o.current.setOptions((t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),null==e.onStateChange||e.onStateChange(t)}}))),o.current}({columns:i,data:p,getCoreRowModel:e=>ii((()=>[e.options.data]),(t=>{const n={rows:[],flatRows:[],rowsById:{}},o=function(t,r,i){void 0===r&&(r=0);const l=[];for(let s=0;s<t.length;s++){const c=di(e,e._getRowId(t[s],s,i),t[s],s,r,void 0,null==i?void 0:i.id);var a;n.flatRows.push(c),n.rowsById[c.id]=c,l.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(t[s],s),null!=(a=c.originalSubRows)&&a.length&&(c.subRows=o(c.originalSubRows,r+1,c)))}return l};return n.rows=o(t),n}),li(e.options,"debugTable","getRowModel",(()=>e._autoResetPageIndex()))),pageCount:l,state:{pagination:o.useMemo((()=>({pageIndex:m.pageIndex,pageSize:m.pageSize})),[m.pageIndex,m.pageSize])},onPaginationChange:h,manualPagination:!0});return o.useEffect((()=>{void 0!==u&&v.setPageIndex(Number(u-1))}),[u,v]),o.useEffect((()=>{f(r)}),[r]),t(Ji,{children:[v.getHeaderGroups().map((t=>e("thead",{children:e("tr",{children:t.headers.map((t=>e("th",{key:t.id,colSpan:t.colSpan,style:{width:t.getSize()},children:t.isPlaceholder?null:Zi(t.column.columnDef.header,t.getContext())})))},t.id)}))),e("tbody",{children:v.getRowModel().rows.map((t=>e("tr",{children:t.getVisibleCells().map((t=>e("td",{key:t.id,style:{width:t.column.getSize()},children:Zi(t.column.columnDef.cell,t.getContext())})))},t.id)))}),e("tfoot",{children:t(Qi,{children:[void 0!==a?t("div",{children:["Total: ",a]}):null,d?t(el,{children:[e(io,{type:"link",href:v.getCanPreviousPage()?window.location.href:"",disabled:!v.getCanPreviousPage(),children:"<<"}),e(io,{type:"link",href:v.getCanPreviousPage()&&c?c:"",disabled:!v.getCanPreviousPage(),children:"<"}),e(io,{type:"link",href:v.getCanNextPage()&&s?s:"",disabled:!v.getCanNextPage(),children:">"}),e(io,{href:v.getCanNextPage()?`${window.location.href}?page=${String(l)}`:"",type:"link",disabled:!v.getCanNextPage(),children:">>"}),t("span",{children:[e("div",{children:"Page"}),t("strong",{children:[v.getState().pagination.pageIndex+1," of"," ",v.getPageCount()]})]})]}):null]})})]})}const nl=tn.div`
|
|
618
618
|
background-color: transparent;
|
|
619
619
|
border-bottom: 2px solid transparent;
|
|
620
620
|
color: var(--color--grey-dark);
|