@atom-learning/components 3.20.0 → 3.21.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.
- package/CHANGELOG.md +3 -2
- package/dist/components/data-table/DataTable.d.ts +333 -328
- package/dist/components/data-table/pagination/Pagination.d.ts +8 -2
- package/dist/components/data-table/pagination/Pagination.js +1 -1
- package/dist/components/data-table/pagination/Pagination.js.map +1 -1
- package/dist/docgen.json +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/data-table/pagination/PaginationButtons.d.ts +0 -14
- package/dist/components/data-table/pagination/PaginationButtons.js +0 -2
- package/dist/components/data-table/pagination/PaginationButtons.js.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { TcolorScheme } from '../../../experiments/color-scheme';
|
|
2
3
|
declare const StyledNav: import("@stitches/react/types/styled-component").StyledComponent<"nav", {}, {
|
|
3
4
|
sm: string;
|
|
4
5
|
md: string;
|
|
@@ -330,7 +331,12 @@ declare const StyledNav: import("@stitches/react/types/styled-component").Styled
|
|
|
330
331
|
marginBottom: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
331
332
|
};
|
|
332
333
|
}>>;
|
|
333
|
-
declare type PaginationProps = React.ComponentProps<typeof StyledNav
|
|
334
|
+
declare type PaginationProps = React.ComponentProps<typeof StyledNav> & {
|
|
335
|
+
colorScheme?: TcolorScheme;
|
|
336
|
+
};
|
|
334
337
|
/** Applies pagination to parent DataTableProvider and renders UI to switch pages etc */
|
|
335
|
-
export declare const Pagination:
|
|
338
|
+
export declare const Pagination: {
|
|
339
|
+
({ colorScheme, ...props }: PaginationProps): JSX.Element | null;
|
|
340
|
+
displayName: string;
|
|
341
|
+
};
|
|
336
342
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as e from"react";import{styled as P}from"../../../stitches.js";import{
|
|
1
|
+
import*as e from"react";import{styled as P}from"../../../stitches.js";import{Pagination as x}from"../../pagination/Pagination.js";import{Text as S}from"../../text/Text.js";import{AsyncDataState as w}from"../DataTable.types.js";import{useDataTable as y}from"../DataTableContext.js";const $=P("nav",{display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center",fontVariantNumeric:"tabular-nums",flexWrap:"wrap",width:"100%",gap:"$4",mt:"$4","@md":{flexDirection:"row"}}),i=({colorScheme:r,...m})=>{const{applyPagination:a,getState:s,getRowModel:g,getPageCount:l,setPageIndex:c,getTotalRows:n,asyncDataState:p}=y();e.useEffect(()=>{a()},[a]);const{pagination:t}=s();if(p!==w.PENDING&&n()===0)return null;const o=t.pageIndex*t.pageSize+1,f=o+g().rows.length-1,d=u=>{c(u-1)};return e.createElement($,{...m},e.createElement(S,{size:"sm"},`${o.toString()} - ${f.toString()} of ${n()} items`),e.createElement(x,{colorScheme:r,selectedPage:t.pageIndex+1,pagesCount:l(),onSelectedPageChange:d}))};i.displayName="Pagination";export{i as Pagination};
|
|
2
2
|
//# sourceMappingURL=Pagination.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","sources":["../../../../src/components/data-table/pagination/Pagination.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '~/stitches'\n\nimport {
|
|
1
|
+
{"version":3,"file":"Pagination.js","sources":["../../../../src/components/data-table/pagination/Pagination.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '~/stitches'\n\nimport { TcolorScheme } from '../../../experiments/color-scheme'\nimport { Pagination as PaginationComponent } from '../../pagination'\nimport { Text } from '../../text'\nimport { AsyncDataState } from '../DataTable.types'\nimport { useDataTable } from '../DataTableContext'\n\nconst StyledNav = styled('nav', {\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n alignItems: 'center',\n fontVariantNumeric: 'tabular-nums',\n flexWrap: 'wrap',\n width: '100%',\n gap: '$4',\n mt: '$4',\n '@md': {\n flexDirection: 'row'\n }\n})\n\ntype PaginationProps = React.ComponentProps<typeof StyledNav> & {\n colorScheme?: TcolorScheme\n}\n\n/** Applies pagination to parent DataTableProvider and renders UI to switch pages etc */\nexport const Pagination = ({ colorScheme, ...props }: PaginationProps) => {\n const {\n applyPagination,\n getState,\n getRowModel,\n getPageCount,\n setPageIndex,\n getTotalRows,\n asyncDataState\n } = useDataTable()\n\n React.useEffect(() => {\n applyPagination()\n }, [applyPagination])\n\n const { pagination: paginationState } = getState()\n const isPending = asyncDataState === AsyncDataState.PENDING\n const isEmpty = !isPending && getTotalRows() === 0\n\n if (isEmpty) return null\n\n const recordsCountFrom =\n paginationState.pageIndex * paginationState.pageSize + 1\n const recordsCountTo = recordsCountFrom + getRowModel().rows.length - 1\n\n //indexing for the pagination component is 1 based\n const setPage = (index: number) => {\n setPageIndex(index - 1)\n }\n\n return (\n <StyledNav {...props}>\n <Text size=\"sm\">\n {`${recordsCountFrom.toString()} - ${recordsCountTo.toString()} of ${getTotalRows()} items`}\n </Text>\n <PaginationComponent\n colorScheme={colorScheme}\n selectedPage={paginationState.pageIndex + 1}\n pagesCount={getPageCount()}\n onSelectedPageChange={setPage}\n />\n </StyledNav>\n )\n}\n\nPagination.displayName = 'Pagination'\n"],"names":["StyledNav","styled","Pagination","colorScheme","props","applyPagination","getState","getRowModel","getPageCount","setPageIndex","getTotalRows","asyncDataState","useDataTable","React","paginationState","AsyncDataState","recordsCountFrom","recordsCountTo","setPage","index","Text","PaginationComponent"],"mappings":"yRAUA,MAAMA,EAAYC,EAAO,MAAO,CAC9B,QAAS,OACT,cAAe,SACf,eAAgB,gBAChB,WAAY,SACZ,mBAAoB,eACpB,SAAU,OACV,MAAO,OACP,IAAK,KACL,GAAI,KACJ,MAAO,CACL,cAAe,KACjB,CACF,CAAC,EAOYC,EAAa,CAAC,CAAE,YAAAC,KAAgBC,CAAM,IAAuB,CACxE,KAAM,CACJ,gBAAAC,EACA,SAAAC,EACA,YAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,eAAAC,CACF,EAAIC,EAAa,EAEjBC,EAAM,UAAU,IAAM,CACpBR,EACF,CAAA,EAAG,CAACA,CAAe,CAAC,EAEpB,KAAM,CAAE,WAAYS,CAAgB,EAAIR,EAAAA,EAIxC,GAHkBK,IAAmBI,EAAe,SACtBL,EAAa,IAAM,EAEpC,OAAO,KAEpB,MAAMM,EACJF,EAAgB,UAAYA,EAAgB,SAAW,EACnDG,EAAiBD,EAAmBT,EAAY,EAAE,KAAK,OAAS,EAGhEW,EAAWC,GAAkB,CACjCV,EAAaU,EAAQ,CAAC,CACxB,EAEA,OACEN,EAAA,cAACb,EAAA,CAAW,GAAGI,CACbS,EAAAA,EAAA,cAACO,EAAA,CAAK,KAAK,IAAA,EACR,GAAGJ,EAAiB,gBAAgBC,EAAe,SAAA,QAAiBP,EAAa,SACpF,EACAG,EAAA,cAACQ,EAAA,CACC,YAAalB,EACb,aAAcW,EAAgB,UAAY,EAC1C,WAAYN,IACZ,qBAAsBU,CAAAA,CACxB,CACF,CAEJ,EAEAhB,EAAW,YAAc"}
|