@jetbrains/ring-ui 6.0.33 → 6.0.35
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.
|
@@ -33,12 +33,11 @@ export default class HTTP implements Partial<HTTPAuth> {
|
|
|
33
33
|
constructor(auth?: HTTPAuth, baseUrl?: string | null | undefined, fetchConfig?: RequestInit);
|
|
34
34
|
setAuth: (auth: HTTPAuth) => void;
|
|
35
35
|
setBaseUrl: (baseUrl: string | null | undefined) => void;
|
|
36
|
-
_fetch(...args: Parameters<typeof fetch>): Promise<Response
|
|
36
|
+
_fetch(...args: Parameters<typeof fetch>): Promise<Response>;
|
|
37
37
|
private _makeRequestUrl;
|
|
38
38
|
private _performRequest;
|
|
39
39
|
private _storeRequestMeta;
|
|
40
40
|
private _processResponse;
|
|
41
|
-
private static _isErrorStatus;
|
|
42
41
|
fetch: <T = unknown>(url: string, params?: FetchParams) => Promise<T>;
|
|
43
42
|
authorizedFetch(...args: Parameters<HTTP['_performRequest']>): Promise<any>;
|
|
44
43
|
request: <T = unknown>(url: string, params?: RequestParams) => Promise<T>;
|
package/components/http/http.js
CHANGED
|
@@ -4,8 +4,6 @@ import { encodeURL, joinBaseURLAndPath } from '../global/url';
|
|
|
4
4
|
* @name HTTP
|
|
5
5
|
*/
|
|
6
6
|
const TOKEN_TYPE = 'Bearer';
|
|
7
|
-
const STATUS_OK_IF_MORE_THAN = 200;
|
|
8
|
-
const STATUS_BAD_IF_MORE_THAN = 300;
|
|
9
7
|
export const defaultFetchConfig = {
|
|
10
8
|
headers: {
|
|
11
9
|
'Content-Type': 'application/json',
|
|
@@ -99,12 +97,12 @@ export default class HTTP {
|
|
|
99
97
|
set(parsedResponse, { headers, ok, redirected, status, statusText, type, url });
|
|
100
98
|
}
|
|
101
99
|
async _processResponse(response) {
|
|
102
|
-
const contentType = response.headers
|
|
100
|
+
const contentType = response.headers.get('content-type');
|
|
103
101
|
const isJson = contentType && contentType.indexOf('application/json') !== -1;
|
|
104
|
-
if (response.
|
|
102
|
+
if (!response.ok) {
|
|
105
103
|
let resJson;
|
|
106
104
|
try {
|
|
107
|
-
resJson = await (isJson ? response.json
|
|
105
|
+
resJson = await (isJson ? response.json() : response.text());
|
|
108
106
|
}
|
|
109
107
|
catch (err) {
|
|
110
108
|
// noop
|
|
@@ -112,7 +110,7 @@ export default class HTTP {
|
|
|
112
110
|
throw new HTTPError(response, resJson);
|
|
113
111
|
}
|
|
114
112
|
try {
|
|
115
|
-
const parsedResponse = await (isJson ? response.json
|
|
113
|
+
const parsedResponse = await (isJson ? response.json() : { data: await response.text() });
|
|
116
114
|
this._storeRequestMeta(parsedResponse, response);
|
|
117
115
|
return parsedResponse;
|
|
118
116
|
}
|
|
@@ -120,9 +118,6 @@ export default class HTTP {
|
|
|
120
118
|
return response;
|
|
121
119
|
}
|
|
122
120
|
}
|
|
123
|
-
static _isErrorStatus(status) {
|
|
124
|
-
return status < STATUS_OK_IF_MORE_THAN || status >= STATUS_BAD_IF_MORE_THAN;
|
|
125
|
-
}
|
|
126
121
|
fetch = async (url, params = {}) => {
|
|
127
122
|
const { body, query = {}, ...fetchConfig } = params;
|
|
128
123
|
const response = await this._fetch(this._makeRequestUrl(url, query), {
|
|
@@ -8,11 +8,7 @@ export default class HTTPMock extends HTTP {
|
|
|
8
8
|
requests: HTTPMockRequest[];
|
|
9
9
|
responsesByUrlMap: Map<string | RegExp, unknown>;
|
|
10
10
|
constructor();
|
|
11
|
-
_fetch(url: string, params: RequestInit):
|
|
12
|
-
status: number;
|
|
13
|
-
headers: Headers;
|
|
14
|
-
json: () => Promise<unknown>;
|
|
15
|
-
};
|
|
11
|
+
_fetch(url: string, params: RequestInit): Promise<Response>;
|
|
16
12
|
respondDefault(response: unknown): void;
|
|
17
13
|
respondForUrl(url: string | RegExp, response: unknown): void;
|
|
18
14
|
_getResponseForUrl(urlToMatch: string): unknown;
|
|
@@ -22,11 +22,12 @@ export default class HTTPMock extends HTTP {
|
|
|
22
22
|
body: typeof params.body === 'string' ? JSON.parse(params.body) : params.body
|
|
23
23
|
}
|
|
24
24
|
}];
|
|
25
|
-
return {
|
|
25
|
+
return Promise.resolve({
|
|
26
26
|
status: 200,
|
|
27
|
+
ok: true,
|
|
27
28
|
headers: new Headers({ 'content-type': 'application/json' }),
|
|
28
29
|
json: () => Promise.resolve((this._getResponseForUrl(url) || this.defaultResponse))
|
|
29
|
-
};
|
|
30
|
+
});
|
|
30
31
|
}
|
|
31
32
|
respondDefault(response) {
|
|
32
33
|
this.defaultResponse = response;
|
|
@@ -101,7 +101,6 @@ export class Input extends PureComponent {
|
|
|
101
101
|
[styles.active]: active,
|
|
102
102
|
[styles.error]: error != null,
|
|
103
103
|
[styles.empty]: empty,
|
|
104
|
-
[styles.noLabel]: !this.props.label,
|
|
105
104
|
[styles.withIcon]: icon != null,
|
|
106
105
|
[styles.clearable]: clearable,
|
|
107
106
|
[styles.borderless]: borderless
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetbrains/ring-ui",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.35",
|
|
4
4
|
"description": "JetBrains UI library",
|
|
5
5
|
"author": "JetBrains",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -76,28 +76,30 @@
|
|
|
76
76
|
},
|
|
77
77
|
"readmeFilename": "README.md",
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@babel/cli": "^7.24.
|
|
80
|
-
"@babel/eslint-parser": "^7.24.
|
|
79
|
+
"@babel/cli": "^7.24.7",
|
|
80
|
+
"@babel/eslint-parser": "^7.24.7",
|
|
81
81
|
"@csstools/css-parser-algorithms": "^2.6.1",
|
|
82
82
|
"@csstools/stylelint-no-at-nest-rule": "^2.0.0",
|
|
83
83
|
"@jetbrains/eslint-config": "^5.4.2",
|
|
84
|
+
"@jetbrains/logos": "3.0.0-canary.734b213.0",
|
|
84
85
|
"@jetbrains/stylelint-config": "^4.0.2",
|
|
85
86
|
"@primer/octicons": "^19.9.0",
|
|
86
87
|
"@rollup/plugin-babel": "^6.0.4",
|
|
87
88
|
"@rollup/plugin-json": "^6.1.0",
|
|
88
89
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
89
|
-
"@rollup/plugin-replace": "^5.0.
|
|
90
|
-
"@storybook/addon-a11y": "8.1.
|
|
91
|
-
"@storybook/addon-docs": "8.1.
|
|
92
|
-
"@storybook/addon-essentials": "8.1.
|
|
93
|
-
"@storybook/components": "8.1.
|
|
94
|
-
"@storybook/manager-api": "8.1.
|
|
95
|
-
"@storybook/preview-api": "8.1.
|
|
96
|
-
"@storybook/react": "8.1.
|
|
97
|
-
"@storybook/react-webpack5": "8.1.
|
|
98
|
-
"@storybook/test-runner": "^0.18.
|
|
99
|
-
"@storybook/theming": "8.1.
|
|
100
|
-
"@testing-library/
|
|
90
|
+
"@rollup/plugin-replace": "^5.0.7",
|
|
91
|
+
"@storybook/addon-a11y": "8.1.6",
|
|
92
|
+
"@storybook/addon-docs": "8.1.6",
|
|
93
|
+
"@storybook/addon-essentials": "8.1.6",
|
|
94
|
+
"@storybook/components": "8.1.6",
|
|
95
|
+
"@storybook/manager-api": "8.1.6",
|
|
96
|
+
"@storybook/preview-api": "8.1.6",
|
|
97
|
+
"@storybook/react": "8.1.6",
|
|
98
|
+
"@storybook/react-webpack5": "8.1.6",
|
|
99
|
+
"@storybook/test-runner": "^0.18.2",
|
|
100
|
+
"@storybook/theming": "8.1.6",
|
|
101
|
+
"@testing-library/dom": "^10.1.0",
|
|
102
|
+
"@testing-library/react": "^16.0.0",
|
|
101
103
|
"@testing-library/user-event": "^14.5.2",
|
|
102
104
|
"@types/chai": "^4.3.16",
|
|
103
105
|
"@types/chai-as-promised": "^7.1.8",
|
|
@@ -109,14 +111,14 @@
|
|
|
109
111
|
"@types/react-dom": "^18.3.0",
|
|
110
112
|
"@types/sinon": "^17.0.3",
|
|
111
113
|
"@types/sinon-chai": "^3.2.12",
|
|
112
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
113
|
-
"@typescript-eslint/parser": "^7.
|
|
114
|
+
"@typescript-eslint/eslint-plugin": "^7.12.0",
|
|
115
|
+
"@typescript-eslint/parser": "^7.12.0",
|
|
114
116
|
"@vitejs/plugin-react": "^4.3.0",
|
|
115
117
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
|
|
116
118
|
"acorn": "^8.11.3",
|
|
117
119
|
"axe-playwright": "^2.0.1",
|
|
118
120
|
"babel-plugin-require-context-hook": "^1.0.0",
|
|
119
|
-
"caniuse-lite": "^1.0.
|
|
121
|
+
"caniuse-lite": "^1.0.30001629",
|
|
120
122
|
"chai": "^5.1.1",
|
|
121
123
|
"chai-as-promised": "^7.1.2",
|
|
122
124
|
"chai-dom": "^1.10.0",
|
|
@@ -145,7 +147,7 @@
|
|
|
145
147
|
"markdown-it": "^14.1.0",
|
|
146
148
|
"merge-options": "^3.0.4",
|
|
147
149
|
"pinst": "^3.0.0",
|
|
148
|
-
"prettier": "^3.
|
|
150
|
+
"prettier": "^3.3.1",
|
|
149
151
|
"raw-loader": "^4.0.2",
|
|
150
152
|
"react": "^18.3.1",
|
|
151
153
|
"react-dom": "^18.3.1",
|
|
@@ -158,9 +160,9 @@
|
|
|
158
160
|
"sinon": "^18.0.0",
|
|
159
161
|
"sinon-chai": "^3.7.0",
|
|
160
162
|
"storage-mock": "^2.1.0",
|
|
161
|
-
"storybook": "8.1.
|
|
163
|
+
"storybook": "8.1.6",
|
|
162
164
|
"storybook-addon-themes": "^6.1.0",
|
|
163
|
-
"stylelint": "^16.6.
|
|
165
|
+
"stylelint": "^16.6.1",
|
|
164
166
|
"svg-inline-loader": "^0.8.2",
|
|
165
167
|
"teamcity-service-messages": "^0.1.14",
|
|
166
168
|
"terser-webpack-plugin": "^5.3.10",
|
|
@@ -192,11 +194,10 @@
|
|
|
192
194
|
}
|
|
193
195
|
},
|
|
194
196
|
"dependencies": {
|
|
195
|
-
"@babel/core": "^7.24.
|
|
196
|
-
"@babel/preset-typescript": "^7.24.
|
|
197
|
+
"@babel/core": "^7.24.7",
|
|
198
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
197
199
|
"@jetbrains/babel-preset-jetbrains": "^2.3.2",
|
|
198
200
|
"@jetbrains/icons": "^4.2.0",
|
|
199
|
-
"@jetbrains/logos": "^3.0.0-canary.734b213.0",
|
|
200
201
|
"@jetbrains/postcss-require-hover": "^0.1.2",
|
|
201
202
|
"@types/combokeys": "^2.4.9",
|
|
202
203
|
"@types/deep-equal": "^1.0.4",
|