@coorpacademy/components 10.22.5 → 10.22.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/es/atom/choice/index.native.js +132 -0
- package/es/atom/choice/index.native.js.map +1 -0
- package/es/atom/gradient/index.native.js +46 -0
- package/es/atom/gradient/index.native.js.map +1 -0
- package/es/atom/html/index.native.js.map +1 -1
- package/es/atom/image-background/index.native.js +90 -0
- package/es/atom/image-background/index.native.js.map +1 -0
- package/es/atom/resource-miniature/index.js +1 -2
- package/es/atom/resource-miniature/index.js.map +1 -1
- package/es/atom/resource-miniature/style.css +4 -0
- package/es/template/app-player/player/slides/header/learner.css +4 -0
- package/es/template/app-player/player/slides/header/learner.js +2 -3
- package/es/template/app-player/player/slides/header/learner.js.map +1 -1
- package/es/template/app-player/player/slides/header/microlearning.css +4 -0
- package/es/template/app-player/player/slides/header/microlearning.js +1 -2
- package/es/template/app-player/player/slides/header/microlearning.js.map +1 -1
- package/es/template/app-player/player/slides/index.js +3 -4
- package/es/template/app-player/player/slides/index.js.map +1 -1
- package/es/template/app-player/player/slides/style.css +5 -0
- package/es/template/app-player/popin-correction/index.js +3 -4
- package/es/template/app-player/popin-correction/index.js.map +1 -1
- package/es/template/app-player/popin-correction/style.css +4 -0
- package/es/template/app-player/popin-end/summary.css +4 -0
- package/es/template/app-player/popin-end/summary.js +3 -4
- package/es/template/app-player/popin-end/summary.js.map +1 -1
- package/es/template/app-player/popin-header/index.js +3 -4
- package/es/template/app-player/popin-header/index.js.map +1 -1
- package/es/template/app-player/popin-header/style.css +4 -0
- package/es/template/common/authors/index.js +1 -2
- package/es/template/common/authors/index.js.map +1 -1
- package/es/template/common/authors/style.css +4 -0
- package/es/util/build-query-string.js +9 -0
- package/es/util/build-query-string.js.map +1 -0
- package/es/util/get-clean-uri.js +4 -0
- package/es/util/get-clean-uri.js.map +1 -0
- package/es/util/get-resized-image.js +39 -0
- package/es/util/get-resized-image.js.map +1 -0
- package/es/variables/theme.native.js.map +1 -1
- package/lib/atom/choice/index.native.js +150 -0
- package/lib/atom/choice/index.native.js.map +1 -0
- package/lib/atom/gradient/index.native.js +56 -0
- package/lib/atom/gradient/index.native.js.map +1 -0
- package/lib/atom/html/index.native.js.map +1 -1
- package/lib/atom/image-background/index.native.js +105 -0
- package/lib/atom/image-background/index.native.js.map +1 -0
- package/lib/atom/resource-miniature/index.js +9 -11
- package/lib/atom/resource-miniature/index.js.map +1 -1
- package/lib/atom/resource-miniature/style.css +4 -0
- package/lib/template/app-player/player/slides/header/learner.css +4 -0
- package/lib/template/app-player/player/slides/header/learner.js +2 -4
- package/lib/template/app-player/player/slides/header/learner.js.map +1 -1
- package/lib/template/app-player/player/slides/header/microlearning.css +4 -0
- package/lib/template/app-player/player/slides/header/microlearning.js +1 -3
- package/lib/template/app-player/player/slides/header/microlearning.js.map +1 -1
- package/lib/template/app-player/player/slides/index.js +23 -25
- package/lib/template/app-player/player/slides/index.js.map +1 -1
- package/lib/template/app-player/player/slides/style.css +5 -0
- package/lib/template/app-player/popin-correction/index.js +20 -22
- package/lib/template/app-player/popin-correction/index.js.map +1 -1
- package/lib/template/app-player/popin-correction/style.css +4 -0
- package/lib/template/app-player/popin-end/summary.css +4 -0
- package/lib/template/app-player/popin-end/summary.js +3 -5
- package/lib/template/app-player/popin-end/summary.js.map +1 -1
- package/lib/template/app-player/popin-header/index.js +32 -34
- package/lib/template/app-player/popin-header/index.js.map +1 -1
- package/lib/template/app-player/popin-header/style.css +4 -0
- package/lib/template/common/authors/index.js +15 -17
- package/lib/template/common/authors/index.js.map +1 -1
- package/lib/template/common/authors/style.css +4 -0
- package/lib/util/build-query-string.js +17 -0
- package/lib/util/build-query-string.js.map +1 -0
- package/lib/util/get-clean-uri.js +10 -0
- package/lib/util/get-clean-uri.js.map +1 -0
- package/lib/util/get-resized-image.js +49 -0
- package/lib/util/get-resized-image.js.map +1 -0
- package/lib/variables/theme.native.js.map +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -99,7 +99,7 @@ Among the Lottie Atom's props, there are two *important* props: animationSrc & i
|
|
|
99
99
|
that need an additional step, the ie11ImageBackup is needed as it's name implies because ie11 doesn't
|
|
100
100
|
support Lottie (more specifically Web Components due to the Shadow DOM).
|
|
101
101
|
|
|
102
|
-
First, you must upload to AWS S3 any new animation, in one of the static buckets (depending on the desired env), ex:
|
|
102
|
+
First, you must upload to AWS S3 any new animation, in one of the static buckets (depending on the desired env), ex:
|
|
103
103
|
`https://static-staging.coorpacademy.com/animations/review/`.
|
|
104
104
|
|
|
105
105
|
This animation must be paired with a backup image (svg) that'll be used for the ie11 scenario.
|
|
@@ -144,7 +144,6 @@ const props = {
|
|
|
144
144
|
|
|
145
145
|
The props include classNames && size control to handle additional styling.
|
|
146
146
|
|
|
147
|
-
|
|
148
147
|
## Locally use in an external project
|
|
149
148
|
|
|
150
149
|
Link your dependencies:
|
|
@@ -160,13 +159,20 @@ Build modifications:
|
|
|
160
159
|
[@coorpacademy-components] > npm run build:es
|
|
161
160
|
```
|
|
162
161
|
|
|
163
|
-
|
|
164
162
|
## Use in mobile app
|
|
163
|
+
|
|
165
164
|
Run `npm run build:watch`
|
|
166
|
-
For more info see the mobile
|
|
165
|
+
For more info see the [mobile documentation](https://github.com/CoorpAcademy/mobile/blob/master/docs/local-sync.md)
|
|
166
|
+
|
|
167
|
+
You may need to install these optional libs depending on which native components you use:
|
|
168
|
+
|
|
169
|
+
- `color`
|
|
170
|
+
- `react-native-modal`
|
|
171
|
+
- `react-native-render-html`
|
|
172
|
+
- `react-native-linear-gradient`
|
|
167
173
|
|
|
168
174
|
## Troubleshooting
|
|
169
175
|
|
|
170
176
|
Error when trying to launch the storybook:
|
|
171
177
|
|
|
172
|
-
Try to delete your ```node_modules```, go to the project's root and launch: ```yarn && yarn bootstrap```
|
|
178
|
+
Try to delete your ```node_modules```, go to the project's root and launch: ```yarn && yarn bootstrap```
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View, StyleSheet } from 'react-native';
|
|
3
|
+
import Html from '../html/index.native';
|
|
4
|
+
import ImageBackground from '../image-background/index.native';
|
|
5
|
+
import getCleanUri from '../../util/get-clean-uri';
|
|
6
|
+
import Touchable from '../../hoc/touchable/index.native';
|
|
7
|
+
import { useTemplateContext } from '../../template/app-review/template-context';
|
|
8
|
+
|
|
9
|
+
const createStyleSheet = theme => StyleSheet.create({
|
|
10
|
+
boxShadow: {
|
|
11
|
+
shadowColor: '#000',
|
|
12
|
+
shadowOffset: {
|
|
13
|
+
width: 0,
|
|
14
|
+
height: 4
|
|
15
|
+
},
|
|
16
|
+
shadowOpacity: 0.12,
|
|
17
|
+
shadowRadius: 16,
|
|
18
|
+
elevation: 8,
|
|
19
|
+
backgroundColor: '#0000'
|
|
20
|
+
},
|
|
21
|
+
container: {
|
|
22
|
+
minHeight: 80,
|
|
23
|
+
backgroundColor: theme.colors.white,
|
|
24
|
+
borderRadius: theme.radius.regular,
|
|
25
|
+
overflow: 'hidden',
|
|
26
|
+
flexDirection: 'row',
|
|
27
|
+
alignItems: 'stretch'
|
|
28
|
+
},
|
|
29
|
+
textContainer: {
|
|
30
|
+
paddingHorizontal: 24,
|
|
31
|
+
paddingVertical: 12,
|
|
32
|
+
justifyContent: 'center',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
flex: 1
|
|
35
|
+
},
|
|
36
|
+
squeezedTextContainer: {
|
|
37
|
+
padding: theme.spacing.small,
|
|
38
|
+
paddingLeft: undefined,
|
|
39
|
+
paddingVertical: undefined,
|
|
40
|
+
paddingRight: undefined,
|
|
41
|
+
flex: 0
|
|
42
|
+
},
|
|
43
|
+
text: {
|
|
44
|
+
fontWeight: theme.fontWeight.bold,
|
|
45
|
+
color: theme.colors.black
|
|
46
|
+
},
|
|
47
|
+
textSelected: {
|
|
48
|
+
color: theme.colors.white
|
|
49
|
+
},
|
|
50
|
+
unselectedImageContainer: {
|
|
51
|
+
borderRightColor: theme.colors.border
|
|
52
|
+
},
|
|
53
|
+
imageContainer: {
|
|
54
|
+
height: '100%',
|
|
55
|
+
width: '25%'
|
|
56
|
+
},
|
|
57
|
+
image: {
|
|
58
|
+
flex: 1
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const Choice = ({
|
|
63
|
+
children,
|
|
64
|
+
isSelected = false,
|
|
65
|
+
squeezed = false,
|
|
66
|
+
isDisabled,
|
|
67
|
+
onPress,
|
|
68
|
+
media,
|
|
69
|
+
testID: prefixTestID,
|
|
70
|
+
style,
|
|
71
|
+
questionType
|
|
72
|
+
}) => {
|
|
73
|
+
const templateContext = useTemplateContext();
|
|
74
|
+
const {
|
|
75
|
+
theme,
|
|
76
|
+
brandTheme
|
|
77
|
+
} = templateContext;
|
|
78
|
+
const [styleSheet, setStylesheet] = useState(null);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
const _stylesheet = createStyleSheet(theme);
|
|
81
|
+
|
|
82
|
+
setStylesheet(_stylesheet);
|
|
83
|
+
}, [theme]);
|
|
84
|
+
|
|
85
|
+
if (!styleSheet) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const selectedStyle = brandTheme && {
|
|
90
|
+
backgroundColor: brandTheme.colors.primary,
|
|
91
|
+
borderColor: brandTheme.colors.primary,
|
|
92
|
+
borderRadius: theme.radius.common
|
|
93
|
+
};
|
|
94
|
+
const selectedSuffix = prefixTestID && isSelected ? '-selected' : '';
|
|
95
|
+
const mediaType = media && media.type && media.type === 'img' && media.type.toLowerCase();
|
|
96
|
+
const url = media && media.type === 'img' && media.src && media.src.length > 0 && getCleanUri(media.src[0].url);
|
|
97
|
+
const source = {
|
|
98
|
+
uri: url ? getCleanUri(url) : undefined
|
|
99
|
+
};
|
|
100
|
+
const mediaSuffix = prefixTestID && mediaType ? `-${mediaType}` : '';
|
|
101
|
+
const htmlStyle = [styleSheet.text];
|
|
102
|
+
|
|
103
|
+
if (isSelected) {
|
|
104
|
+
htmlStyle.push(styleSheet.textSelected);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return /*#__PURE__*/React.createElement(Touchable, {
|
|
108
|
+
onPress: !isDisabled ? onPress : undefined,
|
|
109
|
+
style: style,
|
|
110
|
+
analyticsID: "question-choice",
|
|
111
|
+
analyticsParams: {
|
|
112
|
+
questionType
|
|
113
|
+
}
|
|
114
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
115
|
+
style: [styleSheet.boxShadow, styleSheet.container],
|
|
116
|
+
testID: prefixTestID && `${prefixTestID}${selectedSuffix}`
|
|
117
|
+
}, url ? /*#__PURE__*/React.createElement(View, {
|
|
118
|
+
style: styleSheet.imageContainer
|
|
119
|
+
}, /*#__PURE__*/React.createElement(ImageBackground, {
|
|
120
|
+
testID: prefixTestID && `${prefixTestID}${mediaSuffix}`,
|
|
121
|
+
source: source,
|
|
122
|
+
style: styleSheet.image
|
|
123
|
+
})) : null, /*#__PURE__*/React.createElement(View, {
|
|
124
|
+
style: [styleSheet.textContainer, squeezed && styleSheet.squeezedTextContainer, isSelected && selectedStyle]
|
|
125
|
+
}, /*#__PURE__*/React.createElement(Html, {
|
|
126
|
+
fontSize: squeezed ? theme.fontSize.medium : theme.fontSize.regular,
|
|
127
|
+
style: htmlStyle
|
|
128
|
+
}, children))));
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export default Choice;
|
|
132
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/atom/choice/index.native.tsx"],"names":["React","useEffect","useState","View","StyleSheet","Html","ImageBackground","getCleanUri","Touchable","useTemplateContext","createStyleSheet","theme","create","boxShadow","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","backgroundColor","container","minHeight","colors","white","borderRadius","radius","regular","overflow","flexDirection","alignItems","textContainer","paddingHorizontal","paddingVertical","justifyContent","flex","squeezedTextContainer","padding","spacing","small","paddingLeft","undefined","paddingRight","text","fontWeight","bold","color","black","textSelected","unselectedImageContainer","borderRightColor","border","imageContainer","image","Choice","children","isSelected","squeezed","isDisabled","onPress","media","testID","prefixTestID","style","questionType","templateContext","brandTheme","styleSheet","setStylesheet","_stylesheet","selectedStyle","primary","borderColor","common","selectedSuffix","mediaType","type","toLowerCase","url","src","length","source","uri","mediaSuffix","htmlStyle","push","fontSize","medium"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,SAAf,EAA0BC,QAA1B,QAAyC,OAAzC;AACA,SAAQC,IAAR,EAAcC,UAAd,QAA0C,cAA1C;AAGA,OAAOC,IAAP,MAAiB,sBAAjB;AACA,OAAOC,eAAP,MAA4B,kCAA5B;AACA,OAAOC,WAAP,MAAwB,0BAAxB;AACA,OAAOC,SAAP,MAAsB,kCAAtB;AACA,SAAQC,kBAAR,QAAiC,4CAAjC;;AA2BA,MAAMC,gBAAgB,GAAIC,KAAD,IACvBP,UAAU,CAACQ,MAAX,CAAkB;AAChBC,EAAAA,SAAS,EAAE;AACTC,IAAAA,WAAW,EAAE,MADJ;AAETC,IAAAA,YAAY,EAAE;AAACC,MAAAA,KAAK,EAAE,CAAR;AAAWC,MAAAA,MAAM,EAAE;AAAnB,KAFL;AAGTC,IAAAA,aAAa,EAAE,IAHN;AAITC,IAAAA,YAAY,EAAE,EAJL;AAKTC,IAAAA,SAAS,EAAE,CALF;AAMTC,IAAAA,eAAe,EAAE;AANR,GADK;AAShBC,EAAAA,SAAS,EAAE;AACTC,IAAAA,SAAS,EAAE,EADF;AAETF,IAAAA,eAAe,EAAEV,KAAK,CAACa,MAAN,CAAaC,KAFrB;AAGTC,IAAAA,YAAY,EAAEf,KAAK,CAACgB,MAAN,CAAaC,OAHlB;AAITC,IAAAA,QAAQ,EAAE,QAJD;AAKTC,IAAAA,aAAa,EAAE,KALN;AAMTC,IAAAA,UAAU,EAAE;AANH,GATK;AAiBhBC,EAAAA,aAAa,EAAE;AACbC,IAAAA,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ffect, useState} from 'react';\nimport {View, StyleSheet, ViewStyle} from 'react-native';\nimport type {Media, QuestionType} from '../../types/progression-engine';\n\nimport Html from '../html/index.native';\nimport ImageBackground from '../image-background/index.native';\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: any;\n container: any;\n text: any;\n textSelected: any;\n textContainer: any;\n squeezedTextContainer: any;\n unselectedImageContainer: any;\n imageContainer: any;\n image: any;\n};\n\nconst createStyleSheet = (theme: Theme): 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 minHeight: 80,\n backgroundColor: theme.colors.white,\n borderRadius: theme.radius.regular,\n overflow: 'hidden',\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 fontWeight: theme.fontWeight.bold,\n color: theme.colors.black\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 },\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);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!styleSheet) {\n return null;\n }\n\n const selectedStyle = brandTheme && {\n backgroundColor: brandTheme.colors.primary,\n borderColor: brandTheme.colors.primary,\n borderRadius: theme.radius.common\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 htmlStyle: ViewStyle[] = [styleSheet.text];\n\n if (isSelected) {\n htmlStyle.push(styleSheet.textSelected);\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 <View\n style={[\n styleSheet.textContainer,\n squeezed && styleSheet.squeezedTextContainer,\n isSelected && selectedStyle\n ]}\n >\n <Html\n fontSize={squeezed ? theme.fontSize.medium : theme.fontSize.regular}\n style={htmlStyle}\n >\n {children}\n </Html>\n </View>\n </View>\n </Touchable>\n );\n};\n\nexport default Choice;\n"],"file":"index.native.js"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
3
|
+
import Color from 'color';
|
|
4
|
+
|
|
5
|
+
const Gradient = ({
|
|
6
|
+
children,
|
|
7
|
+
colors,
|
|
8
|
+
transparencyPosition = 'top',
|
|
9
|
+
height,
|
|
10
|
+
style,
|
|
11
|
+
testID,
|
|
12
|
+
pointerEvents
|
|
13
|
+
}) => {
|
|
14
|
+
let calculatedColors = colors;
|
|
15
|
+
|
|
16
|
+
if (colors.length === 1) {
|
|
17
|
+
const {
|
|
18
|
+
r,
|
|
19
|
+
g,
|
|
20
|
+
b
|
|
21
|
+
} = Color(colors[0]).object();
|
|
22
|
+
calculatedColors = transparencyPosition === 'top' ? [`rgba(${r}, ${g}, ${b}, 0)`, colors[0], colors[0]] : [colors[0], colors[0], `rgba(${r}, ${g}, ${b}, 0)`];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const _style = [];
|
|
26
|
+
|
|
27
|
+
if (style) {
|
|
28
|
+
_style.push(style);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (height) {
|
|
32
|
+
_style.push({
|
|
33
|
+
height
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return /*#__PURE__*/React.createElement(LinearGradient, {
|
|
38
|
+
colors: calculatedColors,
|
|
39
|
+
style: _style,
|
|
40
|
+
pointerEvents: pointerEvents,
|
|
41
|
+
testID: testID
|
|
42
|
+
}, children);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default Gradient;
|
|
46
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/atom/gradient/index.native.tsx"],"names":["React","LinearGradient","Color","Gradient","children","colors","transparencyPosition","height","style","testID","pointerEvents","calculatedColors","length","r","g","b","object","_style","push"],"mappings":"AAAA,OAAOA,KAAP,MAA+B,OAA/B;AAEA,OAAOC,cAAP,MAA2B,8BAA3B;AACA,OAAOC,KAAP,MAAkB,OAAlB;;AAYA,MAAMC,QAAQ,GAAG,CAAC;AAChBC,EAAAA,QADgB;AAEhBC,EAAAA,MAFgB;AAGhBC,EAAAA,oBAAoB,GAAG,KAHP;AAIhBC,EAAAA,MAJgB;AAKhBC,EAAAA,KALgB;AAMhBC,EAAAA,MANgB;AAOhBC,EAAAA;AAPgB,CAAD,KAQJ;AACX,MAAIC,gBAAgB,GAAGN,MAAvB;;AACA,MAAIA,MAAM,CAACO,MAAP,KAAkB,CAAtB,EAAyB;AACvB,UAAM;AAACC,MAAAA,CAAD;AAAIC,MAAAA,CAAJ;AAAOC,MAAAA;AAAP,QAAYb,KAAK,CAACG,MAAM,CAAC,CAAD,CAAP,CAAL,CAAiBW,MAAjB,EAAlB;AACAL,IAAAA,gBAAgB,GACdL,oBAAoB,KAAK,KAAzB,GACI,CAAE,QAAOO,CAAE,KAAIC,CAAE,KAAIC,CAAE,MAAvB,EAA8BV,MAAM,CAAC,CAAD,CAApC,EAAyCA,MAAM,CAAC,CAAD,CAA/C,CADJ,GAEI,CAACA,MAAM,CAAC,CAAD,CAAP,EAAYA,MAAM,CAAC,CAAD,CAAlB,EAAwB,QAAOQ,CAAE,KAAIC,CAAE,KAAIC,CAAE,MAA7C,CAHN;AAID;;AAED,QAAME,MAAM,GAAG,EAAf;;AAEA,MAAIT,KAAJ,EAAW;AACTS,IAAAA,MAAM,CAACC,IAAP,CAAYV,KAAZ;AACD;;AACD,MAAID,MAAJ,EAAY;AACVU,IAAAA,MAAM,CAACC,IAAP,CAAY;AAACX,MAAAA;AAAD,KAAZ;AACD;;AAED,sBACE,oBAAC,cAAD;AACE,IAAA,MAAM,EAAEI,gBADV;AAEE,IAAA,KAAK,EAAEM,MAFT;AAGE,IAAA,aAAa,EAAEP,aAHjB;AAIE,IAAA,MAAM,EAAED;AAJV,KAMGL,QANH,CADF;AAUD,CArCD;;AAuCA,eAAeD,QAAf","sourcesContent":["import React, {ReactNode} from 'react';\nimport {ViewStyle} from 'react-native';\nimport LinearGradient from 'react-native-linear-gradient';\nimport Color from 'color';\n\nexport type Props = {\n children?: ReactNode;\n colors: Array<string>;\n transparencyPosition?: 'top' | 'bottom';\n height?: number;\n style?: ViewStyle | ViewStyle[] | undefined;\n testID?: string;\n pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only' | undefined;\n};\n\nconst Gradient = ({\n children,\n colors,\n transparencyPosition = 'top',\n height,\n style,\n testID,\n pointerEvents\n}: Props) => {\n let calculatedColors = colors;\n if (colors.length === 1) {\n const {r, g, b} = Color(colors[0]).object();\n calculatedColors =\n transparencyPosition === 'top'\n ? [`rgba(${r}, ${g}, ${b}, 0)`, colors[0], colors[0]]\n : [colors[0], colors[0], `rgba(${r}, ${g}, ${b}, 0)`];\n }\n\n const _style = [];\n\n if (style) {\n _style.push(style);\n }\n if (height) {\n _style.push({height});\n }\n\n return (\n <LinearGradient\n colors={calculatedColors}\n style={_style}\n pointerEvents={pointerEvents}\n testID={testID}\n >\n {children}\n </LinearGradient>\n );\n};\n\nexport default Gradient;\n"],"file":"index.native.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/atom/html/index.native.tsx"],"names":["React","useMemo","useState","View","HtmlBase","HTML_ANCHOR_TEXT_COLOR","useTemplateContext","Text","DEFAULT_STYLE","DEFAULT_TEXT_STYLE","Html","props","disableBaseFontStyleColor","setDisableBaseFontStyleColor","templateContext","theme","vibration","children","fontSize","containerStyle","imageStyle","style","testID","anchorTextColor","isTextCentered","numberOfLines","onLinkPress","handleLinkPress","url","vibrate","styles","p","marginVertical","textAlign","u","textDecorationLine","i","fontStyle","b","fontWeight","bold","s","tagsStyles","h1","h2","h3","h4","h5","h6","a","color","img","baseFontStyle","colors","black","Array","isArray","styleObject","reduce","result","child","renderers","font","htmlAttribs","_children","span","Span","_","convertedCSSStyles","allowFontScaling","key","html"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,EAAwBC,QAAxB,QAAuC,OAAvC;AACA,SAAQC,IAAR,QAAqD,cAArD;AACA,OAAOC,QAAP,MAAqB,0BAArB;AAEA,SAAQC,sBAAR,QAAqC,8BAArC;AACA,SAAQC,kBAAR,QAAiC,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hBC,IAAAA,IAAI,EAAE,SAASC,IAAT,CACJC,CADI,EAEJH,SAFI,EAGJI,kBAHI,EAIJ;AAACC,MAAAA,gBAAD;AAAmBC,MAAAA;AAAnB,KAJI,EAKJ;AACA,0BACE,oBAAC,IAAD;AACE,QAAA,aAAa,EAAE7C,aADjB;AAEE,QAAA,gBAAgB,EAAE4C,gBAFpB;AAGE,QAAA,GAAG,EAAEC,GAHP;AAIE,QAAA,KAAK,EAAEF;AAJT,SAMGJ,SANH,CADF;AAUD;AAlCe,GAAlB;AAqCA,sBACE,oBAAC,IAAD;AAAM,IAAA,MAAM,EAAE1C,MAAd;AAAsB,IAAA,KAAK,EAAEH;AAA7B,kBACE,oBAAC,QAAD,CACE;AACA;AACA;AACA;AAJF;AAKE,IAAA,MAAM,EAAE;AACN;AACAoD,MAAAA,IAAI,EAAE/C,cAAc,GACf,MAAKP,QAAS,MADC,GAEhBQ,aAAa,GACZ,SAAQR,QAAS,SADL,GAEZ,GAAEA,QAAS;AANV,KALV;AAaE,IAAA,UAAU,EAAEyB,UAbd;AAcE,IAAA,aAAa,wBACRU,aADQ;AAEXF,MAAAA,KAAK,EAAEtC,yBAAyB,GAAG,IAAH,GAAUwC,aAAa,CAACF;AAF7C,MAdf;AAkBE,IAAA,WAAW,EAAEvB,eAlBf;AAmBE,IAAA,SAAS,EAAEkC,SAnBb,CAoBE;AACA;AACA;AACA;AAvBF;AAwBE,IAAA,aAAa,EAAE,CAAC,OAAD,EAAU,QAAV,CAxBjB;AAyBE,IAAA,MAAM,EAAC;AAzBT,IADF,CADF;AA+BD,CAjJD;;AAmJA,eAAenD,IAAf","sourcesContent":["import React, {useMemo, useState} from 'react';\nimport {View, ViewStyle, ImageStyle, TextStyle} from 'react-native';\nimport HtmlBase 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\nexport type Props = {\n children: string;\n fontSize:
|
|
1
|
+
{"version":3,"sources":["../../../src/atom/html/index.native.tsx"],"names":["React","useMemo","useState","View","HtmlBase","HTML_ANCHOR_TEXT_COLOR","useTemplateContext","Text","DEFAULT_STYLE","DEFAULT_TEXT_STYLE","Html","props","disableBaseFontStyleColor","setDisableBaseFontStyleColor","templateContext","theme","vibration","children","fontSize","containerStyle","imageStyle","style","testID","anchorTextColor","isTextCentered","numberOfLines","onLinkPress","handleLinkPress","url","vibrate","styles","p","marginVertical","textAlign","u","textDecorationLine","i","fontStyle","b","fontWeight","bold","s","tagsStyles","h1","h2","h3","h4","h5","h6","a","color","img","baseFontStyle","colors","black","Array","isArray","styleObject","reduce","result","child","renderers","font","htmlAttribs","_children","span","Span","_","convertedCSSStyles","allowFontScaling","key","html"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,EAAwBC,QAAxB,QAAuC,OAAvC;AACA,SAAQC,IAAR,QAAqD,cAArD;AACA,OAAOC,QAAP,MAAqB,0BAArB;AAEA,SAAQC,sBAAR,QAAqC,8BAArC;AACA,SAAQC,kBAAR,QAAiC,4CAAjC;AACA,OAAOC,IAAP,IAAcC,aAAa,IAAIC,kBAA/B,QAAwD,sBAAxD;;AAeA,MAAMC,IAAI,GAAIC,KAAD,IAAkB;AAC7B,QAAM,CAACC,yBAAD,EAA4BC,4BAA5B,IAA4DX,QAAQ,CAAU,KAAV,CAA1E;AACA,QAAMY,eAAe,GAAGR,kBAAkB,EAA1C;AACA,QAAM;AAACS,IAAAA,KAAD;AAAQC,IAAAA;AAAR,MAAqBF,eAA3B;AACA,QAAM;AACJG,IAAAA,QADI;AAEJC,IAAAA,QAFI;AAGJC,IAAAA,cAHI;AAIJC,IAAAA,UAJI;AAKJC,IAAAA,KALI;AAMJC,IAAAA,MANI;AAOJC,IAAAA,eAAe,GAAGlB,sBAPd;AAQJmB,IAAAA,cARI;AASJC,IAAAA,aATI;AAUJC,IAAAA;AAVI,MA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/C,cAAc,GACf,MAAKP,QAAS,MADC,GAEhBQ,aAAa,GACZ,SAAQR,QAAS,SADL,GAEZ,GAAEA,QAAS;AANV,KALV;AAaE,IAAA,UAAU,EAAEyB,UAbd;AAcE,IAAA,aAAa,wBACRU,aADQ;AAEXF,MAAAA,KAAK,EAAEtC,yBAAyB,GAAG,IAAH,GAAUwC,aAAa,CAACF;AAF7C,MAdf;AAkBE,IAAA,WAAW,EAAEvB,eAlBf;AAmBE,IAAA,SAAS,EAAEkC,SAnBb,CAoBE;AACA;AACA;AACA;AAvBF;AAwBE,IAAA,aAAa,EAAE,CAAC,OAAD,EAAU,QAAV,CAxBjB;AAyBE,IAAA,MAAM,EAAC;AAzBT,IADF,CADF;AA+BD,CAjJD;;AAmJA,eAAenD,IAAf","sourcesContent":["import React, {useMemo, useState} from 'react';\nimport {View, ViewStyle, ImageStyle, TextStyle} from 'react-native';\nimport HtmlBase 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\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\nconst Html = (props: Props) => {\n const [disableBaseFontStyleColor, setDisableBaseFontStyleColor] = useState<boolean>(false);\n const templateContext = useTemplateContext();\n const {theme, vibration} = 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 onLinkPress\n } = props;\n\n const handleLinkPress = useMemo(\n () => (url: string) => {\n vibration?.vibrate();\n\n onLinkPress && onLinkPress(url);\n },\n [onLinkPress, vibration]\n );\n\n // Don't use StyleSheet there, it's not a react style\n const 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 = {\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 = {...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 renderers = {\n // eslint-disable-next-line react/display-name\n font: (htmlAttribs, _children) => {\n if (htmlAttribs.color) {\n setDisableBaseFontStyleColor(true);\n }\n return (\n <Text\n key={1}\n style={{\n ...baseFontStyle,\n color: htmlAttribs.color\n }}\n >\n {_children}\n </Text>\n );\n },\n span: function Span(\n _: any,\n _children: any,\n convertedCSSStyles: any,\n {allowFontScaling, key}: any\n ) {\n return (\n <Text\n numberOfLines={numberOfLines}\n allowFontScaling={allowFontScaling}\n key={key}\n style={convertedCSSStyles}\n >\n {_children}\n </Text>\n );\n }\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: disableBaseFontStyleColor ? null : baseFontStyle.color\n }}\n onLinkPress={handleLinkPress}\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>\n );\n};\n\nexport default Html;\n"],"file":"index.native.js"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || 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
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { ImageBackground as ImageBackgroundBase, StyleSheet } from 'react-native';
|
|
7
|
+
import getCleanUri from '../../util/get-clean-uri';
|
|
8
|
+
import getResizedImage from '../../util/get-resized-image';
|
|
9
|
+
import Gradient from '../gradient/index.native';
|
|
10
|
+
const styles = StyleSheet.create({
|
|
11
|
+
image: {
|
|
12
|
+
width: '100%',
|
|
13
|
+
height: '100%'
|
|
14
|
+
},
|
|
15
|
+
gradient: {
|
|
16
|
+
flex: 1
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const ImageBackground = (_ref) => {
|
|
21
|
+
let {
|
|
22
|
+
source,
|
|
23
|
+
gradient,
|
|
24
|
+
gradientStyle,
|
|
25
|
+
style,
|
|
26
|
+
testID = 'image-background'
|
|
27
|
+
} = _ref,
|
|
28
|
+
props = _objectWithoutPropertiesLoose(_ref, ["source", "gradient", "gradientStyle", "style", "testID"]);
|
|
29
|
+
|
|
30
|
+
// @ts-ignore this statement is enough but type is too weak
|
|
31
|
+
let uri = source && source.uri;
|
|
32
|
+
|
|
33
|
+
if (uri) {
|
|
34
|
+
const {
|
|
35
|
+
width: _width,
|
|
36
|
+
height: _height,
|
|
37
|
+
resizeMode
|
|
38
|
+
} = props;
|
|
39
|
+
const {
|
|
40
|
+
width,
|
|
41
|
+
height
|
|
42
|
+
} = StyleSheet.flatten([{
|
|
43
|
+
width: _width,
|
|
44
|
+
height: _height
|
|
45
|
+
}, style]);
|
|
46
|
+
const maxHeight = typeof height === 'number' ? height : undefined;
|
|
47
|
+
const maxWidth = typeof width === 'number' ? width : undefined;
|
|
48
|
+
uri = getResizedImage(getCleanUri(uri), {
|
|
49
|
+
maxHeight,
|
|
50
|
+
maxWidth,
|
|
51
|
+
resizeMode
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const resizedSource = uri && {
|
|
56
|
+
uri
|
|
57
|
+
} || source;
|
|
58
|
+
|
|
59
|
+
if (gradient) {
|
|
60
|
+
const {
|
|
61
|
+
children
|
|
62
|
+
} = props,
|
|
63
|
+
remainingProps = _objectWithoutPropertiesLoose(props, ["children"]);
|
|
64
|
+
|
|
65
|
+
const _style = [styles.gradient];
|
|
66
|
+
|
|
67
|
+
if (gradientStyle) {
|
|
68
|
+
_style.push(gradientStyle);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return /*#__PURE__*/React.createElement(ImageBackgroundBase, _extends({}, remainingProps, {
|
|
72
|
+
source: resizedSource,
|
|
73
|
+
style: [styles.image, style],
|
|
74
|
+
testID: testID
|
|
75
|
+
}), /*#__PURE__*/React.createElement(Gradient, {
|
|
76
|
+
testID: `${testID}-gradient`,
|
|
77
|
+
colors: gradient,
|
|
78
|
+
style: _style
|
|
79
|
+
}, children));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return /*#__PURE__*/React.createElement(ImageBackgroundBase, _extends({}, props, {
|
|
83
|
+
source: resizedSource,
|
|
84
|
+
style: [styles.image, style],
|
|
85
|
+
testID: testID
|
|
86
|
+
}));
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default ImageBackground;
|
|
90
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/atom/image-background/index.native.tsx"],"names":["React","ImageBackground","ImageBackgroundBase","StyleSheet","getCleanUri","getResizedImage","Gradient","styles","create","image","width","height","gradient","flex","source","gradientStyle","style","testID","props","uri","_width","_height","resizeMode","flatten","maxHeight","undefined","maxWidth","resizedSource","children","remainingProps","_style","push"],"mappings":";;;;AAAA,OAAOA,KAAP,MAA+B,OAA/B;AACA,SACEC,eAAe,IAAIC,mBADrB,EAEEC,UAFF,QAKO,cALP;AAOA,OAAOC,WAAP,MAAwB,0BAAxB;AAEA,OAAOC,eAAP,MAA4B,8BAA5B;AACA,OAAOC,QAAP,MAAqB,0BAArB;AAEA,MAAMC,MAAM,GAAGJ,UAAU,CAACK,MAAX,CAAkB;AAC/BC,EAAAA,KAAK,EAAE;AACLC,IAAAA,KAAK,EAAE,MADF;AAELC,IAAAA,MAAM,EAAE;AAFH,GADwB;AAK/BC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,IAAI,EAAE;AADE;AALqB,CAAlB,CAAf;;AAmBA,MAAMZ,eAAe,GAAG,UAOX;AAAA,MAPY;AACvBa,IAAAA,MADuB;AAEvBF,IAAAA,QAFuB;AAGvBG,IAAAA,aAHuB;AAIvBC,IAAAA,KAJuB;AAKvBC,IAAAA,MAAM,GAAG;AALc,GAOZ;AAAA,MADRC,KACQ;;AACX;AACA,MAAIC,GAAuB,GAAGL,MAAM,IAAIA,MAAM,CAACK,GAA/C;;AAEA,MAAIA,GAAJ,EAAS;AACP,UAAM;AAACT,MAAAA,KAAK,EAAEU,MAAR;AAAgBT,MAAAA,MAAM,EAAEU,OAAxB;AAAiCC,MAAAA;AAAjC,QAA+CJ,KAArD;AACA,UAAM;AAACR,MAAAA,KAAD;AAAQC,MAAAA;AAAR,QAAkBR,UAAU,CAACoB,OA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eO,KAAf,CAHT;AAIE,IAAA,MAAM,EAAEC;AAJV,KADF;AAQD,CAxDD;;AA0DA,eAAehB,eAAf","sourcesContent":["import React, {ReactNode} from 'react';\nimport {\n ImageBackground as ImageBackgroundBase,\n StyleSheet,\n ViewStyle,\n ImageStyle\n} from 'react-native';\n\nimport getCleanUri from '../../util/get-clean-uri';\n\nimport getResizedImage from '../../util/get-resized-image';\nimport Gradient from '../gradient/index.native';\n\nconst styles = StyleSheet.create({\n image: {\n width: '100%',\n height: '100%'\n },\n gradient: {\n flex: 1\n }\n});\n\nexport type Props = ImageStyle & {\n children?: ReactNode;\n gradient?: Array<string>;\n gradientStyle?: ViewStyle;\n testID?: string;\n source: {uri: string | undefined};\n style?: ViewStyle;\n};\n\nconst ImageBackground = ({\n source,\n gradient,\n gradientStyle,\n style,\n testID = 'image-background',\n ...props\n}: Props) => {\n // @ts-ignore this statement is enough but type is too weak\n let uri: string | undefined = source && source.uri;\n\n if (uri) {\n const {width: _width, height: _height, resizeMode} = props;\n const {width, height} = StyleSheet.flatten([{width: _width, height: _height}, style]);\n const maxHeight: number | undefined = typeof height === 'number' ? height : undefined;\n const maxWidth: number | undefined = typeof width === 'number' ? width : undefined;\n\n uri = getResizedImage(getCleanUri(uri), {\n maxHeight,\n maxWidth,\n resizeMode\n });\n }\n\n const resizedSource = (uri && {uri}) || source;\n\n if (gradient) {\n const {children, ...remainingProps} = props;\n const _style: ViewStyle[] = [styles.gradient];\n\n if (gradientStyle) {\n _style.push(gradientStyle);\n }\n\n return (\n <ImageBackgroundBase\n {...remainingProps}\n source={resizedSource}\n style={[styles.image, style]}\n testID={testID}\n >\n <Gradient testID={`${testID}-gradient`} colors={gradient} style={_style}>\n {children}\n </Gradient>\n </ImageBackgroundBase>\n );\n }\n\n return (\n <ImageBackgroundBase\n {...props}\n source={resizedSource}\n style={[styles.image, style]}\n testID={testID}\n />\n );\n};\n\nexport default ImageBackground;\n"],"file":"index.native.js"}
|
|
@@ -5,7 +5,6 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import { NovaSolidAudioAudioControlPlay as PlayIcon, NovaLineFilesOfficeFileOfficePdf as PDFIcon, NovaCompositionCoorpacademyMicrophone as PodcastIcon } from '@coorpacademy/nova-icons';
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import Provider from '../provider';
|
|
8
|
-
import { innerHTML } from '../label/style.css';
|
|
9
8
|
import style from './style.css';
|
|
10
9
|
const TYPES = {
|
|
11
10
|
pdf: {
|
|
@@ -59,7 +58,7 @@ const ResourceMiniature = (props, context) => {
|
|
|
59
58
|
color: white,
|
|
60
59
|
className: style.icon
|
|
61
60
|
}) : null), /*#__PURE__*/React.createElement("div", {
|
|
62
|
-
className: classnames(descriptionClassName, innerHTML) // eslint-disable-next-line react/no-danger
|
|
61
|
+
className: classnames(descriptionClassName, style.innerHTML) // eslint-disable-next-line react/no-danger
|
|
63
62
|
,
|
|
64
63
|
dangerouslySetInnerHTML: {
|
|
65
64
|
__html: description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/atom/resource-miniature/index.js"],"names":["React","PropTypes","NovaSolidAudioAudioControlPlay","PlayIcon","NovaLineFilesOfficeFileOfficePdf","PDFIcon","NovaCompositionCoorpacademyMicrophone","PodcastIcon","classnames","Provider","
|
|
1
|
+
{"version":3,"sources":["../../../src/atom/resource-miniature/index.js"],"names":["React","PropTypes","NovaSolidAudioAudioControlPlay","PlayIcon","NovaLineFilesOfficeFileOfficePdf","PDFIcon","NovaCompositionCoorpacademyMicrophone","PodcastIcon","classnames","Provider","style","TYPES","pdf","icon","audio","video","ResourceMiniature","props","context","skin","type","description","poster","onClick","handleOnClick","selected","descriptionClassName","selectedDescription","white","primary","posterOutlineColor","Icon","posterWrapper","borderColor","backgroundImage","innerHTML","__html","propTypes","oneOf","bool","string","func","contextTypes","childContextTypes"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AA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AAL,CAAYV,KAA5B;AAAmC,IAAA,OAAO,EAAEc,aAA5C;AAA2D,iBAAWJ;AAAtE,kBACE;AAAK,IAAA,SAAS,EAAEV,KAAK,CAACsB,aAAtB;AAAqC,IAAA,KAAK,EAAE;AAACC,MAAAA,WAAW,EAAEH;AAAd;AAA5C,kBACE;AAAK,IAAA,SAAS,EAAEpB,KAAK,CAACY,MAAtB;AAA8B,IAAA,KAAK,EAAE;AAACY,MAAAA,eAAe,EAAG,OAAMZ,MAAO;AAAhC;AAArC,IADF,EAEG,CAACG,QAAD,gBAAY,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEG,KAAb;AAAoB,IAAA,SAAS,EAAElB,KAAK,CAACG;AAArC,IAAZ,GAA4D,IAF/D,CADF,eAKE;AACE,IAAA,SAAS,EAAEL,UAAU,CAACkB,oBAAD,EAAuBhB,KAAK,CAACyB,SAA7B,CADvB,CAEE;AAFF;AAGE,IAAA,uBAAuB,EAAE;AAACC,MAAAA,MAAM,EAAEf;AAAT;AAH3B,IALF,CADF;AAaD,CArBD;;AAuBAL,iBAAiB,CAACqB,SAAlB,2CAA8B;AAC5BjB,EAAAA,IAAI,EAAEnB,SAAS,CAACqC,KAAV,CAAgB,MAAK3B,KAAL,CAAhB,CADsB;AAE5Bc,EAAAA,QAAQ,EAAExB,SAAS,CAACsC,IAFQ;AAG5BlB,EAAAA,WAAW,EAAEpB,SAAS,CAACuC,MAHK;AAI5BlB,EAAAA,MAAM,EAAErB,SAAS,CAACuC,MAJU;AAK5BjB,EAAAA,OAAO,EAAEtB,SAAS,CAACwC;AALS,CAA9B;AAQAzB,iBAAiB,CAAC0B,YAAlB,GAAiC;AAC/BvB,EAAAA,IAAI,EAAEV,QAAQ,CAACkC,iBAAT,CAA2BxB;AADF,CAAjC;AAIA,eAAeH,iBAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {get, keys} from 'lodash/fp';\nimport {\n NovaSolidAudioAudioControlPlay as PlayIcon,\n NovaLineFilesOfficeFileOfficePdf as PDFIcon,\n NovaCompositionCoorpacademyMicrophone as PodcastIcon\n} from '@coorpacademy/nova-icons';\nimport classnames from 'classnames';\nimport Provider from '../provider';\nimport style from './style.css';\n\nconst TYPES = {\n pdf: {style: style.pdf, icon: PDFIcon},\n audio: {style: style.audio, icon: PodcastIcon},\n video: {style: style.video, icon: PlayIcon}\n};\n\nconst ResourceMiniature = (props, context) => {\n const {skin} = context;\n const {type, description, poster, onClick: handleOnClick, selected = false} = props;\n const descriptionClassName = selected ? style.selectedDescription : style.description;\n const white = get('common.white', skin);\n const primary = get('common.primary', skin);\n const posterOutlineColor = selected ? primary : white;\n const Icon = TYPES[type].icon;\n return (\n <div className={TYPES[type].style} onClick={handleOnClick} data-type={type}>\n <div className={style.posterWrapper} style={{borderColor: posterOutlineColor}}>\n <div className={style.poster} style={{backgroundImage: `url(${poster})`}} />\n {!selected ? <Icon color={white} className={style.icon} /> : null}\n </div>\n <div\n className={classnames(descriptionClassName, style.innerHTML)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: description}}\n />\n </div>\n );\n};\n\nResourceMiniature.propTypes = {\n type: PropTypes.oneOf(keys(TYPES)),\n selected: PropTypes.bool,\n description: PropTypes.string,\n poster: PropTypes.string,\n onClick: PropTypes.func\n};\n\nResourceMiniature.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport default ResourceMiniature;\n"],"file":"index.js"}
|
|
@@ -5,7 +5,6 @@ import classnames from 'classnames';
|
|
|
5
5
|
import { NovaCompositionNavigationArrowLeft as BackIcon } from '@coorpacademy/nova-icons';
|
|
6
6
|
import Link from '../../../../../atom/link';
|
|
7
7
|
import Provider from '../../../../../atom/provider';
|
|
8
|
-
import { innerHTML } from '../../../../../atom/label/style.css';
|
|
9
8
|
import style from './learner.css';
|
|
10
9
|
|
|
11
10
|
const Content = ({
|
|
@@ -34,7 +33,7 @@ const Content = ({
|
|
|
34
33
|
}
|
|
35
34
|
}, details), /*#__PURE__*/React.createElement("span", {
|
|
36
35
|
"data-name": "contentTitle",
|
|
37
|
-
className: classnames(style.contentTitle, innerHTML) // eslint-disable-next-line react/no-danger
|
|
36
|
+
className: classnames(style.contentTitle, style.innerHTML) // eslint-disable-next-line react/no-danger
|
|
38
37
|
,
|
|
39
38
|
dangerouslySetInnerHTML: {
|
|
40
39
|
__html: title
|
|
@@ -59,7 +58,7 @@ const Subcontent = ({
|
|
|
59
58
|
}, /*#__PURE__*/React.createElement("div", {
|
|
60
59
|
className: style.subcontentDetails
|
|
61
60
|
}, details), /*#__PURE__*/React.createElement("div", {
|
|
62
|
-
className: classnames(style.subcontentTitle, innerHTML) // eslint-disable-next-line react/no-danger
|
|
61
|
+
className: classnames(style.subcontentTitle, style.innerHTML) // eslint-disable-next-line react/no-danger
|
|
63
62
|
,
|
|
64
63
|
dangerouslySetInnerHTML: {
|
|
65
64
|
__html: title
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/template/app-player/player/slides/header/learner.js"],"names":["React","PropTypes","classnames","NovaCompositionNavigationArrowLeft","BackIcon","Link","Provider","
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/template/app-player/player/slides/header/learner.js"],"names":["React","PropTypes","classnames","NovaCompositionNavigationArrowLeft","BackIcon","Link","Provider","style","Content","onClick","title","details","context","skin","primarySkinColor","contentWrapper","backIcon","content","contentDetails","color","contentTitle","innerHTML","__html","contextTypes","childContextTypes","propTypes","string","isRequired","Subcontent","subcontent","subcontentDetails","subcontentTitle","LearnerHeader","props","wrapper","shape"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAAQC,kCAAkC,IAAIC,QAA9C,QAA6D,0BAA7D;AACA,OAAOC,IAAP,MAAiB,0BAAjB;AACA,OAAOC,QAAP,MAAqB,8BAArB;AACA,OAAOC,KAAP,MAAkB,eAAlB;;AAE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mBC,OAAnB,kBACjB;AAAK,EAAA,SAAS,EAAEL,KAAK,CAACsB;AAAtB,gBACE;AAAK,EAAA,SAAS,EAAEtB,KAAK,CAACuB;AAAtB,GAA0CnB,OAA1C,CADF,eAEE;AACE,EAAA,SAAS,EAAET,UAAU,CAACK,KAAK,CAACwB,eAAP,EAAwBxB,KAAK,CAACc,SAA9B,CADvB,CAEE;AAFF;AAGE,EAAA,uBAAuB,EAAE;AAACC,IAAAA,MAAM,EAAEZ;AAAT;AAH3B,EAFF,CADF;;AAWAkB,UAAU,CAACH,SAAX,2CAAuB;AACrBf,EAAAA,KAAK,EAAET,SAAS,CAACyB,MAAV,CAAiBC,UADH;AAErBhB,EAAAA,OAAO,EAAEV,SAAS,CAACyB;AAFE,CAAvB;;AAKA,MAAMM,aAAa,GAAG,CAACC,KAAD,EAAQrB,OAAR,KAAoB;AACxC,QAAM;AAACK,IAAAA,OAAD;AAAUY,IAAAA;AAAV,MAAwBI,KAA9B;AAEA,sBACE;AAAK,IAAA,SAAS,EAAE1B,KAAK,CAAC2B;AAAtB,kBACE,oBAAC,OAAD,EAAajB,OAAb,CADF,eAEE,oBAAC,UAAD,EAAgBY,UAAhB,CAFF,CADF;AAMD,CATD;;AAWAG,aAAa,CAACP,SAAd,2CAA0B;AACxBR,EAAAA,OAAO,EAAEhB,SAAS,CAACkC,KAAV,CAAgB3B,OAAO,CAACiB,SAAxB,EAAmCE,UADpB;AAExBE,EAAAA,UAAU,EAAE5B,SAAS,CAACkC,KAAV,CAAgBP,UAAU,CAACH,SAA3B,EAAsCE;AAF1B,CAA1B;AAKA,eAAeK,aAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {get} from 'lodash/fp';\nimport classnames from 'classnames';\nimport {NovaCompositionNavigationArrowLeft as BackIcon} from '@coorpacademy/nova-icons';\nimport Link from '../../../../../atom/link';\nimport Provider from '../../../../../atom/provider';\nimport style from './learner.css';\n\nconst Content = ({onClick, title, details}, context) => {\n const {skin} = context;\n const primarySkinColor = get('common.primary', skin);\n\n return (\n <Link onClick={onClick} className={style.contentWrapper}>\n <BackIcon className={style.backIcon} color=\"inherit\" />\n <div className={style.content}>\n <div\n className={style.contentDetails}\n style={{\n color: primarySkinColor\n }}\n >\n {details}\n </div>\n\n <span\n data-name=\"contentTitle\"\n className={classnames(style.contentTitle, style.innerHTML)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n </div>\n </Link>\n );\n};\n\nContent.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nContent.propTypes = {\n onClick: Link.propTypes.onClick,\n title: PropTypes.string.isRequired,\n details: PropTypes.string\n};\n\nconst Subcontent = ({title, details}, context) => (\n <div className={style.subcontent}>\n <div className={style.subcontentDetails}>{details}</div>\n <div\n className={classnames(style.subcontentTitle, style.innerHTML)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n </div>\n);\n\nSubcontent.propTypes = {\n title: PropTypes.string.isRequired,\n details: PropTypes.string\n};\n\nconst LearnerHeader = (props, context) => {\n const {content, subcontent} = props;\n\n return (\n <div className={style.wrapper}>\n <Content {...content} />\n <Subcontent {...subcontent} />\n </div>\n );\n};\n\nLearnerHeader.propTypes = {\n content: PropTypes.shape(Content.propTypes).isRequired,\n subcontent: PropTypes.shape(Subcontent.propTypes).isRequired\n};\n\nexport default LearnerHeader;\n"],"file":"learner.js"}
|
|
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { NovaCompositionNavigationArrowLeft as BackIcon } from '@coorpacademy/nova-icons';
|
|
5
5
|
import Link from '../../../../../atom/link';
|
|
6
|
-
import { innerHTML } from '../../../../../atom/label/style.css';
|
|
7
6
|
import style from './microlearning.css';
|
|
8
7
|
|
|
9
8
|
const Content = ({
|
|
@@ -17,7 +16,7 @@ const Content = ({
|
|
|
17
16
|
color: "inherit"
|
|
18
17
|
}), /*#__PURE__*/React.createElement("div", {
|
|
19
18
|
"data-name": "contentTitle",
|
|
20
|
-
className: classnames(style.contentTitle, innerHTML) // eslint-disable-next-line react/no-danger
|
|
19
|
+
className: classnames(style.contentTitle, style.innerHTML) // eslint-disable-next-line react/no-danger
|
|
21
20
|
,
|
|
22
21
|
dangerouslySetInnerHTML: {
|
|
23
22
|
__html: title
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/template/app-player/player/slides/header/microlearning.js"],"names":["React","PropTypes","classnames","NovaCompositionNavigationArrowLeft","BackIcon","Link","
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/template/app-player/player/slides/header/microlearning.js"],"names":["React","PropTypes","classnames","NovaCompositionNavigationArrowLeft","BackIcon","Link","style","Content","onClick","title","context","content","backIcon","contentTitle","innerHTML","__html","propTypes","node","MicrolearningHeader","props","shape","string","isRequired"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAAQC,kCAAkC,IAAIC,QAA9C,QAA6D,0BAA7D;AACA,OAAOC,IAAP,MAAiB,0BAAjB;AACA,OAAOC,KAAP,MAAkB,qBAAlB;;AAEA,MAAMC,OAAO,GAAG,CAAC;AAACC,EAAAA,OAAD;AAAUC,EAAAA;AAAV,CAAD,EAAmBC,OAAnB,kBACd,oBAAC,IAAD;AAAM,EAAA,OAAO,EAAEF,OAAf;AAAwB,EAAA,SAAS,EAAEF,KAAK,CAACK;AAAzC,gBACE,oBAAC,QAAD;AAAU,EAAA,SAAS,EAAEL,KAAK,CAACM,QAA3B;AAAqC,EAAA,KAAK,EAAC;AAA3C,EADF,eAEE;AACE,eAAU,cADZ;AAEE,EAAA,SAAS,EAAEV,UAAU,CAACI,KAAK,CAACO,YAAP,EAAqBP,KAAK,CAACQ,SAA3B,CAFvB,CAGE;AAHF;AAIE,EAAA,uBAAuB,EAAE;AAACC,IAAAA,MAAM,EAAEN;AAAT;AAJ3B,EAFF,CADF;;AAYAF,OAAO,CAACS,SAAR,2CAAoB;AAClBR,EAAAA,OAAO,EAAEH,IAAI,CAACW,SAAL,CAAeR,OADN;AAElBC,EAAAA,KAAK,EAAER,SAAS,CAACgB;AAFC,CAApB;;AAKA,MAAMC,mBAAmB,GAAG,CAACC,KAAD,EAAQT,OAAR,KAAoB;AAC9C,QAAM;AAACC,IAAAA;AAAD,MAAYQ,KAAlB;AACA,sBAAO,oBAAC,OAAD,EAAaR,OAAb,CAAP;AACD,CAHD;;AAKAO,mBAAmB,CAACF,SAApB,2CAAgC;AAC9BL,EAAAA,OAAO,EAAEV,SAAS,CAACmB,KAAV,CAAgB;AACvBZ,IAAAA,OAAO,EAAEH,IAAI,CAACW,SAAL,CAAeR,OADD;AAEvBC,IAAAA,KAAK,EAAER,SAAS,CAACoB,MAAV,CAAiBC;AAFD,GAAhB;AADqB,CAAhC;AAOA,eAAeJ,mBAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {NovaCompositionNavigationArrowLeft as BackIcon} from '@coorpacademy/nova-icons';\nimport Link from '../../../../../atom/link';\nimport style from './microlearning.css';\n\nconst Content = ({onClick, title}, context) => (\n <Link onClick={onClick} className={style.content}>\n <BackIcon className={style.backIcon} color=\"inherit\" />\n <div\n data-name=\"contentTitle\"\n className={classnames(style.contentTitle, style.innerHTML)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n </Link>\n);\n\nContent.propTypes = {\n onClick: Link.propTypes.onClick,\n title: PropTypes.node\n};\n\nconst MicrolearningHeader = (props, context) => {\n const {content} = props;\n return <Content {...content} />;\n};\n\nMicrolearningHeader.propTypes = {\n content: PropTypes.shape({\n onClick: Link.propTypes.onClick,\n title: PropTypes.string.isRequired\n })\n};\n\nexport default MicrolearningHeader;\n"],"file":"microlearning.js"}
|
|
@@ -28,7 +28,6 @@ import VideoPlayer from '../../../../molecule/video-player';
|
|
|
28
28
|
import PDF from '../../../../molecule/pdf';
|
|
29
29
|
import Audio from '../../../../molecule/audio';
|
|
30
30
|
import ResourceBrowser from '../../../../organism/resource-browser';
|
|
31
|
-
import { innerHTML } from '../../../../atom/label/style.css';
|
|
32
31
|
import Footer from './footer';
|
|
33
32
|
import Header from './header';
|
|
34
33
|
import style from './style.css';
|
|
@@ -295,7 +294,7 @@ const ContextContent = ({
|
|
|
295
294
|
const paragraphs = descriptionParagraphs.map((paragraph, index) => /*#__PURE__*/React.createElement("p", {
|
|
296
295
|
key: index,
|
|
297
296
|
"data-name": "contextDescription",
|
|
298
|
-
className: classnames(style.contextDescription, innerHTML) // eslint-disable-next-line react/no-danger
|
|
297
|
+
className: classnames(style.contextDescription, style.innerHTML) // eslint-disable-next-line react/no-danger
|
|
299
298
|
,
|
|
300
299
|
dangerouslySetInnerHTML: {
|
|
301
300
|
__html: paragraph
|
|
@@ -325,7 +324,7 @@ const CONTENT_TYPE = {
|
|
|
325
324
|
const Help = ({
|
|
326
325
|
help
|
|
327
326
|
}) => /*#__PURE__*/React.createElement("div", {
|
|
328
|
-
className: classnames(style.helpView, innerHTML) // eslint-disable-next-line react/no-danger
|
|
327
|
+
className: classnames(style.helpView, style.innerHTML) // eslint-disable-next-line react/no-danger
|
|
329
328
|
,
|
|
330
329
|
dangerouslySetInnerHTML: {
|
|
331
330
|
__html: help
|
|
@@ -375,7 +374,7 @@ const ContentLayout = (props, context) => {
|
|
|
375
374
|
}
|
|
376
375
|
}, /*#__PURE__*/React.createElement("div", {
|
|
377
376
|
"data-name": "question",
|
|
378
|
-
className: classnames(selectedTab === 'context' ? style.contextTitle : style.question, innerHTML) // eslint-disable-next-line react/no-danger
|
|
377
|
+
className: classnames(selectedTab === 'context' ? style.contextTitle : style.question, style.innerHTML) // eslint-disable-next-line react/no-danger
|
|
379
378
|
,
|
|
380
379
|
dangerouslySetInnerHTML: {
|
|
381
380
|
__html: selectedTab === 'context' ? slideContext.title : question
|