@jetbrains/ring-ui-built 7.0.100 → 7.0.102

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.
@@ -45,6 +45,7 @@ export interface TagsInputProps {
45
45
  label?: ReactNode;
46
46
  labelType?: LabelType;
47
47
  id?: string | undefined;
48
+ error?: ReactNode | null | undefined;
48
49
  }
49
50
  interface TagsInputState {
50
51
  tags: TagType[];
@@ -10,8 +10,8 @@ import { S as Size, i as inputStyles } from '../_helpers/input.js';
10
10
  import { ControlsHeightContext } from '../global/controls-height.js';
11
11
  import getUID from '../global/get-uid.js';
12
12
  import { ControlLabel } from '../control-label/control-label.js';
13
+ import ChevronButton from '../select/chevron-button.js';
13
14
  import { jsxs, jsx } from 'react/jsx-runtime';
14
- import '@jetbrains/icons/chevron-down';
15
15
  import '@jetbrains/icons/close-12px';
16
16
  import 'dequal';
17
17
  import '../global/data-tests.js';
@@ -19,6 +19,7 @@ import '../global/typescript-utils.js';
19
19
  import '../_helpers/anchor.js';
20
20
  import 'react-compiler-runtime';
21
21
  import '../button/button.js';
22
+ import '@jetbrains/icons/chevron-down';
22
23
  import '@jetbrains/icons/chevron-12px-down';
23
24
  import 'util-deprecate';
24
25
  import '../icon/icon.js';
@@ -80,13 +81,13 @@ import '../text/text.js';
80
81
  import '../_helpers/select-filter.js';
81
82
  import '../tag/tag.js';
82
83
 
83
- var styles = {"outerContainer":"ring-input-outerContainer","container":"ring-input-container","input":"ring-input-input","tagsInput":"ring-tags-input-tagsInput","tagsInputDisabled":"ring-tags-input-tagsInputDisabled","tagsInputFocused":"ring-tags-input-tagsInputFocused","tagsList":"ring-tags-input-tagsList","tagsSelect":"ring-tags-input-tagsSelect"};
84
+ var styles = {"outerContainer":"ring-input-outerContainer","container":"ring-input-container","input":"ring-input-input","tagsInput":"ring-tags-input-tagsInput","tagsInputDisabled":"ring-tags-input-tagsInputDisabled","tagsInputFocused":"ring-tags-input-tagsInputFocused","tagsList":"ring-tags-input-tagsList","error":"ring-tags-input-error","tagInputChevronButton":"ring-tags-input-tagInputChevronButton","tagsSelect":"ring-tags-input-tagsSelect"};
84
85
 
85
86
  function noop() {}
86
87
  /**
87
88
  * @name Tags Input
88
89
  */
89
- const POPUP_VERTICAL_SHIFT = 2;
90
+ const POPUP_VERTICAL_SHIFT = -2;
90
91
  class TagsInput extends PureComponent {
91
92
  static defaultProps = {
92
93
  dataSource: noop,
@@ -205,7 +206,7 @@ class TagsInput extends PureComponent {
205
206
  }, this.focusInput);
206
207
  }
207
208
  clickHandler = event => {
208
- if (event.target !== this.node && event.target.parentElement !== this.node) {
209
+ if (event.target !== this.node && event.target.parentElement !== this.node && !this.node?.querySelector(`.${styles.tagInputChevronButton}`)?.contains(event.target)) {
209
210
  return;
210
211
  }
211
212
  // eslint-disable-next-line no-underscore-dangle
@@ -341,7 +342,8 @@ class TagsInput extends PureComponent {
341
342
  size,
342
343
  labelType,
343
344
  height = typeof this.context === 'function' ? this.context() : this.context,
344
- label
345
+ label,
346
+ error
345
347
  } = this.props;
346
348
  const classes = classNames(styles.tagsInput, size !== Size.AUTO && [inputStyles[`size${size}`]], [inputStyles[`height${height}`]], {
347
349
  [styles.tagsInputDisabled]: disabled,
@@ -359,16 +361,18 @@ class TagsInput extends PureComponent {
359
361
  disabled: disabled,
360
362
  type: labelType,
361
363
  children: label
362
- }), /*#__PURE__*/jsx(TagsList, {
364
+ }), /*#__PURE__*/jsxs(TagsList, {
363
365
  tags: tags,
364
366
  activeIndex: activeIndex,
365
367
  disabled: disabled,
366
368
  canNotBeEmpty: canNotBeEmpty,
367
369
  handleRemove: this.handleRemove,
368
- className: styles.tagsList,
370
+ className: classNames(styles.tagsList, error != null && styles.error),
369
371
  handleClick: this.handleClick,
370
372
  customTagComponent: this.props.customTagComponent,
371
- children: /*#__PURE__*/jsx(Select, {
373
+ children: [/*#__PURE__*/jsx(ChevronButton, {
374
+ className: styles.tagInputChevronButton
375
+ }), /*#__PURE__*/jsx(Select, {
372
376
  id: this.id,
373
377
  ref: this.selectRef,
374
378
  size: Select.Size.AUTO,
@@ -395,8 +399,10 @@ class TagsInput extends PureComponent {
395
399
  disabled: this.props.disabled,
396
400
  loadingMessage: this.props.loadingMessage,
397
401
  notFoundMessage: this.props.notFoundMessage,
398
- hint: this.props.hint
399
- })
402
+ hint: this.props.hint,
403
+ error: error,
404
+ targetElement: this.node
405
+ })]
400
406
  })]
401
407
  });
402
408
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui-built",
3
- "version": "7.0.100",
3
+ "version": "7.0.102",
4
4
  "description": "JetBrains UI library",
5
5
  "author": {
6
6
  "name": "JetBrains"