import { useId } from "@radix-ui/react-id"; import * as Label from "@radix-ui/react-label"; import * as PrimitiveSwitch from "@radix-ui/react-switch"; import type { ReactNode } from "react"; import React from "react"; import cx from "@calcom/lib/classNames"; import { Tooltip } from "../../tooltip"; const Wrapper = ({ children, tooltip }: { tooltip?: string; children: React.ReactNode }) => { if (!tooltip) { return <>{children}; } return {children}; }; const Switch = ( props: React.ComponentProps & { label?: string | ReactNode; fitToHeight?: boolean; disabled?: boolean; tooltip?: string; labelOnLeading?: boolean; size?: "base" | "sm"; classNames?: { container?: string; thumb?: string; }; LockedIcon?: React.ReactNode; padding?: boolean; } ) => { const { label, fitToHeight, classNames, labelOnLeading, LockedIcon, padding, size = "base", ...primitiveProps } = props; const id = useId(); return (
{LockedIcon &&
{LockedIcon}
} {label && ( {label} )}
); }; export default Switch;