{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "feature-voting-board",
  "title": "Feature Voting Board",
  "description": "A searchable feature request board with reversible votes, ranked ideas, proposal creation and delivery status tracking.",
  "dependencies": [
    "lucide-react",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/feature-voting-board/feature-voting-board.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { Layers, Plus, Search, ChevronUp } from \"lucide-react\";\nimport { clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction Frame({\n  name,\n  title,\n  description,\n  theme,\n  className,\n  toolbar,\n  children,\n}: {\n  name: string;\n  title: string;\n  description: string;\n  theme: \"dark\" | \"light\";\n  className?: string;\n  toolbar?: React.ReactNode;\n  children: React.ReactNode;\n}) {\n  const dark = theme === \"dark\";\n  return (\n    <section\n      aria-label={name}\n      className={twMerge(\n        clsx(\n          \"w-full overflow-hidden rounded-xl border font-sans antialiased\",\n          className,\n        ),\n      )}\n      style={\n        {\n          background: dark ? \"#111113\" : \"#fcfcfd\",\n          color: dark ? \"#e5e5e8\" : \"#28282e\",\n          borderColor: dark ? \"#ffffff12\" : \"#18181b16\",\n          \"--board-panel\": dark ? \"#19191d\" : \"#ffffff\",\n          \"--board-canvas\": dark ? \"#0e0e10\" : \"#f6f6f8\",\n          \"--board-input\": dark ? \"#222227\" : \"#efeff3\",\n          \"--board-accent\": dark ? \"#a49aee\" : \"#6857ac\",\n        } as React.CSSProperties\n      }\n    >\n      <header className=\"flex items-center justify-between border-b border-current/[0.07] px-6 py-3 text-[11px]\">\n        <span className=\"flex items-center gap-2\">\n          <Layers size={14} className=\"opacity-45\" />\n          <span className=\"opacity-50\">Workspace</span>\n          <span className=\"px-1 opacity-20\">/</span>\n          {name}\n        </span>\n        <span className=\"flex size-6 items-center justify-center rounded-full border border-current/10 text-[9px] opacity-60\">\n          AL\n        </span>\n      </header>\n      <div className=\"px-6 pb-5 pt-6\">\n        <p className=\"mb-2 text-[9px] tracking-[0.14em] opacity-35\">\n          PRODUCT WORKSPACE\n        </p>\n        <h2 className=\"text-[23px] font-medium tracking-[-0.035em]\">{title}</h2>\n        <p className=\"mt-2 text-xs leading-relaxed opacity-45\">{description}</p>\n      </div>\n      {toolbar && (\n        <div className=\"flex flex-wrap items-center justify-between gap-3 border-y border-current/[0.07] px-6 py-3\">\n          {toolbar}\n        </div>\n      )}\n      {children}\n    </section>\n  );\n}\nconst button =\n  \"inline-flex items-center justify-center gap-1.5 rounded-md border border-current/10 px-2.5 py-1.5 text-[11px] transition-colors hover:bg-current/5 focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-25\";\nconst primary =\n  \"inline-flex items-center justify-center gap-1.5 rounded-md border border-white/15 bg-[#6e67d4] px-3 py-1.5 text-[11px] font-medium text-white hover:bg-[#7a73df] focus-visible:outline-2 focus-visible:outline-offset-2\";\nconst input =\n  \"min-w-0 rounded-md border border-current/10 bg-[var(--board-input)] px-3 py-2 text-xs outline-none focus:border-[#9690da]\";\n\nexport interface FeatureRequest {\n  id: string;\n  title: string;\n  description: string;\n  category: string;\n  status: \"Under review\" | \"Planned\" | \"In progress\" | \"Shipped\";\n  votes: number;\n  author: string;\n}\nexport interface FeatureVotingBoardProps {\n  title?: string;\n  theme?: \"dark\" | \"light\";\n  initialFeatures?: FeatureRequest[];\n  onFeaturesChange?: (features: FeatureRequest[]) => void;\n  className?: string;\n}\nconst statuses = [\"Under review\", \"Planned\", \"In progress\", \"Shipped\"] as const;\nconst statusColors = {\n  \"Under review\": \"#8b8b95\",\n  Planned: \"#9690da\",\n  \"In progress\": \"#bda478\",\n  Shipped: \"#79a798\",\n};\nconst initial: FeatureRequest[] = [\n  {\n    id: \"f1\",\n    title: \"A home for every project\",\n    description:\n      \"Organize related documents, issues and decisions in a shared project space. Less searching, more context.\",\n    category: \"Workspace\",\n    status: \"In progress\",\n    votes: 128,\n    author: \"SK\",\n  },\n  {\n    id: \"f2\",\n    title: \"Offline, without missing a beat\",\n    description:\n      \"Keep capturing ideas when the connection drops. Sync changes when you're back online.\",\n    category: \"Experience\",\n    status: \"Planned\",\n    votes: 96,\n    author: \"JD\",\n  },\n  {\n    id: \"f3\",\n    title: \"A public API for your workflows\",\n    description:\n      \"Connect the tools you already use with a thoughtful API, webhooks and clear documentation.\",\n    category: \"Integrations\",\n    status: \"Under review\",\n    votes: 84,\n    author: \"AL\",\n  },\n  {\n    id: \"f4\",\n    title: \"Make it feel like your workspace\",\n    description:\n      \"Custom accent colors and a little more control over the details of your workspace.\",\n    category: \"Experience\",\n    status: \"Under review\",\n    votes: 62,\n    author: \"MK\",\n  },\n  {\n    id: \"f5\",\n    title: \"Find anything, from anywhere\",\n    description:\n      \"One shortcut to search across projects, documents and people.\",\n    category: \"Workspace\",\n    status: \"Shipped\",\n    votes: 51,\n    author: \"SK\",\n  },\n];\nexport function FeatureVotingBoard({\n  title = \"Help shape what comes next.\",\n  theme = \"dark\",\n  initialFeatures = initial,\n  onFeaturesChange,\n  className,\n}: FeatureVotingBoardProps) {\n  const [features, setFeatures] = React.useState(() =>\n    initialFeatures.map((feature) => ({ ...feature })),\n  );\n  const [votes, setVotes] = React.useState<string[]>([]);\n  const [query, setQuery] = React.useState(\"\");\n  const [filter, setFilter] = React.useState(\"All statuses\");\n  const [sort, setSort] = React.useState(\"Top voted\");\n  const [selected, setSelected] = React.useState<string | null>(null);\n  const [adding, setAdding] = React.useState(false);\n  const [draft, setDraft] = React.useState(\"\");\n  const [description, setDescription] = React.useState(\"\");\n  const [category, setCategory] = React.useState(\"Experience\");\n  const current = React.useRef(features);\n  const update = (next: FeatureRequest[]) => {\n    current.current = next;\n    setFeatures(next);\n    onFeaturesChange?.(next);\n  };\n  const visible = features\n    .filter(\n      (feature) =>\n        (filter === \"All statuses\" || feature.status === filter) &&\n        `${feature.title} ${feature.description} ${feature.category}`\n          .toLowerCase()\n          .includes(query.trim().toLowerCase()),\n    )\n    .sort((a, b) =>\n      sort === \"Top voted\"\n        ? b.votes - a.votes\n        : features.indexOf(b) - features.indexOf(a),\n    );\n  const toggle = (id: string) => {\n    const has = votes.includes(id);\n    update(\n      current.current.map((feature) =>\n        feature.id === id\n          ? { ...feature, votes: Math.max(0, feature.votes + (has ? -1 : 1)) }\n          : feature,\n      ),\n    );\n    setVotes((values) =>\n      has ? values.filter((value) => value !== id) : [...values, id],\n    );\n  };\n  return (\n    <Frame\n      name=\"Feature requests\"\n      title={title}\n      description=\"Good products are built together. Share an idea, or support one you believe in.\"\n      theme={theme}\n      className={className}\n      toolbar={\n        <>\n          <div className=\"flex flex-wrap items-center gap-2\">\n            <label className=\"flex items-center gap-2 rounded-md border border-current/10 bg-[var(--board-input)] px-2.5\">\n              <Search size={12} className=\"opacity-40\" />\n              <input\n                aria-label=\"Search features\"\n                placeholder=\"Search ideas…\"\n                className=\"w-36 bg-transparent py-2 text-[11px] outline-none\"\n                value={query}\n                onChange={(event) => setQuery(event.target.value)}\n              />\n            </label>\n            <select\n              aria-label=\"Filter feature status\"\n              className={input}\n              value={filter}\n              onChange={(event) => setFilter(event.target.value)}\n            >\n              {[\"All statuses\", ...statuses].map((value) => (\n                <option key={value}>{value}</option>\n              ))}\n            </select>\n            <select\n              aria-label=\"Sort features\"\n              className={input}\n              value={sort}\n              onChange={(event) => setSort(event.target.value)}\n            >\n              <option>Top voted</option>\n              <option>Newest</option>\n            </select>\n          </div>\n          <button\n            className={primary}\n            aria-expanded={adding}\n            onClick={() => setAdding(!adding)}\n          >\n            <Plus size={13} /> Suggest a feature\n          </button>\n        </>\n      }\n    >\n      {adding && (\n        <form\n          className=\"space-y-3 border-b border-current/10 p-5\"\n          onSubmit={(event) => {\n            event.preventDefault();\n            if (!draft.trim() || !description.trim()) return;\n            const id = crypto.randomUUID();\n            update([\n              ...current.current,\n              {\n                id,\n                title: draft.trim(),\n                description: description.trim(),\n                category,\n                status: \"Under review\",\n                votes: 0,\n                author: \"You\",\n              },\n            ]);\n            setDraft(\"\");\n            setDescription(\"\");\n            setAdding(false);\n            setFilter(\"All statuses\");\n            setQuery(\"\");\n            setSort(\"Newest\");\n            setSelected(id);\n          }}\n        >\n          <div className=\"flex flex-wrap gap-2\">\n            <input\n              aria-label=\"Feature title\"\n              className={input + \" flex-1\"}\n              required\n              maxLength={100}\n              placeholder=\"A short, clear title\"\n              value={draft}\n              onChange={(event) => setDraft(event.target.value)}\n            />\n            <select\n              aria-label=\"Feature category\"\n              className={input}\n              value={category}\n              onChange={(event) => setCategory(event.target.value)}\n            >\n              {[\"Experience\", \"Workspace\", \"Integrations\"].map((value) => (\n                <option key={value}>{value}</option>\n              ))}\n            </select>\n          </div>\n          <textarea\n            aria-label=\"Feature description\"\n            className={input + \" w-full resize-none\"}\n            required\n            maxLength={600}\n            placeholder=\"What would this help you do?\"\n            value={description}\n            onChange={(event) => setDescription(event.target.value)}\n          />\n          <div className=\"flex gap-2\">\n            <button type=\"submit\" className={primary}>\n              Submit idea\n            </button>\n            <button\n              type=\"button\"\n              className={button}\n              onClick={() => setAdding(false)}\n            >\n              Cancel\n            </button>\n          </div>\n        </form>\n      )}\n      <div className=\"bg-[var(--board-canvas)] px-5 py-2\">\n        {visible.map((feature) => (\n          <article\n            key={feature.id}\n            className=\"border-b border-current/[0.07] py-5 last:border-0\"\n          >\n            <div className=\"flex items-start gap-4\">\n              <button\n                aria-label={`${votes.includes(feature.id) ? \"Remove vote from\" : \"Vote for\"} ${feature.title}`}\n                aria-pressed={votes.includes(feature.id)}\n                onClick={() => toggle(feature.id)}\n                className=\"flex w-12 shrink-0 flex-col items-center gap-1 rounded-lg border py-2.5 text-xs transition-colors hover:bg-current/5\"\n                style={{\n                  borderColor: votes.includes(feature.id)\n                    ? \"#9690da70\"\n                    : \"#88888825\",\n                  background: votes.includes(feature.id)\n                    ? \"#9690da12\"\n                    : \"var(--board-panel)\",\n                  color: votes.includes(feature.id)\n                    ? \"var(--board-accent)\"\n                    : undefined,\n                }}\n              >\n                <ChevronUp size={14} />\n                <span>{feature.votes}</span>\n              </button>\n              <div className=\"min-w-0 flex-1\">\n                <button\n                  aria-expanded={selected === feature.id}\n                  aria-label={`Open feature ${feature.title}`}\n                  onClick={() =>\n                    setSelected(selected === feature.id ? null : feature.id)\n                  }\n                  className=\"block text-left text-[13px] font-medium tracking-tight hover:underline\"\n                >\n                  {feature.title}\n                </button>\n                <p\n                  className={`mt-2 text-[11px] leading-relaxed opacity-45 ${selected === feature.id ? \"\" : \"line-clamp-2\"}`}\n                >\n                  {feature.description}\n                </p>\n                <div className=\"mt-3 flex flex-wrap items-center gap-3 text-[9px]\">\n                  <span className=\"rounded border border-current/10 px-1.5 py-0.5 opacity-45\">\n                    {feature.category}\n                  </span>\n                  <span\n                    className=\"flex items-center gap-1.5\"\n                    style={{ color: statusColors[feature.status] }}\n                  >\n                    <span className=\"size-1.5 rounded-full bg-current\" />\n                    {feature.status}\n                  </span>\n                  <span className=\"opacity-30\">by {feature.author}</span>\n                </div>\n              </div>\n            </div>\n            {selected === feature.id && (\n              <div className=\"ml-16 mt-4 flex flex-wrap items-center gap-3 rounded-md border border-current/10 bg-[var(--board-panel)] p-3\">\n                <label className=\"text-[10px] opacity-60\">\n                  Update status{\" \"}\n                  <select\n                    aria-label={`Status for ${feature.title}`}\n                    className={input}\n                    value={feature.status}\n                    onChange={(event) =>\n                      update(\n                        current.current.map((item) =>\n                          item.id === feature.id\n                            ? {\n                                ...item,\n                                status: event.target\n                                  .value as FeatureRequest[\"status\"],\n                              }\n                            : item,\n                        ),\n                      )\n                    }\n                  >\n                    {statuses.map((value) => (\n                      <option key={value}>{value}</option>\n                    ))}\n                  </select>\n                </label>\n                <span className=\"text-[10px] opacity-35\">\n                  {feature.votes} people support this idea\n                </span>\n              </div>\n            )}\n          </article>\n        ))}\n        {!visible.length && (\n          <div className=\"py-16 text-center\">\n            <Search size={20} className=\"mx-auto mb-3 opacity-20\" />\n            <p className=\"text-xs opacity-50\">No ideas match your search.</p>\n            <button\n              className={button + \" mt-3\"}\n              onClick={() => {\n                setQuery(\"\");\n                setFilter(\"All statuses\");\n              }}\n            >\n              Clear filters\n            </button>\n          </div>\n        )}\n      </div>\n      <footer\n        role=\"status\"\n        className=\"flex flex-wrap justify-between gap-2 border-t border-current/[0.07] px-5 py-3 text-[10px] opacity-40\"\n      >\n        <span>\n          {visible.length} ideas · {votes.length} supported by you\n        </span>\n        <span>Thoughtful feedback moves us forward.</span>\n      </footer>\n    </Frame>\n  );\n}\nexport default FeatureVotingBoard;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}