@jetbrains/ring-ui 5.0.0-beta.21 → 5.0.0-beta.22

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.
@@ -49,3 +49,4 @@ export default class Avatar extends PureComponent<AvatarProps> {
49
49
  handleSuccess: () => void;
50
50
  render(): JSX.Element;
51
51
  }
52
+ export declare type AvatarAttrs = JSX.LibraryManagedAttributes<typeof Avatar, AvatarProps>;
@@ -64,6 +64,8 @@ export declare class Input extends PureComponent<InputProps> {
64
64
  render(): JSX.Element;
65
65
  }
66
66
  export declare type ContainerProps<P extends InputProps> = JSX.LibraryManagedAttributes<typeof Input, P>;
67
- export declare type InputAttrs = ContainerProps<InputProps>;
67
+ export declare type InputSpecificAttrs = ContainerProps<InputSpecificProps>;
68
+ export declare type TextAreaSpecificAttrs = ContainerProps<TextAreaSpecificProps>;
69
+ export declare type InputAttrs = InputSpecificAttrs | TextAreaSpecificAttrs;
68
70
  export default Input;
69
71
  export { Size };
@@ -144,3 +144,4 @@ export default class Popup<P extends BasePopupProps = PopupProps> extends PureCo
144
144
  render(): JSX.Element;
145
145
  }
146
146
  export declare type PopupAttrs = JSX.LibraryManagedAttributes<typeof Popup, PopupProps>;
147
+ export declare type BasePopupAttrs = JSX.LibraryManagedAttributes<typeof Popup, BasePopupProps>;
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributes, ReactNode } from 'react';
2
- export declare const PopupTargetContext: React.Context<string | undefined>;
2
+ export declare const PopupTargetContext: React.Context<string | Element | undefined>;
3
3
  export interface PopupTargetProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
4
4
  id: string;
5
5
  children: ReactNode | ((target: ReactNode) => ReactNode);
@@ -58,7 +58,7 @@ export interface QueryAssistProps {
58
58
  actions?: ReactNode[] | null | undefined;
59
59
  'data-test'?: string | null | undefined;
60
60
  }
61
- interface StyleRange {
61
+ export interface StyleRange {
62
62
  style: string;
63
63
  start: number;
64
64
  length: number;
@@ -45,6 +45,7 @@ export interface CustomAnchorProps {
45
45
  buttonProps: ButtonHTMLAttributes<HTMLButtonElement> & DataTestProps;
46
46
  popup: ReactNode;
47
47
  }
48
+ export declare type CustomAnchor = ((props: CustomAnchorProps) => ReactNode);
48
49
  export interface BaseSelectProps<T = unknown> {
49
50
  data: readonly SelectItem<T>[];
50
51
  filter: boolean | Filter<T>;
@@ -94,7 +95,7 @@ export interface BaseSelectProps<T = unknown> {
94
95
  hint?: ReactNode;
95
96
  add?: Add | null | undefined;
96
97
  compact?: boolean | null | undefined;
97
- customAnchor?: ((props: CustomAnchorProps) => ReactNode) | null | undefined;
98
+ customAnchor?: CustomAnchor | null | undefined;
98
99
  disableMoveOverflow?: boolean | null | undefined;
99
100
  disableScrollToActive?: boolean | null | undefined;
100
101
  'data-test'?: string | null | undefined;
@@ -113,7 +114,7 @@ export interface MultipleSelectProps<T = unknown> extends BaseSelectProps<T> {
113
114
  onChange: (selected: SelectItem<T>[], event?: Event | SyntheticEvent) => void;
114
115
  tags?: Tags | boolean | null | undefined;
115
116
  }
116
- declare type SelectProps<T = unknown> = SingleSelectProps<T> | MultipleSelectProps<T>;
117
+ export declare type SelectProps<T = unknown> = SingleSelectProps<T> | MultipleSelectProps<T>;
117
118
  interface AddButton {
118
119
  prefix: string | null | undefined;
119
120
  label: string;
@@ -105,7 +105,7 @@ export default class SelectPopup<T = unknown> extends PureComponent<SelectPopupP
105
105
  getFilterWithTags(): JSX.Element | null;
106
106
  getBottomLine(): "" | JSX.Element | null;
107
107
  handleListResize: () => void;
108
- getList(ringPopupTarget: string | undefined): JSX.Element | null;
108
+ getList(ringPopupTarget: string | Element | undefined): JSX.Element | null;
109
109
  handleSelectAll: () => void;
110
110
  getSelectAll: () => false | JSX.Element;
111
111
  private _adjustListMaxHeight;
@@ -3,10 +3,10 @@ import { FocusSensorProps } from '../global/focus-sensor-hoc';
3
3
  import Row, { RowProps } from './row';
4
4
  import { SelectionItem } from './selection';
5
5
  export interface RowWithFocusSensorCallbacksProps<T extends SelectionItem> extends Omit<FocusSensorProps<RowProps<T>, HTMLTableRowElement, typeof Row>, 'onFocus'> {
6
- onFocus: (item: T) => void;
7
- onSelect: (item: T, selected: boolean) => void;
8
- onCollapse: (item: T) => void;
9
- onExpand: (item: T) => void;
6
+ onFocus?: (item: T) => void;
7
+ onSelect?: (item: T, selected: boolean) => void;
8
+ onCollapse?: (item: T) => void;
9
+ onExpand?: (item: T) => void;
10
10
  }
11
11
  export default class RowWithFocusSensorCallbacks<T extends SelectionItem> extends PureComponent<RowWithFocusSensorCallbacksProps<T>> {
12
12
  RowWithFocusSensor: React.ComponentType<FocusSensorProps<RowProps<T>, HTMLDivElement, typeof Row>>;
@@ -6,16 +6,16 @@ export default class RowWithFocusSensorCallbacks extends PureComponent {
6
6
  // https://stackoverflow.com/a/53882322/6304152
7
7
  RowWithFocusSensor = getContainer();
8
8
  onFocus = () => {
9
- this.props.onFocus(this.props.item);
9
+ this.props.onFocus?.(this.props.item);
10
10
  };
11
11
  onSelect = (item, selected) => {
12
- this.props.onSelect(item, selected);
12
+ this.props.onSelect?.(item, selected);
13
13
  };
14
14
  onCollapse = () => {
15
- this.props.onCollapse(this.props.item);
15
+ this.props.onCollapse?.(this.props.item);
16
16
  };
17
17
  onExpand = () => {
18
- this.props.onExpand(this.props.item);
18
+ this.props.onExpand?.(this.props.item);
19
19
  };
20
20
  render() {
21
21
  return (<this.RowWithFocusSensor {...this.props} onFocus={this.onFocus} onSelect={this.onSelect} onCollapse={this.onCollapse} onExpand={this.onExpand}/>);
@@ -54,3 +54,4 @@ export default class Row<T extends SelectionItem> extends PureComponent<RowProps
54
54
  rowRef: (el: HTMLElement | null) => void;
55
55
  render(): JSX.Element;
56
56
  }
57
+ export declare type RowAttrs<T extends SelectionItem> = JSX.LibraryManagedAttributes<typeof Row, RowProps<T>>;
@@ -4,7 +4,7 @@ import { CollapsibleTabsProps } from './collapsible-tabs';
4
4
  import { CustomItem } from './custom-item';
5
5
  import { TabProps } from './tab';
6
6
  export { CustomItem };
7
- declare type Children = readonly Children[] | ReactElement<TabProps> | null | boolean;
7
+ export declare type Children = readonly (Children | null | boolean)[] | ReactElement<TabProps> | null | boolean;
8
8
  export interface TabsProps extends Omit<CollapsibleTabsProps, 'onSelect' | 'children'> {
9
9
  children: Children;
10
10
  onSelect: (key: string) => void;
@@ -1,9 +1,8 @@
1
- import { PureComponent, ReactElement } from 'react';
1
+ import { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { TabsAttrs } from './dumb-tabs';
4
- import { TabProps } from './tab';
3
+ import { TabsAttrs, Children } from './dumb-tabs';
5
4
  export interface SmartTabsProps extends TabsAttrs {
6
- children: ReactElement<TabProps>[];
5
+ children: Children;
7
6
  initSelected?: string | null | undefined;
8
7
  }
9
8
  export default class SmartTabs extends PureComponent<SmartTabsProps> {
@@ -12,6 +11,7 @@ export default class SmartTabs extends PureComponent<SmartTabsProps> {
12
11
  initSelected: PropTypes.Requireable<string>;
13
12
  'data-test': PropTypes.Requireable<string>;
14
13
  };
14
+ constructor(props: SmartTabsProps);
15
15
  state: {
16
16
  selected: string;
17
17
  };
@@ -8,9 +8,15 @@ export default class SmartTabs extends PureComponent {
8
8
  initSelected: PropTypes.string,
9
9
  'data-test': PropTypes.string
10
10
  };
11
- state = {
12
- selected: this.props.initSelected || this.props.children[0].props.id || '0'
13
- };
11
+ constructor(props) {
12
+ super(props);
13
+ this.state = {
14
+ selected: this.props.initSelected ||
15
+ (Array.isArray(this.props.children) && this.props.children[0].props.id) ||
16
+ '0'
17
+ };
18
+ }
19
+ state;
14
20
  handleSelect = (selected) => this.setState({ selected });
15
21
  render() {
16
22
  const { children, initSelected, 'data-test': dataTest, ...restProps } = this.props;
@@ -49,3 +49,4 @@ export default class Avatar extends PureComponent<AvatarProps> {
49
49
  handleSuccess: () => void;
50
50
  render(): JSX.Element;
51
51
  }
52
+ export declare type AvatarAttrs = JSX.LibraryManagedAttributes<typeof Avatar, AvatarProps>;
@@ -64,6 +64,8 @@ export declare class Input extends PureComponent<InputProps> {
64
64
  render(): JSX.Element;
65
65
  }
66
66
  export declare type ContainerProps<P extends InputProps> = JSX.LibraryManagedAttributes<typeof Input, P>;
67
- export declare type InputAttrs = ContainerProps<InputProps>;
67
+ export declare type InputSpecificAttrs = ContainerProps<InputSpecificProps>;
68
+ export declare type TextAreaSpecificAttrs = ContainerProps<TextAreaSpecificProps>;
69
+ export declare type InputAttrs = InputSpecificAttrs | TextAreaSpecificAttrs;
68
70
  export default Input;
69
71
  export { Size };
@@ -144,3 +144,4 @@ export default class Popup<P extends BasePopupProps = PopupProps> extends PureCo
144
144
  render(): JSX.Element;
145
145
  }
146
146
  export declare type PopupAttrs = JSX.LibraryManagedAttributes<typeof Popup, PopupProps>;
147
+ export declare type BasePopupAttrs = JSX.LibraryManagedAttributes<typeof Popup, BasePopupProps>;
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributes, ReactNode } from 'react';
2
- export declare const PopupTargetContext: React.Context<string | undefined>;
2
+ export declare const PopupTargetContext: React.Context<string | Element | undefined>;
3
3
  export interface PopupTargetProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
4
4
  id: string;
5
5
  children: ReactNode | ((target: ReactNode) => ReactNode);
@@ -58,7 +58,7 @@ export interface QueryAssistProps {
58
58
  actions?: ReactNode[] | null | undefined;
59
59
  'data-test'?: string | null | undefined;
60
60
  }
61
- interface StyleRange {
61
+ export interface StyleRange {
62
62
  style: string;
63
63
  start: number;
64
64
  length: number;
@@ -45,6 +45,7 @@ export interface CustomAnchorProps {
45
45
  buttonProps: ButtonHTMLAttributes<HTMLButtonElement> & DataTestProps;
46
46
  popup: ReactNode;
47
47
  }
48
+ export declare type CustomAnchor = ((props: CustomAnchorProps) => ReactNode);
48
49
  export interface BaseSelectProps<T = unknown> {
49
50
  data: readonly SelectItem<T>[];
50
51
  filter: boolean | Filter<T>;
@@ -94,7 +95,7 @@ export interface BaseSelectProps<T = unknown> {
94
95
  hint?: ReactNode;
95
96
  add?: Add | null | undefined;
96
97
  compact?: boolean | null | undefined;
97
- customAnchor?: ((props: CustomAnchorProps) => ReactNode) | null | undefined;
98
+ customAnchor?: CustomAnchor | null | undefined;
98
99
  disableMoveOverflow?: boolean | null | undefined;
99
100
  disableScrollToActive?: boolean | null | undefined;
100
101
  'data-test'?: string | null | undefined;
@@ -113,7 +114,7 @@ export interface MultipleSelectProps<T = unknown> extends BaseSelectProps<T> {
113
114
  onChange: (selected: SelectItem<T>[], event?: Event | SyntheticEvent) => void;
114
115
  tags?: Tags | boolean | null | undefined;
115
116
  }
116
- declare type SelectProps<T = unknown> = SingleSelectProps<T> | MultipleSelectProps<T>;
117
+ export declare type SelectProps<T = unknown> = SingleSelectProps<T> | MultipleSelectProps<T>;
117
118
  interface AddButton {
118
119
  prefix: string | null | undefined;
119
120
  label: string;
@@ -105,7 +105,7 @@ export default class SelectPopup<T = unknown> extends PureComponent<SelectPopupP
105
105
  getFilterWithTags(): JSX.Element | null;
106
106
  getBottomLine(): "" | JSX.Element | null;
107
107
  handleListResize: () => void;
108
- getList(ringPopupTarget: string | undefined): JSX.Element | null;
108
+ getList(ringPopupTarget: string | Element | undefined): JSX.Element | null;
109
109
  handleSelectAll: () => void;
110
110
  getSelectAll: () => false | JSX.Element;
111
111
  private _adjustListMaxHeight;
@@ -3,10 +3,10 @@ import { FocusSensorProps } from '../global/focus-sensor-hoc';
3
3
  import Row, { RowProps } from './row';
4
4
  import { SelectionItem } from './selection';
5
5
  export interface RowWithFocusSensorCallbacksProps<T extends SelectionItem> extends Omit<FocusSensorProps<RowProps<T>, HTMLTableRowElement, typeof Row>, 'onFocus'> {
6
- onFocus: (item: T) => void;
7
- onSelect: (item: T, selected: boolean) => void;
8
- onCollapse: (item: T) => void;
9
- onExpand: (item: T) => void;
6
+ onFocus?: (item: T) => void;
7
+ onSelect?: (item: T, selected: boolean) => void;
8
+ onCollapse?: (item: T) => void;
9
+ onExpand?: (item: T) => void;
10
10
  }
11
11
  export default class RowWithFocusSensorCallbacks<T extends SelectionItem> extends PureComponent<RowWithFocusSensorCallbacksProps<T>> {
12
12
  RowWithFocusSensor: React.ComponentType<FocusSensorProps<RowProps<T>, HTMLDivElement, typeof Row>>;
@@ -55,19 +55,27 @@ class RowWithFocusSensorCallbacks extends PureComponent {
55
55
  _defineProperty(this, "RowWithFocusSensor", getContainer());
56
56
 
57
57
  _defineProperty(this, "onFocus", () => {
58
- this.props.onFocus(this.props.item);
58
+ var _this$props$onFocus, _this$props;
59
+
60
+ (_this$props$onFocus = (_this$props = this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props, this.props.item);
59
61
  });
60
62
 
61
63
  _defineProperty(this, "onSelect", (item, selected) => {
62
- this.props.onSelect(item, selected);
64
+ var _this$props$onSelect, _this$props2;
65
+
66
+ (_this$props$onSelect = (_this$props2 = this.props).onSelect) === null || _this$props$onSelect === void 0 ? void 0 : _this$props$onSelect.call(_this$props2, item, selected);
63
67
  });
64
68
 
65
69
  _defineProperty(this, "onCollapse", () => {
66
- this.props.onCollapse(this.props.item);
70
+ var _this$props$onCollaps, _this$props3;
71
+
72
+ (_this$props$onCollaps = (_this$props3 = this.props).onCollapse) === null || _this$props$onCollaps === void 0 ? void 0 : _this$props$onCollaps.call(_this$props3, this.props.item);
67
73
  });
68
74
 
69
75
  _defineProperty(this, "onExpand", () => {
70
- this.props.onExpand(this.props.item);
76
+ var _this$props$onExpand, _this$props4;
77
+
78
+ (_this$props$onExpand = (_this$props4 = this.props).onExpand) === null || _this$props$onExpand === void 0 ? void 0 : _this$props$onExpand.call(_this$props4, this.props.item);
71
79
  });
72
80
  }
73
81
 
@@ -54,3 +54,4 @@ export default class Row<T extends SelectionItem> extends PureComponent<RowProps
54
54
  rowRef: (el: HTMLElement | null) => void;
55
55
  render(): JSX.Element;
56
56
  }
57
+ export declare type RowAttrs<T extends SelectionItem> = JSX.LibraryManagedAttributes<typeof Row, RowProps<T>>;
@@ -4,7 +4,7 @@ import { CollapsibleTabsProps } from './collapsible-tabs';
4
4
  import { CustomItem } from './custom-item';
5
5
  import { TabProps } from './tab';
6
6
  export { CustomItem };
7
- declare type Children = readonly Children[] | ReactElement<TabProps> | null | boolean;
7
+ export declare type Children = readonly (Children | null | boolean)[] | ReactElement<TabProps> | null | boolean;
8
8
  export interface TabsProps extends Omit<CollapsibleTabsProps, 'onSelect' | 'children'> {
9
9
  children: Children;
10
10
  onSelect: (key: string) => void;
@@ -1,9 +1,8 @@
1
- import { PureComponent, ReactElement } from 'react';
1
+ import { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { TabsAttrs } from './dumb-tabs';
4
- import { TabProps } from './tab';
3
+ import { TabsAttrs, Children } from './dumb-tabs';
5
4
  export interface SmartTabsProps extends TabsAttrs {
6
- children: ReactElement<TabProps>[];
5
+ children: Children;
7
6
  initSelected?: string | null | undefined;
8
7
  }
9
8
  export default class SmartTabs extends PureComponent<SmartTabsProps> {
@@ -12,6 +11,7 @@ export default class SmartTabs extends PureComponent<SmartTabsProps> {
12
11
  initSelected: PropTypes.Requireable<string>;
13
12
  'data-test': PropTypes.Requireable<string>;
14
13
  };
14
+ constructor(props: SmartTabsProps);
15
15
  state: {
16
16
  selected: string;
17
17
  };
@@ -1,9 +1,9 @@
1
1
  import { _ as _defineProperty, a as _extends } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import 'core-js/modules/web.dom-collections.iterator.js';
3
2
  import React, { PureComponent } from 'react';
4
3
  import PropTypes from 'prop-types';
5
4
  import joinDataTestAttributes from '../global/data-tests.js';
6
5
  import Tabs from './dumb-tabs.js';
6
+ import 'core-js/modules/web.dom-collections.iterator.js';
7
7
  import 'classnames';
8
8
  import '../global/memoize.js';
9
9
  import '../_helpers/tabs.js';
@@ -70,16 +70,18 @@ import './collapsible-tab.js';
70
70
  import './custom-item.js';
71
71
 
72
72
  class SmartTabs extends PureComponent {
73
- constructor() {
74
- super(...arguments);
73
+ constructor(props) {
74
+ super(props);
75
75
 
76
- _defineProperty(this, "state", {
77
- selected: this.props.initSelected || this.props.children[0].props.id || '0'
78
- });
76
+ _defineProperty(this, "state", void 0);
79
77
 
80
78
  _defineProperty(this, "handleSelect", selected => this.setState({
81
79
  selected
82
80
  }));
81
+
82
+ this.state = {
83
+ selected: this.props.initSelected || Array.isArray(this.props.children) && this.props.children[0].props.id || '0'
84
+ };
83
85
  }
84
86
 
85
87
  render() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "5.0.0-beta.21",
3
+ "version": "5.0.0-beta.22",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",
@@ -254,5 +254,5 @@
254
254
  "node": ">=7.4",
255
255
  "npm": ">=6.0.0"
256
256
  },
257
- "gitHead": "7c50b0bb1d954f530e7d821bf21de435b1e710b5"
257
+ "gitHead": "3b6a6152427f0c519caa67912d668f102dd458cb"
258
258
  }