@jetbrains/ring-ui-built 7.0.0-beta.2 → 7.0.0-beta.3
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/components/_helpers/_rollupPluginBabelHelpers.js +1 -504
- package/components/_helpers/anchor.js +7 -5
- package/components/_helpers/button__classes.js +15 -13
- package/components/_helpers/caption.js +11 -17
- package/components/_helpers/card.js +92 -96
- package/components/_helpers/dialog__body-scroll-preventer.js +10 -17
- package/components/_helpers/icon__svg.js +27 -23
- package/components/_helpers/input.js +150 -171
- package/components/_helpers/query-assist__suggestions.js +78 -93
- package/components/_helpers/select__filter.js +56 -67
- package/components/_helpers/services-link.js +23 -29
- package/components/_helpers/sidebar.js +91 -93
- package/components/_helpers/tab-link.js +8 -6
- package/components/_helpers/theme.js +41 -50
- package/components/_helpers/title.js +59 -69
- package/components/alert/alert.js +112 -156
- package/components/alert/container.js +32 -39
- package/components/alert-service/alert-service.js +104 -161
- package/components/analytics/analytics.js +12 -20
- package/components/analytics/analytics__custom-plugin.js +52 -68
- package/components/auth/auth.js +2 -27
- package/components/auth/auth__core.d.ts +1 -1
- package/components/auth/auth__core.js +742 -1428
- package/components/auth/background-flow.js +84 -121
- package/components/auth/down-notification.js +31 -69
- package/components/auth/iframe-flow.js +70 -123
- package/components/auth/request-builder.js +46 -77
- package/components/auth/response-parser.js +84 -112
- package/components/auth/storage.js +160 -318
- package/components/auth/token-validator.js +132 -227
- package/components/auth/window-flow.js +84 -121
- package/components/auth-dialog/auth-dialog.js +99 -150
- package/components/auth-dialog-service/auth-dialog-service.js +6 -26
- package/components/avatar/avatar-example-datauri.js +1 -1
- package/components/avatar/avatar.js +94 -123
- package/components/avatar/fallback-avatar.js +20 -34
- package/components/badge/badge.js +32 -38
- package/components/breadcrumbs/breadcrumbs.js +13 -17
- package/components/button/button.js +67 -80
- package/components/button-group/button-group.js +27 -36
- package/components/button-set/button-set.js +19 -27
- package/components/button-toolbar/button-toolbar.js +17 -25
- package/components/caret/caret.js +184 -211
- package/components/checkbox/checkbox.js +69 -86
- package/components/clipboard/clipboard-fallback.js +7 -7
- package/components/clipboard/clipboard.js +36 -128
- package/components/code/code.js +83 -151
- package/components/collapse/collapse-content.js +42 -60
- package/components/collapse/collapse-context.js +2 -2
- package/components/collapse/collapse-control.js +12 -12
- package/components/collapse/collapse.js +12 -17
- package/components/collapse/consts.js +4 -4
- package/components/collapse/utils.js +1 -3
- package/components/confirm/confirm.js +57 -87
- package/components/confirm-service/confirm-service.js +23 -44
- package/components/content-layout/content-layout.js +41 -56
- package/components/content-layout/sidebar.js +1 -1
- package/components/contenteditable/contenteditable.js +38 -46
- package/components/control-help/control-help.js +5 -3
- package/components/control-label/control-label.js +9 -8
- package/components/data-list/data-list.js +113 -156
- package/components/data-list/data-list.mock.js +3 -5
- package/components/data-list/item.js +120 -140
- package/components/data-list/selection.js +77 -135
- package/components/data-list/title.js +2 -10
- package/components/date-picker/consts.js +16 -22
- package/components/date-picker/date-input.js +99 -124
- package/components/date-picker/date-picker.js +140 -184
- package/components/date-picker/date-popup.js +280 -327
- package/components/date-picker/day.js +71 -94
- package/components/date-picker/month-names.js +41 -59
- package/components/date-picker/month-slider.js +42 -61
- package/components/date-picker/month.js +17 -24
- package/components/date-picker/months.js +44 -49
- package/components/date-picker/weekdays.js +12 -21
- package/components/date-picker/years.js +77 -98
- package/components/dialog/dialog.js +151 -187
- package/components/dialog/dialog__body-scroll-preventer.js +0 -3
- package/components/dropdown/anchor.js +0 -6
- package/components/dropdown/dropdown.js +134 -154
- package/components/dropdown-menu/dropdown-menu.js +59 -87
- package/components/editable-heading/editable-heading.js +69 -116
- package/components/error-bubble/error-bubble.js +29 -54
- package/components/error-message/error-message.js +34 -49
- package/components/footer/footer.js +27 -28
- package/components/global/compose.js +1 -8
- package/components/global/composeRefs.d.ts +0 -3
- package/components/global/composeRefs.js +8 -15
- package/components/global/controls-height.js +2 -2
- package/components/global/create-stateful-context.js +14 -13
- package/components/global/data-tests.js +7 -12
- package/components/global/dom.js +49 -82
- package/components/global/focus-sensor-hoc.js +99 -106
- package/components/global/fuzzy-highlight.js +23 -34
- package/components/global/get-event-key.js +8 -8
- package/components/global/get-uid.js +3 -7
- package/components/global/inject-styles.js +7 -14
- package/components/global/listeners.js +28 -47
- package/components/global/memoize.js +6 -10
- package/components/global/normalize-indent.js +19 -46
- package/components/global/promise-with-timeout.js +6 -8
- package/components/global/prop-types.js +3 -5
- package/components/global/react-dom-renderer.js +29 -40
- package/components/global/rerender-hoc.js +16 -32
- package/components/global/schedule-raf.js +4 -4
- package/components/global/sniffer.js +1 -1
- package/components/global/theme.js +1 -18
- package/components/global/trivial-template-tag.js +4 -9
- package/components/global/typescript-utils.js +2 -6
- package/components/global/url.js +20 -23
- package/components/global/use-event-callback.js +7 -4
- package/components/grid/col.js +27 -39
- package/components/grid/grid.js +18 -27
- package/components/grid/row.js +23 -30
- package/components/group/group.js +16 -22
- package/components/header/header-icon.js +19 -31
- package/components/header/header.d.ts +0 -1
- package/components/header/header.js +30 -64
- package/components/header/links.js +6 -3
- package/components/header/logo.js +15 -26
- package/components/header/profile.js +124 -150
- package/components/header/services-link.js +1 -3
- package/components/header/services.js +64 -97
- package/components/header/smart-profile.js +101 -178
- package/components/header/smart-services.js +55 -90
- package/components/header/tray.js +21 -30
- package/components/heading/heading.js +21 -20
- package/components/http/http.js +162 -319
- package/components/http/http.mock.js +50 -98
- package/components/hub-source/hub-source.js +77 -182
- package/components/hub-source/hub-source__user.js +9 -37
- package/components/hub-source/hub-source__users-groups.js +34 -60
- package/components/i18n/i18n-context.js +7 -8
- package/components/i18n/i18n.js +3 -6
- package/components/icon/icon.js +60 -74
- package/components/icon/icon__svg.js +0 -5
- package/components/icon/index.js +0 -5
- package/components/input/input.js +1 -11
- package/components/island/adaptive-island-hoc.js +29 -37
- package/components/island/content.js +100 -110
- package/components/island/header.js +56 -66
- package/components/island/island.js +25 -33
- package/components/island-legacy/content-legacy.js +16 -22
- package/components/island-legacy/header-legacy.js +19 -25
- package/components/island-legacy/island-legacy.js +16 -22
- package/components/link/clickableLink.js +33 -42
- package/components/link/link.js +47 -55
- package/components/list/consts.js +2 -2
- package/components/list/list.js +399 -486
- package/components/list/list__custom.js +51 -61
- package/components/list/list__hint.js +9 -17
- package/components/list/list__item.js +147 -178
- package/components/list/list__link.js +38 -47
- package/components/list/list__separator.js +15 -24
- package/components/list/list__title.js +25 -34
- package/components/list/list__users-groups-source.js +55 -121
- package/components/loader/loader.js +38 -60
- package/components/loader/loader__core.js +123 -184
- package/components/loader-inline/loader-inline.js +24 -32
- package/components/loader-screen/loader-screen.js +24 -40
- package/components/login-dialog/login-dialog.js +81 -121
- package/components/login-dialog/service.js +6 -29
- package/components/markdown/markdown.js +16 -24
- package/components/message/message.js +170 -201
- package/components/old-browsers-message/old-browsers-message.js +11 -14
- package/components/old-browsers-message/old-browsers-message__stop.js +1 -4
- package/components/old-browsers-message/white-list.js +8 -13
- package/components/pager/pager.js +212 -257
- package/components/panel/panel.js +16 -22
- package/components/permissions/permissions.js +118 -161
- package/components/permissions/permissions__cache.js +191 -218
- package/components/popup/popup.consts.js +1 -1
- package/components/popup/popup.js +237 -288
- package/components/popup/popup.target.js +9 -7
- package/components/popup/position.js +94 -101
- package/components/popup-menu/popup-menu.js +33 -67
- package/components/progress-bar/progress-bar.js +57 -68
- package/components/query-assist/query-assist.js +583 -652
- package/components/query-assist/query-assist__suggestions.js +2 -26
- package/components/radio/radio.js +15 -27
- package/components/radio/radio__item.js +52 -62
- package/components/scrollable-section/scrollable-section.js +22 -32
- package/components/select/select.js +693 -793
- package/components/select/select__filter.js +1 -26
- package/components/select/select__popup.js +316 -413
- package/components/shortcuts/core.js +147 -195
- package/components/shortcuts/shortcut-title.js +6 -10
- package/components/shortcuts/shortcuts-hoc.js +23 -41
- package/components/shortcuts/shortcuts.js +41 -64
- package/components/slider/slider.js +93 -112
- package/components/slider/slider.utils.js +16 -23
- package/components/storage/storage.js +3 -27
- package/components/storage/storage__fallback.js +137 -210
- package/components/storage/storage__local.js +89 -147
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +35 -53
- package/components/table/cell.js +11 -21
- package/components/table/disable-hover-hoc.js +27 -42
- package/components/table/header-cell.js +59 -75
- package/components/table/header.js +89 -110
- package/components/table/multitable.js +83 -89
- package/components/table/row-with-focus-sensor.js +25 -57
- package/components/table/row.js +169 -200
- package/components/table/selection-adapter.js +2 -2
- package/components/table/selection-shortcuts-hoc.js +108 -113
- package/components/table/selection.js +150 -217
- package/components/table/simple-table.js +19 -55
- package/components/table/smart-table.js +42 -76
- package/components/table/table.js +267 -327
- package/components/tabs/collapsible-more.js +47 -73
- package/components/tabs/collapsible-tab.js +32 -36
- package/components/tabs/collapsible-tabs.js +89 -148
- package/components/tabs/custom-item.js +4 -2
- package/components/tabs/dumb-tabs.js +60 -92
- package/components/tabs/smart-tabs.js +29 -61
- package/components/tabs/tab-link.js +1 -3
- package/components/tabs/tab.js +15 -24
- package/components/tabs/tabs.js +1 -26
- package/components/tag/tag.d.ts +0 -2
- package/components/tag/tag.js +120 -162
- package/components/tags-input/tags-input.js +222 -304
- package/components/tags-list/tags-list.js +45 -61
- package/components/text/text.js +28 -37
- package/components/toggle/toggle.js +51 -61
- package/components/tooltip/tooltip.js +109 -141
- package/components/user-agreement/service.js +259 -400
- package/components/user-agreement/user-agreement.js +80 -108
- package/components/user-card/card.js +1 -25
- package/components/user-card/smart-user-card-tooltip.js +52 -103
- package/components/user-card/tooltip.js +35 -65
- package/components/user-card/user-card.js +1 -25
- package/package.json +1 -1
- package/components/global/react-render-adapter.d.ts +0 -1
- package/components/global/react-render-adapter.js +0 -6
- package/components/header/tray-icon.d.ts +0 -1
- package/components/header/tray-icon.js +0 -26
@@ -1,26 +1,19 @@
|
|
1
|
-
import 'core-js/modules/es.object.to-string.js';
|
2
|
-
import 'core-js/modules/web.dom-collections.for-each.js';
|
3
1
|
import memoizeOne from 'memoize-one';
|
4
|
-
import deprecate from 'util-deprecate';
|
5
2
|
|
6
3
|
function composeRefs() {
|
7
4
|
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
8
5
|
refs[_key] = arguments[_key];
|
9
6
|
}
|
10
|
-
return
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
});
|
18
|
-
};
|
7
|
+
return value => refs.forEach(ref => {
|
8
|
+
if (typeof ref === 'function') {
|
9
|
+
ref(value);
|
10
|
+
} else if (ref != null) {
|
11
|
+
ref.current = value;
|
12
|
+
}
|
13
|
+
});
|
19
14
|
}
|
20
|
-
// TODO remove export in 7.0, composeRefs should be used only in createComposedRef and in useComposedRefs in the future
|
21
|
-
var composeRefs$1 = deprecate(composeRefs, 'composeRefs is deprecated and will be removed in 7.0. Use createComposedRef instead.');
|
22
15
|
function createComposedRef() {
|
23
16
|
return memoizeOne(composeRefs);
|
24
17
|
}
|
25
18
|
|
26
|
-
export { createComposedRef
|
19
|
+
export { createComposedRef };
|
@@ -6,8 +6,8 @@ var ControlsHeight;
|
|
6
6
|
ControlsHeight["M"] = "M";
|
7
7
|
ControlsHeight["L"] = "L";
|
8
8
|
})(ControlsHeight || (ControlsHeight = {}));
|
9
|
-
|
10
|
-
|
9
|
+
const ControlsHeightContext = /*#__PURE__*/createContext(ControlsHeight.M);
|
10
|
+
let globalControlsHeight = ControlsHeight.M;
|
11
11
|
// This can be used if React Context is not applicable, for example for alertService or Auth dialog
|
12
12
|
function configureGlobalControlsHeight(value) {
|
13
13
|
globalControlsHeight = value;
|
@@ -1,18 +1,17 @@
|
|
1
|
-
import
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
2
2
|
import { memo, createContext, useState, useContext, useEffect } from 'react';
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
5
5
|
|
6
6
|
function createStatefulContext(initialValue) {
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
8
|
+
const ValueContext = /*#__PURE__*/createContext(initialValue);
|
9
|
+
const UpdateContext = /*#__PURE__*/createContext(() => {});
|
10
10
|
function Provider(_ref) {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
update = _useState2[1];
|
11
|
+
let {
|
12
|
+
children
|
13
|
+
} = _ref;
|
14
|
+
const [value, update] = useState(initialValue);
|
16
15
|
return /*#__PURE__*/jsx(ValueContext.Provider, {
|
17
16
|
value: value,
|
18
17
|
children: /*#__PURE__*/jsx(UpdateContext.Provider, {
|
@@ -26,16 +25,18 @@ function createStatefulContext(initialValue) {
|
|
26
25
|
};
|
27
26
|
Provider.displayName = "".concat(name, "Provider");
|
28
27
|
function useUpdate(value, skipUpdate) {
|
29
|
-
|
30
|
-
useEffect(
|
28
|
+
const update = useContext(UpdateContext);
|
29
|
+
useEffect(() => {
|
31
30
|
if (!skipUpdate) {
|
32
31
|
update(value);
|
33
32
|
}
|
34
33
|
}, [update, value, skipUpdate]);
|
35
34
|
}
|
36
35
|
function Updater(_ref2) {
|
37
|
-
|
38
|
-
|
36
|
+
let {
|
37
|
+
value,
|
38
|
+
skipUpdate
|
39
|
+
} = _ref2;
|
39
40
|
useUpdate(value, skipUpdate);
|
40
41
|
return null;
|
41
42
|
}
|
@@ -1,29 +1,24 @@
|
|
1
|
-
import { j as _toConsumableArray, i as _slicedToArray } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
-
import 'core-js/modules/es.array.concat.js';
|
3
1
|
import 'core-js/modules/es.array.reduce.js';
|
4
|
-
import 'core-js/modules/
|
5
|
-
import 'core-js/modules/es.object.to-string.js';
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
6
3
|
|
7
4
|
function expandMap(attrsMap) {
|
8
|
-
return Object.entries(attrsMap).reduce(
|
9
|
-
|
10
|
-
|
11
|
-
value = _ref2[1];
|
12
|
-
return value ? [].concat(_toConsumableArray(result), [key]) : result;
|
5
|
+
return Object.entries(attrsMap).reduce((result, _ref) => {
|
6
|
+
let [key, value] = _ref;
|
7
|
+
return value ? [...result, key] : result;
|
13
8
|
}, []);
|
14
9
|
}
|
15
10
|
function joinDataTestAttributes() {
|
16
11
|
for (var _len = arguments.length, attrs = new Array(_len), _key = 0; _key < _len; _key++) {
|
17
12
|
attrs[_key] = arguments[_key];
|
18
13
|
}
|
19
|
-
return attrs.reduce(
|
14
|
+
return attrs.reduce((result, attr) => {
|
20
15
|
if (!attr) {
|
21
16
|
return result;
|
22
17
|
}
|
23
18
|
if (typeof attr === 'object') {
|
24
|
-
return [
|
19
|
+
return [...result, ...expandMap(attr)];
|
25
20
|
}
|
26
|
-
return [
|
21
|
+
return [...result, attr];
|
27
22
|
}, []).join(' ');
|
28
23
|
}
|
29
24
|
|
package/components/global/dom.js
CHANGED
@@ -1,26 +1,18 @@
|
|
1
|
-
import {
|
2
|
-
import 'core-js/modules/es.array.filter.js';
|
3
|
-
import 'core-js/modules/es.array.iterator.js';
|
4
|
-
import 'core-js/modules/es.object.assign.js';
|
5
|
-
import 'core-js/modules/es.object.entries.js';
|
6
|
-
import 'core-js/modules/es.object.to-string.js';
|
1
|
+
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
7
2
|
import 'core-js/modules/es.regexp.exec.js';
|
8
|
-
import 'core-js/modules/es.set.js';
|
9
|
-
import 'core-js/modules/es.string.split.js';
|
10
|
-
import 'core-js/modules/web.dom-collections.for-each.js';
|
11
3
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
12
4
|
|
13
5
|
/**
|
14
6
|
* @name DOM
|
15
7
|
*/
|
16
|
-
|
8
|
+
const getStyles = window.getComputedStyle.bind(window);
|
17
9
|
function isMounted(node) {
|
18
10
|
if (node === document) {
|
19
11
|
return true;
|
20
12
|
}
|
21
13
|
return node instanceof Node && document.documentElement.contains(node.parentNode);
|
22
14
|
}
|
23
|
-
|
15
|
+
const rectStub = {
|
24
16
|
top: 0,
|
25
17
|
right: 0,
|
26
18
|
bottom: 0,
|
@@ -30,13 +22,14 @@ var rectStub = {
|
|
30
22
|
};
|
31
23
|
function getRect(node) {
|
32
24
|
if (node instanceof Range || node != null && isMounted(node)) {
|
33
|
-
|
34
|
-
top
|
35
|
-
right
|
36
|
-
bottom
|
37
|
-
left
|
38
|
-
width
|
39
|
-
height
|
25
|
+
const {
|
26
|
+
top,
|
27
|
+
right,
|
28
|
+
bottom,
|
29
|
+
left,
|
30
|
+
width,
|
31
|
+
height
|
32
|
+
} = node.getBoundingClientRect();
|
40
33
|
return {
|
41
34
|
top,
|
42
35
|
right,
|
@@ -59,11 +52,12 @@ function getWindowWidth() {
|
|
59
52
|
return window.innerWidth;
|
60
53
|
}
|
61
54
|
function isNodeInVisiblePartOfPage(node) {
|
62
|
-
|
63
|
-
top
|
64
|
-
bottom
|
65
|
-
left
|
66
|
-
right
|
55
|
+
const {
|
56
|
+
top,
|
57
|
+
bottom,
|
58
|
+
left,
|
59
|
+
right
|
60
|
+
} = getRect(node);
|
67
61
|
return !(bottom < 0 || right < 0 || getWindowHeight() - top < 0 || getWindowWidth() - left < 0);
|
68
62
|
}
|
69
63
|
function getDocumentScrollTop() {
|
@@ -72,74 +66,47 @@ function getDocumentScrollTop() {
|
|
72
66
|
function getDocumentScrollLeft() {
|
73
67
|
return document.documentElement && document.documentElement.scrollLeft || document.body.scrollLeft;
|
74
68
|
}
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
classes.split(/\s+/g).filter(function (className) {
|
79
|
-
return !!className;
|
80
|
-
}).forEach(function (className) {
|
81
|
-
return classList[method](className);
|
82
|
-
});
|
83
|
-
};
|
84
|
-
};
|
85
|
-
var addClasses = applyMethodToClasses('add');
|
86
|
-
var removeClasses = applyMethodToClasses('remove');
|
87
|
-
var toggleClasses = function toggleClasses(classList, classes) {
|
88
|
-
return Object.entries(classes).forEach(function (_ref) {
|
89
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
90
|
-
className = _ref2[0],
|
91
|
-
on = _ref2[1];
|
92
|
-
return classList.toggle(className, on);
|
93
|
-
});
|
69
|
+
const applyMethodToClasses = method => function (classList) {
|
70
|
+
let classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
71
|
+
classes.split(/\s+/g).filter(className => !!className).forEach(className => classList[method](className));
|
94
72
|
};
|
73
|
+
const addClasses = applyMethodToClasses('add');
|
74
|
+
const removeClasses = applyMethodToClasses('remove');
|
75
|
+
const toggleClasses = (classList, classes) => Object.entries(classes).forEach(_ref => {
|
76
|
+
let [className, on] = _ref;
|
77
|
+
return classList.toggle(className, on);
|
78
|
+
});
|
95
79
|
function setRootStyleProperties() {
|
96
|
-
|
97
|
-
|
98
|
-
Object.entries(properties).forEach(
|
99
|
-
|
100
|
-
key = _ref4[0],
|
101
|
-
value = _ref4[1];
|
80
|
+
let properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
81
|
+
const rootStyle = document.documentElement.style;
|
82
|
+
Object.entries(properties).forEach(_ref2 => {
|
83
|
+
let [key, value] = _ref2;
|
102
84
|
rootStyle.setProperty(key, value);
|
103
85
|
});
|
104
86
|
}
|
105
87
|
function resetRootStyleProperties() {
|
106
|
-
|
107
|
-
|
108
|
-
Object.keys(properties).forEach(
|
109
|
-
return rootStyle.removeProperty(key);
|
110
|
-
});
|
88
|
+
let properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
89
|
+
const rootStyle = document.documentElement.style;
|
90
|
+
Object.keys(properties).forEach(key => rootStyle.removeProperty(key));
|
111
91
|
}
|
112
|
-
|
113
|
-
|
114
|
-
_classCallCheck(this, Listeners);
|
92
|
+
class Listeners {
|
93
|
+
constructor() {
|
115
94
|
_defineProperty(this, "_all", new Set());
|
116
95
|
}
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
this._all.delete(fn);
|
132
|
-
}
|
133
|
-
}, {
|
134
|
-
key: "removeAll",
|
135
|
-
value: function removeAll() {
|
136
|
-
var _this = this;
|
137
|
-
this._all.forEach(function (fn) {
|
138
|
-
return _this.remove(fn);
|
139
|
-
});
|
140
|
-
}
|
141
|
-
}]);
|
142
|
-
}();
|
96
|
+
add(el, event, handler, options) {
|
97
|
+
el.addEventListener(event, handler, options);
|
98
|
+
const dispatchFn = () => el.removeEventListener(event, handler, options);
|
99
|
+
this._all.add(dispatchFn);
|
100
|
+
return dispatchFn;
|
101
|
+
}
|
102
|
+
remove(fn) {
|
103
|
+
fn();
|
104
|
+
this._all.delete(fn);
|
105
|
+
}
|
106
|
+
removeAll() {
|
107
|
+
this._all.forEach(fn => this.remove(fn));
|
108
|
+
}
|
109
|
+
}
|
143
110
|
// Synthetic events from Combokeys#trigger are plain objects
|
144
111
|
function preventDefault(e) {
|
145
112
|
if (e.preventDefault) {
|
@@ -1,152 +1,145 @@
|
|
1
|
-
import {
|
2
|
-
import 'core-js/modules/
|
1
|
+
import { b as _objectSpread2, a as _objectWithoutProperties, _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
3
3
|
import { Component } from 'react';
|
4
4
|
import PropTypes from 'prop-types';
|
5
5
|
import { refObject } from './prop-types.js';
|
6
6
|
import { createComposedRef } from './composeRefs.js';
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
8
|
-
import 'core-js/modules/es.object.to-string.js';
|
9
|
-
import 'core-js/modules/web.dom-collections.for-each.js';
|
10
8
|
import 'memoize-one';
|
11
|
-
import 'util-deprecate';
|
12
9
|
|
13
|
-
|
10
|
+
const _excluded = ["innerRef", "focused", "onFocusReset", "onFocusRestore"],
|
14
11
|
_excluded2 = ["autofocus", "focused", "onFocus", "onBlur", "innerRef", "scrollOnTableFocus"];
|
15
12
|
function extractPropTypes(_ref) {
|
16
|
-
|
13
|
+
let {
|
14
|
+
propTypes
|
15
|
+
} = _ref;
|
17
16
|
if (propTypes == null) {
|
18
17
|
return propTypes;
|
19
18
|
}
|
20
|
-
propTypes
|
21
|
-
propTypes.focused;
|
22
|
-
propTypes.onFocusReset;
|
23
|
-
propTypes.onFocusRestore;
|
24
|
-
var restPropTypes = _objectWithoutProperties(propTypes, _excluded);
|
19
|
+
const restPropTypes = _objectWithoutProperties(propTypes, _excluded);
|
25
20
|
return restPropTypes;
|
26
21
|
}
|
27
22
|
function focusSensorHOC(ComposedComponent) {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
args[_key] = arguments[_key];
|
34
|
-
}
|
35
|
-
_this = _callSuper(this, FocusSensor, [].concat(args));
|
36
|
-
_defineProperty(_this, "state", {
|
37
|
-
focused: _this.props.focused
|
23
|
+
class FocusSensor extends Component {
|
24
|
+
constructor() {
|
25
|
+
super(...arguments);
|
26
|
+
_defineProperty(this, "state", {
|
27
|
+
focused: this.props.focused
|
38
28
|
});
|
39
|
-
_defineProperty(
|
40
|
-
_defineProperty(
|
41
|
-
_defineProperty(
|
29
|
+
_defineProperty(this, "node", void 0);
|
30
|
+
_defineProperty(this, "_skipNextCapture", false);
|
31
|
+
_defineProperty(this, "onRefUpdate", node => {
|
42
32
|
if (node) {
|
43
|
-
|
33
|
+
this.node = node;
|
44
34
|
}
|
45
35
|
});
|
46
|
-
_defineProperty(
|
47
|
-
_defineProperty(
|
36
|
+
_defineProperty(this, "composedRef", createComposedRef());
|
37
|
+
_defineProperty(this, "onFocusCapture", _ref2 => {
|
48
38
|
var _this$node;
|
49
|
-
|
50
|
-
|
51
|
-
|
39
|
+
let {
|
40
|
+
target
|
41
|
+
} = _ref2;
|
42
|
+
if (this._skipNextCapture) {
|
43
|
+
this._skipNextCapture = false;
|
52
44
|
return;
|
53
45
|
}
|
54
|
-
|
55
|
-
if (focused && !
|
46
|
+
const focused = target instanceof Node && ((_this$node = this.node) === null || _this$node === void 0 ? void 0 : _this$node.contains(target));
|
47
|
+
if (focused && !this.state.focused) {
|
56
48
|
var _this$props$onFocus, _this$props;
|
57
|
-
|
49
|
+
this.setState({
|
58
50
|
focused: true
|
59
51
|
});
|
60
|
-
(_this$props$onFocus = (_this$props =
|
52
|
+
(_this$props$onFocus = (_this$props = this.props).onFocus) === null || _this$props$onFocus === void 0 || _this$props$onFocus.call(_this$props);
|
61
53
|
}
|
62
54
|
});
|
63
|
-
_defineProperty(
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
55
|
+
_defineProperty(this, "onBlurCapture", _ref3 => {
|
56
|
+
let {
|
57
|
+
target
|
58
|
+
} = _ref3;
|
59
|
+
const {
|
60
|
+
state: {
|
61
|
+
focused
|
62
|
+
},
|
63
|
+
node
|
64
|
+
} = this;
|
68
65
|
if (focused) {
|
69
|
-
setTimeout(
|
70
|
-
|
66
|
+
setTimeout(() => {
|
67
|
+
const blurred = target instanceof Node && (node === null || node === void 0 ? void 0 : node.contains(target)) && !node.contains(document.activeElement);
|
71
68
|
if (blurred) {
|
72
69
|
var _this$props$onBlur, _this$props2;
|
73
|
-
|
70
|
+
this.setState({
|
74
71
|
focused: false
|
75
72
|
});
|
76
|
-
(_this$props$onBlur = (_this$props2 =
|
73
|
+
(_this$props$onBlur = (_this$props2 = this.props).onBlur) === null || _this$props$onBlur === void 0 || _this$props$onBlur.call(_this$props2);
|
77
74
|
}
|
78
75
|
}, 1);
|
79
76
|
}
|
80
77
|
});
|
81
|
-
_defineProperty(
|
78
|
+
_defineProperty(this, "onFocusRestore", () => {
|
82
79
|
var _this$node2;
|
83
|
-
|
84
|
-
(_this$node2 =
|
85
|
-
preventScroll: !
|
80
|
+
this._skipNextCapture = true;
|
81
|
+
(_this$node2 = this.node) === null || _this$node2 === void 0 || _this$node2.focus({
|
82
|
+
preventScroll: !this.props.scrollOnTableFocus
|
86
83
|
});
|
87
84
|
});
|
88
|
-
_defineProperty(
|
85
|
+
_defineProperty(this, "onFocusReset", () => {
|
89
86
|
var _this$node3;
|
90
|
-
(_this$node3 =
|
87
|
+
(_this$node3 = this.node) === null || _this$node3 === void 0 || _this$node3.blur();
|
91
88
|
});
|
92
|
-
return _this;
|
93
89
|
}
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
}
|
106
|
-
document.addEventListener('focus', this.onFocusCapture, true);
|
107
|
-
document.addEventListener('blur', this.onBlurCapture, true);
|
108
|
-
if (autofocus) {
|
109
|
-
node === null || node === void 0 || node.focus({
|
110
|
-
preventScroll: !scrollOnTableFocus
|
111
|
-
});
|
112
|
-
}
|
113
|
-
}
|
114
|
-
}, {
|
115
|
-
key: "componentDidUpdate",
|
116
|
-
value: function componentDidUpdate(prevProps) {
|
117
|
-
var focused = this.props.focused;
|
118
|
-
if (focused && !prevProps.focused) {
|
119
|
-
this.onFocusRestore();
|
120
|
-
} else if (!focused && prevProps.focused) {
|
121
|
-
this.onFocusReset();
|
122
|
-
}
|
90
|
+
componentDidMount() {
|
91
|
+
const {
|
92
|
+
props: {
|
93
|
+
autofocus,
|
94
|
+
scrollOnTableFocus
|
95
|
+
},
|
96
|
+
node
|
97
|
+
} = this;
|
98
|
+
node === null || node === void 0 || node.setAttribute('tabindex', '0');
|
99
|
+
if (node != null) {
|
100
|
+
node.style.outline = 'none';
|
123
101
|
}
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
102
|
+
document.addEventListener('focus', this.onFocusCapture, true);
|
103
|
+
document.addEventListener('blur', this.onBlurCapture, true);
|
104
|
+
if (autofocus) {
|
105
|
+
node === null || node === void 0 || node.focus({
|
106
|
+
preventScroll: !scrollOnTableFocus
|
107
|
+
});
|
129
108
|
}
|
130
|
-
}
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
_this$props4.scrollOnTableFocus;
|
140
|
-
var rest = _objectWithoutProperties(_this$props4, _excluded2);
|
141
|
-
return /*#__PURE__*/jsx(ComposedComponent, _objectSpread2(_objectSpread2({}, rest), {}, {
|
142
|
-
innerRef: this.composedRef(innerRef, this.onRefUpdate),
|
143
|
-
focused: this.state.focused,
|
144
|
-
onFocusReset: this.onFocusReset,
|
145
|
-
onFocusRestore: this.onFocusRestore
|
146
|
-
}));
|
109
|
+
}
|
110
|
+
componentDidUpdate(prevProps) {
|
111
|
+
const {
|
112
|
+
focused
|
113
|
+
} = this.props;
|
114
|
+
if (focused && !prevProps.focused) {
|
115
|
+
this.onFocusRestore();
|
116
|
+
} else if (!focused && prevProps.focused) {
|
117
|
+
this.onFocusReset();
|
147
118
|
}
|
148
|
-
}
|
149
|
-
|
119
|
+
}
|
120
|
+
componentWillUnmount() {
|
121
|
+
document.removeEventListener('focus', this.onFocusCapture, true);
|
122
|
+
document.removeEventListener('blur', this.onBlurCapture, true);
|
123
|
+
}
|
124
|
+
render() {
|
125
|
+
const _this$props3 = this.props,
|
126
|
+
{
|
127
|
+
autofocus,
|
128
|
+
focused,
|
129
|
+
onFocus,
|
130
|
+
onBlur,
|
131
|
+
innerRef,
|
132
|
+
scrollOnTableFocus
|
133
|
+
} = _this$props3,
|
134
|
+
rest = _objectWithoutProperties(_this$props3, _excluded2);
|
135
|
+
return /*#__PURE__*/jsx(ComposedComponent, _objectSpread2(_objectSpread2({}, rest), {}, {
|
136
|
+
innerRef: this.composedRef(innerRef, this.onRefUpdate),
|
137
|
+
focused: this.state.focused,
|
138
|
+
onFocusReset: this.onFocusReset,
|
139
|
+
onFocusRestore: this.onFocusRestore
|
140
|
+
}));
|
141
|
+
}
|
142
|
+
}
|
150
143
|
FocusSensor.propTypes = _objectSpread2(_objectSpread2({}, extractPropTypes(ComposedComponent)), {}, {
|
151
144
|
focused: PropTypes.bool,
|
152
145
|
autofocus: PropTypes.bool,
|
@@ -158,8 +151,8 @@ function focusSensorHOC(ComposedComponent) {
|
|
158
151
|
focused: false,
|
159
152
|
autofocus: false,
|
160
153
|
scrollOnTableFocus: true,
|
161
|
-
onFocus:
|
162
|
-
onBlur:
|
154
|
+
onFocus: () => {},
|
155
|
+
onBlur: () => {}
|
163
156
|
});
|
164
157
|
return FocusSensor;
|
165
158
|
}
|
@@ -1,33 +1,22 @@
|
|
1
|
-
import { k as _createForOfIteratorHelper } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
-
import 'core-js/modules/es.array.concat.js';
|
3
|
-
import 'core-js/modules/es.array.slice.js';
|
4
1
|
import 'core-js/modules/es.regexp.exec.js';
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
5
3
|
|
6
4
|
/** https://github.com/bevacqua/fuzzysearch + highlighting with Markdown */
|
7
5
|
function fuzzyHighlight(needle, haystack) {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
let caseSensitive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
7
|
+
const ndl = caseSensitive ? needle : needle.toLowerCase();
|
8
|
+
const hstck = caseSensitive ? haystack : haystack.toLowerCase();
|
9
|
+
const result = function (matched) {
|
10
|
+
let matches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
11
|
+
let highlight = haystack;
|
14
12
|
if (matches.length > 0) {
|
15
13
|
highlight = '';
|
16
|
-
|
14
|
+
let prevMatch = {
|
17
15
|
to: 0
|
18
16
|
};
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
23
|
-
var match = _step.value;
|
24
|
-
highlight += "".concat(haystack.slice(prevMatch.to, match.from), "**").concat(haystack.slice(match.from, match.to), "**");
|
25
|
-
prevMatch = match;
|
26
|
-
}
|
27
|
-
} catch (err) {
|
28
|
-
_iterator.e(err);
|
29
|
-
} finally {
|
30
|
-
_iterator.f();
|
17
|
+
for (const match of matches) {
|
18
|
+
highlight += "".concat(haystack.slice(prevMatch.to, match.from), "**").concat(haystack.slice(match.from, match.to), "**");
|
19
|
+
prevMatch = match;
|
31
20
|
}
|
32
21
|
highlight += haystack.slice(prevMatch.to);
|
33
22
|
}
|
@@ -37,30 +26,30 @@ function fuzzyHighlight(needle, haystack) {
|
|
37
26
|
highlight
|
38
27
|
};
|
39
28
|
};
|
40
|
-
|
41
|
-
|
29
|
+
const hlen = hstck.length;
|
30
|
+
const nlen = ndl.length;
|
42
31
|
if (nlen > hlen) {
|
43
32
|
return result(false);
|
44
33
|
}
|
45
34
|
if (nlen === hlen) {
|
46
|
-
|
35
|
+
const matched = ndl === hstck;
|
47
36
|
return result(matched, matched ? [{
|
48
37
|
from: 0,
|
49
38
|
to: haystack.length
|
50
39
|
}] : []);
|
51
40
|
}
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
41
|
+
let on = false;
|
42
|
+
let j = 0;
|
43
|
+
const matches = [];
|
44
|
+
let from = 0;
|
56
45
|
/* eslint-disable no-labels */
|
57
|
-
outer: for (
|
58
|
-
|
46
|
+
outer: for (let i = 0; i < nlen; i++) {
|
47
|
+
const nch = ndl[i];
|
59
48
|
while (j < hlen) {
|
60
|
-
|
61
|
-
|
49
|
+
const hch = hstck[j];
|
50
|
+
const match = hch === nch;
|
62
51
|
// Don't turn highlight on for space characters
|
63
|
-
|
52
|
+
const nextOn = match && /\S/.test(hch);
|
64
53
|
if (nextOn && !on) {
|
65
54
|
from = j;
|
66
55
|
} else if (!nextOn && on) {
|