oolib 2.20.0 → 2.20.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.
- package/dist/components/CheckInput/index.js +1 -1
- package/dist/components/RadioInput/comps/RadioOption/index.d.ts +2 -3
- package/dist/components/RadioInput/comps/RadioOption/index.js +7 -7
- package/dist/components/RadioInput/comps/RadioOption/styled.js +3 -3
- package/dist/components/RadioInput/index.d.ts +12 -1
- package/dist/components/RadioInput/index.js +5 -6
- package/dist/components/RadioInput/utils.js +1 -1
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@ var react_1 = __importDefault(require("react"));
|
|
|
19
19
|
var BlockLabel_1 = require("../BlockLabel");
|
|
20
20
|
var _EXPORTS_1 = require("../../utils/_EXPORTS");
|
|
21
21
|
var CheckInput = function (props) {
|
|
22
|
-
var id = props.id, injectOtherOption = props.injectOtherOption, value = props.value, onChange = props.onChange, commonIsCorrectDesc = props.commonIsCorrectDesc, options = props.options, optionGroups = props.optionGroups, optionStyle = props.optionStyle,
|
|
22
|
+
var id = props.id, injectOtherOption = props.injectOtherOption, value = props.value, onChange = props.onChange, commonIsCorrectDesc = props.commonIsCorrectDesc, options = props.options, optionGroups = props.optionGroups, optionStyle = props.optionStyle, rightWrongResult = props.rightWrongResult, passChangeHandlerOps = props.passChangeHandlerOps, listType = props.listType, style = props.style, className = props.className, readOnly = props.readOnly;
|
|
23
23
|
return (react_1.default.createElement("div", { className: className, id: id },
|
|
24
24
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
25
25
|
react_1.default.createElement("input", { type: "checkbox" })));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export function RadioOption({ id, option, onChange, value,
|
|
1
|
+
export function RadioOption({ id, option, onChange, value, rightWrongResult, }: {
|
|
2
2
|
id: any;
|
|
3
3
|
option: any;
|
|
4
4
|
onChange: any;
|
|
5
5
|
value: any;
|
|
6
|
-
|
|
7
|
-
markResult: any;
|
|
6
|
+
rightWrongResult: any;
|
|
8
7
|
}): JSX.Element;
|
|
@@ -13,19 +13,19 @@ var styled_1 = require("./styled");
|
|
|
13
13
|
var green = themes_1.colors.green, red = themes_1.colors.red;
|
|
14
14
|
var XCircle = icons_1.icons.XCircle, CheckCircle = icons_1.icons.CheckCircle;
|
|
15
15
|
var RadioOption = function (_a) {
|
|
16
|
-
var id = _a.id, option = _a.option, onChange = _a.onChange, value = _a.value,
|
|
16
|
+
var id = _a.id, option = _a.option, onChange = _a.onChange, value = _a.value, rightWrongResult = _a.rightWrongResult;
|
|
17
17
|
var isSelected = option.value === (value === null || value === void 0 ? void 0 : value.value);
|
|
18
18
|
var markingCommand = (0, utils_js_1.getMarkingCommand)({ option: option, isSelected: isSelected });
|
|
19
19
|
return (react_1.default.createElement("div", null,
|
|
20
|
-
react_1.default.createElement(styled_1.StyledOption, {
|
|
21
|
-
!
|
|
20
|
+
react_1.default.createElement(styled_1.StyledOption, { rightWrongResult: rightWrongResult, isSelected: isSelected, onClick: function () { return !rightWrongResult && onChange && onChange(id, option); } },
|
|
21
|
+
!rightWrongResult || markingCommand === undefined ?
|
|
22
22
|
react_1.default.createElement(styled_1.StyledRadioInput, { isSelected: isSelected, className: 'radioBtn' }, isSelected && react_1.default.createElement(styled_1.StyledRadioInputFill, null))
|
|
23
23
|
:
|
|
24
24
|
["markCorrect", "revealCorrect"].includes(markingCommand) ?
|
|
25
|
-
react_1.default.createElement(CheckCircle, { size:
|
|
25
|
+
react_1.default.createElement(CheckCircle, { size: 22.5, color: green, style: { marginLeft: '-2.25px' } })
|
|
26
26
|
: // then wrong
|
|
27
|
-
react_1.default.createElement(XCircle, { size:
|
|
28
|
-
react_1.default.createElement(Typo_1.SANS_3, { bold:
|
|
27
|
+
react_1.default.createElement(XCircle, { size: 22.5, color: red, style: { marginLeft: '-2.25px' } }),
|
|
28
|
+
react_1.default.createElement(Typo_1.SANS_3, { bold: rightWrongResult && isSelected },
|
|
29
29
|
" ",
|
|
30
30
|
option.display,
|
|
31
31
|
" ")),
|
|
@@ -34,7 +34,7 @@ var RadioOption = function (_a) {
|
|
|
34
34
|
being right or wrong, we always show an explanation
|
|
35
35
|
against the right answer. provided an explanation is provided.
|
|
36
36
|
*/
|
|
37
|
-
option.isCorrect &&
|
|
37
|
+
option.isCorrect && rightWrongResult && option.isCorrectDesc &&
|
|
38
38
|
react_1.default.createElement(styled_1.StyledCorrectMessage, null, option.isCorrectDesc)));
|
|
39
39
|
};
|
|
40
40
|
exports.RadioOption = RadioOption;
|
|
@@ -35,8 +35,8 @@ var utilsOolib_1 = require("../../../../utilsOolib");
|
|
|
35
35
|
var Typo_1 = require("../../../Typo");
|
|
36
36
|
var none = themes_1.colors.none, white = themes_1.colors.white, green = themes_1.colors.green;
|
|
37
37
|
exports.StyledOption = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: 1rem;\n position: relative;\n cursor: ", ";\n \n\n &:hover .radioBtn {\n ", "\n }\n\n"], ["\n display: flex;\n align-items: center;\n gap: 1rem;\n position: relative;\n cursor: ", ";\n \n\n &:hover .radioBtn {\n ", "\n }\n\n"])), function (_a) {
|
|
38
|
-
var
|
|
39
|
-
return
|
|
38
|
+
var rightWrongResult = _a.rightWrongResult;
|
|
39
|
+
return rightWrongResult ? 'initial' : 'pointer';
|
|
40
40
|
}, function (_a) {
|
|
41
41
|
var isSelected = _a.isSelected, theme = _a.theme;
|
|
42
42
|
return !isSelected && (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), (0, utilsOolib_1.getPrimaryColor10)(theme.colors));
|
|
@@ -44,7 +44,7 @@ exports.StyledOption = styled_components_1.default.div(templateObject_2 || (temp
|
|
|
44
44
|
exports.StyledRadioInput = styled_components_1.default.button(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border-radius: 50%;\n width: 2rem;\n height: 2rem;\n border: 2px solid ", ";\n background-color: ", ";\n flex: 0 0 auto;\n ", "\n\n ", "\n\n"], ["\n border-radius: 50%;\n width: 2rem;\n height: 2rem;\n border: 2px solid ", ";\n background-color: ", ";\n flex: 0 0 auto;\n ", "\n\n ", "\n\n"])), function (_a) {
|
|
45
45
|
var theme = _a.theme;
|
|
46
46
|
return (0, utilsOolib_1.getPrimaryColor100)(theme.colors);
|
|
47
|
-
}, none, (0, mixins_1.transition)('
|
|
47
|
+
}, none, (0, mixins_1.transition)('background-color 0.2s'), function (_a) {
|
|
48
48
|
var isSelected = _a.isSelected;
|
|
49
49
|
return isSelected && (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color:", ";\n display: flex;\n align-items: center;\n justify-content: center;\n "], ["\n background-color:", ";\n display: flex;\n align-items: center;\n justify-content: center;\n "])), function (_a) {
|
|
50
50
|
var theme = _a.theme;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
export function RadioInput(
|
|
1
|
+
export function RadioInput({ id, injectOtherOption, value, onChange, options, rightWrongResult, listType, style, className, readOnly }: {
|
|
2
|
+
id: any;
|
|
3
|
+
injectOtherOption: any;
|
|
4
|
+
value: any;
|
|
5
|
+
onChange: any;
|
|
6
|
+
options: any;
|
|
7
|
+
rightWrongResult: any;
|
|
8
|
+
listType: any;
|
|
9
|
+
style: any;
|
|
10
|
+
className: any;
|
|
11
|
+
readOnly: any;
|
|
12
|
+
}, ...args: any[]): JSX.Element;
|
|
@@ -23,9 +23,9 @@ var _EXPORTS_1 = require("../../utils/_EXPORTS");
|
|
|
23
23
|
var utils_js_1 = require("./utils.js");
|
|
24
24
|
var styled_1 = require("./styled");
|
|
25
25
|
var comps_1 = require("./comps");
|
|
26
|
-
|
|
27
|
-
var id =
|
|
28
|
-
|
|
26
|
+
function RadioInput(_a) {
|
|
27
|
+
var id = _a.id, injectOtherOption = _a.injectOtherOption, value = _a.value, onChange = _a.onChange, options = _a.options, rightWrongResult = _a.rightWrongResult, listType = _a.listType, style = _a.style, className = _a.className, readOnly = _a.readOnly;
|
|
28
|
+
var props = arguments[0];
|
|
29
29
|
var displayedOptions;
|
|
30
30
|
if (options) {
|
|
31
31
|
if (injectOtherOption && !options.includes(function (op) { return op.value === "other"; })) {
|
|
@@ -43,10 +43,9 @@ var RadioInput = function (props) {
|
|
|
43
43
|
id: id,
|
|
44
44
|
onChange: onChange,
|
|
45
45
|
value: value,
|
|
46
|
-
|
|
47
|
-
markResult: markResult,
|
|
46
|
+
rightWrongResult: rightWrongResult,
|
|
48
47
|
key: option.value
|
|
49
48
|
})); })),
|
|
50
49
|
injectOtherOption && (value === null || value === void 0 ? void 0 : value.value) === "other" && (react_1.default.createElement(TextInputs_1.TextInput, { placeholder: "Please Specify Here", value: value.display_desc, onChange: function (k, v) { return onChange && onChange(id, (0, utils_js_1.createNewValue)(v)); } }))))));
|
|
51
|
-
}
|
|
50
|
+
}
|
|
52
51
|
exports.RadioInput = RadioInput;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNewValue = void 0;
|
|
4
4
|
var createNewValue = function (val) {
|
|
5
|
-
value_desc = ( // discuss if we should add the method textToCamelcase to general utils or JS String Class
|
|
5
|
+
var value_desc = ( // discuss if we should add the method textToCamelcase to general utils or JS String Class
|
|
6
6
|
val
|
|
7
7
|
.trim()
|
|
8
8
|
.replace(/[,\/]/gi, '')
|