"use strict";
exports.__esModule = true;
exports.ListLinks = void 0;
var tslib_1 = require("tslib");
// @ts-nocheck
require("./ListLinks.css");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var IconArrowRight_1 = require("../../icons/IconArrowRight/IconArrowRight");
var IconSoon_1 = require("../../icons/IconSoon/IconSoon");
var bem_1 = require("../../utils/bem");
var PropsWithAsAttributes_1 = require("../../utils/types/PropsWithAsAttributes");
var Button_1 = require("../Button/Button");
var cnListLinks = (0, bem_1.cn)('ListLinks');
exports.ListLinks = (0, PropsWithAsAttributes_1.forwardRefWithAs)(function (props) {
    var items = props.items, getLabel = props.getLabel, getPath = props.getPath;
    var linkAttrs = function (item) {
        var pathLink = getPath === null || getPath === void 0 ? void 0 : getPath(item);
        var targetBlank = item.targetBlank;
        if (pathLink && !targetBlank) {
            return {
                isLink: true,
                to: pathLink,
                iconRight: IconArrowRight_1.IconArrowRight
            };
        }
        if (pathLink && targetBlank) {
            return {
                as: 'a',
                href: pathLink,
                iconRight: IconArrowRight_1.IconArrowRight,
                target: '_blank'
            };
        }
        return {
            iconRight: IconSoon_1.IconSoon,
            disabled: true
        };
    };
    return (react_1["default"].createElement("div", { className: cnListLinks() }, items.map(function (item) { return (react_1["default"].createElement("div", { className: cnListLinks('Item'), key: item.id },
        react_1["default"].createElement(Button_1.Button, (0, tslib_1.__assign)({ view: "link-primary", label: getLabel(item), width: "full" }, linkAttrs(item))))); })));
});
