@coorpacademy/components 10.22.3 → 10.22.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/es/atom/choice/index.native.js +132 -0
- package/es/atom/choice/index.native.js.map +1 -0
- package/es/atom/drag-and-drop/index.js +2 -1
- package/es/atom/drag-and-drop/index.js.map +1 -1
- package/es/atom/gradient/index.native.js +46 -0
- package/es/atom/gradient/index.native.js.map +1 -0
- package/es/atom/header-back-button/index.native.js +3 -4
- package/es/atom/header-back-button/index.native.js.map +1 -1
- package/es/atom/html/index.native.js +146 -0
- package/es/atom/html/index.native.js.map +1 -0
- package/es/atom/image-backgound/index.native.js +90 -0
- package/es/atom/image-backgound/index.native.js.map +1 -0
- package/es/atom/input-checkbox/index.js +3 -2
- package/es/atom/input-checkbox/index.js.map +1 -1
- package/es/atom/input-switch/index.js +45 -7
- package/es/atom/input-switch/index.js.map +1 -1
- package/es/atom/input-switch/style.css +56 -6
- package/es/atom/select-modal/index.native.js +113 -0
- package/es/atom/select-modal/index.native.js.map +1 -0
- package/es/atom/space/index.native.js +21 -0
- package/es/atom/space/index.native.js.map +1 -0
- package/es/atom/text/index.native.js +31 -0
- package/es/atom/text/index.native.js.map +1 -0
- package/es/hoc/modal/index.native.js +97 -0
- package/es/hoc/modal/index.native.js.map +1 -0
- package/es/hoc/modal/select/index.native.js +86 -0
- package/es/hoc/modal/select/index.native.js.map +1 -0
- package/es/hoc/modal/select-item/index.native.js +54 -0
- package/es/hoc/modal/select-item/index.native.js.map +1 -0
- package/es/hoc/touchable/index.native.js.map +1 -1
- package/es/index.js +2 -1
- package/es/index.js.map +1 -1
- package/es/molecule/answer/index.js +39 -32
- package/es/molecule/answer/index.js.map +1 -1
- package/es/molecule/cm-popin/index.js +125 -19
- package/es/molecule/cm-popin/index.js.map +1 -1
- package/es/molecule/cm-popin/style.css +176 -9
- package/es/molecule/feedback/index.js +7 -3
- package/es/molecule/feedback/index.js.map +1 -1
- package/es/molecule/feedback/style.css +24 -0
- package/es/molecule/questions/free-text/index.native.js +8 -8
- package/es/molecule/questions/free-text/index.native.js.map +1 -1
- package/es/molecule/questions/mobile/template/index.native.js +222 -0
- package/es/molecule/questions/mobile/template/index.native.js.map +1 -0
- package/es/template/app-player/player/index.js +6 -3
- package/es/template/app-player/player/index.js.map +1 -1
- package/es/template/app-player/popin-end/index.js +21 -6
- package/es/template/app-player/popin-end/index.js.map +1 -1
- package/es/template/app-player/popin-end/style.css +1 -1
- package/es/template/app-player/popin-end/summary.css +65 -0
- package/es/template/app-player/popin-end/summary.js +57 -7
- package/es/template/app-player/popin-end/summary.js.map +1 -1
- package/es/template/app-player/popin-header/index.js +33 -12
- package/es/template/app-player/popin-header/index.js.map +1 -1
- package/es/template/app-player/popin-header/style.css +93 -0
- package/es/template/app-player/popin-no-access/index.js +27 -0
- package/es/template/app-player/popin-no-access/index.js.map +1 -0
- package/es/template/app-review/prop-types.js +2 -1
- package/es/template/app-review/prop-types.js.map +1 -1
- package/es/template/app-review/slides/index.js +2 -2
- package/es/template/app-review/slides/index.js.map +1 -1
- package/es/template/app-review/template-context.js +1 -0
- package/es/template/app-review/template-context.js.map +1 -1
- package/es/template/common/dashboard/index.js +6 -3
- package/es/template/common/dashboard/index.js.map +1 -1
- package/es/types/app-review.d.js +2 -0
- package/es/types/app-review.d.js.map +1 -0
- package/es/types/progression-engine.d.js +2 -0
- package/es/types/progression-engine.d.js.map +1 -0
- package/es/types/translations.js +2 -0
- package/es/types/translations.js.map +1 -0
- package/es/util/build-query-string.js +9 -0
- package/es/util/build-query-string.js.map +1 -0
- package/es/util/get-clean-uri.js +4 -0
- package/es/util/get-clean-uri.js.map +1 -0
- package/es/util/get-resized-image.js +39 -0
- package/es/util/get-resized-image.js.map +1 -0
- package/es/util/parse-template-string.js +4 -2
- package/es/util/parse-template-string.js.map +1 -1
- package/es/variables/colors.css +1 -0
- package/es/variables/theme.native.js +1 -0
- package/es/variables/theme.native.js.map +1 -1
- package/lib/atom/choice/index.native.js +150 -0
- package/lib/atom/choice/index.native.js.map +1 -0
- package/lib/atom/drag-and-drop/index.js +2 -1
- package/lib/atom/drag-and-drop/index.js.map +1 -1
- package/lib/atom/gradient/index.native.js +56 -0
- package/lib/atom/gradient/index.native.js.map +1 -0
- package/lib/atom/header-back-button/index.native.js +3 -4
- package/lib/atom/header-back-button/index.native.js.map +1 -1
- package/lib/atom/html/index.native.js +163 -0
- package/lib/atom/html/index.native.js.map +1 -0
- package/lib/atom/image-backgound/index.native.js +105 -0
- package/lib/atom/image-backgound/index.native.js.map +1 -0
- package/lib/atom/input-checkbox/index.js +2 -1
- package/lib/atom/input-checkbox/index.js.map +1 -1
- package/lib/atom/input-switch/index.js +45 -7
- package/lib/atom/input-switch/index.js.map +1 -1
- package/lib/atom/input-switch/style.css +56 -6
- package/lib/atom/select-modal/index.native.js +135 -0
- package/lib/atom/select-modal/index.native.js.map +1 -0
- package/lib/atom/space/index.native.js +33 -0
- package/lib/atom/space/index.native.js.map +1 -0
- package/lib/atom/text/index.native.js +46 -0
- package/lib/atom/text/index.native.js.map +1 -0
- package/lib/hoc/modal/index.native.js +114 -0
- package/lib/hoc/modal/index.native.js.map +1 -0
- package/lib/hoc/modal/select/index.native.js +103 -0
- package/lib/hoc/modal/select/index.native.js.map +1 -0
- package/lib/hoc/modal/select-item/index.native.js +70 -0
- package/lib/hoc/modal/select-item/index.native.js.map +1 -0
- package/lib/hoc/touchable/index.native.js.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/molecule/answer/index.js +39 -32
- package/lib/molecule/answer/index.js.map +1 -1
- package/lib/molecule/cm-popin/index.js +126 -18
- package/lib/molecule/cm-popin/index.js.map +1 -1
- package/lib/molecule/cm-popin/style.css +176 -9
- package/lib/molecule/feedback/index.js +7 -3
- package/lib/molecule/feedback/index.js.map +1 -1
- package/lib/molecule/feedback/style.css +24 -0
- package/lib/molecule/questions/free-text/index.native.js +7 -7
- package/lib/molecule/questions/free-text/index.native.js.map +1 -1
- package/lib/molecule/questions/mobile/template/index.native.js +243 -0
- package/lib/molecule/questions/mobile/template/index.native.js.map +1 -0
- package/lib/template/app-player/player/index.js +7 -3
- package/lib/template/app-player/player/index.js.map +1 -1
- package/lib/template/app-player/popin-end/index.js +21 -6
- package/lib/template/app-player/popin-end/index.js.map +1 -1
- package/lib/template/app-player/popin-end/style.css +1 -1
- package/lib/template/app-player/popin-end/summary.css +65 -0
- package/lib/template/app-player/popin-end/summary.js +58 -7
- package/lib/template/app-player/popin-end/summary.js.map +1 -1
- package/lib/template/app-player/popin-header/index.js +32 -11
- package/lib/template/app-player/popin-header/index.js.map +1 -1
- package/lib/template/app-player/popin-header/style.css +93 -0
- package/lib/template/app-player/popin-no-access/index.js +37 -0
- package/lib/template/app-player/popin-no-access/index.js.map +1 -0
- package/lib/template/app-review/prop-types.js +2 -1
- package/lib/template/app-review/prop-types.js.map +1 -1
- package/lib/template/app-review/slides/index.js +2 -2
- package/lib/template/app-review/slides/index.js.map +1 -1
- package/lib/template/app-review/template-context.js +1 -0
- package/lib/template/app-review/template-context.js.map +1 -1
- package/lib/template/common/dashboard/index.js +7 -3
- package/lib/template/common/dashboard/index.js.map +1 -1
- package/lib/types/app-review.d.js +2 -0
- package/lib/types/app-review.d.js.map +1 -0
- package/lib/types/progression-engine.d.js +2 -0
- package/lib/types/progression-engine.d.js.map +1 -0
- package/lib/types/translations.js +2 -0
- package/lib/types/translations.js.map +1 -0
- package/lib/util/build-query-string.js +17 -0
- package/lib/util/build-query-string.js.map +1 -0
- package/lib/util/get-clean-uri.js +10 -0
- package/lib/util/get-clean-uri.js.map +1 -0
- package/lib/util/get-resized-image.js +49 -0
- package/lib/util/get-resized-image.js.map +1 -0
- package/lib/util/parse-template-string.js +4 -2
- package/lib/util/parse-template-string.js.map +1 -1
- package/lib/variables/colors.css +1 -0
- package/lib/variables/theme.native.js +3 -1
- package/lib/variables/theme.native.js.map +1 -1
- package/package.json +8 -4
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
@value cm_grey_100 from colors;
|
|
15
15
|
@value cm_grey_200 from colors;
|
|
16
16
|
@value cm_blue_600 from colors;
|
|
17
|
+
@value cm_grey_500 from colors;
|
|
18
|
+
@value cm_grey_700 from colors;
|
|
19
|
+
@value white from colors;
|
|
20
|
+
@value cm_blue_50 from colors;
|
|
21
|
+
@value breakpoints: '../../variables/breakpoints.css';
|
|
22
|
+
@value mobile from breakpoints;
|
|
23
|
+
@value tablet from breakpoints;
|
|
24
|
+
@value cm_grey_75 from colors;
|
|
17
25
|
|
|
18
26
|
.background {
|
|
19
27
|
top: 0px;
|
|
@@ -27,7 +35,8 @@
|
|
|
27
35
|
box-sizing: border-box;
|
|
28
36
|
overflow: hidden;
|
|
29
37
|
display: flex;
|
|
30
|
-
position:fixed;
|
|
38
|
+
position: fixed;
|
|
39
|
+
z-index: 3;
|
|
31
40
|
}
|
|
32
41
|
|
|
33
42
|
.headerBackground {
|
|
@@ -37,7 +46,6 @@
|
|
|
37
46
|
}
|
|
38
47
|
|
|
39
48
|
.popin {
|
|
40
|
-
position: absolute;
|
|
41
49
|
overflow: auto;
|
|
42
50
|
width: 500px;
|
|
43
51
|
height: 414px;
|
|
@@ -59,7 +67,6 @@
|
|
|
59
67
|
justify-content: center;
|
|
60
68
|
align-items: center;
|
|
61
69
|
padding: 40px 40px 0px;
|
|
62
|
-
position: absolute;
|
|
63
70
|
background: xtraLightGrey;
|
|
64
71
|
font-family: 'Gilroy';
|
|
65
72
|
font-weight: 500;
|
|
@@ -71,10 +78,10 @@
|
|
|
71
78
|
margin: 10px 0px;
|
|
72
79
|
}
|
|
73
80
|
@keyframes popup {
|
|
74
|
-
0%{
|
|
81
|
+
0% {
|
|
75
82
|
transform: scale(0);
|
|
76
83
|
}
|
|
77
|
-
100%{
|
|
84
|
+
100% {
|
|
78
85
|
transform: scale(1);
|
|
79
86
|
}
|
|
80
87
|
}
|
|
@@ -84,7 +91,6 @@
|
|
|
84
91
|
flex-direction: column;
|
|
85
92
|
align-items: center;
|
|
86
93
|
justify-content: center;
|
|
87
|
-
width: 65%;
|
|
88
94
|
}
|
|
89
95
|
|
|
90
96
|
.content {
|
|
@@ -100,9 +106,9 @@
|
|
|
100
106
|
}
|
|
101
107
|
|
|
102
108
|
.buttonContainer {
|
|
103
|
-
|
|
104
|
-
height: 80px;
|
|
109
|
+
min-height: 80px;
|
|
105
110
|
display: flex;
|
|
111
|
+
width: 100%;
|
|
106
112
|
align-items: center;
|
|
107
113
|
justify-content: center;
|
|
108
114
|
}
|
|
@@ -112,6 +118,11 @@
|
|
|
112
118
|
padding: 8px;
|
|
113
119
|
}
|
|
114
120
|
|
|
121
|
+
.largeButton {
|
|
122
|
+
width: 100%;
|
|
123
|
+
padding: 8px;
|
|
124
|
+
}
|
|
125
|
+
|
|
115
126
|
.icon {
|
|
116
127
|
width: 60px;
|
|
117
128
|
height: 60px;
|
|
@@ -126,4 +137,160 @@
|
|
|
126
137
|
|
|
127
138
|
.popinHeader button {
|
|
128
139
|
position: absolute;
|
|
129
|
-
}
|
|
140
|
+
}
|
|
141
|
+
.descriptionText {
|
|
142
|
+
text-align: center;
|
|
143
|
+
font-family: Gilroy;
|
|
144
|
+
font-weight: 500;
|
|
145
|
+
font-size: 16px;
|
|
146
|
+
line-height: 22px;
|
|
147
|
+
color: cm_grey_500;
|
|
148
|
+
font-style: normal;
|
|
149
|
+
white-space: pre-line;
|
|
150
|
+
margin-top: 0px;
|
|
151
|
+
}
|
|
152
|
+
.titleContainer {
|
|
153
|
+
align-items: center;
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
width: 100%;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.cookieHeader {
|
|
160
|
+
width: 100%;
|
|
161
|
+
background-color: cm_grey_700;
|
|
162
|
+
padding: 16px 24px;
|
|
163
|
+
border-radius: 10px 10px 0px 0px;
|
|
164
|
+
display: flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.popinCookie {
|
|
169
|
+
max-width: 550px;
|
|
170
|
+
flex-grow: 0;
|
|
171
|
+
margin: 16px;
|
|
172
|
+
border-radius: 10px;
|
|
173
|
+
background-color: cm_grey_50;
|
|
174
|
+
animation: popup 0.7s;
|
|
175
|
+
position: fixed;
|
|
176
|
+
bottom: 32px;
|
|
177
|
+
left: 32px;
|
|
178
|
+
z-index: 2;
|
|
179
|
+
}
|
|
180
|
+
.cookieTitle {
|
|
181
|
+
font-family: "Gilroy";
|
|
182
|
+
font-style: normal;
|
|
183
|
+
font-weight: 700;
|
|
184
|
+
font-size: 24px;
|
|
185
|
+
line-height: 32px;
|
|
186
|
+
color: white;
|
|
187
|
+
padding-left: 16px;
|
|
188
|
+
width: 60%;
|
|
189
|
+
}
|
|
190
|
+
.cookieIcon {
|
|
191
|
+
height: 20px;
|
|
192
|
+
width: 20px;
|
|
193
|
+
}
|
|
194
|
+
.cookieIconContainer {
|
|
195
|
+
width: 39px;
|
|
196
|
+
height: 39px;
|
|
197
|
+
border-radius: 8px;
|
|
198
|
+
background-color: cm_blue_50;
|
|
199
|
+
display: flex;
|
|
200
|
+
justify-content: center;
|
|
201
|
+
align-items: center;
|
|
202
|
+
}
|
|
203
|
+
.popinCookie .button {
|
|
204
|
+
width: 100%;
|
|
205
|
+
padding: 0px 8px 0px 0px
|
|
206
|
+
}
|
|
207
|
+
.popinCookie .button span {
|
|
208
|
+
margin: 0
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.popinCookie .message {
|
|
212
|
+
padding: 24px 24px 40px 24px
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.descriptionBtn {
|
|
216
|
+
font-family: "Gilroy";
|
|
217
|
+
font-weight: 500;
|
|
218
|
+
font-size: 16px;
|
|
219
|
+
line-height: 22px;
|
|
220
|
+
color: cm_grey_500;
|
|
221
|
+
font-style: normal;
|
|
222
|
+
white-space: pre-line;
|
|
223
|
+
margin-top: 24px;
|
|
224
|
+
width: calc(100% - 24px);
|
|
225
|
+
padding-left: 24px;
|
|
226
|
+
margin-bottom: 24px;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
.firstBtnSwitchContainer {
|
|
231
|
+
height: 56px;
|
|
232
|
+
background-color: cm_grey_75;
|
|
233
|
+
width: 100%;
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
}
|
|
237
|
+
.firstBtnSwitchContainer div:first-child {
|
|
238
|
+
margin-left: 9px;
|
|
239
|
+
}
|
|
240
|
+
.singleSwitchContainer div:first-child {
|
|
241
|
+
margin-left: 9px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.lastBtnSwitchContainer {
|
|
245
|
+
composes: singleSwitchContainer;
|
|
246
|
+
margin-bottom: 28px;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.singleSwitchContainer {
|
|
250
|
+
width: 100%;
|
|
251
|
+
display: flex;
|
|
252
|
+
align-items: center;
|
|
253
|
+
width: 100%;
|
|
254
|
+
margin-top: 24px;
|
|
255
|
+
}
|
|
256
|
+
a {
|
|
257
|
+
color: cm_primary_blue;
|
|
258
|
+
text-decoration: none;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.popinCookie .buttonContainer {
|
|
262
|
+
min-height: 44px;
|
|
263
|
+
padding-bottom: 16px;
|
|
264
|
+
width: auto;
|
|
265
|
+
padding-left: 24px;
|
|
266
|
+
padding-right: 16px;
|
|
267
|
+
}
|
|
268
|
+
.popinCookie .largeButton {
|
|
269
|
+
padding: 0px 8px 0px 0px
|
|
270
|
+
}
|
|
271
|
+
@media tablet {
|
|
272
|
+
.popinCookie {
|
|
273
|
+
position: fixed;
|
|
274
|
+
bottom: 10px;
|
|
275
|
+
left: unset;
|
|
276
|
+
align-self: center;
|
|
277
|
+
max-height: calc(100vh - 50px);
|
|
278
|
+
overflow-x: hidden;
|
|
279
|
+
overflow-y: auto;
|
|
280
|
+
}
|
|
281
|
+
.popinCookie .button{
|
|
282
|
+
width: 100%;
|
|
283
|
+
padding: 0px 0px 8px 0px
|
|
284
|
+
}
|
|
285
|
+
.buttonContainer {
|
|
286
|
+
flex-wrap: wrap;
|
|
287
|
+
margin-top: 40px;
|
|
288
|
+
}
|
|
289
|
+
.popinCookie .largeButton {
|
|
290
|
+
padding: 8px 0px 0px 0px
|
|
291
|
+
}
|
|
292
|
+
.popinCookie .message {
|
|
293
|
+
padding: 24px 24px 0px 24px
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
}
|
|
@@ -15,7 +15,8 @@ const Feedback = (props, context) => {
|
|
|
15
15
|
media,
|
|
16
16
|
mediaDescription,
|
|
17
17
|
title,
|
|
18
|
-
description
|
|
18
|
+
description,
|
|
19
|
+
mode = 'default'
|
|
19
20
|
} = props;
|
|
20
21
|
|
|
21
22
|
const resource = media && media.type && _extends(_extends({}, media), _pipe(_get('src.0'), _extend({
|
|
@@ -23,8 +24,11 @@ const Feedback = (props, context) => {
|
|
|
23
24
|
}))(media));
|
|
24
25
|
|
|
25
26
|
return (resource || title || description ? /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: mode === 'scorm' ? style.feedbackContainerScorm : null
|
|
28
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
26
29
|
className: style.feedback,
|
|
27
|
-
"data-name": "feedback"
|
|
30
|
+
"data-name": "feedback",
|
|
31
|
+
id: "feedback"
|
|
28
32
|
}, /*#__PURE__*/React.createElement("div", {
|
|
29
33
|
className: classnames(style.title, style.innerHTML),
|
|
30
34
|
"data-name": "title" // eslint-disable-next-line react/no-danger
|
|
@@ -51,7 +55,7 @@ const Feedback = (props, context) => {
|
|
|
51
55
|
dangerouslySetInnerHTML: {
|
|
52
56
|
__html: mediaDescription
|
|
53
57
|
}
|
|
54
|
-
})) : null)) : null) || '';
|
|
58
|
+
})) : null))) : null) || '';
|
|
55
59
|
};
|
|
56
60
|
|
|
57
61
|
Feedback.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/molecule/feedback/index.js"],"names":["React","PropTypes","classnames","ResourcePlayer","TYPE_IMAGE","TYPE_VIDEO","TYPE_PDF","TYPE_AUDIO","style","Feedback","props","context","media","mediaDescription","title","description","resource","type","feedback","innerHTML","__html","descWrapper","resourcePlayer","propTypes","string","shape","oneOf","src","array"],"mappings":";;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,cAAP,IAAwBC,UAAxB,EAAoCC,UAApC,EAAgDC,QAAhD,EAA0DC,UAA1D,QAA2E,oBAA3E;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;AACnC,QAAM;AAACC,IAAAA,KAAD;AAAQC,IAAAA,gBAAR;AAA0BC,IAAAA,KAA1B;AAAiCC,IAAAA;
|
|
1
|
+
{"version":3,"sources":["../../../src/molecule/feedback/index.js"],"names":["React","PropTypes","classnames","ResourcePlayer","TYPE_IMAGE","TYPE_VIDEO","TYPE_PDF","TYPE_AUDIO","style","Feedback","props","context","media","mediaDescription","title","description","mode","resource","type","feedbackContainerScorm","feedback","innerHTML","__html","descWrapper","resourcePlayer","propTypes","string","shape","oneOf","src","array"],"mappings":";;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,cAAP,IAAwBC,UAAxB,EAAoCC,UAApC,EAAgDC,QAAhD,EAA0DC,UAA1D,QAA2E,oBAA3E;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;AACnC,QAAM;AAACC,IAAAA,KAAD;AAAQ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,CAFvB,CAGE;AAHF;AAIE,IAAA,uBAAuB,EAAE;AAACC,MAAAA,MAAM,EAAET;AAAT;AAJ3B,IAFF,CADO,GAUL,IAjBN,CAPF,CADF,CADD,GA8BG,IA9BJ,KA8Ba,EA/Bf;AAiCD,CAzCD;;AA2CAJ,QAAQ,CAACgB,SAAT,2CAAqB;AACnBX,EAAAA,KAAK,EAAEb,SAAS,CAACyB,MADE;AAEnBX,EAAAA,WAAW,EAAEd,SAAS,CAACyB,MAFJ;AAGnBd,EAAAA,KAAK,EAAEX,SAAS,CAAC0B,KAAV,CAAgB;AACrBT,IAAAA,IAAI,EAAEjB,SAAS,CAAC2B,KAAV,CAAgB,CAACxB,UAAD,EAAaE,QAAb,EAAuBD,UAAvB,EAAmCE,UAAnC,CAAhB,CADe;AAErBsB,IAAAA,GAAG,EAAE5B,SAAS,CAAC6B;AAFM,GAAhB,CAHY;AAOnBjB,EAAAA,gBAAgB,EAAEZ,SAAS,CAACyB;AAPT,CAArB;AAUA,eAAejB,QAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {pipe, get, extend} from 'lodash/fp';\nimport classnames from 'classnames';\nimport ResourcePlayer, {TYPE_IMAGE, TYPE_VIDEO, TYPE_PDF, TYPE_AUDIO} from '../resource-player';\nimport style from './style.css';\n\nconst Feedback = (props, context) => {\n const {media, mediaDescription, title, description, mode = 'default'} = props;\n const resource = media &&\n media.type && {\n ...media,\n ...pipe(get('src.0'), extend({description: mediaDescription}))(media)\n };\n\n return (\n (resource || title || description ? (\n <div className={mode === 'scorm' ? style.feedbackContainerScorm : null}>\n <div className={style.feedback} data-name=\"feedback\" id=\"feedback\">\n <div\n className={classnames(style.title, style.innerHTML)}\n data-name=\"title\"\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n <div className={style.descWrapper}>\n <div\n className={classnames(style.description, style.innerHTML)}\n data-name=\"description\"\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: description}}\n />\n {resource ? (\n <div>\n <ResourcePlayer className={style.resourcePlayer} resource={resource} />\n <div\n data-name=\"mediaDescription\"\n className={classnames(style.mediaDescription, style.innerHTML)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: mediaDescription}}\n />\n </div>\n ) : null}\n </div>\n </div>\n </div>\n ) : null) || ''\n );\n};\n\nFeedback.propTypes = {\n title: PropTypes.string,\n description: PropTypes.string,\n media: PropTypes.shape({\n type: PropTypes.oneOf([TYPE_IMAGE, TYPE_PDF, TYPE_VIDEO, TYPE_AUDIO]),\n src: PropTypes.array\n }),\n mediaDescription: PropTypes.string\n};\n\nexport default Feedback;\n"],"file":"index.js"}
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
@value medium from colors;
|
|
10
10
|
@value xtraLightGrey from colors;
|
|
11
11
|
@value white from colors;
|
|
12
|
+
@value cm_grey_75 from colors;
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
.feedback {
|
|
14
16
|
width: 100%;
|
|
@@ -19,6 +21,24 @@
|
|
|
19
21
|
flex-direction: column;
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
.feedbackContainerScorm {
|
|
25
|
+
background-color: white;
|
|
26
|
+
max-width: 884px;
|
|
27
|
+
height: 386px;
|
|
28
|
+
padding-bottom: 10px;
|
|
29
|
+
overflow-x: auto;
|
|
30
|
+
border: 1px solid cm_grey_75;
|
|
31
|
+
border-top: 0px;
|
|
32
|
+
z-index: 2;
|
|
33
|
+
margin-top: 60px;
|
|
34
|
+
position: relative;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.feedbackContainerScorm > .feedback {
|
|
38
|
+
border-bottom: 0px;
|
|
39
|
+
height: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
22
42
|
.title {
|
|
23
43
|
width: 100%;
|
|
24
44
|
margin-bottom: 20px;
|
|
@@ -90,6 +110,10 @@
|
|
|
90
110
|
width: 100%;
|
|
91
111
|
margin-bottom: 8px;
|
|
92
112
|
}
|
|
113
|
+
.feedbackContainerScorm {
|
|
114
|
+
width: 100%;
|
|
115
|
+
height: 100%;
|
|
116
|
+
}
|
|
93
117
|
}
|
|
94
118
|
|
|
95
119
|
.innerHTML {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { View, StyleSheet, TextInput } from 'react-native';
|
|
2
|
-
import React, { useState, useEffect,
|
|
2
|
+
import React, { useState, useEffect, useCallback } from 'react';
|
|
3
3
|
import { useTemplateContext } from '../../../template/app-review/template-context';
|
|
4
4
|
import { ANALYTICS_EVENT_TYPE } from '../../../variables/analytics';
|
|
5
5
|
|
|
@@ -39,23 +39,23 @@ const FreeText = props => {
|
|
|
39
39
|
const [styleSheet, setStylesheet] = useState(null);
|
|
40
40
|
const {
|
|
41
41
|
brandTheme,
|
|
42
|
-
theme
|
|
42
|
+
theme,
|
|
43
|
+
translations
|
|
43
44
|
} = templateContext;
|
|
44
45
|
const PLACEHOLDER_COLOR = theme.colors.gray.medium; // ------------------------------------
|
|
45
46
|
|
|
46
47
|
const {
|
|
47
48
|
analytics,
|
|
48
49
|
questionType,
|
|
49
|
-
fullWitdh,
|
|
50
|
+
fullWitdh = false,
|
|
50
51
|
testID,
|
|
51
52
|
onChange,
|
|
52
53
|
isDisabled,
|
|
53
|
-
value
|
|
54
|
-
placeholder
|
|
54
|
+
value
|
|
55
55
|
} = props; // ------------------------------------
|
|
56
56
|
|
|
57
|
-
const handleFocus =
|
|
58
|
-
const handleBlur =
|
|
57
|
+
const handleFocus = useCallback(() => analytics && logEvent(ANALYTICS_EVENT_TYPE.INPUT_FOCUS, analytics, questionType), [analytics, questionType]);
|
|
58
|
+
const handleBlur = useCallback(() => analytics && logEvent(ANALYTICS_EVENT_TYPE.INPUT_BLUR, analytics, questionType), [analytics, questionType]); // ------------------------------------
|
|
59
59
|
|
|
60
60
|
useEffect(() => {
|
|
61
61
|
const _stylesheet = createStyleSheet(brandTheme, theme);
|
|
@@ -74,7 +74,7 @@ const FreeText = props => {
|
|
|
74
74
|
onFocus: handleFocus,
|
|
75
75
|
onBlur: handleBlur,
|
|
76
76
|
onChangeText: onChange,
|
|
77
|
-
placeholder:
|
|
77
|
+
placeholder: translations.typeHere,
|
|
78
78
|
placeholderTextColor: PLACEHOLDER_COLOR,
|
|
79
79
|
value: value,
|
|
80
80
|
testID: testID,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/molecule/questions/free-text/index.native.tsx"],"names":["View","StyleSheet","TextInput","React","useState","useEffect","
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/questions/free-text/index.native.tsx"],"names":["View","StyleSheet","TextInput","React","useState","useEffect","useCallback","useTemplateContext","ANALYTICS_EVENT_TYPE","createStyleSheet","brandTheme","theme","create","input","padding","spacing","tiny","borderWidth","borderColor","colors","gray","lightMedium","borderRadius","radius","common","backgroundColor","white","minWidth","text","primary","color","medium","fontWeight","bold","fontSize","regular","textAlign","spaced","paddingVertical","fullWitdh","width","logEvent","eventName","analytics","questionType","id","FreeText","props","templateContext","styleSheet","setStylesheet","translations","PLACEHOLDER_COLOR","testID","onChange","isDisabled","value","handleFocus","INPUT_FOCUS","handleBlur","INPUT_BLUR","_stylesheet","typeHere"],"mappings":"AAAA,SAAQA,IAAR,EAAcC,UAAd,EAA0BC,SAA1B,QAA0C,cAA1C;AACA,OAAOC,KAAP,IAAeC,QAAf,EAAyBC,SAAzB,EAAoCC,WAApC,QAAsD,OAAtD;AACA,SAAQC,kBAAR,QAAiC,+CAAjC;AACA,SAAQC,oBAAR,QAA8C,8BAA9C;;AAiDA,MAAMC,gBAAgB,GAAG,CAACC,UAAD,EAAaC,KAAb,KACvBV,UAAU,CAACW,MAAX,CAAkB;AAChBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,OAAO,EAAEH,KAAK,CAACI,OAAN,CAAcC,IADlB;AAELC,IAAAA,WAAW,EAAE,CAFR;AAGLC,IAAAA,WAAW,EAAEP,KAAK,CAACQ,MAAN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IAAA,YAAY,EAAEL,QAJhB;AAKE,IAAA,WAAW,EAAEH,YAAY,CAACW,QAL5B;AAME,IAAA,oBAAoB,EAAEV,iBANxB;AAOE,IAAA,KAAK,EAAEI,KAPT;AAQE,IAAA,MAAM,EAAEH,MARV;AASE,IAAA,QAAQ,EAAE,CAACE,UATb;AAUE,IAAA,iBAAiB,EAAE,CAACA;AAVtB,IADF,CADF;AAgBD,CAnDD;;AAqDA,eAAeT,QAAf","sourcesContent":["import {View, StyleSheet, TextInput} from 'react-native';\nimport React, {useState, useEffect, useCallback} from 'react';\nimport {useTemplateContext} from '../../../template/app-review/template-context';\nimport {ANALYTICS_EVENT_TYPE, Analytics} from '../../../variables/analytics';\n\ntype QuestionType = 'basic' | 'template';\n\ninterface Props {\n fullWitdh?: boolean;\n testID: string;\n questionType: QuestionType;\n analytics?: Analytics;\n onChange: (text: string) => void;\n isDisabled: boolean;\n value: string;\n}\n\ntype StyleSheetType = {\n input: {\n padding: string;\n borderWidth: number;\n borderColor: string;\n borderRadius: number;\n backgroundColor: string;\n minWidth: number;\n };\n text: {\n color: string;\n fontWeight:\n | 'normal'\n | 'bold'\n | '100'\n | '200'\n | '300'\n | '400'\n | '500'\n | '600'\n | '700'\n | '800'\n | '900'\n | undefined;\n fontSize: number;\n textAlign: 'auto' | 'left' | 'right' | 'center' | 'justify' | undefined;\n };\n spaced: {\n paddingVertical: number;\n };\n fullWitdh: {\n width: string;\n };\n};\n\nconst createStyleSheet = (brandTheme, theme) =>\n StyleSheet.create({\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 text: {\n borderColor: brandTheme?.colors.primary,\n color: brandTheme?.colors.primary || theme.colors.gray.medium,\n fontWeight: theme.fontWeight.bold,\n fontSize: theme.fontSize.regular,\n textAlign: 'center'\n },\n spaced: {\n paddingVertical: theme.spacing.tiny\n },\n fullWitdh: {\n width: '100%'\n }\n });\n\nconst logEvent = (eventName: string, analytics: Analytics, questionType: QuestionType) => {\n analytics &&\n analytics.logEvent(eventName, {\n id: `question-input-text`,\n questionType\n });\n};\n\nconst FreeText = (props: Props) => {\n const templateContext = useTemplateContext();\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n const {brandTheme, theme, translations} = templateContext;\n const PLACEHOLDER_COLOR = theme.colors.gray.medium;\n\n // ------------------------------------\n\n const {analytics, questionType, fullWitdh = false, testID, onChange, isDisabled, value} = props;\n\n // ------------------------------------\n\n const handleFocus = useCallback(\n () => analytics && logEvent(ANALYTICS_EVENT_TYPE.INPUT_FOCUS, analytics, questionType),\n [analytics, questionType]\n );\n\n const handleBlur = useCallback(\n () => analytics && logEvent(ANALYTICS_EVENT_TYPE.INPUT_BLUR, analytics, questionType),\n [analytics, questionType]\n );\n\n // ------------------------------------\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(brandTheme, theme);\n setStylesheet(_stylesheet);\n }, [brandTheme, theme]);\n\n // ------------------------------------\n\n if (!styleSheet) {\n return null;\n }\n\n return (\n <View style={[styleSheet.spaced, fullWitdh && styleSheet.fullWitdh]}>\n <TextInput\n style={[styleSheet.input, styleSheet.text]}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChangeText={onChange}\n placeholder={translations.typeHere}\n placeholderTextColor={PLACEHOLDER_COLOR}\n value={value}\n testID={testID}\n editable={!isDisabled}\n selectTextOnFocus={!isDisabled}\n />\n </View>\n );\n};\n\nexport default FreeText;\n"],"file":"index.native.js"}
|
|
@@ -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
|