{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"shadcn-studio/input-39","type":"registry:component","title":"Input 39","description":"Search input field with loading indicator that shows during search operations","dependencies":["lucide-react"],"registryDependencies":["input-group","label"],"files":[{"path":"src/registry/new-york/components/input/input-39.tsx","content":"'use client'\n\nimport { useEffect, useId, useState } from 'react'\n\nimport { LoaderCircleIcon, SearchIcon } from 'lucide-react'\n\nimport { InputGroup, InputGroupInput, InputGroupAddon } from '@/registry/new-york/ui/input-group'\nimport { Label } from '@/registry/new-york/ui/label'\n\nconst InputSearchLoaderDemo = () => {\n  const [value, setValue] = useState('')\n  const [isLoading, setIsLoading] = useState(false)\n\n  const id = useId()\n\n  useEffect(() => {\n    if (value) {\n      setIsLoading(true)\n\n      const timer = setTimeout(() => {\n        setIsLoading(false)\n      }, 500)\n\n      return () => clearTimeout(timer)\n    }\n\n    setIsLoading(false)\n  }, [value])\n\n  return (\n    <div className='w-full max-w-xs space-y-2'>\n      <Label htmlFor={id}>Search input with loader</Label>\n      <InputGroup>\n        <InputGroupAddon>\n          <SearchIcon className='size-4' />\n          <span className='sr-only'>Search</span>\n        </InputGroupAddon>\n        <InputGroupInput\n          id={id}\n          type='search'\n          placeholder='Search...'\n          value={value}\n          onChange={e => setValue(e.target.value)}\n          className='[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none'\n        />\n        <InputGroupAddon align='inline-end' className='text-muted-foreground pointer-events-none'>\n          {isLoading && (\n            <>\n              <LoaderCircleIcon className='size-4 animate-spin' />\n              <span className='sr-only'>Loading...</span>\n            </>\n          )}\n        </InputGroupAddon>\n      </InputGroup>\n    </div>\n  )\n}\n\nexport default InputSearchLoaderDemo\n","type":"registry:component","target":"components/shadcn-studio/input/input-39.tsx"}]}