1 | import { __rest } from "tslib";
|
2 | import * as React from 'react';
|
3 | import styles from '@patternfly/react-styles/css/components/MenuToggle/menu-toggle';
|
4 | import { css } from '@patternfly/react-styles';
|
5 | import CaretDownIcon from '@patternfly/react-icons/dist/esm/icons/caret-down-icon';
|
6 | export class MenuToggleBase extends React.Component {
|
7 | constructor() {
|
8 | super(...arguments);
|
9 | this.displayName = 'MenuToggleBase';
|
10 | }
|
11 | render() {
|
12 | const _a = this.props, { children, className, icon, badge, isExpanded, isDisabled, isFullHeight, isFullWidth, variant, innerRef } = _a, props = __rest(_a, ["children", "className", "icon", "badge", "isExpanded", "isDisabled", "isFullHeight", "isFullWidth", "variant", "innerRef"]);
|
13 | const isPlain = variant === 'plain';
|
14 | const isPlainText = variant === 'plainText';
|
15 | const content = (React.createElement(React.Fragment, null,
|
16 | icon && React.createElement("span", { className: css(styles.menuToggleIcon) }, icon),
|
17 | React.createElement("span", { className: "pf-c-menu-toggle__text" }, children),
|
18 | badge && React.createElement("span", { className: css(styles.menuToggleCount) }, badge),
|
19 | React.createElement("span", { className: css(styles.menuToggleControls) },
|
20 | React.createElement("span", { className: css(styles.menuToggleToggleIcon) },
|
21 | React.createElement(CaretDownIcon, { "aria-hidden": true })))));
|
22 | return (React.createElement("button", Object.assign({ className: css(styles.menuToggle, isExpanded && styles.modifiers.expanded, variant === 'primary' && styles.modifiers.primary, variant === 'secondary' && styles.modifiers.secondary, (isPlain || isPlainText) && styles.modifiers.plain, isPlainText && styles.modifiers.text, isFullHeight && styles.modifiers.fullHeight, isFullWidth && styles.modifiers.fullWidth, className), type: "button", "aria-expanded": false, ref: innerRef }, (isExpanded && { 'aria-expanded': true }), (isDisabled && { disabled: true }), props),
|
23 | isPlain && children,
|
24 | !isPlain && content));
|
25 | }
|
26 | }
|
27 | MenuToggleBase.defaultProps = {
|
28 | className: '',
|
29 | isExpanded: false,
|
30 | isDisabled: false,
|
31 | isFullWidth: false,
|
32 | isFullHeight: false,
|
33 | variant: 'default'
|
34 | };
|
35 | export const MenuToggle = React.forwardRef((props, ref) => (React.createElement(MenuToggleBase, Object.assign({ innerRef: ref }, props))));
|
36 | MenuToggle.displayName = 'MenuToggle';
|
37 |
|
\ | No newline at end of file |