{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "account-picker",
  "title": "Account Picker",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/account-picker/AccountPicker.tsx",
      "content": "import * as React from 'react'\nimport { View, type ViewProps } from 'react-native'\nimport { Button } from '@/components/ui/button'\nimport { RadioGroup, RadioGroupItem, type RadioGroupItemProps } from '@/components/ui/radio-group'\nimport { Text } from '@/components/ui/text'\nimport { cn } from '@/lib/utils'\n\nexport interface AccountPickerOptionProps extends Omit<RadioGroupItemProps, 'children'> {\n  accountType: string\n  /** A pre-masked account suffix or other non-sensitive label. */\n  maskedSuffix?: string\n  /** A localized balance string. */\n  availableBalance?: string\n  unavailableReason?: string\n}\n\nexport interface AccountPickerProps extends ViewProps {\n  className?: string\n  /** AccountPickerOption children with unique, nonempty values. */\n  children?: React.ReactNode\n  value: string | null\n  onValueChange: (value: string) => void\n  onConfirm?: (value: string) => void\n  busy?: boolean\n  disabled?: boolean\n  optionsLabel?: string\n  confirmLabel?: string\n  confirmingLabel?: string\n  emptyMessage?: string\n}\n\nfunction accountOptions(children: React.ReactNode): React.ReactElement<AccountPickerOptionProps>[] {\n  return React.Children.toArray(children).flatMap((child) => {\n    if (!React.isValidElement<{ children?: React.ReactNode }>(child)) return []\n    if (child.type === React.Fragment) return accountOptions(child.props.children)\n    if (child.type !== AccountPickerOption) return []\n    const option = child as React.ReactElement<AccountPickerOptionProps>\n    return option.props.value.trim() ? [option] : []\n  })\n}\n\nexport function AccountPicker({\n  className,\n  children,\n  value,\n  onValueChange,\n  onConfirm,\n  busy = false,\n  disabled = false,\n  optionsLabel = 'Accounts',\n  confirmLabel = 'Use this account',\n  confirmingLabel = 'Selecting account…',\n  emptyMessage = 'No accounts are available.',\n  ...props\n}: AccountPickerProps) {\n  const options = accountOptions(children)\n  const selected = options.find(\n    (item) => item.props.value === value && !item.props.disabled && !item.props.unavailableReason,\n  )\n  const blocked = disabled || busy\n  const actionLabel = busy ? confirmingLabel : confirmLabel\n\n  return (\n    <View {...props} className={cn('gap-4', className)}>\n      {options.length ? (\n        <RadioGroup\n          accessibilityLabel={optionsLabel}\n          value={selected?.props.value ?? ''}\n          disabled={blocked}\n          onValueChange={onValueChange}\n        >\n          {options.map((option) => React.cloneElement(option, { key: option.props.value }))}\n        </RadioGroup>\n      ) : (\n        <View className=\"items-center rounded-xl border border-border px-4 py-8\">\n          <Text className=\"text-center font-medium\">{emptyMessage}</Text>\n        </View>\n      )}\n      {onConfirm ? (\n        <Button\n          accessibilityLabel={actionLabel}\n          disabled={disabled || !selected}\n          loading={busy}\n          onPress={() => {\n            if (selected && !blocked) onConfirm(selected.props.value)\n          }}\n        >\n          {actionLabel}\n        </Button>\n      ) : null}\n    </View>\n  )\n}\n\nexport function AccountPickerOption({\n  className,\n  accountType,\n  maskedSuffix,\n  availableBalance,\n  unavailableReason,\n  label,\n  disabled,\n  accessibilityLabel,\n  ...props\n}: AccountPickerOptionProps) {\n  return (\n    <RadioGroupItem\n      {...props}\n      label={label}\n      disabled={disabled || !!unavailableReason}\n      className={cn('rounded-xl border border-border bg-card', className)}\n      accessibilityLabel={\n        accessibilityLabel ??\n        [label, accountType, maskedSuffix, availableBalance, unavailableReason].filter(Boolean).join(', ')\n      }\n    >\n      <View className=\"flex-row flex-wrap gap-x-3 gap-y-1\">\n        <Text size=\"sm\" variant=\"muted\">\n          {accountType}\n        </Text>\n        {maskedSuffix ? (\n          <Text size=\"sm\" variant=\"muted\">\n            {maskedSuffix}\n          </Text>\n        ) : null}\n      </View>\n      {availableBalance ? (\n        <Text size=\"sm\" className=\"font-medium\" style={{ fontVariant: ['tabular-nums'] }}>\n          {availableBalance}\n        </Text>\n      ) : null}\n      {unavailableReason ? (\n        <Text size=\"sm\" variant=\"muted\">\n          {unavailableReason}\n        </Text>\n      ) : null}\n    </RadioGroupItem>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/account-picker/AccountPicker.tsx"
    },
    {
      "path": "packages/registry-native/blocks/account-picker/index.ts",
      "content": "export {\n  AccountPicker,\n  AccountPickerOption,\n  type AccountPickerProps,\n  type AccountPickerOptionProps,\n} from './AccountPicker'\n",
      "type": "registry:block",
      "target": "~/components/blocks/account-picker/index.ts"
    }
  ],
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/radio-group.json",
    "https://native.uipkge.dev/r/native/text.json"
  ],
  "description": "Select a caller-owned account using type, masked identity, balance, and availability, with optional confirmation.",
  "categories": [
    "finance"
  ]
}