@jetbrains/ring-ui 5.0.137 → 5.0.138

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 (86) hide show
  1. package/components/auth/auth__core.d.ts +1 -1
  2. package/components/auth/auth__core.js +21 -26
  3. package/components/auth-dialog/auth-dialog.js +3 -1
  4. package/components/date-picker/date-input.js +3 -1
  5. package/components/editable-heading/editable-heading.css +7 -3
  6. package/components/editable-heading/editable-heading.js +29 -8
  7. package/components/global/react-render-adapter.js +16 -31
  8. package/components/header/profile.d.ts +54 -1
  9. package/components/header/profile.js +15 -11
  10. package/components/i18n/README.md +3 -0
  11. package/components/i18n/i18n-context.d.ts +54 -0
  12. package/components/i18n/i18n-context.js +3 -0
  13. package/components/i18n/i18n.d.ts +56 -0
  14. package/components/i18n/i18n.js +8 -0
  15. package/components/i18n/messages.json +53 -0
  16. package/components/input/input.d.ts +1 -4
  17. package/components/input/input.js +16 -16
  18. package/components/message/message.d.ts +1 -5
  19. package/components/message/message.js +15 -16
  20. package/components/pager/pager.d.ts +54 -8
  21. package/components/pager/pager.js +10 -12
  22. package/components/query-assist/query-assist.d.ts +1 -5
  23. package/components/query-assist/query-assist.js +30 -29
  24. package/components/select/select.d.ts +2 -4
  25. package/components/select/select.js +14 -11
  26. package/components/select/select__filter.d.ts +0 -1
  27. package/components/select/select__filter.js +4 -2
  28. package/components/user-agreement/user-agreement.d.ts +1 -9
  29. package/components/user-agreement/user-agreement.js +31 -30
  30. package/components/user-card/card.d.ts +65 -13
  31. package/components/user-card/card.js +19 -22
  32. package/dist/_helpers/card.js +19 -28
  33. package/dist/_helpers/select__filter.js +14 -10
  34. package/dist/auth/auth.js +1 -0
  35. package/dist/auth/auth__core.d.ts +1 -1
  36. package/dist/auth/auth__core.js +19 -27
  37. package/dist/auth/landing.js +1 -0
  38. package/dist/auth-dialog/auth-dialog.js +1 -1
  39. package/dist/auth-ng/auth-ng.js +1 -0
  40. package/dist/date-picker/date-input.js +3 -1
  41. package/dist/date-picker/date-picker.js +2 -0
  42. package/dist/date-picker/date-popup.js +2 -0
  43. package/dist/editable-heading/editable-heading.js +32 -9
  44. package/dist/global/react-render-adapter.js +0 -2
  45. package/dist/header/header.js +2 -0
  46. package/dist/header/profile.d.ts +54 -1
  47. package/dist/header/profile.js +22 -15
  48. package/dist/header/smart-profile.js +2 -0
  49. package/dist/header/smart-services.js +1 -0
  50. package/dist/i18n/i18n-context.d.ts +54 -0
  51. package/dist/i18n/i18n-context.js +6 -0
  52. package/dist/i18n/i18n.d.ts +56 -0
  53. package/dist/i18n/i18n.js +114 -0
  54. package/dist/input/input.d.ts +1 -4
  55. package/dist/input/input.js +6 -7
  56. package/dist/message/message.d.ts +1 -5
  57. package/dist/message/message.js +5 -7
  58. package/dist/pager/pager.d.ts +54 -8
  59. package/dist/pager/pager.js +19 -15
  60. package/dist/pager-ng/pager-ng.js +2 -0
  61. package/dist/permissions-ng/permissions-ng.js +1 -0
  62. package/dist/query-assist/query-assist.d.ts +1 -5
  63. package/dist/query-assist/query-assist.js +22 -19
  64. package/dist/query-assist-ng/query-assist-ng.js +2 -0
  65. package/dist/select/select.d.ts +2 -4
  66. package/dist/select/select.js +49 -45
  67. package/dist/select/select__filter.d.ts +0 -1
  68. package/dist/select/select__filter.js +2 -0
  69. package/dist/select/select__popup.js +2 -0
  70. package/dist/select-ng/select-ng.js +2 -0
  71. package/dist/select-ng/select-ng__lazy.js +2 -0
  72. package/dist/style.css +1 -1
  73. package/dist/table-legacy-ng/table-legacy-ng.js +2 -0
  74. package/dist/table-legacy-ng/table-legacy-ng__pager.js +2 -0
  75. package/dist/tags-input/tags-input.js +2 -0
  76. package/dist/tags-input-ng/tags-input-ng.js +2 -0
  77. package/dist/user-agreement/service.js +2 -0
  78. package/dist/user-agreement/user-agreement.d.ts +1 -9
  79. package/dist/user-agreement/user-agreement.js +11 -17
  80. package/dist/user-card/card.d.ts +65 -13
  81. package/dist/user-card/card.js +2 -0
  82. package/dist/user-card/smart-user-card-tooltip.js +2 -0
  83. package/dist/user-card/tooltip.js +2 -0
  84. package/dist/user-card/user-card.js +2 -0
  85. package/dist/user-card-ng/user-card-ng.js +2 -0
  86. package/package.json +22 -22
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes, PureComponent, ReactElement } from 'react';
1
+ import React, { HTMLAttributes, PureComponent, ReactElement } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  export interface UserCardUser {
4
4
  name: string;
@@ -22,7 +22,8 @@ export interface UserCardWording {
22
22
  }
23
23
  export interface UserCardProps extends HTMLAttributes<HTMLDivElement> {
24
24
  user: UserCardUser;
25
- wording: UserCardWording;
25
+ wording?: UserCardWording | null | undefined;
26
+ translations?: UserCardWording | null | undefined;
26
27
  info?: ReactElement | readonly ReactElement[] | string;
27
28
  avatarInfo?: ReactElement | readonly ReactElement[] | string;
28
29
  'data-test'?: string | null | undefined;
@@ -52,18 +53,69 @@ export default class UserCard extends PureComponent<UserCardProps> {
52
53
  copingToClipboardError: PropTypes.Requireable<string>;
53
54
  unverified: PropTypes.Requireable<string>;
54
55
  }>>;
56
+ translations: PropTypes.Requireable<PropTypes.InferProps<{
57
+ banned: PropTypes.Validator<string>;
58
+ online: PropTypes.Validator<string>;
59
+ offline: PropTypes.Validator<string>;
60
+ copyToClipboard: PropTypes.Requireable<string>;
61
+ copiedToClipboard: PropTypes.Requireable<string>;
62
+ copingToClipboardError: PropTypes.Requireable<string>;
63
+ unverified: PropTypes.Requireable<string>;
64
+ }>>;
55
65
  };
56
- static defaultProps: {
57
- wording: {
58
- banned: string;
59
- online: string;
60
- offline: string;
61
- copyToClipboard: string;
62
- copiedToClipboard: string;
63
- copingToClipboardError: string;
64
- unverified: string;
65
- };
66
- };
66
+ static contextType: React.Context<{
67
+ login: string;
68
+ logout: string;
69
+ loginTo: string;
70
+ ok: string;
71
+ cancel: string;
72
+ tryAgainLabel: string;
73
+ postpone: string;
74
+ youHaveLoggedInAs: string;
75
+ applyChange: string;
76
+ backendIsNotAvailable: string;
77
+ checkAgain: string;
78
+ nothingHappensLink: string;
79
+ errorMessage: string;
80
+ applyChangedUser: string;
81
+ profile: string;
82
+ switchUser: string;
83
+ addFirstDate: string;
84
+ addSecondDate: string;
85
+ addTime: string;
86
+ selectName: string;
87
+ setDate: string;
88
+ setDateTime: string;
89
+ setPeriod: string;
90
+ clear: string;
91
+ gotIt: string;
92
+ dismiss: string;
93
+ perPage: string;
94
+ firstPage: string;
95
+ lastPage: string;
96
+ nextPage: string;
97
+ previousPage: string;
98
+ searchTitle: string;
99
+ clearTitle: string;
100
+ userAgreement: string;
101
+ accept: string;
102
+ decline: string;
103
+ close: string;
104
+ scrollToAccept: string;
105
+ remindLater: string;
106
+ filterItems: string;
107
+ selectOption: string;
108
+ progress: string;
109
+ loading: string;
110
+ noOptionsFound: string;
111
+ banned: string;
112
+ online: string;
113
+ offline: string;
114
+ copyToClipboard: string;
115
+ copiedToClipboard: string;
116
+ copingToClipboardError: string;
117
+ unverified: string;
118
+ }>;
67
119
  copyEmail: () => void;
68
120
  render(): JSX.Element;
69
121
  }
@@ -7,7 +7,17 @@ import Link from '../link/link';
7
7
  import clipboard from '../clipboard/clipboard';
8
8
  import badgeStyles from '../badge/badge.css';
9
9
  import Icon, { Size as IconSize } from '../icon/icon';
10
+ import { I18nContext } from '../i18n/i18n-context';
10
11
  import styles from './user-card.css';
12
+ const translationsShape = PropTypes.shape({
13
+ banned: PropTypes.string.isRequired,
14
+ online: PropTypes.string.isRequired,
15
+ offline: PropTypes.string.isRequired,
16
+ copyToClipboard: PropTypes.string,
17
+ copiedToClipboard: PropTypes.string,
18
+ copingToClipboardError: PropTypes.string,
19
+ unverified: PropTypes.string
20
+ });
11
21
  class UserCard extends PureComponent {
12
22
  static propTypes = {
13
23
  children: PropTypes.node,
@@ -24,34 +34,21 @@ class UserCard extends PureComponent {
24
34
  banReason: PropTypes.string,
25
35
  unverifiedEmail: PropTypes.bool
26
36
  }).isRequired,
27
- wording: PropTypes.shape({
28
- banned: PropTypes.string.isRequired,
29
- online: PropTypes.string.isRequired,
30
- offline: PropTypes.string.isRequired,
31
- copyToClipboard: PropTypes.string,
32
- copiedToClipboard: PropTypes.string,
33
- copingToClipboardError: PropTypes.string,
34
- unverified: PropTypes.string
35
- })
36
- };
37
- static defaultProps = {
38
- wording: {
39
- banned: 'banned',
40
- online: 'online',
41
- offline: 'offline',
42
- copyToClipboard: 'Copy email to clipboard',
43
- copiedToClipboard: 'Email was copied to clipboard',
44
- copingToClipboardError: 'Failed to copy to clipboard',
45
- unverified: 'Unverified'
46
- }
37
+ wording: translationsShape,
38
+ translations: translationsShape
47
39
  };
40
+ static contextType = I18nContext;
48
41
  copyEmail = () => {
49
- const wording = { ...UserCard.defaultProps.wording, ...this.props.wording };
42
+ const messages = this.context;
43
+ const messageOverrides = this.props.wording || this.props.translations;
44
+ const wording = messageOverrides ?? messages;
50
45
  clipboard.copyText(this.props.user.email || '', wording.copiedToClipboard, wording.copingToClipboardError);
51
46
  };
52
47
  render() {
53
48
  const { children, info, className, user, avatarInfo, ...restProps } = this.props;
54
- const wording = { ...UserCard.defaultProps.wording, ...this.props.wording };
49
+ const messages = this.context;
50
+ const messageOverrides = this.props.wording || this.props.translations;
51
+ const wording = messageOverrides ?? messages;
55
52
  const classes = classNames(className, {});
56
53
  const userActiveStatusClasses = classNames(styles.userActiveStatus, user.online ? styles.online : '');
57
54
  return (<div className={classes} {...restProps}>
@@ -8,10 +8,20 @@ import Link from '../link/link.js';
8
8
  import clipboard from '../clipboard/clipboard.js';
9
9
  import { m as modules_6c9187df } from './badge.js';
10
10
  import Icon from '../icon/icon.js';
11
+ import { I18nContext } from '../i18n/i18n-context.js';
11
12
  import { Size as Size$1 } from '../icon/icon__constants.js';
12
13
 
13
14
  var modules_a4196c17 = {"unit":"i__const_unit_0","light":"light_rui_6e59","userCardSpaced":"userCardSpaced_rui_6e59","userInformationContainer":"userInformationContainer_rui_6e59","userAvatar":"userAvatar_rui_6e59","userInformation":"userInformation_rui_6e59","userInformationGeneral":"userInformationGeneral_rui_6e59","userNameLine":"userNameLine_rui_6e59","userName":"userName_rui_6e59","userLogin":"userLogin_rui_6e59","userEmail":"userEmail_rui_6e59","userCopyIcon":"userCopyIcon_rui_6e59","userEmailWrapper":"userEmailWrapper_rui_6e59","unverifiedLabel":"unverifiedLabel_rui_6e59","userNameInfo":"userNameInfo_rui_6e59","userActiveStatus":"userActiveStatus_rui_6e59","online":"online_rui_6e59"};
14
15
 
16
+ const translationsShape = PropTypes.shape({
17
+ banned: PropTypes.string.isRequired,
18
+ online: PropTypes.string.isRequired,
19
+ offline: PropTypes.string.isRequired,
20
+ copyToClipboard: PropTypes.string,
21
+ copiedToClipboard: PropTypes.string,
22
+ copingToClipboardError: PropTypes.string,
23
+ unverified: PropTypes.string
24
+ });
15
25
  class UserCard extends PureComponent {
16
26
  static propTypes = {
17
27
  children: PropTypes.node,
@@ -28,32 +38,14 @@ class UserCard extends PureComponent {
28
38
  banReason: PropTypes.string,
29
39
  unverifiedEmail: PropTypes.bool
30
40
  }).isRequired,
31
- wording: PropTypes.shape({
32
- banned: PropTypes.string.isRequired,
33
- online: PropTypes.string.isRequired,
34
- offline: PropTypes.string.isRequired,
35
- copyToClipboard: PropTypes.string,
36
- copiedToClipboard: PropTypes.string,
37
- copingToClipboardError: PropTypes.string,
38
- unverified: PropTypes.string
39
- })
40
- };
41
- static defaultProps = {
42
- wording: {
43
- banned: 'banned',
44
- online: 'online',
45
- offline: 'offline',
46
- copyToClipboard: 'Copy email to clipboard',
47
- copiedToClipboard: 'Email was copied to clipboard',
48
- copingToClipboardError: 'Failed to copy to clipboard',
49
- unverified: 'Unverified'
50
- }
41
+ wording: translationsShape,
42
+ translations: translationsShape
51
43
  };
44
+ static contextType = I18nContext;
52
45
  copyEmail = () => {
53
- const wording = {
54
- ...UserCard.defaultProps.wording,
55
- ...this.props.wording
56
- };
46
+ const messages = this.context;
47
+ const messageOverrides = this.props.wording || this.props.translations;
48
+ const wording = messageOverrides !== null && messageOverrides !== void 0 ? messageOverrides : messages;
57
49
  clipboard.copyText(this.props.user.email || '', wording.copiedToClipboard, wording.copingToClipboardError);
58
50
  };
59
51
  render() {
@@ -65,10 +57,9 @@ class UserCard extends PureComponent {
65
57
  avatarInfo,
66
58
  ...restProps
67
59
  } = this.props;
68
- const wording = {
69
- ...UserCard.defaultProps.wording,
70
- ...this.props.wording
71
- };
60
+ const messages = this.context;
61
+ const messageOverrides = this.props.wording || this.props.translations;
62
+ const wording = messageOverrides !== null && messageOverrides !== void 0 ? messageOverrides : messages;
72
63
  const classes = classNames(className, {});
73
64
  const userActiveStatusClasses = classNames(modules_a4196c17.userActiveStatus, user.online ? modules_a4196c17.online : '');
74
65
  return /*#__PURE__*/React.createElement("div", _extends({
@@ -5,13 +5,13 @@ import classNames from 'classnames';
5
5
  import { Input } from '../input/input.js';
6
6
  import sniffr from '../global/sniffer.js';
7
7
  import { ActiveItemContext } from '../list/list.js';
8
+ import { I18nContext } from '../i18n/i18n-context.js';
8
9
 
9
10
  var modules_b607bec2 = {"unit":"i__const_unit_0","filterWithTagsFocused":"filterWithTagsFocused_rui_531d","light":"light_rui_531d","filterWithTags":"filterWithTags_rui_531d","filterWrapper":"filterWrapper_rui_531d","filterWithTagsInput":"filterWithTagsInput_rui_531d","filter":"filter_rui_531d","filterIcon":"filterIcon_rui_531d","bottomLine":"bottomLine_rui_531d","message":"message_rui_531d","selectAll":"selectAll_rui_531d"};
10
11
 
11
12
  function noop() {}
12
13
  class SelectFilter extends Component {
13
14
  static defaultProps = {
14
- placeholder: 'Filter items',
15
15
  inputRef: noop
16
16
  };
17
17
  componentWillUnmount() {
@@ -42,15 +42,19 @@ class SelectFilter extends Component {
42
42
  ...restProps
43
43
  } = this.props;
44
44
  const classes = classNames(modules_b607bec2.filter, className);
45
- return /*#__PURE__*/React.createElement(ActiveItemContext.ValueContext.Consumer, null, activeItemId => /*#__PURE__*/React.createElement(Input, _extends({}, restProps, {
46
- "aria-owns": listId,
47
- "aria-activedescendant": activeItemId,
48
- autoComplete: "off",
49
- autoFocus: true,
50
- borderless: true,
51
- inputRef: this.inputRef,
52
- className: classes
53
- })));
45
+ return /*#__PURE__*/React.createElement(ActiveItemContext.ValueContext.Consumer, null, activeItemId => /*#__PURE__*/React.createElement(I18nContext.Consumer, null, messages => {
46
+ var _restProps$placeholde;
47
+ return /*#__PURE__*/React.createElement(Input, _extends({}, restProps, {
48
+ placeholder: (_restProps$placeholde = restProps.placeholder) !== null && _restProps$placeholde !== void 0 ? _restProps$placeholde : messages.filterItems,
49
+ "aria-owns": listId,
50
+ "aria-activedescendant": activeItemId,
51
+ autoComplete: "off",
52
+ autoFocus: true,
53
+ borderless: true,
54
+ inputRef: this.inputRef,
55
+ className: classes
56
+ }));
57
+ }));
54
58
  }
55
59
  }
56
60
  SelectFilter.propTypes = {
package/dist/auth/auth.js CHANGED
@@ -53,6 +53,7 @@ import '../_helpers/group.js';
53
53
  import '../global/listeners.js';
54
54
  import '../http/http.js';
55
55
  import '../global/promise-with-timeout.js';
56
+ import '../i18n/i18n.js';
56
57
  import './storage.js';
57
58
  import '../storage/storage.js';
58
59
  import '../storage/storage__local.js';
@@ -77,7 +77,7 @@ export interface AuthConfig extends TokenValidatorConfig {
77
77
  checkBackendIsUp: () => Promise<unknown>;
78
78
  onBackendDown: (params: BackendDownParams) => () => void;
79
79
  defaultExpiresIn: number;
80
- translations: AuthTranslations;
80
+ translations?: AuthTranslations | null | undefined;
81
81
  userParams?: RequestParams | undefined;
82
82
  waitForRedirectTimeout: number;
83
83
  }
@@ -2,6 +2,7 @@ import { getAbsoluteBaseURL, fixUrl } from '../global/url.js';
2
2
  import Listeners from '../global/listeners.js';
3
3
  import HTTP from '../http/http.js';
4
4
  import promiseWithTimeout from '../global/promise-with-timeout.js';
5
+ import { getTranslations } from '../i18n/i18n.js';
5
6
  import AuthStorage from './storage.js';
6
7
  import AuthResponseParser from './response-parser.js';
7
8
  import AuthRequestBuilder from './request-builder.js';
@@ -90,19 +91,7 @@ const DEFAULT_CONFIG = {
90
91
  onBackendDown: () => () => {},
91
92
  defaultExpiresIn: DEFAULT_EXPIRES_TIMEOUT,
92
93
  waitForRedirectTimeout: DEFAULT_WAIT_FOR_REDIRECT_TIMEOUT,
93
- translations: {
94
- login: 'Log in',
95
- loginTo: 'Log in to %serviceName%',
96
- cancel: 'Cancel',
97
- tryAgainLabel: 'Try again',
98
- postpone: 'Postpone',
99
- youHaveLoggedInAs: 'You have logged in as another user: %userName%',
100
- applyChange: 'Apply change',
101
- backendIsNotAvailable: 'Connection lost',
102
- checkAgain: 'try again',
103
- nothingHappensLink: 'Click here if nothing happens',
104
- errorMessage: 'There may be a problem with your network connection. Make sure that you are online and'
105
- }
94
+ translations: null
106
95
  };
107
96
  class Auth {
108
97
  static DEFAULT_CONFIG = DEFAULT_CONFIG;
@@ -190,7 +179,8 @@ class Auth {
190
179
  }
191
180
  this._backgroundFlow = new BackgroundFlow(this._requestBuilder, this._storage, backgroundRefreshTimeout);
192
181
  if (this.config.EmbeddedLoginFlow) {
193
- this._embeddedFlow = new this.config.EmbeddedLoginFlow(this._requestBuilder, this._storage, this.config.translations);
182
+ var _this$config$translat;
183
+ this._embeddedFlow = new this.config.EmbeddedLoginFlow(this._requestBuilder, this._storage, (_this$config$translat = this.config.translations) !== null && _this$config$translat !== void 0 ? _this$config$translat : getTranslations());
194
184
  }
195
185
  const API_BASE = this.config.serverUri + Auth.API_PATH;
196
186
  const fetchConfig = config.fetchCredentials ? {
@@ -567,6 +557,7 @@ class Auth {
567
557
  translations
568
558
  } = this.config;
569
559
  const cancelable = this.user?.guest || canCancel;
560
+ const actualTranslations = translations !== null && translations !== void 0 ? translations : getTranslations();
570
561
  this._createInitDeferred();
571
562
  const closeDialog = () => {
572
563
  /* eslint-disable @typescript-eslint/no-use-before-define */
@@ -606,11 +597,11 @@ class Auth {
606
597
  };
607
598
  const hide = this._authDialogService?.({
608
599
  ...this._service,
609
- loginCaption: translations.login,
610
- loginToCaption: translations.loginTo,
611
- confirmLabel: translations.login,
612
- tryAgainLabel: translations.tryAgainLabel,
613
- cancelLabel: cancelable ? translations.cancel : translations.postpone,
600
+ loginCaption: actualTranslations.login,
601
+ loginToCaption: actualTranslations.loginTo,
602
+ confirmLabel: actualTranslations.login,
603
+ tryAgainLabel: actualTranslations.tryAgainLabel,
604
+ cancelLabel: cancelable ? actualTranslations.cancel : actualTranslations.postpone,
614
605
  errorMessage: this._extractErrorMessage(error, true),
615
606
  onConfirm,
616
607
  onCancel,
@@ -625,7 +616,7 @@ class Auth {
625
616
  const stopMessageListening = this._storage?.onMessage(Auth.CLOSE_WINDOW_MESSAGE, () => this._embeddedFlow?.stop());
626
617
  }
627
618
  _showUserChangedDialog(_ref) {
628
- var _newUser$name;
619
+ var _newUser$name, _newUser$name2;
629
620
  let {
630
621
  newUser,
631
622
  onApply,
@@ -634,6 +625,7 @@ class Auth {
634
625
  const {
635
626
  translations
636
627
  } = this.config;
628
+ const actualTranslations = translations !== null && translations !== void 0 ? translations : getTranslations();
637
629
  this._createInitDeferred();
638
630
  const done = () => {
639
631
  this._initDeferred?.resolve?.();
@@ -642,12 +634,12 @@ class Auth {
642
634
  };
643
635
  const hide = this._authDialogService?.({
644
636
  ...this._service,
645
- title: translations.youHaveLoggedInAs.replace('%userName%', (_newUser$name = newUser.name) !== null && _newUser$name !== void 0 ? _newUser$name : ''),
646
- loginCaption: translations.login,
647
- loginToCaption: translations.loginTo,
648
- confirmLabel: translations.applyChange,
649
- tryAgainLabel: translations.tryAgainLabel,
650
- cancelLabel: translations.postpone,
637
+ title: actualTranslations.youHaveLoggedInAs.replace('%userName%', (_newUser$name = newUser.name) !== null && _newUser$name !== void 0 ? _newUser$name : '').replace('{{userName}}', (_newUser$name2 = newUser.name) !== null && _newUser$name2 !== void 0 ? _newUser$name2 : ''),
638
+ loginCaption: actualTranslations.login,
639
+ loginToCaption: actualTranslations.loginTo,
640
+ confirmLabel: actualTranslations.applyChange,
641
+ tryAgainLabel: actualTranslations.tryAgainLabel,
642
+ cancelLabel: actualTranslations.postpone,
651
643
  onConfirm: () => {
652
644
  done();
653
645
  onApply();
@@ -714,7 +706,7 @@ class Auth {
714
706
  onCheckAgain,
715
707
  onPostpone,
716
708
  backendError,
717
- translations
709
+ translations: translations !== null && translations !== void 0 ? translations : getTranslations()
718
710
  });
719
711
  window.addEventListener('online', onCheckAgain);
720
712
  function networkWatchdog() {
@@ -55,6 +55,7 @@ import '../group/group.js';
55
55
  import '../_helpers/group.js';
56
56
  import '../global/listeners.js';
57
57
  import '../global/promise-with-timeout.js';
58
+ import '../i18n/i18n.js';
58
59
  import '../storage/storage.js';
59
60
  import '../storage/storage__local.js';
60
61
  import '../storage/storage__fallback.js';
@@ -120,7 +120,7 @@ class AuthDialog extends Component {
120
120
  retrying
121
121
  } = this.state;
122
122
  const defaultTitle = serviceName ? loginToCaption : loginCaption;
123
- const title = (this.props.title || defaultTitle).replace('%serviceName%', serviceName !== null && serviceName !== void 0 ? serviceName : '');
123
+ const title = (this.props.title || defaultTitle).replace('%serviceName%', serviceName !== null && serviceName !== void 0 ? serviceName : '').replace('{{serviceName}}', serviceName !== null && serviceName !== void 0 ? serviceName : '');
124
124
  return /*#__PURE__*/React.createElement(Dialog, {
125
125
  label: title,
126
126
  "data-test": "ring-auth-dialog",
@@ -54,6 +54,7 @@ import '../_helpers/group.js';
54
54
  import '../global/listeners.js';
55
55
  import '../http/http.js';
56
56
  import '../global/promise-with-timeout.js';
57
+ import '../i18n/i18n.js';
57
58
  import '../auth/storage.js';
58
59
  import '../storage/storage.js';
59
60
  import '../storage/storage__local.js';
@@ -19,6 +19,8 @@ import '../global/memoize.js';
19
19
  import '../link/clickableLink.js';
20
20
  import '../_helpers/button__classes.js';
21
21
  import '../global/get-uid.js';
22
+ import '../i18n/i18n-context.js';
23
+ import '../i18n/i18n.js';
22
24
  import '../global/composeRefs.js';
23
25
  import '../_helpers/input.js';
24
26
  import '../input/input-label.js';
@@ -131,7 +133,7 @@ class DateInput extends React.PureComponent {
131
133
  case 'time':
132
134
  return timePlaceholder || translations.addTime;
133
135
  default:
134
- return translations.selectName.replace('%name%', name);
136
+ return translations.selectName.replace('%name%', name).replace('{{name}}', name);
135
137
  }
136
138
  })();
137
139
  const classes = classNames(modules_0c7b7d96.filter, modules_0c7b7d96[`${name}Input`], divider && modules_0c7b7d96[`${name}InputWithDivider`], 'ring-js-shortcuts');
@@ -50,6 +50,8 @@ import '../_helpers/button__classes.js';
50
50
  import '../_helpers/link.js';
51
51
  import '@jetbrains/icons/close-12px';
52
52
  import '../global/prop-types.js';
53
+ import '../i18n/i18n-context.js';
54
+ import '../i18n/i18n.js';
53
55
  import '../global/composeRefs.js';
54
56
  import '../_helpers/input.js';
55
57
  import '../input/input-label.js';
@@ -28,6 +28,8 @@ import '../link/clickableLink.js';
28
28
  import '../global/controls-height.js';
29
29
  import '../_helpers/button__classes.js';
30
30
  import '../global/get-uid.js';
31
+ import '../i18n/i18n-context.js';
32
+ import '../i18n/i18n.js';
31
33
  import '../global/composeRefs.js';
32
34
  import '../_helpers/input.js';
33
35
  import '../input/input-label.js';
@@ -1,5 +1,5 @@
1
1
  import { _ as _extends } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import React from 'react';
2
+ import React, { useEffect } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import Heading, { Levels } from '../heading/heading.js';
5
5
  import { Button } from '../button/button.js';
@@ -20,6 +20,8 @@ import '../global/controls-height.js';
20
20
  import '../_helpers/button__classes.js';
21
21
  import '@jetbrains/icons/close-12px';
22
22
  import '../global/prop-types.js';
23
+ import '../i18n/i18n-context.js';
24
+ import '../i18n/i18n.js';
23
25
  import '../global/composeRefs.js';
24
26
  import '../input/input-label.js';
25
27
  import '../shortcuts/core.js';
@@ -27,7 +29,7 @@ import 'combokeys';
27
29
  import '../global/sniffer.js';
28
30
  import 'sniffr';
29
31
 
30
- var modules_6e69b0fe = {"unit":"i__const_unit_0","editableHeading":"editableHeading_rui_0870","fullSize":"fullSize_rui_0870","isEditing":"isEditing_rui_0870","headingWrapperButton":"headingWrapperButton_rui_0870","disabled":"disabled_rui_0870","heading":"heading_rui_0870","multiline":"multiline_rui_0870","input":"input_rui_0870","error":"error_rui_0870","button":"button_rui_0870","errorText":"errorText_rui_0870","level1":"level1_rui_0870","level2":"level2_rui_0870","level3":"level3_rui_0870","sizeS":"sizeS_rui_0870","sizeM":"sizeM_rui_0870","sizeL":"sizeL_rui_0870","sizeFULL":"sizeFULL_rui_0870"};
32
+ var modules_6e69b0fe = {"unit":"i__const_unit_0","editableHeading":"editableHeading_rui_0870","fullSize":"fullSize_rui_0870","isEditing":"isEditing_rui_0870","headingWrapperButton":"headingWrapperButton_rui_0870","disabled":"disabled_rui_0870","selectionMode":"selectionMode_rui_0870","heading":"heading_rui_0870","multiline":"multiline_rui_0870","input":"input_rui_0870","error":"error_rui_0870","button":"button_rui_0870","errorText":"errorText_rui_0870","level1":"level1_rui_0870","level2":"level2_rui_0870","level3":"level3_rui_0870","sizeS":"sizeS_rui_0870","sizeM":"sizeM_rui_0870","sizeL":"sizeL_rui_0870","sizeFULL":"sizeFULL_rui_0870"};
31
33
 
32
34
  function noop() {}
33
35
  const EditableHeading = props => {
@@ -61,6 +63,8 @@ const EditableHeading = props => {
61
63
  } = props;
62
64
  const [shortcutsScope] = React.useState(getUID('ring-editable-heading-'));
63
65
  const [isInFocus, setIsInFocus] = React.useState(false);
66
+ const [isMouseDown, setIsMouseDown] = React.useState(false);
67
+ const [isInSelectionMode, setIsInSelectionMode] = React.useState(false);
64
68
  const hasError = error !== undefined;
65
69
  const isSaveDisabled = !isSavingPossible || !children || children.trim() === '' || hasError || isSaving;
66
70
  const isCancelDisabled = isSaving;
@@ -80,16 +84,27 @@ const EditableHeading = props => {
80
84
  [modules_6e69b0fe.isEditing]: isEditing,
81
85
  [modules_6e69b0fe.error]: hasError,
82
86
  [modules_6e69b0fe.disabled]: disabled,
83
- [modules_6e69b0fe.multiline]: multiline
87
+ [modules_6e69b0fe.multiline]: multiline,
88
+ [modules_6e69b0fe.selectionMode]: isInSelectionMode
84
89
  });
85
90
  const headingClasses = classNames(modules_6e69b0fe.heading, headingClassName, modules_6e69b0fe[`size${size}`]);
86
91
  const inputClasses = classNames('ring-js-shortcuts', modules_6e69b0fe.input, modules_88cfaf40[`size${size}`], modules_6e69b0fe[`level${level}`], inputClassName);
87
- const onHeadingClick = React.useCallback(() => {
88
- if (disabled) {
89
- return undefined;
92
+ const onHeadingMouseDown = React.useCallback(() => {
93
+ setIsMouseDown(true);
94
+ }, []);
95
+ const onMouseMove = React.useCallback(() => {
96
+ if (!isMouseDown) {
97
+ return;
90
98
  }
91
- return onEdit();
92
- }, [disabled, onEdit]);
99
+ setIsInSelectionMode(true);
100
+ }, [isMouseDown]);
101
+ const onMouseUp = React.useCallback(() => {
102
+ if (isMouseDown && !isInSelectionMode && !disabled) {
103
+ onEdit();
104
+ }
105
+ setIsMouseDown(false);
106
+ setIsInSelectionMode(false);
107
+ }, [isMouseDown, isInSelectionMode, disabled, onEdit]);
93
108
  const onInputFocus = React.useCallback(e => {
94
109
  setIsInFocus(true);
95
110
  onFocus?.(e);
@@ -98,6 +113,14 @@ const EditableHeading = props => {
98
113
  setIsInFocus(false);
99
114
  onBlur?.(e);
100
115
  }, [onBlur]);
116
+ useEffect(() => {
117
+ window.addEventListener('mousemove', onMouseMove);
118
+ window.addEventListener('mouseup', onMouseUp);
119
+ return () => {
120
+ window.removeEventListener('mousemove', onMouseMove);
121
+ window.removeEventListener('mouseup', onMouseUp);
122
+ };
123
+ });
101
124
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
102
125
  className: classes
103
126
  }, !disabled && isEditing ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Shortcuts, {
@@ -116,7 +139,7 @@ const EditableHeading = props => {
116
139
  }))) : /*#__PURE__*/React.createElement("button", {
117
140
  type: "button",
118
141
  className: modules_6e69b0fe.headingWrapperButton,
119
- onClick: onHeadingClick
142
+ onMouseDown: onHeadingMouseDown
120
143
  }, /*#__PURE__*/React.createElement(Heading, {
121
144
  className: headingClasses,
122
145
  level: level,
@@ -4,8 +4,6 @@ import { render as render$1, unmountComponentAtNode as unmountComponentAtNode$1,
4
4
  let render = render$1;
5
5
  let unmountComponentAtNode = unmountComponentAtNode$1;
6
6
  let hydrate = hydrate$1;
7
- /* eslint-enable */
8
-
9
7
  function setClient(_ref) {
10
8
  let {
11
9
  createRoot,
@@ -69,6 +69,8 @@ import '../dropdown/dropdown.js';
69
69
  import '../global/typescript-utils.js';
70
70
  import '../_helpers/anchor.js';
71
71
  import '../popup-menu/popup-menu.js';
72
+ import '../i18n/i18n-context.js';
73
+ import '../i18n/i18n.js';
72
74
  import '../auth/auth.js';
73
75
  import '../auth/window-flow.js';
74
76
  import '../auth/response-parser.js';
@@ -15,7 +15,7 @@ export interface ProfileTranslations {
15
15
  export interface ProfileProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {
16
16
  closeOnSelect: boolean;
17
17
  renderPopupItems: (items: ListDataItem[]) => readonly ListDataItem[];
18
- translations: ProfileTranslations;
18
+ translations?: ProfileTranslations | null | undefined;
19
19
  size: Size;
20
20
  renderGuest: (props: ProfileProps) => ReactNode;
21
21
  hasUpdates?: boolean | null | undefined;
@@ -67,6 +67,59 @@ export default class Profile extends PureComponent<ProfileProps> {
67
67
  renderGuest: PropTypes.Requireable<(...args: any[]) => any>;
68
68
  };
69
69
  static defaultProps: ProfileProps;
70
+ static contextType: React.Context<{
71
+ login: string;
72
+ logout: string;
73
+ loginTo: string;
74
+ ok: string;
75
+ cancel: string;
76
+ tryAgainLabel: string;
77
+ postpone: string;
78
+ youHaveLoggedInAs: string;
79
+ applyChange: string;
80
+ backendIsNotAvailable: string;
81
+ checkAgain: string;
82
+ nothingHappensLink: string;
83
+ errorMessage: string;
84
+ applyChangedUser: string;
85
+ profile: string;
86
+ switchUser: string;
87
+ addFirstDate: string;
88
+ addSecondDate: string;
89
+ addTime: string;
90
+ selectName: string;
91
+ setDate: string;
92
+ setDateTime: string;
93
+ setPeriod: string;
94
+ clear: string;
95
+ gotIt: string;
96
+ dismiss: string;
97
+ perPage: string;
98
+ firstPage: string;
99
+ lastPage: string;
100
+ nextPage: string;
101
+ previousPage: string;
102
+ searchTitle: string;
103
+ clearTitle: string;
104
+ userAgreement: string;
105
+ accept: string;
106
+ decline: string;
107
+ close: string;
108
+ scrollToAccept: string;
109
+ remindLater: string;
110
+ filterItems: string;
111
+ selectOption: string;
112
+ progress: string;
113
+ loading: string;
114
+ noOptionsFound: string;
115
+ banned: string;
116
+ online: string;
117
+ offline: string;
118
+ copyToClipboard: string;
119
+ copiedToClipboard: string;
120
+ copingToClipboardError: string;
121
+ unverified: string;
122
+ }>;
70
123
  static Size: typeof Size;
71
124
  render(): string | number | boolean | JSX.Element | React.ReactFragment | null | undefined;
72
125
  }