// #region Imports
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { isDateEqual, isDateInDates } from '../../../../../Extensions/DateExtensions';
import { Appearanceable } from '../../../../Behaviors/Appearanceable';
import { Themeable } from '../../../../Behaviors/Themeable';
import { Variantable } from '../../../../Behaviors/Variantable';
import { Component } from '../../../../Decorators/ComponentDecorator';
import { CalendarView } from '../../../../Types/CalendarView';
import { ButtonElement } from '../../../Buttons/Button/ButtonElement';
import { TextElement } from '../../../Primitives/Text/TextElement';
import { CalendarItemElement } from '../CalendarItemElement';
import { CalendarViewBaseElement } from './Abstracts/CalendarViewBase';
import { calendarYearsViewElementTemplate } from './CalendarYearsViewElementTemplate';
import { calendarYearsViewElementCosmopolitanStyle } from './Themes/CalendarYearsViewElement.Cosmopolitan';
import { calendarYearsViewElementJoyStyle } from './Themes/CalendarYearsViewElement.Joy';
import { calendarYearsViewElementMemphisStyle } from './Themes/CalendarYearsViewElement.Memphis';
// #endregion
/**
 * Calendar Years View - A component that displays a view of years in a calendar, allowing users to select a year.
 *
 * @description
 * The Calendar Years View component is used to display a list of years in a calendar format. This view allows users to
 * navigate and select a specific year. It is typically part of a larger calendar component or date picker, providing
 * a way to select years in the date selection process.
 *
 * @name CalendarYearsView
 * @element mosaik-calendar-years-view
 * @category Calendar
 *
 * @slot header - The header slot.
 *
 * @csspart heading - The heading part.
 * @csspart item - The item part.
 * @csspart navigation - The navigation part.
 * @csspart yearView - The year view part.
 * @csspart yearView - The yearView part.
 *
 * @cssprop {String} --calendar-years-view-font-family - The years view font family CSS custom property.
 * @cssprop {String} --calendar-years-view-font-letter-spacing - The years view font letter spacing CSS custom property.
 * @cssprop {String} --calendar-years-view-font-line-height - The years view font line height CSS custom property.
 * @cssprop {String} --calendar-years-view-font-size - The years view font size CSS custom property.
 * @cssprop {String} --calendar-years-view-font-text-decoration - The years view font text decoration CSS custom property.
 * @cssprop {String} --calendar-years-view-font-text-transform - The years view font text transform CSS custom property.
 * @cssprop {String} --calendar-years-view-font-weight - The years view font weight CSS custom property.
 * @cssprop {String} --calendar-years-view-gap
 * @cssprop {String} --calendar-years-view-padding-bottom
 * @cssprop {String} --calendar-years-view-padding-left
 * @cssprop {String} --calendar-years-view-padding-right
 * @cssprop {String} --calendar-years-view-padding-top
 * @cssprop {String} --calendar-years-view-shadow - The years view shadow CSS custom property.
 * @cssprop {String} --calendar-years-view-shadow-blur - The years view shadow blur CSS custom property.
 * @cssprop {String} --calendar-years-view-shadow-color - The years view shadow color CSS custom property.
 * @cssprop {String} --calendar-years-view-shadow-offset-x - The years view shadow offset x CSS custom property.
 * @cssprop {String} --calendar-years-view-shadow-offset-y - The years view shadow offset y CSS custom property.
 * @cssprop {String} --calendar-years-view-shadow-spread - The years view shadow spread CSS custom property.
 * @cssprop {String} --calendar-years-view-transition-duration - The years view transition duration CSS custom property.
 * @cssprop {String} --calendar-years-view-transition-mode - The years view transition mode CSS custom property.
 * @cssprop {String} --calendar-years-view-transition-property - The years view transition property CSS custom property.
 * @cssprop {String} --calendar-years-view-translate - The years view translate CSS custom property.
 *
 * @dependency mosaik-button - The Button element.
 * @dependency mosaik-button-group - The Button Group element.
 * @dependency mosaik-calendar-item - The Calendar Item element.
 *
 * @example
 * Basic calendar years view:
 * ```html
 * <mosaik-calendar-years-view></mosaik-calendar-years-view>
 * ```
 *
 * @example
 * Calendar years view with primary variant:
 * ```html
 * <mosaik-calendar-years-view variant="primary"></mosaik-calendar-years-view>
 * ```
 *
 * @public
 */
let CalendarYearsViewElement = class CalendarYearsViewElement extends Themeable(Appearanceable(Variantable(CalendarViewBaseElement))) {
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     * The `is` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-calendar-years-view';
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     * @template
     */
    selectYear(year) {
        this.displayDate?.setFullYear(year);
        this.value?.setFullYear(year);
        if (this.value === undefined) {
            console.error('[CalendarYearsViewElement] Value is not set.');
        }
        const date = this.value;
        this.onValueChanged({
            value: {
                date: date,
                isAdjacent: false, // TODO: isAdjacent
                isBlackout: isDateInDates(date, this.blackoutDates),
                isSpecial: isDateInDates(date, this.specialDates),
                isToday: isDateEqual(date, new Date()),
                isWeekend: date.getDay() === 0 || date.getDay() === 6
            },
            values: this.values?.map((date) => ({
                date: date,
                isAdjacent: false, // TODO: isAdjacent
                isBlackout: isDateInDates(date, this.blackoutDates),
                isSpecial: isDateInDates(date, this.specialDates),
                isToday: isDateEqual(date, new Date()),
                isWeekend: date.getDay() === 0 || date.getDay() === 6
            }))
        });
        this.setView(CalendarView.Month);
    }
    /**
     * @protected
     * @template
     */
    setView(view) {
        this.onViewChanged({ view: view });
    }
};
CalendarYearsViewElement = __decorate([
    Component({
        selector: 'mosaik-calendar-years-view',
        template: calendarYearsViewElementTemplate,
        themes: {
            joy: calendarYearsViewElementJoyStyle,
            memphis: calendarYearsViewElementMemphisStyle,
            cosmopolitan: calendarYearsViewElementCosmopolitanStyle
        },
        imports: [
            TextElement,
            ButtonElement,
            CalendarItemElement
        ]
    }),
    __metadata("design:paramtypes", [])
], CalendarYearsViewElement);
export { CalendarYearsViewElement };
//# sourceMappingURL=CalendarYearsViewElement.js.map