@elice/material-quiz 1.230629.1 → 1.230705.0
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.
- package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +7 -28
- package/cjs/components/shared/question-radio/QuestionRadioOption.js +7 -28
- package/cjs/components/shared/utils/getQuestionStatusStyle.d.ts +10 -0
- package/cjs/components/shared/utils/getQuestionStatusStyle.js +26 -0
- package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +7 -28
- package/es/components/shared/question-radio/QuestionRadioOption.js +7 -28
- package/es/components/shared/utils/getQuestionStatusStyle.d.ts +10 -0
- package/es/components/shared/utils/getQuestionStatusStyle.js +22 -0
- package/package.json +4 -4
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var designTokens = require('@elice/design-tokens');
|
|
7
7
|
var styled = require('styled-components');
|
|
8
|
+
var getQuestionStatusStyle = require('../utils/getQuestionStatusStyle.js');
|
|
8
9
|
var QuestionCheckboxContext = require('./QuestionCheckboxContext.js');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -90,34 +91,12 @@ var StyledQuestionCheckboxInput = styled__default["default"].input.withConfig({
|
|
|
90
91
|
});
|
|
91
92
|
var StyledLabel = styled__default["default"].label.withConfig({
|
|
92
93
|
componentId: "sc-1erloup-3"
|
|
93
|
-
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
case 'wrong':
|
|
100
|
-
return designTokens.base.color.red9;
|
|
101
|
-
default:
|
|
102
|
-
return checked ? designTokens.base.color.primary6 : designTokens.base.color.navy0;
|
|
103
|
-
}
|
|
104
|
-
}, function (_ref8) {
|
|
105
|
-
var checked = _ref8.checked,
|
|
106
|
-
status = _ref8.status;
|
|
107
|
-
switch (status) {
|
|
108
|
-
case 'correct':
|
|
109
|
-
return designTokens.base.color.green9;
|
|
110
|
-
case 'wrong':
|
|
111
|
-
return designTokens.base.color.red9;
|
|
112
|
-
default:
|
|
113
|
-
return checked ? designTokens.base.color.primary6 : designTokens.base.color.navy0;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
var QuestionCheckboxOption = React__default["default"].memo(function (_ref9) {
|
|
117
|
-
var value = _ref9.value,
|
|
118
|
-
status = _ref9.status,
|
|
119
|
-
isAnswer = _ref9.isAnswer,
|
|
120
|
-
children = _ref9.children;
|
|
94
|
+
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], designTokens.base.size.body3, getQuestionStatusStyle.getQuestionStatusStyle());
|
|
95
|
+
var QuestionCheckboxOption = React__default["default"].memo(function (_ref7) {
|
|
96
|
+
var value = _ref7.value,
|
|
97
|
+
status = _ref7.status,
|
|
98
|
+
isAnswer = _ref7.isAnswer,
|
|
99
|
+
children = _ref7.children;
|
|
121
100
|
var _useQuestionCheckboxC = QuestionCheckboxContext.useQuestionCheckboxContext(),
|
|
122
101
|
selectedOptions = _useQuestionCheckboxC.selectedOptions,
|
|
123
102
|
disabled = _useQuestionCheckboxC.disabled,
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var designTokens = require('@elice/design-tokens');
|
|
7
7
|
var styled = require('styled-components');
|
|
8
|
+
var getQuestionStatusStyle = require('../utils/getQuestionStatusStyle.js');
|
|
8
9
|
var QuestionRadioContext = require('./QuestionRadioContext.js');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -66,34 +67,12 @@ var StyledQuestionRadioInput = styled__default["default"].input.withConfig({
|
|
|
66
67
|
});
|
|
67
68
|
var StyledLabel = styled__default["default"].label.withConfig({
|
|
68
69
|
componentId: "sc-cy66me-2"
|
|
69
|
-
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
case 'wrong':
|
|
76
|
-
return designTokens.base.color.red9;
|
|
77
|
-
default:
|
|
78
|
-
return checked ? designTokens.base.color.primary6 : designTokens.base.color.navy0;
|
|
79
|
-
}
|
|
80
|
-
}, function (_ref7) {
|
|
81
|
-
var checked = _ref7.checked,
|
|
82
|
-
status = _ref7.status;
|
|
83
|
-
switch (status) {
|
|
84
|
-
case 'correct':
|
|
85
|
-
return designTokens.base.color.green9;
|
|
86
|
-
case 'wrong':
|
|
87
|
-
return designTokens.base.color.red9;
|
|
88
|
-
default:
|
|
89
|
-
return checked ? designTokens.base.color.primary6 : designTokens.base.color.navy0;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
var QuestionRadioOption = React__default["default"].memo(function (_ref8) {
|
|
93
|
-
var value = _ref8.value,
|
|
94
|
-
status = _ref8.status,
|
|
95
|
-
isAnswer = _ref8.isAnswer,
|
|
96
|
-
children = _ref8.children;
|
|
70
|
+
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], designTokens.base.size.body3, getQuestionStatusStyle.getQuestionStatusStyle());
|
|
71
|
+
var QuestionRadioOption = React__default["default"].memo(function (_ref6) {
|
|
72
|
+
var value = _ref6.value,
|
|
73
|
+
status = _ref6.status,
|
|
74
|
+
isAnswer = _ref6.isAnswer,
|
|
75
|
+
children = _ref6.children;
|
|
97
76
|
var _useQuestionRadioCont = QuestionRadioContext.useQuestionRadioContext(),
|
|
98
77
|
selectedValue = _useQuestionRadioCont.selectedValue,
|
|
99
78
|
disabled = _useQuestionRadioCont.disabled,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare type Status = 'correct' | 'wrong' | 'answer';
|
|
2
|
+
interface QuestionValues {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
status?: Status;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Get shared question custom style depend on checked, status values.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getQuestionStatusStyle(): import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<QuestionValues, any>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var designTokens = require('@elice/design-tokens');
|
|
6
|
+
var styled = require('styled-components');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get shared question custom style depend on checked, status values.
|
|
10
|
+
*/
|
|
11
|
+
function getQuestionStatusStyle() {
|
|
12
|
+
return styled.css(["&,& p,& p.elicemd.elicemd--theme-light{color:", ";}"], function (_ref) {
|
|
13
|
+
var checked = _ref.checked,
|
|
14
|
+
status = _ref.status;
|
|
15
|
+
switch (status) {
|
|
16
|
+
case 'correct':
|
|
17
|
+
return designTokens.base.color.green9;
|
|
18
|
+
case 'wrong':
|
|
19
|
+
return designTokens.base.color.red9;
|
|
20
|
+
default:
|
|
21
|
+
return checked ? designTokens.base.color.primary6 : designTokens.base.color.navy0;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.getQuestionStatusStyle = getQuestionStatusStyle;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { base } from '@elice/design-tokens';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
+
import { getQuestionStatusStyle } from '../utils/getQuestionStatusStyle.js';
|
|
4
5
|
import { useQuestionCheckboxContext } from './QuestionCheckboxContext.js';
|
|
5
6
|
|
|
6
7
|
var StyledQuestionCheckboxOption = styled.div.withConfig({
|
|
@@ -81,34 +82,12 @@ var StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
|
81
82
|
});
|
|
82
83
|
var StyledLabel = styled.label.withConfig({
|
|
83
84
|
componentId: "sc-1erloup-3"
|
|
84
|
-
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
case 'wrong':
|
|
91
|
-
return base.color.red9;
|
|
92
|
-
default:
|
|
93
|
-
return checked ? base.color.primary6 : base.color.navy0;
|
|
94
|
-
}
|
|
95
|
-
}, function (_ref8) {
|
|
96
|
-
var checked = _ref8.checked,
|
|
97
|
-
status = _ref8.status;
|
|
98
|
-
switch (status) {
|
|
99
|
-
case 'correct':
|
|
100
|
-
return base.color.green9;
|
|
101
|
-
case 'wrong':
|
|
102
|
-
return base.color.red9;
|
|
103
|
-
default:
|
|
104
|
-
return checked ? base.color.primary6 : base.color.navy0;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
var QuestionCheckboxOption = React.memo(function (_ref9) {
|
|
108
|
-
var value = _ref9.value,
|
|
109
|
-
status = _ref9.status,
|
|
110
|
-
isAnswer = _ref9.isAnswer,
|
|
111
|
-
children = _ref9.children;
|
|
85
|
+
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], base.size.body3, getQuestionStatusStyle());
|
|
86
|
+
var QuestionCheckboxOption = React.memo(function (_ref7) {
|
|
87
|
+
var value = _ref7.value,
|
|
88
|
+
status = _ref7.status,
|
|
89
|
+
isAnswer = _ref7.isAnswer,
|
|
90
|
+
children = _ref7.children;
|
|
112
91
|
var _useQuestionCheckboxC = useQuestionCheckboxContext(),
|
|
113
92
|
selectedOptions = _useQuestionCheckboxC.selectedOptions,
|
|
114
93
|
disabled = _useQuestionCheckboxC.disabled,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { base } from '@elice/design-tokens';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
+
import { getQuestionStatusStyle } from '../utils/getQuestionStatusStyle.js';
|
|
4
5
|
import { useQuestionRadioContext } from './QuestionRadioContext.js';
|
|
5
6
|
|
|
6
7
|
var StyledQuestionRadioOption = styled.div.withConfig({
|
|
@@ -57,34 +58,12 @@ var StyledQuestionRadioInput = styled.input.withConfig({
|
|
|
57
58
|
});
|
|
58
59
|
var StyledLabel = styled.label.withConfig({
|
|
59
60
|
componentId: "sc-cy66me-2"
|
|
60
|
-
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
case 'wrong':
|
|
67
|
-
return base.color.red9;
|
|
68
|
-
default:
|
|
69
|
-
return checked ? base.color.primary6 : base.color.navy0;
|
|
70
|
-
}
|
|
71
|
-
}, function (_ref7) {
|
|
72
|
-
var checked = _ref7.checked,
|
|
73
|
-
status = _ref7.status;
|
|
74
|
-
switch (status) {
|
|
75
|
-
case 'correct':
|
|
76
|
-
return base.color.green9;
|
|
77
|
-
case 'wrong':
|
|
78
|
-
return base.color.red9;
|
|
79
|
-
default:
|
|
80
|
-
return checked ? base.color.primary6 : base.color.navy0;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
var QuestionRadioOption = React.memo(function (_ref8) {
|
|
84
|
-
var value = _ref8.value,
|
|
85
|
-
status = _ref8.status,
|
|
86
|
-
isAnswer = _ref8.isAnswer,
|
|
87
|
-
children = _ref8.children;
|
|
61
|
+
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], base.size.body3, getQuestionStatusStyle());
|
|
62
|
+
var QuestionRadioOption = React.memo(function (_ref6) {
|
|
63
|
+
var value = _ref6.value,
|
|
64
|
+
status = _ref6.status,
|
|
65
|
+
isAnswer = _ref6.isAnswer,
|
|
66
|
+
children = _ref6.children;
|
|
88
67
|
var _useQuestionRadioCont = useQuestionRadioContext(),
|
|
89
68
|
selectedValue = _useQuestionRadioCont.selectedValue,
|
|
90
69
|
disabled = _useQuestionRadioCont.disabled,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare type Status = 'correct' | 'wrong' | 'answer';
|
|
2
|
+
interface QuestionValues {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
status?: Status;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Get shared question custom style depend on checked, status values.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getQuestionStatusStyle(): import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<QuestionValues, any>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { base } from '@elice/design-tokens';
|
|
2
|
+
import { css } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get shared question custom style depend on checked, status values.
|
|
6
|
+
*/
|
|
7
|
+
function getQuestionStatusStyle() {
|
|
8
|
+
return css(["&,& p,& p.elicemd.elicemd--theme-light{color:", ";}"], function (_ref) {
|
|
9
|
+
var checked = _ref.checked,
|
|
10
|
+
status = _ref.status;
|
|
11
|
+
switch (status) {
|
|
12
|
+
case 'correct':
|
|
13
|
+
return base.color.green9;
|
|
14
|
+
case 'wrong':
|
|
15
|
+
return base.color.red9;
|
|
16
|
+
default:
|
|
17
|
+
return checked ? base.color.primary6 : base.color.navy0;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { getQuestionStatusStyle };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-quiz",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.230705.0",
|
|
4
4
|
"description": "User view and editing components of Elice material quiz",
|
|
5
5
|
"repository": "https://git.elicer.io/elice/frontend/library/elice-material",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"@elice/icons": "^1.220803.0",
|
|
59
59
|
"@elice/icons-legacy": "npm:@elice/icons@0.220803.1",
|
|
60
60
|
"@elice/markdown": "^1.220803.0",
|
|
61
|
-
"@elice/material-shared-types": "1.
|
|
62
|
-
"@elice/material-shared-utils": "1.
|
|
61
|
+
"@elice/material-shared-types": "1.230705.0",
|
|
62
|
+
"@elice/material-shared-utils": "1.230705.0",
|
|
63
63
|
"@elice/types": "^1.230629.0",
|
|
64
64
|
"@types/classnames": "^2.3.1",
|
|
65
65
|
"@types/jquery": "^3.5.13",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"react-use": "^17.2.4",
|
|
74
74
|
"styled-components": "^5.3.0"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "3f369e88f09030e7025ccbc65d0f510bd6f1cf49"
|
|
77
77
|
}
|