import React, { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { Field, Form } from '../../../../utilities/form';
import { FluentTextField } from '../../../../UI/inputs/textField';
const UdpTransactionAttachmentTypeForm = (props, ref) => {
    const { onSubmit, initialData } = props;
    const handleSubmitRef = useRef();
    const { t } = useTranslation();
    useImperativeHandle(ref, () => ({
        submit: () => {
            // eslint-disable-next-line no-unused-expressions
            handleSubmitRef === null || handleSubmitRef === void 0 ? void 0 : handleSubmitRef.current();
        }
    }));
    const handleSubmit = useCallback(formData => {
        onSubmit(formData, initialData);
    }, [initialData, onSubmit]);
    return (React.createElement(Form, { onSubmit: handleSubmit, render: ({ handleSubmit }) => {
            handleSubmitRef.current = handleSubmit;
            return (React.createElement(React.Fragment, null, React.createElement(Field, { component: FluentTextField, label: t("Name"), id: "name", name: "name", fullWidth: true, variant: "outlined", margin: "normal", size: "small", required: true, initialValue: (initialData === null || initialData === void 0 ? void 0 : initialData.name) || '' })));
        } }));
};
export default forwardRef(UdpTransactionAttachmentTypeForm);
//# sourceMappingURL=UdpTransactionAttachmentTypeForm.js.map