{
  "title": "Model Ability Selector",
  "description": "Compact selector for toggling abilities with icons and custom styles",
  "name": "gsap-ai-model-ability-selector",
  "dependencies": [
    "gsap",
    "@gsap/react"
  ],
  "registryDependencies": [
    "gsap-swap",
    "button",
    "dropdown-menu",
    "tooltip"
  ],
  "type": "registry:ui",
  "files": [
    {
      "path": "components/paceui/gsap/ai-model-ability-selector.tsx",
      "type": "registry:ui",
      "content": "import { type ComponentProps, type ReactNode, useEffect, useState } from \"react\";\n\nimport { BrainIcon, CodeIcon, EyeIcon, FileSearch2Icon, SpeechIcon, Wand2Icon } from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\n\nimport { Button } from \"@/components/ui/button\";\nimport {\n    DropdownMenu,\n    DropdownMenuCheckboxItem,\n    DropdownMenuContent,\n    DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\nimport { Swap } from \"@/components/paceui/gsap/swap\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"@/components/ui/tooltip\";\n\nconst abilities = [\"vision\", \"thinking\", \"code\", \"speech\", \"search\", \"creativity\"] as const;\n\ntype AbilityType = (typeof abilities)[number];\n\nconst abilityConfig: Record<AbilityType, { color: string; text: string; icon: ReactNode }> = {\n    thinking: {\n        color: \"bg-purple-500/10 hover:bg-purple-500/20 text-purple-500\",\n        text: \"Thinking\",\n        icon: <BrainIcon className=\"size-4.5\" />,\n    },\n    code: {\n        color: \"bg-cyan-500/10 hover:bg-cyan-500/20 text-cyan-500\",\n        text: \"Code\",\n        icon: <CodeIcon className=\"size-4.5\" />,\n    },\n    vision: {\n        color: \"bg-green-500/10 hover:bg-green-500/20 text-green-500\",\n        text: \"Vision\",\n        icon: <EyeIcon className=\"size-4.5\" />,\n    },\n    creativity: {\n        color: \"bg-orange-500/10 hover:bg-orange-500/20 text-orange-500\",\n        text: \"Creativity\",\n        icon: <Wand2Icon className=\"size-4.5\" />,\n    },\n    search: {\n        color: \"bg-teal-500/10 hover:bg-teal-500/20 text-teal-500\",\n        text: \"Search\",\n        icon: <FileSearch2Icon className=\"size-4.5\" />,\n    },\n    speech: {\n        color: \"bg-pink-500/10 hover:bg-pink-500/20 text-pink-500\",\n        text: \"Speech\",\n        icon: <SpeechIcon className=\"size-4.5\" />,\n    },\n};\n\ntype ModelAbilitySelectorProps = ComponentProps<typeof Button> & {\n    buttonVariant?: \"ghost\" | \"outline\" | \"default\";\n    maxVisible?: number;\n};\n\nexport const AiModelAbilitySelector = ({\n    className,\n    buttonVariant = \"ghost\",\n    maxVisible = 3,\n    ...props\n}: ModelAbilitySelectorProps) => {\n    const [selected, setSelected] = useState<AbilityType[]>([\"code\", \"search\"]);\n\n    const toggleAbility = (ability: AbilityType) => {\n        setSelected((prev) => (prev.includes(ability) ? prev.filter((c) => c !== ability) : [...prev, ability]));\n    };\n\n    useEffect(() => setSelected((s) => [...s]), [maxVisible]);\n\n    return (\n        <TooltipProvider>\n            <DropdownMenu>\n                <DropdownMenuTrigger\n                    render={\n                        <Button\n                            variant={buttonVariant}\n                            {...props}\n                            className={cn(\"cursor-pointer h-8 px-2 shadow-none ring-0!\", className)}>\n                            <Swap state={selected} effects={[\"blur\", \"opacity\"]}>\n                                {(current) =>\n                                    current.length === 0 ? (\n                                        <p className=\"text-muted-foreground\">None</p>\n                                    ) : (\n                                        <div className=\"flex items-center gap-1.5\">\n                                            {current.slice(0, maxVisible - 1).map((cap) => (\n                                                <Tooltip key={cap}>\n                                                    <TooltipTrigger\n                                                        render={\n                                                            <div className=\"bg-card flex size-8 items-center justify-center rounded-md shadow\">\n                                                                {abilityConfig[cap].icon}\n                                                            </div>\n                                                        }></TooltipTrigger>\n                                                    <TooltipContent>{abilityConfig[cap].text}</TooltipContent>\n                                                </Tooltip>\n                                            ))}\n                                            {current.length > maxVisible - 1 && (\n                                                <Tooltip>\n                                                    <TooltipTrigger\n                                                        render={\n                                                            <div className=\"bg-card flex h-8 min-w-8 items-center justify-center rounded-md px-1.5 text-xs font-medium tabular-nums shadow\">\n                                                                {current.length === maxVisible\n                                                                    ? abilityConfig[current[maxVisible - 1]].icon\n                                                                    : `+${current.length - (maxVisible - 1)}`}\n                                                            </div>\n                                                        }></TooltipTrigger>\n                                                    <TooltipContent>\n                                                        {current.length === maxVisible\n                                                            ? abilityConfig[current[maxVisible - 1]].text\n                                                            : current\n                                                                  .slice(maxVisible - 1)\n                                                                  .map((cap) => abilityConfig[cap].text)\n                                                                  .join(\", \")}\n                                                    </TooltipContent>\n                                                </Tooltip>\n                                            )}\n                                        </div>\n                                    )\n                                }\n                            </Swap>\n                        </Button>\n                    }></DropdownMenuTrigger>\n\n                <DropdownMenuContent className=\"w-44 shadow-xs transition-all hover:shadow-md\" align=\"start\">\n                    <div className=\"space-y-0.5\">\n                        {abilities.map((ability) => (\n                            <DropdownMenuCheckboxItem\n                                key={ability}\n                                className=\"cursor-pointer gap-2\"\n                                checked={selected.includes(ability)}\n                                onCheckedChange={() => toggleAbility(ability)}>\n                                {abilityConfig[ability].icon}\n                                {abilityConfig[ability].text}\n                            </DropdownMenuCheckboxItem>\n                        ))}\n                    </div>\n                </DropdownMenuContent>\n            </DropdownMenu>\n        </TooltipProvider>\n    );\n};\n"
    },
    {
      "path": "components/paceui/gsap/swap.tsx",
      "type": "registry:ui",
      "content": "import { type ComponentProps, type ReactNode, useMemo, useRef, useState } from \"react\";\n\nimport { useGSAP } from \"@gsap/react\";\nimport gsap from \"gsap\";\n\nconst effectPresets = {\n    slideUp: [\n        {\n            y: \"-100%\",\n        },\n        {\n            y: \"100%\",\n        },\n        {\n            y: 0,\n        },\n    ],\n    slideDown: [\n        {\n            y: \"100%\",\n        },\n        {\n            y: \"-100%\",\n        },\n        {\n            y: 0,\n        },\n    ],\n    opacity: [\n        {\n            opacity: 0,\n        },\n        {\n            opacity: 0,\n        },\n        {\n            opacity: 1,\n        },\n    ],\n    blur: [\n        {\n            filter: \"blur(12px)\",\n        },\n        {\n            filter: \"blur(12px)\",\n        },\n        {\n            filter: \"blur(0px)\",\n        },\n    ],\n    grayscale: [\n        {\n            filter: \"grayscale(100%)\",\n        },\n        {\n            filter: \"grayscale(100%)\",\n        },\n        {\n            filter: \"grayscale(0%)\",\n        },\n    ],\n} as const;\n\nexport type SwapProps<T = object> = Omit<ComponentProps<\"div\">, \"children\"> & {\n    state: T;\n    children: (state: T) => ReactNode;\n    effects?: (keyof typeof effectPresets)[];\n    duration?: number;\n};\n\nconst mergeVars = (varsArray: Record<string, string | number>[]) => {\n    const merged: Record<string, string | number> = {};\n\n    for (const vars of varsArray) {\n        for (const [key, value] of Object.entries(vars)) {\n            if (key === \"filter\" && merged.filter) {\n                merged.filter += ` ${value}`; // combine filters\n            } else {\n                merged[key] = value; // last one wins for other props\n            }\n        }\n    }\n\n    return merged;\n};\n\nexport const Swap = <T,>({ state, children, duration = 0.4, effects = [], ...props }: SwapProps<T>) => {\n    const [currentState, setCurrentState] = useState(state);\n\n    const containerRef = useRef<HTMLDivElement>(null);\n    const contentRef = useRef<HTMLDivElement>(null);\n\n    const [enterVars, exitVars, finalVars] = useMemo(\n        () => Array.from({ length: 3 }, (_, i) => mergeVars(effects.map((e) => effectPresets[e][i]))),\n        [effects],\n    );\n\n    useGSAP(\n        () => {\n            if (currentState === state) return;\n            const content = contentRef.current;\n            if (!content) return;\n\n            gsap.to(content, {\n                ...enterVars,\n                duration,\n                ease: \"power2.in\",\n                onComplete: () => {\n                    setCurrentState(state);\n                    gsap.fromTo(content, exitVars, {\n                        ...finalVars,\n                        duration,\n                        ease: \"power2.out\",\n                    });\n                },\n            });\n        },\n        { dependencies: [state] },\n    );\n\n    useGSAP(\n        () => {\n            if (!containerRef.current || !contentRef.current) return;\n\n            const box = contentRef.current.getBoundingClientRect();\n\n            gsap.to(containerRef.current, {\n                width: box.width,\n                height: box.height,\n                duration: 0.4,\n                ease: \"power2.out\",\n            });\n        },\n        { dependencies: [currentState] },\n    );\n\n    return (\n        <div {...props} ref={containerRef}>\n            <div ref={contentRef} className=\"inline-block\">\n                {children(currentState)}\n            </div>\n        </div>\n    );\n};\n"
    }
  ],
  "mcp": {
    "description": "Provides refined UI interactions and accessible controls. Compact selector for toggling abilities with icons and custom styles Configurable props include: ComponentProps<typeof Button> & {; buttonVariant?: \"ghost\" | \"outline\" | \"default\";; maxVisible?: number;. Relies on gsap, @gsap/react, gsap-swap, button, dropdown-menu, tooltip. Optimal for building reusable interface elements and user input flows.",
    "tags": [
      "component",
      "gsap",
      "animation"
    ]
  }
}