import { forwardRef, type ForwardedRef } from 'react'; import { composeRenderProps } from 'react-aria-components/composeRenderProps'; import { FieldError as RACFieldError, type FieldErrorProps, } from 'react-aria-components/FieldError'; import { Group, type GroupProps } from 'react-aria-components/Group'; import { Input as RACInput, type InputProps, } from 'react-aria-components/Input'; import { Label as RACLabel, type LabelProps, } from 'react-aria-components/Label'; import { Text, type TextProps } from 'react-aria-components/Text'; import { TextArea as RACTextArea, type TextAreaProps, } from 'react-aria-components/TextArea'; import { twMerge } from 'tailwind-merge'; import { tv } from 'tailwind-variants'; import { composeTailwindRenderProps, focusRing } from './utils'; export function Label(props: LabelProps) { return ( ); } export function Description(props: TextProps) { return ( ); } export function FieldError(props: FieldErrorProps) { return ( ); } export const fieldBorderStyles = tv({ variants: { isFocusWithin: { false: 'border-transparent dark:border-zinc-500 forced-colors:border-[ButtonBorder]', true: 'border-primary-900 dark:border-zinc-500 forced-colors:border-[Highlight]', }, isInvalid: { true: 'border-warning-600 dark:border-warning-600 forced-colors:border-[Mark]', }, isDisabled: { true: 'border-gray-200 dark:border-zinc-700 forced-colors:border-[GrayText]', }, }, }); export const fieldGroupStyles = tv({ extend: focusRing, base: 'group flex h-9 items-center overflow-hidden rounded-lg border-2 bg-white dark:bg-zinc-900 forced-colors:bg-[Field]', variants: fieldBorderStyles.variants, }); export function FieldGroup(props: GroupProps) { return ( fieldGroupStyles({ ...renderProps, className }), )} /> ); } export const Input = forwardRef(function Input( props: InputProps, ref: ForwardedRef, ) { return ( ); }); export const TextAreaInput = forwardRef(function TextAreaInput( props: TextAreaProps, ref: ForwardedRef, ) { return ( ); });