@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
@@ -1,4 +1,3 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
1
  import React from 'react';
3
2
  import { base } from '@elice/design-tokens';
4
3
  import styled from 'styled-components';
@@ -6,11 +5,12 @@ import { WRONG_BACKGROUND_COLOR, CORRECT_BACKGROUND_COLOR } from '../../material
6
5
  import { getQuestionStatusStyle } from '../utils/getQuestionStatusStyle.js';
7
6
  import { useQuestionRadioContext } from './QuestionRadioContext.js';
8
7
 
9
- var StyledQuestionRadioOption = styled.div.withConfig({
8
+ const StyledQuestionRadioOption = styled.div.withConfig({
10
9
  componentId: "sc-cy66me-0"
11
- })(["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) {
12
- var checked = _ref.checked,
13
- status = _ref.status;
10
+ })(["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:", ";}", ""], ({
11
+ checked,
12
+ status
13
+ }) => {
14
14
  switch (status) {
15
15
  case 'correct':
16
16
  return CORRECT_BACKGROUND_COLOR;
@@ -21,18 +21,17 @@ var StyledQuestionRadioOption = styled.div.withConfig({
21
21
  default:
22
22
  return checked ? base.color.primary1 : base.color.navy6;
23
23
  }
24
- }, function (_ref2) {
25
- var disabled = _ref2.disabled;
26
- return disabled ? 'not-allowed' : 'pointer';
27
- }, function (_ref3) {
28
- var isAnswer = _ref3.isAnswer;
29
- return isAnswer ? "border: 3px solid ".concat(base.color.green5) : '';
30
- });
31
- var StyledQuestionRadioInput = styled.input.withConfig({
24
+ }, ({
25
+ disabled
26
+ }) => disabled ? 'not-allowed' : 'pointer', ({
27
+ isAnswer
28
+ }) => isAnswer ? `border: 3px solid ${base.color.green5}` : '');
29
+ const StyledQuestionRadioInput = styled.input.withConfig({
32
30
  componentId: "sc-cy66me-1"
33
- })(["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) {
34
- var checked = _ref4.checked,
35
- status = _ref4.status;
31
+ })(["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 ", ";", ""], ({
32
+ checked,
33
+ status
34
+ }) => {
36
35
  switch (status) {
37
36
  case 'correct':
38
37
  return base.color.green9;
@@ -41,10 +40,11 @@ var StyledQuestionRadioInput = styled.input.withConfig({
41
40
  default:
42
41
  return checked ? base.color.primary6 : base.color.gray3;
43
42
  }
44
- }, function (_ref5) {
45
- var status = _ref5.status,
46
- checked = _ref5.checked;
47
- var bgColor;
43
+ }, ({
44
+ status,
45
+ checked
46
+ }) => {
47
+ let bgColor;
48
48
  switch (status) {
49
49
  case 'correct':
50
50
  bgColor = base.color.green9;
@@ -56,45 +56,57 @@ var StyledQuestionRadioInput = styled.input.withConfig({
56
56
  bgColor = checked ? base.color.primary6 : status ? base.color.gray3 : 'transparent';
57
57
  break;
58
58
  }
59
- 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 ");
59
+ return `
60
+ &:after {
61
+ content: '';
62
+ position: absolute;
63
+ top: 50%;
64
+ left: 50%;
65
+ transform: translate(-50%, -50%);
66
+ width: 70%;
67
+ height: 70%;
68
+ border-radius: 50%;
69
+ background-color: ${bgColor};
70
+ }
71
+ `;
60
72
  });
61
- var StyledLabel = styled.label.withConfig({
73
+ const StyledLabel = styled.label.withConfig({
62
74
  componentId: "sc-cy66me-2"
63
75
  })(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], base.size.body3, getQuestionStatusStyle());
64
- var QuestionRadioOption = React.memo(function (_ref6) {
65
- var value = _ref6.value,
66
- status = _ref6.status,
67
- isAnswer = _ref6.isAnswer,
68
- children = _ref6.children;
69
- var _useQuestionRadioCont = useQuestionRadioContext(),
70
- selectedValue = _useQuestionRadioCont.selectedValue,
71
- disabled = _useQuestionRadioCont.disabled,
72
- onSelect = _useQuestionRadioCont.onSelect;
73
- return jsxs(StyledQuestionRadioOption, {
76
+ const QuestionRadioOption = React.memo(({
77
+ value,
78
+ status,
79
+ isAnswer,
80
+ children
81
+ }) => {
82
+ const {
83
+ selectedValue,
84
+ disabled,
85
+ onSelect
86
+ } = useQuestionRadioContext();
87
+ return React.createElement(StyledQuestionRadioOption, {
74
88
  isAnswer: isAnswer,
75
89
  disabled: disabled,
76
90
  checked: selectedValue === value,
77
- onClick: function onClick(e) {
91
+ onClick: e => {
78
92
  e.preventDefault();
79
93
  if (disabled) {
80
94
  return;
81
95
  }
82
96
  onSelect(value);
83
97
  },
84
- status: status,
85
- children: [jsx(StyledQuestionRadioInput, {
86
- id: value,
87
- type: "radio",
88
- readOnly: true,
89
- checked: selectedValue === value,
90
- status: status
91
- }), jsx(StyledLabel, {
92
- htmlFor: value,
93
- checked: selectedValue === value,
94
- status: status,
95
- children: children
96
- })]
97
- });
98
+ status: status
99
+ }, React.createElement(StyledQuestionRadioInput, {
100
+ id: value,
101
+ type: "radio",
102
+ readOnly: true,
103
+ checked: selectedValue === value,
104
+ status: status
105
+ }), React.createElement(StyledLabel, {
106
+ htmlFor: value,
107
+ checked: selectedValue === value,
108
+ status: status
109
+ }, children));
98
110
  });
99
111
 
100
112
  export { QuestionRadioOption as default };
@@ -6,9 +6,10 @@ import { WRONG_TEXT_COLOR, CORRECT_TEXT_COLOR } from '../../material-quiz/consta
6
6
  * Get shared question custom style depend on checked, status values.
7
7
  */
8
8
  function getQuestionStatusStyle() {
9
- return css(["&,& p,& p.elicemd.elicemd--theme-dark{color:", ";table tbody > tr:nth-child(odd) > td{background-color:", ";}}"], function (_ref) {
10
- var checked = _ref.checked,
11
- status = _ref.status;
9
+ return css(["&,& p,& p.elicemd.elicemd--theme-dark{color:", ";table tbody > tr:nth-child(odd) > td{background-color:", ";}}"], ({
10
+ checked,
11
+ status
12
+ }) => {
12
13
  switch (status) {
13
14
  case 'correct':
14
15
  return CORRECT_TEXT_COLOR;
@@ -17,10 +18,11 @@ function getQuestionStatusStyle() {
17
18
  default:
18
19
  return checked ? base.color.primary6 : base.color.navy0;
19
20
  }
20
- }, function (_ref2) {
21
- var checked = _ref2.checked,
22
- status = _ref2.status;
23
- return checked || status !== 'answer' ? "rgba(0, 0, 0, 0.08);" : null;
21
+ }, ({
22
+ checked,
23
+ status
24
+ }) => {
25
+ return checked || status !== 'answer' ? `rgba(0, 0, 0, 0.08);` : null;
24
26
  });
25
27
  }
26
28
 
@@ -1,18 +1,9 @@
1
- import { typeof as _typeof } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
-
3
- var mergeRefs = function mergeRefs() {
4
- for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
5
- refs[_key] = arguments[_key];
1
+ const mergeRefs = (...refs) => element => refs.forEach(ref => {
2
+ if (typeof ref === 'function') {
3
+ ref(element);
4
+ } else if (ref && typeof ref === 'object') {
5
+ ref.current = element;
6
6
  }
7
- return function (element) {
8
- return refs.forEach(function (ref) {
9
- if (typeof ref === 'function') {
10
- ref(element);
11
- } else if (ref && _typeof(ref) === 'object') {
12
- ref.current = element;
13
- }
14
- });
15
- };
16
- };
7
+ });
17
8
 
18
9
  export { mergeRefs };
@@ -1,5 +1,5 @@
1
- var MATERIAL_QUIZ_CONTAINER_ID = 'MATERIAL_QUIZ_CONTAINER_ID';
2
- var MATERIAL_QUIZ_PASSIVE_ID = 'MATERIAL_QUIZ_PASSIVE_ID';
3
- var MATERIAL_QUIZ_ANSWER_ID = 'MATERIAL_QUIZ_ANSWER_ID';
1
+ const MATERIAL_QUIZ_CONTAINER_ID = 'MATERIAL_QUIZ_CONTAINER_ID';
2
+ const MATERIAL_QUIZ_PASSIVE_ID = 'MATERIAL_QUIZ_PASSIVE_ID';
3
+ const MATERIAL_QUIZ_ANSWER_ID = 'MATERIAL_QUIZ_ANSWER_ID';
4
4
 
5
5
  export { MATERIAL_QUIZ_ANSWER_ID, MATERIAL_QUIZ_CONTAINER_ID, MATERIAL_QUIZ_PASSIVE_ID };
@@ -20,11 +20,12 @@ function getQuizResultStatus(materialQuizResponse) {
20
20
  }
21
21
  return QuizResultStatus.NotSubmitted;
22
22
  }
23
- var getOptionStatus = function getOptionStatus(_ref) {
24
- var isSelected = _ref.isSelected,
25
- isActive = _ref.isActive,
26
- materialQuizResponse = _ref.materialQuizResponse;
27
- var status = getQuizResultStatus(materialQuizResponse);
23
+ const getOptionStatus = ({
24
+ isSelected,
25
+ isActive,
26
+ materialQuizResponse
27
+ }) => {
28
+ const status = getQuizResultStatus(materialQuizResponse);
28
29
  if (isActive) {
29
30
  return;
30
31
  }
@@ -41,8 +42,9 @@ var getOptionStatus = function getOptionStatus(_ref) {
41
42
  function checkUserLectureTestEnded(lecture) {
42
43
  return (lecture === null || lecture === void 0 ? void 0 : lecture.testAdmissionStatus) === enums.TestAdmissionStatus.Completed;
43
44
  }
44
- function shouldResetOptions(_ref2) {
45
- var materialQuizResponse = _ref2.materialQuizResponse;
45
+ function shouldResetOptions({
46
+ materialQuizResponse
47
+ }) {
46
48
  // when score is given(correct, wrong), reset selected option in order to select options from scratch
47
49
  // score condition
48
50
  // normal quiz - score is always given(not a null) as long as a user submits the answer
@@ -50,7 +52,7 @@ function shouldResetOptions(_ref2) {
50
52
  return [(materialQuizResponse === null || materialQuizResponse === void 0 ? void 0 : materialQuizResponse.score) !== null].every(Boolean);
51
53
  }
52
54
  function getQuizResult(materialQuizResponse) {
53
- var status = getQuizResultStatus(materialQuizResponse);
55
+ const status = getQuizResultStatus(materialQuizResponse);
54
56
  switch (status) {
55
57
  case QuizResultStatus.Correct:
56
58
  return true;
@@ -1,32 +1,31 @@
1
- import { slicedToArray as _slicedToArray } from '../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { useEffect } from 'react';
3
2
  import { useMeasure } from 'react-use';
4
3
  import { useMaterialQuizState, useMaterialQuizDispatch } from '../components/material-quiz/context/MaterialQuizContext.js';
5
4
  import { MATERIAL_QUIZ_CONTAINER_ID } from '../constant/element.js';
6
5
 
7
- var useCaculatePassage = function useCaculatePassage() {
8
- var _useMaterialQuizState = useMaterialQuizState(),
9
- materialQuiz = _useMaterialQuizState.materialQuiz,
10
- vertical = _useMaterialQuizState.vertical;
11
- var _useMaterialQuizDispa = useMaterialQuizDispatch(),
12
- setIsLongPassage = _useMaterialQuizDispa.setIsLongPassage,
13
- setIsInitialLoading = _useMaterialQuizDispa.setIsInitialLoading;
14
- var _useMeasure = useMeasure(),
15
- _useMeasure2 = _slicedToArray(_useMeasure, 2),
16
- questionRef = _useMeasure2[0],
17
- questionDetailHeight = _useMeasure2[1].height;
18
- var _useMeasure3 = useMeasure(),
19
- _useMeasure4 = _slicedToArray(_useMeasure3, 2),
20
- containerRef = _useMeasure4[0],
21
- containerHeight = _useMeasure4[1].height;
22
- useEffect(function () {
6
+ const useCaculatePassage = () => {
7
+ const {
8
+ materialQuiz,
9
+ vertical
10
+ } = useMaterialQuizState();
11
+ const {
12
+ setIsLongPassage,
13
+ setIsInitialLoading
14
+ } = useMaterialQuizDispatch();
15
+ const [questionRef, {
16
+ height: questionDetailHeight
17
+ }] = useMeasure();
18
+ const [containerRef, {
19
+ height: containerHeight
20
+ }] = useMeasure();
21
+ useEffect(() => {
23
22
  var _a, _b;
24
- var currentContainerHeight = vertical ? (_b = (_a = document.getElementById(MATERIAL_QUIZ_CONTAINER_ID)) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0 : containerHeight;
23
+ const currentContainerHeight = vertical ? (_b = (_a = document.getElementById(MATERIAL_QUIZ_CONTAINER_ID)) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0 : containerHeight;
25
24
  if (currentContainerHeight && questionDetailHeight && materialQuiz) {
26
25
  setIsLongPassage(questionDetailHeight > currentContainerHeight);
27
26
  // add timeout for forcing caculate layout and render in the parent
28
27
  // finish before turning off loading
29
- setTimeout(function () {
28
+ setTimeout(() => {
30
29
  setIsInitialLoading(false);
31
30
  }, 300);
32
31
  } else if (materialQuiz && !materialQuiz.questionDescription) {
@@ -34,8 +33,8 @@ var useCaculatePassage = function useCaculatePassage() {
34
33
  }
35
34
  }, [containerHeight, questionDetailHeight, materialQuiz, setIsLongPassage, vertical, setIsInitialLoading]);
36
35
  return {
37
- questionRef: questionRef,
38
- containerRef: containerRef
36
+ questionRef,
37
+ containerRef
39
38
  };
40
39
  };
41
40
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-quiz",
3
- "version": "1.240718.0-trasncript.2",
3
+ "version": "1.240718.1",
4
4
  "description": "User view and editing components of Elice material quiz",
5
5
  "repository": "https://git.elicer.io/elice/frontend/library/elice-material",
6
6
  "license": "UNLICENSED",
@@ -17,8 +17,10 @@
17
17
  "scripts": {
18
18
  "start": "run-s watch",
19
19
  "prebuild": "run-s clean",
20
- "build": "cross-env NODE_ENV=production rollup -c ../../rollup.config.ts --configPlugin typescript -f es -f cjs",
21
- "watch": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es -f cjs -w",
20
+ "build": "run-p build:es build:cjs",
21
+ "build:es": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es",
22
+ "build:cjs": "rollup -c ../../rollup.config.ts --configPlugin typescript -f cjs",
23
+ "watch": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es -w",
22
24
  "lint": "eslint --ext .ts,.tsx ./src --max-warnings=0",
23
25
  "clean": "del-cli \"es/*\" \"cjs/*\" \"dist/*\""
24
26
  },
@@ -39,7 +41,7 @@
39
41
  "@fortawesome/pro-regular-svg-icons": "^6",
40
42
  "@fortawesome/pro-solid-svg-icons": "^6",
41
43
  "@mui/lab": "^5.0.0-alpha.112",
42
- "@mui/material": "^5.10.16",
44
+ "@mui/material": "^5.14.17",
43
45
  "@mui/x-data-grid": "^6.7.0",
44
46
  "@mui/x-date-pickers": "^6.7.0",
45
47
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
@@ -58,23 +60,23 @@
58
60
  },
59
61
  "devDependencies": {
60
62
  "@elice/api-client": "^1.240619.0",
61
- "@elice/blocks": "^1.240529.0",
63
+ "@elice/blocks": "^1.240514.0",
62
64
  "@elice/design-tokens": "^1.220803.0",
63
65
  "@elice/icons": "^1.230814.0",
64
66
  "@elice/icons-legacy": "npm:@elice/icons@0.230814.0",
65
67
  "@elice/intl": "0.240425.0-rc.2",
66
68
  "@elice/markdown": "^1.240124.0",
67
- "@elice/material-shared-types": "1.240718.0-trasncript.2",
68
- "@elice/material-shared-utils": "1.240718.0-trasncript.2",
69
+ "@elice/material-shared-types": "1.240718.1",
70
+ "@elice/material-shared-utils": "1.240718.1",
69
71
  "@elice/mui-system": "^5.240108.1",
70
- "@elice/types": "1.240709.0",
72
+ "@elice/types": "^1.240619.0",
71
73
  "@elice/wysiwyg": "1.240716.1",
72
- "@emotion/react": "^11.10.5",
73
- "@emotion/styled": "^11.10.5",
74
+ "@emotion/react": "^11.10.0",
75
+ "@emotion/styled": "^11.10.0",
74
76
  "@fortawesome/pro-regular-svg-icons": "^6.4.2",
75
77
  "@fortawesome/pro-solid-svg-icons": "^6.4.2",
76
78
  "@mui/lab": "^5.0.0-alpha.112",
77
- "@mui/material": "^5.10.16",
79
+ "@mui/material": "^5.14.17",
78
80
  "@mui/x-data-grid": "^6.7.0",
79
81
  "@mui/x-date-pickers": "^6.7.0",
80
82
  "@types/classnames": "^2.3.1",
@@ -87,5 +89,6 @@
87
89
  "react": "^17.0.2",
88
90
  "react-use": "^17.2.4",
89
91
  "styled-components": "^5.3.0"
90
- }
92
+ },
93
+ "gitHead": "c1b2b8f98c5eed547941a327188a09f6ed21f6e4"
91
94
  }