@gravity-ui/uikit
Version:
Gravity UI base styling and components
19 lines (18 loc) • 970 B
JavaScript
'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from 'react';
import { useRadio } from "../../hooks/private/index.js";
import { block } from "../utils/cn.js";
import { isIcon, isSvg } from "../utils/common.js";
const b = block('segmented-radio-group');
export const SegmentedRadioGroupOption = React.forwardRef(function SegmentedRadioGroupOption(props, ref) {
const { disabled = false, content, children, title } = props;
const { checked, inputProps } = useRadio(props);
const inner = content || children;
const icon = isIcon(inner) || isSvg(inner);
return (_jsxs("label", { className: b('option', {
disabled,
checked,
}), ref: ref, title: title, children: [_jsx("input", { ...inputProps, className: b('option-control') }), inner && _jsx("span", { className: b('option-text', { icon }), children: inner })] }));
});
//# sourceMappingURL=SegmentedRadioGroupOption.js.map