@patternfly/react-core 4.211.2 → 4.211.5
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/CHANGELOG.md +30 -0
- package/dist/esm/components/Modal/Modal.d.ts +4 -0
- package/dist/esm/components/Modal/Modal.d.ts.map +1 -1
- package/dist/esm/components/Modal/Modal.js +2 -2
- package/dist/esm/components/Modal/Modal.js.map +1 -1
- package/dist/esm/components/Modal/ModalContent.d.ts +4 -0
- package/dist/esm/components/Modal/ModalContent.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalContent.js +3 -2
- package/dist/esm/components/Modal/ModalContent.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.d.ts +6 -0
- package/dist/esm/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +2 -2
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/helpers/Popper/Popper.js +7 -6
- package/dist/esm/helpers/Popper/Popper.js.map +1 -1
- package/dist/js/components/Modal/Modal.d.ts +4 -0
- package/dist/js/components/Modal/Modal.d.ts.map +1 -1
- package/dist/js/components/Modal/Modal.js +2 -2
- package/dist/js/components/Modal/Modal.js.map +1 -1
- package/dist/js/components/Modal/ModalContent.d.ts +4 -0
- package/dist/js/components/Modal/ModalContent.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalContent.js +3 -2
- package/dist/js/components/Modal/ModalContent.js.map +1 -1
- package/dist/js/components/Tooltip/Tooltip.d.ts +6 -0
- package/dist/js/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/js/components/Tooltip/Tooltip.js +2 -2
- package/dist/js/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/js/helpers/Popper/Popper.js +7 -6
- package/dist/js/helpers/Popper/Popper.js.map +1 -1
- package/dist/umd/react-core.css +74 -69
- package/dist/umd/react-core.js +14 -12
- package/dist/umd/react-core.min.css +82 -77
- package/dist/umd/react-core.min.js +3 -3
- package/package.json +6 -6
- package/src/components/Modal/Modal.tsx +8 -0
- package/src/components/Modal/ModalContent.tsx +14 -1
- package/src/components/Modal/__tests__/Modal.test.tsx +56 -0
- package/src/components/Modal/examples/Modal.md +7 -0
- package/src/components/Modal/examples/ModalWithOverflowingContent.tsx +71 -0
- package/src/components/Tabs/examples/Tabs.md +144 -25
- package/src/components/Tooltip/Tooltip.tsx +8 -0
- package/src/components/Tooltip/examples/Tooltip.md +86 -41
- package/src/helpers/Popper/Popper.tsx +10 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.211.
|
|
3
|
+
"version": "4.211.5",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.62.
|
|
38
|
-
"@patternfly/react-styles": "^4.61.
|
|
39
|
-
"@patternfly/react-tokens": "^4.63.
|
|
37
|
+
"@patternfly/react-icons": "^4.62.5",
|
|
38
|
+
"@patternfly/react-styles": "^4.61.5",
|
|
39
|
+
"@patternfly/react-tokens": "^4.63.5",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
43
43
|
"tslib": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@patternfly/patternfly": "4.194.
|
|
46
|
+
"@patternfly/patternfly": "4.194.1",
|
|
47
47
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
48
48
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
49
49
|
"@rollup/plugin-replace": "^3.0.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "21e6084e6b2057c8a26d6cc7bc804fa81e825545"
|
|
64
64
|
}
|
|
@@ -31,6 +31,10 @@ export interface ModalProps extends React.HTMLProps<HTMLDivElement>, OUIAProps {
|
|
|
31
31
|
'aria-label'?: string;
|
|
32
32
|
/** Id to use for Modal Box descriptor */
|
|
33
33
|
'aria-describedby'?: string;
|
|
34
|
+
/** Accessible label applied to the modal box body. This should be used to communicate important information about the modal box body div if needed, such as that it is scrollable */
|
|
35
|
+
bodyAriaLabel?: string;
|
|
36
|
+
/** Accessible role applied to the modal box body. This will default to region if a body aria label is applied. Set to a more appropriate role as applicable based on the modal content and context */
|
|
37
|
+
bodyAriaRole?: string;
|
|
34
38
|
/** Flag to show the close button in the header area of the modal */
|
|
35
39
|
showClose?: boolean;
|
|
36
40
|
/** Custom footer */
|
|
@@ -206,6 +210,8 @@ export class Modal extends React.Component<ModalProps, ModalState> {
|
|
|
206
210
|
'aria-labelledby': ariaLabelledby,
|
|
207
211
|
'aria-label': ariaLabel,
|
|
208
212
|
'aria-describedby': ariaDescribedby,
|
|
213
|
+
bodyAriaLabel,
|
|
214
|
+
bodyAriaRole,
|
|
209
215
|
title,
|
|
210
216
|
titleIconVariant,
|
|
211
217
|
titleLabel,
|
|
@@ -231,6 +237,8 @@ export class Modal extends React.Component<ModalProps, ModalState> {
|
|
|
231
237
|
aria-label={ariaLabel}
|
|
232
238
|
aria-describedby={ariaDescribedby}
|
|
233
239
|
aria-labelledby={ariaLabelledby}
|
|
240
|
+
bodyAriaLabel={bodyAriaLabel}
|
|
241
|
+
bodyAriaRole={bodyAriaRole}
|
|
234
242
|
ouiaId={ouiaId !== undefined ? ouiaId : this.state.ouiaStateId}
|
|
235
243
|
ouiaSafe={ouiaSafe}
|
|
236
244
|
/>,
|
|
@@ -47,6 +47,10 @@ export interface ModalContentProps extends OUIAProps {
|
|
|
47
47
|
'aria-label'?: string;
|
|
48
48
|
/** Id of Modal Box description */
|
|
49
49
|
'aria-describedby'?: string;
|
|
50
|
+
/** Accessible label applied to the modal box body. This should be used to communicate important information about the modal box body div if needed, such as that it is scrollable */
|
|
51
|
+
bodyAriaLabel?: string;
|
|
52
|
+
/** Accessible role applied to the modal box body. This will default to region if a body aria label is applied. Set to a more appropriate role as applicable based on the modal content and context */
|
|
53
|
+
bodyAriaRole?: string;
|
|
50
54
|
/** Flag to show the close button in the header area of the modal */
|
|
51
55
|
showClose?: boolean;
|
|
52
56
|
/** Default width of the content. */
|
|
@@ -82,6 +86,8 @@ export const ModalContent: React.FunctionComponent<ModalContentProps> = ({
|
|
|
82
86
|
'aria-label': ariaLabel = '',
|
|
83
87
|
'aria-describedby': ariaDescribedby,
|
|
84
88
|
'aria-labelledby': ariaLabelledby,
|
|
89
|
+
bodyAriaLabel,
|
|
90
|
+
bodyAriaRole,
|
|
85
91
|
showClose = true,
|
|
86
92
|
footer = null,
|
|
87
93
|
actions = [],
|
|
@@ -120,10 +126,17 @@ export const ModalContent: React.FunctionComponent<ModalContentProps> = ({
|
|
|
120
126
|
actions.length > 0 && <ModalBoxFooter>{actions}</ModalBoxFooter>
|
|
121
127
|
);
|
|
122
128
|
|
|
129
|
+
const defaultModalBodyAriaRole = bodyAriaLabel ? 'region' : undefined;
|
|
130
|
+
|
|
123
131
|
const modalBody = hasNoBodyWrapper ? (
|
|
124
132
|
children
|
|
125
133
|
) : (
|
|
126
|
-
<ModalBoxBody
|
|
134
|
+
<ModalBoxBody
|
|
135
|
+
aria-label={bodyAriaLabel}
|
|
136
|
+
role={bodyAriaRole || defaultModalBodyAriaRole}
|
|
137
|
+
{...props}
|
|
138
|
+
{...(!description && !ariaDescribedby && { id: descriptorId })}
|
|
139
|
+
>
|
|
127
140
|
{children}
|
|
128
141
|
</ModalBoxBody>
|
|
129
142
|
);
|
|
@@ -85,4 +85,60 @@ describe('Modal', () => {
|
|
|
85
85
|
|
|
86
86
|
expect(consoleErrorMock).toHaveBeenCalled();
|
|
87
87
|
});
|
|
88
|
+
|
|
89
|
+
test('The modalBoxBody has no aria-label when bodyAriaLabel is not passed', () => {
|
|
90
|
+
const props = {
|
|
91
|
+
isOpen: true
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
render(<Modal {...props}>This is a ModalBox</Modal>);
|
|
95
|
+
|
|
96
|
+
const modalBoxBody = screen.getByText('This is a ModalBox');
|
|
97
|
+
expect(modalBoxBody).not.toHaveAccessibleName('modal box body aria label');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test('The modalBoxBody has the expected aria-label when bodyAriaLabel is passed', () => {
|
|
101
|
+
const props = {
|
|
102
|
+
isOpen: true
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
render(
|
|
106
|
+
<Modal bodyAriaLabel="modal box body aria label" {...props}>
|
|
107
|
+
This is a ModalBox
|
|
108
|
+
</Modal>
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const modalBoxBody = screen.getByText('This is a ModalBox');
|
|
112
|
+
expect(modalBoxBody).toHaveAccessibleName('modal box body aria label');
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('The modalBoxBody has the expected aria role when bodyAriaLabel is passed and bodyAriaRole is not', () => {
|
|
116
|
+
const props = {
|
|
117
|
+
isOpen: true
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
render(
|
|
121
|
+
<Modal bodyAriaLabel="modal box body aria label" {...props}>
|
|
122
|
+
This is a ModalBox
|
|
123
|
+
</Modal>
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const modalBoxBody = screen.getByRole('region', { name: 'modal box body aria label' });
|
|
127
|
+
expect(modalBoxBody).toBeInTheDocument();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test('The modalBoxBody has the expected aria role when bodyAriaRole is passed', () => {
|
|
131
|
+
const props = {
|
|
132
|
+
isOpen: true
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
render(
|
|
136
|
+
<Modal bodyAriaLabel="modal box body aria label" bodyAriaRole="article" {...props}>
|
|
137
|
+
This is a ModalBox
|
|
138
|
+
</Modal>
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const modalBoxBody = screen.getByRole('article', { name: 'modal box body aria label' });
|
|
142
|
+
expect(modalBoxBody).toBeInTheDocument();
|
|
143
|
+
});
|
|
88
144
|
});
|
|
@@ -869,3 +869,10 @@ class HelpModal extends React.Component {
|
|
|
869
869
|
```ts file="ModalWithForm.tsx"
|
|
870
870
|
|
|
871
871
|
```
|
|
872
|
+
|
|
873
|
+
### With overflowing content
|
|
874
|
+
|
|
875
|
+
If the content that you're passing to the modal is likely to overflow the modal content area, pass tabIndex={0} to the modal to enable keyboard accessible scrolling.
|
|
876
|
+
|
|
877
|
+
```ts file="ModalWithOverflowingContent.tsx"
|
|
878
|
+
```
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Modal, ModalVariant, Button } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const ModalWithOverflowingContent: React.FunctionComponent = () => {
|
|
5
|
+
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
|
6
|
+
|
|
7
|
+
const handleModalToggle = () => {
|
|
8
|
+
setIsModalOpen(prevIsModalOpen => !prevIsModalOpen);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<React.Fragment>
|
|
13
|
+
<Button variant="primary" onClick={handleModalToggle}>
|
|
14
|
+
Show modal
|
|
15
|
+
</Button>
|
|
16
|
+
<Modal
|
|
17
|
+
bodyAriaLabel="Scrollable modal content"
|
|
18
|
+
tabIndex={0}
|
|
19
|
+
variant={ModalVariant.small}
|
|
20
|
+
title="Modal with overflowing content"
|
|
21
|
+
isOpen={isModalOpen}
|
|
22
|
+
onClose={handleModalToggle}
|
|
23
|
+
actions={[
|
|
24
|
+
<Button key="confirm" variant="primary" onClick={handleModalToggle}>
|
|
25
|
+
Confirm
|
|
26
|
+
</Button>,
|
|
27
|
+
<Button key="cancel" variant="link" onClick={handleModalToggle}>
|
|
28
|
+
Cancel
|
|
29
|
+
</Button>
|
|
30
|
+
]}
|
|
31
|
+
>
|
|
32
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
33
|
+
magna aliqua. Quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Semper auctor neque vitae tempus.
|
|
34
|
+
Diam donec adipiscing tristique risus. Augue eget arcu dictum varius duis. Ut enim blandit volutpat maecenas
|
|
35
|
+
volutpat blandit aliquam. Sit amet mauris commodo quis imperdiet massa tincidunt. Habitant morbi tristique
|
|
36
|
+
senectus et netus. Fames ac turpis egestas sed tempus urna. Neque laoreet suspendisse interdum consectetur
|
|
37
|
+
libero id. Volutpat lacus laoreet non curabitur gravida arcu ac tortor. Porta nibh venenatis cras sed felis eget
|
|
38
|
+
velit. Nullam non nisi est sit amet facilisis. Nunc mi ipsum faucibus vitae. Lorem sed risus ultricies tristique
|
|
39
|
+
nulla aliquet enim tortor at. Egestas sed tempus urna et pharetra pharetra massa massa ultricies. Lacinia quis
|
|
40
|
+
vel eros donec ac odio tempor orci. Malesuada fames ac turpis egestas integer eget aliquet.
|
|
41
|
+
<br />
|
|
42
|
+
<br />
|
|
43
|
+
Neque aliquam vestibulum morbi blandit cursus risus at ultrices. Molestie at elementum eu facilisis sed odio
|
|
44
|
+
morbi. Elit pellentesque habitant morbi tristique. Consequat nisl vel pretium lectus quam id leo in vitae. Quis
|
|
45
|
+
varius quam quisque id diam vel quam elementum. Viverra nam libero justo laoreet sit amet cursus. Sollicitudin
|
|
46
|
+
tempor id eu nisl nunc. Orci nulla pellentesque dignissim enim sit amet venenatis. Dignissim enim sit amet
|
|
47
|
+
venenatis urna cursus eget. Iaculis at erat pellentesque adipiscing commodo elit. Faucibus pulvinar elementum
|
|
48
|
+
integer enim neque volutpat. Nullam vehicula ipsum a arcu cursus vitae congue mauris. Nunc mattis enim ut tellus
|
|
49
|
+
elementum sagittis vitae. Blandit cursus risus at ultrices. Tellus mauris a diam maecenas sed enim. Non diam
|
|
50
|
+
phasellus vestibulum lorem sed risus ultricies tristique nulla.
|
|
51
|
+
<br />
|
|
52
|
+
<br />
|
|
53
|
+
Nulla pharetra diam sit amet nisl suscipit adipiscing. Ac tortor vitae purus faucibus ornare suspendisse sed
|
|
54
|
+
nisi. Sed felis eget velit aliquet sagittis id consectetur purus. Tincidunt tortor aliquam nulla facilisi cras
|
|
55
|
+
fermentum. Volutpat est velit egestas dui id ornare arcu odio. Pharetra magna ac placerat vestibulum. Ultrices
|
|
56
|
+
sagittis orci a scelerisque purus semper eget duis at. Nisi est sit amet facilisis magna etiam tempor orci eu.
|
|
57
|
+
Convallis tellus id interdum velit. Facilisis sed odio morbi quis commodo odio aenean sed.
|
|
58
|
+
<br />
|
|
59
|
+
<br />
|
|
60
|
+
Eu scelerisque felis imperdiet proin fermentum leo vel orci porta. Facilisi etiam dignissim diam quis enim
|
|
61
|
+
lobortis scelerisque fermentum. Eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada. Magna
|
|
62
|
+
etiam tempor orci eu lobortis elementum. Quis auctor elit sed vulputate mi sit. Eleifend quam adipiscing vitae
|
|
63
|
+
proin sagittis nisl rhoncus mattis rhoncus. Erat velit scelerisque in dictum non. Sit amet nulla facilisi morbi
|
|
64
|
+
tempus iaculis urna. Enim ut tellus elementum sagittis vitae et leo duis ut. Lectus arcu bibendum at varius vel
|
|
65
|
+
pharetra vel turpis. Morbi tristique senectus et netus et. Eget aliquet nibh praesent tristique magna sit amet
|
|
66
|
+
purus gravida. Nisl purus in mollis nunc sed id semper risus. Id neque aliquam vestibulum morbi. Mauris a diam
|
|
67
|
+
maecenas sed enim ut sem. Egestas tellus rutrum tellus pellentesque.
|
|
68
|
+
</Modal>
|
|
69
|
+
</React.Fragment>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
@@ -56,7 +56,12 @@ class SimpleTabs extends React.Component {
|
|
|
56
56
|
|
|
57
57
|
return (
|
|
58
58
|
<div>
|
|
59
|
-
<Tabs
|
|
59
|
+
<Tabs
|
|
60
|
+
activeKey={activeTabKey}
|
|
61
|
+
onSelect={this.handleTabClick}
|
|
62
|
+
isBox={isBox}
|
|
63
|
+
aria-label="Tabs in the default example"
|
|
64
|
+
>
|
|
60
65
|
<Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
|
|
61
66
|
Users
|
|
62
67
|
</Tab>
|
|
@@ -99,7 +104,9 @@ class SimpleTabs extends React.Component {
|
|
|
99
104
|
|
|
100
105
|
### With tooltip react ref
|
|
101
106
|
|
|
102
|
-
When using a React ref to link a Tooltip to a Tab component
|
|
107
|
+
When using a React ref to link a Tooltip to a Tab component via the `reference` prop, you should avoid manually passing in a value of "off" to the `aria-live` prop. Doing so may lead to the tooltip becoming less accessible to assistive technologies.
|
|
108
|
+
|
|
109
|
+
The tooltip should also have the `id` prop passed in. The value given to this prop should then be passed into the tab's `aria-describedby` prop. This ensures a tooltip used with a React ref will be announced by the JAWS and NVDA screen readers.
|
|
103
110
|
|
|
104
111
|
```js
|
|
105
112
|
import React from 'react';
|
|
@@ -132,7 +139,12 @@ class SimpleTabs extends React.Component {
|
|
|
132
139
|
|
|
133
140
|
return (
|
|
134
141
|
<div>
|
|
135
|
-
<Tabs
|
|
142
|
+
<Tabs
|
|
143
|
+
activeKey={activeTabKey}
|
|
144
|
+
onSelect={this.handleTabClick}
|
|
145
|
+
isBox={isBox}
|
|
146
|
+
aria-label="Tabs in the example with a tooltip ref"
|
|
147
|
+
>
|
|
136
148
|
<Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
|
|
137
149
|
Users
|
|
138
150
|
</Tab>
|
|
@@ -153,15 +165,15 @@ class SimpleTabs extends React.Component {
|
|
|
153
165
|
title={<TabTitleText>ARIA Disabled (Tooltip)</TabTitleText>}
|
|
154
166
|
isAriaDisabled
|
|
155
167
|
ref={tooltipRef}
|
|
156
|
-
aria-describedby="tooltip-
|
|
168
|
+
aria-describedby="tooltip-ref1"
|
|
157
169
|
>
|
|
158
170
|
ARIA Disabled (Tooltip)
|
|
159
171
|
</Tab>
|
|
160
172
|
</Tabs>
|
|
161
173
|
<Tooltip
|
|
174
|
+
id="tooltip-ref1"
|
|
162
175
|
content="Aria-disabled tabs are like disabled tabs, but focusable. Allows for tooltip support."
|
|
163
176
|
reference={tooltipRef}
|
|
164
|
-
id="tooltip-tab-5"
|
|
165
177
|
/>
|
|
166
178
|
<div style={{ marginTop: '20px' }}>
|
|
167
179
|
<Checkbox
|
|
@@ -338,7 +350,12 @@ class ScrollButtonsPrimaryTabs extends React.Component {
|
|
|
338
350
|
const { activeTabKey, isBox } = this.state;
|
|
339
351
|
return (
|
|
340
352
|
<div>
|
|
341
|
-
<Tabs
|
|
353
|
+
<Tabs
|
|
354
|
+
activeKey={activeTabKey}
|
|
355
|
+
onSelect={this.handleTabClick}
|
|
356
|
+
isBox={isBox}
|
|
357
|
+
aria-label="Tabs in the default overflow example"
|
|
358
|
+
>
|
|
342
359
|
<Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
|
|
343
360
|
Users
|
|
344
361
|
</Tab>
|
|
@@ -424,7 +441,13 @@ class VerticalTabs extends React.Component {
|
|
|
424
441
|
|
|
425
442
|
return (
|
|
426
443
|
<div>
|
|
427
|
-
<Tabs
|
|
444
|
+
<Tabs
|
|
445
|
+
activeKey={activeTabKey}
|
|
446
|
+
onSelect={this.handleTabClick}
|
|
447
|
+
isVertical
|
|
448
|
+
isBox={isBox}
|
|
449
|
+
aria-label="Tabs in the vertical example"
|
|
450
|
+
>
|
|
428
451
|
<Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
|
|
429
452
|
Users
|
|
430
453
|
</Tab>
|
|
@@ -689,7 +712,13 @@ class PageInsetsTabs extends React.Component {
|
|
|
689
712
|
const { activeTabKey, isBox } = this.state;
|
|
690
713
|
return (
|
|
691
714
|
<div>
|
|
692
|
-
<Tabs
|
|
715
|
+
<Tabs
|
|
716
|
+
activeKey={activeTabKey}
|
|
717
|
+
onSelect={this.handleTabClick}
|
|
718
|
+
usePageInsets
|
|
719
|
+
isBox={isBox}
|
|
720
|
+
aria-label="Tabs in the page insets example"
|
|
721
|
+
>
|
|
693
722
|
<Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
|
|
694
723
|
Users
|
|
695
724
|
</Tab>
|
|
@@ -753,7 +782,11 @@ class IconAndTextTabs extends React.Component {
|
|
|
753
782
|
|
|
754
783
|
render() {
|
|
755
784
|
return (
|
|
756
|
-
<Tabs
|
|
785
|
+
<Tabs
|
|
786
|
+
activeKey={this.state.activeTabKey}
|
|
787
|
+
onSelect={this.handleTabClick}
|
|
788
|
+
aria-label="Tabs in the icons and text example"
|
|
789
|
+
>
|
|
757
790
|
<Tab
|
|
758
791
|
eventKey={0}
|
|
759
792
|
title={
|
|
@@ -876,9 +909,19 @@ class SecondaryTabs extends React.Component {
|
|
|
876
909
|
const { activeTabKey1, activeTabKey2, isBox } = this.state;
|
|
877
910
|
return (
|
|
878
911
|
<div>
|
|
879
|
-
<Tabs
|
|
912
|
+
<Tabs
|
|
913
|
+
activeKey={activeTabKey1}
|
|
914
|
+
onSelect={this.handleTabClickFirst}
|
|
915
|
+
isBox={isBox}
|
|
916
|
+
aria-label="Tabs in the tabs with subtabs example"
|
|
917
|
+
>
|
|
880
918
|
<Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
|
|
881
|
-
<Tabs
|
|
919
|
+
<Tabs
|
|
920
|
+
aria-label="secondary tabs for users"
|
|
921
|
+
activeKey={activeTabKey2}
|
|
922
|
+
isSecondary
|
|
923
|
+
onSelect={this.handleTabClickSecond}
|
|
924
|
+
>
|
|
882
925
|
<Tab eventKey={20} title={<TabTitleText>Secondary tab item 1</TabTitleText>}>
|
|
883
926
|
Secondary tab item 1 item section
|
|
884
927
|
</Tab>
|
|
@@ -983,7 +1026,13 @@ class FilledTabs extends React.Component {
|
|
|
983
1026
|
const { activeTabKey, isBox } = this.state;
|
|
984
1027
|
return (
|
|
985
1028
|
<div>
|
|
986
|
-
<Tabs
|
|
1029
|
+
<Tabs
|
|
1030
|
+
isFilled
|
|
1031
|
+
activeKey={activeTabKey}
|
|
1032
|
+
onSelect={this.handleTabClick}
|
|
1033
|
+
isBox={isBox}
|
|
1034
|
+
aria-label="Tabs in the filled example"
|
|
1035
|
+
>
|
|
987
1036
|
<Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
|
|
988
1037
|
Users
|
|
989
1038
|
</Tab>
|
|
@@ -1044,7 +1093,13 @@ class FilledTabsWithIcons extends React.Component {
|
|
|
1044
1093
|
const { activeTabKey, isBox } = this.state;
|
|
1045
1094
|
return (
|
|
1046
1095
|
<div>
|
|
1047
|
-
<Tabs
|
|
1096
|
+
<Tabs
|
|
1097
|
+
isFilled
|
|
1098
|
+
activeKey={activeTabKey}
|
|
1099
|
+
onSelect={this.handleTabClick}
|
|
1100
|
+
isBox={isBox}
|
|
1101
|
+
aria-label="Tabs in the filled with icons example"
|
|
1102
|
+
>
|
|
1048
1103
|
<Tab
|
|
1049
1104
|
eventKey={0}
|
|
1050
1105
|
title={
|
|
@@ -1270,7 +1325,11 @@ class SeparateTabContent extends React.Component {
|
|
|
1270
1325
|
render() {
|
|
1271
1326
|
return (
|
|
1272
1327
|
<React.Fragment>
|
|
1273
|
-
<Tabs
|
|
1328
|
+
<Tabs
|
|
1329
|
+
activeKey={this.state.activeTabKey}
|
|
1330
|
+
onSelect={this.handleTabClick}
|
|
1331
|
+
aria-label="Tabs in the seperate content example"
|
|
1332
|
+
>
|
|
1274
1333
|
<Tab
|
|
1275
1334
|
eventKey={0}
|
|
1276
1335
|
title={<TabTitleText>Tab item 1</TabTitleText>}
|
|
@@ -1291,13 +1350,30 @@ class SeparateTabContent extends React.Component {
|
|
|
1291
1350
|
/>
|
|
1292
1351
|
</Tabs>
|
|
1293
1352
|
<div>
|
|
1294
|
-
<TabContent
|
|
1353
|
+
<TabContent
|
|
1354
|
+
eventKey={0}
|
|
1355
|
+
id="refTab1Section"
|
|
1356
|
+
ref={this.contentRef1}
|
|
1357
|
+
aria-label="This is content for the first tab"
|
|
1358
|
+
>
|
|
1295
1359
|
Tab 1 section
|
|
1296
1360
|
</TabContent>
|
|
1297
|
-
<TabContent
|
|
1361
|
+
<TabContent
|
|
1362
|
+
eventKey={1}
|
|
1363
|
+
id="refTab2Section"
|
|
1364
|
+
ref={this.contentRef2}
|
|
1365
|
+
aria-label="This is content for the second tab"
|
|
1366
|
+
hidden
|
|
1367
|
+
>
|
|
1298
1368
|
Tab 2 section
|
|
1299
1369
|
</TabContent>
|
|
1300
|
-
<TabContent
|
|
1370
|
+
<TabContent
|
|
1371
|
+
eventKey={2}
|
|
1372
|
+
id="refTab3Section"
|
|
1373
|
+
ref={this.contentRef3}
|
|
1374
|
+
aria-label="This is content for the third tab"
|
|
1375
|
+
hidden
|
|
1376
|
+
>
|
|
1301
1377
|
Tab 3 section
|
|
1302
1378
|
</TabContent>
|
|
1303
1379
|
</div>
|
|
@@ -1351,10 +1427,22 @@ const TabContentWithBody = () => {
|
|
|
1351
1427
|
<TabContent eventKey={0} id="refTab1Section" ref={contentRef1} aria-label="This is content for the first tab">
|
|
1352
1428
|
<TabContentBody hasPadding> Tab 1 section </TabContentBody>
|
|
1353
1429
|
</TabContent>
|
|
1354
|
-
<TabContent
|
|
1430
|
+
<TabContent
|
|
1431
|
+
eventKey={1}
|
|
1432
|
+
id="refTab2Section"
|
|
1433
|
+
ref={contentRef2}
|
|
1434
|
+
aria-label="This is content for the second tab"
|
|
1435
|
+
hidden
|
|
1436
|
+
>
|
|
1355
1437
|
<TabContentBody hasPadding> Tab 2 section </TabContentBody>
|
|
1356
1438
|
</TabContent>
|
|
1357
|
-
<TabContent
|
|
1439
|
+
<TabContent
|
|
1440
|
+
eventKey={2}
|
|
1441
|
+
id="refTab3Section"
|
|
1442
|
+
ref={contentRef3}
|
|
1443
|
+
aria-label="This is content for the third tab"
|
|
1444
|
+
hidden
|
|
1445
|
+
>
|
|
1358
1446
|
<TabContentBody hasPadding> Tab 3 section </TabContentBody>
|
|
1359
1447
|
</TabContent>
|
|
1360
1448
|
</div>
|
|
@@ -1385,7 +1473,12 @@ class MountingSimpleTabs extends React.Component {
|
|
|
1385
1473
|
|
|
1386
1474
|
render() {
|
|
1387
1475
|
return (
|
|
1388
|
-
<Tabs
|
|
1476
|
+
<Tabs
|
|
1477
|
+
mountOnEnter
|
|
1478
|
+
activeKey={this.state.activeTabKey}
|
|
1479
|
+
onSelect={this.handleTabClick}
|
|
1480
|
+
aria-label="Tabs in the children mounting on click example"
|
|
1481
|
+
>
|
|
1389
1482
|
<Tab eventKey={0} title={<TabTitleText>Tab item 1</TabTitleText>}>
|
|
1390
1483
|
Tab 1 section
|
|
1391
1484
|
</Tab>
|
|
@@ -1423,7 +1516,12 @@ class UnmountingSimpleTabs extends React.Component {
|
|
|
1423
1516
|
|
|
1424
1517
|
render() {
|
|
1425
1518
|
return (
|
|
1426
|
-
<Tabs
|
|
1519
|
+
<Tabs
|
|
1520
|
+
unmountOnExit
|
|
1521
|
+
activeKey={this.state.activeTabKey}
|
|
1522
|
+
onSelect={this.handleTabClick}
|
|
1523
|
+
aria-label="Tabs in the unmounting invisible children example"
|
|
1524
|
+
>
|
|
1427
1525
|
<Tab eventKey={0} title={<TabTitleText>Tab item 1</TabTitleText>}>
|
|
1428
1526
|
Tab 1 section
|
|
1429
1527
|
</Tab>
|
|
@@ -1473,7 +1571,11 @@ class ToggledSeparateContent extends React.Component {
|
|
|
1473
1571
|
{isTab2Hidden ? 'Show' : 'Hide'} tab 2
|
|
1474
1572
|
</Button>
|
|
1475
1573
|
<Divider style={{ paddingTop: '1rem', paddingBottom: '1rem' }} />
|
|
1476
|
-
<Tabs
|
|
1574
|
+
<Tabs
|
|
1575
|
+
activeKey={this.state.activeTabKey}
|
|
1576
|
+
onSelect={this.handleTabClick}
|
|
1577
|
+
aria-label="Tabs in the toggled separate content example"
|
|
1578
|
+
>
|
|
1477
1579
|
<Tab eventKey={0} title="Tab item 1" tabContentId="refTab1Section" tabContentRef={this.contentRef1} />
|
|
1478
1580
|
{!isTab2Hidden && (
|
|
1479
1581
|
<Tab eventKey={1} title="Tab item 2" tabContentId="refTab2Section" tabContentRef={this.contentRef2} />
|
|
@@ -1481,15 +1583,32 @@ class ToggledSeparateContent extends React.Component {
|
|
|
1481
1583
|
<Tab eventKey={2} title="Tab item 3" tabContentId="refTab3Section" tabContentRef={this.contentRef3} />
|
|
1482
1584
|
</Tabs>
|
|
1483
1585
|
<div>
|
|
1484
|
-
<TabContent
|
|
1586
|
+
<TabContent
|
|
1587
|
+
eventKey={0}
|
|
1588
|
+
id="refTab1Section"
|
|
1589
|
+
ref={this.contentRef1}
|
|
1590
|
+
aria-label="This is content for the first tab"
|
|
1591
|
+
>
|
|
1485
1592
|
Tab 1 section
|
|
1486
1593
|
</TabContent>
|
|
1487
1594
|
{!isTab2Hidden && (
|
|
1488
|
-
<TabContent
|
|
1595
|
+
<TabContent
|
|
1596
|
+
eventKey={1}
|
|
1597
|
+
id="refTab2Section"
|
|
1598
|
+
ref={this.contentRef2}
|
|
1599
|
+
aria-label="This is content for the second tab"
|
|
1600
|
+
hidden
|
|
1601
|
+
>
|
|
1489
1602
|
Tab 2 section
|
|
1490
1603
|
</TabContent>
|
|
1491
1604
|
)}
|
|
1492
|
-
<TabContent
|
|
1605
|
+
<TabContent
|
|
1606
|
+
eventKey={2}
|
|
1607
|
+
id="refTab3Section"
|
|
1608
|
+
ref={this.contentRef3}
|
|
1609
|
+
aria-label="This is content for the third tab"
|
|
1610
|
+
hidden
|
|
1611
|
+
>
|
|
1493
1612
|
Tab 3 section
|
|
1494
1613
|
</TabContent>
|
|
1495
1614
|
</div>
|
|
@@ -35,6 +35,12 @@ export interface TooltipProps extends Omit<React.HTMLProps<HTMLDivElement>, 'con
|
|
|
35
35
|
* If you don't want that or prefer to add the aria attribute yourself on the trigger, set aria to 'none'.
|
|
36
36
|
*/
|
|
37
37
|
aria?: 'describedby' | 'labelledby' | 'none';
|
|
38
|
+
/**
|
|
39
|
+
* Determines whether the tooltip is an aria-live region. If the reference prop is passed in the
|
|
40
|
+
* default behavior is 'polite' in order to ensure the tooltip contents is announced to
|
|
41
|
+
* assistive technologies. Otherwise the default behavior is 'off'.
|
|
42
|
+
*/
|
|
43
|
+
'aria-live'?: 'off' | 'polite';
|
|
38
44
|
/**
|
|
39
45
|
* The reference element to which the Tooltip is relatively placed to.
|
|
40
46
|
* If you cannot wrap the reference with the Tooltip, you can use the reference prop instead.
|
|
@@ -155,6 +161,7 @@ export const Tooltip: React.FunctionComponent<TooltipProps> = ({
|
|
|
155
161
|
children,
|
|
156
162
|
animationDuration = 300,
|
|
157
163
|
reference,
|
|
164
|
+
'aria-live': ariaLive = reference ? 'polite' : 'off',
|
|
158
165
|
boundary,
|
|
159
166
|
isAppLauncher,
|
|
160
167
|
tippyProps,
|
|
@@ -251,6 +258,7 @@ export const Tooltip: React.FunctionComponent<TooltipProps> = ({
|
|
|
251
258
|
const hasCustomMaxWidth = maxWidth !== tooltipMaxWidth.value;
|
|
252
259
|
const content = (
|
|
253
260
|
<div
|
|
261
|
+
aria-live={ariaLive}
|
|
254
262
|
className={css(styles.tooltip, className)}
|
|
255
263
|
role="tooltip"
|
|
256
264
|
id={id}
|