@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
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty } from './_rollupPluginBabelHelpers.js';
|
|
2
|
-
import { createElement } from 'react';
|
|
3
|
-
import { render } from 'react-dom';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Wraps a component to add a "rerender" method
|
|
7
|
-
* @param ComposedComponent
|
|
8
|
-
* @param captureNode, whether the wrapper should capture this.node itself. Set to false if the component already has "node" property captured
|
|
9
|
-
* @returns {Rerenderer}
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
function rerenderHOC(ComposedComponent, {
|
|
13
|
-
captureNode
|
|
14
|
-
} = {
|
|
15
|
-
captureNode: false
|
|
16
|
-
}) {
|
|
17
|
-
var _temp;
|
|
18
|
-
|
|
19
|
-
if (captureNode) {
|
|
20
|
-
// TODO remove in 5.0
|
|
21
|
-
throw new Error('rerenderHOC: captureNode={true} is deprecated. Wrapped component must have "node" property captured itself');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return _temp = class Rerenderer extends ComposedComponent {
|
|
25
|
-
constructor(...args) {
|
|
26
|
-
super(...args);
|
|
27
|
-
|
|
28
|
-
_defineProperty(this, "_propsCache", {});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
rerender(props = {}, callback) {
|
|
32
|
-
let container;
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
container = this.node.parentNode;
|
|
36
|
-
} finally {
|
|
37
|
-
if (!container) {
|
|
38
|
-
throw new Error(`${this.constructor.name} component isn't mounted`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
this._propsCache = Object.assign({}, this.props, this._propsCache, props);
|
|
43
|
-
return render( /*#__PURE__*/createElement(this.constructor, this._propsCache), container, callback);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
}, _temp;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { rerenderHOC as r };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
function scheduleRAF(trailingCall) {
|
|
2
|
-
let scheduledCb;
|
|
3
|
-
let RAF;
|
|
4
|
-
let trailingCallScheduled = false;
|
|
5
|
-
|
|
6
|
-
function doSchedule() {
|
|
7
|
-
RAF = window.requestAnimationFrame(() => {
|
|
8
|
-
scheduledCb();
|
|
9
|
-
|
|
10
|
-
if (trailingCallScheduled) {
|
|
11
|
-
trailingCallScheduled = false;
|
|
12
|
-
doSchedule();
|
|
13
|
-
} else {
|
|
14
|
-
RAF = null;
|
|
15
|
-
scheduledCb = null;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return function schedule(cb) {
|
|
21
|
-
scheduledCb = cb;
|
|
22
|
-
|
|
23
|
-
if (!RAF) {
|
|
24
|
-
doSchedule();
|
|
25
|
-
} else if (trailingCall) {
|
|
26
|
-
trailingCallScheduled = true;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { scheduleRAF as s };
|
package/dist/_helpers/sniffer.js
DELETED
package/dist/_helpers/theme.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { _ as _objectWithoutProperties, a as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { createContext, memo, forwardRef } from 'react';
|
|
3
|
-
|
|
4
|
-
const Theme = {
|
|
5
|
-
LIGHT: 'light',
|
|
6
|
-
DARK: 'dark'
|
|
7
|
-
};
|
|
8
|
-
const ThemeContext = /*#__PURE__*/createContext();
|
|
9
|
-
|
|
10
|
-
const getDisplayName = Component => {
|
|
11
|
-
var _ref, _Component$name;
|
|
12
|
-
|
|
13
|
-
return typeof Component === 'string' ? Component : (_ref = (_Component$name = Component.name) !== null && _Component$name !== void 0 ? _Component$name : Component.displayName) !== null && _ref !== void 0 ? _ref : 'Component';
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const withTheme = (defaultTheme = Theme.LIGHT) => ComposedComponent => {
|
|
17
|
-
const WithTheme = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function WithTheme(_ref2, ref) {
|
|
18
|
-
let {
|
|
19
|
-
theme
|
|
20
|
-
} = _ref2,
|
|
21
|
-
restProps = _objectWithoutProperties(_ref2, ["theme"]);
|
|
22
|
-
|
|
23
|
-
return /*#__PURE__*/React.createElement(ThemeContext.Consumer, null, contextTheme => {
|
|
24
|
-
const usedTheme = theme || contextTheme || defaultTheme;
|
|
25
|
-
return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
|
|
26
|
-
value: usedTheme
|
|
27
|
-
}, /*#__PURE__*/React.createElement(ComposedComponent, _extends({
|
|
28
|
-
ref: ref
|
|
29
|
-
}, restProps, {
|
|
30
|
-
theme: usedTheme
|
|
31
|
-
})));
|
|
32
|
-
});
|
|
33
|
-
}));
|
|
34
|
-
Object.assign(WithTheme, ComposedComponent);
|
|
35
|
-
WithTheme.propTypes = ComposedComponent.propTypes;
|
|
36
|
-
WithTheme.displayName = `withTheme(${getDisplayName(ComposedComponent)})`;
|
|
37
|
-
return WithTheme;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export { Theme as T, ThemeContext as a, withTheme as w };
|
package/dist/_helpers/url.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @const {RegExp}
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const ABSOLUTE_URL_PATTERN = /^[a-z]+:\/\//i;
|
|
6
|
-
/**
|
|
7
|
-
* Get URI from the <base> tag
|
|
8
|
-
* @return {string|undefined} base URI
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
function getBaseURI() {
|
|
12
|
-
const baseElement = document.getElementsByTagName('base')[0];
|
|
13
|
-
return baseElement ? baseElement.href : undefined;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Get absolute URI from the <base> tag
|
|
17
|
-
* @return {string} absolute base URI
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
function getAbsoluteBaseURL() {
|
|
21
|
-
const baseUrl = getBaseURI();
|
|
22
|
-
const host = `${window.location.protocol}//${window.location.host}`;
|
|
23
|
-
let uri;
|
|
24
|
-
|
|
25
|
-
if (baseUrl) {
|
|
26
|
-
uri = ABSOLUTE_URL_PATTERN.test(baseUrl) ? baseUrl : host + baseUrl;
|
|
27
|
-
} else {
|
|
28
|
-
uri = host;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return uri;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Fixes the URL
|
|
35
|
-
* If the URL is relative and the page contains a <base> TAG, the URL will be converted to absolute
|
|
36
|
-
* <base href="/">: some/path => /some/path
|
|
37
|
-
* @param {string} url URL to fix
|
|
38
|
-
* @param {Function} baseURIGetter a function that returns base URI
|
|
39
|
-
* @return {string} fixed URL
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
function fixUrl(url, baseURIGetter = getBaseURI) {
|
|
43
|
-
if (url.indexOf('http://') === -1 && url.indexOf('https://') === -1 && url.indexOf('/') !== 0) {
|
|
44
|
-
const baseUrl = baseURIGetter();
|
|
45
|
-
|
|
46
|
-
if (baseUrl) {
|
|
47
|
-
return baseUrl + url;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return url;
|
|
52
|
-
}
|
|
53
|
-
function joinBaseURLAndPath(baseUrl, path) {
|
|
54
|
-
if (!baseUrl || path.indexOf('http://') !== -1 || path.indexOf('https://') !== -1) {
|
|
55
|
-
return path;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return baseUrl + path;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Parses a queryString into an object.
|
|
62
|
-
* ```
|
|
63
|
-
* parseQueryString("access_token=2YotnFZFEjr1zCsicMWpAA&state=xyz&token_type=example&expires_in=3600");
|
|
64
|
-
* // is {access_token: "2YotnFZFEjr1zCsicMWpAA", state: "xyz", token_type: "example", expires_in: "3600"}
|
|
65
|
-
* ```
|
|
66
|
-
* @param {string} queryString query parameter string to parse
|
|
67
|
-
* @return {AuthResponse} object with query parameters map
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
function parseQueryString(queryString) {
|
|
71
|
-
if (queryString == null) {
|
|
72
|
-
return {};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const queryParameterPairRE = /([^&;=]+)=?([^&;]*)/g;
|
|
76
|
-
const FIRST_PAIR_ELEMENT = 1;
|
|
77
|
-
const SECOND_PAIR_ELEMENT = 2;
|
|
78
|
-
const urlParams = {};
|
|
79
|
-
|
|
80
|
-
function decode(s) {
|
|
81
|
-
return decodeURIComponent(s.replace(/\+/g, ' '));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
let matchedQueryPair;
|
|
85
|
-
|
|
86
|
-
while ((matchedQueryPair = queryParameterPairRE.exec(queryString)) != null) {
|
|
87
|
-
urlParams[decode(matchedQueryPair[FIRST_PAIR_ELEMENT])] = decode(matchedQueryPair[SECOND_PAIR_ELEMENT]);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return urlParams;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function customEncodeURIComponent(str) {
|
|
94
|
-
const commaRE = /%2C/g;
|
|
95
|
-
return encodeURIComponent(str).replace(commaRE, ',');
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Takes a URL as input and a params object.
|
|
99
|
-
* Each property in the params is added to the URL as query string parameters
|
|
100
|
-
* @param {string} url URL to add parameters to
|
|
101
|
-
* @param {Object} params parameters to add
|
|
102
|
-
* @returns {string} encoded URL
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
function encodeURL(url, params) {
|
|
107
|
-
const equalsSign = '=';
|
|
108
|
-
const firstSeparator = url.indexOf('?') === -1 ? '?' : '&';
|
|
109
|
-
let res = url;
|
|
110
|
-
let k;
|
|
111
|
-
let i = 0;
|
|
112
|
-
|
|
113
|
-
for (k in params) {
|
|
114
|
-
if (params.hasOwnProperty(k) && params[k] != null) {
|
|
115
|
-
res += (i++ === 0 ? firstSeparator : '&') + customEncodeURIComponent(k) + equalsSign + customEncodeURIComponent(params[k]);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return res;
|
|
120
|
-
}
|
|
121
|
-
function isDataURI(uri) {
|
|
122
|
-
return uri.indexOf('data:') === 0;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export { encodeURL as e, fixUrl as f, getAbsoluteBaseURL as g, isDataURI as i, joinBaseURLAndPath as j, parseQueryString as p };
|
package/dist/alert-service.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty, _ as _objectWithoutProperties, a as _extends, c as _objectSpread2 } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { render } from 'react-dom';
|
|
4
|
-
import { g as getUID } from './_helpers/get-uid.js';
|
|
5
|
-
import Alert, { Container as Alerts, ANIMATION_TIME } from './alert.js';
|
|
6
|
-
import 'classnames';
|
|
7
|
-
import 'prop-types';
|
|
8
|
-
import '@jetbrains/icons/exception';
|
|
9
|
-
import '@jetbrains/icons/checkmark';
|
|
10
|
-
import '@jetbrains/icons/warning';
|
|
11
|
-
import '@jetbrains/icons/close';
|
|
12
|
-
import './icon.js';
|
|
13
|
-
import 'util-deprecate';
|
|
14
|
-
import './_helpers/memoize.js';
|
|
15
|
-
import './loader-inline.js';
|
|
16
|
-
import './_helpers/theme.js';
|
|
17
|
-
import './_helpers/data-tests.js';
|
|
18
|
-
import 'conic-gradient';
|
|
19
|
-
import './_helpers/dom.js';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @name Alert Service
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
class AlertService {
|
|
26
|
-
constructor() {
|
|
27
|
-
_defineProperty(this, "defaultTimeout", 0);
|
|
28
|
-
|
|
29
|
-
_defineProperty(this, "showingAlerts", []);
|
|
30
|
-
|
|
31
|
-
_defineProperty(this, "containerElement", document.createElement('div'));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
_getShowingAlerts() {
|
|
35
|
-
return [...this.showingAlerts];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
renderAlertContainer(alerts) {
|
|
39
|
-
if (alerts.length === 0) {
|
|
40
|
-
return /*#__PURE__*/React.createElement("span", null);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return /*#__PURE__*/React.createElement(Alerts, null, alerts.map(alert => {
|
|
44
|
-
const {
|
|
45
|
-
message,
|
|
46
|
-
key
|
|
47
|
-
} = alert,
|
|
48
|
-
rest = _objectWithoutProperties(alert, ["message", "key"]);
|
|
49
|
-
|
|
50
|
-
return /*#__PURE__*/React.createElement(Alert, _extends({
|
|
51
|
-
key: key
|
|
52
|
-
}, rest), message);
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Renders alert container into virtual node to skip maintaining container
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
renderAlerts() {
|
|
61
|
-
render(this.renderAlertContainer(this.showingAlerts), this.containerElement);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
findSameAlert(message, type) {
|
|
65
|
-
return this.showingAlerts.filter(it => it.type === type && it.message === message)[0];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
startAlertClosing(alert) {
|
|
69
|
-
alert.isClosing = true;
|
|
70
|
-
this.renderAlerts();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
remove(key) {
|
|
74
|
-
const alertToClose = this.showingAlerts.filter(alert => alert.key === key)[0];
|
|
75
|
-
|
|
76
|
-
if (!alertToClose) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
this.startAlertClosing(alertToClose);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
removeWithoutAnimation(key) {
|
|
84
|
-
this.showingAlerts = this.showingAlerts.filter(alert => alert.key !== key);
|
|
85
|
-
this.renderAlerts();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
stopShakingWhenAnimationDone(shakingAlert) {
|
|
89
|
-
setTimeout(() => {
|
|
90
|
-
shakingAlert.showWithAnimation = false;
|
|
91
|
-
shakingAlert.isShaking = false;
|
|
92
|
-
this.renderAlerts();
|
|
93
|
-
}, ANIMATION_TIME);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
addAlert(message, type, timeout = this.defaultTimeout, restOptions = {}) {
|
|
97
|
-
const sameAlert = this.findSameAlert(message, type);
|
|
98
|
-
|
|
99
|
-
if (sameAlert) {
|
|
100
|
-
sameAlert.isShaking = true;
|
|
101
|
-
this.renderAlerts();
|
|
102
|
-
this.stopShakingWhenAnimationDone(sameAlert);
|
|
103
|
-
return sameAlert.key;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const alert = _objectSpread2({
|
|
107
|
-
key: getUID('alert-service-'),
|
|
108
|
-
message,
|
|
109
|
-
type,
|
|
110
|
-
timeout,
|
|
111
|
-
isClosing: false,
|
|
112
|
-
onCloseRequest: () => this.startAlertClosing(alert),
|
|
113
|
-
onClose: () => this.removeWithoutAnimation(alert.key)
|
|
114
|
-
}, restOptions);
|
|
115
|
-
|
|
116
|
-
this.showingAlerts = [alert, ...this.showingAlerts];
|
|
117
|
-
this.renderAlerts();
|
|
118
|
-
return alert.key;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
setDefaultTimeout(timeout) {
|
|
122
|
-
this.defaultTimeout = timeout;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
error(message, timeout) {
|
|
126
|
-
return this.addAlert(message, Alert.Type.ERROR, timeout);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
message(message, timeout) {
|
|
130
|
-
return this.addAlert(message, Alert.Type.MESSAGE, timeout);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
warning(message, timeout) {
|
|
134
|
-
return this.addAlert(message, Alert.Type.WARNING, timeout);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
successMessage(message, timeout) {
|
|
138
|
-
return this.addAlert(message, Alert.Type.SUCCESS, timeout);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
loadingMessage(message, timeout) {
|
|
142
|
-
return this.addAlert(message, Alert.Type.LOADING, timeout);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const alertService = new AlertService();
|
|
148
|
-
|
|
149
|
-
export default alertService;
|
package/dist/alert.js
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import { _ as _objectWithoutProperties, a as _extends, b as _defineProperty } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { PureComponent, Children, cloneElement } from 'react';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import exceptionIcon from '@jetbrains/icons/exception';
|
|
6
|
-
import checkmarkIcon from '@jetbrains/icons/checkmark';
|
|
7
|
-
import warningIcon from '@jetbrains/icons/warning';
|
|
8
|
-
import closeIcon from '@jetbrains/icons/close';
|
|
9
|
-
import Icon from './icon.js';
|
|
10
|
-
import LoaderInline from './loader-inline.js';
|
|
11
|
-
import { g as getRect } from './_helpers/dom.js';
|
|
12
|
-
import { j as joinDataTestAttributes } from './_helpers/data-tests.js';
|
|
13
|
-
import { createPortal } from 'react-dom';
|
|
14
|
-
import 'util-deprecate';
|
|
15
|
-
import './_helpers/memoize.js';
|
|
16
|
-
import './_helpers/theme.js';
|
|
17
|
-
import 'conic-gradient';
|
|
18
|
-
import './_helpers/get-uid.js';
|
|
19
|
-
|
|
20
|
-
var modules_e02b3280 = {"unit":"8px","animation-duration":".3s","animation-easing":"ease-out","close":"alert_close__9b217ed4","alert":"alert_alert__9b217ed4","alertInline":"alert_alertInline__9b217ed4","error":"alert_error__9b217ed4","icon":"alert_icon__9b217ed4","caption":"alert_caption__9b217ed4","link":"alert_link__9b217ed4","withCloseButton":"alert_withCloseButton__9b217ed4","badge":"alert_badge__9b217ed4","loader":"alert_loader__9b217ed4","animationOpen":"alert_animationOpen__9b217ed4","show":"alert_show__9b217ed4","animationClosing":"alert_animationClosing__9b217ed4","animationShaking":"alert_animationShaking__9b217ed4","shaking":"alert_shaking__9b217ed4"};
|
|
21
|
-
|
|
22
|
-
var modules_fc8df42d = {"unit":"8px","alert":"alert_alert__9b217ed4","alertContainer":"container_alertContainer__127d32bc","alertInContainer":"container_alertInContainer__127d32bc alert_alert__9b217ed4"};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @name Alert Container
|
|
26
|
-
* @description Displays a stack of alerts on top of the page.
|
|
27
|
-
* @extends {PureComponent}
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
class Alerts extends PureComponent {
|
|
31
|
-
render() {
|
|
32
|
-
const _this$props = this.props,
|
|
33
|
-
{
|
|
34
|
-
children,
|
|
35
|
-
className
|
|
36
|
-
} = _this$props,
|
|
37
|
-
restProps = _objectWithoutProperties(_this$props, ["children", "className"]);
|
|
38
|
-
|
|
39
|
-
const classes = classNames(modules_fc8df42d.alertContainer, className);
|
|
40
|
-
const show = Children.count(children) > 0;
|
|
41
|
-
|
|
42
|
-
if (!show) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", _extends({
|
|
47
|
-
"data-test": "alert-container",
|
|
48
|
-
className: classes,
|
|
49
|
-
"aria-live": "polite"
|
|
50
|
-
}, restProps), Children.map(children, child => {
|
|
51
|
-
const alertClassNames = classNames(modules_fc8df42d.alertInContainer, child.props.className);
|
|
52
|
-
return /*#__PURE__*/cloneElement(child, {
|
|
53
|
-
className: alertClassNames
|
|
54
|
-
});
|
|
55
|
-
})), document.body);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
_defineProperty(Alerts, "propTypes", {
|
|
61
|
-
children: PropTypes.node,
|
|
62
|
-
className: PropTypes.string
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const ANIMATION_TIME = 500;
|
|
66
|
-
/**
|
|
67
|
-
* @name Alert
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* List of available alert types.
|
|
72
|
-
* @enum {string}
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
const Type = {
|
|
76
|
-
ERROR: 'error',
|
|
77
|
-
MESSAGE: 'message',
|
|
78
|
-
SUCCESS: 'success',
|
|
79
|
-
WARNING: 'warning',
|
|
80
|
-
LOADING: 'loading'
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Lookup table of alert type to icon modifier.
|
|
84
|
-
* @type {Object.<Type, string>}
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
const TypeToIcon = {
|
|
88
|
-
[Type.ERROR]: exceptionIcon,
|
|
89
|
-
[Type.SUCCESS]: checkmarkIcon,
|
|
90
|
-
[Type.WARNING]: warningIcon
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Lookup table of alert type to icon color.
|
|
94
|
-
* @type {Object.<Type, Icon.Color>}
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
const TypeToIconColor = {
|
|
98
|
-
[Type.ERROR]: Icon.Color.RED,
|
|
99
|
-
[Type.SUCCESS]: Icon.Color.GREEN,
|
|
100
|
-
[Type.WARNING]: Icon.Color.WHITE
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* @constructor
|
|
104
|
-
* @name Alert
|
|
105
|
-
* @extends {ReactComponent}
|
|
106
|
-
*/
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* **Alert** is a component for displaying contextual notifications. If you want to display a stack of notifications, use **Alerts** instead.
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
|
-
class Alert extends PureComponent {
|
|
113
|
-
constructor(..._args) {
|
|
114
|
-
super(..._args);
|
|
115
|
-
|
|
116
|
-
_defineProperty(this, "state", {
|
|
117
|
-
height: null
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
_defineProperty(this, "closeRequest", (...args) => {
|
|
121
|
-
const height = getRect(this.node).height;
|
|
122
|
-
this.setState({
|
|
123
|
-
height
|
|
124
|
-
});
|
|
125
|
-
return this.props.onCloseRequest(...args);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
_defineProperty(this, "_handleCaptionsLinksClick", evt => {
|
|
129
|
-
if (evt.target.matches('a')) {
|
|
130
|
-
this.closeRequest(evt);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
_defineProperty(this, "storeAlertRef", node => {
|
|
135
|
-
this.node = node;
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
componentDidMount() {
|
|
140
|
-
if (this.props.timeout > 0) {
|
|
141
|
-
this.hideTimeout = setTimeout(this.closeRequest, this.props.timeout);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
componentDidUpdate() {
|
|
146
|
-
if (this.props.isClosing) {
|
|
147
|
-
this._close();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
componentWillUnmount() {
|
|
152
|
-
clearTimeout(this.hideTimeout);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
_close() {
|
|
156
|
-
setTimeout(() => {
|
|
157
|
-
this.props.onClose();
|
|
158
|
-
}, ANIMATION_TIME);
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* @param {SyntheticEvent} evt
|
|
162
|
-
* @private
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* @private
|
|
168
|
-
*/
|
|
169
|
-
_getCaption() {
|
|
170
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
171
|
-
className: classNames(modules_e02b3280.caption, this.props.captionClassName, {
|
|
172
|
-
[modules_e02b3280.withCloseButton]: this.props.closeable
|
|
173
|
-
}),
|
|
174
|
-
onClick: this._handleCaptionsLinksClick // We only process clicks on `a` elements, see above
|
|
175
|
-
,
|
|
176
|
-
role: "presentation"
|
|
177
|
-
}, this.props.children);
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* @private
|
|
181
|
-
* @return {XML|string}
|
|
182
|
-
*/
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
_getIcon() {
|
|
186
|
-
const glyph = TypeToIcon[this.props.type];
|
|
187
|
-
|
|
188
|
-
if (glyph) {
|
|
189
|
-
return /*#__PURE__*/React.createElement(Icon, {
|
|
190
|
-
glyph: glyph,
|
|
191
|
-
className: modules_e02b3280.icon,
|
|
192
|
-
color: TypeToIconColor[this.props.type] || Icon.Color.DEFAULT
|
|
193
|
-
});
|
|
194
|
-
} else if (this.props.type === Type.LOADING) {
|
|
195
|
-
return /*#__PURE__*/React.createElement(LoaderInline, {
|
|
196
|
-
className: modules_e02b3280.loader,
|
|
197
|
-
theme: LoaderInline.Theme.DARK
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return '';
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
render() {
|
|
205
|
-
const {
|
|
206
|
-
type,
|
|
207
|
-
inline,
|
|
208
|
-
isClosing,
|
|
209
|
-
isShaking,
|
|
210
|
-
showWithAnimation,
|
|
211
|
-
className,
|
|
212
|
-
'data-test': dataTest
|
|
213
|
-
} = this.props;
|
|
214
|
-
const classes = classNames(className, {
|
|
215
|
-
[modules_e02b3280.alert]: true,
|
|
216
|
-
[modules_e02b3280.animationOpen]: showWithAnimation,
|
|
217
|
-
[modules_e02b3280.error]: type === 'error',
|
|
218
|
-
[modules_e02b3280.alertInline]: inline,
|
|
219
|
-
[modules_e02b3280.animationClosing]: isClosing,
|
|
220
|
-
[modules_e02b3280.animationShaking]: isShaking
|
|
221
|
-
});
|
|
222
|
-
const style = this.state.height ? {
|
|
223
|
-
marginBottom: -this.state.height
|
|
224
|
-
} : null;
|
|
225
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
226
|
-
className: classes,
|
|
227
|
-
"data-test": joinDataTestAttributes('alert', dataTest),
|
|
228
|
-
"data-test-type": type,
|
|
229
|
-
style: style,
|
|
230
|
-
ref: this.storeAlertRef
|
|
231
|
-
}, this._getIcon(), this._getCaption(), this.props.closeable ? /*#__PURE__*/React.createElement("button", {
|
|
232
|
-
type: "button",
|
|
233
|
-
className: modules_e02b3280.close,
|
|
234
|
-
"data-test": "alert-close",
|
|
235
|
-
"aria-label": "close alert",
|
|
236
|
-
onClick: this.closeRequest
|
|
237
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
238
|
-
glyph: closeIcon
|
|
239
|
-
})) : '');
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
_defineProperty(Alert, "propTypes", {
|
|
245
|
-
timeout: PropTypes.number,
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Fires when alert starts closing if timeout is out or user clicks "Close" button
|
|
249
|
-
*/
|
|
250
|
-
onCloseRequest: PropTypes.func,
|
|
251
|
-
onClose: PropTypes.func,
|
|
252
|
-
isShaking: PropTypes.bool,
|
|
253
|
-
isClosing: PropTypes.bool,
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Whether an alert is rendered inside an **Alerts** container
|
|
257
|
-
* or standalone.
|
|
258
|
-
*/
|
|
259
|
-
inline: PropTypes.bool,
|
|
260
|
-
showWithAnimation: PropTypes.bool,
|
|
261
|
-
closeable: PropTypes.bool,
|
|
262
|
-
type: PropTypes.oneOf(Object.values(Type)),
|
|
263
|
-
children: PropTypes.node,
|
|
264
|
-
className: PropTypes.string,
|
|
265
|
-
captionClassName: PropTypes.string,
|
|
266
|
-
'data-test': PropTypes.string
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
_defineProperty(Alert, "defaultProps", {
|
|
270
|
-
closeable: true,
|
|
271
|
-
showWithAnimation: true,
|
|
272
|
-
type: Type.MESSAGE,
|
|
273
|
-
inline: true,
|
|
274
|
-
isClosing: false,
|
|
275
|
-
isShaking: false,
|
|
276
|
-
timeout: 0,
|
|
277
|
-
onClose: () => {},
|
|
278
|
-
onCloseRequest: () => {}
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
_defineProperty(Alert, "Type", Type);
|
|
282
|
-
|
|
283
|
-
export default Alert;
|
|
284
|
-
export { ANIMATION_TIME, Alerts as Container };
|