import { cn } from './utils'; import type { VariantProps } from 'class-variance-authority'; import { cva } from 'class-variance-authority'; import { forwardRef, type HTMLAttributes, type PropsWithChildren } from 'react'; export type ContainerProps = HTMLAttributes & PropsWithChildren; const variants = cva('flex min-h-[36px] items-center', { defaultVariants: { intent: 'default', }, variants: { intent: { danger: '[&>*]:border-red-500 [&>*>*]:border-red-500', default: '', }, }, }); export type WrapperProps = HTMLAttributes & VariantProps & { readonly message?: string }; export const ElementContainer = forwardRef( ({ children, className, id, intent, message = 'Некорректные данные', title, ...props }, ref) => (
{children}
{intent === 'danger' ? message :
}
) );