import React from "react"; import classNames from "@calcom/lib/classNames"; type RadioAreaProps = React.InputHTMLAttributes & { classNames?: { container?: string } }; const RadioArea = React.forwardRef( ({ children, className, classNames: innerClassNames, ...props }, ref) => { return ( ); } ); type MaybeArray = T[] | T; type ChildrenOfType = MaybeArray< React.ReactElement> >; interface RadioAreaGroupProps extends Omit, "onChange" | "children"> { onChange?: (value: string) => void; children: ChildrenOfType; } const RadioAreaGroup = ({ children, className, onChange, ...passThroughProps }: RadioAreaGroupProps) => { const childrenWithProps = React.Children.map(children, (child) => { if (onChange && React.isValidElement(child)) { return React.cloneElement(child, { onChange: (e: React.ChangeEvent) => { onChange(e.target.value); }, }); } return child; }); return (
{childrenWithProps}
); }; RadioAreaGroup.displayName = "RadioAreaGroup"; RadioArea.displayName = "RadioArea"; const Item = RadioArea; const Group = RadioAreaGroup; export { RadioArea, RadioAreaGroup, Item, Group };