import { useId } from "@radix-ui/react-id"; import * as Label from "@radix-ui/react-label"; import * as PrimitiveSwitch from "@radix-ui/react-switch"; 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; fitToHeight?: boolean; disabled?: boolean; tooltip?: string; labelOnLeading?: boolean; classNames?: { container?: string; thumb?: string; }; LockedIcon?: React.ReactNode; } ) => { const { label, fitToHeight, classNames, labelOnLeading, LockedIcon, ...primitiveProps } = props; const id = useId(); const isChecked = props.checked || props.defaultChecked; return (
{LockedIcon &&
{LockedIcon}
} {label && ( {label} )}
); }; export default Switch;