@coorpacademy/components 11.11.10 → 11.11.12-alpha.11
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/button/index.d.ts.map +1 -1
- package/es/atom/button/index.js +6 -3
- package/es/atom/button/index.js.map +1 -1
- package/es/atom/range/handle.d.ts +5 -0
- package/es/atom/range/handle.d.ts.map +1 -1
- package/es/atom/range/handle.js +12 -9
- package/es/atom/range/handle.js.map +1 -1
- package/es/atom/range/index.d.ts +10 -0
- package/es/atom/range/index.d.ts.map +1 -1
- package/es/atom/range/index.js +23 -5
- package/es/atom/range/index.js.map +1 -1
- package/es/atom/select/index.d.ts.map +1 -1
- package/es/atom/select/index.js +31 -3
- package/es/atom/select/index.js.map +1 -1
- package/es/atom/select/style.css +1 -0
- package/es/molecule/answer/index.js +3 -1
- package/es/molecule/answer/index.js.map +1 -1
- package/es/molecule/answer/style.css +4 -0
- package/es/molecule/forum/forum-comment/index.d.ts.map +1 -1
- package/es/molecule/forum/forum-comment/index.js +1 -0
- package/es/molecule/forum/forum-comment/index.js.map +1 -1
- package/es/molecule/questions/mobile/template/index.native.d.ts.map +1 -1
- package/es/molecule/questions/mobile/template/index.native.js +4 -6
- package/es/molecule/questions/mobile/template/index.native.js.map +1 -1
- package/es/molecule/questions/qcm-drag/style.css +1 -1
- package/es/molecule/questions/question-range/index.d.ts +10 -0
- package/es/molecule/skill-card/index.js +1 -1
- package/es/molecule/skill-card/index.js.map +1 -1
- package/es/organism/mooc-header/style.css +14 -3
- package/es/organism/review-header/index.d.ts +2 -1
- package/es/organism/review-header/index.d.ts.map +1 -1
- package/es/organism/review-header/index.js +7 -7
- package/es/organism/review-header/index.js.map +1 -1
- package/es/organism/review-slide/index.d.ts +26 -1
- package/es/organism/review-slide/index.d.ts.map +1 -1
- package/es/organism/review-slide/index.js +16 -7
- package/es/organism/review-slide/index.js.map +1 -1
- package/lib/atom/button/index.d.ts.map +1 -1
- package/lib/atom/button/index.js +6 -3
- package/lib/atom/button/index.js.map +1 -1
- package/lib/atom/range/handle.d.ts +5 -0
- package/lib/atom/range/handle.d.ts.map +1 -1
- package/lib/atom/range/handle.js +11 -8
- package/lib/atom/range/handle.js.map +1 -1
- package/lib/atom/range/index.d.ts +10 -0
- package/lib/atom/range/index.d.ts.map +1 -1
- package/lib/atom/range/index.js +23 -5
- package/lib/atom/range/index.js.map +1 -1
- package/lib/atom/select/index.d.ts.map +1 -1
- package/lib/atom/select/index.js +32 -2
- package/lib/atom/select/index.js.map +1 -1
- package/lib/atom/select/style.css +1 -0
- package/lib/molecule/answer/index.js +3 -1
- package/lib/molecule/answer/index.js.map +1 -1
- package/lib/molecule/answer/style.css +4 -0
- package/lib/molecule/forum/forum-comment/index.d.ts.map +1 -1
- package/lib/molecule/forum/forum-comment/index.js +1 -0
- package/lib/molecule/forum/forum-comment/index.js.map +1 -1
- package/lib/molecule/questions/mobile/template/index.native.d.ts.map +1 -1
- package/lib/molecule/questions/mobile/template/index.native.js +4 -6
- package/lib/molecule/questions/mobile/template/index.native.js.map +1 -1
- package/lib/molecule/questions/qcm-drag/style.css +1 -1
- package/lib/molecule/questions/question-range/index.d.ts +10 -0
- package/lib/molecule/skill-card/index.js +1 -1
- package/lib/molecule/skill-card/index.js.map +1 -1
- package/lib/organism/mooc-header/style.css +14 -3
- package/lib/organism/review-header/index.d.ts +2 -1
- package/lib/organism/review-header/index.d.ts.map +1 -1
- package/lib/organism/review-header/index.js +11 -7
- package/lib/organism/review-header/index.js.map +1 -1
- package/lib/organism/review-slide/index.d.ts +26 -1
- package/lib/organism/review-slide/index.d.ts.map +1 -1
- package/lib/organism/review-slide/index.js +16 -7
- package/lib/organism/review-slide/index.js.map +1 -1
- package/locales/.mtslconfig.json +1 -0
- package/locales/en/global.json +4 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../../../src/molecule/questions/mobile/template/index.native.tsx"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAE3E,OAAO,EACL,eAAe,EACf,UAAU,EACV,WAAW,EAEZ,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../../../src/molecule/questions/mobile/template/index.native.tsx"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAE3E,OAAO,EACL,eAAe,EACf,UAAU,EACV,WAAW,EAEZ,MAAM,kDAAkD,CAAC;AAkJ1D,oBAAY,KAAK,GAAG;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC,kBAAkB,GAAG,qBAAqB,CAAC,CAAC;IAC3D,aAAa,EAAE,CAAC,IAAI,EAAE,kBAAkB,GAAG,qBAAqB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzF,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,QAAA,MAAM,gBAAgB,UAAW,KAAK,uBA8CrC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -68,7 +68,6 @@ const createStyleSheet = theme => ({
|
|
|
68
68
|
const Item = props => {
|
|
69
69
|
const {
|
|
70
70
|
part,
|
|
71
|
-
index,
|
|
72
71
|
isDisabled = false,
|
|
73
72
|
focusedSelectId,
|
|
74
73
|
choices,
|
|
@@ -83,7 +82,7 @@ const Item = props => {
|
|
|
83
82
|
translations
|
|
84
83
|
} = templateContext;
|
|
85
84
|
const inputNames = choices.map(choice => choice.name);
|
|
86
|
-
const id = `question-part-${
|
|
85
|
+
const id = `question-part-${part.value}`;
|
|
87
86
|
const isFocused = focusedSelectId === id;
|
|
88
87
|
|
|
89
88
|
if (part.type === 'answerField' && inputNames.includes(part.value)) {
|
|
@@ -146,7 +145,7 @@ const Item = props => {
|
|
|
146
145
|
fontSize: theme.fontSize.regular,
|
|
147
146
|
testID: id,
|
|
148
147
|
style: styles.htmlText
|
|
149
|
-
}, (0, _trim.default)(part.value || ''));
|
|
148
|
+
}, part.value === ' ' ? part.value : (0, _trim.default)(part.value || ''));
|
|
150
149
|
};
|
|
151
150
|
|
|
152
151
|
const QuestionTemplate = props => {
|
|
@@ -178,15 +177,14 @@ const QuestionTemplate = props => {
|
|
|
178
177
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
179
178
|
style: styleSheet.container,
|
|
180
179
|
testID: "question-template"
|
|
181
|
-
}, parts.map(
|
|
182
|
-
key: `question-part-${
|
|
180
|
+
}, parts.map(part => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
181
|
+
key: `question-part-${part.value}`,
|
|
183
182
|
style: {
|
|
184
183
|
flexDirection: 'row'
|
|
185
184
|
}
|
|
186
185
|
}, /*#__PURE__*/_react.default.createElement(Item, {
|
|
187
186
|
part: part,
|
|
188
187
|
choices: choices,
|
|
189
|
-
index: id,
|
|
190
188
|
focusedSelectId: focusedSelectId,
|
|
191
189
|
isDisabled: isDisabled,
|
|
192
190
|
handleBlur: handleBlur,
|
|
@@ -1 +1 @@
|
|
|
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","translations","inputNames","map","choice","name","id","isFocused","type","includes","value","choiceIndex","findIndex","disabledSuffix","selectedSuffix","handleInputChange","_item","_value","selectInputStyle","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, 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 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 =\n (_item: TemplateTextChoice | TemplateListOfChoices) => (_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: TextStyle[] = [styles.selectInput];\n const selectTextStyle: TextStyle[] = [styles.selectText];\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;I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ACG,WAAD,CAAb;EACD,CAHD,EAGG,CAAC1E,KAAD,CAHH;;EAKA,IAAI,CAACqE,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,CAACrE,SAAxB;IAAmC,MAAM,EAAC;EAA1C,GACG0E,KAAK,CAAC3B,GAAN,CAAU,CAACb,IAAD,EAAOgB,EAAP,kBACT,6BAAC,iBAAD;IAAM,GAAG,EAAG,iBAAgBA,EAAG,EAA/B;IAAkC,KAAK,EAAE;MAAChD,aAAa,EAAE;IAAhB;EAAzC,gBACE,6BAAC,IAAD;IACE,IAAI,EAAEgC,IADR;IAEE,OAAO,EAAEI,OAFX;IAGE,KAAK,EAAEY,EAHT;IAIE,eAAe,EAAEb,eAJnB;IAKE,UAAU,EAAED,UALd;IAME,UAAU,EAAEI,UANd;IAOE,WAAW,EAAEC,WAPf;IAQE,aAAa,EAAEF,aARjB;IASE,MAAM,EAAE8B;EATV,EADF,eAYE,6BAAC,eAAD;IAAO,IAAI,EAAC;EAAZ,EAZF,CADD,CADH,CADF;AAoBD,CA/CD;;eAiDeF,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","isDisabled","focusedSelectId","choices","onInputChange","handleBlur","handleFocus","styles","templateContext","useTemplateContext","translations","inputNames","map","choice","name","id","value","isFocused","type","includes","choiceIndex","findIndex","disabledSuffix","selectedSuffix","handleInputChange","_item","_value","selectInputStyle","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 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 isDisabled = false,\n focusedSelectId,\n choices,\n onInputChange,\n handleBlur,\n handleFocus,\n styles\n } = props;\n\n const templateContext = useTemplateContext();\n const {theme, translations} = templateContext;\n\n const inputNames = choices.map(choice => choice.name);\n const id = `question-part-${part.value}`;\n const isFocused = focusedSelectId === id;\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 =\n (_item: TemplateTextChoice | TemplateListOfChoices) => (_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: TextStyle[] = [styles.selectInput];\n const selectTextStyle: TextStyle[] = [styles.selectText];\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 {part.value === ' ' ? part.value : 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 => (\n <View key={`question-part-${part.value}`} style={{flexDirection: 'row'}}>\n <Item\n part={part}\n choices={choices}\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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,CAACG,WAAD,CAAb;EACD,CAHD,EAGG,CAACzE,KAAD,CAHH;;EAKA,IAAI,CAACoE,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,CAACpE,SAAxB;IAAmC,MAAM,EAAC;EAA1C,GACGyE,KAAK,CAAC3B,GAAN,CAAUZ,IAAI,iBACb,6BAAC,iBAAD;IAAM,GAAG,EAAG,iBAAgBA,IAAI,CAACgB,KAAM,EAAvC;IAA0C,KAAK,EAAE;MAAChD,aAAa,EAAE;IAAhB;EAAjD,gBACE,6BAAC,IAAD;IACE,IAAI,EAAEgC,IADR;IAEE,OAAO,EAAEG,OAFX;IAGE,eAAe,EAAED,eAHnB;IAIE,UAAU,EAAED,UAJd;IAKE,UAAU,EAAEI,UALd;IAME,WAAW,EAAEC,WANf;IAOE,aAAa,EAAEF,aAPjB;IAQE,MAAM,EAAE8B;EARV,EADF,eAWE,6BAAC,eAAD;IAAO,IAAI,EAAC;EAAZ,EAXF,CADD,CADH,CADF;AAmBD,CA9CD;;eAgDeF,gB"}
|
|
@@ -32,6 +32,16 @@ declare namespace QuestionRange {
|
|
|
32
32
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
33
33
|
onChangeEnd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
34
|
multi: PropTypes.Requireable<boolean>;
|
|
35
|
+
HammerForTestingMin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
36
|
+
on: PropTypes.Requireable<(...args: any[]) => any>;
|
|
37
|
+
destroy: PropTypes.Requireable<(...args: any[]) => any>;
|
|
38
|
+
stop: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
|
+
}>>;
|
|
40
|
+
HammerForTestingMax: PropTypes.Requireable<PropTypes.InferProps<{
|
|
41
|
+
on: PropTypes.Requireable<(...args: any[]) => any>;
|
|
42
|
+
destroy: PropTypes.Requireable<(...args: any[]) => any>;
|
|
43
|
+
stop: PropTypes.Requireable<(...args: any[]) => any>;
|
|
44
|
+
}>>;
|
|
35
45
|
value: PropTypes.Requireable<NonNullable<number | (number | null | undefined)[] | null | undefined>>;
|
|
36
46
|
};
|
|
37
47
|
}
|
|
@@ -54,7 +54,7 @@ const SkillCard = (props, context) => {
|
|
|
54
54
|
transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out'
|
|
55
55
|
},
|
|
56
56
|
onClick,
|
|
57
|
-
'aria-label': buttonAriaLabel,
|
|
57
|
+
'aria-label': buttonAriaLabel ? `${skillTitle}, ${buttonAriaLabel}` : skillTitle,
|
|
58
58
|
label: buttonLabel,
|
|
59
59
|
'data-name': 'skill-card-button'
|
|
60
60
|
};
|
|
@@ -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(\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,QADkD,CAExE,4DAA2DA,SAAS,CAAC,CAAD,CAAI,QAAO,IAAAC,yBAAA,EAC9E,SAAQD,SAAS,CAAC,CAAD,CAAI,QADyD,CAE/E,2DAA0DA,SAAS,CAAC,CAAD,CAAI,QAAO,IAAAC,yBAAA,EAC7E,SAAQD,SAAS,CAAC,CAAD,CAAI,QADwD,CAE9E,WAAUD,SAAU,EANtB;AAOD,CAdD;;AAgBA,MAAMG,SAAS,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACpC,MAAM;IACJ,cAAcC,SADV;IAEJC,UAFI;IAGJC,cAHI;IAIJC,WAJI;IAKJC,eALI;IAMJC,WANI;IAOJC,eAPI;IAQJC,OARI;IASJC,QAAQ,GAAG;EATP,IAUFV,KAVJ;EAWA,MAAM;IAACW;EAAD,IAASV,OAAf;EACA,MAAM,CAACW,OAAD,EAAUC,UAAV,IAAwB,IAAAC,eAAA,EAAS,KAAT,CAA9B;EACA,MAAMC,gBAAgB,GAAG,IAAAC,cAAA,EAAM,SAAN,EAAiB,gBAAjB,EAAmCL,IAAnC,CAAzB;EAEA,MAAMM,eAAe,GAAG,IAAAC,kBAAA,EAAY,MAAML,UAAU,CAAC,IAAD,CAA5B,EAAoC,CAACA,UAAD,CAApC,CAAxB;EAEA,MAAMM,gBAAgB,GAAG,IAAAD,kBAAA,EAAY,MAAML,UAAU,CAAC,KAAD,CAA5B,EAAqC,CAACA,UAAD,CAArC,CAAzB;EAEA,MAAMO,WAAW,GAAG;IAClBC,WAAW,EAAE;MACXC,eAAe,EAAEV,OAAO,GAAGG,gBAAH,GAAsB,IAAAjB,yBAAA,EAAS,SAAQiB,gBAAiB,WAAlC,CADnC;MAEXQ,KAAK,EAAEX,OAAO,GAAG,SAAH,GAAeG,gBAFlB;MAGXS,UAAU,EAAE;IAHD,CADK;IAMlBf,OANkB;IAOlB,cAAcH,
|
|
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 ? `${skillTitle}, ${buttonAriaLabel}` : skillTitle,\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,QADkD,CAExE,4DAA2DA,SAAS,CAAC,CAAD,CAAI,QAAO,IAAAC,yBAAA,EAC9E,SAAQD,SAAS,CAAC,CAAD,CAAI,QADyD,CAE/E,2DAA0DA,SAAS,CAAC,CAAD,CAAI,QAAO,IAAAC,yBAAA,EAC7E,SAAQD,SAAS,CAAC,CAAD,CAAI,QADwD,CAE9E,WAAUD,SAAU,EANtB;AAOD,CAdD;;AAgBA,MAAMG,SAAS,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACpC,MAAM;IACJ,cAAcC,SADV;IAEJC,UAFI;IAGJC,cAHI;IAIJC,WAJI;IAKJC,eALI;IAMJC,WANI;IAOJC,eAPI;IAQJC,OARI;IASJC,QAAQ,GAAG;EATP,IAUFV,KAVJ;EAWA,MAAM;IAACW;EAAD,IAASV,OAAf;EACA,MAAM,CAACW,OAAD,EAAUC,UAAV,IAAwB,IAAAC,eAAA,EAAS,KAAT,CAA9B;EACA,MAAMC,gBAAg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AAA,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"}
|
|
@@ -701,11 +701,22 @@
|
|
|
701
701
|
|
|
702
702
|
.items .item {
|
|
703
703
|
line-height: 40px;
|
|
704
|
-
padding: 0;
|
|
704
|
+
padding: 0 0 0 8px ;
|
|
705
705
|
}
|
|
706
706
|
|
|
707
707
|
.item .bar {
|
|
708
|
-
|
|
708
|
+
background-color: brand;
|
|
709
|
+
width: 3px;
|
|
710
|
+
height: 0;
|
|
711
|
+
left: 0;
|
|
712
|
+
position: absolute;
|
|
713
|
+
transition: all 0.2s ease-out;
|
|
714
|
+
display: none;
|
|
715
|
+
}
|
|
716
|
+
.item:hover .bar {
|
|
717
|
+
height: 40px;
|
|
718
|
+
width: 3px;
|
|
719
|
+
display: inherit;
|
|
709
720
|
}
|
|
710
721
|
|
|
711
722
|
.items .currentOption {
|
|
@@ -725,7 +736,7 @@
|
|
|
725
736
|
}
|
|
726
737
|
|
|
727
738
|
.items .option {
|
|
728
|
-
padding: 0;
|
|
739
|
+
padding: 0 0 0 8px ;
|
|
729
740
|
line-height: 40px;
|
|
730
741
|
}
|
|
731
742
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default ReviewHeader;
|
|
2
|
-
declare function ReviewHeader(props: any,
|
|
2
|
+
declare function ReviewHeader(props: any, legacyContext: any): JSX.Element;
|
|
3
3
|
declare namespace ReviewHeader {
|
|
4
4
|
export { propTypes };
|
|
5
5
|
export namespace contextTypes {
|
|
@@ -24,6 +24,7 @@ declare namespace ReviewHeader {
|
|
|
24
24
|
[x: string]: any;
|
|
25
25
|
}>;
|
|
26
26
|
}>>;
|
|
27
|
+
const translate: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
import propTypes from "./types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/review-header/index.js"],"names":[],"mappings":";AASA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/review-header/index.js"],"names":[],"mappings":";AASA,2EAiDC"}
|
|
@@ -9,7 +9,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
9
9
|
|
|
10
10
|
var _getOr = _interopRequireDefault(require("lodash/fp/getOr"));
|
|
11
11
|
|
|
12
|
-
var _provider =
|
|
12
|
+
var _provider = _interopRequireWildcard(require("../../atom/provider"));
|
|
13
13
|
|
|
14
14
|
var _buttonLinkIconOnly = _interopRequireDefault(require("../../atom/button-link-icon-only"));
|
|
15
15
|
|
|
@@ -19,21 +19,24 @@ var _style = _interopRequireDefault(require("./style.css"));
|
|
|
19
19
|
|
|
20
20
|
var _types = _interopRequireDefault(require("./types"));
|
|
21
21
|
|
|
22
|
+
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); }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
22
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
27
|
|
|
24
|
-
const ReviewHeader = (props,
|
|
28
|
+
const ReviewHeader = (props, legacyContext) => {
|
|
25
29
|
const {
|
|
26
30
|
steps,
|
|
27
31
|
mode,
|
|
28
32
|
skillName,
|
|
29
33
|
'aria-label': ariaLabel,
|
|
30
|
-
closeButtonAriaLabel,
|
|
31
34
|
onQuitClick,
|
|
32
35
|
hiddenSteps
|
|
33
36
|
} = props;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
const translate = (0, _provider.GetTranslateFromContext)(legacyContext);
|
|
38
|
+
const skin = (0, _provider.GetSkinFromContext)(legacyContext);
|
|
39
|
+
const closeButtonAriaLabel = translate('close_button_ariaLabel');
|
|
37
40
|
const primarySkinColor = (0, _getOr.default)('#00B0FF', 'common.primary', skin);
|
|
38
41
|
const buttonProps = {
|
|
39
42
|
icon: 'close',
|
|
@@ -76,7 +79,8 @@ const ReviewHeader = (props, context) => {
|
|
|
76
79
|
|
|
77
80
|
ReviewHeader.propTypes = process.env.NODE_ENV !== "production" ? _types.default : {};
|
|
78
81
|
ReviewHeader.contextTypes = {
|
|
79
|
-
skin: _provider.default.childContextTypes.skin
|
|
82
|
+
skin: _provider.default.childContextTypes.skin,
|
|
83
|
+
translate: _provider.default.childContextTypes.translate
|
|
80
84
|
};
|
|
81
85
|
var _default = ReviewHeader;
|
|
82
86
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReviewHeader","props","
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReviewHeader","props","legacyContext","steps","mode","skillName","ariaLabel","onQuitClick","hiddenSteps","translate","GetTranslateFromContext","skin","GetSkinFromContext","closeButtonAriaLabel","primarySkinColor","getOr","buttonProps","icon","onClick","size","className","style","review","stepsWrapper","classnames","stepsWrapperAnimation","headerWrapper","titlesWrapper","title","color","iconButtonWrapper","propTypes","contextTypes","Provider","childContextTypes"],"sources":["../../../src/organism/review-header/index.js"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport getOr from 'lodash/fp/getOr';\nimport Provider, {GetTranslateFromContext, GetSkinFromContext} from '../../atom/provider';\nimport ButtonLinkIconOnly from '../../atom/button-link-icon-only';\nimport ReviewHeaderSteps from '../../molecule/review-header-steps';\nimport style from './style.css';\nimport propTypes from './types';\n\nconst ReviewHeader = (props, legacyContext) => {\n const {steps, mode, skillName, 'aria-label': ariaLabel, onQuitClick, hiddenSteps} = props;\n const translate = GetTranslateFromContext(legacyContext);\n const skin = GetSkinFromContext(legacyContext);\n const closeButtonAriaLabel = translate('close_button_ariaLabel');\n const primarySkinColor = getOr('#00B0FF', 'common.primary', skin);\n\n const buttonProps = {\n icon: 'close',\n 'data-name': 'review-header-close-button',\n 'aria-label': closeButtonAriaLabel,\n onClick: onQuitClick,\n size: 'responsive',\n className: style.review\n };\n\n const stepsWrapper = classnames(\n style.stepsWrapper,\n hiddenSteps ? style.stepsWrapperAnimation : null\n );\n\n return (\n <div className={style.headerWrapper} data-name=\"review-header\" aria-label={ariaLabel}>\n <div className={style.titlesWrapper}>\n <div className={style.title} title={mode} aria-label={mode} data-name=\"review-header-mode\">\n {mode}\n </div>\n <div\n className={style.skillName}\n style={{\n color: primarySkinColor\n }}\n title={skillName}\n aria-label={skillName}\n data-name=\"review-header-skill-name\"\n >\n {skillName}\n </div>\n </div>\n\n <div className={stepsWrapper}>\n <ReviewHeaderSteps steps={steps} key={'review-header-steps'} />\n </div>\n\n <div className={style.iconButtonWrapper} data-testid=\"review-header-close-button-wrapper\">\n <ButtonLinkIconOnly {...buttonProps} />\n </div>\n </div>\n );\n};\n\nReviewHeader.propTypes = propTypes;\n\nReviewHeader.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nexport default ReviewHeader;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,YAAY,GAAG,CAACC,KAAD,EAAQC,aAAR,KAA0B;EAC7C,MAAM;IAACC,KAAD;IAAQC,IAAR;IAAcC,SAAd;IAAyB,cAAcC,SAAvC;IAAkDC,WAAlD;IAA+DC;EAA/D,IAA8EP,KAApF;EACA,MAAMQ,SAAS,GAAG,IAAAC,iCAAA,EAAwBR,aAAxB,CAAlB;EACA,MAAMS,IAAI,GAAG,IAAAC,4BAAA,EAAmBV,aAAnB,CAAb;EACA,MAAMW,oBAAoB,GAAGJ,SAAS,CAAC,wBAAD,CAAtC;EACA,MAAMK,gBAAgB,GAAG,IAAAC,cAAA,EAAM,SAAN,EAAiB,gBAAjB,EAAmCJ,IAAnC,CAAzB;EAEA,MAAMK,WAAW,GAAG;IAClBC,IAAI,EAAE,OADY;IAElB,aAAa,4BAFK;IAGlB,cAAcJ,oBAHI;IAIlBK,OAAO,EAAEX,WAJS;IAKlBY,IAAI,EAAE,YALY;IAMlBC,SAAS,EAAEC,cAAA,CAAMC;EANC,CAApB;EASA,MAAMC,YAAY,GAAG,IAAAC,mBAAA,EACnBH,cAAA,CAAME,YADa,EAEnBf,WAAW,GAAGa,cAAA,CAAMI,qBAAT,GAAiC,IAFzB,CAArB;EAKA,oBACE;IAAK,SAAS,EAAEJ,cAAA,CAAMK,aAAtB;IAAqC,aAAU,eAA/C;IAA+D,cAAYpB;EAA3E,gBACE;IAAK,SAAS,EAAEe,cAAA,CAAMM;EAAtB,gBACE;IAAK,SAAS,EAAEN,cAAA,CAAMO,KAAtB;IAA6B,KAAK,EAAExB,IAApC;IAA0C,cAAYA,IAAtD;IAA4D,aAAU;EAAtE,GACGA,IADH,CADF,eAIE;IACE,SAAS,EAAEiB,cAAA,CAAMhB,SADnB;IAEE,KAAK,EAAE;MACLwB,KAAK,EAAEf;IADF,CAFT;IAKE,KAAK,EAAET,SALT;IAME,cAAYA,SANd;IAOE,aAAU;EAPZ,GASGA,SATH,CAJF,CADF,eAkBE;IAAK,SAAS,EAAEkB;EAAhB,gBACE,6BAAC,0BAAD;IAAmB,KAAK,EAAEpB,KAA1B;IAAiC,GAAG,EAAE;EAAtC,EADF,CAlBF,eAsBE;IAAK,SAAS,EAAEkB,cAAA,CAAMS,iBAAtB;IAAyC,eAAY;EAArD,gBACE,6BAAC,2BAAD,EAAwBd,WAAxB,CADF,CAtBF,CADF;AA4BD,CAjDD;;AAmDAhB,YAAY,CAAC+B,SAAb,2CAAyBA,cAAzB;AAEA/B,YAAY,CAACgC,YAAb,GAA4B;EAC1BrB,IAAI,EAAEsB,iBAAA,CAASC,iBAAT,CAA2BvB,IADP;EAE1BF,SAAS,EAAEwB,iBAAA,CAASC,iBAAT,CAA2BzB;AAFZ,CAA5B;eAKeT,Y"}
|
|
@@ -1,7 +1,32 @@
|
|
|
1
1
|
export default ReviewSlide;
|
|
2
|
-
declare function ReviewSlide(props: any): JSX.Element;
|
|
2
|
+
declare function ReviewSlide(props: any, legacyContext: any): JSX.Element;
|
|
3
3
|
declare namespace ReviewSlide {
|
|
4
4
|
export { propTypes };
|
|
5
|
+
export namespace contextTypes {
|
|
6
|
+
const skin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
7
|
+
common: PropTypes.Requireable<{
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
}>;
|
|
10
|
+
images: PropTypes.Requireable<PropTypes.InferProps<{
|
|
11
|
+
'logo-mobile': PropTypes.Requireable<any>;
|
|
12
|
+
logo: PropTypes.Requireable<any>;
|
|
13
|
+
'logo-email': PropTypes.Requireable<any>;
|
|
14
|
+
login: PropTypes.Requireable<any>;
|
|
15
|
+
}>>;
|
|
16
|
+
icons: PropTypes.Requireable<{
|
|
17
|
+
[x: string]: any;
|
|
18
|
+
}>;
|
|
19
|
+
mod: PropTypes.Requireable<{
|
|
20
|
+
[x: string]: any;
|
|
21
|
+
}>;
|
|
22
|
+
courses: PropTypes.Requireable<any[]>;
|
|
23
|
+
texts: PropTypes.Requireable<{
|
|
24
|
+
[x: string]: any;
|
|
25
|
+
}>;
|
|
26
|
+
}>>;
|
|
27
|
+
const translate: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
+
}
|
|
5
29
|
}
|
|
6
30
|
import propTypes from "./prop-types";
|
|
31
|
+
import PropTypes from "prop-types";
|
|
7
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/index.js"],"names":[],"mappings":";AA8JA,0EAkDC"}
|
|
@@ -21,7 +21,7 @@ var _loader = _interopRequireDefault(require("../../atom/loader"));
|
|
|
21
21
|
|
|
22
22
|
var _reviewCorrectionPopin = _interopRequireDefault(require("../../molecule/review-correction-popin"));
|
|
23
23
|
|
|
24
|
-
var _provider = require("../../atom/provider");
|
|
24
|
+
var _provider = _interopRequireWildcard(require("../../atom/provider"));
|
|
25
25
|
|
|
26
26
|
var _propTypes2 = _interopRequireDefault(require("./prop-types"));
|
|
27
27
|
|
|
@@ -91,7 +91,8 @@ CorrectionPopin.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
91
91
|
const ValidateButton = ({
|
|
92
92
|
slideIndex,
|
|
93
93
|
validateButton,
|
|
94
|
-
primarySkinColor
|
|
94
|
+
primarySkinColor,
|
|
95
|
+
ariaLabel
|
|
95
96
|
}) => {
|
|
96
97
|
const {
|
|
97
98
|
label,
|
|
@@ -101,7 +102,7 @@ const ValidateButton = ({
|
|
|
101
102
|
const validateButtonProps = {
|
|
102
103
|
type: 'primary',
|
|
103
104
|
label,
|
|
104
|
-
'aria-label':
|
|
105
|
+
'aria-label': ariaLabel,
|
|
105
106
|
'data-name': `slide-validate-button-${slideIndex}`,
|
|
106
107
|
onClick,
|
|
107
108
|
disabled,
|
|
@@ -133,7 +134,8 @@ const ValidateButton = ({
|
|
|
133
134
|
ValidateButton.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
134
135
|
slideIndex: _propTypes.default.string,
|
|
135
136
|
validateButton: _propTypes2.default.validateButton,
|
|
136
|
-
primarySkinColor: _propTypes.default.string
|
|
137
|
+
primarySkinColor: _propTypes.default.string,
|
|
138
|
+
ariaLabel: _propTypes.default.string
|
|
137
139
|
} : {};
|
|
138
140
|
|
|
139
141
|
const QuestionContainer = props => {
|
|
@@ -181,14 +183,16 @@ QuestionContainer.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
181
183
|
disableContent: _propTypes.default.bool
|
|
182
184
|
} : {};
|
|
183
185
|
|
|
184
|
-
const ReviewSlide = props => {
|
|
186
|
+
const ReviewSlide = (props, legacyContext) => {
|
|
185
187
|
const {
|
|
186
188
|
slide,
|
|
187
189
|
validateButton,
|
|
188
190
|
correctionPopinProps,
|
|
189
191
|
slideIndex = '0'
|
|
190
192
|
} = props;
|
|
191
|
-
const skin = (0, _provider.GetSkinFromContext)();
|
|
193
|
+
const skin = (0, _provider.GetSkinFromContext)(legacyContext);
|
|
194
|
+
const translate = (0, _provider.GetTranslateFromContext)(legacyContext);
|
|
195
|
+
const validateariaLabel = translate('validate_aria_label');
|
|
192
196
|
const primarySkinColor = (0, _react.useMemo)(() => (0, _getOr.default)('#00B0FF', 'common.primary', skin), [skin]);
|
|
193
197
|
const {
|
|
194
198
|
loading,
|
|
@@ -217,7 +221,8 @@ const ReviewSlide = props => {
|
|
|
217
221
|
slideIndex: slideIndex,
|
|
218
222
|
validateButton: validateButton,
|
|
219
223
|
primarySkinColor: primarySkinColor,
|
|
220
|
-
key: "validate-button"
|
|
224
|
+
key: "validate-button",
|
|
225
|
+
ariaLabel: validateariaLabel
|
|
221
226
|
}), /*#__PURE__*/_react.default.createElement(CorrectionPopin, {
|
|
222
227
|
correctionPopinProps: correctionPopinProps,
|
|
223
228
|
slideIndex: slideIndex,
|
|
@@ -228,6 +233,10 @@ const ReviewSlide = props => {
|
|
|
228
233
|
};
|
|
229
234
|
|
|
230
235
|
ReviewSlide.propTypes = process.env.NODE_ENV !== "production" ? _propTypes2.default : {};
|
|
236
|
+
ReviewSlide.contextTypes = {
|
|
237
|
+
skin: _provider.default.childContextTypes.skin,
|
|
238
|
+
translate: _provider.default.childContextTypes.translate
|
|
239
|
+
};
|
|
231
240
|
var _default = ReviewSlide;
|
|
232
241
|
exports.default = _default;
|
|
233
242
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","klf","getOr","information","label","message","next","get","onClick","_correctionPopinProps","type","resultLabel","useEffect","keyDownHandler","event","key","preventDefault","document","removeEventListener","addEventListener","classnames","style","correctionPopinWrapper","popinAnimation","propTypes","PropTypes","string","bool","ValidateButton","validateButton","primarySkinColor","disabled","validateButtonProps","className","customStyle","backgroundColor","validateButtonWrapper","QuestionContainer","props","answerUI","questionText","questionOrigin","disableContent","slideContentContainer","disabledSlideContent","question","__html","help","answerContainer","shape","slide","ReviewSlide","skin","GetSkinFromContext","useMemo","loading","loadingAriaLabel","parentContentTitle","disabledContent","loader"],"sources":["../../../src/organism/review-slide/index.js"],"sourcesContent":["import React, {useMemo, useEffect} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport Answer from '../../molecule/answer';\nimport ButtonLink from '../../atom/button-link';\nimport Loader from '../../atom/loader';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin';\nimport {GetSkinFromContext} from '../../atom/provider';\nimport propTypes from './prop-types';\nimport style from './style.css';\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}) => {\n if (!showCorrectionPopin) return null;\n\n const klf = getOr({}, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n // there is an error of eslint here because this useEffect will be only there when the correctionPopin will be there\n // but that is on purpose to go to the next slide if you press enter when the correctionPopin is present\n // istanbul ignore next\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n const keyDownHandler = event => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n onClick();\n document.removeEventListener('keydown', keyDownHandler);\n }\n };\n document.addEventListener('keydown', keyDownHandler);\n }, []);\n\n return (\n <div\n className={classnames(\n style.correctionPopinWrapper,\n animateCorrectionPopin ? style.popinAnimation : null\n )}\n >\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </div>\n );\n};\n\nCorrectionPopin.propTypes = {\n slideIndex: PropTypes.string,\n showCorrectionPopin: PropTypes.bool,\n animateCorrectionPopin: PropTypes.bool,\n correctionPopinProps: propTypes.correctionPopinProps\n};\n\nconst ValidateButton = ({slideIndex, validateButton, primarySkinColor}) => {\n const {label, onClick, disabled} = validateButton;\n const validateButtonProps = {\n type: 'primary',\n label,\n 'aria-label': label,\n 'data-name': `slide-validate-button-${slideIndex}`,\n onClick,\n disabled,\n className: style.validateButton,\n customStyle: {\n backgroundColor: primarySkinColor\n }\n };\n\n /* istanbul ignore next */\n useEffect(() => {\n const keyDownHandler = event => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n }\n };\n if (disabled) document.addEventListener('keydown', keyDownHandler);\n return () => {\n document.removeEventListener('keydown', keyDownHandler);\n };\n }, [disabled]);\n\n return (\n <div key=\"button-wrapper\" className={style.validateButtonWrapper}>\n <ButtonLink {...validateButtonProps} />\n </div>\n );\n};\n\nValidateButton.propTypes = {\n slideIndex: PropTypes.string,\n validateButton: propTypes.validateButton,\n primarySkinColor: PropTypes.string\n};\n\nconst QuestionContainer = props => {\n const {answerUI, questionText, questionOrigin, disableContent} = props;\n if (!answerUI || !questionText) return null;\n\n return (\n <div\n key=\"content-container\"\n data-testid=\"content-container\"\n className={classnames(\n style.slideContentContainer,\n disableContent ? style.disabledSlideContent : null\n )}\n >\n <div key=\"from-course\" className={style.questionOrigin}>\n {questionOrigin}\n </div>\n <div\n key=\"title\"\n data-testid=\"slide-question\"\n className={style.question}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: questionText}}\n />\n <div\n key=\"help\"\n className={style.help}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: get('help', answerUI)}}\n />\n <div key=\"answer-container\" className={style.answerContainer}>\n <Answer {...answerUI} key=\"answer\" />\n </div>\n </div>\n );\n};\n\nQuestionContainer.propTypes = {\n answerUI: PropTypes.shape(propTypes.slide.answerUI),\n questionText: PropTypes.string,\n questionOrigin: PropTypes.string,\n disableContent: PropTypes.bool\n};\n\nconst ReviewSlide = props => {\n const {slide, validateButton, correctionPopinProps, slideIndex = '0'} = props;\n\n const skin = GetSkinFromContext();\n const primarySkinColor = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n const {\n loading,\n loadingAriaLabel,\n parentContentTitle,\n questionText,\n disabledContent,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n return (\n <div data-testid=\"review-slide\" className={style.slide}>\n {loading ? (\n <Loader className={style.loader} theme=\"default\" aria-label={loadingAriaLabel} />\n ) : (\n <>\n <QuestionContainer\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n disableContent={disabledContent}\n key=\"question-container\"\n />\n <ValidateButton\n slideIndex={slideIndex}\n validateButton={validateButton}\n primarySkinColor={primarySkinColor}\n key=\"validate-button\"\n />\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n </>\n )}\n </div>\n );\n};\n\nReviewSlide.propTypes = propTypes;\n\nexport default ReviewSlide;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,eAAe,GAAG,CAAC;EACvBC,oBADuB;EAEvBC,UAFuB;EAGvBC,mBAHuB;EAIvBC;AAJuB,CAAD,KAKlB;EACJ,IAAI,CAACD,mBAAL,EAA0B,OAAO,IAAP;EAE1B,MAAME,GAAG,GAAG,IAAAC,cAAA,EAAM,EAAN,EAAU,KAAV,EAAiBL,oBAAjB,CAAZ;EACA,MAAMM,WAAW,GAAG,IAAAD,cAAA,EAAM;IAACE,KAAK,EAAE,EAAR;IAAYC,OAAO,EAAE;EAArB,CAAN,EAAgC,aAAhC,EAA+CR,oBAA/C,CAApB;EACA,MAAMS,IAAI,GAAG,IAAAC,YAAA,EAAI,MAAJ,EAAYV,oBAAZ,CAAb;EACA,MAAMW,OAAO,GAAG,IAAAD,YAAA,EAAI,CAAC,MAAD,EAAS,SAAT,CAAJ,EAAyBV,oBAAzB,CAAhB;EAEA,MAAMY,qBAAqB,GAAG;IAC5BH,IAAI,EAAE;MACJE,OADI;MAEJJ,KAAK,EAAEE,IAAI,IAAIA,IAAI,CAACF,KAFhB;MAGJ,aAAc,w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CAAd,EAAwD,CAACA,IAAD,CAAxD,CAAzB;EACA,MAAM;IACJG,OADI;IAEJC,gBAFI;IAGJC,kBAHI;IAIJjB,YAJI;IAKJkB,eALI;IAMJnB,QANI;IAOJxC,mBAPI;IAQJC;EARI,IASFkD,KATJ;EAWA,oBACE;IAAK,eAAY,cAAjB;IAAgC,SAAS,EAAE7B,cAAA,CAAM6B;EAAjD,GACGK,OAAO,gBACN,6BAAC,eAAD;IAAQ,SAAS,EAAElC,cAAA,CAAMsC,MAAzB;IAAiC,KAAK,EAAC,SAAvC;IAAiD,cAAYH;EAA7D,EADM,gBAGN,yEACE,6BAAC,iBAAD;IACE,cAAc,EAAEC,kBADlB;IAEE,YAAY,EAAEjB,YAFhB;IAGE,QAAQ,EAAED,QAHZ;IAIE,cAAc,EAAEmB,eAJlB;IAKE,GAAG,EAAC;EALN,EADF,eAQE,6BAAC,cAAD;IACE,UAAU,EAAE5D,UADd;IAEE,cAAc,EAAE+B,cAFlB;IAGE,gBAAgB,EAAEC,gBAHpB;IAIE,GAAG,EAAC;EAJN,EARF,eAcE,6BAAC,eAAD;IACE,oBAAoB,EAAEjC,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EAdF,CAJJ,CADF;AA8BD,CA9CD;;AAgDAmD,WAAW,CAAC3B,SAAZ,2CAAwBA,mBAAxB;eAEe2B,W"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","klf","getOr","information","label","message","next","get","onClick","_correctionPopinProps","type","resultLabel","useEffect","keyDownHandler","event","key","preventDefault","document","removeEventListener","addEventListener","classnames","style","correctionPopinWrapper","popinAnimation","propTypes","PropTypes","string","bool","ValidateButton","validateButton","primarySkinColor","ariaLabel","disabled","validateButtonProps","className","customStyle","backgroundColor","validateButtonWrapper","QuestionContainer","props","answerUI","questionText","questionOrigin","disableContent","slideContentContainer","disabledSlideContent","question","__html","help","answerContainer","shape","slide","ReviewSlide","legacyContext","skin","GetSkinFromContext","translate","GetTranslateFromContext","validateariaLabel","useMemo","loading","loadingAriaLabel","parentContentTitle","disabledContent","loader","contextTypes","Provider","childContextTypes"],"sources":["../../../src/organism/review-slide/index.js"],"sourcesContent":["import React, {useMemo, useEffect} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport Answer from '../../molecule/answer';\nimport ButtonLink from '../../atom/button-link';\nimport Loader from '../../atom/loader';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin';\nimport Provider, {GetSkinFromContext, GetTranslateFromContext} from '../../atom/provider';\nimport propTypes from './prop-types';\nimport style from './style.css';\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}) => {\n if (!showCorrectionPopin) return null;\n\n const klf = getOr({}, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n // there is an error of eslint here because this useEffect will be only there when the correctionPopin will be there\n // but that is on purpose to go to the next slide if you press enter when the correctionPopin is present\n // istanbul ignore next\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n const keyDownHandler = event => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n onClick();\n document.removeEventListener('keydown', keyDownHandler);\n }\n };\n document.addEventListener('keydown', keyDownHandler);\n }, []);\n\n return (\n <div\n className={classnames(\n style.correctionPopinWrapper,\n animateCorrectionPopin ? style.popinAnimation : null\n )}\n >\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </div>\n );\n};\n\nCorrectionPopin.propTypes = {\n slideIndex: PropTypes.string,\n showCorrectionPopin: PropTypes.bool,\n animateCorrectionPopin: PropTypes.bool,\n correctionPopinProps: propTypes.correctionPopinProps\n};\n\nconst ValidateButton = ({slideIndex, validateButton, primarySkinColor, ariaLabel}) => {\n const {label, onClick, disabled} = validateButton;\n const validateButtonProps = {\n type: 'primary',\n label,\n 'aria-label': ariaLabel,\n 'data-name': `slide-validate-button-${slideIndex}`,\n onClick,\n disabled,\n className: style.validateButton,\n customStyle: {\n backgroundColor: primarySkinColor\n }\n };\n\n /* istanbul ignore next */\n useEffect(() => {\n const keyDownHandler = event => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n }\n };\n if (disabled) document.addEventListener('keydown', keyDownHandler);\n return () => {\n document.removeEventListener('keydown', keyDownHandler);\n };\n }, [disabled]);\n\n return (\n <div key=\"button-wrapper\" className={style.validateButtonWrapper}>\n <ButtonLink {...validateButtonProps} />\n </div>\n );\n};\n\nValidateButton.propTypes = {\n slideIndex: PropTypes.string,\n validateButton: propTypes.validateButton,\n primarySkinColor: PropTypes.string,\n ariaLabel: PropTypes.string\n};\n\nconst QuestionContainer = props => {\n const {answerUI, questionText, questionOrigin, disableContent} = props;\n if (!answerUI || !questionText) return null;\n\n return (\n <div\n key=\"content-container\"\n data-testid=\"content-container\"\n className={classnames(\n style.slideContentContainer,\n disableContent ? style.disabledSlideContent : null\n )}\n >\n <div key=\"from-course\" className={style.questionOrigin}>\n {questionOrigin}\n </div>\n <div\n key=\"title\"\n data-testid=\"slide-question\"\n className={style.question}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: questionText}}\n />\n <div\n key=\"help\"\n className={style.help}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: get('help', answerUI)}}\n />\n <div key=\"answer-container\" className={style.answerContainer}>\n <Answer {...answerUI} key=\"answer\" />\n </div>\n </div>\n );\n};\n\nQuestionContainer.propTypes = {\n answerUI: PropTypes.shape(propTypes.slide.answerUI),\n questionText: PropTypes.string,\n questionOrigin: PropTypes.string,\n disableContent: PropTypes.bool\n};\n\nconst ReviewSlide = (props, legacyContext) => {\n const {slide, validateButton, correctionPopinProps, slideIndex = '0'} = props;\n\n const skin = GetSkinFromContext(legacyContext);\n const translate = GetTranslateFromContext(legacyContext);\n\n const validateariaLabel = translate('validate_aria_label');\n const primarySkinColor = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n const {\n loading,\n loadingAriaLabel,\n parentContentTitle,\n questionText,\n disabledContent,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n return (\n <div data-testid=\"review-slide\" className={style.slide}>\n {loading ? (\n <Loader className={style.loader} theme=\"default\" aria-label={loadingAriaLabel} />\n ) : (\n <>\n <QuestionContainer\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n disableContent={disabledContent}\n key=\"question-container\"\n />\n <ValidateButton\n slideIndex={slideIndex}\n validateButton={validateButton}\n primarySkinColor={primarySkinColor}\n key=\"validate-button\"\n ariaLabel={validateariaLabel}\n />\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n </>\n )}\n </div>\n );\n};\n\nReviewSlide.propTypes = propTypes;\n\nReviewSlide.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nexport default ReviewSlide;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,eAAe,GAAG,CAAC;EACvBC,oBADuB;EAEvBC,UAFuB;EAGvBC,mBAHuB;EAIvBC;AAJuB,CAAD,KAKl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AFhB;IAGE,QAAQ,EAAED,QAHZ;IAIE,cAAc,EAAEuB,eAJlB;IAKE,GAAG,EAAC;EALN,EADF,eAQE,6BAAC,cAAD;IACE,UAAU,EAAEjE,UADd;IAEE,cAAc,EAAE+B,cAFlB;IAGE,gBAAgB,EAAEC,gBAHpB;IAIE,GAAG,EAAC,iBAJN;IAKE,SAAS,EAAE4B;EALb,EARF,eAeE,6BAAC,eAAD;IACE,oBAAoB,EAAE7D,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EAfF,CAJJ,CADF;AA+BD,CAlDD;;AAoDAoD,WAAW,CAAC5B,SAAZ,2CAAwBA,mBAAxB;AAEA4B,WAAW,CAACa,YAAZ,GAA2B;EACzBX,IAAI,EAAEY,iBAAA,CAASC,iBAAT,CAA2Bb,IADR;EAEzBE,SAAS,EAAEU,iBAAA,CAASC,iBAAT,CAA2BX;AAFb,CAA3B;eAKeJ,W"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"ignore_dirs":[]}
|
package/locales/en/global.json
CHANGED
|
@@ -89,5 +89,8 @@
|
|
|
89
89
|
"errors_number": "bulk import errors number is {{bulkImportErrorsNumber}}",
|
|
90
90
|
"valid_scorm": "scorm file is valid",
|
|
91
91
|
"invalid_scorm": "scorm file is not valid"
|
|
92
|
-
}
|
|
92
|
+
},
|
|
93
|
+
"close_button_ariaLabel": "Close review slide",
|
|
94
|
+
"post_comment_aria_label": "Post your comment",
|
|
95
|
+
"validate_aria_label": "Validate your answer and go to next step"
|
|
93
96
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/components",
|
|
3
|
-
"version": "11.11.
|
|
3
|
+
"version": "11.11.12-alpha.11+85cdf415e",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -165,5 +165,5 @@
|
|
|
165
165
|
"last 2 versions",
|
|
166
166
|
"IE 11"
|
|
167
167
|
],
|
|
168
|
-
"gitHead": "
|
|
168
|
+
"gitHead": "85cdf415ef1f7d82e7e9d2792737c3238439afa8"
|
|
169
169
|
}
|