@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.
Files changed (271) hide show
  1. package/components/alert/alert.d.ts +7 -24
  2. package/components/alert/alert.js +0 -24
  3. package/components/alert/container.d.ts +0 -5
  4. package/components/alert/container.js +0 -5
  5. package/components/alert-service/alert-service.js +2 -2
  6. package/components/auth/auth__core.d.ts +4 -4
  7. package/components/auth/auth__core.js +28 -16
  8. package/components/auth/down-notification.js +0 -9
  9. package/components/auth/storage.js +1 -2
  10. package/components/auth-dialog/auth-dialog.d.ts +0 -18
  11. package/components/auth-dialog/auth-dialog.js +0 -18
  12. package/components/avatar/avatar.d.ts +0 -13
  13. package/components/avatar/avatar.js +0 -13
  14. package/components/avatar/fallback-avatar.d.ts +1 -10
  15. package/components/avatar/fallback-avatar.js +0 -6
  16. package/components/badge/badge.d.ts +0 -10
  17. package/components/badge/badge.js +0 -10
  18. package/components/breadcrumbs/breadcrumbs.css +1 -0
  19. package/components/button/button.css +156 -184
  20. package/components/button/button.d.ts +0 -21
  21. package/components/button/button.js +16 -32
  22. package/components/button/button__classes.d.ts +1 -1
  23. package/components/button/button__classes.js +10 -8
  24. package/components/button-group/button-group.d.ts +0 -5
  25. package/components/button-group/button-group.js +0 -5
  26. package/components/button-group/caption.d.ts +0 -4
  27. package/components/button-group/caption.js +0 -4
  28. package/components/button-set/button-set.d.ts +0 -6
  29. package/components/button-set/button-set.js +0 -6
  30. package/components/button-toolbar/button-toolbar.d.ts +0 -6
  31. package/components/button-toolbar/button-toolbar.js +0 -6
  32. package/components/checkbox/checkbox.d.ts +0 -19
  33. package/components/checkbox/checkbox.js +0 -21
  34. package/components/code/code.d.ts +0 -12
  35. package/components/code/code.js +0 -13
  36. package/components/confirm/confirm.d.ts +0 -14
  37. package/components/confirm/confirm.js +0 -14
  38. package/components/content-layout/content-layout.d.ts +0 -7
  39. package/components/content-layout/content-layout.js +0 -7
  40. package/components/content-layout/sidebar.d.ts +0 -9
  41. package/components/content-layout/sidebar.js +0 -9
  42. package/components/contenteditable/contenteditable.d.ts +1 -22
  43. package/components/contenteditable/contenteditable.js +0 -17
  44. package/components/control-label/control-label.js +0 -6
  45. package/components/data-list/data-list.css +1 -0
  46. package/components/data-list/data-list.d.ts +0 -2
  47. package/components/data-list/data-list.js +0 -23
  48. package/components/data-list/item.js +0 -25
  49. package/components/data-list/title.d.ts +2 -2
  50. package/components/data-list/title.js +0 -18
  51. package/components/date-picker/consts.d.ts +0 -2
  52. package/components/date-picker/consts.js +0 -6
  53. package/components/date-picker/date-input.d.ts +0 -20
  54. package/components/date-picker/date-input.js +0 -21
  55. package/components/date-picker/date-picker.d.ts +0 -29
  56. package/components/date-picker/date-picker.js +1 -39
  57. package/components/date-picker/date-popup.d.ts +0 -22
  58. package/components/date-picker/date-popup.js +1 -23
  59. package/components/date-picker/day.d.ts +0 -14
  60. package/components/date-picker/day.js +1 -15
  61. package/components/date-picker/month-names.d.ts +1 -11
  62. package/components/date-picker/month-names.js +1 -13
  63. package/components/date-picker/month-slider.d.ts +0 -9
  64. package/components/date-picker/month-slider.js +1 -10
  65. package/components/date-picker/month.d.ts +1 -9
  66. package/components/date-picker/month.js +1 -6
  67. package/components/date-picker/months.d.ts +1 -9
  68. package/components/date-picker/months.js +1 -6
  69. package/components/date-picker/weekdays.d.ts +2 -8
  70. package/components/date-picker/weekdays.js +0 -4
  71. package/components/date-picker/years.d.ts +0 -6
  72. package/components/date-picker/years.js +1 -7
  73. package/components/dialog/dialog.css +2 -2
  74. package/components/dialog/dialog.d.ts +0 -20
  75. package/components/dialog/dialog.js +7 -28
  76. package/components/dropdown/anchor.d.ts +1 -8
  77. package/components/dropdown/anchor.js +0 -5
  78. package/components/dropdown/dropdown.css +2 -4
  79. package/components/dropdown/dropdown.d.ts +4 -22
  80. package/components/dropdown/dropdown.js +0 -22
  81. package/components/dropdown-menu/dropdown-menu.js +0 -18
  82. package/components/error-bubble/error-bubble.d.ts +0 -6
  83. package/components/error-bubble/error-bubble.js +1 -7
  84. package/components/error-message/error-message.d.ts +0 -10
  85. package/components/error-message/error-message.js +0 -10
  86. package/components/footer/footer.js +0 -19
  87. package/components/global/composeRefs.d.ts +0 -3
  88. package/components/global/composeRefs.js +0 -3
  89. package/components/global/create-stateful-context.d.ts +0 -4
  90. package/components/global/create-stateful-context.js +0 -4
  91. package/components/global/focus-sensor-hoc.js +0 -17
  92. package/components/global/react-dom-renderer.d.ts +0 -5
  93. package/components/global/react-dom-renderer.js +0 -5
  94. package/components/global/rerender-hoc.d.ts +2 -2
  95. package/components/global/theme.d.ts +8 -2
  96. package/components/global/theme.js +20 -11
  97. package/components/global/variables.css +2 -0
  98. package/components/global/variables_dark.css +2 -0
  99. package/components/grid/col.d.ts +0 -14
  100. package/components/grid/col.js +1 -16
  101. package/components/grid/grid.d.ts +0 -5
  102. package/components/grid/grid.js +1 -6
  103. package/components/grid/row.d.ts +0 -18
  104. package/components/grid/row.js +1 -19
  105. package/components/group/group.d.ts +0 -5
  106. package/components/group/group.js +1 -6
  107. package/components/header/header-icon.d.ts +0 -22
  108. package/components/header/header-icon.js +0 -6
  109. package/components/header/header.css +2 -14
  110. package/components/header/header.d.ts +0 -7
  111. package/components/header/header.js +0 -7
  112. package/components/header/links.d.ts +2 -0
  113. package/components/header/links.js +7 -0
  114. package/components/header/logo.d.ts +0 -4
  115. package/components/header/logo.js +0 -4
  116. package/components/header/profile.d.ts +1 -39
  117. package/components/header/profile.js +1 -43
  118. package/components/header/services-link.d.ts +0 -10
  119. package/components/header/services-link.js +0 -10
  120. package/components/header/services.d.ts +0 -14
  121. package/components/header/services.js +0 -12
  122. package/components/header/smart-profile.d.ts +0 -9
  123. package/components/header/smart-profile.js +3 -11
  124. package/components/header/smart-services.d.ts +0 -4
  125. package/components/header/smart-services.js +0 -5
  126. package/components/header/tray.d.ts +0 -5
  127. package/components/header/tray.js +0 -5
  128. package/components/heading/heading.js +0 -6
  129. package/components/icon/icon.d.ts +0 -11
  130. package/components/icon/icon.js +0 -11
  131. package/components/icon/icon__svg.d.ts +0 -8
  132. package/components/icon/icon__svg.js +6 -7
  133. package/components/input/input.js +1 -29
  134. package/components/island/adaptive-island-hoc.d.ts +0 -1
  135. package/components/island/adaptive-island-hoc.js +0 -1
  136. package/components/island/content.d.ts +0 -10
  137. package/components/island/content.js +0 -10
  138. package/components/island/header.js +0 -8
  139. package/components/island/island.d.ts +0 -9
  140. package/components/island/island.js +0 -8
  141. package/components/island-legacy/content-legacy.d.ts +0 -5
  142. package/components/island-legacy/content-legacy.js +0 -5
  143. package/components/island-legacy/header-legacy.d.ts +0 -5
  144. package/components/island-legacy/header-legacy.js +0 -5
  145. package/components/island-legacy/island-legacy.d.ts +0 -5
  146. package/components/island-legacy/island-legacy.js +0 -5
  147. package/components/link/clickableLink.d.ts +0 -9
  148. package/components/link/clickableLink.js +0 -9
  149. package/components/link/link.d.ts +0 -25
  150. package/components/link/link.js +0 -13
  151. package/components/list/list.d.ts +0 -32
  152. package/components/list/list.js +1 -30
  153. package/components/list/list__custom.js +0 -21
  154. package/components/list/list__hint.d.ts +0 -4
  155. package/components/list/list__hint.js +0 -4
  156. package/components/list/list__item.js +0 -44
  157. package/components/list/list__link.js +1 -21
  158. package/components/list/list__separator.js +0 -9
  159. package/components/list/list__title.js +0 -13
  160. package/components/loader/loader.d.ts +0 -10
  161. package/components/loader/loader.js +0 -10
  162. package/components/loader-inline/loader-inline.d.ts +0 -6
  163. package/components/loader-inline/loader-inline.js +0 -6
  164. package/components/loader-screen/loader-screen.d.ts +0 -6
  165. package/components/loader-screen/loader-screen.js +0 -6
  166. package/components/login-dialog/login-dialog.d.ts +0 -11
  167. package/components/login-dialog/login-dialog.js +0 -11
  168. package/components/login-dialog/service.js +4 -1
  169. package/components/markdown/markdown.js +0 -5
  170. package/components/message/message.css +2 -2
  171. package/components/message/message.js +1 -17
  172. package/components/pager/pager.css +9 -0
  173. package/components/pager/pager.js +14 -32
  174. package/components/panel/panel.d.ts +0 -5
  175. package/components/panel/panel.js +0 -5
  176. package/components/popup/popup.js +0 -38
  177. package/components/popup/popup.target.js +0 -5
  178. package/components/popup-menu/popup-menu.js +0 -8
  179. package/components/progress-bar/progress-bar.css +4 -4
  180. package/components/progress-bar/progress-bar.d.ts +19 -33
  181. package/components/progress-bar/progress-bar.js +0 -33
  182. package/components/query-assist/query-assist.d.ts +63 -93
  183. package/components/query-assist/query-assist.js +2 -95
  184. package/components/radio/radio.d.ts +0 -8
  185. package/components/radio/radio.js +0 -12
  186. package/components/radio/radio__item.d.ts +0 -9
  187. package/components/radio/radio__item.js +0 -10
  188. package/components/scrollable-section/scrollable-section.css +31 -0
  189. package/components/{header → scrollable-section}/scrollable-section.js +11 -6
  190. package/components/select/select.css +13 -5
  191. package/components/select/select.d.ts +3 -0
  192. package/components/select/select.js +29 -84
  193. package/components/select/select__filter.js +6 -9
  194. package/components/select/select__popup.js +0 -54
  195. package/components/shortcuts/core.js +3 -3
  196. package/components/shortcuts/shortcuts-hoc.d.ts +0 -5
  197. package/components/shortcuts/shortcuts-hoc.js +0 -5
  198. package/components/shortcuts/shortcuts.d.ts +0 -8
  199. package/components/shortcuts/shortcuts.js +0 -8
  200. package/components/storage/storage.d.ts +2 -3
  201. package/components/storage/storage.js +1 -21
  202. package/components/tab-trap/tab-trap.js +0 -8
  203. package/components/table/cell.d.ts +0 -6
  204. package/components/table/cell.js +0 -6
  205. package/components/table/disable-hover-hoc.d.ts +0 -1
  206. package/components/table/disable-hover-hoc.js +0 -1
  207. package/components/table/header-cell.d.ts +0 -10
  208. package/components/table/header-cell.js +0 -10
  209. package/components/table/header.d.ts +1 -23
  210. package/components/table/header.js +0 -15
  211. package/components/table/multitable.d.ts +0 -4
  212. package/components/table/multitable.js +0 -4
  213. package/components/table/row-with-focus-sensor.d.ts +2 -2
  214. package/components/table/row-with-focus-sensor.js +0 -2
  215. package/components/table/row.js +0 -34
  216. package/components/table/selection-shortcuts-hoc.js +0 -16
  217. package/components/table/simple-table.d.ts +0 -44
  218. package/components/table/simple-table.js +0 -4
  219. package/components/table/smart-table.d.ts +0 -48
  220. package/components/table/smart-table.js +0 -7
  221. package/components/table/table.d.ts +0 -2
  222. package/components/table/table.js +1 -50
  223. package/components/tabs/collapsible-more.d.ts +1 -9
  224. package/components/tabs/collapsible-more.js +0 -23
  225. package/components/tabs/collapsible-tab.js +0 -8
  226. package/components/tabs/collapsible-tabs.d.ts +2 -29
  227. package/components/tabs/collapsible-tabs.js +0 -12
  228. package/components/tabs/custom-item.d.ts +1 -7
  229. package/components/tabs/custom-item.js +0 -4
  230. package/components/tabs/dumb-tabs.d.ts +0 -11
  231. package/components/tabs/dumb-tabs.js +0 -11
  232. package/components/tabs/smart-tabs.d.ts +0 -6
  233. package/components/tabs/smart-tabs.js +0 -6
  234. package/components/tabs/tab-link.d.ts +0 -8
  235. package/components/tabs/tab-link.js +0 -6
  236. package/components/tabs/tab.d.ts +0 -8
  237. package/components/tabs/tab.js +0 -8
  238. package/components/tabs/tabs.css +4 -4
  239. package/components/tag/tag.css +3 -48
  240. package/components/tag/tag.d.ts +0 -19
  241. package/components/tag/tag.js +0 -24
  242. package/components/tags-input/tags-input.d.ts +7 -33
  243. package/components/tags-input/tags-input.js +1 -31
  244. package/components/tags-list/tags-list.d.ts +0 -13
  245. package/components/tags-list/tags-list.js +0 -13
  246. package/components/text/text.d.ts +0 -7
  247. package/components/text/text.js +0 -7
  248. package/components/toggle/toggle.d.ts +0 -15
  249. package/components/toggle/toggle.js +1 -16
  250. package/components/tooltip/tooltip.d.ts +4 -10
  251. package/components/tooltip/tooltip.js +7 -12
  252. package/components/user-agreement/service.d.ts +2 -1
  253. package/components/user-agreement/user-agreement.d.ts +0 -18
  254. package/components/user-agreement/user-agreement.js +0 -18
  255. package/components/user-card/card.d.ts +0 -35
  256. package/components/user-card/card.js +0 -28
  257. package/components/user-card/smart-user-card-tooltip.d.ts +0 -5
  258. package/components/user-card/smart-user-card-tooltip.js +0 -5
  259. package/components/user-card/tooltip.d.ts +0 -9
  260. package/components/user-card/tooltip.js +0 -9
  261. package/package.json +56 -59
  262. package/components/global/prop-types.d.ts +0 -4
  263. package/components/global/prop-types.js +0 -4
  264. package/components/global/react-render-adapter.d.ts +0 -1
  265. package/components/global/react-render-adapter.js +0 -3
  266. package/components/header/tray-icon.d.ts +0 -1
  267. package/components/header/tray-icon.js +0 -2
  268. package/components/palette/palette.css +0 -220
  269. package/components/storage/storage__fallback.d.ts +0 -79
  270. package/components/storage/storage__fallback.js +0 -181
  271. /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 && onCloseRequest();
74
+ onCloseRequest?.();
75
75
  this.startAlertClosing(alert);
76
76
  },
77
77
  onClose: () => {
78
- onClose && 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> | null;
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> | undefined;
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 = null;
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, () => this._reloadCurrentPage());
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
- return {};
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
- const urlFromState = new URL(state); // checking if state contains valid URL on same origin, see HUB-11514
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 (e) {
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
- const newState = await (stateId && this._storage?.getState(stateId)) ||
735
- this._makeStateFromResponse(authResponse);
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 = Math.min(config.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
- declare function FallbackAvatar({ username, size, round }: FallbackAvatarProps): import("react").JSX.Element;
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 {
@@ -4,4 +4,5 @@
4
4
  color: var(--ring-borders-color);
5
5
 
6
6
  font-size: 16px;
7
+ line-height: 16px;
7
8
  }