@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,48 +1,48 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import * as Dialog from
|
|
3
|
-
import { X } from
|
|
4
|
-
import {
|
|
5
|
-
Overlay,
|
|
6
|
-
Content,
|
|
7
|
-
Title,
|
|
8
|
-
Description,
|
|
9
|
-
Footer,
|
|
10
|
-
CancelButton,
|
|
11
|
-
ConfirmButton,
|
|
12
|
-
CloseIcon,
|
|
13
|
-
} from
|
|
14
|
-
import { ExcludeModalProps } from
|
|
15
|
-
|
|
16
|
-
const ExcludeModal: React.FC<ExcludeModalProps> = ({
|
|
17
|
-
open,
|
|
18
|
-
onOpenChange,
|
|
19
|
-
onClose,
|
|
20
|
-
onConfirm,
|
|
21
|
-
isLoading = false,
|
|
22
|
-
title =
|
|
23
|
-
description =
|
|
24
|
-
}) => {
|
|
25
|
-
return (
|
|
26
|
-
<Dialog.Root open={open} onOpenChange={onOpenChange}>
|
|
27
|
-
<Overlay />
|
|
28
|
-
<Content>
|
|
29
|
-
<CloseIcon aria-label="Fechar" onClick={onClose}>
|
|
30
|
-
<X size={28} />
|
|
31
|
-
</CloseIcon>
|
|
32
|
-
|
|
33
|
-
<Title>{title}</Title>
|
|
34
|
-
|
|
35
|
-
<Description>{description}</Description>
|
|
36
|
-
|
|
37
|
-
<Footer>
|
|
38
|
-
<CancelButton onClick={onClose}>Cancelar</CancelButton>
|
|
39
|
-
<ConfirmButton onClick={onConfirm} disabled={isLoading}>
|
|
40
|
-
{isLoading ?
|
|
41
|
-
</ConfirmButton>
|
|
42
|
-
</Footer>
|
|
43
|
-
</Content>
|
|
44
|
-
</Dialog.Root>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export { ExcludeModal };
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as Dialog from '@radix-ui/react-dialog';
|
|
3
|
+
import { X } from 'lucide-react';
|
|
4
|
+
import {
|
|
5
|
+
Overlay,
|
|
6
|
+
Content,
|
|
7
|
+
Title,
|
|
8
|
+
Description,
|
|
9
|
+
Footer,
|
|
10
|
+
CancelButton,
|
|
11
|
+
ConfirmButton,
|
|
12
|
+
CloseIcon,
|
|
13
|
+
} from './ExcludeModal.styles';
|
|
14
|
+
import { ExcludeModalProps } from './ExcludeModal.types';
|
|
15
|
+
|
|
16
|
+
const ExcludeModal: React.FC<ExcludeModalProps> = ({
|
|
17
|
+
open,
|
|
18
|
+
onOpenChange,
|
|
19
|
+
onClose,
|
|
20
|
+
onConfirm,
|
|
21
|
+
isLoading = false,
|
|
22
|
+
title = 'Você tem certeza que deseja excluir essa cotação?',
|
|
23
|
+
description = 'Essa cotação será excluída mas ainda será mantida no nosso sistema, caso queira restaurar, precisa entrar em contato conosco.',
|
|
24
|
+
}) => {
|
|
25
|
+
return (
|
|
26
|
+
<Dialog.Root open={open} onOpenChange={onOpenChange}>
|
|
27
|
+
<Overlay />
|
|
28
|
+
<Content>
|
|
29
|
+
<CloseIcon aria-label="Fechar" onClick={onClose}>
|
|
30
|
+
<X size={28} />
|
|
31
|
+
</CloseIcon>
|
|
32
|
+
|
|
33
|
+
<Title>{title}</Title>
|
|
34
|
+
|
|
35
|
+
<Description>{description}</Description>
|
|
36
|
+
|
|
37
|
+
<Footer>
|
|
38
|
+
<CancelButton onClick={onClose}>Cancelar</CancelButton>
|
|
39
|
+
<ConfirmButton onClick={onConfirm} disabled={isLoading}>
|
|
40
|
+
{isLoading ? 'Excluindo...' : 'Sim, excluir'}
|
|
41
|
+
</ConfirmButton>
|
|
42
|
+
</Footer>
|
|
43
|
+
</Content>
|
|
44
|
+
</Dialog.Root>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { ExcludeModal };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export interface ExcludeModalProps{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
1
|
+
export interface ExcludeModalProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
onOpenChange: (open: boolean) => void;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onConfirm: () => void;
|
|
6
|
+
orderId?: string;
|
|
7
|
+
isLoading?: boolean;
|
|
8
|
+
title?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ExcludeModal } from
|
|
1
|
+
export { ExcludeModal } from './ExcludeModal';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
semanticBorders,
|
|
3
|
+
semanticColors,
|
|
4
|
+
typographyTokens,
|
|
5
|
+
} from '@/styles/tokens';
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
|
|
8
|
+
export const Container = styled.div`
|
|
9
|
+
display: flex;
|
|
10
|
+
gap: 2rem;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
padding: 2rem;
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
export const Column = styled.div`
|
|
16
|
+
width: 373px;
|
|
17
|
+
background: ${semanticColors.global.foreground.default};
|
|
18
|
+
border-radius: ${semanticBorders.global.md};
|
|
19
|
+
padding: 1rem;
|
|
20
|
+
display: block;
|
|
21
|
+
min-height: 100px;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export const TitleRow = styled.div`
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
align-items: center;
|
|
28
|
+
margin-bottom: 1rem;
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
export const Title = styled.h3`
|
|
32
|
+
font-size: ${typographyTokens.fontSizes.headingL};
|
|
33
|
+
margin: 0;
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export const Action = styled.button`
|
|
37
|
+
background: none;
|
|
38
|
+
border: none;
|
|
39
|
+
color: ${semanticColors.branding.text.accent.enabled};
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
font-size: ${typographyTokens.fontSizes.bodyS};
|
|
42
|
+
&:hover {
|
|
43
|
+
text-decoration: underline;
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
export const Item = styled.div<{ selected?: boolean }>`
|
|
48
|
+
background: ${semanticColors.global.surface.default};
|
|
49
|
+
border-radius: 8px;
|
|
50
|
+
padding: 0.5rem 0.75rem;
|
|
51
|
+
margin-bottom: 0.5rem;
|
|
52
|
+
flex-direction: row;
|
|
53
|
+
display: flex;
|
|
54
|
+
justify-content: space-between;
|
|
55
|
+
align-items: center;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
user-select: none;
|
|
58
|
+
transition: all 0.2s;
|
|
59
|
+
`;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { DragDropContext, Droppable, Draggable } from '@hello-pangea/dnd';
|
|
4
|
+
import {
|
|
5
|
+
Action,
|
|
6
|
+
Column,
|
|
7
|
+
Container,
|
|
8
|
+
Item,
|
|
9
|
+
Title,
|
|
10
|
+
TitleRow,
|
|
11
|
+
} from './FieldSelector.styles';
|
|
12
|
+
|
|
13
|
+
interface FieldSelectorProps {
|
|
14
|
+
availableFields: string[];
|
|
15
|
+
selectedFields: string[];
|
|
16
|
+
setAvailableFields: (fields: string[]) => void;
|
|
17
|
+
setSelectedFields: (fields: string[]) => void;
|
|
18
|
+
handleSave?: (selectedFields: string[]) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const FieldSelector: React.FC<FieldSelectorProps> = ({
|
|
22
|
+
availableFields = [],
|
|
23
|
+
selectedFields = [],
|
|
24
|
+
setAvailableFields,
|
|
25
|
+
setSelectedFields,
|
|
26
|
+
handleSave,
|
|
27
|
+
}) => {
|
|
28
|
+
const handleSelectAll = () => {
|
|
29
|
+
setSelectedFields([...selectedFields, ...availableFields]);
|
|
30
|
+
setAvailableFields([]);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const handleRemoveAll = () => {
|
|
34
|
+
setAvailableFields([...availableFields, ...selectedFields]);
|
|
35
|
+
setSelectedFields([]);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const handleClick = (item: string, from: 'available' | 'selected') => {
|
|
39
|
+
if (from === 'available') {
|
|
40
|
+
setAvailableFields(availableFields.filter((f) => f !== item));
|
|
41
|
+
setSelectedFields([...selectedFields, item]);
|
|
42
|
+
} else {
|
|
43
|
+
setSelectedFields(selectedFields.filter((f) => f !== item));
|
|
44
|
+
setAvailableFields([...availableFields, item]);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const reorder = (list: string[], startIndex: number, endIndex: number) => {
|
|
49
|
+
const result = Array.from(list);
|
|
50
|
+
const [removed] = result.splice(startIndex, 1);
|
|
51
|
+
result.splice(endIndex, 0, removed);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const onDragEnd = (result: any) => {
|
|
56
|
+
const { source, destination } = result;
|
|
57
|
+
if (!destination) return;
|
|
58
|
+
|
|
59
|
+
if (source.droppableId === destination.droppableId) {
|
|
60
|
+
if (source.droppableId === 'available') {
|
|
61
|
+
const reordered = reorder(
|
|
62
|
+
availableFields,
|
|
63
|
+
source.index,
|
|
64
|
+
destination.index
|
|
65
|
+
);
|
|
66
|
+
setAvailableFields(reordered);
|
|
67
|
+
} else {
|
|
68
|
+
const reordered = reorder(
|
|
69
|
+
selectedFields,
|
|
70
|
+
source.index,
|
|
71
|
+
destination.index
|
|
72
|
+
);
|
|
73
|
+
setSelectedFields(reordered);
|
|
74
|
+
}
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const sourceList =
|
|
79
|
+
source.droppableId === 'available' ? availableFields : selectedFields;
|
|
80
|
+
const destList =
|
|
81
|
+
destination.droppableId === 'available'
|
|
82
|
+
? availableFields
|
|
83
|
+
: selectedFields;
|
|
84
|
+
const setSource =
|
|
85
|
+
source.droppableId === 'available'
|
|
86
|
+
? setAvailableFields
|
|
87
|
+
: setSelectedFields;
|
|
88
|
+
const setDest =
|
|
89
|
+
destination.droppableId === 'available'
|
|
90
|
+
? setAvailableFields
|
|
91
|
+
: setSelectedFields;
|
|
92
|
+
|
|
93
|
+
const sourceClone = Array.from(sourceList);
|
|
94
|
+
const destClone = Array.from(destList);
|
|
95
|
+
const [moved] = sourceClone.splice(source.index, 1);
|
|
96
|
+
destClone.splice(destination.index, 0, moved);
|
|
97
|
+
|
|
98
|
+
setSource(sourceClone);
|
|
99
|
+
setDest(destClone);
|
|
100
|
+
|
|
101
|
+
if (destination.droppableId === 'selected') {
|
|
102
|
+
handleSave?.(destClone);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<Container>
|
|
108
|
+
<DragDropContext onDragEnd={onDragEnd}>
|
|
109
|
+
<Droppable droppableId="available">
|
|
110
|
+
{(provided) => (
|
|
111
|
+
<Column ref={provided.innerRef} {...provided.droppableProps}>
|
|
112
|
+
<TitleRow>
|
|
113
|
+
<Title>Campos disponíveis ({availableFields.length})</Title>
|
|
114
|
+
<Action onClick={handleSelectAll}>Selecionar todos</Action>
|
|
115
|
+
</TitleRow>
|
|
116
|
+
{availableFields.map((item, index) => (
|
|
117
|
+
<Draggable key={item} draggableId={item} index={index}>
|
|
118
|
+
{(prov) => (
|
|
119
|
+
<Item
|
|
120
|
+
ref={prov.innerRef}
|
|
121
|
+
{...prov.draggableProps}
|
|
122
|
+
{...prov.dragHandleProps}
|
|
123
|
+
selected={false}
|
|
124
|
+
onDoubleClick={() => handleClick(item, 'available')}
|
|
125
|
+
>
|
|
126
|
+
{item} <div>⋮⋮</div>
|
|
127
|
+
</Item>
|
|
128
|
+
)}
|
|
129
|
+
</Draggable>
|
|
130
|
+
))}
|
|
131
|
+
{provided.placeholder}
|
|
132
|
+
</Column>
|
|
133
|
+
)}
|
|
134
|
+
</Droppable>
|
|
135
|
+
|
|
136
|
+
<Droppable droppableId="selected">
|
|
137
|
+
{(provided) => (
|
|
138
|
+
<Column ref={provided.innerRef} {...provided.droppableProps}>
|
|
139
|
+
<TitleRow>
|
|
140
|
+
<Title>Campos selecionados ({selectedFields.length})</Title>
|
|
141
|
+
<Action onClick={handleRemoveAll}>Remover todos</Action>
|
|
142
|
+
</TitleRow>
|
|
143
|
+
{selectedFields.map((item, index) => (
|
|
144
|
+
<Draggable key={item} draggableId={item} index={index}>
|
|
145
|
+
{(prov) => (
|
|
146
|
+
<Item
|
|
147
|
+
ref={prov.innerRef}
|
|
148
|
+
{...prov.draggableProps}
|
|
149
|
+
{...prov.dragHandleProps}
|
|
150
|
+
selected
|
|
151
|
+
onDoubleClick={() => handleClick(item, 'selected')}
|
|
152
|
+
>
|
|
153
|
+
{item} <div>⋮⋮</div>
|
|
154
|
+
</Item>
|
|
155
|
+
)}
|
|
156
|
+
</Draggable>
|
|
157
|
+
))}
|
|
158
|
+
{provided.placeholder}
|
|
159
|
+
</Column>
|
|
160
|
+
)}
|
|
161
|
+
</Droppable>
|
|
162
|
+
</DragDropContext>
|
|
163
|
+
</Container>
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export default FieldSelector;
|
|
@@ -1,68 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
width: 100%;
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
font-
|
|
56
|
-
|
|
57
|
-
margin:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
font-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
`;
|
|
1
|
+
/* eslint-disable react-refresh/only-export-components */
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import {
|
|
4
|
+
primitiveColors,
|
|
5
|
+
semanticColors,
|
|
6
|
+
semanticSizes,
|
|
7
|
+
typographyTokens,
|
|
8
|
+
} from '../../../styles/tokens';
|
|
9
|
+
import { HighlightProps } from './HighlightsCard.types';
|
|
10
|
+
|
|
11
|
+
export const CardWrapper = styled.div`
|
|
12
|
+
display: grid;
|
|
13
|
+
grid-template-columns: repeat(2, 225px);
|
|
14
|
+
gap: ${semanticSizes.global.gap['lg']};
|
|
15
|
+
width: 100%;
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export const backgroundColors: Record<HighlightProps['color'], string> = {
|
|
19
|
+
red: primitiveColors.red[600], // #CB2C2D
|
|
20
|
+
orange: primitiveColors.orange[600], // #CB712C
|
|
21
|
+
blue: primitiveColors.blue[400], // #5F73E0
|
|
22
|
+
gray: primitiveColors.gray[400], // #CFCFCF
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const Card = styled.div<{ color: HighlightProps['color'] }>`
|
|
26
|
+
width: 225px;
|
|
27
|
+
background-color: ${({ color }) => backgroundColors[color]};
|
|
28
|
+
padding: ${semanticSizes.global.padding.xl};
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
position: relative;
|
|
31
|
+
min-height: 120px;
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
export const IconWrapper = styled.div`
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: ${semanticSizes.global.padding.xl};
|
|
38
|
+
right: ${semanticSizes.global.padding.xl};
|
|
39
|
+
background-color: ${semanticColors.base.background};
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
width: 40px;
|
|
42
|
+
height: 40px;
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
export const CardContent = styled.div`
|
|
49
|
+
width: 100%;
|
|
50
|
+
margin-top: 60px;
|
|
51
|
+
text-align: left;
|
|
52
|
+
|
|
53
|
+
p {
|
|
54
|
+
font-size: ${typographyTokens.fontSizes.bodyXS};
|
|
55
|
+
font-weight: ${typographyTokens.fontWeights.medium};
|
|
56
|
+
margin: 0;
|
|
57
|
+
margin-bottom: ${semanticSizes.global.padding.sm};
|
|
58
|
+
color: ${semanticColors.base.background};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
h3 {
|
|
62
|
+
font-size: ${typographyTokens.fontSizes.displayXL};
|
|
63
|
+
font-weight: ${typographyTokens.fontWeights.bold};
|
|
64
|
+
margin: 0;
|
|
65
|
+
color: ${semanticColors.base.background};
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
@@ -1,26 +1,35 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Card,
|
|
4
|
+
CardWrapper,
|
|
5
|
+
IconWrapper,
|
|
6
|
+
CardContent,
|
|
7
|
+
} from './HighlightsCard.styles';
|
|
8
|
+
import { HighlightsCardProps } from './HighlightsCard.types';
|
|
9
|
+
import Icon from '../../atoms/Icon/Icon';
|
|
10
|
+
|
|
11
|
+
const HighlightsCard: React.FC<HighlightsCardProps> = ({ items }) => {
|
|
12
|
+
return (
|
|
13
|
+
<CardWrapper data-testid="highlights-wrapper">
|
|
14
|
+
{items.map((item, index) => (
|
|
15
|
+
<Card
|
|
16
|
+
key={index}
|
|
17
|
+
color={item.color}
|
|
18
|
+
data-testid={`highlight-card-${index}`}
|
|
19
|
+
>
|
|
20
|
+
{item.icon && (
|
|
21
|
+
<IconWrapper data-testid={`highlight-card-icon-${index}`}>
|
|
22
|
+
<Icon name={item.icon} size="xs" />
|
|
23
|
+
</IconWrapper>
|
|
24
|
+
)}
|
|
25
|
+
<CardContent>
|
|
26
|
+
<p>{item.label}</p>
|
|
27
|
+
<h3>{item.value}</h3>
|
|
28
|
+
</CardContent>
|
|
29
|
+
</Card>
|
|
30
|
+
))}
|
|
31
|
+
</CardWrapper>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { HighlightsCard };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export interface HighlightProps {
|
|
2
|
-
label: string;
|
|
3
|
-
value: number;
|
|
4
|
-
color: string;
|
|
5
|
-
icon?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface HighlightsCardProps {
|
|
9
|
-
items: HighlightProps[];
|
|
10
|
-
}
|
|
1
|
+
export interface HighlightProps {
|
|
2
|
+
label: string;
|
|
3
|
+
value: number;
|
|
4
|
+
color: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface HighlightsCardProps {
|
|
9
|
+
items: HighlightProps[];
|
|
10
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { HighlightsCard } from
|
|
1
|
+
export { HighlightsCard } from './HighlightsCard';
|