(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "tslib", "react", "../ListItem", "../../../hooks/useStateProps", "../../../RadioButton", "../List"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var tslib_1 = require("tslib");
    var react_1 = (0, tslib_1.__importStar)(require("react"));
    var ListItem_1 = (0, tslib_1.__importDefault)(require("../ListItem"));
    var useStateProps_1 = require("../../../hooks/useStateProps");
    var RadioButton_1 = (0, tslib_1.__importDefault)(require("../../../RadioButton"));
    var List_1 = (0, tslib_1.__importDefault)(require("../List"));
    var ListRadioButtons = (0, react_1.forwardRef)(function (_a, ref) {
        var dataSource = _a.dataSource, onChange = _a.onChange, defaultValue = _a.defaultValue, className = _a.className, style = _a.style, isDisabled = _a.isDisabled, header = _a.header, height = _a.height, width = _a.width, viewType = _a.viewType, isSelected = _a.isSelected, styleItem = _a.styleItem, classNameItem = _a.classNameItem, _b = _a.size, size = _b === void 0 ? "l" : _b, onClickItem = _a.onClickItem, props = (0, tslib_1.__rest)(_a, ["dataSource", "onChange", "defaultValue", "className", "style", "isDisabled", "header", "height", "width", "viewType", "isSelected", "styleItem", "classNameItem", "size", "onClickItem"]);
        var _c = (0, tslib_1.__read)((0, useStateProps_1.useStateProps)(defaultValue), 2), value = _c[0], setValue = _c[1];
        var handleCLick = function (event, val) {
            setValue(val);
            onChange === null || onChange === void 0 ? void 0 : onChange(event, val);
            onClickItem === null || onClickItem === void 0 ? void 0 : onClickItem(event, val);
        };
        var renderItem = function (item) { return (react_1.default.createElement(ListItem_1.default, (0, tslib_1.__assign)({}, item, { key: item.label, size: size, className: classNameItem, style: styleItem, isDisabled: isDisabled || item.isDisabled, onClick: function (event) { return handleCLick(event, item.value); }, isSelected: item.value === value, leadContent: react_1.default.createElement(RadioButton_1.default, { isDisabled: isDisabled || item.isDisabled, value: item.value, name: item.name, isChecked: item.value === value }) }), item.label)); };
        return (react_1.default.createElement(List_1.default, (0, tslib_1.__assign)({ ref: ref, header: header, height: height, width: width, viewType: viewType, isSelected: isSelected, className: className, style: style, size: size, dataSource: dataSource, renderItem: renderItem, isDisabled: isDisabled }, props)));
    });
    ListRadioButtons.displayName = "ListRadioButtons";
    exports.default = ListRadioButtons;
});
