import { h } from '../edel-elements.core.js';

var SidemenuPosition;
(function (SidemenuPosition) {
    SidemenuPosition["default"] = "left";
    SidemenuPosition["left"] = "left";
    SidemenuPosition["right"] = "right";
})(SidemenuPosition || (SidemenuPosition = {}));
function isSidemenuPosition(value) {
    return value === SidemenuPosition.left || value === SidemenuPosition.right;
}

class EdelSidemenuComponent {
    constructor() {
        this.active = false;
        this.position = SidemenuPosition.default;
    }
    render() {
        return h("slot", null);
    }
    hostData() {
        return {
            class: 'sidemenu'
        };
    }
    componentDidLoad() {
        if (isSidemenuPosition(this.position) === false) {
            this.position = SidemenuPosition.default;
        }
        this.shouldHaveClass('sidemenu--active', this.active);
        this.shouldHaveClass('sidemenu--left', this.position === SidemenuPosition.left);
        this.shouldHaveClass('sidemenu--right', this.position === SidemenuPosition.right);
    }
    shouldHaveClass(theme, should) {
        if (should) {
            this.host.classList.add(theme);
        }
        else {
            this.host.classList.remove(theme);
        }
    }
    static get is() { return "edel-sidemenu"; }
    static get properties() { return {
        "active": {
            "type": Boolean,
            "attr": "active",
            "watchCallbacks": ["componentDidLoad"]
        },
        "host": {
            "elementRef": true
        },
        "position": {
            "type": String,
            "attr": "position",
            "mutable": true,
            "watchCallbacks": ["componentDidLoad"]
        }
    }; }
}

export { EdelSidemenuComponent as EdelSidemenu };
