@elice/material-quiz 1.240718.0-trasncript.1 → 1.240718.0-trasncript.2

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/_virtual/_rollupPluginBabelHelpers.js +423 -0
  2. package/cjs/components/eb-sortable/EbDraggable.js +42 -33
  3. package/cjs/components/eb-sortable/EbDroppable.js +27 -20
  4. package/cjs/components/markdown-editor/index.d.ts +1 -2
  5. package/cjs/components/markdown-editor/index.js +19 -10
  6. package/cjs/components/material-quiz/MaterialQuiz.js +114 -83
  7. package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +36 -29
  8. package/cjs/components/material-quiz/MaterialQuizInfo.js +151 -149
  9. package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +175 -127
  10. package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +360 -286
  11. package/cjs/components/material-quiz/MaterialQuizSelectOne.js +172 -126
  12. package/cjs/components/material-quiz/MaterialQuizShimmer.js +46 -39
  13. package/cjs/components/material-quiz/MaterialQuizText.js +163 -115
  14. package/cjs/components/material-quiz/QuizResultBadge.js +32 -22
  15. package/cjs/components/material-quiz/QuizSubmitStatusText.js +21 -16
  16. package/cjs/components/material-quiz/constants/color.js +5 -5
  17. package/cjs/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
  18. package/cjs/components/material-quiz/context/MaterialQuizContext.js +156 -93
  19. package/cjs/components/material-quiz/index.js +9 -0
  20. package/cjs/components/material-quiz/locales/index.js +13 -0
  21. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +259 -161
  22. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +134 -100
  23. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +130 -101
  24. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +64 -52
  25. package/cjs/components/material-quiz/material-quiz-group/context/context.js +5 -1
  26. package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +47 -36
  27. package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +280 -232
  28. package/cjs/components/material-quiz-edit/context.js +8 -2
  29. package/cjs/components/material-quiz-edit/index.js +7 -0
  30. package/cjs/components/material-quiz-edit/locales/index.js +13 -0
  31. package/cjs/components/material-quiz-edit/options/OptionEditor.js +70 -46
  32. package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +174 -148
  33. package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +175 -149
  34. package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +164 -144
  35. package/cjs/components/material-quiz-edit/options/OptionText.js +90 -82
  36. package/cjs/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
  37. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +156 -112
  38. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +288 -196
  39. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +88 -75
  40. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +108 -92
  41. package/cjs/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
  42. package/cjs/components/material-quiz-edit/utils/editValue.js +21 -12
  43. package/cjs/components/shared/QuestionBox.js +198 -165
  44. package/cjs/components/shared/QuizDraggbleDroppedOption.js +11 -12
  45. package/cjs/components/shared/QuizDraggbleDummyOption.js +23 -16
  46. package/cjs/components/shared/QuizDraggbleOption.js +65 -59
  47. package/cjs/components/shared/StyledMarkdown.js +5 -1
  48. package/cjs/components/shared/index.js +19 -0
  49. package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +13 -7
  50. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  51. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +24 -17
  52. package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +59 -68
  53. package/cjs/components/shared/question-radio/QuestionRadio.js +13 -7
  54. package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  55. package/cjs/components/shared/question-radio/QuestionRadioContext.js +24 -17
  56. package/cjs/components/shared/question-radio/QuestionRadioOption.js +52 -59
  57. package/cjs/components/shared/utils/getQuestionStatusStyle.js +7 -9
  58. package/cjs/components/shared/utils/mergeRefs.js +15 -6
  59. package/cjs/constant/element.js +3 -3
  60. package/cjs/constant/index.js +9 -0
  61. package/cjs/helpers/index.js +8 -10
  62. package/cjs/hooks/index.js +7 -0
  63. package/cjs/hooks/useCaculatePassage.js +21 -20
  64. package/es/_virtual/_rollupPluginBabelHelpers.js +408 -0
  65. package/es/components/eb-sortable/EbDraggable.js +37 -33
  66. package/es/components/eb-sortable/EbDroppable.js +22 -20
  67. package/es/components/markdown-editor/index.d.ts +1 -2
  68. package/es/components/markdown-editor/index.js +15 -10
  69. package/es/components/material-quiz/MaterialQuiz.js +109 -83
  70. package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +32 -29
  71. package/es/components/material-quiz/MaterialQuizInfo.js +148 -150
  72. package/es/components/material-quiz/MaterialQuizSelectMultiple.js +171 -127
  73. package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +356 -287
  74. package/es/components/material-quiz/MaterialQuizSelectOne.js +168 -126
  75. package/es/components/material-quiz/MaterialQuizShimmer.js +42 -39
  76. package/es/components/material-quiz/MaterialQuizText.js +158 -115
  77. package/es/components/material-quiz/QuizResultBadge.js +27 -22
  78. package/es/components/material-quiz/QuizSubmitStatusText.js +17 -16
  79. package/es/components/material-quiz/constants/color.js +5 -5
  80. package/es/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
  81. package/es/components/material-quiz/context/MaterialQuizContext.js +153 -94
  82. package/es/components/material-quiz/index.js +2 -0
  83. package/es/components/material-quiz/locales/index.js +4 -0
  84. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +253 -161
  85. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +129 -100
  86. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +125 -101
  87. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +60 -52
  88. package/es/components/material-quiz/material-quiz-group/context/context.js +1 -1
  89. package/es/components/material-quiz-edit/MaterialQuizEdit.js +43 -36
  90. package/es/components/material-quiz-edit/MaterialQuizEditContent.js +272 -229
  91. package/es/components/material-quiz-edit/context.js +4 -2
  92. package/es/components/material-quiz-edit/index.js +1 -0
  93. package/es/components/material-quiz-edit/locales/index.js +4 -0
  94. package/es/components/material-quiz-edit/options/OptionEditor.js +64 -46
  95. package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +170 -148
  96. package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +171 -149
  97. package/es/components/material-quiz-edit/options/OptionSelectOne.js +159 -144
  98. package/es/components/material-quiz-edit/options/OptionText.js +86 -82
  99. package/es/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
  100. package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +151 -112
  101. package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +283 -197
  102. package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +83 -75
  103. package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +103 -92
  104. package/es/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
  105. package/es/components/material-quiz-edit/utils/editValue.js +17 -12
  106. package/es/components/shared/QuestionBox.js +192 -165
  107. package/es/components/shared/QuizDraggbleDroppedOption.js +11 -12
  108. package/es/components/shared/QuizDraggbleDummyOption.js +19 -16
  109. package/es/components/shared/QuizDraggbleOption.js +61 -59
  110. package/es/components/shared/StyledMarkdown.js +1 -1
  111. package/es/components/shared/index.js +7 -0
  112. package/es/components/shared/question-checkbox/QuestionCheckbox.js +9 -7
  113. package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  114. package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +20 -17
  115. package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +54 -68
  116. package/es/components/shared/question-radio/QuestionRadio.js +9 -7
  117. package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  118. package/es/components/shared/question-radio/QuestionRadioContext.js +20 -17
  119. package/es/components/shared/question-radio/QuestionRadioOption.js +47 -59
  120. package/es/components/shared/utils/getQuestionStatusStyle.js +7 -9
  121. package/es/components/shared/utils/mergeRefs.js +15 -6
  122. package/es/constant/element.js +3 -3
  123. package/es/constant/index.js +1 -0
  124. package/es/helpers/index.js +8 -10
  125. package/es/hooks/index.js +1 -0
  126. package/es/hooks/useCaculatePassage.js +21 -20
  127. package/package.json +12 -15
@@ -1,4 +1,6 @@
1
+ import { asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import { __rest } from 'tslib';
3
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
4
  import React, { useEffect } from 'react';
3
5
  import { useIntersection } from 'react-use';
4
6
  import { Button, Flex, Text, Box } from '@elice/blocks';
@@ -11,206 +13,231 @@ import { MATERIAL_QUIZ_ANSWER_ID, MATERIAL_QUIZ_PASSIVE_ID } from '../../constan
11
13
  import { useMaterialQuizState } from '../material-quiz/context/MaterialQuizContext.js';
12
14
  import { mergeRefs } from './utils/mergeRefs.js';
13
15
 
14
- const easeInOutCubic = t => {
16
+ var easeInOutCubic = function easeInOutCubic(t) {
15
17
  return t < 0.5 ? 4 * Math.pow(t, 3) : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
16
18
  };
17
- const StyledQuestionBox = styled.div.withConfig({
19
+ var StyledQuestionBox = styled.div.withConfig({
18
20
  componentId: "sc-6qfyxj-0"
19
- })(["position:relative;display:flex;flex-direction:column;overflow:", ";border-radius:", ";width:100%;background-color:", ";", ";"], ({
20
- vertical
21
- }) => vertical ? 'auto' : 'hidden', ({
22
- vertical
23
- }) => vertical ? '0' : '8px', base.color.navy8, ({
24
- vertical
25
- }) => vertical ? 'height: 100%' : `
26
- max-height: 100%;
27
- min-height: 100%;
28
- `);
29
- const StyledQuestionBoxHeader = styled.div.withConfig({
21
+ })(["position:relative;display:flex;flex-direction:column;overflow:", ";border-radius:", ";width:100%;background-color:", ";", ";"], function (_ref) {
22
+ var vertical = _ref.vertical;
23
+ return vertical ? 'auto' : 'hidden';
24
+ }, function (_ref2) {
25
+ var vertical = _ref2.vertical;
26
+ return vertical ? '0' : '8px';
27
+ }, base.color.navy8, function (_ref3) {
28
+ var vertical = _ref3.vertical;
29
+ return vertical ? 'height: 100%' : "\n max-height: 100%;\n min-height: 100%;\n ";
30
+ });
31
+ var StyledQuestionBoxHeader = styled.div.withConfig({
30
32
  componentId: "sc-6qfyxj-1"
31
- })(["display:flex;justify-content:space-between;background-color:", ";padding:", ";flex:none;", ""], base.color.navy8, ({
32
- vertical
33
- }) => !vertical ? '1.5rem' : '1.5rem 1rem 1rem', ({
34
- vertical
35
- }) => vertical ? `
36
- position: sticky;
37
- top: -1px;
38
- left: 0;
39
- z-index: 1;
40
- ` : '');
41
- const StyledQuestionBoxBody = styled.div.withConfig({
33
+ })(["display:flex;justify-content:space-between;background-color:", ";padding:", ";flex:none;", ""], base.color.navy8, function (_ref4) {
34
+ var vertical = _ref4.vertical;
35
+ return !vertical ? '1.5rem' : '1.5rem 1rem 1rem';
36
+ }, function (_ref5) {
37
+ var vertical = _ref5.vertical;
38
+ return vertical ? "\n position: sticky;\n top: -1px;\n left: 0;\n z-index: 1;\n " : '';
39
+ });
40
+ var StyledQuestionBoxBody = styled.div.withConfig({
42
41
  componentId: "sc-6qfyxj-2"
43
- })(["background-color:", ";flex:auto;", ";"], base.color.navy8, ({
44
- hasFooter,
45
- vertical
46
- }) => hasFooter && !vertical ? 'height: 100%; padding: 0 1.5rem 1.5rem; overflow-y: auto;' : 'padding: 0.25rem 1.5rem 1.5rem');
47
- const StyledAnchorBox = styled.div.withConfig({
42
+ })(["background-color:", ";flex:auto;", ";"], base.color.navy8, function (_ref6) {
43
+ var hasFooter = _ref6.hasFooter,
44
+ vertical = _ref6.vertical;
45
+ return hasFooter && !vertical ? 'height: 100%; padding: 0 1.5rem 1.5rem; overflow-y: auto;' : 'padding: 0.25rem 1.5rem 1.5rem';
46
+ });
47
+ var StyledAnchorBox = styled.div.withConfig({
48
48
  componentId: "sc-6qfyxj-3"
49
49
  })(["position:sticky;bottom:0;left:0;display:flex;justify-content:center;background-color:", ";border-top:1px solid ", ";"], base.color.navy8, base.color.gray7);
50
- const StyledQuestionBoxFooter = styled.div.withConfig({
50
+ var StyledQuestionBoxFooter = styled.div.withConfig({
51
51
  componentId: "sc-6qfyxj-4"
52
- })(["flex:none;display:flex;align-items:center;padding:1rem;background-color:", ";", ""], base.color.navy8, ({
53
- vertical
54
- }) => {
55
- return vertical ? `
56
- flex-direction: column;
57
- align-items: flex-start;
58
- ` : `
59
- border-top: 1px solid ${base.color.gray7};
60
- justify-content: end;
61
- gap: 0.75rem;
62
- `;
52
+ })(["flex:none;display:flex;align-items:center;padding:1rem;background-color:", ";", ""], base.color.navy8, function (_ref7) {
53
+ var vertical = _ref7.vertical;
54
+ return vertical ? "\n flex-direction: column;\n align-items: flex-start;\n " : "\n border-top: 1px solid ".concat(base.color.gray7, ";\n justify-content: end; \n gap: 0.75rem;\n ");
63
55
  });
64
- const StyledQuestionBoxFooterActions = styled.div.withConfig({
56
+ var StyledQuestionBoxFooterActions = styled.div.withConfig({
65
57
  componentId: "sc-6qfyxj-5"
66
- })(["display:flex;gap:0.75rem;", ";"], ({
67
- vertical
68
- }) => {
58
+ })(["display:flex;gap:0.75rem;", ";"], function (_ref8) {
59
+ var vertical = _ref8.vertical;
69
60
  return vertical ? 'width: 100%' : '';
70
61
  });
71
- const StyledPrimaryButton = styled(Button).withConfig({
62
+ var StyledPrimaryButton = styled(Button).withConfig({
72
63
  componentId: "sc-6qfyxj-6"
73
64
  })(["background-color:", ";border-color:", ";"], base.color.primary6, base.color.primary6);
74
- const QuestionBox = _a => {
75
- var {
76
- children,
77
- footerActions = [],
78
- title,
79
- titlePrefix,
80
- submitResult,
81
- submitStatus,
82
- onNext,
83
- isNextActive,
84
- bodyContainerRef
85
- } = _a,
65
+ var QuestionBox = function QuestionBox(_a) {
66
+ var children = _a.children,
67
+ _a$footerActions = _a.footerActions,
68
+ footerActions = _a$footerActions === void 0 ? [] : _a$footerActions,
69
+ title = _a.title,
70
+ titlePrefix = _a.titlePrefix,
71
+ submitResult = _a.submitResult;
72
+ _a.submitStatus;
73
+ var onNext = _a.onNext,
74
+ isNextActive = _a.isNextActive,
75
+ bodyContainerRef = _a.bodyContainerRef,
86
76
  props = __rest(_a, ["children", "footerActions", "title", "titlePrefix", "submitResult", "submitStatus", "onNext", "isNextActive", "bodyContainerRef"]);
87
- const theme = useTheme();
88
- const intl = useRawEliceIntl();
89
- const {
90
- vertical,
91
- isLongPassage
92
- } = useMaterialQuizState();
93
- const intersectionRef = React.useRef(null);
94
- const headerRef = React.useRef(null);
95
- const bodyRef = React.useRef(null);
96
- const currentBodyRef = mergeRefs(bodyContainerRef, bodyRef);
97
- const hasFooter = footerActions.length > 0;
98
- const visibleAnchorSection = vertical && isLongPassage;
99
- const intersection = useIntersection(intersectionRef, {
77
+ var theme = useTheme();
78
+ var intl = useRawEliceIntl();
79
+ var _useMaterialQuizState = useMaterialQuizState(),
80
+ vertical = _useMaterialQuizState.vertical,
81
+ isLongPassage = _useMaterialQuizState.isLongPassage;
82
+ var intersectionRef = React.useRef(null);
83
+ var headerRef = React.useRef(null);
84
+ var bodyRef = React.useRef(null);
85
+ var currentBodyRef = mergeRefs(bodyContainerRef, bodyRef);
86
+ var hasFooter = footerActions.length > 0;
87
+ var visibleAnchorSection = vertical && isLongPassage;
88
+ var intersection = useIntersection(intersectionRef, {
100
89
  root: null,
101
90
  rootMargin: '0px',
102
91
  threshold: 0.1
103
92
  });
104
- const isViewingAnswerContainer = Boolean(intersection === null || intersection === void 0 ? void 0 : intersection.isIntersecting);
105
- useEffect(() => {
106
- const answerContainer = document.getElementById(MATERIAL_QUIZ_ANSWER_ID);
93
+ var isViewingAnswerContainer = Boolean(intersection === null || intersection === void 0 ? void 0 : intersection.isIntersecting);
94
+ useEffect(function () {
95
+ var answerContainer = document.getElementById(MATERIAL_QUIZ_ANSWER_ID);
107
96
  // only enable for vertical mode
108
97
  if (answerContainer && vertical) intersectionRef.current = answerContainer;
109
98
  }, [intersectionRef, vertical]);
110
- const scrollToElement = async elementId => {
111
- var _a, _b;
112
- const target = document.getElementById(elementId);
113
- if (target && bodyRef.current) {
114
- await animateScrollTo(target.offsetTop, {
115
- elementToScroll: bodyRef.current,
116
- verticalOffset: -((_b = (_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0),
117
- easing: easeInOutCubic,
118
- minDuration: 50,
119
- speed: 200
120
- });
121
- }
122
- };
123
- const header = title ? React.createElement(StyledQuestionBoxHeader, {
99
+ var scrollToElement = /*#__PURE__*/function () {
100
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(elementId) {
101
+ var _a, _b, target;
102
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
103
+ while (1) switch (_context.prev = _context.next) {
104
+ case 0:
105
+ target = document.getElementById(elementId);
106
+ if (!(target && bodyRef.current)) {
107
+ _context.next = 4;
108
+ break;
109
+ }
110
+ _context.next = 4;
111
+ return animateScrollTo(target.offsetTop, {
112
+ elementToScroll: bodyRef.current,
113
+ verticalOffset: -((_b = (_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0),
114
+ easing: easeInOutCubic,
115
+ minDuration: 50,
116
+ speed: 200
117
+ });
118
+ case 4:
119
+ case "end":
120
+ return _context.stop();
121
+ }
122
+ }, _callee);
123
+ }));
124
+ return function scrollToElement(_x) {
125
+ return _ref9.apply(this, arguments);
126
+ };
127
+ }();
128
+ var header = title ? jsxs(StyledQuestionBoxHeader, {
124
129
  vertical: vertical,
125
- ref: headerRef
126
- }, React.createElement(Flex, null, titlePrefix ? React.createElement(Text, {
127
- bold: true,
128
- size: "large",
129
- customStyles: {
130
- color: base.color.primary3,
131
- marginRight: '0.5rem'
132
- }
133
- }, titlePrefix) : null, React.createElement(Text, {
134
- bold: true,
135
- role: "navy0",
136
- size: "large",
137
- wordBreak: "break-word"
138
- }, title)), submitResult ? React.createElement(Box, null, submitResult) : null) : null;
139
- const body = React.createElement(StyledQuestionBoxBody, {
130
+ ref: headerRef,
131
+ children: [jsxs(Flex, {
132
+ children: [titlePrefix ? jsx(Text, {
133
+ bold: true,
134
+ size: "large",
135
+ customStyles: {
136
+ color: base.color.primary3,
137
+ marginRight: '0.5rem'
138
+ },
139
+ children: titlePrefix
140
+ }) : null, jsx(Text, {
141
+ bold: true,
142
+ role: "navy0",
143
+ size: "large",
144
+ wordBreak: "break-word",
145
+ children: title
146
+ })]
147
+ }), submitResult ? jsx(Box, {
148
+ children: submitResult
149
+ }) : null]
150
+ }) : null;
151
+ var body = jsx(StyledQuestionBoxBody, {
140
152
  ref: !vertical ? currentBodyRef : undefined,
141
153
  hasFooter: hasFooter,
142
- vertical: vertical
143
- }, children);
144
- const footer = React.createElement(StyledQuestionBoxFooter, {
145
- vertical: vertical
146
- }, React.createElement(StyledQuestionBoxFooterActions, {
147
- vertical: vertical
148
- }, footerActions.map((action, index) => {
149
- const Component = action.role === 'lightpurple' ? StyledPrimaryButton : Button;
150
- return React.createElement(Component, Object.assign({
151
- isFluid: vertical,
152
- key: index,
153
- size: "small"
154
- }, action), action.children);
155
- }), isNextActive ? React.createElement(StyledPrimaryButton, {
156
- isFluid: vertical,
157
- size: "small",
158
- border: false,
159
- tabIndex: 0,
160
- transparent: false,
161
- onClick: onNext,
162
- customStyles: {
163
- backgroundColor: theme.palette.primary.main,
164
- color: theme.palette.primary.contrastText
165
- }
166
- }, intl.formatMessage({
167
- id: 'materialQuiz.next'
168
- })) : null));
169
- const _renderAnchorSection = () => {
170
- const getCustomStyles = active => ({
171
- borderBottom: '3px solid currentColor',
172
- background: 'none',
173
- borderColor: active ? 'currentColor' : 'transparent',
174
- color: active ? theme.palette.primary.main : theme.palette.secondary.light
154
+ vertical: vertical,
155
+ children: children
156
+ });
157
+ var footer = jsx(StyledQuestionBoxFooter, {
158
+ vertical: vertical,
159
+ children: jsxs(StyledQuestionBoxFooterActions, {
160
+ vertical: vertical,
161
+ children: [footerActions.map(function (action, index) {
162
+ var Component = action.role === 'lightpurple' ? StyledPrimaryButton : Button;
163
+ return jsx(Component, Object.assign({
164
+ isFluid: vertical,
165
+ size: "small"
166
+ }, action, {
167
+ children: action.children
168
+ }), index);
169
+ }), isNextActive ? jsx(StyledPrimaryButton, {
170
+ isFluid: vertical,
171
+ size: "small",
172
+ border: false,
173
+ tabIndex: 0,
174
+ transparent: false,
175
+ onClick: onNext,
176
+ customStyles: {
177
+ backgroundColor: theme.palette.primary.main,
178
+ color: theme.palette.primary.contrastText
179
+ },
180
+ children: intl.formatMessage({
181
+ id: 'materialQuiz.next'
182
+ })
183
+ }) : null]
184
+ })
185
+ });
186
+ var _renderAnchorSection = function _renderAnchorSection() {
187
+ var getCustomStyles = function getCustomStyles(active) {
188
+ return {
189
+ borderBottom: '3px solid currentColor',
190
+ background: 'none',
191
+ borderColor: active ? 'currentColor' : 'transparent',
192
+ color: active ? theme.palette.primary.main : theme.palette.secondary.light
193
+ };
194
+ };
195
+ return visibleAnchorSection && jsxs(StyledAnchorBox, {
196
+ children: [jsx(Button, {
197
+ size: "small",
198
+ border: false,
199
+ hasBorderRadius: false,
200
+ tabIndex: 0,
201
+ transparent: true,
202
+ onClick: scrollToElement.bind(null, MATERIAL_QUIZ_PASSIVE_ID),
203
+ customStyles: getCustomStyles(!isViewingAnswerContainer),
204
+ children: intl.formatMessage({
205
+ id: 'materialQuiz.anchorLabel.question'
206
+ })
207
+ }), jsx(Button, {
208
+ size: "small",
209
+ border: false,
210
+ hasBorderRadius: false,
211
+ tabIndex: 0,
212
+ transparent: true,
213
+ onClick: scrollToElement.bind(null, MATERIAL_QUIZ_ANSWER_ID),
214
+ customStyles: getCustomStyles(isViewingAnswerContainer),
215
+ children: intl.formatMessage({
216
+ id: 'materialQuiz.anchorLabel.answer'
217
+ })
218
+ })]
175
219
  });
176
- return visibleAnchorSection && React.createElement(StyledAnchorBox, null, React.createElement(Button, {
177
- size: "small",
178
- border: false,
179
- hasBorderRadius: false,
180
- tabIndex: 0,
181
- transparent: true,
182
- onClick: scrollToElement.bind(null, MATERIAL_QUIZ_PASSIVE_ID),
183
- customStyles: getCustomStyles(!isViewingAnswerContainer)
184
- }, intl.formatMessage({
185
- id: 'materialQuiz.anchorLabel.question'
186
- })), React.createElement(Button, {
187
- size: "small",
188
- border: false,
189
- hasBorderRadius: false,
190
- tabIndex: 0,
191
- transparent: true,
192
- onClick: scrollToElement.bind(null, MATERIAL_QUIZ_ANSWER_ID),
193
- customStyles: getCustomStyles(isViewingAnswerContainer)
194
- }, intl.formatMessage({
195
- id: 'materialQuiz.anchorLabel.answer'
196
- })));
197
220
  };
198
- const renderContent = () => {
199
- const content = React.createElement(React.Fragment, null, body, footerActions.length > 0 ? footer : null);
221
+ var renderContent = function renderContent() {
222
+ var content = jsxs(Fragment, {
223
+ children: [body, footerActions.length > 0 ? footer : null]
224
+ });
200
225
  if (vertical) {
201
- return React.createElement("div", {
226
+ return jsx("div", {
202
227
  ref: currentBodyRef,
203
228
  style: {
204
229
  height: '100%',
205
230
  overflow: 'auto'
206
- }
207
- }, content);
231
+ },
232
+ children: content
233
+ });
208
234
  }
209
235
  return content;
210
236
  };
211
- return React.createElement(StyledQuestionBox, Object.assign({}, props, {
212
- vertical: vertical
213
- }), header, renderContent(), _renderAnchorSection());
237
+ return jsxs(StyledQuestionBox, Object.assign({}, props, {
238
+ vertical: vertical,
239
+ children: [header, renderContent(), _renderAnchorSection()]
240
+ }));
214
241
  };
215
242
 
216
243
  export { StyledQuestionBox, QuestionBox as default };
@@ -1,17 +1,16 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import QuizDraggbleOption from './QuizDraggbleOption.js';
3
3
 
4
- const QuizDraggbleDroppedOption = ({
5
- id,
6
- content,
7
- disabled = false,
8
- role,
9
- indexOrder,
10
- isMarkdown
11
- }) => {
12
- return React.createElement(QuizDraggbleOption, {
4
+ var QuizDraggbleDroppedOption = function QuizDraggbleDroppedOption(_ref) {
5
+ var id = _ref.id,
6
+ content = _ref.content,
7
+ _ref$disabled = _ref.disabled,
8
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
9
+ role = _ref.role,
10
+ indexOrder = _ref.indexOrder,
11
+ isMarkdown = _ref.isMarkdown;
12
+ return jsx(QuizDraggbleOption, {
13
13
  id: id,
14
- key: id,
15
14
  content: content,
16
15
  className: "quiz-answer",
17
16
  disabled: disabled,
@@ -19,7 +18,7 @@ const QuizDraggbleDroppedOption = ({
19
18
  indexOrder: indexOrder,
20
19
  clone: true,
21
20
  isMarkdown: isMarkdown
22
- });
21
+ }, id);
23
22
  };
24
23
 
25
24
  export { QuizDraggbleDroppedOption as default };
@@ -1,28 +1,31 @@
1
- import React from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { Text } from '@elice/blocks';
3
3
  import { base } from '@elice/design-tokens';
4
4
  import styled from 'styled-components';
5
5
  import EbDroppable from '../eb-sortable/EbDroppable.js';
6
6
 
7
- const StyledQuizDraggbleDummyOption = styled(EbDroppable).withConfig({
7
+ var StyledQuizDraggbleDummyOption = styled(EbDroppable).withConfig({
8
8
  componentId: "sc-1ayp8c1-0"
9
9
  })(["display:flex;justify-content:space-between;align-items:center;border:1px dashed ", ";border-radius:8px;overflow:hidden;background-color:", ";padding:0.875rem 1rem;color:", ";font-size:0.875rem;&:not(:last-of-type){margin-bottom:1rem;}&.ui-droppable-hover{outline:1px dashed ", ";}"], base.color.navy4, base.color.navy5, base.color.navy0, base.color.navy0);
10
- const StyledOrder = styled.div.withConfig({
10
+ var StyledOrder = styled.div.withConfig({
11
11
  componentId: "sc-1ayp8c1-1"
12
12
  })(["width:1.5rem;height:1.5rem;display:flex;border-radius:4px;align-items:center;justify-content:center;color:", ";background-color:", ";flex:none;margin-left:0.5rem;"], base.color.navy0, base.color.navy4);
13
- const QuizDraggbleDummyOption = ({
14
- children,
15
- indexOrder,
16
- onDrop
17
- }) => {
18
- return React.createElement(StyledQuizDraggbleDummyOption, {
19
- onDrop: onDrop
20
- }, React.createElement(Text, {
21
- wordBreak: "break-all",
22
- customStyles: {
23
- color: base.color.navy0
24
- }
25
- }, children !== null && children !== void 0 ? children : 'drag here...'), React.createElement(StyledOrder, null, indexOrder));
13
+ var QuizDraggbleDummyOption = function QuizDraggbleDummyOption(_ref) {
14
+ var children = _ref.children,
15
+ indexOrder = _ref.indexOrder,
16
+ onDrop = _ref.onDrop;
17
+ return jsxs(StyledQuizDraggbleDummyOption, {
18
+ onDrop: onDrop,
19
+ children: [jsx(Text, {
20
+ wordBreak: "break-all",
21
+ customStyles: {
22
+ color: base.color.navy0
23
+ },
24
+ children: children !== null && children !== void 0 ? children : 'drag here...'
25
+ }), jsx(StyledOrder, {
26
+ children: indexOrder
27
+ })]
28
+ });
26
29
  };
27
30
 
28
31
  export { QuizDraggbleDummyOption as default };