// import { CloseOutlined } from '@ant-design/icons';
import { CnTooltip } from '@cainiaofe/cn-ui';
import clsx from 'classnames';
import React, { useMemo } from 'react';
const Skill = ({ removeSkill, prefixCls, toolTip, closable, title, value, }) => {
    const componentCls = `${prefixCls}-skill`;
    const closeNode = useMemo(() => {
        if (!closable) {
            return [null];
        }
        const config = typeof closable === 'boolean' ? {} : closable;
        const handleClose = (event) => {
            var _a;
            if (config.disabled) {
                return;
            }
            event.stopPropagation();
            removeSkill();
            (_a = config.onClose) === null || _a === void 0 ? void 0 : _a.call(config, event);
        };
        const closeIcon = config.closeIcon ||
            // <CloseOutlined className={`${componentCls}-close-icon`} />
            null;
        const closeNode = (React.createElement("div", { className: clsx(`${componentCls}-close`, {
                [`${componentCls}-close-disabled`]: config.disabled,
            }), onClick: handleClose, role: "button", "aria-label": "Close skill", tabIndex: 0 }, closeIcon));
        return closeNode;
    }, [closable, removeSkill]);
    const mergeTitle = title || value;
    const titleNode = toolTip ? React.createElement(CnTooltip, { ...toolTip }, mergeTitle) : mergeTitle;
    return (React.createElement("div", { className: `${componentCls}-wrapper`, contentEditable: false },
        React.createElement("div", { className: `${componentCls}-tag`, contentEditable: false, role: "button", tabIndex: 0 },
            React.createElement("span", { className: `${componentCls}-tag-text` }, titleNode),
            closeNode),
        React.createElement("div", { className: `${componentCls}-holder` })));
};
Skill.displayName = 'Skill';
export default Skill;
