@granto-umbrella/umbrella-components 3.0.34 → 3.0.37

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 (158) hide show
  1. package/README.md +165 -27
  2. package/dist/umbrella-components.css +1 -1
  3. package/dist/umbrella-components.es.js +33627 -28792
  4. package/dist/umbrella-components.umd.js +1169 -1908
  5. package/package.json +136 -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 -25
  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 -56
  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/ExportExcelModal/ExportExcelModal.styles.ts +59 -0
  140. package/src/components/organisms/ExportExcelModal/ExportExcelModal.tsx +80 -0
  141. package/src/components/organisms/Form/Form.styles.ts +35 -35
  142. package/src/components/organisms/Form/Form.tsx +160 -160
  143. package/src/components/organisms/ListagemUltimasEmissoes/ListagemUltimasEmissoes.styles.tsx +115 -114
  144. package/src/components/organisms/ListagemUltimasEmissoes/ListagemUltimasEmissoes.tsx +89 -89
  145. package/src/components/organisms/ListagemUltimasEmissoes/ListagemUltimasEmissoes.types.ts +16 -16
  146. package/src/components/organisms/ListagemUltimasEmissoes/index.tsx +1 -1
  147. package/src/components/organisms/Navbar/Navbar.styles.tsx +243 -243
  148. package/src/global.d.ts +9 -9
  149. package/src/index.ts +4 -0
  150. package/src/lib/utils.ts +6 -6
  151. package/src/styles/tokens/borders.ts +17 -17
  152. package/src/styles/tokens/index.tsx +6 -6
  153. package/src/styles/tokens/radius.ts +22 -22
  154. package/src/styles/tokens/shadows.ts +22 -22
  155. package/src/styles/tokens/sizes.ts +60 -64
  156. package/src/types/radius.types.ts +1 -1
  157. package/src/types/shadows.types.ts +1 -1
  158. package/src/utils/renderHighlightsCard.tsx +21 -0
@@ -1,65 +1,66 @@
1
- import styled, { keyframes } from "styled-components";
2
- import * as PopoverPrimitive from "@radix-ui/react-popover";
3
-
4
- const animateIn = keyframes`
5
- from { opacity: 0; transform: scale(0.95); }
6
- to { opacity: 1; transform: scale(1); }
7
- `;
8
-
9
- const animateOut = keyframes`
10
- from { opacity: 1; transform: scale(1); }
11
- to { opacity: 0; transform: scale(0.95); }
12
- `;
13
-
14
- const slideInFromTop2 = keyframes`
15
- from { transform: translateY(-10px); opacity: 0; }
16
- to { transform: translateY(0); opacity: 1; }
17
- `;
18
-
19
- const slideInFromRight2 = keyframes`
20
- from { transform: translateX(10px); opacity: 0; }
21
- to { transform: translateX(0); opacity: 1; }
22
- `;
23
-
24
- const slideInFromLeft2 = keyframes`
25
- from { transform: translateX(-10px); opacity: 0; }
26
- to { transform: translateX(0); opacity: 1; }
27
- `;
28
-
29
- const slideInFromBottom2 = keyframes`
30
- from { transform: translateY(10px); opacity: 0; }
31
- to { transform: translateY(0); opacity: 1; }
32
- `;
33
-
34
- export const StyledPopoverContent = styled(PopoverPrimitive.Content)`
35
- z-index: 50;
36
- width: 18rem;
37
- border-radius: 0.375rem;
38
- border: 1px solid #e5e7eb;
39
- background-color: var(--popover-bg, #fff);
40
- padding: 1rem;
41
- color: var(--popover-foreground, #000);
42
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
43
- 0 2px 4px -1px rgba(0, 0, 0, 0.06);
44
- outline: none;
45
-
46
- &[data-state="open"] {
47
- animation: ${animateIn} 0.3s ease-out forwards;
48
- }
49
- &[data-state="closed"] {
50
- animation: ${animateOut} 0.3s ease-in forwards;
51
- }
52
-
53
- &[data-side="bottom"] {
54
- animation: ${slideInFromTop2} 0.3s ease-out forwards;
55
- }
56
- &[data-side="left"] {
57
- animation: ${slideInFromRight2} 0.3s ease-out forwards;
58
- }
59
- &[data-side="right"] {
60
- animation: ${slideInFromLeft2} 0.3s ease-out forwards;
61
- }
62
- &[data-side="top"] {
63
- animation: ${slideInFromBottom2} 0.3s ease-out forwards;
64
- }
65
- `;
1
+ import styled, { keyframes } from 'styled-components';
2
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
3
+
4
+ const animateIn = keyframes`
5
+ from { opacity: 0; transform: scale(0.95); }
6
+ to { opacity: 1; transform: scale(1); }
7
+ `;
8
+
9
+ const animateOut = keyframes`
10
+ from { opacity: 1; transform: scale(1); }
11
+ to { opacity: 0; transform: scale(0.95); }
12
+ `;
13
+
14
+ const slideInFromTop2 = keyframes`
15
+ from { transform: translateY(-10px); opacity: 0; }
16
+ to { transform: translateY(0); opacity: 1; }
17
+ `;
18
+
19
+ const slideInFromRight2 = keyframes`
20
+ from { transform: translateX(10px); opacity: 0; }
21
+ to { transform: translateX(0); opacity: 1; }
22
+ `;
23
+
24
+ const slideInFromLeft2 = keyframes`
25
+ from { transform: translateX(-10px); opacity: 0; }
26
+ to { transform: translateX(0); opacity: 1; }
27
+ `;
28
+
29
+ const slideInFromBottom2 = keyframes`
30
+ from { transform: translateY(10px); opacity: 0; }
31
+ to { transform: translateY(0); opacity: 1; }
32
+ `;
33
+
34
+ export const StyledPopoverContent = styled(PopoverPrimitive.Content)`
35
+ z-index: 50;
36
+ width: 18rem;
37
+ border-radius: 0.375rem;
38
+ border: 1px solid #e5e7eb;
39
+ background-color: var(--popover-bg, #fff);
40
+ padding: 1rem;
41
+ color: var(--popover-foreground, #000);
42
+ box-shadow:
43
+ 0 4px 6px -1px rgba(0, 0, 0, 0.1),
44
+ 0 2px 4px -1px rgba(0, 0, 0, 0.06);
45
+ outline: none;
46
+
47
+ &[data-state='open'] {
48
+ animation: ${animateIn} 0.3s ease-out forwards;
49
+ }
50
+ &[data-state='closed'] {
51
+ animation: ${animateOut} 0.3s ease-in forwards;
52
+ }
53
+
54
+ &[data-side='bottom'] {
55
+ animation: ${slideInFromTop2} 0.3s ease-out forwards;
56
+ }
57
+ &[data-side='left'] {
58
+ animation: ${slideInFromRight2} 0.3s ease-out forwards;
59
+ }
60
+ &[data-side='right'] {
61
+ animation: ${slideInFromLeft2} 0.3s ease-out forwards;
62
+ }
63
+ &[data-side='top'] {
64
+ animation: ${slideInFromBottom2} 0.3s ease-out forwards;
65
+ }
66
+ `;
@@ -1,23 +1,23 @@
1
- import * as React from "react";
2
- import * as PopoverPrimitive from "@radix-ui/react-popover";
3
- import { StyledPopoverContent } from "./Popover.styles";
4
-
5
- const Popover = PopoverPrimitive.Root;
6
- const PopoverTrigger = PopoverPrimitive.Trigger;
7
-
8
- const PopoverContent = React.forwardRef<
9
- React.ElementRef<typeof PopoverPrimitive.Content>,
10
- React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
11
- >(({ align = "center", sideOffset = 4, ...props }, ref) => (
12
- <PopoverPrimitive.Portal>
13
- <StyledPopoverContent
14
- ref={ref}
15
- align={align}
16
- sideOffset={sideOffset}
17
- {...props}
18
- />
19
- </PopoverPrimitive.Portal>
20
- ));
21
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
22
-
23
- export { Popover, PopoverTrigger, PopoverContent };
1
+ import * as React from 'react';
2
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
3
+ import { StyledPopoverContent } from './Popover.styles';
4
+
5
+ const Popover = PopoverPrimitive.Root;
6
+ const PopoverTrigger = PopoverPrimitive.Trigger;
7
+
8
+ const PopoverContent = React.forwardRef<
9
+ React.ElementRef<typeof PopoverPrimitive.Content>,
10
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
11
+ >(({ align = 'center', sideOffset = 4, ...props }, ref) => (
12
+ <PopoverPrimitive.Portal>
13
+ <StyledPopoverContent
14
+ ref={ref}
15
+ align={align}
16
+ sideOffset={sideOffset}
17
+ {...props}
18
+ />
19
+ </PopoverPrimitive.Portal>
20
+ ));
21
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
22
+
23
+ export { Popover, PopoverTrigger, PopoverContent };
@@ -1,11 +1,11 @@
1
- import styled from "styled-components";
2
- import { semanticSizes } from "../../../styles/tokens";
3
-
4
- export const Container = styled.div<{
5
- orientation?: "horizontal" | "vertical";
6
- }>`
7
- display: flex;
8
- flex-direction: ${({ orientation = "horizontal" }) =>
9
- orientation === "vertical" ? "column" : "row"};
10
- gap: ${semanticSizes.global.padding.sm};
11
- `;
1
+ import styled from 'styled-components';
2
+ import { semanticSizes } from '../../../styles/tokens';
3
+
4
+ export const Container = styled.div<{
5
+ orientation?: 'horizontal' | 'vertical';
6
+ }>`
7
+ display: flex;
8
+ flex-direction: ${({ orientation = 'horizontal' }) =>
9
+ orientation === 'vertical' ? 'column' : 'row'};
10
+ gap: ${semanticSizes.global.padding.sm};
11
+ `;
@@ -1,43 +1,43 @@
1
- import React from "react";
2
- import { Container } from "./RadioBoxGroup.styles";
3
- import RadioButton from "../../../components/atoms/RadioButton/RadioButton";
4
-
5
- export interface Option {
6
- label: string;
7
- value: string | number;
8
- disabled?: boolean;
9
- }
10
-
11
- export interface RadioBoxGroupProps {
12
- name: string;
13
- options: Option[];
14
- value: string;
15
- onChange: (value: string) => void;
16
- orientation?: "horizontal" | "vertical";
17
- }
18
-
19
- const RadioBoxGroup: React.FC<RadioBoxGroupProps> = ({
20
- name,
21
- options,
22
- value,
23
- onChange,
24
- orientation = "horizontal",
25
- }) => {
26
- return (
27
- <Container orientation={orientation}>
28
- {options.map((opt) => (
29
- <RadioButton
30
- key={opt.value}
31
- name={name}
32
- value={`${opt.value}`}
33
- label={opt.label}
34
- checked={opt.value === value}
35
- disabled={opt.disabled}
36
- onChange={(e) => onChange(e.currentTarget.value)}
37
- />
38
- ))}
39
- </Container>
40
- );
41
- };
42
-
43
- export default RadioBoxGroup;
1
+ import React from 'react';
2
+ import { Container } from './RadioBoxGroup.styles';
3
+ import RadioButton from '../../../components/atoms/RadioButton/RadioButton';
4
+
5
+ export interface Option {
6
+ label: string;
7
+ value: string | number;
8
+ disabled?: boolean;
9
+ }
10
+
11
+ export interface RadioBoxGroupProps {
12
+ name: string;
13
+ options: Option[];
14
+ value: string;
15
+ onChange: (value: string) => void;
16
+ orientation?: 'horizontal' | 'vertical';
17
+ }
18
+
19
+ const RadioBoxGroup: React.FC<RadioBoxGroupProps> = ({
20
+ name,
21
+ options,
22
+ value,
23
+ onChange,
24
+ orientation = 'horizontal',
25
+ }) => {
26
+ return (
27
+ <Container orientation={orientation}>
28
+ {options.map((opt) => (
29
+ <RadioButton
30
+ key={opt.value}
31
+ name={name}
32
+ value={`${opt.value}`}
33
+ label={opt.label}
34
+ checked={opt.value === value}
35
+ disabled={opt.disabled}
36
+ onChange={(e) => onChange(e.currentTarget.value)}
37
+ />
38
+ ))}
39
+ </Container>
40
+ );
41
+ };
42
+
43
+ export default RadioBoxGroup;
@@ -1,64 +1,65 @@
1
- import styled from "styled-components";
2
- import {
3
- semanticColors,
4
- semanticRadius,
5
- semanticSizes,
6
- typographyTokens,
7
- } from "../../../styles/tokens";
8
-
9
- export const RadioGroupContainer = styled.div`
10
- display: flex;
11
- flex-wrap: wrap;
12
- gap: ${semanticSizes.global.gap.md};
13
- width: 100%;
14
- `;
15
-
16
- export const RadioButton = styled.div<{ isSelected: boolean }>`
17
- min-width: 274px;
18
- padding: ${semanticSizes.global.padding.md} ${semanticSizes.global.padding["2xl"]};
19
- height: 40px;
20
- display: flex;
21
- align-items: center;
22
- justify-content: center;
23
- cursor: pointer;
24
- border-radius: ${semanticRadius.global.radius.md2};
25
- transition: all 0.2s;
26
- font-size: ${typographyTokens.fontSizes.bodyS};
27
- font-weight: ${typographyTokens.fontWeights.regular};
28
-
29
- ${({ isSelected }) =>
30
- isSelected
31
- ? `
32
- background-color: ${semanticColors.branding.surface.enabled};
33
- color: ${semanticColors.branding.text.onSurfaceAccent.enabled};
34
- border: none;
35
- `
36
- : `
37
- background-color: ${semanticColors.base.background};
38
- color: ${semanticColors.neutral[700]};
39
- border: 1px solid ${semanticColors.global.border.default};
40
-
41
- &:hover {
42
- border-color: ${semanticColors.global.border.medium};
43
- }
44
- `}
45
-
46
- &:disabled {
47
- cursor: not-allowed;
48
- opacity: 0.5;
49
- }
50
- `;
51
-
52
- export const RadioLabel = styled.label`
53
- display: inline-flex;
54
- align-items: center;
55
- gap: ${semanticSizes.global.gap.lg};
56
- cursor: pointer;
57
- margin: 0;
58
- `;
59
-
60
- export const HiddenRadioInput = styled.input`
61
- position: absolute;
62
- opacity: 0;
63
- pointer-events: none;
64
- `;
1
+ import styled from 'styled-components';
2
+ import {
3
+ semanticColors,
4
+ semanticRadius,
5
+ semanticSizes,
6
+ typographyTokens,
7
+ } from '../../../styles/tokens';
8
+
9
+ export const RadioGroupContainer = styled.div`
10
+ display: flex;
11
+ flex-wrap: wrap;
12
+ gap: ${semanticSizes.global.gap.md};
13
+ width: 100%;
14
+ `;
15
+
16
+ export const RadioButton = styled.div<{ isSelected: boolean }>`
17
+ min-width: 274px;
18
+ padding: ${semanticSizes.global.padding.md}
19
+ ${semanticSizes.global.padding['2xl']};
20
+ height: 40px;
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: center;
24
+ cursor: pointer;
25
+ border-radius: ${semanticRadius.global.radius.md2};
26
+ transition: all 0.2s;
27
+ font-size: ${typographyTokens.fontSizes.bodyS};
28
+ font-weight: ${typographyTokens.fontWeights.regular};
29
+
30
+ ${({ isSelected }) =>
31
+ isSelected
32
+ ? `
33
+ background-color: ${semanticColors.branding.surface.enabled};
34
+ color: ${semanticColors.branding.text.onSurfaceAccent.enabled};
35
+ border: none;
36
+ `
37
+ : `
38
+ background-color: ${semanticColors.base.background};
39
+ color: ${semanticColors.neutral[700]};
40
+ border: 1px solid ${semanticColors.global.border.default};
41
+
42
+ &:hover {
43
+ border-color: ${semanticColors.global.border.medium};
44
+ }
45
+ `}
46
+
47
+ &:disabled {
48
+ cursor: not-allowed;
49
+ opacity: 0.5;
50
+ }
51
+ `;
52
+
53
+ export const RadioLabel = styled.label`
54
+ display: inline-flex;
55
+ align-items: center;
56
+ gap: ${semanticSizes.global.gap.lg};
57
+ cursor: pointer;
58
+ margin: 0;
59
+ `;
60
+
61
+ export const HiddenRadioInput = styled.input`
62
+ position: absolute;
63
+ opacity: 0;
64
+ pointer-events: none;
65
+ `;
@@ -1,69 +1,69 @@
1
- import React, { useState } from "react";
2
- import {
3
- RadioGroupContainer,
4
- RadioButton,
5
- RadioLabel,
6
- HiddenRadioInput,
7
- } from "./RadioGroupField.styles";
8
- import { RadioGroupFieldProps } from "./RadioGroupField.types";
9
-
10
- const RadioGroupField: React.FC<RadioGroupFieldProps> = ({
11
- options,
12
- value: controlledValue,
13
- defaultValue,
14
- onChange,
15
- name = "radio-group",
16
- disabled = false,
17
- }) => {
18
- const [internalValue, setInternalValue] = useState(defaultValue || "");
19
-
20
- // Componente controlado ou não-controlado
21
- const isControlled = controlledValue !== undefined;
22
- const currentValue = isControlled ? controlledValue : internalValue;
23
-
24
- const handleChange = (optionValue: string) => {
25
- if (disabled) return;
26
-
27
- if (!isControlled) {
28
- setInternalValue(optionValue);
29
- }
30
-
31
- onChange?.(optionValue);
32
- };
33
-
34
- return (
35
- <RadioGroupContainer>
36
- {options.map((option) => {
37
- const isSelected = currentValue === option.value;
38
-
39
- return (
40
- <RadioButton
41
- key={option.value}
42
- isSelected={isSelected}
43
- onClick={() => handleChange(option.value)}
44
- role="radio"
45
- aria-checked={isSelected}
46
- aria-disabled={disabled}
47
- >
48
- <RadioLabel>
49
- <HiddenRadioInput
50
- type="radio"
51
- name={name}
52
- value={option.value}
53
- checked={isSelected}
54
- onChange={() => handleChange(option.value)}
55
- disabled={disabled}
56
- />
57
-
58
- {isSelected ? option.iconActive : option.iconInactive}
59
-
60
- <span>{option.label}</span>
61
- </RadioLabel>
62
- </RadioButton>
63
- );
64
- })}
65
- </RadioGroupContainer>
66
- );
67
- };
68
-
69
- export { RadioGroupField };
1
+ import React, { useState } from 'react';
2
+ import {
3
+ RadioGroupContainer,
4
+ RadioButton,
5
+ RadioLabel,
6
+ HiddenRadioInput,
7
+ } from './RadioGroupField.styles';
8
+ import { RadioGroupFieldProps } from './RadioGroupField.types';
9
+
10
+ const RadioGroupField: React.FC<RadioGroupFieldProps> = ({
11
+ options,
12
+ value: controlledValue,
13
+ defaultValue,
14
+ onChange,
15
+ name = 'radio-group',
16
+ disabled = false,
17
+ }) => {
18
+ const [internalValue, setInternalValue] = useState(defaultValue || '');
19
+
20
+ // Componente controlado ou não-controlado
21
+ const isControlled = controlledValue !== undefined;
22
+ const currentValue = isControlled ? controlledValue : internalValue;
23
+
24
+ const handleChange = (optionValue: string) => {
25
+ if (disabled) return;
26
+
27
+ if (!isControlled) {
28
+ setInternalValue(optionValue);
29
+ }
30
+
31
+ onChange?.(optionValue);
32
+ };
33
+
34
+ return (
35
+ <RadioGroupContainer>
36
+ {options.map((option) => {
37
+ const isSelected = currentValue === option.value;
38
+
39
+ return (
40
+ <RadioButton
41
+ key={option.value}
42
+ isSelected={isSelected}
43
+ onClick={() => handleChange(option.value)}
44
+ role="radio"
45
+ aria-checked={isSelected}
46
+ aria-disabled={disabled}
47
+ >
48
+ <RadioLabel>
49
+ <HiddenRadioInput
50
+ type="radio"
51
+ name={name}
52
+ value={option.value}
53
+ checked={isSelected}
54
+ onChange={() => handleChange(option.value)}
55
+ disabled={disabled}
56
+ />
57
+
58
+ {isSelected ? option.iconActive : option.iconInactive}
59
+
60
+ <span>{option.label}</span>
61
+ </RadioLabel>
62
+ </RadioButton>
63
+ );
64
+ })}
65
+ </RadioGroupContainer>
66
+ );
67
+ };
68
+
69
+ export { RadioGroupField };
@@ -1,17 +1,17 @@
1
- import { ReactNode } from "react";
2
-
3
- export interface RadioOption {
4
- value: string;
5
- label: string;
6
- iconActive?: ReactNode;
7
- iconInactive?: ReactNode;
8
- }
9
-
10
- export interface RadioGroupFieldProps {
11
- options: RadioOption[];
12
- value?: string;
13
- defaultValue?: string;
14
- onChange?: (value: string) => void;
15
- name?: string;
16
- disabled?: boolean;
17
- }
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface RadioOption {
4
+ value: string;
5
+ label: string;
6
+ iconActive?: ReactNode;
7
+ iconInactive?: ReactNode;
8
+ }
9
+
10
+ export interface RadioGroupFieldProps {
11
+ options: RadioOption[];
12
+ value?: string;
13
+ defaultValue?: string;
14
+ onChange?: (value: string) => void;
15
+ name?: string;
16
+ disabled?: boolean;
17
+ }
@@ -1 +1 @@
1
- export { RadioGroupField } from "./RadioGroupField";
1
+ export { RadioGroupField } from './RadioGroupField';