@giro-ds/react 3.0.7 → 4.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 (38) hide show
  1. package/dist/components/Avatar/Avatar.d.ts +2 -1
  2. package/dist/components/Avatar/Avatar.types.d.ts +12 -12
  3. package/dist/components/Avatar/__tests__/Avatar.test.d.ts +1 -0
  4. package/dist/components/Avatar/index.d.ts +1 -0
  5. package/dist/components/Button/Button.types.d.ts +6 -0
  6. package/dist/components/Calendar/Calendar.d.ts +3 -7
  7. package/dist/components/Calendar/Calendar.types.d.ts +102 -79
  8. package/dist/components/Calendar/__tests__/Calendar.test.d.ts +1 -0
  9. package/dist/components/Container/__tests__/Container.test.d.ts +1 -0
  10. package/dist/components/Dialog/Dialog.d.ts +4 -4
  11. package/dist/components/Dialog/Dialog.types.d.ts +17 -37
  12. package/dist/components/Dialog/__tests__/Dialog.test.d.ts +1 -0
  13. package/dist/components/Popover/Popover.d.ts +4 -0
  14. package/dist/components/Popover/Popover.types.d.ts +8 -0
  15. package/dist/components/Popover/__test__/Popover.test.d.ts +1 -0
  16. package/dist/components/Popover/index.d.ts +2 -0
  17. package/dist/components/Search/Search.types.d.ts +4 -1
  18. package/dist/components/Search/__tests__/Search.test.d.ts +1 -0
  19. package/dist/components/Toast/Toast.d.ts +34 -13
  20. package/dist/components/Toast/Toast.types.d.ts +50 -52
  21. package/dist/components/Toast/__tests__/Toast.test.d.ts +1 -0
  22. package/dist/components/Toast/components/ToastContainer.d.ts +22 -0
  23. package/dist/components/Toast/components/ToastProvider.d.ts +35 -0
  24. package/dist/components/Toast/index.d.ts +5 -2
  25. package/dist/components/Tooltip/Tooltip.types.d.ts +1 -26
  26. package/dist/components/index.d.ts +6 -4
  27. package/dist/contexts/ToastContext.d.ts +43 -0
  28. package/dist/hooks/useToast.d.ts +46 -0
  29. package/dist/index.cjs +4296 -5738
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.ts +315 -193
  32. package/dist/index.esm.js +4275 -5719
  33. package/dist/index.esm.js.map +1 -1
  34. package/dist/styles.css +1 -1
  35. package/package.json +3 -2
  36. package/dist/components/Calendar/i18n.d.ts +0 -56
  37. package/dist/components/Dialog/utils/DialogUtils.d.ts +0 -1
  38. /package/dist/components/Container/{index.d.ts → Container.d.ts} +0 -0
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import type { AvatarProps } from './Avatar.types';
2
- declare let Avatar: ({ id, icon, size, className, ...rest }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
3
+ declare const Avatar: React.FC<AvatarProps>;
3
4
  export default Avatar;
@@ -1,23 +1,23 @@
1
1
  import * as React from 'react';
2
- import { Size, BaseProps } from '../../types';
2
+ import { BaseProps, Size } from '../../types';
3
3
  /**
4
4
  * Props do componente Avatar
5
5
  * @example
6
6
  * ```tsx
7
+ * // Avatar com ícone
7
8
  * <Avatar icon={<UserIcon />} size="lg" />
8
- * ```
9
- * @example
10
- * ```tsx
11
- * <Avatar
12
- * icon={<ProfileIcon />}
13
- * size="sm"
14
- * className="custom-avatar"
15
- * />
9
+ *
10
+ * // Avatar com imagem
11
+ * <Avatar src="https://example.com/avatar.jpg" icon={<UserIcon />} size="sm" />
16
12
  * ```
17
13
  */
18
14
  export interface AvatarProps extends BaseProps {
19
- /** Ícone ou conteúdo a ser exibido no avatar */
20
- icon: React.ReactNode;
21
- /** Tamanho do avatar */
15
+ /** Ícone ou conteúdo a ser exibido no fallback quando não há imagem ou ela falha ao carregar */
16
+ icon?: React.ReactNode;
17
+ /** Tamanho do avatar: 'sm' (32px) ou 'lg' (44px). @default 'lg' */
22
18
  size?: Size;
19
+ /** URL da imagem do avatar. Quando fornecido, exibe a imagem; caso contrário, mostra o ícone */
20
+ src?: string;
21
+ /** Texto alternativo da imagem do avatar, usado como as iniciais do nome */
22
+ initialLetters?: string;
23
23
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,2 @@
1
1
  export { default } from './Avatar';
2
+ export type { AvatarProps } from './Avatar.types';
@@ -53,4 +53,10 @@ export interface ButtonProps extends BaseProps, React.HTMLAttributes<HTMLElement
53
53
  ariaLabel?: string;
54
54
  /** Estado de carregamento (exibe spinner) */
55
55
  loading?: boolean;
56
+ /** Texto do tooltip exibido quando o botão é apenas ícone */
57
+ tooltipText?: string;
58
+ /** Lado em que o tooltip será exibido */
59
+ tooltipSide?: 'top' | 'bottom' | 'left' | 'right';
60
+ /** Alinhamento do tooltip */
61
+ tooltipAlign?: 'start' | 'center' | 'end';
56
62
  }
@@ -1,7 +1,3 @@
1
- import React from 'react';
2
- import './i18n';
3
- import type { DateFormat, CalendarProps } from './Calendar.types';
4
- import { Locale } from '../../types/common.types';
5
- declare const MemoizedCalendar: React.NamedExoticComponent<CalendarProps>;
6
- export default MemoizedCalendar;
7
- export type { CalendarProps, Locale, DateFormat };
1
+ import type { CalendarProps } from "./Calendar.types";
2
+ declare const Calendar: ({ selected, selectedDate, currentDate, defaultMonth, startMonth, endMonth, numberOfMonths, onDaySelect, onDateChange, onClear: _onClear, minDate, maxDate, disabled, hidden, format: _format, locale, captionLayout, reverseYears, fixedWeeks, showOutsideDays, showWeekNumber, hideNavigation, disableNavigation, navLayout, role, title, animate, timeZone, modifiers, modifiersClassNames, footer, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, }: CalendarProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default Calendar;
@@ -1,86 +1,109 @@
1
- import { Locale, BaseProps } from '../../types/common.types';
2
- /** Formatos de exibição de data disponíveis */
3
- export type DateFormat = 'dd/mm/yyyy' | 'mm/dd/yyyy';
4
- /**
5
- * Representa um dia no calendário
6
- */
7
- export interface DayItem {
8
- /** Tipo do item (sempre 'day') */
9
- type: 'day';
10
- /** Chave única para renderização */
11
- key: number;
12
- /** Número do dia */
13
- day: number;
14
- /** Objeto Date completo */
15
- date: Date;
16
- /** Indica se é o dia atual */
17
- isToday: boolean;
18
- /** Indica se o dia está selecionado */
19
- isSelected: boolean;
20
- /** Label acessível do dia */
21
- label: string;
22
- }
23
- /**
24
- * Representa um espaço vazio no grid do calendário
25
- */
26
- export interface EmptyItem {
27
- /** Tipo do item (sempre 'empty') */
28
- type: 'empty';
29
- /** Chave única para renderização */
30
- key: string;
31
- }
32
- /** Item do calendário (pode ser um dia ou espaço vazio) */
33
- export type CalendarItem = DayItem | EmptyItem;
34
- /**
35
- * Representa um ano na visualização de seleção de ano
36
- */
37
- export interface YearItem {
38
- /** Número do ano */
39
- year: number;
40
- /** Indica se é o ano atual */
41
- isCurrent: boolean;
42
- /** Chave única para renderização */
43
- key: number;
44
- }
45
- /**
46
- * Props do componente Calendar
47
- * @example
48
- * ```tsx
49
- * <Calendar
50
- * currentDate={new Date()}
51
- * onDateChange={(date) => console.log(date)}
52
- * locale="pt-br"
53
- * />
54
- * ```
55
- * @example
56
- * ```tsx
57
- * <Calendar
58
- * currentDate={new Date()}
59
- * selectedDate={selectedDate}
60
- * onDaySelect={handleDaySelect}
61
- * minDate={new Date('2024-01-01')}
62
- * maxDate={new Date('2024-12-31')}
63
- * format="dd/mm/yyyy"
64
- * />
65
- * ```
66
- */
67
- export interface CalendarProps extends BaseProps {
68
- /** Data do dia atual */
69
- currentDate: Date | null;
70
- /** Dia selecionado pelo usuário */
1
+ import React from 'react';
2
+ import type { Matcher } from 'react-day-picker';
3
+ import type { BaseProps, Locale } from '../../types/common.types';
4
+ /** Formato de exibição da data aceito pelo componente. */
5
+ export type DateFormat = 'dd/mm/yyyy' | 'mm/dd/yyyy' | (string & {});
6
+ export interface CalendarProps extends Omit<BaseProps, 'disabled'> {
7
+ /** Data selecionada atualmente (usada pelo DatePicker). */
8
+ selected?: Date | null;
9
+ /** Data selecionada atualmente (usada pelo Filter). */
71
10
  selectedDate?: Date | null;
72
- /** Callback executado quando a data escolhida é alterada: (date) => void */
73
- onDateChange?: (date: Date) => void;
74
- /** Callback executado quando um dia é selecionado: (date) => void */
11
+ /**
12
+ * Mês exibido no calendário. Use junto com `onDateChange` para
13
+ * controlar a navegação externamente.
14
+ */
15
+ currentDate?: Date | null;
16
+ /**
17
+ * Mês inicial padrão exibido quando não controlado.
18
+ * @default currentMonth
19
+ */
20
+ defaultMonth?: Date;
21
+ /** Primeiro mês navegável. */
22
+ startMonth?: Date;
23
+ /** Último mês navegável. */
24
+ endMonth?: Date;
25
+ /** Número de meses exibidos simultaneamente. @default 1 */
26
+ numberOfMonths?: number;
27
+ /** Chamado quando o usuário seleciona um dia. */
75
28
  onDaySelect?: (date: Date) => void;
76
- /** Callback executado ao limpar a seleção: () => void */
29
+ /** Chamado quando o usuário navega entre meses. */
30
+ onDateChange?: (date: Date) => void;
31
+ /** Chamado quando o usuário limpa a seleção. */
77
32
  onClear?: () => void;
78
- /** Data mínima selecionável */
33
+ /** Data mínima selecionável. */
79
34
  minDate?: Date;
80
- /** Data máxima selecionável */
35
+ /** Data máxima selecionável. */
81
36
  maxDate?: Date;
82
- /** Locale do calendário */
83
- locale?: Locale;
84
- /** Formato de exibição da data */
37
+ /**
38
+ * Dias desabilitados — aceita qualquer `Matcher` do react-day-picker
39
+ * (Date, DateRange, DateBefore, DateAfter, DayOfWeek, função…).
40
+ */
41
+ disabled?: Matcher | Matcher[];
42
+ /**
43
+ * Dias ocultados — aceita qualquer `Matcher` do react-day-picker.
44
+ */
45
+ hidden?: Matcher | Matcher[];
46
+ /**
47
+ * Formato de exibição da data.
48
+ * @example 'dd/mm/yyyy' | 'mm/dd/yyyy'
49
+ */
85
50
  format?: DateFormat;
51
+ /**
52
+ * Locale da interface — aceita os códigos internos do design system.
53
+ * @default 'pt-br'
54
+ */
55
+ locale?: Locale;
56
+ /**
57
+ * Layout do cabeçalho do calendário.
58
+ * - `'label'` — exibe mês/ano como texto (padrão).
59
+ * - `'dropdown'` — exibe dropdowns para mês e ano.
60
+ * - `'dropdown-months'` — dropdown apenas para mês.
61
+ * - `'dropdown-years'` — dropdown apenas para ano.
62
+ */
63
+ captionLayout?: 'dropdown' | 'label' | 'dropdown-months' | 'dropdown-years';
64
+ /** Inverte a ordem dos anos no dropdown. */
65
+ reverseYears?: boolean;
66
+ /** Sempre exibe 6 semanas por mês, preenchendo com dias do mês seguinte. */
67
+ fixedWeeks?: boolean;
68
+ /** Exibe os dias pertencentes ao mês anterior/próximo. */
69
+ showOutsideDays?: boolean;
70
+ /** Exibe a coluna com o número da semana. */
71
+ showWeekNumber?: boolean;
72
+ /** Oculta os botões de navegação (sem desabilitar a navegação). */
73
+ hideNavigation?: boolean;
74
+ /** Desabilita a navegação entre meses. */
75
+ disableNavigation?: boolean;
76
+ /**
77
+ * Posicionamento dos botões de navegação.
78
+ * - `'around'` — um botão de cada lado do caption.
79
+ * - `'after'` — ambos após o caption.
80
+ */
81
+ navLayout?: 'after' | 'around';
82
+ /** Atributo `aria-label` para o elemento raiz. */
83
+ 'aria-label'?: string;
84
+ /** Atributo `aria-labelledby` para o elemento raiz. */
85
+ 'aria-labelledby'?: string;
86
+ /** Foca automaticamente o primeiro dia selecionado ou hoje. */
87
+ autoFocus?: boolean;
88
+ /** Atributo `role` do elemento raiz (`'application'` ou `'dialog'`). */
89
+ role?: 'application' | 'dialog';
90
+ /** Atributo `title` do elemento raiz. */
91
+ title?: string;
92
+ /** Anima a transição entre meses. */
93
+ animate?: boolean;
94
+ /**
95
+ * Fuso horário IANA usado nos cálculos de datas.
96
+ * @example 'America/Sao_Paulo'
97
+ */
98
+ timeZone?: string;
99
+ /** Estilos inline para o elemento raiz. */
100
+ style?: React.CSSProperties;
101
+ /** Substitui os `classNames` padrão do react-day-picker. */
102
+ classNames?: Partial<Record<string, string>>;
103
+ /** Modificadores customizados para dias específicos. */
104
+ modifiers?: Record<string, Matcher | Matcher[] | undefined>;
105
+ /** ClassNames aplicadas aos dias que correspondem aos `modifiers`. */
106
+ modifiersClassNames?: Record<string, string>;
107
+ /** Rodapé do calendário — exibido como live region para acessibilidade. */
108
+ footer?: React.ReactNode;
86
109
  }
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import type { DialogProps } from './Dialog.types';
3
- declare const MemoizedDialog: React.NamedExoticComponent<DialogProps>;
4
- export default MemoizedDialog;
1
+ import * as React from "react";
2
+ import { DialogProps } from "./Dialog.types";
3
+ declare const Dialog: React.FC<DialogProps>;
4
+ export default Dialog;
@@ -3,46 +3,26 @@ import { BaseProps } from '../../types/common.types';
3
3
  /**
4
4
  * Props do componente Dialog
5
5
  * @example
6
- * ```tsx
7
6
  * <Dialog
8
- * show={isOpen}
9
- * title="Confirmar exclusão"
10
- * text="Tem certeza que deseja excluir este item?"
11
- * textConfirm="Excluir"
7
+ * title="Confirmar ação"
8
+ * bodyContent="Tem certeza que deseja continuar?"
9
+ * textConfirm="Confirmar"
12
10
  * textCancel="Cancelar"
13
- * fnConfirm={handleDelete}
14
- * fnCancel={handleCancel}
15
- * onClose={handleClose}
16
11
  * />
17
- * ```
18
- * @example
19
- * ```tsx
20
- * <Dialog
21
- * show={showDialog}
22
- * title="Informação"
23
- * onClose={() => setShowDialog(false)}
24
- * >
25
- * <p>Conteúdo customizado do dialog</p>
26
- * </Dialog>
27
- * ```
28
12
  */
29
- export interface DialogProps extends BaseProps {
30
- /** Conteúdo customizado do dialog */
31
- children?: ReactNode;
32
- /** Define se o dialog está visível */
13
+ export interface DialogProps extends BaseProps, React.HTMLAttributes<HTMLDivElement> {
14
+ /** Conteúdo customizado do diálogo */
33
15
  show: boolean;
34
- /** Título exibido no cabeçalho do dialog */
35
- title: string;
36
- /** Texto ou conteúdo do corpo do dialog */
37
- text?: ReactNode;
38
- /** Texto do botão de confirmação */
39
- textConfirm?: string;
40
- /** Texto do botão de cancelamento */
41
- textCancel?: string;
42
- /** Callback executado ao confirmar: () => void */
43
- fnConfirm?: () => void;
44
- /** Callback executado ao cancelar: () => void */
45
- fnCancel?: () => void;
46
- /** Callback executado ao fechar o dialog: () => void */
47
- onClose?: () => void;
16
+ /** Título exibido no cabeçalho do diálogo */
17
+ title?: string;
18
+ /** Texto ou conteúdo do corpo do diálogo */
19
+ bodyContent?: ReactNode;
20
+ /** Texto do botão de ação primária */
21
+ textPrimaryAction?: string;
22
+ /** Texto do botão de ação secundária */
23
+ textSecondaryAction?: string;
24
+ /** Função chamada ao executar a ação primária */
25
+ onPrimaryAction?: () => void;
26
+ /** Função chamada ao executar a ação secundária */
27
+ onSecondaryAction?: () => void;
48
28
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import { PopoverProps } from "./Popover.types";
3
+ declare const Popover: React.FC<PopoverProps>;
4
+ export default Popover;
@@ -0,0 +1,8 @@
1
+ import { Align, Side } from '../../types/common.types';
2
+ export interface PopoverProps {
3
+ trigger: React.ReactNode;
4
+ content: React.ReactNode;
5
+ onDateSelect?: (date: Date) => void;
6
+ align?: Align;
7
+ side?: Side;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default } from './Popover';
2
+ export type { PopoverProps } from './Popover.types';
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import type { ComponentPropsWithoutRef } from 'react';
2
3
  import { BaseProps } from '../../types/common.types';
3
4
  /**
4
5
  * Props do componente Search
@@ -21,7 +22,8 @@ import { BaseProps } from '../../types/common.types';
21
22
  * />
22
23
  * ```
23
24
  */
24
- export interface SearchProps extends BaseProps {
25
+ type NativeInputProps = Omit<ComponentPropsWithoutRef<'input'>, 'value' | 'defaultValue' | 'onChange' | 'onClick' | 'onMouseDown'>;
26
+ export interface SearchProps extends BaseProps, NativeInputProps {
25
27
  /** Placeholder do campo de busca */
26
28
  placeholder?: string;
27
29
  /** Valor controlado do campo */
@@ -43,3 +45,4 @@ export interface SearchProps extends BaseProps {
43
45
  /** ID para testes automatizados */
44
46
  'data-testid'?: string;
45
47
  }
48
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,13 +1,34 @@
1
- import React, { ReactNode } from 'react';
2
- import type { ToastType, ToastOptions, ToastContextType } from './Toast.types';
3
- export interface ToastProviderProps {
4
- children: ReactNode;
5
- maxToasts?: number;
6
- }
7
- export declare const ToastProvider: React.FC<ToastProviderProps>;
8
- export declare const useToast: () => ToastContextType;
9
- export declare const Toast: {
10
- show: (message: string, type?: ToastType, options?: ToastOptions) => string;
11
- setContext: (context: ToastContextType) => void;
12
- };
13
- export default ToastProvider;
1
+ import * as React from "react";
2
+ import { ToastProps } from './Toast.types';
3
+ /**
4
+ * Componente individual de notificação Toast.
5
+ *
6
+ * Consome o contexto do `ToastProvider` para gerenciar seu próprio ciclo de vida.
7
+ * Cada instância recebe um `id` único gerado pelo provider e o utiliza para
8
+ * se remover da fila ao ser fechada.
9
+ *
10
+ * Construído sobre `Toast.Root` do **Radix UI**, com suporte completo a
11
+ * acessibilidade (ARIA) e gesto de swipe para a esquerda.
12
+ *
13
+ * @remarks
14
+ * Este componente não deve ser usado diretamente. Utilize o hook `useToast`
15
+ * para exibir toasts programaticamente.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * // Uso indireto via hook (recomendado)
20
+ * const { showToast } = useToast();
21
+ *
22
+ * showToast({
23
+ * title: 'Item salvo',
24
+ * iconType: 'Success',
25
+ * duration: 3000,
26
+ * });
27
+ * ```
28
+ *
29
+ * @param props - {@link ToastProps} combinadas com o `id` único do toast
30
+ */
31
+ declare const Toast: React.FC<ToastProps & {
32
+ id: string;
33
+ }>;
34
+ export default Toast;
@@ -1,59 +1,57 @@
1
- import { ReactNode } from 'react';
2
- /** Tipos de toast disponíveis */
3
- export type ToastType = 'success' | 'alert' | 'info';
1
+ import { Toast } from 'radix-ui';
2
+ import * as React from 'react';
3
+ import { BaseProps } from '../../types';
4
4
  /**
5
- * Representa uma mensagem de toast
6
- */
7
- export interface ToastMessage {
8
- /** ID único da mensagem */
9
- id: string;
10
- /** Conteúdo da mensagem */
11
- message: string;
12
- /** Tipo visual do toast */
13
- type: ToastType;
14
- /** Define se o toast permanece até ser fechado manualmente */
15
- persistent?: boolean;
16
- /** Duração em milissegundos antes de auto-fechar */
17
- duration?: number;
18
- /** Timestamp de quando foi criado */
19
- timestamp: number;
20
- }
21
- /**
22
- * Opções para exibição do toast
23
- */
24
- export interface ToastOptions {
25
- /** Define se o toast permanece até ser fechado manualmente */
26
- persistent?: boolean;
27
- /** Duração em milissegundos antes de auto-fechar */
28
- duration?: number;
29
- }
30
- /**
31
- * Contexto do sistema de toasts
32
- * @example
33
- * ```tsx
34
- * const { showToast, hideToast } = useToast();
5
+ * Props do componente individual de notificação `Toast`.
6
+ *
7
+ * Estende {@link BaseProps} e os atributos nativos do `Toast.Root` do Radix UI,
8
+ * excluindo as propriedades controladas internamente (`open`, `onOpenChange`,
9
+ * `duration`, `className`).
35
10
  *
36
- * showToast('Operação realizada com sucesso!', 'success');
37
- * ```
38
- */
39
- export interface ToastContextType {
40
- /** Exibe um toast e retorna seu ID: (message, type?, options?) => string */
41
- showToast: (message: string, type?: ToastType, options?: ToastOptions) => string;
42
- /** Oculta um toast específico: (id) => void */
43
- hideToast: (id: string) => void;
44
- /** Oculta todos os toasts: () => void */
45
- hideAllToasts: () => void;
46
- }
47
- /**
48
- * Props do componente ToastProvider
49
11
  * @example
50
12
  * ```tsx
51
- * <ToastProvider>
52
- * <App />
53
- * </ToastProvider>
13
+ * showToast({
14
+ * title: 'Sucesso!',
15
+ * iconType: 'Success',
16
+ * duration: 3000,
17
+ * });
54
18
  * ```
55
19
  */
56
- export interface ToastProviderProps {
57
- /** Conteúdo da aplicação */
58
- children: ReactNode;
20
+ export interface ToastProps extends BaseProps, Omit<React.ComponentPropsWithoutRef<typeof Toast.Root>, 'open' | 'onOpenChange' | 'duration' | 'className'> {
21
+ /**
22
+ * Título principal exibido no toast.
23
+ */
24
+ title: string;
25
+ /**
26
+ * Define se o toast fecha automaticamente após o tempo definido em `duration`.
27
+ * @default true
28
+ */
29
+ automaticClose?: boolean;
30
+ /**
31
+ * Tempo em milissegundos até o toast fechar automaticamente.
32
+ * Só tem efeito quando `automaticClose` é `true`.
33
+ * @default 5000
34
+ */
35
+ duration?: number;
36
+ /**
37
+ * Ícone customizado exibido no toast.
38
+ * Quando fornecido, substitui o ícone gerado automaticamente por `iconType`.
39
+ */
40
+ icon?: React.ReactNode;
41
+ /**
42
+ * Ícone exibido no botão de fechar o toast.
43
+ * @default <Dismiss16Filled />
44
+ */
45
+ iconClosed?: React.ReactNode;
46
+ /**
47
+ * Tipo do ícone exibido automaticamente no toast.
48
+ *
49
+ * - `'Info'` → ícone informativo (`Info20Filled`)
50
+ * - `'Success'` → ícone de sucesso (`CheckmarkCircle20Filled`)
51
+ * - `'Alert'` → ícone de alerta/erro (`Warning20Filled`)
52
+ *
53
+ * Ignorado quando a prop `icon` for fornecida.
54
+ * @default 'Info'
55
+ */
56
+ iconType?: 'Info' | 'Success' | 'Alert';
59
57
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Componente responsável por renderizar todos os toasts ativos na tela.
4
+ *
5
+ * Lê a lista de toasts do contexto fornecido pelo `ToastProvider` e os
6
+ * renderiza individualmente. Configura o `Toast.Provider` do Radix UI com
7
+ * direção de swipe para a esquerda.
8
+ *
9
+ * @remarks
10
+ * - Deve ser posicionado **dentro** do `ToastProvider`.
11
+ * - Geralmente é colocado próximo à raiz da aplicação, após os demais filhos.
12
+ * - Toasts sem `id` são ignorados automaticamente.
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * <ToastProvider>
17
+ * <App />
18
+ * <ToastContainer /> {/* Deve estar aqui *\/}
19
+ * </ToastProvider>
20
+ * ```
21
+ */
22
+ export declare const ToastContainer: React.FC;
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Provider que gerencia o estado global dos toasts na aplicação.
4
+ *
5
+ * Deve envolver toda a árvore de componentes que precisará exibir toasts.
6
+ * Disponibiliza o contexto com `showToast` e `dismissToast` para todos os
7
+ * componentes filhos via `useToast()`.
8
+ *
9
+ * @remarks
10
+ * O `ToastContainer` deve ser renderizado **dentro** do `ToastProvider`.
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * // App.tsx ou layout principal
15
+ * import { ToastProvider, ToastContainer } from '@giro-ds/react';
16
+ *
17
+ * function App() {
18
+ * return (
19
+ * <ToastProvider maxToasts={5}>
20
+ * <Routes />
21
+ * <ToastContainer />
22
+ * </ToastProvider>
23
+ * );
24
+ * }
25
+ * ```
26
+ *
27
+ * @param children - Árvore de componentes filhos da aplicação.
28
+ * @param maxToasts - Número máximo de toasts exibidos simultaneamente.
29
+ * Quando o limite é excedido, o toast mais antigo é removido automaticamente.
30
+ * @default 5
31
+ */
32
+ export declare const ToastProvider: React.FC<{
33
+ children: React.ReactNode;
34
+ maxToasts?: number;
35
+ }>;
@@ -1,2 +1,5 @@
1
- export { default } from './Toast';
2
- export { Toast, ToastProvider, useToast } from './Toast';
1
+ export { default as Toast } from './Toast';
2
+ export { ToastProvider } from './components/ToastProvider';
3
+ export { ToastContainer } from './components/ToastContainer';
4
+ export { useToast } from '../../hooks/useToast';
5
+ export type { ToastProps } from './Toast.types';