@jetbrains/ring-ui 7.0.34 → 7.0.36

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.
@@ -23,6 +23,9 @@ export interface ButtonBaseProps {
23
23
  dropdown?: boolean | null | undefined;
24
24
  disabled?: boolean | undefined;
25
25
  icon?: string | IconType | null | undefined;
26
+ /**
27
+ * @deprecated Use icons with appropriate intrinsic sizes instead
28
+ */
26
29
  iconSize?: IconProps['size'];
27
30
  iconClassName?: string | null | undefined;
28
31
  iconSuppressSizeWarning?: boolean | null | undefined;
@@ -42,6 +45,9 @@ export type ButtonProps = ButtonButtonProps | ButtonLinkProps;
42
45
  * A component for displaying variously styled buttons.
43
46
  */
44
47
  export declare class Button extends PureComponent<ButtonProps> {
48
+ /**
49
+ * @deprecated Use icons with appropriate intrinsic sizes instead
50
+ */
45
51
  static IconSize: typeof Size;
46
52
  static contextType: React.Context<ControlsHeight>;
47
53
  context: React.ContextType<typeof ControlsHeightContext>;
@@ -17,6 +17,9 @@ const warnText = deprecate(() => { }, 'Button: "text" prop is deprecated and wil
17
17
  * A component for displaying variously styled buttons.
18
18
  */
19
19
  export class Button extends PureComponent {
20
+ /**
21
+ * @deprecated Use icons with appropriate intrinsic sizes instead
22
+ */
20
23
  static IconSize = Size;
21
24
  static contextType = ControlsHeightContext;
22
25
  buttonRef = createRef();
@@ -29,13 +29,6 @@
29
29
  color: var(--ring-code-meta-color);
30
30
  }
31
31
 
32
- & :global(.hljs-tag) {
33
- background: var(--ring-code-tag-background-color);
34
- box-shadow:
35
- 0 1px var(--ring-code-tag-background-color),
36
- 0 -1px var(--ring-code-tag-background-color);
37
- }
38
-
39
32
  & :global(.hljs-section),
40
33
  & :global(.hljs-literal),
41
34
  & :global(.hljs-keyword),
@@ -124,7 +124,7 @@ export default class Dialog extends PureComponent {
124
124
  [styles.closeIconInside]: closeButtonInside,
125
125
  }), onClick: this.onCloseClick, title: closeButtonTitle, "aria-label": closeButtonTitle || 'close dialog' }))] }) })] }));
126
126
  if (native) {
127
- return (_jsx("dialog", { className: classNames(styles.nativeDialog, className), ref: this.nativeDialog, children: _jsx(PopupTarget, { id: this.uid, className: styles.popupTarget, children: target => (_jsxs(_Fragment, { children: [content, target] })) }) }));
127
+ return (_jsx("dialog", { className: classNames(styles.nativeDialog, className), ref: this.nativeDialog, "data-rg-modal-dialog-container": modal ? '' : undefined, children: _jsx(PopupTarget, { id: this.uid, className: styles.popupTarget, children: target => (_jsxs(_Fragment, { children: [content, target] })) }) }));
128
128
  }
129
129
  return (show && (_jsx(PopupTargetContext.Consumer, { children: contextTarget => {
130
130
  let targetElement = document.body;
@@ -137,7 +137,7 @@ export default class Dialog extends PureComponent {
137
137
  targetElement = container;
138
138
  }
139
139
  }
140
- return createPortal(_jsx(PopupTarget, { id: this.uid, className: styles.popupTarget, children: target => (_jsxs(TabTrap, { trapDisabled: !trapFocus, "data-test": dataTests('ring-dialog-container', dataTest), ref: this.dialogRef, className: classes, role: "presentation", ...restProps, children: [content, target] })) }), targetElement);
140
+ return createPortal(_jsx(PopupTarget, { id: this.uid, className: styles.popupTarget, children: target => (_jsxs(TabTrap, { trapDisabled: !trapFocus, "data-test": dataTests('ring-dialog-container', dataTest), "data-rg-modal-dialog-container": "", ref: this.dialogRef, className: classes, role: "presentation", ...restProps, children: [content, target] })) }), targetElement);
141
141
  } })));
142
142
  }
143
143
  }
@@ -14,7 +14,9 @@ const prevent = (key) => {
14
14
  getComputedStyle(document.documentElement).overflowY === 'scroll';
15
15
  document.documentElement.classList.add(styles.documentWithoutScroll);
16
16
  const scrollWidth = scrollbarWidth();
17
- if (documentHasScroll && scrollWidth != null && scrollWidth > 0) {
17
+ const { scrollbarGutter } = getComputedStyle(document.documentElement);
18
+ const documentHasScrollbarGutter = scrollbarGutter === 'stable' || scrollbarGutter === 'both-edges';
19
+ if (documentHasScroll && scrollWidth != null && scrollWidth > 0 && !documentHasScrollbarGutter) {
18
20
  previousDocumentWidth = document.documentElement.style.width;
19
21
  document.documentElement.style.width = `calc(100% - ${scrollWidth}px)`;
20
22
  }
@@ -154,10 +154,9 @@
154
154
  --ring-code-background-color: var(--ring-content-background-color);
155
155
  --ring-code-components: 0, 0, 0;
156
156
  --ring-code-color: rgb(var(--ring-code-components)); /* #000000 */
157
- --ring-code-comment-components: 140, 140, 140;
158
- --ring-code-comment-color: rgb(var(--ring-code-comment-components)); /* #8C8C8C */
159
- --ring-code-meta-components: 158, 136, 13;
160
- --ring-code-meta-color: rgb(var(--ring-code-meta-components)); /* #9E880D */
157
+ --ring-code-comment-color: var(--ring-secondary-color);
158
+ --ring-code-meta-components: 145, 76, 7;
159
+ --ring-code-meta-color: rgb(var(--ring-code-meta-components)); /* #914C07 */
161
160
  --ring-code-keyword-components: 0, 51, 179;
162
161
  --ring-code-keyword-color: rgb(var(--ring-code-keyword-components)); /* #0033B3 */
163
162
  --ring-code-tag-background-components: 235, 236, 240;
@@ -141,10 +141,9 @@
141
141
  --ring-code-background-color: rgb(var(--ring-code-background-components)); /* #1E1F22 */
142
142
  --ring-code-components: 189, 192, 201;
143
143
  --ring-code-color: rgb(var(--ring-code-components)); /* #BDC0C9 */
144
- --ring-code-comment-components: 110, 121, 138;
145
- --ring-code-comment-color: rgb(var(--ring-code-comment-components)); /* #6E798A */
146
- --ring-code-meta-components: 184, 177, 103;
147
- --ring-code-meta-color: rgb(var(--ring-code-meta-components)); /* #B8B167 */
144
+ --ring-code-comment-color: var(--ring-secondary-color);
145
+ --ring-code-meta-components: 86, 168, 245;
146
+ --ring-code-meta-color: rgb(var(--ring-code-meta-components)); /* #56A8F5 */
148
147
  --ring-code-keyword-components: 214, 154, 107;
149
148
  --ring-code-keyword-color: rgb(var(--ring-code-keyword-components)); /* #D69A6B */
150
149
  --ring-code-tag-background-components: 67, 69, 74;
@@ -7,8 +7,17 @@ export type IconType = ComponentType<SVGAttributes<SVGSVGElement>>;
7
7
  export interface IconProps extends HTMLAttributes<HTMLElement> {
8
8
  color: Color;
9
9
  glyph: string | IconType | null;
10
+ /**
11
+ * @deprecated Use icons with appropriate intrinsic sizes instead
12
+ */
10
13
  height?: number | undefined;
14
+ /**
15
+ * @deprecated Use icons with appropriate intrinsic sizes instead
16
+ */
11
17
  size?: Size | number | null | undefined;
18
+ /**
19
+ * @deprecated Use icons with appropriate intrinsic sizes instead
20
+ */
12
21
  width?: number | undefined;
13
22
  loading?: boolean | null | undefined;
14
23
  suppressSizeWarning?: boolean | null | undefined;
@@ -20,6 +29,9 @@ export default class Icon extends PureComponent<IconProps> {
20
29
  glyph: string;
21
30
  };
22
31
  static Color: typeof Color;
32
+ /**
33
+ * @deprecated Use icons with appropriate intrinsic sizes instead
34
+ */
23
35
  static Size: typeof Size;
24
36
  warnSize(): void;
25
37
  getStyle(): {
@@ -18,6 +18,9 @@ export default class Icon extends PureComponent {
18
18
  glyph: '',
19
19
  };
20
20
  static Color = Color;
21
+ /**
22
+ * @deprecated Use icons with appropriate intrinsic sizes instead
23
+ */
21
24
  static Size = Size;
22
25
  warnSize() {
23
26
  if (this.props.suppressSizeWarning) {
@@ -13,6 +13,7 @@ export declare enum Color {
13
13
  }
14
14
  /**
15
15
  * @enum {number}
16
+ * @deprecated Use icons with appropriate intrinsic sizes instead
16
17
  */
17
18
  export declare enum Size {
18
19
  Size12 = 12,
@@ -14,6 +14,7 @@ export var Color;
14
14
  })(Color || (Color = {}));
15
15
  /**
16
16
  * @enum {number}
17
+ * @deprecated Use icons with appropriate intrinsic sizes instead
17
18
  */
18
19
  export var Size;
19
20
  (function (Size) {
@@ -0,0 +1,74 @@
1
+ // url=https://www.figma.com/design/HY6d4uE1xxaQXCMG9fe6Y2/RingUI-(Internal)?node-id=7538-7763
2
+ const figma = require('figma');
3
+
4
+ const instance = figma.selectedInstance;
5
+ const size = instance.getString('Size');
6
+ const state = instance.getString('State');
7
+ const formVariant = instance.getBoolean('Form variant');
8
+ const icon = instance.getBoolean('Icon');
9
+ const clearable = instance.getBoolean('Clearable');
10
+ const hasLabel = instance.getBoolean('Label');
11
+ const label = instance.findText('Label').textContent;
12
+ const hasHelpText = instance.getBoolean('Help text');
13
+ const helpText = instance.findText('Help text').textContent;
14
+ const hasText = instance.getBoolean('Text');
15
+ const text = instance.findText('Text').textContent;
16
+ const hasPlaceholder = instance.getBoolean('Placeholder');
17
+ const placeholder = instance.findText('Placeholder').textContent;
18
+
19
+ const imports = ["import Input from '@jetbrains/ring-ui/components/input/input'"];
20
+ const props = [];
21
+ const DEFAULT_SIZE = 'M';
22
+ const isDefaultSize = size === DEFAULT_SIZE;
23
+
24
+ if (!isDefaultSize) {
25
+ imports.push("import {ControlsHeight} from '@jetbrains/ring-ui/components/global/controls-height'");
26
+ props.push(`height={ControlsHeight.${size}}`);
27
+ }
28
+
29
+ switch (state) {
30
+ case 'disabled':
31
+ props.push('disabled');
32
+ break;
33
+ case 'error':
34
+ props.push('error=""');
35
+ break;
36
+ default:
37
+ }
38
+
39
+ if (formVariant) {
40
+ imports.push("import {LabelType} from '../control-label/control-label'");
41
+ props.push('labelType={LabelType.FORM}');
42
+ }
43
+
44
+ if (icon) {
45
+ imports.push("import searchIcon from '@jetbrains/icons/search'");
46
+ props.push('icon={searchIcon}');
47
+ }
48
+
49
+ if (clearable) {
50
+ props.push('onClear={() => {}}');
51
+ }
52
+
53
+ if (hasLabel) {
54
+ props.push(`label="${label}"`);
55
+ }
56
+
57
+ if (hasHelpText) {
58
+ props.push(`help="${helpText}"`);
59
+ }
60
+
61
+ if (hasText) {
62
+ props.push(`defaultValue="${text}"`);
63
+ }
64
+
65
+ if (hasPlaceholder) {
66
+ props.push(`placeholder="${placeholder}"`);
67
+ }
68
+
69
+ export default {
70
+ id: 'input',
71
+ example: figma.code`${imports.join('\n')}
72
+
73
+ <Input ${props.map(prop => `${prop} `).join('')}/>`,
74
+ };
@@ -10,7 +10,7 @@ export declare enum Type {
10
10
  SEPARATOR = 0,
11
11
  LINK = 1,
12
12
  ITEM = 2,
13
- HINT = 3,
13
+ HINT = 3,// doesn't work, TODO remove in 8.0
14
14
  CUSTOM = 4,
15
15
  TITLE = 5,
16
16
  MARGIN = 6
@@ -42,6 +42,9 @@ export type ListDataItem<T = unknown> = T & Partial<Omit<LinkProps, 'onClick' |
42
42
  subavatar?: string | null | undefined;
43
43
  glyph?: IconType | string | null | undefined;
44
44
  icon?: string | undefined;
45
+ /**
46
+ * @deprecated Use icons with appropriate intrinsic sizes instead
47
+ */
45
48
  iconSize?: Size | null | undefined;
46
49
  suppressSizeWarning?: boolean | null | undefined;
47
50
  rightGlyph?: IconType | string | null | undefined;
@@ -115,16 +115,21 @@ export default class List extends Component {
115
115
  }
116
116
  }
117
117
  shouldComponentUpdate(nextProps, nextState) {
118
- return (nextProps !== this.props ||
118
+ return (Object.keys(nextProps).some(key => !Object.is(nextProps[key], this.props[key])) ||
119
119
  Object.keys(nextState).some(key => nextState[key] !== this.state[key]));
120
120
  }
121
121
  componentDidUpdate(prevProps) {
122
122
  if (this.virtualizedList && prevProps.data !== this.props.data) {
123
123
  this.virtualizedList.recomputeRowHeights();
124
124
  }
125
+ const { activeIndex } = this.state;
126
+ const isActiveItemRetainedPosition = activeIndex
127
+ ? prevProps.data[activeIndex]?.key === this.props.data[activeIndex]?.key
128
+ : false;
125
129
  if (this.props.activeIndex == null &&
126
130
  getDataHash(this.props.data) !== getDataHash(prevProps.data) &&
127
- shouldActivateFirstItem(this.props)) {
131
+ shouldActivateFirstItem(this.props) &&
132
+ !isActiveItemRetainedPosition) {
128
133
  this.activateFirst();
129
134
  }
130
135
  this.checkOverflow();
@@ -18,6 +18,6 @@ export default class ListCustom extends PureComponent {
18
18
  }, this.props['data-test']);
19
19
  const content = typeof template === 'function' ? template(this.props) : template;
20
20
  const TagName = tagName || 'span';
21
- return (_jsx(TagName, { role: role || 'button', tabIndex: tabIndex, onClick: onClick, onKeyPress: this.handleKeyPress, onMouseOver: onMouseOver, onFocus: onMouseOver, onMouseUp: onMouseUp, className: classes, "data-test": dataTest, children: content }));
21
+ return (_jsx(TagName, { role: role || 'button', "aria-disabled": disabled, tabIndex: tabIndex, onClick: onClick, onKeyPress: this.handleKeyPress, onMouseOver: onMouseOver, onFocus: onMouseOver, onMouseUp: onMouseUp, className: classes, "data-test": dataTest, children: content }));
22
22
  }
23
23
  }
@@ -83,7 +83,7 @@
83
83
  }
84
84
 
85
85
  .input {
86
- overflow: hidden;
86
+ overflow: auto;
87
87
 
88
88
  flex-grow: 1;
89
89
 
@@ -55,7 +55,12 @@ export default class UserAgreementService {
55
55
  userConsent = DEFAULT_CONSENT;
56
56
  intervalId;
57
57
  startChecking = () => {
58
- this.intervalId = window.setInterval(this.checkConsentAndShowDialog, this.interval);
58
+ this.intervalId = window.setInterval(() => this.checkConsentAndShowDialog().catch(reason => {
59
+ if (reason === 'Postponed') {
60
+ return;
61
+ }
62
+ throw reason;
63
+ }), this.interval);
59
64
  window.addEventListener('storage', this.onStorageEvent);
60
65
  this.checkConsentAndShowDialog();
61
66
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "7.0.34",
3
+ "version": "7.0.36",
4
4
  "description": "JetBrains UI library",
5
5
  "author": {
6
6
  "name": "JetBrains"
@@ -85,8 +85,8 @@
85
85
  },
86
86
  "readmeFilename": "README.md",
87
87
  "devDependencies": {
88
- "@babel/cli": "^7.26.4",
89
- "@babel/eslint-parser": "^7.26.8",
88
+ "@babel/cli": "^7.27.0",
89
+ "@babel/eslint-parser": "^7.27.0",
90
90
  "@babel/plugin-syntax-import-assertions": "^7.26.0",
91
91
  "@csstools/css-parser-algorithms": "^3.0.4",
92
92
  "@csstools/stylelint-no-at-nest-rule": "^4.0.0",
@@ -101,28 +101,26 @@
101
101
  "@primer/octicons": "^19.15.1",
102
102
  "@rollup/plugin-babel": "^6.0.4",
103
103
  "@rollup/plugin-json": "^6.1.0",
104
- "@rollup/plugin-node-resolve": "^16.0.0",
104
+ "@rollup/plugin-node-resolve": "^16.0.1",
105
105
  "@rollup/plugin-replace": "^6.0.2",
106
- "@storybook/addon-a11y": "8.6.4",
107
- "@storybook/addon-docs": "8.6.4",
108
- "@storybook/addon-essentials": "8.6.4",
109
- "@storybook/addon-themes": "^8.6.4",
110
- "@storybook/components": "8.6.4",
106
+ "@storybook/addon-a11y": "8.6.11",
107
+ "@storybook/addon-docs": "8.6.11",
108
+ "@storybook/addon-essentials": "8.6.11",
109
+ "@storybook/addon-themes": "^8.6.11",
110
+ "@storybook/components": "8.6.11",
111
111
  "@storybook/csf": "^0.1.13",
112
- "@storybook/manager-api": "8.6.4",
113
- "@storybook/preview-api": "8.6.4",
114
- "@storybook/react": "8.6.4",
115
- "@storybook/react-webpack5": "8.6.4",
112
+ "@storybook/manager-api": "8.6.11",
113
+ "@storybook/preview-api": "8.6.11",
114
+ "@storybook/react": "8.6.11",
115
+ "@storybook/react-webpack5": "8.6.11",
116
116
  "@storybook/test-runner": "^0.22.0",
117
- "@storybook/theming": "8.6.4",
117
+ "@storybook/theming": "8.6.11",
118
118
  "@testing-library/dom": "^10.4.0",
119
119
  "@testing-library/react": "^16.2.0",
120
120
  "@testing-library/user-event": "^14.6.1",
121
- "@types/chai": "^5.2.0",
121
+ "@types/chai": "^5.2.1",
122
122
  "@types/chai-as-promised": "^8.0.2",
123
123
  "@types/chai-dom": "0.0.10",
124
- "@types/chai-enzyme": "^0.6.13",
125
- "@types/enzyme": "^3.10.18",
126
124
  "@types/eslint__js": "^8.42.3",
127
125
  "@types/markdown-it": "^14.1.2",
128
126
  "@types/react": "^18.3.12",
@@ -131,32 +129,29 @@
131
129
  "@types/sinon-chai": "^4.0.0",
132
130
  "@types/webpack-env": "^1.18.8",
133
131
  "@vitejs/plugin-react": "^4.3.4",
134
- "@vitest/eslint-plugin": "^1.1.36",
135
- "@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
132
+ "@vitest/eslint-plugin": "^1.1.38",
136
133
  "acorn": "^8.14.1",
137
134
  "axe-playwright": "^2.1.0",
138
135
  "babel-plugin-require-context-hook": "^1.0.0",
139
- "caniuse-lite": "^1.0.30001702",
136
+ "caniuse-lite": "^1.0.30001707",
140
137
  "chai": "^5.2.0",
141
138
  "chai-as-promised": "^8.0.1",
142
139
  "chai-dom": "^1.10.0",
143
- "chai-enzyme": "1.0.0-beta.1",
144
140
  "cheerio": "^1.0.0-rc.12",
145
141
  "chromatic": "^11.27.0",
146
142
  "core-js": "^3.41.0",
147
143
  "cpy-cli": "^5.0.0",
148
144
  "dotenv-cli": "^8.0.0",
149
- "enzyme": "^3.11.0",
150
- "eslint": "^9.21.0",
145
+ "eslint": "^9.23.0",
151
146
  "eslint-config-prettier": "^10.1.1",
152
147
  "eslint-formatter-jslint-xml": "^8.40.0",
153
148
  "eslint-import-resolver-webpack": "^0.13.10",
154
149
  "eslint-plugin-import": "^2.31.0",
155
150
  "eslint-plugin-jsx-a11y": "^6.10.2",
156
- "eslint-plugin-prettier": "^5.2.3",
151
+ "eslint-plugin-prettier": "^5.2.5",
157
152
  "eslint-plugin-react": "^7.37.4",
158
153
  "eslint-plugin-react-hooks": "^5.2.0",
159
- "eslint-plugin-storybook": "^0.11.4",
154
+ "eslint-plugin-storybook": "^0.12.0",
160
155
  "events": "^3.3.0",
161
156
  "glob": "^11.0.1",
162
157
  "globals": "^16.0.0",
@@ -167,7 +162,7 @@
167
162
  "jest": "~29.7.0",
168
163
  "jest-environment-jsdom": "^29.7.0",
169
164
  "jest-teamcity": "^1.12.0",
170
- "lint-staged": "^15.4.3",
165
+ "lint-staged": "^15.5.0",
171
166
  "markdown-it": "^14.1.0",
172
167
  "merge-options": "^3.0.4",
173
168
  "pinst": "^3.0.0",
@@ -175,22 +170,22 @@
175
170
  "raw-loader": "^4.0.2",
176
171
  "react": "^18.3.1",
177
172
  "react-dom": "^18.3.1",
178
- "react-test-renderer": "^19.0.0",
173
+ "react-test-renderer": "^19.1.0",
179
174
  "regenerator-runtime": "^0.14.1",
180
175
  "rimraf": "^6.0.1",
181
- "rollup": "^4.34.9",
176
+ "rollup": "^4.38.0",
182
177
  "rollup-plugin-clear": "^2.0.7",
183
- "sinon": "^19.0.2",
178
+ "sinon": "^20.0.0",
184
179
  "sinon-chai": "^4.0.0",
185
180
  "storage-mock": "^2.1.0",
186
- "storybook": "8.6.4",
187
- "stylelint": "^16.15.0",
181
+ "storybook": "8.6.11",
182
+ "stylelint": "^16.17.0",
188
183
  "svg-inline-loader": "^0.8.2",
189
184
  "teamcity-service-messages": "^0.1.14",
190
185
  "terser-webpack-plugin": "^5.3.14",
191
186
  "typescript": "~5.8.2",
192
- "typescript-eslint": "^8.26.0",
193
- "vitest": "^3.0.8",
187
+ "typescript-eslint": "^8.29.0",
188
+ "vitest": "^3.1.1",
194
189
  "vitest-teamcity-reporter": "^0.3.1",
195
190
  "wallaby-webpack": "^3.9.16",
196
191
  "webpack": "^5.98.0",
@@ -217,10 +212,10 @@
217
212
  }
218
213
  },
219
214
  "dependencies": {
220
- "@babel/core": "^7.26.9",
221
- "@babel/preset-typescript": "^7.26.0",
215
+ "@babel/core": "^7.26.10",
216
+ "@babel/preset-typescript": "^7.27.0",
222
217
  "@jetbrains/babel-preset-jetbrains": "^2.4.0",
223
- "@jetbrains/icons": "^5.7.0",
218
+ "@jetbrains/icons": "^5.8.0",
224
219
  "@jetbrains/postcss-require-hover": "^0.1.3",
225
220
  "@types/combokeys": "^2.4.9",
226
221
  "@types/element-resize-detector": "^1.1.6",