oolib 2.208.0 → 2.208.1
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/DateRangePicker/index.js +2 -2
- package/dist/components/GroupQuestionsInputSingle/index.js +2 -2
- package/dist/components/IFrameInput/index.js +1 -1
- package/dist/components/ImageInput/comps/Placeholder/index.js +1 -1
- package/dist/components/SimpleTable/index.js +2 -2
- package/dist/components/VideoInput/comps/EmbedLinkModal.js +1 -1
- package/dist/components/cards/ListProfile/index.js +1 -1
- package/dist/index.d.ts +8 -9
- package/dist/index.js +25 -33
- package/dist/stories/Oolib/components/Modal.stories.js +2 -2
- package/dist/stories/Oolib/components/TagsInput.stories.js +1 -1
- package/dist/v2/components/DateRangePicker/index.js +1 -2
- package/dist/v2/components/TabBar/index.js +3 -3
- package/dist/v2/components/TextInputs/index.js +0 -7
- package/dist/v2/components/TextInputs/index.styled.js +1 -1
- package/package.json +1 -1
- package/dist/components/BlockLabel/index.d.ts +0 -2
- package/dist/components/BlockLabel/index.js +0 -75
- package/dist/components/BlockLabel/index.styled.d.ts +0 -2
- package/dist/components/BlockLabel/index.styled.js +0 -14
- package/dist/components/Dropdowns/DropdownMulti/index.d.ts +0 -38
- package/dist/components/Dropdowns/DropdownMulti/index.js +0 -179
- package/dist/components/Dropdowns/DropdownSingle/index.d.ts +0 -40
- package/dist/components/Dropdowns/DropdownSingle/index.js +0 -163
- package/dist/components/Dropdowns/comps/Caret/index.d.ts +0 -6
- package/dist/components/Dropdowns/comps/Caret/index.js +0 -19
- package/dist/components/Dropdowns/comps/Caret/styled.d.ts +0 -2
- package/dist/components/Dropdowns/comps/Caret/styled.js +0 -14
- package/dist/components/Dropdowns/comps/DisplayCompSingle/index.d.ts +0 -7
- package/dist/components/Dropdowns/comps/DisplayCompSingle/index.js +0 -39
- package/dist/components/Dropdowns/comps/NoOptionResultsComp/index.d.ts +0 -4
- package/dist/components/Dropdowns/comps/NoOptionResultsComp/index.js +0 -15
- package/dist/components/Dropdowns/comps/OptionContent/index.d.ts +0 -8
- package/dist/components/Dropdowns/comps/OptionContent/index.js +0 -34
- package/dist/components/Dropdowns/comps/OptionsMulti/index.d.ts +0 -28
- package/dist/components/Dropdowns/comps/OptionsMulti/index.js +0 -159
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/index.d.ts +0 -14
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/index.js +0 -81
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/styled.d.ts +0 -2
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/styled.js +0 -25
- package/dist/components/Dropdowns/comps/OptionsShell/index.d.ts +0 -2
- package/dist/components/Dropdowns/comps/OptionsShell/index.js +0 -101
- package/dist/components/Dropdowns/comps/OptionsShell/styled.d.ts +0 -5
- package/dist/components/Dropdowns/comps/OptionsShell/styled.js +0 -45
- package/dist/components/Dropdowns/comps/OptionsSingle/index.d.ts +0 -28
- package/dist/components/Dropdowns/comps/OptionsSingle/index.js +0 -105
- package/dist/components/Dropdowns/comps/OptionsSingle/styled.d.ts +0 -1
- package/dist/components/Dropdowns/comps/OptionsSingle/styled.js +0 -61
- package/dist/components/Dropdowns/comps/SelectDropdown/index.d.ts +0 -13
- package/dist/components/Dropdowns/comps/SelectDropdown/index.js +0 -54
- package/dist/components/Dropdowns/comps/SelectDropdown/styled.d.ts +0 -1
- package/dist/components/Dropdowns/comps/SelectDropdown/styled.js +0 -71
- package/dist/components/Dropdowns/comps/SelectTagsInput/index.d.ts +0 -18
- package/dist/components/Dropdowns/comps/SelectTagsInput/index.js +0 -124
- package/dist/components/Dropdowns/comps/SelectTagsInput/styled.d.ts +0 -2
- package/dist/components/Dropdowns/comps/SelectTagsInput/styled.js +0 -54
- package/dist/components/Dropdowns/handlers/index.d.ts +0 -14
- package/dist/components/Dropdowns/handlers/index.js +0 -52
- package/dist/components/Dropdowns/styled.d.ts +0 -2
- package/dist/components/Dropdowns/styled.js +0 -49
- package/dist/components/Dropdowns/utils/genColor.d.ts +0 -4
- package/dist/components/Dropdowns/utils/genColor.js +0 -15
- package/dist/components/Dropdowns/utils/genIcon.d.ts +0 -6
- package/dist/components/Dropdowns/utils/genIcon.js +0 -18
- package/dist/components/Dropdowns/utils/genLinkOrText.d.ts +0 -1
- package/dist/components/Dropdowns/utils/genLinkOrText.js +0 -48
- package/dist/components/Dropdowns/utils/genProfileImg.d.ts +0 -6
- package/dist/components/Dropdowns/utils/genProfileImg.js +0 -14
- package/dist/components/Dropdowns/utils/genTagComp.d.ts +0 -2
- package/dist/components/Dropdowns/utils/genTagComp.js +0 -27
- package/dist/components/Dropdowns/utils/generateOptions.d.ts +0 -5
- package/dist/components/Dropdowns/utils/generateOptions.js +0 -20
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genMonthsArray.d.ts +0 -1
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genMonthsArray.js +0 -40
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genYearsArray.d.ts +0 -4
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genYearsArray.js +0 -11
- package/dist/components/Dropdowns/utils/getAllOptionsFns/getLanguagesArray.d.ts +0 -4
- package/dist/components/Dropdowns/utils/getAllOptionsFns/getLanguagesArray.js +0 -62
- package/dist/components/Dropdowns/utils/getAllOptionsFns/index.d.ts +0 -1
- package/dist/components/Dropdowns/utils/getAllOptionsFns/index.js +0 -19
- package/dist/components/Dropdowns/utils/getValue.d.ts +0 -14
- package/dist/components/Dropdowns/utils/getValue.js +0 -32
- package/dist/components/Dropdowns/utils/isDynamicOtherOption.d.ts +0 -0
- package/dist/components/Dropdowns/utils/isDynamicOtherOption.js +0 -0
- package/dist/components/Dropdowns/utils/keywordSearchOptions.d.ts +0 -6
- package/dist/components/Dropdowns/utils/keywordSearchOptions.js +0 -18
- package/dist/components/Dropdowns/utils/setDropdownSelectText.d.ts +0 -12
- package/dist/components/Dropdowns/utils/setDropdownSelectText.js +0 -19
- package/dist/components/Dropdowns/utils/useCreateDropdownRefs.d.ts +0 -5
- package/dist/components/Dropdowns/utils/useCreateDropdownRefs.js +0 -15
- package/dist/components/Dropdowns/utils/useHideShowOptions.d.ts +0 -5
- package/dist/components/Dropdowns/utils/useHideShowOptions.js +0 -20
- package/dist/components/Dropdowns/utils/useKeyboardControl.d.ts +0 -12
- package/dist/components/Dropdowns/utils/useKeyboardControl.js +0 -73
- package/dist/components/Dropdowns/utils/useSearchString.d.ts +0 -4
- package/dist/components/Dropdowns/utils/useSearchString.js +0 -20
- package/dist/components/Dropdowns/utils/useSetYOrientation.d.ts +0 -9
- package/dist/components/Dropdowns/utils/useSetYOrientation.js +0 -46
- package/dist/components/Hints/contextApi.d.ts +0 -6
- package/dist/components/Hints/contextApi.js +0 -48
- package/dist/components/Hints/index.d.ts +0 -9
- package/dist/components/Hints/index.js +0 -127
- package/dist/components/Hints/styled.d.ts +0 -6
- package/dist/components/Hints/styled.js +0 -54
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/index.d.ts +0 -11
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/index.js +0 -30
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/styled.d.ts +0 -1
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/styled.js +0 -70
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.d.ts +0 -11
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.js +0 -50
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/index.d.ts +0 -20
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/index.js +0 -124
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/styled.d.ts +0 -2
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/styled.js +0 -17
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.d.ts +0 -18
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.js +0 -53
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.d.ts +0 -2
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.js +0 -84
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/index.d.ts +0 -1
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/index.js +0 -6
- package/dist/components/RadioAndCheckbox/comps/RadioList/index.d.ts +0 -17
- package/dist/components/RadioAndCheckbox/comps/RadioList/index.js +0 -109
- package/dist/components/RadioAndCheckbox/index.d.ts +0 -5
- package/dist/components/RadioAndCheckbox/index.js +0 -14
- package/dist/components/RadioAndCheckbox/styled.d.ts +0 -5
- package/dist/components/RadioAndCheckbox/styled.js +0 -84
- package/dist/components/RadioAndCheckbox/utils.d.ts +0 -22
- package/dist/components/RadioAndCheckbox/utils.js +0 -49
- package/dist/components/Switches/index.d.ts +0 -21
- package/dist/components/Switches/index.js +0 -102
- package/dist/components/Switches/styled.d.ts +0 -5
- package/dist/components/Switches/styled.js +0 -63
- package/dist/components/TextInputs/index.d.ts +0 -24
- package/dist/components/TextInputs/index.js +0 -367
- package/dist/components/TextInputs/index.styled.d.ts +0 -3
- package/dist/components/TextInputs/index.styled.js +0 -77
- package/dist/components/cards/CardContent/index.d.ts +0 -11
- package/dist/components/cards/CardContent/index.js +0 -76
- package/dist/components/cards/CardContent/styled.d.ts +0 -7
- package/dist/components/cards/CardContent/styled.js +0 -63
- package/dist/components/cards/ListContent/index.d.ts +0 -12
- package/dist/components/cards/ListContent/index.js +0 -87
- package/dist/components/cards/ListContent/styled.d.ts +0 -7
- package/dist/components/cards/ListContent/styled.js +0 -26
- package/dist/stories/Oolib/components/BlockLabel.stories.d.ts +0 -71
- package/dist/stories/Oolib/components/BlockLabel.stories.js +0 -106
- package/dist/stories/Oolib/components/Checkbox.stories.d.ts +0 -248
- package/dist/stories/Oolib/components/Checkbox.stories.js +0 -249
- package/dist/stories/Oolib/components/Dropdowns.stories.d.ts +0 -127
- package/dist/stories/Oolib/components/Dropdowns.stories.js +0 -298
- package/dist/stories/Oolib/components/RadioButton.stories.d.ts +0 -260
- package/dist/stories/Oolib/components/RadioButton.stories.js +0 -264
- package/dist/stories/Oolib/components/Switches.stories.d.ts +0 -106
- package/dist/stories/Oolib/components/Switches.stories.js +0 -146
- package/dist/stories/Oolib/components/TextInputs.stories.d.ts +0 -124
- package/dist/stories/Oolib/components/TextInputs.stories.js +0 -188
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.StyledRadioInputFill = exports.StyledRadioInput = void 0;
|
|
41
|
-
var styled_components_1 = __importStar(require("styled-components"));
|
|
42
|
-
var themes_1 = require("../../../../../../themes");
|
|
43
|
-
var mixins_1 = require("../../../../../../themes/mixins");
|
|
44
|
-
var utilsOolib_1 = require("../../../../../../utilsOolib");
|
|
45
|
-
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;
|
|
46
|
-
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 &:focus {\n border: 2px solid ", ";\n box-shadow: none;\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 &:focus {\n border: 2px solid ", ";\n box-shadow: none;\n }\n\n"])), function (_a) {
|
|
47
|
-
var S = _a.S;
|
|
48
|
-
return S ? '1.7rem' : '2rem';
|
|
49
|
-
}, function (_a) {
|
|
50
|
-
var S = _a.S;
|
|
51
|
-
return S ? '1.7rem' : '2rem';
|
|
52
|
-
}, function (_a) {
|
|
53
|
-
var colors = _a.theme.colors, disabled = _a.disabled, invert = _a.invert;
|
|
54
|
-
return disabled ? greyColor40 :
|
|
55
|
-
invert ? (0, utilsOolib_1.getPrimaryColor40)(colors) : (0, utilsOolib_1.getPrimaryColor100)(colors);
|
|
56
|
-
}, none, function (_a) {
|
|
57
|
-
var disabled = _a.disabled, readOnly = _a.readOnly;
|
|
58
|
-
return disabled ? 'not-allowed' : readOnly ? 'default' : 'pointer';
|
|
59
|
-
}, (0, mixins_1.transition)('background-color 0.2s'), function (_a) {
|
|
60
|
-
var isSelected = _a.isSelected;
|
|
61
|
-
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) {
|
|
62
|
-
var colors = _a.theme.colors, disabled = _a.disabled, invert = _a.invert;
|
|
63
|
-
return disabled ? greyColor40 :
|
|
64
|
-
invert ? (0, utilsOolib_1.getPrimaryColor40)(colors) : (0, utilsOolib_1.getPrimaryColor100)(colors);
|
|
65
|
-
});
|
|
66
|
-
}, function (_a) {
|
|
67
|
-
var isSelected = _a.isSelected, disabled = _a.disabled, theme = _a.theme, invert = _a.invert, readOnly = _a.readOnly;
|
|
68
|
-
return !isSelected && !disabled && !readOnly && (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), invert ? greyColor80 : (0, utilsOolib_1.getPrimaryColor10)(theme.colors));
|
|
69
|
-
}, function (_a) {
|
|
70
|
-
var colors = _a.theme.colors, disabled = _a.disabled, invert = _a.invert;
|
|
71
|
-
return disabled ? greyColor40 :
|
|
72
|
-
invert ? (0, utilsOolib_1.getPrimaryColor40)(colors) : (0, utilsOolib_1.getPrimaryColor100)(colors);
|
|
73
|
-
});
|
|
74
|
-
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) {
|
|
75
|
-
var S = _a.S;
|
|
76
|
-
return S ? '0.7rem' : '0.8rem';
|
|
77
|
-
}, function (_a) {
|
|
78
|
-
var S = _a.S;
|
|
79
|
-
return S ? '0.7rem' : '0.8rem';
|
|
80
|
-
}, function (_a) {
|
|
81
|
-
var invert = _a.invert;
|
|
82
|
-
return invert ? greyColor100 : white;
|
|
83
|
-
});
|
|
84
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { RadioInput, RadioButton } from "./RadioInput";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RadioButton = exports.RadioInput = void 0;
|
|
4
|
-
var RadioInput_1 = require("./RadioInput");
|
|
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,17 +0,0 @@
|
|
|
1
|
-
export function RadioList({ id, injectOtherOption, value: valueProp, onChange, saveValueAsString, options, commonIsCorrectDesc, rightWrongResult, optionsLimit, listType, disabled, invert, readOnly, S }: {
|
|
2
|
-
id: any;
|
|
3
|
-
injectOtherOption?: boolean;
|
|
4
|
-
value: any;
|
|
5
|
-
onChange: any;
|
|
6
|
-
saveValueAsString: any;
|
|
7
|
-
options?: any[];
|
|
8
|
-
commonIsCorrectDesc: any;
|
|
9
|
-
rightWrongResult: any;
|
|
10
|
-
optionsLimit?: number;
|
|
11
|
-
listType?: string;
|
|
12
|
-
disabled: any;
|
|
13
|
-
invert: any;
|
|
14
|
-
readOnly: any;
|
|
15
|
-
S: any;
|
|
16
|
-
}, ...args: any[]): React.JSX.Element;
|
|
17
|
-
import React from "react";
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
-
var ownKeys = function(o) {
|
|
31
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
-
var ar = [];
|
|
33
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
-
return ar;
|
|
35
|
-
};
|
|
36
|
-
return ownKeys(o);
|
|
37
|
-
};
|
|
38
|
-
return function (mod) {
|
|
39
|
-
if (mod && mod.__esModule) return mod;
|
|
40
|
-
var result = {};
|
|
41
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
-
__setModuleDefault(result, mod);
|
|
43
|
-
return result;
|
|
44
|
-
};
|
|
45
|
-
})();
|
|
46
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
-
exports.RadioList = RadioList;
|
|
48
|
-
var react_1 = __importStar(require("react"));
|
|
49
|
-
var BlockLabel_1 = require("../../../../v2/components/BlockLabel");
|
|
50
|
-
var Tags_1 = require("../../../Tags");
|
|
51
|
-
var TextInputs_1 = require("../../../TextInputs");
|
|
52
|
-
var Buttons_1 = require("../../../Buttons");
|
|
53
|
-
var _EXPORTS_1 = require("../../../../utils/_EXPORTS");
|
|
54
|
-
var styled_1 = require("../../styled");
|
|
55
|
-
var utils_1 = require("../../utils");
|
|
56
|
-
var comps_1 = require("./comps");
|
|
57
|
-
function RadioList(_a) {
|
|
58
|
-
var id = _a.id, _b = _a.injectOtherOption, injectOtherOption = _b === void 0 ? false : _b, valueProp = _a.value, onChange = _a.onChange, saveValueAsString = _a.saveValueAsString, _c = _a.options, options = _c === void 0 ? [] : _c, commonIsCorrectDesc = _a.commonIsCorrectDesc, rightWrongResult = _a.rightWrongResult, _d = _a.optionsLimit, optionsLimit = _d === void 0 ? Infinity : _d, _e = _a.listType, listType = _e === void 0 ? 'horizontal' : _e, disabled = _a.disabled, invert = _a.invert, readOnly = _a.readOnly, S = _a.S;
|
|
59
|
-
var props = arguments[0];
|
|
60
|
-
var shouldHideSomeOptions = options.length > optionsLimit;
|
|
61
|
-
var _f = (0, react_1.useState)(false), seeMore = _f[0], setSeeMore = _f[1];
|
|
62
|
-
var _g = (0, utils_1.genDisplayedOptions)({ injectOtherOption: injectOtherOption, options: options, valueProp: valueProp, saveValueAsString: saveValueAsString }), typicalOptions = _g.typicalOptions, injectedOtherOption = _g.injectedOtherOption;
|
|
63
|
-
var value = saveValueAsString ?
|
|
64
|
-
typicalOptions
|
|
65
|
-
.concat(injectedOtherOption || [])
|
|
66
|
-
.find(function (op) { var _a; return ((_a = op.display_desc) !== null && _a !== void 0 ? _a : op.value) === valueProp; })
|
|
67
|
-
: valueProp;
|
|
68
|
-
var correctOp = options.find(function (op) { return op.isCorrect; }); //
|
|
69
|
-
var handleInputClick = function (option) {
|
|
70
|
-
var _a;
|
|
71
|
-
onChange(id, saveValueAsString ? ((_a = option.display_desc) !== null && _a !== void 0 ? _a : option.value) : option);
|
|
72
|
-
};
|
|
73
|
-
var handleTextInputChange = function (text) {
|
|
74
|
-
onChange(id, saveValueAsString ? text : (0, utils_1.genOtherValueObject)(text) //text === display_desc
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
var InputCommonProps = {
|
|
78
|
-
invert: invert,
|
|
79
|
-
value: value,
|
|
80
|
-
S: S,
|
|
81
|
-
disabled: disabled,
|
|
82
|
-
rightWrongResult: rightWrongResult,
|
|
83
|
-
onClick: handleInputClick,
|
|
84
|
-
};
|
|
85
|
-
return (react_1.default.createElement("div", { id: id },
|
|
86
|
-
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
87
|
-
readOnly ? ((value === null || value === void 0 ? void 0 : value.display) && react_1.default.createElement(Tags_1.TagDisplay, { display: value.display_desc || value.display, invert: invert }) //prioritzing display_desc since display of 'other' option is === other
|
|
88
|
-
) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
89
|
-
react_1.default.createElement(styled_1.StyledOptionsContainer, { listType: listType, S: S }, typicalOptions === null || typicalOptions === void 0 ? void 0 :
|
|
90
|
-
typicalOptions.map(function (option, idx) { return idx < optionsLimit && (react_1.default.createElement(comps_1.RadioInput, __assign({}, InputCommonProps, { option: option, key: option.value }))); }),
|
|
91
|
-
shouldHideSomeOptions && // if we have the case of off limit options
|
|
92
|
-
(seeMore || rightWrongResult) && //and decided to show them
|
|
93
|
-
typicalOptions.slice(optionsLimit).map(function (option) {
|
|
94
|
-
return react_1.default.createElement(comps_1.RadioInput, __assign({}, InputCommonProps, { option: option, key: option.value }));
|
|
95
|
-
}),
|
|
96
|
-
injectOtherOption && injectedOtherOption && ( //so other box and its textInput act as one entity in the flexbox
|
|
97
|
-
react_1.default.createElement(styled_1.StyledOtherOptionContainer, { listType: listType },
|
|
98
|
-
react_1.default.createElement(comps_1.RadioInput, __assign({}, InputCommonProps, { option: injectedOtherOption })),
|
|
99
|
-
(value === null || value === void 0 ? void 0 : value.value) === "other" && (react_1.default.createElement(styled_1.StyledOtherTextInputWrapper, { listType: listType, rightWrongResult: rightWrongResult },
|
|
100
|
-
react_1.default.createElement(TextInputs_1.TextInput, { placeholder: "Please Specify Here", value: value.display_desc, onChange: function (k, v) { return handleTextInputChange(v); }, disabled: disabled, invert: invert, S: S })))))),
|
|
101
|
-
shouldHideSomeOptions && !rightWrongResult && (react_1.default.createElement(Buttons_1.ButtonGhost, { onClick: function () { return setSeeMore(!seeMore); }, value: !seeMore ? 'See More' : 'See Less', style: { marginTop: 10 } })),
|
|
102
|
-
/*
|
|
103
|
-
the minute the results have come in, irrespective of user's answer
|
|
104
|
-
being right or wrong, we always show an explanation
|
|
105
|
-
against the right answer. provided that an explanation is provided.
|
|
106
|
-
*/
|
|
107
|
-
correctOp && rightWrongResult && commonIsCorrectDesc &&
|
|
108
|
-
react_1.default.createElement(styled_1.StyledCorrectMessage, { invert: invert }, commonIsCorrectDesc)))));
|
|
109
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { RadioList } from "./comps/RadioList";
|
|
2
|
-
export { CheckboxList } from "./comps/CheckboxList";
|
|
3
|
-
export { CheckboxInput } from "./comps/CheckboxList/comps/CheckboxInput";
|
|
4
|
-
export { CheckboxButton } from "./comps/CheckboxList/comps/CheckboxButton";
|
|
5
|
-
export { RadioInput, RadioButton } from "./comps/RadioList/comps";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CheckboxButton = exports.CheckboxInput = exports.CheckboxList = exports.RadioButton = exports.RadioInput = exports.RadioList = void 0;
|
|
4
|
-
var RadioList_1 = require("./comps/RadioList");
|
|
5
|
-
Object.defineProperty(exports, "RadioList", { enumerable: true, get: function () { return RadioList_1.RadioList; } });
|
|
6
|
-
var comps_1 = require("./comps/RadioList/comps");
|
|
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; } });
|
|
9
|
-
var CheckboxList_1 = require("./comps/CheckboxList");
|
|
10
|
-
Object.defineProperty(exports, "CheckboxList", { enumerable: true, get: function () { return CheckboxList_1.CheckboxList; } });
|
|
11
|
-
var CheckboxInput_1 = require("./comps/CheckboxList/comps/CheckboxInput");
|
|
12
|
-
Object.defineProperty(exports, "CheckboxInput", { enumerable: true, get: function () { return CheckboxInput_1.CheckboxInput; } });
|
|
13
|
-
var CheckboxButton_1 = require("./comps/CheckboxList/comps/CheckboxButton");
|
|
14
|
-
Object.defineProperty(exports, "CheckboxButton", { enumerable: true, get: function () { return CheckboxButton_1.CheckboxButton; } });
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const StyledOptionsContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
export const StyledOption: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export const StyledOtherOptionContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export const StyledOtherTextInputWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
-
export const StyledCorrectMessage: import("styled-components").StyledComponent<import("react").FunctionComponent<import("../Typo").TypoCompProps>, any, {}, never>;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.StyledCorrectMessage = exports.StyledOtherTextInputWrapper = exports.StyledOtherOptionContainer = exports.StyledOption = exports.StyledOptionsContainer = void 0;
|
|
41
|
-
var styled_components_1 = __importStar(require("styled-components"));
|
|
42
|
-
var utilsOolib_1 = require("../../utilsOolib");
|
|
43
|
-
var Typo_1 = require("../Typo");
|
|
44
|
-
var themes_1 = require("../../themes");
|
|
45
|
-
var mixins_1 = require("../../themes/mixins");
|
|
46
|
-
var green = themes_1.colors.green, greyColor80 = themes_1.colors.greyColor80, white = themes_1.colors.white, greyColor100 = themes_1.colors.greyColor100;
|
|
47
|
-
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) {
|
|
48
|
-
var S = _a.S;
|
|
49
|
-
return S ? '0.7rem 1.5rem' : '1rem 2rem';
|
|
50
|
-
}, function (_a) {
|
|
51
|
-
var listType = _a.listType;
|
|
52
|
-
return listType === 'vertical' ? (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-wrap: nowrap;\n \n flex-direction: column;\n gap: ", ";\n align-items: flex-start; //ensures that each option doesnt stretch full width and create unnecessary click area\n "], ["\n flex-wrap: nowrap;\n \n flex-direction: column;\n gap: ", ";\n align-items: flex-start; //ensures that each option doesnt stretch full width and create unnecessary click area\n "])), function (_a) {
|
|
53
|
-
var S = _a.S;
|
|
54
|
-
return S ? '1rem' : '1.5rem';
|
|
55
|
-
}) :
|
|
56
|
-
'';
|
|
57
|
-
});
|
|
58
|
-
exports.StyledOption = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", ";\n position: relative;\n cursor: ", ";\n \n\n &:hover .btn {\n ", "\n }\n\n"], ["\n display: flex;\n align-items: center;\n gap: ", ";\n position: relative;\n cursor: ", ";\n \n\n &:hover .btn {\n ", "\n }\n\n"])), function (_a) {
|
|
59
|
-
var S = _a.S;
|
|
60
|
-
return S ? '0.7rem' : '1rem';
|
|
61
|
-
}, function (_a) {
|
|
62
|
-
var rightWrongResult = _a.rightWrongResult, disabled = _a.disabled;
|
|
63
|
-
return disabled ? 'not-allowed' :
|
|
64
|
-
rightWrongResult ? 'initial' : 'pointer';
|
|
65
|
-
}, function (_a) {
|
|
66
|
-
var isSelected = _a.isSelected, rightWrongResult = _a.rightWrongResult, disabled = _a.disabled, theme = _a.theme, invert = _a.invert;
|
|
67
|
-
return !isSelected && !rightWrongResult && !disabled && (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), invert ? greyColor80 : (0, utilsOolib_1.getPrimaryColor10)(theme.colors));
|
|
68
|
-
});
|
|
69
|
-
exports.StyledOtherOptionContainer = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n gap: 1rem;\n flex-direction: ", ";\n"], ["\n display: flex;\n gap: 1rem;\n flex-direction: ", ";\n"])), function (_a) {
|
|
70
|
-
var listType = _a.listType;
|
|
71
|
-
return listType == 'vertical' ? 'column' : 'row';
|
|
72
|
-
});
|
|
73
|
-
exports.StyledOtherTextInputWrapper = styled_components_1.default.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n \n margin-right: 0.5rem;\n ", "\n\n ", ";\n \n ", "{ width: 28rem; }\n"], ["\n \n margin-right: 0.5rem;\n ", "\n\n ", ";\n \n ", "{ width: 28rem; }\n"])), function (_a) {
|
|
74
|
-
var rightWrongResult = _a.rightWrongResult;
|
|
75
|
-
return rightWrongResult && (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["pointer-events: none;"], ["pointer-events: none;"])));
|
|
76
|
-
}, function (_a) {
|
|
77
|
-
var listType = _a.listType;
|
|
78
|
-
return listType === 'vertical' ? (0, styled_components_1.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["margin-left: 2.5rem;"], ["margin-left: 2.5rem;"]))) : (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["width: 28rem"], ["width: 28rem"])));
|
|
79
|
-
}, (0, mixins_1.mediaQuery)('sm'));
|
|
80
|
-
exports.StyledCorrectMessage = (0, styled_components_1.default)(Typo_1.SANS_3)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n color: ", ";\n padding-top: 1rem;\n"], ["\n color: ", ";\n padding-top: 1rem;\n"])), function (_a) {
|
|
81
|
-
var invert = _a.invert;
|
|
82
|
-
return invert ? white : greyColor100;
|
|
83
|
-
});
|
|
84
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export function getMarkingCommand({ option, isSelected }: {
|
|
2
|
-
option: any;
|
|
3
|
-
isSelected: any;
|
|
4
|
-
}): "markCorrect" | "markWrong" | "revealCorrect";
|
|
5
|
-
export function genOtherValueObject(text: any): {
|
|
6
|
-
value: string;
|
|
7
|
-
display_desc: any;
|
|
8
|
-
value_desc: any;
|
|
9
|
-
display: string;
|
|
10
|
-
};
|
|
11
|
-
export function genDisplayedOptions({ injectOtherOption, options, valueProp, saveValueAsString }: {
|
|
12
|
-
injectOtherOption: any;
|
|
13
|
-
options: any;
|
|
14
|
-
valueProp: any;
|
|
15
|
-
saveValueAsString: any;
|
|
16
|
-
}): {
|
|
17
|
-
typicalOptions: any;
|
|
18
|
-
injectedOtherOption?: undefined;
|
|
19
|
-
} | {
|
|
20
|
-
typicalOptions: any;
|
|
21
|
-
injectedOtherOption: any;
|
|
22
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.genDisplayedOptions = exports.genOtherValueObject = exports.getMarkingCommand = void 0;
|
|
4
|
-
var formatTextToCamelCase_1 = require("../../utils/formatTextToCamelCase");
|
|
5
|
-
var toArray_1 = require("../../utils/toArray");
|
|
6
|
-
var getMarkingCommand = function (_a) {
|
|
7
|
-
var option = _a.option, isSelected = _a.isSelected;
|
|
8
|
-
if (isSelected) {
|
|
9
|
-
return option.isCorrect ? 'markCorrect' : 'markWrong';
|
|
10
|
-
}
|
|
11
|
-
else { //not selected
|
|
12
|
-
if (option.isCorrect)
|
|
13
|
-
return "revealCorrect";
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
exports.getMarkingCommand = getMarkingCommand;
|
|
17
|
-
var genOtherValueObject = function (text) {
|
|
18
|
-
var value_desc = (0, formatTextToCamelCase_1.formatTextToCamelCase)(text);
|
|
19
|
-
return {
|
|
20
|
-
value: "other",
|
|
21
|
-
display_desc: text,
|
|
22
|
-
value_desc: value_desc,
|
|
23
|
-
display: "Other",
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
exports.genOtherValueObject = genOtherValueObject;
|
|
27
|
-
var genDisplayedOptions = function (_a) {
|
|
28
|
-
var injectOtherOption = _a.injectOtherOption, options = _a.options, valueProp = _a.valueProp, saveValueAsString = _a.saveValueAsString;
|
|
29
|
-
/*
|
|
30
|
-
if options has the other object already
|
|
31
|
-
then do none of this inject business
|
|
32
|
-
*/
|
|
33
|
-
if (options.find(function (op) { return op.value === "other"; }) ||
|
|
34
|
-
!injectOtherOption)
|
|
35
|
-
return {
|
|
36
|
-
typicalOptions: options
|
|
37
|
-
};
|
|
38
|
-
var OtherValInValueProp = (0, toArray_1.toArray)(valueProp).find(function (v) {
|
|
39
|
-
return saveValueAsString ?
|
|
40
|
-
options.every(function (op) { return op.value !== v; })
|
|
41
|
-
: (v === null || v === void 0 ? void 0 : v.value) === 'other';
|
|
42
|
-
});
|
|
43
|
-
var injectedOtherOption = saveValueAsString ?
|
|
44
|
-
{ value: "other", display: "Other", display_desc: (OtherValInValueProp || '') }
|
|
45
|
-
:
|
|
46
|
-
OtherValInValueProp || { value: "other", display: "Other", display_desc: '' };
|
|
47
|
-
return { typicalOptions: options, injectedOtherOption: injectedOtherOption };
|
|
48
|
-
};
|
|
49
|
-
exports.genDisplayedOptions = genDisplayedOptions;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export function SwitchDouble({ id, value: valueProp, options, onChange, invert, saveValueAsString, disabled, }: {
|
|
2
|
-
id: any;
|
|
3
|
-
value: any;
|
|
4
|
-
options: any;
|
|
5
|
-
onChange: any;
|
|
6
|
-
invert: any;
|
|
7
|
-
saveValueAsString: any;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
}, ...args: any[]): React.JSX.Element;
|
|
10
|
-
export function SwitchSingle({ id, value, option, onChange, disabled, invert, saveValueAsString, layoutStyle, infoTooltip, }: {
|
|
11
|
-
id: any;
|
|
12
|
-
value: any;
|
|
13
|
-
option: any;
|
|
14
|
-
onChange: any;
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
invert: any;
|
|
17
|
-
saveValueAsString: any;
|
|
18
|
-
layoutStyle?: string;
|
|
19
|
-
infoTooltip: any;
|
|
20
|
-
}, ...args: any[]): React.JSX.Element;
|
|
21
|
-
import React from "react";
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.SwitchDouble = SwitchDouble;
|
|
18
|
-
exports.SwitchSingle = SwitchSingle;
|
|
19
|
-
var react_1 = __importDefault(require("react"));
|
|
20
|
-
var themes_1 = require("../../themes");
|
|
21
|
-
var _EXPORTS_1 = require("../../utils/_EXPORTS");
|
|
22
|
-
var BlockLabel_1 = require("../../v2/components/BlockLabel");
|
|
23
|
-
var styled_1 = require("./styled");
|
|
24
|
-
var Tooltip_1 = require("../Tooltip");
|
|
25
|
-
var utilsOolib_1 = require("../../utilsOolib");
|
|
26
|
-
var greyColor40 = themes_1.colors.greyColor40, greyColor100 = themes_1.colors.greyColor100, white = themes_1.colors.white;
|
|
27
|
-
function SwitchDouble(_a) {
|
|
28
|
-
var id = _a.id, valueProp = _a.value, options = _a.options, onChange = _a.onChange, invert = _a.invert, saveValueAsString = _a.saveValueAsString, _b = _a.disabled, disabled = _b === void 0 ? false : _b;
|
|
29
|
-
var value = saveValueAsString
|
|
30
|
-
? options.find(function (d) { return d.value === valueProp; })
|
|
31
|
-
: valueProp;
|
|
32
|
-
var handleClick = function () {
|
|
33
|
-
var otherOption = options.find(function (op) { return op.value !== value.value; });
|
|
34
|
-
!disabled &&
|
|
35
|
-
onChange &&
|
|
36
|
-
onChange(id, saveValueAsString ? otherOption.value : otherOption);
|
|
37
|
-
};
|
|
38
|
-
var props = arguments[0];
|
|
39
|
-
var isLeftOptionActive = value === undefined || options[0].value === (value === null || value === void 0 ? void 0 : value.value);
|
|
40
|
-
if (value === undefined)
|
|
41
|
-
throw new Error("You need to pass a value prop to make SwitchDouble work");
|
|
42
|
-
return (react_1.default.createElement("div", null,
|
|
43
|
-
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
44
|
-
react_1.default.createElement(styled_1.StyledSwitchWrapperStyle1, null,
|
|
45
|
-
react_1.default.createElement(styled_1.STYLED_SANS_3, { lineHeight: 1,
|
|
46
|
-
semibold: isLeftOptionActive ? true : false, invert: invert }, options[0].display),
|
|
47
|
-
react_1.default.createElement(styled_1.StyledButtonSlider, { invert: invert, disabled: disabled, onClick: handleClick },
|
|
48
|
-
react_1.default.createElement(styled_1.StyledSwitch, { className: "StyledSwitch" //read in styled.js why we are using an okf-anti-pattern
|
|
49
|
-
, invert: invert, disabled: disabled, direction: isLeftOptionActive ? "left" : "right" })),
|
|
50
|
-
react_1.default.createElement(styled_1.STYLED_SANS_3, { invert: invert, semibold: isLeftOptionActive ? false : true,
|
|
51
|
-
lineHeight: 1 }, options[1].display))));
|
|
52
|
-
}
|
|
53
|
-
function SwitchSingle(_a) {
|
|
54
|
-
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, infoTooltip = _a.infoTooltip;
|
|
55
|
-
var props = arguments[0];
|
|
56
|
-
var localize = (0, utilsOolib_1.useLocale)();
|
|
57
|
-
/**
|
|
58
|
-
* very important that we check this way,
|
|
59
|
-
* as opposed to checking as 'value === undefined'
|
|
60
|
-
*
|
|
61
|
-
* because in some cases in the TCI, the initial value
|
|
62
|
-
* is not equal to undefined. it is equal to 'false' or something else
|
|
63
|
-
*/
|
|
64
|
-
var isInactive = saveValueAsString
|
|
65
|
-
? value !== option.value
|
|
66
|
-
: (value === null || value === void 0 ? void 0 : value.value) !== option.value;
|
|
67
|
-
var handleClick = function (v) {
|
|
68
|
-
!disabled &&
|
|
69
|
-
onChange &&
|
|
70
|
-
onChange(id, isInactive ? (saveValueAsString ? option.value : option) : undefined);
|
|
71
|
-
};
|
|
72
|
-
var genSwitch = function () { return (react_1.default.createElement(styled_1.StyledButtonSlider, { inactive: isInactive, disabled: disabled, invert: invert, onClick: handleClick },
|
|
73
|
-
react_1.default.createElement(styled_1.StyledSwitch, { className: "StyledSwitch" //read in styled.js why we are using an okf-anti-pattern
|
|
74
|
-
, direction: isInactive ? "left" : "right", inactive: isInactive, disabled: disabled, invert: invert }))); };
|
|
75
|
-
var injectOptionalLabelIntoDisplayText = function (_a) {
|
|
76
|
-
var label = _a.label, display = _a.display, isRequired = _a.isRequired;
|
|
77
|
-
if (!!label)
|
|
78
|
-
return display; //if label exists, we do nothing, cuz optional label in that case, would be shown next to the label
|
|
79
|
-
//else
|
|
80
|
-
if (isRequired === false)
|
|
81
|
-
return display + " (".concat(localize('optional'), ")");
|
|
82
|
-
//else
|
|
83
|
-
return display; //cuz ofcourse its not optional, so no need to show optional label
|
|
84
|
-
};
|
|
85
|
-
var genDisplayText = function () { return (react_1.default.createElement(styled_1.STYLED_SANS_3, { invert: invert, lineHeight: 1, semibold: isInactive ? false : true }, injectOptionalLabelIntoDisplayText({
|
|
86
|
-
display: option.display,
|
|
87
|
-
label: props.label,
|
|
88
|
-
isRequired: props.isRequired
|
|
89
|
-
}))); };
|
|
90
|
-
var genSwitchDisplay = function () {
|
|
91
|
-
return infoTooltip ? (react_1.default.createElement("div", { style: { display: "flex", gap: ".5rem", alignItems: "center" } },
|
|
92
|
-
genDisplayText(),
|
|
93
|
-
react_1.default.createElement(Tooltip_1.Tooltip, __assign({ presetTarget: "infoIcon" }, infoTooltip)))) : (genDisplayText());
|
|
94
|
-
};
|
|
95
|
-
return (react_1.default.createElement("div", null,
|
|
96
|
-
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({ hideOptionalLabel: !!props.label === false }, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
97
|
-
layoutStyle === "style1" ? (react_1.default.createElement(styled_1.StyledSwitchWrapperStyle1, null,
|
|
98
|
-
genSwitch(),
|
|
99
|
-
genSwitchDisplay())) : (layoutStyle === "style2" && (react_1.default.createElement(styled_1.StyledSwitchWrapperStyle2, null,
|
|
100
|
-
genSwitchDisplay(),
|
|
101
|
-
genSwitch())))));
|
|
102
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const StyledSwitchWrapperStyle1: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
export const StyledSwitchWrapperStyle2: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export const StyledButtonSlider: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export const StyledSwitch: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
5
|
-
export const STYLED_SANS_3: import("styled-components").StyledComponent<import("react").FunctionComponent<import("../Typo").TypoCompProps>, any, {}, never>;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.STYLED_SANS_3 = exports.StyledSwitch = exports.StyledButtonSlider = exports.StyledSwitchWrapperStyle2 = exports.StyledSwitchWrapperStyle1 = void 0;
|
|
11
|
-
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
-
var themes_1 = require("../../themes");
|
|
13
|
-
var mixins_1 = require("../../themes/mixins");
|
|
14
|
-
var utilsOolib_1 = require("../../utilsOolib");
|
|
15
|
-
var Typo_1 = require("../Typo");
|
|
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.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) {
|
|
20
|
-
var disabled = _a.disabled;
|
|
21
|
-
return disabled ? 'not-allowed' : 'pointer';
|
|
22
|
-
}, function (_a) {
|
|
23
|
-
var colors = _a.theme.colors, inactive = _a.inactive, disabled = _a.disabled, invert = _a.invert;
|
|
24
|
-
if (disabled)
|
|
25
|
-
return invert ? greyColor80 : greyColor10;
|
|
26
|
-
if (inactive)
|
|
27
|
-
return greyColor70;
|
|
28
|
-
return invert ? (0, utilsOolib_1.getPrimaryColor40)(colors) : (0, utilsOolib_1.getPrimaryColor100)(colors);
|
|
29
|
-
}, function (_a) {
|
|
30
|
-
var colors = _a.theme.colors, inactive = _a.inactive, disabled = _a.disabled;
|
|
31
|
-
return !disabled && (inactive ? greyColor40 : (0, utilsOolib_1.getPrimaryColorText)(colors));
|
|
32
|
-
}, function (_a) {
|
|
33
|
-
var colors = _a.theme.colors, inactive = _a.inactive, disabled = _a.disabled;
|
|
34
|
-
return !disabled && (inactive ? greyColor40 : (0, utilsOolib_1.getPrimaryColorText)(colors));
|
|
35
|
-
}, (0, mixins_1.transition)('background-color'));
|
|
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) {
|
|
37
|
-
var invert = _a.invert;
|
|
38
|
-
return invert ? greyColor100 : white;
|
|
39
|
-
}, (0, mixins_1.transition)('border-color', 'left 0.2s'), function (_a) {
|
|
40
|
-
var disabled = _a.disabled;
|
|
41
|
-
return disabled ? 'not-allowed' : 'pointer';
|
|
42
|
-
}, function (_a) {
|
|
43
|
-
var colors = _a.theme.colors, inactive = _a.inactive, disabled = _a.disabled, invert = _a.invert;
|
|
44
|
-
if (disabled)
|
|
45
|
-
return invert ? greyColor80 : greyColor10;
|
|
46
|
-
if (inactive)
|
|
47
|
-
return greyColor70;
|
|
48
|
-
return invert ? (0, utilsOolib_1.getPrimaryColor40)(colors) : (0, utilsOolib_1.getPrimaryColor100)(colors);
|
|
49
|
-
}, function (_a) {
|
|
50
|
-
var direction = _a.direction;
|
|
51
|
-
return direction === 'left' ? '0' : 'calc(100% - 2rem)';
|
|
52
|
-
}, exports.StyledButtonSlider, function (_a) {
|
|
53
|
-
var colors = _a.theme.colors, inactive = _a.inactive, disabled = _a.disabled;
|
|
54
|
-
return !disabled && (inactive ? greyColor40 : (0, utilsOolib_1.getPrimaryColorText)(colors));
|
|
55
|
-
});
|
|
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) {
|
|
57
|
-
var color = _a.color;
|
|
58
|
-
return color;
|
|
59
|
-
}, function (_a) {
|
|
60
|
-
var lineHeight = _a.lineHeight;
|
|
61
|
-
return lineHeight;
|
|
62
|
-
}, (0, mixins_1.transition)('color'));
|
|
63
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export function TextInput(props: any): React.JSX.Element;
|
|
2
|
-
export function PasswordInput({ ...props }: {
|
|
3
|
-
[x: string]: any;
|
|
4
|
-
}): React.JSX.Element;
|
|
5
|
-
export function EmailInput({ passValidationErrorToFormValidation, ...props }: {
|
|
6
|
-
[x: string]: any;
|
|
7
|
-
passValidationErrorToFormValidation: any;
|
|
8
|
-
}): React.JSX.Element;
|
|
9
|
-
export function PhoneInput({ passValidationErrorToFormValidation, ...props }: {
|
|
10
|
-
[x: string]: any;
|
|
11
|
-
passValidationErrorToFormValidation: any;
|
|
12
|
-
}): React.JSX.Element;
|
|
13
|
-
export function URLInput({ routesAreValidInputs, validationPlugin, passValidationErrorToFormValidation, content, ...props }: {
|
|
14
|
-
[x: string]: any;
|
|
15
|
-
routesAreValidInputs?: boolean;
|
|
16
|
-
validationPlugin: any;
|
|
17
|
-
passValidationErrorToFormValidation: any;
|
|
18
|
-
content: any;
|
|
19
|
-
}): React.JSX.Element;
|
|
20
|
-
export function NumberInput({ passValidationErrorToFormValidation, ...props }: {
|
|
21
|
-
[x: string]: any;
|
|
22
|
-
passValidationErrorToFormValidation: any;
|
|
23
|
-
}): React.JSX.Element;
|
|
24
|
-
import React from "react";
|