| 1 |
import { __rest } from "tslib"; |
| 2 |
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; |
| 3 |
import { Component } from 'react'; |
| 4 |
import styles from '@patternfly/react-styles/css/components/Toolbar/toolbar.mjs'; |
| 5 |
import { css } from '@patternfly/react-styles'; |
| 6 |
import { ToolbarGroup } from './ToolbarGroup'; |
| 7 |
import { ToolbarItem } from './ToolbarItem'; |
| 8 |
import { Button } from '../Button'; |
| 9 |
import { ToolbarContext } from './ToolbarUtils'; |
| 10 |
class ToolbarExpandableContent extends Component { |
| 11 |
render() { |
| 12 |
const _a = this.props, { children, className, expandableContentRef, labelContainerRef, isExpanded, clearAllFilters, clearFiltersButtonText, showClearFiltersButton } = _a, props = __rest(_a, ["children", "className", "expandableContentRef", "labelContainerRef", "isExpanded", "clearAllFilters", "clearFiltersButtonText", "showClearFiltersButton"]); |
| 13 |
const { numberOfFilters, customLabelGroupContent } = this.context; |
| 14 |
const clearLabelGroups = () => { |
| 15 |
clearAllFilters(); |
| 16 |
}; |
| 17 |
return (_jsxs("div", Object.assign({ className: css(styles.toolbarExpandableContent, isExpanded && styles.modifiers.expanded, className), ref: expandableContentRef }, props, { children: [_jsx(ToolbarGroup, { children: children }), numberOfFilters > 0 && (_jsxs(ToolbarGroup, { children: [_jsx(ToolbarGroup, { ref: labelContainerRef }), showClearFiltersButton && !customLabelGroupContent && (_jsx(ToolbarItem, { children: _jsx(Button, { variant: "link", onClick: clearLabelGroups, isInline: true, children: clearFiltersButtonText }) })), customLabelGroupContent && customLabelGroupContent] }))] }))); |
| 18 |
} |
| 19 |
} |
| 20 |
ToolbarExpandableContent.displayName = 'ToolbarExpandableContent'; |
| 21 |
ToolbarExpandableContent.contextType = ToolbarContext; |
| 22 |
ToolbarExpandableContent.defaultProps = { |
| 23 |
isExpanded: false, |
| 24 |
clearFiltersButtonText: 'Clear all filters' |
| 25 |
}; |
| 26 |
export { ToolbarExpandableContent }; |
| 27 |
//# sourceMappingURL=ToolbarExpandableContent.js.map |