@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,35 +1,35 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { ToggleContainer, Slider, TabButton } from
|
|
3
|
-
|
|
4
|
-
export type TabItem = {
|
|
5
|
-
title: string;
|
|
6
|
-
quantity: number;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export type TabToggleProps = {
|
|
10
|
-
items: TabItem[];
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const TabToggle: React.FC<TabToggleProps> = ({ items }) => {
|
|
14
|
-
const [activeIndex, setActiveIndex] = useState(0);
|
|
15
|
-
const count = items.length;
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<ToggleContainer>
|
|
19
|
-
{/* Slider agora sabe quantas abas existem */}
|
|
20
|
-
<Slider activeIndex={activeIndex} count={count} />
|
|
21
|
-
|
|
22
|
-
{items.map(({ title, quantity }, i) => (
|
|
23
|
-
<TabButton
|
|
24
|
-
key={title}
|
|
25
|
-
active={i === activeIndex}
|
|
26
|
-
onClick={() => setActiveIndex(i)}
|
|
27
|
-
>
|
|
28
|
-
{title} ({quantity})
|
|
29
|
-
</TabButton>
|
|
30
|
-
))}
|
|
31
|
-
</ToggleContainer>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default TabToggle;
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { ToggleContainer, Slider, TabButton } from './TabToggle.styles';
|
|
3
|
+
|
|
4
|
+
export type TabItem = {
|
|
5
|
+
title: string;
|
|
6
|
+
quantity: number;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type TabToggleProps = {
|
|
10
|
+
items: TabItem[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const TabToggle: React.FC<TabToggleProps> = ({ items }) => {
|
|
14
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
15
|
+
const count = items.length;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<ToggleContainer>
|
|
19
|
+
{/* Slider agora sabe quantas abas existem */}
|
|
20
|
+
<Slider activeIndex={activeIndex} count={count} />
|
|
21
|
+
|
|
22
|
+
{items.map(({ title, quantity }, i) => (
|
|
23
|
+
<TabButton
|
|
24
|
+
key={title}
|
|
25
|
+
active={i === activeIndex}
|
|
26
|
+
onClick={() => setActiveIndex(i)}
|
|
27
|
+
>
|
|
28
|
+
{title} ({quantity})
|
|
29
|
+
</TabButton>
|
|
30
|
+
))}
|
|
31
|
+
</ToggleContainer>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default TabToggle;
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
semanticColors,
|
|
3
|
-
semanticRadius,
|
|
4
|
-
semanticShadows,
|
|
5
|
-
semanticSizes,
|
|
6
|
-
} from
|
|
7
|
-
import styled from
|
|
8
|
-
|
|
9
|
-
export const DialogContainer = styled.div`
|
|
10
|
-
background: ${semanticColors.base.background};
|
|
11
|
-
padding: ${semanticSizes.global.padding[
|
|
12
|
-
border-radius: ${semanticRadius.global.radius.md};
|
|
13
|
-
box-shadow: ${semanticShadows.shadow};
|
|
14
|
-
border-top: 4px solid ${semanticColors.danger.border.enabled};
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
align-items: center;
|
|
18
|
-
gap: ${semanticSizes.global.gap.lg};
|
|
19
|
-
max-width: 440px;
|
|
20
|
-
text-align: left;
|
|
21
|
-
position: relative;
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
export const ButtonContainer = styled.div`
|
|
25
|
-
display: flex;
|
|
26
|
-
width: 100%;
|
|
27
|
-
gap: ${semanticSizes.global.gap.lg};
|
|
28
|
-
margin-top: ${semanticSizes.global.spacings.lg};
|
|
29
|
-
justify-content: flex-end;
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
export const Overlay = styled.div`
|
|
33
|
-
position: fixed;
|
|
34
|
-
inset: 0;
|
|
35
|
-
background: rgba(0, 0, 0, 0.5);
|
|
36
|
-
display: flex;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
align-items: center;
|
|
39
|
-
z-index: 9999;
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
|
-
export const CloseButton = styled.button`
|
|
43
|
-
background: none;
|
|
44
|
-
border: none;
|
|
45
|
-
cursor: pointer;
|
|
46
|
-
color: ${semanticColors.base.text};
|
|
47
|
-
font-size: ${semanticSizes.global.spacings.lg};
|
|
48
|
-
|
|
49
|
-
&:hover {
|
|
50
|
-
color: ${semanticColors.danger.border.enabled};
|
|
51
|
-
}
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
export const TitleContainer = styled.div`
|
|
55
|
-
display: flex;
|
|
56
|
-
width: 100%;
|
|
57
|
-
flex-direction: row;
|
|
58
|
-
justify-content: space-between;
|
|
59
|
-
align-items: flex-start;
|
|
60
|
-
gap: ${semanticSizes.global.gap.sm};
|
|
61
|
-
`;
|
|
1
|
+
import {
|
|
2
|
+
semanticColors,
|
|
3
|
+
semanticRadius,
|
|
4
|
+
semanticShadows,
|
|
5
|
+
semanticSizes,
|
|
6
|
+
} from '../../../styles/tokens';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
|
|
9
|
+
export const DialogContainer = styled.div`
|
|
10
|
+
background: ${semanticColors.base.background};
|
|
11
|
+
padding: ${semanticSizes.global.padding['2xl']};
|
|
12
|
+
border-radius: ${semanticRadius.global.radius.md};
|
|
13
|
+
box-shadow: ${semanticShadows.shadow};
|
|
14
|
+
border-top: 4px solid ${semanticColors.danger.border.enabled};
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
align-items: center;
|
|
18
|
+
gap: ${semanticSizes.global.gap.lg};
|
|
19
|
+
max-width: 440px;
|
|
20
|
+
text-align: left;
|
|
21
|
+
position: relative;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export const ButtonContainer = styled.div`
|
|
25
|
+
display: flex;
|
|
26
|
+
width: 100%;
|
|
27
|
+
gap: ${semanticSizes.global.gap.lg};
|
|
28
|
+
margin-top: ${semanticSizes.global.spacings.lg};
|
|
29
|
+
justify-content: flex-end;
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
export const Overlay = styled.div`
|
|
33
|
+
position: fixed;
|
|
34
|
+
inset: 0;
|
|
35
|
+
background: rgba(0, 0, 0, 0.5);
|
|
36
|
+
display: flex;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
align-items: center;
|
|
39
|
+
z-index: 9999;
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
export const CloseButton = styled.button`
|
|
43
|
+
background: none;
|
|
44
|
+
border: none;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
color: ${semanticColors.base.text};
|
|
47
|
+
font-size: ${semanticSizes.global.spacings.lg};
|
|
48
|
+
|
|
49
|
+
&:hover {
|
|
50
|
+
color: ${semanticColors.danger.border.enabled};
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
export const TitleContainer = styled.div`
|
|
55
|
+
display: flex;
|
|
56
|
+
width: 100%;
|
|
57
|
+
flex-direction: row;
|
|
58
|
+
justify-content: space-between;
|
|
59
|
+
align-items: flex-start;
|
|
60
|
+
gap: ${semanticSizes.global.gap.sm};
|
|
61
|
+
`;
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import Text from
|
|
3
|
-
import Button from
|
|
4
|
-
import {
|
|
5
|
-
ButtonContainer,
|
|
6
|
-
DialogContainer,
|
|
7
|
-
Overlay,
|
|
8
|
-
CloseButton,
|
|
9
|
-
TitleContainer,
|
|
10
|
-
} from
|
|
11
|
-
import { X } from
|
|
12
|
-
import { AlertDialogProps } from
|
|
13
|
-
import { semanticColors } from
|
|
14
|
-
|
|
15
|
-
const AlertDialog: React.FC<AlertDialogProps> = ({
|
|
16
|
-
text,
|
|
17
|
-
isOpen,
|
|
18
|
-
buttons: { confirm, cancel, onClose, onConfirm },
|
|
19
|
-
testId,
|
|
20
|
-
}) => {
|
|
21
|
-
if (!isOpen) return null;
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Overlay>
|
|
25
|
-
<DialogContainer>
|
|
26
|
-
<TitleContainer>
|
|
27
|
-
<Text
|
|
28
|
-
size="lg"
|
|
29
|
-
weight="bold"
|
|
30
|
-
color={`${semanticColors.danger.border.enabled}`}
|
|
31
|
-
>
|
|
32
|
-
{text.title}
|
|
33
|
-
</Text>
|
|
34
|
-
<CloseButton onClick={onClose} aria-label="Fechar">
|
|
35
|
-
<X
|
|
36
|
-
size={20}
|
|
37
|
-
color={`${semanticColors.neutral[300]}`}
|
|
38
|
-
weight="bold"
|
|
39
|
-
/>
|
|
40
|
-
</CloseButton>
|
|
41
|
-
</TitleContainer>
|
|
42
|
-
<Text size="md" color={`${semanticColors.neutral[500]}`}>
|
|
43
|
-
{text.description}
|
|
44
|
-
</Text>
|
|
45
|
-
<ButtonContainer>
|
|
46
|
-
{cancel && (
|
|
47
|
-
<Button
|
|
48
|
-
testId={`${testId}_cancelar`}
|
|
49
|
-
variant="alert"
|
|
50
|
-
onClick={onClose}
|
|
51
|
-
>
|
|
52
|
-
{cancel}
|
|
53
|
-
</Button>
|
|
54
|
-
)}
|
|
55
|
-
{confirm && (
|
|
56
|
-
<Button
|
|
57
|
-
testId={`${testId}_confirmar`}
|
|
58
|
-
variant="danger"
|
|
59
|
-
onClick={onConfirm}
|
|
60
|
-
>
|
|
61
|
-
{confirm}
|
|
62
|
-
</Button>
|
|
63
|
-
)}
|
|
64
|
-
</ButtonContainer>
|
|
65
|
-
</DialogContainer>
|
|
66
|
-
</Overlay>
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export default AlertDialog;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Text from '../../atoms/Text/Text';
|
|
3
|
+
import Button from '../../atoms/Button/Button';
|
|
4
|
+
import {
|
|
5
|
+
ButtonContainer,
|
|
6
|
+
DialogContainer,
|
|
7
|
+
Overlay,
|
|
8
|
+
CloseButton,
|
|
9
|
+
TitleContainer,
|
|
10
|
+
} from './AlertDialog.styles';
|
|
11
|
+
import { X } from '@phosphor-icons/react';
|
|
12
|
+
import { AlertDialogProps } from './AlertDialog.types';
|
|
13
|
+
import { semanticColors } from '../../../styles/tokens';
|
|
14
|
+
|
|
15
|
+
const AlertDialog: React.FC<AlertDialogProps> = ({
|
|
16
|
+
text,
|
|
17
|
+
isOpen,
|
|
18
|
+
buttons: { confirm, cancel, onClose, onConfirm },
|
|
19
|
+
testId,
|
|
20
|
+
}) => {
|
|
21
|
+
if (!isOpen) return null;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Overlay>
|
|
25
|
+
<DialogContainer>
|
|
26
|
+
<TitleContainer>
|
|
27
|
+
<Text
|
|
28
|
+
size="lg"
|
|
29
|
+
weight="bold"
|
|
30
|
+
color={`${semanticColors.danger.border.enabled}`}
|
|
31
|
+
>
|
|
32
|
+
{text.title}
|
|
33
|
+
</Text>
|
|
34
|
+
<CloseButton onClick={onClose} aria-label="Fechar">
|
|
35
|
+
<X
|
|
36
|
+
size={20}
|
|
37
|
+
color={`${semanticColors.neutral[300]}`}
|
|
38
|
+
weight="bold"
|
|
39
|
+
/>
|
|
40
|
+
</CloseButton>
|
|
41
|
+
</TitleContainer>
|
|
42
|
+
<Text size="md" color={`${semanticColors.neutral[500]}`}>
|
|
43
|
+
{text.description}
|
|
44
|
+
</Text>
|
|
45
|
+
<ButtonContainer>
|
|
46
|
+
{cancel && (
|
|
47
|
+
<Button
|
|
48
|
+
testId={`${testId}_cancelar`}
|
|
49
|
+
variant="alert"
|
|
50
|
+
onClick={onClose}
|
|
51
|
+
>
|
|
52
|
+
{cancel}
|
|
53
|
+
</Button>
|
|
54
|
+
)}
|
|
55
|
+
{confirm && (
|
|
56
|
+
<Button
|
|
57
|
+
testId={`${testId}_confirmar`}
|
|
58
|
+
variant="danger"
|
|
59
|
+
onClick={onConfirm}
|
|
60
|
+
>
|
|
61
|
+
{confirm}
|
|
62
|
+
</Button>
|
|
63
|
+
)}
|
|
64
|
+
</ButtonContainer>
|
|
65
|
+
</DialogContainer>
|
|
66
|
+
</Overlay>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default AlertDialog;
|
|
@@ -1,106 +1,107 @@
|
|
|
1
|
-
// Dialog.styled.tsx
|
|
2
|
-
import styled from
|
|
3
|
-
import * as DialogPrimitive from
|
|
4
|
-
|
|
5
|
-
/* ========================= */
|
|
6
|
-
/* === Overlay Component === */
|
|
7
|
-
/* ========================= */
|
|
8
|
-
export const StyledDialogOverlay = styled(DialogPrimitive.Overlay)`
|
|
9
|
-
position: fixed;
|
|
10
|
-
inset: 0;
|
|
11
|
-
z-index: 50;
|
|
12
|
-
background-color: rgba(0, 0, 0, 0.8);
|
|
13
|
-
/* Você pode definir animações adicionais aqui, caso deseje */
|
|
14
|
-
`;
|
|
15
|
-
|
|
16
|
-
/* ========================== */
|
|
17
|
-
/* === Content Component === */
|
|
18
|
-
/* ========================== */
|
|
19
|
-
export const StyledDialogContent = styled(DialogPrimitive.Content)`
|
|
20
|
-
position: fixed;
|
|
21
|
-
left: 50%;
|
|
22
|
-
top: 50%;
|
|
23
|
-
z-index: 50;
|
|
24
|
-
display: grid;
|
|
25
|
-
width: 100%;
|
|
26
|
-
max-width: 32rem; /* Equivalente a max-w-lg */
|
|
27
|
-
transform: translate(-50%, -50%);
|
|
28
|
-
gap: 1rem; /* gap-4 */
|
|
29
|
-
border: 1px solid #e5e7eb;
|
|
30
|
-
background-color: #fff; /* bg-background */
|
|
31
|
-
padding: 1.5rem; /* p-6 */
|
|
32
|
-
box-shadow:
|
|
33
|
-
0
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/*
|
|
40
|
-
/*
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
border
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/*
|
|
64
|
-
/*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/*
|
|
78
|
-
/*
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
/*
|
|
92
|
-
/*
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
font-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/*
|
|
102
|
-
/*
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
1
|
+
// Dialog.styled.tsx
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
|
+
|
|
5
|
+
/* ========================= */
|
|
6
|
+
/* === Overlay Component === */
|
|
7
|
+
/* ========================= */
|
|
8
|
+
export const StyledDialogOverlay = styled(DialogPrimitive.Overlay)`
|
|
9
|
+
position: fixed;
|
|
10
|
+
inset: 0;
|
|
11
|
+
z-index: 50;
|
|
12
|
+
background-color: rgba(0, 0, 0, 0.8);
|
|
13
|
+
/* Você pode definir animações adicionais aqui, caso deseje */
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
/* ========================== */
|
|
17
|
+
/* === Content Component === */
|
|
18
|
+
/* ========================== */
|
|
19
|
+
export const StyledDialogContent = styled(DialogPrimitive.Content)`
|
|
20
|
+
position: fixed;
|
|
21
|
+
left: 50%;
|
|
22
|
+
top: 50%;
|
|
23
|
+
z-index: 50;
|
|
24
|
+
display: grid;
|
|
25
|
+
width: 100%;
|
|
26
|
+
max-width: 32rem; /* Equivalente a max-w-lg */
|
|
27
|
+
transform: translate(-50%, -50%);
|
|
28
|
+
gap: 1rem; /* gap-4 */
|
|
29
|
+
border: 1px solid #e5e7eb;
|
|
30
|
+
background-color: #fff; /* bg-background */
|
|
31
|
+
padding: 1.5rem; /* p-6 */
|
|
32
|
+
box-shadow:
|
|
33
|
+
0 10px 15px -3px rgba(0, 0, 0, 0.1),
|
|
34
|
+
0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
35
|
+
border-radius: 0.5rem; /* sm:rounded-lg */
|
|
36
|
+
transition: all 0.2s ease;
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
/* ============================ */
|
|
40
|
+
/* === Close Button Component === */
|
|
41
|
+
/* ============================ */
|
|
42
|
+
export const StyledDialogClose = styled(DialogPrimitive.Close)`
|
|
43
|
+
position: absolute;
|
|
44
|
+
top: 1rem; /* top-4 */
|
|
45
|
+
right: 1rem; /* right-4 */
|
|
46
|
+
background: none;
|
|
47
|
+
border: none;
|
|
48
|
+
border-radius: 0.125rem; /* rounded-sm */
|
|
49
|
+
opacity: 0.7;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
transition: opacity 0.2s ease;
|
|
52
|
+
|
|
53
|
+
&:hover {
|
|
54
|
+
opacity: 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&:focus {
|
|
58
|
+
outline: none;
|
|
59
|
+
box-shadow: 0 0 0 2px #3b82f6; /* focus:ring-2 focus:ring-ring */
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
/* ========================== */
|
|
64
|
+
/* === Header Component === */
|
|
65
|
+
/* ========================== */
|
|
66
|
+
export const StyledDialogHeader = styled.div`
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
gap: 0.375rem; /* Aproximadamente space-y-1.5 */
|
|
70
|
+
text-align: center;
|
|
71
|
+
|
|
72
|
+
@media (min-width: 640px) {
|
|
73
|
+
text-align: left;
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
/* ========================== */
|
|
78
|
+
/* === Footer Component === */
|
|
79
|
+
/* ========================== */
|
|
80
|
+
export const StyledDialogFooter = styled.div`
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: column-reverse;
|
|
83
|
+
justify-content: flex-end;
|
|
84
|
+
gap: 0.5rem; /* Aproximadamente sm:space-x-2 */
|
|
85
|
+
|
|
86
|
+
@media (min-width: 640px) {
|
|
87
|
+
flex-direction: row;
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
/* =========================== */
|
|
92
|
+
/* === Title Component === */
|
|
93
|
+
/* =========================== */
|
|
94
|
+
export const StyledDialogTitle = styled(DialogPrimitive.Title)`
|
|
95
|
+
font-size: 1.125rem; /* text-lg */
|
|
96
|
+
font-weight: 600; /* font-semibold */
|
|
97
|
+
line-height: 1; /* leading-none */
|
|
98
|
+
letter-spacing: -0.025em; /* tracking-tight */
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
/* =============================== */
|
|
102
|
+
/* === Description Component === */
|
|
103
|
+
/* =============================== */
|
|
104
|
+
export const StyledDialogDescription = styled(DialogPrimitive.Description)`
|
|
105
|
+
font-size: 0.875rem; /* text-sm */
|
|
106
|
+
color: #6b7280; /* text-muted-foreground */
|
|
107
|
+
`;
|