"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Radio = exports.IconStyled = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const styled_components_1 = __importDefault(require("styled-components"));
const Icon_1 = require("../Icon");
const theme_1 = require("../../theme");
const Text_1 = require("../Text");
exports.IconStyled = (0, styled_components_1.default)(Icon_1.Icon)(({ theme, checked, disabled }) => ({
    border: `2px solid ${checked && !disabled ? theme.COLOR.brandMain : theme.COLOR.gray2}`,
    backgroundColor: 'transparent',
    svg: {
        visibility: checked ? 'visible' : 'hidden',
        padding: '0',
    },
}));
const StyledText = (0, styled_components_1.default)(Text_1.Text) `
  display: flex;
  align-items: center;
  cursor: pointer;
`;
const HiddenRadio = styled_components_1.default.input `
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
`;
const Radio = (props) => {
    const { checked, name, onChange, label, disabled, icon } = props, other = __rest(props, ["checked", "name", "onChange", "label", "disabled", "icon"]);
    const handleChange = (event) => {
        if (onChange) {
            onChange(event);
        }
    };
    return ((0, jsx_runtime_1.jsxs)(StyledText, Object.assign({ variant: "label" }, { children: [(0, jsx_runtime_1.jsx)(HiddenRadio, Object.assign({ type: "radio", name: name, checked: checked, onChange: handleChange, disabled: disabled }, other), void 0), (0, jsx_runtime_1.jsx)(exports.IconStyled, { variant: "circle", icon: icon || theme_1.polyIcons.PointNew, color: disabled ? 'gray2' : 'brandMain', size: "20px", checked: checked, disabled: disabled }, void 0), (0, jsx_runtime_1.jsx)(Text_1.Text, Object.assign({ margin: "0 5px", variant: "span", color: disabled ? 'gray2' : 'highlightText' }, { children: label }), void 0)] }), void 0));
};
exports.Radio = Radio;
//# sourceMappingURL=Radio.js.map