@granto-umbrella/umbrella-components 3.0.34 → 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.
- package/README.md +165 -27
- package/dist/umbrella-components.css +1 -1
- package/dist/umbrella-components.es.js +28129 -29249
- package/dist/umbrella-components.umd.js +1234 -2181
- package/package.json +135 -106
- package/src/assets.d.ts +19 -19
- package/src/components/atoms/Badge/Badge.styles.ts +88 -86
- package/src/components/atoms/Badge/Badge.tsx +42 -44
- package/src/components/atoms/Badge/Badge.types.ts +15 -15
- package/src/components/atoms/Breadcrumb/Breadcrumb.styles.ts +43 -43
- package/src/components/atoms/Breadcrumb/Breadcrumb.tsx +46 -48
- package/src/components/atoms/Breadcrumb/Breadcrumb.types.ts +12 -12
- package/src/components/atoms/Button/Button.styles.ts +279 -280
- package/src/components/atoms/Button/Button.tsx +76 -76
- package/src/components/atoms/Button/Button.types.ts +28 -28
- package/src/components/atoms/Button/index.ts +1 -1
- package/src/components/atoms/Checkbox/Checkbox.styles.ts +72 -72
- package/src/components/atoms/Checkbox/Checkbox.tsx +36 -36
- package/src/components/atoms/Checkbox/Checkbox.types.ts +14 -14
- package/src/components/atoms/Checkbox/CheckboxGroup.tsx +30 -30
- package/src/components/atoms/Checkbox/CheckboxSelectAll.tsx +32 -32
- package/src/components/atoms/CodeInput/CodeInput.styles.tsx +38 -39
- package/src/components/atoms/CodeInput/CodeInput.tsx +13 -19
- package/src/components/atoms/CodeInput/CodeInput.types.ts +3 -3
- package/src/components/atoms/CodeInput/index.tsx +1 -1
- package/src/components/atoms/DropDownMenu/DropdownMenu.tsx +48 -48
- package/src/components/atoms/DropDownMenu/DropdownMenu.types.ts +15 -15
- package/src/components/atoms/DropDownMenu/index.tsx +5 -2
- package/src/components/atoms/ErrorMessage/ErrorMessage.styles.tsx +28 -28
- package/src/components/atoms/ErrorMessage/ErrorMessage.tsx +12 -12
- package/src/components/atoms/ErrorMessage/ErrorMessage.types.ts +6 -6
- package/src/components/atoms/ErrorMessage/index.tsx +1 -1
- package/src/components/atoms/Footer/Footer.styles.tsx +22 -22
- package/src/components/atoms/Footer/Footer.tsx +9 -9
- package/src/components/atoms/Footer/Footer.types.tsx +5 -5
- package/src/components/atoms/Footer/index.tsx +1 -1
- package/src/components/atoms/GenericContainer/GenericContainer.styles.tsx +21 -21
- package/src/components/atoms/GenericContainer/GenericContainer.tsx +9 -9
- package/src/components/atoms/GenericContainer/GenericContainer.types.ts +5 -5
- package/src/components/atoms/GenericContainer/index.tsx +1 -1
- package/src/components/atoms/Icon/Icon.styles.ts +11 -11
- package/src/components/atoms/Icon/Icon.tsx +22 -22
- package/src/components/atoms/Icon/Icon.types.ts +6 -6
- package/src/components/atoms/Icon/index.ts +1 -1
- package/src/components/atoms/Input/Input.styles.ts +106 -101
- package/src/components/atoms/Input/index.ts +1 -1
- package/src/components/atoms/Label/Label.tsx +16 -16
- package/src/components/atoms/Loading/Loading.styles.tsx +25 -25
- package/src/components/atoms/Loading/Loading.tsx +8 -8
- package/src/components/atoms/LogoContainer/LogoContainer.Types.tsx +5 -5
- package/src/components/atoms/LogoContainer/LogoContainer.styles.tsx +11 -11
- package/src/components/atoms/LogoContainer/LogoContainer.tsx +11 -11
- package/src/components/atoms/LogoContainer/index.tsx +1 -1
- package/src/components/atoms/ModalAviso/ModalAviso.styles.tsx +56 -56
- package/src/components/atoms/ModalAviso/ModalAviso.tsx +43 -37
- package/src/components/atoms/ModalAviso/ModalAviso.types.ts +5 -5
- package/src/components/atoms/ModalAviso/index.tsx +1 -1
- package/src/components/atoms/MultiSelect/MultiSelect.styles.tsx +100 -92
- package/src/components/atoms/MultiSelect/MultiSelect.tsx +346 -346
- package/src/components/atoms/MultiSelect/MultiSelect.types.ts +38 -38
- package/src/components/atoms/Pill/Pill.styles.ts +46 -46
- package/src/components/atoms/Pill/Pill.tsx +35 -36
- package/src/components/atoms/Pill/Pill.types.ts +14 -18
- package/src/components/atoms/RadioButton/RadioButton.styles.ts +44 -43
- package/src/components/atoms/RadioButton/RadioButton.tsx +31 -31
- package/src/components/atoms/ResendLink/ResendLink.styles.tsx +19 -20
- package/src/components/atoms/ResendLink/ResendLink.tsx +21 -21
- package/src/components/atoms/ResendLink/ResendLink.types.ts +8 -9
- package/src/components/atoms/ResendLink/index.tsx +1 -2
- package/src/components/atoms/Select/Select.styles.ts +153 -149
- package/src/components/atoms/Select/Select.tsx +52 -43
- package/src/components/atoms/Select/index.tsx +1 -1
- package/src/components/atoms/Subtitle/Subtitle.tsx +7 -7
- package/src/components/atoms/Subtitle/Subtitle.types.ts +5 -5
- package/src/components/atoms/Subtitle/index.tsx +1 -1
- package/src/components/atoms/Switch/Switch.tsx +25 -25
- package/src/components/atoms/TabBar/TabBar.styles.tsx +64 -57
- package/src/components/atoms/TabBar/index.tsx +2 -2
- package/src/components/atoms/Text/Text.styles.tsx +35 -35
- package/src/components/atoms/Text/Text.tsx +32 -31
- package/src/components/atoms/Text/Text.types.ts +8 -8
- package/src/components/atoms/Text/index.ts +1 -1
- package/src/components/atoms/Textarea/Textarea.styles.ts +52 -52
- package/src/components/atoms/Textarea/Textarea.tsx +31 -31
- package/src/components/atoms/Title/Title.tsx +7 -7
- package/src/components/atoms/Title/Title.types.ts +5 -5
- package/src/components/atoms/Title/index.tsx +1 -1
- package/src/components/molecules/BannerAjuda/BannerAjuda.styles.tsx +9 -9
- package/src/components/molecules/BannerAjuda/BannerAjuda.tsx +18 -19
- package/src/components/molecules/BannerAjuda/index.tsx +1 -1
- package/src/components/molecules/ButtonGroup/ButtonGroup.styles.ts +10 -10
- package/src/components/molecules/ButtonGroup/ButtonGroup.types.ts +22 -22
- package/src/components/molecules/Calendar/Calendar.styles.ts +143 -143
- package/src/components/molecules/Calendar/Calendar.tsx +31 -31
- package/src/components/molecules/CodeInputContainer/CodeInputContainer.styles.tsx +7 -7
- package/src/components/molecules/CodeInputContainer/CodeInputContainer.types.ts +13 -13
- package/src/components/molecules/CodeInputContainer/index.tsx +1 -3
- package/src/components/molecules/ExcludeModal/ExcludeModal.styles.tsx +123 -118
- package/src/components/molecules/ExcludeModal/ExcludeModal.tsx +48 -48
- package/src/components/molecules/ExcludeModal/ExcludeModal.types.ts +10 -10
- package/src/components/molecules/ExcludeModal/index.tsx +1 -1
- package/src/components/molecules/FieldSelector/FieldSelector.styles.ts +59 -0
- package/src/components/molecules/FieldSelector/FieldSelector.tsx +167 -0
- package/src/components/molecules/HighlightsCard/HighlightsCard.styles.tsx +67 -68
- package/src/components/molecules/HighlightsCard/HighlightsCard.tsx +35 -26
- package/src/components/molecules/HighlightsCard/HighlightsCard.types.ts +10 -10
- package/src/components/molecules/HighlightsCard/index.tsx +1 -1
- package/src/components/molecules/InsuranceCard/InsuranceCard.styles.tsx +237 -237
- package/src/components/molecules/InsuranceCard/index.tsx +1 -1
- package/src/components/molecules/PieChartComponent/PieChartComponent.styles.tsx +7 -8
- package/src/components/molecules/PieChartComponent/PieChartComponent.tsx +70 -73
- package/src/components/molecules/PieChartComponent/PieChartComponent.types.ts +11 -11
- package/src/components/molecules/PieChartComponent/index.tsx +1 -1
- package/src/components/molecules/Popover/Popover.styles.ts +66 -65
- package/src/components/molecules/Popover/Popover.tsx +23 -23
- package/src/components/molecules/RadioBoxGroup/RadioBoxGroup.styles.ts +11 -11
- package/src/components/molecules/RadioBoxGroup/RadioBoxGroup.tsx +43 -43
- package/src/components/molecules/RadioGroupField/RadioGroupField.styles.tsx +65 -64
- package/src/components/molecules/RadioGroupField/RadioGroupField.tsx +69 -69
- package/src/components/molecules/RadioGroupField/RadioGroupField.types.ts +17 -17
- package/src/components/molecules/RadioGroupField/index.tsx +1 -1
- package/src/components/molecules/RefuseModal/RefuseModal.styles.tsx +139 -139
- package/src/components/molecules/RefuseModal/RefuseModal.tsx +92 -76
- package/src/components/molecules/RefuseModal/RefuseModal.types.ts +15 -15
- package/src/components/molecules/RefuseModal/index.tsx +2 -2
- package/src/components/molecules/ResultsChart/ResultsChart.tsx +23 -19
- package/src/components/molecules/ResultsChart/ResultsChart.types.ts +3 -3
- package/src/components/molecules/ResultsChart/index.tsx +2 -2
- package/src/components/molecules/TabToggle/TabToggle.styles.ts +54 -54
- package/src/components/molecules/TabToggle/TabToggle.tsx +35 -35
- package/src/components/organisms/AlertDialog/AlertDialog.styles.tsx +61 -61
- package/src/components/organisms/AlertDialog/AlertDialog.tsx +70 -70
- package/src/components/organisms/Dialog/Dialog.styles.ts +107 -106
- package/src/components/organisms/Dialog/Dialog.tsx +69 -69
- package/src/components/organisms/DonutEmissionsChart/DonutEmissionsChart.styles.tsx +113 -113
- package/src/components/organisms/DonutEmissionsChart/DonutEmissionsChart.tsx +75 -71
- package/src/components/organisms/DonutEmissionsChart/DonutEmissionsChart.types.ts +9 -9
- package/src/components/organisms/DonutEmissionsChart/index.tsx +5 -2
- package/src/components/organisms/Form/Form.styles.ts +35 -35
- package/src/components/organisms/Form/Form.tsx +160 -160
- package/src/components/organisms/ListagemUltimasEmissoes/ListagemUltimasEmissoes.styles.tsx +115 -114
- package/src/components/organisms/ListagemUltimasEmissoes/ListagemUltimasEmissoes.tsx +89 -89
- package/src/components/organisms/ListagemUltimasEmissoes/ListagemUltimasEmissoes.types.ts +16 -16
- package/src/components/organisms/ListagemUltimasEmissoes/index.tsx +1 -1
- package/src/components/organisms/Navbar/Navbar.styles.tsx +243 -243
- package/src/global.d.ts +9 -9
- package/src/index.ts +2 -0
- package/src/lib/utils.ts +6 -6
- package/src/styles/tokens/borders.ts +17 -17
- package/src/styles/tokens/index.tsx +6 -6
- package/src/styles/tokens/radius.ts +22 -22
- package/src/styles/tokens/shadows.ts +22 -22
- package/src/styles/tokens/sizes.ts +60 -64
- package/src/types/radius.types.ts +1 -1
- package/src/types/shadows.types.ts +1 -1
- package/src/utils/renderHighlightsCard.tsx +21 -0
|
@@ -1,65 +1,66 @@
|
|
|
1
|
-
import styled, { keyframes } from
|
|
2
|
-
import * as PopoverPrimitive from
|
|
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
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
|
2
|
-
import * as PopoverPrimitive from
|
|
3
|
-
import { StyledPopoverContent } from
|
|
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 =
|
|
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
|
|
2
|
-
import { semanticSizes } from
|
|
3
|
-
|
|
4
|
-
export const Container = styled.div<{
|
|
5
|
-
orientation?:
|
|
6
|
-
}>`
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-direction: ${({ orientation =
|
|
9
|
-
orientation ===
|
|
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
|
|
2
|
-
import { Container } from
|
|
3
|
-
import RadioButton from
|
|
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?:
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const RadioBoxGroup: React.FC<RadioBoxGroupProps> = ({
|
|
20
|
-
name,
|
|
21
|
-
options,
|
|
22
|
-
value,
|
|
23
|
-
onChange,
|
|
24
|
-
orientation =
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
semanticColors,
|
|
4
|
-
semanticRadius,
|
|
5
|
-
semanticSizes,
|
|
6
|
-
typographyTokens,
|
|
7
|
-
} from
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
font-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
color: ${semanticColors.branding.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
color: ${semanticColors.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
RadioGroupContainer,
|
|
4
|
-
RadioButton,
|
|
5
|
-
RadioLabel,
|
|
6
|
-
HiddenRadioInput,
|
|
7
|
-
} from
|
|
8
|
-
import { RadioGroupFieldProps } from
|
|
9
|
-
|
|
10
|
-
const RadioGroupField: React.FC<RadioGroupFieldProps> = ({
|
|
11
|
-
options,
|
|
12
|
-
value: controlledValue,
|
|
13
|
-
defaultValue,
|
|
14
|
-
onChange,
|
|
15
|
-
name =
|
|
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
|
|
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
|
|
1
|
+
export { RadioGroupField } from './RadioGroupField';
|