import { __assign, __read, __rest } from "tslib";
import React from "react";
import { useStateProps } from "../hooks/useStateProps";
import { MapObjectRoot, StripeStyled } from "./styles";
var MapObject = React.forwardRef(function (_a, ref) {
    var className = _a.className, icon = _a.icon, typeColor = _a.typeColor, onClick = _a.onClick, isDisabled = _a.isDisabled, props = __rest(_a, ["className", "icon", "typeColor", "onClick", "isDisabled"]);
    var _b = __read(useStateProps(props.isChecked), 2), isChecked = _b[0], setIsChecked = _b[1];
    var handleClick = function (event) {
        setIsChecked(function (prevState) { return !prevState; });
        onClick === null || onClick === void 0 ? void 0 : onClick(event);
    };
    return (React.createElement(MapObjectRoot, __assign({ className: className, typeColor: typeColor, onClick: handleClick, isChecked: isChecked, isDisabled: isDisabled, ref: ref }, props),
        icon,
        !isDisabled && React.createElement(StripeStyled, { isChecked: isChecked })));
});
MapObject.displayName = "MapObject";
export default MapObject;
