| 1 |
import { __rest } from "tslib"; |
| 2 |
import { jsx as _jsx } from "react/jsx-runtime"; |
| 3 |
import { Component, createRef } from 'react'; |
| 4 |
import styles from '@patternfly/react-styles/css/components/Toolbar/toolbar.mjs'; |
| 5 |
import { css } from '@patternfly/react-styles'; |
| 6 |
import { ToolbarContentContext, ToolbarContext } from './ToolbarUtils'; |
| 7 |
import { formatBreakpointMods } from '../../helpers/util'; |
| 8 |
import { PageContext } from '../Page/PageContext'; |
| 9 |
class ToolbarContent extends Component { |
| 10 |
constructor() { |
| 11 |
super(...arguments); |
| 12 |
this.expandableContentRef = createRef(); |
| 13 |
this.labelContainerRef = createRef(); |
| 14 |
} |
| 15 |
render() { |
| 16 |
const _a = this.props, { className, children, isExpanded, toolbarId, visibility, visibilityAtHeight, rowWrap, alignItems, clearAllFilters, showClearFiltersButton, clearFiltersButtonText } = _a, props = __rest(_a, ["className", "children", "isExpanded", "toolbarId", "visibility", "visibilityAtHeight", "rowWrap", "alignItems", "clearAllFilters", "showClearFiltersButton", "clearFiltersButtonText"]); |
| 17 |
return (_jsx(PageContext.Consumer, { children: ({ width, getBreakpoint, height, getVerticalBreakpoint }) => (_jsx("div", Object.assign({ className: css(styles.toolbarContent, formatBreakpointMods(visibility, styles, '', getBreakpoint(width)), formatBreakpointMods(visibilityAtHeight, styles, '', getVerticalBreakpoint(height), true), className), ref: this.expandableContentRef }, props, { children: _jsx(ToolbarContext.Consumer, { children: ({ clearAllFilters: clearAllFiltersContext, clearFiltersButtonText: clearFiltersButtonContext, showClearFiltersButton: showClearFiltersButtonContext, isExpanded: isExpandedContext, toolbarId: toolbarIdContext }) => { |
| 18 |
const expandableContentId = `${toolbarId || toolbarIdContext}-expandable-content-${ToolbarContent.currentId++}`; |
| 19 |
return (_jsx(ToolbarContentContext.Provider, { value: { |
| 20 |
expandableContentRef: this.expandableContentRef, |
| 21 |
expandableContentId, |
| 22 |
labelContainerRef: this.labelContainerRef, |
| 23 |
isExpanded: isExpanded || isExpandedContext, |
| 24 |
clearAllFilters: clearAllFilters || clearAllFiltersContext, |
| 25 |
clearFiltersButtonText: clearFiltersButtonText || clearFiltersButtonContext, |
| 26 |
showClearFiltersButton: showClearFiltersButton || showClearFiltersButtonContext |
| 27 |
}, children: _jsx("div", { className: css(styles.toolbarContentSection, formatBreakpointMods(rowWrap, styles, '', getBreakpoint(width)), alignItems === 'center' && styles.modifiers.alignItemsCenter, alignItems === 'start' && styles.modifiers.alignItemsStart, alignItems === 'baseline' && styles.modifiers.alignItemsBaseline), children: children }) })); |
| 28 |
} }) }))) })); |
| 29 |
} |
| 30 |
} |
| 31 |
ToolbarContent.displayName = 'ToolbarContent'; |
| 32 |
ToolbarContent.currentId = 0; |
| 33 |
ToolbarContent.defaultProps = { |
| 34 |
isExpanded: false, |
| 35 |
showClearFiltersButton: false |
| 36 |
}; |
| 37 |
export { ToolbarContent }; |
| 38 |
//# sourceMappingURL=ToolbarContent.js.map |