oolib 2.24.4 → 2.25.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/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.d.ts +8 -0
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.js +9 -4
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/styled.js +10 -4
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/index.d.ts +1 -1
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/index.js +2 -1
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.d.ts +8 -0
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.js +8 -3
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.js +11 -5
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/index.d.ts +1 -1
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/index.js +2 -1
- package/dist/components/RadioAndCheckbox/index.d.ts +2 -2
- package/dist/components/RadioAndCheckbox/index.js +3 -1
- package/package.json +1 -1
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
export function CheckboxButton({ className, isSelected, onClick, disabled, invert, S }: {
|
|
2
|
+
className: any;
|
|
3
|
+
isSelected: any;
|
|
4
|
+
onClick: any;
|
|
5
|
+
disabled: any;
|
|
6
|
+
invert: any;
|
|
7
|
+
S: any;
|
|
8
|
+
}): JSX.Element;
|
|
1
9
|
export function CheckboxInput({ option, onClick, S, inputStyle, value, invert, disabled, rightWrongResult, }: {
|
|
2
10
|
option: any;
|
|
3
11
|
onClick: any;
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.CheckboxInput = void 0;
|
|
17
|
+
exports.CheckboxInput = exports.CheckboxButton = void 0;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var icons_1 = require("../../../../../../icons");
|
|
20
20
|
var themes_1 = require("../../../../../../themes");
|
|
@@ -25,15 +25,20 @@ var utils_1 = require("../../../../utils");
|
|
|
25
25
|
var styled_2 = require("./styled");
|
|
26
26
|
var Check = icons_1.icons.Check, CheckSquare = icons_1.icons.CheckSquare, XSquare = icons_1.icons.XSquare;
|
|
27
27
|
var white = themes_1.colors.white, green = themes_1.colors.green, red = themes_1.colors.red, greyColor40 = themes_1.colors.greyColor40, greyColor100 = themes_1.colors.greyColor100;
|
|
28
|
+
var CheckboxButton = function (_a) {
|
|
29
|
+
var className = _a.className, isSelected = _a.isSelected, onClick = _a.onClick, disabled = _a.disabled, invert = _a.invert, S = _a.S;
|
|
30
|
+
return (react_1.default.createElement(styled_2.StyledCheckbox, __assign({ onClick: function (ev) { return onClick && onClick(ev); } }, { className: className, isSelected: isSelected, disabled: disabled, invert: invert, S: S }), isSelected &&
|
|
31
|
+
react_1.default.createElement(Check, { weight: "bold", color: invert ? greyColor100 : white, size: 16, style: { flexShrink: 0 } })));
|
|
32
|
+
};
|
|
33
|
+
exports.CheckboxButton = CheckboxButton;
|
|
28
34
|
var CheckboxInput = function (_a) {
|
|
29
35
|
var option = _a.option, onClick = _a.onClick, S = _a.S, inputStyle = _a.inputStyle, _b = _a.value, value = _b === void 0 ? [] : _b, invert = _a.invert, disabled = _a.disabled, rightWrongResult = _a.rightWrongResult;
|
|
30
36
|
var isSelected = !!value.find(function (selOp) { return selOp.value === option.value; });
|
|
31
37
|
var markingCommand = (0, utils_1.getMarkingCommand)({ option: option, isSelected: isSelected }); // returns undefined if option isn't labeled as 'correct' nor selected
|
|
32
38
|
var SuitableTypo = S ? Typo_1.SANS_2 : Typo_1.SANS_3;
|
|
33
|
-
return inputStyle === 'tagSelect' ? (react_1.default.createElement(Tags_1.TagSelect, __assign({}, { isSelected: isSelected, invert: invert, disabled: disabled }, { onClick: function () { return !disabled && onClick
|
|
39
|
+
return inputStyle === 'tagSelect' ? (react_1.default.createElement(Tags_1.TagSelect, __assign({}, { isSelected: isSelected, invert: invert, disabled: disabled }, { onClick: function () { return !disabled && onClick(option, isSelected); }, display: option.display, value: option.value, style: { alignSelf: 'flex-start' } }))) : (react_1.default.createElement(styled_1.StyledOption, __assign({}, { rightWrongResult: rightWrongResult, isSelected: isSelected, disabled: disabled, invert: invert, S: S }, { onClick: function () { return !rightWrongResult && !disabled && onClick(option, isSelected); } }),
|
|
34
40
|
!rightWrongResult || markingCommand === undefined ?
|
|
35
|
-
react_1.default.createElement(
|
|
36
|
-
react_1.default.createElement(Check, { weight: "bold", color: invert ? greyColor100 : white, size: 16, style: { flexShrink: 0 } }))
|
|
41
|
+
react_1.default.createElement(exports.CheckboxButton, __assign({}, { isSelected: isSelected, disabled: disabled, invert: invert, S: S, className: 'btn' }))
|
|
37
42
|
:
|
|
38
43
|
["markCorrect", "revealCorrect"].includes(markingCommand) ?
|
|
39
44
|
react_1.default.createElement(CheckSquare, { size: S ? 22.5 : 26, color: green, style: {
|
|
@@ -32,8 +32,8 @@ var styled_components_1 = __importStar(require("styled-components"));
|
|
|
32
32
|
var utilsOolib_1 = require("../../../../../../utilsOolib");
|
|
33
33
|
var themes_1 = require("../../../../../../themes");
|
|
34
34
|
var mixins_1 = require("../../../../../../themes/mixins");
|
|
35
|
-
var none = themes_1.colors.none, greyColor40 = themes_1.colors.greyColor40;
|
|
36
|
-
exports.StyledCheckbox = styled_components_1.default.button(
|
|
35
|
+
var none = themes_1.colors.none, greyColor40 = themes_1.colors.greyColor40, greyColor80 = themes_1.colors.greyColor80;
|
|
36
|
+
exports.StyledCheckbox = styled_components_1.default.button(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n \n width: ", ";\n height: ", ";\n border: none;\n box-shadow: inset 0 0 0 2px ", ";\n border-radius: 2px;\n background-color: ", ";\n cursor: ", ";\n\n ", "\n\n\n ", "\n\n &:hover {\n ", "\n }\n\n"], ["\n \n width: ", ";\n height: ", ";\n border: none;\n box-shadow: inset 0 0 0 2px ", ";\n border-radius: 2px;\n background-color: ", ";\n cursor: ", ";\n\n ", "\n\n\n ", "\n\n &:hover {\n ", "\n }\n\n"])), function (_a) {
|
|
37
37
|
var S = _a.S;
|
|
38
38
|
return S ? '1.7rem' : '2rem';
|
|
39
39
|
}, function (_a) {
|
|
@@ -43,8 +43,14 @@ exports.StyledCheckbox = styled_components_1.default.button(templateObject_2 ||
|
|
|
43
43
|
var colors = _a.theme.colors, disabled = _a.disabled, invert = _a.invert;
|
|
44
44
|
return disabled ?
|
|
45
45
|
greyColor40 : invert ? (0, utilsOolib_1.getPrimaryColor40)(colors) : (0, utilsOolib_1.getPrimaryColor100)(colors);
|
|
46
|
-
}, none,
|
|
46
|
+
}, none, function (_a) {
|
|
47
|
+
var disabled = _a.disabled;
|
|
48
|
+
return disabled ? 'not-allowed' : 'pointer';
|
|
49
|
+
}, (0, mixins_1.transition)('background-color 0.2s'), function (_a) {
|
|
47
50
|
var isSelected = _a.isSelected, disabled = _a.disabled, invert = _a.invert, colors = _a.theme.colors;
|
|
48
51
|
return isSelected && (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __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 "])), disabled ? greyColor40 : invert ? (0, utilsOolib_1.getPrimaryColor40)(colors) : (0, utilsOolib_1.getPrimaryColor100)(colors));
|
|
52
|
+
}, function (_a) {
|
|
53
|
+
var isSelected = _a.isSelected, disabled = _a.disabled, theme = _a.theme, invert = _a.invert;
|
|
54
|
+
return !isSelected && !disabled && (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), invert ? greyColor80 : (0, utilsOolib_1.getPrimaryColor10)(theme.colors));
|
|
49
55
|
});
|
|
50
|
-
var templateObject_1, templateObject_2;
|
|
56
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { CheckboxInput } from "./CheckboxInput";
|
|
1
|
+
export { CheckboxInput, CheckboxButton } from "./CheckboxInput";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CheckboxInput = void 0;
|
|
3
|
+
exports.CheckboxButton = exports.CheckboxInput = void 0;
|
|
4
4
|
var CheckboxInput_1 = require("./CheckboxInput");
|
|
5
5
|
Object.defineProperty(exports, "CheckboxInput", { enumerable: true, get: function () { return CheckboxInput_1.CheckboxInput; } });
|
|
6
|
+
Object.defineProperty(exports, "CheckboxButton", { enumerable: true, get: function () { return CheckboxInput_1.CheckboxButton; } });
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
export function RadioButton({ className, isSelected, onClick, disabled, invert, S }: {
|
|
2
|
+
className: any;
|
|
3
|
+
isSelected: any;
|
|
4
|
+
onClick: any;
|
|
5
|
+
disabled: any;
|
|
6
|
+
invert: any;
|
|
7
|
+
S: any;
|
|
8
|
+
}): JSX.Element;
|
|
1
9
|
export function RadioInput({ option, onClick, disabled, invert, value, S, rightWrongResult, }: {
|
|
2
10
|
option: any;
|
|
3
11
|
onClick: any;
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.RadioInput = void 0;
|
|
17
|
+
exports.RadioInput = exports.RadioButton = void 0;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var themes_1 = require("../../../../../../themes");
|
|
20
20
|
var icons_1 = require("../../../../../../icons");
|
|
@@ -24,14 +24,19 @@ var styled_1 = require("../../../../styled");
|
|
|
24
24
|
var styled_2 = require("./styled");
|
|
25
25
|
var green = themes_1.colors.green, red = themes_1.colors.red, greyColor40 = themes_1.colors.greyColor40;
|
|
26
26
|
var XCircle = icons_1.icons.XCircle, CheckCircle = icons_1.icons.CheckCircle;
|
|
27
|
+
var RadioButton = function (_a) {
|
|
28
|
+
var className = _a.className, isSelected = _a.isSelected, onClick = _a.onClick, disabled = _a.disabled, invert = _a.invert, S = _a.S;
|
|
29
|
+
return (react_1.default.createElement(styled_2.StyledRadioInput, __assign({ onClick: function (ev) { return onClick && onClick(ev); } }, { className: className, isSelected: isSelected, disabled: disabled, invert: invert, S: S }), isSelected && react_1.default.createElement(styled_2.StyledRadioInputFill, { invert: invert, S: S })));
|
|
30
|
+
};
|
|
31
|
+
exports.RadioButton = RadioButton;
|
|
27
32
|
var RadioInput = function (_a) {
|
|
28
33
|
var option = _a.option, onClick = _a.onClick, disabled = _a.disabled, invert = _a.invert, value = _a.value, S = _a.S, rightWrongResult = _a.rightWrongResult;
|
|
29
34
|
var isSelected = option.value === (value === null || value === void 0 ? void 0 : value.value);
|
|
30
35
|
var markingCommand = (0, utils_1.getMarkingCommand)({ option: option, isSelected: isSelected }); // returns undefined if option isn't labeled as 'correct' nor selected
|
|
31
36
|
var SuitableTypo = S ? Typo_1.SANS_2 : Typo_1.SANS_3;
|
|
32
|
-
return (react_1.default.createElement(styled_1.StyledOption, __assign({}, { disabled: disabled, rightWrongResult: rightWrongResult, isSelected: isSelected, invert: invert, S: S }, { onClick: function () { return !rightWrongResult && !disabled && onClick
|
|
37
|
+
return (react_1.default.createElement(styled_1.StyledOption, __assign({}, { disabled: disabled, rightWrongResult: rightWrongResult, isSelected: isSelected, invert: invert, S: S }, { onClick: function () { return !rightWrongResult && !disabled && onClick(option); } }),
|
|
33
38
|
!rightWrongResult || markingCommand === undefined ?
|
|
34
|
-
react_1.default.createElement(
|
|
39
|
+
react_1.default.createElement(exports.RadioButton, __assign({}, { isSelected: isSelected, disabled: disabled, invert: invert, S: S, className: 'btn' }))
|
|
35
40
|
:
|
|
36
41
|
["markCorrect", "revealCorrect"].includes(markingCommand) ?
|
|
37
42
|
react_1.default.createElement(CheckCircle, { size: S ? 21 : 24.5, color: green, style: {
|
|
@@ -32,8 +32,8 @@ var styled_components_1 = __importStar(require("styled-components"));
|
|
|
32
32
|
var themes_1 = require("../../../../../../themes");
|
|
33
33
|
var mixins_1 = require("../../../../../../themes/mixins");
|
|
34
34
|
var utilsOolib_1 = require("../../../../../../utilsOolib");
|
|
35
|
-
var none = themes_1.colors.none, white = themes_1.colors.white, greyColor40 = themes_1.colors.greyColor40, greyColor100 = themes_1.colors.greyColor100;
|
|
36
|
-
exports.StyledRadioInput = styled_components_1.default.button(
|
|
35
|
+
var none = themes_1.colors.none, white = themes_1.colors.white, greyColor40 = themes_1.colors.greyColor40, greyColor100 = themes_1.colors.greyColor100, greyColor80 = themes_1.colors.greyColor80;
|
|
36
|
+
exports.StyledRadioInput = styled_components_1.default.button(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border-radius: 50%;\n width: ", ";\n height: ", ";\n border: 2px solid ", ";\n background-color: ", ";\n flex: 0 0 auto;\n cursor: ", ";\n ", "\n\n ", "\n\n &:hover {\n ", "\n }\n\n"], ["\n border-radius: 50%;\n width: ", ";\n height: ", ";\n border: 2px solid ", ";\n background-color: ", ";\n flex: 0 0 auto;\n cursor: ", ";\n ", "\n\n ", "\n\n &:hover {\n ", "\n }\n\n"])), function (_a) {
|
|
37
37
|
var S = _a.S;
|
|
38
38
|
return S ? '1.7rem' : '2rem';
|
|
39
39
|
}, function (_a) {
|
|
@@ -43,15 +43,21 @@ exports.StyledRadioInput = styled_components_1.default.button(templateObject_2 |
|
|
|
43
43
|
var colors = _a.theme.colors, disabled = _a.disabled, invert = _a.invert;
|
|
44
44
|
return disabled ? greyColor40 :
|
|
45
45
|
invert ? (0, utilsOolib_1.getPrimaryColor40)(colors) : (0, utilsOolib_1.getPrimaryColor100)(colors);
|
|
46
|
-
}, none,
|
|
46
|
+
}, none, function (_a) {
|
|
47
|
+
var disabled = _a.disabled;
|
|
48
|
+
return disabled ? 'not-allowed' : 'pointer';
|
|
49
|
+
}, (0, mixins_1.transition)('background-color 0.2s'), function (_a) {
|
|
47
50
|
var isSelected = _a.isSelected;
|
|
48
51
|
return isSelected && (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __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) {
|
|
49
52
|
var colors = _a.theme.colors, disabled = _a.disabled, invert = _a.invert;
|
|
50
53
|
return disabled ? greyColor40 :
|
|
51
54
|
invert ? (0, utilsOolib_1.getPrimaryColor40)(colors) : (0, utilsOolib_1.getPrimaryColor100)(colors);
|
|
52
55
|
});
|
|
56
|
+
}, function (_a) {
|
|
57
|
+
var isSelected = _a.isSelected, disabled = _a.disabled, theme = _a.theme, invert = _a.invert;
|
|
58
|
+
return !isSelected && !disabled && (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), invert ? greyColor80 : (0, utilsOolib_1.getPrimaryColor10)(theme.colors));
|
|
53
59
|
});
|
|
54
|
-
exports.StyledRadioInputFill = styled_components_1.default.div(
|
|
60
|
+
exports.StyledRadioInputFill = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width:", ";\n height:", ";\n flex-shrink: 0;\n border-radius: 50%;\n background-color: ", ";\n"], ["\n width:", ";\n height:", ";\n flex-shrink: 0;\n border-radius: 50%;\n background-color: ", ";\n"])), function (_a) {
|
|
55
61
|
var S = _a.S;
|
|
56
62
|
return S ? '0.7rem' : '0.8rem';
|
|
57
63
|
}, function (_a) {
|
|
@@ -61,4 +67,4 @@ exports.StyledRadioInputFill = styled_components_1.default.div(templateObject_3
|
|
|
61
67
|
var invert = _a.invert;
|
|
62
68
|
return invert ? greyColor100 : white;
|
|
63
69
|
});
|
|
64
|
-
var templateObject_1, templateObject_2, templateObject_3;
|
|
70
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { RadioInput } from "./RadioInput";
|
|
1
|
+
export { RadioInput, RadioButton } from "./RadioInput";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RadioInput = void 0;
|
|
3
|
+
exports.RadioButton = exports.RadioInput = void 0;
|
|
4
4
|
var RadioInput_1 = require("./RadioInput");
|
|
5
5
|
Object.defineProperty(exports, "RadioInput", { enumerable: true, get: function () { return RadioInput_1.RadioInput; } });
|
|
6
|
+
Object.defineProperty(exports, "RadioButton", { enumerable: true, get: function () { return RadioInput_1.RadioButton; } });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { RadioList } from "./comps/RadioList";
|
|
2
|
-
export { RadioInput } from "./comps/RadioList/comps";
|
|
3
2
|
export { CheckboxList } from "./comps/CheckboxList";
|
|
4
|
-
export {
|
|
3
|
+
export { RadioInput, RadioButton } from "./comps/RadioList/comps";
|
|
4
|
+
export { CheckboxInput, CheckboxButton } from "./comps/CheckboxList/comps";
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CheckboxInput = exports.CheckboxList = exports.RadioInput = exports.RadioList = void 0;
|
|
3
|
+
exports.CheckboxButton = exports.CheckboxInput = exports.CheckboxList = exports.RadioButton = exports.RadioInput = exports.RadioList = void 0;
|
|
4
4
|
var RadioList_1 = require("./comps/RadioList");
|
|
5
5
|
Object.defineProperty(exports, "RadioList", { enumerable: true, get: function () { return RadioList_1.RadioList; } });
|
|
6
6
|
var comps_1 = require("./comps/RadioList/comps");
|
|
7
7
|
Object.defineProperty(exports, "RadioInput", { enumerable: true, get: function () { return comps_1.RadioInput; } });
|
|
8
|
+
Object.defineProperty(exports, "RadioButton", { enumerable: true, get: function () { return comps_1.RadioButton; } });
|
|
8
9
|
var CheckboxList_1 = require("./comps/CheckboxList");
|
|
9
10
|
Object.defineProperty(exports, "CheckboxList", { enumerable: true, get: function () { return CheckboxList_1.CheckboxList; } });
|
|
10
11
|
var comps_2 = require("./comps/CheckboxList/comps");
|
|
11
12
|
Object.defineProperty(exports, "CheckboxInput", { enumerable: true, get: function () { return comps_2.CheckboxInput; } });
|
|
13
|
+
Object.defineProperty(exports, "CheckboxButton", { enumerable: true, get: function () { return comps_2.CheckboxButton; } });
|