"use client";
import { jsx as _jsx } from "react/jsx-runtime";
import { forwardRef } from "react";
import { Radio } from "../form/Radio.js";
import { TableCell } from "./TableCell.js";
const noop = ()=>{
// do nothing
};
/**
 * **Client Component**
 * The `TableRadio` is used to render a `Radio` within a `TableCell` by applying
 * some minimal styles.
 *
 * @example
 * Simple Example
 * ```tsx
 * import {
 *   Table,
 *   TableBody,
 *   TableCell,
 *   TableRadio,
 *   TableContainer,
 *   TableHeader,
 *   TableRow,
 *   useRadioGroup,
 * } from "@react-md/core";
 * import type { ReactElement } from "react";
 *
 * const rows = [
 *   { name: "Frozen Yogurt", type: "Ice Cream" },
 *   { name: "Ice cream sandwich", type: "Ice Cream" },
 *   { name: "Eclair", type: "Pastry" },
 *   // ...other content
 * ] as const;
 *
 * function Example(): ReactElement {
 *   const { getRadioProps } = useRadioGroup({
 *     name: "selected",
 *   });
 *   return (
 *     <TableContainer>
 *       <Table>
 *         <TableHeader>
 *           <TableRow>
 *             <TableCell header={false} />
 *             <TableCell>Name</TableCell>
 *             <TableCell>Type</TableCell>
 *           </TableRow>
 *         </TableHeader>
 *         <TableBody>
 *           {rows.map(({ name, type }) => {
 *             const radioProps = getRadioProps(name);
 *             const { checked, onChange } = radioProps;
 *
 *             return (
 *               <TableRow
 *                 key={name}
 *                 onClick={onChange}
 *                 clickable
 *                 selected={checked}
 *               >
 *                 <TableRadio {...radioProps} />
 *                 <TableCell>{name}</TableCell>
 *                 <TableCell hAlign="right">{type}</TableCell>
 *               </TableRow>
 *             );
 *           })}
 *         </TableBody>
 *       </Table>
 *     </TableContainer>
 *   );
 * }
 * ```
 * @remarks \@since 6.0.0
 */ export const TableRadio = /*#__PURE__*/ forwardRef(function TableRadio(props, ref) {
    const { "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel = !ariaLabelledBy ? "Select Row" : undefined, "aria-controls": ariaControls, name, icon, iconProps, iconStyle, iconClassName, checkedIcon, value, checked, onChange, defaultChecked, radioProps, onClick = noop, error, required, onInvalid, ...remaining } = props;
    return /*#__PURE__*/ _jsx(TableCell, {
        ...remaining,
        ref: ref,
        header: false,
        inputToggle: true,
        onClick: (event)=>{
            event.stopPropagation();
            onClick(event);
        },
        children: /*#__PURE__*/ _jsx(Radio, {
            "aria-label": ariaLabel,
            "aria-labelledby": ariaLabelledBy,
            "aria-controls": ariaControls,
            name: name,
            icon: icon,
            iconProps: iconProps,
            iconStyle: iconStyle,
            iconClassName: iconClassName,
            checkedIcon: checkedIcon,
            value: value,
            checked: checked,
            defaultChecked: defaultChecked,
            error: error,
            required: required,
            onChange: onChange,
            onInvalid: onInvalid,
            ...radioProps
        })
    });
});

//# sourceMappingURL=TableRadio.js.map