@jetbrains/ring-ui 7.0.81 → 7.0.83

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.
@@ -9,7 +9,7 @@ import dataTests from '../global/data-tests';
9
9
  import Shortcuts from '../shortcuts/shortcuts';
10
10
  import TabTrap from '../tab-trap/tab-trap';
11
11
  import Button from '../button/button';
12
- import { PopupTarget, PopupTargetContext } from '../popup/popup.target';
12
+ import { normalizePopupTarget, PopupTarget, PopupTargetContext } from '../popup/popup.target';
13
13
  import { getPopupContainer } from '../popup/popup';
14
14
  import { preventerFactory as scrollPreventerFactory } from './dialog-body-scroll-preventer';
15
15
  import styles from './dialog.css';
@@ -144,12 +144,13 @@ export default class Dialog extends PureComponent {
144
144
  }
145
145
  return (show && (<PopupTargetContext.Consumer>
146
146
  {contextTarget => {
147
+ const normalizedContextTarget = normalizePopupTarget(contextTarget);
147
148
  let targetElement = document.body;
148
149
  if (portalTarget instanceof HTMLElement) {
149
150
  targetElement = portalTarget;
150
151
  }
151
- else if (contextTarget !== undefined) {
152
- const container = getPopupContainer(contextTarget);
152
+ else if (normalizedContextTarget !== undefined) {
153
+ const container = getPopupContainer(normalizedContextTarget);
153
154
  if (container) {
154
155
  targetElement = container;
155
156
  }
@@ -94,6 +94,7 @@ export default class Popup<P extends BasePopupProps = PopupProps> extends PureCo
94
94
  parent?: HTMLElement | null;
95
95
  container?: HTMLElement | null;
96
96
  ringPopupTarget?: string | Element;
97
+ private cssPositioningFromContext;
97
98
  clickStartedInsidePopup: boolean;
98
99
  shouldUseShortcuts(): boolean;
99
100
  listeners: Listeners;
@@ -15,7 +15,7 @@ import TabTrap from '../tab-trap/tab-trap';
15
15
  import { getConfiguration } from '../global/configuration';
16
16
  import position from './position';
17
17
  import { DEFAULT_DIRECTIONS, Dimension, Directions, Display, MaxHeight, MinWidth } from './popup.consts';
18
- import { PopupTargetContext, PopupTarget } from './popup.target';
18
+ import { PopupTargetContext, PopupTarget, normalizePopupTarget } from './popup.target';
19
19
  import { setCSSAnchorPositioning, supportsCSSAnchorPositioning } from './position-css';
20
20
  import { ThemeContext, WithThemeClasses } from '../global/theme';
21
21
  import styles from './popup.css';
@@ -79,6 +79,7 @@ export default class Popup extends PureComponent {
79
79
  parent;
80
80
  container;
81
81
  ringPopupTarget;
82
+ cssPositioningFromContext;
82
83
  clickStartedInsidePopup = false;
83
84
  shouldUseShortcuts() {
84
85
  const { shortcuts, hidden } = this.props;
@@ -145,9 +146,7 @@ export default class Popup extends PureComponent {
145
146
  if (!supportsCSSAnchorPositioning()) {
146
147
  return false;
147
148
  }
148
- return this.props.cssPositioning !== undefined
149
- ? this.props.cssPositioning
150
- : getConfiguration().popupsCssPositioning;
149
+ return this.props.cssPositioning ?? this.cssPositioningFromContext ?? getConfiguration().popupsCssPositioning;
151
150
  }
152
151
  _updatePosition = () => {
153
152
  const popup = this.popup;
@@ -285,7 +284,10 @@ export default class Popup extends PureComponent {
285
284
  {theme => (<WithThemeClasses theme={theme.theme}>
286
285
  {themeClasses => (<PopupTargetContext.Consumer>
287
286
  {value => {
288
- this.ringPopupTarget = value;
287
+ this.ringPopupTarget = normalizePopupTarget(value);
288
+ if (!(typeof value === 'string' || value instanceof Element)) {
289
+ this.cssPositioningFromContext = value?.cssPositioning;
290
+ }
289
291
  const classes = classNames(className, theme.passToPopups ? themeClasses : null, styles.popup, {
290
292
  [styles.cssAnchoredPopup]: this.shouldUseCssPositioning(),
291
293
  [styles.attached]: attached,
@@ -1,7 +1,13 @@
1
1
  import { type HTMLAttributes, type ReactNode } from 'react';
2
- export declare const PopupTargetContext: import("react").Context<string | Element | undefined>;
2
+ interface ComplexConfig {
3
+ target: string | Element | undefined;
4
+ cssPositioning?: boolean;
5
+ }
6
+ export declare const PopupTargetContext: import("react").Context<string | Element | ComplexConfig | undefined>;
3
7
  export interface PopupTargetProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
4
8
  id: string;
5
9
  children: ReactNode | ((target: ReactNode) => ReactNode);
6
10
  }
11
+ export declare function normalizePopupTarget(value: string | Element | undefined | ComplexConfig): string | Element | undefined;
7
12
  export declare const PopupTarget: import("react").ForwardRefExoticComponent<PopupTargetProps & import("react").RefAttributes<HTMLDivElement>>;
13
+ export {};
@@ -1,5 +1,8 @@
1
1
  import { createContext, forwardRef } from 'react';
2
2
  export const PopupTargetContext = createContext(undefined);
3
+ export function normalizePopupTarget(value) {
4
+ return typeof value === 'string' || value instanceof Element ? value : value?.target;
5
+ }
3
6
  export const PopupTarget = forwardRef(function PopupTarget({ id, children, ...restProps }, ref) {
4
7
  const target = (<div {...restProps} data-portaltarget={id} ref={ref}>
5
8
  {typeof children !== 'function' && children}
@@ -10,7 +10,7 @@ import memoizeOne from 'memoize-one';
10
10
  import Icon from '../icon/icon';
11
11
  import Popup, { getPopupContainer } from '../popup/popup';
12
12
  import { maxHeightForDirection } from '../popup/position';
13
- import { PopupTargetContext } from '../popup/popup.target';
13
+ import { normalizePopupTarget, PopupTargetContext } from '../popup/popup.target';
14
14
  import List from '../list/list';
15
15
  import LoaderInline from '../loader-inline/loader-inline';
16
16
  import shortcutsHOC from '../shortcuts/shortcuts-hoc';
@@ -329,7 +329,7 @@ export default class SelectPopup extends PureComponent {
329
329
  {ringPopupTarget => {
330
330
  const filterWithTags = this.getFilterWithTags();
331
331
  const selectAll = multiple && typeof multiple === 'object' && !multiple.limit && multiple.selectAll && this.getSelectAll();
332
- const list = this.getList(this.props.ringPopupTarget || ringPopupTarget);
332
+ const list = this.getList(this.props.ringPopupTarget || normalizePopupTarget(ringPopupTarget));
333
333
  const bottomLine = this.getBottomLine();
334
334
  const hasContent = filterWithTags || selectAll || list || bottomLine || toolbar || topbar;
335
335
  return (<Popup trapFocus={false} ref={this.popupRef} hidden={hidden || !hasContent} attached={isInputMode} className={classes} dontCloseOnAnchorClick anchorElement={anchorElement} minWidth={minWidth} onCloseAttempt={onCloseAttempt} onOutsideClick={onOutsideClick} directions={directions} top={top} left={left} offset={offset} onMouseDown={this.mouseDownHandler} target={this.props.ringPopupTarget} autoCorrectTopOverflow={false} style={style} largeBorderRadius>
@@ -55,6 +55,7 @@ export default class Tooltip extends Component {
55
55
  return;
56
56
  }
57
57
  if (delay) {
58
+ clearTimeout(this.timeout);
58
59
  this.timeout = window.setTimeout(this.showPopup, delay);
59
60
  }
60
61
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "7.0.81",
3
+ "version": "7.0.83",
4
4
  "description": "JetBrains UI library",
5
5
  "author": {
6
6
  "name": "JetBrains"
@@ -101,16 +101,16 @@
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.0",
104
+ "@primer/octicons": "^19.21.1",
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.2",
110
- "@storybook/addon-docs": "^10.1.2",
111
- "@storybook/addon-themes": "^10.1.2",
109
+ "@storybook/addon-a11y": "10.1.4",
110
+ "@storybook/addon-docs": "^10.1.4",
111
+ "@storybook/addon-themes": "^10.1.4",
112
112
  "@storybook/csf": "^0.1.13",
113
- "@storybook/react-webpack5": "10.1.2",
113
+ "@storybook/react-webpack5": "10.1.4",
114
114
  "@storybook/test-runner": "^0.24.2",
115
115
  "@testing-library/dom": "^10.4.1",
116
116
  "@testing-library/react": "^16.3.0",
@@ -121,8 +121,8 @@
121
121
  "@types/react": "^19.2.7",
122
122
  "@types/react-dom": "^19.2.3",
123
123
  "@types/webpack-env": "^1.18.8",
124
- "@vitejs/plugin-react": "^5.1.1",
125
- "@vitest/eslint-plugin": "^1.5.1",
124
+ "@vitejs/plugin-react": "^5.1.2",
125
+ "@vitest/eslint-plugin": "^1.5.2",
126
126
  "acorn": "^8.15.0",
127
127
  "babel-plugin-require-context-hook": "^1.0.0",
128
128
  "caniuse-lite": "^1.0.30001757",
@@ -142,7 +142,7 @@
142
142
  "eslint-plugin-prettier": "^5.5.4",
143
143
  "eslint-plugin-react": "^7.37.5",
144
144
  "eslint-plugin-react-hooks": "^7.0.1",
145
- "eslint-plugin-storybook": "^10.1.2",
145
+ "eslint-plugin-storybook": "^10.1.4",
146
146
  "eslint-plugin-unicorn": "^62.0.0",
147
147
  "events": "^3.3.0",
148
148
  "glob": "^13.0.0",
@@ -158,24 +158,24 @@
158
158
  "markdown-it": "^14.1.0",
159
159
  "merge-options": "^3.0.4",
160
160
  "pinst": "^3.0.0",
161
- "prettier": "^3.7.3",
161
+ "prettier": "^3.7.4",
162
162
  "raw-loader": "^4.0.2",
163
- "react": "^19.2.0",
164
- "react-dom": "^19.2.0",
163
+ "react": "^19.2.1",
164
+ "react-dom": "^19.2.1",
165
165
  "regenerator-runtime": "^0.14.1",
166
166
  "rimraf": "^6.1.2",
167
167
  "rollup": "^4.53.3",
168
168
  "rollup-plugin-clear": "^2.0.7",
169
169
  "storage-mock": "^2.1.0",
170
- "storybook": "10.1.2",
170
+ "storybook": "10.1.4",
171
171
  "stylelint": "^16.26.1",
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
- "terser-webpack-plugin": "^5.3.14",
175
+ "terser-webpack-plugin": "^5.3.15",
176
176
  "typescript": "~5.9.3",
177
- "typescript-eslint": "^8.48.0",
178
- "vitest": "^4.0.14",
177
+ "typescript-eslint": "^8.48.1",
178
+ "vitest": "^4.0.15",
179
179
  "vitest-teamcity-reporter": "^0.4.1",
180
180
  "webpack": "^5.103.0",
181
181
  "webpack-cli": "^6.0.1"
@@ -212,7 +212,7 @@
212
212
  "babel-loader": "10.0.0",
213
213
  "babel-plugin-react-compiler": "^1.0.0",
214
214
  "babel-plugin-transform-define": "^2.1.4",
215
- "browserslist": "^4.28.0",
215
+ "browserslist": "^4.28.1",
216
216
  "change-case": "^4.1.1",
217
217
  "classnames": "^2.5.1",
218
218
  "combokeys": "^3.0.1",
@@ -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.4.0",
236
+ "postcss-preset-env": "^10.5.0",
237
237
  "react-compiler-runtime": "^1.0.0",
238
238
  "react-movable": "^3.4.1",
239
239
  "react-virtualized": "^9.22.6",