1 | import { __rest } from "tslib";
|
2 | import * as React from 'react';
|
3 | import styles from '@patternfly/react-styles/css/components/Toolbar/toolbar';
|
4 | import { css } from '@patternfly/react-styles';
|
5 | import { ToolbarGroup } from './ToolbarGroup';
|
6 | import { ToolbarItem } from './ToolbarItem';
|
7 | import { Button } from '../Button';
|
8 | import { ToolbarContext } from './ToolbarUtils';
|
9 | export class ToolbarExpandableContent extends React.Component {
|
10 | render() {
|
11 | const _a = this.props, { className, expandableContentRef, chipContainerRef,
|
12 |
|
13 | isExpanded, clearAllFilters, clearFiltersButtonText, showClearFiltersButton } = _a, props = __rest(_a, ["className", "expandableContentRef", "chipContainerRef", "isExpanded", "clearAllFilters", "clearFiltersButtonText", "showClearFiltersButton"]);
|
14 | const { numberOfFilters, customChipGroupContent } = this.context;
|
15 | const clearChipGroups = () => {
|
16 | clearAllFilters();
|
17 | };
|
18 | return (React.createElement("div", Object.assign({ className: css(styles.toolbarExpandableContent, className), ref: expandableContentRef }, props),
|
19 | React.createElement(ToolbarGroup, null),
|
20 | numberOfFilters > 0 && (React.createElement(ToolbarGroup, { className: styles.modifiers.chipContainer },
|
21 | React.createElement(ToolbarGroup, { ref: chipContainerRef }),
|
22 | showClearFiltersButton && !customChipGroupContent && (React.createElement(ToolbarItem, null,
|
23 | React.createElement(Button, { variant: "link", onClick: clearChipGroups, isInline: true }, clearFiltersButtonText))),
|
24 | customChipGroupContent && customChipGroupContent))));
|
25 | }
|
26 | }
|
27 | ToolbarExpandableContent.displayName = 'ToolbarExpandableContent';
|
28 | ToolbarExpandableContent.contextType = ToolbarContext;
|
29 | ToolbarExpandableContent.defaultProps = {
|
30 | isExpanded: false,
|
31 | clearFiltersButtonText: 'Clear all filters'
|
32 | };
|
33 |
|
\ | No newline at end of file |