@granto-umbrella/umbrella-components 3.0.33 → 3.0.36

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 (156) hide show
  1. package/README.md +165 -27
  2. package/dist/umbrella-components.css +1 -1
  3. package/dist/umbrella-components.es.js +28129 -29249
  4. package/dist/umbrella-components.umd.js +1234 -2181
  5. package/package.json +135 -106
  6. package/src/assets.d.ts +19 -19
  7. package/src/components/atoms/Badge/Badge.styles.ts +88 -86
  8. package/src/components/atoms/Badge/Badge.tsx +42 -44
  9. package/src/components/atoms/Badge/Badge.types.ts +15 -15
  10. package/src/components/atoms/Breadcrumb/Breadcrumb.styles.ts +43 -43
  11. package/src/components/atoms/Breadcrumb/Breadcrumb.tsx +46 -48
  12. package/src/components/atoms/Breadcrumb/Breadcrumb.types.ts +12 -12
  13. package/src/components/atoms/Button/Button.styles.ts +279 -280
  14. package/src/components/atoms/Button/Button.tsx +76 -76
  15. package/src/components/atoms/Button/Button.types.ts +28 -28
  16. package/src/components/atoms/Button/index.ts +1 -1
  17. package/src/components/atoms/Checkbox/Checkbox.styles.ts +72 -72
  18. package/src/components/atoms/Checkbox/Checkbox.tsx +36 -36
  19. package/src/components/atoms/Checkbox/Checkbox.types.ts +14 -14
  20. package/src/components/atoms/Checkbox/CheckboxGroup.tsx +30 -30
  21. package/src/components/atoms/Checkbox/CheckboxSelectAll.tsx +32 -32
  22. package/src/components/atoms/CodeInput/CodeInput.styles.tsx +38 -39
  23. package/src/components/atoms/CodeInput/CodeInput.tsx +13 -19
  24. package/src/components/atoms/CodeInput/CodeInput.types.ts +3 -3
  25. package/src/components/atoms/CodeInput/index.tsx +1 -1
  26. package/src/components/atoms/DropDownMenu/DropdownMenu.tsx +48 -48
  27. package/src/components/atoms/DropDownMenu/DropdownMenu.types.ts +15 -15
  28. package/src/components/atoms/DropDownMenu/index.tsx +5 -2
  29. package/src/components/atoms/ErrorMessage/ErrorMessage.styles.tsx +28 -28
  30. package/src/components/atoms/ErrorMessage/ErrorMessage.tsx +12 -12
  31. package/src/components/atoms/ErrorMessage/ErrorMessage.types.ts +6 -6
  32. package/src/components/atoms/ErrorMessage/index.tsx +1 -1
  33. package/src/components/atoms/Footer/Footer.styles.tsx +22 -22
  34. package/src/components/atoms/Footer/Footer.tsx +9 -9
  35. package/src/components/atoms/Footer/Footer.types.tsx +5 -5
  36. package/src/components/atoms/Footer/index.tsx +1 -1
  37. package/src/components/atoms/GenericContainer/GenericContainer.styles.tsx +21 -21
  38. package/src/components/atoms/GenericContainer/GenericContainer.tsx +9 -9
  39. package/src/components/atoms/GenericContainer/GenericContainer.types.ts +5 -5
  40. package/src/components/atoms/GenericContainer/index.tsx +1 -1
  41. package/src/components/atoms/Icon/Icon.styles.ts +11 -11
  42. package/src/components/atoms/Icon/Icon.tsx +22 -22
  43. package/src/components/atoms/Icon/Icon.types.ts +6 -6
  44. package/src/components/atoms/Icon/index.ts +1 -1
  45. package/src/components/atoms/Input/Input.styles.ts +106 -101
  46. package/src/components/atoms/Input/index.ts +1 -1
  47. package/src/components/atoms/Label/Label.tsx +16 -16
  48. package/src/components/atoms/Loading/Loading.styles.tsx +25 -23
  49. package/src/components/atoms/Loading/Loading.tsx +8 -8
  50. package/src/components/atoms/LogoContainer/LogoContainer.Types.tsx +5 -5
  51. package/src/components/atoms/LogoContainer/LogoContainer.styles.tsx +11 -11
  52. package/src/components/atoms/LogoContainer/LogoContainer.tsx +11 -11
  53. package/src/components/atoms/LogoContainer/index.tsx +1 -1
  54. package/src/components/atoms/ModalAviso/ModalAviso.styles.tsx +56 -55
  55. package/src/components/atoms/ModalAviso/ModalAviso.tsx +43 -37
  56. package/src/components/atoms/ModalAviso/ModalAviso.types.ts +5 -5
  57. package/src/components/atoms/ModalAviso/index.tsx +1 -1
  58. package/src/components/atoms/MultiSelect/MultiSelect.styles.tsx +100 -92
  59. package/src/components/atoms/MultiSelect/MultiSelect.tsx +346 -346
  60. package/src/components/atoms/MultiSelect/MultiSelect.types.ts +38 -38
  61. package/src/components/atoms/Pill/Pill.styles.ts +46 -46
  62. package/src/components/atoms/Pill/Pill.tsx +35 -36
  63. package/src/components/atoms/Pill/Pill.types.ts +14 -18
  64. package/src/components/atoms/RadioButton/RadioButton.styles.ts +44 -43
  65. package/src/components/atoms/RadioButton/RadioButton.tsx +31 -31
  66. package/src/components/atoms/ResendLink/ResendLink.styles.tsx +19 -20
  67. package/src/components/atoms/ResendLink/ResendLink.tsx +21 -21
  68. package/src/components/atoms/ResendLink/ResendLink.types.ts +8 -9
  69. package/src/components/atoms/ResendLink/index.tsx +1 -2
  70. package/src/components/atoms/Select/Select.styles.ts +153 -149
  71. package/src/components/atoms/Select/Select.tsx +52 -43
  72. package/src/components/atoms/Select/index.tsx +1 -1
  73. package/src/components/atoms/Subtitle/Subtitle.tsx +7 -7
  74. package/src/components/atoms/Subtitle/Subtitle.types.ts +5 -5
  75. package/src/components/atoms/Subtitle/index.tsx +1 -1
  76. package/src/components/atoms/Switch/Switch.tsx +25 -25
  77. package/src/components/atoms/TabBar/TabBar.styles.tsx +64 -57
  78. package/src/components/atoms/TabBar/index.tsx +2 -2
  79. package/src/components/atoms/Text/Text.styles.tsx +35 -35
  80. package/src/components/atoms/Text/Text.tsx +32 -31
  81. package/src/components/atoms/Text/Text.types.ts +8 -8
  82. package/src/components/atoms/Text/index.ts +1 -1
  83. package/src/components/atoms/Textarea/Textarea.styles.ts +52 -52
  84. package/src/components/atoms/Textarea/Textarea.tsx +31 -31
  85. package/src/components/atoms/Title/Title.tsx +7 -7
  86. package/src/components/atoms/Title/Title.types.ts +5 -5
  87. package/src/components/atoms/Title/index.tsx +1 -1
  88. package/src/components/molecules/BannerAjuda/BannerAjuda.styles.tsx +9 -9
  89. package/src/components/molecules/BannerAjuda/BannerAjuda.tsx +18 -19
  90. package/src/components/molecules/BannerAjuda/index.tsx +1 -1
  91. package/src/components/molecules/ButtonGroup/ButtonGroup.styles.ts +10 -10
  92. package/src/components/molecules/ButtonGroup/ButtonGroup.types.ts +22 -22
  93. package/src/components/molecules/Calendar/Calendar.styles.ts +143 -143
  94. package/src/components/molecules/Calendar/Calendar.tsx +31 -31
  95. package/src/components/molecules/CodeInputContainer/CodeInputContainer.styles.tsx +7 -7
  96. package/src/components/molecules/CodeInputContainer/CodeInputContainer.types.ts +13 -13
  97. package/src/components/molecules/CodeInputContainer/index.tsx +1 -3
  98. package/src/components/molecules/ExcludeModal/ExcludeModal.styles.tsx +123 -118
  99. package/src/components/molecules/ExcludeModal/ExcludeModal.tsx +48 -48
  100. package/src/components/molecules/ExcludeModal/ExcludeModal.types.ts +10 -10
  101. package/src/components/molecules/ExcludeModal/index.tsx +1 -1
  102. package/src/components/molecules/FieldSelector/FieldSelector.styles.ts +59 -0
  103. package/src/components/molecules/FieldSelector/FieldSelector.tsx +167 -0
  104. package/src/components/molecules/HighlightsCard/HighlightsCard.styles.tsx +67 -68
  105. package/src/components/molecules/HighlightsCard/HighlightsCard.tsx +35 -26
  106. package/src/components/molecules/HighlightsCard/HighlightsCard.types.ts +10 -10
  107. package/src/components/molecules/HighlightsCard/index.tsx +1 -1
  108. package/src/components/molecules/InsuranceCard/InsuranceCard.styles.tsx +237 -237
  109. package/src/components/molecules/InsuranceCard/index.tsx +1 -1
  110. package/src/components/molecules/PieChartComponent/PieChartComponent.styles.tsx +7 -8
  111. package/src/components/molecules/PieChartComponent/PieChartComponent.tsx +70 -73
  112. package/src/components/molecules/PieChartComponent/PieChartComponent.types.ts +11 -11
  113. package/src/components/molecules/PieChartComponent/index.tsx +1 -1
  114. package/src/components/molecules/Popover/Popover.styles.ts +66 -65
  115. package/src/components/molecules/Popover/Popover.tsx +23 -23
  116. package/src/components/molecules/RadioBoxGroup/RadioBoxGroup.styles.ts +11 -11
  117. package/src/components/molecules/RadioBoxGroup/RadioBoxGroup.tsx +43 -43
  118. package/src/components/molecules/RadioGroupField/RadioGroupField.styles.tsx +65 -64
  119. package/src/components/molecules/RadioGroupField/RadioGroupField.tsx +69 -69
  120. package/src/components/molecules/RadioGroupField/RadioGroupField.types.ts +17 -17
  121. package/src/components/molecules/RadioGroupField/index.tsx +1 -1
  122. package/src/components/molecules/RefuseModal/RefuseModal.styles.tsx +139 -139
  123. package/src/components/molecules/RefuseModal/RefuseModal.tsx +92 -76
  124. package/src/components/molecules/RefuseModal/RefuseModal.types.ts +15 -15
  125. package/src/components/molecules/RefuseModal/index.tsx +2 -2
  126. package/src/components/molecules/ResultsChart/ResultsChart.tsx +23 -19
  127. package/src/components/molecules/ResultsChart/ResultsChart.types.ts +3 -3
  128. package/src/components/molecules/ResultsChart/index.tsx +2 -2
  129. package/src/components/molecules/TabToggle/TabToggle.styles.ts +54 -54
  130. package/src/components/molecules/TabToggle/TabToggle.tsx +35 -35
  131. package/src/components/organisms/AlertDialog/AlertDialog.styles.tsx +61 -61
  132. package/src/components/organisms/AlertDialog/AlertDialog.tsx +70 -70
  133. package/src/components/organisms/Dialog/Dialog.styles.ts +107 -106
  134. package/src/components/organisms/Dialog/Dialog.tsx +69 -69
  135. package/src/components/organisms/DonutEmissionsChart/DonutEmissionsChart.styles.tsx +113 -113
  136. package/src/components/organisms/DonutEmissionsChart/DonutEmissionsChart.tsx +75 -71
  137. package/src/components/organisms/DonutEmissionsChart/DonutEmissionsChart.types.ts +9 -9
  138. package/src/components/organisms/DonutEmissionsChart/index.tsx +5 -2
  139. package/src/components/organisms/Form/Form.styles.ts +35 -35
  140. package/src/components/organisms/Form/Form.tsx +160 -160
  141. package/src/components/organisms/ListagemUltimasEmissoes/ListagemUltimasEmissoes.styles.tsx +115 -114
  142. package/src/components/organisms/ListagemUltimasEmissoes/ListagemUltimasEmissoes.tsx +89 -89
  143. package/src/components/organisms/ListagemUltimasEmissoes/ListagemUltimasEmissoes.types.ts +16 -16
  144. package/src/components/organisms/ListagemUltimasEmissoes/index.tsx +1 -1
  145. package/src/components/organisms/Navbar/Navbar.styles.tsx +243 -243
  146. package/src/global.d.ts +9 -9
  147. package/src/index.ts +2 -0
  148. package/src/lib/utils.ts +6 -6
  149. package/src/styles/tokens/borders.ts +17 -17
  150. package/src/styles/tokens/index.tsx +6 -6
  151. package/src/styles/tokens/radius.ts +22 -22
  152. package/src/styles/tokens/shadows.ts +22 -22
  153. package/src/styles/tokens/sizes.ts +60 -64
  154. package/src/types/radius.types.ts +1 -1
  155. package/src/types/shadows.types.ts +1 -1
  156. package/src/utils/renderHighlightsCard.tsx +21 -0
@@ -1,76 +1,76 @@
1
- import React from "react";
2
- import { StyledButton } from "./Button.styles";
3
- import { ButtonProps } from "./Button.types";
4
- import * as Icons from "@phosphor-icons/react";
5
- import { semanticSizes } from "../../../styles/tokens";
6
-
7
- const Button: React.FC<ButtonProps> = ({
8
- children,
9
- size = "md",
10
- variant = "primary",
11
- radius = "md",
12
- isLoading = false,
13
- iconSize = "lg",
14
- leftIcon,
15
- rightIcon,
16
- width,
17
- height,
18
- testId,
19
- ...props
20
- }) => {
21
- const IconComponentLeft =
22
- leftIcon && (Icons[leftIcon as keyof typeof Icons] as React.ElementType);
23
- const IconComponentRight =
24
- rightIcon && (Icons[rightIcon as keyof typeof Icons] as React.ElementType);
25
-
26
- return (
27
- <StyledButton
28
- $size={size}
29
- $variant={variant}
30
- $radius={radius}
31
- $width={width}
32
- $height={height}
33
- data-testid={testId}
34
- id={testId}
35
- {...props}
36
- >
37
- {isLoading ? (
38
- <Icons.Spinner
39
- size={
40
- semanticSizes.global.padding[
41
- iconSize as keyof typeof semanticSizes.global.padding
42
- ]
43
- }
44
- />
45
- ) : (
46
- <>
47
- {IconComponentLeft && (
48
- <span className="icon-left">
49
- <IconComponentLeft
50
- size={
51
- semanticSizes.global.padding[
52
- iconSize as keyof typeof semanticSizes.global.padding
53
- ]
54
- }
55
- />
56
- </span>
57
- )}
58
- {children}
59
- {IconComponentRight && (
60
- <span className="icon-right">
61
- <IconComponentRight
62
- size={
63
- semanticSizes.global.padding[
64
- iconSize as keyof typeof semanticSizes.global.padding
65
- ]
66
- }
67
- />
68
- </span>
69
- )}
70
- </>
71
- )}
72
- </StyledButton>
73
- );
74
- };
75
-
76
- export default Button;
1
+ import React from 'react';
2
+ import { StyledButton } from './Button.styles';
3
+ import { ButtonProps } from './Button.types';
4
+ import * as Icons from '@phosphor-icons/react';
5
+ import { semanticSizes } from '../../../styles/tokens';
6
+
7
+ const Button: React.FC<ButtonProps> = ({
8
+ children,
9
+ size = 'md',
10
+ variant = 'primary',
11
+ radius = 'md',
12
+ isLoading = false,
13
+ iconSize = 'lg',
14
+ leftIcon,
15
+ rightIcon,
16
+ width,
17
+ height,
18
+ testId,
19
+ ...props
20
+ }) => {
21
+ const IconComponentLeft =
22
+ leftIcon && (Icons[leftIcon as keyof typeof Icons] as React.ElementType);
23
+ const IconComponentRight =
24
+ rightIcon && (Icons[rightIcon as keyof typeof Icons] as React.ElementType);
25
+
26
+ return (
27
+ <StyledButton
28
+ $size={size}
29
+ $variant={variant}
30
+ $radius={radius}
31
+ $width={width}
32
+ $height={height}
33
+ data-testid={testId}
34
+ id={testId}
35
+ {...props}
36
+ >
37
+ {isLoading ? (
38
+ <Icons.Spinner
39
+ size={
40
+ semanticSizes.global.padding[
41
+ iconSize as keyof typeof semanticSizes.global.padding
42
+ ]
43
+ }
44
+ />
45
+ ) : (
46
+ <>
47
+ {IconComponentLeft && (
48
+ <span className="icon-left">
49
+ <IconComponentLeft
50
+ size={
51
+ semanticSizes.global.padding[
52
+ iconSize as keyof typeof semanticSizes.global.padding
53
+ ]
54
+ }
55
+ />
56
+ </span>
57
+ )}
58
+ {children}
59
+ {IconComponentRight && (
60
+ <span className="icon-right">
61
+ <IconComponentRight
62
+ size={
63
+ semanticSizes.global.padding[
64
+ iconSize as keyof typeof semanticSizes.global.padding
65
+ ]
66
+ }
67
+ />
68
+ </span>
69
+ )}
70
+ </>
71
+ )}
72
+ </StyledButton>
73
+ );
74
+ };
75
+
76
+ export default Button;
@@ -1,28 +1,28 @@
1
- export interface ButtonProps
2
- extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
- size?: "sm" | "md" | "lg";
4
- variant?:
5
- | "primary"
6
- | "outline"
7
- | "outline_ghost"
8
- | "outline_ghost_disabled"
9
- | "outline_danger"
10
- | "danger"
11
- | "ghost"
12
- | "ghost_alert"
13
- | "alert"
14
- | "danger-no-fill"
15
- | "accent-outline"
16
- | "accent-fill"
17
- | "secondary-outline"
18
- | "danger-fill";
19
- radius?: string;
20
- isLoading?: boolean;
21
- leftIcon?: string;
22
- rightIcon?: string;
23
- iconSize?: string;
24
- fontSize?: string;
25
- width?: string;
26
- height?: string;
27
- testId?: string;
28
- }
1
+ export interface ButtonProps
2
+ extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
+ size?: 'sm' | 'md' | 'lg';
4
+ variant?:
5
+ | 'primary'
6
+ | 'outline'
7
+ | 'outline_ghost'
8
+ | 'outline_ghost_disabled'
9
+ | 'outline_danger'
10
+ | 'danger'
11
+ | 'ghost'
12
+ | 'ghost_alert'
13
+ | 'alert'
14
+ | 'danger-no-fill'
15
+ | 'accent-outline'
16
+ | 'accent-fill'
17
+ | 'secondary-outline'
18
+ | 'danger-fill';
19
+ radius?: string;
20
+ isLoading?: boolean;
21
+ leftIcon?: string;
22
+ rightIcon?: string;
23
+ iconSize?: string;
24
+ fontSize?: string;
25
+ width?: string;
26
+ height?: string;
27
+ testId?: string;
28
+ }
@@ -1 +1 @@
1
- export { default } from "./Button";
1
+ export { default } from './Button';
@@ -1,72 +1,72 @@
1
- import styled from "styled-components";
2
- import {
3
- semanticColors,
4
- semanticSizes,
5
- semanticRadius,
6
- typographyTokens,
7
- } from "../../../styles/tokens";
8
-
9
- export const CheckboxWrapper = styled.label`
10
- display: flex;
11
- align-items: center;
12
- gap: ${semanticSizes.global.gap.sm};
13
- cursor: pointer;
14
- font-size: ${typographyTokens.fontSizes.labelS};
15
- color: ${semanticColors.neutral[600]};
16
- user-select: none;
17
- `;
18
-
19
- export const StyledCheckbox = styled.input`
20
- width: ${semanticSizes.global.padding.xl};
21
- height: ${semanticSizes.global.padding.xl};
22
- border: 2px solid ${semanticColors.neutral[400]};
23
- border-radius: ${semanticRadius.global.radius.sm};
24
- appearance: none;
25
- cursor: pointer;
26
- position: relative;
27
- transition: all 0.2s ease-in-out;
28
-
29
- &:checked {
30
- background: ${semanticColors.branding.surface.enabled};
31
- border-color: ${semanticColors.branding.surface.enabled};
32
- }
33
- `;
34
-
35
- export const CheckboxIconWrapper = styled.div<{ checked?: boolean }>`
36
- display: flex;
37
- align-items: center;
38
- justify-content: center;
39
- position: absolute;
40
- width: ${semanticSizes.global.padding.xl};
41
- height: ${semanticSizes.global.padding.xl};
42
- left: 0;
43
- top: 50%;
44
- transform: translateY(-50%);
45
- pointer-events: none;
46
- color: ${({ checked }) =>
47
- checked ? semanticColors.base.background : "transparent"};
48
- `;
49
-
50
- export const CheckboxLabel = styled.span`
51
- font-size: ${typographyTokens.fontSizes.labelS};
52
- color: ${semanticColors.base.text};
53
- `;
54
-
55
- export const CheckboxGroupWrapper = styled.div`
56
- display: flex;
57
- flex-direction: column;
58
- gap: ${semanticSizes.global.gap.sm};
59
- `;
60
-
61
- export const CheckboxGroupHorizontal = styled(CheckboxGroupWrapper)`
62
- flex-direction: row;
63
- flex-wrap: wrap;
64
- `;
65
-
66
- export const SelectAllWrapper = styled.div`
67
- display: flex;
68
- flex-direction: column;
69
- gap: ${semanticSizes.global.gap.sm};
70
- font-weight: bold;
71
- font-size: ${typographyTokens.fontSizes.labelS};
72
- `;
1
+ import styled from 'styled-components';
2
+ import {
3
+ semanticColors,
4
+ semanticSizes,
5
+ semanticRadius,
6
+ typographyTokens,
7
+ } from '../../../styles/tokens';
8
+
9
+ export const CheckboxWrapper = styled.label`
10
+ display: flex;
11
+ align-items: center;
12
+ gap: ${semanticSizes.global.gap.sm};
13
+ cursor: pointer;
14
+ font-size: ${typographyTokens.fontSizes.labelS};
15
+ color: ${semanticColors.neutral[600]};
16
+ user-select: none;
17
+ `;
18
+
19
+ export const StyledCheckbox = styled.input`
20
+ width: ${semanticSizes.global.padding.xl};
21
+ height: ${semanticSizes.global.padding.xl};
22
+ border: 2px solid ${semanticColors.neutral[400]};
23
+ border-radius: ${semanticRadius.global.radius.sm};
24
+ appearance: none;
25
+ cursor: pointer;
26
+ position: relative;
27
+ transition: all 0.2s ease-in-out;
28
+
29
+ &:checked {
30
+ background: ${semanticColors.branding.surface.enabled};
31
+ border-color: ${semanticColors.branding.surface.enabled};
32
+ }
33
+ `;
34
+
35
+ export const CheckboxIconWrapper = styled.div<{ checked?: boolean }>`
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+ position: absolute;
40
+ width: ${semanticSizes.global.padding.xl};
41
+ height: ${semanticSizes.global.padding.xl};
42
+ left: 0;
43
+ top: 50%;
44
+ transform: translateY(-50%);
45
+ pointer-events: none;
46
+ color: ${({ checked }) =>
47
+ checked ? semanticColors.base.background : 'transparent'};
48
+ `;
49
+
50
+ export const CheckboxLabel = styled.span`
51
+ font-size: ${typographyTokens.fontSizes.labelS};
52
+ color: ${semanticColors.base.text};
53
+ `;
54
+
55
+ export const CheckboxGroupWrapper = styled.div`
56
+ display: flex;
57
+ flex-direction: column;
58
+ gap: ${semanticSizes.global.gap.sm};
59
+ `;
60
+
61
+ export const CheckboxGroupHorizontal = styled(CheckboxGroupWrapper)`
62
+ flex-direction: row;
63
+ flex-wrap: wrap;
64
+ `;
65
+
66
+ export const SelectAllWrapper = styled.div`
67
+ display: flex;
68
+ flex-direction: column;
69
+ gap: ${semanticSizes.global.gap.sm};
70
+ font-weight: bold;
71
+ font-size: ${typographyTokens.fontSizes.labelS};
72
+ `;
@@ -1,36 +1,36 @@
1
- import React from "react";
2
- import { Check } from "@phosphor-icons/react";
3
- import {
4
- CheckboxWrapper,
5
- StyledCheckbox,
6
- CheckboxLabel,
7
- CheckboxIconWrapper,
8
- } from "./Checkbox.styles";
9
- import { CheckboxProps } from "./Checkbox.types";
10
- import { semanticSizes } from "../../../styles/tokens";
11
-
12
- export const Checkbox: React.FC<CheckboxProps> = ({
13
- label,
14
- checked,
15
- onChange,
16
- disabled = false,
17
- ...props
18
- }) => {
19
- return (
20
- <CheckboxWrapper>
21
- <StyledCheckbox
22
- type="checkbox"
23
- checked={checked}
24
- onChange={onChange}
25
- disabled={disabled}
26
- {...props}
27
- />
28
- {checked && (
29
- <CheckboxIconWrapper>
30
- <Check size={semanticSizes.global.padding.sm} weight="bold" />
31
- </CheckboxIconWrapper>
32
- )}
33
- {label && <CheckboxLabel>{label}</CheckboxLabel>}
34
- </CheckboxWrapper>
35
- );
36
- };
1
+ import React from 'react';
2
+ import { Check } from '@phosphor-icons/react';
3
+ import {
4
+ CheckboxWrapper,
5
+ StyledCheckbox,
6
+ CheckboxLabel,
7
+ CheckboxIconWrapper,
8
+ } from './Checkbox.styles';
9
+ import { CheckboxProps } from './Checkbox.types';
10
+ import { semanticSizes } from '../../../styles/tokens';
11
+
12
+ export const Checkbox: React.FC<CheckboxProps> = ({
13
+ label,
14
+ checked,
15
+ onChange,
16
+ disabled = false,
17
+ ...props
18
+ }) => {
19
+ return (
20
+ <CheckboxWrapper>
21
+ <StyledCheckbox
22
+ type="checkbox"
23
+ checked={checked}
24
+ onChange={onChange}
25
+ disabled={disabled}
26
+ {...props}
27
+ />
28
+ {checked && (
29
+ <CheckboxIconWrapper>
30
+ <Check size={semanticSizes.global.padding.sm} weight="bold" />
31
+ </CheckboxIconWrapper>
32
+ )}
33
+ {label && <CheckboxLabel>{label}</CheckboxLabel>}
34
+ </CheckboxWrapper>
35
+ );
36
+ };
@@ -1,14 +1,14 @@
1
- export interface CheckboxProps
2
- extends React.InputHTMLAttributes<HTMLInputElement> {
3
- label?: string;
4
- checked?: boolean;
5
- onChange?: () => void;
6
- disabled?: boolean;
7
- }
8
-
9
- export interface CheckboxGroupProps {
10
- options: { label: string; value: string }[];
11
- selected: string[];
12
- setSelected: (values: string[]) => void;
13
- direction?: "vertical" | "horizontal";
14
- }
1
+ export interface CheckboxProps
2
+ extends React.InputHTMLAttributes<HTMLInputElement> {
3
+ label?: string;
4
+ checked?: boolean;
5
+ onChange?: () => void;
6
+ disabled?: boolean;
7
+ }
8
+
9
+ export interface CheckboxGroupProps {
10
+ options: { label: string; value: string }[];
11
+ selected: string[];
12
+ setSelected: (values: string[]) => void;
13
+ direction?: 'vertical' | 'horizontal';
14
+ }
@@ -1,30 +1,30 @@
1
- import React from "react";
2
- import { Checkbox } from "./Checkbox";
3
- import { CheckboxGroupProps } from "./Checkbox.types";
4
- import { CheckboxGroupWrapper } from "./Checkbox.styles";
5
-
6
- export const CheckboxGroup: React.FC<CheckboxGroupProps> = ({
7
- options,
8
- selected,
9
- setSelected,
10
- }) => {
11
- const handleChange = (value: string) => {
12
- const newSelected = selected.includes(value)
13
- ? selected.filter((v: string) => v !== value)
14
- : [...selected, value];
15
- setSelected(newSelected);
16
- };
17
-
18
- return (
19
- <CheckboxGroupWrapper>
20
- {options.map((option) => (
21
- <Checkbox
22
- key={option.value}
23
- label={option.label}
24
- checked={selected.includes(option.value)}
25
- onChange={() => handleChange(option.value)}
26
- />
27
- ))}
28
- </CheckboxGroupWrapper>
29
- );
30
- };
1
+ import React from 'react';
2
+ import { Checkbox } from './Checkbox';
3
+ import { CheckboxGroupProps } from './Checkbox.types';
4
+ import { CheckboxGroupWrapper } from './Checkbox.styles';
5
+
6
+ export const CheckboxGroup: React.FC<CheckboxGroupProps> = ({
7
+ options,
8
+ selected,
9
+ setSelected,
10
+ }) => {
11
+ const handleChange = (value: string) => {
12
+ const newSelected = selected.includes(value)
13
+ ? selected.filter((v: string) => v !== value)
14
+ : [...selected, value];
15
+ setSelected(newSelected);
16
+ };
17
+
18
+ return (
19
+ <CheckboxGroupWrapper>
20
+ {options.map((option) => (
21
+ <Checkbox
22
+ key={option.value}
23
+ label={option.label}
24
+ checked={selected.includes(option.value)}
25
+ onChange={() => handleChange(option.value)}
26
+ />
27
+ ))}
28
+ </CheckboxGroupWrapper>
29
+ );
30
+ };
@@ -1,32 +1,32 @@
1
- import React from "react";
2
- import { Checkbox } from "./Checkbox";
3
- import { CheckboxGroup } from "./CheckboxGroup";
4
- import { CheckboxGroupProps } from "./Checkbox.types";
5
- import { SelectAllWrapper } from "./Checkbox.styles";
6
-
7
- export const CheckboxSelectAll: React.FC<CheckboxGroupProps> = ({
8
- options,
9
- selected,
10
- setSelected,
11
- }) => {
12
- const allSelected = selected.length === options.length;
13
-
14
- const handleSelectAll = () => {
15
- setSelected(allSelected ? [] : options.map((option) => option.value));
16
- };
17
-
18
- return (
19
- <SelectAllWrapper>
20
- <Checkbox
21
- label="Selecionar todos"
22
- checked={allSelected}
23
- onChange={handleSelectAll}
24
- />
25
- <CheckboxGroup
26
- options={options}
27
- selected={selected}
28
- setSelected={setSelected}
29
- />
30
- </SelectAllWrapper>
31
- );
32
- };
1
+ import React from 'react';
2
+ import { Checkbox } from './Checkbox';
3
+ import { CheckboxGroup } from './CheckboxGroup';
4
+ import { CheckboxGroupProps } from './Checkbox.types';
5
+ import { SelectAllWrapper } from './Checkbox.styles';
6
+
7
+ export const CheckboxSelectAll: React.FC<CheckboxGroupProps> = ({
8
+ options,
9
+ selected,
10
+ setSelected,
11
+ }) => {
12
+ const allSelected = selected.length === options.length;
13
+
14
+ const handleSelectAll = () => {
15
+ setSelected(allSelected ? [] : options.map((option) => option.value));
16
+ };
17
+
18
+ return (
19
+ <SelectAllWrapper>
20
+ <Checkbox
21
+ label="Selecionar todos"
22
+ checked={allSelected}
23
+ onChange={handleSelectAll}
24
+ />
25
+ <CheckboxGroup
26
+ options={options}
27
+ selected={selected}
28
+ setSelected={setSelected}
29
+ />
30
+ </SelectAllWrapper>
31
+ );
32
+ };
@@ -1,39 +1,38 @@
1
-
2
- import {
3
- primitiveSizes,
4
- semanticBorders,
5
- semanticColors,
6
- semanticSizes,
7
- semanticRadius,
8
- typographyTokens,
9
- } from "../../../styles/tokens";
10
- import { styled } from "styled-components";
11
-
12
- const borderColor = semanticColors.global.border.strong;
13
- const inputWidth = semanticSizes.global.spacings.lg;
14
- const inputHeight = primitiveSizes.size.x14;
15
- const fontSize = typographyTokens.fontSizes.labelL;
16
- const borderRadius = semanticRadius.global.radius.md;
17
- const borderStyle = semanticBorders.global.sm;
18
-
19
- export const StyledCodeInput = styled.input`
20
- width: ${inputWidth};
21
- height: ${inputHeight};
22
- font-size: ${fontSize};
23
- text-align: center;
24
- border-top: ${borderStyle} solid ${borderColor};
25
- border-bottom: ${borderStyle} solid ${borderColor};
26
- border-left: 0;
27
- border-right: ${borderStyle} solid ${borderColor};
28
-
29
- &:first-child {
30
- border-top-left-radius: ${borderRadius};
31
- border-bottom-left-radius: ${borderRadius};
32
- border-left: ${borderStyle} solid ${borderColor};
33
- }
34
-
35
- &:last-child {
36
- border-top-right-radius: ${borderRadius};
37
- border-bottom-right-radius: ${borderRadius};
38
- }
39
- `;
1
+ import {
2
+ primitiveSizes,
3
+ semanticBorders,
4
+ semanticColors,
5
+ semanticSizes,
6
+ semanticRadius,
7
+ typographyTokens,
8
+ } from '../../../styles/tokens';
9
+ import { styled } from 'styled-components';
10
+
11
+ const borderColor = semanticColors.global.border.strong;
12
+ const inputWidth = semanticSizes.global.spacings.lg;
13
+ const inputHeight = primitiveSizes.size.x14;
14
+ const fontSize = typographyTokens.fontSizes.labelL;
15
+ const borderRadius = semanticRadius.global.radius.md;
16
+ const borderStyle = semanticBorders.global.sm;
17
+
18
+ export const StyledCodeInput = styled.input`
19
+ width: ${inputWidth};
20
+ height: ${inputHeight};
21
+ font-size: ${fontSize};
22
+ text-align: center;
23
+ border-top: ${borderStyle} solid ${borderColor};
24
+ border-bottom: ${borderStyle} solid ${borderColor};
25
+ border-left: 0;
26
+ border-right: ${borderStyle} solid ${borderColor};
27
+
28
+ &:first-child {
29
+ border-top-left-radius: ${borderRadius};
30
+ border-bottom-left-radius: ${borderRadius};
31
+ border-left: ${borderStyle} solid ${borderColor};
32
+ }
33
+
34
+ &:last-child {
35
+ border-top-right-radius: ${borderRadius};
36
+ border-bottom-right-radius: ${borderRadius};
37
+ }
38
+ `;