1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.ToolbarContent = void 0;
|
4 | const tslib_1 = require("tslib");
|
5 | const React = tslib_1.__importStar(require("react"));
|
6 | const toolbar_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/Toolbar/toolbar"));
|
7 | const react_styles_1 = require("@patternfly/react-styles");
|
8 | const ToolbarUtils_1 = require("./ToolbarUtils");
|
9 | const util_1 = require("../../helpers/util");
|
10 | const ToolbarExpandableContent_1 = require("./ToolbarExpandableContent");
|
11 | const Page_1 = require("../Page/Page");
|
12 | class ToolbarContent extends React.Component {
|
13 | constructor() {
|
14 | super(...arguments);
|
15 | this.expandableContentRef = React.createRef();
|
16 | this.chipContainerRef = React.createRef();
|
17 | }
|
18 | render() {
|
19 | const _a = this.props, { className, children, isExpanded, toolbarId, visibility, visiblity, alignment, clearAllFilters, showClearFiltersButton, clearFiltersButtonText } = _a, props = tslib_1.__rest(_a, ["className", "children", "isExpanded", "toolbarId", "visibility", "visiblity", "alignment", "clearAllFilters", "showClearFiltersButton", "clearFiltersButtonText"]);
|
20 | if (visiblity !== undefined) {
|
21 |
|
22 | console.warn('The ToolbarContent visiblity prop has been deprecated. ' +
|
23 | 'Please use the correctly spelled visibility prop instead.');
|
24 | }
|
25 | return (React.createElement(Page_1.PageContext.Consumer, null, ({ width, getBreakpoint }) => (React.createElement("div", Object.assign({ className: react_styles_1.css(toolbar_1.default.toolbarContent, util_1.formatBreakpointMods(visibility || visiblity, toolbar_1.default, '', getBreakpoint(width)), util_1.formatBreakpointMods(alignment, toolbar_1.default, '', getBreakpoint(width)), className) }, props),
|
26 | React.createElement(ToolbarUtils_1.ToolbarContext.Consumer, null, ({ clearAllFilters: clearAllFiltersContext, clearFiltersButtonText: clearFiltersButtonContext, showClearFiltersButton: showClearFiltersButtonContext, toolbarId: toolbarIdContext }) => {
|
27 | const expandableContentId = `${toolbarId ||
|
28 | toolbarIdContext}-expandable-content-${ToolbarContent.currentId++}`;
|
29 | return (React.createElement(ToolbarUtils_1.ToolbarContentContext.Provider, { value: {
|
30 | expandableContentRef: this.expandableContentRef,
|
31 | expandableContentId,
|
32 | chipContainerRef: this.chipContainerRef
|
33 | } },
|
34 | React.createElement("div", { className: react_styles_1.css(toolbar_1.default.toolbarContentSection) }, children),
|
35 | React.createElement(ToolbarExpandableContent_1.ToolbarExpandableContent, { id: expandableContentId, isExpanded: isExpanded, expandableContentRef: this.expandableContentRef, chipContainerRef: this.chipContainerRef, clearAllFilters: clearAllFilters || clearAllFiltersContext, showClearFiltersButton: showClearFiltersButton || showClearFiltersButtonContext, clearFiltersButtonText: clearFiltersButtonText || clearFiltersButtonContext })));
|
36 | })))));
|
37 | }
|
38 | }
|
39 | exports.ToolbarContent = ToolbarContent;
|
40 | ToolbarContent.displayName = 'ToolbarContent';
|
41 | ToolbarContent.currentId = 0;
|
42 | ToolbarContent.defaultProps = {
|
43 | isExpanded: false,
|
44 | showClearFiltersButton: false
|
45 | };
|
46 |
|
\ | No newline at end of file |