diff --git a/apps/docs/public/registry/index.json b/apps/docs/public/registry/index.json index 4b641731..d5229927 100644 --- a/apps/docs/public/registry/index.json +++ b/apps/docs/public/registry/index.json @@ -62,7 +62,8 @@ { "name": "button", "dependencies": [ - "@kobalte/core" + "@kobalte/core", + "class-variance-authority" ], "files": [ "ui/button.tsx" diff --git a/apps/docs/public/registry/ui/button.json b/apps/docs/public/registry/ui/button.json index 0d0777dc..b6dbaab1 100644 --- a/apps/docs/public/registry/ui/button.json +++ b/apps/docs/public/registry/ui/button.json @@ -1,12 +1,13 @@ { "name": "button", "dependencies": [ - "@kobalte/core" + "@kobalte/core", + "class-variance-authority" ], "files": [ { "name": "button.tsx", - "content": "import type { Component, ComponentProps } from \"solid-js\"\nimport { splitProps } from \"solid-js\"\n\nimport type { VariantProps } from \"class-variance-authority\"\nimport { cva } from \"class-variance-authority\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive: \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline: \"border border-input hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\"\n },\n size: {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"size-10\"\n }\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\"\n }\n }\n)\n\nexport interface ButtonProps\n extends ComponentProps<\"button\">,\n VariantProps {}\n\nconst Button: Component = (props) => {\n const [, rest] = splitProps(props, [\"variant\", \"size\", \"class\"])\n return (\n \n )\n}\n\nexport { Button, buttonVariants }\n" + "content": "import type { Component } from \"solid-js\"\nimport { splitProps } from \"solid-js\"\n\nimport { Button as ButtonPrimitive } from \"@kobalte/core\"\nimport type { VariantProps } from \"class-variance-authority\"\nimport { cva } from \"class-variance-authority\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive: \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline: \"border border-input hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\"\n },\n size: {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"size-10\"\n }\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\"\n }\n }\n)\n\nexport interface ButtonProps\n extends ButtonPrimitive.ButtonRootProps,\n VariantProps {}\n\nconst Button: Component = (props) => {\n const [, rest] = splitProps(props, [\"variant\", \"size\", \"class\"])\n return (\n \n )\n}\n\nexport { Button, buttonVariants }\n" } ], "type": "ui" diff --git a/apps/docs/src/registry/registry.ts b/apps/docs/src/registry/registry.ts index 4fa21f8b..7805ac5c 100644 --- a/apps/docs/src/registry/registry.ts +++ b/apps/docs/src/registry/registry.ts @@ -40,7 +40,7 @@ const ui: Registry = [ { name: "button", type: "ui", - dependencies: ["@kobalte/core"], + dependencies: ["@kobalte/core", "class-variance-authority"], files: ["ui/button.tsx"] }, { diff --git a/apps/docs/src/registry/ui/button.tsx b/apps/docs/src/registry/ui/button.tsx index 60f20a6c..96098e2c 100644 --- a/apps/docs/src/registry/ui/button.tsx +++ b/apps/docs/src/registry/ui/button.tsx @@ -1,6 +1,7 @@ -import type { Component, ComponentProps } from "solid-js" +import type { Component } from "solid-js" import { splitProps } from "solid-js" +import { Button as ButtonPrimitive } from "@kobalte/core" import type { VariantProps } from "class-variance-authority" import { cva } from "class-variance-authority" @@ -33,13 +34,13 @@ const buttonVariants = cva( ) export interface ButtonProps - extends ComponentProps<"button">, + extends ButtonPrimitive.ButtonRootProps, VariantProps {} const Button: Component = (props) => { const [, rest] = splitProps(props, ["variant", "size", "class"]) return ( -