@micromag/screen-quiz 0.3.637 → 0.3.644
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/assets/css/styles.css +2 -2
- package/es/index.js +140 -55
- package/package.json +2 -2
package/assets/css/styles.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.micromag-screen-quiz-answers-emptyAnswer{border:2px dashed #343434;color:#343434;margin:5px auto}.micromag-screen-quiz-answers-button:focus-visible{outline:3px solid #a13dff;outline-offset:4px}.micromag-screen-quiz-answers-container,.micromag-screen-quiz-answers-items{position:relative}.micromag-screen-quiz-answers-emptyAnswer{font-size:.75em;height:40px;margin:0 auto;width:100%}.micromag-screen-quiz-answers-item{margin:0;padding:0;position:relative;-webkit-transition:opacity .6s ease-out;transition:opacity .6s ease-out}.micromag-screen-quiz-answers-isPlaceholder .micromag-screen-quiz-answers-item{padding:1px 0}.micromag-screen-quiz-answers-item.micromag-screen-quiz-answers-userAnswer{opacity:1!important}.micromag-screen-quiz-answers-item.micromag-screen-quiz-answers-otherAnswer{opacity:.6!important}.micromag-screen-quiz-answers-item.micromag-screen-quiz-answers-withoutOpacity{opacity:1!important}.micromag-screen-quiz-answers-button{color:#fff;padding:10px;position:relative;width:100%}.micromag-screen-quiz-answers-button:disabled{opacity:1;pointer-events:none}.micromag-screen-quiz-answers-withIcon .micromag-screen-quiz-answers-button{padding-left:42px;padding-right:42px}.micromag-screen-quiz-answers-resultIcon{display:-ms-flexbox;display:flex;left:5px;position:absolute;top:50%;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;background-color:#ff2945;border:2px solid #1c1c1c;border-radius:50%;height:32px;justify-content:center;margin-top:-16px;opacity:0;padding:5px;-webkit-transition:opacity .15s ease;transition:opacity .15s ease;width:32px}.micromag-screen-quiz-answers-answered .micromag-screen-quiz-answers-resultIcon{opacity:1}.micromag-screen-quiz-answers-rightAnswer .micromag-screen-quiz-answers-resultIcon{background-color:#0ed88f}.micromag-screen-quiz-answers-resultIcon .micromag-screen-quiz-answers-faIcon{display:block}.micromag-screen-quiz-answers-itemContent{padding:5px 0}
|
|
2
|
-
.micromag-screen-quiz-question-container .micromag-screen-quiz-question-emptyQuestion,.micromag-screen-quiz-question-container .micromag-screen-quiz-question-emptyResult{border:2px dashed #343434;color:#343434;margin:5px auto}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-question{margin-bottom:10px}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-index{display:block;margin-bottom:1em;text-align:center;width:100%}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-result{opacity:0;pointer-events:none;position:absolute;-webkit-transition:opacity .5s ease;transition:opacity .5s ease;-webkit-transition-delay:.3s;transition-delay:.3s}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-
|
|
3
|
-
.micromag-screen-quiz-container .micromag-screen-quiz-background{height:100%;left:0;position:absolute;top:0;width:100%}.micromag-screen-quiz-container{height:100%;overflow:hidden;position:relative;width:100%}.micromag-screen-quiz-disabled.micromag-screen-quiz-container{overflow:hidden;pointer-events:none}.micromag-screen-quiz-hidden.micromag-screen-quiz-container{display:none;visibility:hidden}.micromag-screen-quiz-placeholder.micromag-screen-quiz-container .micromag-screen-quiz-content{padding:6px;position:relative}.micromag-screen-quiz-container .micromag-screen-quiz-background{z-index:0}.micromag-screen-quiz-container .micromag-screen-quiz-content{z-index:2}.micromag-screen-quiz-container.micromag-screen-quiz-disabled{pointer-events:none}.micromag-screen-quiz-reset{border:0;padding:10px;position:absolute;right:0;top:0;-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center;-webkit-transition:opacity .15s ease-out,-webkit-transform .15s ease-out;transition:opacity .15s ease-out,-webkit-transform .15s ease-out;transition:opacity .15s ease-out,transform .15s ease-out;transition:opacity .15s ease-out,transform .15s ease-out,-webkit-transform .15s ease-out;z-index:1000}.micromag-screen-quiz-reset:hover{border:0;opacity:.8}.micromag-screen-quiz-reset:hover:active{-webkit-transform:rotate(30deg);-ms-transform:rotate(30deg);transform:rotate(30deg)}.micromag-screen-quiz-points{color:#fff;left:0;padding:10px;position:absolute;top:0;z-index:1000}.micromag-screen-quiz-layout{bottom:0;left:0;position:absolute;right:0;top:0}.micromag-screen-quiz-header{left:0;position:absolute;top:0;-webkit-transition:opacity .2s ease-out;transition:opacity .2s ease-out;width:100%}.micromag-screen-quiz-header.micromag-screen-quiz-disabled{opacity:0;pointer-events:none}.micromag-screen-quiz-footer{bottom:0;left:0;position:absolute;-webkit-transition:opacity .2s ease-out;transition:opacity .2s ease-out;width:100%}.micromag-screen-quiz-footer a{padding:0}.micromag-screen-quiz-footer.micromag-screen-quiz-disabled{opacity:0;pointer-events:none}.micromag-screen-quiz-transition{bottom:0;left:0;position:absolute;right:0;top:0}.micromag-screen-quiz-intro,.micromag-screen-quiz-question,.micromag-screen-quiz-results{overflow:hidden}.micromag-screen-quiz-intro.micromag-screen-quiz-enter,.micromag-screen-quiz-question.micromag-screen-quiz-enter,.micromag-screen-quiz-results.micromag-screen-quiz-enter{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%)}.micromag-screen-quiz-left .micromag-screen-quiz-intro.micromag-screen-quiz-enter,.micromag-screen-quiz-left .micromag-screen-quiz-question.micromag-screen-quiz-enter,.micromag-screen-quiz-left .micromag-screen-quiz-results.micromag-screen-quiz-enter{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%)}.micromag-screen-quiz-intro.micromag-screen-quiz-enterActive,.micromag-screen-quiz-left .micromag-screen-quiz-intro.micromag-screen-quiz-enterActive,.micromag-screen-quiz-left .micromag-screen-quiz-question.micromag-screen-quiz-enterActive,.micromag-screen-quiz-left .micromag-screen-quiz-results.micromag-screen-quiz-enterActive,.micromag-screen-quiz-question.micromag-screen-quiz-enterActive,.micromag-screen-quiz-results.micromag-screen-quiz-enterActive{left:0;min-height:100%;position:absolute;top:0;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0);-webkit-transition:-webkit-transform 1s ease;transition:-webkit-transform 1s ease;transition:transform 1s ease;transition:transform 1s ease,-webkit-transform 1s ease;width:100%}.micromag-screen-quiz-intro.micromag-screen-quiz-exit,.micromag-screen-quiz-question.micromag-screen-quiz-exit,.micromag-screen-quiz-results.micromag-screen-quiz-exit{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}.micromag-screen-quiz-intro.micromag-screen-quiz-exitActive,.micromag-screen-quiz-question.micromag-screen-quiz-exitActive,.micromag-screen-quiz-results.micromag-screen-quiz-exitActive{left:0;min-height:100%;position:absolute;top:0;-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);-webkit-transition:-webkit-transform 1s ease;transition:-webkit-transform 1s ease;transition:transform 1s ease;transition:transform 1s ease,-webkit-transform 1s ease;width:100%}.micromag-screen-quiz-left .micromag-screen-quiz-intro.micromag-screen-quiz-exitActive,.micromag-screen-quiz-left .micromag-screen-quiz-question.micromag-screen-quiz-exitActive,.micromag-screen-quiz-left .micromag-screen-quiz-results.micromag-screen-quiz-exitActive{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%)}.micromag-screen-quiz-background.micromag-screen-quiz-enter{opacity:0}.micromag-screen-quiz-background.micromag-screen-quiz-enterActive{opacity:1;-webkit-transition:opacity 1s ease;transition:opacity 1s ease;z-index:1}.micromag-screen-quiz-background.micromag-screen-quiz-exit{opacity:1}.micromag-screen-quiz-background.micromag-screen-quiz-exitActive{opacity:0;-webkit-transition:opacity 1s ease;transition:opacity 1s ease;z-index:0}
|
|
2
|
+
.micromag-screen-quiz-question-container .micromag-screen-quiz-question-emptyQuestion,.micromag-screen-quiz-question-container .micromag-screen-quiz-question-emptyResult{border:2px dashed #343434;color:#343434;margin:5px auto}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-question{margin-bottom:10px}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-index{display:block;margin-bottom:1em;text-align:center;width:100%}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-resultContent{padding:20px 0}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-result{opacity:0;pointer-events:none;position:absolute;-webkit-transition:opacity .5s ease;transition:opacity .5s ease;-webkit-transition-delay:.3s;transition-delay:.3s}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-emptyQuestion,.micromag-screen-quiz-question-container .micromag-screen-quiz-question-emptyResult{margin:0 auto;width:100%}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-emptyQuestion{height:60px;margin-bottom:10px}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-emptyResult{height:100px}.micromag-screen-quiz-question-container.micromag-screen-quiz-question-resultVisible .micromag-screen-quiz-question-result{opacity:1;pointer-events:all;position:relative}.micromag-screen-quiz-question-container.micromag-screen-quiz-question-resultHidden .micromag-screen-quiz-question-result{opacity:0;pointer-events:none;position:absolute}.micromag-screen-quiz-question-container.micromag-screen-quiz-question-resultHidden .micromag-screen-quiz-question-result .micromag-screen-quiz-question-resultContent{padding:0}.micromag-screen-quiz-question-container.micromag-screen-quiz-question-isPlaceholder{padding:10px}.micromag-screen-quiz-question-container.micromag-screen-quiz-question-isPlaceholder .micromag-screen-quiz-question-index{color:hsla(0,0%,100%,.6);font-size:8px;mix-blend-mode:difference}
|
|
3
|
+
.micromag-screen-quiz-container .micromag-screen-quiz-background{height:100%;left:0;position:absolute;top:0;width:100%}.micromag-screen-quiz-container{height:100%;overflow:hidden;position:relative;width:100%}.micromag-screen-quiz-disabled.micromag-screen-quiz-container{overflow:hidden;pointer-events:none}.micromag-screen-quiz-hidden.micromag-screen-quiz-container{display:none;visibility:hidden}.micromag-screen-quiz-placeholder.micromag-screen-quiz-container .micromag-screen-quiz-content{padding:6px;position:relative}.micromag-screen-quiz-nextButton:focus-visible{outline:3px solid #a13dff;outline-offset:4px}.micromag-screen-quiz-container .micromag-screen-quiz-background{z-index:0}.micromag-screen-quiz-container .micromag-screen-quiz-content{z-index:2}.micromag-screen-quiz-container.micromag-screen-quiz-disabled{pointer-events:none}.micromag-screen-quiz-reset{background-color:transparent;border:0;padding:10px;position:absolute;right:0;top:0;-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center;-webkit-transition:opacity .15s ease-out,-webkit-transform .15s ease-out;transition:opacity .15s ease-out,-webkit-transform .15s ease-out;transition:opacity .15s ease-out,transform .15s ease-out;transition:opacity .15s ease-out,transform .15s ease-out,-webkit-transform .15s ease-out;z-index:1000}.micromag-screen-quiz-reset:hover{border:0;opacity:.8}.micromag-screen-quiz-reset:hover:active{-webkit-transform:rotate(30deg);-ms-transform:rotate(30deg);transform:rotate(30deg)}.micromag-screen-quiz-points{color:#fff;left:0;padding:10px;position:absolute;top:0;z-index:1000}.micromag-screen-quiz-layout{bottom:0;left:0;position:absolute;right:0;top:0}.micromag-screen-quiz-header{left:0;position:absolute;top:0;-webkit-transition:opacity .2s ease-out;transition:opacity .2s ease-out;width:100%}.micromag-screen-quiz-header.micromag-screen-quiz-disabled{opacity:0;pointer-events:none}.micromag-screen-quiz-footer{bottom:0;left:0;position:absolute;-webkit-transition:opacity .2s ease-out;transition:opacity .2s ease-out;width:100%}.micromag-screen-quiz-footer a{padding:0}.micromag-screen-quiz-footer.micromag-screen-quiz-disabled{opacity:0;pointer-events:none}.micromag-screen-quiz-transition{bottom:0;left:0;position:absolute;right:0;top:0}.micromag-screen-quiz-intro,.micromag-screen-quiz-nextButton,.micromag-screen-quiz-question,.micromag-screen-quiz-results{overflow:hidden}.micromag-screen-quiz-intro.micromag-screen-quiz-enter,.micromag-screen-quiz-nextButton.micromag-screen-quiz-enter,.micromag-screen-quiz-question.micromag-screen-quiz-enter,.micromag-screen-quiz-results.micromag-screen-quiz-enter{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%)}.micromag-screen-quiz-left .micromag-screen-quiz-intro.micromag-screen-quiz-enter,.micromag-screen-quiz-left .micromag-screen-quiz-nextButton.micromag-screen-quiz-enter,.micromag-screen-quiz-left .micromag-screen-quiz-question.micromag-screen-quiz-enter,.micromag-screen-quiz-left .micromag-screen-quiz-results.micromag-screen-quiz-enter{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%)}.micromag-screen-quiz-intro.micromag-screen-quiz-enterActive,.micromag-screen-quiz-left .micromag-screen-quiz-intro.micromag-screen-quiz-enterActive,.micromag-screen-quiz-left .micromag-screen-quiz-nextButton.micromag-screen-quiz-enterActive,.micromag-screen-quiz-left .micromag-screen-quiz-question.micromag-screen-quiz-enterActive,.micromag-screen-quiz-left .micromag-screen-quiz-results.micromag-screen-quiz-enterActive,.micromag-screen-quiz-nextButton.micromag-screen-quiz-enterActive,.micromag-screen-quiz-question.micromag-screen-quiz-enterActive,.micromag-screen-quiz-results.micromag-screen-quiz-enterActive{left:0;min-height:100%;position:absolute;top:0;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0);-webkit-transition:-webkit-transform 1s ease;transition:-webkit-transform 1s ease;transition:transform 1s ease;transition:transform 1s ease,-webkit-transform 1s ease;width:100%}.micromag-screen-quiz-intro.micromag-screen-quiz-exit,.micromag-screen-quiz-nextButton.micromag-screen-quiz-exit,.micromag-screen-quiz-question.micromag-screen-quiz-exit,.micromag-screen-quiz-results.micromag-screen-quiz-exit{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}.micromag-screen-quiz-intro.micromag-screen-quiz-exitActive,.micromag-screen-quiz-nextButton.micromag-screen-quiz-exitActive,.micromag-screen-quiz-question.micromag-screen-quiz-exitActive,.micromag-screen-quiz-results.micromag-screen-quiz-exitActive{left:0;min-height:100%;position:absolute;top:0;-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);-webkit-transition:-webkit-transform 1s ease;transition:-webkit-transform 1s ease;transition:transform 1s ease;transition:transform 1s ease,-webkit-transform 1s ease;width:100%}.micromag-screen-quiz-left .micromag-screen-quiz-intro.micromag-screen-quiz-exitActive,.micromag-screen-quiz-left .micromag-screen-quiz-nextButton.micromag-screen-quiz-exitActive,.micromag-screen-quiz-left .micromag-screen-quiz-question.micromag-screen-quiz-exitActive,.micromag-screen-quiz-left .micromag-screen-quiz-results.micromag-screen-quiz-exitActive{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%)}.micromag-screen-quiz-nextButton{color:#fff;padding:10px;position:relative;width:100%}.micromag-screen-quiz-nextButton:disabled{opacity:1;pointer-events:none}.micromag-screen-quiz-withIcon .micromag-screen-quiz-nextButton{padding-left:42px;padding-right:42px}.micromag-screen-quiz-background.micromag-screen-quiz-enter{opacity:0}.micromag-screen-quiz-background.micromag-screen-quiz-enterActive{opacity:1;-webkit-transition:opacity 1s ease;transition:opacity 1s ease;z-index:1}.micromag-screen-quiz-background.micromag-screen-quiz-exit{opacity:1}.micromag-screen-quiz-background.micromag-screen-quiz-exitActive{opacity:0;-webkit-transition:opacity 1s ease;transition:opacity 1s ease;z-index:0}
|
|
4
4
|
.micromag-screen-quiz-results-container .micromag-screen-quiz-results-emptyDescription,.micromag-screen-quiz-results-container .micromag-screen-quiz-results-emptyTitle{border:2px dashed #343434;color:#343434;margin:5px auto}.micromag-screen-quiz-results-container .micromag-screen-quiz-results-title{margin-bottom:10px}.micromag-screen-quiz-results-container .micromag-screen-quiz-results-emptyDescription,.micromag-screen-quiz-results-container .micromag-screen-quiz-results-emptyTitle{margin:0 auto;width:100%}.micromag-screen-quiz-results-container .micromag-screen-quiz-results-emptyTitle{height:60px}.micromag-screen-quiz-results-container .micromag-screen-quiz-results-emptyDescription{height:100px}.micromag-screen-quiz-results-container.micromag-screen-quiz-results-isPlaceholder{padding:10px}
|
|
5
5
|
.micromag-screen-quiz-title-container .micromag-screen-quiz-title-emptyDescription,.micromag-screen-quiz-title-container .micromag-screen-quiz-title-emptyTitle{border:2px dashed #343434;color:#343434;margin:5px auto}.micromag-screen-quiz-title-container .micromag-screen-quiz-title-description,.micromag-screen-quiz-title-container .micromag-screen-quiz-title-title{margin-bottom:10px}.micromag-screen-quiz-title-container .micromag-screen-quiz-title-emptyDescription,.micromag-screen-quiz-title-container .micromag-screen-quiz-title-emptyTitle{margin:0 auto 10px;width:100%}.micromag-screen-quiz-title-container .micromag-screen-quiz-title-emptyTitle{height:60px}.micromag-screen-quiz-title-container .micromag-screen-quiz-title-emptyDescription{height:100px}.micromag-screen-quiz-title-container.micromag-screen-quiz-title-isPlaceholder{padding:10px}
|
package/es/index.js
CHANGED
|
@@ -332,7 +332,7 @@ var Answers = function Answers(_ref) {
|
|
|
332
332
|
Answers.propTypes = propTypes$5;
|
|
333
333
|
Answers.defaultProps = defaultProps$5;
|
|
334
334
|
|
|
335
|
-
var styles$3 = {"container":"micromag-screen-quiz-question-container","emptyQuestion":"micromag-screen-quiz-question-emptyQuestion","emptyResult":"micromag-screen-quiz-question-emptyResult","question":"micromag-screen-quiz-question-question","index":"micromag-screen-quiz-question-index","
|
|
335
|
+
var styles$3 = {"container":"micromag-screen-quiz-question-container","emptyQuestion":"micromag-screen-quiz-question-emptyQuestion","emptyResult":"micromag-screen-quiz-question-emptyResult","question":"micromag-screen-quiz-question-question","index":"micromag-screen-quiz-question-index","resultContent":"micromag-screen-quiz-question-resultContent","result":"micromag-screen-quiz-question-result","resultVisible":"micromag-screen-quiz-question-resultVisible","resultHidden":"micromag-screen-quiz-question-resultHidden","isPlaceholder":"micromag-screen-quiz-question-isPlaceholder"};
|
|
336
336
|
|
|
337
337
|
var propTypes$4 = {
|
|
338
338
|
question: PropTypes$1.textElement,
|
|
@@ -467,7 +467,7 @@ var Question = function Question(_ref) {
|
|
|
467
467
|
}, [setResultVisible]);
|
|
468
468
|
var hasIndex = index !== null && totalCount !== null;
|
|
469
469
|
return /*#__PURE__*/React.createElement(Layout, {
|
|
470
|
-
className: classNames([styles$3.container, _defineProperty(_defineProperty(_defineProperty({}, styles$3.isPlaceholder, isPlaceholder), styles$3.resultVisible, resultVisible), className, className !== null)]),
|
|
470
|
+
className: classNames([styles$3.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles$3.isPlaceholder, isPlaceholder), styles$3.resultVisible, resultVisible), styles$3.resultHidden, !hasResult), className, className !== null)]),
|
|
471
471
|
verticalAlign: verticalAlign,
|
|
472
472
|
style: style
|
|
473
473
|
}, [!withoutIndex && hasIndex ? /*#__PURE__*/React.createElement(ScreenElement, {
|
|
@@ -525,7 +525,7 @@ var Question = function Question(_ref) {
|
|
|
525
525
|
onCollapse: onAnswersCollapse,
|
|
526
526
|
onTransitionEnd: onAnswerTransitionEnd
|
|
527
527
|
}), withResult ? /*#__PURE__*/React.createElement("div", {
|
|
528
|
-
className: styles$3.result,
|
|
528
|
+
className: classNames([styles$3.result]),
|
|
529
529
|
key: "results"
|
|
530
530
|
}, /*#__PURE__*/React.createElement("div", {
|
|
531
531
|
className: styles$3.resultContent
|
|
@@ -556,7 +556,7 @@ var Question = function Question(_ref) {
|
|
|
556
556
|
Question.propTypes = propTypes$4;
|
|
557
557
|
Question.defaultProps = defaultProps$4;
|
|
558
558
|
|
|
559
|
-
var styles$2 = {"container":"micromag-screen-quiz-container","background":"micromag-screen-quiz-background","disabled":"micromag-screen-quiz-disabled","hidden":"micromag-screen-quiz-hidden","placeholder":"micromag-screen-quiz-placeholder","content":"micromag-screen-quiz-content","reset":"micromag-screen-quiz-reset","points":"micromag-screen-quiz-points","layout":"micromag-screen-quiz-layout","header":"micromag-screen-quiz-header","footer":"micromag-screen-quiz-footer","transition":"micromag-screen-quiz-transition","question":"micromag-screen-quiz-question","results":"micromag-screen-quiz-results","intro":"micromag-screen-quiz-intro","enter":"micromag-screen-quiz-enter","left":"micromag-screen-quiz-left","enterActive":"micromag-screen-quiz-enterActive","exit":"micromag-screen-quiz-exit","exitActive":"micromag-screen-quiz-exitActive"};
|
|
559
|
+
var styles$2 = {"container":"micromag-screen-quiz-container","background":"micromag-screen-quiz-background","disabled":"micromag-screen-quiz-disabled","hidden":"micromag-screen-quiz-hidden","placeholder":"micromag-screen-quiz-placeholder","content":"micromag-screen-quiz-content","nextButton":"micromag-screen-quiz-nextButton","reset":"micromag-screen-quiz-reset","points":"micromag-screen-quiz-points","layout":"micromag-screen-quiz-layout","header":"micromag-screen-quiz-header","footer":"micromag-screen-quiz-footer","transition":"micromag-screen-quiz-transition","question":"micromag-screen-quiz-question","results":"micromag-screen-quiz-results","intro":"micromag-screen-quiz-intro","enter":"micromag-screen-quiz-enter","left":"micromag-screen-quiz-left","enterActive":"micromag-screen-quiz-enterActive","exit":"micromag-screen-quiz-exit","exitActive":"micromag-screen-quiz-exitActive","withIcon":"micromag-screen-quiz-withIcon"};
|
|
560
560
|
|
|
561
561
|
var propTypes$3 = {
|
|
562
562
|
id: PropTypes.string,
|
|
@@ -1080,6 +1080,7 @@ var propTypes = {
|
|
|
1080
1080
|
background: PropTypes$1.backgroundElement,
|
|
1081
1081
|
introButton: PropTypes$1.textElement,
|
|
1082
1082
|
introBackground: PropTypes$1.backgroundElement,
|
|
1083
|
+
nextButton: PropTypes$1.textElement,
|
|
1083
1084
|
header: PropTypes$1.header,
|
|
1084
1085
|
footer: PropTypes$1.footer,
|
|
1085
1086
|
current: PropTypes.bool,
|
|
@@ -1110,6 +1111,7 @@ var defaultProps = {
|
|
|
1110
1111
|
background: null,
|
|
1111
1112
|
introButton: null,
|
|
1112
1113
|
introBackground: null,
|
|
1114
|
+
nextButton: null,
|
|
1113
1115
|
header: null,
|
|
1114
1116
|
footer: null,
|
|
1115
1117
|
current: true,
|
|
@@ -1140,6 +1142,7 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1140
1142
|
background = _ref.background,
|
|
1141
1143
|
introBackground = _ref.introBackground,
|
|
1142
1144
|
introButton = _ref.introButton,
|
|
1145
|
+
nextButton = _ref.nextButton,
|
|
1143
1146
|
header = _ref.header,
|
|
1144
1147
|
footer = _ref.footer,
|
|
1145
1148
|
current = _ref.current,
|
|
@@ -1181,9 +1184,9 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1181
1184
|
var transitionDisabled = isStatic || isCapture || isPlaceholder || isPreview || isEdit;
|
|
1182
1185
|
var backgroundPlaying = current && (isView || isEdit);
|
|
1183
1186
|
var backgroundShouldLoad = current || active;
|
|
1187
|
+
var hasButtonText = isTextFilled(nextButton);
|
|
1184
1188
|
|
|
1185
1189
|
// Call to Action
|
|
1186
|
-
|
|
1187
1190
|
var hasHeader = isHeaderFilled(header);
|
|
1188
1191
|
var hasFooter = isFooterFilled(footer);
|
|
1189
1192
|
var footerProps = getFooterProps(footer, {
|
|
@@ -1230,18 +1233,6 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1230
1233
|
answerIndex: answerIndex
|
|
1231
1234
|
});
|
|
1232
1235
|
}, [userAnswers, setUserAnswers, trackScreenEvent, questions, questionIndex]);
|
|
1233
|
-
var onAnswerTransitionEnd = useCallback(function () {
|
|
1234
|
-
if (isEdit) {
|
|
1235
|
-
return;
|
|
1236
|
-
}
|
|
1237
|
-
var nextIndex = questionIndex + 1;
|
|
1238
|
-
var questionsCount = questions.length;
|
|
1239
|
-
if (nextIndex < questionsCount) {
|
|
1240
|
-
setQuestionIndex(nextIndex);
|
|
1241
|
-
} else if (nextIndex === questionsCount) {
|
|
1242
|
-
setQuestionIndex('results');
|
|
1243
|
-
}
|
|
1244
|
-
}, [questions, questionIndex, setQuestionIndex, isEdit]);
|
|
1245
1236
|
var onClickIntroButton = useCallback(function () {
|
|
1246
1237
|
setQuestionIndex(0);
|
|
1247
1238
|
}, [setQuestionIndex]);
|
|
@@ -1252,24 +1243,52 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1252
1243
|
}, [isEdit, current, userAnswers, setUserAnswers]);
|
|
1253
1244
|
var hasQuestions = questions !== null && questions.length > 0;
|
|
1254
1245
|
var currentQuestion = hasQuestions ? questions[questionIndex] || {} : {};
|
|
1255
|
-
var
|
|
1256
|
-
text =
|
|
1257
|
-
|
|
1258
|
-
answers =
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1246
|
+
var _ref4 = currentQuestion || {},
|
|
1247
|
+
_ref4$text = _ref4.text,
|
|
1248
|
+
text = _ref4$text === undefined ? null : _ref4$text,
|
|
1249
|
+
_ref4$answers = _ref4.answers,
|
|
1250
|
+
answers = _ref4$answers === undefined ? [] : _ref4$answers,
|
|
1251
|
+
_ref4$background = _ref4.background,
|
|
1252
|
+
questionBackground = _ref4$background === undefined ? null : _ref4$background,
|
|
1253
|
+
_ref4$layout = _ref4.layout,
|
|
1254
|
+
questionLayout = _ref4$layout === undefined ? null : _ref4$layout,
|
|
1255
|
+
_ref4$result = _ref4.result,
|
|
1256
|
+
questionResult = _ref4$result === undefined ? null : _ref4$result,
|
|
1257
|
+
_ref4$resultImage = _ref4.resultImage,
|
|
1258
|
+
questionResultImage = _ref4$resultImage === undefined ? null : _ref4$resultImage;
|
|
1263
1259
|
var currentAnsweredIndex = userAnswers !== null && typeof userAnswers[questionIndex] !== 'undefined' ? userAnswers[questionIndex] : null;
|
|
1260
|
+
var answer = currentAnsweredIndex !== null && typeof answers[currentAnsweredIndex] !== 'undefined' ? answers[currentAnsweredIndex] : null;
|
|
1261
|
+
var _ref5 = answer || {},
|
|
1262
|
+
_ref5$customAnswerLab = _ref5.customAnswerLabel,
|
|
1263
|
+
customAnswerLabel = _ref5$customAnswerLab === undefined ? null : _ref5$customAnswerLab;
|
|
1264
|
+
var firstCustomAnswerLabel = (answers || []).find(function () {
|
|
1265
|
+
var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1266
|
+
_ref6$customAnswerLab = _ref6.customAnswerLabel,
|
|
1267
|
+
cal = _ref6$customAnswerLab === undefined ? null : _ref6$customAnswerLab;
|
|
1268
|
+
return cal !== null;
|
|
1269
|
+
}) || null;
|
|
1270
|
+
var hasResult = questionResult !== null || questionResultImage !== null || customAnswerLabel !== null || firstCustomAnswerLabel !== null;
|
|
1271
|
+
var onNextSlide = useCallback(function () {
|
|
1272
|
+
if (isEdit) {
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
var nextIndex = questionIndex + 1;
|
|
1276
|
+
var questionsCount = questions.length;
|
|
1277
|
+
if (nextIndex < questionsCount) {
|
|
1278
|
+
setQuestionIndex(nextIndex);
|
|
1279
|
+
} else if (nextIndex === questionsCount) {
|
|
1280
|
+
setQuestionIndex('results');
|
|
1281
|
+
}
|
|
1282
|
+
}, [questions, questionIndex, setQuestionIndex, isEdit]);
|
|
1264
1283
|
var currentPoints = useMemo(function () {
|
|
1265
1284
|
return userAnswers !== null ? Object.keys(userAnswers).reduce(function (totalPoints, answerQuestionIndex) {
|
|
1266
|
-
var
|
|
1267
|
-
|
|
1268
|
-
questionAnswers =
|
|
1285
|
+
var _ref7 = questions !== null ? questions[answerQuestionIndex] || {} : {},
|
|
1286
|
+
_ref7$answers = _ref7.answers,
|
|
1287
|
+
questionAnswers = _ref7$answers === undefined ? [] : _ref7$answers;
|
|
1269
1288
|
var answerIndex = userAnswers[answerQuestionIndex];
|
|
1270
|
-
var
|
|
1271
|
-
|
|
1272
|
-
points =
|
|
1289
|
+
var _ref8 = questionAnswers[answerIndex] || {},
|
|
1290
|
+
_ref8$points = _ref8.points,
|
|
1291
|
+
points = _ref8$points === undefined ? 0 : _ref8$points;
|
|
1273
1292
|
return points + totalPoints;
|
|
1274
1293
|
}, 0) : 0;
|
|
1275
1294
|
}, [userAnswers, questions]);
|
|
@@ -1283,30 +1302,30 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1283
1302
|
if (stateId === 'results') {
|
|
1284
1303
|
return (results || [])[parseInt(stateIndex, 10)] || null;
|
|
1285
1304
|
}
|
|
1286
|
-
return (results || []).sort(function (
|
|
1287
|
-
var
|
|
1288
|
-
pointsA =
|
|
1289
|
-
var
|
|
1290
|
-
pointsB =
|
|
1305
|
+
return (results || []).sort(function (_ref9, _ref10) {
|
|
1306
|
+
var _ref9$points = _ref9.points,
|
|
1307
|
+
pointsA = _ref9$points === undefined ? 0 : _ref9$points;
|
|
1308
|
+
var _ref10$points = _ref10.points,
|
|
1309
|
+
pointsB = _ref10$points === undefined ? 0 : _ref10$points;
|
|
1291
1310
|
if (pointsA === pointsB) {
|
|
1292
1311
|
return 0;
|
|
1293
1312
|
}
|
|
1294
1313
|
return pointsA > pointsB ? 1 : -1;
|
|
1295
1314
|
}).reduce(function (lastResult, result) {
|
|
1296
|
-
var
|
|
1297
|
-
|
|
1298
|
-
lastPoints =
|
|
1299
|
-
var
|
|
1300
|
-
|
|
1301
|
-
points =
|
|
1315
|
+
var _ref11 = lastResult || {},
|
|
1316
|
+
_ref11$points = _ref11.points,
|
|
1317
|
+
lastPoints = _ref11$points === undefined ? 0 : _ref11$points;
|
|
1318
|
+
var _ref12 = result || {},
|
|
1319
|
+
_ref12$points = _ref12.points,
|
|
1320
|
+
points = _ref12$points === undefined ? 0 : _ref12$points;
|
|
1302
1321
|
return currentPoints >= (lastPoints || 0) && currentPoints >= points ? result : lastResult;
|
|
1303
1322
|
}, null);
|
|
1304
1323
|
}, [isResults, results, currentPoints, stateId, stateIndex]);
|
|
1305
|
-
var
|
|
1306
|
-
|
|
1307
|
-
resultBackground =
|
|
1308
|
-
|
|
1309
|
-
resultLayout =
|
|
1324
|
+
var _ref13 = currentResult || {},
|
|
1325
|
+
_ref13$background = _ref13.background,
|
|
1326
|
+
resultBackground = _ref13$background === undefined ? null : _ref13$background,
|
|
1327
|
+
_ref13$layout = _ref13.layout,
|
|
1328
|
+
resultLayout = _ref13$layout === undefined ? null : _ref13$layout;
|
|
1310
1329
|
var _useQuizCreate = useQuizCreate({
|
|
1311
1330
|
screenId: screenId
|
|
1312
1331
|
}),
|
|
@@ -1366,8 +1385,8 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1366
1385
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
1367
1386
|
scrolledBottom = _useState6[0],
|
|
1368
1387
|
setScrolledBottom = _useState6[1];
|
|
1369
|
-
var onScrolledBottom = useCallback(function (
|
|
1370
|
-
var initial =
|
|
1388
|
+
var onScrolledBottom = useCallback(function (_ref14) {
|
|
1389
|
+
var initial = _ref14.initial;
|
|
1371
1390
|
if (initial) {
|
|
1372
1391
|
trackScreenEvent('scroll', 'Screen');
|
|
1373
1392
|
}
|
|
@@ -1380,9 +1399,9 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1380
1399
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
1381
1400
|
hasScroll = _useState8[0],
|
|
1382
1401
|
setHasScroll = _useState8[1];
|
|
1383
|
-
var onScrollHeightChange = useCallback(function (
|
|
1384
|
-
var
|
|
1385
|
-
canScroll =
|
|
1402
|
+
var onScrollHeightChange = useCallback(function (_ref15) {
|
|
1403
|
+
var _ref15$canScroll = _ref15.canScroll,
|
|
1404
|
+
canScroll = _ref15$canScroll === undefined ? false : _ref15$canScroll;
|
|
1386
1405
|
setHasScroll(canScroll);
|
|
1387
1406
|
}, [setHasScroll]);
|
|
1388
1407
|
var onQuizReset = useCallback(function () {
|
|
@@ -1413,7 +1432,7 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1413
1432
|
"type": 0,
|
|
1414
1433
|
"value": "points gained"
|
|
1415
1434
|
}]
|
|
1416
|
-
})) : null, showReset ? /*#__PURE__*/React.createElement(Button
|
|
1435
|
+
})) : null, showReset ? /*#__PURE__*/React.createElement(Button, {
|
|
1417
1436
|
className: styles$2.reset,
|
|
1418
1437
|
icon: /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
1419
1438
|
icon: faRedo,
|
|
@@ -1480,6 +1499,9 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1480
1499
|
focusable: current && isView,
|
|
1481
1500
|
showInstantAnswer: showInstantAnswer,
|
|
1482
1501
|
layout: questionLayout || layout,
|
|
1502
|
+
result: questionResult,
|
|
1503
|
+
resultImage: questionResultImage,
|
|
1504
|
+
withResult: hasResult,
|
|
1483
1505
|
withoutGoodAnswer: true,
|
|
1484
1506
|
withoutTrueFalse: true,
|
|
1485
1507
|
transitions: transitions,
|
|
@@ -1487,14 +1509,41 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1487
1509
|
transitionStagger: transitionStagger,
|
|
1488
1510
|
transitionDisabled: transitionDisabled,
|
|
1489
1511
|
onAnswerClick: onAnswerClick,
|
|
1490
|
-
onAnswerTransitionEnd:
|
|
1512
|
+
onAnswerTransitionEnd: hasResult ? null : onNextSlide,
|
|
1491
1513
|
className: styles$2.question,
|
|
1492
1514
|
style: !isPlaceholder ? {
|
|
1493
1515
|
padding: spacing,
|
|
1494
1516
|
paddingTop: (current && !isPreview ? viewerTopHeight : 0) + (headerHeight || spacing),
|
|
1495
1517
|
paddingBottom: (current && !isPreview ? viewerBottomHeight : 0) + (callToActionHeight || spacing)
|
|
1496
1518
|
} : null
|
|
1497
|
-
})) : null,
|
|
1519
|
+
})) : null, hasResult && currentAnsweredIndex !== null ? /*#__PURE__*/React.createElement(CSSTransition, {
|
|
1520
|
+
key: "next",
|
|
1521
|
+
classNames: styles$2,
|
|
1522
|
+
timeout: 0
|
|
1523
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1524
|
+
className: styles$2.next,
|
|
1525
|
+
style: !isPlaceholder ? {
|
|
1526
|
+
padding: spacing,
|
|
1527
|
+
paddingTop: (current && !isPreview ? viewerTopHeight : 0) + (headerHeight || spacing),
|
|
1528
|
+
paddingBottom: (current && !isPreview ? viewerBottomHeight : 0) + (callToActionHeight || spacing)
|
|
1529
|
+
} : null
|
|
1530
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
1531
|
+
disabled: currentAnsweredIndex === null,
|
|
1532
|
+
focusable: true,
|
|
1533
|
+
buttonStyle: nextButton !== null ? nextButton.buttonStyle : null,
|
|
1534
|
+
className: styles$2.nextButton,
|
|
1535
|
+
onClick: onNextSlide
|
|
1536
|
+
}, hasButtonText ? /*#__PURE__*/React.createElement(Text, Object.assign({}, nextButton, {
|
|
1537
|
+
className: styles$2.label
|
|
1538
|
+
})) : /*#__PURE__*/React.createElement("span", {
|
|
1539
|
+
className: styles$2.label
|
|
1540
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
1541
|
+
id: "SVLGTA",
|
|
1542
|
+
defaultMessage: [{
|
|
1543
|
+
"type": 0,
|
|
1544
|
+
"value": "Next"
|
|
1545
|
+
}]
|
|
1546
|
+
}))))) : null, isResults ? /*#__PURE__*/React.createElement(CSSTransition, {
|
|
1498
1547
|
key: "results",
|
|
1499
1548
|
classNames: styles$2,
|
|
1500
1549
|
timeout: 2000
|
|
@@ -1896,6 +1945,29 @@ var definition = [{
|
|
|
1896
1945
|
"value": "Answers"
|
|
1897
1946
|
}]
|
|
1898
1947
|
})
|
|
1948
|
+
}, {
|
|
1949
|
+
name: 'result',
|
|
1950
|
+
type: 'text-element',
|
|
1951
|
+
theme: {
|
|
1952
|
+
textStyle: 'text'
|
|
1953
|
+
},
|
|
1954
|
+
label: defineMessage({
|
|
1955
|
+
id: "iQ5Uf7",
|
|
1956
|
+
defaultMessage: [{
|
|
1957
|
+
"type": 0,
|
|
1958
|
+
"value": "Default feedback"
|
|
1959
|
+
}]
|
|
1960
|
+
})
|
|
1961
|
+
}, {
|
|
1962
|
+
name: 'resultImage',
|
|
1963
|
+
type: 'visual',
|
|
1964
|
+
label: defineMessage({
|
|
1965
|
+
id: "yA4B6h",
|
|
1966
|
+
defaultMessage: [{
|
|
1967
|
+
"type": 0,
|
|
1968
|
+
"value": "Result feedback image"
|
|
1969
|
+
}]
|
|
1970
|
+
})
|
|
1899
1971
|
}, {
|
|
1900
1972
|
name: 'background',
|
|
1901
1973
|
type: 'background',
|
|
@@ -2077,6 +2149,19 @@ var definition = [{
|
|
|
2077
2149
|
}]
|
|
2078
2150
|
})
|
|
2079
2151
|
}]
|
|
2152
|
+
}, {
|
|
2153
|
+
name: 'nextButton',
|
|
2154
|
+
type: 'button-element',
|
|
2155
|
+
theme: {
|
|
2156
|
+
textStyle: 'button'
|
|
2157
|
+
},
|
|
2158
|
+
label: defineMessage({
|
|
2159
|
+
id: "Yu/PB5",
|
|
2160
|
+
defaultMessage: [{
|
|
2161
|
+
"type": 0,
|
|
2162
|
+
"value": "Next button"
|
|
2163
|
+
}]
|
|
2164
|
+
})
|
|
2080
2165
|
}, {
|
|
2081
2166
|
name: 'background',
|
|
2082
2167
|
type: 'background',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-quiz",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.644",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"access": "public",
|
|
90
90
|
"registry": "https://registry.npmjs.org/"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "f4460f61304b26c486b121045ea629920eb28c0d"
|
|
93
93
|
}
|