@jetbrains/ring-ui-built 6.0.41 → 6.0.43

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.
@@ -43,6 +43,6 @@ export default class DateInput extends React.PureComponent<DateInputProps> {
43
43
  inputRef: (el: HTMLInputElement | null) => void;
44
44
  updateInput({ text, active }: UpdateInputConfig): void;
45
45
  handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
46
- handleKeyDown: (e: React.KeyboardEvent) => false | void;
46
+ handleKeyDown: (e: React.KeyboardEvent) => void;
47
47
  render(): React.JSX.Element;
48
48
  }
@@ -59,7 +59,14 @@ var DateInput = /*#__PURE__*/function (_React$PureComponent) {
59
59
  return _this.props.onInput(e.currentTarget.value, e.currentTarget.dataset.name);
60
60
  });
61
61
  _defineProperty(_this, "handleKeyDown", function (e) {
62
- return e.key === 'Enter' && _this.props.onConfirm();
62
+ if (e.key === 'Enter') {
63
+ // We have to prevent the default behavior, because restoring focus by TabTrap caused by
64
+ // pressing Enter will trigger the onClick event on the DatePicker Dropdown anchor,
65
+ // so DatePicker will be open again.
66
+ // https://youtrack.jetbrains.com/issue/RG-2450/Anchor-should-be-focused-after-closing-datepicker#focus=Comments-27-10044234.0-0.
67
+ e.preventDefault();
68
+ _this.props.onConfirm();
69
+ }
63
70
  });
64
71
  return _this;
65
72
  }
@@ -982,12 +982,16 @@ var Select = /*#__PURE__*/function (_Component) {
982
982
  [modules_9d0de074["size".concat(this.props.size)]]: this.props.type !== Type.INLINE,
983
983
  [modules_9d0de074.disabled]: this.props.disabled
984
984
  });
985
- var icons = this._getIcons();
986
- var style = getStyle(icons.length);
987
- var iconsNode = /*#__PURE__*/jsx("div", {
988
- className: modules_9d0de074.icons,
989
- children: icons
990
- });
985
+ var style;
986
+ var iconsNode;
987
+ if (this.props.type === Type.INPUT || this.props.type === Type.BUTTON) {
988
+ var icons = this._getIcons();
989
+ style = getStyle(icons.length);
990
+ iconsNode = /*#__PURE__*/jsx("div", {
991
+ className: modules_9d0de074.icons,
992
+ children: icons
993
+ });
994
+ }
991
995
  var ariaProps = this.state.showPopup ? {
992
996
  'aria-owns': this.listId,
993
997
  'aria-activedescendant': activeItemId,
@@ -1029,7 +1033,7 @@ var Select = /*#__PURE__*/function (_Component) {
1029
1033
  "data-test": "ring-select__focus",
1030
1034
  enableShortcuts: shortcutsEnabled ? Object.keys(_objectSpread2(_objectSpread2({}, this.getShortcutsMap()), (_this$_popup5 = this._popup) === null || _this$_popup5 === void 0 || (_this$_popup5 = _this$_popup5.list) === null || _this$_popup5 === void 0 ? void 0 : _this$_popup5.shortcutsMap)) : undefined,
1031
1035
  icon: this.props.filterIcon,
1032
- afterInput: this.props.type === Type.INPUT && iconsNode
1036
+ afterInput: iconsNode
1033
1037
  })), this._renderPopup()]
1034
1038
  }), this.props.error && /*#__PURE__*/jsx("div", {
1035
1039
  className: classNames(modules_88cfaf40.errorText, modules_88cfaf40["size".concat(this.props.size)]),
@@ -83,18 +83,13 @@ var TabTrap = /*#__PURE__*/forwardRef(function TabTrap(_ref, ref) {
83
83
  function restoreFocus() {
84
84
  var previousFocusedNode = previousFocusedNodeRef.current;
85
85
  if (previousFocusedNode instanceof HTMLElement && previousFocusedNode.focus && isNodeInVisiblePartOfPage(previousFocusedNode)) {
86
- // If no delay is added, restoring focus caused by pressing Enter will trigger
87
- // the onClick event on the previousFocusedNode, e.g.
88
- // https://youtrack.jetbrains.com/issue/RG-2450/Anchor-should-be-focused-after-closing-datepicker#focus=Comments-27-10044234.0-0.
89
- setTimeout(function () {
90
- // This is to prevent the focus from being restored the first time
91
- // componentWillUnmount is called in StrictMode.
92
- if (!mountedRef.current) {
93
- previousFocusedNode.focus({
94
- preventScroll: true
95
- });
96
- }
97
- });
86
+ // This is to prevent the focus from being restored the first time
87
+ // componentWillUnmount is called in StrictMode.
88
+ if (!mountedRef.current) {
89
+ previousFocusedNode.focus({
90
+ preventScroll: true
91
+ });
92
+ }
98
93
  }
99
94
  }
100
95
  function focusElement() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui-built",
3
- "version": "6.0.41",
3
+ "version": "6.0.43",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",