@jetbrains/ring-ui 5.0.150 → 5.0.152

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.
@@ -442,7 +442,7 @@ export default class Select extends Component {
442
442
  }
443
443
  const shownData = this.getListItems(this.filterValue());
444
444
  this.setState({
445
- showPopup: !!shownData.length || !this.props.allowAny,
445
+ showPopup: true,
446
446
  shownData
447
447
  });
448
448
  }
@@ -1,6 +1,5 @@
1
1
  import React, { ChangeEventHandler, PureComponent, ReactNode, SyntheticEvent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Waypoint } from 'react-waypoint';
4
3
  import { Column, SortParams } from './header-cell';
5
4
  export interface HeaderProps {
6
5
  columns: readonly Column[];
@@ -49,18 +48,8 @@ export default class Header extends PureComponent<HeaderProps> {
49
48
  sortKey: string;
50
49
  sortOrder: boolean;
51
50
  };
52
- state: {
53
- fixed: boolean;
54
- headerWidth: undefined;
55
- widths: never[];
56
- };
57
51
  id: string;
58
52
  onCheckboxFocus: (event: SyntheticEvent<HTMLElement>) => void;
59
- private _columnsRowNode?;
60
- storeColumnsRowNode: (node: HTMLElement | null) => void;
61
- onScrollIn: () => void;
62
- onScrollOut: ({ currentPosition }: Waypoint.CallbackArgs) => void;
63
- calculateColumnsWidths(columnsRowNode: HTMLElement | null | undefined): void;
64
53
  createCells(widths?: never[]): React.JSX.Element[];
65
54
  render(): React.JSX.Element;
66
55
  }
@@ -1,7 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { Waypoint } from 'react-waypoint';
5
4
  import Checkbox from '../checkbox/checkbox';
6
5
  import getUID from '../global/get-uid';
7
6
  import style from './table.css';
@@ -32,39 +31,10 @@ export default class Header extends PureComponent {
32
31
  sortKey: 'id',
33
32
  sortOrder: true
34
33
  };
35
- state = {
36
- fixed: false,
37
- headerWidth: undefined,
38
- widths: []
39
- };
40
34
  id = getUID('table-header-');
41
35
  onCheckboxFocus = (event) => {
42
36
  event.currentTarget.blur();
43
37
  };
44
- _columnsRowNode;
45
- storeColumnsRowNode = (node) => {
46
- if (node) {
47
- this._columnsRowNode = node;
48
- this.calculateColumnsWidths(node);
49
- }
50
- };
51
- onScrollIn = () => {
52
- this.calculateColumnsWidths(this._columnsRowNode);
53
- this.setState({ fixed: false });
54
- };
55
- onScrollOut = ({ currentPosition }) => {
56
- if (currentPosition !== 'above') {
57
- return;
58
- }
59
- this.calculateColumnsWidths(this._columnsRowNode);
60
- this.setState({ fixed: true });
61
- };
62
- calculateColumnsWidths(columnsRowNode) {
63
- this.setState({
64
- headerWidth: columnsRowNode?.clientWidth,
65
- widths: [...columnsRowNode?.childNodes ?? []].map(column => (column instanceof Element ? column.clientWidth : 0))
66
- });
67
- }
68
38
  createCells(widths = []) {
69
39
  const { selectable, draggable, columns, checked, checkboxDisabled, onCheckboxChange, onSort, sortKey, sortOrder } = this.props;
70
40
  const metaColumnClasses = classNames(style.metaColumn, style.headerMetaColumn);
@@ -82,30 +52,16 @@ export default class Header extends PureComponent {
82
52
  }
83
53
  render() {
84
54
  const { caption, sticky, topStickOffset } = this.props;
85
- const { fixed, widths, headerWidth } = this.state;
86
55
  const regularCells = this.createCells();
87
- const waypointChild = (<tr data-test="ring-table-header-row">
88
- {/*Since we need to keep the exact amount of columns in each row, we need to present them even being empty*/}
89
- {/*regularCells doesn't provide any other information than a list of components. Hence using array indexes as keys looks like a sane idea*/}
90
- {/*eslint-disable-next-line react/no-array-index-key*/}
91
- {regularCells.map((c, i) => <td key={i}/>)}
92
- </tr>);
93
- return (<thead id={this.id} data-test="ring-table-header" className={style.tableHead}>
56
+ return (<thead id={this.id} data-test="ring-table-header" style={{ top: topStickOffset }} className={classNames({
57
+ [style.tableHead]: true,
58
+ [style.subHeaderSticky]: sticky
59
+ })}>
94
60
  {caption && (<tr data-test="ring-table-header-row">
95
61
  <th className={classNames(style.headerCell, style.caption)} colSpan={regularCells.length + 1} data-test="ring-table-header-cell">{caption}</th>
96
62
  </tr>)}
97
63
 
98
- {sticky &&
99
- (<Waypoint topOffset={topStickOffset} onEnter={this.onScrollIn} onLeave={this.onScrollOut}>
100
- {waypointChild}
101
- </Waypoint>)}
102
-
103
- <tr className={style.subHeader} ref={this.storeColumnsRowNode} data-test="ring-table-header-row">{regularCells}</tr>
104
-
105
- {fixed && sticky &&
106
- (<tr className={style.subHeaderFixed} style={{ width: headerWidth, top: topStickOffset }} data-test="ring-table-header-row">
107
- {this.createCells(widths)}
108
- </tr>)}
64
+ <tr className={style.subHeader} data-test="ring-table-header-row">{regularCells}</tr>
109
65
  </thead>);
110
66
  }
111
67
  }
@@ -101,34 +101,13 @@
101
101
  background-color: var(--ring-line-color);
102
102
  }
103
103
 
104
- .subHeaderFixed::after {
105
- position: absolute;
106
- top: 24px;
107
-
108
- height: 1px;
109
-
110
- content: "";
111
-
112
- background-color: var(--ring-line-color);
113
- }
114
-
115
- .subHeader::after {
116
- right: calc(unit * 4);
117
- left: calc(unit * 4);
118
- }
104
+ .subHeaderSticky {
105
+ position: sticky;
119
106
 
120
- .subHeaderFixed {
121
- position: fixed;
122
107
  z-index: var(--ring-fixed-z-index);
123
108
  top: 0;
124
109
 
125
- opacity: 0.9;
126
- background-color: var(--ring-content-background-color);
127
- }
128
-
129
- .subHeaderFixed::after {
130
- right: 0;
131
- left: 0;
110
+ background-color: rgba(var(--ring-content-background-components), 0.9);
132
111
  }
133
112
 
134
113
  .row {
@@ -1,4 +1,4 @@
1
- import React, { Component, PureComponent, SyntheticEvent, ReactNode } from 'react';
1
+ import React, { PureComponent, SyntheticEvent, ReactNode, ComponentType } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Select, { SelectItem } from '../select/select';
4
4
  import { TagType } from '../tags-list/tags-list';
@@ -6,6 +6,7 @@ import Caret from '../caret/caret';
6
6
  import { Size } from '../input/input';
7
7
  import { ControlsHeight } from '../global/controls-height';
8
8
  import { Filter } from '../select/select__popup';
9
+ import { TagAttrs } from '../tag/tag';
9
10
  declare function noop(): void;
10
11
  export interface ToggleTagParams {
11
12
  tag: TagType;
@@ -17,7 +18,7 @@ export interface TagsInputProps {
17
18
  dataSource: (params: TagsInputRequestParams) => readonly SelectItem[] | Promise<readonly SelectItem[]>;
18
19
  onAddTag: (params: ToggleTagParams) => void;
19
20
  onRemoveTag: (params: ToggleTagParams) => void;
20
- customTagComponent: Component;
21
+ customTagComponent: ComponentType<TagAttrs>;
21
22
  maxPopupHeight: number;
22
23
  minPopupWidth: number;
23
24
  canNotBeEmpty: boolean;
@@ -31,7 +32,7 @@ export interface TagsInputProps {
31
32
  tags?: readonly TagType[] | null | undefined;
32
33
  loadingMessage?: string | undefined;
33
34
  notFoundMessage?: string | undefined;
34
- hint?: string | undefined;
35
+ hint?: ReactNode | null | undefined;
35
36
  size: Size;
36
37
  height?: ControlsHeight | undefined;
37
38
  label?: ReactNode;
@@ -74,7 +75,7 @@ export default class TagsInput extends PureComponent<TagsInputProps, TagsInputSt
74
75
  label: PropTypes.Requireable<PropTypes.ReactNodeLike>;
75
76
  loadingMessage: PropTypes.Requireable<string>;
76
77
  notFoundMessage: PropTypes.Requireable<string>;
77
- hint: PropTypes.Requireable<string>;
78
+ hint: PropTypes.Requireable<PropTypes.ReactNodeLike>;
78
79
  allowAddNewTags: PropTypes.Requireable<boolean>;
79
80
  };
80
81
  static defaultProps: {
@@ -44,7 +44,7 @@ export default class TagsInput extends PureComponent {
44
44
  label: PropTypes.node,
45
45
  loadingMessage: PropTypes.string,
46
46
  notFoundMessage: PropTypes.string,
47
- hint: PropTypes.string,
47
+ hint: PropTypes.node,
48
48
  allowAddNewTags: PropTypes.bool
49
49
  };
50
50
  static defaultProps = {
@@ -264,7 +264,7 @@ export default class TagsInput extends PureComponent {
264
264
  [inputStyles.disabledLabel]: disabled
265
265
  })}>{label}</label>)}
266
266
 
267
- <TagsList tags={tags} activeIndex={activeIndex} disabled={disabled} canNotBeEmpty={canNotBeEmpty} handleRemove={this.handleRemove} className={styles.tagsList} tagClassName={styles.tag} handleClick={this.handleClick}>
267
+ <TagsList tags={tags} activeIndex={activeIndex} disabled={disabled} canNotBeEmpty={canNotBeEmpty} handleRemove={this.handleRemove} className={styles.tagsList} tagClassName={styles.tag} handleClick={this.handleClick} customTagComponent={this.props.customTagComponent}>
268
268
  <Select id={this.id} ref={this.selectRef} size={Select.Size.AUTO} type={Select.Type.INPUT_WITHOUT_CONTROLS} inputPlaceholder={this.props.placeholder} data={this.state.suggestions} className={classNames(styles.tagsSelect)} onSelect={this.addTag} onFocus={this._focusHandler} onBlur={this._blurHandler} renderOptimization={this.props.renderOptimization} add={allowAddNewTags ? { prefix: 'Add new tag' } : undefined} onAdd={allowAddNewTags ? this.handleTagCreation : undefined} filter={filter} maxHeight={this.props.maxPopupHeight} minWidth={this.props.minPopupWidth} top={POPUP_VERTICAL_SHIFT} loading={this.state.loading} onFilter={this.loadSuggestions} onBeforeOpen={this.loadSuggestions} onKeyDown={this.handleKeyDown} disabled={this.props.disabled} loadingMessage={this.props.loadingMessage} notFoundMessage={this.props.notFoundMessage} hint={this.props.hint}/>
269
269
  </TagsList>
270
270
  </div>);
@@ -1,3 +1,3 @@
1
- var modules_1db4bbca = {"unit":"i__const_unit_0","height":"32px","compensate":"2px","compensated":"30px","top":"-3px","row":"row_rui_23fe","dragHandle":"dragHandle_rui_23fe","light":"light_rui_2ac4","tableWrapper":"tableWrapper_rui_23fe","table":"table_rui_23fe","userSelectNone":"userSelectNone_rui_23fe","headerCell":"headerCell_rui_23fe font-smaller-lower_rui_8bff font-smaller_rui_8bff font-lower_rui_8bff font_rui_8bff","headerCellSorted":"headerCellSorted_rui_23fe","headerCellSortable":"headerCellSortable_rui_23fe","sorter":"sorter_rui_23fe","sortedUp":"sortedUp_rui_23fe","icon":"icon_rui_23fe","caption":"caption_rui_23fe","tableHead":"tableHead_rui_23fe","subHeaderFixed":"subHeaderFixed_rui_23fe","subHeader":"subHeader_rui_23fe","disabledHover":"disabledHover_rui_23fe","rowSelected":"rowSelected_rui_23fe","rowFocused":"rowFocused_rui_23fe","cell":"cell_rui_23fe ellipsis_rui_8bff","loadingOverlay":"loadingOverlay_rui_23fe","cellUnlimited":"cellUnlimited_rui_23fe","cellRight":"cellRight_rui_23fe","metaColumn":"metaColumn_rui_23fe","headerMetaColumn":"headerMetaColumn_rui_23fe","visibleDragHandle":"visibleDragHandle_rui_23fe","rowCollapseExpandButton":"rowCollapseExpandButton_rui_23fe","draggingRow":"draggingRow_rui_23fe","draggingTable":"draggingTable_rui_23fe","tableMessage":"tableMessage_rui_23fe"};
1
+ var modules_1db4bbca = {"unit":"i__const_unit_0","height":"32px","compensate":"2px","compensated":"30px","top":"-3px","row":"row_rui_23fe","dragHandle":"dragHandle_rui_23fe","light":"light_rui_2ac4","tableWrapper":"tableWrapper_rui_23fe","table":"table_rui_23fe","userSelectNone":"userSelectNone_rui_23fe","headerCell":"headerCell_rui_23fe font-smaller-lower_rui_8bff font-smaller_rui_8bff font-lower_rui_8bff font_rui_8bff","headerCellSorted":"headerCellSorted_rui_23fe","headerCellSortable":"headerCellSortable_rui_23fe","sorter":"sorter_rui_23fe","sortedUp":"sortedUp_rui_23fe","icon":"icon_rui_23fe","caption":"caption_rui_23fe","tableHead":"tableHead_rui_23fe","subHeaderSticky":"subHeaderSticky_rui_23fe","disabledHover":"disabledHover_rui_23fe","rowSelected":"rowSelected_rui_23fe","rowFocused":"rowFocused_rui_23fe","cell":"cell_rui_23fe ellipsis_rui_8bff","loadingOverlay":"loadingOverlay_rui_23fe","cellUnlimited":"cellUnlimited_rui_23fe","cellRight":"cellRight_rui_23fe","metaColumn":"metaColumn_rui_23fe","headerMetaColumn":"headerMetaColumn_rui_23fe","visibleDragHandle":"visibleDragHandle_rui_23fe","rowCollapseExpandButton":"rowCollapseExpandButton_rui_23fe","draggingRow":"draggingRow_rui_23fe","draggingTable":"draggingTable_rui_23fe","tableMessage":"tableMessage_rui_23fe"};
2
2
 
3
3
  export { modules_1db4bbca as m };
@@ -569,7 +569,7 @@ class Select extends Component {
569
569
  }
570
570
  const shownData = this.getListItems(this.filterValue());
571
571
  this.setState({
572
- showPopup: !!shownData.length || !this.props.allowAny,
572
+ showPopup: true,
573
573
  shownData
574
574
  });
575
575
  }