import classNames from 'classnames';
import { keysOf } from "../../libraries";
import { SoftTextColor } from './SoftTextColor';
import { SoftTextAlign } from './SoftTextAlign';
import * as React from "react";
import { PureComponent } from "react";
import PropTypes from 'prop-types';
const textSizeToClassNameMap = {
    xs: 'softText--extraSmall',
    s: 'softText--small',
    m: 'softText--medium',
};
export const SOFT_TEXT_SIZES = keysOf(textSizeToClassNameMap);
export class SoftText extends PureComponent {
    render() {
        let { size, color, grow, textAlign, children, className, ...rest } = this.props;
        const classes = classNames('softText', textSizeToClassNameMap[size], className, {
            'softText--constrainedWidth': !grow,
        });
        let optionallyAlteredText;
        if (color) {
            optionallyAlteredText = (React.createElement(SoftTextColor, { color: color, component: "div" }, children));
        }
        if (textAlign) {
            optionallyAlteredText = (React.createElement(SoftTextAlign, { textAlign: textAlign }, optionallyAlteredText || children));
        }
        return (React.createElement("div", Object.assign({ className: classes }, rest), optionallyAlteredText || children));
    }
}
SoftText.defaultProps = { size: 'm', grow: true };
SoftTextColor.propTypes = {
    size: PropTypes.string,
    color: PropTypes.string,
    textAlign: PropTypes.string,
    grow: PropTypes.bool,
    children: PropTypes.node,
    className: PropTypes.string
};
//# sourceMappingURL=SoftText.js.map