@giro-ds/react 1.0.5 → 3.0.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.
Files changed (60) hide show
  1. package/dist/components/Button/Button.d.ts +1 -1
  2. package/dist/components/Button/Button.types.d.ts +3 -23
  3. package/dist/components/Button/__tests__/Button.test.d.ts +1 -0
  4. package/dist/components/Checkbox/Checkbox.d.ts +4 -4
  5. package/dist/components/Checkbox/Checkbox.types.d.ts +4 -19
  6. package/dist/components/Checkbox/__tests__/Checkbox.test.d.ts +1 -0
  7. package/dist/components/Menu/Menu.d.ts +1 -1
  8. package/dist/components/Menu/Menu.types.d.ts +25 -34
  9. package/dist/components/Menu/__tests__/Menu.test.d.ts +1 -0
  10. package/dist/components/{MenuRadix → Menu}/components/MenuItem.d.ts +1 -6
  11. package/dist/components/{MenuRadix → Menu}/hooks/useMenuLogic.d.ts +1 -1
  12. package/dist/components/{MenuRadix → Menu}/hooks/useSearchLogic.d.ts +1 -1
  13. package/dist/components/Menu/index.d.ts +1 -1
  14. package/dist/components/Radio/Radio.d.ts +3 -3
  15. package/dist/components/Radio/Radio.types.d.ts +11 -14
  16. package/dist/components/Radio/__tests__/Radio.test.d.ts +1 -0
  17. package/dist/components/Radio/index.d.ts +1 -0
  18. package/dist/components/Search/Search.types.d.ts +1 -0
  19. package/dist/components/Select/Select.d.ts +2 -2
  20. package/dist/components/Select/Select.types.d.ts +100 -52
  21. package/dist/components/Select/__tests__/SelectRadix.test.d.ts +1 -0
  22. package/dist/components/{SelectRadix → Select}/components/CheckboxSelectItem.d.ts +1 -1
  23. package/dist/components/Select/components/ExpandableSelectItem.d.ts +11 -0
  24. package/dist/components/{SelectRadix → Select}/components/SelectItem.d.ts +1 -1
  25. package/dist/components/{SelectRadix → Select}/hooks/useSelectLogic.d.ts +1 -1
  26. package/dist/components/Select/index.d.ts +4 -1
  27. package/dist/components/Switch/Switch.d.ts +4 -0
  28. package/dist/components/{CheckboxRadix/CheckboxRadix.types.d.ts → Switch/Switch.types.d.ts} +5 -7
  29. package/dist/components/Switch/__tests__/Switch.test.d.ts +1 -0
  30. package/dist/components/Switch/index.d.ts +2 -0
  31. package/dist/components/Table/Table.d.ts +2 -3
  32. package/dist/components/Table/Table.types.d.ts +46 -10
  33. package/dist/components/Table/index.d.ts +1 -1
  34. package/dist/components/TextField/TextField.types.d.ts +2 -3
  35. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  36. package/dist/components/Tooltip/Tooltip.types.d.ts +5 -1
  37. package/dist/components/Tooltip/__tests__/Tooltip.test.d.ts +1 -0
  38. package/dist/components/Tooltip/index.d.ts +1 -0
  39. package/dist/components/index.d.ts +5 -13
  40. package/dist/index.cjs +275 -843
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.ts +85 -248
  43. package/dist/index.esm.js +287 -833
  44. package/dist/index.esm.js.map +1 -1
  45. package/dist/shared/Label/index.d.ts +4 -3
  46. package/dist/styles.css +1 -1
  47. package/package.json +3 -2
  48. package/dist/components/CheckboxRadix/CheckboxRadix.d.ts +0 -4
  49. package/dist/components/CheckboxRadix/index.d.ts +0 -2
  50. package/dist/components/MenuRadix/MenuRadix.d.ts +0 -4
  51. package/dist/components/MenuRadix/MenuRadix.types.d.ts +0 -27
  52. package/dist/components/MenuRadix/index.d.ts +0 -2
  53. package/dist/components/RadioRadix/RadioRadix.d.ts +0 -4
  54. package/dist/components/RadioRadix/RadioRadix.types.d.ts +0 -15
  55. package/dist/components/RadioRadix/index.d.ts +0 -2
  56. package/dist/components/SelectField/SelectField.d.ts +0 -4
  57. package/dist/components/SelectField/SelectField.types.d.ts +0 -35
  58. package/dist/components/SelectRadix/SelectRadix.d.ts +0 -4
  59. package/dist/components/SelectRadix/SelectRadix.types.d.ts +0 -112
  60. package/dist/components/SelectRadix/index.d.ts +0 -5
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { ButtonProps } from './Button.types';
3
- declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLElement>>;
3
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLElement>>;
4
4
  export default Button;
@@ -1,43 +1,23 @@
1
1
  import React from 'react';
2
- export interface ButtonProps {
3
- /** Define o elemento a ser renderizado (ex: 'button', 'a', ou componente de roteamento) */
2
+ export interface ButtonProps extends React.HTMLAttributes<HTMLElement> {
4
3
  as?: React.ElementType;
5
- /** Define o texto principal do botão */
6
4
  children?: React.ReactNode;
7
- /** Define tipo do botão entre as opções */
8
5
  variant?: 'filled' | 'outlined' | 'text';
9
6
  iconOnly?: boolean;
10
- /** Define a posição do ícone entre as opções */
11
- iconPosition?: 'none' | 'left' | 'right';
12
- /** URL para links externos (ex: https://example.com) */
7
+ iconPosition?: 'left' | 'right' | 'both';
13
8
  href?: string;
14
- /** Rota interna para navegação SPA (ex: /dashboard, /profile) */
15
9
  to?: string;
16
- /** Indica se o link é externo */
17
10
  external?: boolean;
18
- /** Target para links (_blank, _self, etc.) */
19
11
  target?: string;
20
- /** Rel attribute para links */
21
12
  rel?: string;
22
- /** Props para React Router (replace, state, etc.) */
23
- routerProps?: Record<string, any>;
24
13
  type?: 'button' | 'submit' | 'reset';
25
- /** Desabilita interações do botão */
26
14
  disabled?: boolean;
27
- /** Função a ser chamada quando o botão é clicado */
28
15
  onClick?: (event: React.MouseEvent<HTMLElement>) => void;
29
- /** Define o tamanho do botão entre as opções */
30
16
  size?: 'lg' | 'sm';
31
- /** Classe CSS opcional */
32
17
  className?: string;
33
- /** ID opcional */
34
18
  id?: string;
35
- /** Ícone opcional */
36
19
  icon?: React.ReactNode;
37
- /** Define se o botão deve ocupar toda a largura */
38
20
  fullWidth?: boolean;
39
- /** Texto para acessibilidade */
40
21
  ariaLabel?: string;
41
- /** Outros props específicos do elemento/componente */
42
- [key: string]: any;
22
+ loading?: boolean;
43
23
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import type { CheckboxProps } from './Checkbox.types';
3
- declare const MemoizedCheckbox: React.NamedExoticComponent<CheckboxProps>;
4
- export default MemoizedCheckbox;
1
+ import * as React from 'react';
2
+ import { CheckboxProps } from './Checkbox.types';
3
+ declare const Checkbox: React.FC<CheckboxProps>;
4
+ export default Checkbox;
@@ -1,25 +1,10 @@
1
- import React from 'react';
2
1
  export interface CheckboxProps {
3
- /** Unique identifier for the checkbox input */
4
2
  id?: string;
5
- /** Name attribute for the checkbox, used for form identification */
6
- name?: string;
7
- /** Controlled value indicating whether the checkbox is checked */
3
+ label?: React.ReactNode;
4
+ onCheckedChange?: (checked: boolean) => void;
5
+ defaultChecked?: boolean;
8
6
  checked?: boolean;
9
- /** Callback function triggered when the checkbox value changes */
10
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
11
- /** Label text displayed next to the checkbox */
12
- label?: string | React.ReactNode;
13
- /** Additional CSS classes for custom styling */
14
- className?: string;
15
- /** Value attribute for the checkbox input element */
16
- value?: string;
17
- /** AriaDescribedBy for the checkbox input element */
18
- ariaDescribedby?: string;
19
- /** Disables the checkbox, preventing user interaction */
20
7
  disabled?: boolean;
21
- /** Sets the checkbox to an indeterminate state (useful for parent-child relationships) */
8
+ className?: string;
22
9
  indeterminate?: boolean;
23
- /** Additional props passed to the checkbox input element */
24
- [key: string]: any;
25
10
  }
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -1,4 +1,4 @@
1
+ import { MenuProps } from './Menu.types';
1
2
  import React from 'react';
2
- import type { MenuProps } from './Menu.types';
3
3
  declare const Menu: React.FC<MenuProps>;
4
4
  export default Menu;
@@ -1,41 +1,32 @@
1
- import { ReactNode, ReactElement } from 'react';
2
- export interface MenuItem {
3
- /** ID único do item */
4
- id: string;
5
- /** Texto principal do item */
6
- text: string;
7
- /** Texto secundário opcional */
1
+ import { ReactElement } from 'react';
2
+ export interface MenuItemProps {
3
+ id?: string;
4
+ text?: string;
8
5
  subText?: string;
9
- /** Ícone do item */
10
- icon?: ReactNode;
11
- /** Estado desabilitado */
12
6
  disabled?: boolean;
13
- /** Valor customizado do item */
14
- value?: unknown;
7
+ icon?: React.ReactNode;
8
+ children?: MenuItemProps[];
9
+ value?: string;
10
+ }
11
+ export interface DefaultMenuItemProps {
12
+ item: MenuItemProps;
13
+ isSelected: boolean;
14
+ onSelect: (item: MenuItemProps) => void;
15
15
  }
16
16
  export interface MenuProps {
17
- /** Elemento React que será usado como âncora do menu (obrigatório) */
18
- children: ReactElement<any, any>;
19
- /** Array de itens do menu */
20
- menuItems?: MenuItem[];
21
- /** Callback executado quando um item do menu é clicado */
22
- onMenuItemClick?: (item: MenuItem) => void;
23
- /** Callback executado quando o menu é aberto/fechado */
24
- onToggle?: (isOpen: boolean) => void;
25
- /** Tipo do dropdown */
17
+ items: MenuItemProps[];
18
+ children?: ReactElement;
26
19
  type?: 'text' | 'icon';
27
- /** Habilita campo de busca */
28
- applySearch?: boolean;
29
- /** Placeholder do campo de busca */
30
- placeholder?: string;
31
- /** Controla exibição do subtexto */
32
- showSubText?: boolean;
33
- /** Classes CSS adicionais */
34
20
  className?: string;
35
- /** ID único do componente */
36
- id?: string;
37
- maxWidth?: string | number;
38
- minWidth?: string | number;
39
- /** Posição do menu em relação ao elemento âncora */
40
- position?: 'left' | 'right';
21
+ onItemSelect?: (items: MenuItemProps) => void;
22
+ selectedItems?: MenuItemProps[];
23
+ search?: boolean;
24
+ align?: 'start' | 'end' | 'center';
25
+ maxHeight?: number | string;
26
+ enableInfiniteScroll?: boolean;
27
+ onScrollEnd?: () => void;
28
+ isLoadingMore?: boolean;
29
+ enableApiSearch?: boolean;
30
+ onApiSearch?: (searchTerm: string) => void;
31
+ onOpenChange?: (open: boolean) => void;
41
32
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,3 @@
1
- import { MenuItemProps } from '../MenuRadix.types';
2
- interface DefaultMenuItemProps {
3
- item: MenuItemProps;
4
- isSelected: boolean;
5
- onSelect: (item: MenuItemProps) => void;
6
- }
1
+ import { DefaultMenuItemProps } from '../Menu.types';
7
2
  export declare const MenuItem: import("react").MemoExoticComponent<({ item, isSelected, onSelect }: DefaultMenuItemProps) => import("react/jsx-runtime").JSX.Element>;
8
3
  export default MenuItem;
@@ -1,4 +1,4 @@
1
- import { MenuItemProps } from '../MenuRadix.types';
1
+ import { MenuItemProps } from '../Menu.types';
2
2
  export interface UseMenuLogicProps {
3
3
  selectedItems?: MenuItemProps[];
4
4
  onItemSelect?: (items: MenuItemProps) => void;
@@ -1,4 +1,4 @@
1
- import { MenuItemProps } from '../MenuRadix.types';
1
+ import { MenuItemProps } from '../Menu.types';
2
2
  interface UseSearchLogicProps {
3
3
  items: MenuItemProps[];
4
4
  searchValue: string;
@@ -1,2 +1,2 @@
1
1
  export { default } from './Menu';
2
- export type { MenuProps, MenuItem } from './Menu.types';
2
+ export type { MenuProps, MenuItemProps } from './Menu.types';
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import type { RadioProps } from './Radio.types';
3
- declare const MemoizedRadio: React.NamedExoticComponent<RadioProps>;
4
- export default MemoizedRadio;
2
+ import { RadioGroupProps } from './Radio.types';
3
+ declare const Radio: React.FC<RadioGroupProps>;
4
+ export default Radio;
@@ -1,18 +1,15 @@
1
1
  export interface RadioProps {
2
- /** Definirá o nome do grupo de radio */
3
- name?: string;
4
- /** O valor associado ao botão de rádio */
2
+ id?: string | number;
5
3
  value: string;
6
- /** O identificador único para o input do rádio */
7
- id?: string;
8
- /** Indica se o botão de rádio está selecionado */
9
- checked?: boolean;
10
- /** Classes adicionais para estilização personalizada */
11
- className?: string;
12
- /** Função de callback acionada quando o valor do botão de rádio muda */
13
- onChange?: (value: string) => void;
14
- /** O texto do rótulo exibido ao lado do botão de rádio */
15
- label?: string;
16
- /** Indica se o botão de rádio está desabilitado */
4
+ label: string;
17
5
  disabled?: boolean;
18
6
  }
7
+ export interface RadioGroupProps {
8
+ id?: string;
9
+ items: RadioProps[];
10
+ onValueChange?: (value: string) => void;
11
+ defaultValue?: string;
12
+ name?: string;
13
+ ariaLabel?: string;
14
+ orientation?: "horizontal" | "vertical";
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,2 @@
1
1
  export { default } from './Radio';
2
+ export type { RadioProps, RadioGroupProps } from './Radio.types';
@@ -12,4 +12,5 @@ export interface SearchProps {
12
12
  onMouseDown?: (e: React.MouseEvent<HTMLDivElement>) => void;
13
13
  className?: string;
14
14
  id?: string;
15
+ 'data-testid'?: string;
15
16
  }
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import type { SelectProps } from './Select.types';
3
- declare const Select: React.NamedExoticComponent<SelectProps>;
2
+ import { SelectProps } from './Select.types';
3
+ declare const Select: React.FC<SelectProps>;
4
4
  export default Select;
@@ -1,67 +1,115 @@
1
- import React from 'react';
2
- import { DropdownType } from '../Dropdown/Dropdown.types';
3
- export interface SelectOption {
4
- /** ID único da opção (opcional, será gerado automaticamente se não fornecido) */
1
+ import { ReactNode } from 'react';
2
+ export interface SelectItemProps {
5
3
  id?: string;
6
- /** Texto principal da opção */
7
- text: string;
8
- /** Texto secundário/descrição da opção */
9
- subText?: string;
10
- /** Ícone da opção (React node) */
11
- icon?: React.ReactNode;
12
- /** Define se a opção está desabilitada */
4
+ text: ReactNode;
5
+ subTitle?: ReactNode;
6
+ icon?: ReactNode;
13
7
  disabled?: boolean;
8
+ value: string;
9
+ selected?: boolean;
10
+ children?: SelectItemProps[];
14
11
  }
12
+ export interface CheckboxItemProps extends SelectItemProps {
13
+ checked: boolean;
14
+ onCheckedChange: (checked: boolean) => void;
15
+ }
16
+ export type SelectVariant = 'text' | 'icon' | 'checkbox';
15
17
  export interface SelectProps {
16
- /** ID único do componente */
17
- id?: string;
18
- /** Array de opções para seleção - obrigatório */
19
- options: SelectOption[];
20
- /** Valor(es) selecionado(s) */
18
+ items: SelectItemProps[];
19
+ onValueChange?: (value: string | string[]) => void;
20
+ onOpenChange?: (open: boolean) => void;
21
+ variant: SelectVariant;
22
+ required?: boolean;
21
23
  value?: string | string[];
22
- /** Valor inicial para seleção (usado apenas na primeira renderização) */
23
- initialValue?: string | string[];
24
- /** Callback para mudanças na seleção */
25
- onChange?: (selectedItems: SelectOption[]) => void;
26
- /** Placeholder do campo */
24
+ multiple?: boolean;
27
25
  placeholder?: string;
28
- /** Tipo do dropdown (single ou multiple) */
29
- type?: DropdownType;
30
- maxHeight?: string;
31
- /** Label do campo */
26
+ search?: boolean;
32
27
  label?: string;
33
- /** Texto de ajuda */
34
28
  helperText?: string;
35
- /** Mensagem de erro */
29
+ maxWidth?: number;
36
30
  errorMessage?: string;
37
- /** Campo obrigatório */
38
- required?: boolean;
39
- /** Campo desabilitado */
40
31
  disabled?: boolean;
41
- /** Classes CSS adicionais */
42
32
  className?: string;
43
- /** Texto para acessibilidade */
44
- showSubText?: boolean;
45
- /** Aria-label do campo */
46
- ariaLabel?: string;
47
- /** Habilita campo de busca */
48
- applySearch?: boolean;
49
- /** Placeholder do campo de busca */
50
- searchPlaceholder?: string;
51
- maxWidth?: string;
52
- minWidth?: string;
33
+ 'aria-label'?: string;
34
+ 'data-testid'?: string;
53
35
  tooltip?: boolean;
54
36
  tooltipText?: string;
55
- width?: string;
56
- /** Força posição do dropdown: 'top' abre para cima, 'bottom' abre para baixo. Se não especificado, usa detecção automática */
57
- position?: 'top' | 'bottom';
58
- positionTooltip?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'left' | 'right';
59
- infiniteScroll?: {
60
- status: 'idle' | 'loading' | 'succeeded' | 'failed';
61
- page: number;
62
- lastPage: number;
63
- onLoadMore: () => void;
64
- threshold?: number;
65
- rootMargin?: string;
37
+ side?: "top" | "right" | "bottom" | "left";
38
+ align?: "start" | "center" | "end";
39
+ enableInfiniteScroll?: boolean;
40
+ onScrollEnd?: () => void;
41
+ isLoadingMore?: boolean;
42
+ enableApiSearch?: boolean;
43
+ onApiSearch?: (term: string) => void;
44
+ isSearching?: boolean;
45
+ }
46
+ export interface SelectState {
47
+ isOpen: boolean;
48
+ selectedValues: string[];
49
+ searchInput: string;
50
+ searchTerm: string;
51
+ touched: boolean;
52
+ hasError: boolean;
53
+ }
54
+ export type SelectAction = {
55
+ type: 'SET_OPEN';
56
+ payload: boolean;
57
+ } | {
58
+ type: 'SET_SELECTED_VALUES';
59
+ payload: string[];
60
+ } | {
61
+ type: 'SET_SEARCH_INPUT';
62
+ payload: string;
63
+ } | {
64
+ type: 'SET_SEARCH_TERM';
65
+ payload: string;
66
+ } | {
67
+ type: 'SET_TOUCHED';
68
+ payload: boolean;
69
+ } | {
70
+ type: 'SET_ERROR';
71
+ payload: boolean;
72
+ } | {
73
+ type: 'RESET_SEARCH';
74
+ } | {
75
+ type: 'VALIDATE';
76
+ payload: {
77
+ required: boolean;
78
+ };
79
+ };
80
+ export interface UseSelectLogicProps {
81
+ value?: string | string[];
82
+ required?: boolean;
83
+ search?: boolean;
84
+ onValueChange?: (value: string | string[]) => void;
85
+ onOpenChange?: (open: boolean) => void;
86
+ enableApiSearch?: boolean;
87
+ onApiSearch?: (term: string) => void;
88
+ isSearching?: boolean;
89
+ }
90
+ export interface UseSelectLogicReturn {
91
+ state: SelectState;
92
+ actions: {
93
+ setOpen: (open: boolean) => void;
94
+ setSelectedValues: (values: string[]) => void;
95
+ setSearchInput: (input: string) => void;
96
+ setSearchTerm: (term: string) => void;
97
+ setTouched: (touched: boolean) => void;
98
+ setError: (error: boolean) => void;
99
+ resetSearch: () => void;
100
+ validate: () => void;
101
+ handleSingleSelect: (value: string) => void;
102
+ handleMultipleSelect: (value: string, checked: boolean) => void;
103
+ };
104
+ computed: {
105
+ displayText: string;
106
+ filteredItems: SelectItemProps[];
107
+ };
108
+ refs: {
109
+ searchInputRef: React.RefObject<HTMLInputElement | null>;
110
+ };
111
+ utils: {
112
+ getDisplayText: (selectedValues: string[], placeholder: string, variant: string, items: SelectItemProps[]) => string;
113
+ getFilteredItems: (items: SelectItemProps[], searchTerm: string) => SelectItemProps[];
66
114
  };
67
115
  }
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { CheckboxItemProps } from '../SelectRadix.types';
2
+ import { CheckboxItemProps } from '../Select.types';
3
3
  declare const CheckboxSelectItem: React.FC<CheckboxItemProps>;
4
4
  export default CheckboxSelectItem;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { SelectItemProps, SelectVariant } from '../Select.types';
3
+ interface ExpandableSelectItemProps {
4
+ item: SelectItemProps;
5
+ variant: SelectVariant;
6
+ onSelect: (value: string) => void;
7
+ selectedValues: string[];
8
+ level?: number;
9
+ }
10
+ declare const ExpandableSelectItem: React.FC<ExpandableSelectItemProps>;
11
+ export default ExpandableSelectItem;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { SelectItemProps, SelectVariant } from '../SelectRadix.types';
2
+ import { SelectItemProps, SelectVariant } from '../Select.types';
3
3
  interface SelectItemComponentProps extends SelectItemProps {
4
4
  variant?: SelectVariant;
5
5
  }
@@ -1,3 +1,3 @@
1
- import { UseSelectLogicProps, UseSelectLogicReturn } from '../SelectRadix.types';
1
+ import { UseSelectLogicProps, UseSelectLogicReturn } from '../Select.types';
2
2
  export declare function useSelectLogic({ value, required, search, onValueChange, onOpenChange, enableApiSearch, onApiSearch, isSearching, }: UseSelectLogicProps): UseSelectLogicReturn;
3
3
  export default useSelectLogic;
@@ -1,2 +1,5 @@
1
1
  export { default } from './Select';
2
- export type { SelectProps, SelectOption } from './Select.types';
2
+ export type { SelectProps, SelectItemProps, CheckboxItemProps, SelectVariant, SelectState, SelectAction, UseSelectLogicProps, UseSelectLogicReturn } from './Select.types';
3
+ export { useSelectLogic } from './hooks/useSelectLogic';
4
+ export { default as CheckboxSelectItem } from './components/CheckboxSelectItem';
5
+ export { default as SelectItem } from './components/SelectItem';
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import { SwitchProps } from './Switch.types';
3
+ declare const Switch: React.FC<SwitchProps>;
4
+ export default Switch;
@@ -1,10 +1,8 @@
1
- export interface CheckboxRadixProps {
2
- id?: string;
3
- label: string;
4
- onCheckedChange?: (checked: boolean) => void;
1
+ export interface SwitchProps {
5
2
  defaultChecked?: boolean;
6
- checked?: boolean;
7
3
  disabled?: boolean;
8
- className?: string;
9
- indeterminate?: boolean;
4
+ onCheckedChange?: (checked: boolean) => void;
5
+ name?: string;
6
+ value?: string;
7
+ checked?: boolean;
10
8
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default } from './Switch';
2
+ export type { SwitchProps } from './Switch.types';
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
- import type { TableProps } from './Table.types';
3
- declare const Table: React.FC<TableProps>;
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;
4
3
  export default Table;
@@ -1,35 +1,71 @@
1
1
  import { ReactNode, CSSProperties } from 'react';
2
+ /**
3
+ * Tipo base para dados da tabela. Use `<Table<SeuTipo>>` para type-safety completo.
4
+ * @example <Table<User> dataSource={users} />
5
+ */
6
+ export type TableRowData = Record<string, any>;
7
+ /** Tipos de coluna suportados */
2
8
  export type TableColumnType = 'text' | 'datetime' | 'custom';
9
+ /** Opções de alinhamento de coluna */
3
10
  export type TableAlign = 'left' | 'center' | 'right';
4
- export interface TableColumn {
11
+ /**
12
+ * Configuração de coluna da tabela
13
+ * @typeParam T - Tipo dos dados da linha
14
+ */
15
+ export interface TableColumn<T = TableRowData> {
16
+ /** Chave única identificadora da coluna */
5
17
  key: string;
18
+ /** Conteúdo do cabeçalho da coluna */
6
19
  label: ReactNode;
20
+ /** Tipo de dados da coluna */
7
21
  type?: TableColumnType;
22
+ /** Formato de exibição (ex: 'dd/MM/yyyy' para datetime) */
8
23
  format?: string;
9
- render?: (row: TableRowData, index: number) => ReactNode;
24
+ /** Função customizada para renderizar o conteúdo da célula */
25
+ render?: (row: T, index: number) => ReactNode;
26
+ /** Alinhamento do conteúdo */
10
27
  align?: TableAlign;
28
+ /** Estilos CSS customizados */
11
29
  style?: CSSProperties;
12
30
  }
13
- export type TableRowData = Record<string, any>;
14
- export interface TableProps {
15
- columns: TableColumn[];
16
- dataSource: TableRowData[];
31
+ /**
32
+ * Props do componente Table. Use genérico para autocomplete: `<Table<User>>`
33
+ * @typeParam T - Tipo dos dados da linha
34
+ */
35
+ export interface TableProps<T = TableRowData> {
36
+ /** Configuração das colunas */
37
+ columns: TableColumn<T>[];
38
+ /** Array de dados a serem exibidos */
39
+ dataSource: T[];
40
+ /** Classe CSS customizada */
17
41
  className?: string;
42
+ /** Estado de carregamento */
18
43
  loading?: boolean;
44
+ /** Configuração de seleção de linhas */
19
45
  rowSelection?: {
46
+ /** Keys das linhas selecionadas (modo controlado) */
20
47
  selectedRowKeys?: (string | number)[];
21
- onChange?: (keys: (string | number)[], rows: TableRowData[]) => void;
22
- getCheckboxProps?: (row: TableRowData, index: number) => {
48
+ /** Callback quando seleção muda: (keys, rows) => void */
49
+ onChange?: (keys: (string | number)[], rows: T[]) => void;
50
+ /** Customiza props dos checkboxes: (row, index) => { disabled? } */
51
+ getCheckboxProps?: (row: T, index: number) => {
23
52
  disabled?: boolean;
24
53
  };
54
+ /** Desabilita o checkbox "selecionar todos" */
55
+ disableSelectAll?: boolean;
25
56
  };
57
+ /** Configurações de localização */
26
58
  locale?: {
59
+ /** Texto quando não há dados */
27
60
  emptyText?: ReactNode;
28
61
  };
29
- /** Eventos de linha */
30
- onRow?: (row: TableRowData, index: number) => {
62
+ /** Eventos de linha: (row, index) => { onClick?, onDoubleClick?, className? } */
63
+ onRow?: (row: T, index: number) => {
64
+ /** Clique simples na linha */
31
65
  onClick?: () => void;
66
+ /** Clique duplo na linha */
32
67
  onDoubleClick?: () => void;
68
+ /** Classe CSS da linha */
33
69
  className?: string;
34
70
  };
35
71
  }
@@ -1,6 +1,6 @@
1
1
  export { default } from './Table';
2
2
  export { default as Table } from './Table';
3
- export type { TableProps, TableColumn, TableRowData, } from './Table.types';
3
+ export type { TableProps, TableColumn, TableRowData, TableColumnType, TableAlign, } from './Table.types';
4
4
  export { default as TableHeader } from './TableHeader';
5
5
  export type { TableHeaderProps } from './TableHeader';
6
6
  export { default as TablePagination } from './TablePagination';
@@ -16,9 +16,8 @@ export interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInput
16
16
  tooltip?: boolean;
17
17
  /** Tooltip content */
18
18
  tooltipText?: string;
19
- /** Tooltip position */
20
- positionTooltip?: TooltipPosition;
21
- /** Custom error message for validation */
19
+ side?: "top" | "right" | "bottom" | "left";
20
+ align?: "start" | "center" | "end";
22
21
  errorMessage?: string;
23
22
  /** Leading icon */
24
23
  icon?: React.ReactNode;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import type { TooltipProps } from './Tooltip.types';
2
+ import { TooltipProps } from './Tooltip.types';
3
3
  declare const Tooltip: React.FC<TooltipProps>;
4
4
  export default Tooltip;