'use client'; import { Ref } from 'react'; import { useFormStatus } from 'react-dom'; import Spinner from './Spinner'; import { clsx } from 'clsx/lite'; import { FieldSetType, AnnotatedTag } from '@/photo/form'; import TagInput from './TagInput'; import { FiChevronDown } from 'react-icons/fi'; export default function FieldSetWithStatus({ id, label, note, error, value, isModified, onChange, selectOptions, selectOptionsDefaultLabel, tagOptions, placeholder, loading, required, readOnly, spellCheck, capitalize, type = 'text', inputRef, accessory, hideLabel, }: { id: string label?: string note?: string error?: string value: string isModified?: boolean onChange?: (value: string) => void selectOptions?: { value: string, label: string }[] selectOptionsDefaultLabel?: string tagOptions?: AnnotatedTag[] placeholder?: string loading?: boolean required?: boolean readOnly?: boolean spellCheck?: boolean capitalize?: boolean type?: FieldSetType inputRef?: Ref accessory?: React.ReactNode hideLabel?: boolean }) { const { pending } = useFormStatus(); return (
{!hideLabel && label && }
{selectOptions ?
: tagOptions ? : type === 'textarea' ?