@coorpacademy/components 10.24.0 → 10.24.1
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/autocomplete/index.js.map +1 -1
- package/es/atom/button-menu/index.js.map +1 -1
- package/es/atom/gradient/index.native.js +1 -1
- package/es/atom/gradient/index.native.js.map +1 -1
- package/es/atom/lottie-wrapper/index.js.map +1 -1
- package/es/atom/select/index.js.map +1 -1
- package/es/atom/select-modal/index.native.js +2 -2
- package/es/atom/select-modal/index.native.js.map +1 -1
- package/es/molecule/add-to-my-list/index.js +3 -2
- package/es/molecule/add-to-my-list/index.js.map +1 -1
- package/es/molecule/brand-tabs/index.js +22 -8
- package/es/molecule/brand-tabs/index.js.map +1 -1
- package/es/molecule/cm-popin/index.js +3 -3
- package/es/molecule/cm-popin/index.js.map +1 -1
- package/es/molecule/discipline-partners/index.js +1 -1
- package/es/molecule/discipline-partners/index.js.map +1 -1
- package/es/molecule/drag-and-drop/upload-report.js +43 -21
- package/es/molecule/drag-and-drop/upload-report.js.map +1 -1
- package/es/molecule/feedback/index.js +2 -2
- package/es/molecule/feedback/index.js.map +1 -1
- package/es/molecule/filters/index.js.map +1 -1
- package/es/molecule/menu-list/index.js +2 -1
- package/es/molecule/menu-list/index.js.map +1 -1
- package/es/molecule/questions/free-text/index.js.map +1 -1
- package/es/molecule/questions/free-text/index.native.js +12 -6
- package/es/molecule/questions/free-text/index.native.js.map +1 -1
- package/es/molecule/questions/mobile/template/index.native.js +42 -67
- package/es/molecule/questions/mobile/template/index.native.js.map +1 -1
- package/es/molecule/skill-card/index.js.map +1 -1
- package/es/template/common/discipline/index.js +1 -1
- package/es/template/common/discipline/index.js.map +1 -1
- package/es/template/teams-dashboard/index.js.map +1 -1
- package/es/util/navigation.js.map +1 -1
- package/es/util/proptypes.js.map +1 -1
- package/lib/atom/autocomplete/index.js.map +1 -1
- package/lib/atom/button-menu/index.js.map +1 -1
- package/lib/atom/gradient/index.native.js +1 -1
- package/lib/atom/gradient/index.native.js.map +1 -1
- package/lib/atom/lottie-wrapper/index.js.map +1 -1
- package/lib/atom/select/index.js.map +1 -1
- package/lib/atom/select-modal/index.native.js +2 -2
- package/lib/atom/select-modal/index.native.js.map +1 -1
- package/lib/molecule/add-to-my-list/index.js +2 -1
- package/lib/molecule/add-to-my-list/index.js.map +1 -1
- package/lib/molecule/brand-tabs/index.js +22 -8
- package/lib/molecule/brand-tabs/index.js.map +1 -1
- package/lib/molecule/cm-popin/index.js +3 -3
- package/lib/molecule/cm-popin/index.js.map +1 -1
- package/lib/molecule/discipline-partners/index.js +1 -1
- package/lib/molecule/discipline-partners/index.js.map +1 -1
- package/lib/molecule/drag-and-drop/upload-report.js +43 -22
- package/lib/molecule/drag-and-drop/upload-report.js.map +1 -1
- package/lib/molecule/feedback/index.js +2 -2
- package/lib/molecule/feedback/index.js.map +1 -1
- package/lib/molecule/filters/index.js.map +1 -1
- package/lib/molecule/menu-list/index.js +2 -1
- package/lib/molecule/menu-list/index.js.map +1 -1
- package/lib/molecule/questions/free-text/index.js.map +1 -1
- package/lib/molecule/questions/free-text/index.native.js +13 -6
- package/lib/molecule/questions/free-text/index.native.js.map +1 -1
- package/lib/molecule/questions/mobile/template/index.native.js +43 -67
- package/lib/molecule/questions/mobile/template/index.native.js.map +1 -1
- package/lib/molecule/skill-card/index.js.map +1 -1
- package/lib/template/common/discipline/index.js +1 -1
- package/lib/template/common/discipline/index.js.map +1 -1
- package/lib/template/teams-dashboard/index.js.map +1 -1
- package/lib/util/navigation.js.map +1 -1
- package/lib/util/proptypes.js.map +1 -1
- package/package.json +6 -5
|
@@ -21,14 +21,18 @@ var _templateContext = require("../../../../template/app-review/template-context
|
|
|
21
21
|
|
|
22
22
|
var _parseTemplateString = _interopRequireDefault(require("../../../../util/parse-template-string"));
|
|
23
23
|
|
|
24
|
+
var _shadow = require("../../../../variables/shadow");
|
|
25
|
+
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
26
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
29
|
|
|
28
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
31
|
|
|
32
|
+
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); }
|
|
33
|
+
|
|
30
34
|
const createStyleSheet = theme => ({
|
|
31
|
-
|
|
35
|
+
container: {
|
|
32
36
|
width: '100%',
|
|
33
37
|
flexDirection: 'row',
|
|
34
38
|
flexWrap: 'wrap',
|
|
@@ -38,21 +42,22 @@ const createStyleSheet = theme => ({
|
|
|
38
42
|
spaced: {
|
|
39
43
|
paddingVertical: theme.spacing.tiny
|
|
40
44
|
},
|
|
41
|
-
input: {
|
|
42
|
-
padding: theme.spacing.tiny,
|
|
43
|
-
borderWidth: 1,
|
|
44
|
-
borderColor: theme.colors.gray.lightMedium,
|
|
45
|
-
borderRadius: theme.radius.common,
|
|
46
|
-
backgroundColor: theme.colors.white,
|
|
47
|
-
minWidth: 175
|
|
48
|
-
},
|
|
49
45
|
htmlText: {
|
|
50
|
-
padding: theme.spacing.tiny,
|
|
51
46
|
color: theme.colors.black,
|
|
52
47
|
fontWeight: theme.fontWeight.bold,
|
|
53
|
-
lineHeight:
|
|
48
|
+
lineHeight: 25
|
|
54
49
|
},
|
|
55
|
-
|
|
50
|
+
// eslint-disable-next-line @coorpacademy/coorpacademy/no-overwriting-spread
|
|
51
|
+
selectInput: _extends({
|
|
52
|
+
padding: theme.spacing.tiny,
|
|
53
|
+
borderRadius: theme.radius.regular,
|
|
54
|
+
minWidth: 175,
|
|
55
|
+
marginHorizontal: 12,
|
|
56
|
+
paddingVertical: 16
|
|
57
|
+
}, _shadow.BOX_STYLE, {
|
|
58
|
+
backgroundColor: theme.colors.white
|
|
59
|
+
}),
|
|
60
|
+
selectText: {
|
|
56
61
|
color: theme.colors.gray.medium,
|
|
57
62
|
fontWeight: theme.fontWeight.bold,
|
|
58
63
|
fontSize: theme.fontSize.regular,
|
|
@@ -60,49 +65,10 @@ const createStyleSheet = theme => ({
|
|
|
60
65
|
}
|
|
61
66
|
});
|
|
62
67
|
|
|
63
|
-
const Section = ({
|
|
64
|
-
section,
|
|
65
|
-
choices,
|
|
66
|
-
index,
|
|
67
|
-
focusedSelectId,
|
|
68
|
-
onInputChange,
|
|
69
|
-
handleBlur,
|
|
70
|
-
handleFocus,
|
|
71
|
-
isDisabled,
|
|
72
|
-
styles
|
|
73
|
-
}) => {
|
|
74
|
-
const prefix = `question-section-${index + 1}`;
|
|
75
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
76
|
-
style: styles.section,
|
|
77
|
-
key: `container-${prefix}`
|
|
78
|
-
}, section.map((part, id) => {
|
|
79
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
80
|
-
key: `${prefix}-${id}`,
|
|
81
|
-
style: {
|
|
82
|
-
flexDirection: 'row'
|
|
83
|
-
}
|
|
84
|
-
}, /*#__PURE__*/_react.default.createElement(Item, {
|
|
85
|
-
prefix: prefix,
|
|
86
|
-
part: part,
|
|
87
|
-
choices: choices,
|
|
88
|
-
index: id,
|
|
89
|
-
focusedSelectId: focusedSelectId,
|
|
90
|
-
isDisabled: isDisabled,
|
|
91
|
-
handleBlur: handleBlur,
|
|
92
|
-
handleFocus: handleFocus,
|
|
93
|
-
onInputChange: onInputChange,
|
|
94
|
-
styles: styles
|
|
95
|
-
}), /*#__PURE__*/_react.default.createElement(_index3.default, {
|
|
96
|
-
type: "micro"
|
|
97
|
-
}));
|
|
98
|
-
}));
|
|
99
|
-
};
|
|
100
|
-
|
|
101
68
|
const Item = props => {
|
|
102
69
|
const {
|
|
103
70
|
part,
|
|
104
71
|
index,
|
|
105
|
-
prefix,
|
|
106
72
|
isDisabled = false,
|
|
107
73
|
focusedSelectId,
|
|
108
74
|
choices,
|
|
@@ -118,10 +84,9 @@ const Item = props => {
|
|
|
118
84
|
translations
|
|
119
85
|
} = templateContext;
|
|
120
86
|
const inputNames = choices.map(choice => choice.name);
|
|
121
|
-
const id =
|
|
87
|
+
const id = `question-part-${index + 1}`;
|
|
122
88
|
const isFocused = focusedSelectId === id;
|
|
123
|
-
const
|
|
124
|
-
borderColor: brandTheme.colors.primary,
|
|
89
|
+
const coloredText = brandTheme && {
|
|
125
90
|
color: brandTheme.colors.primary
|
|
126
91
|
};
|
|
127
92
|
|
|
@@ -155,10 +120,16 @@ const Item = props => {
|
|
|
155
120
|
}));
|
|
156
121
|
}
|
|
157
122
|
|
|
158
|
-
const
|
|
123
|
+
const selectInputStyle = [styles.selectInput];
|
|
159
124
|
|
|
160
125
|
if (value) {
|
|
161
|
-
|
|
126
|
+
selectInputStyle.push(coloredText);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const selectTextStyle = [styles.selectText];
|
|
130
|
+
|
|
131
|
+
if (value) {
|
|
132
|
+
selectTextStyle.push(coloredText);
|
|
162
133
|
}
|
|
163
134
|
|
|
164
135
|
if (choice.type === 'select') {
|
|
@@ -175,8 +146,8 @@ const Item = props => {
|
|
|
175
146
|
onBlur: handleBlur,
|
|
176
147
|
onFocus: handleFocus(id),
|
|
177
148
|
onChange: handleInputChange(choice),
|
|
178
|
-
textStyle:
|
|
179
|
-
style:
|
|
149
|
+
textStyle: selectTextStyle,
|
|
150
|
+
style: selectInputStyle,
|
|
180
151
|
analyticsID: `${id}-select${selectedSuffix}${disabledSuffix}`,
|
|
181
152
|
testID: `${id}-select${selectedSuffix}${disabledSuffix}`
|
|
182
153
|
}));
|
|
@@ -217,22 +188,27 @@ const QuestionTemplate = props => {
|
|
|
217
188
|
}
|
|
218
189
|
|
|
219
190
|
const parts = (0, _parseTemplateString.default)(template);
|
|
220
|
-
const sections = [parts]; // @todo remove useless sections
|
|
221
|
-
|
|
222
191
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
192
|
+
style: styleSheet.container,
|
|
223
193
|
testID: "question-template"
|
|
224
|
-
},
|
|
225
|
-
key:
|
|
226
|
-
|
|
194
|
+
}, parts.map((part, id) => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
195
|
+
key: `question-part-${id}`,
|
|
196
|
+
style: {
|
|
197
|
+
flexDirection: 'row'
|
|
198
|
+
}
|
|
199
|
+
}, /*#__PURE__*/_react.default.createElement(Item, {
|
|
200
|
+
part: part,
|
|
227
201
|
choices: choices,
|
|
228
|
-
index:
|
|
202
|
+
index: id,
|
|
203
|
+
focusedSelectId: focusedSelectId,
|
|
204
|
+
isDisabled: isDisabled,
|
|
229
205
|
handleBlur: handleBlur,
|
|
230
206
|
handleFocus: handleFocus,
|
|
231
|
-
focusedSelectId: focusedSelectId,
|
|
232
207
|
onInputChange: onInputChange,
|
|
233
|
-
isDisabled: isDisabled,
|
|
234
208
|
styles: styleSheet
|
|
235
|
-
})
|
|
209
|
+
}), /*#__PURE__*/_react.default.createElement(_index3.default, {
|
|
210
|
+
type: "micro"
|
|
211
|
+
}))));
|
|
236
212
|
};
|
|
237
213
|
|
|
238
214
|
var _default = QuestionTemplate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["createStyleSheet","theme","section","width","flexDirection","flexWrap","justifyContent","alignItems","spaced","paddingVertical","spacing","tiny","input","padding","borderWidth","borderColor","colors","gray","lightMedium","borderRadius","radius","common","backgroundColor","white","minWidth","htmlText","color","black","fontWeight","bold","lineHeight","text","medium","fontSize","regular","textAlign","Section","choices","index","focusedSelectId","onInputChange","handleBlur","handleFocus","isDisabled","styles","prefix","map","part","id","Item","props","templateContext","useTemplateContext","brandTheme","translations","inputNames","choice","name","isFocused","selectedStyle","primary","type","includes","value","choiceIndex","findIndex","disabledSuffix","selectedSuffix","handleInputChange","_item","_value","selectStyle","push","items","selectAnAnswer","trim","QuestionTemplate","template","styleSheet","setStylesheet","useState","useEffect","_stylesheet","parts","parseTemplateString","sections"],"sources":["../../../../../src/molecule/questions/mobile/template/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {TextStyle, View, ViewStyle} from 'react-native';\n\nimport trim from 'lodash/fp/trim';\n\nimport Html from '../../../../atom/html/index.native';\nimport Select from '../../../../atom/select-modal/index.native';\nimport Space from '../../../../atom/space/index.native';\nimport type {TemplateListOfChoices, TemplateTextChoice} from '../../types';\nimport FreeText from '../../free-text/index.native';\nimport {\n FocusedSelectId,\n HandleBlur,\n HandleFocus,\n useTemplateContext\n} from '../../../../template/app-review/template-context';\nimport {Theme} from '../../../../variables/theme.native';\nimport parseTemplateString from '../../../../util/parse-template-string';\n\ntype StyleSheetType = {\n section: ViewStyle;\n spaced: ViewStyle;\n input: ViewStyle;\n htmlText: TextStyle;\n text: TextStyle;\n};\n\nconst createStyleSheet = (theme: Theme): StyleSheetType => ({\n section: {\n width: '100%',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'center',\n alignItems: 'center'\n },\n spaced: {\n paddingVertical: theme.spacing.tiny\n },\n input: {\n padding: theme.spacing.tiny,\n borderWidth: 1,\n borderColor: theme.colors.gray.lightMedium,\n borderRadius: theme.radius.common,\n backgroundColor: theme.colors.white,\n minWidth: 175\n },\n htmlText: {\n padding: theme.spacing.tiny,\n color: theme.colors.black,\n fontWeight: theme.fontWeight.bold,\n lineHeight: 30\n },\n text: {\n color: theme.colors.gray.medium,\n fontWeight: theme.fontWeight.bold,\n fontSize: theme.fontSize.regular,\n textAlign: 'center'\n }\n});\n\ntype TemplatePart = {\n type: 'string' | 'answerField';\n value: string;\n};\n\ntype SectionProps = {\n isDisabled: boolean;\n section: Array<TemplatePart>;\n choices: Array<TemplateTextChoice | TemplateListOfChoices>;\n index: number;\n onInputChange: (item: TemplateTextChoice | TemplateListOfChoices, value: string) => void;\n focusedSelectId: FocusedSelectId;\n handleBlur: HandleBlur;\n handleFocus: HandleFocus;\n styles: any;\n};\n\nconst Section = ({\n section,\n choices,\n index,\n focusedSelectId,\n onInputChange,\n handleBlur,\n handleFocus,\n isDisabled,\n styles\n}: SectionProps) => {\n const prefix = `question-section-${index + 1}`;\n\n return (\n <View style={styles.section} key={`container-${prefix}`}>\n {section.map((part, id) => {\n return (\n <View key={`${prefix}-${id}`} style={{flexDirection: 'row'}}>\n <Item\n prefix={prefix}\n part={part}\n choices={choices}\n index={id}\n focusedSelectId={focusedSelectId}\n isDisabled={isDisabled}\n handleBlur={handleBlur}\n handleFocus={handleFocus}\n onInputChange={onInputChange}\n styles={styles}\n />\n <Space type=\"micro\" />\n </View>\n );\n })}\n </View>\n );\n};\n\ntype ItemProps = {\n part: TemplatePart;\n choices: Array<TemplateTextChoice | TemplateListOfChoices>;\n index: number;\n prefix: string;\n isDisabled?: boolean;\n onInputChange: (item: TemplateTextChoice | TemplateListOfChoices, value: string) => void;\n focusedSelectId: FocusedSelectId;\n handleBlur: HandleBlur;\n handleFocus: HandleFocus;\n styles: any;\n};\n\nconst Item = (props: ItemProps) => {\n const {\n part,\n index,\n prefix,\n isDisabled = false,\n focusedSelectId,\n choices,\n onInputChange,\n handleBlur,\n handleFocus,\n styles\n } = props;\n\n const templateContext = useTemplateContext();\n const {theme, brandTheme, translations} = templateContext;\n\n const inputNames = choices.map(choice => choice.name);\n const id = `${prefix}-part-${index + 1}`;\n const isFocused = focusedSelectId === id;\n\n const selectedStyle = brandTheme && {\n borderColor: brandTheme.colors.primary,\n color: brandTheme.colors.primary\n };\n\n if (part.type === 'answerField' && inputNames.includes(part.value)) {\n const choiceIndex = choices.findIndex(choice => choice.name === part.value);\n const choice = choices[choiceIndex];\n const {value} = choice;\n\n if (!choice || !choice.type || !choice.name) {\n return null;\n }\n\n const disabledSuffix = isDisabled ? '-disabled' : '';\n const selectedSuffix = value ? '-selected' : '';\n\n const handleInputChange = (_item: TemplateTextChoice | TemplateListOfChoices) => (\n _value: string\n ) => onInputChange(_item, _value);\n\n if (choice.type === 'text') {\n return (\n <View style={styles.spaced} testID={id}>\n <FreeText\n key={id}\n isDisabled={isDisabled}\n onChange={handleInputChange(choice)}\n value={value}\n testID={`${id}-text${selectedSuffix}${disabledSuffix}`}\n questionType=\"template\"\n />\n </View>\n );\n }\n\n const selectStyle: ViewStyle[] = [styles.input];\n if (value) {\n selectStyle.push(selectedStyle);\n }\n\n if (choice.type === 'select') {\n return (\n <View style={styles.spaced} testID={id}>\n <Select\n isDisabled={isDisabled}\n questionType=\"template\"\n values={choice.items}\n value={value}\n placeholder={translations.selectAnAnswer}\n isFocused={isFocused}\n onBlur={handleBlur}\n onFocus={handleFocus(id)}\n onChange={handleInputChange(choice)}\n textStyle={styles.text}\n style={selectStyle}\n analyticsID={`${id}-select${selectedSuffix}${disabledSuffix}`}\n testID={`${id}-select${selectedSuffix}${disabledSuffix}`}\n />\n </View>\n );\n }\n }\n\n return (\n <Html key={id} fontSize={theme.fontSize.regular} testID={id} style={styles.htmlText}>\n {trim(part.value || '')}\n </Html>\n );\n};\n\nexport type Props = {\n isDisabled?: boolean;\n template: string;\n choices: Array<TemplateTextChoice | TemplateListOfChoices>;\n onInputChange: (item: TemplateTextChoice | TemplateListOfChoices, value: string) => void;\n focusedSelectId: FocusedSelectId;\n handleBlur: HandleBlur;\n handleFocus: HandleFocus;\n};\n\nconst QuestionTemplate = (props: Props) => {\n const {\n template,\n onInputChange,\n choices,\n handleBlur,\n handleFocus,\n focusedSelectId,\n isDisabled = false\n } = props;\n\n const templateContext = useTemplateContext();\n const {theme} = 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 (!template || !styleSheet) {\n return null;\n }\n\n const parts: TemplatePart[] = parseTemplateString(template);\n const sections = [parts]; // @todo remove useless sections\n\n return (\n <View testID=\"question-template\">\n {sections.map((section, index) => (\n <Section\n key={index}\n section={section}\n choices={choices}\n index={index}\n handleBlur={handleBlur}\n handleFocus={handleFocus}\n focusedSelectId={focusedSelectId}\n onInputChange={onInputChange}\n isDisabled={isDisabled}\n styles={styleSheet}\n />\n ))}\n </View>\n );\n};\n\nexport default QuestionTemplate;\n"],"mappings":";;;;;AAAA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AAEA;;AACA;;AAOA;;;;;;;;AAUA,MAAMA,gBAAgB,GAAIC,KAAD,KAAmC;EAC1DC,OAAO,EAAE;IACPC,KAAK,EAAE,MADA;IAEPC,aAAa,EAAE,KAFR;IAGPC,QAAQ,EAAE,MAHH;IAIPC,cAAc,EAAE,QAJT;IAKPC,UAAU,EAAE;EALL,CADiD;EAQ1DC,MAAM,EAAE;IACNC,eAAe,EAAER,KAAK,CAACS,OAAN,CAAcC;EADzB,CARkD;EAW1DC,KAAK,EAAE;IACLC,OAAO,EAAEZ,KAAK,CAACS,OAAN,CAAcC,IADlB;IAELG,WAAW,EAAE,CAFR;IAGLC,WAAW,EAAEd,KAAK,CAACe,MAAN,CAAaC,IAAb,CAAkBC,WAH1B;IAILC,YAAY,EAA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AA9B;EACA,MAAMQ,QAAQ,GAAG,CAACF,KAAD,CAAjB,CA1ByC,CA0Bf;;EAE1B,oBACE,6BAAC,iBAAD;IAAM,MAAM,EAAC;EAAb,GACGE,QAAQ,CAACvC,GAAT,CAAa,CAAC5C,OAAD,EAAUoC,KAAV,kBACZ,6BAAC,OAAD;IACE,GAAG,EAAEA,KADP;IAEE,OAAO,EAAEpC,OAFX;IAGE,OAAO,EAAEmC,OAHX;IAIE,KAAK,EAAEC,KAJT;IAKE,UAAU,EAAEG,UALd;IAME,WAAW,EAAEC,WANf;IAOE,eAAe,EAAEH,eAPnB;IAQE,aAAa,EAAEC,aARjB;IASE,UAAU,EAAEG,UATd;IAUE,MAAM,EAAEmC;EAVV,EADD,CADH,CADF;AAkBD,CA9CD;;eAgDeF,gB"}
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["createStyleSheet","theme","container","width","flexDirection","flexWrap","justifyContent","alignItems","spaced","paddingVertical","spacing","tiny","htmlText","color","colors","black","fontWeight","bold","lineHeight","selectInput","padding","borderRadius","radius","regular","minWidth","marginHorizontal","BOX_STYLE","backgroundColor","white","selectText","gray","medium","fontSize","textAlign","Item","props","part","index","isDisabled","focusedSelectId","choices","onInputChange","handleBlur","handleFocus","styles","templateContext","useTemplateContext","brandTheme","translations","inputNames","map","choice","name","id","isFocused","coloredText","primary","type","includes","value","choiceIndex","findIndex","disabledSuffix","selectedSuffix","handleInputChange","_item","_value","selectInputStyle","push","selectTextStyle","items","selectAnAnswer","trim","QuestionTemplate","template","styleSheet","setStylesheet","useState","useEffect","_stylesheet","parts","parseTemplateString"],"sources":["../../../../../src/molecule/questions/mobile/template/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {TextStyle, View, ViewStyle} from 'react-native';\n\nimport trim from 'lodash/fp/trim';\n\nimport Html from '../../../../atom/html/index.native';\nimport Select from '../../../../atom/select-modal/index.native';\nimport Space from '../../../../atom/space/index.native';\nimport type {TemplateListOfChoices, TemplateTextChoice} from '../../types';\nimport FreeText from '../../free-text/index.native';\nimport {\n FocusedSelectId,\n HandleBlur,\n HandleFocus,\n useTemplateContext\n} from '../../../../template/app-review/template-context';\nimport {Theme} from '../../../../variables/theme.native';\nimport parseTemplateString from '../../../../util/parse-template-string';\nimport {BOX_STYLE} from '../../../../variables/shadow';\n\ntype StyleSheetType = {\n container: ViewStyle;\n spaced: ViewStyle;\n htmlText: TextStyle;\n selectInput: ViewStyle;\n selectText: TextStyle;\n};\n\nconst createStyleSheet = (theme: Theme): StyleSheetType => ({\n container: {\n width: '100%',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'center',\n alignItems: 'center'\n },\n spaced: {\n paddingVertical: theme.spacing.tiny\n },\n htmlText: {\n color: theme.colors.black,\n fontWeight: theme.fontWeight.bold,\n lineHeight: 25\n },\n // eslint-disable-next-line @coorpacademy/coorpacademy/no-overwriting-spread\n selectInput: {\n padding: theme.spacing.tiny,\n borderRadius: theme.radius.regular,\n minWidth: 175,\n marginHorizontal: 12,\n paddingVertical: 16,\n ...BOX_STYLE,\n backgroundColor: theme.colors.white\n },\n selectText: {\n color: theme.colors.gray.medium,\n fontWeight: theme.fontWeight.bold,\n fontSize: theme.fontSize.regular,\n textAlign: 'center'\n }\n});\n\ntype TemplatePart = {\n type: 'string' | 'answerField';\n value: string;\n};\n\ntype ItemProps = {\n part: TemplatePart;\n choices: Array<TemplateTextChoice | TemplateListOfChoices>;\n index: number;\n isDisabled?: boolean;\n onInputChange: (item: TemplateTextChoice | TemplateListOfChoices, value: string) => void;\n focusedSelectId: FocusedSelectId;\n handleBlur: HandleBlur;\n handleFocus: HandleFocus;\n styles: StyleSheetType;\n};\n\nconst Item = (props: ItemProps) => {\n const {\n part,\n index,\n isDisabled = false,\n focusedSelectId,\n choices,\n onInputChange,\n handleBlur,\n handleFocus,\n styles\n } = props;\n\n const templateContext = useTemplateContext();\n const {theme, brandTheme, translations} = templateContext;\n\n const inputNames = choices.map(choice => choice.name);\n const id = `question-part-${index + 1}`;\n const isFocused = focusedSelectId === id;\n\n const coloredText = brandTheme && {\n color: brandTheme.colors.primary\n };\n\n if (part.type === 'answerField' && inputNames.includes(part.value)) {\n const choiceIndex = choices.findIndex(choice => choice.name === part.value);\n const choice = choices[choiceIndex];\n const {value} = choice;\n\n if (!choice || !choice.type || !choice.name) {\n return null;\n }\n\n const disabledSuffix = isDisabled ? '-disabled' : '';\n const selectedSuffix = value ? '-selected' : '';\n\n const handleInputChange = (_item: TemplateTextChoice | TemplateListOfChoices) => (\n _value: string\n ) => onInputChange(_item, _value);\n\n if (choice.type === 'text') {\n return (\n <View style={styles.spaced} testID={id}>\n <FreeText\n key={id}\n isDisabled={isDisabled}\n onChange={handleInputChange(choice)}\n value={value}\n testID={`${id}-text${selectedSuffix}${disabledSuffix}`}\n questionType=\"template\"\n />\n </View>\n );\n }\n\n const selectInputStyle: ViewStyle[] = [styles.selectInput];\n if (value) {\n selectInputStyle.push(coloredText);\n }\n\n const selectTextStyle: ViewStyle[] = [styles.selectText];\n if (value) {\n selectTextStyle.push(coloredText);\n }\n\n if (choice.type === 'select') {\n return (\n <View style={styles.spaced} testID={id}>\n <Select\n isDisabled={isDisabled}\n questionType=\"template\"\n values={choice.items}\n value={value}\n placeholder={translations.selectAnAnswer}\n isFocused={isFocused}\n onBlur={handleBlur}\n onFocus={handleFocus(id)}\n onChange={handleInputChange(choice)}\n textStyle={selectTextStyle}\n style={selectInputStyle}\n analyticsID={`${id}-select${selectedSuffix}${disabledSuffix}`}\n testID={`${id}-select${selectedSuffix}${disabledSuffix}`}\n />\n </View>\n );\n }\n }\n\n return (\n <Html key={id} fontSize={theme.fontSize.regular} testID={id} style={styles.htmlText}>\n {trim(part.value || '')}\n </Html>\n );\n};\n\nexport type Props = {\n isDisabled?: boolean;\n template: string;\n choices: Array<TemplateTextChoice | TemplateListOfChoices>;\n onInputChange: (item: TemplateTextChoice | TemplateListOfChoices, value: string) => void;\n focusedSelectId: FocusedSelectId;\n handleBlur: HandleBlur;\n handleFocus: HandleFocus;\n};\n\nconst QuestionTemplate = (props: Props) => {\n const {\n template,\n onInputChange,\n choices,\n handleBlur,\n handleFocus,\n focusedSelectId,\n isDisabled = false\n } = props;\n\n const templateContext = useTemplateContext();\n const {theme} = 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 (!template || !styleSheet) {\n return null;\n }\n\n const parts: TemplatePart[] = parseTemplateString(template);\n\n return (\n <View style={styleSheet.container} testID=\"question-template\">\n {parts.map((part, id) => (\n <View key={`question-part-${id}`} style={{flexDirection: 'row'}}>\n <Item\n part={part}\n choices={choices}\n index={id}\n focusedSelectId={focusedSelectId}\n isDisabled={isDisabled}\n handleBlur={handleBlur}\n handleFocus={handleFocus}\n onInputChange={onInputChange}\n styles={styleSheet}\n />\n <Space type=\"micro\" />\n </View>\n ))}\n </View>\n );\n};\n\nexport default QuestionTemplate;\n"],"mappings":";;;;;AAAA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AAEA;;AACA;;AAOA;;AACA;;;;;;;;;;AAUA,MAAMA,gBAAgB,GAAIC,KAAD,KAAmC;EAC1DC,SAAS,EAAE;IACTC,KAAK,EAAE,MADE;IAETC,aAAa,EAAE,KAFN;IAGTC,QAAQ,EAAE,MAHD;IAITC,cAAc,EAAE,QAJP;IAKTC,UAAU,EAAE;EALH,CAD+C;EAQ1DC,MAAM,EAAE;IACNC,eAAe,EAAER,KAAK,CAACS,OAAN,CAAcC;EADzB,CARkD;EAW1DC,QAAQ,EAAE;IACRC,KAAK,EAAEZ,KAAK,CAACa,MAAN,CAAaC,KADZ;IAERC,UAAU,EAAEf,KAAK,CAACe,UAAN,CAAiBC,IAFrB;IAGRC,UAAU,EAAE;EAHJ,CAXgD;EAgB1D;EACAC,WAAW;IACTC,OAAO,EAAEnB,KAAK,CAACS,OAAN,CAAcC,IADd;IAETU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G/E,gBAAgB,CAACC,KAAD,CAApC;;IACA2E,aAAa,CAACG,WAAD,CAAb;EACD,CAHD,EAGG,CAAC9E,KAAD,CAHH;;EAKA,IAAI,CAACyE,QAAD,IAAa,CAACC,UAAlB,EAA8B;IAC5B,OAAO,IAAP;EACD;;EAED,MAAMK,KAAqB,GAAG,IAAAC,4BAAA,EAAoBP,QAApB,CAA9B;EAEA,oBACE,6BAAC,iBAAD;IAAM,KAAK,EAAEC,UAAU,CAACzE,SAAxB;IAAmC,MAAM,EAAC;EAA1C,GACG8E,KAAK,CAAC9B,GAAN,CAAU,CAACd,IAAD,EAAOiB,EAAP,kBACT,6BAAC,iBAAD;IAAM,GAAG,EAAG,iBAAgBA,EAAG,EAA/B;IAAkC,KAAK,EAAE;MAACjD,aAAa,EAAE;IAAhB;EAAzC,gBACE,6BAAC,IAAD;IACE,IAAI,EAAEgC,IADR;IAEE,OAAO,EAAEI,OAFX;IAGE,KAAK,EAAEa,EAHT;IAIE,eAAe,EAAEd,eAJnB;IAKE,UAAU,EAAED,UALd;IAME,UAAU,EAAEI,UANd;IAOE,WAAW,EAAEC,WAPf;IAQE,aAAa,EAAEF,aARjB;IASE,MAAM,EAAEkC;EATV,EADF,eAYE,6BAAC,eAAD;IAAO,IAAI,EAAC;EAAZ,EAZF,CADD,CADH,CADF;AAoBD,CA/CD;;eAiDeF,gB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getGradientBackground","baseColor","gradients","convert","SkillCard","props","context","ariaLabel","skillTitle","skillAriaLabel","buttonLabel","buttonAriaLabel","reviseLabel","reviseAriaLabel","onClick","isCustom","skin","hovered","setHovered","useState","primarySkinColor","getOr","handleMouseOver","useCallback","handleMouseLeave","buttonProps","customStyle","backgroundColor","color","transition","label","titleBackgroundColor","useMemo","titleBackground","style","skillCardWrapper","background","questionReviseText","questionReviseIcon","buttonWrapper","propTypes"],"sources":["../../../src/molecule/skill-card/index.js"],"sourcesContent":["import React, {useCallback, useState, useMemo} from 'react';\nimport {convert} from 'css-color-function';\nimport {NovaSolidInterfaceFeedbackInterfaceQuestionMark as QuestionIcon} from '@coorpacademy/nova-icons';\nimport getOr from 'lodash/fp/getOr';\nimport ButtonLink from '../../atom/button-link';\nimport style from './style.css';\nimport propTypes from './prop-types';\n\nconst getGradientBackground = baseColor => {\n const gradients = [\n convert(`color(${baseColor} lightness(30%))`),\n convert(`color(${baseColor} lightness(47%))`),\n convert(`color(${baseColor} lightness(55%))`)\n ];\n\n return `radial-gradient(62.12% 56.45% at 0% 77.29%, ${gradients[0]} 0%, ${convert(\n `color(${gradients[0]} a(0))`\n )} 100%), radial-gradient(113.85% 103.46% at 93.27% 7.88%, ${gradients[1]} 0%, ${convert(\n `color(${gradients[1]} a(0))`\n )} 100%), radial-gradient(49.66% 49.63% at 78.65% 86.26%, ${gradients[2]} 0%, ${convert(\n `color(${gradients[2]} a(0))`\n )} 100%), ${baseColor}`;\n};\n\nconst SkillCard = (props, context) => {\n const {\n 'aria-label': ariaLabel,\n skillTitle,\n skillAriaLabel,\n buttonLabel,\n buttonAriaLabel,\n reviseLabel,\n reviseAriaLabel,\n onClick,\n isCustom = false\n } = props;\n const {skin} = context;\n const [hovered, setHovered] = useState(false);\n const primarySkinColor = getOr('#00B0FF', 'common.primary', skin);\n\n const handleMouseOver = useCallback(() => setHovered(true), [setHovered]);\n\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const buttonProps = {\n customStyle: {\n backgroundColor: hovered ? primarySkinColor : convert(`color(${primarySkinColor} a(0.07))`),\n color: hovered ? '#FFFFFF' : primarySkinColor,\n transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out'\n },\n onClick,\n 'aria-label': buttonAriaLabel,\n label: buttonLabel,\n 'data-name': 'skill-card-button'\n };\n\n const titleBackgroundColor = useMemo(() => (isCustom ? '#128C72' : primarySkinColor)
|
|
1
|
+
{"version":3,"file":"index.js","names":["getGradientBackground","baseColor","gradients","convert","SkillCard","props","context","ariaLabel","skillTitle","skillAriaLabel","buttonLabel","buttonAriaLabel","reviseLabel","reviseAriaLabel","onClick","isCustom","skin","hovered","setHovered","useState","primarySkinColor","getOr","handleMouseOver","useCallback","handleMouseLeave","buttonProps","customStyle","backgroundColor","color","transition","label","titleBackgroundColor","useMemo","titleBackground","style","skillCardWrapper","background","questionReviseText","questionReviseIcon","buttonWrapper","propTypes"],"sources":["../../../src/molecule/skill-card/index.js"],"sourcesContent":["import React, {useCallback, useState, useMemo} from 'react';\nimport {convert} from 'css-color-function';\nimport {NovaSolidInterfaceFeedbackInterfaceQuestionMark as QuestionIcon} from '@coorpacademy/nova-icons';\nimport getOr from 'lodash/fp/getOr';\nimport ButtonLink from '../../atom/button-link';\nimport style from './style.css';\nimport propTypes from './prop-types';\n\nconst getGradientBackground = baseColor => {\n const gradients = [\n convert(`color(${baseColor} lightness(30%))`),\n convert(`color(${baseColor} lightness(47%))`),\n convert(`color(${baseColor} lightness(55%))`)\n ];\n\n return `radial-gradient(62.12% 56.45% at 0% 77.29%, ${gradients[0]} 0%, ${convert(\n `color(${gradients[0]} a(0))`\n )} 100%), radial-gradient(113.85% 103.46% at 93.27% 7.88%, ${gradients[1]} 0%, ${convert(\n `color(${gradients[1]} a(0))`\n )} 100%), radial-gradient(49.66% 49.63% at 78.65% 86.26%, ${gradients[2]} 0%, ${convert(\n `color(${gradients[2]} a(0))`\n )} 100%), ${baseColor}`;\n};\n\nconst SkillCard = (props, context) => {\n const {\n 'aria-label': ariaLabel,\n skillTitle,\n skillAriaLabel,\n buttonLabel,\n buttonAriaLabel,\n reviseLabel,\n reviseAriaLabel,\n onClick,\n isCustom = false\n } = props;\n const {skin} = context;\n const [hovered, setHovered] = useState(false);\n const primarySkinColor = getOr('#00B0FF', 'common.primary', skin);\n\n const handleMouseOver = useCallback(() => setHovered(true), [setHovered]);\n\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const buttonProps = {\n customStyle: {\n backgroundColor: hovered ? primarySkinColor : convert(`color(${primarySkinColor} a(0.07))`),\n color: hovered ? '#FFFFFF' : primarySkinColor,\n transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out'\n },\n onClick,\n 'aria-label': buttonAriaLabel,\n label: buttonLabel,\n 'data-name': 'skill-card-button'\n };\n\n const titleBackgroundColor = useMemo(\n () => (isCustom ? '#128C72' : primarySkinColor),\n [isCustom, primarySkinColor]\n );\n\n const titleBackground = useMemo(\n () => getGradientBackground(titleBackgroundColor),\n [titleBackgroundColor]\n );\n\n return (\n <div className={style.skillCardWrapper} data-name=\"skill-card-wrapper\" aria-label={ariaLabel}>\n <div\n data-name=\"skill-title\"\n className={style.skillTitle}\n aria-label={skillAriaLabel || skillTitle}\n style={{\n background: titleBackground\n }}\n >\n {skillTitle}\n </div>\n <div data-name=\"card-content-wrapper\">\n <div\n className={style.questionReviseText}\n data-name=\"questions-to-revise-label\"\n aria-label={reviseAriaLabel || reviseLabel}\n >\n <QuestionIcon className={style.questionReviseIcon} width={16} height={16} />\n {reviseLabel}\n </div>\n <div\n className={style.buttonWrapper}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n data-name=\"button-wrapper\"\n >\n <ButtonLink {...buttonProps} />\n </div>\n </div>\n </div>\n );\n};\n\nSkillCard.propTypes = propTypes;\n\nexport default SkillCard;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,qBAAqB,GAAGC,SAAS,IAAI;EACzC,MAAMC,SAAS,GAAG,CAChB,IAAAC,yBAAA,EAAS,SAAQF,SAAU,kBAA3B,CADgB,EAEhB,IAAAE,yBAAA,EAAS,SAAQF,SAAU,kBAA3B,CAFgB,EAGhB,IAAAE,yBAAA,EAAS,SAAQF,SAAU,kBAA3B,CAHgB,CAAlB;EAMA,OAAQ,+CAA8CC,SAAS,CAAC,CAAD,CAAI,QAAO,IAAAC,yBAAA,EACvE,SAAQD,SAAS,CAAC,CAAD,CAAI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oB,GAAG,IAAAC,cAAA,EAC3B,MAAOjB,QAAQ,GAAG,SAAH,GAAeK,gBADH,EAE3B,CAACL,QAAD,EAAWK,gBAAX,CAF2B,CAA7B;EAKA,MAAMa,eAAe,GAAG,IAAAD,cAAA,EACtB,MAAMhC,qBAAqB,CAAC+B,oBAAD,CADL,EAEtB,CAACA,oBAAD,CAFsB,CAAxB;EAKA,oBACE;IAAK,SAAS,EAAEG,cAAA,CAAMC,gBAAtB;IAAwC,aAAU,oBAAlD;IAAuE,cAAY5B;EAAnF,gBACE;IACE,aAAU,aADZ;IAEE,SAAS,EAAE2B,cAAA,CAAM1B,UAFnB;IAGE,cAAYC,cAAc,IAAID,UAHhC;IAIE,KAAK,EAAE;MACL4B,UAAU,EAAEH;IADP;EAJT,GAQGzB,UARH,CADF,eAWE;IAAK,aAAU;EAAf,gBACE;IACE,SAAS,EAAE0B,cAAA,CAAMG,kBADnB;IAEE,aAAU,2BAFZ;IAGE,cAAYxB,eAAe,IAAID;EAHjC,gBAKE,6BAAC,0DAAD;IAAc,SAAS,EAAEsB,cAAA,CAAMI,kBAA/B;IAAmD,KAAK,EAAE,EAA1D;IAA8D,MAAM,EAAE;EAAtE,EALF,EAMG1B,WANH,CADF,eASE;IACE,SAAS,EAAEsB,cAAA,CAAMK,aADnB;IAEE,WAAW,EAAEjB,eAFf;IAGE,YAAY,EAAEE,gBAHhB;IAIE,aAAU;EAJZ,gBAME,6BAAC,mBAAD,EAAgBC,WAAhB,CANF,CATF,CAXF,CADF;AAgCD,CA1ED;;AA4EArB,SAAS,CAACoC,SAAV,2CAAsBA,kBAAtB;eAEepC,S"}
|
|
@@ -142,7 +142,7 @@ const Discipline = (props, context) => {
|
|
|
142
142
|
removeFromMyListText: removeFromMyListText,
|
|
143
143
|
favorite: favorite
|
|
144
144
|
});
|
|
145
|
-
const addToMyListProviderWrap = disableAddToMyList ?
|
|
145
|
+
const addToMyListProviderWrap = disableAddToMyList ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, shareFeedBack, discipline) : /*#__PURE__*/_react.default.createElement(_addToMyList.AddToMyListStatusProvider, null, shareFeedBack, addToMyListFeedback, discipline);
|
|
146
146
|
const shareProviderWrap = disableShare ? addToMyListProviderWrap : /*#__PURE__*/_react.default.createElement(_share.ShareStatusProvider, null, addToMyListProviderWrap);
|
|
147
147
|
return shareProviderWrap;
|
|
148
148
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Discipline","props","context","selected","level","levels","changeLevel","image","title","video","authors","description","start","buy","startLabel","buyLabel","shareWording","shareText","shareSuccessWording","shareErrorWording","addToMyListButton","favorite","onFavoriteClick","addToMyListText","removeFromMyListText","disableShare","disableAddToMyList","authorSection","isEmpty","style","partners","disciplineCTA","disciplineContent","content","disciplineHeader","header","discipline","container","leftSection","mobileAuthorCtaSection","columnReverse","cta","addToMyListBtn","shareBtn","rightSection","stickySection","buttons","shareFeedBack","addToMyListFeedback","addToMyListProviderWrap","shareProviderWrap","propTypes","DisciplineHeader","DisciplineCTA","DisciplinePartners","DisciplineScope","onClick","Share","wording","text","ShareFeedback","successWording","errorWording","AddToMyListFeedback","AddToMyList","PropTypes","bool","contextTypes","translate","func"],"sources":["../../../../src/template/common/discipline/index.js"],"sourcesContent":["import React from 'react';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport PropTypes from 'prop-types';\nimport DisciplineCTA from '../../../molecule/discipline-cta';\nimport DisciplineHeader from '../../../molecule/discipline-header';\nimport DisciplinePartners from '../../../molecule/discipline-partners';\nimport DisciplineScope from '../../../molecule/discipline-scope';\nimport Share, {ShareFeedback, ShareStatusProvider} from '../../../molecule/share';\nimport AddToMyList, {\n AddToMyListFeedback,\n AddToMyListStatusProvider\n} from '../../../molecule/add-to-my-list';\nimport style from './style.css';\n\nconst Discipline = (props, context) => {\n const {\n selected = 0,\n level,\n levels,\n changeLevel,\n image,\n title = '',\n video,\n authors = [],\n description = '',\n start,\n buy,\n startLabel,\n buyLabel,\n shareWording,\n shareText,\n shareSuccessWording,\n shareErrorWording,\n addToMyListButton,\n favorite,\n onFavoriteClick,\n addToMyListText,\n removeFromMyListText,\n disableShare = false,\n disableAddToMyList = false\n } = props;\n\n const authorSection = isEmpty(authors) ? null : (\n <div className={style.partners}>\n <DisciplinePartners authors={authors} />\n </div>\n );\n\n const disciplineCTA = (\n <DisciplineCTA\n type={'discipline'}\n start={start}\n buy={buy}\n startLabel={startLabel}\n buyLabel={buyLabel}\n />\n );\n\n const disciplineContent = (\n <div className={style.content}>\n <DisciplineScope content={level} levels={levels} selected={selected} onClick={changeLevel} />\n </div>\n );\n\n const disciplineHeader = (\n <div className={style.header}>\n <DisciplineHeader image={image} video={video} title={title} description={description} />\n </div>\n );\n\n const discipline = (\n <div data-name=\"discipline\" className={style.container} key=\"discipline\">\n <div className={style.leftSection}>\n {disciplineHeader}\n <div className={style.mobileAuthorCtaSection}>\n <div className={style.columnReverse}>\n <div className={style.cta}>{disciplineCTA}</div>\n {disableAddToMyList ? null : (\n <AddToMyList\n style={style.addToMyListBtn}\n addToMyListButton={addToMyListButton}\n favorite={favorite}\n onFavoriteClick={onFavoriteClick}\n key={'addToMyListTablet'}\n />\n )}\n {disableShare ? null : (\n <Share\n style={style.shareBtn}\n wording={shareWording}\n text={shareText}\n key={'shareTablet'}\n />\n )}\n </div>\n {authorSection}\n </div>\n {disciplineContent}\n </div>\n <div className={style.rightSection}>\n <div className={style.stickySection}>\n <div className={style.cta}>\n {disciplineCTA}\n {disableShare && disableAddToMyList ? null : (\n <div className={style.buttons}>\n {disableShare ? null : (\n <Share\n style={style.shareBtn}\n wording={shareWording}\n text={shareText}\n key={'shareDesktop'}\n />\n )}\n {disableAddToMyList ? null : (\n <AddToMyList\n style={style.addToMyListBtn}\n addToMyListButton={addToMyListButton}\n favorite={favorite}\n onFavoriteClick={onFavoriteClick}\n key={'addToMyListDesktop'}\n />\n )}\n </div>\n )}\n </div>\n {authorSection}\n </div>\n </div>\n </div>\n );\n\n const shareFeedBack = disableShare ? null : (\n <ShareFeedback\n errorWording={shareErrorWording}\n successWording={shareSuccessWording}\n key=\"shareFeedBack\"\n />\n );\n\n const addToMyListFeedback = disableAddToMyList ? null : (\n <AddToMyListFeedback\n addToMyListText={addToMyListText}\n removeFromMyListText={removeFromMyListText}\n favorite={favorite}\n />\n );\n\n const addToMyListProviderWrap = disableAddToMyList ? (\n [shareFeedBack, discipline]\n ) : (\n <AddToMyListStatusProvider>\n {shareFeedBack}\n {addToMyListFeedback}\n {discipline}\n </AddToMyListStatusProvider>\n );\n const shareProviderWrap = disableShare ? (\n addToMyListProviderWrap\n ) : (\n <ShareStatusProvider>{addToMyListProviderWrap}</ShareStatusProvider>\n );\n\n return shareProviderWrap;\n};\n\nDiscipline.propTypes = {\n image: DisciplineHeader.propTypes.image,\n video: DisciplineHeader.propTypes.video,\n title: DisciplineHeader.propTypes.title,\n description: DisciplineHeader.propTypes.description,\n start: DisciplineCTA.propTypes.start,\n buy: DisciplineCTA.propTypes.buy,\n startLabel: DisciplineCTA.propTypes.startLabel,\n buyLabel: DisciplineCTA.propTypes.buyLabel,\n authors: DisciplinePartners.propTypes.authors,\n level: DisciplineScope.propTypes.content,\n levels: DisciplineScope.propTypes.levels,\n selected: DisciplineScope.propTypes.selected,\n changeLevel: DisciplineScope.propTypes.onClick,\n shareWording: Share.propTypes.wording,\n shareText: Share.propTypes.text,\n shareSuccessWording: ShareFeedback.propTypes.successWording,\n shareErrorWording: ShareFeedback.propTypes.errorWording,\n addToMyListText: AddToMyListFeedback.propTypes.addToMyListText,\n removeFromMyListText: AddToMyListFeedback.propTypes.removeFromMyListText,\n addToMyListButton: AddToMyList.propTypes.addToMyListButton,\n onFavoriteClick: AddToMyList.propTypes.onFavoriteClick,\n favorite: AddToMyList.propTypes.favorite,\n disableShare: PropTypes.bool,\n disableAddToMyList: PropTypes.bool\n};\n\nDiscipline.contextTypes = {\n translate: PropTypes.func\n};\n\nexport default Discipline;\n"],"mappings":";;;;;AAAA;;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{"version":3,"file":"index.js","names":["Discipline","props","context","selected","level","levels","changeLevel","image","title","video","authors","description","start","buy","startLabel","buyLabel","shareWording","shareText","shareSuccessWording","shareErrorWording","addToMyListButton","favorite","onFavoriteClick","addToMyListText","removeFromMyListText","disableShare","disableAddToMyList","authorSection","isEmpty","style","partners","disciplineCTA","disciplineContent","content","disciplineHeader","header","discipline","container","leftSection","mobileAuthorCtaSection","columnReverse","cta","addToMyListBtn","shareBtn","rightSection","stickySection","buttons","shareFeedBack","addToMyListFeedback","addToMyListProviderWrap","shareProviderWrap","propTypes","DisciplineHeader","DisciplineCTA","DisciplinePartners","DisciplineScope","onClick","Share","wording","text","ShareFeedback","successWording","errorWording","AddToMyListFeedback","AddToMyList","PropTypes","bool","contextTypes","translate","func"],"sources":["../../../../src/template/common/discipline/index.js"],"sourcesContent":["import React from 'react';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport PropTypes from 'prop-types';\nimport DisciplineCTA from '../../../molecule/discipline-cta';\nimport DisciplineHeader from '../../../molecule/discipline-header';\nimport DisciplinePartners from '../../../molecule/discipline-partners';\nimport DisciplineScope from '../../../molecule/discipline-scope';\nimport Share, {ShareFeedback, ShareStatusProvider} from '../../../molecule/share';\nimport AddToMyList, {\n AddToMyListFeedback,\n AddToMyListStatusProvider\n} from '../../../molecule/add-to-my-list';\nimport style from './style.css';\n\nconst Discipline = (props, context) => {\n const {\n selected = 0,\n level,\n levels,\n changeLevel,\n image,\n title = '',\n video,\n authors = [],\n description = '',\n start,\n buy,\n startLabel,\n buyLabel,\n shareWording,\n shareText,\n shareSuccessWording,\n shareErrorWording,\n addToMyListButton,\n favorite,\n onFavoriteClick,\n addToMyListText,\n removeFromMyListText,\n disableShare = false,\n disableAddToMyList = false\n } = props;\n\n const authorSection = isEmpty(authors) ? null : (\n <div className={style.partners}>\n <DisciplinePartners authors={authors} />\n </div>\n );\n\n const disciplineCTA = (\n <DisciplineCTA\n type={'discipline'}\n start={start}\n buy={buy}\n startLabel={startLabel}\n buyLabel={buyLabel}\n />\n );\n\n const disciplineContent = (\n <div className={style.content}>\n <DisciplineScope content={level} levels={levels} selected={selected} onClick={changeLevel} />\n </div>\n );\n\n const disciplineHeader = (\n <div className={style.header}>\n <DisciplineHeader image={image} video={video} title={title} description={description} />\n </div>\n );\n\n const discipline = (\n <div data-name=\"discipline\" className={style.container} key=\"discipline\">\n <div className={style.leftSection}>\n {disciplineHeader}\n <div className={style.mobileAuthorCtaSection}>\n <div className={style.columnReverse}>\n <div className={style.cta}>{disciplineCTA}</div>\n {disableAddToMyList ? null : (\n <AddToMyList\n style={style.addToMyListBtn}\n addToMyListButton={addToMyListButton}\n favorite={favorite}\n onFavoriteClick={onFavoriteClick}\n key={'addToMyListTablet'}\n />\n )}\n {disableShare ? null : (\n <Share\n style={style.shareBtn}\n wording={shareWording}\n text={shareText}\n key={'shareTablet'}\n />\n )}\n </div>\n {authorSection}\n </div>\n {disciplineContent}\n </div>\n <div className={style.rightSection}>\n <div className={style.stickySection}>\n <div className={style.cta}>\n {disciplineCTA}\n {disableShare && disableAddToMyList ? null : (\n <div className={style.buttons}>\n {disableShare ? null : (\n <Share\n style={style.shareBtn}\n wording={shareWording}\n text={shareText}\n key={'shareDesktop'}\n />\n )}\n {disableAddToMyList ? null : (\n <AddToMyList\n style={style.addToMyListBtn}\n addToMyListButton={addToMyListButton}\n favorite={favorite}\n onFavoriteClick={onFavoriteClick}\n key={'addToMyListDesktop'}\n />\n )}\n </div>\n )}\n </div>\n {authorSection}\n </div>\n </div>\n </div>\n );\n\n const shareFeedBack = disableShare ? null : (\n <ShareFeedback\n errorWording={shareErrorWording}\n successWording={shareSuccessWording}\n key=\"shareFeedBack\"\n />\n );\n\n const addToMyListFeedback = disableAddToMyList ? null : (\n <AddToMyListFeedback\n addToMyListText={addToMyListText}\n removeFromMyListText={removeFromMyListText}\n favorite={favorite}\n />\n );\n\n const addToMyListProviderWrap = disableAddToMyList ? (\n <>\n {shareFeedBack}\n {discipline}\n </>\n ) : (\n <AddToMyListStatusProvider>\n {shareFeedBack}\n {addToMyListFeedback}\n {discipline}\n </AddToMyListStatusProvider>\n );\n const shareProviderWrap = disableShare ? (\n addToMyListProviderWrap\n ) : (\n <ShareStatusProvider>{addToMyListProviderWrap}</ShareStatusProvider>\n );\n\n return shareProviderWrap;\n};\n\nDiscipline.propTypes = {\n image: DisciplineHeader.propTypes.image,\n video: DisciplineHeader.propTypes.video,\n title: DisciplineHeader.propTypes.title,\n description: DisciplineHeader.propTypes.description,\n start: DisciplineCTA.propTypes.start,\n buy: DisciplineCTA.propTypes.buy,\n startLabel: DisciplineCTA.propTypes.startLabel,\n buyLabel: DisciplineCTA.propTypes.buyLabel,\n authors: DisciplinePartners.propTypes.authors,\n level: DisciplineScope.propTypes.content,\n levels: DisciplineScope.propTypes.levels,\n selected: DisciplineScope.propTypes.selected,\n changeLevel: DisciplineScope.propTypes.onClick,\n shareWording: Share.propTypes.wording,\n shareText: Share.propTypes.text,\n shareSuccessWording: ShareFeedback.propTypes.successWording,\n shareErrorWording: ShareFeedback.propTypes.errorWording,\n addToMyListText: AddToMyListFeedback.propTypes.addToMyListText,\n removeFromMyListText: AddToMyListFeedback.propTypes.removeFromMyListText,\n addToMyListButton: AddToMyList.propTypes.addToMyListButton,\n onFavoriteClick: AddToMyList.propTypes.onFavoriteClick,\n favorite: AddToMyList.propTypes.favorite,\n disableShare: PropTypes.bool,\n disableAddToMyList: PropTypes.bool\n};\n\nDiscipline.contextTypes = {\n translate: PropTypes.func\n};\n\nexport default Discipline;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;;;;;;;AAEA,MAAMA,UAAU,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACrC,MAAM;IACJC,QAAQ,GAAG,CADP;IAEJC,KAFI;IAGJC,MAHI;IAIJC,WAJI;IAKJC,KALI;IAMJC,KAAK,GAAG,EANJ;IAOJC,KAPI;IAQJC,OAAO,GAA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WrB5B,MAAM,EAAEkD,wBAAA,CAAgBJ,SAAhB,CAA0B9C,MAXb;EAYrBF,QAAQ,EAAEoD,wBAAA,CAAgBJ,SAAhB,CAA0BhD,QAZf;EAarBG,WAAW,EAAEiD,wBAAA,CAAgBJ,SAAhB,CAA0BK,OAblB;EAcrBxC,YAAY,EAAEyC,cAAA,CAAMN,SAAN,CAAgBO,OAdT;EAerBzC,SAAS,EAAEwC,cAAA,CAAMN,SAAN,CAAgBQ,IAfN;EAgBrBzC,mBAAmB,EAAE0C,oBAAA,CAAcT,SAAd,CAAwBU,cAhBxB;EAiBrB1C,iBAAiB,EAAEyC,oBAAA,CAAcT,SAAd,CAAwBW,YAjBtB;EAkBrBvC,eAAe,EAAEwC,gCAAA,CAAoBZ,SAApB,CAA8B5B,eAlB1B;EAmBrBC,oBAAoB,EAAEuC,gCAAA,CAAoBZ,SAApB,CAA8B3B,oBAnB/B;EAoBrBJ,iBAAiB,EAAE4C,oBAAA,CAAYb,SAAZ,CAAsB/B,iBApBpB;EAqBrBE,eAAe,EAAE0C,oBAAA,CAAYb,SAAZ,CAAsB7B,eArBlB;EAsBrBD,QAAQ,EAAE2C,oBAAA,CAAYb,SAAZ,CAAsB9B,QAtBX;EAuBrBI,YAAY,EAAEwC,kBAAA,CAAUC,IAvBH;EAwBrBxC,kBAAkB,EAAEuC,kBAAA,CAAUC;AAxBT,CAAvB;AA2BAlE,UAAU,CAACmE,YAAX,GAA0B;EACxBC,SAAS,EAAEH,kBAAA,CAAUI;AADG,CAA1B;eAIerE,U"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["TeamsDashboard","logo","platformLinks","sections","isLoading","isShadowed","setShadowed","useState","onMenuOpen","useCallback","onMenuClose","buildSection","section","index","title","sectionsList","useMemo","convert","cap","style","loader","shadowedTeamsDashboard","teamsDashboard","sectionsWrapper","propTypes","MoocHeader","PropTypes","arrayOf","shape","Cta","CardsList","bool"],"sources":["../../../src/template/teams-dashboard/index.js"],"sourcesContent":["import React, {useState, useCallback, useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {map} from 'lodash/fp';\nimport MoocHeader from '../../organism/mooc-header';\nimport Cta from '../../atom/cta';\nimport Loader from '../../atom/loader';\nimport CardsList from '../../molecule/dashboard/cards-list';\nimport style from './style.css';\n\nconst TeamsDashboard = ({logo, platformLinks, sections, isLoading}) => {\n const [isShadowed, setShadowed] = useState(false);\n const onMenuOpen = useCallback(() => setShadowed(true), []);\n const onMenuClose = useCallback(() => setShadowed(false), []);\n\n const buildSection = useCallback((section, index) => {\n return <CardsList {...section} key={section.title + index} />;\n }, []);\n\n const sectionsList = useMemo(() => map.convert({cap: false})(buildSection, sections)
|
|
1
|
+
{"version":3,"file":"index.js","names":["TeamsDashboard","logo","platformLinks","sections","isLoading","isShadowed","setShadowed","useState","onMenuOpen","useCallback","onMenuClose","buildSection","section","index","title","sectionsList","useMemo","convert","cap","style","loader","shadowedTeamsDashboard","teamsDashboard","sectionsWrapper","propTypes","MoocHeader","PropTypes","arrayOf","shape","Cta","CardsList","bool"],"sources":["../../../src/template/teams-dashboard/index.js"],"sourcesContent":["import React, {useState, useCallback, useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {map} from 'lodash/fp';\nimport MoocHeader from '../../organism/mooc-header';\nimport Cta from '../../atom/cta';\nimport Loader from '../../atom/loader';\nimport CardsList from '../../molecule/dashboard/cards-list';\nimport style from './style.css';\n\nconst TeamsDashboard = ({logo, platformLinks, sections, isLoading}) => {\n const [isShadowed, setShadowed] = useState(false);\n const onMenuOpen = useCallback(() => setShadowed(true), []);\n const onMenuClose = useCallback(() => setShadowed(false), []);\n\n const buildSection = useCallback((section, index) => {\n return <CardsList {...section} key={section.title + index} />;\n }, []);\n\n const sectionsList = useMemo(\n () => map.convert({cap: false})(buildSection, sections),\n [buildSection, sections]\n );\n\n return isLoading ? (\n <div className={style.loader}>\n <Loader data-name=\"teams-dashboard-loader\" />\n </div>\n ) : (\n <div\n data-name=\"teams-dashboard\"\n className={isShadowed ? style.shadowedTeamsDashboard : style.teamsDashboard}\n >\n <MoocHeader\n data-name=\"teams-dashboard-header\"\n logo={logo}\n links={platformLinks}\n onMenuOpen={onMenuOpen}\n onMenuClose={onMenuClose}\n />\n <div data-name=\"sections-wrapper\" className={isShadowed ? style.sectionsWrapper : null}>\n {sectionsList}\n </div>\n </div>\n );\n};\n\nTeamsDashboard.propTypes = {\n logo: MoocHeader.propTypes.logo,\n platformLinks: PropTypes.arrayOf(PropTypes.shape(Cta.propTypes)),\n sections: PropTypes.arrayOf(PropTypes.shape(CardsList.propTypes)),\n isLoading: PropTypes.bool\n};\n\nexport default TeamsDashboard;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,cAAc,GAAG,CAAC;EAACC,IAAD;EAAOC,aAAP;EAAsBC,QAAtB;EAAgCC;AAAhC,CAAD,KAAgD;EACrE,MAAM,CAACC,UAAD,EAAaC,WAAb,IAA4B,IAAAC,eAAA,EAAS,KAAT,CAAlC;EACA,MAAMC,UAAU,GAAG,IAAAC,kBAAA,EAAY,MAAMH,WAAW,CAAC,IAAD,CAA7B,EAAqC,EAArC,CAAnB;EACA,MAAMI,WAAW,GAAG,IAAAD,kBAAA,EAAY,MAAMH,WAAW,CAAC,KAAD,CAA7B,EAAsC,EAAtC,CAApB;EAEA,MAAMK,YAAY,GAAG,IAAAF,kBAAA,EAAY,CAACG,OAAD,EAAUC,KAAV,KAAoB;IACnD,oBAAO,6BAAC,kBAAD,eAAeD,OAAf;MAAwB,GAAG,EAAEA,OAAO,CAACE,KAAR,GAAgBD;IAA7C,GAAP;EACD,CAFoB,EAElB,EAFkB,CAArB;EAIA,MAAME,YAAY,GAAG,IAAAC,cAAA,EACnB,MAAM,cAAIC,OAAJ,CAAY;IAACC,GAAG,EAAE;EAAN,CAAZ,EAA0BP,YAA1B,EAAwCR,QAAxC,CADa,EAEnB,CAACQ,YAAD,EAAeR,QAAf,CAFmB,CAArB;EAKA,OAAOC,SAAS,gBACd;IAAK,SAAS,EAAEe,cAAA,CAAMC;EAAtB,gBACE,6BAAC,eAAD;IAAQ,aAAU;EAAlB,EADF,CADc,gBAKd;IACE,aAAU,iBADZ;IAEE,SAAS,EAAEf,UAAU,GAAGc,cAAA,CAAME,sBAAT,GAAkCF,cAAA,CAAMG;EAF/D,gBAIE,6BAAC,mBAAD;IACE,aAAU,wBADZ;IAEE,IAAI,EAAErB,IAFR;IAGE,KAAK,EAAEC,aAHT;IAIE,UAAU,EAAEM,UAJd;IAKE,WAAW,EAAEE;EALf,EAJF,eAWE;IAAK,aAAU,kBAAf;IAAkC,SAAS,EAAEL,UAAU,GAAGc,cAAA,CAAMI,eAAT,GAA2B;EAAlF,GACGR,YADH,CAXF,CALF;AAqBD,CAnCD;;AAqCAf,cAAc,CAACwB,SAAf,2CAA2B;EACzBvB,IAAI,EAAEwB,mBAAA,CAAWD,SAAX,CAAqBvB,IADF;EAEzBC,aAAa,EAAEwB,kBAAA,CAAUC,OAAV,CAAkBD,kBAAA,CAAUE,KAAV,CAAgBC,YAAA,CAAIL,SAApB,CAAlB,CAFU;EAGzBrB,QAAQ,EAAEuB,kBAAA,CAAUC,OAAV,CAAkBD,kBAAA,CAAUE,KAAV,CAAgBE,kBAAA,CAAUN,SAA1B,CAAlB,CAHe;EAIzBpB,SAAS,EAAEsB,kBAAA,CAAUK;AAJI,CAA3B;eAOe/B,c"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","names":["isLeftClickEvent","e","button","isModifiedEvent","metaKey","altKey","ctrlKey","shiftKey","navigation","options","_history","href","defaultPrevented","parse","host","preventDefault","push"],"sources":["../../src/util/navigation.js"],"sourcesContent":["/* eslint-disable node/no-deprecated-api */\nimport {parse} from 'url';\nimport {getOr, has, noop} from 'lodash/fp';\n\nconst isLeftClickEvent = e => e.button === 0;\nconst isModifiedEvent = e => !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);\n\nconst navigation = options => {\n const _history = getOr({}, 'history', options);\n if (!has('push', _history)) {\n return () => noop;\n }\n\n return ({href} = {})
|
|
1
|
+
{"version":3,"file":"navigation.js","names":["isLeftClickEvent","e","button","isModifiedEvent","metaKey","altKey","ctrlKey","shiftKey","navigation","options","_history","href","defaultPrevented","parse","host","preventDefault","push"],"sources":["../../src/util/navigation.js"],"sourcesContent":["/* eslint-disable node/no-deprecated-api */\nimport {parse} from 'url';\nimport {getOr, has, noop} from 'lodash/fp';\n\nconst isLeftClickEvent = e => e.button === 0;\nconst isModifiedEvent = e => !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);\n\nconst navigation = options => {\n const _history = getOr({}, 'history', options);\n if (!has('push', _history)) {\n return () => noop;\n }\n\n return ({href} = {}) =>\n e => {\n if (!href || e.defaultPrevented || isModifiedEvent(e) || !isLeftClickEvent(e)) {\n return;\n }\n if (parse(href).host) return;\n e.preventDefault();\n _history.push(href);\n };\n};\n\nexport default navigation;\n"],"mappings":";;;;;;;;;;;AACA;;;;AADA;AAIA,MAAMA,gBAAgB,GAAGC,CAAC,IAAIA,CAAC,CAACC,MAAF,KAAa,CAA3C;;AACA,MAAMC,eAAe,GAAGF,CAAC,IAAI,CAAC,EAAEA,CAAC,CAACG,OAAF,IAAaH,CAAC,CAACI,MAAf,IAAyBJ,CAAC,CAACK,OAA3B,IAAsCL,CAAC,CAACM,QAA1C,CAA9B;;AAEA,MAAMC,UAAU,GAAGC,OAAO,IAAI;EAC5B,MAAMC,QAAQ,GAAG,qBAAM,EAAN,EAAU,SAAV,EAAqBD,OAArB,CAAjB;;EACA,IAAI,CAAC,mBAAI,MAAJ,EAAYC,QAAZ,CAAL,EAA4B;IAC1B,OAAO,oBAAP;EACD;;EAED,OAAO,CAAC;IAACC;EAAD,IAAS,EAAV,KACLV,CAAC,IAAI;IACH,IAAI,CAACU,IAAD,IAASV,CAAC,CAACW,gBAAX,IAA+BT,eAAe,CAACF,CAAD,CAA9C,IAAqD,CAACD,gBAAgB,CAACC,CAAD,CAA1E,EAA+E;MAC7E;IACD;;IACD,IAAI,IAAAY,UAAA,EAAMF,IAAN,EAAYG,IAAhB,EAAsB;IACtBb,CAAC,CAACc,cAAF;;IACAL,QAAQ,CAACM,IAAT,CAAcL,IAAd;EACD,CARH;AASD,CAfD;;eAiBeH,U"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proptypes.js","names":["URL_REGEXP","UrlPropType","stringMatching","PATH_REGEXP","PathPropType","SrcPropType","PropTypes","oneOfType","ImagePropType","propValue","key","componentName","includes","Error","ColorPropType","_ColorPropType","HexPropType","_HexPropType"],"sources":["../../src/util/proptypes.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport includes from 'lodash/fp/includes';\nimport stringMatching from 'extended-proptypes/lib/validators/stringMatching';\n\nimport _ColorPropType from 'extended-proptypes/lib/validators/color';\nimport _HexPropType from 'extended-proptypes/lib/validators/hex';\n\nconst URL_REGEXP
|
|
1
|
+
{"version":3,"file":"proptypes.js","names":["URL_REGEXP","UrlPropType","stringMatching","PATH_REGEXP","PathPropType","SrcPropType","PropTypes","oneOfType","ImagePropType","propValue","key","componentName","includes","Error","ColorPropType","_ColorPropType","HexPropType","_HexPropType"],"sources":["../../src/util/proptypes.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport includes from 'lodash/fp/includes';\nimport stringMatching from 'extended-proptypes/lib/validators/stringMatching';\n\nimport _ColorPropType from 'extended-proptypes/lib/validators/color';\nimport _HexPropType from 'extended-proptypes/lib/validators/hex';\n\nconst URL_REGEXP =\n /^(http(s)?:\\/\\/.)[-a-zA-Z0-9@:%._\\\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\\\+.~#?&//=]*)$/;\nexport const UrlPropType = stringMatching(URL_REGEXP);\n\nconst PATH_REGEXP = /^\\/([-a-zA-Z0-9@:%_\\\\+.~#?&//=]*)$/;\nexport const PathPropType = stringMatching(PATH_REGEXP);\n\nexport const SrcPropType = PropTypes.oneOfType([UrlPropType, PathPropType]);\n\nexport const ImagePropType = (propValue, key, componentName) => {\n if (includes(propValue[key], ['jpg', 'png', 'svg+xml'])) return;\n return new Error(\n `Invalid prop value: ${propValue[key]}, at component: ${componentName}. Expected a valid image type: jpg, png or svg+xml.`\n );\n};\n\nexport const ColorPropType = _ColorPropType;\nexport const HexPropType = _HexPropType;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;;;AAEA,MAAMA,UAAU,GACd,8FADF;AAEO,MAAMC,WAAW,GAAG,IAAAC,uBAAA,EAAeF,UAAf,CAApB;;AAEP,MAAMG,WAAW,GAAG,oCAApB;AACO,MAAMC,YAAY,GAAG,IAAAF,uBAAA,EAAeC,WAAf,CAArB;;;AAEA,MAAME,WAAW,GAAGC,kBAAA,CAAUC,SAAV,CAAoB,CAACN,WAAD,EAAcG,YAAd,CAApB,CAApB;;;;AAEA,MAAMI,aAAa,GAAG,CAACC,SAAD,EAAYC,GAAZ,EAAiBC,aAAjB,KAAmC;EAC9D,IAAI,IAAAC,iBAAA,EAASH,SAAS,CAACC,GAAD,CAAlB,EAAyB,CAAC,KAAD,EAAQ,KAAR,EAAe,SAAf,CAAzB,CAAJ,EAAyD;EACzD,OAAO,IAAIG,KAAJ,CACJ,uBAAsBJ,SAAS,CAACC,GAAD,CAAM,mBAAkBC,aAAc,qDADjE,CAAP;AAGD,CALM;;;AAOA,MAAMG,aAAa,GAAGC,cAAtB;;AACA,MAAMC,WAAW,GAAGC,YAApB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/components",
|
|
3
|
-
"version": "10.24.
|
|
3
|
+
"version": "10.24.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"prestart": "npm run generate:storybook",
|
|
27
27
|
"start": "npm run storybook:run",
|
|
28
28
|
"start:ie": "IE=true npm start",
|
|
29
|
+
"prestatic": "npm run generate:storybook",
|
|
29
30
|
"static": "npm run storybook:export",
|
|
30
31
|
"storybook:run": "cross-env BABEL_ENV=es start-storybook -p 3004 -c .storybook",
|
|
31
32
|
"storybook:export": "cross-env BABEL_ENV=es build-storybook -c .storybook -o static",
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"Soualmi Djamel <djamel.soualmi@coorpacademy.com>"
|
|
52
53
|
],
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@coorpacademy/nova-icons": "3.11.
|
|
55
|
+
"@coorpacademy/nova-icons": "3.11.12",
|
|
55
56
|
"@types/react": "^17.0.50",
|
|
56
57
|
"@types/react-dom": "^17.0.17",
|
|
57
58
|
"autoprefixer": "^10.4.12",
|
|
@@ -101,7 +102,7 @@
|
|
|
101
102
|
"@coorpacademy/react-native-mock-render": "^0.2.4",
|
|
102
103
|
"@coorpacademy/react-native-slider": "^0.11.1",
|
|
103
104
|
"@coorpacademy/translate": "6.1.5",
|
|
104
|
-
"@coorpacademy/webpack-config": "
|
|
105
|
+
"@coorpacademy/webpack-config": "11.0.0",
|
|
105
106
|
"@react-native-community/blur": "^4.2.0",
|
|
106
107
|
"@storybook/addon-actions": "^6.5.12",
|
|
107
108
|
"@storybook/addon-controls": "^6.5.12",
|
|
@@ -112,7 +113,7 @@
|
|
|
112
113
|
"@storybook/react": "^6.5.12",
|
|
113
114
|
"@testing-library/react": "12.1.5",
|
|
114
115
|
"@testing-library/react-native": "^10.1.1",
|
|
115
|
-
"@types/react-native": "
|
|
116
|
+
"@types/react-native": "~0.68.7",
|
|
116
117
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
|
|
117
118
|
"ava": "^4.3.3",
|
|
118
119
|
"babel-loader": "^8.2.5",
|
|
@@ -150,5 +151,5 @@
|
|
|
150
151
|
"last 2 versions",
|
|
151
152
|
"IE 11"
|
|
152
153
|
],
|
|
153
|
-
"gitHead": "
|
|
154
|
+
"gitHead": "59ed58c1e02784b3fbf1bf503ce7117a7288ccda"
|
|
154
155
|
}
|