'use client'; import { useId, useState } from 'react'; import { FlexBox } from '../../flex-box'; import { Typography } from '../../typography'; import { buttonLayout } from '../constants'; import type { FrozenButtonProps } from '../types'; import { frozenTipVariants } from '../variants'; /** * A frozen button with its reason. Hover and keyboard focus show the reason through CSS; a tap * toggles it, because touch has no hover. Only frozen buttons with a reason load this code. */ export function FrozenButton({ reason, block, children, ...props }: FrozenButtonProps) { const [isOpen, setIsOpen] = useState(false); const tipId = useId(); return ( setIsOpen(false)} > setIsOpen((open) => !open)} {...props} > {children} {reason} ); }