@jetbrains/ring-ui 7.0.91 → 7.0.93

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.
@@ -40,8 +40,7 @@ export default class BackgroundFlow {
40
40
  * promise is rejected if no token was received after {@link BackgroundToken.BACKGROUND_TIMEOUT} ms.
41
41
  */
42
42
  async _load() {
43
- const authRequest = await this._requestBuilder
44
- .prepareAuthRequest({ request_credentials: 'silent' }, { nonRedirect: true });
43
+ const authRequest = await this._requestBuilder.prepareAuthRequest({ request_credentials: 'silent' }, { nonRedirect: true });
45
44
  return new Promise((resolve, reject) => {
46
45
  function onMessage(e) {
47
46
  if (e.data === HUB_AUTH_PAGE_OPENED) {
@@ -17,8 +17,8 @@ export default function AvatarStack({ children, className, size = Size.Size20, e
17
17
  height: size,
18
18
  '--ring-avatar-stack-index': Children.count(children),
19
19
  fontSize: fontSizes[size],
20
- }} anchor={(<button type='button' className={styles.extraButton}>
20
+ }} anchor={<button type='button' className={styles.extraButton}>
21
21
  <Avatar size={size} info={<span className={styles.extraText}>{`+${extraItems.length}`}</span>}/>
22
- </button>)} data={extraItems} menuProps={{ offset: 4, ...dropdownMenuProps?.menuProps }} {...dropdownMenuProps}/>) : null}
22
+ </button>} data={extraItems} menuProps={{ offset: 4, ...dropdownMenuProps?.menuProps }} {...dropdownMenuProps}/>) : null}
23
23
  </div>);
24
24
  }
@@ -143,7 +143,7 @@ export default class Popup extends PureComponent {
143
143
  }
144
144
  };
145
145
  shouldUseCssPositioning() {
146
- if (!supportsCSSAnchorPositioning()) {
146
+ if (!supportsCSSAnchorPositioning) {
147
147
  return false;
148
148
  }
149
149
  return this.props.cssPositioning ?? this.cssPositioningFromContext ?? getConfiguration().popupsCssPositioning;
@@ -1,5 +1,5 @@
1
1
  import { Directions } from './popup.consts';
2
- export declare const supportsCSSAnchorPositioning: () => boolean;
2
+ export declare const supportsCSSAnchorPositioning: boolean;
3
3
  interface SetCSSAnchorPositioningParams {
4
4
  popup: HTMLElement;
5
5
  anchor: HTMLElement;
@@ -1,7 +1,12 @@
1
1
  import { getRect } from '../global/dom';
2
2
  import { calculateMinWidth, MaxHeight } from './position';
3
3
  import { Directions, Dimension } from './popup.consts';
4
- export const supportsCSSAnchorPositioning = () => CSS?.supports?.('anchor-name', 'none');
4
+ import sniffr from '../global/sniffer';
5
+ const doesSupportCSSAnchorPositioning = () => {
6
+ const isSafari = sniffr.browser.name === 'safari';
7
+ return !isSafari && CSS?.supports?.('anchor-name', 'none');
8
+ };
9
+ export const supportsCSSAnchorPositioning = doesSupportCSSAnchorPositioning();
5
10
  const getPositionArea = (direction) => {
6
11
  switch (direction) {
7
12
  case Directions.BOTTOM_RIGHT:
@@ -54,7 +59,10 @@ export const setCSSAnchorPositioning = ({ popup, anchor, uid, minWidth, top, lef
54
59
  }
55
60
  // When all directions are BOTTOM, the `max-height: 100%` from CSS should stay applied so popup doesn't overflow the anchor RG-2754
56
61
  const SHOULD_AUTO_SHRINK = directions.every(d => d.startsWith('BOTTOM'));
57
- if (!SHOULD_AUTO_SHRINK) {
62
+ if (SHOULD_AUTO_SHRINK) {
63
+ popup.style.removeProperty('max-height'); // Reset to 100% from CSS to allow shrinking based on viewport height
64
+ }
65
+ else {
58
66
  const screenWithMargin = `calc(100vh - ${Dimension.MARGIN * 2}px)`;
59
67
  if (maxHeight === 'screen' || maxHeight === MaxHeight.SCREEN) {
60
68
  popup.style.maxHeight = screenWithMargin;
@@ -62,9 +70,9 @@ export const setCSSAnchorPositioning = ({ popup, anchor, uid, minWidth, top, lef
62
70
  else if (typeof maxHeight === 'number' && maxHeight > 0) {
63
71
  popup.style.maxHeight = `min(${screenWithMargin}, ${maxHeight}px)`;
64
72
  }
65
- }
66
- else {
67
- popup.style.maxHeight = '';
73
+ else {
74
+ popup.style.maxHeight = 'none';
75
+ }
68
76
  }
69
77
  const [initialPositionStyle, initialPositionName] = getPositionArea(directions[0]);
70
78
  popup.style.setProperty('position-area', initialPositionStyle);
@@ -1,4 +1,4 @@
1
- import { getDocumentScrollLeft, getDocumentScrollTop, getRect, isMounted, } from '../global/dom';
1
+ import { getDocumentScrollLeft, getDocumentScrollTop, getRect, isMounted } from '../global/dom';
2
2
  import { Dimension, Directions, MaxHeight, MinWidth } from './popup.consts';
3
3
  export { Dimension, Directions, MaxHeight, MinWidth };
4
4
  function getScrollingCoordinates(container) {
@@ -15,6 +15,7 @@ import { type SelectItem } from './select';
15
15
  export type FilterFn<T> = (itemToCheck: SelectItem<T>, checkString: string, data: readonly SelectItem<T>[]) => boolean;
16
16
  export interface Filter<T = unknown> {
17
17
  fn?: FilterFn<T> | null | undefined;
18
+ preserveSeparators?: boolean | null | undefined;
18
19
  fuzzy?: boolean | null | undefined;
19
20
  value?: string | null | undefined;
20
21
  placeholder?: string | undefined;
@@ -6,7 +6,7 @@ import { type LabelType } from '../control-label/control-label';
6
6
  import { type ListDataItem } from '../list/consts';
7
7
  import { type Directions } from '../popup/popup.consts';
8
8
  import { ControlsHeight, ControlsHeightContext } from '../global/controls-height';
9
- import SelectPopup, { type Filter, type FilterFn, type Multiple, type Tags } from './select-popup';
9
+ import SelectPopup, { type Filter, type Multiple, type Tags } from './select-popup';
10
10
  /**
11
11
  * @name Select
12
12
  */
@@ -240,7 +240,6 @@ export default class Select<T = unknown> extends Component<SelectProps<T>, Selec
240
240
  getTopbar(): ReactNode;
241
241
  getLowerCaseLabel: typeof getLowerCaseLabel;
242
242
  doesLabelMatch: typeof doesLabelMatch;
243
- getFilterFn(): FilterFn<T>;
244
243
  getListItems(rawFilterString: string, data?: SelectItem<T>[]): SelectItem<T>[];
245
244
  filterValue(): string;
246
245
  filterValue(setValue: string): void;
@@ -62,15 +62,18 @@ function doesLabelMatch(itemToCheck, fn) {
62
62
  return fn(lowerCaseLabel);
63
63
  }
64
64
  function getFilterFn(filter) {
65
+ const preserveSeparators = filter === false || (typeof filter === 'object' && filter.preserveSeparators);
65
66
  if (typeof filter === 'object') {
66
67
  if (filter.fn) {
67
- return filter.fn;
68
+ return { check: filter.fn, preserveSeparators };
68
69
  }
69
70
  if (filter.fuzzy) {
70
- return (itemToCheck, checkString) => doesLabelMatch(itemToCheck, lowerCaseLabel => fuzzyHighlight(checkString, lowerCaseLabel).matched);
71
+ const check = (itemToCheck, checkString) => doesLabelMatch(itemToCheck, lowerCaseLabel => fuzzyHighlight(checkString, lowerCaseLabel).matched);
72
+ return { check, preserveSeparators };
71
73
  }
72
74
  }
73
- return (itemToCheck, checkString) => doesLabelMatch(itemToCheck, lowerCaseLabel => lowerCaseLabel.indexOf(checkString) >= 0);
75
+ const check = (itemToCheck, checkString) => doesLabelMatch(itemToCheck, lowerCaseLabel => lowerCaseLabel.indexOf(checkString) >= 0);
76
+ return { check, preserveSeparators };
74
77
  }
75
78
  function buildMultipleMap(selected) {
76
79
  return selected.reduce((acc, item) => {
@@ -91,10 +94,15 @@ function getListItems(props, state, rawFilterString, data = props.data) {
91
94
  const lowerCaseString = filterString.toLowerCase();
92
95
  const filteredData = [];
93
96
  let exactMatch = false;
94
- const check = getFilterFn(props.filter);
97
+ const { check, preserveSeparators } = getFilterFn(props.filter);
95
98
  for (let i = 0; i < data.length; i++) {
96
99
  const item = { ...data[i] };
97
100
  if (check(item, lowerCaseString, data)) {
101
+ if (!preserveSeparators &&
102
+ List.isItemType(List.ListProps.Type.SEPARATOR, item) &&
103
+ (!filteredData.length || List.isItemType(List.ListProps.Type.SEPARATOR, filteredData[filteredData.length - 1]))) {
104
+ continue;
105
+ }
98
106
  exactMatch = item.label === filterString;
99
107
  if (props.multiple && !(typeof props.multiple === 'object' && props.multiple.removeSelectedItems)) {
100
108
  item.checkbox = !!state.multipleMap?.[item.key];
@@ -116,6 +124,11 @@ function getListItems(props, state, rawFilterString, data = props.data) {
116
124
  }
117
125
  }
118
126
  }
127
+ if (!preserveSeparators &&
128
+ filteredData.length &&
129
+ List.isItemType(List.ListProps.Type.SEPARATOR, filteredData[filteredData.length - 1])) {
130
+ filteredData.pop();
131
+ }
119
132
  let addButton = null;
120
133
  const { add } = props;
121
134
  if ((add && filterString && !exactMatch) || (add && add.alwaysVisible)) {
@@ -497,9 +510,6 @@ export default class Select extends Component {
497
510
  }
498
511
  getLowerCaseLabel = getLowerCaseLabel;
499
512
  doesLabelMatch = doesLabelMatch;
500
- getFilterFn() {
501
- return getFilterFn(this.props.filter);
502
- }
503
513
  getListItems(rawFilterString, data) {
504
514
  const { filteredData, addButton } = getListItems(this.props, this.state, rawFilterString, data);
505
515
  this.setState({ addButton });
@@ -196,6 +196,7 @@
196
196
  .avatarContainer {
197
197
  display: inline-block;
198
198
  overflow: hidden;
199
+ flex-shrink: 0;
199
200
 
200
201
  box-sizing: border-box;
201
202
  width: var(--ring-tag-max-height);
@@ -23,9 +23,9 @@ export default class SmartUserCardTooltip extends Component {
23
23
  this.setState({ loading: false });
24
24
  }
25
25
  };
26
- renderNoUser = () => (this.state.loading ? (<div className={styles.userCardSpaced}>
26
+ renderNoUser = () => this.state.loading ? (<div className={styles.userCardSpaced}>
27
27
  <LoaderInline />
28
- </div>) : (''));
28
+ </div>) : ('');
29
29
  render() {
30
30
  const { user } = this.state;
31
31
  const { children, userDataSource, ...restProps } = this.props;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "7.0.91",
3
+ "version": "7.0.93",
4
4
  "description": "JetBrains UI library",
5
5
  "author": {
6
6
  "name": "JetBrains"
@@ -93,44 +93,44 @@
93
93
  "@babel/eslint-parser": "^7.28.6",
94
94
  "@csstools/css-parser-algorithms": "^4.0.0",
95
95
  "@csstools/stylelint-no-at-nest-rule": "^5.0.0",
96
- "@eslint/compat": "^2.0.1",
96
+ "@eslint/compat": "^2.0.2",
97
97
  "@eslint/eslintrc": "^3.3.3",
98
98
  "@eslint/js": "^9.39.2",
99
- "@figma/code-connect": "^1.3.12",
99
+ "@figma/code-connect": "^1.3.13",
100
100
  "@jetbrains/eslint-config": "^6.0.5",
101
101
  "@jetbrains/logos": "3.0.0-canary.734b213.0",
102
102
  "@jetbrains/rollup-css-plugin": "./packages/rollup-css-plugin",
103
103
  "@jetbrains/stylelint-config": "^4.0.2",
104
- "@primer/octicons": "^19.21.2",
104
+ "@primer/octicons": "^19.22.0",
105
105
  "@rollup/plugin-babel": "^6.1.0",
106
106
  "@rollup/plugin-json": "^6.1.0",
107
107
  "@rollup/plugin-node-resolve": "^16.0.3",
108
108
  "@rollup/plugin-replace": "^6.0.3",
109
- "@storybook/addon-a11y": "10.1.11",
110
- "@storybook/addon-docs": "^10.1.11",
111
- "@storybook/addon-themes": "^10.1.11",
109
+ "@storybook/addon-a11y": "10.2.8",
110
+ "@storybook/addon-docs": "^10.2.8",
111
+ "@storybook/addon-themes": "^10.2.8",
112
112
  "@storybook/csf": "^0.1.13",
113
- "@storybook/react-webpack5": "10.1.11",
113
+ "@storybook/react-webpack5": "10.2.8",
114
114
  "@storybook/test-runner": "^0.24.2",
115
115
  "@testing-library/dom": "^10.4.1",
116
- "@testing-library/react": "^16.3.1",
116
+ "@testing-library/react": "^16.3.2",
117
117
  "@testing-library/user-event": "^14.6.1",
118
118
  "@types/chai-as-promised": "^8.0.2",
119
119
  "@types/chai-dom": "1.11.3",
120
120
  "@types/markdown-it": "^14.1.2",
121
- "@types/react": "^19.2.8",
121
+ "@types/react": "^19.2.14",
122
122
  "@types/react-dom": "^19.2.3",
123
123
  "@types/webpack-env": "^1.18.8",
124
- "@vitejs/plugin-react": "^5.1.2",
125
- "@vitest/eslint-plugin": "^1.6.6",
124
+ "@vitejs/plugin-react": "^5.1.4",
125
+ "@vitest/eslint-plugin": "^1.6.7",
126
126
  "acorn": "^8.15.0",
127
127
  "babel-plugin-require-context-hook": "^1.0.0",
128
- "caniuse-lite": "^1.0.30001764",
128
+ "caniuse-lite": "^1.0.30001769",
129
129
  "chai-as-promised": "^8.0.2",
130
130
  "chai-dom": "^1.12.1",
131
- "cheerio": "^1.1.2",
132
- "core-js": "^3.47.0",
133
- "cpy-cli": "^6.0.0",
131
+ "cheerio": "^1.2.0",
132
+ "core-js": "^3.48.0",
133
+ "cpy-cli": "^7.0.0",
134
134
  "dotenv-cli": "^11.0.0",
135
135
  "eslint": "^9.39.2",
136
136
  "eslint-config-prettier": "^10.1.8",
@@ -142,11 +142,11 @@
142
142
  "eslint-plugin-prettier": "^5.5.5",
143
143
  "eslint-plugin-react": "^7.37.5",
144
144
  "eslint-plugin-react-hooks": "^7.0.1",
145
- "eslint-plugin-storybook": "^10.1.11",
145
+ "eslint-plugin-storybook": "^10.2.8",
146
146
  "eslint-plugin-unicorn": "^62.0.0",
147
147
  "events": "^3.3.0",
148
- "glob": "^13.0.0",
149
- "globals": "^17.0.0",
148
+ "glob": "^13.0.3",
149
+ "globals": "^17.3.0",
150
150
  "html-webpack-plugin": "^5.6.6",
151
151
  "http-server": "^14.1.1",
152
152
  "husky": "^9.1.7",
@@ -155,29 +155,29 @@
155
155
  "jest-environment-jsdom": "^30.2.0",
156
156
  "jest-teamcity": "^1.12.0",
157
157
  "lint-staged": "^16.2.7",
158
- "markdown-it": "^14.1.0",
158
+ "markdown-it": "^14.1.1",
159
159
  "merge-options": "^3.0.4",
160
160
  "pinst": "^3.0.0",
161
- "prettier": "^3.8.0",
161
+ "prettier": "^3.8.1",
162
162
  "raw-loader": "^4.0.2",
163
- "react": "^19.2.3",
164
- "react-dom": "^19.2.3",
163
+ "react": "^19.2.4",
164
+ "react-dom": "^19.2.4",
165
165
  "regenerator-runtime": "^0.14.1",
166
166
  "rimraf": "^6.1.2",
167
- "rollup": "^4.55.1",
167
+ "rollup": "^4.57.1",
168
168
  "rollup-plugin-clear": "^2.0.7",
169
169
  "storage-mock": "^2.1.0",
170
- "storybook": "10.1.11",
171
- "stylelint": "^17.0.0",
170
+ "storybook": "10.2.8",
171
+ "stylelint": "^17.3.0",
172
172
  "stylelint-config-sass-guidelines": "^12.1.0",
173
173
  "svg-inline-loader": "^0.8.2",
174
174
  "teamcity-service-messages": "^0.1.14",
175
175
  "terser-webpack-plugin": "^5.3.16",
176
176
  "typescript": "~5.9.3",
177
- "typescript-eslint": "^8.53.0",
177
+ "typescript-eslint": "^8.55.0",
178
178
  "vitest": "^4.0.18",
179
179
  "vitest-teamcity-reporter": "^0.4.1",
180
- "webpack": "^5.104.1",
180
+ "webpack": "^5.105.2",
181
181
  "webpack-cli": "^6.0.1"
182
182
  },
183
183
  "peerDependencies": {
@@ -200,10 +200,10 @@
200
200
  }
201
201
  },
202
202
  "dependencies": {
203
- "@babel/core": "^7.28.6",
203
+ "@babel/core": "^7.29.0",
204
204
  "@babel/preset-typescript": "^7.28.5",
205
205
  "@jetbrains/babel-preset-jetbrains": "^2.4.0",
206
- "@jetbrains/icons": "^5.15.0",
206
+ "@jetbrains/icons": "^5.16.0",
207
207
  "@jetbrains/postcss-require-hover": "^0.2.0",
208
208
  "@types/combokeys": "^2.4.9",
209
209
  "@types/element-resize-detector": "^1.1.6",
@@ -216,14 +216,14 @@
216
216
  "change-case": "^4.1.1",
217
217
  "classnames": "^2.5.1",
218
218
  "combokeys": "^3.0.1",
219
- "css-loader": "^7.1.2",
219
+ "css-loader": "^7.1.3",
220
220
  "csstype": "^3.2.1",
221
221
  "date-fns": "^4.1.0",
222
222
  "dequal": "^2.0.3",
223
223
  "element-resize-detector": "^1.2.4",
224
224
  "fastdom": "^1.0.12",
225
225
  "file-loader": "^6.2.0",
226
- "focus-trap": "^7.8.0",
226
+ "focus-trap": "^8.0.0",
227
227
  "highlight.js": "^10.7.2",
228
228
  "just-debounce-it": "^3.2.0",
229
229
  "memoize-one": "^6.0.0",
@@ -233,7 +233,7 @@
233
233
  "postcss-font-family-system-ui": "^5.0.0",
234
234
  "postcss-loader": "^8.2.0",
235
235
  "postcss-modules-values-replace": "^4.2.2",
236
- "postcss-preset-env": "^11.1.1",
236
+ "postcss-preset-env": "^11.1.3",
237
237
  "react-compiler-runtime": "^1.0.0",
238
238
  "react-movable": "^3.4.1",
239
239
  "react-virtualized": "^9.22.6",