import React, { PureComponent } from 'react';
import classNames from 'classnames';
import { SoftButtonEmpty, } from '../ButtonEmpty';
import { SoftI18n } from '../I18n';
export class SoftCardSelect extends PureComponent {
    render() {
        let { className, onClick, isSelected, isDisabled, color, children, ...rest } = this.props;
        const child = SoftCardSelectableText(isSelected, isDisabled, children);
        const selectClasses = classNames('softCardSelect', `softCardSelect--${SoftCardSelectableColor(color, isSelected)}`, className);
        return (React.createElement(SoftButtonEmpty, Object.assign({ className: selectClasses, color: color || 'text', size: "xs", onClick: onClick, isDisabled: isDisabled, iconType: isSelected ? 'check' : undefined }, rest), child));
    }
}
function SoftCardSelectableText(isSelected, isDisabled, children) {
    if (children) {
        return children;
    }
    let text;
    if (isSelected) {
        text = React.createElement(SoftI18n, { token: "softCardSelect.selected", default: "Selected" });
    }
    else if (isDisabled) {
        text = React.createElement(SoftI18n, { token: "softCardSelect.unavailable", default: "Unavailable" });
    }
    else {
        text = React.createElement(SoftI18n, { token: "softCardSelect.select", default: "Select" });
    }
    return text;
}
export function SoftCardSelectableColor(color, isSelected) {
    let calculatedColor;
    if (color) {
        calculatedColor = color;
    }
    else if (isSelected) {
        calculatedColor = 'success';
    }
    else {
        calculatedColor = 'text';
    }
    return calculatedColor;
}
//# sourceMappingURL=SoftCardSelect.js.map