@coorpacademy/components 10.22.3 → 10.22.4

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 (105) hide show
  1. package/es/atom/drag-and-drop/index.js +2 -1
  2. package/es/atom/drag-and-drop/index.js.map +1 -1
  3. package/es/atom/header-back-button/index.native.js +3 -4
  4. package/es/atom/header-back-button/index.native.js.map +1 -1
  5. package/es/atom/html/index.native.js +153 -0
  6. package/es/atom/html/index.native.js.map +1 -0
  7. package/es/atom/input-checkbox/index.js +3 -2
  8. package/es/atom/input-checkbox/index.js.map +1 -1
  9. package/es/atom/input-switch/index.js +2 -1
  10. package/es/atom/input-switch/index.js.map +1 -1
  11. package/es/atom/select-modal/index.native.js +113 -0
  12. package/es/atom/select-modal/index.native.js.map +1 -0
  13. package/es/atom/space/index.native.js +21 -0
  14. package/es/atom/space/index.native.js.map +1 -0
  15. package/es/atom/text/index.native.js +29 -0
  16. package/es/atom/text/index.native.js.map +1 -0
  17. package/es/hoc/modal/index.native.js +97 -0
  18. package/es/hoc/modal/index.native.js.map +1 -0
  19. package/es/hoc/modal/select/index.native.js +85 -0
  20. package/es/hoc/modal/select/index.native.js.map +1 -0
  21. package/es/hoc/modal/select-item/index.native.js +54 -0
  22. package/es/hoc/modal/select-item/index.native.js.map +1 -0
  23. package/es/hoc/touchable/index.native.js.map +1 -1
  24. package/es/index.js +2 -1
  25. package/es/index.js.map +1 -1
  26. package/es/molecule/cm-popin/index.js +27 -8
  27. package/es/molecule/cm-popin/index.js.map +1 -1
  28. package/es/molecule/cm-popin/style.css +24 -1
  29. package/es/molecule/feedback/index.js +7 -3
  30. package/es/molecule/feedback/index.js.map +1 -1
  31. package/es/molecule/feedback/style.css +24 -0
  32. package/es/template/app-player/player/index.js +6 -3
  33. package/es/template/app-player/player/index.js.map +1 -1
  34. package/es/template/app-player/popin-end/index.js +21 -6
  35. package/es/template/app-player/popin-end/index.js.map +1 -1
  36. package/es/template/app-player/popin-end/style.css +1 -1
  37. package/es/template/app-player/popin-end/summary.css +65 -0
  38. package/es/template/app-player/popin-end/summary.js +57 -7
  39. package/es/template/app-player/popin-end/summary.js.map +1 -1
  40. package/es/template/app-player/popin-header/index.js +33 -12
  41. package/es/template/app-player/popin-header/index.js.map +1 -1
  42. package/es/template/app-player/popin-header/style.css +93 -0
  43. package/es/template/app-player/popin-no-access/index.js +27 -0
  44. package/es/template/app-player/popin-no-access/index.js.map +1 -0
  45. package/es/template/app-review/prop-types.js +2 -1
  46. package/es/template/app-review/prop-types.js.map +1 -1
  47. package/es/template/app-review/slides/index.js +2 -2
  48. package/es/template/app-review/slides/index.js.map +1 -1
  49. package/es/types/progression-engine.d.js +2 -0
  50. package/es/types/progression-engine.d.js.map +1 -0
  51. package/es/variables/theme.native.js +1 -0
  52. package/es/variables/theme.native.js.map +1 -1
  53. package/lib/atom/drag-and-drop/index.js +2 -1
  54. package/lib/atom/drag-and-drop/index.js.map +1 -1
  55. package/lib/atom/header-back-button/index.native.js +3 -4
  56. package/lib/atom/header-back-button/index.native.js.map +1 -1
  57. package/lib/atom/html/index.native.js +170 -0
  58. package/lib/atom/html/index.native.js.map +1 -0
  59. package/lib/atom/input-checkbox/index.js +2 -1
  60. package/lib/atom/input-checkbox/index.js.map +1 -1
  61. package/lib/atom/input-switch/index.js +2 -1
  62. package/lib/atom/input-switch/index.js.map +1 -1
  63. package/lib/atom/select-modal/index.native.js +135 -0
  64. package/lib/atom/select-modal/index.native.js.map +1 -0
  65. package/lib/atom/space/index.native.js +33 -0
  66. package/lib/atom/space/index.native.js.map +1 -0
  67. package/lib/atom/text/index.native.js +44 -0
  68. package/lib/atom/text/index.native.js.map +1 -0
  69. package/lib/hoc/modal/index.native.js +114 -0
  70. package/lib/hoc/modal/index.native.js.map +1 -0
  71. package/lib/hoc/modal/select/index.native.js +101 -0
  72. package/lib/hoc/modal/select/index.native.js.map +1 -0
  73. package/lib/hoc/modal/select-item/index.native.js +70 -0
  74. package/lib/hoc/modal/select-item/index.native.js.map +1 -0
  75. package/lib/hoc/touchable/index.native.js.map +1 -1
  76. package/lib/index.js +4 -0
  77. package/lib/index.js.map +1 -1
  78. package/lib/molecule/cm-popin/index.js +27 -8
  79. package/lib/molecule/cm-popin/index.js.map +1 -1
  80. package/lib/molecule/cm-popin/style.css +24 -1
  81. package/lib/molecule/feedback/index.js +7 -3
  82. package/lib/molecule/feedback/index.js.map +1 -1
  83. package/lib/molecule/feedback/style.css +24 -0
  84. package/lib/template/app-player/player/index.js +7 -3
  85. package/lib/template/app-player/player/index.js.map +1 -1
  86. package/lib/template/app-player/popin-end/index.js +21 -6
  87. package/lib/template/app-player/popin-end/index.js.map +1 -1
  88. package/lib/template/app-player/popin-end/style.css +1 -1
  89. package/lib/template/app-player/popin-end/summary.css +65 -0
  90. package/lib/template/app-player/popin-end/summary.js +58 -7
  91. package/lib/template/app-player/popin-end/summary.js.map +1 -1
  92. package/lib/template/app-player/popin-header/index.js +32 -11
  93. package/lib/template/app-player/popin-header/index.js.map +1 -1
  94. package/lib/template/app-player/popin-header/style.css +93 -0
  95. package/lib/template/app-player/popin-no-access/index.js +37 -0
  96. package/lib/template/app-player/popin-no-access/index.js.map +1 -0
  97. package/lib/template/app-review/prop-types.js +2 -1
  98. package/lib/template/app-review/prop-types.js.map +1 -1
  99. package/lib/template/app-review/slides/index.js +2 -2
  100. package/lib/template/app-review/slides/index.js.map +1 -1
  101. package/lib/types/progression-engine.d.js +2 -0
  102. package/lib/types/progression-engine.d.js.map +1 -0
  103. package/lib/variables/theme.native.js +3 -1
  104. package/lib/variables/theme.native.js.map +1 -1
  105. package/package.json +6 -4
@@ -0,0 +1,170 @@
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 _reactNativeRenderHtml = _interopRequireDefault(require("react-native-render-html"));
11
+
12
+ var _theme = require("../../variables/theme.native");
13
+
14
+ var _templateContext = require("../../template/app-review/template-context");
15
+
16
+ var _index = _interopRequireWildcard(require("../text/index.native"));
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
21
+
22
+ 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; }
23
+
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
+
26
+ const Html = props => {
27
+ const templateContext = (0, _templateContext.useTemplateContext)();
28
+ const {
29
+ theme,
30
+ vibration
31
+ } = templateContext;
32
+ const {
33
+ children,
34
+ fontSize,
35
+ containerStyle,
36
+ imageStyle,
37
+ style,
38
+ testID,
39
+ anchorTextColor = _theme.HTML_ANCHOR_TEXT_COLOR,
40
+ isTextCentered,
41
+ numberOfLines,
42
+ onLinkPress
43
+ } = props;
44
+ const handleLinkPress = (0, _react.useMemo)(() => url => {
45
+ vibration?.vibrate();
46
+ 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
54
+
55
+ const styles = {
56
+ p: {
57
+ marginVertical: 0,
58
+ textAlign: 'center'
59
+ },
60
+ u: {
61
+ textDecorationLine: 'underline'
62
+ },
63
+ i: {
64
+ fontStyle: 'italic'
65
+ },
66
+ b: {
67
+ fontWeight: theme.fontWeight.bold
68
+ },
69
+ s: {
70
+ textDecorationLine: 'line-through'
71
+ }
72
+ };
73
+
74
+ const tagsStyles = _extends(_extends({}, styles), {}, {
75
+ h1: {
76
+ fontSize
77
+ },
78
+ h2: {
79
+ fontSize
80
+ },
81
+ h3: {
82
+ fontSize
83
+ },
84
+ h4: {
85
+ fontSize
86
+ },
87
+ h5: {
88
+ fontSize
89
+ },
90
+ h6: {
91
+ fontSize
92
+ },
93
+ a: {
94
+ color: anchorTextColor
95
+ },
96
+ img: imageStyle
97
+ });
98
+
99
+ let baseFontStyle = _extends(_extends({}, _index.DEFAULT_STYLE), {}, {
100
+ fontSize,
101
+ color: theme.colors.black
102
+ });
103
+
104
+ if (style) {
105
+ if (Array.isArray(style)) {
106
+ const styleObject = style.reduce((result, child) => _extends(_extends({}, result), child));
107
+ baseFontStyle = _extends(_extends({}, baseFontStyle), styleObject);
108
+ } else {
109
+ baseFontStyle = _extends(_extends({}, baseFontStyle), style);
110
+ }
111
+ }
112
+
113
+ const renderers = {
114
+ // eslint-disable-next-line react/display-name
115
+ font: (htmlAttribs, children) => {
116
+ if (htmlAttribs.color) {
117
+ (void 0).setState({
118
+ disableBaseFontStyleColor: true
119
+ });
120
+ }
121
+
122
+ return /*#__PURE__*/_react.default.createElement(_index.default, {
123
+ key: 1,
124
+ style: _extends(_extends({}, baseFontStyle), {}, {
125
+ color: htmlAttribs.color
126
+ })
127
+ }, children);
128
+ },
129
+ span: (_, children, convertedCSSStyles, {
130
+ allowFontScaling,
131
+ key
132
+ }) => {
133
+ return /*#__PURE__*/_react.default.createElement(_index.default, {
134
+ numberOfLines: numberOfLines,
135
+ allowFontScaling: allowFontScaling,
136
+ key: key,
137
+ style: convertedCSSStyles
138
+ }, children);
139
+ }
140
+ };
141
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
142
+ testID: testID,
143
+ style: containerStyle
144
+ }, /*#__PURE__*/_react.default.createElement(_reactNativeRenderHtml.default // to text-align center on android
145
+ // we have to encapsulate between <p> tag
146
+ // and use custom style define on <p>
147
+ // definition in component style doesn't work
148
+ , {
149
+ source: {
150
+ // eslint-disable-next-line no-nested-ternary
151
+ html: isTextCentered ? `<p>${children}</p>` : numberOfLines ? `<span>${children}</span>` : `${children}`
152
+ },
153
+ tagsStyles: tagsStyles,
154
+ baseFontStyle: _extends(_extends({}, baseFontStyle), {}, {
155
+ color: disableBaseFontStyleColor ? null : baseFontStyle.color
156
+ }),
157
+ onLinkPress: handleLinkPress,
158
+ renderers: renderers // this is exceptionally for the onboarding course
159
+ // is the only course that has a gif in the context but the img tag
160
+ // comes with width & height attr and these makes this lib do not render the gif
161
+ // so to avoid it, we decided to ignore these attr
162
+ ,
163
+ ignoredStyles: ['width', 'height'],
164
+ testID: "html-base"
165
+ }));
166
+ };
167
+
168
+ var _default = Html;
169
+ exports.default = _default;
170
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +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;;;;;;;;;;AAoB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AASrD,QAAT,EAAwBsD,kBAAxB,EAAiD;AAACC,MAAAA,gBAAD;AAAmBC,MAAAA;AAAnB,KAAjD,KAAkF;AACtF,0BACE,6BAAC,cAAD;AACE,QAAA,aAAa,EAAE/C,aADjB;AAEE,QAAA,gBAAgB,EAAE8C,gBAFpB;AAGE,QAAA,GAAG,EAAEC,GAHP;AAIE,QAAA,KAAK,EAAEF;AAJT,SAMGtD,QANH,CADF;AAUD;AA7Be,GAAlB;AAgCA,sBACE,6BAAC,iBAAD;AAAM,IAAA,MAAM,EAAEK,MAAd;AAAsB,IAAA,KAAK,EAAEH;AAA7B,kBACE,6BAAC,8BAAD,CACE;AACA;AACA;AACA;AAJF;AAKE,IAAA,MAAM,EAAE;AACN;AACAuD,MAAAA,IAAI,EAAEjD,cAAc,GACf,MAAKR,QAAS,MADC,GAEhBS,aAAa,GACZ,SAAQT,QAAS,SADL,GAEZ,GAAEA,QAAS;AANV,KALV;AAaE,IAAA,UAAU,EAAE4B,UAbd;AAcE,IAAA,aAAa,wBACRU,aADQ;AAEXF,MAAAA,KAAK,EAAErB,yBAAyB,GAAG,IAAH,GAAUuB,aAAa,CAACF;AAF7C,MAdf;AAkBE,IAAA,WAAW,EAAEzB,eAlBf;AAmBE,IAAA,SAAS,EAAEqC,SAnBb,CAoBE;AACA;AACA;AACA;AAvBF;AAwBE,IAAA,aAAa,EAAE,CAAC,OAAD,EAAU,QAAV,CAxBjB;AAyBE,IAAA,MAAM,EAAC;AAzBT,IADF,CADF;AA+BD,CAjJD;;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"}
@@ -50,7 +50,7 @@ const InputCheckbox = props => {
50
50
  const titleStyleClassName = titleStylesClassNames[titleStyle];
51
51
  const idCheckbox = (0, _uniqueId2.default)('input-checkbox-');
52
52
  const title = `${propsTitle}${required ? '*' : ''}`;
53
- const handleChange = (0, _react.useMemo)(() => e => onChange(e.target.checked), [onChange]);
53
+ const handleChange = (0, _react.useCallback)(e => onChange(e.target.checked), [onChange]);
54
54
  const modifiedClassName = theme === 'coorpmanager' ? _style.default.coorpManagerModified : _style.default.defaultModified;
55
55
  const errorClassName = theme === 'coorpmanager' ? _style.default.coorpManagerError : _style.default.defaultError;
56
56
  const defaultContainerClassName = theme === 'coorpmanager' ? _style.default.coorpManager : _style.default.default;
@@ -69,6 +69,7 @@ const InputCheckbox = props => {
69
69
  disabled: disabled,
70
70
  "data-name": "checkbox-input"
71
71
  }), /*#__PURE__*/_react.default.createElement("div", {
72
+ "data-name": "checkbox-label",
72
73
  className: (0, _classnames.default)(_style.default.label, noLabelMargins ? _style.default.noLabelMargins : undefined)
73
74
  }, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaSolidStatusValidate, {
74
75
  className: _style.default.icon
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/atom/input-checkbox/index.js"],"names":["titleStylesClassNames","inherit","style","primary","secondary","tertiary","InputCheckbox","props","checked","onChange","error","disabled","required","titleStyle","modified","theme","title","propsTitle","noLabelMargins","titleStyleClassName","idCheckbox","handleChange","e","target","modifiedClassName","coorpManagerModified","defaultModified","errorClassName","coorpManagerError","defaultError","defaultContainerClassName","coorpManager","default","className","checkbox","label","undefined","icon","propTypes","PropTypes","string","isRequired","bool","func","oneOf"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;AAEA,MAAMA,qBAAqB,GAAG;AAC5BC,EAAAA,OAAO,EAAEC,eAAMD,OADa;AAE5BE,EAAAA,OAAO,EAAED,eAAMC,OAFa;AAG5BC,EAAAA,SAAS,EAAEF,eAAME,SAHW;AAI5BC,EAAAA,QAAQ,EAAEH,eAAMG;AAJY,CAA9B;;AAOA,MAAMC,aAAa,GAAGC,KAAK,IAAI;AAC7B,QAAM;AACJC,IAAAA,OADI;AAEJC,IAAAA,QAAQ,iBAFJ;AAGJC,IAAAA,KAHI;AAIJC,IAAAA,QAJI;AAKJC,IAAAA,QALI;AAMJC,IAAAA,UAAU,GAAG,SANT;AAOJC,IAAAA,QAAQ,GAAG,KAPP;AAQJC,IAAAA,KAAK,GAAG,SARJ;AASJC,IAAAA,KAAK,EAAEC,UATH;AAUJC,IAAAA,cAAc,GAAG;AAVb,MAWFX,KAXJ;AAaA,QAAMY,mBAAmB,GAAGnB,qBAAqB,CAACa,UAAD,CAAjD;AACA,QAAMO,UAAU,GAAG,wBAAS,iBAAT,CAAnB;AACA,QAAMJ,KAAK,GAAI,GAAEC,UAAW,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D,CApDD;;AAsDAV,aAAa,CAACgC,SAAd,2CAA0B;AACxBtB,EAAAA,KAAK,EAAEuB,mBAAUC,MAAV,CAAiBC,UADA;AAExB9B,EAAAA,QAAQ,EAAE4B,mBAAUG,IAFI;AAGxB9B,EAAAA,QAAQ,EAAE2B,mBAAUG,IAHI;AAIxBlC,EAAAA,OAAO,EAAE+B,mBAAUG,IAJK;AAKxBhC,EAAAA,KAAK,EAAE6B,mBAAUG,IALO;AAMxBjC,EAAAA,QAAQ,EAAE8B,mBAAUI,IANI;AAOxB7B,EAAAA,QAAQ,EAAEyB,mBAAUG,IAPI;AAQxBxB,EAAAA,cAAc,EAAEqB,mBAAUG,IARF;AASxB3B,EAAAA,KAAK,EAAEwB,mBAAUK,KAAV,CAAgB,CAAC,cAAD,EAAiB,SAAjB,CAAhB,CATiB;AAUxB/B,EAAAA,UAAU,EAAE0B,mBAAUK,KAAV,CAAgB,oBAAK5C,qBAAL,CAAhB;AAVY,CAA1B;eAaeM,a","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {NovaSolidStatusValidate as CheckIcon} from '@coorpacademy/nova-icons';\nimport {keys, noop, uniqueId} from 'lodash/fp';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst titleStylesClassNames = {\n inherit: style.inherit,\n primary: style.primary,\n secondary: style.secondary,\n tertiary: style.tertiary\n};\n\nconst InputCheckbox = props => {\n const {\n checked,\n onChange = noop,\n error,\n disabled,\n required,\n titleStyle = 'primary',\n modified = false,\n theme = 'default',\n title: propsTitle,\n noLabelMargins = false\n } = props;\n\n const titleStyleClassName = titleStylesClassNames[titleStyle];\n const idCheckbox = uniqueId('input-checkbox-');\n const title = `${propsTitle}${required ? '*' : ''}`;\n const handleChange = useMemo(() => e => onChange(e.target.checked), [onChange]);\n\n const modifiedClassName =\n theme === 'coorpmanager' ? style.coorpManagerModified : style.defaultModified;\n const errorClassName = theme === 'coorpmanager' ? style.coorpManagerError : style.defaultError;\n const defaultContainerClassName = theme === 'coorpmanager' ? style.coorpManager : style.default;\n\n const className = getClassState(\n defaultContainerClassName,\n modifiedClassName,\n errorClassName,\n modified,\n error\n );\n\n return (\n <label className={className} htmlFor={idCheckbox} data-name=\"checkbox-input-label\">\n <input\n type=\"checkbox\"\n className={style.checkbox}\n name={title}\n id={idCheckbox}\n checked={checked}\n onChange={handleChange}\n disabled={disabled}\n data-name=\"checkbox-input\"\n />\n <div className={classnames(style.label, noLabelMargins ? style.noLabelMargins : undefined)}>\n <CheckIcon className={style.icon} />\n </div>\n <span className={titleStyleClassName} title={title}>\n {title}\n </span>\n </label>\n );\n};\n\nInputCheckbox.propTypes = {\n title: PropTypes.string.isRequired,\n disabled: PropTypes.bool,\n required: PropTypes.bool,\n checked: PropTypes.bool,\n error: PropTypes.bool,\n onChange: PropTypes.func,\n modified: PropTypes.bool,\n noLabelMargins: PropTypes.bool,\n theme: PropTypes.oneOf(['coorpmanager', 'default']),\n titleStyle: PropTypes.oneOf(keys(titleStylesClassNames))\n};\n\nexport default InputCheckbox;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/atom/input-checkbox/index.js"],"names":["titleStylesClassNames","inherit","style","primary","secondary","tertiary","InputCheckbox","props","checked","onChange","error","disabled","required","titleStyle","modified","theme","title","propsTitle","noLabelMargins","titleStyleClassName","idCheckbox","handleChange","e","target","modifiedClassName","coorpManagerModified","defaultModified","errorClassName","coorpManagerError","defaultError","defaultContainerClassName","coorpManager","default","className","checkbox","label","undefined","icon","propTypes","PropTypes","string","isRequired","bool","func","oneOf"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;AAEA,MAAMA,qBAAqB,GAAG;AAC5BC,EAAAA,OAAO,EAAEC,eAAMD,OADa;AAE5BE,EAAAA,OAAO,EAAED,eAAMC,OAFa;AAG5BC,EAAAA,SAAS,EAAEF,eAAME,SAHW;AAI5BC,EAAAA,QAAQ,EAAE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EAAElB,eAAMgC,QAFnB;AAGE,IAAA,IAAI,EAAElB,KAHR;AAIE,IAAA,EAAE,EAAEI,UAJN;AAKE,IAAA,OAAO,EAAEZ,OALX;AAME,IAAA,QAAQ,EAAEa,YANZ;AAOE,IAAA,QAAQ,EAAEV,QAPZ;AAQE,iBAAU;AARZ,IADF,eAWE;AACE,iBAAU,gBADZ;AAEE,IAAA,SAAS,EAAE,yBAAWT,eAAMiC,KAAjB,EAAwBjB,cAAc,GAAGhB,eAAMgB,cAAT,GAA0BkB,SAAhE;AAFb,kBAIE,6BAAC,kCAAD;AAAW,IAAA,SAAS,EAAElC,eAAMmC;AAA5B,IAJF,CAXF,eAiBE;AAAM,IAAA,SAAS,EAAElB,mBAAjB;AAAsC,IAAA,KAAK,EAAEH;AAA7C,KACGA,KADH,CAjBF,CADF;AAuBD,CAvDD;;AAyDAV,aAAa,CAACgC,SAAd,2CAA0B;AACxBtB,EAAAA,KAAK,EAAEuB,mBAAUC,MAAV,CAAiBC,UADA;AAExB9B,EAAAA,QAAQ,EAAE4B,mBAAUG,IAFI;AAGxB9B,EAAAA,QAAQ,EAAE2B,mBAAUG,IAHI;AAIxBlC,EAAAA,OAAO,EAAE+B,mBAAUG,IAJK;AAKxBhC,EAAAA,KAAK,EAAE6B,mBAAUG,IALO;AAMxBjC,EAAAA,QAAQ,EAAE8B,mBAAUI,IANI;AAOxB7B,EAAAA,QAAQ,EAAEyB,mBAAUG,IAPI;AAQxBxB,EAAAA,cAAc,EAAEqB,mBAAUG,IARF;AASxB3B,EAAAA,KAAK,EAAEwB,mBAAUK,KAAV,CAAgB,CAAC,cAAD,EAAiB,SAAjB,CAAhB,CATiB;AAUxB/B,EAAAA,UAAU,EAAE0B,mBAAUK,KAAV,CAAgB,oBAAK5C,qBAAL,CAAhB;AAVY,CAA1B;eAaeM,a","sourcesContent":["import React, {useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {NovaSolidStatusValidate as CheckIcon} from '@coorpacademy/nova-icons';\nimport {keys, noop, uniqueId} from 'lodash/fp';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst titleStylesClassNames = {\n inherit: style.inherit,\n primary: style.primary,\n secondary: style.secondary,\n tertiary: style.tertiary\n};\n\nconst InputCheckbox = props => {\n const {\n checked,\n onChange = noop,\n error,\n disabled,\n required,\n titleStyle = 'primary',\n modified = false,\n theme = 'default',\n title: propsTitle,\n noLabelMargins = false\n } = props;\n\n const titleStyleClassName = titleStylesClassNames[titleStyle];\n const idCheckbox = uniqueId('input-checkbox-');\n const title = `${propsTitle}${required ? '*' : ''}`;\n const handleChange = useCallback(e => onChange(e.target.checked), [onChange]);\n\n const modifiedClassName =\n theme === 'coorpmanager' ? style.coorpManagerModified : style.defaultModified;\n const errorClassName = theme === 'coorpmanager' ? style.coorpManagerError : style.defaultError;\n const defaultContainerClassName = theme === 'coorpmanager' ? style.coorpManager : style.default;\n\n const className = getClassState(\n defaultContainerClassName,\n modifiedClassName,\n errorClassName,\n modified,\n error\n );\n\n return (\n <label className={className} htmlFor={idCheckbox} data-name=\"checkbox-input-label\">\n <input\n type=\"checkbox\"\n className={style.checkbox}\n name={title}\n id={idCheckbox}\n checked={checked}\n onChange={handleChange}\n disabled={disabled}\n data-name=\"checkbox-input\"\n />\n <div\n data-name=\"checkbox-label\"\n className={classnames(style.label, noLabelMargins ? style.noLabelMargins : undefined)}\n >\n <CheckIcon className={style.icon} />\n </div>\n <span className={titleStyleClassName} title={title}>\n {title}\n </span>\n </label>\n );\n};\n\nInputCheckbox.propTypes = {\n title: PropTypes.string.isRequired,\n disabled: PropTypes.bool,\n required: PropTypes.bool,\n checked: PropTypes.bool,\n error: PropTypes.bool,\n onChange: PropTypes.func,\n modified: PropTypes.bool,\n noLabelMargins: PropTypes.bool,\n theme: PropTypes.oneOf(['coorpmanager', 'default']),\n titleStyle: PropTypes.oneOf(keys(titleStylesClassNames))\n};\n\nexport default InputCheckbox;\n"],"file":"index.js"}
@@ -58,7 +58,8 @@ const InputSwitch = props => {
58
58
  disabled: isDisabled,
59
59
  className: _style.default.checkbox
60
60
  }), /*#__PURE__*/_react.default.createElement("label", {
61
- htmlFor: idSwitch
61
+ htmlFor: idSwitch,
62
+ "data-name": "input-switch-label"
62
63
  }), titlePosition === 'right' ? titleView : null, descriptionView);
63
64
  };
64
65
 
@@ -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;AAEA,QAAMW,SAAS,GAAGhB,KAAK,gBAAG;AAAM,IAAA,SAAS,EAAEiB,eAAMjB;AAAvB,KAAgC,GAAEA,KAAM,GAAxC,CAAH,GAAwD,IAA/E;AAEA,QAAMkB,eAAe,GAAGZ,WAAW,gB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A,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} />\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","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;AAEA,QAAMW,SAAS,GAAGhB,KAAK,gBAAG;AAAM,IAAA,SAAS,EAAEiB,eAAMjB;AAAvB,KAAgC,GAAEA,KAAM,GAAxC,CAAH,GAAwD,IAA/E;AAEA,QAAMkB,eAAe,GAAGZ,WAAW,gBACjC;AAAK,IAAA,SAAS,EAAEW,eAAMX;AAAtB,KAAoCA,WAApC,CADiC,GAE/B,IAFJ;AAIA,QAAMa,YAAY,GAAGX,KAAK,KAAK,cAAV,GAA2BS,eAAMG,YAAjC,GAAgDH,eAAMI,OAA3E;AACA,QAAMC,aAAa,GAAGd,KAAK,KAAK,cAAV,GAA2BS,eAAMM,oB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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"}
@@ -0,0 +1,135 @@
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 _novaIcons = require("@coorpacademy/nova-icons");
11
+
12
+ var _reactNativeModal = _interopRequireDefault(require("react-native-modal"));
13
+
14
+ var _index = _interopRequireDefault(require("../../hoc/touchable/index.native"));
15
+
16
+ var _analytics = require("../../variables/analytics");
17
+
18
+ var _index2 = _interopRequireDefault(require("../space/index.native"));
19
+
20
+ var _index3 = _interopRequireDefault(require("../text/index.native"));
21
+
22
+ var _index4 = _interopRequireDefault(require("../../hoc/modal/select/index.native"));
23
+
24
+ var _templateContext = require("../../template/app-review/template-context");
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
+
28
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
29
+
30
+ 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; }
31
+
32
+ const ICON_WIDTH = 15;
33
+
34
+ const createStyleSheet = theme => _reactNative.StyleSheet.create({
35
+ container: {
36
+ alignItems: 'center',
37
+ flexDirection: 'row'
38
+ },
39
+ text: {
40
+ flex: 1,
41
+ color: theme.colors.gray.medium,
42
+ textAlign: 'center'
43
+ }
44
+ });
45
+
46
+ const logEvent = (eventName, analyticsID, analytics, questionType) => {
47
+ analytics && analytics.logEvent(eventName, {
48
+ id: analyticsID,
49
+ questionType
50
+ });
51
+ };
52
+
53
+ const Select = props => {
54
+ const templateContext = (0, _templateContext.useTemplateContext)();
55
+ const {
56
+ theme,
57
+ analytics
58
+ } = templateContext;
59
+ const [styleSheet, setStylesheet] = (0, _react.useState)(null);
60
+ (0, _react.useEffect)(() => {
61
+ const _stylesheet = createStyleSheet(theme);
62
+
63
+ setStylesheet(_stylesheet);
64
+ }, [theme]);
65
+ const {
66
+ analyticsID,
67
+ onBlur,
68
+ onFocus,
69
+ onChange,
70
+ values,
71
+ placeholder,
72
+ value,
73
+ style,
74
+ textStyle,
75
+ color,
76
+ questionType,
77
+ isFocused = false,
78
+ isDisabled = false,
79
+ testID = 'select'
80
+ } = props;
81
+ const handleFocus = (0, _react.useMemo)(() => () => {
82
+ if (!onFocus) return;
83
+ analytics && logEvent(_analytics.ANALYTICS_EVENT_TYPE.OPEN_SELECT, analyticsID, analytics, questionType);
84
+ onFocus();
85
+ }, [analytics, analyticsID, onFocus, questionType]);
86
+ const handleBlur = (0, _react.useMemo)(() => () => {
87
+ if (!onBlur) return;
88
+ analytics && logEvent(_analytics.ANALYTICS_EVENT_TYPE.CLOSE_SELECT, analyticsID, analytics, questionType);
89
+ onBlur();
90
+ }, [analytics, analyticsID, onBlur, questionType]);
91
+ const handleChange = (0, _react.useMemo)(() => () => {
92
+ onChange(value);
93
+ handleBlur();
94
+ }, [value, onChange, handleBlur]);
95
+
96
+ if (!styleSheet) {
97
+ return null;
98
+ }
99
+
100
+ const selectedItem = values.find(item => item.text === value);
101
+ const text = selectedItem && selectedItem.text || placeholder || null;
102
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_index.default, {
103
+ disabled: isDisabled,
104
+ onPress: handleFocus,
105
+ analyticsID: analyticsID,
106
+ testID: `${testID}-input`
107
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
108
+ style: [styleSheet.container, style]
109
+ }, /*#__PURE__*/_react.default.createElement(_index3.default, {
110
+ style: [styleSheet.text, textStyle, color && {
111
+ color
112
+ }]
113
+ }, text), /*#__PURE__*/_react.default.createElement(_index2.default, {
114
+ type: "tiny"
115
+ }), /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationArrowDown, {
116
+ color: color || theme.colors.gray.dark,
117
+ height: ICON_WIDTH,
118
+ width: ICON_WIDTH
119
+ }))), /*#__PURE__*/_react.default.createElement(_reactNativeModal.default, {
120
+ isVisible: isFocused,
121
+ onSwipeComplete: handleBlur,
122
+ onBackdropPress: handleBlur,
123
+ testID: testID
124
+ }, /*#__PURE__*/_react.default.createElement(_index4.default, {
125
+ value: value,
126
+ values: values,
127
+ onChange: handleChange,
128
+ onClose: handleBlur,
129
+ testID: `${testID}-modal`
130
+ })));
131
+ };
132
+
133
+ var _default = Select;
134
+ exports.default = _default;
135
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/atom/select-modal/index.native.tsx"],"names":["ICON_WIDTH","createStyleSheet","theme","StyleSheet","create","container","alignItems","flexDirection","text","flex","color","colors","gray","medium","textAlign","logEvent","eventName","analyticsID","analytics","questionType","id","Select","props","templateContext","styleSheet","setStylesheet","_stylesheet","onBlur","onFocus","onChange","values","placeholder","value","style","textStyle","isFocused","isDisabled","testID","handleFocus","ANALYTICS_EVENT_TYPE","OPEN_SELECT","handleBlur","CLOSE_SELECT","handleChange","selectedItem","find","item","dark"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AA+BA,MAAMA,UAAU,GAAG,EAAnB;;AAEA,MAAMC,gBAAgB,GAAIC,KAAD,IACvBC,wBAAWC,MAAX,CAAkB;AAChBC,EAAAA,SAAS,EAAE;AACTC,IAAAA,UAAU,EAAE,QADH;AAETC,IAAAA,aAAa,EAAE;AAFN,GADK;AAKhBC,EAAAA,IAAI,EAAE;AACJC,IAAAA,IAAI,EAAE,CADF;AAEJC,IAAAA,KAAK,EAAER,KAAK,CAACS,MAAN,CAAaC,IAAb,CAAkBC,MAFrB;AAGJC,IAAAA,SAAS,EAAE;AAHP;AALU,CAAlB,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AACE,IAAA,KAAK,EAAEE,KAAK,IAAIR,KAAK,CAACS,MAAN,CAAaC,IAAb,CAAkBmC,IADpC;AAEE,IAAA,MAAM,EAAE/C,UAFV;AAGE,IAAA,KAAK,EAAEA;AAHT,IAHF,CANF,CADF,eAiBE,6BAAC,yBAAD;AACE,IAAA,SAAS,EAAEmC,SADb;AAEE,IAAA,eAAe,EAAEM,UAFnB;AAGE,IAAA,eAAe,EAAEA,UAHnB;AAIE,IAAA,MAAM,EAAEJ;AAJV,kBAME,6BAAC,eAAD;AACE,IAAA,KAAK,EAAEL,KADT;AAEE,IAAA,MAAM,EAAEF,MAFV;AAGE,IAAA,QAAQ,EAAEa,YAHZ;AAIE,IAAA,OAAO,EAAEF,UAJX;AAKE,IAAA,MAAM,EAAG,GAAEJ,MAAO;AALpB,IANF,CAjBF,CADF;AAkCD,CAjGD;;eAmGehB,M","sourcesContent":["import React, {useState, useEffect, useMemo} from 'react';\nimport {View, StyleSheet, ViewStyle, TextStyle, FlexAlignType, FlexStyle} from 'react-native';\nimport {NovaCompositionNavigationArrowDown as ArrowDown} from '@coorpacademy/nova-icons';\nimport Modal from 'react-native-modal';\nimport Touchable from '../../hoc/touchable/index.native';\nimport type {QuestionType} from '../../types/progression-engine';\nimport {Theme} from '../../variables/theme.native';\n\nimport {ANALYTICS_EVENT_TYPE, Analytics} from '../../variables/analytics';\nimport Space from '../space/index.native';\nimport Text from '../text/index.native';\nimport ModalSelect, {OnChangeFunction} from '../../hoc/modal/select/index.native';\nimport type {Props as ModalSelectProps} from '../../hoc/modal/select/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\n\nexport type Props = {\n analyticsID: string;\n questionType: QuestionType;\n isDisabled?: boolean;\n isFocused?: boolean;\n values: Pick<ModalSelectProps, 'values'>;\n value?: Pick<ModalSelectProps, 'value'>;\n placeholder?: string;\n color?: string;\n onChange: OnChangeFunction;\n onFocus: () => void;\n onBlur: () => void;\n style?: ViewStyle;\n textStyle?: ViewStyle;\n testID?: string;\n};\n\ntype StyleSheetType = {\n container: {\n alignItems: FlexAlignType;\n flexDirection: 'row' | 'column' | 'row-reverse' | 'column-reverse' | undefined;\n };\n text: {\n flex: number;\n color: string;\n textAlign: string;\n };\n};\n\nconst ICON_WIDTH = 15;\n\nconst createStyleSheet = (theme: Theme) =>\n StyleSheet.create({\n container: {\n alignItems: 'center',\n flexDirection: 'row'\n },\n text: {\n flex: 1,\n color: theme.colors.gray.medium,\n textAlign: 'center'\n }\n });\n\nconst logEvent = (\n eventName: string,\n analyticsID: String,\n analytics: Analytics,\n questionType: QuestionType\n) => {\n analytics &&\n analytics.logEvent(eventName, {\n id: analyticsID,\n questionType\n });\n};\n\nconst Select = (props: Props) => {\n const templateContext = useTemplateContext();\n const {theme, analytics} = templateContext;\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n const {\n analyticsID,\n onBlur,\n onFocus,\n onChange,\n values,\n placeholder,\n value,\n style,\n textStyle,\n color,\n questionType,\n isFocused = false,\n isDisabled = false,\n testID = 'select'\n } = props;\n\n const handleFocus = useMemo(\n () => () => {\n if (!onFocus) return;\n\n analytics && logEvent(ANALYTICS_EVENT_TYPE.OPEN_SELECT, analyticsID, analytics, questionType);\n onFocus();\n },\n [analytics, analyticsID, onFocus, questionType]\n );\n\n const handleBlur = useMemo(\n () => () => {\n if (!onBlur) return;\n\n analytics &&\n logEvent(ANALYTICS_EVENT_TYPE.CLOSE_SELECT, analyticsID, analytics, questionType);\n onBlur();\n },\n [analytics, analyticsID, onBlur, questionType]\n );\n\n const handleChange = useMemo(\n () => () => {\n onChange(value);\n handleBlur();\n },\n [value, onChange, handleBlur]\n );\n\n if (!styleSheet) {\n return null;\n }\n\n const selectedItem = values.find(item => item.text === value);\n const text = (selectedItem && selectedItem.text) || placeholder || null;\n\n return (\n <>\n <Touchable\n disabled={isDisabled}\n onPress={handleFocus}\n analyticsID={analyticsID}\n testID={`${testID}-input`}\n >\n <View style={[styleSheet.container, style]}>\n <Text style={[styleSheet.text, textStyle, color && {color}]}>{text}</Text>\n <Space type=\"tiny\" />\n <ArrowDown\n color={color || theme.colors.gray.dark}\n height={ICON_WIDTH}\n width={ICON_WIDTH}\n />\n </View>\n </Touchable>\n <Modal\n isVisible={isFocused}\n onSwipeComplete={handleBlur}\n onBackdropPress={handleBlur}\n testID={testID}\n >\n <ModalSelect\n value={value}\n values={values}\n onChange={handleChange}\n onClose={handleBlur}\n testID={`${testID}-modal`}\n />\n </Modal>\n </>\n );\n};\n\nexport default Select;\n"],"file":"index.native.js"}
@@ -0,0 +1,33 @@
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 _templateContext = require("../../template/app-review/template-context");
11
+
12
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
13
+
14
+ 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; }
15
+
16
+ const Space = ({
17
+ type = 'tiny'
18
+ }) => {
19
+ const templateContext = (0, _templateContext.useTemplateContext)();
20
+ const {
21
+ theme
22
+ } = templateContext;
23
+ return /*#__PURE__*/React.createElement(_reactNative.View, {
24
+ style: {
25
+ width: theme.spacing[type],
26
+ height: theme.spacing[type]
27
+ }
28
+ });
29
+ };
30
+
31
+ var _default = Space;
32
+ exports.default = _default;
33
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/atom/space/index.native.tsx"],"names":["Space","type","templateContext","theme","width","spacing","height"],"mappings":";;;;;AAAA;;AACA;;AAEA;;;;;;AAMA,MAAMA,KAAK,GAAG,CAAC;AAACC,EAAAA,IAAI,GAAG;AAAR,CAAD,KAA4B;AACxC,QAAMC,eAAe,GAAG,0CAAxB;AAEA,QAAM;AAACC,IAAAA;AAAD,MAAUD,eAAhB;AAEA,sBAAO,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAE;AAACE,MAAAA,KAAK,EAAED,KAAK,CAACE,OAAN,CAAcJ,IAAd,CAAR;AAA6BK,MAAAA,MAAM,EAAEH,KAAK,CAACE,OAAN,CAAcJ,IAAd;AAArC;AAAb,IAAP;AACD,CAND;;eAQeD,K","sourcesContent":["import * as React from 'react';\nimport {View} from 'react-native';\nimport type {SpaceType} from '../../variables/theme.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\n\ninterface Props {\n type?: SpaceType;\n}\n\nconst Space = ({type = 'tiny'}: Props) => {\n const templateContext = useTemplateContext();\n\n const {theme} = templateContext;\n\n return <View style={{width: theme.spacing[type], height: theme.spacing[type]}} />;\n};\n\nexport default Space;\n"],"file":"index.native.js"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = exports.DEFAULT_STYLE = void 0;
5
+
6
+ var React = _interopRequireWildcard(require("react"));
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11
+
12
+ 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; }
13
+
14
+ 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); }
15
+
16
+ const DEFAULT_STYLE = _extends({}, _reactNative.Platform.select({
17
+ android: {
18
+ fontFamily: 'Roboto'
19
+ }
20
+ }));
21
+
22
+ exports.DEFAULT_STYLE = DEFAULT_STYLE;
23
+
24
+ const styles = _reactNative.StyleSheet.create({
25
+ text: _extends({}, DEFAULT_STYLE)
26
+ });
27
+
28
+ const Text = props => {
29
+ const {
30
+ children,
31
+ style,
32
+ testID,
33
+ numberOfLines
34
+ } = props;
35
+ return /*#__PURE__*/React.createElement(_reactNative.Text, {
36
+ style: [styles.text, style],
37
+ testID: testID,
38
+ numberOfLines: numberOfLines
39
+ }, children);
40
+ };
41
+
42
+ var _default = Text;
43
+ exports.default = _default;
44
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/atom/text/index.native.tsx"],"names":["DEFAULT_STYLE","Platform","select","android","fontFamily","styles","StyleSheet","create","text","Text","props","children","style","testID","numberOfLines"],"mappings":";;;;;AAAA;;AACA;;;;;;;;AAUO,MAAMA,aAAa,gBACrBC,sBAASC,MAAT,CAAgB;AACjBC,EAAAA,OAAO,EAAE;AACPC,IAAAA,UAAU,EAAE;AADL;AADQ,CAAhB,CADqB,CAAnB;;;;AAQP,MAAMC,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,IAAI,eACCR,aADD;AAD2B,CAAlB,CAAf;;AAMA,MAAMS,IAAI,GAAIC,KAAD,IAAkB;AAC7B,QAAM;AAACC,IAAAA,QAAD;AAAWC,IAAAA,KAAX;AAAkBC,IAAAA,MAAlB;AAA0BC,IAAAA;AAA1B,MAA2CJ,KAAjD;AAEA,sBACE,oBAAC,iBAAD;AAAU,IAAA,KAAK,EAAE,CAACL,MAAM,CAACG,IAAR,EAAcI,KAAd,CAAjB;AAAuC,IAAA,MAAM,EAAEC,MAA/C;AAAuD,IAAA,aAAa,EAAEC;AAAtE,KACGH,QADH,CADF;AAKD,CARD;;eAUeF,I","sourcesContent":["import * as React from 'react';\nimport {Text as TextBase, Platform, StyleSheet, ViewStyle} from 'react-native';\n\nexport type Props = {\n // copied from node_modules/react-native/Libraries/Text/TextProps.js\n children: React.ReactNode;\n style?: ViewStyle | ViewStyle[];\n testID?: string;\n numberOfLines?: number;\n};\n\nexport const DEFAULT_STYLE = {\n ...Platform.select({\n android: {\n fontFamily: 'Roboto'\n }\n })\n};\n\nconst styles = StyleSheet.create({\n text: {\n ...DEFAULT_STYLE\n }\n});\n\nconst Text = (props: Props) => {\n const {children, style, testID, numberOfLines} = props;\n\n return (\n <TextBase style={[styles.text, style]} testID={testID} numberOfLines={numberOfLines}>\n {children}\n </TextBase>\n );\n};\n\nexport default Text;\n"],"file":"index.native.js"}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = exports.HEADER_HEIGHT = void 0;
5
+
6
+ var _react = _interopRequireWildcard(require("react"));
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ var _index = _interopRequireDefault(require("../../atom/header-back-button/index.native"));
11
+
12
+ var _templateContext = require("../../template/app-review/template-context");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
17
+
18
+ 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; }
19
+
20
+ const HEADER_HEIGHT = 64;
21
+ exports.HEADER_HEIGHT = HEADER_HEIGHT;
22
+
23
+ const createStyleSheet = theme => _reactNative.StyleSheet.create({
24
+ container: {
25
+ borderRadius: theme.radius.card,
26
+ overflow: 'hidden',
27
+ backgroundColor: theme.colors.white
28
+ },
29
+ header: {
30
+ backgroundColor: theme.colors.white,
31
+ alignItems: 'flex-end',
32
+ justifyContent: 'center',
33
+ paddingHorizontal: theme.spacing.medium,
34
+ height: HEADER_HEIGHT
35
+ },
36
+ content: {
37
+ paddingHorizontal: theme.spacing.medium,
38
+ paddingBottom: theme.spacing.medium,
39
+ alignItems: 'center'
40
+ },
41
+ contentWithHeader: {
42
+ paddingTop: theme.spacing.medium
43
+ },
44
+ contentWithIcon: {
45
+ paddingTop: theme.spacing.small
46
+ },
47
+ icon: {
48
+ marginTop: -HEADER_HEIGHT * (3 / 4),
49
+ padding: 5,
50
+ backgroundColor: theme.colors.white,
51
+ borderRadius: theme.radius.thumbnail,
52
+ alignSelf: 'center'
53
+ },
54
+ iconContent: {
55
+ backgroundColor: theme.colors.white,
56
+ padding: theme.spacing.small,
57
+ borderRadius: theme.radius.thumbnail,
58
+ justifyContent: 'center',
59
+ alignItems: 'center'
60
+ }
61
+ });
62
+
63
+ const Modal = props => {
64
+ const templateContext = (0, _templateContext.useTemplateContext)();
65
+ const [styleSheet, setStylesheet] = (0, _react.useState)(null);
66
+ const {
67
+ theme
68
+ } = templateContext;
69
+ const {
70
+ children,
71
+ headerBackgroundColor,
72
+ iconBackgroundColor,
73
+ renderIcon,
74
+ contentStyle,
75
+ onClose,
76
+ testID
77
+ } = props;
78
+ (0, _react.useEffect)(() => {
79
+ const _stylesheet = createStyleSheet(theme);
80
+
81
+ setStylesheet(_stylesheet);
82
+ }, [theme]);
83
+
84
+ if (!styleSheet) {
85
+ return null;
86
+ }
87
+
88
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
89
+ style: styleSheet.container,
90
+ testID: testID
91
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
92
+ style: [styleSheet.header, {
93
+ backgroundColor: headerBackgroundColor
94
+ }]
95
+ }, /*#__PURE__*/_react.default.createElement(_index.default, {
96
+ color: theme.colors.gray.dark,
97
+ isFloating: false,
98
+ testID: "close-modal",
99
+ onPress: onClose,
100
+ type: "close"
101
+ })), renderIcon ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
102
+ style: styleSheet.icon
103
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
104
+ style: [styleSheet.iconContent, {
105
+ backgroundColor: iconBackgroundColor
106
+ }]
107
+ }, renderIcon)) : null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
108
+ style: [styleSheet.content, headerBackgroundColor && styleSheet.contentWithHeader, renderIcon && styleSheet.contentWithIcon, contentStyle]
109
+ }, children));
110
+ };
111
+
112
+ var _default = Modal;
113
+ exports.default = _default;
114
+ //# sourceMappingURL=index.native.js.map