oolib 2.27.11 → 2.27.12
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.
|
@@ -7,7 +7,7 @@ export function SwitchDouble({ id, value: valueProp, options, onChange, invert,
|
|
|
7
7
|
saveValueAsString: any;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
}, ...args: any[]): any;
|
|
10
|
-
export function SwitchSingle({ id, value, option, onChange, disabled, invert, saveValueAsString, }: {
|
|
10
|
+
export function SwitchSingle({ id, value, option, onChange, disabled, invert, saveValueAsString, layoutStyle, }: {
|
|
11
11
|
id: any;
|
|
12
12
|
value: any;
|
|
13
13
|
option: any;
|
|
@@ -15,4 +15,5 @@ export function SwitchSingle({ id, value, option, onChange, disabled, invert, sa
|
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
invert: any;
|
|
17
17
|
saveValueAsString: any;
|
|
18
|
+
layoutStyle?: string;
|
|
18
19
|
}, ...args: any[]): any;
|
|
@@ -36,16 +36,24 @@ function SwitchDouble(_a) {
|
|
|
36
36
|
var isLeftOptionActive = options[0].value === (value === null || value === void 0 ? void 0 : value.value);
|
|
37
37
|
return (react_1.default.createElement("div", null,
|
|
38
38
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
39
|
-
react_1.default.createElement(styled_1.
|
|
40
|
-
react_1.default.createElement(styled_1.STYLED_SANS_3, __assign({}, {
|
|
39
|
+
react_1.default.createElement(styled_1.StyledSwitchWrapperStyle1, null,
|
|
40
|
+
react_1.default.createElement(styled_1.STYLED_SANS_3, __assign({}, {
|
|
41
|
+
lineHeight: 1,
|
|
42
|
+
semibold: isLeftOptionActive ? true : false,
|
|
43
|
+
invert: invert,
|
|
44
|
+
}), options[0].display),
|
|
41
45
|
react_1.default.createElement(styled_1.StyledButtonSlider, { invert: invert, disabled: disabled, onClick: handleClick },
|
|
42
|
-
react_1.default.createElement(styled_1.StyledSwitch, { className:
|
|
46
|
+
react_1.default.createElement(styled_1.StyledSwitch, { className: "StyledSwitch" //read in styled.js why we are using an okf-anti-pattern
|
|
43
47
|
, invert: invert, disabled: disabled, direction: isLeftOptionActive ? "left" : "right" })),
|
|
44
|
-
react_1.default.createElement(styled_1.STYLED_SANS_3, __assign({}, {
|
|
48
|
+
react_1.default.createElement(styled_1.STYLED_SANS_3, __assign({}, {
|
|
49
|
+
invert: invert,
|
|
50
|
+
semibold: isLeftOptionActive ? false : true,
|
|
51
|
+
lineHeight: 1,
|
|
52
|
+
}), options[1].display))));
|
|
45
53
|
}
|
|
46
54
|
exports.SwitchDouble = SwitchDouble;
|
|
47
55
|
function SwitchSingle(_a) {
|
|
48
|
-
var id = _a.id, value = _a.value, option = _a.option, onChange = _a.onChange, _b = _a.disabled, disabled = _b === void 0 ? false : _b, invert = _a.invert, saveValueAsString = _a.saveValueAsString;
|
|
56
|
+
var id = _a.id, value = _a.value, option = _a.option, onChange = _a.onChange, _b = _a.disabled, disabled = _b === void 0 ? false : _b, invert = _a.invert, saveValueAsString = _a.saveValueAsString, _c = _a.layoutStyle, layoutStyle = _c === void 0 ? "style1" : _c;
|
|
49
57
|
var props = arguments[0];
|
|
50
58
|
/**
|
|
51
59
|
* very important that we check this way,
|
|
@@ -62,12 +70,16 @@ function SwitchSingle(_a) {
|
|
|
62
70
|
onChange &&
|
|
63
71
|
onChange(id, isInactive ? (saveValueAsString ? option.value : option) : undefined);
|
|
64
72
|
};
|
|
73
|
+
var genSwitch = function () { return (react_1.default.createElement(styled_1.StyledButtonSlider, { inactive: isInactive, disabled: disabled, invert: invert, onClick: handleClick },
|
|
74
|
+
react_1.default.createElement(styled_1.StyledSwitch, { className: "StyledSwitch" //read in styled.js why we are using an okf-anti-pattern
|
|
75
|
+
, direction: isInactive ? "left" : "right", inactive: isInactive, disabled: disabled, invert: invert }))); };
|
|
76
|
+
var genSwitchDisplay = function () { return (react_1.default.createElement(styled_1.STYLED_SANS_3, __assign({}, { invert: invert, lineHeight: 1, semibold: isInactive ? false : true }), option.display)); };
|
|
65
77
|
return (react_1.default.createElement("div", null,
|
|
66
78
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
67
|
-
react_1.default.createElement(styled_1.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
79
|
+
layoutStyle === "style1" ? (react_1.default.createElement(styled_1.StyledSwitchWrapperStyle1, null,
|
|
80
|
+
genSwitch(),
|
|
81
|
+
genSwitchDisplay())) : layoutStyle === "style2" && (react_1.default.createElement(styled_1.StyledSwitchWrapperStyle2, null,
|
|
82
|
+
genSwitchDisplay(),
|
|
83
|
+
genSwitch()))));
|
|
72
84
|
}
|
|
73
85
|
exports.SwitchSingle = SwitchSingle;
|
|
@@ -7,15 +7,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.STYLED_SANS_3 = exports.StyledSwitch = exports.StyledButtonSlider = exports.
|
|
10
|
+
exports.STYLED_SANS_3 = exports.StyledSwitch = exports.StyledButtonSlider = exports.StyledSwitchWrapperStyle2 = exports.StyledSwitchWrapperStyle1 = void 0;
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
var themes_1 = require("../../themes");
|
|
13
13
|
var mixins_1 = require("../../themes/mixins");
|
|
14
14
|
var utilsOolib_1 = require("../../utilsOolib");
|
|
15
15
|
var Typo_1 = require("../Typo");
|
|
16
16
|
var white = themes_1.colors.white, greyColor10 = themes_1.colors.greyColor10, greyColor80 = themes_1.colors.greyColor80, greyColor70 = themes_1.colors.greyColor70, greyColor100 = themes_1.colors.greyColor100, greyColor40 = themes_1.colors.greyColor40;
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
17
|
+
exports.StyledSwitchWrapperStyle1 = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n /* justify-content: center; */\n align-items: center;\n gap: 1rem;\n"], ["\n display: flex;\n /* justify-content: center; */\n align-items: center;\n gap: 1rem;\n"])));
|
|
18
|
+
exports.StyledSwitchWrapperStyle2 = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n"], ["\n display: flex;\n justify-content: space-between;\n align-items: center;\n"])));
|
|
19
|
+
exports.StyledButtonSlider = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 4rem;\n height: 2rem;\n user-select: none;\n position: relative;\n \n border-radius: 1rem;\n cursor: ", ";\n background-color: ", ";\n\n &:hover {\n background-color: ", ";\n\n & > .StyledSwitch {\n border-color: ", "; \n }\n }\n\n \n\n ", "\n"], ["\n width: 4rem;\n height: 2rem;\n user-select: none;\n position: relative;\n \n border-radius: 1rem;\n cursor: ", ";\n background-color: ", ";\n\n &:hover {\n background-color: ", ";\n\n & > .StyledSwitch {\n border-color: ", "; \n }\n }\n\n \n\n ", "\n"])), function (_a) {
|
|
19
20
|
var disabled = _a.disabled;
|
|
20
21
|
return disabled ? 'not-allowed' : 'pointer';
|
|
21
22
|
}, function (_a) {
|
|
@@ -32,7 +33,7 @@ exports.StyledButtonSlider = styled_components_1.default.div(templateObject_2 ||
|
|
|
32
33
|
var colors = _a.theme.colors, inactive = _a.inactive, disabled = _a.disabled;
|
|
33
34
|
return !disabled && (inactive ? greyColor40 : (0, utilsOolib_1.getPrimaryColorText)(colors));
|
|
34
35
|
}, (0, mixins_1.transition)('background-color'));
|
|
35
|
-
exports.StyledSwitch = styled_components_1.default.button(
|
|
36
|
+
exports.StyledSwitch = styled_components_1.default.button(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 2rem;\n height: 2rem;\n background-color: ", ";\n outline: none;\n ", ";\n border-radius: 50%;\n cursor: ", ";\n border: 2px solid; \n border-color: ", ";\n position: absolute;\n top: 0;\n left: ", ";\n\n /**\n this is the styled comps way of dealing with child hover.\n But it is a buggy functionality. Probably an issue at\n the styled-components package level. Should report on their github\n\n Instead we use the oldschool class approach for child hover (line 40)\n */\n /* ", ":hover & {\n border-color: ", "; \n } */\n \n"], ["\n width: 2rem;\n height: 2rem;\n background-color: ", ";\n outline: none;\n ", ";\n border-radius: 50%;\n cursor: ", ";\n border: 2px solid; \n border-color: ", ";\n position: absolute;\n top: 0;\n left: ", ";\n\n /**\n this is the styled comps way of dealing with child hover.\n But it is a buggy functionality. Probably an issue at\n the styled-components package level. Should report on their github\n\n Instead we use the oldschool class approach for child hover (line 40)\n */\n /* ", ":hover & {\n border-color: ", "; \n } */\n \n"])), function (_a) {
|
|
36
37
|
var invert = _a.invert;
|
|
37
38
|
return invert ? greyColor100 : white;
|
|
38
39
|
}, (0, mixins_1.transition)('border-color', 'left 0.2s'), function (_a) {
|
|
@@ -52,11 +53,11 @@ exports.StyledSwitch = styled_components_1.default.button(templateObject_3 || (t
|
|
|
52
53
|
var colors = _a.theme.colors, inactive = _a.inactive, disabled = _a.disabled;
|
|
53
54
|
return !disabled && (inactive ? greyColor40 : (0, utilsOolib_1.getPrimaryColorText)(colors));
|
|
54
55
|
});
|
|
55
|
-
exports.STYLED_SANS_3 = (0, styled_components_1.default)(Typo_1.SANS_3)(
|
|
56
|
+
exports.STYLED_SANS_3 = (0, styled_components_1.default)(Typo_1.SANS_3)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: ", ";\n line-height: ", ";\n ", "\n"], ["\n color: ", ";\n line-height: ", ";\n ", "\n"])), function (_a) {
|
|
56
57
|
var color = _a.color;
|
|
57
58
|
return color;
|
|
58
59
|
}, function (_a) {
|
|
59
60
|
var lineHeight = _a.lineHeight;
|
|
60
61
|
return lineHeight;
|
|
61
62
|
}, (0, mixins_1.transition)('color'));
|
|
62
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
63
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|