oolib 2.22.0 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ActionMenu/index.d.ts +3 -1
- package/dist/components/ActionMenu/index.js +19 -6
- package/dist/components/ActionMenu/styled.d.ts +1 -0
- package/dist/components/ActionMenu/styled.js +43 -14
- package/dist/components/ActionMenu/utils/useHandleClickOutside.d.ts +1 -0
- package/dist/components/ActionMenu/{utils.js → utils/useHandleClickOutside.js} +3 -3
- package/dist/components/ActionMenu/utils/usePopOutOfOverflowHiddenParent.d.ts +6 -0
- package/dist/components/ActionMenu/utils/usePopOutOfOverflowHiddenParent.js +65 -0
- package/dist/components/Buttons/index.styled.js +4 -4
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.d.ts +3 -2
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.js +3 -2
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/index.d.ts +3 -2
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/index.js +47 -12
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/styled.d.ts +1 -0
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/styled.js +6 -2
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.js +1 -1
- package/dist/components/RadioAndCheckbox/comps/RadioList/index.d.ts +2 -1
- package/dist/components/RadioAndCheckbox/comps/RadioList/index.js +42 -12
- package/dist/components/RadioAndCheckbox/styled.js +9 -3
- package/dist/components/RadioAndCheckbox/utils.d.ts +4 -1
- package/dist/components/RadioAndCheckbox/utils.js +13 -9
- package/dist/components/Tags/index.d.ts +2 -1
- package/dist/components/Tags/index.js +2 -2
- package/dist/utils/_EXPORTS/index.d.ts +3 -1
- package/dist/utils/_EXPORTS/index.js +8 -3
- package/dist/utils/customHooks/useScroll.d.ts +1 -0
- package/dist/utils/customHooks/useScroll.js +16 -0
- package/dist/utils/formatTextToCamelCase.d.ts +1 -0
- package/dist/utils/{genValueFromDisplay.js → formatTextToCamelCase.js} +3 -3
- package/dist/utils/toArray.d.ts +1 -0
- package/dist/utils/toArray.js +13 -0
- package/package.json +1 -1
- package/dist/components/ActionMenu/utils.d.ts +0 -1
- package/dist/utils/genValueFromDisplay.d.ts +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function ActionMenu({ icon, invert, actions, align, iconSize, ButtonComp: _ButtonComp, setShowActions: setShowActionsInParent }: {
|
|
1
|
+
export function ActionMenu({ icon, invert, actions, align, iconSize, ButtonComp: _ButtonComp, setShowActions: setShowActionsInParent, popOutOfOverflowHiddenParent, storybookPreview }: {
|
|
2
2
|
icon?: string;
|
|
3
3
|
invert: any;
|
|
4
4
|
actions: any;
|
|
@@ -6,4 +6,6 @@ export function ActionMenu({ icon, invert, actions, align, iconSize, ButtonComp:
|
|
|
6
6
|
iconSize?: string;
|
|
7
7
|
ButtonComp?: string;
|
|
8
8
|
setShowActions: any;
|
|
9
|
+
popOutOfOverflowHiddenParent?: boolean;
|
|
10
|
+
storybookPreview: any;
|
|
9
11
|
}): JSX.Element;
|
|
@@ -39,17 +39,19 @@ var react_1 = __importStar(require("react"));
|
|
|
39
39
|
var ButtonComps = __importStar(require("../Buttons"));
|
|
40
40
|
var Typo_1 = require("../Typo");
|
|
41
41
|
var icons_1 = require("../../icons");
|
|
42
|
-
var
|
|
42
|
+
var useHandleClickOutside_1 = require("./utils/useHandleClickOutside");
|
|
43
|
+
var usePopOutOfOverflowHiddenParent_1 = require("./utils/usePopOutOfOverflowHiddenParent");
|
|
43
44
|
var styled_1 = require("./styled");
|
|
44
45
|
//
|
|
45
46
|
var ActionMenu = function (_a) {
|
|
46
47
|
var _b, _c;
|
|
47
48
|
var _d = _a.icon, icon = _d === void 0 ? 'DotsThree' : _d, //most likely will never change
|
|
48
|
-
invert = _a.invert, actions = _a.actions, _e = _a.align, align = _e === void 0 ? 'right' : _e, _f = _a.iconSize, iconSize = _f === void 0 ? 'S' : _f, _g = _a.ButtonComp, _ButtonComp = _g === void 0 ? 'ButtonGhost' : _g, setShowActionsInParent = _a.setShowActions
|
|
49
|
+
invert = _a.invert, actions = _a.actions, _e = _a.align, align = _e === void 0 ? 'right' : _e, _f = _a.iconSize, iconSize = _f === void 0 ? 'S' : _f, _g = _a.ButtonComp, _ButtonComp = _g === void 0 ? 'ButtonGhost' : _g, setShowActionsInParent = _a.setShowActions, _h = _a.popOutOfOverflowHiddenParent, popOutOfOverflowHiddenParent = _h === void 0 ? false : _h, storybookPreview = _a.storybookPreview //for storybook purposes
|
|
50
|
+
;
|
|
49
51
|
var actionMenuRef = (0, react_1.useRef)(null);
|
|
50
52
|
var optionsWrapperRef = (0, react_1.useRef)(null);
|
|
51
|
-
var
|
|
52
|
-
(0,
|
|
53
|
+
var _j = (0, react_1.useState)(false), showActions = _j[0], setShowActions = _j[1];
|
|
54
|
+
(0, useHandleClickOutside_1.useHandleClickOutside)(actionMenuRef, setShowActions);
|
|
53
55
|
if (!actions || actions.length === 0)
|
|
54
56
|
return null;
|
|
55
57
|
var getOpsRect = function () { var _a; return (_a = optionsWrapperRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(); };
|
|
@@ -60,21 +62,32 @@ var ActionMenu = function (_a) {
|
|
|
60
62
|
};
|
|
61
63
|
(0, react_1.useEffect)(function () {
|
|
62
64
|
setShowActionsInParent && setShowActionsInParent(showActions);
|
|
65
|
+
if (popOutOfOverflowHiddenParent) {
|
|
66
|
+
if (showActions)
|
|
67
|
+
applyFixedPos();
|
|
68
|
+
else
|
|
69
|
+
removeFixedPos();
|
|
70
|
+
}
|
|
63
71
|
}, [showActions]);
|
|
64
72
|
//on unmount, setShowActionsInParent to false, obviously.
|
|
65
73
|
(0, react_1.useEffect)(function () {
|
|
66
|
-
return function () { return setShowActionsInParent(false); };
|
|
74
|
+
return function () { return setShowActionsInParent && setShowActionsInParent(false); };
|
|
67
75
|
}, []);
|
|
76
|
+
var _k = (0, usePopOutOfOverflowHiddenParent_1.usePopOutOfOverflowHiddenParent)(popOutOfOverflowHiddenParent), fixPos = _k.fixPos, applyFixedPos = _k.applyFixedPos, removeFixedPos = _k.removeFixedPos, trackerRef = _k.trackerRef;
|
|
68
77
|
return (react_1.default.createElement(styled_1.StyledActionMenu, { ref: actionMenuRef },
|
|
69
78
|
react_1.default.createElement(ButtonComp, { icon: icon, iconSize: iconSize, invert: invert, stopPropagation: true, onClick: function (e) {
|
|
70
79
|
setShowActions(!showActions);
|
|
71
80
|
}, active: showActions }),
|
|
81
|
+
popOutOfOverflowHiddenParent &&
|
|
82
|
+
react_1.default.createElement(styled_1.StyledActionMenuTracker, { storybookPreview: storybookPreview, align: align, ref: trackerRef }),
|
|
72
83
|
react_1.default.createElement(styled_1.StyledActionsDropMenu, __assign({}, {
|
|
84
|
+
id: 'dropmenu',
|
|
73
85
|
align: align,
|
|
74
86
|
invert: invert,
|
|
75
87
|
optionsHeight: (_b = getOpsRect()) === null || _b === void 0 ? void 0 : _b.height,
|
|
76
88
|
optionsWidth: (_c = getOpsRect()) === null || _c === void 0 ? void 0 : _c.width,
|
|
77
|
-
showActions: showActions
|
|
89
|
+
showActions: showActions,
|
|
90
|
+
fixPos: fixPos
|
|
78
91
|
}),
|
|
79
92
|
react_1.default.createElement(styled_1.StyledOptionsWrapper, { invert: invert, align: align, ref: optionsWrapperRef }, actions.map(function (action) {
|
|
80
93
|
return (react_1.default.createElement(styled_1.StyledOption, __assign({}, action, { onClick: function (ev) {
|
|
@@ -27,7 +27,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
27
27
|
return result;
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.StyledOption = exports.StyledOptionsWrapper = exports.StyledActionsDropMenu = exports.StyledActionMenu = void 0;
|
|
30
|
+
exports.StyledOption = exports.StyledOptionsWrapper = exports.StyledActionsDropMenu = exports.StyledActionMenuTracker = exports.StyledActionMenu = void 0;
|
|
31
31
|
var styled_components_1 = __importStar(require("styled-components"));
|
|
32
32
|
var themes_1 = require("../../themes");
|
|
33
33
|
var mixins_1 = require("../../themes/mixins");
|
|
@@ -42,18 +42,47 @@ var pointerHeight = 10;
|
|
|
42
42
|
*/
|
|
43
43
|
var offset = 10;
|
|
44
44
|
exports.StyledActionMenu = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n width: max-content;\n"], ["\n position: relative;\n width: max-content;\n"])));
|
|
45
|
-
|
|
45
|
+
var trackerSize = 5;
|
|
46
|
+
exports.StyledActionMenuTracker = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n width: ", "px;\n height: ", "px;\n position: absolute;\n ", "\n bottom: 0;\n transform: translateY(100%);\n ", ";\n"], ["\n width: ", "px;\n height: ", "px;\n position: absolute;\n ", "\n bottom: 0;\n transform: translateY(100%);\n ", ";\n"])), trackerSize, trackerSize, function (_a) {
|
|
47
|
+
var align = _a.align;
|
|
48
|
+
switch (align) {
|
|
49
|
+
case "left":
|
|
50
|
+
return (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n left: -", "px;\n "], ["\n left: -", "px;\n "])), offset);
|
|
51
|
+
case "right":
|
|
52
|
+
return (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n right: -", "px;\n "], ["\n right: -", "px;\n "])), offset + trackerSize);
|
|
53
|
+
case "center":
|
|
54
|
+
return (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n left: 1.5rem; //actionMenu button half width\n "], ["\n left: 1.5rem; //actionMenu button half width\n "])));
|
|
55
|
+
}
|
|
56
|
+
}, function (_a) {
|
|
57
|
+
var storybookPreview = _a.storybookPreview;
|
|
58
|
+
return storybookPreview && (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject([" background-color: ", ""], [" background-color: ", ""])), themes_1.colors.red);
|
|
59
|
+
});
|
|
60
|
+
exports.StyledActionsDropMenu = styled_components_1.default.div(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n ", "\n\n z-index: 1001;\n\n ", ";\n overflow: hidden;\n width: ", ";\n height: ", ";\n"], ["\n ", "\n\n z-index: 1001;\n\n ", ";\n overflow: hidden;\n width: ", ";\n height: ", ";\n"])), function (_a) {
|
|
61
|
+
var fixPos = _a.fixPos;
|
|
62
|
+
return fixPos
|
|
63
|
+
? (0, styled_components_1.css)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n position: fixed;\n top: ", "px;\n left: ", "px;\n z-index: 1000;\n ", "\n "], ["\n position: fixed;\n top: ", "px;\n left: ", "px;\n z-index: 1000;\n ", "\n "])), fixPos.y, fixPos.x, function (_a) {
|
|
64
|
+
var align = _a.align;
|
|
65
|
+
switch (align) {
|
|
66
|
+
case "center":
|
|
67
|
+
return (0, styled_components_1.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n transform: translate(-50%, 0);\n "], ["\n transform: translate(-50%, 0);\n "])));
|
|
68
|
+
case "right":
|
|
69
|
+
return (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n transform: translate(-100%, 0);\n "], ["\n transform: translate(-100%, 0);\n "])));
|
|
70
|
+
}
|
|
71
|
+
}) : (0, styled_components_1.css)(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n position: absolute;\n bottom: 0;\n transform: translateY(100%);\n transform-origin: left top;\n ", "\n "], ["\n position: absolute;\n bottom: 0;\n transform: translateY(100%);\n transform-origin: left top;\n ", "\n "])), function (_a) {
|
|
72
|
+
var align = _a.align;
|
|
73
|
+
return align === "center"
|
|
74
|
+
? (0, styled_components_1.css)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n left: 1.5rem;\n transform: translate(-50%, 100%);\n "], ["\n left: 1.5rem;\n transform: translate(-50%, 100%);\n "]))) : (0, styled_components_1.css)(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n ", ": ", "px;\n "], ["\n ", ": ", "px;\n "])), align, 0 - offset);
|
|
75
|
+
});
|
|
76
|
+
}, (0, mixins_1.transition)("height"), function (_a) {
|
|
46
77
|
var optionsWidth = _a.optionsWidth;
|
|
47
|
-
return
|
|
78
|
+
return optionsWidth + offset * 2 + "px";
|
|
48
79
|
}, function (_a) {
|
|
49
80
|
var showActions = _a.showActions, optionsHeight = _a.optionsHeight;
|
|
50
|
-
return showActions
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return align == "center"
|
|
54
|
-
? (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n left: 1.5rem;\n transform: translate(-50%, 100%);\n "], ["\n left: 1.5rem;\n transform: translate(-50%, 100%);\n "]))) : (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", ": ", "px;\n "], ["\n ", ": ", "px;\n "])), align, 0 - offset);
|
|
81
|
+
return showActions
|
|
82
|
+
? optionsHeight + pointerHeight + offset + "px" || "auto"
|
|
83
|
+
: 0;
|
|
55
84
|
});
|
|
56
|
-
exports.StyledOptionsWrapper = styled_components_1.default.div(
|
|
85
|
+
exports.StyledOptionsWrapper = styled_components_1.default.div(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n position: absolute;\n bottom: 10px;\n padding: 0.6rem 0;\n border: 1px solid ", ";\n background-color: ", ";\n border-radius: 2px;\n box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.05);\n margin: 0 ", "px;\n\n //pointer outline\n &::after {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n\n ", "\n\n border: 1rem solid transparent;\n border-bottom: 1rem solid\n ", ";\n }\n\n //pointer fill\n &::before {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n ", "\n border: 0.85rem solid transparent;\n border-bottom: 0.85rem solid\n ", ";\n z-index: 1;\n }\n"], ["\n position: absolute;\n bottom: 10px;\n padding: 0.6rem 0;\n border: 1px solid ", ";\n background-color: ", ";\n border-radius: 2px;\n box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.05);\n margin: 0 ", "px;\n\n //pointer outline\n &::after {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n\n ", "\n\n border: 1rem solid transparent;\n border-bottom: 1rem solid\n ", ";\n }\n\n //pointer fill\n &::before {\n content: \"\";\n width: 0;\n height: 0;\n position: absolute;\n bottom: 100%;\n ", "\n border: 0.85rem solid transparent;\n border-bottom: 0.85rem solid\n ", ";\n z-index: 1;\n }\n"])), function (_a) {
|
|
57
86
|
var invert = _a.invert;
|
|
58
87
|
return (invert ? greyColor70 : greyColor5);
|
|
59
88
|
}, function (_a) {
|
|
@@ -62,23 +91,23 @@ exports.StyledOptionsWrapper = styled_components_1.default.div(templateObject_9
|
|
|
62
91
|
}, offset, function (_a) {
|
|
63
92
|
var align = _a.align;
|
|
64
93
|
return align === "center"
|
|
65
|
-
? (0, styled_components_1.css)(
|
|
94
|
+
? (0, styled_components_1.css)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n left: 50%;\n transform: translateX(-50%);\n "], ["\n left: 50%;\n transform: translateX(-50%);\n "]))) : (0, styled_components_1.css)(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n ", ": 0.5rem;\n "], ["\n ", ": 0.5rem;\n "])), align);
|
|
66
95
|
}, function (_a) {
|
|
67
96
|
var invert = _a.invert;
|
|
68
97
|
return (invert ? greyColor70 : greyColor5);
|
|
69
98
|
}, function (_a) {
|
|
70
99
|
var align = _a.align;
|
|
71
100
|
return align === "center"
|
|
72
|
-
? (0, styled_components_1.css)(
|
|
101
|
+
? (0, styled_components_1.css)(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n left: 50%;\n transform: translateX(-50%);\n "], ["\n left: 50%;\n transform: translateX(-50%);\n "]))) : (0, styled_components_1.css)(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n ", ": 0.65rem;\n "], ["\n ", ": 0.65rem;\n "])), align);
|
|
73
102
|
}, function (_a) {
|
|
74
103
|
var invert = _a.invert;
|
|
75
104
|
return (invert ? greyColor80 : white);
|
|
76
105
|
});
|
|
77
|
-
exports.StyledOption = styled_components_1.default.button(
|
|
106
|
+
exports.StyledOption = styled_components_1.default.button(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n white-space: nowrap;\n border: none;\n cursor: pointer;\n width: 100%;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n text-align: left;\n padding: 0.25rem 1.2rem;\n background-color: transparent;\n color: ", ";\n ", ";\n &:hover {\n background-color: ", ";\n }\n"], ["\n white-space: nowrap;\n border: none;\n cursor: pointer;\n width: 100%;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n text-align: left;\n padding: 0.25rem 1.2rem;\n background-color: transparent;\n color: ", ";\n ", ";\n &:hover {\n background-color: ", ";\n }\n"])), function (_a) {
|
|
78
107
|
var invert = _a.invert;
|
|
79
108
|
return (invert ? white : greyColor100);
|
|
80
109
|
}, (0, mixins_1.transition)("background-color"), function (_a) {
|
|
81
110
|
var invert = _a.invert;
|
|
82
|
-
return invert ? greyColor70 : greyColor10;
|
|
111
|
+
return (invert ? greyColor70 : greyColor10);
|
|
83
112
|
});
|
|
84
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
113
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function useHandleClickOutside(ref: any, setShowOptions: any, options?: {}): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useHandleClickOutside = void 0;
|
|
4
4
|
var react_1 = require("react");
|
|
5
|
-
var
|
|
5
|
+
var useHandleClickOutside = function (ref, setShowOptions, options) {
|
|
6
6
|
if (options === void 0) { options = {}; }
|
|
7
7
|
var _a = options.enabled, enabled = _a === void 0 ? true : _a;
|
|
8
8
|
var handleClickOutside = function (event) {
|
|
@@ -18,4 +18,4 @@ var useTrackFocus = function (ref, setShowOptions, options) {
|
|
|
18
18
|
return function () { return document.removeEventListener('mousedown', handleClickOutside); };
|
|
19
19
|
}, [enabled]);
|
|
20
20
|
};
|
|
21
|
-
exports.
|
|
21
|
+
exports.useHandleClickOutside = useHandleClickOutside;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePopOutOfOverflowHiddenParent = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var useScroll_1 = require("../../../utils/customHooks/useScroll");
|
|
6
|
+
//HOW TO USE
|
|
7
|
+
/**
|
|
8
|
+
* this utility is useful when action menus or dropdowns are
|
|
9
|
+
* used inside parents that have overflow hidden.
|
|
10
|
+
*
|
|
11
|
+
* When the dropdown / menu opens, we need it to show,
|
|
12
|
+
* and sometimes its not possible to reposition the dropdown / menu
|
|
13
|
+
* outside of the overflow hidden container.
|
|
14
|
+
*
|
|
15
|
+
* In such cases, we can use this hook.
|
|
16
|
+
* The way to use is this:
|
|
17
|
+
*
|
|
18
|
+
* 1// initiate -> (see what it returns below)
|
|
19
|
+
*
|
|
20
|
+
* 2// attach the ref & pass fixPos as a prop to whatever
|
|
21
|
+
* wrapper is wrapping the menu or dropdown.
|
|
22
|
+
*
|
|
23
|
+
* 3// whereever you are tracking the dropdown/menu opening or closing,
|
|
24
|
+
* there you can write a function to
|
|
25
|
+
* trigger applyFixedPos() when open
|
|
26
|
+
* and removeFixedPos() when closed
|
|
27
|
+
* for example in ActionMenu we can pass a prop called 'setShowActions'
|
|
28
|
+
* which listens to open-close changes
|
|
29
|
+
*
|
|
30
|
+
* And thats it. it should work.
|
|
31
|
+
*
|
|
32
|
+
* Current Usage :
|
|
33
|
+
* 1. In ImageEditor component > to make the ActionMenu stick out of parent
|
|
34
|
+
* 2. In TableRowElem component > to make the ActionMenu stick out of parent
|
|
35
|
+
*
|
|
36
|
+
* Known Issues :
|
|
37
|
+
* 1. If you scroll while the menu is open, it remains fixed to that part of the
|
|
38
|
+
* screen since we are using fixed positioning.
|
|
39
|
+
* 2. When you close the menu, fixed position is removed, so momentarily you see the
|
|
40
|
+
* menu disappearing behind the overflow hidden parent. Minor, but an issue none the less.
|
|
41
|
+
*
|
|
42
|
+
*
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
var usePopOutOfOverflowHiddenParent = function (popOutOfOverflowHiddenParent) {
|
|
46
|
+
var trackerRef = (0, react_1.useRef)(null);
|
|
47
|
+
var _a = (0, react_1.useState)(undefined), fixPos = _a[0], setFixPos = _a[1];
|
|
48
|
+
var getBoundingClientRect = function () { var _a; return (_a = trackerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(); };
|
|
49
|
+
var applyFixedPos = function () {
|
|
50
|
+
setFixPos(getBoundingClientRect());
|
|
51
|
+
};
|
|
52
|
+
var updateFixedPos = function (e) {
|
|
53
|
+
/**
|
|
54
|
+
* only if popOut... prop is enabled, AND
|
|
55
|
+
* if an initial fixedPos has been applied,
|
|
56
|
+
* then update it
|
|
57
|
+
*/
|
|
58
|
+
if (popOutOfOverflowHiddenParent)
|
|
59
|
+
setFixPos(function (prev) { return prev && getBoundingClientRect(); });
|
|
60
|
+
};
|
|
61
|
+
(0, useScroll_1.useScroll)(updateFixedPos, { noThrottle: true });
|
|
62
|
+
var removeFixedPos = function () { return setFixPos(undefined); };
|
|
63
|
+
return ({ trackerRef: trackerRef, applyFixedPos: applyFixedPos, removeFixedPos: removeFixedPos, fixPos: fixPos });
|
|
64
|
+
};
|
|
65
|
+
exports.usePopOutOfOverflowHiddenParent = usePopOutOfOverflowHiddenParent;
|
|
@@ -19,7 +19,7 @@ var SIZES = {
|
|
|
19
19
|
S: "3rem",
|
|
20
20
|
M: "4rem",
|
|
21
21
|
};
|
|
22
|
-
var ButtonPrimary = (0, styled_components_2.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border: none; // $none;\n background-color: ", ";\n color: ", ";\n ", "\n ", "\n &:hover {\n
|
|
22
|
+
var ButtonPrimary = (0, styled_components_2.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border: none; // $none;\n background-color: ", ";\n color: ", ";\n ", "\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n }\n"], ["\n border: none; // $none;\n background-color: ", ";\n color: ", ";\n ", "\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n }\n"])), function (_a) {
|
|
23
23
|
var invert = _a.invert, colors = _a.theme.colors;
|
|
24
24
|
return invert
|
|
25
25
|
? (0, utilsOolib_1.getPrimaryColor40)(colors)
|
|
@@ -47,7 +47,7 @@ var ButtonPrimary = (0, styled_components_2.css)(templateObject_3 || (templateOb
|
|
|
47
47
|
? greyColor100
|
|
48
48
|
: (0, utilsOolib_1.getPrimaryColorText)(colors);
|
|
49
49
|
});
|
|
50
|
-
var ButtonSecondary = (0, styled_components_2.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n border: 2px solid\n ", ";\n background-color: ", ";\n\n color: ", "; \n ", "\n ", "\n ", "\n &:hover {\n
|
|
50
|
+
var ButtonSecondary = (0, styled_components_2.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n border: 2px solid\n ", ";\n background-color: ", ";\n\n color: ", "; \n ", "\n ", "\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n color: ", "; \n }\n }\n"], ["\n border: 2px solid\n ", ";\n background-color: ", ";\n\n color: ", "; \n ", "\n ", "\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n color: ", "; \n }\n }\n"])), function (_a) {
|
|
51
51
|
var invert = _a.invert, colors = _a.theme.colors;
|
|
52
52
|
return invert
|
|
53
53
|
? (0, utilsOolib_1.getPrimaryColor40)(colors)
|
|
@@ -92,7 +92,7 @@ var ButtonSecondary = (0, styled_components_2.css)(templateObject_7 || (template
|
|
|
92
92
|
var colors = _a.theme.colors;
|
|
93
93
|
return (0, utilsOolib_1.getPrimaryColorText)(colors);
|
|
94
94
|
});
|
|
95
|
-
var ButtonCustom = (0, styled_components_2.css)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n border: 2px solid\n ", ";\n box-shadow: -4px 4px 1px\n ", ";\n \n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n ", "\n &:hover {\n
|
|
95
|
+
var ButtonCustom = (0, styled_components_2.css)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n border: 2px solid\n ", ";\n box-shadow: -4px 4px 1px\n ", ";\n \n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n"], ["\n border: 2px solid\n ", ";\n box-shadow: -4px 4px 1px\n ", ";\n \n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n"])), function (_a) {
|
|
96
96
|
var invert = _a.invert, colors = _a.theme.colors;
|
|
97
97
|
return invert
|
|
98
98
|
? (0, utilsOolib_1.getPrimaryColor40)(colors)
|
|
@@ -128,7 +128,7 @@ var ButtonCustom = (0, styled_components_2.css)(templateObject_10 || (templateOb
|
|
|
128
128
|
? greyColor80
|
|
129
129
|
: (0, utilsOolib_1.getPrimaryColor40)(colors);
|
|
130
130
|
});
|
|
131
|
-
var ButtonGhost = (0, styled_components_2.css)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n background-color: ", "; //$white;\n color: ", ";\n ", "\n ", "\n\n ", "\n &:hover {\n
|
|
131
|
+
var ButtonGhost = (0, styled_components_2.css)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n background-color: ", "; //$white;\n color: ", ";\n ", "\n ", "\n\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n"], ["\n background-color: ", "; //$white;\n color: ", ";\n ", "\n ", "\n\n ", "\n @media (hover: hover) {\n &:hover {\n background-color: ", ";\n }\n }\n"])), function (_a) {
|
|
132
132
|
var active = _a.active, colors = _a.theme.colors;
|
|
133
133
|
return active ? (0, utilsOolib_1.getPrimaryColor40)(colors) : "inherit";
|
|
134
134
|
}, function (_a) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export function CheckboxInput({ option, onClick, S, value, invert, disabled, rightWrongResult, }: {
|
|
1
|
+
export function CheckboxInput({ option, onClick, S, inputStyle, value, invert, disabled, rightWrongResult, }: {
|
|
2
2
|
option: any;
|
|
3
3
|
onClick: any;
|
|
4
4
|
S: any;
|
|
5
|
-
|
|
5
|
+
inputStyle: any;
|
|
6
|
+
value?: any[];
|
|
6
7
|
invert: any;
|
|
7
8
|
disabled: any;
|
|
8
9
|
rightWrongResult: any;
|
|
@@ -18,6 +18,7 @@ exports.CheckboxInput = void 0;
|
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var icons_1 = require("../../../../../../icons");
|
|
20
20
|
var themes_1 = require("../../../../../../themes");
|
|
21
|
+
var Tags_1 = require("../../../../../Tags");
|
|
21
22
|
var Typo_1 = require("../../../../../Typo");
|
|
22
23
|
var styled_1 = require("../../../../styled");
|
|
23
24
|
var utils_1 = require("../../../../utils");
|
|
@@ -25,11 +26,11 @@ var styled_2 = require("./styled");
|
|
|
25
26
|
var Check = icons_1.icons.Check, CheckSquare = icons_1.icons.CheckSquare, XSquare = icons_1.icons.XSquare;
|
|
26
27
|
var white = themes_1.colors.white, green = themes_1.colors.green, red = themes_1.colors.red, greyColor40 = themes_1.colors.greyColor40, greyColor100 = themes_1.colors.greyColor100;
|
|
27
28
|
var CheckboxInput = function (_a) {
|
|
28
|
-
var option = _a.option, onClick = _a.onClick, S = _a.S,
|
|
29
|
+
var option = _a.option, onClick = _a.onClick, S = _a.S, inputStyle = _a.inputStyle, _b = _a.value, value = _b === void 0 ? [] : _b, invert = _a.invert, disabled = _a.disabled, rightWrongResult = _a.rightWrongResult;
|
|
29
30
|
var isSelected = value.find(function (selOp) { return selOp.value === option.value; });
|
|
30
31
|
var markingCommand = (0, utils_1.getMarkingCommand)({ option: option, isSelected: isSelected }); // returns undefined if option isn't labeled as 'correct' nor selected
|
|
31
32
|
var SuitableTypo = S ? Typo_1.SANS_2 : Typo_1.SANS_3;
|
|
32
|
-
return (react_1.default.createElement(styled_1.StyledOption, __assign({}, { rightWrongResult: rightWrongResult, isSelected: isSelected, disabled: disabled, invert: invert, S: S }, { onClick: function () { return !rightWrongResult && onClick(option, isSelected); } }),
|
|
33
|
+
return inputStyle === 'tagSelect' ? (react_1.default.createElement(Tags_1.TagSelect, __assign({}, { isSelected: isSelected, invert: invert, disabled: disabled }, { onClick: function () { return !disabled && onClick(option, isSelected); }, display: option.display, value: option.value, style: { alignSelf: 'flex-start' } }))) : (react_1.default.createElement(styled_1.StyledOption, __assign({}, { rightWrongResult: rightWrongResult, isSelected: isSelected, disabled: disabled, invert: invert, S: S }, { onClick: function () { return !rightWrongResult && !disabled && onClick(option, isSelected); } }),
|
|
33
34
|
!rightWrongResult || markingCommand === undefined ?
|
|
34
35
|
react_1.default.createElement(styled_2.StyledCheckbox, __assign({ className: "btn" }, { isSelected: isSelected, disabled: disabled, invert: invert, S: S }), isSelected && react_1.default.createElement(Check, { weight: "bold", color: invert ? greyColor100 : white, size: 16 }))
|
|
35
36
|
:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function CheckboxList({ id, injectOtherOption, value: valueProp, onChange, commonIsCorrectDesc, options, saveValueAsString,
|
|
1
|
+
export function CheckboxList({ id, injectOtherOption, value: valueProp, onChange, commonIsCorrectDesc, options, saveValueAsString, inputStyle, rightWrongResult, listType, invert, optionsLimit, style, disabled, className, S, readOnly }: {
|
|
2
2
|
id: any;
|
|
3
3
|
injectOtherOption?: boolean;
|
|
4
4
|
value?: any[];
|
|
@@ -6,10 +6,11 @@ export function CheckboxList({ id, injectOtherOption, value: valueProp, onChange
|
|
|
6
6
|
commonIsCorrectDesc: any;
|
|
7
7
|
options: any;
|
|
8
8
|
saveValueAsString: any;
|
|
9
|
-
|
|
9
|
+
inputStyle?: string;
|
|
10
10
|
rightWrongResult: any;
|
|
11
11
|
listType: any;
|
|
12
12
|
invert: any;
|
|
13
|
+
optionsLimit?: number;
|
|
13
14
|
style: any;
|
|
14
15
|
disabled: any;
|
|
15
16
|
className: any;
|
|
@@ -10,28 +10,57 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var
|
|
14
|
-
|
|
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 (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
15
35
|
};
|
|
16
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
37
|
exports.CheckboxList = void 0;
|
|
18
|
-
var react_1 =
|
|
38
|
+
var react_1 = __importStar(require("react"));
|
|
19
39
|
var BlockLabel_1 = require("../../../BlockLabel");
|
|
20
40
|
var Tags_1 = require("../../../Tags");
|
|
21
41
|
var TextInputs_1 = require("../../../TextInputs");
|
|
42
|
+
var Buttons_1 = require("../../../Buttons");
|
|
22
43
|
var _EXPORTS_1 = require("../../../../utils/_EXPORTS");
|
|
23
44
|
var utils_1 = require("../../utils");
|
|
24
45
|
var styled_1 = require("../../styled");
|
|
25
46
|
var comps_1 = require("./comps");
|
|
26
47
|
var styled_2 = require("./styled");
|
|
48
|
+
var optionsContainers = {
|
|
49
|
+
checkbox: styled_1.StyledOptionsContainer,
|
|
50
|
+
tagSelect: styled_2.StyledTagOptionsContainer,
|
|
51
|
+
};
|
|
27
52
|
var convToString = function (value) { return value.map(function (v) { var _a; return (_a = v.display_desc) !== null && _a !== void 0 ? _a : v.value; }); };
|
|
28
53
|
function CheckboxList(_a) {
|
|
29
|
-
var id = _a.id, _b = _a.injectOtherOption, injectOtherOption = _b === void 0 ? false : _b, _c = _a.value, valueProp = _c === void 0 ? [] : _c, onChange = _a.onChange, commonIsCorrectDesc = _a.commonIsCorrectDesc, options = _a.options, saveValueAsString = _a.saveValueAsString,
|
|
54
|
+
var id = _a.id, _b = _a.injectOtherOption, injectOtherOption = _b === void 0 ? false : _b, _c = _a.value, valueProp = _c === void 0 ? [] : _c, onChange = _a.onChange, commonIsCorrectDesc = _a.commonIsCorrectDesc, options = _a.options, saveValueAsString = _a.saveValueAsString, _d = _a.inputStyle, inputStyle = _d === void 0 ? 'checkbox' : _d, rightWrongResult = _a.rightWrongResult, listType = _a.listType, invert = _a.invert, _e = _a.optionsLimit, optionsLimit = _e === void 0 ? Infinity : _e, style = _a.style, //where to attatch this
|
|
30
55
|
disabled = _a.disabled, className = _a.className, S = _a.S, readOnly = _a.readOnly;
|
|
31
56
|
var props = arguments[0];
|
|
32
|
-
var
|
|
57
|
+
var shouldHideSomeOptions = options.length > optionsLimit;
|
|
58
|
+
var _f = (0, react_1.useState)(false), seeMore = _f[0], setSeeMore = _f[1];
|
|
59
|
+
var _g = (0, utils_1.genDisplayedOptions)({ injectOtherOption: injectOtherOption, options: options, valueProp: valueProp, saveValueAsString: saveValueAsString }), typicalOptions = _g.typicalOptions, injectedOtherOption = _g.injectedOtherOption;
|
|
33
60
|
var value = saveValueAsString ?
|
|
34
|
-
typicalOptions
|
|
61
|
+
typicalOptions
|
|
62
|
+
.concat(injectedOtherOption || [])
|
|
63
|
+
.filter(function (op) { var _a; return valueProp.includes((_a = op.display_desc) !== null && _a !== void 0 ? _a : op.value); })
|
|
35
64
|
: valueProp;
|
|
36
65
|
var handleTextInputChange = function (text) {
|
|
37
66
|
var newValue = value.map(function (selectedOp) { return (selectedOp.value === 'other' ? (0, utils_1.genOtherValueObject)(text) : selectedOp); });
|
|
@@ -53,21 +82,27 @@ function CheckboxList(_a) {
|
|
|
53
82
|
value: value,
|
|
54
83
|
S: S,
|
|
55
84
|
disabled: disabled,
|
|
85
|
+
inputStyle: inputStyle,
|
|
56
86
|
rightWrongResult: rightWrongResult,
|
|
57
87
|
onClick: handleCheckboxClick,
|
|
58
88
|
};
|
|
89
|
+
var OptionsContainer = optionsContainers[inputStyle];
|
|
59
90
|
return (react_1.default.createElement("div", { className: className, id: id },
|
|
60
91
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
61
92
|
readOnly ? (react_1.default.createElement(styled_2.StyledDisplayTagsContainer, null, value === null || value === void 0 ? void 0 : value.map(function (selOp) { return react_1.default.createElement(Tags_1.TagDisplay, { key: selOp.value, invert: invert, display: selOp.display_desc || selOp.display }); }))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
62
|
-
react_1.default.createElement(
|
|
63
|
-
typicalOptions.map(function (option) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
93
|
+
react_1.default.createElement(OptionsContainer, { listType: listType, S: S }, typicalOptions === null || typicalOptions === void 0 ? void 0 :
|
|
94
|
+
typicalOptions.map(function (option, idx) { return idx < optionsLimit && (react_1.default.createElement(comps_1.CheckboxInput, __assign({}, __assign(__assign({}, InputCommonProps), { option: option, key: option.value })))); }),
|
|
95
|
+
shouldHideSomeOptions && // if we have the case of off limit options
|
|
96
|
+
(seeMore || rightWrongResult) && //and decided to show them
|
|
97
|
+
typicalOptions.slice(optionsLimit).map(function (option) {
|
|
98
|
+
return react_1.default.createElement(comps_1.CheckboxInput, __assign({}, __assign(__assign({}, InputCommonProps), { option: option, key: option.value })));
|
|
99
|
+
}),
|
|
100
|
+
injectOtherOption && injectedOtherOption && ( //so other box and its textInput act as one entity in the flexbox
|
|
67
101
|
react_1.default.createElement(styled_1.StyledOtherOptionContainer, { listType: listType },
|
|
68
|
-
react_1.default.createElement(comps_1.CheckboxInput, __assign({}, __assign(__assign({}, InputCommonProps), { option:
|
|
102
|
+
react_1.default.createElement(comps_1.CheckboxInput, __assign({}, __assign(__assign({}, InputCommonProps), { option: injectedOtherOption }))),
|
|
69
103
|
otherOpInSelectees && (react_1.default.createElement(styled_1.StyledOtherTextInputWrapper, __assign({}, { listType: listType, rightWrongResult: rightWrongResult }),
|
|
70
104
|
react_1.default.createElement(TextInputs_1.TextInput, __assign({ placeholder: "Please Specify Here", value: otherOpInSelectees.display_desc, onChange: function (k, v) { return handleTextInputChange(v); } }, { disabled: disabled, invert: invert, S: S }))))))),
|
|
105
|
+
shouldHideSomeOptions && !rightWrongResult && (react_1.default.createElement(Buttons_1.ButtonGhost, { onClick: function () { return setSeeMore(!seeMore); }, value: !seeMore ? 'See More' : 'See Less', style: inputStyle != 'tagSelect' ? { marginTop: 10 } : {} })),
|
|
71
106
|
rightWrongResult && commonIsCorrectDesc &&
|
|
72
107
|
react_1.default.createElement(styled_1.StyledCorrectMessage, null, commonIsCorrectDesc)))));
|
|
73
108
|
}
|
|
@@ -7,7 +7,11 @@ 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.StyledDisplayTagsContainer = void 0;
|
|
10
|
+
exports.StyledTagOptionsContainer = exports.StyledDisplayTagsContainer = void 0;
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
exports.StyledDisplayTagsContainer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n gap: 1rem;\n"], ["\n display: flex;\n flex-wrap: wrap;\n gap: 1rem;\n"])));
|
|
13
|
-
|
|
13
|
+
exports.StyledTagOptionsContainer = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n flex-direction: ", ";\n gap: 1rem;\n padding: 1.5rem 0 2rem 0;\n"], ["\n display: flex;\n flex-wrap: wrap;\n flex-direction: ", ";\n gap: 1rem;\n padding: 1.5rem 0 2rem 0;\n"])), function (_a) {
|
|
14
|
+
var listType = _a.listType;
|
|
15
|
+
return listType === 'vertical' ? 'column' : 'row';
|
|
16
|
+
});
|
|
17
|
+
var templateObject_1, templateObject_2;
|
|
@@ -29,7 +29,7 @@ var RadioInput = function (_a) {
|
|
|
29
29
|
var isSelected = option.value === (value === null || value === void 0 ? void 0 : value.value);
|
|
30
30
|
var markingCommand = (0, utils_1.getMarkingCommand)({ option: option, isSelected: isSelected }); // returns undefined if option isn't labeled as 'correct' nor selected
|
|
31
31
|
var SuitableTypo = S ? Typo_1.SANS_2 : Typo_1.SANS_3;
|
|
32
|
-
return (react_1.default.createElement(styled_1.StyledOption, __assign({}, { disabled: disabled, rightWrongResult: rightWrongResult, isSelected: isSelected, invert: invert, S: S }, { onClick: function () { return !rightWrongResult && onClick(option); } }),
|
|
32
|
+
return (react_1.default.createElement(styled_1.StyledOption, __assign({}, { disabled: disabled, rightWrongResult: rightWrongResult, isSelected: isSelected, invert: invert, S: S }, { onClick: function () { return !rightWrongResult && !disabled && onClick(option); } }),
|
|
33
33
|
!rightWrongResult || markingCommand === undefined ?
|
|
34
34
|
react_1.default.createElement(styled_2.StyledRadioInput, __assign({ className: 'btn' }, { isSelected: isSelected, disabled: disabled, invert: invert, S: S }), isSelected && react_1.default.createElement(styled_2.StyledRadioInputFill, { invert: invert, S: S }))
|
|
35
35
|
:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function RadioList({ id, injectOtherOption, value: valueProp, onChange, saveValueAsString, options, commonIsCorrectDesc, rightWrongResult, listType, disabled, invert, style, className, readOnly, S }: {
|
|
1
|
+
export function RadioList({ id, injectOtherOption, value: valueProp, onChange, saveValueAsString, options, commonIsCorrectDesc, rightWrongResult, optionsLimit, listType, disabled, invert, style, className, readOnly, S }: {
|
|
2
2
|
id: any;
|
|
3
3
|
injectOtherOption?: boolean;
|
|
4
4
|
value: any;
|
|
@@ -7,6 +7,7 @@ export function RadioList({ id, injectOtherOption, value: valueProp, onChange, s
|
|
|
7
7
|
options: any;
|
|
8
8
|
commonIsCorrectDesc: any;
|
|
9
9
|
rightWrongResult: any;
|
|
10
|
+
optionsLimit?: number;
|
|
10
11
|
listType: any;
|
|
11
12
|
disabled: any;
|
|
12
13
|
invert: any;
|
|
@@ -10,25 +10,51 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var
|
|
14
|
-
|
|
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 (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
15
35
|
};
|
|
16
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
37
|
exports.RadioList = void 0;
|
|
18
|
-
var react_1 =
|
|
38
|
+
var react_1 = __importStar(require("react"));
|
|
19
39
|
var BlockLabel_1 = require("../../../BlockLabel");
|
|
20
40
|
var Tags_1 = require("../../../Tags");
|
|
21
41
|
var TextInputs_1 = require("../../../TextInputs");
|
|
42
|
+
var Buttons_1 = require("../../../Buttons");
|
|
22
43
|
var _EXPORTS_1 = require("../../../../utils/_EXPORTS");
|
|
23
44
|
var styled_1 = require("../../styled");
|
|
24
45
|
var utils_1 = require("../../utils");
|
|
25
46
|
var comps_1 = require("./comps");
|
|
26
47
|
function RadioList(_a) {
|
|
27
|
-
var id = _a.id, _b = _a.injectOtherOption, injectOtherOption = _b === void 0 ? false : _b, valueProp = _a.value, onChange = _a.onChange, saveValueAsString = _a.saveValueAsString, options = _a.options, commonIsCorrectDesc = _a.commonIsCorrectDesc, rightWrongResult = _a.rightWrongResult, listType = _a.listType, disabled = _a.disabled, invert = _a.invert, style = _a.style, className = _a.className, readOnly = _a.readOnly, S = _a.S;
|
|
48
|
+
var id = _a.id, _b = _a.injectOtherOption, injectOtherOption = _b === void 0 ? false : _b, valueProp = _a.value, onChange = _a.onChange, saveValueAsString = _a.saveValueAsString, options = _a.options, commonIsCorrectDesc = _a.commonIsCorrectDesc, rightWrongResult = _a.rightWrongResult, _c = _a.optionsLimit, optionsLimit = _c === void 0 ? Infinity : _c, listType = _a.listType, disabled = _a.disabled, invert = _a.invert, style = _a.style, className = _a.className, readOnly = _a.readOnly, S = _a.S;
|
|
28
49
|
var props = arguments[0];
|
|
29
|
-
var
|
|
50
|
+
var shouldHideSomeOptions = options.length > optionsLimit;
|
|
51
|
+
var _d = (0, react_1.useState)(false), seeMore = _d[0], setSeeMore = _d[1];
|
|
52
|
+
var _e = (0, utils_1.genDisplayedOptions)({ injectOtherOption: injectOtherOption, options: options, valueProp: valueProp, saveValueAsString: saveValueAsString }), typicalOptions = _e.typicalOptions, injectedOtherOption = _e.injectedOtherOption;
|
|
30
53
|
var value = saveValueAsString ?
|
|
31
|
-
typicalOptions
|
|
54
|
+
typicalOptions
|
|
55
|
+
.concat(injectedOtherOption)
|
|
56
|
+
.filter(Boolean)
|
|
57
|
+
.find(function (op) { var _a; return ((_a = op.display_desc) !== null && _a !== void 0 ? _a : op.value) === valueProp; })
|
|
32
58
|
: valueProp;
|
|
33
59
|
var correctOp = options.find(function (op) { return op.isCorrect; }); //
|
|
34
60
|
var handleInputClick = function (option) {
|
|
@@ -51,15 +77,19 @@ function RadioList(_a) {
|
|
|
51
77
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
52
78
|
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
|
|
53
79
|
) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
54
|
-
react_1.default.createElement(styled_1.StyledOptionsContainer, { listType: listType, style: style }, typicalOptions === null || typicalOptions === void 0 ? void 0 :
|
|
55
|
-
typicalOptions.map(function (option) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
80
|
+
react_1.default.createElement(styled_1.StyledOptionsContainer, __assign({}, { listType: listType, style: style, S: S }), typicalOptions === null || typicalOptions === void 0 ? void 0 :
|
|
81
|
+
typicalOptions.map(function (option, idx) { return idx < optionsLimit && (react_1.default.createElement(comps_1.RadioInput, __assign({}, __assign(__assign({}, InputCommonProps), { option: option, key: option.value })))); }),
|
|
82
|
+
shouldHideSomeOptions && // if we have the case of off limit options
|
|
83
|
+
(seeMore || rightWrongResult) && //and decided to show them
|
|
84
|
+
typicalOptions.slice(optionsLimit).map(function (option) {
|
|
85
|
+
return react_1.default.createElement(comps_1.RadioInput, __assign({}, __assign(__assign({}, InputCommonProps), { option: option, key: option.value })));
|
|
86
|
+
}),
|
|
87
|
+
injectOtherOption && injectedOtherOption && ( //so other box and its textInput act as one entity in the flexbox
|
|
59
88
|
react_1.default.createElement(styled_1.StyledOtherOptionContainer, { listType: listType },
|
|
60
|
-
react_1.default.createElement(comps_1.RadioInput, __assign({}, __assign(__assign({}, InputCommonProps), { option:
|
|
89
|
+
react_1.default.createElement(comps_1.RadioInput, __assign({}, __assign(__assign({}, InputCommonProps), { option: injectedOtherOption }))),
|
|
61
90
|
(value === null || value === void 0 ? void 0 : value.value) === "other" && (react_1.default.createElement(styled_1.StyledOtherTextInputWrapper, __assign({}, { listType: listType, rightWrongResult: rightWrongResult }),
|
|
62
91
|
react_1.default.createElement(TextInputs_1.TextInput, __assign({ placeholder: "Please Specify Here", value: value.display_desc, onChange: function (k, v) { return handleTextInputChange(v); } }, { disabled: disabled, invert: invert, S: S }))))))),
|
|
92
|
+
shouldHideSomeOptions && !rightWrongResult && (react_1.default.createElement(Buttons_1.ButtonGhost, { onClick: function () { return setSeeMore(!seeMore); }, value: !seeMore ? 'See More' : 'See Less', style: { marginTop: 10 } })),
|
|
63
93
|
/*
|
|
64
94
|
the minute the results have come in, irrespective of user's answer
|
|
65
95
|
being right or wrong, we always show an explanation
|
|
@@ -34,9 +34,15 @@ var Typo_1 = require("../Typo");
|
|
|
34
34
|
var themes_1 = require("../../themes");
|
|
35
35
|
var mixins_1 = require("../../themes/mixins");
|
|
36
36
|
var green = themes_1.colors.green, greyColor80 = themes_1.colors.greyColor80;
|
|
37
|
-
exports.StyledOptionsContainer = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n gap:
|
|
37
|
+
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) {
|
|
38
|
+
var S = _a.S;
|
|
39
|
+
return S ? '0.7rem 1.5rem' : '1rem 2rem';
|
|
40
|
+
}, function (_a) {
|
|
38
41
|
var listType = _a.listType;
|
|
39
|
-
return listType === 'vertical' ? (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: column;\n gap:
|
|
42
|
+
return listType === 'vertical' ? (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: column;\n gap: ", ";\n align-items: initial;\n "], ["\n flex-direction: column;\n gap: ", ";\n align-items: initial;\n "])), function (_a) {
|
|
43
|
+
var S = _a.S;
|
|
44
|
+
return S ? '1rem' : '1.5rem';
|
|
45
|
+
}) :
|
|
40
46
|
'';
|
|
41
47
|
});
|
|
42
48
|
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) {
|
|
@@ -61,5 +67,5 @@ exports.StyledOtherTextInputWrapper = styled_components_1.default.div(templateOb
|
|
|
61
67
|
var listType = _a.listType;
|
|
62
68
|
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"])));
|
|
63
69
|
}, (0, mixins_1.mediaQuery)('sm'));
|
|
64
|
-
exports.StyledCorrectMessage = (0, styled_components_1.default)(Typo_1.
|
|
70
|
+
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"])), green);
|
|
65
71
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
@@ -15,5 +15,8 @@ export function genDisplayedOptions({ injectOtherOption, options, valueProp, sav
|
|
|
15
15
|
saveValueAsString: any;
|
|
16
16
|
}): {
|
|
17
17
|
typicalOptions: any;
|
|
18
|
-
|
|
18
|
+
injectedOtherOption?: undefined;
|
|
19
|
+
} | {
|
|
20
|
+
typicalOptions: any;
|
|
21
|
+
injectedOtherOption: any;
|
|
19
22
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.genDisplayedOptions = exports.genOtherValueObject = exports.getMarkingCommand = void 0;
|
|
4
|
-
var
|
|
4
|
+
var formatTextToCamelCase_1 = require("../../utils/formatTextToCamelCase");
|
|
5
|
+
var toArray_1 = require("../../utils/toArray");
|
|
5
6
|
var getMarkingCommand = function (_a) {
|
|
6
7
|
var option = _a.option, isSelected = _a.isSelected;
|
|
7
8
|
if (isSelected) {
|
|
@@ -14,7 +15,7 @@ var getMarkingCommand = function (_a) {
|
|
|
14
15
|
};
|
|
15
16
|
exports.getMarkingCommand = getMarkingCommand;
|
|
16
17
|
var genOtherValueObject = function (text) {
|
|
17
|
-
var value_desc = (0,
|
|
18
|
+
var value_desc = (0, formatTextToCamelCase_1.formatTextToCamelCase)(text);
|
|
18
19
|
return {
|
|
19
20
|
value: "other",
|
|
20
21
|
display_desc: text,
|
|
@@ -25,21 +26,24 @@ var genOtherValueObject = function (text) {
|
|
|
25
26
|
exports.genOtherValueObject = genOtherValueObject;
|
|
26
27
|
var genDisplayedOptions = function (_a) {
|
|
27
28
|
var injectOtherOption = _a.injectOtherOption, options = _a.options, valueProp = _a.valueProp, saveValueAsString = _a.saveValueAsString;
|
|
28
|
-
|
|
29
|
-
if
|
|
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)
|
|
30
35
|
return {
|
|
31
|
-
typicalOptions: options
|
|
32
|
-
otherOption: injectOtherOption ? otherOption : {}
|
|
36
|
+
typicalOptions: options
|
|
33
37
|
};
|
|
34
|
-
var OtherValInValueProp = (
|
|
38
|
+
var OtherValInValueProp = (0, toArray_1.toArray)(valueProp).find(function (v) {
|
|
35
39
|
return saveValueAsString ?
|
|
36
40
|
options.every(function (op) { return op.value !== v; })
|
|
37
41
|
: (v === null || v === void 0 ? void 0 : v.value) === 'other';
|
|
38
42
|
});
|
|
39
|
-
|
|
43
|
+
var injectedOtherOption = saveValueAsString ?
|
|
40
44
|
{ value: "other", display: "Other", display_desc: (OtherValInValueProp || '') }
|
|
41
45
|
:
|
|
42
46
|
OtherValInValueProp || { value: "other", display: "Other", display_desc: '' };
|
|
43
|
-
return { typicalOptions: options,
|
|
47
|
+
return { typicalOptions: options, injectedOtherOption: injectedOtherOption };
|
|
44
48
|
};
|
|
45
49
|
exports.genDisplayedOptions = genDisplayedOptions;
|
|
@@ -17,13 +17,14 @@ export function TagClear({ id, display, value, M, XS, invert, onClick, variant,
|
|
|
17
17
|
variant?: string;
|
|
18
18
|
grey: any;
|
|
19
19
|
}): JSX.Element;
|
|
20
|
-
export function TagSelect({ onClick, isSelected, display, value, M, XS, style, onMouseDown }: {
|
|
20
|
+
export function TagSelect({ onClick, isSelected, display, value, M, XS, invert, style, onMouseDown }: {
|
|
21
21
|
onClick: any;
|
|
22
22
|
isSelected?: boolean;
|
|
23
23
|
display: any;
|
|
24
24
|
value: any;
|
|
25
25
|
M: any;
|
|
26
26
|
XS: any;
|
|
27
|
+
invert: any;
|
|
27
28
|
style: any;
|
|
28
29
|
onMouseDown: any;
|
|
29
30
|
}): JSX.Element;
|
|
@@ -56,7 +56,7 @@ function TagClear(_a) {
|
|
|
56
56
|
}
|
|
57
57
|
exports.TagClear = TagClear;
|
|
58
58
|
function TagSelect(_a) {
|
|
59
|
-
var onClick = _a.onClick, _b = _a.isSelected, isSelected = _b === void 0 ? false : _b, display = _a.display, value = _a.value, M = _a.M, XS = _a.XS, style = _a.style, onMouseDown = _a.onMouseDown;
|
|
59
|
+
var onClick = _a.onClick, _b = _a.isSelected, isSelected = _b === void 0 ? false : _b, display = _a.display, value = _a.value, M = _a.M, XS = _a.XS, invert = _a.invert, style = _a.style, onMouseDown = _a.onMouseDown;
|
|
60
60
|
var _c = (0, react_1.useState)(isSelected), selected = _c[0], setSelected = _c[1];
|
|
61
61
|
var handleOnClick = function () {
|
|
62
62
|
setSelected(!selected);
|
|
@@ -69,7 +69,7 @@ function TagSelect(_a) {
|
|
|
69
69
|
}, [isSelected]);
|
|
70
70
|
var size = M ? 'M' : XS ? 'XS' : 'S';
|
|
71
71
|
var TYPO_COMP = getTypoComp(size);
|
|
72
|
-
return (react_1.default.createElement(index_styled_1.StyledTagSelect, { onClick: onMouseDown ? function () { return null; } : handleOnClick, selected: selected, size: size, style: style, onMouseDown: onMouseDown },
|
|
72
|
+
return (react_1.default.createElement(index_styled_1.StyledTagSelect, { invert: invert, onClick: onMouseDown ? function () { return null; } : handleOnClick, selected: selected, size: size, style: style, onMouseDown: onMouseDown },
|
|
73
73
|
react_1.default.createElement(TYPO_COMP, null, display)));
|
|
74
74
|
}
|
|
75
75
|
exports.TagSelect = TagSelect;
|
|
@@ -3,4 +3,6 @@ export { setVal } from "../getterSetterDeleter/setVal";
|
|
|
3
3
|
export { deleteVal } from "../getterSetterDeleter/deleteVal";
|
|
4
4
|
export { getBlockLabelProps } from "../getBlockLabelProps";
|
|
5
5
|
export { injectHttps } from "../injectHttps";
|
|
6
|
-
export {
|
|
6
|
+
export { formatTextToCamelCase } from "../formatTextToCamelCase";
|
|
7
|
+
export { toArray } from "../toArray";
|
|
8
|
+
export { useScroll } from "../customHooks/useScroll";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useScroll = exports.toArray = exports.formatTextToCamelCase = exports.injectHttps = exports.getBlockLabelProps = exports.deleteVal = exports.setVal = exports.getVal = void 0;
|
|
4
4
|
//the holy setter, getter & deleter
|
|
5
5
|
var getVal_1 = require("../getterSetterDeleter/getVal");
|
|
6
6
|
Object.defineProperty(exports, "getVal", { enumerable: true, get: function () { return getVal_1.getVal; } });
|
|
@@ -13,5 +13,10 @@ var getBlockLabelProps_1 = require("../getBlockLabelProps");
|
|
|
13
13
|
Object.defineProperty(exports, "getBlockLabelProps", { enumerable: true, get: function () { return getBlockLabelProps_1.getBlockLabelProps; } });
|
|
14
14
|
var injectHttps_1 = require("../injectHttps");
|
|
15
15
|
Object.defineProperty(exports, "injectHttps", { enumerable: true, get: function () { return injectHttps_1.injectHttps; } });
|
|
16
|
-
var
|
|
17
|
-
Object.defineProperty(exports, "
|
|
16
|
+
var formatTextToCamelCase_1 = require("../formatTextToCamelCase");
|
|
17
|
+
Object.defineProperty(exports, "formatTextToCamelCase", { enumerable: true, get: function () { return formatTextToCamelCase_1.formatTextToCamelCase; } });
|
|
18
|
+
var toArray_1 = require("../toArray");
|
|
19
|
+
Object.defineProperty(exports, "toArray", { enumerable: true, get: function () { return toArray_1.toArray; } });
|
|
20
|
+
//custom hooks
|
|
21
|
+
var useScroll_1 = require("../customHooks/useScroll");
|
|
22
|
+
Object.defineProperty(exports, "useScroll", { enumerable: true, get: function () { return useScroll_1.useScroll; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function useScroll(scrollFn: any, options?: {}): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useScroll = void 0;
|
|
4
|
+
var lodash_1 = require("lodash");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var useScroll = function (scrollFn, options) {
|
|
7
|
+
if (options === void 0) { options = {}; }
|
|
8
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
9
|
+
scrollFn(); //run the scroll fn once before any scroll to set initial states
|
|
10
|
+
var throttledScrollFn = (0, lodash_1.throttle)(scrollFn, 100);
|
|
11
|
+
var fnToUse = options.noThrottle ? scrollFn : throttledScrollFn;
|
|
12
|
+
window.addEventListener('scroll', fnToUse);
|
|
13
|
+
return function () { return window.removeEventListener('scroll', fnToUse); };
|
|
14
|
+
}, [options.loading]);
|
|
15
|
+
};
|
|
16
|
+
exports.useScroll = useScroll;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function formatTextToCamelCase(text: any): any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
3
|
+
exports.formatTextToCamelCase = void 0;
|
|
4
|
+
var formatTextToCamelCase = function (text) {
|
|
5
5
|
var value_desc = ( // genrating a value text abiding js conventions (camelCased)
|
|
6
6
|
text
|
|
7
7
|
.trim()
|
|
@@ -12,4 +12,4 @@ var genValueFromDisplay = function (text) {
|
|
|
12
12
|
.join(""));
|
|
13
13
|
return value_desc;
|
|
14
14
|
};
|
|
15
|
-
exports.
|
|
15
|
+
exports.formatTextToCamelCase = formatTextToCamelCase;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function toArray(property: any): any[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toArray = void 0;
|
|
4
|
+
var toArray = function (property) {
|
|
5
|
+
if (!property &&
|
|
6
|
+
(property !== false && property !== 0))
|
|
7
|
+
return []; //return an empty array if the property is falsy. ( except for an explicity 'false' or '0' value )
|
|
8
|
+
if (property.constructor === Array)
|
|
9
|
+
return property;
|
|
10
|
+
//else
|
|
11
|
+
return [property];
|
|
12
|
+
};
|
|
13
|
+
exports.toArray = toArray;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function useTrackFocus(ref: any, setShowOptions: any, options?: {}): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function genValueFromDisplay(text: any): any;
|