@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,4 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
1
+ import React from 'react';
2
2
  import { IconButton, Text } from '@elice/blocks';
3
3
  import { base } from '@elice/design-tokens';
4
4
  import { eilMathsignMultiplyBasic } from '@elice/icons';
@@ -7,59 +7,55 @@ import styled from 'styled-components';
7
7
  import EbDraggable from '../../eb-sortable/EbDraggable.js';
8
8
  import { useMaterialQuizState } from '../context/MaterialQuizContext.js';
9
9
 
10
- var StyledDraggbleOption = styled(EbDraggable).withConfig({
10
+ const StyledDraggbleOption = styled(EbDraggable).withConfig({
11
11
  componentId: "sc-1b3vxse-0"
12
- })(["display:flex;flex-direction:column;flex-shrink:", ";overflow:hidden;max-width:", ";height:fit-content;border-radius:0.5rem;background:", ";"], function (_ref) {
13
- var vertical = _ref.vertical;
14
- return vertical ? 0 : 1;
15
- }, function (_ref2) {
16
- var vertical = _ref2.vertical;
17
- return vertical ? '10.25rem' : '11.5rem';
18
- }, base.color.navy8);
19
- var StyledOptionTitle = styled.div.withConfig({
12
+ })(["display:flex;flex-direction:column;flex-shrink:", ";overflow:hidden;max-width:", ";height:fit-content;border-radius:0.5rem;background:", ";"], ({
13
+ vertical
14
+ }) => vertical ? 0 : 1, ({
15
+ vertical
16
+ }) => vertical ? '10.25rem' : '11.5rem', base.color.navy8);
17
+ const StyledOptionTitle = styled.div.withConfig({
20
18
  componentId: "sc-1b3vxse-1"
21
- })(["display:flex;justify-content:center;align-items:center;width:", ";height:", ";padding:0.5rem;background:", ";"], function (_ref3) {
22
- var vertical = _ref3.vertical,
23
- isOptionContent = _ref3.isOptionContent;
24
- return isOptionContent ? '100%' : vertical ? '10.25rem' : '11.5rem';
25
- }, function (_ref4) {
26
- var vertical = _ref4.vertical,
27
- isOptionContent = _ref4.isOptionContent;
28
- return isOptionContent ? 'auto' : vertical ? '10.25rem' : '11.5rem';
29
- }, base.color.white);
30
- var StyledOptionContent = styled.div.withConfig({
19
+ })(["display:flex;justify-content:center;align-items:center;width:", ";height:", ";padding:0.5rem;background:", ";"], ({
20
+ vertical,
21
+ isOptionContent
22
+ }) => isOptionContent ? '100%' : vertical ? '10.25rem' : '11.5rem', ({
23
+ vertical,
24
+ isOptionContent
25
+ }) => isOptionContent ? 'auto' : vertical ? '10.25rem' : '11.5rem', base.color.white);
26
+ const StyledOptionContent = styled.div.withConfig({
31
27
  componentId: "sc-1b3vxse-2"
32
- })(["display:flex;align-items:center;width:", ";height:", ";background:", ";& p{line-height:1;}"], function (_ref5) {
33
- var vertical = _ref5.vertical;
34
- return vertical ? '10.25rem' : '11.5rem';
35
- }, function (_ref6) {
36
- var vertical = _ref6.vertical;
37
- return vertical ? '10.25rem' : '11.5rem';
38
- }, base.color.navy8);
39
- var StyledOptionRemoveIcon = styled(IconButton).withConfig({
28
+ })(["display:flex;align-items:center;width:", ";height:", ";background:", ";& p{line-height:1;}"], ({
29
+ vertical
30
+ }) => vertical ? '10.25rem' : '11.5rem', ({
31
+ vertical
32
+ }) => vertical ? '10.25rem' : '11.5rem', base.color.navy8);
33
+ const StyledOptionRemoveIcon = styled(IconButton).withConfig({
40
34
  componentId: "sc-1b3vxse-3"
41
35
  })(["position:absolute;top:0.5rem;right:0.5rem;border-radius:1rem;"]);
42
- var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref7) {
43
- var option = _ref7.option,
44
- onClose = _ref7.onClose;
36
+ const MaterialQuizGroupOptionItem = ({
37
+ option,
38
+ onClose
39
+ }) => {
45
40
  var _a;
46
- var _useMaterialQuizState = useMaterialQuizState(),
47
- vertical = _useMaterialQuizState.vertical,
48
- userId = _useMaterialQuizState.userId;
49
- var isOptionTitle = Boolean(option.options.title);
50
- var isOptionContent = Boolean(option.options.content);
51
- var renderRemoveItem = function renderRemoveItem() {
41
+ const {
42
+ vertical,
43
+ userId
44
+ } = useMaterialQuizState();
45
+ const isOptionTitle = Boolean(option.options.title);
46
+ const isOptionContent = Boolean(option.options.content);
47
+ const renderRemoveItem = () => {
52
48
  if (typeof onClose !== 'function') {
53
49
  return null;
54
50
  }
55
51
  if (!!userId) {
56
52
  return null;
57
53
  }
58
- return jsx(StyledOptionRemoveIcon, {
54
+ return React.createElement(StyledOptionRemoveIcon, {
59
55
  icon: eilMathsignMultiplyBasic,
60
56
  role: "gray1",
61
57
  size: "micro",
62
- onClick: function onClick(e) {
58
+ onClick: e => {
63
59
  e.stopPropagation();
64
60
  onClose();
65
61
  }
@@ -68,31 +64,27 @@ var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref7) {
68
64
  //
69
65
  //
70
66
  //
71
- return jsxs(StyledDraggbleOption, {
67
+ return React.createElement(StyledDraggbleOption, {
72
68
  disabled: !!userId || vertical,
73
69
  id: option.order.toString(),
74
70
  className: "quiz-answer",
71
+ vertical: vertical
72
+ }, isOptionContent ? React.createElement(StyledOptionContent, {
73
+ vertical: vertical
74
+ }, React.createElement(MarkdownSSR, {
75
+ children: (_a = option.options.content) !== null && _a !== void 0 ? _a : '',
76
+ paddingx: 0,
77
+ paddingy: 0,
78
+ dark: true
79
+ })) : null, isOptionTitle ? React.createElement(StyledOptionTitle, {
75
80
  vertical: vertical,
76
- children: [isOptionContent ? jsx(StyledOptionContent, {
77
- vertical: vertical,
78
- children: jsx(MarkdownSSR, {
79
- children: (_a = option.options.content) !== null && _a !== void 0 ? _a : '',
80
- paddingx: 0,
81
- paddingy: 0,
82
- dark: true
83
- })
84
- }) : null, isOptionTitle ? jsx(StyledOptionTitle, {
85
- vertical: vertical,
86
- isOptionContent: isOptionContent,
87
- children: jsx(Text, {
88
- size: vertical ? 'small' : 'default',
89
- textAlign: "center",
90
- wordBreak: "break-all",
91
- bold: true,
92
- children: option.options.title
93
- })
94
- }) : null, renderRemoveItem()]
95
- });
81
+ isOptionContent: isOptionContent
82
+ }, React.createElement(Text, {
83
+ size: vertical ? 'small' : 'default',
84
+ textAlign: "center",
85
+ wordBreak: "break-all",
86
+ bold: true
87
+ }, option.options.title)) : null, renderRemoveItem());
96
88
  };
97
89
 
98
90
  export { MaterialQuizGroupOptionItem as default };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
 
3
- var QuizGroupContext = React.createContext(null);
3
+ const QuizGroupContext = React.createContext(null);
4
4
 
5
5
  export { QuizGroupContext as default };
@@ -1,4 +1,3 @@
1
- import { jsx } from 'react/jsx-runtime';
2
1
  import React, { forwardRef } from 'react';
3
2
  import { useForm, FormProvider } from 'react-hook-form';
4
3
  import { RawEliceIntlProvider, IntlComponentBuilder } from '@elice/intl';
@@ -9,28 +8,29 @@ import messageEn from './locales/en.json.js';
9
8
  import messageKo from './locales/ko.json.js';
10
9
  import MaterialQuizEditContent from './MaterialQuizEditContent.js';
11
10
 
12
- var MaterialQuizEdit = forwardRef(function (_ref, ref) {
13
- var value = _ref.value,
14
- _ref$disabled = _ref.disabled,
15
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
16
- onChange = _ref.onChange,
17
- onFormStateChange = _ref.onFormStateChange,
18
- onFileUploadRequest = _ref.onFileUploadRequest,
19
- __intl = _ref.__intl;
20
- var formElRef = React.useRef(null);
21
- var useFormMethods = useForm({
11
+ const MaterialQuizEdit = forwardRef(({
12
+ value,
13
+ disabled = false,
14
+ onChange,
15
+ onFormStateChange,
16
+ onFileUploadRequest,
17
+ __intl
18
+ }, ref) => {
19
+ const formElRef = React.useRef(null);
20
+ const useFormMethods = useForm({
22
21
  defaultValues: manipulateValue(value),
23
22
  mode: 'onBlur'
24
23
  });
25
- var watchedMaterialQuizEditValue = useFormMethods.watch();
26
- var _useFormMethods$formS = useFormMethods.formState,
27
- isDirty = _useFormMethods$formS.isDirty,
28
- isValid = _useFormMethods$formS.isValid;
24
+ const watchedMaterialQuizEditValue = useFormMethods.watch();
25
+ const {
26
+ isDirty,
27
+ isValid
28
+ } = useFormMethods.formState;
29
29
  //
30
30
  // Reset from value, when `value` changes.
31
31
  // TODO: will be removed, since `CourseLecturesMaterialTemplate` removed at `elice-web`.
32
32
  //
33
- useDeepClonedCompareEffect(function () {
33
+ useDeepClonedCompareEffect(() => {
34
34
  useFormMethods.reset(manipulateValue(value), {
35
35
  keepDirty: true,
36
36
  keepErrors: true,
@@ -44,17 +44,17 @@ var MaterialQuizEdit = forwardRef(function (_ref, ref) {
44
44
  // Emit `onChange` handler when form value changed.
45
45
  // TODO: will be removed, since `CourseLecturesMaterialTemplate` removed at `elice-web`.
46
46
  //
47
- useDeepClonedCompareEffect(function () {
47
+ useDeepClonedCompareEffect(() => {
48
48
  onChange(restoreValue(watchedMaterialQuizEditValue));
49
49
  }, [watchedMaterialQuizEditValue]);
50
50
  //
51
51
  // Emit `onFormStateChange` handler when form state change.
52
52
  //
53
- React.useEffect(function () {
53
+ React.useEffect(() => {
54
54
  if (typeof onFormStateChange === 'function') {
55
55
  onFormStateChange({
56
- isDirty: isDirty,
57
- isValid: isValid
56
+ isDirty,
57
+ isValid
58
58
  });
59
59
  }
60
60
  },
@@ -63,32 +63,25 @@ var MaterialQuizEdit = forwardRef(function (_ref, ref) {
63
63
  //
64
64
  // Set ref.
65
65
  //
66
- React.useImperativeHandle(ref, function () {
67
- return Object.assign(Object.assign({}, formElRef.current), {
68
- reset: function reset() {
69
- useFormMethods.reset(manipulateValue(value));
70
- void useFormMethods.trigger();
71
- }
72
- });
73
- }, [useFormMethods, value]);
66
+ React.useImperativeHandle(ref, () => Object.assign(Object.assign({}, formElRef.current), {
67
+ reset: () => {
68
+ useFormMethods.reset(manipulateValue(value));
69
+ void useFormMethods.trigger();
70
+ }
71
+ }), [useFormMethods, value]);
74
72
  //
75
73
  //
76
74
  //
77
- return jsx(RawEliceIntlProvider, {
78
- value: __intl,
79
- children: jsx("form", {
80
- ref: formElRef,
81
- children: jsx(MaterialQuizEditContext.Provider, {
82
- value: {
83
- disabled: disabled,
84
- onFileUploadRequest: onFileUploadRequest
85
- },
86
- children: jsx(FormProvider, Object.assign({}, useFormMethods, {
87
- children: jsx(MaterialQuizEditContent, {})
88
- }))
89
- })
90
- })
91
- });
75
+ return React.createElement(RawEliceIntlProvider, {
76
+ value: __intl
77
+ }, React.createElement("form", {
78
+ ref: formElRef
79
+ }, React.createElement(MaterialQuizEditContext.Provider, {
80
+ value: {
81
+ disabled,
82
+ onFileUploadRequest
83
+ }
84
+ }, React.createElement(FormProvider, Object.assign({}, useFormMethods), React.createElement(MaterialQuizEditContent, null)))));
92
85
  });
93
86
  var MaterialQuizEdit$1 = new IntlComponentBuilder(MaterialQuizEdit).add('en', messageEn).add('ko', messageKo).addAsync('th', import('./locales/th.json.js')).addAsync('ja', import('./locales/ja.json.js')).build();
94
87