@jetbrains/ring-ui-built 7.0.52 → 7.0.54

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.
@@ -39,6 +39,7 @@ class Title extends PureComponent {
39
39
  innerRef,
40
40
  selectable,
41
41
  selected,
42
+ partialSelected,
42
43
  collapserExpander
43
44
  } = this.props;
44
45
  const classes = classNames(className, {
@@ -61,6 +62,7 @@ class Title extends PureComponent {
61
62
  "aria-labelledby": this.id,
62
63
  className: showFocus ? 'ring-checkbox_focus' : '',
63
64
  checked: selected,
65
+ indeterminate: partialSelected,
64
66
  onFocus: this.onCheckboxFocus,
65
67
  onChange: this.onCheckboxChange,
66
68
  tabIndex: -1
@@ -18,12 +18,12 @@ import 'core-js/modules/es.regexp.exec.js';
18
18
  import 'combokeys';
19
19
  import '../global/sniffer.js';
20
20
  import 'sniffr';
21
- import '../global/data-tests.js';
22
21
  import '../loader/loader__core.js';
23
22
  import '../global/dom.js';
24
23
  import '@jetbrains/icons/chevron-right';
25
24
  import '@jetbrains/icons/chevron-down';
26
25
  import '../link/link.js';
26
+ import '../global/data-tests.js';
27
27
  import '../link/clickableLink.js';
28
28
  import '../_helpers/link.js';
29
29
  import '../text/text.js';
@@ -153,6 +153,7 @@ class DataList extends PureComponent {
153
153
  selection: selection,
154
154
  selectable: item.selectable,
155
155
  selected: selection.isSelected(model),
156
+ partialSelected: selection.isPartialSelected(model),
156
157
  onSelect: this.onItemSelect,
157
158
  showMoreLessButton: showMoreLessButton,
158
159
  onItemMoreLess: this.props.onItemMoreLess
@@ -1,5 +1,6 @@
1
1
  import { PureComponent, ReactNode } from 'react';
2
- import Selection, { SelectionItem } from '../table/selection';
2
+ import { SelectionItem } from '../table/selection';
3
+ import Selection from './selection';
3
4
  export declare enum moreLessButtonStates {
4
5
  UNUSED = 0,
5
6
  MORE = 1,
@@ -32,6 +33,7 @@ export interface ItemProps<T extends SelectionItem> extends BaseFormattedItem<T>
32
33
  showFocus?: boolean | undefined;
33
34
  selection: Selection<T>;
34
35
  selected?: boolean | undefined;
36
+ partialSelected?: boolean | undefined;
35
37
  }
36
38
  export default class Item<T extends SelectionItem> extends PureComponent<ItemProps<T>> {
37
39
  static defaultProps: {
@@ -97,6 +97,7 @@ class Item extends PureComponent {
97
97
  selection: selection,
98
98
  selectable: item.selectable,
99
99
  selected: selection.isSelected(model),
100
+ partialSelected: selection.isPartialSelected(model),
100
101
  onSelect: onSelect
101
102
  }, item.key || item.id);
102
103
  });
@@ -111,6 +112,7 @@ class Item extends PureComponent {
111
112
  showFocus,
112
113
  selectable,
113
114
  selected,
115
+ partialSelected,
114
116
  collapsible,
115
117
  collapsed,
116
118
  onCollapse,
@@ -171,6 +173,7 @@ class Item extends PureComponent {
171
173
  showFocus: showFocus,
172
174
  selectable: selectable,
173
175
  selected: selected,
176
+ partialSelected: partialSelected,
174
177
  collapserExpander: collapserExpander,
175
178
  onFocus: this.onFocus,
176
179
  onSelect: this.onSelect,
@@ -1,5 +1,13 @@
1
- import TableSelection, { CloneWithConfig, SelectionItem } from '../table/selection';
1
+ import TableSelection, { CloneWithConfig, SelectionItem, TableSelectionConfig } from '../table/selection';
2
+ interface DataListSelectionConfig<T extends SelectionItem> extends TableSelectionConfig<T> {
3
+ partialSelected?: Set<T> | undefined;
4
+ }
5
+ interface DataListCloneWithConfig<T> extends CloneWithConfig<T> {
6
+ partialSelected?: Set<T> | undefined;
7
+ }
2
8
  export default class Selection<T extends SelectionItem> extends TableSelection<T> {
9
+ protected _partialSelected: Set<T>;
10
+ constructor({ partialSelected, ...props }: DataListSelectionConfig<T>);
3
11
  protected _buildData(data: T[]): Set<T>;
4
12
  protected _buildSelected(data: Set<T>, selected: Set<T>): Set<T>;
5
13
  private _getDescendants;
@@ -9,8 +17,10 @@ export default class Selection<T extends SelectionItem> extends TableSelection<T
9
17
  private _selectAncestors;
10
18
  private _deselectAncestors;
11
19
  select(value?: T | null): Selection<T>;
20
+ isPartialSelected(value: T | null): boolean;
12
21
  focus(value: T | null | undefined): Selection<T>;
13
22
  resetSelection(): Selection<T>;
14
- cloneWith(config: CloneWithConfig<T>): Selection<T>;
23
+ cloneWith({ partialSelected, ...rest }: DataListCloneWithConfig<T>): Selection<T>;
15
24
  deselect(value?: T | null): Selection<T>;
16
25
  }
26
+ export {};
@@ -1,8 +1,19 @@
1
+ import { a as _objectWithoutProperties, _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
1
2
  import 'core-js/modules/web.dom-collections.iterator.js';
2
3
  import Selection$1 from '../table/selection.js';
3
- import '../_helpers/_rollupPluginBabelHelpers.js';
4
4
 
5
+ const _excluded = ["partialSelected"],
6
+ _excluded2 = ["partialSelected"];
5
7
  class Selection extends Selection$1 {
8
+ constructor(_ref) {
9
+ let {
10
+ partialSelected = new Set()
11
+ } = _ref,
12
+ props = _objectWithoutProperties(_ref, _excluded);
13
+ super(props);
14
+ _defineProperty(this, "_partialSelected", void 0);
15
+ this._partialSelected = partialSelected;
16
+ }
6
17
  _buildData(data) {
7
18
  return new Set(this._getDescendants(data));
8
19
  }
@@ -10,7 +21,7 @@ class Selection extends Selection$1 {
10
21
  const _selected = new Set(selected);
11
22
  [...data].forEach(item => {
12
23
  if (_selected.has(item)) {
13
- this._selectDescendants(item, _selected);
24
+ this._selectDescendants(item, _selected, this._partialSelected);
14
25
  }
15
26
  });
16
27
  return _selected;
@@ -31,22 +42,40 @@ class Selection extends Selection$1 {
31
42
  }
32
43
  return result;
33
44
  }
34
- _selectDescendants(item, selected) {
35
- this._getDescendants(this._getChildren(item)).forEach(it => selected.add(it));
45
+ _selectDescendants(item, selected, partialSelected) {
46
+ this._getDescendants(this._getChildren(item)).forEach(it => {
47
+ selected.add(it);
48
+ partialSelected.delete(it);
49
+ });
36
50
  }
37
- _deselectDescendants(item, selected) {
38
- this._getDescendants(this._getChildren(item)).forEach(it => selected.delete(it));
51
+ _deselectDescendants(item, selected, partialSelected) {
52
+ this._getDescendants(this._getChildren(item)).forEach(it => {
53
+ selected.delete(it);
54
+ partialSelected.delete(it);
55
+ });
39
56
  }
40
- _selectAncestors(item, selected) {
57
+ _selectAncestors(item, selected, partialSelected) {
41
58
  this._getAncestors(item).forEach(ancestor => {
42
59
  const groupIsSelected = this._getChildren(ancestor).filter(it => this._isItemSelectable(it)).every(it => selected.has(it));
60
+ const groupIsPartialSelected = this._getChildren(ancestor).filter(it => this._isItemSelectable(it)).some(it => selected.has(it) || partialSelected.has(it));
43
61
  if (groupIsSelected) {
44
62
  selected.add(ancestor);
63
+ partialSelected.delete(ancestor);
64
+ } else if (groupIsPartialSelected) {
65
+ partialSelected.add(ancestor);
45
66
  }
46
67
  });
47
68
  }
48
- _deselectAncestors(item, selected) {
49
- this._getAncestors(item).forEach(it => selected.delete(it));
69
+ _deselectAncestors(item, selected, partialSelected) {
70
+ this._getAncestors(item).forEach(ancestor => {
71
+ const groupIsPartialSelected = this._getChildren(ancestor).filter(it => this._isItemSelectable(it)).filter(it => it !== item).some(it => selected.has(it) || partialSelected.has(it));
72
+ if (groupIsPartialSelected) {
73
+ partialSelected.add(ancestor);
74
+ } else {
75
+ partialSelected.delete(ancestor);
76
+ }
77
+ selected.delete(ancestor);
78
+ });
50
79
  }
51
80
  select() {
52
81
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
@@ -54,21 +83,40 @@ class Selection extends Selection$1 {
54
83
  return this;
55
84
  }
56
85
  const selected = new Set(this._selected);
86
+ const partialSelected = new Set(this._partialSelected);
57
87
  selected.add(value);
58
- this._selectDescendants(value, selected);
59
- this._selectAncestors(value, selected);
88
+ partialSelected.delete(value);
89
+ this._selectDescendants(value, selected, partialSelected);
90
+ this._selectAncestors(value, selected, partialSelected);
60
91
  return this.cloneWith({
61
- selected
92
+ selected,
93
+ partialSelected
62
94
  });
63
95
  }
96
+ isPartialSelected(value) {
97
+ return value != null && this._partialSelected.has(value);
98
+ }
64
99
  focus(value) {
65
100
  return super.focus(value);
66
101
  }
67
102
  resetSelection() {
68
103
  return super.resetSelection();
69
104
  }
70
- cloneWith(config) {
71
- return super.cloneWith(config);
105
+ cloneWith(_ref2) {
106
+ let {
107
+ partialSelected = this._partialSelected
108
+ } = _ref2,
109
+ rest = _objectWithoutProperties(_ref2, _excluded2);
110
+ const parentClone = super.cloneWith(rest);
111
+ return new this.constructor({
112
+ data: parentClone._rawData,
113
+ selected: parentClone._selected,
114
+ focused: parentClone._focused,
115
+ getKey: parentClone._getKey,
116
+ getChildren: parentClone._getChildren,
117
+ isItemSelectable: parentClone._isItemSelectable,
118
+ partialSelected
119
+ });
72
120
  }
73
121
  deselect() {
74
122
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
@@ -76,11 +124,14 @@ class Selection extends Selection$1 {
76
124
  return this;
77
125
  }
78
126
  const selected = new Set(this._selected);
127
+ const partialSelected = new Set(this._partialSelected);
79
128
  selected.delete(value);
80
- this._deselectDescendants(value, selected);
81
- this._deselectAncestors(value, selected);
129
+ partialSelected.delete(value);
130
+ this._deselectDescendants(value, selected, partialSelected);
131
+ this._deselectAncestors(value, selected, partialSelected);
82
132
  return this.cloneWith({
83
- selected
133
+ selected,
134
+ partialSelected
84
135
  });
85
136
  }
86
137
  }
@@ -4,6 +4,7 @@ export interface TitleProps extends FocusSensorAddProps<HTMLDivElement> {
4
4
  onSelect: (selected: boolean) => void;
5
5
  selectable?: boolean | undefined;
6
6
  selected?: boolean | undefined;
7
+ partialSelected?: boolean | undefined;
7
8
  showFocus?: boolean | undefined;
8
9
  offset?: number | undefined;
9
10
  className?: string | null | undefined;
@@ -23,7 +23,7 @@ function adaptiveIslandHOC(ComposedComponent) {
23
23
  clientHeight
24
24
  } = _ref;
25
25
  if (scrollHeight - clientHeight >= interpolateLinear(TITLE_RESIZE_THRESHOLD, TITLE_RESIZE_END, (_this$state$phase = this.state.phase) !== null && _this$state$phase !== void 0 ? _this$state$phase : 0)) {
26
- const phase = Math.min(1, scrollTop / TITLE_RESIZE_END);
26
+ const phase = Math.min(1, Math.max(0, scrollTop) / TITLE_RESIZE_END);
27
27
  this.setState({
28
28
  phase
29
29
  });
@@ -18,7 +18,7 @@ const Start = {
18
18
  SPACING: 0
19
19
  };
20
20
  const End = {
21
- FONT_SIZE: 13,
21
+ FONT_SIZE: 14,
22
22
  LINE_HEIGHT: 20,
23
23
  PADDING_TOP: 16,
24
24
  PADDING_BOTTOM: 8,
@@ -33,6 +33,20 @@ class Header extends Component {
33
33
  var _this$props$phase;
34
34
  return interpolateLinear(Start[name], End[name], (_this$props$phase = this.props.phase) !== null && _this$props$phase !== void 0 ? _this$props$phase : 0);
35
35
  }
36
+ getTitleStyle(phase) {
37
+ if (phase === undefined) return;
38
+ if (phase < 1) {
39
+ const scaleFont = this.style('FONT_SIZE') / Start.FONT_SIZE;
40
+ return {
41
+ fontSize: Start.FONT_SIZE,
42
+ transform: "translate(".concat(this.style('X'), "px, ").concat(this.style('Y'), "px) scale(").concat(scaleFont, ")"),
43
+ letterSpacing: this.style('SPACING')
44
+ };
45
+ }
46
+ return {
47
+ fontSize: End.FONT_SIZE
48
+ };
49
+ }
36
50
  render() {
37
51
  const _this$props = this.props,
38
52
  {
@@ -52,12 +66,7 @@ class Header extends Component {
52
66
  paddingTop: this.style('PADDING_TOP'),
53
67
  paddingBottom: this.style('PADDING_BOTTOM')
54
68
  } : undefined;
55
- const scaleFont = phase != null && this.style('FONT_SIZE') / Start.FONT_SIZE;
56
- const titleStyle = phase != null && phase < 1 ? {
57
- fontSize: Start.FONT_SIZE,
58
- transform: "translate(".concat(this.style('X'), "px, ").concat(this.style('Y'), "px) scale(").concat(scaleFont, ")"),
59
- letterSpacing: this.style('SPACING')
60
- } : undefined;
69
+ const titleStyle = this.getTitleStyle(phase);
61
70
  return jsxs("div", _objectSpread2(_objectSpread2({}, restProps), {}, {
62
71
  "data-test": "ring-island-header",
63
72
  className: classes,
@@ -2,7 +2,6 @@ import { _ as _defineProperty, a as _objectWithoutProperties, b as _objectSpread
2
2
  import 'core-js/modules/web.dom-collections.iterator.js';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import { PureComponent } from 'react';
5
- import joinDataTestAttributes from '../global/data-tests.js';
6
5
  import LoaderCore from './loader__core.js';
7
6
  import 'core-js/modules/es.regexp.exec.js';
8
7
  import '../global/dom.js';
@@ -48,9 +47,7 @@ class Loader extends PureComponent {
48
47
  deterministic
49
48
  } = _this$props,
50
49
  restProps = _objectWithoutProperties(_this$props, _excluded);
51
- return jsx("div", _objectSpread2(_objectSpread2({
52
- "data-test": joinDataTestAttributes('ring-loader', dataTest)
53
- }, restProps), {}, {
50
+ return jsx("div", _objectSpread2(_objectSpread2({}, restProps), {}, {
54
51
  ref: this.initLoader
55
52
  }));
56
53
  }
@@ -4,7 +4,6 @@ import { PureComponent } from 'react';
4
4
  import classNames from 'classnames';
5
5
  import Loader from '../loader/loader.js';
6
6
  import 'core-js/modules/web.dom-collections.iterator.js';
7
- import '../global/data-tests.js';
8
7
  import '../loader/loader__core.js';
9
8
  import 'core-js/modules/es.regexp.exec.js';
10
9
  import '../global/dom.js';
@@ -8,11 +8,11 @@ const MAJOR_VERSION_INDEX = 0;
8
8
  /**
9
9
  * SUPPORTED_BROWSERS are defined by Babel plugin, see babel config
10
10
  */
11
- if (!["and_chr 137", "and_ff 139", "and_qq 14.9", "and_uc 15.5", "android 137", "chrome 137", "chrome 136", "chrome 135", "chrome 134", "chrome 133", "chrome 132", "chrome 131", "chrome 130", "chrome 128", "chrome 126", "chrome 125", "chrome 123", "chrome 121", "chrome 109", "edge 137", "edge 136", "edge 135", "firefox 139", "firefox 138", "firefox 137", "firefox 128", "firefox 115", "ios_saf 18.5", "ios_saf 18.4", "ios_saf 18.3", "ios_saf 18.2", "ios_saf 18.1", "ios_saf 18.0", "ios_saf 17.6-17.7", "ios_saf 17.5", "ios_saf 17.4", "ios_saf 16.6-16.7", "ios_saf 16.3", "ios_saf 16.1", "ios_saf 15.6-15.8", "ios_saf 14.0-14.4", "ios_saf 12.2-12.5", "ios_saf 11.0-11.2", "kaios 3.0-3.1", "kaios 2.5", "op_mini all", "op_mob 80", "opera 117", "opera 116", "safari 18.5", "safari 18.4", "safari 18.3", "safari 17.6", "safari 17.1", "safari 16.6", "safari 15.6", "samsung 28", "samsung 27"]) {
11
+ if (!["and_chr 137", "and_ff 139", "and_qq 14.9", "and_uc 15.5", "android 137", "chrome 138", "chrome 137", "chrome 136", "chrome 135", "chrome 134", "chrome 133", "chrome 132", "chrome 131", "chrome 130", "chrome 128", "chrome 126", "chrome 125", "chrome 123", "chrome 121", "chrome 109", "edge 137", "edge 136", "edge 135", "firefox 140", "firefox 139", "firefox 138", "firefox 137", "firefox 128", "firefox 115", "ios_saf 18.5", "ios_saf 18.4", "ios_saf 18.3", "ios_saf 18.2", "ios_saf 18.1", "ios_saf 18.0", "ios_saf 17.6-17.7", "ios_saf 17.5", "ios_saf 17.4", "ios_saf 16.6-16.7", "ios_saf 16.3", "ios_saf 16.1", "ios_saf 15.6-15.8", "ios_saf 14.0-14.4", "ios_saf 12.2-12.5", "ios_saf 11.0-11.2", "kaios 3.0-3.1", "kaios 2.5", "op_mini all", "op_mob 80", "opera 117", "opera 116", "safari 18.5", "safari 18.4", "safari 18.3", "safari 17.6", "safari 17.1", "safari 16.6", "safari 15.6", "samsung 28", "samsung 27"]) {
12
12
  // eslint-disable-next-line no-console
13
13
  console.warn('Ring UI: no SUPPORTED_BROWSERS passed. Please check babel config.');
14
14
  }
15
- const SUPPORTED = ["and_chr 137", "and_ff 139", "and_qq 14.9", "and_uc 15.5", "android 137", "chrome 137", "chrome 136", "chrome 135", "chrome 134", "chrome 133", "chrome 132", "chrome 131", "chrome 130", "chrome 128", "chrome 126", "chrome 125", "chrome 123", "chrome 121", "chrome 109", "edge 137", "edge 136", "edge 135", "firefox 139", "firefox 138", "firefox 137", "firefox 128", "firefox 115", "ios_saf 18.5", "ios_saf 18.4", "ios_saf 18.3", "ios_saf 18.2", "ios_saf 18.1", "ios_saf 18.0", "ios_saf 17.6-17.7", "ios_saf 17.5", "ios_saf 17.4", "ios_saf 16.6-16.7", "ios_saf 16.3", "ios_saf 16.1", "ios_saf 15.6-15.8", "ios_saf 14.0-14.4", "ios_saf 12.2-12.5", "ios_saf 11.0-11.2", "kaios 3.0-3.1", "kaios 2.5", "op_mini all", "op_mob 80", "opera 117", "opera 116", "safari 18.5", "safari 18.4", "safari 18.3", "safari 17.6", "safari 17.1", "safari 16.6", "safari 15.6", "samsung 28", "samsung 27"] || [];
15
+ const SUPPORTED = ["and_chr 137", "and_ff 139", "and_qq 14.9", "and_uc 15.5", "android 137", "chrome 138", "chrome 137", "chrome 136", "chrome 135", "chrome 134", "chrome 133", "chrome 132", "chrome 131", "chrome 130", "chrome 128", "chrome 126", "chrome 125", "chrome 123", "chrome 121", "chrome 109", "edge 137", "edge 136", "edge 135", "firefox 140", "firefox 139", "firefox 138", "firefox 137", "firefox 128", "firefox 115", "ios_saf 18.5", "ios_saf 18.4", "ios_saf 18.3", "ios_saf 18.2", "ios_saf 18.1", "ios_saf 18.0", "ios_saf 17.6-17.7", "ios_saf 17.5", "ios_saf 17.4", "ios_saf 16.6-16.7", "ios_saf 16.3", "ios_saf 16.1", "ios_saf 15.6-15.8", "ios_saf 14.0-14.4", "ios_saf 12.2-12.5", "ios_saf 11.0-11.2", "kaios 3.0-3.1", "kaios 2.5", "op_mini all", "op_mob 80", "opera 117", "opera 116", "safari 18.5", "safari 18.4", "safari 18.3", "safari 17.6", "safari 17.1", "safari 16.6", "safari 15.6", "samsung 28", "samsung 27"] || [];
16
16
  const WHITE_LISTED_BROWSERS = ['chrome', 'firefox', 'safari', 'edge'];
17
17
  const WHITE_LIST = SUPPORTED.reduce((acc, item) => {
18
18
  var _item$match;