@gravity-ui/uikit
Version:
Gravity UI base styling and components
25 lines (24 loc) • 1.35 kB
JavaScript
'use client';
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Radio = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const React = tslib_1.__importStar(require("react"));
const private_1 = require("../../hooks/private/index.js");
const ControlLabel_1 = require("../ControlLabel/index.js");
const cn_1 = require("../utils/cn.js");
require("./Radio.css");
const b = (0, cn_1.block)('radio');
exports.Radio = React.forwardRef(function Radio(props, ref) {
const { size = 'm', disabled = false, content, children, title, style, className, qa } = props;
const { checked, inputProps } = (0, private_1.useRadio)(props);
const text = content || children;
const control = ((0, jsx_runtime_1.jsxs)("span", { className: b('indicator'), children: [(0, jsx_runtime_1.jsx)("span", { className: b('disc') }), (0, jsx_runtime_1.jsx)("input", { ...inputProps, className: b('control') }), (0, jsx_runtime_1.jsx)("span", { className: b('outline') })] }));
return ((0, jsx_runtime_1.jsx)(ControlLabel_1.ControlLabel, { ref: ref, title: title, style: style, size: size, disabled: disabled, className: b({
size,
disabled,
checked,
}, className), qa: qa, control: control, children: text }));
});
//# sourceMappingURL=Radio.js.map