@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.
@@ -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
  }
@@ -2,7 +2,6 @@ import { _ as _extends } from '../_helpers/_rollupPluginBabelHelpers.js';
2
2
  import React, { PureComponent } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import classNames from 'classnames';
5
- import { Waypoint } from 'react-waypoint';
6
5
  import Checkbox from '../checkbox/checkbox.js';
7
6
  import getUID from '../global/get-uid.js';
8
7
  import { m as modules_1db4bbca } from '../_helpers/table.js';
@@ -48,47 +47,10 @@ class Header extends PureComponent {
48
47
  sortKey: 'id',
49
48
  sortOrder: true
50
49
  };
51
- state = {
52
- fixed: false,
53
- headerWidth: undefined,
54
- widths: []
55
- };
56
50
  id = getUID('table-header-');
57
51
  onCheckboxFocus = event => {
58
52
  event.currentTarget.blur();
59
53
  };
60
- _columnsRowNode;
61
- storeColumnsRowNode = node => {
62
- if (node) {
63
- this._columnsRowNode = node;
64
- this.calculateColumnsWidths(node);
65
- }
66
- };
67
- onScrollIn = () => {
68
- this.calculateColumnsWidths(this._columnsRowNode);
69
- this.setState({
70
- fixed: false
71
- });
72
- };
73
- onScrollOut = _ref => {
74
- let {
75
- currentPosition
76
- } = _ref;
77
- if (currentPosition !== 'above') {
78
- return;
79
- }
80
- this.calculateColumnsWidths(this._columnsRowNode);
81
- this.setState({
82
- fixed: true
83
- });
84
- };
85
- calculateColumnsWidths(columnsRowNode) {
86
- var _columnsRowNode$child;
87
- this.setState({
88
- headerWidth: columnsRowNode?.clientWidth,
89
- widths: [...((_columnsRowNode$child = columnsRowNode?.childNodes) !== null && _columnsRowNode$child !== void 0 ? _columnsRowNode$child : [])].map(column => column instanceof Element ? column.clientWidth : 0)
90
- });
91
- }
92
54
  createCells() {
93
55
  let widths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
94
56
  const {
@@ -135,43 +97,27 @@ class Header extends PureComponent {
135
97
  sticky,
136
98
  topStickOffset
137
99
  } = this.props;
138
- const {
139
- fixed,
140
- widths,
141
- headerWidth
142
- } = this.state;
143
100
  const regularCells = this.createCells();
144
- const waypointChild = /*#__PURE__*/React.createElement("tr", {
145
- "data-test": "ring-table-header-row"
146
- }, regularCells.map((c, i) => /*#__PURE__*/React.createElement("td", {
147
- key: i
148
- })));
149
101
  return /*#__PURE__*/React.createElement("thead", {
150
102
  id: this.id,
151
103
  "data-test": "ring-table-header",
152
- className: modules_1db4bbca.tableHead
104
+ style: {
105
+ top: topStickOffset
106
+ },
107
+ className: classNames({
108
+ [modules_1db4bbca.tableHead]: true,
109
+ [modules_1db4bbca.subHeaderSticky]: sticky
110
+ })
153
111
  }, caption && /*#__PURE__*/React.createElement("tr", {
154
112
  "data-test": "ring-table-header-row"
155
113
  }, /*#__PURE__*/React.createElement("th", {
156
114
  className: classNames(modules_1db4bbca.headerCell, modules_1db4bbca.caption),
157
115
  colSpan: regularCells.length + 1,
158
116
  "data-test": "ring-table-header-cell"
159
- }, caption)), sticky && /*#__PURE__*/React.createElement(Waypoint, {
160
- topOffset: topStickOffset,
161
- onEnter: this.onScrollIn,
162
- onLeave: this.onScrollOut
163
- }, waypointChild), /*#__PURE__*/React.createElement("tr", {
117
+ }, caption)), /*#__PURE__*/React.createElement("tr", {
164
118
  className: modules_1db4bbca.subHeader,
165
- ref: this.storeColumnsRowNode,
166
- "data-test": "ring-table-header-row"
167
- }, regularCells), fixed && sticky && /*#__PURE__*/React.createElement("tr", {
168
- className: modules_1db4bbca.subHeaderFixed,
169
- style: {
170
- width: headerWidth,
171
- top: topStickOffset
172
- },
173
119
  "data-test": "ring-table-header-row"
174
- }, this.createCells(widths)));
120
+ }, regularCells));
175
121
  }
176
122
  }
177
123
 
@@ -19,7 +19,6 @@ import '../global/data-tests.js';
19
19
  import '../loader/loader__core.js';
20
20
  import '../global/dom.js';
21
21
  import './header.js';
22
- import 'react-waypoint';
23
22
  import '../checkbox/checkbox.js';
24
23
  import '@jetbrains/icons/checkmark-14px';
25
24
  import '@jetbrains/icons/remove-14px';
@@ -22,7 +22,6 @@ import 'sniffr';
22
22
  import '../global/data-tests.js';
23
23
  import '../loader/loader__core.js';
24
24
  import '../global/dom.js';
25
- import 'react-waypoint';
26
25
  import '../checkbox/checkbox.js';
27
26
  import '@jetbrains/icons/checkmark-14px';
28
27
  import '@jetbrains/icons/remove-14px';
@@ -26,7 +26,6 @@ import '../loader/loader__core.js';
26
26
  import '../global/dom.js';
27
27
  import '../table/selection.js';
28
28
  import '../table/header.js';
29
- import 'react-waypoint';
30
29
  import '../checkbox/checkbox.js';
31
30
  import '@jetbrains/icons/checkmark-14px';
32
31
  import '@jetbrains/icons/remove-14px';
@@ -25,7 +25,6 @@ import '../loader/loader__core.js';
25
25
  import '../global/dom.js';
26
26
  import '../table/selection.js';
27
27
  import '../table/header.js';
28
- import 'react-waypoint';
29
28
  import '../checkbox/checkbox.js';
30
29
  import '@jetbrains/icons/checkmark-14px';
31
30
  import '@jetbrains/icons/remove-14px';
@@ -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: {
@@ -117,7 +117,7 @@ class TagsInput extends PureComponent {
117
117
  label: PropTypes.node,
118
118
  loadingMessage: PropTypes.string,
119
119
  notFoundMessage: PropTypes.string,
120
- hint: PropTypes.string,
120
+ hint: PropTypes.node,
121
121
  allowAddNewTags: PropTypes.bool
122
122
  };
123
123
  static defaultProps = {
@@ -398,7 +398,8 @@ class TagsInput extends PureComponent {
398
398
  handleRemove: this.handleRemove,
399
399
  className: modules_5aa8aaf3.tagsList,
400
400
  tagClassName: modules_5aa8aaf3.tag,
401
- handleClick: this.handleClick
401
+ handleClick: this.handleClick,
402
+ customTagComponent: this.props.customTagComponent
402
403
  }, /*#__PURE__*/React.createElement(Select, {
403
404
  id: this.id,
404
405
  ref: this.selectRef,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "5.0.150",
3
+ "version": "5.0.152",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",
@@ -162,7 +162,7 @@
162
162
  "react-test-renderer": "^18.2.0",
163
163
  "regenerator-runtime": "^0.13.11",
164
164
  "rimraf": "^5.0.1",
165
- "rollup": "^3.26.1",
165
+ "rollup": "^3.26.2",
166
166
  "rollup-plugin-clear": "^2.0.7",
167
167
  "rollup-plugin-styles": "^4.0.0",
168
168
  "sinon": "^15.2.0",