"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const formik_1 = require("formik");
const react_core_1 = require("@patternfly/react-core");
const utils_1 = require("./utils");
const RadioField = (_a) => {
    var { callFormikOnChange = true, name, value, onChange } = _a, rest = tslib_1.__rest(_a, ["callFormikOnChange", "name", "value", "onChange"]);
    const [field] = (0, formik_1.useField)({
        name,
        value,
        type: 'radio',
    });
    const fieldId = (0, utils_1.getFieldId)(name, 'radio', field.value);
    return (react_1.default.createElement(react_core_1.Radio, Object.assign({}, field, rest, { id: fieldId, isChecked: !!field.checked, onChange: (e, checked) => {
            onChange === null || onChange === void 0 ? void 0 : onChange(e, checked);
            callFormikOnChange && field.onChange(e);
        } })));
};
exports.default = RadioField;
//# sourceMappingURL=RadioField.js.map