@giro-ds/react 1.0.4 → 2.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/Checkbox/Checkbox.d.ts +4 -4
  2. package/dist/components/Checkbox/Checkbox.types.d.ts +4 -19
  3. package/dist/components/Checkbox/__tests__/Checkbox.test.d.ts +1 -0
  4. package/dist/components/Radio/Radio.d.ts +3 -3
  5. package/dist/components/Radio/Radio.types.d.ts +11 -14
  6. package/dist/components/Radio/__tests__/Radio.test.d.ts +1 -0
  7. package/dist/components/Radio/index.d.ts +1 -0
  8. package/dist/components/SelectRadix/SelectRadix.types.d.ts +5 -3
  9. package/dist/components/Switch/Switch.d.ts +4 -0
  10. package/dist/components/Switch/Switch.types.d.ts +8 -0
  11. package/dist/components/Switch/__tests__/Switch.test.d.ts +1 -0
  12. package/dist/components/Switch/index.d.ts +2 -0
  13. package/dist/components/TextField/TextField.d.ts +2 -2
  14. package/dist/components/TextField/TextField.types.d.ts +23 -14
  15. package/dist/components/TextField/__tests__/Textfield.test.d.ts +1 -0
  16. package/dist/components/TextField/utils/__tests__/validation.test.d.ts +1 -0
  17. package/dist/components/TextField/utils/index.d.ts +2 -0
  18. package/dist/components/TextField/utils/validation.d.ts +8 -0
  19. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  20. package/dist/components/Tooltip/Tooltip.types.d.ts +5 -1
  21. package/dist/components/Tooltip/__tests__/Tooltip.test.d.ts +1 -0
  22. package/dist/components/Tooltip/index.d.ts +1 -0
  23. package/dist/components/index.d.ts +3 -5
  24. package/dist/index.cjs +202 -327
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.ts +42 -72
  27. package/dist/index.esm.js +215 -321
  28. package/dist/index.esm.js.map +1 -1
  29. package/dist/shared/Label/index.d.ts +4 -2
  30. package/dist/styles.css +1 -1
  31. package/package.json +15 -13
  32. package/dist/components/CheckboxRadix/CheckboxRadix.d.ts +0 -4
  33. package/dist/components/CheckboxRadix/CheckboxRadix.types.d.ts +0 -10
  34. package/dist/components/CheckboxRadix/index.d.ts +0 -2
  35. package/dist/components/RadioRadix/RadioRadix.d.ts +0 -4
  36. package/dist/components/RadioRadix/RadioRadix.types.d.ts +0 -15
  37. package/dist/components/RadioRadix/index.d.ts +0 -2
  38. package/dist/components/TextField/ValidationUtils.d.ts +0 -8
@@ -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
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';
@@ -10,7 +10,7 @@ export interface SelectItemProps {
10
10
  }
11
11
  export interface CheckboxItemProps extends SelectItemProps {
12
12
  checked: boolean;
13
- onChange: (checked: boolean) => void;
13
+ onCheckedChange: (checked: boolean) => void;
14
14
  }
15
15
  export type SelectVariant = 'text' | 'icon' | 'checkbox';
16
16
  export interface SelectRadixProps {
@@ -23,8 +23,6 @@ export interface SelectRadixProps {
23
23
  multiple?: boolean;
24
24
  placeholder?: string;
25
25
  search?: boolean;
26
- tooltip?: boolean;
27
- tooltipMessage?: string;
28
26
  label?: string;
29
27
  helperText?: string;
30
28
  maxWidth?: string | number;
@@ -33,6 +31,10 @@ export interface SelectRadixProps {
33
31
  className?: string;
34
32
  'aria-label'?: string;
35
33
  'data-testid'?: string;
34
+ tooltip?: boolean;
35
+ tooltipText?: string;
36
+ side?: "top" | "right" | "bottom" | "left";
37
+ align?: "start" | "center" | "end";
36
38
  enableInfiniteScroll?: boolean;
37
39
  onScrollEnd?: () => void;
38
40
  isLoadingMore?: boolean;
@@ -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;
@@ -0,0 +1,8 @@
1
+ export interface SwitchProps {
2
+ defaultChecked: boolean;
3
+ disabled: boolean;
4
+ onCheckedChange?: (checked: boolean) => void;
5
+ name?: string;
6
+ value?: string;
7
+ checked?: boolean;
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,4 @@
1
1
  import React from 'react';
2
2
  import type { TextFieldProps } from './TextField.types';
3
- declare const MemoizedTextField: React.NamedExoticComponent<TextFieldProps>;
4
- export default MemoizedTextField;
3
+ declare const _default: React.NamedExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>>;
4
+ export default _default;
@@ -1,22 +1,31 @@
1
1
  import React from 'react';
2
- export interface TextFieldProps {
3
- name?: string;
4
- className?: string;
5
- value?: string | number;
2
+ export type TextFieldType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url';
3
+ export type TooltipPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
4
+ export interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value' | 'type'> {
5
+ /** Controlled value */
6
+ value?: string;
7
+ /** Change handler - receives string value */
8
+ onChange?: (value: string) => void;
9
+ /** Label text */
6
10
  label?: string;
7
- placeholder?: string;
8
- type?: string;
9
- onChange?: (value: string | number) => void;
10
- disabled?: boolean;
11
- maxLength?: number;
12
- required?: boolean;
13
- helper?: boolean;
11
+ /** Input type */
12
+ type?: TextFieldType;
13
+ /** Helper text (shown below input) */
14
14
  helperText?: string;
15
+ /** Show tooltip with info icon */
15
16
  tooltip?: boolean;
17
+ /** Tooltip content */
16
18
  tooltipText?: string;
17
- positionTooltip?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
19
+ side?: "top" | "right" | "bottom" | "left";
20
+ align?: "start" | "center" | "end";
18
21
  errorMessage?: string;
19
- trailingIcon?: boolean;
20
- id?: string;
22
+ /** Leading icon */
21
23
  icon?: React.ReactNode;
22
24
  }
25
+ export interface ValidationParams {
26
+ value: string;
27
+ maxLength?: number;
28
+ type?: TextFieldType;
29
+ errorMessage?: string;
30
+ required?: boolean;
31
+ }
@@ -0,0 +1,2 @@
1
+ export { validateInput } from './validation';
2
+ export type { ValidationParams } from './validation';
@@ -0,0 +1,8 @@
1
+ export interface ValidationParams {
2
+ value: string;
3
+ maxLength?: number;
4
+ type?: string;
5
+ errorMessage?: string;
6
+ required?: boolean;
7
+ }
8
+ export declare const validateInput: ({ value, maxLength, errorMessage, required }: ValidationParams) => string;
@@ -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;
@@ -2,6 +2,10 @@ import React from 'react';
2
2
  export interface TooltipProps {
3
3
  id?: string;
4
4
  text: React.ReactNode;
5
- position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'left' | 'right';
5
+ side?: "top" | "right" | "bottom" | "left";
6
+ align?: "start" | "center" | "end";
7
+ sideOffset?: number;
8
+ alignOffset?: number;
9
+ maxWidth?: number;
6
10
  children: React.ReactNode;
7
11
  }
@@ -1 +1,2 @@
1
1
  export { default } from './Tooltip';
2
+ export type { TooltipProps } from './Tooltip.types';
@@ -10,8 +10,6 @@ export { default as Callout } from './Callout';
10
10
  export { type CalloutProps } from './Callout/Callout.types';
11
11
  export { default as Checkbox } from './Checkbox';
12
12
  export { type CheckboxProps } from './Checkbox/Checkbox.types';
13
- export { default as CheckboxRadix } from './CheckboxRadix';
14
- export { type CheckboxRadixProps } from './CheckboxRadix/CheckboxRadix.types';
15
13
  export { default as Chips } from './Chips';
16
14
  export { type ChipsProps } from './Chips/Chips.types';
17
15
  export { default as Container } from './Container';
@@ -35,9 +33,7 @@ export { type MenuRadixProps } from './MenuRadix/MenuRadix.types';
35
33
  export { default as Quantity } from './Quantity';
36
34
  export { type QuantityProps } from './Quantity/Quantity.types';
37
35
  export { default as Radio } from './Radio';
38
- export { type RadioProps } from './Radio/Radio.types';
39
- export { default as RadioRadix } from './RadioRadix';
40
- export { type RadioGroupProps as RadioRadixProps, type RadioProps as RadioRadixItemProps } from './RadioRadix/RadioRadix.types';
36
+ export { type RadioGroupProps, type RadioProps } from './Radio/Radio.types';
41
37
  export { default as Search } from './Search';
42
38
  export { type SearchProps } from './Search/Search.types';
43
39
  export { default as Select } from './Select';
@@ -58,6 +54,8 @@ export { default as Toast, ToastProvider, useToast } from './Toast';
58
54
  export { type ToastType, type ToastMessage, type ToastOptions, type ToastContextType } from './Toast/Toast.types';
59
55
  export { default as Tooltip } from './Tooltip';
60
56
  export { type TooltipProps } from './Tooltip/Tooltip.types';
57
+ export { default as Switch } from './Switch';
58
+ export { type SwitchProps } from './Switch/Switch.types';
61
59
  export { default as VerificationCode } from './VerificationCode';
62
60
  export { type VerificationCodeProps } from './VerificationCode/VerificationCode.types';
63
61
  export { default as useApiSimulation } from '../hooks/ApiSimulation';