@jetbrains/ring-ui 4.0.42 → 4.0.46
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.
|
@@ -11,36 +11,44 @@ const {children, ...dropdownPropTypes} = Dropdown.propTypes || {};
|
|
|
11
11
|
const {
|
|
12
12
|
id: idPropType,
|
|
13
13
|
data: dataPropType,
|
|
14
|
-
ariaLabel: ariaLabelPropType
|
|
14
|
+
ariaLabel: ariaLabelPropType,
|
|
15
|
+
onSelect: onSelectPropType
|
|
15
16
|
} = PopupMenu.propTypes || {};
|
|
16
17
|
|
|
17
18
|
const defaultAriaLabel = 'Dropdown menu';
|
|
18
19
|
|
|
19
20
|
function DropdownAnchorWrapper({anchor, pinned, active, activeListItemId, listId, ...restProps}) {
|
|
20
|
-
const anchorAriaProps = useMemo(() => (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
), [active, activeListItemId, listId]);
|
|
21
|
+
const anchorAriaProps = useMemo(() => ({
|
|
22
|
+
...(listId ? {'aria-haspopup': 'true'} : {}),
|
|
23
|
+
...(activeListItemId ? {'aria-activedescendant': activeListItemId, 'aria-owns': listId} : {}),
|
|
24
|
+
...(active ? {'aria-expanded': 'true'} : {})
|
|
25
|
+
}), [active, activeListItemId, listId]);
|
|
25
26
|
|
|
26
27
|
const anchorProps = useMemo(
|
|
27
28
|
() => ({active, pinned, ...restProps, ...anchorAriaProps}),
|
|
28
29
|
[pinned, active, restProps, anchorAriaProps]
|
|
29
30
|
);
|
|
30
31
|
|
|
32
|
+
const anchorComponentProps = useMemo(
|
|
33
|
+
() => ({...anchorProps, pinned: `${anchorProps.pinned}`}),
|
|
34
|
+
[anchorProps]
|
|
35
|
+
);
|
|
36
|
+
|
|
31
37
|
if (typeof anchor === 'string') {
|
|
32
38
|
return (
|
|
33
39
|
<Anchor
|
|
34
|
-
{...
|
|
35
|
-
pinned={`${pinned}`}
|
|
40
|
+
{...anchorComponentProps}
|
|
36
41
|
>{anchor}</Anchor>
|
|
37
42
|
);
|
|
38
43
|
}
|
|
39
44
|
if (typeof anchor === 'function') {
|
|
40
|
-
return anchor(
|
|
45
|
+
return anchor(({active, pinned, ...restProps}), anchorAriaProps);
|
|
41
46
|
}
|
|
42
47
|
if (!Array.isArray(anchor)) {
|
|
43
|
-
return cloneElement(
|
|
48
|
+
return cloneElement(
|
|
49
|
+
anchor,
|
|
50
|
+
typeof anchor.type === 'string' ? anchorAriaProps : anchorComponentProps
|
|
51
|
+
);
|
|
44
52
|
}
|
|
45
53
|
return (
|
|
46
54
|
<div {...anchorAriaProps}>{anchor}</div>
|
|
@@ -56,7 +64,7 @@ DropdownAnchorWrapper.propTypes = {
|
|
|
56
64
|
};
|
|
57
65
|
|
|
58
66
|
const DropdownMenu = React.forwardRef(function DropdownMenu(
|
|
59
|
-
{id, anchor, ariaLabel, data, menuProps, ...restDropdownProps},
|
|
67
|
+
{id, anchor, ariaLabel, data, onSelect, menuProps, ...restDropdownProps},
|
|
60
68
|
forwardedRef
|
|
61
69
|
) {
|
|
62
70
|
const listId = useMemo(() => id || getUID('dropdown-menu-list'), [id]);
|
|
@@ -87,6 +95,7 @@ const DropdownMenu = React.forwardRef(function DropdownMenu(
|
|
|
87
95
|
closeOnSelect
|
|
88
96
|
activateFirstItem
|
|
89
97
|
data={data}
|
|
98
|
+
onSelect={onSelect}
|
|
90
99
|
{...menuProps}
|
|
91
100
|
/>
|
|
92
101
|
</Dropdown>
|
|
@@ -98,6 +107,7 @@ DropdownMenu.propTypes = {
|
|
|
98
107
|
id: idPropType,
|
|
99
108
|
data: dataPropType,
|
|
100
109
|
ariaLabel: ariaLabelPropType,
|
|
110
|
+
onSelect: onSelectPropType,
|
|
101
111
|
menuProps: PropTypes.object,
|
|
102
112
|
...dropdownPropTypes
|
|
103
113
|
};
|
|
@@ -133,11 +133,16 @@ export default class Tooltip extends Component {
|
|
|
133
133
|
const {children, 'data-test': dataTest,
|
|
134
134
|
title, delay, selfOverflowOnly, popupProps, ...restProps} = this.props;
|
|
135
135
|
|
|
136
|
+
const ariaProps = typeof title === 'string'
|
|
137
|
+
? {'aria-label': title, role: 'contentinfo'}
|
|
138
|
+
: {};
|
|
139
|
+
|
|
136
140
|
const {onNestedTooltipShow, onNestedTooltipHide} = this;
|
|
137
141
|
|
|
138
142
|
return (
|
|
139
143
|
<TooltipContext.Provider value={{onNestedTooltipShow, onNestedTooltipHide}}>
|
|
140
144
|
<span
|
|
145
|
+
{...ariaProps}
|
|
141
146
|
{...restProps}
|
|
142
147
|
ref={this.containerRef}
|
|
143
148
|
data-test={dataTests('ring-tooltip', dataTest)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetbrains/ring-ui",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.46",
|
|
4
4
|
"description": "JetBrains UI library",
|
|
5
5
|
"author": "JetBrains",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@babel/cli": "^7.15.4",
|
|
69
69
|
"@babel/eslint-parser": "^7.15.4",
|
|
70
70
|
"@jetbrains/eslint-config": "^5.3.1",
|
|
71
|
-
"@jetbrains/generator-ring-ui": "^4.0.
|
|
71
|
+
"@jetbrains/generator-ring-ui": "^4.0.35",
|
|
72
72
|
"@jetbrains/stylelint-config": "^2.0.1",
|
|
73
73
|
"@primer/octicons": "^15.1.0",
|
|
74
74
|
"@storybook/addon-a11y": "6.3.8",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"babel-plugin-require-context-hook": "^1.0.0",
|
|
96
96
|
"chai": "^4.3.4",
|
|
97
97
|
"chai-as-promised": "^7.1.1",
|
|
98
|
-
"chai-dom": "^1.
|
|
98
|
+
"chai-dom": "^1.10.0",
|
|
99
99
|
"chai-enzyme": "1.0.0-beta.1",
|
|
100
100
|
"cheerio": "^0.22.0",
|
|
101
101
|
"core-js": "^3.17.3",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"eslint-plugin-bdd": "^2.1.1",
|
|
107
107
|
"eslint-plugin-import": "^2.24.2",
|
|
108
108
|
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
109
|
-
"eslint-plugin-react": "^7.25.
|
|
109
|
+
"eslint-plugin-react": "^7.25.2",
|
|
110
110
|
"events": "^3.3.0",
|
|
111
111
|
"html-webpack-plugin": "^5.3.2",
|
|
112
112
|
"husky": "^7.0.2",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"teamcity-service-messages": "^0.1.11",
|
|
140
140
|
"terser-webpack-plugin": "^5.2.4",
|
|
141
141
|
"wallaby-webpack": "^3.9.16",
|
|
142
|
-
"webpack": "^5.
|
|
142
|
+
"webpack": "^5.53.0",
|
|
143
143
|
"webpack-cli": "^4.8.0",
|
|
144
144
|
"xmlappend": "^1.0.4",
|
|
145
145
|
"yo": "^4.3.0"
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
"core-js": ">=3.0.0",
|
|
149
149
|
"react": ">=16.8.0",
|
|
150
150
|
"react-dom": ">=16.8.0",
|
|
151
|
-
"webpack": "^5.
|
|
151
|
+
"webpack": "^5.53.0"
|
|
152
152
|
},
|
|
153
153
|
"dependencies": {
|
|
154
154
|
"@babel/core": "^7.15.5",
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
"compile-code-loader": "^1.0.0",
|
|
168
168
|
"conic-gradient": "^1.0.0",
|
|
169
169
|
"css-loader": "^6.2.0",
|
|
170
|
-
"date-fns": "^2.
|
|
170
|
+
"date-fns": "^2.24.0",
|
|
171
171
|
"deep-equal": "^2.0.4",
|
|
172
172
|
"element-resize-detector": "^1.2.3",
|
|
173
173
|
"es6-error": "^4.1.1",
|
|
@@ -207,5 +207,5 @@
|
|
|
207
207
|
"node": ">=7.4",
|
|
208
208
|
"npm": ">=6.0.0"
|
|
209
209
|
},
|
|
210
|
-
"gitHead": "
|
|
210
|
+
"gitHead": "51ea222790f311224226726b175ff773329f23ed"
|
|
211
211
|
}
|