{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "integrations-grid",
  "title": "Integrations Grid",
  "description": "An integrations directory: search, category chips with counts, app cards with icon tiles, Popular and Connected badges, Connect and Disconnect buttons driven by your promise, a running connected count, and a request-an-integration card that doubles as the empty state.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/integrations-grid/integrations-grid.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport interface Integration {\n  id: string;\n  name: string;\n  category: string;\n  description: string;\n  /** Your app icon. Without it a coloured tile with a glyph is drawn. */\n  icon?: React.ReactNode;\n  color?: string;\n  connected?: boolean;\n  popular?: boolean;\n  href?: string;\n}\n\nexport interface IntegrationsGridProps {\n  eyebrow?: string;\n  title?: string;\n  description?: string;\n  integrations?: Integration[];\n  searchable?: boolean;\n  /**\n   * Called when Connect or Disconnect is pressed. Return a promise: the button shows a spinner\n   * while it runs and the new state sticks only if it resolves. Without it the state just toggles.\n   */\n  onToggle?: (id: string, connect: boolean) => void | Promise<void>;\n  /** Link for the \"Request an integration\" card. Pass null to hide the card. */\n  requestHref?: string | null;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { bg: \"#0A0A0A\", text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.6)\", faint: \"rgba(245,244,241,0.38)\", card: \"#111111\", cardHover: \"#151515\", border: \"rgba(255,255,255,0.1)\", chip: \"rgba(255,255,255,0.05)\", on: \"#F5F4F1\", onText: \"#0A0A0A\", ok: \"#4ADE80\", okBg: \"rgba(74,222,128,0.12)\", ring: \"rgba(245,244,241,0.6)\" },\n  light: { bg: \"#FAFAF8\", text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.6)\", faint: \"rgba(10,10,10,0.4)\", card: \"#FFFFFF\", cardHover: \"#FFFFFF\", border: \"rgba(10,10,10,0.1)\", chip: \"rgba(10,10,10,0.04)\", on: \"#0A0A0A\", onText: \"#FAFAF8\", ok: \"#16A34A\", okBg: \"rgba(22,163,74,0.1)\", ring: \"rgba(10,10,10,0.5)\" },\n};\n\nconst DEFAULT_INTEGRATIONS: Integration[] = [\n  { id: \"gitline\", name: \"Gitline\", category: \"Engineering\", description: \"Branches and pull requests move tasks for you.\", color: \"#F97316\", connected: true, popular: true },\n  { id: \"buildbay\", name: \"Buildbay\", category: \"Engineering\", description: \"See build status on every card.\", color: \"#3B82F6\" },\n  { id: \"chatterbox\", name: \"Chatterbox\", category: \"Communication\", description: \"Get updates in channels and reply from chat.\", color: \"#A855F7\", popular: true },\n  { id: \"huddle\", name: \"Huddle\", category: \"Communication\", description: \"Start a call from any task or doc.\", color: \"#22C55E\" },\n  { id: \"framekit\", name: \"Framekit\", category: \"Design\", description: \"Embed live design files in specs.\", color: \"#EC4899\", connected: true },\n  { id: \"pixelpad\", name: \"Pixelpad\", category: \"Design\", description: \"Attach mockups and track feedback.\", color: \"#06B6D4\" },\n  { id: \"calendo\", name: \"Calendo\", category: \"Productivity\", description: \"Due dates and milestones in your calendar.\", color: \"#EAB308\" },\n  { id: \"papertrail\", name: \"Papertrail\", category: \"Productivity\", description: \"Turn signed contracts into projects.\", color: \"#64748B\" },\n  { id: \"helpline\", name: \"Helpline\", category: \"Support\", description: \"Link tickets to the bugs that fix them.\", color: \"#EF4444\", popular: true },\n  { id: \"metricly\", name: \"Metricly\", category: \"Analytics\", description: \"Put product metrics next to the roadmap.\", color: \"#8B5CF6\" },\n  { id: \"wikiwise\", name: \"Wikiwise\", category: \"Productivity\", description: \"Import pages and keep links working.\", color: \"#14B8A6\" },\n  { id: \"slotify\", name: \"Slotify\", category: \"Support\", description: \"Book customer calls from feedback.\", color: \"#F59E0B\" },\n];\n\n// Simple white glyphs for the drawn tiles, picked from the id so each app keeps its own.\nconst GLYPHS: React.ReactNode[] = [\n  <path key=\"g0\" d=\"M7 4h10l3 4-8 12L4 8z\" />,\n  <path key=\"g1\" d=\"M12 3 21 20H3z\" />,\n  <circle key=\"g2\" cx=\"12\" cy=\"12\" r=\"7.5\" />,\n  <path key=\"g3\" d=\"M4 4h7v7H4zM13 13h7v7h-7zM13 4h7v7h-7z\" />,\n  <path key=\"g4\" d=\"M3 18 9 8l4 6 3-4 5 8z\" />,\n  <path key=\"g5\" d=\"M9 3h6v6h6v6h-6v6H9v-6H3V9h6z\" />,\n  <path key=\"g6\" d=\"M5 5h14v4H5zM5 11h10v4H5zM5 17h7v3H5z\" />,\n  <path key=\"g7\" d=\"M12 3a9 9 0 1 1 0 18V3z\" />,\n];\n\nfunction Tile({ it }: { it: Integration }) {\n  if (it.icon) return <span className=\"flex h-11 w-11 shrink-0 items-center justify-center overflow-hidden rounded-xl\">{it.icon}</span>;\n  let h = 7;\n  for (let i = 0; i < it.id.length; i++) h = (h * 33 + it.id.charCodeAt(i) * (i + 1)) % 9973;\n  return (\n    <span className=\"relative flex h-11 w-11 shrink-0 items-center justify-center overflow-hidden rounded-xl\" style={{ background: it.color ?? \"#64748B\" }} aria-hidden=\"true\">\n      <span className=\"absolute inset-0\" style={{ background: \"linear-gradient(140deg, rgba(255,255,255,0.28), transparent 60%)\" }} />\n      <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" className=\"relative\" fill=\"rgba(255,255,255,0.95)\">\n        {GLYPHS[h % GLYPHS.length]}\n      </svg>\n    </span>\n  );\n}\n\nexport function IntegrationsGrid({\n  eyebrow = \"Integrations\",\n  title = \"Works with the tools you already use\",\n  description = \"Connect your code, chat, design and support tools in a couple of clicks. Nexora keeps them in sync both ways.\",\n  integrations = DEFAULT_INTEGRATIONS,\n  searchable = true,\n  onToggle,\n  requestHref = \"#\",\n  theme = \"dark\",\n  className,\n}: IntegrationsGridProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [cat, setCat] = React.useState(\"All\");\n  const [q, setQ] = React.useState(\"\");\n  const [connected, setConnected] = React.useState<Record<string, boolean>>(() => Object.fromEntries(integrations.map((i) => [i.id, !!i.connected])));\n  const [busy, setBusy] = React.useState<string | null>(null);\n  const [failed, setFailed] = React.useState<string | null>(null);\n  const cats = [\"All\", ...Array.from(new Set(integrations.map((i) => i.category)))];\n  const query = q.trim().toLowerCase();\n  const list = integrations.filter((i) => (cat === \"All\" || i.category === cat) && (!query || `${i.name} ${i.category} ${i.description}`.toLowerCase().includes(query)));\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.card } as React.CSSProperties;\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n  const countOn = Object.values(connected).filter(Boolean).length;\n\n  const toggle = async (id: string) => {\n    const next = !connected[id];\n    setFailed(null);\n    if (!onToggle) return setConnected((c) => ({ ...c, [id]: next }));\n    setBusy(id);\n    try {\n      await onToggle(id, next);\n      setConnected((c) => ({ ...c, [id]: next }));\n    } catch {\n      setFailed(id);\n    } finally {\n      setBusy(null);\n    }\n  };\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      <div className=\"mx-auto max-w-6xl px-6 py-20 @[640px]:py-24\">\n        <div className=\"flex flex-col gap-6 @[860px]:flex-row @[860px]:items-end @[860px]:justify-between\">\n          <div>\n            {eyebrow && <p className=\"m-0 text-[13px] font-medium tracking-[0.12em] uppercase\" style={{ color: p.faint }}>{eyebrow}</p>}\n            <h2 className=\"mt-3 mb-0 max-w-[18ch] text-[32px] leading-[1.1] font-semibold tracking-[-0.03em] @[640px]:text-[44px]\">{title}</h2>\n            {description && <p className=\"mt-4 mb-0 max-w-[520px] text-[16px] leading-[1.6]\" style={{ color: p.muted }}>{description}</p>}\n          </div>\n          {searchable && (\n            <div className=\"w-full @[860px]:w-[280px]\">\n              <label htmlFor={`${uid}-q`} className=\"sr-only\">\n                Search integrations\n              </label>\n              <div className=\"relative\">\n                <svg className=\"pointer-events-none absolute top-1/2 left-3.5 -translate-y-1/2\" width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke={p.faint} strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\">\n                  <circle cx=\"11\" cy=\"11\" r=\"6.5\" />\n                  <path d=\"m20 20-4.2-4.2\" />\n                </svg>\n                <input id={`${uid}-q`} type=\"search\" value={q} onChange={(e) => setQ(e.target.value)} placeholder=\"Search integrations\" className=\"h-11 w-full rounded-full border pr-4 pl-10 text-[16px] outline-none focus-visible:ring-2 @[860px]:text-[14px]\" style={{ background: p.chip, borderColor: p.border, color: p.text, ...ring }} />\n              </div>\n            </div>\n          )}\n        </div>\n\n        <div className=\"mt-8 flex flex-col gap-3 @[640px]:flex-row @[640px]:items-center @[640px]:justify-between\">\n          <div role=\"group\" aria-label=\"Category\" className=\"-mx-6 flex gap-1.5 overflow-x-auto px-6 [scrollbar-width:none] @[640px]:mx-0 @[640px]:flex-wrap @[640px]:px-0 [&::-webkit-scrollbar]:hidden\">\n            {cats.map((c) => {\n              const n = c === \"All\" ? integrations.length : integrations.filter((i) => i.category === c).length;\n              const on = cat === c;\n              return (\n                <button key={c} type=\"button\" aria-pressed={on} onClick={() => setCat(c)} className={cn(\"relative h-9 shrink-0 cursor-pointer rounded-full border px-3.5 text-[13px] font-medium whitespace-nowrap transition-colors\", focus)} style={{ borderColor: on ? p.on : p.border, background: on ? p.on : \"transparent\", color: on ? p.onText : p.muted, ...ring, [\"--tw-ring-offset-color\" as string]: p.bg }}>\n                  {c} <span style={{ opacity: 0.55 }}>{n}</span>\n                </button>\n              );\n            })}\n          </div>\n          <p className=\"m-0 shrink-0 text-[13px] tabular-nums\" style={{ color: p.faint }} aria-live=\"polite\">\n            {countOn} connected\n          </p>\n        </div>\n\n        <ul className=\"m-0 mt-6 grid list-none grid-cols-1 gap-3 p-0 @[560px]:grid-cols-2 @[900px]:grid-cols-3\">\n          <AnimatePresence initial={false} mode=\"popLayout\">\n            {list.map((it) => {\n              const on = connected[it.id];\n              const loading = busy === it.id;\n              return (\n                <motion.li key={it.id} layout={!reduce} initial={reduce ? false : { opacity: 0, scale: 0.97 }} animate={{ opacity: 1, scale: 1 }} exit={reduce ? undefined : { opacity: 0, scale: 0.97 }} transition={{ duration: 0.2 }} className=\"group flex flex-col rounded-2xl border p-5 transition-colors\" style={{ background: p.card, borderColor: on ? p.ok + \"55\" : p.border }}>\n                  <div className=\"flex items-start justify-between gap-3\">\n                    <Tile it={it} />\n                    <div className=\"flex items-center gap-1.5\">\n                      {it.popular && (\n                        <span className=\"rounded-full px-2 py-0.5 text-[11px] font-medium\" style={{ background: p.chip, color: p.muted }}>\n                          Popular\n                        </span>\n                      )}\n                      {on && (\n                        <motion.span initial={reduce ? false : { scale: 0.6, opacity: 0 }} animate={{ scale: 1, opacity: 1 }} className=\"flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium\" style={{ background: p.okBg, color: p.ok }}>\n                          <span className=\"h-1.5 w-1.5 rounded-full\" style={{ background: p.ok }} aria-hidden=\"true\" />\n                          Connected\n                        </motion.span>\n                      )}\n                    </div>\n                  </div>\n                  <h3 className=\"mt-4 mb-0 text-[16px] font-semibold\">\n                    {it.href ? (\n                      <a href={it.href} className={cn(\"rounded no-underline hover:underline\", focus)} style={{ color: p.text, ...ring }}>\n                        {it.name}\n                      </a>\n                    ) : (\n                      it.name\n                    )}\n                  </h3>\n                  <p className=\"m-0 mt-0.5 text-[12.5px]\" style={{ color: p.faint }}>\n                    {it.category}\n                  </p>\n                  <p className=\"m-0 mt-3 flex-1 text-[14px] leading-[1.55]\" style={{ color: p.muted }}>\n                    {it.description}\n                  </p>\n                  <div className=\"mt-5 flex items-center justify-between gap-3\">\n                    <button\n                      type=\"button\"\n                      aria-pressed={on}\n                      disabled={loading}\n                      onClick={() => toggle(it.id)}\n                      aria-label={`${on ? \"Disconnect\" : \"Connect\"} ${it.name}`}\n                      className={cn(\"flex h-9 cursor-pointer items-center gap-2 rounded-full border px-4 text-[13px] font-medium transition-colors disabled:cursor-wait\", focus)}\n                      style={{ background: on ? \"transparent\" : p.on, color: on ? p.text : p.onText, borderColor: on ? p.border : p.on, ...ring }}\n                    >\n                      {loading && <motion.span className=\"h-3.5 w-3.5 rounded-full border-2 border-current border-t-transparent\" animate={reduce ? undefined : { rotate: 360 }} transition={{ repeat: Infinity, duration: 0.8, ease: \"linear\" }} aria-hidden=\"true\" />}\n                      {loading ? (on ? \"Disconnecting\" : \"Connecting\") : on ? \"Disconnect\" : \"Connect\"}\n                    </button>\n                    {failed === it.id && (\n                      <span role=\"alert\" className=\"text-[12.5px]\" style={{ color: \"#FF7A6B\" }}>\n                        Could not connect\n                      </span>\n                    )}\n                  </div>\n                </motion.li>\n              );\n            })}\n          </AnimatePresence>\n          {requestHref !== null && (\n            <li className=\"flex flex-col items-start justify-center rounded-2xl border border-dashed p-5\" style={{ borderColor: p.border }}>\n              <p className=\"m-0 text-[15px] font-semibold\">{list.length === 0 ? `Nothing for “${q.trim() || cat}” yet` : \"Missing a tool?\"}</p>\n              <p className=\"m-0 mt-1.5 text-[14px] leading-[1.55]\" style={{ color: p.muted }}>\n                Tell us what you use. Most requests ship within a quarter, and our API covers the rest.\n              </p>\n              <a href={requestHref} className={cn(\"mt-4 inline-flex h-9 items-center rounded-full border px-4 text-[13px] font-medium no-underline\", focus)} style={{ borderColor: p.border, color: p.text, ...ring }}>\n                Request an integration →\n              </a>\n            </li>\n          )}\n        </ul>\n      </div>\n    </section>\n  );\n}\n\nexport default IntegrationsGrid;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}