import { jsx as _jsx } from "react/jsx-runtime";
import * as React from 'react';
import classNames from 'classnames';
import * as Actions from './actions';
import { EntireWorksheetSelection } from './selection';
import useDispatch from './use-dispatch';
import useSelector from './use-selector';
import Icon from '../../../Icon';
const CornerIndicator = ({ selected, onSelect, }) => {
    const handleClick = React.useCallback(() => {
        onSelect();
    }, [onSelect]);
    return (_jsx("th", { className: 'ff-spreadsheet-corner-header', onClick: handleClick, tabIndex: 0, children: _jsx("div", { className: classNames('corner-header', {
                'ff-spreadsheet-header--selected': selected,
            }), children: _jsx(Icon, { variant: selected ? 'dark' : 'light', color: selected ? 'var(--hover-color)' : 'var(--text-color)', name: "excel_corner_menu" }) }) }));
};
export default CornerIndicator;
export const enhance = (CornerIndicatorComponent) => {
    return function CornerIndicatorWrapper(props) {
        const dispatch = useDispatch();
        const selectEntireWorksheet = React.useCallback(() => dispatch(Actions.selectEntireWorksheet()), [dispatch]);
        const selected = useSelector((state) => state.selected instanceof EntireWorksheetSelection);
        return (_jsx(CornerIndicatorComponent, { ...props, selected: selected, onSelect: selectEntireWorksheet }));
    };
};
//# sourceMappingURL=CornerIndicator.js.map