blockforce-design-system 2.0.0 → 2.0.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/MIGRATION.md +148 -116
- package/lib/commonjs/components/forms/select/select.styles.js +20 -20
- package/lib/commonjs/components/layout/table/table.comp.js.map +1 -1
- package/lib/commonjs/components/navigation/pagination/pagination.comp.js +1 -1
- package/lib/commonjs/components/navigation/pagination/pagination.comp.js.map +1 -1
- package/lib/commonjs/components/navigation/pagination/pagination.styles.js +14 -3
- package/lib/commonjs/components/navigation/pagination/pagination.styles.js.map +1 -1
- package/lib/commonjs/components/navigation/table-pagination/table-pagination.comp.js +1 -1
- package/lib/commonjs/components/navigation/table-pagination/table-pagination.comp.js.map +1 -1
- package/lib/index.d.ts +56 -42
- package/lib/module/components/forms/select/select.styles.js +20 -20
- package/lib/module/components/layout/table/table.comp.js.map +1 -1
- package/lib/module/components/navigation/pagination/pagination.comp.js +1 -1
- package/lib/module/components/navigation/pagination/pagination.comp.js.map +1 -1
- package/lib/module/components/navigation/pagination/pagination.styles.js +17 -6
- package/lib/module/components/navigation/pagination/pagination.styles.js.map +1 -1
- package/lib/module/components/navigation/table-pagination/table-pagination.comp.js +1 -1
- package/lib/module/components/navigation/table-pagination/table-pagination.comp.js.map +1 -1
- package/package.json +1 -1
- package/lib/commonjs/components/navigation/table-pagination/table-pagination.styles.js +0 -13
- package/lib/commonjs/components/navigation/table-pagination/table-pagination.styles.js.map +0 -1
- package/lib/module/components/navigation/table-pagination/table-pagination.styles.js +0 -13
- package/lib/module/components/navigation/table-pagination/table-pagination.styles.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.comp.js","sources":["../../../../../src/components/navigation/pagination/pagination.comp.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\n\nimport { Button } from '../../buttons'\nimport { Icon } from '../../icons'\nimport { Box } from '../../layout'\nimport { Text } from '../../typography'\n\nimport { PaginationProps } from './pagination.types'\n\nimport * as Styles from './pagination.styles'\n\nconst PaginationSpacer = () => (\n <Box padding={1} borderRadius=\"8px\">\n <Text color=\"grey_3\">...</Text>\n </Box>\n)\n\n/**\n * Números de página com setas, para navegar entre as páginas de uma lista.\n * `total` é o número de páginas. Para rodapé de tabela com itens por página e contagem use TablePagination.\n * @example <Pagination total={10} current={pagina} onChange={setPagina} />\n */\nexport const Pagination = ({\n current = 1,\n onChange,\n total,\n showAll,\n}: PaginationProps) => {\n const [page, setPage] = useState(current)\n const [pages, setPages] = useState<(number | JSX.Element)[]>([])\n\n useEffect(() => {\n const pageIsAtStart = page <= 3\n const pageIsAtEnd = page >= total - 2\n\n if (showAll || total <= 5) {\n setPages(Array.from({ length: total }, (_, i) => i + 1))\n return\n }\n\n if (pageIsAtStart) {\n setPages([1, 2, 3, 4, <PaginationSpacer />, total])\n return\n }\n if (pageIsAtEnd) {\n setPages([\n 1,\n <PaginationSpacer />,\n total - 3,\n total - 2,\n total - 1,\n total,\n ])\n return\n }\n\n setPages([\n 1,\n <PaginationSpacer />,\n page - 1,\n page,\n page + 1,\n <PaginationSpacer />,\n total,\n ])\n }, [page, total])\n\n useEffect(() => {\n setPage(current)\n }, [current])\n\n const handleChangePage = (_page: number) => {\n setPage(_page)\n onChange?.(_page)\n }\n\n const isFirstPage = page === 1\n const isLastPage = page === total\n\n return (\n <Box alignItems=\"center\" data-testid=\"pagination\">\n <Button\n disabled={isFirstPage}\n variant=\"text\"\n width=\"40px\"\n onClick={() => handleChangePage(page - 1)}\n data-testid=\"previous-button\"\n aria-label=\"Página anterior\"\n >\n <Icon\n name=\"arrow_left_s\"\n color={isFirstPage ? 'grey_4' : 'secondary'}\n size={24}\n />\n </Button>\n {pages.map((_page, index) => {\n if (typeof _page === 'number') {\n return (\n <Styles.PageButton\n key={`page-${index}`}\n type=\"button\"\n onClick={() => handleChangePage(_page)}\n $current={page === _page}\n data-testid={`page-${_page}`}\n aria-label={`Página ${_page}`}\n aria-current={page === _page ? 'page' : undefined}\n >\n <Text color={page === _page ? 'grey_1' : 'grey_3'}>{_page}</Text>\n </Styles.PageButton>\n )\n }\n return <Box key={`page-spacer-${index}`}>{_page}</Box>\n })}\n <Button\n disabled={isLastPage}\n variant=\"text\"\n width=\"40px\"\n onClick={() => handleChangePage(page + 1)}\n data-testid=\"next-button\"\n aria-label=\"Próxima página\"\n >\n <Icon\n name=\"arrow_right_s\"\n color={isLastPage ? 'grey_4' : 'secondary'}\n size={24}\n />\n </Button>\n </Box>\n )\n}\n"],"names":["PaginationSpacer","_jsx","jsx","Box","padding","borderRadius","children","Text","color","Pagination","current","onChange","total","showAll","page","setPage","useState","pages","setPages","useEffect","pageIsAtStart","pageIsAtEnd","Array","from","length","_","i","handleChangePage","_page","isFirstPage","isLastPage","_jsxs","alignItems","Button","disabled","variant","width","onClick","Icon","name","size","map","index","Styles","type","$current","undefined"],"mappings":"6RAWA,MAAMA,EAAmBA,IACvBC,EAAAC,IAACC,MAAG,CAACC,QAAS,EAAGC,aAAa,MAC5BC,SAAAL,EAAAC,IAACK,OAAI,CAACC,MAAM,SAAQF,SAAA,6BASEG,EACxBC,UAAU,EACVC,WACAC,QACAC,cAEA,MAAOC,EAAMC,GAAWC,EAAQA,SAACN,IAC1BO,EAAOC,GAAYF,EAAQA,SAA2B,IAE7DG,EAAAA,WAAU,KACR,MAAMC,EAAgBN,GAAQ,EACxBO,EAAcP,GAAQF,EAAQ,EAGlCM,EADEL,GAAWD,GAAS,EACbU,MAAMC,KAAK,CAAEC,OAAQZ,IAAS,CAACa,EAAGC,IAAMA,EAAI,IAInDN,EACO,CAAC,EAAG,EAAG,EAAG,EAAGnB,MAACD,EAAgB,CAAA,GAAKY,GAG1CS,EACO,CACP,EACApB,EAAAC,IAACF,EAAmB,CAAA,GACpBY,EAAQ,EACRA,EAAQ,EACRA,EAAQ,EACRA,GAKK,CACP,EACAX,EAAAC,IAACF,EAAmB,CAAA,GACpBc,EAAO,EACPA,EACAA,EAAO,EACPb,MAACD,EAAmB,CAAA,GACpBY,GACA,GACD,CAACE,EAAMF,IAEVO,EAAAA,WAAU,KACRJ,EAAQL,EAAQ,GACf,CAACA,IAEJ,MAAMiB,EAAoBC,IACxBb,EAAQa,GACRjB,IAAWiB,EAAM,EAGbC,EAAuB,IAATf,EACdgB,EAAahB,IAASF,EAE5B,OACEmB,EAAAA,KAAC5B,EAAAA,IAAG,CAAC6B,WAAW,SAAqB,cAAA,uBACnC/B,EAACC,IAAA+B,SACC,CAAAC,SAAUL,EACVM,QAAQ,OACRC,MAAM,OACNC,QAASA,IAAMV,EAAiBb,EAAO,GAAE,cAC7B,kBAAiB,aAClB,kBAEXR,SAAAL,EAAAC,IAACoC,OAAI,CACHC,KAAK,eACL/B,MAAOqB,EAAc,SAAW,YAChCW,KAAM,OAGTvB,EAAMwB,KAAI,CAACb,EAAOc,IACI,iBAAVd,EAEP3B,EAAAA,IAAC0C,EAAAA,WAEC,CAAAC,KAAK,SACLP,QAASA,IAAMV,EAAiBC,GAAMiB,SAC5B/B,IAASc,EACN,cAAA,QAAQA,IACT,aAAA,UAAUA,mBACRd,IAASc,EAAQ,YAASkB,EAExCxC,SAAAL,EAAAC,IAACK,OAAI,CAACC,MAAOM,IAASc,EAAQ,SAAW,SAAQtB,SAAGsB,KARvC,QAAAc,KAYZzC,EAAAA,IAACE,EAAAA,IAAkC,CAAAG,SAAAsB,GAAV,eAAAc,OAElCzC,EAAAC,IAAC+B,SAAM,CACLC,SAAUJ,EACVK,QAAQ,OACRC,MAAM,OACNC,QAASA,IAAMV,EAAiBb,EAAO,GAAE,cAC7B,cAAa,aACd,iBAAgBR,SAE3BL,EAACC,IAAAoC,OACC,CAAAC,KAAK,gBACL/B,MAAOsB,EAAa,SAAW,YAC/BU,KAAM,SAGN"}
|
|
1
|
+
{"version":3,"file":"pagination.comp.js","sources":["../../../../../src/components/navigation/pagination/pagination.comp.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react'\n\nimport { Button } from '../../buttons'\nimport { Select, SelectOption } from '../../forms/select'\nimport { Icon } from '../../icons'\nimport { Box } from '../../layout'\nimport { Text } from '../../typography'\n\nimport { PaginationProps } from './pagination.types'\n\nimport * as Styles from './pagination.styles'\n\nconst DEFAULT_ITEMS_PER_PAGE_OPTIONS = [10, 50, 100]\n\nconst PaginationSpacer = () => (\n <Box padding={1} borderRadius=\"8px\">\n <Text color=\"grey_3\">...</Text>\n </Box>\n)\n\ninterface PageListProps {\n total: number\n current: number\n onChange: (page: number) => void\n showAll?: boolean\n}\n\nconst PageList = ({ total, current, onChange, showAll }: PageListProps) => {\n const [page, setPage] = useState(current)\n const [pages, setPages] = useState<(number | JSX.Element)[]>([])\n\n useEffect(() => {\n const pageIsAtStart = page <= 3\n const pageIsAtEnd = page >= total - 2\n\n if (showAll || total <= 5) {\n setPages(Array.from({ length: total }, (_, i) => i + 1))\n return\n }\n\n if (pageIsAtStart) {\n setPages([1, 2, 3, 4, <PaginationSpacer />, total])\n return\n }\n if (pageIsAtEnd) {\n setPages([\n 1,\n <PaginationSpacer />,\n total - 3,\n total - 2,\n total - 1,\n total,\n ])\n return\n }\n\n setPages([\n 1,\n <PaginationSpacer />,\n page - 1,\n page,\n page + 1,\n <PaginationSpacer />,\n total,\n ])\n }, [page, total, showAll])\n\n useEffect(() => {\n setPage(current)\n }, [current])\n\n const handleChangePage = (_page: number) => {\n setPage(_page)\n onChange(_page)\n }\n\n const isFirstPage = page === 1\n const isLastPage = page === total\n\n return (\n <Box alignItems=\"center\" data-testid=\"pagination\">\n <Button\n disabled={isFirstPage}\n variant=\"text\"\n width=\"40px\"\n onClick={() => handleChangePage(page - 1)}\n data-testid=\"previous-button\"\n aria-label=\"Página anterior\"\n >\n <Icon\n name=\"arrow_left_s\"\n color={isFirstPage ? 'grey_4' : 'secondary'}\n size={24}\n />\n </Button>\n {pages.map((_page, index) => {\n if (typeof _page === 'number') {\n return (\n <Styles.PageButton\n key={`page-${index}`}\n type=\"button\"\n onClick={() => handleChangePage(_page)}\n $current={page === _page}\n data-testid={`page-${_page}`}\n aria-label={`Página ${_page}`}\n aria-current={page === _page ? 'page' : undefined}\n >\n <Text color={page === _page ? 'grey_1' : 'grey_3'}>{_page}</Text>\n </Styles.PageButton>\n )\n }\n return <Box key={`page-spacer-${index}`}>{_page}</Box>\n })}\n <Button\n disabled={isLastPage}\n variant=\"text\"\n width=\"40px\"\n onClick={() => handleChangePage(page + 1)}\n data-testid=\"next-button\"\n aria-label=\"Próxima página\"\n >\n <Icon\n name=\"arrow_right_s\"\n color={isLastPage ? 'grey_4' : 'secondary'}\n size={24}\n />\n </Button>\n </Box>\n )\n}\n\n/**\n * Paginação de listas e tabelas. Um componente só, em duas formas:\n * - com `total` (número de páginas): só as setas e os números de página;\n * - com `totalItems` (número de itens): o rodapé completo de tabela, com itens por página,\n * páginas e a contagem (\"20 de 78\"). As páginas saem de `totalItems` e `itemsPerPage`.\n * Os textos (`viewText`, `itemsText`, `ofText`) podem ser traduzidos.\n * @example <Pagination total={10} current={pagina} onChange={setPagina} />\n * @example <Pagination totalItems={240} onChange={setPagina} onChangeItemsPerPage={setPorPagina} />\n */\nexport const Pagination = ({\n total,\n totalItems,\n current = 1,\n onChange,\n showAll,\n itemsPerPage = 10,\n itemsPerPageOptions = DEFAULT_ITEMS_PER_PAGE_OPTIONS,\n onChangeItemsPerPage,\n viewText = 'Visualizar',\n itemsText = 'itens',\n ofText = 'de',\n}: PaginationProps) => {\n const [page, setPage] = useState(current)\n const [perPage, setPerPage] = useState(itemsPerPage)\n\n useEffect(() => {\n setPage(current)\n }, [current])\n\n useEffect(() => {\n setPerPage(itemsPerPage)\n }, [itemsPerPage])\n\n const quantityOptions: SelectOption[] = useMemo(\n () =>\n itemsPerPageOptions.map((quantity) => ({\n label: `${quantity} ${itemsText}`,\n value: String(quantity),\n })),\n [itemsPerPageOptions, itemsText],\n )\n\n const handleChangePage = (next: number) => {\n setPage(next)\n onChange?.(next)\n }\n\n if (totalItems === undefined) {\n return (\n <PageList\n total={Math.max(1, total ?? 1)}\n current={page}\n onChange={handleChangePage}\n showAll={showAll}\n />\n )\n }\n\n const handleChangePerPage = (e: React.ChangeEvent<HTMLInputElement>) => {\n const next = parseInt(e.target.value)\n if (Number.isNaN(next)) return\n setPerPage(next)\n onChangeItemsPerPage?.(next)\n }\n\n return (\n <Box\n width=\"100%\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n flexWrap=\"wrap\"\n position=\"relative\"\n data-testid=\"pagination-footer\"\n >\n <Styles.SideBox gap={1} alignItems=\"center\" minWidth=\"180px\">\n <Text color=\"grey_3\" size=\"small\">\n {viewText}\n </Text>\n <Select\n options={quantityOptions}\n value={String(perPage)}\n onChange={handleChangePerPage}\n width=\"120px\"\n padding=\"4px 8px\"\n variant=\"text\"\n aria-label={viewText}\n />\n </Styles.SideBox>\n\n <Styles.CenterBox>\n <PageList\n total={Math.max(1, Math.ceil(totalItems / perPage))}\n current={page}\n onChange={handleChangePage}\n showAll={showAll}\n />\n </Styles.CenterBox>\n\n <Styles.SideBox minWidth=\"180px\" justifyContent=\"flex-end\">\n <Text>\n <b>{Math.min(totalItems, page * perPage)}</b> {ofText} {totalItems}\n </Text>\n </Styles.SideBox>\n </Box>\n )\n}\n"],"names":["DEFAULT_ITEMS_PER_PAGE_OPTIONS","PaginationSpacer","_jsx","jsx","Box","padding","borderRadius","children","Text","color","PageList","total","current","onChange","showAll","page","setPage","useState","pages","setPages","useEffect","pageIsAtStart","pageIsAtEnd","Array","from","length","_","i","handleChangePage","_page","isFirstPage","isLastPage","_jsxs","alignItems","Button","disabled","variant","width","onClick","Icon","name","size","map","index","Styles","type","$current","undefined","Pagination","totalItems","itemsPerPage","itemsPerPageOptions","onChangeItemsPerPage","viewText","itemsText","ofText","perPage","setPerPage","quantityOptions","useMemo","quantity","label","value","String","next","Math","max","justifyContent","flexWrap","position","gap","minWidth","Select","options","e","parseInt","target","Number","isNaN","ceil","min"],"mappings":"4UAYA,MAAMA,EAAiC,CAAC,GAAI,GAA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EAAAA,IACC,CAAAiC,MAAM,OACN8B,eAAe,gBACflC,WAAW,SACXmC,SAAS,OACTC,SAAS,WAAU,cACP,oBAAmB9D,SAAA,CAE/ByB,OAACY,UAAc,CAAC0B,IAAK,EAAGrC,WAAW,SAASsC,SAAS,kBACnDrE,EAACC,IAAAK,OAAK,CAAAC,MAAM,SAASgC,KAAK,QACvBlC,SAAA8C,IAEHnD,EAAAC,IAACqE,SACC,CAAAC,QAASf,EACTI,MAAOC,OAAOP,GACd3C,SAvBqB6D,IAC3B,MAAMV,EAAOW,SAASD,EAAEE,OAAOd,OAC3Be,OAAOC,MAAMd,KACjBP,EAAWO,GACXZ,IAAuBY,GAAK,EAoBtB3B,MAAM,QACNhC,QAAQ,UACR+B,QAAQ,OACI,aAAAiB,OAIhBnD,EAACC,IAAAyC,sBACC1C,EAACC,IAAAO,GACCC,MAAOsD,KAAKC,IAAI,EAAGD,KAAKc,KAAK9B,EAAaO,IAC1C5C,QAASG,EACTF,SAAUe,EACVd,QAASA,MAIbZ,EAACC,IAAAyC,UAAc,CAAC2B,SAAS,QAAQJ,eAAe,WAAU5D,SACxDyB,OAACxB,OAAI,CAAAD,SAAA,CACHL,EAAIC,IAAA,IAAA,CAAAI,SAAA0D,KAAKe,IAAI/B,EAAYlC,EAAOyC,KAAa,IAAED,EAAS,IAAAN,SAGxD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";var e=require("styled-components"),o=require("../../../theme/media.js"),t=require("../../layout/box/box.comp.js");const r=e.styled.button`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: none;
|
|
4
4
|
align-items: center;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
padding: ${({theme:e})=>e.spacing[1]};
|
|
9
9
|
border: none;
|
|
10
10
|
border-radius: ${({theme:e})=>e.radius.md};
|
|
11
|
-
background-color: ${({$current:e,theme:
|
|
11
|
+
background-color: ${({$current:e,theme:o})=>e?o.colors.grey_5:o.colors.white};
|
|
12
12
|
font: inherit;
|
|
13
13
|
cursor: pointer;
|
|
14
14
|
|
|
@@ -16,5 +16,16 @@
|
|
|
16
16
|
outline: 2px solid ${({theme:e})=>e.colors.border.focus};
|
|
17
17
|
outline-offset: 1px;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
`,i=e.styled(t.Box)`
|
|
20
|
+
${o.media.down("md")} {
|
|
21
|
+
order: 1;
|
|
22
|
+
min-width: auto;
|
|
23
|
+
}
|
|
24
|
+
`,n=e.styled(t.Box)`
|
|
25
|
+
${o.media.down("md")} {
|
|
26
|
+
width: 100%;
|
|
27
|
+
order: 2;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
}
|
|
30
|
+
`;exports.CenterBox=n,exports.PageButton=r,exports.SideBox=i;
|
|
20
31
|
//# sourceMappingURL=pagination.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.styles.js","sources":["../../../../../src/components/navigation/pagination/pagination.styles.tsx"],"sourcesContent":["import { styled } from 'styled-components'\n\nexport const PageButton = styled.button<{ $current: boolean }>`\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n padding: ${({ theme }) => theme.spacing[1]};\n border: none;\n border-radius: ${({ theme }) => theme.radius.md};\n background-color: ${({ $current, theme }) =>\n $current ? theme.colors.grey_5 : theme.colors.white};\n font: inherit;\n cursor: pointer;\n\n &:focus-visible {\n outline: 2px solid ${({ theme }) => theme.colors.border.focus};\n outline-offset: 1px;\n }\n`\n"],"names":["PageButton","styled","button","theme","spacing","radius","md","$current","colors","grey_5","white","border","focus"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pagination.styles.js","sources":["../../../../../src/components/navigation/pagination/pagination.styles.tsx"],"sourcesContent":["import { styled } from 'styled-components'\n\nimport { media } from '../../../theme'\nimport { Box } from '../../layout'\n\nexport const PageButton = styled.button<{ $current: boolean }>`\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n padding: ${({ theme }) => theme.spacing[1]};\n border: none;\n border-radius: ${({ theme }) => theme.radius.md};\n background-color: ${({ $current, theme }) =>\n $current ? theme.colors.grey_5 : theme.colors.white};\n font: inherit;\n cursor: pointer;\n\n &:focus-visible {\n outline: 2px solid ${({ theme }) => theme.colors.border.focus};\n outline-offset: 1px;\n }\n`\n\nexport const SideBox = styled(Box)`\n ${media.down('md')} {\n order: 1;\n min-width: auto;\n }\n`\n\nexport const CenterBox = styled(Box)`\n ${media.down('md')} {\n width: 100%;\n order: 2;\n justify-content: center;\n }\n`\n"],"names":["PageButton","styled","button","theme","spacing","radius","md","$current","colors","grey_5","white","border","focus","SideBox","Box","media","down","CenterBox"],"mappings":"+HAKaA,MAAAA,EAAaC,EAAMA,OAACC,MAA6B;;;;;;;aAOjD,EAAGC,WAAYA,EAAMC,QAAQ;;mBAEvB,EAAGD,WAAYA,EAAME,OAAOC;sBACzB,EAAGC,WAAUJ,WAC/BI,EAAWJ,EAAMK,OAAOC,OAASN,EAAMK,OAAOE;;;;;yBAKzB,EAAGP,WAAYA,EAAMK,OAAOG,OAAOC;;;EAK/CC,EAAUZ,EAAAA,OAAOa,EAAAA,IAAI;IAC9BC,EAAKA,MAACC,KAAK;;;;EAMFC,EAAYhB,EAAAA,OAAOa,EAAAA,IAAI;IAChCC,EAAKA,MAACC,KAAK;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var t=require("react/jsx-runtime"),a=require("../pagination/pagination.comp.js");exports.TablePagination=({total:i,...e})=>t.jsx(a.Pagination,{totalItems:i,...e});
|
|
2
2
|
//# sourceMappingURL=table-pagination.comp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-pagination.comp.js","sources":["../../../../../src/components/navigation/table-pagination/table-pagination.comp.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"table-pagination.comp.js","sources":["../../../../../src/components/navigation/table-pagination/table-pagination.comp.tsx"],"sourcesContent":["import { Pagination } from '../pagination/pagination.comp'\n\nimport { TablePaginationProps } from './table-pagination.types'\n\n/**\n * Rodapé de tabela da v1. É o próprio `Pagination` com `totalItems`.\n * @deprecated Use `<Pagination totalItems={...} />`.\n * @example <Pagination totalItems={240} onChange={setPagina} onChangeItemsPerPage={setPorPagina} />\n */\nexport const TablePagination = ({ total, ...rest }: TablePaginationProps) => (\n <Pagination totalItems={total} {...rest} />\n)\n"],"names":["TablePagination","total","rest","_jsx","Pagination","totalItems"],"mappings":"sHAS+BA,EAAGC,WAAUC,KAC1CC,EAAAA,IAACC,EAAAA,WAAW,CAAAC,WAAYJ,KAAWC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -2725,7 +2725,7 @@ interface TableProps {
|
|
|
2725
2725
|
* Tabela de dados com colunas configuráveis (`headers`), seleção de linhas (`selectable`) e conteúdo próprio por coluna (`customRender`).
|
|
2726
2726
|
* No celular, `mobileLayout="cards"` mostra cada linha como um card.
|
|
2727
2727
|
* `onRowClick` deixa a linha clicável (com destaque no hover e teclado); `hoverable` só destaca.
|
|
2728
|
-
* Para listas grandes, coloque
|
|
2728
|
+
* Para listas grandes, coloque `<Pagination totalItems={...} />` abaixo.
|
|
2729
2729
|
* @example <Table headers={[{ key: 'nome', label: 'Nome' }]} data={fornecedores} />
|
|
2730
2730
|
*/
|
|
2731
2731
|
declare const Table: ({ data, headers, onSelectionChange, selectable, selected, header, footer, borderRadius, spacing, boxShadow, mobileLayout, onRowClick, hoverable, ...rest }: TableProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -3232,24 +3232,60 @@ interface AvatarProps {
|
|
|
3232
3232
|
*/
|
|
3233
3233
|
declare const Avatar: ({ children, ...props }: AvatarProps) => react_jsx_runtime.JSX.Element;
|
|
3234
3234
|
|
|
3235
|
-
/** Props
|
|
3235
|
+
/** Props do Pagination: só os números de página (`total`) ou o rodapé de tabela completo (`totalItems`). */
|
|
3236
3236
|
interface PaginationProps {
|
|
3237
|
-
/**
|
|
3238
|
-
|
|
3239
|
-
|
|
3237
|
+
/**
|
|
3238
|
+
* Número de páginas. Use quando a lista já sabe quantas páginas tem.
|
|
3239
|
+
* Com `totalItems`, as páginas são calculadas e este valor é ignorado.
|
|
3240
|
+
*/
|
|
3241
|
+
total?: number;
|
|
3242
|
+
/**
|
|
3243
|
+
* Número de itens da lista. Liga o rodapé completo: itens por página à esquerda,
|
|
3244
|
+
* páginas no meio e a contagem ("20 de 78") à direita.
|
|
3245
|
+
*/
|
|
3246
|
+
totalItems?: number;
|
|
3247
|
+
/** Página atual (começa em 1).
|
|
3248
|
+
* @default 1
|
|
3249
|
+
*/
|
|
3240
3250
|
current?: number;
|
|
3241
|
-
/**
|
|
3251
|
+
/** Chamado ao trocar de página, com o número da página. */
|
|
3242
3252
|
onChange?: (page: number) => void;
|
|
3243
|
-
/**
|
|
3253
|
+
/** Mostra todos os números de página, sem reticências. */
|
|
3244
3254
|
showAll?: boolean;
|
|
3255
|
+
/** Itens por página (só com `totalItems`).
|
|
3256
|
+
* @default 10
|
|
3257
|
+
*/
|
|
3258
|
+
itemsPerPage?: number;
|
|
3259
|
+
/** Quantidades oferecidas no seletor de itens por página (só com `totalItems`).
|
|
3260
|
+
* @default [10, 50, 100]
|
|
3261
|
+
*/
|
|
3262
|
+
itemsPerPageOptions?: number[];
|
|
3263
|
+
/** Chamado ao trocar a quantidade de itens por página, com o novo valor. */
|
|
3264
|
+
onChangeItemsPerPage?: (itemsPerPage: number) => void;
|
|
3265
|
+
/** Texto antes do seletor de itens por página.
|
|
3266
|
+
* @default 'Visualizar'
|
|
3267
|
+
*/
|
|
3268
|
+
viewText?: string;
|
|
3269
|
+
/** Texto depois da quantidade no seletor ("10 itens").
|
|
3270
|
+
* @default 'itens'
|
|
3271
|
+
*/
|
|
3272
|
+
itemsText?: string;
|
|
3273
|
+
/** Texto da contagem ("20 de 78").
|
|
3274
|
+
* @default 'de'
|
|
3275
|
+
*/
|
|
3276
|
+
ofText?: string;
|
|
3245
3277
|
}
|
|
3246
3278
|
|
|
3247
3279
|
/**
|
|
3248
|
-
*
|
|
3249
|
-
* `total`
|
|
3280
|
+
* Paginação de listas e tabelas. Um componente só, em duas formas:
|
|
3281
|
+
* - com `total` (número de páginas): só as setas e os números de página;
|
|
3282
|
+
* - com `totalItems` (número de itens): o rodapé completo de tabela, com itens por página,
|
|
3283
|
+
* páginas e a contagem ("20 de 78"). As páginas saem de `totalItems` e `itemsPerPage`.
|
|
3284
|
+
* Os textos (`viewText`, `itemsText`, `ofText`) podem ser traduzidos.
|
|
3250
3285
|
* @example <Pagination total={10} current={pagina} onChange={setPagina} />
|
|
3286
|
+
* @example <Pagination totalItems={240} onChange={setPagina} onChangeItemsPerPage={setPorPagina} />
|
|
3251
3287
|
*/
|
|
3252
|
-
declare const Pagination: ({ current, onChange,
|
|
3288
|
+
declare const Pagination: ({ total, totalItems, current, onChange, showAll, itemsPerPage, itemsPerPageOptions, onChangeItemsPerPage, viewText, itemsText, ofText, }: PaginationProps) => react_jsx_runtime.JSX.Element;
|
|
3253
3289
|
|
|
3254
3290
|
/** Aba com ícone, contador ou estado desabilitado. Use em vez de texto simples quando precisar disso. */
|
|
3255
3291
|
interface TabItem {
|
|
@@ -3319,43 +3355,21 @@ interface TextLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
3319
3355
|
*/
|
|
3320
3356
|
declare const TextLink: ({ children, href, target, underline, ...props }: TextLinkProps) => react_jsx_runtime.JSX.Element;
|
|
3321
3357
|
|
|
3322
|
-
/**
|
|
3323
|
-
|
|
3324
|
-
|
|
3358
|
+
/**
|
|
3359
|
+
* Props do TablePagination. Aqui `total` é o número de itens.
|
|
3360
|
+
* @deprecated Use `PaginationProps` com `totalItems`.
|
|
3361
|
+
*/
|
|
3362
|
+
interface TablePaginationProps extends Omit<PaginationProps, 'total' | 'totalItems'> {
|
|
3363
|
+
/** Número de itens da tabela (vira `totalItems` do Pagination). */
|
|
3325
3364
|
total: number;
|
|
3326
|
-
/** Current active page (1-based) */
|
|
3327
|
-
current?: number;
|
|
3328
|
-
/** Number of items displayed per page
|
|
3329
|
-
* @default 10
|
|
3330
|
-
*/
|
|
3331
|
-
itemsPerPage?: number;
|
|
3332
|
-
/** Called when a page is selected — receives the page number */
|
|
3333
|
-
onChange?: (page: number) => void;
|
|
3334
|
-
/** Called when items per page is changed — receives the new value */
|
|
3335
|
-
onChangeItemsPerPage?: (itemsPerPage: number) => void;
|
|
3336
|
-
/** When true, shows all page numbers instead of truncating with ellipsis */
|
|
3337
|
-
showAll?: boolean;
|
|
3338
|
-
/** Custom label for the "View" text (i18n)
|
|
3339
|
-
* @default 'Visualizar'
|
|
3340
|
-
*/
|
|
3341
|
-
viewText?: string;
|
|
3342
|
-
/** Custom label for the "items" text (i18n)
|
|
3343
|
-
* @default 'itens'
|
|
3344
|
-
*/
|
|
3345
|
-
itemsText?: string;
|
|
3346
|
-
/** Custom label for the "of" text (i18n)
|
|
3347
|
-
* @default 'de'
|
|
3348
|
-
*/
|
|
3349
|
-
ofText?: string;
|
|
3350
3365
|
}
|
|
3351
3366
|
|
|
3352
3367
|
/**
|
|
3353
|
-
* Rodapé de tabela
|
|
3354
|
-
*
|
|
3355
|
-
*
|
|
3356
|
-
* @example <TablePagination total={240} onChange={setPagina} onChangeItemsPerPage={setPorPagina} />
|
|
3368
|
+
* Rodapé de tabela da v1. É o próprio `Pagination` com `totalItems`.
|
|
3369
|
+
* @deprecated Use `<Pagination totalItems={...} />`.
|
|
3370
|
+
* @example <Pagination totalItems={240} onChange={setPagina} onChangeItemsPerPage={setPorPagina} />
|
|
3357
3371
|
*/
|
|
3358
|
-
declare const TablePagination: ({
|
|
3372
|
+
declare const TablePagination: ({ total, ...rest }: TablePaginationProps) => react_jsx_runtime.JSX.Element;
|
|
3359
3373
|
|
|
3360
3374
|
/** Um passo do caminho de navegação. */
|
|
3361
3375
|
interface BreadcrumbItem {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{styled as e}from"styled-components";import{fieldFocus as o,fieldBorder as t}from"../form.styles.js";import{
|
|
1
|
+
import{styled as e}from"styled-components";import{fieldFocus as o,fieldBorder as t}from"../form.styles.js";import{getThemeSpacing as r,getThemeColor as i}from"../../../theme/theme.util.js";import{Box as n}from"../../layout/box/box.comp.js";const a=e(n)`
|
|
2
2
|
position: relative;
|
|
3
3
|
height: 44px;
|
|
4
4
|
width: 100%;
|
|
@@ -7,9 +7,9 @@ import{styled as e}from"styled-components";import{fieldFocus as o,fieldBorder as
|
|
|
7
7
|
width: 100%;
|
|
8
8
|
border-radius: ${({theme:e})=>e.border_radius.input};
|
|
9
9
|
padding: ${({theme:e,padding:o})=>o||`${e.spacing[1]} ${e.spacing[2]}`};
|
|
10
|
-
padding-right: ${({theme:e})=>`calc(${
|
|
10
|
+
padding-right: ${({theme:e})=>`calc(${r(2,e)} + 20px)`};
|
|
11
11
|
font-size: ${({theme:e})=>e.typography.body_size.normal};
|
|
12
|
-
color: ${({value:e,theme:o})=>
|
|
12
|
+
color: ${({value:e,theme:o})=>i(e?"grey_1":"grey_3",o)};
|
|
13
13
|
cursor: pointer;
|
|
14
14
|
|
|
15
15
|
-webkit-appearance: none;
|
|
@@ -22,64 +22,64 @@ import{styled as e}from"styled-components";import{fieldFocus as o,fieldBorder as
|
|
|
22
22
|
${o}
|
|
23
23
|
|
|
24
24
|
&:disabled {
|
|
25
|
-
background-color: ${({theme:e})=>
|
|
25
|
+
background-color: ${({theme:e})=>i("grey_5",e)};
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
${({variant:e,theme:o})=>"outlined"===e?`\n border: 1px solid ${
|
|
28
|
+
${({variant:e,theme:o})=>"outlined"===e?`\n border: 1px solid ${i("grey_4",o)};\n box-shadow: ${o.box_shadow.input};\n background-color: ${i("white",o)};\n `:"\n border: none;\n box-shadow: none;\n "}
|
|
29
29
|
|
|
30
30
|
${t}
|
|
31
|
-
`,p=e(
|
|
31
|
+
`,p=e(n)`
|
|
32
32
|
position: absolute;
|
|
33
33
|
right: 0;
|
|
34
34
|
height: 100%;
|
|
35
35
|
align-items: center;
|
|
36
36
|
z-index: 999;
|
|
37
|
-
padding-right: ${({theme:e})=>
|
|
37
|
+
padding-right: ${({theme:e})=>r(2,e)};
|
|
38
38
|
cursor: pointer;
|
|
39
|
-
`,s=e(
|
|
39
|
+
`,s=e(n)`
|
|
40
40
|
width: 100%;
|
|
41
41
|
padding: ${({theme:e})=>`${e.spacing[1]} ${e.spacing[2]}`};
|
|
42
|
-
border-bottom: 1px solid ${({theme:e})=>
|
|
42
|
+
border-bottom: 1px solid ${({theme:e})=>i("grey_5",e)};
|
|
43
43
|
cursor: pointer;
|
|
44
44
|
justify-content: space-between;
|
|
45
45
|
|
|
46
46
|
&:hover {
|
|
47
|
-
background-color: ${({selected:e,theme:o})=>e||
|
|
47
|
+
background-color: ${({selected:e,theme:o})=>e||i("grey_5",o)};
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
${({selected:e,theme:o})=>{if(e)return`\n background-color: ${
|
|
50
|
+
${({selected:e,theme:o})=>{if(e)return`\n background-color: ${i("secondary",o)}22;\n `}}
|
|
51
51
|
`,h=e.select.withConfig({shouldForwardProp:e=>!["variant","state","padding"].includes(e)})`
|
|
52
52
|
height: 44px;
|
|
53
53
|
width: 100%;
|
|
54
54
|
border-radius: ${({theme:e})=>e.border_radius.input};
|
|
55
55
|
padding: ${({theme:e,padding:o})=>o||`${e.spacing[1]} ${e.spacing[2]}`};
|
|
56
|
-
padding-right: ${({theme:e})=>`calc(${
|
|
56
|
+
padding-right: ${({theme:e})=>`calc(${r(2,e)} + 20px)`};
|
|
57
57
|
font-size: ${({theme:e})=>e.typography.body_size.normal};
|
|
58
|
-
color: ${({value:e,theme:o})=>
|
|
58
|
+
color: ${({value:e,theme:o})=>i(e?"grey_1":"grey_3",o)};
|
|
59
59
|
cursor: pointer;
|
|
60
|
-
border: 1px solid ${({theme:e})=>
|
|
61
|
-
background-color: ${({theme:e})=>
|
|
60
|
+
border: 1px solid ${({theme:e})=>i("grey_4",e)};
|
|
61
|
+
background-color: ${({theme:e})=>i("white",e)};
|
|
62
62
|
appearance: none;
|
|
63
63
|
|
|
64
64
|
${o}
|
|
65
65
|
|
|
66
66
|
&:disabled {
|
|
67
|
-
background-color: ${({theme:e})=>
|
|
67
|
+
background-color: ${({theme:e})=>i("grey_5",e)};
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
${t}
|
|
71
|
-
`,g=e(
|
|
71
|
+
`,g=e(n)`
|
|
72
72
|
position: absolute;
|
|
73
73
|
right: 0;
|
|
74
74
|
height: 100%;
|
|
75
75
|
align-items: center;
|
|
76
76
|
z-index: 2;
|
|
77
|
-
padding-right: ${({theme:e})=>
|
|
77
|
+
padding-right: ${({theme:e})=>r(2,e)};
|
|
78
78
|
pointer-events: none;
|
|
79
79
|
display: flex;
|
|
80
80
|
`,c=e.option`
|
|
81
|
-
background: ${({theme:e})=>
|
|
82
|
-
color: ${({theme:e})=>
|
|
81
|
+
background: ${({theme:e})=>i("white",e)};
|
|
82
|
+
color: ${({theme:e})=>i("grey_1",e)};
|
|
83
83
|
font-size: ${({theme:e})=>e.typography.body_size.normal};
|
|
84
84
|
padding: ${({theme:e})=>`${e.spacing[1]} ${e.spacing[2]}`};
|
|
85
85
|
`;export{p as IconContainer,c as NativeOption,h as NativeSelect,g as NativeSelectIconContainer,s as Option,d as StyledSelect,a as Wrapper};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.comp.js","sources":["../../../../../src/components/layout/table/table.comp.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\n\nimport { Box } from '../box'\nimport { TableHead } from '../table-head'\nimport { TableRow } from '../table-row'\n\nimport { TableData, TableProps } from './table.types'\n\nimport * as Styles from './table.styles'\n\n/**\n * Tabela de dados com colunas configuráveis (`headers`), seleção de linhas (`selectable`) e conteúdo próprio por coluna (`customRender`).\n * No celular, `mobileLayout=\"cards\"` mostra cada linha como um card.\n * `onRowClick` deixa a linha clicável (com destaque no hover e teclado); `hoverable` só destaca.\n * Para listas grandes, coloque
|
|
1
|
+
{"version":3,"file":"table.comp.js","sources":["../../../../../src/components/layout/table/table.comp.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\n\nimport { Box } from '../box'\nimport { TableHead } from '../table-head'\nimport { TableRow } from '../table-row'\n\nimport { TableData, TableProps } from './table.types'\n\nimport * as Styles from './table.styles'\n\n/**\n * Tabela de dados com colunas configuráveis (`headers`), seleção de linhas (`selectable`) e conteúdo próprio por coluna (`customRender`).\n * No celular, `mobileLayout=\"cards\"` mostra cada linha como um card.\n * `onRowClick` deixa a linha clicável (com destaque no hover e teclado); `hoverable` só destaca.\n * Para listas grandes, coloque `<Pagination totalItems={...} />` abaixo.\n * @example <Table headers={[{ key: 'nome', label: 'Nome' }]} data={fornecedores} />\n */\nexport const Table = ({\n data,\n headers,\n onSelectionChange,\n selectable,\n selected,\n header,\n footer,\n borderRadius,\n spacing,\n boxShadow,\n mobileLayout = 'scroll',\n onRowClick,\n hoverable,\n ...rest\n}: TableProps) => {\n const [selectedRows, setSelectedRows] = useState<TableData[]>(selected || [])\n\n useEffect(() => {\n if (selected) {\n setSelectedRows(selected)\n }\n }, [selected, selectedRows])\n\n const handleToggleSelectAll = () => {\n let newSelectedRows: TableData[] = []\n if (selectedRows.length !== data.length) {\n newSelectedRows = [...data]\n }\n\n setSelectedRows(newSelectedRows)\n onSelectionChange?.(newSelectedRows)\n }\n\n const handleToggleSelect = (row: TableData) => {\n let newSelectedRows: TableData[] = selectedRows\n if (selectedRows.includes(row)) {\n newSelectedRows = selectedRows.filter(\n (selectedRow) => selectedRow !== row,\n )\n } else {\n newSelectedRows = [...selectedRows, row]\n }\n\n setSelectedRows(newSelectedRows)\n onSelectionChange?.(newSelectedRows)\n }\n\n const renderDefaultRow = (row: TableData, index: number) => (\n <TableRow\n data={row}\n headers={headers}\n selectable={selectable}\n selected={selectedRows.includes(row)}\n onSelect={handleToggleSelect}\n index={index}\n spacing={spacing}\n hoverable={hoverable ?? Boolean(onRowClick)}\n onClick={onRowClick}\n />\n )\n\n return (\n <Styles.TableWrapper\n data-testid=\"table\"\n direction=\"column\"\n borderRadius={borderRadius}\n boxShadow={boxShadow}\n {...rest}\n >\n {header && <Box width=\"100%\">{header}</Box>}\n <Styles.Table $mobileCards={mobileLayout === 'cards'}>\n <TableHead\n headers={headers}\n selectable={selectable}\n selected={selectedRows.length === data.length}\n onSelect={handleToggleSelectAll}\n spacing={spacing}\n />\n <tbody>\n {data.map((row, index) => {\n if (row.customRender) {\n return (\n <Styles.CustomTableRow\n key={`custom-row-${index}`}\n data-testid=\"custom-row\"\n >\n <Styles.TableColumn $align=\"center\" width=\"100%\">\n {row.customRender(row, index, renderDefaultRow)}\n </Styles.TableColumn>\n </Styles.CustomTableRow>\n )\n }\n return renderDefaultRow(row, index)\n })}\n </tbody>\n </Styles.Table>\n {footer && <Box width=\"100%\">{footer}</Box>}\n </Styles.TableWrapper>\n )\n}\n"],"names":["Table","data","headers","onSelectionChange","selectable","selected","header","footer","borderRadius","spacing","boxShadow","mobileLayout","onRowClick","hoverable","rest","selectedRows","setSelectedRows","useState","useEffect","handleToggleSelect","row","newSelectedRows","includes","filter","selectedRow","renderDefaultRow","index","_jsx","TableRow","onSelect","Boolean","onClick","_jsxs","Styles","direction","Box","width","children","TableHead","length","handleToggleSelectAll","map","customRender","$align"],"mappings":"mWAiBO,MAAMA,EAAQA,EACnBC,OACAC,UACAC,oBACAC,aACAC,WACAC,SACAC,SACAC,eACAC,UACAC,YACAC,eAAe,SACfC,aACAC,eACGC,MAEH,MAAOC,EAAcC,GAAmBC,EAAsBZ,GAAY,IAE1Ea,GAAU,KACJb,GACFW,EAAgBX,EAClB,GACC,CAACA,EAAUU,IAEd,MAUMI,EAAsBC,IAC1B,IAAIC,EAA+BN,EAEjCM,EADEN,EAAaO,SAASF,GACNL,EAAaQ,QAC5BC,GAAgBA,IAAgBJ,IAGjB,IAAIL,EAAcK,GAGtCJ,EAAgBK,GAChBlB,IAAoBkB,EAAgB,EAGhCI,EAAmBA,CAACL,EAAgBM,IACxCC,EAACC,EACC,CAAA3B,KAAMmB,EACNlB,QAASA,EACTE,WAAYA,EACZC,SAAUU,EAAaO,SAASF,GAChCS,SAAUV,EACVO,MAAOA,EACPjB,QAASA,EACTI,UAAWA,GAAaiB,QAAQlB,GAChCmB,QAASnB,IAIb,OACEoB,EAACC,iBACa,QACZC,UAAU,SACV1B,aAAcA,EACdE,UAAWA,KACPI,YAEHR,GAAUqB,EAACQ,EAAG,CAACC,MAAM,OAAQC,SAAA/B,IAC9B0B,EAACC,gBAA4C,UAAjBtB,EAAwB0B,SAAA,CAClDV,EAACW,EAAS,CACRpC,QAASA,EACTE,WAAYA,EACZC,SAAUU,EAAawB,SAAWtC,EAAKsC,OACvCV,SApDsBW,KAC5B,IAAInB,EAA+B,GAC/BN,EAAawB,SAAWtC,EAAKsC,SAC/BlB,EAAkB,IAAIpB,IAGxBe,EAAgBK,GAChBlB,IAAoBkB,EAAgB,EA8C9BZ,QAASA,IAEXkB,EAAA,QAAA,CAAAU,SACGpC,EAAKwC,KAAI,CAACrB,EAAKM,IACVN,EAAIsB,aAEJf,EAACM,iBAEa,aAAYI,SAExBV,EAACM,EAAkB,CAAAU,OAAQ,SAASP,MAAM,OACvCC,SAAAjB,EAAIsB,aAAatB,EAAKM,EAAOD,MAJb,cAAAC,KASlBD,EAAiBL,EAAKM,UAIlCnB,GAAUoB,EAACQ,EAAI,CAAAC,MAAM,OAAMC,SAAE9B,MACV"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t,jsxs as
|
|
1
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useState as r,useEffect as a,useMemo as n}from"react";import{SideBox as i,CenterBox as o,PageButton as l}from"./pagination.styles.js";import{Select as s}from"../../forms/select/select.comp.js";import{Box as c}from"../../layout/box/box.comp.js";import{Text as p}from"../../typography/text/text.comp.js";import{Button as d}from"../../buttons/button/button.comp.js";import{Icon as m}from"../../icons/icon/icon.comp.js";const h=[10,50,100],g=()=>t(c,{padding:1,borderRadius:"8px",children:t(p,{color:"grey_3",children:"..."})}),u=({total:n,current:i,onChange:o,showAll:s})=>{const[h,u]=r(i),[x,b]=r([]);a((()=>{const e=h<=3,r=h>=n-2;b(s||n<=5?Array.from({length:n},((t,e)=>e+1)):e?[1,2,3,4,t(g,{}),n]:r?[1,t(g,{}),n-3,n-2,n-1,n]:[1,t(g,{}),h-1,h,h+1,t(g,{}),n])}),[h,n,s]),a((()=>{u(i)}),[i]);const f=t=>{u(t),o(t)},y=1===h,w=h===n;return e(c,{alignItems:"center","data-testid":"pagination",children:[t(d,{disabled:y,variant:"text",width:"40px",onClick:()=>f(h-1),"data-testid":"previous-button","aria-label":"Página anterior",children:t(m,{name:"arrow_left_s",color:y?"grey_4":"secondary",size:24})}),x.map(((e,r)=>"number"==typeof e?t(l,{type:"button",onClick:()=>f(e),$current:h===e,"data-testid":`page-${e}`,"aria-label":`Página ${e}`,"aria-current":h===e?"page":void 0,children:t(p,{color:h===e?"grey_1":"grey_3",children:e})},`page-${r}`):t(c,{children:e},`page-spacer-${r}`))),t(d,{disabled:w,variant:"text",width:"40px",onClick:()=>f(h+1),"data-testid":"next-button","aria-label":"Próxima página",children:t(m,{name:"arrow_right_s",color:w?"grey_4":"secondary",size:24})})]})},x=({total:l,totalItems:d,current:m=1,onChange:g,showAll:x,itemsPerPage:b=10,itemsPerPageOptions:f=h,onChangeItemsPerPage:y,viewText:w="Visualizar",itemsText:v="itens",ofText:C="de"})=>{const[_,j]=r(m),[P,$]=r(b);a((()=>{j(m)}),[m]),a((()=>{$(b)}),[b]);const I=n((()=>f.map((t=>({label:`${t} ${v}`,value:String(t)})))),[f,v]),A=t=>{j(t),g?.(t)};if(void 0===d)return t(u,{total:Math.max(1,l??1),current:_,onChange:A,showAll:x});return e(c,{width:"100%",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",position:"relative","data-testid":"pagination-footer",children:[e(i,{gap:1,alignItems:"center",minWidth:"180px",children:[t(p,{color:"grey_3",size:"small",children:w}),t(s,{options:I,value:String(P),onChange:t=>{const e=parseInt(t.target.value);Number.isNaN(e)||($(e),y?.(e))},width:"120px",padding:"4px 8px",variant:"text","aria-label":w})]}),t(o,{children:t(u,{total:Math.max(1,Math.ceil(d/P)),current:_,onChange:A,showAll:x})}),t(i,{minWidth:"180px",justifyContent:"flex-end",children:e(p,{children:[t("b",{children:Math.min(d,_*P)})," ",C," ",d]})})]})};export{x as Pagination};
|
|
2
2
|
//# sourceMappingURL=pagination.comp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.comp.js","sources":["../../../../../src/components/navigation/pagination/pagination.comp.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\n\nimport { Button } from '../../buttons'\nimport { Icon } from '../../icons'\nimport { Box } from '../../layout'\nimport { Text } from '../../typography'\n\nimport { PaginationProps } from './pagination.types'\n\nimport * as Styles from './pagination.styles'\n\nconst PaginationSpacer = () => (\n <Box padding={1} borderRadius=\"8px\">\n <Text color=\"grey_3\">...</Text>\n </Box>\n)\n\n/**\n * Números de página com setas, para navegar entre as páginas de uma lista.\n * `total` é o número de páginas. Para rodapé de tabela com itens por página e contagem use TablePagination.\n * @example <Pagination total={10} current={pagina} onChange={setPagina} />\n */\nexport const Pagination = ({\n current = 1,\n onChange,\n total,\n showAll,\n}: PaginationProps) => {\n const [page, setPage] = useState(current)\n const [pages, setPages] = useState<(number | JSX.Element)[]>([])\n\n useEffect(() => {\n const pageIsAtStart = page <= 3\n const pageIsAtEnd = page >= total - 2\n\n if (showAll || total <= 5) {\n setPages(Array.from({ length: total }, (_, i) => i + 1))\n return\n }\n\n if (pageIsAtStart) {\n setPages([1, 2, 3, 4, <PaginationSpacer />, total])\n return\n }\n if (pageIsAtEnd) {\n setPages([\n 1,\n <PaginationSpacer />,\n total - 3,\n total - 2,\n total - 1,\n total,\n ])\n return\n }\n\n setPages([\n 1,\n <PaginationSpacer />,\n page - 1,\n page,\n page + 1,\n <PaginationSpacer />,\n total,\n ])\n }, [page, total])\n\n useEffect(() => {\n setPage(current)\n }, [current])\n\n const handleChangePage = (_page: number) => {\n setPage(_page)\n onChange?.(_page)\n }\n\n const isFirstPage = page === 1\n const isLastPage = page === total\n\n return (\n <Box alignItems=\"center\" data-testid=\"pagination\">\n <Button\n disabled={isFirstPage}\n variant=\"text\"\n width=\"40px\"\n onClick={() => handleChangePage(page - 1)}\n data-testid=\"previous-button\"\n aria-label=\"Página anterior\"\n >\n <Icon\n name=\"arrow_left_s\"\n color={isFirstPage ? 'grey_4' : 'secondary'}\n size={24}\n />\n </Button>\n {pages.map((_page, index) => {\n if (typeof _page === 'number') {\n return (\n <Styles.PageButton\n key={`page-${index}`}\n type=\"button\"\n onClick={() => handleChangePage(_page)}\n $current={page === _page}\n data-testid={`page-${_page}`}\n aria-label={`Página ${_page}`}\n aria-current={page === _page ? 'page' : undefined}\n >\n <Text color={page === _page ? 'grey_1' : 'grey_3'}>{_page}</Text>\n </Styles.PageButton>\n )\n }\n return <Box key={`page-spacer-${index}`}>{_page}</Box>\n })}\n <Button\n disabled={isLastPage}\n variant=\"text\"\n width=\"40px\"\n onClick={() => handleChangePage(page + 1)}\n data-testid=\"next-button\"\n aria-label=\"Próxima página\"\n >\n <Icon\n name=\"arrow_right_s\"\n color={isLastPage ? 'grey_4' : 'secondary'}\n size={24}\n />\n </Button>\n </Box>\n )\n}\n"],"names":["PaginationSpacer","_jsx","Box","padding","borderRadius","children","Text","color","Pagination","current","onChange","total","showAll","page","setPage","useState","pages","setPages","useEffect","pageIsAtStart","pageIsAtEnd","Array","from","length","_","i","handleChangePage","_page","isFirstPage","isLastPage","_jsxs","alignItems","Button","disabled","variant","width","onClick","Icon","name","size","map","index","Styles","type","$current","undefined"],"mappings":"qXAWA,MAAMA,EAAmBA,IACvBC,EAACC,EAAG,CAACC,QAAS,EA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kB,EAExCxC,SAAAJ,EAACK,EAAI,CAACC,MAAOM,IAASc,EAAQ,SAAW,SAAQtB,SAAGsB,KARvC,QAAAc,KAYZxC,EAACC,EAAkC,CAAAG,SAAAsB,GAAV,eAAAc,OAElCxC,EAAC+B,EAAM,CACLC,SAAUJ,EACVK,QAAQ,OACRC,MAAM,OACNC,QAASA,IAAMV,EAAiBb,EAAO,GAAE,cAC7B,cAAa,aACd,iBAAgBR,SAE3BJ,EAACoC,EACC,CAAAC,KAAK,gBACL/B,MAAOsB,EAAa,SAAW,YAC/BU,KAAM,SAGN"}
|
|
1
|
+
{"version":3,"file":"pagination.comp.js","sources":["../../../../../src/components/navigation/pagination/pagination.comp.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react'\n\nimport { Button } from '../../buttons'\nimport { Select, SelectOption } from '../../forms/select'\nimport { Icon } from '../../icons'\nimport { Box } from '../../layout'\nimport { Text } from '../../typography'\n\nimport { PaginationProps } from './pagination.types'\n\nimport * as Styles from './pagination.styles'\n\nconst DEFAULT_ITEMS_PER_PAGE_OPTIONS = [10, 50, 100]\n\nconst PaginationSpacer = () => (\n <Box padding={1} borderRadius=\"8px\">\n <Text color=\"grey_3\">...</Text>\n </Box>\n)\n\ninterface PageListProps {\n total: number\n current: number\n onChange: (page: number) => void\n showAll?: boolean\n}\n\nconst PageList = ({ total, current, onChange, showAll }: PageListProps) => {\n const [page, setPage] = useState(current)\n const [pages, setPages] = useState<(number | JSX.Element)[]>([])\n\n useEffect(() => {\n const pageIsAtStart = page <= 3\n const pageIsAtEnd = page >= total - 2\n\n if (showAll || total <= 5) {\n setPages(Array.from({ length: total }, (_, i) => i + 1))\n return\n }\n\n if (pageIsAtStart) {\n setPages([1, 2, 3, 4, <PaginationSpacer />, total])\n return\n }\n if (pageIsAtEnd) {\n setPages([\n 1,\n <PaginationSpacer />,\n total - 3,\n total - 2,\n total - 1,\n total,\n ])\n return\n }\n\n setPages([\n 1,\n <PaginationSpacer />,\n page - 1,\n page,\n page + 1,\n <PaginationSpacer />,\n total,\n ])\n }, [page, total, showAll])\n\n useEffect(() => {\n setPage(current)\n }, [current])\n\n const handleChangePage = (_page: number) => {\n setPage(_page)\n onChange(_page)\n }\n\n const isFirstPage = page === 1\n const isLastPage = page === total\n\n return (\n <Box alignItems=\"center\" data-testid=\"pagination\">\n <Button\n disabled={isFirstPage}\n variant=\"text\"\n width=\"40px\"\n onClick={() => handleChangePage(page - 1)}\n data-testid=\"previous-button\"\n aria-label=\"Página anterior\"\n >\n <Icon\n name=\"arrow_left_s\"\n color={isFirstPage ? 'grey_4' : 'secondary'}\n size={24}\n />\n </Button>\n {pages.map((_page, index) => {\n if (typeof _page === 'number') {\n return (\n <Styles.PageButton\n key={`page-${index}`}\n type=\"button\"\n onClick={() => handleChangePage(_page)}\n $current={page === _page}\n data-testid={`page-${_page}`}\n aria-label={`Página ${_page}`}\n aria-current={page === _page ? 'page' : undefined}\n >\n <Text color={page === _page ? 'grey_1' : 'grey_3'}>{_page}</Text>\n </Styles.PageButton>\n )\n }\n return <Box key={`page-spacer-${index}`}>{_page}</Box>\n })}\n <Button\n disabled={isLastPage}\n variant=\"text\"\n width=\"40px\"\n onClick={() => handleChangePage(page + 1)}\n data-testid=\"next-button\"\n aria-label=\"Próxima página\"\n >\n <Icon\n name=\"arrow_right_s\"\n color={isLastPage ? 'grey_4' : 'secondary'}\n size={24}\n />\n </Button>\n </Box>\n )\n}\n\n/**\n * Paginação de listas e tabelas. Um componente só, em duas formas:\n * - com `total` (número de páginas): só as setas e os números de página;\n * - com `totalItems` (número de itens): o rodapé completo de tabela, com itens por página,\n * páginas e a contagem (\"20 de 78\"). As páginas saem de `totalItems` e `itemsPerPage`.\n * Os textos (`viewText`, `itemsText`, `ofText`) podem ser traduzidos.\n * @example <Pagination total={10} current={pagina} onChange={setPagina} />\n * @example <Pagination totalItems={240} onChange={setPagina} onChangeItemsPerPage={setPorPagina} />\n */\nexport const Pagination = ({\n total,\n totalItems,\n current = 1,\n onChange,\n showAll,\n itemsPerPage = 10,\n itemsPerPageOptions = DEFAULT_ITEMS_PER_PAGE_OPTIONS,\n onChangeItemsPerPage,\n viewText = 'Visualizar',\n itemsText = 'itens',\n ofText = 'de',\n}: PaginationProps) => {\n const [page, setPage] = useState(current)\n const [perPage, setPerPage] = useState(itemsPerPage)\n\n useEffect(() => {\n setPage(current)\n }, [current])\n\n useEffect(() => {\n setPerPage(itemsPerPage)\n }, [itemsPerPage])\n\n const quantityOptions: SelectOption[] = useMemo(\n () =>\n itemsPerPageOptions.map((quantity) => ({\n label: `${quantity} ${itemsText}`,\n value: String(quantity),\n })),\n [itemsPerPageOptions, itemsText],\n )\n\n const handleChangePage = (next: number) => {\n setPage(next)\n onChange?.(next)\n }\n\n if (totalItems === undefined) {\n return (\n <PageList\n total={Math.max(1, total ?? 1)}\n current={page}\n onChange={handleChangePage}\n showAll={showAll}\n />\n )\n }\n\n const handleChangePerPage = (e: React.ChangeEvent<HTMLInputElement>) => {\n const next = parseInt(e.target.value)\n if (Number.isNaN(next)) return\n setPerPage(next)\n onChangeItemsPerPage?.(next)\n }\n\n return (\n <Box\n width=\"100%\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n flexWrap=\"wrap\"\n position=\"relative\"\n data-testid=\"pagination-footer\"\n >\n <Styles.SideBox gap={1} alignItems=\"center\" minWidth=\"180px\">\n <Text color=\"grey_3\" size=\"small\">\n {viewText}\n </Text>\n <Select\n options={quantityOptions}\n value={String(perPage)}\n onChange={handleChangePerPage}\n width=\"120px\"\n padding=\"4px 8px\"\n variant=\"text\"\n aria-label={viewText}\n />\n </Styles.SideBox>\n\n <Styles.CenterBox>\n <PageList\n total={Math.max(1, Math.ceil(totalItems / perPage))}\n current={page}\n onChange={handleChangePage}\n showAll={showAll}\n />\n </Styles.CenterBox>\n\n <Styles.SideBox minWidth=\"180px\" justifyContent=\"flex-end\">\n <Text>\n <b>{Math.min(totalItems, page * perPage)}</b> {ofText} {totalItems}\n </Text>\n </Styles.SideBox>\n </Box>\n )\n}\n"],"names":["DEFAULT_ITEMS_PER_PAGE_OPTIONS","PaginationSpacer","_jsx","Box","padding","borderRadius","children","Text","color","PageList","total","current","onChange","showAll","page","setPage","useState","pages","setPages","useEffect","pageIsAtStart","pageIsAtEnd","Array","from","length","_","i","handleChangePage","_page","isFirstPage","isLastPage","_jsxs","alignItems","Button","disabled","variant","width","onClick","Icon","name","size","map","index","Styles","type","$current","undefined","Pagination","totalItems","itemsPerPage","itemsPerPageOptions","onChangeItemsPerPage","viewText","itemsText","ofText","perPage","setPerPage","quantityOptions","useMemo","quantity","label","value","String","next","Math","max","justifyContent","flexWrap","position","gap","minWidth","Select","options","e","parseInt","target","Number","isNaN","ceil","min"],"mappings":"ydAYA,MAAMA,EAAiC,CAAC,GAAI,GAAI,KAE1CC,EAAmBA,IACvBC,EAACC,EAAG,CAACC,QAAS,EAAGC,aAAa,MAC5BC,SAAAJ,EAACK,EAAI,CAACC,MAAM,SAAQF,SAAA,UAWlBG,EAAWA,EAAGC,QAAOC,UAASC,WAAUC,cAC5C,MAAOC,EAAMC,GAAWC,EAASL,IAC1BM,EAAOC,GAAYF,EAAmC,IAE7DG,GAAU,KACR,MAAMC,EAAgBN,GAAQ,EACxBO,EAAcP,GAAQJ,EAAQ,EAGlCQ,EADEL,GAAWH,GAAS,EACbY,MAAMC,KAAK,CAAEC,OAAQd,IAAS,CAACe,EAAGC,IAAMA,EAAI,IAInDN,EACO,CAAC,EAAG,EAAG,EAAG,EAAGlB,EAACD,EAAgB,CAAA,GAAKS,GAG1CW,EACO,CACP,EACAnB,EAACD,EAAmB,CAAA,GACpBS,EAAQ,EACRA,EAAQ,EACRA,EAAQ,EACRA,GAKK,CACP,EACAR,EAACD,EAAmB,CAAA,GACpBa,EAAO,EACPA,EACAA,EAAO,EACPZ,EAACD,EAAmB,CAAA,GACpBS,GACA,GACD,CAACI,EAAMJ,EAAOG,IAEjBM,GAAU,KACRJ,EAAQJ,EAAQ,GACf,CAACA,IAE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GACtC,IACER,EAAoBT,KAAKkB,IAAc,CACrCC,MAAO,GAAGD,KAAYN,IACtBQ,MAAOC,OAAOH,QAElB,CAACT,EAAqBG,IAGlB1B,EAAoBoC,IACxBhD,EAAQgD,GACRnD,IAAWmD,EAAK,EAGlB,QAAmBjB,IAAfE,EACF,OACE9C,EAACO,EAAQ,CACPC,MAAOsD,KAAKC,IAAI,EAAGvD,GAAS,GAC5BC,QAASG,EACTF,SAAUe,EACVd,QAASA,IAYf,OACEkB,EAAC5B,EACC,CAAAiC,MAAM,OACN8B,eAAe,gBACflC,WAAW,SACXmC,SAAS,OACTC,SAAS,WAAU,cACP,oBAAmB9D,SAAA,CAE/ByB,EAACY,EAAc,CAAC0B,IAAK,EAAGrC,WAAW,SAASsC,SAAS,kBACnDpE,EAACK,EAAK,CAAAC,MAAM,SAASgC,KAAK,QACvBlC,SAAA8C,IAEHlD,EAACqE,EACC,CAAAC,QAASf,EACTI,MAAOC,OAAOP,GACd3C,SAvBqB6D,IAC3B,MAAMV,EAAOW,SAASD,EAAEE,OAAOd,OAC3Be,OAAOC,MAAMd,KACjBP,EAAWO,GACXZ,IAAuBY,GAAK,EAoBtB3B,MAAM,QACNhC,QAAQ,UACR+B,QAAQ,OACI,aAAAiB,OAIhBlD,EAACyC,YACCzC,EAACO,GACCC,MAAOsD,KAAKC,IAAI,EAAGD,KAAKc,KAAK9B,EAAaO,IAC1C5C,QAASG,EACTF,SAAUe,EACVd,QAASA,MAIbX,EAACyC,EAAc,CAAC2B,SAAS,QAAQJ,eAAe,WAAU5D,SACxDyB,EAACxB,EAAI,CAAAD,SAAA,CACHJ,EAAI,IAAA,CAAAI,SAAA0D,KAAKe,IAAI/B,EAAYlC,EAAOyC,KAAa,IAAED,EAAS,IAAAN,SAGxD"}
|
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
import{styled as
|
|
1
|
+
import{styled as o}from"styled-components";import{media as e}from"../../../theme/media.js";import{Box as t}from"../../layout/box/box.comp.js";const r=o.button`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: none;
|
|
4
4
|
align-items: center;
|
|
5
5
|
justify-content: center;
|
|
6
6
|
width: 40px;
|
|
7
7
|
height: 40px;
|
|
8
|
-
padding: ${({theme:
|
|
8
|
+
padding: ${({theme:o})=>o.spacing[1]};
|
|
9
9
|
border: none;
|
|
10
|
-
border-radius: ${({theme:
|
|
11
|
-
background-color: ${({$current:
|
|
10
|
+
border-radius: ${({theme:o})=>o.radius.md};
|
|
11
|
+
background-color: ${({$current:o,theme:e})=>o?e.colors.grey_5:e.colors.white};
|
|
12
12
|
font: inherit;
|
|
13
13
|
cursor: pointer;
|
|
14
14
|
|
|
15
15
|
&:focus-visible {
|
|
16
|
-
outline: 2px solid ${({theme:
|
|
16
|
+
outline: 2px solid ${({theme:o})=>o.colors.border.focus};
|
|
17
17
|
outline-offset: 1px;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
`,n=o(t)`
|
|
20
|
+
${e.down("md")} {
|
|
21
|
+
order: 1;
|
|
22
|
+
min-width: auto;
|
|
23
|
+
}
|
|
24
|
+
`,i=o(t)`
|
|
25
|
+
${e.down("md")} {
|
|
26
|
+
width: 100%;
|
|
27
|
+
order: 2;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
}
|
|
30
|
+
`;export{i as CenterBox,r as PageButton,n as SideBox};
|
|
20
31
|
//# sourceMappingURL=pagination.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.styles.js","sources":["../../../../../src/components/navigation/pagination/pagination.styles.tsx"],"sourcesContent":["import { styled } from 'styled-components'\n\nexport const PageButton = styled.button<{ $current: boolean }>`\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n padding: ${({ theme }) => theme.spacing[1]};\n border: none;\n border-radius: ${({ theme }) => theme.radius.md};\n background-color: ${({ $current, theme }) =>\n $current ? theme.colors.grey_5 : theme.colors.white};\n font: inherit;\n cursor: pointer;\n\n &:focus-visible {\n outline: 2px solid ${({ theme }) => theme.colors.border.focus};\n outline-offset: 1px;\n }\n`\n"],"names":["PageButton","styled","button","theme","spacing","radius","md","$current","colors","grey_5","white","border","focus"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pagination.styles.js","sources":["../../../../../src/components/navigation/pagination/pagination.styles.tsx"],"sourcesContent":["import { styled } from 'styled-components'\n\nimport { media } from '../../../theme'\nimport { Box } from '../../layout'\n\nexport const PageButton = styled.button<{ $current: boolean }>`\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n padding: ${({ theme }) => theme.spacing[1]};\n border: none;\n border-radius: ${({ theme }) => theme.radius.md};\n background-color: ${({ $current, theme }) =>\n $current ? theme.colors.grey_5 : theme.colors.white};\n font: inherit;\n cursor: pointer;\n\n &:focus-visible {\n outline: 2px solid ${({ theme }) => theme.colors.border.focus};\n outline-offset: 1px;\n }\n`\n\nexport const SideBox = styled(Box)`\n ${media.down('md')} {\n order: 1;\n min-width: auto;\n }\n`\n\nexport const CenterBox = styled(Box)`\n ${media.down('md')} {\n width: 100%;\n order: 2;\n justify-content: center;\n }\n`\n"],"names":["PageButton","styled","button","theme","spacing","radius","md","$current","colors","grey_5","white","border","focus","SideBox","Box","media","down","CenterBox"],"mappings":"8IAKaA,MAAAA,EAAaC,EAAOC,MAA6B;;;;;;;aAOjD,EAAGC,WAAYA,EAAMC,QAAQ;;mBAEvB,EAAGD,WAAYA,EAAME,OAAOC;sBACzB,EAAGC,WAAUJ,WAC/BI,EAAWJ,EAAMK,OAAOC,OAASN,EAAMK,OAAOE;;;;;yBAKzB,EAAGP,WAAYA,EAAMK,OAAOG,OAAOC;;;EAK/CC,EAAUZ,EAAOa,EAAI;IAC9BC,EAAMC,KAAK;;;;EAMFC,EAAYhB,EAAOa,EAAI;IAChCC,EAAMC,KAAK;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{Pagination as o}from"../pagination/pagination.comp.js";const a=({total:a,...i})=>t(o,{totalItems:a,...i});export{a as TablePagination};
|
|
2
2
|
//# sourceMappingURL=table-pagination.comp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-pagination.comp.js","sources":["../../../../../src/components/navigation/table-pagination/table-pagination.comp.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"table-pagination.comp.js","sources":["../../../../../src/components/navigation/table-pagination/table-pagination.comp.tsx"],"sourcesContent":["import { Pagination } from '../pagination/pagination.comp'\n\nimport { TablePaginationProps } from './table-pagination.types'\n\n/**\n * Rodapé de tabela da v1. É o próprio `Pagination` com `totalItems`.\n * @deprecated Use `<Pagination totalItems={...} />`.\n * @example <Pagination totalItems={240} onChange={setPagina} onChangeItemsPerPage={setPorPagina} />\n */\nexport const TablePagination = ({ total, ...rest }: TablePaginationProps) => (\n <Pagination totalItems={total} {...rest} />\n)\n"],"names":["TablePagination","total","rest","_jsx","Pagination","totalItems"],"mappings":"sGASO,MAAMA,EAAkBA,EAAGC,WAAUC,KAC1CC,EAACC,EAAW,CAAAC,WAAYJ,KAAWC"}
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("styled-components"),o=require("../../../theme/media.js"),t=require("../../layout/box/box.comp.js");const r=e.styled(t.Box)`
|
|
2
|
-
${o.media.down("md")} {
|
|
3
|
-
order: 1;
|
|
4
|
-
min-width: auto;
|
|
5
|
-
}
|
|
6
|
-
`,d=e.styled(t.Box)`
|
|
7
|
-
${o.media.down("md")} {
|
|
8
|
-
width: 100%;
|
|
9
|
-
order: 2;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
}
|
|
12
|
-
`;exports.CenterBox=d,exports.SideBox=r;
|
|
13
|
-
//# sourceMappingURL=table-pagination.styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table-pagination.styles.js","sources":["../../../../../src/components/navigation/table-pagination/table-pagination.styles.tsx"],"sourcesContent":["import { styled } from 'styled-components'\n\nimport { media } from '../../../theme'\nimport { Box } from '../../layout'\n\nexport const SideBox = styled(Box)`\n ${media.down('md')} {\n order: 1;\n min-width: auto;\n }\n`\n\nexport const CenterBox = styled(Box)`\n ${media.down('md')} {\n width: 100%;\n order: 2;\n justify-content: center;\n }\n`\n"],"names":["SideBox","styled","Box","media","down","CenterBox"],"mappings":"qIAKaA,EAAUC,EAAAA,OAAOC,EAAAA,IAAI;IAC9BC,EAAKA,MAACC,KAAK;;;;EAMFC,EAAYJ,EAAAA,OAAOC,EAAAA,IAAI;IAChCC,EAAKA,MAACC,KAAK;;;;;"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{styled as o}from"styled-components";import{media as t}from"../../../theme/media.js";import{Box as m}from"../../layout/box/box.comp.js";const r=o(m)`
|
|
2
|
-
${t.down("md")} {
|
|
3
|
-
order: 1;
|
|
4
|
-
min-width: auto;
|
|
5
|
-
}
|
|
6
|
-
`,e=o(m)`
|
|
7
|
-
${t.down("md")} {
|
|
8
|
-
width: 100%;
|
|
9
|
-
order: 2;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
}
|
|
12
|
-
`;export{e as CenterBox,r as SideBox};
|
|
13
|
-
//# sourceMappingURL=table-pagination.styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table-pagination.styles.js","sources":["../../../../../src/components/navigation/table-pagination/table-pagination.styles.tsx"],"sourcesContent":["import { styled } from 'styled-components'\n\nimport { media } from '../../../theme'\nimport { Box } from '../../layout'\n\nexport const SideBox = styled(Box)`\n ${media.down('md')} {\n order: 1;\n min-width: auto;\n }\n`\n\nexport const CenterBox = styled(Box)`\n ${media.down('md')} {\n width: 100%;\n order: 2;\n justify-content: center;\n }\n`\n"],"names":["SideBox","styled","Box","media","down","CenterBox"],"mappings":"oJAKaA,EAAUC,EAAOC,EAAI;IAC9BC,EAAMC,KAAK;;;;EAMFC,EAAYJ,EAAOC,EAAI;IAChCC,EAAMC,KAAK;;;;;"}
|