import { Button } from '@gear-js/ui'; import { ReactNode } from 'react'; import { FieldValues, Path, useFormContext } from 'react-hook-form'; import { CSSTransition } from 'react-transition-group'; import { AnimationTimeout } from '@/shared/config'; import styles from './FilterGroup.module.scss'; type Props = { name: Path; children: ReactNode; onSubmit: (values: T) => void; title?: string; withReset?: boolean; }; const FilterGroup = ({ name, title, withReset = false, onSubmit, children }: Props) => { const { resetField, handleSubmit, getFieldState } = useFormContext(); const { isDirty } = getFieldState(name); const handleFilterReset = () => { resetField(name); handleSubmit(onSubmit)(); }; return (
{title && (

{title}

)} {children}
); }; export { FilterGroup };