'use client';
'use strict';

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

var tslib = require('tslib');
var lit = require('lit');
var decorators_js = require('lit/decorators.js');
var classMap_js = require('lit/directives/class-map.js');
var sgdsElement = require('../../base/sgds-element.cjs.js');
var sgdsIcon = require('../Icon/sgds-icon.cjs.js');
var dropdownItem = require('./dropdown-item.cjs.js');
var dropdown = require('./dropdown.cjs.js');

/**
 * @summary `SgdsDropdownItem` are navigation links built with `HTMLAnchorElement`. It should be used in the default slot of `SgdsDropdown`
 * @slot default - The default slot for SgdsDropdownItem. Pass in a single anchor tag per dropdown item directly for navigation items.
 */
class SgdsDropdownItem extends sgdsElement["default"] {
    constructor() {
        super(...arguments);
        /** when true, sets the active stylings of dropdown item */
        this.active = false;
        /** Disables the SgdsMainnavItem */
        this.disabled = false;
    }
    connectedCallback() {
        super.connectedCallback();
        this.addEventListener("keydown", (e) => {
            if (e.key === "Enter") {
                this.anchor[0].click();
            }
        });
        this.addEventListener("click", () => {
            this.anchor.length > 0 && this.anchor[0].click();
        });
        this.setAttribute("role", "menuitem");
        this.setAttribute("aria-disabled", `${this.disabled}`);
    }
    render() {
        return lit.html `
      <div
        class="dropdown-item ${classMap_js.classMap({
            disabled: this.disabled,
            active: this.active
        })}"
        tabindex=${this.disabled ? "-1" : "0"}
      >
        <slot></slot>
      </div>
    `;
    }
}
SgdsDropdownItem.styles = [dropdown["default"], dropdownItem["default"]];
SgdsDropdownItem.dependencies = {
    "sgds-icon": sgdsIcon.SgdsIcon
};
tslib.__decorate([
    decorators_js.queryAssignedElements({ flatten: true })
], SgdsDropdownItem.prototype, "anchor", void 0);
tslib.__decorate([
    decorators_js.property({ type: Boolean })
], SgdsDropdownItem.prototype, "active", void 0);
tslib.__decorate([
    decorators_js.property({ type: Boolean, reflect: true })
], SgdsDropdownItem.prototype, "disabled", void 0);

exports.SgdsDropdownItem = SgdsDropdownItem;
exports["default"] = SgdsDropdownItem;
//# sourceMappingURL=sgds-dropdown-item.cjs.js.map
