@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/heading.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { _ as _objectWithoutProperties, a as _extends } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { memo } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import deprecate from 'util-deprecate';
|
|
6
|
-
|
|
7
|
-
var modules_901b77ec = {"heading":"heading_heading__5ab589c7 global_font__0f8f4370","caps":"heading_caps__5ab589c7"};
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @name Heading
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const Levels = {
|
|
14
|
-
H1: 1,
|
|
15
|
-
H2: 2,
|
|
16
|
-
H3: 3,
|
|
17
|
-
H4: 4
|
|
18
|
-
};
|
|
19
|
-
const fallbackHeading = deprecate(() => 'h3', 'Headings of level 5 and higher are replaced with h3');
|
|
20
|
-
const Heading = /*#__PURE__*/memo(function Heading(_ref) {
|
|
21
|
-
let {
|
|
22
|
-
children,
|
|
23
|
-
className,
|
|
24
|
-
level
|
|
25
|
-
} = _ref,
|
|
26
|
-
restProps = _objectWithoutProperties(_ref, ["children", "className", "level"]);
|
|
27
|
-
|
|
28
|
-
const classes = classNames(modules_901b77ec.heading, className);
|
|
29
|
-
const Tag = level <= Levels.H4 ? `h${level}` : fallbackHeading();
|
|
30
|
-
return /*#__PURE__*/React.createElement(Tag, _extends({}, restProps, {
|
|
31
|
-
className: classes
|
|
32
|
-
}), children);
|
|
33
|
-
});
|
|
34
|
-
Heading.propTypes = {
|
|
35
|
-
children: PropTypes.node,
|
|
36
|
-
className: PropTypes.string,
|
|
37
|
-
level: PropTypes.number
|
|
38
|
-
};
|
|
39
|
-
Heading.defaultProps = {
|
|
40
|
-
level: Levels.H1
|
|
41
|
-
};
|
|
42
|
-
Heading.Levels = Levels;
|
|
43
|
-
|
|
44
|
-
function makeHeading(level, useCaps) {
|
|
45
|
-
const H = /*#__PURE__*/memo((_ref2) => {
|
|
46
|
-
let {
|
|
47
|
-
className,
|
|
48
|
-
caps
|
|
49
|
-
} = _ref2,
|
|
50
|
-
restProps = _objectWithoutProperties(_ref2, ["className", "caps"]);
|
|
51
|
-
|
|
52
|
-
const classes = classNames(className, {
|
|
53
|
-
[modules_901b77ec.caps]: useCaps && caps
|
|
54
|
-
});
|
|
55
|
-
return /*#__PURE__*/React.createElement(Heading, _extends({}, restProps, {
|
|
56
|
-
level: level,
|
|
57
|
-
className: classes
|
|
58
|
-
}));
|
|
59
|
-
});
|
|
60
|
-
H.displayName = `H${level}`;
|
|
61
|
-
H.propTypes = {
|
|
62
|
-
children: PropTypes.node,
|
|
63
|
-
className: PropTypes.string,
|
|
64
|
-
// use only for short h1 headers, no longer than three words
|
|
65
|
-
caps: PropTypes.bool
|
|
66
|
-
};
|
|
67
|
-
return H;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const H1 = makeHeading(Levels.H1, true);
|
|
71
|
-
const H2 = makeHeading(Levels.H2);
|
|
72
|
-
const H3 = makeHeading(Levels.H3);
|
|
73
|
-
const H4 = makeHeading(Levels.H4);
|
|
74
|
-
|
|
75
|
-
export default Heading;
|
|
76
|
-
export { H1, H2, H3, H4 };
|
package/dist/http.js
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty, _ as _objectWithoutProperties, c as _objectSpread2 } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import ExtendableError from 'es6-error';
|
|
3
|
-
import { e as encodeURL, j as joinBaseURLAndPath } from './_helpers/url.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @name HTTP
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const TOKEN_TYPE = 'Bearer';
|
|
10
|
-
const STATUS_OK_IF_MORE_THAN = 200;
|
|
11
|
-
const STATUS_BAD_IF_MORE_THAN = 300;
|
|
12
|
-
const defaultFetchConfig = {
|
|
13
|
-
headers: {
|
|
14
|
-
'Content-Type': 'application/json',
|
|
15
|
-
Accept: 'application/json'
|
|
16
|
-
},
|
|
17
|
-
credentials: 'same-origin'
|
|
18
|
-
};
|
|
19
|
-
class HTTPError extends ExtendableError {
|
|
20
|
-
constructor(response, data = {}) {
|
|
21
|
-
super(`${response.status} ${response.statusText || ''}`);
|
|
22
|
-
this.data = data;
|
|
23
|
-
this.status = response.status;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
const CODE = {
|
|
28
|
-
UNAUTHORIZED: 401
|
|
29
|
-
};
|
|
30
|
-
class HTTP {
|
|
31
|
-
constructor(_auth, _baseUrl, _fetchConfig = {}) {
|
|
32
|
-
_defineProperty(this, "baseUrl", null);
|
|
33
|
-
|
|
34
|
-
_defineProperty(this, "_requestsMeta", new WeakMap());
|
|
35
|
-
|
|
36
|
-
_defineProperty(this, "setAuth", auth => {
|
|
37
|
-
this.requestToken = () => auth.requestToken();
|
|
38
|
-
|
|
39
|
-
this.shouldRefreshToken = auth.constructor.shouldRefreshToken;
|
|
40
|
-
|
|
41
|
-
this.forceTokenUpdate = () => auth.forceTokenUpdate();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
_defineProperty(this, "setBaseUrl", baseUrl => {
|
|
45
|
-
this.baseUrl = baseUrl;
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
_defineProperty(this, "fetch", async (url, params = {}) => {
|
|
49
|
-
const {
|
|
50
|
-
body,
|
|
51
|
-
query = {}
|
|
52
|
-
} = params,
|
|
53
|
-
fetchConfig = _objectWithoutProperties(params, ["body", "query"]);
|
|
54
|
-
|
|
55
|
-
const response = await this._fetch(this._makeRequestUrl(url, query), _objectSpread2(_objectSpread2({}, fetchConfig), {}, {
|
|
56
|
-
body: body ? JSON.stringify(body) : body
|
|
57
|
-
}));
|
|
58
|
-
return this._processResponse(response);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
_defineProperty(this, "request", async (url, params) => {
|
|
62
|
-
let token = await this.requestToken();
|
|
63
|
-
let response = await this._performRequest(url, token, params);
|
|
64
|
-
|
|
65
|
-
try {
|
|
66
|
-
// Wait for result to catch an HTTP error
|
|
67
|
-
return await this._processResponse(response);
|
|
68
|
-
} catch (error) {
|
|
69
|
-
if (!(error instanceof HTTPError)) {
|
|
70
|
-
throw error;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const shouldRefreshToken = error.data.error !== undefined ? this.shouldRefreshToken(error.data.error) : false;
|
|
74
|
-
|
|
75
|
-
if (shouldRefreshToken) {
|
|
76
|
-
token = await this.forceTokenUpdate();
|
|
77
|
-
response = await this._performRequest(url, token, params);
|
|
78
|
-
return this._processResponse(response);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
throw error;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
_defineProperty(this, "getMetaForResponse", response => this._requestsMeta.get(response));
|
|
86
|
-
|
|
87
|
-
_defineProperty(this, "get", (url, params) => this.request(url, _objectSpread2({
|
|
88
|
-
method: 'GET'
|
|
89
|
-
}, params)));
|
|
90
|
-
|
|
91
|
-
_defineProperty(this, "post", (url, params) => this.request(url, _objectSpread2({
|
|
92
|
-
method: 'POST'
|
|
93
|
-
}, params)));
|
|
94
|
-
|
|
95
|
-
if (_auth) {
|
|
96
|
-
this.setAuth(_auth);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
this.setBaseUrl(_baseUrl);
|
|
100
|
-
|
|
101
|
-
const {
|
|
102
|
-
headers
|
|
103
|
-
} = defaultFetchConfig,
|
|
104
|
-
defaultConfig = _objectWithoutProperties(defaultFetchConfig, ["headers"]);
|
|
105
|
-
|
|
106
|
-
this.fetchConfig = _objectSpread2(_objectSpread2(_objectSpread2({}, defaultConfig), _fetchConfig), {}, {
|
|
107
|
-
headers: _objectSpread2(_objectSpread2({}, headers), _fetchConfig.headers)
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
_fetch(...args) {
|
|
112
|
-
return fetch(...args);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
_makeRequestUrl(url, queryObject) {
|
|
116
|
-
const urlWithQuery = encodeURL(url, queryObject);
|
|
117
|
-
return joinBaseURLAndPath(this.baseUrl, urlWithQuery);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
_performRequest(url, token, params = {}) {
|
|
121
|
-
const {
|
|
122
|
-
headers,
|
|
123
|
-
body,
|
|
124
|
-
query = {},
|
|
125
|
-
sendRawBody
|
|
126
|
-
} = params,
|
|
127
|
-
fetchConfig = _objectWithoutProperties(params, ["headers", "body", "query", "sendRawBody"]);
|
|
128
|
-
|
|
129
|
-
const combinedHeaders = _objectSpread2(_objectSpread2(_objectSpread2({}, this.fetchConfig.headers), token ? {
|
|
130
|
-
Authorization: `${TOKEN_TYPE} ${token}`
|
|
131
|
-
} : {}), headers);
|
|
132
|
-
|
|
133
|
-
Object.keys(combinedHeaders).forEach(key => {
|
|
134
|
-
if (combinedHeaders[key] === null || combinedHeaders[key] === undefined) {
|
|
135
|
-
Reflect.deleteProperty(combinedHeaders, key);
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
return this._fetch(this._makeRequestUrl(url, query), _objectSpread2(_objectSpread2(_objectSpread2({}, this.fetchConfig), {}, {
|
|
139
|
-
headers: combinedHeaders
|
|
140
|
-
}, fetchConfig), {}, {
|
|
141
|
-
body: body && !sendRawBody ? JSON.stringify(body) : body
|
|
142
|
-
}));
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
_storeRequestMeta(parsedResponse, rawResponse) {
|
|
146
|
-
const {
|
|
147
|
-
headers,
|
|
148
|
-
ok,
|
|
149
|
-
redirected,
|
|
150
|
-
status,
|
|
151
|
-
statusText,
|
|
152
|
-
type,
|
|
153
|
-
url
|
|
154
|
-
} = rawResponse;
|
|
155
|
-
|
|
156
|
-
this._requestsMeta.set(parsedResponse, {
|
|
157
|
-
headers,
|
|
158
|
-
ok,
|
|
159
|
-
redirected,
|
|
160
|
-
status,
|
|
161
|
-
statusText,
|
|
162
|
-
type,
|
|
163
|
-
url
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
async _processResponse(response) {
|
|
168
|
-
const contentType = response.headers.get('content-type');
|
|
169
|
-
const isJson = contentType && contentType.indexOf('application/json') !== -1;
|
|
170
|
-
|
|
171
|
-
if (HTTP._isErrorStatus(response.status)) {
|
|
172
|
-
let resJson;
|
|
173
|
-
|
|
174
|
-
try {
|
|
175
|
-
resJson = await (isJson ? response.json() : response.text());
|
|
176
|
-
} catch (err) {// noop
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
throw new HTTPError(response, resJson);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
try {
|
|
183
|
-
const parsedResponse = await (isJson ? response.json() : {
|
|
184
|
-
data: await response.text()
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
this._storeRequestMeta(parsedResponse, response);
|
|
188
|
-
|
|
189
|
-
return parsedResponse;
|
|
190
|
-
} catch (err) {
|
|
191
|
-
return response;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
static _isErrorStatus(status) {
|
|
196
|
-
return status < STATUS_OK_IF_MORE_THAN || status >= STATUS_BAD_IF_MORE_THAN;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
async authorizedFetch(...args) {
|
|
200
|
-
const response = await this._performRequest(...args);
|
|
201
|
-
return this._processResponse(response);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export default HTTP;
|
|
207
|
-
export { CODE, HTTPError, defaultFetchConfig };
|
package/dist/hub-source.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
|
|
3
|
-
const defaultOptions = {
|
|
4
|
-
searchMax: 20,
|
|
5
|
-
searchSideThreshold: 100,
|
|
6
|
-
queryFormatter: query => `${query} or ${query}*`
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* HubSource is designed to speed up search requests for small installations.
|
|
10
|
-
* If there are less than "searchSideThreshold" items, it uses client-side filtering
|
|
11
|
-
* of cached results to greatly increase search speed. Useful for completion and
|
|
12
|
-
* select data source.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
class HubSource {
|
|
16
|
-
constructor(auth, relativeUrl, options) {
|
|
17
|
-
this.http = auth.http;
|
|
18
|
-
this.relativeUrl = relativeUrl;
|
|
19
|
-
this.options = Object.assign({}, defaultOptions, options);
|
|
20
|
-
this.storedData = null;
|
|
21
|
-
this.isClientSideSearch = null;
|
|
22
|
-
this.filterFn = null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
makeRequest(queryParams) {
|
|
26
|
-
return this.http.get(this.relativeUrl, {
|
|
27
|
-
query: queryParams
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async makeCachedRequest(params) {
|
|
32
|
-
if (this.storedData) {
|
|
33
|
-
return this.storedData;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const res = await this.makeRequest(params);
|
|
37
|
-
this.storedData = res;
|
|
38
|
-
return res;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
static mergeParams(params, toMerge) {
|
|
42
|
-
return Object.assign({}, params, toMerge);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
checkIsClientSideSearch(res) {
|
|
46
|
-
return res.total <= this.options.searchSideThreshold;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
getDefaultFilterFn(query) {
|
|
50
|
-
if (!query) {
|
|
51
|
-
return () => true;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return it => it.name.toLowerCase().indexOf(query.toLowerCase()) !== -1;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
formatQuery(query) {
|
|
58
|
-
return query ? this.options.queryFormatter(query) : '';
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
static validateInputParams(params) {
|
|
62
|
-
if (params.top) {
|
|
63
|
-
throw new Error('HubSource: params.top should not be filled, configure "options.searchMax" instead');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (params.query) {
|
|
67
|
-
throw new Error('HubSource: params.query should not be filled, configure "options.queryFormatter" instead');
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
processResults(res) {
|
|
72
|
-
const items = res[this.relativeUrl] || [];
|
|
73
|
-
|
|
74
|
-
if (this.isClientSideSearch) {
|
|
75
|
-
return items.filter(it => this.filterFn(it)).slice(0, this.options.searchMax);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return items;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
async sideDetectionRequest(params, query) {
|
|
82
|
-
const res = await this.makeCachedRequest(HubSource.mergeParams(params, {
|
|
83
|
-
$top: this.options.searchSideThreshold
|
|
84
|
-
}));
|
|
85
|
-
this.isClientSideSearch = this.checkIsClientSideSearch(res);
|
|
86
|
-
|
|
87
|
-
if (!this.isClientSideSearch) {
|
|
88
|
-
return this.doServerSideSearch(params, query);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return res;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
doClientSideSearch(params) {
|
|
95
|
-
return this.makeCachedRequest(HubSource.mergeParams(params, {
|
|
96
|
-
$top: this.constructor.TOP_ALL
|
|
97
|
-
}));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
doServerSideSearch(params, query) {
|
|
101
|
-
return this.makeRequest(HubSource.mergeParams(params, {
|
|
102
|
-
query: this.formatQuery(query),
|
|
103
|
-
$top: this.options.searchMax
|
|
104
|
-
}));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
getValueFromSuitableSource(query, params) {
|
|
108
|
-
if (this.isClientSideSearch === null) {
|
|
109
|
-
return this.sideDetectionRequest(params, query);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (this.isClientSideSearch) {
|
|
113
|
-
return this.doClientSideSearch(params);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return this.doServerSideSearch(params, query);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
async get(query, params, filterFn) {
|
|
120
|
-
HubSource.validateInputParams(params);
|
|
121
|
-
this.filterFn = filterFn || this.getDefaultFilterFn(query);
|
|
122
|
-
const res = await this.getValueFromSuitableSource(query, params);
|
|
123
|
-
return this.processResults(res);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
_defineProperty(HubSource, "TOP_ALL", -1);
|
|
129
|
-
|
|
130
|
-
export default HubSource;
|
package/dist/icon.js
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { _ as _objectWithoutProperties, a as _extends, b as _defineProperty } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { memo, PureComponent } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import deprecate from 'util-deprecate';
|
|
6
|
-
import { m as memoize } from './_helpers/memoize.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Commonly used icon colors.
|
|
10
|
-
* @enum {string}
|
|
11
|
-
*/
|
|
12
|
-
const Color = {
|
|
13
|
-
BLUE: 'blue',
|
|
14
|
-
DEFAULT: '',
|
|
15
|
-
GRAY: 'gray',
|
|
16
|
-
GREEN: 'green',
|
|
17
|
-
MAGENTA: 'magenta',
|
|
18
|
-
RED: 'red',
|
|
19
|
-
WHITE: 'white'
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* @enum {number}
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const Size = {
|
|
26
|
-
Size12: 12,
|
|
27
|
-
Size14: 14,
|
|
28
|
-
Size16: 16,
|
|
29
|
-
Size18: 18,
|
|
30
|
-
Size20: 20,
|
|
31
|
-
Size24: 24,
|
|
32
|
-
Size32: 32,
|
|
33
|
-
Size40: 40,
|
|
34
|
-
Size48: 48,
|
|
35
|
-
Size64: 64,
|
|
36
|
-
Size96: 96,
|
|
37
|
-
Size128: 128
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
var modules_29747b80 = {"unit":"8px","icon":"icon_icon__5d709605","glyph":"icon_glyph__5d709605","compatibilityMode":"icon_compatibilityMode__5d709605","gray":"icon_gray__5d709605","hover":"icon_hover__5d709605","green":"icon_green__5d709605","magenta":"icon_magenta__5d709605","red":"icon_red__5d709605","blue":"icon_blue__5d709605","white":"icon_white__5d709605","loading":"icon_loading__5d709605","icon-loading":"icon_iconLoading__5d709605"};
|
|
41
|
-
|
|
42
|
-
function convertReactSVGDOMProperty(str) {
|
|
43
|
-
return str.replace(/[-|:]([a-z])/g, g => g[1].toUpperCase());
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function serializeAttrs(map) {
|
|
47
|
-
const res = {};
|
|
48
|
-
|
|
49
|
-
for (let i = 0; i < map.length; i++) {
|
|
50
|
-
const key = map[i].name;
|
|
51
|
-
let prop = key;
|
|
52
|
-
|
|
53
|
-
if (key === 'class') {
|
|
54
|
-
prop = 'className';
|
|
55
|
-
} else if (!key.startsWith('data-')) {
|
|
56
|
-
prop = convertReactSVGDOMProperty(key);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
res[prop] = map[i].value;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return res;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function extractSVGProps(svgNode) {
|
|
66
|
-
const map = svgNode.attributes;
|
|
67
|
-
return map.length > 0 ? serializeAttrs(map) : null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const getSVGFromSource = memoize(src => {
|
|
71
|
-
const svgContainer = document.createElement('div');
|
|
72
|
-
svgContainer.innerHTML = src;
|
|
73
|
-
const svg = svgContainer.firstElementChild;
|
|
74
|
-
svg.remove ? svg.remove() : svgContainer.removeChild(svg);
|
|
75
|
-
return {
|
|
76
|
-
props: extractSVGProps(svg),
|
|
77
|
-
html: svg.innerHTML
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
function isCompatibilityMode(iconSrc) {
|
|
82
|
-
const hasWidth = /width="[\d\.]+"/ig.test(iconSrc);
|
|
83
|
-
const hasHeight = /height="[\d\.]+"/ig.test(iconSrc);
|
|
84
|
-
return !hasWidth || !hasHeight;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function IconSVG(_ref) {
|
|
88
|
-
let {
|
|
89
|
-
src,
|
|
90
|
-
className
|
|
91
|
-
} = _ref,
|
|
92
|
-
rest = _objectWithoutProperties(_ref, ["src", "className"]);
|
|
93
|
-
|
|
94
|
-
const glyphClasses = classNames(modules_29747b80.glyph, {
|
|
95
|
-
[modules_29747b80.compatibilityMode]: isCompatibilityMode(src)
|
|
96
|
-
}, className);
|
|
97
|
-
const {
|
|
98
|
-
props,
|
|
99
|
-
html
|
|
100
|
-
} = getSVGFromSource(src);
|
|
101
|
-
return /*#__PURE__*/React.createElement("svg", _extends({}, props, rest, {
|
|
102
|
-
className: glyphClasses,
|
|
103
|
-
dangerouslySetInnerHTML: {
|
|
104
|
-
__html: html
|
|
105
|
-
}
|
|
106
|
-
}));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
IconSVG.propTypes = {
|
|
110
|
-
className: PropTypes.string,
|
|
111
|
-
src: PropTypes.string.isRequired,
|
|
112
|
-
style: PropTypes.object
|
|
113
|
-
};
|
|
114
|
-
var IconSVG$1 = /*#__PURE__*/memo(IconSVG);
|
|
115
|
-
|
|
116
|
-
const warnSize = deprecate(() => {}, `\`size\`, \`width\` and \`height\` props are not recommended to use in Ring UI \`Icon\` component. The intrinsic sizes of SVG icon (\`width\` and \`height\` SVG attributes) are used instead.
|
|
117
|
-
|
|
118
|
-
We strongly recommend to use icons handcrafted for particular sizes. If your icon doesn't exist in the desired size, please ask your designer to draw one. "Responsive" checkmark should be unchecked when exporting icon.'`);
|
|
119
|
-
class Icon extends PureComponent {
|
|
120
|
-
warnSize() {
|
|
121
|
-
if (this.props.suppressSizeWarning) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
warnSize();
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
getStyle() {
|
|
129
|
-
const {
|
|
130
|
-
size,
|
|
131
|
-
width,
|
|
132
|
-
height
|
|
133
|
-
} = this.props;
|
|
134
|
-
|
|
135
|
-
if (width || height) {
|
|
136
|
-
this.warnSize();
|
|
137
|
-
return {
|
|
138
|
-
width,
|
|
139
|
-
height
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (size) {
|
|
144
|
-
this.warnSize();
|
|
145
|
-
return {
|
|
146
|
-
width: size,
|
|
147
|
-
height: size
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
render() {
|
|
155
|
-
const _this$props = this.props,
|
|
156
|
-
{
|
|
157
|
-
className,
|
|
158
|
-
size,
|
|
159
|
-
color,
|
|
160
|
-
loading,
|
|
161
|
-
glyph: Glyph,
|
|
162
|
-
width,
|
|
163
|
-
height,
|
|
164
|
-
suppressSizeWarning
|
|
165
|
-
} = _this$props,
|
|
166
|
-
restProps = _objectWithoutProperties(_this$props, ["className", "size", "color", "loading", "glyph", "width", "height", "suppressSizeWarning"]);
|
|
167
|
-
|
|
168
|
-
if (!Glyph) {
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const classes = classNames(modules_29747b80.icon, {
|
|
173
|
-
[modules_29747b80[color]]: !!color,
|
|
174
|
-
[modules_29747b80.loading]: loading
|
|
175
|
-
}, className);
|
|
176
|
-
return /*#__PURE__*/React.createElement("span", _extends({}, restProps, {
|
|
177
|
-
className: classes
|
|
178
|
-
}), typeof Glyph === 'string' ? /*#__PURE__*/React.createElement(IconSVG$1, {
|
|
179
|
-
src: Glyph,
|
|
180
|
-
style: this.getStyle()
|
|
181
|
-
}) : /*#__PURE__*/React.createElement(Glyph, {
|
|
182
|
-
className: modules_29747b80.glyph,
|
|
183
|
-
style: this.getStyle()
|
|
184
|
-
}));
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
_defineProperty(Icon, "propTypes", {
|
|
190
|
-
className: PropTypes.string,
|
|
191
|
-
color: PropTypes.string,
|
|
192
|
-
glyph: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]).isRequired,
|
|
193
|
-
height: PropTypes.number,
|
|
194
|
-
size: PropTypes.number,
|
|
195
|
-
width: PropTypes.number,
|
|
196
|
-
loading: PropTypes.bool,
|
|
197
|
-
suppressSizeWarning: PropTypes.bool
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
_defineProperty(Icon, "defaultProps", {
|
|
201
|
-
className: '',
|
|
202
|
-
color: Color.DEFAULT,
|
|
203
|
-
glyph: ''
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
_defineProperty(Icon, "Color", Color);
|
|
207
|
-
|
|
208
|
-
_defineProperty(Icon, "Size", Size);
|
|
209
|
-
|
|
210
|
-
export default Icon;
|
|
211
|
-
export { Size };
|