@granto-umbrella/umbrella-components 3.0.55 → 3.0.56
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/dist/umbrella-components.es.js +17659 -17587
- package/dist/umbrella-components.umd.js +356 -339
- package/package.json +141 -142
- package/src/components/atoms/Button/Button.types.ts +27 -27
- package/src/components/atoms/Checkbox/Checkbox.types.ts +13 -13
- package/src/components/atoms/Textarea/Textarea.types.ts +6 -6
- package/src/components/atoms/Tooltip/Tooltip.tsx +60 -60
- package/src/components/atoms/Tooltip/Tootip.styles.ts +153 -153
- package/src/components/atoms/Tooltip/tooltip.types.ts +8 -8
- package/src/components/molecules/RadioGroupField/RadioGroupField.types.ts +0 -2
- package/src/components/molecules/TimeLine/TimeLine.mapper.ts +61 -44
- package/src/components/molecules/TimeLine/TimeLine.registry.ts +41 -0
- package/src/components/molecules/TimeLine/TimeLine.styles.ts +55 -25
- package/src/components/molecules/TimeLine/TimeLine.tsx +18 -14
- package/src/components/molecules/TimeLine/TimeLine.types.ts +42 -101
- package/src/index.ts +159 -159
- package/src/styles/tokens/colors.ts +601 -601
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components';
|
|
2
|
-
import {
|
|
3
|
-
semanticColors,
|
|
4
|
-
primitiveColors,
|
|
5
|
-
semanticSizes,
|
|
6
|
-
semanticRadius,
|
|
7
|
-
typographyTokens,
|
|
8
|
-
} from '../../../styles/tokens';
|
|
9
|
-
import { TooltipPosition } from './tooltip.types';
|
|
10
|
-
|
|
11
|
-
const arrowSize = '8px';
|
|
12
|
-
|
|
13
|
-
const positionStyles = {
|
|
14
|
-
top: css`
|
|
15
|
-
bottom: calc(100% + 12px);
|
|
16
|
-
left: 50%;
|
|
17
|
-
transform: translateX(-50%);
|
|
18
|
-
|
|
19
|
-
&::after {
|
|
20
|
-
content: '';
|
|
21
|
-
position: absolute;
|
|
22
|
-
top: 100%;
|
|
23
|
-
left: 50%;
|
|
24
|
-
transform: translateX(-50%);
|
|
25
|
-
border-left: ${arrowSize} solid transparent;
|
|
26
|
-
border-right: ${arrowSize} solid transparent;
|
|
27
|
-
border-top: ${arrowSize} solid ${primitiveColors.base.white};
|
|
28
|
-
}
|
|
29
|
-
`,
|
|
30
|
-
bottom: css`
|
|
31
|
-
top: calc(100% + 12px);
|
|
32
|
-
left: 50%;
|
|
33
|
-
transform: translateX(-50%);
|
|
34
|
-
|
|
35
|
-
&::after {
|
|
36
|
-
content: '';
|
|
37
|
-
position: absolute;
|
|
38
|
-
bottom: 100%;
|
|
39
|
-
left: 50%;
|
|
40
|
-
transform: translateX(-50%);
|
|
41
|
-
border-left: ${arrowSize} solid transparent;
|
|
42
|
-
border-right: ${arrowSize} solid transparent;
|
|
43
|
-
border-bottom: ${arrowSize} solid ${primitiveColors.base.white};
|
|
44
|
-
}
|
|
45
|
-
`,
|
|
46
|
-
left: css`
|
|
47
|
-
right: calc(100% + 12px);
|
|
48
|
-
top: 50%;
|
|
49
|
-
transform: translateY(-50%);
|
|
50
|
-
|
|
51
|
-
&::after {
|
|
52
|
-
content: '';
|
|
53
|
-
position: absolute;
|
|
54
|
-
left: 100%;
|
|
55
|
-
top: 50%;
|
|
56
|
-
transform: translateY(-50%);
|
|
57
|
-
border-top: ${arrowSize} solid transparent;
|
|
58
|
-
border-bottom: ${arrowSize} solid transparent;
|
|
59
|
-
border-left: ${arrowSize} solid ${primitiveColors.base.white};
|
|
60
|
-
}
|
|
61
|
-
`,
|
|
62
|
-
right: css`
|
|
63
|
-
left: calc(100% + 12px);
|
|
64
|
-
top: 50%;
|
|
65
|
-
transform: translateY(-50%);
|
|
66
|
-
|
|
67
|
-
&::after {
|
|
68
|
-
content: '';
|
|
69
|
-
position: absolute;
|
|
70
|
-
right: 100%;
|
|
71
|
-
top: 50%;
|
|
72
|
-
transform: translateY(-50%);
|
|
73
|
-
border-top: ${arrowSize} solid transparent;
|
|
74
|
-
border-bottom: ${arrowSize} solid transparent;
|
|
75
|
-
border-right: ${arrowSize} solid ${primitiveColors.base.white};
|
|
76
|
-
}
|
|
77
|
-
`,
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const TooltipContainer = styled.div`
|
|
81
|
-
position: relative;
|
|
82
|
-
display: inline-flex;
|
|
83
|
-
align-items: center;
|
|
84
|
-
gap: ${semanticSizes.global.gap.xs};
|
|
85
|
-
`;
|
|
86
|
-
|
|
87
|
-
export const TooltipTrigger = styled.div`
|
|
88
|
-
display: inline-flex;
|
|
89
|
-
cursor: pointer;
|
|
90
|
-
|
|
91
|
-
img {
|
|
92
|
-
width: 16px;
|
|
93
|
-
height: 16px;
|
|
94
|
-
color: ${semanticColors.global.text.subtitle.enabled};
|
|
95
|
-
opacity: 0.7;
|
|
96
|
-
transition: opacity 0.2s ease;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&:hover img {
|
|
100
|
-
opacity: 1;
|
|
101
|
-
}
|
|
102
|
-
`;
|
|
103
|
-
|
|
104
|
-
export const TooltipContent = styled.div<{
|
|
105
|
-
$position: TooltipPosition;
|
|
106
|
-
$visible: boolean;
|
|
107
|
-
}>`
|
|
108
|
-
position: absolute;
|
|
109
|
-
background: ${primitiveColors.base.white};
|
|
110
|
-
color: ${primitiveColors.gray[900]};
|
|
111
|
-
padding: ${semanticSizes.global.padding.md};
|
|
112
|
-
border-radius: ${semanticRadius.global.radius.md};
|
|
113
|
-
font-size: ${typographyTokens.fontSizes.captionM};
|
|
114
|
-
line-height: ${typographyTokens.lineHeights.captionM};
|
|
115
|
-
max-width: 280px;
|
|
116
|
-
min-width: 200px;
|
|
117
|
-
z-index: 1000;
|
|
118
|
-
box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.12);
|
|
119
|
-
border: 1px solid ${primitiveColors.gray[200]};
|
|
120
|
-
white-space: normal;
|
|
121
|
-
word-wrap: break-word;
|
|
122
|
-
|
|
123
|
-
opacity: ${({ $visible }) => ($visible ? '1' : '0')};
|
|
124
|
-
visibility: ${({ $visible }) => ($visible ? 'visible' : 'hidden')};
|
|
125
|
-
transition:
|
|
126
|
-
opacity 0.2s ease,
|
|
127
|
-
visibility 0.2s ease;
|
|
128
|
-
pointer-events: ${({ $visible }) => ($visible ? 'auto' : 'none')};
|
|
129
|
-
|
|
130
|
-
${({ $position }) => positionStyles[$position]}
|
|
131
|
-
`;
|
|
132
|
-
|
|
133
|
-
export const TooltipText = styled.p`
|
|
134
|
-
margin: 0 0 ${semanticSizes.global.gap.sm} 0;
|
|
135
|
-
color: ${primitiveColors.gray[800]};
|
|
136
|
-
font-size: ${typographyTokens.fontSizes.captionM};
|
|
137
|
-
line-height: ${typographyTokens.lineHeights.captionM};
|
|
138
|
-
`;
|
|
139
|
-
|
|
140
|
-
export const TooltipLink = styled.a`
|
|
141
|
-
color: ${primitiveColors.blue[600]};
|
|
142
|
-
text-decoration: underline;
|
|
143
|
-
font-weight: ${typographyTokens.fontWeights.medium};
|
|
144
|
-
font-size: ${typographyTokens.fontSizes.captionM};
|
|
145
|
-
display: inline-flex;
|
|
146
|
-
align-items: center;
|
|
147
|
-
gap: 4px;
|
|
148
|
-
margin-top: ${semanticSizes.global.gap.xs};
|
|
149
|
-
|
|
150
|
-
&:hover {
|
|
151
|
-
color: ${primitiveColors.blue[800]};
|
|
152
|
-
}
|
|
153
|
-
`;
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import {
|
|
3
|
+
semanticColors,
|
|
4
|
+
primitiveColors,
|
|
5
|
+
semanticSizes,
|
|
6
|
+
semanticRadius,
|
|
7
|
+
typographyTokens,
|
|
8
|
+
} from '../../../styles/tokens';
|
|
9
|
+
import { TooltipPosition } from './tooltip.types';
|
|
10
|
+
|
|
11
|
+
const arrowSize = '8px';
|
|
12
|
+
|
|
13
|
+
const positionStyles = {
|
|
14
|
+
top: css`
|
|
15
|
+
bottom: calc(100% + 12px);
|
|
16
|
+
left: 50%;
|
|
17
|
+
transform: translateX(-50%);
|
|
18
|
+
|
|
19
|
+
&::after {
|
|
20
|
+
content: '';
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 100%;
|
|
23
|
+
left: 50%;
|
|
24
|
+
transform: translateX(-50%);
|
|
25
|
+
border-left: ${arrowSize} solid transparent;
|
|
26
|
+
border-right: ${arrowSize} solid transparent;
|
|
27
|
+
border-top: ${arrowSize} solid ${primitiveColors.base.white};
|
|
28
|
+
}
|
|
29
|
+
`,
|
|
30
|
+
bottom: css`
|
|
31
|
+
top: calc(100% + 12px);
|
|
32
|
+
left: 50%;
|
|
33
|
+
transform: translateX(-50%);
|
|
34
|
+
|
|
35
|
+
&::after {
|
|
36
|
+
content: '';
|
|
37
|
+
position: absolute;
|
|
38
|
+
bottom: 100%;
|
|
39
|
+
left: 50%;
|
|
40
|
+
transform: translateX(-50%);
|
|
41
|
+
border-left: ${arrowSize} solid transparent;
|
|
42
|
+
border-right: ${arrowSize} solid transparent;
|
|
43
|
+
border-bottom: ${arrowSize} solid ${primitiveColors.base.white};
|
|
44
|
+
}
|
|
45
|
+
`,
|
|
46
|
+
left: css`
|
|
47
|
+
right: calc(100% + 12px);
|
|
48
|
+
top: 50%;
|
|
49
|
+
transform: translateY(-50%);
|
|
50
|
+
|
|
51
|
+
&::after {
|
|
52
|
+
content: '';
|
|
53
|
+
position: absolute;
|
|
54
|
+
left: 100%;
|
|
55
|
+
top: 50%;
|
|
56
|
+
transform: translateY(-50%);
|
|
57
|
+
border-top: ${arrowSize} solid transparent;
|
|
58
|
+
border-bottom: ${arrowSize} solid transparent;
|
|
59
|
+
border-left: ${arrowSize} solid ${primitiveColors.base.white};
|
|
60
|
+
}
|
|
61
|
+
`,
|
|
62
|
+
right: css`
|
|
63
|
+
left: calc(100% + 12px);
|
|
64
|
+
top: 50%;
|
|
65
|
+
transform: translateY(-50%);
|
|
66
|
+
|
|
67
|
+
&::after {
|
|
68
|
+
content: '';
|
|
69
|
+
position: absolute;
|
|
70
|
+
right: 100%;
|
|
71
|
+
top: 50%;
|
|
72
|
+
transform: translateY(-50%);
|
|
73
|
+
border-top: ${arrowSize} solid transparent;
|
|
74
|
+
border-bottom: ${arrowSize} solid transparent;
|
|
75
|
+
border-right: ${arrowSize} solid ${primitiveColors.base.white};
|
|
76
|
+
}
|
|
77
|
+
`,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const TooltipContainer = styled.div`
|
|
81
|
+
position: relative;
|
|
82
|
+
display: inline-flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
gap: ${semanticSizes.global.gap.xs};
|
|
85
|
+
`;
|
|
86
|
+
|
|
87
|
+
export const TooltipTrigger = styled.div`
|
|
88
|
+
display: inline-flex;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
|
|
91
|
+
img {
|
|
92
|
+
width: 16px;
|
|
93
|
+
height: 16px;
|
|
94
|
+
color: ${semanticColors.global.text.subtitle.enabled};
|
|
95
|
+
opacity: 0.7;
|
|
96
|
+
transition: opacity 0.2s ease;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&:hover img {
|
|
100
|
+
opacity: 1;
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
|
|
104
|
+
export const TooltipContent = styled.div<{
|
|
105
|
+
$position: TooltipPosition;
|
|
106
|
+
$visible: boolean;
|
|
107
|
+
}>`
|
|
108
|
+
position: absolute;
|
|
109
|
+
background: ${primitiveColors.base.white};
|
|
110
|
+
color: ${primitiveColors.gray[900]};
|
|
111
|
+
padding: ${semanticSizes.global.padding.md};
|
|
112
|
+
border-radius: ${semanticRadius.global.radius.md};
|
|
113
|
+
font-size: ${typographyTokens.fontSizes.captionM};
|
|
114
|
+
line-height: ${typographyTokens.lineHeights.captionM};
|
|
115
|
+
max-width: 280px;
|
|
116
|
+
min-width: 200px;
|
|
117
|
+
z-index: 1000;
|
|
118
|
+
box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.12);
|
|
119
|
+
border: 1px solid ${primitiveColors.gray[200]};
|
|
120
|
+
white-space: normal;
|
|
121
|
+
word-wrap: break-word;
|
|
122
|
+
|
|
123
|
+
opacity: ${({ $visible }) => ($visible ? '1' : '0')};
|
|
124
|
+
visibility: ${({ $visible }) => ($visible ? 'visible' : 'hidden')};
|
|
125
|
+
transition:
|
|
126
|
+
opacity 0.2s ease,
|
|
127
|
+
visibility 0.2s ease;
|
|
128
|
+
pointer-events: ${({ $visible }) => ($visible ? 'auto' : 'none')};
|
|
129
|
+
|
|
130
|
+
${({ $position }) => positionStyles[$position]}
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
export const TooltipText = styled.p`
|
|
134
|
+
margin: 0 0 ${semanticSizes.global.gap.sm} 0;
|
|
135
|
+
color: ${primitiveColors.gray[800]};
|
|
136
|
+
font-size: ${typographyTokens.fontSizes.captionM};
|
|
137
|
+
line-height: ${typographyTokens.lineHeights.captionM};
|
|
138
|
+
`;
|
|
139
|
+
|
|
140
|
+
export const TooltipLink = styled.a`
|
|
141
|
+
color: ${primitiveColors.blue[600]};
|
|
142
|
+
text-decoration: underline;
|
|
143
|
+
font-weight: ${typographyTokens.fontWeights.medium};
|
|
144
|
+
font-size: ${typographyTokens.fontSizes.captionM};
|
|
145
|
+
display: inline-flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
gap: 4px;
|
|
148
|
+
margin-top: ${semanticSizes.global.gap.xs};
|
|
149
|
+
|
|
150
|
+
&:hover {
|
|
151
|
+
color: ${primitiveColors.blue[800]};
|
|
152
|
+
}
|
|
153
|
+
`;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
2
|
-
|
|
3
|
-
export interface TooltipProps {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
content: string;
|
|
6
|
-
position?: TooltipPosition;
|
|
7
|
-
helpLink?: string;
|
|
8
|
-
}
|
|
1
|
+
export type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
2
|
+
|
|
3
|
+
export interface TooltipProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
content: string;
|
|
6
|
+
position?: TooltipPosition;
|
|
7
|
+
helpLink?: string;
|
|
8
|
+
}
|
|
@@ -1,68 +1,85 @@
|
|
|
1
1
|
// TimeLine.mapper.ts
|
|
2
2
|
import {
|
|
3
3
|
TimelineItem,
|
|
4
|
-
TimelineVariant,
|
|
5
4
|
RemoteEvent,
|
|
6
|
-
|
|
5
|
+
EventIdKey,
|
|
6
|
+
TimelineVariant,
|
|
7
7
|
} from './TimeLine.types';
|
|
8
|
+
import { resolveTimelineConfig } from './TimeLine.registry';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
[EventType.PartnerIssue]: 'issue',
|
|
14
|
-
[EventType.PartnerOrder]: 'order',
|
|
15
|
-
};
|
|
10
|
+
function toEventIdKey(eventId: number | string): EventIdKey {
|
|
11
|
+
const raw = String(eventId).trim();
|
|
12
|
+
return raw as EventIdKey;
|
|
13
|
+
}
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
[EventType.ProposalRefused]: 'Proposta recusada',
|
|
21
|
-
[EventType.PartnerIssue]: 'Emissão realizada',
|
|
22
|
-
[EventType.PartnerOrder]: 'Ordem realizada',
|
|
23
|
-
};
|
|
15
|
+
function toVariant(eventIdKey: EventIdKey): TimelineVariant {
|
|
16
|
+
return resolveTimelineConfig(eventIdKey)?.variant || 'continued';
|
|
17
|
+
}
|
|
24
18
|
|
|
25
|
-
function
|
|
26
|
-
|
|
19
|
+
function buildTitle(eventIdKey: EventIdKey): string {
|
|
20
|
+
const base =
|
|
21
|
+
resolveTimelineConfig(eventIdKey)?.labelPtBr || `Evento ${eventIdKey}`;
|
|
22
|
+
|
|
23
|
+
return base;
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
function actorFrom(ev: RemoteEvent) {
|
|
27
|
+
if (!ev.user) {
|
|
28
|
+
return { id: '', displayName: 'Sistema', type: 'app' as const };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
id: String(ev.user.id),
|
|
33
|
+
displayName: ev.user.name || 'Usuário',
|
|
34
|
+
type: 'user' as const,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function safeOrigin(ev: RemoteEvent): string {
|
|
39
|
+
const origin = ev.parentType || ev.eventType;
|
|
40
|
+
return origin ? String(origin) : 'unknown';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function safeData(ev: RemoteEvent): Record<string, unknown> {
|
|
44
|
+
return ev.data && typeof ev.data === 'object' ? ev.data : {};
|
|
35
45
|
}
|
|
36
46
|
|
|
37
47
|
export function mapRemoteToTimeline(items: RemoteEvent[]): TimelineItem[] {
|
|
38
48
|
return items.map((ev, idx) => {
|
|
39
|
-
const id = ev.
|
|
40
|
-
const
|
|
49
|
+
const id = ev.id || String(idx);
|
|
50
|
+
const eventIdKey = toEventIdKey(ev.eventId);
|
|
51
|
+
const data = safeData(ev) as Record<string, any>;
|
|
41
52
|
|
|
42
53
|
return {
|
|
43
54
|
id,
|
|
44
|
-
timestamp: ev.
|
|
45
|
-
type: toVariant(
|
|
46
|
-
title: buildTitle(
|
|
55
|
+
timestamp: ev.startDate,
|
|
56
|
+
type: toVariant(eventIdKey),
|
|
57
|
+
title: buildTitle(eventIdKey),
|
|
47
58
|
description: undefined,
|
|
48
|
-
actor:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
type: ev.actor?.type ?? 'app',
|
|
52
|
-
},
|
|
53
|
-
origin: ev.parentEventType || ev.eventType,
|
|
54
|
-
correlationId: ev.correlationId,
|
|
59
|
+
actor: actorFrom(ev),
|
|
60
|
+
origin: safeOrigin(ev),
|
|
61
|
+
correlationId: ev.id,
|
|
55
62
|
metadata: {
|
|
63
|
+
eventIdKey,
|
|
64
|
+
eventIdRaw: ev.eventId,
|
|
56
65
|
eventType: ev.eventType,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
endAt: ev.endAt,
|
|
66
|
+
isPublic: ev.isPublic,
|
|
67
|
+
startDate: ev.startDate,
|
|
68
|
+
endDate: ev.endDate,
|
|
61
69
|
duration: ev.duration,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
parentId: ev.parentId,
|
|
71
|
+
parentType: ev.parentType,
|
|
72
|
+
|
|
73
|
+
proposalId: data?.id,
|
|
74
|
+
orderId: data?.umOrder,
|
|
75
|
+
insuranceId: data?.umInsurance,
|
|
76
|
+
insuredName: data?.insuredName,
|
|
77
|
+
insuredDocument: data?.insuredDocument,
|
|
78
|
+
status: data?.status,
|
|
79
|
+
stage: data?.stage,
|
|
80
|
+
modality: data?.modality,
|
|
81
|
+
|
|
82
|
+
data,
|
|
66
83
|
},
|
|
67
84
|
};
|
|
68
85
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { EventIdKey, TimelineVariant } from './TimeLine.types';
|
|
2
|
+
|
|
3
|
+
type TimelineEventConfig = {
|
|
4
|
+
labelPtBr: string;
|
|
5
|
+
variant: TimelineVariant;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const TIMELINE_EVENT_REGISTRY: Record<EventIdKey, TimelineEventConfig> =
|
|
9
|
+
{
|
|
10
|
+
'15101': { labelPtBr: 'Proposta criada', variant: 'info' },
|
|
11
|
+
'15102': { labelPtBr: 'Proposta subscrita', variant: 'info' },
|
|
12
|
+
'15103': { labelPtBr: 'Proposta atualizada', variant: 'info' },
|
|
13
|
+
'15104': { labelPtBr: 'Foi feito o download da proposta', variant: 'info' },
|
|
14
|
+
'15105': { labelPtBr: 'Apólice emitida', variant: 'issue' },
|
|
15
|
+
|
|
16
|
+
'15120': { labelPtBr: 'Categoria criada', variant: 'info' },
|
|
17
|
+
|
|
18
|
+
'20001': { labelPtBr: 'Unidade de Negócio criada', variant: 'info' },
|
|
19
|
+
'20002': { labelPtBr: 'Unidade de Negócio atualizada', variant: 'info' },
|
|
20
|
+
'20003': { labelPtBr: 'Unidade de Negócio removida', variant: 'deleted' },
|
|
21
|
+
'20004': {
|
|
22
|
+
labelPtBr: 'Usuário adicionado à Unidade de Negócio',
|
|
23
|
+
variant: 'info',
|
|
24
|
+
},
|
|
25
|
+
'20005': {
|
|
26
|
+
labelPtBr: 'Usuário removido da Unidade de Negócio',
|
|
27
|
+
variant: 'info',
|
|
28
|
+
},
|
|
29
|
+
'20006': {
|
|
30
|
+
labelPtBr: 'Empresa adicionada à Unidade de Negócio',
|
|
31
|
+
variant: 'info',
|
|
32
|
+
},
|
|
33
|
+
'20007': {
|
|
34
|
+
labelPtBr: 'Empresa removida da Unidade de Negócio',
|
|
35
|
+
variant: 'deleted',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export function resolveTimelineConfig(eventIdKey: EventIdKey) {
|
|
40
|
+
return TIMELINE_EVENT_REGISTRY[eventIdKey];
|
|
41
|
+
}
|
|
@@ -32,17 +32,18 @@ export const ItemWrap = styled.li`
|
|
|
32
32
|
}
|
|
33
33
|
`;
|
|
34
34
|
|
|
35
|
-
export const Dot = styled.span<{
|
|
36
|
-
$variant?: TimelineVariant | string;
|
|
37
|
-
}>`
|
|
35
|
+
export const Dot = styled.span<{ $variant?: TimelineVariant | string }>`
|
|
38
36
|
width: 24px;
|
|
39
37
|
height: 24px;
|
|
40
38
|
border-radius: 50%;
|
|
41
39
|
border: 1px solid;
|
|
42
40
|
display: inline-block;
|
|
43
41
|
margin-top: 0.2rem;
|
|
42
|
+
|
|
44
43
|
${({ $variant = 'continued' }) => {
|
|
45
|
-
const
|
|
44
|
+
const v = ($variant as TimelineVariant) || 'continued';
|
|
45
|
+
|
|
46
|
+
const bgMap: Partial<Record<TimelineVariant, ReturnType<typeof css>>> = {
|
|
46
47
|
continued: css`
|
|
47
48
|
background: ${semanticColors.branding.surface.disabled};
|
|
48
49
|
`,
|
|
@@ -61,32 +62,61 @@ export const Dot = styled.span<{
|
|
|
61
62
|
order: css`
|
|
62
63
|
background: ${semanticColors.global.surface.status.online};
|
|
63
64
|
`,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}}
|
|
67
|
-
|
|
68
|
-
${({ $variant = 'continued' }) => {
|
|
69
|
-
const map: Record<TimelineVariant, ReturnType<typeof css>> = {
|
|
70
|
-
continued: css`
|
|
71
|
-
border-color: ${semanticColors.branding.surface.enabled};
|
|
72
|
-
`,
|
|
73
|
-
accepted: css`
|
|
74
|
-
border-color: ${semanticColors.global.border.feedback.success};
|
|
75
|
-
`,
|
|
76
|
-
rejected: css`
|
|
77
|
-
border-color: ${semanticColors.global.border.feedback.error};
|
|
65
|
+
created: css`
|
|
66
|
+
background: ${semanticColors.global.surface.status.online};
|
|
78
67
|
`,
|
|
79
|
-
|
|
80
|
-
|
|
68
|
+
updated: css`
|
|
69
|
+
background: ${semanticColors.global.surface.status.online};
|
|
81
70
|
`,
|
|
82
|
-
|
|
83
|
-
|
|
71
|
+
deleted: css`
|
|
72
|
+
background: ${semanticColors.global.surface.status.notification};
|
|
84
73
|
`,
|
|
85
|
-
|
|
86
|
-
|
|
74
|
+
info: css`
|
|
75
|
+
background: ${semanticColors.branding.surface.disabled};
|
|
87
76
|
`,
|
|
88
77
|
};
|
|
89
|
-
|
|
78
|
+
|
|
79
|
+
return bgMap[v] ?? bgMap.continued!;
|
|
80
|
+
}}
|
|
81
|
+
|
|
82
|
+
${({ $variant = 'continued' }) => {
|
|
83
|
+
const v = ($variant as TimelineVariant) || 'continued';
|
|
84
|
+
|
|
85
|
+
const borderMap: Partial<Record<TimelineVariant, ReturnType<typeof css>>> =
|
|
86
|
+
{
|
|
87
|
+
continued: css`
|
|
88
|
+
border-color: ${semanticColors.branding.surface.enabled};
|
|
89
|
+
`,
|
|
90
|
+
accepted: css`
|
|
91
|
+
border-color: ${semanticColors.global.border.feedback.success};
|
|
92
|
+
`,
|
|
93
|
+
rejected: css`
|
|
94
|
+
border-color: ${semanticColors.global.border.feedback.error};
|
|
95
|
+
`,
|
|
96
|
+
download: css`
|
|
97
|
+
border-color: ${semanticColors.branding.surface.enabled};
|
|
98
|
+
`,
|
|
99
|
+
issue: css`
|
|
100
|
+
border-color: ${semanticColors.global.border.feedback.success};
|
|
101
|
+
`,
|
|
102
|
+
order: css`
|
|
103
|
+
border-color: ${semanticColors.global.border.feedback.success};
|
|
104
|
+
`,
|
|
105
|
+
created: css`
|
|
106
|
+
border-color: ${semanticColors.global.border.feedback.success};
|
|
107
|
+
`,
|
|
108
|
+
updated: css`
|
|
109
|
+
border-color: ${semanticColors.global.border.feedback.success};
|
|
110
|
+
`,
|
|
111
|
+
deleted: css`
|
|
112
|
+
border-color: ${semanticColors.global.border.feedback.error};
|
|
113
|
+
`,
|
|
114
|
+
info: css`
|
|
115
|
+
border-color: ${semanticColors.branding.surface.enabled};
|
|
116
|
+
`,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
return borderMap[v] ?? borderMap.continued!;
|
|
90
120
|
}}
|
|
91
121
|
`;
|
|
92
122
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// src/components/molecules/TimeLine/TimeLine.tsx
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import {
|
|
4
3
|
ItemWrap,
|
|
@@ -14,6 +13,18 @@ import {
|
|
|
14
13
|
import { TimelineProps } from './TimeLine.types';
|
|
15
14
|
import { Skeleton } from '../../atoms/Skeleton/Skeleton';
|
|
16
15
|
|
|
16
|
+
function formatDateTimePtBr(iso: string) {
|
|
17
|
+
const d = new Date(iso);
|
|
18
|
+
if (Number.isNaN(d.getTime())) return { dateStr: '', timeStr: '' };
|
|
19
|
+
|
|
20
|
+
const dateStr = d.toLocaleDateString('pt-BR');
|
|
21
|
+
const timeStr = d.toLocaleTimeString('pt-BR', {
|
|
22
|
+
hour: '2-digit',
|
|
23
|
+
minute: '2-digit',
|
|
24
|
+
});
|
|
25
|
+
return { dateStr, timeStr };
|
|
26
|
+
}
|
|
27
|
+
|
|
17
28
|
export const Timeline: React.FC<TimelineProps> = ({
|
|
18
29
|
items,
|
|
19
30
|
loading = false,
|
|
@@ -32,6 +43,7 @@ export const Timeline: React.FC<TimelineProps> = ({
|
|
|
32
43
|
height={24}
|
|
33
44
|
ariaLabel="Carregando ponto da linha do tempo"
|
|
34
45
|
/>
|
|
46
|
+
|
|
35
47
|
<Card>
|
|
36
48
|
<Title>
|
|
37
49
|
<Skeleton variant="text" width="60%" height={32} />
|
|
@@ -47,7 +59,7 @@ export const Timeline: React.FC<TimelineProps> = ({
|
|
|
47
59
|
);
|
|
48
60
|
}
|
|
49
61
|
|
|
50
|
-
if (!items
|
|
62
|
+
if (!items?.length) {
|
|
51
63
|
return (
|
|
52
64
|
<Empty role="status" aria-live="polite">
|
|
53
65
|
<div>{emptyLabel}</div>
|
|
@@ -63,18 +75,11 @@ export const Timeline: React.FC<TimelineProps> = ({
|
|
|
63
75
|
return (
|
|
64
76
|
<List aria-label="Linha do tempo">
|
|
65
77
|
{items.map((it) => {
|
|
66
|
-
const
|
|
67
|
-
const dateStr = d.toLocaleDateString('pt-BR');
|
|
68
|
-
const timeStr = d.toLocaleTimeString('pt-BR', {
|
|
69
|
-
hour: '2-digit',
|
|
70
|
-
minute: '2-digit',
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
//const actorName = it.actor?.displayName || 'Sistema';
|
|
78
|
+
const { dateStr, timeStr } = formatDateTimePtBr(it.timestamp);
|
|
74
79
|
|
|
75
80
|
return (
|
|
76
81
|
<ItemWrap key={it.id}>
|
|
77
|
-
|
|
82
|
+
<Dot aria-hidden $variant={it.type} />
|
|
78
83
|
<Card>
|
|
79
84
|
<Row style={{ justifyContent: 'space-between' }}>
|
|
80
85
|
<Title>{it.title}</Title>
|
|
@@ -82,9 +87,8 @@ export const Timeline: React.FC<TimelineProps> = ({
|
|
|
82
87
|
|
|
83
88
|
<Sub>
|
|
84
89
|
<div>
|
|
85
|
-
|
|
86
|
-
{dateStr ?
|
|
87
|
-
Em: {dateStr ? `${dateStr} às ${timeStr}` : ''}
|
|
90
|
+
Por: {it.actor.displayName} no dia{' '}
|
|
91
|
+
{dateStr ? `${dateStr} às ${timeStr}` : ''}
|
|
88
92
|
</div>
|
|
89
93
|
</Sub>
|
|
90
94
|
</Card>
|