@jetbrains/ring-ui 5.0.114 → 5.0.115

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.
@@ -6,6 +6,7 @@
6
6
  .outerContainer {
7
7
  --ring-input-icon-offset: calc(unit * 2.5);
8
8
  --ring-input-padding-inline: unit;
9
+ --ring-input-background-color: var(--ring-content-background-color);
9
10
  }
10
11
 
11
12
  .borderless {
@@ -44,7 +45,7 @@
44
45
  border: 1px solid var(--ring-borders-color);
45
46
  border-radius: var(--ring-border-radius);
46
47
  outline: none;
47
- background: transparent;
48
+ background-color: var(--ring-input-background-color);
48
49
 
49
50
  font: inherit;
50
51
 
@@ -94,6 +95,7 @@
94
95
 
95
96
  .borderless .input {
96
97
  border-color: transparent;
98
+ background-color: transparent;
97
99
  }
98
100
 
99
101
  .withIcon .input {
@@ -2,6 +2,8 @@ import angular from 'angular';
2
2
 
3
3
  import angularDecorator, {APP_NAME} from '../../.storybook/angular-decorator';
4
4
 
5
+ import darkStyles from '../global/variables_dark.css';
6
+
5
7
  import InputNG from './input-ng';
6
8
 
7
9
  export default {
@@ -89,7 +91,7 @@ export const basic = () => {
89
91
  multiline="true"
90
92
  ></rg-input>
91
93
 
92
- <div class="dark">
94
+ <div class="dark ${darkStyles.dark}">
93
95
  <rg-input
94
96
  label="Input on dark background"
95
97
  placeholder="Hint on dark background"
@@ -171,6 +171,10 @@
171
171
  box-shadow: button-shadow var(--ring-main-color);
172
172
  }
173
173
 
174
+ .buttonValueEmpty.buttonValueEmpty {
175
+ color: var(--ring-disabled-color);
176
+ }
177
+
174
178
  .heightS .buttonValue {
175
179
  font-size: var(--ring-font-size);
176
180
  }
@@ -818,7 +818,8 @@ export default class Select extends Component {
818
818
  {shortcutsEnabled && (<Shortcuts map={this.getShortcutsMap()} scope={this.shortcutsScope}/>)}
819
819
  <div className={styles.buttonContainer}>
820
820
  <Button {...ariaProps} height={this.props.height} id={this.props.id} onClick={this._clickHandler} className={classNames(this.props.buttonClassName, styles.buttonValue, {
821
- [styles.buttonValueOpen]: this.state.showPopup
821
+ [styles.buttonValueOpen]: this.state.showPopup,
822
+ [styles.buttonValueEmpty]: this._selectionIsEmpty()
822
823
  })} disabled={this.props.disabled} style={style} data-test="ring-select__button ring-select__focus">
823
824
  {this._getAvatar()}
824
825
  {this._getPlaceholder()}
@@ -57,7 +57,7 @@ export default class UserCard extends PureComponent {
57
57
  return (<div className={classes} {...restProps}>
58
58
  <div className={styles.userInformationContainer}>
59
59
  <div className={styles.userAvatar}>
60
- <Avatar size={AvatarSize.Size56} url={user.avatarUrl}/>
60
+ <Avatar size={AvatarSize.Size56} url={user.avatarUrl} round/>
61
61
  {!!avatarInfo && avatarInfo}
62
62
  </div>
63
63
  <div className={styles.userInformation}>
@@ -46,7 +46,8 @@ class UserCard extends PureComponent {
46
46
  className: modules_a4196c17.userAvatar
47
47
  }, /*#__PURE__*/React.createElement(Avatar, {
48
48
  size: Size.Size56,
49
- url: user.avatarUrl
49
+ url: user.avatarUrl,
50
+ round: true
50
51
  }), !!avatarInfo && avatarInfo), /*#__PURE__*/React.createElement("div", {
51
52
  className: modules_a4196c17.userInformation
52
53
  }, /*#__PURE__*/React.createElement("div", {
@@ -100,6 +100,10 @@ class Alert extends PureComponent {
100
100
  height
101
101
  });
102
102
  });
103
+ /**
104
+ * @param {SyntheticEvent} evt
105
+ * @private
106
+ */
103
107
  _defineProperty(this, "_handleCaptionsLinksClick", evt => {
104
108
  if (evt.target instanceof Element && evt.target.matches('a')) {
105
109
  this.closeRequest(evt);
@@ -128,11 +132,6 @@ class Alert extends PureComponent {
128
132
  this.props.onClose();
129
133
  }, ANIMATION_TIME);
130
134
  }
131
- /**
132
- * @param {SyntheticEvent} evt
133
- * @private
134
- */
135
-
136
135
  /**
137
136
  * @private
138
137
  */
@@ -229,6 +228,7 @@ _defineProperty(Alert, "propTypes", {
229
228
  closeButtonClassName: PropTypes.string,
230
229
  'data-test': PropTypes.string
231
230
  });
231
+ /** @override */
232
232
  _defineProperty(Alert, "defaultProps", {
233
233
  theme: Theme.DARK,
234
234
  closeable: true,
@@ -46,6 +46,7 @@ import '../popup/popup.consts.js';
46
46
  class AlertService {
47
47
  constructor() {
48
48
  _defineProperty(this, "defaultTimeout", 0);
49
+ // This alerts are stored in inverse order (last shown is first in array)
49
50
  _defineProperty(this, "showingAlerts", []);
50
51
  _defineProperty(this, "containerElement", document.createElement('div'));
51
52
  }
@@ -153,6 +153,13 @@ class TokenValidator {
153
153
  }
154
154
  }
155
155
  _defineProperty(TokenValidator, "DEFAULT_REFRESH_BEFORE", 10 * 60);
156
+ // 20 min in s
157
+ /**
158
+ * Error class for auth token validation
159
+ *
160
+ * @param {string} message Error message
161
+ * @param {Error=} cause Error that caused this error
162
+ */
156
163
  _defineProperty(TokenValidator, "TokenValidationError", TokenValidationError);
157
164
 
158
165
  export { TokenValidationError, TokenValidator as default };
@@ -192,6 +192,7 @@ const getContainer = () => disableHoverHOC(selectionShortcutsHOC(focusSensorHOC(
192
192
  class DataListContainer extends Component {
193
193
  constructor() {
194
194
  super(...arguments);
195
+ // https://stackoverflow.com/a/53882322/6304152
195
196
  _defineProperty(this, "DataList", getContainer());
196
197
  }
197
198
  render() {
package/dist/http/http.js CHANGED
@@ -49,6 +49,8 @@ class HTTP {
49
49
  _defineProperty(this, "setBaseUrl", baseUrl => {
50
50
  this.baseUrl = baseUrl;
51
51
  });
52
+ // TODO: Replace any to never/unknown in next release and remove eslint-disable
53
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
54
  _defineProperty(this, "fetch", async function (url) {
53
55
  let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
54
56
  const {
@@ -63,6 +65,8 @@ class HTTP {
63
65
  });
64
66
  return _this._processResponse(response);
65
67
  });
68
+ // TODO: Replace any to never/unknown in next release and remove eslint-disable
69
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
70
  _defineProperty(this, "request", async (url, params) => {
67
71
  let token = await this.requestToken?.();
68
72
  let response = await this._performRequest(url, token, params);
@@ -83,22 +87,34 @@ class HTTP {
83
87
  }
84
88
  });
85
89
  _defineProperty(this, "getMetaForResponse", response => this._requestsMeta.get(response));
90
+ // TODO: Replace any to never/unknown in next release and remove eslint-disable
91
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
86
92
  _defineProperty(this, "get", (url, params) => this.request(url, {
87
93
  ...params,
88
94
  method: 'GET'
89
95
  }));
96
+ // TODO: Replace any to never/unknown in next release and remove eslint-disable
97
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
90
98
  _defineProperty(this, "post", (url, params) => this.request(url, {
91
99
  ...params,
92
100
  method: 'POST'
93
101
  }));
102
+ // TODO: Replace any to never/unknown in next release and remove eslint-disable
103
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
94
104
  _defineProperty(this, "delete", (url, params) => this.request(url, {
95
105
  ...params,
96
106
  method: 'DELETE'
97
107
  }));
108
+ // TODO: Replace any to never/unknown in next release and remove eslint-disable
109
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
98
110
  _defineProperty(this, "put", (url, params) => this.request(url, {
99
111
  ...params,
100
112
  method: 'PUT'
101
113
  }));
114
+ /**
115
+ * Usage: const {promise, abort} = http.abortify(http.get<{id: string}>)('http://test.com');
116
+ * @param method
117
+ */
102
118
  _defineProperty(this, "abortify", method => function () {
103
119
  for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
104
120
  _ref[_key] = arguments[_key];
@@ -217,15 +233,10 @@ class HTTP {
217
233
  static _isErrorStatus(status) {
218
234
  return status < STATUS_OK_IF_MORE_THAN || status >= STATUS_BAD_IF_MORE_THAN;
219
235
  }
220
- // TODO: Replace any to never/unknown in next release and remove eslint-disable
221
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
222
-
223
236
  async authorizedFetch() {
224
237
  const response = await this._performRequest(...arguments);
225
238
  return this._processResponse(response);
226
239
  }
227
- // TODO: Replace any to never/unknown in next release and remove eslint-disable
228
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
229
240
  }
230
241
 
231
242
  export { CODE, HTTPError, HTTP as default, defaultFetchConfig };
package/dist/list/list.js CHANGED
@@ -110,7 +110,10 @@ class List extends Component {
110
110
  }
111
111
  })));
112
112
  _defineProperty(this, "_activatableItems", false);
113
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
113
114
  _defineProperty(this, "_bufferSize", 10);
115
+ // keep X items above and below of the visible area
116
+ // reuse size cache for similar items
114
117
  _defineProperty(this, "sizeCacheKey", index => {
115
118
  if (index === 0 || index === this.props.data.length + 1) {
116
119
  return Type.MARGIN;
@@ -103,6 +103,10 @@ class Popup extends PureComponent {
103
103
  this.props.onEscPress(evt);
104
104
  this._onCloseAttempt(evt, true);
105
105
  });
106
+ /**
107
+ * @param {jQuery.Event} evt
108
+ * @private
109
+ */
106
110
  _defineProperty(this, "_onDocumentClick", evt => {
107
111
  if (this.container && evt.target instanceof Node && this.container.contains(evt.target) || !this._listenersEnabled || this.props.dontCloseOnAnchorClick && evt.target instanceof Node && this._getAnchor()?.contains(evt.target)) {
108
112
  return;
@@ -150,6 +150,7 @@ class QueryAssist extends Component {
150
150
  _defineProperty(this, "immediateState", void 0);
151
151
  _defineProperty(this, "requestData", void 0);
152
152
  _defineProperty(this, "ngModelStateField", ngModelStateField);
153
+ // An array of {query: string; caret: number}[]
153
154
  _defineProperty(this, "historyStack", []);
154
155
  _defineProperty(this, "mouseIsDownOnPopup", void 0);
155
156
  _defineProperty(this, "handleFocusChange", e => {
@@ -248,6 +249,7 @@ class QueryAssist extends Component {
248
249
  this.requestData?.();
249
250
  }
250
251
  });
252
+ // It's necessary to prevent new element creation before any other hooks
251
253
  _defineProperty(this, "handleEnter", e => {
252
254
  if (e.key === 'Enter') {
253
255
  preventDefault(e);
@@ -79,7 +79,7 @@ import '../caret/caret.js';
79
79
  import '../text/text.js';
80
80
  import '../_helpers/select__filter.js';
81
81
 
82
- var modules_9d0de074 = {"unit":"8px","button-shadow":"inset 0 0 0 1px","select":"select_rui_11de","value":"value_rui_11de ellipsis_rui_8bff font_rui_8bff","icons":"icons_rui_11de","light":"light_rui_11de","toolbar":"toolbar_rui_11de","button":"button_rui_11de","buttonSpaced":"buttonSpaced_rui_11de","inputMode":"inputMode_rui_11de","selectedIcon":"selectedIcon_rui_11de resetButton_rui_8bff","clearIcon":"clearIcon_rui_11de","sizeS":"sizeS_rui_11de","sizeM":"sizeM_rui_11de","sizeL":"sizeL_rui_11de","sizeFULL":"sizeFULL_rui_11de","sizeAUTO":"sizeAUTO_rui_11de","buttonMode":"buttonMode_rui_11de","open":"open_rui_11de","buttonContainer":"buttonContainer_rui_11de","buttonValue":"buttonValue_rui_11de ellipsis_rui_8bff","buttonValueOpen":"buttonValueOpen_rui_11de","heightS":"heightS_rui_11de","label":"label_rui_11de","disabled":"disabled_rui_11de","avatar":"avatar_rui_11de","popup":"popup_rui_11de","chevron":"chevron_rui_11de","chevronIcon":"chevronIcon_rui_11de"};
82
+ var modules_9d0de074 = {"unit":"8px","button-shadow":"inset 0 0 0 1px","select":"select_rui_11de","value":"value_rui_11de ellipsis_rui_8bff font_rui_8bff","icons":"icons_rui_11de","light":"light_rui_11de","toolbar":"toolbar_rui_11de","button":"button_rui_11de","buttonSpaced":"buttonSpaced_rui_11de","inputMode":"inputMode_rui_11de","selectedIcon":"selectedIcon_rui_11de resetButton_rui_8bff","clearIcon":"clearIcon_rui_11de","sizeS":"sizeS_rui_11de","sizeM":"sizeM_rui_11de","sizeL":"sizeL_rui_11de","sizeFULL":"sizeFULL_rui_11de","sizeAUTO":"sizeAUTO_rui_11de","buttonMode":"buttonMode_rui_11de","open":"open_rui_11de","buttonContainer":"buttonContainer_rui_11de","buttonValue":"buttonValue_rui_11de ellipsis_rui_8bff","buttonValueOpen":"buttonValueOpen_rui_11de","buttonValueEmpty":"buttonValueEmpty_rui_11de","heightS":"heightS_rui_11de","label":"label_rui_11de","disabled":"disabled_rui_11de","avatar":"avatar_rui_11de","popup":"popup_rui_11de","chevron":"chevron_rui_11de","chevronIcon":"chevronIcon_rui_11de"};
83
83
 
84
84
  /**
85
85
  * @name Select
@@ -995,7 +995,8 @@ class Select extends Component {
995
995
  id: this.props.id,
996
996
  onClick: this._clickHandler,
997
997
  className: classNames(this.props.buttonClassName, modules_9d0de074.buttonValue, {
998
- [modules_9d0de074.buttonValueOpen]: this.state.showPopup
998
+ [modules_9d0de074.buttonValueOpen]: this.state.showPopup,
999
+ [modules_9d0de074.buttonValueEmpty]: this._selectionIsEmpty()
999
1000
  }),
1000
1001
  disabled: this.props.disabled,
1001
1002
  style: style,
@@ -85,6 +85,7 @@ class SelectPopup extends PureComponent {
85
85
  tagsActiveIndex: null
86
86
  });
87
87
  _defineProperty(this, "isClickingPopup", false);
88
+ // This flag is set to true while an item in the popup is being clicked
88
89
  _defineProperty(this, "filter", void 0);
89
90
  _defineProperty(this, "caret", void 0);
90
91
  _defineProperty(this, "onFilterFocus", () => {
@@ -150,6 +151,10 @@ class SelectPopup extends PureComponent {
150
151
  info: true
151
152
  }, `${this.props.selected.length} selected`));
152
153
  });
154
+ // Cache the value because this method is called
155
+ // inside `render` function which can be called N times
156
+ // and should be fast as possible.
157
+ // Cache invalidates each time hidden or userDefinedMaxHeight changes
153
158
  _defineProperty(this, "_adjustListMaxHeight", memoizeOne((hidden, userDefinedMaxHeight, ringPopupTarget) => {
154
159
  if (hidden) {
155
160
  return userDefinedMaxHeight;