diff --git a/package/build/vanilla-calendar.min.css b/package/build/vanilla-calendar.min.css
index 281cb6ef..1e3e5634 100644
--- a/package/build/vanilla-calendar.min.css
+++ b/package/build/vanilla-calendar.min.css
@@ -1,2 +1,2 @@
/*! name: @uvarov.frontend/vanilla-calendar | url: https://github.com/uvarov-frontend/vanilla-calendar */
-.vanilla-calendar{position:relative;display:flex;height:-webkit-max-content;height:max-content;width:-webkit-max-content;width:max-content;min-width:275px;max-width:100%;flex-direction:column;border-radius:.75rem;padding:1rem;opacity:1;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.vanilla-calendar_multiple{width:550px}.vanilla-calendar button:focus-visible{border-radius:.5rem;outline-style:solid;outline-width:1px}.vanilla-calendar.vanilla-calendar_multiple .vanilla-calendar-days{flex-grow:0}.vanilla-calendar_hidden{pointer-events:none;opacity:0}.vanilla-calendar_to-input{position:absolute;left:0;bottom:0;margin-top:.25rem}.vanilla-calendar-controls{pointer-events:none;position:absolute;left:0;right:0;top:0;z-index:20;box-sizing:content-box;display:flex;align-items:center;justify-content:space-between;padding-left:1rem;padding-right:1rem;padding-top:1.25rem}.vanilla-calendar-arrow{pointer-events:auto;position:relative;display:block;height:1.5rem;width:1.5rem;cursor:pointer;border-width:0px;background-color:transparent}.vanilla-calendar-arrow:before{position:absolute;inset:0;content:var(--tw-content);content:"";-webkit-mask-image:url('data:image/svg+xml, %3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M12 16c-.3 0-.5-.1-.7-.3l-6-6c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l5.3 5.3 5.3-5.3c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-6 6c-.2.2-.4.3-.7.3z"/%3E%3C/svg%3E');mask-image:url('data:image/svg+xml, %3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M12 16c-.3 0-.5-.1-.7-.3l-6-6c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l5.3 5.3 5.3-5.3c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-6 6c-.2.2-.4.3-.7.3z"/%3E%3C/svg%3E');-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:50% 50%;mask-position:50% 50%}.vanilla-calendar-arrow.vanilla-calendar-arrow_prev:before{transform:rotate(90deg)}.vanilla-calendar-arrow.vanilla-calendar-arrow_next:before{transform:rotate(-90deg)}.vanilla-calendar-grid{display:grid;flex-grow:1;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:1.75rem}.vanilla-calendar-grid.vanilla-calendar-grid_disabled .vanilla-calendar-column{pointer-events:none;opacity:.3}.vanilla-calendar-grid.vanilla-calendar-grid_disabled .vanilla-calendar-column.vanilla-calendar-column_month,.vanilla-calendar-grid.vanilla-calendar-grid_disabled .vanilla-calendar-column.vanilla-calendar-column_year{pointer-events:auto;opacity:1}.vanilla-calendar-column{display:flex;min-width:-webkit-min-content;min-width:min-content;flex-direction:column}.vanilla-calendar-header{position:relative;margin-bottom:.75rem;display:flex;align-items:center}.vanilla-calendar-header__content{display:grid;flex-grow:1;grid-auto-columns:-webkit-max-content;grid-auto-columns:max-content;grid-auto-flow:column;align-items:center;justify-content:center;white-space:pre-wrap;padding-left:1rem;padding-right:1rem}.vanilla-calendar-month,.vanilla-calendar-year{cursor:pointer;border-radius:.25rem;border-width:0px;background-color:transparent;padding:.25rem;font-size:1rem;line-height:1.5rem;font-weight:700}.vanilla-calendar-month.vanilla-calendar-month_disabled,.vanilla-calendar-year.vanilla-calendar-year_disabled{pointer-events:none}.vanilla-calendar-months{display:grid;flex-grow:1;grid-template-columns:repeat(4,minmax(0,1fr));align-items:center;row-gap:1rem;column-gap:.5rem}.vanilla-calendar-years{display:grid;flex-grow:1;grid-template-columns:repeat(5,minmax(0,1fr));align-items:center;row-gap:1rem;column-gap:.5rem}.vanilla-calendar-months_selecting .vanilla-calendar-months__month,.vanilla-calendar-years_selecting .vanilla-calendar-years__year{cursor:pointer}.vanilla-calendar-months_selecting .vanilla-calendar-months__month .vanilla-calendar-months__month_disabled,.vanilla-calendar-years_selecting .vanilla-calendar-years__year .vanilla-calendar-years__year_disabled{cursor:default}.vanilla-calendar-months__month,.vanilla-calendar-years__year{display:flex;height:2.5rem;align-items:center;justify-content:center;word-break:break-all;border-radius:.5rem;border-width:0px;padding:.25rem;text-align:center;font-size:.75rem;line-height:1rem;font-weight:600}.vanilla-calendar-months__month.vanilla-calendar-months__month_disabled,.vanilla-calendar-years__year.vanilla-calendar-years__year_disabled{pointer-events:none}.vanilla-calendar-week-numbers{display:flex;flex-grow:1;flex-direction:column}.vanilla-calendar-week-numbers__title{margin-bottom:.5rem;display:flex;align-items:center;justify-content:center;font-size:.75rem;line-height:1rem;font-weight:700}.vanilla-calendar-week-numbers__content{display:grid;grid-auto-flow:row;align-items:center;justify-items:center;row-gap:.25rem}.vanilla-calendar-week-number{display:flex;height:100%;min-height:1.875rem;width:100%;min-width:1.875rem;cursor:pointer;align-items:center;justify-content:center;font-size:.75rem;line-height:1rem;font-weight:600}.vanilla-calendar-wrapper{display:flex;flex-grow:1}.vanilla-calendar-content{display:flex;flex-grow:1;flex-direction:column}.vanilla-calendar-week{margin-bottom:.5rem;display:grid;grid-template-columns:repeat(7,1fr);justify-items:center}.vanilla-calendar-week__day{display:flex;height:100%;width:100%;min-width:1.875rem;align-items:center;justify-content:center;font-size:.75rem;line-height:1rem;font-weight:700}.vanilla-calendar-days{display:grid;flex-grow:1;grid-template-columns:repeat(7,1fr);align-items:center;justify-items:center;row-gap:.25rem}.vanilla-calendar-days_selecting .vanilla-calendar-day__btn{cursor:pointer}.vanilla-calendar-days_selecting .vanilla-calendar-day__btn_disabled{cursor:default}.vanilla-calendar-day{position:relative;display:flex;height:100%;width:100%;align-items:center;justify-content:center}.vanilla-calendar-day:focus-visible .vanilla-calendar-day__popup,.vanilla-calendar-day:hover .vanilla-calendar-day__popup{pointer-events:auto;opacity:1}.vanilla-calendar-day_selected-first .vanilla-calendar-day__btn_selected{border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:.5rem;border-bottom-left-radius:.5rem}.vanilla-calendar-day_selected-last .vanilla-calendar-day__btn_selected{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.vanilla-calendar-day_selected-intermediate .vanilla-calendar-day__btn_selected_intermediate{border-radius:0}.vanilla-calendar-day__btn{display:flex;height:100%;min-height:1.875rem;width:100%;min-width:1.875rem;cursor:default;align-items:center;justify-content:center;border-radius:.5rem;border-width:0px;font-size:.75rem;line-height:1rem;font-weight:400}.vanilla-calendar-day__btn_today{font-weight:700}.vanilla-calendar-day__btn_disabled{pointer-events:none}.vanilla-calendar-day__popup{transform:translate(-50%);pointer-events:none;position:absolute;left:50%;top:100%;z-index:20;width:8rem;padding:1rem .75rem .5rem;font-size:.75rem;line-height:1rem;font-weight:400;opacity:0}.vanilla-calendar-day__popup:before{content:var(--tw-content);position:absolute}.vanilla-calendar-day__popup:after{content:var(--tw-content);position:absolute}.vanilla-calendar-day__popup:hover{pointer-events:auto;opacity:1}.vanilla-calendar-day__popup:before{content:"";left:0;bottom:0;z-index:-10;display:block;height:calc(100% - 8px);width:100%;border-radius:.5rem}.vanilla-calendar-day__popup:after{content:"";transform:translate(-50%);left:50%;top:1px;z-index:-10;display:block;height:0px;width:0px;border-left-width:8px;border-right-width:8px;border-top-width:0px;border-bottom-width:8px;border-style:solid;border-left-color:transparent;border-right-color:transparent;border-top-color:transparent}.vanilla-calendar-time{margin-top:.75rem;display:grid;grid-template-columns:auto 1fr;gap:.75rem;border-top-width:1px;border-bottom-width:0px;border-left-width:0px;border-right-width:0px;border-style:solid;padding-top:.75rem}.vanilla-calendar-time__content{display:grid;grid-auto-flow:column;align-items:center}.vanilla-calendar-time__hours{position:relative;margin-right:.35rem;width:1.75rem}.vanilla-calendar-time__hours:after{position:absolute;right:-5px;top:50%;margin-top:calc(-50% + 1px);display:block;--tw-content: ":";content:var(--tw-content)}.vanilla-calendar-time__minutes{width:1.75rem}.vanilla-calendar-time__hours input,.vanilla-calendar-time__minutes input{position:relative;margin:0;box-sizing:border-box;display:block;width:100%;border-radius:.25rem;border-width:0px;padding:.125rem;text-align:center;font-size:1.125rem;font-weight:600;line-height:1.125rem}.vanilla-calendar-time__hours input:focus-visible,.vanilla-calendar-time__minutes input:focus-visible{outline-style:solid;outline-width:1px}.vanilla-calendar-time__hours input:disabled,.vanilla-calendar-time__minutes input:disabled{cursor:default}.vanilla-calendar-time__hours input:hover:disabled,.vanilla-calendar-time__minutes input:hover:disabled{background-color:transparent}.vanilla-calendar-time__keeping{margin-left:1px;margin-top:.25rem;width:22px;cursor:pointer;border-radius:.25rem;border-width:0px;background-color:transparent;padding:0;font-size:11px}.vanilla-calendar-time__keeping:focus-visible{outline-style:solid;outline-width:1px}.vanilla-calendar-time__keeping:disabled{cursor:default}.vanilla-calendar-time__keeping:hover:disabled{background-color:transparent}.vanilla-calendar-time__ranges{display:grid;grid-auto-flow:row}.vanilla-calendar-time__range{position:relative;z-index:10;font-size:0}.vanilla-calendar-time__range:before{content:var(--tw-content);left:0}.vanilla-calendar-time__range:after{content:var(--tw-content);right:0}.vanilla-calendar-time__range:before,.vanilla-calendar-time__range:after{content:"";transform:translateY(-50%);pointer-events:none;position:absolute;top:50%;z-index:10;height:.5rem;width:1px}.vanilla-calendar-time__range input{position:relative;margin:0;height:1.25rem;width:100%;cursor:pointer;-webkit-appearance:none;appearance:none;outline-width:0px}.vanilla-calendar-time__range input::-webkit-slider-thumb{position:relative;z-index:20;margin-top:-.5rem;box-sizing:border-box;height:1rem;width:.75rem;cursor:pointer;-webkit-appearance:none;appearance:none;border-radius:.25rem;border-width:1px;border-style:solid;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.vanilla-calendar-time__range input::-moz-range-thumb{position:relative;z-index:20;box-sizing:border-box;height:1rem;width:.75rem;cursor:pointer;border-radius:.25rem;border-width:1px;border-style:solid;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.vanilla-calendar-time__range input::-webkit-slider-runnable-track{margin-top:1px;box-sizing:border-box;height:1px;width:100%;cursor:pointer;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.vanilla-calendar-time__range input::-moz-range-track{margin-top:1px;box-sizing:border-box;height:1px;width:100%;cursor:pointer;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}
+.vanilla-calendar{position:relative;box-sizing:border-box;display:flex;height:-webkit-max-content;height:max-content;width:-webkit-max-content;width:max-content;min-width:272px;max-width:100%;flex-direction:column;border-radius:.75rem;padding:1rem;opacity:1;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.vanilla-calendar_multiple{width:550px}.vanilla-calendar button:focus-visible{border-radius:.5rem;outline-style:solid;outline-width:1px}.vanilla-calendar.vanilla-calendar_multiple .vanilla-calendar-days{flex-grow:0}.vanilla-calendar_hidden{pointer-events:none;opacity:0}.vanilla-calendar_to-input{position:absolute;left:0;bottom:0;margin-top:.25rem}.vanilla-calendar-controls{pointer-events:none;position:absolute;left:0;right:0;top:0;z-index:20;box-sizing:content-box;display:flex;align-items:center;justify-content:space-between;padding-left:1rem;padding-right:1rem;padding-top:1.25rem}.vanilla-calendar-arrow{pointer-events:auto;position:relative;display:block;height:1.5rem;width:1.5rem;cursor:pointer;border-width:0px;background-color:transparent}.vanilla-calendar-arrow:before{position:absolute;inset:0;content:var(--tw-content);content:"";-webkit-mask-image:url('data:image/svg+xml, %3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M12 16c-.3 0-.5-.1-.7-.3l-6-6c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l5.3 5.3 5.3-5.3c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-6 6c-.2.2-.4.3-.7.3z"/%3E%3C/svg%3E');mask-image:url('data:image/svg+xml, %3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M12 16c-.3 0-.5-.1-.7-.3l-6-6c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l5.3 5.3 5.3-5.3c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-6 6c-.2.2-.4.3-.7.3z"/%3E%3C/svg%3E');-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:50% 50%;mask-position:50% 50%}.vanilla-calendar-arrow.vanilla-calendar-arrow_prev:before{transform:rotate(90deg)}.vanilla-calendar-arrow.vanilla-calendar-arrow_next:before{transform:rotate(-90deg)}.vanilla-calendar-grid{display:grid;flex-grow:1;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:1.75rem}.vanilla-calendar-grid.vanilla-calendar-grid_disabled .vanilla-calendar-column{pointer-events:none;opacity:.3}.vanilla-calendar-grid.vanilla-calendar-grid_disabled .vanilla-calendar-column.vanilla-calendar-column_month,.vanilla-calendar-grid.vanilla-calendar-grid_disabled .vanilla-calendar-column.vanilla-calendar-column_year{pointer-events:auto;opacity:1}.vanilla-calendar-column{display:flex;min-width:-webkit-min-content;min-width:min-content;flex-direction:column}.vanilla-calendar-header{position:relative;margin-bottom:.75rem;display:flex;align-items:center}.vanilla-calendar-header__content{display:grid;flex-grow:1;grid-auto-columns:-webkit-max-content;grid-auto-columns:max-content;grid-auto-flow:column;align-items:center;justify-content:center;white-space:pre-wrap;padding-left:1rem;padding-right:1rem}.vanilla-calendar-month,.vanilla-calendar-year{cursor:pointer;border-radius:.25rem;border-width:0px;background-color:transparent;padding:.25rem;font-size:1rem;line-height:1.5rem;font-weight:700}.vanilla-calendar-month.vanilla-calendar-month_disabled,.vanilla-calendar-year.vanilla-calendar-year_disabled{pointer-events:none}.vanilla-calendar-months{display:grid;flex-grow:1;grid-template-columns:repeat(4,minmax(0,1fr));align-items:center;row-gap:1rem;column-gap:.5rem}.vanilla-calendar-years{display:grid;flex-grow:1;grid-template-columns:repeat(5,minmax(0,1fr));align-items:center;row-gap:1rem;column-gap:.5rem}.vanilla-calendar-months_selecting .vanilla-calendar-months__month,.vanilla-calendar-years_selecting .vanilla-calendar-years__year{cursor:pointer}.vanilla-calendar-months_selecting .vanilla-calendar-months__month .vanilla-calendar-months__month_disabled,.vanilla-calendar-years_selecting .vanilla-calendar-years__year .vanilla-calendar-years__year_disabled{cursor:default}.vanilla-calendar-months__month,.vanilla-calendar-years__year{display:flex;height:2.5rem;align-items:center;justify-content:center;word-break:break-all;border-radius:.5rem;border-width:0px;padding:.25rem;text-align:center;font-size:.75rem;line-height:1rem;font-weight:600}.vanilla-calendar-months__month.vanilla-calendar-months__month_disabled,.vanilla-calendar-years__year.vanilla-calendar-years__year_disabled{pointer-events:none}.vanilla-calendar-week-numbers{display:flex;flex-direction:column}.vanilla-calendar-week-numbers__title{margin-bottom:.5rem;display:flex;align-items:center;justify-content:center;font-size:.75rem;line-height:1rem;font-weight:700}.vanilla-calendar-week-numbers__content{display:grid;grid-auto-flow:row;align-items:center;justify-items:center;row-gap:.25rem}.vanilla-calendar-week-number{margin:0;display:flex;height:100%;min-height:1.875rem;width:100%;min-width:1.875rem;cursor:pointer;align-items:center;justify-content:center;border-style:none;background-color:transparent;padding:0;font-size:.75rem;line-height:1rem;font-weight:600}.vanilla-calendar-wrapper{display:flex;flex-grow:1}.vanilla-calendar-content{display:flex;flex-grow:1;flex-direction:column}.vanilla-calendar-week{margin-bottom:.5rem;display:grid;grid-template-columns:repeat(7,1fr);justify-items:center}.vanilla-calendar-week__day{display:flex;height:100%;width:100%;min-width:1.875rem;align-items:center;justify-content:center;font-size:.75rem;line-height:1rem;font-weight:700}.vanilla-calendar-days{display:grid;flex-grow:1;grid-template-columns:repeat(7,1fr);align-items:center;justify-items:center;row-gap:.25rem}.vanilla-calendar-days_selecting .vanilla-calendar-day__btn{cursor:pointer}.vanilla-calendar-days_selecting .vanilla-calendar-day__btn_disabled{cursor:default}.vanilla-calendar-day{position:relative;display:flex;height:100%;width:100%;align-items:center;justify-content:center}.vanilla-calendar-day:focus-visible .vanilla-calendar-day__popup,.vanilla-calendar-day:hover .vanilla-calendar-day__popup{pointer-events:auto;opacity:1}.vanilla-calendar-day_selected-first .vanilla-calendar-day__btn_selected{border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:.5rem;border-bottom-left-radius:.5rem}.vanilla-calendar-day_selected-last .vanilla-calendar-day__btn_selected{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.vanilla-calendar-day_selected-intermediate .vanilla-calendar-day__btn_selected_intermediate{border-radius:0}.vanilla-calendar-day__btn{display:flex;height:100%;min-height:1.875rem;width:100%;min-width:1.875rem;cursor:default;align-items:center;justify-content:center;border-radius:.5rem;border-width:0px;font-size:.75rem;line-height:1rem;font-weight:400}.vanilla-calendar-day__btn_today{font-weight:700}.vanilla-calendar-day__btn_disabled{pointer-events:none}.vanilla-calendar-day__popup{transform:translate(-50%);pointer-events:none;position:absolute;left:50%;top:100%;z-index:20;width:8rem;padding:1rem .75rem .5rem;font-size:.75rem;line-height:1rem;font-weight:400;opacity:0}.vanilla-calendar-day__popup:before{content:var(--tw-content);position:absolute}.vanilla-calendar-day__popup:after{content:var(--tw-content);position:absolute}.vanilla-calendar-day__popup:hover{pointer-events:auto;opacity:1}.vanilla-calendar-day__popup:before{content:"";left:0;bottom:0;z-index:-10;display:block;height:calc(100% - 8px);width:100%;border-radius:.5rem}.vanilla-calendar-day__popup:after{content:"";transform:translate(-50%);left:50%;top:1px;z-index:-10;display:block;height:0px;width:0px;border-left-width:8px;border-right-width:8px;border-top-width:0px;border-bottom-width:8px;border-style:solid;border-left-color:transparent;border-right-color:transparent;border-top-color:transparent}.vanilla-calendar-time{margin-top:.75rem;display:grid;grid-template-columns:auto 1fr;gap:.75rem;border-top-width:1px;border-bottom-width:0px;border-left-width:0px;border-right-width:0px;border-style:solid;padding-top:.75rem}.vanilla-calendar-time__content{display:grid;grid-auto-flow:column;align-items:center}.vanilla-calendar-time__hours{position:relative;margin-right:.35rem;width:1.75rem}.vanilla-calendar-time__hours:after{position:absolute;right:-5px;top:50%;margin-top:calc(-50% + 1px);display:block;--tw-content: ":";content:var(--tw-content)}.vanilla-calendar-time__minutes{width:1.75rem}.vanilla-calendar-time__hours input,.vanilla-calendar-time__minutes input{position:relative;margin:0;box-sizing:border-box;display:block;width:100%;border-radius:.25rem;border-width:0px;padding:.125rem;text-align:center;font-size:1.125rem;font-weight:600;line-height:1.125rem}.vanilla-calendar-time__hours input:focus-visible,.vanilla-calendar-time__minutes input:focus-visible{outline-style:solid;outline-width:1px}.vanilla-calendar-time__hours input:disabled,.vanilla-calendar-time__minutes input:disabled{cursor:default}.vanilla-calendar-time__hours input:hover:disabled,.vanilla-calendar-time__minutes input:hover:disabled{background-color:transparent}.vanilla-calendar-time__keeping{margin-left:1px;margin-top:.25rem;width:22px;cursor:pointer;border-radius:.25rem;border-width:0px;background-color:transparent;padding:0;font-size:11px}.vanilla-calendar-time__keeping:focus-visible{outline-style:solid;outline-width:1px}.vanilla-calendar-time__keeping:disabled{cursor:default}.vanilla-calendar-time__keeping:hover:disabled{background-color:transparent}.vanilla-calendar-time__ranges{display:grid;grid-auto-flow:row}.vanilla-calendar-time__range{position:relative;z-index:10;font-size:0}.vanilla-calendar-time__range:before{content:var(--tw-content);left:0}.vanilla-calendar-time__range:after{content:var(--tw-content);right:0}.vanilla-calendar-time__range:before,.vanilla-calendar-time__range:after{content:"";transform:translateY(-50%);pointer-events:none;position:absolute;top:50%;z-index:10;height:.5rem;width:1px}.vanilla-calendar-time__range input{position:relative;margin:0;height:1.25rem;width:100%;cursor:pointer;-webkit-appearance:none;appearance:none;outline-width:0px}.vanilla-calendar-time__range input::-webkit-slider-thumb{position:relative;z-index:20;margin-top:-.5rem;box-sizing:border-box;height:1rem;width:.75rem;cursor:pointer;-webkit-appearance:none;appearance:none;border-radius:.25rem;border-width:1px;border-style:solid;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.vanilla-calendar-time__range input::-moz-range-thumb{position:relative;z-index:20;box-sizing:border-box;height:1rem;width:.75rem;cursor:pointer;border-radius:.25rem;border-width:1px;border-style:solid;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.vanilla-calendar-time__range input::-webkit-slider-runnable-track{margin-top:1px;box-sizing:border-box;height:1px;width:100%;cursor:pointer;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.vanilla-calendar-time__range input::-moz-range-track{margin-top:1px;box-sizing:border-box;height:1px;width:100%;cursor:pointer;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}
diff --git a/package/build/vanilla-calendar.min.js b/package/build/vanilla-calendar.min.js
index 31d20296..0451903a 100644
--- a/package/build/vanilla-calendar.min.js
+++ b/package/build/vanilla-calendar.min.js
@@ -1,2 +1,2 @@
/*! name: @uvarov.frontend/vanilla-calendar | url: https://github.com/uvarov-frontend/vanilla-calendar */
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VanillaCalendar=t()}(this,(function(){"use strict";var e=Object.defineProperty,t=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,n=(t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s,l=(e,t,a)=>(n(e,"symbol"!=typeof t?t+"":t,a),a);const r={calendar:"vanilla-calendar",calendarDefault:"vanilla-calendar_default",calendarMultiple:"vanilla-calendar_multiple",calendarMonth:"vanilla-calendar_month",calendarYear:"vanilla-calendar_year",calendarHidden:"vanilla-calendar_hidden",calendarToInput:"vanilla-calendar_to-input",controls:"vanilla-calendar-controls",grid:"vanilla-calendar-grid",gridDisabled:"vanilla-calendar-grid_disabled",column:"vanilla-calendar-column",columnMonth:"vanilla-calendar-column_month",columnYear:"vanilla-calendar-column_year",header:"vanilla-calendar-header",headerContent:"vanilla-calendar-header__content",month:"vanilla-calendar-month",monthDisabled:"vanilla-calendar-month_disabled",year:"vanilla-calendar-year",yearDisabled:"vanilla-calendar-year_disabled",arrow:"vanilla-calendar-arrow",arrowPrev:"vanilla-calendar-arrow_prev",arrowNext:"vanilla-calendar-arrow_next",wrapper:"vanilla-calendar-wrapper",content:"vanilla-calendar-content",week:"vanilla-calendar-week",weekDay:"vanilla-calendar-week__day",weekDayWeekend:"vanilla-calendar-week__day_weekend",days:"vanilla-calendar-days",daysSelecting:"vanilla-calendar-days_selecting",months:"vanilla-calendar-months",monthsSelecting:"vanilla-calendar-months_selecting",monthsMonth:"vanilla-calendar-months__month",monthsMonthSelected:"vanilla-calendar-months__month_selected",monthsMonthDisabled:"vanilla-calendar-months__month_disabled",years:"vanilla-calendar-years",yearsSelecting:"vanilla-calendar-years_selecting",yearsYear:"vanilla-calendar-years__year",yearsYearSelected:"vanilla-calendar-years__year_selected",yearsYearDisabled:"vanilla-calendar-years__year_disabled",time:"vanilla-calendar-time",timeContent:"vanilla-calendar-time__content",timeHours:"vanilla-calendar-time__hours",timeMinutes:"vanilla-calendar-time__minutes",timeKeeping:"vanilla-calendar-time__keeping",timeRanges:"vanilla-calendar-time__ranges",timeRange:"vanilla-calendar-time__range",day:"vanilla-calendar-day",daySelected:"vanilla-calendar-day_selected",daySelectedFirst:"vanilla-calendar-day_selected-first",daySelectedLast:"vanilla-calendar-day_selected-last",daySelectedIntermediate:"vanilla-calendar-day_selected-intermediate",dayPopup:"vanilla-calendar-day__popup",dayBtn:"vanilla-calendar-day__btn",dayBtnPrev:"vanilla-calendar-day__btn_prev",dayBtnNext:"vanilla-calendar-day__btn_next",dayBtnToday:"vanilla-calendar-day__btn_today",dayBtnSelected:"vanilla-calendar-day__btn_selected",dayBtnSelectedFirst:"vanilla-calendar-day__btn_selected_first",dayBtnSelectedLast:"vanilla-calendar-day__btn_selected_last",dayBtnSelectedIntermediate:"vanilla-calendar-day__btn_selected_intermediate",dayBtnHover:"vanilla-calendar-day__btn_hover",dayBtnDisabled:"vanilla-calendar-day__btn_disabled",dayBtnWeekend:"vanilla-calendar-day__btn_weekend",dayBtnHoliday:"vanilla-calendar-day__btn_holiday",weekNumbers:"vanilla-calendar-week-numbers",weekNumbersTitle:"vanilla-calendar-week-numbers__title",weekNumbersContent:"vanilla-calendar-week-numbers__content",weekNumber:"vanilla-calendar-week-number",isFocus:"vanilla-calendar-is-focus"},i=e=>`\n\t
\n\t\t<#ArrowPrev />\n\t\t<#ArrowNext />\n\t
\n\t\n\t\t<#Multiple>\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t<#WeekNumbers />\n\t\t\t\t\t
\n\t\t\t\t\t\t<#Week />\n\t\t\t\t\t\t<#Days />\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t<#/Multiple>\n\t
\n\t<#ControlTime />\n`,d=e=>`\n\t\n\t\n\t\t
\n\t\t\t<#Months />\n\t\t
\n\t
\n`,c=e=>`\n\t\n\t\n\t\t
\n\t\t\t<#Years />\n\t\t
\n\t
\n`;class o{constructor(){var e;l(this,"input",!1),l(this,"type","default"),l(this,"months",2),l(this,"jumpMonths",1),l(this,"date",{min:"1970-01-01",max:"2470-12-31",today:new Date}),l(this,"settings",{lang:"en",iso8601:!0,range:{min:"1970-01-01",max:"2470-12-31",disablePast:!1,disableGaps:!1,disableAllDays:!1,disableWeekday:void 0,disabled:void 0,enabled:void 0},selection:{day:"single",month:!0,year:!0,time:!1,controlTime:"all",stepHours:1,stepMinutes:1},selected:{dates:void 0,month:void 0,year:void 0,holidays:void 0,time:void 0},visibility:{theme:"system",themeDetect:"html[data-theme]",monthShort:!0,weekNumbers:!1,weekend:!0,today:!0,disabled:!1,daysOutside:!0}}),l(this,"locale",{months:[],weekday:[]}),l(this,"actions",{clickDay:null,clickWeekNumber:null,clickMonth:null,clickYear:null,clickArrow:null,changeTime:null,changeToInput:null,getDays:null,hideCalendar:null,showCalendar:null}),l(this,"popups",{}),l(this,"CSSClasses",((e,l)=>{for(var r in l||(l={}))a.call(l,r)&&n(e,r,l[r]);if(t)for(var r of t(l))s.call(l,r)&&n(e,r,l[r]);return e})({},r)),l(this,"DOMTemplates",{default:(e=this.CSSClasses,`\n\t\n\t\n\t\t<#WeekNumbers />\n\t\t
\n\t\t\t<#Week />\n\t\t\t<#Days />\n\t\t
\n\t
\n\t<#ControlTime />\n`),multiple:i(this.CSSClasses),month:d(this.CSSClasses),year:c(this.CSSClasses)}),l(this,"HTMLElement"),l(this,"HTMLOriginalElement"),l(this,"HTMLInputElement"),l(this,"rangeMin"),l(this,"rangeMax"),l(this,"rangeDisabled"),l(this,"rangeEnabled"),l(this,"selectedDates"),l(this,"selectedHolidays"),l(this,"selectedMonth"),l(this,"selectedYear"),l(this,"selectedHours"),l(this,"selectedMinutes"),l(this,"selectedKeeping"),l(this,"selectedTime"),l(this,"userTime"),l(this,"currentType"),l(this,"correctMonths"),l(this,"viewYear"),l(this,"dateMin"),l(this,"dateMax")}}const u=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,m=e=>new Date(`${e}T00:00:00`),g=e=>e.reduce(((e,t)=>(t.match(/^(\d{4}-\d{2}-\d{2})$/g)?e.push(t):t.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g,((t,a,s)=>{const n=m(a),l=m(s),r=new Date(n.getTime());for(;r<=l;r.setDate(r.getDate()+1))e.push(u(r));return t})),e)),[]),h=e=>e?{0:"12",13:"01",14:"02",15:"03",16:"04",17:"05",18:"06",19:"07",20:"08",21:"09",22:"10",23:"11"}[Number(e)]||String(e):"",y=e=>{e.currentType=e.type,(e=>{const t=void 0!==e.settings.selected.month&&Number(e.settings.selected.month)>=0&&Number(e.settings.selected.month)<12,a=void 0!==e.settings.selected.year&&Number(e.settings.selected.year)>=0&&Number(e.settings.selected.year)<=9999;e.selectedMonth=t?Number(e.settings.selected.month):e.date.today.getMonth(),e.selectedYear=a?Number(e.settings.selected.year):e.date.today.getFullYear(),e.viewYear=e.selectedYear})(e),(e=>{var t,a,s,n;const l=e.settings.range.disablePast&&!e.settings.range.disableAllDays&&m(e.settings.range.min){var a;return!(null==(a=e.rangeEnabled)?void 0:a.includes(t))}))),(null==(n=e.rangeEnabled)?void 0:n[0])&&e.settings.range.disableAllDays&&(e.rangeMin=e.rangeEnabled[0],e.rangeMax=e.rangeEnabled[e.rangeEnabled.length-1])})(e),(e=>{var t,a;e.selectedDates=(null==(t=e.settings.selected.dates)?void 0:t[0])?g(e.settings.selected.dates):[],e.selectedHolidays=(null==(a=e.settings.selected.holidays)?void 0:a[0])?g(e.settings.selected.holidays):[]})(e),(e=>{e.dateMin=e.settings.visibility.disabled?m(e.date.min):m(e.rangeMin),e.dateMax=e.settings.visibility.disabled?m(e.date.max):m(e.rangeMax)})(e),(e=>{const t=!0===e.settings.selection.time||12===e.settings.selection.time;if(t||24===e.settings.selection.time){if(e.userTime=!1,"string"==typeof e.settings.selected.time){const a=t?/^([0-9]|0[1-9]|1[0-2]):([0-5][0-9])|(AM|PM)/g:/^([0-1]?[0-9]|2[0-3]):([0-5][0-9])/g;e.settings.selected.time.replace(a,((a,s,n,l)=>(s&&n&&(e.userTime=!0,e.selectedHours=s,e.selectedMinutes=n),l&&t?e.selectedKeeping=l:t&&(e.selectedKeeping="AM"),"")))}!e.userTime&&t?(e.selectedHours=h(String(e.date.today.getHours())),e.selectedMinutes=String(e.date.today.getMinutes()),e.selectedKeeping=Number(e.date.today.getHours())>=12?"PM":"AM"):e.userTime||(e.selectedHours=String(e.date.today.getHours()),e.selectedMinutes=String(e.date.today.getMinutes())),e.selectedHours=Number(e.selectedHours)<10?`0${Number(e.selectedHours)}`:`${e.selectedHours}`,e.selectedMinutes=Number(e.selectedMinutes)<10?`0${Number(e.selectedMinutes)}`:`${e.selectedMinutes}`,e.selectedTime=`${e.selectedHours}:${e.selectedMinutes}${e.selectedKeeping?` ${e.selectedKeeping}`:""}`}else e.settings.selection.time&&(e.settings.selection.time=!1,console.error("The value of the time property can be: false, true, 12 or 24."))})(e),(e=>{e.correctMonths="multiple"===e.type?1===e.months?2:e.months>12?12:e.months:1})(e)},v=e=>`${e.charAt(0).toUpperCase()}${e.substring(1,e.length)}`.replace(/\./,""),M=(e,t)=>{const a=new Date(0,0,t).toLocaleString(e.settings.lang,{weekday:"short"});e.locale.weekday.push(v(a))},S=(e,t)=>{const a=new Date(0,t).toLocaleString(e.settings.lang,{month:"long"});e.locale.months.push(v(a))},p=({arrowPrev:e,arrowNext:t,isPrevHidden:a,isNextHidden:s})=>{e.style.visibility=a?"hidden":"",t.style.visibility=s?"hidden":""},C=e=>{var t,a;if("month"===e.currentType)return;const s=null==(t=e.HTMLElement)?void 0:t.querySelector(`.${e.CSSClasses.arrowPrev}`),n=null==(a=e.HTMLElement)?void 0:a.querySelector(`.${e.CSSClasses.arrowNext}`);if(!s||!n)return;({default:()=>{const t=m(u(new Date(e.selectedYear,e.selectedMonth,1))),a=new Date(t.getTime()),l=new Date(t.getTime());a.setMonth(a.getMonth()-e.jumpMonths),l.setMonth(l.getMonth()+e.jumpMonths),e.settings.selection.year||(e.dateMin.setFullYear(t.getFullYear()),e.dateMax.setFullYear(t.getFullYear()));const r=!e.settings.selection.month||a.getFullYear()e.dateMax.getFullYear()||l.getFullYear()===e.dateMax.getFullYear()&&l.getMonth()>e.dateMax.getMonth();p({arrowPrev:s,arrowNext:n,isPrevHidden:r,isNextHidden:i})},year:()=>{p({arrowPrev:s,arrowNext:n,isPrevHidden:e.dateMin.getFullYear()&&e.viewYear-7<=e.dateMin.getFullYear(),isNextHidden:e.dateMax.getFullYear()&&e.viewYear+7>=e.dateMax.getFullYear()})}})["multiple"===e.currentType?"default":e.currentType]()},b=(e,t)=>{if(!e)return null;const a=m(e),s=t?a.getDay()||7:a.getDay();a.setDate(a.getDate()+4-s);const n=new Date(a.getFullYear(),0,1),l=Math.ceil(((+a-+n)/864e5+1)/7);return{year:a.getFullYear(),week:l}},D=(e,t,a,s,n)=>{const l=t[a].querySelector(`.${e.CSSClasses.dayBtn}`),r=b(null==l?void 0:l.dataset.calendarDay,e.settings.iso8601);if(!r)return;const i=s.cloneNode(!0);i.innerText=String(r.week),i.dataset.calendarYearWeek=String(r.year),n.append(i)},T=(e,t,a,s,n,l,r,i)=>{const d=document.createElement("div");d.className=e.CSSClasses.day;const c=document.createElement("button");c.className=`${e.CSSClasses.dayBtn}${i?` ${i}`:""}`,c.type="button",c.innerText=String(s),c.dataset.calendarDay=l;e.settings.visibility.weekNumbers&&(()=>{const t=b(l,e.settings.iso8601);t&&(c.dataset.calendarWeekNumber=String(t.week))})(),r?e.settings.visibility.daysOutside&&d.append(c):d.append(c),((e,t,a)=>{var s,n,l;(null==(s=e.settings.range.disableWeekday)?void 0:s.includes(a))&&!(null==(n=e.rangeDisabled)?void 0:n.includes(t))&&(e.rangeDisabled=e.rangeDisabled?[...e.rangeDisabled,t]:[t],null==(l=e.rangeDisabled)||l.sort(((e,t)=>+new Date(e)-+new Date(t))))})(e,l,n),((e,t,a,s,n,l,r)=>{var i,d,c;(m(e.rangeMin)>m(l)||m(e.rangeMax)1&&"multiple-ranged"===e.settings.selection.day&&(e.selectedDates[0]===l?(a.classList.add(e.CSSClasses.daySelectedFirst),s.classList.add(e.CSSClasses.daySelectedFirst)):e.selectedDates[e.selectedDates.length-1]===l?(a.classList.add(e.CSSClasses.daySelectedLast),s.classList.add(e.CSSClasses.dayBtnSelectedLast)):(a.classList.add(e.CSSClasses.daySelectedIntermediate),s.classList.add(e.CSSClasses.dayBtnSelectedIntermediate))))})(e,t,d,c,n,l,r),a.append(d),e.actions.getDays&&e.actions.getDays(s,l,d,c)},w=e=>{const t=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.days}`),a=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.weekNumbers}`),s=new Date(e.selectedYear,e.selectedMonth,1);t.forEach(((t,n)=>{const l=new Date(s);l.setMonth(l.getMonth()+n);const r=l.getMonth(),i=l.getFullYear(),d=new Date(i,r,1),c=new Date(i,r+1,0).getDate(),o=e.settings.iso8601?(0!==d.getDay()?d.getDay():7)-1:d.getDay();e.settings.selection.day&&t.classList.add(e.CSSClasses.daysSelecting),t.innerHTML="",((e,t,a,s,n)=>{let l=new Date(a,s,0).getDate()-(n-1);const r=0===s?a-1:a,i=0===s?12:s<10?`0${s}`:s;for(let d=n;d>0;d--,l++){const s=`${r}-${i}-${l}`,n=m(s).getDay();T(e,a,t,l,n,s,!0,e.CSSClasses.dayBtnPrev)}})(e,t,i,r,o),((e,t,a,s,n)=>{for(let l=1;l<=a;l++){const a=new Date(s,n,l),r=u(a),i=a.getDay();T(e,s,t,l,i,r,!1,null)}})(e,t,c,i,r),((e,t,a,s,n,l)=>{const r=l+a,i=7*Math.ceil(r/7)-r,d=n+1===12?s+1:s,c=n+1===12?"01":n+2<10?`0${n+2}`:n+2;for(let o=1;o<=i;o++){const a=`${d}-${c}-${o<10?`0${o}`:String(o)}`,n=m(a).getDay();T(e,s,t,o,n,a,!0,e.CSSClasses.dayBtnNext)}})(e,t,c,i,r,o),((e,t,a,s,n)=>{if(!e.settings.visibility.weekNumbers)return;s.innerHTML="";const l=document.createElement("b");l.className=e.CSSClasses.weekNumbersTitle,l.innerText="#",s.append(l);const r=document.createElement("div");r.className=e.CSSClasses.weekNumbersContent,s.append(r);const i=document.createElement("button");i.type="button",i.className=e.CSSClasses.weekNumber;const d=n.querySelectorAll(`.${e.CSSClasses.day}`),c=Math.ceil((t+a)/7);for(let o=0;o{var a;e.popups&&(null==(a=Object.entries(e.popups))||a.forEach((([a,s])=>((e,t,a,s)=>{const n=a.querySelector(`[data-calendar-day="${e}"]`);n&&((null==t?void 0:t.modifier)&&n.classList.add(...t.modifier.trim().split(" ")),(null==t?void 0:t.html)&&(n.parentNode.innerHTML+=`${t.html}
`))})(a,s,t,e.CSSClasses.dayPopup))))})(e,t)}))},$=Object.freeze(Object.defineProperty({__proto__:null,ArrowNext:e=>`\n\t\n\t \n`,ArrowPrev:e=>`\n\t\n\t \n`,ControlTime:e=>e.settings.selection.time?`\n\t
\n`:"",Days:e=>`\n\t
\n`,Month:e=>`\n\t\n\t \n`,Months:e=>`\n\t
\n`,Week:e=>`\n\t
\n`,WeekNumbers:e=>e.settings.visibility.weekNumbers?`\n\t
\n`:"",Year:e=>`\n\t\n\t \n`,Years:e=>`\n\t
\n`},Symbol.toStringTag,{value:"Module"})),f=(e,t)=>t.replace(/<#(.*?)\/>/g,((t,a)=>{const s=(n=a.replace(/[\s\n\t]/g,""),$[n]);var n;return s?s(e):""})).replace(/[\n\t]/g,""),L=(e,t)=>{const{HTMLElement:a,CSSClasses:s,DOMTemplates:n,type:l,currentType:r,correctMonths:i}=e,d=(n,l)=>{if(!t)return;const r=a.querySelector(`.${s.controls}`);r&&a.removeChild(r);a.querySelector(`.${s.grid}`).classList.add(s.gridDisabled);const i=t.closest(`.${s.column}`);i.classList.add(n),i.innerHTML=f(e,l)},c={default:()=>{a.classList.add(s.calendarDefault),a.classList.remove(s.calendarMonth,s.calendarYear),a.innerHTML=f(e,n.default)},multiple:()=>{i&&(a.classList.add(s.calendarMultiple),a.classList.remove(s.calendarMonth,s.calendarYear),a.innerHTML=((e,t)=>t.replace(/<#Multiple>(.*?)<#\/Multiple>/g,((t,a)=>{let s="";for(let n=0;n{"multiple"!==l?(a.classList.add(s.calendarMonth),a.classList.remove(s.calendarDefault,s.calendarYear),a.innerHTML=f(e,n.month)):d(s.columnMonth,n.month)},year:()=>{"multiple"!==l?(a.classList.add(s.calendarYear),a.classList.remove(s.calendarDefault,s.calendarMonth),a.innerHTML=f(e,n.year)):d(s.columnYear,n.year)}};a.classList.add(s.calendar),c[r]()},H=e=>{var t,a;const s=null==(t=e.HTMLElement)?void 0:t.querySelectorAll("[data-calendar-selected-month]"),n=null==(a=e.HTMLElement)?void 0:a.querySelectorAll("[data-calendar-selected-year]");if(!(null==s?void 0:s[0])&&(null==n?void 0:n[0]))return;const l=new Date(e.selectedYear,e.selectedMonth,1);null==s||s.forEach(((t,a)=>((e,t,a,s)=>{const n=new Date(s.setMonth(e.selectedMonth+a)).getMonth(),l=!1===e.settings.selection.month||"only-arrows"===e.settings.selection.month;t.tabIndex=l?-1:0,t.classList.toggle(e.CSSClasses.monthDisabled,l),t.setAttribute("data-calendar-selected-month",String(n)),t.innerText=e.locale.months[n]})(e,t,a,l))),null==n||n.forEach(((t,a)=>((e,t,a,s)=>{const n=new Date(s.setFullYear(e.selectedYear,e.selectedMonth+a)).getFullYear(),l=!1===e.settings.selection.year||"only-arrows"===e.settings.selection.year;t.tabIndex=l?-1:0,t.classList.toggle(e.CSSClasses.yearDisabled,l),t.setAttribute("data-calendar-selected-year",String(n)),t.innerText=String(n)})(e,t,a,l)))},E=e=>{if("multiple"!==e.type)return 0;const t=[...e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`)].findIndex((t=>t.classList.contains(`${e.CSSClasses.columnMonth}`)));return t>0?t:0},Y=(e,t,a,s,n,l)=>{const r=t.cloneNode(!1);return r.className=`${e.CSSClasses.monthsMonth}${a===l?` ${e.CSSClasses.monthsMonthSelected}`:n?` ${e.CSSClasses.monthsMonthDisabled}`:""}`,r.title=s,r.innerText=`${e.settings.visibility.monthShort?s.substring(0,3):s}`,r.dataset.calendarMonth=String(l),n&&(r.tabIndex=-1),r},_=(e,t)=>{var a,s;const n=(null==t?void 0:t.dataset.calendarSelectedMonth)?Number(t.dataset.calendarSelectedMonth):e.selectedMonth,l=null==(a=null==t?void 0:t.closest(`.${e.CSSClasses.column}`))?void 0:a.querySelector(`.${e.CSSClasses.year}`),r=l?Number(l.dataset.calendarSelectedYear):e.selectedYear;e.currentType="month",L(e,t),H(e);const i=null==(s=e.HTMLElement)?void 0:s.querySelector(`.${e.CSSClasses.months}`);if(!e.settings.selection.month||!i)return;i.classList.add(e.CSSClasses.monthsSelecting);const d=e.jumpMonths>1?e.locale.months.map(((t,a)=>n-e.jumpMonths*a)).concat(e.locale.months.map(((t,a)=>n+e.jumpMonths*a))).filter((e=>e>=0&&e<=12)):Array.from(Array(12).keys()),c=document.createElement("button");c.type="button";for(let o=0;o<12;o++){const t=e.locale.months[o],a=oe.dateMax.getMonth()+E(e)&&r>=e.dateMax.getFullYear()||o!==n&&!d.includes(o);i.append(Y(e,c,n,t,a,o))}},k=(e,t)=>e&&t?{0:{AM:"00",PM:"12"},1:{AM:"01",PM:"13"},2:{AM:"02",PM:"14"},3:{AM:"03",PM:"15"},4:{AM:"04",PM:"16"},5:{AM:"05",PM:"17"},6:{AM:"06",PM:"18"},7:{AM:"07",PM:"19"},8:{AM:"08",PM:"20"},9:{AM:"09",PM:"21"},10:{AM:"10",PM:"22"},11:{AM:"11",PM:"23"},12:{AM:"12",PM:"12"}}[Number(e)][t]:"",x=e=>({hide(){e.HTMLElement.classList.add(e.CSSClasses.calendarHidden),e.actions.hideCalendar&&e.actions.hideCalendar(e.HTMLInputElement,e.HTMLElement)},show(){e.HTMLElement.classList.remove(e.CSSClasses.calendarHidden),e.actions.showCalendar&&e.actions.showCalendar(e.HTMLInputElement,e.HTMLElement)},HTMLInputElement:e.HTMLInputElement,HTMLElement:e.HTMLElement}),N=(e,t,a)=>e.querySelector(`.${t}${a?` input[name="${a}"]`:""}`),A=(e,t,a)=>{e.addEventListener("mouseover",(()=>t.classList.add(a))),e.addEventListener("mouseout",(()=>t.classList.remove(a)))},P=(e,t,a,s)=>{({hours:()=>{e.selectedHours=a},minutes:()=>{e.selectedMinutes=a}})[s](),e.selectedTime=`${e.selectedHours}:${e.selectedMinutes}${e.selectedKeeping?` ${e.selectedKeeping}`:""}`,e.actions.changeTime&&e.actions.changeTime(t,e.selectedTime,e.selectedHours,e.selectedMinutes,e.selectedKeeping),e.input&&e.HTMLInputElement&&e.actions.changeToInput&&e.actions.changeToInput(t,x(e),e.selectedDates,e.selectedTime,e.selectedHours,e.selectedMinutes,e.selectedKeeping)},F=(e,t,a,s,n,l)=>{t.addEventListener("input",(t=>{const r=t.target,i=Number(r.value),d=i<10?`0${i}`:`${i}`;if("hours"!==n||12!==l)return a.value=d,void P(e,t,d,n);i0?(a.value=d,e.selectedKeeping="AM",s.innerText=e.selectedKeeping,P(e,t,d,n)):(0===i?(e.selectedKeeping="AM",s.innerText="AM"):(e.selectedKeeping="PM",s.innerText="PM"),a.value=h(r.value),P(e,t,h(r.value),n))}))},I=(e,t,a,s,n,l)=>{a.addEventListener("change",(a=>{const r=a.target,i=Number(r.value),d=i<10?`0${i}`:`${i}`;"hours"===n&&12===l?r.value&&i<=l&&i>0?(r.value=d,t.value=k(d,e.selectedKeeping),P(e,a,d,n)):r.value&&i<24&&(i>l||0===i)?(0===i?(e.selectedKeeping="AM",s.innerText="AM"):(e.selectedKeeping="PM",s.innerText="PM"),r.value=h(r.value),t.value=d,P(e,a,h(r.value),n)):r.value=e.selectedHours:r.value&&i<=l&&i>=0?(r.value=d,t.value=d,P(e,a,d,n)):"hours"===n?r.value=e.selectedHours:"minutes"===n&&(r.value=e.selectedMinutes)}))},B=(e,t,a)=>{const s=24===a?23:a||12,n=N(t,e.CSSClasses.timeRange,"hours"),l=N(t,e.CSSClasses.timeRange,"minutes"),r=N(t,e.CSSClasses.timeHours,"hours"),i=N(t,e.CSSClasses.timeMinutes,"minutes"),d=t.querySelector(`.${e.CSSClasses.timeKeeping}`);A(n,r,e.CSSClasses.isFocus),A(l,i,e.CSSClasses.isFocus),F(e,n,r,d,"hours",s),F(e,l,i,d,"minutes",0),I(e,n,r,d,"hours",s),I(e,l,i,d,"minutes",59),d&&((e,t,a)=>{t.addEventListener("click",(s=>{e.selectedKeeping=t.innerText.includes("AM")?"PM":"AM",t.innerText=e.selectedKeeping,a.value=k(e.selectedHours,e.selectedKeeping),P(e,s,e.selectedHours,"hours")}))})(e,d,n)},q=(e,t,a,s)=>`\n\t\n\t\t \n\t \n`,K=(e,t,a,s,n,l)=>`\n\t\n\t\t \n\t \n`,W=e=>{const t=[...e.locale.weekday];if(!t[0])return;e.settings.iso8601&&t.push(t.shift());e.HTMLElement.querySelectorAll(`.${e.CSSClasses.week}`).forEach((a=>((e,t,a)=>{const s=document.createElement("b");t.innerHTML="";for(let n=0;n{const l=t.cloneNode(!1);return l.className=`${e.CSSClasses.yearsYear}${a===n?` ${e.CSSClasses.yearsYearSelected}`:s?` ${e.CSSClasses.yearsYearDisabled}`:""}`,l.dataset.calendarYear=String(n),l.title=String(n),l.innerText=String(n),s&&(l.tabIndex=-1),l},j=(e,t)=>{const a=(null==t?void 0:t.dataset.calendarSelectedYear)?Number(null==t?void 0:t.dataset.calendarSelectedYear):e.selectedYear;e.currentType="year",L(e,t),H(e),C(e);const s=e.HTMLElement.querySelector(`.${e.CSSClasses.years}`);if(!e.settings.selection.year||!s)return;s.classList.add(e.CSSClasses.yearsSelecting);const n="multiple"!==e.type||e.selectedYear===a?0:1,l=document.createElement("button");l.type="button";for(let r=e.viewYear-7;re.dateMax.getFullYear();s.append(O(e,l,a,t,r))}},R=["light","dark","system"],G={value:!1,set:()=>{G.value=!0},check:()=>G.value},V=(e,t)=>R.find((a=>{var s;return"system"!==a&&(null==(s=e.getAttribute(t))?void 0:s.includes(a))})),z=(e,t)=>{e.dataset.calendarTheme=t},U=(e,t)=>{const a=t=>z(e.HTMLElement,t.matches?"dark":"light");a(t),"system"!==e.settings.visibility.theme||G.check()||(t.addEventListener("change",a),G.set())},J=(e,t)=>{const a=e.settings.visibility.themeDetect?document.querySelector(e.settings.visibility.themeDetect):null;if(a){const s=e.settings.visibility.themeDetect.replace(/^.*\[(.+)\]/g,((e,t)=>t)),n=V(a,s);n?(z(e.HTMLElement,n),((e,t,a)=>{new MutationObserver((s=>{for(let n=0;n{const t={default:()=>{W(e),w(e)},multiple:()=>{W(e),w(e)},month:()=>_(e),year:()=>j(e)};(e=>{if(!R.includes(e.settings.visibility.theme))throw new Error('Incorrect name of theme in "settings.visibility.theme"');let t;if("not all"===window.matchMedia("(prefers-color-scheme)").media)return void z(e.HTMLElement,"light");t=window.matchMedia("(prefers-color-scheme: dark)"),{light:()=>z(e.HTMLElement,"light"),dark:()=>z(e.HTMLElement,"dark"),system:()=>J(e,t)}[e.settings.visibility.theme]()})(e),(e=>{if("define"!==e.settings.lang||!e.locale.weekday[6]||!e.locale.months[11]){if("define"===e.settings.lang)throw new Error('You specified "define" for "settings.lang" but did not provide the required values for "locale.weekday" or "locale.months".');e.locale.weekday=[],e.locale.months=[];for(let t=0;t<7;t++)M(e,t);for(let t=0;t<12;t++)S(e,t)}})(e),L(e),H(e),C(e),(e=>{const t=e.HTMLElement.querySelector(`.${e.CSSClasses.time}`);if(!t)return;const a=!0===e.settings.selection.time?12:e.settings.selection.time,s="range"===e.settings.selection.controlTime,[n,l]=[0,23],[r,i]=[0,59];t.innerHTML=`\n\t\t\n\t\t\t${q("hours",e.CSSClasses.timeHours,e.selectedHours,s)}\n\t\t\t${q("minutes",e.CSSClasses.timeMinutes,e.selectedMinutes,s)}\n\t\t\t${12===a?`\n\t\t\t${e.selectedKeeping} `:""}\n\t\t
\n\t\t\n\t\t\t${K("hours",e.CSSClasses.timeRange,n,l,e.settings.selection.stepHours,e.selectedKeeping?k(e.selectedHours,e.selectedKeeping):e.selectedHours)}\n\t\t\t${K("minutes",e.CSSClasses.timeRange,r,i,e.settings.selection.stepMinutes,e.selectedMinutes)}\n\t\t
\n\t`,B(e,t,a)})(e),t[e.currentType]()},X=e=>{y(e),Q(e)},Z=(e,t)=>{const a=m(u(new Date(e.selectedYear,e.selectedMonth,1)));({prev:()=>a.setMonth(a.getMonth()-e.jumpMonths),next:()=>a.setMonth(a.getMonth()+e.jumpMonths)})[t](),[e.selectedMonth,e.selectedYear]=[a.getMonth(),a.getFullYear()],H(e),C(e),w(e)};let ee=null;const te=e=>{var t,a;if(!(null==ee?void 0:ee.selectedDates))return;const s=u(e);if(null==(t=ee.rangeDisabled)?void 0:t.includes(s))return;const n=null==(a=ee.HTMLElement)?void 0:a.querySelectorAll(`[data-calendar-day="${s}"]`);null==n||n.forEach((e=>e.classList.add(ee.CSSClasses.dayBtnHover)))},ae=e=>{if(!e.target||!(null==ee?void 0:ee.selectedDates))return;(()=>{var e;const t=null==(e=null==ee?void 0:ee.HTMLElement)?void 0:e.querySelectorAll(`.${ee.CSSClasses.dayBtnHover}`);null==t||t.forEach((e=>e.classList.remove(ee.CSSClasses.dayBtnHover)))})();const t=e.target.closest("[data-calendar-day]");if(!t)return;const a=t.dataset.calendarDay,s=m(ee.selectedDates[0]),n=m(a),[l,r]=s{ee&&"Escape"===e.key&&(ee.selectedDates=[],ee.HTMLElement.removeEventListener("mousemove",ae),document.removeEventListener("keydown",se),Q(ee))},ne=(e,t)=>{const a=t.dataset.calendarDay,s=1===e.selectedDates.length&&e.selectedDates[0].includes(a);e.selectedDates=s?[]:e.selectedDates.length>1?[a]:[...e.selectedDates,a],ee=e;({set:()=>{e.HTMLElement.addEventListener("mousemove",ae),document.addEventListener("keydown",se),e.settings.range.disableGaps&&(()=>{var e,t;if(!(null==(e=null==ee?void 0:ee.selectedDates)?void 0:e[0])||!ee.rangeDisabled||(null==(t=ee.rangeDisabled)?void 0:t.length)<2)return;const a=m(ee.selectedDates[0]),[s,n]=ee.rangeDisabled.map((e=>m(e))).reduce((([e,t],s)=>[a>=s?s:e,a{var t;const[a,s]=e.selectedDates.map((e=>m(e))),n=s>a?1:-1;e.selectedDates=[];for(let l=new Date(a);s>a?l<=s:l>=s;l.setDate(l.getDate()+n)){const a=u(l);(null==(t=e.rangeDisabled)?void 0:t.includes(a))||(e.selectedDates=e.selectedDates?[...e.selectedDates,a]:[a])}e.HTMLElement.removeEventListener("mousemove",ae),document.removeEventListener("keydown",se),e.settings.range.disableGaps&&(()=>{if(!ee)return;const e=m(ee.settings.range.min);ee.rangeMin=ee.settings.range.disablePast&&e{if(!t.dataset.calendarDay)return;const s=t.dataset.calendarDay,n=t.classList.contains(e.CSSClasses.dayBtnSelected);e.selectedDates=n?e.selectedDates.filter((e=>e!==s)):a?[...e.selectedDates,s]:[s]},re=(e,t,a,s,n)=>{const l=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`),r=[...l].findIndex((e=>e.classList.contains(t))),i=Number(l[r].querySelector(`.${a}`).getAttribute(n));return"month"===e.currentType&&r>=0?s-r:"year"===e.currentType&&e.selectedYear!==i?s-1:s},ie=(e,t,a,s)=>{if(!e.settings.selection[a])return;const n=t.target,l=e=>n.closest(`.${e}`),r=l(s.header),i=l(s.item),d=l(e.CSSClasses.grid),c=l(e.CSSClasses.column);if(e.currentType!==a&&r){({year:()=>j(e,n),month:()=>_(e,n)})[a]()}else i?((e,t,a,s,n)=>{const l={year:()=>{var a,s;return null==(s=(a=e.actions).clickYear)?void 0:s.call(a,t,e.selectedYear,e.selectedMonth)},month:()=>{var a,s;return null==(s=(a=e.actions).clickMonth)?void 0:s.call(a,t,e.selectedMonth,e.selectedYear)}};({year:()=>{if("multiple"===e.type){const t=re(e,e.CSSClasses.columnYear,e.CSSClasses.year,Number(n.dataset.calendarYear),"data-calendar-selected-year"),a=e.selectedMonthe.dateMax.getMonth()&&t>=e.dateMax.getFullYear(),l=te.dateMax.getFullYear();a||l?(e.selectedYear=e.dateMin.getFullYear(),e.selectedMonth=e.dateMin.getMonth()):s||r?(e.selectedYear=e.dateMax.getFullYear(),e.selectedMonth=e.dateMax.getMonth()):e.selectedYear=t}else e.selectedYear=Number(n.dataset.calendarYear)},month:()=>{if("multiple"===e.type){const t=re(e,e.CSSClasses.columnMonth,e.CSSClasses.month,Number(n.dataset.calendarMonth),"data-calendar-selected-month"),a=n.closest(`.${s.column}`).querySelector(`.${e.CSSClasses.year}`);e.selectedYear=Number(a.dataset.calendarSelectedYear);const l=te.dateMax.getMonth()&&e.selectedYear>=e.dateMax.getFullYear();e.selectedMonth=l?e.dateMin.getMonth():r?e.dateMax.getMonth():t}else e.selectedMonth=Number(n.dataset.calendarMonth)}})[a](),l[a](),e.currentType=e.type,Q(e)})(e,t,a,s,i):(e.currentType===a&&r||"multiple"===e.type&&e.currentType===a&&d&&!c)&&(e.currentType=e.type,Q(e))},de=e=>{e.HTMLElement.addEventListener("click",(t=>{((e,t)=>{const a=t.target.closest(`.${e.CSSClasses.arrow}`);a&&(["default","multiple"].includes(e.currentType)?Z(e,a.dataset.calendarArrow):"year"===e.currentType&&void 0!==e.viewYear&&(e.viewYear+={prev:-15,next:15}[a.dataset.calendarArrow],j(e,t.target)),e.actions.clickArrow&&e.actions.clickArrow(t,e.selectedYear,e.selectedMonth))})(e,t),((e,t)=>{var a;if(!e.settings.visibility.weekNumbers||!e.actions.clickWeekNumber)return;const s=t.target.closest(`.${e.CSSClasses.weekNumber}`),n=null==(a=e.HTMLElement)?void 0:a.querySelectorAll("[data-calendar-week-number]");if(!s||!n)return;const l=Number(s.innerText),r=Number(s.dataset.calendarYearWeek),i=[...n].filter((e=>Number(e.dataset.calendarWeekNumber)===l));e.actions.clickWeekNumber(t,l,i,r)})(e,t),((e,t)=>{var a;const s=t.target,n=e=>s.closest(`.${e}`),l=n(e.CSSClasses.dayBtn);if(!e.settings.selection.day||!["single","multiple","multiple-ranged"].includes(e.settings.selection.day)||!l)return;({single:()=>le(e,l,!1),multiple:()=>le(e,l,!1),"multiple-ranged":()=>ne(e,l)})[e.settings.selection.day](),null==(a=e.selectedDates)||a.sort(((e,t)=>+new Date(e)-+new Date(t))),e.actions.clickDay&&e.actions.clickDay(t,e.selectedDates),e.input&&e.HTMLInputElement&&e.HTMLElement&&e.actions.changeToInput&&e.actions.changeToInput(t,x(e),e.selectedDates,e.selectedTime,e.selectedHours,e.selectedMinutes,e.selectedKeeping);const r=n(e.CSSClasses.dayBtnPrev),i=n(e.CSSClasses.dayBtnNext);({prev:()=>Z(e,"prev"),next:()=>Z(e,"next"),default:()=>w(e)})[r?"prev":i?"next":"default"]()})(e,t),ie(e,t,"month",{header:e.CSSClasses.month,item:e.CSSClasses.monthsMonth,column:e.CSSClasses.columnMonth}),ie(e,t,"year",{header:e.CSSClasses.year,item:e.CSSClasses.yearsYear,column:e.CSSClasses.columnYear})}))},ce=(e,t)=>{let a=e.offsetHeight,s=0;for(let n=e;n;n=n.offsetParent)a+=n.offsetTop||0,s+=n.offsetLeft||0;Object.assign(t.style,{left:`${s}px`,top:`${a}px`})},oe=e=>{let t=!0;e.HTMLInputElement=e.HTMLElement;const a=t=>{var s;e&&t.target!==e.HTMLInputElement&&!(null==(s=e.HTMLElement)?void 0:s.contains(t.target))&&(e.HTMLInputElement&&e.HTMLElement&&x(e).hide(),document.removeEventListener("click",a,{capture:!0}))};e.HTMLInputElement.addEventListener("click",(()=>{t?(()=>{const a=document.createElement("div");a.className=`${e.CSSClasses.calendar} ${e.CSSClasses.calendarToInput} ${e.CSSClasses.calendarHidden}`,ce(e.HTMLInputElement,a),e.HTMLElement=a,document.body.append(e.HTMLElement),t=!1,setTimeout((()=>x(e).show()),0),X(e),de(e)})():(ce(e.HTMLInputElement,e.HTMLElement),x(e).show()),document.addEventListener("click",a,{capture:!0})}))};return class extends o{constructor(e,t){var a,s,n,r,i,d;if(super(),l(this,"reset",(()=>X(this))),l(this,"update",(()=>(e=>{const{dates:t,month:a,year:s}=e.settings.selected;e.settings.selected.dates=e.selectedDates,e.settings.selected.month=e.selectedMonth,e.settings.selected.year=e.selectedYear,y(e),Q(e),e.settings.selected={dates:t,month:a,year:s}})(this))),l(this,"init",(()=>{return(e=this).HTMLOriginalElement=e.HTMLElement.cloneNode(!0),void(e.input?oe(e):(y(e),Q(e),de(e)));var e})),l(this,"destroy",(()=>(e=>{var t,a,s,n;e.input?(null==(a=null==(t=e.HTMLElement)?void 0:t.parentNode)||a.removeChild(e.HTMLElement),null==(s=e.HTMLInputElement)||s.replaceWith(e.HTMLOriginalElement),e.HTMLInputElement=void 0):null==(n=e.HTMLElement)||n.replaceWith(e.HTMLOriginalElement),e.HTMLElement=e.HTMLOriginalElement})(this))),this.HTMLElement="string"==typeof e?document.querySelector(e):e,!this.HTMLElement)throw new Error(`${e} is not found, check the first argument passed to new VanillaCalendar.`);if(!t)return;this.settings.range.min=null!=(n=null==(s=null==(a=null==t?void 0:t.settings)?void 0:a.range)?void 0:s.min)?n:this.date.min,this.settings.range.max=null!=(d=null==(i=null==(r=null==t?void 0:t.settings)?void 0:r.range)?void 0:i.max)?d:this.date.max;const c=(e,t)=>{Object.keys(t).forEach((a=>{"object"==typeof e[a]&&"object"==typeof t[a]?c(e[a],t[a]):e[a]=t[a]}))};c(this,t)}}}));
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VanillaCalendar=t()}(this,(function(){"use strict";var e=Object.defineProperty,t=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,n=(t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s,l=(e,t,a)=>(n(e,"symbol"!=typeof t?t+"":t,a),a);const r={calendar:"vanilla-calendar",calendarDefault:"vanilla-calendar_default",calendarMultiple:"vanilla-calendar_multiple",calendarMonth:"vanilla-calendar_month",calendarYear:"vanilla-calendar_year",calendarHidden:"vanilla-calendar_hidden",calendarToInput:"vanilla-calendar_to-input",controls:"vanilla-calendar-controls",grid:"vanilla-calendar-grid",gridDisabled:"vanilla-calendar-grid_disabled",column:"vanilla-calendar-column",columnMonth:"vanilla-calendar-column_month",columnYear:"vanilla-calendar-column_year",header:"vanilla-calendar-header",headerContent:"vanilla-calendar-header__content",month:"vanilla-calendar-month",monthDisabled:"vanilla-calendar-month_disabled",year:"vanilla-calendar-year",yearDisabled:"vanilla-calendar-year_disabled",arrow:"vanilla-calendar-arrow",arrowPrev:"vanilla-calendar-arrow_prev",arrowNext:"vanilla-calendar-arrow_next",wrapper:"vanilla-calendar-wrapper",content:"vanilla-calendar-content",week:"vanilla-calendar-week",weekDay:"vanilla-calendar-week__day",weekDayWeekend:"vanilla-calendar-week__day_weekend",days:"vanilla-calendar-days",daysSelecting:"vanilla-calendar-days_selecting",months:"vanilla-calendar-months",monthsSelecting:"vanilla-calendar-months_selecting",monthsMonth:"vanilla-calendar-months__month",monthsMonthSelected:"vanilla-calendar-months__month_selected",monthsMonthDisabled:"vanilla-calendar-months__month_disabled",years:"vanilla-calendar-years",yearsSelecting:"vanilla-calendar-years_selecting",yearsYear:"vanilla-calendar-years__year",yearsYearSelected:"vanilla-calendar-years__year_selected",yearsYearDisabled:"vanilla-calendar-years__year_disabled",time:"vanilla-calendar-time",timeContent:"vanilla-calendar-time__content",timeHours:"vanilla-calendar-time__hours",timeMinutes:"vanilla-calendar-time__minutes",timeKeeping:"vanilla-calendar-time__keeping",timeRanges:"vanilla-calendar-time__ranges",timeRange:"vanilla-calendar-time__range",day:"vanilla-calendar-day",daySelected:"vanilla-calendar-day_selected",daySelectedFirst:"vanilla-calendar-day_selected-first",daySelectedLast:"vanilla-calendar-day_selected-last",daySelectedIntermediate:"vanilla-calendar-day_selected-intermediate",dayPopup:"vanilla-calendar-day__popup",dayBtn:"vanilla-calendar-day__btn",dayBtnPrev:"vanilla-calendar-day__btn_prev",dayBtnNext:"vanilla-calendar-day__btn_next",dayBtnToday:"vanilla-calendar-day__btn_today",dayBtnSelected:"vanilla-calendar-day__btn_selected",dayBtnSelectedFirst:"vanilla-calendar-day__btn_selected_first",dayBtnSelectedLast:"vanilla-calendar-day__btn_selected_last",dayBtnSelectedIntermediate:"vanilla-calendar-day__btn_selected_intermediate",dayBtnHover:"vanilla-calendar-day__btn_hover",dayBtnDisabled:"vanilla-calendar-day__btn_disabled",dayBtnWeekend:"vanilla-calendar-day__btn_weekend",dayBtnHoliday:"vanilla-calendar-day__btn_holiday",weekNumbers:"vanilla-calendar-week-numbers",weekNumbersTitle:"vanilla-calendar-week-numbers__title",weekNumbersContent:"vanilla-calendar-week-numbers__content",weekNumber:"vanilla-calendar-week-number",isFocus:"vanilla-calendar-is-focus"},i=e=>`\n\t\n\t\t<#ArrowPrev />\n\t\t<#ArrowNext />\n\t
\n\t\n\t\t<#Multiple>\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t<#WeekNumbers />\n\t\t\t\t\t
\n\t\t\t\t\t\t<#Week />\n\t\t\t\t\t\t<#Days />\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t<#/Multiple>\n\t
\n\t<#ControlTime />\n`,d=e=>`\n\t\n\t\n\t\t
\n\t\t\t<#Months />\n\t\t
\n\t
\n`,c=e=>`\n\t\n\t\n\t\t
\n\t\t\t<#Years />\n\t\t
\n\t
\n`;class o{constructor(){var e;l(this,"input",!1),l(this,"type","default"),l(this,"months",2),l(this,"jumpMonths",1),l(this,"date",{min:"1970-01-01",max:"2470-12-31",today:new Date}),l(this,"settings",{lang:"en",iso8601:!0,range:{min:this.date.min,max:this.date.max,disablePast:!1,disableGaps:!1,disableAllDays:!1,disableWeekday:void 0,disabled:void 0,enabled:void 0},selection:{day:"single",month:!0,year:!0,time:!1,controlTime:"all",stepHours:1,stepMinutes:1},selected:{dates:void 0,month:void 0,year:void 0,holidays:void 0,time:void 0},visibility:{theme:"system",themeDetect:"html[data-theme]",monthShort:!0,weekNumbers:!1,weekend:!0,today:!0,disabled:!1,daysOutside:!0}}),l(this,"locale",{months:[],weekday:[]}),l(this,"actions",{clickDay:null,clickWeekNumber:null,clickMonth:null,clickYear:null,clickArrow:null,changeTime:null,changeToInput:null,getDays:null,hideCalendar:null,showCalendar:null}),l(this,"popups",{}),l(this,"CSSClasses",((e,l)=>{for(var r in l||(l={}))a.call(l,r)&&n(e,r,l[r]);if(t)for(var r of t(l))s.call(l,r)&&n(e,r,l[r]);return e})({},r)),l(this,"DOMTemplates",{default:(e=this.CSSClasses,`\n\t\n\t\n\t\t<#WeekNumbers />\n\t\t
\n\t\t\t<#Week />\n\t\t\t<#Days />\n\t\t
\n\t
\n\t<#ControlTime />\n`),multiple:i(this.CSSClasses),month:d(this.CSSClasses),year:c(this.CSSClasses)}),l(this,"HTMLElement"),l(this,"HTMLOriginalElement"),l(this,"HTMLInputElement"),l(this,"rangeMin"),l(this,"rangeMax"),l(this,"rangeDisabled"),l(this,"rangeEnabled"),l(this,"selectedDates"),l(this,"selectedHolidays"),l(this,"selectedMonth"),l(this,"selectedYear"),l(this,"selectedHours"),l(this,"selectedMinutes"),l(this,"selectedKeeping"),l(this,"selectedTime"),l(this,"userTime"),l(this,"currentType"),l(this,"correctMonths"),l(this,"viewYear"),l(this,"dateMin"),l(this,"dateMax")}}const u=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,m=e=>new Date(`${e}T00:00:00`),g=e=>e.reduce(((e,t)=>(t.match(/^(\d{4}-\d{2}-\d{2})$/g)?e.push(t):t.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g,((t,a,s)=>{const n=m(a),l=m(s),r=new Date(n.getTime());for(;r<=l;r.setDate(r.getDate()+1))e.push(u(r));return t})),e)),[]),h=e=>e?{0:"12",13:"01",14:"02",15:"03",16:"04",17:"05",18:"06",19:"07",20:"08",21:"09",22:"10",23:"11"}[Number(e)]||String(e):"",v=e=>{e.currentType=e.type,(e=>{const t=void 0!==e.settings.selected.month&&Number(e.settings.selected.month)>=0&&Number(e.settings.selected.month)<12,a=void 0!==e.settings.selected.year&&Number(e.settings.selected.year)>=0&&Number(e.settings.selected.year)<=9999;e.selectedMonth=t?Number(e.settings.selected.month):e.date.today.getMonth(),e.selectedYear=a?Number(e.settings.selected.year):e.date.today.getFullYear(),e.viewYear=e.selectedYear})(e),(e=>{var t,a,s;const n=e.settings.range.disablePast&&!e.settings.range.disableAllDays&&m(e.settings.range.min)+new Date(e)-+new Date(t))),e.rangeEnabled=e.settings.range.enabled?g(e.settings.range.enabled):[],(null==(t=e.rangeEnabled)?void 0:t[0])&&(e.rangeDisabled=null==(a=e.rangeDisabled)?void 0:a.filter((t=>{var a;return!(null==(a=e.rangeEnabled)?void 0:a.includes(t))}))),e.rangeEnabled.sort(((e,t)=>+new Date(e)-+new Date(t))),(null==(s=e.rangeEnabled)?void 0:s[0])&&e.settings.range.disableAllDays&&(e.rangeMin=e.rangeEnabled[0],e.rangeMax=e.rangeEnabled[e.rangeEnabled.length-1])})(e),(e=>{var t,a;e.selectedDates=(null==(t=e.settings.selected.dates)?void 0:t[0])?g(e.settings.selected.dates):[],e.selectedHolidays=(null==(a=e.settings.selected.holidays)?void 0:a[0])?g(e.settings.selected.holidays):[]})(e),(e=>{e.dateMin=e.settings.visibility.disabled?m(e.date.min):m(e.rangeMin),e.dateMax=e.settings.visibility.disabled?m(e.date.max):m(e.rangeMax)})(e),(e=>{const t=!0===e.settings.selection.time||12===e.settings.selection.time;if(t||24===e.settings.selection.time){if(e.userTime=!1,"string"==typeof e.settings.selected.time){const a=t?/^([0-9]|0[1-9]|1[0-2]):([0-5][0-9])|(AM|PM)/g:/^([0-1]?[0-9]|2[0-3]):([0-5][0-9])/g;e.settings.selected.time.replace(a,((a,s,n,l)=>(s&&n&&(e.userTime=!0,e.selectedHours=s,e.selectedMinutes=n),l&&t?e.selectedKeeping=l:t&&(e.selectedKeeping="AM"),"")))}!e.userTime&&t?(e.selectedHours=h(String(e.date.today.getHours())),e.selectedMinutes=String(e.date.today.getMinutes()),e.selectedKeeping=Number(e.date.today.getHours())>=12?"PM":"AM"):e.userTime||(e.selectedHours=String(e.date.today.getHours()),e.selectedMinutes=String(e.date.today.getMinutes())),e.selectedHours=Number(e.selectedHours)<10?`0${Number(e.selectedHours)}`:`${e.selectedHours}`,e.selectedMinutes=Number(e.selectedMinutes)<10?`0${Number(e.selectedMinutes)}`:`${e.selectedMinutes}`,e.selectedTime=`${e.selectedHours}:${e.selectedMinutes}${e.selectedKeeping?` ${e.selectedKeeping}`:""}`}else e.settings.selection.time&&(e.settings.selection.time=!1,console.error("The value of the time property can be: false, true, 12 or 24."))})(e),(e=>{e.correctMonths="multiple"===e.type?1===e.months?2:e.months>12?12:e.months:1})(e)},y=e=>`${e.charAt(0).toUpperCase()}${e.substring(1,e.length)}`.replace(/\./,""),M=(e,t)=>{const a=new Date(0,0,t).toLocaleString(e.settings.lang,{weekday:"short"});e.locale.weekday.push(y(a))},S=(e,t)=>{const a=new Date(0,t).toLocaleString(e.settings.lang,{month:"long"});e.locale.months.push(y(a))},p=({arrowPrev:e,arrowNext:t,isPrevHidden:a,isNextHidden:s})=>{e.style.visibility=a?"hidden":"",t.style.visibility=s?"hidden":""},C=e=>{var t,a;if("month"===e.currentType)return;const s=null==(t=e.HTMLElement)?void 0:t.querySelector(`.${e.CSSClasses.arrowPrev}`),n=null==(a=e.HTMLElement)?void 0:a.querySelector(`.${e.CSSClasses.arrowNext}`);if(!s||!n)return;({default:()=>{const t=m(u(new Date(e.selectedYear,e.selectedMonth,1))),a=new Date(t.getTime()),l=new Date(t.getTime());a.setMonth(a.getMonth()-e.jumpMonths),l.setMonth(l.getMonth()+e.jumpMonths),e.settings.selection.year||(e.dateMin.setFullYear(t.getFullYear()),e.dateMax.setFullYear(t.getFullYear()));const r=!e.settings.selection.month||a.getFullYear()e.dateMax.getFullYear()||l.getFullYear()===e.dateMax.getFullYear()&&l.getMonth()>e.dateMax.getMonth();p({arrowPrev:s,arrowNext:n,isPrevHidden:r,isNextHidden:i})},year:()=>{p({arrowPrev:s,arrowNext:n,isPrevHidden:e.dateMin.getFullYear()&&e.viewYear-7<=e.dateMin.getFullYear(),isNextHidden:e.dateMax.getFullYear()&&e.viewYear+7>=e.dateMax.getFullYear()})}})["multiple"===e.currentType?"default":e.currentType]()},b=(e,t)=>{if(!e)return null;const a=m(e),s=t?a.getDay()||7:a.getDay();a.setDate(a.getDate()+4-s);const n=new Date(a.getFullYear(),0,1),l=Math.ceil(((+a-+n)/864e5+1)/7);return{year:a.getFullYear(),week:l}},f=(e,t,a,s,n)=>{const l=t[a].querySelector(`.${e.CSSClasses.dayBtn}`),r=b(null==l?void 0:l.dataset.calendarDay,e.settings.iso8601);if(!r)return;const i=s.cloneNode(!0);i.innerText=String(r.week),i.dataset.calendarYearWeek=String(r.year),n.append(i)},D=(e,t,a,s,n,l,r,i)=>{const d=document.createElement("div");d.className=e.CSSClasses.day;const c=document.createElement("button");c.className=`${e.CSSClasses.dayBtn}${i?` ${i}`:""}`,c.type="button",c.innerText=String(s),c.dataset.calendarDay=l;e.settings.visibility.weekNumbers&&(()=>{const t=b(l,e.settings.iso8601);t&&(c.dataset.calendarWeekNumber=String(t.week))})(),r?e.settings.visibility.daysOutside&&d.append(c):d.append(c),((e,t,a)=>{var s,n,l;(null==(s=e.settings.range.disableWeekday)?void 0:s.includes(a))&&!(null==(n=e.rangeDisabled)?void 0:n.includes(t))&&(e.rangeDisabled=e.rangeDisabled?[...e.rangeDisabled,t]:[t],null==(l=e.rangeDisabled)||l.sort(((e,t)=>+new Date(e)-+new Date(t))))})(e,l,n),((e,t,a,s,n,l,r)=>{var i,d,c;(m(e.rangeMin)>m(l)||m(e.rangeMax)1&&"multiple-ranged"===e.settings.selection.day&&(e.selectedDates[0]===l?(a.classList.add(e.CSSClasses.daySelectedFirst),s.classList.add(e.CSSClasses.daySelectedFirst)):e.selectedDates[e.selectedDates.length-1]===l?(a.classList.add(e.CSSClasses.daySelectedLast),s.classList.add(e.CSSClasses.dayBtnSelectedLast)):(a.classList.add(e.CSSClasses.daySelectedIntermediate),s.classList.add(e.CSSClasses.dayBtnSelectedIntermediate))))})(e,t,d,c,n,l,r),a.append(d),e.actions.getDays&&e.actions.getDays(s,l,d,c)},w=e=>{const t=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.days}`),a=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.weekNumbers}`),s=new Date(e.selectedYear,e.selectedMonth,1);t.forEach(((t,n)=>{const l=new Date(s);l.setMonth(l.getMonth()+n);const r=l.getMonth(),i=l.getFullYear(),d=new Date(i,r,1),c=new Date(i,r+1,0).getDate(),o=e.settings.iso8601?(0!==d.getDay()?d.getDay():7)-1:d.getDay();e.settings.selection.day&&t.classList.add(e.CSSClasses.daysSelecting),t.innerHTML="",((e,t,a,s,n)=>{let l=new Date(a,s,0).getDate()-(n-1);const r=0===s?a-1:a,i=0===s?12:s<10?`0${s}`:s;for(let d=n;d>0;d--,l++){const s=`${r}-${i}-${l}`,n=m(s).getDay();D(e,a,t,l,n,s,!0,e.CSSClasses.dayBtnPrev)}})(e,t,i,r,o),((e,t,a,s,n)=>{for(let l=1;l<=a;l++){const a=new Date(s,n,l),r=u(a),i=a.getDay();D(e,s,t,l,i,r,!1,null)}})(e,t,c,i,r),((e,t,a,s,n,l)=>{const r=l+a,i=7*Math.ceil(r/7)-r,d=n+1===12?s+1:s,c=n+1===12?"01":n+2<10?`0${n+2}`:n+2;for(let o=1;o<=i;o++){const a=`${d}-${c}-${o<10?`0${o}`:String(o)}`,n=m(a).getDay();D(e,s,t,o,n,a,!0,e.CSSClasses.dayBtnNext)}})(e,t,c,i,r,o),((e,t,a,s,n)=>{if(!e.settings.visibility.weekNumbers)return;s.innerHTML="";const l=document.createElement("b");l.className=e.CSSClasses.weekNumbersTitle,l.innerText="#",s.append(l);const r=document.createElement("div");r.className=e.CSSClasses.weekNumbersContent,s.append(r);const i=document.createElement("button");i.type="button",i.className=e.CSSClasses.weekNumber;const d=n.querySelectorAll(`.${e.CSSClasses.day}`),c=Math.ceil((t+a)/7);for(let o=0;o{var a;e.popups&&(null==(a=Object.entries(e.popups))||a.forEach((([a,s])=>((e,t,a,s)=>{const n=a.querySelector(`[data-calendar-day="${e}"]`);n&&((null==t?void 0:t.modifier)&&n.classList.add(...t.modifier.trim().split(" ")),(null==t?void 0:t.html)&&(n.parentNode.innerHTML+=`${t.html}
`))})(a,s,t,e.CSSClasses.dayPopup))))})(e,t)}))},T=Object.freeze(Object.defineProperty({__proto__:null,ArrowNext:e=>`\n\t\n\t \n`,ArrowPrev:e=>`\n\t\n\t \n`,ControlTime:e=>e.settings.selection.time?`\n\t
\n`:"",Days:e=>`\n\t
\n`,Month:e=>`\n\t\n\t \n`,Months:e=>`\n\t
\n`,Week:e=>`\n\t
\n`,WeekNumbers:e=>e.settings.visibility.weekNumbers?`\n\t
\n`:"",Year:e=>`\n\t\n\t \n`,Years:e=>`\n\t
\n`},Symbol.toStringTag,{value:"Module"})),$=(e,t)=>t.replace(/<#(.*?)\/>/g,((t,a)=>{const s=(n=a.replace(/[\s\n\t]/g,""),T[n]);var n;return s?s(e):""})).replace(/[\n\t]/g,""),L=(e,t)=>{const{HTMLElement:a,CSSClasses:s,DOMTemplates:n,type:l,currentType:r,correctMonths:i}=e,d=(n,l)=>{if(!t)return;const r=a.querySelector(`.${s.controls}`);r&&a.removeChild(r);a.querySelector(`.${s.grid}`).classList.add(s.gridDisabled);const i=t.closest(`.${s.column}`);i.classList.add(n),i.innerHTML=$(e,l)},c={default:()=>{a.classList.add(s.calendarDefault),a.classList.remove(s.calendarMonth,s.calendarYear),a.innerHTML=$(e,n.default)},multiple:()=>{i&&(a.classList.add(s.calendarMultiple),a.classList.remove(s.calendarMonth,s.calendarYear),a.innerHTML=((e,t)=>t.replace(/<#Multiple>(.*?)<#\/Multiple>/g,((t,a)=>{let s="";for(let n=0;n{"multiple"!==l?(a.classList.add(s.calendarMonth),a.classList.remove(s.calendarDefault,s.calendarYear),a.innerHTML=$(e,n.month)):d(s.columnMonth,n.month)},year:()=>{"multiple"!==l?(a.classList.add(s.calendarYear),a.classList.remove(s.calendarDefault,s.calendarMonth),a.innerHTML=$(e,n.year)):d(s.columnYear,n.year)}};a.classList.add(s.calendar),c[r]()},H=e=>{var t,a;const s=null==(t=e.HTMLElement)?void 0:t.querySelectorAll("[data-calendar-selected-month]"),n=null==(a=e.HTMLElement)?void 0:a.querySelectorAll("[data-calendar-selected-year]");if(!(null==s?void 0:s[0])&&(null==n?void 0:n[0]))return;const l=new Date(e.selectedYear,e.selectedMonth,1);null==s||s.forEach(((t,a)=>((e,t,a,s)=>{const n=new Date(s.setMonth(e.selectedMonth+a)).getMonth(),l=!1===e.settings.selection.month||"only-arrows"===e.settings.selection.month;t.tabIndex=l?-1:0,t.classList.toggle(e.CSSClasses.monthDisabled,l),t.setAttribute("data-calendar-selected-month",String(n)),t.innerText=e.locale.months[n]})(e,t,a,l))),null==n||n.forEach(((t,a)=>((e,t,a,s)=>{const n=new Date(s.setFullYear(e.selectedYear,e.selectedMonth+a)).getFullYear(),l=!1===e.settings.selection.year||"only-arrows"===e.settings.selection.year;t.tabIndex=l?-1:0,t.classList.toggle(e.CSSClasses.yearDisabled,l),t.setAttribute("data-calendar-selected-year",String(n)),t.innerText=String(n)})(e,t,a,l)))},E=e=>{if("multiple"!==e.type)return 0;const t=[...e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`)].findIndex((t=>t.classList.contains(`${e.CSSClasses.columnMonth}`)));return t>0?t:0},Y=(e,t,a,s,n,l)=>{const r=t.cloneNode(!1);return r.className=`${e.CSSClasses.monthsMonth}${a===l?` ${e.CSSClasses.monthsMonthSelected}`:n?` ${e.CSSClasses.monthsMonthDisabled}`:""}`,r.title=s,r.innerText=`${e.settings.visibility.monthShort?s.substring(0,3):s}`,r.dataset.calendarMonth=String(l),n&&(r.tabIndex=-1),r},_=(e,t)=>{var a,s;const n=(null==t?void 0:t.dataset.calendarSelectedMonth)?Number(t.dataset.calendarSelectedMonth):e.selectedMonth,l=null==(a=null==t?void 0:t.closest(`.${e.CSSClasses.column}`))?void 0:a.querySelector(`.${e.CSSClasses.year}`),r=l?Number(l.dataset.calendarSelectedYear):e.selectedYear;e.currentType="month",L(e,t),H(e);const i=null==(s=e.HTMLElement)?void 0:s.querySelector(`.${e.CSSClasses.months}`);if(!e.settings.selection.month||!i)return;i.classList.add(e.CSSClasses.monthsSelecting);const d=e.jumpMonths>1?e.locale.months.map(((t,a)=>n-e.jumpMonths*a)).concat(e.locale.months.map(((t,a)=>n+e.jumpMonths*a))).filter((e=>e>=0&&e<=12)):Array.from(Array(12).keys()),c=document.createElement("button");c.type="button";for(let o=0;o<12;o++){const t=e.locale.months[o],a=oe.dateMax.getMonth()+E(e)&&r>=e.dateMax.getFullYear()||o!==n&&!d.includes(o);i.append(Y(e,c,n,t,a,o))}},k=(e,t)=>e&&t?{0:{AM:"00",PM:"12"},1:{AM:"01",PM:"13"},2:{AM:"02",PM:"14"},3:{AM:"03",PM:"15"},4:{AM:"04",PM:"16"},5:{AM:"05",PM:"17"},6:{AM:"06",PM:"18"},7:{AM:"07",PM:"19"},8:{AM:"08",PM:"20"},9:{AM:"09",PM:"21"},10:{AM:"10",PM:"22"},11:{AM:"11",PM:"23"},12:{AM:"12",PM:"12"}}[Number(e)][t]:"",x=e=>({hide(){e.HTMLElement.classList.add(e.CSSClasses.calendarHidden),e.actions.hideCalendar&&e.actions.hideCalendar(e.HTMLInputElement,e.HTMLElement)},show(){e.HTMLElement.classList.remove(e.CSSClasses.calendarHidden),e.actions.showCalendar&&e.actions.showCalendar(e.HTMLInputElement,e.HTMLElement)},HTMLInputElement:e.HTMLInputElement,HTMLElement:e.HTMLElement}),N=(e,t,a)=>e.querySelector(`.${t}${a?` input[name="${a}"]`:""}`),A=(e,t,a)=>{e.addEventListener("mouseover",(()=>t.classList.add(a))),e.addEventListener("mouseout",(()=>t.classList.remove(a)))},P=(e,t,a,s)=>{({hours:()=>{e.selectedHours=a},minutes:()=>{e.selectedMinutes=a}})[s](),e.selectedTime=`${e.selectedHours}:${e.selectedMinutes}${e.selectedKeeping?` ${e.selectedKeeping}`:""}`,e.actions.changeTime&&e.actions.changeTime(t,e.selectedTime,e.selectedHours,e.selectedMinutes,e.selectedKeeping),e.input&&e.HTMLInputElement&&e.actions.changeToInput&&e.actions.changeToInput(t,x(e),e.selectedDates,e.selectedTime,e.selectedHours,e.selectedMinutes,e.selectedKeeping)},F=(e,t,a,s,n,l)=>{t.addEventListener("input",(t=>{const r=t.target,i=Number(r.value),d=i<10?`0${i}`:`${i}`;if("hours"!==n||12!==l)return a.value=d,void P(e,t,d,n);i0?(a.value=d,e.selectedKeeping="AM",s.innerText=e.selectedKeeping,P(e,t,d,n)):(0===i?(e.selectedKeeping="AM",s.innerText="AM"):(e.selectedKeeping="PM",s.innerText="PM"),a.value=h(r.value),P(e,t,h(r.value),n))}))},I=(e,t,a,s,n,l)=>{a.addEventListener("change",(a=>{const r=a.target,i=Number(r.value),d=i<10?`0${i}`:`${i}`;"hours"===n&&12===l?r.value&&i<=l&&i>0?(r.value=d,t.value=k(d,e.selectedKeeping),P(e,a,d,n)):r.value&&i<24&&(i>l||0===i)?(0===i?(e.selectedKeeping="AM",s.innerText="AM"):(e.selectedKeeping="PM",s.innerText="PM"),r.value=h(r.value),t.value=d,P(e,a,h(r.value),n)):r.value=e.selectedHours:r.value&&i<=l&&i>=0?(r.value=d,t.value=d,P(e,a,d,n)):"hours"===n?r.value=e.selectedHours:"minutes"===n&&(r.value=e.selectedMinutes)}))},B=(e,t,a)=>{const s=24===a?23:a||12,n=N(t,e.CSSClasses.timeRange,"hours"),l=N(t,e.CSSClasses.timeRange,"minutes"),r=N(t,e.CSSClasses.timeHours,"hours"),i=N(t,e.CSSClasses.timeMinutes,"minutes"),d=t.querySelector(`.${e.CSSClasses.timeKeeping}`);A(n,r,e.CSSClasses.isFocus),A(l,i,e.CSSClasses.isFocus),F(e,n,r,d,"hours",s),F(e,l,i,d,"minutes",0),I(e,n,r,d,"hours",s),I(e,l,i,d,"minutes",59),d&&((e,t,a)=>{t.addEventListener("click",(s=>{e.selectedKeeping=t.innerText.includes("AM")?"PM":"AM",t.innerText=e.selectedKeeping,a.value=k(e.selectedHours,e.selectedKeeping),P(e,s,e.selectedHours,"hours")}))})(e,d,n)},q=(e,t,a,s)=>`\n\t\n\t\t \n\t \n`,K=(e,t,a,s,n,l)=>`\n\t\n\t\t \n\t \n`,W=e=>{const t=[...e.locale.weekday];if(!t[0])return;e.settings.iso8601&&t.push(t.shift());e.HTMLElement.querySelectorAll(`.${e.CSSClasses.week}`).forEach((a=>((e,t,a)=>{const s=document.createElement("b");t.innerHTML="";for(let n=0;n{const l=t.cloneNode(!1);return l.className=`${e.CSSClasses.yearsYear}${a===n?` ${e.CSSClasses.yearsYearSelected}`:s?` ${e.CSSClasses.yearsYearDisabled}`:""}`,l.dataset.calendarYear=String(n),l.title=String(n),l.innerText=String(n),s&&(l.tabIndex=-1),l},j=(e,t)=>{const a=(null==t?void 0:t.dataset.calendarSelectedYear)?Number(null==t?void 0:t.dataset.calendarSelectedYear):e.selectedYear;e.currentType="year",L(e,t),H(e),C(e);const s=e.HTMLElement.querySelector(`.${e.CSSClasses.years}`);if(!e.settings.selection.year||!s)return;s.classList.add(e.CSSClasses.yearsSelecting);const n="multiple"!==e.type||e.selectedYear===a?0:1,l=document.createElement("button");l.type="button";for(let r=e.viewYear-7;re.dateMax.getFullYear();s.append(O(e,l,a,t,r))}},R=["light","dark","system"],G={value:!1,set:()=>{G.value=!0},check:()=>G.value},V=(e,t)=>R.find((a=>{var s;return"system"!==a&&(null==(s=e.getAttribute(t))?void 0:s.includes(a))})),z=(e,t)=>{e.dataset.calendarTheme=t},U=(e,t)=>{const a=t=>z(e.HTMLElement,t.matches?"dark":"light");a(t),"system"!==e.settings.visibility.theme||G.check()||(t.addEventListener("change",a),G.set())},J=(e,t)=>{const a=e.settings.visibility.themeDetect?document.querySelector(e.settings.visibility.themeDetect):null;if(a){const s=e.settings.visibility.themeDetect.replace(/^.*\[(.+)\]/g,((e,t)=>t)),n=V(a,s);n?(z(e.HTMLElement,n),((e,t,a)=>{new MutationObserver((s=>{for(let n=0;n{const t={default:()=>{W(e),w(e)},multiple:()=>{W(e),w(e)},month:()=>_(e),year:()=>j(e)};(e=>{if(!R.includes(e.settings.visibility.theme))throw new Error('Incorrect name of theme in "settings.visibility.theme"');let t;if("not all"===window.matchMedia("(prefers-color-scheme)").media)return void z(e.HTMLElement,"light");t=window.matchMedia("(prefers-color-scheme: dark)"),{light:()=>z(e.HTMLElement,"light"),dark:()=>z(e.HTMLElement,"dark"),system:()=>J(e,t)}[e.settings.visibility.theme]()})(e),(e=>{if("define"!==e.settings.lang||!e.locale.weekday[6]||!e.locale.months[11]){if("define"===e.settings.lang)throw new Error('You specified "define" for "settings.lang" but did not provide the required values for "locale.weekday" or "locale.months".');e.locale.weekday=[],e.locale.months=[];for(let t=0;t<7;t++)M(e,t);for(let t=0;t<12;t++)S(e,t)}})(e),L(e),H(e),C(e),(e=>{const t=e.HTMLElement.querySelector(`.${e.CSSClasses.time}`);if(!t)return;const a=!0===e.settings.selection.time?12:e.settings.selection.time,s="range"===e.settings.selection.controlTime,[n,l]=[0,23],[r,i]=[0,59];t.innerHTML=`\n\t\t\n\t\t\t${q("hours",e.CSSClasses.timeHours,e.selectedHours,s)}\n\t\t\t${q("minutes",e.CSSClasses.timeMinutes,e.selectedMinutes,s)}\n\t\t\t${12===a?`\n\t\t\t${e.selectedKeeping} `:""}\n\t\t
\n\t\t\n\t\t\t${K("hours",e.CSSClasses.timeRange,n,l,e.settings.selection.stepHours,e.selectedKeeping?k(e.selectedHours,e.selectedKeeping):e.selectedHours)}\n\t\t\t${K("minutes",e.CSSClasses.timeRange,r,i,e.settings.selection.stepMinutes,e.selectedMinutes)}\n\t\t
\n\t`,B(e,t,a)})(e),t[e.currentType]()},X=e=>{v(e),Q(e)},Z=(e,t)=>{const a=m(u(new Date(e.selectedYear,e.selectedMonth,1)));({prev:()=>a.setMonth(a.getMonth()-e.jumpMonths),next:()=>a.setMonth(a.getMonth()+e.jumpMonths)})[t](),[e.selectedMonth,e.selectedYear]=[a.getMonth(),a.getFullYear()],H(e),C(e),w(e)},ee={self:null,rangeMin:void 0,rangeMax:void 0},te=e=>{var t,a,s;if(!(null==(t=ee.self)?void 0:t.selectedDates))return;const n=u(e);if(null==(a=ee.self.rangeDisabled)?void 0:a.includes(n))return;const l=null==(s=ee.self.HTMLElement)?void 0:s.querySelectorAll(`[data-calendar-day="${n}"]`);null==l||l.forEach((e=>e.classList.add(ee.self.CSSClasses.dayBtnHover)))},ae=e=>{var t;if(!e.target||!(null==(t=ee.self)?void 0:t.selectedDates))return;(()=>{var e,t;const a=null==(t=null==(e=ee.self)?void 0:e.HTMLElement)?void 0:t.querySelectorAll(`.${ee.self.CSSClasses.dayBtnHover}`);null==a||a.forEach((e=>e.classList.remove(ee.self.CSSClasses.dayBtnHover)))})();const a=e.target.closest("[data-calendar-day]");if(!a)return;const s=a.dataset.calendarDay,n=m(ee.self.selectedDates[0]),l=m(s),[r,i]=n{ee.self&&"Escape"===e.key&&(ee.self.selectedDates=[],ee.self.HTMLElement.removeEventListener("mousemove",ae),document.removeEventListener("keydown",se),Q(ee.self))},ne=(e,t)=>{const a=t.dataset.calendarDay,s=1===e.selectedDates.length&&e.selectedDates[0].includes(a);e.selectedDates=s?[]:e.selectedDates.length>1?[a]:[...e.selectedDates,a],e.settings.range.disableGaps&&(ee.rangeMin=ee.rangeMin?ee.rangeMin:e.rangeMin,ee.rangeMax=ee.rangeMax?ee.rangeMax:e.rangeMax),ee.self=e;({set:()=>{e.HTMLElement.addEventListener("mousemove",ae),document.addEventListener("keydown",se),e.settings.range.disableGaps&&(()=>{var e,t,a;if(!(null==(t=null==(e=ee.self)?void 0:e.selectedDates)?void 0:t[0])||!ee.self.rangeDisabled||(null==(a=ee.self.rangeDisabled)?void 0:a.length)<2)return;const s=m(ee.self.selectedDates[0]),[n,l]=ee.self.rangeDisabled.map((e=>m(e))).reduce((([e,t],a)=>[s>=a?a:e,s{var t;const[a,s]=e.selectedDates.map((e=>m(e))),n=s>a?1:-1;e.selectedDates=[];for(let l=new Date(a);s>a?l<=s:l>=s;l.setDate(l.getDate()+n)){const a=u(l);(null==(t=e.rangeDisabled)?void 0:t.includes(a))||(e.selectedDates=e.selectedDates?[...e.selectedDates,a]:[a])}e.HTMLElement.removeEventListener("mousemove",ae),document.removeEventListener("keydown",se),e.settings.range.disableGaps&&ee.self&&(ee.self.rangeMin=ee.rangeMin,ee.self.rangeMax=ee.rangeMax)}})[1===e.selectedDates.length?"set":"reset"]()},le=(e,t,a)=>{if(!t.dataset.calendarDay)return;const s=t.dataset.calendarDay,n=t.classList.contains(e.CSSClasses.dayBtnSelected);e.selectedDates=n?e.selectedDates.filter((e=>e!==s)):a?[...e.selectedDates,s]:[s]},re=(e,t,a,s,n)=>{const l=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`),r=[...l].findIndex((e=>e.classList.contains(t))),i=Number(l[r].querySelector(`.${a}`).getAttribute(n));return"month"===e.currentType&&r>=0?s-r:"year"===e.currentType&&e.selectedYear!==i?s-1:s},ie=(e,t,a,s)=>{if(!e.settings.selection[a])return;const n=t.target,l=e=>n.closest(`.${e}`),r=l(s.header),i=l(s.item),d=l(e.CSSClasses.grid),c=l(e.CSSClasses.column);if(e.currentType!==a&&r){({year:()=>j(e,n),month:()=>_(e,n)})[a]()}else i?((e,t,a,s,n)=>{const l={year:()=>{var a,s;return null==(s=(a=e.actions).clickYear)?void 0:s.call(a,t,e.selectedYear,e.selectedMonth)},month:()=>{var a,s;return null==(s=(a=e.actions).clickMonth)?void 0:s.call(a,t,e.selectedMonth,e.selectedYear)}};({year:()=>{if("multiple"===e.type){const t=re(e,e.CSSClasses.columnYear,e.CSSClasses.year,Number(n.dataset.calendarYear),"data-calendar-selected-year"),a=e.selectedMonthe.dateMax.getMonth()&&t>=e.dateMax.getFullYear(),l=te.dateMax.getFullYear();a||l?(e.selectedYear=e.dateMin.getFullYear(),e.selectedMonth=e.dateMin.getMonth()):s||r?(e.selectedYear=e.dateMax.getFullYear(),e.selectedMonth=e.dateMax.getMonth()):e.selectedYear=t}else e.selectedYear=Number(n.dataset.calendarYear)},month:()=>{if("multiple"===e.type){const t=re(e,e.CSSClasses.columnMonth,e.CSSClasses.month,Number(n.dataset.calendarMonth),"data-calendar-selected-month"),a=n.closest(`.${s.column}`).querySelector(`.${e.CSSClasses.year}`);e.selectedYear=Number(a.dataset.calendarSelectedYear);const l=te.dateMax.getMonth()&&e.selectedYear>=e.dateMax.getFullYear();e.selectedMonth=l?e.dateMin.getMonth():r?e.dateMax.getMonth():t}else e.selectedMonth=Number(n.dataset.calendarMonth)}})[a](),l[a](),e.currentType=e.type,Q(e)})(e,t,a,s,i):(e.currentType===a&&r||"multiple"===e.type&&e.currentType===a&&d&&!c)&&(e.currentType=e.type,Q(e))},de=e=>{e.HTMLElement.addEventListener("click",(t=>{((e,t)=>{const a=t.target.closest(`.${e.CSSClasses.arrow}`);a&&(["default","multiple"].includes(e.currentType)?Z(e,a.dataset.calendarArrow):"year"===e.currentType&&void 0!==e.viewYear&&(e.viewYear+={prev:-15,next:15}[a.dataset.calendarArrow],j(e,t.target)),e.actions.clickArrow&&e.actions.clickArrow(t,e.selectedYear,e.selectedMonth))})(e,t),((e,t)=>{var a;if(!e.settings.visibility.weekNumbers||!e.actions.clickWeekNumber)return;const s=t.target.closest(`.${e.CSSClasses.weekNumber}`),n=null==(a=e.HTMLElement)?void 0:a.querySelectorAll("[data-calendar-week-number]");if(!s||!n)return;const l=Number(s.innerText),r=Number(s.dataset.calendarYearWeek),i=[...n].filter((e=>Number(e.dataset.calendarWeekNumber)===l));e.actions.clickWeekNumber(t,l,i,r)})(e,t),((e,t)=>{var a;const s=t.target,n=e=>s.closest(`.${e}`),l=n(e.CSSClasses.dayBtn);if(!e.settings.selection.day||!["single","multiple","multiple-ranged"].includes(e.settings.selection.day)||!l)return;({single:()=>le(e,l,!1),multiple:()=>le(e,l,!0),"multiple-ranged":()=>ne(e,l)})[e.settings.selection.day](),null==(a=e.selectedDates)||a.sort(((e,t)=>+new Date(e)-+new Date(t))),e.actions.clickDay&&e.actions.clickDay(t,e.selectedDates),e.input&&e.HTMLInputElement&&e.HTMLElement&&e.actions.changeToInput&&e.actions.changeToInput(t,x(e),e.selectedDates,e.selectedTime,e.selectedHours,e.selectedMinutes,e.selectedKeeping);const r=n(e.CSSClasses.dayBtnPrev),i=n(e.CSSClasses.dayBtnNext);({prev:()=>Z(e,"prev"),next:()=>Z(e,"next"),default:()=>w(e)})[r?"prev":i?"next":"default"]()})(e,t),ie(e,t,"month",{header:e.CSSClasses.month,item:e.CSSClasses.monthsMonth,column:e.CSSClasses.columnMonth}),ie(e,t,"year",{header:e.CSSClasses.year,item:e.CSSClasses.yearsYear,column:e.CSSClasses.columnYear})}))},ce=(e,t)=>{let a=e.offsetHeight,s=0;for(let n=e;n;n=n.offsetParent)a+=n.offsetTop||0,s+=n.offsetLeft||0;Object.assign(t.style,{left:`${s}px`,top:`${a}px`})},oe=e=>{let t=!0;e.HTMLInputElement=e.HTMLElement;const a=t=>{var s;e&&t.target!==e.HTMLInputElement&&!(null==(s=e.HTMLElement)?void 0:s.contains(t.target))&&(e.HTMLInputElement&&e.HTMLElement&&x(e).hide(),document.removeEventListener("click",a,{capture:!0}))};e.HTMLInputElement.addEventListener("click",(()=>{t?(()=>{const a=document.createElement("div");a.className=`${e.CSSClasses.calendar} ${e.CSSClasses.calendarToInput} ${e.CSSClasses.calendarHidden}`,ce(e.HTMLInputElement,a),e.HTMLElement=a,document.body.append(e.HTMLElement),t=!1,setTimeout((()=>x(e).show()),0),X(e),de(e)})():(ce(e.HTMLInputElement,e.HTMLElement),x(e).show()),document.addEventListener("click",a,{capture:!0})}))};return class extends o{constructor(e,t){var a,s,n,r,i,d;if(super(),l(this,"reset",(()=>X(this))),l(this,"update",(()=>(e=>{const{dates:t,month:a,year:s}=e.settings.selected;e.settings.selected.dates=(null==t?void 0:t[0])?t:e.selectedDates,e.settings.selected.month=a||e.selectedMonth,e.settings.selected.year=s||e.selectedYear,v(e),Q(e),e.settings.selected={dates:t,month:a,year:s}})(this))),l(this,"init",(()=>{return(e=this).HTMLOriginalElement=e.HTMLElement.cloneNode(!0),void(e.input?oe(e):(v(e),Q(e),de(e)));var e})),l(this,"destroy",(()=>(e=>{var t,a,s,n;e.input?(null==(a=null==(t=e.HTMLElement)?void 0:t.parentNode)||a.removeChild(e.HTMLElement),null==(s=e.HTMLInputElement)||s.replaceWith(e.HTMLOriginalElement),e.HTMLInputElement=void 0):null==(n=e.HTMLElement)||n.replaceWith(e.HTMLOriginalElement),e.HTMLElement=e.HTMLOriginalElement})(this))),this.HTMLElement="string"==typeof e?document.querySelector(e):e,!this.HTMLElement)throw new Error(`${e} is not found, check the first argument passed to new VanillaCalendar.`);if(!t)return;const c=(e,t)=>{Object.keys(t).forEach((a=>{"object"!=typeof e[a]||"object"!=typeof t[a]||t[a]instanceof Date?e[a]=t[a]:c(e[a],t[a])}))};c(this,t),this.settings.range.min=null!=(n=null==(s=null==(a=null==t?void 0:t.settings)?void 0:a.range)?void 0:s.min)?n:this.date.min,this.settings.range.max=null!=(d=null==(i=null==(r=null==t?void 0:t.settings)?void 0:r.range)?void 0:i.max)?d:this.date.max}}}));
diff --git a/package/build/vanilla-calendar.min.mjs b/package/build/vanilla-calendar.min.mjs
index e46bef39..33a12b62 100644
--- a/package/build/vanilla-calendar.min.mjs
+++ b/package/build/vanilla-calendar.min.mjs
@@ -177,8 +177,8 @@ class DefaultOptionsCalendar {
lang: "en",
iso8601: true,
range: {
- min: "1970-01-01",
- max: "2470-12-31",
+ min: this.date.min,
+ max: this.date.max,
disablePast: false,
disableGaps: false,
disableAllDays: false,
@@ -308,7 +308,7 @@ const initSelectedMonthYear = (self) => {
self.viewYear = self.selectedYear;
};
const initRange = (self) => {
- var _a, _b, _c, _d;
+ var _a, _b, _c;
const isDisablePast = self.settings.range.disablePast && !self.settings.range.disableAllDays && getDate(self.settings.range.min) < self.date.today;
self.rangeMin = isDisablePast ? generateDate(self.date.today) : self.settings.range.disableAllDays ? generateDate(new Date(self.selectedYear, self.selectedMonth, 1)) : self.settings.range.min;
self.rangeMax = self.settings.range.disableAllDays ? generateDate(new Date(self.selectedYear, self.selectedMonth, 1)) : self.settings.range.max;
@@ -317,17 +317,23 @@ const initRange = (self) => {
firstDay.setDate(firstDay.getDate() - 1);
lastDay.setDate(lastDay.getDate() + 1);
self.rangeDisabled = self.settings.range.disabled ? parseDates(self.settings.range.disabled) : [];
- if (self.settings.range.disableAllDays)
- (_a = self.rangeDisabled) == null ? void 0 : _a.push(generateDate(new Date(self.selectedYear, self.selectedMonth, 1)));
+ if (self.settings.range.disableAllDays) {
+ const daysInCurrentMonth = new Date(self.selectedYear, self.selectedMonth + 1, 0).getDate();
+ for (let i = 1; i <= daysInCurrentMonth; i++) {
+ self.rangeDisabled.push(generateDate(new Date(self.selectedYear, self.selectedMonth, i)));
+ }
+ }
self.rangeDisabled.push(generateDate(firstDay));
self.rangeDisabled.push(generateDate(lastDay));
+ self.rangeDisabled.sort((a, b) => +new Date(a) - +new Date(b));
self.rangeEnabled = self.settings.range.enabled ? parseDates(self.settings.range.enabled) : [];
- if ((_b = self.rangeEnabled) == null ? void 0 : _b[0])
- self.rangeDisabled = (_c = self.rangeDisabled) == null ? void 0 : _c.filter((d) => {
+ if ((_a = self.rangeEnabled) == null ? void 0 : _a[0])
+ self.rangeDisabled = (_b = self.rangeDisabled) == null ? void 0 : _b.filter((d) => {
var _a2;
return !((_a2 = self.rangeEnabled) == null ? void 0 : _a2.includes(d));
});
- if (((_d = self.rangeEnabled) == null ? void 0 : _d[0]) && self.settings.range.disableAllDays) {
+ self.rangeEnabled.sort((a, b) => +new Date(a) - +new Date(b));
+ if (((_c = self.rangeEnabled) == null ? void 0 : _c[0]) && self.settings.range.disableAllDays) {
self.rangeMin = self.rangeEnabled[0];
self.rangeMax = self.rangeEnabled[self.rangeEnabled.length - 1];
}
@@ -1170,9 +1176,9 @@ const reset = (self) => {
};
const update = (self) => {
const { dates, month, year } = self.settings.selected;
- self.settings.selected.dates = self.selectedDates;
- self.settings.selected.month = self.selectedMonth;
- self.settings.selected.year = self.selectedYear;
+ self.settings.selected.dates = !(dates == null ? void 0 : dates[0]) ? self.selectedDates : dates;
+ self.settings.selected.month = !month ? self.selectedMonth : month;
+ self.settings.selected.year = !year ? self.selectedYear : year;
setVariables(self);
create(self);
self.settings.selected = { dates, month, year };
@@ -1216,31 +1222,36 @@ const handleClickWeekNumber = (self, event) => {
const daysOfThisWeek = [...daysToWeeks].filter((day) => Number(day.dataset.calendarWeekNumber) === weekNumberValue);
self.actions.clickWeekNumber(event, weekNumberValue, daysOfThisWeek, yearWeek);
};
-let currentSelf = null;
+const current = {
+ self: null,
+ rangeMin: void 0,
+ rangeMax: void 0
+};
const removeHoverEffect = () => {
- var _a;
- const dayEls = (_a = currentSelf == null ? void 0 : currentSelf.HTMLElement) == null ? void 0 : _a.querySelectorAll(`.${currentSelf.CSSClasses.dayBtnHover}`);
- dayEls == null ? void 0 : dayEls.forEach((d) => d.classList.remove(currentSelf.CSSClasses.dayBtnHover));
+ var _a, _b;
+ const dayEls = (_b = (_a = current.self) == null ? void 0 : _a.HTMLElement) == null ? void 0 : _b.querySelectorAll(`.${current.self.CSSClasses.dayBtnHover}`);
+ dayEls == null ? void 0 : dayEls.forEach((d) => d.classList.remove(current.self.CSSClasses.dayBtnHover));
};
const addHoverEffect = (day) => {
- var _a, _b;
- if (!(currentSelf == null ? void 0 : currentSelf.selectedDates))
+ var _a, _b, _c;
+ if (!((_a = current.self) == null ? void 0 : _a.selectedDates))
return;
const formattedDate = generateDate(day);
- if ((_a = currentSelf.rangeDisabled) == null ? void 0 : _a.includes(formattedDate))
+ if ((_b = current.self.rangeDisabled) == null ? void 0 : _b.includes(formattedDate))
return;
- const dayEls = (_b = currentSelf.HTMLElement) == null ? void 0 : _b.querySelectorAll(`[data-calendar-day="${formattedDate}"]`);
- dayEls == null ? void 0 : dayEls.forEach((d) => d.classList.add(currentSelf.CSSClasses.dayBtnHover));
+ const dayEls = (_c = current.self.HTMLElement) == null ? void 0 : _c.querySelectorAll(`[data-calendar-day="${formattedDate}"]`);
+ dayEls == null ? void 0 : dayEls.forEach((d) => d.classList.add(current.self.CSSClasses.dayBtnHover));
};
const handleHoverDaysEvent = (e) => {
- if (!e.target || !(currentSelf == null ? void 0 : currentSelf.selectedDates))
+ var _a;
+ if (!e.target || !((_a = current.self) == null ? void 0 : _a.selectedDates))
return;
removeHoverEffect();
const dayEl = e.target.closest("[data-calendar-day]");
if (!dayEl)
return;
const formattedDate = dayEl.dataset.calendarDay;
- const startDate = getDate(currentSelf.selectedDates[0]);
+ const startDate = getDate(current.self.selectedDates[0]);
const endDate = getDate(formattedDate);
const [start, end] = startDate < endDate ? [startDate, endDate] : [endDate, startDate];
for (let i = new Date(start); i <= end; i.setDate(i.getDate() + 1)) {
@@ -1248,39 +1259,42 @@ const handleHoverDaysEvent = (e) => {
}
};
const handleCancelSelectionDays = (e) => {
- if (!currentSelf || e.key !== "Escape")
+ if (!current.self || e.key !== "Escape")
return;
- currentSelf.selectedDates = [];
- currentSelf.HTMLElement.removeEventListener("mousemove", handleHoverDaysEvent);
+ current.self.selectedDates = [];
+ current.self.HTMLElement.removeEventListener("mousemove", handleHoverDaysEvent);
document.removeEventListener("keydown", handleCancelSelectionDays);
- create(currentSelf);
+ create(current.self);
};
const updateDisabledDates = () => {
- var _a, _b;
- if (!((_a = currentSelf == null ? void 0 : currentSelf.selectedDates) == null ? void 0 : _a[0]) || !currentSelf.rangeDisabled || ((_b = currentSelf.rangeDisabled) == null ? void 0 : _b.length) < 2)
+ var _a, _b, _c;
+ if (!((_b = (_a = current.self) == null ? void 0 : _a.selectedDates) == null ? void 0 : _b[0]) || !current.self.rangeDisabled || ((_c = current.self.rangeDisabled) == null ? void 0 : _c.length) < 2)
return;
- const selectedDate = getDate(currentSelf.selectedDates[0]);
- const [startDate, endDate] = currentSelf.rangeDisabled.map((dateStr) => getDate(dateStr)).reduce(([start, end], disabledDate) => [
+ const selectedDate = getDate(current.self.selectedDates[0]);
+ const [startDate, endDate] = current.self.rangeDisabled.map((dateStr) => getDate(dateStr)).reduce(([start, end], disabledDate) => [
selectedDate >= disabledDate ? disabledDate : start,
selectedDate < disabledDate && end === null ? disabledDate : end
], [null, null]);
if (startDate)
- currentSelf.rangeMin = generateDate(new Date(startDate.setDate(startDate.getDate() + 1)));
+ current.self.rangeMin = generateDate(new Date(startDate.setDate(startDate.getDate() + 1)));
if (endDate)
- currentSelf.rangeMax = generateDate(new Date(endDate.setDate(endDate.getDate() - 1)));
+ current.self.rangeMax = generateDate(new Date(endDate.setDate(endDate.getDate() - 1)));
};
const resetDisabledDates = () => {
- if (!currentSelf)
+ if (!current.self)
return;
- const minDate = getDate(currentSelf.settings.range.min);
- currentSelf.rangeMin = currentSelf.settings.range.disablePast && minDate < currentSelf.date.today ? generateDate(currentSelf.date.today) : currentSelf.settings.range.min;
- currentSelf.rangeMax = currentSelf.settings.range.max;
+ current.self.rangeMin = current.rangeMin;
+ current.self.rangeMax = current.rangeMax;
};
const handleDayRangedSelection = (self, dayBtnEl) => {
const formattedDate = dayBtnEl.dataset.calendarDay;
const selectedDateExists = self.selectedDates.length === 1 && self.selectedDates[0].includes(formattedDate);
self.selectedDates = selectedDateExists ? [] : self.selectedDates.length > 1 ? [formattedDate] : [...self.selectedDates, formattedDate];
- currentSelf = self;
+ if (self.settings.range.disableGaps) {
+ current.rangeMin = current.rangeMin ? current.rangeMin : self.rangeMin;
+ current.rangeMax = current.rangeMax ? current.rangeMax : self.rangeMax;
+ }
+ current.self = self;
const selectionHandlers = {
set: () => {
self.HTMLElement.addEventListener("mousemove", handleHoverDaysEvent);
@@ -1322,7 +1336,7 @@ const handleClickDay = (self, event) => {
return;
const daySelectionActions = {
single: () => handleDaySelection(self, dayBtnEl, false),
- multiple: () => handleDaySelection(self, dayBtnEl, false),
+ multiple: () => handleDaySelection(self, dayBtnEl, true),
"multiple-ranged": () => handleDayRangedSelection(self, dayBtnEl)
};
daySelectionActions[self.settings.selection.day]();
@@ -1531,11 +1545,9 @@ class VanillaCalendar extends DefaultOptionsCalendar {
throw new Error(`${selector} is not found, check the first argument passed to new VanillaCalendar.`);
if (!options)
return;
- this.settings.range.min = (_c = (_b = (_a = options == null ? void 0 : options.settings) == null ? void 0 : _a.range) == null ? void 0 : _b.min) != null ? _c : this.date.min;
- this.settings.range.max = (_f = (_e = (_d = options == null ? void 0 : options.settings) == null ? void 0 : _d.range) == null ? void 0 : _e.max) != null ? _f : this.date.max;
const replaceProperties = (original, replacement) => {
Object.keys(replacement).forEach((key) => {
- if (typeof original[key] === "object" && typeof replacement[key] === "object") {
+ if (typeof original[key] === "object" && typeof replacement[key] === "object" && !(replacement[key] instanceof Date)) {
replaceProperties(original[key], replacement[key]);
} else {
original[key] = replacement[key];
@@ -1543,6 +1555,8 @@ class VanillaCalendar extends DefaultOptionsCalendar {
});
};
replaceProperties(this, options);
+ this.settings.range.min = (_c = (_b = (_a = options == null ? void 0 : options.settings) == null ? void 0 : _a.range) == null ? void 0 : _b.min) != null ? _c : this.date.min;
+ this.settings.range.max = (_f = (_e = (_d = options == null ? void 0 : options.settings) == null ? void 0 : _d.range) == null ? void 0 : _e.max) != null ? _f : this.date.max;
}
}
export {
diff --git a/package/package.json b/package/package.json
index 5295c06f..a6fc7bdd 100644
--- a/package/package.json
+++ b/package/package.json
@@ -1,6 +1,6 @@
{
"name": "@uvarov.frontend/vanilla-calendar",
- "version": "2.8.1-alpha.2",
+ "version": "2.8.1-alpha.3",
"description": "Vanilla Calendar is a versatile JavaScript date and time picker with TypeScript support, making it compatible with any JavaScript framework or library. It is designed to be lightweight, simple to use, and feature-rich without relying on external dependencies.",
"homepage": "https://vanilla-calendar.com",
"keywords": [