@gamelearn/arcade-components 2.41.1 → 3.0.1
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 +8 -5
- package/dist/arcade-components.cjs +91984 -0
- package/dist/arcade-components.js +91968 -0
- package/package.json +74 -73
- package/dist/components/animation-component/components/AnimationComponent.js +0 -98
- package/dist/components/animation-component/index.js +0 -10
- package/dist/components/animation-component/mocks/mockForStory.js +0 -26
- package/dist/components/auto-evaluation-component/components/AutoEvaluation.js +0 -215
- package/dist/components/auto-evaluation-component/components/EndScreen.js +0 -43
- package/dist/components/auto-evaluation-component/components/StartScreen.js +0 -32
- package/dist/components/auto-evaluation-component/index.js +0 -10
- package/dist/components/auto-evaluation-component/mocks/mockForStory.js +0 -38
- package/dist/components/cards-selector-puzzle-component/components/Board/index.js +0 -159
- package/dist/components/cards-selector-puzzle-component/components/Card/index.js +0 -115
- package/dist/components/cards-selector-puzzle-component/components/CardsSelectorPuzzleComponent.js +0 -289
- package/dist/components/cards-selector-puzzle-component/index.js +0 -10
- package/dist/components/cards-selector-puzzle-component/mocks/mockForStory.js +0 -446
- package/dist/components/cartel-component/components/CartelComponent.js +0 -124
- package/dist/components/cartel-component/index.js +0 -10
- package/dist/components/chained-image-click-puzzle-component/components/ChainedImageClickPuzzleComponent.js +0 -80
- package/dist/components/chained-image-click-puzzle-component/components/CurrentImagePuzzle.js +0 -182
- package/dist/components/chained-image-click-puzzle-component/index.js +0 -10
- package/dist/components/chained-image-click-puzzle-component/mocks/mockForStory.js +0 -413
- package/dist/components/comic-component/components/ComicComponent.js +0 -201
- package/dist/components/comic-component/components/Slide.js +0 -31
- package/dist/components/comic-component/components/Vignette.js +0 -70
- package/dist/components/comic-component/index.js +0 -10
- package/dist/components/comic-component/mocks/mockForStory.js +0 -314
- package/dist/components/conversational-component/components/ConversationalComponent.js +0 -101
- package/dist/components/conversational-component/index.js +0 -10
- package/dist/components/conversational-pro-component/components/ConversationalProComponent.js +0 -543
- package/dist/components/conversational-pro-component/components/Message.js +0 -37
- package/dist/components/conversational-pro-component/components/Slot.js +0 -92
- package/dist/components/conversational-pro-component/components/SlotList.js +0 -162
- package/dist/components/conversational-pro-component/components/scene/Panel.js +0 -179
- package/dist/components/conversational-pro-component/components/scene/Panels.js +0 -46
- package/dist/components/conversational-pro-component/components/scene/index.js +0 -77
- package/dist/components/conversational-pro-component/index.js +0 -10
- package/dist/components/conversational-pro-component/mocks/mockForStory.js +0 -1529
- package/dist/components/cracker-puzzle-component/components/CrackerPuzzleComponent.js +0 -261
- package/dist/components/cracker-puzzle-component/components/DrawGrid/index.js +0 -33
- package/dist/components/cracker-puzzle-component/components/DrawItem/index.js +0 -48
- package/dist/components/cracker-puzzle-component/components/DrawRow/index.js +0 -43
- package/dist/components/cracker-puzzle-component/components/colors.js +0 -12
- package/dist/components/cracker-puzzle-component/components/helpers.js +0 -133
- package/dist/components/cracker-puzzle-component/index.js +0 -10
- package/dist/components/cracker-puzzle-component/mocks/mockForStory.js +0 -277
- package/dist/components/decision-component/components/DecisionBody.js +0 -116
- package/dist/components/decision-component/components/DecisionComponent.js +0 -248
- package/dist/components/decision-component/components/Feedback.js +0 -40
- package/dist/components/decision-component/components/Options.js +0 -74
- package/dist/components/decision-component/index.js +0 -10
- package/dist/components/decision-component/mocks/mockForStory.js +0 -166
- package/dist/components/dialog-component/components/BubbleWrapper.js +0 -39
- package/dist/components/dialog-component/components/DialogComponent.js +0 -779
- package/dist/components/dialog-component/components/DialogDecision.js +0 -44
- package/dist/components/dialog-component/components/SpeechBubbleComponent.js +0 -66
- package/dist/components/dialog-component/index.js +0 -10
- package/dist/components/dialog-component/mocks/mockForStory.js +0 -550
- package/dist/components/drag-item-puzzle-component/components/DragItemPuzzleComponent.js +0 -361
- package/dist/components/drag-item-puzzle-component/index.js +0 -10
- package/dist/components/drag-item-puzzle-component/mocks/mockForStory.js +0 -74
- package/dist/components/feedback-component/components/FeedbackComponent.js +0 -126
- package/dist/components/feedback-component/index.js +0 -10
- package/dist/components/feedback-component/mocks/mockForStory.js +0 -52
- package/dist/components/frame-click-puzzle-component/components/Counter/index.js +0 -24
- package/dist/components/frame-click-puzzle-component/components/CurrentFramePuzzle.js +0 -196
- package/dist/components/frame-click-puzzle-component/components/FrameClickPuzzleComponent.js +0 -178
- package/dist/components/frame-click-puzzle-component/components/Tooltip/index.js +0 -23
- package/dist/components/frame-click-puzzle-component/index.js +0 -10
- package/dist/components/frame-click-puzzle-component/mocks/mockForStory.js +0 -717
- package/dist/components/hacker-puzzle-component/components/HackerPuzzleComponent.js +0 -255
- package/dist/components/hacker-puzzle-component/components/languages.js +0 -13
- package/dist/components/hacker-puzzle-component/index.js +0 -10
- package/dist/components/hacker-puzzle-component/mocks/mockForStory.js +0 -103
- package/dist/components/hanged-puzzle-component/components/HangedPuzzleComponent.js +0 -488
- package/dist/components/hanged-puzzle-component/index.js +0 -10
- package/dist/components/hanged-puzzle-component/mocks/mockForStory.js +0 -61
- package/dist/components/hanged-puzzle-component/utils.js +0 -64
- package/dist/components/image-click-puzzle-component/components/ImageClickPuzzleComponent.js +0 -40
- package/dist/components/image-click-puzzle-component/index.js +0 -10
- package/dist/components/image-click-puzzle-component/mocks/mockForStory.js +0 -427
- package/dist/components/image-click-wrapper-component/components/CountDown/index.js +0 -18
- package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js +0 -472
- package/dist/components/image-click-wrapper-component/components/TimerDialog/index.js +0 -26
- package/dist/components/image-click-wrapper-component/index.js +0 -10
- package/dist/components/image-click-wrapper-component/mocks/mockForStory.js +0 -432
- package/dist/components/image-component/components/ImageComponent.js +0 -83
- package/dist/components/image-component/index.js +0 -10
- package/dist/components/image-component/mocks/mockForStory.js +0 -52
- package/dist/components/index.js +0 -260
- package/dist/components/inventory-item/components/InventoryItem.js +0 -120
- package/dist/components/inventory-item/index.js +0 -10
- package/dist/components/inventory-item/mocks/mockForStory.js +0 -29
- package/dist/components/keyboard-puzzle-component/components/KeyboardPuzzleComponent.js +0 -275
- package/dist/components/keyboard-puzzle-component/index.js +0 -10
- package/dist/components/keyboard-puzzle-component/mocks/mockForStory.js +0 -40
- package/dist/components/konva-components/Area/index.js +0 -170
- package/dist/components/konva-components/KonvaMapper.js +0 -185
- package/dist/components/lectures-component/components/LectureButtons.js +0 -40
- package/dist/components/lectures-component/components/LecturesComponent.js +0 -157
- package/dist/components/lectures-component/index.js +0 -10
- package/dist/components/lectures-component/mocks/mockForStory.js +0 -39
- package/dist/components/login-puzzle-component/components/LoginPuzzleComponent.js +0 -243
- package/dist/components/login-puzzle-component/index.js +0 -10
- package/dist/components/login-puzzle-component/mocks/mockForStory.js +0 -38
- package/dist/components/notice-component/components/NoticeComponent.js +0 -96
- package/dist/components/notice-component/index.js +0 -10
- package/dist/components/notice-component/mocks/mockForStory.js +0 -20
- package/dist/components/pattern-component/components/PatternComponent.js +0 -78
- package/dist/components/pattern-component/index.js +0 -10
- package/dist/components/pattern-component/mocks/mockForStory.js +0 -35
- package/dist/components/pdf-component/components/PdfComponent.js +0 -122
- package/dist/components/pdf-component/components/PdfVisor.js +0 -187
- package/dist/components/pdf-component/index.js +0 -20
- package/dist/components/pdf-component/mocks/mockForProps.js +0 -38
- package/dist/components/referral-component/components/EmailPill.js +0 -26
- package/dist/components/referral-component/components/ReferralComponent.js +0 -115
- package/dist/components/referral-component/components/StepOne.js +0 -170
- package/dist/components/referral-component/components/StepTwo.js +0 -57
- package/dist/components/referral-component/index.js +0 -10
- package/dist/components/referral-component/mocks/mockForStory.js +0 -40
- package/dist/components/survey-component/components/ApplicableBox.js +0 -49
- package/dist/components/survey-component/components/OpinionBox.js +0 -45
- package/dist/components/survey-component/components/SurveyComponent.js +0 -150
- package/dist/components/survey-component/components/TextBox.js +0 -40
- package/dist/components/survey-component/index.js +0 -10
- package/dist/components/survey-component/mocks/mockForStory.js +0 -14
- package/dist/components/terminal-puzzle-component/components/FilesGroup/Item.js +0 -28
- package/dist/components/terminal-puzzle-component/components/FilesGroup/index.js +0 -76
- package/dist/components/terminal-puzzle-component/components/Image/index.js +0 -22
- package/dist/components/terminal-puzzle-component/components/TerminalPuzzleComponent.js +0 -216
- package/dist/components/terminal-puzzle-component/components/Visor/index.js +0 -129
- package/dist/components/terminal-puzzle-component/components/utils/index.js +0 -26
- package/dist/components/terminal-puzzle-component/index.js +0 -10
- package/dist/components/terminal-puzzle-component/mocks/mockForStory.js +0 -188
- package/dist/components/test-component/components/Container.js +0 -211
- package/dist/components/test-component/components/Feedbacks.js +0 -48
- package/dist/components/test-component/components/Questions.js +0 -145
- package/dist/components/test-component/components/Results.js +0 -208
- package/dist/components/test-component/components/TestComponent.js +0 -302
- package/dist/components/test-component/index.js +0 -10
- package/dist/components/test-component/mocks/mockForStory.js +0 -113
- package/dist/components/text-click-puzzle-component/components/TextClickPuzzleComponent.js +0 -387
- package/dist/components/text-click-puzzle-component/index.js +0 -10
- package/dist/components/text-click-puzzle-component/mocks/mockForStory.js +0 -485
- package/dist/components/text-click-puzzle-component/utils/index.js +0 -76
- package/dist/components/url-component/components/UrlComponent.js +0 -88
- package/dist/components/url-component/index.js +0 -10
- package/dist/components/url-component/mocks/mockForProps.js +0 -20
- package/dist/components/video-component/components/VideoComponent.js +0 -73
- package/dist/components/video-component/index.js +0 -10
- package/dist/components/video-component/mocks/mockForStory.js +0 -94
- package/dist/components/video-visor/components/VideoControllers/BufferBar.js +0 -108
- package/dist/components/video-visor/components/VideoControllers/ControlButtons.js +0 -31
- package/dist/components/video-visor/components/VideoControllers/FinishedVideoButtons.js +0 -32
- package/dist/components/video-visor/components/VideoControllers/PlayInitButton.js +0 -37
- package/dist/components/video-visor/components/VideoControllers/SkipButton.js +0 -37
- package/dist/components/video-visor/components/VideoControllers/Timer.js +0 -37
- package/dist/components/video-visor/components/VideoControllers/VolumeBar.js +0 -92
- package/dist/components/video-visor/components/VideoControllers/index.js +0 -122
- package/dist/components/video-visor/components/VideoVisor.js +0 -271
- package/dist/components/video-visor/index.js +0 -10
- package/dist/components/video-visor/mocks/mockForStory.js +0 -42
- package/dist/components/web-builder-puzzle-component/Popups/PopupColorComponent/index.js +0 -87
- package/dist/components/web-builder-puzzle-component/Popups/PopupImageComponent/index.js +0 -94
- package/dist/components/web-builder-puzzle-component/Popups/PopupTextComponent/index.js +0 -114
- package/dist/components/web-builder-puzzle-component/Popups/index.js +0 -27
- package/dist/components/web-builder-puzzle-component/Templates/Bank.js +0 -98
- package/dist/components/web-builder-puzzle-component/Templates/Facebook.js +0 -37
- package/dist/components/web-builder-puzzle-component/Templates/resourcePath.js +0 -9
- package/dist/components/web-builder-puzzle-component/components/EditButton/index.js +0 -28
- package/dist/components/web-builder-puzzle-component/components/Feedback/index.js +0 -41
- package/dist/components/web-builder-puzzle-component/components/PublishButton/index.js +0 -29
- package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/BankBody.js +0 -118
- package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/FacebookBody.js +0 -149
- package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/index.js +0 -25
- package/dist/components/web-builder-puzzle-component/components/WebBuilderFront/index.js +0 -89
- package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/BankHeader.js +0 -84
- package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/FacebookHeader.js +0 -38
- package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/index.js +0 -40
- package/dist/components/web-builder-puzzle-component/components/WebBuilderPuzzleComponent.js +0 -302
- package/dist/components/web-builder-puzzle-component/components/WebBuilderTopBar/index.js +0 -30
- package/dist/components/web-builder-puzzle-component/index.js +0 -10
- package/dist/components/web-builder-puzzle-component/mocks/mockForStory.js +0 -27
- package/dist/components/writer-puzzle-component/components/ElectionComponent.js +0 -69
- package/dist/components/writer-puzzle-component/components/FeedbackComponent.js +0 -97
- package/dist/components/writer-puzzle-component/components/FeedbackElement.js +0 -32
- package/dist/components/writer-puzzle-component/components/FinishedTextComponent.js +0 -25
- package/dist/components/writer-puzzle-component/components/FixedComponent.js +0 -120
- package/dist/components/writer-puzzle-component/components/SingleElection.js +0 -85
- package/dist/components/writer-puzzle-component/components/WriterPuzzleComponent.js +0 -450
- package/dist/components/writer-puzzle-component/index.js +0 -10
- package/dist/components/writer-puzzle-component/mocks/mockForStory.js +0 -1194
- package/dist/components/zoom-test/components/ZoomTest.js +0 -73
- package/dist/components/zoom-test/index.js +0 -10
- package/dist/components/zoom-test/mocks/mockForStory.js +0 -21
- package/dist/helpers/LangIsRtl.js +0 -16
- package/dist/helpers/LightSet.js +0 -35
- package/dist/helpers/LodController.js +0 -28
- package/dist/helpers/deviceDetection.js +0 -21
- package/dist/helpers/drawLOD.js +0 -310
- package/dist/helpers/index.js +0 -268
- package/dist/helpers/lodStats.js +0 -55
- package/dist/helpers/mocker.js +0 -116
- package/dist/helpers/useEkho.js +0 -172
- package/dist/helpers/useGLB.js +0 -57
- package/dist/helpers/useStateMachine.js +0 -277
- package/dist/helpers/useTimeout.js +0 -32
- package/dist/helpers/useWindowSize.js +0 -44
- package/dist/index.js +0 -16
- package/dist/test/testSceneWrapper.js +0 -31
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _SingleElection = _interopRequireDefault(require("./SingleElection"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
18
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /* eslint-disable react/no-array-index-key */
|
|
19
|
-
var SingleElectionRender = function SingleElectionRender(_ref) {
|
|
20
|
-
var decisionInspected = _ref.decisionInspected,
|
|
21
|
-
opt = _ref.opt,
|
|
22
|
-
index = _ref.index,
|
|
23
|
-
setCurrentDecisionSelected = _ref.setCurrentDecisionSelected,
|
|
24
|
-
setCurrentDecisionInspected = _ref.setCurrentDecisionInspected,
|
|
25
|
-
soundActions = _ref.soundActions;
|
|
26
|
-
return opt && opt.fullText && opt.fullText !== '' ? /*#__PURE__*/_react.default.createElement(_SingleElection.default, {
|
|
27
|
-
decisionInspected: decisionInspected,
|
|
28
|
-
setCurrentDecisionSelected: setCurrentDecisionSelected,
|
|
29
|
-
setCurrentDecisionInspected: setCurrentDecisionInspected,
|
|
30
|
-
option: opt,
|
|
31
|
-
soundActions: soundActions,
|
|
32
|
-
index: index
|
|
33
|
-
}) : null;
|
|
34
|
-
};
|
|
35
|
-
var ElectionComponent = function ElectionComponent(_ref2) {
|
|
36
|
-
var textWithOpts = _ref2.textWithOpts,
|
|
37
|
-
setCurrentDecisionSelected = _ref2.setCurrentDecisionSelected,
|
|
38
|
-
printed = _ref2.printed,
|
|
39
|
-
soundActions = _ref2.soundActions;
|
|
40
|
-
var _useState = (0, _react.useState)(''),
|
|
41
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
42
|
-
decisionInspected = _useState2[0],
|
|
43
|
-
setCurrentDecisionInspected = _useState2[1];
|
|
44
|
-
(0, _react.useEffect)(function () {
|
|
45
|
-
printed();
|
|
46
|
-
}, [printed]);
|
|
47
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
48
|
-
className: "elections-box pos".concat(decisionInspected + 1, "-").concat(textWithOpts.filter(function (text) {
|
|
49
|
-
return !!text.fullText;
|
|
50
|
-
}).length)
|
|
51
|
-
}, textWithOpts && textWithOpts.map(function (opt, index) {
|
|
52
|
-
return /*#__PURE__*/_react.default.createElement(SingleElectionRender, {
|
|
53
|
-
opt: opt,
|
|
54
|
-
soundActions: soundActions,
|
|
55
|
-
index: index,
|
|
56
|
-
key: index,
|
|
57
|
-
setCurrentDecisionSelected: setCurrentDecisionSelected,
|
|
58
|
-
setCurrentDecisionInspected: setCurrentDecisionInspected,
|
|
59
|
-
decisionInspected: decisionInspected
|
|
60
|
-
});
|
|
61
|
-
}));
|
|
62
|
-
};
|
|
63
|
-
ElectionComponent.defaultProps = {
|
|
64
|
-
textWithOpts: [],
|
|
65
|
-
setCurrentDecisionSelected: function setCurrentDecisionSelected() {},
|
|
66
|
-
printed: function printed() {}
|
|
67
|
-
};
|
|
68
|
-
var _default = ElectionComponent;
|
|
69
|
-
exports.default = _default;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _FeedbackElement = _interopRequireDefault(require("./FeedbackElement"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
var FeedbackComponent = function FeedbackComponent(_ref) {
|
|
17
|
-
var emitEvent = _ref.emitEvent,
|
|
18
|
-
closingAction = _ref.closingAction,
|
|
19
|
-
feedbackIsDone = _ref.feedbackIsDone,
|
|
20
|
-
decisionsList = _ref.decisionsList,
|
|
21
|
-
texts = _ref.texts,
|
|
22
|
-
retryAction = _ref.retryAction,
|
|
23
|
-
retry = _ref.retry,
|
|
24
|
-
skip = _ref.skip,
|
|
25
|
-
checkCorrect = _ref.checkCorrect,
|
|
26
|
-
rewardsStack = _ref.rewardsStack,
|
|
27
|
-
setFailed = _ref.setFailed,
|
|
28
|
-
soundActions = _ref.soundActions;
|
|
29
|
-
var _soundActions = _slicedToArray(soundActions, 1),
|
|
30
|
-
playSound = _soundActions[0];
|
|
31
|
-
var translate = function translate(id) {
|
|
32
|
-
return emitEvent({
|
|
33
|
-
type: 'translate',
|
|
34
|
-
payload: id
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
var close = function close() {
|
|
38
|
-
playSound('click-ui');
|
|
39
|
-
closingAction();
|
|
40
|
-
setFailed();
|
|
41
|
-
feedbackIsDone();
|
|
42
|
-
};
|
|
43
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
44
|
-
className: "writer-feedback ".concat(!rewardsStack.length ? 'start' : '')
|
|
45
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
46
|
-
className: "writer-feedback__title"
|
|
47
|
-
}, translate('puzzles.feedback')), /*#__PURE__*/_react.default.createElement("div", {
|
|
48
|
-
className: "writer-feedback__decisions"
|
|
49
|
-
}, decisionsList.map(function (decision) {
|
|
50
|
-
if (texts[decision.currenTextParagraph].electionTexts[decision.index].feedback.body) {
|
|
51
|
-
return /*#__PURE__*/_react.default.createElement(_FeedbackElement.default, {
|
|
52
|
-
decision: texts[decision.currenTextParagraph].electionTexts[decision.index],
|
|
53
|
-
key: decision.index
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return null;
|
|
57
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
58
|
-
className: "writer-feedback__btns"
|
|
59
|
-
}, skip && /*#__PURE__*/_react.default.createElement("button", {
|
|
60
|
-
type: "button",
|
|
61
|
-
className: "gat--btn gat--btn__secondary writer-feedback__btn-mobile",
|
|
62
|
-
onClick: function onClick() {
|
|
63
|
-
close();
|
|
64
|
-
}
|
|
65
|
-
}, translate('puzzles.skip')), retry && /*#__PURE__*/_react.default.createElement("button", {
|
|
66
|
-
type: "button",
|
|
67
|
-
className: "gat--btn gat--btn__primary writer-feedback__btn-mobile",
|
|
68
|
-
onClick: function onClick() {
|
|
69
|
-
if (checkCorrect()) {
|
|
70
|
-
close();
|
|
71
|
-
} else {
|
|
72
|
-
playSound('click-ui');
|
|
73
|
-
retryAction();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}, translate(checkCorrect() ? 'puzzles.continue' : 'puzzles.retry')), !retry && /*#__PURE__*/_react.default.createElement("button", {
|
|
77
|
-
type: "button",
|
|
78
|
-
className: "gat--btn gat--btn__primary writer-feedback__btn-mobile",
|
|
79
|
-
onClick: function onClick() {
|
|
80
|
-
return close();
|
|
81
|
-
}
|
|
82
|
-
}, translate('puzzles.continue'))));
|
|
83
|
-
};
|
|
84
|
-
FeedbackComponent.defaultProps = {
|
|
85
|
-
emitEvent: function emitEvent() {},
|
|
86
|
-
closingAction: function closingAction() {},
|
|
87
|
-
feedbackIsDone: function feedbackIsDone() {},
|
|
88
|
-
decisionsList: [],
|
|
89
|
-
texts: [],
|
|
90
|
-
retryAction: function retryAction() {},
|
|
91
|
-
retry: false,
|
|
92
|
-
skip: false,
|
|
93
|
-
checkCorrect: function checkCorrect() {},
|
|
94
|
-
nodeId: '0'
|
|
95
|
-
};
|
|
96
|
-
var _default = FeedbackComponent;
|
|
97
|
-
exports.default = _default;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var FeedbackElement = function FeedbackElement(_ref) {
|
|
10
|
-
var decision = _ref.decision;
|
|
11
|
-
var _decision$feedback = decision.feedback,
|
|
12
|
-
title = _decision$feedback.title,
|
|
13
|
-
body = _decision$feedback.body;
|
|
14
|
-
return /*#__PURE__*/_react.default.createElement("div", null, body !== '' && /*#__PURE__*/_react.default.createElement("div", {
|
|
15
|
-
className: "writer-feedback-decision-item"
|
|
16
|
-
}, title && /*#__PURE__*/_react.default.createElement("div", {
|
|
17
|
-
dir: "auto",
|
|
18
|
-
className: "writer-feedback-decision-item__title"
|
|
19
|
-
}, title, ' '), body && /*#__PURE__*/_react.default.createElement("div", {
|
|
20
|
-
dir: "auto",
|
|
21
|
-
className: "writer-feedback-decision-item__message"
|
|
22
|
-
}, decision.correct ? /*#__PURE__*/_react.default.createElement("span", {
|
|
23
|
-
className: "icon-check-circle-black color--success"
|
|
24
|
-
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
25
|
-
className: "icon-error-circle-black color--error"
|
|
26
|
-
}), /*#__PURE__*/_react.default.createElement("span", null, body))));
|
|
27
|
-
};
|
|
28
|
-
FeedbackElement.defaultProps = {
|
|
29
|
-
decision: {}
|
|
30
|
-
};
|
|
31
|
-
var _default = FeedbackElement;
|
|
32
|
-
exports.default = _default;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
var FinishedTextComponent = function FinishedTextComponent(_ref) {
|
|
11
|
-
var textToPrint = _ref.textToPrint,
|
|
12
|
-
correct = _ref.correct;
|
|
13
|
-
var splittedText = textToPrint.split('<p>');
|
|
14
|
-
splittedText.shift();
|
|
15
|
-
var hasMultipleP = splittedText.length > 1;
|
|
16
|
-
return /*#__PURE__*/_react.default.createElement("span", {
|
|
17
|
-
className: "writer-inline ".concat(hasMultipleP ? 'multiple' : '', " ").concat(correct)
|
|
18
|
-
}, (0, _htmlReactParser.default)(textToPrint));
|
|
19
|
-
};
|
|
20
|
-
FinishedTextComponent.defaultProps = {
|
|
21
|
-
correct: '',
|
|
22
|
-
textToPrint: ''
|
|
23
|
-
};
|
|
24
|
-
var _default = FinishedTextComponent;
|
|
25
|
-
exports.default = _default;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _reactTypist = _interopRequireDefault(require("react-typist"));
|
|
10
|
-
var _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
15
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
17
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
18
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
22
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
23
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
-
var Fakecursor = function Fakecursor() {
|
|
25
|
-
return /*#__PURE__*/_react.default.createElement("span", {
|
|
26
|
-
className: "fakecursor"
|
|
27
|
-
}, "|");
|
|
28
|
-
};
|
|
29
|
-
var FixedComponent = function FixedComponent(_ref) {
|
|
30
|
-
var delay = _ref.delay,
|
|
31
|
-
index = _ref.index,
|
|
32
|
-
length = _ref.length,
|
|
33
|
-
textToPrint = _ref.textToPrint,
|
|
34
|
-
setDoneTyping = _ref.setDoneTyping,
|
|
35
|
-
nextParagraphType = _ref.nextParagraphType,
|
|
36
|
-
isWriting = _ref.isWriting;
|
|
37
|
-
var _useState = (0, _react.useState)(true),
|
|
38
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
-
isWritingLetters = _useState2[0],
|
|
40
|
-
setIsWritingLetters = _useState2[1];
|
|
41
|
-
var _useState3 = (0, _react.useState)(''),
|
|
42
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
|
-
newtext = _useState4[0],
|
|
44
|
-
setNewText = _useState4[1];
|
|
45
|
-
var _useState5 = (0, _react.useState)(false),
|
|
46
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
47
|
-
isLast = _useState6[0],
|
|
48
|
-
setIsLast = _useState6[1];
|
|
49
|
-
(0, _react.useEffect)(function () {
|
|
50
|
-
setIsLast(index === length - 1);
|
|
51
|
-
}, [index, length]);
|
|
52
|
-
var stripHtmlTags = function stripHtmlTags(str) {
|
|
53
|
-
if (!str || !str.length) return '';
|
|
54
|
-
var strTemp = str.replace(/<script.*?>.*?<\/script>/gim, '');
|
|
55
|
-
var tmp = document.createElement('DIV');
|
|
56
|
-
tmp.innerHTML = strTemp;
|
|
57
|
-
return tmp.textContent || tmp.innerText || '';
|
|
58
|
-
};
|
|
59
|
-
(0, _react.useEffect)(function () {
|
|
60
|
-
var separateTextAndMarkIt = function separateTextAndMarkIt() {
|
|
61
|
-
var arrayWords = textToPrint.trim().split(' ');
|
|
62
|
-
var last = replaceLastWordHtml(arrayWords, arrayWords.length - 1);
|
|
63
|
-
return last.join(' ');
|
|
64
|
-
};
|
|
65
|
-
var replaceLastWordHtml = function replaceLastWordHtml(arrayWords, indexWord) {
|
|
66
|
-
if (indexWord < 0) return [''];
|
|
67
|
-
var arrayCopy = _toConsumableArray(arrayWords);
|
|
68
|
-
if (stripHtmlTags(arrayWords[indexWord]).length !== 0) {
|
|
69
|
-
var lastWord = arrayWords[indexWord];
|
|
70
|
-
arrayCopy[indexWord] = "<span class=\"lastWord\" >".concat(lastWord, "</span>");
|
|
71
|
-
return arrayCopy;
|
|
72
|
-
}
|
|
73
|
-
return replaceLastWordHtml(arrayWords, indexWord - 1);
|
|
74
|
-
};
|
|
75
|
-
if (nextParagraphType === 'election') {
|
|
76
|
-
setNewText(separateTextAndMarkIt());
|
|
77
|
-
} else {
|
|
78
|
-
setTimeout(function () {
|
|
79
|
-
setNewText(textToPrint);
|
|
80
|
-
}, 200);
|
|
81
|
-
}
|
|
82
|
-
}, [nextParagraphType, textToPrint]);
|
|
83
|
-
var typingDone = function typingDone() {
|
|
84
|
-
setDoneTyping(true);
|
|
85
|
-
setIsWritingLetters(false);
|
|
86
|
-
};
|
|
87
|
-
var splittedText = textToPrint.split('<p>');
|
|
88
|
-
splittedText.shift();
|
|
89
|
-
var hasMultipleP = splittedText.length > 1;
|
|
90
|
-
if (isWritingLetters && textToPrint !== '' && newtext !== '') {
|
|
91
|
-
return /*#__PURE__*/_react.default.createElement("span", {
|
|
92
|
-
className: "writer-inline ".concat(hasMultipleP ? 'multiple' : '', " ").concat(isLast ? 'Typist' : ''),
|
|
93
|
-
"data-testid": "result-".concat(index)
|
|
94
|
-
}, /*#__PURE__*/_react.default.createElement(_reactTypist.default, {
|
|
95
|
-
startDelay: 300,
|
|
96
|
-
avgTypingDelay: delay,
|
|
97
|
-
stdTypingDelay: 10,
|
|
98
|
-
onCharacterTyped: isWriting,
|
|
99
|
-
onTypingDone: typingDone,
|
|
100
|
-
cursor: {
|
|
101
|
-
hideWhenDone: true,
|
|
102
|
-
hideWhenDoneDelay: 200
|
|
103
|
-
},
|
|
104
|
-
blink: true
|
|
105
|
-
}, (0, _htmlReactParser.default)(textToPrint)));
|
|
106
|
-
}
|
|
107
|
-
return /*#__PURE__*/_react.default.createElement("span", {
|
|
108
|
-
className: "writer-inline ".concat(hasMultipleP ? 'multiple' : '', " ").concat(isLast ? 'Typist' : ''),
|
|
109
|
-
"data-testid": "result-".concat(index)
|
|
110
|
-
}, (0, _htmlReactParser.default)(newtext), nextParagraphType === 'election' && isLast && /*#__PURE__*/_react.default.createElement(Fakecursor, null));
|
|
111
|
-
};
|
|
112
|
-
FixedComponent.defaultProps = {
|
|
113
|
-
delay: 0,
|
|
114
|
-
textToPrint: '',
|
|
115
|
-
setDoneTyping: function setDoneTyping() {},
|
|
116
|
-
nextParagraphType: '',
|
|
117
|
-
isWriting: function isWriting() {}
|
|
118
|
-
};
|
|
119
|
-
var _default = FixedComponent;
|
|
120
|
-
exports.default = _default;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
var SingleElection = function SingleElection(_ref) {
|
|
17
|
-
var option = _ref.option,
|
|
18
|
-
decisionInspected = _ref.decisionInspected,
|
|
19
|
-
setCurrentDecisionSelected = _ref.setCurrentDecisionSelected,
|
|
20
|
-
index = _ref.index,
|
|
21
|
-
setCurrentDecisionInspected = _ref.setCurrentDecisionInspected,
|
|
22
|
-
soundActions = _ref.soundActions;
|
|
23
|
-
var _soundActions = _slicedToArray(soundActions, 1),
|
|
24
|
-
playSound = _soundActions[0];
|
|
25
|
-
var useText = function useText(opt) {
|
|
26
|
-
if (opt.previewText !== '') {
|
|
27
|
-
return (0, _htmlReactParser.default)(opt.previewText);
|
|
28
|
-
}
|
|
29
|
-
return (0, _htmlReactParser.default)(opt.fullText);
|
|
30
|
-
};
|
|
31
|
-
var fullTextIcon = function fullTextIcon(opt) {
|
|
32
|
-
if (opt.previewText !== '') {
|
|
33
|
-
return decisionInspected === index ? 'icon-eye inspected' : 'icon-eye'; // Icon only appears if there is fullText to show
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return '';
|
|
37
|
-
};
|
|
38
|
-
var selectOption = function selectOption() {
|
|
39
|
-
playSound('click-ui');
|
|
40
|
-
setCurrentDecisionSelected(index);
|
|
41
|
-
};
|
|
42
|
-
var onKeyDownInspect = function onKeyDownInspect(ev) {
|
|
43
|
-
if (ev.keyCode === 13) {
|
|
44
|
-
onInspect(ev);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
var onInspect = function onInspect(ev) {
|
|
48
|
-
ev.preventDefault();
|
|
49
|
-
ev.stopPropagation();
|
|
50
|
-
if (decisionInspected === index) {
|
|
51
|
-
ev.target.style.background = '';
|
|
52
|
-
setCurrentDecisionInspected('');
|
|
53
|
-
} else {
|
|
54
|
-
setCurrentDecisionInspected(index);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
58
|
-
className: "single-election"
|
|
59
|
-
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
60
|
-
className: "single-election__cta",
|
|
61
|
-
type: "button",
|
|
62
|
-
onClick: function onClick() {
|
|
63
|
-
return selectOption();
|
|
64
|
-
}
|
|
65
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
66
|
-
className: "single-election__btn"
|
|
67
|
-
}, /*#__PURE__*/_react.default.createElement("span", null, useText(option))), /*#__PURE__*/_react.default.createElement("div", {
|
|
68
|
-
onClick: onInspect,
|
|
69
|
-
onKeyDown: onKeyDownInspect,
|
|
70
|
-
className: fullTextIcon(option),
|
|
71
|
-
"aria-label": "Inspect",
|
|
72
|
-
role: "button",
|
|
73
|
-
tabIndex: 0
|
|
74
|
-
})), decisionInspected === index && /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
-
className: "single-election__complete"
|
|
76
|
-
}, /*#__PURE__*/_react.default.createElement("div", null, (0, _htmlReactParser.default)(option.fullText))));
|
|
77
|
-
};
|
|
78
|
-
SingleElection.defaultProps = {
|
|
79
|
-
setCurrentDecisionSelected: function setCurrentDecisionSelected() {},
|
|
80
|
-
setCurrentDecisionInspected: function setCurrentDecisionInspected() {},
|
|
81
|
-
option: {},
|
|
82
|
-
index: 0
|
|
83
|
-
};
|
|
84
|
-
var _default = SingleElection;
|
|
85
|
-
exports.default = _default;
|