oolib 2.208.0 → 2.208.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DateRangePicker/index.js +2 -2
- package/dist/components/GroupQuestionsInputSingle/index.js +2 -2
- package/dist/components/IFrameInput/index.js +1 -1
- package/dist/components/ImageInput/comps/Placeholder/index.js +1 -1
- package/dist/components/SimpleTable/index.js +2 -2
- package/dist/components/VideoInput/comps/EmbedLinkModal.js +1 -1
- package/dist/components/cards/ListProfile/index.js +1 -1
- package/dist/index.d.ts +8 -9
- package/dist/index.js +25 -33
- package/dist/stories/Oolib/components/Modal.stories.js +2 -2
- package/dist/stories/Oolib/components/TagsInput.stories.js +1 -1
- package/dist/v2/components/DateRangePicker/index.js +1 -2
- package/dist/v2/components/Dropdowns/comps/SelectDropdown/styled.js +1 -1
- package/dist/v2/components/TabBar/index.js +3 -3
- package/dist/v2/components/TextInputs/index.js +0 -7
- package/dist/v2/components/TextInputs/index.styled.js +1 -1
- package/package.json +1 -1
- package/dist/components/BlockLabel/index.d.ts +0 -2
- package/dist/components/BlockLabel/index.js +0 -75
- package/dist/components/BlockLabel/index.styled.d.ts +0 -2
- package/dist/components/BlockLabel/index.styled.js +0 -14
- package/dist/components/Dropdowns/DropdownMulti/index.d.ts +0 -38
- package/dist/components/Dropdowns/DropdownMulti/index.js +0 -179
- package/dist/components/Dropdowns/DropdownSingle/index.d.ts +0 -40
- package/dist/components/Dropdowns/DropdownSingle/index.js +0 -163
- package/dist/components/Dropdowns/comps/Caret/index.d.ts +0 -6
- package/dist/components/Dropdowns/comps/Caret/index.js +0 -19
- package/dist/components/Dropdowns/comps/Caret/styled.d.ts +0 -2
- package/dist/components/Dropdowns/comps/Caret/styled.js +0 -14
- package/dist/components/Dropdowns/comps/DisplayCompSingle/index.d.ts +0 -7
- package/dist/components/Dropdowns/comps/DisplayCompSingle/index.js +0 -39
- package/dist/components/Dropdowns/comps/NoOptionResultsComp/index.d.ts +0 -4
- package/dist/components/Dropdowns/comps/NoOptionResultsComp/index.js +0 -15
- package/dist/components/Dropdowns/comps/OptionContent/index.d.ts +0 -8
- package/dist/components/Dropdowns/comps/OptionContent/index.js +0 -34
- package/dist/components/Dropdowns/comps/OptionsMulti/index.d.ts +0 -28
- package/dist/components/Dropdowns/comps/OptionsMulti/index.js +0 -159
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/index.d.ts +0 -14
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/index.js +0 -81
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/styled.d.ts +0 -2
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/styled.js +0 -25
- package/dist/components/Dropdowns/comps/OptionsShell/index.d.ts +0 -2
- package/dist/components/Dropdowns/comps/OptionsShell/index.js +0 -101
- package/dist/components/Dropdowns/comps/OptionsShell/styled.d.ts +0 -5
- package/dist/components/Dropdowns/comps/OptionsShell/styled.js +0 -45
- package/dist/components/Dropdowns/comps/OptionsSingle/index.d.ts +0 -28
- package/dist/components/Dropdowns/comps/OptionsSingle/index.js +0 -105
- package/dist/components/Dropdowns/comps/OptionsSingle/styled.d.ts +0 -1
- package/dist/components/Dropdowns/comps/OptionsSingle/styled.js +0 -61
- package/dist/components/Dropdowns/comps/SelectDropdown/index.d.ts +0 -13
- package/dist/components/Dropdowns/comps/SelectDropdown/index.js +0 -54
- package/dist/components/Dropdowns/comps/SelectDropdown/styled.d.ts +0 -1
- package/dist/components/Dropdowns/comps/SelectDropdown/styled.js +0 -71
- package/dist/components/Dropdowns/comps/SelectTagsInput/index.d.ts +0 -18
- package/dist/components/Dropdowns/comps/SelectTagsInput/index.js +0 -124
- package/dist/components/Dropdowns/comps/SelectTagsInput/styled.d.ts +0 -2
- package/dist/components/Dropdowns/comps/SelectTagsInput/styled.js +0 -54
- package/dist/components/Dropdowns/handlers/index.d.ts +0 -14
- package/dist/components/Dropdowns/handlers/index.js +0 -52
- package/dist/components/Dropdowns/styled.d.ts +0 -2
- package/dist/components/Dropdowns/styled.js +0 -49
- package/dist/components/Dropdowns/utils/genColor.d.ts +0 -4
- package/dist/components/Dropdowns/utils/genColor.js +0 -15
- package/dist/components/Dropdowns/utils/genIcon.d.ts +0 -6
- package/dist/components/Dropdowns/utils/genIcon.js +0 -18
- package/dist/components/Dropdowns/utils/genLinkOrText.d.ts +0 -1
- package/dist/components/Dropdowns/utils/genLinkOrText.js +0 -48
- package/dist/components/Dropdowns/utils/genProfileImg.d.ts +0 -6
- package/dist/components/Dropdowns/utils/genProfileImg.js +0 -14
- package/dist/components/Dropdowns/utils/genTagComp.d.ts +0 -2
- package/dist/components/Dropdowns/utils/genTagComp.js +0 -27
- package/dist/components/Dropdowns/utils/generateOptions.d.ts +0 -5
- package/dist/components/Dropdowns/utils/generateOptions.js +0 -20
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genMonthsArray.d.ts +0 -1
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genMonthsArray.js +0 -40
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genYearsArray.d.ts +0 -4
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genYearsArray.js +0 -11
- package/dist/components/Dropdowns/utils/getAllOptionsFns/getLanguagesArray.d.ts +0 -4
- package/dist/components/Dropdowns/utils/getAllOptionsFns/getLanguagesArray.js +0 -62
- package/dist/components/Dropdowns/utils/getAllOptionsFns/index.d.ts +0 -1
- package/dist/components/Dropdowns/utils/getAllOptionsFns/index.js +0 -19
- package/dist/components/Dropdowns/utils/getValue.d.ts +0 -14
- package/dist/components/Dropdowns/utils/getValue.js +0 -32
- package/dist/components/Dropdowns/utils/isDynamicOtherOption.d.ts +0 -0
- package/dist/components/Dropdowns/utils/isDynamicOtherOption.js +0 -0
- package/dist/components/Dropdowns/utils/keywordSearchOptions.d.ts +0 -6
- package/dist/components/Dropdowns/utils/keywordSearchOptions.js +0 -18
- package/dist/components/Dropdowns/utils/setDropdownSelectText.d.ts +0 -12
- package/dist/components/Dropdowns/utils/setDropdownSelectText.js +0 -19
- package/dist/components/Dropdowns/utils/useCreateDropdownRefs.d.ts +0 -5
- package/dist/components/Dropdowns/utils/useCreateDropdownRefs.js +0 -15
- package/dist/components/Dropdowns/utils/useHideShowOptions.d.ts +0 -5
- package/dist/components/Dropdowns/utils/useHideShowOptions.js +0 -20
- package/dist/components/Dropdowns/utils/useKeyboardControl.d.ts +0 -12
- package/dist/components/Dropdowns/utils/useKeyboardControl.js +0 -73
- package/dist/components/Dropdowns/utils/useSearchString.d.ts +0 -4
- package/dist/components/Dropdowns/utils/useSearchString.js +0 -20
- package/dist/components/Dropdowns/utils/useSetYOrientation.d.ts +0 -9
- package/dist/components/Dropdowns/utils/useSetYOrientation.js +0 -46
- package/dist/components/Hints/contextApi.d.ts +0 -6
- package/dist/components/Hints/contextApi.js +0 -48
- package/dist/components/Hints/index.d.ts +0 -9
- package/dist/components/Hints/index.js +0 -127
- package/dist/components/Hints/styled.d.ts +0 -6
- package/dist/components/Hints/styled.js +0 -54
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/index.d.ts +0 -11
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/index.js +0 -30
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/styled.d.ts +0 -1
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/styled.js +0 -70
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.d.ts +0 -11
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.js +0 -50
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/index.d.ts +0 -20
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/index.js +0 -124
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/styled.d.ts +0 -2
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/styled.js +0 -17
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.d.ts +0 -18
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.js +0 -53
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.d.ts +0 -2
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.js +0 -84
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/index.d.ts +0 -1
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/index.js +0 -6
- package/dist/components/RadioAndCheckbox/comps/RadioList/index.d.ts +0 -17
- package/dist/components/RadioAndCheckbox/comps/RadioList/index.js +0 -109
- package/dist/components/RadioAndCheckbox/index.d.ts +0 -5
- package/dist/components/RadioAndCheckbox/index.js +0 -14
- package/dist/components/RadioAndCheckbox/styled.d.ts +0 -5
- package/dist/components/RadioAndCheckbox/styled.js +0 -84
- package/dist/components/RadioAndCheckbox/utils.d.ts +0 -22
- package/dist/components/RadioAndCheckbox/utils.js +0 -49
- package/dist/components/Switches/index.d.ts +0 -21
- package/dist/components/Switches/index.js +0 -102
- package/dist/components/Switches/styled.d.ts +0 -5
- package/dist/components/Switches/styled.js +0 -63
- package/dist/components/TextInputs/index.d.ts +0 -24
- package/dist/components/TextInputs/index.js +0 -367
- package/dist/components/TextInputs/index.styled.d.ts +0 -3
- package/dist/components/TextInputs/index.styled.js +0 -77
- package/dist/components/cards/CardContent/index.d.ts +0 -11
- package/dist/components/cards/CardContent/index.js +0 -76
- package/dist/components/cards/CardContent/styled.d.ts +0 -7
- package/dist/components/cards/CardContent/styled.js +0 -63
- package/dist/components/cards/ListContent/index.d.ts +0 -12
- package/dist/components/cards/ListContent/index.js +0 -87
- package/dist/components/cards/ListContent/styled.d.ts +0 -7
- package/dist/components/cards/ListContent/styled.js +0 -26
- package/dist/stories/Oolib/components/BlockLabel.stories.d.ts +0 -71
- package/dist/stories/Oolib/components/BlockLabel.stories.js +0 -106
- package/dist/stories/Oolib/components/Checkbox.stories.d.ts +0 -248
- package/dist/stories/Oolib/components/Checkbox.stories.js +0 -249
- package/dist/stories/Oolib/components/Dropdowns.stories.d.ts +0 -127
- package/dist/stories/Oolib/components/Dropdowns.stories.js +0 -298
- package/dist/stories/Oolib/components/RadioButton.stories.d.ts +0 -260
- package/dist/stories/Oolib/components/RadioButton.stories.js +0 -264
- package/dist/stories/Oolib/components/Switches.stories.d.ts +0 -106
- package/dist/stories/Oolib/components/Switches.stories.js +0 -146
- package/dist/stories/Oolib/components/TextInputs.stories.d.ts +0 -124
- package/dist/stories/Oolib/components/TextInputs.stories.js +0 -188
|
@@ -1,159 +0,0 @@
|
|
|
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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.OptionsMulti = void 0;
|
|
37
|
-
var react_1 = __importStar(require("react"));
|
|
38
|
-
var OptionsShell_1 = require("../OptionsShell");
|
|
39
|
-
var colors_1 = require("../../../../themes/colors");
|
|
40
|
-
var useSetYOrientation_1 = require("../../utils/useSetYOrientation");
|
|
41
|
-
var useKeyboardControl_1 = require("../../utils/useKeyboardControl");
|
|
42
|
-
var NoOptionResultsComp_1 = require("../NoOptionResultsComp");
|
|
43
|
-
var OptionContent_1 = require("../OptionContent");
|
|
44
|
-
var styled_1 = require("../OptionsSingle/styled");
|
|
45
|
-
var CheckboxButton_1 = require("../../../RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton");
|
|
46
|
-
var Divider_1 = require("../../../Divider");
|
|
47
|
-
var TextInputs_1 = require("../../../TextInputs");
|
|
48
|
-
var Typo_1 = require("../../../Typo");
|
|
49
|
-
var TextLoader_1 = require("../../../LoadersAndProgress/TextLoader");
|
|
50
|
-
var greyColor40 = colors_1.colors.greyColor40, white = colors_1.colors.white;
|
|
51
|
-
var CheckboxButtonShell = function (_a) {
|
|
52
|
-
var children = _a.children, isSelected = _a.isSelected, invert = _a.invert;
|
|
53
|
-
return (react_1.default.createElement("div", { style: {
|
|
54
|
-
display: "flex",
|
|
55
|
-
alignItems: "center",
|
|
56
|
-
position: "relative",
|
|
57
|
-
} },
|
|
58
|
-
react_1.default.createElement(react_1.Fragment, null,
|
|
59
|
-
react_1.default.createElement("div", { className: "OKE-Dropdown__checkboxClickArea" }),
|
|
60
|
-
react_1.default.createElement(CheckboxButton_1.CheckboxButton, { invert: invert, isSelected: isSelected, className: "OKE-Dropdown__checkboxClickArea-box" })),
|
|
61
|
-
children));
|
|
62
|
-
};
|
|
63
|
-
var OptionsMulti = function (_a) {
|
|
64
|
-
var
|
|
65
|
-
//from root
|
|
66
|
-
lightboxHeight = _a.lightboxHeight, lightboxStyle = _a.lightboxStyle, optionsAnchor = _a.optionsAnchor, value = _a.value, id = _a.id, optionsClassName = _a.optionsClassName,
|
|
67
|
-
//from Dropdown
|
|
68
|
-
relativeToRef = _a.relativeToRef, //the element that this lightbox is being rendered against. i.e top or bottom
|
|
69
|
-
showOptions = _a.showOptions, handleHideOptions = _a.handleHideOptions, handleSelect = _a.handleSelect, options = _a.options, isSearchable = _a.isSearchable, label = _a.label, optionsModalLabel = _a.optionsModalLabel, //label is just a fallback for optionsModalLabel. Don't know why both are needed
|
|
70
|
-
searchString = _a.searchString, setSearchString = _a.setSearchString, SelectComp = _a.SelectComp, // for mobile
|
|
71
|
-
isTagsStyle = _a.isTagsStyle, genCreateTagButton = _a.genCreateTagButton, invert = _a.invert, setFocusSelectTagsInput = _a.setFocusSelectTagsInput, popOutOfOverflowHiddenParent = _a.popOutOfOverflowHiddenParent, S = _a.S, searchbarPlaceholder = _a.searchbarPlaceholder, alignDropdown = _a.alignDropdown;
|
|
72
|
-
//INIT ORIENTATION STATE AND CUSTOM HOOK
|
|
73
|
-
var optionsRef = (0, react_1.useRef)(null);
|
|
74
|
-
var yOrientation = (0, useSetYOrientation_1.useSetYOrientation)({
|
|
75
|
-
showOptions: showOptions,
|
|
76
|
-
optionsRef: optionsRef,
|
|
77
|
-
relativeToRef: relativeToRef,
|
|
78
|
-
}).yOrientation;
|
|
79
|
-
//RESET SEARCHSTRING WHEN OPTIONS ARE CLOSED
|
|
80
|
-
(0, react_1.useEffect)(function () {
|
|
81
|
-
if (!showOptions && !!searchString === true)
|
|
82
|
-
setSearchString("");
|
|
83
|
-
}, [showOptions]);
|
|
84
|
-
var selectedOptions = (0, react_1.useMemo)(function () {
|
|
85
|
-
return value || [];
|
|
86
|
-
//we need this to update on optionsProp, cuz when tag is created inTagsInputMulti
|
|
87
|
-
//opsProp changes.
|
|
88
|
-
//if we use value as dep, then this will update on every onChange, which we dont want.
|
|
89
|
-
}, [
|
|
90
|
-
// showOptions,
|
|
91
|
-
JSON.stringify(options),
|
|
92
|
-
value,
|
|
93
|
-
]);
|
|
94
|
-
var _b = (0, useKeyboardControl_1.useKeyboardControl)({
|
|
95
|
-
showOptions: showOptions,
|
|
96
|
-
optionsWrapperRef: optionsRef,
|
|
97
|
-
handleHideOptions: handleHideOptions,
|
|
98
|
-
handleSelect: handleSelect,
|
|
99
|
-
options: options,
|
|
100
|
-
searchString: searchString,
|
|
101
|
-
id: id,
|
|
102
|
-
}), scrollFocussedOpIntoView = _b.scrollFocussedOpIntoView, focussedOp = _b.focussedOp;
|
|
103
|
-
var opIsSelected = function (thisOpData) {
|
|
104
|
-
return value === null || value === void 0 ? void 0 : value.some(function (d) { return d.value === thisOpData.value; });
|
|
105
|
-
};
|
|
106
|
-
var _c = (0, react_1.useState)(true), searchBarFocus = _c[0], setSearchBarFocus = _c[1];
|
|
107
|
-
(0, react_1.useEffect)(function () {
|
|
108
|
-
setSearchBarFocus(showOptions);
|
|
109
|
-
}, [showOptions]);
|
|
110
|
-
var createOption = function (d) {
|
|
111
|
-
return isTagsStyle ? (react_1.default.createElement(OptionContent_1.OptionContent, { option: d, optionsClassName: optionsClassName, invert: invert })) : (react_1.default.createElement(CheckboxButtonShell, { invert: invert, isSelected: opIsSelected(d) },
|
|
112
|
-
react_1.default.createElement(OptionContent_1.OptionContent, { option: d, optionsClassName: optionsClassName, invert: invert, S: S })));
|
|
113
|
-
};
|
|
114
|
-
var createSelectedOptions = function () {
|
|
115
|
-
return (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 0 && (react_1.default.createElement("div", { style: {
|
|
116
|
-
borderBottom: "1px solid ".concat(greyColor40),
|
|
117
|
-
} },
|
|
118
|
-
react_1.default.createElement(Typo_1.LABEL, { invert: invert, style: { padding: "2rem", paddingBottom: 0 }, color: colors_1.colors.greyColor70 }, "selected"),
|
|
119
|
-
selectedOptions.map(function (d) {
|
|
120
|
-
return (react_1.default.createElement(styled_1.StyledOption, { invert: invert, key: d.value, isSelected: opIsSelected(d), S: S, onClick: function (e) {
|
|
121
|
-
if (!d.loading) {
|
|
122
|
-
handleSelect(d);
|
|
123
|
-
setSearchString("");
|
|
124
|
-
setSearchBarFocus(true); //refocus on searchbar after select
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
//this is important cuz if we dont, then the option will have the light blue background of the 'selected' state
|
|
128
|
-
//is a bit hacky, but will do for now.
|
|
129
|
-
style: { backgroundColor: invert ? colors_1.colors.greyColor90 : white } }, createOption(d)));
|
|
130
|
-
})));
|
|
131
|
-
};
|
|
132
|
-
var genSearchBar = function () { return (react_1.default.createElement("div", { style: {
|
|
133
|
-
position: "sticky",
|
|
134
|
-
top: 0,
|
|
135
|
-
zIndex: 1,
|
|
136
|
-
background: invert ? colors_1.colors.greyColor90 : colors_1.colors.white,
|
|
137
|
-
} },
|
|
138
|
-
react_1.default.createElement("div", { style: { padding: "1rem" }, onBlur: function () { return setSearchBarFocus(false); }, tabIndex: 0 },
|
|
139
|
-
react_1.default.createElement(TextInputs_1.TextInput, { placeholder: searchbarPlaceholder, forceFocus: searchBarFocus, invert: invert, type: "text", icon: "MagnifyingGlass", value: searchString, onChange: function (k, v) { return setSearchString(v); }, S: S })),
|
|
140
|
-
react_1.default.createElement(Divider_1.Divider, { invert: invert }))); };
|
|
141
|
-
console.log({ options: options });
|
|
142
|
-
return (react_1.default.createElement(OptionsShell_1.OptionsShell, { ref: optionsRef, yOrientation: yOrientation, lightboxHeight: lightboxHeight, lightboxStyle: lightboxStyle, options: options, optionsAnchor: optionsAnchor, showOptions: showOptions, handleHideOptions: handleHideOptions, SelectComp: SelectComp, label: label, optionsModalLabel: optionsModalLabel, invert: invert, showDoneButton: true, popOutOfOverflowHiddenParent: popOutOfOverflowHiddenParent, relativeToRef: relativeToRef, S: S, alignDropdown: alignDropdown },
|
|
143
|
-
isSearchable && genSearchBar(),
|
|
144
|
-
!isTagsStyle && createSelectedOptions(),
|
|
145
|
-
options.length === 0 ? (react_1.default.createElement(NoOptionResultsComp_1.NoOptionResultsComp, { S: S })) : (options.map(function (d, i) {
|
|
146
|
-
return (react_1.default.createElement(styled_1.StyledOption, { key: d.value, invert: invert, isSelected: opIsSelected(d), isFocussed: focussedOp === i, className: "OKE-Dropdown__option", ref: function (el) {
|
|
147
|
-
return focussedOp === i && el && scrollFocussedOpIntoView(el);
|
|
148
|
-
}, onClick: function (e) {
|
|
149
|
-
if (!d.loading) {
|
|
150
|
-
handleSelect(d);
|
|
151
|
-
setSearchBarFocus(true);
|
|
152
|
-
setSearchString("");
|
|
153
|
-
setFocusSelectTagsInput && setFocusSelectTagsInput(true);
|
|
154
|
-
}
|
|
155
|
-
}, S: S }, d.loading ? (react_1.default.createElement(TextLoader_1.TextLoader, { style: { width: "8rem", height: "1.5rem" } })) : (createOption(d))));
|
|
156
|
-
})),
|
|
157
|
-
genCreateTagButton && genCreateTagButton(options)));
|
|
158
|
-
};
|
|
159
|
-
exports.OptionsMulti = OptionsMulti;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function OptionsAnimateWrapper({ options, optionsRef, relativeToRef, showOptions, invert, yOrientation, fixPos, optionsAnchor, children, lightboxStyle, alignDropdown }: {
|
|
2
|
-
options: any;
|
|
3
|
-
optionsRef: any;
|
|
4
|
-
relativeToRef: any;
|
|
5
|
-
showOptions: any;
|
|
6
|
-
invert: any;
|
|
7
|
-
yOrientation: any;
|
|
8
|
-
fixPos: any;
|
|
9
|
-
optionsAnchor: any;
|
|
10
|
-
children: any;
|
|
11
|
-
lightboxStyle: any;
|
|
12
|
-
alignDropdown: any;
|
|
13
|
-
}): React.JSX.Element;
|
|
14
|
-
import React from "react";
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
-
var ownKeys = function(o) {
|
|
31
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
-
var ar = [];
|
|
33
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
-
return ar;
|
|
35
|
-
};
|
|
36
|
-
return ownKeys(o);
|
|
37
|
-
};
|
|
38
|
-
return function (mod) {
|
|
39
|
-
if (mod && mod.__esModule) return mod;
|
|
40
|
-
var result = {};
|
|
41
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
-
__setModuleDefault(result, mod);
|
|
43
|
-
return result;
|
|
44
|
-
};
|
|
45
|
-
})();
|
|
46
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
-
exports.OptionsAnimateWrapper = void 0;
|
|
48
|
-
var react_1 = __importStar(require("react"));
|
|
49
|
-
var styled_1 = require("./styled");
|
|
50
|
-
var OptionsAnimateWrapper = function (_a) {
|
|
51
|
-
var _b;
|
|
52
|
-
var _c;
|
|
53
|
-
var options = _a.options, optionsRef = _a.optionsRef, relativeToRef = _a.relativeToRef, showOptions = _a.showOptions, invert = _a.invert, yOrientation = _a.yOrientation, fixPos = _a.fixPos, optionsAnchor = _a.optionsAnchor, children = _a.children, lightboxStyle = _a.lightboxStyle, alignDropdown = _a.alignDropdown;
|
|
54
|
-
var selectCompRect = (_c = relativeToRef === null || relativeToRef === void 0 ? void 0 : relativeToRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
|
|
55
|
-
//we need to recalc when ops length change because, in tag comps, when loading a fixed set of 'loading' options are shown
|
|
56
|
-
//before the actual number of options are loaded
|
|
57
|
-
//useMemo wont work cuz it runs before render, and before render ref doesnt exist.
|
|
58
|
-
var _d = (0, react_1.useState)({
|
|
59
|
-
width: undefined,
|
|
60
|
-
openHeight: undefined,
|
|
61
|
-
}), _e = _d[0], width = _e.width, openHeight = _e.openHeight, setWidthAndOpenHeight = _d[1];
|
|
62
|
-
(0, react_1.useEffect)(function () {
|
|
63
|
-
var _a, _b, _c, _d;
|
|
64
|
-
setWidthAndOpenHeight({
|
|
65
|
-
width: (_b = (_a = optionsRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.width,
|
|
66
|
-
openHeight: (_d = (_c = optionsRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect()) === null || _d === void 0 ? void 0 : _d.height,
|
|
67
|
-
});
|
|
68
|
-
}, [options.length]);
|
|
69
|
-
var viewportWidth = document.documentElement.clientWidth; // excludes scrollbar
|
|
70
|
-
return (react_1.default.createElement(styled_1.StyledOptionsAnimateWrapper, { invert: invert, isOpen: showOptions, width: width, openHeight: openHeight, style: __assign(__assign(__assign({}, (lightboxStyle || {})), { zIndex: 100000 }), (fixPos
|
|
71
|
-
? __assign(__assign({ position: "fixed", top: "".concat(fixPos.y - (yOrientation === "top" ? (selectCompRect === null || selectCompRect === void 0 ? void 0 : selectCompRect.height) || 0 : 0), "px") }, (alignDropdown === "right"
|
|
72
|
-
? {
|
|
73
|
-
right: "".concat(viewportWidth - fixPos.right, "px")
|
|
74
|
-
}
|
|
75
|
-
: {
|
|
76
|
-
left: "".concat(fixPos.x, "px")
|
|
77
|
-
})), (yOrientation === "top" ? { transform: "translateY(-100%)" } : {})) : __assign(__assign({ position: "absolute" }, (optionsAnchor ? (_b = {}, _b[optionsAnchor] = 0, _b) : alignDropdown === "right" ? { right: 0 } : { left: 0 })), (yOrientation === "bottom"
|
|
78
|
-
? { bottom: 0, transform: "translateY(100%)" }
|
|
79
|
-
: { top: 0, transform: "translateY(-100%)" })))) }, children));
|
|
80
|
-
};
|
|
81
|
-
exports.OptionsAnimateWrapper = OptionsAnimateWrapper;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.StyledOptionsAnimateWrapper = void 0;
|
|
11
|
-
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
-
var globalVariables_1 = require("../../../../../../globalStyles/globalVariables");
|
|
13
|
-
var mixins_1 = require("../../../../../../themes/mixins");
|
|
14
|
-
/** for lightbox shell */
|
|
15
|
-
exports.StyledOptionsAnimateWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: ", ";\n /**\n 'else 100%' is very important. \n what this does is, on first render, it allows the optionsWrapper within to take whatever width \n its supposed to i.e max-content / 100% width of select / 36rem.\n Then on the next render (after the ref has already been attached to optionsWrapper), the proper width\n gets calculated and passed to this component.\n\n Without this 100%, this will not work > scenarios where there is enough space for the dropdown to \n stretch to the width of the select OR 36rem. Instead it will always stick to its min-width which is \n max-content\n */\n width: ", ";\n overflow: hidden;\n ", ";\n ", ";\n border-width: ", "; //hack, otherwsie this shit line shows when options are closed\n"], ["\n height: ", ";\n /**\n 'else 100%' is very important. \n what this does is, on first render, it allows the optionsWrapper within to take whatever width \n its supposed to i.e max-content / 100% width of select / 36rem.\n Then on the next render (after the ref has already been attached to optionsWrapper), the proper width\n gets calculated and passed to this component.\n\n Without this 100%, this will not work > scenarios where there is enough space for the dropdown to \n stretch to the width of the select OR 36rem. Instead it will always stick to its min-width which is \n max-content\n */\n width: ", ";\n overflow: hidden;\n ", ";\n ", ";\n border-width: ", "; //hack, otherwsie this shit line shows when options are closed\n"])), function (_a) {
|
|
16
|
-
var isOpen = _a.isOpen, openHeight = _a.openHeight;
|
|
17
|
-
return isOpen ? (openHeight ? openHeight + 'px' : 'auto') : 0;
|
|
18
|
-
}, function (_a) {
|
|
19
|
-
var width = _a.width;
|
|
20
|
-
return width ? width + 'px' : '100%';
|
|
21
|
-
}, (0, mixins_1.transition)('height', 'border-width'), globalVariables_1.globalLightboxStyle, function (_a) {
|
|
22
|
-
var isOpen = _a.isOpen;
|
|
23
|
-
return isOpen ? '1px' : 0;
|
|
24
|
-
});
|
|
25
|
-
var templateObject_1;
|
|
@@ -1,101 +0,0 @@
|
|
|
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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.OptionsShell = void 0;
|
|
37
|
-
var framer_motion_1 = require("framer-motion");
|
|
38
|
-
var react_1 = __importStar(require("react"));
|
|
39
|
-
var themes_1 = require("../../../../themes");
|
|
40
|
-
var mixins_1 = require("../../../../themes/mixins");
|
|
41
|
-
var useScreenWidth_1 = require("../../../../utils/customHooks/useScreenWidth");
|
|
42
|
-
var usePopOutOfOverflowHiddenParent_1 = require("../../../../utils/usePopOutOfOverflowHiddenParent");
|
|
43
|
-
var Buttons_1 = require("../../../Buttons");
|
|
44
|
-
var Modal_1 = require("../../../Modals/Modal");
|
|
45
|
-
var styled_1 = require("./styled");
|
|
46
|
-
var OptionsAnimateWrapper_1 = require("./comps/OptionsAnimateWrapper");
|
|
47
|
-
var styled_components_1 = require("styled-components");
|
|
48
|
-
var DefaultMobileShell = function (_a) {
|
|
49
|
-
var children = _a.children;
|
|
50
|
-
return (react_1.default.createElement("div", { style: { top: 0, left: 0, height: '100dvh', width: '100dvw', position: 'fixed', zIndex: '100000000', background: 'rgba(0,0,0,0.5)', display: 'flex', flexDirection: 'column', justifyContent: 'flex-end' } }, children));
|
|
51
|
-
};
|
|
52
|
-
exports.OptionsShell = react_1.default.forwardRef(function (_a, ref) {
|
|
53
|
-
var yOrientation = _a.yOrientation, lightboxHeight = _a.lightboxHeight, lightboxStyle = _a.lightboxStyle, options = _a.options, optionsAnchor = _a.optionsAnchor, showOptions = _a.showOptions, handleHideOptions = _a.handleHideOptions, children = _a.children, SelectComp = _a.SelectComp, label = _a.label, optionsModalLabel = _a.optionsModalLabel, invert = _a.invert, showDoneButton = _a.showDoneButton, _b = _a.popOutOfOverflowHiddenParent, popOutOfOverflowHiddenParent = _b === void 0 ? false : _b, relativeToRef = _a.relativeToRef, S = _a.S, alignDropdown = _a.alignDropdown;
|
|
54
|
-
var screenWidth = (0, useScreenWidth_1.useScreenWidth)();
|
|
55
|
-
var isDesktop = screenWidth >= (0, mixins_1.getBreakPoint)("sm");
|
|
56
|
-
var currentTheme = (0, styled_components_1.useTheme)();
|
|
57
|
-
var MobileShell = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.MobileShell) || DefaultMobileShell;
|
|
58
|
-
var _c = (0, usePopOutOfOverflowHiddenParent_1.usePopOutOfOverflowHiddenParent)(popOutOfOverflowHiddenParent), fixPos = _c.fixPos, applyFixedPos = _c.applyFixedPos, removeFixedPos = _c.removeFixedPos, trackerRef = _c.trackerRef;
|
|
59
|
-
(0, react_1.useEffect)(function () {
|
|
60
|
-
if (popOutOfOverflowHiddenParent) {
|
|
61
|
-
if (showOptions)
|
|
62
|
-
applyFixedPos();
|
|
63
|
-
else
|
|
64
|
-
removeFixedPos();
|
|
65
|
-
}
|
|
66
|
-
}, [showOptions]);
|
|
67
|
-
return isDesktop ? (react_1.default.createElement(react_1.Fragment, null,
|
|
68
|
-
popOutOfOverflowHiddenParent && react_1.default.createElement("div", { ref: trackerRef }),
|
|
69
|
-
react_1.default.createElement(OptionsAnimateWrapper_1.OptionsAnimateWrapper, { options: options, optionsRef: ref, relativeToRef: relativeToRef, showOptions: showOptions, invert: invert, yOrientation: yOrientation, fixPos: fixPos, optionsAnchor: optionsAnchor, children: children, lightboxStyle: lightboxStyle, alignDropdown: alignDropdown },
|
|
70
|
-
react_1.default.createElement(styled_1.StyledOptionsWrapper, { id: "StyledOptionsWrapper", ref: ref, invert: invert, lightboxHeight: lightboxHeight,
|
|
71
|
-
// className={className}
|
|
72
|
-
style: {
|
|
73
|
-
position: "absolute",
|
|
74
|
-
bottom: yOrientation === "top" ? undefined : 0,
|
|
75
|
-
top: yOrientation === "top" ? 0 : undefined,
|
|
76
|
-
} }, children)))) : (
|
|
77
|
-
// <AnimatePresence>
|
|
78
|
-
// {showOptions ? (
|
|
79
|
-
// <Modal
|
|
80
|
-
// fitToContentHeight
|
|
81
|
-
// title={optionsModalLabel || label}
|
|
82
|
-
// onClose={handleHideOptions}
|
|
83
|
-
// invert={invert}
|
|
84
|
-
// S={S}
|
|
85
|
-
// dynamicHeaderHeight
|
|
86
|
-
// >
|
|
87
|
-
react_1.default.createElement(react_1.Fragment, null, showOptions ? (react_1.default.createElement(MobileShell, { onClose: handleHideOptions, title: optionsModalLabel || label },
|
|
88
|
-
SelectComp && SelectComp,
|
|
89
|
-
react_1.default.createElement(styled_1.StyledModalOptionsWrapper, { invert: invert, ref: ref }, children),
|
|
90
|
-
showDoneButton && (react_1.default.createElement("div", { style: {
|
|
91
|
-
backgroundColor: invert ? themes_1.colors.greyColor90 : themes_1.colors.white,
|
|
92
|
-
padding: "1rem 2rem",
|
|
93
|
-
position: "sticky",
|
|
94
|
-
bottom: "0",
|
|
95
|
-
} },
|
|
96
|
-
react_1.default.createElement(Buttons_1.ButtonPrimary, { children: "Done", width: "100%", onClick: handleHideOptions, S: S }))))) : null)
|
|
97
|
-
// </Modal>
|
|
98
|
-
// ) : null}
|
|
99
|
-
// </AnimatePresence>
|
|
100
|
-
);
|
|
101
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/** for lightbox shell */
|
|
2
|
-
export const StyledOptionsAnimateWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export const StyledOptionsWrapper: import("styled-components").StyledComponent<"ul", any, {}, never>;
|
|
4
|
-
/** for modal shell */
|
|
5
|
-
export const StyledModalOptionsWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.StyledModalOptionsWrapper = exports.StyledOptionsWrapper = exports.StyledOptionsAnimateWrapper = void 0;
|
|
11
|
-
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
-
var themes_1 = require("../../../../themes");
|
|
13
|
-
var mixins_1 = require("../../../../themes/mixins");
|
|
14
|
-
var globalVariables_1 = require("../../../../globalStyles/globalVariables");
|
|
15
|
-
/** for lightbox shell */
|
|
16
|
-
exports.StyledOptionsAnimateWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: ", ";\n /**\n 'else 100%' is very important. \n what this does is, on first render, it allows the optionsWrapper within to take whatever width \n its supposed to i.e max-content / 100% width of select / 36rem.\n Then on the next render (after the ref has already been attached to optionsWrapper), the proper width\n gets calculated and passed to this component.\n\n Without this 100%, this will not work > scenarios where there is enough space for the dropdown to \n stretch to the width of the select OR 36rem. Instead it will always stick to its min-width which is \n max-content\n */\n width: ", ";\n overflow: hidden;\n ", ";\n ", ";\n border-width: ", "; //hack, otherwsie this shit line shows when options are closed\n"], ["\n height: ", ";\n /**\n 'else 100%' is very important. \n what this does is, on first render, it allows the optionsWrapper within to take whatever width \n its supposed to i.e max-content / 100% width of select / 36rem.\n Then on the next render (after the ref has already been attached to optionsWrapper), the proper width\n gets calculated and passed to this component.\n\n Without this 100%, this will not work > scenarios where there is enough space for the dropdown to \n stretch to the width of the select OR 36rem. Instead it will always stick to its min-width which is \n max-content\n */\n width: ", ";\n overflow: hidden;\n ", ";\n ", ";\n border-width: ", "; //hack, otherwsie this shit line shows when options are closed\n"])), function (_a) {
|
|
17
|
-
var isOpen = _a.isOpen, openHeight = _a.openHeight;
|
|
18
|
-
return isOpen ? (openHeight ? openHeight + 'px' : 'auto') : 0;
|
|
19
|
-
}, function (_a) {
|
|
20
|
-
var width = _a.width;
|
|
21
|
-
return width ? width + 'px' : '100%';
|
|
22
|
-
}, (0, mixins_1.transition)('height', 'border-width'), globalVariables_1.globalLightboxStyle, function (_a) {
|
|
23
|
-
var isOpen = _a.isOpen;
|
|
24
|
-
return isOpen ? '1px' : 0;
|
|
25
|
-
});
|
|
26
|
-
exports.StyledOptionsWrapper = styled_components_1.default.ul(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n z-index: 100000; //show remove if we do animation thing\n padding-left: 0; //cancel out the ul's padding left\n cursor: pointer;\n width: 100%;\n min-width: max-content;\n max-width: 36rem;\n overflow: auto;\n max-height: ", ";\n"], ["\n z-index: 100000; //show remove if we do animation thing\n padding-left: 0; //cancel out the ul's padding left\n cursor: pointer;\n width: 100%;\n min-width: max-content;\n max-width: 36rem;\n overflow: auto;\n max-height: ", ";\n"
|
|
27
|
-
/** for modal shell */
|
|
28
|
-
])), function (_a) {
|
|
29
|
-
var lightboxHeight = _a.lightboxHeight;
|
|
30
|
-
switch (lightboxHeight) {
|
|
31
|
-
case 'large':
|
|
32
|
-
return '33rem';
|
|
33
|
-
case 'small':
|
|
34
|
-
return '20rem';
|
|
35
|
-
case 'medium':
|
|
36
|
-
default:
|
|
37
|
-
return '24rem';
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
/** for modal shell */
|
|
41
|
-
exports.StyledModalOptionsWrapper = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n padding-left: 0;\n cursor: pointer;\n background-color: ", ";\n width: 100%;\n min-width: max-content;\n min-width: -moz-max-content;\n /* overflow: auto; */\n"], ["\n position: relative;\n padding-left: 0;\n cursor: pointer;\n background-color: ", ";\n width: 100%;\n min-width: max-content;\n min-width: -moz-max-content;\n /* overflow: auto; */\n"])), function (_a) {
|
|
42
|
-
var invert = _a.invert;
|
|
43
|
-
return invert ? themes_1.colors.greyColor90 : themes_1.colors.white;
|
|
44
|
-
});
|
|
45
|
-
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export function OptionsSingle({ lightboxHeight, lightboxStyle, optionsAnchor, value, id, optionsClassName, relativeToRef, showOptions, handleHideOptions, handleSelect, options, isSearchable, label, optionsModalLabel, searchString, setSearchString, SelectComp, genCreateTagButton, invert, popOutOfOverflowHiddenParent, enableUseSetYOrientation, S, observerRef, searchbarPlaceholder, alignDropdown }: {
|
|
2
|
-
lightboxHeight: any;
|
|
3
|
-
lightboxStyle: any;
|
|
4
|
-
optionsAnchor: any;
|
|
5
|
-
value: any;
|
|
6
|
-
id: any;
|
|
7
|
-
optionsClassName: any;
|
|
8
|
-
relativeToRef: any;
|
|
9
|
-
showOptions: any;
|
|
10
|
-
handleHideOptions: any;
|
|
11
|
-
handleSelect: any;
|
|
12
|
-
options: any;
|
|
13
|
-
isSearchable: any;
|
|
14
|
-
label: any;
|
|
15
|
-
optionsModalLabel: any;
|
|
16
|
-
searchString: any;
|
|
17
|
-
setSearchString: any;
|
|
18
|
-
SelectComp: any;
|
|
19
|
-
genCreateTagButton: any;
|
|
20
|
-
invert: any;
|
|
21
|
-
popOutOfOverflowHiddenParent: any;
|
|
22
|
-
enableUseSetYOrientation?: boolean;
|
|
23
|
-
S: any;
|
|
24
|
-
observerRef: any;
|
|
25
|
-
searchbarPlaceholder: any;
|
|
26
|
-
alignDropdown: any;
|
|
27
|
-
}): React.JSX.Element;
|
|
28
|
-
import React from "react";
|
|
@@ -1,105 +0,0 @@
|
|
|
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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.OptionsSingle = void 0;
|
|
37
|
-
var react_1 = __importStar(require("react"));
|
|
38
|
-
var NoOptionResultsComp_1 = require("../NoOptionResultsComp");
|
|
39
|
-
var OptionContent_1 = require("../OptionContent");
|
|
40
|
-
var OptionsShell_1 = require("../OptionsShell");
|
|
41
|
-
var styled_1 = require("./styled");
|
|
42
|
-
var themes_1 = require("../../../../themes");
|
|
43
|
-
var Divider_1 = require("../../../Divider");
|
|
44
|
-
var TextInputs_1 = require("../../../TextInputs");
|
|
45
|
-
var TextLoader_1 = require("../../../LoadersAndProgress/TextLoader");
|
|
46
|
-
var useKeyboardControl_1 = require("../../utils/useKeyboardControl");
|
|
47
|
-
var useSetYOrientation_1 = require("../../utils/useSetYOrientation");
|
|
48
|
-
/**
|
|
49
|
-
* if used independently, must be used inside a 'position: relative/absolute' div.
|
|
50
|
-
*/
|
|
51
|
-
var OptionsSingle = function (_a) {
|
|
52
|
-
var
|
|
53
|
-
//from root
|
|
54
|
-
lightboxHeight = _a.lightboxHeight, lightboxStyle = _a.lightboxStyle, optionsAnchor = _a.optionsAnchor, value = _a.value, id = _a.id, optionsClassName = _a.optionsClassName,
|
|
55
|
-
//from Dropdown
|
|
56
|
-
relativeToRef = _a.relativeToRef, //the element that this lightbox is being rendered against. i.e top or bottom
|
|
57
|
-
showOptions = _a.showOptions, handleHideOptions = _a.handleHideOptions, handleSelect = _a.handleSelect, options = _a.options, isSearchable = _a.isSearchable, label = _a.label, optionsModalLabel = _a.optionsModalLabel, //label is just a fallback for optionsModalLabel. Don't know why both are needed
|
|
58
|
-
searchString = _a.searchString, setSearchString = _a.setSearchString, SelectComp = _a.SelectComp, genCreateTagButton = _a.genCreateTagButton, invert = _a.invert, popOutOfOverflowHiddenParent = _a.popOutOfOverflowHiddenParent, _b = _a.enableUseSetYOrientation, enableUseSetYOrientation = _b === void 0 ? true : _b, // if using this component standalone, this should be set to false ( if relativeToRef is not being passed thru)
|
|
59
|
-
S = _a.S, observerRef = _a.observerRef, searchbarPlaceholder = _a.searchbarPlaceholder, alignDropdown = _a.alignDropdown
|
|
60
|
-
//disabled only with this is being used for the RTEEmbedLightbox. Also this might be temp.
|
|
61
|
-
//ensure this is set to false, if you are not passing a 'relativeToRef'
|
|
62
|
-
;
|
|
63
|
-
//INIT ORIENTATION STATE AND CUSTOM HOOK
|
|
64
|
-
var optionsRef = (0, react_1.useRef)(null);
|
|
65
|
-
var yOrientation = (0, useSetYOrientation_1.useSetYOrientation)({
|
|
66
|
-
showOptions: showOptions,
|
|
67
|
-
optionsRef: optionsRef,
|
|
68
|
-
relativeToRef: relativeToRef,
|
|
69
|
-
enabled: enableUseSetYOrientation,
|
|
70
|
-
}).yOrientation;
|
|
71
|
-
var _c = (0, useKeyboardControl_1.useKeyboardControl)({
|
|
72
|
-
showOptions: showOptions,
|
|
73
|
-
optionsWrapperRef: optionsRef,
|
|
74
|
-
handleHideOptions: handleHideOptions,
|
|
75
|
-
handleSelect: handleSelect,
|
|
76
|
-
options: options,
|
|
77
|
-
searchString: searchString,
|
|
78
|
-
id: id,
|
|
79
|
-
}), scrollFocussedOpIntoView = _c.scrollFocussedOpIntoView, focussedOp = _c.focussedOp;
|
|
80
|
-
var _d = (0, react_1.useState)(true), searchBarFocus = _d[0], setSearchBarFocus = _d[1];
|
|
81
|
-
(0, react_1.useEffect)(function () {
|
|
82
|
-
setSearchBarFocus(showOptions);
|
|
83
|
-
}, [showOptions]);
|
|
84
|
-
var genSearchBar = function () { return (react_1.default.createElement("div", { style: {
|
|
85
|
-
position: "sticky",
|
|
86
|
-
top: 0,
|
|
87
|
-
zIndex: 1,
|
|
88
|
-
background: invert ? themes_1.colors.greyColor90 : themes_1.colors.white,
|
|
89
|
-
} },
|
|
90
|
-
react_1.default.createElement("div", { style: { padding: "1rem" } },
|
|
91
|
-
react_1.default.createElement(TextInputs_1.TextInput, { placeholder: searchbarPlaceholder, invert: invert, forceFocus: searchBarFocus, type: "text", icon: "MagnifyingGlass", value: searchString, onChange: function (k, v) { return setSearchString(v); }, S: S })),
|
|
92
|
-
react_1.default.createElement(Divider_1.Divider, { invert: invert }))); };
|
|
93
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
94
|
-
react_1.default.createElement(OptionsShell_1.OptionsShell, { ref: optionsRef, yOrientation: yOrientation, lightboxHeight: lightboxHeight, lightboxStyle: lightboxStyle, options: options, optionsAnchor: optionsAnchor, showOptions: showOptions, SelectComp: SelectComp, handleHideOptions: handleHideOptions, label: label, optionsModalLabel: optionsModalLabel, invert: invert, relativeToRef: relativeToRef, popOutOfOverflowHiddenParent: popOutOfOverflowHiddenParent, alignDropdown: alignDropdown, S: S },
|
|
95
|
-
isSearchable && genSearchBar(),
|
|
96
|
-
options.length === 0 ? (react_1.default.createElement(NoOptionResultsComp_1.NoOptionResultsComp, { S: S })) : (react_1.default.createElement(react_1.Fragment, null, options.map(function (option, index) { return (react_1.default.createElement(styled_1.StyledOption, { key: option.value, invert: invert, isSelected: !option.loading && (value === null || value === void 0 ? void 0 : value.value) === option.value, isFocussed: focussedOp === index, className: "OKE-Dropdown__option", ref: function (el) {
|
|
97
|
-
return focussedOp === index && el && scrollFocussedOpIntoView(el);
|
|
98
|
-
}, onClick: function (e) {
|
|
99
|
-
if (!option.loading)
|
|
100
|
-
handleSelect(option);
|
|
101
|
-
setSearchString && setSearchString("");
|
|
102
|
-
}, S: S }, option.loading ? (react_1.default.createElement(TextLoader_1.TextLoader, { style: { width: "8rem", height: "1.5rem" } })) : (react_1.default.createElement(OptionContent_1.OptionContent, { option: option, optionsClassName: optionsClassName, invert: invert, S: S, observerRef: options.length === index + 1 ? observerRef : null })))); }))),
|
|
103
|
-
genCreateTagButton && genCreateTagButton(options))));
|
|
104
|
-
};
|
|
105
|
-
exports.OptionsSingle = OptionsSingle;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const StyledOption: import("styled-components").StyledComponent<"li", any, {}, never>;
|