import { h } from '@stencil/core';
export class EclBreadcrumbItem {
  constructor() {
    this.theme = 'ec';
    this.styleClass = undefined;
    this.variant = undefined;
    this.path = undefined;
    this.currentPage = false;
    this.ellipsis = false;
    this.buttonAriaLabel = '';
  }
  getClass() {
    const styleClasses = [
      `ecl-breadcrumb__segment`,
      `sc-ecl-breadcrumb-${this.theme}`,
      this.styleClass
    ];
    if (this.ellipsis) {
      styleClasses.push('ecl-breadcrumb__segment--ellipsis');
    }
    if (this.currentPage) {
      styleClasses.push('ecl-breadcrumb__current-page');
    }
    return styleClasses.join(' ');
  }
  getLinkClass() {
    const linkClasses = [
      `sc-ecl-breadcrumb-${this.theme}`,
      'ecl-breadcrumb__link',
      'ecl-link--no-visited',
    ];
    if (this.el.closest('.ecl-breadcrumb--negative')) {
      linkClasses.push('ecl-link--negative');
    }
    return linkClasses.join(' ');
  }
  getLiAttrs() {
    const attrs = { 'data-ecl-breadcrumb-item': 'static' };
    if (this.ellipsis) {
      attrs['data-ecl-breadcrumb-ellipsis'] = 'data-ecl-breadcrumb-ellipsis';
    }
    return attrs;
  }
  render() {
    return (h("li", Object.assign({ class: this.getClass() }, this.getLiAttrs()), !this.currentPage && !this.ellipsis ?
      h("ecl-link", { variant: "standalone", path: this.path, "style-class": this.getLinkClass() }, h("ecl-icon", { slot: "icon-after", "style-class": `ecl-breadcrumb__icon sc-ecl-breadcrumb-${this.theme}`, icon: "corner-arrow", transform: "rotate-90", size: "2xs" }), h("slot", null)) :
      h("slot", null), this.ellipsis ?
      h("ecl-button", { "style-class": `ecl-breadcrumb__ellipsis sc-ecl-breadcrumb-${this.theme}`, variant: "ghost", "data-ecl-breadcrumb-ellipsis-button": true, "aria-label": this.buttonAriaLabel }, "...", h("ecl-icon", { "style-class": `ecl-breadcrumb__icon sc-ecl-breadcrumb-${this.theme}`, size: "2xs", transform: "rotate-90", icon: "corner-arrow", slot: "icon-after" })) : '', this.currentPage ?
      h("slot", null) : ''));
  }
  static get is() { return "ecl-breadcrumb-item"; }
  static get properties() {
    return {
      "theme": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "theme",
        "reflect": false,
        "defaultValue": "'ec'"
      },
      "styleClass": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "style-class",
        "reflect": false
      },
      "variant": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "variant",
        "reflect": false
      },
      "path": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "path",
        "reflect": false
      },
      "currentPage": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "current-page",
        "reflect": false,
        "defaultValue": "false"
      },
      "ellipsis": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "ellipsis",
        "reflect": false,
        "defaultValue": "false"
      },
      "buttonAriaLabel": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "button-aria-label",
        "reflect": false,
        "defaultValue": "''"
      }
    };
  }
  static get elementRef() { return "el"; }
}
//# sourceMappingURL=ecl-breadcrumb-item.js.map
