oolib 2.206.3 → 2.206.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.
|
@@ -6,11 +6,6 @@ var getKeyCode_1 = require("../../../../utils/getKeyCode");
|
|
|
6
6
|
var useKeyboardControl = function (_a) {
|
|
7
7
|
var showOptions = _a.showOptions, handleHideOptions = _a.handleHideOptions, optionsWrapperRef = _a.optionsWrapperRef, handleSelect = _a.handleSelect, options = _a.options, searchString = _a.searchString, id = _a.id;
|
|
8
8
|
var _b = (0, react_1.useState)(-1), focussedOp = _b[0], setFocussedOp = _b[1];
|
|
9
|
-
var hasMountedRef = (0, react_1.useRef)(false);
|
|
10
|
-
// Track if component has mounted to prevent initial scroll
|
|
11
|
-
(0, react_1.useEffect)(function () {
|
|
12
|
-
hasMountedRef.current = true;
|
|
13
|
-
}, []);
|
|
14
9
|
// if search string is not empty, then reset focussedOp to first op
|
|
15
10
|
// else set it to minus 1
|
|
16
11
|
(0, react_1.useEffect)(function () {
|
|
@@ -26,6 +21,12 @@ var useKeyboardControl = function (_a) {
|
|
|
26
21
|
}, [showOptions]);
|
|
27
22
|
(0, react_1.useEffect)(function () {
|
|
28
23
|
var handleKeyDown = function (e) {
|
|
24
|
+
if (!showOptions)
|
|
25
|
+
return;
|
|
26
|
+
/**
|
|
27
|
+
* dont prevent default outside the condition, else
|
|
28
|
+
* all other key actions stop working..
|
|
29
|
+
*/
|
|
29
30
|
var code = (0, getKeyCode_1.getKeyCode)(e);
|
|
30
31
|
if (code === 'Enter') {
|
|
31
32
|
if (options[focussedOp])
|
|
@@ -49,8 +50,8 @@ var useKeyboardControl = function (_a) {
|
|
|
49
50
|
return function () { return window.removeEventListener('keydown', handleKeyDown); };
|
|
50
51
|
});
|
|
51
52
|
var scrollFocussedOpIntoView = function (el) {
|
|
52
|
-
//
|
|
53
|
-
if (!
|
|
53
|
+
// Only scroll if options are actually showing to prevent unwanted auto-scroll
|
|
54
|
+
if (!showOptions)
|
|
54
55
|
return;
|
|
55
56
|
var _a = el.getBoundingClientRect(), elBottom = _a.bottom, elTop = _a.top;
|
|
56
57
|
var _b = optionsWrapperRef.current.getBoundingClientRect(), opsWrapperBottom = _b.bottom, opsWrapperTop = _b.top;
|
|
@@ -1,41 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
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
|
-
})();
|
|
39
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
40
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
41
4
|
};
|
|
@@ -45,20 +8,17 @@ var react_1 = __importDefault(require("react"));
|
|
|
45
8
|
var styled_1 = require("./styled");
|
|
46
9
|
var icons_1 = require("../../../../../icons");
|
|
47
10
|
var styled_2 = require("./styled");
|
|
48
|
-
var styled_components_1 =
|
|
11
|
+
var styled_components_1 = require("styled-components");
|
|
49
12
|
var themes_1 = require("../../../../themes");
|
|
50
|
-
var mixins_1 = require("../../../../../themes/mixins");
|
|
51
13
|
var grey40 = themes_1.colors.grey40;
|
|
52
14
|
var Tag = function (_a) {
|
|
53
15
|
var id = _a.id, _b = _a.fill, fill = _b === void 0 ? "solid" : _b, _c = _a.size, size = _c === void 0 ? "S" : _c, display = _a.display, icon = _a.icon, weight = _a.weight, onClick = _a.onClick, variant = _a.variant, typo = _a.typo, badgeColor = _a.badgeColor, style = _a.style;
|
|
54
16
|
var Icon = icons_1.icons[icon];
|
|
55
17
|
var theme = (0, styled_components_1.useTheme)();
|
|
56
18
|
var Typo = typo || styled_2.Styled_UI_CAPTION_DF;
|
|
57
|
-
// ellipsis style to props typo
|
|
58
|
-
var StyledTypo = typo ? (0, styled_components_1.default)(Typo)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["", ""], ["", ""])), mixins_1.ellipsis) : Typo;
|
|
59
19
|
return (react_1.default.createElement(styled_1.StyledTag, { id: id, fill: fill, size: size, icon: icon, onClick: onClick, variant: variant, colors: theme === null || theme === void 0 ? void 0 : theme.colors, style: style },
|
|
60
20
|
badgeColor && react_1.default.createElement("div", { style: { background: badgeColor, width: "1rem", height: "1rem", borderRadius: "50%", marginRight: "0.2rem" } }),
|
|
61
|
-
react_1.default.createElement(
|
|
21
|
+
react_1.default.createElement(Typo, { weight: weight },
|
|
62
22
|
" ",
|
|
63
23
|
display,
|
|
64
24
|
" "),
|
|
@@ -67,4 +27,3 @@ var Tag = function (_a) {
|
|
|
67
27
|
react_1.default.createElement(Icon, { size: size === "XS" ? 10 : 12, weight: "bold", style: { color: grey40 } }))));
|
|
68
28
|
};
|
|
69
29
|
exports.Tag = Tag;
|
|
70
|
-
var templateObject_1;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
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
|
+
};
|
|
2
6
|
var __assign = (this && this.__assign) || function () {
|
|
3
7
|
__assign = Object.assign || function(t) {
|
|
4
8
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -20,12 +24,16 @@ var Typo2_1 = require("../../../Typo2");
|
|
|
20
24
|
var Tag_1 = require("../Tag");
|
|
21
25
|
var themes_1 = require("../../../../themes");
|
|
22
26
|
var getTagDisplayStyles_1 = require("./getTagDisplayStyles");
|
|
27
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
28
|
+
var mixins_1 = require("../../../../../themes/mixins");
|
|
23
29
|
var white = themes_1.colors.white;
|
|
30
|
+
var STYLED_UI_TAG_DF = (0, styled_components_1.default)(Typo2_1.UI_TAG_DF)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), mixins_1.ellipsis);
|
|
24
31
|
var TagDisplay = function (_a) {
|
|
25
32
|
var id = _a.id, display = _a.display, size = _a.size,
|
|
26
33
|
// tagColor,
|
|
27
34
|
// textColor,
|
|
28
35
|
fill = _a.fill, icon = _a.icon, _b = _a.colorPreset, colorPreset = _b === void 0 ? 'default' : _b, weight = _a.weight;
|
|
29
|
-
return (react_1.default.createElement(Tag_1.Tag, { weight: weight, id: id, display: display, icon: icon, size: size, fill: fill, style: __assign({ padding: "0.25rem 0.5rem", borderRadius: "4px", color: white }, (0, getTagDisplayStyles_1.getTagDisplayStyles)({ colorPreset: colorPreset })), typo:
|
|
36
|
+
return (react_1.default.createElement(Tag_1.Tag, { weight: weight, id: id, display: display, icon: icon, size: size, fill: fill, style: __assign({ padding: "0.25rem 0.5rem", borderRadius: "4px", color: white }, (0, getTagDisplayStyles_1.getTagDisplayStyles)({ colorPreset: colorPreset })), typo: STYLED_UI_TAG_DF }));
|
|
30
37
|
};
|
|
31
38
|
exports.TagDisplay = TagDisplay;
|
|
39
|
+
var templateObject_1;
|