{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "search-bar",
  "title": "Search Bar",
  "type": "registry:ui",
  "files": [
    {
      "path": "packages/registry-native/components/search-bar/SearchBar.tsx",
      "content": "import * as React from 'react'\nimport { TextInput, View, type ViewProps } from 'react-native'\nimport { Search, X } from 'lucide-react-native'\nimport { Input, type InputProps } from '@/components/ui/input'\nimport { IconButton } from '@/components/ui/icon-button'\nimport { useThemeColors } from '@/lib/theme'\nimport { cn } from '@/lib/utils'\n\nexport interface SearchBarProps extends Omit<InputProps, 'prefixIcon' | 'suffixIcon' | 'containerClassName' | 'style'> {\n  inputClassName?: string\n  clearLabel?: string\n  style?: ViewProps['style']\n}\n\nexport const SearchBar = React.forwardRef<React.ComponentRef<typeof TextInput>, SearchBarProps>(\n  (\n    {\n      value,\n      defaultValue = '',\n      onChangeText,\n      className,\n      inputClassName,\n      style,\n      clearLabel = 'Clear search',\n      editable = true,\n      invalid,\n      placeholder = 'Search',\n      accessibilityLabel = 'Search',\n      autoCapitalize = 'none',\n      autoCorrect = false,\n      returnKeyType = 'search',\n      onFocus,\n      onBlur,\n      ...props\n    },\n    ref,\n  ) => {\n    const colors = useThemeColors()\n    const [internal, setInternal] = React.useState(defaultValue)\n    const [focused, setFocused] = React.useState(false)\n    const input = React.useRef<React.ComponentRef<typeof TextInput>>(null)\n    const resolved = value ?? internal\n    const canEdit = editable && !props.readOnly\n    const setRef = React.useCallback(\n      (node: React.ComponentRef<typeof TextInput> | null) => {\n        input.current = node\n        if (typeof ref === 'function') return ref(node)\n        if (ref) ref.current = node\n      },\n      [ref],\n    )\n    function change(next: string) {\n      if (!canEdit) return\n      if (value === undefined) setInternal(next)\n      onChangeText?.(next)\n    }\n\n    return (\n      <View\n        className={cn(\n          'flex-row items-center rounded-md border border-muted-foreground bg-background',\n          focused && !invalid && 'border-ring bg-muted',\n          invalid && 'border-destructive',\n          !editable && 'opacity-50',\n          className,\n        )}\n        style={style}\n      >\n        <View className=\"min-w-0 flex-1\">\n          <Input\n            ref={setRef}\n            {...props}\n            value={resolved}\n            onChangeText={change}\n            editable={editable}\n            invalid={invalid}\n            placeholder={placeholder}\n            accessibilityLabel={accessibilityLabel}\n            autoCapitalize={autoCapitalize}\n            autoCorrect={autoCorrect}\n            returnKeyType={returnKeyType}\n            prefixIcon={<Search size={20} color={colors.mutedForeground} aria-hidden />}\n            containerClassName=\"border-0 opacity-100\"\n            className={inputClassName}\n            onFocus={(event) => {\n              setFocused(true)\n              onFocus?.(event)\n            }}\n            onBlur={(event) => {\n              setFocused(false)\n              onBlur?.(event)\n            }}\n          />\n        </View>\n        {resolved && canEdit ? (\n          <IconButton\n            icon={X}\n            accessibilityLabel={clearLabel}\n            onPress={() => {\n              change('')\n              input.current?.focus()\n            }}\n          />\n        ) : null}\n      </View>\n    )\n  },\n)\nSearchBar.displayName = 'SearchBar'\n",
      "type": "registry:ui",
      "target": "~/components/ui/search-bar/SearchBar.tsx"
    },
    {
      "path": "packages/registry-native/components/search-bar/index.ts",
      "content": "export * from './SearchBar'\n",
      "type": "registry:ui",
      "target": "~/components/ui/search-bar/index.ts"
    }
  ],
  "dependencies": [
    "lucide-react-native"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/input.json",
    "https://native.uipkge.dev/r/native/icon-button.json"
  ],
  "description": "Search input with controlled or default text, clear action, keyboard submit props, and themed focus/error states.",
  "categories": [
    "control"
  ]
}