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