@jetbrains/ring-ui 5.0.119 → 5.0.121

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.
@@ -265,6 +265,7 @@ export default class DatePopup extends Component {
265
265
  }
266
266
  this.select(changes);
267
267
  this.props.onClear?.(e);
268
+ this.componentRef.current?.querySelector('input')?.focus();
268
269
  };
269
270
  render() {
270
271
  const { range, hidden, withTime, locale } = this.props;
@@ -2,6 +2,7 @@ import { ComponentType, Ref } from 'react';
2
2
  export interface FocusSensorOuterProps<T extends HTMLElement> {
3
3
  focused?: boolean | undefined;
4
4
  autofocus?: boolean | undefined;
5
+ scrollOnTableFocus?: boolean;
5
6
  onFocus?: (() => void) | undefined;
6
7
  onBlur?: (() => void) | undefined;
7
8
  innerRef?: Ref<T> | null | undefined;
@@ -15,7 +15,7 @@ export default function focusSensorHOC(ComposedComponent) {
15
15
  focused: this.props.focused
16
16
  };
17
17
  componentDidMount() {
18
- const { props: { autofocus }, node } = this;
18
+ const { props: { autofocus, scrollOnTableFocus }, node } = this;
19
19
  node?.setAttribute('tabindex', '0');
20
20
  if (node != null) {
21
21
  node.style.outline = 'none';
@@ -23,7 +23,7 @@ export default function focusSensorHOC(ComposedComponent) {
23
23
  document.addEventListener('focus', this.onFocusCapture, true);
24
24
  document.addEventListener('blur', this.onBlurCapture, true);
25
25
  if (autofocus) {
26
- node?.focus();
26
+ node?.focus({ preventScroll: !scrollOnTableFocus });
27
27
  }
28
28
  }
29
29
  componentDidUpdate(prevProps) {
@@ -72,13 +72,13 @@ export default function focusSensorHOC(ComposedComponent) {
72
72
  };
73
73
  onFocusRestore = () => {
74
74
  this._skipNextCapture = true;
75
- this.node?.focus();
75
+ this.node?.focus({ preventScroll: !this.props.scrollOnTableFocus });
76
76
  };
77
77
  onFocusReset = () => {
78
78
  this.node?.blur();
79
79
  };
80
80
  render() {
81
- const { autofocus, focused, onFocus, onBlur, innerRef, ...rest } = this.props;
81
+ const { autofocus, focused, onFocus, onBlur, innerRef, scrollOnTableFocus, ...rest } = this.props;
82
82
  return (<ComposedComponent {...rest} innerRef={composeRefs(innerRef, this.onRefUpdate)} focused={this.state.focused} onFocusReset={this.onFocusReset} onFocusRestore={this.onFocusRestore}/>);
83
83
  }
84
84
  }
@@ -94,6 +94,7 @@ export default function focusSensorHOC(ComposedComponent) {
94
94
  ...ComposedComponent.defaultProps,
95
95
  focused: false,
96
96
  autofocus: false,
97
+ scrollOnTableFocus: true,
97
98
  onFocus: () => { },
98
99
  onBlur: () => { }
99
100
  };
@@ -28,8 +28,8 @@
28
28
  @nest h3& {
29
29
  margin-bottom: 0;
30
30
 
31
- font-size: inherit;
32
- line-height: inherit;
31
+ font-size: 16px;
32
+ line-height: 22px;
33
33
  }
34
34
 
35
35
  @nest h4& {
@@ -40,7 +40,7 @@
40
40
 
41
41
  font-size: 12px;
42
42
  font-weight: normal;
43
- line-height: 16px;
43
+ line-height: 18px;
44
44
  }
45
45
  }
46
46
 
@@ -20,6 +20,7 @@ declare class SmartTable<T extends SelectionItem> extends PureComponent<SmartTab
20
20
  isItemSelectable: PropTypes.Requireable<(...args: any[]) => any> | React.Validator<((item: SelectionItem) => boolean) | null | undefined>;
21
21
  innerRef?: React.Validator<React.Ref<HTMLTableRowElement> | undefined> | undefined;
22
22
  autofocus?: React.Validator<boolean | null | undefined> | undefined;
23
+ scrollOnTableFocus?: React.Validator<boolean | null | undefined> | undefined;
23
24
  disabledHover?: React.Validator<boolean> | undefined;
24
25
  remoteSelection?: React.Validator<boolean | null | undefined> | undefined;
25
26
  onSort?: React.Validator<((params: import("./header-cell").SortParams) => void) | null | undefined> | undefined;
@@ -161,6 +161,7 @@ class DatePopup extends Component {
161
161
  }
162
162
  this.select(changes);
163
163
  this.props.onClear?.(e);
164
+ this.componentRef.current?.querySelector('input')?.focus();
164
165
  });
165
166
  const defaultState = {
166
167
  text: null,
@@ -2,6 +2,7 @@ import { ComponentType, Ref } from 'react';
2
2
  export interface FocusSensorOuterProps<T extends HTMLElement> {
3
3
  focused?: boolean | undefined;
4
4
  autofocus?: boolean | undefined;
5
+ scrollOnTableFocus?: boolean;
5
6
  onFocus?: (() => void) | undefined;
6
7
  onBlur?: (() => void) | undefined;
7
8
  innerRef?: Ref<T> | null | undefined;
@@ -74,7 +74,9 @@ function focusSensorHOC(ComposedComponent) {
74
74
  });
75
75
  _defineProperty(this, "onFocusRestore", () => {
76
76
  this._skipNextCapture = true;
77
- this.node?.focus();
77
+ this.node?.focus({
78
+ preventScroll: !this.props.scrollOnTableFocus
79
+ });
78
80
  });
79
81
  _defineProperty(this, "onFocusReset", () => {
80
82
  this.node?.blur();
@@ -83,7 +85,8 @@ function focusSensorHOC(ComposedComponent) {
83
85
  componentDidMount() {
84
86
  const {
85
87
  props: {
86
- autofocus
88
+ autofocus,
89
+ scrollOnTableFocus
87
90
  },
88
91
  node
89
92
  } = this;
@@ -94,7 +97,9 @@ function focusSensorHOC(ComposedComponent) {
94
97
  document.addEventListener('focus', this.onFocusCapture, true);
95
98
  document.addEventListener('blur', this.onBlurCapture, true);
96
99
  if (autofocus) {
97
- node?.focus();
100
+ node?.focus({
101
+ preventScroll: !scrollOnTableFocus
102
+ });
98
103
  }
99
104
  }
100
105
  componentDidUpdate(prevProps) {
@@ -118,6 +123,7 @@ function focusSensorHOC(ComposedComponent) {
118
123
  onFocus,
119
124
  onBlur,
120
125
  innerRef,
126
+ scrollOnTableFocus,
121
127
  ...rest
122
128
  } = this.props;
123
129
  return /*#__PURE__*/React.createElement(ComposedComponent, _extends({}, rest, {
@@ -140,6 +146,7 @@ function focusSensorHOC(ComposedComponent) {
140
146
  ...ComposedComponent.defaultProps,
141
147
  focused: false,
142
148
  autofocus: false,
149
+ scrollOnTableFocus: true,
143
150
  onFocus: () => {},
144
151
  onBlur: () => {}
145
152
  };