@jetbrains/ring-ui 7.0.21 → 7.0.22
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.
- package/components/avatar/avatar.figma.d.ts +1 -0
- package/components/avatar/avatar.figma.js +24 -0
- package/components/list/list.css +4 -1
- package/components/list/list__classes.d.ts +2 -0
- package/components/list/list__classes.js +14 -0
- package/components/list/list__custom.js +4 -9
- package/components/list/list__item.js +5 -11
- package/components/list/list__link.js +3 -8
- package/package.json +9 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import figma from '@figma/code-connect';
|
|
3
|
+
import Avatar, { Size } from './avatar';
|
|
4
|
+
figma.connect(Avatar, 'https://www.figma.com/design/HY6d4uE1xxaQXCMG9fe6Y2/RingUI?m=auto&node-id=5990-522&t=v8bItK8qotmnbysK-1', {
|
|
5
|
+
props: {
|
|
6
|
+
round: figma.boolean('Round'),
|
|
7
|
+
size: figma.enum('Size', {
|
|
8
|
+
'20 px': Size.Size20,
|
|
9
|
+
'24 px': Size.Size24,
|
|
10
|
+
'28 px': Size.Size28,
|
|
11
|
+
'32 px': Size.Size32,
|
|
12
|
+
'40px': Size.Size40,
|
|
13
|
+
'56px': Size.Size56,
|
|
14
|
+
}),
|
|
15
|
+
username: figma.enum('Content', {
|
|
16
|
+
name: 'Samuel Morse',
|
|
17
|
+
}),
|
|
18
|
+
url: figma.enum('Content', {
|
|
19
|
+
'color/image': 'avatar.png',
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
example: props => _jsx(Avatar, { ...props }),
|
|
23
|
+
imports: ['import Avatar, {Size} from "@jetbrains/ring-ui/components/avatar/avatar"'],
|
|
24
|
+
});
|
package/components/list/list.css
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import globalStyles from '../global/global.css';
|
|
3
|
+
import { Type } from './consts';
|
|
4
|
+
import styles from './list.css';
|
|
5
|
+
export function getListClasses({ className, disabled, hover, compact, scrolling, rgItemType, }) {
|
|
6
|
+
return classNames(styles.item, globalStyles.resetButton, className, {
|
|
7
|
+
[styles.action]: !disabled,
|
|
8
|
+
[styles.actionLink]: !disabled && rgItemType === Type.LINK,
|
|
9
|
+
[styles.hover]: hover && !disabled,
|
|
10
|
+
[styles.compact]: compact,
|
|
11
|
+
[styles.scrolling]: scrolling,
|
|
12
|
+
[styles.disabled]: disabled,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PureComponent } from 'react';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
3
|
import dataTests from '../global/data-tests';
|
|
5
4
|
import getEventKey from '../global/get-event-key';
|
|
6
|
-
import
|
|
5
|
+
import { getListClasses } from './list__classes';
|
|
7
6
|
export default class ListCustom extends PureComponent {
|
|
8
7
|
handleKeyPress = (event) => {
|
|
9
8
|
const key = getEventKey(event);
|
|
@@ -12,15 +11,11 @@ export default class ListCustom extends PureComponent {
|
|
|
12
11
|
}
|
|
13
12
|
};
|
|
14
13
|
render() {
|
|
15
|
-
const {
|
|
16
|
-
const classes =
|
|
17
|
-
[styles.action]: !disabled,
|
|
18
|
-
[styles.hover]: hover && !disabled,
|
|
19
|
-
[styles.scrolling]: scrolling,
|
|
20
|
-
});
|
|
14
|
+
const { disabled, template, tabIndex, onClick, onMouseOver, onMouseUp, role, tagName } = this.props;
|
|
15
|
+
const classes = getListClasses(this.props);
|
|
21
16
|
const dataTest = dataTests('ring-list-item-custom', {
|
|
22
17
|
'ring-list-item-action': !disabled,
|
|
23
|
-
},
|
|
18
|
+
}, this.props['data-test']);
|
|
24
19
|
const content = typeof template === 'function' ? template(this.props) : template;
|
|
25
20
|
const TagName = tagName || 'span';
|
|
26
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 }));
|
|
@@ -6,8 +6,8 @@ import Avatar, { Size as AvatarSize } from '../avatar/avatar';
|
|
|
6
6
|
import Checkbox from '../checkbox/checkbox';
|
|
7
7
|
import Icon from '../icon/icon';
|
|
8
8
|
import getUID from '../global/get-uid';
|
|
9
|
-
import globalStyles from '../global/global.css';
|
|
10
9
|
import styles from './list.css';
|
|
10
|
+
import { getListClasses } from './list__classes';
|
|
11
11
|
/**
|
|
12
12
|
* @constructor
|
|
13
13
|
* @extends {ReactComponent}
|
|
@@ -20,18 +20,12 @@ export default class ListItem extends PureComponent {
|
|
|
20
20
|
stopBubbling = (e) => e.stopPropagation();
|
|
21
21
|
_isString = (val) => typeof val === 'string' || val instanceof String;
|
|
22
22
|
render() {
|
|
23
|
-
const {
|
|
23
|
+
const { disabled, checkbox, avatar, subavatar, glyph, icon, rightGlyph, description, label, title, details, hover, level, tabIndex, onClick, onCheckboxChange, onMouseOver, onMouseDown, onMouseUp, rightNodes, leftNodes, showGeneratedAvatar, username, labelWrapper, } = this.props;
|
|
24
24
|
const checkable = checkbox !== undefined;
|
|
25
25
|
const shouldShowGeneratedAvatar = showGeneratedAvatar && username != null;
|
|
26
26
|
const hasLeftNodes = leftNodes || glyph || avatar || shouldShowGeneratedAvatar;
|
|
27
27
|
const showCheckbox = checkable && (checkbox || !hasLeftNodes || (hover && !disabled));
|
|
28
|
-
const classes =
|
|
29
|
-
[styles.action]: !disabled,
|
|
30
|
-
[styles.hover]: hover && !disabled,
|
|
31
|
-
[styles.compact]: compact,
|
|
32
|
-
[styles.scrolling]: scrolling,
|
|
33
|
-
[styles.disabled]: disabled,
|
|
34
|
-
});
|
|
28
|
+
const classes = getListClasses(this.props);
|
|
35
29
|
const detailsClasses = classNames({
|
|
36
30
|
[styles.details]: details,
|
|
37
31
|
[styles.padded]: icon !== undefined || checkbox !== undefined || glyph !== undefined,
|
|
@@ -50,10 +44,10 @@ export default class ListItem extends PureComponent {
|
|
|
50
44
|
computedTitle = this._isString(label) ? label : '';
|
|
51
45
|
}
|
|
52
46
|
const dataTest = dataTests({
|
|
53
|
-
'ring-list-item': (
|
|
47
|
+
'ring-list-item': (this.props['data-test'] || '').indexOf('ring-list-item') === -1,
|
|
54
48
|
'ring-list-item-action': !disabled,
|
|
55
49
|
'ring-list-item-selected': checkbox,
|
|
56
|
-
},
|
|
50
|
+
}, this.props['data-test']);
|
|
57
51
|
const labelElement = (_jsx("span", { className: styles.label, title: computedTitle, "data-test": "ring-list-item-label", children: label }));
|
|
58
52
|
return (_jsxs("div", { className: styles.itemContainer, "data-test": dataTest, children: [showCheckbox && (_jsx("div", { className: styles.checkboxContainer, children: _jsx(Checkbox, { "aria-labelledby": this.id, checked: checkbox, disabled: disabled, onChange: onCheckboxChange, onClick: this.stopBubbling }) })), _jsxs("button", { id: this.id, type: "button", tabIndex: tabIndex, onClick: onClick, onMouseOver: onMouseOver, onMouseDown: onMouseDown, onFocus: onMouseOver, onMouseUp: onMouseUp, className: classes, style: style, disabled: disabled, children: [_jsxs("div", { className: styles.top, onMouseOut: this.stopBubbling, onBlur: this.stopBubbling, children: [!showCheckbox && (_jsxs("div", { className: styles.left, children: [leftNodes, glyph && (_jsx(Icon, { className: styles.glyph, glyph: glyph, size: this.props.iconSize, suppressSizeWarning: this.props.suppressSizeWarning })), (avatar || shouldShowGeneratedAvatar) && (_jsx(Avatar, { className: styles.avatar, url: avatar, size: AvatarSize.Size20, subavatar: subavatar, username: username }))] })), labelWrapper ? labelWrapper(labelElement) : labelElement, description && (_jsx("span", { className: styles.description, "data-test": "ring-list-item-description", children: description })), _jsxs("div", { className: styles.right, children: [rightGlyph && (_jsx(Icon, { className: styles.rightGlyph, glyph: rightGlyph, suppressSizeWarning: this.props.suppressSizeWarning, size: this.props.iconSize })), icon && _jsx("div", { className: styles.icon, style: { backgroundImage: `url("${icon}")` } }), rightNodes] })] }), details && _jsx("div", { className: detailsClasses, children: details })] })] }));
|
|
59
53
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PureComponent } from 'react';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
3
|
import Link, { linkHOC } from '../link/link';
|
|
5
4
|
import dataTests from '../global/data-tests';
|
|
6
|
-
import
|
|
5
|
+
import { getListClasses } from './list__classes';
|
|
7
6
|
/**
|
|
8
7
|
* @constructor
|
|
9
8
|
* @extends {ReactComponent}
|
|
@@ -11,12 +10,8 @@ import styles from './list.css';
|
|
|
11
10
|
export default class ListLink extends PureComponent {
|
|
12
11
|
render() {
|
|
13
12
|
const { scrolling, 'data-test': dataTest, className, label, hover, description, rgItemType, url, onCheckboxChange, disabled, LinkComponent, compact, hoverClassName, children, ...restProps } = this.props;
|
|
14
|
-
const classes =
|
|
15
|
-
[styles.actionLink]: !disabled,
|
|
16
|
-
[styles.compact]: compact,
|
|
17
|
-
[styles.scrolling]: scrolling,
|
|
18
|
-
});
|
|
13
|
+
const classes = getListClasses(this.props);
|
|
19
14
|
const Comp = LinkComponent ? linkHOC(LinkComponent) : Link;
|
|
20
|
-
return (_jsx(Comp, { pseudo: !this.props.href, ...restProps,
|
|
15
|
+
return (_jsx(Comp, { pseudo: !this.props.href, ...restProps, className: classes, "data-test": dataTests('ring-list-link', dataTest), children: label ?? children }));
|
|
21
16
|
}
|
|
22
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetbrains/ring-ui",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.22",
|
|
4
4
|
"description": "JetBrains UI library",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "JetBrains"
|
|
@@ -116,8 +116,8 @@
|
|
|
116
116
|
"@storybook/test-runner": "^0.21.0",
|
|
117
117
|
"@storybook/theming": "8.4.7",
|
|
118
118
|
"@testing-library/dom": "^10.4.0",
|
|
119
|
-
"@testing-library/react": "^16.
|
|
120
|
-
"@testing-library/user-event": "^14.
|
|
119
|
+
"@testing-library/react": "^16.2.0",
|
|
120
|
+
"@testing-library/user-event": "^14.6.0",
|
|
121
121
|
"@types/chai": "^5.0.1",
|
|
122
122
|
"@types/chai-as-promised": "^8.0.1",
|
|
123
123
|
"@types/chai-dom": "0.0.10",
|
|
@@ -136,13 +136,13 @@
|
|
|
136
136
|
"acorn": "^8.14.0",
|
|
137
137
|
"axe-playwright": "^2.0.3",
|
|
138
138
|
"babel-plugin-require-context-hook": "^1.0.0",
|
|
139
|
-
"caniuse-lite": "^1.0.
|
|
139
|
+
"caniuse-lite": "^1.0.30001695",
|
|
140
140
|
"chai": "^5.1.2",
|
|
141
141
|
"chai-as-promised": "^8.0.1",
|
|
142
142
|
"chai-dom": "^1.10.0",
|
|
143
143
|
"chai-enzyme": "1.0.0-beta.1",
|
|
144
144
|
"cheerio": "^1.0.0-rc.12",
|
|
145
|
-
"chromatic": "^11.
|
|
145
|
+
"chromatic": "^11.25.0",
|
|
146
146
|
"core-js": "^3.40.0",
|
|
147
147
|
"cpy-cli": "^5.0.0",
|
|
148
148
|
"dotenv-cli": "^8.0.0",
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"eslint-import-resolver-webpack": "^0.13.10",
|
|
154
154
|
"eslint-plugin-import": "^2.31.0",
|
|
155
155
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
156
|
-
"eslint-plugin-prettier": "^5.2.
|
|
156
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
157
157
|
"eslint-plugin-react": "^7.37.4",
|
|
158
158
|
"eslint-plugin-react-hooks": "^5.1.0",
|
|
159
159
|
"eslint-plugin-storybook": "^0.11.2",
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
"jest": "~29.7.0",
|
|
168
168
|
"jest-environment-jsdom": "^29.7.0",
|
|
169
169
|
"jest-teamcity": "^1.12.0",
|
|
170
|
-
"lint-staged": "^15.
|
|
170
|
+
"lint-staged": "^15.4.1",
|
|
171
171
|
"markdown-it": "^14.1.0",
|
|
172
172
|
"merge-options": "^3.0.4",
|
|
173
173
|
"pinst": "^3.0.0",
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"react-test-renderer": "^19.0.0",
|
|
179
179
|
"regenerator-runtime": "^0.14.1",
|
|
180
180
|
"rimraf": "^6.0.1",
|
|
181
|
-
"rollup": "^4.
|
|
181
|
+
"rollup": "^4.31.0",
|
|
182
182
|
"rollup-plugin-clear": "^2.0.7",
|
|
183
183
|
"sinon": "^19.0.2",
|
|
184
184
|
"sinon-chai": "^4.0.0",
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
"terser-webpack-plugin": "^5.3.11",
|
|
191
191
|
"typescript": "~5.7.3",
|
|
192
192
|
"typescript-eslint": "^8.20.0",
|
|
193
|
-
"vitest": "^
|
|
193
|
+
"vitest": "^3.0.2",
|
|
194
194
|
"vitest-teamcity-reporter": "^0.3.1",
|
|
195
195
|
"wallaby-webpack": "^3.9.16",
|
|
196
196
|
"webpack": "^5.97.1",
|