@jetbrains/ring-ui 4.1.0-beta.3 → 4.1.1
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/CHANGELOG.md +13 -0
- package/README.md +17 -15
- package/babel.config.js +3 -2
- package/components/alert/alert.js +9 -3
- package/components/alert/alert.test.js +21 -48
- package/components/alert/container.css +1 -1
- package/components/alert/container.test.js +3 -13
- package/components/alert-service/alert-service.examples.css +18 -0
- package/components/alert-service/alert-service.examples.js +21 -0
- package/components/alert-service/alert-service.js +10 -3
- package/components/analytics/analytics__fus-plugin.js +3 -3
- package/components/analytics/analytics__ga-plugin.js +2 -2
- package/components/auth/auth.test.js +14 -7
- package/components/auth/auth__core.js +64 -33
- package/components/auth-dialog/auth-dialog.css +2 -3
- package/components/auth-dialog/auth-dialog.js +4 -1
- package/components/auth-dialog/auth-dialog.test.js +3 -19
- package/components/avatar/avatar.css +4 -1
- package/components/avatar/avatar.examples.js +3 -2
- package/components/avatar/avatar.js +34 -6
- package/components/avatar/avatar.test.js +20 -17
- package/components/avatar/fallback-avatar.js +136 -0
- package/components/avatar-editor-ng/avatar-editor-ng.css +2 -2
- package/components/avatar-editor-ng/avatar-editor-ng.js +2 -1
- package/components/avatar-editor-ng/{avatar-editor-ng.html → avatar-editor-ng__template.js} +2 -2
- package/components/badge/badge.test.js +13 -20
- package/components/button/button.css +2 -2
- package/components/button/button.js +4 -1
- package/components/button/button.test.js +32 -33
- package/components/button-group/button-group.js +1 -1
- package/components/button-group/caption.js +1 -1
- package/components/button-ng/button-ng.js +1 -1
- package/components/button-set-ng/button-set-ng.js +3 -1
- package/components/checkbox/checkbox.css +1 -1
- package/components/code/code.js +2 -5
- package/components/confirm/confirm.js +1 -0
- package/components/confirm-service/confirm-service.js +5 -5
- package/components/content-layout/content-layout.css +1 -1
- package/components/data-list/data-list.css +1 -1
- package/components/date-picker/date-input.js +5 -4
- package/components/date-picker/date-picker.css +34 -22
- package/components/date-picker/date-picker.js +16 -14
- package/components/date-picker/date-popup.js +22 -7
- package/components/date-picker/month-names.js +8 -5
- package/components/date-picker/month.js +6 -2
- package/components/date-picker/weekdays.js +10 -2
- package/components/dialog/dialog.examples.js +3 -1
- package/components/dialog/dialog.js +10 -5
- package/components/dialog/dialog.test.js +1 -1
- package/components/dialog/dialog__body-scroll-preventer.js +51 -31
- package/components/dialog-ng/dialog-ng.js +10 -10
- package/components/dialog-ng/{dialog-ng.html → dialog-ng__template.js} +2 -2
- package/components/dropdown/dropdown.examples.js +36 -1
- package/components/dropdown/dropdown.test.js +2 -2
- package/components/dropdown-menu/dropdown-menu.examples.js +47 -0
- package/components/dropdown-menu/dropdown-menu.js +117 -0
- package/components/dropdown-menu/dropdown-menu.test.js +76 -0
- package/components/error-bubble/error-bubble-legacy.css +1 -1
- package/components/error-bubble/error-bubble.css +1 -1
- package/components/error-bubble/error-bubble.examples.js +1 -1
- package/components/error-page/error-page.css +2 -2
- package/components/footer-ng/footer-ng.js +13 -3
- package/components/form/form.css +2 -2
- package/components/form-ng/form-ng.js +3 -1
- package/components/global/global.css +1 -1
- package/components/global/theme.js +1 -1
- package/components/global/variables.css +8 -1
- package/components/grid/grid.css +10 -9
- package/components/header/header.css +1 -1
- package/components/header/header.examples.js +7 -8
- package/components/header/profile.js +10 -11
- package/components/http/http.js +1 -1
- package/components/icon/icon.css +5 -4
- package/components/input/input-legacy.css +7 -7
- package/components/island/header.js +2 -2
- package/components/island/island.css +8 -3
- package/components/island-legacy/island-legacy.css +3 -1
- package/components/list/list.js +6 -1
- package/components/list/list__custom.js +9 -3
- package/components/list/list__item.js +8 -2
- package/components/list/list__link.js +2 -1
- package/components/loader-inline/loader-inline.css +1 -1
- package/components/loader-screen/loader-screen.css +1 -1
- package/components/message/message.css +1 -1
- package/components/message/message.examples.js +8 -7
- package/components/pager/pager.js +5 -3
- package/components/permissions/permissions.js +1 -1
- package/components/popup/popup.js +1 -1
- package/components/popup/popup.test.js +15 -13
- package/components/progress-bar/progress-bar.css +1 -1
- package/components/progress-bar/progress-bar.examples.js +3 -3
- package/components/progress-bar/progress-bar.js +5 -2
- package/components/progress-bar/progress-bar.test.js +12 -13
- package/components/progress-bar-ng/progress-bar-ng.examples.js +3 -3
- package/components/query-assist/query-assist.css +13 -3
- package/components/query-assist/query-assist.examples.js +3 -4
- package/components/query-assist/query-assist.js +56 -12
- package/components/query-assist/query-assist.test.js +37 -5
- package/components/save-field-ng/save-field-ng.css +0 -3
- package/components/save-field-ng/save-field-ng.js +3 -1
- package/components/save-field-ng/{save-field-ng.html → save-field-ng__template.js} +2 -2
- package/components/select/select.css +12 -7
- package/components/select/select.examples.js +13 -0
- package/components/select/select.js +30 -43
- package/components/select/select.test.js +4 -5
- package/components/select/select__popup.js +1 -0
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.css +1 -1
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.js +1 -1
- package/components/shortcuts-hint-ng/{shortcuts-hint-ng.html → shortcuts-hint-ng__template.js} +2 -2
- package/components/sidebar/sidebar.css +1 -0
- package/components/sidebar-ng/sidebar-ng.js +6 -2
- package/components/sidebar-ng/{sidebar-ng__button.html → sidebar-ng__button-template.js} +2 -2
- package/components/sidebar-ng/{sidebar-ng.html → sidebar-ng__template.js} +2 -2
- package/components/table/header.js +9 -1
- package/components/table/row.js +2 -1
- package/components/table/table.css +2 -1
- package/components/table-legacy/table-legacy.css +2 -2
- package/components/table-legacy/table-legacy__toolbar.css +2 -2
- package/components/table-legacy-ng/table-legacy-ng.js +38 -5
- package/components/table-legacy-ng/table-legacy-ng__pager.js +7 -1
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/collapsible-tabs.js +5 -9
- package/components/tabs/tab-link.js +4 -2
- package/components/tabs/tabs.css +32 -5
- package/components/tabs-ng/tabs-ng.js +4 -2
- package/components/tabs-ng/{tabs-ng.html → tabs-ng__template.js} +6 -2
- package/components/tag/tag.css +5 -2
- package/components/tag/tag.examples.js +3 -0
- package/components/tag/tag.js +19 -16
- package/components/tags-input/tag-input.examples.js +1 -1
- package/components/tags-input/tags-input.js +5 -2
- package/components/template-ng/template-ng.js +1 -1
- package/components/tooltip/tooltip.js +7 -2
- package/components/user-agreement/user-agreement.css +1 -5
- package/components/user-agreement/user-agreement.examples.js +7 -6
- package/components/user-agreement/user-agreement.js +11 -3
- package/package.json +85 -83
- package/webpack.config.js +14 -10
- package/components/button-set-ng/button-set-ng.html +0 -1
- package/components/footer-ng/footer-ng.html +0 -13
- package/components/form-ng/form-ng__error-bubble.html +0 -3
- package/components/table-legacy-ng/table-legacy-ng.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__column.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__header.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__pager.html +0 -7
- package/components/table-legacy-ng/table-legacy-ng__row.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__title.html +0 -9
- package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -123
- package/dist/_helpers/background-flow.js +0 -232
- package/dist/_helpers/badge.js +0 -3
- package/dist/_helpers/button.js +0 -145
- package/dist/_helpers/clickableLink.js +0 -65
- package/dist/_helpers/data-tests.js +0 -15
- package/dist/_helpers/disable-hover-hoc.js +0 -407
- package/dist/_helpers/dom.js +0 -101
- package/dist/_helpers/get-uid.js +0 -15
- package/dist/_helpers/linear-function.js +0 -17
- package/dist/_helpers/list.js +0 -1327
- package/dist/_helpers/logo.js +0 -36
- package/dist/_helpers/memoize.js +0 -17
- package/dist/_helpers/popup.js +0 -691
- package/dist/_helpers/popup.target.js +0 -27
- package/dist/_helpers/rerender-hoc.js +0 -49
- package/dist/_helpers/schedule-raf.js +0 -31
- package/dist/_helpers/sniffer.js +0 -6
- package/dist/_helpers/theme.js +0 -40
- package/dist/_helpers/url.js +0 -125
- package/dist/alert-service.js +0 -149
- package/dist/alert.js +0 -284
- package/dist/analytics.js +0 -116
- package/dist/auth-dialog-service.js +0 -56
- package/dist/auth-dialog.js +0 -122
- package/dist/auth.js +0 -1744
- package/dist/avatar.js +0 -152
- package/dist/badge.js +0 -52
- package/dist/button-group.js +0 -48
- package/dist/button-set.js +0 -27
- package/dist/button-toolbar.js +0 -30
- package/dist/button.js +0 -12
- package/dist/caret.js +0 -262
- package/dist/checkbox.js +0 -108
- package/dist/confirm-service.js +0 -102
- package/dist/confirm.js +0 -113
- package/dist/content-layout.js +0 -184
- package/dist/contenteditable.js +0 -81
- package/dist/data-list.js +0 -466
- package/dist/date-picker.js +0 -1398
- package/dist/dialog.js +0 -223
- package/dist/dropdown.js +0 -250
- package/dist/error-bubble.js +0 -56
- package/dist/error-message.js +0 -53
- package/dist/footer.js +0 -124
- package/dist/grid.js +0 -148
- package/dist/group.js +0 -34
- package/dist/header.js +0 -658
- package/dist/heading.js +0 -76
- package/dist/http.js +0 -207
- package/dist/hub-source.js +0 -130
- package/dist/icon.js +0 -211
- package/dist/input.js +0 -228
- package/dist/island.js +0 -314
- package/dist/link.js +0 -117
- package/dist/list.js +0 -29
- package/dist/loader-inline.js +0 -165
- package/dist/loader-screen.js +0 -45
- package/dist/loader.js +0 -338
- package/dist/login-dialog.js +0 -173
- package/dist/logo.js +0 -8
- package/dist/message.js +0 -226
- package/dist/old-browsers-message.js +0 -129
- package/dist/pager.js +0 -325
- package/dist/panel.js +0 -34
- package/dist/permissions.js +0 -466
- package/dist/popup-menu.js +0 -93
- package/dist/popup.js +0 -16
- package/dist/progress-bar.js +0 -111
- package/dist/proxy-attrs.js +0 -19
- package/dist/query-assist.js +0 -1081
- package/dist/radio.js +0 -112
- package/dist/select.js +0 -1920
- package/dist/selection.js +0 -213
- package/dist/shortcuts.js +0 -307
- package/dist/storage.js +0 -373
- package/dist/style.css +0 -1
- package/dist/tab-trap.js +0 -174
- package/dist/table.js +0 -903
- package/dist/tabs.js +0 -721
- package/dist/tag.js +0 -187
- package/dist/tags-input.js +0 -440
- package/dist/tags-list.js +0 -91
- package/dist/text.js +0 -38
- package/dist/toggle.js +0 -80
- package/dist/tooltip.js +0 -202
- package/dist/user-card.js +0 -218
package/dist/login-dialog.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { Component } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import Dialog from './dialog.js';
|
|
5
|
-
import { Content as ContentWrapper } from './island.js';
|
|
6
|
-
import LoaderScreen from './loader-screen.js';
|
|
7
|
-
import { H as HUB_AUTH_PAGE_OPENED } from './_helpers/background-flow.js';
|
|
8
|
-
import 'react-dom';
|
|
9
|
-
import 'classnames';
|
|
10
|
-
import '@jetbrains/icons/close';
|
|
11
|
-
import './_helpers/get-uid.js';
|
|
12
|
-
import './_helpers/data-tests.js';
|
|
13
|
-
import './shortcuts.js';
|
|
14
|
-
import 'combokeys';
|
|
15
|
-
import './_helpers/sniffer.js';
|
|
16
|
-
import 'sniffr';
|
|
17
|
-
import './tab-trap.js';
|
|
18
|
-
import './_helpers/dom.js';
|
|
19
|
-
import './_helpers/button.js';
|
|
20
|
-
import 'focus-visible';
|
|
21
|
-
import '@jetbrains/icons/chevron-10px';
|
|
22
|
-
import './icon.js';
|
|
23
|
-
import 'util-deprecate';
|
|
24
|
-
import './_helpers/memoize.js';
|
|
25
|
-
import './_helpers/theme.js';
|
|
26
|
-
import './_helpers/clickableLink.js';
|
|
27
|
-
import './_helpers/popup.target.js';
|
|
28
|
-
import 'scrollbar-width';
|
|
29
|
-
import './_helpers/linear-function.js';
|
|
30
|
-
import 'element-resize-detector';
|
|
31
|
-
import './_helpers/schedule-raf.js';
|
|
32
|
-
import './loader.js';
|
|
33
|
-
import 'es6-error';
|
|
34
|
-
import './_helpers/url.js';
|
|
35
|
-
|
|
36
|
-
var modules_45da1992 = {"unit":"8px","iFrame":"loginDialog_iFrame__ea283227","dialogContent":"loginDialog_dialogContent__ea283227","nonOpaqueLoader":"loginDialog_nonOpaqueLoader__ea283227","fallbackLinkContainer":"loginDialog_fallbackLinkContainer__ea283227"};
|
|
37
|
-
|
|
38
|
-
const HUB_AUTH_PAGE_LOGIN_STARTED = 'HUB_AUTH_PAGE_LOGIN_STARTED';
|
|
39
|
-
const HUB_AUTH_PAGE_LOGIN_DIMENSIONS = 'HUB_AUTH_PAGE_LOGIN_DIMENSIONS';
|
|
40
|
-
const DEFAULT_HEIGHT = 517;
|
|
41
|
-
const DEFAULT_WIDTH = 333;
|
|
42
|
-
const DEFAULT_SHOW_FALLBACK_TIMEOUT = 5000;
|
|
43
|
-
/**
|
|
44
|
-
* @name Login Dialog
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
class LoginDialog extends Component {
|
|
48
|
-
constructor(...args) {
|
|
49
|
-
super(...args);
|
|
50
|
-
|
|
51
|
-
_defineProperty(this, "state", {
|
|
52
|
-
loading: true,
|
|
53
|
-
loggingIn: false,
|
|
54
|
-
showFallbackLink: false,
|
|
55
|
-
height: DEFAULT_HEIGHT,
|
|
56
|
-
width: DEFAULT_WIDTH
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
_defineProperty(this, "onMessage", event => {
|
|
60
|
-
const {
|
|
61
|
-
data
|
|
62
|
-
} = event;
|
|
63
|
-
|
|
64
|
-
if (!data) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (data === HUB_AUTH_PAGE_OPENED) {
|
|
69
|
-
clearTimeout(this.showFallbackTimout);
|
|
70
|
-
this.setState({
|
|
71
|
-
loading: false,
|
|
72
|
-
loggingIn: false
|
|
73
|
-
});
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (data === HUB_AUTH_PAGE_LOGIN_STARTED) {
|
|
78
|
-
this.setState({
|
|
79
|
-
loading: true,
|
|
80
|
-
loggingIn: true
|
|
81
|
-
});
|
|
82
|
-
this.startFallbackCountdown();
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (data.message === HUB_AUTH_PAGE_LOGIN_DIMENSIONS) {
|
|
87
|
-
this.setState({
|
|
88
|
-
height: data.height,
|
|
89
|
-
width: data.width
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
componentDidMount() {
|
|
96
|
-
window.addEventListener('message', this.onMessage);
|
|
97
|
-
this.startFallbackCountdown();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
componentWillUnmount() {
|
|
101
|
-
window.removeEventListener('message', this.onMessage);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
startFallbackCountdown() {
|
|
105
|
-
this.showFallbackTimout = setTimeout(() => this.setState({
|
|
106
|
-
showFallbackLink: true
|
|
107
|
-
}), this.props.showFallbackTimeout);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
render() {
|
|
111
|
-
const {
|
|
112
|
-
show,
|
|
113
|
-
className,
|
|
114
|
-
url,
|
|
115
|
-
loadingMessage,
|
|
116
|
-
renderFallbackLink,
|
|
117
|
-
onCancel
|
|
118
|
-
} = this.props;
|
|
119
|
-
const {
|
|
120
|
-
loading,
|
|
121
|
-
height,
|
|
122
|
-
width,
|
|
123
|
-
loggingIn,
|
|
124
|
-
showFallbackLink
|
|
125
|
-
} = this.state;
|
|
126
|
-
const iFrameStyle = {
|
|
127
|
-
height,
|
|
128
|
-
width
|
|
129
|
-
};
|
|
130
|
-
return /*#__PURE__*/React.createElement(Dialog, {
|
|
131
|
-
"data-test": "ring-login-dialog",
|
|
132
|
-
className: className,
|
|
133
|
-
contentClassName: modules_45da1992.dialogContent,
|
|
134
|
-
trapFocus: true,
|
|
135
|
-
autoFocusFirst: false,
|
|
136
|
-
show: show,
|
|
137
|
-
showCloseButton: true,
|
|
138
|
-
onCloseAttempt: onCancel
|
|
139
|
-
}, /*#__PURE__*/React.createElement(ContentWrapper, null, /*#__PURE__*/React.createElement("iframe", {
|
|
140
|
-
title: "Login dialog",
|
|
141
|
-
style: iFrameStyle,
|
|
142
|
-
src: url,
|
|
143
|
-
className: modules_45da1992.iFrame,
|
|
144
|
-
scrolling: "no"
|
|
145
|
-
})), loading && /*#__PURE__*/React.createElement(LoaderScreen, {
|
|
146
|
-
message: loadingMessage,
|
|
147
|
-
containerClassName: modules_45da1992.nonOpaqueLoader
|
|
148
|
-
}), showFallbackLink && /*#__PURE__*/React.createElement("div", {
|
|
149
|
-
className: modules_45da1992.fallbackLinkContainer
|
|
150
|
-
}, renderFallbackLink(loggingIn)));
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
_defineProperty(LoginDialog, "propTypes", {
|
|
156
|
-
show: PropTypes.bool,
|
|
157
|
-
className: PropTypes.string,
|
|
158
|
-
url: PropTypes.string,
|
|
159
|
-
loader: PropTypes.bool,
|
|
160
|
-
loadingMessage: PropTypes.string,
|
|
161
|
-
showFallbackTimeout: PropTypes.number,
|
|
162
|
-
renderFallbackLink: PropTypes.func,
|
|
163
|
-
onCancel: PropTypes.func.isRequired
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
_defineProperty(LoginDialog, "defaultProps", {
|
|
167
|
-
show: false,
|
|
168
|
-
url: 'about:blank',
|
|
169
|
-
renderFallbackLink: () => null,
|
|
170
|
-
showFallbackTimeout: DEFAULT_SHOW_FALLBACK_TIMEOUT
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
export default LoginDialog;
|
package/dist/logo.js
DELETED
package/dist/message.js
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty, a as _extends } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { Component } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import gift from '@jetbrains/icons/gift';
|
|
6
|
-
import { P as Popup } from './_helpers/popup.js';
|
|
7
|
-
import Icon from './icon.js';
|
|
8
|
-
import { B as Button } from './_helpers/button.js';
|
|
9
|
-
import 'react-dom';
|
|
10
|
-
import './_helpers/get-uid.js';
|
|
11
|
-
import './_helpers/schedule-raf.js';
|
|
12
|
-
import './_helpers/dom.js';
|
|
13
|
-
import './shortcuts.js';
|
|
14
|
-
import 'combokeys';
|
|
15
|
-
import './_helpers/sniffer.js';
|
|
16
|
-
import 'sniffr';
|
|
17
|
-
import './_helpers/data-tests.js';
|
|
18
|
-
import './tab-trap.js';
|
|
19
|
-
import './_helpers/popup.target.js';
|
|
20
|
-
import 'util-deprecate';
|
|
21
|
-
import './_helpers/memoize.js';
|
|
22
|
-
import 'focus-visible';
|
|
23
|
-
import '@jetbrains/icons/chevron-10px';
|
|
24
|
-
import './_helpers/theme.js';
|
|
25
|
-
import './_helpers/clickableLink.js';
|
|
26
|
-
|
|
27
|
-
var modules_8b837449 = {"unit":"8px","padding":"12px","message":"message_message__18608ba2","icon":"message_icon__18608ba2","title":"message_title__18608ba2 global_fontLower__0f8f4370 global_font__0f8f4370","description":"message_description__18608ba2 global_fontSmallerLower__0f8f4370 global_fontSmaller__0f8f4370 global_fontLower__0f8f4370 global_font__0f8f4370","button":"message_button__18608ba2","tail":"message_tail__18608ba2"};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @name Message
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
const {
|
|
34
|
-
Directions
|
|
35
|
-
} = Popup.PopupProps;
|
|
36
|
-
const UNIT = 8;
|
|
37
|
-
|
|
38
|
-
const getTailOffsets = offset => ({
|
|
39
|
-
[Directions.BOTTOM_RIGHT]: {
|
|
40
|
-
top: 0,
|
|
41
|
-
left: offset - UNIT,
|
|
42
|
-
transform: 'rotate(180deg)'
|
|
43
|
-
},
|
|
44
|
-
[Directions.BOTTOM_LEFT]: {
|
|
45
|
-
top: 0,
|
|
46
|
-
right: offset - UNIT,
|
|
47
|
-
transform: 'rotate(180deg)'
|
|
48
|
-
},
|
|
49
|
-
[Directions.BOTTOM_CENTER]: {
|
|
50
|
-
top: 0,
|
|
51
|
-
left: offset - UNIT,
|
|
52
|
-
transform: 'rotate(180deg)'
|
|
53
|
-
},
|
|
54
|
-
[Directions.TOP_RIGHT]: {
|
|
55
|
-
bottom: -UNIT + 1,
|
|
56
|
-
left: offset - UNIT
|
|
57
|
-
},
|
|
58
|
-
[Directions.TOP_LEFT]: {
|
|
59
|
-
bottom: -UNIT + 1,
|
|
60
|
-
right: offset - UNIT
|
|
61
|
-
},
|
|
62
|
-
[Directions.TOP_CENTER]: {
|
|
63
|
-
bottom: -UNIT + 1,
|
|
64
|
-
left: offset - UNIT
|
|
65
|
-
},
|
|
66
|
-
[Directions.RIGHT_TOP]: {
|
|
67
|
-
bottom: offset - UNIT,
|
|
68
|
-
left: -UNIT,
|
|
69
|
-
transform: 'rotate(90deg)'
|
|
70
|
-
},
|
|
71
|
-
[Directions.RIGHT_BOTTOM]: {
|
|
72
|
-
top: offset,
|
|
73
|
-
left: -UNIT,
|
|
74
|
-
transform: 'rotate(90deg)'
|
|
75
|
-
},
|
|
76
|
-
[Directions.RIGHT_CENTER]: {
|
|
77
|
-
top: offset,
|
|
78
|
-
left: -UNIT,
|
|
79
|
-
transform: 'rotate(90deg)'
|
|
80
|
-
},
|
|
81
|
-
[Directions.LEFT_TOP]: {
|
|
82
|
-
bottom: offset - UNIT,
|
|
83
|
-
right: -UNIT,
|
|
84
|
-
transform: 'rotate(-90deg)'
|
|
85
|
-
},
|
|
86
|
-
[Directions.LEFT_BOTTOM]: {
|
|
87
|
-
top: offset,
|
|
88
|
-
right: -UNIT,
|
|
89
|
-
transform: 'rotate(-90deg)'
|
|
90
|
-
},
|
|
91
|
-
[Directions.LEFT_CENTER]: {
|
|
92
|
-
top: offset,
|
|
93
|
-
right: -UNIT,
|
|
94
|
-
transform: 'rotate(-90deg)'
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
/**
|
|
98
|
-
* Displays a popup containing a message.
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
class Message extends Component {
|
|
103
|
-
constructor(...args) {
|
|
104
|
-
super(...args);
|
|
105
|
-
|
|
106
|
-
_defineProperty(this, "state", {});
|
|
107
|
-
|
|
108
|
-
_defineProperty(this, "_onDirectionChange", direction => this.setState({
|
|
109
|
-
direction
|
|
110
|
-
}));
|
|
111
|
-
|
|
112
|
-
_defineProperty(this, "popupRef", el => {
|
|
113
|
-
var _this$popup;
|
|
114
|
-
|
|
115
|
-
this.popup = el;
|
|
116
|
-
this.node = (_this$popup = this.popup) === null || _this$popup === void 0 ? void 0 : _this$popup.node;
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
getTailOffset() {
|
|
121
|
-
var _this$popup2;
|
|
122
|
-
|
|
123
|
-
const DEFAULT_OFFSET = 32;
|
|
124
|
-
const {
|
|
125
|
-
popupProps
|
|
126
|
-
} = this.props;
|
|
127
|
-
|
|
128
|
-
if (this.props.tailOffset != null) {
|
|
129
|
-
return this.props.tailOffset;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const anchor = (popupProps === null || popupProps === void 0 ? void 0 : popupProps.anchorElement) || ((_this$popup2 = this.popup) === null || _this$popup2 === void 0 ? void 0 : _this$popup2.parent);
|
|
133
|
-
|
|
134
|
-
if (!anchor) {
|
|
135
|
-
return DEFAULT_OFFSET;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const offset = Math.floor(anchor.offsetWidth / 2);
|
|
139
|
-
const isOpenedToRight = [Directions.TOP_RIGHT, Directions.BOTTOM_RIGHT].includes(this.state.direction);
|
|
140
|
-
|
|
141
|
-
if (popupProps !== null && popupProps !== void 0 && popupProps.left && isOpenedToRight) {
|
|
142
|
-
return offset - (popupProps === null || popupProps === void 0 ? void 0 : popupProps.left);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return offset;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
render() {
|
|
149
|
-
const {
|
|
150
|
-
children,
|
|
151
|
-
className,
|
|
152
|
-
tailClassName,
|
|
153
|
-
title,
|
|
154
|
-
icon,
|
|
155
|
-
popupProps,
|
|
156
|
-
buttonProps,
|
|
157
|
-
onClose,
|
|
158
|
-
onDismiss,
|
|
159
|
-
translations
|
|
160
|
-
} = this.props;
|
|
161
|
-
const classes = classNames(modules_8b837449.message, className);
|
|
162
|
-
const tailClasses = classNames(modules_8b837449.tail, tailClassName);
|
|
163
|
-
const popupDirections = this.props.direction ? [this.props.direction] : this.props.directions;
|
|
164
|
-
const {
|
|
165
|
-
direction
|
|
166
|
-
} = this.state;
|
|
167
|
-
return /*#__PURE__*/React.createElement(Popup, _extends({
|
|
168
|
-
ref: this.popupRef,
|
|
169
|
-
hidden: false,
|
|
170
|
-
directions: popupDirections,
|
|
171
|
-
className: classes,
|
|
172
|
-
offset: UNIT * 2,
|
|
173
|
-
onDirectionChange: this._onDirectionChange
|
|
174
|
-
}, popupProps), direction && /*#__PURE__*/React.createElement("div", {
|
|
175
|
-
className: tailClasses,
|
|
176
|
-
style: getTailOffsets(this.getTailOffset())[direction]
|
|
177
|
-
}), icon && /*#__PURE__*/React.createElement(Icon, {
|
|
178
|
-
className: modules_8b837449.icon,
|
|
179
|
-
glyph: icon
|
|
180
|
-
}), /*#__PURE__*/React.createElement("h1", {
|
|
181
|
-
"data-test": "rgMessageTitle",
|
|
182
|
-
className: modules_8b837449.title
|
|
183
|
-
}, title), children && /*#__PURE__*/React.createElement("div", {
|
|
184
|
-
className: modules_8b837449.description
|
|
185
|
-
}, children), (onClose || buttonProps) && /*#__PURE__*/React.createElement(Button, _extends({
|
|
186
|
-
className: modules_8b837449.button,
|
|
187
|
-
onClick: onClose,
|
|
188
|
-
primary: true
|
|
189
|
-
}, buttonProps), translations.gotIt), onDismiss && /*#__PURE__*/React.createElement(Button, {
|
|
190
|
-
onClick: onDismiss,
|
|
191
|
-
text: true
|
|
192
|
-
}, translations.dismiss));
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
_defineProperty(Message, "propTypes", {
|
|
198
|
-
children: PropTypes.node,
|
|
199
|
-
className: PropTypes.string,
|
|
200
|
-
tailClassName: PropTypes.string,
|
|
201
|
-
title: PropTypes.string.isRequired,
|
|
202
|
-
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
203
|
-
directions: PropTypes.arrayOf(PropTypes.string),
|
|
204
|
-
direction: PropTypes.string,
|
|
205
|
-
popupProps: PropTypes.object,
|
|
206
|
-
buttonProps: PropTypes.object,
|
|
207
|
-
tailOffset: PropTypes.number,
|
|
208
|
-
onClose: PropTypes.func,
|
|
209
|
-
onDismiss: PropTypes.func,
|
|
210
|
-
translations: PropTypes.object
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
_defineProperty(Message, "defaultProps", {
|
|
214
|
-
icon: gift,
|
|
215
|
-
directions: [Directions.TOP_RIGHT, Directions.TOP_LEFT, Directions.TOP_CENTER, Directions.BOTTOM_RIGHT, Directions.BOTTOM_LEFT, Directions.BOTTOM_CENTER, Directions.RIGHT_TOP, Directions.RIGHT_BOTTOM, Directions.RIGHT_CENTER, Directions.LEFT_TOP, Directions.LEFT_BOTTOM, Directions.LEFT_CENTER],
|
|
216
|
-
translations: {
|
|
217
|
-
gotIt: 'Got it',
|
|
218
|
-
dismiss: 'Dismiss'
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
_defineProperty(Message, "Directions", Directions);
|
|
223
|
-
|
|
224
|
-
_defineProperty(Message, "PopupProps", Popup.PopupProps);
|
|
225
|
-
|
|
226
|
-
export default Message;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { c as _objectSpread2 } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import { s as sniffr } from './_helpers/sniffer.js';
|
|
3
|
-
import 'sniffr';
|
|
4
|
-
|
|
5
|
-
const MAJOR_VERSION_INDEX = 0;
|
|
6
|
-
/**
|
|
7
|
-
* SUPPORTED_BROWSERS are defined by Babel plugin, see babel config
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/* global SUPPORTED_BROWSERS */
|
|
11
|
-
|
|
12
|
-
if (!["and_chr 90", "and_uc 12.12", "chrome 89", "chrome 88", "edge 89", "firefox 86", "ios_saf 14.0-14.5", "safari 14", "samsung 13.0"]) {
|
|
13
|
-
// eslint-disable-next-line no-console
|
|
14
|
-
console.warn('Ring UI: no SUPPORTED_BROWSERS passed. Please check babel config.');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const SUPPORTED = ["and_chr 90", "and_uc 12.12", "chrome 89", "chrome 88", "edge 89", "firefox 86", "ios_saf 14.0-14.5", "safari 14", "samsung 13.0"] || [];
|
|
18
|
-
const WHITE_LISTED_BROWSERS = ['chrome', 'firefox', 'safari', 'edge'];
|
|
19
|
-
const WHITE_LIST = SUPPORTED.reduce((acc, item) => {
|
|
20
|
-
const [, browserName, version] = item.match(/(\S+)\s(\S+)/);
|
|
21
|
-
|
|
22
|
-
if (!WHITE_LISTED_BROWSERS.includes(browserName)) {
|
|
23
|
-
return acc;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return _objectSpread2(_objectSpread2({}, acc), {}, {
|
|
27
|
-
[browserName]: parseInt(version, 10)
|
|
28
|
-
});
|
|
29
|
-
}, {});
|
|
30
|
-
function isBrowserInWhiteList() {
|
|
31
|
-
return sniffr.browser.version[MAJOR_VERSION_INDEX] >= WHITE_LIST[sniffr.browser.name];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @name Old Browsers Message
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
The list of versions which are definitely supported. "Browser is unsupported"
|
|
40
|
-
won't be displayed for those and higher versions even when a JS error occurs
|
|
41
|
-
on application start.
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
let smileChanges = 0;
|
|
45
|
-
const MAX_SMILE_CHANGES = 50;
|
|
46
|
-
let previousWindowErrorHandler;
|
|
47
|
-
|
|
48
|
-
function changeSmileClickListener(event) {
|
|
49
|
-
const eyes = ['O', 'o', '-', '>', '<'];
|
|
50
|
-
const target = event.target || event.srcElement;
|
|
51
|
-
smileChanges++;
|
|
52
|
-
|
|
53
|
-
function rand(min, max) {
|
|
54
|
-
return Math.round(Math.random() * (max - min)) + min;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function getRandomEye() {
|
|
58
|
-
return eyes[rand(0, eyes.length - 1)];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function getRandomSmile() {
|
|
62
|
-
if (smileChanges >= MAX_SMILE_CHANGES) {
|
|
63
|
-
return '\\\\ (x_x) //';
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return `{{ (${getRandomEye()}_${getRandomEye()}) }}`;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
target.innerHTML = getRandomSmile();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function attachSmileClickListener(smileNode) {
|
|
73
|
-
if (smileNode.addEventListener) {
|
|
74
|
-
smileNode.addEventListener('click', changeSmileClickListener);
|
|
75
|
-
} else if (smileNode.attachEvent) {
|
|
76
|
-
smileNode.attachEvent('onclick', changeSmileClickListener);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Listens to unhandled errors and displays passed node
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
function startOldBrowsersDetector(onOldBrowserDetected) {
|
|
85
|
-
previousWindowErrorHandler = window.onerror;
|
|
86
|
-
|
|
87
|
-
window.onerror = function oldBrowsersMessageShower(errorMsg, url, lineNumber) {
|
|
88
|
-
if (onOldBrowserDetected) {
|
|
89
|
-
onOldBrowserDetected();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (previousWindowErrorHandler) {
|
|
93
|
-
return previousWindowErrorHandler(errorMsg, url, lineNumber);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return false;
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function stopOldBrowserDetector() {
|
|
101
|
-
window.onerror = previousWindowErrorHandler;
|
|
102
|
-
} //Start javascript error detection
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
startOldBrowsersDetector(() => {
|
|
106
|
-
const oldBrowsersMessageContainer = document.getElementById('ring-old-browsers-message');
|
|
107
|
-
const browserMessage = document.getElementById('ring-old-browsers-message__browser-message');
|
|
108
|
-
const errorMessage = document.getElementById('ring-old-browsers-message__error-message');
|
|
109
|
-
const smileNode = document.getElementById('ring-old-browsers-message__smile');
|
|
110
|
-
|
|
111
|
-
if (isBrowserInWhiteList()) {
|
|
112
|
-
browserMessage.style.display = 'none';
|
|
113
|
-
errorMessage.style.display = 'block';
|
|
114
|
-
} else {
|
|
115
|
-
browserMessage.style.display = 'block';
|
|
116
|
-
errorMessage.style.display = 'none';
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (oldBrowsersMessageContainer) {
|
|
120
|
-
oldBrowsersMessageContainer.hidden = false;
|
|
121
|
-
oldBrowsersMessageContainer.style.display = 'block';
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (smileNode) {
|
|
125
|
-
attachSmileClickListener(smileNode);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
export { stopOldBrowserDetector as stop };
|