tycho-components 0.0.17-SNAPSHOT-5 → 0.0.17-SNAPSHOT-7

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.
@@ -5,6 +5,7 @@ type Props<TData> = {
5
5
  pagination: PaginationState;
6
6
  setPagination: (p: PaginationState) => void;
7
7
  hideItensPage?: boolean;
8
+ numItens?: number[];
8
9
  };
9
- export default function AppPagination<TData>({ totalElements, pagination, setPagination, hideItensPage, }: Props<TData>): import("react/jsx-runtime").JSX.Element;
10
+ export default function AppPagination<TData>({ totalElements, pagination, setPagination, hideItensPage, numItens, }: Props<TData>): import("react/jsx-runtime").JSX.Element;
10
11
  export {};
@@ -3,7 +3,7 @@ import { Select, MenuItem } from '@mui/material';
3
3
  import { Trans, useTranslation } from 'react-i18next';
4
4
  import { IconButton } from 'tycho-storybook';
5
5
  import './styles.scss';
6
- export default function AppPagination({ totalElements, pagination, setPagination, hideItensPage, }) {
6
+ export default function AppPagination({ totalElements, pagination, setPagination, hideItensPage, numItens = [10, 25, 50], }) {
7
7
  const { t } = useTranslation('common');
8
8
  const numPages = Math.ceil(totalElements / pagination.pageSize);
9
9
  const currentPage = pagination.pageIndex + 1;
@@ -15,7 +15,7 @@ export default function AppPagination({ totalElements, pagination, setPagination
15
15
  const setPageIndex = (p) => {
16
16
  setPagination({ ...pagination, pageIndex: p });
17
17
  };
18
- return (_jsxs("div", { className: "app-table-pagination", children: [!hideItensPage && (_jsxs("div", { className: "itens-page", children: [_jsx("span", { children: t('table.label.rows-page') }), _jsx(Select, { value: pagination.pageSize, onChange: (e) => setPageSize(e.target.value), MenuProps: menuProps, children: [10, 25, 50].map((size) => (_jsx(MenuItem, { value: size, children: size }, size))) })] })), _jsx("div", { className: "itens-total", children: _jsx("span", { children: _jsx(Trans, { t: t, i18nKey: "table.label.items", values: {
18
+ return (_jsxs("div", { className: "app-table-pagination", children: [!hideItensPage && (_jsxs("div", { className: "itens-page", children: [_jsx("span", { children: t('table.label.rows-page') }), _jsx(Select, { value: pagination.pageSize, onChange: (e) => setPageSize(e.target.value), MenuProps: menuProps, children: numItens.map((size) => (_jsx(MenuItem, { value: size, children: size }, size))) })] })), _jsx("div", { className: "itens-total", children: _jsx("span", { children: _jsx(Trans, { t: t, i18nKey: "table.label.items", values: {
19
19
  first: getFirstElementNumber(),
20
20
  last: getLastElementNumber(),
21
21
  total: totalElements,
@@ -24,7 +24,31 @@ export default function AppPagination({ totalElements, pagination, setPagination
24
24
  const menuProps = {
25
25
  PaperProps: {
26
26
  style: {
27
- maxHeight: 400,
27
+ maxHeight: 200,
28
28
  },
29
29
  },
30
+ anchorOrigin: {
31
+ vertical: 'top',
32
+ horizontal: 'left',
33
+ },
34
+ transformOrigin: {
35
+ vertical: 'bottom',
36
+ horizontal: 'left',
37
+ },
38
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
39
+ // @ts-expect-error -- PopperProps is not typed but works at runtime
40
+ PopperProps: {
41
+ modifiers: [
42
+ {
43
+ name: 'flip',
44
+ enabled: false,
45
+ },
46
+ {
47
+ name: 'offset',
48
+ options: {
49
+ offset: [0, -4],
50
+ },
51
+ },
52
+ ],
53
+ },
30
54
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.0.17-SNAPSHOT-5",
4
+ "version": "0.0.17-SNAPSHOT-7",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {