@jetbrains/ring-ui 5.0.127 → 5.0.129
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/alert/alert.js +2 -1
- package/components/alert/container.js +2 -1
- package/components/auth/auth__core.js +2 -1
- package/components/auth/request-builder.js +2 -1
- package/components/auth/response-parser.js +2 -1
- package/components/auth/token-validator.js +2 -1
- package/components/auth-dialog/auth-dialog.js +2 -1
- package/components/avatar/avatar.js +2 -1
- package/components/badge/badge.js +2 -1
- package/components/button/button.js +2 -1
- package/components/button-group/button-group.js +2 -1
- package/components/button-group/caption.js +2 -1
- package/components/button-set/button-set.js +2 -1
- package/components/button-toolbar/button-toolbar.js +2 -1
- package/components/caret/caret.js +2 -1
- package/components/checkbox/checkbox.js +2 -1
- package/components/code/code.js +2 -1
- package/components/confirm/confirm.js +2 -1
- package/components/content-layout/content-layout.js +2 -1
- package/components/content-layout/sidebar.js +2 -1
- package/components/data-list/data-list.js +2 -1
- package/components/data-list/item.js +2 -1
- package/components/date-picker/date-input.js +2 -1
- package/components/date-picker/date-picker.js +2 -1
- package/components/date-picker/date-popup.js +2 -1
- package/components/date-picker/day.js +2 -1
- package/components/date-picker/month-slider.js +2 -1
- package/components/date-picker/years.js +2 -1
- package/components/dialog/dialog.d.ts +4 -16
- package/components/dialog/dialog.js +6 -3
- package/components/dropdown/dropdown.js +2 -1
- package/components/error-bubble/error-bubble.js +2 -1
- package/components/error-message/error-message.js +2 -1
- package/components/footer/footer.js +1 -0
- package/components/global/react-dom-renderer.js +2 -1
- package/components/grid/col.js +2 -1
- package/components/grid/grid.js +2 -1
- package/components/grid/row.js +2 -1
- package/components/group/group.js +2 -1
- package/components/header/logo.js +2 -1
- package/components/header/profile.js +2 -1
- package/components/header/services-link.js +2 -1
- package/components/header/services.js +2 -1
- package/components/header/smart-profile.js +2 -1
- package/components/header/smart-services.js +2 -1
- package/components/header/tray-icon.js +2 -1
- package/components/header/tray.js +2 -1
- package/components/hub-source/hub-source.js +2 -1
- package/components/icon/icon.js +2 -1
- package/components/input/input.js +2 -1
- package/components/island/island.js +2 -1
- package/components/island-legacy/content-legacy.js +2 -1
- package/components/island-legacy/header-legacy.js +2 -1
- package/components/island-legacy/island-legacy.js +2 -1
- package/components/link/clickableLink.js +2 -1
- package/components/list/list.js +2 -1
- package/components/list/list__hint.js +2 -1
- package/components/list/list__users-groups-source.js +2 -1
- package/components/loader/loader.js +2 -1
- package/components/loader/loader__core.js +2 -1
- package/components/loader-screen/loader-screen.js +2 -1
- package/components/login-dialog/login-dialog.js +2 -1
- package/components/message/message.js +2 -1
- package/components/pager/pager.js +2 -1
- package/components/panel/panel.js +2 -1
- package/components/permissions/permissions.js +2 -1
- package/components/permissions/permissions__cache.js +2 -1
- package/components/popup/popup.js +2 -1
- package/components/popup-menu/popup-menu.js +2 -1
- package/components/progress-bar/progress-bar.js +2 -1
- package/components/query-assist/query-assist.js +4 -3
- package/components/radio/radio.js +2 -1
- package/components/radio/radio__item.js +2 -1
- package/components/select/select.js +2 -1
- package/components/select/select__filter.js +2 -1
- package/components/select/select__popup.js +4 -2
- package/components/shortcuts/shortcuts.js +2 -1
- package/components/storage/storage__fallback.js +2 -1
- package/components/tab-trap/tab-trap.js +2 -1
- package/components/table/cell.js +2 -1
- package/components/table/header-cell.js +2 -1
- package/components/table/header.js +2 -1
- package/components/table/multitable.js +2 -1
- package/components/table/row.d.ts +1 -0
- package/components/table/row.js +6 -4
- package/components/table/smart-table.d.ts +1 -0
- package/components/table/table.d.ts +2 -0
- package/components/table/table.js +8 -4
- package/components/tabs/smart-tabs.js +2 -1
- package/components/tabs/tab.js +2 -1
- package/components/tag/tag.js +2 -1
- package/components/tags-input/tags-input.d.ts +1 -1
- package/components/tags-input/tags-input.js +3 -2
- package/components/tags-list/tags-list.js +2 -1
- package/components/text/text.js +2 -1
- package/components/tooltip/tooltip.js +2 -1
- package/components/user-agreement/user-agreement.js +2 -1
- package/components/user-card/card.js +2 -1
- package/components/user-card/smart-user-card-tooltip.d.ts +1 -1
- package/components/user-card/smart-user-card-tooltip.js +2 -1
- package/components/user-card/tooltip.js +2 -1
- package/dist/_helpers/_rollupPluginBabelHelpers.js +1 -29
- package/dist/_helpers/anchor.js +1 -1
- package/dist/_helpers/card.js +44 -47
- package/dist/_helpers/footer.js +1 -0
- package/dist/_helpers/select__filter.js +10 -13
- package/dist/_helpers/services-link.js +10 -10
- package/dist/_helpers/sidebar.js +34 -37
- package/dist/_helpers/theme.js +1 -1
- package/dist/_helpers/title.js +12 -16
- package/dist/alert/alert.js +63 -66
- package/dist/alert/container.js +5 -5
- package/dist/alert-service/alert-service.js +5 -7
- package/dist/analytics/analytics.js +1 -2
- package/dist/analytics/analytics__custom-plugin.js +6 -8
- package/dist/auth/auth.js +1 -1
- package/dist/auth/auth__core.js +26 -26
- package/dist/auth/background-flow.js +4 -5
- package/dist/auth/iframe-flow.js +12 -12
- package/dist/auth/landing.js +1 -1
- package/dist/auth/request-builder.js +3 -5
- package/dist/auth/response-parser.js +5 -6
- package/dist/auth/storage.js +12 -12
- package/dist/auth/token-validator.js +13 -16
- package/dist/auth/window-flow.js +18 -19
- package/dist/auth-dialog/auth-dialog.js +54 -57
- package/dist/auth-dialog-service/auth-dialog-service.js +1 -1
- package/dist/auth-ng/auth-ng.js +1 -1
- package/dist/avatar/avatar.js +30 -33
- package/dist/avatar-ng/avatar-ng.js +1 -1
- package/dist/badge/badge.js +10 -10
- package/dist/badge-ng/badge-ng.js +1 -1
- package/dist/breadcrumb-ng/breadcrumb-ng.js +0 -1
- package/dist/button/button.js +24 -27
- package/dist/button-group/button-group.js +5 -5
- package/dist/button-group/caption.js +4 -4
- package/dist/button-ng/button-ng.js +68 -69
- package/dist/button-set/button-set.js +6 -6
- package/dist/button-toolbar/button-toolbar.js +6 -6
- package/dist/caret/caret.js +2 -4
- package/dist/checkbox/checkbox.js +27 -30
- package/dist/checkbox-ng/checkbox-ng.js +0 -1
- package/dist/code/code.js +17 -21
- package/dist/confirm/confirm.js +31 -34
- package/dist/confirm-ng/confirm-ng.js +1 -1
- package/dist/confirm-service/confirm-service.js +1 -1
- package/dist/content-layout/content-layout.js +17 -20
- package/dist/contenteditable/contenteditable.js +11 -11
- package/dist/data-list/data-list.js +49 -55
- package/dist/data-list/item.js +64 -67
- package/dist/data-list/selection.js +0 -1
- package/dist/data-list/title.js +1 -1
- package/dist/data-list-ng/data-list-ng.js +1 -1
- package/dist/date-picker/date-input.js +39 -42
- package/dist/date-picker/date-picker.js +162 -165
- package/dist/date-picker/date-popup.js +119 -119
- package/dist/date-picker/day.js +34 -38
- package/dist/date-picker/month-names.js +11 -14
- package/dist/date-picker/month-slider.js +24 -28
- package/dist/date-picker/month.js +1 -1
- package/dist/date-picker/months.js +1 -1
- package/dist/date-picker/years.js +9 -13
- package/dist/dialog/dialog.d.ts +4 -16
- package/dist/dialog/dialog.js +68 -65
- package/dist/dialog-ng/dialog-ng.js +21 -22
- package/dist/docked-panel-ng/docked-panel-ng.js +0 -1
- package/dist/dropdown/dropdown.js +101 -104
- package/dist/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/editable-heading/editable-heading.js +1 -1
- package/dist/error-bubble/error-bubble.js +6 -6
- package/dist/error-message/error-message.js +10 -10
- package/dist/error-message-ng/error-message-ng.js +0 -1
- package/dist/footer-ng/footer-ng.js +19 -21
- package/dist/global/angular-component-factory.js +2 -3
- package/dist/global/dom.js +1 -5
- package/dist/global/focus-sensor-hoc.js +58 -61
- package/dist/global/listeners.js +1 -5
- package/dist/global/react-dom-renderer.js +8 -12
- package/dist/global/rerender-hoc.js +1 -5
- package/dist/global/ring-angular-component.js +1 -3
- package/dist/grid/col.js +13 -14
- package/dist/grid/grid.js +5 -5
- package/dist/grid/row.js +16 -17
- package/dist/group/group.js +5 -5
- package/dist/header/header.js +10 -10
- package/dist/header/logo.js +9 -9
- package/dist/header/profile.js +58 -58
- package/dist/header/services.js +19 -22
- package/dist/header/smart-profile.js +40 -43
- package/dist/header/smart-services.js +28 -31
- package/dist/header/tray-icon.js +6 -6
- package/dist/header/tray.js +5 -5
- package/dist/heading/heading.js +1 -1
- package/dist/heading-ng/heading-ng.js +1 -1
- package/dist/http/http.js +111 -107
- package/dist/http/http.mock.js +3 -4
- package/dist/hub-source/hub-source.js +7 -9
- package/dist/hub-source/hub-source__user.js +0 -1
- package/dist/hub-source/hub-source__users-groups.js +4 -5
- package/dist/icon/icon.js +18 -18
- package/dist/icon/icon__svg.js +1 -1
- package/dist/icon-ng/icon-ng.js +0 -1
- package/dist/input/input.js +35 -38
- package/dist/input-ng/input-ng.js +25 -26
- package/dist/island/adaptive-island-hoc.js +21 -25
- package/dist/island/content.js +62 -65
- package/dist/island/header.js +11 -11
- package/dist/island/island.js +8 -8
- package/dist/island-legacy/content-legacy.js +5 -5
- package/dist/island-legacy/header-legacy.js +5 -5
- package/dist/island-legacy/island-legacy.js +5 -5
- package/dist/link/clickableLink.js +27 -30
- package/dist/link/link.js +16 -16
- package/dist/list/list.js +389 -391
- package/dist/list/list__custom.js +6 -10
- package/dist/list/list__hint.js +3 -4
- package/dist/list/list__item.js +4 -7
- package/dist/list/list__link.js +1 -1
- package/dist/list/list__users-groups-source.js +3 -3
- package/dist/loader/loader.js +16 -19
- package/dist/loader/loader__core.js +62 -62
- package/dist/loader-inline/loader-inline.js +6 -6
- package/dist/loader-ng/loader-ng.js +3 -4
- package/dist/loader-screen/loader-screen.js +6 -6
- package/dist/loader-screen-ng/loader-screen-ng.js +0 -1
- package/dist/login-dialog/login-dialog.js +55 -58
- package/dist/login-dialog/service.js +1 -1
- package/dist/markdown/code.js +0 -1
- package/dist/markdown/markdown.js +1 -1
- package/dist/message/message.js +22 -25
- package/dist/old-browsers-message/white-list.js +2 -2
- package/dist/pager/pager.js +55 -58
- package/dist/pager-ng/pager-ng.js +1 -1
- package/dist/panel/panel.js +5 -5
- package/dist/panel-ng/panel-ng.js +0 -1
- package/dist/permissions/permissions.js +14 -16
- package/dist/permissions/permissions__cache.js +4 -6
- package/dist/permissions-ng/permissions-ng.js +1 -1
- package/dist/place-under-ng/place-under-ng.js +0 -1
- package/dist/popup/popup.js +118 -121
- package/dist/popup/popup.target.js +1 -1
- package/dist/popup/position.js +0 -1
- package/dist/popup-menu/popup-menu.js +19 -22
- package/dist/progress-bar/progress-bar.js +41 -44
- package/dist/progress-bar-ng/progress-bar-ng.js +1 -1
- package/dist/promised-click-ng/promised-click-ng.js +0 -1
- package/dist/query-assist/query-assist.js +507 -501
- package/dist/query-assist/query-assist__suggestions.js +1 -1
- package/dist/query-assist-ng/query-assist-ng.js +1 -1
- package/dist/radio/radio.js +10 -13
- package/dist/radio/radio__item.js +19 -22
- package/dist/select/select.js +350 -349
- package/dist/select/select__popup.js +148 -152
- package/dist/select-ng/select-ng.js +1 -1
- package/dist/select-ng/select-ng__lazy.js +4 -4
- package/dist/select-ng/select-ng__options.js +14 -15
- package/dist/shortcuts/core.js +35 -36
- package/dist/shortcuts/shortcuts-hoc.js +7 -11
- package/dist/shortcuts/shortcuts.js +10 -11
- package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +0 -1
- package/dist/shortcuts-ng/shortcuts-ng.js +0 -1
- package/dist/sidebar-ng/sidebar-ng.js +0 -1
- package/dist/storage/storage.js +1 -1
- package/dist/storage/storage__fallback.js +8 -10
- package/dist/storage/storage__local.js +2 -2
- package/dist/style.css +1 -1
- package/dist/tab-trap/tab-trap.js +84 -86
- package/dist/table/cell.js +6 -6
- package/dist/table/disable-hover-hoc.js +23 -25
- package/dist/table/header-cell.js +28 -31
- package/dist/table/header.js +58 -61
- package/dist/table/multitable.js +91 -95
- package/dist/table/row-with-focus-sensor.js +15 -18
- package/dist/table/row.d.ts +1 -0
- package/dist/table/row.js +54 -55
- package/dist/table/selection-shortcuts-hoc.js +145 -147
- package/dist/table/selection.js +7 -9
- package/dist/table/smart-table.d.ts +1 -0
- package/dist/table/smart-table.js +21 -24
- package/dist/table/table.d.ts +2 -0
- package/dist/table/table.js +107 -109
- package/dist/table-legacy-ng/table-legacy-ng.js +1 -1
- package/dist/table-legacy-ng/table-legacy-ng__pager.js +1 -1
- package/dist/table-legacy-ng/table-legacy-ng__selection.js +1 -3
- package/dist/table-legacy-ng/table-legacy-ng__toolbar.js +0 -1
- package/dist/table-ng/smart-table-ng.js +1 -1
- package/dist/table-ng/table-ng.js +1 -1
- package/dist/tabs/collapsible-more.js +1 -1
- package/dist/tabs/collapsible-tab.js +1 -1
- package/dist/tabs/dumb-tabs.js +46 -49
- package/dist/tabs/smart-tabs.js +10 -10
- package/dist/tabs/tab.js +7 -8
- package/dist/tag/tag.js +42 -45
- package/dist/tags-input/tags-input.d.ts +1 -1
- package/dist/tags-input/tags-input.js +214 -213
- package/dist/tags-input-ng/tags-input-ng.js +1 -1
- package/dist/tags-list/tags-list.js +20 -20
- package/dist/template-ng/template-ng.js +25 -26
- package/dist/text/text.js +6 -6
- package/dist/toggle/toggle.js +19 -19
- package/dist/toggle-ng/toggle-ng.js +1 -1
- package/dist/tooltip/tooltip.js +86 -89
- package/dist/tooltip-ng/tooltip-ng.js +1 -1
- package/dist/user-agreement/service.js +207 -205
- package/dist/user-agreement/user-agreement.js +39 -42
- package/dist/user-card/smart-user-card-tooltip.d.ts +1 -1
- package/dist/user-card/smart-user-card-tooltip.js +32 -35
- package/dist/user-card/tooltip.js +26 -26
- package/dist/user-card-ng/user-card-ng.js +1 -1
- package/package.json +17 -17
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import angularComponentFactory from '../global/angular-component-factory.js';
|
|
2
2
|
import Toggle from '../toggle/toggle.js';
|
|
3
|
-
import '../_helpers/_rollupPluginBabelHelpers.js';
|
|
4
3
|
import 'angular';
|
|
5
4
|
import 'react';
|
|
6
5
|
import '../global/react-render-adapter.js';
|
|
@@ -8,6 +7,7 @@ import 'react-dom';
|
|
|
8
7
|
import '../global/ring-angular-component.js';
|
|
9
8
|
import '../global/react-dom-renderer.js';
|
|
10
9
|
import 'prop-types';
|
|
10
|
+
import '../_helpers/_rollupPluginBabelHelpers.js';
|
|
11
11
|
import 'classnames';
|
|
12
12
|
import '../global/data-tests.js';
|
|
13
13
|
|
package/dist/tooltip/tooltip.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as _extends } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React, { Component, createContext } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import classNames from 'classnames';
|
|
@@ -26,79 +26,23 @@ const TooltipContext = /*#__PURE__*/createContext(undefined);
|
|
|
26
26
|
* @name Tooltip
|
|
27
27
|
*/
|
|
28
28
|
class Tooltip extends Component {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (!title) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (delay) {
|
|
50
|
-
this.timeout = window.setTimeout(this.showPopup, delay);
|
|
51
|
-
} else {
|
|
52
|
-
this.showPopup();
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
_defineProperty(this, "showPopup", () => {
|
|
56
|
-
if (this.props.selfOverflowOnly) {
|
|
57
|
-
const {
|
|
58
|
-
containerNode
|
|
59
|
-
} = this;
|
|
60
|
-
// rare cases when containerNode is null are possible;
|
|
61
|
-
// probably the collision is due to the asynchronous nature of the code,
|
|
62
|
-
// i.e. this code runs after the component is unmounted,
|
|
63
|
-
// although at first glance it looks unlikely.
|
|
64
|
-
if (!containerNode) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
// inline element?
|
|
68
|
-
if (containerNode.clientWidth === 0 && containerNode.clientHeight === 0) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (containerNode.scrollWidth <= containerNode.clientWidth && containerNode.scrollHeight <= containerNode.clientHeight) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
this.context?.onNestedTooltipShow();
|
|
76
|
-
this.setState({
|
|
77
|
-
showPopup: true
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
_defineProperty(this, "hidePopup", () => {
|
|
81
|
-
clearTimeout(this.timeout);
|
|
82
|
-
this.context?.onNestedTooltipHide();
|
|
83
|
-
this.setState({
|
|
84
|
-
showPopup: false
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
_defineProperty(this, "popup", void 0);
|
|
88
|
-
_defineProperty(this, "popupRef", el => {
|
|
89
|
-
this.popup = el;
|
|
90
|
-
});
|
|
91
|
-
_defineProperty(this, "onNestedTooltipShow", () => {
|
|
92
|
-
this.setState({
|
|
93
|
-
showNestedPopup: true
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
_defineProperty(this, "onNestedTooltipHide", () => {
|
|
97
|
-
this.setState({
|
|
98
|
-
showNestedPopup: false
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
}
|
|
29
|
+
static propTypes = {
|
|
30
|
+
delay: PropTypes.number,
|
|
31
|
+
selfOverflowOnly: PropTypes.bool,
|
|
32
|
+
popupProps: PropTypes.object,
|
|
33
|
+
title: PropTypes.node,
|
|
34
|
+
children: PropTypes.node,
|
|
35
|
+
'data-test': PropTypes.string
|
|
36
|
+
};
|
|
37
|
+
static defaultProps = {
|
|
38
|
+
title: '',
|
|
39
|
+
selfOverflowOnly: false,
|
|
40
|
+
popupProps: {}
|
|
41
|
+
};
|
|
42
|
+
state = {
|
|
43
|
+
showPopup: false,
|
|
44
|
+
showNestedPopup: false
|
|
45
|
+
};
|
|
102
46
|
componentDidMount() {
|
|
103
47
|
if (this.props.title) {
|
|
104
48
|
this.addListeners();
|
|
@@ -115,6 +59,60 @@ class Tooltip extends Component {
|
|
|
115
59
|
clearTimeout(this.timeout);
|
|
116
60
|
this.listeners.removeAll();
|
|
117
61
|
}
|
|
62
|
+
static PopupProps = Popup.PopupProps;
|
|
63
|
+
static contextType = TooltipContext;
|
|
64
|
+
timeout;
|
|
65
|
+
listeners = new Listeners();
|
|
66
|
+
containerNode;
|
|
67
|
+
containerRef = el => {
|
|
68
|
+
this.containerNode = el;
|
|
69
|
+
};
|
|
70
|
+
tryToShowPopup = () => {
|
|
71
|
+
const {
|
|
72
|
+
delay,
|
|
73
|
+
title
|
|
74
|
+
} = this.props;
|
|
75
|
+
if (!title) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (delay) {
|
|
79
|
+
this.timeout = window.setTimeout(this.showPopup, delay);
|
|
80
|
+
} else {
|
|
81
|
+
this.showPopup();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
showPopup = () => {
|
|
85
|
+
if (this.props.selfOverflowOnly) {
|
|
86
|
+
const {
|
|
87
|
+
containerNode
|
|
88
|
+
} = this;
|
|
89
|
+
// rare cases when containerNode is null are possible;
|
|
90
|
+
// probably the collision is due to the asynchronous nature of the code,
|
|
91
|
+
// i.e. this code runs after the component is unmounted,
|
|
92
|
+
// although at first glance it looks unlikely.
|
|
93
|
+
if (!containerNode) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
// inline element?
|
|
97
|
+
if (containerNode.clientWidth === 0 && containerNode.clientHeight === 0) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (containerNode.scrollWidth <= containerNode.clientWidth && containerNode.scrollHeight <= containerNode.clientHeight) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
this.context?.onNestedTooltipShow();
|
|
105
|
+
this.setState({
|
|
106
|
+
showPopup: true
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
hidePopup = () => {
|
|
110
|
+
clearTimeout(this.timeout);
|
|
111
|
+
this.context?.onNestedTooltipHide();
|
|
112
|
+
this.setState({
|
|
113
|
+
showPopup: false
|
|
114
|
+
});
|
|
115
|
+
};
|
|
118
116
|
addListeners() {
|
|
119
117
|
if (this.containerNode != null) {
|
|
120
118
|
this.listeners.add(this.containerNode, 'mouseover', this.tryToShowPopup);
|
|
@@ -124,6 +122,20 @@ class Tooltip extends Component {
|
|
|
124
122
|
passive: true
|
|
125
123
|
});
|
|
126
124
|
}
|
|
125
|
+
popup;
|
|
126
|
+
popupRef = el => {
|
|
127
|
+
this.popup = el;
|
|
128
|
+
};
|
|
129
|
+
onNestedTooltipShow = () => {
|
|
130
|
+
this.setState({
|
|
131
|
+
showNestedPopup: true
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
onNestedTooltipHide = () => {
|
|
135
|
+
this.setState({
|
|
136
|
+
showNestedPopup: false
|
|
137
|
+
});
|
|
138
|
+
};
|
|
127
139
|
render() {
|
|
128
140
|
const {
|
|
129
141
|
children,
|
|
@@ -167,20 +179,5 @@ class Tooltip extends Component {
|
|
|
167
179
|
}, popupProps), title)));
|
|
168
180
|
}
|
|
169
181
|
}
|
|
170
|
-
_defineProperty(Tooltip, "propTypes", {
|
|
171
|
-
delay: PropTypes.number,
|
|
172
|
-
selfOverflowOnly: PropTypes.bool,
|
|
173
|
-
popupProps: PropTypes.object,
|
|
174
|
-
title: PropTypes.node,
|
|
175
|
-
children: PropTypes.node,
|
|
176
|
-
'data-test': PropTypes.string
|
|
177
|
-
});
|
|
178
|
-
_defineProperty(Tooltip, "defaultProps", {
|
|
179
|
-
title: '',
|
|
180
|
-
selfOverflowOnly: false,
|
|
181
|
-
popupProps: {}
|
|
182
|
-
});
|
|
183
|
-
_defineProperty(Tooltip, "PopupProps", Popup.PopupProps);
|
|
184
|
-
_defineProperty(Tooltip, "contextType", TooltipContext);
|
|
185
182
|
|
|
186
183
|
export { Tooltip as default };
|
|
@@ -4,7 +4,6 @@ import classNames from 'classnames';
|
|
|
4
4
|
import { render } from '../global/react-render-adapter.js';
|
|
5
5
|
import Popup from '../popup/popup.js';
|
|
6
6
|
import 'react-dom';
|
|
7
|
-
import '../_helpers/_rollupPluginBabelHelpers.js';
|
|
8
7
|
import 'prop-types';
|
|
9
8
|
import '../global/get-uid.js';
|
|
10
9
|
import '../global/schedule-raf.js';
|
|
@@ -16,6 +15,7 @@ import '../global/sniffer.js';
|
|
|
16
15
|
import 'sniffr';
|
|
17
16
|
import '../global/data-tests.js';
|
|
18
17
|
import '../tab-trap/tab-trap.js';
|
|
18
|
+
import '../_helpers/_rollupPluginBabelHelpers.js';
|
|
19
19
|
import '../popup/position.js';
|
|
20
20
|
import '../popup/popup.consts.js';
|
|
21
21
|
import '../popup/popup.target.js';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { render, unmountComponentAtNode } from '../global/react-render-adapter.js';
|
|
4
3
|
import ActualStorage from '../storage/storage.js';
|
|
@@ -12,6 +11,7 @@ import 'react-dom';
|
|
|
12
11
|
import '../storage/storage__local.js';
|
|
13
12
|
import '../storage/storage__fallback.js';
|
|
14
13
|
import 'deep-equal';
|
|
14
|
+
import '../_helpers/_rollupPluginBabelHelpers.js';
|
|
15
15
|
import '../global/get-uid.js';
|
|
16
16
|
import '../alert/container.js';
|
|
17
17
|
import 'classnames';
|
|
@@ -92,150 +92,166 @@ const DEFAULT_AGREEMENT = {
|
|
|
92
92
|
text: ''
|
|
93
93
|
};
|
|
94
94
|
class UserAgreementService {
|
|
95
|
+
config;
|
|
95
96
|
constructor(config) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
_defineProperty(this, "_notifyAboutShowing", () => {
|
|
135
|
-
localStorage.setItem(storageKey, JSON.stringify({
|
|
136
|
-
command: showMessage,
|
|
137
|
-
tabId: this.tabId
|
|
138
|
-
}));
|
|
139
|
-
});
|
|
140
|
-
_defineProperty(this, "_notifyAboutHiding", () => {
|
|
141
|
-
localStorage.setItem(storageKey, JSON.stringify({
|
|
142
|
-
command: hideMessage,
|
|
143
|
-
tabId: this.tabId
|
|
144
|
-
}));
|
|
145
|
-
});
|
|
146
|
-
_defineProperty(this, "getUserAgreement", async () => {
|
|
147
|
-
this.userAgreement = (await this.config.getUserAgreement()) || DEFAULT_AGREEMENT;
|
|
148
|
-
return this.userAgreement;
|
|
149
|
-
});
|
|
150
|
-
_defineProperty(this, "getUserConsent", async () => {
|
|
97
|
+
if (!config) {
|
|
98
|
+
throw new Error('Please pass a config to UserAgreementService');
|
|
99
|
+
}
|
|
100
|
+
if (!config.getUserAgreement) {
|
|
101
|
+
throw new Error('Please pass a "getUserAgreement" option to UserAgreementService');
|
|
102
|
+
}
|
|
103
|
+
if (!config.getUserConsent) {
|
|
104
|
+
throw new Error('Please pass a "getUserConsent" option to UserAgreementService');
|
|
105
|
+
}
|
|
106
|
+
if (!config.setUserConsent) {
|
|
107
|
+
throw new Error('Please pass a "setUserConsent" option to UserAgreementService');
|
|
108
|
+
}
|
|
109
|
+
this.config = config;
|
|
110
|
+
this.interval = config.interval || this.interval;
|
|
111
|
+
}
|
|
112
|
+
_dialogPromise = null;
|
|
113
|
+
_alertPromise = null;
|
|
114
|
+
tabId = Math.random();
|
|
115
|
+
interval = ONE_HOUR;
|
|
116
|
+
container = document.createElement('div');
|
|
117
|
+
storage = new ActualStorage();
|
|
118
|
+
checkingPromise = null;
|
|
119
|
+
guest = false;
|
|
120
|
+
userAgreement = DEFAULT_AGREEMENT;
|
|
121
|
+
userConsent = DEFAULT_CONSENT;
|
|
122
|
+
intervalId;
|
|
123
|
+
startChecking = () => {
|
|
124
|
+
this.intervalId = window.setInterval(this.checkConsentAndShowDialog, this.interval);
|
|
125
|
+
window.addEventListener('storage', this.onStorageEvent);
|
|
126
|
+
this.checkConsentAndShowDialog();
|
|
127
|
+
};
|
|
128
|
+
stopChecking = () => {
|
|
129
|
+
clearInterval(this.intervalId);
|
|
130
|
+
window.removeEventListener('storage', this.onStorageEvent);
|
|
131
|
+
this.hideDialog();
|
|
132
|
+
};
|
|
133
|
+
onStorageEvent = event => {
|
|
134
|
+
if (event.key === storageKey && event.newValue != null) {
|
|
151
135
|
const {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
} =
|
|
155
|
-
this.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return this.userConsent;
|
|
162
|
-
});
|
|
163
|
-
_defineProperty(this, "checkConsentAndShowDialog", async withoutNotifications => {
|
|
164
|
-
if (await this.checkConsent()) {
|
|
165
|
-
return this.hideDialogAndAlert(withoutNotifications);
|
|
166
|
-
} else {
|
|
167
|
-
return this.showDialogOrAlert(withoutNotifications);
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
_defineProperty(this, "checkConsent", async () => {
|
|
171
|
-
if (!this.checkingPromise) {
|
|
172
|
-
this.checkingPromise = Promise.all([this.getUserAgreement(), this.getUserConsent()]);
|
|
136
|
+
tabId,
|
|
137
|
+
command
|
|
138
|
+
} = JSON.parse(event.newValue);
|
|
139
|
+
if (tabId !== this.tabId) {
|
|
140
|
+
if (command === showMessage) {
|
|
141
|
+
this.checkConsentAndShowDialog(true);
|
|
142
|
+
} else if (command === hideMessage) {
|
|
143
|
+
this.hideDialogAndAlert(true);
|
|
144
|
+
}
|
|
173
145
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
_notifyAboutShowing = () => {
|
|
149
|
+
localStorage.setItem(storageKey, JSON.stringify({
|
|
150
|
+
command: showMessage,
|
|
151
|
+
tabId: this.tabId
|
|
152
|
+
}));
|
|
153
|
+
};
|
|
154
|
+
_notifyAboutHiding = () => {
|
|
155
|
+
localStorage.setItem(storageKey, JSON.stringify({
|
|
156
|
+
command: hideMessage,
|
|
157
|
+
tabId: this.tabId
|
|
158
|
+
}));
|
|
159
|
+
};
|
|
160
|
+
getUserAgreement = async () => {
|
|
161
|
+
this.userAgreement = (await this.config.getUserAgreement()) || DEFAULT_AGREEMENT;
|
|
162
|
+
return this.userAgreement;
|
|
163
|
+
};
|
|
164
|
+
getUserConsent = async () => {
|
|
165
|
+
const {
|
|
166
|
+
guest,
|
|
167
|
+
endUserAgreementConsent
|
|
168
|
+
} = await this.config.getUserConsent();
|
|
169
|
+
this.guest = guest;
|
|
170
|
+
if (guest) {
|
|
171
|
+
this.userConsent = (await this.storage.get(GUEST_SESSION_KEY)) || this.userConsent;
|
|
172
|
+
} else {
|
|
173
|
+
this.userConsent = endUserAgreementConsent || this.userConsent;
|
|
174
|
+
}
|
|
175
|
+
return this.userConsent;
|
|
176
|
+
};
|
|
177
|
+
checkConsentAndShowDialog = async withoutNotifications => {
|
|
178
|
+
if (await this.checkConsent()) {
|
|
179
|
+
return this.hideDialogAndAlert(withoutNotifications);
|
|
180
|
+
} else {
|
|
181
|
+
return this.showDialogOrAlert(withoutNotifications);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
checkConsent = async () => {
|
|
185
|
+
if (!this.checkingPromise) {
|
|
186
|
+
this.checkingPromise = Promise.all([this.getUserAgreement(), this.getUserConsent()]);
|
|
187
|
+
}
|
|
188
|
+
const [userAgreement, userConsent] = await this.checkingPromise;
|
|
189
|
+
this.checkingPromise = null;
|
|
190
|
+
const {
|
|
191
|
+
enabled,
|
|
192
|
+
majorVersion: actualVersion
|
|
193
|
+
} = userAgreement;
|
|
194
|
+
const {
|
|
195
|
+
accepted,
|
|
196
|
+
majorVersion: acceptedVersion
|
|
197
|
+
} = userConsent;
|
|
198
|
+
return !enabled || accepted && actualVersion === acceptedVersion;
|
|
199
|
+
};
|
|
200
|
+
alertKey;
|
|
201
|
+
showAlert = withoutNotifications => {
|
|
202
|
+
if (this._alertPromise) {
|
|
203
|
+
return this._alertPromise;
|
|
204
|
+
}
|
|
205
|
+
this._alertPromise = new Promise((resolve, reject) => {
|
|
180
206
|
const {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
const {
|
|
193
|
-
userAgreement,
|
|
194
|
-
reviewNow,
|
|
195
|
-
remindLater
|
|
196
|
-
} = this.config.translations || {};
|
|
197
|
-
const onRemind = () => {
|
|
198
|
-
this.hideDialogAndAlert(withoutNotifications);
|
|
199
|
-
reject('Postponed');
|
|
200
|
-
};
|
|
201
|
-
const onReview = async () => {
|
|
202
|
-
await this.showDialog(true, false, {
|
|
203
|
-
onRemindLater: onRemind
|
|
204
|
-
});
|
|
205
|
-
this.hideAlert(withoutNotifications);
|
|
206
|
-
resolve();
|
|
207
|
-
};
|
|
208
|
-
const message = /*#__PURE__*/React.createElement(Group, null, /*#__PURE__*/React.createElement("span", null, userAgreement || 'User Agreement'), /*#__PURE__*/React.createElement(Link, {
|
|
209
|
-
onClick: onReview,
|
|
210
|
-
"data-test": "review"
|
|
211
|
-
}, reviewNow || 'Review now'), /*#__PURE__*/React.createElement(Link, {
|
|
212
|
-
onClick: onRemind,
|
|
213
|
-
"data-test": "later"
|
|
214
|
-
}, remindLater || 'Remind me later'));
|
|
215
|
-
this.alertKey = alertService.addAlert(message, Alert.Type.WARNING, 0, {
|
|
216
|
-
closeable: false
|
|
207
|
+
userAgreement,
|
|
208
|
+
reviewNow,
|
|
209
|
+
remindLater
|
|
210
|
+
} = this.config.translations || {};
|
|
211
|
+
const onRemind = () => {
|
|
212
|
+
this.hideDialogAndAlert(withoutNotifications);
|
|
213
|
+
reject('Postponed');
|
|
214
|
+
};
|
|
215
|
+
const onReview = async () => {
|
|
216
|
+
await this.showDialog(true, false, {
|
|
217
|
+
onRemindLater: onRemind
|
|
217
218
|
});
|
|
219
|
+
this.hideAlert(withoutNotifications);
|
|
220
|
+
resolve();
|
|
221
|
+
};
|
|
222
|
+
const message = /*#__PURE__*/React.createElement(Group, null, /*#__PURE__*/React.createElement("span", null, userAgreement || 'User Agreement'), /*#__PURE__*/React.createElement(Link, {
|
|
223
|
+
onClick: onReview,
|
|
224
|
+
"data-test": "review"
|
|
225
|
+
}, reviewNow || 'Review now'), /*#__PURE__*/React.createElement(Link, {
|
|
226
|
+
onClick: onRemind,
|
|
227
|
+
"data-test": "later"
|
|
228
|
+
}, remindLater || 'Remind me later'));
|
|
229
|
+
this.alertKey = alertService.addAlert(message, Alert.Type.WARNING, 0, {
|
|
230
|
+
closeable: false
|
|
218
231
|
});
|
|
219
|
-
if (!withoutNotifications) {
|
|
220
|
-
this._notifyAboutShowing();
|
|
221
|
-
}
|
|
222
|
-
return this._alertPromise;
|
|
223
232
|
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
233
|
+
if (!withoutNotifications) {
|
|
234
|
+
this._notifyAboutShowing();
|
|
235
|
+
}
|
|
236
|
+
return this._alertPromise;
|
|
237
|
+
};
|
|
238
|
+
hideAlert = withoutNotifications => {
|
|
239
|
+
const {
|
|
240
|
+
onRemindLater
|
|
241
|
+
} = this.config;
|
|
242
|
+
alertService.remove(this.alertKey);
|
|
243
|
+
this.alertKey = null;
|
|
244
|
+
this._alertPromise = null;
|
|
245
|
+
if (onRemindLater) {
|
|
246
|
+
onRemindLater();
|
|
247
|
+
}
|
|
248
|
+
if (!withoutNotifications) {
|
|
249
|
+
this._notifyAboutHiding();
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
showDialog = (() => {
|
|
253
|
+
var _this = this;
|
|
254
|
+
return function (withoutNotifications) {
|
|
239
255
|
let preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
240
256
|
let restOptions = arguments.length > 2 ? arguments[2] : undefined;
|
|
241
257
|
const {
|
|
@@ -279,78 +295,64 @@ class UserAgreementService {
|
|
|
279
295
|
}
|
|
280
296
|
}
|
|
281
297
|
return _this._dialogPromise;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
_defineProperty(this, "showDialogOrAlert", (withoutNotifications, preview, restOptions) => {
|
|
297
|
-
if (this.guest && !this.userAgreement.requiredForREST) {
|
|
298
|
-
return this.showAlert(withoutNotifications);
|
|
299
|
-
}
|
|
300
|
-
return this.showDialog(withoutNotifications, preview, restOptions);
|
|
301
|
-
});
|
|
302
|
-
_defineProperty(this, "hideDialogAndAlert", withoutNotifications => {
|
|
303
|
-
this.hideAlert(withoutNotifications);
|
|
304
|
-
this.hideDialog(withoutNotifications);
|
|
305
|
-
});
|
|
306
|
-
_defineProperty(this, "onAccept", async () => {
|
|
307
|
-
const {
|
|
308
|
-
setUserConsent,
|
|
309
|
-
onAccept
|
|
310
|
-
} = this.config;
|
|
311
|
-
if (this.guest) {
|
|
312
|
-
const {
|
|
313
|
-
majorVersion,
|
|
314
|
-
minorVersion
|
|
315
|
-
} = this.userAgreement;
|
|
316
|
-
this.userConsent = {
|
|
317
|
-
majorVersion,
|
|
318
|
-
minorVersion,
|
|
319
|
-
accepted: true
|
|
320
|
-
};
|
|
321
|
-
await this.storage.set(GUEST_SESSION_KEY, this.userConsent);
|
|
322
|
-
} else {
|
|
323
|
-
this.userConsent = await setUserConsent();
|
|
324
|
-
}
|
|
325
|
-
this.hideDialog();
|
|
326
|
-
if (onAccept) {
|
|
327
|
-
onAccept();
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
_defineProperty(this, "onDecline", () => {
|
|
331
|
-
const {
|
|
332
|
-
onDecline
|
|
333
|
-
} = this.config;
|
|
334
|
-
this.hideDialog();
|
|
335
|
-
if (onDecline) {
|
|
336
|
-
onDecline();
|
|
298
|
+
};
|
|
299
|
+
})();
|
|
300
|
+
hideDialog = withoutNotifications => {
|
|
301
|
+
const {
|
|
302
|
+
onDialogHide
|
|
303
|
+
} = this.config;
|
|
304
|
+
unmountComponentAtNode(this.container);
|
|
305
|
+
if (onDialogHide) {
|
|
306
|
+
onDialogHide();
|
|
307
|
+
this._dialogPromise = null;
|
|
308
|
+
if (!withoutNotifications) {
|
|
309
|
+
this._notifyAboutHiding();
|
|
337
310
|
}
|
|
338
|
-
});
|
|
339
|
-
if (!config) {
|
|
340
|
-
throw new Error('Please pass a config to UserAgreementService');
|
|
341
311
|
}
|
|
342
|
-
|
|
343
|
-
|
|
312
|
+
};
|
|
313
|
+
showDialogOrAlert = (withoutNotifications, preview, restOptions) => {
|
|
314
|
+
if (this.guest && !this.userAgreement.requiredForREST) {
|
|
315
|
+
return this.showAlert(withoutNotifications);
|
|
344
316
|
}
|
|
345
|
-
|
|
346
|
-
|
|
317
|
+
return this.showDialog(withoutNotifications, preview, restOptions);
|
|
318
|
+
};
|
|
319
|
+
hideDialogAndAlert = withoutNotifications => {
|
|
320
|
+
this.hideAlert(withoutNotifications);
|
|
321
|
+
this.hideDialog(withoutNotifications);
|
|
322
|
+
};
|
|
323
|
+
onAccept = async () => {
|
|
324
|
+
const {
|
|
325
|
+
setUserConsent,
|
|
326
|
+
onAccept
|
|
327
|
+
} = this.config;
|
|
328
|
+
if (this.guest) {
|
|
329
|
+
const {
|
|
330
|
+
majorVersion,
|
|
331
|
+
minorVersion
|
|
332
|
+
} = this.userAgreement;
|
|
333
|
+
this.userConsent = {
|
|
334
|
+
majorVersion,
|
|
335
|
+
minorVersion,
|
|
336
|
+
accepted: true
|
|
337
|
+
};
|
|
338
|
+
await this.storage.set(GUEST_SESSION_KEY, this.userConsent);
|
|
339
|
+
} else {
|
|
340
|
+
this.userConsent = await setUserConsent();
|
|
347
341
|
}
|
|
348
|
-
|
|
349
|
-
|
|
342
|
+
this.hideDialog();
|
|
343
|
+
if (onAccept) {
|
|
344
|
+
onAccept();
|
|
350
345
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
346
|
+
};
|
|
347
|
+
onDecline = () => {
|
|
348
|
+
const {
|
|
349
|
+
onDecline
|
|
350
|
+
} = this.config;
|
|
351
|
+
this.hideDialog();
|
|
352
|
+
if (onDecline) {
|
|
353
|
+
onDecline();
|
|
354
|
+
}
|
|
355
|
+
};
|
|
354
356
|
}
|
|
355
357
|
|
|
356
358
|
export { UserAgreementService as default, hideMessage, showMessage };
|