oolib 2.202.1 → 2.203.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/icons/index.d.ts +2 -0
- package/dist/icons/index.js +1 -0
- package/dist/v2/components/Dropdowns/DropdownMulti/index.js +6 -1
- package/dist/v2/components/Dropdowns/comps/SelectTagsInput/index.d.ts +2 -1
- package/dist/v2/components/Dropdowns/comps/SelectTagsInput/index.js +19 -33
- package/dist/v2/components/Dropdowns/comps/SelectTagsInput/styled.d.ts +1 -2
- package/dist/v2/components/Dropdowns/comps/SelectTagsInput/styled.js +7 -44
- package/dist/v2/components/Dropdowns/utils/genTagComp.js +5 -1
- package/dist/v2/components/Dropdowns/utils/getValue.js +6 -4
- package/package.json +1 -1
package/dist/icons/index.d.ts
CHANGED
|
@@ -131,6 +131,7 @@ export namespace icons {
|
|
|
131
131
|
export { ChartBarHorizontal };
|
|
132
132
|
export { GridNine };
|
|
133
133
|
export { ChartDonut };
|
|
134
|
+
export { Translate };
|
|
134
135
|
export { SlidersHorizontal };
|
|
135
136
|
export { Stack };
|
|
136
137
|
export { OkeGoogleIcon };
|
|
@@ -329,6 +330,7 @@ import { ShareIcon as Share } from '@phosphor-icons/react';
|
|
|
329
330
|
import { ChartBarHorizontalIcon as ChartBarHorizontal } from '@phosphor-icons/react';
|
|
330
331
|
import { GridNineIcon as GridNine } from '@phosphor-icons/react';
|
|
331
332
|
import { ChartDonutIcon as ChartDonut } from '@phosphor-icons/react';
|
|
333
|
+
import { TranslateIcon as Translate } from '@phosphor-icons/react';
|
|
332
334
|
import { SlidersHorizontalIcon as SlidersHorizontal } from '@phosphor-icons/react';
|
|
333
335
|
import { StackIcon as Stack } from '@phosphor-icons/react';
|
|
334
336
|
import { OkeGoogleIcon } from "./custom";
|
package/dist/icons/index.js
CHANGED
|
@@ -136,6 +136,7 @@ exports.icons = {
|
|
|
136
136
|
ChartBarHorizontal: react_1.ChartBarHorizontalIcon,
|
|
137
137
|
GridNine: react_1.GridNineIcon,
|
|
138
138
|
ChartDonut: react_1.ChartDonutIcon,
|
|
139
|
+
Translate: react_1.TranslateIcon,
|
|
139
140
|
SlidersHorizontal: react_1.SlidersHorizontalIcon,
|
|
140
141
|
Stack: react_1.StackIcon,
|
|
141
142
|
//custom icons
|
|
@@ -163,6 +163,11 @@ function DropdownMulti(_a) {
|
|
|
163
163
|
// hideShowOtherTextInputOnSelect_MULTI,
|
|
164
164
|
saveValueAsString: saveValueAsString
|
|
165
165
|
}); };
|
|
166
|
+
var handleClearAll = function () {
|
|
167
|
+
var newValForParent = saveValueAsString ? [] : [];
|
|
168
|
+
parentOnChange && parentOnChange(id, newValForParent);
|
|
169
|
+
setSearchString('');
|
|
170
|
+
};
|
|
166
171
|
var genDisplayComp = function () {
|
|
167
172
|
if (!(value === null || value === void 0 ? void 0 : value.length) > 0)
|
|
168
173
|
return null;
|
|
@@ -172,7 +177,7 @@ function DropdownMulti(_a) {
|
|
|
172
177
|
var _h = (0, react_1.useState)(false), focusSelectTagsInput = _h[0], setFocusSelectTagsInput = _h[1];
|
|
173
178
|
var genSelectTagsInput = function (ops) {
|
|
174
179
|
if (ops === void 0) { ops = {}; }
|
|
175
|
-
return (react_1.default.createElement(SelectTagsInput_1.SelectTagsInput, { id: id, value: value, handleSelect: handleSelect, searchString: searchString,
|
|
180
|
+
return (react_1.default.createElement(SelectTagsInput_1.SelectTagsInput, { id: id, value: value, handleSelect: handleSelect, handleClearAll: handleClearAll, searchString: searchString,
|
|
176
181
|
setSearchString: setSearchString,
|
|
177
182
|
single_multi: "multi", placeholder: placeholder, focusSelectTagsInput: focusSelectTagsInput, setFocusSelectTagsInput: setFocusSelectTagsInput, showOptions: showOptions, S: S, disabled: disabled, style: ops.style }));
|
|
178
183
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function SelectTagsInput({ id, value, disabled, handleSelect, searchString, setSearchString, placeholder, setFocusSelectTagsInput, focusSelectTagsInput, single_multi, showOptions, S, tagColor, style }: {
|
|
1
|
+
export function SelectTagsInput({ id, value, disabled, handleSelect, searchString, setSearchString, placeholder, setFocusSelectTagsInput, focusSelectTagsInput, single_multi, showOptions, S, handleClearAll, tagColor, style }: {
|
|
2
2
|
id: any;
|
|
3
3
|
value: any;
|
|
4
4
|
disabled: any;
|
|
@@ -11,6 +11,7 @@ export function SelectTagsInput({ id, value, disabled, handleSelect, searchStrin
|
|
|
11
11
|
single_multi: any;
|
|
12
12
|
showOptions: any;
|
|
13
13
|
S: any;
|
|
14
|
+
handleClearAll: any;
|
|
14
15
|
tagColor: any;
|
|
15
16
|
style: any;
|
|
16
17
|
}): React.JSX.Element;
|
|
@@ -38,12 +38,14 @@ var react_1 = __importStar(require("react"));
|
|
|
38
38
|
var styled_components_1 = require("styled-components");
|
|
39
39
|
var toArray_1 = require("../../../../../utils/toArray");
|
|
40
40
|
var utilsOolib_1 = require("../../../../../utilsOolib");
|
|
41
|
-
var styled_1 = require("../../styled");
|
|
42
41
|
var genTagComp_1 = require("../../utils/genTagComp");
|
|
43
|
-
var
|
|
42
|
+
var styled_1 = require("./styled");
|
|
44
43
|
var getKeyCode_1 = require("../../../../../utils/getKeyCode");
|
|
45
44
|
var themes_1 = require("../../../../themes");
|
|
45
|
+
var TextInputs_1 = require("../../../TextInputs");
|
|
46
|
+
var Buttons_1 = require("../../../Buttons");
|
|
46
47
|
var Typo2_1 = require("../../../Typo2");
|
|
48
|
+
var __1 = require("../../../../..");
|
|
47
49
|
var SelectTagsInput = function (_a) {
|
|
48
50
|
var
|
|
49
51
|
//from root
|
|
@@ -52,7 +54,7 @@ var SelectTagsInput = function (_a) {
|
|
|
52
54
|
handleSelect = _a.handleSelect, searchString = _a.searchString, setSearchString = _a.setSearchString, placeholder = _a.placeholder,
|
|
53
55
|
// minHeight, // standard | wide | actual height in rem
|
|
54
56
|
setFocusSelectTagsInput = _a.setFocusSelectTagsInput, focusSelectTagsInput = _a.focusSelectTagsInput, //force focus when after an option is selected in multiselect
|
|
55
|
-
single_multi = _a.single_multi, showOptions = _a.showOptions, S = _a.S, tagColor = _a.tagColor, style = _a.style;
|
|
57
|
+
single_multi = _a.single_multi, showOptions = _a.showOptions, S = _a.S, handleClearAll = _a.handleClearAll, tagColor = _a.tagColor, style = _a.style;
|
|
56
58
|
var inputRef = (0, react_1.useRef)(null);
|
|
57
59
|
var theme = (0, styled_components_1.useTheme)();
|
|
58
60
|
var localize = (0, utilsOolib_1.useLocale)();
|
|
@@ -74,32 +76,14 @@ var SelectTagsInput = function (_a) {
|
|
|
74
76
|
handleFocus(true);
|
|
75
77
|
}
|
|
76
78
|
}, [focusSelectTagsInput]);
|
|
77
|
-
var genSelectedTagsTextLabel = function () {
|
|
78
|
-
var TYPO_COMP = S ? Typo2_1.UI_BODY_SM : Typo2_1.UI_BODY;
|
|
79
|
-
return (react_1.default.createElement("div", { style: {
|
|
80
|
-
minHeight: S ? "2rem" : "3rem",
|
|
81
|
-
display: "flex",
|
|
82
|
-
alignItems: "center",
|
|
83
|
-
} },
|
|
84
|
-
react_1.default.createElement(TYPO_COMP, { color: disabled
|
|
85
|
-
? themes_1.colors.grey40
|
|
86
|
-
: themes_1.colors.grey80 }, "".concat(localize('Selected Tags'), ":"))));
|
|
87
|
-
};
|
|
88
79
|
var genSelectComp = function () {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return (react_1.default.createElement(styled_2.StyledSelectTagsInputContainer, { onKeyDown: blurInputOnEscKey,
|
|
97
|
-
// style={{ minHeight: '9rem' }}
|
|
98
|
-
style: style, className: "".concat(isFocussed ? "focussed" : ""), disabled: disabled, onFocus: function () {
|
|
99
|
-
handleFocus(true);
|
|
100
|
-
}, onBlur: function () { return handleFocus(false); }, tabIndex: 0 },
|
|
101
|
-
react_1.default.createElement(styled_1.StyledTagsInputWrapper, null,
|
|
102
|
-
genSelectedTagsTextLabel(),
|
|
80
|
+
return (react_1.default.createElement(styled_1.StyledSelectTagsWrapper, { style: style, disabled: disabled, className: "".concat(isFocussed ? "focussed" : "") },
|
|
81
|
+
react_1.default.createElement("div", { style: { display: "flex", gap: "0.4rem", alignItems: "center", height: "2.4rem" } },
|
|
82
|
+
" ",
|
|
83
|
+
single_multi === "multi" ?
|
|
84
|
+
react_1.default.createElement(Buttons_1.ButtonTertiaryCompact, { onClick: function () { return handleClearAll(); }, children: "Clear all", disabled: !value || !value.length })
|
|
85
|
+
:
|
|
86
|
+
react_1.default.createElement(Typo2_1.UI_BODY_SEMIBOLD_SM_DF, { style: { color: __1.colors2.grey50 } }, "Selected : "),
|
|
103
87
|
value &&
|
|
104
88
|
(0, toArray_1.toArray)(value).map(function (d) {
|
|
105
89
|
return (0, genTagComp_1.genTagComp)(id, d, {
|
|
@@ -110,11 +94,13 @@ var SelectTagsInput = function (_a) {
|
|
|
110
94
|
S: S,
|
|
111
95
|
color: tagColor
|
|
112
96
|
});
|
|
113
|
-
}),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
97
|
+
})),
|
|
98
|
+
react_1.default.createElement(TextInputs_1.TextInput, { onKeyDown: blurInputOnEscKey, onFocus: function () {
|
|
99
|
+
handleFocus(true);
|
|
100
|
+
}, ref: inputRef, className: S ? "UI_BODY_SM" : "UI_BODY", style: { color: themes_1.colors.grey80 }, placeholder: localize(placeholder || "Type to Search"), icon: "Tag", value: searchString, onBlur: function () {
|
|
101
|
+
handleFocus(false);
|
|
102
|
+
setFocusSelectTagsInput && setFocusSelectTagsInput(false);
|
|
103
|
+
}, onChange: function (id, v) { return setSearchString(v); } })));
|
|
118
104
|
};
|
|
119
105
|
return genSelectComp();
|
|
120
106
|
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export const
|
|
2
|
-
export const StyledSelectTagsInputContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
1
|
+
export const StyledSelectTagsWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -3,48 +3,11 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
3
3
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
4
|
return cooked;
|
|
5
5
|
};
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
39
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.
|
|
41
|
-
var styled_components_1 =
|
|
42
|
-
|
|
43
|
-
var
|
|
44
|
-
var themes_1 = require("../../../../themes");
|
|
45
|
-
exports.StyledTagsSelectTextInput = styled_components_1.default.input(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 100%;\n border: 0;\n width: 100%;\n background-color: inherit;\n \n // this strange bit is to fix the 'zoom into input' issue on ios\n margin: 0 -2rem;\n ", "\n &:focus {\n border: 0;\n }\n\n &::placeholder {\n color: ", ";\n }\n"], ["\n height: 100%;\n border: 0;\n width: 100%;\n background-color: inherit;\n \n // this strange bit is to fix the 'zoom into input' issue on ios\n margin: 0 -2rem;\n ", "\n &:focus {\n border: 0;\n }\n\n &::placeholder {\n color: ", ";\n }\n"])), globalVariables_1.globalInputElemPadding, themes_1.colors.grey40);
|
|
46
|
-
exports.StyledSelectTagsInputContainer = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n cursor: pointer;\n position: relative;\n border-radius: 2px;\n background-color: ", ";\n padding: 1rem 2rem 1rem 2rem;\n ", "\n\n ", ";\n\n ", "\n ", "\n\n height: auto;\n align-items: flex-start;\n"], ["\n cursor: pointer;\n position: relative;\n border-radius: 2px;\n background-color: ", ";\n padding: 1rem 2rem 1rem 2rem;\n ", "\n\n ", ";\n\n ", "\n ", "\n\n height: auto;\n align-items: flex-start;\n"])), themes_1.colors.grey5, function (_a) {
|
|
47
|
-
var disabled = _a.disabled;
|
|
48
|
-
return disabled && (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n pointer-events: none;\n "], ["\n pointer-events: none;\n "])));
|
|
49
|
-
}, (0, mixins_1.transition)("background-color"), globalVariables_1.globalInputElemFocused, globalVariables_1.globalInputElemHover);
|
|
50
|
-
var templateObject_1, templateObject_2, templateObject_3;
|
|
10
|
+
exports.StyledSelectTagsWrapper = void 0;
|
|
11
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
+
exports.StyledSelectTagsWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 0.8rem;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 0.8rem;\n"])));
|
|
13
|
+
var templateObject_1;
|
|
@@ -14,7 +14,11 @@ var genTagComp = function (id, d, options) {
|
|
|
14
14
|
switch (true) {
|
|
15
15
|
case !options.display:
|
|
16
16
|
return (react_1.default.createElement("div", { tabIndex: 0, style: { minWidth: 0 }, onFocus: function (e) { return !showOptions && e.stopPropagation(); } },
|
|
17
|
-
react_1.default.createElement(Tags_1.TagClear
|
|
17
|
+
react_1.default.createElement(Tags_1.TagClear
|
|
18
|
+
// size={options.S}
|
|
19
|
+
, {
|
|
20
|
+
// size={options.S}
|
|
21
|
+
grey: true, display: d.display, onClick: function (e) {
|
|
18
22
|
e.stopPropagation();
|
|
19
23
|
options.handleSelect(options.single_multi === "single" ? undefined : d);
|
|
20
24
|
} })));
|
|
@@ -25,6 +25,7 @@ var getAllOptionsFns_1 = require("./getAllOptionsFns");
|
|
|
25
25
|
// }
|
|
26
26
|
var getValue_SINGLE = function (_a) {
|
|
27
27
|
var _b;
|
|
28
|
+
var _c;
|
|
28
29
|
var valueProp = _a.valueProp, optionsFn = _a.optionsFn, options = _a.options, theme = _a.theme, saveValueAsString = _a.saveValueAsString;
|
|
29
30
|
if (!saveValueAsString)
|
|
30
31
|
return valueProp;
|
|
@@ -33,7 +34,7 @@ var getValue_SINGLE = function (_a) {
|
|
|
33
34
|
// For grouped data, search through all options in all groups
|
|
34
35
|
for (var _i = 0, allOptions_1 = allOptions; _i < allOptions_1.length; _i++) {
|
|
35
36
|
var group = allOptions_1[_i];
|
|
36
|
-
var found = group.options.find(function (d) { return d.value === valueProp; });
|
|
37
|
+
var found = (_c = group.options) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.value === valueProp; });
|
|
37
38
|
if (found)
|
|
38
39
|
return found;
|
|
39
40
|
}
|
|
@@ -41,7 +42,7 @@ var getValue_SINGLE = function (_a) {
|
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
43
44
|
// For normal data, search directly
|
|
44
|
-
return allOptions.find(function (d) { return d.value === valueProp; });
|
|
45
|
+
return allOptions === null || allOptions === void 0 ? void 0 : allOptions.find(function (d) { return d.value === valueProp; });
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
48
|
exports.getValue_SINGLE = getValue_SINGLE;
|
|
@@ -55,9 +56,10 @@ var getValue_MULTI = function (_a) {
|
|
|
55
56
|
if ((0, List_1.isGroupedData)(allOptions)) {
|
|
56
57
|
// For grouped data, map each value and search through all options in all groups
|
|
57
58
|
return valueProp.map(function (vProp) {
|
|
59
|
+
var _a;
|
|
58
60
|
for (var _i = 0, allOptions_2 = allOptions; _i < allOptions_2.length; _i++) {
|
|
59
61
|
var group = allOptions_2[_i];
|
|
60
|
-
var found = group.options.find(function (d) { return d.value === vProp; });
|
|
62
|
+
var found = (_a = group.options) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.value === vProp; });
|
|
61
63
|
if (found)
|
|
62
64
|
return found;
|
|
63
65
|
}
|
|
@@ -67,7 +69,7 @@ var getValue_MULTI = function (_a) {
|
|
|
67
69
|
else {
|
|
68
70
|
// For normal data, map directly
|
|
69
71
|
return valueProp.map(function (vProp) {
|
|
70
|
-
return allOptions.find(function (d) { return d.value === vProp; });
|
|
72
|
+
return allOptions === null || allOptions === void 0 ? void 0 : allOptions.find(function (d) { return d.value === vProp; });
|
|
71
73
|
}).filter(Boolean); // Remove any undefined values
|
|
72
74
|
}
|
|
73
75
|
};
|