import type { RadioListProps } from "$/types/InputTypes";
import { RadioGroup } from "@headlessui/react";
import clsx from "clsx";


export default function RadioList({
	id,
	className,
	name,
	value,
	onChange,
	defaultValue,
	direction = "horizontal",
	children
}: Readonly<RadioListProps>){
	return (
		<RadioGroup
			id={id}
			className={clsx(
				"flex",
				className,
				{
					"flex-row items-center justify-center gap-x-8": direction === "horizontal",
					"flex-col items-start justify-center gap-y-2": direction === "vertical"
				}
			)}
			name={name}
			value={value}
			onChange={onChange}
			defaultValue={defaultValue}
		>
			{children}
		</RadioGroup>
	);
}
