var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import ConfigProvider from '../config-provider';
import Dropdown from '../dropdown';
import React, { Component } from 'react';
import cls from 'classnames';
import { Icon } from '../index';
import { Breadcrumb as NextBreadcrumb } from '@alifd/next';
class BreadcrumbItem extends Component {
    static Separator({ prefix, children }) {
        return React.createElement("span", { className: `${prefix}breadcrumb-separator` }, children);
    }
    render() {
        const { overlay } = this.props;
        const _a = this.props, { prefix = 'next-', className, rtl, children, activated, separator } = _a, otherProps = __rest(_a, ["prefix", "className", "rtl", "children", "activated", "separator"]);
        // overlay 模式
        if (overlay) {
            const clazz = cls(`${prefix}breadcrumb-text ${prefix}breadcrumb-text-overlay`, className, {
                activated,
            });
            const childDom = children => {
                return (React.createElement("span", { className: `${prefix}breadcrumb-overlay` },
                    children,
                    React.createElement(Icon, { size: 'small', type: "Caretdown-filled" })));
            };
            return (React.createElement("li", { dir: rtl ? 'rtl' : null, className: `${prefix}breadcrumb-item` },
                React.createElement("span", Object.assign({ className: clazz }, otherProps),
                    React.createElement(Dropdown, { className: `${prefix}breadcrumb-dropdown-wrapper`, trigger: childDom(children), triggerType: ['hover'] }, overlay)),
                activated
                    ? null
                    : BreadcrumbItem.Separator({ prefix, children: separator })));
        }
        return (React.createElement(NextBreadcrumb.Item, Object.assign({}, this.props, { prefix: prefix, className: cls(className, {}) })));
    }
}
class Breadcrumb extends Component {
    render() {
        return React.createElement(NextBreadcrumb, Object.assign({}, this.props));
    }
}
Breadcrumb.Item = ConfigProvider.config(BreadcrumbItem);
export default ConfigProvider.config(Breadcrumb);
