import { jsx } from 'react/jsx-runtime';
import * as React from 'react';
import classNames from '../../../../_virtual/index.js';
import { selectEntireWorksheet } from './actions.js';
import { EntireWorksheetSelection } from './selection.js';
import useDispatch from './use-dispatch.js';
import useSelector from './use-selector.js';
import Icon from '../../../Icon/Icon.js';

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" }) }) }));
};
const enhance = (CornerIndicatorComponent) => {
    return function CornerIndicatorWrapper(props) {
        const dispatch = useDispatch();
        const selectEntireWorksheet$1 = React.useCallback(() => dispatch(selectEntireWorksheet()), [dispatch]);
        const selected = useSelector((state) => state.selected instanceof EntireWorksheetSelection);
        return (jsx(CornerIndicatorComponent, { ...props, selected: selected, onSelect: selectEntireWorksheet$1 }));
    };
};

export { CornerIndicator as default, enhance };
//# sourceMappingURL=CornerIndicator.js.map
