@patternfly/react-core 6.0.0-alpha.78 → 6.0.0-alpha.79
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 +6 -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/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/Content/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/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/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/Chip/package.json +1 -1
- package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
- package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Modal/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/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/styles/package.json +1 -1
- package/dist/dynamic-modules.json +2 -2
- package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
- package/dist/esm/components/ExpandableSection/ExpandableSection.js +6 -4
- package/dist/esm/components/ExpandableSection/ExpandableSection.js.map +1 -1
- package/dist/esm/components/Toolbar/Toolbar.d.ts +5 -5
- package/dist/esm/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/Toolbar.js +6 -6
- package/dist/esm/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarContent.d.ts +1 -1
- package/dist/esm/components/Toolbar/ToolbarContent.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarContent.js +2 -2
- package/dist/esm/components/Toolbar/ToolbarContent.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarExpandableContent.d.ts +2 -2
- package/dist/esm/components/Toolbar/ToolbarExpandableContent.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarExpandableContent.js +7 -7
- package/dist/esm/components/Toolbar/ToolbarExpandableContent.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarFilter.d.ts +21 -21
- package/dist/esm/components/Toolbar/ToolbarFilter.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarFilter.js +15 -15
- package/dist/esm/components/Toolbar/ToolbarFilter.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarGroup.d.ts +1 -1
- package/dist/esm/components/Toolbar/ToolbarGroup.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarItem.d.ts +2 -2
- package/dist/esm/components/Toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarItem.js +2 -2
- package/dist/esm/components/Toolbar/ToolbarItem.js.map +1 -1
- package/dist/esm/components/Toolbar/{ToolbarChipGroupContent.d.ts → ToolbarLabelGroupContent.d.ts} +10 -10
- package/dist/esm/components/Toolbar/ToolbarLabelGroupContent.d.ts.map +1 -0
- package/dist/esm/components/Toolbar/{ToolbarChipGroupContent.js → ToolbarLabelGroupContent.js} +11 -11
- package/dist/esm/components/Toolbar/ToolbarLabelGroupContent.js.map +1 -0
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.d.ts +2 -2
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.js +4 -4
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarUtils.d.ts +3 -3
- package/dist/esm/components/Toolbar/ToolbarUtils.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarUtils.js +2 -2
- package/dist/esm/components/Toolbar/ToolbarUtils.js.map +1 -1
- package/dist/js/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
- package/dist/js/components/ExpandableSection/ExpandableSection.js +6 -4
- package/dist/js/components/ExpandableSection/ExpandableSection.js.map +1 -1
- package/dist/js/components/Toolbar/Toolbar.d.ts +5 -5
- package/dist/js/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/js/components/Toolbar/Toolbar.js +6 -6
- package/dist/js/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarContent.d.ts +1 -1
- package/dist/js/components/Toolbar/ToolbarContent.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarContent.js +2 -2
- package/dist/js/components/Toolbar/ToolbarContent.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarExpandableContent.d.ts +2 -2
- package/dist/js/components/Toolbar/ToolbarExpandableContent.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarExpandableContent.js +7 -7
- package/dist/js/components/Toolbar/ToolbarExpandableContent.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarFilter.d.ts +21 -21
- package/dist/js/components/Toolbar/ToolbarFilter.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarFilter.js +15 -15
- package/dist/js/components/Toolbar/ToolbarFilter.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarGroup.d.ts +1 -1
- package/dist/js/components/Toolbar/ToolbarGroup.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarItem.d.ts +2 -2
- package/dist/js/components/Toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarItem.js +2 -2
- package/dist/js/components/Toolbar/ToolbarItem.js.map +1 -1
- package/dist/js/components/Toolbar/{ToolbarChipGroupContent.d.ts → ToolbarLabelGroupContent.d.ts} +10 -10
- package/dist/js/components/Toolbar/ToolbarLabelGroupContent.d.ts.map +1 -0
- package/dist/js/components/Toolbar/{ToolbarChipGroupContent.js → ToolbarLabelGroupContent.js} +12 -12
- package/dist/js/components/Toolbar/ToolbarLabelGroupContent.js.map +1 -0
- package/dist/js/components/Toolbar/ToolbarToggleGroup.d.ts +2 -2
- package/dist/js/components/Toolbar/ToolbarToggleGroup.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarToggleGroup.js +4 -4
- package/dist/js/components/Toolbar/ToolbarToggleGroup.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarUtils.d.ts +3 -3
- package/dist/js/components/Toolbar/ToolbarUtils.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarUtils.js +2 -2
- package/dist/js/components/Toolbar/ToolbarUtils.js.map +1 -1
- package/dist/umd/assets/{output-Dt8Et40Q.css → output-Rz4e1DgY.css} +2800 -2800
- package/dist/umd/react-core.min.js +1 -1
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +2 -2
- package/src/components/ExpandableSection/ExpandableSection.tsx +6 -4
- package/src/components/Toolbar/Toolbar.tsx +12 -12
- package/src/components/Toolbar/ToolbarContent.tsx +2 -2
- package/src/components/Toolbar/ToolbarExpandableContent.tsx +9 -9
- package/src/components/Toolbar/ToolbarFilter.tsx +51 -51
- package/src/components/Toolbar/ToolbarGroup.tsx +1 -1
- package/src/components/Toolbar/ToolbarItem.tsx +3 -3
- package/src/components/Toolbar/{ToolbarChipGroupContent.tsx → ToolbarLabelGroupContent.tsx} +17 -17
- package/src/components/Toolbar/ToolbarToggleGroup.tsx +7 -7
- package/src/components/Toolbar/ToolbarUtils.tsx +5 -5
- package/src/components/Toolbar/__tests__/Generated/ToolbarChipGroupContent.test.tsx +4 -4
- package/src/components/Toolbar/__tests__/Generated/ToolbarExpandableContent.test.tsx +1 -1
- package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarChipGroupContent.test.tsx.snap +1 -1
- package/src/components/Toolbar/__tests__/Toolbar.test.tsx +6 -6
- package/src/components/Toolbar/__tests__/__snapshots__/Toolbar.test.tsx.snap +2 -2
- package/src/components/Toolbar/examples/Toolbar.md +5 -5
- package/src/components/Toolbar/examples/{ToolbarCustomChipGroupContent.tsx → ToolbarCustomLabelGroupContent.tsx} +10 -10
- package/src/components/Toolbar/examples/ToolbarWithFilters.tsx +5 -5
- package/src/demos/CardView/examples/CardView.tsx +2 -2
- package/src/demos/Filters/examples/FilterAttributeSearch.tsx +9 -9
- package/src/demos/Filters/examples/FilterCheckboxSelect.tsx +3 -3
- package/src/demos/Filters/examples/FilterFaceted.tsx +9 -9
- package/src/demos/Filters/examples/FilterMixedSelectGroup.tsx +6 -6
- package/src/demos/examples/PrimaryDetail/PrimaryDetailCardView.tsx +2 -2
- package/dist/esm/components/Toolbar/ToolbarChipGroupContent.d.ts.map +0 -1
- package/dist/esm/components/Toolbar/ToolbarChipGroupContent.js.map +0 -1
- package/dist/js/components/Toolbar/ToolbarChipGroupContent.d.ts.map +0 -1
- package/dist/js/components/Toolbar/ToolbarChipGroupContent.js.map +0 -1
package/helpers/package.json
CHANGED
package/layouts/package.json
CHANGED
package/next/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.79",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"react": "^17 || ^18",
|
|
65
65
|
"react-dom": "^17 || ^18"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "cb1098099e5ccc766571bcd64adc642ee9687f3b"
|
|
68
68
|
}
|
|
@@ -168,10 +168,12 @@ class ExpandableSection extends React.Component<ExpandableSectionProps, Expandab
|
|
|
168
168
|
};
|
|
169
169
|
|
|
170
170
|
resize = () => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
this.
|
|
174
|
-
|
|
171
|
+
if (this.expandableContentRef) {
|
|
172
|
+
const { offsetWidth } = this.expandableContentRef.current;
|
|
173
|
+
if (this.state.previousWidth !== offsetWidth) {
|
|
174
|
+
this.setState({ previousWidth: offsetWidth });
|
|
175
|
+
this.checkToggleVisibility();
|
|
176
|
+
}
|
|
175
177
|
}
|
|
176
178
|
};
|
|
177
179
|
handleResize = debounce(this.resize, 250);
|
|
@@ -3,7 +3,7 @@ import styles from '@patternfly/react-styles/css/components/Toolbar/toolbar';
|
|
|
3
3
|
import { GenerateId } from '../../helpers/GenerateId/GenerateId';
|
|
4
4
|
import { css } from '@patternfly/react-styles';
|
|
5
5
|
import { ToolbarContext } from './ToolbarUtils';
|
|
6
|
-
import {
|
|
6
|
+
import { ToolbarLabelGroupContent } from './ToolbarLabelGroupContent';
|
|
7
7
|
import { formatBreakpointMods, canUseDOM } from '../../helpers/util';
|
|
8
8
|
import { getDefaultOUIAId, getOUIAProps, OUIAProps } from '../../helpers';
|
|
9
9
|
import { PageContext } from '../Page/PageContext';
|
|
@@ -20,9 +20,9 @@ export interface ToolbarProps extends React.HTMLProps<HTMLDivElement>, OUIAProps
|
|
|
20
20
|
clearAllFilters?: () => void;
|
|
21
21
|
/** Text to display in the clear all filters button */
|
|
22
22
|
clearFiltersButtonText?: string;
|
|
23
|
-
/** Custom content appended to the filter generated
|
|
24
|
-
|
|
25
|
-
/** The breakpoint at which the listed filters in
|
|
23
|
+
/** Custom content appended to the filter generated label group. To maintain spacing and styling, each node should be wrapped in a ToolbarItem or ToolbarGroup. This property will remove the default "Clear all filters" button. */
|
|
24
|
+
customLabelGroupContent?: React.ReactNode;
|
|
25
|
+
/** The breakpoint at which the listed filters in label groups are collapsed down to a summary */
|
|
26
26
|
collapseListedFiltersBreakpoint?: 'all' | 'md' | 'lg' | 'xl' | '2xl';
|
|
27
27
|
/** Flag indicating if a data toolbar toggle group's expandable content is expanded */
|
|
28
28
|
isExpanded?: boolean;
|
|
@@ -65,7 +65,7 @@ export interface ToolbarState {
|
|
|
65
65
|
/** Flag used if the user has opted NOT to manage the 'isExpanded' state of the toggle group.
|
|
66
66
|
* Indicates whether or not the toggle group is expanded. */
|
|
67
67
|
isManagedToggleExpanded: boolean;
|
|
68
|
-
/** Object managing information about how many
|
|
68
|
+
/** Object managing information about how many labels are in each label group */
|
|
69
69
|
filterInfo: FilterInfo;
|
|
70
70
|
/** Used to keep track of window width so we can collapse expanded content when window is resizing */
|
|
71
71
|
windowWidth: number;
|
|
@@ -78,7 +78,7 @@ interface FilterInfo {
|
|
|
78
78
|
|
|
79
79
|
class Toolbar extends React.Component<ToolbarProps, ToolbarState> {
|
|
80
80
|
static displayName = 'Toolbar';
|
|
81
|
-
|
|
81
|
+
labelGroupContentRef = React.createRef<HTMLDivElement>();
|
|
82
82
|
staticFilterInfo = {};
|
|
83
83
|
state = {
|
|
84
84
|
isManagedToggleExpanded: false,
|
|
@@ -144,7 +144,7 @@ class Toolbar extends React.Component<ToolbarProps, ToolbarState> {
|
|
|
144
144
|
isSticky,
|
|
145
145
|
ouiaId,
|
|
146
146
|
numberOfFiltersText,
|
|
147
|
-
|
|
147
|
+
customLabelGroupContent,
|
|
148
148
|
colorVariant = ToolbarColorVariant.default,
|
|
149
149
|
...props
|
|
150
150
|
} = this.props;
|
|
@@ -180,27 +180,27 @@ class Toolbar extends React.Component<ToolbarProps, ToolbarState> {
|
|
|
180
180
|
value={{
|
|
181
181
|
isExpanded,
|
|
182
182
|
toggleIsExpanded: isToggleManaged ? this.toggleIsExpanded : toggleIsExpanded,
|
|
183
|
-
|
|
183
|
+
labelGroupContentRef: this.labelGroupContentRef,
|
|
184
184
|
updateNumberFilters: this.updateNumberFilters,
|
|
185
185
|
numberOfFilters,
|
|
186
186
|
clearAllFilters,
|
|
187
187
|
clearFiltersButtonText,
|
|
188
188
|
showClearFiltersButton,
|
|
189
189
|
toolbarId: randomId,
|
|
190
|
-
|
|
190
|
+
customLabelGroupContent
|
|
191
191
|
}}
|
|
192
192
|
>
|
|
193
193
|
{children}
|
|
194
|
-
<
|
|
194
|
+
<ToolbarLabelGroupContent
|
|
195
195
|
isExpanded={isExpanded}
|
|
196
|
-
|
|
196
|
+
labelGroupContentRef={this.labelGroupContentRef}
|
|
197
197
|
clearAllFilters={clearAllFilters}
|
|
198
198
|
showClearFiltersButton={showClearFiltersButton}
|
|
199
199
|
clearFiltersButtonText={clearFiltersButtonText}
|
|
200
200
|
numberOfFilters={numberOfFilters}
|
|
201
201
|
numberOfFiltersText={numberOfFiltersText}
|
|
202
202
|
collapseListedFiltersBreakpoint={collapseListedFiltersBreakpoint}
|
|
203
|
-
|
|
203
|
+
customLabelGroupContent={customLabelGroupContent}
|
|
204
204
|
/>
|
|
205
205
|
</ToolbarContext.Provider>
|
|
206
206
|
</div>
|
|
@@ -37,7 +37,7 @@ export interface ToolbarContentProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
37
37
|
class ToolbarContent extends React.Component<ToolbarContentProps> {
|
|
38
38
|
static displayName = 'ToolbarContent';
|
|
39
39
|
private expandableContentRef = React.createRef<HTMLDivElement>();
|
|
40
|
-
private
|
|
40
|
+
private labelContainerRef = React.createRef<HTMLDivElement>();
|
|
41
41
|
private static currentId = 0;
|
|
42
42
|
|
|
43
43
|
static defaultProps: ToolbarContentProps = {
|
|
@@ -88,7 +88,7 @@ class ToolbarContent extends React.Component<ToolbarContentProps> {
|
|
|
88
88
|
value={{
|
|
89
89
|
expandableContentRef: this.expandableContentRef,
|
|
90
90
|
expandableContentId,
|
|
91
|
-
|
|
91
|
+
labelContainerRef: this.labelContainerRef,
|
|
92
92
|
isExpanded: isExpanded || isExpandedContext,
|
|
93
93
|
clearAllFilters: clearAllFilters || clearAllFiltersContext,
|
|
94
94
|
clearFiltersButtonText: clearFiltersButtonText || clearFiltersButtonContext,
|
|
@@ -16,8 +16,8 @@ export interface ToolbarExpandableContentProps extends React.HTMLProps<HTMLDivEl
|
|
|
16
16
|
isExpanded?: boolean;
|
|
17
17
|
/** Expandable content reference for passing to data toolbar children */
|
|
18
18
|
expandableContentRef?: RefObject<HTMLDivElement>;
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/** Label container reference for passing to data toolbar children */
|
|
20
|
+
labelContainerRef?: RefObject<any>;
|
|
21
21
|
/** optional callback for clearing all filters in the toolbar */
|
|
22
22
|
clearAllFilters?: () => void;
|
|
23
23
|
/** Text to display in the clear all filters button */
|
|
@@ -40,16 +40,16 @@ class ToolbarExpandableContent extends React.Component<ToolbarExpandableContentP
|
|
|
40
40
|
children,
|
|
41
41
|
className,
|
|
42
42
|
expandableContentRef,
|
|
43
|
-
|
|
43
|
+
labelContainerRef,
|
|
44
44
|
isExpanded,
|
|
45
45
|
clearAllFilters,
|
|
46
46
|
clearFiltersButtonText,
|
|
47
47
|
showClearFiltersButton,
|
|
48
48
|
...props
|
|
49
49
|
} = this.props;
|
|
50
|
-
const { numberOfFilters,
|
|
50
|
+
const { numberOfFilters, customLabelGroupContent } = this.context;
|
|
51
51
|
|
|
52
|
-
const
|
|
52
|
+
const clearLabelGroups = () => {
|
|
53
53
|
clearAllFilters();
|
|
54
54
|
};
|
|
55
55
|
|
|
@@ -62,15 +62,15 @@ class ToolbarExpandableContent extends React.Component<ToolbarExpandableContentP
|
|
|
62
62
|
<ToolbarGroup>{children}</ToolbarGroup>
|
|
63
63
|
{numberOfFilters > 0 && (
|
|
64
64
|
<ToolbarGroup>
|
|
65
|
-
<ToolbarGroup ref={
|
|
66
|
-
{showClearFiltersButton && !
|
|
65
|
+
<ToolbarGroup ref={labelContainerRef} />
|
|
66
|
+
{showClearFiltersButton && !customLabelGroupContent && (
|
|
67
67
|
<ToolbarItem>
|
|
68
|
-
<Button variant="link" onClick={
|
|
68
|
+
<Button variant="link" onClick={clearLabelGroups} isInline>
|
|
69
69
|
{clearFiltersButtonText}
|
|
70
70
|
</Button>
|
|
71
71
|
</ToolbarItem>
|
|
72
72
|
)}
|
|
73
|
-
{
|
|
73
|
+
{customLabelGroupContent && customLabelGroupContent}
|
|
74
74
|
</ToolbarGroup>
|
|
75
75
|
)}
|
|
76
76
|
</div>
|
|
@@ -5,41 +5,41 @@ import { ToolbarContentContext, ToolbarContext } from './ToolbarUtils';
|
|
|
5
5
|
import { PickOptional } from '../../helpers/typeUtils';
|
|
6
6
|
import { Label, LabelGroup } from '../Label';
|
|
7
7
|
|
|
8
|
-
export interface
|
|
9
|
-
/** A unique key to identify this
|
|
8
|
+
export interface ToolbarLabelGroup {
|
|
9
|
+
/** A unique key to identify this label group category */
|
|
10
10
|
key: string;
|
|
11
|
-
/** The category name to display for the
|
|
11
|
+
/** The category name to display for the label group */
|
|
12
12
|
name: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export interface
|
|
16
|
-
/** A unique key to identify this
|
|
15
|
+
export interface ToolbarLabel {
|
|
16
|
+
/** A unique key to identify this label */
|
|
17
17
|
key: string;
|
|
18
|
-
/** The ReactNode to display in the
|
|
18
|
+
/** The ReactNode to display in the label */
|
|
19
19
|
node: React.ReactNode;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export interface ToolbarFilterProps extends ToolbarItemProps {
|
|
23
23
|
/** Flag indicating when toolbar toggle group is expanded for non-managed toolbar toggle groups. */
|
|
24
24
|
isExpanded?: boolean;
|
|
25
|
-
/** An array of strings to be displayed as
|
|
26
|
-
|
|
27
|
-
/** Callback passed by consumer used to close the entire
|
|
28
|
-
|
|
29
|
-
/** Callback passed by consumer used to delete a
|
|
30
|
-
|
|
31
|
-
/** Customizable "Show Less" text string for the
|
|
32
|
-
|
|
33
|
-
/** Customizeable template string for the
|
|
34
|
-
|
|
35
|
-
/** Content to be rendered inside the data toolbar item associated with the
|
|
25
|
+
/** An array of strings to be displayed as labels in the expandable content */
|
|
26
|
+
labels?: (string | ToolbarLabel)[];
|
|
27
|
+
/** Callback passed by consumer used to close the entire label group */
|
|
28
|
+
deleteLabelGroup?: (category: string | ToolbarLabelGroup) => void;
|
|
29
|
+
/** Callback passed by consumer used to delete a label from the labels[] */
|
|
30
|
+
deleteLabel?: (category: string | ToolbarLabelGroup, label: ToolbarLabel | string) => void;
|
|
31
|
+
/** Customizable "Show Less" text string for the label group */
|
|
32
|
+
labelGroupExpandedText?: string;
|
|
33
|
+
/** Customizeable template string for the label group. Use variable "${remaining}" for the overflow label count. */
|
|
34
|
+
labelGroupCollapsedText?: string;
|
|
35
|
+
/** Content to be rendered inside the data toolbar item associated with the label group */
|
|
36
36
|
children: React.ReactNode;
|
|
37
|
-
/** Unique category name to be used as a label for the
|
|
38
|
-
categoryName: string |
|
|
37
|
+
/** Unique category name to be used as a label for the label group */
|
|
38
|
+
categoryName: string | ToolbarLabelGroup;
|
|
39
39
|
/** Flag to show the toolbar item */
|
|
40
40
|
showToolbarItem?: boolean;
|
|
41
|
-
/** Reference to a
|
|
42
|
-
|
|
41
|
+
/** Reference to a label container created with a custom expandable content group, for non-managed multiple toolbar toggle groups. */
|
|
42
|
+
expandableLabelContainerRef?: React.RefObject<HTMLDivElement>;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
interface ToolbarFilterState {
|
|
@@ -51,7 +51,7 @@ class ToolbarFilter extends React.Component<ToolbarFilterProps, ToolbarFilterSta
|
|
|
51
51
|
static contextType = ToolbarContext;
|
|
52
52
|
context!: React.ContextType<typeof ToolbarContext>;
|
|
53
53
|
static defaultProps: PickOptional<ToolbarFilterProps> = {
|
|
54
|
-
|
|
54
|
+
labels: [] as (string | ToolbarLabel)[],
|
|
55
55
|
showToolbarItem: true
|
|
56
56
|
};
|
|
57
57
|
|
|
@@ -63,65 +63,65 @@ class ToolbarFilter extends React.Component<ToolbarFilterProps, ToolbarFilterSta
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
componentDidMount() {
|
|
66
|
-
const { categoryName,
|
|
66
|
+
const { categoryName, labels } = this.props;
|
|
67
67
|
this.context.updateNumberFilters(
|
|
68
68
|
typeof categoryName !== 'string' && categoryName.hasOwnProperty('key')
|
|
69
69
|
? categoryName.key
|
|
70
70
|
: categoryName.toString(),
|
|
71
|
-
|
|
71
|
+
labels.length
|
|
72
72
|
);
|
|
73
73
|
this.setState({ isMounted: true });
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
componentDidUpdate() {
|
|
77
|
-
const { categoryName,
|
|
77
|
+
const { categoryName, labels } = this.props;
|
|
78
78
|
this.context.updateNumberFilters(
|
|
79
79
|
typeof categoryName !== 'string' && categoryName.hasOwnProperty('key')
|
|
80
80
|
? categoryName.key
|
|
81
81
|
: categoryName.toString(),
|
|
82
|
-
|
|
82
|
+
labels.length
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
render() {
|
|
87
87
|
const {
|
|
88
88
|
children,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
labels,
|
|
90
|
+
deleteLabelGroup,
|
|
91
|
+
deleteLabel,
|
|
92
|
+
labelGroupExpandedText,
|
|
93
|
+
labelGroupCollapsedText,
|
|
94
94
|
categoryName,
|
|
95
95
|
showToolbarItem,
|
|
96
96
|
isExpanded,
|
|
97
|
-
|
|
97
|
+
expandableLabelContainerRef,
|
|
98
98
|
...props
|
|
99
99
|
} = this.props;
|
|
100
|
-
const { isExpanded: managedIsExpanded,
|
|
100
|
+
const { isExpanded: managedIsExpanded, labelGroupContentRef } = this.context;
|
|
101
101
|
const _isExpanded = isExpanded !== undefined ? isExpanded : managedIsExpanded;
|
|
102
102
|
const categoryKey =
|
|
103
103
|
typeof categoryName !== 'string' && categoryName.hasOwnProperty('key')
|
|
104
104
|
? categoryName.key
|
|
105
105
|
: categoryName.toString();
|
|
106
106
|
|
|
107
|
-
const
|
|
108
|
-
<ToolbarItem variant="
|
|
107
|
+
const labelGroup = labels.length ? (
|
|
108
|
+
<ToolbarItem variant="label-group">
|
|
109
109
|
<LabelGroup
|
|
110
110
|
key={categoryKey}
|
|
111
111
|
categoryName={typeof categoryName === 'string' ? categoryName : categoryName.name}
|
|
112
|
-
isClosable={
|
|
113
|
-
onClick={() =>
|
|
114
|
-
collapsedText={
|
|
115
|
-
expandedText={
|
|
112
|
+
isClosable={deleteLabelGroup !== undefined}
|
|
113
|
+
onClick={() => deleteLabelGroup(categoryName)}
|
|
114
|
+
collapsedText={labelGroupCollapsedText}
|
|
115
|
+
expandedText={labelGroupExpandedText}
|
|
116
116
|
>
|
|
117
|
-
{
|
|
118
|
-
typeof
|
|
119
|
-
<Label variant="outline" key={
|
|
120
|
-
{
|
|
117
|
+
{labels.map((label) =>
|
|
118
|
+
typeof label === 'string' ? (
|
|
119
|
+
<Label variant="outline" key={label} onClose={() => deleteLabel(categoryKey, label)}>
|
|
120
|
+
{label}
|
|
121
121
|
</Label>
|
|
122
122
|
) : (
|
|
123
|
-
<Label key={
|
|
124
|
-
{
|
|
123
|
+
<Label key={label.key} onClose={() => deleteLabel(categoryKey, label)}>
|
|
124
|
+
{label.node}
|
|
125
125
|
</Label>
|
|
126
126
|
)
|
|
127
127
|
)}
|
|
@@ -133,20 +133,20 @@ class ToolbarFilter extends React.Component<ToolbarFilterProps, ToolbarFilterSta
|
|
|
133
133
|
return (
|
|
134
134
|
<React.Fragment>
|
|
135
135
|
{showToolbarItem && <ToolbarItem {...props}>{children}</ToolbarItem>}
|
|
136
|
-
{ReactDOM.createPortal(
|
|
136
|
+
{ReactDOM.createPortal(labelGroup, labelGroupContentRef.current.firstElementChild)}
|
|
137
137
|
</React.Fragment>
|
|
138
138
|
);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
return (
|
|
142
142
|
<ToolbarContentContext.Consumer>
|
|
143
|
-
{({
|
|
143
|
+
{({ labelContainerRef }) => (
|
|
144
144
|
<React.Fragment>
|
|
145
145
|
{showToolbarItem && <ToolbarItem {...props}>{children}</ToolbarItem>}
|
|
146
|
-
{
|
|
147
|
-
{
|
|
148
|
-
|
|
149
|
-
ReactDOM.createPortal(
|
|
146
|
+
{labelContainerRef.current && ReactDOM.createPortal(labelGroup, labelContainerRef.current)}
|
|
147
|
+
{expandableLabelContainerRef &&
|
|
148
|
+
expandableLabelContainerRef.current &&
|
|
149
|
+
ReactDOM.createPortal(labelGroup, expandableLabelContainerRef.current)}
|
|
150
150
|
</React.Fragment>
|
|
151
151
|
)}
|
|
152
152
|
</ToolbarContentContext.Consumer>
|
|
@@ -152,7 +152,7 @@ export interface ToolbarGroupProps extends Omit<React.HTMLProps<HTMLDivElement>,
|
|
|
152
152
|
children?: React.ReactNode;
|
|
153
153
|
/** Flag that modifies the toolbar group to hide overflow and respond to available space. Used for horizontal navigation. */
|
|
154
154
|
isOverflowContainer?: boolean;
|
|
155
|
-
/** @hide Reference to pass to this group if it has .pf-m-
|
|
155
|
+
/** @hide Reference to pass to this group if it has .pf-m-label-container modifier */
|
|
156
156
|
innerRef?: React.RefObject<any>;
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -9,7 +9,7 @@ export enum ToolbarItemVariant {
|
|
|
9
9
|
separator = 'separator',
|
|
10
10
|
pagination = 'pagination',
|
|
11
11
|
label = 'label',
|
|
12
|
-
'
|
|
12
|
+
'label-group' = 'label-group',
|
|
13
13
|
'expand-all' = 'expand-all'
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ export interface ToolbarItemProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
17
17
|
/** Classes applied to root element of the data toolbar item */
|
|
18
18
|
className?: string;
|
|
19
19
|
/** A type modifier which modifies spacing specifically depending on the type of item */
|
|
20
|
-
variant?: ToolbarItemVariant | 'pagination' | 'label' | '
|
|
20
|
+
variant?: ToolbarItemVariant | 'pagination' | 'label' | 'label-group' | 'separator' | 'expand-all';
|
|
21
21
|
/** Visibility at various breakpoints. */
|
|
22
22
|
visibility?: {
|
|
23
23
|
default?: 'hidden' | 'visible';
|
|
@@ -189,7 +189,7 @@ export const ToolbarItem: React.FunctionComponent<ToolbarItemProps> = ({
|
|
|
189
189
|
className={css(
|
|
190
190
|
styles.toolbarItem,
|
|
191
191
|
variant && styles.modifiers[toCamel(variant) as 'pagination' | 'label'],
|
|
192
|
-
variant === ToolbarItemVariant['
|
|
192
|
+
variant === ToolbarItemVariant['label-group'] && styles.modifiers.labelGroup,
|
|
193
193
|
isAllExpanded && styles.modifiers.expanded,
|
|
194
194
|
isOverflowContainer && styles.modifiers.overflowContainer,
|
|
195
195
|
formatBreakpointMods(visibility, styles, '', getBreakpoint(width)),
|
|
@@ -10,13 +10,13 @@ import { ToolbarGroup } from './ToolbarGroup';
|
|
|
10
10
|
import { globalBreakpoints } from './ToolbarUtils';
|
|
11
11
|
import { PickOptional } from '../../helpers/typeUtils';
|
|
12
12
|
|
|
13
|
-
export interface
|
|
13
|
+
export interface ToolbarLabelGroupContentProps extends React.HTMLProps<HTMLDivElement> {
|
|
14
14
|
/** Classes applied to root element of the data toolbar content row */
|
|
15
15
|
className?: string;
|
|
16
16
|
/** Flag indicating if a data toolbar toggle group's expandable content is expanded */
|
|
17
17
|
isExpanded?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/** Label group content reference for passing to data toolbar children */
|
|
19
|
+
labelGroupContentRef?: RefObject<any>;
|
|
20
20
|
/** optional callback for clearing all filters in the toolbar */
|
|
21
21
|
clearAllFilters?: () => void;
|
|
22
22
|
/** Flag indicating that the clear all filters button should be visible */
|
|
@@ -27,15 +27,15 @@ export interface ToolbarChipGroupContentProps extends React.HTMLProps<HTMLDivEle
|
|
|
27
27
|
numberOfFilters: number;
|
|
28
28
|
/** Text to display in the total number of applied filters ToolbarFilter */
|
|
29
29
|
numberOfFiltersText?: (numberOfFilters: number) => string;
|
|
30
|
-
/** The breakpoint at which the listed filters in
|
|
30
|
+
/** The breakpoint at which the listed filters in label groups are collapsed down to a summary */
|
|
31
31
|
collapseListedFiltersBreakpoint?: 'all' | 'md' | 'lg' | 'xl' | '2xl';
|
|
32
|
-
/** Custom additional content appended to the generated
|
|
33
|
-
|
|
32
|
+
/** Custom additional content appended to the generated labels. To maintain spacing and styling, each node should be a ToolbarItem or ToolbarGroup. This property will remove the built in "Clear all filters" button. */
|
|
33
|
+
customLabelGroupContent?: React.ReactNode;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
class
|
|
37
|
-
static displayName = '
|
|
38
|
-
static defaultProps: PickOptional<
|
|
36
|
+
class ToolbarLabelGroupContent extends React.Component<ToolbarLabelGroupContentProps> {
|
|
37
|
+
static displayName = 'ToolbarLabelGroupContent';
|
|
38
|
+
static defaultProps: PickOptional<ToolbarLabelGroupContentProps> = {
|
|
39
39
|
clearFiltersButtonText: 'Clear all filters',
|
|
40
40
|
collapseListedFiltersBreakpoint: 'lg',
|
|
41
41
|
numberOfFiltersText: (numberOfFilters: number) => `${numberOfFilters} filters applied`
|
|
@@ -45,18 +45,18 @@ class ToolbarChipGroupContent extends React.Component<ToolbarChipGroupContentPro
|
|
|
45
45
|
const {
|
|
46
46
|
className,
|
|
47
47
|
isExpanded,
|
|
48
|
-
|
|
48
|
+
labelGroupContentRef,
|
|
49
49
|
clearAllFilters,
|
|
50
50
|
showClearFiltersButton,
|
|
51
51
|
clearFiltersButtonText,
|
|
52
52
|
collapseListedFiltersBreakpoint,
|
|
53
53
|
numberOfFilters,
|
|
54
54
|
numberOfFiltersText,
|
|
55
|
-
|
|
55
|
+
customLabelGroupContent,
|
|
56
56
|
...props
|
|
57
57
|
} = this.props;
|
|
58
58
|
|
|
59
|
-
const
|
|
59
|
+
const clearLabelGroups = () => {
|
|
60
60
|
clearAllFilters();
|
|
61
61
|
};
|
|
62
62
|
|
|
@@ -74,7 +74,7 @@ class ToolbarChipGroupContent extends React.Component<ToolbarChipGroupContentPro
|
|
|
74
74
|
<div
|
|
75
75
|
className={css(styles.toolbarContent, isHidden && styles.modifiers.hidden, className)}
|
|
76
76
|
{...((numberOfFilters === 0 || isExpanded) && { hidden: true })}
|
|
77
|
-
ref={
|
|
77
|
+
ref={labelGroupContentRef}
|
|
78
78
|
{...props}
|
|
79
79
|
>
|
|
80
80
|
<ToolbarGroup
|
|
@@ -87,17 +87,17 @@ class ToolbarChipGroupContent extends React.Component<ToolbarChipGroupContentPro
|
|
|
87
87
|
<ToolbarItem>{numberOfFiltersText(numberOfFilters)}</ToolbarItem>
|
|
88
88
|
</ToolbarGroup>
|
|
89
89
|
)}
|
|
90
|
-
{showClearFiltersButton && !isExpanded && !
|
|
90
|
+
{showClearFiltersButton && !isExpanded && !customLabelGroupContent && (
|
|
91
91
|
<ToolbarItem>
|
|
92
|
-
<Button variant="link" onClick={
|
|
92
|
+
<Button variant="link" onClick={clearLabelGroups} isInline>
|
|
93
93
|
{clearFiltersButtonText}
|
|
94
94
|
</Button>
|
|
95
95
|
</ToolbarItem>
|
|
96
96
|
)}
|
|
97
|
-
{
|
|
97
|
+
{customLabelGroupContent && customLabelGroupContent}
|
|
98
98
|
</div>
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
export {
|
|
103
|
+
export { ToolbarLabelGroupContent };
|
|
@@ -149,8 +149,8 @@ export interface ToolbarToggleGroupProps extends ToolbarGroupProps {
|
|
|
149
149
|
| 'rowGap_3xl'
|
|
150
150
|
| 'rowGap_4xl';
|
|
151
151
|
};
|
|
152
|
-
/** Reference to a
|
|
153
|
-
|
|
152
|
+
/** Reference to a label container group for filters inside the toolbar toggle group */
|
|
153
|
+
labelContainerRef?: React.RefObject<any>;
|
|
154
154
|
/** Optional callback for clearing all filters in the toolbar toggle group */
|
|
155
155
|
clearAllFilters?: () => void;
|
|
156
156
|
/** Flag indicating that the clear all filters button should be visible in the toolbar toggle group */
|
|
@@ -184,7 +184,7 @@ class ToolbarToggleGroup extends React.Component<ToolbarToggleGroupProps> {
|
|
|
184
184
|
children,
|
|
185
185
|
isExpanded,
|
|
186
186
|
onToggle,
|
|
187
|
-
|
|
187
|
+
labelContainerRef,
|
|
188
188
|
clearAllFilters,
|
|
189
189
|
showClearFiltersButton,
|
|
190
190
|
clearFiltersButtonText,
|
|
@@ -208,15 +208,15 @@ class ToolbarToggleGroup extends React.Component<ToolbarToggleGroupProps> {
|
|
|
208
208
|
{({
|
|
209
209
|
expandableContentRef,
|
|
210
210
|
expandableContentId,
|
|
211
|
-
|
|
211
|
+
labelContainerRef: managedLabelContainerRef,
|
|
212
212
|
isExpanded: managedIsExpanded,
|
|
213
213
|
clearAllFilters: clearAllFiltersContext,
|
|
214
214
|
clearFiltersButtonText: clearFiltersButtonContext,
|
|
215
215
|
showClearFiltersButton: showClearFiltersButtonContext
|
|
216
216
|
}) => {
|
|
217
217
|
const _isExpanded = isExpanded !== undefined ? isExpanded : managedIsExpanded;
|
|
218
|
-
const
|
|
219
|
-
|
|
218
|
+
const _labelContainerRef =
|
|
219
|
+
labelContainerRef !== undefined ? labelContainerRef : managedLabelContainerRef;
|
|
220
220
|
|
|
221
221
|
const breakpointMod: {
|
|
222
222
|
md?: 'show';
|
|
@@ -234,7 +234,7 @@ class ToolbarToggleGroup extends React.Component<ToolbarToggleGroupProps> {
|
|
|
234
234
|
clearAllFilters={clearAllFilters || clearAllFiltersContext}
|
|
235
235
|
showClearFiltersButton={showClearFiltersButton || showClearFiltersButtonContext}
|
|
236
236
|
clearFiltersButtonText={clearFiltersButtonText || clearFiltersButtonContext}
|
|
237
|
-
|
|
237
|
+
labelContainerRef={_labelContainerRef}
|
|
238
238
|
>
|
|
239
239
|
{children}
|
|
240
240
|
</ToolbarExpandableContent>
|
|
@@ -8,20 +8,20 @@ import globalBreakpoint2xl from '@patternfly/react-tokens/dist/esm/global_breakp
|
|
|
8
8
|
export interface ToolbarContextProps {
|
|
9
9
|
isExpanded: boolean;
|
|
10
10
|
toggleIsExpanded: () => void;
|
|
11
|
-
|
|
11
|
+
labelGroupContentRef: RefObject<HTMLDivElement>;
|
|
12
12
|
updateNumberFilters: (categoryName: string, numberOfFilters: number) => void;
|
|
13
13
|
numberOfFilters: number;
|
|
14
14
|
clearAllFilters?: () => void;
|
|
15
15
|
clearFiltersButtonText?: string;
|
|
16
16
|
showClearFiltersButton?: boolean;
|
|
17
17
|
toolbarId?: string;
|
|
18
|
-
|
|
18
|
+
customLabelGroupContent?: React.ReactNode;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export const ToolbarContext = React.createContext<ToolbarContextProps>({
|
|
22
22
|
isExpanded: false,
|
|
23
23
|
toggleIsExpanded: () => {},
|
|
24
|
-
|
|
24
|
+
labelGroupContentRef: null,
|
|
25
25
|
updateNumberFilters: () => {},
|
|
26
26
|
numberOfFilters: 0,
|
|
27
27
|
clearAllFilters: () => {}
|
|
@@ -30,7 +30,7 @@ export const ToolbarContext = React.createContext<ToolbarContextProps>({
|
|
|
30
30
|
interface ToolbarContentContextProps {
|
|
31
31
|
expandableContentRef: RefObject<HTMLDivElement>;
|
|
32
32
|
expandableContentId: string;
|
|
33
|
-
|
|
33
|
+
labelContainerRef: RefObject<any>;
|
|
34
34
|
isExpanded?: boolean;
|
|
35
35
|
clearAllFilters?: () => void;
|
|
36
36
|
clearFiltersButtonText?: string;
|
|
@@ -40,7 +40,7 @@ interface ToolbarContentContextProps {
|
|
|
40
40
|
export const ToolbarContentContext = React.createContext<ToolbarContentContextProps>({
|
|
41
41
|
expandableContentRef: null,
|
|
42
42
|
expandableContentId: '',
|
|
43
|
-
|
|
43
|
+
labelContainerRef: null,
|
|
44
44
|
clearAllFilters: () => {}
|
|
45
45
|
});
|
|
46
46
|
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { render } from '@testing-library/react';
|
|
6
|
-
import {
|
|
6
|
+
import { ToolbarLabelGroupContent } from '../../ToolbarLabelGroupContent';
|
|
7
7
|
// any missing imports can usually be resolved by adding them here
|
|
8
8
|
import {} from '../..';
|
|
9
9
|
|
|
10
|
-
it('
|
|
10
|
+
it('ToolbarLabelGroupContent should match snapshot (auto-generated)', () => {
|
|
11
11
|
const { asFragment } = render(
|
|
12
|
-
<
|
|
12
|
+
<ToolbarLabelGroupContent
|
|
13
13
|
className={'string'}
|
|
14
14
|
isExpanded={true}
|
|
15
|
-
|
|
15
|
+
labelGroupContentRef={{ current: document.createElement('div') }}
|
|
16
16
|
clearAllFilters={() => undefined as void}
|
|
17
17
|
showClearFiltersButton={true}
|
|
18
18
|
clearFiltersButtonText={"'Clear all filters'"}
|