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 { ToolbarContentContext, ToolbarContext } from './ToolbarUtils';
|
6 | import { formatBreakpointMods } from '../../helpers/util';
|
7 | import { ToolbarExpandableContent } from './ToolbarExpandableContent';
|
8 | import { PageContext } from '../Page/Page';
|
9 | export class ToolbarContent extends React.Component {
|
10 | constructor() {
|
11 | super(...arguments);
|
12 | this.expandableContentRef = React.createRef();
|
13 | this.chipContainerRef = React.createRef();
|
14 | }
|
15 | render() {
|
16 | const _a = this.props, { className, children, isExpanded, toolbarId, visibility, visiblity, alignment, clearAllFilters, showClearFiltersButton, clearFiltersButtonText } = _a, props = __rest(_a, ["className", "children", "isExpanded", "toolbarId", "visibility", "visiblity", "alignment", "clearAllFilters", "showClearFiltersButton", "clearFiltersButtonText"]);
|
17 | if (visiblity !== undefined) {
|
18 |
|
19 | console.warn('The ToolbarContent visiblity prop has been deprecated. ' +
|
20 | 'Please use the correctly spelled visibility prop instead.');
|
21 | }
|
22 | return (React.createElement(PageContext.Consumer, null, ({ width, getBreakpoint }) => (React.createElement("div", Object.assign({ className: css(styles.toolbarContent, formatBreakpointMods(visibility || visiblity, styles, '', getBreakpoint(width)), formatBreakpointMods(alignment, styles, '', getBreakpoint(width)), className) }, props),
|
23 | React.createElement(ToolbarContext.Consumer, null, ({ clearAllFilters: clearAllFiltersContext, clearFiltersButtonText: clearFiltersButtonContext, showClearFiltersButton: showClearFiltersButtonContext, toolbarId: toolbarIdContext }) => {
|
24 | const expandableContentId = `${toolbarId ||
|
25 | toolbarIdContext}-expandable-content-${ToolbarContent.currentId++}`;
|
26 | return (React.createElement(ToolbarContentContext.Provider, { value: {
|
27 | expandableContentRef: this.expandableContentRef,
|
28 | expandableContentId,
|
29 | chipContainerRef: this.chipContainerRef
|
30 | } },
|
31 | React.createElement("div", { className: css(styles.toolbarContentSection) }, children),
|
32 | React.createElement(ToolbarExpandableContent, { id: expandableContentId, isExpanded: isExpanded, expandableContentRef: this.expandableContentRef, chipContainerRef: this.chipContainerRef, clearAllFilters: clearAllFilters || clearAllFiltersContext, showClearFiltersButton: showClearFiltersButton || showClearFiltersButtonContext, clearFiltersButtonText: clearFiltersButtonText || clearFiltersButtonContext })));
|
33 | })))));
|
34 | }
|
35 | }
|
36 | ToolbarContent.displayName = 'ToolbarContent';
|
37 | ToolbarContent.currentId = 0;
|
38 | ToolbarContent.defaultProps = {
|
39 | isExpanded: false,
|
40 | showClearFiltersButton: false
|
41 | };
|
42 |
|
\ | No newline at end of file |