@elice/material-quiz 1.240718.0-trasncript.2 → 1.240718.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/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 { Icon, Text } from '@elice/blocks';
3
3
  import { base } from '@elice/design-tokens';
4
4
  import { eilDraggableVertical } from '@elice/icons';
@@ -7,23 +7,25 @@ import EbDraggable from '../eb-sortable/EbDraggable.js';
7
7
  import { useMaterialQuizState } from '../material-quiz/context/MaterialQuizContext.js';
8
8
  import StyledMarkdown from './StyledMarkdown.js';
9
9
 
10
- var StyledQuizDraggbleOptionHandle = styled.div.withConfig({
10
+ const StyledQuizDraggbleOptionHandle = styled.div.withConfig({
11
11
  componentId: "sc-19b0zkq-0"
12
12
  })(["display:flex;align-items:center;justify-content:center;background-color:", ";width:1.5rem;flex:none;"], base.color.navy5);
13
- var StyledQuizDraggbleOptionContent = styled.div.withConfig({
13
+ const StyledQuizDraggbleOptionContent = styled.div.withConfig({
14
14
  componentId: "sc-19b0zkq-1"
15
- })(["display:flex;justify-content:space-between;min-width:0;align-items:center;flex:auto;padding:0.875rem 1rem;line-height:24px;border:", ";background-color:", ";"], function (_ref) {
16
- var role = _ref.role;
15
+ })(["display:flex;justify-content:space-between;min-width:0;align-items:center;flex:auto;padding:0.875rem 1rem;line-height:24px;border:", ";background-color:", ";"], ({
16
+ role
17
+ }) => {
17
18
  switch (role) {
18
19
  case 'correct':
19
- return "1px solid ".concat(base.color.primary6);
20
+ return `1px solid ${base.color.primary6}`;
20
21
  case 'wrong':
21
- return "1px solid ".concat(base.color.red6);
22
+ return `1px solid ${base.color.red6}`;
22
23
  default:
23
24
  return '';
24
25
  }
25
- }, function (_ref2) {
26
- var role = _ref2.role;
26
+ }, ({
27
+ role
28
+ }) => {
27
29
  switch (role) {
28
30
  case 'answer':
29
31
  return base.color.primary6;
@@ -31,13 +33,14 @@ var StyledQuizDraggbleOptionContent = styled.div.withConfig({
31
33
  return '';
32
34
  }
33
35
  });
34
- var StyledOrder = styled.div.withConfig({
36
+ const StyledOrder = styled.div.withConfig({
35
37
  componentId: "sc-19b0zkq-2"
36
38
  })(["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);
37
- var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
39
+ const StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
38
40
  componentId: "sc-19b0zkq-3"
39
- })(["display:flex;border-radius:8px;border:1px solid ", ";background-color:", ";overflow:hidden;z-index:980 !important;&:not(:last-of-type){margin-bottom:1rem;}", "{background-color:", ";color:", ";}", "{background-color:", ";& *{color:", ";}}", "{background-color:", ";color:", ";}&.ui-draggable-dragging{z-index:1000 !important;color:", " !important;border:none !important;", "{background-color:", ";}", "{background-color:", ";border:1px solid ", " !important;}", "{color:", ";background-color:", ";}& *{color:", " !important;}}&.ui-draggable-dragging.quiz-answer{width:calc(100% - 1rem * 2);}"], base.color.navy4, base.color.navy5, StyledQuizDraggbleOptionHandle, function (_ref3) {
40
- var role = _ref3.role;
41
+ })(["display:flex;border-radius:8px;border:1px solid ", ";background-color:", ";overflow:hidden;z-index:980 !important;&:not(:last-of-type){margin-bottom:1rem;}", "{background-color:", ";color:", ";}", "{background-color:", ";& *{color:", ";}}", "{background-color:", ";color:", ";}&.ui-draggable-dragging{z-index:1000 !important;color:", " !important;border:none !important;", "{background-color:", ";}", "{background-color:", ";border:1px solid ", " !important;}", "{color:", ";background-color:", ";}& *{color:", " !important;}}&.ui-draggable-dragging.quiz-answer{width:calc(100% - 1rem * 2);}"], base.color.navy4, base.color.navy5, StyledQuizDraggbleOptionHandle, ({
42
+ role
43
+ }) => {
41
44
  switch (role) {
42
45
  case 'answer':
43
46
  return base.color.primary4;
@@ -49,8 +52,9 @@ var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
49
52
  default:
50
53
  return base.color.navy3;
51
54
  }
52
- }, function (_ref4) {
53
- var role = _ref4.role;
55
+ }, ({
56
+ role
57
+ }) => {
54
58
  switch (role) {
55
59
  case 'answer':
56
60
  return base.color.primary9;
@@ -62,8 +66,9 @@ var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
62
66
  default:
63
67
  return base.color.navy5;
64
68
  }
65
- }, StyledQuizDraggbleOptionContent, function (_ref5) {
66
- var role = _ref5.role;
69
+ }, StyledQuizDraggbleOptionContent, ({
70
+ role
71
+ }) => {
67
72
  switch (role) {
68
73
  case 'answer':
69
74
  return base.color.primary1;
@@ -75,8 +80,9 @@ var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
75
80
  default:
76
81
  return base.color.navy5;
77
82
  }
78
- }, function (_ref6) {
79
- var role = _ref6.role;
83
+ }, ({
84
+ role
85
+ }) => {
80
86
  switch (role) {
81
87
  case 'answer':
82
88
  return base.color.primary9;
@@ -88,8 +94,9 @@ var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
88
94
  default:
89
95
  return base.color.navy0;
90
96
  }
91
- }, StyledOrder, function (_ref7) {
92
- var role = _ref7.role;
97
+ }, StyledOrder, ({
98
+ role
99
+ }) => {
93
100
  switch (role) {
94
101
  case 'answer':
95
102
  return base.color.primary3;
@@ -101,8 +108,9 @@ var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
101
108
  default:
102
109
  return base.color.navy4;
103
110
  }
104
- }, function (_ref8) {
105
- var role = _ref8.role;
111
+ }, ({
112
+ role
113
+ }) => {
106
114
  switch (role) {
107
115
  case 'answer':
108
116
  return base.color.primary9;
@@ -115,49 +123,39 @@ var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
115
123
  return base.color.navy0;
116
124
  }
117
125
  }, base.color.navy0, StyledQuizDraggbleOptionHandle, base.color.navy5, StyledQuizDraggbleOptionContent, base.color.navy4, base.color.navy4, StyledOrder, base.color.navy0, base.color.navy5, base.color.navy0);
118
- var QuizDraggbleOption = function QuizDraggbleOption(_ref9) {
119
- var id = _ref9.id,
120
- className = _ref9.className,
121
- content = _ref9.content,
122
- _ref9$disabled = _ref9.disabled,
123
- disabled = _ref9$disabled === void 0 ? false : _ref9$disabled,
124
- _ref9$role = _ref9.role,
125
- role = _ref9$role === void 0 ? 'default' : _ref9$role,
126
- indexOrder = _ref9.indexOrder,
127
- _ref9$clone = _ref9.clone,
128
- clone = _ref9$clone === void 0 ? false : _ref9$clone,
129
- _ref9$isMarkdown = _ref9.isMarkdown,
130
- isMarkdown = _ref9$isMarkdown === void 0 ? false : _ref9$isMarkdown;
131
- var _useMaterialQuizState = useMaterialQuizState(),
132
- vertical = _useMaterialQuizState.vertical;
133
- return jsxs(StyledQuizDraggbleOption, {
126
+ const QuizDraggbleOption = ({
127
+ id,
128
+ className,
129
+ content,
130
+ disabled = false,
131
+ role = 'default',
132
+ indexOrder,
133
+ clone = false,
134
+ isMarkdown = false
135
+ }) => {
136
+ const {
137
+ vertical
138
+ } = useMaterialQuizState();
139
+ return React.createElement(StyledQuizDraggbleOption, {
134
140
  id: id,
135
141
  className: className,
136
142
  disabled: disabled,
137
143
  role: role,
138
144
  clone: clone,
139
- vertical: vertical,
140
- children: [jsx(StyledQuizDraggbleOptionHandle, {
141
- children: jsx(Icon, {
142
- size: "large",
143
- icon: eilDraggableVertical
144
- })
145
- }), jsxs(StyledQuizDraggbleOptionContent, {
146
- children: [isMarkdown ? jsx(StyledMarkdown, {
147
- children: content,
148
- dark: true,
149
- paddingx: 0,
150
- paddingy: 0
151
- }) : jsx(Text, {
152
- userSelect: "none",
153
- wordBreak: "break-all",
154
- role: role === 'answer' ? 'white' : 'default',
155
- children: content
156
- }), indexOrder ? jsx(StyledOrder, {
157
- children: indexOrder
158
- }) : null]
159
- })]
160
- });
145
+ vertical: vertical
146
+ }, React.createElement(StyledQuizDraggbleOptionHandle, null, React.createElement(Icon, {
147
+ size: "large",
148
+ icon: eilDraggableVertical
149
+ })), React.createElement(StyledQuizDraggbleOptionContent, null, isMarkdown ? React.createElement(StyledMarkdown, {
150
+ children: content,
151
+ dark: true,
152
+ paddingx: 0,
153
+ paddingy: 0
154
+ }) : React.createElement(Text, {
155
+ userSelect: "none",
156
+ wordBreak: "break-all",
157
+ role: role === 'answer' ? 'white' : 'default'
158
+ }, content), indexOrder ? React.createElement(StyledOrder, null, indexOrder) : null));
161
159
  };
162
160
 
163
161
  export { QuizDraggbleOption as default };
@@ -1,7 +1,7 @@
1
1
  import { Markdown } from '@elice/markdown';
2
2
  import styled from 'styled-components';
3
3
 
4
- var StyledMarkdown = styled(Markdown).withConfig({
4
+ const StyledMarkdown = styled(Markdown).withConfig({
5
5
  componentId: "sc-l6r531-0"
6
6
  })(["p{margin:0 !important;}code{white-space:pre-wrap;word-break:break-all;}"]);
7
7
 
@@ -1,19 +1,17 @@
1
1
  import { __rest } from 'tslib';
2
- import { jsx } from 'react/jsx-runtime';
2
+ import React from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { QuestionCheckboxContextProvider } from './QuestionCheckboxContext.js';
5
5
 
6
- var StyledQuestionCheckbox = styled.div.withConfig({
6
+ const StyledQuestionCheckbox = styled.div.withConfig({
7
7
  componentId: "sc-1jgy6x5-0"
8
8
  })(["display:flex;flex-direction:column;"]);
9
- var QuestionCheckbox = function QuestionCheckbox(_a) {
10
- var children = _a.children,
9
+ const QuestionCheckbox = _a => {
10
+ var {
11
+ children
12
+ } = _a,
11
13
  props = __rest(_a, ["children"]);
12
- return jsx(QuestionCheckboxContextProvider, Object.assign({}, props, {
13
- children: jsx(StyledQuestionCheckbox, {
14
- children: children
15
- })
16
- }));
14
+ return React.createElement(QuestionCheckboxContextProvider, Object.assign({}, props), React.createElement(StyledQuestionCheckbox, null, children));
17
15
  };
18
16
 
19
17
  export { QuestionCheckbox as default };
@@ -4,6 +4,6 @@ type Value = Pick<QuestionCheckboxProps, 'selectedOptions' | 'disabled' | 'onSel
4
4
  interface QuestionCheckboxProviderProps extends QuestionCheckboxProps {
5
5
  children: React.ReactNode;
6
6
  }
7
- declare function QuestionCheckboxContextProvider({ selectedOptions, onSelect, disabled, children, }: QuestionCheckboxProviderProps): JSX.Element;
7
+ declare function QuestionCheckboxContextProvider({ selectedOptions, onSelect, disabled, children, }: QuestionCheckboxProviderProps): React.JSX.Element;
8
8
  declare function useQuestionCheckboxContext(): Value;
9
9
  export { QuestionCheckboxContextProvider, useQuestionCheckboxContext };
@@ -1,29 +1,26 @@
1
- import { jsx } from 'react/jsx-runtime';
2
1
  import React from 'react';
3
2
 
4
- var QuestionCheckboxContext = React.createContext(undefined);
3
+ const QuestionCheckboxContext = React.createContext(undefined);
5
4
  QuestionCheckboxContext.displayName = 'QuestionCheckboxContext';
6
- function QuestionCheckboxContextProvider(_ref) {
7
- var selectedOptions = _ref.selectedOptions,
8
- onSelect = _ref.onSelect,
9
- disabled = _ref.disabled,
10
- children = _ref.children;
5
+ function QuestionCheckboxContextProvider({
6
+ selectedOptions,
7
+ onSelect,
8
+ disabled,
9
+ children
10
+ }) {
11
11
  // eslint-disable-next-line react-hooks/exhaustive-deps
12
- var onSelectValue = React.useCallback(onSelect, []);
13
- var value = React.useMemo(function () {
14
- return {
15
- selectedOptions: selectedOptions,
16
- disabled: disabled,
17
- onSelect: onSelectValue
18
- };
19
- }, [selectedOptions, disabled, onSelectValue]);
20
- return jsx(QuestionCheckboxContext.Provider, {
21
- value: value,
22
- children: children
23
- });
12
+ const onSelectValue = React.useCallback(onSelect, []);
13
+ const value = React.useMemo(() => ({
14
+ selectedOptions,
15
+ disabled,
16
+ onSelect: onSelectValue
17
+ }), [selectedOptions, disabled, onSelectValue]);
18
+ return React.createElement(QuestionCheckboxContext.Provider, {
19
+ value: value
20
+ }, children);
24
21
  }
25
22
  function useQuestionCheckboxContext() {
26
- var context = React.useContext(QuestionCheckboxContext);
23
+ const context = React.useContext(QuestionCheckboxContext);
27
24
  if (context === undefined) {
28
25
  throw new Error('useQuestionCheckboxContext must be used within a QuestionCheckboxContextProvider');
29
26
  }
@@ -1,15 +1,15 @@
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';
5
4
  import { getQuestionStatusStyle } from '../utils/getQuestionStatusStyle.js';
6
5
  import { useQuestionCheckboxContext } from './QuestionCheckboxContext.js';
7
6
 
8
- var StyledQuestionCheckboxOption = styled.div.withConfig({
7
+ const StyledQuestionCheckboxOption = styled.div.withConfig({
9
8
  componentId: "sc-1erloup-0"
10
- })(["display:flex;align-items:center;padding:0.875rem 1rem;border-radius:8px;background-color:", ";&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], function (_ref) {
11
- var checked = _ref.checked,
12
- status = _ref.status;
9
+ })(["display:flex;align-items:center;padding:0.875rem 1rem;border-radius:8px;background-color:", ";&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], ({
10
+ checked,
11
+ status
12
+ }) => {
13
13
  switch (status) {
14
14
  case 'correct':
15
15
  return base.color.green1;
@@ -18,21 +18,20 @@ var StyledQuestionCheckboxOption = styled.div.withConfig({
18
18
  default:
19
19
  return checked ? base.color.primary1 : base.color.navy6;
20
20
  }
21
- }, function (_ref2) {
22
- var disabled = _ref2.disabled;
23
- return disabled ? 'not-allowed' : 'pointer';
24
- }, function (_ref3) {
25
- var isAnswer = _ref3.isAnswer;
26
- return isAnswer ? "border: 3px solid ".concat(base.color.green5) : '';
27
- });
28
- var StyledCustomCheckboxButton = styled.span.withConfig({
21
+ }, ({
22
+ disabled
23
+ }) => disabled ? 'not-allowed' : 'pointer', ({
24
+ isAnswer
25
+ }) => isAnswer ? `border: 3px solid ${base.color.green5}` : '');
26
+ const StyledCustomCheckboxButton = styled.span.withConfig({
29
27
  componentId: "sc-1erloup-1"
30
28
  })([""]);
31
- var StyledQuestionCheckboxInput = styled.input.withConfig({
29
+ const StyledQuestionCheckboxInput = styled.input.withConfig({
32
30
  componentId: "sc-1erloup-2"
33
- })(["flex:none;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:relative;width:1rem;height:1rem;margin-right:0.875rem;background-color:", ";border:", ";", ""], 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;width:1rem;height:1rem;margin-right:0.875rem;background-color:", ";border:", ";", ""], ({
32
+ checked,
33
+ status
34
+ }) => {
36
35
  switch (status) {
37
36
  case 'correct':
38
37
  return base.color.green9;
@@ -41,21 +40,23 @@ var StyledQuestionCheckboxInput = styled.input.withConfig({
41
40
  default:
42
41
  return checked ? base.color.primary6 : 'transparent';
43
42
  }
44
- }, function (_ref5) {
45
- var checked = _ref5.checked,
46
- status = _ref5.status;
43
+ }, ({
44
+ checked,
45
+ status
46
+ }) => {
47
47
  switch (status) {
48
48
  case 'correct':
49
49
  return base.color.green9;
50
50
  case 'wrong':
51
51
  return base.color.red9;
52
52
  default:
53
- return checked ? base.color.primary6 : "1px solid ".concat(base.color.gray3);
53
+ return checked ? base.color.primary6 : `1px solid ${base.color.gray3}`;
54
54
  }
55
- }, function (_ref6) {
56
- var status = _ref6.status,
57
- checked = _ref6.checked;
58
- var bgColor;
55
+ }, ({
56
+ status,
57
+ checked
58
+ }) => {
59
+ let bgColor;
59
60
  switch (status) {
60
61
  case 'correct':
61
62
  bgColor = base.color.green9;
@@ -67,7 +68,7 @@ var StyledQuestionCheckboxInput = styled.input.withConfig({
67
68
  bgColor = 'transparent';
68
69
  break;
69
70
  }
70
- var borderColor;
71
+ let borderColor;
71
72
  switch (status) {
72
73
  case 'correct':
73
74
  borderColor = base.color.green1;
@@ -79,46 +80,59 @@ var StyledQuestionCheckboxInput = styled.input.withConfig({
79
80
  borderColor = checked ? base.color.primary1 : status ? base.color.navy5 : 'transparent';
80
81
  break;
81
82
  }
82
- return "\n &:after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 3px;\n height: 7px;\n border: solid ".concat(borderColor, ";\n transform: translate(-50%, -50%) rotate(45deg);\n border-width: 0 2px 2px 0;\n background-color: ").concat(bgColor, ";\n }\n ");
83
+ return `
84
+ &:after {
85
+ content: '';
86
+ position: absolute;
87
+ top: 50%;
88
+ left: 50%;
89
+ width: 3px;
90
+ height: 7px;
91
+ border: solid ${borderColor};
92
+ transform: translate(-50%, -50%) rotate(45deg);
93
+ border-width: 0 2px 2px 0;
94
+ background-color: ${bgColor};
95
+ }
96
+ `;
83
97
  });
84
- var StyledLabel = styled.label.withConfig({
98
+ const StyledLabel = styled.label.withConfig({
85
99
  componentId: "sc-1erloup-3"
86
100
  })(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], base.size.body3, getQuestionStatusStyle());
87
- var QuestionCheckboxOption = React.memo(function (_ref7) {
88
- var value = _ref7.value,
89
- status = _ref7.status,
90
- isAnswer = _ref7.isAnswer,
91
- children = _ref7.children;
92
- var _useQuestionCheckboxC = useQuestionCheckboxContext(),
93
- selectedOptions = _useQuestionCheckboxC.selectedOptions,
94
- disabled = _useQuestionCheckboxC.disabled,
95
- onSelect = _useQuestionCheckboxC.onSelect;
96
- var checked = selectedOptions.includes(value);
97
- return jsxs(StyledQuestionCheckboxOption, {
101
+ const QuestionCheckboxOption = React.memo(({
102
+ value,
103
+ status,
104
+ isAnswer,
105
+ children
106
+ }) => {
107
+ const {
108
+ selectedOptions,
109
+ disabled,
110
+ onSelect
111
+ } = useQuestionCheckboxContext();
112
+ const checked = selectedOptions.includes(value);
113
+ return React.createElement(StyledQuestionCheckboxOption, {
98
114
  isAnswer: isAnswer,
99
115
  disabled: disabled,
100
116
  checked: checked,
101
- onClick: function onClick(e) {
117
+ onClick: e => {
102
118
  e.preventDefault();
103
119
  if (disabled) {
104
120
  return;
105
121
  }
106
122
  onSelect(value);
107
123
  },
108
- status: status,
109
- children: [jsx(StyledCustomCheckboxButton, {}), jsx(StyledQuestionCheckboxInput, {
110
- id: value,
111
- readOnly: true,
112
- type: "checkbox",
113
- checked: checked,
114
- status: status
115
- }), jsx(StyledLabel, {
116
- htmlFor: value,
117
- checked: checked,
118
- status: status,
119
- children: children
120
- })]
121
- });
124
+ status: status
125
+ }, React.createElement(StyledCustomCheckboxButton, null), React.createElement(StyledQuestionCheckboxInput, {
126
+ id: value,
127
+ readOnly: true,
128
+ type: "checkbox",
129
+ checked: checked,
130
+ status: status
131
+ }), React.createElement(StyledLabel, {
132
+ htmlFor: value,
133
+ checked: checked,
134
+ status: status
135
+ }, children));
122
136
  });
123
137
 
124
138
  export { QuestionCheckboxOption as default };
@@ -1,19 +1,17 @@
1
1
  import { __rest } from 'tslib';
2
- import { jsx } from 'react/jsx-runtime';
2
+ import React from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { QuestionRadioContextProvider } from './QuestionRadioContext.js';
5
5
 
6
- var StyledQuestionRadio = styled.div.withConfig({
6
+ const StyledQuestionRadio = styled.div.withConfig({
7
7
  componentId: "sc-s7wqiy-0"
8
8
  })(["display:flex;flex-direction:column;"]);
9
- var QuestionRadio = function QuestionRadio(_a) {
10
- var children = _a.children,
9
+ const QuestionRadio = _a => {
10
+ var {
11
+ children
12
+ } = _a,
11
13
  props = __rest(_a, ["children"]);
12
- return jsx(QuestionRadioContextProvider, Object.assign({}, props, {
13
- children: jsx(StyledQuestionRadio, {
14
- children: children
15
- })
16
- }));
14
+ return React.createElement(QuestionRadioContextProvider, Object.assign({}, props), React.createElement(StyledQuestionRadio, null, children));
17
15
  };
18
16
 
19
17
  export { QuestionRadio as default };
@@ -4,6 +4,6 @@ type Value = Pick<QuestionRadioProps, 'selectedValue' | 'disabled' | 'onSelect'>
4
4
  interface QuestionRadioProviderProps extends QuestionRadioProps {
5
5
  children: React.ReactNode;
6
6
  }
7
- declare function QuestionRadioContextProvider({ selectedValue, onSelect, disabled, children, }: QuestionRadioProviderProps): JSX.Element;
7
+ declare function QuestionRadioContextProvider({ selectedValue, onSelect, disabled, children, }: QuestionRadioProviderProps): React.JSX.Element;
8
8
  declare function useQuestionRadioContext(): Value;
9
9
  export { QuestionRadioContextProvider, useQuestionRadioContext };
@@ -1,29 +1,26 @@
1
- import { jsx } from 'react/jsx-runtime';
2
1
  import React from 'react';
3
2
 
4
- var QuestionRadioContext = React.createContext(undefined);
3
+ const QuestionRadioContext = React.createContext(undefined);
5
4
  QuestionRadioContext.displayName = 'QuestionRadioContext';
6
- function QuestionRadioContextProvider(_ref) {
7
- var selectedValue = _ref.selectedValue,
8
- onSelect = _ref.onSelect,
9
- disabled = _ref.disabled,
10
- children = _ref.children;
5
+ function QuestionRadioContextProvider({
6
+ selectedValue,
7
+ onSelect,
8
+ disabled,
9
+ children
10
+ }) {
11
11
  // eslint-disable-next-line react-hooks/exhaustive-deps
12
- var onSelectValue = React.useCallback(onSelect, []);
13
- var value = React.useMemo(function () {
14
- return {
15
- selectedValue: selectedValue,
16
- disabled: disabled,
17
- onSelect: onSelectValue
18
- };
19
- }, [selectedValue, disabled, onSelectValue]);
20
- return jsx(QuestionRadioContext.Provider, {
21
- value: value,
22
- children: children
23
- });
12
+ const onSelectValue = React.useCallback(onSelect, []);
13
+ const value = React.useMemo(() => ({
14
+ selectedValue,
15
+ disabled,
16
+ onSelect: onSelectValue
17
+ }), [selectedValue, disabled, onSelectValue]);
18
+ return React.createElement(QuestionRadioContext.Provider, {
19
+ value: value
20
+ }, children);
24
21
  }
25
22
  function useQuestionRadioContext() {
26
- var context = React.useContext(QuestionRadioContext);
23
+ const context = React.useContext(QuestionRadioContext);
27
24
  if (context === undefined) {
28
25
  throw new Error('useQuestionRadioContext must be used within a QuestionRadioContextProvider');
29
26
  }