@giro-ds/react 5.0.1 → 6.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.
package/dist/index.d.ts CHANGED
@@ -80,34 +80,17 @@ interface BadgeProps extends BaseProps {
80
80
  declare const Badge: React__default.FC<BadgeProps>;
81
81
 
82
82
  /**
83
- * Props do componente Button
84
- * @example
85
- * ```tsx
86
- * <Button variant="filled" size="lg" onClick={handleClick}>
87
- * Clique aqui
88
- * </Button>
89
- * ```
90
- * @example
91
- * ```tsx
92
- * <Button
93
- * variant="outlined"
94
- * icon={<Icon />}
95
- * iconPosition="left"
96
- * loading={isLoading}
97
- * >
98
- * Salvar
99
- * </Button>
100
- * ```
83
+ * Props base do Button, independentes da variante iconOnly/icon.
84
+ * `target`, `rel`, `type` e `onClick` são declarados aqui para garantir
85
+ * que o destructuring funcione em todos os modos (button | a | custom).
101
86
  */
102
- interface ButtonProps extends BaseProps, React__default.HTMLAttributes<HTMLElement> {
87
+ type ButtonOwnPropsBase = {
103
88
  /** Elemento customizado a ser renderizado (ex: 'a', Link do React Router) */
104
89
  as?: React__default.ElementType;
105
90
  /** Conteúdo do botão */
106
91
  children?: React__default.ReactNode;
107
92
  /** Variante visual do botão */
108
93
  variant?: Variant;
109
- /** Define se o botão exibe apenas ícone (sem texto) */
110
- iconOnly?: boolean;
111
94
  /** Posição do ícone em relação ao texto */
112
95
  iconPosition?: Position;
113
96
  /** URL de destino quando usado como link (renderiza <a>) */
@@ -124,8 +107,6 @@ interface ButtonProps extends BaseProps, React__default.HTMLAttributes<HTMLEleme
124
107
  type?: 'button' | 'submit' | 'reset';
125
108
  /** Tamanho do botão */
126
109
  size?: Size;
127
- /** Ícone a ser exibido no botão */
128
- icon?: React__default.ReactNode;
129
110
  /** Define se o botão ocupa 100% da largura do container */
130
111
  fullWidth?: boolean;
131
112
  /** Label acessível para leitores de tela */
@@ -138,9 +119,56 @@ interface ButtonProps extends BaseProps, React__default.HTMLAttributes<HTMLEleme
138
119
  tooltipSide?: 'top' | 'bottom' | 'left' | 'right';
139
120
  /** Alinhamento do tooltip */
140
121
  tooltipAlign?: 'start' | 'center' | 'end';
141
- }
122
+ /** Handler de clique; tipado em HTMLElement para ser compatível com todos os modos */
123
+ onClick?: React__default.MouseEventHandler<HTMLElement>;
124
+ } & BaseProps;
125
+ /**
126
+ * Props próprias do componente Button.
127
+ * Quando `iconOnly: true`, a prop `icon` é **obrigatória**.
128
+ * Isso evita que botões icon-only sejam renderizados sem ícone definido.
129
+ */
130
+ type ButtonOwnProps = (ButtonOwnPropsBase & {
131
+ /** Exibe apenas o ícone, sem texto. Requer obrigatoriamente a prop `icon`. */
132
+ iconOnly: true;
133
+ /** Ícone exibido no botão — obrigatório quando `iconOnly` é true */
134
+ icon: React__default.ReactNode;
135
+ }) | (ButtonOwnPropsBase & {
136
+ /** @default false */
137
+ iconOnly?: false;
138
+ /** Ícone a ser exibido no botão */
139
+ icon?: React__default.ReactNode;
140
+ });
141
+ /** Button renderizado como `<button>` — recebe atributos HTML precisos de HTMLButtonElement */
142
+ type ButtonAsButton = ButtonOwnProps & Omit<React__default.ButtonHTMLAttributes<HTMLButtonElement>, keyof ButtonOwnProps>;
143
+ /** Button renderizado como `<a>` — recebe atributos HTML precisos de HTMLAnchorElement */
144
+ type ButtonAsAnchor = ButtonOwnProps & Omit<React__default.AnchorHTMLAttributes<HTMLAnchorElement>, keyof ButtonOwnProps>;
145
+ /** Button renderizado como elemento customizado via prop `as` */
146
+ type ButtonAsCustom = ButtonOwnProps & Omit<React__default.HTMLAttributes<HTMLElement>, keyof ButtonOwnProps> & {
147
+ as: React__default.ElementType;
148
+ };
149
+ /**
150
+ * Props do componente Button
151
+ * @example
152
+ * ```tsx
153
+ * <Button variant="filled" size="lg" onClick={handleClick}>
154
+ * Clique aqui
155
+ * </Button>
156
+ * ```
157
+ * @example
158
+ * ```tsx
159
+ * <Button
160
+ * variant="outlined"
161
+ * icon={<Icon />}
162
+ * iconPosition="left"
163
+ * loading={isLoading}
164
+ * >
165
+ * Salvar
166
+ * </Button>
167
+ * ```
168
+ */
169
+ type ButtonProps = ButtonAsButton | ButtonAsAnchor | ButtonAsCustom;
142
170
 
143
- declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<HTMLElement>>;
171
+ declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
144
172
 
145
173
  /** Formato de exibição da data aceito pelo componente. */
146
174
  type DateFormat = 'dd/mm/yyyy' | 'mm/dd/yyyy' | (string & {});
@@ -271,33 +299,35 @@ declare const Checkbox: React$1.FC<CheckboxProps>;
271
299
  * Props do componente Chips
272
300
  * @example
273
301
  * ```tsx
274
- * <Chips
275
- * type="success"
276
- * title="Ativo"
277
- * leftIcon={<CheckIcon />}
278
- * />
302
+ * <Chips variant="success" leftIcon={<CheckIcon />}>
303
+ * Ativo
304
+ * </Chips>
279
305
  * ```
280
306
  * @example
281
307
  * ```tsx
282
308
  * <Chips
283
- * type="brand"
284
- * title="Novo"
285
- * rightIcon={<CloseIcon />}
286
- * disabled={false}
287
- * />
309
+ * backgroundColor="color-brand-secondary-medium"
310
+ * textColor="color-brand-secondary-dark"
311
+ * >
312
+ * Alerta
313
+ * </Chips>
288
314
  * ```
289
315
  */
290
- interface ChipsProps extends BaseProps {
291
- /** Tipo visual do chip */
292
- type?: TextVariant;
293
- /** Texto a ser exibido dentro do chip */
294
- title: string;
316
+ interface ChipsProps extends BaseProps, Omit<React$1.HTMLAttributes<HTMLDivElement>, 'color'> {
317
+ /** Variante semântica do chip. Define o preset de cor de fundo. */
318
+ variant?: Exclude<TextVariant, 'color'>;
319
+ /** Token CSS para a cor de fundo. Ex: 'color-brand-secondary-medium'. Sobrescreve o variant. */
320
+ backgroundColor?: string;
321
+ /** Token CSS para a cor do texto e ícones. Ex: 'color-brand-secondary-dark'. Sobrescreve o variant. */
322
+ textColor?: string;
323
+ /** Conteúdo exibido dentro do chip */
324
+ children: React$1.ReactNode;
295
325
  /** Ícone posicionado à esquerda do texto */
296
326
  leftIcon?: React$1.ReactNode;
297
327
  /** Ícone posicionado à direita do texto */
298
328
  rightIcon?: React$1.ReactNode;
299
- /** Props adicionais para o elemento div */
300
- [key: string]: any;
329
+ /** Estilos inline adicionais */
330
+ style?: React$1.CSSProperties;
301
331
  }
302
332
 
303
333
  declare const MemoizedChips: React__default.NamedExoticComponent<ChipsProps>;
@@ -662,6 +692,53 @@ interface MenuProps extends BaseProps {
662
692
 
663
693
  declare const Menu: React__default.FC<MenuProps>;
664
694
 
695
+ /**
696
+ * Props do componente Modal
697
+ * @example
698
+ * ```tsx
699
+ * <Modal
700
+ * isOpen={isModalOpen}
701
+ * onClose={() => setIsModalOpen(false)}
702
+ * title="Título do Modal"
703
+ * >
704
+ * <p>Conteúdo do modal</p>
705
+ * </Modal>
706
+ * ```
707
+ * @example
708
+ * ```tsx
709
+ * <Modal
710
+ * isOpen={showModal}
711
+ * onClose={handleClose}
712
+ * title="Confirmar ação"
713
+ * closeOnOverlayClick={false}
714
+ * >
715
+ * <MyForm />
716
+ * </Modal>
717
+ * ```
718
+ */
719
+ interface ModalProps extends BaseProps {
720
+ /** Define se o modal está aberto */
721
+ isOpen: boolean;
722
+ /** Callback executado ao fechar o modal */
723
+ onClose: () => void;
724
+ /** Título exibido no cabeçalho do modal */
725
+ title?: string;
726
+ /** Conteúdo a ser exibido dentro do modal */
727
+ children?: ReactNode;
728
+ /** Conteúdo customizado no cabeçalho, exibido ao lado do título */
729
+ headerContent?: ReactNode;
730
+ /** Define se o modal fecha ao clicar no overlay (padrão: true) */
731
+ closeOnOverlayClick?: boolean;
732
+ /** Conteúdo do rodapé do modal */
733
+ footer?: ReactNode;
734
+ /** Largura customizada do modal (ex: '500px', '80%') */
735
+ customWidth?: string;
736
+ /** Define se o modal ocupa toda a tela. Tem prioridade sobre customWidth */
737
+ fullscreen?: boolean;
738
+ }
739
+
740
+ declare const Modal: React$1.FC<ModalProps>;
741
+
665
742
  interface PopoverProps {
666
743
  trigger: React.ReactNode;
667
744
  content: React.ReactNode;
@@ -704,7 +781,7 @@ declare const Popover: React$1.FC<PopoverProps>;
704
781
  * @example
705
782
  * ```tsx
706
783
  * <Quantity
707
- * defaultValue={1}
784
+ * value={1}
708
785
  * decimal={true}
709
786
  * decimalPlaces={2}
710
787
  * step={0.5}
@@ -713,9 +790,7 @@ declare const Popover: React$1.FC<PopoverProps>;
713
790
  * ```
714
791
  */
715
792
  interface QuantityProps extends BaseProps {
716
- /** Valor inicial (modo não controlado) */
717
- defaultValue?: number;
718
- /** Valor atual (modo controlado) */
793
+ /** Valor do componente */
719
794
  value?: number;
720
795
  /** Callback executado quando o valor muda: (value) => void */
721
796
  onChange?: (value: number) => void;
@@ -726,7 +801,24 @@ interface QuantityProps extends BaseProps {
726
801
  /** Número de casas decimais permitidas */
727
802
  decimalPlaces?: number;
728
803
  /** Incremento/decremento ao clicar nos botões */
729
- step?: number;
804
+ valueIncrement?: number;
805
+ /**
806
+ * Tamanho fixo do input, medido em caracteres (unidade CSS `ch`).
807
+ * O valor define quantos caracteres cabem visivelmente no campo sem necessidade de rolar.
808
+ * Exemplo: `inputSize={4}` reserva espaço para 4 caracteres ("9999").
809
+ * Se omitido, o tamanho é ajustado automaticamente conforme o conteúdo digitado.
810
+ */
811
+ inputSize?: number;
812
+ /** Valor mínimo permitido */
813
+ minValue?: number;
814
+ /** Valor máximo permitido */
815
+ maxValue?: number;
816
+ /** Aria label for the decrement button. Default: 'Decrease quantity' */
817
+ decrementAriaLabel?: string;
818
+ /** Aria label for the increment button. Default: 'Increase quantity' */
819
+ incrementAriaLabel?: string;
820
+ /** Aria label for the quantity input. Default: 'Quantity' */
821
+ inputAriaLabel?: string;
730
822
  }
731
823
 
732
824
  declare const memorizedQuantity: React__default.NamedExoticComponent<QuantityProps>;
@@ -1560,5 +1652,5 @@ declare function useInfiniteScroll({ status, page, lastPage, onLoadMore, thresho
1560
1652
 
1561
1653
  declare const normalizeText: (text: React.ReactNode) => string;
1562
1654
 
1563
- export { Avatar, Badge, Button, Calendar, Callout, Checkbox, MemoizedChips as Chips, Container, _default$2 as DatePicker, Dialog, Drawer, Filter, ListItem, Menu, Popover, memorizedQuantity as Quantity, Radio, Search, Select, Switch, Table, TableHeader, TablePagination, _default$1 as TextArea, _default as TextField, Toast, ToastContainer, ToastProvider, Tooltip, VerificationCode, normalizeText, useApiSimulation, useInfiniteScroll, useToast };
1564
- export type { AvatarProps, BadgeProps, ButtonProps, CalendarProps, CalloutProps, CheckboxProps, ChipsProps, ContainerProps, DatePickerProps, DialogProps, DrawerProps, FilterItem, FilterProps, ListItemProps, MenuProps, PopoverProps, QuantityProps, RadioGroupProps, RadioProps, SearchProps, SelectProps, SwitchProps, TableHeaderProps, TablePaginationProps, TableProps, TextAreaProps, TextFieldProps, ToastProps, TooltipProps, VerificationCodeProps };
1655
+ export { Avatar, Badge, Button, Calendar, Callout, Checkbox, MemoizedChips as Chips, Container, _default$2 as DatePicker, Dialog, Drawer, Filter, ListItem, Menu, Modal, Popover, memorizedQuantity as Quantity, Radio, Search, Select, Switch, Table, TableHeader, TablePagination, _default$1 as TextArea, _default as TextField, Toast, ToastContainer, ToastProvider, Tooltip, VerificationCode, normalizeText, useApiSimulation, useInfiniteScroll, useToast };
1656
+ export type { AvatarProps, BadgeProps, ButtonProps, CalendarProps, CalloutProps, CheckboxProps, ChipsProps, ContainerProps, DatePickerProps, DialogProps, DrawerProps, FilterItem, FilterProps, ListItemProps, MenuProps, ModalProps, PopoverProps, QuantityProps, RadioGroupProps, RadioProps, SearchProps, SelectProps, SwitchProps, TableHeaderProps, TablePaginationProps, TableProps, TextAreaProps, TextFieldProps, ToastProps, TooltipProps, VerificationCodeProps };