@elice/material-quiz 1.240718.0-trasncript.2 → 1.240718.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.
Files changed (127) hide show
  1. package/cjs/components/eb-sortable/EbDraggable.js +33 -42
  2. package/cjs/components/eb-sortable/EbDroppable.js +20 -27
  3. package/cjs/components/markdown-editor/index.d.ts +2 -1
  4. package/cjs/components/markdown-editor/index.js +10 -19
  5. package/cjs/components/material-quiz/MaterialQuiz.js +83 -114
  6. package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +29 -36
  7. package/cjs/components/material-quiz/MaterialQuizInfo.js +149 -151
  8. package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +127 -175
  9. package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +286 -360
  10. package/cjs/components/material-quiz/MaterialQuizSelectOne.js +126 -172
  11. package/cjs/components/material-quiz/MaterialQuizShimmer.js +39 -46
  12. package/cjs/components/material-quiz/MaterialQuizText.js +115 -163
  13. package/cjs/components/material-quiz/QuizResultBadge.js +22 -32
  14. package/cjs/components/material-quiz/QuizSubmitStatusText.js +16 -21
  15. package/cjs/components/material-quiz/constants/color.js +5 -5
  16. package/cjs/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
  17. package/cjs/components/material-quiz/context/MaterialQuizContext.js +93 -156
  18. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +161 -259
  19. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +100 -134
  20. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +101 -130
  21. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +52 -64
  22. package/cjs/components/material-quiz/material-quiz-group/context/context.js +1 -5
  23. package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +36 -47
  24. package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +232 -280
  25. package/cjs/components/material-quiz-edit/context.js +2 -8
  26. package/cjs/components/material-quiz-edit/options/OptionEditor.js +46 -70
  27. package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +148 -174
  28. package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +149 -175
  29. package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +144 -164
  30. package/cjs/components/material-quiz-edit/options/OptionText.js +82 -90
  31. package/cjs/components/material-quiz-edit/options/options-group/OptionGroup.js +8 -9
  32. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +112 -156
  33. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +196 -288
  34. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +75 -88
  35. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +92 -108
  36. package/cjs/components/material-quiz-edit/utils/checkTwoDimensionArray.js +1 -5
  37. package/cjs/components/material-quiz-edit/utils/editValue.js +12 -21
  38. package/cjs/components/shared/QuestionBox.js +165 -198
  39. package/cjs/components/shared/QuizDraggbleDroppedOption.js +12 -11
  40. package/cjs/components/shared/QuizDraggbleDummyOption.js +16 -23
  41. package/cjs/components/shared/QuizDraggbleOption.js +59 -65
  42. package/cjs/components/shared/StyledMarkdown.js +1 -5
  43. package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +7 -13
  44. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  45. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -24
  46. package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +68 -59
  47. package/cjs/components/shared/question-radio/QuestionRadio.js +7 -13
  48. package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  49. package/cjs/components/shared/question-radio/QuestionRadioContext.js +17 -24
  50. package/cjs/components/shared/question-radio/QuestionRadioOption.js +59 -52
  51. package/cjs/components/shared/utils/getQuestionStatusStyle.js +9 -7
  52. package/cjs/components/shared/utils/mergeRefs.js +6 -15
  53. package/cjs/constant/element.js +3 -3
  54. package/cjs/helpers/index.js +10 -8
  55. package/cjs/hooks/useCaculatePassage.js +20 -21
  56. package/es/components/eb-sortable/EbDraggable.js +33 -37
  57. package/es/components/eb-sortable/EbDroppable.js +20 -22
  58. package/es/components/markdown-editor/index.d.ts +2 -1
  59. package/es/components/markdown-editor/index.js +10 -15
  60. package/es/components/material-quiz/MaterialQuiz.js +83 -109
  61. package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +29 -32
  62. package/es/components/material-quiz/MaterialQuizInfo.js +150 -148
  63. package/es/components/material-quiz/MaterialQuizSelectMultiple.js +127 -171
  64. package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +287 -356
  65. package/es/components/material-quiz/MaterialQuizSelectOne.js +126 -168
  66. package/es/components/material-quiz/MaterialQuizShimmer.js +39 -42
  67. package/es/components/material-quiz/MaterialQuizText.js +115 -158
  68. package/es/components/material-quiz/QuizResultBadge.js +22 -27
  69. package/es/components/material-quiz/QuizSubmitStatusText.js +16 -17
  70. package/es/components/material-quiz/constants/color.js +5 -5
  71. package/es/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
  72. package/es/components/material-quiz/context/MaterialQuizContext.js +94 -153
  73. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +161 -253
  74. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +100 -129
  75. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +101 -125
  76. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +52 -60
  77. package/es/components/material-quiz/material-quiz-group/context/context.js +1 -1
  78. package/es/components/material-quiz-edit/MaterialQuizEdit.js +36 -43
  79. package/es/components/material-quiz-edit/MaterialQuizEditContent.js +229 -272
  80. package/es/components/material-quiz-edit/context.js +2 -4
  81. package/es/components/material-quiz-edit/options/OptionEditor.js +46 -64
  82. package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +148 -170
  83. package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +149 -171
  84. package/es/components/material-quiz-edit/options/OptionSelectOne.js +144 -159
  85. package/es/components/material-quiz-edit/options/OptionText.js +82 -86
  86. package/es/components/material-quiz-edit/options/options-group/OptionGroup.js +8 -9
  87. package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +112 -151
  88. package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +197 -283
  89. package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +75 -83
  90. package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +92 -103
  91. package/es/components/material-quiz-edit/utils/checkTwoDimensionArray.js +1 -5
  92. package/es/components/material-quiz-edit/utils/editValue.js +12 -17
  93. package/es/components/shared/QuestionBox.js +165 -192
  94. package/es/components/shared/QuizDraggbleDroppedOption.js +12 -11
  95. package/es/components/shared/QuizDraggbleDummyOption.js +16 -19
  96. package/es/components/shared/QuizDraggbleOption.js +59 -61
  97. package/es/components/shared/StyledMarkdown.js +1 -1
  98. package/es/components/shared/question-checkbox/QuestionCheckbox.js +7 -9
  99. package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  100. package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -20
  101. package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +68 -54
  102. package/es/components/shared/question-radio/QuestionRadio.js +7 -9
  103. package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  104. package/es/components/shared/question-radio/QuestionRadioContext.js +17 -20
  105. package/es/components/shared/question-radio/QuestionRadioOption.js +59 -47
  106. package/es/components/shared/utils/getQuestionStatusStyle.js +9 -7
  107. package/es/components/shared/utils/mergeRefs.js +6 -15
  108. package/es/constant/element.js +3 -3
  109. package/es/helpers/index.js +10 -8
  110. package/es/hooks/useCaculatePassage.js +20 -21
  111. package/package.json +15 -12
  112. package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -423
  113. package/cjs/components/material-quiz/index.js +0 -9
  114. package/cjs/components/material-quiz/locales/index.js +0 -13
  115. package/cjs/components/material-quiz-edit/index.js +0 -7
  116. package/cjs/components/material-quiz-edit/locales/index.js +0 -13
  117. package/cjs/components/shared/index.js +0 -19
  118. package/cjs/constant/index.js +0 -9
  119. package/cjs/hooks/index.js +0 -7
  120. package/es/_virtual/_rollupPluginBabelHelpers.js +0 -408
  121. package/es/components/material-quiz/index.js +0 -2
  122. package/es/components/material-quiz/locales/index.js +0 -4
  123. package/es/components/material-quiz-edit/index.js +0 -1
  124. package/es/components/material-quiz-edit/locales/index.js +0 -4
  125. package/es/components/shared/index.js +0 -7
  126. package/es/constant/index.js +0 -1
  127. package/es/hooks/index.js +0 -1
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var jsxRuntime = require('react/jsx-runtime');
6
5
  var React = require('react');
7
6
  var designTokens = require('@elice/design-tokens');
8
7
  var styled = require('styled-components');
@@ -10,16 +9,12 @@ var color = require('../../material-quiz/constants/color.js');
10
9
  var getQuestionStatusStyle = require('../utils/getQuestionStatusStyle.js');
11
10
  var QuestionRadioContext = require('./QuestionRadioContext.js');
12
11
 
13
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
14
-
15
- var React__default = /*#__PURE__*/_interopDefaultCompat(React);
16
- var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
17
-
18
- var StyledQuestionRadioOption = styled__default.default.div.withConfig({
12
+ const StyledQuestionRadioOption = styled.div.withConfig({
19
13
  componentId: "sc-cy66me-0"
20
- })(["display:flex;align-items:center;padding:0.875rem 1rem;border-radius:8px;background-color:", ";overflow-x:auto;&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], function (_ref) {
21
- var checked = _ref.checked,
22
- status = _ref.status;
14
+ })(["display:flex;align-items:center;padding:0.875rem 1rem;border-radius:8px;background-color:", ";overflow-x:auto;&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], ({
15
+ checked,
16
+ status
17
+ }) => {
23
18
  switch (status) {
24
19
  case 'correct':
25
20
  return color.CORRECT_BACKGROUND_COLOR;
@@ -30,18 +25,17 @@ var StyledQuestionRadioOption = styled__default.default.div.withConfig({
30
25
  default:
31
26
  return checked ? designTokens.base.color.primary1 : designTokens.base.color.navy6;
32
27
  }
33
- }, function (_ref2) {
34
- var disabled = _ref2.disabled;
35
- return disabled ? 'not-allowed' : 'pointer';
36
- }, function (_ref3) {
37
- var isAnswer = _ref3.isAnswer;
38
- return isAnswer ? "border: 3px solid ".concat(designTokens.base.color.green5) : '';
39
- });
40
- var StyledQuestionRadioInput = styled__default.default.input.withConfig({
28
+ }, ({
29
+ disabled
30
+ }) => disabled ? 'not-allowed' : 'pointer', ({
31
+ isAnswer
32
+ }) => isAnswer ? `border: 3px solid ${designTokens.base.color.green5}` : '');
33
+ const StyledQuestionRadioInput = styled.input.withConfig({
41
34
  componentId: "sc-cy66me-1"
42
- })(["flex:none;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:relative;border-radius:50%;width:1rem;height:1rem;margin-right:0.875rem;border:2px solid ", ";", ""], function (_ref4) {
43
- var checked = _ref4.checked,
44
- status = _ref4.status;
35
+ })(["flex:none;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:relative;border-radius:50%;width:1rem;height:1rem;margin-right:0.875rem;border:2px solid ", ";", ""], ({
36
+ checked,
37
+ status
38
+ }) => {
45
39
  switch (status) {
46
40
  case 'correct':
47
41
  return designTokens.base.color.green9;
@@ -50,10 +44,11 @@ var StyledQuestionRadioInput = styled__default.default.input.withConfig({
50
44
  default:
51
45
  return checked ? designTokens.base.color.primary6 : designTokens.base.color.gray3;
52
46
  }
53
- }, function (_ref5) {
54
- var status = _ref5.status,
55
- checked = _ref5.checked;
56
- var bgColor;
47
+ }, ({
48
+ status,
49
+ checked
50
+ }) => {
51
+ let bgColor;
57
52
  switch (status) {
58
53
  case 'correct':
59
54
  bgColor = designTokens.base.color.green9;
@@ -65,45 +60,57 @@ var StyledQuestionRadioInput = styled__default.default.input.withConfig({
65
60
  bgColor = checked ? designTokens.base.color.primary6 : status ? designTokens.base.color.gray3 : 'transparent';
66
61
  break;
67
62
  }
68
- return "\n &:after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 70%;\n height: 70%;\n border-radius: 50%;\n background-color: ".concat(bgColor, ";\n }\n ");
63
+ return `
64
+ &:after {
65
+ content: '';
66
+ position: absolute;
67
+ top: 50%;
68
+ left: 50%;
69
+ transform: translate(-50%, -50%);
70
+ width: 70%;
71
+ height: 70%;
72
+ border-radius: 50%;
73
+ background-color: ${bgColor};
74
+ }
75
+ `;
69
76
  });
70
- var StyledLabel = styled__default.default.label.withConfig({
77
+ const StyledLabel = styled.label.withConfig({
71
78
  componentId: "sc-cy66me-2"
72
79
  })(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], designTokens.base.size.body3, getQuestionStatusStyle.getQuestionStatusStyle());
73
- var QuestionRadioOption = React__default.default.memo(function (_ref6) {
74
- var value = _ref6.value,
75
- status = _ref6.status,
76
- isAnswer = _ref6.isAnswer,
77
- children = _ref6.children;
78
- var _useQuestionRadioCont = QuestionRadioContext.useQuestionRadioContext(),
79
- selectedValue = _useQuestionRadioCont.selectedValue,
80
- disabled = _useQuestionRadioCont.disabled,
81
- onSelect = _useQuestionRadioCont.onSelect;
82
- return jsxRuntime.jsxs(StyledQuestionRadioOption, {
80
+ const QuestionRadioOption = React.memo(({
81
+ value,
82
+ status,
83
+ isAnswer,
84
+ children
85
+ }) => {
86
+ const {
87
+ selectedValue,
88
+ disabled,
89
+ onSelect
90
+ } = QuestionRadioContext.useQuestionRadioContext();
91
+ return React.createElement(StyledQuestionRadioOption, {
83
92
  isAnswer: isAnswer,
84
93
  disabled: disabled,
85
94
  checked: selectedValue === value,
86
- onClick: function onClick(e) {
95
+ onClick: e => {
87
96
  e.preventDefault();
88
97
  if (disabled) {
89
98
  return;
90
99
  }
91
100
  onSelect(value);
92
101
  },
93
- status: status,
94
- children: [jsxRuntime.jsx(StyledQuestionRadioInput, {
95
- id: value,
96
- type: "radio",
97
- readOnly: true,
98
- checked: selectedValue === value,
99
- status: status
100
- }), jsxRuntime.jsx(StyledLabel, {
101
- htmlFor: value,
102
- checked: selectedValue === value,
103
- status: status,
104
- children: children
105
- })]
106
- });
102
+ status: status
103
+ }, React.createElement(StyledQuestionRadioInput, {
104
+ id: value,
105
+ type: "radio",
106
+ readOnly: true,
107
+ checked: selectedValue === value,
108
+ status: status
109
+ }), React.createElement(StyledLabel, {
110
+ htmlFor: value,
111
+ checked: selectedValue === value,
112
+ status: status
113
+ }, children));
107
114
  });
108
115
 
109
116
  exports.default = QuestionRadioOption;
@@ -8,9 +8,10 @@ var color = require('../../material-quiz/constants/color.js');
8
8
  * Get shared question custom style depend on checked, status values.
9
9
  */
10
10
  function getQuestionStatusStyle() {
11
- return styled.css(["&,& p,& p.elicemd.elicemd--theme-dark{color:", ";table tbody > tr:nth-child(odd) > td{background-color:", ";}}"], function (_ref) {
12
- var checked = _ref.checked,
13
- status = _ref.status;
11
+ return styled.css(["&,& p,& p.elicemd.elicemd--theme-dark{color:", ";table tbody > tr:nth-child(odd) > td{background-color:", ";}}"], ({
12
+ checked,
13
+ status
14
+ }) => {
14
15
  switch (status) {
15
16
  case 'correct':
16
17
  return color.CORRECT_TEXT_COLOR;
@@ -19,10 +20,11 @@ function getQuestionStatusStyle() {
19
20
  default:
20
21
  return checked ? designTokens.base.color.primary6 : designTokens.base.color.navy0;
21
22
  }
22
- }, function (_ref2) {
23
- var checked = _ref2.checked,
24
- status = _ref2.status;
25
- return checked || status !== 'answer' ? "rgba(0, 0, 0, 0.08);" : null;
23
+ }, ({
24
+ checked,
25
+ status
26
+ }) => {
27
+ return checked || status !== 'answer' ? `rgba(0, 0, 0, 0.08);` : null;
26
28
  });
27
29
  }
28
30
 
@@ -1,20 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
4
-
5
- var mergeRefs = function mergeRefs() {
6
- for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
7
- refs[_key] = arguments[_key];
3
+ const mergeRefs = (...refs) => element => refs.forEach(ref => {
4
+ if (typeof ref === 'function') {
5
+ ref(element);
6
+ } else if (ref && typeof ref === 'object') {
7
+ ref.current = element;
8
8
  }
9
- return function (element) {
10
- return refs.forEach(function (ref) {
11
- if (typeof ref === 'function') {
12
- ref(element);
13
- } else if (ref && _rollupPluginBabelHelpers.typeof(ref) === 'object') {
14
- ref.current = element;
15
- }
16
- });
17
- };
18
- };
9
+ });
19
10
 
20
11
  exports.mergeRefs = mergeRefs;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var MATERIAL_QUIZ_CONTAINER_ID = 'MATERIAL_QUIZ_CONTAINER_ID';
4
- var MATERIAL_QUIZ_PASSIVE_ID = 'MATERIAL_QUIZ_PASSIVE_ID';
5
- var MATERIAL_QUIZ_ANSWER_ID = 'MATERIAL_QUIZ_ANSWER_ID';
3
+ const MATERIAL_QUIZ_CONTAINER_ID = 'MATERIAL_QUIZ_CONTAINER_ID';
4
+ const MATERIAL_QUIZ_PASSIVE_ID = 'MATERIAL_QUIZ_PASSIVE_ID';
5
+ const MATERIAL_QUIZ_ANSWER_ID = 'MATERIAL_QUIZ_ANSWER_ID';
6
6
 
7
7
  exports.MATERIAL_QUIZ_ANSWER_ID = MATERIAL_QUIZ_ANSWER_ID;
8
8
  exports.MATERIAL_QUIZ_CONTAINER_ID = MATERIAL_QUIZ_CONTAINER_ID;
@@ -22,11 +22,12 @@ function getQuizResultStatus(materialQuizResponse) {
22
22
  }
23
23
  return exports.QuizResultStatus.NotSubmitted;
24
24
  }
25
- var getOptionStatus = function getOptionStatus(_ref) {
26
- var isSelected = _ref.isSelected,
27
- isActive = _ref.isActive,
28
- materialQuizResponse = _ref.materialQuizResponse;
29
- var status = getQuizResultStatus(materialQuizResponse);
25
+ const getOptionStatus = ({
26
+ isSelected,
27
+ isActive,
28
+ materialQuizResponse
29
+ }) => {
30
+ const status = getQuizResultStatus(materialQuizResponse);
30
31
  if (isActive) {
31
32
  return;
32
33
  }
@@ -43,8 +44,9 @@ var getOptionStatus = function getOptionStatus(_ref) {
43
44
  function checkUserLectureTestEnded(lecture) {
44
45
  return (lecture === null || lecture === void 0 ? void 0 : lecture.testAdmissionStatus) === types.enums.TestAdmissionStatus.Completed;
45
46
  }
46
- function shouldResetOptions(_ref2) {
47
- var materialQuizResponse = _ref2.materialQuizResponse;
47
+ function shouldResetOptions({
48
+ materialQuizResponse
49
+ }) {
48
50
  // when score is given(correct, wrong), reset selected option in order to select options from scratch
49
51
  // score condition
50
52
  // normal quiz - score is always given(not a null) as long as a user submits the answer
@@ -52,7 +54,7 @@ function shouldResetOptions(_ref2) {
52
54
  return [(materialQuizResponse === null || materialQuizResponse === void 0 ? void 0 : materialQuizResponse.score) !== null].every(Boolean);
53
55
  }
54
56
  function getQuizResult(materialQuizResponse) {
55
- var status = getQuizResultStatus(materialQuizResponse);
57
+ const status = getQuizResultStatus(materialQuizResponse);
56
58
  switch (status) {
57
59
  case exports.QuizResultStatus.Correct:
58
60
  return true;
@@ -1,34 +1,33 @@
1
1
  'use strict';
2
2
 
3
- var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.js');
4
3
  var React = require('react');
5
4
  var reactUse = require('react-use');
6
5
  var MaterialQuizContext = require('../components/material-quiz/context/MaterialQuizContext.js');
7
6
  var element = require('../constant/element.js');
8
7
 
9
- var useCaculatePassage = function useCaculatePassage() {
10
- var _useMaterialQuizState = MaterialQuizContext.useMaterialQuizState(),
11
- materialQuiz = _useMaterialQuizState.materialQuiz,
12
- vertical = _useMaterialQuizState.vertical;
13
- var _useMaterialQuizDispa = MaterialQuizContext.useMaterialQuizDispatch(),
14
- setIsLongPassage = _useMaterialQuizDispa.setIsLongPassage,
15
- setIsInitialLoading = _useMaterialQuizDispa.setIsInitialLoading;
16
- var _useMeasure = reactUse.useMeasure(),
17
- _useMeasure2 = _rollupPluginBabelHelpers.slicedToArray(_useMeasure, 2),
18
- questionRef = _useMeasure2[0],
19
- questionDetailHeight = _useMeasure2[1].height;
20
- var _useMeasure3 = reactUse.useMeasure(),
21
- _useMeasure4 = _rollupPluginBabelHelpers.slicedToArray(_useMeasure3, 2),
22
- containerRef = _useMeasure4[0],
23
- containerHeight = _useMeasure4[1].height;
24
- React.useEffect(function () {
8
+ const useCaculatePassage = () => {
9
+ const {
10
+ materialQuiz,
11
+ vertical
12
+ } = MaterialQuizContext.useMaterialQuizState();
13
+ const {
14
+ setIsLongPassage,
15
+ setIsInitialLoading
16
+ } = MaterialQuizContext.useMaterialQuizDispatch();
17
+ const [questionRef, {
18
+ height: questionDetailHeight
19
+ }] = reactUse.useMeasure();
20
+ const [containerRef, {
21
+ height: containerHeight
22
+ }] = reactUse.useMeasure();
23
+ React.useEffect(() => {
25
24
  var _a, _b;
26
- var currentContainerHeight = vertical ? (_b = (_a = document.getElementById(element.MATERIAL_QUIZ_CONTAINER_ID)) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0 : containerHeight;
25
+ const currentContainerHeight = vertical ? (_b = (_a = document.getElementById(element.MATERIAL_QUIZ_CONTAINER_ID)) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0 : containerHeight;
27
26
  if (currentContainerHeight && questionDetailHeight && materialQuiz) {
28
27
  setIsLongPassage(questionDetailHeight > currentContainerHeight);
29
28
  // add timeout for forcing caculate layout and render in the parent
30
29
  // finish before turning off loading
31
- setTimeout(function () {
30
+ setTimeout(() => {
32
31
  setIsInitialLoading(false);
33
32
  }, 300);
34
33
  } else if (materialQuiz && !materialQuiz.questionDescription) {
@@ -36,8 +35,8 @@ var useCaculatePassage = function useCaculatePassage() {
36
35
  }
37
36
  }, [containerHeight, questionDetailHeight, materialQuiz, setIsLongPassage, vertical, setIsInitialLoading]);
38
37
  return {
39
- questionRef: questionRef,
40
- containerRef: containerRef
38
+ questionRef,
39
+ containerRef
41
40
  };
42
41
  };
43
42
 
@@ -1,106 +1,102 @@
1
- import { jsx } from 'react/jsx-runtime';
2
1
  import React from 'react';
3
2
  import $ from 'jquery';
4
3
  import 'jquery-ui/ui/widgets/draggable';
5
4
 
6
- var EbDraggable = function EbDraggable(_ref) {
7
- var children = _ref.children,
8
- id = _ref.id,
9
- _ref$disabled = _ref.disabled,
10
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
11
- _ref$revert = _ref.revert,
12
- revert = _ref$revert === void 0 ? true : _ref$revert,
13
- _ref$clone = _ref.clone,
14
- clone = _ref$clone === void 0 ? false : _ref$clone,
15
- className = _ref.className,
16
- onStart = _ref.onStart,
17
- onStop = _ref.onStop,
18
- onDrag = _ref.onDrag,
19
- onCreate = _ref.onCreate;
20
- var rootEl = React.useRef(null);
21
- var onStartCallback = React.useCallback(function (event, ui) {
5
+ const EbDraggable = ({
6
+ children,
7
+ id,
8
+ disabled = false,
9
+ revert = true,
10
+ clone = false,
11
+ className,
12
+ onStart,
13
+ onStop,
14
+ onDrag,
15
+ onCreate
16
+ }) => {
17
+ const rootEl = React.useRef(null);
18
+ const onStartCallback = React.useCallback((event, ui) => {
22
19
  if (onStart) {
23
20
  return onStart(event, ui);
24
21
  } else {
25
- return function () {
22
+ return () => {
26
23
  return;
27
24
  };
28
25
  }
29
26
  }, [onStart]);
30
- var onStopCallback = React.useCallback(function (event, ui) {
27
+ const onStopCallback = React.useCallback((event, ui) => {
31
28
  if (onStop) {
32
29
  return onStop(event, ui);
33
30
  } else {
34
- return function () {
31
+ return () => {
35
32
  return;
36
33
  };
37
34
  }
38
35
  }, [onStop]);
39
- var onDragCallback = React.useCallback(function (event, ui) {
36
+ const onDragCallback = React.useCallback((event, ui) => {
40
37
  if (onDrag) {
41
38
  return onDrag(event, ui);
42
39
  } else {
43
- return function () {
40
+ return () => {
44
41
  return;
45
42
  };
46
43
  }
47
44
  }, [onDrag]);
48
- var onCreateCallback = React.useCallback(function (event, ui) {
45
+ const onCreateCallback = React.useCallback((event, ui) => {
49
46
  if (onCreate) {
50
47
  return onCreate(event, ui);
51
48
  } else {
52
- return function () {
49
+ return () => {
53
50
  return;
54
51
  };
55
52
  }
56
53
  }, [onCreate]);
57
- React.useEffect(function () {
54
+ React.useEffect(() => {
58
55
  if (!rootEl.current) {
59
56
  return;
60
57
  }
61
- var draggableEl = $(rootEl.current);
58
+ const draggableEl = $(rootEl.current);
62
59
  draggableEl.draggable(Object.assign(Object.assign(Object.assign(Object.assign({}, disabled ? {
63
- disabled: disabled
60
+ disabled
64
61
  } : null), revert ? {
65
- revert: revert
62
+ revert
66
63
  } : null), clone ? {
67
64
  helper: 'clone'
68
65
  } : null), {
69
66
  zIndex: 200,
70
67
  revertDuration: 0,
71
- start: function start(event, ui) {
68
+ start: (event, ui) => {
72
69
  if (!onStartCallback) {
73
70
  return;
74
71
  }
75
72
  onStartCallback(event, ui);
76
73
  },
77
- stop: function stop(event, ui) {
74
+ stop: (event, ui) => {
78
75
  if (!onStopCallback) {
79
76
  return;
80
77
  }
81
78
  // draggableEl.draggable('cancel');
82
79
  onStopCallback(event, ui);
83
80
  },
84
- drag: function drag(event, ui) {
81
+ drag: (event, ui) => {
85
82
  onDragCallback(event, ui);
86
83
  },
87
- create: function create(event, ui) {
84
+ create: (event, ui) => {
88
85
  onCreateCallback(event, ui);
89
86
  }
90
87
  }));
91
- return function () {
88
+ return () => {
92
89
  draggableEl.draggable('destroy');
93
90
  };
94
91
  }, [clone, disabled, onCreateCallback, onDragCallback, onStartCallback, onStopCallback, revert]);
95
- return jsx("div", {
92
+ return React.createElement("div", {
96
93
  ref: rootEl,
97
94
  id: id,
98
95
  className: className,
99
96
  style: {
100
97
  cursor: disabled ? 'auto' : 'move'
101
- },
102
- children: children
103
- });
98
+ }
99
+ }, children);
104
100
  };
105
101
 
106
102
  export { EbDraggable as default };
@@ -1,53 +1,51 @@
1
- import { jsx } from 'react/jsx-runtime';
2
1
  import React from 'react';
3
2
  import $ from 'jquery';
4
3
  import 'jquery-ui/ui/widgets/droppable';
5
4
 
6
- var EbDroppable = function EbDroppable(_ref) {
7
- var children = _ref.children,
8
- id = _ref.id,
9
- _ref$disabled = _ref.disabled,
10
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
11
- accept = _ref.accept,
12
- className = _ref.className,
13
- onDrop = _ref.onDrop;
14
- var rootEl = React.useRef(null);
15
- var onDropCallback = React.useCallback(function (event, ui) {
5
+ const EbDroppable = ({
6
+ children,
7
+ id,
8
+ disabled = false,
9
+ accept,
10
+ className,
11
+ onDrop
12
+ }) => {
13
+ const rootEl = React.useRef(null);
14
+ const onDropCallback = React.useCallback((event, ui) => {
16
15
  if (onDrop) {
17
16
  return onDrop(event, ui);
18
17
  } else {
19
- return function () {
18
+ return () => {
20
19
  return;
21
20
  };
22
21
  }
23
22
  }, [onDrop]);
24
- React.useEffect(function () {
23
+ React.useEffect(() => {
25
24
  if (!rootEl.current) {
26
25
  return;
27
26
  }
28
- var draggableEl = $(rootEl.current);
27
+ const draggableEl = $(rootEl.current);
29
28
  draggableEl.droppable(Object.assign(Object.assign(Object.assign({}, disabled ? {
30
- disabled: disabled
29
+ disabled
31
30
  } : null), accept ? {
32
- accept: accept
31
+ accept
33
32
  } : null), {
34
- drop: function drop(event, ui) {
33
+ drop: (event, ui) => {
35
34
  if (!onDropCallback) {
36
35
  return;
37
36
  }
38
37
  onDropCallback(event, ui);
39
38
  }
40
39
  }));
41
- return function () {
40
+ return () => {
42
41
  draggableEl.droppable('destroy');
43
42
  };
44
43
  }, [accept, disabled, onDropCallback]);
45
- return jsx("div", {
44
+ return React.createElement("div", {
46
45
  ref: rootEl,
47
46
  id: id,
48
- className: className,
49
- children: children
50
- });
47
+ className: className
48
+ }, children);
51
49
  };
52
50
 
53
51
  export { EbDroppable as default };
@@ -1,2 +1,3 @@
1
+ import React from 'react';
1
2
  import type { EliceWysiwygEditorProps } from '@elice/wysiwyg';
2
- export declare const MarkdownEditor: ({ value, onChange, ...props }: EliceWysiwygEditorProps) => JSX.Element;
3
+ export declare const MarkdownEditor: ({ value, onChange, ...props }: EliceWysiwygEditorProps) => React.JSX.Element;
@@ -1,28 +1,23 @@
1
- import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { __rest } from 'tslib';
3
- import { jsx } from 'react/jsx-runtime';
4
2
  import React from 'react';
5
3
  import { useDebounce } from 'react-use';
6
4
  import { EliceWysiwygEditor } from '@elice/wysiwyg';
7
5
 
8
- var STATE_SYNC_DEBOUNCE_TIME = 50;
9
- var MarkdownEditor = function MarkdownEditor(_a) {
10
- var value = _a.value,
11
- onChange = _a.onChange,
6
+ const STATE_SYNC_DEBOUNCE_TIME = 50;
7
+ const MarkdownEditor = _a => {
8
+ var {
9
+ value,
10
+ onChange
11
+ } = _a,
12
12
  props = __rest(_a, ["value", "onChange"]);
13
- var _React$useState = React.useState(value),
14
- _React$useState2 = _slicedToArray(_React$useState, 2),
15
- __value = _React$useState2[0],
16
- __setValue = _React$useState2[1];
17
- useDebounce(function () {
18
- return __setValue(value);
19
- }, STATE_SYNC_DEBOUNCE_TIME, [value]);
20
- useDebounce(function () {
13
+ const [__value, __setValue] = React.useState(value);
14
+ useDebounce(() => __setValue(value), STATE_SYNC_DEBOUNCE_TIME, [value]);
15
+ useDebounce(() => {
21
16
  if (__value !== value && typeof onChange === 'function') {
22
17
  onChange(__value !== null && __value !== void 0 ? __value : '');
23
18
  }
24
19
  }, STATE_SYNC_DEBOUNCE_TIME, [__value]);
25
- return jsx(EliceWysiwygEditor, Object.assign({
20
+ return React.createElement(EliceWysiwygEditor, Object.assign({
26
21
  value: value,
27
22
  onChange: __setValue
28
23
  }, props));