{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "product-details",
  "title": "Product Details",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/product-details/ProductDetails.tsx",
      "content": "import * as React from 'react'\nimport { View, type ViewProps } from 'react-native'\nimport { Button } from '@/components/ui/button'\nimport {\n  Image,\n  ImageFallback,\n  ImageLoading,\n  ImageRetry,\n  ImageSource,\n  type ImageSourceValue,\n} from '@/components/ui/image'\nimport { QuantityStepper } from '@/components/ui/quantity-stepper'\nimport { Text } from '@/components/ui/text'\nimport { useAnnouncement } from '@/lib/accessibility'\nimport { cn } from '@/lib/utils'\n\nexport interface ProductDetailsProps extends ViewProps {\n  className?: string\n  title: string\n  /** Price for the selected variant, formatted by the caller. */\n  price: string\n  description?: string\n  image?: ImageSourceValue\n  imageLabel?: string\n  /** Number of units still available for this purchase. Zero disables adding. */\n  availableQuantity?: number\n  unavailableReason?: string\n  error?: string\n  loading?: boolean\n  quantityLabel?: string\n  addLabel?: string\n  soldOutLabel?: string\n  photoUnavailableLabel?: string\n  retryPhotoLabel?: string\n  /** Variant controls or product details authored by the caller. */\n  children?: React.ReactNode\n  onAdd?: (quantity: number) => void\n}\n\nexport function ProductDetails({\n  className,\n  title,\n  price,\n  description,\n  image,\n  imageLabel = title,\n  availableQuantity,\n  unavailableReason,\n  error,\n  loading = false,\n  quantityLabel = 'Quantity',\n  addLabel = 'Add to cart',\n  soldOutLabel = 'Sold out',\n  photoUnavailableLabel = 'Photo unavailable',\n  retryPhotoLabel = 'Retry photo',\n  children,\n  onAdd,\n  ...props\n}: ProductDetailsProps) {\n  const stock =\n    availableQuantity != null && Number.isSafeInteger(availableQuantity) ? Math.max(0, availableQuantity) : 99\n  const maximum = Math.max(1, stock)\n  const blocked = stock === 0 || Boolean(unavailableReason)\n  const reason = unavailableReason || (stock === 0 ? soldOutLabel : undefined)\n  const [requested, setRequested] = React.useState(1)\n  const quantity = Math.min(requested, maximum)\n  useAnnouncement(error || reason)\n\n  React.useEffect(() => {\n    if (requested > maximum) setRequested(maximum)\n  }, [requested, maximum])\n\n  return (\n    <View {...props} className={cn('gap-[20px]', className)}>\n      {image !== undefined ? (\n        <Image source={image} style={{ aspectRatio: 3 / 2 }}>\n          <ImageSource accessible accessibilityRole=\"image\" accessibilityLabel={imageLabel} />\n          <ImageLoading />\n          <ImageFallback>\n            <Text size=\"sm\" variant=\"muted\" className=\"text-center\">\n              {photoUnavailableLabel}\n            </Text>\n            <ImageRetry accessibilityLabel={retryPhotoLabel}>{retryPhotoLabel}</ImageRetry>\n          </ImageFallback>\n        </Image>\n      ) : null}\n      <View className=\"gap-[8px]\">\n        <Text size=\"title\" accessibilityRole=\"header\">\n          {title}\n        </Text>\n        <Text size=\"lg\" className=\"font-semibold\" style={{ fontVariant: ['tabular-nums'] }}>\n          {price}\n        </Text>\n        {description ? <Text variant=\"muted\">{description}</Text> : null}\n      </View>\n      {children}\n      {reason ? (\n        <Text size=\"sm\" variant=\"muted\">\n          {reason}\n        </Text>\n      ) : null}\n      {error ? (\n        <Text size=\"sm\" accessibilityRole=\"alert\" className=\"text-destructive\">\n          {error}\n        </Text>\n      ) : null}\n      {onAdd ? (\n        <>\n          <View className=\"flex-row flex-wrap items-center justify-between gap-[8px]\">\n            <Text size=\"sm\" aria-hidden className=\"shrink font-medium\">\n              {quantityLabel}\n            </Text>\n            <QuantityStepper\n              accessibilityLabel={quantityLabel}\n              value={quantity}\n              min={1}\n              max={maximum}\n              disabled={loading || blocked}\n              onValueChange={setRequested}\n            />\n          </View>\n          <Button\n            accessibilityLabel={addLabel}\n            disabled={blocked}\n            loading={loading}\n            onPress={() => {\n              if (!loading && !blocked) onAdd(quantity)\n            }}\n          >\n            {addLabel}\n          </Button>\n        </>\n      ) : null}\n    </View>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/product-details/ProductDetails.tsx"
    },
    {
      "path": "packages/registry-native/blocks/product-details/index.ts",
      "content": "export { ProductDetails, type ProductDetailsProps } from './ProductDetails'\n",
      "type": "registry:block",
      "target": "~/components/blocks/product-details/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/image.json",
    "https://native.uipkge.dev/r/native/quantity-stepper.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Product overview with a recoverable image, variant content, live stock limits, and add-to-cart action.",
  "categories": [
    "commerce"
  ]
}