@micromag/screen-quiz 0.3.7 → 0.3.11
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 +1 -1
- package/es/index.js +72 -24
- package/lib/index.js +72 -24
- package/package.json +12 -12
package/assets/css/styles.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.micromag-screen-quiz-answers-emptyAnswer{margin:5px auto;border:2px dashed #343434;color:#343434}.micromag-screen-quiz-answers-button:focus-visible{outline:3px solid #a13dff}.micromag-screen-quiz-answers-container,.micromag-screen-quiz-answers-items{position:relative}.micromag-screen-quiz-answers-emptyAnswer{width:100%;height:40px;margin:0 auto;font-size:.75em}.micromag-screen-quiz-answers-item{-webkit-transition-property:opacity;-o-transition-property:opacity;transition-property:opacity;-webkit-transition-duration:.5s;-o-transition-duration:.5s;transition-duration:.5s;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease}.micromag-screen-quiz-answers-item.micromag-screen-quiz-answers-rightAnswer{-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;-o-transition-property:transform;transition-property:transform;transition-property:transform, -webkit-transform;-webkit-transition-duration:1s;-o-transition-duration:1s;transition-duration:1s}.micromag-screen-quiz-answers-answered .micromag-screen-quiz-answers-item{opacity:.3}.micromag-screen-quiz-answers-answered .micromag-screen-quiz-answers-item.micromag-screen-quiz-answers-rightAnswer,.micromag-screen-quiz-answers-answered .micromag-screen-quiz-answers-item.micromag-screen-quiz-answers-userAnswer{opacity:.99}.micromag-screen-quiz-answers-willCollapse .micromag-screen-quiz-answers-item,.micromag-screen-quiz-answers-willCollapse .micromag-screen-quiz-answers-item.micromag-screen-quiz-answers-userAnswer{-webkit-transition-duration:.2s;-o-transition-duration:.2s;transition-duration:.2s;opacity:0}.micromag-screen-quiz-answers-willCollapse .micromag-screen-quiz-answers-item.micromag-screen-quiz-answers-rightAnswer{-webkit-transition-duration:1s;-o-transition-duration:1s;transition-duration:1s;opacity:1}.micromag-screen-quiz-answers-didCollapsed .micromag-screen-quiz-answers-item.micromag-screen-quiz-answers-rightAnswer{-webkit-transition:none;-o-transition:none;transition:none}.micromag-screen-quiz-answers-withoutGoodAnswer .micromag-screen-quiz-answers-item.micromag-screen-quiz-answers-userAnswer{-webkit-transition-duration:1s;-o-transition-duration:1s;transition-duration:1s}.micromag-screen-quiz-answers-isPlaceholder .micromag-screen-quiz-answers-item{padding:1px 0}.micromag-screen-quiz-answers-button{position:relative;width:100%;padding:10px;color:#fff;border:1px solid #fff;border-radius:10px}.micromag-screen-quiz-answers-button:disabled{opacity:1;pointer-events:none}.micromag-screen-quiz-answers-withGoodAnswer .micromag-screen-quiz-answers-button{padding-right:42px!important;padding-left:42px!important}.micromag-screen-quiz-answers-resultIcon{display:-webkit-flex;display:-ms-flexbox;display:flex;position:absolute;top:50%;left:5px;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;width:32px;height:32px;margin-top:-16px;padding:5px;-webkit-transition:opacity .15s ease;-o-transition:opacity .15s ease;transition:opacity .15s ease;border:2px solid #1c1c1c;border-radius:50%;opacity:0;background-color:#ff2945}.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-itemContent{padding:5px 0}
|
|
2
2
|
.micromag-screen-quiz-question-container .micromag-screen-quiz-question-emptyQuestion,.micromag-screen-quiz-question-container .micromag-screen-quiz-question-emptyResult{margin:5px auto;border:2px dashed #343434;color:#343434}.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;width:100%;margin-bottom:1em;text-align:center}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-result{position:absolute;-webkit-transition:opacity .5s ease;-o-transition:opacity .5s ease;transition:opacity .5s ease;-webkit-transition-delay:.3s;-o-transition-delay:.3s;transition-delay:.3s;opacity:0;pointer-events:none}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-resultContent{padding:20px 0}.micromag-screen-quiz-question-container .micromag-screen-quiz-question-emptyQuestion,.micromag-screen-quiz-question-container .micromag-screen-quiz-question-emptyResult{width:100%;margin:0 auto}.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{position:relative;opacity:1;pointer-events:all}.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);mix-blend-mode:difference;font-size:8px}
|
|
3
3
|
.micromag-screen-quiz-container{position:relative;width:100%;height:100%;overflow:hidden}.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{position:relative;padding:6px}.micromag-screen-quiz-layout{top:0;right:0}.micromag-screen-quiz-callToAction,.micromag-screen-quiz-layout{position:absolute;bottom:0;left:0}.micromag-screen-quiz-callToAction{width:100%}.micromag-screen-quiz-transition{position:absolute;top:0;right:0;bottom:0;left: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{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0);-webkit-transition:-webkit-transform 1s ease;transition:-webkit-transform 1s ease;-o-transition:transform 1s ease;transition:transform 1s ease;transition:transform 1s ease, -webkit-transform 1s ease}.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{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);-webkit-transition:-webkit-transform 1s ease;transition:-webkit-transform 1s ease;-o-transition:transform 1s ease;transition:transform 1s ease;transition:transform 1s ease, -webkit-transform 1s ease}.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{-webkit-transition:opacity 1s ease;-o-transition:opacity 1s ease;transition:opacity 1s ease;opacity:1}.micromag-screen-quiz-background.micromag-screen-quiz-exit{opacity:1}.micromag-screen-quiz-background.micromag-screen-quiz-exitActive{-webkit-transition:opacity 1s ease;-o-transition:opacity 1s ease;transition:opacity 1s ease;opacity:0}
|
|
4
|
-
.micromag-screen-quiz-title-container .micromag-screen-quiz-title-emptyDescription,.micromag-screen-quiz-title-container .micromag-screen-quiz-title-emptyTitle{margin:5px auto;border:2px dashed #343434;color:#343434}.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{width:100%;margin:0 auto}.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}
|
|
4
|
+
.micromag-screen-quiz-title-container .micromag-screen-quiz-title-emptyDescription,.micromag-screen-quiz-title-container .micromag-screen-quiz-title-emptyTitle{margin:5px auto;border:2px dashed #343434;color:#343434}.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{width:100%;margin:0 auto 10px}.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}
|
|
5
5
|
.micromag-screen-quiz-results-container .micromag-screen-quiz-results-emptyDescription,.micromag-screen-quiz-results-container .micromag-screen-quiz-results-emptyTitle{margin:5px auto;border:2px dashed #343434;color:#343434}.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{width:100%;margin:0 auto}.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}
|
package/es/index.js
CHANGED
|
@@ -162,7 +162,6 @@ var Answers = function Answers(_ref) {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
}, [shouldCollapse, answersCollapsed, answersDidCollapsed, setAnswersCollapsed, onCollapsed, onTransitionEnd]);
|
|
165
|
-
console.log(items);
|
|
166
165
|
return /*#__PURE__*/React.createElement("div", {
|
|
167
166
|
className: classNames([styles$4.container, (_ref5 = {}, _defineProperty(_ref5, styles$4.answered, answered), _defineProperty(_ref5, styles$4.withoutGoodAnswer, withoutGoodAnswer), _defineProperty(_ref5, styles$4.withGoodAnswer, !withoutGoodAnswer), _defineProperty(_ref5, styles$4.willCollapse, shouldCollapse && answersCollapsed), _defineProperty(_ref5, styles$4.didCollapsed, shouldCollapse && answersDidCollapsed), _defineProperty(_ref5, styles$4.isPlaceholder, isPlaceholder), _defineProperty(_ref5, className, className !== null), _ref5)]),
|
|
168
167
|
ref: answerRef,
|
|
@@ -638,45 +637,60 @@ var QuizScreen = function QuizScreen(_ref) {
|
|
|
638
637
|
QuizScreen.propTypes = propTypes$3;
|
|
639
638
|
QuizScreen.defaultProps = defaultProps$3;
|
|
640
639
|
|
|
641
|
-
var styles$1 = {"container":"micromag-screen-quiz-title-container","emptyDescription":"micromag-screen-quiz-title-emptyDescription","emptyTitle":"micromag-screen-quiz-title-emptyTitle","title":"micromag-screen-quiz-title-title","isPlaceholder":"micromag-screen-quiz-title-isPlaceholder"};
|
|
640
|
+
var styles$1 = {"container":"micromag-screen-quiz-title-container","emptyDescription":"micromag-screen-quiz-title-emptyDescription","emptyTitle":"micromag-screen-quiz-title-emptyTitle","description":"micromag-screen-quiz-title-description","title":"micromag-screen-quiz-title-title","isPlaceholder":"micromag-screen-quiz-title-isPlaceholder"};
|
|
642
641
|
|
|
643
642
|
var propTypes$2 = {
|
|
644
643
|
title: PropTypes.textElement,
|
|
645
644
|
description: PropTypes.textElement,
|
|
645
|
+
button: PropTypes.textElement,
|
|
646
646
|
layout: PropTypes$1.string,
|
|
647
|
+
focusable: PropTypes$1.bool,
|
|
647
648
|
transitions: PropTypes.transitions,
|
|
648
649
|
transitionPlaying: PropTypes$1.bool,
|
|
649
650
|
transitionStagger: PropTypes$1.number,
|
|
650
651
|
transitionDisabled: PropTypes$1.bool,
|
|
651
652
|
className: PropTypes$1.string,
|
|
652
|
-
style: PropTypes$1.objectOf(PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.number]))
|
|
653
|
+
style: PropTypes$1.objectOf(PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.number])),
|
|
654
|
+
onClickButton: PropTypes$1.func
|
|
653
655
|
};
|
|
654
656
|
var defaultProps$2 = {
|
|
655
657
|
title: null,
|
|
656
658
|
description: null,
|
|
657
659
|
layout: null,
|
|
660
|
+
button: null,
|
|
661
|
+
focusable: false,
|
|
658
662
|
transitions: null,
|
|
659
663
|
transitionPlaying: false,
|
|
660
664
|
transitionStagger: 100,
|
|
661
665
|
transitionDisabled: false,
|
|
662
666
|
className: null,
|
|
663
|
-
style: null
|
|
667
|
+
style: null,
|
|
668
|
+
onClickButton: null
|
|
664
669
|
};
|
|
665
670
|
|
|
666
671
|
var Title = function Title(_ref) {
|
|
667
672
|
var layout = _ref.layout,
|
|
668
673
|
title = _ref.title,
|
|
669
674
|
description = _ref.description,
|
|
675
|
+
button = _ref.button,
|
|
676
|
+
focusable = _ref.focusable,
|
|
670
677
|
transitions = _ref.transitions,
|
|
671
678
|
transitionPlaying = _ref.transitionPlaying,
|
|
672
679
|
transitionStagger = _ref.transitionStagger,
|
|
673
680
|
transitionDisabled = _ref.transitionDisabled,
|
|
674
681
|
className = _ref.className,
|
|
675
|
-
style = _ref.style
|
|
682
|
+
style = _ref.style,
|
|
683
|
+
onClickButton = _ref.onClickButton;
|
|
684
|
+
|
|
685
|
+
var _useScreenRenderConte = useScreenRenderContext(),
|
|
686
|
+
isPreview = _useScreenRenderConte.isPreview,
|
|
687
|
+
isEdit = _useScreenRenderConte.isEdit;
|
|
688
|
+
|
|
676
689
|
var isSplitted = layout === 'split';
|
|
677
690
|
var verticalAlign = isSplitted ? null : layout;
|
|
678
691
|
var hasTitle = isTextFilled(title);
|
|
679
692
|
var hasDescription = isTextFilled(description);
|
|
693
|
+
var hasButton = isTextFilled(button);
|
|
680
694
|
return /*#__PURE__*/React.createElement(Layout, {
|
|
681
695
|
className: classNames([styles$1.container, _defineProperty({}, className, className !== null)]),
|
|
682
696
|
fullscreen: true,
|
|
@@ -700,9 +714,7 @@ var Title = function Title(_ref) {
|
|
|
700
714
|
disabled: transitionDisabled
|
|
701
715
|
}, /*#__PURE__*/React.createElement(Heading, Object.assign({}, title, {
|
|
702
716
|
className: styles$1.title
|
|
703
|
-
}))) : null),
|
|
704
|
-
key: "spacer"
|
|
705
|
-
}) : null, /*#__PURE__*/React.createElement(ScreenElement, {
|
|
717
|
+
}))) : null), /*#__PURE__*/React.createElement(ScreenElement, {
|
|
706
718
|
key: "description",
|
|
707
719
|
placeholder: "text",
|
|
708
720
|
emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
@@ -714,14 +726,38 @@ var Title = function Title(_ref) {
|
|
|
714
726
|
}),
|
|
715
727
|
emptyClassName: styles$1.emptyDescription,
|
|
716
728
|
isEmpty: !hasDescription
|
|
717
|
-
},
|
|
729
|
+
}, hasDescription ? /*#__PURE__*/React.createElement(Transitions, {
|
|
718
730
|
transitions: transitions,
|
|
719
731
|
playing: transitionPlaying,
|
|
720
732
|
disabled: transitionDisabled,
|
|
721
733
|
delay: transitionStagger
|
|
722
734
|
}, /*#__PURE__*/React.createElement(Text, Object.assign({}, description, {
|
|
723
735
|
className: styles$1.description
|
|
724
|
-
}))) : null)
|
|
736
|
+
}))) : null), isSplitted ? /*#__PURE__*/React.createElement(Spacer, {
|
|
737
|
+
key: "spacer"
|
|
738
|
+
}) : null, /*#__PURE__*/React.createElement(ScreenElement, {
|
|
739
|
+
key: "button",
|
|
740
|
+
placeholder: "button"
|
|
741
|
+
}, /*#__PURE__*/React.createElement(Transitions, {
|
|
742
|
+
transitions: transitions,
|
|
743
|
+
playing: transitionPlaying,
|
|
744
|
+
disabled: transitionDisabled,
|
|
745
|
+
delay: transitionStagger * 2
|
|
746
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
747
|
+
disabled: isPreview || isEdit,
|
|
748
|
+
focusable: focusable,
|
|
749
|
+
buttonStyle: button !== null ? button.buttonStyle : null,
|
|
750
|
+
className: styles$1.button,
|
|
751
|
+
onClick: onClickButton
|
|
752
|
+
}, hasButton ? /*#__PURE__*/React.createElement(Text, Object.assign({}, button, {
|
|
753
|
+
className: styles$1.label
|
|
754
|
+
})) : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
755
|
+
id: "D7LIZQ",
|
|
756
|
+
defaultMessage: [{
|
|
757
|
+
"type": 0,
|
|
758
|
+
"value": "Start"
|
|
759
|
+
}]
|
|
760
|
+
}))))]);
|
|
725
761
|
};
|
|
726
762
|
|
|
727
763
|
Title.propTypes = propTypes$2;
|
|
@@ -835,6 +871,7 @@ var propTypes = {
|
|
|
835
871
|
badAnswerColor: PropTypes.color,
|
|
836
872
|
spacing: PropTypes$1.number,
|
|
837
873
|
background: PropTypes.backgroundElement,
|
|
874
|
+
introButton: PropTypes.textElement,
|
|
838
875
|
introBackground: PropTypes.backgroundElement,
|
|
839
876
|
callToAction: PropTypes.callToAction,
|
|
840
877
|
current: PropTypes$1.bool,
|
|
@@ -857,6 +894,7 @@ var defaultProps = {
|
|
|
857
894
|
badAnswerColor: null,
|
|
858
895
|
spacing: 20,
|
|
859
896
|
background: null,
|
|
897
|
+
introButton: null,
|
|
860
898
|
introBackground: null,
|
|
861
899
|
callToAction: null,
|
|
862
900
|
current: true,
|
|
@@ -883,6 +921,7 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
883
921
|
spacing = _ref.spacing,
|
|
884
922
|
background = _ref.background,
|
|
885
923
|
introBackground = _ref.introBackground,
|
|
924
|
+
introButton = _ref.introButton,
|
|
886
925
|
callToAction = _ref.callToAction,
|
|
887
926
|
current = _ref.current,
|
|
888
927
|
active = _ref.active,
|
|
@@ -978,6 +1017,9 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
978
1017
|
setQuestionIndex('results');
|
|
979
1018
|
}
|
|
980
1019
|
}, [questions, questionIndex, setQuestionIndex]);
|
|
1020
|
+
var onClickIntroButton = useCallback(function () {
|
|
1021
|
+
setQuestionIndex(0);
|
|
1022
|
+
}, [setQuestionIndex]);
|
|
981
1023
|
useEffect(function () {
|
|
982
1024
|
if (!current && isEdit && userAnswers !== null) {
|
|
983
1025
|
setUserAnswers(null);
|
|
@@ -1136,6 +1178,8 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1136
1178
|
title: title,
|
|
1137
1179
|
description: description,
|
|
1138
1180
|
layout: introLayout || layout,
|
|
1181
|
+
button: introButton,
|
|
1182
|
+
focusable: current && isView,
|
|
1139
1183
|
transitions: transitions,
|
|
1140
1184
|
transitionPlaying: transitionPlaying,
|
|
1141
1185
|
transitionStagger: transitionStagger,
|
|
@@ -1144,7 +1188,8 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1144
1188
|
style: !isPlaceholder ? {
|
|
1145
1189
|
padding: spacing,
|
|
1146
1190
|
paddingTop: (menuOverScreen && !isPreview ? menuSize : 0) + spacing
|
|
1147
|
-
} : null
|
|
1191
|
+
} : null,
|
|
1192
|
+
onClickButton: onClickIntroButton
|
|
1148
1193
|
})) : null, isQuestion ? /*#__PURE__*/React.createElement(CSSTransition, {
|
|
1149
1194
|
key: "question-".concat(questionIndex),
|
|
1150
1195
|
classNames: styles$2,
|
|
@@ -1287,24 +1332,14 @@ var definition = [{
|
|
|
1287
1332
|
}),
|
|
1288
1333
|
fields: [{
|
|
1289
1334
|
name: 'buttonsStyle',
|
|
1290
|
-
type: '
|
|
1335
|
+
type: 'box-style-form',
|
|
1291
1336
|
label: defineMessage({
|
|
1292
1337
|
id: "l5uLMd",
|
|
1293
1338
|
defaultMessage: [{
|
|
1294
1339
|
"type": 0,
|
|
1295
1340
|
"value": "Buttons"
|
|
1296
1341
|
}]
|
|
1297
|
-
})
|
|
1298
|
-
noValueLabel: defineMessage({
|
|
1299
|
-
id: "65rc70",
|
|
1300
|
-
defaultMessage: [{
|
|
1301
|
-
"type": 0,
|
|
1302
|
-
"value": "Edit style..."
|
|
1303
|
-
}]
|
|
1304
|
-
}),
|
|
1305
|
-
field: {
|
|
1306
|
-
type: 'box-style'
|
|
1307
|
-
}
|
|
1342
|
+
})
|
|
1308
1343
|
}, {
|
|
1309
1344
|
name: 'goodAnswerColor',
|
|
1310
1345
|
type: 'color',
|
|
@@ -1414,6 +1449,19 @@ var definition = [{
|
|
|
1414
1449
|
"value": "Description"
|
|
1415
1450
|
}]
|
|
1416
1451
|
})
|
|
1452
|
+
}, {
|
|
1453
|
+
name: 'introButton',
|
|
1454
|
+
type: 'button-element',
|
|
1455
|
+
theme: {
|
|
1456
|
+
textStyle: 'button'
|
|
1457
|
+
},
|
|
1458
|
+
label: defineMessage({
|
|
1459
|
+
id: "i6bmbD",
|
|
1460
|
+
defaultMessage: [{
|
|
1461
|
+
"type": 0,
|
|
1462
|
+
"value": "Button"
|
|
1463
|
+
}]
|
|
1464
|
+
})
|
|
1417
1465
|
}, {
|
|
1418
1466
|
name: 'introBackground',
|
|
1419
1467
|
type: 'background',
|
|
@@ -1569,7 +1617,7 @@ var definition = [{
|
|
|
1569
1617
|
isList: true,
|
|
1570
1618
|
fields: [{
|
|
1571
1619
|
name: 'buttonsStyle',
|
|
1572
|
-
type: 'box-style',
|
|
1620
|
+
type: 'box-style-form',
|
|
1573
1621
|
label: defineMessage({
|
|
1574
1622
|
id: "l5uLMd",
|
|
1575
1623
|
defaultMessage: [{
|
package/lib/index.js
CHANGED
|
@@ -183,7 +183,6 @@ var Answers = function Answers(_ref) {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
}, [shouldCollapse, answersCollapsed, answersDidCollapsed, setAnswersCollapsed, onCollapsed, onTransitionEnd]);
|
|
186
|
-
console.log(items);
|
|
187
186
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
188
187
|
className: classNames__default["default"]([styles$4.container, (_ref5 = {}, _defineProperty__default["default"](_ref5, styles$4.answered, answered), _defineProperty__default["default"](_ref5, styles$4.withoutGoodAnswer, withoutGoodAnswer), _defineProperty__default["default"](_ref5, styles$4.withGoodAnswer, !withoutGoodAnswer), _defineProperty__default["default"](_ref5, styles$4.willCollapse, shouldCollapse && answersCollapsed), _defineProperty__default["default"](_ref5, styles$4.didCollapsed, shouldCollapse && answersDidCollapsed), _defineProperty__default["default"](_ref5, styles$4.isPlaceholder, isPlaceholder), _defineProperty__default["default"](_ref5, className, className !== null), _ref5)]),
|
|
189
188
|
ref: answerRef,
|
|
@@ -659,45 +658,60 @@ var QuizScreen = function QuizScreen(_ref) {
|
|
|
659
658
|
QuizScreen.propTypes = propTypes$3;
|
|
660
659
|
QuizScreen.defaultProps = defaultProps$3;
|
|
661
660
|
|
|
662
|
-
var styles$1 = {"container":"micromag-screen-quiz-title-container","emptyDescription":"micromag-screen-quiz-title-emptyDescription","emptyTitle":"micromag-screen-quiz-title-emptyTitle","title":"micromag-screen-quiz-title-title","isPlaceholder":"micromag-screen-quiz-title-isPlaceholder"};
|
|
661
|
+
var styles$1 = {"container":"micromag-screen-quiz-title-container","emptyDescription":"micromag-screen-quiz-title-emptyDescription","emptyTitle":"micromag-screen-quiz-title-emptyTitle","description":"micromag-screen-quiz-title-description","title":"micromag-screen-quiz-title-title","isPlaceholder":"micromag-screen-quiz-title-isPlaceholder"};
|
|
663
662
|
|
|
664
663
|
var propTypes$2 = {
|
|
665
664
|
title: core.PropTypes.textElement,
|
|
666
665
|
description: core.PropTypes.textElement,
|
|
666
|
+
button: core.PropTypes.textElement,
|
|
667
667
|
layout: PropTypes__default["default"].string,
|
|
668
|
+
focusable: PropTypes__default["default"].bool,
|
|
668
669
|
transitions: core.PropTypes.transitions,
|
|
669
670
|
transitionPlaying: PropTypes__default["default"].bool,
|
|
670
671
|
transitionStagger: PropTypes__default["default"].number,
|
|
671
672
|
transitionDisabled: PropTypes__default["default"].bool,
|
|
672
673
|
className: PropTypes__default["default"].string,
|
|
673
|
-
style: PropTypes__default["default"].objectOf(PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]))
|
|
674
|
+
style: PropTypes__default["default"].objectOf(PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number])),
|
|
675
|
+
onClickButton: PropTypes__default["default"].func
|
|
674
676
|
};
|
|
675
677
|
var defaultProps$2 = {
|
|
676
678
|
title: null,
|
|
677
679
|
description: null,
|
|
678
680
|
layout: null,
|
|
681
|
+
button: null,
|
|
682
|
+
focusable: false,
|
|
679
683
|
transitions: null,
|
|
680
684
|
transitionPlaying: false,
|
|
681
685
|
transitionStagger: 100,
|
|
682
686
|
transitionDisabled: false,
|
|
683
687
|
className: null,
|
|
684
|
-
style: null
|
|
688
|
+
style: null,
|
|
689
|
+
onClickButton: null
|
|
685
690
|
};
|
|
686
691
|
|
|
687
692
|
var Title = function Title(_ref) {
|
|
688
693
|
var layout = _ref.layout,
|
|
689
694
|
title = _ref.title,
|
|
690
695
|
description = _ref.description,
|
|
696
|
+
button = _ref.button,
|
|
697
|
+
focusable = _ref.focusable,
|
|
691
698
|
transitions = _ref.transitions,
|
|
692
699
|
transitionPlaying = _ref.transitionPlaying,
|
|
693
700
|
transitionStagger = _ref.transitionStagger,
|
|
694
701
|
transitionDisabled = _ref.transitionDisabled,
|
|
695
702
|
className = _ref.className,
|
|
696
|
-
style = _ref.style
|
|
703
|
+
style = _ref.style,
|
|
704
|
+
onClickButton = _ref.onClickButton;
|
|
705
|
+
|
|
706
|
+
var _useScreenRenderConte = contexts.useScreenRenderContext(),
|
|
707
|
+
isPreview = _useScreenRenderConte.isPreview,
|
|
708
|
+
isEdit = _useScreenRenderConte.isEdit;
|
|
709
|
+
|
|
697
710
|
var isSplitted = layout === 'split';
|
|
698
711
|
var verticalAlign = isSplitted ? null : layout;
|
|
699
712
|
var hasTitle = utils.isTextFilled(title);
|
|
700
713
|
var hasDescription = utils.isTextFilled(description);
|
|
714
|
+
var hasButton = utils.isTextFilled(button);
|
|
701
715
|
return /*#__PURE__*/React__default["default"].createElement(Layout__default["default"], {
|
|
702
716
|
className: classNames__default["default"]([styles$1.container, _defineProperty__default["default"]({}, className, className !== null)]),
|
|
703
717
|
fullscreen: true,
|
|
@@ -721,9 +735,7 @@ var Title = function Title(_ref) {
|
|
|
721
735
|
disabled: transitionDisabled
|
|
722
736
|
}, /*#__PURE__*/React__default["default"].createElement(Heading__default["default"], Object.assign({}, title, {
|
|
723
737
|
className: styles$1.title
|
|
724
|
-
}))) : null),
|
|
725
|
-
key: "spacer"
|
|
726
|
-
}) : null, /*#__PURE__*/React__default["default"].createElement(components.ScreenElement, {
|
|
738
|
+
}))) : null), /*#__PURE__*/React__default["default"].createElement(components.ScreenElement, {
|
|
727
739
|
key: "description",
|
|
728
740
|
placeholder: "text",
|
|
729
741
|
emptyLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
@@ -735,14 +747,38 @@ var Title = function Title(_ref) {
|
|
|
735
747
|
}),
|
|
736
748
|
emptyClassName: styles$1.emptyDescription,
|
|
737
749
|
isEmpty: !hasDescription
|
|
738
|
-
},
|
|
750
|
+
}, hasDescription ? /*#__PURE__*/React__default["default"].createElement(components.Transitions, {
|
|
739
751
|
transitions: transitions,
|
|
740
752
|
playing: transitionPlaying,
|
|
741
753
|
disabled: transitionDisabled,
|
|
742
754
|
delay: transitionStagger
|
|
743
755
|
}, /*#__PURE__*/React__default["default"].createElement(Text__default["default"], Object.assign({}, description, {
|
|
744
756
|
className: styles$1.description
|
|
745
|
-
}))) : null)]
|
|
757
|
+
}))) : null), isSplitted ? /*#__PURE__*/React__default["default"].createElement(Layout.Spacer, {
|
|
758
|
+
key: "spacer"
|
|
759
|
+
}) : null, /*#__PURE__*/React__default["default"].createElement(components.ScreenElement, {
|
|
760
|
+
key: "button",
|
|
761
|
+
placeholder: "button"
|
|
762
|
+
}, /*#__PURE__*/React__default["default"].createElement(components.Transitions, {
|
|
763
|
+
transitions: transitions,
|
|
764
|
+
playing: transitionPlaying,
|
|
765
|
+
disabled: transitionDisabled,
|
|
766
|
+
delay: transitionStagger * 2
|
|
767
|
+
}, /*#__PURE__*/React__default["default"].createElement(Button__default["default"], {
|
|
768
|
+
disabled: isPreview || isEdit,
|
|
769
|
+
focusable: focusable,
|
|
770
|
+
buttonStyle: button !== null ? button.buttonStyle : null,
|
|
771
|
+
className: styles$1.button,
|
|
772
|
+
onClick: onClickButton
|
|
773
|
+
}, hasButton ? /*#__PURE__*/React__default["default"].createElement(Text__default["default"], Object.assign({}, button, {
|
|
774
|
+
className: styles$1.label
|
|
775
|
+
})) : /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
776
|
+
id: "D7LIZQ",
|
|
777
|
+
defaultMessage: [{
|
|
778
|
+
"type": 0,
|
|
779
|
+
"value": "Start"
|
|
780
|
+
}]
|
|
781
|
+
}))))]);
|
|
746
782
|
};
|
|
747
783
|
|
|
748
784
|
Title.propTypes = propTypes$2;
|
|
@@ -856,6 +892,7 @@ var propTypes = {
|
|
|
856
892
|
badAnswerColor: core.PropTypes.color,
|
|
857
893
|
spacing: PropTypes__default["default"].number,
|
|
858
894
|
background: core.PropTypes.backgroundElement,
|
|
895
|
+
introButton: core.PropTypes.textElement,
|
|
859
896
|
introBackground: core.PropTypes.backgroundElement,
|
|
860
897
|
callToAction: core.PropTypes.callToAction,
|
|
861
898
|
current: PropTypes__default["default"].bool,
|
|
@@ -878,6 +915,7 @@ var defaultProps = {
|
|
|
878
915
|
badAnswerColor: null,
|
|
879
916
|
spacing: 20,
|
|
880
917
|
background: null,
|
|
918
|
+
introButton: null,
|
|
881
919
|
introBackground: null,
|
|
882
920
|
callToAction: null,
|
|
883
921
|
current: true,
|
|
@@ -904,6 +942,7 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
904
942
|
spacing = _ref.spacing,
|
|
905
943
|
background = _ref.background,
|
|
906
944
|
introBackground = _ref.introBackground,
|
|
945
|
+
introButton = _ref.introButton,
|
|
907
946
|
callToAction = _ref.callToAction,
|
|
908
947
|
current = _ref.current,
|
|
909
948
|
active = _ref.active,
|
|
@@ -999,6 +1038,9 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
999
1038
|
setQuestionIndex('results');
|
|
1000
1039
|
}
|
|
1001
1040
|
}, [questions, questionIndex, setQuestionIndex]);
|
|
1041
|
+
var onClickIntroButton = React.useCallback(function () {
|
|
1042
|
+
setQuestionIndex(0);
|
|
1043
|
+
}, [setQuestionIndex]);
|
|
1002
1044
|
React.useEffect(function () {
|
|
1003
1045
|
if (!current && isEdit && userAnswers !== null) {
|
|
1004
1046
|
setUserAnswers(null);
|
|
@@ -1157,6 +1199,8 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1157
1199
|
title: title,
|
|
1158
1200
|
description: description,
|
|
1159
1201
|
layout: introLayout || layout,
|
|
1202
|
+
button: introButton,
|
|
1203
|
+
focusable: current && isView,
|
|
1160
1204
|
transitions: transitions,
|
|
1161
1205
|
transitionPlaying: transitionPlaying,
|
|
1162
1206
|
transitionStagger: transitionStagger,
|
|
@@ -1165,7 +1209,8 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1165
1209
|
style: !isPlaceholder ? {
|
|
1166
1210
|
padding: spacing,
|
|
1167
1211
|
paddingTop: (menuOverScreen && !isPreview ? menuSize : 0) + spacing
|
|
1168
|
-
} : null
|
|
1212
|
+
} : null,
|
|
1213
|
+
onClickButton: onClickIntroButton
|
|
1169
1214
|
})) : null, isQuestion ? /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.CSSTransition, {
|
|
1170
1215
|
key: "question-".concat(questionIndex),
|
|
1171
1216
|
classNames: styles$2,
|
|
@@ -1308,24 +1353,14 @@ var definition = [{
|
|
|
1308
1353
|
}),
|
|
1309
1354
|
fields: [{
|
|
1310
1355
|
name: 'buttonsStyle',
|
|
1311
|
-
type: '
|
|
1356
|
+
type: 'box-style-form',
|
|
1312
1357
|
label: reactIntl.defineMessage({
|
|
1313
1358
|
id: "l5uLMd",
|
|
1314
1359
|
defaultMessage: [{
|
|
1315
1360
|
"type": 0,
|
|
1316
1361
|
"value": "Buttons"
|
|
1317
1362
|
}]
|
|
1318
|
-
})
|
|
1319
|
-
noValueLabel: reactIntl.defineMessage({
|
|
1320
|
-
id: "65rc70",
|
|
1321
|
-
defaultMessage: [{
|
|
1322
|
-
"type": 0,
|
|
1323
|
-
"value": "Edit style..."
|
|
1324
|
-
}]
|
|
1325
|
-
}),
|
|
1326
|
-
field: {
|
|
1327
|
-
type: 'box-style'
|
|
1328
|
-
}
|
|
1363
|
+
})
|
|
1329
1364
|
}, {
|
|
1330
1365
|
name: 'goodAnswerColor',
|
|
1331
1366
|
type: 'color',
|
|
@@ -1435,6 +1470,19 @@ var definition = [{
|
|
|
1435
1470
|
"value": "Description"
|
|
1436
1471
|
}]
|
|
1437
1472
|
})
|
|
1473
|
+
}, {
|
|
1474
|
+
name: 'introButton',
|
|
1475
|
+
type: 'button-element',
|
|
1476
|
+
theme: {
|
|
1477
|
+
textStyle: 'button'
|
|
1478
|
+
},
|
|
1479
|
+
label: reactIntl.defineMessage({
|
|
1480
|
+
id: "i6bmbD",
|
|
1481
|
+
defaultMessage: [{
|
|
1482
|
+
"type": 0,
|
|
1483
|
+
"value": "Button"
|
|
1484
|
+
}]
|
|
1485
|
+
})
|
|
1438
1486
|
}, {
|
|
1439
1487
|
name: 'introBackground',
|
|
1440
1488
|
type: 'background',
|
|
@@ -1590,7 +1638,7 @@ var definition = [{
|
|
|
1590
1638
|
isList: true,
|
|
1591
1639
|
fields: [{
|
|
1592
1640
|
name: 'buttonsStyle',
|
|
1593
|
-
type: 'box-style',
|
|
1641
|
+
type: 'box-style-form',
|
|
1594
1642
|
label: reactIntl.defineMessage({
|
|
1595
1643
|
id: "l5uLMd",
|
|
1596
1644
|
defaultMessage: [{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-quiz",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
|
53
53
|
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
|
54
54
|
"@fortawesome/react-fontawesome": "^0.1.13",
|
|
55
|
-
"@micromag/core": "^0.3.
|
|
56
|
-
"@micromag/data": "^0.3.
|
|
57
|
-
"@micromag/element-background": "^0.3.
|
|
58
|
-
"@micromag/element-button": "^0.3.
|
|
59
|
-
"@micromag/element-call-to-action": "^0.3.
|
|
60
|
-
"@micromag/element-container": "^0.3.
|
|
61
|
-
"@micromag/element-heading": "^0.3.
|
|
62
|
-
"@micromag/element-layout": "^0.3.
|
|
63
|
-
"@micromag/element-text": "^0.3.
|
|
64
|
-
"@micromag/transforms": "^0.3.
|
|
55
|
+
"@micromag/core": "^0.3.11",
|
|
56
|
+
"@micromag/data": "^0.3.11",
|
|
57
|
+
"@micromag/element-background": "^0.3.11",
|
|
58
|
+
"@micromag/element-button": "^0.3.11",
|
|
59
|
+
"@micromag/element-call-to-action": "^0.3.11",
|
|
60
|
+
"@micromag/element-container": "^0.3.11",
|
|
61
|
+
"@micromag/element-heading": "^0.3.11",
|
|
62
|
+
"@micromag/element-layout": "^0.3.11",
|
|
63
|
+
"@micromag/element-text": "^0.3.11",
|
|
64
|
+
"@micromag/transforms": "^0.3.11",
|
|
65
65
|
"classnames": "^2.2.6",
|
|
66
66
|
"lodash": "^4.17.21",
|
|
67
67
|
"prop-types": "^15.7.2",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "4baa4392185262ac19705bab9f21d4623a975249"
|
|
76
76
|
}
|