{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "search-input",
  "title": "SearchInput",
  "description": "A search field with a shortcut hint, a spinner and a clear button.",
  "registryDependencies": [
    "https://creance.pages.dev/r/clearable-input.json",
    "https://creance.pages.dev/r/creance-base.json",
    "https://creance.pages.dev/r/kbd.json",
    "https://creance.pages.dev/r/spinner.json"
  ],
  "files": [
    {
      "path": "search-input/SearchInput.tsx",
      "content": "import { forwardRef, type ReactNode } from 'react';\nimport { Kbd } from '@/components/creance/kbd/Kbd';\nimport { Spinner } from '@/components/creance/spinner/Spinner';\nimport { SearchIcon } from '@/lib/creance/icons';\nimport { ClearableInput, type ClearableInputProps } from '@/components/creance/clearable-input/ClearableInput';\n\nexport interface SearchInputProps extends Omit<ClearableInputProps, 'leading' | 'trailing' | 'type'> {\n  /** A shortcut hint shown while the field is empty, such as \"⌘K\". Display only: bind the key yourself. */\n  shortcut?: ReactNode;\n  /** Shows a spinner while results load. */\n  loading?: boolean;\n  /** Names the search landmark, so two on one page can be told apart. Defaults to the field's `aria-label`. */\n  landmarkLabel?: string;\n}\n\n/** A pill-shaped search field inside `role=\"search\"`: icon, optional shortcut hint, spinner and clear button. */\nexport const SearchInput = forwardRef<HTMLInputElement, SearchInputProps>(function SearchInput(\n  { shortcut, loading, landmarkLabel, clearLabel = 'Clear search', className, ...props },\n  ref,\n) {\n  return (\n    <div role=\"search\" aria-label={landmarkLabel ?? props['aria-label']} className={className}>\n      <ClearableInput\n        ref={ref}\n        type=\"search\"\n        shape=\"pill\"\n        clearLabel={clearLabel}\n        leading={<SearchIcon />}\n        trailing={\n          loading ? (\n            <Spinner size=\"sm\" label=\"Searching\" />\n          ) : shortcut ? (\n            <Kbd className=\"cr-clearable__hint\">{shortcut}</Kbd>\n          ) : null\n        }\n        {...props}\n      />\n    </div>\n  );\n});\n",
      "type": "registry:ui",
      "target": "@components/creance/search-input/SearchInput.tsx"
    }
  ],
  "categories": [
    "molecule",
    "forms"
  ],
  "type": "registry:ui"
}