@patternfly/react-core 4.192.3 → 4.192.7
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 +35 -0
- package/dist/esm/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/esm/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js +7 -3
- package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/Masthead/Masthead.d.ts.map +1 -1
- package/dist/esm/components/Masthead/Masthead.js +6 -2
- package/dist/esm/components/Masthead/Masthead.js.map +1 -1
- package/dist/esm/components/Menu/MenuContent.js +1 -1
- package/dist/esm/components/Menu/MenuContent.js.map +1 -1
- package/dist/esm/components/Nav/Nav.d.ts +4 -2
- package/dist/esm/components/Nav/Nav.d.ts.map +1 -1
- package/dist/esm/components/Nav/Nav.js +2 -1
- package/dist/esm/components/Nav/Nav.js.map +1 -1
- package/dist/esm/components/Nav/NavList.d.ts +2 -8
- package/dist/esm/components/Nav/NavList.d.ts.map +1 -1
- package/dist/esm/components/Nav/NavList.js +4 -7
- package/dist/esm/components/Nav/NavList.js.map +1 -1
- package/dist/esm/components/Page/Page.d.ts +14 -0
- package/dist/esm/components/Page/Page.d.ts.map +1 -1
- package/dist/esm/components/Page/Page.js +31 -16
- package/dist/esm/components/Page/Page.js.map +1 -1
- package/dist/esm/components/Page/PageHeaderToolsGroup.d.ts.map +1 -1
- package/dist/esm/components/Page/PageHeaderToolsGroup.js +3 -1
- package/dist/esm/components/Page/PageHeaderToolsGroup.js.map +1 -1
- package/dist/esm/components/Page/PageHeaderToolsItem.d.ts.map +1 -1
- package/dist/esm/components/Page/PageHeaderToolsItem.js +7 -1
- package/dist/esm/components/Page/PageHeaderToolsItem.js.map +1 -1
- package/dist/esm/components/Page/PageSidebar.d.ts +1 -0
- package/dist/esm/components/Page/PageSidebar.d.ts.map +1 -1
- package/dist/esm/components/Page/PageSidebar.js +3 -2
- package/dist/esm/components/Page/PageSidebar.js.map +1 -1
- package/dist/esm/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/Toolbar.js +3 -2
- package/dist/esm/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarContent.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarContent.js +3 -2
- package/dist/esm/components/Toolbar/ToolbarContent.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarGroup.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarGroup.js +2 -1
- package/dist/esm/components/Toolbar/ToolbarGroup.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarItem.js +3 -2
- package/dist/esm/components/Toolbar/ToolbarItem.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.js +8 -5
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.js.map +1 -1
- package/dist/esm/helpers/util.d.ts +16 -8
- package/dist/esm/helpers/util.d.ts.map +1 -1
- package/dist/esm/helpers/util.js +53 -7
- package/dist/esm/helpers/util.js.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/js/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.js +7 -3
- package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/js/components/Masthead/Masthead.d.ts.map +1 -1
- package/dist/js/components/Masthead/Masthead.js +6 -2
- package/dist/js/components/Masthead/Masthead.js.map +1 -1
- package/dist/js/components/Menu/MenuContent.js +1 -1
- package/dist/js/components/Menu/MenuContent.js.map +1 -1
- package/dist/js/components/Nav/Nav.d.ts +4 -2
- package/dist/js/components/Nav/Nav.d.ts.map +1 -1
- package/dist/js/components/Nav/Nav.js +3 -2
- package/dist/js/components/Nav/Nav.js.map +1 -1
- package/dist/js/components/Nav/NavList.d.ts +2 -8
- package/dist/js/components/Nav/NavList.d.ts.map +1 -1
- package/dist/js/components/Nav/NavList.js +4 -7
- package/dist/js/components/Nav/NavList.js.map +1 -1
- package/dist/js/components/Page/Page.d.ts +14 -0
- package/dist/js/components/Page/Page.d.ts.map +1 -1
- package/dist/js/components/Page/Page.js +34 -19
- package/dist/js/components/Page/Page.js.map +1 -1
- package/dist/js/components/Page/PageHeaderToolsGroup.d.ts.map +1 -1
- package/dist/js/components/Page/PageHeaderToolsGroup.js +3 -1
- package/dist/js/components/Page/PageHeaderToolsGroup.js.map +1 -1
- package/dist/js/components/Page/PageHeaderToolsItem.d.ts.map +1 -1
- package/dist/js/components/Page/PageHeaderToolsItem.js +6 -1
- package/dist/js/components/Page/PageHeaderToolsItem.js.map +1 -1
- package/dist/js/components/Page/PageSidebar.d.ts +1 -0
- package/dist/js/components/Page/PageSidebar.d.ts.map +1 -1
- package/dist/js/components/Page/PageSidebar.js +4 -3
- package/dist/js/components/Page/PageSidebar.js.map +1 -1
- package/dist/js/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/js/components/Toolbar/Toolbar.js +3 -2
- package/dist/js/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarContent.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarContent.js +3 -2
- package/dist/js/components/Toolbar/ToolbarContent.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarGroup.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarGroup.js +2 -1
- package/dist/js/components/Toolbar/ToolbarGroup.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarItem.js +3 -2
- package/dist/js/components/Toolbar/ToolbarItem.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarToggleGroup.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarToggleGroup.js +7 -4
- package/dist/js/components/Toolbar/ToolbarToggleGroup.js.map +1 -1
- package/dist/js/helpers/util.d.ts +16 -8
- package/dist/js/helpers/util.d.ts.map +1 -1
- package/dist/js/helpers/util.js +55 -8
- package/dist/js/helpers/util.js.map +1 -1
- package/dist/umd/react-core.js +428 -351
- package/dist/umd/react-core.min.js +3 -3
- package/package.json +5 -5
- package/src/components/BackToTop/examples/BackToTop.md +0 -1
- package/src/components/DatePicker/DatePicker.tsx +10 -2
- package/src/components/DatePicker/examples/DatePicker.md +4 -1
- package/src/components/JumpLinks/examples/JumpLinks.md +0 -1
- package/src/components/Masthead/Masthead.tsx +23 -16
- package/src/components/Masthead/__tests__/__snapshots__/Masthead.test.tsx.snap +11 -11
- package/src/components/Menu/MenuContent.tsx +2 -2
- package/src/components/Menu/examples/Menu.md +7 -7
- package/src/components/Nav/Nav.tsx +4 -2
- package/src/components/Nav/NavList.tsx +4 -7
- package/src/components/Page/Page.tsx +49 -16
- package/src/components/Page/PageHeaderToolsGroup.tsx +16 -5
- package/src/components/Page/PageHeaderToolsItem.tsx +20 -14
- package/src/components/Page/PageSidebar.tsx +3 -3
- package/src/components/Page/__tests__/Generated/__snapshots__/Page.test.tsx.snap +2 -0
- package/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap +18 -9
- package/src/components/Toolbar/Toolbar.tsx +44 -39
- package/src/components/Toolbar/ToolbarContent.tsx +45 -40
- package/src/components/Toolbar/ToolbarGroup.tsx +19 -14
- package/src/components/Toolbar/ToolbarItem.tsx +30 -19
- package/src/components/Toolbar/ToolbarToggleGroup.tsx +60 -53
- package/src/components/Toolbar/__tests__/Generated/__snapshots__/Toolbar.test.tsx.snap +3 -43
- package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarContent.test.tsx.snap +3 -7
- package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarItem.test.tsx.snap +3 -8
- package/src/demos/ComposableMenu/ComposableMenu.md +88 -0
- package/src/demos/ComposableMenu/examples/ComposableActionsMenu.tsx +122 -0
- package/src/demos/ComposableMenu/examples/ComposableApplicationLauncher.tsx +282 -0
- package/src/demos/ComposableMenu/examples/ComposableContextSelector.tsx +202 -0
- package/src/demos/ComposableMenu/examples/ComposableDrilldownMenu.tsx +246 -0
- package/src/demos/ComposableMenu/examples/ComposableDropdwnVariants.tsx +235 -0
- package/src/demos/ComposableMenu/examples/ComposableFlyout.tsx +103 -0
- package/src/demos/ComposableMenu/examples/ComposableOptionsMenuVariants.tsx +94 -0
- package/src/demos/ComposableMenu/examples/ComposableSimpleDropdown.tsx +70 -0
- package/src/demos/ComposableMenu/examples/ComposableSimpleSelect.tsx +74 -0
- package/src/demos/ComposableMenu/examples/ComposableTreeViewMenu.tsx +240 -0
- package/src/demos/ComposableMenu/examples/avatarImg.svg +18 -0
- package/src/demos/ComposableMenu/examples/pf-logo-small.svg +23 -0
- package/src/demos/JumpLinks.md +0 -1
- package/src/demos/Page/Page.md +92 -43
- package/src/helpers/util.ts +61 -12
- package/src/demos/ComposableMenu.md +0 -1443
- package/src/demos/composable-menu.css +0 -3
|
@@ -5,6 +5,7 @@ exports[`Check dark page against snapshot 1`] = `
|
|
|
5
5
|
aria-label="Page layout"
|
|
6
6
|
className="my-page-class"
|
|
7
7
|
defaultManagedSidebarIsOpen={true}
|
|
8
|
+
getBreakpoint={[Function]}
|
|
8
9
|
header={
|
|
9
10
|
<PageHeader
|
|
10
11
|
headerTools="PageHeaderTools | Avatar"
|
|
@@ -29,7 +30,7 @@ exports[`Check dark page against snapshot 1`] = `
|
|
|
29
30
|
>
|
|
30
31
|
<div
|
|
31
32
|
aria-label="Page layout"
|
|
32
|
-
className="pf-c-page my-page-class"
|
|
33
|
+
className="pf-c-page pf-m-resize-observer pf-m-breakpoint-default my-page-class"
|
|
33
34
|
id="PageId"
|
|
34
35
|
>
|
|
35
36
|
<PageHeader
|
|
@@ -119,6 +120,7 @@ exports[`Check page horizontal layout example against snapshot 1`] = `
|
|
|
119
120
|
aria-label="Page layout"
|
|
120
121
|
className="my-page-class"
|
|
121
122
|
defaultManagedSidebarIsOpen={true}
|
|
123
|
+
getBreakpoint={[Function]}
|
|
122
124
|
header={
|
|
123
125
|
<PageHeader
|
|
124
126
|
headerTools="PageHeaderTools | Avatar"
|
|
@@ -141,7 +143,7 @@ exports[`Check page horizontal layout example against snapshot 1`] = `
|
|
|
141
143
|
>
|
|
142
144
|
<div
|
|
143
145
|
aria-label="Page layout"
|
|
144
|
-
className="pf-c-page my-page-class"
|
|
146
|
+
className="pf-c-page pf-m-resize-observer pf-m-breakpoint-default my-page-class"
|
|
145
147
|
id="PageId"
|
|
146
148
|
>
|
|
147
149
|
<PageHeader
|
|
@@ -232,6 +234,7 @@ exports[`Check page to verify breadcrumb is created - PageBreadcrumb syntax 1`]
|
|
|
232
234
|
aria-label="Page layout"
|
|
233
235
|
className="my-page-class"
|
|
234
236
|
defaultManagedSidebarIsOpen={true}
|
|
237
|
+
getBreakpoint={[Function]}
|
|
235
238
|
header={
|
|
236
239
|
<PageHeader
|
|
237
240
|
headerTools="PageHeaderTools | Avatar"
|
|
@@ -254,7 +257,7 @@ exports[`Check page to verify breadcrumb is created - PageBreadcrumb syntax 1`]
|
|
|
254
257
|
>
|
|
255
258
|
<div
|
|
256
259
|
aria-label="Page layout"
|
|
257
|
-
className="pf-c-page my-page-class"
|
|
260
|
+
className="pf-c-page pf-m-resize-observer pf-m-breakpoint-default my-page-class"
|
|
258
261
|
id="PageId"
|
|
259
262
|
>
|
|
260
263
|
<PageHeader
|
|
@@ -510,6 +513,7 @@ exports[`Check page to verify breadcrumb is created 1`] = `
|
|
|
510
513
|
breadcrumb={<PageBreadcrumb />}
|
|
511
514
|
className="my-page-class"
|
|
512
515
|
defaultManagedSidebarIsOpen={true}
|
|
516
|
+
getBreakpoint={[Function]}
|
|
513
517
|
header={
|
|
514
518
|
<PageHeader
|
|
515
519
|
headerTools="PageHeaderTools | Avatar"
|
|
@@ -532,7 +536,7 @@ exports[`Check page to verify breadcrumb is created 1`] = `
|
|
|
532
536
|
>
|
|
533
537
|
<div
|
|
534
538
|
aria-label="Page layout"
|
|
535
|
-
className="pf-c-page my-page-class"
|
|
539
|
+
className="pf-c-page pf-m-resize-observer pf-m-breakpoint-default my-page-class"
|
|
536
540
|
id="PageId"
|
|
537
541
|
>
|
|
538
542
|
<PageHeader
|
|
@@ -787,6 +791,7 @@ exports[`Check page to verify grouped nav and breadcrumb - new components syntax
|
|
|
787
791
|
aria-label="Page layout"
|
|
788
792
|
className="my-page-class"
|
|
789
793
|
defaultManagedSidebarIsOpen={true}
|
|
794
|
+
getBreakpoint={[Function]}
|
|
790
795
|
header={
|
|
791
796
|
<PageHeader
|
|
792
797
|
headerTools="PageHeaderTools | Avatar"
|
|
@@ -809,7 +814,7 @@ exports[`Check page to verify grouped nav and breadcrumb - new components syntax
|
|
|
809
814
|
>
|
|
810
815
|
<div
|
|
811
816
|
aria-label="Page layout"
|
|
812
|
-
className="pf-c-page my-page-class"
|
|
817
|
+
className="pf-c-page pf-m-resize-observer pf-m-breakpoint-default my-page-class"
|
|
813
818
|
id="PageId"
|
|
814
819
|
>
|
|
815
820
|
<PageHeader
|
|
@@ -1295,6 +1300,7 @@ exports[`Check page to verify grouped nav and breadcrumb - old / props syntax 1`
|
|
|
1295
1300
|
}
|
|
1296
1301
|
className="my-page-class"
|
|
1297
1302
|
defaultManagedSidebarIsOpen={true}
|
|
1303
|
+
getBreakpoint={[Function]}
|
|
1298
1304
|
groupProps={
|
|
1299
1305
|
Object {
|
|
1300
1306
|
"hasShadowTop": true,
|
|
@@ -1367,7 +1373,7 @@ exports[`Check page to verify grouped nav and breadcrumb - old / props syntax 1`
|
|
|
1367
1373
|
>
|
|
1368
1374
|
<div
|
|
1369
1375
|
aria-label="Page layout"
|
|
1370
|
-
className="pf-c-page my-page-class"
|
|
1376
|
+
className="pf-c-page pf-m-resize-observer pf-m-breakpoint-default my-page-class"
|
|
1371
1377
|
id="PageId"
|
|
1372
1378
|
>
|
|
1373
1379
|
<PageHeader
|
|
@@ -1831,6 +1837,7 @@ exports[`Check page to verify nav is created - PageNavigation syntax 1`] = `
|
|
|
1831
1837
|
aria-label="Page layout"
|
|
1832
1838
|
className="my-page-class"
|
|
1833
1839
|
defaultManagedSidebarIsOpen={true}
|
|
1840
|
+
getBreakpoint={[Function]}
|
|
1834
1841
|
header={
|
|
1835
1842
|
<PageHeader
|
|
1836
1843
|
headerTools="PageHeaderTools | Avatar"
|
|
@@ -1853,7 +1860,7 @@ exports[`Check page to verify nav is created - PageNavigation syntax 1`] = `
|
|
|
1853
1860
|
>
|
|
1854
1861
|
<div
|
|
1855
1862
|
aria-label="Page layout"
|
|
1856
|
-
className="pf-c-page my-page-class"
|
|
1863
|
+
className="pf-c-page pf-m-resize-observer pf-m-breakpoint-default my-page-class"
|
|
1857
1864
|
id="PageId"
|
|
1858
1865
|
>
|
|
1859
1866
|
<PageHeader
|
|
@@ -2165,6 +2172,7 @@ exports[`Check page to verify skip to content points to main content region 1`]
|
|
|
2165
2172
|
}
|
|
2166
2173
|
className="my-page-class"
|
|
2167
2174
|
defaultManagedSidebarIsOpen={true}
|
|
2175
|
+
getBreakpoint={[Function]}
|
|
2168
2176
|
header={
|
|
2169
2177
|
<PageHeader
|
|
2170
2178
|
headerTools="PageHeaderTools | Avatar"
|
|
@@ -2196,7 +2204,7 @@ exports[`Check page to verify skip to content points to main content region 1`]
|
|
|
2196
2204
|
>
|
|
2197
2205
|
<div
|
|
2198
2206
|
aria-label="Page layout"
|
|
2199
|
-
className="pf-c-page my-page-class"
|
|
2207
|
+
className="pf-c-page pf-m-resize-observer pf-m-breakpoint-default my-page-class"
|
|
2200
2208
|
id="PageId"
|
|
2201
2209
|
>
|
|
2202
2210
|
<SkipToContent
|
|
@@ -2461,6 +2469,7 @@ exports[`Check page vertical layout example against snapshot 1`] = `
|
|
|
2461
2469
|
aria-label="Page layout"
|
|
2462
2470
|
className="my-page-class"
|
|
2463
2471
|
defaultManagedSidebarIsOpen={true}
|
|
2472
|
+
getBreakpoint={[Function]}
|
|
2464
2473
|
header={
|
|
2465
2474
|
<PageHeader
|
|
2466
2475
|
headerTools="PageHeaderTools | Avatar"
|
|
@@ -2484,7 +2493,7 @@ exports[`Check page vertical layout example against snapshot 1`] = `
|
|
|
2484
2493
|
>
|
|
2485
2494
|
<div
|
|
2486
2495
|
aria-label="Page layout"
|
|
2487
|
-
className="pf-c-page my-page-class"
|
|
2496
|
+
className="pf-c-page pf-m-resize-observer pf-m-breakpoint-default my-page-class"
|
|
2488
2497
|
id="PageId"
|
|
2489
2498
|
>
|
|
2490
2499
|
<PageHeader
|
|
@@ -6,6 +6,7 @@ import { ToolbarContext } from './ToolbarUtils';
|
|
|
6
6
|
import { ToolbarChipGroupContent } from './ToolbarChipGroupContent';
|
|
7
7
|
import { formatBreakpointMods, canUseDOM } from '../../helpers/util';
|
|
8
8
|
import { getDefaultOUIAId, getOUIAProps, OUIAProps } from '../../helpers';
|
|
9
|
+
import { PageContext } from '../Page/Page';
|
|
9
10
|
|
|
10
11
|
export interface ToolbarProps extends React.HTMLProps<HTMLDivElement>, OUIAProps {
|
|
11
12
|
/** Optional callback for clearing all filters in the toolbar */
|
|
@@ -139,46 +140,50 @@ export class Toolbar extends React.Component<ToolbarProps, ToolbarState> {
|
|
|
139
140
|
const showClearFiltersButton = numberOfFilters > 0;
|
|
140
141
|
|
|
141
142
|
return (
|
|
142
|
-
<
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
<PageContext.Consumer>
|
|
144
|
+
{({ width, getBreakpoint }) => (
|
|
145
|
+
<div
|
|
146
|
+
className={css(
|
|
147
|
+
styles.toolbar,
|
|
148
|
+
isFullHeight && styles.modifiers.fullHeight,
|
|
149
|
+
isStatic && styles.modifiers.static,
|
|
150
|
+
usePageInsets && styles.modifiers.pageInsets,
|
|
151
|
+
isSticky && styles.modifiers.sticky,
|
|
152
|
+
formatBreakpointMods(inset, styles, '', getBreakpoint(width)),
|
|
153
|
+
className
|
|
154
|
+
)}
|
|
155
|
+
id={randomId}
|
|
156
|
+
{...getOUIAProps(Toolbar.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId)}
|
|
157
|
+
{...props}
|
|
158
|
+
>
|
|
159
|
+
<ToolbarContext.Provider
|
|
160
|
+
value={{
|
|
161
|
+
isExpanded,
|
|
162
|
+
toggleIsExpanded: isToggleManaged ? this.toggleIsExpanded : toggleIsExpanded,
|
|
163
|
+
chipGroupContentRef: this.chipGroupContentRef,
|
|
164
|
+
updateNumberFilters: this.updateNumberFilters,
|
|
165
|
+
numberOfFilters,
|
|
166
|
+
clearAllFilters,
|
|
167
|
+
clearFiltersButtonText,
|
|
168
|
+
showClearFiltersButton,
|
|
169
|
+
toolbarId: randomId
|
|
170
|
+
}}
|
|
171
|
+
>
|
|
172
|
+
{children}
|
|
173
|
+
<ToolbarChipGroupContent
|
|
174
|
+
isExpanded={isExpanded}
|
|
175
|
+
chipGroupContentRef={this.chipGroupContentRef}
|
|
176
|
+
clearAllFilters={clearAllFilters}
|
|
177
|
+
showClearFiltersButton={showClearFiltersButton}
|
|
178
|
+
clearFiltersButtonText={clearFiltersButtonText}
|
|
179
|
+
numberOfFilters={numberOfFilters}
|
|
180
|
+
numberOfFiltersText={numberOfFiltersText}
|
|
181
|
+
collapseListedFiltersBreakpoint={collapseListedFiltersBreakpoint}
|
|
182
|
+
/>
|
|
183
|
+
</ToolbarContext.Provider>
|
|
184
|
+
</div>
|
|
151
185
|
)}
|
|
152
|
-
|
|
153
|
-
{...getOUIAProps(Toolbar.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId)}
|
|
154
|
-
{...props}
|
|
155
|
-
>
|
|
156
|
-
<ToolbarContext.Provider
|
|
157
|
-
value={{
|
|
158
|
-
isExpanded,
|
|
159
|
-
toggleIsExpanded: isToggleManaged ? this.toggleIsExpanded : toggleIsExpanded,
|
|
160
|
-
chipGroupContentRef: this.chipGroupContentRef,
|
|
161
|
-
updateNumberFilters: this.updateNumberFilters,
|
|
162
|
-
numberOfFilters,
|
|
163
|
-
clearAllFilters,
|
|
164
|
-
clearFiltersButtonText,
|
|
165
|
-
showClearFiltersButton,
|
|
166
|
-
toolbarId: randomId
|
|
167
|
-
}}
|
|
168
|
-
>
|
|
169
|
-
{children}
|
|
170
|
-
<ToolbarChipGroupContent
|
|
171
|
-
isExpanded={isExpanded}
|
|
172
|
-
chipGroupContentRef={this.chipGroupContentRef}
|
|
173
|
-
clearAllFilters={clearAllFilters}
|
|
174
|
-
showClearFiltersButton={showClearFiltersButton}
|
|
175
|
-
clearFiltersButtonText={clearFiltersButtonText}
|
|
176
|
-
numberOfFilters={numberOfFilters}
|
|
177
|
-
numberOfFiltersText={numberOfFiltersText}
|
|
178
|
-
collapseListedFiltersBreakpoint={collapseListedFiltersBreakpoint}
|
|
179
|
-
/>
|
|
180
|
-
</ToolbarContext.Provider>
|
|
181
|
-
</div>
|
|
186
|
+
</PageContext.Consumer>
|
|
182
187
|
);
|
|
183
188
|
};
|
|
184
189
|
|
|
@@ -4,6 +4,7 @@ import { css } from '@patternfly/react-styles';
|
|
|
4
4
|
import { ToolbarContentContext, ToolbarContext } from './ToolbarUtils';
|
|
5
5
|
import { formatBreakpointMods } from '../../helpers/util';
|
|
6
6
|
import { ToolbarExpandableContent } from './ToolbarExpandableContent';
|
|
7
|
+
import { PageContext } from '../Page/Page';
|
|
7
8
|
|
|
8
9
|
export interface ToolbarContentProps extends React.HTMLProps<HTMLDivElement> {
|
|
9
10
|
/** Classes applied to root element of the data toolbar content row */
|
|
@@ -81,47 +82,51 @@ export class ToolbarContent extends React.Component<ToolbarContentProps> {
|
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
return (
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
<PageContext.Consumer>
|
|
86
|
+
{({ width, getBreakpoint }) => (
|
|
87
|
+
<div
|
|
88
|
+
className={css(
|
|
89
|
+
styles.toolbarContent,
|
|
90
|
+
formatBreakpointMods(visibility || visiblity, styles, '', getBreakpoint(width)),
|
|
91
|
+
formatBreakpointMods(alignment, styles, '', getBreakpoint(width)),
|
|
92
|
+
className
|
|
93
|
+
)}
|
|
94
|
+
{...props}
|
|
95
|
+
>
|
|
96
|
+
<ToolbarContext.Consumer>
|
|
97
|
+
{({
|
|
98
|
+
clearAllFilters: clearAllFiltersContext,
|
|
99
|
+
clearFiltersButtonText: clearFiltersButtonContext,
|
|
100
|
+
showClearFiltersButton: showClearFiltersButtonContext,
|
|
101
|
+
toolbarId: toolbarIdContext
|
|
102
|
+
}) => {
|
|
103
|
+
const expandableContentId = `${toolbarId ||
|
|
104
|
+
toolbarIdContext}-expandable-content-${ToolbarContent.currentId++}`;
|
|
105
|
+
return (
|
|
106
|
+
<ToolbarContentContext.Provider
|
|
107
|
+
value={{
|
|
108
|
+
expandableContentRef: this.expandableContentRef,
|
|
109
|
+
expandableContentId,
|
|
110
|
+
chipContainerRef: this.chipContainerRef
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
<div className={css(styles.toolbarContentSection)}>{children}</div>
|
|
114
|
+
<ToolbarExpandableContent
|
|
115
|
+
id={expandableContentId}
|
|
116
|
+
isExpanded={isExpanded}
|
|
117
|
+
expandableContentRef={this.expandableContentRef}
|
|
118
|
+
chipContainerRef={this.chipContainerRef}
|
|
119
|
+
clearAllFilters={clearAllFilters || clearAllFiltersContext}
|
|
120
|
+
showClearFiltersButton={showClearFiltersButton || showClearFiltersButtonContext}
|
|
121
|
+
clearFiltersButtonText={clearFiltersButtonText || clearFiltersButtonContext}
|
|
122
|
+
/>
|
|
123
|
+
</ToolbarContentContext.Provider>
|
|
124
|
+
);
|
|
125
|
+
}}
|
|
126
|
+
</ToolbarContext.Consumer>
|
|
127
|
+
</div>
|
|
90
128
|
)}
|
|
91
|
-
|
|
92
|
-
>
|
|
93
|
-
<ToolbarContext.Consumer>
|
|
94
|
-
{({
|
|
95
|
-
clearAllFilters: clearAllFiltersContext,
|
|
96
|
-
clearFiltersButtonText: clearFiltersButtonContext,
|
|
97
|
-
showClearFiltersButton: showClearFiltersButtonContext,
|
|
98
|
-
toolbarId: toolbarIdContext
|
|
99
|
-
}) => {
|
|
100
|
-
const expandableContentId = `${toolbarId ||
|
|
101
|
-
toolbarIdContext}-expandable-content-${ToolbarContent.currentId++}`;
|
|
102
|
-
return (
|
|
103
|
-
<ToolbarContentContext.Provider
|
|
104
|
-
value={{
|
|
105
|
-
expandableContentRef: this.expandableContentRef,
|
|
106
|
-
expandableContentId,
|
|
107
|
-
chipContainerRef: this.chipContainerRef
|
|
108
|
-
}}
|
|
109
|
-
>
|
|
110
|
-
<div className={css(styles.toolbarContentSection)}>{children}</div>
|
|
111
|
-
<ToolbarExpandableContent
|
|
112
|
-
id={expandableContentId}
|
|
113
|
-
isExpanded={isExpanded}
|
|
114
|
-
expandableContentRef={this.expandableContentRef}
|
|
115
|
-
chipContainerRef={this.chipContainerRef}
|
|
116
|
-
clearAllFilters={clearAllFilters || clearAllFiltersContext}
|
|
117
|
-
showClearFiltersButton={showClearFiltersButton || showClearFiltersButtonContext}
|
|
118
|
-
clearFiltersButtonText={clearFiltersButtonText || clearFiltersButtonContext}
|
|
119
|
-
/>
|
|
120
|
-
</ToolbarContentContext.Provider>
|
|
121
|
-
);
|
|
122
|
-
}}
|
|
123
|
-
</ToolbarContext.Consumer>
|
|
124
|
-
</div>
|
|
129
|
+
</PageContext.Consumer>
|
|
125
130
|
);
|
|
126
131
|
}
|
|
127
132
|
}
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import styles from '@patternfly/react-styles/css/components/Toolbar/toolbar';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
import { formatBreakpointMods, toCamel } from '../../helpers/util';
|
|
5
|
+
import { PageContext } from '../Page/Page';
|
|
5
6
|
|
|
6
7
|
export enum ToolbarGroupVariant {
|
|
7
8
|
'filter-group' = 'filter-group',
|
|
@@ -84,21 +85,25 @@ class ToolbarGroupWithRef extends React.Component<ToolbarGroupProps> {
|
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
return (
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
<PageContext.Consumer>
|
|
89
|
+
{({ width, getBreakpoint }) => (
|
|
90
|
+
<div
|
|
91
|
+
className={css(
|
|
92
|
+
styles.toolbarGroup,
|
|
93
|
+
variant && styles.modifiers[toCamel(variant) as 'filterGroup' | 'iconButtonGroup' | 'buttonGroup'],
|
|
94
|
+
formatBreakpointMods(visibility || visiblity, styles, '', getBreakpoint(width)),
|
|
95
|
+
formatBreakpointMods(alignment, styles, '', getBreakpoint(width)),
|
|
96
|
+
formatBreakpointMods(spacer, styles, '', getBreakpoint(width)),
|
|
97
|
+
formatBreakpointMods(spaceItems, styles, '', getBreakpoint(width)),
|
|
98
|
+
className
|
|
99
|
+
)}
|
|
100
|
+
{...props}
|
|
101
|
+
ref={innerRef}
|
|
102
|
+
>
|
|
103
|
+
{children}
|
|
104
|
+
</div>
|
|
96
105
|
)}
|
|
97
|
-
|
|
98
|
-
ref={innerRef}
|
|
99
|
-
>
|
|
100
|
-
{children}
|
|
101
|
-
</div>
|
|
106
|
+
</PageContext.Consumer>
|
|
102
107
|
);
|
|
103
108
|
}
|
|
104
109
|
}
|
|
@@ -4,6 +4,7 @@ import { css } from '@patternfly/react-styles';
|
|
|
4
4
|
|
|
5
5
|
import { formatBreakpointMods, toCamel } from '../../helpers/util';
|
|
6
6
|
import { Divider } from '../Divider';
|
|
7
|
+
import { PageContext } from '../Page/Page';
|
|
7
8
|
|
|
8
9
|
export enum ToolbarItemVariant {
|
|
9
10
|
separator = 'separator',
|
|
@@ -113,26 +114,36 @@ export const ToolbarItem: React.FunctionComponent<ToolbarItemProps> = ({
|
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
return (
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
117
|
+
<PageContext.Consumer>
|
|
118
|
+
{({ width, getBreakpoint }) => (
|
|
119
|
+
<div
|
|
120
|
+
className={css(
|
|
121
|
+
styles.toolbarItem,
|
|
122
|
+
variant &&
|
|
123
|
+
styles.modifiers[
|
|
124
|
+
toCamel(variant) as
|
|
125
|
+
| 'bulkSelect'
|
|
126
|
+
| 'overflowMenu'
|
|
127
|
+
| 'pagination'
|
|
128
|
+
| 'searchFilter'
|
|
129
|
+
| 'label'
|
|
130
|
+
| 'chipGroup'
|
|
131
|
+
],
|
|
132
|
+
isAllExpanded && styles.modifiers.expanded,
|
|
133
|
+
formatBreakpointMods(visibility || visiblity, styles, '', getBreakpoint(width)),
|
|
134
|
+
formatBreakpointMods(alignment, styles, '', getBreakpoint(width)),
|
|
135
|
+
formatBreakpointMods(spacer, styles, '', getBreakpoint(width)),
|
|
136
|
+
className
|
|
137
|
+
)}
|
|
138
|
+
{...(variant === 'label' && { 'aria-hidden': true })}
|
|
139
|
+
id={id}
|
|
140
|
+
{...props}
|
|
141
|
+
{...(widths && { style: { ...widthStyles, ...props.style } as React.CSSProperties })}
|
|
142
|
+
>
|
|
143
|
+
{children}
|
|
144
|
+
</div>
|
|
128
145
|
)}
|
|
129
|
-
|
|
130
|
-
id={id}
|
|
131
|
-
{...props}
|
|
132
|
-
{...(widths && { style: { ...widthStyles, ...props.style } as React.CSSProperties })}
|
|
133
|
-
>
|
|
134
|
-
{children}
|
|
135
|
-
</div>
|
|
146
|
+
</PageContext.Consumer>
|
|
136
147
|
);
|
|
137
148
|
};
|
|
138
149
|
ToolbarItem.displayName = 'ToolbarItem';
|
|
@@ -6,7 +6,8 @@ import { ToolbarGroupProps } from './ToolbarGroup';
|
|
|
6
6
|
import { ToolbarContext, ToolbarContentContext } from './ToolbarUtils';
|
|
7
7
|
import { Button } from '../Button';
|
|
8
8
|
import globalBreakpointLg from '@patternfly/react-tokens/dist/esm/global_breakpoint_lg';
|
|
9
|
-
import { formatBreakpointMods, toCamel,
|
|
9
|
+
import { formatBreakpointMods, toCamel, canUseDOM } from '../../helpers/util';
|
|
10
|
+
import { PageContext } from '../Page/Page';
|
|
10
11
|
|
|
11
12
|
export interface ToolbarToggleGroupProps extends ToolbarGroupProps {
|
|
12
13
|
/** An icon to be rendered when the toggle group has collapsed down */
|
|
@@ -92,61 +93,67 @@ export class ToolbarToggleGroup extends React.Component<ToolbarToggleGroupProps>
|
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
return (
|
|
95
|
-
<
|
|
96
|
-
{({
|
|
97
|
-
<
|
|
98
|
-
{({
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
expandableContentRef.current.classList
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
<PageContext.Consumer>
|
|
97
|
+
{({ width, getBreakpoint }) => (
|
|
98
|
+
<ToolbarContext.Consumer>
|
|
99
|
+
{({ isExpanded, toggleIsExpanded }) => (
|
|
100
|
+
<ToolbarContentContext.Consumer>
|
|
101
|
+
{({ expandableContentRef, expandableContentId }) => {
|
|
102
|
+
if (expandableContentRef.current && expandableContentRef.current.classList) {
|
|
103
|
+
if (isExpanded) {
|
|
104
|
+
expandableContentRef.current.classList.add(styles.modifiers.expanded);
|
|
105
|
+
} else {
|
|
106
|
+
expandableContentRef.current.classList.remove(styles.modifiers.expanded);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
106
109
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<Button
|
|
131
|
-
variant="plain"
|
|
132
|
-
onClick={toggleIsExpanded}
|
|
133
|
-
aria-label="Show Filters"
|
|
134
|
-
{...(isExpanded && { 'aria-expanded': true })}
|
|
135
|
-
aria-haspopup={isExpanded && this.isContentPopup()}
|
|
136
|
-
aria-controls={expandableContentId}
|
|
110
|
+
const breakpointMod: {
|
|
111
|
+
md?: 'show';
|
|
112
|
+
lg?: 'show';
|
|
113
|
+
xl?: 'show';
|
|
114
|
+
'2xl'?: 'show';
|
|
115
|
+
} = {};
|
|
116
|
+
breakpointMod[breakpoint] = 'show';
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<div
|
|
120
|
+
className={css(
|
|
121
|
+
styles.toolbarGroup,
|
|
122
|
+
styles.modifiers.toggleGroup,
|
|
123
|
+
variant &&
|
|
124
|
+
styles.modifiers[toCamel(variant) as 'filterGroup' | 'iconButtonGroup' | 'buttonGroup'],
|
|
125
|
+
formatBreakpointMods(breakpointMod, styles, '', getBreakpoint(width)),
|
|
126
|
+
formatBreakpointMods(visibility || visiblity, styles, '', getBreakpoint(width)),
|
|
127
|
+
formatBreakpointMods(alignment, styles, '', getBreakpoint(width)),
|
|
128
|
+
formatBreakpointMods(spacer, styles, '', getBreakpoint(width)),
|
|
129
|
+
formatBreakpointMods(spaceItems, styles, '', getBreakpoint(width)),
|
|
130
|
+
className
|
|
131
|
+
)}
|
|
132
|
+
{...props}
|
|
137
133
|
>
|
|
138
|
-
{
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
134
|
+
<div className={css(styles.toolbarToggle)}>
|
|
135
|
+
<Button
|
|
136
|
+
variant="plain"
|
|
137
|
+
onClick={toggleIsExpanded}
|
|
138
|
+
aria-label="Show Filters"
|
|
139
|
+
{...(isExpanded && { 'aria-expanded': true })}
|
|
140
|
+
aria-haspopup={isExpanded && this.isContentPopup()}
|
|
141
|
+
aria-controls={expandableContentId}
|
|
142
|
+
>
|
|
143
|
+
{toggleIcon}
|
|
144
|
+
</Button>
|
|
145
|
+
</div>
|
|
146
|
+
{isExpanded
|
|
147
|
+
? ReactDOM.createPortal(children, expandableContentRef.current.firstElementChild)
|
|
148
|
+
: children}
|
|
149
|
+
</div>
|
|
150
|
+
);
|
|
151
|
+
}}
|
|
152
|
+
</ToolbarContentContext.Consumer>
|
|
153
|
+
)}
|
|
154
|
+
</ToolbarContext.Consumer>
|
|
148
155
|
)}
|
|
149
|
-
</
|
|
156
|
+
</PageContext.Consumer>
|
|
150
157
|
);
|
|
151
158
|
}
|
|
152
159
|
}
|
|
@@ -1,47 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`Toolbar should match snapshot (auto-generated) 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
data-ouia-component-type="PF4/Toolbar"
|
|
8
|
-
data-ouia-safe={true}
|
|
9
|
-
id="string"
|
|
10
|
-
>
|
|
11
|
-
<ContextProvider
|
|
12
|
-
value={
|
|
13
|
-
Object {
|
|
14
|
-
"chipGroupContentRef": Object {
|
|
15
|
-
"current": null,
|
|
16
|
-
},
|
|
17
|
-
"clearAllFilters": [Function],
|
|
18
|
-
"clearFiltersButtonText": "string",
|
|
19
|
-
"isExpanded": true,
|
|
20
|
-
"numberOfFilters": 0,
|
|
21
|
-
"showClearFiltersButton": false,
|
|
22
|
-
"toggleIsExpanded": [Function],
|
|
23
|
-
"toolbarId": "string",
|
|
24
|
-
"updateNumberFilters": [Function],
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
>
|
|
28
|
-
<div>
|
|
29
|
-
ReactNode
|
|
30
|
-
</div>
|
|
31
|
-
<ToolbarChipGroupContent
|
|
32
|
-
chipGroupContentRef={
|
|
33
|
-
Object {
|
|
34
|
-
"current": null,
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
clearAllFilters={[Function]}
|
|
38
|
-
clearFiltersButtonText="string"
|
|
39
|
-
collapseListedFiltersBreakpoint="md"
|
|
40
|
-
isExpanded={true}
|
|
41
|
-
numberOfFilters={0}
|
|
42
|
-
numberOfFiltersText={[Function]}
|
|
43
|
-
showClearFiltersButton={false}
|
|
44
|
-
/>
|
|
45
|
-
</ContextProvider>
|
|
46
|
-
</div>
|
|
4
|
+
<ContextConsumer>
|
|
5
|
+
<Component />
|
|
6
|
+
</ContextConsumer>
|
|
47
7
|
`;
|
package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarContent.test.tsx.snap
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`ToolbarContent should match snapshot (auto-generated) 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
>
|
|
7
|
-
<ContextConsumer>
|
|
8
|
-
<Component />
|
|
9
|
-
</ContextConsumer>
|
|
10
|
-
</div>
|
|
4
|
+
<ContextConsumer>
|
|
5
|
+
<Component />
|
|
6
|
+
</ContextConsumer>
|
|
11
7
|
`;
|