@coorpacademy/components 10.22.24-alpha.5 → 10.22.25

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.
Files changed (91) hide show
  1. package/es/atom/choice/index.native.js +4 -4
  2. package/es/atom/choice/index.native.js.map +1 -1
  3. package/es/atom/select-modal/index.native.js +1 -1
  4. package/es/atom/select-modal/index.native.js.map +1 -1
  5. package/es/hoc/modal/select/index.native.js.map +1 -1
  6. package/es/molecule/answer/index.native.js +85 -0
  7. package/es/molecule/answer/index.native.js.map +1 -0
  8. package/es/molecule/answer/prop-types.js +22 -3
  9. package/es/molecule/answer/prop-types.js.map +1 -1
  10. package/es/molecule/questions/mobile/draggable/index.native.js +8 -29
  11. package/es/molecule/questions/mobile/draggable/index.native.js.map +1 -1
  12. package/es/molecule/questions/mobile/switch/index.native.js +57 -54
  13. package/es/molecule/questions/mobile/switch/index.native.js.map +1 -1
  14. package/es/molecule/questions/mobile/template/index.native.js +18 -23
  15. package/es/molecule/questions/mobile/template/index.native.js.map +1 -1
  16. package/es/molecule/questions/types.js +2 -0
  17. package/{lib/types/styles.d.js.map → es/molecule/questions/types.js.map} +1 -1
  18. package/es/organism/review-congrats/index.js +3 -1
  19. package/es/organism/review-congrats/index.js.map +1 -1
  20. package/es/organism/review-congrats/style.css +5 -0
  21. package/es/organism/review-slide/index.js +7 -11
  22. package/es/organism/review-slide/index.js.map +1 -1
  23. package/es/organism/review-slide/index.native.js +213 -0
  24. package/es/organism/review-slide/index.native.js.map +1 -0
  25. package/es/organism/review-slide/prop-types.js +4 -3
  26. package/es/organism/review-slide/prop-types.js.map +1 -1
  27. package/es/organism/review-slide/style.css +4 -0
  28. package/es/organism/review-stacked-slides/index.native.js +34 -0
  29. package/es/organism/review-stacked-slides/index.native.js.map +1 -0
  30. package/es/organism/review-stacked-slides/prop-types.js +3 -2
  31. package/es/organism/review-stacked-slides/prop-types.js.map +1 -1
  32. package/es/template/app-review/player/index.native.js +33 -230
  33. package/es/template/app-review/player/index.native.js.map +1 -1
  34. package/es/template/app-review/player/prop-types.js.map +1 -1
  35. package/es/template/app-review/player/style.css +7 -0
  36. package/es/template/app-review/template-context.js +3 -1
  37. package/es/template/app-review/template-context.js.map +1 -1
  38. package/es/types/styles.js +2 -0
  39. package/es/types/{styles.d.js.map → styles.js.map} +1 -1
  40. package/lib/atom/choice/index.native.js +4 -4
  41. package/lib/atom/choice/index.native.js.map +1 -1
  42. package/lib/atom/select-modal/index.native.js +1 -1
  43. package/lib/atom/select-modal/index.native.js.map +1 -1
  44. package/lib/hoc/modal/select/index.native.js.map +1 -1
  45. package/lib/molecule/answer/index.native.js +94 -0
  46. package/lib/molecule/answer/index.native.js.map +1 -0
  47. package/lib/molecule/answer/prop-types.js +25 -3
  48. package/lib/molecule/answer/prop-types.js.map +1 -1
  49. package/lib/molecule/questions/mobile/draggable/index.native.js +8 -31
  50. package/lib/molecule/questions/mobile/draggable/index.native.js.map +1 -1
  51. package/lib/molecule/questions/mobile/switch/index.native.js +64 -62
  52. package/lib/molecule/questions/mobile/switch/index.native.js.map +1 -1
  53. package/lib/molecule/questions/mobile/template/index.native.js +18 -23
  54. package/lib/molecule/questions/mobile/template/index.native.js.map +1 -1
  55. package/lib/molecule/questions/types.js +2 -0
  56. package/lib/{types/app-review.d.js.map → molecule/questions/types.js.map} +1 -1
  57. package/lib/organism/review-congrats/index.js +3 -1
  58. package/lib/organism/review-congrats/index.js.map +1 -1
  59. package/lib/organism/review-congrats/style.css +5 -0
  60. package/lib/organism/review-slide/index.js +7 -11
  61. package/lib/organism/review-slide/index.js.map +1 -1
  62. package/lib/organism/review-slide/index.native.js +232 -0
  63. package/lib/organism/review-slide/index.native.js.map +1 -0
  64. package/lib/organism/review-slide/prop-types.js +6 -5
  65. package/lib/organism/review-slide/prop-types.js.map +1 -1
  66. package/lib/organism/review-slide/style.css +4 -0
  67. package/lib/organism/review-stacked-slides/index.native.js +47 -0
  68. package/lib/organism/review-stacked-slides/index.native.js.map +1 -0
  69. package/lib/organism/review-stacked-slides/prop-types.js +3 -2
  70. package/lib/organism/review-stacked-slides/prop-types.js.map +1 -1
  71. package/lib/template/app-review/player/index.native.js +36 -233
  72. package/lib/template/app-review/player/index.native.js.map +1 -1
  73. package/lib/template/app-review/player/prop-types.js.map +1 -1
  74. package/lib/template/app-review/player/style.css +7 -0
  75. package/lib/template/app-review/template-context.js +3 -1
  76. package/lib/template/app-review/template-context.js.map +1 -1
  77. package/lib/types/styles.js +2 -0
  78. package/{es/types/app-review.d.js.map → lib/types/styles.js.map} +1 -1
  79. package/package.json +2 -2
  80. package/es/molecule/questions/qcm/index.native.js +0 -50
  81. package/es/molecule/questions/qcm/index.native.js.map +0 -1
  82. package/es/types/app-review.d.js +0 -2
  83. package/es/types/progression-engine.d.js +0 -2
  84. package/es/types/progression-engine.d.js.map +0 -1
  85. package/es/types/styles.d.js +0 -2
  86. package/lib/molecule/questions/qcm/index.native.js +0 -62
  87. package/lib/molecule/questions/qcm/index.native.js.map +0 -1
  88. package/lib/types/app-review.d.js +0 -2
  89. package/lib/types/progression-engine.d.js +0 -2
  90. package/lib/types/progression-engine.d.js.map +0 -1
  91. package/lib/types/styles.d.js +0 -2
@@ -31,6 +31,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
31
31
 
32
32
  const createStyleSheet = theme => ({
33
33
  section: {
34
+ // backgroundColor: '#188', // flex-debug
34
35
  width: '100%',
35
36
  flexDirection: 'row',
36
37
  flexWrap: 'wrap',
@@ -64,11 +65,10 @@ const createStyleSheet = theme => ({
64
65
 
65
66
  const Section = ({
66
67
  section,
67
- items,
68
+ choices,
68
69
  index,
69
70
  focusedSelectId,
70
71
  onInputChange,
71
- userChoices,
72
72
  handleBlur,
73
73
  handleFocus,
74
74
  isDisabled,
@@ -87,11 +87,10 @@ const Section = ({
87
87
  }, /*#__PURE__*/_react.default.createElement(Item, {
88
88
  prefix: prefix,
89
89
  part: part,
90
- items: items,
90
+ choices: choices,
91
91
  index: id,
92
92
  focusedSelectId: focusedSelectId,
93
93
  isDisabled: isDisabled,
94
- userChoices: userChoices,
95
94
  handleBlur: handleBlur,
96
95
  handleFocus: handleFocus,
97
96
  onInputChange: onInputChange,
@@ -109,8 +108,7 @@ const Item = props => {
109
108
  prefix,
110
109
  isDisabled = false,
111
110
  focusedSelectId,
112
- items,
113
- userChoices,
111
+ choices,
114
112
  onInputChange,
115
113
  handleBlur,
116
114
  handleFocus,
@@ -122,7 +120,7 @@ const Item = props => {
122
120
  brandTheme,
123
121
  translations
124
122
  } = templateContext;
125
- const inputNames = items.map(item => item.name);
123
+ const inputNames = choices.map(choice => choice.name);
126
124
  const id = `${prefix}-part-${index + 1}`;
127
125
  const isFocused = focusedSelectId === id;
128
126
  const selectedStyle = brandTheme && {
@@ -131,11 +129,13 @@ const Item = props => {
131
129
  };
132
130
 
133
131
  if (part.type === 'answerField' && inputNames.includes(part.value)) {
134
- const itemIndex = items.findIndex(_item => _item.name === part.value);
135
- const item = items[itemIndex];
136
- const value = userChoices[itemIndex];
132
+ const choiceIndex = choices.findIndex(choice => choice.name === part.value);
133
+ const choice = choices[choiceIndex];
134
+ const {
135
+ value
136
+ } = choice;
137
137
 
138
- if (!item || !item.type || !item.name) {
138
+ if (!choice || !choice.type || !choice.name) {
139
139
  return null;
140
140
  }
141
141
 
@@ -144,34 +144,34 @@ const Item = props => {
144
144
 
145
145
  const handleInputChange = _item => _value => onInputChange(_item, _value);
146
146
 
147
- if (item.type === 'text') {
147
+ if (choice.type === 'text') {
148
148
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
149
149
  style: styles.spaced,
150
150
  testID: id
151
151
  }, /*#__PURE__*/_react.default.createElement(_index4.default, {
152
152
  key: id,
153
153
  isDisabled: isDisabled,
154
- onChange: handleInputChange(item),
154
+ onChange: handleInputChange(choice),
155
155
  value: value,
156
156
  testID: `${id}-text${selectedSuffix}${disabledSuffix}`,
157
157
  questionType: "template"
158
158
  }));
159
159
  }
160
160
 
161
- if (item.type === 'select') {
161
+ if (choice.type === 'select') {
162
162
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
163
163
  style: styles.spaced,
164
164
  testID: id
165
165
  }, /*#__PURE__*/_react.default.createElement(_index2.default, {
166
166
  isDisabled: isDisabled,
167
167
  questionType: "template",
168
- values: item.items,
168
+ values: choice.items,
169
169
  value: value,
170
170
  placeholder: translations.selectAnAnswer,
171
171
  isFocused: isFocused,
172
172
  onBlur: handleBlur,
173
173
  onFocus: handleFocus(id),
174
- onChange: handleInputChange(item),
174
+ onChange: handleInputChange(choice),
175
175
  textStyle: styles.text,
176
176
  style: [styles.input, value && selectedStyle],
177
177
  testID: `${id}-select${selectedSuffix}${disabledSuffix}`
@@ -191,8 +191,7 @@ const QuestionTemplate = props => {
191
191
  const {
192
192
  template,
193
193
  onInputChange,
194
- userChoices,
195
- items,
194
+ choices,
196
195
  handleBlur,
197
196
  handleFocus,
198
197
  focusedSelectId,
@@ -219,20 +218,16 @@ const QuestionTemplate = props => {
219
218
  return result.slice(0, -1).concat([section.concat([item])]);
220
219
  }, []);
221
220
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
222
- style: {
223
- flex: 1
224
- },
225
221
  testID: "question-template"
226
222
  }, sections.map((section, index) => /*#__PURE__*/_react.default.createElement(Section, {
227
223
  key: index,
228
224
  section: section,
229
- items: items,
225
+ choices: choices,
230
226
  index: index,
231
227
  handleBlur: handleBlur,
232
228
  handleFocus: handleFocus,
233
229
  focusedSelectId: focusedSelectId,
234
230
  onInputChange: onInputChange,
235
- userChoices: userChoices,
236
231
  isDisabled: isDisabled,
237
232
  styles: styleSheet
238
233
  })));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/molecule/questions/mobile/template/index.native.tsx"],"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","items","index","focusedSelectId","onInputChange","userChoices","handleBlur","handleFocus","isDisabled","styles","prefix","map","part","id","Item","props","templateContext","brandTheme","translations","inputNames","item","name","isFocused","selectedStyle","primary","type","includes","value","itemIndex","findIndex","_item","disabledSuffix","selectedSuffix","handleInputChange","_value","selectAnAnswer","QuestionTemplate","template","styleSheet","setStylesheet","_stylesheet","parts","sections","reduce","result","slice","concat","flex"],"mappings":";;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AAGA;;AACA;;AAEA;;;;;;;;AAEA,MAAMA,gBAAgB,GAAIC,KAAD,KAAmB;AAC1CC,EAAAA,OAAO,EAAE;AACPC,IAAAA,KAAK,EAAE,MADA;AAEPC,IAAAA,aAAa,EAAE,KAFR;AAGPC,IAAAA,QAAQ,EAAE,MAHH;AAIPC,IAAAA,cAAc,EAAE,QAJT;AAKPC,IAAAA,UAAU,EAAE;AALL,GADiC;AAQ1CC,EAAAA,MAAM,EAAE;AACNC,IAAAA,eAAe,EAAER,KAAK,CAACS,OAAN,CAAcC;AADzB,GARkC;AAW1CC,EAAAA,KAAK,EAAE;AACLC,IAAAA,OAAO,EAAEZ,KAAK,CAACS,OAAN,CAAcC,IADlB;AAELG,IAAAA,WAAW,EAAE,CAFR;AAGLC,IAAAA,WAAW,EAAEd,KAAK,CAACe,MAAN,CAAaC,IAAb,CAAkBC,WAH1B;AAILC,IAAAA,YAAY,EAAElB,KAAK,CAACmB,MAAN,CAAaC,MAJtB;AAKLC,IAAAA,eAAe,EAAErB,KAAK,CAACe,MAAN,CAAaO,KALzB;AAMLC,IAAAA,QAAQ,EAAE;AANL,GAXmC;AAmB1CC,EAAAA,QAAQ,EAAE;AACRZ,IAAAA,OAAO,EAAEZ,KAAK,CAACS,OAAN,CAAcC,IADf;AAERe,IAAAA,KAAK,EAAEzB,KAAK,CAACe,MAAN,CAAaW,KAFZ;AAGRC,IAAAA,UAAU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CAAC3E,KAAD,CAHH;;AAKA,MAAI,CAACwE,QAAD,IAAa,CAACC,UAAlB,EAA8B;AAC5B,WAAO,IAAP;AACD;;AAED,QAAMG,KAAK,GAAG,kCAAoBJ,QAApB,CAAd;AAEA,QAAMK,QAAoC,GAAGD,KAAK,CAACE,MAAN,CAAa,CAACC,MAAD,EAASxB,IAAT,KAAkB;AAC1E,UAAMtD,OAAO,GAAG,mBAAK8E,MAAL,KAAgB,EAAhC;AACA,WAAOA,MAAM,CAACC,KAAP,CAAa,CAAb,EAAgB,CAAC,CAAjB,EAAoBC,MAApB,CAA2B,CAAChF,OAAO,CAACgF,MAAR,CAAe,CAAC1B,IAAD,CAAf,CAAD,CAA3B,CAAP;AACD,GAH4C,EAG1C,EAH0C,CAA7C;AAKA,sBACE,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAE;AAAC2B,MAAAA,IAAI,EAAE;AAAP,KAAb;AAAwB,IAAA,MAAM,EAAC;AAA/B,KACGL,QAAQ,CAAC/B,GAAT,CAAa,CAAC7C,OAAD,EAAUoC,KAAV,kBACZ,6BAAC,OAAD;AACE,IAAA,GAAG,EAAEA,KADP;AAEE,IAAA,OAAO,EAAEpC,OAFX;AAGE,IAAA,KAAK,EAAEmC,KAHT;AAIE,IAAA,KAAK,EAAEC,KAJT;AAKE,IAAA,UAAU,EAAEI,UALd;AAME,IAAA,WAAW,EAAEC,WANf;AAOE,IAAA,eAAe,EAAEJ,eAPnB;AAQE,IAAA,aAAa,EAAEC,aARjB;AASE,IAAA,WAAW,EAAEC,WATf;AAUE,IAAA,UAAU,EAAEG,UAVd;AAWE,IAAA,MAAM,EAAE8B;AAXV,IADD,CADH,CADF;AAmBD,CApDD;;eAsDeF,gB","sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {View} from 'react-native';\n\nimport trim from 'lodash/fp/trim';\nimport last from 'lodash/fp/last';\n\nimport Html from '../../../../atom/html/index.native';\nimport Select from '../../../../atom/select-modal/index.native';\nimport Space from '../../../../atom/space/index.native';\nimport {FocusedSelectId, HandleBlur, HandleFocus} from '../../../../types/app-review.d';\nimport type {Choice} from '../../../../types/progression-engine.d';\nimport FreeText from '../../free-text/index.native';\nimport {useTemplateContext} from '../../../../template/app-review/template-context';\nimport {Theme} from '../../../../variables/theme.native';\nimport parseTemplateString from '../../../../util/parse-template-string';\n\nconst createStyleSheet = (theme: Theme) => ({\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 userChoices: Array<string>;\n section: Array<TemplatePart>;\n items: Array<Choice>;\n index: number;\n onInputChange: (item: Choice, value: string) => void;\n focusedSelectId: FocusedSelectId;\n handleBlur: HandleBlur;\n handleFocus: HandleFocus;\n styles: any;\n};\n\nconst Section = ({\n section,\n items,\n index,\n focusedSelectId,\n onInputChange,\n userChoices,\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 items={items}\n index={id}\n focusedSelectId={focusedSelectId}\n isDisabled={isDisabled}\n userChoices={userChoices}\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 items: Array<Choice>;\n index: number;\n prefix: string;\n isDisabled?: boolean;\n userChoices: Array<string>;\n onInputChange: (item: Choice, 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 items,\n userChoices,\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 = items.map(item => item.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 itemIndex = items.findIndex(_item => _item.name === part.value);\n const item = items[itemIndex];\n const value = userChoices[itemIndex];\n\n if (!item || !item.type || !item.name) {\n return null;\n }\n\n const disabledSuffix = isDisabled ? '-disabled' : '';\n const selectedSuffix = value ? '-selected' : '';\n\n const handleInputChange = (_item: Choice) => (_value: string) => onInputChange(_item, _value);\n\n if (item.type === 'text') {\n return (\n <View style={styles.spaced} testID={id}>\n <FreeText\n key={id}\n isDisabled={isDisabled}\n onChange={handleInputChange(item)}\n value={value}\n testID={`${id}-text${selectedSuffix}${disabledSuffix}`}\n questionType=\"template\"\n />\n </View>\n );\n }\n\n if (item.type === 'select') {\n return (\n <View style={styles.spaced} testID={id}>\n <Select\n isDisabled={isDisabled}\n questionType=\"template\"\n values={item.items}\n value={value}\n placeholder={translations.selectAnAnswer}\n isFocused={isFocused}\n onBlur={handleBlur}\n onFocus={handleFocus(id)}\n onChange={handleInputChange(item)}\n textStyle={styles.text}\n style={[styles.input, value && selectedStyle]}\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 items: Array<Choice>;\n userChoices: Array<string>;\n onInputChange: (item: Choice, 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 userChoices,\n items,\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<any | 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 = parseTemplateString(template);\n\n const sections: Array<Array<TemplatePart>> = parts.reduce((result, item) => {\n const section = last(result) || [];\n return result.slice(0, -1).concat([section.concat([item])]);\n }, []);\n\n return (\n <View style={{flex: 1}} testID=\"question-template\">\n {sections.map((section, index) => (\n <Section\n key={index}\n section={section}\n items={items}\n index={index}\n handleBlur={handleBlur}\n handleFocus={handleFocus}\n focusedSelectId={focusedSelectId}\n onInputChange={onInputChange}\n userChoices={userChoices}\n isDisabled={isDisabled}\n styles={styleSheet}\n />\n ))}\n </View>\n );\n};\n\nexport default QuestionTemplate;\n"],"file":"index.native.js"}
1
+ {"version":3,"sources":["../../../../../src/molecule/questions/mobile/template/index.native.tsx"],"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","brandTheme","translations","inputNames","choice","name","isFocused","selectedStyle","primary","type","includes","value","choiceIndex","findIndex","disabledSuffix","selectedSuffix","handleInputChange","_item","_value","items","selectAnAnswer","QuestionTemplate","template","styleSheet","setStylesheet","_stylesheet","parts","sections","reduce","result","item","slice","concat"],"mappings":";;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AAEA;;AACA;;AAOA;;;;;;;;AAEA,MAAMA,gBAAgB,GAAIC,KAAD,KAAmB;AAC1CC,EAAAA,OAAO,EAAE;AACP;AACAC,IAAAA,KAAK,EAAE,MAFA;AAGPC,IAAAA,aAAa,EAAE,KAHR;AAIPC,IAAAA,QAAQ,EAAE,MAJH;AAKPC,IAAAA,cAAc,EAAE,QALT;AAMPC,IAAAA,UAAU,EAAE;AANL,GADiC;AAS1CC,EAAAA,MAAM,EAAE;AACNC,IAAAA,eAAe,EAAER,KAAK,CAACS,OAAN,CAAcC;AADzB,GATkC;AAY1CC,EAAAA,KAAK,EAAE;AACLC,IAAAA,OAAO,EAAEZ,KAAK,CAACS,OAAN,CAAcC,IADlB;AAELG,IAAAA,WAAW,EAAE,CAFR;AAGLC,IAAAA,WAAW,EAAEd,KAAK,CAACe,MAAN,CAAaC,IAAb,CAAkBC,WAH1B;AAILC,IAAAA,YAAY,EAAElB,KAAK,CAACmB,MAAN,CAAaC,MAJtB;AAKLC,IAAAA,eAAe,EAAErB,KAAK,CAACe,MAAN,CAAaO,KALzB;AAMLC,IAAAA,QAAQ,EAAE;AANL,GAZmC;AAoB1CC,EAAAA,QAAQ,EAAE;AACRZ,IAAAA,OAAO,EAAEZ,KAAK,CAACS,OAAN,CAAcC,IADf;AAERe,IAAAA,KAAK,EAAEzB,KAAK,CAACe,MAAN,CAAaW,KAFZ;AAGRC,IAAAA,UAAU,EAAE3B,KAAK,CAAC2B,UAAN,CAAiBC,IAHrB;AAIRC,IAAAA,UAAU,EAAE;AAJJ,GApBg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ACE,MAAN,CAAa,CAACC,MAAD,EAASC,IAAT,KAAkB;AAC1E,UAAM/E,OAAO,GAAG,mBAAK8E,MAAL,KAAgB,EAAhC;AACA,WAAOA,MAAM,CAACE,KAAP,CAAa,CAAb,EAAgB,CAAC,CAAjB,EAAoBC,MAApB,CAA2B,CAACjF,OAAO,CAACiF,MAAR,CAAe,CAACF,IAAD,CAAf,CAAD,CAA3B,CAAP;AACD,GAH4C,EAG1C,EAH0C,CAA7C;AAKA,sBACE,6BAAC,iBAAD;AAAM,IAAA,MAAM,EAAC;AAAb,KACGH,QAAQ,CAAChC,GAAT,CAAa,CAAC5C,OAAD,EAAUoC,KAAV,kBACZ,6BAAC,OAAD;AACE,IAAA,GAAG,EAAEA,KADP;AAEE,IAAA,OAAO,EAAEpC,OAFX;AAGE,IAAA,OAAO,EAAEmC,OAHX;AAIE,IAAA,KAAK,EAAEC,KAJT;AAKE,IAAA,UAAU,EAAEG,UALd;AAME,IAAA,WAAW,EAAEC,WANf;AAOE,IAAA,eAAe,EAAEH,eAPnB;AAQE,IAAA,aAAa,EAAEC,aARjB;AASE,IAAA,UAAU,EAAEG,UATd;AAUE,IAAA,MAAM,EAAE+B;AAVV,IADD,CADH,CADF;AAkBD,CAlDD;;eAoDeF,gB","sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {View} from 'react-native';\n\nimport trim from 'lodash/fp/trim';\nimport last from 'lodash/fp/last';\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 {Choice} 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\nconst createStyleSheet = (theme: Theme) => ({\n section: {\n // backgroundColor: '#188', // flex-debug\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<Choice>;\n index: number;\n onInputChange: (item: Choice, 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<Choice>;\n index: number;\n prefix: string;\n isDisabled?: boolean;\n onInputChange: (item: Choice, 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: Choice) => (_value: string) => 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 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={[styles.input, value && selectedStyle]}\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<Choice>;\n onInputChange: (item: Choice, 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<any | 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 = parseTemplateString(template);\n\n const sections: Array<Array<TemplatePart>> = parts.reduce((result, item) => {\n const section = last(result) || [];\n return result.slice(0, -1).concat([section.concat([item])]);\n }, []);\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"],"file":"index.native.js"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"app-review.d.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
@@ -66,11 +66,13 @@ const ReviewCongrats = props => {
66
66
  }, title), /*#__PURE__*/_react.default.createElement("div", {
67
67
  ref: container,
68
68
  className: _style.default.containerCards
69
- }, /*#__PURE__*/_react.default.createElement(_reviewCardCongrats.default, _extends({}, cardCongratsStar, {
69
+ }, cardCongratsRank ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reviewCardCongrats.default, _extends({}, cardCongratsStar, {
70
70
  className: _style.default.cardStar
71
71
  })), /*#__PURE__*/_react.default.createElement(_reviewCardCongrats.default, _extends({}, cardCongratsRank, {
72
72
  timerAnimation: 1800,
73
73
  className: _style.default.cardRank
74
+ }))) : /*#__PURE__*/_react.default.createElement(_reviewCardCongrats.default, _extends({}, cardCongratsStar, {
75
+ className: _style.default.cardStarNoRank
74
76
  }))), /*#__PURE__*/_react.default.createElement("div", {
75
77
  className: _style.default.buttonContainer
76
78
  }, /*#__PURE__*/_react.default.createElement(_buttonLink.default, _extends({}, buttonRevising, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/organism/review-congrats/index.js"],"names":["setScroll","container","current","scrollTo","left","behavior","ReviewCongrats","props","ariaLabel","dataName","animationLottie","title","cardCongratsStar","cardCongratsRank","buttonRevising","buttonRevisingSkill","timer","setTimeout","clearTimeout","style","mainContainer","lottie","ie11Backup","containerCongrats","containerCards","cardStar","cardRank","buttonContainer","buttonRevise","propTypes"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,MAAMA,SAAS,GAAGC,SAAS,IAAI,MAAM;AAC1CA,EAAAA,SAAS,CAACC,OAAV,EAAmBC,QAAnB,IACEF,SAAS,CAACC,OAAV,CAAkBC,QAAlB,CAA2B;AACzBC,IAAAA,IAAI,EAAE,IADmB;AAEzBC,IAAAA,QAAQ,EAAE;AAFe,GAA3B,CADF;AAKD,CANM;;;;AAQP,MAAMC,cAAc,GAAGC,KAAK,IAAI;AAC9B,QAAM;AACJ,kBAAcC,SADV;AAEJ,iBAAaC,QAFT;AAGJC,IAAAA,eAHI;AAIJC,IAAAA,KAJI;AAKJC,IAAAA,gBALI;AAMJC,IAAAA,gBANI;AAOJC,IAAAA,cAPI;AAQJC,IAAAA;AARI,MASFR,KATJ;AAWA,QAAMN,SAAS,GAAG,mBAAO,IAAP,CAAlB;AAEA,wBAAU,MAAM;AACd,UAAMe,KAAK,GAAGC,UAAU,CAACjB,SAAS,CAACC,SAAD,CAAV,EAAuB,IAAvB,CAAxB;AACA,WAAO,MAAMe,KAAK,IAAIE,YAAY,CAACF,KAAD,CAAlC;AACD,GAHD,EAGG,EAHH;AAKA,sBACE;AAAK,IAAA,SAAS,EAAEG,eAAMC,aAAtB;AAAqC,kBAAYZ,SAAjD;AAA4D,iBAAWC;AAAvE,kBACE,6BAAC,sBAAD,eACMC,eADN;AAEE,IAAA,IAAI,EAAE,KAFR;AAGE,IAAA,gBAAgB,EAAE,MAHpB;AAIE,IAAA,QAAQ,MAJV;AAKE,iBAAU,gBALZ;AAME,IAAA,SAAS,EAAES,eAAME,MANnB;AAOE,IAAA,oBAAoB,EAAEF,eAAMG;AAP9B,KADF,eAUE;AAAK,IAAA,SAAS,EAAEH,eAAMI;AAAtB,kBACE;AAAK,IAAA,SAAS,EAAEJ,eAAMR;AAAtB,KAA8BA,KAA9B,CADF,eAEE;AAAK,IAAA,GAAG,EAAEV,SAAV;AAAqB,IAAA,SAAS,EAAEkB,eAAMK;AAAtC,kBACE,6BAAC,2BAAD,eAAgCZ,gBAAhC;AAAkD,IAAA,SAAS,EAAEO,eAAMM;AAAnE,KADF,eAEE,6BAAC,2BAAD,eACMZ,gBADN;AAEE,IAAA,cAAc,EAAE,IAFlB;AAGE,IAAA,SAAS,EAAEM,eAAMO;AAHnB,KAFF,CAFF,eAUE;AAAK,IAAA,SAAS,EAAEP,eAAMQ;AAAtB,kBACE,6BAAC,mBAAD,eACMb,cADN;AAEE,IAAA,SAAS,EAAEK,eAAMS,YAFnB;AAGE,iBAAU;AAHZ,KADF,eAME,6BAAC,mBAAD,eAAgBb,mBAAhB;AAAqC,IAAA,SAAS,EAAEI,eAAMS;AAAtD,KANF,CAVF,CAVF,CADF;AAgCD,CAnDD;;AAqDAtB,cAAc,CAACuB,SAAf,2CAA2BA,kBAA3B;eAEevB,c","sourcesContent":["import React, {useEffect, useRef} from 'react';\nimport AtomLottieWrapper from '../../atom/lottie-wrapper';\nimport ButtonLink from '../../atom/button-link';\nimport MoleculeReviewCardCongrats from '../../molecule/review-card-congrats';\nimport style from './style.css';\nimport propTypes from './prop-types';\n\nexport const setScroll = container => () => {\n container.current?.scrollTo &&\n container.current.scrollTo({\n left: 1000,\n behavior: 'smooth'\n });\n};\n\nconst ReviewCongrats = props => {\n const {\n 'aria-label': ariaLabel,\n 'data-name': dataName,\n animationLottie,\n title,\n cardCongratsStar,\n cardCongratsRank,\n buttonRevising,\n buttonRevisingSkill\n } = props;\n\n const container = useRef(null);\n\n useEffect(() => {\n const timer = setTimeout(setScroll(container), 2000);\n return () => timer && clearTimeout(timer);\n }, []);\n\n return (\n <div className={style.mainContainer} aria-label={ariaLabel} data-name={dataName}>\n <AtomLottieWrapper\n {...animationLottie}\n loop={false}\n animationControl={'play'}\n autoplay\n data-name=\"lottie-wrapper\"\n className={style.lottie}\n backupImageClassName={style.ie11Backup}\n />\n <div className={style.containerCongrats}>\n <div className={style.title}>{title}</div>\n <div ref={container} className={style.containerCards}>\n <MoleculeReviewCardCongrats {...cardCongratsStar} className={style.cardStar} />\n <MoleculeReviewCardCongrats\n {...cardCongratsRank}\n timerAnimation={1800}\n className={style.cardRank}\n />\n </div>\n <div className={style.buttonContainer}>\n <ButtonLink\n {...buttonRevising}\n className={style.buttonRevise}\n data-name=\"revise-skill-link\"\n />\n <ButtonLink {...buttonRevisingSkill} className={style.buttonRevise} />\n </div>\n </div>\n </div>\n );\n};\n\nReviewCongrats.propTypes = propTypes;\n\nexport default ReviewCongrats;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/organism/review-congrats/index.js"],"names":["setScroll","container","current","scrollTo","left","behavior","ReviewCongrats","props","ariaLabel","dataName","animationLottie","title","cardCongratsStar","cardCongratsRank","buttonRevising","buttonRevisingSkill","timer","setTimeout","clearTimeout","style","mainContainer","lottie","ie11Backup","containerCongrats","containerCards","cardStar","cardRank","cardStarNoRank","buttonContainer","buttonRevise","propTypes"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,MAAMA,SAAS,GAAGC,SAAS,IAAI,MAAM;AAC1CA,EAAAA,SAAS,CAACC,OAAV,EAAmBC,QAAnB,IACEF,SAAS,CAACC,OAAV,CAAkBC,QAAlB,CAA2B;AACzBC,IAAAA,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S,EAAEM,eAAMO;AAHnB,KAFF,CADe,gBAUf,6BAAC,2BAAD,eAAgCd,gBAAhC;AAAkD,IAAA,SAAS,EAAEO,eAAMQ;AAAnE,KAXJ,CAFF,eAgBE;AAAK,IAAA,SAAS,EAAER,eAAMS;AAAtB,kBACE,6BAAC,mBAAD,eACMd,cADN;AAEE,IAAA,SAAS,EAAEK,eAAMU,YAFnB;AAGE,iBAAU;AAHZ,KADF,eAME,6BAAC,mBAAD,eAAgBd,mBAAhB;AAAqC,IAAA,SAAS,EAAEI,eAAMU;AAAtD,KANF,CAhBF,CAVF,CADF;AAsCD,CAzDD;;AA2DAvB,cAAc,CAACwB,SAAf,2CAA2BA,kBAA3B;eAEexB,c","sourcesContent":["import React, {useEffect, useRef} from 'react';\nimport AtomLottieWrapper from '../../atom/lottie-wrapper';\nimport ButtonLink from '../../atom/button-link';\nimport MoleculeReviewCardCongrats from '../../molecule/review-card-congrats';\nimport style from './style.css';\nimport propTypes from './prop-types';\n\nexport const setScroll = container => () => {\n container.current?.scrollTo &&\n container.current.scrollTo({\n left: 1000,\n behavior: 'smooth'\n });\n};\n\nconst ReviewCongrats = props => {\n const {\n 'aria-label': ariaLabel,\n 'data-name': dataName,\n animationLottie,\n title,\n cardCongratsStar,\n cardCongratsRank,\n buttonRevising,\n buttonRevisingSkill\n } = props;\n\n const container = useRef(null);\n\n useEffect(() => {\n const timer = setTimeout(setScroll(container), 2000);\n return () => timer && clearTimeout(timer);\n }, []);\n\n return (\n <div className={style.mainContainer} aria-label={ariaLabel} data-name={dataName}>\n <AtomLottieWrapper\n {...animationLottie}\n loop={false}\n animationControl={'play'}\n autoplay\n data-name=\"lottie-wrapper\"\n className={style.lottie}\n backupImageClassName={style.ie11Backup}\n />\n <div className={style.containerCongrats}>\n <div className={style.title}>{title}</div>\n <div ref={container} className={style.containerCards}>\n {cardCongratsRank ? (\n <>\n <MoleculeReviewCardCongrats {...cardCongratsStar} className={style.cardStar} />\n <MoleculeReviewCardCongrats\n {...cardCongratsRank}\n timerAnimation={1800}\n className={style.cardRank}\n />\n </>\n ) : (\n <MoleculeReviewCardCongrats {...cardCongratsStar} className={style.cardStarNoRank} />\n )}\n </div>\n <div className={style.buttonContainer}>\n <ButtonLink\n {...buttonRevising}\n className={style.buttonRevise}\n data-name=\"revise-skill-link\"\n />\n <ButtonLink {...buttonRevisingSkill} className={style.buttonRevise} />\n </div>\n </div>\n </div>\n );\n};\n\nReviewCongrats.propTypes = propTypes;\n\nexport default ReviewCongrats;\n"],"file":"index.js"}
@@ -129,6 +129,11 @@
129
129
  opacity: 0;
130
130
  }
131
131
 
132
+ .cardStarNoRank {
133
+ animation: translateYCardStar 0.5s ease-out 0.8s forwards;
134
+ opacity: 0;
135
+ }
136
+
132
137
  .cardRank {
133
138
  animation: translateCardRank 0.2s ease-in-out 2s forwards;
134
139
  position: absolute;
@@ -126,19 +126,13 @@ const QuestionContainer = props => {
126
126
  const {
127
127
  answerUI,
128
128
  questionText,
129
- questionOrigin
129
+ questionOrigin,
130
+ disableContent
130
131
  } = props;
131
132
  if (!answerUI || !questionText) return null;
132
- const answerProps = (0, _get.default)(['model', 'choices'], answerUI) ?
133
- /* istanbul ignore next */
134
- _extends(_extends({}, answerUI), {}, {
135
- model: _extends(_extends({}, answerUI.model), {}, {
136
- answers: answerUI.model.choices
137
- })
138
- }) : answerUI;
139
133
  return /*#__PURE__*/_react.default.createElement("div", {
140
134
  key: "content-container",
141
- className: _style.default.slideContentContainer
135
+ className: (0, _classnames.default)(_style.default.slideContentContainer, disableContent ? _style.default.disabledSlideContent : null)
142
136
  }, /*#__PURE__*/_react.default.createElement("div", {
143
137
  key: "from-course",
144
138
  className: _style.default.questionOrigin
@@ -155,7 +149,7 @@ const QuestionContainer = props => {
155
149
  }, (0, _get.default)('help', answerUI)), /*#__PURE__*/_react.default.createElement("div", {
156
150
  key: "answer-container",
157
151
  className: _style.default.answerContainer
158
- }, /*#__PURE__*/_react.default.createElement(_answer.default, _extends({}, answerProps, {
152
+ }, /*#__PURE__*/_react.default.createElement(_answer.default, _extends({}, answerUI, {
159
153
  key: "answer"
160
154
  }))));
161
155
  };
@@ -163,7 +157,8 @@ const QuestionContainer = props => {
163
157
  QuestionContainer.propTypes = process.env.NODE_ENV !== "production" ? {
164
158
  answerUI: _propTypes.default.shape(_propTypes2.default.slide.answerUI),
165
159
  questionText: _propTypes.default.string,
166
- questionOrigin: _propTypes.default.string
160
+ questionOrigin: _propTypes.default.string,
161
+ disableContent: _propTypes.default.bool
167
162
  } : {};
168
163
 
169
164
  const ReviewSlide = props => {
@@ -195,6 +190,7 @@ const ReviewSlide = props => {
195
190
  questionOrigin: parentContentTitle,
196
191
  questionText: questionText,
197
192
  answerUI: answerUI,
193
+ disableContent: !showCorrectionPopin,
198
194
  key: "question-container"
199
195
  }), /*#__PURE__*/_react.default.createElement(ValidateButton, {
200
196
  slideIndex: slideIndex,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/organism/review-slide/index.js"],"names":["CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","klf","information","label","message","next","_correctionPopinProps","onClick","console","log","type","resultLabel","style","correctionPopinWrapper","popinAnimation","propTypes","PropTypes","string","bool","ValidateButton","validateButton","primarySkinColor","disabled","validateButtonProps","className","customStyle","backgroundColor","validateButtonWrapper","QuestionContainer","props","answerUI","questionText","questionOrigin","answerProps","model","answers","choices","slideContentContainer","question","__html","help","answerContainer","shape","slide","ReviewSlide","skin","loading","loadingAriaLabel","parentContentTitle","loader"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,eAAe,GAAG,CAAC;AACvBC,EAAAA,oBADuB;AAEvBC,EAAAA,UAFuB;AAGvBC,EAAAA,mBAHuB;AAIvBC,EAAAA;AAJuB,CAAD,KAKlB;AACJ,MAAI,CAACD,mBAAL,EAA0B,OAAO,IAAP;AAE1B,QAAME,GA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JI;AAKJD,IAAAA,QALI;AAMJ/B,IAAAA,mBANI;AAOJC,IAAAA;AAPI,MAQF2C,KARJ;AAUA,sBACE;AAAK,iBAAY,iBAAjB;AAAmC,IAAA,SAAS,EAAE/B,eAAM+B;AAApD,KACGG,OAAO,gBACN,6BAAC,eAAD;AAAQ,IAAA,SAAS,EAAElC,eAAMqC,MAAzB;AAAiC,IAAA,KAAK,EAAC,SAAvC;AAAiD,kBAAYF;AAA7D,IADM,GAGN,cACE,6BAAC,iBAAD;AACE,IAAA,cAAc,EAAEC,kBADlB;AAEE,IAAA,YAAY,EAAEjB,YAFhB;AAGE,IAAA,QAAQ,EAAED,QAHZ;AAIE,IAAA,GAAG,EAAC;AAJN,IADF,eAOE,6BAAC,cAAD;AACE,IAAA,UAAU,EAAEhC,UADd;AAEE,IAAA,cAAc,EAAEsB,cAFlB;AAGE,IAAA,gBAAgB,EAAEC,gBAHpB;AAIE,IAAA,GAAG,EAAC;AAJN,IAPF,eAaE,6BAAC,eAAD;AACE,IAAA,oBAAoB,EAAExB,oBADxB;AAEE,IAAA,UAAU,EAAEC,UAFd;AAGE,IAAA,mBAAmB,EAAEC,mBAHvB;AAIE,IAAA,sBAAsB,EAAEC,sBAJ1B;AAKE,IAAA,GAAG,EAAC;AALN,IAbF,CAJJ,CADF;AA6BD,CA5CD;;AA8CA4C,WAAW,CAAC7B,SAAZ,2CAAwBA,mBAAxB;eAEe6B,W","sourcesContent":["import React, {useMemo} 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\n const _correctionPopinProps = {\n next: {\n onClick: () => {\n // eslint-disable-next-line no-console\n console.log('Next Slide');\n },\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n return (\n <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 slide validation action, this will trigger the correction popin\n (with the useEffect that fires the dispatchers, if there is a nextContent content,\n it will be loaded here) but will not trigger any animations unless the endReview\n signal is received (all slide will disappear, also fired in a useEffect),\n\n if it is the last slide and the content needs to be different, then that update will\n be handled on the next slide logic but the content will be carried from here.\n onClick: async () => {\n // endReview based on nextContent ref exit node values: 'successExitNode' : 'failExitNode'\n await validateSlide();\n },\n */\n };\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} = props;\n if (!answerUI || !questionText) return null;\n\n const answerProps = get(['model', 'choices'], answerUI)\n ? /* istanbul ignore next */ {\n ...answerUI,\n model: {\n ...answerUI.model,\n answers: answerUI.model.choices\n }\n }\n : answerUI;\n\n return (\n <div key=\"content-container\" className={style.slideContentContainer}>\n <div key=\"from-course\" className={style.questionOrigin}>\n {questionOrigin}\n </div>\n <div\n key=\"title\"\n className={style.question}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: questionText}}\n />\n <div key=\"help\" className={style.help}>\n {get('help', answerUI)}\n </div>\n <div key=\"answer-container\" className={style.answerContainer}>\n <Answer {...answerProps} 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};\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 answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n return (\n <div data-name={`slide-container`} 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 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"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/organism/review-slide/index.js"],"names":["CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","klf","information","label","message","next","_correctionPopinProps","onClick","console","log","type","resultLabel","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","loading","loadingAriaLabel","parentContentTitle","loader"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,eAAe,GAAG,CAAC;AACvBC,EAAAA,oBADuB;AAEvBC,EAAAA,UAFuB;AAGvBC,EAAAA,mBAHuB;AAIvBC,EAAAA;AAJuB,CAAD,KAKlB;AACJ,MAAI,CAACD,mBAAL,EAA0B,OAAO,IAAP;AAE1B,QAAME,GAAG,GAAG,oBAAM,EAAN,EAAU,KAAV,EAAiBJ,oBAAjB,CAAZ;AACA,QAAMK,WAAW,GAAG,oBAAM;AAACC,IAAAA,KAAK,EAAE,EAAR;AAAYC,IAAAA,OAAO,EAAE;AAArB,GAAN,EAAgC,aAAhC,EAA+CP,oBAA/C,CAApB;AACA,QAAMQ,IAAI,GAAG,kBAAI,MAAJ,EAAYR,oBAAZ,CAAb;AAEA,QAAMS,qBAAqB,GAAG;AAC5BD,IAAAA,IAAI,EAAE;AACJE,MAAAA,OAAO,EAAE,MAAM;AACb;AACAC,QAAAA,OAAO,CAACC,GAAR,CAAY,YAAZ;AACD,OAJG;AAKJN,MAAAA,KAAK,EAAEE,IAAI,IAAIA,IAAI,CAACF,KALhB;AAMJ,mBAAc,wBAAuBL,UAAW,EAN5C;AAOJ,oBAAcO,IAAI,IAAIA,IAAI,CAAC,YAAD;AAPtB,KADsB;AAU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AA,oBAAoB,EAAExB,oBADxB;AAEE,IAAA,UAAU,EAAEC,UAFd;AAGE,IAAA,mBAAmB,EAAEC,mBAHvB;AAIE,IAAA,sBAAsB,EAAEC,sBAJ1B;AAKE,IAAA,GAAG,EAAC;AALN,IAdF,CAJJ,CADF;AA8BD,CA7CD;;AA+CA0C,WAAW,CAAC3B,SAAZ,2CAAwBA,mBAAxB;eAEe2B,W","sourcesContent":["import React, {useMemo} 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\n const _correctionPopinProps = {\n next: {\n onClick: () => {\n // eslint-disable-next-line no-console\n console.log('Next Slide');\n },\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n return (\n <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 slide validation action, this will trigger the correction popin\n (with the useEffect that fires the dispatchers, if there is a nextContent content,\n it will be loaded here) but will not trigger any animations unless the endReview\n signal is received (all slide will disappear, also fired in a useEffect),\n\n if it is the last slide and the content needs to be different, then that update will\n be handled on the next slide logic but the content will be carried from here.\n onClick: async () => {\n // endReview based on nextContent ref exit node values: 'successExitNode' : 'failExitNode'\n await validateSlide();\n },\n */\n };\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 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 className={style.question}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: questionText}}\n />\n <div key=\"help\" className={style.help}>\n {get('help', answerUI)}\n </div>\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 answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n return (\n <div data-name={`slide-container`} 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={!showCorrectionPopin}\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"],"file":"index.js"}
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+
6
+ var _react = _interopRequireWildcard(require("react"));
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ var _get = _interopRequireDefault(require("lodash/fp/get"));
11
+
12
+ var _getOr = _interopRequireDefault(require("lodash/fp/getOr"));
13
+
14
+ var _index = _interopRequireDefault(require("../../atom/text/index.native"));
15
+
16
+ var _index2 = _interopRequireDefault(require("../../molecule/answer/index.native"));
17
+
18
+ var _templateContext = require("../../template/app-review/template-context");
19
+
20
+ var _index3 = _interopRequireDefault(require("../../hoc/touchable/index.native"));
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
25
+
26
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
27
+
28
+ // import Loader from '../../atom/loader';
29
+ // import ReviewCorrectionPopin from '../../molecule/review-correction-popin';
30
+ const CorrectionPopin = ({
31
+ correctionPopinProps,
32
+ slideIndex,
33
+ showCorrectionPopin,
34
+ animateCorrectionPopin
35
+ }) => {
36
+ if (!showCorrectionPopin) return null;
37
+ const klf = (0, _getOr.default)({}, 'klf', correctionPopinProps);
38
+ const information = (0, _getOr.default)({
39
+ label: '',
40
+ message: ''
41
+ }, 'information', correctionPopinProps);
42
+ const next = (0, _get.default)('next', correctionPopinProps);
43
+ const _correctionPopinProps = {
44
+ next: {
45
+ onClick: () => {
46
+ // eslint-disable-next-line no-console
47
+ console.log('Next Slide');
48
+ },
49
+ label: next && next.label,
50
+ 'data-name': `next-question-button-${slideIndex}`,
51
+ 'aria-label': next && next['aria-label']
52
+ },
53
+ klf,
54
+ information,
55
+ type: correctionPopinProps.type,
56
+ resultLabel: correctionPopinProps.resultLabel
57
+ };
58
+ return /*#__PURE__*/_react.default.createElement(_index.default, null, "ReviewCorrectionPopin") // <ReviewCorrectionPopin {..._correctionPopinProps} />
59
+ ;
60
+ }; // const ValidateButton = ({slideIndex, validateButton, primarySkinColor}) => {
61
+ // const {label, onClick, disabled} = validateButton;
62
+ // const validateButtonProps = {
63
+ // type: 'primary',
64
+ // label,
65
+ // 'aria-label': label,
66
+ // 'data-name': `slide-validate-button-${slideIndex}`,
67
+ // onClick,
68
+ // disabled,
69
+ // customStyle: {
70
+ // backgroundColor: primarySkinColor
71
+ // }
72
+ // };
73
+ // return <Button title="validate todo" />;
74
+ // };
75
+
76
+
77
+ const createQuestionStyle = (theme, brandTheme) => _reactNative.StyleSheet.create({
78
+ questionHeading: {
79
+ // backgroundColor: '#f00', // flex-debug
80
+ justifyContent: 'space-between'
81
+ },
82
+ questionOrigin: {
83
+ fontSize: 12,
84
+ lineHeight: 16,
85
+ color: theme.colors.text.primary,
86
+ marginBottom: theme.spacing.tiny,
87
+ marginTop: theme.spacing.small,
88
+ textAlign: 'center'
89
+ },
90
+ questionText: {
91
+ fontSize: 16,
92
+ lineHeight: 22,
93
+ fontWeight: '700',
94
+ color: theme.colors.text.primary,
95
+ textAlign: 'center'
96
+ },
97
+ questionHelp: {
98
+ // backgroundColor: '#38295b', // flex-debug
99
+ fontSize: 12,
100
+ lineHeight: 16,
101
+ color: theme.colors.gray.medium,
102
+ marginBottom: 0,
103
+ marginTop: theme.spacing.small,
104
+ textAlign: 'center'
105
+ },
106
+ choicesContainer: {
107
+ flex: 1,
108
+ width: '100%',
109
+ // backgroundColor: '#ff0', // flex-debug
110
+ justifyContent: 'center'
111
+ },
112
+ validateButton: {
113
+ backgroundColor: brandTheme?.colors.primary || theme.colors.text.primary,
114
+ borderRadius: 7,
115
+ width: '100%'
116
+ },
117
+ validateButtonText: {
118
+ fontSize: 14,
119
+ lineHeight: 20,
120
+ fontWeight: '700',
121
+ color: theme.colors.white,
122
+ marginBottom: 16,
123
+ marginTop: 16,
124
+ textAlign: 'center'
125
+ }
126
+ });
127
+
128
+ const Question = props => {
129
+ const {
130
+ answerUI,
131
+ questionText,
132
+ questionOrigin
133
+ } = props;
134
+ const {
135
+ theme,
136
+ brandTheme
137
+ } = (0, _templateContext.useTemplateContext)();
138
+ const [style, setStyle] = (0, _react.useState)(null);
139
+ (0, _react.useEffect)(() => {
140
+ const questionStyle = createQuestionStyle(theme, brandTheme);
141
+ setStyle(questionStyle);
142
+ }, [theme, brandTheme]);
143
+ if (!answerUI || !questionText || !style) return null;
144
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
145
+ style: style.questionHeading
146
+ }, /*#__PURE__*/_react.default.createElement(_index.default, {
147
+ style: style.questionOrigin
148
+ }, questionOrigin), /*#__PURE__*/_react.default.createElement(_index.default, {
149
+ style: style.questionText
150
+ }, questionText), /*#__PURE__*/_react.default.createElement(_index.default, {
151
+ style: style.questionHelp
152
+ }, (0, _get.default)('help', answerUI))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
153
+ style: style.choicesContainer
154
+ }, /*#__PURE__*/_react.default.createElement(_index2.default, answerUI)), /*#__PURE__*/_react.default.createElement(_index3.default, {
155
+ style: style.validateButton
156
+ }, /*#__PURE__*/_react.default.createElement(_index.default, {
157
+ style: style.validateButtonText
158
+ }, "@todo validate")));
159
+ };
160
+
161
+ const creatSlideStyle = (num, screenWidth, screenHeight) => {
162
+ const slideWidth = screenWidth - 40 - num * 8;
163
+ const slideHeight = screenHeight * 0.75;
164
+ return _reactNative.StyleSheet.create({
165
+ slide: {
166
+ position: 'absolute',
167
+ top: num * -5,
168
+ left: -slideWidth / 2,
169
+ flex: 1,
170
+ backgroundColor: '#fff',
171
+ // theme.colors.white
172
+ height: slideHeight,
173
+ width: slideWidth,
174
+ justifyContent: 'space-between',
175
+ alignItems: 'center',
176
+ padding: 25,
177
+ shadowColor: '#000',
178
+ shadowOffset: {
179
+ width: 0,
180
+ height: -1
181
+ },
182
+ shadowOpacity: 0.05,
183
+ shadowRadius: 16,
184
+ elevation: 10 - num * 1,
185
+ borderRadius: 16
186
+ }
187
+ });
188
+ };
189
+
190
+ const Slide = props => {
191
+ const {
192
+ slide,
193
+ validateButton,
194
+ correctionPopinProps,
195
+ num,
196
+ slideIndex = '0'
197
+ } = props;
198
+ const {
199
+ width,
200
+ height
201
+ } = (0, _reactNative.useWindowDimensions)();
202
+ const slideStyle = creatSlideStyle(num, width, height);
203
+ const {
204
+ loading,
205
+ parentContentTitle,
206
+ questionText,
207
+ answerUI,
208
+ showCorrectionPopin,
209
+ animateCorrectionPopin
210
+ } = slide;
211
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
212
+ style: slideStyle.slide
213
+ }, loading ?
214
+ /*#__PURE__*/
215
+ // <Loader className={style.loader} theme="default" aria-label={loadingAriaLabel} />
216
+ _react.default.createElement(_index.default, null, "@todo loader ", num) : [/*#__PURE__*/_react.default.createElement(Question, {
217
+ questionOrigin: parentContentTitle,
218
+ questionText: questionText,
219
+ answerUI: answerUI,
220
+ key: "question-container"
221
+ }), /*#__PURE__*/_react.default.createElement(CorrectionPopin, {
222
+ correctionPopinProps: correctionPopinProps,
223
+ slideIndex: slideIndex,
224
+ showCorrectionPopin: showCorrectionPopin,
225
+ animateCorrectionPopin: animateCorrectionPopin,
226
+ key: "correction-popin"
227
+ })]);
228
+ };
229
+
230
+ var _default = Slide;
231
+ exports.default = _default;
232
+ //# sourceMappingURL=index.native.js.map