@micromag/screen-survey 0.3.699 → 0.3.701
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.js +53 -52
- package/package.json +3 -3
package/es/index.js
CHANGED
|
@@ -200,11 +200,11 @@ var SurveyScreen = function SurveyScreen(_ref) {
|
|
|
200
200
|
var _ref9 = label || {},
|
|
201
201
|
_ref9$body = _ref9.body,
|
|
202
202
|
body = _ref9$body === void 0 ? null : _ref9$body;
|
|
203
|
-
var
|
|
203
|
+
var _ref0 = quizAnswers.find(function (qa) {
|
|
204
204
|
return qa.choice === body;
|
|
205
205
|
}) || {},
|
|
206
|
-
|
|
207
|
-
count =
|
|
206
|
+
_ref0$count = _ref0.count,
|
|
207
|
+
count = _ref0$count === void 0 ? 0 : _ref0$count;
|
|
208
208
|
var countWithUser = i === userAnswerIndex ? count + 1 : count;
|
|
209
209
|
if (body !== null) {
|
|
210
210
|
return _objectSpread(_objectSpread({}, answersTotal), {}, _defineProperty({}, body, {
|
|
@@ -240,6 +240,7 @@ var SurveyScreen = function SurveyScreen(_ref) {
|
|
|
240
240
|
value: 1
|
|
241
241
|
});
|
|
242
242
|
trackScreenEvent('click_answer', "Answer ".concat(userAnswerIndex + 1, ": ").concat(answer.label.body), {
|
|
243
|
+
linkType: 'survey_answer',
|
|
243
244
|
answer: answer,
|
|
244
245
|
answerIndex: answerIndex,
|
|
245
246
|
answerType: 'button'
|
|
@@ -318,8 +319,8 @@ var SurveyScreen = function SurveyScreen(_ref) {
|
|
|
318
319
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
319
320
|
scrolledBottom = _useState8[0],
|
|
320
321
|
setScrolledBottom = _useState8[1];
|
|
321
|
-
var onScrolledBottom = useCallback(function (
|
|
322
|
-
var initial =
|
|
322
|
+
var onScrolledBottom = useCallback(function (_ref1) {
|
|
323
|
+
var initial = _ref1.initial;
|
|
323
324
|
if (initial) {
|
|
324
325
|
trackScreenEvent('scroll', 'Screen');
|
|
325
326
|
}
|
|
@@ -329,12 +330,12 @@ var SurveyScreen = function SurveyScreen(_ref) {
|
|
|
329
330
|
setScrolledBottom(false);
|
|
330
331
|
}, [setScrolledBottom]);
|
|
331
332
|
var _useState9 = useState(false),
|
|
332
|
-
|
|
333
|
-
hasScroll =
|
|
334
|
-
setHasScroll =
|
|
335
|
-
var onScrollHeightChange = useCallback(function (
|
|
336
|
-
var
|
|
337
|
-
canScroll =
|
|
333
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
334
|
+
hasScroll = _useState0[0],
|
|
335
|
+
setHasScroll = _useState0[1];
|
|
336
|
+
var onScrollHeightChange = useCallback(function (_ref10) {
|
|
337
|
+
var _ref10$canScroll = _ref10.canScroll,
|
|
338
|
+
canScroll = _ref10$canScroll === void 0 ? false : _ref10$canScroll;
|
|
338
339
|
setHasScroll(canScroll);
|
|
339
340
|
}, [setHasScroll]);
|
|
340
341
|
|
|
@@ -366,19 +367,19 @@ var SurveyScreen = function SurveyScreen(_ref) {
|
|
|
366
367
|
var finalTransitionDuration = useMemo(function () {
|
|
367
368
|
return showInstantAnswer ? 0 : "".concat(resultTransitionDuration, "ms");
|
|
368
369
|
}, [showInstantAnswer, resultTransitionDuration]);
|
|
369
|
-
var
|
|
370
|
-
|
|
371
|
-
resultsBarColor =
|
|
372
|
-
|
|
373
|
-
resultsTextColor =
|
|
374
|
-
|
|
375
|
-
resultsPercentageTextStyle =
|
|
370
|
+
var _ref11 = resultsStyle || {},
|
|
371
|
+
_ref11$barColor = _ref11.barColor,
|
|
372
|
+
resultsBarColor = _ref11$barColor === void 0 ? null : _ref11$barColor,
|
|
373
|
+
_ref11$textColor = _ref11.textColor,
|
|
374
|
+
resultsTextColor = _ref11$textColor === void 0 ? null : _ref11$textColor,
|
|
375
|
+
_ref11$percentageText = _ref11.percentageTextStyle,
|
|
376
|
+
resultsPercentageTextStyle = _ref11$percentageText === void 0 ? null : _ref11$percentageText;
|
|
376
377
|
var finalResult = useMemo(function () {
|
|
377
378
|
var defaultResult = hasDefaultResult ? result : null;
|
|
378
379
|
var answer = answers !== null && userAnswerIndex !== null ? answers[userAnswerIndex] : null;
|
|
379
|
-
var
|
|
380
|
-
|
|
381
|
-
answerResult =
|
|
380
|
+
var _ref12 = answer || {},
|
|
381
|
+
_ref12$result = _ref12.result,
|
|
382
|
+
answerResult = _ref12$result === void 0 ? null : _ref12$result;
|
|
382
383
|
return answerResult || defaultResult;
|
|
383
384
|
}, [hasDefaultResult, result, answers, userAnswerIndex]);
|
|
384
385
|
var showReset = isEdit && userAnswerIndex !== null;
|
|
@@ -389,43 +390,43 @@ var SurveyScreen = function SurveyScreen(_ref) {
|
|
|
389
390
|
className: styles.items
|
|
390
391
|
}, (isPlaceholder ? _toConsumableArray(new Array(3)) : answers).map(function (answer, answerIndex) {
|
|
391
392
|
var hasAnswer = answer !== null;
|
|
392
|
-
var
|
|
393
|
-
|
|
394
|
-
label =
|
|
395
|
-
|
|
396
|
-
answerButtonStyle =
|
|
397
|
-
|
|
398
|
-
answerButtonTextStyle =
|
|
399
|
-
|
|
400
|
-
answerResultStyle =
|
|
401
|
-
var
|
|
402
|
-
|
|
403
|
-
answerResultBarColor =
|
|
404
|
-
answerResultTextColor =
|
|
405
|
-
|
|
406
|
-
answerResultPercentageTextStyle =
|
|
393
|
+
var _ref13 = answer || {},
|
|
394
|
+
_ref13$label = _ref13.label,
|
|
395
|
+
label = _ref13$label === void 0 ? null : _ref13$label,
|
|
396
|
+
_ref13$buttonStyle = _ref13.buttonStyle,
|
|
397
|
+
answerButtonStyle = _ref13$buttonStyle === void 0 ? null : _ref13$buttonStyle,
|
|
398
|
+
_ref13$textStyle = _ref13.textStyle,
|
|
399
|
+
answerButtonTextStyle = _ref13$textStyle === void 0 ? null : _ref13$textStyle,
|
|
400
|
+
_ref13$resultStyle = _ref13.resultStyle,
|
|
401
|
+
answerResultStyle = _ref13$resultStyle === void 0 ? null : _ref13$resultStyle;
|
|
402
|
+
var _ref14 = answerResultStyle || {},
|
|
403
|
+
_ref14$barColor = _ref14.barColor,
|
|
404
|
+
answerResultBarColor = _ref14$barColor === void 0 ? null : _ref14$barColor,
|
|
405
|
+
answerResultTextColor = _ref14.textColor,
|
|
406
|
+
_ref14$percentageText = _ref14.percentageTextStyle,
|
|
407
|
+
answerResultPercentageTextStyle = _ref14$percentageText === void 0 ? null : _ref14$percentageText;
|
|
408
|
+
var _ref15 = label || {},
|
|
409
|
+
_ref15$body = _ref15.body,
|
|
410
|
+
body = _ref15$body === void 0 ? null : _ref15$body;
|
|
411
|
+
var _ref16 = body !== null ? quizAnswersComputed[body] || {} : {},
|
|
412
|
+
_ref16$percent = _ref16.percent,
|
|
413
|
+
percent = _ref16$percent === void 0 ? 0 : _ref16$percent,
|
|
414
|
+
_ref16$count = _ref16.count,
|
|
415
|
+
count = _ref16$count === void 0 ? 0 : _ref16$count;
|
|
407
416
|
var _ref17 = label || {},
|
|
408
|
-
_ref17$
|
|
409
|
-
|
|
410
|
-
var _ref18 =
|
|
411
|
-
_ref18$
|
|
412
|
-
|
|
413
|
-
_ref18$count = _ref18.count,
|
|
414
|
-
count = _ref18$count === void 0 ? 0 : _ref18$count;
|
|
415
|
-
var _ref19 = label || {},
|
|
416
|
-
_ref19$textStyle = _ref19.textStyle,
|
|
417
|
-
textStyle = _ref19$textStyle === void 0 ? null : _ref19$textStyle;
|
|
418
|
-
var _ref20 = textStyle || {},
|
|
419
|
-
_ref20$color = _ref20.color,
|
|
420
|
-
labelColor = _ref20$color === void 0 ? null : _ref20$color;
|
|
417
|
+
_ref17$textStyle = _ref17.textStyle,
|
|
418
|
+
textStyle = _ref17$textStyle === void 0 ? null : _ref17$textStyle;
|
|
419
|
+
var _ref18 = textStyle || {},
|
|
420
|
+
_ref18$color = _ref18.color,
|
|
421
|
+
labelColor = _ref18$color === void 0 ? null : _ref18$color;
|
|
421
422
|
var hasAnswerLabel = isTextFilled(label);
|
|
422
423
|
var userAnswer = userAnswerIndex === answerIndex;
|
|
423
424
|
var buttonStyles = _objectSpread(_objectSpread(_objectSpread({}, buttonsStyle), answerButtonStyle), answered ? {
|
|
424
425
|
textAlign: 'left'
|
|
425
426
|
} : null);
|
|
426
|
-
var
|
|
427
|
-
|
|
428
|
-
answerResultBorderRadius =
|
|
427
|
+
var _ref19 = buttonStyles || {},
|
|
428
|
+
_ref19$borderRadius = _ref19.borderRadius,
|
|
429
|
+
answerResultBorderRadius = _ref19$borderRadius === void 0 ? null : _ref19$borderRadius;
|
|
429
430
|
var finalBarBorderRadius = answerResultBorderRadius !== null && isNumber(answerResultBorderRadius) && answerResultBorderRadius > 2 ? answerResultBorderRadius - 2 : answerResultBorderRadius;
|
|
430
431
|
return /*#__PURE__*/React.createElement("div", {
|
|
431
432
|
key: "answer-".concat(answerIndex + 1),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-survey",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.701",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
66
66
|
"@micromag/core": "^0.3.679",
|
|
67
67
|
"@micromag/data": "^0.3.699",
|
|
68
|
-
"@micromag/element-background": "^0.3.
|
|
68
|
+
"@micromag/element-background": "^0.3.700",
|
|
69
69
|
"@micromag/element-button": "^0.3.679",
|
|
70
70
|
"@micromag/element-container": "^0.3.679",
|
|
71
71
|
"@micromag/element-footer": "^0.3.679",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"access": "public",
|
|
88
88
|
"registry": "https://registry.npmjs.org/"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "c693ba9ccf9798d2b047c5a8b427453a1b7a09d6"
|
|
91
91
|
}
|