wca-designsystem 0.0.48 → 0.0.50

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.48",
2
+ "version": "0.0.50",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -203,5 +203,7 @@ TabelaProps.args = {
203
203
  setFiltrosPor: () => console.log('aqui'),
204
204
  setGlobalFilter: () => console.log('aqui'),
205
205
  setPagination: () => console.log('aqui'),
206
+ quantidadeDeRegistros: 10,
207
+ tamanhoPaginacao: 97,
206
208
  setSimples: () => console.log('aqui'),
207
209
  };
@@ -3,8 +3,8 @@ import { Checkbox } from '@mantine/core';
3
3
  import { Column } from '.';
4
4
  import * as S from './styles';
5
5
  import { theme } from '../../../styles/theme';
6
- import Icone from '../../atomos/Icone';
7
6
  import SetaBaixo from '../../../assets/imagens/icons/SetaAbaixo.svg';
7
+ import Icone from '../../atomos/Icone';
8
8
 
9
9
  export interface BodyTableProps<
10
10
  T extends { id: string | number; children: Array<T> }
@@ -187,7 +187,7 @@ function BodyTable<T extends { id: string | number; children: Array<T> }>(
187
187
  ];
188
188
  }
189
189
  return (
190
- <S.TabelaBody color={color} hasselect={hasSelect ? 'true' : 'false'}>
190
+ <S.TabelaBody color={color} style={{ left: hasSelect ? '52px' : '17px' }}>
191
191
  {data.flatMap(item =>
192
192
  renderRows(
193
193
  item,
@@ -5,9 +5,9 @@ import { Column } from '.';
5
5
  import buscar from '../../../assets/imagens/icons/Busca.svg';
6
6
  import { useCallback } from 'react';
7
7
  import { theme } from '../../../styles/theme';
8
+ import { Capitalize } from '../../../utils/functions';
8
9
  import InputDeTexto from '../../atomos/InputDeTexto';
9
10
  import Icone from '../../atomos/Icone';
10
- import { Capitalize } from '../../../utils/functions';
11
11
 
12
12
  type HeaderOptions = {
13
13
  [key: string | number | symbol]: string; // Um índice genérico para mapear headers a valores
@@ -77,7 +77,7 @@ const HeaderTabela = <T,>({
77
77
  return especialHeaders[header] ?? Capitalize(String(header));
78
78
  }, []);
79
79
  return (
80
- <S.TabelaHeader color={color} style={{ minWidth: `${tdMinWidth}` }}>
80
+ <S.TabelaHeader color={color}>
81
81
  <tr>
82
82
  {hasExpand && <></>}
83
83
  {hasSelect && <></>}
@@ -94,6 +94,7 @@ const HeaderTabela = <T,>({
94
94
  : ''
95
95
  }
96
96
  style={{
97
+ minWidth: tdMinWidth,
97
98
  background: coloredHeader(header.key).background,
98
99
  color: coloredHeader(header.key).color,
99
100
  left: fixedPosition?.some(fixed => header.key === fixed)
@@ -115,7 +116,7 @@ const HeaderTabela = <T,>({
115
116
  value: 'ativo',
116
117
  });
117
118
  setGlobalFilter(String(e.currentTarget.checked));
118
- setPagination({ pageIndex: 0, pageSize: 10 });
119
+ setPagination({ pageIndex: 1, pageSize: 10 });
119
120
  }}
120
121
  />
121
122
  ) : (
@@ -127,7 +128,7 @@ const HeaderTabela = <T,>({
127
128
  tipo="table"
128
129
  placeholder={`Pesquisar por: ${header.header}`}
129
130
  onChange={e => {
130
- setPagination({ pageIndex: 0, pageSize: 10 });
131
+ setPagination({ pageIndex: 1, pageSize: 10 });
131
132
  setFiltrosPor({
132
133
  label: header.header,
133
134
  value:
@@ -3,13 +3,16 @@ import * as S from './styles';
3
3
  import SelectCustomizado from '../../atomos/Select';
4
4
  import Botao from '../../atomos/Botao';
5
5
 
6
+ export type PaginationProps = {
7
+ pageIndex: number;
8
+ pageSize: number;
9
+ };
10
+
6
11
  export type PaginacaoProps = {
7
12
  tamanhoPaginacao?: number;
8
13
  color?: string;
9
14
  quantidadeRegistros?: number;
10
- setPagination: React.Dispatch<
11
- React.SetStateAction<{ pageIndex: number; pageSize: number }>
12
- >;
15
+ setPagination: React.Dispatch<React.SetStateAction<PaginationProps>>;
13
16
  tabelaPaginacao: {
14
17
  pageIndex: number;
15
18
  pageSize: number;
@@ -27,18 +30,27 @@ const Paginacao = ({
27
30
  if (tabelaPaginacao.pageIndex + 1 > tabelaPaginacao.pageSize) {
28
31
  return;
29
32
  }
30
- setPagination({ pageIndex: tabelaPaginacao.pageIndex + 1, pageSize: 10 });
33
+ setPagination({
34
+ pageIndex: tabelaPaginacao.pageIndex + 1,
35
+ pageSize: tabelaPaginacao.pageSize ?? 10,
36
+ });
31
37
  }
32
38
 
33
39
  function previousPage() {
34
40
  if (tabelaPaginacao.pageIndex <= 0) {
35
41
  return;
36
42
  }
37
- setPagination({ pageIndex: tabelaPaginacao.pageIndex - 1, pageSize: 10 });
43
+ setPagination({
44
+ pageIndex: tabelaPaginacao.pageIndex - 1,
45
+ pageSize: tabelaPaginacao.pageSize ?? 10,
46
+ });
38
47
  }
39
48
 
40
49
  function changePage(e: number) {
41
- setPagination({ pageIndex: e, pageSize: 10 });
50
+ setPagination({
51
+ pageIndex: e,
52
+ pageSize: tabelaPaginacao.pageSize ?? 10,
53
+ });
42
54
  }
43
55
 
44
56
  function changeLinhas(e: string) {
@@ -52,9 +64,7 @@ const Paginacao = ({
52
64
  <S.PaginacaoWrapper color={color}>
53
65
  <div className="pagination-header">
54
66
  <p>
55
- Exibindo{' '}
56
- {tabelaPaginacao.pageIndex === 0 ? 1 : tabelaPaginacao.pageIndex} de{' '}
57
- {quantidadeRegistros}
67
+ Exibindo {tabelaPaginacao.pageIndex} de {quantidadeRegistros}
58
68
  </p>
59
69
  <div className="select-wrapper">
60
70
  <SelectCustomizado
@@ -81,9 +91,7 @@ const Paginacao = ({
81
91
  Anterior
82
92
  </Botao>
83
93
  <S.PaginationMantine
84
- value={
85
- tabelaPaginacao.pageIndex === 0 ? 1 : tabelaPaginacao.pageIndex
86
- }
94
+ value={tabelaPaginacao.pageIndex}
87
95
  onChange={e => {
88
96
  changePage(e);
89
97
  }}
@@ -1,19 +1,19 @@
1
- import styled, { css } from 'styled-components';
2
- import { Pagination } from '@mantine/core';
1
+ import styled, { css } from 'styled-components'
2
+ import { Pagination } from '@mantine/core'
3
3
 
4
4
  type ColorsProp = {
5
- color?: string;
6
- headerSelection?: Array<String>;
7
- hasselect?: string;
8
- tdMinWidth?: string;
9
- };
5
+ color?: string
6
+ headerSelection?: Array<String>
7
+ hasselect?: string
8
+ tdMinWidth?: string
9
+ }
10
10
 
11
11
  export const TableWrapper = styled.div`
12
12
  ${() => css`
13
13
  max-width: 1500px;
14
14
  overflow-x: hidden;
15
15
  `}
16
- `;
16
+ `
17
17
 
18
18
  export const TableContainer = styled.div`
19
19
  overflow-x: auto;
@@ -21,7 +21,7 @@ export const TableContainer = styled.div`
21
21
  font-family: 'Open Sans', sans-serif;
22
22
  max-width: 1500px;
23
23
  width: 100%;
24
- `;
24
+ `
25
25
 
26
26
  export const StyledTable = styled.table`
27
27
  ${({ theme }) => css`
@@ -52,7 +52,7 @@ export const StyledTable = styled.table`
52
52
  padding: 0;
53
53
  }
54
54
  `}
55
- `;
55
+ `
56
56
 
57
57
  export const TabelaHeader = styled.thead<ColorsProp>`
58
58
  ${({ theme, color }) => css`
@@ -90,11 +90,11 @@ export const TabelaHeader = styled.thead<ColorsProp>`
90
90
  min-width: 50px;
91
91
  }
92
92
  `}
93
- `;
93
+ `
94
94
 
95
95
  export const TabelaBody = styled.tbody<ColorsProp>`
96
96
  ${({ theme, color, hasselect }) => css`
97
- height: 250px;
97
+ min-height: 100vh; /* Garante altura mínima igual à altura da viewport */
98
98
  width: 100%;
99
99
 
100
100
  .select {
@@ -142,12 +142,12 @@ export const TabelaBody = styled.tbody<ColorsProp>`
142
142
  }
143
143
 
144
144
  .sticky {
145
- background-color: ;
145
+ background-color:;
146
146
  color: ${theme.colors.white};
147
147
  font-weight: bold;
148
148
  }
149
149
  `}
150
- `;
150
+ `
151
151
 
152
152
  export const TabelaSemDados = styled.div<ColorsProp>`
153
153
  ${({ color, theme }) => css`
@@ -165,7 +165,7 @@ export const TabelaSemDados = styled.div<ColorsProp>`
165
165
  color: ${color};
166
166
  }
167
167
  `}
168
- `;
168
+ `
169
169
 
170
170
  export const PaginacaoWrapper = styled.div<ColorsProp>`
171
171
  ${({ theme, color }) => css`
@@ -187,7 +187,7 @@ export const PaginacaoWrapper = styled.div<ColorsProp>`
187
187
  margin-left: 15px;
188
188
  }
189
189
  `}
190
- `;
190
+ `
191
191
 
192
192
  export const PaginationMantine = styled(Pagination)`
193
193
  ${({ theme }) => css`
@@ -203,7 +203,7 @@ export const PaginationMantine = styled(Pagination)`
203
203
  }
204
204
  }
205
205
  `}
206
- `;
206
+ `
207
207
 
208
208
  export const PaginationButtons = styled.div<ColorsProp>`
209
209
  ${({ theme, color }) => css`
@@ -223,4 +223,4 @@ export const PaginationButtons = styled.div<ColorsProp>`
223
223
  padding: 0 15px;
224
224
  }
225
225
  `}
226
- `;
226
+ `