var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import PropTypes from 'prop-types';
import React, { PureComponent } from 'react';
import './Breadcrumbs.scss';
export var createBreadcrumbItem = function (_a) {
    var label = _a.label, link = _a.link;
    return ({
        label: label,
        link: link,
    });
};
var Breadcrumbs = /** @class */ (function (_super) {
    __extends(Breadcrumbs, _super);
    function Breadcrumbs() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.handleItemClicked = function (label) {
            if (_this.props.onClick) {
                _this.props.onClick(label);
            }
        };
        return _this;
    }
    Breadcrumbs.prototype.render = function () {
        var _this = this;
        return (React.createElement("nav", { className: [
                this.props.className,
                'ddb-breadcrumbs__container',
                "theme--" + this.props.theme,
            ]
                .filter(Boolean)
                .join(' ') },
            React.createElement("ol", { className: "ddb-breadcrumbs__list" }, this.props.items.map(function (_a) {
                var label = _a.label, link = _a.link;
                return React.createElement("li", { key: label, className: "ddb-breadcrumbs__item", itemScope: true, itemType: "http://data-vocabulary.org/Breadcrumb" }, link ?
                    React.createElement("a", { className: "ddb-breadcrumbs__item-link", href: link, rel: "up", itemProp: "url", onClick: _this.handleItemClicked.bind(_this, label) },
                        React.createElement("span", { className: "ddb-breadcrumbs__item-label", itemProp: "title" }, label)) :
                    React.createElement("span", { className: "ddb-breadcrumbs__item-label", itemProp: "title" }, label));
            }))));
    };
    Breadcrumbs.propTypes = {
        className: PropTypes.string,
        items: PropTypes.arrayOf(PropTypes.shape({
            label: PropTypes.string,
            link: PropTypes.string,
        })).isRequired,
        onClick: PropTypes.func,
        theme: PropTypes.string,
    };
    Breadcrumbs.defaultProps = {
        className: '',
        theme: 'light',
    };
    return Breadcrumbs;
}(PureComponent));
export { Breadcrumbs };
export default Breadcrumbs;
//# sourceMappingURL=Breadcrumbs.js.map