@coorpacademy/components 10.30.4-alpha.2 → 10.30.7
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/es/atom/choice/index.native.js +2 -4
- package/es/atom/choice/index.native.js.map +1 -1
- package/es/atom/html/index.native.js +1 -3
- package/es/atom/html/index.native.js.map +1 -1
- package/es/atom/review-presentation/index.native.js +56 -60
- package/es/atom/review-presentation/index.native.js.map +1 -1
- package/es/hoc/modal/select/index.native.js +3 -3
- package/es/hoc/modal/select/index.native.js.map +1 -1
- package/es/hoc/modal/select-item/index.native.js +13 -17
- package/es/hoc/modal/select-item/index.native.js.map +1 -1
- package/es/hoc/touchable/index.native.js +2 -2
- package/es/hoc/touchable/index.native.js.map +1 -1
- package/es/molecule/dashboard/cards-list/index.js +3 -7
- package/es/molecule/dashboard/cards-list/index.js.map +1 -1
- package/es/molecule/questions/free-text/index.native.js +26 -30
- package/es/molecule/questions/free-text/index.native.js.map +1 -1
- package/es/molecule/questions/mobile/slider/index.native.js +3 -5
- package/es/molecule/questions/mobile/slider/index.native.js.map +1 -1
- package/es/molecule/questions/mobile/template/index.native.js +1 -3
- package/es/molecule/questions/mobile/template/index.native.js.map +1 -1
- package/es/organism/review-congrats/index.js +1 -3
- package/es/organism/review-congrats/index.js.map +1 -1
- package/es/organism/review-slide/index.d.ts.map +1 -1
- package/es/organism/review-slide/index.js +6 -2
- package/es/organism/review-slide/index.js.map +1 -1
- package/es/organism/review-slide/index.native.d.ts.map +1 -1
- package/es/organism/review-slide/index.native.js +116 -79
- package/es/organism/review-slide/index.native.js.map +1 -1
- package/es/organism/review-slide/prop-types.d.ts +11 -0
- package/es/organism/review-slide/prop-types.d.ts.map +1 -1
- package/es/organism/review-slide/prop-types.js.map +1 -1
- package/es/template/app-player/popin-correction/style.css +1 -0
- package/es/template/common/dashboard/index.d.ts +0 -1
- package/es/template/common/dashboard/index.d.ts.map +1 -1
- package/es/template/common/dashboard/index.js +3 -26
- package/es/template/common/dashboard/index.js.map +1 -1
- package/lib/atom/choice/index.native.js +2 -4
- package/lib/atom/choice/index.native.js.map +1 -1
- package/lib/atom/html/index.native.js +1 -3
- package/lib/atom/html/index.native.js.map +1 -1
- package/lib/atom/review-presentation/index.native.js +56 -60
- package/lib/atom/review-presentation/index.native.js.map +1 -1
- package/lib/hoc/modal/select/index.native.js +3 -3
- package/lib/hoc/modal/select/index.native.js.map +1 -1
- package/lib/hoc/modal/select-item/index.native.js +13 -17
- package/lib/hoc/modal/select-item/index.native.js.map +1 -1
- package/lib/hoc/touchable/index.native.js +2 -2
- package/lib/hoc/touchable/index.native.js.map +1 -1
- package/lib/molecule/dashboard/cards-list/index.js +3 -7
- package/lib/molecule/dashboard/cards-list/index.js.map +1 -1
- package/lib/molecule/questions/free-text/index.native.js +26 -30
- package/lib/molecule/questions/free-text/index.native.js.map +1 -1
- package/lib/molecule/questions/mobile/slider/index.native.js +3 -5
- package/lib/molecule/questions/mobile/slider/index.native.js.map +1 -1
- package/lib/molecule/questions/mobile/template/index.native.js +1 -3
- package/lib/molecule/questions/mobile/template/index.native.js.map +1 -1
- package/lib/organism/review-congrats/index.js +1 -3
- package/lib/organism/review-congrats/index.js.map +1 -1
- package/lib/organism/review-slide/index.d.ts.map +1 -1
- package/lib/organism/review-slide/index.js +6 -2
- package/lib/organism/review-slide/index.js.map +1 -1
- package/lib/organism/review-slide/index.native.d.ts.map +1 -1
- package/lib/organism/review-slide/index.native.js +115 -78
- package/lib/organism/review-slide/index.native.js.map +1 -1
- package/lib/organism/review-slide/prop-types.d.ts +11 -0
- package/lib/organism/review-slide/prop-types.d.ts.map +1 -1
- package/lib/organism/review-slide/prop-types.js.map +1 -1
- package/lib/template/app-player/popin-correction/style.css +1 -0
- package/lib/template/common/dashboard/index.d.ts +0 -1
- package/lib/template/common/dashboard/index.d.ts.map +1 -1
- package/lib/template/common/dashboard/index.js +3 -30
- package/lib/template/common/dashboard/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React, { useCallback, useEffect, useState, useRef } from 'react';
|
|
4
|
+
import { Animated, Easing, StyleSheet, useWindowDimensions, View } from 'react-native';
|
|
3
5
|
import get from 'lodash/fp/get';
|
|
4
6
|
import getOr from 'lodash/fp/getOr';
|
|
5
7
|
import Text from '../../atom/text/index.native';
|
|
@@ -17,8 +19,25 @@ const styles = StyleSheet.create({
|
|
|
17
19
|
|
|
18
20
|
const CorrectionPopin = ({
|
|
19
21
|
correctionPopinProps,
|
|
20
|
-
slideIndex
|
|
22
|
+
slideIndex,
|
|
23
|
+
showCorrectionPopin,
|
|
24
|
+
animateCorrectionPopin
|
|
21
25
|
}) => {
|
|
26
|
+
const translateAnim = useRef(new Animated.Value(1000)).current;
|
|
27
|
+
const translateYAnim = useCallback(() => {
|
|
28
|
+
Animated.timing(translateAnim, {
|
|
29
|
+
toValue: 0,
|
|
30
|
+
duration: 800,
|
|
31
|
+
easing: Easing.bezier(0.37, 0, 0.63, 1),
|
|
32
|
+
useNativeDriver: true
|
|
33
|
+
}).start();
|
|
34
|
+
}, [translateAnim]);
|
|
35
|
+
|
|
36
|
+
if (animateCorrectionPopin) {
|
|
37
|
+
translateYAnim();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!showCorrectionPopin) return null;
|
|
22
41
|
const klf = getOr(undefined, 'klf', correctionPopinProps);
|
|
23
42
|
const information = getOr({
|
|
24
43
|
label: '',
|
|
@@ -38,78 +57,96 @@ const CorrectionPopin = ({
|
|
|
38
57
|
type: correctionPopinProps.type,
|
|
39
58
|
resultLabel: correctionPopinProps.resultLabel
|
|
40
59
|
};
|
|
41
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
42
|
-
style: styles.correctionPopinWrapper
|
|
60
|
+
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
61
|
+
style: _extends({}, styles.correctionPopinWrapper, {
|
|
62
|
+
transform: [{
|
|
63
|
+
translateY: translateAnim
|
|
64
|
+
}]
|
|
65
|
+
})
|
|
43
66
|
}, /*#__PURE__*/React.createElement(ReviewCorrectionPopin, _correctionPopinProps));
|
|
44
|
-
};
|
|
45
|
-
// const {label, onClick, disabled} = validateButton;
|
|
46
|
-
// const validateButtonProps = {
|
|
47
|
-
// type: 'primary',
|
|
48
|
-
// label,
|
|
49
|
-
// 'aria-label': label,
|
|
50
|
-
// 'data-name': `slide-validate-button-${slideIndex}`,
|
|
51
|
-
// onClick,
|
|
52
|
-
// disabled,
|
|
53
|
-
// customStyle: {
|
|
54
|
-
// backgroundColor: primarySkinColor
|
|
55
|
-
// }
|
|
56
|
-
// };
|
|
57
|
-
// return <Button title="validate todo" />;
|
|
58
|
-
// };
|
|
59
|
-
|
|
67
|
+
};
|
|
60
68
|
|
|
61
|
-
const
|
|
62
|
-
|
|
69
|
+
const createValidateButtonStyle = (theme, brandTheme) => StyleSheet.create({
|
|
70
|
+
validateButton: {
|
|
71
|
+
backgroundColor: brandTheme?.colors?.primary || theme.colors.text.primary,
|
|
72
|
+
borderRadius: 7,
|
|
73
|
+
width: '100%'
|
|
74
|
+
},
|
|
75
|
+
validateButtonText: {
|
|
76
|
+
fontSize: 14,
|
|
77
|
+
lineHeight: 20,
|
|
78
|
+
fontWeight: theme.fontWeight.bold,
|
|
79
|
+
color: theme.colors.white,
|
|
80
|
+
marginBottom: theme.spacing.small,
|
|
81
|
+
marginTop: theme.spacing.small,
|
|
82
|
+
textAlign: 'center'
|
|
83
|
+
}
|
|
84
|
+
});
|
|
63
85
|
|
|
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
|
-
flex: 1,
|
|
93
|
-
width: '100%',
|
|
94
|
-
justifyContent: 'center'
|
|
95
|
-
},
|
|
96
|
-
validateButton: {
|
|
97
|
-
backgroundColor: (brandTheme == null ? void 0 : (_brandTheme$colors = brandTheme.colors) == null ? void 0 : _brandTheme$colors.primary) || theme.colors.text.primary,
|
|
98
|
-
borderRadius: 7,
|
|
99
|
-
width: '100%'
|
|
100
|
-
},
|
|
101
|
-
validateButtonText: {
|
|
102
|
-
fontSize: 14,
|
|
103
|
-
lineHeight: 20,
|
|
104
|
-
fontWeight: '700',
|
|
105
|
-
color: theme.colors.white,
|
|
106
|
-
marginBottom: 16,
|
|
107
|
-
marginTop: 16,
|
|
108
|
-
textAlign: 'center'
|
|
109
|
-
}
|
|
110
|
-
});
|
|
86
|
+
const ValidateButton = ({
|
|
87
|
+
slideIndex,
|
|
88
|
+
validateButton
|
|
89
|
+
}) => {
|
|
90
|
+
const {
|
|
91
|
+
label,
|
|
92
|
+
onClick,
|
|
93
|
+
disabled
|
|
94
|
+
} = validateButton;
|
|
95
|
+
const {
|
|
96
|
+
theme,
|
|
97
|
+
brandTheme
|
|
98
|
+
} = useTemplateContext();
|
|
99
|
+
const [style, setStyle] = useState();
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
const buttonStyle = createValidateButtonStyle(theme, brandTheme);
|
|
102
|
+
setStyle(buttonStyle);
|
|
103
|
+
}, [theme, brandTheme]);
|
|
104
|
+
if (!style) return null;
|
|
105
|
+
return /*#__PURE__*/React.createElement(Touchable, {
|
|
106
|
+
style: style.validateButton,
|
|
107
|
+
onPress: onClick,
|
|
108
|
+
disabled: disabled,
|
|
109
|
+
accessibilityLabel: label,
|
|
110
|
+
testID: `slide-validate-button-${slideIndex}`
|
|
111
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
112
|
+
style: style.validateButtonText
|
|
113
|
+
}, label));
|
|
111
114
|
};
|
|
112
115
|
|
|
116
|
+
const createQuestionStyle = theme => StyleSheet.create({
|
|
117
|
+
questionHeading: {
|
|
118
|
+
justifyContent: 'space-between'
|
|
119
|
+
},
|
|
120
|
+
questionOrigin: {
|
|
121
|
+
fontSize: 12,
|
|
122
|
+
lineHeight: 16,
|
|
123
|
+
color: theme.colors.text.primary,
|
|
124
|
+
marginBottom: theme.spacing.tiny,
|
|
125
|
+
marginTop: theme.spacing.small,
|
|
126
|
+
textAlign: 'center'
|
|
127
|
+
},
|
|
128
|
+
questionText: {
|
|
129
|
+
fontSize: 16,
|
|
130
|
+
lineHeight: 22,
|
|
131
|
+
fontWeight: '700',
|
|
132
|
+
color: theme.colors.text.primary,
|
|
133
|
+
textAlign: 'center'
|
|
134
|
+
},
|
|
135
|
+
questionHelp: {
|
|
136
|
+
fontSize: 12,
|
|
137
|
+
lineHeight: 16,
|
|
138
|
+
color: theme.colors.gray.medium,
|
|
139
|
+
marginBottom: 0,
|
|
140
|
+
marginTop: theme.spacing.small,
|
|
141
|
+
textAlign: 'center'
|
|
142
|
+
},
|
|
143
|
+
choicesContainer: {
|
|
144
|
+
flex: 1,
|
|
145
|
+
width: '100%',
|
|
146
|
+
justifyContent: 'center'
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
113
150
|
const Question = props => {
|
|
114
151
|
const {
|
|
115
152
|
answerUI,
|
|
@@ -117,14 +154,13 @@ const Question = props => {
|
|
|
117
154
|
questionOrigin
|
|
118
155
|
} = props;
|
|
119
156
|
const {
|
|
120
|
-
theme
|
|
121
|
-
brandTheme
|
|
157
|
+
theme
|
|
122
158
|
} = useTemplateContext();
|
|
123
159
|
const [style, setStyle] = useState();
|
|
124
160
|
useEffect(() => {
|
|
125
|
-
const questionStyle = createQuestionStyle(theme
|
|
161
|
+
const questionStyle = createQuestionStyle(theme);
|
|
126
162
|
setStyle(questionStyle);
|
|
127
|
-
}, [theme
|
|
163
|
+
}, [theme]);
|
|
128
164
|
if (!answerUI || !questionText || !style) return null;
|
|
129
165
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
130
166
|
style: style.questionHeading
|
|
@@ -136,11 +172,7 @@ const Question = props => {
|
|
|
136
172
|
style: style.questionHelp
|
|
137
173
|
}, get('help', answerUI))), /*#__PURE__*/React.createElement(View, {
|
|
138
174
|
style: style.choicesContainer
|
|
139
|
-
}, /*#__PURE__*/React.createElement(Answer, answerUI))
|
|
140
|
-
style: style.validateButton
|
|
141
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
142
|
-
style: style.validateButtonText
|
|
143
|
-
}, "@todo validate")));
|
|
175
|
+
}, /*#__PURE__*/React.createElement(Answer, answerUI)));
|
|
144
176
|
};
|
|
145
177
|
|
|
146
178
|
const createSlideStyle = (num, screenWidth) => {
|
|
@@ -174,6 +206,7 @@ const Slide = props => {
|
|
|
174
206
|
const {
|
|
175
207
|
slide,
|
|
176
208
|
correctionPopinProps,
|
|
209
|
+
validateButton,
|
|
177
210
|
num,
|
|
178
211
|
slideIndex = '0'
|
|
179
212
|
} = props;
|
|
@@ -199,6 +232,10 @@ const Slide = props => {
|
|
|
199
232
|
questionText: questionText,
|
|
200
233
|
answerUI: answerUI,
|
|
201
234
|
key: "question-container"
|
|
235
|
+
}), /*#__PURE__*/React.createElement(ValidateButton, {
|
|
236
|
+
slideIndex: slideIndex,
|
|
237
|
+
validateButton: validateButton,
|
|
238
|
+
key: "validate-button"
|
|
202
239
|
}), correctionPopinProps ? /*#__PURE__*/React.createElement(CorrectionPopin, {
|
|
203
240
|
correctionPopinProps: correctionPopinProps,
|
|
204
241
|
slideIndex: slideIndex,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["React","useEffect","useState","StyleSheet","useWindowDimensions","View","get","getOr","Text","Answer","ReviewCorrectionPopin","useTemplateContext","Touchable","styles","create","correctionPopinWrapper","position","bottom","width","CorrectionPopin","correctionPopinProps","slideIndex","klf","undefined","information","label","message","next","onClick","_correctionPopinProps","type","resultLabel","createQuestionStyle","theme","brandTheme","questionHeading","justifyContent","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","marginTop","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesContainer","flex","validateButton","backgroundColor","borderRadius","validateButtonText","white","Question","props","answerUI","style","setStyle","questionStyle","createSlideStyle","num","screenWidth","slideWidth","slide","left","height","alignItems","padding","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","Slide","slideStyle","loading","parentContentTitle","showCorrectionPopin","animateCorrectionPopin"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {StyleSheet, TextStyle, useWindowDimensions, View, ViewStyle} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport Text from '../../atom/text/index.native';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Touchable from '../../hoc/touchable/index.native';\nimport {Brand} from '../../variables/brand.native';\nimport {ReviewCorrectionPopinProps} from '../../molecule/review-correction-popin/prop-types';\nimport {ReviewSlideProps, SlideProps} from './prop-types';\n\ntype PopinProps = {\n correctionPopinProps: ReviewCorrectionPopinProps;\n slideIndex: unknown;\n showCorrectionPopin: unknown;\n animateCorrectionPopin: unknown;\n};\n\nconst styles = StyleSheet.create({\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst CorrectionPopin = ({correctionPopinProps, slideIndex}: PopinProps) => {\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n return (\n <View style={styles.correctionPopinWrapper}>\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </View>\n );\n};\n\n// const ValidateButton = ({slideIndex, validateButton, primarySkinColor}) => {\n// const {label, onClick, disabled} = validateButton;\n// const validateButtonProps = {\n// type: 'primary',\n// label,\n// 'aria-label': label,\n// 'data-name': `slide-validate-button-${slideIndex}`,\n// onClick,\n// disabled,\n// customStyle: {\n// backgroundColor: primarySkinColor\n// }\n// };\n\n// return <Button title=\"validate todo\" />;\n// };\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesContainer: ViewStyle;\n validateButton: ViewStyle;\n validateButtonText: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme, brandTheme: Brand): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesContainer: {\n flex: 1,\n width: '100%',\n justifyContent: 'center'\n },\n validateButton: {\n backgroundColor: brandTheme?.colors?.primary || theme.colors.text.primary,\n borderRadius: 7,\n width: '100%'\n },\n validateButtonText: {\n fontSize: 14,\n lineHeight: 20,\n fontWeight: '700',\n color: theme.colors.white,\n marginBottom: 16,\n marginTop: 16,\n textAlign: 'center'\n }\n });\n\ntype QuestionProps = {\n answerUI: SlideProps['answerUI'];\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {answerUI, questionText, questionOrigin} = props;\n const {theme, brandTheme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme, brandTheme);\n setStyle(questionStyle);\n }, [theme, brandTheme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n return (\n <>\n <View style={style.questionHeading}>\n <Text style={style.questionOrigin}>{questionOrigin}</Text>\n <Text style={style.questionText}>{questionText}</Text>\n <Text style={style.questionHelp}>{get('help', answerUI)}</Text>\n </View>\n <View style={style.choicesContainer}>\n <Answer {...answerUI} />\n </View>\n <Touchable style={style.validateButton}>\n <Text style={style.validateButtonText}>@todo validate</Text>\n </Touchable>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n};\n\nconst createSlideStyle = (num: number, screenWidth: number): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: 34 + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {slide, correctionPopinProps, num, slideIndex = '0'} = props;\n\n const {width} = useWindowDimensions();\n const slideStyle = createSlideStyle(num, width);\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n return (\n <View style={slideStyle.slide}>\n {loading ? (\n // <Loader className={style.loader} theme=\"default\" aria-label={loadingAriaLabel} />\n <Text>@todo loader {num}</Text>\n ) : (\n <>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n key=\"question-container\"\n />\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </>\n )}\n </View>\n );\n};\n\nexport default Slide;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,SAAf,EAA0BC,QAA1B,QAAyC,OAAzC;AACA,SAAQC,UAAR,EAA+BC,mBAA/B,EAAoDC,IAApD,QAA0E,cAA1E;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,IAAP,MAAiB,8BAAjB;AACA,OAAOC,MAAP,MAAmB,oCAAnB;AACA,OAAOC,qBAAP,MAAkC,qDAAlC;AACA,SAAQC,kBAAR,QAAiC,4CAAjC;AAEA,OAAOC,SAAP,MAAsB,kCAAtB;AAYA,MAAMC,MAAM,GAAGV,UAAU,CAACW,MAAX,CAAkB;EAC/BC,sBAAsB,EAAE;IACtBC,QAAQ,EAAE,UADY;IAEtBC,MAAM,EAAE,EAFc;IAGtBC,KAAK,EAAE;EAHe;AADO,CAAlB,CAAf;;AAQA,MAAMC,eAAe,GAAG,CAAC;EAACC,oBAAD;EAAuBC;AAAvB,CAAD,KAAoD;EAC1E,MAAMC,GAAG,GAAGf,KAAK,CAACgB,SAAD,EAAY,KAAZ,EAAmBH,oBAAnB,CAAjB;EACA,MAAMI,WAAW,GAAGjB,KAAK,CAAC;IAACkB,KAAK,EAAE,EAAR;IAAYC,OAAO,EAAE;EAArB,C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{"version":3,"file":"index.native.js","names":["React","useCallback","useEffect","useState","useRef","Animated","Easing","StyleSheet","useWindowDimensions","View","get","getOr","Text","Answer","ReviewCorrectionPopin","useTemplateContext","Touchable","styles","create","correctionPopinWrapper","position","bottom","width","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateAnim","Value","current","translateYAnim","timing","toValue","duration","easing","bezier","useNativeDriver","start","klf","undefined","information","label","message","next","onClick","_correctionPopinProps","type","resultLabel","transform","translateY","createValidateButtonStyle","theme","brandTheme","validateButton","backgroundColor","colors","primary","text","borderRadius","validateButtonText","fontSize","lineHeight","fontWeight","bold","color","white","marginBottom","spacing","small","marginTop","textAlign","ValidateButton","disabled","style","setStyle","buttonStyle","createQuestionStyle","questionHeading","justifyContent","questionOrigin","tiny","questionText","questionHelp","gray","medium","choicesContainer","flex","Question","props","answerUI","questionStyle","createSlideStyle","num","screenWidth","slideWidth","slide","left","height","alignItems","padding","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","Slide","slideStyle","loading","parentContentTitle"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useCallback, useEffect, useState, useRef} from 'react';\nimport {\n Animated,\n Easing,\n StyleSheet,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport Text from '../../atom/text/index.native';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Touchable from '../../hoc/touchable/index.native';\nimport {Brand} from '../../variables/brand.native';\nimport {PopinProps, ReviewSlideProps, SlideProps, ValidateButtonProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}: PopinProps) => {\n const translateAnim = useRef(new Animated.Value(1000)).current;\n\n const translateYAnim = useCallback(() => {\n Animated.timing(translateAnim, {\n toValue: 0,\n duration: 800,\n easing: Easing.bezier(0.37, 0, 0.63, 1),\n useNativeDriver: true\n }).start();\n }, [translateAnim]);\n\n if (animateCorrectionPopin) {\n translateYAnim();\n }\n\n if (!showCorrectionPopin) return null;\n\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n return (\n <Animated.View\n style={{\n ...styles.correctionPopinWrapper,\n transform: [\n {\n translateY: translateAnim\n }\n ]\n }}\n >\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </Animated.View>\n );\n};\n\ntype StyleValidateButtonType = {\n validateButton: ViewStyle;\n validateButtonText: ViewStyle;\n};\n\nconst createValidateButtonStyle = (theme: Theme, brandTheme: Brand): StyleValidateButtonType =>\n StyleSheet.create({\n validateButton: {\n backgroundColor: brandTheme?.colors?.primary || theme.colors.text.primary,\n borderRadius: 7,\n width: '100%'\n },\n validateButtonText: {\n fontSize: 14,\n lineHeight: 20,\n fontWeight: theme.fontWeight.bold,\n color: theme.colors.white,\n marginBottom: theme.spacing.small,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n }\n });\n\nconst ValidateButton = ({slideIndex, validateButton}: ValidateButtonProps) => {\n const {label, onClick, disabled} = validateButton;\n const {theme, brandTheme} = useTemplateContext();\n const [style, setStyle] = useState<StyleValidateButtonType>();\n\n useEffect(() => {\n const buttonStyle = createValidateButtonStyle(theme, brandTheme);\n setStyle(buttonStyle);\n }, [theme, brandTheme]);\n\n if (!style) return null;\n\n return (\n <Touchable\n style={style.validateButton}\n onPress={onClick}\n disabled={disabled}\n accessibilityLabel={label}\n testID={`slide-validate-button-${slideIndex}`}\n >\n <Text style={style.validateButtonText}>{label}</Text>\n </Touchable>\n );\n};\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesContainer: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesContainer: {\n flex: 1,\n width: '100%',\n justifyContent: 'center'\n }\n });\n\ntype QuestionProps = {\n answerUI: SlideProps['answerUI'];\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {answerUI, questionText, questionOrigin} = props;\n const {theme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme);\n setStyle(questionStyle);\n }, [theme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n return (\n <>\n <View style={style.questionHeading}>\n <Text style={style.questionOrigin}>{questionOrigin}</Text>\n <Text style={style.questionText}>{questionText}</Text>\n <Text style={style.questionHelp}>{get('help', answerUI)}</Text>\n </View>\n <View style={style.choicesContainer}>\n <Answer {...answerUI} />\n </View>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n};\n\nconst createSlideStyle = (num: number, screenWidth: number): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: 34 + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {slide, correctionPopinProps, validateButton, num, slideIndex = '0'} = props;\n\n const {width} = useWindowDimensions();\n const slideStyle = createSlideStyle(num, width);\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n return (\n <View style={slideStyle.slide}>\n {loading ? (\n // <Loader className={style.loader} theme=\"default\" aria-label={loadingAriaLabel} />\n <Text>@todo loader {num}</Text>\n ) : (\n <>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n key=\"question-container\"\n />\n <ValidateButton\n slideIndex={slideIndex}\n validateButton={validateButton}\n key=\"validate-button\"\n />\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </>\n )}\n </View>\n );\n};\n\nexport default Slide;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,SAA5B,EAAuCC,QAAvC,EAAiDC,MAAjD,QAA8D,OAA9D;AACA,SACEC,QADF,EAEEC,MAFF,EAGEC,UAHF,EAKEC,mBALF,EAMEC,IANF,QAQO,cARP;AASA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAA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,EAAnC;EACA,MAAMmG,UAAU,GAAGf,gBAAgB,CAACC,GAAD,EAAMvE,KAAN,CAAnC;EAEA,MAAM;IACJsF,OADI;IAEJC,kBAFI;IAGJ3B,YAHI;IAIJQ,QAJI;IAKJhE,mBALI;IAMJC;EANI,IAOFqE,KAPJ;EASA,oBACE,oBAAC,IAAD;IAAM,KAAK,EAAEW,UAAU,CAACX;EAAxB,GACGY,OAAO;EAAA;EACN;EACA,oBAAC,IAAD,yBAAoBf,GAApB,CAFM,gBAIN,uDACE,oBAAC,QAAD;IACE,cAAc,EAAEgB,kBADlB;IAEE,YAAY,EAAE3B,YAFhB;IAGE,QAAQ,EAAEQ,QAHZ;IAIE,GAAG,EAAC;EAJN,EADF,eAOE,oBAAC,cAAD;IACE,UAAU,EAAEjE,UADd;IAEE,cAAc,EAAE6B,cAFlB;IAGE,GAAG,EAAC;EAHN,EAPF,EAYG9B,oBAAoB,gBACnB,oBAAC,eAAD;IACE,oBAAoB,EAAEA,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EADmB,GAQjB,IApBN,CALJ,CADF;AA+BD,CA9CD;;AAgDA,eAAe+E,KAAf"}
|
|
@@ -176,6 +176,17 @@ declare const propTypes: {
|
|
|
176
176
|
}>>;
|
|
177
177
|
};
|
|
178
178
|
export default propTypes;
|
|
179
|
+
export declare type PopinProps = {
|
|
180
|
+
correctionPopinProps: ReviewCorrectionPopinProps;
|
|
181
|
+
slideIndex: string;
|
|
182
|
+
showCorrectionPopin?: boolean;
|
|
183
|
+
animateCorrectionPopin?: boolean;
|
|
184
|
+
};
|
|
185
|
+
export declare type ValidateButtonProps = {
|
|
186
|
+
slideIndex: string;
|
|
187
|
+
validateButton: ReviewSlideProps['validateButton'];
|
|
188
|
+
primarySkinColor?: string;
|
|
189
|
+
};
|
|
179
190
|
export declare type SlideProps = {
|
|
180
191
|
position: number;
|
|
181
192
|
loading: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAuC,EACrC,0BAA0B,EAC3B,MAAM,mDAAmD,CAAC;AAC3D,OAAwB,EAAC,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAE9E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAY1B,CAAC;AAEH,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmBd,CAAC;AAEF,eAAe,SAAS,CAAC;AAEzB,oBAAY,UAAU,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,WAAW,CAAC;CACxB,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,UAAU,CAAC;IAClB,oBAAoB,CAAC,EAAE,0BAA0B,CAAC;IAClD,cAAc,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM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AO,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,WAAW,CAAC;CACxB,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,UAAU,CAAC;IAClB,oBAAoB,CAAC,EAAE,0BAA0B,CAAC;IAClD,cAAc,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,IAAI,CAAC;QACpB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.js","names":["PropTypes","ReviewCorrectionPopinPropTypes","AnswerPropTypes","SlidePropsTypes","shape","position","number","loading","bool","loadingAriaLabel","string","animationType","isCorrect","animateCorrectionPopin","showCorrectionPopin","disableContent","parentContentTitle","questionText","answerUI","propTypes","slideIndex","slide","validateButton","label","isRequired","onClick","func","disabled","correctionPopinProps","klf","information","next","resultLabel","type"],"sources":["../../../src/organism/review-slide/prop-types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport ReviewCorrectionPopinPropTypes, {\n ReviewCorrectionPopinProps\n} from '../../molecule/review-correction-popin/prop-types';\nimport AnswerPropTypes, {AnswerProps} from '../../molecule/answer/prop-types';\n\nexport const SlidePropsTypes = PropTypes.shape({\n position: PropTypes.number,\n loading: PropTypes.bool,\n loadingAriaLabel: PropTypes.string,\n animationType: PropTypes.string, // 'unstack' | 'restack'\n isCorrect: PropTypes.bool,\n animateCorrectionPopin: PropTypes.bool,\n showCorrectionPopin: PropTypes.bool,\n disableContent: PropTypes.bool,\n parentContentTitle: PropTypes.string,\n questionText: PropTypes.string,\n answerUI: PropTypes.shape(AnswerPropTypes)\n});\n\nconst propTypes = {\n slideIndex: PropTypes.string,\n slide: SlidePropsTypes,\n validateButton: PropTypes.shape({\n label: PropTypes.string.isRequired,\n onClick: PropTypes.func.isRequired,\n disabled: PropTypes.bool\n }),\n correctionPopinProps: PropTypes.shape({\n klf: ReviewCorrectionPopinPropTypes.klf,\n information: ReviewCorrectionPopinPropTypes.information,\n next: PropTypes.shape({\n label: PropTypes.string,\n 'aria-label': PropTypes.string // Pourquoi le onClick du next n'est pas ici !\n // updateSlidesOnNext: PropTypes.func.isRequired ???\n }),\n resultLabel: ReviewCorrectionPopinPropTypes.resultLabel,\n type: ReviewCorrectionPopinPropTypes.type\n })\n};\n\nexport default propTypes;\n\nexport type SlideProps = {\n position: number;\n loading: boolean;\n loadingAriaLabel?: string;\n animationType?: 'unstack' | 'restack';\n isCorrect?: boolean;\n animateCorrectionPopin?: boolean;\n showCorrectionPopin?: boolean;\n parentContentTitle?: string;\n questionText?: string;\n answerUI?: AnswerProps;\n};\n\nexport type ReviewSlideProps = {\n slideIndex: string;\n num: number;\n slide: SlideProps;\n correctionPopinProps?: ReviewCorrectionPopinProps;\n validateButton: {\n label: string;\n onClick: () => void;\n disabled: boolean;\n };\n};\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,8BAAP,MAEO,mDAFP;AAGA,OAAOC,eAAP,MAA2C,kCAA3C;AAEA,OAAO,MAAMC,eAAe,GAAGH,SAAS,CAACI,KAAV,CAAgB;EAC7CC,QAAQ,EAAEL,SAAS,CAACM,MADyB;EAE7CC,OAAO,EAAEP,SAAS,CAACQ,IAF0B;EAG7CC,gBAAgB,EAAET,SAAS,CAACU,MAHiB;EAI7CC,aAAa,EAAEX,SAAS,CAACU,MAJoB;EAIZ;EACjCE,SAAS,EAAEZ,SAAS,CAACQ,IALwB;EAM7CK,sBAAsB,EAAEb,SAAS,CAACQ,IANW;EAO7CM,mBAAmB,EAAEd,SAAS,CAACQ,IAPc;EAQ7CO,cAAc,EAAEf,SAAS,CAACQ,IARmB;EAS7CQ,kBAAkB,EAAEhB,SAAS,CAACU,MATe;EAU7CO,YAAY,EAAEjB,SAAS,CAACU,MAVqB;EAW7CQ,QAAQ,EAAElB,SAAS,CAACI,KAAV,CAAgBF,eAAhB;AAXmC,CAAhB,CAAxB;AAcP,MAAMiB,SAAS,GAAG;EAChBC,UAAU,EAAEpB,SAAS,CAACU,MADN;EAEhBW,KAAK,EAAElB,eAFS;EAGhBmB,cAAc,EAAEtB,SAAS,CAACI,KAAV,CAAgB;IAC9BmB,KAAK,EAAEvB,SAAS,CAACU,MAAV,CAAiBc,UADM;IAE9BC,OAAO,EAAEzB,SAAS,CAAC0B,IAAV,CAAeF,UAFM;IAG9BG,QAAQ,EAAE3B,SAAS,CAACQ;EAHU,CAAhB,CAHA;EAQhBoB,oBAAoB,EAAE5B,SAAS,CAACI,KAAV,CAAgB;IACpCyB,GAAG,EAAE5B,8BAA8B,CAAC4B,GADA;IAEpCC,WAAW,EAAE7B,8BAA8B,CAAC6B,WAFR;IAGpCC,IAAI,EAAE/B,SAAS,CAACI,KAAV,CAAgB;MACpBmB,KAAK,EAAEvB,SAAS,CAACU,MADG;MAEpB,cAAcV,SAAS,CAACU,MAFJ,CAEW;MAC/B;;IAHoB,CAAhB,CAH8B;IAQpCsB,WAAW,EAAE/B,8BAA8B,CAAC+B,WARR;IASpCC,IAAI,EAAEhC,8BAA8B,CAACgC;EATD,CAAhB;AARN,CAAlB;AAqBA,eAAed,SAAf"}
|
|
1
|
+
{"version":3,"file":"prop-types.js","names":["PropTypes","ReviewCorrectionPopinPropTypes","AnswerPropTypes","SlidePropsTypes","shape","position","number","loading","bool","loadingAriaLabel","string","animationType","isCorrect","animateCorrectionPopin","showCorrectionPopin","disableContent","parentContentTitle","questionText","answerUI","propTypes","slideIndex","slide","validateButton","label","isRequired","onClick","func","disabled","correctionPopinProps","klf","information","next","resultLabel","type"],"sources":["../../../src/organism/review-slide/prop-types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport ReviewCorrectionPopinPropTypes, {\n ReviewCorrectionPopinProps\n} from '../../molecule/review-correction-popin/prop-types';\nimport AnswerPropTypes, {AnswerProps} from '../../molecule/answer/prop-types';\n\nexport const SlidePropsTypes = PropTypes.shape({\n position: PropTypes.number,\n loading: PropTypes.bool,\n loadingAriaLabel: PropTypes.string,\n animationType: PropTypes.string, // 'unstack' | 'restack'\n isCorrect: PropTypes.bool,\n animateCorrectionPopin: PropTypes.bool,\n showCorrectionPopin: PropTypes.bool,\n disableContent: PropTypes.bool,\n parentContentTitle: PropTypes.string,\n questionText: PropTypes.string,\n answerUI: PropTypes.shape(AnswerPropTypes)\n});\n\nconst propTypes = {\n slideIndex: PropTypes.string,\n slide: SlidePropsTypes,\n validateButton: PropTypes.shape({\n label: PropTypes.string.isRequired,\n onClick: PropTypes.func.isRequired,\n disabled: PropTypes.bool\n }),\n correctionPopinProps: PropTypes.shape({\n klf: ReviewCorrectionPopinPropTypes.klf,\n information: ReviewCorrectionPopinPropTypes.information,\n next: PropTypes.shape({\n label: PropTypes.string,\n 'aria-label': PropTypes.string // Pourquoi le onClick du next n'est pas ici !\n // updateSlidesOnNext: PropTypes.func.isRequired ???\n }),\n resultLabel: ReviewCorrectionPopinPropTypes.resultLabel,\n type: ReviewCorrectionPopinPropTypes.type\n })\n};\n\nexport default propTypes;\n\nexport type PopinProps = {\n correctionPopinProps: ReviewCorrectionPopinProps;\n slideIndex: string;\n showCorrectionPopin?: boolean;\n animateCorrectionPopin?: boolean;\n};\n\nexport type ValidateButtonProps = {\n slideIndex: string;\n validateButton: ReviewSlideProps['validateButton'];\n primarySkinColor?: string;\n};\n\nexport type SlideProps = {\n position: number;\n loading: boolean;\n loadingAriaLabel?: string;\n animationType?: 'unstack' | 'restack';\n isCorrect?: boolean;\n animateCorrectionPopin?: boolean;\n showCorrectionPopin?: boolean;\n parentContentTitle?: string;\n questionText?: string;\n answerUI?: AnswerProps;\n};\n\nexport type ReviewSlideProps = {\n slideIndex: string;\n num: number;\n slide: SlideProps;\n correctionPopinProps?: ReviewCorrectionPopinProps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mB,KAAK,EAAEvB,SAAS,CAACU,MADG;MAEpB,cAAcV,SAAS,CAACU,MAFJ,CAEW;MAC/B;;IAHoB,CAAhB,CAH8B;IAQpCsB,WAAW,EAAE/B,8BAA8B,CAAC+B,WARR;IASpCC,IAAI,EAAEhC,8BAA8B,CAACgC;EATD,CAAhB;AARN,CAAlB;AAqBA,eAAed,SAAf"}
|
|
@@ -4,7 +4,6 @@ declare namespace Dashboard {
|
|
|
4
4
|
namespace propTypes {
|
|
5
5
|
const hero: any;
|
|
6
6
|
const welcome: any;
|
|
7
|
-
const onLoadMoreSections: PropTypes.Requireable<(...args: any[]) => any>;
|
|
8
7
|
const sections: PropTypes.Requireable<((PropTypes.InferPropsInner<Pick<any, any>> & Partial<PropTypes.InferPropsInner<Pick<any, never>>>) | null | undefined)[]>;
|
|
9
8
|
const cookie: PropTypes.Requireable<PropTypes.InferProps<{
|
|
10
9
|
content: PropTypes.Requireable<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/template/common/dashboard/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/template/common/dashboard/index.js"],"names":[],"mappings":";AAoBA,oDAoCC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { useRef, useCallback, useEffect } from 'react';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import Slide from '../../../atom/slide';
|
|
5
4
|
import HeroCard from '../../../molecule/hero';
|
|
@@ -27,8 +26,7 @@ const Dashboard = props => {
|
|
|
27
26
|
sections = [],
|
|
28
27
|
hero,
|
|
29
28
|
welcome,
|
|
30
|
-
cookie
|
|
31
|
-
onLoadMoreSections
|
|
29
|
+
cookie
|
|
32
30
|
} = props;
|
|
33
31
|
|
|
34
32
|
const buildSectionComponent = section => {
|
|
@@ -72,29 +70,9 @@ const Dashboard = props => {
|
|
|
72
70
|
key: 'hero'
|
|
73
71
|
}, ...sections].map(section => /*#__PURE__*/React.createElement("div", {
|
|
74
72
|
key: section.key
|
|
75
|
-
}, buildSection(section)));
|
|
76
|
-
|
|
77
|
-
const ref = useRef(); // The scroll listener
|
|
78
|
-
|
|
79
|
-
const handleScroll = useCallback(() => {
|
|
80
|
-
console.log('scrolling');
|
|
81
|
-
|
|
82
|
-
if (window.innerHeight + document.documentElement.scrollTop + 1 >= document.scrollingElement.scrollHeight) {
|
|
83
|
-
onLoadMoreSections ? onLoadMoreSections() : null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return;
|
|
87
|
-
}, [onLoadMoreSections]); // Attach the scroll listener to the div
|
|
88
|
-
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
const div = ref.current;
|
|
91
|
-
console.log('Div is', div); // Attach a scroll listener to the div
|
|
92
|
-
|
|
93
|
-
div.addEventListener('scroll', handleScroll);
|
|
94
|
-
}, [handleScroll]);
|
|
73
|
+
}, buildSection(section)));
|
|
95
74
|
return /*#__PURE__*/React.createElement("div", {
|
|
96
75
|
className: style.wrapper,
|
|
97
|
-
ref: ref,
|
|
98
76
|
"data-name": "dashboard"
|
|
99
77
|
}, sectionsList, cookie ? /*#__PURE__*/React.createElement(CMPopin, cookie) : null);
|
|
100
78
|
};
|
|
@@ -102,7 +80,6 @@ const Dashboard = props => {
|
|
|
102
80
|
Dashboard.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
103
81
|
hero: Hero.propTypes.hero,
|
|
104
82
|
welcome: Hero.propTypes.welcome,
|
|
105
|
-
onLoadMoreSections: PropTypes.func,
|
|
106
83
|
sections: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape(BattleRequestList.propTypes), PropTypes.shape(CardsList.propTypes), PropTypes.shape(NewsList.propTypes), PropTypes.shape(StartBattle.propTypes)])),
|
|
107
84
|
cookie: PropTypes.shape(CMPopin.propTypes)
|
|
108
85
|
} : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","Slide","HeroCard","BattleRequestList","CardsList","NewsList","StartBattle","CMPopin","style","Hero","memo","hero","welcome","propTypes","shape","Dashboard","props","sections","cookie","buildSectionComponent","section","type","buildSection","index","sectionView","sectionsList","key","map","wrapper","arrayOf","oneOfType"],"sources":["../../../../src/template/common/dashboard/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Slide from '../../../atom/slide';\nimport HeroCard from '../../../molecule/hero';\nimport BattleRequestList from '../../../molecule/dashboard/battle-request-list';\nimport CardsList from '../../../molecule/dashboard/cards-list';\nimport NewsList from '../../../molecule/dashboard/news-list';\nimport StartBattle from '../../../molecule/dashboard/start-battle';\nimport CMPopin from '../../../molecule/cm-popin';\nimport style from './style.css';\n\nconst Hero = React.memo(function Hero({hero, welcome}) {\n return <div className={style.hero}>{hero ? <HeroCard {...hero} /> : <Slide {...welcome} />}</div>;\n});\n\nHero.propTypes = {\n hero: PropTypes.shape(HeroCard.propTypes),\n welcome: PropTypes.shape(Slide.propTypes)\n};\n\nconst Dashboard = props => {\n const {sections = [], hero, welcome, cookie} = props;\n\n const buildSectionComponent = section => {\n const {type} = section;\n switch (type) {\n case 'hero':\n return <Hero hero={hero} welcome={welcome} />;\n case 'battleRequests':\n return <BattleRequestList {...section} />;\n case 'cards':\n return <CardsList {...section} />;\n case 'news':\n return <NewsList {...section} />;\n case 'battle':\n return <StartBattle {...section} />;\n default:\n return null;\n }\n };\n\n const buildSection = (section, index) => {\n const sectionView = buildSectionComponent(section);\n\n return <div key={index}>{sectionView}</div>;\n };\n\n const sectionsList = [{type: 'hero', key: 'hero'}, ...sections].map(section => (\n <div key={section.key}>{buildSection(section)}</div>\n ));\n return (\n <div className={style.wrapper} data-name=\"dashboard\">\n {sectionsList}\n {cookie ? <CMPopin {...cookie} /> : null}\n </div>\n );\n};\n\nDashboard.propTypes = {\n hero: Hero.propTypes.hero,\n welcome: Hero.propTypes.welcome,\n sections: PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.shape(BattleRequestList.propTypes),\n PropTypes.shape(CardsList.propTypes),\n PropTypes.shape(NewsList.propTypes),\n PropTypes.shape(StartBattle.propTypes)\n ])\n ),\n cookie: PropTypes.shape(CMPopin.propTypes)\n};\nexport default Dashboard;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,qBAAlB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,iBAAP,MAA8B,iDAA9B;AACA,OAAOC,SAAP,MAAsB,wCAAtB;AACA,OAAOC,QAAP,MAAqB,uCAArB;AACA,OAAOC,WAAP,MAAwB,0CAAxB;AACA,OAAOC,OAAP,MAAoB,4BAApB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,IAAI,gBAAGV,KAAK,CAACW,IAAN,CAAW,SAASD,IAAT,CAAc;EAACE,IAAD;EAAOC;AAAP,CAAd,EAA+B;EACrD,oBAAO;IAAK,SAAS,EAAEJ,KAAK,CAACG;EAAtB,GAA6BA,IAAI,gBAAG,oBAAC,QAAD,EAAcA,IAAd,CAAH,gBAA4B,oBAAC,KAAD,EAAWC,OAAX,CAA7D,CAAP;AACD,CAFY,CAAb;AAIAH,IAAI,CAACI,SAAL,2CAAiB;EACfF,IAAI,EAAEX,SAAS,CAACc,KAAV,CAAgBZ,QAAQ,CAACW,SAAzB,CADS;EAEfD,OAAO,EAAEZ,SAAS,CAACc,KAAV,CAAgBb,KAAK,CAACY,SAAtB;AAFM,CAAjB;;AAKA,MAAME,SAAS,GAAGC,KAAK,IAAI;EACzB,MAAM;IAACC,QAAQ,GAAG,EAAZ;IAAgBN,IAAhB;IAAsBC,OAAtB;IAA+BM;EAA/B,IAAyCF,KAA/C;;EAEA,MAAMG,qBAAqB,GAAGC,OAAO,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AV,CACR7B,SAAS,CAAC8B,SAAV,CAAoB,CAClB9B,SAAS,CAACc,KAAV,CAAgBX,iBAAiB,CAACU,SAAlC,CADkB,EAElBb,SAAS,CAACc,KAAV,CAAgBV,SAAS,CAACS,SAA1B,CAFkB,EAGlBb,SAAS,CAACc,KAAV,CAAgBT,QAAQ,CAACQ,SAAzB,CAHkB,EAIlBb,SAAS,CAACc,KAAV,CAAgBR,WAAW,CAACO,SAA5B,CAJkB,CAApB,CADQ,CAHU;EAWpBK,MAAM,EAAElB,SAAS,CAACc,KAAV,CAAgBP,OAAO,CAACM,SAAxB;AAXY,CAAtB;AAaA,eAAeE,SAAf"}
|
|
@@ -123,13 +123,11 @@ const Choice = ({
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
if (isSelected) {
|
|
126
|
-
var _brandTheme$colors, _brandTheme$colors2;
|
|
127
|
-
|
|
128
126
|
textStyle.push(styleSheet.textSelected); // eslint-disable-next-line @coorpacademy/coorpacademy/no-overwriting-spread
|
|
129
127
|
|
|
130
128
|
const selectionStyle = brandTheme && _extends({
|
|
131
|
-
backgroundColor:
|
|
132
|
-
borderColor:
|
|
129
|
+
backgroundColor: brandTheme.colors?.primary,
|
|
130
|
+
borderColor: brandTheme.colors?.primary
|
|
133
131
|
}, url ? {
|
|
134
132
|
borderTopRightRadius: theme.radius.regular,
|
|
135
133
|
borderBottomRightRadius: theme.radius.regular
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["createStyleSheet","theme","squeezed","StyleSheet","create","boxShadow","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","backgroundColor","container","colors","white","borderRadius","radius","regular","flexDirection","alignItems","textContainer","paddingHorizontal","paddingVertical","justifyContent","flex","squeezedTextContainer","padding","spacing","small","paddingLeft","undefined","paddingRight","text","fontSize","medium","fontWeight","bold","color","black","textAlign","textSelected","unselectedImageContainer","borderRightColor","border","imageContainer","overflow","borderTopLeftRadius","borderBottomLeftRadius","image","Choice","children","isSelected","isDisabled","onPress","media","testID","prefixTestID","style","questionType","templateContext","useTemplateContext","brandTheme","styleSheet","setStylesheet","useState","useEffect","_stylesheet","selectedSuffix","mediaType","type","toLowerCase","url","src","length","getCleanUri","source","uri","mediaSuffix","textStyle","textWrapperStyle","push","selectionStyle","primary","borderColor","borderTopRightRadius","borderBottomRightRadius"],"sources":["../../../src/atom/choice/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {View, StyleSheet, ViewStyle, TextStyle} from 'react-native';\n\nimport Html from '../html/index.native';\nimport ImageBackground from '../image-background/index.native';\nimport type {Media, QuestionType} from '../../molecule/questions/types';\nimport getCleanUri from '../../util/get-clean-uri';\nimport Touchable from '../../hoc/touchable/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\n\nexport type Props = {\n isSelected?: boolean;\n onPress: () => void;\n children?: string;\n isDisabled?: boolean;\n testID?: string;\n media?: Media;\n squeezed?: boolean;\n style?: ViewStyle;\n questionType: QuestionType;\n};\n\ntype StyleSheetType = {\n boxShadow: ViewStyle;\n container: ViewStyle;\n text: TextStyle;\n textSelected: TextStyle;\n textContainer: ViewStyle;\n squeezedTextContainer: ViewStyle;\n unselectedImageContainer: ViewStyle;\n imageContainer: ViewStyle;\n image: ViewStyle;\n};\n\nconst createStyleSheet = (theme: Theme, squeezed: boolean): StyleSheetType =>\n StyleSheet.create({\n boxShadow: {\n shadowColor: '#000',\n shadowOffset: {width: 0, height: 4},\n shadowOpacity: 0.12,\n shadowRadius: 16,\n elevation: 8,\n backgroundColor: '#0000'\n },\n container: {\n backgroundColor: theme.colors.white,\n borderRadius: theme.radius.regular,\n flexDirection: 'row',\n alignItems: 'stretch'\n },\n textContainer: {\n paddingHorizontal: 24,\n paddingVertical: 12,\n justifyContent: 'center',\n alignItems: 'center',\n flex: 1\n },\n squeezedTextContainer: {\n padding: theme.spacing.small,\n paddingLeft: undefined,\n paddingVertical: undefined,\n paddingRight: undefined,\n flex: 0\n },\n text: {\n fontSize: squeezed ? theme.fontSize.medium : theme.fontSize.regular,\n fontWeight: theme.fontWeight.bold,\n color: theme.colors.black,\n textAlign: 'center'\n },\n textSelected: {\n color: theme.colors.white\n },\n unselectedImageContainer: {\n borderRightColor: theme.colors.border\n },\n imageContainer: {\n height: '100%',\n width: '25%',\n overflow: 'hidden',\n borderTopLeftRadius: theme.radius.regular,\n borderBottomLeftRadius: theme.radius.regular\n },\n image: {\n flex: 1\n }\n });\n\nconst Choice = ({\n children,\n isSelected = false,\n squeezed = false,\n isDisabled,\n onPress,\n media,\n testID: prefixTestID,\n style,\n questionType\n}: Props) => {\n const templateContext = useTemplateContext();\n const {theme, brandTheme} = templateContext;\n\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme, squeezed);\n setStylesheet(_stylesheet);\n }, [theme, squeezed]);\n\n if (!styleSheet) {\n return null;\n }\n\n const selectedSuffix = prefixTestID && isSelected ? '-selected' : '';\n const mediaType = media && media.type && media.type === 'img' && media.type.toLowerCase();\n const url =\n media &&\n media.type === 'img' &&\n media.src &&\n media.src.length > 0 &&\n getCleanUri(media.src[0].url);\n\n const source = {uri: url ? getCleanUri(url) : undefined};\n const mediaSuffix = prefixTestID && mediaType ? `-${mediaType}` : '';\n\n const textStyle: TextStyle[] = [styleSheet.text];\n const textWrapperStyle: ViewStyle[] = [styleSheet.textContainer];\n\n if (squeezed) {\n textWrapperStyle.push(styleSheet.squeezedTextContainer);\n }\n\n if (isSelected) {\n textStyle.push(styleSheet.textSelected);\n\n // eslint-disable-next-line @coorpacademy/coorpacademy/no-overwriting-spread\n const selectionStyle = brandTheme && {\n backgroundColor: brandTheme.colors?.primary,\n borderColor: brandTheme.colors?.primary,\n ...(url\n ? {\n borderTopRightRadius: theme.radius.regular,\n borderBottomRightRadius: theme.radius.regular\n }\n : {\n borderRadius: theme.radius.regular\n })\n };\n\n if (selectionStyle) {\n textWrapperStyle.push(selectionStyle);\n }\n }\n\n return (\n <Touchable\n onPress={!isDisabled ? onPress : undefined}\n style={style}\n analyticsID=\"question-choice\"\n analyticsParams={{questionType}}\n >\n <View\n style={[styleSheet.boxShadow, styleSheet.container]}\n testID={prefixTestID && `${prefixTestID}${selectedSuffix}`}\n >\n {url ? (\n <View style={styleSheet.imageContainer}>\n <ImageBackground\n testID={prefixTestID && `${prefixTestID}${mediaSuffix}`}\n source={source}\n style={styleSheet.image}\n />\n </View>\n ) : null}\n\n {children ? (\n <View style={textWrapperStyle}>\n <Html style={textStyle}>{children}</Html>\n </View>\n ) : null}\n </View>\n </Touchable>\n );\n};\n\nexport default Choice;\n"],"mappings":";;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AA2BA,MAAMA,gBAAgB,GAAG,CAACC,KAAD,EAAeC,QAAf,KACvBC,uBAAA,CAAWC,MAAX,CAAkB;EAChBC,SAAS,EAAE;IACTC,WAAW,EAAE,MADJ;IAETC,YAAY,EAAE;MAACC,KAAK,EAAE,CAAR;MAAWC,MAAM,EAAE;IAAnB,CAFL;IAGTC,aAAa,EAAE,IAHN;IAITC,YAAY,EAAE,EAJL;IAKTC,SAAS,EAAE,CALF;IAMTC,eAAe,EAAE;EANR,CADK;EAShBC,SAAS,EAAE;IACTD,eAAe,EAAEZ,KAAK,CAACc,MAAN,CAAaC,KADrB;IAETC,YAAY,EAAEhB,KAAK,CAACiB,MAAN,CAAaC,OAFlB;IAGTC,aAAa,EAAE,KAHN;IAITC,UAAU,EAAE;EAJH,CATK;EAehBC,aAAa,EAAE;IACbC,iBAAiB,EAAE,EADN;IAEbC,eAAe,EAAE,EAFJ;IAGbC,cAAc,EAAE,QAHH;IAIbJ,UAAU,EAAE,QAJC;IAKbK,IAAI,EAAE;EALO,CAfC;EAsBhBC,qBAAqB,EAAE;IACrBC,OAAO,EAAE3B,KAAK,CAAC4B,OAAN,CAAcC,KADF;IAErBC,WAA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et","theme","squeezed","StyleSheet","create","boxShadow","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","backgroundColor","container","colors","white","borderRadius","radius","regular","flexDirection","alignItems","textContainer","paddingHorizontal","paddingVertical","justifyContent","flex","squeezedTextContainer","padding","spacing","small","paddingLeft","undefined","paddingRight","text","fontSize","medium","fontWeight","bold","color","black","textAlign","textSelected","unselectedImageContainer","borderRightColor","border","imageContainer","overflow","borderTopLeftRadius","borderBottomLeftRadius","image","Choice","children","isSelected","isDisabled","onPress","media","testID","prefixTestID","style","questionType","templateContext","useTemplateContext","brandTheme","styleSheet","setStylesheet","useState","useEffect","_stylesheet","selectedSuffix","mediaType","type","toLowerCase","url","src","length","getCleanUri","source","uri","mediaSuffix","textStyle","textWrapperStyle","push","selectionStyle","primary","borderColor","borderTopRightRadius","borderBottomRightRadius"],"sources":["../../../src/atom/choice/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {View, StyleSheet, ViewStyle, TextStyle} from 'react-native';\n\nimport Html from '../html/index.native';\nimport ImageBackground from '../image-background/index.native';\nimport type {Media, QuestionType} from '../../molecule/questions/types';\nimport getCleanUri from '../../util/get-clean-uri';\nimport Touchable from '../../hoc/touchable/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\n\nexport type Props = {\n isSelected?: boolean;\n onPress: () => void;\n children?: string;\n isDisabled?: boolean;\n testID?: string;\n media?: Media;\n squeezed?: boolean;\n style?: ViewStyle;\n questionType: QuestionType;\n};\n\ntype StyleSheetType = {\n boxShadow: ViewStyle;\n container: ViewStyle;\n text: TextStyle;\n textSelected: TextStyle;\n textContainer: ViewStyle;\n squeezedTextContainer: ViewStyle;\n unselectedImageContainer: ViewStyle;\n imageContainer: ViewStyle;\n image: ViewStyle;\n};\n\nconst createStyleSheet = (theme: Theme, squeezed: boolean): StyleSheetType =>\n StyleSheet.create({\n boxShadow: {\n shadowColor: '#000',\n shadowOffset: {width: 0, height: 4},\n shadowOpacity: 0.12,\n shadowRadius: 16,\n elevation: 8,\n backgroundColor: '#0000'\n },\n container: {\n backgroundColor: theme.colors.white,\n borderRadius: theme.radius.regular,\n flexDirection: 'row',\n alignItems: 'stretch'\n },\n textContainer: {\n paddingHorizontal: 24,\n paddingVertical: 12,\n justifyContent: 'center',\n alignItems: 'center',\n flex: 1\n },\n squeezedTextContainer: {\n padding: theme.spacing.small,\n paddingLeft: undefined,\n paddingVertical: undefined,\n paddingRight: undefined,\n flex: 0\n },\n text: {\n fontSize: squeezed ? theme.fontSize.medium : theme.fontSize.regular,\n fontWeight: theme.fontWeight.bold,\n color: theme.colors.black,\n textAlign: 'center'\n },\n textSelected: {\n color: theme.colors.white\n },\n unselectedImageContainer: {\n borderRightColor: theme.colors.border\n },\n imageContainer: {\n height: '100%',\n width: '25%',\n overflow: 'hidden',\n borderTopLeftRadius: theme.radius.regular,\n borderBottomLeftRadius: theme.radius.regular\n },\n image: {\n flex: 1\n }\n });\n\nconst Choice = ({\n children,\n isSelected = false,\n squeezed = false,\n isDisabled,\n onPress,\n media,\n testID: prefixTestID,\n style,\n questionType\n}: Props) => {\n const templateContext = useTemplateContext();\n const {theme, brandTheme} = templateContext;\n\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme, squeezed);\n setStylesheet(_stylesheet);\n }, [theme, squeezed]);\n\n if (!styleSheet) {\n return null;\n }\n\n const selectedSuffix = prefixTestID && isSelected ? '-selected' : '';\n const mediaType = media && media.type && media.type === 'img' && media.type.toLowerCase();\n const url =\n media &&\n media.type === 'img' &&\n media.src &&\n media.src.length > 0 &&\n getCleanUri(media.src[0].url);\n\n const source = {uri: url ? getCleanUri(url) : undefined};\n const mediaSuffix = prefixTestID && mediaType ? `-${mediaType}` : '';\n\n const textStyle: TextStyle[] = [styleSheet.text];\n const textWrapperStyle: ViewStyle[] = [styleSheet.textContainer];\n\n if (squeezed) {\n textWrapperStyle.push(styleSheet.squeezedTextContainer);\n }\n\n if (isSelected) {\n textStyle.push(styleSheet.textSelected);\n\n // eslint-disable-next-line @coorpacademy/coorpacademy/no-overwriting-spread\n const selectionStyle = brandTheme && {\n backgroundColor: brandTheme.colors?.primary,\n borderColor: brandTheme.colors?.primary,\n ...(url\n ? {\n borderTopRightRadius: theme.radius.regular,\n borderBottomRightRadius: theme.radius.regular\n }\n : {\n borderRadius: theme.radius.regular\n })\n };\n\n if (selectionStyle) {\n textWrapperStyle.push(selectionStyle);\n }\n }\n\n return (\n <Touchable\n onPress={!isDisabled ? onPress : undefined}\n style={style}\n analyticsID=\"question-choice\"\n analyticsParams={{questionType}}\n >\n <View\n style={[styleSheet.boxShadow, styleSheet.container]}\n testID={prefixTestID && `${prefixTestID}${selectedSuffix}`}\n >\n {url ? (\n <View style={styleSheet.imageContainer}>\n <ImageBackground\n testID={prefixTestID && `${prefixTestID}${mediaSuffix}`}\n source={source}\n style={styleSheet.image}\n />\n </View>\n ) : null}\n\n {children ? (\n <View style={textWrapperStyle}>\n <Html style={textStyle}>{children}</Html>\n </View>\n ) : null}\n </View>\n </Touchable>\n );\n};\n\nexport default Choice;\n"],"mappings":";;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AA2BA,MAAMA,gBAAgB,GAAG,CAACC,KAAD,EAAeC,QAAf,KACvBC,uBAAA,CAAWC,MAAX,CAAkB;EAChBC,SAAS,EAAE;IACTC,WAAW,EAAE,MADJ;IAETC,YAAY,EAAE;MAACC,KAAK,EAAE,CAAR;MAAWC,MAAM,EAAE;IAAnB,CAFL;IAGTC,aAAa,EAAE,IAHN;IAITC,YAAY,EAAE,EAJL;IAKTC,SAAS,EAAE,CALF;IAMTC,eAAe,EAAE;EANR,CADK;EAShBC,SAAS,EAAE;IACTD,eAAe,EAAEZ,KAAK,CAACc,MAAN,CAAaC,KADrB;IAETC,YAAY,EAAEhB,KAAK,CAACiB,MAAN,CAAaC,OAFlB;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Eb,UAAU,CAACd;EAHpB,EADF,CADE,GAQA,IAZN,EAcGE,QAAQ,gBACP,6BAAC,iBAAD;IAAM,KAAK,EAAE6B;EAAb,gBACE,6BAAC,cAAD;IAAM,KAAK,EAAED;EAAb,GAAyB5B,QAAzB,CADF,CADO,GAIL,IAlBN,CANF,CADF;AA6BD,CA/FD;;eAiGeD,M"}
|
|
@@ -107,8 +107,6 @@ const Html = props => {
|
|
|
107
107
|
numberOfLines: numberOfLines
|
|
108
108
|
}, _children), [numberOfLines]);
|
|
109
109
|
const FontRenderer = (0, _react.useCallback)((htmlAttribs, _children) => {
|
|
110
|
-
var _htmlAttribs$color;
|
|
111
|
-
|
|
112
110
|
if (htmlAttribs.color) {
|
|
113
111
|
disableBaseFontStyleColor(true);
|
|
114
112
|
}
|
|
@@ -116,7 +114,7 @@ const Html = props => {
|
|
|
116
114
|
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
117
115
|
key: 1,
|
|
118
116
|
style: _extends({}, baseFontStyle, {
|
|
119
|
-
color:
|
|
117
|
+
color: htmlAttribs.color?.replace(/ /g, '')
|
|
120
118
|
})
|
|
121
119
|
}, _children);
|
|
122
120
|
}, [baseFontStyle]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["HtmlBase","props","Html","templateContext","useTemplateContext","isDisabledBaseFontStyleColor","disableBaseFontStyleColor","useState","theme","children","fontSize","containerStyle","imageStyle","style","testID","anchorTextColor","HTML_ANCHOR_TEXT_COLOR","isTextCentered","numberOfLines","styles","p","marginVertical","textAlign","u","textDecorationLine","i","fontStyle","b","fontWeight","bold","s","tagsStyles","h1","h2","h3","h4","h5","h6","a","color","img","baseFontStyle","DEFAULT_TEXT_STYLE","colors","black","Array","isArray","styleObject","reduce","result","child","SpanRenderer","useCallback","htmlAttribs","_children","FontRenderer","replace","renderers","font","span","html","undefined"],"sources":["../../../src/atom/html/index.native.tsx"],"sourcesContent":["import React, {useCallback, useState} from 'react';\nimport {View, ViewStyle, ImageStyle, TextStyle} from 'react-native';\nimport RenderHTML, {\n CustomRendererProps,\n MixedStyleRecord,\n RenderHTMLProps,\n TBlock\n} from 'react-native-render-html';\n\nimport {HTML_ANCHOR_TEXT_COLOR} from '../../variables/theme.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport Text, {DEFAULT_STYLE as DEFAULT_TEXT_STYLE} from '../text/index.native';\n\ninterface CustomRenderHTMLProps extends RenderHTMLProps {\n baseFontStyle?: TextStyle;\n testID?: string;\n}\n\nconst HtmlBase = (props: CustomRenderHTMLProps) => {\n return <RenderHTML {...props} />;\n};\n\nexport type Props = {\n children: string;\n fontSize?: TextStyle['fontSize'];\n numberOfLines?: number;\n onLinkPress?: (url: string) => void;\n containerStyle?: ViewStyle;\n anchorTextColor?: string;\n imageStyle?: ImageStyle;\n style?: ViewStyle | ViewStyle[];\n testID?: string;\n isTextCentered?: boolean;\n};\n\ntype Styles = {\n p: {\n marginVertical: ViewStyle['marginVertical'];\n textAlign: TextStyle['textAlign'];\n };\n u: {\n textDecorationLine: TextStyle['textDecorationLine'];\n };\n i: {\n fontStyle: TextStyle['fontStyle'];\n };\n b: {\n fontWeight: TextStyle['fontWeight'];\n };\n s: {\n textDecorationLine: TextStyle['textDecorationLine'];\n };\n};\n\nconst Html = (props: Props) => {\n const templateContext = useTemplateContext();\n const [isDisabledBaseFontStyleColor, disableBaseFontStyleColor] = useState<boolean>(false);\n const {theme} = templateContext;\n const {\n children,\n fontSize,\n containerStyle,\n imageStyle,\n style,\n testID,\n anchorTextColor = HTML_ANCHOR_TEXT_COLOR,\n isTextCentered,\n numberOfLines\n } = props;\n\n // Don't use StyleSheet there, it's not a react style\n const styles: Styles = {\n p: {\n marginVertical: 0,\n textAlign: 'center'\n },\n u: {\n textDecorationLine: 'underline'\n },\n i: {\n fontStyle: 'italic'\n },\n b: {\n fontWeight: theme.fontWeight.bold\n },\n s: {\n textDecorationLine: 'line-through'\n }\n };\n\n const tagsStyles: MixedStyleRecord = {\n ...styles,\n h1: {fontSize},\n h2: {fontSize},\n h3: {fontSize},\n h4: {fontSize},\n h5: {fontSize},\n h6: {fontSize},\n a: {color: anchorTextColor},\n img: imageStyle || {}\n };\n\n let baseFontStyle: TextStyle = {...DEFAULT_TEXT_STYLE, fontSize, color: theme.colors.black};\n if (style) {\n if (Array.isArray(style)) {\n const styleObject = style.reduce((result, child) => ({\n ...result,\n ...child\n }));\n baseFontStyle = {\n ...baseFontStyle,\n ...styleObject\n };\n } else {\n baseFontStyle = {\n ...baseFontStyle,\n ...style\n };\n }\n }\n\n const SpanRenderer = useCallback(\n (htmlAttribs: CustomRendererProps<TBlock>, _children: string) => (\n <Text numberOfLines={numberOfLines}>{_children}</Text>\n ),\n [numberOfLines]\n );\n\n interface HtmlAttrib extends CustomRendererProps<TBlock> {\n color?: string;\n }\n\n const FontRenderer = useCallback(\n (htmlAttribs: HtmlAttrib, _children: string) => {\n if (htmlAttribs.color) {\n disableBaseFontStyleColor(true);\n }\n\n return (\n <Text\n key={1}\n style={{\n ...baseFontStyle,\n color: htmlAttribs.color?.replace(/ /g, '')\n }}\n >\n {_children}\n </Text>\n );\n },\n [baseFontStyle]\n );\n\n const renderers = {\n font: FontRenderer,\n span: SpanRenderer\n };\n\n return (\n <View testID={testID} style={containerStyle}>\n <HtmlBase\n // to text-align center on android\n // we have to encapsulate between <p> tag\n // and use custom style define on <p>\n // definition in component style doesn't work\n source={{\n // eslint-disable-next-line no-nested-ternary\n html: isTextCentered\n ? `<p>${children}</p>`\n : numberOfLines\n ? `<span>${children}</span>`\n : `${children}`\n }}\n tagsStyles={tagsStyles}\n baseFontStyle={{\n ...baseFontStyle,\n color: isDisabledBaseFontStyleColor ? undefined : baseFontStyle.color\n }}\n renderers={renderers}\n // this is exceptionally for the onboarding course\n // is the only course that has a gif in the context but the img tag\n // comes with width & height attr and these makes this lib do not render the gif\n // so to avoid it, we decided to ignore these attr\n ignoredStyles={['width', 'height']}\n testID=\"html-base\"\n />\n </View>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KAAK,EAAExB;IAAR,CAR6B;IAShCyB,GAAG,EAAE5B,UAAU,IAAI;EATa,EAAlC;;EAYA,IAAI6B,aAAwB,gBAAOC,oBAAP;IAA2BhC,QAA3B;IAAqC6B,KAAK,EAAE/B,KAAK,CAACmC,MAAN,CAAaC;EAAzD,EAA5B;;EACA,IAAI/B,KAAJ,EAAW;IACT,IAAIgC,KAAK,CAACC,OAAN,CAAcjC,KAAd,CAAJ,EAA0B;MACxB,MAAMkC,WAAW,GAAGlC,KAAK,CAACmC,MAAN,CAAa,CAACC,MAAD,EAASC,KAAT,kBAC5BD,MAD4B,EAE5BC,KAF4B,CAAb,CAApB;MAIAT,aAAa,gBACRA,aADQ,EAERM,WAFQ,CAAb;IAID,CATD,MASO;MACLN,aAAa,gBACRA,aADQ,EAER5B,KAFQ,CAAb;IAID;EACF;;EAED,MAAMsC,YAAY,GAAG,IAAAC,kBAAA,EACnB,CAACC,WAAD,EAA2CC,SAA3C,kBACE,6BAAC,cAAD;IAAM,aAAa,EAAEpC;EAArB,GAAqCoC,SAArC,CAFiB,EAInB,CAACpC,aAAD,CAJmB,CAArB;EAWA,MAAMqC,YAAY,GAAG,IAAAH,kBAAA,EACnB,CAACC,WAAD,EAA0BC,SAA1B,KAAgD;
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["HtmlBase","props","Html","templateContext","useTemplateContext","isDisabledBaseFontStyleColor","disableBaseFontStyleColor","useState","theme","children","fontSize","containerStyle","imageStyle","style","testID","anchorTextColor","HTML_ANCHOR_TEXT_COLOR","isTextCentered","numberOfLines","styles","p","marginVertical","textAlign","u","textDecorationLine","i","fontStyle","b","fontWeight","bold","s","tagsStyles","h1","h2","h3","h4","h5","h6","a","color","img","baseFontStyle","DEFAULT_TEXT_STYLE","colors","black","Array","isArray","styleObject","reduce","result","child","SpanRenderer","useCallback","htmlAttribs","_children","FontRenderer","replace","renderers","font","span","html","undefined"],"sources":["../../../src/atom/html/index.native.tsx"],"sourcesContent":["import React, {useCallback, useState} from 'react';\nimport {View, ViewStyle, ImageStyle, TextStyle} from 'react-native';\nimport RenderHTML, {\n CustomRendererProps,\n MixedStyleRecord,\n RenderHTMLProps,\n TBlock\n} from 'react-native-render-html';\n\nimport {HTML_ANCHOR_TEXT_COLOR} from '../../variables/theme.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport Text, {DEFAULT_STYLE as DEFAULT_TEXT_STYLE} from '../text/index.native';\n\ninterface CustomRenderHTMLProps extends RenderHTMLProps {\n baseFontStyle?: TextStyle;\n testID?: string;\n}\n\nconst HtmlBase = (props: CustomRenderHTMLProps) => {\n return <RenderHTML {...props} />;\n};\n\nexport type Props = {\n children: string;\n fontSize?: TextStyle['fontSize'];\n numberOfLines?: number;\n onLinkPress?: (url: string) => void;\n containerStyle?: ViewStyle;\n anchorTextColor?: string;\n imageStyle?: ImageStyle;\n style?: ViewStyle | ViewStyle[];\n testID?: string;\n isTextCentered?: boolean;\n};\n\ntype Styles = {\n p: {\n marginVertical: ViewStyle['marginVertical'];\n textAlign: TextStyle['textAlign'];\n };\n u: {\n textDecorationLine: TextStyle['textDecorationLine'];\n };\n i: {\n fontStyle: TextStyle['fontStyle'];\n };\n b: {\n fontWeight: TextStyle['fontWeight'];\n };\n s: {\n textDecorationLine: TextStyle['textDecorationLine'];\n };\n};\n\nconst Html = (props: Props) => {\n const templateContext = useTemplateContext();\n const [isDisabledBaseFontStyleColor, disableBaseFontStyleColor] = useState<boolean>(false);\n const {theme} = templateContext;\n const {\n children,\n fontSize,\n containerStyle,\n imageStyle,\n style,\n testID,\n anchorTextColor = HTML_ANCHOR_TEXT_COLOR,\n isTextCentered,\n numberOfLines\n } = props;\n\n // Don't use StyleSheet there, it's not a react style\n const styles: Styles = {\n p: {\n marginVertical: 0,\n textAlign: 'center'\n },\n u: {\n textDecorationLine: 'underline'\n },\n i: {\n fontStyle: 'italic'\n },\n b: {\n fontWeight: theme.fontWeight.bold\n },\n s: {\n textDecorationLine: 'line-through'\n }\n };\n\n const tagsStyles: MixedStyleRecord = {\n ...styles,\n h1: {fontSize},\n h2: {fontSize},\n h3: {fontSize},\n h4: {fontSize},\n h5: {fontSize},\n h6: {fontSize},\n a: {color: anchorTextColor},\n img: imageStyle || {}\n };\n\n let baseFontStyle: TextStyle = {...DEFAULT_TEXT_STYLE, fontSize, color: theme.colors.black};\n if (style) {\n if (Array.isArray(style)) {\n const styleObject = style.reduce((result, child) => ({\n ...result,\n ...child\n }));\n baseFontStyle = {\n ...baseFontStyle,\n ...styleObject\n };\n } else {\n baseFontStyle = {\n ...baseFontStyle,\n ...style\n };\n }\n }\n\n const SpanRenderer = useCallback(\n (htmlAttribs: CustomRendererProps<TBlock>, _children: string) => (\n <Text numberOfLines={numberOfLines}>{_children}</Text>\n ),\n [numberOfLines]\n );\n\n interface HtmlAttrib extends CustomRendererProps<TBlock> {\n color?: string;\n }\n\n const FontRenderer = useCallback(\n (htmlAttribs: HtmlAttrib, _children: string) => {\n if (htmlAttribs.color) {\n disableBaseFontStyleColor(true);\n }\n\n return (\n <Text\n key={1}\n style={{\n ...baseFontStyle,\n color: htmlAttribs.color?.replace(/ /g, '')\n }}\n >\n {_children}\n </Text>\n );\n },\n [baseFontStyle]\n );\n\n const renderers = {\n font: FontRenderer,\n span: SpanRenderer\n };\n\n return (\n <View testID={testID} style={containerStyle}>\n <HtmlBase\n // to text-align center on android\n // we have to encapsulate between <p> tag\n // and use custom style define on <p>\n // definition in component style doesn't work\n source={{\n // eslint-disable-next-line no-nested-ternary\n html: isTextCentered\n ? `<p>${children}</p>`\n : numberOfLines\n ? `<span>${children}</span>`\n : `${children}`\n }}\n tagsStyles={tagsStyles}\n baseFontStyle={{\n ...baseFontStyle,\n color: isDisabledBaseFontStyleColor ? undefined : baseFontStyle.color\n }}\n renderers={renderers}\n // this is exceptionally for the onboarding course\n // is the only course that has a gif in the context but the img tag\n // comes with width & height attr and these makes this lib do not render the gif\n // so to avoid it, we decided to ignore these attr\n ignoredStyles={['width', 'height']}\n testID=\"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