'use client'; import React from 'react'; import { DateField as AriaDateField, type DateFieldProps as AriaDateFieldProps, DateInput as AriaDateInput, type DateInputProps, DateSegment, type DateValue, type ValidationResult } from 'react-aria-components/DateField'; import {tv} from 'tailwind-variants'; import {Description, FieldError, Label, fieldGroupStyles} from './Field'; import {composeTailwindRenderProps} from './utils'; export interface DateFieldProps extends AriaDateFieldProps { label?: string; description?: string; errorMessage?: string | ((validation: ValidationResult) => string); } export function DateField({ label, description, errorMessage, ...props }: DateFieldProps) { return ( {label && } {description && {description}} {errorMessage} ); } const segmentStyles = tv({ base: 'inline p-0.5 whitespace-nowrap type-literal:p-0 rounded-xs outline outline-0 forced-color-adjust-none caret-transparent text-neutral-800 dark:text-neutral-200 forced-colors:text-[ButtonText] [-webkit-tap-highlight-color:transparent]', variants: { isPlaceholder: { true: 'text-neutral-600 dark:text-neutral-400' }, isDisabled: { true: 'text-neutral-200 dark:text-neutral-600 forced-colors:text-[GrayText]' }, isFocused: { true: 'bg-blue-600 text-white dark:text-white forced-colors:bg-[Highlight] forced-colors:text-[HighlightText]' } } }); export function DateInput(props: Omit) { return ( fieldGroupStyles({ ...renderProps, class: 'inline min-w-[150px] px-3 h-9 text-sm leading-8.5 font-sans cursor-text disabled:cursor-default whitespace-nowrap overflow-x-auto [scrollbar-width:none]' }) } {...props}> {segment => } ); }