"use client"; /** * Boolean Field * * COPIED VERBATIM FROM: components/onboarding/steps/boolean-step.tsx:116-171 * Renders a checkbox toggle or yes/no radio buttons */ import { ANIMATION_CLASSES, getStaggerStyle, STAGGER_PRESETS, } from "../animations"; import { cx } from "../lib/utils"; import { OnboardingCard } from "../primitives/onboarding-card"; import { OnboardingCheckbox } from "../primitives/onboarding-checkbox"; import { OnboardingLabel } from "../primitives/onboarding-label"; import { OnboardingRadioCardGroup, OnboardingRadioCardItem, } from "../primitives/onboarding-radio-card"; import { OnboardingRadioGroup, OnboardingRadioGroupItem, } from "../primitives/onboarding-radio-group"; import type { BooleanFieldProps } from "../types/fields"; export function BooleanField({ id, label, description, mode = "toggle", value, onChange, requiredTrue = false, yesLabel = "Yes", noLabel = "No", animationIndex = 0, disabled = false, }: BooleanFieldProps) { return (
{mode === "yesno" ? (
{label} {requiredTrue && *} {description && (

{description}

)} onChange(val === "yes")} className="grid grid-cols-2 gap-3" disabled={disabled} > {yesLabel} {noLabel}
) : mode === "radio" ? (
{label} {requiredTrue && *} {description && (

{description}

)} onChange(val === "yes")} disabled={disabled} className="flex flex-row gap-6" >
{yesLabel}
{noLabel}
) : ( onChange(checked === true)} className="mt-0.5" disabled={disabled} />
{label} {requiredTrue && ( * )} {description && (

{description}

)}
)}
); }