import * as CheckboxPrimitive from "@radix-ui/react-checkbox"; import { useId } from "@radix-ui/react-id"; import { Check } from "lucide-react"; import type { InputHTMLAttributes } from "react"; import React, { forwardRef } from "react"; import classNames from "@calcom/lib/classNames"; type Props = InputHTMLAttributes & { label?: React.ReactNode; description: string; descriptionAsLabel?: boolean; informationIconText?: string; error?: boolean; className?: string; descriptionClassName?: string; }; const Checkbox = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); Checkbox.displayName = CheckboxPrimitive.Root.displayName; const CheckboxField = forwardRef( ({ label, description, error, disabled, ...rest }, ref) => { const descriptionAsLabel = !label || rest.descriptionAsLabel; const id = useId(); return (
{label && (
{React.createElement( descriptionAsLabel ? "div" : "label", { className: classNames("flex text-sm font-medium text-emphasis"), ...(!descriptionAsLabel ? { htmlFor: rest.id ? rest.id : id, } : {}), }, label )}
)}
{React.createElement( descriptionAsLabel ? "label" : "div", { className: classNames( "relative flex items-start", !error && descriptionAsLabel ? "text-emphasis" : "text-emphasis", error && "text-error" ), }, <>
{description} )} {/* {informationIconText && } */}
); } ); CheckboxField.displayName = "CheckboxField"; export { Checkbox, CheckboxField };