@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,39 +1,22 @@
|
|
1
|
-
import { _ as _defineProperty,
|
2
|
-
import 'core-js/modules/es.array.concat.js';
|
3
|
-
import 'core-js/modules/es.object.entries.js';
|
4
|
-
import 'core-js/modules/es.object.to-string.js';
|
1
|
+
import { _ as _defineProperty, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
5
2
|
import 'core-js/modules/es.regexp.exec.js';
|
6
|
-
import 'core-js/modules/es.regexp.to-string.js';
|
7
3
|
import 'core-js/modules/es.string.replace.js';
|
8
|
-
import 'core-js/modules/web.dom-collections.
|
4
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
9
5
|
import { PureComponent } from 'react';
|
10
6
|
import { createPortal } from 'react-dom';
|
11
7
|
import PropTypes from 'prop-types';
|
12
8
|
import classNames from 'classnames';
|
13
9
|
import getUID from '../global/get-uid.js';
|
14
10
|
import scheduleRAF from '../global/schedule-raf.js';
|
15
|
-
import {
|
11
|
+
import { Listeners, getStyles } from '../global/dom.js';
|
16
12
|
import Shortcuts from '../shortcuts/shortcuts.js';
|
17
13
|
import joinDataTestAttributes from '../global/data-tests.js';
|
18
14
|
import TabTrap from '../tab-trap/tab-trap.js';
|
19
15
|
import position from './position.js';
|
20
|
-
import { DEFAULT_DIRECTIONS, Directions, Dimension, MinWidth, MaxHeight
|
16
|
+
import { Display, DEFAULT_DIRECTIONS, Directions, Dimension, MinWidth, MaxHeight } from './popup.consts.js';
|
21
17
|
import { PopupTargetContext, PopupTarget } from './popup.target.js';
|
22
18
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
23
|
-
import 'core-js/modules/es.array.filter.js';
|
24
|
-
import 'core-js/modules/es.array.iterator.js';
|
25
|
-
import 'core-js/modules/es.object.assign.js';
|
26
|
-
import 'core-js/modules/es.set.js';
|
27
|
-
import 'core-js/modules/es.string.split.js';
|
28
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
29
|
-
import 'core-js/modules/es.array.map.js';
|
30
19
|
import '../shortcuts/core.js';
|
31
|
-
import 'core-js/modules/es.array.find-index.js';
|
32
|
-
import 'core-js/modules/es.array.includes.js';
|
33
|
-
import 'core-js/modules/es.array.slice.js';
|
34
|
-
import 'core-js/modules/es.array.splice.js';
|
35
|
-
import 'core-js/modules/es.string.includes.js';
|
36
|
-
import 'core-js/modules/es.string.match.js';
|
37
20
|
import 'combokeys';
|
38
21
|
import '../global/sniffer.js';
|
39
22
|
import 'sniffr';
|
@@ -42,9 +25,9 @@ import 'core-js/modules/es.array.sort.js';
|
|
42
25
|
|
43
26
|
var modules_2f69e2e2 = {"light":"light_rui_2ac4","popup":"popup_rui_871b font_rui_f295","hidden":"hidden_rui_871b","showing":"showing_rui_871b","attached":"attached_rui_871b"};
|
44
27
|
|
45
|
-
|
46
|
-
|
47
|
-
|
28
|
+
const isPossibleClientSideNavigation = event => {
|
29
|
+
const target = event.target;
|
30
|
+
const link = target.closest('a');
|
48
31
|
// Taken from https://github.com/nanostores/router/blob/80a333db4cf0789fda21a02715ebabca15192642/index.js#L58-L69
|
49
32
|
return link && event.button === 0 &&
|
50
33
|
// Left mouse button
|
@@ -68,80 +51,70 @@ var isPossibleClientSideNavigation = function isPossibleClientSideNavigation(eve
|
|
68
51
|
// Not open in new window by user
|
69
52
|
!event.defaultPrevented;
|
70
53
|
};
|
71
|
-
|
54
|
+
const stop = event => {
|
72
55
|
if (!isPossibleClientSideNavigation(event)) {
|
73
56
|
event.stopPropagation();
|
74
57
|
}
|
75
58
|
};
|
76
|
-
|
77
|
-
return typeof target === 'string' ? document.querySelector("[data-portaltarget=".concat(target, "]")) : target;
|
78
|
-
};
|
59
|
+
const getPopupContainer = target => typeof target === 'string' ? document.querySelector("[data-portaltarget=".concat(target, "]")) : target;
|
79
60
|
/**
|
80
61
|
* @constructor
|
81
62
|
* @name Popup
|
82
63
|
* @extends {ReactComponent}
|
83
64
|
*/
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
89
|
-
args[_key] = arguments[_key];
|
90
|
-
}
|
91
|
-
_this = _callSuper(this, Popup, [].concat(args));
|
92
|
-
_defineProperty(_this, "state", {
|
65
|
+
class Popup extends PureComponent {
|
66
|
+
constructor() {
|
67
|
+
super(...arguments);
|
68
|
+
_defineProperty(this, "state", {
|
93
69
|
display: Display.SHOWING
|
94
70
|
});
|
95
|
-
_defineProperty(
|
96
|
-
_defineProperty(
|
97
|
-
_defineProperty(
|
98
|
-
_defineProperty(
|
99
|
-
_defineProperty(
|
100
|
-
_defineProperty(
|
101
|
-
_defineProperty(
|
102
|
-
_defineProperty(
|
103
|
-
_defineProperty(
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
if (el && _this.getContainer()) {
|
112
|
-
_this._redraw();
|
71
|
+
_defineProperty(this, "popup", void 0);
|
72
|
+
_defineProperty(this, "node", void 0);
|
73
|
+
_defineProperty(this, "parent", void 0);
|
74
|
+
_defineProperty(this, "container", void 0);
|
75
|
+
_defineProperty(this, "ringPopupTarget", void 0);
|
76
|
+
_defineProperty(this, "listeners", new Listeners());
|
77
|
+
_defineProperty(this, "redrawScheduler", scheduleRAF(true));
|
78
|
+
_defineProperty(this, "uid", getUID('popup-'));
|
79
|
+
_defineProperty(this, "calculateDisplay", prevState => _objectSpread2(_objectSpread2({}, prevState), {}, {
|
80
|
+
display: this.props.hidden ? Display.SHOWING : Display.SHOWN
|
81
|
+
}));
|
82
|
+
_defineProperty(this, "portalRef", el => {
|
83
|
+
this.node = el;
|
84
|
+
this.parent = el && el.parentElement;
|
85
|
+
if (el && this.getContainer()) {
|
86
|
+
this._redraw();
|
113
87
|
}
|
114
88
|
});
|
115
|
-
_defineProperty(
|
116
|
-
|
117
|
-
|
89
|
+
_defineProperty(this, "popupRef", el => {
|
90
|
+
this.popup = el;
|
91
|
+
this._redraw();
|
118
92
|
});
|
119
|
-
_defineProperty(
|
120
|
-
|
93
|
+
_defineProperty(this, "containerRef", el => {
|
94
|
+
this.container = el;
|
121
95
|
});
|
122
|
-
_defineProperty(
|
123
|
-
if (
|
124
|
-
|
96
|
+
_defineProperty(this, "_updateDirection", newDirection => {
|
97
|
+
if (this.state.direction !== newDirection) {
|
98
|
+
this.setState({
|
125
99
|
direction: newDirection
|
126
100
|
});
|
127
|
-
if (
|
128
|
-
|
101
|
+
if (this.props.onDirectionChange) {
|
102
|
+
this.props.onDirectionChange(newDirection);
|
129
103
|
}
|
130
104
|
}
|
131
105
|
});
|
132
|
-
_defineProperty(
|
133
|
-
|
106
|
+
_defineProperty(this, "_updatePosition", () => {
|
107
|
+
const popup = this.popup;
|
134
108
|
if (popup) {
|
135
109
|
popup.style.position = 'absolute';
|
136
|
-
if (
|
137
|
-
|
138
|
-
style
|
139
|
-
direction
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
var propKey = key;
|
110
|
+
if (this.isVisible()) {
|
111
|
+
const {
|
112
|
+
styles: style,
|
113
|
+
direction
|
114
|
+
} = this.position();
|
115
|
+
Object.entries(style).forEach(_ref => {
|
116
|
+
let [key, value] = _ref;
|
117
|
+
const propKey = key;
|
145
118
|
if (typeof value === 'number') {
|
146
119
|
popup.style[propKey] = "".concat(value, "px");
|
147
120
|
} else {
|
@@ -149,243 +122,219 @@ var Popup = /*#__PURE__*/function (_PureComponent) {
|
|
149
122
|
}
|
150
123
|
});
|
151
124
|
if (direction != null) {
|
152
|
-
|
125
|
+
this._updateDirection(direction);
|
153
126
|
}
|
154
127
|
}
|
155
|
-
|
128
|
+
this.setState(this.calculateDisplay);
|
156
129
|
}
|
157
130
|
});
|
158
|
-
_defineProperty(
|
159
|
-
if (
|
160
|
-
|
131
|
+
_defineProperty(this, "_redraw", () => {
|
132
|
+
if (this.isVisible()) {
|
133
|
+
this.redrawScheduler(this._updatePosition);
|
161
134
|
}
|
162
135
|
});
|
163
|
-
_defineProperty(
|
164
|
-
_defineProperty(
|
165
|
-
|
166
|
-
|
136
|
+
_defineProperty(this, "_listenersEnabled", void 0);
|
137
|
+
_defineProperty(this, "_onEscPress", evt => {
|
138
|
+
this.props.onEscPress(evt);
|
139
|
+
this._onCloseAttempt(evt, true);
|
167
140
|
});
|
168
141
|
/**
|
169
142
|
* @param {jQuery.Event} evt
|
170
143
|
* @private
|
171
144
|
*/
|
172
|
-
_defineProperty(
|
145
|
+
_defineProperty(this, "_onDocumentClick", evt => {
|
173
146
|
var _this$_getAnchor;
|
174
|
-
if (
|
147
|
+
if (this.container && evt.target instanceof Node && this.container.contains(evt.target) || !this._listenersEnabled || this.props.dontCloseOnAnchorClick && evt.target instanceof Node && (_this$_getAnchor = this._getAnchor()) !== null && _this$_getAnchor !== void 0 && _this$_getAnchor.contains(evt.target)) {
|
175
148
|
return;
|
176
149
|
}
|
177
|
-
|
178
|
-
|
150
|
+
this.props.onOutsideClick(evt);
|
151
|
+
this._onCloseAttempt(evt, false);
|
179
152
|
});
|
180
|
-
_defineProperty(
|
181
|
-
_defineProperty(
|
182
|
-
esc:
|
153
|
+
_defineProperty(this, "shortcutsScope", this.uid);
|
154
|
+
_defineProperty(this, "shortcutsMap", {
|
155
|
+
esc: this._onEscPress
|
183
156
|
});
|
184
|
-
return _this;
|
185
157
|
}
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
if (!this.props.client) {
|
191
|
-
this.setState({
|
192
|
-
client: true
|
193
|
-
});
|
194
|
-
}
|
195
|
-
if (!this.props.hidden) {
|
196
|
-
this._setListenersEnabled(true);
|
197
|
-
}
|
198
|
-
}
|
199
|
-
}, {
|
200
|
-
key: "componentDidUpdate",
|
201
|
-
value: function componentDidUpdate(prevProps, prevState) {
|
202
|
-
var hidden = this.props.hidden;
|
203
|
-
if (this.props !== prevProps) {
|
204
|
-
if (prevProps.hidden !== hidden) {
|
205
|
-
this._setListenersEnabled(!hidden);
|
206
|
-
}
|
207
|
-
this._redraw();
|
208
|
-
}
|
209
|
-
if (this.props.onShow && !hidden && this.state.display === Display.SHOWN && (prevProps.hidden || prevState.display !== Display.SHOWN)) {
|
210
|
-
this.props.onShow();
|
211
|
-
}
|
212
|
-
}
|
213
|
-
}, {
|
214
|
-
key: "componentWillUnmount",
|
215
|
-
value: function componentWillUnmount() {
|
216
|
-
this._setListenersEnabled(false);
|
217
|
-
}
|
218
|
-
}, {
|
219
|
-
key: "shouldUseShortcuts",
|
220
|
-
value: function shouldUseShortcuts() {
|
221
|
-
var _this$props = this.props,
|
222
|
-
shortcuts = _this$props.shortcuts,
|
223
|
-
hidden = _this$props.hidden;
|
224
|
-
return shortcuts && !hidden;
|
225
|
-
}
|
226
|
-
}, {
|
227
|
-
key: "getContainer",
|
228
|
-
value: function getContainer() {
|
229
|
-
var target = this.props.target || this.ringPopupTarget;
|
230
|
-
return target && getPopupContainer(target);
|
231
|
-
}
|
232
|
-
}, {
|
233
|
-
key: "position",
|
234
|
-
value: function position$1() {
|
235
|
-
var _this$props2 = this.props,
|
236
|
-
directions = _this$props2.directions,
|
237
|
-
autoPositioning = _this$props2.autoPositioning,
|
238
|
-
autoCorrectTopOverflow = _this$props2.autoCorrectTopOverflow,
|
239
|
-
sidePadding = _this$props2.sidePadding,
|
240
|
-
top = _this$props2.top,
|
241
|
-
left = _this$props2.left,
|
242
|
-
offset = _this$props2.offset,
|
243
|
-
maxHeight = _this$props2.maxHeight,
|
244
|
-
minWidth = _this$props2.minWidth;
|
245
|
-
var container = this.getContainer();
|
246
|
-
return position({
|
247
|
-
popup: this.popup,
|
248
|
-
container: container && getStyles(container).position !== 'static' ? container : null,
|
249
|
-
anchor: this._getAnchor(),
|
250
|
-
directions,
|
251
|
-
autoPositioning,
|
252
|
-
autoCorrectTopOverflow,
|
253
|
-
sidePadding,
|
254
|
-
top,
|
255
|
-
left,
|
256
|
-
offset,
|
257
|
-
maxHeight,
|
258
|
-
minWidth
|
158
|
+
componentDidMount() {
|
159
|
+
if (!this.props.client) {
|
160
|
+
this.setState({
|
161
|
+
client: true
|
259
162
|
});
|
260
163
|
}
|
261
|
-
|
262
|
-
|
263
|
-
value: function _getAnchor() {
|
264
|
-
return this.props.anchorElement || this.parent;
|
164
|
+
if (!this.props.hidden) {
|
165
|
+
this._setListenersEnabled(true);
|
265
166
|
}
|
266
|
-
}
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
var _this2 = this;
|
275
|
-
if (enable && !this._listenersEnabled) {
|
276
|
-
setTimeout(function () {
|
277
|
-
_this2._listenersEnabled = true;
|
278
|
-
_this2.listeners.add(window, 'resize', _this2._redraw);
|
279
|
-
if (_this2.props.autoPositioningOnScroll) {
|
280
|
-
_this2.listeners.add(window, 'scroll', _this2._redraw);
|
281
|
-
}
|
282
|
-
_this2.listeners.add(document, 'pointerdown', _this2._onDocumentClick, true);
|
283
|
-
var el = _this2._getAnchor();
|
284
|
-
while (el) {
|
285
|
-
_this2.listeners.add(el, 'scroll', _this2._redraw);
|
286
|
-
el = el.parentElement;
|
287
|
-
}
|
288
|
-
}, 0);
|
289
|
-
return;
|
290
|
-
}
|
291
|
-
if (!enable && this._listenersEnabled) {
|
292
|
-
this.listeners.removeAll();
|
293
|
-
this._listenersEnabled = false;
|
167
|
+
}
|
168
|
+
componentDidUpdate(prevProps, prevState) {
|
169
|
+
const {
|
170
|
+
hidden
|
171
|
+
} = this.props;
|
172
|
+
if (this.props !== prevProps) {
|
173
|
+
if (prevProps.hidden !== hidden) {
|
174
|
+
this._setListenersEnabled(!hidden);
|
294
175
|
}
|
176
|
+
this._redraw();
|
295
177
|
}
|
296
|
-
|
297
|
-
|
298
|
-
* @return {boolean}
|
299
|
-
*/
|
300
|
-
}, {
|
301
|
-
key: "isVisible",
|
302
|
-
value: function isVisible() {
|
303
|
-
return !this.props.hidden;
|
178
|
+
if (this.props.onShow && !hidden && this.state.display === Display.SHOWN && (prevProps.hidden || prevState.display !== Display.SHOWN)) {
|
179
|
+
this.props.onShow();
|
304
180
|
}
|
305
|
-
}
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
ref: _this3.containerRef,
|
363
|
-
onMouseOver: onMouseOver,
|
364
|
-
onFocus: onMouseOver,
|
365
|
-
onMouseOut: onMouseOut,
|
366
|
-
onBlur: onMouseOut,
|
367
|
-
onContextMenu: onContextMenu,
|
368
|
-
children: /*#__PURE__*/jsx("div", {
|
369
|
-
"data-test": joinDataTestAttributes('ring-popup', dataTest),
|
370
|
-
"data-test-shown": !hidden && !showing,
|
371
|
-
"data-test-direction": direction,
|
372
|
-
ref: _this3.popupRef,
|
373
|
-
className: classes,
|
374
|
-
style: style,
|
375
|
-
onMouseDown: onMouseDown,
|
376
|
-
onMouseUp: onMouseUp
|
377
|
-
// mouse handlers are used to track clicking on inner elements
|
378
|
-
,
|
379
|
-
role: "presentation",
|
380
|
-
children: _this3.getInternalContent()
|
381
|
-
})
|
382
|
-
}), _this3.getContainer() || document.body)]
|
383
|
-
});
|
181
|
+
}
|
182
|
+
componentWillUnmount() {
|
183
|
+
this._setListenersEnabled(false);
|
184
|
+
}
|
185
|
+
shouldUseShortcuts() {
|
186
|
+
const {
|
187
|
+
shortcuts,
|
188
|
+
hidden
|
189
|
+
} = this.props;
|
190
|
+
return shortcuts && !hidden;
|
191
|
+
}
|
192
|
+
getContainer() {
|
193
|
+
const target = this.props.target || this.ringPopupTarget;
|
194
|
+
return target && getPopupContainer(target);
|
195
|
+
}
|
196
|
+
position() {
|
197
|
+
const {
|
198
|
+
directions,
|
199
|
+
autoPositioning,
|
200
|
+
autoCorrectTopOverflow,
|
201
|
+
sidePadding,
|
202
|
+
top,
|
203
|
+
left,
|
204
|
+
offset,
|
205
|
+
maxHeight,
|
206
|
+
minWidth
|
207
|
+
} = this.props;
|
208
|
+
const container = this.getContainer();
|
209
|
+
return position({
|
210
|
+
popup: this.popup,
|
211
|
+
container: container && getStyles(container).position !== 'static' ? container : null,
|
212
|
+
anchor: this._getAnchor(),
|
213
|
+
directions,
|
214
|
+
autoPositioning,
|
215
|
+
autoCorrectTopOverflow,
|
216
|
+
sidePadding,
|
217
|
+
top,
|
218
|
+
left,
|
219
|
+
offset,
|
220
|
+
maxHeight,
|
221
|
+
minWidth
|
222
|
+
});
|
223
|
+
}
|
224
|
+
_getAnchor() {
|
225
|
+
return this.props.anchorElement || this.parent;
|
226
|
+
}
|
227
|
+
/**
|
228
|
+
* @param {boolean} enable
|
229
|
+
* @private
|
230
|
+
*/
|
231
|
+
_setListenersEnabled(enable) {
|
232
|
+
if (enable && !this._listenersEnabled) {
|
233
|
+
setTimeout(() => {
|
234
|
+
this._listenersEnabled = true;
|
235
|
+
this.listeners.add(window, 'resize', this._redraw);
|
236
|
+
if (this.props.autoPositioningOnScroll) {
|
237
|
+
this.listeners.add(window, 'scroll', this._redraw);
|
384
238
|
}
|
385
|
-
|
239
|
+
this.listeners.add(document, 'pointerdown', this._onDocumentClick, true);
|
240
|
+
let el = this._getAnchor();
|
241
|
+
while (el) {
|
242
|
+
this.listeners.add(el, 'scroll', this._redraw);
|
243
|
+
el = el.parentElement;
|
244
|
+
}
|
245
|
+
}, 0);
|
246
|
+
return;
|
247
|
+
}
|
248
|
+
if (!enable && this._listenersEnabled) {
|
249
|
+
this.listeners.removeAll();
|
250
|
+
this._listenersEnabled = false;
|
386
251
|
}
|
387
|
-
}
|
388
|
-
|
252
|
+
}
|
253
|
+
/**
|
254
|
+
* Returns visibility state
|
255
|
+
* @return {boolean}
|
256
|
+
*/
|
257
|
+
isVisible() {
|
258
|
+
return !this.props.hidden;
|
259
|
+
}
|
260
|
+
_onCloseAttempt(evt, isEsc) {
|
261
|
+
this.props.onCloseAttempt(evt, isEsc);
|
262
|
+
}
|
263
|
+
getInternalContent() {
|
264
|
+
const {
|
265
|
+
trapFocus,
|
266
|
+
autoFocusFirst,
|
267
|
+
children
|
268
|
+
} = this.props;
|
269
|
+
return trapFocus ? /*#__PURE__*/jsx(TabTrap, {
|
270
|
+
autoFocusFirst: autoFocusFirst,
|
271
|
+
focusBackOnExit: true,
|
272
|
+
children: children
|
273
|
+
}) : children;
|
274
|
+
}
|
275
|
+
render() {
|
276
|
+
const {
|
277
|
+
className,
|
278
|
+
style,
|
279
|
+
hidden,
|
280
|
+
attached,
|
281
|
+
keepMounted,
|
282
|
+
client,
|
283
|
+
onMouseDown,
|
284
|
+
onMouseUp,
|
285
|
+
onMouseOver,
|
286
|
+
onMouseOut,
|
287
|
+
onContextMenu,
|
288
|
+
'data-test': dataTest
|
289
|
+
} = this.props;
|
290
|
+
const showing = this.state.display === Display.SHOWING;
|
291
|
+
const classes = classNames(className, modules_2f69e2e2.popup, {
|
292
|
+
[modules_2f69e2e2.attached]: attached,
|
293
|
+
[modules_2f69e2e2.hidden]: hidden,
|
294
|
+
[modules_2f69e2e2.showing]: showing
|
295
|
+
});
|
296
|
+
const direction = (this.state.direction || '').toLowerCase().replace(/[_]/g, '-');
|
297
|
+
return /*#__PURE__*/jsx(PopupTargetContext.Consumer, {
|
298
|
+
children: value => {
|
299
|
+
this.ringPopupTarget = value;
|
300
|
+
return /*#__PURE__*/jsxs("span", {
|
301
|
+
// prevent bubbling through portal
|
302
|
+
onClick: stop
|
303
|
+
// This handler only blocks bubbling through React portal
|
304
|
+
,
|
305
|
+
role: "presentation",
|
306
|
+
ref: this.portalRef,
|
307
|
+
children: [this.shouldUseShortcuts() && /*#__PURE__*/jsx(Shortcuts, {
|
308
|
+
map: this.shortcutsMap,
|
309
|
+
scope: this.shortcutsScope
|
310
|
+
}), (client || this.state.client) && (keepMounted || !hidden) && /*#__PURE__*/createPortal( /*#__PURE__*/jsx(PopupTarget, {
|
311
|
+
id: this.uid,
|
312
|
+
ref: this.containerRef,
|
313
|
+
onMouseOver: onMouseOver,
|
314
|
+
onFocus: onMouseOver,
|
315
|
+
onMouseOut: onMouseOut,
|
316
|
+
onBlur: onMouseOut,
|
317
|
+
onContextMenu: onContextMenu,
|
318
|
+
children: /*#__PURE__*/jsx("div", {
|
319
|
+
"data-test": joinDataTestAttributes('ring-popup', dataTest),
|
320
|
+
"data-test-shown": !hidden && !showing,
|
321
|
+
"data-test-direction": direction,
|
322
|
+
ref: this.popupRef,
|
323
|
+
className: classes,
|
324
|
+
style: style,
|
325
|
+
onMouseDown: onMouseDown,
|
326
|
+
onMouseUp: onMouseUp
|
327
|
+
// mouse handlers are used to track clicking on inner elements
|
328
|
+
,
|
329
|
+
role: "presentation",
|
330
|
+
children: this.getInternalContent()
|
331
|
+
})
|
332
|
+
}), this.getContainer() || document.body)]
|
333
|
+
});
|
334
|
+
}
|
335
|
+
});
|
336
|
+
}
|
337
|
+
}
|
389
338
|
_defineProperty(Popup, "defaultProps", {
|
390
339
|
shortcuts: true,
|
391
340
|
hidden: false,
|
@@ -1,15 +1,17 @@
|
|
1
|
-
import {
|
1
|
+
import { a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
2
|
import { createContext, forwardRef } from 'react';
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
const _excluded = ["id", "children"];
|
7
|
+
const PopupTargetContext = /*#__PURE__*/createContext(undefined);
|
8
|
+
const PopupTarget = /*#__PURE__*/forwardRef(function PopupTarget(_ref, ref) {
|
9
|
+
let {
|
10
|
+
id,
|
11
|
+
children
|
12
|
+
} = _ref,
|
11
13
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
12
|
-
|
14
|
+
const target = /*#__PURE__*/jsx("div", _objectSpread2(_objectSpread2({}, restProps), {}, {
|
13
15
|
"data-portaltarget": id,
|
14
16
|
ref: ref,
|
15
17
|
children: typeof children !== 'function' && children
|