@coorpacademy/components 10.22.4 → 10.22.5

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 (63) hide show
  1. package/es/atom/html/index.native.js +9 -16
  2. package/es/atom/html/index.native.js.map +1 -1
  3. package/es/atom/input-switch/index.js +43 -6
  4. package/es/atom/input-switch/index.js.map +1 -1
  5. package/es/atom/input-switch/style.css +56 -6
  6. package/es/atom/select-modal/index.native.js +6 -6
  7. package/es/atom/select-modal/index.native.js.map +1 -1
  8. package/es/atom/text/index.native.js +3 -1
  9. package/es/atom/text/index.native.js.map +1 -1
  10. package/es/hoc/modal/select/index.native.js +4 -3
  11. package/es/hoc/modal/select/index.native.js.map +1 -1
  12. package/es/molecule/answer/index.js +39 -32
  13. package/es/molecule/answer/index.js.map +1 -1
  14. package/es/molecule/cm-popin/index.js +101 -14
  15. package/es/molecule/cm-popin/index.js.map +1 -1
  16. package/es/molecule/cm-popin/style.css +153 -9
  17. package/es/molecule/questions/free-text/index.native.js +8 -8
  18. package/es/molecule/questions/free-text/index.native.js.map +1 -1
  19. package/es/molecule/questions/mobile/template/index.native.js +222 -0
  20. package/es/molecule/questions/mobile/template/index.native.js.map +1 -0
  21. package/es/template/app-review/template-context.js +1 -0
  22. package/es/template/app-review/template-context.js.map +1 -1
  23. package/es/template/common/dashboard/index.js +6 -3
  24. package/es/template/common/dashboard/index.js.map +1 -1
  25. package/es/types/app-review.d.js +2 -0
  26. package/es/types/app-review.d.js.map +1 -0
  27. package/es/types/translations.js +2 -0
  28. package/es/types/translations.js.map +1 -0
  29. package/es/util/parse-template-string.js +4 -2
  30. package/es/util/parse-template-string.js.map +1 -1
  31. package/es/variables/colors.css +1 -0
  32. package/lib/atom/html/index.native.js +8 -15
  33. package/lib/atom/html/index.native.js.map +1 -1
  34. package/lib/atom/input-switch/index.js +43 -6
  35. package/lib/atom/input-switch/index.js.map +1 -1
  36. package/lib/atom/input-switch/style.css +56 -6
  37. package/lib/atom/select-modal/index.native.js +5 -5
  38. package/lib/atom/select-modal/index.native.js.map +1 -1
  39. package/lib/atom/text/index.native.js +3 -1
  40. package/lib/atom/text/index.native.js.map +1 -1
  41. package/lib/hoc/modal/select/index.native.js +7 -5
  42. package/lib/hoc/modal/select/index.native.js.map +1 -1
  43. package/lib/molecule/answer/index.js +39 -32
  44. package/lib/molecule/answer/index.js.map +1 -1
  45. package/lib/molecule/cm-popin/index.js +102 -13
  46. package/lib/molecule/cm-popin/index.js.map +1 -1
  47. package/lib/molecule/cm-popin/style.css +153 -9
  48. package/lib/molecule/questions/free-text/index.native.js +7 -7
  49. package/lib/molecule/questions/free-text/index.native.js.map +1 -1
  50. package/lib/molecule/questions/mobile/template/index.native.js +243 -0
  51. package/lib/molecule/questions/mobile/template/index.native.js.map +1 -0
  52. package/lib/template/app-review/template-context.js +1 -0
  53. package/lib/template/app-review/template-context.js.map +1 -1
  54. package/lib/template/common/dashboard/index.js +7 -3
  55. package/lib/template/common/dashboard/index.js.map +1 -1
  56. package/lib/types/app-review.d.js +2 -0
  57. package/lib/types/app-review.d.js.map +1 -0
  58. package/lib/types/translations.js +2 -0
  59. package/lib/types/translations.js.map +1 -0
  60. package/lib/util/parse-template-string.js +4 -2
  61. package/lib/util/parse-template-string.js.map +1 -1
  62. package/lib/variables/colors.css +1 -0
  63. package/package.json +2 -2
@@ -0,0 +1,222 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { View } from 'react-native';
3
+ import trim from 'lodash/fp/trim';
4
+ import last from 'lodash/fp/last';
5
+ import Html from '../../../../atom/html/index.native';
6
+ import Select from '../../../../atom/select-modal/index.native';
7
+ import Space from '../../../../atom/space/index.native';
8
+ import FreeText from '../../free-text/index.native';
9
+ import { useTemplateContext } from '../../../../template/app-review/template-context';
10
+ import parseTemplateString from '../../../../util/parse-template-string';
11
+
12
+ const createStyleSheet = theme => ({
13
+ section: {
14
+ width: '100%',
15
+ flexDirection: 'row',
16
+ flexWrap: 'wrap',
17
+ justifyContent: 'center',
18
+ alignItems: 'center'
19
+ },
20
+ spaced: {
21
+ paddingVertical: theme.spacing.tiny
22
+ },
23
+ input: {
24
+ padding: theme.spacing.tiny,
25
+ borderWidth: 1,
26
+ borderColor: theme.colors.gray.lightMedium,
27
+ borderRadius: theme.radius.common,
28
+ backgroundColor: theme.colors.white,
29
+ minWidth: 175
30
+ },
31
+ htmlText: {
32
+ padding: theme.spacing.tiny,
33
+ color: theme.colors.black,
34
+ fontWeight: theme.fontWeight.bold,
35
+ lineHeight: 30
36
+ },
37
+ text: {
38
+ color: theme.colors.gray.medium,
39
+ fontWeight: theme.fontWeight.bold,
40
+ fontSize: theme.fontSize.regular,
41
+ textAlign: 'center'
42
+ }
43
+ });
44
+
45
+ const Section = ({
46
+ section,
47
+ items,
48
+ index,
49
+ focusedSelectId,
50
+ onInputChange,
51
+ userChoices,
52
+ handleBlur,
53
+ handleFocus,
54
+ isDisabled,
55
+ styles
56
+ }) => {
57
+ const prefix = `question-section-${index + 1}`;
58
+ return /*#__PURE__*/React.createElement(View, {
59
+ style: styles.section,
60
+ key: `container-${prefix}`
61
+ }, section.map((part, id) => {
62
+ return /*#__PURE__*/React.createElement(View, {
63
+ key: `${prefix}-${id}`,
64
+ style: {
65
+ flexDirection: 'row'
66
+ }
67
+ }, /*#__PURE__*/React.createElement(Item, {
68
+ prefix: prefix,
69
+ part: part,
70
+ items: items,
71
+ index: id,
72
+ focusedSelectId: focusedSelectId,
73
+ isDisabled: isDisabled,
74
+ userChoices: userChoices,
75
+ handleBlur: handleBlur,
76
+ handleFocus: handleFocus,
77
+ onInputChange: onInputChange,
78
+ styles: styles
79
+ }), /*#__PURE__*/React.createElement(Space, {
80
+ type: "micro"
81
+ }));
82
+ }));
83
+ };
84
+
85
+ const Item = props => {
86
+ const {
87
+ part,
88
+ index,
89
+ prefix,
90
+ isDisabled = false,
91
+ focusedSelectId,
92
+ items,
93
+ userChoices,
94
+ onInputChange,
95
+ handleBlur,
96
+ handleFocus,
97
+ styles
98
+ } = props;
99
+ const templateContext = useTemplateContext();
100
+ const {
101
+ theme,
102
+ brandTheme,
103
+ translations
104
+ } = templateContext;
105
+ const inputNames = items.map(item => item.name);
106
+ const id = `${prefix}-part-${index + 1}`;
107
+ const isFocused = focusedSelectId === id;
108
+ const selectedStyle = brandTheme && {
109
+ borderColor: brandTheme.colors.primary,
110
+ color: brandTheme.colors.primary
111
+ };
112
+
113
+ if (part.type === 'answerField' && inputNames.includes(part.value)) {
114
+ const itemIndex = items.findIndex(_item => _item.name === part.value);
115
+ const item = items[itemIndex];
116
+ const value = userChoices[itemIndex];
117
+
118
+ if (!item || !item.type || !item.name) {
119
+ return null;
120
+ }
121
+
122
+ const disabledSuffix = isDisabled ? '-disabled' : '';
123
+ const selectedSuffix = value ? '-selected' : '';
124
+
125
+ const handleInputChange = _item => _value => onInputChange(_item, _value);
126
+
127
+ if (item.type === 'text') {
128
+ return /*#__PURE__*/React.createElement(View, {
129
+ style: styles.spaced,
130
+ testID: id
131
+ }, /*#__PURE__*/React.createElement(FreeText, {
132
+ key: id,
133
+ isDisabled: isDisabled,
134
+ onChange: handleInputChange(item),
135
+ value: value,
136
+ testID: `${id}-text${selectedSuffix}${disabledSuffix}`,
137
+ questionType: "template"
138
+ }));
139
+ }
140
+
141
+ if (item.type === 'select') {
142
+ return /*#__PURE__*/React.createElement(View, {
143
+ style: styles.spaced,
144
+ testID: id
145
+ }, /*#__PURE__*/React.createElement(Select, {
146
+ isDisabled: isDisabled,
147
+ questionType: "template",
148
+ values: item.items,
149
+ value: value,
150
+ placeholder: translations.selectAnAnswer,
151
+ isFocused: isFocused,
152
+ onBlur: handleBlur,
153
+ onFocus: handleFocus(id),
154
+ onChange: handleInputChange(item),
155
+ textStyle: styles.text,
156
+ style: [styles.input, value && selectedStyle],
157
+ testID: `${id}-select${selectedSuffix}${disabledSuffix}`
158
+ }));
159
+ }
160
+ }
161
+
162
+ return /*#__PURE__*/React.createElement(Html, {
163
+ key: id,
164
+ fontSize: theme.fontSize.regular,
165
+ testID: id,
166
+ style: styles.htmlText
167
+ }, trim(part.value || ''));
168
+ };
169
+
170
+ const QuestionTemplate = props => {
171
+ const {
172
+ template,
173
+ onInputChange,
174
+ userChoices,
175
+ items,
176
+ handleBlur,
177
+ handleFocus,
178
+ focusedSelectId,
179
+ isDisabled = false
180
+ } = props;
181
+ const templateContext = useTemplateContext();
182
+ const {
183
+ theme
184
+ } = templateContext;
185
+ const [styleSheet, setStylesheet] = useState(null);
186
+ useEffect(() => {
187
+ const _stylesheet = createStyleSheet(theme);
188
+
189
+ setStylesheet(_stylesheet);
190
+ }, [theme]);
191
+
192
+ if (!template || !styleSheet) {
193
+ return null;
194
+ }
195
+
196
+ const parts = parseTemplateString(template);
197
+ const sections = parts.reduce((result, item) => {
198
+ const section = last(result) || [];
199
+ return result.slice(0, -1).concat([section.concat([item])]);
200
+ }, []);
201
+ return /*#__PURE__*/React.createElement(View, {
202
+ style: {
203
+ flex: 1
204
+ },
205
+ testID: "question-template"
206
+ }, sections.map((section, index) => /*#__PURE__*/React.createElement(Section, {
207
+ key: index,
208
+ section: section,
209
+ items: items,
210
+ index: index,
211
+ handleBlur: handleBlur,
212
+ handleFocus: handleFocus,
213
+ focusedSelectId: focusedSelectId,
214
+ onInputChange: onInputChange,
215
+ userChoices: userChoices,
216
+ isDisabled: isDisabled,
217
+ styles: styleSheet
218
+ })));
219
+ };
220
+
221
+ export default QuestionTemplate;
222
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/molecule/questions/mobile/template/index.native.tsx"],"names":["React","useEffect","useState","View","trim","last","Html","Select","Space","FreeText","useTemplateContext","parseTemplateString","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,OAAOA,KAAP,IAAeC,SAAf,EAA0BC,QAA1B,QAAyC,OAAzC;AACA,SAAQC,IAAR,QAAmB,cAAnB;AAEA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AAEA,OAAOC,IAAP,MAAiB,oCAAjB;AACA,OAAOC,MAAP,MAAmB,4CAAnB;AACA,OAAOC,KAAP,MAAkB,qCAAlB;AAGA,OAAOC,QAAP,MAAqB,8BAArB;AACA,SAAQC,kBAAR,QAAiC,kDAAjC;AAEA,OAAOC,mBAAP,MAAgC,wCAAhC;;AAEA,MAAMC,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,eAA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Aa,EAAEC,aARjB;AASE,IAAA,WAAW,EAAEC,WATf;AAUE,IAAA,UAAU,EAAEG,UAVd;AAWE,IAAA,MAAM,EAAE8B;AAXV,IADD,CADH,CADF;AAmBD,CApDD;;AAsDA,eAAeF,gBAAf","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"}
@@ -6,6 +6,7 @@ import defaultTheme from '../../variables/theme.native';
6
6
  // -----------------------------------------------------------------------------
7
7
  const Context = createContext({
8
8
  theme: defaultTheme,
9
+ translations: {},
9
10
  display: {
10
11
  statusBarHeight: 42
11
12
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/template/app-review/template-context.tsx"],"names":["React","createContext","useContext","defaultTheme","Context","theme","display","statusBarHeight","useTemplateContext","context","Error","TemplateContext","values","children"],"mappings":";;AAAA;AAEA,OAAOA,KAAP,IAAeC,aAAf,EAA8BC,UAA9B,QAA+C,OAA/C;AAEA,OAAOC,YAAP,MAAkC,8BAAlC;AAeA;AAEA,MAAMC,OAAO,GAAGH,aAAa,CAAC;AAC5BI,EAAAA,KAAK,EAAEF,YADqB;AAE5BG,EAAAA,OAAO,EAAE;AACPC,IAAAA,eAAe,EAAE;AADV;AAFmB,CAAD,CAA7B,C,CAOA;;AAEA,MAAMC,kBAAkB,GAAG,MAA6B;AACtD,QAAMC,OAAO,GAAGP,UAAU,CAACE,OAAD,CAA1B;;AAEA,MAAI,CAACK,OAAL,EAAc;AACZ,UAAM,IAAIC,KAAJ,CACH,yFADG,CAAN;AAGD;;AAED,SAAOD,OAAP;AACD,CAVD,C,CAYA;;;AAEA,MAAME,eAAe,GAAG,CAAC;AAACC,EAAAA,MAAD;AAASC,EAAAA;AAAT,CAAD,KAA+B;AACrD,sBAAO,oBAAC,OAAD,CAAS,QAAT;AAAkB,IAAA,KAAK,eAAMD,MAAN;AAAvB,KAAuCC,QAAvC,CAAP;AACD,CAFD,C,CAIA;;;AAEA,SAAQF,eAAR,EAAyBH,kBAAzB","sourcesContent":["// -----------------------------------------------------------------------------\n\nimport React, {createContext, useContext} from 'react';\nimport {Analytics} from '../../variables/analytics';\nimport defaultTheme, {Theme} from '../../variables/theme.native';\nimport {Vibration} from '../../variables/vibration';\n\nexport type TemplateContextValues = {\n analytics?: Analytics;\n brandTheme?: any;\n theme: Theme;\n vibration?: Vibration;\n display: {\n statusBarHeight: number;\n };\n};\n\ntype Props = {values: TemplateContextValues; children: any};\n\n// -----------------------------------------------------------------------------\n\nconst Context = createContext({\n theme: defaultTheme,\n display: {\n statusBarHeight: 42\n }\n});\n\n// -----------------------------------------------------------------------------\n\nconst useTemplateContext = (): TemplateContextValues => {\n const context = useContext(Context);\n\n if (!context) {\n throw new Error(\n `❌ [TemplateContext] useTemplateContext must be used within a provider <TemplateContext>`\n );\n }\n\n return context;\n};\n\n// -----------------------------------------------------------------------------\n\nconst TemplateContext = ({values, children}: Props) => {\n return <Context.Provider value={{...values}}>{children}</Context.Provider>;\n};\n\n// -----------------------------------------------------------------------------\n\nexport {TemplateContext, useTemplateContext};\n"],"file":"template-context.js"}
1
+ {"version":3,"sources":["../../../src/template/app-review/template-context.tsx"],"names":["React","createContext","useContext","defaultTheme","Context","theme","translations","display","statusBarHeight","useTemplateContext","context","Error","TemplateContext","values","children"],"mappings":";;AAAA;AAEA,OAAOA,KAAP,IAAeC,aAAf,EAA8BC,UAA9B,QAA+C,OAA/C;AAGA,OAAOC,YAAP,MAAkC,8BAAlC;AAgBA;AAEA,MAAMC,OAAO,GAAGH,aAAa,CAAC;AAC5BI,EAAAA,KAAK,EAAEF,YADqB;AAE5BG,EAAAA,YAAY,EAAE,EAFc;AAG5BC,EAAAA,OAAO,EAAE;AACPC,IAAAA,eAAe,EAAE;AADV;AAHmB,CAAD,CAA7B,C,CAQA;;AAEA,MAAMC,kBAAkB,GAAG,MAA6B;AACtD,QAAMC,OAAO,GAAGR,UAAU,CAACE,OAAD,CAA1B;;AAEA,MAAI,CAACM,OAAL,EAAc;AACZ,UAAM,IAAIC,KAAJ,CACH,yFADG,CAAN;AAGD;;AAED,SAAOD,OAAP;AACD,CAVD,C,CAYA;;;AAEA,MAAME,eAAe,GAAG,CAAC;AAACC,EAAAA,MAAD;AAASC,EAAAA;AAAT,CAAD,KAA+B;AACrD,sBAAO,oBAAC,OAAD,CAAS,QAAT;AAAkB,IAAA,KAAK,eAAMD,MAAN;AAAvB,KAAuCC,QAAvC,CAAP;AACD,CAFD,C,CAIA;;;AAEA,SAAQF,eAAR,EAAyBH,kBAAzB","sourcesContent":["// -----------------------------------------------------------------------------\n\nimport React, {createContext, useContext} from 'react';\nimport {Translations} from '../../types/translations';\nimport {Analytics} from '../../variables/analytics';\nimport defaultTheme, {Theme} from '../../variables/theme.native';\nimport {Vibration} from '../../variables/vibration';\n\nexport type TemplateContextValues = {\n analytics?: Analytics;\n brandTheme?: any;\n theme: Theme;\n translations: Translations;\n vibration?: Vibration;\n display: {\n statusBarHeight: number;\n };\n};\n\ntype Props = {values: TemplateContextValues; children: any};\n\n// -----------------------------------------------------------------------------\n\nconst Context = createContext({\n theme: defaultTheme,\n translations: {},\n display: {\n statusBarHeight: 42\n }\n});\n\n// -----------------------------------------------------------------------------\n\nconst useTemplateContext = (): TemplateContextValues => {\n const context = useContext(Context);\n\n if (!context) {\n throw new Error(\n `❌ [TemplateContext] useTemplateContext must be used within a provider <TemplateContext>`\n );\n }\n\n return context;\n};\n\n// -----------------------------------------------------------------------------\n\nconst TemplateContext = ({values, children}: Props) => {\n return <Context.Provider value={{...values}}>{children}</Context.Provider>;\n};\n\n// -----------------------------------------------------------------------------\n\nexport {TemplateContext, useTemplateContext};\n"],"file":"template-context.js"}
@@ -6,6 +6,7 @@ import BattleRequestList from '../../../molecule/dashboard/battle-request-list';
6
6
  import CardsList from '../../../molecule/dashboard/cards-list';
7
7
  import NewsList from '../../../molecule/dashboard/news-list';
8
8
  import StartBattle from '../../../molecule/dashboard/start-battle';
9
+ import CMPopin from '../../../molecule/cm-popin';
9
10
  import style from './style.css';
10
11
  const Hero = React.memo(function Hero({
11
12
  hero,
@@ -24,7 +25,8 @@ const Dashboard = props => {
24
25
  const {
25
26
  sections = [],
26
27
  hero,
27
- welcome
28
+ welcome,
29
+ cookie
28
30
  } = props;
29
31
 
30
32
  const buildSectionComponent = section => {
@@ -72,13 +74,14 @@ const Dashboard = props => {
72
74
  return /*#__PURE__*/React.createElement("div", {
73
75
  className: style.wrapper,
74
76
  "data-name": "dashboard"
75
- }, sectionsList);
77
+ }, sectionsList, cookie ? /*#__PURE__*/React.createElement(CMPopin, cookie) : null);
76
78
  };
77
79
 
78
80
  Dashboard.propTypes = process.env.NODE_ENV !== "production" ? {
79
81
  hero: Hero.propTypes.hero,
80
82
  welcome: Hero.propTypes.welcome,
81
- sections: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape(BattleRequestList.propTypes), PropTypes.shape(CardsList.propTypes), PropTypes.shape(NewsList.propTypes), PropTypes.shape(StartBattle.propTypes)]))
83
+ sections: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape(BattleRequestList.propTypes), PropTypes.shape(CardsList.propTypes), PropTypes.shape(NewsList.propTypes), PropTypes.shape(StartBattle.propTypes)])),
84
+ cookie: PropTypes.shape(CMPopin.propTypes)
82
85
  } : {};
83
86
  export default Dashboard;
84
87
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/template/common/dashboard/index.js"],"names":["React","PropTypes","Slide","HeroCard","BattleRequestList","CardsList","NewsList","StartBattle","style","Hero","memo","hero","welcome","propTypes","shape","Dashboard","props","sections","buildSectionComponent","section","type","buildSection","index","sectionView","sectionsList","key","map","wrapper","arrayOf","oneOfType"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,qBAAlB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,iBAAP,MAA8B,iDAA9B;AACA,OAAOC,SAAP,MAAsB,wCAAtB;AACA,OAAOC,QAAP,MAAqB,uCAArB;AACA,OAAOC,WAAP,MAAwB,0CAAxB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,IAAI,GAAGT,KAAK,CAACU,IAAN,CAAW,SAASD,IA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AK,MAAA,GAAG,EAAEG;AAAV,OAAkBC,WAAlB,CAAP;AACD,GAJD;;AAMA,QAAMC,YAAY,GAAG,CAAC;AAACJ,IAAAA,IAAI,EAAE,MAAP;AAAeK,IAAAA,GAAG,EAAE;AAApB,GAAD,EAA8B,GAAGR,QAAjC,EAA2CS,GAA3C,CAA+CP,OAAO,iBACzE;AAAK,IAAA,GAAG,EAAEA,OAAO,CAACM;AAAlB,KAAwBJ,YAAY,CAACF,OAAD,CAApC,CADmB,CAArB;AAGA,sBACE;AAAK,IAAA,SAAS,EAAEX,KAAK,CAACmB,OAAtB;AAA+B,iBAAU;AAAzC,KACGH,YADH,CADF;AAKD,CAnCD;;AAqCAT,SAAS,CAACF,SAAV,2CAAsB;AACpBF,EAAAA,IAAI,EAAEF,IAAI,CAACI,SAAL,CAAeF,IADD;AAEpBC,EAAAA,OAAO,EAAEH,IAAI,CAACI,SAAL,CAAeD,OAFJ;AAGpBK,EAAAA,QAAQ,EAAEhB,SAAS,CAAC2B,OAAV,CACR3B,SAAS,CAAC4B,SAAV,CAAoB,CAClB5B,SAAS,CAACa,KAAV,CAAgBV,iBAAiB,CAACS,SAAlC,CADkB,EAElBZ,SAAS,CAACa,KAAV,CAAgBT,SAAS,CAACQ,SAA1B,CAFkB,EAGlBZ,SAAS,CAACa,KAAV,CAAgBR,QAAQ,CAACO,SAAzB,CAHkB,EAIlBZ,SAAS,CAACa,KAAV,CAAgBP,WAAW,CAACM,SAA5B,CAJkB,CAApB,CADQ;AAHU,CAAtB;AAYA,eAAeE,SAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Slide from '../../../atom/slide';\nimport HeroCard from '../../../molecule/hero';\nimport BattleRequestList from '../../../molecule/dashboard/battle-request-list';\nimport CardsList from '../../../molecule/dashboard/cards-list';\nimport NewsList from '../../../molecule/dashboard/news-list';\nimport StartBattle from '../../../molecule/dashboard/start-battle';\nimport style from './style.css';\n\nconst Hero = React.memo(function Hero({hero, welcome}) {\n return <div className={style.hero}>{hero ? <HeroCard {...hero} /> : <Slide {...welcome} />}</div>;\n});\n\nHero.propTypes = {\n hero: PropTypes.shape(HeroCard.propTypes),\n welcome: PropTypes.shape(Slide.propTypes)\n};\n\nconst Dashboard = props => {\n const {sections = [], hero, welcome} = props;\n\n const buildSectionComponent = section => {\n const {type} = section;\n switch (type) {\n case 'hero':\n return <Hero hero={hero} welcome={welcome} />;\n case 'battleRequests':\n return <BattleRequestList {...section} />;\n case 'cards':\n return <CardsList {...section} />;\n case 'news':\n return <NewsList {...section} />;\n case 'battle':\n return <StartBattle {...section} />;\n default:\n return null;\n }\n };\n\n const buildSection = (section, index) => {\n const sectionView = buildSectionComponent(section);\n\n return <div key={index}>{sectionView}</div>;\n };\n\n const sectionsList = [{type: 'hero', key: 'hero'}, ...sections].map(section => (\n <div key={section.key}>{buildSection(section)}</div>\n ));\n return (\n <div className={style.wrapper} data-name=\"dashboard\">\n {sectionsList}\n </div>\n );\n};\n\nDashboard.propTypes = {\n hero: Hero.propTypes.hero,\n welcome: Hero.propTypes.welcome,\n sections: PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.shape(BattleRequestList.propTypes),\n PropTypes.shape(CardsList.propTypes),\n PropTypes.shape(NewsList.propTypes),\n PropTypes.shape(StartBattle.propTypes)\n ])\n )\n};\nexport default Dashboard;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/template/common/dashboard/index.js"],"names":["React","PropTypes","Slide","HeroCard","BattleRequestList","CardsList","NewsList","StartBattle","CMPopin","style","Hero","memo","hero","welcome","propTypes","shape","Dashboard","props","sections","cookie","buildSectionComponent","section","type","buildSection","index","sectionView","sectionsList","key","map","wrapper","arrayOf","oneOfType"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,qBAAlB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,iBAAP,MAA8B,iDAA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B,CAApB,CADQ,CAHU;AAWpBK,EAAAA,MAAM,EAAElB,SAAS,CAACc,KAAV,CAAgBP,OAAO,CAACM,SAAxB;AAXY,CAAtB;AAaA,eAAeE,SAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Slide from '../../../atom/slide';\nimport HeroCard from '../../../molecule/hero';\nimport BattleRequestList from '../../../molecule/dashboard/battle-request-list';\nimport CardsList from '../../../molecule/dashboard/cards-list';\nimport NewsList from '../../../molecule/dashboard/news-list';\nimport StartBattle from '../../../molecule/dashboard/start-battle';\nimport CMPopin from '../../../molecule/cm-popin';\nimport style from './style.css';\n\nconst Hero = React.memo(function Hero({hero, welcome}) {\n return <div className={style.hero}>{hero ? <HeroCard {...hero} /> : <Slide {...welcome} />}</div>;\n});\n\nHero.propTypes = {\n hero: PropTypes.shape(HeroCard.propTypes),\n welcome: PropTypes.shape(Slide.propTypes)\n};\n\nconst Dashboard = props => {\n const {sections = [], hero, welcome, cookie} = props;\n\n const buildSectionComponent = section => {\n const {type} = section;\n switch (type) {\n case 'hero':\n return <Hero hero={hero} welcome={welcome} />;\n case 'battleRequests':\n return <BattleRequestList {...section} />;\n case 'cards':\n return <CardsList {...section} />;\n case 'news':\n return <NewsList {...section} />;\n case 'battle':\n return <StartBattle {...section} />;\n default:\n return null;\n }\n };\n\n const buildSection = (section, index) => {\n const sectionView = buildSectionComponent(section);\n\n return <div key={index}>{sectionView}</div>;\n };\n\n const sectionsList = [{type: 'hero', key: 'hero'}, ...sections].map(section => (\n <div key={section.key}>{buildSection(section)}</div>\n ));\n return (\n <div className={style.wrapper} data-name=\"dashboard\">\n {sectionsList}\n {cookie ? <CMPopin {...cookie} /> : null}\n </div>\n );\n};\n\nDashboard.propTypes = {\n hero: Hero.propTypes.hero,\n welcome: Hero.propTypes.welcome,\n sections: PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.shape(BattleRequestList.propTypes),\n PropTypes.shape(CardsList.propTypes),\n PropTypes.shape(NewsList.propTypes),\n PropTypes.shape(StartBattle.propTypes)\n ])\n ),\n cookie: PropTypes.shape(CMPopin.propTypes)\n};\nexport default Dashboard;\n"],"file":"index.js"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=app-review.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"app-review.d.js"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=translations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"translations.js"}
@@ -1,11 +1,13 @@
1
1
  import _compact from "lodash/fp/compact";
2
2
  const reg = /{{(\w+)}}/;
3
3
 
4
- function parseTemplateString(template) {
5
- if (!template) {
4
+ function parseTemplateString(_template) {
5
+ if (!_template) {
6
6
  return [];
7
7
  }
8
8
 
9
+ const template = _template.replace(/<br\s*\/*>/g, '<br>').replace(/\r?\n|\r/g, '<br>');
10
+
9
11
  const res = reg.exec(template);
10
12
 
11
13
  if (!res) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/util/parse-template-string.js"],"names":["reg","parseTemplateString","template","res","exec","type","value","index","slice","concat","length"],"mappings":";AAEA,MAAMA,GAAG,GAAG,WAAZ;;AAEA,SAASC,mBAAT,CAA6BC,QAA7B,EAAuC;AACrC,MAAI,CAACA,QAAL,EAAe;AACb,WAAO,EAAP;AACD;;AACD,QAAMC,GAAG,GAAGH,GAAG,CAACI,IAAJ,CAASF,QAAT,CAAZ;;AACA,MAAI,CAACC,GAAL,EAAU;AACR,WAAO,CAAC;AAACE,MAAAA,IAAI,EAAE,QAAP;AAAiBC,MAAAA,KAAK,EAAEJ;AAAxB,KAAD,CAAP;AACD;;AACD,SAAO,SAAQ,CACbC,GAAG,CAACI,KAAJ,KAAc,CAAd,GAAkB,IAAlB,GAAyB;AAACF,IAAAA,IAAI,EAAE,QAAP;AAAiBC,IAAAA,KAAK,EAAEJ,QAAQ,CAACM,KAAT,CAAe,CAAf,EAAkBL,GAAG,CAACI,KAAtB;AAAxB,GADZ,EAEb;AAACF,IAAAA,IAAI,EAAE,aAAP;AAAsBC,IAAAA,KAAK,EAAEH,GAAG,CAAC,CAAD;AAAhC,GAFa,CAAR,EAGJM,MAHI,CAGGR,mBAAmB,CAACC,QAAQ,CAACM,KAAT,CAAeL,GAAG,CAACI,KAAJ,GAAYJ,GAAG,CAAC,CAAD,CAAH,CAAOO,MAAlC,CAAD,CAHtB,CAAP;AAID;;AAED,eAAeT,mBAAf","sourcesContent":["import {compact} from 'lodash/fp';\n\nconst reg = /{{(\\w+)}}/;\n\nfunction parseTemplateString(template) {\n if (!template) {\n return [];\n }\n const res = reg.exec(template);\n if (!res) {\n return [{type: 'string', value: template}];\n }\n return compact([\n res.index === 0 ? null : {type: 'string', value: template.slice(0, res.index)},\n {type: 'answerField', value: res[1]}\n ]).concat(parseTemplateString(template.slice(res.index + res[0].length)));\n}\n\nexport default parseTemplateString;\n"],"file":"parse-template-string.js"}
1
+ {"version":3,"sources":["../../src/util/parse-template-string.js"],"names":["reg","parseTemplateString","_template","template","replace","res","exec","type","value","index","slice","concat","length"],"mappings":";AAEA,MAAMA,GAAG,GAAG,WAAZ;;AAEA,SAASC,mBAAT,CAA6BC,SAA7B,EAAwC;AACtC,MAAI,CAACA,SAAL,EAAgB;AACd,WAAO,EAAP;AACD;;AAED,QAAMC,QAAQ,GAAGD,SAAS,CAACE,OAAV,CAAkB,aAAlB,EAAiC,MAAjC,EAAyCA,OAAzC,CAAiD,WAAjD,EAA8D,MAA9D,CAAjB;;AAEA,QAAMC,GAAG,GAAGL,GAAG,CAACM,IAAJ,CAASH,QAAT,CAAZ;;AAEA,MAAI,CAACE,GAAL,EAAU;AACR,WAAO,CAAC;AAACE,MAAAA,IAAI,EAAE,QAAP;AAAiBC,MAAAA,KAAK,EAAEL;AAAxB,KAAD,CAAP;AACD;;AAED,SAAO,SAAQ,CACbE,GAAG,CAACI,KAAJ,KAAc,CAAd,GAAkB,IAAlB,GAAyB;AAACF,IAAAA,IAAI,EAAE,QAAP;AAAiBC,IAAAA,KAAK,EAAEL,QAAQ,CAACO,KAAT,CAAe,CAAf,EAAkBL,GAAG,CAACI,KAAtB;AAAxB,GADZ,EAEb;AAACF,IAAAA,IAAI,EAAE,aAAP;AAAsBC,IAAAA,KAAK,EAAEH,GAAG,CAAC,CAAD;AAAhC,GAFa,CAAR,EAGJM,MAHI,CAGGV,mBAAmB,CAACE,QAAQ,CAACO,KAAT,CAAeL,GAAG,CAACI,KAAJ,GAAYJ,GAAG,CAAC,CAAD,CAAH,CAAOO,MAAlC,CAAD,CAHtB,CAAP;AAID;;AAED,eAAeX,mBAAf","sourcesContent":["import {compact} from 'lodash/fp';\n\nconst reg = /{{(\\w+)}}/;\n\nfunction parseTemplateString(_template) {\n if (!_template) {\n return [];\n }\n\n const template = _template.replace(/<br\\s*\\/*>/g, '<br>').replace(/\\r?\\n|\\r/g, '<br>');\n\n const res = reg.exec(template);\n\n if (!res) {\n return [{type: 'string', value: template}];\n }\n\n return compact([\n res.index === 0 ? null : {type: 'string', value: template.slice(0, res.index)},\n {type: 'answerField', value: res[1]}\n ]).concat(parseTemplateString(template.slice(res.index + res[0].length)));\n}\n\nexport default parseTemplateString;\n"],"file":"parse-template-string.js"}
@@ -67,6 +67,7 @@
67
67
  @value box_shadow_light_dark: rgba(0, 0, 0, 0.12);
68
68
  @value box_shadow_medium_dark: rgba(0, 0, 0, 0.2);
69
69
  @value box_shadow_orange_700: rgba(255, 84, 31, 0.15);
70
+ @value light_blue: #ADC9F5;
70
71
 
71
72
  @value go1_backgound: #144953;
72
73
  @value go1_primary: #D5FD42;
@@ -24,6 +24,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
24
24
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
25
 
26
26
  const Html = props => {
27
+ const [disableBaseFontStyleColor, setDisableBaseFontStyleColor] = (0, _react.useState)(false);
27
28
  const templateContext = (0, _templateContext.useTemplateContext)();
28
29
  const {
29
30
  theme,
@@ -44,13 +45,7 @@ const Html = props => {
44
45
  const handleLinkPress = (0, _react.useMemo)(() => url => {
45
46
  vibration?.vibrate();
46
47
  onLinkPress && onLinkPress(url);
47
- }, [onLinkPress, vibration]);
48
- const state = {
49
- disableBaseFontStyleColor: false
50
- };
51
- const {
52
- disableBaseFontStyleColor
53
- } = state; // Don't use StyleSheet there, it's not a react style
48
+ }, [onLinkPress, vibration]); // Don't use StyleSheet there, it's not a react style
54
49
 
55
50
  const styles = {
56
51
  p: {
@@ -112,11 +107,9 @@ const Html = props => {
112
107
 
113
108
  const renderers = {
114
109
  // eslint-disable-next-line react/display-name
115
- font: (htmlAttribs, children) => {
110
+ font: (htmlAttribs, _children) => {
116
111
  if (htmlAttribs.color) {
117
- (void 0).setState({
118
- disableBaseFontStyleColor: true
119
- });
112
+ setDisableBaseFontStyleColor(true);
120
113
  }
121
114
 
122
115
  return /*#__PURE__*/_react.default.createElement(_index.default, {
@@ -124,18 +117,18 @@ const Html = props => {
124
117
  style: _extends(_extends({}, baseFontStyle), {}, {
125
118
  color: htmlAttribs.color
126
119
  })
127
- }, children);
120
+ }, _children);
128
121
  },
129
- span: (_, children, convertedCSSStyles, {
122
+ span: function Span(_, _children, convertedCSSStyles, {
130
123
  allowFontScaling,
131
124
  key
132
- }) => {
125
+ }) {
133
126
  return /*#__PURE__*/_react.default.createElement(_index.default, {
134
127
  numberOfLines: numberOfLines,
135
128
  allowFontScaling: allowFontScaling,
136
129
  key: key,
137
130
  style: convertedCSSStyles
138
- }, children);
131
+ }, _children);
139
132
  }
140
133
  };
141
134
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/atom/html/index.native.tsx"],"names":["Html","props","templateContext","theme","vibration","children","fontSize","containerStyle","imageStyle","style","testID","anchorTextColor","HTML_ANCHOR_TEXT_COLOR","isTextCentered","numberOfLines","onLinkPress","handleLinkPress","url","vibrate","state","disableBaseFontStyleColor","styles","p","marginVertical","textAlign","u","textDecorationLine","i","fontStyle","b","fontWeight","bold","s","tagsStyles","h1","h2","h3","h4","h5","h6","a","color","img","baseFontStyle","DEFAULT_TEXT_STYLE","colors","black","Array","isArray","styleObject","reduce","result","child","renderers","font","htmlAttribs","setState","span","_","convertedCSSStyles","allowFontScaling","key","html"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;;;;;;;;;AAoBA,MAAMA,IAAI,GAAIC,KAAD,IAAkB;AAC7B,QAAMC,eAAe,GAAG,0CAAxB;AACA,QAAM;AAACC,IAAAA,KAAD;AAAQC,IAAAA;AAAR,MAAqBF,eAA3B;AACA,QAAM;AACJG,IAAAA,QADI;AAEJC,IAAAA,QAFI;AAGJC,IAAAA,cAHI;AAIJC,IAAAA,UAJI;AAKJC,IAAAA,KALI;AAMJC,IAAAA,MANI;AAOJC,IAAAA,eAAe,GAAGC,6BAPd;AAQJC,IAAAA,cARI;AASJC,IAAAA,aATI;AAUJC,IAAAA;AAVI,MAWFd,KAXJ;AAaA,QAAMe,eAAe,GAAG,oBACtB,MAAOC,GAAD,IAAiB;AACrBb,IAAAA,SAAS,EAAEc,OAAX;AAEAH,IAAAA,WAAW,IAAIA,WAAW,CAACE,GAAD,CAA1B;AACD,GALqB,EAMtB,CAACF,WAAD,EAAcX,SAAd,CANsB,CAAxB;AASA,QAAMe,KAAY,GAAG;AACnBC,IAAAA,yBAAyB,EAAE;AADR,GAArB;AAIA,QAAM;AAACA,IAAAA;AAAD,MAA8BD,KAApC,CA7B6B,CA+B7B;;AACA,QAAME,MAAM,GAAG;AACbC,IAAAA,CAAC,EAAE;AACDC,MAAAA,cAAc,EAAE,CADf;AAEDC,MAAAA,SAAS,EAAE;AAFV,KADU;AAK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AACA;AAvBF;AAwBE,IAAA,aAAa,EAAE,CAAC,OAAD,EAAU,QAAV,CAxBjB;AAyBE,IAAA,MAAM,EAAC;AAzBT,IADF,CADF;AA+BD,CAjJD;;eAmJerD,I","sourcesContent":["import React, {useMemo} from 'react';\nimport {View, ViewStyle, ImageStyle, TextStyle} from 'react-native';\nimport HtmlBase from 'react-native-render-html';\n\nimport {HTML_ANCHOR_TEXT_COLOR} from '../../variables/theme.native';\nimport {Vibration} from '../../variables/vibration';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport Text, {DEFAULT_STYLE as DEFAULT_TEXT_STYLE} from '../text/index.native';\n\ntype State = {\n disableBaseFontStyleColor: boolean;\n};\n\nexport type Props = {\n children: string;\n fontSize: number;\n numberOfLines?: number;\n onLinkPress?: (url: string) => void;\n containerStyle?: ViewStyle;\n anchorTextColor?: string;\n imageStyle?: ImageStyle;\n style?: TextStyle;\n testID?: string;\n isTextCentered?: boolean;\n vibration?: Vibration;\n};\n\nconst Html = (props: Props) => {\n const templateContext = useTemplateContext();\n const {theme, vibration} = templateContext;\n const {\n children,\n fontSize,\n containerStyle,\n imageStyle,\n style,\n testID,\n anchorTextColor = HTML_ANCHOR_TEXT_COLOR,\n isTextCentered,\n numberOfLines,\n onLinkPress\n } = props;\n\n const handleLinkPress = useMemo(\n () => (url: string) => {\n vibration?.vibrate();\n\n onLinkPress && onLinkPress(url);\n },\n [onLinkPress, vibration]\n );\n\n const state: State = {\n disableBaseFontStyleColor: false\n };\n\n const {disableBaseFontStyleColor} = state;\n\n // Don't use StyleSheet there, it's not a react style\n const styles = {\n p: {\n marginVertical: 0,\n textAlign: 'center'\n },\n u: {\n textDecorationLine: 'underline'\n },\n i: {\n fontStyle: 'italic'\n },\n b: {\n fontWeight: theme.fontWeight.bold\n },\n s: {\n textDecorationLine: 'line-through'\n }\n };\n\n const tagsStyles = {\n ...styles,\n h1: {fontSize},\n h2: {fontSize},\n h3: {fontSize},\n h4: {fontSize},\n h5: {fontSize},\n h6: {fontSize},\n a: {color: anchorTextColor},\n img: imageStyle\n };\n\n let baseFontStyle = {...DEFAULT_TEXT_STYLE, fontSize, color: theme.colors.black};\n if (style) {\n if (Array.isArray(style)) {\n const styleObject = style.reduce((result, child) => ({\n ...result,\n ...child\n }));\n baseFontStyle = {\n ...baseFontStyle,\n ...styleObject\n };\n } else {\n baseFontStyle = {\n ...baseFontStyle,\n ...style\n };\n }\n }\n\n const renderers = {\n // eslint-disable-next-line react/display-name\n font: (htmlAttribs, children) => {\n if (htmlAttribs.color) {\n this.setState({disableBaseFontStyleColor: true});\n }\n return (\n <Text\n key={1}\n style={{\n ...baseFontStyle,\n color: htmlAttribs.color\n }}\n >\n {children}\n </Text>\n );\n },\n span: (_: any, children: any, convertedCSSStyles: any, {allowFontScaling, key}: any) => {\n return (\n <Text\n numberOfLines={numberOfLines}\n allowFontScaling={allowFontScaling}\n key={key}\n style={convertedCSSStyles}\n >\n {children}\n </Text>\n );\n }\n };\n\n return (\n <View testID={testID} style={containerStyle}>\n <HtmlBase\n // to text-align center on android\n // we have to encapsulate between <p> tag\n // and use custom style define on <p>\n // definition in component style doesn't work\n source={{\n // eslint-disable-next-line no-nested-ternary\n html: isTextCentered\n ? `<p>${children}</p>`\n : numberOfLines\n ? `<span>${children}</span>`\n : `${children}`\n }}\n tagsStyles={tagsStyles}\n baseFontStyle={{\n ...baseFontStyle,\n color: disableBaseFontStyleColor ? null : baseFontStyle.color\n }}\n onLinkPress={handleLinkPress}\n renderers={renderers}\n // this is exceptionally for the onboarding course\n // is the only course that has a gif in the context but the img tag\n // comes with width & height attr and these makes this lib do not render the gif\n // so to avoid it, we decided to ignore these attr\n ignoredStyles={['width', 'height']}\n testID=\"html-base\"\n />\n </View>\n );\n};\n\nexport default Html;\n"],"file":"index.native.js"}
1
+ {"version":3,"sources":["../../../src/atom/html/index.native.tsx"],"names":["Html","props","disableBaseFontStyleColor","setDisableBaseFontStyleColor","templateContext","theme","vibration","children","fontSize","containerStyle","imageStyle","style","testID","anchorTextColor","HTML_ANCHOR_TEXT_COLOR","isTextCentered","numberOfLines","onLinkPress","handleLinkPress","url","vibrate","styles","p","marginVertical","textAlign","u","textDecorationLine","i","fontStyle","b","fontWeight","bold","s","tagsStyles","h1","h2","h3","h4","h5","h6","a","color","img","baseFontStyle","DEFAULT_TEXT_STYLE","colors","black","Array","isArray","styleObject","reduce","result","child","renderers","font","htmlAttribs","_children","span","Span","_","convertedCSSStyles","allowFontScaling","key","html"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AAeA,MAAMA,IAAI,GAAIC,KAAD,IAAkB;AAC7B,QAAM,CAACC,yBAAD,EAA4BC,4BAA5B,IAA4D,qBAAkB,KAAlB,CAAlE;AACA,QAAMC,eAAe,GAAG,0CAAxB;AACA,QAAM;AAACC,IAAAA,KAAD;AAAQC,IAAAA;AAAR,MAAqBF,eAA3B;AACA,QAAM;AACJG,IAAAA,QADI;AAEJC,IAAAA,QAFI;AAGJC,IAAAA,cAHI;AAIJC,IAAAA,UAJI;AAKJC,IAAAA,KALI;AAMJC,IAAAA,MANI;AAOJC,IAAAA,eAAe,GAAGC,6BAPd;AAQJC,IAAAA,cARI;AASJC,IAAAA,aATI;AAUJC,IAAAA;AAVI,MAWFhB,KAXJ;AAaA,QAAMiB,eAAe,GAAG,oBACtB,MAAOC,GAAD,IAAiB;AACrBb,IAAAA,SAAS,EAAEc,OAAX;AAEAH,IAAAA,WAAW,IAAIA,WAAW,CAACE,GAAD,CAA1B;AACD,GALqB,EAMtB,CAACF,WAAD,EAAcX,SAAd,CANsB,CAAxB,CAjB6B,CA0B7B;;AACA,QAAMe,MAAM,GAAG;AACbC,IAAAA,CAAC,EAAE;AACDC,MAAAA,cAAc,EAAE,CADf;AAEDC,MAAAA,SAAS,EAAE;AAFV,KADU;AAKbC,IAAAA,CAAC,EAAE;AACDC,MAAAA,kBAAkB,EAAE;AADnB,KALU;AAQbC,IAAAA,CAAC,EAAE;AAC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A+BD,CAjJD;;eAmJerD,I","sourcesContent":["import React, {useMemo, useState} from 'react';\nimport {View, ViewStyle, ImageStyle, TextStyle} from 'react-native';\nimport HtmlBase from 'react-native-render-html';\n\nimport {HTML_ANCHOR_TEXT_COLOR} from '../../variables/theme.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport Text, {DEFAULT_STYLE as DEFAULT_TEXT_STYLE} from '../text/index.native';\n\nexport type Props = {\n children: string;\n fontSize: number;\n numberOfLines?: number;\n onLinkPress?: (url: string) => void;\n containerStyle?: ViewStyle;\n anchorTextColor?: string;\n imageStyle?: ImageStyle;\n style?: TextStyle;\n testID?: string;\n isTextCentered?: boolean;\n};\n\nconst Html = (props: Props) => {\n const [disableBaseFontStyleColor, setDisableBaseFontStyleColor] = useState<boolean>(false);\n const templateContext = useTemplateContext();\n const {theme, vibration} = templateContext;\n const {\n children,\n fontSize,\n containerStyle,\n imageStyle,\n style,\n testID,\n anchorTextColor = HTML_ANCHOR_TEXT_COLOR,\n isTextCentered,\n numberOfLines,\n onLinkPress\n } = props;\n\n const handleLinkPress = useMemo(\n () => (url: string) => {\n vibration?.vibrate();\n\n onLinkPress && onLinkPress(url);\n },\n [onLinkPress, vibration]\n );\n\n // Don't use StyleSheet there, it's not a react style\n const styles = {\n p: {\n marginVertical: 0,\n textAlign: 'center'\n },\n u: {\n textDecorationLine: 'underline'\n },\n i: {\n fontStyle: 'italic'\n },\n b: {\n fontWeight: theme.fontWeight.bold\n },\n s: {\n textDecorationLine: 'line-through'\n }\n };\n\n const tagsStyles = {\n ...styles,\n h1: {fontSize},\n h2: {fontSize},\n h3: {fontSize},\n h4: {fontSize},\n h5: {fontSize},\n h6: {fontSize},\n a: {color: anchorTextColor},\n img: imageStyle\n };\n\n let baseFontStyle = {...DEFAULT_TEXT_STYLE, fontSize, color: theme.colors.black};\n if (style) {\n if (Array.isArray(style)) {\n const styleObject = style.reduce((result, child) => ({\n ...result,\n ...child\n }));\n baseFontStyle = {\n ...baseFontStyle,\n ...styleObject\n };\n } else {\n baseFontStyle = {\n ...baseFontStyle,\n ...style\n };\n }\n }\n\n const renderers = {\n // eslint-disable-next-line react/display-name\n font: (htmlAttribs, _children) => {\n if (htmlAttribs.color) {\n setDisableBaseFontStyleColor(true);\n }\n return (\n <Text\n key={1}\n style={{\n ...baseFontStyle,\n color: htmlAttribs.color\n }}\n >\n {_children}\n </Text>\n );\n },\n span: function Span(\n _: any,\n _children: any,\n convertedCSSStyles: any,\n {allowFontScaling, key}: any\n ) {\n return (\n <Text\n numberOfLines={numberOfLines}\n allowFontScaling={allowFontScaling}\n key={key}\n style={convertedCSSStyles}\n >\n {_children}\n </Text>\n );\n }\n };\n\n return (\n <View testID={testID} style={containerStyle}>\n <HtmlBase\n // to text-align center on android\n // we have to encapsulate between <p> tag\n // and use custom style define on <p>\n // definition in component style doesn't work\n source={{\n // eslint-disable-next-line no-nested-ternary\n html: isTextCentered\n ? `<p>${children}</p>`\n : numberOfLines\n ? `<span>${children}</span>`\n : `${children}`\n }}\n tagsStyles={tagsStyles}\n baseFontStyle={{\n ...baseFontStyle,\n color: disableBaseFontStyleColor ? null : baseFontStyle.color\n }}\n onLinkPress={handleLinkPress}\n renderers={renderers}\n // this is exceptionally for the onboarding course\n // is the only course that has a gif in the context but the img tag\n // comes with width & height attr and these makes this lib do not render the gif\n // so to avoid it, we decided to ignore these attr\n ignoredStyles={['width', 'height']}\n testID=\"html-base\"\n />\n </View>\n );\n};\n\nexport default Html;\n"],"file":"index.native.js"}
@@ -32,7 +32,9 @@ const InputSwitch = props => {
32
32
  description,
33
33
  modified = false,
34
34
  theme = 'default',
35
- titlePosition = 'left'
35
+ titlePosition = 'left',
36
+ details = '',
37
+ requiredSelection = false
36
38
  } = props;
37
39
  const idSwitch = id || (0, _uniqueId2.default)('input-switch-');
38
40
  const isDisabled = disabled ? 'disabled' : '';
@@ -43,13 +45,42 @@ const InputSwitch = props => {
43
45
  const descriptionView = description ? /*#__PURE__*/_react.default.createElement("div", {
44
46
  className: _style.default.description
45
47
  }, description) : null;
46
- const defaultClass = theme === 'coorpmanager' ? _style.default.coorpmanager : _style.default.default;
47
- const modifiedClass = theme === 'coorpmanager' ? _style.default.coorpmanagerModified : _style.default.modified;
48
+
49
+ const getClass = () => {
50
+ switch (theme) {
51
+ case 'coorpmanager':
52
+ return {
53
+ defaultClass: _style.default.coorpmanager,
54
+ modifiedClass: _style.default.coorpmanagerModified
55
+ };
56
+
57
+ case 'mooc':
58
+ return {
59
+ defaultClass: _style.default.partielUncheck,
60
+ modifiedClass: _style.default.coorpmanagerModified
61
+ };
62
+
63
+ default:
64
+ return {
65
+ defaultClass: _style.default.default,
66
+ modifiedClass: _style.default.modified
67
+ };
68
+ }
69
+ };
70
+
71
+ const {
72
+ defaultClass,
73
+ modifiedClass
74
+ } = getClass();
48
75
  const className = (0, _getClassState.default)(defaultClass, modifiedClass, null, modified);
49
76
  return /*#__PURE__*/_react.default.createElement("div", {
50
77
  className: className,
51
78
  "data-name": `switch-input-${theme}`
52
- }, titlePosition === 'left' ? titleView : null, /*#__PURE__*/_react.default.createElement("input", {
79
+ }, titlePosition === 'left' ? titleView : null, /*#__PURE__*/_react.default.createElement("div", {
80
+ className: requiredSelection ? _style.default.requiredSelection : null
81
+ }, /*#__PURE__*/_react.default.createElement("div", {
82
+ className: _style.default.btnSwitchContainer
83
+ }, /*#__PURE__*/_react.default.createElement("input", {
53
84
  type: "checkbox",
54
85
  id: idSwitch,
55
86
  name: name,
@@ -60,7 +91,11 @@ const InputSwitch = props => {
60
91
  }), /*#__PURE__*/_react.default.createElement("label", {
61
92
  htmlFor: idSwitch,
62
93
  "data-name": "input-switch-label"
63
- }), titlePosition === 'right' ? titleView : null, descriptionView);
94
+ }))), /*#__PURE__*/_react.default.createElement("div", {
95
+ className: !details ? _style.default.alignedTextContainer : null
96
+ }, titlePosition === 'right' ? titleView : null, details ? /*#__PURE__*/_react.default.createElement("div", {
97
+ className: _style.default.detailsTxt
98
+ }, details) : null), descriptionView);
64
99
  };
65
100
 
66
101
  InputSwitch.propTypes = process.env.NODE_ENV !== "production" ? {
@@ -73,7 +108,9 @@ InputSwitch.propTypes = process.env.NODE_ENV !== "production" ? {
73
108
  description: _propTypes.default.string,
74
109
  modified: _propTypes.default.bool,
75
110
  titlePosition: _propTypes.default.oneOf(['right', 'left']),
76
- theme: _propTypes.default.oneOf(['default', 'coorpmanager'])
111
+ theme: _propTypes.default.oneOf(['default', 'coorpmanager', 'mooc']),
112
+ details: _propTypes.default.string,
113
+ requiredSelection: _propTypes.default.bool
77
114
  } : {};
78
115
  var _default = InputSwitch;
79
116
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/atom/input-switch/index.js"],"names":["InputSwitch","props","title","name","id","value","disabled","onChange","description","modified","theme","titlePosition","idSwitch","isDisabled","handleChange","e","target","checked","titleView","style","descriptionView","defaultClass","coorpmanager","default","modifiedClass","coorpmanagerModified","className","checkbox","propTypes","PropTypes","string","bool","func","oneOf"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;AAEA,MAAMA,WAAW,GAAGC,KAAK,IAAI;AAC3B,QAAM;AACJC,IAAAA,KADI;AAEJC,IAAAA,IAFI;AAGJC,IAAAA,EAHI;AAIJC,IAAAA,KAJI;AAKJC,IAAAA,QALI;AAMJC,IAAAA,QAAQ,iBANJ;AAOJC,IAAAA,WAPI;AAQJC,IAAAA,QAAQ,GAAG,KARP;AASJC,IAAAA,KAAK,GAAG,SATJ;AAUJC,IAAAA,aAAa,GAAG;AAVZ,MAWFV,KAXJ;AAaA,QAAMW,QAAQ,GAAGR,EAAE,IAAI,wBAAS,eAAT,CAAvB;AACA,QAAMS,UAAU,GAAGP,QAAQ,GAAG,UAAH,GAAgB,EAA3C;AACA,QAAMQ,YAAY,GAAG,oBAAQ,MAAMC,CAAC,IAAIR,QAAQ,CAACQ,CAAC,CAACC,MAAF,CAASC,OAAV,CAA3B,EAA+C,CAACV,QAAD,CAA/C,CAArB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B,EAAAA,KAAK,EAAEwB,mBAAUE,IAJK;AAKtBzB,EAAAA,QAAQ,EAAEuB,mBAAUE,IALE;AAMtBxB,EAAAA,QAAQ,EAAEsB,mBAAUG,IANE;AAOtBxB,EAAAA,WAAW,EAAEqB,mBAAUC,MAPD;AAQtBrB,EAAAA,QAAQ,EAAEoB,mBAAUE,IARE;AAStBpB,EAAAA,aAAa,EAAEkB,mBAAUI,KAAV,CAAgB,CAAC,OAAD,EAAU,MAAV,CAAhB,CATO;AAUtBvB,EAAAA,KAAK,EAAEmB,mBAAUI,KAAV,CAAgB,CAAC,SAAD,EAAY,cAAZ,CAAhB;AAVe,CAAxB;eAYejC,W","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, uniqueId} from 'lodash/fp';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst InputSwitch = props => {\n const {\n title,\n name,\n id,\n value,\n disabled,\n onChange = noop,\n description,\n modified = false,\n theme = 'default',\n titlePosition = 'left'\n } = props;\n\n const idSwitch = id || uniqueId('input-switch-');\n const isDisabled = disabled ? 'disabled' : '';\n const handleChange = useMemo(() => e => onChange(e.target.checked), [onChange]);\n\n const titleView = title ? <span className={style.title}>{`${title} `}</span> : null;\n\n const descriptionView = description ? (\n <div className={style.description}>{description}</div>\n ) : null;\n\n const defaultClass = theme === 'coorpmanager' ? style.coorpmanager : style.default;\n const modifiedClass = theme === 'coorpmanager' ? style.coorpmanagerModified : style.modified;\n const className = getClassState(defaultClass, modifiedClass, null, modified);\n\n return (\n <div className={className} data-name={`switch-input-${theme}`}>\n {titlePosition === 'left' ? titleView : null}\n <input\n type=\"checkbox\"\n id={idSwitch}\n name={name}\n onChange={handleChange}\n checked={value}\n disabled={isDisabled}\n className={style.checkbox}\n />\n <label htmlFor={idSwitch} data-name=\"input-switch-label\" />\n {titlePosition === 'right' ? titleView : null}\n {descriptionView}\n </div>\n );\n};\n\nInputSwitch.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n id: PropTypes.string,\n value: PropTypes.bool,\n disabled: PropTypes.bool,\n onChange: PropTypes.func,\n description: PropTypes.string,\n modified: PropTypes.bool,\n titlePosition: PropTypes.oneOf(['right', 'left']),\n theme: PropTypes.oneOf(['default', 'coorpmanager'])\n};\nexport default InputSwitch;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/atom/input-switch/index.js"],"names":["InputSwitch","props","title","name","id","value","disabled","onChange","description","modified","theme","titlePosition","details","requiredSelection","idSwitch","isDisabled","handleChange","e","target","checked","titleView","style","descriptionView","getClass","defaultClass","coorpmanager","modifiedClass","coorpmanagerModified","partielUncheck","default","className","btnSwitchContainer","checkbox","alignedTextContainer","detailsTxt","propTypes","PropTypes","string","bool","func","oneOf"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;AAEA,MAAMA,WAAW,GAAGC,KAAK,IAAI;AAC3B,QAAM;AACJC,IAAAA,KADI;AAEJC,IAAAA,IAFI;AAGJC,IAAAA,EAHI;AAIJC,IAAAA,KAJI;AAKJC,IAAAA,QALI;AAMJC,IAAAA,QAAQ,iBANJ;AAOJC,IAAAA,WAPI;AAQJC,IAAAA,QAAQ,GAAG,KARP;AASJC,IAAAA,KAAK,GAAG,SATJ;AAUJC,IAAAA,aAAa,GAAG,MAVZ;AAWJC,IAAAA,OAAO,GAAG,EAXN;AAYJC,IAAAA,iBAAiB,GAAG;AAZhB,MAaFZ,KAbJ;AAeA,QAAMa,QAAQ,GAAGV,EAAE,IAAI,wBAAS,eAAT,CAAvB;AACA,QAAMW,UAAU,GAAGT,QAAQ,GAAG,UAAH,GAAgB,EAA3C;AACA,QAAMU,YAAY,GAAG,oBAAQ,MAAMC,CAAC,IAAIV,QAAQ,CAACU,CAAC,CAACC,MAAF,CAASC,OAAV,CAA3B,EAA+C,CAACZ,QAAD,CAA/C,CAArB;AAEA,QAAMa,SAAS,GAAGlB,KAAK,gBAAG;AAAM,IAAA,SAAS,EAAEmB,e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AEM,eAAMW;AAPnB,IADF,eAUE;AAAO,IAAA,OAAO,EAAElB,QAAhB;AAA0B,iBAAU;AAApC,IAVF,CADF,CAFF,eAgBE;AAAK,IAAA,SAAS,EAAE,CAACF,OAAD,GAAWS,eAAMY,oBAAjB,GAAwC;AAAxD,KACGtB,aAAa,KAAK,OAAlB,GAA4BS,SAA5B,GAAwC,IAD3C,EAEGR,OAAO,gBAAG;AAAK,IAAA,SAAS,EAAES,eAAMa;AAAtB,KAAmCtB,OAAnC,CAAH,GAAuD,IAFjE,CAhBF,EAoBGU,eApBH,CADF;AAwBD,CArED;;AAuEAtB,WAAW,CAACmC,SAAZ,2CAAwB;AACtBjC,EAAAA,KAAK,EAAEkC,mBAAUC,MADK;AAEtBlC,EAAAA,IAAI,EAAEiC,mBAAUC,MAFM;AAGtBjC,EAAAA,EAAE,EAAEgC,mBAAUC,MAHQ;AAItBhC,EAAAA,KAAK,EAAE+B,mBAAUE,IAJK;AAKtBhC,EAAAA,QAAQ,EAAE8B,mBAAUE,IALE;AAMtB/B,EAAAA,QAAQ,EAAE6B,mBAAUG,IANE;AAOtB/B,EAAAA,WAAW,EAAE4B,mBAAUC,MAPD;AAQtB5B,EAAAA,QAAQ,EAAE2B,mBAAUE,IARE;AAStB3B,EAAAA,aAAa,EAAEyB,mBAAUI,KAAV,CAAgB,CAAC,OAAD,EAAU,MAAV,CAAhB,CATO;AAUtB9B,EAAAA,KAAK,EAAE0B,mBAAUI,KAAV,CAAgB,CAAC,SAAD,EAAY,cAAZ,EAA4B,MAA5B,CAAhB,CAVe;AAWtB5B,EAAAA,OAAO,EAAEwB,mBAAUC,MAXG;AAYtBxB,EAAAA,iBAAiB,EAAEuB,mBAAUE;AAZP,CAAxB;eAcetC,W","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, uniqueId} from 'lodash/fp';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst InputSwitch = props => {\n const {\n title,\n name,\n id,\n value,\n disabled,\n onChange = noop,\n description,\n modified = false,\n theme = 'default',\n titlePosition = 'left',\n details = '',\n requiredSelection = false\n } = props;\n\n const idSwitch = id || uniqueId('input-switch-');\n const isDisabled = disabled ? 'disabled' : '';\n const handleChange = useMemo(() => e => onChange(e.target.checked), [onChange]);\n\n const titleView = title ? <span className={style.title}>{`${title} `}</span> : null;\n\n const descriptionView = description ? (\n <div className={style.description}>{description}</div>\n ) : null;\n\n const getClass = () => {\n switch (theme) {\n case 'coorpmanager':\n return {\n defaultClass: style.coorpmanager,\n modifiedClass: style.coorpmanagerModified\n };\n case 'mooc':\n return {\n defaultClass: style.partielUncheck,\n modifiedClass: style.coorpmanagerModified\n };\n default:\n return {defaultClass: style.default, modifiedClass: style.modified};\n }\n };\n const {defaultClass, modifiedClass} = getClass();\n const className = getClassState(defaultClass, modifiedClass, null, modified);\n\n return (\n <div className={className} data-name={`switch-input-${theme}`}>\n {titlePosition === 'left' ? titleView : null}\n <div className={requiredSelection ? style.requiredSelection : null}>\n <div className={style.btnSwitchContainer}>\n <input\n type=\"checkbox\"\n id={idSwitch}\n name={name}\n onChange={handleChange}\n checked={value}\n disabled={isDisabled}\n className={style.checkbox}\n />\n <label htmlFor={idSwitch} data-name=\"input-switch-label\" />\n </div>\n </div>\n <div className={!details ? style.alignedTextContainer : null}>\n {titlePosition === 'right' ? titleView : null}\n {details ? <div className={style.detailsTxt}>{details}</div> : null}\n </div>\n {descriptionView}\n </div>\n );\n};\n\nInputSwitch.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n id: PropTypes.string,\n value: PropTypes.bool,\n disabled: PropTypes.bool,\n onChange: PropTypes.func,\n description: PropTypes.string,\n modified: PropTypes.bool,\n titlePosition: PropTypes.oneOf(['right', 'left']),\n theme: PropTypes.oneOf(['default', 'coorpmanager', 'mooc']),\n details: PropTypes.string,\n requiredSelection: PropTypes.bool\n};\nexport default InputSwitch;\n"],"file":"index.js"}