{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "select",
  "title": "Select",
  "type": "registry:ui",
  "files": [
    {
      "path": "packages/registry-native/components/select/Select.tsx",
      "content": "import * as React from 'react'\nimport { Platform, Pressable, View, type PressableProps } from 'react-native'\nimport { Check, ChevronDown } from 'lucide-react-native'\nimport { Button, type ButtonProps } from '@/components/ui/button'\nimport { Sheet, SheetContent, type SheetContentProps } from '@/components/ui/sheet'\nimport { Text } from '@/components/ui/text'\nimport { useOverlay, useOverlayTriggerRef, type OverlayProps } from '@/lib/overlay'\nimport { useThemeColors } from '@/lib/theme'\nimport { cn } from '@/lib/utils'\n\nexport interface SelectOption {\n  value: string\n  label: string\n}\n\nexport interface SelectProps extends OverlayProps {\n  value?: SelectOption | null\n  defaultValue?: SelectOption | null\n  onValueChange?: (option: SelectOption) => void\n  disabled?: boolean\n}\n\ninterface SelectContextValue {\n  value: SelectOption | null\n  disabled: boolean\n  select: (option: SelectOption) => void\n}\n\nconst SelectContext = React.createContext<SelectContextValue | null>(null)\n\nfunction useSelect() {\n  const select = React.useContext(SelectContext)\n  if (!select) throw new Error('Select controls must be inside Select')\n  return select\n}\n\nexport function Select({\n  value,\n  defaultValue = null,\n  onValueChange,\n  disabled = false,\n  children,\n  ...props\n}: SelectProps) {\n  const [internal, setInternal] = React.useState(defaultValue)\n  const resolved = value === undefined ? internal : value\n  const select = (option: SelectOption) => {\n    if (disabled || resolved?.value === option.value) return\n    if (value === undefined) setInternal(option)\n    onValueChange?.(option)\n  }\n  return (\n    <SelectContext.Provider value={{ value: resolved, disabled, select }}>\n      <Sheet {...props}>{children}</Sheet>\n    </SelectContext.Provider>\n  )\n}\n\nexport interface SelectTriggerProps extends Omit<ButtonProps, 'variant' | 'textClassName' | 'size'> {\n  size?: Exclude<ButtonProps['size'], 'icon'>\n  placeholder?: string\n  invalid?: boolean\n}\n\nexport const SelectTrigger = React.forwardRef<React.ComponentRef<typeof Pressable>, SelectTriggerProps>(\n  (\n    {\n      placeholder = 'Choose an option',\n      invalid,\n      disabled,\n      onPress,\n      children,\n      className,\n      accessibilityValue,\n      accessibilityState,\n      ...props\n    },\n    ref,\n  ) => {\n    const select = useSelect()\n    const colors = useThemeColors()\n    const { open, setOpen } = useOverlay()\n    const trigger = useOverlayTriggerRef(ref)\n    const isDisabled = select.disabled || !!disabled\n    return (\n      <Button\n        {...props}\n        variant=\"outline\"\n        ref={trigger.ref}\n        accessibilityRole={Platform.OS === 'ios' ? 'button' : 'combobox'}\n        accessibilityState={{ ...accessibilityState, expanded: open, disabled: isDisabled }}\n        accessibilityValue={{ ...accessibilityValue, text: select.value?.label ?? placeholder }}\n        disabled={isDisabled}\n        className={cn('justify-between', invalid && 'border-destructive', className)}\n        onPress={(event) => {\n          if (isDisabled) return\n          onPress?.(event)\n          if (!event.isDefaultPrevented()) {\n            trigger.capture()\n            setOpen(true)\n          }\n        }}\n      >\n        <Text className={cn('min-w-0 flex-1', !select.value && 'text-muted-foreground')}>\n          {children ?? select.value?.label ?? placeholder}\n        </Text>\n        <ChevronDown size={20} color={colors.foreground} aria-hidden />\n      </Button>\n    )\n  },\n)\nSelectTrigger.displayName = 'SelectTrigger'\n\nexport const SelectContent = React.forwardRef<React.ComponentRef<typeof View>, SheetContentProps>(\n  ({ children, ...props }, ref) => (\n    <SheetContent ref={ref} {...props}>\n      <View accessible={false} accessibilityRole=\"radiogroup\" accessibilityLabel={props.title} className=\"gap-[8px]\">\n        {children}\n      </View>\n    </SheetContent>\n  ),\n)\nSelectContent.displayName = 'SelectContent'\nexport type SelectContentProps = SheetContentProps\n\nexport interface SelectItemProps extends PressableProps {\n  value: string\n  label: string\n  children?: React.ReactNode\n  className?: string\n}\n\nexport const SelectItem = React.forwardRef<React.ComponentRef<typeof Pressable>, SelectItemProps>(\n  ({ value, label, children, disabled, onPress, className, accessibilityState, accessibilityLabel, ...props }, ref) => {\n    const select = useSelect()\n    const colors = useThemeColors()\n    const { setOpen } = useOverlay()\n    const checked = select.value?.value === value\n    const isDisabled = select.disabled || !!disabled\n    return (\n      <Pressable\n        ref={ref}\n        {...props}\n        accessibilityRole=\"radio\"\n        accessibilityLabel={accessibilityLabel ?? label}\n        accessibilityState={{ ...accessibilityState, checked, disabled: isDisabled }}\n        disabled={isDisabled}\n        onPress={(event) => {\n          if (isDisabled) return\n          onPress?.(event)\n          if (event.isDefaultPrevented()) return\n          select.select({ value, label })\n          setOpen(false)\n        }}\n        className={cn(\n          'active:bg-muted min-h-[48px] flex-row items-center gap-3 rounded-md px-3 py-3',\n          checked && 'bg-secondary',\n          isDisabled && 'opacity-50',\n          className,\n        )}\n      >\n        <View aria-hidden pointerEvents=\"none\" className=\"min-w-0 flex-1 gap-1\">\n          <Text className=\"font-medium\">{label}</Text>\n          {children}\n        </View>\n        <View aria-hidden className=\"size-[20px] items-center justify-center\">\n          {checked ? <Check size={20} color={colors.foreground} aria-hidden /> : null}\n        </View>\n      </Pressable>\n    )\n  },\n)\nSelectItem.displayName = 'SelectItem'\n",
      "type": "registry:ui",
      "target": "~/components/ui/select/Select.tsx"
    },
    {
      "path": "packages/registry-native/components/select/index.ts",
      "content": "export {\n  Select,\n  SelectTrigger,\n  SelectContent,\n  SelectItem,\n  type SelectProps,\n  type SelectOption,\n  type SelectTriggerProps,\n  type SelectContentProps,\n  type SelectItemProps,\n} from './Select'\n",
      "type": "registry:ui",
      "target": "~/components/ui/select/index.ts"
    }
  ],
  "dependencies": [
    "lucide-react-native",
    "react-native-svg"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/sheet.json",
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/overlay.json",
    "https://native.uipkge.dev/r/native/theme.json"
  ],
  "description": "Single-choice picker composed from caller-owned options and a native modal sheet, with selected value announcements and focus restoration.",
  "categories": [
    "control",
    "form"
  ]
}