react-native-exp-fig 0.1.37 → 0.1.39
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/components/modal-create-activitie/index.js +13 -11
- package/lib/commonjs/components/modal-create-activitie/index.js.map +1 -1
- package/lib/commonjs/components/modal-create-activitie/interface.js.map +1 -1
- package/lib/commonjs/components/modal-journey-rectification/index.js +10 -10
- package/lib/commonjs/components/modal-journey-rectification/index.js.map +1 -1
- package/lib/commonjs/components/modals/modal-activities/data-activities/index.js +25 -1
- package/lib/commonjs/components/modals/modal-activities/data-activities/index.js.map +1 -1
- package/lib/commonjs/components/modals/modal-activity-reason/index.js +6 -5
- package/lib/commonjs/components/modals/modal-activity-reason/index.js.map +1 -1
- package/lib/commonjs/components/modals/modal-activity-reason/interface.d.js.map +1 -1
- package/lib/commonjs/components/modals/modal-change-activity/index.js.map +1 -1
- package/lib/commonjs/components/selects/select-option/index.js +4 -4
- package/lib/commonjs/components/selects/select-option/index.js.map +1 -1
- package/lib/commonjs/components/selects/select-option/interface.d.js.map +1 -1
- package/lib/commonjs/stories/modal-activity-reason/modal-activity-reason.stories.js +8 -8
- package/lib/commonjs/stories/modal-activity-reason/modal-activity-reason.stories.js.map +1 -1
- package/lib/commonjs/stories/modal-create-activitie/modal-create-activitie.stories.js +5 -1
- package/lib/commonjs/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -1
- package/lib/module/components/modal-create-activitie/index.js +13 -11
- package/lib/module/components/modal-create-activitie/index.js.map +1 -1
- package/lib/module/components/modal-create-activitie/interface.js.map +1 -1
- package/lib/module/components/modal-journey-rectification/index.js +10 -10
- package/lib/module/components/modal-journey-rectification/index.js.map +1 -1
- package/lib/module/components/modals/modal-activities/data-activities/index.js +24 -0
- package/lib/module/components/modals/modal-activities/data-activities/index.js.map +1 -1
- package/lib/module/components/modals/modal-activity-reason/index.js +6 -5
- package/lib/module/components/modals/modal-activity-reason/index.js.map +1 -1
- package/lib/module/components/modals/modal-activity-reason/interface.d.js.map +1 -1
- package/lib/module/components/modals/modal-change-activity/index.js.map +1 -1
- package/lib/module/components/selects/select-option/index.js +4 -4
- package/lib/module/components/selects/select-option/index.js.map +1 -1
- package/lib/module/components/selects/select-option/interface.d.js.map +1 -1
- package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js +8 -8
- package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js.map +1 -1
- package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js +5 -1
- package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -1
- package/lib/typescript/src/components/modals/modal-activities/data-activities/index.d.ts +7 -0
- package/package.json +4 -8
- package/src/components/modal-create-activitie/index.tsx +215 -211
- package/src/components/modal-create-activitie/interface.ts +22 -22
- package/src/components/modal-journey-rectification/index.tsx +213 -211
- package/src/components/modals/modal-activities/data-activities/index.ts +31 -0
- package/src/components/modals/modal-activity-reason/index.tsx +163 -162
- package/src/components/modals/modal-activity-reason/interface.d.ts +10 -10
- package/src/components/modals/modal-change-activity/index.tsx +1 -1
- package/src/components/selects/select-option/index.tsx +124 -124
- package/src/components/selects/select-option/interface.d.ts +18 -18
- package/src/stories/modal-activity-reason/modal-activity-reason.stories.tsx +192 -192
- package/src/stories/modal-create-activitie/modal-create-activitie.stories.tsx +4 -0
|
@@ -1,211 +1,215 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IMPORTS
|
|
3
|
-
*/
|
|
4
|
-
import React, { useMemo, useState, useCallback } from "react";
|
|
5
|
-
import { Modal, View, Pressable } from "react-native";
|
|
6
|
-
|
|
7
|
-
// components
|
|
8
|
-
import Box from "
|
|
9
|
-
import { Button }from "../button";
|
|
10
|
-
|
|
11
|
-
import { Typography } from "../typography";
|
|
12
|
-
|
|
13
|
-
import ActivityFields from "../selects/select-date-and-hours";
|
|
14
|
-
|
|
15
|
-
import SelectOption from "../selects/select-option";
|
|
16
|
-
|
|
17
|
-
// commons
|
|
18
|
-
import { Icons } from "../../common/icons-svg";
|
|
19
|
-
import { asBaseComponent } from "../../@types/as-base-component";
|
|
20
|
-
|
|
21
|
-
// helpers
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
//
|
|
28
|
-
import {
|
|
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
|
-
const
|
|
56
|
-
|
|
57
|
-
}, [
|
|
58
|
-
|
|
59
|
-
const
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import React, { useMemo, useState, useCallback } from "react";
|
|
5
|
+
import { Modal, View, Pressable } from "react-native";
|
|
6
|
+
|
|
7
|
+
// components
|
|
8
|
+
import Box from "../box";
|
|
9
|
+
import { Button } from "../button";
|
|
10
|
+
|
|
11
|
+
import { Typography } from "../typography";
|
|
12
|
+
|
|
13
|
+
import ActivityFields from "../selects/select-date-and-hours";
|
|
14
|
+
|
|
15
|
+
import SelectOption from "../selects/select-option";
|
|
16
|
+
|
|
17
|
+
// commons
|
|
18
|
+
import { Icons } from "../../common/icons-svg";
|
|
19
|
+
import { asBaseComponent } from "../../@types/as-base-component";
|
|
20
|
+
|
|
21
|
+
// helpers
|
|
22
|
+
import { retificacaoActivities } from "../modals/modal-activities/data-activities";
|
|
23
|
+
|
|
24
|
+
// utils
|
|
25
|
+
import { formatDate, formHoursMinute } from "../../utils/format-data";
|
|
26
|
+
|
|
27
|
+
// typings
|
|
28
|
+
import type { IDateAndHoursProps, IModalCreateActivitieProps } from "./interface";
|
|
29
|
+
|
|
30
|
+
// styles / theme
|
|
31
|
+
import { theme } from "../../styles/theme/theme";
|
|
32
|
+
import { styles } from "./styles";
|
|
33
|
+
|
|
34
|
+
const ModalCreteActivitie: React.FC<IModalCreateActivitieProps<any>> = React.memo(
|
|
35
|
+
({ visible, onClose, onPressConfirm, textTitle }) => {
|
|
36
|
+
const [dateAndHours, setDateAndHours] = useState<IDateAndHoursProps>({
|
|
37
|
+
date: formatDate(new Date()),
|
|
38
|
+
hours: formHoursMinute(String(new Date().getHours() * 3600 + new Date().getMinutes() * 60)),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// estados controlados mínimos
|
|
42
|
+
const [selectedActivitie, setSelectedActivitie] = useState<number | null>(
|
|
43
|
+
retificacaoActivities[0]?.value ?? null
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// label do motivo derivada com memo
|
|
47
|
+
const activitieLabel = useMemo(
|
|
48
|
+
() =>
|
|
49
|
+
retificacaoActivities?.find((activitie) => activitie?.value === selectedActivitie)?.label ??
|
|
50
|
+
null,
|
|
51
|
+
[selectedActivitie]
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// handlers estáveis
|
|
55
|
+
const handleChangeReason = useCallback((value: number | null) => {
|
|
56
|
+
setSelectedActivitie(value);
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
const handleCancel = useCallback(() => {
|
|
60
|
+
onClose?.();
|
|
61
|
+
}, [onClose]);
|
|
62
|
+
|
|
63
|
+
const handleConfirm = useCallback(() => {
|
|
64
|
+
onPressConfirm?.({
|
|
65
|
+
value: selectedActivitie,
|
|
66
|
+
label: activitieLabel,
|
|
67
|
+
dateAndHours: dateAndHours,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
onClose?.();
|
|
71
|
+
}, [onPressConfirm, onClose, activitieLabel, selectedActivitie, dateAndHours]);
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<Modal
|
|
75
|
+
animationType="fade"
|
|
76
|
+
transparent
|
|
77
|
+
visible={visible}
|
|
78
|
+
onRequestClose={handleCancel}
|
|
79
|
+
statusBarTranslucent
|
|
80
|
+
>
|
|
81
|
+
<Pressable style={styles.overlay} onPress={handleCancel}>
|
|
82
|
+
<Box
|
|
83
|
+
width="90%"
|
|
84
|
+
backgroundColor={theme.colors.orange[500]}
|
|
85
|
+
borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
|
|
86
|
+
paddingStyle={{
|
|
87
|
+
paddingLeft: theme.paddings["2xs"],
|
|
88
|
+
paddingRight: theme.paddings["2xs"],
|
|
89
|
+
paddingTop: theme.paddings.sm,
|
|
90
|
+
paddingBottom: theme.paddings.sm,
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
<View style={styles.headerRow}>
|
|
94
|
+
<Icons
|
|
95
|
+
icon="EXCLAMATION_TRIANGLE"
|
|
96
|
+
color={theme.colors.orange[500]}
|
|
97
|
+
background={theme.colors.neutral[300]}
|
|
98
|
+
size={22}
|
|
99
|
+
/>
|
|
100
|
+
<Typography
|
|
101
|
+
text={textTitle ?? "Incluir atividade"}
|
|
102
|
+
color={theme.colors.neutral[25]}
|
|
103
|
+
marginLeft={theme.margins["2xs"]}
|
|
104
|
+
fontFamily={theme.fonts.inter_bold}
|
|
105
|
+
fontWeight="700"
|
|
106
|
+
size={theme.fontSizes.lg}
|
|
107
|
+
/>
|
|
108
|
+
</View>
|
|
109
|
+
|
|
110
|
+
<Box
|
|
111
|
+
backgroundColor={theme.colors.neutral[300]}
|
|
112
|
+
paddingStyle={{ padding: theme.paddings.xs }}
|
|
113
|
+
borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
|
|
114
|
+
>
|
|
115
|
+
<Typography
|
|
116
|
+
text="Preencha os dados da atividade que deseja incluir."
|
|
117
|
+
color={theme.colors.black[100]}
|
|
118
|
+
fontFamily={theme.fonts.inter_regular_400}
|
|
119
|
+
fontWeight="400"
|
|
120
|
+
lineHeight={theme.lineHeight["2xl"]}
|
|
121
|
+
size={theme.fontSizes.sm}
|
|
122
|
+
marginBottom={16}
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
<SelectOption
|
|
126
|
+
titleLabel="Selecione um motivo"
|
|
127
|
+
sizeTitleLabel={18}
|
|
128
|
+
dataOption={retificacaoActivities as any}
|
|
129
|
+
handleSelectDown={handleChangeReason}
|
|
130
|
+
backgroundColor={theme.colors.neutral[300]}
|
|
131
|
+
/>
|
|
132
|
+
|
|
133
|
+
<ActivityFields
|
|
134
|
+
disabled={false}
|
|
135
|
+
icon={"CALENDAR"}
|
|
136
|
+
value={dateAndHours?.date}
|
|
137
|
+
onPressConfirm={(value) =>
|
|
138
|
+
setDateAndHours({ date: value, hours: dateAndHours?.hours })
|
|
139
|
+
}
|
|
140
|
+
/>
|
|
141
|
+
|
|
142
|
+
<ActivityFields
|
|
143
|
+
disabled={false}
|
|
144
|
+
icon={"TIMER"}
|
|
145
|
+
value={dateAndHours?.hours}
|
|
146
|
+
onPressConfirm={(value) =>
|
|
147
|
+
setDateAndHours({ date: dateAndHours?.date, hours: value })
|
|
148
|
+
}
|
|
149
|
+
/>
|
|
150
|
+
|
|
151
|
+
<View style={styles.actions}>
|
|
152
|
+
<Button
|
|
153
|
+
title="CANCELAR"
|
|
154
|
+
onPress={handleCancel}
|
|
155
|
+
width="48%"
|
|
156
|
+
height={40}
|
|
157
|
+
isLoading={false}
|
|
158
|
+
disabled={false}
|
|
159
|
+
backgroundColor={theme.colors.neutral[300]}
|
|
160
|
+
buttonTextStyle={{
|
|
161
|
+
color: theme.colors.blue[500],
|
|
162
|
+
fontFamily: theme.fonts.inter_medium_500,
|
|
163
|
+
fontSize: theme.fontSizes.xs,
|
|
164
|
+
fontWeight: "500",
|
|
165
|
+
}}
|
|
166
|
+
flexStyle={{
|
|
167
|
+
flexDirection: "row",
|
|
168
|
+
alignItems: "center",
|
|
169
|
+
justifyContent: "center",
|
|
170
|
+
textAlign: "center",
|
|
171
|
+
}}
|
|
172
|
+
borderStyled={{
|
|
173
|
+
borderWidth: theme.borderWidths.thin,
|
|
174
|
+
borderColor: theme.colors.blue[100],
|
|
175
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
176
|
+
}}
|
|
177
|
+
/>
|
|
178
|
+
|
|
179
|
+
<Button
|
|
180
|
+
title="CONFIRMAR"
|
|
181
|
+
onPress={handleConfirm}
|
|
182
|
+
width="48%"
|
|
183
|
+
height={40}
|
|
184
|
+
isLoading={false}
|
|
185
|
+
disabled={false}
|
|
186
|
+
backgroundColor={theme.colors.blue[500]}
|
|
187
|
+
buttonTextStyle={{
|
|
188
|
+
color: theme.colors.neutral[25],
|
|
189
|
+
fontFamily: theme.fonts.inter_medium_500,
|
|
190
|
+
fontSize: theme.fontSizes.xs,
|
|
191
|
+
fontWeight: "500",
|
|
192
|
+
}}
|
|
193
|
+
flexStyle={{
|
|
194
|
+
flexDirection: "row",
|
|
195
|
+
alignItems: "center",
|
|
196
|
+
justifyContent: "center",
|
|
197
|
+
textAlign: "center",
|
|
198
|
+
}}
|
|
199
|
+
borderStyled={{
|
|
200
|
+
borderWidth: theme.borderWidths.thin,
|
|
201
|
+
borderColor: theme.colors.blue[100],
|
|
202
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
203
|
+
}}
|
|
204
|
+
/>
|
|
205
|
+
</View>
|
|
206
|
+
</Box>
|
|
207
|
+
</Box>
|
|
208
|
+
</Pressable>
|
|
209
|
+
</Modal>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
ModalCreteActivitie.displayName = "ModalCreteActivitie";
|
|
215
|
+
export default asBaseComponent(ModalCreteActivitie);
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/* eslint-disable no-unused-vars */
|
|
2
|
-
/**
|
|
3
|
-
* IMPORTS
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
type IModalCreateActivitieProps<T> = {
|
|
7
|
-
visible: boolean;
|
|
8
|
-
textTitle?: string;
|
|
9
|
-
options?: T;
|
|
10
|
-
onClose: () => void;
|
|
11
|
-
onPressConfirm: (value: T) => void;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
type IDateAndHoursProps = {
|
|
15
|
-
date: string;
|
|
16
|
-
hours: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* EXPORTS
|
|
21
|
-
*/
|
|
22
|
-
export type { IModalCreateActivitieProps, IDateAndHoursProps };
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
|
2
|
+
/**
|
|
3
|
+
* IMPORTS
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
type IModalCreateActivitieProps<T> = {
|
|
7
|
+
visible: boolean;
|
|
8
|
+
textTitle?: string;
|
|
9
|
+
options?: T;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onPressConfirm: (value: T) => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type IDateAndHoursProps = {
|
|
15
|
+
date: string;
|
|
16
|
+
hours: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* EXPORTS
|
|
21
|
+
*/
|
|
22
|
+
export type { IModalCreateActivitieProps, IDateAndHoursProps };
|