{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"integration-beam","type":"registry:block","title":"Integration beam","description":"An animated product scene: soft light pulses travel along curved beams from your inputs into your product and out to your destinations, with live reflow and interactive pause.","author":"Hairline UI","dependencies":[],"files":[{"path":"registry/integration-beam.tsx","type":"registry:component","content":"// Hairline UI · integration-beam · MIT License\n// Copyright (c) 2026 Hairline UI · https://hairlineui.com/license#components\n\n\"use client\";\n\nimport {\n  useEffect,\n  useId,\n  useLayoutEffect,\n  useRef,\n  useState,\n  type FocusEvent,\n  type PointerEvent,\n  type ReactNode,\n} from \"react\";\n\n/*\n * Integration Beam – an animated product scene, in a single self-contained file.\n * Your product sits in the middle, three tools on each side, joined by curved beams. In sync cycles,\n * soft light pulses travel from the tools on the left into the product and on out to the tools on the\n * right; every arrival makes the target glow. Hover a tool to bring its beam forward, click it to\n * pause it. The beams are measured from the real tile positions, so the scene reflows with its\n * container – on narrow widths the tools stack above and below and the curves morph into place.\n */\n\nexport type BeamTool = {\n  /** Shown in the tooltip and read to screen readers, e.g. \"Slack\" */\n  name: string;\n  /** Logo, drawn into a 28 × 28 box (an <svg> fills the box) */\n  logo: ReactNode;\n};\n\nexport type BeamCenter = {\n  /** Your product's name, used in the accessible description */\n  name: string;\n  /** Your mark, drawn into a 36 × 36 box on the dark tile – a neutral flower when left out */\n  logo?: ReactNode;\n};\n\nexport type IntegrationBeamProps = {\n  /** Tools that send data in (left, or above on narrow widths) – three look best */\n  left?: BeamTool[];\n  /** Tools that receive data (right, or below on narrow widths) – three look best */\n  right?: BeamTool[];\n  /** The product in the middle */\n  center?: BeamCenter;\n  className?: string;\n  /** Accessible description of the scene */\n  label?: string;\n};\n\n/* Choreography, in ms */\nconst TRAVEL = 1500; // one pulse, end to end\nconst STAGGER = 280; // between the pulses of one wave\nconst REST = 1500; // quiet time between two sync cycles\nconst MORPH = 460; // tiles and curves gliding to a new layout\nconst FLASH = 1400; // tooltip shown after a tap\nconst EASE = \"cubic-bezier(0.22, 1, 0.36, 1)\";\n\n/** Easing of the morph – the same curve as EASE (it's easeOutQuint), so curves and tiles move together */\nconst easeOut = (t: number) => 1 - (1 - t) ** 5;\n/** Pulses glide in and out softly instead of shooting off */\nconst easeInOut = (t: number) => -(Math.cos(Math.PI * t) - 1) / 2;\n\n// useLayoutEffect measures before the first paint; on the server it simply never runs\nconst useIsoLayoutEffect = typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\ntype Point = { x: number; y: number };\n/** A cubic curve as 8 numbers: start, two control points, end – one shape, so any two can be blended */\ntype Curve = number[];\n\nexport function IntegrationBeam({\n  left = DEFAULT_LEFT,\n  right = DEFAULT_RIGHT,\n  center = DEFAULT_CENTER,\n  className,\n  label,\n}: IntegrationBeamProps) {\n  const uid = \"ui-ib\" + useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n  const tools = [...left, ...right];\n  const n = tools.length;\n  const nLeft = left.length;\n\n  const [off, setOff] = useState<ReadonlySet<number>>(() => new Set());\n  const [focus, setFocus] = useState<number | null>(null);\n  const [flash, setFlash] = useState<number | null>(null);\n  const [syncing, setSyncing] = useState(false);\n  const [announce, setAnnounce] = useState(\"\");\n\n  const rootRef = useRef<HTMLDivElement>(null);\n  const sceneRef = useRef<HTMLDivElement>(null);\n  const svgRef = useRef<SVGSVGElement>(null);\n  const centerRef = useRef<HTMLDivElement>(null);\n  const centerRingRef = useRef<HTMLSpanElement>(null);\n  const chipRef = useRef<HTMLSpanElement>(null);\n  const chipInnerRef = useRef<HTMLSpanElement>(null);\n  const toolRefs = useRef<(HTMLButtonElement | null)[]>([]);\n  const ringRefs = useRef<(HTMLSpanElement | null)[]>([]);\n  const lineRefs = useRef<(SVGPathElement | null)[]>([]);\n  const pulseRefs = useRef<(SVGGElement | null)[]>([]);\n  const gradRefs = useRef<(SVGLinearGradientElement | null)[]>([]);\n  const flashTimer = useRef(0);\n  // The animation loop reads the paused tools without restarting\n  const offRef = useRef(off);\n  useIsoLayoutEffect(() => {\n    offRef.current = off;\n  }, [off]);\n\n  const connected = n - off.size;\n  const status = connected === 0 ? \"All paused\" : syncing ? \"Syncing…\" : `${connected}\\u00A0connected`;\n\n  /* ---------- Beams: measure, morph, pulses ---------- */\n  useIsoLayoutEffect(() => {\n    const root = rootRef.current;\n    const scene = sceneRef.current;\n    const svg = svgRef.current;\n    const hub = centerRef.current;\n    if (!root || !scene || !svg || !hub) return;\n    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n\n    let shown: Curve[] = [];\n    let from: Curve[] = [];\n    let to: Curve[] = [];\n    let morphStart = 0;\n    let lastPos: Point[] | null = null;\n    let lastStack: boolean | null = null;\n    const lengths: number[] = [];\n\n    // Tiles are positioned, the scene and groups are not – so offsets are relative to the root and ignore transforms\n    const centerOf = (el: HTMLElement): Point => ({\n      x: el.offsetLeft + el.offsetWidth / 2,\n      y: el.offsetTop + el.offsetHeight / 2,\n    });\n\n    // Horizontal tangents side by side, vertical ones when stacked: the S-curve leaves and enters each tile straight\n    const curve = (a: Point, b: Point, stack: boolean): Curve => {\n      if (stack) {\n        const my = (a.y + b.y) / 2;\n        return [a.x, a.y, a.x, my, b.x, my, b.x, b.y];\n      }\n      const mx = (a.x + b.x) / 2;\n      return [a.x, a.y, mx, a.y, mx, b.y, b.x, b.y];\n    };\n\n    const draw = (curves: Curve[]) => {\n      shown = curves;\n      curves.forEach((c, i) => {\n        const d = `M${c[0]} ${c[1]}C${c[2]} ${c[3]} ${c[4]} ${c[5]} ${c[6]} ${c[7]}`;\n        const line = lineRefs.current[i];\n        if (!line) return;\n        line.setAttribute(\"d\", d);\n        pulseRefs.current[i]?.querySelectorAll(\"path\").forEach((p) => p.setAttribute(\"d\", d));\n        lengths[i] = line.getTotalLength();\n      });\n    };\n\n    const measure = () => {\n      svg.setAttribute(\"viewBox\", `0 0 ${root.clientWidth} ${root.clientHeight}`);\n      const stack = getComputedStyle(scene).getPropertyValue(\"--ui-ib-stack\").trim() === \"1\";\n      const els = [...toolRefs.current.slice(0, n), hub];\n      if (els.some((el) => !el)) return;\n      const pos = els.map((el) => centerOf(el!));\n      const c = pos[n];\n      // Left tools send into the centre, the centre sends out to the right – paths run in the pulse's direction\n      const target = pos.slice(0, n).map((p, i) => (i < nLeft ? curve(p, c, stack) : curve(c, p, stack)));\n\n      if (lastPos && lastStack !== null && stack !== lastStack && !reduce) {\n        // The layout flipped: tiles glide from their old spots (FLIP), the curves blend along with them\n        els.forEach((el, i) => {\n          const dx = lastPos![i].x - pos[i].x;\n          const dy = lastPos![i].y - pos[i].y;\n          if (dx || dy) {\n            el!.animate?.([{ transform: `translate(${dx}px, ${dy}px)` }, { transform: \"none\" }], {\n              duration: MORPH,\n              easing: EASE,\n            });\n          }\n        });\n        from = shown.length === n ? shown : target;\n        to = target;\n        morphStart = performance.now();\n        kick();\n      } else if (morphStart) {\n        // Resizing while a morph runs: keep gliding, just towards the new spots\n        to = target;\n      } else {\n        draw(target);\n      }\n      lastPos = pos;\n      lastStack = stack;\n    };\n\n    /* Pulses: one per beam at a time, started from a schedule that's rebuilt every sync cycle */\n    const pulseStart: (number | null)[] = Array(n).fill(null);\n    let queue: { beam: number; at: number }[] = [];\n    let nextCycle = 0;\n    let syncFrom = 0;\n    let syncTo = 0;\n    let wasSyncing = false;\n    let visible = false;\n    let raf = 0;\n\n    const hide = (i: number) => {\n      pulseStart[i] = null;\n      const g = pulseRefs.current[i];\n      if (g) g.style.opacity = \"0\";\n    };\n\n    const ring = (el: HTMLElement | null | undefined) =>\n      el?.animate?.(\n        [\n          { opacity: 0, transform: \"scale(0.96)\" },\n          { opacity: 1, transform: \"scale(1)\", offset: 0.3 },\n          { opacity: 0, transform: \"scale(1.14)\" },\n        ],\n        { duration: 760, easing: \"ease-out\" },\n      );\n\n    const planCycle = (now: number) => {\n      const ins = Array.from({ length: nLeft }, (_, i) => i).filter((i) => !offRef.current.has(i));\n      const outs = Array.from({ length: n - nLeft }, (_, i) => nLeft + i).filter((i) => !offRef.current.has(i));\n      if (!ins.length && !outs.length) {\n        nextCycle = now + REST;\n        return;\n      }\n      const t0 = now;\n      // The outgoing wave leaves as the first incoming pulse lands\n      const tOut = ins.length ? t0 + TRAVEL : t0;\n      queue = [\n        ...ins.map((beam, k) => ({ beam, at: t0 + k * STAGGER })),\n        ...outs.map((beam, k) => ({ beam, at: tOut + k * STAGGER })),\n      ];\n      const end = Math.max(...queue.map((q) => q.at)) + TRAVEL;\n      syncFrom = ins.length ? tOut : t0;\n      syncTo = end;\n      nextCycle = end + REST;\n    };\n\n    const paint = (i: number, t: number) => {\n      const line = lineRefs.current[i];\n      const g = pulseRefs.current[i];\n      const grad = gradRefs.current[i];\n      if (!line || !g || !grad) return;\n      const L = lengths[i] || 0;\n      const seg = Math.min(84, L * 0.42);\n      const head = easeInOut(t) * (L + seg);\n      // One dash, `seg` long, ending at the head\n      g.querySelectorAll(\"path\").forEach((p) => {\n        p.style.strokeDasharray = `${seg} ${L + seg}`;\n        p.style.strokeDashoffset = `${seg - head}`;\n      });\n      // The gradient runs from tail (clear) to head (bright) along the dash\n      const a = line.getPointAtLength(Math.max(0, Math.min(L, head - seg)));\n      const b = line.getPointAtLength(Math.max(0, Math.min(L, head)));\n      grad.setAttribute(\"x1\", `${a.x}`);\n      grad.setAttribute(\"y1\", `${a.y}`);\n      grad.setAttribute(\"x2\", `${b.x + (b.x === a.x && b.y === a.y ? 0.01 : 0)}`);\n      grad.setAttribute(\"y2\", `${b.y}`);\n      g.style.opacity = \"1\";\n    };\n\n    const frame = (now: number) => {\n      raf = 0;\n      if (morphStart) {\n        const t = Math.min(1, (now - morphStart) / MORPH);\n        const e = easeOut(t);\n        draw(to.map((c, i) => c.map((v, k) => (from[i]?.[k] ?? v) + (v - (from[i]?.[k] ?? v)) * e)));\n        if (t >= 1) morphStart = 0;\n      }\n      if (visible && !reduce) {\n        if (now >= nextCycle) planCycle(now);\n        queue = queue.filter((q) => {\n          if (q.at > now) return true;\n          if (!offRef.current.has(q.beam) && pulseStart[q.beam] === null) pulseStart[q.beam] = q.at;\n          return false;\n        });\n        for (let i = 0; i < n; i++) {\n          const start = pulseStart[i];\n          if (start === null) continue;\n          // Paused mid-flight: the pulse fades out where it is\n          if (offRef.current.has(i)) {\n            hide(i);\n            continue;\n          }\n          const t = (now - start) / TRAVEL;\n          if (t >= 1) {\n            hide(i);\n            ring(i < nLeft ? centerRingRef.current : ringRefs.current[i]);\n            continue;\n          }\n          paint(i, t);\n        }\n        const isSyncing = now >= syncFrom && now < syncTo;\n        if (isSyncing !== wasSyncing) {\n          wasSyncing = isSyncing;\n          setSyncing(isSyncing);\n        }\n      }\n      if (morphStart || (visible && !reduce)) raf = requestAnimationFrame(frame);\n    };\n    const kick = () => {\n      if (!raf) raf = requestAnimationFrame(frame);\n    };\n\n    measure();\n    const ro = new ResizeObserver(measure);\n    ro.observe(root);\n\n    // Runs only while the scene is on screen\n    const io =\n      typeof IntersectionObserver === \"undefined\"\n        ? null\n        : new IntersectionObserver(([e]) => {\n            visible = e.isIntersecting;\n            if (visible) {\n              nextCycle = performance.now() + 400;\n              kick();\n            } else {\n              queue = [];\n              for (let i = 0; i < n; i++) hide(i);\n              syncTo = 0;\n              if (wasSyncing) setSyncing((wasSyncing = false));\n            }\n          });\n    io?.observe(root);\n\n    return () => {\n      ro.disconnect();\n      io?.disconnect();\n      cancelAnimationFrame(raf);\n    };\n  }, [n, nLeft]);\n\n  /* The status chip glides to the width of its new text */\n  useIsoLayoutEffect(() => {\n    const chip = chipRef.current;\n    const inner = chipInnerRef.current;\n    if (chip && inner) chip.style.width = `${inner.offsetWidth}px`;\n  }, [status]);\n\n  useEffect(() => () => window.clearTimeout(flashTimer.current), []);\n\n  const toggle = (i: number) => {\n    const pausing = !off.has(i);\n    const next = new Set(off);\n    if (pausing) next.add(i);\n    else next.delete(i);\n    setOff(next);\n    offRef.current = next;\n    setAnnounce(`${tools[i].name} ${pausing ? \"paused\" : \"connected\"}. ${n - next.size} of ${n} connected.`);\n    // On touch there's no hover: show the tooltip for a moment so the tap says what it did\n    setFlash(i);\n    window.clearTimeout(flashTimer.current);\n    flashTimer.current = window.setTimeout(() => setFlash(null), FLASH);\n  };\n\n  const onEnter = (i: number) => (e: PointerEvent<HTMLButtonElement>) => {\n    if (e.pointerType === \"mouse\") setFocus(i);\n  };\n  const onFocus = (i: number) => (e: FocusEvent<HTMLButtonElement>) => {\n    if (e.currentTarget.matches(\":focus-visible\")) setFocus(i);\n  };\n\n  const tile = (t: BeamTool, i: number) => (\n    <button\n      key={i}\n      ref={(el) => {\n        toolRefs.current[i] = el;\n      }}\n      type=\"button\"\n      className=\"ui-ib__tool\"\n      aria-pressed={!off.has(i)}\n      aria-label={`${t.name}, ${off.has(i) ? \"paused\" : \"connected\"}`}\n      data-off={off.has(i) || undefined}\n      data-tip={focus === i || flash === i || undefined}\n      onClick={() => toggle(i)}\n      onPointerEnter={onEnter(i)}\n      onPointerLeave={() => setFocus(null)}\n      onFocus={onFocus(i)}\n      onBlur={() => setFocus(null)}\n    >\n      <span\n        className=\"ui-ib__ring\"\n        ref={(el) => {\n          ringRefs.current[i] = el;\n        }}\n      />\n      <span className=\"ui-ib__logo\" aria-hidden=\"true\">\n        {t.logo}\n      </span>\n      <span className=\"ui-ib__tip\" aria-hidden=\"true\">\n        {t.name}\n        {off.has(i) && <span className=\"ui-ib__tip-state\"> · Paused</span>}\n      </span>\n    </button>\n  );\n\n  return (\n    <div\n      ref={rootRef}\n      className={[\"ui-ib\", className].filter(Boolean).join(\" \")}\n      role=\"group\"\n      aria-label={label ?? `${center.name} connected to ${tools.map((t) => t.name).join(\", \")}`}\n      data-focus={focus !== null || undefined}\n    >\n      {/* React 19 hoists this into <head> once, no matter how many instances render */}\n      <style href=\"ui-integration-beam\" precedence=\"default\">\n        {css}\n      </style>\n\n      <svg ref={svgRef} className=\"ui-ib__beams\" aria-hidden=\"true\">\n        <defs>\n          {/* User-space region: a straight, flat beam has a zero-height box and would lose its glow otherwise */}\n          <filter id={`${uid}-blur`} filterUnits=\"userSpaceOnUse\" x=\"-100\" y=\"-100\" width=\"10000\" height=\"10000\">\n            <feGaussianBlur stdDeviation=\"3\" />\n          </filter>\n          {tools.map((_, i) => (\n            <linearGradient\n              key={i}\n              id={`${uid}-g${i}`}\n              gradientUnits=\"userSpaceOnUse\"\n              ref={(el) => {\n                gradRefs.current[i] = el;\n              }}\n            >\n              <stop offset=\"0\" className=\"ui-ib__stop-tail\" />\n              <stop offset=\"0.6\" className=\"ui-ib__stop-mid\" />\n              <stop offset=\"1\" className=\"ui-ib__stop-head\" />\n            </linearGradient>\n          ))}\n        </defs>\n        {tools.map((_, i) => (\n          <path\n            key={i}\n            className=\"ui-ib__line\"\n            data-off={off.has(i) || undefined}\n            data-focus={focus === i || undefined}\n            ref={(el) => {\n              lineRefs.current[i] = el;\n            }}\n          />\n        ))}\n        {tools.map((_, i) => (\n          <g\n            key={i}\n            className=\"ui-ib__pulse\"\n            data-focus={focus === i || undefined}\n            ref={(el) => {\n              pulseRefs.current[i] = el;\n            }}\n          >\n            <path className=\"ui-ib__glow\" stroke={`url(#${uid}-g${i})`} filter={`url(#${uid}-blur)`} />\n            <path className=\"ui-ib__core\" stroke={`url(#${uid}-g${i})`} />\n          </g>\n        ))}\n      </svg>\n\n      <div ref={sceneRef} className=\"ui-ib__scene\">\n        <div className=\"ui-ib__group ui-ib__group--in\">{left.map((t, i) => tile(t, i))}</div>\n\n        <div ref={centerRef} className=\"ui-ib__center\" data-syncing={(syncing && connected > 0) || undefined}>\n          <span className=\"ui-ib__ring ui-ib__ring--center\" ref={centerRingRef} />\n          <span className=\"ui-ib__mark\" aria-hidden=\"true\">\n            {center.logo ?? <ProductMark />}\n          </span>\n          <span ref={chipRef} className=\"ui-ib__chip\">\n            <span ref={chipInnerRef} className=\"ui-ib__chip-inner\">\n              <span className=\"ui-ib__dot\" data-idle={connected === 0 || undefined} />\n              <span className=\"ui-ib__status\" key={status}>\n                {status}\n              </span>\n            </span>\n          </span>\n        </div>\n\n        <div className=\"ui-ib__group ui-ib__group--out\">{right.map((t, i) => tile(t, nLeft + i))}</div>\n      </div>\n\n      <span className=\"ui-ib__sr\" aria-live=\"polite\">\n        {announce}\n      </span>\n    </div>\n  );\n}\n\n/* A neutral four-petal flower, with fainter diagonal petals */\nexport function ProductMark() {\n  const petal = \"M24 24C17.6 19.6 16.4 9.4 24 3.5C31.6 9.4 30.4 19.6 24 24Z\";\n  return (\n    <svg viewBox=\"0 0 48 48\" aria-hidden=\"true\">\n      <g opacity=\"0.36\">\n        {[45, 135, 225, 315].map((r) => (\n          <path key={r} d={petal} transform={`rotate(${r} 24 24)`} />\n        ))}\n      </g>\n      {[0, 90, 180, 270].map((r) => (\n        <path key={r} d={petal} transform={`rotate(${r} 24 24)`} />\n      ))}\n    </svg>\n  );\n}\n\n/* ---------- Brand marks: the brands' own marks (svgl.app, Simple Icons – CC0) ---------- */\n\nconst Svg = ({ children }: { children: ReactNode }) => (\n  <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n    {children}\n  </svg>\n);\n\nexport const DEFAULT_CENTER: BeamCenter = { name: \"Acme\" };\n\nexport const DEFAULT_LEFT: BeamTool[] = [\n  {\n    name: \"Slack\",\n    logo: (\n      <Svg>\n        <svg x=\"2\" y=\"2\" width=\"20\" height=\"20\" viewBox=\"0 0 2447.6 2452.5\">\n          <g clipRule=\"evenodd\" fillRule=\"evenodd\">\n            <path\n              d=\"m897.4 0c-135.3.1-244.8 109.9-244.7 245.2-.1 135.3 109.5 245.1 244.8 245.2h244.8v-245.1c.1-135.3-109.5-245.1-244.9-245.3.1 0 .1 0 0 0m0 654h-652.6c-135.3.1-244.9 109.9-244.8 245.2-.2 135.3 109.4 245.1 244.7 245.3h652.7c135.3-.1 244.9-109.9 244.8-245.2.1-135.4-109.5-245.2-244.8-245.3z\"\n              fill=\"#36c5f0\"\n            />\n            <path\n              d=\"m2447.6 899.2c.1-135.3-109.5-245.1-244.8-245.2-135.3.1-244.9 109.9-244.8 245.2v245.3h244.8c135.3-.1 244.9-109.9 244.8-245.3zm-652.7 0v-654c.1-135.2-109.4-245-244.7-245.2-135.3.1-244.9 109.9-244.8 245.2v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.3z\"\n              fill=\"#2eb67d\"\n            />\n            <path\n              d=\"m1550.1 2452.5c135.3-.1 244.9-109.9 244.8-245.2.1-135.3-109.5-245.1-244.8-245.2h-244.8v245.2c-.1 135.2 109.5 245 244.8 245.2zm0-654.1h652.7c135.3-.1 244.9-109.9 244.8-245.2.2-135.3-109.4-245.1-244.7-245.3h-652.7c-135.3.1-244.9 109.9-244.8 245.2-.1 135.4 109.4 245.2 244.7 245.3z\"\n              fill=\"#ecb22e\"\n            />\n            <path\n              d=\"m0 1553.2c-.1 135.3 109.5 245.1 244.8 245.2 135.3-.1 244.9-109.9 244.8-245.2v-245.2h-244.8c-135.3.1-244.9 109.9-244.8 245.2zm652.7 0v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.2v-653.9c.2-135.3-109.4-245.1-244.7-245.3-135.4 0-244.9 109.8-244.8 245.1 0 0 0 .1 0 0\"\n              fill=\"#e01e5a\"\n            />\n          </g>\n        </svg>\n      </Svg>\n    ),\n  },\n  {\n    name: \"Notion\",\n    logo: (\n      <Svg>\n        <path\n          fill=\"currentColor\"\n          d=\"M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z\"\n        />\n      </Svg>\n    ),\n  },\n  {\n    name: \"Gmail\",\n    logo: (\n      <Svg>\n        <svg x=\"2\" y=\"2\" width=\"20\" height=\"20\" viewBox=\"0 49.4 512 399.42\">\n          <g fill=\"none\" fillRule=\"evenodd\">\n            <g fillRule=\"nonzero\">\n              <path fill=\"#4285f4\" d=\"M34.91 448.818h81.454V251L0 163.727V413.91c0 19.287 15.622 34.91 34.91 34.91z\" />\n              <path fill=\"#34a853\" d=\"M395.636 448.818h81.455c19.287 0 34.909-15.622 34.909-34.909V163.727L395.636 251z\" />\n              <path fill=\"#fbbc04\" d=\"M395.636 99.727V251L512 163.727v-46.545c0-43.142-49.25-67.782-83.782-41.891z\" />\n            </g>\n            <path fill=\"#ea4335\" d=\"M116.364 251V99.727L256 204.455 395.636 99.727V251L256 355.727z\" />\n            <path fill=\"#c5221f\" fillRule=\"nonzero\" d=\"M0 117.182v46.545L116.364 251V99.727L83.782 75.291C49.25 49.4 0 74.04 0 117.18z\" />\n          </g>\n        </svg>\n      </Svg>\n    ),\n  },\n];\n\nexport const DEFAULT_RIGHT: BeamTool[] = [\n  {\n    name: \"HubSpot\",\n    logo: (\n      <Svg>\n        <path\n          fill=\"#FF7A59\"\n          d=\"M18.164 7.93V5.084a2.198 2.198 0 001.267-1.978v-.067A2.2 2.2 0 0017.238.845h-.067a2.2 2.2 0 00-2.193 2.193v.067a2.196 2.196 0 001.252 1.973l.013.006v2.852a6.22 6.22 0 00-2.969 1.31l.012-.01-7.828-6.095A2.497 2.497 0 104.3 4.656l-.012.006 7.697 5.991a6.176 6.176 0 00-1.038 3.446c0 1.343.425 2.588 1.147 3.607l-.013-.02-2.342 2.343a1.968 1.968 0 00-.58-.095h-.002a2.033 2.033 0 102.033 2.033 1.978 1.978 0 00-.1-.595l.005.014 2.317-2.317a6.247 6.247 0 104.782-11.134l-.036-.005zm-.964 9.378a3.206 3.206 0 113.215-3.207v.002a3.206 3.206 0 01-3.207 3.207z\"\n        />\n      </Svg>\n    ),\n  },\n  {\n    name: \"Linear\",\n    logo: (\n      <Svg>\n        <path\n          fill=\"#5E6AD2\"\n          d=\"M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z\"\n        />\n      </Svg>\n    ),\n  },\n  {\n    name: \"Google Drive\",\n    logo: (\n      <Svg>\n        <svg x=\"1\" y=\"2\" width=\"22\" height=\"20\" viewBox=\"0 0 87.3 78\">\n          <path d=\"m6.6 66.85 3.85 6.65c.8 1.4 1.95 2.5 3.3 3.3l13.75-23.8h-27.5c0 1.55.4 3.1 1.2 4.5z\" fill=\"#0066da\" />\n          <path d=\"m43.65 25-13.75-23.8c-1.35.8-2.5 1.9-3.3 3.3l-25.4 44a9.06 9.06 0 0 0 -1.2 4.5h27.5z\" fill=\"#00ac47\" />\n          <path d=\"m73.55 76.8c1.35-.8 2.5-1.9 3.3-3.3l1.6-2.75 7.65-13.25c.8-1.4 1.2-2.95 1.2-4.5h-27.502l5.852 11.5z\" fill=\"#ea4335\" />\n          <path d=\"m43.65 25 13.75-23.8c-1.35-.8-2.9-1.2-4.5-1.2h-18.5c-1.6 0-3.15.45-4.5 1.2z\" fill=\"#00832d\" />\n          <path d=\"m59.8 53h-32.3l-13.75 23.8c1.35.8 2.9 1.2 4.5 1.2h50.8c1.6 0 3.15-.45 4.5-1.2z\" fill=\"#2684fc\" />\n          <path d=\"m73.4 26.5-12.7-22c-.8-1.4-1.95-2.5-3.3-3.3l-13.75 23.8 16.15 28h27.45c0-1.55-.4-3.1-1.2-4.5z\" fill=\"#ffba00\" />\n        </svg>\n      </Svg>\n    ),\n  },\n];\n\n/* ---------- Styles ---------- */\n\nconst css = /* css */ `\n.ui-ib {\n  --ui-ib-ink: #171717;\n  --ui-ib-text: #404040;\n  --ui-ib-muted: #8f8f8f;\n  --ui-ib-faint: #b5b5b5;\n  --ui-ib-line: #e2e2e2;\n  --ui-ib-line-hi: #a9c0ff;\n  --ui-ib-card: #ffffff;\n  --ui-ib-tray: #f0f0f0;\n  --ui-ib-accent: #2f6bff;\n  /* Pulse: clear tail, accent body, a pale tip that reads as light */\n  --ui-ib-pulse: #2f6bff;\n  --ui-ib-tip-color: #b9cdff;\n  --ui-ib-ring: rgba(47, 107, 255, 0.2);\n  --ui-ib-glow: rgba(47, 107, 255, 0.26);\n  --ui-ib-hub: #171717;\n  --ui-ib-hub-mark: #ffffff;\n  --ui-ib-hub-edge: rgba(0, 0, 0, 0.9);\n  --ui-ib-tooltip: #171717;\n  --ui-ib-tooltip-text: #ffffff;\n  --ui-ib-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 18px -10px rgba(0, 0, 0, 0.18);\n  --ui-ib-focus: rgba(23, 23, 23, 0.22);\n  --ui-ib-ease: ${EASE};\n  position: relative;\n  width: 100%;\n  container-type: inline-size;\n  font-family: Inter, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif;\n  font-size: 13px;\n  color: var(--ui-ib-text);\n  -webkit-tap-highlight-color: transparent;\n}\n.ui-ib *, .ui-ib *::before, .ui-ib *::after { box-sizing: border-box; }\n\n/* ---------- Beams ---------- */\n\n/* Absolute, so it paints below the (positioned) tiles */\n.ui-ib__beams {\n  position: absolute;\n  inset: 0;\n  width: 100%;\n  height: 100%;\n  overflow: visible;\n  pointer-events: none;\n}\n.ui-ib__line {\n  fill: none;\n  stroke: var(--ui-ib-line);\n  stroke-width: 1.5;\n  stroke-linecap: round;\n  transition: stroke 300ms var(--ui-ib-ease), opacity 300ms var(--ui-ib-ease);\n}\n.ui-ib__line[data-off] { stroke: var(--ui-ib-faint); stroke-dasharray: 2 5; opacity: 0.75; }\n.ui-ib[data-focus] .ui-ib__line:not([data-focus]) { opacity: 0.35; }\n.ui-ib__line[data-focus]:not([data-off]) { stroke: var(--ui-ib-line-hi); }\n\n.ui-ib__pulse { opacity: 0; transition: opacity 240ms ease; }\n.ui-ib__pulse path { fill: none; stroke-linecap: round; transition: opacity 300ms var(--ui-ib-ease); }\n.ui-ib__core { stroke-width: 2; }\n.ui-ib__glow { stroke-width: 6; opacity: 0.45; }\n.ui-ib[data-focus] .ui-ib__pulse:not([data-focus]) path { opacity: 0.25; }\n.ui-ib__pulse[data-focus] .ui-ib__glow { opacity: 0.7; }\n.ui-ib__stop-tail { stop-color: var(--ui-ib-pulse); stop-opacity: 0; }\n.ui-ib__stop-mid { stop-color: var(--ui-ib-pulse); stop-opacity: 0.9; }\n.ui-ib__stop-head { stop-color: var(--ui-ib-tip-color); stop-opacity: 1; }\n\n/* ---------- Layout: side by side, stacked on narrow widths ---------- */\n\n.ui-ib__scene {\n  --ui-ib-stack: 0;\n  display: grid;\n  grid-template-columns: auto minmax(40px, 1fr) auto minmax(40px, 1fr) auto;\n  grid-template-areas: \"in . hub . out\";\n  align-items: center;\n  padding: 6px 0;\n}\n.ui-ib__group { display: flex; flex-direction: column; gap: 26px; }\n.ui-ib__group--in { grid-area: in; }\n.ui-ib__group--out { grid-area: out; }\n\n/* ---------- Tools ---------- */\n\n.ui-ib__tool {\n  position: relative;\n  display: grid;\n  place-items: center;\n  width: 60px;\n  height: 60px;\n  padding: 0;\n  border: 0;\n  border-radius: 18px;\n  background: var(--ui-ib-card);\n  box-shadow: var(--ui-ib-shadow);\n  color: var(--ui-ib-ink);\n  font: inherit;\n  cursor: pointer;\n  transition: background-color 300ms var(--ui-ib-ease), box-shadow 300ms var(--ui-ib-ease);\n}\n.ui-ib__tool:focus-visible { outline: 2px solid var(--ui-ib-focus); outline-offset: 3px; }\n.ui-ib__logo {\n  display: grid;\n  width: 28px;\n  height: 28px;\n  transition: transform 300ms var(--ui-ib-ease), filter 300ms var(--ui-ib-ease), opacity 300ms var(--ui-ib-ease);\n}\n.ui-ib__logo > svg { width: 100%; height: 100%; }\n@media (hover: hover) {\n  .ui-ib__tool:hover .ui-ib__logo { transform: scale(1.08); }\n}\n.ui-ib__tool[data-off] { background: var(--ui-ib-tray); }\n.ui-ib__tool[data-off] .ui-ib__logo { filter: grayscale(1); opacity: 0.4; }\n\n/* Arrival glow – played with the Web Animations API */\n.ui-ib__ring {\n  position: absolute;\n  inset: 0;\n  border-radius: inherit;\n  box-shadow: 0 0 0 3px var(--ui-ib-ring), 0 0 22px 2px var(--ui-ib-glow);\n  opacity: 0;\n  pointer-events: none;\n}\n\n/* Tooltip: points toward the centre, so it never leaves the scene */\n.ui-ib__tip {\n  --ui-ib-tip-from: translate(-4px, -50%);\n  position: absolute;\n  z-index: 3;\n  top: 50%;\n  left: calc(100% + 10px);\n  padding: 5px 9px;\n  border-radius: 8px;\n  background: var(--ui-ib-tooltip);\n  color: var(--ui-ib-tooltip-text);\n  font-size: 12px;\n  font-weight: 500;\n  line-height: 16px;\n  white-space: nowrap;\n  pointer-events: none;\n  opacity: 0;\n  transform: var(--ui-ib-tip-from);\n  transition: opacity 180ms ease, transform 260ms var(--ui-ib-ease);\n}\n.ui-ib__group--out .ui-ib__tip { --ui-ib-tip-from: translate(4px, -50%); left: auto; right: calc(100% + 10px); }\n.ui-ib__tip-state { opacity: 0.6; font-weight: 400; }\n.ui-ib__tool[data-tip] .ui-ib__tip { opacity: 1; transform: translate(0, -50%); }\n\n/* ---------- Centre ---------- */\n\n.ui-ib__center {\n  grid-area: hub;\n  position: relative;\n  display: grid;\n  place-items: center;\n  width: 80px;\n  height: 80px;\n  border-radius: 24px;\n  background: var(--ui-ib-hub);\n  box-shadow: 0 0 0 1px var(--ui-ib-hub-edge), inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 14px 28px -12px rgba(0, 0, 0, 0.38);\n  color: var(--ui-ib-hub-mark);\n}\n.ui-ib__mark { display: grid; width: 36px; height: 36px; fill: currentColor; }\n.ui-ib__mark > svg { width: 100%; height: 100%; }\n.ui-ib__ring--center { inset: -1px; }\n\n/* Status chip under the hub – absolute, so the hub itself stays centred on the beams */\n.ui-ib__chip {\n  position: absolute;\n  top: calc(100% + 12px);\n  left: 50%;\n  translate: -50% 0;\n  display: block;\n  height: 26px;\n  overflow: hidden;\n  border-radius: 999px;\n  background: var(--ui-ib-card);\n  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);\n  transition: width 320ms var(--ui-ib-ease);\n}\n.ui-ib__chip-inner {\n  display: inline-flex;\n  align-items: center;\n  gap: 7px;\n  width: max-content;\n  height: 26px;\n  padding: 0 11px 0 10px;\n  font-size: 12px;\n  font-weight: 500;\n  color: var(--ui-ib-text);\n  white-space: nowrap;\n  font-variant-numeric: tabular-nums;\n}\n.ui-ib__status { display: inline-block; animation: ui-ib-in 320ms var(--ui-ib-ease) both; }\n.ui-ib__dot {\n  width: 6px;\n  height: 6px;\n  border-radius: 50%;\n  background: var(--ui-ib-accent);\n  transition: background-color 300ms ease;\n}\n.ui-ib__dot[data-idle] { background: var(--ui-ib-faint); }\n.ui-ib__center[data-syncing] .ui-ib__dot { animation: ui-ib-breathe 1.1s ease-in-out infinite; }\n\n.ui-ib__sr {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  overflow: hidden;\n  clip-path: inset(50%);\n  white-space: nowrap;\n}\n\n@keyframes ui-ib-in { from { opacity: 0; transform: translateY(6px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }\n@keyframes ui-ib-breathe { 50% { box-shadow: 0 0 0 3px var(--ui-ib-ring); } }\n\n/* Narrow: senders above, receivers below, vertical beams */\n@container (max-width: 459px) {\n  .ui-ib__scene {\n    --ui-ib-stack: 1;\n    grid-template-columns: 1fr;\n    grid-template-areas: \"in\" \"hub\" \"out\";\n    justify-items: center;\n    row-gap: 78px;\n    padding: 0 0 4px;\n  }\n  .ui-ib__group { flex-direction: row; gap: clamp(14px, 7cqw, 34px); }\n  .ui-ib__tool { width: 56px; height: 56px; border-radius: 17px; }\n  .ui-ib__center { width: 76px; height: 76px; border-radius: 23px; }\n  /* Tooltips sit between the rows; the outer tools align theirs to their edge */\n  .ui-ib__tip,\n  .ui-ib__group--out .ui-ib__tip {\n    --ui-ib-tip-from: translate(-50%, -4px);\n    top: calc(100% + 8px);\n    right: auto;\n    left: 50%;\n  }\n  .ui-ib__group--out .ui-ib__tip { --ui-ib-tip-from: translate(-50%, 4px); top: auto; bottom: calc(100% + 8px); }\n  .ui-ib__tool[data-tip] .ui-ib__tip { transform: translate(-50%, 0); }\n  .ui-ib__tool:first-child .ui-ib__tip { left: 0; translate: 50% 0; }\n  .ui-ib__tool:last-child .ui-ib__tip { left: 100%; translate: -50% 0; }\n}\n\n/* Touch: the tiles are already 56px+; tooltips are shown after a tap instead of on hover */\n@media (hover: none) and (pointer: coarse) {\n  .ui-ib__tool { min-width: 44px; min-height: 44px; }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .ui-ib__line, .ui-ib__tool, .ui-ib__logo, .ui-ib__tip, .ui-ib__chip, .ui-ib__dot { transition: none; }\n  .ui-ib__status, .ui-ib__center[data-syncing] .ui-ib__dot { animation: none; }\n}\n\n/* Dark mode: follows a .dark class or data-theme=\"dark\" on any ancestor, e.g. <html> */\n:where(.dark, [data-theme=\"dark\"]) .ui-ib {\n  --ui-ib-ink: #ededed;\n  --ui-ib-text: #c8c8cc;\n  --ui-ib-muted: #8b8b92;\n  --ui-ib-faint: #5c5c63;\n  --ui-ib-line: #2e2e33;\n  --ui-ib-line-hi: #4b5f9e;\n  --ui-ib-card: #19191b;\n  --ui-ib-tray: #111113;\n  --ui-ib-accent: #6d8bff;\n  --ui-ib-pulse: #6d8bff;\n  --ui-ib-tip-color: #ffffff;\n  --ui-ib-ring: rgba(109, 139, 255, 0.24);\n  --ui-ib-glow: rgba(109, 139, 255, 0.3);\n  --ui-ib-hub: #26262a;\n  --ui-ib-hub-mark: #ffffff;\n  --ui-ib-hub-edge: rgba(255, 255, 255, 0.12);\n  --ui-ib-tooltip: #ededed;\n  --ui-ib-tooltip-text: #111113;\n  --ui-ib-shadow: 0 0 0 1px #2a2a2e, 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 18px -10px rgba(0, 0, 0, 0.6);\n  --ui-ib-focus: rgba(255, 255, 255, 0.3);\n}\n:where(.dark, [data-theme=\"dark\"]) .ui-ib__chip { box-shadow: 0 0 0 1px #2a2a2e, 0 1px 2px rgba(0, 0, 0, 0.3); }\n`;\n"}],"css":{},"docs":"Docs and live preview: https://hairlineui.com/ui/integration-beam. MIT licensed: https://hairlineui.com/license#components","meta":{"license":"MIT"}}