oolib 2.149.4 → 2.149.5
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 +2 -1
- package/dist/components/Dropdowns/DropdownMulti/index.js +8 -8
- package/dist/components/Dropdowns/DropdownSingle/index.d.ts +2 -1
- package/dist/components/Dropdowns/DropdownSingle/index.js +8 -8
- package/dist/components/Dropdowns/comps/OptionsMulti/index.d.ts +2 -1
- package/dist/components/Dropdowns/comps/OptionsMulti/index.js +2 -2
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/index.d.ts +2 -1
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/index.js +8 -2
- package/dist/components/Dropdowns/comps/OptionsShell/index.js +2 -2
- package/dist/components/Dropdowns/comps/OptionsSingle/index.d.ts +2 -1
- package/dist/components/Dropdowns/comps/OptionsSingle/index.js +2 -2
- package/dist/components/Dropdowns/comps/SelectDropdown/styled.js +1 -1
- package/dist/stories/Oolib/components/Dropdowns.stories.d.ts +14 -0
- package/dist/stories/Oolib/components/Dropdowns.stories.js +9 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function DropdownMulti({ saveValueAsString, value: valueProp, id, onChange: parentOnChange, className, readOnly, invert, selectClassName, optionsClassName, selectStyleOverride, optionsFn, options: optionsProp, isTagsStyle, isSearchable, searchFieldsConfig, setFilteredOptions: setFilteredOptionsInParent, setSearchString: setSearchStringInParent, searchString: searchStringInParent, label, optionsModalLabel, genCreateTagButton, placeholder, genCustomSelectComp, disableSelectTextUpdate, selectConfig, lightboxHeight, lightboxStyle, optionsAnchor, popOutOfOverflowHiddenParent, S, disabled, broadcastShowOptions, tagColor, searchbarPlaceholder }: {
|
|
1
|
+
export function DropdownMulti({ saveValueAsString, value: valueProp, id, onChange: parentOnChange, className, readOnly, invert, selectClassName, optionsClassName, selectStyleOverride, optionsFn, options: optionsProp, isTagsStyle, isSearchable, searchFieldsConfig, setFilteredOptions: setFilteredOptionsInParent, setSearchString: setSearchStringInParent, searchString: searchStringInParent, label, optionsModalLabel, genCreateTagButton, placeholder, genCustomSelectComp, disableSelectTextUpdate, selectConfig, lightboxHeight, lightboxStyle, optionsAnchor, popOutOfOverflowHiddenParent, S, disabled, broadcastShowOptions, tagColor, searchbarPlaceholder, alignDropdown }: {
|
|
2
2
|
saveValueAsString: any;
|
|
3
3
|
value: any;
|
|
4
4
|
id: any;
|
|
@@ -33,5 +33,6 @@ export function DropdownMulti({ saveValueAsString, value: valueProp, id, onChang
|
|
|
33
33
|
broadcastShowOptions: any;
|
|
34
34
|
tagColor: any;
|
|
35
35
|
searchbarPlaceholder: any;
|
|
36
|
+
alignDropdown?: string;
|
|
36
37
|
}, ...args: any[]): React.JSX.Element;
|
|
37
38
|
import React from "react";
|
|
@@ -62,24 +62,24 @@ function DropdownMulti(_a) {
|
|
|
62
62
|
optionsClassName = _a.optionsClassName, //used to override font size in priimary header
|
|
63
63
|
selectStyleOverride = _a.selectStyleOverride, optionsFn = _a.optionsFn, optionsProp = _a.options, isTagsStyle = _a.isTagsStyle, isSearchable = _a.isSearchable, searchFieldsConfig = _a.searchFieldsConfig, setFilteredOptionsInParent = _a.setFilteredOptions, setSearchStringInParent = _a.setSearchString, searchStringInParent = _a.searchString, label = _a.label, optionsModalLabel = _a.optionsModalLabel, genCreateTagButton = _a.genCreateTagButton, placeholder = _a.placeholder, genCustomSelectComp = _a.genCustomSelectComp, disableSelectTextUpdate = _a.disableSelectTextUpdate, selectConfig = _a.selectConfig,
|
|
64
64
|
//props whose existence needs to be questioned:
|
|
65
|
-
lightboxHeight = _a.lightboxHeight, lightboxStyle = _a.lightboxStyle, optionsAnchor = _a.optionsAnchor, popOutOfOverflowHiddenParent = _a.popOutOfOverflowHiddenParent, S = _a.S, disabled = _a.disabled, broadcastShowOptions = _a.broadcastShowOptions, tagColor = _a.tagColor, searchbarPlaceholder = _a.searchbarPlaceholder;
|
|
65
|
+
lightboxHeight = _a.lightboxHeight, lightboxStyle = _a.lightboxStyle, optionsAnchor = _a.optionsAnchor, popOutOfOverflowHiddenParent = _a.popOutOfOverflowHiddenParent, S = _a.S, disabled = _a.disabled, broadcastShowOptions = _a.broadcastShowOptions, tagColor = _a.tagColor, searchbarPlaceholder = _a.searchbarPlaceholder, _b = _a.alignDropdown, alignDropdown = _b === void 0 ? "left" : _b;
|
|
66
66
|
var theme = (0, styled_components_1.useTheme)();
|
|
67
67
|
var props = arguments[0];
|
|
68
68
|
var value = (0, getValue_1.getValue_MULTI)({ valueProp: valueProp, optionsFn: optionsFn, options: optionsProp, theme: theme, saveValueAsString: saveValueAsString });
|
|
69
69
|
//1 INIT REFS
|
|
70
|
-
var
|
|
70
|
+
var _c = (0, useCreateDropdownRefs_1.useCreateDropdownRefs)(), selectRef = _c.selectRef, dropdownRef = _c.dropdownRef;
|
|
71
71
|
//2 INIT SHOW OPTIONS STATE
|
|
72
|
-
var
|
|
72
|
+
var _d = (0, useHideShowOptions_1.useHideShowOptions)({
|
|
73
73
|
broadcastShowOptions: broadcastShowOptions
|
|
74
|
-
}), showOptions =
|
|
74
|
+
}), showOptions = _d.showOptions, handleHideOptions = _d.handleHideOptions, handleShowOptions = _d.handleShowOptions;
|
|
75
75
|
var screenWidth = (0, useScreenWidth_1.useScreenWidth)();
|
|
76
76
|
//3 INIT DD FOCUS CUSTOM HOOK
|
|
77
77
|
(0, useHandleClickOutside_1.useHandleClickOutside)(dropdownRef, handleHideOptions, { enabled: screenWidth >= (0, mixins_1.getBreakPoint)('sm') });
|
|
78
78
|
//-- TAG INPUT SPECIFIC
|
|
79
|
-
var
|
|
79
|
+
var _e = (0, useSearchString_1.useSearchString)({
|
|
80
80
|
setSearchStringInParent: setSearchStringInParent,
|
|
81
81
|
searchStringInParent: searchStringInParent
|
|
82
|
-
}), searchString =
|
|
82
|
+
}), searchString = _e[0], setSearchString = _e[1];
|
|
83
83
|
var options = (0, react_1.useMemo)(function () {
|
|
84
84
|
var ops = (0, generateOptions_1.generateOptions)({
|
|
85
85
|
options: optionsProp,
|
|
@@ -139,7 +139,7 @@ function DropdownMulti(_a) {
|
|
|
139
139
|
return isTagsStyle ? (react_1.default.createElement(styled_1.StyledTagsInputWrapper, null, value.map(function (d) { return (0, genTagComp_1.genTagComp)(id, d, { display: true, invert: invert, theme: theme, color: tagColor }); }))) : (react_1.default.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" } }, value.map(function (v, i) { return (react_1.default.createElement(react_1.Fragment, null,
|
|
140
140
|
react_1.default.createElement(DisplayCompSingle_1.DisplayCompSingle, { value: v, invert: invert, injectComma: i !== value.length - 1, S: S }))); })));
|
|
141
141
|
};
|
|
142
|
-
var
|
|
142
|
+
var _f = (0, react_1.useState)(false), focusSelectTagsInput = _f[0], setFocusSelectTagsInput = _f[1];
|
|
143
143
|
var genSelectTagsInput = function () { return (react_1.default.createElement(SelectTagsInput_1.SelectTagsInput, { id: id, value: value, invert: invert, handleSelect: handleSelect, searchString: searchString,
|
|
144
144
|
setSearchString: setSearchString,
|
|
145
145
|
single_multi: "multi", placeholder: placeholder, focusSelectTagsInput: focusSelectTagsInput, setFocusSelectTagsInput: setFocusSelectTagsInput, showOptions: showOptions, S: S, disabled: disabled })); };
|
|
@@ -151,7 +151,7 @@ function DropdownMulti(_a) {
|
|
|
151
151
|
? !showOptions && handleShowOptions() //if tagsStyle, then click always shows options
|
|
152
152
|
: showOptions ? handleHideOptions() : handleShowOptions(); //if dropdowns, then click toggles show/hide
|
|
153
153
|
} }, isTagsStyle ? genSelectTagsInput() : (react_1.default.createElement(SelectDropdown_1.SelectDropdown, { invert: invert, value: value, placeholder: placeholder, selectClassName: selectClassName, selectStyleOverride: selectStyleOverride, showOptions: showOptions, genCustomSelectComp: genCustomSelectComp, disableSelectTextUpdate: disableSelectTextUpdate, selectConfig: selectConfig, S: S, disabled: disabled }))),
|
|
154
|
-
react_1.default.createElement(OptionsMulti_1.OptionsMulti, { searchbarPlaceholder: searchbarPlaceholder, id: id, value: value, relativeToRef: selectRef, showOptions: showOptions, handleSelect: handleSelect, handleHideOptions: handleHideOptions, optionsClassName: optionsClassName, options: options, optionsFn: optionsFn, isSearchable: isTagsStyle ? false : isSearchable, searchString: searchString, setSearchString: setSearchString, label: label, optionsModalLabel: optionsModalLabel, isTagsStyle: isTagsStyle, genCreateTagButton: genCreateTagButton, lightboxHeight: lightboxHeight, lightboxStyle: lightboxStyle, optionsAnchor: optionsAnchor, SelectComp: isTagsStyle && genSelectTagsInput(), invert: invert, setFocusSelectTagsInput: setFocusSelectTagsInput, popOutOfOverflowHiddenParent: popOutOfOverflowHiddenParent, S: S })));
|
|
154
|
+
react_1.default.createElement(OptionsMulti_1.OptionsMulti, { searchbarPlaceholder: searchbarPlaceholder, id: id, value: value, relativeToRef: selectRef, showOptions: showOptions, handleSelect: handleSelect, handleHideOptions: handleHideOptions, optionsClassName: optionsClassName, options: options, optionsFn: optionsFn, isSearchable: isTagsStyle ? false : isSearchable, searchString: searchString, setSearchString: setSearchString, label: label, optionsModalLabel: optionsModalLabel, isTagsStyle: isTagsStyle, genCreateTagButton: genCreateTagButton, lightboxHeight: lightboxHeight, lightboxStyle: lightboxStyle, optionsAnchor: optionsAnchor, SelectComp: isTagsStyle && genSelectTagsInput(), invert: invert, setFocusSelectTagsInput: setFocusSelectTagsInput, popOutOfOverflowHiddenParent: popOutOfOverflowHiddenParent, S: S, alignDropdown: alignDropdown })));
|
|
155
155
|
};
|
|
156
156
|
return (react_1.default.createElement("div", { className: "OKE-Dropdown ".concat(className, " OKE-Dropdown--").concat(readOnly ? "displayComp" : "inputComp", " ").concat(invert ? "-invert-" : "") },
|
|
157
157
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, getBlockLabelProps_1.getBlockLabelProps)(props))),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function DropdownSingle({ optionsAnchor, lightboxHeight, lightboxStyle, selectClassName, optionsClassName, disableSelectTextUpdate, selectStyleOverride, value: valueProp, id, onChange: parentOnChange, className, style, readOnly, invert, optionsFn, options: optionsProp, saveValueAsString, isTagsStyle, selectConfig, label, optionsModalLabel, broadcastShowOptions, isSearchable, searchFieldsConfig, setFilteredOptions: setFilteredOptionsInParent, setSearchString: setSearchStringInParent, searchString: searchStringInParent, genCustomSelectComp, placeholder, genCreateTagButton, popOutOfOverflowHiddenParent, S, disabled, tagColor, observerRef, searchbarPlaceholder }: {
|
|
1
|
+
export function DropdownSingle({ optionsAnchor, lightboxHeight, lightboxStyle, selectClassName, optionsClassName, disableSelectTextUpdate, selectStyleOverride, value: valueProp, id, onChange: parentOnChange, className, style, readOnly, invert, optionsFn, options: optionsProp, saveValueAsString, isTagsStyle, selectConfig, label, optionsModalLabel, broadcastShowOptions, isSearchable, searchFieldsConfig, setFilteredOptions: setFilteredOptionsInParent, setSearchString: setSearchStringInParent, searchString: searchStringInParent, genCustomSelectComp, placeholder, genCreateTagButton, popOutOfOverflowHiddenParent, S, disabled, tagColor, observerRef, searchbarPlaceholder, alignDropdown }: {
|
|
2
2
|
optionsAnchor: any;
|
|
3
3
|
lightboxHeight: any;
|
|
4
4
|
lightboxStyle: any;
|
|
@@ -35,5 +35,6 @@ export function DropdownSingle({ optionsAnchor, lightboxHeight, lightboxStyle, s
|
|
|
35
35
|
tagColor: any;
|
|
36
36
|
observerRef: any;
|
|
37
37
|
searchbarPlaceholder: any;
|
|
38
|
+
alignDropdown?: string;
|
|
38
39
|
}, ...args: any[]): React.JSX.Element;
|
|
39
40
|
import React from "react";
|
|
@@ -72,16 +72,16 @@ function DropdownSingle(_a) {
|
|
|
72
72
|
searchFieldsConfig = _a.searchFieldsConfig, setFilteredOptionsInParent = _a.setFilteredOptions, setSearchStringInParent = _a.setSearchString, searchStringInParent = _a.searchString, genCustomSelectComp = _a.genCustomSelectComp, placeholder = _a.placeholder, //
|
|
73
73
|
genCreateTagButton = _a.genCreateTagButton, popOutOfOverflowHiddenParent = _a.popOutOfOverflowHiddenParent, S = _a.S, //
|
|
74
74
|
disabled = _a.disabled, //
|
|
75
|
-
tagColor = _a.tagColor, observerRef = _a.observerRef, searchbarPlaceholder = _a.searchbarPlaceholder;
|
|
75
|
+
tagColor = _a.tagColor, observerRef = _a.observerRef, searchbarPlaceholder = _a.searchbarPlaceholder, _b = _a.alignDropdown, alignDropdown = _b === void 0 ? "left" : _b;
|
|
76
76
|
var theme = (0, styled_components_1.useTheme)();
|
|
77
77
|
var props = arguments[0];
|
|
78
78
|
var value = (0, getValue_1.getValue_SINGLE)({ valueProp: valueProp, optionsFn: optionsFn, options: optionsProp, theme: theme, saveValueAsString: saveValueAsString });
|
|
79
79
|
//1 INIT REFS
|
|
80
|
-
var
|
|
80
|
+
var _c = (0, useCreateDropdownRefs_1.useCreateDropdownRefs)(), selectRef = _c.selectRef, dropdownRef = _c.dropdownRef;
|
|
81
81
|
//2 INIT SHOW OPTIONS STATE
|
|
82
|
-
var
|
|
82
|
+
var _d = (0, useHideShowOptions_1.useHideShowOptions)({
|
|
83
83
|
broadcastShowOptions: broadcastShowOptions
|
|
84
|
-
}), showOptions =
|
|
84
|
+
}), showOptions = _d.showOptions, handleHideOptions = _d.handleHideOptions, handleShowOptions = _d.handleShowOptions;
|
|
85
85
|
var screenWidth = (0, useScreenWidth_1.useScreenWidth)();
|
|
86
86
|
//3 INIT DD FOCUS CUSTOM HOOK
|
|
87
87
|
(0, useHandleClickOutside_1.useHandleClickOutside)(dropdownRef, handleHideOptions, { enabled: screenWidth >= (0, mixins_1.getBreakPoint)('sm') });
|
|
@@ -99,10 +99,10 @@ function DropdownSingle(_a) {
|
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
101
|
//-- TAG INPUT SPECIFIC
|
|
102
|
-
var
|
|
102
|
+
var _e = (0, useSearchString_1.useSearchString)({
|
|
103
103
|
searchStringInParent: searchStringInParent,
|
|
104
104
|
setSearchStringInParent: setSearchStringInParent
|
|
105
|
-
}), searchString =
|
|
105
|
+
}), searchString = _e[0], setSearchString = _e[1];
|
|
106
106
|
var options = (0, react_1.useMemo)(function () {
|
|
107
107
|
var ops = (0, generateOptions_1.generateOptions)({
|
|
108
108
|
options: optionsProp,
|
|
@@ -124,7 +124,7 @@ function DropdownSingle(_a) {
|
|
|
124
124
|
// forceFocus, comp is expecting this
|
|
125
125
|
})); };
|
|
126
126
|
var genInputComp = function () {
|
|
127
|
-
return (react_1.default.createElement(styled_1.StyledDropdownRefWrapper, { ref: dropdownRef },
|
|
127
|
+
return (react_1.default.createElement(styled_1.StyledDropdownRefWrapper, { ref: dropdownRef, id: "StyledDropdownRefWrapper" },
|
|
128
128
|
react_1.default.createElement("div", { ref: selectRef, className: "OKE-Dropdown__Select-wrapper", onClick: disabled ? function () { } : function () {
|
|
129
129
|
isTagsStyle
|
|
130
130
|
? !showOptions && handleShowOptions() //if tagsStyle, then click always shows options
|
|
@@ -132,7 +132,7 @@ function DropdownSingle(_a) {
|
|
|
132
132
|
} }, isTagsStyle ? genSelectTagsInput() : (react_1.default.createElement(SelectDropdown_1.SelectDropdown, { invert: invert, value: value, placeholder: placeholder, genCustomSelectComp: genCustomSelectComp, selectClassName: selectClassName, selectStyleOverride: selectStyleOverride, showOptions: showOptions, disableSelectTextUpdate: disableSelectTextUpdate, selectConfig: selectConfig, S: S, disabled: disabled }))),
|
|
133
133
|
react_1.default.createElement(OptionsSingle_1.OptionsSingle, { searchbarPlaceholder: searchbarPlaceholder, observerRef: observerRef, lightboxHeight: lightboxHeight, lightboxStyle: lightboxStyle, optionsAnchor: optionsAnchor, searchString: searchString, setSearchString: setSearchString, id: id, optionsClassName: optionsClassName, label: label, value: value, relativeToRef: selectRef, invert: invert, showOptions: showOptions, handleHideOptions: handleHideOptions, handleSelect: handleSelect, options: options, optionsFn: optionsFn, optionsModalLabel: optionsModalLabel,
|
|
134
134
|
//combobox specific
|
|
135
|
-
isSearchable: isTagsStyle ? false : isSearchable, genCreateTagButton: genCreateTagButton, SelectComp: isTagsStyle && genSelectTagsInput(), S: S, popOutOfOverflowHiddenParent: popOutOfOverflowHiddenParent })));
|
|
135
|
+
isSearchable: isTagsStyle ? false : isSearchable, alignDropdown: alignDropdown, genCreateTagButton: genCreateTagButton, SelectComp: isTagsStyle && genSelectTagsInput(), S: S, popOutOfOverflowHiddenParent: popOutOfOverflowHiddenParent })));
|
|
136
136
|
};
|
|
137
137
|
var genDisplayComp = function () {
|
|
138
138
|
if (!value)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function OptionsMulti({ lightboxHeight, lightboxStyle, optionsAnchor, value, id, optionsClassName, relativeToRef, showOptions, handleHideOptions, handleSelect, options, isSearchable, label, optionsModalLabel, searchString, setSearchString, SelectComp, isTagsStyle, genCreateTagButton, invert, setFocusSelectTagsInput, popOutOfOverflowHiddenParent, S, searchbarPlaceholder }: {
|
|
1
|
+
export function OptionsMulti({ lightboxHeight, lightboxStyle, optionsAnchor, value, id, optionsClassName, relativeToRef, showOptions, handleHideOptions, handleSelect, options, isSearchable, label, optionsModalLabel, searchString, setSearchString, SelectComp, isTagsStyle, genCreateTagButton, invert, setFocusSelectTagsInput, popOutOfOverflowHiddenParent, S, searchbarPlaceholder, alignDropdown }: {
|
|
2
2
|
lightboxHeight: any;
|
|
3
3
|
lightboxStyle: any;
|
|
4
4
|
optionsAnchor: any;
|
|
@@ -23,5 +23,6 @@ export function OptionsMulti({ lightboxHeight, lightboxStyle, optionsAnchor, val
|
|
|
23
23
|
popOutOfOverflowHiddenParent: any;
|
|
24
24
|
S: any;
|
|
25
25
|
searchbarPlaceholder: any;
|
|
26
|
+
alignDropdown: any;
|
|
26
27
|
}): React.JSX.Element;
|
|
27
28
|
import React from "react";
|
|
@@ -58,7 +58,7 @@ var OptionsMulti = function (_a) {
|
|
|
58
58
|
relativeToRef = _a.relativeToRef, //the element that this lightbox is being rendered against. i.e top or bottom
|
|
59
59
|
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
|
|
60
60
|
searchString = _a.searchString, setSearchString = _a.setSearchString, SelectComp = _a.SelectComp, // for mobile
|
|
61
|
-
isTagsStyle = _a.isTagsStyle, genCreateTagButton = _a.genCreateTagButton, invert = _a.invert, setFocusSelectTagsInput = _a.setFocusSelectTagsInput, popOutOfOverflowHiddenParent = _a.popOutOfOverflowHiddenParent, S = _a.S, searchbarPlaceholder = _a.searchbarPlaceholder;
|
|
61
|
+
isTagsStyle = _a.isTagsStyle, genCreateTagButton = _a.genCreateTagButton, invert = _a.invert, setFocusSelectTagsInput = _a.setFocusSelectTagsInput, popOutOfOverflowHiddenParent = _a.popOutOfOverflowHiddenParent, S = _a.S, searchbarPlaceholder = _a.searchbarPlaceholder, alignDropdown = _a.alignDropdown;
|
|
62
62
|
//INIT ORIENTATION STATE AND CUSTOM HOOK
|
|
63
63
|
var optionsRef = (0, react_1.useRef)(null);
|
|
64
64
|
var yOrientation = (0, useSetYOrientation_1.useSetYOrientation)({
|
|
@@ -128,7 +128,7 @@ var OptionsMulti = function (_a) {
|
|
|
128
128
|
react_1.default.createElement("div", { style: { padding: "1rem" }, onBlur: function () { return setSearchBarFocus(false); }, tabIndex: 0 },
|
|
129
129
|
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 })),
|
|
130
130
|
react_1.default.createElement(Divider_1.Divider, { invert: invert }))); };
|
|
131
|
-
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 },
|
|
131
|
+
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 },
|
|
132
132
|
isSearchable && genSearchBar(),
|
|
133
133
|
!isTagsStyle && createSelectedOptions(),
|
|
134
134
|
options.length === 0 ? (react_1.default.createElement(NoOptionResultsComp_1.NoOptionResultsComp, { S: S })) : (options.map(function (d, i) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function OptionsAnimateWrapper({ options, optionsRef, relativeToRef, showOptions, invert, yOrientation, fixPos, optionsAnchor, children, lightboxStyle }: {
|
|
1
|
+
export function OptionsAnimateWrapper({ options, optionsRef, relativeToRef, showOptions, invert, yOrientation, fixPos, optionsAnchor, children, lightboxStyle, alignDropdown }: {
|
|
2
2
|
options: any;
|
|
3
3
|
optionsRef: any;
|
|
4
4
|
relativeToRef: any;
|
|
@@ -9,5 +9,6 @@ export function OptionsAnimateWrapper({ options, optionsRef, relativeToRef, show
|
|
|
9
9
|
optionsAnchor: any;
|
|
10
10
|
children: any;
|
|
11
11
|
lightboxStyle: any;
|
|
12
|
+
alignDropdown: any;
|
|
12
13
|
}): React.JSX.Element;
|
|
13
14
|
import React from "react";
|
|
@@ -40,7 +40,7 @@ var styled_1 = require("./styled");
|
|
|
40
40
|
var OptionsAnimateWrapper = function (_a) {
|
|
41
41
|
var _b;
|
|
42
42
|
var _c;
|
|
43
|
-
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;
|
|
43
|
+
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;
|
|
44
44
|
var selectCompRect = (_c = relativeToRef === null || relativeToRef === void 0 ? void 0 : relativeToRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
|
|
45
45
|
//we need to recalc when ops length change because, in tag comps, when loading a fixed set of 'loading' options are shown
|
|
46
46
|
//before the actual number of options are loaded
|
|
@@ -57,7 +57,13 @@ var OptionsAnimateWrapper = function (_a) {
|
|
|
57
57
|
});
|
|
58
58
|
}, [options.length]);
|
|
59
59
|
return (react_1.default.createElement(styled_1.StyledOptionsAnimateWrapper, { invert: invert, isOpen: showOptions, width: width, openHeight: openHeight, style: __assign(__assign(__assign({}, (lightboxStyle || {})), { zIndex: 100000 }), (fixPos
|
|
60
|
-
? __assign({ position: "fixed", top: "".concat(fixPos.y - (yOrientation === "top" ? (selectCompRect === null || selectCompRect === void 0 ? void 0 : selectCompRect.height) || 0 : 0), "px")
|
|
60
|
+
? __assign(__assign({ position: "fixed", top: "".concat(fixPos.y - (yOrientation === "top" ? (selectCompRect === null || selectCompRect === void 0 ? void 0 : selectCompRect.height) || 0 : 0), "px") }, (alignDropdown === "right"
|
|
61
|
+
? {
|
|
62
|
+
right: "".concat(window.innerWidth - fixPos.right, "px")
|
|
63
|
+
}
|
|
64
|
+
: {
|
|
65
|
+
left: "".concat(fixPos.x, "px")
|
|
66
|
+
})), (yOrientation === "top" ? { transform: "translateY(-100%)" } : {})) : __assign(__assign({ position: "absolute" }, (optionsAnchor ? (_b = {}, _b[optionsAnchor] = 0, _b) : alignDropdown === "right" ? { right: 0 } : { left: 0 })), (yOrientation === "bottom"
|
|
61
67
|
? { bottom: 0, transform: "translateY(100%)" }
|
|
62
68
|
: { top: 0, transform: "translateY(-100%)" })))) }, children));
|
|
63
69
|
};
|
|
@@ -35,7 +35,7 @@ var Modal_1 = require("../../../Modals/Modal");
|
|
|
35
35
|
var styled_1 = require("./styled");
|
|
36
36
|
var OptionsAnimateWrapper_1 = require("./comps/OptionsAnimateWrapper");
|
|
37
37
|
exports.OptionsShell = react_1.default.forwardRef(function (_a, ref) {
|
|
38
|
-
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;
|
|
38
|
+
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;
|
|
39
39
|
var screenWidth = (0, useScreenWidth_1.useScreenWidth)();
|
|
40
40
|
var isDesktop = screenWidth >= (0, mixins_1.getBreakPoint)("sm");
|
|
41
41
|
var _c = (0, usePopOutOfOverflowHiddenParent_1.usePopOutOfOverflowHiddenParent)(popOutOfOverflowHiddenParent), fixPos = _c.fixPos, applyFixedPos = _c.applyFixedPos, removeFixedPos = _c.removeFixedPos, trackerRef = _c.trackerRef;
|
|
@@ -49,7 +49,7 @@ exports.OptionsShell = react_1.default.forwardRef(function (_a, ref) {
|
|
|
49
49
|
}, [showOptions]);
|
|
50
50
|
return isDesktop ? (react_1.default.createElement(react_1.Fragment, null,
|
|
51
51
|
popOutOfOverflowHiddenParent && react_1.default.createElement("div", { ref: trackerRef }),
|
|
52
|
-
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 },
|
|
52
|
+
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 },
|
|
53
53
|
react_1.default.createElement(styled_1.StyledOptionsWrapper, { id: "StyledOptionsWrapper", ref: ref, invert: invert, lightboxHeight: lightboxHeight,
|
|
54
54
|
// className={className}
|
|
55
55
|
style: {
|
|
@@ -1,4 +1,4 @@
|
|
|
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 }: {
|
|
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
2
|
lightboxHeight: any;
|
|
3
3
|
lightboxStyle: any;
|
|
4
4
|
optionsAnchor: any;
|
|
@@ -23,5 +23,6 @@ export function OptionsSingle({ lightboxHeight, lightboxStyle, optionsAnchor, va
|
|
|
23
23
|
S: any;
|
|
24
24
|
observerRef: any;
|
|
25
25
|
searchbarPlaceholder: any;
|
|
26
|
+
alignDropdown: any;
|
|
26
27
|
}): React.JSX.Element;
|
|
27
28
|
import React from "react";
|
|
@@ -47,7 +47,7 @@ var OptionsSingle = function (_a) {
|
|
|
47
47
|
relativeToRef = _a.relativeToRef, //the element that this lightbox is being rendered against. i.e top or bottom
|
|
48
48
|
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
|
|
49
49
|
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)
|
|
50
|
-
S = _a.S, observerRef = _a.observerRef, searchbarPlaceholder = _a.searchbarPlaceholder
|
|
50
|
+
S = _a.S, observerRef = _a.observerRef, searchbarPlaceholder = _a.searchbarPlaceholder, alignDropdown = _a.alignDropdown
|
|
51
51
|
//disabled only with this is being used for the RTEEmbedLightbox. Also this might be temp.
|
|
52
52
|
//ensure this is set to false, if you are not passing a 'relativeToRef'
|
|
53
53
|
;
|
|
@@ -82,7 +82,7 @@ var OptionsSingle = function (_a) {
|
|
|
82
82
|
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 })),
|
|
83
83
|
react_1.default.createElement(Divider_1.Divider, { invert: invert }))); };
|
|
84
84
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
85
|
-
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, S: S },
|
|
85
|
+
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 },
|
|
86
86
|
isSearchable && genSearchBar(),
|
|
87
87
|
options.length === 0 ? (react_1.default.createElement(NoOptionResultsComp_1.NoOptionResultsComp, { S: S })) : (react_1.default.createElement(VirtualizedWrapper_1.VirtualizedWrapper, { options: options, lightboxHeight: lightboxHeight, searchString: searchString }, function (option, index, style) { 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) {
|
|
88
88
|
return focussedOp === index && el && scrollFocussedOpIntoView(el);
|
|
@@ -32,7 +32,7 @@ var styled_components_1 = __importStar(require("styled-components"));
|
|
|
32
32
|
var themes_1 = require("../../../../themes");
|
|
33
33
|
var utilsOolib_1 = require("../../../../utilsOolib");
|
|
34
34
|
var mixins_1 = require("../../../../themes/mixins");
|
|
35
|
-
exports.StyledSelectWrapper = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n position: relative;\n border-radius: 2px;\n min-height: 4rem;\n padding: 0 2rem;\n background-color: ", ";\n color: ", "; \n ", "\n ", "\n ", "\n\n &::after{\n content: '';\n position: absolute;\n width: 0;\n height: 2px;\n bottom: 0;\n
|
|
35
|
+
exports.StyledSelectWrapper = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n position: relative;\n border-radius: 2px;\n min-height: 4rem;\n padding: 0 2rem;\n background-color: ", ";\n color: ", "; \n ", "\n ", "\n ", "\n\n &::after{\n content: '';\n position: absolute;\n width: 0;\n height: 2px;\n bottom: 0;\n right: 0;\n background-color: ", ";\n ", "\n }\n \n\n &:hover {\n background-color: ", ";\n }\n\n &.focussed {\n background-color: ", ";\n &::after{\n width: 100%;\n }\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n position: relative;\n border-radius: 2px;\n min-height: 4rem;\n padding: 0 2rem;\n background-color: ", ";\n color: ", "; \n ", "\n ", "\n ", "\n\n &::after{\n content: '';\n position: absolute;\n width: 0;\n height: 2px;\n bottom: 0;\n right: 0;\n background-color: ", ";\n ", "\n }\n \n\n &:hover {\n background-color: ", ";\n }\n\n &.focussed {\n background-color: ", ";\n &::after{\n width: 100%;\n }\n }\n"])), function (_a) {
|
|
36
36
|
var invert = _a.invert;
|
|
37
37
|
return invert ? themes_1.colors.greyColor80 : themes_1.colors.greyColor5;
|
|
38
38
|
}, function (_a) {
|
|
@@ -72,6 +72,17 @@ declare namespace _default {
|
|
|
72
72
|
let name_11: string;
|
|
73
73
|
export { name_11 as name };
|
|
74
74
|
}
|
|
75
|
+
namespace alignDropdown {
|
|
76
|
+
let name_12: string;
|
|
77
|
+
export { name_12 as name };
|
|
78
|
+
let options_2: string[];
|
|
79
|
+
export { options_2 as options };
|
|
80
|
+
export namespace control_3 {
|
|
81
|
+
let type_3: string;
|
|
82
|
+
export { type_3 as type };
|
|
83
|
+
}
|
|
84
|
+
export { control_3 as control };
|
|
85
|
+
}
|
|
75
86
|
}
|
|
76
87
|
namespace args {
|
|
77
88
|
let placeholder_1: string;
|
|
@@ -100,6 +111,9 @@ declare namespace _default {
|
|
|
100
111
|
export { readOnly_1 as readOnly };
|
|
101
112
|
let invert_1: boolean;
|
|
102
113
|
export { invert_1 as invert };
|
|
114
|
+
export let popOutOfOverflowHiddenParent: boolean;
|
|
115
|
+
let alignDropdown_1: string;
|
|
116
|
+
export { alignDropdown_1 as alignDropdown };
|
|
103
117
|
}
|
|
104
118
|
namespace parameters {
|
|
105
119
|
namespace docs {
|
|
@@ -129,7 +129,12 @@ exports.default = {
|
|
|
129
129
|
},
|
|
130
130
|
showColorInSelectArea: {
|
|
131
131
|
name: "Show Color in Select Area"
|
|
132
|
-
}
|
|
132
|
+
},
|
|
133
|
+
alignDropdown: {
|
|
134
|
+
name: "Align Dropdown",
|
|
135
|
+
options: ["left", "right"],
|
|
136
|
+
control: { type: "select" }
|
|
137
|
+
},
|
|
133
138
|
},
|
|
134
139
|
args: {
|
|
135
140
|
// label: "This is a label",
|
|
@@ -147,6 +152,8 @@ exports.default = {
|
|
|
147
152
|
disabled: false,
|
|
148
153
|
readOnly: false,
|
|
149
154
|
invert: false,
|
|
155
|
+
popOutOfOverflowHiddenParent: false,
|
|
156
|
+
alignDropdown: "left",
|
|
150
157
|
},
|
|
151
158
|
parameters: {
|
|
152
159
|
docs: {
|
|
@@ -243,7 +250,7 @@ var Dropdowns = function (args) {
|
|
|
243
250
|
var _a;
|
|
244
251
|
return (__assign(__assign({}, prev), (_a = {}, _a[args.selection] = v, _a)));
|
|
245
252
|
});
|
|
246
|
-
}, selectConfig: args.showIconInSelectArea ? ["display", "icon"] : args.showColorInSelectArea ? ["display", "color"] : ["display"], label: "Dropdown Component", sublabel: "Select single or multiple options in dropdown based on Selection Type" }))))));
|
|
253
|
+
}, selectConfig: args.showIconInSelectArea ? ["display", "icon"] : args.showColorInSelectArea ? ["display", "color"] : ["display"], label: "Dropdown Component", sublabel: "Select single or multiple options in dropdown based on Selection Type", popOutOfOverflowHiddenParent: args.popOutOfOverflowHiddenParent }))))));
|
|
247
254
|
};
|
|
248
255
|
exports.Dropdowns = Dropdowns;
|
|
249
256
|
// export const Button_Primary = (args) => (
|