{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "faq-topic-icons",
  "type": "registry:component",
  "title": "FAQ Topic Icons",
  "description": "An accordion where every question has a topic icon that draws itself and lights up when opened, with a search field (press slash to focus, arrow keys to move, Enter to open), match highlighting, a result count and topic chips.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "faq",
    "faq",
    "accordion",
    "search",
    "icons",
    "keyboard",
    "section"
  ],
  "docs": "https://hyperblur.dev/effects/faq-topic-icons",
  "files": [
    {
      "path": "registry/hyperblur/faq-topic-icons.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/faq-topic-icons.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport type FaqTopicIconsTopic = \"billing\" | \"security\" | \"team\" | \"data\" | \"integrations\" | \"account\";\n\nexport interface FaqTopicIconsItem {\n  question: string;\n  answer: string;\n  topic: FaqTopicIconsTopic;\n}\n\nexport interface FaqTopicIconsProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  items?: FaqTopicIconsItem[];\n  defaultOpen?: number | null;\n  placeholder?: string;\n  contact?: { label: string; href: string };\n  onItemToggle?: (index: number, open: boolean) => void;\n  accent?: string;\n}\n\nconst css = `\n.hb-wc9 {\n  --hb-wc9-accent: #2f7bff;\n  container-type: inline-size;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-wc9 *, .hb-wc9 *::before, .hb-wc9 *::after { box-sizing: border-box; }\n.hb-wc9-inner { max-width: 880px; margin: 0 auto; padding: 72px 20px; }\n.hb-wc9-head { display: grid; gap: 22px; margin-bottom: 26px; }\n.hb-wc9-eyebrow { margin: 0 0 12px; color: var(--hb-wc9-accent); font-size: 13px; font-weight: 650; letter-spacing: .02em; }\n.hb-wc9-title { margin: 0; font-family: var(--font-grotesk), var(--font-sans), sans-serif; font-size: clamp(30px, 5cqi, 46px); font-weight: 600; line-height: 1.05; letter-spacing: -.035em; }\n.hb-wc9-sub { margin: 12px 0 0; max-width: 460px; color: #8f8f8f; font-size: 15.5px; line-height: 1.55; }\n.hb-wc9-search { position: relative; display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 8px 0 16px; border: 1px solid rgba(255, 255, 255, .09); border-radius: 14px; background: linear-gradient(180deg, #141414, #101010); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); transition: border-color .2s ease, box-shadow .2s ease; }\n.hb-wc9-search:focus-within { border-color: color-mix(in srgb, var(--hb-wc9-accent) 70%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-wc9-accent) 16%, transparent); }\n.hb-wc9-search > svg { flex: none; width: 17px; height: 17px; color: #6f6f6f; }\n.hb-wc9-input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: #ededed; font: inherit; font-size: 15px; outline: none; }\n.hb-wc9-input::placeholder { color: #5f5f5f; }\n.hb-wc9-input::-webkit-search-cancel-button { display: none; }\n.hb-wc9-count { color: #6f6f6f; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }\n.hb-wc9-kbd { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 6px; background: #1a1a1a; color: #8f8f8f; font-family: var(--font-mono), monospace; font-size: 11.5px; box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .05); }\n.hb-wc9-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }\n.hb-wc9-chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 999px; background: transparent; color: #a1a1a1; font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; transition: color .2s ease, background .2s ease, border-color .2s ease; }\n.hb-wc9-chip:hover { color: #ededed; border-color: rgba(255, 255, 255, .18); }\n.hb-wc9-chip[aria-pressed=\"true\"] { border-color: color-mix(in srgb, var(--hb-wc9-accent) 60%, transparent); background: color-mix(in srgb, var(--hb-wc9-accent) 14%, transparent); color: #fff; }\n.hb-wc9-chip svg { width: 14px; height: 14px; }\n.hb-wc9-chip:focus-visible, .hb-wc9-q:focus-visible, .hb-wc9-link:focus-visible { outline: 2px solid var(--hb-wc9-accent); outline-offset: 2px; }\n.hb-wc9-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }\n.hb-wc9-item { position: relative; border: 1px solid rgba(255, 255, 255, .07); border-radius: 16px; background: #0f0f0f; transition: border-color .3s ease, background .3s ease; animation: hb-wc9-in .4s cubic-bezier(.2, .9, .3, 1) both; }\n.hb-wc9-item[data-open=\"true\"] { border-color: rgba(255, 255, 255, .12); background: linear-gradient(180deg, #141414, #0f0f0f); }\n.hb-wc9-item[data-active=\"true\"] { border-color: color-mix(in srgb, var(--hb-wc9-accent) 55%, transparent); }\n.hb-wc9-q { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px 14px 14px; border: 0; border-radius: 16px; background: none; color: #ededed; font: inherit; font-size: 15.5px; font-weight: 550; text-align: left; cursor: pointer; }\n.hb-wc9-tile { position: relative; display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px; background: #171717; color: #8f8f8f; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); transition: background .35s ease, color .35s ease, box-shadow .35s ease, transform .45s cubic-bezier(.3, 1.6, .5, 1); }\n.hb-wc9-tile svg { width: 19px; height: 19px; overflow: visible; }\n.hb-wc9-tile path { stroke-dasharray: 1; stroke-dashoffset: 0; }\n.hb-wc9-q:hover .hb-wc9-tile { transform: rotate(-6deg) scale(1.05); }\n.hb-wc9-item[data-open=\"true\"] .hb-wc9-tile { background: color-mix(in srgb, var(--hb-wc9-accent) 20%, #141414); color: #fff; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hb-wc9-accent) 60%, transparent), 0 8px 20px -8px var(--hb-wc9-accent); }\n.hb-wc9-item[data-open=\"true\"] .hb-wc9-tile path { animation: hb-wc9-draw .9s cubic-bezier(.65, 0, .35, 1) both; }\n.hb-wc9-item[data-open=\"true\"] .hb-wc9-tile path:nth-child(2) { animation-delay: .12s; }\n.hb-wc9-item[data-open=\"true\"] .hb-wc9-tile path:nth-child(3) { animation-delay: .24s; }\n.hb-wc9-qt { flex: 1; min-width: 0; }\n.hb-wc9-qt mark, .hb-wc9-a mark { padding: 0 2px; border-radius: 3px; background: color-mix(in srgb, var(--hb-wc9-accent) 32%, transparent); color: #fff; }\n.hb-wc9-pm { position: relative; flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .1); transition: transform .5s cubic-bezier(.3, 1.4, .5, 1), background .3s ease, border-color .3s ease; }\n.hb-wc9-pm::before, .hb-wc9-pm::after { content: \"\"; position: absolute; left: 50%; top: 50%; width: 10px; height: 1.6px; border-radius: 1px; background: #a1a1a1; transform: translate(-50%, -50%); transition: transform .5s cubic-bezier(.3, 1.4, .5, 1), background .3s ease; }\n.hb-wc9-pm::after { transform: translate(-50%, -50%) rotate(90deg); }\n.hb-wc9-item[data-open=\"true\"] .hb-wc9-pm { transform: rotate(180deg); background: #ededed; border-color: #ededed; }\n.hb-wc9-item[data-open=\"true\"] .hb-wc9-pm::before, .hb-wc9-item[data-open=\"true\"] .hb-wc9-pm::after { background: #0a0a0a; }\n.hb-wc9-item[data-open=\"true\"] .hb-wc9-pm::after { transform: translate(-50%, -50%) rotate(0deg); }\n.hb-wc9-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s cubic-bezier(.2, .8, .2, 1); }\n.hb-wc9-item[data-open=\"true\"] .hb-wc9-wrap { grid-template-rows: 1fr; }\n.hb-wc9-wrap > div { min-height: 0; overflow: hidden; }\n.hb-wc9-a { margin: 0; padding: 0 56px 18px 66px; color: #a1a1a1; font-size: 14.5px; line-height: 1.65; opacity: 0; transform: translateY(-6px); transition: opacity .3s ease, transform .4s cubic-bezier(.2, .8, .2, 1); }\n.hb-wc9-item[data-open=\"true\"] .hb-wc9-a { opacity: 1; transform: none; transition-delay: .08s; }\n.hb-wc9-empty { display: grid; justify-items: center; gap: 10px; padding: 40px 16px; border: 1px dashed rgba(255, 255, 255, .1); border-radius: 16px; color: #8f8f8f; font-size: 14.5px; text-align: center; }\n.hb-wc9-empty b { color: #ededed; font-weight: 600; }\n.hb-wc9-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; color: #6f6f6f; font-size: 13px; }\n.hb-wc9-keys { display: inline-flex; align-items: center; gap: 6px; }\n.hb-wc9-link { display: inline-flex; align-items: center; gap: 6px; color: #ededed; font-weight: 550; text-decoration: none; border-radius: 6px; }\n.hb-wc9-link svg { width: 13px; height: 13px; transition: transform .3s ease; }\n.hb-wc9-link:hover svg { transform: translateX(3px); }\n@keyframes hb-wc9-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }\n@keyframes hb-wc9-in { from { opacity: 0; transform: translateY(6px); } }\n@container (min-width: 720px) {\n  .hb-wc9-inner { padding: 104px 32px; }\n  .hb-wc9-head { grid-template-columns: minmax(0, 1fr) minmax(0, 340px); align-items: end; gap: 32px; }\n}\n@container (max-width: 520px) {\n  .hb-wc9-a { padding: 0 16px 16px 66px; }\n  .hb-wc9-keys { display: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-wc9 *, .hb-wc9 *::before, .hb-wc9 *::after { animation: none !important; transition: none !important; }\n}\n`;\n\nconst topicIcons: Record<FaqTopicIconsTopic, string[]> = {\n  billing: [\"M2 5.5h16v10H2z\", \"M2 8.5h16\", \"M5 12.5h4\"],\n  security: [\"M10 2l6.5 2.5v5c0 4-2.8 6.8-6.5 8-3.7-1.2-6.5-4-6.5-8v-5z\", \"M7 10l2.2 2.2L13.5 8\"],\n  team: [\"M7.5 9a3 3 0 100-6 3 3 0 000 6z\", \"M2 17c0-3 2.5-5 5.5-5s5.5 2 5.5 5\", \"M13.5 3.3a3 3 0 010 5.4M15.5 12.4c1.6.7 2.5 2.4 2.5 4.6\"],\n  data: [\"M10 2c4 0 7 1.3 7 3s-3 3-7 3-7-1.3-7-3 3-3 7-3z\", \"M3 5v5c0 1.7 3 3 7 3s7-1.3 7-3V5\", \"M3 10v5c0 1.7 3 3 7 3s7-1.3 7-3v-5\"],\n  integrations: [\"M8 3v4M12 3v4\", \"M5 7h10v3a5 5 0 01-10 0z\", \"M10 15v3\"],\n  account: [\"M10 9.5a3.5 3.5 0 100-7 3.5 3.5 0 000 7z\", \"M3 18c.8-3.5 3.6-5.5 7-5.5s6.2 2 7 5.5\"],\n};\n\nconst topicLabels: Record<FaqTopicIconsTopic, string> = {\n  billing: \"Billing\",\n  security: \"Security\",\n  team: \"Team\",\n  data: \"Data\",\n  integrations: \"Integrations\",\n  account: \"Account\",\n};\n\nconst defaultItems: FaqTopicIconsItem[] = [\n  { topic: \"billing\", question: \"Can I switch between monthly and yearly billing?\", answer: \"Yes. Switch from Settings, Billing at any time. Moving to yearly applies a prorated credit for the rest of your month, and moving to monthly takes effect at the end of your current year.\" },\n  { topic: \"security\", question: \"Where is my data stored and is it encrypted?\", answer: \"Workspaces are hosted in Frankfurt or Virginia, your choice at signup. Data is encrypted at rest with AES-256 and in transit with TLS 1.3, and keys rotate every 90 days.\" },\n  { topic: \"team\", question: \"How do guest seats work?\", answer: \"Guests can view and comment on the projects you share with them and never count toward your seat total. Each paid seat includes five guests.\" },\n  { topic: \"integrations\", question: \"Which tools can I connect?\", answer: \"There are native integrations for 60 tools including issue trackers, chat, calendars and storage. Anything else connects through webhooks or the REST API with a personal token.\" },\n  { topic: \"data\", question: \"Can I export everything if I leave?\", answer: \"Export your full workspace as JSON or CSV from Settings, Data. Files come as a zip with the original folder structure. Exports stay available for 30 days after you cancel.\" },\n  { topic: \"account\", question: \"How do I transfer workspace ownership?\", answer: \"An owner can hand over ownership to any admin from Members. The new owner confirms by email, and billing moves with the ownership.\" },\n  { topic: \"billing\", question: \"Do you offer discounts for nonprofits or education?\", answer: \"Registered nonprofits and accredited schools get 50 percent off any paid plan. Apply from the billing page with your registration number.\" },\n  { topic: \"security\", question: \"Do you support SSO and SCIM?\", answer: \"SAML single sign-on and SCIM provisioning are available on the Business plan and work with every major identity provider.\" },\n];\n\nfunction Icon({ topic }: { topic: FaqTopicIconsTopic }) {\n  return (\n    <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\">\n      {topicIcons[topic].map((d) => (\n        <path key={d} d={d} pathLength={1} fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n      ))}\n    </svg>\n  );\n}\n\nfunction highlight(text: string, terms: string[]) {\n  if (!terms.length) return text;\n  const esc = terms.map((t) => t.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\"));\n  const re = new RegExp(`(${esc.join(\"|\")})`, \"gi\");\n  return text.split(re).map((part, i) => (i % 2 === 1 ? <mark key={i}>{part}</mark> : <React.Fragment key={i}>{part}</React.Fragment>));\n}\n\nexport function FaqTopicIcons({\n  eyebrow = \"Help center\",\n  title = \"Questions, answered.\",\n  subtitle = \"Search the most common questions or filter by topic. Still stuck? A real person replies in under two hours.\",\n  items = defaultItems,\n  defaultOpen = 1,\n  placeholder = \"Search questions\",\n  contact = { label: \"Contact support\", href: \"#\" },\n  onItemToggle,\n  accent = \"#2f7bff\",\n  className = \"\",\n  style,\n  ...rest\n}: FaqTopicIconsProps) {\n  const [query, setQuery] = React.useState(\"\");\n  const [topic, setTopic] = React.useState<FaqTopicIconsTopic | null>(null);\n  const [open, setOpen] = React.useState<number | null>(defaultOpen);\n  const [active, setActive] = React.useState(-1);\n  const input = React.useRef<HTMLInputElement>(null);\n  const id = React.useId();\n\n  const terms = query.trim().toLowerCase().split(/\\s+/).filter((t) => t.length > 1);\n  const visible = items\n    .map((it, i) => ({ it, i }))\n    .filter(({ it }) => (!topic || it.topic === topic) && terms.every((t) => `${it.question} ${it.answer}`.toLowerCase().includes(t)));\n  const topics = Array.from(new Set(items.map((i) => i.topic)));\n\n  React.useEffect(() => {\n    const on = (e: KeyboardEvent) => {\n      if (e.key !== \"/\" || e.metaKey || e.ctrlKey) return;\n      const t = e.target as HTMLElement | null;\n      if (t && (t.tagName === \"INPUT\" || t.tagName === \"TEXTAREA\" || t.isContentEditable)) return;\n      e.preventDefault();\n      input.current?.focus();\n    };\n    window.addEventListener(\"keydown\", on);\n    return () => window.removeEventListener(\"keydown\", on);\n  }, []);\n\n  const toggle = (i: number) => {\n    const next = open === i ? null : i;\n    setOpen(next);\n    onItemToggle?.(i, next === i);\n  };\n\n  const searchKey = (e: React.KeyboardEvent<HTMLInputElement>) => {\n    if (!visible.length) return;\n    if (e.key === \"ArrowDown\") {\n      e.preventDefault();\n      setActive((a) => (a + 1) % visible.length);\n    } else if (e.key === \"ArrowUp\") {\n      e.preventDefault();\n      setActive((a) => (a <= 0 ? visible.length - 1 : a - 1));\n    } else if (e.key === \"Enter\") {\n      e.preventDefault();\n      const pick = visible[Math.max(0, active)];\n      if (pick) toggle(pick.i);\n    } else if (e.key === \"Escape\") {\n      setQuery(\"\");\n      setActive(-1);\n    }\n  };\n\n  const vars = { \"--hb-wc9-accent\": accent, ...style } as React.CSSProperties;\n\n  return (\n    <section className={`hb-wc9 ${className}`} style={vars} {...rest}>\n      <style href=\"hb-faq-topic-icons\" precedence=\"default\">{css}</style>\n      <div className=\"hb-wc9-inner\">\n        <div className=\"hb-wc9-head\">\n          <div>\n            {eyebrow ? <p className=\"hb-wc9-eyebrow\">{eyebrow}</p> : null}\n            <h2 className=\"hb-wc9-title\">{title}</h2>\n            {subtitle ? <p className=\"hb-wc9-sub\">{subtitle}</p> : null}\n          </div>\n          <label className=\"hb-wc9-search\" htmlFor={`${id}-q`}>\n            <svg viewBox=\"0 0 18 18\" aria-hidden=\"true\">\n              <circle cx=\"8\" cy=\"8\" r=\"5.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" />\n              <path d=\"M12.2 12.2L16 16\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" />\n            </svg>\n            <input\n              ref={input}\n              id={`${id}-q`}\n              className=\"hb-wc9-input\"\n              type=\"search\"\n              value={query}\n              placeholder={placeholder}\n              aria-label=\"Search questions\"\n              aria-controls={`${id}-l`}\n              aria-activedescendant={active >= 0 && visible[active] ? `${id}-i${visible[active].i}` : undefined}\n              onChange={(e) => {\n                setQuery(e.target.value);\n                setActive(-1);\n              }}\n              onKeyDown={searchKey}\n            />\n            {query ? (\n              <span className=\"hb-wc9-count\" aria-live=\"polite\">\n                {visible.length} of {items.length}\n              </span>\n            ) : (\n              <span className=\"hb-wc9-kbd\" aria-hidden=\"true\">/</span>\n            )}\n          </label>\n        </div>\n        <div className=\"hb-wc9-chips\" role=\"group\" aria-label=\"Filter by topic\">\n          <button type=\"button\" className=\"hb-wc9-chip\" aria-pressed={topic === null} onClick={() => setTopic(null)}>\n            All\n          </button>\n          {topics.map((t) => (\n            <button key={t} type=\"button\" className=\"hb-wc9-chip\" aria-pressed={topic === t} onClick={() => setTopic((c) => (c === t ? null : t))}>\n              <Icon topic={t} />\n              {topicLabels[t]}\n            </button>\n          ))}\n        </div>\n        {visible.length ? (\n          <ul className=\"hb-wc9-list\" id={`${id}-l`}>\n            {visible.map(({ it, i }, n) => (\n              <li\n                key={i}\n                id={`${id}-i${i}`}\n                className=\"hb-wc9-item\"\n                data-open={open === i ? \"true\" : \"false\"}\n                data-active={active === n ? \"true\" : \"false\"}\n                style={{ animationDelay: `${(n * 40).toFixed(0)}ms` }}\n              >\n                <button type=\"button\" className=\"hb-wc9-q\" aria-expanded={open === i} aria-controls={`${id}-a${i}`} onClick={() => toggle(i)}>\n                  <span className=\"hb-wc9-tile\">\n                    <Icon topic={it.topic} />\n                  </span>\n                  <span className=\"hb-wc9-qt\">{highlight(it.question, terms)}</span>\n                  <span className=\"hb-wc9-pm\" aria-hidden=\"true\" />\n                </button>\n                <div className=\"hb-wc9-wrap\" id={`${id}-a${i}`} role=\"region\" aria-hidden={open !== i}>\n                  <div>\n                    <p className=\"hb-wc9-a\">{highlight(it.answer, terms)}</p>\n                  </div>\n                </div>\n              </li>\n            ))}\n          </ul>\n        ) : (\n          <div className=\"hb-wc9-empty\" role=\"status\">\n            <b>No matches for &ldquo;{query}&rdquo;</b>\n            Try a shorter word, or ask the team directly.\n            {contact ? (\n              <a className=\"hb-wc9-link\" href={contact.href}>\n                {contact.label}\n              </a>\n            ) : null}\n          </div>\n        )}\n        <div className=\"hb-wc9-foot\">\n          <span className=\"hb-wc9-keys\">\n            <span className=\"hb-wc9-kbd\">/</span> to search, <span className=\"hb-wc9-kbd\">↑</span>\n            <span className=\"hb-wc9-kbd\">↓</span> to move, <span className=\"hb-wc9-kbd\">Enter</span> to open\n          </span>\n          {contact ? (\n            <a className=\"hb-wc9-link\" href={contact.href}>\n              {contact.label}\n              <svg viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n                <path d=\"M2.5 7h8.5M7.5 3.5L11 7l-3.5 3.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n              </svg>\n            </a>\n          ) : null}\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}