@jetbrains/ring-ui 7.0.16 → 7.0.18

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.
@@ -39,12 +39,12 @@
39
39
  }
40
40
 
41
41
  .button {
42
- --ring-button-default-background-color: var(--ring-content-background-color);
42
+ --ring-button-default-background-color: transparent;
43
43
  --ring-button-background-color: var(--ring-button-default-background-color);
44
44
  --ring-button-hover-background-color: var(--ring-content-background-color);
45
45
  --ring-button-pressed-background-color: var(--ring-selected-background-color);
46
46
  --ring-button-active-background-color: var(--ring-hover-background-color);
47
- --ring-button-disabled-background-color: var(--ring-content-background-color);
47
+ --ring-button-disabled-background-color: var(--ring-button-default-background-color);
48
48
 
49
49
  box-sizing: border-box;
50
50
  margin: 0;
@@ -82,6 +82,7 @@
82
82
  }
83
83
 
84
84
  .block {
85
+ --ring-button-default-background-color: var(--ring-content-background-color);
85
86
  --ring-button-default-border-color: var(--ring-borders-color);
86
87
  --ring-button-border-color: var(--ring-button-default-border-color);
87
88
  --ring-button-hover-border-color: var(--ring-border-hover-color);
@@ -259,6 +260,7 @@
259
260
  }
260
261
 
261
262
  .ghost {
263
+ --ring-button-default-background-color: transparent;
262
264
  --ring-button-hover-background-color: var(--ring-tag-hover-background-color);
263
265
  --ring-button-text-color: var(--ring-secondary-color);
264
266
 
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,70 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import figma from '@figma/code-connect';
3
+ import addIcon from '@jetbrains/icons/add';
4
+ import add12pxIcon from '@jetbrains/icons/add-12px';
5
+ import downloadIcon from '@jetbrains/icons/download';
6
+ import download12pxIcon from '@jetbrains/icons/download-12px';
7
+ import { ControlsHeight } from '../global/controls-height';
8
+ import Button from './button';
9
+ figma.connect(Button, 'https://www.figma.com/design/HY6d4uE1xxaQXCMG9fe6Y2/RingUI?node-id=9954%3A528', {
10
+ props: {
11
+ height: figma.enum('Size', {
12
+ S: ControlsHeight.S,
13
+ M: ControlsHeight.M,
14
+ L: ControlsHeight.L,
15
+ }),
16
+ children: figma.enum('Type', {
17
+ Label: 'Button',
18
+ 'L-Icon-Label': 'Button',
19
+ 'R-Icon-Label': 'Button',
20
+ }),
21
+ icon: figma.enum('Type', {
22
+ 'L-Icon-Label': figma.enum('Size', {
23
+ S: figma.enum('Variant', {
24
+ Main: download12pxIcon,
25
+ Green: download12pxIcon,
26
+ 'Red solid': download12pxIcon,
27
+ Gray: download12pxIcon,
28
+ Outlined: download12pxIcon,
29
+ 'Red outlined': download12pxIcon,
30
+ Ghost: download12pxIcon,
31
+ Text: downloadIcon,
32
+ }),
33
+ M: downloadIcon,
34
+ L: downloadIcon,
35
+ }),
36
+ Icon: figma.enum('Size', {
37
+ S: figma.enum('Variant', {
38
+ Main: add12pxIcon,
39
+ Green: add12pxIcon,
40
+ 'Red solid': add12pxIcon,
41
+ Gray: add12pxIcon,
42
+ Outlined: add12pxIcon,
43
+ 'Red outlined': add12pxIcon,
44
+ Ghost: add12pxIcon,
45
+ Text: addIcon,
46
+ }),
47
+ M: addIcon,
48
+ L: addIcon,
49
+ }),
50
+ }),
51
+ dropdown: figma.enum('Type', { 'R-Icon-Label': true }),
52
+ disabled: figma.enum('State', { Disabled: true }),
53
+ primary: figma.enum('Variant', { Main: true }),
54
+ success: figma.enum('Variant', { Green: true }),
55
+ error: figma.enum('Variant', { 'Red solid': true }),
56
+ secondary: figma.enum('Variant', { Gray: true }),
57
+ danger: figma.enum('Variant', { 'Red outlined': true }),
58
+ ghost: figma.enum('Variant', { Ghost: true }),
59
+ inline: figma.enum('Variant', { Text: true }),
60
+ },
61
+ example: ({ children, ...restProps }) => _jsx(Button, { ...restProps, children: children }),
62
+ imports: [
63
+ 'import Button from "@jetbrains/ring-ui/components/button/button"',
64
+ 'import {ControlsHeight} from "@jetbrains/ring-ui/components/global/controls-height"',
65
+ 'import addIcon from "@jetbrains/icons/add"',
66
+ 'import add12pxIcon from "@jetbrains/icons/add-12px"',
67
+ 'import downloadIcon from "@jetbrains/icons/download"',
68
+ 'import download12pxIcon from "@jetbrains/icons/download-12px"',
69
+ ],
70
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import figma from '@figma/code-connect';
3
+ import chevronDownIcon from '@jetbrains/icons/chevron-down';
4
+ import Button from '../button/button';
5
+ import { ControlsHeight } from '../global/controls-height';
6
+ import ButtonGroup from './button-group';
7
+ figma.connect(ButtonGroup, 'https://www.figma.com/design/HY6d4uE1xxaQXCMG9fe6Y2/RingUI?node-id=9954%3A528', {
8
+ props: {
9
+ height: figma.enum('Size', {
10
+ S: ControlsHeight.S,
11
+ M: ControlsHeight.M,
12
+ L: ControlsHeight.L,
13
+ }),
14
+ disabled: figma.enum('State', { Disabled: true }),
15
+ primary: figma.enum('Variant', { Main: true }),
16
+ success: figma.enum('Variant', { Green: true }),
17
+ error: figma.enum('Variant', { 'Red solid': true }),
18
+ secondary: figma.enum('Variant', { Gray: true }),
19
+ danger: figma.enum('Variant', { 'Red outlined': true }),
20
+ ghost: figma.enum('Variant', { Ghost: true }),
21
+ inline: figma.enum('Variant', { Text: true }),
22
+ },
23
+ variant: { Type: 'Split' },
24
+ example: props => (_jsxs(ButtonGroup, { children: [_jsx(Button, { ...props, children: 'Button' }), _jsx(Button, { ...props, icon: chevronDownIcon })] })),
25
+ imports: [
26
+ 'import Button from "@jetbrains/ring-ui/components/button/button"',
27
+ 'import {ControlsHeight} from "@jetbrains/ring-ui/components/global/controls-height"',
28
+ 'import chevronDownIcon from "@jetbrains/icons/chevron-down"',
29
+ ],
30
+ });
@@ -114,7 +114,9 @@ export default class Dialog extends PureComponent {
114
114
  const shortcutsMap = this.getShortcutsMap();
115
115
  const content = (_jsxs(_Fragment, { children: [_jsx(Shortcuts, { map: shortcutsMap, scope: this.state.shortcutsScope, options: this.props.shortcutOptions }), (onOverlayClick !== noop || onCloseAttempt !== noop) && (_jsx("div", {
116
116
  // click handler is duplicated in close button
117
- role: "presentation", className: styles.clickableOverlay, onClick: this.handleClick, "data-test": "ring-dialog-overlay" })), _jsx("div", { className: styles.innerContainer, children: _jsxs(AdaptiveIsland, { className: classNames(styles.content, contentClassName, { [styles.dense]: dense }), "data-test": "ring-dialog", role: "dialog", "aria-label": label, children: [children, showCloseButton && (_jsx(Button, { icon: closeIcon, "data-test": "ring-dialog-close-button", className: classNames(styles.closeButton, {
117
+ role: "presentation", className: styles.clickableOverlay, onClick: this.handleClick, "data-test": "ring-dialog-overlay" })), _jsx("div", { className: styles.innerContainer, children: _jsxs(AdaptiveIsland, { className: classNames(styles.content, contentClassName, {
118
+ [styles.dense]: dense,
119
+ }), "data-test": "ring-dialog", role: "dialog", "aria-label": label, children: [children, showCloseButton && (_jsx(Button, { icon: closeIcon, "data-test": "ring-dialog-close-button", className: classNames(styles.closeButton, {
118
120
  [styles.closeButtonOutside]: !closeButtonInside,
119
121
  [styles.closeButtonInside]: closeButtonInside,
120
122
  }), iconClassName: classNames(styles.closeIcon, {
@@ -20,7 +20,8 @@ export default function focusSensorHOC(ComposedComponent) {
20
20
  }
21
21
  componentDidUpdate(prevProps) {
22
22
  const { focused } = this.props;
23
- if (focused && !prevProps.focused) {
23
+ const isInFocus = this.node?.contains(document.activeElement);
24
+ if (focused && (!isInFocus || !prevProps.focused)) {
24
25
  this.onFocusRestore();
25
26
  }
26
27
  else if (!focused && prevProps.focused) {
@@ -365,6 +365,8 @@ export default class List extends Component {
365
365
  if (cleanedProps.href) {
366
366
  cleanedProps.rgItemType = Type.LINK;
367
367
  }
368
+ cleanedProps.description =
369
+ typeof cleanedProps.description === 'string' ? cleanedProps.description.trim() : cleanedProps.description;
368
370
  const itemProps = Object.assign({ rgItemType: DEFAULT_ITEM_TYPE }, restProps);
369
371
  itemKey = key || itemId;
370
372
  itemProps.hover = isActive;
@@ -121,6 +121,7 @@ export default class Popup<P extends BasePopupProps = PopupProps> extends PureCo
121
121
  private _redraw;
122
122
  private _getAnchor;
123
123
  private _listenersEnabled?;
124
+ private _prevTimeout?;
124
125
  /**
125
126
  * @param {boolean} enable
126
127
  * @private
@@ -70,9 +70,6 @@ export default class Popup extends PureComponent {
70
70
  display: Display.SHOWING,
71
71
  };
72
72
  componentDidMount() {
73
- if (!this.props.client) {
74
- this.setState({ client: true });
75
- }
76
73
  if (!this.props.hidden) {
77
74
  this._setListenersEnabled(true);
78
75
  }
@@ -192,13 +189,15 @@ export default class Popup extends PureComponent {
192
189
  return this.props.anchorElement || this.parent;
193
190
  }
194
191
  _listenersEnabled;
192
+ _prevTimeout;
195
193
  /**
196
194
  * @param {boolean} enable
197
195
  * @private
198
196
  */
199
197
  _setListenersEnabled(enable) {
200
198
  if (enable && !this._listenersEnabled) {
201
- setTimeout(() => {
199
+ clearTimeout(this._prevTimeout);
200
+ this._prevTimeout = window.setTimeout(() => {
202
201
  this._listenersEnabled = true;
203
202
  this.listeners.add(window, 'resize', this._redraw);
204
203
  if (this.props.autoPositioningOnScroll) {
@@ -215,6 +214,7 @@ export default class Popup extends PureComponent {
215
214
  }
216
215
  if (!enable && this._listenersEnabled) {
217
216
  this.listeners.removeAll();
217
+ clearTimeout(this._prevTimeout);
218
218
  this._listenersEnabled = false;
219
219
  }
220
220
  }
@@ -269,7 +269,7 @@ export default class Popup extends PureComponent {
269
269
  // prevent bubbling through portal
270
270
  onClick: stop,
271
271
  // This handler only blocks bubbling through React portal
272
- role: "presentation", ref: this.portalRef, children: [this.shouldUseShortcuts() && _jsx(Shortcuts, { map: this.shortcutsMap, scope: this.shortcutsScope }), (client || this.state.client) &&
272
+ role: "presentation", ref: this.portalRef, children: [this.shouldUseShortcuts() && _jsx(Shortcuts, { map: this.shortcutsMap, scope: this.shortcutsScope }), client !== false &&
273
273
  (keepMounted || !hidden) &&
274
274
  createPortal(_jsx(PopupTarget, { id: this.uid, ref: this.containerRef, onMouseOver: onMouseOver, onFocus: onMouseOver, onMouseOut: onMouseOut, onBlur: onMouseOut, onContextMenu: onContextMenu, children: _jsx("div", { "data-test": dataTests('ring-popup', dataTest), "data-test-shown": !hidden && !showing, "data-test-direction": direction, ref: this.popupRef, className: classes, style: style, onMouseDown: onMouseDown, onMouseUp: onMouseUp,
275
275
  // mouse handlers are used to track clicking on inner elements
package/package.json CHANGED
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "7.0.16",
3
+ "version": "7.0.18",
4
4
  "description": "JetBrains UI library",
5
- "author": "JetBrains",
5
+ "author": {
6
+ "name": "JetBrains"
7
+ },
6
8
  "license": "Apache-2.0",
7
9
  "packageManager": "npm@8.11.0",
8
10
  "files": [
@@ -46,6 +48,12 @@
46
48
  "screenshots-test-ci": "npm --prefix packages/screenshots run test-ci",
47
49
  "screenshots-gather": "npm --prefix packages/screenshots run gather",
48
50
  "build-stories": "storybook build --quiet -c .storybook -o storybook-dist",
51
+ "chromatic": "npx chromatic --build-script-name build-stories --exit-once-uploaded",
52
+ "chromatic-local": "dotenv -- npm run publish-stories",
53
+ "figma-connect-publish": "npx figma connect publish --token=$FIGMA_CODE_CONNECT_TOKEN",
54
+ "figma-connect-publish-local": "dotenv -- npm run figma-connect-publish",
55
+ "figma-connect-unpublish": "npx figma connect unpublish --token=$FIGMA_CODE_CONNECT_TOKEN",
56
+ "figma-connect-unpublish-local": "dotenv -- npm run figma-connect-unpublish",
49
57
  "prebuild": "rimraf components && tsc --project tsconfig-build.json && cpy './**/*' '!**/*.ts' '!**/*.tsx' '!**/__mocks__/**' ../components --parents --cwd=src/",
50
58
  "build": "./node_modules/.bin/rollup -c --bundleConfigAsCjs",
51
59
  "postbuild": "cpy './**/*.d.ts' ../dist --parents --cwd=components/",
@@ -73,7 +81,7 @@
73
81
  },
74
82
  "repository": {
75
83
  "type": "git",
76
- "url": "ssh://github.com/JetBrains/ring-ui.git"
84
+ "url": "git+ssh://git@github.com/JetBrains/ring-ui.git"
77
85
  },
78
86
  "readmeFilename": "README.md",
79
87
  "devDependencies": {
@@ -85,10 +93,11 @@
85
93
  "@eslint/compat": "^1.2.4",
86
94
  "@eslint/eslintrc": "^3.2.0",
87
95
  "@eslint/js": "^9.17.0",
96
+ "@figma/code-connect": "^1.2.4",
88
97
  "@jetbrains/eslint-config": "^6.0.4",
89
98
  "@jetbrains/logos": "3.0.0-canary.734b213.0",
90
- "@jetbrains/stylelint-config": "^4.0.2",
91
99
  "@jetbrains/rollup-css-plugin": "./packages/rollup-css-plugin",
100
+ "@jetbrains/stylelint-config": "^4.0.2",
92
101
  "@primer/octicons": "^19.14.0",
93
102
  "@rollup/plugin-babel": "^6.0.4",
94
103
  "@rollup/plugin-json": "^6.1.0",
@@ -99,12 +108,12 @@
99
108
  "@storybook/addon-essentials": "8.4.7",
100
109
  "@storybook/addon-themes": "^8.4.7",
101
110
  "@storybook/components": "8.4.7",
102
- "@storybook/csf": "^0.1.12",
111
+ "@storybook/csf": "^0.1.13",
103
112
  "@storybook/manager-api": "8.4.7",
104
113
  "@storybook/preview-api": "8.4.7",
105
114
  "@storybook/react": "8.4.7",
106
115
  "@storybook/react-webpack5": "8.4.7",
107
- "@storybook/test-runner": "^0.20.1",
116
+ "@storybook/test-runner": "^0.21.0",
108
117
  "@storybook/theming": "8.4.7",
109
118
  "@testing-library/dom": "^10.4.0",
110
119
  "@testing-library/react": "^16.1.0",
@@ -122,7 +131,7 @@
122
131
  "@types/sinon-chai": "^4.0.0",
123
132
  "@types/webpack-env": "^1.18.5",
124
133
  "@vitejs/plugin-react": "^4.3.4",
125
- "@vitest/eslint-plugin": "^1.1.18",
134
+ "@vitest/eslint-plugin": "^1.1.22",
126
135
  "@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
127
136
  "acorn": "^8.14.0",
128
137
  "axe-playwright": "^2.0.3",
@@ -133,8 +142,10 @@
133
142
  "chai-dom": "^1.10.0",
134
143
  "chai-enzyme": "1.0.0-beta.1",
135
144
  "cheerio": "^1.0.0-rc.12",
145
+ "chromatic": "^11.20.2",
136
146
  "core-js": "^3.39.0",
137
147
  "cpy-cli": "^5.0.0",
148
+ "dotenv-cli": "^8.0.0",
138
149
  "enzyme": "^3.11.0",
139
150
  "eslint": "^9.17.0",
140
151
  "eslint-config-prettier": "^9.1.0",
@@ -143,7 +154,7 @@
143
154
  "eslint-plugin-import": "^2.31.0",
144
155
  "eslint-plugin-jsx-a11y": "^6.10.2",
145
156
  "eslint-plugin-prettier": "^5.2.1",
146
- "eslint-plugin-react": "^7.37.2",
157
+ "eslint-plugin-react": "^7.37.3",
147
158
  "eslint-plugin-react-hooks": "^5.1.0",
148
159
  "eslint-plugin-storybook": "^0.11.1",
149
160
  "events": "^3.3.0",
@@ -156,7 +167,7 @@
156
167
  "jest": "~29.7.0",
157
168
  "jest-environment-jsdom": "^29.7.0",
158
169
  "jest-teamcity": "^1.12.0",
159
- "lint-staged": "^15.2.11",
170
+ "lint-staged": "^15.3.0",
160
171
  "markdown-it": "^14.1.0",
161
172
  "merge-options": "^3.0.4",
162
173
  "pinst": "^3.0.0",
@@ -167,7 +178,7 @@
167
178
  "react-test-renderer": "^19.0.0",
168
179
  "regenerator-runtime": "^0.14.1",
169
180
  "rimraf": "^6.0.1",
170
- "rollup": "^4.28.1",
181
+ "rollup": "^4.29.1",
171
182
  "rollup-plugin-clear": "^2.0.7",
172
183
  "sinon": "^19.0.2",
173
184
  "sinon-chai": "^4.0.0",
@@ -178,12 +189,12 @@
178
189
  "teamcity-service-messages": "^0.1.14",
179
190
  "terser-webpack-plugin": "^5.3.11",
180
191
  "typescript": "~5.7.2",
181
- "typescript-eslint": "^8.18.1",
192
+ "typescript-eslint": "^8.19.0",
182
193
  "vitest": "^2.1.8",
183
194
  "vitest-teamcity-reporter": "^0.3.1",
184
195
  "wallaby-webpack": "^3.9.16",
185
196
  "webpack": "^5.97.1",
186
- "webpack-cli": "^5.1.4",
197
+ "webpack-cli": "^6.0.1",
187
198
  "xmlappend": "^1.0.4"
188
199
  },
189
200
  "peerDependencies": {
@@ -239,8 +250,8 @@
239
250
  "postcss-font-family-system-ui": "^5.0.0",
240
251
  "postcss-loader": "^8.1.1",
241
252
  "postcss-modules-values-replace": "^4.2.0",
242
- "postcss-preset-env": "^10.1.2",
243
- "react-movable": "^3.3.1",
253
+ "postcss-preset-env": "^10.1.3",
254
+ "react-movable": "^3.4.0",
244
255
  "react-virtualized": "^9.22.5",
245
256
  "react-waypoint": "^10.3.0",
246
257
  "scrollbar-width": "^3.1.1",
@@ -254,5 +265,9 @@
254
265
  "engines": {
255
266
  "node": ">=14.0",
256
267
  "npm": ">=6.0.0"
257
- }
268
+ },
269
+ "bugs": {
270
+ "url": "https://github.com/JetBrains/ring-ui/issues"
271
+ },
272
+ "homepage": "https://github.com/JetBrains/ring-ui#readme"
258
273
  }