import { Host, h } from "@stencil/core";
export class Day {
    dayHandler() {
        this.evaluateDay();
    }
    componentWillLoad() {
        this.evaluateDay();
    }
    equalToDatePickerDay(date = this.adapter.newDateFromValue()) {
        return this.adapter.sameDay(this.day, date);
    }
    evaluateDay() {
        this.dayAsDate = this.adapter.newDateFromArray(this.day.year, this.day.month, this.day.day);
    }
    daySelectedHandler() {
        this.anjDaySelect.emit(this.day);
    }
    mouseOverHandler() {
        this.anjMouseOver.emit(this.day);
    }
    mouseOutHandler() {
        this.anjMouseOut.emit();
    }
    render() {
        const disabled = this.adapter.isDisabled(this.dayAsDate, this.rangeParams);
        const hostClasses = {
            'anj-selected': this.equalToDatePickerDay(this.date),
            'anj-diff-month': this.day.month !== this.month,
            'anj-today': this.equalToDatePickerDay(),
            'anj-disabled': disabled
        };
        return (h(Host, { class: hostClasses }, this.day.month === this.month ?
            h("button", { type: "button", disabled: disabled, onClick: () => this.daySelectedHandler(), onBlur: () => this.mouseOutHandler(), onMouseOver: () => this.mouseOverHandler(), onMouseOut: () => this.mouseOutHandler(), onFocus: () => this.mouseOverHandler() }, this.day.day) : this.day.day));
    }
    static get is() { return "anj-date-picker-day"; }
    static get encapsulation() { return "scoped"; }
    static get originalStyleUrls() { return {
        "$": ["day.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["day.css"]
    }; }
    static get properties() { return {
        "adapter": {
            "type": "any",
            "mutable": false,
            "complexType": {
                "original": "any",
                "resolved": "any",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "adapter",
            "reflect": false
        },
        "date": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "Date",
                "resolved": "Date",
                "references": {
                    "Date": {
                        "location": "global"
                    }
                }
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            }
        },
        "day": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "DayWithMetadata",
                "resolved": "DayWithMetadata",
                "references": {
                    "DayWithMetadata": {
                        "location": "import",
                        "path": "../../../types/types"
                    }
                }
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            }
        },
        "month": {
            "type": "number",
            "mutable": false,
            "complexType": {
                "original": "number",
                "resolved": "number",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "month",
            "reflect": false
        },
        "rangeParams": {
            "type": "any",
            "mutable": false,
            "complexType": {
                "original": "any",
                "resolved": "any",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "range-params",
            "reflect": false
        }
    }; }
    static get states() { return {
        "dayAsDate": {}
    }; }
    static get events() { return [{
            "method": "anjMouseOut",
            "name": "anjMouseOut",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "complexType": {
                "original": "any",
                "resolved": "any",
                "references": {}
            }
        }, {
            "method": "anjMouseOver",
            "name": "anjMouseOver",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "complexType": {
                "original": "any",
                "resolved": "any",
                "references": {}
            }
        }, {
            "method": "anjDaySelect",
            "name": "anjDaySelect",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "complexType": {
                "original": "DayWithMetadata",
                "resolved": "DayWithMetadata",
                "references": {
                    "DayWithMetadata": {
                        "location": "import",
                        "path": "../../../types/types"
                    }
                }
            }
        }]; }
    static get watchers() { return [{
            "propName": "day",
            "methodName": "dayHandler"
        }]; }
}
