import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useCallback } from "react";
import { RiFile2Line } from "react-icons/ri";
import { useDictionary } from "../../../../i18n/dictionary.js";
export const AddFileButton = (props) => {
    const dict = useDictionary();
    // Prevents focus from moving to the button.
    const addFileButtonMouseDownHandler = useCallback((event) => {
        event.preventDefault();
    }, []);
    // Opens the file toolbar.
    const addFileButtonClickHandler = useCallback(() => {
        props.editor.dispatch(props.editor._tiptapEditor.state.tr.setMeta(props.editor.filePanel.plugin, {
            block: props.block,
        }));
    }, [props.block, props.editor]);
    return (_jsxs("div", { className: "bn-add-file-button", onMouseDown: addFileButtonMouseDownHandler, onClick: addFileButtonClickHandler, children: [_jsx("div", { className: "bn-add-file-button-icon", children: props.buttonIcon || _jsx(RiFile2Line, { size: 24 }) }), _jsx("div", { className: "bn-add-file-button-text", children: props.buttonText || dict.file_blocks.file.add_button_text })] }));
};
//# sourceMappingURL=AddFileButton.js.map