@giro-ds/react 3.0.5 → 3.0.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.
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/Avatar/Avatar.types.d.ts +21 -5
- package/dist/components/Badge/Badge.types.d.ts +25 -7
- package/dist/components/Button/Button.types.d.ts +41 -8
- package/dist/components/Calendar/Calendar.d.ts +2 -1
- package/dist/components/Calendar/Calendar.types.d.ts +56 -12
- package/dist/components/Callout/Callout.types.d.ts +28 -11
- package/dist/components/Checkbox/Checkbox.types.d.ts +28 -4
- package/dist/components/Chips/Chips.types.d.ts +28 -11
- package/dist/components/Container/Container.types.d.ts +11 -0
- package/dist/components/DatePicker/DatePicker.types.d.ts +36 -18
- package/dist/components/DatePicker/DateUtils.d.ts +1 -1
- package/dist/components/DatePicker/index.d.ts +1 -1
- package/dist/components/Dialog/Dialog.types.d.ts +35 -11
- package/dist/components/Drawer/Drawer.types.d.ts +58 -27
- package/dist/components/Dropdown/Dropdown.types.d.ts +47 -20
- package/dist/components/Filter/Filter.types.d.ts +47 -28
- package/dist/components/ListItem/ListItem.d.ts +0 -5
- package/dist/components/ListItem/ListItem.types.d.ts +35 -17
- package/dist/components/Menu/Menu.d.ts +1 -1
- package/dist/components/Menu/Menu.types.d.ts +60 -2
- package/dist/components/Quantity/Quantity.types.d.ts +31 -13
- package/dist/components/Radio/Radio.types.d.ts +39 -2
- package/dist/components/Search/Search.types.d.ts +34 -5
- package/dist/components/Select/Select.types.d.ts +117 -8
- package/dist/components/Switch/Switch.types.d.ts +26 -2
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Table/Table.types.d.ts +2 -3
- package/dist/components/Table/TableHeader.d.ts +1 -1
- package/dist/components/Table/TablePagination.d.ts +1 -9
- package/dist/components/TextField/TextField.types.d.ts +49 -11
- package/dist/components/Toast/Toast.types.d.ts +37 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +32 -4
- package/dist/components/VerificationCode/VerificationCode.types.d.ts +29 -9
- package/dist/components/index.d.ts +1 -1
- package/dist/index.cjs +154 -176
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +860 -250
- package/dist/index.esm.js +147 -187
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/common.types.d.ts +12 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,56 +1,131 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
import { Side, Align, BaseProps } from '../../types/common.types';
|
|
4
|
+
/**
|
|
5
|
+
* Representa um item do select
|
|
6
|
+
*/
|
|
7
|
+
export interface SelectItemProps extends BaseProps {
|
|
8
|
+
/** Texto principal do item */
|
|
4
9
|
text: ReactNode;
|
|
10
|
+
/** Subtítulo ou descrição do item */
|
|
5
11
|
subTitle?: ReactNode;
|
|
12
|
+
/** Ícone do item */
|
|
6
13
|
icon?: ReactNode;
|
|
7
|
-
|
|
14
|
+
/** Valor do item */
|
|
8
15
|
value: string;
|
|
16
|
+
/** Define se o item está selecionado */
|
|
9
17
|
selected?: boolean;
|
|
18
|
+
/** Subitens do select (para selects aninhados) */
|
|
10
19
|
children?: SelectItemProps[];
|
|
11
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Props de um item com checkbox
|
|
23
|
+
*/
|
|
12
24
|
export interface CheckboxItemProps extends SelectItemProps {
|
|
25
|
+
/** Estado de checked do checkbox */
|
|
13
26
|
checked: boolean;
|
|
27
|
+
/** Callback executado quando o estado muda: (checked) => void */
|
|
14
28
|
onCheckedChange: (checked: boolean) => void;
|
|
15
29
|
}
|
|
30
|
+
/** Variantes disponíveis para o Select */
|
|
16
31
|
export type SelectVariant = 'text' | 'icon' | 'checkbox';
|
|
17
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Props do componente Select
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <Select
|
|
37
|
+
* items={[
|
|
38
|
+
* { value: '1', text: 'Opção 1' },
|
|
39
|
+
* { value: '2', text: 'Opção 2' }
|
|
40
|
+
* ]}
|
|
41
|
+
* variant="text"
|
|
42
|
+
* placeholder="Selecione uma opção"
|
|
43
|
+
* onValueChange={(value) => console.log(value)}
|
|
44
|
+
* />
|
|
45
|
+
* ```
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <Select
|
|
49
|
+
* items={options}
|
|
50
|
+
* variant="checkbox"
|
|
51
|
+
* multiple={true}
|
|
52
|
+
* search={true}
|
|
53
|
+
* label="Selecione múltiplas opções"
|
|
54
|
+
* helperText="Você pode selecionar mais de uma"
|
|
55
|
+
* required={true}
|
|
56
|
+
* />
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export interface SelectProps extends BaseProps {
|
|
60
|
+
/** Array de itens do select */
|
|
18
61
|
items: SelectItemProps[];
|
|
62
|
+
/** Callback executado quando o valor muda: (value) => void */
|
|
19
63
|
onValueChange?: (value: string | string[]) => void;
|
|
64
|
+
/** Callback executado quando o select abre/fecha: (open) => void */
|
|
20
65
|
onOpenChange?: (open: boolean) => void;
|
|
66
|
+
/** Variante visual do select */
|
|
21
67
|
variant: SelectVariant;
|
|
68
|
+
/** Define se o campo é obrigatório */
|
|
22
69
|
required?: boolean;
|
|
70
|
+
/** Valor(es) selecionado(s) */
|
|
23
71
|
value?: string | string[];
|
|
72
|
+
/** Habilita seleção múltipla */
|
|
24
73
|
multiple?: boolean;
|
|
74
|
+
/** Placeholder do campo */
|
|
25
75
|
placeholder?: string;
|
|
76
|
+
/** Habilita campo de busca */
|
|
26
77
|
search?: boolean;
|
|
78
|
+
/** Label do campo */
|
|
27
79
|
label?: string;
|
|
80
|
+
/** Texto de ajuda exibido abaixo do campo */
|
|
28
81
|
helperText?: string;
|
|
82
|
+
/** Largura máxima do select */
|
|
29
83
|
maxWidth?: number;
|
|
84
|
+
/** Mensagem de erro a ser exibida */
|
|
30
85
|
errorMessage?: string;
|
|
31
|
-
|
|
32
|
-
className?: string;
|
|
86
|
+
/** Label acessível para leitores de tela */
|
|
33
87
|
'aria-label'?: string;
|
|
88
|
+
/** ID para testes automatizados */
|
|
34
89
|
'data-testid'?: string;
|
|
90
|
+
/** Habilita tooltip */
|
|
35
91
|
tooltip?: boolean;
|
|
92
|
+
/** Texto do tooltip */
|
|
36
93
|
tooltipText?: string;
|
|
37
|
-
|
|
38
|
-
|
|
94
|
+
/** Lado onde o dropdown abre */
|
|
95
|
+
side?: Side;
|
|
96
|
+
/** Alinhamento do dropdown */
|
|
97
|
+
align?: Align;
|
|
98
|
+
/** Habilita scroll infinito */
|
|
39
99
|
enableInfiniteScroll?: boolean;
|
|
100
|
+
/** Callback executado ao chegar ao final do scroll: () => void */
|
|
40
101
|
onScrollEnd?: () => void;
|
|
102
|
+
/** Estado de carregamento de mais itens */
|
|
41
103
|
isLoadingMore?: boolean;
|
|
104
|
+
/** Habilita busca via API */
|
|
42
105
|
enableApiSearch?: boolean;
|
|
106
|
+
/** Callback executado na busca via API: (term) => void */
|
|
43
107
|
onApiSearch?: (term: string) => void;
|
|
108
|
+
/** Estado de busca em andamento */
|
|
44
109
|
isSearching?: boolean;
|
|
45
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Estado interno do componente Select
|
|
113
|
+
*/
|
|
46
114
|
export interface SelectState {
|
|
115
|
+
/** Define se o select está aberto */
|
|
47
116
|
isOpen: boolean;
|
|
117
|
+
/** Valores selecionados */
|
|
48
118
|
selectedValues: string[];
|
|
119
|
+
/** Texto digitado no campo de busca */
|
|
49
120
|
searchInput: string;
|
|
121
|
+
/** Termo de busca aplicado */
|
|
50
122
|
searchTerm: string;
|
|
123
|
+
/** Define se o campo foi tocado */
|
|
51
124
|
touched: boolean;
|
|
125
|
+
/** Define se há erro de validação */
|
|
52
126
|
hasError: boolean;
|
|
53
127
|
}
|
|
128
|
+
/** Ações disponíveis para o reducer do Select */
|
|
54
129
|
export type SelectAction = {
|
|
55
130
|
type: 'SET_OPEN';
|
|
56
131
|
payload: boolean;
|
|
@@ -77,39 +152,73 @@ export type SelectAction = {
|
|
|
77
152
|
required: boolean;
|
|
78
153
|
};
|
|
79
154
|
};
|
|
155
|
+
/**
|
|
156
|
+
* Props do hook useSelectLogic
|
|
157
|
+
*/
|
|
80
158
|
export interface UseSelectLogicProps {
|
|
159
|
+
/** Valor(es) controlado(s) */
|
|
81
160
|
value?: string | string[];
|
|
161
|
+
/** Define se o campo é obrigatório */
|
|
82
162
|
required?: boolean;
|
|
163
|
+
/** Habilita busca */
|
|
83
164
|
search?: boolean;
|
|
165
|
+
/** Callback executado quando o valor muda: (value) => void */
|
|
84
166
|
onValueChange?: (value: string | string[]) => void;
|
|
167
|
+
/** Callback executado quando o select abre/fecha: (open) => void */
|
|
85
168
|
onOpenChange?: (open: boolean) => void;
|
|
169
|
+
/** Habilita busca via API */
|
|
86
170
|
enableApiSearch?: boolean;
|
|
171
|
+
/** Callback executado na busca via API: (term) => void */
|
|
87
172
|
onApiSearch?: (term: string) => void;
|
|
173
|
+
/** Estado de busca em andamento */
|
|
88
174
|
isSearching?: boolean;
|
|
89
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Retorno do hook useSelectLogic
|
|
178
|
+
*/
|
|
90
179
|
export interface UseSelectLogicReturn {
|
|
180
|
+
/** Estado atual do select */
|
|
91
181
|
state: SelectState;
|
|
182
|
+
/** Ações disponíveis */
|
|
92
183
|
actions: {
|
|
184
|
+
/** Define se o select está aberto */
|
|
93
185
|
setOpen: (open: boolean) => void;
|
|
186
|
+
/** Define os valores selecionados */
|
|
94
187
|
setSelectedValues: (values: string[]) => void;
|
|
188
|
+
/** Define o texto de busca */
|
|
95
189
|
setSearchInput: (input: string) => void;
|
|
190
|
+
/** Define o termo de busca aplicado */
|
|
96
191
|
setSearchTerm: (term: string) => void;
|
|
192
|
+
/** Define se o campo foi tocado */
|
|
97
193
|
setTouched: (touched: boolean) => void;
|
|
194
|
+
/** Define se há erro */
|
|
98
195
|
setError: (error: boolean) => void;
|
|
196
|
+
/** Reseta a busca */
|
|
99
197
|
resetSearch: () => void;
|
|
198
|
+
/** Valida o campo */
|
|
100
199
|
validate: () => void;
|
|
200
|
+
/** Manipula seleção simples */
|
|
101
201
|
handleSingleSelect: (value: string) => void;
|
|
202
|
+
/** Manipula seleção múltipla */
|
|
102
203
|
handleMultipleSelect: (value: string, checked: boolean) => void;
|
|
103
204
|
};
|
|
205
|
+
/** Valores computados */
|
|
104
206
|
computed: {
|
|
207
|
+
/** Texto a ser exibido no campo */
|
|
105
208
|
displayText: string;
|
|
209
|
+
/** Itens filtrados pela busca */
|
|
106
210
|
filteredItems: SelectItemProps[];
|
|
107
211
|
};
|
|
212
|
+
/** Referências */
|
|
108
213
|
refs: {
|
|
214
|
+
/** Referência do input de busca */
|
|
109
215
|
searchInputRef: React.RefObject<HTMLInputElement | null>;
|
|
110
216
|
};
|
|
217
|
+
/** Funções utilitárias */
|
|
111
218
|
utils: {
|
|
219
|
+
/** Obtém o texto a ser exibido */
|
|
112
220
|
getDisplayText: (selectedValues: string[], placeholder: string, variant: string, items: SelectItemProps[]) => string;
|
|
221
|
+
/** Filtra os itens pela busca */
|
|
113
222
|
getFilteredItems: (items: SelectItemProps[], searchTerm: string) => SelectItemProps[];
|
|
114
223
|
};
|
|
115
224
|
}
|
|
@@ -1,8 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
import { BaseProps } from '../../types/common.types';
|
|
2
|
+
/**
|
|
3
|
+
* Props do componente Switch
|
|
4
|
+
* @example
|
|
5
|
+
* ```tsx
|
|
6
|
+
* <Switch
|
|
7
|
+
* checked={isEnabled}
|
|
8
|
+
* onCheckedChange={setIsEnabled}
|
|
9
|
+
* />
|
|
10
|
+
* ```
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Switch
|
|
14
|
+
* defaultChecked={true}
|
|
15
|
+
* disabled={isLoading}
|
|
16
|
+
* onCheckedChange={(checked) => console.log(checked)}
|
|
17
|
+
* name="notifications"
|
|
18
|
+
* />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export interface SwitchProps extends BaseProps {
|
|
22
|
+
/** Estado inicial (modo não controlado) */
|
|
2
23
|
defaultChecked?: boolean;
|
|
3
|
-
|
|
24
|
+
/** Callback executado quando o estado muda: (checked) => void */
|
|
4
25
|
onCheckedChange?: (checked: boolean) => void;
|
|
26
|
+
/** Nome do input */
|
|
5
27
|
name?: string;
|
|
28
|
+
/** Valor do input */
|
|
6
29
|
value?: string;
|
|
30
|
+
/** Estado atual (modo controlado) */
|
|
7
31
|
checked?: boolean;
|
|
8
32
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TableRowData, TableProps } from './Table.types';
|
|
2
|
-
declare const Table: <T extends TableRowData = TableRowData>({ columns, dataSource, className, loading, rowSelection, locale, onRow, }: TableProps<T>) => import("react/jsx-runtime").JSX.Element | null;
|
|
2
|
+
declare const Table: <T extends TableRowData = TableRowData>({ columns, dataSource, className, loading, rowSelection, locale, onRow, ...rest }: TableProps<T>) => import("react/jsx-runtime").JSX.Element | null;
|
|
3
3
|
export default Table;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
import { BaseProps } from '../../types';
|
|
2
3
|
/**
|
|
3
4
|
* Tipo base para dados da tabela. Use `<Table<SeuTipo>>` para type-safety completo.
|
|
4
5
|
* @example <Table<User> dataSource={users} />
|
|
@@ -32,13 +33,11 @@ export interface TableColumn<T = TableRowData> {
|
|
|
32
33
|
* Props do componente Table. Use genérico para autocomplete: `<Table<User>>`
|
|
33
34
|
* @typeParam T - Tipo dos dados da linha
|
|
34
35
|
*/
|
|
35
|
-
export interface TableProps<T = TableRowData> {
|
|
36
|
+
export interface TableProps<T = TableRowData> extends BaseProps {
|
|
36
37
|
/** Configuração das colunas */
|
|
37
38
|
columns: TableColumn<T>[];
|
|
38
39
|
/** Array de dados a serem exibidos */
|
|
39
40
|
dataSource: T[];
|
|
40
|
-
/** Classe CSS customizada */
|
|
41
|
-
className?: string;
|
|
42
41
|
/** Estado de carregamento */
|
|
43
42
|
loading?: boolean;
|
|
44
43
|
/** Configuração de seleção de linhas */
|
|
@@ -30,7 +30,7 @@ interface CalendarFilterItem extends BaseFilterItem {
|
|
|
30
30
|
export type FilterItem = CheckboxFilterItem | CalendarFilterItem;
|
|
31
31
|
declare const isCalendarFilter: (filter: FilterItem) => filter is CalendarFilterItem;
|
|
32
32
|
declare const isCheckboxFilter: (filter: FilterItem) => filter is CheckboxFilterItem;
|
|
33
|
-
export interface TableHeaderProps {
|
|
33
|
+
export interface TableHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
34
34
|
searchValue?: string;
|
|
35
35
|
onSearchChange?: (value: string) => void;
|
|
36
36
|
searchPlaceholder?: string;
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export interface TablePaginationProps {
|
|
3
|
-
/** Página atual */
|
|
2
|
+
export interface TablePaginationProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
3
|
currentPage: number;
|
|
5
|
-
/** Total de itens */
|
|
6
4
|
totalItems: number;
|
|
7
|
-
/** Itens por página */
|
|
8
5
|
itemsPerPage: number;
|
|
9
|
-
/** Callback quando a página muda */
|
|
10
6
|
onPageChange: (page: number) => void;
|
|
11
|
-
/** Callback quando itens por página muda */
|
|
12
7
|
onItemsPerPageChange: (itemsPerPage: number) => void;
|
|
13
|
-
/** Opções disponíveis para itens por página */
|
|
14
8
|
pageSizeOptions?: number[];
|
|
15
|
-
/** Desabilita a paginação */
|
|
16
9
|
disabled?: boolean;
|
|
17
|
-
/** Classes CSS adicionais */
|
|
18
10
|
className?: string;
|
|
19
11
|
}
|
|
20
12
|
declare const TablePagination: React.FC<TablePaginationProps>;
|
|
@@ -1,31 +1,69 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Side, Align } from '../../types/common.types';
|
|
3
|
+
/** Tipos de input suportados pelo TextField */
|
|
2
4
|
export type TextFieldType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url';
|
|
3
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Props do componente TextField
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <TextField
|
|
10
|
+
* label="Email"
|
|
11
|
+
* type="email"
|
|
12
|
+
* value={email}
|
|
13
|
+
* onChange={setEmail}
|
|
14
|
+
* placeholder="Digite seu email"
|
|
15
|
+
* />
|
|
16
|
+
* ```
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <TextField
|
|
20
|
+
* label="Senha"
|
|
21
|
+
* type="password"
|
|
22
|
+
* required
|
|
23
|
+
* helperText="Mínimo 8 caracteres"
|
|
24
|
+
* errorMessage={error}
|
|
25
|
+
* tooltip={true}
|
|
26
|
+
* tooltipText="Deve conter letras e números"
|
|
27
|
+
* icon={<LockIcon />}
|
|
28
|
+
* />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
4
31
|
export interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value' | 'type'> {
|
|
5
|
-
/**
|
|
32
|
+
/** Valor controlado do campo */
|
|
6
33
|
value?: string | number;
|
|
7
|
-
/**
|
|
34
|
+
/** Callback executado quando o valor muda: (value) => void */
|
|
8
35
|
onChange?: (value: string) => void;
|
|
9
|
-
/** Label
|
|
36
|
+
/** Label do campo */
|
|
10
37
|
label?: string;
|
|
11
|
-
/**
|
|
38
|
+
/** Tipo do input */
|
|
12
39
|
type?: TextFieldType;
|
|
13
|
-
/**
|
|
40
|
+
/** Texto de ajuda exibido abaixo do campo */
|
|
14
41
|
helperText?: string;
|
|
15
|
-
/**
|
|
42
|
+
/** Habilita tooltip */
|
|
16
43
|
tooltip?: boolean;
|
|
17
|
-
/**
|
|
44
|
+
/** Texto do tooltip */
|
|
18
45
|
tooltipText?: string;
|
|
19
|
-
|
|
20
|
-
|
|
46
|
+
/** Lado onde o tooltip aparece */
|
|
47
|
+
side?: Side;
|
|
48
|
+
/** Alinhamento do tooltip */
|
|
49
|
+
align?: Align;
|
|
50
|
+
/** Mensagem de erro a ser exibida */
|
|
21
51
|
errorMessage?: string;
|
|
22
|
-
/**
|
|
52
|
+
/** Ícone a ser exibido no campo */
|
|
23
53
|
icon?: React.ReactNode;
|
|
24
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Parâmetros para validação do TextField
|
|
57
|
+
*/
|
|
25
58
|
export interface ValidationParams {
|
|
59
|
+
/** Valor a ser validado */
|
|
26
60
|
value: string;
|
|
61
|
+
/** Comprimento máximo permitido */
|
|
27
62
|
maxLength?: number;
|
|
63
|
+
/** Tipo do campo (influencia a validação) */
|
|
28
64
|
type?: TextFieldType;
|
|
65
|
+
/** Mensagem de erro customizada */
|
|
29
66
|
errorMessage?: string;
|
|
67
|
+
/** Define se o campo é obrigatório */
|
|
30
68
|
required?: boolean;
|
|
31
69
|
}
|
|
@@ -1,22 +1,59 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
/** Tipos de toast disponíveis */
|
|
2
3
|
export type ToastType = 'success' | 'alert' | 'info';
|
|
4
|
+
/**
|
|
5
|
+
* Representa uma mensagem de toast
|
|
6
|
+
*/
|
|
3
7
|
export interface ToastMessage {
|
|
8
|
+
/** ID único da mensagem */
|
|
4
9
|
id: string;
|
|
10
|
+
/** Conteúdo da mensagem */
|
|
5
11
|
message: string;
|
|
12
|
+
/** Tipo visual do toast */
|
|
6
13
|
type: ToastType;
|
|
14
|
+
/** Define se o toast permanece até ser fechado manualmente */
|
|
7
15
|
persistent?: boolean;
|
|
16
|
+
/** Duração em milissegundos antes de auto-fechar */
|
|
8
17
|
duration?: number;
|
|
18
|
+
/** Timestamp de quando foi criado */
|
|
9
19
|
timestamp: number;
|
|
10
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Opções para exibição do toast
|
|
23
|
+
*/
|
|
11
24
|
export interface ToastOptions {
|
|
25
|
+
/** Define se o toast permanece até ser fechado manualmente */
|
|
12
26
|
persistent?: boolean;
|
|
27
|
+
/** Duração em milissegundos antes de auto-fechar */
|
|
13
28
|
duration?: number;
|
|
14
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Contexto do sistema de toasts
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* const { showToast, hideToast } = useToast();
|
|
35
|
+
*
|
|
36
|
+
* showToast('Operação realizada com sucesso!', 'success');
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
15
39
|
export interface ToastContextType {
|
|
40
|
+
/** Exibe um toast e retorna seu ID: (message, type?, options?) => string */
|
|
16
41
|
showToast: (message: string, type?: ToastType, options?: ToastOptions) => string;
|
|
42
|
+
/** Oculta um toast específico: (id) => void */
|
|
17
43
|
hideToast: (id: string) => void;
|
|
44
|
+
/** Oculta todos os toasts: () => void */
|
|
18
45
|
hideAllToasts: () => void;
|
|
19
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Props do componente ToastProvider
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <ToastProvider>
|
|
52
|
+
* <App />
|
|
53
|
+
* </ToastProvider>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
20
56
|
export interface ToastProviderProps {
|
|
57
|
+
/** Conteúdo da aplicação */
|
|
21
58
|
children: ReactNode;
|
|
22
59
|
}
|
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { Side, Align, BaseProps } from '../../types/common.types';
|
|
3
|
+
/**
|
|
4
|
+
* Props do componente Tooltip
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* <Tooltip text="Informação adicional">
|
|
8
|
+
* <Button>Hover me</Button>
|
|
9
|
+
* </Tooltip>
|
|
10
|
+
* ```
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Tooltip
|
|
14
|
+
* text="Clique para mais detalhes"
|
|
15
|
+
* side="top"
|
|
16
|
+
* align="center"
|
|
17
|
+
* sideOffset={10}
|
|
18
|
+
* maxWidth={300}
|
|
19
|
+
* >
|
|
20
|
+
* <IconButton icon={<InfoIcon />} />
|
|
21
|
+
* </Tooltip>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export interface TooltipProps extends BaseProps {
|
|
25
|
+
/** Conteúdo do tooltip */
|
|
4
26
|
text: React.ReactNode;
|
|
5
|
-
|
|
6
|
-
|
|
27
|
+
/** Lado onde o tooltip aparece em relação ao elemento */
|
|
28
|
+
side?: Side;
|
|
29
|
+
/** Alinhamento do tooltip */
|
|
30
|
+
align?: Align;
|
|
31
|
+
/** Distância em pixels do lado do elemento */
|
|
7
32
|
sideOffset?: number;
|
|
33
|
+
/** Deslocamento em pixels no eixo de alinhamento */
|
|
8
34
|
alignOffset?: number;
|
|
35
|
+
/** Largura máxima do tooltip em pixels */
|
|
9
36
|
maxWidth?: number;
|
|
37
|
+
/** Elemento que dispara o tooltip ao hover */
|
|
10
38
|
children: React.ReactNode;
|
|
11
39
|
}
|
|
@@ -1,19 +1,39 @@
|
|
|
1
|
+
import { BaseProps } from '../../types/common.types';
|
|
2
|
+
/** Tipos de entrada suportados pelo VerificationCode */
|
|
1
3
|
export type InputType = 'numeric' | 'alpha' | 'alphanumeric';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Props do componente VerificationCode
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <VerificationCode
|
|
9
|
+
* length={6}
|
|
10
|
+
* inputType="numeric"
|
|
11
|
+
* onComplete={(code) => handleVerification(code)}
|
|
12
|
+
* />
|
|
13
|
+
* ```
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <VerificationCode
|
|
17
|
+
* length={4}
|
|
18
|
+
* inputType="alphanumeric"
|
|
19
|
+
* onComplete={handleCode}
|
|
20
|
+
* hasError={!!error}
|
|
21
|
+
* errorMessage="Código inválido"
|
|
22
|
+
* disabled={isVerifying}
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export interface VerificationCodeProps extends BaseProps {
|
|
27
|
+
/** Número de dígitos do código (padrão: 6) */
|
|
4
28
|
length?: number;
|
|
5
|
-
/**
|
|
29
|
+
/** Tipo de entrada permitida (padrão: "numeric") */
|
|
6
30
|
inputType?: InputType;
|
|
7
|
-
/** Callback
|
|
31
|
+
/** Callback executado quando todos os campos são preenchidos: (value) => void */
|
|
8
32
|
onComplete?: (value: string) => void;
|
|
9
|
-
/**
|
|
33
|
+
/** Define se o campo está em estado de erro */
|
|
10
34
|
hasError?: boolean;
|
|
11
35
|
/** Mensagem de erro exibida abaixo do componente */
|
|
12
36
|
errorMessage?: string;
|
|
13
|
-
/** Define se o componente deve estar desabilitado */
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
/** Classe CSS adicional para estilização externa */
|
|
16
|
-
className?: string;
|
|
17
37
|
/** Props adicionais passadas para os inputs */
|
|
18
38
|
[key: string]: any;
|
|
19
39
|
}
|
|
@@ -5,7 +5,7 @@ export { type BadgeProps } from './Badge/Badge.types';
|
|
|
5
5
|
export { default as Button } from './Button';
|
|
6
6
|
export { type ButtonProps } from './Button/Button.types';
|
|
7
7
|
export { default as Calendar } from './Calendar';
|
|
8
|
-
export { type CalendarProps, type
|
|
8
|
+
export { type CalendarProps, type DateFormat, type DayItem, type EmptyItem, type CalendarItem, type YearItem } from './Calendar/Calendar.types';
|
|
9
9
|
export { default as Callout } from './Callout';
|
|
10
10
|
export { type CalloutProps } from './Callout/Callout.types';
|
|
11
11
|
export { default as Checkbox } from './Checkbox';
|