/* eslint-disable */ // @ts-nocheck import { TextControl } from "../../../shared/keycloak-ui-shared"; import { Form, ModalVariant } from "../../../shared/@patternfly/react-core"; import { ConfirmDialogModal } from "../../components/confirm-dialog/ConfirmDialog"; import { useTranslation } from "react-i18next"; import { FormProvider, useForm, useWatch } from "react-hook-form"; import { useEffect } from "react"; type FileNameDialogProps = { onSave: ( themeName: string, fileName: string, themeDescription: string, ) => void; onClose: () => void; }; type FormValues = { themeName: string; fileName: string; themeDescription: string; }; export const FileNameDialog = ({ onSave, onClose }: FileNameDialogProps) => { const { t } = useTranslation(); const form = useForm({ defaultValues: { themeName: "quick-theme", fileName: "quick-theme.jar", themeDescription: t("themeDescriptionDefault"), }, }); const { handleSubmit, setValue, control } = form; const themeName = useWatch({ control, name: "themeName" }); // Auto-update fileName when themeName changes useEffect(() => { setValue("fileName", `${themeName.trim()}.jar`); }, [themeName, setValue]); const save = ({ themeName, fileName, themeDescription }: FormValues) => onSave(themeName, fileName, themeDescription); return ( handleSubmit(save)()} >
); };