@jetbrains/ring-ui-built 7.0.65 → 7.0.70
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/anchor.js +12 -17
- package/components/_helpers/avatar-info.js +4 -5
- package/components/_helpers/button.classes.js +20 -21
- package/components/_helpers/caption.js +3 -3
- package/components/_helpers/card.js +26 -32
- package/components/_helpers/dialog-body-scroll-preventer.js +1 -2
- package/components/_helpers/icon-svg.js +9 -12
- package/components/_helpers/input.js +78 -86
- package/components/_helpers/loader-core.js +260 -0
- package/components/_helpers/query-assist-suggestions.js +0 -1
- package/components/_helpers/select-filter.js +19 -26
- package/components/_helpers/services-link.js +9 -12
- package/components/_helpers/sidebar.js +36 -44
- package/components/_helpers/tab-link.js +9 -11
- package/components/_helpers/theme.js +20 -24
- package/components/_helpers/title.js +12 -17
- package/components/alert/alert.js +41 -49
- package/components/alert/container.js +9 -12
- package/components/alert-service/alert-service.js +23 -32
- package/components/analytics/analytics-custom-plugin.js +12 -17
- package/components/analytics/analytics.js +1 -3
- package/components/auth/auth-core.js +128 -170
- package/components/auth/auth.js +3 -10
- package/components/auth/background-flow.js +5 -8
- package/components/auth/down-notification.js +9 -17
- package/components/auth/iframe-flow.js +13 -19
- package/components/auth/request-builder.js +4 -9
- package/components/auth/response-parser.js +9 -12
- package/components/auth/storage.js +12 -18
- package/components/auth/token-validator.js +19 -30
- package/components/auth/window-flow.js +22 -27
- package/components/auth-dialog/auth-dialog.js +40 -48
- package/components/auth-dialog-service/auth-dialog-service.js +10 -13
- package/components/avatar/avatar.figma.js +6 -6
- package/components/avatar/avatar.js +58 -59
- package/components/avatar/fallback-avatar.js +8 -11
- package/components/avatar-stack/avatar-stack.figma.js +10 -11
- package/components/avatar-stack/avatar-stack.js +25 -31
- package/components/banner/banner.js +0 -6
- package/components/breadcrumbs/breadcrumbs.figma.js +8 -6
- package/components/breadcrumbs/breadcrumbs.js +4 -5
- package/components/button/button.figma.js +15 -10
- package/components/button/button.js +59 -64
- package/components/button-group/button-group.js +11 -15
- package/components/button-group/caption.js +0 -1
- package/components/button-set/button-set.js +9 -12
- package/components/button-toolbar/button-toolbar.js +8 -11
- package/components/caret/caret.js +20 -28
- package/components/checkbox/checkbox-group.figma.js +8 -10
- package/components/checkbox/checkbox.figma.js +5 -5
- package/components/checkbox/checkbox.js +27 -35
- package/components/clipboard/clipboard-fallback.js +3 -3
- package/components/clipboard/clipboard.js +3 -16
- package/components/code/code.js +8 -14
- package/components/collapse/collapse-content.js +10 -15
- package/components/collapse/collapse-control.js +5 -7
- package/components/collapse/collapse.js +9 -11
- package/components/collapse/utils.js +1 -1
- package/components/confirm/confirm.js +17 -26
- package/components/confirm-service/confirm-service.js +30 -31
- package/components/content-layout/content-layout.js +21 -28
- package/components/content-layout/sidebar.js +0 -2
- package/components/contenteditable/contenteditable.js +23 -28
- package/components/control-help/control-help.js +8 -10
- package/components/control-label/control-label.js +12 -17
- package/components/data-list/data-list.js +57 -65
- package/components/data-list/data-list.mock.js +0 -4
- package/components/data-list/item.js +65 -72
- package/components/data-list/selection.js +11 -19
- package/components/data-list/title.js +0 -4
- package/components/date-picker/consts.js +3 -4
- package/components/date-picker/date-input.js +25 -33
- package/components/date-picker/date-picker.js +179 -193
- package/components/date-picker/date-popup.js +135 -127
- package/components/date-picker/day.d.ts +1 -1
- package/components/date-picker/day.js +24 -30
- package/components/date-picker/month-names.js +7 -12
- package/components/date-picker/month-slider.js +16 -22
- package/components/date-picker/month.js +3 -5
- package/components/date-picker/months.js +6 -6
- package/components/date-picker/weekdays.js +0 -1
- package/components/date-picker/years.js +20 -26
- package/components/dialog/dialog-body-scroll-preventer.js +0 -1
- package/components/dialog/dialog.js +73 -83
- package/components/dropdown/anchor.js +0 -4
- package/components/dropdown/dropdown.js +98 -114
- package/components/dropdown-menu/dropdown-menu.js +80 -79
- package/components/editable-heading/editable-heading.js +48 -54
- package/components/error-bubble/error-bubble.figma.js +4 -4
- package/components/error-bubble/error-bubble.js +9 -13
- package/components/error-message/error-message.js +1 -6
- package/components/footer/footer.js +11 -15
- package/components/global/compose-refs.js +1 -4
- package/components/global/compose.js +1 -4
- package/components/global/configuration.js +3 -3
- package/components/global/controls-height.js +0 -1
- package/components/global/create-stateful-context.js +10 -14
- package/components/global/data-tests.js +2 -10
- package/components/global/dom.js +6 -19
- package/components/global/focus-sensor-hoc.js +74 -87
- package/components/global/fuzzy-highlight.js +3 -8
- package/components/global/get-uid.js +1 -1
- package/components/global/inject-styles.js +5 -6
- package/components/global/listeners.js +2 -11
- package/components/global/memoize.js +0 -2
- package/components/global/normalize-indent.js +2 -6
- package/components/global/promise-with-timeout.js +4 -5
- package/components/global/react-dom-renderer.js +4 -9
- package/components/global/rerender-hoc.js +8 -11
- package/components/global/schedule-raf.js +1 -2
- package/components/global/theme.js +0 -5
- package/components/global/trivial-template-tag.js +1 -6
- package/components/global/url.js +2 -6
- package/components/global/use-event-callback.js +2 -3
- package/components/grid/col.js +7 -18
- package/components/grid/grid.js +9 -14
- package/components/grid/row.js +7 -11
- package/components/group/group.js +9 -12
- package/components/header/header-icon.js +8 -13
- package/components/header/header.js +16 -27
- package/components/header/links.js +7 -10
- package/components/header/logo.js +12 -16
- package/components/header/profile.js +73 -83
- package/components/header/services-link.js +0 -2
- package/components/header/services.js +32 -43
- package/components/header/smart-profile.js +44 -59
- package/components/header/smart-services.js +33 -45
- package/components/header/tray.js +8 -10
- package/components/heading/heading.js +27 -27
- package/components/http/http.js +120 -125
- package/components/http/http.mock.js +6 -10
- package/components/hub-source/hub-source-user.js +6 -13
- package/components/hub-source/hub-source-users-groups.js +8 -12
- package/components/hub-source/hub-source.js +8 -10
- package/components/i18n/i18n-context.js +4 -7
- package/components/i18n/i18n.js +5 -5
- package/components/icon/icon-svg.js +0 -4
- package/components/icon/icon.js +28 -32
- package/components/icon/index.js +0 -4
- package/components/input/input.figma.js +8 -8
- package/components/input/input.js +0 -4
- package/components/island/adaptive-island-hoc.js +19 -23
- package/components/island/content.js +70 -75
- package/components/island/header.js +21 -21
- package/components/island/island.js +11 -14
- package/components/link/clickable-link.js +30 -37
- package/components/link/link.js +27 -29
- package/components/list/list-custom.js +6 -11
- package/components/list/list-item.js +49 -56
- package/components/list/list-separator.js +0 -1
- package/components/list/list-title.js +0 -1
- package/components/list/list-users-groups-source.js +14 -22
- package/components/list/list.classes.js +8 -9
- package/components/list/list.js +387 -404
- package/components/loader/loader-core.js +2 -265
- package/components/loader/loader.d.ts +8 -0
- package/components/loader/loader.js +43 -29
- package/components/loader-inline/loader-inline.js +9 -12
- package/components/loader-screen/loader-screen.js +10 -14
- package/components/login-dialog/login-dialog.js +46 -54
- package/components/login-dialog/service.js +13 -15
- package/components/message/message.js +65 -79
- package/components/old-browsers-message/old-browsers-message-stop.js +0 -3
- package/components/old-browsers-message/old-browsers-message.js +1 -4
- package/components/old-browsers-message/white-list.js +5 -7
- package/components/pager/pager.js +73 -88
- package/components/panel/panel.js +9 -12
- package/components/permissions/permissions-cache.js +6 -8
- package/components/permissions/permissions.js +19 -21
- package/components/popup/popup.js +136 -145
- package/components/popup/popup.target.js +8 -10
- package/components/popup/position-css.js +19 -27
- package/components/popup/position.js +22 -28
- package/components/popup-menu/popup-menu.js +27 -37
- package/components/progress-bar/progress-bar.js +26 -32
- package/components/query-assist/query-assist-suggestions.js +0 -6
- package/components/query-assist/query-assist.js +432 -468
- package/components/radio/radio-item.js +30 -40
- package/components/radio/radio.js +6 -10
- package/components/scrollable-section/scrollable-section.js +7 -10
- package/components/select/select-filter.js +0 -6
- package/components/select/select-popup.js +155 -174
- package/components/select/select.js +464 -479
- package/components/shortcuts/core.js +40 -45
- package/components/shortcuts/shortcut-title.js +0 -1
- package/components/shortcuts/shortcuts-hoc.js +9 -15
- package/components/shortcuts/shortcuts.js +3 -5
- package/components/slider/slider.js +53 -66
- package/components/slider/slider.utils.js +1 -4
- package/components/storage/storage-local.js +2 -8
- package/components/storage/storage.js +0 -5
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +21 -30
- package/components/table/cell.js +3 -4
- package/components/table/disable-hover-hoc.js +24 -28
- package/components/table/header-cell.js +30 -38
- package/components/table/header.js +20 -28
- package/components/table/multitable.js +81 -101
- package/components/table/row-with-focus-sensor.js +17 -28
- package/components/table/row.js +89 -99
- package/components/table/selection-adapter.js +0 -2
- package/components/table/selection-shortcuts-hoc.js +159 -161
- package/components/table/selection.js +23 -31
- package/components/table/simple-table.js +16 -22
- package/components/table/smart-table.js +19 -26
- package/components/table/table.js +137 -146
- package/components/tabs/collapsible-more.js +34 -47
- package/components/tabs/collapsible-tab.js +28 -33
- package/components/tabs/collapsible-tabs.js +18 -26
- package/components/tabs/custom-item.js +3 -6
- package/components/tabs/dumb-tabs.js +48 -64
- package/components/tabs/smart-tabs.js +14 -23
- package/components/tabs/tab-link.js +0 -2
- package/components/tabs/tab.js +0 -1
- package/components/tabs/tabs.js +0 -7
- package/components/tag/tag.js +30 -35
- package/components/tags-input/tags-input.js +192 -218
- package/components/tags-list/tags-list.js +26 -31
- package/components/text/text.js +16 -19
- package/components/toggle/toggle.js +19 -23
- package/components/tooltip/tooltip.js +110 -121
- package/components/upload/upload.js +19 -28
- package/components/user-agreement/service.js +247 -252
- package/components/user-agreement/toolbox.eula.js +160 -1
- package/components/user-agreement/user-agreement.js +23 -32
- package/components/user-card/card.js +0 -5
- package/components/user-card/smart-user-card-tooltip.js +41 -50
- package/components/user-card/tooltip.js +32 -38
- package/components/user-card/user-card.js +0 -5
- package/package.json +9 -3
- package/components/_helpers/_rollupPluginBabelHelpers.js +0 -72
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { jsx } from 'react/jsx-runtime';
|
|
4
2
|
import { PureComponent, createRef } from 'react';
|
|
5
3
|
import classNames from 'classnames';
|
|
@@ -14,7 +12,6 @@ import { subYears } from 'date-fns/subYears';
|
|
|
14
12
|
import linearFunction from '../global/linear-function.js';
|
|
15
13
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
16
14
|
import units, { yearDuration, DOUBLE, HALF } from './consts.js';
|
|
17
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
18
15
|
import 'date-fns/add';
|
|
19
16
|
|
|
20
17
|
const {
|
|
@@ -25,29 +22,9 @@ let scrollTO;
|
|
|
25
22
|
const YEARSBACK = 5;
|
|
26
23
|
const scrollDelay = 100;
|
|
27
24
|
class Years extends PureComponent {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
scrollDate: null
|
|
32
|
-
});
|
|
33
|
-
_defineProperty(this, "stoppedScrolling", void 0);
|
|
34
|
-
_defineProperty(this, "componentRef", /*#__PURE__*/createRef());
|
|
35
|
-
_defineProperty(this, "handleWheel", e => {
|
|
36
|
-
const {
|
|
37
|
-
scrollDate
|
|
38
|
-
} = this.props;
|
|
39
|
-
const date = this.state.scrollDate || scrollDate;
|
|
40
|
-
e.preventDefault();
|
|
41
|
-
const newScrollDate = linearFunction(0, Number(date), yearDuration / yearHeight).y(e.deltaY);
|
|
42
|
-
this.setState({
|
|
43
|
-
scrollDate: newScrollDate
|
|
44
|
-
});
|
|
45
|
-
if (scrollTO) {
|
|
46
|
-
window.clearTimeout(scrollTO);
|
|
47
|
-
}
|
|
48
|
-
scrollTO = window.setTimeout(() => this.setYear(newScrollDate), scrollDelay);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
25
|
+
state = {
|
|
26
|
+
scrollDate: null
|
|
27
|
+
};
|
|
51
28
|
componentDidMount() {
|
|
52
29
|
if (this.componentRef.current) {
|
|
53
30
|
this.componentRef.current.addEventListener('wheel', this.handleWheel);
|
|
@@ -61,6 +38,7 @@ class Years extends PureComponent {
|
|
|
61
38
|
this.componentRef.current.removeEventListener('wheel', this.handleWheel);
|
|
62
39
|
}
|
|
63
40
|
}
|
|
41
|
+
stoppedScrolling;
|
|
64
42
|
setYear(date) {
|
|
65
43
|
if (scrollTO) {
|
|
66
44
|
window.clearTimeout(scrollTO);
|
|
@@ -71,6 +49,22 @@ class Years extends PureComponent {
|
|
|
71
49
|
});
|
|
72
50
|
this.props.onScroll(Number(setYear(this.props.scrollDate, getYear(date))));
|
|
73
51
|
}
|
|
52
|
+
componentRef = /*#__PURE__*/createRef();
|
|
53
|
+
handleWheel = e => {
|
|
54
|
+
const {
|
|
55
|
+
scrollDate
|
|
56
|
+
} = this.props;
|
|
57
|
+
const date = this.state.scrollDate || scrollDate;
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
const newScrollDate = linearFunction(0, Number(date), yearDuration / yearHeight).y(e.deltaY);
|
|
60
|
+
this.setState({
|
|
61
|
+
scrollDate: newScrollDate
|
|
62
|
+
});
|
|
63
|
+
if (scrollTO) {
|
|
64
|
+
window.clearTimeout(scrollTO);
|
|
65
|
+
}
|
|
66
|
+
scrollTO = window.setTimeout(() => this.setYear(newScrollDate), scrollDelay);
|
|
67
|
+
};
|
|
74
68
|
render() {
|
|
75
69
|
const {
|
|
76
70
|
onScrollChange,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty, a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
4
2
|
import { PureComponent, createRef } from 'react';
|
|
5
3
|
import { createPortal } from 'react-dom';
|
|
@@ -22,7 +20,6 @@ import '../island/content.js';
|
|
|
22
20
|
import 'element-resize-detector';
|
|
23
21
|
import '../global/schedule-raf.js';
|
|
24
22
|
import '../shortcuts/core.js';
|
|
25
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
26
23
|
import 'combokeys';
|
|
27
24
|
import '../global/sniffer.js';
|
|
28
25
|
import 'sniffr';
|
|
@@ -33,56 +30,40 @@ import 'util-deprecate';
|
|
|
33
30
|
import '../icon/icon.js';
|
|
34
31
|
import '../icon/icon.constants.js';
|
|
35
32
|
import '../_helpers/icon-svg.js';
|
|
36
|
-
import 'core-js/modules/es.string.replace.js';
|
|
37
33
|
import '../global/memoize.js';
|
|
38
34
|
import '../link/clickable-link.js';
|
|
39
35
|
import '../global/controls-height.js';
|
|
40
36
|
import '../global/configuration.js';
|
|
41
37
|
import '../_helpers/button.classes.js';
|
|
42
38
|
import '../popup/position.js';
|
|
43
|
-
import 'core-js/modules/es.array.sort.js';
|
|
44
39
|
import '../popup/popup.consts.js';
|
|
45
40
|
import '../popup/position-css.js';
|
|
46
41
|
import 'scrollbar-width';
|
|
47
42
|
|
|
48
|
-
const _excluded = ["show", "showCloseButton", "onOverlayClick", "onCloseAttempt", "onEscPress", "onCloseClick", "children", "className", "contentClassName", "trapFocus", "data-test", "closeButtonInside", "portalTarget", "label", "closeButtonTitle", "dense", "shortcutOptions", "native", "modal", "preventBodyScroll"];
|
|
49
43
|
/**
|
|
50
44
|
* @name Dialog
|
|
51
45
|
*/
|
|
52
46
|
function noop() {}
|
|
53
47
|
class Dialog extends PureComponent {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.props.onCloseAttempt(event);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
return {
|
|
77
|
-
esc: onEscape
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
_defineProperty(this, "dialog", void 0);
|
|
81
|
-
_defineProperty(this, "dialogRef", tabTrap => {
|
|
82
|
-
this.dialog = tabTrap && tabTrap.node;
|
|
83
|
-
});
|
|
84
|
-
_defineProperty(this, "nativeDialog", /*#__PURE__*/createRef());
|
|
85
|
-
}
|
|
48
|
+
static defaultProps = {
|
|
49
|
+
label: 'Dialog',
|
|
50
|
+
onOverlayClick: noop,
|
|
51
|
+
onEscPress: noop,
|
|
52
|
+
onCloseClick: noop,
|
|
53
|
+
onCloseAttempt: noop,
|
|
54
|
+
showCloseButton: false,
|
|
55
|
+
closeButtonInside: false,
|
|
56
|
+
shortcutOptions: {
|
|
57
|
+
modal: false
|
|
58
|
+
},
|
|
59
|
+
trapFocus: false,
|
|
60
|
+
autoFocusFirst: true,
|
|
61
|
+
modal: true,
|
|
62
|
+
preventBodyScroll: true
|
|
63
|
+
};
|
|
64
|
+
state = {
|
|
65
|
+
shortcutsScope: getUID('ring-dialog-')
|
|
66
|
+
};
|
|
86
67
|
componentDidMount() {
|
|
87
68
|
const {
|
|
88
69
|
show,
|
|
@@ -108,6 +89,8 @@ class Dialog extends PureComponent {
|
|
|
108
89
|
componentWillUnmount() {
|
|
109
90
|
this.scrollPreventer.reset();
|
|
110
91
|
}
|
|
92
|
+
scrollPreventer = preventerFactory(getUID('preventer-'));
|
|
93
|
+
uid = getUID('dialog-');
|
|
111
94
|
toggleNativeDialog() {
|
|
112
95
|
const {
|
|
113
96
|
show,
|
|
@@ -136,31 +119,54 @@ class Dialog extends PureComponent {
|
|
|
136
119
|
this.scrollPreventer.reset();
|
|
137
120
|
}
|
|
138
121
|
}
|
|
122
|
+
handleClick = event => {
|
|
123
|
+
this.props.onOverlayClick(event);
|
|
124
|
+
this.props.onCloseAttempt(event);
|
|
125
|
+
};
|
|
126
|
+
onCloseClick = event => {
|
|
127
|
+
this.props.onCloseClick(event);
|
|
128
|
+
this.props.onCloseAttempt(event);
|
|
129
|
+
};
|
|
130
|
+
getShortcutsMap = () => {
|
|
131
|
+
const onEscape = event => {
|
|
132
|
+
if (this.props.show) {
|
|
133
|
+
this.props.onEscPress(event);
|
|
134
|
+
this.props.onCloseAttempt(event);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
return {
|
|
138
|
+
esc: onEscape
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
dialog;
|
|
142
|
+
dialogRef = tabTrap => {
|
|
143
|
+
this.dialog = tabTrap && tabTrap.node;
|
|
144
|
+
};
|
|
145
|
+
nativeDialog = /*#__PURE__*/createRef();
|
|
139
146
|
render() {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
restProps = _objectWithoutProperties(_this$props, _excluded);
|
|
147
|
+
const {
|
|
148
|
+
show,
|
|
149
|
+
showCloseButton,
|
|
150
|
+
onOverlayClick,
|
|
151
|
+
onCloseAttempt,
|
|
152
|
+
onEscPress,
|
|
153
|
+
onCloseClick,
|
|
154
|
+
children,
|
|
155
|
+
className,
|
|
156
|
+
contentClassName,
|
|
157
|
+
trapFocus,
|
|
158
|
+
'data-test': dataTest,
|
|
159
|
+
closeButtonInside,
|
|
160
|
+
portalTarget,
|
|
161
|
+
label,
|
|
162
|
+
closeButtonTitle,
|
|
163
|
+
dense,
|
|
164
|
+
shortcutOptions,
|
|
165
|
+
native,
|
|
166
|
+
modal,
|
|
167
|
+
preventBodyScroll,
|
|
168
|
+
...restProps
|
|
169
|
+
} = this.props;
|
|
164
170
|
const classes = classNames(styles.container, className);
|
|
165
171
|
const shortcutsMap = this.getShortcutsMap();
|
|
166
172
|
const content = jsxs(Fragment, {
|
|
@@ -220,7 +226,7 @@ class Dialog extends PureComponent {
|
|
|
220
226
|
let targetElement = document.body;
|
|
221
227
|
if (portalTarget instanceof HTMLElement) {
|
|
222
228
|
targetElement = portalTarget;
|
|
223
|
-
} else if (contextTarget) {
|
|
229
|
+
} else if (contextTarget !== undefined) {
|
|
224
230
|
const container = getPopupContainer(contextTarget);
|
|
225
231
|
if (container) {
|
|
226
232
|
targetElement = container;
|
|
@@ -229,36 +235,20 @@ class Dialog extends PureComponent {
|
|
|
229
235
|
return /*#__PURE__*/createPortal(jsx(PopupTarget, {
|
|
230
236
|
id: this.uid,
|
|
231
237
|
className: styles.popupTarget,
|
|
232
|
-
children: target => jsxs(TabTrap,
|
|
238
|
+
children: target => jsxs(TabTrap, {
|
|
233
239
|
trapDisabled: !trapFocus,
|
|
234
240
|
"data-test": joinDataTestAttributes('ring-dialog-container', dataTest),
|
|
235
241
|
"data-rg-modal-dialog-container": '',
|
|
236
242
|
ref: this.dialogRef,
|
|
237
243
|
className: classes,
|
|
238
|
-
role: 'presentation'
|
|
239
|
-
|
|
244
|
+
role: 'presentation',
|
|
245
|
+
...restProps,
|
|
240
246
|
children: [content, target]
|
|
241
|
-
})
|
|
247
|
+
})
|
|
242
248
|
}), targetElement);
|
|
243
249
|
}
|
|
244
250
|
});
|
|
245
251
|
}
|
|
246
252
|
}
|
|
247
|
-
_defineProperty(Dialog, "defaultProps", {
|
|
248
|
-
label: 'Dialog',
|
|
249
|
-
onOverlayClick: noop,
|
|
250
|
-
onEscPress: noop,
|
|
251
|
-
onCloseClick: noop,
|
|
252
|
-
onCloseAttempt: noop,
|
|
253
|
-
showCloseButton: false,
|
|
254
|
-
closeButtonInside: false,
|
|
255
|
-
shortcutOptions: {
|
|
256
|
-
modal: false
|
|
257
|
-
},
|
|
258
|
-
trapFocus: false,
|
|
259
|
-
autoFocusFirst: true,
|
|
260
|
-
modal: true,
|
|
261
|
-
preventBodyScroll: true
|
|
262
|
-
});
|
|
263
253
|
|
|
264
254
|
export { Dialog as default };
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import 'react/jsx-runtime';
|
|
3
2
|
import 'react';
|
|
4
3
|
import 'classnames';
|
|
5
4
|
import '../button/button.js';
|
|
6
5
|
export { A as default } from '../_helpers/anchor.js';
|
|
7
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
6
|
import '@jetbrains/icons/chevron-down';
|
|
9
7
|
import '@jetbrains/icons/chevron-12px-down';
|
|
10
8
|
import 'util-deprecate';
|
|
11
9
|
import '../icon/icon.js';
|
|
12
10
|
import '../icon/icon.constants.js';
|
|
13
11
|
import '../_helpers/icon-svg.js';
|
|
14
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
15
|
-
import 'core-js/modules/es.string.replace.js';
|
|
16
12
|
import '../global/memoize.js';
|
|
17
13
|
import '../link/clickable-link.js';
|
|
18
14
|
import '../global/controls-height.js';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty, a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
2
|
import { Component, cloneElement } from 'react';
|
|
5
3
|
import classNames from 'classnames';
|
|
@@ -13,103 +11,102 @@ import 'util-deprecate';
|
|
|
13
11
|
import '../icon/icon.js';
|
|
14
12
|
import '../icon/icon.constants.js';
|
|
15
13
|
import '../_helpers/icon-svg.js';
|
|
16
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
17
|
-
import 'core-js/modules/es.string.replace.js';
|
|
18
14
|
import '../global/memoize.js';
|
|
19
15
|
import '../link/clickable-link.js';
|
|
20
16
|
import '../global/controls-height.js';
|
|
21
17
|
import '../global/configuration.js';
|
|
22
18
|
import '../_helpers/button.classes.js';
|
|
23
19
|
|
|
24
|
-
const _excluded = ["initShown", "onShow", "onHide", "hoverShowTimeOut", "hoverHideTimeOut", "children", "anchor", "className", "activeClassName", "hoverMode", "clickMode", "data-test", "disabled"];
|
|
25
20
|
/**
|
|
26
21
|
* @name Dropdown
|
|
27
22
|
*/
|
|
28
23
|
class Dropdown extends Component {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
24
|
+
static defaultProps = {
|
|
25
|
+
initShown: false,
|
|
26
|
+
clickMode: true,
|
|
27
|
+
hoverMode: false,
|
|
28
|
+
hoverShowTimeOut: 300,
|
|
29
|
+
hoverHideTimeOut: 600,
|
|
30
|
+
disabled: false,
|
|
31
|
+
onShow: () => {},
|
|
32
|
+
onHide: () => {},
|
|
33
|
+
onMouseEnter: () => {},
|
|
34
|
+
onMouseLeave: () => {}
|
|
35
|
+
};
|
|
36
|
+
state = {
|
|
37
|
+
show: this.props.initShown,
|
|
38
|
+
pinned: false
|
|
39
|
+
};
|
|
40
|
+
onClick = () => {
|
|
41
|
+
if (this.props.disabled) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const {
|
|
45
|
+
show,
|
|
46
|
+
pinned
|
|
47
|
+
} = this.state;
|
|
48
|
+
let nextPinned = pinned;
|
|
49
|
+
if (this.props.hoverMode) {
|
|
50
|
+
if (!pinned) {
|
|
51
|
+
nextPinned = true;
|
|
52
|
+
if (show) {
|
|
53
|
+
this.setState({
|
|
54
|
+
pinned: true
|
|
55
|
+
});
|
|
56
|
+
return;
|
|
55
57
|
}
|
|
56
|
-
}
|
|
57
|
-
this._toggle(!show, nextPinned);
|
|
58
|
-
});
|
|
59
|
-
_defineProperty(this, "onChildCloseAttempt", () => {
|
|
60
|
-
let nextPinned = this.state.pinned;
|
|
61
|
-
if (this.props.hoverMode) {
|
|
58
|
+
} else {
|
|
62
59
|
nextPinned = false;
|
|
63
60
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (this.
|
|
83
|
-
|
|
61
|
+
}
|
|
62
|
+
this._toggle(!show, nextPinned);
|
|
63
|
+
};
|
|
64
|
+
onChildCloseAttempt = () => {
|
|
65
|
+
let nextPinned = this.state.pinned;
|
|
66
|
+
if (this.props.hoverMode) {
|
|
67
|
+
nextPinned = false;
|
|
68
|
+
}
|
|
69
|
+
this._toggle(false, nextPinned);
|
|
70
|
+
};
|
|
71
|
+
hoverTimer;
|
|
72
|
+
onMouseEnter = event => {
|
|
73
|
+
if (this.props.disabled) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this._clearTimer();
|
|
77
|
+
this.props.onMouseEnter?.(event);
|
|
78
|
+
this.hoverTimer = window.setTimeout(() => {
|
|
79
|
+
if (!this.state.show) {
|
|
80
|
+
this._toggle(true);
|
|
84
81
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
}, this.props.hoverShowTimeOut);
|
|
83
|
+
};
|
|
84
|
+
onMouseLeave = event => {
|
|
85
|
+
if (this.props.disabled) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.props.onMouseLeave?.(event);
|
|
89
|
+
if (this.state.pinned) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
this._clearTimer();
|
|
93
|
+
this.hoverTimer = window.setTimeout(() => {
|
|
94
|
+
if (this.state.show) {
|
|
95
|
+
this._toggle(false);
|
|
88
96
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
_defineProperty(this, "handlePopupInteraction", () => {
|
|
97
|
-
this.setState(_ref => {
|
|
98
|
-
let {
|
|
99
|
-
pinned
|
|
100
|
-
} = _ref;
|
|
101
|
-
return pinned ? null : {
|
|
102
|
-
pinned: true
|
|
103
|
-
};
|
|
104
|
-
});
|
|
97
|
+
}, this.props.hoverHideTimeOut);
|
|
98
|
+
};
|
|
99
|
+
handlePopupInteraction = () => {
|
|
100
|
+
this.setState(({
|
|
101
|
+
pinned
|
|
102
|
+
}) => pinned ? null : {
|
|
103
|
+
pinned: true
|
|
105
104
|
});
|
|
106
|
-
}
|
|
107
|
-
toggle() {
|
|
108
|
-
let show = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !this.state.show;
|
|
105
|
+
};
|
|
106
|
+
toggle(show = !this.state.show) {
|
|
109
107
|
this._toggle(show);
|
|
110
108
|
}
|
|
111
|
-
_toggle(show) {
|
|
112
|
-
let pinned = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state.pinned;
|
|
109
|
+
_toggle(show, pinned = this.state.pinned) {
|
|
113
110
|
this.setState({
|
|
114
111
|
show,
|
|
115
112
|
pinned
|
|
@@ -126,23 +123,22 @@ class Dropdown extends Component {
|
|
|
126
123
|
show,
|
|
127
124
|
pinned
|
|
128
125
|
} = this.state;
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
restProps = _objectWithoutProperties(_this$props3, _excluded);
|
|
126
|
+
const {
|
|
127
|
+
initShown,
|
|
128
|
+
onShow,
|
|
129
|
+
onHide,
|
|
130
|
+
hoverShowTimeOut,
|
|
131
|
+
hoverHideTimeOut,
|
|
132
|
+
children,
|
|
133
|
+
anchor,
|
|
134
|
+
className,
|
|
135
|
+
activeClassName,
|
|
136
|
+
hoverMode,
|
|
137
|
+
clickMode,
|
|
138
|
+
'data-test': dataTest,
|
|
139
|
+
disabled,
|
|
140
|
+
...restProps
|
|
141
|
+
} = this.props;
|
|
146
142
|
const classes = classNames(styles.dropdown, className, {
|
|
147
143
|
[activeClassName !== null && activeClassName !== void 0 ? activeClassName : '']: activeClassName && show
|
|
148
144
|
});
|
|
@@ -177,9 +173,9 @@ class Dropdown extends Component {
|
|
|
177
173
|
onContextMenu: hoverMode ? this.handlePopupInteraction : undefined,
|
|
178
174
|
dontCloseOnAnchorClick: true
|
|
179
175
|
};
|
|
180
|
-
return jsxs("div",
|
|
181
|
-
"data-test": joinDataTestAttributes('ring-dropdown', dataTest)
|
|
182
|
-
|
|
176
|
+
return jsxs("div", {
|
|
177
|
+
"data-test": joinDataTestAttributes('ring-dropdown', dataTest),
|
|
178
|
+
...restProps,
|
|
183
179
|
onClick: clickMode ? this.onClick : undefined,
|
|
184
180
|
// anchorElement should be a `button` or an `a`
|
|
185
181
|
role: 'presentation',
|
|
@@ -187,20 +183,8 @@ class Dropdown extends Component {
|
|
|
187
183
|
onMouseLeave: hoverMode ? this.onMouseLeave : undefined,
|
|
188
184
|
className: classes,
|
|
189
185
|
children: [anchorElement, typeof children === 'function' ? children(childProps) : /*#__PURE__*/cloneElement(children, childProps)]
|
|
190
|
-
})
|
|
186
|
+
});
|
|
191
187
|
}
|
|
192
188
|
}
|
|
193
|
-
_defineProperty(Dropdown, "defaultProps", {
|
|
194
|
-
initShown: false,
|
|
195
|
-
clickMode: true,
|
|
196
|
-
hoverMode: false,
|
|
197
|
-
hoverShowTimeOut: 300,
|
|
198
|
-
hoverHideTimeOut: 600,
|
|
199
|
-
disabled: false,
|
|
200
|
-
onShow: () => {},
|
|
201
|
-
onHide: () => {},
|
|
202
|
-
onMouseEnter: () => {},
|
|
203
|
-
onMouseLeave: () => {}
|
|
204
|
-
});
|
|
205
189
|
|
|
206
190
|
export { Anchor, Dropdown as default };
|