{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ride-receipt",
  "title": "Ride Receipt",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/ride-receipt/RideReceipt.tsx",
      "content": "import { Children, Fragment, isValidElement, 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 { Separator } from '@/components/ui/separator'\nimport { Text } from '@/components/ui/text'\nimport { cn } from '@/lib/utils'\n\nexport interface RideReceiptStop {\n  address: string\n  /** Caller-formatted local time. */\n  time?: string\n}\n\nconst defaultLabels = {\n  total: 'Trip total',\n  trip: 'Trip details',\n  pickup: 'Pickup',\n  dropoff: 'Drop-off',\n  breakdown: 'Fare breakdown',\n  receipt: 'Open receipt',\n  report: 'Report a fare issue',\n}\n\nexport interface RideReceiptProps extends ViewProps {\n  className?: string\n  /** The authoritative, caller-formatted amount charged. */\n  total: string\n  /** A masked payment label, for example \"Card ending in 2048\". */\n  paymentLabel?: string\n  /** A localized date and receipt reference. */\n  metadata?: string\n  pickup: RideReceiptStop\n  dropoff: RideReceiptStop\n  /** An optional explanation of a fare adjustment. */\n  note?: string\n  onOpenReceipt?: () => void\n  onReportIssue?: () => void\n  labels?: Partial<typeof defaultLabels>\n}\n\nfunction hasFareRows(children: ReactNode): boolean {\n  return Children.toArray(children).some((child) =>\n    isValidElement<{ children?: ReactNode }>(child) && child.type === Fragment\n      ? hasFareRows(child.props.children)\n      : true,\n  )\n}\n\nexport function RideReceipt({\n  total,\n  paymentLabel,\n  metadata,\n  pickup,\n  dropoff,\n  note,\n  onOpenReceipt,\n  onReportIssue,\n  labels,\n  children,\n  className,\n  ...props\n}: RideReceiptProps) {\n  const copy = { ...defaultLabels, ...labels }\n  const hasLines = hasFareRows(children)\n\n  return (\n    <View {...props} className={cn('gap-[20px]', className)}>\n      <View className=\"gap-[4px] rounded-lg bg-muted p-[16px]\">\n        <Text size=\"sm\" variant=\"muted\">\n          {copy.total}\n        </Text>\n        <Text size=\"title\" style={{ fontVariant: ['tabular-nums'] }}>\n          {total}\n        </Text>\n        {paymentLabel ? <Text size=\"sm\">{paymentLabel}</Text> : null}\n        {metadata ? (\n          <Text size=\"sm\" variant=\"muted\">\n            {metadata}\n          </Text>\n        ) : null}\n      </View>\n\n      {hasLines || note ? (\n        <View className=\"gap-[8px]\">\n          <Text className=\"font-semibold\">{copy.breakdown}</Text>\n          <View className=\"gap-[8px] rounded-lg border border-border bg-card p-[16px]\">\n            {children}\n            {note ? (\n              <>\n                {hasLines ? <Separator /> : null}\n                <Text size=\"sm\" variant=\"muted\">\n                  {note}\n                </Text>\n              </>\n            ) : null}\n          </View>\n        </View>\n      ) : null}\n\n      <View className=\"gap-[8px]\">\n        <Text className=\"font-semibold\">{copy.trip}</Text>\n        <View className=\"gap-[8px] rounded-lg border border-border bg-card 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                {copy.pickup}\n              </Text>\n              <Text className=\"font-medium\">{pickup.address}</Text>\n              {pickup.time ? (\n                <Text size=\"sm\" variant=\"muted\" style={{ fontVariant: ['tabular-nums'] }}>\n                  {pickup.time}\n                </Text>\n              ) : null}\n            </View>\n          </View>\n          <Separator />\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                {copy.dropoff}\n              </Text>\n              <Text className=\"font-medium\">{dropoff.address}</Text>\n              {dropoff.time ? (\n                <Text size=\"sm\" variant=\"muted\" style={{ fontVariant: ['tabular-nums'] }}>\n                  {dropoff.time}\n                </Text>\n              ) : null}\n            </View>\n          </View>\n        </View>\n      </View>\n\n      {onOpenReceipt || onReportIssue ? (\n        <View className=\"flex-row flex-wrap gap-[8px]\">\n          {onOpenReceipt ? (\n            <Button accessibilityLabel={copy.receipt} onPress={onOpenReceipt}>\n              {copy.receipt}\n            </Button>\n          ) : null}\n          {onReportIssue ? (\n            <Button variant=\"outline\" accessibilityLabel={copy.report} onPress={onReportIssue}>\n              {copy.report}\n            </Button>\n          ) : null}\n        </View>\n      ) : null}\n    </View>\n  )\n}\n\nexport interface RideReceiptLineProps extends ViewProps {\n  className?: string\n  label: string\n  amount: string\n  detail?: string\n}\n\nexport function RideReceiptLine({ label, amount, detail, className, ...props }: RideReceiptLineProps) {\n  return (\n    <View {...props} className={cn('gap-[4px]', className)}>\n      <View className=\"flex-row flex-wrap items-baseline justify-between gap-[8px]\">\n        <Text size=\"sm\" className=\"min-w-[120px] shrink grow\">\n          {label}\n        </Text>\n        <Text size=\"sm\" className=\"font-semibold\" style={{ fontVariant: ['tabular-nums'] }}>\n          {amount}\n        </Text>\n      </View>\n      {detail ? (\n        <Text size=\"xs\" variant=\"muted\">\n          {detail}\n        </Text>\n      ) : null}\n    </View>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/ride-receipt/RideReceipt.tsx"
    },
    {
      "path": "packages/registry-native/blocks/ride-receipt/index.ts",
      "content": "export {\n  RideReceipt,\n  RideReceiptLine,\n  type RideReceiptLineProps,\n  type RideReceiptProps,\n  type RideReceiptStop,\n} from './RideReceipt'\n",
      "type": "registry:block",
      "target": "~/components/blocks/ride-receipt/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/separator.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Completed ride receipt with an authoritative total, visible fare lines, pickup and drop-off times, and optional receipt and fare-review actions.",
  "categories": [
    "transport",
    "finance"
  ]
}