/**
 * amis-ui v6.12.0-beta.0
 * Copyright 2018-2025 fex
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var tslib = require('tslib');
var React = require('react');
var amisCore = require('amis-core');
var icons = require('./icons.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

var __react_jsx__ = require('react');
var _J$X_ = (__react_jsx__["default"] || __react_jsx__).createElement;
(__react_jsx__["default"] || __react_jsx__).Fragment;
var Link = /** @class */ (function (_super) {
    tslib.__extends(Link, _super);
    function Link(props) {
        return _super.call(this, props) || this;
    }
    Link.prototype.handleClick = function (e) {
        var _a = this.props, disabled = _a.disabled, onClick = _a.onClick;
        if (disabled) {
            e.preventDefault();
            e.stopPropagation();
            return;
        }
        onClick === null || onClick === void 0 ? void 0 : onClick(e);
    };
    Link.prototype.render = function () {
        var _a = this.props, className = _a.className, style = _a.style, href = _a.href, cx = _a.classnames, disabled = _a.disabled, htmlTarget = _a.htmlTarget, title = _a.title, icon = _a.icon, rightIcon = _a.rightIcon, children = _a.children; _a.classPrefix; _a.theme; var rest = tslib.__rest(_a, ["className", "style", "href", "classnames", "disabled", "htmlTarget", "title", "icon", "rightIcon", "children", "classPrefix", "theme"]);
        return (_J$X_("a", tslib.__assign({}, rest, { href: href, target: htmlTarget, className: cx("Link", {
                'is-disabled': disabled
            }, className), style: style, title: title, onClick: this.handleClick }),
            icon ? _J$X_(icons.Icon, { cx: cx, icon: icon, className: "Link-icon" }) : null,
            children,
            rightIcon ? (_J$X_(icons.Icon, { cx: cx, icon: rightIcon, className: "Link-icon" })) : null));
    };
    tslib.__decorate([
        amisCore.autobind,
        tslib.__metadata("design:type", Function),
        tslib.__metadata("design:paramtypes", [Object]),
        tslib.__metadata("design:returntype", void 0)
    ], Link.prototype, "handleClick", null);
    return Link;
}(React__default["default"].Component));
var Link$1 = amisCore.themeable(Link);

exports.Link = Link;
exports["default"] = Link$1;
