"use client"
import React, { ComponentProps, ComponentPropsWithoutRef, useRef } from "react"
import { useElementAttribute } from "../../hooks"
import { classNames } from "../../utils"
import { Item } from "../Item"
import { Label } from "../Label"
import { RadioGroup, RadioGroupItemProps, RadioGroupProps } from "../RadioGroup"
import { SpaceBetween } from "../SpaceBetween"
import { Text } from "../Text"
export type RadioButtonGroupProps = RadioGroupProps
const RadioButtonGroupBase = ({
className,
variant = "checkmark",
...rest
}: RadioButtonGroupProps) => {
return (
)
}
export type RadioButtonGroupItemProps = RadioGroupItemProps & {
children: React.ReactNode
}
const RadioButtonGroupItemBase = ({
children,
className,
disabled,
...rest
}: RadioButtonGroupItemProps) => {
const ref = useRef(null)
const state = useElementAttribute<"checked" | "unchecked">(ref, "data-state")
const checked = state === "checked"
return (
)
}
export const RadioButtonGroupItemContent = ({
className,
...rest
}: ComponentProps) => {
return (
)
}
const RadioButtonGroupItemTitle = ({
className,
size = "sm",
...rest
}: Partial>) => {
return (
{/* Empty space to account for the radio button */}
)
}
export const RadioButtonGroupItemDescription = ({
size = "md",
...rest
}: ComponentProps) => {
return
}
/**
* Displays a list of radio toggles that look like buttons.
*/
export const RadioButtonGroup = Object.assign(RadioButtonGroupBase, {
Item: Object.assign(RadioButtonGroupItemBase, {
Content: RadioButtonGroupItemContent,
Title: RadioButtonGroupItemTitle,
Description: RadioButtonGroupItemDescription,
}),
})