'use client';
import {
ColorField as AriaColorField,
ColorFieldProps as AriaColorFieldProps,
Input,
ValidationResult
} from 'react-aria-components';
import {Label, FieldError, Description} from '@/registry/react-aria/ui/Form';
import './ColorField.css';
export interface ColorFieldProps extends AriaColorFieldProps {
label?: string;
description?: string;
errorMessage?: string | ((validation: ValidationResult) => string);
placeholder?: string
}
export function ColorField(
{ label, description, errorMessage, placeholder, ...props }: ColorFieldProps
) {
return (
(
<AriaColorField {...props}>
{label && <Label>{label}</Label>}
<Input className="react-aria-Input inset" placeholder={placeholder} />
{description && <Description>{description}</Description>}
<FieldError>{errorMessage}</FieldError>
</AriaColorField>
)
);
}