From d200452563b8c6f0edeac978085b407b1b82ab7f Mon Sep 17 00:00:00 2001 From: Devin Villarosa Date: Fri, 7 Feb 2025 15:09:04 -0800 Subject: [PATCH] [UI v2] chore: Removes toggleVariants as an export --- ui-v2/src/components/ui/toggle/index.ts | 2 ++ .../ui/{toggle.tsx => toggle/styles.ts} | 26 ++----------------- ui-v2/src/components/ui/toggle/toggle.tsx | 24 +++++++++++++++++ 3 files changed, 28 insertions(+), 24 deletions(-) create mode 100644 ui-v2/src/components/ui/toggle/index.ts rename ui-v2/src/components/ui/{toggle.tsx => toggle/styles.ts} (52%) create mode 100644 ui-v2/src/components/ui/toggle/toggle.tsx diff --git a/ui-v2/src/components/ui/toggle/index.ts b/ui-v2/src/components/ui/toggle/index.ts new file mode 100644 index 000000000000..615021b6768c --- /dev/null +++ b/ui-v2/src/components/ui/toggle/index.ts @@ -0,0 +1,2 @@ +export { Toggle } from "./toggle"; +export { toggleVariants } from "./styles"; diff --git a/ui-v2/src/components/ui/toggle.tsx b/ui-v2/src/components/ui/toggle/styles.ts similarity index 52% rename from ui-v2/src/components/ui/toggle.tsx rename to ui-v2/src/components/ui/toggle/styles.ts index 67f567e38f81..b60d9deae949 100644 --- a/ui-v2/src/components/ui/toggle.tsx +++ b/ui-v2/src/components/ui/toggle/styles.ts @@ -1,12 +1,6 @@ -"use client"; +import { cva } from "class-variance-authority"; -import * as TogglePrimitive from "@radix-ui/react-toggle"; -import { type VariantProps, cva } from "class-variance-authority"; -import * as React from "react"; - -import { cn } from "@/lib/utils"; - -const toggleVariants = cva( +export const toggleVariants = cva( "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", { variants: { @@ -27,19 +21,3 @@ const toggleVariants = cva( }, }, ); - -const Toggle = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & - VariantProps ->(({ className, variant, size, ...props }, ref) => ( - -)); - -Toggle.displayName = TogglePrimitive.Root.displayName; - -export { Toggle, toggleVariants }; diff --git a/ui-v2/src/components/ui/toggle/toggle.tsx b/ui-v2/src/components/ui/toggle/toggle.tsx new file mode 100644 index 000000000000..4759ad300327 --- /dev/null +++ b/ui-v2/src/components/ui/toggle/toggle.tsx @@ -0,0 +1,24 @@ +"use client"; + +import * as TogglePrimitive from "@radix-ui/react-toggle"; +import { type VariantProps } from "class-variance-authority"; +import * as React from "react"; + +import { cn } from "@/lib/utils"; +import { toggleVariants } from "./styles"; + +const Toggle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & + VariantProps +>(({ className, variant, size, ...props }, ref) => ( + +)); + +Toggle.displayName = TogglePrimitive.Root.displayName; + +export { Toggle };