@jetbrains/ring-ui 7.0.98 → 7.0.100

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.
@@ -46,8 +46,10 @@
46
46
  --ring-button-default-background-color: transparent;
47
47
  --ring-button-background-color: var(--ring-button-default-background-color);
48
48
  --ring-button-hover-background-color: var(--ring-content-background-color);
49
- --ring-button-pressed-background-color: var(--ring-selected-background-color);
49
+ --ring-button-pressed-background-color: var(--ring-hover-background-color);
50
50
  --ring-button-active-background-color: var(--ring-main-container-light-color);
51
+ --ring-button-active-hover-background-color: var(--ring-hover-background-color);
52
+ --ring-button-active-pressed-background-color: var(--ring-selected-background-color);
51
53
  --ring-button-disabled-background-color: var(--ring-button-default-background-color);
52
54
 
53
55
  box-sizing: border-box;
@@ -89,8 +91,8 @@
89
91
  --ring-button-default-background-color: var(--ring-content-background-color);
90
92
  --ring-button-default-border-color: var(--ring-borders-color);
91
93
  --ring-button-border-color: var(--ring-button-default-border-color);
92
- --ring-button-hover-border-color: var(--ring-border-hover-color);
93
- --ring-button-pressed-border-color: var(--ring-border-hover-color);
94
+ --ring-button-hover-border-color: var(--ring-border-accent-color);
95
+ --ring-button-pressed-border-color: var(--ring-border-accent-color);
94
96
  --ring-button-active-border-color: var(--ring-main-color);
95
97
  --ring-button-disabled-border-color: var(--ring-border-disabled-color);
96
98
  --ring-button-text-color: var(--ring-text-color);
@@ -174,7 +176,7 @@
174
176
  }
175
177
 
176
178
  .active {
177
- --ring-button-disabled-background-color: var(--ring-hover-background-color);
179
+ --ring-button-disabled-background-color: var(--ring-main-container-light-color);
178
180
  --ring-button-disabled-border-color: var(--ring-border-hover-color);
179
181
 
180
182
  transition: none;
@@ -185,6 +187,14 @@
185
187
  --ring-button-border-color: var(--ring-button-active-border-color);
186
188
  }
187
189
 
190
+ .active:hover {
191
+ --ring-button-active-background-color: var(--ring-button-active-hover-background-color);
192
+ }
193
+
194
+ .active:active {
195
+ --ring-button-active-background-color: var(--ring-button-active-pressed-background-color);
196
+ }
197
+
188
198
  .disabled {
189
199
  cursor: auto;
190
200
 
@@ -196,6 +206,8 @@
196
206
  .danger {
197
207
  --ring-button-pressed-background-color: var(--ring-button-danger-active-color);
198
208
  --ring-button-active-background-color: var(--ring-button-danger-active-color);
209
+ --ring-button-active-hover-background-color: var(--ring-button-danger-active-color);
210
+ --ring-button-active-pressed-background-color: var(--ring-button-danger-active-color);
199
211
  --ring-button-focus-border-color: var(--ring-removed-background-color);
200
212
  --ring-button-hover-border-color: var(--ring-button-danger-hover-color);
201
213
  --ring-button-pressed-border-color: var(--ring-button-danger-hover-color);
@@ -224,6 +236,8 @@
224
236
  --ring-button-hover-background-color: var(--ring-main-hover-color);
225
237
  --ring-button-pressed-background-color: var(--ring-button-primary-background-color);
226
238
  --ring-button-active-background-color: var(--ring-button-primary-background-color);
239
+ --ring-button-active-hover-background-color: var(--ring-main-hover-color);
240
+ --ring-button-active-pressed-background-color: var(--ring-button-primary-background-color);
227
241
  --ring-button-disabled-background-color: var(--ring-border-hover-color);
228
242
  --ring-button-pressed-border-color: var(--ring-button-primary-border-color);
229
243
  --ring-button-active-border-color: var(--ring-button-primary-border-color);
@@ -237,6 +251,8 @@
237
251
  --ring-button-hover-background-color: var(--ring-main-success-hover-color);
238
252
  --ring-button-pressed-background-color: var(--ring-main-success-hover-color);
239
253
  --ring-button-active-background-color: var(--ring-main-success-hover-color);
254
+ --ring-button-active-hover-background-color: var(--ring-main-success-hover-color);
255
+ --ring-button-active-pressed-background-color: var(--ring-main-success-hover-color);
240
256
  --ring-button-disabled-background-color: var(--ring-added-background-color);
241
257
  --ring-button-focus-border-color: var(--ring-border-hover-success-color);
242
258
  --ring-button-pressed-border-color: var(--ring-success-color);
@@ -252,6 +268,8 @@
252
268
  --ring-button-hover-background-color: var(--ring-main-error-hover-color);
253
269
  --ring-button-pressed-background-color: var(--ring-main-error-hover-color);
254
270
  --ring-button-active-background-color: var(--ring-main-error-hover-color);
271
+ --ring-button-active-hover-background-color: var(--ring-main-error-hover-color);
272
+ --ring-button-active-pressed-background-color: var(--ring-main-error-hover-color);
255
273
  --ring-button-disabled-background-color: var(--ring-removed-background-color);
256
274
  --ring-button-focus-border-color: var(--ring-border-hover-error-color);
257
275
  --ring-button-pressed-border-color: var(--ring-error-color);
@@ -119,7 +119,7 @@
119
119
  .buttonGroup .button.button:hover:not(:disabled),
120
120
  .buttonGroup .button.button:active:not(:disabled) {
121
121
  border-radius: var(--ring-border-radius);
122
- box-shadow: var(--ring-button-shadow) var(--ring-border-hover-color);
122
+ box-shadow: var(--ring-button-shadow) var(--ring-button-border-color);
123
123
  }
124
124
 
125
125
  .buttonGroup .button.button:focus-visible {
@@ -131,13 +131,13 @@
131
131
 
132
132
  .buttonGroup .button.button.active {
133
133
  border-radius: var(--ring-border-radius);
134
- box-shadow: var(--ring-button-shadow) var(--ring-main-color);
134
+ box-shadow: var(--ring-button-shadow) var(--ring-button-border-color);
135
135
  }
136
136
 
137
137
  .buttonGroup .button:focus-visible.active {
138
138
  border-radius: var(--ring-border-radius);
139
139
  box-shadow:
140
- var(--ring-button-shadow) var(--ring-main-color),
140
+ var(--ring-button-shadow) var(--ring-button-border-color),
141
141
  0 0 0 1px var(--ring-border-hover-color);
142
142
  }
143
143
 
@@ -9,8 +9,8 @@ const defaultAriaLabel = 'Dropdown menu';
9
9
  function DropdownAnchorWrapper({ anchor, pinned, active, activeListItemId, listId, ...restProps }) {
10
10
  const anchorAriaProps = {
11
11
  ...(listId ? { 'aria-haspopup': true } : {}),
12
- ...(activeListItemId ? { 'aria-activedescendant': activeListItemId, 'aria-owns': listId } : {}),
13
- ...(active ? { 'aria-expanded': true } : {}),
12
+ ...(activeListItemId ? { 'aria-activedescendant': activeListItemId } : {}),
13
+ ...(active ? { 'aria-expanded': true, 'aria-owns': listId } : {}),
14
14
  };
15
15
  const anchorProps = { active, pinned, ...restProps, ...anchorAriaProps };
16
16
  const anchorComponentProps = { ...anchorProps, pinned: `${anchorProps.pinned}` };
@@ -39,7 +39,7 @@ const DropdownMenu = forwardRef(function DropdownMenu({ id, anchor, ariaLabel, d
39
39
  id: listId,
40
40
  ariaLabel: ariaLabel || defaultAriaLabel,
41
41
  closeOnSelect: true,
42
- activateFirstItem: true,
42
+ activateFirstItem: false,
43
43
  data,
44
44
  onSelect,
45
45
  ...menuProps,
@@ -97,7 +97,7 @@ export class Input extends PureComponent {
97
97
  // Modifiers
98
98
  size, multiline, borderless,
99
99
  // Props
100
- label, labelType, error, help, className, inputClassName, children, value, onClear, disabled, inputRef, onChange, enableShortcuts, id, placeholder, icon, translations, height = typeof this.context === 'function' ? this.context() : this.context, beforeInput, afterInput, autogrow, ...restProps } = this.props;
100
+ label, labelType, error, help, className, inputClassName, clearButtonClassName, children, value, onClear, disabled, inputRef, onChange, enableShortcuts, id, placeholder, icon, translations, height = typeof this.context === 'function' ? this.context() : this.context, beforeInput, afterInput, autogrow, ...restProps } = this.props;
101
101
  const { empty } = this.state;
102
102
  const clearable = !!onClear;
103
103
  const classes = classNames(className, styles.outerContainer, size && size !== Size.AUTO && styles[`size${size}`], styles[`height${height}`], {
@@ -129,7 +129,7 @@ export class Input extends PureComponent {
129
129
  {icon && <Icon glyph={icon} className={styles.icon}/>}
130
130
  {beforeInput}
131
131
  {multiline ? (<textarea onChange={this.handleTextareaChange} rows={1} {...commonProps} {...restProps}/>) : (<input onChange={this.handleInputChange} {...commonProps} {...restProps}/>)}
132
- {clearable && !disabled && (<Button title={translations?.clear ?? translate('clear')} data-test='ring-input-clear' className={classNames(styles.clear, this.props.clearButtonClassName)} icon={closeIcon} onClick={this.clear}/>)}
132
+ {clearable && !disabled && (<Button title={translations?.clear ?? translate('clear')} data-test='ring-input-clear' className={classNames(styles.clear, clearButtonClassName)} icon={closeIcon} onClick={this.clear}/>)}
133
133
  {afterInput}
134
134
  </div>
135
135
  {error ? (<div className={styles.errorText}>{error}</div>) : (help && <ControlHelp className={styles.helpText}>{help}</ControlHelp>)}
@@ -1,5 +1,9 @@
1
1
  import { PureComponent, type SyntheticEvent } from 'react';
2
2
  import { type ListDataItemProps } from './consts';
3
+ /**
4
+ * @constructor
5
+ * @extends {ReactComponent}
6
+ */
3
7
  export default class ListItem<T> extends PureComponent<ListDataItemProps<T>> {
4
8
  id: string;
5
9
  stopBubbling: (e: SyntheticEvent) => void;
@@ -13,9 +13,6 @@ import styles from './list.css';
13
13
  * @constructor
14
14
  * @extends {ReactComponent}
15
15
  */
16
- const RING_UNIT = 8;
17
- const DEFAULT_PADDING = 8;
18
- const CHECKBOX_WIDTH = 28;
19
16
  export default class ListItem extends PureComponent {
20
17
  id = getUID('list-item-');
21
18
  stopBubbling = (e) => e.stopPropagation();
@@ -31,10 +28,12 @@ export default class ListItem extends PureComponent {
31
28
  const classes = getListClasses(this.props);
32
29
  const detailsClasses = classNames({
33
30
  [styles.details]: details,
34
- [styles.padded]: icon !== undefined || checkbox !== undefined || glyph !== undefined,
31
+ [styles.padded]: !showCheckbox && hasLeftNodes,
35
32
  }, detailsClassName);
33
+ const levelPadding = `var(--ring-unit) * ${1 + (Number(level) || 0)}`;
34
+ const checkboxPadding = showCheckbox ? ' + var(--ring-list-item-icon-size) + var(--ring-unit)' : '';
36
35
  const style = {
37
- paddingLeft: `${(Number(level) || 0) * RING_UNIT + DEFAULT_PADDING + (showCheckbox ? CHECKBOX_WIDTH : 0)}px`,
36
+ paddingLeft: `calc(${levelPadding}${checkboxPadding})`,
38
37
  };
39
38
  let computedTitle;
40
39
  if (this._isString(title)) {
@@ -74,6 +74,8 @@
74
74
  }
75
75
 
76
76
  .itemContainer {
77
+ --ring-list-item-icon-size: 20px;
78
+
77
79
  position: relative;
78
80
  }
79
81
 
@@ -150,7 +152,7 @@
150
152
  }
151
153
 
152
154
  .padded {
153
- margin-left: 20px;
155
+ margin-left: calc(var(--ring-unit) + var(--ring-list-item-icon-size));
154
156
  }
155
157
 
156
158
  /* Override :last-child */
@@ -194,8 +196,8 @@
194
196
  .icon {
195
197
  display: inline-block;
196
198
 
197
- width: 20px;
198
- height: 20px;
199
+ width: var(--ring-list-item-icon-size);
200
+ height: var(--ring-list-item-icon-size);
199
201
  margin-left: calc(var(--ring-unit) * 2);
200
202
 
201
203
  background-repeat: no-repeat;
@@ -215,7 +217,7 @@
215
217
  .glyph {
216
218
  float: left;
217
219
 
218
- width: 20px;
220
+ width: var(--ring-list-item-icon-size);
219
221
 
220
222
  margin-right: var(--ring-unit);
221
223
 
@@ -227,7 +229,7 @@
227
229
 
228
230
  top: 0;
229
231
 
230
- height: 20px;
232
+ height: var(--ring-list-item-icon-size);
231
233
 
232
234
  object-fit: cover;
233
235
  object-position: center;
@@ -247,8 +249,8 @@
247
249
  top: 7px;
248
250
  left: 19px;
249
251
 
250
- width: 20px;
251
- height: 20px;
252
+ width: var(--ring-list-item-icon-size);
253
+ height: var(--ring-list-item-icon-size);
252
254
  margin-right: var(--ring-unit);
253
255
  }
254
256
 
@@ -342,7 +342,13 @@ export default class List extends Component {
342
342
  else {
343
343
  const itemId = this.getId(this.props.data[activeIndex]);
344
344
  if (itemId) {
345
- document.getElementById(itemId)?.scrollIntoView?.({ block: 'center' });
345
+ // scrollIntoView({container: 'nearest'}) is not yet supported in Firefox and Safari, emulating
346
+ const itemElement = document.getElementById(itemId);
347
+ const scrollerElement = this.inner;
348
+ if (itemElement && scrollerElement) {
349
+ scrollerElement.scrollTop =
350
+ itemElement.offsetTop + itemElement.clientHeight / 2 - scrollerElement.clientHeight / 2;
351
+ }
346
352
  }
347
353
  }
348
354
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "7.0.98",
3
+ "version": "7.0.100",
4
4
  "description": "JetBrains UI library",
5
5
  "author": {
6
6
  "name": "JetBrains"
@@ -117,11 +117,11 @@
117
117
  "@rollup/plugin-json": "^6.1.0",
118
118
  "@rollup/plugin-node-resolve": "^16.0.3",
119
119
  "@rollup/plugin-replace": "^6.0.3",
120
- "@storybook/addon-a11y": "10.2.13",
121
- "@storybook/addon-docs": "^10.2.13",
122
- "@storybook/addon-themes": "^10.2.13",
120
+ "@storybook/addon-a11y": "10.2.14",
121
+ "@storybook/addon-docs": "^10.2.14",
122
+ "@storybook/addon-themes": "^10.2.14",
123
123
  "@storybook/csf": "^0.1.13",
124
- "@storybook/react-webpack5": "10.2.13",
124
+ "@storybook/react-webpack5": "10.2.14",
125
125
  "@storybook/test-runner": "^0.24.2",
126
126
  "@testing-library/dom": "^10.4.1",
127
127
  "@testing-library/react": "^16.3.2",
@@ -145,7 +145,7 @@
145
145
  "dotenv-cli": "^11.0.0",
146
146
  "eslint": "^9.39.2",
147
147
  "eslint-config-prettier": "^10.1.8",
148
- "eslint-formatter-jslint-xml": "^8.40.0",
148
+ "eslint-formatter-jslint-xml": "^9.0.1",
149
149
  "eslint-import-resolver-exports": "^1.0.0-beta.5",
150
150
  "eslint-import-resolver-typescript": "^4.4.4",
151
151
  "eslint-import-resolver-webpack": "^0.13.10",
@@ -154,11 +154,11 @@
154
154
  "eslint-plugin-prettier": "^5.5.5",
155
155
  "eslint-plugin-react": "^7.37.5",
156
156
  "eslint-plugin-react-hooks": "^7.0.1",
157
- "eslint-plugin-storybook": "^10.2.13",
157
+ "eslint-plugin-storybook": "^10.2.14",
158
158
  "eslint-plugin-unicorn": "^63.0.0",
159
159
  "events": "^3.3.0",
160
160
  "glob": "^13.0.6",
161
- "globals": "^17.3.0",
161
+ "globals": "^17.4.0",
162
162
  "html-webpack-plugin": "^5.6.6",
163
163
  "http-server": "^14.1.1",
164
164
  "husky": "^9.1.7",
@@ -166,7 +166,7 @@
166
166
  "jest": "~30.2.0",
167
167
  "jest-environment-jsdom": "^30.2.0",
168
168
  "jest-teamcity": "^1.12.0",
169
- "lint-staged": "^16.2.7",
169
+ "lint-staged": "^16.3.1",
170
170
  "markdown-it": "^14.1.1",
171
171
  "merge-options": "^3.0.4",
172
172
  "pinst": "^3.0.0",
@@ -179,7 +179,7 @@
179
179
  "rollup": "^4.59.0",
180
180
  "rollup-plugin-clear": "^2.0.7",
181
181
  "storage-mock": "^2.1.0",
182
- "storybook": "10.2.13",
182
+ "storybook": "10.2.14",
183
183
  "stylelint": "^17.4.0",
184
184
  "stylelint-config-sass-guidelines": "^13.0.0",
185
185
  "svg-inline-loader": "^0.8.2",
@@ -217,7 +217,7 @@
217
217
  "@babel/core": "^7.29.0",
218
218
  "@babel/preset-typescript": "^7.28.5",
219
219
  "@jetbrains/babel-preset-jetbrains": "^2.4.0",
220
- "@jetbrains/icons": "^5.16.0",
220
+ "@jetbrains/icons": "^5.17.0",
221
221
  "@jetbrains/postcss-require-hover": "^0.2.0",
222
222
  "@types/combokeys": "^2.4.9",
223
223
  "@types/element-resize-detector": "^1.1.6",