{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"location-card","type":"registry:ui","title":"Location card","description":"Stylized SVG map card with a dropped pin, address, hours, phone and a Google Maps directions link.","dependencies":["lucide-react","motion"],"registryDependencies":["utils"],"files":[{"path":"registry/items/location-card/location-card.tsx","type":"registry:ui","target":"components/facade/location-card.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { motion, useReducedMotion } from \"motion/react\";\nimport { ArrowUpRight, Clock, MapPin, Phone } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface LocationCardProps {\n  name?: string;\n  /** Single line street address, used for display and the directions link. */\n  address?: string;\n  phone?: string;\n  /** Short hours line, e.g. \"Mon to Fri 8 AM to 6 PM\". */\n  hours?: string;\n  /** Small label above the name, e.g. \"Downtown\". */\n  label?: string;\n  /** Extra note under the address, e.g. parking info. */\n  note?: string;\n  /** Map layout seed so multiple cards look different. */\n  variant?: 0 | 1 | 2;\n  className?: string;\n}\n\nexport function directionsUrl(address: string) {\n  return `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(address)}`;\n}\n\nfunction telHref(phone: string) {\n  return `tel:${phone.replace(/[^\\d+]/g, \"\")}`;\n}\n\nconst LAYOUTS = [\n  {\n    pin: { x: 58, y: 52 },\n    park: { x: 12, y: 14, w: 24, h: 20 },\n    water: \"M -5 78 C 20 70, 38 92, 62 84 S 96 74, 110 82 L 110 110 L -5 110 Z\",\n    diag: \"M -5 40 L 110 4\",\n  },\n  {\n    pin: { x: 44, y: 46 },\n    park: { x: 64, y: 62, w: 26, h: 18 },\n    water: \"M 78 -5 C 70 18, 92 30, 84 52 S 96 80, 110 92 L 110 -5 Z\",\n    diag: \"M -5 88 L 104 -5\",\n  },\n  {\n    pin: { x: 52, y: 40 },\n    park: { x: 8, y: 64, w: 22, h: 26 },\n    water: \"M -5 -5 L 46 -5 C 40 6, 22 10, 18 22 S -2 32, -5 30 Z\",\n    diag: \"M 20 110 L 110 30\",\n  },\n] as const;\n\nconst EASE = [0.16, 1, 0.3, 1] as const;\n\nfunction MapArt({ variant, reduce }: { variant: 0 | 1 | 2; reduce: boolean | null }) {\n  const l = LAYOUTS[variant];\n  const p = l.park;\n  const minor = [8, 24, 31, 46, 54, 70, 86, 93];\n  const major = [16, 39, 62, 78];\n  const trees = [\n    [0.25, 0.3, 1.7],\n    [0.6, 0.45, 2.2],\n    [0.35, 0.72, 1.5],\n    [0.78, 0.75, 1.8],\n  ] as const;\n  return (\n    <div className=\"absolute inset-0 overflow-hidden\">\n      <svg\n        viewBox=\"0 0 100 100\"\n        preserveAspectRatio=\"xMidYMid slice\"\n        className=\"absolute inset-0 size-full text-foreground\"\n        aria-hidden\n      >\n        {/* Blocks tint */}\n        <rect width=\"100\" height=\"100\" fill=\"currentColor\" opacity=\"0.03\" />\n        {/* Park */}\n        <rect x={p.x} y={p.y} width={p.w} height={p.h} rx=\"1.5\" className=\"fill-success/15\" />\n        <g className=\"fill-success/25\">\n          {trees.map(([tx, ty, r], i) => (\n            <circle key={i} cx={p.x + p.w * tx} cy={p.y + p.h * ty} r={r} />\n          ))}\n        </g>\n        {/* Water */}\n        <path d={l.water} fill=\"currentColor\" opacity=\"0.06\" />\n        {/* Minor streets */}\n        <g stroke=\"var(--background)\" strokeOpacity=\"0.7\" strokeWidth=\"0.6\">\n          {minor.map((v) => (\n            <React.Fragment key={v}>\n              <line x1={v} y1=\"-5\" x2={v} y2=\"105\" />\n              <line x1=\"-5\" y1={v} x2=\"105\" y2={v} />\n            </React.Fragment>\n          ))}\n        </g>\n        {/* Major streets */}\n        <g stroke=\"var(--background)\" strokeWidth=\"2.2\" strokeLinecap=\"round\">\n          {major.map((v) => (\n            <React.Fragment key={v}>\n              <line x1={v} y1=\"-5\" x2={v} y2=\"105\" />\n              <line x1=\"-5\" y1={v} x2=\"105\" y2={v} />\n            </React.Fragment>\n          ))}\n          <path d={l.diag} fill=\"none\" strokeWidth=\"3.2\" />\n        </g>\n        {/* Route to pin */}\n        <motion.path\n          d={`M ${l.pin.x - 30} 105 L ${l.pin.x - 30} ${l.pin.y + 14} L ${l.pin.x} ${l.pin.y + 14} L ${l.pin.x} ${l.pin.y + 1}`}\n          fill=\"none\"\n          stroke=\"var(--brand)\"\n          strokeWidth=\"1\"\n          strokeDasharray=\"2 1.6\"\n          strokeLinecap=\"round\"\n          initial={reduce ? false : { pathLength: 0, opacity: 0 }}\n          whileInView={{ pathLength: 1, opacity: 0.9 }}\n          viewport={{ once: true, margin: \"-40px 0px\" }}\n          transition={{ duration: 1.4, ease: EASE, delay: 0.3 }}\n        />\n      </svg>\n\n      {/* Pin */}\n      <div className=\"absolute\" style={{ left: `${l.pin.x}%`, top: `${l.pin.y}%` }}>\n        <span className=\"absolute left-0 top-0 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-brand/40\" aria-hidden />\n        <motion.span\n          initial={reduce ? false : { y: -12, opacity: 0 }}\n          whileInView={{ y: 0, opacity: 1 }}\n          viewport={{ once: true, margin: \"-40px 0px\" }}\n          transition={{ type: \"spring\", stiffness: 380, damping: 34 }}\n          className=\"absolute bottom-1 left-0 block -translate-x-1/2\"\n        >\n          <span className=\"grid size-9 rotate-45 place-items-center rounded-full rounded-br-none bg-brand text-brand-foreground shadow-float ring-[3px] ring-background\">\n            <MapPin className=\"size-4 -rotate-45\" aria-hidden />\n          </span>\n        </motion.span>\n      </div>\n    </div>\n  );\n}\n\nexport function LocationCard({\n  name = \"Riverside Family Dental\",\n  address = \"2150 S Broadway, Denver, CO 80210\",\n  phone = \"(303) 555-0119\",\n  hours = \"Mon to Fri, 8 AM to 6 PM\",\n  label,\n  note,\n  variant = 0,\n  className,\n}: LocationCardProps) {\n  const reduce = useReducedMotion();\n  return (\n    <article className={cn(\"w-full overflow-hidden rounded-[28px] bg-muted text-foreground\", className)}>\n      <a\n        href={directionsUrl(address)}\n        target=\"_blank\"\n        rel=\"noopener noreferrer\"\n        aria-label={`Open ${name} in Google Maps`}\n        className=\"group relative block aspect-[16/9] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\"\n      >\n        <MapArt variant={variant} reduce={reduce} />\n        <span className=\"absolute bottom-3 right-3 inline-flex h-7 items-center gap-1 rounded-full bg-background px-3 text-[12px] font-medium text-foreground shadow-float transition-transform duration-300 group-hover:-translate-y-0.5\">\n          Open map <ArrowUpRight className=\"size-3\" aria-hidden />\n        </span>\n      </a>\n      <div className=\"p-6\">\n        {label && <p className=\"mb-1.5 text-[12px] font-medium uppercase tracking-[0.08em] text-muted-foreground\">{label}</p>}\n        <h3 className=\"font-display text-[19px] font-semibold tracking-[-0.02em]\">{name}</h3>\n        <address className=\"mt-1 text-[15px] not-italic leading-relaxed text-muted-foreground\">{address}</address>\n        {note && <p className=\"mt-1 text-[13px] text-muted-foreground\">{note}</p>}\n\n        <dl className=\"mt-4 space-y-2 text-[15px]\">\n          {hours && (\n            <div className=\"flex items-center gap-2.5\">\n              <dt className=\"sr-only\">Hours</dt>\n              <Clock className=\"size-4 shrink-0 text-muted-foreground\" aria-hidden />\n              <dd>{hours}</dd>\n            </div>\n          )}\n          {phone && (\n            <div className=\"flex items-center gap-2.5\">\n              <dt className=\"sr-only\">Phone</dt>\n              <Phone className=\"size-4 shrink-0 text-muted-foreground\" aria-hidden />\n              <dd>\n                <a\n                  href={telHref(phone)}\n                  className=\"rounded tabular-nums underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n                >\n                  {phone}\n                </a>\n              </dd>\n            </div>\n          )}\n        </dl>\n\n        <a\n          href={directionsUrl(address)}\n          target=\"_blank\"\n          rel=\"noopener noreferrer\"\n          className=\"mt-6 inline-flex h-11 w-full items-center justify-center gap-2 rounded-full bg-primary text-[15px] font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-muted\"\n        >\n          Get directions\n          <ArrowUpRight className=\"size-4\" aria-hidden />\n        </a>\n      </div>\n    </article>\n  );\n}\n\nexport default LocationCard;\n"}],"categories":["local-business"],"meta":{"tier":"free","demo":"\"use client\";\n\nimport { LocationCard } from \"./location-card\";\n\nexport default function Demo() {\n  return (\n    <div className=\"mx-auto grid w-full max-w-3xl gap-5 sm:grid-cols-2\">\n      <LocationCard\n        label=\"Pearl District\"\n        name=\"Stumptown Physical Therapy\"\n        address=\"1120 NW Couch St, Portland, OR 97209\"\n        phone=\"(503) 555-0164\"\n        hours=\"Mon to Fri, 7 AM to 7 PM\"\n        note=\"Free validated parking in the Couch Street garage.\"\n        variant={0}\n      />\n      <LocationCard\n        label=\"Sellwood\"\n        name=\"Stumptown Physical Therapy\"\n        address=\"7905 SE 13th Ave, Portland, OR 97202\"\n        phone=\"(503) 555-0178\"\n        hours=\"Mon to Sat, 8 AM to 5 PM\"\n        note=\"Street parking on SE Tenino St.\"\n        variant={1}\n      />\n    </div>\n  );\n}\n"}}