"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RadioCard = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const RadioGroup_1 = require("../RadioGroup");
const classNames_1 = require("../utils/classNames");
const constants_1 = require("./constants");
const styles_1 = require("./styles");
const RadioCard = ({ id, disabled: propsIsDisabled, className, header, children, value, ...props }) => {
    const { isError, value: groupValue, name, onChange, disabled, } = (0, react_1.useContext)(RadioGroup_1.RadioGroupContext);
    return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: (0, classNames_1.classNames)(className, constants_1.radioCardClassnames.root), "$isError": isError, "$isChecked": groupValue === value, "$isDisabled": disabled || propsIsDisabled, children: [(0, jsx_runtime_1.jsx)(styles_1.StyledRadio, { disabled: disabled || propsIsDisabled, checked: groupValue === value, name: name, onChange: (event) => onChange?.(event, event.target.value), value: value, ...props }), (0, jsx_runtime_1.jsxs)(styles_1.Content, { className: constants_1.radioCardClassnames.content, children: [(0, jsx_runtime_1.jsx)("div", { children: header }), (0, jsx_runtime_1.jsx)("div", { children: children })] })] }));
};
exports.RadioCard = RadioCard;
