@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 { Flex, Button, Vspace, Text, Icon } from '@elice/blocks';
4
3
  import { base } from '@elice/design-tokens';
@@ -10,169 +9,141 @@ import { useMaterialQuizState } from '../context/MaterialQuizContext.js';
10
9
  import QuizGroupContext from './context/context.js';
11
10
  import MaterialQuizGroupOptionItem from './MaterialQuizGroupOptionItem.js';
12
11
 
13
- var QUIZ_OPTIONS_CONTENT_WIDTH = 534;
14
- var StyledQuizAnswerWrapper = styled.div.withConfig({
12
+ const QUIZ_OPTIONS_CONTENT_WIDTH = 534;
13
+ const StyledQuizAnswerWrapper = styled.div.withConfig({
15
14
  componentId: "sc-18trt81-0"
16
15
  })(["display:flex;flex-direction:column;flex:0 0 calc((100% - ", "px) / 2);"], QUIZ_OPTIONS_CONTENT_WIDTH);
17
- var StyledQuizAnswerDropzoneWrapper = styled.div.withConfig({
16
+ const StyledQuizAnswerDropzoneWrapper = styled.div.withConfig({
18
17
  componentId: "sc-18trt81-1"
19
18
  })(["padding:1rem;border-radius:0.5rem;background:", ";&:not(:last-child){margin-bottom:1rem;}"], base.color.white);
20
- var StyledQuizAnswerDropzone = styled(EbDroppable).withConfig({
19
+ const StyledQuizAnswerDropzone = styled(EbDroppable).withConfig({
21
20
  componentId: "sc-18trt81-2"
22
- })(["display:flex;flex-wrap:wrap;gap:0.5rem;justify-content:", ";align-items:", ";min-width:12.5rem;min-height:16.25rem;padding:0.5rem;border-radius:0.5rem;background:", ";text-align:center;outline:1px dashed ", ";&.ui-droppable-hover{outline:1px dashed ", ";}"], function (_ref) {
23
- var isGroupAnswer = _ref.isGroupAnswer;
24
- return isGroupAnswer ? 'flex-start' : 'center';
25
- }, function (_ref2) {
26
- var isGroupAnswer = _ref2.isGroupAnswer;
27
- return isGroupAnswer ? 'flex-start' : 'center';
28
- }, base.color.gray1, base.color.gray3, base.color.navy4);
29
- var StyledQuizOptions = styled.div.withConfig({
21
+ })(["display:flex;flex-wrap:wrap;gap:0.5rem;justify-content:", ";align-items:", ";min-width:12.5rem;min-height:16.25rem;padding:0.5rem;border-radius:0.5rem;background:", ";text-align:center;outline:1px dashed ", ";&.ui-droppable-hover{outline:1px dashed ", ";}"], ({
22
+ isGroupAnswer
23
+ }) => isGroupAnswer ? 'flex-start' : 'center', ({
24
+ isGroupAnswer
25
+ }) => isGroupAnswer ? 'flex-start' : 'center', base.color.gray1, base.color.gray3, base.color.navy4);
26
+ const StyledQuizOptions = styled.div.withConfig({
30
27
  componentId: "sc-18trt81-3"
31
28
  })(["display:flex;flex-direction:column;width:26.125rem;height:fit-content;padding:1rem;background-color:", ";border-radius:0.5rem;outline:1px dashed ", ";"], base.color.navy6, base.color.navy4);
32
- var StyledQuizOptionsDropzone = styled(EbDroppable).withConfig({
29
+ const StyledQuizOptionsDropzone = styled(EbDroppable).withConfig({
33
30
  componentId: "sc-18trt81-4"
34
31
  })(["display:flex;flex-wrap:wrap;gap:1rem;min-height:10.25rem;border-radius:0.5rem;outline:1px dashed ", ";&.ui-droppable-hover{outline:1px dashed ", ";}"], base.color.navy4, base.color.gray4);
35
- var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop() {
36
- var intl = useRawEliceIntl();
37
- var _useMaterialQuizState = useMaterialQuizState(),
38
- userId = _useMaterialQuizState.userId;
39
- var _React$useContext = React.useContext(QuizGroupContext),
40
- groupList = _React$useContext.groupList,
41
- currentAnswerList = _React$useContext.currentAnswerList,
42
- currentOptionList = _React$useContext.currentOptionList,
43
- updateCurrentAnswer = _React$useContext.updateCurrentAnswer,
44
- updateCurrentOption = _React$useContext.updateCurrentOption,
45
- handleAnswerReset = _React$useContext.handleAnswerReset;
32
+ const MaterialQuizGroupDesktop = () => {
33
+ const intl = useRawEliceIntl();
34
+ const {
35
+ userId
36
+ } = useMaterialQuizState();
37
+ const {
38
+ groupList,
39
+ currentAnswerList,
40
+ currentOptionList,
41
+ updateCurrentAnswer,
42
+ updateCurrentOption,
43
+ handleAnswerReset
44
+ } = React.useContext(QuizGroupContext);
46
45
  /**
47
46
  *
48
47
  */
49
- var renderQuizContentSortation = function renderQuizContentSortation() {
50
- return jsx(Flex, {
48
+ const renderQuizContentSortation = () => {
49
+ return React.createElement(Flex, {
51
50
  align: "center",
52
- margin: "0 1.25rem",
53
- children: jsx(Icon, {
54
- size: "large",
55
- icon: eilSortItem,
56
- rotate: 90,
57
- color: "white"
58
- })
59
- });
51
+ margin: "0 1.25rem"
52
+ }, React.createElement(Icon, {
53
+ size: "large",
54
+ icon: eilSortItem,
55
+ rotate: 90,
56
+ color: "white"
57
+ }));
60
58
  };
61
59
  /**
62
60
  *
63
61
  */
64
- var renderQuizGroupAnswer = function renderQuizGroupAnswer(title, dropzoneIndex) {
62
+ const renderQuizGroupAnswer = (title, dropzoneIndex) => {
65
63
  var _a, _b;
66
- var isGroupAnswer = Boolean((_a = currentAnswerList[dropzoneIndex]) === null || _a === void 0 ? void 0 : _a.length);
67
- return jsxs(StyledQuizAnswerDropzoneWrapper, {
68
- children: [jsx(Text, {
69
- size: "large",
70
- bold: true,
71
- children: title
72
- }), jsx(Vspace, {
73
- height: 1
74
- }), jsx(StyledQuizAnswerDropzone, {
75
- accept: ".quiz-answer",
76
- disabled: !!userId,
77
- isGroupAnswer: isGroupAnswer,
78
- onDrop: function onDrop(event, ui) {
79
- var targetId = Number(ui.draggable[0].id);
80
- updateCurrentAnswer(targetId, dropzoneIndex);
81
- },
82
- children: isGroupAnswer ? (_b = currentAnswerList[dropzoneIndex]) === null || _b === void 0 ? void 0 : _b.map(function (answer, index) {
83
- return jsx(MaterialQuizGroupOptionItem, {
84
- option: answer
85
- }, index);
86
- }) : jsx(Text, {
87
- role: "gray5",
88
- bold: true,
89
- children: intl.formatMessage({
90
- id: 'materialQuiz.dropzone.desktop.answerEmpty'
91
- })
92
- })
93
- })]
94
- });
64
+ const isGroupAnswer = Boolean((_a = currentAnswerList[dropzoneIndex]) === null || _a === void 0 ? void 0 : _a.length);
65
+ return React.createElement(StyledQuizAnswerDropzoneWrapper, null, React.createElement(Text, {
66
+ size: "large",
67
+ bold: true
68
+ }, title), React.createElement(Vspace, {
69
+ height: 1
70
+ }), React.createElement(StyledQuizAnswerDropzone, {
71
+ accept: ".quiz-answer",
72
+ disabled: !!userId,
73
+ isGroupAnswer: isGroupAnswer,
74
+ onDrop: (event, ui) => {
75
+ const targetId = Number(ui.draggable[0].id);
76
+ updateCurrentAnswer(targetId, dropzoneIndex);
77
+ }
78
+ }, isGroupAnswer ? (_b = currentAnswerList[dropzoneIndex]) === null || _b === void 0 ? void 0 : _b.map((answer, index) => React.createElement(MaterialQuizGroupOptionItem, {
79
+ key: index,
80
+ option: answer
81
+ })) : React.createElement(Text, {
82
+ role: "gray5",
83
+ bold: true
84
+ }, intl.formatMessage({
85
+ id: 'materialQuiz.dropzone.desktop.answerEmpty'
86
+ }))));
95
87
  };
96
88
  /**
97
89
  *
98
90
  */
99
- var renderQuizContentLeft = function renderQuizContentLeft() {
100
- return jsx(StyledQuizAnswerWrapper, {
101
- children: groupList.filter(function (_, index) {
102
- return !(index % 2);
103
- }).map(function (group, index) {
104
- return jsx(React.Fragment, {
105
- children: renderQuizGroupAnswer(group, index * 2)
106
- }, index);
107
- })
108
- });
91
+ const renderQuizContentLeft = () => {
92
+ return React.createElement(StyledQuizAnswerWrapper, null, groupList.filter((_, index) => !(index % 2)).map((group, index) => React.createElement(React.Fragment, {
93
+ key: index
94
+ }, renderQuizGroupAnswer(group, index * 2))));
109
95
  };
110
96
  /**
111
97
  *
112
98
  */
113
- var renderQuizContentRight = function renderQuizContentRight() {
114
- return jsx(StyledQuizAnswerWrapper, {
115
- children: groupList.filter(function (_, index) {
116
- return index % 2;
117
- }).map(function (group, index) {
118
- return jsx(React.Fragment, {
119
- children: renderQuizGroupAnswer(group, index * 2 + 1)
120
- }, index);
121
- })
122
- });
99
+ const renderQuizContentRight = () => {
100
+ return React.createElement(StyledQuizAnswerWrapper, null, groupList.filter((_, index) => index % 2).map((group, index) => React.createElement(React.Fragment, {
101
+ key: index
102
+ }, renderQuizGroupAnswer(group, index * 2 + 1))));
123
103
  };
124
104
  /**
125
105
  *
126
106
  */
127
- var renderQuizContentOption = function renderQuizContentOption() {
128
- return jsxs(Flex, {
129
- height: "fit-content",
130
- children: [renderQuizContentSortation(), jsxs(StyledQuizOptions, {
131
- children: [jsx(Button, {
132
- role: "white",
133
- size: "small",
134
- disabled: !!userId,
135
- onClick: handleAnswerReset,
136
- children: intl.formatMessage({
137
- id: 'materialQuiz.dropzone.optionReset'
138
- })
139
- }), jsx(Vspace, {
140
- height: 1
141
- }), jsx(StyledQuizOptionsDropzone, {
142
- accept: ".quiz-answer",
143
- onDrop: function onDrop(event, ui) {
144
- var targetId = Number(ui.draggable[0].id);
145
- updateCurrentOption(targetId);
146
- },
147
- children: currentOptionList.length ? currentOptionList.map(function (option, index) {
148
- return jsx(MaterialQuizGroupOptionItem, {
149
- option: option
150
- }, index);
151
- }) : jsx(Flex, {
152
- justify: "center",
153
- align: "center",
154
- width: "100%",
155
- children: jsx(Text, {
156
- role: "navy",
157
- textAlign: "center",
158
- bold: true,
159
- children: intl.formatMessage({
160
- id: 'materialQuiz.dropzone.optionEmpty'
161
- })
162
- })
163
- })
164
- })]
165
- }), renderQuizContentSortation()]
166
- });
107
+ const renderQuizContentOption = () => {
108
+ return React.createElement(Flex, {
109
+ height: "fit-content"
110
+ }, renderQuizContentSortation(), React.createElement(StyledQuizOptions, null, React.createElement(Button, {
111
+ role: "white",
112
+ size: "small",
113
+ disabled: !!userId,
114
+ onClick: handleAnswerReset
115
+ }, intl.formatMessage({
116
+ id: 'materialQuiz.dropzone.optionReset'
117
+ })), React.createElement(Vspace, {
118
+ height: 1
119
+ }), React.createElement(StyledQuizOptionsDropzone, {
120
+ accept: ".quiz-answer",
121
+ onDrop: (event, ui) => {
122
+ const targetId = Number(ui.draggable[0].id);
123
+ updateCurrentOption(targetId);
124
+ }
125
+ }, currentOptionList.length ? currentOptionList.map((option, index) => React.createElement(MaterialQuizGroupOptionItem, {
126
+ key: index,
127
+ option: option
128
+ })) : React.createElement(Flex, {
129
+ justify: "center",
130
+ align: "center",
131
+ width: "100%"
132
+ }, React.createElement(Text, {
133
+ role: "navy",
134
+ textAlign: "center",
135
+ bold: true
136
+ }, intl.formatMessage({
137
+ id: 'materialQuiz.dropzone.optionEmpty'
138
+ }))))), renderQuizContentSortation());
167
139
  };
168
140
  //
169
141
  //
170
142
  //
171
- return jsxs(Flex, {
143
+ return React.createElement(Flex, {
172
144
  width: "100%",
173
- height: "100%",
174
- children: [renderQuizContentLeft(), renderQuizContentOption(), renderQuizContentRight()]
175
- });
145
+ height: "100%"
146
+ }, renderQuizContentLeft(), renderQuizContentOption(), renderQuizContentRight());
176
147
  };
177
148
 
178
149
  export { MaterialQuizGroupDesktop as default };
@@ -1,5 +1,3 @@
1
- import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
1
  import React from 'react';
4
2
  import { Button, Vspace, Text, BottomSheet } from '@elice/blocks';
5
3
  import { base } from '@elice/design-tokens';
@@ -9,158 +7,136 @@ import { useMaterialQuizState } from '../context/MaterialQuizContext.js';
9
7
  import QuizGroupContext from './context/context.js';
10
8
  import MaterialQuizGroupOptionItem from './MaterialQuizGroupOptionItem.js';
11
9
 
12
- var StyledQuizGroupWrapper = styled.div.withConfig({
10
+ const StyledQuizGroupWrapper = styled.div.withConfig({
13
11
  componentId: "sc-bftjpj-0"
14
12
  })(["display:flex;flex-direction:column;overflow:hidden;width:100%;padding:1rem;background:", ";border-radius:0.5rem;&:hover{cursor:pointer;}&:not(:last-child){margin-bottom:1rem;}"], base.color.white);
15
- var StyledQuizOptionList = styled.div.withConfig({
13
+ const StyledQuizOptionList = styled.div.withConfig({
16
14
  componentId: "sc-bftjpj-1"
17
- })(["display:flex;align-items:", ";gap:0.5rem;overflow-x:auto;min-height:223px;padding:1rem;border-radius:0.5rem;background:", ";outline-color:", ";"], function (_ref) {
18
- var isCurrentOptionList = _ref.isCurrentOptionList;
19
- return isCurrentOptionList ? 'flex-start' : 'center';
20
- }, base.color.gray1, base.color.gray3);
21
- var StyledQuizOptionItem = styled.div.withConfig({
15
+ })(["display:flex;align-items:", ";gap:0.5rem;overflow-x:auto;min-height:223px;padding:1rem;border-radius:0.5rem;background:", ";outline-color:", ";"], ({
16
+ isCurrentOptionList
17
+ }) => isCurrentOptionList ? 'flex-start' : 'center', base.color.gray1, base.color.gray3);
18
+ const StyledQuizOptionItem = styled.div.withConfig({
22
19
  componentId: "sc-bftjpj-2"
23
20
  })(["&:hover{cursor:pointer;}"]);
24
- var StyledBottomSheetWrapper = styled(StyledQuizOptionList).withConfig({
21
+ const StyledBottomSheetWrapper = styled(StyledQuizOptionList).withConfig({
25
22
  componentId: "sc-bftjpj-3"
26
- })(["align-items:", ";padding:0.5rem;"], function (_ref2) {
27
- var vertical = _ref2.vertical,
28
- isCurrentOptionList = _ref2.isCurrentOptionList;
29
- return vertical && isCurrentOptionList ? 'flex-start' : 'center';
30
- });
31
- var MaterialQuizGroupMobile = function MaterialQuizGroupMobile() {
32
- var intl = useRawEliceIntl();
23
+ })(["align-items:", ";padding:0.5rem;"], ({
24
+ vertical,
25
+ isCurrentOptionList
26
+ }) => vertical && isCurrentOptionList ? 'flex-start' : 'center');
27
+ const MaterialQuizGroupMobile = () => {
28
+ const intl = useRawEliceIntl();
33
29
  // context
34
- var _useMaterialQuizState = useMaterialQuizState(),
35
- materialQuiz = _useMaterialQuizState.materialQuiz,
36
- userId = _useMaterialQuizState.userId,
37
- vertical = _useMaterialQuizState.vertical;
38
- var _React$useContext = React.useContext(QuizGroupContext),
39
- currentOptionList = _React$useContext.currentOptionList,
40
- currentAnswerList = _React$useContext.currentAnswerList,
41
- updateCurrentAnswer = _React$useContext.updateCurrentAnswer,
42
- updateCurrentOption = _React$useContext.updateCurrentOption,
43
- handleAnswerReset = _React$useContext.handleAnswerReset;
44
- var _React$useState = React.useState(null),
45
- _React$useState2 = _slicedToArray(_React$useState, 2),
46
- dropzoneIndex = _React$useState2[0],
47
- setDropzoneIndex = _React$useState2[1];
30
+ const {
31
+ materialQuiz,
32
+ userId,
33
+ vertical
34
+ } = useMaterialQuizState();
35
+ const {
36
+ currentOptionList,
37
+ currentAnswerList,
38
+ updateCurrentAnswer,
39
+ updateCurrentOption,
40
+ handleAnswerReset
41
+ } = React.useContext(QuizGroupContext);
42
+ const [dropzoneIndex, setDropzoneIndex] = React.useState(null);
48
43
  /**
49
44
  *
50
45
  */
51
- var renderResetButton = function renderResetButton() {
52
- return jsxs(Fragment, {
53
- children: [jsx(Button, {
54
- role: "white",
55
- size: "small",
56
- disabled: !!userId,
57
- onClick: handleAnswerReset,
58
- block: true,
59
- children: intl.formatMessage({
60
- id: 'materialQuiz.dropzone.optionReset'
61
- })
62
- }), jsx(Vspace, {
63
- height: 1
64
- })]
65
- });
46
+ const renderResetButton = () => {
47
+ return React.createElement(React.Fragment, null, React.createElement(Button, {
48
+ role: "white",
49
+ size: "small",
50
+ disabled: !!userId,
51
+ onClick: handleAnswerReset,
52
+ block: true
53
+ }, intl.formatMessage({
54
+ id: 'materialQuiz.dropzone.optionReset'
55
+ })), React.createElement(Vspace, {
56
+ height: 1
57
+ }));
66
58
  };
67
59
  /**
68
60
  *
69
61
  */
70
- var renderGroupList = function renderGroupList() {
62
+ const renderGroupList = () => {
71
63
  var _a;
72
- return jsx(Fragment, {
73
- children: (_a = materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.groups) === null || _a === void 0 ? void 0 : _a.map(function (group, index) {
74
- var _a;
75
- var isCurrentOptionList = Boolean((_a = currentAnswerList === null || currentAnswerList === void 0 ? void 0 : currentAnswerList[index]) === null || _a === void 0 ? void 0 : _a.length);
76
- return jsxs(StyledQuizGroupWrapper, {
77
- onClick: function onClick() {
78
- return setDropzoneIndex(index);
79
- },
80
- children: [jsx(Text, {
81
- size: "small",
82
- bold: true,
83
- children: group
84
- }), jsx(Vspace, {
85
- height: 0.5
86
- }), jsx(StyledQuizOptionList, {
87
- isCurrentOptionList: isCurrentOptionList,
88
- children: isCurrentOptionList ? currentAnswerList[index].map(function (answer) {
89
- return jsx(MaterialQuizGroupOptionItem, {
90
- option: answer,
91
- onClose: function onClose() {
92
- var targetId = answer.order;
93
- updateCurrentOption(targetId);
94
- }
95
- }, answer.order);
96
- }) : jsx(Text, {
97
- role: "gray6",
98
- size: "small",
99
- textAlign: "center",
100
- bold: true,
101
- block: true,
102
- children: intl.formatMessage({
103
- id: 'materialQuiz.dropzone.mobile.answerEmpty'
104
- })
105
- })
106
- })]
107
- }, index);
108
- })
109
- });
64
+ return React.createElement(React.Fragment, null, (_a = materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.groups) === null || _a === void 0 ? void 0 : _a.map((group, index) => {
65
+ var _a;
66
+ const isCurrentOptionList = Boolean((_a = currentAnswerList === null || currentAnswerList === void 0 ? void 0 : currentAnswerList[index]) === null || _a === void 0 ? void 0 : _a.length);
67
+ return React.createElement(StyledQuizGroupWrapper, {
68
+ key: index,
69
+ onClick: () => setDropzoneIndex(index)
70
+ }, React.createElement(Text, {
71
+ size: "small",
72
+ bold: true
73
+ }, group), React.createElement(Vspace, {
74
+ height: 0.5
75
+ }), React.createElement(StyledQuizOptionList, {
76
+ isCurrentOptionList: isCurrentOptionList
77
+ }, isCurrentOptionList ? currentAnswerList[index].map(answer => React.createElement(MaterialQuizGroupOptionItem, {
78
+ key: answer.order,
79
+ option: answer,
80
+ onClose: () => {
81
+ const targetId = answer.order;
82
+ updateCurrentOption(targetId);
83
+ }
84
+ })) : React.createElement(Text, {
85
+ role: "gray6",
86
+ size: "small",
87
+ textAlign: "center",
88
+ bold: true,
89
+ block: true
90
+ }, intl.formatMessage({
91
+ id: 'materialQuiz.dropzone.mobile.answerEmpty'
92
+ }))));
93
+ }));
110
94
  };
111
95
  /**
112
96
  *
113
97
  */
114
- var renderOptionListBottomSheet = function renderOptionListBottomSheet() {
115
- var isCurrentOptionList = Boolean(currentOptionList.length);
116
- return jsx(BottomSheet, {
98
+ const renderOptionListBottomSheet = () => {
99
+ const isCurrentOptionList = Boolean(currentOptionList.length);
100
+ return React.createElement(BottomSheet, {
117
101
  show: dropzoneIndex !== null,
118
102
  title: intl.formatMessage({
119
103
  id: 'materialQuiz.bottomSheet.title'
120
104
  }),
121
105
  contentsText: "",
122
106
  disableSwipeGesture: true,
123
- onClose: function onClose() {
124
- return setDropzoneIndex(null);
125
- },
126
- children: jsx(StyledBottomSheetWrapper, {
127
- vertical: vertical,
128
- isCurrentOptionList: isCurrentOptionList,
129
- children: isCurrentOptionList ? currentOptionList === null || currentOptionList === void 0 ? void 0 : currentOptionList.map(function (option, index) {
130
- return jsx(StyledQuizOptionItem, {
131
- onClick: function onClick() {
132
- var targetId = option.order;
133
- if (dropzoneIndex === null) {
134
- return;
135
- }
136
- if (!!userId) {
137
- return;
138
- }
139
- updateCurrentAnswer(targetId, dropzoneIndex);
140
- },
141
- children: jsx(MaterialQuizGroupOptionItem, {
142
- option: option
143
- }, index)
144
- }, index);
145
- }) : jsx(Text, {
146
- role: "gray6",
147
- size: "small",
148
- textAlign: "center",
149
- bold: true,
150
- block: true,
151
- children: intl.formatMessage({
152
- id: 'materialQuiz.bottomSheet.optionEmpty'
153
- })
154
- })
155
- })
156
- });
107
+ onClose: () => setDropzoneIndex(null)
108
+ }, React.createElement(StyledBottomSheetWrapper, {
109
+ vertical: vertical,
110
+ isCurrentOptionList: isCurrentOptionList
111
+ }, isCurrentOptionList ? currentOptionList === null || currentOptionList === void 0 ? void 0 : currentOptionList.map((option, index) => React.createElement(StyledQuizOptionItem, {
112
+ key: index,
113
+ onClick: () => {
114
+ const targetId = option.order;
115
+ if (dropzoneIndex === null) {
116
+ return;
117
+ }
118
+ if (!!userId) {
119
+ return;
120
+ }
121
+ updateCurrentAnswer(targetId, dropzoneIndex);
122
+ }
123
+ }, React.createElement(MaterialQuizGroupOptionItem, {
124
+ key: index,
125
+ option: option
126
+ }))) : React.createElement(Text, {
127
+ role: "gray6",
128
+ size: "small",
129
+ textAlign: "center",
130
+ bold: true,
131
+ block: true
132
+ }, intl.formatMessage({
133
+ id: 'materialQuiz.bottomSheet.optionEmpty'
134
+ }))));
157
135
  };
158
136
  //
159
137
  //
160
138
  //
161
- return jsxs(Fragment, {
162
- children: [renderResetButton(), renderGroupList(), renderOptionListBottomSheet()]
163
- });
139
+ return React.createElement(React.Fragment, null, renderResetButton(), renderGroupList(), renderOptionListBottomSheet());
164
140
  };
165
141
 
166
142
  export { MaterialQuizGroupMobile as default };