"use client"; // Adapted from Kokonut UI (@dorianbaffier), MIT. See THIRD_PARTY_NOTICES.md. import { useState, useId, type ComponentProps, type ReactNode } from "react"; export interface CardFlipProps extends Omit, "children"> { front: ReactNode; back: ReactNode; flipped?: boolean; defaultFlipped?: boolean; onFlippedChange?: (flipped: boolean) => void; frontLabel?: string; backLabel?: string; } export function CardFlip({ front, back, flipped, defaultFlipped = false, onFlippedChange, frontLabel = "Show front", backLabel = "Show back", className = "", ...props }: CardFlipProps) { const [internal, setInternal] = useState(defaultFlipped); const value = flipped ?? internal; const id = useId(); return (
{front}
{back}
); }