import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { SoftBetaBadge } from '../Badge';
const paddingSizeToClassNameMap = {
    none: null,
    s: 'softPanel--paddingSmall',
    m: 'softPanel--paddingMedium',
    l: 'softPanel--paddingLarge',
};
export const SOFT_PANEL_SIZES = Object.keys(paddingSizeToClassNameMap);
export class SoftPanel extends PureComponent {
    render() {
        let { children, className, paddingSize, hasShadow, grow, panelRef, onClick, betaBadgeLabel, betaBadgeTooltipContent, betaBadgeTitle, ...rest } = this.props;
        const classes = classNames('softPanel', paddingSizeToClassNameMap[paddingSize], {
            'softPanel--shadow': hasShadow,
            'softPanel--flexGrowZero': !grow,
            'softPanel--isClickable': onClick,
            'softPanel--hasBetaBadge': betaBadgeLabel,
        }, className);
        const PanelTag = onClick ? 'button' : 'div';
        const props = {
            ref: panelRef,
            className: classes,
        };
        // Avoid passing down this prop if it hasn't been supplied, in order to
        // avoid noise in react-test-renderer snapshots.
        if (onClick != null) {
            props.onClick = onClick;
        }
        let optionalBetaBadge;
        if (betaBadgeLabel) {
            optionalBetaBadge = (React.createElement("span", { className: "softPanel__betaBadgeWrapper" },
                React.createElement(SoftBetaBadge, { label: betaBadgeLabel, title: betaBadgeTitle, tooltipContent: betaBadgeTooltipContent, className: "softPanel__betaBadge" })));
        }
        return (React.createElement(PanelTag, Object.assign({}, props, rest),
            optionalBetaBadge,
            children));
    }
}
SoftPanel.defaultProps = {
    paddingSize: 'm',
    hasShadow: false,
    grow: true,
};
SoftPanel.propTypes = {
    children: PropTypes.node,
    className: PropTypes.string,
    /**
     * If active, adds a deeper shadow to the panel
     */
    hasShadow: PropTypes.bool,
    /**
     * Padding applied to the panel
     */
    paddingSize: PropTypes.oneOf(SOFT_PANEL_SIZES),
    /**
     * When true the panel will grow to match `SoftFlexItem`
     */
    grow: PropTypes.bool,
    panelRef: PropTypes.func,
    onClick: PropTypes.func,
    /**
     * Add a badge to the panel to label it as "Beta" or other non-GA state
     */
    betaBadgeLabel: PropTypes.string,
    /**
     * Add a description to the beta badge (will appear in a tooltip)
     */
    betaBadgeTooltipContent: PropTypes.node,
    /**
     * Optional title will be supplied as tooltip title or title attribute otherwise the label will be used
     */
    betaBadgeTitle: PropTypes.string,
};
//# sourceMappingURL=SoftPanel.js.map