@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
package/components/text/text.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { _ as _defineProperty, a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { Component } from 'react';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
|
|
6
5
|
var styles = {"text":"ring-text-text","sizeS":"ring-text-sizeS","sizeM":"ring-text-sizeM","sizeL":"ring-text-sizeL","info":"ring-text-info","bold":"ring-text-bold"};
|
|
7
6
|
|
|
8
|
-
const _excluded = ["children", "className", "info", "size", "bold"];
|
|
9
7
|
const TextSizes = {
|
|
10
8
|
S: 's',
|
|
11
9
|
M: 'm',
|
|
@@ -15,16 +13,19 @@ const TextSizes = {
|
|
|
15
13
|
* @name Text
|
|
16
14
|
*/
|
|
17
15
|
class Text extends Component {
|
|
16
|
+
static defaultProps = {
|
|
17
|
+
size: TextSizes.M
|
|
18
|
+
};
|
|
19
|
+
static Size = TextSizes;
|
|
18
20
|
render() {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
restProps = _objectWithoutProperties(_this$props, _excluded);
|
|
21
|
+
const {
|
|
22
|
+
children,
|
|
23
|
+
className,
|
|
24
|
+
info,
|
|
25
|
+
size,
|
|
26
|
+
bold,
|
|
27
|
+
...restProps
|
|
28
|
+
} = this.props;
|
|
28
29
|
const classes = classNames(styles.text, className, {
|
|
29
30
|
[styles.info]: info,
|
|
30
31
|
[styles.bold]: bold,
|
|
@@ -32,16 +33,12 @@ class Text extends Component {
|
|
|
32
33
|
[styles.sizeM]: size === Text.Size.M,
|
|
33
34
|
[styles.sizeL]: size === Text.Size.L
|
|
34
35
|
});
|
|
35
|
-
return jsx("span",
|
|
36
|
-
className: classes
|
|
37
|
-
|
|
36
|
+
return jsx("span", {
|
|
37
|
+
className: classes,
|
|
38
|
+
...restProps,
|
|
38
39
|
children: children
|
|
39
|
-
})
|
|
40
|
+
});
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
_defineProperty(Text, "defaultProps", {
|
|
43
|
-
size: TextSizes.M
|
|
44
|
-
});
|
|
45
|
-
_defineProperty(Text, "Size", TextSizes);
|
|
46
43
|
|
|
47
44
|
export { Text as default };
|
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import { _ as _defineProperty, a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { PureComponent } from 'react';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
import joinDataTestAttributes from '../global/data-tests.js';
|
|
6
5
|
import ControlHelp from '../control-help/control-help.js';
|
|
7
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
6
|
|
|
9
7
|
var styles = {"toggle":"ring-toggle-toggle","switch":"ring-toggle-switch","disabled":"ring-toggle-disabled","label":"ring-toggle-label","help":"ring-toggle-help","leftLabel":"ring-toggle-leftLabel","switchWrapper":"ring-toggle-switchWrapper","input":"ring-toggle-input","size16":"ring-toggle-size16","size14":"ring-toggle-size14","size20":"ring-toggle-size20"};
|
|
10
8
|
|
|
11
|
-
const _excluded = ["className", "children", "disabled", "title", "leftLabel", "size", "data-test", "help", "onTransitionEnd"];
|
|
12
9
|
const Size = {
|
|
13
10
|
Size14: styles.size14,
|
|
14
11
|
Size16: styles.size16,
|
|
15
12
|
Size20: styles.size20
|
|
16
13
|
};
|
|
17
14
|
class Toggle extends PureComponent {
|
|
15
|
+
static defaultProps = {
|
|
16
|
+
size: Size.Size16
|
|
17
|
+
};
|
|
18
18
|
render() {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
restProps = _objectWithoutProperties(_this$props, _excluded);
|
|
19
|
+
const {
|
|
20
|
+
className,
|
|
21
|
+
children,
|
|
22
|
+
disabled,
|
|
23
|
+
title,
|
|
24
|
+
leftLabel,
|
|
25
|
+
size = Size.Size16,
|
|
26
|
+
'data-test': dataTest,
|
|
27
|
+
help,
|
|
28
|
+
onTransitionEnd,
|
|
29
|
+
...restProps
|
|
30
|
+
} = this.props;
|
|
32
31
|
const classes = classNames(className, size, styles.toggle, disabled && styles.disabled);
|
|
33
32
|
return jsxs("label", {
|
|
34
33
|
className: classes,
|
|
@@ -42,13 +41,13 @@ class Toggle extends PureComponent {
|
|
|
42
41
|
})]
|
|
43
42
|
}), jsxs("span", {
|
|
44
43
|
className: styles.switchWrapper,
|
|
45
|
-
children: [jsx("input",
|
|
46
|
-
"data-test": 'ring-toggle-input'
|
|
47
|
-
|
|
44
|
+
children: [jsx("input", {
|
|
45
|
+
"data-test": 'ring-toggle-input',
|
|
46
|
+
...restProps,
|
|
48
47
|
type: 'checkbox',
|
|
49
48
|
disabled: disabled,
|
|
50
49
|
className: styles.input
|
|
51
|
-
})
|
|
50
|
+
}), jsx("span", {
|
|
52
51
|
className: styles.switch,
|
|
53
52
|
onTransitionEnd: onTransitionEnd
|
|
54
53
|
})]
|
|
@@ -62,8 +61,5 @@ class Toggle extends PureComponent {
|
|
|
62
61
|
});
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
|
-
_defineProperty(Toggle, "defaultProps", {
|
|
66
|
-
size: Size.Size16
|
|
67
|
-
});
|
|
68
64
|
|
|
69
65
|
export { Size, Toggle as default };
|
|
@@ -1,15 +1,11 @@
|
|
|
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
|
-
import {
|
|
2
|
+
import { Component, createContext } from 'react';
|
|
5
3
|
import classNames from 'classnames';
|
|
6
4
|
import Popup from '../popup/popup.js';
|
|
7
5
|
import { Listeners } from '../global/dom.js';
|
|
8
6
|
import joinDataTestAttributes from '../global/data-tests.js';
|
|
9
7
|
import scheduleRAF from '../global/schedule-raf.js';
|
|
10
8
|
import { T as Theme, a as ThemeProvider } from '../_helpers/theme.js';
|
|
11
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
12
|
-
import 'core-js/modules/es.string.replace.js';
|
|
13
9
|
import 'react-dom';
|
|
14
10
|
import '../global/get-uid.js';
|
|
15
11
|
import '../shortcuts/shortcuts.js';
|
|
@@ -20,102 +16,28 @@ import 'sniffr';
|
|
|
20
16
|
import '../tab-trap/tab-trap.js';
|
|
21
17
|
import '../global/configuration.js';
|
|
22
18
|
import '../popup/position.js';
|
|
23
|
-
import 'core-js/modules/es.array.sort.js';
|
|
24
19
|
import '../popup/popup.consts.js';
|
|
25
20
|
import '../popup/popup.target.js';
|
|
26
21
|
import '../popup/position-css.js';
|
|
27
22
|
|
|
28
23
|
var styles = {"tooltip":"ring-tooltip-tooltip","inheritedTheme":"ring-tooltip-inheritedTheme","long":"ring-tooltip-long"};
|
|
29
24
|
|
|
30
|
-
const _excluded = ["children", "data-test", "title", "delay", "theme", "selfOverflowOnly", "popupProps", "long"];
|
|
31
25
|
const scheduleScroll = scheduleRAF();
|
|
32
26
|
const TooltipContext = /*#__PURE__*/createContext(undefined);
|
|
33
27
|
/**
|
|
34
28
|
* @name Tooltip
|
|
35
29
|
*/
|
|
36
30
|
class Tooltip extends Component {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.containerNode = el;
|
|
48
|
-
});
|
|
49
|
-
_defineProperty(this, "tryToShowPopup", () => {
|
|
50
|
-
const {
|
|
51
|
-
delay,
|
|
52
|
-
title
|
|
53
|
-
} = this.props;
|
|
54
|
-
if (!title) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (delay) {
|
|
58
|
-
this.timeout = window.setTimeout(this.showPopup, delay);
|
|
59
|
-
} else {
|
|
60
|
-
this.showPopup();
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
_defineProperty(this, "showPopup", () => {
|
|
64
|
-
var _this$context;
|
|
65
|
-
if (this.props.selfOverflowOnly) {
|
|
66
|
-
const {
|
|
67
|
-
containerNode
|
|
68
|
-
} = this;
|
|
69
|
-
// rare cases when containerNode is null are possible;
|
|
70
|
-
// probably the collision is due to the asynchronous nature of the code,
|
|
71
|
-
// i.e. this code runs after the component is unmounted,
|
|
72
|
-
// although at first glance it looks unlikely.
|
|
73
|
-
if (!containerNode) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
// inline element?
|
|
77
|
-
if (containerNode.clientWidth === 0 && containerNode.clientHeight === 0) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
if (containerNode.scrollWidth <= containerNode.clientWidth && containerNode.scrollHeight <= containerNode.clientHeight) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
(_this$context = this.context) === null || _this$context === void 0 || _this$context.onNestedTooltipShow();
|
|
85
|
-
this.setState({
|
|
86
|
-
showPopup: true
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
_defineProperty(this, "hidePopup", () => {
|
|
90
|
-
var _this$context2;
|
|
91
|
-
clearTimeout(this.timeout);
|
|
92
|
-
(_this$context2 = this.context) === null || _this$context2 === void 0 || _this$context2.onNestedTooltipHide();
|
|
93
|
-
this.setState({
|
|
94
|
-
showPopup: false
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
_defineProperty(this, "hideIfMovedOutsidePopup", ev => {
|
|
98
|
-
var _this$popup;
|
|
99
|
-
if (!('relatedTarget' in ev) || (_this$popup = this.popup) !== null && _this$popup !== void 0 && (_this$popup = _this$popup.container) !== null && _this$popup !== void 0 && _this$popup.contains(ev.relatedTarget)) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
this.hidePopup();
|
|
103
|
-
});
|
|
104
|
-
_defineProperty(this, "popup", void 0);
|
|
105
|
-
_defineProperty(this, "popupRef", el => {
|
|
106
|
-
this.popup = el;
|
|
107
|
-
});
|
|
108
|
-
_defineProperty(this, "onNestedTooltipShow", () => {
|
|
109
|
-
this.setState({
|
|
110
|
-
showNestedPopup: true
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
_defineProperty(this, "onNestedTooltipHide", () => {
|
|
114
|
-
this.setState({
|
|
115
|
-
showNestedPopup: false
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
}
|
|
31
|
+
static defaultProps = {
|
|
32
|
+
title: '',
|
|
33
|
+
selfOverflowOnly: false,
|
|
34
|
+
theme: Theme.DARK,
|
|
35
|
+
popupProps: {}
|
|
36
|
+
};
|
|
37
|
+
state = {
|
|
38
|
+
showPopup: false,
|
|
39
|
+
showNestedPopup: false
|
|
40
|
+
};
|
|
119
41
|
componentDidMount() {
|
|
120
42
|
if (this.props.title) {
|
|
121
43
|
this.addListeners();
|
|
@@ -133,20 +55,72 @@ class Tooltip extends Component {
|
|
|
133
55
|
clearTimeout(this.timeout);
|
|
134
56
|
this.listeners.removeAll();
|
|
135
57
|
}
|
|
58
|
+
static PopupProps = Popup.PopupProps;
|
|
59
|
+
static contextType = TooltipContext;
|
|
60
|
+
timeout;
|
|
61
|
+
listeners = new Listeners();
|
|
62
|
+
containerNode;
|
|
63
|
+
containerRef = el => {
|
|
64
|
+
this.containerNode = el;
|
|
65
|
+
};
|
|
66
|
+
tryToShowPopup = () => {
|
|
67
|
+
const {
|
|
68
|
+
delay,
|
|
69
|
+
title
|
|
70
|
+
} = this.props;
|
|
71
|
+
if (!title) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (delay) {
|
|
75
|
+
this.timeout = window.setTimeout(this.showPopup, delay);
|
|
76
|
+
} else {
|
|
77
|
+
this.showPopup();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
showPopup = () => {
|
|
81
|
+
if (this.props.selfOverflowOnly) {
|
|
82
|
+
const {
|
|
83
|
+
containerNode
|
|
84
|
+
} = this;
|
|
85
|
+
// rare cases when containerNode is null are possible;
|
|
86
|
+
// probably the collision is due to the asynchronous nature of the code,
|
|
87
|
+
// i.e. this code runs after the component is unmounted,
|
|
88
|
+
// although at first glance it looks unlikely.
|
|
89
|
+
if (!containerNode) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// inline element?
|
|
93
|
+
if (containerNode.clientWidth === 0 && containerNode.clientHeight === 0) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (containerNode.scrollWidth <= containerNode.clientWidth && containerNode.scrollHeight <= containerNode.clientHeight) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
this.context?.onNestedTooltipShow();
|
|
101
|
+
this.setState({
|
|
102
|
+
showPopup: true
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
hidePopup = () => {
|
|
106
|
+
clearTimeout(this.timeout);
|
|
107
|
+
this.context?.onNestedTooltipHide();
|
|
108
|
+
this.setState({
|
|
109
|
+
showPopup: false
|
|
110
|
+
});
|
|
111
|
+
};
|
|
136
112
|
addListeners() {
|
|
137
113
|
if (this.containerNode) {
|
|
138
114
|
this.listeners.add(this.containerNode, 'mouseenter', this.tryToShowPopup);
|
|
139
115
|
this.listeners.add(this.containerNode, 'mouseleave', ev => {
|
|
140
|
-
|
|
141
|
-
if (ev.relatedTarget && (_this$popup2 = this.popup) !== null && _this$popup2 !== void 0 && (_this$popup2 = _this$popup2.container) !== null && _this$popup2 !== void 0 && _this$popup2.contains(ev.relatedTarget)) {
|
|
116
|
+
if (ev.relatedTarget && this.popup?.container?.contains(ev.relatedTarget)) {
|
|
142
117
|
return;
|
|
143
118
|
}
|
|
144
119
|
this.hidePopup();
|
|
145
120
|
});
|
|
146
121
|
this.listeners.add(this.containerNode, 'focusin', this.tryToShowPopup);
|
|
147
122
|
this.listeners.add(this.containerNode, 'focusout', ev => {
|
|
148
|
-
|
|
149
|
-
if (ev.relatedTarget && (_this$popup3 = this.popup) !== null && _this$popup3 !== void 0 && (_this$popup3 = _this$popup3.container) !== null && _this$popup3 !== void 0 && _this$popup3.contains(ev.relatedTarget)) {
|
|
123
|
+
if (ev.relatedTarget && this.popup?.container?.contains(ev.relatedTarget)) {
|
|
150
124
|
return;
|
|
151
125
|
}
|
|
152
126
|
this.hidePopup();
|
|
@@ -156,19 +130,38 @@ class Tooltip extends Component {
|
|
|
156
130
|
passive: true
|
|
157
131
|
});
|
|
158
132
|
}
|
|
133
|
+
hideIfMovedOutsidePopup = ev => {
|
|
134
|
+
if (!('relatedTarget' in ev) || this.popup?.container?.contains(ev.relatedTarget)) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
this.hidePopup();
|
|
138
|
+
};
|
|
139
|
+
popup;
|
|
140
|
+
popupRef = el => {
|
|
141
|
+
this.popup = el;
|
|
142
|
+
};
|
|
143
|
+
onNestedTooltipShow = () => {
|
|
144
|
+
this.setState({
|
|
145
|
+
showNestedPopup: true
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
onNestedTooltipHide = () => {
|
|
149
|
+
this.setState({
|
|
150
|
+
showNestedPopup: false
|
|
151
|
+
});
|
|
152
|
+
};
|
|
159
153
|
render() {
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
restProps = _objectWithoutProperties(_this$props, _excluded);
|
|
154
|
+
const {
|
|
155
|
+
children,
|
|
156
|
+
'data-test': dataTest,
|
|
157
|
+
title,
|
|
158
|
+
delay,
|
|
159
|
+
theme,
|
|
160
|
+
selfOverflowOnly,
|
|
161
|
+
popupProps,
|
|
162
|
+
long,
|
|
163
|
+
...restProps
|
|
164
|
+
} = this.props;
|
|
172
165
|
const ariaProps = typeof title === 'string' && !!title ? {
|
|
173
166
|
'aria-label': title,
|
|
174
167
|
role: 'tooltip'
|
|
@@ -177,7 +170,7 @@ class Tooltip extends Component {
|
|
|
177
170
|
onNestedTooltipShow,
|
|
178
171
|
onNestedTooltipHide
|
|
179
172
|
} = this;
|
|
180
|
-
const popup = jsx(Popup,
|
|
173
|
+
const popup = jsx(Popup, {
|
|
181
174
|
trapFocus: false,
|
|
182
175
|
anchorElement: this.containerNode,
|
|
183
176
|
hidden: !this.state.showPopup || this.state.showNestedPopup,
|
|
@@ -187,40 +180,36 @@ class Tooltip extends Component {
|
|
|
187
180
|
onMouseOut: this.hideIfMovedOutsidePopup,
|
|
188
181
|
top: 4,
|
|
189
182
|
dontCloseOnAnchorClick: true,
|
|
190
|
-
ref: this.popupRef
|
|
191
|
-
|
|
183
|
+
ref: this.popupRef,
|
|
184
|
+
...popupProps,
|
|
192
185
|
className: classNames(styles.tooltip, {
|
|
193
186
|
[styles.long]: long,
|
|
194
187
|
[styles.inheritedTheme]: theme === 'inherit'
|
|
195
|
-
}, popupProps
|
|
188
|
+
}, popupProps?.className),
|
|
196
189
|
children: title
|
|
197
|
-
})
|
|
190
|
+
});
|
|
198
191
|
return jsx(TooltipContext.Provider, {
|
|
199
192
|
value: {
|
|
200
193
|
onNestedTooltipShow,
|
|
201
194
|
onNestedTooltipHide
|
|
202
195
|
},
|
|
203
|
-
children: jsxs("span",
|
|
196
|
+
children: jsxs("span", {
|
|
197
|
+
...ariaProps,
|
|
198
|
+
...restProps,
|
|
204
199
|
ref: this.containerRef,
|
|
205
200
|
"data-test": joinDataTestAttributes('ring-tooltip', dataTest),
|
|
206
201
|
"data-test-title": typeof title === 'string' ? title : undefined,
|
|
207
202
|
children: [children, theme === 'inherit' ? popup : jsx(ThemeProvider, {
|
|
208
203
|
theme: theme,
|
|
209
204
|
passToPopups: true,
|
|
210
|
-
WrapperComponent: props => jsx("span",
|
|
205
|
+
WrapperComponent: props => jsx("span", {
|
|
206
|
+
...props
|
|
207
|
+
}),
|
|
211
208
|
children: popup
|
|
212
209
|
})]
|
|
213
|
-
})
|
|
210
|
+
})
|
|
214
211
|
});
|
|
215
212
|
}
|
|
216
213
|
}
|
|
217
|
-
_defineProperty(Tooltip, "defaultProps", {
|
|
218
|
-
title: '',
|
|
219
|
-
selfOverflowOnly: false,
|
|
220
|
-
theme: Theme.DARK,
|
|
221
|
-
popupProps: {}
|
|
222
|
-
});
|
|
223
|
-
_defineProperty(Tooltip, "PopupProps", Popup.PopupProps);
|
|
224
|
-
_defineProperty(Tooltip, "contextType", TooltipContext);
|
|
225
214
|
|
|
226
215
|
export { Tooltip as default };
|
|
@@ -1,42 +1,34 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { forwardRef, useRef, useState, useImperativeHandle, useCallback } from 'react';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
import attachmentIcon from '@jetbrains/icons/attachment';
|
|
6
5
|
import Icon from '../icon/icon.js';
|
|
7
|
-
import '../_helpers/_rollupPluginBabelHelpers.js';
|
|
8
6
|
import 'util-deprecate';
|
|
9
7
|
import '../icon/icon.constants.js';
|
|
10
8
|
import '../_helpers/icon-svg.js';
|
|
11
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
12
|
-
import 'core-js/modules/es.string.replace.js';
|
|
13
9
|
import '../global/memoize.js';
|
|
14
10
|
|
|
15
11
|
var styles = {"upload":"ring-upload-upload","success":"ring-upload-success","error":"ring-upload-error","dragOver":"ring-upload-dragOver","disabled":"ring-upload-disabled","invisibleFileInput":"ring-upload-invisibleFileInput","attachmentIcon":"ring-upload-attachmentIcon"};
|
|
16
12
|
|
|
17
|
-
const Upload = /*#__PURE__*/forwardRef(function Upload(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} = _ref;
|
|
13
|
+
const Upload = /*#__PURE__*/forwardRef(function Upload({
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
onFilesSelected,
|
|
17
|
+
onFilesRejected,
|
|
18
|
+
validate = () => true,
|
|
19
|
+
variant = 'empty',
|
|
20
|
+
multiple,
|
|
21
|
+
renderIcon = () => jsx(Icon, {
|
|
22
|
+
className: styles.attachmentIcon,
|
|
23
|
+
glyph: attachmentIcon
|
|
24
|
+
}),
|
|
25
|
+
accept,
|
|
26
|
+
disabled
|
|
27
|
+
}, ref) {
|
|
33
28
|
const fileInputRef = useRef(null);
|
|
34
29
|
const [dragOver, setDragOver] = useState(false);
|
|
35
30
|
useImperativeHandle(ref, () => ({
|
|
36
|
-
openFilePicker: () =>
|
|
37
|
-
var _fileInputRef$current;
|
|
38
|
-
return (_fileInputRef$current = fileInputRef.current) === null || _fileInputRef$current === void 0 ? void 0 : _fileInputRef$current.click();
|
|
39
|
-
}
|
|
31
|
+
openFilePicker: () => fileInputRef.current?.click()
|
|
40
32
|
}), []);
|
|
41
33
|
const handleSelectedFiles = useCallback(files => {
|
|
42
34
|
if (!files.length) {
|
|
@@ -44,7 +36,7 @@ const Upload = /*#__PURE__*/forwardRef(function Upload(_ref, ref) {
|
|
|
44
36
|
}
|
|
45
37
|
const rejected = files.filter(file => !validate(file));
|
|
46
38
|
if (rejected.length > 0) {
|
|
47
|
-
onFilesRejected
|
|
39
|
+
onFilesRejected?.(files);
|
|
48
40
|
return;
|
|
49
41
|
}
|
|
50
42
|
onFilesSelected(files);
|
|
@@ -53,9 +45,8 @@ const Upload = /*#__PURE__*/forwardRef(function Upload(_ref, ref) {
|
|
|
53
45
|
const onDragOver = useCallback(e => e.preventDefault(), []);
|
|
54
46
|
const onDragLeave = useCallback(() => setDragOver(false), []);
|
|
55
47
|
const onInputChange = useCallback(() => {
|
|
56
|
-
var _fileInputRef$current2;
|
|
57
48
|
setDragOver(false);
|
|
58
|
-
if (
|
|
49
|
+
if (fileInputRef.current?.files) {
|
|
59
50
|
handleSelectedFiles(Array.from(fileInputRef.current.files));
|
|
60
51
|
}
|
|
61
52
|
}, [handleSelectedFiles]);
|