import { SortDirection } from '@essex/arquero';
import { useCallback } from 'react';
export function useHandleColumnChange(order, onChange) {
    return useCallback((_e, opt)=>{
        const update = {
            ...order,
            column: opt?.key
        };
        onChange?.(update);
    }, [
        order,
        onChange
    ]);
}
export function useHandleDirectionClick(order, onChange) {
    return useCallback(()=>{
        const update = {
            ...order,
            direction: order.direction === SortDirection.Descending ? SortDirection.Ascending : SortDirection.Descending
        };
        onChange?.(update);
    }, [
        order,
        onChange
    ]);
}
