oolib 2.176.1 → 2.176.3
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/index.d.ts +4 -2
- package/dist/index.js +17 -7
- package/dist/stories/v2/components/RadioButton.stories.d.ts +1 -0
- package/dist/stories/v2/components/RadioButton.stories.js +1 -0
- package/dist/stories/v2/components/Switches.stories.js +4 -4
- package/dist/v2/components/Buttons/styled.js +8 -8
- package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/index.js +8 -2
- package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/styled.js +4 -4
- package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.js +1 -1
- package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.d.ts +2 -1
- package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.js +5 -7
- package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.d.ts +1 -1
- package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.js +14 -13
- package/dist/v2/components/RadioAndCheckbox/styled.js +5 -4
- package/dist/v2/components/Switches/index.js +5 -4
- package/dist/v2/components/Switches/styled.d.ts +1 -3
- package/dist/v2/components/Switches/styled.js +24 -30
- package/dist/v2/themes/utils/baseStyling.d.ts +3 -1
- package/dist/v2/themes/utils/baseStyling.js +7 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export * from "./components/InlineAlert";
|
|
|
8
8
|
export * from "./components/TextInputs";
|
|
9
9
|
export * from "./components/Container";
|
|
10
10
|
export * from "./components/Wrappers";
|
|
11
|
-
export * from "./components/Switches";
|
|
12
11
|
export * from "./components/TabBar";
|
|
13
12
|
export * from "./components/Margins";
|
|
14
13
|
export * from "./components/Paddings";
|
|
@@ -20,6 +19,7 @@ export * from "./v2/components/Typo2";
|
|
|
20
19
|
export * from "./v2/components/BlockLabel";
|
|
21
20
|
export { colors } from "./themes";
|
|
22
21
|
export { icons } from "./icons";
|
|
22
|
+
export { SwitchDouble } from "./components/Switches";
|
|
23
23
|
export { Section } from "./components/Section";
|
|
24
24
|
export { UserRoleBadge } from "./components/UserRoleBadge";
|
|
25
25
|
export { OKELink } from "./components/OKELink";
|
|
@@ -76,11 +76,13 @@ export { DataVizAccordion } from "./v2/components/DataVizAccordion";
|
|
|
76
76
|
export { CheckboxList } from "./v2/components/RadioAndCheckbox/comps/CheckboxList";
|
|
77
77
|
export { CheckboxInput } from "./v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput";
|
|
78
78
|
export { CheckboxButton } from "./v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton";
|
|
79
|
+
export { RadioList } from "./v2/components/RadioAndCheckbox/comps/RadioList/index";
|
|
80
|
+
export { SwitchSingle } from "./v2/components/Switches";
|
|
79
81
|
export * as baseStyling from "./v2/themes/utils/baseStyling";
|
|
80
82
|
export { LoaderCircle, ProgressBar, LoaderCircle as Loader, LoaderOverlay } from "./components/LoadersAndProgress";
|
|
81
83
|
export { TagClear, TagLink, TagSelect, TagDisplay } from "./components/Tags";
|
|
82
|
-
export { RadioButton, RadioInput, RadioList } from "./components/RadioAndCheckbox";
|
|
83
84
|
export { BannerAlert, BannerInfo } from "./components/Banners";
|
|
84
85
|
export { BannerContext, useBannerContext, BannerProvider } from "./components/Banners/bannerContext";
|
|
85
86
|
export { TagDisplay as TagDisplayV2, TagLink as TagLinkV2, TagClear as TagClearV2 } from "./v2/components/Tags";
|
|
86
87
|
export { ButtonPrimary as ButtonPrimaryV2, ButtonSecondary as ButtonSecondaryV2, ButtonTertiary as ButtonTertiaryV2, ButtonGhost as ButtonGhostV2, ButtonPrimaryCompact, ButtonSecondaryCompact, ButtonTertiaryCompact } from "./v2/components/Buttons";
|
|
88
|
+
export { RadioInput, RadioButton } from "./v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index";
|
package/dist/index.js
CHANGED
|
@@ -39,8 +39,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.VideoInput = exports.ProfileImageInput = exports.ImageInput = exports.MetaBlock = exports.genTagComp = exports.generateOptions = exports.OptionsSingle = exports.DropdownMulti = exports.DropdownSingle = exports.parseCardConfig = exports.ListProfile = exports.CardProfile = exports.CardEmbed = exports.DateTimeRangePicker = exports.DateTimePicker = exports.TimeRangePicker = exports.TimePicker = exports.DateRangePicker = exports.DatePicker = exports.TextLoader = exports.PageScrollIndicator = exports.HomeCover = exports.EmptyStates = exports.ModalSmall = exports.Modal = exports.ModalForms = exports.ModalConfirm = exports.SkeletonLoader = exports.Divider = exports.PercentCompletedPie = exports.Accordion = exports.ActionMenu = exports.Tooltip = exports.OKELink = exports.UserRoleBadge = exports.Section = exports.
|
|
43
|
-
exports.baseStyling = exports.CheckboxButton = exports.CheckboxInput = exports.CheckboxList = exports.DataVizAccordion = exports.BarChart = exports.HomeCoverV2 = exports.DateRangePickerV2 = exports.MetaBlockV2 = exports.colors2 = exports.TabBarV2 = exports.ButtonTertiaryCompact = exports.ButtonSecondaryCompact = exports.ButtonPrimaryCompact = exports.ButtonGhostV2 = exports.ButtonTertiaryV2 = exports.ButtonSecondaryV2 = exports.ButtonPrimaryV2 = exports.TagClearV2 = exports.TagLinkV2 = exports.TagDisplayV2 = exports.HintsProvider = exports.TableCellResizerPlugin = exports.styledOKELinkCSS = exports.SimpleTable = exports.ModalConfirmAction = exports.BannerProvider = exports.useBannerContext = exports.BannerContext = exports.BannerInfo = exports.BannerAlert = exports.GroupQuestionsInputSingle = exports.ResourceInput = exports.IFrameInput =
|
|
42
|
+
exports.PDFInput = exports.AudioInput = exports.VideoInput = exports.ProfileImageInput = exports.ImageInput = exports.MetaBlock = exports.genTagComp = exports.generateOptions = exports.OptionsSingle = exports.DropdownMulti = exports.DropdownSingle = exports.parseCardConfig = exports.ListProfile = exports.CardProfile = exports.CardEmbed = exports.DateTimeRangePicker = exports.DateTimePicker = exports.TimeRangePicker = exports.TimePicker = exports.DateRangePicker = exports.DatePicker = exports.TextLoader = exports.PageScrollIndicator = exports.HomeCover = exports.EmptyStates = exports.ModalSmall = exports.Modal = exports.ModalForms = exports.ModalConfirm = exports.SkeletonLoader = exports.Divider = exports.PercentCompletedPie = exports.Accordion = exports.ActionMenu = exports.Tooltip = exports.OKELink = exports.UserRoleBadge = exports.Section = exports.SwitchDouble = exports.TagDisplay = exports.TagSelect = exports.TagLink = exports.TagClear = exports.LoaderOverlay = exports.Loader = exports.ProgressBar = exports.LoaderCircle = exports.icons = exports.colors = exports.GlobalStyles = void 0;
|
|
43
|
+
exports.baseStyling = exports.SwitchSingle = exports.RadioButton = exports.RadioInput = exports.RadioList = exports.CheckboxButton = exports.CheckboxInput = exports.CheckboxList = exports.DataVizAccordion = exports.BarChart = exports.HomeCoverV2 = exports.DateRangePickerV2 = exports.MetaBlockV2 = exports.colors2 = exports.TabBarV2 = exports.ButtonTertiaryCompact = exports.ButtonSecondaryCompact = exports.ButtonPrimaryCompact = exports.ButtonGhostV2 = exports.ButtonTertiaryV2 = exports.ButtonSecondaryV2 = exports.ButtonPrimaryV2 = exports.TagClearV2 = exports.TagLinkV2 = exports.TagDisplayV2 = exports.HintsProvider = exports.TableCellResizerPlugin = exports.styledOKELinkCSS = exports.SimpleTable = exports.ModalConfirmAction = exports.BannerProvider = exports.useBannerContext = exports.BannerContext = exports.BannerInfo = exports.BannerAlert = exports.GroupQuestionsInputSingle = exports.ResourceInput = exports.IFrameInput = void 0;
|
|
44
44
|
//css and styling related ( styled-components )
|
|
45
45
|
var globalStyles_1 = require("./globalStyles");
|
|
46
46
|
Object.defineProperty(exports, "GlobalStyles", { enumerable: true, get: function () { return globalStyles_1.GlobalStyles; } });
|
|
@@ -71,12 +71,14 @@ __exportStar(require("./components/InlineAlert"), exports);
|
|
|
71
71
|
__exportStar(require("./components/TextInputs"), exports);
|
|
72
72
|
__exportStar(require("./components/Container"), exports);
|
|
73
73
|
__exportStar(require("./components/Wrappers"), exports);
|
|
74
|
-
|
|
74
|
+
var Switches_1 = require("./components/Switches");
|
|
75
|
+
Object.defineProperty(exports, "SwitchDouble", { enumerable: true, get: function () { return Switches_1.SwitchDouble; } });
|
|
75
76
|
__exportStar(require("./components/TabBar"), exports);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
// export {
|
|
78
|
+
// RadioButton,
|
|
79
|
+
// RadioInput,
|
|
80
|
+
// RadioList
|
|
81
|
+
// } from './components/RadioAndCheckbox';
|
|
80
82
|
__exportStar(require("./components/Margins"), exports);
|
|
81
83
|
__exportStar(require("./components/Paddings"), exports);
|
|
82
84
|
var Section_1 = require("./components/Section");
|
|
@@ -237,4 +239,12 @@ var CheckboxInput_1 = require("./v2/components/RadioAndCheckbox/comps/CheckboxLi
|
|
|
237
239
|
Object.defineProperty(exports, "CheckboxInput", { enumerable: true, get: function () { return CheckboxInput_1.CheckboxInput; } });
|
|
238
240
|
var CheckboxButton_1 = require("./v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton");
|
|
239
241
|
Object.defineProperty(exports, "CheckboxButton", { enumerable: true, get: function () { return CheckboxButton_1.CheckboxButton; } });
|
|
242
|
+
var index_1 = require("./v2/components/RadioAndCheckbox/comps/RadioList/index");
|
|
243
|
+
Object.defineProperty(exports, "RadioList", { enumerable: true, get: function () { return index_1.RadioList; } });
|
|
244
|
+
var index_2 = require("./v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index");
|
|
245
|
+
Object.defineProperty(exports, "RadioInput", { enumerable: true, get: function () { return index_2.RadioInput; } });
|
|
246
|
+
var index_3 = require("./v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index");
|
|
247
|
+
Object.defineProperty(exports, "RadioButton", { enumerable: true, get: function () { return index_3.RadioButton; } });
|
|
248
|
+
var Switches_2 = require("./v2/components/Switches");
|
|
249
|
+
Object.defineProperty(exports, "SwitchSingle", { enumerable: true, get: function () { return Switches_2.SwitchSingle; } });
|
|
240
250
|
exports.baseStyling = __importStar(require("./v2/themes/utils/baseStyling"));
|
|
@@ -76,8 +76,8 @@ var SwitchDouble = function (args) {
|
|
|
76
76
|
};
|
|
77
77
|
exports.SwitchDouble = SwitchDouble;
|
|
78
78
|
exports.SwitchDouble.args = {
|
|
79
|
-
rightOption: '
|
|
80
|
-
leftOption: '
|
|
79
|
+
rightOption: 'Right Option',
|
|
80
|
+
leftOption: 'Left Option',
|
|
81
81
|
disabled: false,
|
|
82
82
|
invert: false,
|
|
83
83
|
saveValueAsString: true,
|
|
@@ -89,7 +89,7 @@ exports.SwitchDouble.argTypes = {
|
|
|
89
89
|
defaultValue: 'style1'
|
|
90
90
|
},
|
|
91
91
|
rightOption: {
|
|
92
|
-
name: 'Right
|
|
92
|
+
name: 'Right Option'
|
|
93
93
|
},
|
|
94
94
|
leftOption: {
|
|
95
95
|
name: "Left Option"
|
|
@@ -121,7 +121,7 @@ exports.SwitchSingle.parameters = {
|
|
|
121
121
|
controls: { exclude: ['leftOption'] }
|
|
122
122
|
};
|
|
123
123
|
exports.SwitchSingle.args = {
|
|
124
|
-
rightOption: '
|
|
124
|
+
rightOption: 'Right Option',
|
|
125
125
|
layoutStyle: 'style1',
|
|
126
126
|
disabled: false,
|
|
127
127
|
invert: false,
|
|
@@ -72,11 +72,11 @@ var variants = {
|
|
|
72
72
|
return colors ? (0, getDynamicColors_1.getOnPrimary)(colors) : onPrimary;
|
|
73
73
|
}, function (_a) {
|
|
74
74
|
var forceHover = _a.forceHover;
|
|
75
|
-
return forceHover && (0, baseStyling_1.
|
|
75
|
+
return forceHover && (0, baseStyling_1.applyBlackOverlayOnHover)();
|
|
76
76
|
}, function (_a) {
|
|
77
77
|
var disabled = _a.disabled;
|
|
78
78
|
return disabled && disabledStyles;
|
|
79
|
-
}, (0, baseStyling_1.
|
|
79
|
+
}, (0, baseStyling_1.applyBlackOverlayOnHover)()),
|
|
80
80
|
secondary: (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n \n ", "\n ", "\n \n @media (hover: hover) {\n &:hover {\n ", "\n }\n }\n "], ["\n background-color: ", ";\n color: ", ";\n \n ", "\n ", "\n \n @media (hover: hover) {\n &:hover {\n ", "\n }\n }\n "])), function (_a) {
|
|
81
81
|
var colors = _a.theme.colors;
|
|
82
82
|
return colors ? (0, getDynamicColors_1.getSecondaryContainer)(colors) : secondaryContainer;
|
|
@@ -88,22 +88,22 @@ var variants = {
|
|
|
88
88
|
return disabled && disabledStyles;
|
|
89
89
|
}, function (_a) {
|
|
90
90
|
var forceHover = _a.forceHover;
|
|
91
|
-
return forceHover && (0, baseStyling_1.
|
|
92
|
-
}, (0, baseStyling_1.
|
|
91
|
+
return forceHover && (0, baseStyling_1.applyBlackOverlayOnHover)();
|
|
92
|
+
}, (0, baseStyling_1.applyBlackOverlayOnHover)()),
|
|
93
93
|
tertiary: (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background-color: transparent;\n color: ", ";\n /* border: 1px solid ", "; */\n box-sizing: border-box;\n outline: 1px solid ", ";\n ", "\n\n ", "\n\n @media (hover: hover) {\n &:hover {\n ", "\n }\n }\n "], ["\n background-color: transparent;\n color: ", ";\n /* border: 1px solid ", "; */\n box-sizing: border-box;\n outline: 1px solid ", ";\n ", "\n\n ", "\n\n @media (hover: hover) {\n &:hover {\n ", "\n }\n }\n "])), grey80, colors_1.colors.grey10, grey10, function (_a) {
|
|
94
94
|
var disabled = _a.disabled;
|
|
95
95
|
return disabled && (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n pointer-events: none;\n "], ["\n color: ", ";\n pointer-events: none;\n "])), grey40);
|
|
96
96
|
}, function (_a) {
|
|
97
97
|
var forceHover = _a.forceHover;
|
|
98
|
-
return forceHover && (0, baseStyling_1.
|
|
99
|
-
}, (0, baseStyling_1.
|
|
98
|
+
return forceHover && (0, baseStyling_1.applyBlackOverlayOnHover)();
|
|
99
|
+
}, (0, baseStyling_1.applyBlackOverlayOnHover)()),
|
|
100
100
|
ghost: (0, styled_components_1.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n background-color: transparent;\n color: ", ";\n\n ", "\n \n ", "\n \n @media (hover: hover) {\n &:hover {\n ", "\n }\n }\n "], ["\n background-color: transparent;\n color: ", ";\n\n ", "\n \n ", "\n \n @media (hover: hover) {\n &:hover {\n ", "\n }\n }\n "])), grey80, function (_a) {
|
|
101
101
|
var disabled = _a.disabled;
|
|
102
102
|
return disabled && (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: ", ";\n pointer-events: none;\n "], ["\n color: ", ";\n pointer-events: none;\n "])), grey40);
|
|
103
103
|
}, function (_a) {
|
|
104
104
|
var forceHover = _a.forceHover;
|
|
105
|
-
return forceHover && (0, baseStyling_1.
|
|
106
|
-
}, (0, baseStyling_1.
|
|
105
|
+
return forceHover && (0, baseStyling_1.applyBlackOverlayOnHover)();
|
|
106
|
+
}, (0, baseStyling_1.applyBlackOverlayOnHover)()),
|
|
107
107
|
};
|
|
108
108
|
// Composition Styles
|
|
109
109
|
var getCompositionStyles = function (composition, responsive) {
|
package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/index.js
CHANGED
|
@@ -8,8 +8,12 @@ var react_1 = __importDefault(require("react"));
|
|
|
8
8
|
var icons_1 = require("../../../../../../../icons");
|
|
9
9
|
var themes_1 = require("../../../../../../themes");
|
|
10
10
|
var styled_1 = require("./styled");
|
|
11
|
+
var getDynamicColors_1 = require("../../../../../../themes/utils/getDynamicColors");
|
|
12
|
+
var styled_components_1 = require("styled-components");
|
|
13
|
+
var _EXPORTS_1 = require("../../../../../../../utils/_EXPORTS");
|
|
14
|
+
var mixins_1 = require("../../../../../../../themes/mixins");
|
|
11
15
|
var Check = icons_1.icons.Check, Minus = icons_1.icons.Minus;
|
|
12
|
-
var white = themes_1.colors.white, greyColor100 = themes_1.colors.greyColor100,
|
|
16
|
+
var white = themes_1.colors.white, greyColor100 = themes_1.colors.greyColor100, grey40 = themes_1.colors.grey40;
|
|
13
17
|
/**
|
|
14
18
|
* value and onChange are being passed as props so
|
|
15
19
|
* that it can be generated dynamically via our
|
|
@@ -20,18 +24,20 @@ var CheckboxButton = function (_a) {
|
|
|
20
24
|
var id = _a.id, className = _a.className, _isSelected = _a.isSelected, isMixture = _a.isMixture, //basically if isSelected/value && isMixture is true, then we get that '-' thing in the checkbox (useful on table headers where some (not all) rows are selected below)
|
|
21
25
|
value = _a.value, //can be used interchangibly with isSelected
|
|
22
26
|
onChange = _a.onChange, disabled = _a.disabled, invert = _a.invert, S = _a.S;
|
|
27
|
+
var theme = (0, styled_components_1.useTheme)();
|
|
23
28
|
var isSelected = (_b = _isSelected !== null && _isSelected !== void 0 ? _isSelected : value) !== null && _b !== void 0 ? _b : false;
|
|
24
29
|
var CheckIcon = (isSelected && isMixture)
|
|
25
30
|
? Minus
|
|
26
31
|
: isSelected
|
|
27
32
|
? Check
|
|
28
33
|
: undefined;
|
|
34
|
+
var screenWidth = (0, _EXPORTS_1.useScreenWidth)();
|
|
29
35
|
return (react_1.default.createElement(styled_1.StyledCheckbox, { style: { overflow: 'hidden' }, onClick: function (e) {
|
|
30
36
|
// e.preventDefault();
|
|
31
37
|
// e.stopPropagation(); //this disables the checkbox in checkboxlist which we dont want. so commented. tho we might need this later in table usecase in which case we will have to make stopPropagration a prop
|
|
32
38
|
onChange && onChange(id, !isSelected);
|
|
33
39
|
}, className: className, isSelected: isSelected, disabled: disabled, invert: invert, S: S }, isSelected && (react_1.default.createElement("div", { style: { filter: "drop-shadow(0px 4px 6px rgba(0, 0, 0, 0.25))", display: 'flex' } },
|
|
34
|
-
react_1.default.createElement(CheckIcon, { weight: "bold", color: disabled ? grey40 :
|
|
40
|
+
react_1.default.createElement(CheckIcon, { weight: "bold", color: disabled ? grey40 : (0, getDynamicColors_1.getOnSecondary)(theme === null || theme === void 0 ? void 0 : theme.colors), size: screenWidth >= (0, mixins_1.getBreakPoint)('md') ? 14 : 16, style: {
|
|
35
41
|
flexShrink: 0,
|
|
36
42
|
} })))));
|
|
37
43
|
};
|
package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/styled.js
CHANGED
|
@@ -54,9 +54,9 @@ exports.StyledCheckbox = styled_components_1.default.button(templateObject_3 ||
|
|
|
54
54
|
}
|
|
55
55
|
return "none";
|
|
56
56
|
}, function (_a) {
|
|
57
|
-
var isSelected = _a.isSelected, disabled = _a.disabled,
|
|
57
|
+
var isSelected = _a.isSelected, disabled = _a.disabled, theme = _a.theme;
|
|
58
58
|
if (isSelected) {
|
|
59
|
-
return disabled ? grey5 : (0, getDynamicColors_1.getSecondaryContainer)(colors);
|
|
59
|
+
return disabled ? grey5 : (0, getDynamicColors_1.getSecondaryContainer)(theme === null || theme === void 0 ? void 0 : theme.colors);
|
|
60
60
|
}
|
|
61
61
|
return disabled ? grey5 : "white";
|
|
62
62
|
}, function (_a) {
|
|
@@ -64,10 +64,10 @@ exports.StyledCheckbox = styled_components_1.default.button(templateObject_3 ||
|
|
|
64
64
|
return (disabled ? "not-allowed" : "pointer");
|
|
65
65
|
}, function (_a) {
|
|
66
66
|
var isSelected = _a.isSelected, disabled = _a.disabled;
|
|
67
|
-
return isSelected && !disabled && (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", " \n "], ["\n ", " \n "])), (0, baseStyling_1.
|
|
67
|
+
return isSelected && !disabled && (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", " \n "], ["\n ", " \n "])), (0, baseStyling_1.applyBlackOverlayOnHover)());
|
|
68
68
|
}, function (_a) {
|
|
69
69
|
var isSelected = _a.isSelected, disabled = _a.disabled;
|
|
70
70
|
return !disabled &&
|
|
71
|
-
!isSelected && (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n
|
|
71
|
+
!isSelected && (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), baseStyling_1.borderStyleOnHover);
|
|
72
72
|
});
|
|
73
73
|
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -21,7 +21,7 @@ var CheckboxInput = function (_a) {
|
|
|
21
21
|
var markingCommand = (0, utils_1.getMarkingCommand)({ option: option, isSelected: isSelected }); // returns undefined if option isn't labeled as 'correct' nor selected
|
|
22
22
|
var genCheckboxButton = function (options) {
|
|
23
23
|
if (options === void 0) { options = {}; }
|
|
24
|
-
return (react_1.default.createElement(CheckboxButton_1.CheckboxButton, { isSelected: isSelected, disabled: disabled, invert: invert, S: S, className: "
|
|
24
|
+
return (react_1.default.createElement(CheckboxButton_1.CheckboxButton, { isSelected: isSelected, disabled: disabled, invert: invert, S: S, className: "radioOrCheckboxButton_inside_input", disabled: disabled }));
|
|
25
25
|
};
|
|
26
26
|
var genCheckSquare = function () { return (react_1.default.createElement("div", { style: { flexShrink: 0 } },
|
|
27
27
|
react_1.default.createElement(CheckSquare, { size: S ? 22.5 : 26, color: disabled ? grey40 : onSecondary, style: {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export function RadioButton({ isSelected, onClick, disabled, invert, S, readOnly }: {
|
|
1
|
+
export function RadioButton({ isSelected, onClick, disabled, invert, S, readOnly, className }: {
|
|
2
2
|
isSelected: any;
|
|
3
3
|
onClick: any;
|
|
4
4
|
disabled: any;
|
|
5
5
|
invert: any;
|
|
6
6
|
S: any;
|
|
7
7
|
readOnly: any;
|
|
8
|
+
className: any;
|
|
8
9
|
}): React.JSX.Element;
|
|
9
10
|
export function RadioInput({ option, onClick, disabled, invert, value, S, rightWrongResult, }: {
|
|
10
11
|
option: any;
|
|
@@ -11,23 +11,21 @@ var Typo_1 = require("../../../../../../../components/Typo");
|
|
|
11
11
|
var utils_1 = require("../../../../utils");
|
|
12
12
|
var styled_1 = require("../../../../styled");
|
|
13
13
|
var styled_2 = require("./styled");
|
|
14
|
+
var Typo2_1 = require("../../../../../Typo2");
|
|
14
15
|
var invertGreen = themes_1.colors.invertGreen, red = themes_1.colors.red, greyColor40 = themes_1.colors.greyColor40, green = themes_1.colors.green, invertRed = themes_1.colors.invertRed;
|
|
15
16
|
var XCircle = icons_1.icons.XCircle, CheckCircle = icons_1.icons.CheckCircle;
|
|
16
17
|
var RadioButton = function (_a) {
|
|
17
|
-
var isSelected = _a.isSelected, onClick = _a.onClick, disabled = _a.disabled, invert = _a.invert, S = _a.S, readOnly = _a.readOnly;
|
|
18
|
-
return (react_1.default.createElement(styled_2.
|
|
18
|
+
var isSelected = _a.isSelected, onClick = _a.onClick, disabled = _a.disabled, invert = _a.invert, S = _a.S, readOnly = _a.readOnly, className = _a.className;
|
|
19
|
+
return (react_1.default.createElement(styled_2.StyledRadioButton, { style: { overflow: 'hidden' }, className: className || '', onClick: function (ev) { return onClick && onClick(ev); }, isSelected: isSelected, disabled: disabled, invert: invert, S: S, readOnly: readOnly }));
|
|
19
20
|
};
|
|
20
21
|
exports.RadioButton = RadioButton;
|
|
21
22
|
var RadioInput = function (_a) {
|
|
22
23
|
var option = _a.option, onClick = _a.onClick, disabled = _a.disabled, invert = _a.invert, value = _a.value, S = _a.S, rightWrongResult = _a.rightWrongResult;
|
|
23
24
|
var isSelected = option.value === (value === null || value === void 0 ? void 0 : value.value);
|
|
24
25
|
var markingCommand = (0, utils_1.getMarkingCommand)({ option: option, isSelected: isSelected }); // returns undefined if option isn't labeled as 'correct' nor selected
|
|
25
|
-
var TYPO_COMP = S
|
|
26
|
-
? Typo_1.SANS_2
|
|
27
|
-
: Typo_1.SANS_3;
|
|
28
26
|
var genRadioButton = function (options) {
|
|
29
27
|
if (options === void 0) { options = {}; }
|
|
30
|
-
return (react_1.default.createElement(exports.RadioButton, { isSelected: isSelected, invert: invert, S: S, className: '
|
|
28
|
+
return (react_1.default.createElement(exports.RadioButton, { isSelected: isSelected, invert: invert, S: S, className: 'radioOrCheckboxButton_inside_input',
|
|
31
29
|
disabled: options.disabled || disabled //because we force disabled if rightWrongResult exists & no markingCommand exists against this option i.e, it neither has to be marked right nor wrong
|
|
32
30
|
}));
|
|
33
31
|
};
|
|
@@ -48,6 +46,6 @@ var RadioInput = function (_a) {
|
|
|
48
46
|
: genRadioButton({ disabled: true }) //else rightWrongResult has come in, but this doesnt have to be marked right or wrong
|
|
49
47
|
: genRadioButton() // rightWrongResult as not come in. so gen normal radio button
|
|
50
48
|
,
|
|
51
|
-
react_1.default.createElement(
|
|
49
|
+
react_1.default.createElement(Typo2_1.UI_BODY_SM_DF, { bold: rightWrongResult && isSelected, color: disabled && greyColor40, invert: invert }, option.display)));
|
|
52
50
|
};
|
|
53
51
|
exports.RadioInput = RadioInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const StyledRadioButton: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
@@ -37,18 +37,17 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
37
37
|
};
|
|
38
38
|
})();
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.
|
|
40
|
+
exports.StyledRadioButton = void 0;
|
|
41
41
|
var styled_components_1 = __importStar(require("styled-components"));
|
|
42
42
|
var themes_1 = require("../../../../../../themes");
|
|
43
43
|
var mixins_1 = require("../../../../../../../themes/mixins");
|
|
44
|
-
var
|
|
44
|
+
var baseStyling_1 = require("../../../../../../themes/utils/baseStyling");
|
|
45
|
+
var getDynamicColors_1 = require("../../../../../../themes/utils/getDynamicColors");
|
|
45
46
|
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, grey5 = themes_1.colors.grey5, grey10 = themes_1.colors.grey10, grey20 = themes_1.colors.grey20;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
exports.StyledRadioInput = styled_components_1.default.button(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background: ", ";\n border: ", ";\n cursor: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n\n &:hover {\n ", "\n }\n\n &:focus {\n outline: none;\n box-shadow: ", ";\n }\n\n /* add the smaller circle for selected state */\n &::after {\n content: \"\";\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: ", ";\n border: ", ";\n box-shadow: ", ";\n }\n"], ["\n position: relative;\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background: ", ";\n border: ", ";\n cursor: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n\n &:hover {\n ", "\n }\n\n &:focus {\n outline: none;\n box-shadow: ", ";\n }\n\n /* add the smaller circle for selected state */\n &::after {\n content: \"\";\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: ", ";\n border: ", ";\n box-shadow: ", ";\n }\n"])), function (_a) {
|
|
49
|
-
var isSelected = _a.isSelected, disabled = _a.disabled;
|
|
47
|
+
exports.StyledRadioButton = styled_components_1.default.button(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n width: 2.4rem;\n height: 2.4rem;\n ", "{\n width: 1.8rem;\n height: 1.8rem;\n }\n border-radius: 50%;\n background: ", ";\n border: ", ";\n cursor: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n\n ", "\n\n &:hover {\n ", "\n }\n\n /* &:focus {\n outline: none;\n box-shadow: ", ";\n } */\n\n /* add the smaller circle for selected state */\n &::after {\n z-index: 1; //so that the black overlay that appears via ::before is below this\n content: \"\";\n position: absolute;\n width: 1.4rem;\n height: 1.4rem;\n ", "{\n width: 1rem;\n height: 1rem;\n }\n border-radius: 50%;\n background: ", ";\n border: ", ";\n box-shadow: ", ";\n }\n"], ["\n position: relative;\n width: 2.4rem;\n height: 2.4rem;\n ", "{\n width: 1.8rem;\n height: 1.8rem;\n }\n border-radius: 50%;\n background: ", ";\n border: ", ";\n cursor: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n\n ", "\n\n &:hover {\n ", "\n }\n\n /* &:focus {\n outline: none;\n box-shadow: ", ";\n } */\n\n /* add the smaller circle for selected state */\n &::after {\n z-index: 1; //so that the black overlay that appears via ::before is below this\n content: \"\";\n position: absolute;\n width: 1.4rem;\n height: 1.4rem;\n ", "{\n width: 1rem;\n height: 1rem;\n }\n border-radius: 50%;\n background: ", ";\n border: ", ";\n box-shadow: ", ";\n }\n"])), (0, mixins_1.mediaQuery)('md'), function (_a) {
|
|
48
|
+
var isSelected = _a.isSelected, disabled = _a.disabled, theme = _a.theme;
|
|
50
49
|
if (isSelected) {
|
|
51
|
-
return disabled ? grey5 :
|
|
50
|
+
return disabled ? grey5 : (0, getDynamicColors_1.getSecondaryContainer)(theme === null || theme === void 0 ? void 0 : theme.colors);
|
|
52
51
|
}
|
|
53
52
|
return disabled ? grey5 : "none";
|
|
54
53
|
}, function (_a) {
|
|
@@ -60,29 +59,31 @@ exports.StyledRadioInput = styled_components_1.default.button(templateObject_1 |
|
|
|
60
59
|
}, function (_a) {
|
|
61
60
|
var disabled = _a.disabled;
|
|
62
61
|
return (disabled ? "not-allowed" : "pointer");
|
|
62
|
+
}, function (_a) {
|
|
63
|
+
var isSelected = _a.isSelected, disabled = _a.disabled;
|
|
64
|
+
return isSelected && !disabled && (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", " \n "], ["\n ", " \n "])), (0, baseStyling_1.applyBlackOverlayOnHover)());
|
|
63
65
|
}, function (_a) {
|
|
64
66
|
var isSelected = _a.isSelected, disabled = _a.disabled;
|
|
65
67
|
return !disabled &&
|
|
66
|
-
!isSelected &&
|
|
67
|
-
"\n background: rgba(0, 0, 0, 0.05); \n ";
|
|
68
|
+
!isSelected && (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), baseStyling_1.borderStyleOnHover);
|
|
68
69
|
}, function (_a) {
|
|
69
70
|
var isSelected = _a.isSelected;
|
|
70
71
|
return isSelected ? "0px 4px 6px rgba(0, 0, 0, 0.25)" : "none";
|
|
71
|
-
}, function (_a) {
|
|
72
|
+
}, (0, mixins_1.mediaQuery)('md'), function (_a) {
|
|
72
73
|
var isSelected = _a.isSelected, disabled = _a.disabled;
|
|
73
74
|
return isSelected ? (disabled ? grey10 : white) : "transparent";
|
|
74
75
|
}, function (_a) {
|
|
75
|
-
var isSelected = _a.isSelected, disabled = _a.disabled;
|
|
76
|
+
var isSelected = _a.isSelected, disabled = _a.disabled, theme = _a.theme;
|
|
76
77
|
return isSelected
|
|
77
78
|
? disabled
|
|
78
79
|
? "1px solid ".concat(grey20)
|
|
79
|
-
: "1px solid ".concat(
|
|
80
|
+
: "1px solid ".concat((0, getDynamicColors_1.getOnSecondary)(theme === null || theme === void 0 ? void 0 : theme.colors))
|
|
80
81
|
: "none";
|
|
81
82
|
}, function (_a) {
|
|
82
83
|
var isSelected = _a.isSelected, disabled = _a.disabled;
|
|
83
84
|
return isSelected && !disabled ? "0px 4px 6px rgba(0, 0, 0, 0.25)" : "none";
|
|
84
85
|
});
|
|
85
|
-
var templateObject_1;
|
|
86
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
86
87
|
// we no longer need StyleRadioInputFill since the ::after pseudo is doing the work. It wasn't working without it.
|
|
87
88
|
// export const StyledRadioInputFill = styled.div`
|
|
88
89
|
// width: ${({ isSelected }) => (isSelected ? '10px' : '0px')};
|
|
@@ -42,13 +42,14 @@ var styled_components_1 = __importStar(require("styled-components"));
|
|
|
42
42
|
var themes_1 = require("../../themes");
|
|
43
43
|
var mixins_1 = require("../../../themes/mixins");
|
|
44
44
|
var Typo2_1 = require("../Typo2");
|
|
45
|
+
var baseStyling_1 = require("../../themes/utils/baseStyling");
|
|
45
46
|
exports.StyledOptionsContainer = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n gap: ", ";\n align-items: center;\n\n ", "\n"], ["\n display: flex;\n flex-wrap: wrap;\n gap: ", ";\n align-items: center;\n\n ", "\n"])), function (_a) {
|
|
46
47
|
var S = _a.S;
|
|
47
48
|
return (S ? "0.7rem 1.5rem" : "1rem 2rem");
|
|
48
49
|
}, function (_a) {
|
|
49
50
|
var listType = _a.listType;
|
|
50
51
|
return listType === "vertical"
|
|
51
|
-
? (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: column;\n\n gap: ", "; //0.6 because on mobile checkbox has 0.4 rem extra click area top and bottom. so 1.4rem - 0.8rem\n align-items: flex-start;\n ", " {\n gap: ", ";\n }\n "], ["\n flex-direction: column;\n\n gap: ", "; //0.6 because on mobile checkbox has 0.4 rem extra click area top and bottom. so 1.4rem - 0.8rem\n align-items: flex-start;\n ", " {\n gap: ", ";\n }\n "])), function (_a) {
|
|
52
|
+
? (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: column;\n\n gap: ", "; //0.6 because on mobile checkbox & radio has 0.4 rem extra click area top and bottom. so 1.4rem - 0.8rem\n align-items: flex-start;\n ", " {\n gap: ", ";\n }\n "], ["\n flex-direction: column;\n\n gap: ", "; //0.6 because on mobile checkbox & radio has 0.4 rem extra click area top and bottom. so 1.4rem - 0.8rem\n align-items: flex-start;\n ", " {\n gap: ", ";\n }\n "])), function (_a) {
|
|
52
53
|
var S = _a.S;
|
|
53
54
|
return S
|
|
54
55
|
? "1rem"
|
|
@@ -58,7 +59,7 @@ exports.StyledOptionsContainer = styled_components_1.default.div(templateObject_
|
|
|
58
59
|
return (S ? "1rem" : "1.4rem");
|
|
59
60
|
}) : "";
|
|
60
61
|
});
|
|
61
|
-
exports.StyledOption = styled_components_1.default.button(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n border: none;\n background-color: unset;\n text-align: left;\n display: flex;\n align-items: center;\n /* gap: ", "; */\n gap: 0.8rem;\n padding: 0.4rem 0; //this is so that there is more click area on mobile\n ", " {\n gap: 0.6rem;\n padding: 0;\n }\n position: relative;\n cursor: ", ";\n\n &:hover .
|
|
62
|
+
exports.StyledOption = styled_components_1.default.button(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n border: none;\n background-color: unset;\n text-align: left;\n display: flex;\n align-items: center;\n /* gap: ", "; */\n gap: 0.8rem;\n padding: 0.4rem 0; //this is so that there is more click area on mobile\n ", " {\n gap: 0.6rem;\n padding: 0;\n }\n position: relative;\n cursor: ", ";\n\n &:hover .radioOrCheckboxButton_inside_input {\n ", "\n \n // here we manually trigger what apply10PeecentBlackOnHover does\n ", "\n }\n"], ["\n border: none;\n background-color: unset;\n text-align: left;\n display: flex;\n align-items: center;\n /* gap: ", "; */\n gap: 0.8rem;\n padding: 0.4rem 0; //this is so that there is more click area on mobile\n ", " {\n gap: 0.6rem;\n padding: 0;\n }\n position: relative;\n cursor: ", ";\n\n &:hover .radioOrCheckboxButton_inside_input {\n ", "\n \n // here we manually trigger what apply10PeecentBlackOnHover does\n ", "\n }\n"])), function (_a) {
|
|
62
63
|
var S = _a.S;
|
|
63
64
|
return (S ? "0.7rem" : "1rem");
|
|
64
65
|
}, (0, mixins_1.mediaQuery)("md"), function (_a) {
|
|
@@ -70,9 +71,9 @@ exports.StyledOption = styled_components_1.default.button(templateObject_5 || (t
|
|
|
70
71
|
!rightWrongResult &&
|
|
71
72
|
!disabled && (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border: 1px solid ", ";\n "], ["\n border: 1px solid ", ";\n "])), themes_1.colors.grey50);
|
|
72
73
|
}, function (_a) {
|
|
73
|
-
var isSelected = _a.isSelected,
|
|
74
|
+
var isSelected = _a.isSelected, disabled = _a.disabled;
|
|
74
75
|
return isSelected &&
|
|
75
|
-
!
|
|
76
|
+
!disabled && (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n &::before {\n ", "\n }\n "], ["\n &::before {\n ", "\n }\n "])), baseStyling_1.blackOverlayEffect);
|
|
76
77
|
});
|
|
77
78
|
exports.StyledOtherOptionContainer = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n gap: 1rem;\n flex-direction: ", ";\n"], ["\n display: flex;\n gap: 1rem;\n flex-direction: ", ";\n"])), function (_a) {
|
|
78
79
|
var listType = _a.listType;
|
|
@@ -52,6 +52,7 @@ var BlockLabel_1 = require("../BlockLabel");
|
|
|
52
52
|
var styled_1 = require("./styled");
|
|
53
53
|
var Tooltip_1 = require("../../../components/Tooltip");
|
|
54
54
|
var utilsOolib_1 = require("../../../utilsOolib");
|
|
55
|
+
var Typo2_1 = require("../Typo2");
|
|
55
56
|
function SwitchDouble(_a) {
|
|
56
57
|
var id = _a.id, valueProp = _a.value, options = _a.options, onChange = _a.onChange, saveValueAsString = _a.saveValueAsString, _b = _a.disabled, disabled = _b === void 0 ? false : _b;
|
|
57
58
|
var value = saveValueAsString
|
|
@@ -69,7 +70,7 @@ function SwitchDouble(_a) {
|
|
|
69
70
|
throw new Error("You need to pass a value prop to make SwitchDouble work");
|
|
70
71
|
return (react_1.default.createElement("div", null,
|
|
71
72
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
72
|
-
react_1.default.createElement(
|
|
73
|
+
react_1.default.createElement(StyledSwitchWrapperStyle1, null,
|
|
73
74
|
react_1.default.createElement(styled_1.STYLED_UI_BODY_SM, { lineHeight: 1,
|
|
74
75
|
semibold: isLeftOptionActive ? true : false }, options[0].display),
|
|
75
76
|
react_1.default.createElement(styled_1.StyledButtonSlider, { disabled: disabled, onClick: handleClick },
|
|
@@ -123,7 +124,7 @@ function SwitchSingle(_a) {
|
|
|
123
124
|
//else
|
|
124
125
|
return display; //cuz ofcourse its not optional, so no need to show optional label
|
|
125
126
|
};
|
|
126
|
-
var genDisplayText = function () { return (react_1.default.createElement(
|
|
127
|
+
var genDisplayText = function () { return (react_1.default.createElement(Typo2_1.UI_BODY_SM_DF, { disabled: disabled }, injectOptionalLabelIntoDisplayText({
|
|
127
128
|
display: option.display,
|
|
128
129
|
label: props.label,
|
|
129
130
|
isRequired: props.isRequired
|
|
@@ -135,9 +136,9 @@ function SwitchSingle(_a) {
|
|
|
135
136
|
};
|
|
136
137
|
return (react_1.default.createElement("div", null,
|
|
137
138
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({ hideOptionalLabel: !!props.label === false }, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
138
|
-
layoutStyle === "style1" ? (react_1.default.createElement(styled_1.
|
|
139
|
+
layoutStyle === "style1" ? (react_1.default.createElement(styled_1.StyledSwitchWrapper, null,
|
|
139
140
|
genSwitch(),
|
|
140
|
-
genSwitchDisplay())) : (layoutStyle === "style2" && (react_1.default.createElement(styled_1.
|
|
141
|
+
genSwitchDisplay())) : (layoutStyle === "style2" && (react_1.default.createElement(styled_1.StyledSwitchWrapper, null,
|
|
141
142
|
genSwitchDisplay(),
|
|
142
143
|
genSwitch())))));
|
|
143
144
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export const
|
|
2
|
-
export const StyledSwitchWrapperStyle2: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
1
|
+
export const StyledSwitchWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
2
|
export const StyledButtonSlider: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
3
|
export const StyledSwitch: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
5
|
-
export const STYLED_UI_BODY_SM: import("styled-components").StyledComponent<import("react").FunctionComponent<import("../Typo2").TypoCompProps>, any, {}, never>;
|
|
@@ -7,16 +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.
|
|
10
|
+
exports.StyledSwitch = exports.StyledButtonSlider = exports.StyledSwitchWrapper = 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 getDynamicColors_1 = require("../../themes/utils/getDynamicColors");
|
|
15
15
|
var Typo2_1 = require("../Typo2");
|
|
16
|
+
var baseStyling_1 = require("../../themes/utils/baseStyling");
|
|
16
17
|
var white = themes_1.colors.white, grey5 = themes_1.colors.grey5, grey10 = themes_1.colors.grey10, grey20 = themes_1.colors.grey20, grey40 = themes_1.colors.grey40, grey70 = themes_1.colors.grey70, grey80 = themes_1.colors.grey80;
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.StyledButtonSlider = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 28px;\n height: 18px;\n user-select: none;\n position: relative;\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 width: 28px;\n height: 18px;\n user-select: none;\n position: relative;\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"])), function (_a) {
|
|
18
|
+
exports.StyledSwitchWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: 8px;\n ", "{\n gap: 6px;\n }\n \n \n"], ["\n display: flex;\n align-items: center;\n gap: 8px;\n ", "{\n gap: 6px;\n }\n \n \n"])), (0, mixins_1.mediaQuery)('md'));
|
|
19
|
+
exports.StyledButtonSlider = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 3.6rem;\n height: 2.4rem;\n ", "{\n width: 2.8rem;\n height: 1.8rem;\n }\n border-radius: 4rem;\n\n user-select: none;\n position: relative;\n cursor: ", ";\n background-color: ", ";\n overflow: hidden; //so that this hover below is within bounds\n ", "\n\n \n"], ["\n width: 3.6rem;\n height: 2.4rem;\n ", "{\n width: 2.8rem;\n height: 1.8rem;\n }\n border-radius: 4rem;\n\n user-select: none;\n position: relative;\n cursor: ", ";\n background-color: ", ";\n overflow: hidden; //so that this hover below is within bounds\n ", "\n\n \n"])), (0, mixins_1.mediaQuery)('md'), function (_a) {
|
|
20
20
|
var disabled = _a.disabled;
|
|
21
21
|
return (disabled ? 'not-allowed' : 'pointer');
|
|
22
22
|
}, function (_a) {
|
|
@@ -25,38 +25,32 @@ exports.StyledButtonSlider = styled_components_1.default.div(templateObject_3 ||
|
|
|
25
25
|
return grey5;
|
|
26
26
|
return inactive ? grey10 : (0, getDynamicColors_1.getSecondaryContainer)(colors);
|
|
27
27
|
}, function (_a) {
|
|
28
|
-
var
|
|
29
|
-
return !disabled && (
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
var disabled = _a.disabled;
|
|
29
|
+
return !disabled && (0, baseStyling_1.applyBlackOverlayOnHover)();
|
|
30
|
+
});
|
|
31
|
+
var desktop_size = 1.2;
|
|
32
|
+
var desktop_left_right_gap = 0.3;
|
|
33
|
+
var mob_size = 1.4;
|
|
34
|
+
var mob_left_right_gap = 0.5;
|
|
35
|
+
exports.StyledSwitch = styled_components_1.default.button(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n \n width: ", "rem; \n height: ", "rem;\n top: calc(50% - ", "rem); /* Updated for vertical centering */\n left: ", "; \n ", "\n\n ", "{\n width: ", "rem; \n height: ", "rem;\n top: calc(50% - ", "rem); /* Updated for vertical centering */\n left: ", "; \n ", "\n }\n\n z-index: 1; //so that this is above the blackoverlay hover above\n background-color: ", "; \n outline: none;\n border-radius: 50%; \n cursor: ", "; \n border: 1px solid; \n border-color: ", ";\n position: absolute;\n \n box-shadow: ", ";\n \n \n \n"], ["\n \n width: ", "rem; \n height: ", "rem;\n top: calc(50% - ", "rem); /* Updated for vertical centering */\n left: ", "; \n ", "\n\n ", "{\n width: ", "rem; \n height: ", "rem;\n top: calc(50% - ", "rem); /* Updated for vertical centering */\n left: ", "; \n ", "\n }\n\n z-index: 1; //so that this is above the blackoverlay hover above\n background-color: ", "; \n outline: none;\n border-radius: 50%; \n cursor: ", "; \n border: 1px solid; \n border-color: ", ";\n position: absolute;\n \n box-shadow: ", ";\n \n \n \n"])), mob_size, mob_size, mob_size / 2, function (_a) {
|
|
36
|
+
var direction = _a.direction;
|
|
37
|
+
return direction === 'left' ? mob_left_right_gap + 'rem' : "calc(100% - ".concat(mob_size + mob_left_right_gap, "rem)");
|
|
38
|
+
}, (0, mixins_1.transition)('left 0.15s ease-out'), (0, mixins_1.mediaQuery)('md'), desktop_size, desktop_size, desktop_size / 2, function (_a) {
|
|
39
|
+
var direction = _a.direction;
|
|
40
|
+
return direction === 'left' ? desktop_left_right_gap + 'rem' : "calc(100% - ".concat(desktop_size + desktop_left_right_gap, "rem)");
|
|
41
|
+
}, (0, mixins_1.transition)('left 0.1s ease-out'), function (_a) {
|
|
35
42
|
var disabled = _a.disabled;
|
|
36
43
|
return (disabled ? "" : white);
|
|
37
|
-
},
|
|
44
|
+
}, function (_a) {
|
|
38
45
|
var disabled = _a.disabled;
|
|
39
46
|
return disabled ? 'not-allowed' : 'pointer';
|
|
40
47
|
}, function (_a) {
|
|
41
|
-
var
|
|
42
|
-
disabled
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, function (_a) {
|
|
46
|
-
var direction = _a.direction;
|
|
47
|
-
return direction === 'left' ? '3px' : 'calc(100% - 15px)';
|
|
48
|
+
var theme = _a.theme, inactive = _a.inactive, disabled = _a.disabled;
|
|
49
|
+
return disabled
|
|
50
|
+
? grey20
|
|
51
|
+
: inactive ? grey70 : (0, getDynamicColors_1.getOnSecondary)(theme === null || theme === void 0 ? void 0 : theme.colors);
|
|
48
52
|
}, function (_a) {
|
|
49
53
|
var disabled = _a.disabled;
|
|
50
54
|
return (disabled ? "" : "0px 4px 6px rgba(0, 0, 0, 0.25)");
|
|
51
|
-
}, exports.StyledButtonSlider, function (_a) {
|
|
52
|
-
var colors = _a.theme.colors, inactive = _a.inactive, disabled = _a.disabled;
|
|
53
|
-
return !disabled && (inactive ? grey40 : (0, getDynamicColors_1.getOnPrimary)(colors));
|
|
54
55
|
});
|
|
55
|
-
|
|
56
|
-
var disabled = _a.disabled;
|
|
57
|
-
return (disabled ? grey40 : grey80);
|
|
58
|
-
}, function (_a) {
|
|
59
|
-
var lineHeight = _a.lineHeight;
|
|
60
|
-
return lineHeight;
|
|
61
|
-
}, (0, mixins_1.transition)('color'));
|
|
62
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
56
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
interface HoverEffectOptions {
|
|
2
2
|
borderRadius?: string;
|
|
3
3
|
}
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const applyBlackOverlayOnHover: (options?: HoverEffectOptions) => import("styled-components").FlattenSimpleInterpolation;
|
|
5
|
+
export declare const blackOverlayEffect: import("styled-components").FlattenSimpleInterpolation;
|
|
6
|
+
export declare const borderStyleOnHover: import("styled-components").FlattenSimpleInterpolation;
|
|
5
7
|
export {};
|
|
@@ -4,14 +4,16 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
4
4
|
return cooked;
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.borderStyleOnHover = exports.blackOverlayEffect = exports.applyBlackOverlayOnHover = void 0;
|
|
8
8
|
var styled_components_1 = require("styled-components");
|
|
9
9
|
var colors_1 = require("../colors");
|
|
10
10
|
// Hover Effects
|
|
11
|
-
var
|
|
11
|
+
var applyBlackOverlayOnHover = function (options) {
|
|
12
12
|
if (options === void 0) { options = {}; }
|
|
13
13
|
var _a = options.borderRadius, borderRadius = _a === void 0 ? 0 : _a; //some cases we want to trigger the
|
|
14
|
-
return (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &::before {\n content: \"\";\n background-color: transparent;\n position: absolute;\n border-radius: ", ";\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n }\n &:hover::before {\n
|
|
14
|
+
return (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &::before {\n content: \"\";\n background-color: transparent;\n position: absolute;\n border-radius: ", ";\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n }\n &:hover::before {\n ", "\n }\n "], ["\n &::before {\n content: \"\";\n background-color: transparent;\n position: absolute;\n border-radius: ", ";\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n }\n &:hover::before {\n ", "\n }\n "])), borderRadius, exports.blackOverlayEffect);
|
|
15
15
|
};
|
|
16
|
-
exports.
|
|
17
|
-
|
|
16
|
+
exports.applyBlackOverlayOnHover = applyBlackOverlayOnHover;
|
|
17
|
+
exports.blackOverlayEffect = (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n"], ["\n background: ", ";\n"])), colors_1.colors.grey10);
|
|
18
|
+
exports.borderStyleOnHover = (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border: 1px solid ", "\n"], ["\n border: 1px solid ", "\n"])), colors_1.colors.grey50);
|
|
19
|
+
var templateObject_1, templateObject_2, templateObject_3;
|