{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "shipping-method-picker",
  "title": "Shipping Method Picker",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/shipping-method-picker/ShippingMethodPicker.tsx",
      "content": "import { View, type ViewProps } from 'react-native'\nimport { Button } from '@/components/ui/button'\nimport { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'\nimport { Spinner } from '@/components/ui/spinner'\nimport { Text } from '@/components/ui/text'\nimport { useAnnouncement } from '@/lib/accessibility'\nimport { cn } from '@/lib/utils'\n\nexport interface ShippingMethod {\n  id: string\n  label: string\n  /** Localized price, including \"Free\" when the actual fee is zero. */\n  fee?: string\n  /** Localized carrier estimate, including fulfillment time when applicable. */\n  arrivalRange?: string\n  unavailableReason?: string\n}\n\ninterface ShippingMethodPickerLabels {\n  estimate: (range: string) => string\n  estimateUnavailable: string\n  priceUnavailable: string\n  selectionUnavailable: string\n  loading: string\n  empty: string\n  retry: string\n}\n\nexport interface ShippingMethodPickerProps extends Omit<ViewProps, 'children'> {\n  className?: string\n  title?: string\n  destination?: string\n  /** Caller-supplied rates for this destination, with unique and nonempty IDs. */\n  methods?: readonly ShippingMethod[]\n  value: string | null\n  onValueChange: (value: string) => void\n  loading?: boolean\n  error?: string\n  onRetry?: () => void\n  labels?: Partial<ShippingMethodPickerLabels>\n}\n\nexport function ShippingMethodPicker({\n  className,\n  title = 'Shipping method',\n  destination,\n  methods = [],\n  value,\n  onValueChange,\n  loading,\n  error,\n  onRetry,\n  labels,\n  ...props\n}: ShippingMethodPickerProps) {\n  const options = methods.map(({ id, label, fee, arrivalRange, unavailableReason }) => {\n    const quotedFee = fee?.trim()\n    return {\n      id,\n      label,\n      fee: quotedFee,\n      estimate: arrivalRange?.trim(),\n      unavailable:\n        unavailableReason?.trim() ||\n        (!quotedFee ? labels?.priceUnavailable?.trim() || 'Shipping price unavailable' : undefined),\n    }\n  })\n  const selected = options.find((option) => option.id === value && !option.unavailable)\n  const stale = !loading && !error && value !== null && !selected && options.some((option) => !option.unavailable)\n  const selectionNotice = stale\n    ? (labels?.selectionUnavailable ?? 'Your selected shipping method is unavailable. Choose another method.')\n    : undefined\n  useAnnouncement(loading ? undefined : error || selectionNotice)\n\n  return (\n    <View {...props} className={cn('gap-[16px]', className)}>\n      <View className=\"gap-[4px]\">\n        <Text size=\"title\" accessibilityRole=\"header\">\n          {title}\n        </Text>\n        {destination ? <Text variant=\"muted\">{destination}</Text> : null}\n      </View>\n\n      {loading ? (\n        <Spinner className=\"self-start\" accessibilityLabel={labels?.loading ?? 'Getting shipping rates'} />\n      ) : error ? (\n        <View className=\"gap-[8px]\">\n          <Text className=\"text-destructive\" accessibilityRole=\"alert\">\n            {error}\n          </Text>\n          {onRetry ? (\n            <Button variant=\"outline\" accessibilityLabel={labels?.retry ?? 'Try again'} onPress={onRetry}>\n              {labels?.retry ?? 'Try again'}\n            </Button>\n          ) : null}\n        </View>\n      ) : options.length > 0 ? (\n        <RadioGroup accessibilityLabel={title} value={selected?.id ?? ''} onValueChange={onValueChange}>\n          {options.map(({ id, label, fee, estimate, unavailable }) => {\n            const arrival = estimate\n              ? (labels?.estimate?.(estimate) ?? `Estimated delivery ${estimate}`)\n              : (labels?.estimateUnavailable ?? 'Delivery estimate unavailable')\n            return (\n              <RadioGroupItem\n                key={id}\n                value={id}\n                label={label}\n                disabled={Boolean(unavailable)}\n                accessibilityLabel={[label, ...(unavailable ? [unavailable] : [fee, arrival])]\n                  .filter(Boolean)\n                  .join(', ')}\n                className={cn(\n                  'rounded-lg border border-border bg-card focus:border-ring',\n                  unavailable && 'bg-muted opacity-100',\n                  selected?.id === id && 'border-primary',\n                )}\n              >\n                {unavailable ? (\n                  <Text size=\"sm\" variant=\"muted\">\n                    {unavailable}\n                  </Text>\n                ) : (\n                  <View className=\"gap-[4px]\">\n                    <Text size=\"sm\" className=\"font-semibold\">\n                      {fee}\n                    </Text>\n                    <Text size=\"sm\" variant=\"muted\">\n                      {arrival}\n                    </Text>\n                  </View>\n                )}\n              </RadioGroupItem>\n            )\n          })}\n        </RadioGroup>\n      ) : (\n        <Text variant=\"muted\">{labels?.empty ?? 'No shipping methods for this destination.'}</Text>\n      )}\n      {selectionNotice ? (\n        <Text size=\"sm\" variant=\"muted\">\n          {selectionNotice}\n        </Text>\n      ) : null}\n    </View>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/shipping-method-picker/ShippingMethodPicker.tsx"
    },
    {
      "path": "packages/registry-native/blocks/shipping-method-picker/index.ts",
      "content": "export { ShippingMethodPicker, type ShippingMethod, type ShippingMethodPickerProps } from './ShippingMethodPicker'\n",
      "type": "registry:block",
      "target": "~/components/blocks/shipping-method-picker/index.ts"
    }
  ],
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/accessibility.json",
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/radio-group.json",
    "https://native.uipkge.dev/r/native/spinner.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Controlled shipping quotes with caller-localized fees, arrival estimates and unavailable options.",
  "categories": [
    "commerce"
  ]
}