oolib 2.228.1 → 2.229.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/v2/components/Dropdowns/DropdownMulti/index.d.ts +2 -1
- package/dist/v2/components/Dropdowns/DropdownMulti/index.js +3 -2
- package/dist/v2/components/Dropdowns/comps/OptionsMulti/index.d.ts +2 -1
- package/dist/v2/components/Dropdowns/comps/OptionsMulti/index.js +21 -2
- package/dist/v2/components/List/index.js +1 -1
- package/dist/v2/components/TabBar/index.styled.js +4 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function DropdownMulti({ saveValueAsString, value: valueProp, id, onChange: parentOnChange, className, readOnly, 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, variant, matchSelectInputWidth, observerRef, content, }: {
|
|
1
|
+
export function DropdownMulti({ saveValueAsString, value: valueProp, id, onChange: parentOnChange, className, readOnly, 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, variant, matchSelectInputWidth, observerRef, content, showSelectAll, }: {
|
|
2
2
|
saveValueAsString: any;
|
|
3
3
|
value: any;
|
|
4
4
|
id: any;
|
|
@@ -37,5 +37,6 @@ export function DropdownMulti({ saveValueAsString, value: valueProp, id, onChang
|
|
|
37
37
|
matchSelectInputWidth?: boolean;
|
|
38
38
|
observerRef: any;
|
|
39
39
|
content: any;
|
|
40
|
+
showSelectAll: any;
|
|
40
41
|
}, ...args: any[]): React.JSX.Element;
|
|
41
42
|
import React from "react";
|
|
@@ -74,7 +74,8 @@ function DropdownMulti(_a) {
|
|
|
74
74
|
optionsClassName = _a.optionsClassName, //used to override font size in priimary header
|
|
75
75
|
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,
|
|
76
76
|
//props whose existence needs to be questioned:
|
|
77
|
-
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, _c = _a.variant, variant = _c === void 0 ? "default" : _c, _d = _a.matchSelectInputWidth, matchSelectInputWidth = _d === void 0 ? false : _d, observerRef = _a.observerRef, content = _a.content;
|
|
77
|
+
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, _c = _a.variant, variant = _c === void 0 ? "default" : _c, _d = _a.matchSelectInputWidth, matchSelectInputWidth = _d === void 0 ? false : _d, observerRef = _a.observerRef, content = _a.content, // parent document; content.meta.kp_content_type is used to set ?activeTab= on collection tag links
|
|
78
|
+
showSelectAll = _a.showSelectAll;
|
|
78
79
|
var theme = (0, styled_components_1.useTheme)();
|
|
79
80
|
var props = arguments[0];
|
|
80
81
|
var value = (0, getValue_1.getValue_MULTI)({ valueProp: valueProp, optionsFn: optionsFn, options: optionsProp, theme: theme, saveValueAsString: saveValueAsString });
|
|
@@ -196,7 +197,7 @@ function DropdownMulti(_a) {
|
|
|
196
197
|
? !showOptions && handleShowOptions() //if tagsStyle, then click always shows options
|
|
197
198
|
: showOptions ? handleHideOptions() : handleShowOptions(); //if dropdowns, then click toggles show/hide
|
|
198
199
|
} }, isTagsStyle ? genSelectTagsInput() : (react_1.default.createElement(SelectDropdown_1.SelectDropdown, { value: value, placeholder: placeholder, selectClassName: selectClassName, selectStyleOverride: selectStyleOverride, showOptions: showOptions, genCustomSelectComp: genCustomSelectComp, disableSelectTextUpdate: disableSelectTextUpdate, selectConfig: selectConfig, S: S, disabled: disabled, variant: variant }))),
|
|
199
|
-
react_1.default.createElement(OptionsMulti_1.OptionsMulti, { parentOnChange: parentOnChange, id: id, value: value, relativeToRef: selectRef, showOptions: showOptions, handleSelect: handleSelect, handleHideOptions: handleHideOptions, optionsClassName: optionsClassName, options: options, optionsFn: optionsFn, label: label, optionsModalLabel: optionsModalLabel, isTagsStyle: isTagsStyle, genCreateTagButton: genCreateTagButton, lightboxHeight: lightboxHeight, lightboxStyle: lightboxStyle, optionsAnchor: optionsAnchor, SelectComp: isTagsStyle && genSelectTagsInput({ style: { position: 'sticky', top: 0, zIndex: 1000 } }), setFocusSelectTagsInput: setFocusSelectTagsInput, popOutOfOverflowHiddenParent: popOutOfOverflowHiddenParent, S: S, alignDropdown: alignDropdown, matchSelectInputWidth: matchSelectInputWidth, observerRef: observerRef, searchbarPlaceholder: searchbarPlaceholder, isSearchable: isTagsStyle ? false : isSearchable, searchString: searchString, setSearchString: setSearchString })));
|
|
200
|
+
react_1.default.createElement(OptionsMulti_1.OptionsMulti, { parentOnChange: parentOnChange, id: id, value: value, relativeToRef: selectRef, showOptions: showOptions, handleSelect: handleSelect, handleHideOptions: handleHideOptions, optionsClassName: optionsClassName, options: options, optionsFn: optionsFn, label: label, optionsModalLabel: optionsModalLabel, isTagsStyle: isTagsStyle, genCreateTagButton: genCreateTagButton, lightboxHeight: lightboxHeight, lightboxStyle: lightboxStyle, optionsAnchor: optionsAnchor, SelectComp: isTagsStyle && genSelectTagsInput({ style: { position: 'sticky', top: 0, zIndex: 1000 } }), setFocusSelectTagsInput: setFocusSelectTagsInput, popOutOfOverflowHiddenParent: popOutOfOverflowHiddenParent, S: S, alignDropdown: alignDropdown, matchSelectInputWidth: matchSelectInputWidth, observerRef: observerRef, searchbarPlaceholder: searchbarPlaceholder, isSearchable: isTagsStyle ? false : isSearchable, searchString: searchString, setSearchString: setSearchString, showSelectAll: showSelectAll })));
|
|
200
201
|
};
|
|
201
202
|
return (react_1.default.createElement("div", { className: "OKE-Dropdown ".concat(className, " OKE-Dropdown--").concat(readOnly ? "displayComp" : "inputComp") },
|
|
202
203
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, getBlockLabelProps_1.getBlockLabelProps)(props))),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function OptionsMulti({ lightboxHeight, lightboxStyle, optionsAnchor, value, id, optionsClassName, relativeToRef, showOptions, handleHideOptions, handleSelect, options, parentOnChange, isSearchable, label, optionsModalLabel, searchString, setSearchString, SelectComp, isTagsStyle, genCreateTagButton, setFocusSelectTagsInput, popOutOfOverflowHiddenParent, S, observerRef, searchbarPlaceholder, alignDropdown, matchSelectInputWidth }: {
|
|
1
|
+
export function OptionsMulti({ lightboxHeight, lightboxStyle, optionsAnchor, value, id, optionsClassName, relativeToRef, showOptions, handleHideOptions, handleSelect, options, parentOnChange, isSearchable, label, optionsModalLabel, searchString, setSearchString, SelectComp, isTagsStyle, genCreateTagButton, setFocusSelectTagsInput, popOutOfOverflowHiddenParent, S, observerRef, searchbarPlaceholder, alignDropdown, matchSelectInputWidth, showSelectAll }: {
|
|
2
2
|
lightboxHeight: any;
|
|
3
3
|
lightboxStyle: any;
|
|
4
4
|
optionsAnchor: any;
|
|
@@ -26,5 +26,6 @@ export function OptionsMulti({ lightboxHeight, lightboxStyle, optionsAnchor, val
|
|
|
26
26
|
searchbarPlaceholder: any;
|
|
27
27
|
alignDropdown: any;
|
|
28
28
|
matchSelectInputWidth: any;
|
|
29
|
+
showSelectAll: any;
|
|
29
30
|
}): React.JSX.Element;
|
|
30
31
|
import React from "react";
|
|
@@ -32,6 +32,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
36
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
37
|
+
if (ar || !(i in from)) {
|
|
38
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
39
|
+
ar[i] = from[i];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
43
|
+
};
|
|
35
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
45
|
exports.OptionsMulti = void 0;
|
|
37
46
|
var react_1 = __importStar(require("react"));
|
|
@@ -48,7 +57,7 @@ var OptionsMulti = function (_a) {
|
|
|
48
57
|
relativeToRef = _a.relativeToRef, //the element that this lightbox is being rendered against. i.e top or bottom
|
|
49
58
|
showOptions = _a.showOptions, handleHideOptions = _a.handleHideOptions, handleSelect = _a.handleSelect, options = _a.options, parentOnChange = _a.parentOnChange, isSearchable = _a.isSearchable, label = _a.label, optionsModalLabel = _a.optionsModalLabel, //label is just a fallback for optionsModalLabel. Don't know why both are needed
|
|
50
59
|
searchString = _a.searchString, setSearchString = _a.setSearchString, SelectComp = _a.SelectComp, // for mobile
|
|
51
|
-
isTagsStyle = _a.isTagsStyle, genCreateTagButton = _a.genCreateTagButton, setFocusSelectTagsInput = _a.setFocusSelectTagsInput, popOutOfOverflowHiddenParent = _a.popOutOfOverflowHiddenParent, S = _a.S, observerRef = _a.observerRef, searchbarPlaceholder = _a.searchbarPlaceholder, alignDropdown = _a.alignDropdown, matchSelectInputWidth = _a.matchSelectInputWidth;
|
|
60
|
+
isTagsStyle = _a.isTagsStyle, genCreateTagButton = _a.genCreateTagButton, setFocusSelectTagsInput = _a.setFocusSelectTagsInput, popOutOfOverflowHiddenParent = _a.popOutOfOverflowHiddenParent, S = _a.S, observerRef = _a.observerRef, searchbarPlaceholder = _a.searchbarPlaceholder, alignDropdown = _a.alignDropdown, matchSelectInputWidth = _a.matchSelectInputWidth, showSelectAll = _a.showSelectAll;
|
|
52
61
|
//INIT ORIENTATION STATE AND CUSTOM HOOK
|
|
53
62
|
var optionsRef = (0, react_1.useRef)(null);
|
|
54
63
|
var yOrientation = (0, useSetYOrientation_1.useSetYOrientation)({
|
|
@@ -88,6 +97,14 @@ var OptionsMulti = function (_a) {
|
|
|
88
97
|
parentOnChange(id, []);
|
|
89
98
|
setSearchString('');
|
|
90
99
|
};
|
|
100
|
+
var handleSelectAll = function () {
|
|
101
|
+
// Combine selected (value) + unselected (options) to get all options
|
|
102
|
+
var flatUnselected = (0, List_1.isGroupedData)(options)
|
|
103
|
+
? options.flatMap(function (group) { return group.options; })
|
|
104
|
+
: options;
|
|
105
|
+
parentOnChange(id, __spreadArray(__spreadArray([], (value || []), true), flatUnselected, true));
|
|
106
|
+
setSearchString('');
|
|
107
|
+
};
|
|
91
108
|
var createSelectedOptions = function () {
|
|
92
109
|
return (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 0 && (react_1.default.createElement("div", null,
|
|
93
110
|
react_1.default.createElement("div", { style: {
|
|
@@ -97,7 +114,9 @@ var OptionsMulti = function (_a) {
|
|
|
97
114
|
alignItems: "center",
|
|
98
115
|
} },
|
|
99
116
|
react_1.default.createElement(__1.UI_TAG, null, "Selected"),
|
|
100
|
-
react_1.default.createElement(
|
|
117
|
+
react_1.default.createElement("div", { style: { display: "flex", gap: "0.2rem" } },
|
|
118
|
+
showSelectAll && options.length > 0 && (react_1.default.createElement(__1.ButtonTertiaryCompact, { onClick: handleSelectAll, children: "Select all", icon: "CheckCircle" })),
|
|
119
|
+
react_1.default.createElement(__1.ButtonTertiaryCompact, { onClick: handleClearAll, children: "Clear all", icon: "X" }))),
|
|
101
120
|
react_1.default.createElement(List_1.List, { key: value, options: selectedOptions, value: value, focussedOp: focussedOp, scrollFocussedOpIntoView: scrollFocussedOpIntoView, onChange: function (id, v) {
|
|
102
121
|
return handleSelect(v);
|
|
103
122
|
}, setSearchString: setSearchString, optionsClassName: optionsClassName, setFocusSelectTagsInput: setFocusSelectTagsInput, S: S, isMulti: true, style: { padding: "0" }, disableShadow: true }),
|
|
@@ -69,7 +69,7 @@ var List = function (_a) {
|
|
|
69
69
|
// const theme = useTheme();
|
|
70
70
|
var id = _a.id, _b = _a.options, options = _b === void 0 ? [] : _b, value = _a.value, focussedOp = _a.focussedOp, scrollFocussedOpIntoView = _a.scrollFocussedOpIntoView, parentOnChange = _a.onChange, optionsClassName = _a.optionsClassName, invert = _a.invert, S = _a.S, observerRef = _a.observerRef, _c = _a.isMulti, isMulti = _c === void 0 ? false : _c, isTagsStyle = _a.isTagsStyle, setFocusSelectTagsInput = _a.setFocusSelectTagsInput, disableShadow = _a.disableShadow, isSearchable = _a.isSearchable, searchbarPlaceholder = _a.searchbarPlaceholder, searchBarFocus = _a.searchBarFocus, searchString = _a.searchString, setSearchString = _a.setSearchString, setSearchBarFocus = _a.setSearchBarFocus, children = _a.children, enableBorder = _a.enableBorder, style = _a.style, groupHeaderStickyTop = _a.groupHeaderStickyTop, showListInParent = _a.showList, usedIn = _a.usedIn, alignCheckbox = _a.alignCheckbox, iconAfter = _a.iconAfter;
|
|
71
71
|
var renderListItems = function () {
|
|
72
|
-
if (options.length === 0) {
|
|
72
|
+
if (options.length === 0 && searchString) {
|
|
73
73
|
return react_1.default.createElement(NoOptionResultsComp_1.NoOptionResultsComp, { S: S });
|
|
74
74
|
}
|
|
75
75
|
if ((0, exports.isGroupedData)(options)) {
|
|
@@ -150,13 +150,13 @@ exports.TabBarTabStyled = styled_components_1.default.button(templateObject_17 |
|
|
|
150
150
|
return exports.tabStyles.style2;
|
|
151
151
|
}
|
|
152
152
|
});
|
|
153
|
-
exports.StyledDirectionButtons = styled_components_1.default.div(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n position: absolute;\n ", "\n
|
|
153
|
+
exports.StyledDirectionButtons = styled_components_1.default.div(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n position: absolute;\n ", "\n height: 100%;\n z-index: 10;\n display: flex;\n align-items: center;\n"], ["\n position: absolute;\n ", "\n height: 100%;\n z-index: 10;\n display: flex;\n align-items: center;\n"])), function (_a) {
|
|
154
154
|
var left = _a.left, right = _a.right;
|
|
155
155
|
if (left)
|
|
156
|
-
return (0, styled_components_1.css)(templateObject_18 || (templateObject_18 = __makeTemplateObject([" left: 0
|
|
156
|
+
return (0, styled_components_1.css)(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n left: 0;\n background: linear-gradient(to left, transparent, ", ");\n padding-right: 0.5rem;\n "], ["\n left: 0;\n background: linear-gradient(to left, transparent, ", ");\n padding-right: 0.5rem;\n "])), white);
|
|
157
157
|
else if (right)
|
|
158
|
-
return (0, styled_components_1.css)(templateObject_19 || (templateObject_19 = __makeTemplateObject([" right: 0
|
|
159
|
-
}
|
|
158
|
+
return (0, styled_components_1.css)(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n right: 0;\n background: linear-gradient(to right, transparent, ", ");\n padding-left: 0.5rem;\n "], ["\n right: 0;\n background: linear-gradient(to right, transparent, ", ");\n padding-left: 0.5rem;\n "])), white);
|
|
159
|
+
});
|
|
160
160
|
exports.StyledDot = styled_components_1.default.div(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n background: ", ";\n height: 5px;\n width: 5px;\n border-radius: 50%;\n margin-left: 10px;\n"], ["\n background: ", ";\n height: 5px;\n width: 5px;\n border-radius: 50%;\n margin-left: 10px;\n"])), function (_a) {
|
|
161
161
|
var active = _a.active, error = _a.error, tabBarStyle = _a.tabBarStyle;
|
|
162
162
|
return tabBarStyle === "2" && active ? errorColor : !active && error ? errorColor : errorColor;
|