@m3e/web 2.5.1 → 2.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/all.js +1046 -10
  2. package/dist/all.js.map +1 -1
  3. package/dist/all.min.js +156 -43
  4. package/dist/all.min.js.map +1 -1
  5. package/dist/breadcrumb.js +1 -0
  6. package/dist/breadcrumb.js.map +1 -1
  7. package/dist/breadcrumb.min.js.map +1 -1
  8. package/dist/calendar.js +18 -2
  9. package/dist/calendar.js.map +1 -1
  10. package/dist/calendar.min.js +5 -5
  11. package/dist/calendar.min.js.map +1 -1
  12. package/dist/core.js +2 -0
  13. package/dist/core.js.map +1 -1
  14. package/dist/core.min.js.map +1 -1
  15. package/dist/css-custom-data.json +333 -333
  16. package/dist/custom-elements.json +3863 -3780
  17. package/dist/datepicker.js +6 -0
  18. package/dist/datepicker.js.map +1 -1
  19. package/dist/datepicker.min.js +1 -1
  20. package/dist/datepicker.min.js.map +1 -1
  21. package/dist/html-custom-data.json +139 -139
  22. package/dist/list.js +1 -1
  23. package/dist/list.js.map +1 -1
  24. package/dist/list.min.js +1 -1
  25. package/dist/list.min.js.map +1 -1
  26. package/dist/nav-bar.js +7 -4
  27. package/dist/nav-bar.js.map +1 -1
  28. package/dist/nav-bar.min.js +1 -1
  29. package/dist/nav-bar.min.js.map +1 -1
  30. package/dist/search.js +2 -2
  31. package/dist/search.js.map +1 -1
  32. package/dist/search.min.js +1 -1
  33. package/dist/search.min.js.map +1 -1
  34. package/dist/slider.js +2 -0
  35. package/dist/slider.js.map +1 -1
  36. package/dist/slider.min.js.map +1 -1
  37. package/dist/src/breadcrumb/BreadcrumbItemElement.d.ts +1 -0
  38. package/dist/src/breadcrumb/BreadcrumbItemElement.d.ts.map +1 -1
  39. package/dist/src/calendar/CalendarElement.d.ts.map +1 -1
  40. package/dist/src/calendar/MonthViewElement.d.ts.map +1 -1
  41. package/dist/src/core/shared/primitives/SlideElement.d.ts +2 -0
  42. package/dist/src/core/shared/primitives/SlideElement.d.ts.map +1 -1
  43. package/dist/src/datepicker/DatepickerElement.d.ts.map +1 -1
  44. package/dist/src/list/ListItemButtonElement.d.ts +0 -5
  45. package/dist/src/list/ListItemButtonElement.d.ts.map +1 -1
  46. package/dist/src/nav-bar/NavItemElement.d.ts.map +1 -1
  47. package/dist/src/slider/SliderElement.d.ts +2 -0
  48. package/dist/src/slider/SliderElement.d.ts.map +1 -1
  49. package/dist/src/theme/ThemeElement.d.ts +2 -0
  50. package/dist/src/theme/ThemeElement.d.ts.map +1 -1
  51. package/dist/src/theme/getColorFromImage.d.ts +12 -0
  52. package/dist/src/theme/getColorFromImage.d.ts.map +1 -0
  53. package/dist/src/theme/index.d.ts +1 -0
  54. package/dist/src/theme/index.d.ts.map +1 -1
  55. package/dist/theme.js +1007 -1
  56. package/dist/theme.js.map +1 -1
  57. package/dist/theme.min.js +133 -20
  58. package/dist/theme.min.js.map +1 -1
  59. package/dist/toc.js +1 -1
  60. package/dist/toc.js.map +1 -1
  61. package/dist/toc.min.js +1 -1
  62. package/dist/toc.min.js.map +1 -1
  63. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.min.js","sources":["../../src/calendar/utils.ts","../../src/calendar/CalendarViewElementBase.ts","../../src/calendar/MonthViewElement.ts","../../src/calendar/MultiYearViewElement.ts","../../src/calendar/YearViewElement.ts","../../src/calendar/CalendarElement.ts"],"sourcesContent":["/** @private */\r\nfunction createDateWithOverflow(year: number, month: number, day: number): Date {\r\n const date = new Date();\r\n date.setFullYear(year, month, day);\r\n date.setHours(0, 0, 0, 0);\r\n return date;\r\n}\r\n\r\n/** @private */\r\nfunction getStartingYear(minDate: Date | null, maxDate: Date | null): number {\r\n if (maxDate) {\r\n return maxDate.getFullYear() - YEARS_PER_PAGE + 1;\r\n } else if (minDate) {\r\n return minDate.getFullYear();\r\n }\r\n return 0;\r\n}\r\n\r\n/** @private */\r\nfunction euclideanModulo(a: number, b: number): number {\r\n return ((a % b) + b) % b;\r\n}\r\n\r\n/** @internal */\r\nexport function addCalendarDays(date: Date, days: number): Date {\r\n return createDateWithOverflow(date.getFullYear(), date.getMonth(), date.getDate() + days);\r\n}\r\n\r\n/** @internal */\r\nexport function addCalendarMonths(date: Date, months: number): Date {\r\n let newDate = createDateWithOverflow(date.getFullYear(), date.getMonth() + months, date.getDate());\r\n if (newDate.getMonth() != (((date.getMonth() + months) % 12) + 12) % 12) {\r\n newDate = createDateWithOverflow(newDate.getFullYear(), newDate.getMonth(), 0);\r\n }\r\n return newDate;\r\n}\r\n\r\n/** @internal */\r\nexport function addCalendarYears(date: Date, years: number): Date {\r\n return addCalendarMonths(date, years * 12);\r\n}\r\n\r\n/** @internal */\r\nexport function getNumDaysInMonth(date: Date): number {\r\n return createDateWithOverflow(date.getFullYear(), date.getMonth() + 1, 0).getDate();\r\n}\r\n\r\n/** @internal */\r\nexport function compareDate(first: Date, second: Date): number {\r\n return (\r\n first.getFullYear() - second.getFullYear() ||\r\n first.getMonth() - second.getMonth() ||\r\n first.getDate() - second.getDate()\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport function sameDate(first: Date | null, second: Date | null): boolean {\r\n return first && second ? compareDate(first, second) == 0 : first == second;\r\n}\r\n\r\n/** @internal */\r\nexport function getActiveOffset(activeDate: Date, minDate: Date | null, maxDate: Date | null): number {\r\n return euclideanModulo(activeDate.getFullYear() - getStartingYear(minDate, maxDate), YEARS_PER_PAGE);\r\n}\r\n\r\n/** @internal */\r\nexport function minYearOfPage(activeDate: Date, minDate: Date | null, maxDate: Date | null): number {\r\n return activeDate.getFullYear() - getActiveOffset(activeDate, minDate, maxDate);\r\n}\r\n\r\n/** @internal */\r\nexport function maxYearOfPage(activeDate: Date, minDate: Date | null, maxDate: Date | null): number {\r\n return minYearOfPage(activeDate, minDate, maxDate) + YEARS_PER_PAGE - 1;\r\n}\r\n\r\n/** @internal */\r\nexport function clampDate(date: Date, minDate: Date | null, maxDate: Date | null): Date {\r\n if (minDate && compareDate(date, minDate) < 0) return minDate;\r\n if (maxDate && compareDate(date, maxDate) > 0) return maxDate;\r\n return date;\r\n}\r\n\r\n/** @internal */ export const YEARS_PER_PAGE = 15;\r\n/** @internal */ export const YEARS_PER_ROW = 3;\r\n/** @internal */ export const MONTHS_PER_ROW = 4;\r\n","import { css, CSSResultGroup, LitElement } from \"lit\";\r\nimport { property, query } from \"lit/decorators.js\";\r\n\r\nimport { dateConverter, DesignToken, focusWhenReady } from \"@m3e/web/core\";\r\n\r\nimport { clampDate, sameDate } from \"./utils\";\r\n\r\n/**\r\n * A base implementation for a view in a calendar. This class must be inherited.\r\n * @internal\r\n */\r\nexport abstract class CalendarViewElementBase extends LitElement {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: inline-block;\r\n user-select: none;\r\n vertical-align: top;\r\n }\r\n .visually-hidden {\r\n position: absolute;\r\n appearance: none;\r\n visibility: hidden;\r\n border: none;\r\n outline: none;\r\n overflow: hidden;\r\n left: 0;\r\n height: 1px;\r\n width: 1px;\r\n margin: -1px;\r\n padding: 0;\r\n white-space: nowrap;\r\n }\r\n table {\r\n border-collapse: collapse;\r\n border-spacing: 0;\r\n width: calc(3rem * 7);\r\n }\r\n td,\r\n th {\r\n font: inherit;\r\n text-align: center;\r\n padding: unset;\r\n }\r\n td {\r\n box-sizing: border-box;\r\n height: 3rem;\r\n padding: 0.25rem;\r\n position: relative;\r\n color: var(--m3e-calendar-item-color, ${DesignToken.color.onSurface});\r\n }\r\n .item,\r\n .item > span {\r\n position: relative;\r\n }\r\n .item {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n border-radius: inherit;\r\n outline: none;\r\n width: 100%;\r\n height: 100%;\r\n border-radius: ${DesignToken.shape.corner.full};\r\n }\r\n .item:not([aria-disabled]) {\r\n cursor: pointer;\r\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n }\r\n .touch {\r\n position: absolute;\r\n height: 3rem;\r\n width: 3rem;\r\n margin: auto;\r\n }\r\n td:not(:has(.item[aria-disabled])).selected {\r\n color: var(--m3e-calendar-item-selected-color, ${DesignToken.color.onPrimary});\r\n --m3e-ripple-color: var(--m3e-calendar-item-selected-ripple-color, ${DesignToken.color.onPrimary});\r\n --m3e-state-layer-hover-color: var(--m3e-calendar-item-selected-hover-color, ${DesignToken.color.onPrimary});\r\n --m3e-state-layer-focus-color: var(--m3e-calendar-item-selected-focus-color, ${DesignToken.color.onPrimary});\r\n }\r\n td:not(:has(.item[aria-disabled])).selected .state-layer {\r\n background-color: var(--m3e-calendar-item-selected-container-color, ${DesignToken.color.primary});\r\n }\r\n td.current:not(.selected):not(.special):not(.range-start):not(.range-end) {\r\n color: var(--m3e-calendar-item-current-outline-color, ${DesignToken.color.primary});\r\n }\r\n td.current:not(.selected):not(.special):not(.range-start):not(.range-end) .state-layer {\r\n outline-style: solid;\r\n outline-offset: -1px;\r\n outline-width: var(--m3e-calendar-item-current-outline-thickness, 1px);\r\n outline-color: var(--m3e-calendar-item-current-outline-color, ${DesignToken.color.primary});\r\n }\r\n td:has(.item[aria-disabled]) {\r\n color: color-mix(\r\n in srgb,\r\n var(--m3e-calendar-item-disabled-color, ${DesignToken.color.onSurface})\r\n var(--m3e-calendar-item-disabled-color-opacity, 38%),\r\n transparent\r\n );\r\n }\r\n @media (forced-colors: active) {\r\n td:not(:has(.item[aria-disabled])).selected {\r\n forced-color-adjust: none;\r\n color: ButtonFace;\r\n }\r\n td:not(:has(.item[aria-disabled])).selected .state-layer {\r\n background-color: ButtonText;\r\n }\r\n td:has(.item[aria-disabled]) {\r\n color: GrayText;\r\n }\r\n td.current:not(.selected):not(.special):not(.range-start):not(.range-end) {\r\n color: ButtonText;\r\n }\r\n td.current:not(.selected):not(.special):not(.range-start):not(.range-end) .state-layer {\r\n border-color: ButtonText;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ @query(\".active > .item\") private readonly _activeItem?: HTMLElement;\r\n\r\n /** Today's date. */\r\n @property({ converter: dateConverter }) today: Date = new Date();\r\n\r\n /** The selected date. */\r\n @property({ converter: dateConverter }) date: Date | null = null;\r\n\r\n /** The active date. */\r\n @property({ attribute: \"active-date\", converter: dateConverter }) activeDate: Date = new Date();\r\n\r\n /** The minimum date that can be selected. */\r\n @property({ attribute: \"min-date\", converter: dateConverter }) minDate: Date | null = null;\r\n\r\n /** The maximum date that can be selected. */\r\n @property({ attribute: \"max-date\", converter: dateConverter }) maxDate: Date | null = null;\r\n\r\n /**\r\n * Asynchronously focuses the active date.\r\n * @returns {Promise<void>} A promise that resolves after the active date has been focused.\r\n */\r\n async focusActiveCell(): Promise<void> {\r\n if (this.isUpdatePending) {\r\n await this.updateComplete;\r\n }\r\n\r\n if (this._activeItem) {\r\n await focusWhenReady(this._activeItem);\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected _changeActiveDate(activeDate: Date): void {\r\n activeDate = clampDate(activeDate, this.minDate, this.maxDate);\r\n if (!sameDate(activeDate, this.activeDate)) {\r\n this._activeItem?.style.setProperty(\"--m3e-state-layer-duration\", \"0ms\");\r\n this._activeItem?.blur();\r\n this._activeItem?.style.removeProperty(\"--m3e-state-layer-duration\");\r\n\r\n this.activeDate = activeDate;\r\n this.dispatchEvent(new Event(\"active-change\", { bubbles: false }));\r\n }\r\n }\r\n}\r\n","/**\r\n * Adapted from Angular Material Datepicker\r\n * Source: https://github.com/angular/components/blob/main/src/material/datepicker/month-view.ts\r\n *\r\n * @license MIT\r\n * Copyright (c) 2025 Google LLC\r\n * See LICENSE file in the project root for full license text.\r\n */\r\n\r\nimport { css, CSSResultGroup, html, nothing } from \"lit\";\r\nimport { property } from \"lit/decorators.js\";\r\nimport { classMap } from \"lit/directives/class-map.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport { customElement, dateConverter, DesignToken } from \"@m3e/web/core\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\n\r\nimport { CalendarViewElementBase } from \"./CalendarViewElementBase\";\r\nimport {\r\n addCalendarDays,\r\n addCalendarMonths,\r\n addCalendarYears,\r\n clampDate,\r\n compareDate,\r\n getNumDaysInMonth,\r\n sameDate,\r\n} from \"./utils\";\r\n\r\n/**\r\n * An internal component used to display a single month in a calendar.\r\n * @internal\r\n */\r\n@customElement(\"m3e-month-view\")\r\nexport class M3eMonthViewElement extends CalendarViewElementBase {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = [\r\n CalendarViewElementBase.styles,\r\n css`\r\n thead {\r\n font-size: var(--m3e-calendar-weekday-font-size, ${DesignToken.typescale.standard.title.small.fontSize});\r\n font-weight: var(--m3e-calendar-weekday-font-weight, ${DesignToken.typescale.standard.title.small.fontWeight});\r\n line-height: var(--m3e-calendar-weekday-line-height, ${DesignToken.typescale.standard.title.small.lineHeight});\r\n letter-spacing: var(--m3e-calendar-weekday-tracking, ${DesignToken.typescale.standard.title.small.tracking});\r\n color: var(--m3e-calendar-weekday-color, ${DesignToken.color.onSurface});\r\n }\r\n th {\r\n height: 1.5rem;\r\n padding-block-start: 1.875rem;\r\n padding-block-end: 1rem;\r\n }\r\n tbody {\r\n font-size: var(--m3e-calendar-date-font-size, ${DesignToken.typescale.standard.body.medium.fontSize});\r\n font-weight: var(--m3e-calendar-date-font-weight, ${DesignToken.typescale.standard.body.medium.fontWeight});\r\n line-height: var(--m3e-calendar-date-line-height, ${DesignToken.typescale.standard.body.medium.lineHeight});\r\n letter-spacing: var(--m3e-calendar-date-tracking, ${DesignToken.typescale.standard.body.medium.tracking});\r\n }\r\n td:not(:has(.item[aria-disabled])):not(.selected):not(.range-start):not(.range-end).special {\r\n color: var(--m3e-calendar-item-special-color, ${DesignToken.color.onTertiaryContainer});\r\n --m3e-ripple-color: var(--m3e-calendar-item-special-ripple-color, ${DesignToken.color.onTertiaryContainer});\r\n --m3e-state-layer-hover-color: var(\r\n --m3e-calendar-item-special-hover-color,\r\n ${DesignToken.color.onTertiaryContainer}\r\n );\r\n --m3e-state-layer-focus-color: var(\r\n --m3e-calendar-item-special-focus-color,\r\n ${DesignToken.color.onTertiaryContainer}\r\n );\r\n }\r\n td:not(:has(.item[aria-disabled])):not(.selected):not(.range-start):not(.range-end).special .state-layer {\r\n background-color: var(--m3e-calendar-item-special-container-color, ${DesignToken.color.tertiaryContainer});\r\n }\r\n td:not(:has(.item[aria-disabled])).range-start,\r\n td:not(:has(.item[aria-disabled])).range-end {\r\n color: var(--m3e-calendar-item-selected-color, ${DesignToken.color.onPrimary});\r\n --m3e-ripple-color: var(--m3e-calendar-item-selected-ripple-color, ${DesignToken.color.onPrimary});\r\n }\r\n td:not(:has(.item[aria-disabled])).range-start .state-layer,\r\n td:not(:has(.item[aria-disabled])).range-end .state-layer {\r\n background-color: var(--m3e-calendar-item-selected-container-color, ${DesignToken.color.primary});\r\n }\r\n td:not(:has(.item[aria-disabled])).range::before,\r\n td:not(:has(.item[aria-disabled])).range-start-range::before,\r\n td:not(:has(.item[aria-disabled])).range-end::before {\r\n content: \"\";\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n top: 0.25rem;\r\n bottom: 0.25rem;\r\n background-color: var(--m3e-calendar-range-container-color, ${DesignToken.color.primaryContainer});\r\n }\r\n td:not(:has(.item[aria-disabled])):not(.selected).range {\r\n color: var(--m3e-calendar-range-color, ${DesignToken.color.onPrimaryContainer});\r\n }\r\n td:not(:has(.item[aria-disabled])).range-start::before {\r\n inset-inline-start: 50%;\r\n width: 50%;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-end::before {\r\n inset-inline-end: 50%;\r\n width: 50%;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-highlight-start .item::after,\r\n td:not(:has(.item[aria-disabled])).range-highlight .item::after,\r\n td:not(:has(.item[aria-disabled])).range-highlight-end .item::after {\r\n content: \"\";\r\n position: absolute;\r\n top: 0;\r\n left: calc(0px - 0.1875rem);\r\n right: calc(0px - 0.1875rem);\r\n bottom: 0;\r\n border-style: dashed;\r\n border-color: ${DesignToken.color.primary};\r\n border-width: 1px;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-highlight-start .item::after {\r\n margin-inline-start: 50%;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-highlight-end .item::after {\r\n margin-inline-end: 0.1875rem;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-highlight-start .item::after,\r\n td:not(:has(.item[aria-disabled])).range-highlight .item::after {\r\n border-inline-style: none;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-highlight-end .item::after {\r\n border-start-end-radius: ${DesignToken.shape.corner.full};\r\n border-end-end-radius: ${DesignToken.shape.corner.full};\r\n border-inline-start-style: none;\r\n }\r\n @media (forced-colors: active) {\r\n td:not(:has(.item[aria-disabled])).range-start,\r\n td:not(:has(.item[aria-disabled])).range-end {\r\n forced-color-adjust: none;\r\n color: HighlightText;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-start .state-layer,\r\n td:not(:has(.item[aria-disabled])).range-end .state-layer {\r\n background-color: Highlight;\r\n }\r\n td:not(:has(.item[aria-disabled])).range::before,\r\n td:not(:has(.item[aria-disabled])).range-start-range::before,\r\n td:not(:has(.item[aria-disabled])).range-end::before {\r\n background-color: Highlight;\r\n }\r\n td:not(:has(.item[aria-disabled])):not(.selected).range {\r\n forced-color-adjust: none;\r\n color: HighlightText;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-highlight-start .item::after,\r\n td:not(:has(.item[aria-disabled])).range-highlight .item::after,\r\n td:not(:has(.item[aria-disabled])).range-highlight-end .item::after {\r\n border-color: GrayText;\r\n }\r\n }\r\n `,\r\n ];\r\n\r\n /** @internal */ _suppressFocusHighlight = true;\r\n\r\n /** Start of a date range. */\r\n @property({ attribute: \"range-start\", converter: dateConverter }) rangeStart: Date | null = null;\r\n\r\n /** End of a date range. */\r\n @property({ attribute: \"range-end\", converter: dateConverter }) rangeEnd: Date | null = null;\r\n\r\n /** A function used to determine whether a date cannot be selected. */\r\n @property({ attribute: false }) blackoutDates: ((date: Date) => boolean) | null = null;\r\n\r\n /** A function used to determine whether a date is special. */\r\n @property({ attribute: false }) specialDates: ((date: Date) => boolean) | null = null;\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n const date = new Date(this.today);\r\n date.setDate(1);\r\n\r\n while (date.getDay() != 0) {\r\n date.setDate(date.getDate() + 1);\r\n }\r\n\r\n const weekdays = new Array<{ long: string; narrow: string; id: number }>();\r\n const narrowFormat = new Intl.DateTimeFormat(navigator.language, { weekday: \"narrow\" });\r\n const longFormat = new Intl.DateTimeFormat(navigator.language, { weekday: \"long\" });\r\n\r\n for (let i = 0; i < 7; i++) {\r\n weekdays.push({ id: i, narrow: narrowFormat.format(date), long: longFormat.format(date) });\r\n date.setDate(date.getDate() + 1);\r\n }\r\n\r\n const year = this.activeDate.getFullYear();\r\n const month = this.activeDate.getMonth();\r\n const firstDate = new Date(year, month, 1);\r\n const lastDate = new Date(year, month + 1, 0);\r\n const numDays = lastDate.getDate();\r\n\r\n let weeks: number[][] = [];\r\n let dayOfWeek = firstDate.getDay();\r\n\r\n for (let i = 1; i <= numDays; i++) {\r\n if (dayOfWeek === 0 || weeks.length === 0) {\r\n weeks.push([]);\r\n }\r\n weeks[weeks.length - 1].push(i);\r\n dayOfWeek = (dayOfWeek + 1) % 7;\r\n }\r\n\r\n weeks = weeks.filter((x) => !!x.length);\r\n\r\n return html`<table role=\"grid\">\r\n <thead>\r\n <tr>\r\n ${weekdays.map(\r\n (x) =>\r\n html`<th scope=\"col\">\r\n <span class=\"visually-hidden\">${x.long}</span>\r\n <div id=\"weekday-${x.id}-month-${month}\" aria-hidden=\"true\">${x.narrow}</div>\r\n <m3e-tooltip for=\"weekday-${x.id}-month-${month}\">${x.long}</m3e-tooltip>\r\n </th>`,\r\n )}\r\n </tr>\r\n </thead>\r\n <tbody>\r\n ${weeks.map(\r\n (row, i) =>\r\n html`<tr role=\"row\">\r\n ${i === 0 && row.length < 7 ? html`<td colspan=\"${7 - row.length}\"></td>` : nothing}\r\n ${row.map((y) => this.#renderItem(new Date(year, month, y)))}\r\n ${i > 0 && row.length < 7 ? html`<td colspan=\"${7 - row.length}\"></td>` : nothing}\r\n </tr>`,\r\n )}\r\n </tbody>\r\n </table>`;\r\n }\r\n\r\n /** @private */\r\n #renderItem(value: Date): unknown {\r\n const long = new Intl.DateTimeFormat(navigator.language, {\r\n year: \"numeric\",\r\n month: \"long\",\r\n day: \"numeric\",\r\n }).format(value);\r\n\r\n const special = this.specialDates?.(value) ?? false;\r\n const selected = sameDate(this.date, value);\r\n const active = sameDate(this.activeDate, value);\r\n const current = sameDate(this.today, value);\r\n const disabled =\r\n (this.minDate && compareDate(value, this.minDate) < 0) ||\r\n (this.maxDate && compareDate(value, this.maxDate) > 0) ||\r\n this.blackoutDates?.(value) === true;\r\n\r\n const id = `date-${value.getMonth()}-${value.getDate()}-${value.getFullYear()}`;\r\n\r\n let range = false,\r\n rangeStart = false,\r\n rangeEnd = false,\r\n rangeStartRange = false;\r\n\r\n if (this.rangeStart) {\r\n if (!this.rangeEnd) {\r\n rangeStart = sameDate(value, this.rangeStart);\r\n } else {\r\n range = compareDate(value, this.rangeStart) > 0 && compareDate(value, this.rangeEnd) < 0;\r\n if (!range) {\r\n rangeStart = compareDate(value, this.rangeStart) >= 0 && compareDate(value, this.rangeEnd) < 0;\r\n if (!rangeStart) {\r\n rangeEnd = compareDate(value, this.rangeStart) > 0 && compareDate(value, this.rangeEnd) <= 0;\r\n } else {\r\n rangeStartRange = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return html`<td\r\n role=\"gridcell\"\r\n class=\"${classMap({\r\n current,\r\n selected,\r\n active,\r\n special,\r\n range,\r\n \"range-start\": rangeStart,\r\n \"range-start-range\": rangeStartRange,\r\n \"range-end\": rangeEnd,\r\n })}\"\r\n >\r\n <div\r\n id=\"${id}\"\r\n role=\"button\"\r\n class=\"item\"\r\n data-value=\"${value.toISOString()}\"\r\n tabindex=\"${active ? \"0\" : \"-1\"}\"\r\n aria-disabled=\"${ifDefined(disabled || undefined)}\"\r\n aria-current=\"${ifDefined(current ? \"date\" : undefined)}\"\r\n aria-pressed=\"${selected || rangeStart || rangeEnd}\"\r\n @click=\"${this.#handleItemClick}\"\r\n @mouseenter=\"${this.#handleItemMouseEnter}\"\r\n @focus=\"${this.#handleItemFocus}\"\r\n @mouseleave=\"${this.#clearRangeHighlight}\"\r\n @blur=\"${this.#clearRangeHighlight}\"\r\n @keydown=\"${this.#handleItemKeyDown}\"\r\n >\r\n <m3e-focus-ring class=\"focus-ring\" for=\"${id}\"></m3e-focus-ring>\r\n <m3e-state-layer class=\"state-layer\" for=\"${id}\" ?disable-hover=\"${disabled}\"></m3e-state-layer>\r\n <m3e-ripple class=\"ripple\" centered for=\"${id}\" ?disabled=\"${disabled}\"></m3e-ripple>\r\n <div class=\"touch\"></div>\r\n <span class=\"visually-hidden\">${long}</span>\r\n <span aria-hidden=\"true\">${value.getDate()}</span>\r\n </div>\r\n </td>`;\r\n }\r\n\r\n /** @private */\r\n #handleItemClick(e: Event): void {\r\n const item = e.currentTarget as HTMLElement;\r\n if (item.ariaDisabled === \"true\" || !item.dataset[\"value\"]) return;\r\n\r\n this.activeDate = new Date(item.dataset[\"value\"]);\r\n this.activeDate = clampDate(this.activeDate, this.minDate, this.maxDate);\r\n\r\n if (this.rangeStart) {\r\n if (compareDate(this.activeDate, this.rangeStart) < 0) {\r\n this.rangeStart = this.activeDate;\r\n this.rangeEnd = null;\r\n } else {\r\n this.rangeEnd = this.activeDate;\r\n }\r\n this.#clearRangeHighlight();\r\n }\r\n\r\n this.dispatchEvent(new Event(\"change\", { bubbles: false }));\r\n }\r\n\r\n /** @private */\r\n #handleItemKeyDown(e: KeyboardEvent): void {\r\n let activeDate = this.activeDate;\r\n\r\n switch (e.key) {\r\n case \" \":\r\n case \"Enter\":\r\n e.preventDefault();\r\n (e.currentTarget as HTMLElement).click();\r\n return;\r\n\r\n case \"ArrowLeft\":\r\n case \"Left\":\r\n activeDate = addCalendarDays(activeDate, M3eDirectionality.current === \"rtl\" ? 1 : -1);\r\n break;\r\n\r\n case \"ArrowRight\":\r\n case \"Right\":\r\n activeDate = addCalendarDays(activeDate, M3eDirectionality.current === \"rtl\" ? -1 : 1);\r\n break;\r\n\r\n case \"ArrowUp\":\r\n case \"Up\":\r\n activeDate = addCalendarDays(activeDate, -7);\r\n break;\r\n\r\n case \"ArrowDown\":\r\n case \"Down\":\r\n activeDate = addCalendarDays(activeDate, 7);\r\n break;\r\n\r\n case \"Home\":\r\n activeDate = addCalendarDays(activeDate, 1 - activeDate.getDate());\r\n break;\r\n\r\n case \"End\":\r\n activeDate = addCalendarDays(activeDate, getNumDaysInMonth(activeDate) - activeDate.getDate());\r\n break;\r\n\r\n case \"PageUp\":\r\n activeDate = e.altKey ? addCalendarYears(activeDate, -1) : addCalendarMonths(activeDate, -1);\r\n break;\r\n\r\n case \"PageDown\":\r\n activeDate = e.altKey ? addCalendarYears(activeDate, 1) : addCalendarMonths(activeDate, 1);\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n e.preventDefault();\r\n this._changeActiveDate(activeDate);\r\n }\r\n\r\n /** @private */\r\n #handleItemMouseEnter(e: Event): void {\r\n this.#setRangeHighlight(e.currentTarget as HTMLElement);\r\n }\r\n\r\n /** @private */\r\n #handleItemFocus(e: Event): void {\r\n if (!this._suppressFocusHighlight) {\r\n this.#setRangeHighlight(e.currentTarget as HTMLElement);\r\n }\r\n }\r\n\r\n /** @private */\r\n #setRangeHighlight(item: HTMLElement): void {\r\n this.#clearRangeHighlight();\r\n if (this.rangeStart && item.dataset[\"value\"]) {\r\n if (compareDate(new Date(item.dataset[\"value\"]), this.rangeStart) > 0) {\r\n item.parentElement!.classList.add(\"range-highlight-end\");\r\n }\r\n for (const cell of item.closest(\"table\")?.querySelectorAll<HTMLElement>(\".item\") ?? []) {\r\n if (cell === item) break;\r\n\r\n const value = new Date(cell.dataset[\"value\"]!);\r\n if (compareDate(value, this.rangeStart) > 0) {\r\n cell.parentElement!.classList.add(\"range-highlight\");\r\n } else if (compareDate(value, this.rangeStart) >= 0) {\r\n cell.parentElement!.classList.add(\"range-highlight-start\");\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #clearRangeHighlight(): void {\r\n if (this.rangeStart) {\r\n this.shadowRoot\r\n ?.querySelectorAll(\".range-highlight,.range-highlight-end,.range-highlight-start\")\r\n .forEach((x) => x.classList.remove(\"range-highlight\", \"range-highlight-end\", \"range-highlight-start\"));\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-month-view\": M3eMonthViewElement;\r\n }\r\n}\r\n","/**\r\n * Adapted from Angular Material Datepicker\r\n * Source: https://github.com/angular/components/blob/main/src/material/datepicker/multi-year-view.ts\r\n *\r\n * @license MIT\r\n * Copyright (c) 2025 Google LLC\r\n * See LICENSE file in the project root for full license text.\r\n */\r\n\r\nimport { css, CSSResultGroup, html } from \"lit\";\r\nimport { classMap } from \"lit/directives/class-map.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport { customElement, DesignToken } from \"@m3e/web/core\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\n\r\nimport { CalendarViewElementBase } from \"./CalendarViewElementBase\";\r\nimport { addCalendarYears, clampDate, getActiveOffset, minYearOfPage, YEARS_PER_PAGE, YEARS_PER_ROW } from \"./utils\";\r\n\r\n/**\r\n * An internal component used to display a year selector in a calendar.\r\n * @internal\r\n */\r\n@customElement(\"m3e-multi-year-view\")\r\nexport class M3eMultiYearViewElement extends CalendarViewElementBase {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = [\r\n CalendarViewElementBase.styles,\r\n css`\r\n .item {\r\n height: 2.25rem;\r\n }\r\n .touch {\r\n width: 100%;\r\n }\r\n th {\r\n height: 1rem;\r\n }\r\n td {\r\n padding-inline: 1rem;\r\n }\r\n tbody {\r\n font-size: var(--m3e-calendar-item-font-size, ${DesignToken.typescale.standard.body.medium.fontSize});\r\n font-weight: var(--m3e-calendar-item-font-weight, ${DesignToken.typescale.standard.body.medium.fontWeight});\r\n line-height: var(--m3e-calendar-item-line-height, ${DesignToken.typescale.standard.body.medium.lineHeight});\r\n letter-spacing: var(--m3e-calendar-item-tracking, ${DesignToken.typescale.standard.body.medium.tracking});\r\n }\r\n `,\r\n ];\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n const years = new Array<number[]>();\r\n const minYear = minYearOfPage(this.activeDate, this.minDate, this.maxDate);\r\n for (let i = 0, row: number[] = []; i < YEARS_PER_PAGE; i++) {\r\n row.push(minYear + i);\r\n if (row.length === YEARS_PER_ROW) {\r\n years.push(row);\r\n row = new Array<number>();\r\n }\r\n }\r\n\r\n return html`<table role=\"grid\">\r\n <thead aria-hidden=\"true\">\r\n <tr>\r\n <th colspan=\"${YEARS_PER_ROW}\"></th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n ${years.map(\r\n (row) =>\r\n html`<tr role=\"row\">\r\n ${row.map((year) => this.#renderItem(year))}\r\n </tr>`,\r\n )}\r\n </tbody>\r\n </table>`;\r\n }\r\n\r\n /** @private */\r\n #renderItem(year: number): unknown {\r\n const yearFormat = new Intl.DateTimeFormat(navigator.language, { year: \"numeric\" });\r\n const active = this.activeDate.getFullYear() === year;\r\n const selected = this.date?.getFullYear() === year;\r\n const current = this.today.getFullYear() === year;\r\n const disabled =\r\n (this.minDate && year < this.minDate.getFullYear()) || (this.maxDate && year > this.maxDate.getFullYear());\r\n\r\n const id = `year-${year}`;\r\n\r\n return html`<td role=\"gridcell\" class=\"${classMap({ current, selected, active })}\">\r\n <div\r\n id=\"${id}\"\r\n class=\"item\"\r\n role=\"button\"\r\n tabindex=\"${active ? \"0\" : \"-1\"}\"\r\n data-value=\"${year}\"\r\n aria-disabled=\"${ifDefined(disabled || undefined)}\"\r\n aria-current=\"${ifDefined(current ? \"date\" : undefined)}\"\r\n aria-pressed=\"${selected}\"\r\n @click=\"${this.#handleItemClick}\"\r\n @keydown=\"${this.#handleItemKeyDown}\"\r\n >\r\n <m3e-focus-ring class=\"focus-ring\" for=\"${id}\"></m3e-focus-ring>\r\n <m3e-state-layer class=\"state-layer\" for=\"${id}\" ?disable-hover=\"${disabled}\"></m3e-state-layer>\r\n <m3e-ripple class=\"ripple\" for=\"${id}\" centered ?disabled=\"${disabled}\"></m3e-ripple>\r\n <div class=\"touch\"></div>\r\n <span>${yearFormat.format(new Date(year, 0, 1))}</span>\r\n </div>\r\n </td>`;\r\n }\r\n\r\n /** @private */\r\n #handleItemClick(e: Event): void {\r\n const item = e.currentTarget as HTMLElement;\r\n if (item.ariaDisabled === \"true\" || !item.dataset[\"value\"]) return;\r\n\r\n this.activeDate = new Date(this.activeDate);\r\n this.activeDate.setFullYear(Number(item.dataset[\"value\"]));\r\n this.activeDate = clampDate(this.activeDate, this.minDate, this.maxDate);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: false }));\r\n }\r\n\r\n /** @private */\r\n #handleItemKeyDown(e: KeyboardEvent): void {\r\n let activeDate = this.activeDate;\r\n switch (e.key) {\r\n case \" \":\r\n case \"Enter\":\r\n e.preventDefault();\r\n (e.currentTarget as HTMLElement).click();\r\n return;\r\n\r\n case \"ArrowLeft\":\r\n case \"Left\":\r\n activeDate = addCalendarYears(activeDate, M3eDirectionality.current === \"rtl\" ? 1 : -1);\r\n break;\r\n\r\n case \"ArrowRight\":\r\n case \"Right\":\r\n activeDate = addCalendarYears(activeDate, M3eDirectionality.current === \"rtl\" ? -1 : 1);\r\n break;\r\n\r\n case \"ArrowUp\":\r\n case \"Up\":\r\n activeDate = addCalendarYears(activeDate, -YEARS_PER_ROW);\r\n break;\r\n\r\n case \"ArrowDown\":\r\n case \"Down\":\r\n activeDate = addCalendarYears(activeDate, YEARS_PER_ROW);\r\n break;\r\n\r\n case \"Home\":\r\n activeDate = addCalendarYears(activeDate, -getActiveOffset(activeDate, this.minDate, this.maxDate));\r\n break;\r\n\r\n case \"End\":\r\n activeDate = addCalendarYears(\r\n activeDate,\r\n YEARS_PER_PAGE - getActiveOffset(activeDate, this.minDate, this.maxDate) - 1,\r\n );\r\n break;\r\n\r\n case \"PageUp\":\r\n activeDate = addCalendarYears(activeDate, e.altKey ? -YEARS_PER_PAGE * 10 : -YEARS_PER_PAGE);\r\n break;\r\n\r\n case \"PageDown\":\r\n activeDate = addCalendarYears(activeDate, e.altKey ? YEARS_PER_PAGE * 10 : YEARS_PER_PAGE);\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n e.preventDefault();\r\n this._changeActiveDate(activeDate);\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-multi-year-view\": M3eMultiYearViewElement;\r\n }\r\n}\r\n","/**\r\n * Adapted from Angular Material Datepicker\r\n * Source: https://github.com/angular/components/blob/main/src/material/datepicker/year-view.ts\r\n *\r\n * @license MIT\r\n * Copyright (c) 2025 Google LLC\r\n * See LICENSE file in the project root for full license text.\r\n */\r\n\r\nimport { css, CSSResultGroup, html } from \"lit\";\r\nimport { classMap } from \"lit/directives/class-map.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport { customElement, DesignToken } from \"@m3e/web/core\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\n\r\nimport { CalendarViewElementBase } from \"./CalendarViewElementBase\";\r\nimport { addCalendarMonths, addCalendarYears, clampDate, MONTHS_PER_ROW } from \"./utils\";\r\n\r\n/**\r\n * An internal component used to display a single year in a calendar.\r\n * @internal\r\n */\r\n@customElement(\"m3e-year-view\")\r\nexport class M3eYearViewElement extends CalendarViewElementBase {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = [\r\n CalendarViewElementBase.styles,\r\n css`\r\n .item {\r\n height: 2.25rem;\r\n }\r\n .touch {\r\n width: 100%;\r\n }\r\n th {\r\n height: 1rem;\r\n }\r\n td {\r\n padding-inline: 0.375rem;\r\n }\r\n tbody {\r\n font-size: var(--m3e-calendar-item-font-size, ${DesignToken.typescale.standard.body.medium.fontSize});\r\n font-weight: var(--m3e-calendar-item-font-weight, ${DesignToken.typescale.standard.body.medium.fontWeight});\r\n line-height: var(--m3e-calendar-item-line-height, ${DesignToken.typescale.standard.body.medium.lineHeight});\r\n letter-spacing: var(--m3e-calendar-item-tracking, ${DesignToken.typescale.standard.body.medium.tracking});\r\n }\r\n `,\r\n ];\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n const months = new Array<Array<{ date: Date; long: string; narrow: string }>>();\r\n const shortFormat = new Intl.DateTimeFormat(navigator.language, { month: \"short\" });\r\n const longFormat = new Intl.DateTimeFormat(navigator.language, { month: \"long\" });\r\n const year = this.activeDate.getFullYear();\r\n\r\n for (let month = 0, row = new Array<{ date: Date; long: string; narrow: string }>(); month < 12; month++) {\r\n const date = new Date(year, month, 1);\r\n row.push({ narrow: shortFormat.format(date), long: longFormat.format(date), date: date });\r\n\r\n if (row.length == MONTHS_PER_ROW) {\r\n months.push(row);\r\n row = [];\r\n }\r\n }\r\n\r\n return html`<table role=\"grid\">\r\n <thead aria-hidden=\"true\">\r\n <tr>\r\n <th colspan=\"${MONTHS_PER_ROW}\"></th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n ${months.map(\r\n (row) =>\r\n html`<tr role=\"row\">\r\n ${row.map((month) => this.#renderItem(month))}\r\n </tr>`,\r\n )}\r\n </tbody>\r\n </table>`;\r\n }\r\n\r\n /** @private */\r\n #renderItem(month: { date: Date; long: string; narrow: string }): unknown {\r\n const active =\r\n this.activeDate.getFullYear() === month.date.getFullYear() &&\r\n this.activeDate.getMonth() === month.date.getMonth();\r\n\r\n const selected =\r\n this.date?.getFullYear() === month.date.getFullYear() && this.date?.getMonth() === month.date.getMonth();\r\n\r\n const current =\r\n this.today.getFullYear() === month.date.getFullYear() && this.today.getMonth() === month.date.getMonth();\r\n\r\n const disabled =\r\n (this.minDate &&\r\n (month.date.getFullYear() < this.minDate.getFullYear() ||\r\n (month.date.getFullYear() === this.minDate.getFullYear() &&\r\n month.date.getMonth() < this.minDate.getMonth()))) ||\r\n (this.maxDate &&\r\n (month.date.getFullYear() > this.maxDate.getFullYear() ||\r\n (month.date.getFullYear() === this.maxDate.getFullYear() &&\r\n month.date.getMonth() > this.maxDate.getMonth())));\r\n\r\n const id = `month-${month.date.getMonth()}`;\r\n\r\n return html`<td role=\"gridcell\" class=\"${classMap({ current, selected, active })}\">\r\n <div\r\n id=\"${id}\"\r\n class=\"item\"\r\n role=\"button\"\r\n tabindex=\"${active ? \"0\" : \"-1\"}\"\r\n data-value=\"${month.date.toISOString()}\"\r\n aria-disabled=\"${ifDefined(disabled || undefined)}\"\r\n aria-current=\"${ifDefined(current ? \"date\" : undefined)}\"\r\n aria-pressed=\"${selected}\"\r\n @click=\"${this.#handleItemClick}\"\r\n @keydown=\"${this.#handleItemKeyDown}\"\r\n >\r\n <m3e-focus-ring class=\"focus-ring\" for=\"${id}\"></m3e-focus-ring>\r\n <m3e-state-layer class=\"state-layer\" for=\"${id}\" ?disable-hover=\"${disabled}\"></m3e-state-layer>\r\n <m3e-ripple class=\"ripple\" centered for=\"${id}\" ?disabled=\"${disabled}\"></m3e-ripple>\r\n <div class=\"touch\"></div>\r\n <span class=\"visually-hidden\">${month.long}</span>\r\n <span aria-hidden=\"true\">${month.narrow}</span>\r\n </div>\r\n </td>`;\r\n }\r\n\r\n /** @private */\r\n #handleItemClick(e: Event): void {\r\n const item = e.currentTarget as HTMLElement;\r\n if (item.ariaDisabled === \"true\" || !item.dataset[\"value\"]) return;\r\n\r\n this.activeDate = clampDate(new Date(item.dataset[\"value\"]), this.minDate, this.maxDate);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: false }));\r\n }\r\n\r\n /** @private */\r\n #handleItemKeyDown(e: KeyboardEvent): void {\r\n let activeDate = this.activeDate;\r\n switch (e.key) {\r\n case \" \":\r\n case \"Enter\":\r\n e.preventDefault();\r\n (e.currentTarget as HTMLElement).click();\r\n return;\r\n\r\n case \"ArrowLeft\":\r\n case \"Left\":\r\n activeDate = addCalendarMonths(activeDate, M3eDirectionality.current === \"rtl\" ? 1 : -1);\r\n break;\r\n\r\n case \"ArrowRight\":\r\n case \"Right\":\r\n activeDate = addCalendarMonths(activeDate, M3eDirectionality.current === \"rtl\" ? -1 : 1);\r\n break;\r\n\r\n case \"ArrowUp\":\r\n case \"Up\":\r\n activeDate = addCalendarMonths(activeDate, -4);\r\n break;\r\n\r\n case \"ArrowDown\":\r\n case \"Down\":\r\n activeDate = addCalendarMonths(activeDate, 4);\r\n break;\r\n\r\n case \"Home\":\r\n activeDate = addCalendarMonths(activeDate, -activeDate.getMonth());\r\n break;\r\n\r\n case \"End\":\r\n activeDate = addCalendarMonths(activeDate, 11 - activeDate.getMonth());\r\n break;\r\n\r\n case \"PageUp\":\r\n activeDate = addCalendarYears(activeDate, e.altKey ? -10 : -1);\r\n break;\r\n\r\n case \"PageDown\":\r\n activeDate = addCalendarYears(activeDate, e.altKey ? 10 : 1);\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n e.preventDefault();\r\n this._changeActiveDate(activeDate);\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-year-view\": M3eYearViewElement;\r\n }\r\n}\r\n","/**\r\n * Adapted from Angular Material Datepicker\r\n * Source: https://github.com/angular/components/blob/main/src/material/datepicker/calendar.ts\r\n *\r\n * @license MIT\r\n * Copyright (c) 2025 Google LLC\r\n * See LICENSE file in the project root for full license text.\r\n */\r\n\r\nimport { css, CSSResultGroup, html, LitElement, PropertyValues, unsafeCSS } from \"lit\";\r\nimport { property, query, state } from \"lit/decorators.js\";\r\nimport { classMap } from \"lit/directives/class-map.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport { customElement, dateConverter, DesignToken, prefersReducedMotion } from \"@m3e/web/core\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\n\r\nimport \"@m3e/web/button\";\r\nimport \"@m3e/web/icon-button\";\r\nimport \"@m3e/web/tooltip\";\r\n\r\nimport { CalendarView } from \"./CalendarView\";\r\nimport { CalendarViewElementBase } from \"./CalendarViewElementBase\";\r\nimport { M3eMonthViewElement } from \"./MonthViewElement\";\r\nimport { maxYearOfPage, minYearOfPage } from \"./utils\";\r\n\r\nimport \"./MonthViewElement\";\r\nimport \"./MultiYearViewElement\";\r\nimport \"./YearViewElement\";\r\n\r\n/**\r\n * A calendar used to select a date.\r\n *\r\n * @description\r\n * The `m3e-calendar` component provides structured navigation and selection across\r\n * month, year, and multi‑year views. It supports single‑date and range selection,\r\n * applies disabled rules including minimum, maximum, and blackout constraints, and\r\n * provides styling hooks for special date states.\r\n *\r\n * @example\r\n * The following example illustrates use of the `m3e-calendar`. In this example, a calendar is displayed\r\n * with a selected date.\r\n *\r\n * ```html\r\n * <m3e-calendar date=\"2025-12-13\"></m3e-calendar>\r\n * ```\r\n *\r\n * @tag m3e-calendar\r\n *\r\n * @slot header - Renders the header of the calendar.\r\n *\r\n * @attr date - The selected date.\r\n * @attr max-date - The maximum date that can be selected.\r\n * @attr min-date - The minimum date that can be selected.\r\n * @attr range-end - End of a date range.\r\n * @attr range-start - Start of a date range.\r\n * @attr start-at - A date specifying the period (month or year) to start the calendar in.\r\n * @attr start-view - The initial view used to select a date.\r\n * @attr previous-month-label - The accessible label given to the button used to move to the previous month.\r\n * @attr next-month-label - The accessible label given to the button used to move to the next month.\r\n * @attr previous-year-label - The accessible label given to the button used to move to the previous year.\r\n * @attr next-year-label - The accessible label given to the button used to move to the next year.\r\n * @attr previous-multi-year-label - The accessible label given to the button used to move to the previous 24 years.\r\n * @attr next-multi-year-label - The accessible label given to the button used to move to the next 24 years.\r\n *\r\n * @fires change - Emitted when the selected date changes.\r\n *\r\n * @cssprop --m3e-calendar-container-color - Background color of the container surface.\r\n * @cssprop --m3e-calendar-container-elevation - Elevation shadow applied to the container surface.\r\n * @cssprop --m3e-calendar-container-shape - Corner radius of the container surface.\r\n * @cssprop --m3e-calendar-padding - Padding applied to the calendar header and body.\r\n * @cssprop --m3e-calendar-period-button-text-color - Text color used for the period‑navigation buttons in the header.\r\n * @cssprop --m3e-calendar-weekday-font-size - Font size of weekday labels in month view.\r\n * @cssprop --m3e-calendar-weekday-font-weight - Font weight of weekday labels in month view.\r\n * @cssprop --m3e-calendar-weekday-line-height - Line height of weekday labels in month view.\r\n * @cssprop --m3e-calendar-weekday-tracking - Letter spacing of weekday labels in month view.\r\n * @cssprop --m3e-calendar-weekday-color - Text color for weekday labels in month view.\r\n * @cssprop --m3e-calendar-date-font-size - Font size of date cells in month view.\r\n * @cssprop --m3e-calendar-date-font-weight - Font weight of date cells in month view.\r\n * @cssprop --m3e-calendar-date-line-height - Line height of date cells in month view.\r\n * @cssprop --m3e-calendar-date-tracking - Letter spacing of date cells in month view.\r\n * @cssprop --m3e-calendar-item-font-size - Font size of items in year and multi‑year views.\r\n * @cssprop --m3e-calendar-item-font-weight - Font weight of items in year and multi‑year views.\r\n * @cssprop --m3e-calendar-item-line-height - Line height of items in year and multi‑year views.\r\n * @cssprop --m3e-calendar-item-tracking - Letter spacing of items in year and multi‑year views.\r\n * @cssprop --m3e-calendar-item-color - Text color for date items.\r\n * @cssprop --m3e-calendar-item-selected-color - Text color for selected date items.\r\n * @cssprop --m3e-calendar-item-selected-container-color - Background color for selected date items.\r\n * @cssprop --m3e-calendar-item-selected-ripple-color - Ripple color used when interacting with selected date items.\r\n * @cssprop --m3e-calendar-item-selected-hover-color - Hover color used when interacting with selected date items.\r\n * @cssprop --m3e-calendar-item-selected-focus-color - Focus color used when interacting with selected date items.\r\n * @cssprop --m3e-calendar-item-current-outline-thickness - Outline thickness used to indicate the current date.\r\n * @cssprop --m3e-calendar-item-current-outline-color - Outline color used to indicate the current date.\r\n * @cssprop --m3e-calendar-item-special-color - Text color for dates marked as special.\r\n * @cssprop --m3e-calendar-item-special-container-color - Background color for dates marked as special.\r\n * @cssprop --m3e-calendar-item-special-ripple-color - Ripple color used when interacting with dates marked as special.\r\n * @cssprop --m3e-calendar-item-special-hover-color - Hover color used when interacting with dates marked as special.\r\n * @cssprop --m3e-calendar-item-special-focus-color - Focus color used when interacting with dates marked as special.\r\n * @cssprop --m3e-calendar-range-container-color - Background color applied to the selected date range.\r\n * @cssprop --m3e-calendar-range-color - Text color for dates within a selected range.\r\n * @cssprop --m3e-calendar-item-disabled-color - Color used for disabled date items.\r\n * @cssprop --m3e-calendar-item-disabled-color-opacity - Opacity applied to the disabled item color.\r\n * @cssprop --m3e-calendar-slide-animation-duration - Duration of slide transitions between calendar views.\r\n */\r\n@customElement(\"m3e-calendar\")\r\nexport class M3eCalendarElement extends LitElement {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: inline-block;\r\n vertical-align: top;\r\n width: fit-content;\r\n height: fit-content;\r\n }\r\n .base {\r\n display: flex;\r\n flex-direction: column;\r\n width: fit-content;\r\n overflow: hidden;\r\n padding: var(--m3e-calendar-padding, 0.5rem);\r\n background-color: var(--m3e-calendar-container-color);\r\n box-shadow: var(--m3e-calendar-container-elevation);\r\n border-radius: var(--m3e-calendar-container-shape);\r\n }\r\n .header {\r\n display: flex;\r\n align-items: center;\r\n --m3e-text-button-label-text-color: var(\r\n --m3e-calendar-period-button-text-color,\r\n ${DesignToken.color.onSurfaceVariant}\r\n );\r\n --m3e-text-button-hover-label-text-color: var(\r\n --m3e-calendar-period-button-text-color,\r\n ${DesignToken.color.onSurfaceVariant}\r\n );\r\n --m3e-text-button-focus-label-text-color: var(\r\n --m3e-calendar-period-button-text-color,\r\n ${DesignToken.color.onSurfaceVariant}\r\n );\r\n --m3e-text-button-pressed-label-text-color: var(\r\n --m3e-calendar-period-button-text-color,\r\n ${DesignToken.color.onSurfaceVariant}\r\n );\r\n }\r\n .spacer {\r\n flex: 1 1 auto;\r\n }\r\n svg {\r\n transition: transform ${DesignToken.motion.spring.fastEffects};\r\n }\r\n svg.rotate {\r\n transform: rotate(-180deg);\r\n }\r\n .body {\r\n position: relative;\r\n }\r\n .view:not(.no-animate) {\r\n transition: ${unsafeCSS(\r\n `margin var(--m3e-calendar-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard},\r\n visibility var(--m3e-calendar-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .view.before,\r\n .view.after {\r\n visibility: hidden;\r\n position: absolute;\r\n }\r\n .view.before {\r\n margin-inline-start: -100%;\r\n }\r\n .view.after {\r\n margin-inline-start: 100%;\r\n }\r\n .view:not(.before):not(.after) {\r\n visibility: visible;\r\n position: relative;\r\n left: 0;\r\n margin-inline-start: 0;\r\n }\r\n .row {\r\n opacity: 1;\r\n transform: translateY(0);\r\n }\r\n .row.multi-year {\r\n transition: ${unsafeCSS(\r\n `transform var(--m3e-calendar-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard} allow-discrete,\r\n opacity var(--m3e-calendar-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .row:not(.multi-year) {\r\n transition: ${unsafeCSS(\r\n `opacity var(--m3e-calendar-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .body.month > .row:not(.month),\r\n .body.year > .row:not(.year),\r\n .body.multi-year > .row:not(.multi-year) {\r\n visibility: hidden;\r\n position: absolute;\r\n transform: translateY(-10%);\r\n opacity: 0;\r\n }\r\n .body.month > .row:not(.month) .view:not(.before):not(.after),\r\n .body.year > .row:not(.year) .view:not(.before):not(.after),\r\n .body.multi-year > .row:not(.multi-year) .view:not(.before):not(.after) {\r\n visibility: hidden;\r\n transition: none;\r\n }\r\n\r\n @media (prefers-reduced-motion) {\r\n .row:not(.multi-year),\r\n .row.multi-year,\r\n .view:not(.no-animate),\r\n svg {\r\n transition: none;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ #transitionComplete?: Promise<void>;\r\n /** @private */ @state() private _today = new Date();\r\n /** @private */ @state() private _activeView: CalendarView = \"month\";\r\n /** @private */ @state() private _activeDate: Date = new Date();\r\n /** @private */ @query(\".active\") private readonly _view?: CalendarViewElementBase;\r\n /** @private */ @query(\".body\") private readonly _body!: HTMLElement;\r\n\r\n /**\r\n * The initial view used to select a date.\r\n * @default \"month\"\r\n */\r\n @property({ attribute: \"start-view\" }) startView: CalendarView = \"month\";\r\n\r\n /**\r\n * The selected date.\r\n * @default null\r\n */\r\n @property({ converter: dateConverter }) date: Date | null = null;\r\n\r\n /**\r\n * A date specifying the period (month or year) to start the calendar in.\r\n * @default null\r\n */\r\n @property({ attribute: \"start-at\", converter: dateConverter }) startAt: Date | null = null;\r\n\r\n /**\r\n * The minimum date that can be selected.\r\n * @default null\r\n */\r\n @property({ attribute: \"min-date\", converter: dateConverter }) minDate: Date | null = null;\r\n\r\n /**\r\n * The maximum date that can be selected.\r\n * @default null\r\n */\r\n @property({ attribute: \"max-date\", converter: dateConverter }) maxDate: Date | null = null;\r\n\r\n /**\r\n * Start of a date range.\r\n * @default null\r\n */\r\n @property({ attribute: \"range-start\", converter: dateConverter }) rangeStart: Date | null = null;\r\n\r\n /**\r\n * End of a date range.\r\n * @default null\r\n */\r\n @property({ attribute: \"range-end\", converter: dateConverter }) rangeEnd: Date | null = null;\r\n\r\n /**\r\n * A function used to determine whether a date cannot be selected.\r\n * @default null\r\n */\r\n @property({ attribute: false }) blackoutDates: ((date: Date) => boolean) | null = null;\r\n\r\n /**\r\n * A function used to determine whether a date is special.\r\n * @default null\r\n */\r\n @property({ attribute: false }) specialDates: ((date: Date) => boolean) | null = null;\r\n\r\n /**\r\n * The accessible label given to the button used to move to the previous month.\r\n * @default \"Previous month\"\r\n */\r\n @property({ attribute: \"previous-month-label\" }) previousMonthLabel = \"Previous month\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the previous year.\r\n * @default \"Previous year\"\r\n */\r\n @property({ attribute: \"previous-year-label\" }) previousYearLabel = \"Previous year\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the previous 24 years.\r\n * @default \"Previous 24 years\"\r\n */\r\n @property({ attribute: \"previous-multi-year-label\" }) previousMultiYearLabel = \"Previous 24 years\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the next month.\r\n * @default \"Next month\"\r\n */\r\n @property({ attribute: \"next-month-label\" }) nextMonthLabel = \"Next month\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the next year.\r\n * @default \"Next year\"\r\n */\r\n @property({ attribute: \"next-year-label\" }) nextYearLabel = \"Next year\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the next 24 years.\r\n * @default \"Next 24 years\"\r\n */\r\n @property({ attribute: \"next-multi-year-label\" }) nextMultiYearLabel = \"Next 24 years\";\r\n\r\n /** The label to present for the current period. */\r\n get periodLabel(): string {\r\n switch (this._activeView) {\r\n case \"month\":\r\n return new Intl.DateTimeFormat(navigator.language, { month: \"short\", year: \"numeric\" }).format(\r\n this._activeDate,\r\n );\r\n\r\n case \"year\":\r\n return new Intl.DateTimeFormat(navigator.language, { year: \"numeric\" }).format(\r\n new Date(this._activeDate.getFullYear(), 0, 1),\r\n );\r\n\r\n case \"multi-year\":\r\n return new Intl.DateTimeFormat(navigator.language, { year: \"numeric\" }).formatRange(\r\n new Date(minYearOfPage(this._activeDate, this.minDate, this.maxDate), 0, 1),\r\n new Date(maxYearOfPage(this._activeDate, this.minDate, this.maxDate), 0, 1),\r\n );\r\n }\r\n }\r\n\r\n /** Whether the calendar can move to the previous period. */\r\n get canMovePreviousPeriod(): boolean {\r\n if (!this.minDate) return true;\r\n switch (this._activeView) {\r\n case \"month\":\r\n return new Date(this._activeDate.getFullYear(), this._activeDate.getMonth(), 0) >= this.minDate;\r\n\r\n case \"year\":\r\n return new Date(this._activeDate.getFullYear() - 1, 12, 1) >= this.minDate;\r\n\r\n case \"multi-year\":\r\n return new Date(minYearOfPage(this._activeDate, this.minDate, this.maxDate) - 1, 12, 1) >= this.minDate;\r\n }\r\n }\r\n\r\n /** Whether the calendar can move to the next period. */\r\n get canMoveNextPeriod(): boolean {\r\n if (!this.maxDate) return true;\r\n switch (this._activeView) {\r\n case \"month\":\r\n return new Date(this._activeDate.getFullYear(), this._activeDate.getMonth() + 1, 1) <= this.maxDate;\r\n\r\n case \"year\":\r\n return new Date(this._activeDate.getFullYear() + 1, 1, 1) <= this.maxDate;\r\n\r\n case \"multi-year\":\r\n return new Date(maxYearOfPage(this._activeDate, this.minDate, this.maxDate) + 1, 12, 1) <= this.maxDate;\r\n }\r\n }\r\n\r\n /**\r\n * Asynchronously focuses the active date.\r\n * @returns {Promise<void>} A promise that resolves after the active date has been focused.\r\n */\r\n async focusActiveCell(): Promise<void> {\r\n if (this.isUpdatePending) {\r\n await this.updateComplete;\r\n }\r\n await this._view?.focusActiveCell();\r\n }\r\n\r\n /** Updates today's date. */\r\n updateTodayDate(): void {\r\n this._today = new Date();\r\n }\r\n\r\n /**\r\n * Moves the calendar to the previous period.\r\n * @returns {Promise<void>} A promise that resolves when the operation is complete.\r\n */\r\n async movePreviousPeriod(): Promise<void> {\r\n if (!this.canMovePreviousPeriod) return;\r\n if (prefersReducedMotion()) {\r\n this._activeDate = this.#getPreviousPeriod(this._activeView);\r\n return;\r\n }\r\n\r\n await this.#transitionComplete;\r\n\r\n const views = [...(this.shadowRoot?.querySelectorAll<HTMLElement>(`.row.${this._activeView} .view`) ?? [])];\r\n if (views.length != 3) return;\r\n\r\n this.#transitionComplete = new Promise<void>((resolve) => {\r\n views[0].addEventListener(\r\n \"transitionend\",\r\n () => {\r\n this._activeDate = this.#getPreviousPeriod(this._activeView);\r\n views.forEach((x) => x.classList.add(\"no-animate\"));\r\n views[1].classList.remove(\"after\");\r\n views[0].classList.add(\"before\");\r\n setTimeout(() => {\r\n views.forEach((x) => x.classList.remove(\"no-animate\"));\r\n resolve();\r\n });\r\n },\r\n { once: true },\r\n );\r\n });\r\n\r\n this._body.style.overflow = \"hidden\";\r\n views[1].classList.add(\"after\");\r\n views[0].classList.remove(\"before\");\r\n\r\n await this.#transitionComplete;\r\n this._body.style.overflow = \"\";\r\n }\r\n\r\n /**\r\n * Moves the calendar to the next period.\r\n * @returns {Promise<void>} A promise that resolves when the operation is complete.\r\n */\r\n async moveNextPeriod(): Promise<void> {\r\n if (!this.canMoveNextPeriod) return;\r\n if (prefersReducedMotion()) {\r\n this._activeDate = this.#getNextPeriod(this._activeView);\r\n return;\r\n }\r\n\r\n await this.#transitionComplete;\r\n\r\n const views = [...(this.shadowRoot?.querySelectorAll<HTMLElement>(`.row.${this._activeView} .view`) ?? [])];\r\n if (views.length != 3) return;\r\n\r\n this.#transitionComplete = new Promise<void>((resolve) => {\r\n views[2].addEventListener(\r\n \"transitionend\",\r\n () => {\r\n this._activeDate = this.#getNextPeriod(this._activeView);\r\n views.forEach((x) => x.classList.add(\"no-animate\"));\r\n views[1].classList.remove(\"before\");\r\n views[2].classList.add(\"after\");\r\n setTimeout(() => {\r\n views.forEach((x) => x.classList.remove(\"no-animate\"));\r\n resolve();\r\n });\r\n },\r\n { once: true },\r\n );\r\n });\r\n\r\n this._body.style.overflow = \"hidden\";\r\n views[1].classList.add(\"before\");\r\n views[2].classList.remove(\"after\");\r\n\r\n await this.#transitionComplete;\r\n this._body.style.overflow = \"\";\r\n }\r\n\r\n /**\r\n * Toggles the current period.\r\n * @returns {Promise<void>} A promise that resolves when the operation is complete.\r\n */\r\n async togglePeriod(): Promise<void> {\r\n await this.#transitionComplete;\r\n this._activeView = this._activeView === \"month\" ? \"multi-year\" : \"month\";\r\n await this.focusActiveCell();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override willUpdate(changedProperties: PropertyValues<this>): void {\r\n super.willUpdate(changedProperties);\r\n\r\n if (changedProperties.has(\"date\")) {\r\n this._activeDate = new Date(this.date ?? this._today);\r\n }\r\n if (changedProperties.has(\"startAt\")) {\r\n this._activeDate = new Date(this.startAt ?? this.date ?? this._today);\r\n }\r\n if (changedProperties.has(\"startView\")) {\r\n this._activeView = this.startView;\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override updated(_changedProperties: PropertyValues<this>): void {\r\n super.updated(_changedProperties);\r\n\r\n if (this._view instanceof M3eMonthViewElement) {\r\n if (_changedProperties.has(\"specialDates\") || _changedProperties.has(\"blackoutDates\")) {\r\n this.shadowRoot?.querySelectorAll(\"m3e-month-view\").forEach((x) => {\r\n x.specialDates = this.specialDates;\r\n x.blackoutDates = this.blackoutDates;\r\n });\r\n }\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<div class=\"base\">\r\n <slot name=\"header\">${this.#renderHeader()}</slot>\r\n <div class=\"body ${this._activeView}\">\r\n <div class=\"row multi-year\">\r\n ${this.#renderView(\"multi-year\", -1)}${this.#renderView(\"multi-year\", 0)}${this.#renderView(\"multi-year\", 1)}\r\n </div>\r\n <div class=\"row year\">\r\n ${this.#renderView(\"year\", -1)}${this.#renderView(\"year\", 0)}${this.#renderView(\"year\", 1)}\r\n </div>\r\n <div class=\"row month\">\r\n ${this.#renderView(\"month\", -1)}${this.#renderView(\"month\", 0)}${this.#renderView(\"month\", 1)}\r\n </div>\r\n </div>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n #renderHeader(): unknown {\r\n return html`<div class=\"header\">\r\n <m3e-button @click=\"${this.togglePeriod}\">\r\n ${this.periodLabel}\r\n <svg\r\n class=\"${classMap({ rotate: this._activeView !== \"month\" })}\"\r\n slot=\"trailing-icon\"\r\n viewBox=\"0 -960 960 960\"\r\n fill=\"currentColor\"\r\n >\r\n <path d=\"M480-360 280-560h400L480-360Z\" />\r\n </svg>\r\n </m3e-button>\r\n <div class=\"spacer\"></div>\r\n <m3e-icon-button\r\n ?disabled=\"${!this.canMovePreviousPeriod}\"\r\n @click=\"${this.movePreviousPeriod}\"\r\n aria-label=\"${this._activeView === \"month\"\r\n ? this.previousMonthLabel\r\n : this._activeView === \"year\"\r\n ? this.previousYearLabel\r\n : this.previousMultiYearLabel}\"\r\n >\r\n ${M3eDirectionality.current === \"ltr\"\r\n ? html`<svg viewBox=\"0 -960 960 960\" fill=\"currentColor\">\r\n <path d=\"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z\" />\r\n </svg>`\r\n : html`<svg viewBox=\"0 -960 960 960\" fill=\"currentColor\">\r\n <path d=\"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z\" />\r\n </svg>`}\r\n </m3e-icon-button>\r\n <m3e-icon-button\r\n ?disabled=\"${!this.canMoveNextPeriod}\"\r\n @click=\"${this.moveNextPeriod}\"\r\n aria-label=\"${this._activeView === \"month\"\r\n ? this.nextMonthLabel\r\n : this._activeView === \"year\"\r\n ? this.nextYearLabel\r\n : this.nextMultiYearLabel}\"\r\n >\r\n ${M3eDirectionality.current === \"ltr\"\r\n ? html`<svg viewBox=\"0 -960 960 960\" fill=\"currentColor\">\r\n <path d=\"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z\" />\r\n </svg>`\r\n : html`<svg viewBox=\"0 -960 960 960\" fill=\"currentColor\">\r\n <path d=\"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z\" />\r\n </svg>`}\r\n </m3e-icon-button>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n #renderView(view: CalendarView, offset: -1 | 0 | 1): unknown {\r\n const activeDate =\r\n offset < 0 ? this.#getPreviousPeriod(view) : offset > 0 ? this.#getNextPeriod(view) : new Date(this._activeDate);\r\n\r\n switch (view) {\r\n case \"month\":\r\n return html`<m3e-month-view\r\n class=\"view ${classMap({\r\n before: offset < 0,\r\n after: offset > 0,\r\n active: view === this._activeView && offset === 0,\r\n })}\"\r\n ?inert=\"${offset !== 0}\"\r\n today=\"${this._today.toISOString()}\"\r\n date=\"${ifDefined(this.date?.toISOString())}\"\r\n active-date=\"${activeDate.toISOString()}\"\r\n min-date=\"${ifDefined(this.minDate?.toISOString())}\"\r\n max-date=\"${ifDefined(this.maxDate?.toISOString())}\"\r\n range-start=\"${ifDefined(this.rangeStart?.toISOString())}\"\r\n range-end=\"${ifDefined(this.rangeEnd?.toISOString())}\"\r\n @active-change=\"${offset === 0 ? this.#handleActiveChange : undefined}\"\r\n @change=\"${offset === 0 ? this.#handleDateChange : undefined}\"\r\n >\r\n </m3e-month-view>`;\r\n\r\n case \"year\":\r\n return html`<m3e-year-view\r\n class=\"view ${classMap({\r\n before: offset < 0,\r\n after: offset > 0,\r\n active: view === this._activeView && offset === 0,\r\n })}\"\r\n ?inert=\"${offset !== 0}\"\r\n today=\"${this._today.toISOString()}\"\r\n date=\"${ifDefined(this.date?.toISOString())}\"\r\n active-date=\"${activeDate.toISOString()}\"\r\n min-date=\"${ifDefined(this.minDate?.toISOString())}\"\r\n max-date=\"${ifDefined(this.maxDate?.toISOString())}\"\r\n @active-change=\"${offset === 0 ? this.#handleActiveChange : undefined}\"\r\n @change=\"${offset === 0 ? this.#handleMonthChange : undefined}\"\r\n ></m3e-year-view>`;\r\n\r\n case \"multi-year\":\r\n return html`<m3e-multi-year-view\r\n class=\"view ${classMap({\r\n before: offset < 0,\r\n after: offset > 0,\r\n active: view === this._activeView && offset === 0,\r\n })}\"\r\n ?inert=\"${offset !== 0}\"\r\n today=\"${this._today.toISOString()}\"\r\n date=\"${ifDefined(this.date?.toISOString())}\"\r\n active-date=\"${activeDate.toISOString()}\"\r\n min-date=\"${ifDefined(this.minDate?.toISOString())}\"\r\n max-date=\"${ifDefined(this.maxDate?.toISOString())}\"\r\n @active-change=\"${offset === 0 ? this.#handleActiveChange : undefined}\"\r\n @change=\"${offset === 0 ? this.#handleYearChange : undefined}\"\r\n >\r\n </m3e-multi-year-view>`;\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleDateChange(e: Event): void {\r\n const monthView = e.currentTarget as M3eMonthViewElement;\r\n this._activeDate = new Date(monthView.activeDate);\r\n this.rangeStart = monthView.rangeStart;\r\n this.rangeEnd = monthView.rangeEnd;\r\n this.date = new Date(this._activeDate);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n\r\n /** @private */\r\n async #handleMonthChange(e: Event): Promise<void> {\r\n this._activeDate = new Date((e.currentTarget as CalendarViewElementBase).activeDate);\r\n this._activeView = \"month\";\r\n this.focusActiveCell();\r\n }\r\n\r\n /** @private */\r\n #handleYearChange(e: Event): void {\r\n this._activeDate = new Date((e.currentTarget as CalendarViewElementBase).activeDate);\r\n this._activeView = \"year\";\r\n this.focusActiveCell();\r\n }\r\n\r\n /** @private */\r\n async #handleActiveChange(e: Event): Promise<void> {\r\n if (this._view instanceof M3eMonthViewElement) {\r\n this._view._suppressFocusHighlight = false;\r\n }\r\n\r\n this._activeDate = new Date((e.currentTarget as CalendarViewElementBase).activeDate);\r\n await this.focusActiveCell();\r\n\r\n if (this._view instanceof M3eMonthViewElement) {\r\n this._view._suppressFocusHighlight = false;\r\n }\r\n }\r\n\r\n /** @private */\r\n #getPreviousPeriod(view: CalendarView): Date {\r\n const activeDate = new Date(this._activeDate);\r\n switch (view) {\r\n case \"month\":\r\n activeDate.setMonth(this._activeDate.getMonth() - 1);\r\n while (activeDate.getMonth() === this._activeDate.getMonth()) {\r\n activeDate.setDate(activeDate.getDate() - 1);\r\n }\r\n\r\n break;\r\n\r\n case \"year\":\r\n activeDate.setFullYear(this._activeDate.getFullYear() - 1);\r\n break;\r\n\r\n case \"multi-year\": {\r\n activeDate.setDate(1);\r\n activeDate.setFullYear(minYearOfPage(this._activeDate, this.minDate, this.maxDate) - 1);\r\n }\r\n }\r\n return activeDate;\r\n }\r\n\r\n /** @private */\r\n #getNextPeriod(view: CalendarView): Date {\r\n const activeDate = new Date(this._activeDate);\r\n switch (view) {\r\n case \"month\":\r\n activeDate.setMonth(this._activeDate.getMonth() + 1);\r\n while (activeDate.getMonth() === this._activeDate.getMonth()) {\r\n activeDate.setDate(activeDate.getDate() + 1);\r\n }\r\n break;\r\n\r\n case \"year\":\r\n activeDate.setFullYear(this._activeDate.getFullYear() + 1);\r\n break;\r\n\r\n case \"multi-year\":\r\n activeDate.setDate(1);\r\n activeDate.setFullYear(maxYearOfPage(this._activeDate, this.minDate, this.maxDate) + 1);\r\n break;\r\n }\r\n return activeDate;\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-calendar\": M3eCalendarElement;\r\n }\r\n}\r\n"],"names":["createDateWithOverflow","year","month","day","date","Date","setFullYear","setHours","addCalendarDays","days","getFullYear","getMonth","getDate","addCalendarMonths","months","newDate","addCalendarYears","years","compareDate","first","second","sameDate","getActiveOffset","activeDate","minDate","maxDate","a","YEARS_PER_PAGE","getStartingYear","b","minYearOfPage","maxYearOfPage","clampDate","CalendarViewElementBase","LitElement","constructor","this","today","focusActiveCell","isUpdatePending","updateComplete","_activeItem","focusWhenReady","_changeActiveDate","style","setProperty","blur","removeProperty","dispatchEvent","Event","bubbles","styles","css","DesignToken","color","onSurface","shape","corner","full","onPrimary","primary","__decorate","query","prototype","property","converter","dateConverter","attribute","M3eMonthViewElement","_suppressFocusHighlight","rangeStart","rangeEnd","blackoutDates","specialDates","render","setDate","getDay","weekdays","Array","narrowFormat","Intl","DateTimeFormat","navigator","language","weekday","longFormat","i","push","id","narrow","format","long","firstDate","numDays","weeks","dayOfWeek","length","filter","x","html","map","row","nothing","y","__classPrivateFieldGet","_M3eMonthViewElement_instances","_M3eMonthViewElement_renderItem","call","value","special","selected","active","current","disabled","range","rangeStartRange","classMap","toISOString","ifDefined","undefined","_M3eMonthViewElement_handleItemClick","_M3eMonthViewElement_handleItemMouseEnter","_M3eMonthViewElement_handleItemFocus","_M3eMonthViewElement_clearRangeHighlight","_M3eMonthViewElement_handleItemKeyDown","e","item","currentTarget","ariaDisabled","dataset","key","preventDefault","click","M3eDirectionality","altKey","parentElement","classList","add","cell","closest","querySelectorAll","shadowRoot","forEach","remove","typescale","standard","title","small","fontSize","fontWeight","lineHeight","tracking","body","medium","onTertiaryContainer","tertiaryContainer","primaryContainer","onPrimaryContainer","customElement","M3eMultiYearViewElement","minYear","yearFormat","_M3eMultiYearViewElement_instances","_M3eMultiYearViewElement_handleItemClick","_M3eMultiYearViewElement_handleItemKeyDown","Number","M3eYearViewElement","shortFormat","_M3eYearViewElement_instances","_M3eYearViewElement_handleItemClick","_M3eYearViewElement_handleItemKeyDown","M3eCalendarElement","_M3eCalendarElement_transitionComplete","set","_today","_activeView","_activeDate","startView","startAt","previousMonthLabel","previousYearLabel","previousMultiYearLabel","nextMonthLabel","nextYearLabel","nextMultiYearLabel","periodLabel","formatRange","canMovePreviousPeriod","canMoveNextPeriod","_view","updateTodayDate","movePreviousPeriod","prefersReducedMotion","_M3eCalendarElement_instances","_M3eCalendarElement_getPreviousPeriod","views","__classPrivateFieldSet","Promise","resolve","addEventListener","setTimeout","once","_body","overflow","moveNextPeriod","_M3eCalendarElement_getNextPeriod","togglePeriod","willUpdate","changedProperties","super","has","updated","_changedProperties","_M3eCalendarElement_renderHeader","_M3eCalendarElement_renderView","rotate","view","offset","before","after","_M3eCalendarElement_handleActiveChange","_M3eCalendarElement_handleDateChange","_M3eCalendarElement_handleMonthChange","_M3eCalendarElement_handleYearChange","monthView","async","setMonth","onSurfaceVariant","motion","spring","fastEffects","unsafeCSS","duration","long2","easing","state"],"mappings":";;;;;mmBACA,SAASA,EAAuBC,EAAcC,EAAeC,GAC3D,MAAMC,EAAO,IAAIC,KAGjB,OAFAD,EAAKE,YAAYL,EAAMC,EAAOC,GAC9BC,EAAKG,SAAS,EAAG,EAAG,EAAG,GAChBH,CACT,CAkBM,SAAUI,EAAgBJ,EAAYK,GAC1C,OAAOT,EAAuBI,EAAKM,cAAeN,EAAKO,WAAYP,EAAKQ,UAAYH,EACtF,CAGM,SAAUI,EAAkBT,EAAYU,GAC5C,IAAIC,EAAUf,EAAuBI,EAAKM,cAAeN,EAAKO,WAAaG,EAAQV,EAAKQ,WAIxF,OAHIG,EAAQJ,cAAiBP,EAAKO,WAAaG,GA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G,UAAW,sBAAoDwG,GAAA5G,UAAA,sBAAA,GAM/BF,EAAA,CAA3CG,EAAS,CAAEG,UAAW,qBAAiDwG,GAAA5G,UAAA,qBAAA,GAMtBF,EAAA,CAAjDG,EAAS,CAAEG,UAAW,2BAAgEwG,GAAA5G,UAAA,0BAAA,GAjN5E4G,GAAkB9G,EAAA,CAD9BiG,EAAc,iBACFa"}
1
+ {"version":3,"file":"calendar.min.js","sources":["../../src/calendar/utils.ts","../../src/calendar/CalendarViewElementBase.ts","../../src/calendar/MonthViewElement.ts","../../src/calendar/MultiYearViewElement.ts","../../src/calendar/YearViewElement.ts","../../src/calendar/CalendarElement.ts"],"sourcesContent":["/** @private */\r\nfunction createDateWithOverflow(year: number, month: number, day: number): Date {\r\n const date = new Date();\r\n date.setFullYear(year, month, day);\r\n date.setHours(0, 0, 0, 0);\r\n return date;\r\n}\r\n\r\n/** @private */\r\nfunction getStartingYear(minDate: Date | null, maxDate: Date | null): number {\r\n if (maxDate) {\r\n return maxDate.getFullYear() - YEARS_PER_PAGE + 1;\r\n } else if (minDate) {\r\n return minDate.getFullYear();\r\n }\r\n return 0;\r\n}\r\n\r\n/** @private */\r\nfunction euclideanModulo(a: number, b: number): number {\r\n return ((a % b) + b) % b;\r\n}\r\n\r\n/** @internal */\r\nexport function addCalendarDays(date: Date, days: number): Date {\r\n return createDateWithOverflow(date.getFullYear(), date.getMonth(), date.getDate() + days);\r\n}\r\n\r\n/** @internal */\r\nexport function addCalendarMonths(date: Date, months: number): Date {\r\n let newDate = createDateWithOverflow(date.getFullYear(), date.getMonth() + months, date.getDate());\r\n if (newDate.getMonth() != (((date.getMonth() + months) % 12) + 12) % 12) {\r\n newDate = createDateWithOverflow(newDate.getFullYear(), newDate.getMonth(), 0);\r\n }\r\n return newDate;\r\n}\r\n\r\n/** @internal */\r\nexport function addCalendarYears(date: Date, years: number): Date {\r\n return addCalendarMonths(date, years * 12);\r\n}\r\n\r\n/** @internal */\r\nexport function getNumDaysInMonth(date: Date): number {\r\n return createDateWithOverflow(date.getFullYear(), date.getMonth() + 1, 0).getDate();\r\n}\r\n\r\n/** @internal */\r\nexport function compareDate(first: Date, second: Date): number {\r\n return (\r\n first.getFullYear() - second.getFullYear() ||\r\n first.getMonth() - second.getMonth() ||\r\n first.getDate() - second.getDate()\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport function sameDate(first: Date | null, second: Date | null): boolean {\r\n return first && second ? compareDate(first, second) == 0 : first == second;\r\n}\r\n\r\n/** @internal */\r\nexport function getActiveOffset(activeDate: Date, minDate: Date | null, maxDate: Date | null): number {\r\n return euclideanModulo(activeDate.getFullYear() - getStartingYear(minDate, maxDate), YEARS_PER_PAGE);\r\n}\r\n\r\n/** @internal */\r\nexport function minYearOfPage(activeDate: Date, minDate: Date | null, maxDate: Date | null): number {\r\n return activeDate.getFullYear() - getActiveOffset(activeDate, minDate, maxDate);\r\n}\r\n\r\n/** @internal */\r\nexport function maxYearOfPage(activeDate: Date, minDate: Date | null, maxDate: Date | null): number {\r\n return minYearOfPage(activeDate, minDate, maxDate) + YEARS_PER_PAGE - 1;\r\n}\r\n\r\n/** @internal */\r\nexport function clampDate(date: Date, minDate: Date | null, maxDate: Date | null): Date {\r\n if (minDate && compareDate(date, minDate) < 0) return minDate;\r\n if (maxDate && compareDate(date, maxDate) > 0) return maxDate;\r\n return date;\r\n}\r\n\r\n/** @internal */ export const YEARS_PER_PAGE = 15;\r\n/** @internal */ export const YEARS_PER_ROW = 3;\r\n/** @internal */ export const MONTHS_PER_ROW = 4;\r\n","import { css, CSSResultGroup, LitElement } from \"lit\";\r\nimport { property, query } from \"lit/decorators.js\";\r\n\r\nimport { dateConverter, DesignToken, focusWhenReady } from \"@m3e/web/core\";\r\n\r\nimport { clampDate, sameDate } from \"./utils\";\r\n\r\n/**\r\n * A base implementation for a view in a calendar. This class must be inherited.\r\n * @internal\r\n */\r\nexport abstract class CalendarViewElementBase extends LitElement {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: inline-block;\r\n user-select: none;\r\n vertical-align: top;\r\n }\r\n .visually-hidden {\r\n position: absolute;\r\n appearance: none;\r\n visibility: hidden;\r\n border: none;\r\n outline: none;\r\n overflow: hidden;\r\n left: 0;\r\n height: 1px;\r\n width: 1px;\r\n margin: -1px;\r\n padding: 0;\r\n white-space: nowrap;\r\n }\r\n table {\r\n border-collapse: collapse;\r\n border-spacing: 0;\r\n width: calc(3rem * 7);\r\n }\r\n td,\r\n th {\r\n font: inherit;\r\n text-align: center;\r\n padding: unset;\r\n }\r\n td {\r\n box-sizing: border-box;\r\n height: 3rem;\r\n padding: 0.25rem;\r\n position: relative;\r\n color: var(--m3e-calendar-item-color, ${DesignToken.color.onSurface});\r\n }\r\n .item,\r\n .item > span {\r\n position: relative;\r\n }\r\n .item {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n border-radius: inherit;\r\n outline: none;\r\n width: 100%;\r\n height: 100%;\r\n border-radius: ${DesignToken.shape.corner.full};\r\n }\r\n .item:not([aria-disabled]) {\r\n cursor: pointer;\r\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n }\r\n .touch {\r\n position: absolute;\r\n height: 3rem;\r\n width: 3rem;\r\n margin: auto;\r\n }\r\n td:not(:has(.item[aria-disabled])).selected {\r\n color: var(--m3e-calendar-item-selected-color, ${DesignToken.color.onPrimary});\r\n --m3e-ripple-color: var(--m3e-calendar-item-selected-ripple-color, ${DesignToken.color.onPrimary});\r\n --m3e-state-layer-hover-color: var(--m3e-calendar-item-selected-hover-color, ${DesignToken.color.onPrimary});\r\n --m3e-state-layer-focus-color: var(--m3e-calendar-item-selected-focus-color, ${DesignToken.color.onPrimary});\r\n }\r\n td:not(:has(.item[aria-disabled])).selected .state-layer {\r\n background-color: var(--m3e-calendar-item-selected-container-color, ${DesignToken.color.primary});\r\n }\r\n td.current:not(.selected):not(.special):not(.range-start):not(.range-end) {\r\n color: var(--m3e-calendar-item-current-outline-color, ${DesignToken.color.primary});\r\n }\r\n td.current:not(.selected):not(.special):not(.range-start):not(.range-end) .state-layer {\r\n outline-style: solid;\r\n outline-offset: -1px;\r\n outline-width: var(--m3e-calendar-item-current-outline-thickness, 1px);\r\n outline-color: var(--m3e-calendar-item-current-outline-color, ${DesignToken.color.primary});\r\n }\r\n td:has(.item[aria-disabled]) {\r\n color: color-mix(\r\n in srgb,\r\n var(--m3e-calendar-item-disabled-color, ${DesignToken.color.onSurface})\r\n var(--m3e-calendar-item-disabled-color-opacity, 38%),\r\n transparent\r\n );\r\n }\r\n @media (forced-colors: active) {\r\n td:not(:has(.item[aria-disabled])).selected {\r\n forced-color-adjust: none;\r\n color: ButtonFace;\r\n }\r\n td:not(:has(.item[aria-disabled])).selected .state-layer {\r\n background-color: ButtonText;\r\n }\r\n td:has(.item[aria-disabled]) {\r\n color: GrayText;\r\n }\r\n td.current:not(.selected):not(.special):not(.range-start):not(.range-end) {\r\n color: ButtonText;\r\n }\r\n td.current:not(.selected):not(.special):not(.range-start):not(.range-end) .state-layer {\r\n border-color: ButtonText;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ @query(\".active > .item\") private readonly _activeItem?: HTMLElement;\r\n\r\n /** Today's date. */\r\n @property({ converter: dateConverter }) today: Date = new Date();\r\n\r\n /** The selected date. */\r\n @property({ converter: dateConverter }) date: Date | null = null;\r\n\r\n /** The active date. */\r\n @property({ attribute: \"active-date\", converter: dateConverter }) activeDate: Date = new Date();\r\n\r\n /** The minimum date that can be selected. */\r\n @property({ attribute: \"min-date\", converter: dateConverter }) minDate: Date | null = null;\r\n\r\n /** The maximum date that can be selected. */\r\n @property({ attribute: \"max-date\", converter: dateConverter }) maxDate: Date | null = null;\r\n\r\n /**\r\n * Asynchronously focuses the active date.\r\n * @returns {Promise<void>} A promise that resolves after the active date has been focused.\r\n */\r\n async focusActiveCell(): Promise<void> {\r\n if (this.isUpdatePending) {\r\n await this.updateComplete;\r\n }\r\n\r\n if (this._activeItem) {\r\n await focusWhenReady(this._activeItem);\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected _changeActiveDate(activeDate: Date): void {\r\n activeDate = clampDate(activeDate, this.minDate, this.maxDate);\r\n if (!sameDate(activeDate, this.activeDate)) {\r\n this._activeItem?.style.setProperty(\"--m3e-state-layer-duration\", \"0ms\");\r\n this._activeItem?.blur();\r\n this._activeItem?.style.removeProperty(\"--m3e-state-layer-duration\");\r\n\r\n this.activeDate = activeDate;\r\n this.dispatchEvent(new Event(\"active-change\", { bubbles: false }));\r\n }\r\n }\r\n}\r\n","/**\r\n * Adapted from Angular Material Datepicker\r\n * Source: https://github.com/angular/components/blob/main/src/material/datepicker/month-view.ts\r\n *\r\n * @license MIT\r\n * Copyright (c) 2025 Google LLC\r\n * See LICENSE file in the project root for full license text.\r\n */\r\n\r\nimport { css, CSSResultGroup, html, nothing } from \"lit\";\r\nimport { property } from \"lit/decorators.js\";\r\nimport { classMap } from \"lit/directives/class-map.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport { customElement, dateConverter, DesignToken } from \"@m3e/web/core\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\n\r\nimport { CalendarViewElementBase } from \"./CalendarViewElementBase\";\r\nimport {\r\n addCalendarDays,\r\n addCalendarMonths,\r\n addCalendarYears,\r\n clampDate,\r\n compareDate,\r\n getNumDaysInMonth,\r\n sameDate,\r\n} from \"./utils\";\r\n\r\n/**\r\n * An internal component used to display a single month in a calendar.\r\n * @internal\r\n */\r\n@customElement(\"m3e-month-view\")\r\nexport class M3eMonthViewElement extends CalendarViewElementBase {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = [\r\n CalendarViewElementBase.styles,\r\n css`\r\n thead {\r\n font-size: var(--m3e-calendar-weekday-font-size, ${DesignToken.typescale.standard.title.small.fontSize});\r\n font-weight: var(--m3e-calendar-weekday-font-weight, ${DesignToken.typescale.standard.title.small.fontWeight});\r\n line-height: var(--m3e-calendar-weekday-line-height, ${DesignToken.typescale.standard.title.small.lineHeight});\r\n letter-spacing: var(--m3e-calendar-weekday-tracking, ${DesignToken.typescale.standard.title.small.tracking});\r\n color: var(--m3e-calendar-weekday-color, ${DesignToken.color.onSurface});\r\n }\r\n th {\r\n height: 1.5rem;\r\n padding-block-start: 1.875rem;\r\n padding-block-end: 1rem;\r\n }\r\n tbody {\r\n font-size: var(--m3e-calendar-date-font-size, ${DesignToken.typescale.standard.body.medium.fontSize});\r\n font-weight: var(--m3e-calendar-date-font-weight, ${DesignToken.typescale.standard.body.medium.fontWeight});\r\n line-height: var(--m3e-calendar-date-line-height, ${DesignToken.typescale.standard.body.medium.lineHeight});\r\n letter-spacing: var(--m3e-calendar-date-tracking, ${DesignToken.typescale.standard.body.medium.tracking});\r\n }\r\n td:not(:has(.item[aria-disabled])):not(.selected):not(.range-start):not(.range-end).special {\r\n color: var(--m3e-calendar-item-special-color, ${DesignToken.color.onTertiaryContainer});\r\n --m3e-ripple-color: var(--m3e-calendar-item-special-ripple-color, ${DesignToken.color.onTertiaryContainer});\r\n --m3e-state-layer-hover-color: var(\r\n --m3e-calendar-item-special-hover-color,\r\n ${DesignToken.color.onTertiaryContainer}\r\n );\r\n --m3e-state-layer-focus-color: var(\r\n --m3e-calendar-item-special-focus-color,\r\n ${DesignToken.color.onTertiaryContainer}\r\n );\r\n }\r\n td:not(:has(.item[aria-disabled])):not(.selected):not(.range-start):not(.range-end).special .state-layer {\r\n background-color: var(--m3e-calendar-item-special-container-color, ${DesignToken.color.tertiaryContainer});\r\n }\r\n td:not(:has(.item[aria-disabled])).range-start,\r\n td:not(:has(.item[aria-disabled])).range-end {\r\n color: var(--m3e-calendar-item-selected-color, ${DesignToken.color.onPrimary});\r\n --m3e-ripple-color: var(--m3e-calendar-item-selected-ripple-color, ${DesignToken.color.onPrimary});\r\n }\r\n td:not(:has(.item[aria-disabled])).range-start .state-layer,\r\n td:not(:has(.item[aria-disabled])).range-end .state-layer {\r\n background-color: var(--m3e-calendar-item-selected-container-color, ${DesignToken.color.primary});\r\n }\r\n td:not(:has(.item[aria-disabled])).range::before,\r\n td:not(:has(.item[aria-disabled])).range-start-range::before,\r\n td:not(:has(.item[aria-disabled])).range-end::before {\r\n content: \"\";\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n top: 0.25rem;\r\n bottom: 0.25rem;\r\n background-color: var(--m3e-calendar-range-container-color, ${DesignToken.color.primaryContainer});\r\n }\r\n td:not(:has(.item[aria-disabled])):not(.selected).range {\r\n color: var(--m3e-calendar-range-color, ${DesignToken.color.onPrimaryContainer});\r\n }\r\n td:not(:has(.item[aria-disabled])).range-start::before {\r\n inset-inline-start: 50%;\r\n width: 50%;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-end::before {\r\n inset-inline-end: 50%;\r\n width: 50%;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-highlight-start .item::after,\r\n td:not(:has(.item[aria-disabled])).range-highlight .item::after,\r\n td:not(:has(.item[aria-disabled])).range-highlight-end .item::after {\r\n content: \"\";\r\n position: absolute;\r\n top: 0;\r\n left: calc(0px - 0.1875rem);\r\n right: calc(0px - 0.1875rem);\r\n bottom: 0;\r\n border-style: dashed;\r\n border-color: ${DesignToken.color.primary};\r\n border-width: 1px;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-highlight-start .item::after {\r\n margin-inline-start: 50%;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-highlight-end .item::after {\r\n margin-inline-end: 0.1875rem;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-highlight-start .item::after,\r\n td:not(:has(.item[aria-disabled])).range-highlight .item::after {\r\n border-inline-style: none;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-highlight-end .item::after {\r\n border-start-end-radius: ${DesignToken.shape.corner.full};\r\n border-end-end-radius: ${DesignToken.shape.corner.full};\r\n border-inline-start-style: none;\r\n }\r\n @media (forced-colors: active) {\r\n td:not(:has(.item[aria-disabled])).range-start,\r\n td:not(:has(.item[aria-disabled])).range-end {\r\n forced-color-adjust: none;\r\n color: HighlightText;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-start .state-layer,\r\n td:not(:has(.item[aria-disabled])).range-end .state-layer {\r\n background-color: Highlight;\r\n }\r\n td:not(:has(.item[aria-disabled])).range::before,\r\n td:not(:has(.item[aria-disabled])).range-start-range::before,\r\n td:not(:has(.item[aria-disabled])).range-end::before {\r\n background-color: Highlight;\r\n }\r\n td:not(:has(.item[aria-disabled])):not(.selected).range {\r\n forced-color-adjust: none;\r\n color: HighlightText;\r\n }\r\n td:not(:has(.item[aria-disabled])).range-highlight-start .item::after,\r\n td:not(:has(.item[aria-disabled])).range-highlight .item::after,\r\n td:not(:has(.item[aria-disabled])).range-highlight-end .item::after {\r\n border-color: GrayText;\r\n }\r\n }\r\n `,\r\n ];\r\n\r\n /** @internal */ _suppressFocusHighlight = true;\r\n\r\n /** Start of a date range. */\r\n @property({ attribute: \"range-start\", converter: dateConverter }) rangeStart: Date | null = null;\r\n\r\n /** End of a date range. */\r\n @property({ attribute: \"range-end\", converter: dateConverter }) rangeEnd: Date | null = null;\r\n\r\n /** A function used to determine whether a date cannot be selected. */\r\n @property({ attribute: false }) blackoutDates: ((date: Date) => boolean) | null = null;\r\n\r\n /** A function used to determine whether a date is special. */\r\n @property({ attribute: false }) specialDates: ((date: Date) => boolean) | null = null;\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n const date = new Date(this.today);\r\n date.setDate(1);\r\n\r\n while (date.getDay() != 0) {\r\n date.setDate(date.getDate() + 1);\r\n }\r\n\r\n const weekdays = new Array<{ long: string; narrow: string; id: number }>();\r\n const narrowFormat = new Intl.DateTimeFormat(navigator.language, { weekday: \"narrow\" });\r\n const longFormat = new Intl.DateTimeFormat(navigator.language, { weekday: \"long\" });\r\n\r\n for (let i = 0; i < 7; i++) {\r\n weekdays.push({ id: i, narrow: narrowFormat.format(date), long: longFormat.format(date) });\r\n date.setDate(date.getDate() + 1);\r\n }\r\n\r\n const year = this.activeDate.getFullYear();\r\n const month = this.activeDate.getMonth();\r\n const firstDate = new Date(year, month, 1);\r\n const lastDate = new Date(year, month + 1, 0);\r\n const numDays = lastDate.getDate();\r\n\r\n let weeks: number[][] = [];\r\n let dayOfWeek = firstDate.getDay();\r\n\r\n for (let i = 1; i <= numDays; i++) {\r\n if (dayOfWeek === 0 || weeks.length === 0) {\r\n weeks.push([]);\r\n }\r\n weeks[weeks.length - 1].push(i);\r\n dayOfWeek = (dayOfWeek + 1) % 7;\r\n }\r\n\r\n weeks = weeks.filter((x) => !!x.length);\r\n\r\n return html`<table role=\"grid\">\r\n <thead>\r\n <tr>\r\n ${weekdays.map(\r\n (x) =>\r\n html`<th scope=\"col\">\r\n <span class=\"visually-hidden\">${x.long}</span>\r\n <div id=\"weekday-${x.id}-month-${month}\" aria-hidden=\"true\">${x.narrow}</div>\r\n <m3e-tooltip for=\"weekday-${x.id}-month-${month}\">${x.long}</m3e-tooltip>\r\n </th>`,\r\n )}\r\n </tr>\r\n </thead>\r\n <tbody>\r\n ${weeks.map(\r\n (row, i) =>\r\n html`<tr role=\"row\">\r\n ${i === 0 && row.length < 7 ? html`<td colspan=\"${7 - row.length}\"></td>` : nothing}\r\n ${row.map((y) => this.#renderItem(new Date(year, month, y)))}\r\n ${i > 0 && row.length < 7 ? html`<td colspan=\"${7 - row.length}\"></td>` : nothing}\r\n </tr>`,\r\n )}\r\n </tbody>\r\n </table>`;\r\n }\r\n\r\n /** @private */\r\n #renderItem(value: Date): unknown {\r\n const long = new Intl.DateTimeFormat(navigator.language, {\r\n year: \"numeric\",\r\n month: \"long\",\r\n day: \"numeric\",\r\n }).format(value);\r\n\r\n const special = this.specialDates?.(value) ?? false;\r\n const selected = sameDate(this.date, value);\r\n const active = sameDate(this.activeDate, value);\r\n const current = sameDate(this.today, value);\r\n const disabled =\r\n (this.minDate && compareDate(value, this.minDate) < 0) ||\r\n (this.maxDate && compareDate(value, this.maxDate) > 0) ||\r\n this.blackoutDates?.(value) === true;\r\n\r\n const id = `date-${value.getMonth()}-${value.getDate()}-${value.getFullYear()}`;\r\n\r\n let range = false,\r\n rangeStart = false,\r\n rangeEnd = false,\r\n rangeStartRange = false;\r\n\r\n if (this.rangeStart) {\r\n if (!this.rangeEnd) {\r\n rangeStart = sameDate(value, this.rangeStart);\r\n } else {\r\n range = compareDate(value, this.rangeStart) > 0 && compareDate(value, this.rangeEnd) < 0;\r\n if (!range) {\r\n rangeStart = compareDate(value, this.rangeStart) >= 0 && compareDate(value, this.rangeEnd) < 0;\r\n if (!rangeStart) {\r\n rangeEnd = compareDate(value, this.rangeStart) > 0 && compareDate(value, this.rangeEnd) <= 0;\r\n } else {\r\n rangeStartRange = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return html`<td\r\n role=\"gridcell\"\r\n class=\"${classMap({\r\n current,\r\n selected,\r\n active,\r\n special,\r\n range,\r\n \"range-start\": rangeStart,\r\n \"range-start-range\": rangeStartRange,\r\n \"range-end\": rangeEnd,\r\n })}\"\r\n >\r\n <div\r\n id=\"${id}\"\r\n role=\"button\"\r\n class=\"item\"\r\n data-value=\"${value.toISOString()}\"\r\n tabindex=\"${active ? \"0\" : \"-1\"}\"\r\n aria-disabled=\"${ifDefined(disabled || undefined)}\"\r\n aria-current=\"${ifDefined(current ? \"date\" : undefined)}\"\r\n aria-pressed=\"${selected || rangeStart || rangeEnd}\"\r\n @click=\"${this.#handleItemClick}\"\r\n @mouseenter=\"${this.#handleItemMouseEnter}\"\r\n @focus=\"${this.#handleItemFocus}\"\r\n @mouseleave=\"${this.#clearRangeHighlight}\"\r\n @blur=\"${this.#clearRangeHighlight}\"\r\n @keydown=\"${this.#handleItemKeyDown}\"\r\n >\r\n <m3e-focus-ring class=\"focus-ring\" for=\"${id}\"></m3e-focus-ring>\r\n <m3e-state-layer class=\"state-layer\" for=\"${id}\" ?disable-hover=\"${disabled}\"></m3e-state-layer>\r\n <m3e-ripple class=\"ripple\" centered for=\"${id}\" ?disabled=\"${disabled}\"></m3e-ripple>\r\n <div class=\"touch\"></div>\r\n <span class=\"visually-hidden\">${long}</span>\r\n <span aria-hidden=\"true\">${value.getDate()}</span>\r\n </div>\r\n </td>`;\r\n }\r\n\r\n /** @private */\r\n #handleItemClick(e: Event): void {\r\n const item = e.currentTarget as HTMLElement;\r\n if (item.ariaDisabled === \"true\" || !item.dataset[\"value\"]) return;\r\n\r\n this.activeDate = new Date(item.dataset[\"value\"]);\r\n this.activeDate = clampDate(this.activeDate, this.minDate, this.maxDate);\r\n\r\n if (this.rangeEnd) {\r\n this.rangeStart = this.activeDate;\r\n this.rangeEnd = null;\r\n this.#clearRangeHighlight();\r\n } else if (this.rangeStart) {\r\n if (compareDate(this.activeDate, this.rangeStart) < 0) {\r\n this.rangeStart = this.activeDate;\r\n this.rangeEnd = null;\r\n } else {\r\n this.rangeEnd = this.activeDate;\r\n }\r\n this.#clearRangeHighlight();\r\n }\r\n\r\n this.dispatchEvent(new Event(\"change\", { bubbles: false }));\r\n }\r\n\r\n /** @private */\r\n #handleItemKeyDown(e: KeyboardEvent): void {\r\n let activeDate = this.activeDate;\r\n\r\n switch (e.key) {\r\n case \" \":\r\n case \"Enter\":\r\n e.preventDefault();\r\n (e.currentTarget as HTMLElement).click();\r\n return;\r\n\r\n case \"ArrowLeft\":\r\n case \"Left\":\r\n activeDate = addCalendarDays(activeDate, M3eDirectionality.current === \"rtl\" ? 1 : -1);\r\n break;\r\n\r\n case \"ArrowRight\":\r\n case \"Right\":\r\n activeDate = addCalendarDays(activeDate, M3eDirectionality.current === \"rtl\" ? -1 : 1);\r\n break;\r\n\r\n case \"ArrowUp\":\r\n case \"Up\":\r\n activeDate = addCalendarDays(activeDate, -7);\r\n break;\r\n\r\n case \"ArrowDown\":\r\n case \"Down\":\r\n activeDate = addCalendarDays(activeDate, 7);\r\n break;\r\n\r\n case \"Home\":\r\n activeDate = addCalendarDays(activeDate, 1 - activeDate.getDate());\r\n break;\r\n\r\n case \"End\":\r\n activeDate = addCalendarDays(activeDate, getNumDaysInMonth(activeDate) - activeDate.getDate());\r\n break;\r\n\r\n case \"PageUp\":\r\n activeDate = e.altKey ? addCalendarYears(activeDate, -1) : addCalendarMonths(activeDate, -1);\r\n break;\r\n\r\n case \"PageDown\":\r\n activeDate = e.altKey ? addCalendarYears(activeDate, 1) : addCalendarMonths(activeDate, 1);\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n e.preventDefault();\r\n this._changeActiveDate(activeDate);\r\n }\r\n\r\n /** @private */\r\n #handleItemMouseEnter(e: Event): void {\r\n this.#setRangeHighlight(e.currentTarget as HTMLElement);\r\n }\r\n\r\n /** @private */\r\n #handleItemFocus(e: Event): void {\r\n if (!this._suppressFocusHighlight) {\r\n this.#setRangeHighlight(e.currentTarget as HTMLElement);\r\n }\r\n }\r\n\r\n /** @private */\r\n #setRangeHighlight(item: HTMLElement): void {\r\n this.#clearRangeHighlight();\r\n if (this.rangeStart && !this.rangeEnd && item.dataset[\"value\"]) {\r\n if (compareDate(new Date(item.dataset[\"value\"]), this.rangeStart) > 0) {\r\n item.parentElement!.classList.add(\"range-highlight-end\");\r\n }\r\n for (const cell of item.closest(\"table\")?.querySelectorAll<HTMLElement>(\".item\") ?? []) {\r\n if (cell === item) break;\r\n\r\n const value = new Date(cell.dataset[\"value\"]!);\r\n if (compareDate(value, this.rangeStart) > 0) {\r\n cell.parentElement!.classList.add(\"range-highlight\");\r\n } else if (compareDate(value, this.rangeStart) >= 0) {\r\n cell.parentElement!.classList.add(\"range-highlight-start\");\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** @private */\r\n #clearRangeHighlight(): void {\r\n if (this.rangeStart) {\r\n this.shadowRoot\r\n ?.querySelectorAll(\".range-highlight,.range-highlight-end,.range-highlight-start\")\r\n .forEach((x) => x.classList.remove(\"range-highlight\", \"range-highlight-end\", \"range-highlight-start\"));\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-month-view\": M3eMonthViewElement;\r\n }\r\n}\r\n","/**\r\n * Adapted from Angular Material Datepicker\r\n * Source: https://github.com/angular/components/blob/main/src/material/datepicker/multi-year-view.ts\r\n *\r\n * @license MIT\r\n * Copyright (c) 2025 Google LLC\r\n * See LICENSE file in the project root for full license text.\r\n */\r\n\r\nimport { css, CSSResultGroup, html } from \"lit\";\r\nimport { classMap } from \"lit/directives/class-map.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport { customElement, DesignToken } from \"@m3e/web/core\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\n\r\nimport { CalendarViewElementBase } from \"./CalendarViewElementBase\";\r\nimport { addCalendarYears, clampDate, getActiveOffset, minYearOfPage, YEARS_PER_PAGE, YEARS_PER_ROW } from \"./utils\";\r\n\r\n/**\r\n * An internal component used to display a year selector in a calendar.\r\n * @internal\r\n */\r\n@customElement(\"m3e-multi-year-view\")\r\nexport class M3eMultiYearViewElement extends CalendarViewElementBase {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = [\r\n CalendarViewElementBase.styles,\r\n css`\r\n .item {\r\n height: 2.25rem;\r\n }\r\n .touch {\r\n width: 100%;\r\n }\r\n th {\r\n height: 1rem;\r\n }\r\n td {\r\n padding-inline: 1rem;\r\n }\r\n tbody {\r\n font-size: var(--m3e-calendar-item-font-size, ${DesignToken.typescale.standard.body.medium.fontSize});\r\n font-weight: var(--m3e-calendar-item-font-weight, ${DesignToken.typescale.standard.body.medium.fontWeight});\r\n line-height: var(--m3e-calendar-item-line-height, ${DesignToken.typescale.standard.body.medium.lineHeight});\r\n letter-spacing: var(--m3e-calendar-item-tracking, ${DesignToken.typescale.standard.body.medium.tracking});\r\n }\r\n `,\r\n ];\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n const years = new Array<number[]>();\r\n const minYear = minYearOfPage(this.activeDate, this.minDate, this.maxDate);\r\n for (let i = 0, row: number[] = []; i < YEARS_PER_PAGE; i++) {\r\n row.push(minYear + i);\r\n if (row.length === YEARS_PER_ROW) {\r\n years.push(row);\r\n row = new Array<number>();\r\n }\r\n }\r\n\r\n return html`<table role=\"grid\">\r\n <thead aria-hidden=\"true\">\r\n <tr>\r\n <th colspan=\"${YEARS_PER_ROW}\"></th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n ${years.map(\r\n (row) =>\r\n html`<tr role=\"row\">\r\n ${row.map((year) => this.#renderItem(year))}\r\n </tr>`,\r\n )}\r\n </tbody>\r\n </table>`;\r\n }\r\n\r\n /** @private */\r\n #renderItem(year: number): unknown {\r\n const yearFormat = new Intl.DateTimeFormat(navigator.language, { year: \"numeric\" });\r\n const active = this.activeDate.getFullYear() === year;\r\n const selected = this.date?.getFullYear() === year;\r\n const current = this.today.getFullYear() === year;\r\n const disabled =\r\n (this.minDate && year < this.minDate.getFullYear()) || (this.maxDate && year > this.maxDate.getFullYear());\r\n\r\n const id = `year-${year}`;\r\n\r\n return html`<td role=\"gridcell\" class=\"${classMap({ current, selected, active })}\">\r\n <div\r\n id=\"${id}\"\r\n class=\"item\"\r\n role=\"button\"\r\n tabindex=\"${active ? \"0\" : \"-1\"}\"\r\n data-value=\"${year}\"\r\n aria-disabled=\"${ifDefined(disabled || undefined)}\"\r\n aria-current=\"${ifDefined(current ? \"date\" : undefined)}\"\r\n aria-pressed=\"${selected}\"\r\n @click=\"${this.#handleItemClick}\"\r\n @keydown=\"${this.#handleItemKeyDown}\"\r\n >\r\n <m3e-focus-ring class=\"focus-ring\" for=\"${id}\"></m3e-focus-ring>\r\n <m3e-state-layer class=\"state-layer\" for=\"${id}\" ?disable-hover=\"${disabled}\"></m3e-state-layer>\r\n <m3e-ripple class=\"ripple\" for=\"${id}\" centered ?disabled=\"${disabled}\"></m3e-ripple>\r\n <div class=\"touch\"></div>\r\n <span>${yearFormat.format(new Date(year, 0, 1))}</span>\r\n </div>\r\n </td>`;\r\n }\r\n\r\n /** @private */\r\n #handleItemClick(e: Event): void {\r\n const item = e.currentTarget as HTMLElement;\r\n if (item.ariaDisabled === \"true\" || !item.dataset[\"value\"]) return;\r\n\r\n this.activeDate = new Date(this.activeDate);\r\n this.activeDate.setFullYear(Number(item.dataset[\"value\"]));\r\n this.activeDate = clampDate(this.activeDate, this.minDate, this.maxDate);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: false }));\r\n }\r\n\r\n /** @private */\r\n #handleItemKeyDown(e: KeyboardEvent): void {\r\n let activeDate = this.activeDate;\r\n switch (e.key) {\r\n case \" \":\r\n case \"Enter\":\r\n e.preventDefault();\r\n (e.currentTarget as HTMLElement).click();\r\n return;\r\n\r\n case \"ArrowLeft\":\r\n case \"Left\":\r\n activeDate = addCalendarYears(activeDate, M3eDirectionality.current === \"rtl\" ? 1 : -1);\r\n break;\r\n\r\n case \"ArrowRight\":\r\n case \"Right\":\r\n activeDate = addCalendarYears(activeDate, M3eDirectionality.current === \"rtl\" ? -1 : 1);\r\n break;\r\n\r\n case \"ArrowUp\":\r\n case \"Up\":\r\n activeDate = addCalendarYears(activeDate, -YEARS_PER_ROW);\r\n break;\r\n\r\n case \"ArrowDown\":\r\n case \"Down\":\r\n activeDate = addCalendarYears(activeDate, YEARS_PER_ROW);\r\n break;\r\n\r\n case \"Home\":\r\n activeDate = addCalendarYears(activeDate, -getActiveOffset(activeDate, this.minDate, this.maxDate));\r\n break;\r\n\r\n case \"End\":\r\n activeDate = addCalendarYears(\r\n activeDate,\r\n YEARS_PER_PAGE - getActiveOffset(activeDate, this.minDate, this.maxDate) - 1,\r\n );\r\n break;\r\n\r\n case \"PageUp\":\r\n activeDate = addCalendarYears(activeDate, e.altKey ? -YEARS_PER_PAGE * 10 : -YEARS_PER_PAGE);\r\n break;\r\n\r\n case \"PageDown\":\r\n activeDate = addCalendarYears(activeDate, e.altKey ? YEARS_PER_PAGE * 10 : YEARS_PER_PAGE);\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n e.preventDefault();\r\n this._changeActiveDate(activeDate);\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-multi-year-view\": M3eMultiYearViewElement;\r\n }\r\n}\r\n","/**\r\n * Adapted from Angular Material Datepicker\r\n * Source: https://github.com/angular/components/blob/main/src/material/datepicker/year-view.ts\r\n *\r\n * @license MIT\r\n * Copyright (c) 2025 Google LLC\r\n * See LICENSE file in the project root for full license text.\r\n */\r\n\r\nimport { css, CSSResultGroup, html } from \"lit\";\r\nimport { classMap } from \"lit/directives/class-map.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport { customElement, DesignToken } from \"@m3e/web/core\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\n\r\nimport { CalendarViewElementBase } from \"./CalendarViewElementBase\";\r\nimport { addCalendarMonths, addCalendarYears, clampDate, MONTHS_PER_ROW } from \"./utils\";\r\n\r\n/**\r\n * An internal component used to display a single year in a calendar.\r\n * @internal\r\n */\r\n@customElement(\"m3e-year-view\")\r\nexport class M3eYearViewElement extends CalendarViewElementBase {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = [\r\n CalendarViewElementBase.styles,\r\n css`\r\n .item {\r\n height: 2.25rem;\r\n }\r\n .touch {\r\n width: 100%;\r\n }\r\n th {\r\n height: 1rem;\r\n }\r\n td {\r\n padding-inline: 0.375rem;\r\n }\r\n tbody {\r\n font-size: var(--m3e-calendar-item-font-size, ${DesignToken.typescale.standard.body.medium.fontSize});\r\n font-weight: var(--m3e-calendar-item-font-weight, ${DesignToken.typescale.standard.body.medium.fontWeight});\r\n line-height: var(--m3e-calendar-item-line-height, ${DesignToken.typescale.standard.body.medium.lineHeight});\r\n letter-spacing: var(--m3e-calendar-item-tracking, ${DesignToken.typescale.standard.body.medium.tracking});\r\n }\r\n `,\r\n ];\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n const months = new Array<Array<{ date: Date; long: string; narrow: string }>>();\r\n const shortFormat = new Intl.DateTimeFormat(navigator.language, { month: \"short\" });\r\n const longFormat = new Intl.DateTimeFormat(navigator.language, { month: \"long\" });\r\n const year = this.activeDate.getFullYear();\r\n\r\n for (let month = 0, row = new Array<{ date: Date; long: string; narrow: string }>(); month < 12; month++) {\r\n const date = new Date(year, month, 1);\r\n row.push({ narrow: shortFormat.format(date), long: longFormat.format(date), date: date });\r\n\r\n if (row.length == MONTHS_PER_ROW) {\r\n months.push(row);\r\n row = [];\r\n }\r\n }\r\n\r\n return html`<table role=\"grid\">\r\n <thead aria-hidden=\"true\">\r\n <tr>\r\n <th colspan=\"${MONTHS_PER_ROW}\"></th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n ${months.map(\r\n (row) =>\r\n html`<tr role=\"row\">\r\n ${row.map((month) => this.#renderItem(month))}\r\n </tr>`,\r\n )}\r\n </tbody>\r\n </table>`;\r\n }\r\n\r\n /** @private */\r\n #renderItem(month: { date: Date; long: string; narrow: string }): unknown {\r\n const active =\r\n this.activeDate.getFullYear() === month.date.getFullYear() &&\r\n this.activeDate.getMonth() === month.date.getMonth();\r\n\r\n const selected =\r\n this.date?.getFullYear() === month.date.getFullYear() && this.date?.getMonth() === month.date.getMonth();\r\n\r\n const current =\r\n this.today.getFullYear() === month.date.getFullYear() && this.today.getMonth() === month.date.getMonth();\r\n\r\n const disabled =\r\n (this.minDate &&\r\n (month.date.getFullYear() < this.minDate.getFullYear() ||\r\n (month.date.getFullYear() === this.minDate.getFullYear() &&\r\n month.date.getMonth() < this.minDate.getMonth()))) ||\r\n (this.maxDate &&\r\n (month.date.getFullYear() > this.maxDate.getFullYear() ||\r\n (month.date.getFullYear() === this.maxDate.getFullYear() &&\r\n month.date.getMonth() > this.maxDate.getMonth())));\r\n\r\n const id = `month-${month.date.getMonth()}`;\r\n\r\n return html`<td role=\"gridcell\" class=\"${classMap({ current, selected, active })}\">\r\n <div\r\n id=\"${id}\"\r\n class=\"item\"\r\n role=\"button\"\r\n tabindex=\"${active ? \"0\" : \"-1\"}\"\r\n data-value=\"${month.date.toISOString()}\"\r\n aria-disabled=\"${ifDefined(disabled || undefined)}\"\r\n aria-current=\"${ifDefined(current ? \"date\" : undefined)}\"\r\n aria-pressed=\"${selected}\"\r\n @click=\"${this.#handleItemClick}\"\r\n @keydown=\"${this.#handleItemKeyDown}\"\r\n >\r\n <m3e-focus-ring class=\"focus-ring\" for=\"${id}\"></m3e-focus-ring>\r\n <m3e-state-layer class=\"state-layer\" for=\"${id}\" ?disable-hover=\"${disabled}\"></m3e-state-layer>\r\n <m3e-ripple class=\"ripple\" centered for=\"${id}\" ?disabled=\"${disabled}\"></m3e-ripple>\r\n <div class=\"touch\"></div>\r\n <span class=\"visually-hidden\">${month.long}</span>\r\n <span aria-hidden=\"true\">${month.narrow}</span>\r\n </div>\r\n </td>`;\r\n }\r\n\r\n /** @private */\r\n #handleItemClick(e: Event): void {\r\n const item = e.currentTarget as HTMLElement;\r\n if (item.ariaDisabled === \"true\" || !item.dataset[\"value\"]) return;\r\n\r\n this.activeDate = clampDate(new Date(item.dataset[\"value\"]), this.minDate, this.maxDate);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: false }));\r\n }\r\n\r\n /** @private */\r\n #handleItemKeyDown(e: KeyboardEvent): void {\r\n let activeDate = this.activeDate;\r\n switch (e.key) {\r\n case \" \":\r\n case \"Enter\":\r\n e.preventDefault();\r\n (e.currentTarget as HTMLElement).click();\r\n return;\r\n\r\n case \"ArrowLeft\":\r\n case \"Left\":\r\n activeDate = addCalendarMonths(activeDate, M3eDirectionality.current === \"rtl\" ? 1 : -1);\r\n break;\r\n\r\n case \"ArrowRight\":\r\n case \"Right\":\r\n activeDate = addCalendarMonths(activeDate, M3eDirectionality.current === \"rtl\" ? -1 : 1);\r\n break;\r\n\r\n case \"ArrowUp\":\r\n case \"Up\":\r\n activeDate = addCalendarMonths(activeDate, -4);\r\n break;\r\n\r\n case \"ArrowDown\":\r\n case \"Down\":\r\n activeDate = addCalendarMonths(activeDate, 4);\r\n break;\r\n\r\n case \"Home\":\r\n activeDate = addCalendarMonths(activeDate, -activeDate.getMonth());\r\n break;\r\n\r\n case \"End\":\r\n activeDate = addCalendarMonths(activeDate, 11 - activeDate.getMonth());\r\n break;\r\n\r\n case \"PageUp\":\r\n activeDate = addCalendarYears(activeDate, e.altKey ? -10 : -1);\r\n break;\r\n\r\n case \"PageDown\":\r\n activeDate = addCalendarYears(activeDate, e.altKey ? 10 : 1);\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n e.preventDefault();\r\n this._changeActiveDate(activeDate);\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-year-view\": M3eYearViewElement;\r\n }\r\n}\r\n","/**\r\n * Adapted from Angular Material Datepicker\r\n * Source: https://github.com/angular/components/blob/main/src/material/datepicker/calendar.ts\r\n *\r\n * @license MIT\r\n * Copyright (c) 2025 Google LLC\r\n * See LICENSE file in the project root for full license text.\r\n */\r\n\r\nimport { css, CSSResultGroup, html, LitElement, PropertyValues, unsafeCSS } from \"lit\";\r\nimport { property, query, state } from \"lit/decorators.js\";\r\nimport { classMap } from \"lit/directives/class-map.js\";\r\nimport { ifDefined } from \"lit/directives/if-defined.js\";\r\n\r\nimport { customElement, dateConverter, DesignToken, prefersReducedMotion } from \"@m3e/web/core\";\r\nimport { M3eDirectionality } from \"@m3e/web/core/bidi\";\r\n\r\nimport \"@m3e/web/button\";\r\nimport \"@m3e/web/icon-button\";\r\nimport \"@m3e/web/tooltip\";\r\n\r\nimport { CalendarView } from \"./CalendarView\";\r\nimport { CalendarViewElementBase } from \"./CalendarViewElementBase\";\r\nimport { M3eMonthViewElement } from \"./MonthViewElement\";\r\nimport { maxYearOfPage, minYearOfPage } from \"./utils\";\r\n\r\nimport \"./MonthViewElement\";\r\nimport \"./MultiYearViewElement\";\r\nimport \"./YearViewElement\";\r\n\r\n/**\r\n * A calendar used to select a date.\r\n *\r\n * @description\r\n * The `m3e-calendar` component provides structured navigation and selection across\r\n * month, year, and multi‑year views. It supports single‑date and range selection,\r\n * applies disabled rules including minimum, maximum, and blackout constraints, and\r\n * provides styling hooks for special date states.\r\n *\r\n * @example\r\n * The following example illustrates use of the `m3e-calendar`. In this example, a calendar is displayed\r\n * with a selected date.\r\n *\r\n * ```html\r\n * <m3e-calendar date=\"2025-12-13\"></m3e-calendar>\r\n * ```\r\n *\r\n * @tag m3e-calendar\r\n *\r\n * @slot header - Renders the header of the calendar.\r\n *\r\n * @attr date - The selected date.\r\n * @attr max-date - The maximum date that can be selected.\r\n * @attr min-date - The minimum date that can be selected.\r\n * @attr range-end - End of a date range.\r\n * @attr range-start - Start of a date range.\r\n * @attr start-at - A date specifying the period (month or year) to start the calendar in.\r\n * @attr start-view - The initial view used to select a date.\r\n * @attr previous-month-label - The accessible label given to the button used to move to the previous month.\r\n * @attr next-month-label - The accessible label given to the button used to move to the next month.\r\n * @attr previous-year-label - The accessible label given to the button used to move to the previous year.\r\n * @attr next-year-label - The accessible label given to the button used to move to the next year.\r\n * @attr previous-multi-year-label - The accessible label given to the button used to move to the previous 24 years.\r\n * @attr next-multi-year-label - The accessible label given to the button used to move to the next 24 years.\r\n *\r\n * @fires change - Emitted when the selected date changes.\r\n *\r\n * @cssprop --m3e-calendar-container-color - Background color of the container surface.\r\n * @cssprop --m3e-calendar-container-elevation - Elevation shadow applied to the container surface.\r\n * @cssprop --m3e-calendar-container-shape - Corner radius of the container surface.\r\n * @cssprop --m3e-calendar-padding - Padding applied to the calendar header and body.\r\n * @cssprop --m3e-calendar-period-button-text-color - Text color used for the period‑navigation buttons in the header.\r\n * @cssprop --m3e-calendar-weekday-font-size - Font size of weekday labels in month view.\r\n * @cssprop --m3e-calendar-weekday-font-weight - Font weight of weekday labels in month view.\r\n * @cssprop --m3e-calendar-weekday-line-height - Line height of weekday labels in month view.\r\n * @cssprop --m3e-calendar-weekday-tracking - Letter spacing of weekday labels in month view.\r\n * @cssprop --m3e-calendar-weekday-color - Text color for weekday labels in month view.\r\n * @cssprop --m3e-calendar-date-font-size - Font size of date cells in month view.\r\n * @cssprop --m3e-calendar-date-font-weight - Font weight of date cells in month view.\r\n * @cssprop --m3e-calendar-date-line-height - Line height of date cells in month view.\r\n * @cssprop --m3e-calendar-date-tracking - Letter spacing of date cells in month view.\r\n * @cssprop --m3e-calendar-item-font-size - Font size of items in year and multi‑year views.\r\n * @cssprop --m3e-calendar-item-font-weight - Font weight of items in year and multi‑year views.\r\n * @cssprop --m3e-calendar-item-line-height - Line height of items in year and multi‑year views.\r\n * @cssprop --m3e-calendar-item-tracking - Letter spacing of items in year and multi‑year views.\r\n * @cssprop --m3e-calendar-item-color - Text color for date items.\r\n * @cssprop --m3e-calendar-item-selected-color - Text color for selected date items.\r\n * @cssprop --m3e-calendar-item-selected-container-color - Background color for selected date items.\r\n * @cssprop --m3e-calendar-item-selected-ripple-color - Ripple color used when interacting with selected date items.\r\n * @cssprop --m3e-calendar-item-selected-hover-color - Hover color used when interacting with selected date items.\r\n * @cssprop --m3e-calendar-item-selected-focus-color - Focus color used when interacting with selected date items.\r\n * @cssprop --m3e-calendar-item-current-outline-thickness - Outline thickness used to indicate the current date.\r\n * @cssprop --m3e-calendar-item-current-outline-color - Outline color used to indicate the current date.\r\n * @cssprop --m3e-calendar-item-special-color - Text color for dates marked as special.\r\n * @cssprop --m3e-calendar-item-special-container-color - Background color for dates marked as special.\r\n * @cssprop --m3e-calendar-item-special-ripple-color - Ripple color used when interacting with dates marked as special.\r\n * @cssprop --m3e-calendar-item-special-hover-color - Hover color used when interacting with dates marked as special.\r\n * @cssprop --m3e-calendar-item-special-focus-color - Focus color used when interacting with dates marked as special.\r\n * @cssprop --m3e-calendar-range-container-color - Background color applied to the selected date range.\r\n * @cssprop --m3e-calendar-range-color - Text color for dates within a selected range.\r\n * @cssprop --m3e-calendar-item-disabled-color - Color used for disabled date items.\r\n * @cssprop --m3e-calendar-item-disabled-color-opacity - Opacity applied to the disabled item color.\r\n * @cssprop --m3e-calendar-slide-animation-duration - Duration of slide transitions between calendar views.\r\n */\r\n@customElement(\"m3e-calendar\")\r\nexport class M3eCalendarElement extends LitElement {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: inline-block;\r\n vertical-align: top;\r\n width: fit-content;\r\n height: fit-content;\r\n }\r\n .base {\r\n display: flex;\r\n flex-direction: column;\r\n width: fit-content;\r\n overflow: hidden;\r\n padding: var(--m3e-calendar-padding, 0.5rem);\r\n background-color: var(--m3e-calendar-container-color);\r\n box-shadow: var(--m3e-calendar-container-elevation);\r\n border-radius: var(--m3e-calendar-container-shape);\r\n }\r\n .header {\r\n display: flex;\r\n align-items: center;\r\n --m3e-text-button-label-text-color: var(\r\n --m3e-calendar-period-button-text-color,\r\n ${DesignToken.color.onSurfaceVariant}\r\n );\r\n --m3e-text-button-hover-label-text-color: var(\r\n --m3e-calendar-period-button-text-color,\r\n ${DesignToken.color.onSurfaceVariant}\r\n );\r\n --m3e-text-button-focus-label-text-color: var(\r\n --m3e-calendar-period-button-text-color,\r\n ${DesignToken.color.onSurfaceVariant}\r\n );\r\n --m3e-text-button-pressed-label-text-color: var(\r\n --m3e-calendar-period-button-text-color,\r\n ${DesignToken.color.onSurfaceVariant}\r\n );\r\n }\r\n .spacer {\r\n flex: 1 1 auto;\r\n }\r\n svg {\r\n transition: transform ${DesignToken.motion.spring.fastEffects};\r\n }\r\n svg.rotate {\r\n transform: rotate(-180deg);\r\n }\r\n .body {\r\n position: relative;\r\n }\r\n .view:not(.no-animate) {\r\n transition: ${unsafeCSS(\r\n `margin var(--m3e-calendar-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard},\r\n visibility var(--m3e-calendar-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .view.before,\r\n .view.after {\r\n visibility: hidden;\r\n position: absolute;\r\n }\r\n .view.before {\r\n margin-inline-start: -100%;\r\n }\r\n .view.after {\r\n margin-inline-start: 100%;\r\n }\r\n .view:not(.before):not(.after) {\r\n visibility: visible;\r\n position: relative;\r\n left: 0;\r\n margin-inline-start: 0;\r\n }\r\n .row {\r\n opacity: 1;\r\n transform: translateY(0);\r\n }\r\n .row.multi-year {\r\n transition: ${unsafeCSS(\r\n `transform var(--m3e-calendar-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard} allow-discrete,\r\n opacity var(--m3e-calendar-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .row:not(.multi-year) {\r\n transition: ${unsafeCSS(\r\n `opacity var(--m3e-calendar-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard} allow-discrete`,\r\n )};\r\n }\r\n .body.month > .row:not(.month),\r\n .body.year > .row:not(.year),\r\n .body.multi-year > .row:not(.multi-year) {\r\n visibility: hidden;\r\n position: absolute;\r\n transform: translateY(-10%);\r\n opacity: 0;\r\n }\r\n .body.month > .row:not(.month) .view:not(.before):not(.after),\r\n .body.year > .row:not(.year) .view:not(.before):not(.after),\r\n .body.multi-year > .row:not(.multi-year) .view:not(.before):not(.after) {\r\n visibility: hidden;\r\n transition: none;\r\n }\r\n\r\n @media (prefers-reduced-motion) {\r\n .row:not(.multi-year),\r\n .row.multi-year,\r\n .view:not(.no-animate),\r\n svg {\r\n transition: none;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ #transitionComplete?: Promise<void>;\r\n /** @private */ @state() private _today = new Date();\r\n /** @private */ @state() private _activeView: CalendarView = \"month\";\r\n /** @private */ @state() private _activeDate: Date = new Date();\r\n /** @private */ @query(\".active\") private readonly _view?: CalendarViewElementBase;\r\n /** @private */ @query(\".body\") private readonly _body!: HTMLElement;\r\n\r\n /**\r\n * The initial view used to select a date.\r\n * @default \"month\"\r\n */\r\n @property({ attribute: \"start-view\" }) startView: CalendarView = \"month\";\r\n\r\n /**\r\n * The selected date.\r\n * @default null\r\n */\r\n @property({ converter: dateConverter }) date: Date | null = null;\r\n\r\n /**\r\n * A date specifying the period (month or year) to start the calendar in.\r\n * @default null\r\n */\r\n @property({ attribute: \"start-at\", converter: dateConverter }) startAt: Date | null = null;\r\n\r\n /**\r\n * The minimum date that can be selected.\r\n * @default null\r\n */\r\n @property({ attribute: \"min-date\", converter: dateConverter }) minDate: Date | null = null;\r\n\r\n /**\r\n * The maximum date that can be selected.\r\n * @default null\r\n */\r\n @property({ attribute: \"max-date\", converter: dateConverter }) maxDate: Date | null = null;\r\n\r\n /**\r\n * Start of a date range.\r\n * @default null\r\n */\r\n @property({ attribute: \"range-start\", converter: dateConverter }) rangeStart: Date | null = null;\r\n\r\n /**\r\n * End of a date range.\r\n * @default null\r\n */\r\n @property({ attribute: \"range-end\", converter: dateConverter }) rangeEnd: Date | null = null;\r\n\r\n /**\r\n * A function used to determine whether a date cannot be selected.\r\n * @default null\r\n */\r\n @property({ attribute: false }) blackoutDates: ((date: Date) => boolean) | null = null;\r\n\r\n /**\r\n * A function used to determine whether a date is special.\r\n * @default null\r\n */\r\n @property({ attribute: false }) specialDates: ((date: Date) => boolean) | null = null;\r\n\r\n /**\r\n * The accessible label given to the button used to move to the previous month.\r\n * @default \"Previous month\"\r\n */\r\n @property({ attribute: \"previous-month-label\" }) previousMonthLabel = \"Previous month\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the previous year.\r\n * @default \"Previous year\"\r\n */\r\n @property({ attribute: \"previous-year-label\" }) previousYearLabel = \"Previous year\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the previous 24 years.\r\n * @default \"Previous 24 years\"\r\n */\r\n @property({ attribute: \"previous-multi-year-label\" }) previousMultiYearLabel = \"Previous 24 years\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the next month.\r\n * @default \"Next month\"\r\n */\r\n @property({ attribute: \"next-month-label\" }) nextMonthLabel = \"Next month\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the next year.\r\n * @default \"Next year\"\r\n */\r\n @property({ attribute: \"next-year-label\" }) nextYearLabel = \"Next year\";\r\n\r\n /**\r\n * The accessible label given to the button used to move to the next 24 years.\r\n * @default \"Next 24 years\"\r\n */\r\n @property({ attribute: \"next-multi-year-label\" }) nextMultiYearLabel = \"Next 24 years\";\r\n\r\n /** The label to present for the current period. */\r\n get periodLabel(): string {\r\n switch (this._activeView) {\r\n case \"month\":\r\n return new Intl.DateTimeFormat(navigator.language, { month: \"short\", year: \"numeric\" }).format(\r\n this._activeDate,\r\n );\r\n\r\n case \"year\":\r\n return new Intl.DateTimeFormat(navigator.language, { year: \"numeric\" }).format(\r\n new Date(this._activeDate.getFullYear(), 0, 1),\r\n );\r\n\r\n case \"multi-year\":\r\n return new Intl.DateTimeFormat(navigator.language, { year: \"numeric\" }).formatRange(\r\n new Date(minYearOfPage(this._activeDate, this.minDate, this.maxDate), 0, 1),\r\n new Date(maxYearOfPage(this._activeDate, this.minDate, this.maxDate), 0, 1),\r\n );\r\n }\r\n }\r\n\r\n /** Whether the calendar can move to the previous period. */\r\n get canMovePreviousPeriod(): boolean {\r\n if (!this.minDate) return true;\r\n switch (this._activeView) {\r\n case \"month\":\r\n return new Date(this._activeDate.getFullYear(), this._activeDate.getMonth(), 0) >= this.minDate;\r\n\r\n case \"year\":\r\n return new Date(this._activeDate.getFullYear() - 1, 12, 1) >= this.minDate;\r\n\r\n case \"multi-year\":\r\n return new Date(minYearOfPage(this._activeDate, this.minDate, this.maxDate) - 1, 12, 1) >= this.minDate;\r\n }\r\n }\r\n\r\n /** Whether the calendar can move to the next period. */\r\n get canMoveNextPeriod(): boolean {\r\n if (!this.maxDate) return true;\r\n switch (this._activeView) {\r\n case \"month\":\r\n return new Date(this._activeDate.getFullYear(), this._activeDate.getMonth() + 1, 1) <= this.maxDate;\r\n\r\n case \"year\":\r\n return new Date(this._activeDate.getFullYear() + 1, 1, 1) <= this.maxDate;\r\n\r\n case \"multi-year\":\r\n return new Date(maxYearOfPage(this._activeDate, this.minDate, this.maxDate) + 1, 12, 1) <= this.maxDate;\r\n }\r\n }\r\n\r\n /**\r\n * Asynchronously focuses the active date.\r\n * @returns {Promise<void>} A promise that resolves after the active date has been focused.\r\n */\r\n async focusActiveCell(): Promise<void> {\r\n if (this.isUpdatePending) {\r\n await this.updateComplete;\r\n }\r\n await this._view?.focusActiveCell();\r\n }\r\n\r\n /** Updates today's date. */\r\n updateTodayDate(): void {\r\n this._today = new Date();\r\n }\r\n\r\n /**\r\n * Moves the calendar to the previous period.\r\n * @returns {Promise<void>} A promise that resolves when the operation is complete.\r\n */\r\n async movePreviousPeriod(): Promise<void> {\r\n if (!this.canMovePreviousPeriod) return;\r\n if (prefersReducedMotion()) {\r\n this._activeDate = this.#getPreviousPeriod(this._activeView);\r\n return;\r\n }\r\n\r\n await this.#transitionComplete;\r\n\r\n const views = [...(this.shadowRoot?.querySelectorAll<HTMLElement>(`.row.${this._activeView} .view`) ?? [])];\r\n if (views.length != 3) return;\r\n\r\n this.#transitionComplete = new Promise<void>((resolve) => {\r\n views[0].addEventListener(\r\n \"transitionend\",\r\n () => {\r\n this._activeDate = this.#getPreviousPeriod(this._activeView);\r\n views.forEach((x) => x.classList.add(\"no-animate\"));\r\n views[1].classList.remove(\"after\");\r\n views[0].classList.add(\"before\");\r\n setTimeout(() => {\r\n views.forEach((x) => x.classList.remove(\"no-animate\"));\r\n resolve();\r\n });\r\n },\r\n { once: true },\r\n );\r\n });\r\n\r\n this._body.style.overflow = \"hidden\";\r\n views[1].classList.add(\"after\");\r\n views[0].classList.remove(\"before\");\r\n\r\n await this.#transitionComplete;\r\n this._body.style.overflow = \"\";\r\n }\r\n\r\n /**\r\n * Moves the calendar to the next period.\r\n * @returns {Promise<void>} A promise that resolves when the operation is complete.\r\n */\r\n async moveNextPeriod(): Promise<void> {\r\n if (!this.canMoveNextPeriod) return;\r\n if (prefersReducedMotion()) {\r\n this._activeDate = this.#getNextPeriod(this._activeView);\r\n return;\r\n }\r\n\r\n await this.#transitionComplete;\r\n\r\n const views = [...(this.shadowRoot?.querySelectorAll<HTMLElement>(`.row.${this._activeView} .view`) ?? [])];\r\n if (views.length != 3) return;\r\n\r\n this.#transitionComplete = new Promise<void>((resolve) => {\r\n views[2].addEventListener(\r\n \"transitionend\",\r\n () => {\r\n this._activeDate = this.#getNextPeriod(this._activeView);\r\n views.forEach((x) => x.classList.add(\"no-animate\"));\r\n views[1].classList.remove(\"before\");\r\n views[2].classList.add(\"after\");\r\n setTimeout(() => {\r\n views.forEach((x) => x.classList.remove(\"no-animate\"));\r\n resolve();\r\n });\r\n },\r\n { once: true },\r\n );\r\n });\r\n\r\n this._body.style.overflow = \"hidden\";\r\n views[1].classList.add(\"before\");\r\n views[2].classList.remove(\"after\");\r\n\r\n await this.#transitionComplete;\r\n this._body.style.overflow = \"\";\r\n }\r\n\r\n /**\r\n * Toggles the current period.\r\n * @returns {Promise<void>} A promise that resolves when the operation is complete.\r\n */\r\n async togglePeriod(): Promise<void> {\r\n await this.#transitionComplete;\r\n this._activeView = this._activeView === \"month\" ? \"multi-year\" : \"month\";\r\n await this.focusActiveCell();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override willUpdate(changedProperties: PropertyValues<this>): void {\r\n super.willUpdate(changedProperties);\r\n\r\n if (changedProperties.has(\"date\")) {\r\n this._activeDate = new Date(this.date ?? this._today);\r\n }\r\n if (changedProperties.has(\"startAt\")) {\r\n this._activeDate = new Date(this.startAt ?? this.date ?? this._today);\r\n }\r\n if (changedProperties.has(\"rangeStart\") && this.rangeStart) {\r\n this._activeDate = new Date(this.rangeStart);\r\n if (!changedProperties.has(\"date\")) {\r\n this.date = new Date(this.rangeStart);\r\n }\r\n }\r\n if (changedProperties.has(\"rangeEnd\") && this.rangeEnd) {\r\n this._activeDate = new Date(this.rangeEnd);\r\n if (!changedProperties.has(\"date\")) {\r\n this.date = new Date(this.rangeEnd);\r\n }\r\n }\r\n if (changedProperties.has(\"startView\")) {\r\n this._activeView = this.startView;\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override updated(_changedProperties: PropertyValues<this>): void {\r\n super.updated(_changedProperties);\r\n\r\n if (this._view instanceof M3eMonthViewElement) {\r\n if (_changedProperties.has(\"specialDates\") || _changedProperties.has(\"blackoutDates\")) {\r\n this.shadowRoot?.querySelectorAll(\"m3e-month-view\").forEach((x) => {\r\n x.specialDates = this.specialDates;\r\n x.blackoutDates = this.blackoutDates;\r\n });\r\n }\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<div class=\"base\">\r\n <slot name=\"header\">${this.#renderHeader()}</slot>\r\n <div class=\"body ${this._activeView}\">\r\n <div class=\"row multi-year\">\r\n ${this.#renderView(\"multi-year\", -1)}${this.#renderView(\"multi-year\", 0)}${this.#renderView(\"multi-year\", 1)}\r\n </div>\r\n <div class=\"row year\">\r\n ${this.#renderView(\"year\", -1)}${this.#renderView(\"year\", 0)}${this.#renderView(\"year\", 1)}\r\n </div>\r\n <div class=\"row month\">\r\n ${this.#renderView(\"month\", -1)}${this.#renderView(\"month\", 0)}${this.#renderView(\"month\", 1)}\r\n </div>\r\n </div>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n #renderHeader(): unknown {\r\n return html`<div class=\"header\">\r\n <m3e-button @click=\"${this.togglePeriod}\">\r\n ${this.periodLabel}\r\n <svg\r\n class=\"${classMap({ rotate: this._activeView !== \"month\" })}\"\r\n slot=\"trailing-icon\"\r\n viewBox=\"0 -960 960 960\"\r\n fill=\"currentColor\"\r\n >\r\n <path d=\"M480-360 280-560h400L480-360Z\" />\r\n </svg>\r\n </m3e-button>\r\n <div class=\"spacer\"></div>\r\n <m3e-icon-button\r\n ?disabled=\"${!this.canMovePreviousPeriod}\"\r\n @click=\"${this.movePreviousPeriod}\"\r\n aria-label=\"${this._activeView === \"month\"\r\n ? this.previousMonthLabel\r\n : this._activeView === \"year\"\r\n ? this.previousYearLabel\r\n : this.previousMultiYearLabel}\"\r\n >\r\n ${M3eDirectionality.current === \"ltr\"\r\n ? html`<svg viewBox=\"0 -960 960 960\" fill=\"currentColor\">\r\n <path d=\"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z\" />\r\n </svg>`\r\n : html`<svg viewBox=\"0 -960 960 960\" fill=\"currentColor\">\r\n <path d=\"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z\" />\r\n </svg>`}\r\n </m3e-icon-button>\r\n <m3e-icon-button\r\n ?disabled=\"${!this.canMoveNextPeriod}\"\r\n @click=\"${this.moveNextPeriod}\"\r\n aria-label=\"${this._activeView === \"month\"\r\n ? this.nextMonthLabel\r\n : this._activeView === \"year\"\r\n ? this.nextYearLabel\r\n : this.nextMultiYearLabel}\"\r\n >\r\n ${M3eDirectionality.current === \"ltr\"\r\n ? html`<svg viewBox=\"0 -960 960 960\" fill=\"currentColor\">\r\n <path d=\"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z\" />\r\n </svg>`\r\n : html`<svg viewBox=\"0 -960 960 960\" fill=\"currentColor\">\r\n <path d=\"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z\" />\r\n </svg>`}\r\n </m3e-icon-button>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n #renderView(view: CalendarView, offset: -1 | 0 | 1): unknown {\r\n const activeDate =\r\n offset < 0 ? this.#getPreviousPeriod(view) : offset > 0 ? this.#getNextPeriod(view) : new Date(this._activeDate);\r\n\r\n switch (view) {\r\n case \"month\":\r\n return html`<m3e-month-view\r\n class=\"view ${classMap({\r\n before: offset < 0,\r\n after: offset > 0,\r\n active: view === this._activeView && offset === 0,\r\n })}\"\r\n ?inert=\"${offset !== 0}\"\r\n today=\"${this._today.toISOString()}\"\r\n date=\"${ifDefined(this.date?.toISOString())}\"\r\n active-date=\"${activeDate.toISOString()}\"\r\n min-date=\"${ifDefined(this.minDate?.toISOString())}\"\r\n max-date=\"${ifDefined(this.maxDate?.toISOString())}\"\r\n range-start=\"${ifDefined(this.rangeStart?.toISOString())}\"\r\n range-end=\"${ifDefined(this.rangeEnd?.toISOString())}\"\r\n @active-change=\"${offset === 0 ? this.#handleActiveChange : undefined}\"\r\n @change=\"${offset === 0 ? this.#handleDateChange : undefined}\"\r\n >\r\n </m3e-month-view>`;\r\n\r\n case \"year\":\r\n return html`<m3e-year-view\r\n class=\"view ${classMap({\r\n before: offset < 0,\r\n after: offset > 0,\r\n active: view === this._activeView && offset === 0,\r\n })}\"\r\n ?inert=\"${offset !== 0}\"\r\n today=\"${this._today.toISOString()}\"\r\n date=\"${ifDefined(this.date?.toISOString())}\"\r\n active-date=\"${activeDate.toISOString()}\"\r\n min-date=\"${ifDefined(this.minDate?.toISOString())}\"\r\n max-date=\"${ifDefined(this.maxDate?.toISOString())}\"\r\n @active-change=\"${offset === 0 ? this.#handleActiveChange : undefined}\"\r\n @change=\"${offset === 0 ? this.#handleMonthChange : undefined}\"\r\n ></m3e-year-view>`;\r\n\r\n case \"multi-year\":\r\n return html`<m3e-multi-year-view\r\n class=\"view ${classMap({\r\n before: offset < 0,\r\n after: offset > 0,\r\n active: view === this._activeView && offset === 0,\r\n })}\"\r\n ?inert=\"${offset !== 0}\"\r\n today=\"${this._today.toISOString()}\"\r\n date=\"${ifDefined(this.date?.toISOString())}\"\r\n active-date=\"${activeDate.toISOString()}\"\r\n min-date=\"${ifDefined(this.minDate?.toISOString())}\"\r\n max-date=\"${ifDefined(this.maxDate?.toISOString())}\"\r\n @active-change=\"${offset === 0 ? this.#handleActiveChange : undefined}\"\r\n @change=\"${offset === 0 ? this.#handleYearChange : undefined}\"\r\n >\r\n </m3e-multi-year-view>`;\r\n }\r\n }\r\n\r\n /** @private */\r\n #handleDateChange(e: Event): void {\r\n const monthView = e.currentTarget as M3eMonthViewElement;\r\n this._activeDate = new Date(monthView.activeDate);\r\n this.rangeStart = monthView.rangeStart;\r\n this.rangeEnd = monthView.rangeEnd;\r\n this.date = new Date(this._activeDate);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n\r\n /** @private */\r\n async #handleMonthChange(e: Event): Promise<void> {\r\n this._activeDate = new Date((e.currentTarget as CalendarViewElementBase).activeDate);\r\n this._activeView = \"month\";\r\n this.focusActiveCell();\r\n }\r\n\r\n /** @private */\r\n #handleYearChange(e: Event): void {\r\n this._activeDate = new Date((e.currentTarget as CalendarViewElementBase).activeDate);\r\n this._activeView = \"year\";\r\n this.focusActiveCell();\r\n }\r\n\r\n /** @private */\r\n async #handleActiveChange(e: Event): Promise<void> {\r\n if (this._view instanceof M3eMonthViewElement) {\r\n this._view._suppressFocusHighlight = false;\r\n }\r\n\r\n this._activeDate = new Date((e.currentTarget as CalendarViewElementBase).activeDate);\r\n await this.focusActiveCell();\r\n\r\n if (this._view instanceof M3eMonthViewElement) {\r\n this._view._suppressFocusHighlight = false;\r\n }\r\n }\r\n\r\n /** @private */\r\n #getPreviousPeriod(view: CalendarView): Date {\r\n const activeDate = new Date(this._activeDate);\r\n switch (view) {\r\n case \"month\":\r\n activeDate.setMonth(this._activeDate.getMonth() - 1);\r\n while (activeDate.getMonth() === this._activeDate.getMonth()) {\r\n activeDate.setDate(activeDate.getDate() - 1);\r\n }\r\n\r\n break;\r\n\r\n case \"year\":\r\n activeDate.setFullYear(this._activeDate.getFullYear() - 1);\r\n break;\r\n\r\n case \"multi-year\": {\r\n activeDate.setDate(1);\r\n activeDate.setFullYear(minYearOfPage(this._activeDate, this.minDate, this.maxDate) - 1);\r\n }\r\n }\r\n return activeDate;\r\n }\r\n\r\n /** @private */\r\n #getNextPeriod(view: CalendarView): Date {\r\n const activeDate = new Date(this._activeDate);\r\n switch (view) {\r\n case \"month\":\r\n activeDate.setMonth(this._activeDate.getMonth() + 1);\r\n while (activeDate.getMonth() === this._activeDate.getMonth()) {\r\n activeDate.setDate(activeDate.getDate() + 1);\r\n }\r\n break;\r\n\r\n case \"year\":\r\n activeDate.setFullYear(this._activeDate.getFullYear() + 1);\r\n break;\r\n\r\n case \"multi-year\":\r\n activeDate.setDate(1);\r\n activeDate.setFullYear(maxYearOfPage(this._activeDate, this.minDate, this.maxDate) + 1);\r\n break;\r\n }\r\n return activeDate;\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-calendar\": M3eCalendarElement;\r\n }\r\n}\r\n"],"names":["createDateWithOverflow","year","month","day","date","Date","setFullYear","setHours","addCalendarDays","days","getFullYear","getMonth","getDate","addCalendarMonths","months","newDate","addCalendarYears","years","compareDate","first","second","sameDate","getActiveOffset","activeDate","minDate","maxDate","a","YEARS_PER_PAGE","getStartingYear","b","minYearOfPage","maxYearOfPage","clampDate","CalendarViewElementBase","LitElement","constructor","this","today","focusActiveCell","isUpdatePending","updateComplete","_activeItem","focusWhenReady","_changeActiveDate","style","setProperty","blur","removeProperty","dispatchEvent","Event","bubbles","styles","css","DesignToken","color","onSurface","shape","corner","full","onPrimary","primary","__decorate","query","prototype","property","converter","dateConverter","attribute","M3eMonthViewElement","_suppressFocusHighlight","rangeStart","rangeEnd","blackoutDates","specialDates","render","setDate","getDay","weekdays","Array","narrowFormat","Intl","DateTimeFormat","navigator","language","weekday","longFormat","i","push","id","narrow","format","long","firstDate","numDays","weeks","dayOfWeek","length","filter","x","html","map","row","nothing","y","__classPrivateFieldGet","_M3eMonthViewElement_instances","_M3eMonthViewElement_renderItem","call","value","special","selected","active","current","disabled","range","rangeStartRange","classMap","toISOString","ifDefined","undefined","_M3eMonthViewElement_handleItemClick","_M3eMonthViewElement_handleItemMouseEnter","_M3eMonthViewElement_handleItemFocus","_M3eMonthViewElement_clearRangeHighlight","_M3eMonthViewElement_handleItemKeyDown","e","item","currentTarget","ariaDisabled","dataset","key","preventDefault","click","M3eDirectionality","altKey","parentElement","classList","add","cell","closest","querySelectorAll","shadowRoot","forEach","remove","typescale","standard","title","small","fontSize","fontWeight","lineHeight","tracking","body","medium","onTertiaryContainer","tertiaryContainer","primaryContainer","onPrimaryContainer","customElement","M3eMultiYearViewElement","minYear","yearFormat","_M3eMultiYearViewElement_instances","_M3eMultiYearViewElement_handleItemClick","_M3eMultiYearViewElement_handleItemKeyDown","Number","M3eYearViewElement","shortFormat","_M3eYearViewElement_instances","_M3eYearViewElement_handleItemClick","_M3eYearViewElement_handleItemKeyDown","M3eCalendarElement","_M3eCalendarElement_transitionComplete","set","_today","_activeView","_activeDate","startView","startAt","previousMonthLabel","previousYearLabel","previousMultiYearLabel","nextMonthLabel","nextYearLabel","nextMultiYearLabel","periodLabel","formatRange","canMovePreviousPeriod","canMoveNextPeriod","_view","updateTodayDate","movePreviousPeriod","prefersReducedMotion","_M3eCalendarElement_instances","_M3eCalendarElement_getPreviousPeriod","views","__classPrivateFieldSet","Promise","resolve","addEventListener","setTimeout","once","_body","overflow","moveNextPeriod","_M3eCalendarElement_getNextPeriod","togglePeriod","willUpdate","changedProperties","super","has","updated","_changedProperties","_M3eCalendarElement_renderHeader","_M3eCalendarElement_renderView","rotate","view","offset","before","after","_M3eCalendarElement_handleActiveChange","_M3eCalendarElement_handleDateChange","_M3eCalendarElement_handleMonthChange","_M3eCalendarElement_handleYearChange","monthView","async","setMonth","onSurfaceVariant","motion","spring","fastEffects","unsafeCSS","duration","long2","easing","state"],"mappings":";;;;;mmBACA,SAASA,EAAuBC,EAAcC,EAAeC,GAC3D,MAAMC,EAAO,IAAIC,KAGjB,OAFAD,EAAKE,YAAYL,EAAMC,EAAOC,GAC9BC,EAAKG,SAAS,EAAG,EAAG,EAAG,GAChBH,CACT,CAkBM,SAAUI,EAAgBJ,EAAYK,GAC1C,OAAOT,EAAuBI,EAAKM,cAAeN,EAAKO,WAAYP,EAAKQ,UAAYH,EACtF,CAGM,SAAUI,EAAkBT,EAAYU,GAC5C,IAAIC,EAAUf,EAAuBI,EAAKM,cAAeN,EAAKO,WAAaG,EAAQV,EAAKQ,WAIxF,OAHIG,EAAQJ,cAAiBP,EAAKO,WAAaG,GAAU,GAAM,IAAM,KACnEC,EAAUf,EAAuBe,EAAQL,cAAeK,EAAQJ,WAAY,IAEvEI,CACT,CAGM,SAAUC,EAAiBZ,EAAYa,GAC3C,OAAOJ,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,qBAAA,GAMvDF,EAAA,CAA/BG,EAAS,CAAEG,WAAW,KAA+DwG,GAAA5G,UAAA,oBAAA,GAMrCF,EAAA,CAAhDG,EAAS,CAAEG,UAAW,0BAAgEwG,GAAA5G,UAAA,0BAAA,GAMvCF,EAAA,CAA/CG,EAAS,CAAEG,UAAW,yBAA6DwG,GAAA5G,UAAA,yBAAA,GAM9BF,EAAA,CAArDG,EAAS,CAAEG,UAAW,+BAA4EwG,GAAA5G,UAAA,8BAAA,GAMtDF,EAAA,CAA5CG,EAAS,CAAEG,UAAW,sBAAoDwG,GAAA5G,UAAA,sBAAA,GAM/BF,EAAA,CAA3CG,EAAS,CAAEG,UAAW,qBAAiDwG,GAAA5G,UAAA,qBAAA,GAMtBF,EAAA,CAAjDG,EAAS,CAAEG,UAAW,2BAAgEwG,GAAA5G,UAAA,0BAAA,GAjN5E4G,GAAkB9G,EAAA,CAD9BiG,EAAc,iBACFa"}
package/dist/core.js CHANGED
@@ -4711,6 +4711,8 @@ var _M3eSlideElement_instances, _M3eSlideElement_items, _M3eSlideElement_handleS
4711
4711
  *
4712
4712
  * @tag m3e-slide
4713
4713
  *
4714
+ * @slot - Renders the items through which to cycle.
4715
+ *
4714
4716
  * @attr selected-index - The zero-based index of the visible item.
4715
4717
  *
4716
4718
  * @cssprop --m3e-slide-animation-duration - The duration of transitions between slotted items.