@giro-ds/react 2.0.0 → 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 (39) 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/Menu/Menu.d.ts +1 -1
  5. package/dist/components/Menu/Menu.types.d.ts +25 -34
  6. package/dist/components/Menu/__tests__/Menu.test.d.ts +1 -0
  7. package/dist/components/{MenuRadix → Menu}/components/MenuItem.d.ts +1 -6
  8. package/dist/components/{MenuRadix → Menu}/hooks/useMenuLogic.d.ts +1 -1
  9. package/dist/components/{MenuRadix → Menu}/hooks/useSearchLogic.d.ts +1 -1
  10. package/dist/components/Menu/index.d.ts +1 -1
  11. package/dist/components/Search/Search.types.d.ts +1 -0
  12. package/dist/components/Select/Select.d.ts +2 -2
  13. package/dist/components/Select/Select.types.d.ts +100 -52
  14. package/dist/components/Select/__tests__/SelectRadix.test.d.ts +1 -0
  15. package/dist/components/{SelectRadix → Select}/components/CheckboxSelectItem.d.ts +1 -1
  16. package/dist/components/Select/components/ExpandableSelectItem.d.ts +11 -0
  17. package/dist/components/{SelectRadix → Select}/components/SelectItem.d.ts +1 -1
  18. package/dist/components/{SelectRadix → Select}/hooks/useSelectLogic.d.ts +1 -1
  19. package/dist/components/Select/index.d.ts +4 -1
  20. package/dist/components/Switch/Switch.types.d.ts +2 -2
  21. package/dist/components/Table/Table.d.ts +2 -3
  22. package/dist/components/Table/Table.types.d.ts +46 -10
  23. package/dist/components/Table/index.d.ts +1 -1
  24. package/dist/components/index.d.ts +2 -8
  25. package/dist/index.cjs +232 -682
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.ts +62 -192
  28. package/dist/index.esm.js +235 -682
  29. package/dist/index.esm.js.map +1 -1
  30. package/dist/styles.css +1 -1
  31. package/package.json +3 -2
  32. package/dist/components/MenuRadix/MenuRadix.d.ts +0 -4
  33. package/dist/components/MenuRadix/MenuRadix.types.d.ts +0 -27
  34. package/dist/components/MenuRadix/index.d.ts +0 -2
  35. package/dist/components/SelectField/SelectField.d.ts +0 -4
  36. package/dist/components/SelectField/SelectField.types.d.ts +0 -35
  37. package/dist/components/SelectRadix/SelectRadix.d.ts +0 -4
  38. package/dist/components/SelectRadix/SelectRadix.types.d.ts +0 -114
  39. package/dist/components/SelectRadix/index.d.ts +0 -5
package/dist/index.d.ts CHANGED
@@ -32,50 +32,30 @@ interface BadgeProps {
32
32
 
33
33
  declare const Badge: React__default.FC<BadgeProps>;
34
34
 
35
- interface ButtonProps {
36
- /** Define o elemento a ser renderizado (ex: 'button', 'a', ou componente de roteamento) */
35
+ interface ButtonProps extends React__default.HTMLAttributes<HTMLElement> {
37
36
  as?: React__default.ElementType;
38
- /** Define o texto principal do botão */
39
37
  children?: React__default.ReactNode;
40
- /** Define tipo do botão entre as opções */
41
38
  variant?: 'filled' | 'outlined' | 'text';
42
39
  iconOnly?: boolean;
43
- /** Define a posição do ícone entre as opções */
44
- iconPosition?: 'none' | 'left' | 'right';
45
- /** URL para links externos (ex: https://example.com) */
40
+ iconPosition?: 'left' | 'right' | 'both';
46
41
  href?: string;
47
- /** Rota interna para navegação SPA (ex: /dashboard, /profile) */
48
42
  to?: string;
49
- /** Indica se o link é externo */
50
43
  external?: boolean;
51
- /** Target para links (_blank, _self, etc.) */
52
44
  target?: string;
53
- /** Rel attribute para links */
54
45
  rel?: string;
55
- /** Props para React Router (replace, state, etc.) */
56
- routerProps?: Record<string, any>;
57
46
  type?: 'button' | 'submit' | 'reset';
58
- /** Desabilita interações do botão */
59
47
  disabled?: boolean;
60
- /** Função a ser chamada quando o botão é clicado */
61
48
  onClick?: (event: React__default.MouseEvent<HTMLElement>) => void;
62
- /** Define o tamanho do botão entre as opções */
63
49
  size?: 'lg' | 'sm';
64
- /** Classe CSS opcional */
65
50
  className?: string;
66
- /** ID opcional */
67
51
  id?: string;
68
- /** Ícone opcional */
69
52
  icon?: React__default.ReactNode;
70
- /** Define se o botão deve ocupar toda a largura */
71
53
  fullWidth?: boolean;
72
- /** Texto para acessibilidade */
73
54
  ariaLabel?: string;
74
- /** Outros props específicos do elemento/componente */
75
- [key: string]: any;
55
+ loading?: boolean;
76
56
  }
77
57
 
78
- declare const Button: React__default.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React__default.RefAttributes<HTMLElement>>;
58
+ declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<HTMLElement>>;
79
59
 
80
60
  type Locale = 'pt-br' | 'en-us';
81
61
  type DateFormat = 'dd/mm/yyyy' | 'mm/dd/yyyy';
@@ -427,49 +407,6 @@ interface ListItemProps {
427
407
  */
428
408
  declare const ListItem: React__default.FC<ListItemProps>;
429
409
 
430
- interface MenuItem {
431
- /** ID único do item */
432
- id: string;
433
- /** Texto principal do item */
434
- text: string;
435
- /** Texto secundário opcional */
436
- subText?: string;
437
- /** Ícone do item */
438
- icon?: ReactNode;
439
- /** Estado desabilitado */
440
- disabled?: boolean;
441
- /** Valor customizado do item */
442
- value?: unknown;
443
- }
444
- interface MenuProps {
445
- /** Elemento React que será usado como âncora do menu (obrigatório) */
446
- children: ReactElement<any, any>;
447
- /** Array de itens do menu */
448
- menuItems?: MenuItem[];
449
- /** Callback executado quando um item do menu é clicado */
450
- onMenuItemClick?: (item: MenuItem) => void;
451
- /** Callback executado quando o menu é aberto/fechado */
452
- onToggle?: (isOpen: boolean) => void;
453
- /** Tipo do dropdown */
454
- type?: 'text' | 'icon';
455
- /** Habilita campo de busca */
456
- applySearch?: boolean;
457
- /** Placeholder do campo de busca */
458
- placeholder?: string;
459
- /** Controla exibição do subtexto */
460
- showSubText?: boolean;
461
- /** Classes CSS adicionais */
462
- className?: string;
463
- /** ID único do componente */
464
- id?: string;
465
- maxWidth?: string | number;
466
- minWidth?: string | number;
467
- /** Posição do menu em relação ao elemento âncora */
468
- position?: 'left' | 'right';
469
- }
470
-
471
- declare const Menu: React__default.FC<MenuProps>;
472
-
473
410
  interface MenuItemProps {
474
411
  id?: string;
475
412
  text?: string;
@@ -479,7 +416,7 @@ interface MenuItemProps {
479
416
  children?: MenuItemProps[];
480
417
  value?: string;
481
418
  }
482
- interface MenuRadixProps {
419
+ interface MenuProps {
483
420
  items: MenuItemProps[];
484
421
  children?: ReactElement;
485
422
  type?: 'text' | 'icon';
@@ -497,7 +434,7 @@ interface MenuRadixProps {
497
434
  onOpenChange?: (open: boolean) => void;
498
435
  }
499
436
 
500
- declare const MenuRadix: React__default.FC<MenuRadixProps>;
437
+ declare const Menu: React__default.FC<MenuProps>;
501
438
 
502
439
  interface QuantityProps {
503
440
  /** Valor padrão inicial */
@@ -553,115 +490,11 @@ interface SearchProps {
553
490
  onMouseDown?: (e: React__default.MouseEvent<HTMLDivElement>) => void;
554
491
  className?: string;
555
492
  id?: string;
493
+ 'data-testid'?: string;
556
494
  }
557
495
 
558
496
  declare const Search: React__default.ForwardRefExoticComponent<SearchProps & React__default.RefAttributes<HTMLInputElement>>;
559
497
 
560
- interface SelectOption {
561
- /** ID único da opção (opcional, será gerado automaticamente se não fornecido) */
562
- id?: string;
563
- /** Texto principal da opção */
564
- text: string;
565
- /** Texto secundário/descrição da opção */
566
- subText?: string;
567
- /** Ícone da opção (React node) */
568
- icon?: React__default.ReactNode;
569
- /** Define se a opção está desabilitada */
570
- disabled?: boolean;
571
- }
572
- interface SelectProps {
573
- /** ID único do componente */
574
- id?: string;
575
- /** Array de opções para seleção - obrigatório */
576
- options: SelectOption[];
577
- /** Valor(es) selecionado(s) */
578
- value?: string | string[];
579
- /** Valor inicial para seleção (usado apenas na primeira renderização) */
580
- initialValue?: string | string[];
581
- /** Callback para mudanças na seleção */
582
- onChange?: (selectedItems: SelectOption[]) => void;
583
- /** Placeholder do campo */
584
- placeholder?: string;
585
- /** Tipo do dropdown (single ou multiple) */
586
- type?: DropdownType;
587
- maxHeight?: string;
588
- /** Label do campo */
589
- label?: string;
590
- /** Texto de ajuda */
591
- helperText?: string;
592
- /** Mensagem de erro */
593
- errorMessage?: string;
594
- /** Campo obrigatório */
595
- required?: boolean;
596
- /** Campo desabilitado */
597
- disabled?: boolean;
598
- /** Classes CSS adicionais */
599
- className?: string;
600
- /** Texto para acessibilidade */
601
- showSubText?: boolean;
602
- /** Aria-label do campo */
603
- ariaLabel?: string;
604
- /** Habilita campo de busca */
605
- applySearch?: boolean;
606
- /** Placeholder do campo de busca */
607
- searchPlaceholder?: string;
608
- maxWidth?: string;
609
- minWidth?: string;
610
- tooltip?: boolean;
611
- tooltipText?: string;
612
- width?: string;
613
- /** Força posição do dropdown: 'top' abre para cima, 'bottom' abre para baixo. Se não especificado, usa detecção automática */
614
- position?: 'top' | 'bottom';
615
- positionTooltip?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'left' | 'right';
616
- infiniteScroll?: {
617
- status: 'idle' | 'loading' | 'succeeded' | 'failed';
618
- page: number;
619
- lastPage: number;
620
- onLoadMore: () => void;
621
- threshold?: number;
622
- rootMargin?: string;
623
- };
624
- }
625
-
626
- declare const Select: React__default.NamedExoticComponent<SelectProps>;
627
-
628
- interface SelectFieldProps {
629
- /** ID do campo */
630
- id?: string;
631
- /** Nome do campo */
632
- name?: string;
633
- /** Valor exibido */
634
- value?: string;
635
- /** Placeholder */
636
- placeholder?: string;
637
- /** Label do campo */
638
- label?: string;
639
- /** Texto de ajuda */
640
- helperText?: string;
641
- /** Mensagem de erro */
642
- errorMessage?: string;
643
- /** Campo obrigatório */
644
- required?: boolean;
645
- /** Campo desabilitado */
646
- disabled?: boolean;
647
- /** Ícone (chevron) */
648
- icon?: React__default.ReactNode;
649
- /** Estado aberto */
650
- isOpen?: boolean;
651
- /** Classes CSS adicionais */
652
- className?: string;
653
- /** Tooltip info */
654
- tooltip?: React__default.ReactNode;
655
- tooltipText?: string;
656
- positionTooltip?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'left' | 'right';
657
- /** Indica se o campo foi "tocado" (aberto e fechado) */
658
- isTouched?: boolean;
659
- /** Força estado de erro independente da validação interna */
660
- hasError?: boolean;
661
- }
662
-
663
- declare const SelectField: React__default.ForwardRefExoticComponent<SelectFieldProps & React__default.RefAttributes<HTMLDivElement>>;
664
-
665
498
  interface SelectItemProps {
666
499
  id?: string;
667
500
  text: ReactNode;
@@ -670,9 +503,10 @@ interface SelectItemProps {
670
503
  disabled?: boolean;
671
504
  value: string;
672
505
  selected?: boolean;
506
+ children?: SelectItemProps[];
673
507
  }
674
508
  type SelectVariant = 'text' | 'icon' | 'checkbox';
675
- interface SelectRadixProps {
509
+ interface SelectProps {
676
510
  items: SelectItemProps[];
677
511
  onValueChange?: (value: string | string[]) => void;
678
512
  onOpenChange?: (open: boolean) => void;
@@ -684,7 +518,7 @@ interface SelectRadixProps {
684
518
  search?: boolean;
685
519
  label?: string;
686
520
  helperText?: string;
687
- maxWidth?: string | number;
521
+ maxWidth?: number;
688
522
  errorMessage?: string;
689
523
  disabled?: boolean;
690
524
  className?: string;
@@ -702,44 +536,80 @@ interface SelectRadixProps {
702
536
  isSearching?: boolean;
703
537
  }
704
538
 
705
- declare const SelectRadix: React__default.FC<SelectRadixProps>;
539
+ declare const Select: React__default.FC<SelectProps>;
706
540
 
541
+ /**
542
+ * Tipo base para dados da tabela. Use `<Table<SeuTipo>>` para type-safety completo.
543
+ * @example <Table<User> dataSource={users} />
544
+ */
545
+ type TableRowData = Record<string, any>;
546
+ /** Tipos de coluna suportados */
707
547
  type TableColumnType = 'text' | 'datetime' | 'custom';
548
+ /** Opções de alinhamento de coluna */
708
549
  type TableAlign = 'left' | 'center' | 'right';
709
- interface TableColumn {
550
+ /**
551
+ * Configuração de coluna da tabela
552
+ * @typeParam T - Tipo dos dados da linha
553
+ */
554
+ interface TableColumn<T = TableRowData> {
555
+ /** Chave única identificadora da coluna */
710
556
  key: string;
557
+ /** Conteúdo do cabeçalho da coluna */
711
558
  label: ReactNode;
559
+ /** Tipo de dados da coluna */
712
560
  type?: TableColumnType;
561
+ /** Formato de exibição (ex: 'dd/MM/yyyy' para datetime) */
713
562
  format?: string;
714
- render?: (row: TableRowData, index: number) => ReactNode;
563
+ /** Função customizada para renderizar o conteúdo da célula */
564
+ render?: (row: T, index: number) => ReactNode;
565
+ /** Alinhamento do conteúdo */
715
566
  align?: TableAlign;
567
+ /** Estilos CSS customizados */
716
568
  style?: CSSProperties;
717
569
  }
718
- type TableRowData = Record<string, any>;
719
- interface TableProps {
720
- columns: TableColumn[];
721
- dataSource: TableRowData[];
570
+ /**
571
+ * Props do componente Table. Use genérico para autocomplete: `<Table<User>>`
572
+ * @typeParam T - Tipo dos dados da linha
573
+ */
574
+ interface TableProps<T = TableRowData> {
575
+ /** Configuração das colunas */
576
+ columns: TableColumn<T>[];
577
+ /** Array de dados a serem exibidos */
578
+ dataSource: T[];
579
+ /** Classe CSS customizada */
722
580
  className?: string;
581
+ /** Estado de carregamento */
723
582
  loading?: boolean;
583
+ /** Configuração de seleção de linhas */
724
584
  rowSelection?: {
585
+ /** Keys das linhas selecionadas (modo controlado) */
725
586
  selectedRowKeys?: (string | number)[];
726
- onChange?: (keys: (string | number)[], rows: TableRowData[]) => void;
727
- getCheckboxProps?: (row: TableRowData, index: number) => {
587
+ /** Callback quando seleção muda: (keys, rows) => void */
588
+ onChange?: (keys: (string | number)[], rows: T[]) => void;
589
+ /** Customiza props dos checkboxes: (row, index) => { disabled? } */
590
+ getCheckboxProps?: (row: T, index: number) => {
728
591
  disabled?: boolean;
729
592
  };
593
+ /** Desabilita o checkbox "selecionar todos" */
594
+ disableSelectAll?: boolean;
730
595
  };
596
+ /** Configurações de localização */
731
597
  locale?: {
598
+ /** Texto quando não há dados */
732
599
  emptyText?: ReactNode;
733
600
  };
734
- /** Eventos de linha */
735
- onRow?: (row: TableRowData, index: number) => {
601
+ /** Eventos de linha: (row, index) => { onClick?, onDoubleClick?, className? } */
602
+ onRow?: (row: T, index: number) => {
603
+ /** Clique simples na linha */
736
604
  onClick?: () => void;
605
+ /** Clique duplo na linha */
737
606
  onDoubleClick?: () => void;
607
+ /** Classe CSS da linha */
738
608
  className?: string;
739
609
  };
740
610
  }
741
611
 
742
- declare const Table: React__default.FC<TableProps>;
612
+ declare const Table: <T extends TableRowData = TableRowData>({ columns, dataSource, className, loading, rowSelection, locale, onRow, }: TableProps<T>) => react_jsx_runtime.JSX.Element | null;
743
613
 
744
614
  interface BaseFilterItem {
745
615
  id?: string;
@@ -868,8 +738,8 @@ interface TooltipProps {
868
738
  declare const Tooltip: React__default.FC<TooltipProps>;
869
739
 
870
740
  interface SwitchProps {
871
- defaultChecked: boolean;
872
- disabled: boolean;
741
+ defaultChecked?: boolean;
742
+ disabled?: boolean;
873
743
  onCheckedChange?: (checked: boolean) => void;
874
744
  name?: string;
875
745
  value?: string;
@@ -1012,5 +882,5 @@ declare function useInfiniteScroll({ status, page, lastPage, onLoadMore, thresho
1012
882
 
1013
883
  declare const normalizeText: (text: React.ReactNode) => string;
1014
884
 
1015
- export { Avatar, Badge, Button, MemoizedCalendar as Calendar, Callout, Checkbox, MemoizedChips as Chips, Container, _default$1 as DatePicker, MemoizedDialog as Dialog, Drawer, MemoizedDropdown as Dropdown, Filter, ListItem, Menu, MenuRadix, memorizedQuantity as Quantity, Radio, Search, Select, SelectField, SelectRadix, Switch, Table, TableHeader, TablePagination, _default as TextField, ToastProvider as Toast, ToastProvider, Tooltip, VerificationCode, normalizeText, useApiSimulation, useInfiniteScroll, useToast };
1016
- export type { AvatarProps, BadgeProps, ButtonProps, CalendarItem, CalendarProps, CalloutProps, CheckboxProps, ChipsProps, ContainerProps, DateFormat, DatePickerProps, DayItem, DialogProps, DrawerProps, DropdownItem, DropdownProps, DropdownType, EmptyItem, FilterItem, FilterProps, ListItemProps, Locale, MenuItem, MenuProps, MenuRadixProps, QuantityProps, RadioGroupProps, RadioProps, SearchProps, SelectFieldProps, SelectOption, SelectProps, SelectRadixProps, SwitchProps, TableHeaderProps, TablePaginationProps, TableProps, TextFieldProps, ToastContextType, ToastMessage, ToastOptions, ToastType, TooltipProps, VerificationCodeProps, YearItem };
885
+ export { Avatar, Badge, Button, MemoizedCalendar as Calendar, Callout, Checkbox, MemoizedChips as Chips, Container, _default$1 as DatePicker, MemoizedDialog as Dialog, Drawer, MemoizedDropdown as Dropdown, Filter, ListItem, Menu, memorizedQuantity as Quantity, Radio, Search, Select, Switch, Table, TableHeader, TablePagination, _default as TextField, ToastProvider as Toast, ToastProvider, Tooltip, VerificationCode, normalizeText, useApiSimulation, useInfiniteScroll, useToast };
886
+ export type { AvatarProps, BadgeProps, ButtonProps, CalendarItem, CalendarProps, CalloutProps, CheckboxProps, ChipsProps, ContainerProps, DateFormat, DatePickerProps, DayItem, DialogProps, DrawerProps, DropdownItem, DropdownProps, DropdownType, EmptyItem, FilterItem, FilterProps, ListItemProps, Locale, MenuProps, QuantityProps, RadioGroupProps, RadioProps, SearchProps, SelectProps, SwitchProps, TableHeaderProps, TablePaginationProps, TableProps, TextFieldProps, ToastContextType, ToastMessage, ToastOptions, ToastType, TooltipProps, VerificationCodeProps, YearItem };