{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "payment-method-list",
  "title": "Payment Method List",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/payment-method-list/PaymentMethodList.tsx",
      "content": "import { Fragment } from 'react'\nimport { View, type ViewProps } from 'react-native'\nimport { Button } from '@/components/ui/button'\nimport { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'\nimport { Separator } from '@/components/ui/separator'\nimport { Text } from '@/components/ui/text'\nimport { useAnnouncement } from '@/lib/accessibility'\nimport { cn } from '@/lib/utils'\n\nexport interface StoredPaymentMethod {\n  /** Non-sensitive identifier owned by the checkout or payment provider. */\n  id: string\n  /** A display name, for example \"Debit card\". */\n  label: string\n  /** A display suffix from the provider. Exactly four digit characters are accepted. */\n  lastFour?: string\n  unavailableReason?: string\n}\n\ninterface PaymentMethodListLabels {\n  add: string\n  empty: string\n  selectionUnavailable: string\n  endingIn: (digits: string) => string\n}\n\nexport interface PaymentMethodListProps extends Omit<ViewProps, 'children'> {\n  className?: string\n  title?: string\n  /** Caller-owned methods with unique and nonempty IDs. */\n  methods?: readonly StoredPaymentMethod[]\n  value: string | null\n  onValueChange: (value: string) => void\n  onAdd?: () => void\n  labels?: Partial<PaymentMethodListLabels>\n}\n\nexport function PaymentMethodList({\n  className,\n  title = 'Payment method',\n  methods = [],\n  value,\n  onValueChange,\n  onAdd,\n  labels,\n  ...props\n}: PaymentMethodListProps) {\n  const selected = methods.find((method) => method.id === value && !method.unavailableReason)\n  const selectionNotice =\n    value !== null && !selected && methods.some((method) => !method.unavailableReason)\n      ? (labels?.selectionUnavailable ?? 'Your selected payment method is unavailable. Choose another method.')\n      : undefined\n  const add = labels?.add ?? 'Add payment method'\n  useAnnouncement(selectionNotice)\n\n  return (\n    <View {...props} className={cn('gap-[16px]', className)}>\n      <Text size=\"title\" accessibilityRole=\"header\">\n        {title}\n      </Text>\n      {methods.length > 0 ? (\n        <RadioGroup\n          accessibilityLabel={title}\n          value={selected?.id ?? ''}\n          onValueChange={onValueChange}\n          className=\"gap-0 overflow-hidden rounded-lg border border-border bg-card\"\n        >\n          {methods.map(({ id, label, lastFour, unavailableReason }, index) => {\n            const digits = typeof lastFour === 'string' && /^[0-9]{4}$/.test(lastFour) ? lastFour : undefined\n            const ending = digits\n              ? (labels?.endingIn?.(digits) ?? `ending in ${digits.split('').join(' ')}`)\n              : undefined\n            return (\n              <Fragment key={id}>\n                {index > 0 ? <Separator /> : null}\n                <RadioGroupItem\n                  value={id}\n                  label={label}\n                  disabled={Boolean(unavailableReason)}\n                  accessibilityLabel={[label, ending, unavailableReason].filter(Boolean).join(', ')}\n                  className={cn(\n                    'rounded-none border border-transparent focus:border-ring',\n                    unavailableReason && 'bg-muted opacity-100',\n                  )}\n                >\n                  {digits ? <Text size=\"sm\" style={{ fontVariant: ['tabular-nums'] }}>{`•••• ${digits}`}</Text> : null}\n                  {unavailableReason ? (\n                    <Text size=\"sm\" variant=\"muted\">\n                      {unavailableReason}\n                    </Text>\n                  ) : null}\n                </RadioGroupItem>\n              </Fragment>\n            )\n          })}\n        </RadioGroup>\n      ) : (\n        <Text variant=\"muted\">{labels?.empty ?? 'No saved payment methods.'}</Text>\n      )}\n      {selectionNotice ? (\n        <Text size=\"sm\" variant=\"muted\">\n          {selectionNotice}\n        </Text>\n      ) : null}\n      {onAdd ? (\n        <Button variant=\"outline\" accessibilityLabel={add} onPress={onAdd}>\n          {add}\n        </Button>\n      ) : null}\n    </View>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/payment-method-list/PaymentMethodList.tsx"
    },
    {
      "path": "packages/registry-native/blocks/payment-method-list/index.ts",
      "content": "export { PaymentMethodList, type StoredPaymentMethod, type PaymentMethodListProps } from './PaymentMethodList'\n",
      "type": "registry:block",
      "target": "~/components/blocks/payment-method-list/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/separator.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Choose a saved payment method with masked last four digits, unavailable reasons and caller-owned add intent.",
  "categories": [
    "commerce"
  ]
}