{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chat-order-button",
  "type": "registry:component",
  "title": "Chat Order Button",
  "description": "A pill button with a speech bubble icon that opens a chat with a prefilled message, with a hover glow, sizes, variants and an unread dot.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "ordering",
    "chat",
    "button",
    "order",
    "messaging",
    "link",
    "contact"
  ],
  "docs": "https://hyperblur.dev/effects/chat-order-button",
  "files": [
    {
      "path": "registry/hyperblur/chat-order-button.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/chat-order-button.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ChatOrderButtonProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\" | \"children\"> {\n  phone?: string;\n  message?: string;\n  label?: string;\n  sublabel?: string;\n  size?: \"sm\" | \"md\" | \"lg\";\n  variant?: \"dark\" | \"light\" | \"outline\" | \"solid\";\n  unread?: boolean | number;\n  accent?: string;\n  newTab?: boolean;\n  unreadLabel?: string;\n}\n\nexport function buildChatHref(phone: string, message?: string) {\n  const digits = phone.replace(/\\D/g, \"\");\n  const text = message ? `?text=${encodeURIComponent(message)}` : \"\";\n  return `https://wa.me/${digits}${text}`;\n}\n\nconst css = `\n.hb-ob3 {\n  --hb-ob3-h: 48px;\n  --hb-ob3-icon: 30px;\n  --hb-ob3-fs: 14.5px;\n  --hb-ob3-bg: #0d0d0d;\n  --hb-ob3-fg: #f2f2f2;\n  --hb-ob3-sub: #9a9a9a;\n  --hb-ob3-line: #2a2a2a;\n  position: relative;\n  box-sizing: border-box;\n  display: inline-flex;\n  align-items: center;\n  gap: 11px;\n  height: var(--hb-ob3-h);\n  padding: 0 20px 0 calc((var(--hb-ob3-h) - var(--hb-ob3-icon)) / 2);\n  border: 1px solid var(--hb-ob3-line);\n  border-radius: 999px;\n  background: var(--hb-ob3-bg);\n  color: var(--hb-ob3-fg);\n  font-family: inherit;\n  font-size: var(--hb-ob3-fs);\n  font-weight: 600;\n  line-height: 1;\n  letter-spacing: -0.005em;\n  text-decoration: none;\n  white-space: nowrap;\n  isolation: isolate;\n  cursor: pointer;\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 22px -14px rgba(0, 0, 0, 0.7);\n  transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.15s ease, background-color 0.2s ease;\n  -webkit-tap-highlight-color: transparent;\n}\n.hb-ob3 *, .hb-ob3 *::before, .hb-ob3 *::after { box-sizing: border-box; }\n.hb-ob3::before {\n  content: \"\";\n  position: absolute;\n  inset: -1px;\n  z-index: -1;\n  border-radius: inherit;\n  background: radial-gradient(120% 140% at 12% 50%, color-mix(in srgb, var(--hb-ob3-accent) 30%, transparent) 0%, transparent 55%);\n  opacity: 0;\n  transition: opacity 0.3s ease;\n}\n.hb-ob3:hover, .hb-ob3:focus-visible {\n  border-color: color-mix(in srgb, var(--hb-ob3-accent) 55%, var(--hb-ob3-line));\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 4px color-mix(in srgb, var(--hb-ob3-accent) 14%, transparent), 0 10px 34px -8px color-mix(in srgb, var(--hb-ob3-accent) 55%, transparent);\n}\n.hb-ob3:hover::before, .hb-ob3:focus-visible::before { opacity: 1; }\n.hb-ob3:active { transform: scale(0.97); }\n.hb-ob3:focus-visible { outline: 2px solid var(--hb-ob3-accent); outline-offset: 3px; }\n.hb-ob3[data-size=\"sm\"] { --hb-ob3-h: 38px; --hb-ob3-icon: 24px; --hb-ob3-fs: 13px; gap: 8px; padding-right: 15px; }\n.hb-ob3[data-size=\"lg\"] { --hb-ob3-h: 58px; --hb-ob3-icon: 38px; --hb-ob3-fs: 16px; gap: 13px; padding-right: 26px; }\n.hb-ob3[data-variant=\"light\"] { --hb-ob3-bg: #ffffff; --hb-ob3-fg: #111111; --hb-ob3-sub: #666666; --hb-ob3-line: #e4e4e4; box-shadow: 0 8px 22px -14px rgba(0, 0, 0, 0.35); }\n.hb-ob3[data-variant=\"outline\"] { --hb-ob3-bg: transparent; --hb-ob3-line: color-mix(in srgb, var(--hb-ob3-accent) 45%, transparent); box-shadow: none; }\n.hb-ob3[data-variant=\"solid\"] { --hb-ob3-bg: var(--hb-ob3-accent); --hb-ob3-fg: #06210f; --hb-ob3-sub: rgba(6, 33, 15, 0.7); --hb-ob3-line: transparent; }\n.hb-ob3-icon {\n  position: relative;\n  display: grid;\n  flex: none;\n  place-items: center;\n  width: var(--hb-ob3-icon);\n  height: var(--hb-ob3-icon);\n  border-radius: 50%;\n  background: color-mix(in srgb, var(--hb-ob3-accent) 14%, transparent);\n  transition: transform 0.35s cubic-bezier(0.3, 1.5, 0.5, 1);\n}\n.hb-ob3[data-variant=\"solid\"] .hb-ob3-icon { background: rgba(255, 255, 255, 0.28); }\n.hb-ob3:hover .hb-ob3-icon { transform: rotate(-8deg) scale(1.06); }\n.hb-ob3-icon svg { width: 78%; height: 78%; overflow: visible; }\n.hb-ob3-bubble { fill: var(--hb-ob3-accent); }\n.hb-ob3[data-variant=\"solid\"] .hb-ob3-bubble { fill: #ffffff; }\n.hb-ob3-handset { color: #ffffff; }\n.hb-ob3-handset rect { fill: currentColor; }\n.hb-ob3-handset path { fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; }\n.hb-ob3[data-variant=\"solid\"] .hb-ob3-handset { color: var(--hb-ob3-accent); }\n.hb-ob3:hover .hb-ob3-handset { animation: hb-ob3-ring 0.6s ease; transform-origin: 50% 50%; transform-box: fill-box; }\n.hb-ob3-text { display: flex; flex-direction: column; gap: 3px; }\n.hb-ob3-sub { color: var(--hb-ob3-sub); font-size: 0.76em; font-weight: 500; }\n.hb-ob3-dot {\n  position: absolute;\n  top: -2px;\n  right: -2px;\n  display: grid;\n  place-items: center;\n  min-width: 12px;\n  height: 12px;\n  padding: 0 3px;\n  border: 2px solid var(--hb-ob3-bg);\n  border-radius: 999px;\n  background: #ff4d4f;\n  color: #ffffff;\n  font-size: 9px;\n  font-weight: 700;\n  line-height: 1;\n}\n.hb-ob3[data-variant=\"outline\"] .hb-ob3-dot { border-color: #0d0d0d; }\n.hb-ob3-dot[data-count=\"true\"] { top: -5px; right: -6px; min-width: 17px; height: 17px; }\n.hb-ob3-dot::after {\n  content: \"\";\n  position: absolute;\n  inset: -2px;\n  border-radius: inherit;\n  box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.6);\n  animation: hb-ob3-ping 1.8s ease-out infinite;\n}\n@keyframes hb-ob3-ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(5deg); } }\n@keyframes hb-ob3-ping { 0% { box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.55); } 80%, 100% { box-shadow: 0 0 0 7px rgba(255, 77, 79, 0); } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-ob3, .hb-ob3::before, .hb-ob3-icon { transition: none; }\n  .hb-ob3:hover .hb-ob3-icon { transform: none; }\n  .hb-ob3:hover .hb-ob3-handset, .hb-ob3-dot::after { animation: none; }\n}\n`;\n\nexport function ChatOrderButton({\n  phone = \"1 555 555 0142\",\n  message = \"Hi! I'd like to place an order for pickup.\",\n  label = \"Order on chat\",\n  sublabel,\n  size = \"md\",\n  variant = \"dark\",\n  unread = false,\n  accent = \"#25d366\",\n  newTab = true,\n  unreadLabel = \"unread\",\n  className,\n  style,\n  ...rest\n}: ChatOrderButtonProps) {\n  const count = typeof unread === \"number\" ? unread : 0;\n  const showDot = unread === true || count > 0;\n  return (\n    <a\n      href={buildChatHref(phone, message)}\n      target={newTab ? \"_blank\" : undefined}\n      rel={newTab ? \"noopener noreferrer\" : undefined}\n      className={[\"hb-ob3\", className].filter(Boolean).join(\" \")}\n      data-size={size}\n      data-variant={variant}\n      style={{ \"--hb-ob3-accent\": accent, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-chat-order-button\" precedence=\"default\">{css}</style>\n      <span className=\"hb-ob3-icon\" aria-hidden=\"true\">\n        <svg viewBox=\"0 0 24 24\">\n          <path className=\"hb-ob3-bubble\" d=\"M6.2 2.6h11.6a3.8 3.8 0 0 1 3.8 3.8v8.2a3.8 3.8 0 0 1-3.8 3.8h-1.3l.9 3.3c.15.55-.47.98-.93.64l-5.2-3.94H6.2a3.8 3.8 0 0 1-3.8-3.8V6.4a3.8 3.8 0 0 1 3.8-3.8Z\" />\n          <g className=\"hb-ob3-handset\">\n            <rect x=\"7.4\" y=\"6.4\" width=\"3.6\" height=\"2.4\" rx=\"1.1\" transform=\"rotate(-45 9.2 7.6)\" />\n            <rect x=\"12.6\" y=\"11.6\" width=\"3.6\" height=\"2.4\" rx=\"1.1\" transform=\"rotate(-45 14.4 12.8)\" />\n            <path d=\"M8.9 8.4Q9.4 12.6 13.6 13.1\" />\n          </g>\n        </svg>\n        {showDot ? (\n          <span className=\"hb-ob3-dot\" data-count={count > 0 ? \"true\" : \"false\"}>\n            {count > 0 ? (count > 9 ? \"9+\" : count) : null}\n          </span>\n        ) : null}\n      </span>\n      <span className=\"hb-ob3-text\">\n        <span>{label}</span>\n        {sublabel ? <span className=\"hb-ob3-sub\">{sublabel}</span> : null}\n      </span>\n      {showDot ? <span style={{ position: \"absolute\", width: 1, height: 1, overflow: \"hidden\", clip: \"rect(0 0 0 0)\" }}>{count > 0 ? `, ${count} ${unreadLabel}` : `, ${unreadLabel}`}</span> : null}\n    </a>\n  );\n}\n"
    }
  ]
}