@jetbrains/ring-ui 5.0.144 → 5.0.146

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.
@@ -67,7 +67,7 @@ export default class DatePopup extends Component {
67
67
  }
68
68
  componentDidMount() {
69
69
  if (this.componentRef.current) {
70
- this.componentRef.current.addEventListener('wheel', this.handleWheel, { passive: true });
70
+ this.componentRef.current.addEventListener('wheel', this.handleWheel);
71
71
  }
72
72
  }
73
73
  componentDidUpdate(prevProps, prevState) {
@@ -13,9 +13,13 @@ export default class Years extends PureComponent<CalendarProps> {
13
13
  state: {
14
14
  scrollDate: null;
15
15
  };
16
+ componentDidMount(): void;
16
17
  componentDidUpdate(prevProps: CalendarProps, prevState: YearsState): void;
18
+ componentWillUnmount(): void;
17
19
  stoppedScrolling?: boolean;
18
20
  setYear(date: number): void;
21
+ componentRef: React.RefObject<HTMLDivElement>;
22
+ handleWheel: (e: WheelEvent) => void;
19
23
  render(): React.JSX.Element;
20
24
  }
21
25
  export {};
@@ -1,4 +1,4 @@
1
- import React, { PureComponent } from 'react';
1
+ import React, { createRef, PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import addYears from 'date-fns/addYears';
@@ -23,9 +23,19 @@ export default class Years extends PureComponent {
23
23
  onScrollChange: PropTypes.func
24
24
  };
25
25
  state = { scrollDate: null };
26
+ componentDidMount() {
27
+ if (this.componentRef.current) {
28
+ this.componentRef.current.addEventListener('wheel', this.handleWheel);
29
+ }
30
+ }
26
31
  componentDidUpdate(prevProps, prevState) {
27
32
  this.stoppedScrolling = prevState.scrollDate != null && !this.state.scrollDate;
28
33
  }
34
+ componentWillUnmount() {
35
+ if (this.componentRef.current) {
36
+ this.componentRef.current.removeEventListener('wheel', this.handleWheel);
37
+ }
38
+ }
29
39
  stoppedScrolling;
30
40
  setYear(date) {
31
41
  if (scrollTO) {
@@ -35,6 +45,20 @@ export default class Years extends PureComponent {
35
45
  this.setState({ scrollDate: null });
36
46
  this.props.onScroll(Number(setYear(this.props.scrollDate, getYear(date))));
37
47
  }
48
+ componentRef = createRef();
49
+ handleWheel = (e) => {
50
+ const { scrollDate } = this.props;
51
+ const date = this.state.scrollDate || scrollDate;
52
+ e.preventDefault();
53
+ const newScrollDate = linearFunction(0, Number(date), yearDuration / yearHeight).y(e.deltaY);
54
+ this.setState({
55
+ scrollDate: newScrollDate
56
+ });
57
+ if (scrollTO) {
58
+ window.clearTimeout(scrollTO);
59
+ }
60
+ scrollTO = window.setTimeout(() => this.setYear(newScrollDate), scrollDelay);
61
+ };
38
62
  render() {
39
63
  const { onScrollChange, scrollDate } = this.props;
40
64
  const date = this.state.scrollDate || scrollDate;
@@ -46,19 +70,7 @@ export default class Years extends PureComponent {
46
70
  years.push(year);
47
71
  }
48
72
  const pxToDate = linearFunction(0, Number(years[0]), yearDuration / yearHeight);
49
- const handleWheel = (e) => {
50
- e.preventDefault();
51
- const newScrollDate = linearFunction(0, Number(date), yearDuration / yearHeight).
52
- y(e.deltaY);
53
- this.setState({
54
- scrollDate: newScrollDate
55
- });
56
- if (scrollTO) {
57
- window.clearTimeout(scrollTO);
58
- }
59
- scrollTO = window.setTimeout(() => this.setYear(newScrollDate), scrollDelay);
60
- };
61
- return (<div className={styles.years} onWheel={handleWheel} style={{
73
+ return (<div className={styles.years} ref={this.componentRef} style={{
62
74
  transition: this.stoppedScrolling ? 'top .2s ease-out 0s' : 'none',
63
75
  top: Math.floor(calHeight * HALF - pxToDate.x(Number(date)))
64
76
  }}>
@@ -30,6 +30,7 @@
30
30
 
31
31
  border: none;
32
32
  border-radius: var(--ring-border-radius);
33
+ outline: none;
33
34
  background: inherit;
34
35
 
35
36
  font-size: inherit;
@@ -41,13 +42,13 @@
41
42
  border-radius: 0;
42
43
  }
43
44
 
44
- &:focus {
45
- outline: 1px solid var(--ring-border-hover-color);
45
+ &:focus-visible {
46
+ box-shadow: 0 0 0 2px var(--ring-border-hover-color);
46
47
  }
47
48
 
48
49
  @nest .disabled &:focus,
49
50
  .selectionMode &:focus {
50
- outline: none;
51
+ box-shadow: none;
51
52
  }
52
53
 
53
54
  &:hover {
@@ -70,6 +70,6 @@ export default class Profile extends PureComponent<ProfileProps> {
70
70
  static contextType: React.Context<import("../i18n/i18n-context").I18nContextProps>;
71
71
  context: React.ContextType<typeof Profile.contextType>;
72
72
  static Size: typeof Size;
73
- render(): string | number | boolean | React.JSX.Element | React.ReactFragment | null | undefined;
73
+ render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
74
74
  }
75
75
  export type ProfileAttrs = JSX.LibraryManagedAttributes<typeof Profile, ProfileProps>;
@@ -19,7 +19,7 @@ export interface LinkBaseProps {
19
19
  export type LinkProps<P extends ClickableLinkProps = ClickableLinkProps> = Omit<P, keyof LinkBaseProps> & LinkBaseProps;
20
20
  export declare function linkHOC<P extends ClickableLinkProps>(ComposedComponent: ComponentType<P> | string): {
21
21
  new (props: LinkProps<P> | Readonly<LinkProps<P>>): {
22
- getChildren(): string | number | boolean | React.JSX.Element | React.ReactFragment | null | undefined;
22
+ getChildren(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
23
23
  render(): React.JSX.Element;
24
24
  context: unknown;
25
25
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<LinkProps<P>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
@@ -43,7 +43,7 @@ export declare function linkHOC<P extends ClickableLinkProps>(ComposedComponent:
43
43
  UNSAFE_componentWillUpdate?(nextProps: Readonly<LinkProps<P>>, nextState: Readonly<{}>, nextContext: any): void;
44
44
  };
45
45
  new (props: LinkProps<P>, context: any): {
46
- getChildren(): string | number | boolean | React.JSX.Element | React.ReactFragment | null | undefined;
46
+ getChildren(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
47
47
  render(): React.JSX.Element;
48
48
  context: unknown;
49
49
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<LinkProps<P>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
@@ -83,7 +83,7 @@ export declare function linkHOC<P extends ClickableLinkProps>(ComposedComponent:
83
83
  };
84
84
  declare const _default: {
85
85
  new (props: LinkProps<ClickableLinkProps> | Readonly<LinkProps<ClickableLinkProps>>): {
86
- getChildren(): string | number | boolean | React.JSX.Element | React.ReactFragment | null | undefined;
86
+ getChildren(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
87
87
  render(): React.JSX.Element;
88
88
  context: unknown;
89
89
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<LinkProps<ClickableLinkProps>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
@@ -107,7 +107,7 @@ declare const _default: {
107
107
  UNSAFE_componentWillUpdate?(nextProps: Readonly<LinkProps<ClickableLinkProps>>, nextState: Readonly<{}>, nextContext: any): void;
108
108
  };
109
109
  new (props: LinkProps<ClickableLinkProps>, context: any): {
110
- getChildren(): string | number | boolean | React.JSX.Element | React.ReactFragment | null | undefined;
110
+ getChildren(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
111
111
  render(): React.JSX.Element;
112
112
  context: unknown;
113
113
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<LinkProps<ClickableLinkProps>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
@@ -24,5 +24,5 @@ export default class Shortcuts extends PureComponent<ShortcutsProps> {
24
24
  componentWillUnmount(): void;
25
25
  turnShorcutsOn(): void;
26
26
  turnShorcutsOff(): void;
27
- render(): string | number | true | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactFragment | null;
27
+ render(): string | number | true | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null;
28
28
  }
@@ -127,9 +127,7 @@ class DatePopup extends Component {
127
127
  }
128
128
  componentDidMount() {
129
129
  if (this.componentRef.current) {
130
- this.componentRef.current.addEventListener('wheel', this.handleWheel, {
131
- passive: true
132
- });
130
+ this.componentRef.current.addEventListener('wheel', this.handleWheel);
133
131
  }
134
132
  }
135
133
  componentDidUpdate(prevProps, prevState) {
@@ -13,9 +13,13 @@ export default class Years extends PureComponent<CalendarProps> {
13
13
  state: {
14
14
  scrollDate: null;
15
15
  };
16
+ componentDidMount(): void;
16
17
  componentDidUpdate(prevProps: CalendarProps, prevState: YearsState): void;
18
+ componentWillUnmount(): void;
17
19
  stoppedScrolling?: boolean;
18
20
  setYear(date: number): void;
21
+ componentRef: React.RefObject<HTMLDivElement>;
22
+ handleWheel: (e: WheelEvent) => void;
19
23
  render(): React.JSX.Element;
20
24
  }
21
25
  export {};
@@ -1,4 +1,4 @@
1
- import React, { PureComponent } from 'react';
1
+ import React, { PureComponent, createRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import addYears from 'date-fns/addYears';
@@ -11,7 +11,7 @@ import startOfYear from 'date-fns/startOfYear';
11
11
  import subYears from 'date-fns/subYears';
12
12
  import linearFunction from '../global/linear-function.js';
13
13
  import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
14
- import units, { dateType, DOUBLE, HALF, yearDuration } from './consts.js';
14
+ import units, { dateType, yearDuration, DOUBLE, HALF } from './consts.js';
15
15
  import 'date-fns/add';
16
16
 
17
17
  const {
@@ -30,9 +30,19 @@ class Years extends PureComponent {
30
30
  state = {
31
31
  scrollDate: null
32
32
  };
33
+ componentDidMount() {
34
+ if (this.componentRef.current) {
35
+ this.componentRef.current.addEventListener('wheel', this.handleWheel);
36
+ }
37
+ }
33
38
  componentDidUpdate(prevProps, prevState) {
34
39
  this.stoppedScrolling = prevState.scrollDate != null && !this.state.scrollDate;
35
40
  }
41
+ componentWillUnmount() {
42
+ if (this.componentRef.current) {
43
+ this.componentRef.current.removeEventListener('wheel', this.handleWheel);
44
+ }
45
+ }
36
46
  stoppedScrolling;
37
47
  setYear(date) {
38
48
  if (scrollTO) {
@@ -44,6 +54,22 @@ class Years extends PureComponent {
44
54
  });
45
55
  this.props.onScroll(Number(setYear(this.props.scrollDate, getYear(date))));
46
56
  }
57
+ componentRef = /*#__PURE__*/createRef();
58
+ handleWheel = e => {
59
+ const {
60
+ scrollDate
61
+ } = this.props;
62
+ const date = this.state.scrollDate || scrollDate;
63
+ e.preventDefault();
64
+ const newScrollDate = linearFunction(0, Number(date), yearDuration / yearHeight).y(e.deltaY);
65
+ this.setState({
66
+ scrollDate: newScrollDate
67
+ });
68
+ if (scrollTO) {
69
+ window.clearTimeout(scrollTO);
70
+ }
71
+ scrollTO = window.setTimeout(() => this.setYear(newScrollDate), scrollDelay);
72
+ };
47
73
  render() {
48
74
  const {
49
75
  onScrollChange,
@@ -58,20 +84,9 @@ class Years extends PureComponent {
58
84
  years.push(year);
59
85
  }
60
86
  const pxToDate = linearFunction(0, Number(years[0]), yearDuration / yearHeight);
61
- const handleWheel = e => {
62
- e.preventDefault();
63
- const newScrollDate = linearFunction(0, Number(date), yearDuration / yearHeight).y(e.deltaY);
64
- this.setState({
65
- scrollDate: newScrollDate
66
- });
67
- if (scrollTO) {
68
- window.clearTimeout(scrollTO);
69
- }
70
- scrollTO = window.setTimeout(() => this.setYear(newScrollDate), scrollDelay);
71
- };
72
87
  return /*#__PURE__*/React.createElement("div", {
73
88
  className: modules_0c7b7d96.years,
74
- onWheel: handleWheel,
89
+ ref: this.componentRef,
75
90
  style: {
76
91
  transition: this.stoppedScrolling ? 'top .2s ease-out 0s' : 'none',
77
92
  top: Math.floor(calHeight * HALF - pxToDate.x(Number(date)))
@@ -70,6 +70,6 @@ export default class Profile extends PureComponent<ProfileProps> {
70
70
  static contextType: React.Context<import("../i18n/i18n-context").I18nContextProps>;
71
71
  context: React.ContextType<typeof Profile.contextType>;
72
72
  static Size: typeof Size;
73
- render(): string | number | boolean | React.JSX.Element | React.ReactFragment | null | undefined;
73
+ render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
74
74
  }
75
75
  export type ProfileAttrs = JSX.LibraryManagedAttributes<typeof Profile, ProfileProps>;
@@ -19,7 +19,7 @@ export interface LinkBaseProps {
19
19
  export type LinkProps<P extends ClickableLinkProps = ClickableLinkProps> = Omit<P, keyof LinkBaseProps> & LinkBaseProps;
20
20
  export declare function linkHOC<P extends ClickableLinkProps>(ComposedComponent: ComponentType<P> | string): {
21
21
  new (props: LinkProps<P> | Readonly<LinkProps<P>>): {
22
- getChildren(): string | number | boolean | React.JSX.Element | React.ReactFragment | null | undefined;
22
+ getChildren(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
23
23
  render(): React.JSX.Element;
24
24
  context: unknown;
25
25
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<LinkProps<P>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
@@ -43,7 +43,7 @@ export declare function linkHOC<P extends ClickableLinkProps>(ComposedComponent:
43
43
  UNSAFE_componentWillUpdate?(nextProps: Readonly<LinkProps<P>>, nextState: Readonly<{}>, nextContext: any): void;
44
44
  };
45
45
  new (props: LinkProps<P>, context: any): {
46
- getChildren(): string | number | boolean | React.JSX.Element | React.ReactFragment | null | undefined;
46
+ getChildren(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
47
47
  render(): React.JSX.Element;
48
48
  context: unknown;
49
49
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<LinkProps<P>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
@@ -83,7 +83,7 @@ export declare function linkHOC<P extends ClickableLinkProps>(ComposedComponent:
83
83
  };
84
84
  declare const _default: {
85
85
  new (props: LinkProps<ClickableLinkProps> | Readonly<LinkProps<ClickableLinkProps>>): {
86
- getChildren(): string | number | boolean | React.JSX.Element | React.ReactFragment | null | undefined;
86
+ getChildren(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
87
87
  render(): React.JSX.Element;
88
88
  context: unknown;
89
89
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<LinkProps<ClickableLinkProps>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
@@ -107,7 +107,7 @@ declare const _default: {
107
107
  UNSAFE_componentWillUpdate?(nextProps: Readonly<LinkProps<ClickableLinkProps>>, nextState: Readonly<{}>, nextContext: any): void;
108
108
  };
109
109
  new (props: LinkProps<ClickableLinkProps>, context: any): {
110
- getChildren(): string | number | boolean | React.JSX.Element | React.ReactFragment | null | undefined;
110
+ getChildren(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
111
111
  render(): React.JSX.Element;
112
112
  context: unknown;
113
113
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<LinkProps<ClickableLinkProps>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
@@ -5,11 +5,11 @@ const MAJOR_VERSION_INDEX = 0;
5
5
  /**
6
6
  * SUPPORTED_BROWSERS are defined by Babel plugin, see babel config
7
7
  */
8
- if (!["and_chr 113", "chrome 112", "chrome 111", "chrome 109", "edge 112", "edge 111", "firefox 111", "ios_saf 16.4", "ios_saf 16.3", "ios_saf 16.2", "ios_saf 16.1", "safari 16.3", "samsung 20"]) {
8
+ if (!["and_chr 114", "chrome 113", "chrome 112", "chrome 109", "edge 113", "edge 112", "firefox 113", "ios_saf 16.4", "ios_saf 16.3", "ios_saf 16.1", "opera 98", "safari 16.4", "samsung 20"]) {
9
9
  // eslint-disable-next-line no-console
10
10
  console.warn('Ring UI: no SUPPORTED_BROWSERS passed. Please check babel config.');
11
11
  }
12
- const SUPPORTED = ["and_chr 113", "chrome 112", "chrome 111", "chrome 109", "edge 112", "edge 111", "firefox 111", "ios_saf 16.4", "ios_saf 16.3", "ios_saf 16.2", "ios_saf 16.1", "safari 16.3", "samsung 20"] || [];
12
+ const SUPPORTED = ["and_chr 114", "chrome 113", "chrome 112", "chrome 109", "edge 113", "edge 112", "firefox 113", "ios_saf 16.4", "ios_saf 16.3", "ios_saf 16.1", "opera 98", "safari 16.4", "samsung 20"] || [];
13
13
  const WHITE_LISTED_BROWSERS = ['chrome', 'firefox', 'safari', 'edge'];
14
14
  const WHITE_LIST = SUPPORTED.reduce((acc, item) => {
15
15
  var _item$match;
@@ -24,5 +24,5 @@ export default class Shortcuts extends PureComponent<ShortcutsProps> {
24
24
  componentWillUnmount(): void;
25
25
  turnShorcutsOn(): void;
26
26
  turnShorcutsOff(): void;
27
- render(): string | number | true | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactFragment | null;
27
+ render(): string | number | true | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null;
28
28
  }