{
  "name": "rhf-time-field",
  "type": "registry:ui",
  "dependencies": [
    "@hookform/lenses",
    "react-hook-form"
  ],
  "registryDependencies": [
    "field",
    "select",
    "time"
  ],
  "files": [
    {
      "path": "./items/react-hook-form/time-field/component.tsx",
      "type": "registry:ui",
      "target": "./components/ui/shuip/react-hook-form/time-field.tsx",
      "content": "'use client';\n\nimport type { Lens } from '@hookform/lenses';\nimport { useController } from 'react-hook-form';\nimport { Field, FieldDescription, FieldError, FieldLabel } from '@/components/ui/field';\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';\nimport { HOUR_OPTIONS, isHourDisabled, isMinuteDisabled, joinTime, MINUTE_OPTIONS, splitTime } from '@/lib/time';\n\nexport interface TimeFieldProps {\n  lens: Lens<string>;\n  label?: string;\n  description?: string;\n  min?: string;\n  max?: string;\n  disabled?: boolean;\n}\n\nexport function TimeField({ lens, label, description, min, max, disabled }: TimeFieldProps) {\n  const { field, fieldState } = useController(lens.interop());\n  const { hour, minute } = splitTime(field.value ?? '');\n  const bounds = { min, max };\n\n  return (\n    <Field className='gap-2' data-invalid={fieldState.invalid}>\n      {label && <FieldLabel htmlFor={field.name}>{label}</FieldLabel>}\n      <div className='flex items-center gap-2'>\n        <Select value={hour} onValueChange={(h) => field.onChange(joinTime(h, minute))} disabled={disabled}>\n          <SelectTrigger id={field.name} aria-invalid={fieldState.invalid} className='w-full'>\n            <SelectValue placeholder='HH' />\n          </SelectTrigger>\n          <SelectContent>\n            {HOUR_OPTIONS.map((h) => (\n              <SelectItem key={h} value={h} disabled={isHourDisabled(h, bounds)}>\n                {h}\n              </SelectItem>\n            ))}\n          </SelectContent>\n        </Select>\n        <span className='text-muted-foreground'>:</span>\n        <Select value={minute} onValueChange={(m) => field.onChange(joinTime(hour, m))} disabled={disabled}>\n          <SelectTrigger aria-invalid={fieldState.invalid} className='w-full'>\n            <SelectValue placeholder='mm' />\n          </SelectTrigger>\n          <SelectContent>\n            {MINUTE_OPTIONS.map((m) => (\n              <SelectItem key={m} value={m} disabled={isMinuteDisabled(m, hour, bounds)}>\n                {m}\n              </SelectItem>\n            ))}\n          </SelectContent>\n        </Select>\n      </div>\n      {fieldState.invalid && <FieldError className='text-xs text-left' errors={[fieldState.error]} />}\n      {description && <FieldDescription className='text-xs'>{description}</FieldDescription>}\n    </Field>\n  );\n}\n"
    }
  ],
  "$schema": "https://ui.shadcn.com/schema/registry-item.json"
}
