@patternfly/react-core 4.198.12 → 4.198.15
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/Form/FormFieldGroup.d.ts +1 -1
- package/dist/esm/components/Form/FormFieldGroupExpandable.d.ts +2 -2
- package/dist/esm/components/Form/FormFieldGroupHeader.d.ts +3 -1
- package/dist/esm/components/Form/FormFieldGroupHeader.d.ts.map +1 -1
- package/dist/esm/components/Form/FormFieldGroupHeader.js.map +1 -1
- package/dist/esm/components/Form/InternalFormFieldGroup.d.ts +2 -2
- package/dist/esm/components/Label/Label.d.ts.map +1 -1
- package/dist/esm/components/Label/Label.js +5 -2
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/Menu/MenuItem.d.ts +3 -1
- package/dist/esm/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/esm/components/Menu/MenuItem.js +4 -3
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/Nav/NavGroup.d.ts +1 -1
- package/dist/esm/components/Nav/NavGroup.d.ts.map +1 -1
- package/dist/esm/components/Nav/NavGroup.js +7 -2
- package/dist/esm/components/Nav/NavGroup.js.map +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawer.d.ts +3 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawer.d.ts.map +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawer.js +4 -3
- package/dist/esm/components/NotificationDrawer/NotificationDrawer.js.map +1 -1
- package/dist/esm/components/Tabs/Tab.d.ts +3 -1
- package/dist/esm/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tab.js +4 -3
- package/dist/esm/components/Tabs/Tab.js.map +1 -1
- package/dist/esm/components/Tabs/TabButton.d.ts +2 -0
- package/dist/esm/components/Tabs/TabButton.d.ts.map +1 -1
- package/dist/esm/components/Tabs/TabButton.js +2 -2
- package/dist/esm/components/Tabs/TabButton.js.map +1 -1
- package/dist/esm/components/Tile/Tile.d.ts.map +1 -1
- package/dist/esm/components/Tile/Tile.js +1 -1
- package/dist/esm/components/Tile/Tile.js.map +1 -1
- package/dist/esm/components/Toolbar/Toolbar.d.ts +3 -1
- package/dist/esm/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/Toolbar.js +4 -3
- package/dist/esm/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarChipGroupContent.d.ts +2 -0
- package/dist/esm/components/Toolbar/ToolbarChipGroupContent.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarChipGroupContent.js +4 -3
- package/dist/esm/components/Toolbar/ToolbarChipGroupContent.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarExpandableContent.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarExpandableContent.js +4 -3
- package/dist/esm/components/Toolbar/ToolbarExpandableContent.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarUtils.d.ts +1 -0
- package/dist/esm/components/Toolbar/ToolbarUtils.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarUtils.js.map +1 -1
- package/dist/js/components/Form/FormFieldGroup.d.ts +1 -1
- package/dist/js/components/Form/FormFieldGroupExpandable.d.ts +2 -2
- package/dist/js/components/Form/FormFieldGroupHeader.d.ts +3 -1
- package/dist/js/components/Form/FormFieldGroupHeader.d.ts.map +1 -1
- package/dist/js/components/Form/FormFieldGroupHeader.js.map +1 -1
- package/dist/js/components/Form/InternalFormFieldGroup.d.ts +2 -2
- package/dist/js/components/Label/Label.d.ts.map +1 -1
- package/dist/js/components/Label/Label.js +5 -2
- package/dist/js/components/Label/Label.js.map +1 -1
- package/dist/js/components/Menu/MenuItem.d.ts +3 -1
- package/dist/js/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/js/components/Menu/MenuItem.js +4 -4
- package/dist/js/components/Menu/MenuItem.js.map +1 -1
- package/dist/js/components/Nav/NavGroup.d.ts +1 -1
- package/dist/js/components/Nav/NavGroup.d.ts.map +1 -1
- package/dist/js/components/Nav/NavGroup.js +7 -2
- package/dist/js/components/Nav/NavGroup.js.map +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawer.d.ts +3 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawer.d.ts.map +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawer.js +4 -4
- package/dist/js/components/NotificationDrawer/NotificationDrawer.js.map +1 -1
- package/dist/js/components/Tabs/Tab.d.ts +3 -1
- package/dist/js/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tab.js +4 -3
- package/dist/js/components/Tabs/Tab.js.map +1 -1
- package/dist/js/components/Tabs/TabButton.d.ts +2 -0
- package/dist/js/components/Tabs/TabButton.d.ts.map +1 -1
- package/dist/js/components/Tabs/TabButton.js +2 -2
- package/dist/js/components/Tabs/TabButton.js.map +1 -1
- package/dist/js/components/Tile/Tile.d.ts.map +1 -1
- package/dist/js/components/Tile/Tile.js +1 -1
- package/dist/js/components/Tile/Tile.js.map +1 -1
- package/dist/js/components/Toolbar/Toolbar.d.ts +3 -1
- package/dist/js/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/js/components/Toolbar/Toolbar.js +4 -3
- package/dist/js/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarChipGroupContent.d.ts +2 -0
- package/dist/js/components/Toolbar/ToolbarChipGroupContent.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarChipGroupContent.js +4 -3
- package/dist/js/components/Toolbar/ToolbarChipGroupContent.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarExpandableContent.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarExpandableContent.js +4 -3
- package/dist/js/components/Toolbar/ToolbarExpandableContent.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarUtils.d.ts +1 -0
- package/dist/js/components/Toolbar/ToolbarUtils.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarUtils.js.map +1 -1
- package/dist/umd/react-core.js +38 -25
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/Form/FormFieldGroup.tsx +1 -1
- package/src/components/Form/FormFieldGroupExpandable.tsx +2 -2
- package/src/components/Form/FormFieldGroupHeader.tsx +5 -1
- package/src/components/Form/InternalFormFieldGroup.tsx +2 -2
- package/src/components/Form/__tests__/FormFieldGroup.test.tsx +1 -1
- package/src/components/Form/__tests__/__snapshots__/FormFieldGroup.test.tsx.snap +1 -1
- package/src/components/Form/examples/Form.md +1 -1
- package/src/components/Label/Label.tsx +5 -2
- package/src/components/Menu/MenuItem.tsx +9 -1
- package/src/components/Menu/examples/Menu.md +57 -32
- package/src/components/Nav/NavGroup.tsx +20 -9
- package/src/components/Nav/examples/Nav.md +2 -0
- package/src/components/NotificationDrawer/NotificationDrawer.tsx +8 -2
- package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawer.test.tsx.snap +1 -1
- package/src/components/Tabs/Tab.tsx +31 -24
- package/src/components/Tabs/TabButton.tsx +5 -1
- package/src/components/Tabs/examples/Tabs.md +527 -256
- package/src/components/Tile/Tile.tsx +3 -0
- package/src/components/Tile/__tests__/__snapshots__/Tile.test.tsx.snap +9 -0
- package/src/components/Tile/examples/Tile.md +41 -39
- package/src/components/Toolbar/Toolbar.tsx +7 -2
- package/src/components/Toolbar/ToolbarChipGroupContent.tsx +5 -1
- package/src/components/Toolbar/ToolbarExpandableContent.tsx +3 -2
- package/src/components/Toolbar/ToolbarUtils.tsx +1 -0
- package/src/components/Toolbar/__tests__/ToolbarToggleGroup.test.tsx +71 -1
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarToggleGroup.test.tsx.snap +394 -0
- package/src/components/Toolbar/examples/Toolbar.md +8 -1
- package/src/components/Toolbar/examples/ToolbarCustomChipGroupContent.tsx +166 -0
- package/src/demos/Nav.md +7 -3
- package/src/demos/NotificationDrawer/NotificationDrawer.md +31 -4
- package/src/demos/Page/Page.md +7 -3
- package/src/demos/TileDemo.md +17 -35
- package/src/demos/examples/DashboardHeader.js +2 -1
|
@@ -8,6 +8,7 @@ import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
|
8
8
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
9
9
|
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
10
10
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
11
|
+
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
11
12
|
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
12
13
|
import imgBrand from '@patternfly/react-core/src/components/Brand/examples/pfLogo.svg';
|
|
13
14
|
import imgAvatar from '@patternfly/react-core/src/components/Avatar/examples/avatarImg.svg';
|
|
@@ -15,6 +16,11 @@ import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-
|
|
|
15
16
|
|
|
16
17
|
## Demos
|
|
17
18
|
|
|
19
|
+
- Focus must be manually managed when the NotificationDrawer component is opened:
|
|
20
|
+
|
|
21
|
+
1. Create a React `ref` and pass it into the NotificationDrawer component's `ref` attribute
|
|
22
|
+
2. Pass in a function to the `onNotificationDrawerExpand` prop of the Page component that will place focus on the first interact-able element inside the NotificationDrawer component via the previously created `ref`
|
|
23
|
+
|
|
18
24
|
### Basic
|
|
19
25
|
|
|
20
26
|
```js isFullscreen
|
|
@@ -77,6 +83,7 @@ import { css } from '@patternfly/react-styles';
|
|
|
77
83
|
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
78
84
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
79
85
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
86
|
+
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
80
87
|
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
81
88
|
import imgBrand from '@patternfly/react-core/src/components/Brand/examples/pfLogo.svg';
|
|
82
89
|
import imgAvatar from '@patternfly/react-core/src/components/Avatar/examples/avatarImg.svg';
|
|
@@ -85,6 +92,7 @@ import { Table, TableHeader, TableBody } from '@patternfly/react-table';
|
|
|
85
92
|
class BasicNotificationDrawer extends React.Component {
|
|
86
93
|
constructor(props) {
|
|
87
94
|
super(props);
|
|
95
|
+
this.drawerRef = React.createRef();
|
|
88
96
|
this.state = {
|
|
89
97
|
isDropdownOpen: false,
|
|
90
98
|
isKebabDropdownOpen: false,
|
|
@@ -177,6 +185,11 @@ class BasicNotificationDrawer extends React.Component {
|
|
|
177
185
|
showNotifications: showNotifications
|
|
178
186
|
});
|
|
179
187
|
};
|
|
188
|
+
|
|
189
|
+
this.focusDrawer = () => {
|
|
190
|
+
const firstTabbableItem = this.drawerRef.current.querySelector('a, button');
|
|
191
|
+
firstTabbableItem.focus();
|
|
192
|
+
};
|
|
180
193
|
}
|
|
181
194
|
|
|
182
195
|
render() {
|
|
@@ -257,7 +270,7 @@ class BasicNotificationDrawer extends React.Component {
|
|
|
257
270
|
</ToolbarItem>
|
|
258
271
|
<ToolbarItem>
|
|
259
272
|
<Button aria-label="Help actions" variant={ButtonVariant.plain}>
|
|
260
|
-
<
|
|
273
|
+
<QuestionCircleIcon />
|
|
261
274
|
</Button>
|
|
262
275
|
</ToolbarItem>
|
|
263
276
|
</ToolbarGroup>
|
|
@@ -357,7 +370,7 @@ class BasicNotificationDrawer extends React.Component {
|
|
|
357
370
|
];
|
|
358
371
|
|
|
359
372
|
const notificationDrawer = (
|
|
360
|
-
<NotificationDrawer>
|
|
373
|
+
<NotificationDrawer ref={this.drawerRef}>
|
|
361
374
|
<NotificationDrawerHeader count={this.getNumberUnread()} onClose={this.onCloseNotificationDrawer}>
|
|
362
375
|
<Dropdown
|
|
363
376
|
onSelect={this.onSelect}
|
|
@@ -497,6 +510,7 @@ class BasicNotificationDrawer extends React.Component {
|
|
|
497
510
|
sidebar={Sidebar}
|
|
498
511
|
isManagedSidebar
|
|
499
512
|
notificationDrawer={notificationDrawer}
|
|
513
|
+
onNotificationDrawerExpand={this.focusDrawer}
|
|
500
514
|
isNotificationDrawerExpanded={isDrawerExpanded}
|
|
501
515
|
skipToContent={PageSkipToContent}
|
|
502
516
|
breadcrumb={PageBreadcrumb}
|
|
@@ -523,6 +537,8 @@ class BasicNotificationDrawer extends React.Component {
|
|
|
523
537
|
|
|
524
538
|
### Grouped
|
|
525
539
|
|
|
540
|
+
When using the NotificationDrawerGroupList and related components, the function that is passed in to the `onNotificationDrawerExpand` prop on the Page component must also ensure the NotificationDrawer component only receives focus when it is initially opened. Otherwise any time a drawer group item is opened the NotificationDrawer component will receive focus, which would be unexpected behavior for users.
|
|
541
|
+
|
|
526
542
|
```js isFullscreen
|
|
527
543
|
import React from 'react';
|
|
528
544
|
import {
|
|
@@ -587,6 +603,7 @@ import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
|
587
603
|
import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon';
|
|
588
604
|
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
589
605
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
606
|
+
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
590
607
|
import imgBrand from '@patternfly/react-core/src/components/Brand/examples/pfLogo.svg';
|
|
591
608
|
import imgAvatar from '@patternfly/react-core/src/components/Avatar/examples/avatarImg.svg';
|
|
592
609
|
import { Table, TableHeader, TableBody } from '@patternfly/react-table';
|
|
@@ -594,6 +611,7 @@ import { Table, TableHeader, TableBody } from '@patternfly/react-table';
|
|
|
594
611
|
class GroupedNotificationDrawer extends React.Component {
|
|
595
612
|
constructor(props) {
|
|
596
613
|
super(props);
|
|
614
|
+
this.drawerRef = React.createRef();
|
|
597
615
|
this.state = {
|
|
598
616
|
isDropdownOpen: false,
|
|
599
617
|
isKebabDropdownOpen: false,
|
|
@@ -733,6 +751,14 @@ class GroupedNotificationDrawer extends React.Component {
|
|
|
733
751
|
thirdDrawerGroupExpanded: value
|
|
734
752
|
});
|
|
735
753
|
};
|
|
754
|
+
|
|
755
|
+
this.focusDrawer = () => {
|
|
756
|
+
// Prevent the NotificationDrawer from receiving focus if a drawer group item is opened
|
|
757
|
+
if (!document.activeElement.closest(`.${this.drawerRef.current.className}`)) {
|
|
758
|
+
const firstTabbableItem = this.drawerRef.current.querySelector('a, button');
|
|
759
|
+
firstTabbableItem.focus();
|
|
760
|
+
}
|
|
761
|
+
};
|
|
736
762
|
}
|
|
737
763
|
|
|
738
764
|
render() {
|
|
@@ -816,7 +842,7 @@ class GroupedNotificationDrawer extends React.Component {
|
|
|
816
842
|
</ToolbarItem>
|
|
817
843
|
<ToolbarItem>
|
|
818
844
|
<Button aria-label="Help actions" variant={ButtonVariant.plain}>
|
|
819
|
-
<
|
|
845
|
+
<QuestionCircleIcon />
|
|
820
846
|
</Button>
|
|
821
847
|
</ToolbarItem>
|
|
822
848
|
</ToolbarGroup>
|
|
@@ -916,7 +942,7 @@ class GroupedNotificationDrawer extends React.Component {
|
|
|
916
942
|
];
|
|
917
943
|
|
|
918
944
|
const notificationDrawer = (
|
|
919
|
-
<NotificationDrawer>
|
|
945
|
+
<NotificationDrawer ref={this.drawerRef}>
|
|
920
946
|
<NotificationDrawerHeader count={this.getNumberUnread()} onClose={this.onCloseNotificationDrawer}>
|
|
921
947
|
<Dropdown
|
|
922
948
|
onSelect={this.onSelect}
|
|
@@ -1211,6 +1237,7 @@ class GroupedNotificationDrawer extends React.Component {
|
|
|
1211
1237
|
isManagedSidebar
|
|
1212
1238
|
notificationDrawer={notificationDrawer}
|
|
1213
1239
|
isNotificationDrawerExpanded={isDrawerExpanded}
|
|
1240
|
+
onNotificationDrawerExpand={this.focusDrawer}
|
|
1214
1241
|
skipToContent={PageSkipToContent}
|
|
1215
1242
|
breadcrumb={PageBreadcrumb}
|
|
1216
1243
|
mainContainerId={pageId}
|
package/src/demos/Page/Page.md
CHANGED
|
@@ -7,6 +7,7 @@ import { css } from '@patternfly/react-styles';
|
|
|
7
7
|
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
8
8
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
9
9
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
10
|
+
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
10
11
|
import imgBrand from '@patternfly/react-core/src/demos/examples/pfColorLogo.svg';
|
|
11
12
|
import imgAvatar from '@patternfly/react-core/src/components/Avatar/examples/avatarImg.svg';
|
|
12
13
|
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
@@ -81,6 +82,7 @@ import { css } from '@patternfly/react-styles';
|
|
|
81
82
|
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
82
83
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
83
84
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
85
|
+
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
84
86
|
import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon';
|
|
85
87
|
import LightbulbIcon from '@patternfly/react-icons/dist/esm/icons/lightbulb-icon';
|
|
86
88
|
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
@@ -240,7 +242,7 @@ class PageLayoutGrouped extends React.Component {
|
|
|
240
242
|
</ToolbarItem>
|
|
241
243
|
<ToolbarItem>
|
|
242
244
|
<Button aria-label="Help actions" variant={ButtonVariant.plain}>
|
|
243
|
-
<
|
|
245
|
+
<QuestionCircleIcon />
|
|
244
246
|
</Button>
|
|
245
247
|
</ToolbarItem>
|
|
246
248
|
</ToolbarGroup>
|
|
@@ -420,6 +422,7 @@ import { css } from '@patternfly/react-styles';
|
|
|
420
422
|
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
421
423
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
422
424
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
425
|
+
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
423
426
|
import imgBrand from './imgBrand.svg';
|
|
424
427
|
import imgAvatar from './imgAvatar.svg';
|
|
425
428
|
|
|
@@ -518,7 +521,7 @@ class PageLayoutGrouped extends React.Component {
|
|
|
518
521
|
</PageHeaderToolsItem>
|
|
519
522
|
<PageHeaderToolsItem>
|
|
520
523
|
<Button aria-label="Help actions" variant={ButtonVariant.plain}>
|
|
521
|
-
<
|
|
524
|
+
<QuestionCircleIcon />
|
|
522
525
|
</Button>
|
|
523
526
|
</PageHeaderToolsItem>
|
|
524
527
|
</PageHeaderToolsGroup>
|
|
@@ -662,6 +665,7 @@ import { css } from '@patternfly/react-styles';
|
|
|
662
665
|
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
663
666
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
664
667
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
668
|
+
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
665
669
|
import imgBrand from './imgBrand.svg';
|
|
666
670
|
import imgAvatar from './imgAvatar.svg';
|
|
667
671
|
|
|
@@ -739,7 +743,7 @@ class PageLayoutGroupedAlt extends React.Component {
|
|
|
739
743
|
</PageHeaderToolsItem>
|
|
740
744
|
<PageHeaderToolsItem>
|
|
741
745
|
<Button aria-label="Help actions" variant={ButtonVariant.plain}>
|
|
742
|
-
<
|
|
746
|
+
<QuestionCircleIcon />
|
|
743
747
|
</Button>
|
|
744
748
|
</PageHeaderToolsItem>
|
|
745
749
|
</PageHeaderToolsGroup>
|
package/src/demos/TileDemo.md
CHANGED
|
@@ -13,11 +13,11 @@ import { Tile } from '@patternfly/react-core';
|
|
|
13
13
|
|
|
14
14
|
const TileSingleSelect: React.FunctionComponent = () => {
|
|
15
15
|
const [selectedId, setSelectedId] = React.useState<string>('');
|
|
16
|
-
|
|
17
|
-
const onSelect = (event: React.MouseEvent) => {
|
|
16
|
+
|
|
17
|
+
const onSelect = (event: React.MouseEvent) => {
|
|
18
18
|
setSelectedId(event.currentTarget.id);
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
const onKeyDown = (event: React.KeyboardEvent) => {
|
|
22
22
|
if (event.key === ' ' || event.key === 'Enter') {
|
|
23
23
|
event.preventDefault();
|
|
@@ -26,32 +26,14 @@ const TileSingleSelect: React.FunctionComponent = () => {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
<div>
|
|
30
|
-
<Tile
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
onKeyDown={onKeyDown}
|
|
35
|
-
isSelected={selectedId === 'tile-1'}
|
|
36
|
-
/>
|
|
37
|
-
<Tile
|
|
38
|
-
title="Tile 2"
|
|
39
|
-
id="tile-2"
|
|
40
|
-
onClick={onSelect}
|
|
41
|
-
onKeyDown={onKeyDown}
|
|
42
|
-
isSelected={selectedId === 'tile-2'}
|
|
43
|
-
/>
|
|
44
|
-
<Tile title="Tile 3" id="tile-3" isDisabled />
|
|
45
|
-
<Tile
|
|
46
|
-
title="Tile 4"
|
|
47
|
-
id="tile-4"
|
|
48
|
-
onClick={onSelect}
|
|
49
|
-
onKeyDown={onKeyDown}
|
|
50
|
-
isSelected={selectedId === 'tile-4'}
|
|
51
|
-
/>
|
|
29
|
+
<div role="listbox" aria-label="Single selection tiles">
|
|
30
|
+
<Tile title="Tile 1" id="tile-1" onClick={onSelect} onKeyDown={onKeyDown} isSelected={selectedId === 'tile-1'} />
|
|
31
|
+
<Tile title="Tile 2" id="tile-2" onClick={onSelect} onKeyDown={onKeyDown} isSelected={selectedId === 'tile-2'} />
|
|
32
|
+
<Tile title="Tile 3" id="tile-3" isDisabled isSelected={selectedId === 'tile-3'} />
|
|
33
|
+
<Tile title="Tile 4" id="tile-4" onClick={onSelect} onKeyDown={onKeyDown} isSelected={selectedId === 'tile-4'} />
|
|
52
34
|
</div>
|
|
53
35
|
);
|
|
54
|
-
}
|
|
36
|
+
};
|
|
55
37
|
```
|
|
56
38
|
|
|
57
39
|
### Tiles with multiple selection
|
|
@@ -62,18 +44,18 @@ import { Tile } from '@patternfly/react-core';
|
|
|
62
44
|
|
|
63
45
|
const TileMultiSelect: React.FunctionComponent = () => {
|
|
64
46
|
const [selectedIds, setSelectedIds] = React.useState<string[]>([]);
|
|
65
|
-
|
|
47
|
+
|
|
66
48
|
const onSelect = (event: React.MouseEvent | React.KeyboardEvent) => {
|
|
67
49
|
const targetId = event.currentTarget.id;
|
|
68
50
|
setSelectedIds(prevSelectedIds => {
|
|
69
|
-
const newSelectedIds = prevSelectedIds.includes(targetId)
|
|
70
|
-
prevSelectedIds.filter(id => id !== targetId)
|
|
71
|
-
[...prevSelectedIds, targetId]
|
|
51
|
+
const newSelectedIds = prevSelectedIds.includes(targetId)
|
|
52
|
+
? prevSelectedIds.filter(id => id !== targetId)
|
|
53
|
+
: [...prevSelectedIds, targetId];
|
|
72
54
|
console.log('tile selections: ', newSelectedIds);
|
|
73
55
|
return newSelectedIds;
|
|
74
56
|
});
|
|
75
57
|
};
|
|
76
|
-
|
|
58
|
+
|
|
77
59
|
const onKeyDown = (event: React.KeyboardEvent) => {
|
|
78
60
|
console.log(event.key);
|
|
79
61
|
if (event.key === ' ' || event.key === 'Enter') {
|
|
@@ -81,9 +63,9 @@ const TileMultiSelect: React.FunctionComponent = () => {
|
|
|
81
63
|
onSelect(event);
|
|
82
64
|
}
|
|
83
65
|
};
|
|
84
|
-
|
|
66
|
+
|
|
85
67
|
return (
|
|
86
|
-
<div>
|
|
68
|
+
<div role="listbox" aria-multiselectable={true} aria-label="Multiselectable tiles">
|
|
87
69
|
<Tile
|
|
88
70
|
title="Tile 1"
|
|
89
71
|
id="tile-1"
|
|
@@ -108,5 +90,5 @@ const TileMultiSelect: React.FunctionComponent = () => {
|
|
|
108
90
|
/>
|
|
109
91
|
</div>
|
|
110
92
|
);
|
|
111
|
-
}
|
|
93
|
+
};
|
|
112
94
|
```
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
25
25
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
26
26
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
27
|
+
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
27
28
|
import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon';
|
|
28
29
|
import imgBrand from './pfColorLogo.svg';
|
|
29
30
|
import imgAvatar from '@patternfly/react-core/src/components/Avatar/examples/avatarImg.svg';
|
|
@@ -134,7 +135,7 @@ export default class DashboardHeader extends React.Component {
|
|
|
134
135
|
</ToolbarItem>
|
|
135
136
|
<ToolbarItem>
|
|
136
137
|
<Button aria-label="Help actions" variant={ButtonVariant.plain}>
|
|
137
|
-
<
|
|
138
|
+
<QuestionCircleIcon />
|
|
138
139
|
</Button>
|
|
139
140
|
</ToolbarItem>
|
|
140
141
|
</ToolbarGroup>
|