{
  "name": "command-stack-popover-demo",
  "type": "registry:example",
  "registryDependencies": [
    "button",
    "command-stack",
    "popover"
  ],
  "files": [
    {
      "path": "examples/command-stack-popover-demo.tsx",
      "type": "registry:example",
      "content": "\"use client\";\n\nimport { CircleDashed, ListFilter, SignalHigh, User } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Button } from \"@/registry/bases/radix/ui/button\";\nimport {\n  CommandStack,\n  CommandStackEmpty,\n  CommandStackGroup,\n  CommandStackInput,\n  CommandStackItem,\n  CommandStackList,\n  CommandStackPage,\n  type CommandStackValue,\n} from \"@/registry/bases/radix/ui/command-stack\";\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n} from \"@/registry/bases/radix/ui/popover\";\n\nconst filters = [\n  {\n    value: \"status\",\n    label: \"Status\",\n    icon: CircleDashed,\n    options: [\n      \"Backlog\",\n      \"Todo\",\n      \"In Progress\",\n      \"In Review\",\n      \"Done\",\n      \"Canceled\",\n    ],\n  },\n  {\n    value: \"priority\",\n    label: \"Priority\",\n    icon: SignalHigh,\n    options: [\"Urgent\", \"High\", \"Medium\", \"Low\", \"No priority\"],\n  },\n  {\n    value: \"assignee\",\n    label: \"Assignee\",\n    icon: User,\n    options: [\n      \"Me\",\n      \"Olivia Martin\",\n      \"Jackson Lee\",\n      \"Isabella Nguyen\",\n      \"Unassigned\",\n    ],\n  },\n];\n\nexport default function CommandStackPopoverDemo() {\n  const [value, setValue] = React.useState<CommandStackValue>({});\n\n  const selectedCount = Object.values(value).flat().length;\n\n  return (\n    <Popover>\n      <PopoverTrigger asChild>\n        <Button variant=\"outline\">\n          <ListFilter />\n          Filter\n          {selectedCount > 0 && (\n            <span className=\"rounded-sm bg-muted px-1.5 text-xs font-medium\">\n              {selectedCount}\n            </span>\n          )}\n        </Button>\n      </PopoverTrigger>\n      <PopoverContent align=\"start\" className=\"w-56 p-0\">\n        <CommandStack value={value} onValueChange={setValue}>\n          <CommandStackInput placeholder=\"Filter...\" />\n          <CommandStackList>\n            <CommandStackEmpty>No results found.</CommandStackEmpty>\n            <CommandStackPage value=\"root\">\n              {filters.map((filter) => (\n                <CommandStackItem key={filter.value} page={filter.value}>\n                  <filter.icon />\n                  {filter.label}\n                </CommandStackItem>\n              ))}\n            </CommandStackPage>\n            {filters.map((filter) => (\n              <CommandStackPage\n                key={filter.value}\n                value={filter.value}\n                label={filter.label}\n                placeholder={`Filter by ${filter.label.toLowerCase()}...`}\n                selectionMode=\"multiple\"\n              >\n                <CommandStackGroup heading={filter.label}>\n                  {filter.options.map((option) => (\n                    <CommandStackItem key={option} value={option}>\n                      {option}\n                    </CommandStackItem>\n                  ))}\n                </CommandStackGroup>\n              </CommandStackPage>\n            ))}\n          </CommandStackList>\n        </CommandStack>\n      </PopoverContent>\n    </Popover>\n  );\n}\n",
      "target": ""
    }
  ]
}