import { r as registerInstance, d as createEvent, h, H as Host } from './core-b78a8f7e.js';

const Day = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.anjMouseOut = createEvent(this, "anjMouseOut", 7);
        this.anjMouseOver = createEvent(this, "anjMouseOver", 7);
        this.anjDaySelect = createEvent(this, "anjDaySelect", 7);
    }
    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 watchers() { return {
        "day": ["dayHandler"]
    }; }
    static get style() { return ".sc-anj-date-picker-day-h {\n  border-radius: 50%;\n  color: var(--anj-neutral-dark);\n  cursor: pointer;\n  display: block;\n  font-size: 0.75rem;\n  line-height: 1;\n  text-align: center;\n  -webkit-transition: background-color 0.2s ease;\n  transition: background-color 0.2s ease;\n  width: 14.285%;\n}\n.sc-anj-date-picker-day-h:hover {\n  background-color: var(--anj-highlight-overlay);\n}\n.sc-anj-date-picker-day-h:focus-within {\n  background-color: #bed6ec;\n}\n.anj-today.sc-anj-date-picker-day-h {\n  background-color: var(--anj-highlight-overlay);\n  color: var(--anj-dark);\n  font-weight: bold;\n}\n.anj-today.sc-anj-date-picker-day-h:hover {\n  background-color: #bed6ec;\n}\n.anj-today.sc-anj-date-picker-day-h:focus-within {\n  background-color: #93badf;\n}\n.anj-selected.sc-anj-date-picker-day-h {\n  background: var(--anj-highlight);\n  color: var(--anj-light);\n}\n.anj-selected.sc-anj-date-picker-day-h:hover {\n  background: var(--anj-highlight);\n}\n.anj-disabled.sc-anj-date-picker-day-h {\n  background-color: var(--anj-background);\n  border-radius: 0;\n  color: var(--anj-neutral);\n  cursor: not-allowed;\n}\n.anj-diff-month.sc-anj-date-picker-day-h {\n  cursor: default;\n  opacity: 0;\n}\n.anj-today.anj-disabled.sc-anj-date-picker-day-h {\n  color: var(--anj-neutral-dark);\n}\n.anj-selected.anj-disabled.sc-anj-date-picker-day-h {\n  color: var(--anj-danger);\n}\n.sc-anj-date-picker-day-h button.sc-anj-date-picker-day {\n  background-color: inherit;\n  border: inherit;\n  border-radius: 50%;\n  color: inherit;\n  height: 31.72px;\n  padding: 0;\n  width: 31.72px;\n}\n.sc-anj-date-picker-day-h button.sc-anj-date-picker-day:focus {\n  -webkit-box-shadow: none;\n  box-shadow: none;\n}"; }
};

export { Day as anj_date_picker_day };
