@jetbrains/ring-ui 4.1.5 → 4.1.9

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/README.md CHANGED
@@ -37,7 +37,7 @@ export const Demo = () => {
37
37
 
38
38
  The bundle size will depend on the amount of components you imported.
39
39
 
40
- ### Generating app
40
+ ### Generating app (deprecated)
41
41
 
42
42
  1. Install Yeoman and Ring UI generator: `npm install -g yo@next-4 @jetbrains/generator-ring-ui`
43
43
  2. Go to the root directory of your project (create one if necessary), run `yo @jetbrains/ring-ui` and enter the name of the project. Then run `npm install` to install all the necessary npm dependencies.
@@ -86,18 +86,6 @@ in a same build process, you can use the following configuration:
86
86
  module.exports = webpackConfig;
87
87
  ```
88
88
 
89
- ### Yeoman scaffolding
90
-
91
- 1. Install Yeoman and Ring UI generator: `npm install -g yo @jetbrains/generator-ring-ui`
92
- 2. Go to the root directory of your project (create one if necessary) and run `yo @jetbrains/ring-ui`. After you enter the name of the project all the necessary npm dependencies will be installed.
93
- 3. Your project is ready to be developed. The following commands are available:
94
- - `npm start` to run a local development server
95
- - `npm test` to launch karma tests
96
- - `npm run lint` to lint your code
97
- - `npm run build` to build a production bundle
98
- - `npm run create-component` to create a new component template with styles and tests
99
-
100
-
101
89
  ## Contributing
102
90
 
103
91
  See [CONTRIBUTING.md](./CONTRIBUTING.md)
@@ -516,19 +516,17 @@ describe('Auth', () => {
516
516
  }
517
517
  });
518
518
 
519
- it('should show login overlay if token refresh fails and window login enabled', async () => {
519
+ it('should show login overlay if token refresh fails and window login enabled', done => {
520
520
  auth._backgroundFlow._timeout = 100;
521
521
  sandbox.stub(BackgroundFlow.prototype, '_redirectFrame');
522
522
  sandbox.stub(Auth.prototype, '_showAuthDialog');
523
523
 
524
- try {
525
- await auth.requestToken();
526
- } catch (reject) {
527
- Auth.prototype._showAuthDialog.should.have.been.calledWith({
528
- nonInteractive: true,
529
- error: reject
530
- });
531
- }
524
+ auth.requestToken();
525
+
526
+ setTimeout(() => {
527
+ Auth.prototype._showAuthDialog.should.have.been.called;
528
+ done();
529
+ }, auth._backgroundFlow._timeout * 2);
532
530
  });
533
531
  });
534
532
 
@@ -52,6 +52,7 @@ const DEFAULT_CONFIG = {
52
52
  login: 'Log in',
53
53
  loginTo: 'Log in to %serviceName%',
54
54
  cancel: 'Cancel',
55
+ tryAgainLabel: 'Try again',
55
56
  postpone: 'Postpone',
56
57
  youHaveLoggedInAs: 'You have logged in as another user: %userName%',
57
58
  applyChange: 'Apply change',
@@ -405,9 +406,27 @@ export default class Auth {
405
406
  try {
406
407
  return await this._backgroundFlow.authorize();
407
408
  } catch (error) {
408
-
409
409
  if (this._canShowDialogs()) {
410
- return this._showAuthDialog({nonInteractive: true, error});
410
+ return new Promise(resolve => {
411
+ const onTryAgain = async () => {
412
+ try {
413
+ const result = await this._backgroundFlow.authorize();
414
+ resolve(result);
415
+ } catch (retryError) {
416
+ this._showAuthDialog({
417
+ nonInteractive: true,
418
+ error: retryError,
419
+ onTryAgain
420
+ });
421
+ throw retryError;
422
+ }
423
+ };
424
+ this._showAuthDialog({
425
+ nonInteractive: true,
426
+ error,
427
+ onTryAgain
428
+ });
429
+ });
411
430
  } else {
412
431
  const authRequest = await this._requestBuilder.prepareAuthRequest();
413
432
  this._redirectCurrentPage(authRequest.url);
@@ -516,7 +535,7 @@ export default class Auth {
516
535
  this.logout();
517
536
  }
518
537
 
519
- _showAuthDialog({nonInteractive, error, canCancel} = {}) {
538
+ _showAuthDialog({nonInteractive, error, canCancel, onTryAgain} = {}) {
520
539
  const {embeddedLogin, onPostponeLogout, translations} = this.config;
521
540
  const cancelable = this.user.guest || canCancel;
522
541
 
@@ -557,15 +576,22 @@ export default class Auth {
557
576
  }
558
577
  };
559
578
 
579
+ const onTryAgainClick = async () => {
580
+ await onTryAgain();
581
+ closeDialog();
582
+ };
583
+
560
584
  const hide = this._authDialogService({
561
585
  ...this._service,
562
586
  loginCaption: translations.login,
563
587
  loginToCaption: translations.loginTo,
564
588
  confirmLabel: translations.login,
589
+ tryAgainLabel: translations.tryAgainLabel,
565
590
  cancelLabel: cancelable ? translations.cancel : translations.postpone,
566
591
  errorMessage: this._extractErrorMessage(error, true),
567
592
  onConfirm,
568
- onCancel
593
+ onCancel,
594
+ onTryAgain: onTryAgain ? onTryAgainClick : null
569
595
  });
570
596
 
571
597
  const stopTokenListening = this._storage.onTokenChange(token => {
@@ -1,14 +1,13 @@
1
1
  import React from 'react';
2
2
 
3
+ import youtrackLogo from '!file-loader!@jetbrains/logos/youtrack/youtrack.svg';
4
+
3
5
  import reactDecorator from '../../.storybook/react-decorator';
4
6
 
5
7
  import Button from '@jetbrains/ring-ui/components/button/button';
6
8
 
7
9
  import AuthDialog from '@jetbrains/ring-ui/components/auth-dialog/auth-dialog';
8
10
 
9
- import youtrackLogo from '!file-loader!@jetbrains/logos/youtrack/youtrack.svg';
10
-
11
-
12
11
  export default {
13
12
  title: 'Components/Auth Dialog',
14
13
  decorators: [reactDecorator()],
@@ -28,9 +28,11 @@ export default class AuthDialog extends Component {
28
28
  cancelOnEsc: PropTypes.bool,
29
29
  confirmLabel: PropTypes.string,
30
30
  cancelLabel: PropTypes.string,
31
+ tryAgainLabel: PropTypes.string,
31
32
 
32
33
  onConfirm: PropTypes.func,
33
- onCancel: PropTypes.func
34
+ onCancel: PropTypes.func,
35
+ onTryAgain: PropTypes.func
34
36
  };
35
37
 
36
38
  static defaultProps = {
@@ -44,12 +46,38 @@ export default class AuthDialog extends Component {
44
46
  onCancel: () => {}
45
47
  };
46
48
 
49
+ state = {
50
+ retrying: false
51
+ };
52
+
53
+ componentDidMount() {
54
+ window.addEventListener('online', this.onRetryPress);
55
+ }
56
+
57
+ componentWillUnmount() {
58
+ window.removeEventListener('online', this.onRetryPress);
59
+ }
60
+
47
61
  onEscPress = () => {
48
62
  if (this.props.cancelOnEsc) {
49
63
  this.props.onCancel();
50
64
  }
51
65
  };
52
66
 
67
+ onRetryPress = async () => {
68
+ if (!this.props.onTryAgain || this.state.retrying) {
69
+ return;
70
+ }
71
+ this.setState({retrying: true});
72
+ try {
73
+ await this.props.onTryAgain();
74
+ } catch (e) {
75
+ // do nothing, error is handled in onTryAgain
76
+ } finally {
77
+ this.setState({retrying: false});
78
+ }
79
+ };
80
+
53
81
  render() {
54
82
  const {
55
83
  show,
@@ -61,10 +89,14 @@ export default class AuthDialog extends Component {
61
89
  loginToCaption,
62
90
  confirmLabel,
63
91
  cancelLabel,
92
+ tryAgainLabel,
64
93
  onConfirm,
65
- onCancel
94
+ onCancel,
95
+ onTryAgain
66
96
  } = this.props;
67
97
 
98
+ const {retrying} = this.state;
99
+
68
100
  const defaultTitle = serviceName ? loginToCaption : loginCaption;
69
101
  const title = (this.props.title || defaultTitle).replace('%serviceName%', serviceName);
70
102
 
@@ -99,6 +131,17 @@ export default class AuthDialog extends Component {
99
131
  >
100
132
  {confirmLabel}
101
133
  </Button>
134
+ {onTryAgain && (
135
+ <Button
136
+ className={styles.button}
137
+ data-test="auth-dialog-retry-button"
138
+ onClick={() => this.onRetryPress()}
139
+ loader={retrying}
140
+ disabled={retrying}
141
+ >
142
+ {tryAgainLabel}
143
+ </Button>
144
+ )}
102
145
  <Button
103
146
  className={styles.button}
104
147
  data-test="auth-dialog-cancel-button"
@@ -738,6 +738,14 @@ export default class Select extends Component {
738
738
  }
739
739
  };
740
740
 
741
+ _openPopupIfClosed = () => {
742
+ if (this.props.disabled || this.state.showPopup) {
743
+ return;
744
+ }
745
+ this.props.onBeforeOpen();
746
+ this._showPopup();
747
+ };
748
+
741
749
  _filterChangeHandler = e => {
742
750
  this._setFilter(e.target.value, e);
743
751
  };
@@ -59,11 +59,10 @@ class SelectLazy {
59
59
  this.detachEvents();
60
60
  if (this.type === 'dropdown') {
61
61
  this.ctrl.selectInstance = render(this.reactSelect, this.container);
62
- // In "dropdown" mode we don't click select itself, so need to force click handler
63
- this.ctrl.selectInstance._clickHandler();
64
62
  } else {
65
63
  this.ctrl.selectInstance = hydrate(this.reactSelect, this.container);
66
64
  }
65
+ this.ctrl.selectInstance._openPopupIfClosed();
67
66
  }
68
67
  }
69
68
 
@@ -85,9 +85,9 @@ export default class Row extends PureComponent {
85
85
 
86
86
  id = getUID('table-row-');
87
87
 
88
- onMouseEnter = () => {
88
+ onMouseEnter = e => {
89
89
  const {item, onHover} = this.props;
90
- onHover(item);
90
+ onHover(item, e);
91
91
  };
92
92
 
93
93
  onClick = e => {
@@ -1,7 +1,7 @@
1
1
  import classNames from 'classnames';
2
2
  import Theme from '../global/theme.js';
3
3
 
4
- var modules_e81895c9 = {"unit":"8px","button-shadow":"inset 0 0 0 1px","height":"24px","loaderWidth":"64px","light":"light_rui_b000","active":"active_rui_b000 active_rui_e33e","withIcon":"withIcon_rui_b000","icon":"icon_rui_b000","primary":"primary_rui_b000","danger":"danger_rui_b000","loaderBackground":"loaderBackground_rui_b000","dark":"dark_rui_b000","dropdownIcon":"dropdownIcon_rui_b000","button":"button_rui_b000 button_rui_e33e button_rui_40c7 button_rui_ec74","loader":"loader_rui_b000","text":"text_rui_b000","content":"content_rui_b000","text-loading":"textLoading_rui_b000","inline":"inline_rui_b000","withNormalIconLight":"withNormalIconLight_rui_b000","withNormalIconDark":"withNormalIconDark_rui_b000","withDangerIconLight":"withDangerIconLight_rui_b000","withDangerIconDark":"withDangerIconDark_rui_b000","progress":"progress_rui_b000","delayed":"delayed_rui_b000","short":"short_rui_b000"};
4
+ var modules_e81895c9 = {"unit":"8px","button-shadow":"inset 0 0 0 1px","height":"24px","loaderWidth":"64px","light":"light_rui_8c91","active":"active_rui_8c91 active_rui_e33e","withIcon":"withIcon_rui_8c91","icon":"icon_rui_8c91","primary":"primary_rui_8c91","danger":"danger_rui_8c91","loaderBackground":"loaderBackground_rui_8c91","dark":"dark_rui_8c91","dropdownIcon":"dropdownIcon_rui_8c91","button":"button_rui_8c91 button_rui_e33e button_rui_40c7 button_rui_ec74","loader":"loader_rui_8c91","text":"text_rui_8c91","content":"content_rui_8c91","text-loading":"textLoading_rui_8c91","inline":"inline_rui_8c91","withNormalIconLight":"withNormalIconLight_rui_8c91","withNormalIconDark":"withNormalIconDark_rui_8c91","withDangerIconLight":"withDangerIconLight_rui_8c91","withDangerIconDark":"withDangerIconDark_rui_8c91","progress":"progress_rui_8c91","delayed":"delayed_rui_8c91","short":"short_rui_8c91"};
5
5
 
6
6
  function getButtonClasses(_ref) {
7
7
  let {
@@ -1,3 +1,3 @@
1
- var modules_3199090e = {"unit":"8px","checkboxSize":"14px","checkbox":"checkbox_rui_95ac","cell":"cell_rui_95ac","icon":"icon_rui_95ac","check":"check_rui_95ac icon_rui_95ac","minus":"minus_rui_95ac icon_rui_95ac","input":"input_rui_95ac","focus":"focus_rui_95ac","label":"label_rui_95ac"};
1
+ var modules_3199090e = {"unit":"8px","checkboxSize":"14px","checkbox":"checkbox_rui_a0fd","cell":"cell_rui_a0fd","icon":"icon_rui_a0fd","check":"check_rui_a0fd icon_rui_a0fd","minus":"minus_rui_a0fd icon_rui_a0fd","input":"input_rui_a0fd","focus":"focus_rui_a0fd","label":"label_rui_a0fd"};
2
2
 
3
3
  export { modules_3199090e as m };
@@ -1,3 +1,3 @@
1
- var modules_0c7b7d96 = {"unit":"8px","cellSize":"24px","calHeight":"288px","calWidth":"296px","yearHeight":"32px","yearWidth":"48px","container":"container_rui_58d9","hoverable":"hoverable_rui_58d9","datePicker":"datePicker_rui_58d9","displayDate":"displayDate_rui_58d9","displayRange":"displayRange_rui_58d9","clear":"clear_rui_58d9","datePopup":"datePopup_rui_58d9","filterWrapper":"filterWrapper_rui_58d9 filterWrapper_rui_7e99","filter":"filter_rui_58d9 filter_rui_7e99","filterIcon":"filterIcon_rui_58d9 filterIcon_rui_7e99","fromInput":"fromInput_rui_58d9","fromInputWithDivider":"fromInputWithDivider_rui_58d9","toInput":"toInput_rui_58d9","dateInput":"dateInput_rui_58d9","timeInputWithDivider":"timeInputWithDivider_rui_58d9","weekdays":"weekdays_rui_58d9","weekday":"weekday_rui_58d9","weekend":"weekend_rui_58d9","calendar":"calendar_rui_58d9","months":"months_rui_58d9","days":"days_rui_58d9","month":"month_rui_58d9","monthTitle":"monthTitle_rui_58d9","day":"day_rui_58d9 resetButton_rui_750f","between":"between_rui_58d9","activeBetween":"activeBetween_rui_58d9","current":"current_rui_58d9","active":"active_rui_58d9","disabled":"disabled_rui_58d9","from":"from_rui_58d9","to":"to_rui_58d9","Monday":"Monday_rui_58d9","spread":"spread_rui_58d9","activeSpread":"activeSpread_rui_58d9","first":"first_rui_58d9","Tuesday":"Tuesday_rui_58d9","Friday":"Friday_rui_58d9","Saturday":"Saturday_rui_58d9","Sunday":"Sunday_rui_58d9","empty":"empty_rui_58d9","today":"today_rui_58d9","year":"year_rui_58d9 hoverable_rui_58d9 resetButton_rui_750f","monthNames":"monthNames_rui_58d9","monthName":"monthName_rui_58d9 hoverable_rui_58d9 resetButton_rui_750f","monthSlider":"monthSlider_rui_58d9 resetButton_rui_750f","dragging":"dragging_rui_58d9","range":"range_rui_58d9","years":"years_rui_58d9","currentYear":"currentYear_rui_58d9"};
1
+ var modules_0c7b7d96 = {"unit":"8px","cellSize":"24px","calHeight":"288px","calWidth":"296px","yearHeight":"32px","yearWidth":"48px","container":"container_rui_f337","hoverable":"hoverable_rui_f337","datePicker":"datePicker_rui_f337","displayDate":"displayDate_rui_f337","displayRange":"displayRange_rui_f337","clear":"clear_rui_f337","datePopup":"datePopup_rui_f337","filterWrapper":"filterWrapper_rui_f337 filterWrapper_rui_7e99","filter":"filter_rui_f337 filter_rui_7e99","filterIcon":"filterIcon_rui_f337 filterIcon_rui_7e99","fromInput":"fromInput_rui_f337","fromInputWithDivider":"fromInputWithDivider_rui_f337","toInput":"toInput_rui_f337","dateInput":"dateInput_rui_f337","timeInputWithDivider":"timeInputWithDivider_rui_f337","weekdays":"weekdays_rui_f337","weekday":"weekday_rui_f337","weekend":"weekend_rui_f337","calendar":"calendar_rui_f337","months":"months_rui_f337","days":"days_rui_f337","month":"month_rui_f337","monthTitle":"monthTitle_rui_f337","day":"day_rui_f337 resetButton_rui_750f","between":"between_rui_f337","activeBetween":"activeBetween_rui_f337","current":"current_rui_f337","active":"active_rui_f337","disabled":"disabled_rui_f337","from":"from_rui_f337","to":"to_rui_f337","Monday":"Monday_rui_f337","spread":"spread_rui_f337","activeSpread":"activeSpread_rui_f337","first":"first_rui_f337","Tuesday":"Tuesday_rui_f337","Friday":"Friday_rui_f337","Saturday":"Saturday_rui_f337","Sunday":"Sunday_rui_f337","empty":"empty_rui_f337","today":"today_rui_f337","year":"year_rui_f337 hoverable_rui_f337 resetButton_rui_750f","monthNames":"monthNames_rui_f337","monthName":"monthName_rui_f337 hoverable_rui_f337 resetButton_rui_750f","monthSlider":"monthSlider_rui_f337 resetButton_rui_750f","dragging":"dragging_rui_f337","range":"range_rui_f337","years":"years_rui_f337","currentYear":"currentYear_rui_f337"};
2
2
 
3
3
  export { modules_0c7b7d96 as m };
@@ -4,7 +4,7 @@ import memoize from '../global/memoize.js';
4
4
  import radialGradientMask from '../global/radial-gradient-mask.js';
5
5
  import Theme from '../global/theme.js';
6
6
 
7
- var modules_e49a3529 = {"unit":"8px","loader":"loader_rui_cf3e","spin":"spin_rui_cf3e","pulse":"pulse_rui_cf3e","children":"children_rui_cf3e"};
7
+ var modules_e49a3529 = {"unit":"8px","loader":"loader_rui_423e","spin":"spin_rui_423e","pulse":"pulse_rui_423e","children":"children_rui_423e"};
8
8
 
9
9
  const IMAGE_SIZE = 32;
10
10
  var injectStyles = memoize(() => {
@@ -1,3 +1,3 @@
1
- var modules_88cfaf40 = {"unit":"8px","iconOffset":"22px","container":"container_rui_91e6 fontLower_rui_750f font_rui_750f","compact":"compact_rui_91e6","input":"input_rui_91e6","clearable":"clearable_rui_91e6","light":"light_rui_91e6","dark":"dark_rui_91e6","withIcon":"withIcon_rui_91e6","label":"label_rui_91e6","icon":"icon_rui_91e6","clear":"clear_rui_91e6","empty":"empty_rui_91e6","active":"active_rui_91e6","noLabel":"noLabel_rui_91e6","error":"error_rui_91e6","underline":"underline_rui_91e6","focusUnderline":"focusUnderline_rui_91e6","errorUnderline":"errorUnderline_rui_91e6","errorText":"errorText_rui_91e6","sizeS":"sizeS_rui_91e6","sizeM":"sizeM_rui_91e6","sizeL":"sizeL_rui_91e6","sizeFULL":"sizeFULL_rui_91e6"};
1
+ var modules_88cfaf40 = {"unit":"8px","iconOffset":"22px","container":"container_rui_65d4 fontLower_rui_750f font_rui_750f","compact":"compact_rui_65d4","input":"input_rui_65d4","clearable":"clearable_rui_65d4","light":"light_rui_65d4","dark":"dark_rui_65d4","withIcon":"withIcon_rui_65d4","label":"label_rui_65d4","icon":"icon_rui_65d4","clear":"clear_rui_65d4","empty":"empty_rui_65d4","active":"active_rui_65d4","noLabel":"noLabel_rui_65d4","error":"error_rui_65d4","underline":"underline_rui_65d4","focusUnderline":"focusUnderline_rui_65d4","errorUnderline":"errorUnderline_rui_65d4","errorText":"errorText_rui_65d4","sizeS":"sizeS_rui_65d4","sizeM":"sizeM_rui_65d4","sizeL":"sizeL_rui_65d4","sizeFULL":"sizeFULL_rui_65d4"};
2
2
 
3
3
  export { modules_88cfaf40 as m };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import List from '../list/list.js';
3
3
 
4
- var modules_da7ab055 = {"unit":"8px","overInputZIndex":"2","inputGap":"24px","light":"light_rui_d961","queryAssist":"queryAssist_rui_d961 font_rui_750f","input":"input_rui_d961","placeholder":"placeholder_rui_d961 resetButton_rui_750f","letter-text":"letterText_rui_d961","letterDefault":"letterDefault_rui_d961","letter-field-name":"letterFieldName_rui_d961","letter-field-value":"letterFieldValue_rui_d961","letter-operator":"letterOperator_rui_d961","letter-error":"letterError_rui_d961","iconInner":"iconInner_rui_d961","highlight":"highlight_rui_d961","service":"service_rui_d961","dark":"dark_rui_d961","icon":"icon_rui_d961","loader":"loader_rui_d961","actions":"actions_rui_d961","24px":"_24px_rui_d961","inputGap2":"inputGap2_rui_d961","inputLeftGap":"inputLeftGap_rui_d961","inputDisabled":"inputDisabled_rui_d961","placeholderSpaced":"placeholderSpaced_rui_d961","letter":"letter_rui_d961","loaderOnTheRight":"loaderOnTheRight_rui_d961","focusUnderline":"focusUnderline_rui_d961"};
4
+ var modules_da7ab055 = {"unit":"8px","overInputZIndex":"2","inputGap":"24px","light":"light_rui_7422","queryAssist":"queryAssist_rui_7422 font_rui_750f","input":"input_rui_7422","placeholder":"placeholder_rui_7422 resetButton_rui_750f","letter-text":"letterText_rui_7422","letterDefault":"letterDefault_rui_7422","letter-field-name":"letterFieldName_rui_7422","letter-field-value":"letterFieldValue_rui_7422","letter-operator":"letterOperator_rui_7422","letter-error":"letterError_rui_7422","iconInner":"iconInner_rui_7422","highlight":"highlight_rui_7422","service":"service_rui_7422","dark":"dark_rui_7422","icon":"icon_rui_7422","loader":"loader_rui_7422","actions":"actions_rui_7422","24px":"_24px_rui_7422","inputGap2":"inputGap2_rui_7422","inputLeftGap":"inputLeftGap_rui_7422","inputDisabled":"inputDisabled_rui_7422","placeholderSpaced":"placeholderSpaced_rui_7422","letter":"letter_rui_7422","loaderOnTheRight":"loaderOnTheRight_rui_7422","focusUnderline":"focusUnderline_rui_7422"};
5
5
 
6
6
  const ICON_ID_LENGTH = 44;
7
7
  class QueryAssistSuggestions {
@@ -1,3 +1,3 @@
1
- var modules_02138f4a = {"unit":"8px","line-shadow":"inset 0 -1px 0 0","selected-line-shadow":"inset 0 -3px 0 0","tabs":"tabs_rui_6848 font_rui_750f","titles":"titles_rui_6848","light":"light_rui_6848","dark":"dark_rui_6848","title":"title_rui_6848 font_rui_750f","selected":"selected_rui_6848","collapsed":"collapsed_rui_6848","titleLegacy":"titleLegacy_rui_6848","visible":"visible_rui_6848","container":"container_rui_6848","hidden":"hidden_rui_6848","hiddenBold":"hiddenBold_rui_6848","hiddenRegular":"hiddenRegular_rui_6848","tabCounter":"tabCounter_rui_6848","autoCollapseContainer":"autoCollapseContainer_rui_6848","autoCollapse":"autoCollapse_rui_6848","rendered":"rendered_rui_6848","adjusted":"adjusted_rui_6848","measure":"measure_rui_6848","morePopup":"morePopup_rui_6848","chevron":"chevron_rui_6848","morePopupBeforeEnd":"morePopupBeforeEnd_rui_6848"};
1
+ var modules_02138f4a = {"unit":"8px","line-shadow":"inset 0 -1px 0 0","selected-line-shadow":"inset 0 -3px 0 0","tabs":"tabs_rui_a11f font_rui_750f","titles":"titles_rui_a11f","light":"light_rui_a11f","dark":"dark_rui_a11f","title":"title_rui_a11f font_rui_750f","selected":"selected_rui_a11f","collapsed":"collapsed_rui_a11f","titleLegacy":"titleLegacy_rui_a11f","visible":"visible_rui_a11f","container":"container_rui_a11f","hidden":"hidden_rui_a11f","hiddenBold":"hiddenBold_rui_a11f","hiddenRegular":"hiddenRegular_rui_a11f","tabCounter":"tabCounter_rui_a11f","autoCollapseContainer":"autoCollapseContainer_rui_a11f","autoCollapse":"autoCollapse_rui_a11f","rendered":"rendered_rui_a11f","adjusted":"adjusted_rui_a11f","measure":"measure_rui_a11f","morePopup":"morePopup_rui_a11f","chevron":"chevron_rui_a11f","morePopupBeforeEnd":"morePopupBeforeEnd_rui_a11f"};
2
2
 
3
3
  export { modules_02138f4a as m };
@@ -86,6 +86,7 @@ const DEFAULT_CONFIG = {
86
86
  login: 'Log in',
87
87
  loginTo: 'Log in to %serviceName%',
88
88
  cancel: 'Cancel',
89
+ tryAgainLabel: 'Try again',
89
90
  postpone: 'Postpone',
90
91
  youHaveLoggedInAs: 'You have logged in as another user: %userName%',
91
92
  applyChange: 'Apply change',
@@ -475,9 +476,27 @@ class Auth {
475
476
  return await this._backgroundFlow.authorize();
476
477
  } catch (error) {
477
478
  if (this._canShowDialogs()) {
478
- return this._showAuthDialog({
479
- nonInteractive: true,
480
- error
479
+ return new Promise(resolve => {
480
+ const onTryAgain = async () => {
481
+ try {
482
+ const result = await this._backgroundFlow.authorize();
483
+ resolve(result);
484
+ } catch (retryError) {
485
+ this._showAuthDialog({
486
+ nonInteractive: true,
487
+ error: retryError,
488
+ onTryAgain
489
+ });
490
+
491
+ throw retryError;
492
+ }
493
+ };
494
+
495
+ this._showAuthDialog({
496
+ nonInteractive: true,
497
+ error,
498
+ onTryAgain
499
+ });
481
500
  });
482
501
  } else {
483
502
  const authRequest = await this._requestBuilder.prepareAuthRequest();
@@ -603,7 +622,8 @@ class Auth {
603
622
  let {
604
623
  nonInteractive,
605
624
  error,
606
- canCancel
625
+ canCancel,
626
+ onTryAgain
607
627
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
608
628
  const {
609
629
  embeddedLogin,
@@ -654,14 +674,21 @@ class Auth {
654
674
  }
655
675
  };
656
676
 
677
+ const onTryAgainClick = async () => {
678
+ await onTryAgain();
679
+ closeDialog();
680
+ };
681
+
657
682
  const hide = this._authDialogService({ ...this._service,
658
683
  loginCaption: translations.login,
659
684
  loginToCaption: translations.loginTo,
660
685
  confirmLabel: translations.login,
686
+ tryAgainLabel: translations.tryAgainLabel,
661
687
  cancelLabel: cancelable ? translations.cancel : translations.postpone,
662
688
  errorMessage: this._extractErrorMessage(error, true),
663
689
  onConfirm,
664
- onCancel
690
+ onCancel,
691
+ onTryAgain: onTryAgain ? onTryAgainClick : null
665
692
  });
666
693
 
667
694
  const stopTokenListening = this._storage.onTokenChange(token => {
@@ -49,11 +49,42 @@ class AuthDialog extends Component {
49
49
  constructor() {
50
50
  super(...arguments);
51
51
 
52
+ _defineProperty(this, "state", {
53
+ retrying: false
54
+ });
55
+
52
56
  _defineProperty(this, "onEscPress", () => {
53
57
  if (this.props.cancelOnEsc) {
54
58
  this.props.onCancel();
55
59
  }
56
60
  });
61
+
62
+ _defineProperty(this, "onRetryPress", async () => {
63
+ if (!this.props.onTryAgain || this.state.retrying) {
64
+ return;
65
+ }
66
+
67
+ this.setState({
68
+ retrying: true
69
+ });
70
+
71
+ try {
72
+ await this.props.onTryAgain();
73
+ } catch (e) {// do nothing, error is handled in onTryAgain
74
+ } finally {
75
+ this.setState({
76
+ retrying: false
77
+ });
78
+ }
79
+ });
80
+ }
81
+
82
+ componentDidMount() {
83
+ window.addEventListener('online', this.onRetryPress);
84
+ }
85
+
86
+ componentWillUnmount() {
87
+ window.removeEventListener('online', this.onRetryPress);
57
88
  }
58
89
 
59
90
  render() {
@@ -67,9 +98,14 @@ class AuthDialog extends Component {
67
98
  loginToCaption,
68
99
  confirmLabel,
69
100
  cancelLabel,
101
+ tryAgainLabel,
70
102
  onConfirm,
71
- onCancel
103
+ onCancel,
104
+ onTryAgain
72
105
  } = this.props;
106
+ const {
107
+ retrying
108
+ } = this.state;
73
109
  const defaultTitle = serviceName ? loginToCaption : loginCaption;
74
110
  const title = (this.props.title || defaultTitle).replace('%serviceName%', serviceName);
75
111
  return /*#__PURE__*/React.createElement(Dialog, {
@@ -95,7 +131,13 @@ class AuthDialog extends Component {
95
131
  className: modules_ae521deb.firstButton,
96
132
  "data-test": "auth-dialog-confirm-button",
97
133
  onClick: onConfirm
98
- }, confirmLabel), /*#__PURE__*/React.createElement(Button, {
134
+ }, confirmLabel), onTryAgain && /*#__PURE__*/React.createElement(Button, {
135
+ className: modules_ae521deb.button,
136
+ "data-test": "auth-dialog-retry-button",
137
+ onClick: () => this.onRetryPress(),
138
+ loader: retrying,
139
+ disabled: retrying
140
+ }, tryAgainLabel), /*#__PURE__*/React.createElement(Button, {
99
141
  className: modules_ae521deb.button,
100
142
  "data-test": "auth-dialog-cancel-button",
101
143
  onClick: onCancel
@@ -116,8 +158,10 @@ _defineProperty(AuthDialog, "propTypes", {
116
158
  cancelOnEsc: PropTypes.bool,
117
159
  confirmLabel: PropTypes.string,
118
160
  cancelLabel: PropTypes.string,
161
+ tryAgainLabel: PropTypes.string,
119
162
  onConfirm: PropTypes.func,
120
- onCancel: PropTypes.func
163
+ onCancel: PropTypes.func,
164
+ onTryAgain: PropTypes.func
121
165
  });
122
166
 
123
167
  _defineProperty(AuthDialog, "defaultProps", {
@@ -21,7 +21,7 @@ import '../_helpers/link.js';
21
21
  import '../heading/heading.js';
22
22
  import 'util-deprecate';
23
23
 
24
- var modules_9c709e64 = {"unit":"8px","p-margin":"10px","inline":"inline_rui_8126","markdown":"markdown_rui_8126 font_rui_750f"};
24
+ var modules_9c709e64 = {"unit":"8px","p-margin":"10px","inline":"inline_rui_b3aa","markdown":"markdown_rui_b3aa font_rui_750f"};
25
25
 
26
26
  /**
27
27
  * @name Markdown
@@ -391,6 +391,16 @@ class Select extends Component {
391
391
  }
392
392
  });
393
393
 
394
+ _defineProperty(this, "_openPopupIfClosed", () => {
395
+ if (this.props.disabled || this.state.showPopup) {
396
+ return;
397
+ }
398
+
399
+ this.props.onBeforeOpen();
400
+
401
+ this._showPopup();
402
+ });
403
+
394
404
  _defineProperty(this, "_filterChangeHandler", e => {
395
405
  this._setFilter(e.target.value, e);
396
406
  });
@@ -137,12 +137,12 @@ class SelectLazy {
137
137
  this.detachEvents();
138
138
 
139
139
  if (this.type === 'dropdown') {
140
- this.ctrl.selectInstance = render(this.reactSelect, this.container); // In "dropdown" mode we don't click select itself, so need to force click handler
141
-
142
- this.ctrl.selectInstance._clickHandler();
140
+ this.ctrl.selectInstance = render(this.reactSelect, this.container);
143
141
  } else {
144
142
  this.ctrl.selectInstance = hydrate(this.reactSelect, this.container);
145
143
  }
144
+
145
+ this.ctrl.selectInstance._openPopupIfClosed();
146
146
  }
147
147
 
148
148
  }