@jetbrains/ring-ui 5.0.63 → 5.0.65

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.
@@ -36,6 +36,10 @@
36
36
  &:focus {
37
37
  outline: 1px solid var(--ring-border-hover-color);
38
38
  }
39
+
40
+ @nest .disabled &:focus {
41
+ outline: none;
42
+ }
39
43
  }
40
44
 
41
45
  .heading {
@@ -94,6 +94,7 @@ export interface BaseSelectProps<T = unknown> {
94
94
  left?: number | undefined;
95
95
  renderOptimization?: boolean | undefined;
96
96
  ringPopupTarget?: string | null | undefined;
97
+ error?: ReactNode | null | undefined;
97
98
  hint?: ReactNode;
98
99
  add?: Add | null | undefined;
99
100
  compact?: boolean | null | undefined;
@@ -19,6 +19,7 @@ import fuzzyHighlight from '../global/fuzzy-highlight';
19
19
  import memoize from '../global/memoize';
20
20
  import { isArray } from '../global/typescript-utils';
21
21
  import { ControlsHeight, ControlsHeightContext } from '../global/controls-height';
22
+ import inputStyles from '../input/input.css';
22
23
  import SelectPopup from './select__popup';
23
24
  import styles from './select.css';
24
25
  /**
@@ -793,16 +794,23 @@ export default class Select extends Component {
793
794
  };
794
795
  switch (this.props.type) {
795
796
  case Type.INPUT_WITHOUT_CONTROLS:
796
- case Type.INPUT: return (<div ref={this.nodeRef} className={classNames(classes, styles.inputMode)} data-test={dataTests('ring-select', dataTest)}>
797
- {shortcutsEnabled && (<Shortcuts map={this.getShortcutsMap()} scope={this.shortcutsScope}/>)}
798
- <Input {...ariaProps} height={this.props.height} autoComplete="off" id={this.props.id} onClick={this._clickHandler} inputRef={this.filterRef} disabled={this.props.disabled} value={this.state.filterValue} borderless={this.props.type === Type.INPUT_WITHOUT_CONTROLS} style={style} size={Size.FULL} onChange={this._filterChangeHandler} onFocus={this._focusHandler} onBlur={this._blurHandler} label={this.props.type === Type.INPUT ? this._getLabel() : null} placeholder={this.props.inputPlaceholder} onKeyDown={this.props.onKeyDown} data-test="ring-select__focus" enableShortcuts={shortcutsEnabled
797
+ case Type.INPUT: return (<>
798
+ <div ref={this.nodeRef} className={classNames(classes, styles.inputMode)} data-test={dataTests('ring-select', dataTest)}>
799
+ {shortcutsEnabled && (<Shortcuts map={this.getShortcutsMap()} scope={this.shortcutsScope}/>)}
800
+ <Input {...ariaProps} height={this.props.height} autoComplete="off" id={this.props.id} onClick={this._clickHandler} inputRef={this.filterRef} disabled={this.props.disabled} value={this.state.filterValue} borderless={this.props.type === Type.INPUT_WITHOUT_CONTROLS} style={style} size={Size.FULL} onChange={this._filterChangeHandler} onFocus={this._focusHandler} onBlur={this._blurHandler}
801
+ // Input with error style without description
802
+ error={this.props.error != null ? '' : null} label={this.props.type === Type.INPUT ? this._getLabel() : null} placeholder={this.props.inputPlaceholder} onKeyDown={this.props.onKeyDown} data-test="ring-select__focus" enableShortcuts={shortcutsEnabled
799
803
  ? Object.keys({
800
804
  ...this.getShortcutsMap(),
801
805
  ...this._popup?.list?.shortcutsMap
802
806
  })
803
807
  : undefined} afterInput={this.props.type === Type.INPUT && iconsNode}/>
804
- {this._renderPopup()}
805
- </div>);
808
+ {this._renderPopup()}
809
+ </div>
810
+ {this.props.error && (<div className={classNames(inputStyles.errorText, inputStyles[`size${this.props.size}`])}>
811
+ {this.props.error}
812
+ </div>)}
813
+ </>);
806
814
  case Type.BUTTON:
807
815
  return (<div ref={this.nodeRef} className={classNames(classes, styles.buttonMode)} data-test={dataTests('ring-select', dataTest)}>
808
816
  {selectedLabel && (<InputLabel label={selectedLabel} disabled={this.props.disabled} htmlFor={this.props.id}/>)}
@@ -898,6 +906,7 @@ Select.propTypes = {
898
906
  left: PropTypes.number,
899
907
  renderOptimization: PropTypes.bool,
900
908
  ringPopupTarget: PropTypes.string,
909
+ error: PropTypes.bool,
901
910
  hint: List.ListHint.propTypes.label,
902
911
  add: PropTypes.object,
903
912
  type: PropTypes.oneOf(Object.values(Type)),
@@ -75,16 +75,15 @@
75
75
 
76
76
  color: var(--ring-heading-color);
77
77
 
78
- font-size: calc(3 * unit);
79
- font-weight: normal;
80
- line-height: 28px;
78
+ font-size: 20px;
79
+ line-height: 24px;
81
80
  }
82
81
 
83
82
  :global(.ring-sidebar__title .tag-flag) {
84
83
  vertical-align: bottom;
85
84
  }
86
85
 
87
- .ring-sidebar__avatar ~ .ring-sidebar__title {
86
+ :global(.ring-sidebar__avatar ~ .ring-sidebar__title) {
88
87
  margin-bottom: 42px;
89
88
  }
90
89
 
@@ -94,6 +94,7 @@ export interface BaseSelectProps<T = unknown> {
94
94
  left?: number | undefined;
95
95
  renderOptimization?: boolean | undefined;
96
96
  ringPopupTarget?: string | null | undefined;
97
+ error?: ReactNode | null | undefined;
97
98
  hint?: ReactNode;
98
99
  add?: Add | null | undefined;
99
100
  compact?: boolean | null | undefined;
@@ -20,6 +20,7 @@ import fuzzyHighlight from '../global/fuzzy-highlight.js';
20
20
  import memoize from '../global/memoize.js';
21
21
  import { isArray } from '../global/typescript-utils.js';
22
22
  import { ControlsHeight, ControlsHeightContext } from '../global/controls-height.js';
23
+ import { m as modules_88cfaf40 } from '../_helpers/input.js';
23
24
  import SelectPopup from './select__popup.js';
24
25
  import { A as Anchor } from '../_helpers/anchor.js';
25
26
  import '@jetbrains/icons/chevron-10px';
@@ -67,7 +68,6 @@ import '../list/list__hint.js';
67
68
  import '../list/consts.js';
68
69
  import '../global/prop-types.js';
69
70
  import '../global/composeRefs.js';
70
- import '../_helpers/input.js';
71
71
  import '../global/react-render-adapter.js';
72
72
  import '@jetbrains/icons/search';
73
73
  import '../loader-inline/loader-inline.js';
@@ -944,7 +944,7 @@ class Select extends Component {
944
944
  switch (this.props.type) {
945
945
  case Type.INPUT_WITHOUT_CONTROLS:
946
946
  case Type.INPUT:
947
- return /*#__PURE__*/React.createElement("div", {
947
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
948
948
  ref: this.nodeRef,
949
949
  className: classNames(classes, modules_9d0de074.inputMode),
950
950
  "data-test": joinDataTestAttributes('ring-select', dataTest)
@@ -964,7 +964,10 @@ class Select extends Component {
964
964
  size: Size.FULL,
965
965
  onChange: this._filterChangeHandler,
966
966
  onFocus: this._focusHandler,
967
- onBlur: this._blurHandler,
967
+ onBlur: this._blurHandler
968
+ // Input with error style without description
969
+ ,
970
+ error: this.props.error != null ? '' : null,
968
971
  label: this.props.type === Type.INPUT ? this._getLabel() : null,
969
972
  placeholder: this.props.inputPlaceholder,
970
973
  onKeyDown: this.props.onKeyDown,
@@ -974,7 +977,9 @@ class Select extends Component {
974
977
  ...((_this$_popup5 = this._popup) === null || _this$_popup5 === void 0 ? void 0 : (_this$_popup5$list = _this$_popup5.list) === null || _this$_popup5$list === void 0 ? void 0 : _this$_popup5$list.shortcutsMap)
975
978
  }) : undefined,
976
979
  afterInput: this.props.type === Type.INPUT && iconsNode
977
- })), this._renderPopup());
980
+ })), this._renderPopup()), this.props.error && /*#__PURE__*/React.createElement("div", {
981
+ className: classNames(modules_88cfaf40.errorText, modules_88cfaf40[`size${this.props.size}`])
982
+ }, this.props.error));
978
983
  case Type.BUTTON:
979
984
  return /*#__PURE__*/React.createElement("div", {
980
985
  ref: this.nodeRef,
@@ -1129,6 +1134,7 @@ Select.propTypes = {
1129
1134
  left: PropTypes.number,
1130
1135
  renderOptimization: PropTypes.bool,
1131
1136
  ringPopupTarget: PropTypes.string,
1137
+ error: PropTypes.bool,
1132
1138
  hint: List.ListHint.propTypes.label,
1133
1139
  add: PropTypes.object,
1134
1140
  type: PropTypes.oneOf(Object.values(Type)),