{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ride-option-selector",
  "title": "Ride Option Selector",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/ride-option-selector/RideOptionSelector.tsx",
      "content": "import { Children, Fragment, isValidElement, type ReactElement, type ReactNode } from 'react'\nimport { View, type ViewProps } from 'react-native'\nimport { CircleDot, MapPin } from 'lucide-react-native'\nimport { Button } from '@/components/ui/button'\nimport { Icon } from '@/components/ui/icon'\nimport { RadioGroup, RadioGroupItem, type RadioGroupItemProps } from '@/components/ui/radio-group'\nimport { Text } from '@/components/ui/text'\nimport { cn } from '@/lib/utils'\n\ninterface RideOptionSelectorLabels {\n  pickup: string\n  destination: string\n  options: string\n  confirm: string\n  confirming: string\n}\n\nexport interface RideOptionSelectorProps extends ViewProps {\n  className?: string\n  /** RideOption children with unique, nonempty values. Fragments and arrays are supported. */\n  children?: ReactNode\n  pickup: string\n  destination: string\n  /** Pass null when the caller has no available selected quote. */\n  value: string | null\n  onValueChange: (value: string) => void\n  onConfirm: (value: string) => void\n  /** Disable the options and confirmation while the caller checks or books the selection. */\n  loading?: boolean\n  disabled?: boolean\n  labels?: Partial<RideOptionSelectorLabels>\n  emptyMessage?: string\n}\n\nfunction rideOptions(children: ReactNode): ReactElement<RideOptionProps>[] {\n  return Children.toArray(children).flatMap((child) => {\n    if (!isValidElement<{ children?: ReactNode }>(child)) return []\n    if (child.type === Fragment) return rideOptions(child.props.children)\n    return child.type === RideOption ? [child as ReactElement<RideOptionProps>] : []\n  })\n}\n\nexport function RideOptionSelector({\n  pickup,\n  destination,\n  value,\n  onValueChange,\n  onConfirm,\n  loading = false,\n  disabled = false,\n  labels,\n  emptyMessage = 'No ride options are available. Try a different pickup location.',\n  children,\n  className,\n  ...props\n}: RideOptionSelectorProps) {\n  const options = rideOptions(children)\n  const selected = value ? options.find((option) => option.props.value === value && !option.props.disabled) : undefined\n  const confirmLabel = loading ? (labels?.confirming ?? 'Confirming…') : (labels?.confirm ?? 'Confirm ride option')\n\n  return (\n    <View {...props} className={cn('gap-[16px]', className)}>\n      <View className=\"gap-[12px] rounded-lg bg-muted p-[16px]\">\n        <View className=\"flex-row items-start gap-[12px]\">\n          <Icon icon={CircleDot} size={18} className=\"mt-[2px] text-muted-foreground\" />\n          <View className=\"min-w-0 flex-1\">\n            <Text size=\"xs\" variant=\"muted\">\n              {labels?.pickup ?? 'Pickup'}\n            </Text>\n            <Text className=\"font-medium\">{pickup}</Text>\n          </View>\n        </View>\n        <View className=\"flex-row items-start gap-[12px]\">\n          <Icon icon={MapPin} size={18} className=\"mt-[2px] text-muted-foreground\" />\n          <View className=\"min-w-0 flex-1\">\n            <Text size=\"xs\" variant=\"muted\">\n              {labels?.destination ?? 'Destination'}\n            </Text>\n            <Text className=\"font-medium\">{destination}</Text>\n          </View>\n        </View>\n      </View>\n\n      {options.length > 0 ? (\n        <RadioGroup\n          accessibilityLabel={labels?.options ?? 'Ride options'}\n          className=\"gap-[8px]\"\n          value={selected?.props.value ?? ''}\n          onValueChange={onValueChange}\n          disabled={disabled || loading}\n        >\n          {children}\n        </RadioGroup>\n      ) : (\n        <Text variant=\"muted\">{emptyMessage}</Text>\n      )}\n\n      <Button\n        accessibilityLabel={confirmLabel}\n        disabled={disabled || !selected}\n        loading={loading}\n        onPress={() => {\n          if (selected && !disabled && !loading) onConfirm(selected.props.value)\n        }}\n      >\n        {confirmLabel}\n      </Button>\n    </View>\n  )\n}\n\nexport interface RideOptionProps extends Omit<RadioGroupItemProps, 'children'> {\n  /** Localized fare and estimate, as received or formatted by the caller. */\n  fare?: string\n  pickupEstimate?: string\n  detail?: string\n}\n\nexport function RideOption({\n  label,\n  fare,\n  pickupEstimate,\n  detail,\n  className,\n  accessibilityLabel,\n  ...props\n}: RideOptionProps) {\n  return (\n    <RadioGroupItem\n      {...props}\n      label={label}\n      accessibilityLabel={accessibilityLabel ?? [label, fare, pickupEstimate, detail].filter(Boolean).join(', ')}\n      className={cn('rounded-lg border border-border bg-card', className)}\n    >\n      {fare || pickupEstimate ? (\n        <View className=\"flex-row flex-wrap items-baseline gap-x-[10px] gap-y-[2px]\">\n          {fare ? (\n            <Text size=\"sm\" className=\"font-semibold\" style={{ fontVariant: ['tabular-nums'] }}>\n              {fare}\n            </Text>\n          ) : null}\n          {pickupEstimate ? (\n            <Text size=\"sm\" variant=\"muted\">\n              {pickupEstimate}\n            </Text>\n          ) : null}\n        </View>\n      ) : null}\n      {detail ? (\n        <Text size=\"sm\" variant=\"muted\">\n          {detail}\n        </Text>\n      ) : null}\n    </RadioGroupItem>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/ride-option-selector/RideOptionSelector.tsx"
    },
    {
      "path": "packages/registry-native/blocks/ride-option-selector/index.ts",
      "content": "export {\n  RideOption,\n  RideOptionSelector,\n  type RideOptionProps,\n  type RideOptionSelectorProps,\n} from './RideOptionSelector'\n",
      "type": "registry:block",
      "target": "~/components/blocks/ride-option-selector/index.ts"
    }
  ],
  "dependencies": [
    "lucide-react-native"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/icon.json",
    "https://native.uipkge.dev/r/native/radio-group.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Compare caller-owned ride quotes against a pickup and destination and confirm an available option.",
  "categories": [
    "transport"
  ]
}