import React, { type ComponentPropsWithoutRef, type FC } from 'react'; import { useForm } from 'react-hook-form'; import { CiLock, CiUser } from 'react-icons/ci'; import { PiBuildingsThin } from 'react-icons/pi'; import { ReactHookForm } from '../../react-hook-form'; export type LoginFormData = { org?: string; ticket?: string; password: string; username: string; remember?: boolean; }; export interface LoginFormProps extends Omit, 'onSubmit'> { onSubmit?: (data: LoginFormData) => void; defaultValues?: Partial; showOrg?: boolean; orgValue?: string; onForgetPassword?: () => void; onRegister?: () => void; } export const LoginPageForm: FC = ({ onSubmit = () => undefined, defaultValues, showOrg, orgValue, onForgetPassword, onRegister, className, ...props }) => { const methods = useForm({ defaultValues, }); const { register, handleSubmit, formState: { isValid, isSubmitting }, } = methods; return (
{showOrg && (
)}
{onForgetPassword && (
)}
); };