"use client" import * as React from "react" import * as SwitchPrimitives from "@radix-ui/react-switch" import { cn } from "../../lib/utils" type SwitchSize = "sm" | "md" | "lg"; type SwitchVariant = "primary" | "success" | "warning" | "danger" | "secondary"; export interface SwitchProps extends React.ComponentPropsWithoutRef { /** Switch boyutu */ size?: SwitchSize; /** Switch renk varyantı */ variant?: SwitchVariant; /** Yükleniyor durumunu gösterir */ loading?: boolean; /** Sol tarafta gösterilecek ikon */ leftIcon?: React.ReactNode; /** Sağ tarafta gösterilecek ikon */ rightIcon?: React.ReactNode; /** Switch açıklaması */ description?: string; } const Switch = React.forwardRef< React.ElementRef, SwitchProps >(({ className, size = "md", variant = "primary", loading, leftIcon, rightIcon, description, ...props }, ref) => (
{leftIcon && {leftIcon}} {loading ? (
) : null}
{rightIcon && {rightIcon}} {description && {description}}
)) Switch.displayName = SwitchPrimitives.Root.displayName export { Switch } export type { SwitchSize, SwitchVariant }