@jetbrains/ring-ui 7.0.0-beta.1 → 7.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/alert/alert.d.ts +7 -24
- package/components/alert/alert.js +0 -24
- package/components/alert/container.d.ts +0 -5
- package/components/alert/container.js +0 -5
- package/components/alert-service/alert-service.js +2 -2
- package/components/auth/auth__core.d.ts +4 -4
- package/components/auth/auth__core.js +28 -16
- package/components/auth/down-notification.js +0 -9
- package/components/auth/storage.js +1 -2
- package/components/auth-dialog/auth-dialog.d.ts +0 -18
- package/components/auth-dialog/auth-dialog.js +0 -18
- package/components/avatar/avatar.d.ts +0 -13
- package/components/avatar/avatar.js +0 -13
- package/components/avatar/fallback-avatar.d.ts +1 -10
- package/components/avatar/fallback-avatar.js +0 -6
- package/components/badge/badge.d.ts +0 -10
- package/components/badge/badge.js +0 -10
- package/components/breadcrumbs/breadcrumbs.css +1 -0
- package/components/button/button.css +156 -184
- package/components/button/button.d.ts +0 -21
- package/components/button/button.js +16 -32
- package/components/button/button__classes.d.ts +1 -1
- package/components/button/button__classes.js +10 -8
- package/components/button-group/button-group.d.ts +0 -5
- package/components/button-group/button-group.js +0 -5
- package/components/button-group/caption.d.ts +0 -4
- package/components/button-group/caption.js +0 -4
- package/components/button-set/button-set.d.ts +0 -6
- package/components/button-set/button-set.js +0 -6
- package/components/button-toolbar/button-toolbar.d.ts +0 -6
- package/components/button-toolbar/button-toolbar.js +0 -6
- package/components/checkbox/checkbox.d.ts +0 -19
- package/components/checkbox/checkbox.js +0 -21
- package/components/code/code.d.ts +0 -12
- package/components/code/code.js +0 -13
- package/components/confirm/confirm.d.ts +0 -14
- package/components/confirm/confirm.js +0 -14
- package/components/content-layout/content-layout.d.ts +0 -7
- package/components/content-layout/content-layout.js +0 -7
- package/components/content-layout/sidebar.d.ts +0 -9
- package/components/content-layout/sidebar.js +0 -9
- package/components/contenteditable/contenteditable.d.ts +1 -22
- package/components/contenteditable/contenteditable.js +0 -17
- package/components/control-label/control-label.js +0 -6
- package/components/data-list/data-list.css +1 -0
- package/components/data-list/data-list.d.ts +0 -2
- package/components/data-list/data-list.js +0 -23
- package/components/data-list/item.js +0 -25
- package/components/data-list/title.d.ts +2 -2
- package/components/data-list/title.js +0 -18
- package/components/date-picker/consts.d.ts +0 -2
- package/components/date-picker/consts.js +0 -6
- package/components/date-picker/date-input.d.ts +0 -20
- package/components/date-picker/date-input.js +0 -21
- package/components/date-picker/date-picker.d.ts +0 -29
- package/components/date-picker/date-picker.js +1 -39
- package/components/date-picker/date-popup.d.ts +0 -22
- package/components/date-picker/date-popup.js +1 -23
- package/components/date-picker/day.d.ts +0 -14
- package/components/date-picker/day.js +1 -15
- package/components/date-picker/month-names.d.ts +1 -11
- package/components/date-picker/month-names.js +1 -13
- package/components/date-picker/month-slider.d.ts +0 -9
- package/components/date-picker/month-slider.js +1 -10
- package/components/date-picker/month.d.ts +1 -9
- package/components/date-picker/month.js +1 -6
- package/components/date-picker/months.d.ts +1 -9
- package/components/date-picker/months.js +1 -6
- package/components/date-picker/weekdays.d.ts +2 -8
- package/components/date-picker/weekdays.js +0 -4
- package/components/date-picker/years.d.ts +0 -6
- package/components/date-picker/years.js +1 -7
- package/components/dialog/dialog.css +2 -2
- package/components/dialog/dialog.d.ts +0 -20
- package/components/dialog/dialog.js +7 -28
- package/components/dropdown/anchor.d.ts +1 -8
- package/components/dropdown/anchor.js +0 -5
- package/components/dropdown/dropdown.css +2 -4
- package/components/dropdown/dropdown.d.ts +4 -22
- package/components/dropdown/dropdown.js +0 -22
- package/components/dropdown-menu/dropdown-menu.js +0 -18
- package/components/error-bubble/error-bubble.d.ts +0 -6
- package/components/error-bubble/error-bubble.js +1 -7
- package/components/error-message/error-message.d.ts +0 -10
- package/components/error-message/error-message.js +0 -10
- package/components/footer/footer.js +0 -19
- package/components/global/composeRefs.d.ts +0 -3
- package/components/global/composeRefs.js +0 -3
- package/components/global/create-stateful-context.d.ts +0 -4
- package/components/global/create-stateful-context.js +0 -4
- package/components/global/focus-sensor-hoc.js +0 -17
- package/components/global/react-dom-renderer.d.ts +0 -5
- package/components/global/react-dom-renderer.js +0 -5
- package/components/global/rerender-hoc.d.ts +2 -2
- package/components/global/theme.d.ts +8 -2
- package/components/global/theme.js +20 -11
- package/components/global/variables.css +2 -0
- package/components/global/variables_dark.css +2 -0
- package/components/grid/col.d.ts +0 -14
- package/components/grid/col.js +1 -16
- package/components/grid/grid.d.ts +0 -5
- package/components/grid/grid.js +1 -6
- package/components/grid/row.d.ts +0 -18
- package/components/grid/row.js +1 -19
- package/components/group/group.d.ts +0 -5
- package/components/group/group.js +1 -6
- package/components/header/header-icon.d.ts +0 -22
- package/components/header/header-icon.js +0 -6
- package/components/header/header.css +2 -14
- package/components/header/header.d.ts +0 -7
- package/components/header/header.js +0 -7
- package/components/header/links.d.ts +2 -0
- package/components/header/links.js +7 -0
- package/components/header/logo.d.ts +0 -4
- package/components/header/logo.js +0 -4
- package/components/header/profile.d.ts +1 -39
- package/components/header/profile.js +1 -43
- package/components/header/services-link.d.ts +0 -10
- package/components/header/services-link.js +0 -10
- package/components/header/services.d.ts +0 -14
- package/components/header/services.js +0 -12
- package/components/header/smart-profile.d.ts +0 -9
- package/components/header/smart-profile.js +3 -11
- package/components/header/smart-services.d.ts +0 -4
- package/components/header/smart-services.js +0 -5
- package/components/header/tray.d.ts +0 -5
- package/components/header/tray.js +0 -5
- package/components/heading/heading.js +0 -6
- package/components/icon/icon.d.ts +0 -11
- package/components/icon/icon.js +0 -11
- package/components/icon/icon__svg.d.ts +0 -8
- package/components/icon/icon__svg.js +6 -7
- package/components/input/input.js +1 -29
- package/components/island/adaptive-island-hoc.d.ts +0 -1
- package/components/island/adaptive-island-hoc.js +0 -1
- package/components/island/content.d.ts +0 -10
- package/components/island/content.js +0 -10
- package/components/island/header.js +0 -8
- package/components/island/island.d.ts +0 -9
- package/components/island/island.js +0 -8
- package/components/island-legacy/content-legacy.d.ts +0 -5
- package/components/island-legacy/content-legacy.js +0 -5
- package/components/island-legacy/header-legacy.d.ts +0 -5
- package/components/island-legacy/header-legacy.js +0 -5
- package/components/island-legacy/island-legacy.d.ts +0 -5
- package/components/island-legacy/island-legacy.js +0 -5
- package/components/link/clickableLink.d.ts +0 -9
- package/components/link/clickableLink.js +0 -9
- package/components/link/link.d.ts +0 -25
- package/components/link/link.js +0 -13
- package/components/list/list.d.ts +0 -32
- package/components/list/list.js +1 -30
- package/components/list/list__custom.js +0 -21
- package/components/list/list__hint.d.ts +0 -4
- package/components/list/list__hint.js +0 -4
- package/components/list/list__item.js +0 -44
- package/components/list/list__link.js +1 -21
- package/components/list/list__separator.js +0 -9
- package/components/list/list__title.js +0 -13
- package/components/loader/loader.d.ts +0 -10
- package/components/loader/loader.js +0 -10
- package/components/loader-inline/loader-inline.d.ts +0 -6
- package/components/loader-inline/loader-inline.js +0 -6
- package/components/loader-screen/loader-screen.d.ts +0 -6
- package/components/loader-screen/loader-screen.js +0 -6
- package/components/login-dialog/login-dialog.d.ts +0 -11
- package/components/login-dialog/login-dialog.js +0 -11
- package/components/login-dialog/service.js +4 -1
- package/components/markdown/markdown.js +0 -5
- package/components/message/message.css +2 -2
- package/components/message/message.js +1 -17
- package/components/pager/pager.css +9 -0
- package/components/pager/pager.js +14 -32
- package/components/panel/panel.d.ts +0 -5
- package/components/panel/panel.js +0 -5
- package/components/popup/popup.js +0 -38
- package/components/popup/popup.target.js +0 -5
- package/components/popup-menu/popup-menu.js +0 -8
- package/components/progress-bar/progress-bar.css +4 -4
- package/components/progress-bar/progress-bar.d.ts +19 -33
- package/components/progress-bar/progress-bar.js +0 -33
- package/components/query-assist/query-assist.d.ts +63 -93
- package/components/query-assist/query-assist.js +2 -95
- package/components/radio/radio.d.ts +0 -8
- package/components/radio/radio.js +0 -12
- package/components/radio/radio__item.d.ts +0 -9
- package/components/radio/radio__item.js +0 -10
- package/components/scrollable-section/scrollable-section.css +31 -0
- package/components/{header → scrollable-section}/scrollable-section.js +11 -6
- package/components/select/select.css +13 -5
- package/components/select/select.d.ts +3 -0
- package/components/select/select.js +29 -84
- package/components/select/select__filter.js +6 -9
- package/components/select/select__popup.js +0 -54
- package/components/shortcuts/core.js +3 -3
- package/components/shortcuts/shortcuts-hoc.d.ts +0 -5
- package/components/shortcuts/shortcuts-hoc.js +0 -5
- package/components/shortcuts/shortcuts.d.ts +0 -8
- package/components/shortcuts/shortcuts.js +0 -8
- package/components/storage/storage.d.ts +2 -3
- package/components/storage/storage.js +1 -21
- package/components/tab-trap/tab-trap.js +0 -8
- package/components/table/cell.d.ts +0 -6
- package/components/table/cell.js +0 -6
- package/components/table/disable-hover-hoc.d.ts +0 -1
- package/components/table/disable-hover-hoc.js +0 -1
- package/components/table/header-cell.d.ts +0 -10
- package/components/table/header-cell.js +0 -10
- package/components/table/header.d.ts +1 -23
- package/components/table/header.js +0 -15
- package/components/table/multitable.d.ts +0 -4
- package/components/table/multitable.js +0 -4
- package/components/table/row-with-focus-sensor.d.ts +2 -2
- package/components/table/row-with-focus-sensor.js +0 -2
- package/components/table/row.js +0 -34
- package/components/table/selection-shortcuts-hoc.js +0 -16
- package/components/table/simple-table.d.ts +0 -44
- package/components/table/simple-table.js +0 -4
- package/components/table/smart-table.d.ts +0 -48
- package/components/table/smart-table.js +0 -7
- package/components/table/table.d.ts +0 -2
- package/components/table/table.js +1 -50
- package/components/tabs/collapsible-more.d.ts +1 -9
- package/components/tabs/collapsible-more.js +0 -23
- package/components/tabs/collapsible-tab.js +0 -8
- package/components/tabs/collapsible-tabs.d.ts +2 -29
- package/components/tabs/collapsible-tabs.js +0 -12
- package/components/tabs/custom-item.d.ts +1 -7
- package/components/tabs/custom-item.js +0 -4
- package/components/tabs/dumb-tabs.d.ts +0 -11
- package/components/tabs/dumb-tabs.js +0 -11
- package/components/tabs/smart-tabs.d.ts +0 -6
- package/components/tabs/smart-tabs.js +0 -6
- package/components/tabs/tab-link.d.ts +0 -8
- package/components/tabs/tab-link.js +0 -6
- package/components/tabs/tab.d.ts +0 -8
- package/components/tabs/tab.js +0 -8
- package/components/tabs/tabs.css +4 -4
- package/components/tag/tag.css +3 -48
- package/components/tag/tag.d.ts +0 -19
- package/components/tag/tag.js +0 -24
- package/components/tags-input/tags-input.d.ts +7 -33
- package/components/tags-input/tags-input.js +1 -31
- package/components/tags-list/tags-list.d.ts +0 -13
- package/components/tags-list/tags-list.js +0 -13
- package/components/text/text.d.ts +0 -7
- package/components/text/text.js +0 -7
- package/components/toggle/toggle.d.ts +0 -15
- package/components/toggle/toggle.js +1 -16
- package/components/tooltip/tooltip.d.ts +4 -10
- package/components/tooltip/tooltip.js +7 -12
- package/components/user-agreement/service.d.ts +2 -1
- package/components/user-agreement/user-agreement.d.ts +0 -18
- package/components/user-agreement/user-agreement.js +0 -18
- package/components/user-card/card.d.ts +0 -35
- package/components/user-card/card.js +0 -28
- package/components/user-card/smart-user-card-tooltip.d.ts +0 -5
- package/components/user-card/smart-user-card-tooltip.js +0 -5
- package/components/user-card/tooltip.d.ts +0 -9
- package/components/user-card/tooltip.js +0 -9
- package/package.json +56 -59
- package/components/global/prop-types.d.ts +0 -4
- package/components/global/prop-types.js +0 -4
- package/components/global/react-render-adapter.d.ts +0 -1
- package/components/global/react-render-adapter.js +0 -3
- package/components/header/tray-icon.d.ts +0 -1
- package/components/header/tray-icon.js +0 -2
- package/components/palette/palette.css +0 -220
- package/components/storage/storage__fallback.d.ts +0 -79
- package/components/storage/storage__fallback.js +0 -181
- /package/components/{header → scrollable-section}/scrollable-section.d.ts +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PureComponent, ReactNode } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import Theme from '../global/theme';
|
|
5
4
|
export declare const ANIMATION_TIME = 500;
|
|
6
5
|
/**
|
|
@@ -20,10 +19,17 @@ export declare enum AlertType {
|
|
|
20
19
|
export interface AlertProps {
|
|
21
20
|
theme: Theme;
|
|
22
21
|
timeout: number;
|
|
22
|
+
/**
|
|
23
|
+
* Fires when alert starts closing if timeout is out or user clicks "Close" button
|
|
24
|
+
*/
|
|
23
25
|
onCloseRequest: ((event?: React.MouseEvent<HTMLElement>) => void);
|
|
24
26
|
onClose: (() => void);
|
|
25
27
|
isShaking: boolean;
|
|
26
28
|
isClosing: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether an alert is rendered inside an **Alerts** container
|
|
31
|
+
* or standalone.
|
|
32
|
+
*/
|
|
27
33
|
inline: boolean;
|
|
28
34
|
showWithAnimation: boolean;
|
|
29
35
|
closeable: boolean;
|
|
@@ -46,29 +52,6 @@ interface State {
|
|
|
46
52
|
* **Alert** is a component for displaying contextual notifications. If you want to display a stack of notifications, use **Alerts** instead.
|
|
47
53
|
*/
|
|
48
54
|
export default class Alert extends PureComponent<AlertProps, State> {
|
|
49
|
-
static propTypes: {
|
|
50
|
-
timeout: PropTypes.Requireable<number>;
|
|
51
|
-
/**
|
|
52
|
-
* Fires when alert starts closing if timeout is out or user clicks "Close" button
|
|
53
|
-
*/
|
|
54
|
-
onCloseRequest: PropTypes.Requireable<(...args: any[]) => any>;
|
|
55
|
-
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
56
|
-
isShaking: PropTypes.Requireable<boolean>;
|
|
57
|
-
isClosing: PropTypes.Requireable<boolean>;
|
|
58
|
-
/**
|
|
59
|
-
* Whether an alert is rendered inside an **Alerts** container
|
|
60
|
-
* or standalone.
|
|
61
|
-
*/
|
|
62
|
-
inline: PropTypes.Requireable<boolean>;
|
|
63
|
-
showWithAnimation: PropTypes.Requireable<boolean>;
|
|
64
|
-
closeable: PropTypes.Requireable<boolean>;
|
|
65
|
-
type: PropTypes.Requireable<AlertType>;
|
|
66
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
67
|
-
className: PropTypes.Requireable<string>;
|
|
68
|
-
captionClassName: PropTypes.Requireable<string>;
|
|
69
|
-
closeButtonClassName: PropTypes.Requireable<string>;
|
|
70
|
-
'data-test': PropTypes.Requireable<string>;
|
|
71
|
-
};
|
|
72
55
|
/** @override */
|
|
73
56
|
static defaultProps: {
|
|
74
57
|
theme: Theme;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
4
|
import exceptionIcon from '@jetbrains/icons/exception';
|
|
6
5
|
import checkmarkIcon from '@jetbrains/icons/checkmark';
|
|
7
6
|
import warningIcon from '@jetbrains/icons/warning';
|
|
@@ -56,29 +55,6 @@ const TypeToIconColor = {
|
|
|
56
55
|
* **Alert** is a component for displaying contextual notifications. If you want to display a stack of notifications, use **Alerts** instead.
|
|
57
56
|
*/
|
|
58
57
|
export default class Alert extends PureComponent {
|
|
59
|
-
static propTypes = {
|
|
60
|
-
timeout: PropTypes.number,
|
|
61
|
-
/**
|
|
62
|
-
* Fires when alert starts closing if timeout is out or user clicks "Close" button
|
|
63
|
-
*/
|
|
64
|
-
onCloseRequest: PropTypes.func,
|
|
65
|
-
onClose: PropTypes.func,
|
|
66
|
-
isShaking: PropTypes.bool,
|
|
67
|
-
isClosing: PropTypes.bool,
|
|
68
|
-
/**
|
|
69
|
-
* Whether an alert is rendered inside an **Alerts** container
|
|
70
|
-
* or standalone.
|
|
71
|
-
*/
|
|
72
|
-
inline: PropTypes.bool,
|
|
73
|
-
showWithAnimation: PropTypes.bool,
|
|
74
|
-
closeable: PropTypes.bool,
|
|
75
|
-
type: PropTypes.oneOf(Object.values(AlertType)),
|
|
76
|
-
children: PropTypes.node,
|
|
77
|
-
className: PropTypes.string,
|
|
78
|
-
captionClassName: PropTypes.string,
|
|
79
|
-
closeButtonClassName: PropTypes.string,
|
|
80
|
-
'data-test': PropTypes.string
|
|
81
|
-
};
|
|
82
58
|
/** @override */
|
|
83
59
|
static defaultProps = {
|
|
84
60
|
theme: Theme.DARK,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PureComponent, HTMLAttributes } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
/**
|
|
4
3
|
* @name Alert Container
|
|
5
4
|
* @description Displays a stack of alerts on top of the page.
|
|
@@ -7,9 +6,5 @@ import PropTypes from 'prop-types';
|
|
|
7
6
|
*/
|
|
8
7
|
export type AlertContainerProps = HTMLAttributes<HTMLDivElement>;
|
|
9
8
|
export default class Alerts extends PureComponent<AlertContainerProps> {
|
|
10
|
-
static propTypes: {
|
|
11
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
12
|
-
className: PropTypes.Requireable<string>;
|
|
13
|
-
};
|
|
14
9
|
render(): import("react").ReactPortal | null;
|
|
15
10
|
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { Children, cloneElement, PureComponent, isValidElement } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
4
|
import styles from './container.css';
|
|
6
5
|
export default class Alerts extends PureComponent {
|
|
7
|
-
static propTypes = {
|
|
8
|
-
children: PropTypes.node,
|
|
9
|
-
className: PropTypes.string
|
|
10
|
-
};
|
|
11
6
|
render() {
|
|
12
7
|
const { children, className, ...restProps } = this.props;
|
|
13
8
|
const classes = classNames(styles.alertContainer, className);
|
|
@@ -71,11 +71,11 @@ class AlertService {
|
|
|
71
71
|
timeout,
|
|
72
72
|
isClosing: false,
|
|
73
73
|
onCloseRequest: () => {
|
|
74
|
-
onCloseRequest
|
|
74
|
+
onCloseRequest?.();
|
|
75
75
|
this.startAlertClosing(alert);
|
|
76
76
|
},
|
|
77
77
|
onClose: () => {
|
|
78
|
-
onClose
|
|
78
|
+
onClose?.();
|
|
79
79
|
this.removeWithoutAnimation(alert.key);
|
|
80
80
|
},
|
|
81
81
|
...restOptions
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Listeners, { Handler } from '../global/listeners';
|
|
2
2
|
import HTTP, { HTTPAuth, RequestParams } from '../http/http';
|
|
3
|
-
import AuthDialogService from '../auth-dialog-service/auth-dialog-service';
|
|
3
|
+
import type AuthDialogService from '../auth-dialog-service/auth-dialog-service';
|
|
4
4
|
import AuthStorage, { AuthState } from './storage';
|
|
5
5
|
import { AuthError, AuthResponse } from './response-parser';
|
|
6
6
|
import AuthRequestBuilder from './request-builder';
|
|
@@ -129,7 +129,7 @@ export default class Auth implements HTTPAuth {
|
|
|
129
129
|
listeners: Listeners<AuthPayloadMap>;
|
|
130
130
|
http: HTTP;
|
|
131
131
|
private _service;
|
|
132
|
-
readonly _storage: AuthStorage<number
|
|
132
|
+
readonly _storage: AuthStorage<number>;
|
|
133
133
|
private _responseParser;
|
|
134
134
|
private readonly _requestBuilder;
|
|
135
135
|
_backgroundFlow: BackgroundFlow | null;
|
|
@@ -174,7 +174,7 @@ export default class Auth implements HTTPAuth {
|
|
|
174
174
|
/**
|
|
175
175
|
* @return {Promise.<object>}
|
|
176
176
|
*/
|
|
177
|
-
getUser(accessToken?: string | null | undefined): Promise<any
|
|
177
|
+
getUser(accessToken?: string | null | undefined): Promise<any>;
|
|
178
178
|
/**
|
|
179
179
|
* @return {Promise.<object>}
|
|
180
180
|
*/
|
|
@@ -197,7 +197,7 @@ export default class Auth implements HTTPAuth {
|
|
|
197
197
|
*/
|
|
198
198
|
login(): Promise<void>;
|
|
199
199
|
switchUser(): Promise<void>;
|
|
200
|
-
_makeStateFromResponse(authResponse: AuthResponse): AuthState;
|
|
200
|
+
_makeStateFromResponse(authResponse: AuthResponse): AuthState | null;
|
|
201
201
|
/**
|
|
202
202
|
* Check if the hash contains an access token.
|
|
203
203
|
* If it does, extract the state, compare with
|
|
@@ -58,7 +58,7 @@ export default class Auth {
|
|
|
58
58
|
listeners = new Listeners();
|
|
59
59
|
http;
|
|
60
60
|
_service = {};
|
|
61
|
-
_storage
|
|
61
|
+
_storage;
|
|
62
62
|
_responseParser = new AuthResponseParser();
|
|
63
63
|
_requestBuilder = null;
|
|
64
64
|
_backgroundFlow;
|
|
@@ -137,7 +137,10 @@ export default class Auth {
|
|
|
137
137
|
this.addListener(LOGOUT_EVENT, this.config.onLogout);
|
|
138
138
|
}
|
|
139
139
|
if (this.config.reloadOnUserChange) {
|
|
140
|
-
this.addListener(USER_CHANGED_EVENT, () =>
|
|
140
|
+
this.addListener(USER_CHANGED_EVENT, () => {
|
|
141
|
+
// Timeout is needed to ensure all other listeners triggered before stopping current page
|
|
142
|
+
setTimeout(() => this._reloadCurrentPage());
|
|
143
|
+
});
|
|
141
144
|
}
|
|
142
145
|
this.addListener(LOGOUT_POSTPONED_EVENT, () => this._setPostponed(true));
|
|
143
146
|
this.addListener(USER_CHANGE_POSTPONED_EVENT, () => this._setPostponed(true));
|
|
@@ -694,23 +697,24 @@ export default class Auth {
|
|
|
694
697
|
_makeStateFromResponse(authResponse) {
|
|
695
698
|
const { state } = authResponse;
|
|
696
699
|
if (!state) {
|
|
697
|
-
|
|
700
|
+
throw new Error('No state in AuthResponse');
|
|
698
701
|
}
|
|
699
702
|
const { scope: defaultScope } = this.config;
|
|
703
|
+
let urlFromState = null;
|
|
700
704
|
try {
|
|
701
|
-
|
|
702
|
-
if (urlFromState.origin !== window.location.origin) {
|
|
703
|
-
return {};
|
|
704
|
-
}
|
|
705
|
-
return {
|
|
706
|
-
restoreLocation: state,
|
|
707
|
-
created: Date.now(),
|
|
708
|
-
scopes: defaultScope
|
|
709
|
-
};
|
|
705
|
+
urlFromState = new URL(state); // checking if state contains valid URL on same origin, see HUB-11514
|
|
710
706
|
}
|
|
711
|
-
catch
|
|
712
|
-
return
|
|
707
|
+
catch {
|
|
708
|
+
return null;
|
|
713
709
|
}
|
|
710
|
+
if (urlFromState.origin !== window.location.origin) {
|
|
711
|
+
throw new Error(`State contains URL with different origin: "${state}"`);
|
|
712
|
+
}
|
|
713
|
+
return {
|
|
714
|
+
restoreLocation: state,
|
|
715
|
+
created: Date.now(),
|
|
716
|
+
scopes: defaultScope
|
|
717
|
+
};
|
|
714
718
|
}
|
|
715
719
|
/**
|
|
716
720
|
* Check if the hash contains an access token.
|
|
@@ -731,8 +735,16 @@ export default class Auth {
|
|
|
731
735
|
return undefined;
|
|
732
736
|
}
|
|
733
737
|
const { state: stateId, scope, expiresIn, accessToken } = authResponse;
|
|
734
|
-
|
|
735
|
-
|
|
738
|
+
let newState = null;
|
|
739
|
+
if (stateId) {
|
|
740
|
+
newState = await this._storage.getState(stateId);
|
|
741
|
+
if (!newState) {
|
|
742
|
+
newState = this._makeStateFromResponse(authResponse);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
if (!newState) {
|
|
746
|
+
throw new Error(`Could not create state where stateId="${stateId}"`);
|
|
747
|
+
}
|
|
736
748
|
const scopes = scope ? scope.split(' ') : newState.scopes || defaultScope || [];
|
|
737
749
|
const effectiveExpiresIn = expiresIn ? parseInt(expiresIn, 10) : defaultExpiresIn;
|
|
738
750
|
const expires = TokenValidator._epoch() + effectiveExpiresIn;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import alertService from '../alert-service/alert-service';
|
|
4
3
|
import Alert from '../alert/alert';
|
|
5
4
|
import Link from '../link/link';
|
|
@@ -27,14 +26,6 @@ function Message({ translations, onCheckAgain }) {
|
|
|
27
26
|
<Link onClick={onCheckAgain} data-test="check-again">{checkAgain}</Link>
|
|
28
27
|
</div>);
|
|
29
28
|
}
|
|
30
|
-
Message.propTypes = {
|
|
31
|
-
translations: PropTypes.shape({
|
|
32
|
-
backendIsNotAvailable: PropTypes.string,
|
|
33
|
-
checkAgain: PropTypes.string,
|
|
34
|
-
errorMessage: PropTypes.string
|
|
35
|
-
}),
|
|
36
|
-
onCheckAgain: PropTypes.func
|
|
37
|
-
};
|
|
38
29
|
export default function onBackendDown({ onCheckAgain, translations }) {
|
|
39
30
|
async function checkAgainWithoutClosing(e) {
|
|
40
31
|
// Alert has weird behaviour of handling clicks by "a" tags
|
|
@@ -39,8 +39,7 @@ export default class AuthStorage {
|
|
|
39
39
|
this.stateTTL = config.stateTTL || DEFAULT_STATE_TTL;
|
|
40
40
|
this._lastMessage = null;
|
|
41
41
|
const StorageConstructor = config.storage || Storage;
|
|
42
|
-
this.stateQuota =
|
|
43
|
-
DEFAULT_STATE_QUOTA, StorageConstructor.QUOTA || Infinity);
|
|
42
|
+
this.stateQuota = config.stateQuota || DEFAULT_STATE_QUOTA;
|
|
44
43
|
this._stateStorage = new StorageConstructor({
|
|
45
44
|
cookieName: 'ring-state'
|
|
46
45
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
/**
|
|
4
3
|
* @name Auth Dialog
|
|
5
4
|
*/
|
|
@@ -21,23 +20,6 @@ export interface AuthDialogProps {
|
|
|
21
20
|
onTryAgain?: () => void;
|
|
22
21
|
}
|
|
23
22
|
export default class AuthDialog extends Component<AuthDialogProps> {
|
|
24
|
-
static propTypes: {
|
|
25
|
-
className: PropTypes.Requireable<string>;
|
|
26
|
-
title: PropTypes.Requireable<string>;
|
|
27
|
-
errorMessage: PropTypes.Requireable<string>;
|
|
28
|
-
serviceImage: PropTypes.Requireable<string>;
|
|
29
|
-
serviceName: PropTypes.Requireable<string>;
|
|
30
|
-
loginCaption: PropTypes.Requireable<string>;
|
|
31
|
-
loginToCaption: PropTypes.Requireable<string>;
|
|
32
|
-
show: PropTypes.Requireable<boolean>;
|
|
33
|
-
cancelOnEsc: PropTypes.Requireable<boolean>;
|
|
34
|
-
confirmLabel: PropTypes.Requireable<string>;
|
|
35
|
-
cancelLabel: PropTypes.Requireable<string>;
|
|
36
|
-
tryAgainLabel: PropTypes.Requireable<string>;
|
|
37
|
-
onConfirm: PropTypes.Requireable<(...args: any[]) => any>;
|
|
38
|
-
onCancel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
|
-
onTryAgain: PropTypes.Requireable<(...args: any[]) => any>;
|
|
40
|
-
};
|
|
41
23
|
static defaultProps: {
|
|
42
24
|
loginCaption: string;
|
|
43
25
|
loginToCaption: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import { Content } from '../island/island';
|
|
5
4
|
import Dialog from '../dialog/dialog';
|
|
@@ -7,23 +6,6 @@ import Button from '../button/button';
|
|
|
7
6
|
import { H2 } from '../heading/heading';
|
|
8
7
|
import styles from './auth-dialog.css';
|
|
9
8
|
export default class AuthDialog extends Component {
|
|
10
|
-
static propTypes = {
|
|
11
|
-
className: PropTypes.string,
|
|
12
|
-
title: PropTypes.string,
|
|
13
|
-
errorMessage: PropTypes.string,
|
|
14
|
-
serviceImage: PropTypes.string,
|
|
15
|
-
serviceName: PropTypes.string,
|
|
16
|
-
loginCaption: PropTypes.string,
|
|
17
|
-
loginToCaption: PropTypes.string,
|
|
18
|
-
show: PropTypes.bool,
|
|
19
|
-
cancelOnEsc: PropTypes.bool,
|
|
20
|
-
confirmLabel: PropTypes.string,
|
|
21
|
-
cancelLabel: PropTypes.string,
|
|
22
|
-
tryAgainLabel: PropTypes.string,
|
|
23
|
-
onConfirm: PropTypes.func,
|
|
24
|
-
onCancel: PropTypes.func,
|
|
25
|
-
onTryAgain: PropTypes.func
|
|
26
|
-
};
|
|
27
9
|
static defaultProps = {
|
|
28
10
|
loginCaption: 'Log in',
|
|
29
11
|
loginToCaption: 'Log in to %serviceName%',
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PureComponent, ImgHTMLAttributes } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
/**
|
|
4
3
|
* @name Avatar
|
|
5
4
|
*/
|
|
@@ -24,18 +23,6 @@ export interface AvatarProps extends ImgHTMLAttributes<HTMLImageElement> {
|
|
|
24
23
|
skipParams?: boolean | null | undefined;
|
|
25
24
|
}
|
|
26
25
|
export default class Avatar extends PureComponent<AvatarProps> {
|
|
27
|
-
static propTypes: {
|
|
28
|
-
dpr: PropTypes.Requireable<number>;
|
|
29
|
-
className: PropTypes.Requireable<string>;
|
|
30
|
-
size: PropTypes.Requireable<number>;
|
|
31
|
-
style: PropTypes.Requireable<object>;
|
|
32
|
-
url: PropTypes.Requireable<string>;
|
|
33
|
-
round: PropTypes.Requireable<boolean>;
|
|
34
|
-
subavatar: PropTypes.Requireable<string>;
|
|
35
|
-
subavatarSize: PropTypes.Requireable<number>;
|
|
36
|
-
username: PropTypes.Requireable<string>;
|
|
37
|
-
skipParams: PropTypes.Requireable<boolean>;
|
|
38
|
-
};
|
|
39
26
|
static defaultProps: {
|
|
40
27
|
dpr: number;
|
|
41
28
|
size: Size;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import { encodeURL, isDataURI, parseQueryString } from '../global/url';
|
|
5
4
|
import { getPixelRatio } from '../global/dom';
|
|
@@ -20,18 +19,6 @@ export var Size;
|
|
|
20
19
|
Size[Size["Size56"] = 56] = "Size56";
|
|
21
20
|
})(Size || (Size = {}));
|
|
22
21
|
export default class Avatar extends PureComponent {
|
|
23
|
-
static propTypes = {
|
|
24
|
-
dpr: PropTypes.number,
|
|
25
|
-
className: PropTypes.string,
|
|
26
|
-
size: PropTypes.number,
|
|
27
|
-
style: PropTypes.object,
|
|
28
|
-
url: PropTypes.string,
|
|
29
|
-
round: PropTypes.bool,
|
|
30
|
-
subavatar: PropTypes.string,
|
|
31
|
-
subavatarSize: PropTypes.number,
|
|
32
|
-
username: PropTypes.string,
|
|
33
|
-
skipParams: PropTypes.bool
|
|
34
|
-
};
|
|
35
22
|
static defaultProps = {
|
|
36
23
|
dpr: getPixelRatio(),
|
|
37
24
|
size: Size.Size20,
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
1
|
import { Size } from './avatar';
|
|
3
2
|
export interface FallbackAvatarProps {
|
|
4
3
|
username: string;
|
|
5
4
|
size: Size;
|
|
6
5
|
round: boolean | null | undefined;
|
|
7
6
|
}
|
|
8
|
-
|
|
9
|
-
declare namespace FallbackAvatar {
|
|
10
|
-
var propTypes: {
|
|
11
|
-
username: PropTypes.Validator<string>;
|
|
12
|
-
size: PropTypes.Validator<number>;
|
|
13
|
-
round: PropTypes.Requireable<boolean>;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export default FallbackAvatar;
|
|
7
|
+
export default function FallbackAvatar({ username, size, round }: FallbackAvatarProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import getUID from '../global/get-uid';
|
|
4
3
|
const colorPairs = [
|
|
5
4
|
['#60A800', '#D5CA00'],
|
|
@@ -106,8 +105,3 @@ export default function FallbackAvatar({ username, size, round }) {
|
|
|
106
105
|
</g>
|
|
107
106
|
</svg>);
|
|
108
107
|
}
|
|
109
|
-
FallbackAvatar.propTypes = {
|
|
110
|
-
username: PropTypes.string.isRequired,
|
|
111
|
-
size: PropTypes.number.isRequired,
|
|
112
|
-
round: PropTypes.bool
|
|
113
|
-
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PureComponent, HTMLAttributes } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
export interface BadgeProps extends HTMLAttributes<HTMLElement> {
|
|
4
3
|
gray?: boolean | null | undefined;
|
|
5
4
|
valid?: boolean | null | undefined;
|
|
@@ -11,14 +10,5 @@ export interface BadgeProps extends HTMLAttributes<HTMLElement> {
|
|
|
11
10
|
* @name Badge
|
|
12
11
|
*/
|
|
13
12
|
export default class Badge extends PureComponent<BadgeProps> {
|
|
14
|
-
static propTypes: {
|
|
15
|
-
gray: PropTypes.Requireable<boolean>;
|
|
16
|
-
valid: PropTypes.Requireable<boolean>;
|
|
17
|
-
invalid: PropTypes.Requireable<boolean>;
|
|
18
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
19
|
-
className: PropTypes.Requireable<string>;
|
|
20
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
21
|
-
'data-test': PropTypes.Requireable<string>;
|
|
22
|
-
};
|
|
23
13
|
render(): import("react").JSX.Element;
|
|
24
14
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import deprecate from 'util-deprecate';
|
|
5
4
|
import dataTests from '../global/data-tests';
|
|
@@ -10,15 +9,6 @@ const warn = deprecate(() => { }, 'Badge is deprecated and will be removed in Ri
|
|
|
10
9
|
*/
|
|
11
10
|
// TODO remove in 7.0
|
|
12
11
|
export default class Badge extends PureComponent {
|
|
13
|
-
static propTypes = {
|
|
14
|
-
gray: PropTypes.bool,
|
|
15
|
-
valid: PropTypes.bool,
|
|
16
|
-
invalid: PropTypes.bool,
|
|
17
|
-
disabled: PropTypes.bool,
|
|
18
|
-
className: PropTypes.string,
|
|
19
|
-
children: PropTypes.node,
|
|
20
|
-
'data-test': PropTypes.string
|
|
21
|
-
};
|
|
22
12
|
render() {
|
|
23
13
|
warn();
|
|
24
14
|
const {
|