jornada-ui 2.0.8 → 3.0.0
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/lib/commonjs/common/icons-svg/chevron-right/index.js +36 -0
- package/lib/commonjs/common/icons-svg/chevron-right/index.js.map +1 -0
- package/lib/commonjs/common/icons-svg/constants/index.js +3 -1
- package/lib/commonjs/common/icons-svg/constants/index.js.map +1 -1
- package/lib/commonjs/common/icons-svg/index.js +14 -0
- package/lib/commonjs/common/icons-svg/index.js.map +1 -1
- package/lib/commonjs/common/icons-svg/video/index.js +36 -0
- package/lib/commonjs/common/icons-svg/video/index.js.map +1 -0
- package/lib/commonjs/components/check-box/index.js +2 -1
- package/lib/commonjs/components/check-box/index.js.map +1 -1
- package/lib/commonjs/components/notification-card/index.js +6 -1
- package/lib/commonjs/components/notification-card/index.js.map +1 -1
- package/lib/commonjs/components/notification-steps-card/index.js +190 -0
- package/lib/commonjs/components/notification-steps-card/index.js.map +1 -0
- package/lib/commonjs/components/notification-steps-card/interface.js +6 -0
- package/lib/commonjs/components/notification-steps-card/interface.js.map +1 -0
- package/lib/commonjs/index.js +13 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/stories/notification-steps-card/notification-steps-card.stories.js +135 -0
- package/lib/commonjs/stories/notification-steps-card/notification-steps-card.stories.js.map +1 -0
- package/lib/module/common/icons-svg/chevron-right/index.js +30 -0
- package/lib/module/common/icons-svg/chevron-right/index.js.map +1 -0
- package/lib/module/common/icons-svg/constants/index.js +3 -1
- package/lib/module/common/icons-svg/constants/index.js.map +1 -1
- package/lib/module/common/icons-svg/index.js +14 -0
- package/lib/module/common/icons-svg/index.js.map +1 -1
- package/lib/module/common/icons-svg/video/index.js +30 -0
- package/lib/module/common/icons-svg/video/index.js.map +1 -0
- package/lib/module/components/check-box/index.js +2 -1
- package/lib/module/components/check-box/index.js.map +1 -1
- package/lib/module/components/notification-card/index.js +6 -1
- package/lib/module/components/notification-card/index.js.map +1 -1
- package/lib/module/components/notification-steps-card/index.js +183 -0
- package/lib/module/components/notification-steps-card/index.js.map +1 -0
- package/lib/module/components/notification-steps-card/interface.js +4 -0
- package/lib/module/components/notification-steps-card/interface.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/stories/notification-steps-card/notification-steps-card.stories.js +130 -0
- package/lib/module/stories/notification-steps-card/notification-steps-card.stories.js.map +1 -0
- package/lib/typescript/commonjs/src/common/icons-svg/chevron-right/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/common/icons-svg/chevron-right/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/common/icons-svg/constants/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/common/icons-svg/constants/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/common/icons-svg/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/common/icons-svg/video/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/common/icons-svg/video/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/card-scheduled-journey/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/check-box/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/notification-card/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/notification-card/interface.d.ts +2 -1
- package/lib/typescript/commonjs/src/components/notification-card/interface.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/notification-steps-card/index.d.ts +11 -0
- package/lib/typescript/commonjs/src/components/notification-steps-card/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/notification-steps-card/interface.d.ts +30 -0
- package/lib/typescript/commonjs/src/components/notification-steps-card/interface.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/selects/select-date-and-hours/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/stories/notification-steps-card/notification-steps-card.stories.d.ts +14 -0
- package/lib/typescript/commonjs/src/stories/notification-steps-card/notification-steps-card.stories.d.ts.map +1 -0
- package/lib/typescript/module/src/common/icons-svg/chevron-right/index.d.ts +8 -0
- package/lib/typescript/module/src/common/icons-svg/chevron-right/index.d.ts.map +1 -0
- package/lib/typescript/module/src/common/icons-svg/constants/index.d.ts +2 -0
- package/lib/typescript/module/src/common/icons-svg/constants/index.d.ts.map +1 -1
- package/lib/typescript/module/src/common/icons-svg/index.d.ts.map +1 -1
- package/lib/typescript/module/src/common/icons-svg/video/index.d.ts +8 -0
- package/lib/typescript/module/src/common/icons-svg/video/index.d.ts.map +1 -0
- package/lib/typescript/module/src/components/card-scheduled-journey/index.d.ts +1 -1
- package/lib/typescript/module/src/components/check-box/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/notification-card/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/notification-card/interface.d.ts +2 -1
- package/lib/typescript/module/src/components/notification-card/interface.d.ts.map +1 -1
- package/lib/typescript/module/src/components/notification-steps-card/index.d.ts +11 -0
- package/lib/typescript/module/src/components/notification-steps-card/index.d.ts.map +1 -0
- package/lib/typescript/module/src/components/notification-steps-card/interface.d.ts +30 -0
- package/lib/typescript/module/src/components/notification-steps-card/interface.d.ts.map +1 -0
- package/lib/typescript/module/src/components/selects/select-date-and-hours/index.d.ts +1 -1
- package/lib/typescript/module/src/index.d.ts +1 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/stories/notification-steps-card/notification-steps-card.stories.d.ts +14 -0
- package/lib/typescript/module/src/stories/notification-steps-card/notification-steps-card.stories.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/common/icons-svg/chevron-right/index.tsx +27 -0
- package/src/common/icons-svg/constants/index.ts +2 -0
- package/src/common/icons-svg/index.tsx +15 -0
- package/src/common/icons-svg/video/index.tsx +27 -0
- package/src/components/check-box/index.tsx +1 -0
- package/src/components/notification-card/index.tsx +15 -10
- package/src/components/notification-card/interface.ts +3 -1
- package/src/components/notification-steps-card/index.tsx +190 -0
- package/src/components/notification-steps-card/interface.ts +38 -0
- package/src/index.tsx +1 -0
- package/src/stories/notification-steps-card/notification-steps-card.stories.tsx +144 -0
|
@@ -69,6 +69,8 @@ import { SvgIconPlusTrash } from "./trash";
|
|
|
69
69
|
import { SvgIconDownload } from "./download";
|
|
70
70
|
import { SvgIconBluetoothSlash } from "./bluetooth-slash";
|
|
71
71
|
import { SvgIconCheckBox } from "./check-box";
|
|
72
|
+
import { SvgIconVideo } from "./video";
|
|
73
|
+
import { SvgIconChevronRight } from "./chevron-right";
|
|
72
74
|
|
|
73
75
|
const Icons: React.FC<ISvgProps> = ({ icon, color, size, background }) => {
|
|
74
76
|
switch (icon) {
|
|
@@ -274,6 +276,19 @@ const Icons: React.FC<ISvgProps> = ({ icon, color, size, background }) => {
|
|
|
274
276
|
|
|
275
277
|
case "TRASH":
|
|
276
278
|
return <SvgIconPlusTrash color={color} size={size} icon="TRASH" />;
|
|
279
|
+
|
|
280
|
+
case "VIDEO":
|
|
281
|
+
return <SvgIconVideo color={color ?? theme.colors.gray[700]} size={size ?? 24} icon="VIDEO" />;
|
|
282
|
+
|
|
283
|
+
case "CHEVRON_RIGHT":
|
|
284
|
+
return (
|
|
285
|
+
<SvgIconChevronRight
|
|
286
|
+
color={color ?? theme.colors.gray[700]}
|
|
287
|
+
size={size ?? 20}
|
|
288
|
+
icon="CHEVRON_RIGHT"
|
|
289
|
+
/>
|
|
290
|
+
);
|
|
291
|
+
|
|
277
292
|
default:
|
|
278
293
|
return <SvgIconCameraPlus color={color} size={size} icon={"CAMERA_PLUS"} />;
|
|
279
294
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import Svg, { Path } from "react-native-svg";
|
|
6
|
+
|
|
7
|
+
//typings
|
|
8
|
+
import { type ISvgProps } from "../interface";
|
|
9
|
+
|
|
10
|
+
const SvgIconVideo: React.FC<ISvgProps> = ({ size, color, ...res }) => (
|
|
11
|
+
<Svg
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
+
width={size ?? 24}
|
|
15
|
+
height={size ?? 24}
|
|
16
|
+
fill="none"
|
|
17
|
+
viewBox="0 0 24 24"
|
|
18
|
+
{...res}
|
|
19
|
+
>
|
|
20
|
+
<Path
|
|
21
|
+
fill={color ?? "#837676"}
|
|
22
|
+
d="M4 5.25A1.75 1.75 0 0 0 2.25 7v10A1.75 1.75 0 0 0 4 18.75h12A1.75 1.75 0 0 0 17.75 17v-2.19l3.14 2.35A.75.75 0 0 0 22 16.56V7.44a.75.75 0 0 0-1.11-.66l-3.14 2.35V7A1.75 1.75 0 0 0 16 5.25zm12.25 11.5H4a.25.25 0 0 1-.25-.25V7a.25.25 0 0 1 .25-.25h12a.25.25 0 0 1 .25.25zm4.25-2.02-2.75-2.06v.66l2.75 2.06zm0-.72V8.79l-2.75 2.06v2.34zm-9.62-3.34a.75.75 0 0 0-1.13.65v3.96a.75.75 0 0 0 1.13.65l3.4-1.98a.75.75 0 0 0 0-1.3zm.37 3.31v-1.36l1.17.68z"
|
|
23
|
+
></Path>
|
|
24
|
+
</Svg>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export { SvgIconVideo };
|
|
@@ -72,16 +72,21 @@ const NotificationCard: React.FC<INotificationCardProps> = forwardRef<View, INot
|
|
|
72
72
|
</Box>
|
|
73
73
|
|
|
74
74
|
{/* Texto */}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
{/* Texto */}
|
|
76
|
+
{typeof description === "string" ? (
|
|
77
|
+
<Typography
|
|
78
|
+
text={description}
|
|
79
|
+
numberOfLines={isWarning ? 2 : 4}
|
|
80
|
+
ellipsizeMode="tail"
|
|
81
|
+
size={theme.fontSizes.sm}
|
|
82
|
+
lineHeight={theme.lineHeight.md}
|
|
83
|
+
fontFamily={theme.fonts.inter_regular_400}
|
|
84
|
+
color={theme.colors.gray[700]}
|
|
85
|
+
marginBottom={theme.margins.xs}
|
|
86
|
+
/>
|
|
87
|
+
) : (
|
|
88
|
+
<Box marginStyle={{ marginBottom: theme.margins.xs }}>{description}</Box>
|
|
89
|
+
)}
|
|
85
90
|
|
|
86
91
|
{/* Ação opcional */}
|
|
87
92
|
{actionLabel && onPressAction && (
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
* IMPORTS
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import type { ReactNode } from "react";
|
|
6
|
+
|
|
5
7
|
interface INotificationCardProps {
|
|
6
8
|
variant?: "read" | "unread";
|
|
7
9
|
title: string;
|
|
8
|
-
description: string;
|
|
10
|
+
description: string | ReactNode;
|
|
9
11
|
actionLabel?: string;
|
|
10
12
|
onPress?: () => void;
|
|
11
13
|
onPressAction?: () => void;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import React, { forwardRef } from "react";
|
|
5
|
+
import { TouchableOpacity, View } from "react-native";
|
|
6
|
+
|
|
7
|
+
// commons / icons
|
|
8
|
+
import { Icons } from "../../common/icons-svg";
|
|
9
|
+
|
|
10
|
+
// components
|
|
11
|
+
import Box from "../box";
|
|
12
|
+
import Typography from "../typography";
|
|
13
|
+
|
|
14
|
+
// styles / theme
|
|
15
|
+
import { theme } from "../../styles/theme/theme";
|
|
16
|
+
|
|
17
|
+
// typings
|
|
18
|
+
import { asBaseComponent } from "../../@types/as-base-component";
|
|
19
|
+
import type {
|
|
20
|
+
INotificationStep,
|
|
21
|
+
INotificationStepsCardProps,
|
|
22
|
+
NotificationStepType,
|
|
23
|
+
} from "./interface";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Mapeia o tipo da etapa para o ícone correspondente.
|
|
27
|
+
*/
|
|
28
|
+
const stepIconByType: Record<NotificationStepType, "VIDEO" | "FILES"> = {
|
|
29
|
+
video: "VIDEO",
|
|
30
|
+
pdf: "FILES",
|
|
31
|
+
text: "FILES",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Componente NotificationStepsCard
|
|
36
|
+
*
|
|
37
|
+
* Exibe uma notificação com múltiplas etapas/conteúdos (texto, pdf, vídeo),
|
|
38
|
+
* cada uma com ícone, título, subtítulo e um chevron de ação. Etapas podem
|
|
39
|
+
* ser bloqueadas (disabled) para forçar conclusão em ordem.
|
|
40
|
+
*/
|
|
41
|
+
const NotificationStepsCard: React.FC<INotificationStepsCardProps> = forwardRef<
|
|
42
|
+
View,
|
|
43
|
+
INotificationStepsCardProps
|
|
44
|
+
>(({ title, description, steps, warningMessage, testID }, ref) => {
|
|
45
|
+
const borderColor = theme.colors.blue[525];
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Box
|
|
49
|
+
ref={ref}
|
|
50
|
+
testID={testID ?? "notification-steps-card"}
|
|
51
|
+
flexStyle={{ flexDirection: "row" }}
|
|
52
|
+
borderStyled={{
|
|
53
|
+
borderWidth: 1,
|
|
54
|
+
borderColor: theme.colors.blue[525],
|
|
55
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
56
|
+
}}
|
|
57
|
+
marginStyle={{ marginBottom: 12 }}
|
|
58
|
+
backgroundColor={theme.colors.neutral[25]}
|
|
59
|
+
>
|
|
60
|
+
{/* borda fixa lateral esquerda */}
|
|
61
|
+
<Box
|
|
62
|
+
width={8}
|
|
63
|
+
backgroundColor={borderColor}
|
|
64
|
+
borderStyled={{
|
|
65
|
+
borderTopLeftRadius: theme.borderWidths.thick_medium,
|
|
66
|
+
borderBottomLeftRadius: theme.borderWidths.thick_medium,
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
|
|
70
|
+
{/* Conteúdo do card */}
|
|
71
|
+
<Box flexStyle={{ flex: 1 }} paddingStyle={{ padding: theme.paddings.md }}>
|
|
72
|
+
{/* Título */}
|
|
73
|
+
<Typography
|
|
74
|
+
text={title}
|
|
75
|
+
fontFamily={theme.fonts.inter_bold}
|
|
76
|
+
fontWeight="700"
|
|
77
|
+
size={theme.fontSizes.md}
|
|
78
|
+
color={theme.colors.black[100]}
|
|
79
|
+
marginBottom={theme.margins["2xs"]}
|
|
80
|
+
/>
|
|
81
|
+
|
|
82
|
+
{/* Descrição */}
|
|
83
|
+
{typeof description === "string" ? (
|
|
84
|
+
<Typography
|
|
85
|
+
text={description}
|
|
86
|
+
size={theme.fontSizes.sm}
|
|
87
|
+
lineHeight={theme.lineHeight.xl}
|
|
88
|
+
fontFamily={theme.fonts.inter_regular_400}
|
|
89
|
+
color={theme.colors.gray[700]}
|
|
90
|
+
marginBottom={theme.margins.md}
|
|
91
|
+
/>
|
|
92
|
+
) : (
|
|
93
|
+
<Box marginStyle={{ marginBottom: theme.margins.md }}>{description}</Box>
|
|
94
|
+
)}
|
|
95
|
+
|
|
96
|
+
{/* Etapas */}
|
|
97
|
+
{steps.map((step: INotificationStep, index: number) => {
|
|
98
|
+
const isDisabled = !!step.disabled;
|
|
99
|
+
|
|
100
|
+
const contentColor = isDisabled
|
|
101
|
+
? theme.colors.gray[400]
|
|
102
|
+
: theme.colors.black[100];
|
|
103
|
+
|
|
104
|
+
const subtitleColor = isDisabled
|
|
105
|
+
? theme.colors.gray[400]
|
|
106
|
+
: theme.colors.gray[700];
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<TouchableOpacity
|
|
110
|
+
key={`${step.title}-${index}`}
|
|
111
|
+
testID={`notification-step-${index}`}
|
|
112
|
+
onPress={step.onPress}
|
|
113
|
+
disabled={isDisabled}
|
|
114
|
+
activeOpacity={0.7}
|
|
115
|
+
>
|
|
116
|
+
<Box
|
|
117
|
+
flexStyle={{ flexDirection: "row", alignItems: "center" }}
|
|
118
|
+
borderStyled={{
|
|
119
|
+
borderWidth: 1,
|
|
120
|
+
borderColor: theme.colors.neutral[200],
|
|
121
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
122
|
+
}}
|
|
123
|
+
paddingStyle={{ padding: theme.paddings.sm }}
|
|
124
|
+
marginStyle={{ marginBottom: theme.margins["1xs"] }}
|
|
125
|
+
backgroundColor={theme.colors.neutral[25]}
|
|
126
|
+
opacity={isDisabled ? 0.5 : 1}
|
|
127
|
+
>
|
|
128
|
+
{/* Ícone do tipo de conteúdo */}
|
|
129
|
+
<Icons icon={stepIconByType[step.type]} color={contentColor} size={22} />
|
|
130
|
+
|
|
131
|
+
{/* Título + subtítulo */}
|
|
132
|
+
<Box flexStyle={{ flex: 1 }} marginStyle={{ marginLeft: theme.margins.xs }}>
|
|
133
|
+
<Typography
|
|
134
|
+
text={step.title}
|
|
135
|
+
fontFamily={theme.fonts.inter_semi_bold_600}
|
|
136
|
+
fontWeight="600"
|
|
137
|
+
size={theme.fontSizes.sm}
|
|
138
|
+
color={contentColor}
|
|
139
|
+
/>
|
|
140
|
+
{!!step.subtitle && (
|
|
141
|
+
<Typography
|
|
142
|
+
text={step.subtitle}
|
|
143
|
+
size={theme.fontSizes.xs}
|
|
144
|
+
fontFamily={theme.fonts.inter_regular_400}
|
|
145
|
+
color={subtitleColor}
|
|
146
|
+
marginTop={2}
|
|
147
|
+
/>
|
|
148
|
+
)}
|
|
149
|
+
</Box>
|
|
150
|
+
|
|
151
|
+
{/* Chevron */}
|
|
152
|
+
<Icons icon="CHEVRON_RIGHT" color={subtitleColor} size={20} />
|
|
153
|
+
</Box>
|
|
154
|
+
</TouchableOpacity>
|
|
155
|
+
);
|
|
156
|
+
})}
|
|
157
|
+
|
|
158
|
+
{/* Aviso */}
|
|
159
|
+
{!!warningMessage && (
|
|
160
|
+
<Box
|
|
161
|
+
testID="notification-steps-warning"
|
|
162
|
+
borderStyled={{
|
|
163
|
+
borderWidth: 1,
|
|
164
|
+
borderColor: theme.colors.orange[150],
|
|
165
|
+
borderRadius: theme.borderWidths.thick,
|
|
166
|
+
}}
|
|
167
|
+
paddingStyle={{ padding: theme.paddings.sm }}
|
|
168
|
+
marginStyle={{ marginTop: theme.margins["1xs"] }}
|
|
169
|
+
backgroundColor={theme.colors.yellow[120]}
|
|
170
|
+
>
|
|
171
|
+
<Typography
|
|
172
|
+
text={warningMessage}
|
|
173
|
+
size={theme.fontSizes.sm}
|
|
174
|
+
lineHeight={theme.lineHeight.lg}
|
|
175
|
+
fontFamily={theme.fonts.inter_regular_400}
|
|
176
|
+
color={theme.colors.orange[150]}
|
|
177
|
+
/>
|
|
178
|
+
</Box>
|
|
179
|
+
)}
|
|
180
|
+
</Box>
|
|
181
|
+
</Box>
|
|
182
|
+
);
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
NotificationStepsCard.displayName = "NotificationStepsCard";
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* EXPORTS
|
|
189
|
+
*/
|
|
190
|
+
export default asBaseComponent(NotificationStepsCard);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { ReactNode } from "react";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Tipos de conteúdo suportados por uma etapa da notificação.
|
|
9
|
+
*/
|
|
10
|
+
type NotificationStepType = "pdf" | "video" | "text";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Representa uma etapa/conteúdo dentro do NotificationStepsCard.
|
|
14
|
+
*/
|
|
15
|
+
interface INotificationStep {
|
|
16
|
+
type: NotificationStepType;
|
|
17
|
+
title: string;
|
|
18
|
+
subtitle?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
onPress?: () => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface INotificationStepsCardProps {
|
|
24
|
+
title: string;
|
|
25
|
+
description: string | ReactNode;
|
|
26
|
+
steps: INotificationStep[];
|
|
27
|
+
warningMessage?: string;
|
|
28
|
+
testID?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* EXPORTS
|
|
33
|
+
*/
|
|
34
|
+
export {
|
|
35
|
+
type INotificationStep,
|
|
36
|
+
type INotificationStepsCardProps,
|
|
37
|
+
type NotificationStepType,
|
|
38
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -49,6 +49,7 @@ export { default as ModalToConfirmations } from "./components/modals/modal-to-co
|
|
|
49
49
|
export { default as ActivityTimeline } from "./components/activity-step";
|
|
50
50
|
export { default as NotificationCard } from "./components/notification-card";
|
|
51
51
|
export { default as NotificationDetailCard } from "./components/notification-details-card";
|
|
52
|
+
export { default as NotificationStepsCard } from "./components/notification-steps-card";
|
|
52
53
|
export { default as CheckBox } from "./components/check-box";
|
|
53
54
|
|
|
54
55
|
// adicionar o storybook + teste
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import React from "react";
|
|
5
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
6
|
+
|
|
7
|
+
// components
|
|
8
|
+
import NotificationStepsCard from "../../components/notification-steps-card";
|
|
9
|
+
|
|
10
|
+
// typings
|
|
11
|
+
import type { INotificationStepsCardProps } from "../../components/notification-steps-card/interface";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* META
|
|
15
|
+
*/
|
|
16
|
+
const meta: Meta<typeof NotificationStepsCard> = {
|
|
17
|
+
title: "Componente/NotificationStepsCard",
|
|
18
|
+
component: NotificationStepsCard as React.FC<INotificationStepsCardProps>,
|
|
19
|
+
args: {
|
|
20
|
+
title: "Campanha Zero Acidente",
|
|
21
|
+
description:
|
|
22
|
+
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and",
|
|
23
|
+
steps: [
|
|
24
|
+
{
|
|
25
|
+
type: "pdf",
|
|
26
|
+
title: "1. Instrução de segurança",
|
|
27
|
+
subtitle: "PDF . toque para ler",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: "video",
|
|
31
|
+
title: "2. Vídeo de treinamento",
|
|
32
|
+
subtitle: "Abre em tela cheia . 02:00",
|
|
33
|
+
disabled: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: "pdf",
|
|
37
|
+
title: "3. Termo de responsabilidade",
|
|
38
|
+
subtitle: "PDF . toque para ler",
|
|
39
|
+
disabled: true,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
warningMessage:
|
|
43
|
+
"As etapas devem ser concluídas em ordem. O vídeo não pode ser pulado.",
|
|
44
|
+
},
|
|
45
|
+
argTypes: {
|
|
46
|
+
title: {
|
|
47
|
+
control: { type: "text" },
|
|
48
|
+
description: "Título da notificação.",
|
|
49
|
+
},
|
|
50
|
+
description: {
|
|
51
|
+
control: { type: "text" },
|
|
52
|
+
description: "Descrição da notificação.",
|
|
53
|
+
},
|
|
54
|
+
steps: {
|
|
55
|
+
control: { type: "object" },
|
|
56
|
+
description: "Lista de etapas/conteúdos (text, pdf, video).",
|
|
57
|
+
},
|
|
58
|
+
warningMessage: {
|
|
59
|
+
control: { type: "text" },
|
|
60
|
+
description: "Mensagem de aviso opcional exibida no rodapé.",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
parameters: {
|
|
64
|
+
docs: {
|
|
65
|
+
description: {
|
|
66
|
+
component: `
|
|
67
|
+
### NotificationStepsCard
|
|
68
|
+
|
|
69
|
+
Componente de **notificação com múltiplas etapas** para exibir conteúdos sequenciais (texto, PDF, vídeo).
|
|
70
|
+
|
|
71
|
+
- \`title\`: título da notificação
|
|
72
|
+
- \`description\`: descrição (aceita \`string\` ou \`ReactNode\`)
|
|
73
|
+
- \`steps\`: lista de etapas, cada uma com \`type\` (\`pdf\` | \`video\` | \`text\`), \`title\`, \`subtitle\`, \`disabled\` e \`onPress\`
|
|
74
|
+
- \`warningMessage\`: mensagem de aviso opcional no rodapé
|
|
75
|
+
|
|
76
|
+
> Etapas com \`disabled: true\` ficam em cinza e não disparam \`onPress\`. A ordem de conclusão é controlada por quem consome o componente.
|
|
77
|
+
`,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export default meta;
|
|
84
|
+
|
|
85
|
+
type Story = StoryObj<typeof NotificationStepsCard>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* STORIES
|
|
89
|
+
*/
|
|
90
|
+
export const NotificationStepsCardDefault: Story = {
|
|
91
|
+
name: "notification-steps-card-default",
|
|
92
|
+
args: {
|
|
93
|
+
title: "Campanha Zero Acidente",
|
|
94
|
+
description:
|
|
95
|
+
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and",
|
|
96
|
+
steps: [
|
|
97
|
+
{
|
|
98
|
+
type: "pdf",
|
|
99
|
+
title: "1. Instrução de segurança",
|
|
100
|
+
subtitle: "PDF . toque para ler",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
type: "video",
|
|
104
|
+
title: "2. Vídeo de treinamento",
|
|
105
|
+
subtitle: "Abre em tela cheia . 02:00",
|
|
106
|
+
disabled: true,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: "pdf",
|
|
110
|
+
title: "3. Termo de responsabilidade",
|
|
111
|
+
subtitle: "PDF . toque para ler",
|
|
112
|
+
disabled: true,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
warningMessage:
|
|
116
|
+
"As etapas devem ser concluídas em ordem. O vídeo não pode ser pulado.",
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const NotificationStepsCardAllUnlocked: Story = {
|
|
121
|
+
name: "notification-steps-card-all-unlocked",
|
|
122
|
+
args: {
|
|
123
|
+
title: "Campanha Zero Acidente",
|
|
124
|
+
description:
|
|
125
|
+
"Todas as etapas liberadas para conclusão em qualquer ordem.",
|
|
126
|
+
steps: [
|
|
127
|
+
{
|
|
128
|
+
type: "pdf",
|
|
129
|
+
title: "1. Instrução de segurança",
|
|
130
|
+
subtitle: "PDF . toque para ler",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
type: "video",
|
|
134
|
+
title: "2. Vídeo de treinamento",
|
|
135
|
+
subtitle: "Abre em tela cheia . 02:00",
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
type: "pdf",
|
|
139
|
+
title: "3. Termo de responsabilidade",
|
|
140
|
+
subtitle: "PDF . toque para ler",
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
};
|