"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useLogic = void 0;
const useForwardedRef_1 = require("../../../useForwardedRef");
const useLogic = ({ value, disabled, inputRef: externalInputRef, onChange, }) => {
    const inputRef = (0, useForwardedRef_1.useForwardedRef)(externalInputRef);
    const handleClearAll = (event) => {
        event.stopPropagation();
        onChange?.(null);
        inputRef.current?.focus();
    };
    const isVisibleClearButton = !disabled && Boolean(value);
    return {
        inputRef,
        isVisibleClearButton,
        handleClearAll,
    };
};
exports.useLogic = useLogic;
