@patternfly/react-core 5.1.1-prerelease.1 → 5.1.1-prerelease.10
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 +44 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/Chip/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/DragDrop/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/Text/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/Tile/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/ApplicationLauncher/package.json +1 -1
- package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
- package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
- package/dist/dynamic/deprecated/components/Select/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/favorites/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/next/components/package.json +1 -1
- package/dist/esm/components/BackToTop/BackToTop.js +1 -1
- package/dist/esm/components/BackToTop/BackToTop.js.map +1 -1
- package/dist/esm/components/Button/Button.d.ts +2 -2
- package/dist/esm/components/Button/Button.d.ts.map +1 -1
- package/dist/esm/components/Button/Button.js +3 -3
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/Drawer/DrawerPanelContent.d.ts +16 -0
- package/dist/esm/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
- package/dist/esm/components/Drawer/DrawerPanelContent.js +55 -15
- package/dist/esm/components/Drawer/DrawerPanelContent.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarContent.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarContent.js +8 -6
- package/dist/esm/components/Toolbar/ToolbarContent.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarExpandableContent.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarExpandableContent.js +3 -5
- package/dist/esm/components/Toolbar/ToolbarExpandableContent.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarFilter.d.ts +4 -0
- package/dist/esm/components/Toolbar/ToolbarFilter.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarFilter.js +8 -4
- package/dist/esm/components/Toolbar/ToolbarFilter.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.d.ts +14 -0
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.js +21 -20
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarUtils.d.ts +4 -0
- package/dist/esm/components/Toolbar/ToolbarUtils.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarUtils.js +2 -1
- package/dist/esm/components/Toolbar/ToolbarUtils.js.map +1 -1
- package/dist/esm/components/Toolbar/index.d.ts +1 -0
- package/dist/esm/components/Toolbar/index.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/index.js +1 -0
- package/dist/esm/components/Toolbar/index.js.map +1 -1
- package/dist/esm/deprecated/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/deprecated/components/Select/Select.js +43 -42
- package/dist/esm/deprecated/components/Select/Select.js.map +1 -1
- package/dist/js/components/BackToTop/BackToTop.js +1 -1
- package/dist/js/components/BackToTop/BackToTop.js.map +1 -1
- package/dist/js/components/Button/Button.d.ts +2 -2
- package/dist/js/components/Button/Button.d.ts.map +1 -1
- package/dist/js/components/Button/Button.js +3 -3
- package/dist/js/components/Button/Button.js.map +1 -1
- package/dist/js/components/Drawer/DrawerPanelContent.d.ts +16 -0
- package/dist/js/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
- package/dist/js/components/Drawer/DrawerPanelContent.js +55 -15
- package/dist/js/components/Drawer/DrawerPanelContent.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarContent.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarContent.js +8 -6
- package/dist/js/components/Toolbar/ToolbarContent.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarExpandableContent.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarExpandableContent.js +3 -5
- package/dist/js/components/Toolbar/ToolbarExpandableContent.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarFilter.d.ts +4 -0
- package/dist/js/components/Toolbar/ToolbarFilter.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarFilter.js +8 -4
- package/dist/js/components/Toolbar/ToolbarFilter.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarToggleGroup.d.ts +14 -0
- package/dist/js/components/Toolbar/ToolbarToggleGroup.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarToggleGroup.js +21 -20
- package/dist/js/components/Toolbar/ToolbarToggleGroup.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarUtils.d.ts +4 -0
- package/dist/js/components/Toolbar/ToolbarUtils.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarUtils.js +2 -1
- package/dist/js/components/Toolbar/ToolbarUtils.js.map +1 -1
- package/dist/js/components/Toolbar/index.d.ts +1 -0
- package/dist/js/components/Toolbar/index.d.ts.map +1 -1
- package/dist/js/components/Toolbar/index.js +1 -0
- package/dist/js/components/Toolbar/index.js.map +1 -1
- package/dist/js/deprecated/components/Select/Select.d.ts.map +1 -1
- package/dist/js/deprecated/components/Select/Select.js +43 -42
- package/dist/js/deprecated/components/Select/Select.js.map +1 -1
- package/dist/styles/base-no-reset.css +19 -0
- package/dist/styles/base.css +19 -0
- package/dist/umd/react-core.min.js +3 -3
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +6 -6
- package/src/components/Alert/__tests__/AlertGroup.test.tsx +77 -73
- package/src/components/BackToTop/BackToTop.tsx +1 -1
- package/src/components/BackToTop/__tests__/BackToTop.test.tsx +1 -1
- package/src/components/BackToTop/__tests__/__snapshots__/BackToTop.test.tsx.snap +1 -1
- package/src/components/Button/Button.tsx +5 -5
- package/src/components/Button/examples/ButtonVariations.tsx +1 -1
- package/src/components/Drawer/DrawerPanelContent.tsx +120 -55
- package/src/components/Drawer/__tests__/DrawerPanelContent.test.tsx +89 -0
- package/src/components/Drawer/examples/Drawer.md +31 -0
- package/src/components/Drawer/examples/DrawerFocusTrap.tsx +58 -0
- package/src/components/SearchInput/examples/SearchInputAdvanced.tsx +1 -1
- package/src/components/Tile/examples/Tile.md +14 -10
- package/src/components/Toolbar/ToolbarContent.tsx +7 -11
- package/src/components/Toolbar/ToolbarExpandableContent.tsx +7 -3
- package/src/components/Toolbar/ToolbarFilter.tsx +12 -2
- package/src/components/Toolbar/ToolbarToggleGroup.tsx +92 -47
- package/src/components/Toolbar/ToolbarUtils.tsx +6 -1
- package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarContent.test.tsx.snap +0 -8
- package/src/components/Toolbar/__tests__/Toolbar.test.tsx +3 -4
- package/src/components/Toolbar/__tests__/ToolbarToggleGroup.test.tsx +13 -10
- package/src/components/Toolbar/__tests__/__snapshots__/Toolbar.test.tsx.snap +0 -59
- package/src/components/Toolbar/examples/Test.tsx +258 -0
- package/src/components/Toolbar/examples/Toolbar.md +12 -6
- package/src/components/Toolbar/index.ts +1 -0
- package/src/demos/Card/Card.md +3 -664
- package/src/demos/Card/examples/CardView.tsx +575 -0
- package/src/demos/CardDemos.md +4 -4
- package/src/demos/NotificationDrawer/NotificationDrawer.md +2 -1435
- package/src/demos/NotificationDrawer/examples/NotificationDrawerBasic.tsx +557 -0
- package/src/demos/NotificationDrawer/examples/NotificationDrawerGrouped.tsx +796 -0
- package/src/demos/PrimaryDetail.md +2 -2
- package/src/deprecated/components/Select/Select.tsx +47 -45
- package/src/deprecated/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +9 -5
- package/src/components/Alert/__tests__/__snapshots__/AlertGroup.test.tsx.snap +0 -10
- /package/src/demos/Card/{CardData.jsx → examples/CardData.jsx} +0 -0
|
@@ -13,6 +13,7 @@ propComponents:
|
|
|
13
13
|
DrawerActions,
|
|
14
14
|
DrawerCloseButton,
|
|
15
15
|
DrawerColorVariant,
|
|
16
|
+
DrawerPanelFocusTrapObject
|
|
16
17
|
]
|
|
17
18
|
section: components
|
|
18
19
|
---
|
|
@@ -22,56 +23,67 @@ section: components
|
|
|
22
23
|
### Basic
|
|
23
24
|
|
|
24
25
|
```ts file="./DrawerBasic.tsx"
|
|
26
|
+
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
### Panel on right
|
|
28
30
|
|
|
29
31
|
```ts file="./DrawerPanelRight.tsx"
|
|
32
|
+
|
|
30
33
|
```
|
|
31
34
|
|
|
32
35
|
### Panel on left
|
|
33
36
|
|
|
34
37
|
```ts file="./DrawerPanelLeft.tsx"
|
|
38
|
+
|
|
35
39
|
```
|
|
36
40
|
|
|
37
41
|
### Panel on bottom
|
|
38
42
|
|
|
39
43
|
```ts file="./DrawerPanelBottom.tsx"
|
|
44
|
+
|
|
40
45
|
```
|
|
41
46
|
|
|
42
47
|
### Basic inline
|
|
43
48
|
|
|
44
49
|
```ts file="./DrawerBasicInline.tsx"
|
|
50
|
+
|
|
45
51
|
```
|
|
46
52
|
|
|
47
53
|
### Inline panel on right
|
|
48
54
|
|
|
49
55
|
```ts file="./DrawerInlinePanelRight.tsx"
|
|
56
|
+
|
|
50
57
|
```
|
|
51
58
|
|
|
52
59
|
### Inline panel on left
|
|
53
60
|
|
|
54
61
|
```ts file="./DrawerInlinePanelLeft.tsx"
|
|
62
|
+
|
|
55
63
|
```
|
|
56
64
|
|
|
57
65
|
### Stacked content body elements
|
|
58
66
|
|
|
59
67
|
```ts file="./DrawerStackedContentBodyElements.tsx"
|
|
68
|
+
|
|
60
69
|
```
|
|
61
70
|
|
|
62
71
|
### Modified content padding
|
|
63
72
|
|
|
64
73
|
```ts file="DrawerModifiedContentPadding.tsx"
|
|
74
|
+
|
|
65
75
|
```
|
|
66
76
|
|
|
67
77
|
### Modified panel padding
|
|
68
78
|
|
|
69
79
|
```ts file="DrawerModifiedPanelPadding.tsx"
|
|
80
|
+
|
|
70
81
|
```
|
|
71
82
|
|
|
72
83
|
### Additional section above drawer content
|
|
73
84
|
|
|
74
85
|
```ts file="DrawerAdditionalSectionAboveContent.tsx"
|
|
86
|
+
|
|
75
87
|
```
|
|
76
88
|
|
|
77
89
|
### Static drawer
|
|
@@ -79,34 +91,53 @@ section: components
|
|
|
79
91
|
**Note:** For mobile viewports, all drawer variants behave the same way. At the `md` breakpoint, or where `.pf-m-static{-on-[lg, xl, 2xl]}` is applied, the `static drawer` variant’s `close button` is automatically hidden because the drawer panel doesn’t close by design.
|
|
80
92
|
|
|
81
93
|
```ts file="DrawerStatic.tsx"
|
|
94
|
+
|
|
82
95
|
```
|
|
83
96
|
|
|
84
97
|
### Breakpoint
|
|
85
98
|
|
|
86
99
|
```ts file="DrawerBreakpoint.tsx"
|
|
100
|
+
|
|
87
101
|
```
|
|
88
102
|
|
|
89
103
|
### Resizable on right
|
|
90
104
|
|
|
91
105
|
```ts file="DrawerResizableOnRight.tsx"
|
|
106
|
+
|
|
92
107
|
```
|
|
93
108
|
|
|
94
109
|
### Resizable on left
|
|
95
110
|
|
|
96
111
|
```ts file="DrawerResizableOnLeft.tsx"
|
|
112
|
+
|
|
97
113
|
```
|
|
98
114
|
|
|
99
115
|
### Resizable on bottom
|
|
100
116
|
|
|
101
117
|
```ts file="DrawerResizableOnBottom.tsx"
|
|
118
|
+
|
|
102
119
|
```
|
|
103
120
|
|
|
104
121
|
### Resizable on inline
|
|
105
122
|
|
|
106
123
|
```ts file="DrawerResizableOnInline.tsx"
|
|
124
|
+
|
|
107
125
|
```
|
|
108
126
|
|
|
109
127
|
### Panel with secondary background
|
|
110
128
|
|
|
111
129
|
```ts file="DrawerSecondaryBackground.tsx"
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### With focus trap
|
|
134
|
+
|
|
135
|
+
When a [focus trap](/accessibility/product-development-guide#trapping-focus) is enabled on an element, a user will only be able to interact with the contents of that element until the focus trap is closed or deactivated.
|
|
136
|
+
|
|
137
|
+
To enable and customize a focus trap on a drawer panel, apply the `focusTrap` property to the `<DrawerPanelContent>` component. Enabling a focus trap with `focusTrap.enabled` will also automatically place focus on the first focusable element when the drawer panel expands, and return focus to the previously focused element when it collapses.
|
|
138
|
+
|
|
139
|
+
To customize which element receives focus when the drawer panel expands, use the `focusTrap.elementToFocusOnExpand` property.
|
|
140
|
+
|
|
141
|
+
```ts file="./DrawerFocusTrap.tsx"
|
|
142
|
+
|
|
112
143
|
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Drawer,
|
|
4
|
+
DrawerPanelContent,
|
|
5
|
+
DrawerContent,
|
|
6
|
+
DrawerContentBody,
|
|
7
|
+
DrawerHead,
|
|
8
|
+
DrawerActions,
|
|
9
|
+
DrawerCloseButton,
|
|
10
|
+
Button
|
|
11
|
+
} from '@patternfly/react-core';
|
|
12
|
+
|
|
13
|
+
export const DrawerFocusTrap: React.FunctionComponent = () => {
|
|
14
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
15
|
+
|
|
16
|
+
const onClick = () => {
|
|
17
|
+
setIsExpanded(!isExpanded);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const onCloseClick = () => {
|
|
21
|
+
setIsExpanded(false);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// An onKeyDown property must be passed to the Drawer component to handle closing
|
|
25
|
+
// the drawer panel and deactivating the focus trap via the Escape key.
|
|
26
|
+
const onEscape = (event: React.KeyboardEvent) => {
|
|
27
|
+
if (event.key === 'Escape') {
|
|
28
|
+
setIsExpanded(false);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const panelContent = (
|
|
33
|
+
<DrawerPanelContent focusTrap={{ enabled: true }}>
|
|
34
|
+
<DrawerHead>
|
|
35
|
+
<span>drawer-panel</span>
|
|
36
|
+
<DrawerActions>
|
|
37
|
+
<DrawerCloseButton onClick={onCloseClick} />
|
|
38
|
+
</DrawerActions>
|
|
39
|
+
</DrawerHead>
|
|
40
|
+
</DrawerPanelContent>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const drawerContent =
|
|
44
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pretium est a porttitor vehicula. Quisque vel commodo urna. Morbi mattis rutrum ante, id vehicula ex accumsan ut. Morbi viverra, eros vel porttitor facilisis, eros purus aliquet erat,nec lobortis felis elit pulvinar sem. Vivamus vulputate, risus eget commodo eleifend, eros nibh porta quam, vitae lacinia leo libero at magna. Maecenas aliquam sagittis orci, et posuere nisi ultrices sit amet. Aliquam ex odio, malesuada sed posuere quis, pellentesque at mauris. Phasellus venenatis massa ex, eget pulvinar libero auctor pretium. Aliquam erat volutpat. Duis euismod justo in quam ullamcorper, in commodo massa vulputate.';
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<React.Fragment>
|
|
48
|
+
<Button aria-expanded={isExpanded} onClick={onClick}>
|
|
49
|
+
Toggle drawer with focus trap
|
|
50
|
+
</Button>
|
|
51
|
+
<Drawer onKeyDown={onEscape} isExpanded={isExpanded}>
|
|
52
|
+
<DrawerContent panelContent={panelContent}>
|
|
53
|
+
<DrawerContentBody>{drawerContent}</DrawerContentBody>
|
|
54
|
+
</DrawerContent>
|
|
55
|
+
</Drawer>
|
|
56
|
+
</React.Fragment>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
@@ -44,7 +44,7 @@ export const SearchInputAdvanced: React.FunctionComponent = () => {
|
|
|
44
44
|
formAdditionalItems={
|
|
45
45
|
useCustomFooter ? (
|
|
46
46
|
<FormGroup>
|
|
47
|
-
<Button variant="link" isInline icon={<ExternalLinkSquareAltIcon />} iconPosition="
|
|
47
|
+
<Button variant="link" isInline icon={<ExternalLinkSquareAltIcon />} iconPosition="end">
|
|
48
48
|
Link
|
|
49
49
|
</Button>
|
|
50
50
|
</FormGroup>
|
|
@@ -12,32 +12,36 @@ import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
|
12
12
|
|
|
13
13
|
Keyboard interaction patterns and a11y is implemented in the Tile demos, located in the [Demo section](/components/tile/react-demos).
|
|
14
14
|
|
|
15
|
-
### Basic
|
|
16
|
-
|
|
15
|
+
### Basic tile
|
|
16
|
+
Basic tiles can appear in one of three states: a default state, selected state, and a disabled state. To change the state of a tile, use the properties `isSelected` and `isDisabled`.
|
|
17
17
|
```ts file="./TileBasic.tsx"
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
### With subtext
|
|
21
|
-
|
|
20
|
+
### With subtext
|
|
21
|
+
Tile subtext can provide users with additional context. To add subtext, pass a short description to the `<Tile>` component.
|
|
22
22
|
```ts file="./TileWithSubtext.tsx"
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### With icon
|
|
26
|
-
|
|
26
|
+
Icons can provide a visual cue that helps users understand what the tile is being used for. To add an icon, use the `icon` property.
|
|
27
27
|
```ts file="./TileWithIcon.tsx"
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
###
|
|
31
|
-
|
|
30
|
+
### With stacked icon
|
|
31
|
+
You can further customize a tile’s appearance by placing an icon above the title. To stack your icon on top of a tile’s title, use the `isStacked` property.
|
|
32
32
|
```ts file="./TileStacked.tsx"
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
###
|
|
35
|
+
### With large icons
|
|
36
|
+
You can make your icons larger to help catch a user’s attention. To increase the size of an icon, use the `isDisplayLarge` property.
|
|
36
37
|
|
|
38
|
+
Be aware that `isDisplayLarge` can only be used when `isStacked` is also applied.
|
|
37
39
|
```ts file="./TileStackedWithLargeIcons.tsx"
|
|
38
40
|
```
|
|
39
41
|
|
|
40
|
-
### With
|
|
42
|
+
### With long subtext
|
|
43
|
+
To provide users with a large amount of context, subtext can be elongated to wrap around to the next line. To format a long subtext, you can pass the component `Flex` into `<Tile>`.
|
|
41
44
|
|
|
45
|
+
You can also change the type of `Flex` you can use so that the line breaks in the subtext fits your needs. You can do this by changing the default flex. The standard is `default: “flex_1”`, and changing the number in the default will also change where the sentence breaks.
|
|
42
46
|
```ts file="./TileWithExtraContent.tsx"
|
|
43
|
-
```
|
|
47
|
+
```
|
|
@@ -3,7 +3,6 @@ import styles from '@patternfly/react-styles/css/components/Toolbar/toolbar';
|
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
import { ToolbarContentContext, ToolbarContext } from './ToolbarUtils';
|
|
5
5
|
import { formatBreakpointMods } from '../../helpers/util';
|
|
6
|
-
import { ToolbarExpandableContent } from './ToolbarExpandableContent';
|
|
7
6
|
import { PageContext } from '../Page/PageContext';
|
|
8
7
|
|
|
9
8
|
export interface ToolbarContentProps extends React.HTMLProps<HTMLDivElement> {
|
|
@@ -70,6 +69,7 @@ class ToolbarContent extends React.Component<ToolbarContentProps> {
|
|
|
70
69
|
formatBreakpointMods(visibility, styles, '', getBreakpoint(width)),
|
|
71
70
|
className
|
|
72
71
|
)}
|
|
72
|
+
ref={this.expandableContentRef}
|
|
73
73
|
{...props}
|
|
74
74
|
>
|
|
75
75
|
<ToolbarContext.Consumer>
|
|
@@ -77,6 +77,7 @@ class ToolbarContent extends React.Component<ToolbarContentProps> {
|
|
|
77
77
|
clearAllFilters: clearAllFiltersContext,
|
|
78
78
|
clearFiltersButtonText: clearFiltersButtonContext,
|
|
79
79
|
showClearFiltersButton: showClearFiltersButtonContext,
|
|
80
|
+
isExpanded: isExpandedContext,
|
|
80
81
|
toolbarId: toolbarIdContext
|
|
81
82
|
}) => {
|
|
82
83
|
const expandableContentId = `${
|
|
@@ -87,7 +88,11 @@ class ToolbarContent extends React.Component<ToolbarContentProps> {
|
|
|
87
88
|
value={{
|
|
88
89
|
expandableContentRef: this.expandableContentRef,
|
|
89
90
|
expandableContentId,
|
|
90
|
-
chipContainerRef: this.chipContainerRef
|
|
91
|
+
chipContainerRef: this.chipContainerRef,
|
|
92
|
+
isExpanded: isExpanded || isExpandedContext,
|
|
93
|
+
clearAllFilters: clearAllFilters || clearAllFiltersContext,
|
|
94
|
+
clearFiltersButtonText: clearFiltersButtonText || clearFiltersButtonContext,
|
|
95
|
+
showClearFiltersButton: showClearFiltersButton || showClearFiltersButtonContext
|
|
91
96
|
}}
|
|
92
97
|
>
|
|
93
98
|
<div
|
|
@@ -103,15 +108,6 @@ class ToolbarContent extends React.Component<ToolbarContentProps> {
|
|
|
103
108
|
>
|
|
104
109
|
{children}
|
|
105
110
|
</div>
|
|
106
|
-
<ToolbarExpandableContent
|
|
107
|
-
id={expandableContentId}
|
|
108
|
-
isExpanded={isExpanded}
|
|
109
|
-
expandableContentRef={this.expandableContentRef}
|
|
110
|
-
chipContainerRef={this.chipContainerRef}
|
|
111
|
-
clearAllFilters={clearAllFilters || clearAllFiltersContext}
|
|
112
|
-
showClearFiltersButton={showClearFiltersButton || showClearFiltersButtonContext}
|
|
113
|
-
clearFiltersButtonText={clearFiltersButtonText || clearFiltersButtonContext}
|
|
114
|
-
/>
|
|
115
111
|
</ToolbarContentContext.Provider>
|
|
116
112
|
);
|
|
117
113
|
}}
|
|
@@ -37,10 +37,10 @@ class ToolbarExpandableContent extends React.Component<ToolbarExpandableContentP
|
|
|
37
37
|
|
|
38
38
|
render() {
|
|
39
39
|
const {
|
|
40
|
+
children,
|
|
40
41
|
className,
|
|
41
42
|
expandableContentRef,
|
|
42
43
|
chipContainerRef,
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
44
|
isExpanded,
|
|
45
45
|
clearAllFilters,
|
|
46
46
|
clearFiltersButtonText,
|
|
@@ -54,8 +54,12 @@ class ToolbarExpandableContent extends React.Component<ToolbarExpandableContentP
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
|
-
<div
|
|
58
|
-
|
|
57
|
+
<div
|
|
58
|
+
className={css(styles.toolbarExpandableContent, isExpanded && styles.modifiers.expanded, className)}
|
|
59
|
+
ref={expandableContentRef}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
62
|
+
<ToolbarGroup>{children}</ToolbarGroup>
|
|
59
63
|
{numberOfFilters > 0 && (
|
|
60
64
|
<ToolbarGroup className={styles.modifiers.chipContainer}>
|
|
61
65
|
<ToolbarGroup ref={chipContainerRef} />
|
|
@@ -21,6 +21,8 @@ export interface ToolbarChip {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface ToolbarFilterProps extends ToolbarItemProps {
|
|
24
|
+
/** Flag indicating when toolbar toggle group is expanded for non-managed toolbar toggle groups. */
|
|
25
|
+
isExpanded?: boolean;
|
|
24
26
|
/** An array of strings to be displayed as chips in the expandable content */
|
|
25
27
|
chips?: (string | ToolbarChip)[];
|
|
26
28
|
/** Callback passed by consumer used to close the entire chip group */
|
|
@@ -37,6 +39,8 @@ export interface ToolbarFilterProps extends ToolbarItemProps {
|
|
|
37
39
|
categoryName: string | ToolbarChipGroup;
|
|
38
40
|
/** Flag to show the toolbar item */
|
|
39
41
|
showToolbarItem?: boolean;
|
|
42
|
+
/** Reference to a chip container created with a custom expandable content group, for non-managed multiple toolbar toggle groups. */
|
|
43
|
+
expandableChipContainerRef?: React.RefObject<HTMLDivElement>;
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
interface ToolbarFilterState {
|
|
@@ -90,9 +94,12 @@ class ToolbarFilter extends React.Component<ToolbarFilterProps, ToolbarFilterSta
|
|
|
90
94
|
chipGroupCollapsedText,
|
|
91
95
|
categoryName,
|
|
92
96
|
showToolbarItem,
|
|
97
|
+
isExpanded,
|
|
98
|
+
expandableChipContainerRef,
|
|
93
99
|
...props
|
|
94
100
|
} = this.props;
|
|
95
|
-
const { isExpanded, chipGroupContentRef } = this.context;
|
|
101
|
+
const { isExpanded: managedIsExpanded, chipGroupContentRef } = this.context;
|
|
102
|
+
const _isExpanded = isExpanded !== undefined ? isExpanded : managedIsExpanded;
|
|
96
103
|
const categoryKey =
|
|
97
104
|
typeof categoryName !== 'string' && categoryName.hasOwnProperty('key')
|
|
98
105
|
? categoryName.key
|
|
@@ -123,7 +130,7 @@ class ToolbarFilter extends React.Component<ToolbarFilterProps, ToolbarFilterSta
|
|
|
123
130
|
</ToolbarItem>
|
|
124
131
|
) : null;
|
|
125
132
|
|
|
126
|
-
if (!
|
|
133
|
+
if (!_isExpanded && this.state.isMounted) {
|
|
127
134
|
return (
|
|
128
135
|
<React.Fragment>
|
|
129
136
|
{showToolbarItem && <ToolbarItem {...props}>{children}</ToolbarItem>}
|
|
@@ -138,6 +145,9 @@ class ToolbarFilter extends React.Component<ToolbarFilterProps, ToolbarFilterSta
|
|
|
138
145
|
<React.Fragment>
|
|
139
146
|
{showToolbarItem && <ToolbarItem {...props}>{children}</ToolbarItem>}
|
|
140
147
|
{chipContainerRef.current && ReactDOM.createPortal(chipGroup, chipContainerRef.current)}
|
|
148
|
+
{expandableChipContainerRef &&
|
|
149
|
+
expandableChipContainerRef.current &&
|
|
150
|
+
ReactDOM.createPortal(chipGroup, expandableChipContainerRef.current)}
|
|
141
151
|
</React.Fragment>
|
|
142
152
|
)}
|
|
143
153
|
</ToolbarContentContext.Consumer>
|
|
@@ -8,8 +8,13 @@ import { Button } from '../Button';
|
|
|
8
8
|
import globalBreakpointLg from '@patternfly/react-tokens/dist/esm/global_breakpoint_lg';
|
|
9
9
|
import { formatBreakpointMods, toCamel, canUseDOM } from '../../helpers/util';
|
|
10
10
|
import { PageContext } from '../Page/PageContext';
|
|
11
|
+
import { ToolbarExpandableContent } from './ToolbarExpandableContent';
|
|
11
12
|
|
|
12
13
|
export interface ToolbarToggleGroupProps extends ToolbarGroupProps {
|
|
14
|
+
/** Flag indicating when toggle group is expanded for non-managed toolbar toggle groups. */
|
|
15
|
+
isExpanded?: boolean;
|
|
16
|
+
/** Callback for toggle group click event for non-managed toolbar toggle groups. */
|
|
17
|
+
onToggle?: (event: React.MouseEvent) => void;
|
|
13
18
|
/** An icon to be rendered when the toggle group has collapsed down */
|
|
14
19
|
toggleIcon: React.ReactNode;
|
|
15
20
|
/** Controls when filters are shown and when the toggle button is hidden. */
|
|
@@ -46,10 +51,21 @@ export interface ToolbarToggleGroupProps extends ToolbarGroupProps {
|
|
|
46
51
|
xl?: 'spaceItemsNone' | 'spaceItemsSm' | 'spaceItemsMd' | 'spaceItemsLg';
|
|
47
52
|
'2xl'?: 'spaceItemsNone' | 'spaceItemsSm' | 'spaceItemsMd' | 'spaceItemsLg';
|
|
48
53
|
};
|
|
54
|
+
/** Reference to a chip container group for filters inside the toolbar toggle group */
|
|
55
|
+
chipContainerRef?: React.RefObject<any>;
|
|
56
|
+
/** Optional callback for clearing all filters in the toolbar toggle group */
|
|
57
|
+
clearAllFilters?: () => void;
|
|
58
|
+
/** Flag indicating that the clear all filters button should be visible in the toolbar toggle group */
|
|
59
|
+
showClearFiltersButton?: boolean;
|
|
60
|
+
/** Text to display in the clear all filters button of the toolbar toggle group */
|
|
61
|
+
clearFiltersButtonText?: string;
|
|
49
62
|
}
|
|
50
63
|
|
|
51
64
|
class ToolbarToggleGroup extends React.Component<ToolbarToggleGroupProps> {
|
|
52
65
|
static displayName = 'ToolbarToggleGroup';
|
|
66
|
+
toggleRef = React.createRef<HTMLButtonElement>();
|
|
67
|
+
expandableContentRef = React.createRef<HTMLDivElement>();
|
|
68
|
+
|
|
53
69
|
isContentPopup = () => {
|
|
54
70
|
const viewportSize = canUseDOM ? window.innerWidth : 1200;
|
|
55
71
|
const lgBreakpointValue = parseInt(globalBreakpointLg.value);
|
|
@@ -67,6 +83,12 @@ class ToolbarToggleGroup extends React.Component<ToolbarToggleGroupProps> {
|
|
|
67
83
|
spaceItems,
|
|
68
84
|
className,
|
|
69
85
|
children,
|
|
86
|
+
isExpanded,
|
|
87
|
+
onToggle,
|
|
88
|
+
chipContainerRef,
|
|
89
|
+
clearAllFilters,
|
|
90
|
+
showClearFiltersButton,
|
|
91
|
+
clearFiltersButtonText,
|
|
70
92
|
...props
|
|
71
93
|
} = this.props;
|
|
72
94
|
|
|
@@ -79,64 +101,87 @@ class ToolbarToggleGroup extends React.Component<ToolbarToggleGroupProps> {
|
|
|
79
101
|
<PageContext.Consumer>
|
|
80
102
|
{({ width, getBreakpoint }) => (
|
|
81
103
|
<ToolbarContext.Consumer>
|
|
82
|
-
{({
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
104
|
+
{({ toggleIsExpanded: managedOnToggle }) => {
|
|
105
|
+
const _onToggle = onToggle !== undefined ? onToggle : managedOnToggle;
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<ToolbarContentContext.Consumer>
|
|
109
|
+
{({
|
|
110
|
+
expandableContentRef,
|
|
111
|
+
expandableContentId,
|
|
112
|
+
chipContainerRef: managedChipContainerRef,
|
|
113
|
+
isExpanded: managedIsExpanded,
|
|
114
|
+
clearAllFilters: clearAllFiltersContext,
|
|
115
|
+
clearFiltersButtonText: clearFiltersButtonContext,
|
|
116
|
+
showClearFiltersButton: showClearFiltersButtonContext
|
|
117
|
+
}) => {
|
|
118
|
+
const _isExpanded = isExpanded !== undefined ? isExpanded : managedIsExpanded;
|
|
119
|
+
const _chipContainerRef =
|
|
120
|
+
chipContainerRef !== undefined ? chipContainerRef : managedChipContainerRef;
|
|
121
|
+
|
|
122
|
+
const breakpointMod: {
|
|
123
|
+
md?: 'show';
|
|
124
|
+
lg?: 'show';
|
|
125
|
+
xl?: 'show';
|
|
126
|
+
'2xl'?: 'show';
|
|
127
|
+
} = {};
|
|
128
|
+
breakpointMod[breakpoint] = 'show';
|
|
92
129
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
130
|
+
const expandableContent = (
|
|
131
|
+
<ToolbarExpandableContent
|
|
132
|
+
id={expandableContentId}
|
|
133
|
+
expandableContentRef={this.expandableContentRef}
|
|
134
|
+
isExpanded={_isExpanded}
|
|
135
|
+
clearAllFilters={clearAllFilters || clearAllFiltersContext}
|
|
136
|
+
showClearFiltersButton={showClearFiltersButton || showClearFiltersButtonContext}
|
|
137
|
+
clearFiltersButtonText={clearFiltersButtonText || clearFiltersButtonContext}
|
|
138
|
+
chipContainerRef={_chipContainerRef}
|
|
139
|
+
>
|
|
140
|
+
{children}
|
|
141
|
+
</ToolbarExpandableContent>
|
|
142
|
+
);
|
|
100
143
|
|
|
101
|
-
|
|
102
|
-
<div
|
|
103
|
-
className={css(
|
|
104
|
-
styles.toolbarGroup,
|
|
105
|
-
styles.modifiers.toggleGroup,
|
|
106
|
-
variant &&
|
|
107
|
-
styles.modifiers[toCamel(variant) as 'filterGroup' | 'iconButtonGroup' | 'buttonGroup'],
|
|
108
|
-
formatBreakpointMods(breakpointMod, styles, '', getBreakpoint(width)),
|
|
109
|
-
formatBreakpointMods(visibility, styles, '', getBreakpoint(width)),
|
|
110
|
-
formatBreakpointMods(alignment, styles, '', getBreakpoint(width)),
|
|
111
|
-
formatBreakpointMods(spacer, styles, '', getBreakpoint(width)),
|
|
112
|
-
formatBreakpointMods(spaceItems, styles, '', getBreakpoint(width)),
|
|
113
|
-
className
|
|
114
|
-
)}
|
|
115
|
-
{...props}
|
|
116
|
-
>
|
|
144
|
+
const toggleButton = (
|
|
117
145
|
<div className={css(styles.toolbarToggle)}>
|
|
118
146
|
<Button
|
|
119
147
|
variant="plain"
|
|
120
|
-
onClick={
|
|
148
|
+
onClick={_onToggle}
|
|
121
149
|
aria-label="Show Filters"
|
|
122
|
-
{...(
|
|
123
|
-
aria-haspopup={
|
|
150
|
+
{...(_isExpanded && { 'aria-expanded': true })}
|
|
151
|
+
aria-haspopup={_isExpanded && this.isContentPopup()}
|
|
124
152
|
aria-controls={expandableContentId}
|
|
153
|
+
ref={this.toggleRef}
|
|
125
154
|
>
|
|
126
155
|
{toggleIcon}
|
|
127
156
|
</Button>
|
|
128
157
|
</div>
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
return (
|
|
161
|
+
<div
|
|
162
|
+
className={css(
|
|
163
|
+
styles.toolbarGroup,
|
|
164
|
+
styles.modifiers.toggleGroup,
|
|
165
|
+
variant &&
|
|
166
|
+
styles.modifiers[toCamel(variant) as 'filterGroup' | 'iconButtonGroup' | 'buttonGroup'],
|
|
167
|
+
formatBreakpointMods(breakpointMod, styles, '', getBreakpoint(width)),
|
|
168
|
+
formatBreakpointMods(visibility, styles, '', getBreakpoint(width)),
|
|
169
|
+
formatBreakpointMods(alignment, styles, '', getBreakpoint(width)),
|
|
170
|
+
formatBreakpointMods(spacer, styles, '', getBreakpoint(width)),
|
|
171
|
+
formatBreakpointMods(spaceItems, styles, '', getBreakpoint(width)),
|
|
172
|
+
className
|
|
173
|
+
)}
|
|
174
|
+
{...props}
|
|
175
|
+
>
|
|
176
|
+
{toggleButton}
|
|
177
|
+
{_isExpanded && ReactDOM.createPortal(expandableContent, expandableContentRef.current)}
|
|
178
|
+
{!_isExpanded && children}
|
|
179
|
+
</div>
|
|
180
|
+
);
|
|
181
|
+
}}
|
|
182
|
+
</ToolbarContentContext.Consumer>
|
|
183
|
+
);
|
|
184
|
+
}}
|
|
140
185
|
</ToolbarContext.Consumer>
|
|
141
186
|
)}
|
|
142
187
|
</PageContext.Consumer>
|
|
@@ -31,12 +31,17 @@ interface ToolbarContentContextProps {
|
|
|
31
31
|
expandableContentRef: RefObject<HTMLDivElement>;
|
|
32
32
|
expandableContentId: string;
|
|
33
33
|
chipContainerRef: RefObject<any>;
|
|
34
|
+
isExpanded?: boolean;
|
|
35
|
+
clearAllFilters?: () => void;
|
|
36
|
+
clearFiltersButtonText?: string;
|
|
37
|
+
showClearFiltersButton?: boolean;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
export const ToolbarContentContext = React.createContext<ToolbarContentContextProps>({
|
|
37
41
|
expandableContentRef: null,
|
|
38
42
|
expandableContentId: '',
|
|
39
|
-
chipContainerRef: null
|
|
43
|
+
chipContainerRef: null,
|
|
44
|
+
clearAllFilters: () => {}
|
|
40
45
|
});
|
|
41
46
|
|
|
42
47
|
export const globalBreakpoints = {
|
package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarContent.test.tsx.snap
CHANGED
|
@@ -12,14 +12,6 @@ exports[`ToolbarContent should match snapshot (auto-generated) 1`] = `
|
|
|
12
12
|
ReactNode
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
15
|
-
<div
|
|
16
|
-
class="pf-v5-c-toolbar__expandable-content"
|
|
17
|
-
id="string-expandable-content-0"
|
|
18
|
-
>
|
|
19
|
-
<div
|
|
20
|
-
class="pf-v5-c-toolbar__group"
|
|
21
|
-
/>
|
|
22
|
-
</div>
|
|
23
15
|
</div>
|
|
24
16
|
</DocumentFragment>
|
|
25
17
|
`;
|
|
@@ -65,7 +65,7 @@ describe('Toolbar', () => {
|
|
|
65
65
|
<ToolbarFilter
|
|
66
66
|
chips={['New', 'Pending']}
|
|
67
67
|
deleteChip={(category, chip) => {}}
|
|
68
|
-
deleteChipGroup={category => {}}
|
|
68
|
+
deleteChipGroup={(category) => {}}
|
|
69
69
|
categoryName="Status"
|
|
70
70
|
>
|
|
71
71
|
test content
|
|
@@ -102,8 +102,7 @@ describe('Toolbar', () => {
|
|
|
102
102
|
);
|
|
103
103
|
|
|
104
104
|
expect(asFragment()).toMatchSnapshot();
|
|
105
|
-
|
|
106
|
-
expect(screen.getAllByRole('button', { name: '
|
|
107
|
-
expect(screen.getAllByRole('button', { name: 'Clear all filters' }).length).toBe(2);
|
|
105
|
+
expect(screen.getAllByRole('button', { name: 'Save filters' }).length).toBe(1);
|
|
106
|
+
expect(screen.getAllByRole('button', { name: 'Clear all filters' }).length).toBe(1);
|
|
108
107
|
});
|
|
109
108
|
});
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import { ToolbarToggleGroup } from '../ToolbarToggleGroup';
|
|
4
|
-
import {
|
|
4
|
+
import { Toolbar } from '../Toolbar';
|
|
5
|
+
import { ToolbarContent } from '../ToolbarContent';
|
|
5
6
|
|
|
6
7
|
describe('ToolbarToggleGroup', () => {
|
|
7
8
|
it('should warn on bad props', () => {
|
|
8
9
|
const myMock = jest.fn() as any;
|
|
9
10
|
global.console = { error: myMock } as any;
|
|
10
11
|
|
|
12
|
+
const items = (
|
|
13
|
+
<React.Fragment>
|
|
14
|
+
<ToolbarToggleGroup breakpoint={undefined as 'xl'} toggleIcon={null}>
|
|
15
|
+
test
|
|
16
|
+
</ToolbarToggleGroup>
|
|
17
|
+
</React.Fragment>
|
|
18
|
+
);
|
|
19
|
+
|
|
11
20
|
render(
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
expandableContentRef: { current: undefined },
|
|
16
|
-
chipContainerRef: { current: undefined }
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
19
|
-
<ToolbarToggleGroup breakpoint={undefined as 'xl'} toggleIcon={null} />
|
|
20
|
-
</ToolbarContentContext.Provider>
|
|
21
|
+
<Toolbar id="toolbar-with-filter" className="pf-m-toggle-group-container" collapseListedFiltersBreakpoint="xl">
|
|
22
|
+
<ToolbarContent>{items}</ToolbarContent>
|
|
23
|
+
</Toolbar>
|
|
21
24
|
);
|
|
22
25
|
|
|
23
26
|
expect(myMock).toHaveBeenCalled();
|