import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { SoftContextMenuItem } from '../../ContextMenu';
export class SoftTableSortMobileItem extends PureComponent {
    render() {
        let { children, onSort, isSorted, isSortAscending, className, ariaLabel, ...rest } = this.props;
        let sortIcon = 'empty';
        if (isSorted) {
            sortIcon = isSortAscending ? 'sortUp' : 'sortDown';
        }
        const buttonClasses = classNames('softTableSortMobileItem', className, {
            'softTableSortMobileItem-isSorted': isSorted,
        });
        const columnTitle = ariaLabel ? ariaLabel : children;
        const statefulAriaLabel = `Sort ${columnTitle} ${isSortAscending ? 'descending' : 'ascending'}`;
        return (React.createElement(SoftContextMenuItem, Object.assign({ className: buttonClasses, icon: sortIcon, onClick: onSort, "aria-label": statefulAriaLabel }, rest), children));
    }
}
SoftTableSortMobileItem.propTypes = {
    children: PropTypes.node,
    className: PropTypes.string,
    /**
     * Callback to know when an item has been clicked
     */
    onSort: PropTypes.func,
    /**
     * Indicates current option is the sorted on column
     */
    isSorted: PropTypes.bool,
    /**
     * Indicates which direction the current column is sorted on
     */
    isSortAscending: PropTypes.bool,
};
//# sourceMappingURL=SoftTableSortMobileItem.js.map