{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"property-card","type":"registry:ui","title":"Property card","description":"Listing card with status badge, saved-home heart, price, address and beds, baths and square footage.","dependencies":["lucide-react","motion"],"registryDependencies":["utils"],"files":[{"path":"registry/items/property-card/property-card.tsx","type":"registry:ui","target":"components/facade/property-card.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { Bath, BedDouble, Heart, MapPin, Ruler } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type PropertyStatus = \"for-sale\" | \"pending\" | \"new\";\n\nexport interface PropertyCardProps {\n  /** Optional photo URL. When omitted, an illustrated architectural placeholder renders. */\n  src?: string;\n  alt?: string;\n  status?: PropertyStatus;\n  price?: number;\n  /** Optional suffix such as \"/mo\" for rentals. */\n  priceSuffix?: string;\n  address?: string;\n  city?: string;\n  beds?: number;\n  baths?: number;\n  sqft?: number;\n  /** Placeholder composition when no src is set. */\n  placeholder?: \"modern\" | \"bungalow\" | \"tower\";\n  href?: string;\n  defaultFavorite?: boolean;\n  onFavoriteChange?: (favorite: boolean) => void;\n  className?: string;\n}\n\nconst statusCopy: Record<PropertyStatus, { label: string; className: string }> = {\n  \"for-sale\": { label: \"For sale\", className: \"bg-background/90 text-foreground\" },\n  pending: { label: \"Pending\", className: \"bg-background/90 text-muted-foreground\" },\n  new: { label: \"New\", className: \"bg-brand text-brand-foreground\" },\n};\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n  style: \"currency\",\n  currency: \"USD\",\n  maximumFractionDigits: 0,\n});\n\nconst EASE = [0.16, 1, 0.3, 1] as const;\n\n/** Quiet monochrome architecture placeholder. Walls take the page background, everything else is tinted foreground. */\nfunction PropertyPlaceholder({ variant }: { variant: \"modern\" | \"bungalow\" | \"tower\" }) {\n  const id = React.useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n  return (\n    <svg\n      viewBox=\"0 0 400 260\"\n      preserveAspectRatio=\"xMidYMid slice\"\n      className=\"h-full w-full text-foreground\"\n      aria-hidden=\"true\"\n    >\n      <defs>\n        <linearGradient id={`sky-${id}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n          <stop offset=\"0\" stopColor=\"currentColor\" stopOpacity=\"0.12\" />\n          <stop offset=\"1\" stopColor=\"currentColor\" stopOpacity=\"0.04\" />\n        </linearGradient>\n      </defs>\n      <rect width=\"400\" height=\"260\" fill=\"var(--background)\" />\n      <rect width=\"400\" height=\"260\" fill={`url(#sky-${id})`} />\n      {/* distant hills */}\n      <path d=\"M0 190 Q 80 160 160 182 T 320 172 T 400 180 V260 H0Z\" fill=\"currentColor\" opacity=\"0.05\" />\n      {variant === \"modern\" && (\n        <g>\n          <rect x=\"88\" y=\"118\" width=\"150\" height=\"86\" fill=\"var(--background)\" />\n          <rect x=\"196\" y=\"92\" width=\"122\" height=\"112\" fill=\"var(--background)\" />\n          <rect x=\"188\" y=\"86\" width=\"138\" height=\"8\" fill=\"currentColor\" opacity=\"0.7\" />\n          <rect x=\"80\" y=\"112\" width=\"166\" height=\"7\" fill=\"currentColor\" opacity=\"0.6\" />\n          <rect x=\"208\" y=\"106\" width=\"98\" height=\"64\" fill=\"currentColor\" opacity=\"0.22\" />\n          <path d=\"M257 106 V170 M208 138 H306\" stroke=\"var(--background)\" strokeWidth=\"2.5\" />\n          <rect x=\"102\" y=\"134\" width=\"56\" height=\"40\" fill=\"currentColor\" opacity=\"0.22\" />\n          <rect x=\"172\" y=\"146\" width=\"18\" height=\"58\" fill=\"currentColor\" opacity=\"0.65\" />\n          <rect x=\"96\" y=\"186\" width=\"70\" height=\"18\" fill=\"currentColor\" opacity=\"0.08\" />\n        </g>\n      )}\n      {variant === \"bungalow\" && (\n        <g>\n          <path d=\"M92 132 L200 76 L308 132 Z\" fill=\"currentColor\" opacity=\"0.68\" />\n          <rect x=\"108\" y=\"130\" width=\"184\" height=\"74\" fill=\"var(--background)\" />\n          <rect x=\"124\" y=\"146\" width=\"44\" height=\"34\" fill=\"currentColor\" opacity=\"0.22\" />\n          <rect x=\"232\" y=\"146\" width=\"44\" height=\"34\" fill=\"currentColor\" opacity=\"0.22\" />\n          <rect x=\"186\" y=\"150\" width=\"28\" height=\"54\" fill=\"currentColor\" opacity=\"0.65\" />\n          <path d=\"M146 146 V180 M254 146 V180\" stroke=\"var(--background)\" strokeWidth=\"2\" />\n          <rect x=\"100\" y=\"196\" width=\"200\" height=\"8\" fill=\"currentColor\" opacity=\"0.12\" />\n          <circle cx=\"66\" cy=\"178\" r=\"22\" fill=\"currentColor\" opacity=\"0.1\" />\n          <circle cx=\"336\" cy=\"174\" r=\"26\" fill=\"currentColor\" opacity=\"0.08\" />\n        </g>\n      )}\n      {variant === \"tower\" && (\n        <g>\n          <rect x=\"150\" y=\"40\" width=\"100\" height=\"164\" fill=\"var(--background)\" />\n          {Array.from({ length: 7 }).map((_, row) => (\n            <g key={row}>\n              <rect x=\"160\" y={52 + row * 20} width=\"38\" height=\"12\" fill=\"currentColor\" opacity=\"0.22\" />\n              <rect x=\"202\" y={52 + row * 20} width=\"38\" height=\"12\" fill=\"currentColor\" opacity=\"0.22\" />\n              <rect x=\"150\" y={66 + row * 20} width=\"100\" height=\"2\" fill=\"currentColor\" opacity=\"0.35\" />\n            </g>\n          ))}\n          <rect x=\"70\" y=\"120\" width=\"70\" height=\"84\" fill=\"currentColor\" opacity=\"0.1\" />\n          <rect x=\"262\" y=\"100\" width=\"72\" height=\"104\" fill=\"currentColor\" opacity=\"0.08\" />\n        </g>\n      )}\n      <rect x=\"0\" y=\"204\" width=\"400\" height=\"56\" fill=\"currentColor\" opacity=\"0.07\" />\n    </svg>\n  );\n}\n\nexport function PropertyCard({\n  src,\n  alt = \"Property photo\",\n  status = \"for-sale\",\n  price = 685000,\n  priceSuffix,\n  address = \"2418 Travis Heights Blvd\",\n  city = \"Austin, TX 78704\",\n  beds = 3,\n  baths = 2.5,\n  sqft = 2140,\n  placeholder = \"modern\",\n  href,\n  defaultFavorite = false,\n  onFavoriteChange,\n  className,\n}: PropertyCardProps) {\n  const reduce = useReducedMotion();\n  const [favorite, setFavorite] = React.useState(defaultFavorite);\n  const s = statusCopy[status];\n\n  const toggle = () => {\n    const next = !favorite;\n    setFavorite(next);\n    onFavoriteChange?.(next);\n  };\n\n  const Title = href ? \"a\" : \"span\";\n\n  return (\n    <motion.article\n      className={cn(\"group relative flex w-full flex-col overflow-hidden rounded-[28px] bg-muted text-foreground\", className)}\n      whileHover={reduce ? undefined : { y: -2 }}\n      transition={{ type: \"spring\", stiffness: 400, damping: 34 }}\n    >\n      <div className=\"relative aspect-[3/2] overflow-hidden\">\n        <div className=\"h-full w-full transition-transform duration-700 ease-[cubic-bezier(0.16,1,0.3,1)] group-hover:scale-[1.04]\">\n          {src ? (\n            // eslint-disable-next-line @next/next/no-img-element\n            <img src={src} alt={alt} className=\"h-full w-full object-cover\" loading=\"lazy\" />\n          ) : (\n            <PropertyPlaceholder variant={placeholder} />\n          )}\n        </div>\n\n        <span\n          className={cn(\n            \"absolute left-4 top-4 inline-flex h-7 items-center rounded-full px-3 text-[12px] font-medium backdrop-blur\",\n            s.className,\n          )}\n        >\n          {s.label}\n        </span>\n\n        <button\n          type=\"button\"\n          onClick={toggle}\n          aria-pressed={favorite}\n          aria-label={favorite ? \"Remove from saved homes\" : \"Save home\"}\n          className=\"absolute right-4 top-4 z-10 grid size-9 place-items-center rounded-full bg-background/90 text-foreground backdrop-blur transition-colors hover:bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n        >\n          <motion.span\n            key={favorite ? \"on\" : \"off\"}\n            initial={reduce ? false : { scale: favorite ? 0.6 : 0.9 }}\n            animate={{ scale: 1 }}\n            transition={{ type: \"spring\", stiffness: 400, damping: 32 }}\n            className=\"relative grid place-items-center\"\n          >\n            <Heart\n              aria-hidden=\"true\"\n              className={cn(\n                \"size-4 transition-colors\",\n                favorite ? \"fill-destructive text-destructive\" : \"text-foreground\",\n              )}\n            />\n          </motion.span>\n          <AnimatePresence>\n            {favorite && !reduce && (\n              <motion.span\n                key=\"burst\"\n                className=\"pointer-events-none absolute inset-0 rounded-full border-2 border-destructive/50\"\n                initial={{ scale: 0.6, opacity: 1 }}\n                animate={{ scale: 1.5, opacity: 0 }}\n                exit={{ opacity: 0 }}\n                transition={{ duration: 0.6, ease: EASE }}\n              />\n            )}\n          </AnimatePresence>\n        </button>\n      </div>\n\n      <div className=\"flex flex-1 flex-col p-5 sm:p-6\">\n        <div className=\"flex items-baseline gap-1\">\n          <span className=\"font-display text-[24px] font-semibold tracking-[-0.02em] tabular-nums\">\n            {usd.format(price)}\n          </span>\n          {priceSuffix && <span className=\"text-[14px] text-muted-foreground\">{priceSuffix}</span>}\n        </div>\n        <div className=\"mt-2 min-w-0\">\n          <Title\n            {...(href ? { href } : {})}\n            className={cn(\n              \"block truncate text-[15px] font-medium\",\n              href &&\n                \"rounded-sm after:absolute after:inset-0 after:content-[''] hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n            )}\n          >\n            {address}\n          </Title>\n          <p className=\"mt-0.5 flex items-center gap-1 truncate text-[14px] text-muted-foreground\">\n            <MapPin className=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n            {city}\n          </p>\n        </div>\n        <dl className=\"mt-5 flex flex-wrap items-center gap-x-5 gap-y-1 text-[14px] text-muted-foreground\">\n          <div className=\"flex items-center gap-1.5\">\n            <BedDouble className=\"size-4\" aria-hidden=\"true\" />\n            <dt className=\"sr-only\">Bedrooms</dt>\n            <dd>\n              <span className=\"font-medium tabular-nums text-foreground\">{beds}</span> bd\n            </dd>\n          </div>\n          <div className=\"flex items-center gap-1.5\">\n            <Bath className=\"size-4\" aria-hidden=\"true\" />\n            <dt className=\"sr-only\">Bathrooms</dt>\n            <dd>\n              <span className=\"font-medium tabular-nums text-foreground\">{baths}</span> ba\n            </dd>\n          </div>\n          <div className=\"flex items-center gap-1.5\">\n            <Ruler className=\"size-4\" aria-hidden=\"true\" />\n            <dt className=\"sr-only\">Square feet</dt>\n            <dd>\n              <span className=\"font-medium tabular-nums text-foreground\">{sqft.toLocaleString(\"en-US\")}</span> sqft\n            </dd>\n          </div>\n        </dl>\n      </div>\n    </motion.article>\n  );\n}\n\nexport default PropertyCard;\n"}],"categories":["cards"],"meta":{"tier":"free","demo":"import { PropertyCard } from \"./property-card\";\n\nexport default function Demo() {\n  return (\n    <div className=\"mx-auto grid w-full max-w-[720px] gap-5 sm:grid-cols-2\">\n      <PropertyCard\n        status=\"new\"\n        price={685000}\n        address=\"2418 Travis Heights Blvd\"\n        city=\"Austin, TX 78704\"\n        beds={3}\n        baths={2.5}\n        sqft={2140}\n        placeholder=\"modern\"\n        defaultFavorite\n      />\n      <PropertyCard\n        status=\"pending\"\n        price={1249000}\n        address=\"3150 Bluebird Ln\"\n        city=\"Denver, CO 80211\"\n        beds={4}\n        baths={3}\n        sqft={2865}\n        placeholder=\"bungalow\"\n      />\n    </div>\n  );\n}\n"}}