@woovi/ui 6.8.27 → 6.9.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/dist/llms.txt CHANGED
@@ -1049,6 +1049,85 @@ import {
1049
1049
  - TableToggleViewModel: https://storybook.woovi.design/?path=/docs/components-table-tabletoggleviewmodel--docs
1050
1050
  - TablePixEMV: https://storybook.woovi.design/?path=/docs/components-table-tablepixemv--docs
1051
1051
 
1052
+ ## MuiTable
1053
+
1054
+ Tabela MUI com paginação, seleção de linhas e multiplos tipos de celula. Substitui o pacote `@woovi/table` (descontinuado). Use com `useRelayPagination` de `@woovi/hooks` para consumers Relay.
1055
+
1056
+ ```tsx
1057
+ import { Table, TableRelayPagination, CELL_TYPES, useTableProps } from '@woovi/ui';
1058
+ import type { TableColumn } from '@woovi/ui';
1059
+ import { useRelayPagination } from '@woovi/hooks';
1060
+
1061
+ // Definicao de colunas
1062
+ const columns: TableColumn<User>[] = [
1063
+ { property: 'name', type: CELL_TYPES.STRING, header: { label: 'Nome' } },
1064
+ { property: 'email', type: CELL_TYPES.STRING, header: { label: 'E-mail' } },
1065
+ { property: 'amount', type: CELL_TYPES.CURRENCY, header: { label: 'Saldo' } },
1066
+ { property: 'createdAt', type: CELL_TYPES.DATETIME, header: { label: 'Data' } },
1067
+ // Renderizacao customizada
1068
+ {
1069
+ property: 'status',
1070
+ header: { label: 'Status' },
1071
+ renderRow: (value) => <StatusChip status={value} />,
1072
+ },
1073
+ // Link para rota interna
1074
+ {
1075
+ property: 'id',
1076
+ type: CELL_TYPES.LINK,
1077
+ header: { label: 'ID' },
1078
+ getClickPath: (value) => `/transactions/${value}`,
1079
+ },
1080
+ // Menu de acoes
1081
+ {
1082
+ property: 'id',
1083
+ type: CELL_TYPES.ACTIONS,
1084
+ header: { label: '' },
1085
+ actions: [
1086
+ { label: 'Editar', action: (row) => handleEdit(row) },
1087
+ { label: 'Excluir', action: (row) => handleDelete(row) },
1088
+ ],
1089
+ },
1090
+ ];
1091
+
1092
+ // Table simples (dados em memoria)
1093
+ const { isLoading, quantityPerPage, setQuantityPerPage } = useTableProps();
1094
+ <Table
1095
+ columns={columns}
1096
+ rows={users}
1097
+ isLoading={isLoading}
1098
+ emptyMessage="Nenhum resultado encontrado"
1099
+ rowsPerPage={quantityPerPage}
1100
+ totalItems={users.length}
1101
+ firstItemIndex={0}
1102
+ lastItemIndex={users.length}
1103
+ handleRowsPerPageChange={setQuantityPerPage}
1104
+ handlePageChange={() => {}}
1105
+ isSelectable={false}
1106
+ isRowClickEnabled={() => false}
1107
+ fixedHeader={false}
1108
+ height="auto"
1109
+ onSelectedRowsChange={() => {}}
1110
+ onRowCheck={() => {}}
1111
+ onSelectAllCheck={() => {}}
1112
+ selectedRows={[]}
1113
+ />
1114
+
1115
+ // TableRelayPagination — consumer Relay com useRelayPagination
1116
+ const { edges, paginationProps } = useRelayPagination({ connection, relay });
1117
+ <TableRelayPagination
1118
+ columns={columns}
1119
+ edges={edges}
1120
+ isLoading={isLoading}
1121
+ emptyMessage="Nenhum resultado"
1122
+ {...paginationProps}
1123
+ />
1124
+ ```
1125
+
1126
+ Tipos de célula disponíveis em CELL_TYPES: STRING, CURRENCY, DATE, TIME, DATETIME, LINK, ICON, ACTIONS, CHECKBOX, EDITABLE, TAG. Use `renderRow` para renderização JSX customizada em qualquer coluna.
1127
+
1128
+ - Table: https://storybook.woovi.design/?path=/docs/components-muitable-table--docs
1129
+ - TableRelayPagination: https://storybook.woovi.design/?path=/docs/components-muitable-table--relay-pagination
1130
+
1052
1131
  ## Tag
1053
1132
 
1054
1133
  Componentes de tag e status.
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { NodeT, TableColumn } from './Table.tsx';
3
+ type Props<T> = {
4
+ emptyMessage: string;
5
+ isSelectable: boolean;
6
+ isRowSelected: (row: NodeT<T>) => boolean;
7
+ isRowDisabled?: (row: NodeT<T>) => boolean;
8
+ onRowCheck: (row: NodeT<T>, checked: boolean) => void;
9
+ onRowClick: (row: NodeT<T>) => void;
10
+ isRowClickEnabled: (row: NodeT<T>) => boolean;
11
+ rows: NodeT<T>[];
12
+ columns: TableColumn<T>[];
13
+ extraRow?: any[];
14
+ };
15
+ declare const TableBody: <T extends object>(props: Props<T>) => ReactNode;
16
+ export default TableBody;
@@ -0,0 +1,9 @@
1
+ type Props = {
2
+ rowsPerPage: number;
3
+ firstItemIndex: number;
4
+ totalItems: number;
5
+ handlePageChange: (state: boolean) => void;
6
+ handleRowsPerPageChange: (value: number) => void;
7
+ };
8
+ declare const TableFooter: (props: Props) => import("react/jsx-runtime").JSX.Element;
9
+ export default TableFooter;
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { NodeT, TableColumn } from './Table.tsx';
3
+ type Props<T> = {
4
+ selectedRows: NodeT<T>[];
5
+ rows: NodeT<T>[];
6
+ columns: TableColumn<T>[];
7
+ onSelectAllCheck: (rows: NodeT<T>[]) => void;
8
+ isSelectable: boolean;
9
+ };
10
+ declare const TableHeader: <T extends object>(props: Props<T>) => ReactNode;
11
+ export default TableHeader;
@@ -0,0 +1,85 @@
1
+ import type { TableProps } from '@mui/material/Table';
2
+ import type { ReactNode } from 'react';
3
+ export type NodeT<T> = {
4
+ id?: string;
5
+ } & T;
6
+ export type Edge<T> = {
7
+ node: NodeT<T>;
8
+ };
9
+ export type Action<T> = {
10
+ label: string;
11
+ disabled?: boolean;
12
+ action: (row: T) => void;
13
+ };
14
+ export type Sort<T> = {
15
+ order: 'desc' | 'asc' | undefined;
16
+ orderBy: string;
17
+ onSort: (column: TableColumn<T>) => void;
18
+ };
19
+ export type TableColumn<T> = {
20
+ property: string | ((row: NodeT<T>) => string);
21
+ header?: {
22
+ label: string;
23
+ icon?: string;
24
+ type?: string;
25
+ onChange?: (value: string, row: NodeT<T>) => void;
26
+ };
27
+ onChange?: (value: string, row: NodeT<T>) => void;
28
+ icon?: string | ((row: T) => string);
29
+ rightIcon?: string | ((row: T) => string);
30
+ type?: string;
31
+ clickPath?: string | ((row: T) => string);
32
+ renderRow?: (value: string, row: NodeT<T>) => any;
33
+ onClick?: (row: T, rowIndex?: number) => void;
34
+ actions?: Action<T>[] | ((row: T) => Action<T>[]);
35
+ shouldShowRow?: (row: T, column: TableColumn<T>) => boolean;
36
+ minWidth?: number;
37
+ value?: string;
38
+ cellProps?: Record<string, unknown>;
39
+ sort?: Sort<T>;
40
+ isColumnChecked?: (row: T) => boolean;
41
+ onColumnCheck?: (row: T) => void;
42
+ isColumnDisabled?: (row: T) => boolean;
43
+ route?: {
44
+ value: string;
45
+ params: Record<string, unknown>;
46
+ };
47
+ format?: string;
48
+ getClickPath?: (value: any, row: NodeT<T>) => string | undefined;
49
+ };
50
+ export type TableColumns<T> = TableColumn<T>[];
51
+ export type Props<T> = {
52
+ onRowClick?: (row: T) => void;
53
+ isRowClickEnabled: (row: T) => boolean;
54
+ columns: TableColumn<T>[];
55
+ rows: NodeT<T>[];
56
+ height: string;
57
+ hideFooter?: boolean;
58
+ fixedHeader: boolean;
59
+ isLoading?: boolean;
60
+ emptyMessage: string;
61
+ handleRowsPerPageChange: (quantity: number) => void;
62
+ rowsPerPage: number;
63
+ totalItems: number;
64
+ firstItemIndex: number;
65
+ lastItemIndex: number;
66
+ handlePageChange: (isForward: boolean) => void;
67
+ isSelectable: boolean;
68
+ onSelectedRowsChange: (selectedRows: NodeT<T>[]) => void;
69
+ onRowCheck: (row: T, checkedState: boolean) => void;
70
+ onSelectAllCheck: (selectedRows: NodeT<T>[]) => void;
71
+ selectedRows: T[];
72
+ isRowSelected?: (row: T) => boolean;
73
+ handleLoading?: (value: boolean, callback: () => void) => void;
74
+ setIsLoading?: (value: boolean) => void;
75
+ currentSort?: any;
76
+ onSort?: (column: TableColumn<T>) => void;
77
+ showCheckbox?: boolean;
78
+ sortColumns?: string[];
79
+ columnsNames?: string[];
80
+ hasPreviousPage?: boolean;
81
+ hasNextPage?: boolean;
82
+ staticContext?: any;
83
+ } & TableProps;
84
+ declare const Table: <T extends object>(props: Props<T>) => ReactNode;
85
+ export default Table;
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { Edge, Props as TableProps } from './Table.tsx';
3
+ export type TableRelayPaginationProps<T extends object> = {
4
+ edges: Edge<T>[];
5
+ } & Omit<TableProps<T>, 'rows'>;
6
+ declare const TableRelayPagination: <T extends object>({ edges, columns, ...props }: TableRelayPaginationProps<T>) => ReactNode;
7
+ export default TableRelayPagination;
@@ -0,0 +1,12 @@
1
+ import type { TableCellProps } from '@mui/material/TableCell';
2
+ import type { ReactNode } from 'react';
3
+ import type { TableColumn } from '../Table.tsx';
4
+ type Props<T> = Omit<TableCellProps, 'onClick'> & {
5
+ onClick?: any;
6
+ column: TableColumn<T>;
7
+ cellProps?: Record<string, any>;
8
+ children: React.ReactNode;
9
+ staticContext?: any;
10
+ };
11
+ declare const Cell: <T extends object>(props: Props<T>) => ReactNode;
12
+ export default Cell;
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { NodeT, TableColumn } from '../Table.tsx';
3
+ type Props<T> = {
4
+ column?: TableColumn<T>;
5
+ row?: NodeT<T>;
6
+ cellProps?: Record<string, any>;
7
+ checked?: boolean;
8
+ indeterminate?: boolean;
9
+ onChange: () => void;
10
+ indeterminateIcon?: React.ReactNode;
11
+ checkedIcon?: React.ReactNode;
12
+ icon?: React.ReactNode;
13
+ disabled?: boolean;
14
+ dataTestID?: string;
15
+ };
16
+ declare const CellCheckbox: <T extends object>(props: Props<T>) => ReactNode;
17
+ export default CellCheckbox;
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { NodeT, TableColumn } from '../Table.tsx';
3
+ type Props<T> = {
4
+ column: TableColumn<T>;
5
+ row: NodeT<T>;
6
+ onClick?: () => void;
7
+ cellProps?: Record<string, any>;
8
+ };
9
+ declare const CellCurrency: <T extends Record<string, unknown>>(props: Props<T>) => ReactNode;
10
+ export default CellCurrency;
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { NodeT, TableColumn } from '../Table.tsx';
3
+ type Props<T> = {
4
+ column: TableColumn<T>;
5
+ row: NodeT<T>;
6
+ cellProps?: Record<string, any>;
7
+ onClick?: () => void;
8
+ };
9
+ declare const CellCustom: <T extends object>(props: Props<T>) => ReactNode;
10
+ export default CellCustom;
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { NodeT, TableColumn } from '../Table.tsx';
3
+ type Props<T> = {
4
+ column: TableColumn<T>;
5
+ row: NodeT<T>;
6
+ onClick?: () => void;
7
+ cellProps?: Record<string, any>;
8
+ };
9
+ declare const CellDate: <T extends Record<string, unknown>>(props: Props<T>) => ReactNode;
10
+ export default CellDate;
@@ -0,0 +1,11 @@
1
+ import type { NodeT, TableColumn } from '../Table.tsx';
2
+ type Props<T> = {
3
+ column?: TableColumn<T>;
4
+ row?: NodeT<T>;
5
+ onChange: (value: string, row: NodeT<T>) => void;
6
+ cellProps?: Record<string, any>;
7
+ header?: boolean;
8
+ value?: string;
9
+ };
10
+ declare const CellEditable: <T extends object>(props: Props<T>) => import("react/jsx-runtime").JSX.Element;
11
+ export default CellEditable;
@@ -0,0 +1,8 @@
1
+ import type { NodeT, TableColumn } from '../Table.tsx';
2
+ type Props<T> = {
3
+ column: TableColumn<T>;
4
+ row: NodeT<T>;
5
+ cellProps?: Record<string, any>;
6
+ };
7
+ declare const CellIcon: <T extends object>(props: Props<T>) => import("react/jsx-runtime").JSX.Element;
8
+ export default CellIcon;
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { NodeT, TableColumn } from '../Table.tsx';
3
+ type Props<T> = {
4
+ column: TableColumn<T>;
5
+ row: NodeT<T>;
6
+ cellProps?: Record<string, unknown>;
7
+ onClick?: () => void;
8
+ };
9
+ declare const CellLink: <T extends object>(props: Props<T>) => ReactNode;
10
+ export default CellLink;
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { NodeT, TableColumn } from '../Table.tsx';
3
+ type Props<T> = {
4
+ column: TableColumn<T>;
5
+ row: NodeT<T>;
6
+ cellProps?: {
7
+ onClick?: any;
8
+ [key: string]: any;
9
+ };
10
+ };
11
+ declare const CellString: <T extends object>(props: Props<T>) => ReactNode;
12
+ export default CellString;
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { NodeT, TableColumn } from '../Table.tsx';
3
+ type Props<T> = {
4
+ column: TableColumn<T>;
5
+ row: NodeT<T>;
6
+ onClick?: () => void;
7
+ };
8
+ declare const CellTags: <T extends {
9
+ tags?: string[];
10
+ }>(props: Props<T>) => ReactNode;
11
+ export default CellTags;
@@ -0,0 +1,12 @@
1
+ import type { NodeT, TableColumn } from '../Table.tsx';
2
+ type Row = NodeT<{
3
+ emptyMessage?: string;
4
+ tags?: string[];
5
+ }> & Record<string, any>;
6
+ type CellProps = {
7
+ row: Row;
8
+ column: TableColumn<Row>;
9
+ cellProps: Record<string, unknown>;
10
+ };
11
+ declare const RenderCell: (props: CellProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default RenderCell;
@@ -0,0 +1,15 @@
1
+ declare const CELL_TYPES: {
2
+ TIME: string;
3
+ DATE: string;
4
+ DATETIME: string;
5
+ EMPTY: string;
6
+ STRING: string;
7
+ ICON: string;
8
+ ACTIONS: string;
9
+ CHECKBOX: string;
10
+ EDITABLE: string;
11
+ LINK: string;
12
+ CURRENCY: string;
13
+ TAG: string;
14
+ };
15
+ export default CELL_TYPES;
@@ -0,0 +1,8 @@
1
+ export { default as CellString } from './CellString.tsx';
2
+ export { default as CellCheckbox } from './CellCheckbox.tsx';
3
+ export { default as CellCustom } from './CellCustom.tsx';
4
+ export { default as CellDate } from './CellDate.tsx';
5
+ export { default as CellIcon } from './CellIcon.tsx';
6
+ export { default as CellEditable } from './CellEditable.tsx';
7
+ export { default as CellLink } from './CellLink.tsx';
8
+ export { default as CELL_TYPES } from './cellTypes.ts';
@@ -0,0 +1,7 @@
1
+ export declare const useTableProps: () => {
2
+ isLoading: boolean;
3
+ setIsLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
4
+ quantityPerPage: number;
5
+ setQuantityPerPage: import("react").Dispatch<import("react").SetStateAction<number>>;
6
+ handleLoading: (value: boolean, callback: () => void) => void;
7
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@woovi/ui",
3
3
  "description": "Woovi UI component library",
4
- "version": "6.8.27",
4
+ "version": "6.9.0",
5
5
  "packageManager": "pnpm@10.28.1",
6
6
  "author": "Woovi",
7
7
  "dependencies": {
@@ -14,12 +14,13 @@
14
14
  "@mui/x-data-grid-pro": "8.27.1",
15
15
  "@mui/x-license": "^8.26.0",
16
16
  "@tanstack/react-virtual": "3.13.18",
17
- "@woovi-private/release": "^1.0.0",
17
+ "@woovi-private/release": "^1.1.0",
18
18
  "brazilian-values": "0.13.1",
19
19
  "dot-object": "2.1.5",
20
20
  "formik": "3.0.0-next.6",
21
21
  "i18next": "^23.16.5",
22
22
  "i18next-browser-languagedetector": "8.2.1",
23
+ "lodash": "^4.17.21",
23
24
  "libphonenumber-js": "1.12.36",
24
25
  "mime-types": "3.0.2",
25
26
  "moment": "2.30.1",
@@ -43,8 +44,8 @@
43
44
  "zx": "^8.8.5"
44
45
  },
45
46
  "devDependencies": {
46
- "@biomejs/biome": "^2.4.8",
47
- "@chromatic-com/storybook": "^5.0.0",
47
+ "@biomejs/biome": "^2.4.11",
48
+ "@chromatic-com/storybook": "^5.1.1",
48
49
  "@eslint/js": "^9.39.1",
49
50
  "@mui/x-date-pickers-pro": "^8.27.2",
50
51
  "@octokit/rest": "^22.0.1",
@@ -52,24 +53,25 @@
52
53
  "@rsbuild/plugin-react": "^1.4.5",
53
54
  "@rslib/core": "^0.19.5",
54
55
  "@rspack/core": "^1.7.5",
55
- "@storybook/addon-a11y": "^10.3.3",
56
- "@storybook/addon-docs": "^10.3.3",
57
- "@storybook/addon-mcp": "^0.4.2",
58
- "@storybook/addon-onboarding": "^10.3.3",
59
- "@storybook/addon-vitest": "^10.3.3",
60
- "@storybook/react-vite": "^10.3.3",
56
+ "@storybook/addon-a11y": "^10.3.5",
57
+ "@storybook/addon-docs": "^10.3.5",
58
+ "@storybook/addon-mcp": "^0.5.0",
59
+ "@storybook/addon-onboarding": "^10.3.5",
60
+ "@storybook/addon-vitest": "^10.3.5",
61
+ "@storybook/react-vite": "^10.3.5",
61
62
  "@types/dot-object": "^2.1.6",
62
- "@types/node": "^25.3.3",
63
+ "@types/lodash": "^4.14.197",
64
+ "@types/node": "^25.6.0",
63
65
  "@types/react": "^18.3.12",
64
66
  "@types/react-dom": "^18.3.0",
65
67
  "@types/react-relay": "^18.2.1",
66
68
  "@typescript/native-preview": "7.0.0-dev.20260207.1",
67
69
  "@vitest/browser-playwright": "^4.1.0",
68
- "@vitest/coverage-v8": "^4.1.0",
70
+ "@vitest/coverage-v8": "^4.1.4",
69
71
  "eslint": "^9.39.1",
70
72
  "eslint-plugin-react": "^7.37.5",
71
73
  "eslint-plugin-react-hooks": "^7.0.1",
72
- "eslint-plugin-storybook": "^10.2.7",
74
+ "eslint-plugin-storybook": "^10.3.5",
73
75
  "generate-changelog": "^1.8.0",
74
76
  "glob": "^13.0.1",
75
77
  "globals": "^17.3.0",
@@ -77,12 +79,12 @@
77
79
  "moment-timezone": "^0.6.0",
78
80
  "playwright": "^1.58.2",
79
81
  "simple-git": "^3.30.0",
80
- "storybook": "^10.3.3",
81
- "turbo": "^2.8.20",
82
+ "storybook": "^10.3.5",
83
+ "turbo": "^2.9.6",
82
84
  "typescript": "^5.9.3",
83
85
  "typescript-eslint": "^8.54.0",
84
86
  "vite": "^7.3.1",
85
- "vitest": "^4.1.0"
87
+ "vitest": "^4.1.4"
86
88
  },
87
89
  "engines": {
88
90
  "node": ">=18.0.0"