@jetbrains/ring-ui 7.0.86 → 7.0.88

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.
@@ -29,6 +29,8 @@
29
29
  top: unset;
30
30
  left: unset;
31
31
 
32
+ max-height: 100%;
33
+
32
34
  margin: 0;
33
35
  }
34
36
 
@@ -163,6 +163,7 @@ export default class Popup extends PureComponent {
163
163
  left: this.props.left,
164
164
  directions: this.props.directions,
165
165
  offset: this.props.offset,
166
+ maxHeight: this.props.maxHeight,
166
167
  });
167
168
  const { direction } = this.position();
168
169
  if (direction) {
@@ -9,6 +9,7 @@ interface SetCSSAnchorPositioningParams {
9
9
  left?: number;
10
10
  directions: readonly Directions[];
11
11
  offset?: number;
12
+ maxHeight?: number | 'screen' | null;
12
13
  }
13
- export declare const setCSSAnchorPositioning: ({ popup, anchor, uid, minWidth, top, left, directions, offset, }: SetCSSAnchorPositioningParams) => void;
14
+ export declare const setCSSAnchorPositioning: ({ popup, anchor, uid, minWidth, top, left, directions, offset, maxHeight, }: SetCSSAnchorPositioningParams) => void;
14
15
  export {};
@@ -1,6 +1,6 @@
1
1
  import { getRect } from '../global/dom';
2
- import { calculateMinWidth } from './position';
3
- import { Directions } from './popup.consts';
2
+ import { calculateMinWidth, MaxHeight } from './position';
3
+ import { Directions, Dimension } from './popup.consts';
4
4
  export const supportsCSSAnchorPositioning = () => CSS?.supports?.('anchor-name', 'none');
5
5
  const getPositionArea = (direction) => {
6
6
  switch (direction) {
@@ -36,7 +36,7 @@ const getPositionFallbacks = (directions) => directions
36
36
  .slice(1)
37
37
  .map(direction => getPositionArea(direction)[1])
38
38
  .join(', ');
39
- export const setCSSAnchorPositioning = ({ popup, anchor, uid, minWidth, top, left, directions, offset, }) => {
39
+ export const setCSSAnchorPositioning = ({ popup, anchor, uid, minWidth, top, left, directions, offset, maxHeight, }) => {
40
40
  const anchorName = anchor.style.getPropertyValue('anchor-name') || `--anchor-${uid}`;
41
41
  if (!anchor.style.getPropertyValue('anchor-name')) {
42
42
  anchor.style.setProperty('anchor-name', anchorName);
@@ -52,6 +52,20 @@ export const setCSSAnchorPositioning = ({ popup, anchor, uid, minWidth, top, lef
52
52
  if (left) {
53
53
  popup.style.left = `${left}px`;
54
54
  }
55
+ // When there is just 1 direction, the `max-height: 100%` from CSS should stay applied so popup doesn't overflow the anchor RG-2754
56
+ const SHOULD_AUTO_SHRINK = directions.length <= 1;
57
+ if (!SHOULD_AUTO_SHRINK) {
58
+ const screenWithMargin = `calc(100vh - ${Dimension.MARGIN * 2}px)`;
59
+ if (maxHeight === 'screen' || maxHeight === MaxHeight.SCREEN) {
60
+ popup.style.maxHeight = screenWithMargin;
61
+ }
62
+ else if (typeof maxHeight === 'number' && maxHeight > 0) {
63
+ popup.style.maxHeight = `min(${screenWithMargin}, ${maxHeight}px)`;
64
+ }
65
+ }
66
+ else {
67
+ popup.style.maxHeight = '';
68
+ }
55
69
  const [initialPositionStyle, initialPositionName] = getPositionArea(directions[0]);
56
70
  popup.style.setProperty('position-area', initialPositionStyle);
57
71
  if (offset) {
@@ -13,7 +13,7 @@ export interface QueryAssistSuggestion {
13
13
  completionStart?: number;
14
14
  completionEnd?: number;
15
15
  }
16
- export interface SuggestionItem {
16
+ export interface SuggestionItem extends ListDataItem {
17
17
  data?: QueryAssistSuggestion;
18
18
  }
19
19
  export default class QueryAssistSuggestions {
@@ -1,7 +1,7 @@
1
1
  import { Component, type ComponentRef, type ReactNode, type SyntheticEvent } from 'react';
2
2
  import * as React from 'react';
3
3
  import Caret, { type Position } from '../caret/caret';
4
- import PopupMenu from '../popup-menu/popup-menu';
4
+ import PopupMenu, { type PopupMenuAttrs } from '../popup-menu/popup-menu';
5
5
  import Button from '../button/button';
6
6
  import Icon from '../icon/icon';
7
7
  import { Size } from '../input/input';
@@ -134,6 +134,7 @@ export interface QueryAssistProps {
134
134
  'data-test'?: string | null | undefined;
135
135
  huge?: boolean | null | undefined;
136
136
  size: Size;
137
+ menuProps?: PopupMenuAttrs | null | undefined;
137
138
  }
138
139
  export interface StyleRange {
139
140
  style: string;
@@ -5,7 +5,8 @@ import debounce from 'just-debounce-it';
5
5
  import classNames from 'classnames';
6
6
  import { dequal } from 'dequal';
7
7
  import searchIcon from '@jetbrains/icons/search';
8
- import closeIcon from '@jetbrains/icons/close-12px';
8
+ import closeIcon from '@jetbrains/icons/close';
9
+ import close12pxIcon from '@jetbrains/icons/close-12px';
9
10
  import getUID from '../global/get-uid';
10
11
  import dataTests from '../global/data-tests';
11
12
  import { getRect, preventDefault } from '../global/dom';
@@ -679,7 +680,7 @@ export default class QueryAssist extends Component {
679
680
  const renderClear = this.props.clear && !!this.state.query;
680
681
  if (renderClear) {
681
682
  actions.push(<I18nContext.Consumer key={'clearAction'}>
682
- {({ translate }) => (<Button icon={closeIcon} className={classNames(styles.clear, this.props.clearIconClassName)} title={this.props.translations?.clearTitle ?? translate('clearTitle')} ref={this.clearRef} onClick={this.clearQuery} data-test='query-assist-clear-icon'/>)}
683
+ {({ translate }) => (<Button icon={this.props.huge ? closeIcon : close12pxIcon} className={classNames(styles.clear, this.props.clearIconClassName)} title={this.props.translations?.clearTitle ?? translate('clearTitle')} ref={this.clearRef} onClick={this.clearQuery} data-test='query-assist-clear-icon'/>)}
683
684
  </I18nContext.Consumer>);
684
685
  }
685
686
  return actions;
@@ -735,7 +736,7 @@ export default class QueryAssist extends Component {
735
736
  {actions}
736
737
  </div>) : null}
737
738
 
738
- <PopupMenu hidden={!this.state.showPopup} onCloseAttempt={this.closePopup} ref={this.popupRef} anchorElement={this.node} keepMounted attached className={this.props.popupClassName} directions={[PopupMenu.PopupProps.Directions.BOTTOM_RIGHT]} data={useCustomItemRender ? this.state.suggestions : this.renderSuggestions()} data-test='ring-query-assist-popup' hint={this.props.hint} shortcutsMap={this.listShortcutsMap} hintOnSelection={this.props.hintOnSelection} left={this.getPopupOffset(this.state.suggestions)} maxHeight={PopupMenu.PopupProps.MaxHeight.SCREEN} onMouseDown={this.trackPopupMouseState} onMouseUp={this.trackPopupMouseState} onSelect={item => this.handleComplete(item)}/>
739
+ <PopupMenu hidden={!this.state.showPopup} onCloseAttempt={this.closePopup} ref={this.popupRef} anchorElement={this.node} keepMounted attached className={this.props.popupClassName} directions={[PopupMenu.PopupProps.Directions.BOTTOM_RIGHT, PopupMenu.PopupProps.Directions.BOTTOM_LEFT]} data={useCustomItemRender ? this.state.suggestions : this.renderSuggestions()} data-test='ring-query-assist-popup' hint={this.props.hint} shortcutsMap={this.listShortcutsMap} hintOnSelection={this.props.hintOnSelection} left={this.getPopupOffset(this.state.suggestions)} maxHeight={PopupMenu.PopupProps.MaxHeight.SCREEN} onMouseDown={this.trackPopupMouseState} onMouseUp={this.trackPopupMouseState} onSelect={item => this.handleComplete(item)} {...this.props.menuProps}/>
739
740
 
740
741
  {glass && huge && (<div className={styles.rightSearchButton} data-test='query-assist-search-button'>
741
742
  <Icon glyph={searchIcon} className={classNames(styles.rightSearchIcon, this.props.searchButtonClassName)} title={translations?.searchTitle ?? translate('searchTitle')} onClick={this.handleApply} ref={this.glassRef} data-test='query-assist-search-icon'/>
@@ -39,7 +39,10 @@
39
39
 
40
40
  position: relative;
41
41
 
42
- display: inline-block;
42
+ /* Use inline-flex (not inline-block) to avoid Safari tab title alignment/layout bugs */
43
+
44
+ display: inline-flex;
45
+ align-items: center;
43
46
 
44
47
  padding: 0;
45
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "7.0.86",
3
+ "version": "7.0.88",
4
4
  "description": "JetBrains UI library",
5
5
  "author": {
6
6
  "name": "JetBrains"
@@ -93,7 +93,7 @@
93
93
  "@babel/eslint-parser": "^7.28.5",
94
94
  "@csstools/css-parser-algorithms": "^3.0.4",
95
95
  "@csstools/stylelint-no-at-nest-rule": "^4.0.0",
96
- "@eslint/compat": "^2.0.0",
96
+ "@eslint/compat": "^2.0.1",
97
97
  "@eslint/eslintrc": "^3.3.3",
98
98
  "@eslint/js": "^9.39.2",
99
99
  "@figma/code-connect": "^1.3.12",
@@ -118,14 +118,14 @@
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.7",
121
+ "@types/react": "^19.2.8",
122
122
  "@types/react-dom": "^19.2.3",
123
123
  "@types/webpack-env": "^1.18.8",
124
124
  "@vitejs/plugin-react": "^5.1.2",
125
- "@vitest/eslint-plugin": "^1.6.5",
125
+ "@vitest/eslint-plugin": "^1.6.6",
126
126
  "acorn": "^8.15.0",
127
127
  "babel-plugin-require-context-hook": "^1.0.0",
128
- "caniuse-lite": "^1.0.30001762",
128
+ "caniuse-lite": "^1.0.30001763",
129
129
  "chai-as-promised": "^8.0.2",
130
130
  "chai-dom": "^1.12.1",
131
131
  "cheerio": "^1.1.2",
@@ -164,7 +164,7 @@
164
164
  "react-dom": "^19.2.3",
165
165
  "regenerator-runtime": "^0.14.1",
166
166
  "rimraf": "^6.1.2",
167
- "rollup": "^4.54.0",
167
+ "rollup": "^4.55.1",
168
168
  "rollup-plugin-clear": "^2.0.7",
169
169
  "storage-mock": "^2.1.0",
170
170
  "storybook": "10.1.11",
@@ -174,7 +174,7 @@
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.51.0",
177
+ "typescript-eslint": "^8.52.0",
178
178
  "vitest": "^4.0.16",
179
179
  "vitest-teamcity-reporter": "^0.4.1",
180
180
  "webpack": "^5.104.1",
@@ -223,7 +223,7 @@
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.7.1",
226
+ "focus-trap": "^7.8.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": "^10.6.0",
236
+ "postcss-preset-env": "^10.6.1",
237
237
  "react-compiler-runtime": "^1.0.0",
238
238
  "react-movable": "^3.4.1",
239
239
  "react-virtualized": "^9.22.6",