import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
import { s as stopEventBubbling } from './form-input.js';
import { B as BEM } from './bem.js';

const DateCalendar = proxyCustomElement(class DateCalendar extends HTMLElement {
    constructor() {
        super();
        this.__registerHost();
        this.balSelectDay = createEvent(this, "balSelectDay", 7);
        this.onClick = (ev, selectedDate) => {
            if (!this.disabled) {
                this.balSelectDay.emit(selectedDate);
            }
            else {
                stopEventBubbling(ev);
            }
        };
        this.day = undefined;
        this.month = undefined;
        this.year = undefined;
        this.isoDate = undefined;
        this.fullDate = undefined;
        this.selected = false;
        this.today = false;
        this.disabled = false;
    }
    render() {
        const block = BEM.block('date-calendar-cell');
        return (h(Host, { class: Object.assign(Object.assign(Object.assign(Object.assign({}, block.class()), block.modifier('today').class(!this.disabled && this.today)), block.modifier('selected').class(!this.disabled && this.selected)), block.modifier('disabled').class(this.disabled === true)), tabIndex: -1, type: "button", role: "button", "aria-label": this.fullDate, "aria-selected": this.selected ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', title: this.fullDate, onClick: (ev) => this.onClick(ev, this.isoDate) }, h("time", { dateTime: this.isoDate }, this.day)));
    }
}, [0, "bal-date-calendar-cell", {
        "day": [2],
        "month": [2],
        "year": [2],
        "isoDate": [1, "iso-date"],
        "fullDate": [1, "full-date"],
        "selected": [4],
        "today": [4],
        "disabled": [4]
    }]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["bal-date-calendar-cell"];
    components.forEach(tagName => { switch (tagName) {
        case "bal-date-calendar-cell":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, DateCalendar);
            }
            break;
    } });
}

export { DateCalendar as D, defineCustomElement as d };
