import { useForwardedRef } from '../../../useForwardedRef';
export const useLogic = ({ value, disabled, inputRef: externalInputRef, onChange, }) => {
    const inputRef = useForwardedRef(externalInputRef);
    const handleClearAll = (event) => {
        event.stopPropagation();
        onChange?.('');
        inputRef.current?.focus();
    };
    const isVisibleClearButton = !disabled && Boolean(value);
    return {
        inputRef,
        isVisibleClearButton,
        handleClearAll,
    };
};
