oolib 2.57.2 → 2.57.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Dropdowns/DropdownMulti/index.d.ts +36 -0
- package/dist/components/Dropdowns/DropdownMulti/index.js +201 -0
- package/dist/components/Dropdowns/DropdownSingle/index.d.ts +37 -0
- package/dist/components/Dropdowns/DropdownSingle/index.js +183 -0
- package/dist/components/Dropdowns/comps/Caret/index.d.ts +6 -0
- package/dist/components/Dropdowns/comps/Caret/index.js +19 -0
- package/dist/components/Dropdowns/comps/Caret/styled.d.ts +2 -0
- package/dist/components/Dropdowns/comps/Caret/styled.js +14 -0
- package/dist/components/Dropdowns/comps/DisplayCompSingle/index.d.ts +5 -0
- package/dist/components/Dropdowns/comps/DisplayCompSingle/index.js +39 -0
- package/dist/components/Dropdowns/comps/NoOptionResultsComp/index.d.ts +3 -0
- package/dist/components/Dropdowns/comps/NoOptionResultsComp/index.js +15 -0
- package/dist/components/Dropdowns/comps/OptionContent/index.d.ts +6 -0
- package/dist/components/Dropdowns/comps/OptionContent/index.js +30 -0
- package/dist/components/Dropdowns/comps/OptionsMulti/index.d.ts +25 -0
- package/dist/components/Dropdowns/comps/OptionsMulti/index.js +173 -0
- package/dist/components/Dropdowns/comps/OptionsShell/index.d.ts +1 -0
- package/dist/components/Dropdowns/comps/OptionsShell/index.js +81 -0
- package/dist/components/Dropdowns/comps/OptionsShell/styled.d.ts +1 -0
- package/dist/components/Dropdowns/comps/OptionsShell/styled.js +17 -0
- package/dist/components/Dropdowns/comps/OptionsSingle/index.d.ts +24 -0
- package/dist/components/Dropdowns/comps/OptionsSingle/index.js +117 -0
- package/dist/components/Dropdowns/comps/OptionsSingle/styled.d.ts +2 -0
- package/dist/components/Dropdowns/comps/OptionsSingle/styled.js +71 -0
- package/dist/components/Dropdowns/comps/SelectDropdown/index.d.ts +14 -0
- package/dist/components/Dropdowns/comps/SelectDropdown/index.js +56 -0
- package/dist/components/Dropdowns/comps/SelectDropdown/styled.d.ts +1 -0
- package/dist/components/Dropdowns/comps/SelectDropdown/styled.js +61 -0
- package/dist/components/Dropdowns/comps/SelectTagsInput/index.d.ts +15 -0
- package/dist/components/Dropdowns/comps/SelectTagsInput/index.js +113 -0
- package/dist/components/Dropdowns/comps/SelectTagsInput/styled.d.ts +2 -0
- package/dist/components/Dropdowns/comps/SelectTagsInput/styled.js +54 -0
- package/dist/components/Dropdowns/handlers/index.d.ts +15 -0
- package/dist/components/Dropdowns/handlers/index.js +50 -0
- package/dist/components/Dropdowns/styled.d.ts +2 -0
- package/dist/components/Dropdowns/styled.js +39 -0
- package/dist/components/Dropdowns/utils/genIcon.d.ts +1 -0
- package/dist/components/Dropdowns/utils/genIcon.js +17 -0
- package/dist/components/Dropdowns/utils/genLinkOrText.d.ts +1 -0
- package/dist/components/Dropdowns/utils/genLinkOrText.js +48 -0
- package/dist/components/Dropdowns/utils/genProfileImg.d.ts +7 -0
- package/dist/components/Dropdowns/utils/genProfileImg.js +36 -0
- package/dist/components/Dropdowns/utils/genTagComp.d.ts +1 -0
- package/dist/components/Dropdowns/utils/genTagComp.js +27 -0
- package/dist/components/Dropdowns/utils/generateOptions.d.ts +5 -0
- package/dist/components/Dropdowns/utils/generateOptions.js +19 -0
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genMonthsArray.d.ts +1 -0
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genMonthsArray.js +40 -0
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genYearsArray.d.ts +4 -0
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genYearsArray.js +11 -0
- package/dist/components/Dropdowns/utils/getAllOptionsFns/getLanguagesArray.d.ts +4 -0
- package/dist/components/Dropdowns/utils/getAllOptionsFns/getLanguagesArray.js +62 -0
- package/dist/components/Dropdowns/utils/getAllOptionsFns/index.d.ts +1 -0
- package/dist/components/Dropdowns/utils/getAllOptionsFns/index.js +19 -0
- package/dist/components/Dropdowns/utils/getValue.d.ts +12 -0
- package/dist/components/Dropdowns/utils/getValue.js +29 -0
- package/dist/components/Dropdowns/utils/keywordSearchOptions.d.ts +6 -0
- package/dist/components/Dropdowns/utils/keywordSearchOptions.js +18 -0
- package/dist/components/Dropdowns/utils/setDropdownSelectText.d.ts +12 -0
- package/dist/components/Dropdowns/utils/setDropdownSelectText.js +19 -0
- package/dist/components/Dropdowns/utils/useCreateDropdownRefs.d.ts +5 -0
- package/dist/components/Dropdowns/utils/useCreateDropdownRefs.js +15 -0
- package/dist/components/Dropdowns/utils/useHideShowOptions.d.ts +5 -0
- package/dist/components/Dropdowns/utils/useHideShowOptions.js +20 -0
- package/dist/components/Dropdowns/utils/useKeyboardControl.d.ts +12 -0
- package/dist/components/Dropdowns/utils/useKeyboardControl.js +73 -0
- package/dist/components/Dropdowns/utils/useSearchString.d.ts +4 -0
- package/dist/components/Dropdowns/utils/useSearchString.js +20 -0
- package/dist/components/Dropdowns/utils/useSetYOrientation.d.ts +9 -0
- package/dist/components/Dropdowns/utils/useSetYOrientation.js +46 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function SelectTagsInput({ invert, id, value, disabled, handleSelect, searchString, setSearchString, placeholder, setFocusSelectTagsInput, focusSelectTagsInput, single_multi, showOptions, S }: {
|
|
2
|
+
invert: any;
|
|
3
|
+
id: any;
|
|
4
|
+
value: any;
|
|
5
|
+
disabled: any;
|
|
6
|
+
handleSelect: any;
|
|
7
|
+
searchString: any;
|
|
8
|
+
setSearchString: any;
|
|
9
|
+
placeholder: any;
|
|
10
|
+
setFocusSelectTagsInput: any;
|
|
11
|
+
focusSelectTagsInput: any;
|
|
12
|
+
single_multi: any;
|
|
13
|
+
showOptions: any;
|
|
14
|
+
S: any;
|
|
15
|
+
}): any;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.SelectTagsInput = void 0;
|
|
27
|
+
var react_1 = __importStar(require("react"));
|
|
28
|
+
var styled_components_1 = require("styled-components");
|
|
29
|
+
var themes_1 = require("../../../../themes");
|
|
30
|
+
var getKeyCode_1 = require("../../../../utils/getKeyCode");
|
|
31
|
+
var toArray_1 = require("../../../../utils/toArray");
|
|
32
|
+
var utilsOolib_1 = require("../../../../utilsOolib");
|
|
33
|
+
var Typo_1 = require("../../../Typo");
|
|
34
|
+
var styled_1 = require("../../styled");
|
|
35
|
+
var genTagComp_1 = require("../../utils/genTagComp");
|
|
36
|
+
var styled_2 = require("./styled");
|
|
37
|
+
var SelectTagsInput = function (_a) {
|
|
38
|
+
var
|
|
39
|
+
//from root
|
|
40
|
+
invert = _a.invert, id = _a.id, value = _a.value, disabled = _a.disabled,
|
|
41
|
+
// genCustomSelectComp,
|
|
42
|
+
handleSelect = _a.handleSelect, searchString = _a.searchString, setSearchString = _a.setSearchString, placeholder = _a.placeholder,
|
|
43
|
+
// minHeight, // standard | wide | actual height in rem
|
|
44
|
+
setFocusSelectTagsInput = _a.setFocusSelectTagsInput, focusSelectTagsInput = _a.focusSelectTagsInput, //force focus when after an option is selected in multiselect
|
|
45
|
+
single_multi = _a.single_multi, showOptions = _a.showOptions, S = _a.S;
|
|
46
|
+
var inputRef = (0, react_1.useRef)(null);
|
|
47
|
+
var theme = (0, styled_components_1.useTheme)();
|
|
48
|
+
var localize = (0, utilsOolib_1.useLocale)();
|
|
49
|
+
var _b = (0, react_1.useState)(false), isFocussed = _b[0], setIsFocussed = _b[1];
|
|
50
|
+
var handleFocus = function (bool) {
|
|
51
|
+
setIsFocussed(bool);
|
|
52
|
+
if (bool && inputRef.current)
|
|
53
|
+
inputRef.current.focus(); //focus text input
|
|
54
|
+
};
|
|
55
|
+
var blurInputOnEscKey = function (e) {
|
|
56
|
+
var code = (0, getKeyCode_1.getKeyCode)(e);
|
|
57
|
+
if (code === "Escape") {
|
|
58
|
+
inputRef.current.blur();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
(0, react_1.useEffect)(function () {
|
|
62
|
+
if (focusSelectTagsInput) {
|
|
63
|
+
//it gets initiated as 0. which means on first mount this wont run. which is what we want
|
|
64
|
+
handleFocus(true);
|
|
65
|
+
}
|
|
66
|
+
}, [focusSelectTagsInput]);
|
|
67
|
+
var genSelectedTagsTextLabel = function () {
|
|
68
|
+
var TYPO_COMP = S ? Typo_1.SANS_2 : Typo_1.SANS_3;
|
|
69
|
+
return (react_1.default.createElement("div", { style: {
|
|
70
|
+
minHeight: S ? "2rem" : "3rem",
|
|
71
|
+
display: "flex",
|
|
72
|
+
alignItems: "center",
|
|
73
|
+
} },
|
|
74
|
+
react_1.default.createElement(TYPO_COMP, { color: disabled
|
|
75
|
+
? themes_1.colors.greyColor40
|
|
76
|
+
: invert
|
|
77
|
+
? themes_1.colors.white
|
|
78
|
+
: themes_1.colors.greyColor80 }, "Selected Tags:")));
|
|
79
|
+
};
|
|
80
|
+
var genSelectComp = function () {
|
|
81
|
+
// const minHeightStyle = minHeight
|
|
82
|
+
// ? minHeight === "standard"
|
|
83
|
+
// ? "4rem"
|
|
84
|
+
// : minHeight === "wide"
|
|
85
|
+
// ? "9rem"
|
|
86
|
+
// : minHeight // else use explicit value
|
|
87
|
+
// : "9rem"; //wide by default
|
|
88
|
+
return (react_1.default.createElement(styled_2.StyledSelectTagsInputContainer, { onKeyDown: blurInputOnEscKey,
|
|
89
|
+
// style={{ minHeight: '9rem' }}
|
|
90
|
+
className: "".concat(isFocussed ? "focussed" : ""), invert: invert, disabled: disabled, onFocus: function () {
|
|
91
|
+
handleFocus(true);
|
|
92
|
+
}, onBlur: function () { return handleFocus(false); }, tabIndex: 0 },
|
|
93
|
+
react_1.default.createElement(styled_1.StyledTagsInputWrapper, null,
|
|
94
|
+
genSelectedTagsTextLabel(),
|
|
95
|
+
value &&
|
|
96
|
+
(0, toArray_1.toArray)(value).map(function (d) {
|
|
97
|
+
return (0, genTagComp_1.genTagComp)(id, d, {
|
|
98
|
+
handleSelect: handleSelect,
|
|
99
|
+
single_multi: single_multi,
|
|
100
|
+
invert: invert,
|
|
101
|
+
showOptions: showOptions,
|
|
102
|
+
theme: theme,
|
|
103
|
+
S: S
|
|
104
|
+
});
|
|
105
|
+
}),
|
|
106
|
+
// isCombobox ? (
|
|
107
|
+
react_1.default.createElement(styled_2.StyledTagsSelectTextInput, { ref: inputRef, className: S ? "SANS_2" : "SANS_3", style: { color: invert ? themes_1.colors.white : themes_1.colors.greyColor100 }, placeholder: localize(placeholder || "Type to Search"), type: "text", value: searchString, onBlur: function () {
|
|
108
|
+
return setFocusSelectTagsInput && setFocusSelectTagsInput(false);
|
|
109
|
+
}, onChange: function (e) { return setSearchString(e.target.value); } }))));
|
|
110
|
+
};
|
|
111
|
+
return genSelectComp();
|
|
112
|
+
};
|
|
113
|
+
exports.SelectTagsInput = SelectTagsInput;
|
|
@@ -0,0 +1,54 @@
|
|
|
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 (mod) {
|
|
23
|
+
if (mod && mod.__esModule) return mod;
|
|
24
|
+
var result = {};
|
|
25
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
+
__setModuleDefault(result, mod);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.StyledSelectTagsInputContainer = exports.StyledTagsSelectTextInput = void 0;
|
|
31
|
+
var styled_components_1 = __importStar(require("styled-components"));
|
|
32
|
+
var themes_1 = require("../../../../themes");
|
|
33
|
+
var mixins_1 = require("../../../../themes/mixins");
|
|
34
|
+
var utilsOolib_1 = require("../../../../utilsOolib");
|
|
35
|
+
exports.StyledTagsSelectTextInput = styled_components_1.default.input(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 100%;\n border: 0;\n width: 100%;\n background-color: ", ";\n \n // this strange bit is to fix the 'zoom into input' issue on ios\n margin: 0 -2rem;\n padding: 0 2rem;\n\n &:focus {\n border: 0;\n }\n\n &::placeholder {\n color: ", ";\n }\n"], ["\n height: 100%;\n border: 0;\n width: 100%;\n background-color: ", ";\n \n // this strange bit is to fix the 'zoom into input' issue on ios\n margin: 0 -2rem;\n padding: 0 2rem;\n\n &:focus {\n border: 0;\n }\n\n &::placeholder {\n color: ", ";\n }\n"])), themes_1.colors.none, themes_1.colors.greyColor40);
|
|
36
|
+
exports.StyledSelectTagsInputContainer = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n cursor: pointer;\n position: relative;\n border-radius: 2px;\n background-color: ", ";\n padding: 1rem 2rem 1rem 2rem;\n ", "\n\n ", ";\n\n &::after {\n content: \"\";\n position: absolute;\n width: 0;\n height: 2px;\n bottom: 0;\n left: 0;\n background-color: ", ";\n ", ";\n }\n\n &:hover {\n background-color: ", ";\n }\n\n &.focussed {\n background-color: ", ";\n &::after {\n width: 100%;\n }\n }\n\n height: auto;\n align-items: flex-start;\n"], ["\n cursor: pointer;\n position: relative;\n border-radius: 2px;\n background-color: ", ";\n padding: 1rem 2rem 1rem 2rem;\n ", "\n\n ", ";\n\n &::after {\n content: \"\";\n position: absolute;\n width: 0;\n height: 2px;\n bottom: 0;\n left: 0;\n background-color: ", ";\n ", ";\n }\n\n &:hover {\n background-color: ", ";\n }\n\n &.focussed {\n background-color: ", ";\n &::after {\n width: 100%;\n }\n }\n\n height: auto;\n align-items: flex-start;\n"])), function (_a) {
|
|
37
|
+
var invert = _a.invert;
|
|
38
|
+
return invert ? themes_1.colors.greyColor80 : themes_1.colors.greyColor5;
|
|
39
|
+
}, function (_a) {
|
|
40
|
+
var disabled = _a.disabled;
|
|
41
|
+
return disabled && (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n pointer-events: none;\n "], ["\n pointer-events: none;\n "])));
|
|
42
|
+
}, (0, mixins_1.transition)("background-color"), function (_a) {
|
|
43
|
+
var theme = _a.theme, invert = _a.invert;
|
|
44
|
+
return invert
|
|
45
|
+
? (0, utilsOolib_1.getPrimaryColor40)(theme === null || theme === void 0 ? void 0 : theme.colors)
|
|
46
|
+
: (0, utilsOolib_1.getPrimaryColor100)(theme === null || theme === void 0 ? void 0 : theme.colors);
|
|
47
|
+
}, (0, mixins_1.transition)("width"), function (_a) {
|
|
48
|
+
var invert = _a.invert;
|
|
49
|
+
return invert ? themes_1.colors.greyColor70 : themes_1.colors.greyColor10;
|
|
50
|
+
}, function (_a) {
|
|
51
|
+
var invert = _a.invert;
|
|
52
|
+
return invert ? themes_1.colors.greyColor70 : themes_1.colors.greyColor10;
|
|
53
|
+
});
|
|
54
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function handleSelect_MULTI({ parentOnChange, id, prevVal, newVal, saveValueAsString, }: {
|
|
2
|
+
parentOnChange: any;
|
|
3
|
+
id: any;
|
|
4
|
+
prevVal: any;
|
|
5
|
+
newVal: any;
|
|
6
|
+
saveValueAsString: any;
|
|
7
|
+
}): void;
|
|
8
|
+
export function handleSelect_SINGLE({ parentOnChange, handleHideOptions, id, newVal, prevVal, saveValueAsString }: {
|
|
9
|
+
parentOnChange: any;
|
|
10
|
+
handleHideOptions: any;
|
|
11
|
+
id: any;
|
|
12
|
+
newVal: any;
|
|
13
|
+
prevVal: any;
|
|
14
|
+
saveValueAsString: any;
|
|
15
|
+
}): void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.handleSelect_SINGLE = exports.handleSelect_MULTI = void 0;
|
|
13
|
+
var handleSelect_MULTI = function (_a) {
|
|
14
|
+
var parentOnChange = _a.parentOnChange, id = _a.id, prevVal = _a.prevVal, newVal = _a.newVal,
|
|
15
|
+
// hideShowOtherTextInputOnSelect_MULTI,
|
|
16
|
+
saveValueAsString = _a.saveValueAsString;
|
|
17
|
+
var shouldDeselect = prevVal && prevVal.some(function (d) { return d.value === newVal.value; }); //if value already exists in the selected array, then we should deselect
|
|
18
|
+
var newValue = shouldDeselect
|
|
19
|
+
? prevVal.filter(function (d) { return d.value !== newVal.value; })
|
|
20
|
+
: __spreadArray(__spreadArray([], (prevVal || []) /*prevVal*/, true), [newVal], false);
|
|
21
|
+
// hideShowOtherTextInputOnSelect_MULTI({
|
|
22
|
+
// newVal: newValue,
|
|
23
|
+
// prevVal: prevVal,
|
|
24
|
+
// });
|
|
25
|
+
var newValForParent = saveValueAsString ? newValue.map(function (d) { return d.value; }) : newValue;
|
|
26
|
+
parentOnChange && parentOnChange(id, newValForParent);
|
|
27
|
+
// setForceSelectFocus && setForceSelectFocus(prev => prev+1)
|
|
28
|
+
};
|
|
29
|
+
exports.handleSelect_MULTI = handleSelect_MULTI;
|
|
30
|
+
var handleSelect_SINGLE = function (_a) {
|
|
31
|
+
var parentOnChange = _a.parentOnChange,
|
|
32
|
+
// hideShowOtherTextInputOnSelect_SINGLE,
|
|
33
|
+
handleHideOptions = _a.handleHideOptions, id = _a.id, newVal = _a.newVal, prevVal = _a.prevVal, saveValueAsString = _a.saveValueAsString;
|
|
34
|
+
/**
|
|
35
|
+
* this enables removing the selected option, if clicked on again
|
|
36
|
+
* but disabled for now, cuz deselecting was causing all sorts of sideeffects on the platform
|
|
37
|
+
*/
|
|
38
|
+
// let valueToSet = newVal?.value === prevVal?.value
|
|
39
|
+
// ? undefined
|
|
40
|
+
// : newVal
|
|
41
|
+
var valueToSet = newVal;
|
|
42
|
+
// hideShowOtherTextInputOnSelect_SINGLE({
|
|
43
|
+
// prevVal,
|
|
44
|
+
// newVal : valueToSet
|
|
45
|
+
// });
|
|
46
|
+
parentOnChange &&
|
|
47
|
+
parentOnChange(id, saveValueAsString ? valueToSet === null || valueToSet === void 0 ? void 0 : valueToSet.value : valueToSet);
|
|
48
|
+
handleHideOptions();
|
|
49
|
+
};
|
|
50
|
+
exports.handleSelect_SINGLE = handleSelect_SINGLE;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 (mod) {
|
|
23
|
+
if (mod && mod.__esModule) return mod;
|
|
24
|
+
var result = {};
|
|
25
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
+
__setModuleDefault(result, mod);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.StyledTagsInputWrapper = exports.StyledDropdownRefWrapper = void 0;
|
|
31
|
+
var styled_components_1 = __importStar(require("styled-components"));
|
|
32
|
+
var themes_1 = require("../../themes");
|
|
33
|
+
exports.StyledDropdownRefWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\nposition: relative;\n user-select: none;\n"], ["\nposition: relative;\n user-select: none;\n"])));
|
|
34
|
+
exports.StyledTagsInputWrapper = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n height: 100%;\n gap: 1rem;\n ", "\n"], ["\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n height: 100%;\n gap: 1rem;\n ", "\n"])), function (_a) {
|
|
35
|
+
var input_display = _a.input_display;
|
|
36
|
+
return input_display === 'input'
|
|
37
|
+
? (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n max-width: calc(100vw - 10rem); //2+2 for page container padding on mob & 2+4 for the select elem padding\n "], ["\n background-color: ", ";\n max-width: calc(100vw - 10rem); //2+2 for page container padding on mob & 2+4 for the select elem padding\n "])), themes_1.colors.white) : (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\n "], ["\n\n "])));
|
|
38
|
+
});
|
|
39
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function genIcon(icon: any): any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.genIcon = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var icons_1 = require("../../../icons");
|
|
9
|
+
var genIcon = function (icon) {
|
|
10
|
+
if (!icon)
|
|
11
|
+
return null;
|
|
12
|
+
var IconComp = icons_1.icons[icon];
|
|
13
|
+
if (!IconComp)
|
|
14
|
+
return null;
|
|
15
|
+
return react_1.default.createElement(IconComp, { size: 20 });
|
|
16
|
+
};
|
|
17
|
+
exports.genIcon = genIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function genLinkOrText(value: any, cb?: any, options?: {}): any;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genLinkOrText = void 0;
|
|
4
|
+
var genLinkOrText = function (value, cb, options) {
|
|
5
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6
|
+
if (cb === void 0) { cb = undefined; }
|
|
7
|
+
if (options === void 0) { options = {}; }
|
|
8
|
+
if ((!value.data ||
|
|
9
|
+
!value.data._id ||
|
|
10
|
+
(!((_a = value.data.meta) === null || _a === void 0 ? void 0 : _a.content_type) &&
|
|
11
|
+
!((_b = value.data.meta) === null || _b === void 0 ? void 0 : _b.profile_type) &&
|
|
12
|
+
!((_c = value.data) === null || _c === void 0 ? void 0 : _c.profileType) /**from the user data object */)) && !value.tagId && ['userTags', 'contentTags'].indexOf(value.tagCategory) === -1 // AND its not even a tag v3 type of data then...
|
|
13
|
+
) {
|
|
14
|
+
return cb ? cb(value.display) : { link: undefined };
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
var link = "";
|
|
18
|
+
// create links for content types
|
|
19
|
+
if ((_e = (_d = value.data) === null || _d === void 0 ? void 0 : _d.meta) === null || _e === void 0 ? void 0 : _e.content_type) {
|
|
20
|
+
var _k = value.data, content_type = _k.meta.content_type, _id = _k._id;
|
|
21
|
+
link = "/published-page/".concat(content_type, "?id=").concat(_id);
|
|
22
|
+
}
|
|
23
|
+
// create links for profiles
|
|
24
|
+
else if (((_g = (_f = value.data) === null || _f === void 0 ? void 0 : _f.meta) === null || _g === void 0 ? void 0 : _g.profile_type) || ((_h = value.data) === null || _h === void 0 ? void 0 : _h.profileType)) {
|
|
25
|
+
var profileType = ((_j = value.data.meta) === null || _j === void 0 ? void 0 : _j.profile_type) || value.data.profileType;
|
|
26
|
+
var _l = value.data, user = _l.user, _id = _l._id;
|
|
27
|
+
link = "/profile/userProfiles/".concat(profileType, "/").concat((user === null || user === void 0 ? void 0 : user._id) || _id);
|
|
28
|
+
}
|
|
29
|
+
// create links for tags
|
|
30
|
+
else if (value.tagId &&
|
|
31
|
+
value.tagCategory !== 'userTags' &&
|
|
32
|
+
value.tagCategory !== 'contentTags') {
|
|
33
|
+
// link = `/tags/${value.tagType}/${value.tagId}`
|
|
34
|
+
link = undefined; //temp hack, cuz we dont want to do redirects to tag listing page (since old tagType implementation will be deprecated)
|
|
35
|
+
}
|
|
36
|
+
// create links for user tags
|
|
37
|
+
else if (value.tagCategory === 'userTags') {
|
|
38
|
+
link = "/profile/userProfiles/".concat(value.tagType || value.profileType, "/").concat(value._id);
|
|
39
|
+
}
|
|
40
|
+
//create links for content tags
|
|
41
|
+
else if (value.tagCategory === 'contentTags') {
|
|
42
|
+
//i think value.tagType is redundant, but will have to check
|
|
43
|
+
link = "/published-page/".concat(value.tagType || value.meta.kp_content_type, "?id=").concat(value._id);
|
|
44
|
+
}
|
|
45
|
+
return cb ? (cb(value.display, link)) : ({ link: link });
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.genLinkOrText = genLinkOrText;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.renderImagePlaceholderForOolibPreview = exports.genProfileImg = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var themes_1 = require("../../../themes");
|
|
9
|
+
var Tooltip_1 = require("../../Tooltip");
|
|
10
|
+
var phosphor_react_1 = require("phosphor-react");
|
|
11
|
+
var genProfileImg = function (_a) {
|
|
12
|
+
var image = _a.image, display = _a.display, invert = _a.invert, theme = _a.theme;
|
|
13
|
+
if (image) {
|
|
14
|
+
if (!(theme === null || theme === void 0 ? void 0 : theme.ProfileImageDisplay)) {
|
|
15
|
+
return (0, exports.renderImagePlaceholderForOolibPreview)();
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
var ProfileImageDisplay = theme.ProfileImageDisplay;
|
|
19
|
+
return (react_1.default.createElement("div", { style: { flex: "0 0 auto" } },
|
|
20
|
+
react_1.default.createElement(ProfileImageDisplay, { value: image, imageTitle: display, size: 20, invert: invert })));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.genProfileImg = genProfileImg;
|
|
25
|
+
var renderImagePlaceholderForOolibPreview = function () { return react_1.default.createElement(Tooltip_1.Tooltip, { position: "bottom", text: "ProfileImageDisplay component needs to be provided via theme provider in order to render profile image", children: react_1.default.createElement("div", { style: {
|
|
26
|
+
width: "2rem",
|
|
27
|
+
height: "2rem",
|
|
28
|
+
borderRadius: "50%",
|
|
29
|
+
background: themes_1.colors.lightRed,
|
|
30
|
+
display: 'flex',
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
flex: "0 0 auto"
|
|
34
|
+
} },
|
|
35
|
+
react_1.default.createElement(phosphor_react_1.Info, { size: 16 })) }); };
|
|
36
|
+
exports.renderImagePlaceholderForOolibPreview = renderImagePlaceholderForOolibPreview;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function genTagComp(id: any, d: any, options?: {}): any;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.genTagComp = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var Tags_1 = require("../../Tags");
|
|
9
|
+
var genLinkOrText_1 = require("./genLinkOrText");
|
|
10
|
+
var genTagComp = function (id, d, options) {
|
|
11
|
+
if (options === void 0) { options = {}; }
|
|
12
|
+
var link = (0, genLinkOrText_1.genLinkOrText)(d).link;
|
|
13
|
+
var showOptions = options.showOptions;
|
|
14
|
+
switch (true) {
|
|
15
|
+
case !options.display:
|
|
16
|
+
return (react_1.default.createElement("div", { tabIndex: 0, onFocus: function (e) { return !showOptions && e.stopPropagation(); } },
|
|
17
|
+
react_1.default.createElement(Tags_1.TagClear, { XS: options.S, grey: true, invert: options.invert, display: d.display, onClick: function (e) {
|
|
18
|
+
e.stopPropagation();
|
|
19
|
+
options.handleSelect(options.single_multi === "single" ? undefined : d);
|
|
20
|
+
} })));
|
|
21
|
+
case !!link:
|
|
22
|
+
return react_1.default.createElement(Tags_1.TagLink, { XS: options.S, invert: options.invert, to: link, display: d.display });
|
|
23
|
+
default:
|
|
24
|
+
return react_1.default.createElement(Tags_1.TagDisplay, { XS: options.S, invert: options.invert, display: d.display });
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.genTagComp = genTagComp;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateOptions = void 0;
|
|
4
|
+
var getAllOptionsFns_1 = require("./getAllOptionsFns");
|
|
5
|
+
var generateOptions = function (_a) {
|
|
6
|
+
var _b;
|
|
7
|
+
var options = _a.options, optionsFn = _a.optionsFn, theme = _a.theme /*injectOtherOption*/;
|
|
8
|
+
switch (true) {
|
|
9
|
+
case !!options:
|
|
10
|
+
return options;
|
|
11
|
+
// let otherOp = { display: "Other", value: "other" };
|
|
12
|
+
// return injectOtherOption ? [...options, otherOp] : options;
|
|
13
|
+
case !!optionsFn:
|
|
14
|
+
return (_b = (0, getAllOptionsFns_1.getAllOptionsFns)(theme))[optionsFn.fn].apply(_b, (optionsFn.args || []));
|
|
15
|
+
default:
|
|
16
|
+
return [{ display: "Options Undefined", value: "undefined" }];
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.generateOptions = generateOptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function genMonthsArray(nameLength: any): any;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genMonthsArray = void 0;
|
|
4
|
+
var genMonthsArray = function (nameLength) {
|
|
5
|
+
var form = {
|
|
6
|
+
long: [
|
|
7
|
+
"January",
|
|
8
|
+
"February",
|
|
9
|
+
"March",
|
|
10
|
+
"April",
|
|
11
|
+
"May",
|
|
12
|
+
"June",
|
|
13
|
+
"July",
|
|
14
|
+
"August",
|
|
15
|
+
"September",
|
|
16
|
+
"October",
|
|
17
|
+
"November",
|
|
18
|
+
"December",
|
|
19
|
+
],
|
|
20
|
+
short: [
|
|
21
|
+
"Jan",
|
|
22
|
+
"Feb",
|
|
23
|
+
"Mar",
|
|
24
|
+
"Apr",
|
|
25
|
+
"May",
|
|
26
|
+
"Jun",
|
|
27
|
+
"Jul",
|
|
28
|
+
"Aug",
|
|
29
|
+
"Sep",
|
|
30
|
+
"Oct",
|
|
31
|
+
"Nov",
|
|
32
|
+
"Dec",
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
var monthsAry = form[nameLength].map(function (d) {
|
|
36
|
+
return { display: d, value: d.toLowerCase() };
|
|
37
|
+
});
|
|
38
|
+
return monthsAry;
|
|
39
|
+
};
|
|
40
|
+
exports.genMonthsArray = genMonthsArray;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genYearsArray = void 0;
|
|
4
|
+
var genYearsArray = function (fromYr, toYr) {
|
|
5
|
+
var yrsAry = [];
|
|
6
|
+
for (var i = fromYr; i <= toYr; i++) {
|
|
7
|
+
yrsAry.unshift(i.toString());
|
|
8
|
+
}
|
|
9
|
+
return yrsAry.map(function (d) { return ({ display: d, value: d }); });
|
|
10
|
+
};
|
|
11
|
+
exports.genYearsArray = genYearsArray;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLanguagesArray = void 0;
|
|
4
|
+
var getLanguagesArray = function () { return [
|
|
5
|
+
{
|
|
6
|
+
"value": "as",
|
|
7
|
+
"display": "Assamese"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"value": "bn",
|
|
11
|
+
"display": "Bengali"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"value": "en",
|
|
15
|
+
"display": "English"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"value": "gu",
|
|
19
|
+
"display": "Gujarati"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"value": "hi",
|
|
23
|
+
"display": "Hindi"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"value": "kn",
|
|
27
|
+
"display": "Kannada"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"value": "ml",
|
|
31
|
+
"display": "Malayalam"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"value": "mr",
|
|
35
|
+
"display": "Marathi"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"value": "or",
|
|
39
|
+
"display": "Odiya"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"value": "pa",
|
|
43
|
+
"display": "Punjabi"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"value": "sd",
|
|
47
|
+
"display": "Sindhi"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"value": "ta",
|
|
51
|
+
"display": "Tamil"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"value": "te",
|
|
55
|
+
"display": "Telugu"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"value": "ur",
|
|
59
|
+
"display": "Urdu"
|
|
60
|
+
}
|
|
61
|
+
]; };
|
|
62
|
+
exports.getLanguagesArray = getLanguagesArray;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getAllOptionsFns(theme: any): any;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.getAllOptionsFns = void 0;
|
|
15
|
+
var genMonthsArray_1 = require("./genMonthsArray");
|
|
16
|
+
var genYearsArray_1 = require("./genYearsArray");
|
|
17
|
+
var getLanguagesArray_1 = require("./getLanguagesArray");
|
|
18
|
+
var getAllOptionsFns = function (theme) { return (__assign({ genYearsArray: genYearsArray_1.genYearsArray, genMonthsArray: genMonthsArray_1.genMonthsArray, getLanguagesArray: getLanguagesArray_1.getLanguagesArray }, ((theme === null || theme === void 0 ? void 0 : theme.optionsFns) || {}))); };
|
|
19
|
+
exports.getAllOptionsFns = getAllOptionsFns;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function getValue_SINGLE({ valueProp, optionsFn, options, theme }: {
|
|
2
|
+
valueProp: any;
|
|
3
|
+
optionsFn: any;
|
|
4
|
+
options: any;
|
|
5
|
+
theme: any;
|
|
6
|
+
}): any;
|
|
7
|
+
export function getValue_MULTI({ valueProp, optionsFn, options, theme }: {
|
|
8
|
+
valueProp: any;
|
|
9
|
+
optionsFn: any;
|
|
10
|
+
options: any;
|
|
11
|
+
theme: any;
|
|
12
|
+
}): any;
|