diff --git a/package/build/vanilla-calendar.min.css b/package/build/vanilla-calendar.min.css index 33723e3c..c7816f18 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;min-width:275px;max-width:100%;flex-direction:column;border-radius:.75rem;padding:1rem}.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;visibility:hidden;opacity:0;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.vanilla-calendar_to-input{position:absolute;left:0;top:100%;margin-top:.25rem}.vanilla-calendar-input-wrapper{position:relative}.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{-webkit-transform:rotateZ(90deg);transform:rotate(90deg)}.vanilla-calendar-arrow.vanilla-calendar-arrow_next:before{-webkit-transform:rotateZ(-90deg);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;padding-left:.25rem;padding-right:.25rem}.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;-webkit-column-gap:.5rem;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;-webkit-column-gap:.5rem;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_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{-webkit-transform:translateX(-50%);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:"";-webkit-transform:translateX(-50%);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:"";-webkit-transform:translateY(-50%);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;display:flex;height:-webkit-max-content;height:max-content;min-width:275px;max-width:100%;flex-direction:column;border-radius:.75rem;padding:1rem}.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;visibility:hidden;opacity:0;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.vanilla-calendar_to-input{position:absolute;left:0;top:100%;margin-top:.25rem}.vanilla-calendar-input-wrapper{position:relative}.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{-webkit-transform:rotateZ(90deg);transform:rotate(90deg)}.vanilla-calendar-arrow.vanilla-calendar-arrow_next:before{-webkit-transform:rotateZ(-90deg);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;padding-left:.25rem;padding-right:.25rem}.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;-webkit-column-gap:.5rem;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;-webkit-column-gap:.5rem;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_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{-webkit-transform:translateX(-50%);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:"";-webkit-transform:translateX(-50%);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:"";-webkit-transform:translateY(-50%);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 0daec364..685c1fc3 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,s=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,a=(t,s,l)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[s]=l,n=(e,t,s)=>(a(e,"symbol"!=typeof t?t+"":t,s),s);const i=e=>{const t=e.getFullYear();let s=e.getMonth()+1,l=e.getDate();return s=s<10?`0${s}`:s,l=l<10?`0${l}`:l,`${t}-${s}-${l}`},d=e=>{const t=[];return e.forEach((e=>{e.match(/^(\d{4}-\d{2}-\d{2})$/g)?t.push(e):e.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g,((e,s,l)=>{const a=new Date(`${s}T00:00:00`),n=new Date(`${l}T00:00:00`),d=new Date(a.getTime());for(;d<=n;d.setDate(d.getDate()+1))t.push(i(d));return e}))})),t},r=e=>{const t=Number(e);let s=String(t);return 0===t?s="12":13===t?s="01":14===t?s="02":15===t?s="03":16===t?s="04":17===t?s="05":18===t?s="06":19===t?s="07":20===t?s="08":21===t?s="09":22===t?s="10":23===t&&(s="11"),s},c=e=>{var t,s;e.rangeMin=e.settings.range.min,e.rangeMax=e.settings.range.max,e.rangeDisabled=e.settings.range.disabled?d([...e.settings.range.disabled]):[],e.rangeEnabled=e.settings.range.enabled?d([...e.settings.range.enabled]):[],e.selectedDates=e.settings.selected.dates?d([...e.settings.selected.dates]):[],e.selectedHolidays=e.settings.selected.holidays?d([...e.settings.selected.holidays]):[],e.settings.range.disablePast&&!e.settings.range.disableAllDays&&new Date(`${e.settings.range.min}T00:00:00`)+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]);const l=new Date(`${e.rangeMin}T00:00:00`),a=new Date(`${e.rangeMax}T00:00:00`);l.setDate(l.getDate()-1),a.setDate(a.getDate()+1),e.rangeDisabled.push(i(l)),e.rangeDisabled.push(i(a)),null!==e.settings.selected.month&&e.settings.selected.month>=0&&e.settings.selected.month<12?e.selectedMonth=e.settings.selected.month:e.selectedMonth=e.date.today.getMonth(),null!==e.settings.selected.year&&e.settings.selected.year>=0&&e.settings.selected.year<=9999?e.selectedYear=e.settings.selected.year:e.selectedYear=e.date.today.getFullYear(),e.viewYear=e.selectedYear,e.dateMin=e.settings.visibility.disabled?new Date(`${e.date.min}T00:00:00`):new Date(`${e.rangeMin}T00:00:00`),e.dateMax=e.settings.visibility.disabled?new Date(`${e.date.max}T00:00:00`):new Date(`${e.rangeMax}T00:00:00`);const n=!0===e.settings.selection.time||12===e.settings.selection.time;if(n||24===e.settings.selection.time){if(e.userTime=!1,"string"==typeof e.settings.selected.time){const t=n?/^([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(t,((t,s,l,a)=>(s&&l&&(e.userTime=!0,e.selectedHours=s,e.selectedMinutes=l),a&&n?e.selectedKeeping=a:n&&(e.selectedKeeping="AM"),"")))}!e.userTime&&n?(e.selectedHours=r(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."));"multiple"===e.type&&(1===e.months?(console.warn("The value of the «months» parameter cannot be less than «2», the minimum available value will be initialized."),e.correctMonths=2):e.months>12?(console.warn("The value of the «months» parameter cannot be greater than «12», the maximum available value will be initialized."),e.correctMonths=12):e.correctMonths=e.months)},o=e=>{if(!["default","multiple","year"].includes(e.currentType))return;const t=e.HTMLElement.querySelector(`.${e.CSSClasses.arrowPrev}`),s=e.HTMLElement.querySelector(`.${e.CSSClasses.arrowNext}`);if(!t||!s)return;"default"!==e.currentType&&"multiple"!==e.currentType||(()=>{if(!e.dateMin||!e.dateMax)return;const l=new Date(`${i(new Date(e.selectedYear,e.selectedMonth,1))}T00:00:00`),a=new Date(l.getTime());l.setMonth(l.getMonth()-e.jumpMonths),a.setMonth(a.getMonth()+e.jumpMonths),!e.settings.selection.month||l.getFullYear()e.dateMax.getFullYear()||a.getFullYear()===e.dateMax.getFullYear()&&a.getMonth()>e.dateMax.getMonth()?s.style.visibility="hidden":s.style.visibility=""})(),"year"===e.currentType&&e.dateMin&&e.dateMax&&void 0!==e.viewYear&&(e.dateMin.getFullYear()&&e.viewYear-7<=e.dateMin.getFullYear()?t.style.visibility="hidden":t.style.visibility="",e.dateMax.getFullYear()&&e.viewYear+7>=e.dateMax.getFullYear()?s.style.visibility="hidden":s.style.visibility="")},u=(e,t)=>{if(!e)return null;const s=new Date(`${e}T00:00:00`).getDate(),l=new Date(`${e}T00:00:00`).getMonth(),a=new Date(`${e}T00:00:00`).getFullYear(),n=new Date(a,l,s),i=t?n.getDay()||7:n.getDay();n.setDate(n.getDate()+4-i);const d=new Date(n.getFullYear(),0,1);return{year:a,week:Math.ceil(((+n-+d)/864e5+1)/7)}},m=e=>{var t,s;const l=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.days}`),a=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.weekNumbers}`),n=new Date(e.selectedYear,e.selectedMonth,1),d=document.createElement("div"),r=document.createElement("button");d.className=e.CSSClasses.day,r.className=e.CSSClasses.dayBtn,r.type="button",null==(t=e.selectedDates)||t.sort(((e,t)=>+new Date(e)-+new Date(t))),l.forEach(((t,s)=>{const c=new Date(n.setMonth(e.selectedMonth+s)).getMonth(),o=new Date(n.setFullYear(e.selectedYear,e.selectedMonth+s)).getFullYear(),m=new Date(o,c,1),g=new Date(o,c+1,0).getDate();let v=Number(m.getDay());e.settings.iso8601&&(v=Number((0!==m.getDay()?m.getDay():7)-1)),e.settings.selection.day&&["single","multiple","multiple-ranged"].includes(e.settings.selection.day)&&l[s].classList.add(e.CSSClasses.daysSelecting),l[s].innerHTML="";const y=(t,a,n,i,c)=>{var m,g,v,y,h,S,p,C,b;const M=d.cloneNode(!0),D=r.cloneNode(!0);if(c&&D.classList.add(c),D.innerText=t,D.dataset.calendarDay=n,e.settings.visibility.weekNumbers){const t=u(n,e.settings.iso8601);if(!t)return;D.dataset.calendarWeekNumber=`${t.week}`}(null==(m=e.rangeEnabled)?void 0:m[0])&&e.settings.range.disableAllDays&&!(null==(g=e.rangeDisabled)?void 0:g.includes(n))&&(null==(v=e.rangeDisabled)||v.push(n)),(null==(y=e.rangeEnabled)?void 0:y[0])&&(null==(h=e.rangeDisabled)?void 0:h.includes(n))&&(e.rangeDisabled=null==(S=e.rangeDisabled)?void 0:S.filter((t=>{var s;return!(null==(s=e.rangeEnabled)?void 0:s.includes(t))}))),(null==(p=e.settings.range.disableWeekday)?void 0:p.includes(a))&&!(null==(C=e.rangeDisabled)?void 0:C.includes(n))&&(null==(b=e.rangeDisabled)||b.push(n)),((t,s,l,a,n)=>{(e.rangeMin>a||e.rangeMax{t===a&&s.classList.add(e.CSSClasses.dayBtnHoliday)}));let i=e.date.today.getDate(),d=e.date.today.getMonth()+1;i=i<10?`0${i}`:i,d=d<10?`0${d}`:d;const r=`${e.date.today.getFullYear()}-${d}-${i}`;e.settings.visibility.today&&s.dataset.calendarDay===r&&s.classList.add(e.CSSClasses.dayBtnToday),e.selectedDates&&0===e.selectedDates.indexOf(a)?("multiple-ranged"===e.settings.selection.day&&e.selectedDates.length>1?t.classList.add(e.CSSClasses.daySelectedFirst):t.classList.add(e.CSSClasses.daySelected),s.classList.add(e.CSSClasses.dayBtnSelected)):e.selectedDates&&e.selectedDates[0]&&e.selectedDates.indexOf(a)===e.selectedDates.length-1?(t.classList.add(e.CSSClasses.daySelected),"multiple-ranged"===e.settings.selection.day?t.classList.add(e.CSSClasses.daySelectedLast):t.classList.add(e.CSSClasses.daySelected),s.classList.add(e.CSSClasses.dayBtnSelected)):e.selectedDates&&e.selectedDates.indexOf(a)>0&&"multiple-ranged"===e.settings.selection.day?(t.classList.add(e.CSSClasses.daySelectedIntermediate),s.classList.add(e.CSSClasses.dayBtnSelected),s.classList.add(e.CSSClasses.dayBtnIntermediate)):e.selectedDates&&e.selectedDates.indexOf(a)>0&&(t.classList.add(e.CSSClasses.daySelected),s.classList.add(e.CSSClasses.dayBtnSelected)),Array.isArray(e.rangeDisabled)&&e.rangeDisabled[0]&&e.rangeDisabled.forEach((t=>{t===a&&(s.classList.add(e.CSSClasses.dayBtnDisabled),s.tabIndex=-1)})),!e.settings.selection.month&&n&&(s.classList.add(e.CSSClasses.dayBtnDisabled),s.tabIndex=-1),e.settings.selection.year||new Date(`${a}T00:00:00`).getFullYear()===o||(s.classList.add(e.CSSClasses.dayBtnDisabled),s.tabIndex=-1)})(M,D,a,n,i),i?e.settings.visibility.daysOutside&&M.append(D):M.append(D),l[s].append(M),e.actions.getDays&&e.actions.getDays(Number(t),n,M,D)};(()=>{let t=new Date(o,c,0).getDate()-v,s=o,l=c;0===c?(l=e.locale.months.length,s=o-1):c<10&&(l=`0${c}`);for(let a=0;a{for(let e=1;e<=g;e++){const t=new Date(o,c,e),s=i(t),l=t.getDay();y(String(e),l,s,!1,null)}})(),(()=>{const t=v+g,s=Math.ceil(t/e.locale.weekday.length),l=e.locale.weekday.length*s-t;let a=o,n=String(c+2);c+1===e.locale.months.length?(n="01",a=o+1):c+2<10&&(n=`0${c+2}`);for(let i=1;i<=l;i++){const t=`${a}-${n}-${i<10?`0${i}`:String(i)}`,s=new Date(o,c,i).getMonth()+1,l=new Date(o,s,i).getDay();y(String(i),l,t,!0,e.CSSClasses.dayBtnNext)}})(),((e,t)=>{e.popups&&Object.keys(e.popups).forEach((s=>{var l;const a=t.querySelector(`[data-calendar-day="${s}"]`);if(a){const t=null==(l=e.popups)?void 0:l[s];(null==t?void 0:t.modifier)&&t.modifier.trim().split(" ").forEach((e=>{a.classList.add(e)})),(null==t?void 0:t.html)&&(a.parentNode.innerHTML+=`
${t.html}
`)}}))})(e,l[s]),((e,t,s,l,a)=>{if(!e.settings.visibility.weekNumbers)return;const n=a.querySelectorAll(`.${e.CSSClasses.day}`);l.innerHTML="";const i=Math.ceil((t+s)/7),d=document.createElement("b");d.className=e.CSSClasses.weekNumbersTitle,d.innerText="#",l.append(d);const r=document.createElement("div");r.className=e.CSSClasses.weekNumbersContent,l.append(r);const c=document.createElement("span");c.className=e.CSSClasses.weekNumber;for(let o=0;o+new Date(e)-+new Date(t)))},g=e=>`\n\t\n`,v=e=>`\n\t\n`,y=e=>`\n\t\n`,h=e=>`\n\t\n`,S=e=>`\n\t
\n`,p=e=>`\n\t
\n`,C=e=>`\n\t
\n`,b=e=>`\n\t
\n`,M=e=>e.settings.visibility.weekNumbers?`\n\t
\n`:"",D=e=>e.settings.selection.time?`\n\t
\n`:"",T=(e,t)=>t.replace(/<#(.*?)\/>/g,((t,s)=>{const l=(e=>{let t=null;switch(e){case"ArrowPrev":t=g;break;case"ArrowNext":t=v;break;case"Month":t=y;break;case"Year":t=h;break;case"Week":t=S;break;case"Days":t=p;break;case"Months":t=C;break;case"Years":t=b;break;case"WeekNumbers":t=M;break;case"ControlTime":t=D}return t})(s.replace(/[\s\n\t]/g,""));return l?l(e):""})).replace(/[\n\t]/g,""),w=(e,t)=>{const s=e.HTMLElement;s.classList.add(e.CSSClasses.calendar);const l=(s,l)=>{if(!t)return;const a=e.HTMLElement.querySelector(`.${e.CSSClasses.controls}`);a&&e.HTMLElement.removeChild(a);e.HTMLElement.querySelector(`.${e.CSSClasses.grid}`).classList.add(e.CSSClasses.gridDisabled);const n=t.closest(`.${e.CSSClasses.column}`);n.classList.add(s),n.innerHTML=T(e,l)};switch(e.currentType){case"default":s.classList.add(e.CSSClasses.calendarDefault),s.classList.remove(e.CSSClasses.calendarMonth),s.classList.remove(e.CSSClasses.calendarYear),s.innerHTML=T(e,e.DOMTemplates.default);break;case"multiple":if(!e.correctMonths)break;s.classList.add(e.CSSClasses.calendarMultiple),s.classList.remove(e.CSSClasses.calendarMonth),s.classList.remove(e.CSSClasses.calendarYear),s.innerHTML=((e,t)=>t.replace(/<#Multiple>(.*?)<#\/Multiple>/g,((t,s)=>{let l="";for(let a=0;a{const t=e.HTMLElement.querySelectorAll("[data-calendar-selected-month]");if(!t[0]||void 0===e.selectedMonth)return;const s=new Date(e.selectedYear,e.selectedMonth,1);t.forEach(((l,a)=>{const n=new Date(s.setMonth(e.selectedMonth+a)).getMonth();t[a].dataset.calendarSelectedMonth=String(n),t[a].innerText=e.locale.months[n],e.settings.selection.month?(t[a].tabIndex=0,t[a].classList.remove(e.CSSClasses.monthDisabled)):(t[a].tabIndex=-1,t[a].classList.add(e.CSSClasses.monthDisabled))}))},f=e=>{const t=e.HTMLElement.querySelectorAll("[data-calendar-selected-year]");if(!t||void 0===e.selectedMonth)return;const s=new Date(e.selectedYear,e.selectedMonth,1);t.forEach(((l,a)=>{const n=new Date(s.setFullYear(e.selectedYear,e.selectedMonth+a)).getFullYear();t[a].dataset.calendarSelectedYear=String(n),t[a].innerText=String(n),e.settings.selection.year?(t[a].tabIndex=0,t[a].classList.remove(e.CSSClasses.yearDisabled)):(t[a].tabIndex=-1,t[a].classList.add(e.CSSClasses.yearDisabled))}))},L=(e,t)=>{const s=(null==t?void 0:t.dataset.calendarSelectedMonth)?Number(null==t?void 0:t.dataset.calendarSelectedMonth):e.selectedMonth;e.currentType="month",w(e,t),$(e),f(e);const l=e.HTMLElement.querySelector(`.${e.CSSClasses.months}`);if(void 0===e.selectedYear||!e.dateMin||!e.dateMax||!l)return;e.settings.selection.month&&l.classList.add(e.CSSClasses.monthsSelecting);const a=document.createElement("button");a.type="button",a.className=e.CSSClasses.monthsMonth;for(let n=0;ne.dateMax.getMonth()&&e.selectedYear===e.dateMax.getFullYear()&&(i.classList.add(e.CSSClasses.monthsMonthDisabled),i.tabIndex=-1),i.dataset.calendarMonth=String(n),i.title=`${t}`,i.innerText=`${e.settings.visibility.monthShort?t.substring(0,3):t}`,l.append(i)}},k=(e,t)=>{const s=Number(e);let l=String(s);return"AM"===t?12===s&&(l="00"):"PM"===t&&(1===s?l="13":2===s?l="14":3===s?l="15":4===s?l="16":5===s?l="17":6===s?l="18":7===s?l="19":8===s?l="20":9===s?l="21":10===s?l="22":11===s&&(l="23")),l},H=e=>{const t=e.HTMLElement.querySelector(`.${e.CSSClasses.time}`);if(!t)return;const s=!0===e.settings.selection.time?12:e.settings.selection.time,l="range"===e.settings.selection.controlTime;t.innerHTML=`\n\t
\n\t\t\n\t\t\n\t\t${12===s?`\n\t\t\n\t\t`:""}\n\t
\n\t
\n\t\t\n\t\t\n\t
`,((e,t)=>{const s=e.HTMLElement.querySelector(`.${e.CSSClasses.timeRange} input[name="hours"]`),l=e.HTMLElement.querySelector(`.${e.CSSClasses.timeRange} input[name="minutes"]`),a=e.HTMLElement.querySelector(`.${e.CSSClasses.timeHours} input[name="hours"]`),n=e.HTMLElement.querySelector(`.${e.CSSClasses.timeMinutes} input[name="minutes"]`),i=e.HTMLElement.querySelector(`.${e.CSSClasses.timeKeeping}`),d=(t,s)=>{t.addEventListener("mouseover",(()=>s.classList.add(e.CSSClasses.isFocus)))},c=(t,s)=>{t.addEventListener("mouseout",(()=>s.classList.remove(e.CSSClasses.isFocus)))},o=(t,s,l)=>{"hours"===l?e.selectedHours=`${s}`:"minutes"===l&&(e.selectedMinutes=`${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,e.HTMLInputElement,e.selectedDates,e.selectedTime,e.selectedHours,e.selectedMinutes,e.selectedKeeping)},u=(t,s,l,a)=>{t.addEventListener("input",(t=>{let n=Number(t.target.value);n=n<10?`0${n}`:`${n}`,"hours"===l&&12===a?Number(t.target.value)0?(s.value=n,e.selectedKeeping="AM",i.innerText=e.selectedKeeping,o(t,n,l)):(0===Number(t.target.value)?(e.selectedKeeping="AM",i.innerText="AM"):(e.selectedKeeping="PM",i.innerText="PM"),s.value=r(t.target.value),o(t,r(t.target.value),l)):(s.value=n,o(t,n,l))}))},m=(t,s,l,a)=>{s.addEventListener("change",(s=>{const n=s.target;let d=Number(n.value);d=d<10?`0${d}`:`${d}`,"hours"===l&&12===a?n.value&&Number(n.value)<=a&&Number(n.value)>0?(n.value=d,t.value=k(d,e.selectedKeeping),o(s,d,l)):n.value&&Number(n.value)<24&&(Number(n.value)>a||0===Number(n.value))?(0===Number(n.value)?(e.selectedKeeping="AM",i.innerText="AM"):(e.selectedKeeping="PM",i.innerText="PM"),n.value=r(n.value),t.value=d,o(s,r(n.value),l)):n.value=e.selectedHours:n.value&&Number(n.value)<=a&&Number(n.value)>=0?(n.value=d,t.value=d,o(s,d,l)):"hours"===l?n.value=e.selectedHours:"minutes"===l&&(n.value=e.selectedMinutes)}))};d(s,a),d(l,n),c(s,a),c(l,n),u(s,a,"hours",24===t?23:12),u(l,n,"minutes",0),m(s,a,"hours",24===t?23:12),m(l,n,"minutes",59),i&&i.addEventListener("click",(t=>{i.innerText.includes("AM")?e.selectedKeeping="PM":e.selectedKeeping="AM",s.value=k(e.selectedHours,e.selectedKeeping),o(t,e.selectedHours,"hours"),i.innerText=e.selectedKeeping}))})(e,s)},E=e=>{const t=[...e.locale.weekday];if(!t[0])return;const s=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.week}`),l=document.createElement("b");l.className=e.CSSClasses.weekDay,e.settings.iso8601&&t.push(t.shift()),s.forEach((s=>{s.innerHTML="";for(let a=0;a{if(void 0===e.viewYear||!e.dateMin||!e.dateMax)return;const s=(null==t?void 0:t.dataset.calendarSelectedYear)?Number(null==t?void 0:t.dataset.calendarSelectedYear):e.selectedYear;e.currentType="year",w(e,t),$(e),f(e),o(e);const l=e.HTMLElement.querySelector(`.${e.CSSClasses.years}`);if(!l)return;e.settings.selection.year&&l.classList.add(e.CSSClasses.yearsSelecting);const a=document.createElement("button");a.type="button",a.className=e.CSSClasses.yearsYear;for(let n=e.viewYear-7;ne.dateMax.getFullYear()&&(i.classList.add(e.CSSClasses.yearsYearDisabled),i.tabIndex=-1),i.dataset.calendarYear=String(t),i.innerText=`${t}`,l.append(i)}},x=["light","dark","system"];let N=!1;const _=(e,t)=>{var s;let l=null;for(let a=0;a{e.HTMLElement&&(x.includes(t)?e.HTMLElement.dataset.calendarTheme=t:console.error("Incorrect name of theme in settings.visibility.theme"))},F=(e,t)=>{if(!t)return void A(e,"light");const s=e=>e.matches?"dark":"light";e.HTMLElement.dataset.calendarTheme=s(t),N||(t.onchange=t=>{"system"===e.settings.visibility.theme&&(e.HTMLElement.dataset.calendarTheme=s(t))},N=!0)},I=(e,t)=>{if(!e.HTMLElement)return;const s=!!e.settings.visibility.themeDetect&&document.querySelector(e.settings.visibility.themeDetect);if(!s)return void F(e,t);const l=e.settings.visibility.themeDetect.replace(/^.*\[(.+)\]/g,((e,t)=>t)),a=s.hasAttribute(l);if(!l||!a)return void F(e,t);const n=_(s,l);n?(A(e,n),((e,t,s)=>{new MutationObserver((l=>{for(let a=0;a{const t={default(){E(e),m(e)},multiple(){E(e),m(e)},month(){L(e)},year(){Y(e)}};(e=>{if(!e.HTMLElement)return;let t;"not all"!==window.matchMedia("(prefers-color-scheme)").media&&(t=window.matchMedia("(prefers-color-scheme: dark)")),"system"===e.settings.visibility.theme?I(e,t):A(e,e.settings.visibility.theme)})(e),(e=>{if("define"!==e.settings.lang){e.locale.weekday=[];for(let t=0;t<7;t++){let s=new Date(0,0,t).toLocaleString(e.settings.lang,{weekday:"short"});s=`${s.charAt(0).toUpperCase()}${s.substring(1,s.length)}`,s=s.replace(/\./,""),e.locale.weekday.push(s)}e.locale.months=[];for(let t=0;t<12;t++){let s=new Date(0,t).toLocaleString(e.settings.lang,{month:"long"});s=`${s.charAt(0).toUpperCase()}${s.substring(1,s.length)}`,s=s.replace(/\./,""),e.locale.months.push(s)}}})(e),w(e),$(e),f(e),o(e),H(e),t[e.currentType]()},q=e=>{c(e),B(e)};let O=null;const P=e=>{O&&(e.target.closest(`.${O.CSSClasses.calendar}`)||(document.querySelectorAll(`.${O.CSSClasses.calendar}`).forEach((e=>{e.classList.add(O.CSSClasses.calendarHidden)})),document.removeEventListener("click",P,{capture:!0})))},K=(e,t)=>{if(void 0===e.selectedMonth||void 0===e.selectedYear)return;const s=new Date(`${i(new Date(e.selectedYear,e.selectedMonth,1))}T00:00:00`);switch(t){case"prev":s.setMonth(s.getMonth()-e.jumpMonths);break;case"next":s.setMonth(s.getMonth()+e.jumpMonths)}e.selectedMonth=s.getMonth(),e.selectedYear=s.getFullYear(),$(e),f(e),o(e),m(e)};let W=null;const j=()=>{var e;if(!W)return;const t=null==(e=W.HTMLElement)?void 0:e.querySelectorAll(`.${W.CSSClasses.dayBtnHover}`);t&&t.forEach((e=>e.classList.remove(W.CSSClasses.dayBtnHover)))},R=e=>{var t;if(!W||!W.selectedDates)return;const s=i(e);if(W.rangeDisabled&&W.rangeDisabled.includes(s))return;const l=null==(t=W.HTMLElement)?void 0:t.querySelectorAll(`[data-calendar-day="${s}"]`);null==l||l.forEach((e=>{e.classList.add(W.CSSClasses.dayBtnHover)}))},G=e=>{if(!e.target||!W||!W.selectedDates)return;if(!e.target.closest(`.${W.CSSClasses.days}`))return void j();const t=e.target.dataset.calendarDay;if(!t)return;j();const s=new Date(new Date(`${W.selectedDates[0]}T00:00:00`).getFullYear(),new Date(`${W.selectedDates[0]}T00:00:00`).getMonth(),new Date(`${W.selectedDates[0]}T00:00:00`).getDate()),l=new Date(new Date(`${t}T00:00:00`).getFullYear(),new Date(`${t}T00:00:00`).getMonth(),new Date(`${t}T00:00:00`).getDate());if(l>s)for(let a=s;a<=l;a.setDate(a.getDate()+1))R(a);else for(let a=s;a>=l;a.setDate(a.getDate()-1))R(a)},z=e=>{W&&"Escape"===e.key&&(W.selectedDates=[],W.HTMLElement.removeEventListener("mousemove",G),document.removeEventListener("keydown",z),B(W))},U=e=>{e&&e.selectedDates&&(W=e,e.selectedDates[0]&&e.selectedDates.length<=1?(e.HTMLElement.addEventListener("mousemove",G),document.addEventListener("keydown",z),e.settings.range.disableGaps&&(()=>{var e;if(!W||!(null==(e=W.selectedDates)?void 0:e[0])||!W.rangeDisabled||W.rangeDisabled.length<2)return;const t=new Date(`${W.selectedDates[0]}T00:00:00`);let s=null,l=null;for(let a=0;a=e)){l=e;break}s=e}s&&(s=new Date(s.setDate(s.getDate()+1)),W.rangeMin=i(s)),l&&(l=new Date(l.setDate(l.getDate()-1)),W.rangeMax=i(l))})()):(e.HTMLElement.removeEventListener("mousemove",G),document.removeEventListener("keydown",z),e.settings.range.disableGaps&&W&&(W.rangeMin=W.settings.range.min,W.rangeMax=W.settings.range.max,W.settings.range.disablePast&&new Date(`${W.settings.range.min}T00:00:00`){const n=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`),i=Number(n[0].querySelector(`.${s}`).getAttribute(a)),d=Number(n[n.length-1].querySelector(`.${s}`).getAttribute(a)),r=[...n].findIndex((e=>e.classList.contains(t)));return i===d||r<0?l:id?l-r:l},J=e=>{e.HTMLElement.addEventListener("click",(t=>{const s=t.target,l=s.closest(`.${e.CSSClasses.arrow}`),a=s.closest(`.${e.CSSClasses.arrowPrev}`),n=s.closest(`.${e.CSSClasses.arrowNext}`),d=s.closest(`.${e.CSSClasses.dayBtn}`),r=s.closest(`.${e.CSSClasses.dayBtnPrev}`),c=s.closest(`.${e.CSSClasses.dayBtnNext}`),o=s.closest(`.${e.CSSClasses.weekNumber}`),u=s.closest(`.${e.CSSClasses.year}`),g=s.closest(`.${e.CSSClasses.yearsYear}`),v=s.closest(`.${e.CSSClasses.month}`),y=s.closest(`.${e.CSSClasses.monthsMonth}`),h=s.closest(`.${e.CSSClasses.grid}`),S=s.closest(`.${e.CSSClasses.column}`);l&&"year"!==e.currentType&&"month"!==e.currentType&&K(e,s.dataset.calendarArrow),l&&e.actions.clickArrow&&e.actions.clickArrow(t,Number(e.selectedYear),Number(e.selectedMonth)),(()=>{if(e.settings.selection.day&&["single","multiple","multiple-ranged"].includes(e.settings.selection.day)&&d){switch(e.settings.selection.day){case"single":e.selectedDates&&d&&d.dataset.calendarDay&&(d.classList.contains(e.CSSClasses.dayBtnSelected)?e.selectedDates.splice(e.selectedDates.indexOf(d.dataset.calendarDay),1):(e.selectedDates=[],e.selectedDates.push(d.dataset.calendarDay)));break;case"multiple":e.selectedDates&&d&&d.dataset.calendarDay&&(d.classList.contains(e.CSSClasses.dayBtnSelected)?e.selectedDates.splice(e.selectedDates.indexOf(d.dataset.calendarDay),1):e.selectedDates.push(d.dataset.calendarDay));break;case"multiple-ranged":(()=>{if(e.selectedDates&&d&&d.dataset.calendarDay){if(e.selectedDates.length<=1&&e.selectedDates[0]&&e.selectedDates[0].includes(d.dataset.calendarDay)?e.selectedDates=[]:(e.selectedDates.length>1&&(e.selectedDates=[]),e.selectedDates.push(d.dataset.calendarDay)),e.selectedDates[1]){const t=new Date(new Date(`${e.selectedDates[0]}T00:00:00`).getFullYear(),new Date(`${e.selectedDates[0]}T00:00:00`).getMonth(),new Date(`${e.selectedDates[0]}T00:00:00`).getDate()),s=new Date(new Date(`${e.selectedDates[1]}T00:00:00`).getFullYear(),new Date(`${e.selectedDates[1]}T00:00:00`).getMonth(),new Date(`${e.selectedDates[1]}T00:00:00`).getDate()),l=t=>{if(!e.selectedDates)return;const s=i(t);e.rangeDisabled&&e.rangeDisabled.includes(s)||e.selectedDates.push(s)};if(e.selectedDates=[],s>t)for(let e=t;e<=s;e.setDate(e.getDate()+1))l(e);else for(let e=t;e>=s;e.setDate(e.getDate()-1))l(e)}U(e)}})()}e.actions.clickDay&&e.actions.clickDay(t,e.selectedDates),e.input&&e.HTMLInputElement&&e.actions.changeToInput&&e.actions.changeToInput(t,e.HTMLInputElement,e.selectedDates,e.selectedTime,e.selectedHours,e.selectedMinutes,e.selectedKeeping),r?K(e,"prev"):c?K(e,"next"):m(e)}})(),(()=>{var s;if(!e.settings.visibility.weekNumbers||!o||!e.actions.clickWeekNumber)return;const l=null==(s=e.HTMLElement)?void 0:s.querySelectorAll("[data-calendar-week-number]");if(!l)return;const a=Number(o.innerText),n=Number(o.dataset.calendarYearWeek),i=[...l].filter((e=>Number(e.dataset.calendarWeekNumber)===a));e.actions.clickWeekNumber(t,a,i,n)})(),(()=>{if(e.settings.selection.year)if(l&&"year"===e.currentType){if(void 0===e.viewYear)return;n?e.viewYear+=15:a&&(e.viewYear-=15),Y(e,t.target)}else if("year"!==e.currentType&&u)Y(e,t.target);else if("year"===e.currentType&&u)e.currentType=e.type,B(e);else if(g){if(void 0===e.selectedMonth||!e.dateMin||!e.dateMax)return;e.selectedYear="multiple"===e.type?V(e,e.CSSClasses.columnYear,e.CSSClasses.year,Number(g.dataset.calendarYear),"data-calendar-selected-year"):Number(g.dataset.calendarYear),e.currentType=e.type,e.selectedMonthe.dateMax.getMonth()&&e.selectedYear===e.dateMax.getFullYear()&&(e.selectedMonth=e.dateMax.getMonth()),e.actions.clickYear&&e.actions.clickYear(t,e.selectedYear),B(e)}else"multiple"===e.type&&"year"===e.currentType&&h&&!S&&(e.currentType=e.type,B(e))})(),(()=>{if(e.settings.selection.month)if("month"!==e.currentType&&v)L(e,t.target);else if("month"===e.currentType&&v)e.currentType=e.type,B(e);else if(y){if(e.selectedMonth="multiple"===e.type?V(e,e.CSSClasses.columnMonth,e.CSSClasses.month,Number(y.dataset.calendarMonth),"data-calendar-selected-month"):Number(y.dataset.calendarMonth),"multiple"===e.type){const t=y.closest(`.${e.CSSClasses.columnMonth}`).querySelector(`.${e.CSSClasses.year}`);e.selectedYear=Number(t.dataset.calendarSelectedYear)}e.currentType=e.type,e.actions.clickMonth&&e.actions.clickMonth(t,e.selectedMonth),B(e)}else"multiple"===e.type&&"month"===e.currentType&&h&&!S&&(e.currentType=e.type,B(e))})()}))},Q=e=>{e.HTMLElement&&((e=>{if(!e.input||!e.HTMLElement||!e.HTMLElement.parentNode)return;e.HTMLInputElement=e.HTMLElement;const t=document.createElement("div"),s=document.createElement("div");t.className=e.CSSClasses.calendarInputWrapper,s.className=`${e.CSSClasses.calendar} ${e.CSSClasses.calendarToInput} ${e.CSSClasses.calendarHidden}`,e.HTMLElement.parentNode.insertBefore(t,e.HTMLInputElement),t.append(e.HTMLInputElement),e.HTMLElement=s,t.append(e.HTMLElement)})(e),q(e),(e=>{var t;e&&e.input&&(O=e,null==(t=e.HTMLInputElement)||t.addEventListener("click",(()=>{var t;null==(t=e.HTMLElement)||t.classList.remove(e.CSSClasses.calendarHidden),document.addEventListener("click",P,{capture:!0})})))})(e),J(e))},X=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\t
\n\t\t\t\t\t\t<#Month />\n\t\t\t\t\t\t<#Year />\n\t\t\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`,Z=e=>`\n\t
\n\t\t
\n\t\t\t<#Month />\n\t\t\t<#Year />\n\t\t
\n\t
\n\t
\n\t\t
\n\t\t\t<#Months />\n\t\t
\n\t
\n`,ee=e=>`\n\t
\n\t\t<#ArrowPrev />\n\t\t
\n\t\t\t<#Month />\n\t\t\t<#Year />\n\t\t
\n\t\t<#ArrowNext />\n\t
\n\t
\n\t\t
\n\t\t\t<#Years />\n\t\t
\n\t
\n`,te={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",calendarInputWrapper:"vanilla-calendar-input-wrapper",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",dayBtnHover:"vanilla-calendar-day__btn_hover",dayBtnDisabled:"vanilla-calendar-day__btn_disabled",dayBtnIntermediate:"vanilla-calendar-day__btn_intermediate",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"};return class{constructor(e,i){var d,r,o,u,m,g,v,y,h,S,p,C,b,M,D,T,w,$,f,L,k,H,E,Y,x,N,_,A,F,I,O,P,K,W,j,R,G,z,U,V,J,se,le,ae,ne,ie,de,re,ce,oe,ue,me,ge,ve,ye,he,Se,pe,Ce,be,Me,De,Te,we,$e,fe,Le,ke,He,Ee,Ye,xe,Ne,_e,Ae,Fe,Ie,Be,qe,Oe,Pe,Ke,We,je,Re,Ge,ze,Ue,Ve,Je,Qe,Xe,Ze,et,tt,st,lt,at,nt,it,dt,rt,ct,ot,ut,mt,gt,vt,yt,ht,St,pt,Ct,bt,Mt,Dt,Tt,wt,$t,ft,Lt,kt,Ht,Et,Yt,xt,Nt,_t;(n(this,"HTMLElement"),n(this,"input"),n(this,"type"),n(this,"months"),n(this,"jumpMonths"),n(this,"date"),n(this,"settings"),n(this,"locale"),n(this,"actions"),n(this,"popups"),n(this,"CSSClasses"),n(this,"DOMTemplates"),n(this,"currentType"),n(this,"reset",(()=>q(this))),n(this,"update",(()=>(e=>{var t;let s=null,l=null,a=null;(null==(t=e.settings.selected.dates)?void 0:t[0])||(s=e.settings.selected.dates,e.settings.selected.dates=e.selectedDates),e.settings.selected.month||(l=e.settings.selected.month,e.settings.selected.month=e.selectedMonth),e.settings.selected.year||(a=e.settings.selected.year,e.settings.selected.year=e.selectedYear),c(e),B(e),e.settings.selected.dates=s,e.settings.selected.month=l,e.settings.selected.year=a})(this))),n(this,"init",(()=>Q(this))),this.HTMLElement="string"==typeof e?document.querySelector(e):e,this.HTMLElement)&&(this.input=null!=(d=null==i?void 0:i.input)&&d,this.type=null!=(r=null==i?void 0:i.type)?r:"default",this.months=null!=(o=null==i?void 0:i.months)?o:2,this.jumpMonths=null!=(u=null==i?void 0:i.jumpMonths)?u:1,this.date={min:null!=(g=null==(m=null==i?void 0:i.date)?void 0:m.min)?g:"1970-01-01",max:null!=(y=null==(v=null==i?void 0:i.date)?void 0:v.max)?y:"2470-12-31",today:null!=(S=null==(h=null==i?void 0:i.date)?void 0:h.today)?S:new Date},this.settings={lang:null!=(C=null==(p=null==i?void 0:i.settings)?void 0:p.lang)?C:"en",iso8601:null==(M=null==(b=null==i?void 0:i.settings)?void 0:b.iso8601)||M,range:{min:null!=(w=null==(T=null==(D=null==i?void 0:i.settings)?void 0:D.range)?void 0:T.min)?w:this.date.min,max:null!=(L=null==(f=null==($=null==i?void 0:i.settings)?void 0:$.range)?void 0:f.max)?L:this.date.max,disablePast:null!=(E=null==(H=null==(k=null==i?void 0:i.settings)?void 0:k.range)?void 0:H.disablePast)&&E,disableGaps:null!=(N=null==(x=null==(Y=null==i?void 0:i.settings)?void 0:Y.range)?void 0:x.disableGaps)&&N,disableAllDays:null!=(F=null==(A=null==(_=null==i?void 0:i.settings)?void 0:_.range)?void 0:A.disableAllDays)&&F,disableWeekday:null!=(P=null==(O=null==(I=null==i?void 0:i.settings)?void 0:I.range)?void 0:O.disableWeekday)?P:null,disabled:null!=(j=null==(W=null==(K=null==i?void 0:i.settings)?void 0:K.range)?void 0:W.disabled)?j:null,enabled:null!=(z=null==(G=null==(R=null==i?void 0:i.settings)?void 0:R.range)?void 0:G.enabled)?z:null},selection:{day:null!=(J=null==(V=null==(U=null==i?void 0:i.settings)?void 0:U.selection)?void 0:V.day)?J:"single",month:null==(ae=null==(le=null==(se=null==i?void 0:i.settings)?void 0:se.selection)?void 0:le.month)||ae,year:null==(de=null==(ie=null==(ne=null==i?void 0:i.settings)?void 0:ne.selection)?void 0:ie.year)||de,time:null!=(oe=null==(ce=null==(re=null==i?void 0:i.settings)?void 0:re.selection)?void 0:ce.time)&&oe,controlTime:null!=(ge=null==(me=null==(ue=null==i?void 0:i.settings)?void 0:ue.selection)?void 0:me.controlTime)?ge:"all",stepHours:null!=(he=null==(ye=null==(ve=null==i?void 0:i.settings)?void 0:ve.selection)?void 0:ye.stepHours)?he:1,stepMinutes:null!=(Ce=null==(pe=null==(Se=null==i?void 0:i.settings)?void 0:Se.selection)?void 0:pe.stepMinutes)?Ce:1},selected:{dates:null!=(De=null==(Me=null==(be=null==i?void 0:i.settings)?void 0:be.selected)?void 0:Me.dates)?De:null,month:null!=($e=null==(we=null==(Te=null==i?void 0:i.settings)?void 0:Te.selected)?void 0:we.month)?$e:null,year:null!=(ke=null==(Le=null==(fe=null==i?void 0:i.settings)?void 0:fe.selected)?void 0:Le.year)?ke:null,holidays:null!=(Ye=null==(Ee=null==(He=null==i?void 0:i.settings)?void 0:He.selected)?void 0:Ee.holidays)?Ye:null,time:null!=(_e=null==(Ne=null==(xe=null==i?void 0:i.settings)?void 0:xe.selected)?void 0:Ne.time)?_e:null},visibility:{theme:null!=(Ie=null==(Fe=null==(Ae=null==i?void 0:i.settings)?void 0:Ae.visibility)?void 0:Fe.theme)?Ie:"system",themeDetect:null!=(Oe=null==(qe=null==(Be=null==i?void 0:i.settings)?void 0:Be.visibility)?void 0:qe.themeDetect)?Oe:"html[data-theme]",monthShort:null==(We=null==(Ke=null==(Pe=null==i?void 0:i.settings)?void 0:Pe.visibility)?void 0:Ke.monthShort)||We,weekNumbers:null!=(Ge=null==(Re=null==(je=null==i?void 0:i.settings)?void 0:je.visibility)?void 0:Re.weekNumbers)&&Ge,weekend:null==(Ve=null==(Ue=null==(ze=null==i?void 0:i.settings)?void 0:ze.visibility)?void 0:Ue.weekend)||Ve,today:null==(Xe=null==(Qe=null==(Je=null==i?void 0:i.settings)?void 0:Je.visibility)?void 0:Qe.today)||Xe,disabled:null!=(tt=null==(et=null==(Ze=null==i?void 0:i.settings)?void 0:Ze.visibility)?void 0:et.disabled)&&tt,daysOutside:null==(at=null==(lt=null==(st=null==i?void 0:i.settings)?void 0:st.visibility)?void 0:lt.daysOutside)||at}},this.locale={months:null!=(it=null==(nt=null==i?void 0:i.locale)?void 0:nt.months)?it:[],weekday:null!=(rt=null==(dt=null==i?void 0:i.locale)?void 0:dt.weekday)?rt:[]},this.actions={clickDay:null!=(ot=null==(ct=null==i?void 0:i.actions)?void 0:ct.clickDay)?ot:null,clickWeekNumber:null!=(mt=null==(ut=null==i?void 0:i.actions)?void 0:ut.clickWeekNumber)?mt:null,clickMonth:null!=(vt=null==(gt=null==i?void 0:i.actions)?void 0:gt.clickMonth)?vt:null,clickYear:null!=(ht=null==(yt=null==i?void 0:i.actions)?void 0:yt.clickYear)?ht:null,clickArrow:null!=(pt=null==(St=null==i?void 0:i.actions)?void 0:St.clickArrow)?pt:null,changeTime:null!=(bt=null==(Ct=null==i?void 0:i.actions)?void 0:Ct.changeTime)?bt:null,changeToInput:null!=(Dt=null==(Mt=null==i?void 0:i.actions)?void 0:Mt.changeToInput)?Dt:null,getDays:null!=(wt=null==(Tt=null==i?void 0:i.actions)?void 0:Tt.getDays)?wt:null},this.popups=null!=($t=null==i?void 0:i.popups)?$t:null,this.CSSClasses=(()=>{const e=((e,n)=>{for(var i in n||(n={}))s.call(n,i)&&a(e,i,n[i]);if(t)for(var i of t(n))l.call(n,i)&&a(e,i,n[i]);return e})({},te);return Object.keys(te).forEach((t=>{var s;(null==(s=null==i?void 0:i.CSSClasses)?void 0:s[t])?e[t]=i.CSSClasses[t]:e[t]=te[t]})),e})(),this.DOMTemplates={default:null!=(Lt=null==(ft=null==i?void 0:i.DOMTemplates)?void 0:ft.default)?Lt:(_t=this.CSSClasses,`\n\t
\n\t\t<#ArrowPrev />\n\t\t
\n\t\t\t<#Month />\n\t\t\t<#Year />\n\t\t
\n\t\t<#ArrowNext />\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:null!=(Ht=null==(kt=null==i?void 0:i.DOMTemplates)?void 0:kt.multiple)?Ht:X(this.CSSClasses),month:null!=(Yt=null==(Et=null==i?void 0:i.DOMTemplates)?void 0:Et.month)?Yt:Z(this.CSSClasses),year:null!=(Nt=null==(xt=null==i?void 0:i.DOMTemplates)?void 0:xt.year)?Nt:ee(this.CSSClasses)},this.currentType=this.type)}}})); +!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,s=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,a=(t,s,l)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[s]=l,n=(e,t,s)=>(a(e,"symbol"!=typeof t?t+"":t,s),s);const i=e=>{const t=e.getFullYear();let s=e.getMonth()+1,l=e.getDate();return s=s<10?`0${s}`:s,l=l<10?`0${l}`:l,`${t}-${s}-${l}`},d=e=>{const t=[];return e.forEach((e=>{e.match(/^(\d{4}-\d{2}-\d{2})$/g)?t.push(e):e.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g,((e,s,l)=>{const a=new Date(`${s}T00:00:00`),n=new Date(`${l}T00:00:00`),d=new Date(a.getTime());for(;d<=n;d.setDate(d.getDate()+1))t.push(i(d));return e}))})),t},r=e=>{const t=Number(e);let s=String(t);return 0===t?s="12":13===t?s="01":14===t?s="02":15===t?s="03":16===t?s="04":17===t?s="05":18===t?s="06":19===t?s="07":20===t?s="08":21===t?s="09":22===t?s="10":23===t&&(s="11"),s},c=e=>{var t,s;e.rangeMin=e.settings.range.min,e.rangeMax=e.settings.range.max,e.rangeDisabled=e.settings.range.disabled?d([...e.settings.range.disabled]):[],e.rangeEnabled=e.settings.range.enabled?d([...e.settings.range.enabled]):[],e.selectedDates=e.settings.selected.dates?d([...e.settings.selected.dates]):[],e.selectedHolidays=e.settings.selected.holidays?d([...e.settings.selected.holidays]):[],e.settings.range.disablePast&&!e.settings.range.disableAllDays&&new Date(`${e.settings.range.min}T00:00:00`)+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]);const l=new Date(`${e.rangeMin}T00:00:00`),a=new Date(`${e.rangeMax}T00:00:00`);l.setDate(l.getDate()-1),a.setDate(a.getDate()+1),e.rangeDisabled.push(i(l)),e.rangeDisabled.push(i(a)),null!==e.settings.selected.month&&e.settings.selected.month>=0&&e.settings.selected.month<12?e.selectedMonth=e.settings.selected.month:e.selectedMonth=e.date.today.getMonth(),null!==e.settings.selected.year&&e.settings.selected.year>=0&&e.settings.selected.year<=9999?e.selectedYear=e.settings.selected.year:e.selectedYear=e.date.today.getFullYear(),e.viewYear=e.selectedYear,e.dateMin=e.settings.visibility.disabled?new Date(`${e.date.min}T00:00:00`):new Date(`${e.rangeMin}T00:00:00`),e.dateMax=e.settings.visibility.disabled?new Date(`${e.date.max}T00:00:00`):new Date(`${e.rangeMax}T00:00:00`);const n=!0===e.settings.selection.time||12===e.settings.selection.time;if(n||24===e.settings.selection.time){if(e.userTime=!1,"string"==typeof e.settings.selected.time){const t=n?/^([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(t,((t,s,l,a)=>(s&&l&&(e.userTime=!0,e.selectedHours=s,e.selectedMinutes=l),a&&n?e.selectedKeeping=a:n&&(e.selectedKeeping="AM"),"")))}!e.userTime&&n?(e.selectedHours=r(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."));"multiple"===e.type&&(1===e.months?(console.warn("The value of the «months» parameter cannot be less than «2», the minimum available value will be initialized."),e.correctMonths=2):e.months>12?(console.warn("The value of the «months» parameter cannot be greater than «12», the maximum available value will be initialized."),e.correctMonths=12):e.correctMonths=e.months)},o=e=>{if(!["default","multiple","year"].includes(e.currentType))return;const t=e.HTMLElement.querySelector(`.${e.CSSClasses.arrowPrev}`),s=e.HTMLElement.querySelector(`.${e.CSSClasses.arrowNext}`);if(!t||!s)return;"default"!==e.currentType&&"multiple"!==e.currentType||(()=>{if(!e.dateMin||!e.dateMax)return;const l=new Date(`${i(new Date(e.selectedYear,e.selectedMonth,1))}T00:00:00`),a=new Date(l.getTime());l.setMonth(l.getMonth()-e.jumpMonths),a.setMonth(a.getMonth()+e.jumpMonths),!e.settings.selection.month||l.getFullYear()e.dateMax.getFullYear()||a.getFullYear()===e.dateMax.getFullYear()&&a.getMonth()>e.dateMax.getMonth()?s.style.visibility="hidden":s.style.visibility=""})(),"year"===e.currentType&&e.dateMin&&e.dateMax&&void 0!==e.viewYear&&(e.dateMin.getFullYear()&&e.viewYear-7<=e.dateMin.getFullYear()?t.style.visibility="hidden":t.style.visibility="",e.dateMax.getFullYear()&&e.viewYear+7>=e.dateMax.getFullYear()?s.style.visibility="hidden":s.style.visibility="")},u=(e,t)=>{if(!e)return null;const s=new Date(`${e}T00:00:00`).getDate(),l=new Date(`${e}T00:00:00`).getMonth(),a=new Date(`${e}T00:00:00`).getFullYear(),n=new Date(a,l,s),i=t?n.getDay()||7:n.getDay();n.setDate(n.getDate()+4-i);const d=new Date(n.getFullYear(),0,1);return{year:a,week:Math.ceil(((+n-+d)/864e5+1)/7)}},m=e=>{var t,s;const l=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.days}`),a=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.weekNumbers}`),n=new Date(e.selectedYear,e.selectedMonth,1),d=document.createElement("div"),r=document.createElement("button");d.className=e.CSSClasses.day,r.className=e.CSSClasses.dayBtn,r.type="button",null==(t=e.selectedDates)||t.sort(((e,t)=>+new Date(e)-+new Date(t))),l.forEach(((t,s)=>{const c=new Date(n.setMonth(e.selectedMonth+s)).getMonth(),o=new Date(n.setFullYear(e.selectedYear,e.selectedMonth+s)).getFullYear(),m=new Date(o,c,1),g=new Date(o,c+1,0).getDate();let v=Number(m.getDay());e.settings.iso8601&&(v=Number((0!==m.getDay()?m.getDay():7)-1)),e.settings.selection.day&&["single","multiple","multiple-ranged"].includes(e.settings.selection.day)&&l[s].classList.add(e.CSSClasses.daysSelecting),l[s].innerHTML="";const y=(t,a,n,i,c)=>{var m,g,v,y,h,S,p,C,b;const M=d.cloneNode(!0),D=r.cloneNode(!0);if(c&&D.classList.add(c),D.innerText=t,D.dataset.calendarDay=n,e.settings.visibility.weekNumbers){const t=u(n,e.settings.iso8601);if(!t)return;D.dataset.calendarWeekNumber=`${t.week}`}(null==(m=e.rangeEnabled)?void 0:m[0])&&e.settings.range.disableAllDays&&!(null==(g=e.rangeDisabled)?void 0:g.includes(n))&&(null==(v=e.rangeDisabled)||v.push(n)),(null==(y=e.rangeEnabled)?void 0:y[0])&&(null==(h=e.rangeDisabled)?void 0:h.includes(n))&&(e.rangeDisabled=null==(S=e.rangeDisabled)?void 0:S.filter((t=>{var s;return!(null==(s=e.rangeEnabled)?void 0:s.includes(t))}))),(null==(p=e.settings.range.disableWeekday)?void 0:p.includes(a))&&!(null==(C=e.rangeDisabled)?void 0:C.includes(n))&&(null==(b=e.rangeDisabled)||b.push(n)),((t,s,l,a,n)=>{(e.rangeMin>a||e.rangeMax{t===a&&s.classList.add(e.CSSClasses.dayBtnHoliday)}));let i=e.date.today.getDate(),d=e.date.today.getMonth()+1;i=i<10?`0${i}`:i,d=d<10?`0${d}`:d;const r=`${e.date.today.getFullYear()}-${d}-${i}`;e.settings.visibility.today&&s.dataset.calendarDay===r&&s.classList.add(e.CSSClasses.dayBtnToday),e.selectedDates&&0===e.selectedDates.indexOf(a)?("multiple-ranged"===e.settings.selection.day&&e.selectedDates.length>1?t.classList.add(e.CSSClasses.daySelectedFirst):t.classList.add(e.CSSClasses.daySelected),s.classList.add(e.CSSClasses.dayBtnSelected)):e.selectedDates&&e.selectedDates[0]&&e.selectedDates.indexOf(a)===e.selectedDates.length-1?(t.classList.add(e.CSSClasses.daySelected),"multiple-ranged"===e.settings.selection.day?t.classList.add(e.CSSClasses.daySelectedLast):t.classList.add(e.CSSClasses.daySelected),s.classList.add(e.CSSClasses.dayBtnSelected)):e.selectedDates&&e.selectedDates.indexOf(a)>0&&"multiple-ranged"===e.settings.selection.day?(t.classList.add(e.CSSClasses.daySelectedIntermediate),s.classList.add(e.CSSClasses.dayBtnSelected),s.classList.add(e.CSSClasses.dayBtnIntermediate)):e.selectedDates&&e.selectedDates.indexOf(a)>0&&(t.classList.add(e.CSSClasses.daySelected),s.classList.add(e.CSSClasses.dayBtnSelected)),Array.isArray(e.rangeDisabled)&&e.rangeDisabled[0]&&e.rangeDisabled.forEach((t=>{t===a&&(s.classList.add(e.CSSClasses.dayBtnDisabled),s.tabIndex=-1)})),!e.settings.selection.month&&n&&(s.classList.add(e.CSSClasses.dayBtnDisabled),s.tabIndex=-1),e.settings.selection.year||new Date(`${a}T00:00:00`).getFullYear()===o||(s.classList.add(e.CSSClasses.dayBtnDisabled),s.tabIndex=-1)})(M,D,a,n,i),i?e.settings.visibility.daysOutside&&M.append(D):M.append(D),l[s].append(M),e.actions.getDays&&e.actions.getDays(Number(t),n,M,D)};(()=>{let t=new Date(o,c,0).getDate()-v,s=o,l=c;0===c?(l=e.locale.months.length,s=o-1):c<10&&(l=`0${c}`);for(let a=0;a{for(let e=1;e<=g;e++){const t=new Date(o,c,e),s=i(t),l=t.getDay();y(String(e),l,s,!1,null)}})(),(()=>{const t=v+g,s=Math.ceil(t/e.locale.weekday.length),l=e.locale.weekday.length*s-t;let a=o,n=String(c+2);c+1===e.locale.months.length?(n="01",a=o+1):c+2<10&&(n=`0${c+2}`);for(let i=1;i<=l;i++){const t=`${a}-${n}-${i<10?`0${i}`:String(i)}`,s=new Date(o,c,i).getMonth()+1,l=new Date(o,s,i).getDay();y(String(i),l,t,!0,e.CSSClasses.dayBtnNext)}})(),((e,t)=>{e.popups&&Object.keys(e.popups).forEach((s=>{var l;const a=t.querySelector(`[data-calendar-day="${s}"]`);if(a){const t=null==(l=e.popups)?void 0:l[s];(null==t?void 0:t.modifier)&&t.modifier.trim().split(" ").forEach((e=>{a.classList.add(e)})),(null==t?void 0:t.html)&&(a.parentNode.innerHTML+=`
${t.html}
`)}}))})(e,l[s]),((e,t,s,l,a)=>{if(!e.settings.visibility.weekNumbers)return;const n=a.querySelectorAll(`.${e.CSSClasses.day}`);l.innerHTML="";const i=Math.ceil((t+s)/7),d=document.createElement("b");d.className=e.CSSClasses.weekNumbersTitle,d.innerText="#",l.append(d);const r=document.createElement("div");r.className=e.CSSClasses.weekNumbersContent,l.append(r);const c=document.createElement("span");c.className=e.CSSClasses.weekNumber;for(let o=0;o+new Date(e)-+new Date(t)))},g=e=>`\n\t\n`,v=e=>`\n\t\n`,y=e=>`\n\t\n`,h=e=>`\n\t\n`,S=e=>`\n\t
\n`,p=e=>`\n\t
\n`,C=e=>`\n\t
\n`,b=e=>`\n\t
\n`,M=e=>e.settings.visibility.weekNumbers?`\n\t
\n`:"",D=e=>e.settings.selection.time?`\n\t
\n`:"",T=(e,t)=>t.replace(/<#(.*?)\/>/g,((t,s)=>{const l=(e=>{let t=null;switch(e){case"ArrowPrev":t=g;break;case"ArrowNext":t=v;break;case"Month":t=y;break;case"Year":t=h;break;case"Week":t=S;break;case"Days":t=p;break;case"Months":t=C;break;case"Years":t=b;break;case"WeekNumbers":t=M;break;case"ControlTime":t=D}return t})(s.replace(/[\s\n\t]/g,""));return l?l(e):""})).replace(/[\n\t]/g,""),w=(e,t)=>{const s=e.HTMLElement;s.classList.add(e.CSSClasses.calendar);const l=(s,l)=>{if(!t)return;const a=e.HTMLElement.querySelector(`.${e.CSSClasses.controls}`);a&&e.HTMLElement.removeChild(a);e.HTMLElement.querySelector(`.${e.CSSClasses.grid}`).classList.add(e.CSSClasses.gridDisabled);const n=t.closest(`.${e.CSSClasses.column}`);n.classList.add(s),n.innerHTML=T(e,l)};switch(e.currentType){case"default":s.classList.add(e.CSSClasses.calendarDefault),s.classList.remove(e.CSSClasses.calendarMonth),s.classList.remove(e.CSSClasses.calendarYear),s.innerHTML=T(e,e.DOMTemplates.default);break;case"multiple":if(!e.correctMonths)break;s.classList.add(e.CSSClasses.calendarMultiple),s.classList.remove(e.CSSClasses.calendarMonth),s.classList.remove(e.CSSClasses.calendarYear),s.innerHTML=((e,t)=>t.replace(/<#Multiple>(.*?)<#\/Multiple>/g,((t,s)=>{let l="";for(let a=0;a{const t=e.HTMLElement.querySelectorAll("[data-calendar-selected-month]");if(!t[0]||void 0===e.selectedMonth)return;const s=new Date(e.selectedYear,e.selectedMonth,1);t.forEach(((l,a)=>{const n=new Date(s.setMonth(e.selectedMonth+a)).getMonth();t[a].dataset.calendarSelectedMonth=String(n),t[a].innerText=e.locale.months[n],!1===e.settings.selection.month||"only-arrows"===e.settings.selection.month?(t[a].tabIndex=-1,t[a].classList.add(e.CSSClasses.monthDisabled)):(t[a].tabIndex=0,t[a].classList.remove(e.CSSClasses.monthDisabled))}))},f=e=>{const t=e.HTMLElement.querySelectorAll("[data-calendar-selected-year]");if(!t||void 0===e.selectedMonth)return;const s=new Date(e.selectedYear,e.selectedMonth,1);t.forEach(((l,a)=>{const n=new Date(s.setFullYear(e.selectedYear,e.selectedMonth+a)).getFullYear();t[a].dataset.calendarSelectedYear=String(n),t[a].innerText=String(n),!1===e.settings.selection.year||"only-arrows"===e.settings.selection.year?(t[a].tabIndex=-1,t[a].classList.add(e.CSSClasses.yearDisabled)):(t[a].tabIndex=0,t[a].classList.remove(e.CSSClasses.yearDisabled))}))},L=(e,t)=>{const s=(null==t?void 0:t.dataset.calendarSelectedMonth)?Number(null==t?void 0:t.dataset.calendarSelectedMonth):e.selectedMonth;e.currentType="month",w(e,t),$(e),f(e);const l=e.HTMLElement.querySelector(`.${e.CSSClasses.months}`);if(void 0===e.selectedYear||!e.dateMin||!e.dateMax||!l)return;e.settings.selection.month&&l.classList.add(e.CSSClasses.monthsSelecting);const a=e.jumpMonths>1?e.locale.months.map(((t,l)=>s-e.jumpMonths*l)).concat(e.locale.months.map(((t,l)=>s+e.jumpMonths*l))).filter((e=>e>=0&&e<=12)):Array.from(Array(12).keys()),n=document.createElement("button");n.type="button",n.className=e.CSSClasses.monthsMonth;for(let i=0;ie.dateMax.getMonth()&&e.selectedYear===e.dateMax.getFullYear()||i!==s&&!a.includes(i))&&(d.classList.add(e.CSSClasses.monthsMonthDisabled),d.tabIndex=-1),d.dataset.calendarMonth=String(i),d.title=`${t}`,d.innerText=`${e.settings.visibility.monthShort?t.substring(0,3):t}`,l.append(d)}},k=(e,t)=>{const s=Number(e);let l=String(s);return"AM"===t?12===s&&(l="00"):"PM"===t&&(1===s?l="13":2===s?l="14":3===s?l="15":4===s?l="16":5===s?l="17":6===s?l="18":7===s?l="19":8===s?l="20":9===s?l="21":10===s?l="22":11===s&&(l="23")),l},H=e=>{const t=e.HTMLElement.querySelector(`.${e.CSSClasses.time}`);if(!t)return;const s=!0===e.settings.selection.time?12:e.settings.selection.time,l="range"===e.settings.selection.controlTime;t.innerHTML=`\n\t
\n\t\t\n\t\t\n\t\t${12===s?`\n\t\t\n\t\t`:""}\n\t
\n\t
\n\t\t\n\t\t\n\t
`,((e,t)=>{const s=e.HTMLElement.querySelector(`.${e.CSSClasses.timeRange} input[name="hours"]`),l=e.HTMLElement.querySelector(`.${e.CSSClasses.timeRange} input[name="minutes"]`),a=e.HTMLElement.querySelector(`.${e.CSSClasses.timeHours} input[name="hours"]`),n=e.HTMLElement.querySelector(`.${e.CSSClasses.timeMinutes} input[name="minutes"]`),i=e.HTMLElement.querySelector(`.${e.CSSClasses.timeKeeping}`),d=(t,s)=>{t.addEventListener("mouseover",(()=>s.classList.add(e.CSSClasses.isFocus)))},c=(t,s)=>{t.addEventListener("mouseout",(()=>s.classList.remove(e.CSSClasses.isFocus)))},o=(t,s,l)=>{"hours"===l?e.selectedHours=`${s}`:"minutes"===l&&(e.selectedMinutes=`${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,e.HTMLInputElement,e.selectedDates,e.selectedTime,e.selectedHours,e.selectedMinutes,e.selectedKeeping)},u=(t,s,l,a)=>{t.addEventListener("input",(t=>{let n=Number(t.target.value);n=n<10?`0${n}`:`${n}`,"hours"===l&&12===a?Number(t.target.value)0?(s.value=n,e.selectedKeeping="AM",i.innerText=e.selectedKeeping,o(t,n,l)):(0===Number(t.target.value)?(e.selectedKeeping="AM",i.innerText="AM"):(e.selectedKeeping="PM",i.innerText="PM"),s.value=r(t.target.value),o(t,r(t.target.value),l)):(s.value=n,o(t,n,l))}))},m=(t,s,l,a)=>{s.addEventListener("change",(s=>{const n=s.target;let d=Number(n.value);d=d<10?`0${d}`:`${d}`,"hours"===l&&12===a?n.value&&Number(n.value)<=a&&Number(n.value)>0?(n.value=d,t.value=k(d,e.selectedKeeping),o(s,d,l)):n.value&&Number(n.value)<24&&(Number(n.value)>a||0===Number(n.value))?(0===Number(n.value)?(e.selectedKeeping="AM",i.innerText="AM"):(e.selectedKeeping="PM",i.innerText="PM"),n.value=r(n.value),t.value=d,o(s,r(n.value),l)):n.value=e.selectedHours:n.value&&Number(n.value)<=a&&Number(n.value)>=0?(n.value=d,t.value=d,o(s,d,l)):"hours"===l?n.value=e.selectedHours:"minutes"===l&&(n.value=e.selectedMinutes)}))};d(s,a),d(l,n),c(s,a),c(l,n),u(s,a,"hours",24===t?23:12),u(l,n,"minutes",0),m(s,a,"hours",24===t?23:12),m(l,n,"minutes",59),i&&i.addEventListener("click",(t=>{i.innerText.includes("AM")?e.selectedKeeping="PM":e.selectedKeeping="AM",s.value=k(e.selectedHours,e.selectedKeeping),o(t,e.selectedHours,"hours"),i.innerText=e.selectedKeeping}))})(e,s)},Y=e=>{const t=[...e.locale.weekday];if(!t[0])return;const s=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.week}`),l=document.createElement("b");l.className=e.CSSClasses.weekDay,e.settings.iso8601&&t.push(t.shift()),s.forEach((s=>{s.innerHTML="";for(let a=0;a{if(void 0===e.viewYear||!e.dateMin||!e.dateMax)return;const s=(null==t?void 0:t.dataset.calendarSelectedYear)?Number(null==t?void 0:t.dataset.calendarSelectedYear):e.selectedYear;e.currentType="year",w(e,t),$(e),f(e),o(e);const l=e.HTMLElement.querySelector(`.${e.CSSClasses.years}`);if(!l)return;e.settings.selection.year&&l.classList.add(e.CSSClasses.yearsSelecting);const a=document.createElement("button");a.type="button",a.className=e.CSSClasses.yearsYear;for(let n=e.viewYear-7;ne.dateMax.getFullYear()&&(i.classList.add(e.CSSClasses.yearsYearDisabled),i.tabIndex=-1),i.dataset.calendarYear=String(t),i.innerText=`${t}`,l.append(i)}},x=["light","dark","system"];let N=!1;const _=(e,t)=>{var s;let l=null;for(let a=0;a{e.HTMLElement&&(x.includes(t)?e.HTMLElement.dataset.calendarTheme=t:console.error("Incorrect name of theme in settings.visibility.theme"))},F=(e,t)=>{if(!t)return void A(e,"light");const s=e=>e.matches?"dark":"light";e.HTMLElement.dataset.calendarTheme=s(t),N||(t.onchange=t=>{"system"===e.settings.visibility.theme&&(e.HTMLElement.dataset.calendarTheme=s(t))},N=!0)},B=(e,t)=>{if(!e.HTMLElement)return;const s=!!e.settings.visibility.themeDetect&&document.querySelector(e.settings.visibility.themeDetect);if(!s)return void F(e,t);const l=e.settings.visibility.themeDetect.replace(/^.*\[(.+)\]/g,((e,t)=>t)),a=s.hasAttribute(l);if(!l||!a)return void F(e,t);const n=_(s,l);n?(A(e,n),((e,t,s)=>{new MutationObserver((l=>{for(let a=0;a{const t={default(){Y(e),m(e)},multiple(){Y(e),m(e)},month(){L(e)},year(){E(e)}};(e=>{if(!e.HTMLElement)return;let t;"not all"!==window.matchMedia("(prefers-color-scheme)").media&&(t=window.matchMedia("(prefers-color-scheme: dark)")),"system"===e.settings.visibility.theme?B(e,t):A(e,e.settings.visibility.theme)})(e),(e=>{if("define"!==e.settings.lang){e.locale.weekday=[];for(let t=0;t<7;t++){let s=new Date(0,0,t).toLocaleString(e.settings.lang,{weekday:"short"});s=`${s.charAt(0).toUpperCase()}${s.substring(1,s.length)}`,s=s.replace(/\./,""),e.locale.weekday.push(s)}e.locale.months=[];for(let t=0;t<12;t++){let s=new Date(0,t).toLocaleString(e.settings.lang,{month:"long"});s=`${s.charAt(0).toUpperCase()}${s.substring(1,s.length)}`,s=s.replace(/\./,""),e.locale.months.push(s)}}})(e),w(e),$(e),f(e),o(e),H(e),t[e.currentType]()},q=e=>{c(e),I(e)};let O=null;const P=e=>{O&&(e.target.closest(`.${O.CSSClasses.calendar}`)||(document.querySelectorAll(`.${O.CSSClasses.calendar}`).forEach((e=>{e.classList.add(O.CSSClasses.calendarHidden)})),document.removeEventListener("click",P,{capture:!0})))},K=(e,t)=>{if(void 0===e.selectedMonth||void 0===e.selectedYear)return;const s=new Date(`${i(new Date(e.selectedYear,e.selectedMonth,1))}T00:00:00`);switch(t){case"prev":s.setMonth(s.getMonth()-e.jumpMonths);break;case"next":s.setMonth(s.getMonth()+e.jumpMonths)}e.selectedMonth=s.getMonth(),e.selectedYear=s.getFullYear(),$(e),f(e),o(e),m(e)};let W=null;const j=()=>{var e;if(!W)return;const t=null==(e=W.HTMLElement)?void 0:e.querySelectorAll(`.${W.CSSClasses.dayBtnHover}`);t&&t.forEach((e=>e.classList.remove(W.CSSClasses.dayBtnHover)))},R=e=>{var t;if(!W||!W.selectedDates)return;const s=i(e);if(W.rangeDisabled&&W.rangeDisabled.includes(s))return;const l=null==(t=W.HTMLElement)?void 0:t.querySelectorAll(`[data-calendar-day="${s}"]`);null==l||l.forEach((e=>{e.classList.add(W.CSSClasses.dayBtnHover)}))},G=e=>{if(!e.target||!W||!W.selectedDates)return;if(!e.target.closest(`.${W.CSSClasses.days}`))return void j();const t=e.target.dataset.calendarDay;if(!t)return;j();const s=new Date(new Date(`${W.selectedDates[0]}T00:00:00`).getFullYear(),new Date(`${W.selectedDates[0]}T00:00:00`).getMonth(),new Date(`${W.selectedDates[0]}T00:00:00`).getDate()),l=new Date(new Date(`${t}T00:00:00`).getFullYear(),new Date(`${t}T00:00:00`).getMonth(),new Date(`${t}T00:00:00`).getDate());if(l>s)for(let a=s;a<=l;a.setDate(a.getDate()+1))R(a);else for(let a=s;a>=l;a.setDate(a.getDate()-1))R(a)},z=e=>{W&&"Escape"===e.key&&(W.selectedDates=[],W.HTMLElement.removeEventListener("mousemove",G),document.removeEventListener("keydown",z),I(W))},U=e=>{e&&e.selectedDates&&(W=e,e.selectedDates[0]&&e.selectedDates.length<=1?(e.HTMLElement.addEventListener("mousemove",G),document.addEventListener("keydown",z),e.settings.range.disableGaps&&(()=>{var e;if(!W||!(null==(e=W.selectedDates)?void 0:e[0])||!W.rangeDisabled||W.rangeDisabled.length<2)return;const t=new Date(`${W.selectedDates[0]}T00:00:00`);let s=null,l=null;for(let a=0;a=e)){l=e;break}s=e}s&&(s=new Date(s.setDate(s.getDate()+1)),W.rangeMin=i(s)),l&&(l=new Date(l.setDate(l.getDate()-1)),W.rangeMax=i(l))})()):(e.HTMLElement.removeEventListener("mousemove",G),document.removeEventListener("keydown",z),e.settings.range.disableGaps&&W&&(W.rangeMin=W.settings.range.min,W.rangeMax=W.settings.range.max,W.settings.range.disablePast&&new Date(`${W.settings.range.min}T00:00:00`){const n=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`),i=[...n].findIndex((e=>e.classList.contains(t))),d=Number(n[i].querySelector(`.${s}`).getAttribute(a));return"month"===e.currentType&&i>=0?l-i:"year"===e.currentType&&e.selectedYear!==d?l-1:l},J=e=>{e.HTMLElement.addEventListener("click",(t=>{const s=t.target,l=s.closest(`.${e.CSSClasses.arrow}`),a=s.closest(`.${e.CSSClasses.arrowPrev}`),n=s.closest(`.${e.CSSClasses.arrowNext}`),d=s.closest(`.${e.CSSClasses.dayBtn}`),r=s.closest(`.${e.CSSClasses.dayBtnPrev}`),c=s.closest(`.${e.CSSClasses.dayBtnNext}`),o=s.closest(`.${e.CSSClasses.weekNumber}`),u=s.closest(`.${e.CSSClasses.year}`),g=s.closest(`.${e.CSSClasses.yearsYear}`),v=s.closest(`.${e.CSSClasses.month}`),y=s.closest(`.${e.CSSClasses.monthsMonth}`),h=s.closest(`.${e.CSSClasses.grid}`),S=s.closest(`.${e.CSSClasses.column}`);l&&"year"!==e.currentType&&"month"!==e.currentType&&K(e,s.dataset.calendarArrow),l&&e.actions.clickArrow&&e.actions.clickArrow(t,Number(e.selectedYear),Number(e.selectedMonth)),(()=>{if(e.settings.selection.day&&["single","multiple","multiple-ranged"].includes(e.settings.selection.day)&&d){switch(e.settings.selection.day){case"single":e.selectedDates&&d&&d.dataset.calendarDay&&(d.classList.contains(e.CSSClasses.dayBtnSelected)?e.selectedDates.splice(e.selectedDates.indexOf(d.dataset.calendarDay),1):(e.selectedDates=[],e.selectedDates.push(d.dataset.calendarDay)));break;case"multiple":e.selectedDates&&d&&d.dataset.calendarDay&&(d.classList.contains(e.CSSClasses.dayBtnSelected)?e.selectedDates.splice(e.selectedDates.indexOf(d.dataset.calendarDay),1):e.selectedDates.push(d.dataset.calendarDay));break;case"multiple-ranged":(()=>{if(e.selectedDates&&d&&d.dataset.calendarDay){if(e.selectedDates.length<=1&&e.selectedDates[0]&&e.selectedDates[0].includes(d.dataset.calendarDay)?e.selectedDates=[]:(e.selectedDates.length>1&&(e.selectedDates=[]),e.selectedDates.push(d.dataset.calendarDay)),e.selectedDates[1]){const t=new Date(new Date(`${e.selectedDates[0]}T00:00:00`).getFullYear(),new Date(`${e.selectedDates[0]}T00:00:00`).getMonth(),new Date(`${e.selectedDates[0]}T00:00:00`).getDate()),s=new Date(new Date(`${e.selectedDates[1]}T00:00:00`).getFullYear(),new Date(`${e.selectedDates[1]}T00:00:00`).getMonth(),new Date(`${e.selectedDates[1]}T00:00:00`).getDate()),l=t=>{if(!e.selectedDates)return;const s=i(t);e.rangeDisabled&&e.rangeDisabled.includes(s)||e.selectedDates.push(s)};if(e.selectedDates=[],s>t)for(let e=t;e<=s;e.setDate(e.getDate()+1))l(e);else for(let e=t;e>=s;e.setDate(e.getDate()-1))l(e)}U(e)}})()}e.actions.clickDay&&e.actions.clickDay(t,e.selectedDates),e.input&&e.HTMLInputElement&&e.actions.changeToInput&&e.actions.changeToInput(t,e.HTMLInputElement,e.selectedDates,e.selectedTime,e.selectedHours,e.selectedMinutes,e.selectedKeeping),r?K(e,"prev"):c?K(e,"next"):m(e)}})(),(()=>{var s;if(!e.settings.visibility.weekNumbers||!o||!e.actions.clickWeekNumber)return;const l=null==(s=e.HTMLElement)?void 0:s.querySelectorAll("[data-calendar-week-number]");if(!l)return;const a=Number(o.innerText),n=Number(o.dataset.calendarYearWeek),i=[...l].filter((e=>Number(e.dataset.calendarWeekNumber)===a));e.actions.clickWeekNumber(t,a,i,n)})(),(()=>{if(e.settings.selection.year)if(l&&"year"===e.currentType){if(void 0===e.viewYear)return;n?e.viewYear+=15:a&&(e.viewYear-=15),E(e,t.target)}else if("year"!==e.currentType&&u)E(e,t.target);else if("year"===e.currentType&&u)e.currentType=e.type,I(e);else if(g){if(void 0===e.selectedMonth||!e.dateMin||!e.dateMax)return;e.selectedYear="multiple"===e.type?V(e,e.CSSClasses.columnYear,e.CSSClasses.year,Number(g.dataset.calendarYear),"data-calendar-selected-year"):Number(g.dataset.calendarYear),e.currentType=e.type,e.selectedMonthe.dateMax.getMonth()&&e.selectedYear===e.dateMax.getFullYear()&&(e.selectedMonth=e.dateMax.getMonth()),e.actions.clickYear&&e.actions.clickYear(t,e.selectedYear),I(e)}else"multiple"===e.type&&"year"===e.currentType&&h&&!S&&(e.currentType=e.type,I(e))})(),(()=>{if(e.settings.selection.month)if("month"!==e.currentType&&v)L(e,t.target);else if("month"===e.currentType&&v)e.currentType=e.type,I(e);else if(y){if(e.selectedMonth="multiple"===e.type?V(e,e.CSSClasses.columnMonth,e.CSSClasses.month,Number(y.dataset.calendarMonth),"data-calendar-selected-month"):Number(y.dataset.calendarMonth),"multiple"===e.type){const t=y.closest(`.${e.CSSClasses.columnMonth}`).querySelector(`.${e.CSSClasses.year}`);e.selectedYear=Number(t.dataset.calendarSelectedYear)}e.currentType=e.type,e.actions.clickMonth&&e.actions.clickMonth(t,e.selectedMonth),I(e)}else"multiple"===e.type&&"month"===e.currentType&&h&&!S&&(e.currentType=e.type,I(e))})()}))},Q=e=>{e.HTMLElement&&((e=>{if(!e.input||!e.HTMLElement||!e.HTMLElement.parentNode)return;e.HTMLInputElement=e.HTMLElement;const t=document.createElement("div"),s=document.createElement("div");t.className=e.CSSClasses.calendarInputWrapper,s.className=`${e.CSSClasses.calendar} ${e.CSSClasses.calendarToInput} ${e.CSSClasses.calendarHidden}`,e.HTMLElement.parentNode.insertBefore(t,e.HTMLInputElement),t.append(e.HTMLInputElement),e.HTMLElement=s,t.append(e.HTMLElement)})(e),q(e),(e=>{var t;e&&e.input&&(O=e,null==(t=e.HTMLInputElement)||t.addEventListener("click",(()=>{var t;null==(t=e.HTMLElement)||t.classList.remove(e.CSSClasses.calendarHidden),document.addEventListener("click",P,{capture:!0})})))})(e),J(e))},X=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\t
\n\t\t\t\t\t\t<#Month />\n\t\t\t\t\t\t<#Year />\n\t\t\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`,Z=e=>`\n\t
\n\t\t
\n\t\t\t<#Month />\n\t\t\t<#Year />\n\t\t
\n\t
\n\t
\n\t\t
\n\t\t\t<#Months />\n\t\t
\n\t
\n`,ee=e=>`\n\t
\n\t\t<#ArrowPrev />\n\t\t
\n\t\t\t<#Month />\n\t\t\t<#Year />\n\t\t
\n\t\t<#ArrowNext />\n\t
\n\t
\n\t\t
\n\t\t\t<#Years />\n\t\t
\n\t
\n`,te={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",calendarInputWrapper:"vanilla-calendar-input-wrapper",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",dayBtnHover:"vanilla-calendar-day__btn_hover",dayBtnDisabled:"vanilla-calendar-day__btn_disabled",dayBtnIntermediate:"vanilla-calendar-day__btn_intermediate",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"};return class{constructor(e,i){var d,r,o,u,m,g,v,y,h,S,p,C,b,M,D,T,w,$,f,L,k,H,Y,E,x,N,_,A,F,B,O,P,K,W,j,R,G,z,U,V,J,se,le,ae,ne,ie,de,re,ce,oe,ue,me,ge,ve,ye,he,Se,pe,Ce,be,Me,De,Te,we,$e,fe,Le,ke,He,Ye,Ee,xe,Ne,_e,Ae,Fe,Be,Ie,qe,Oe,Pe,Ke,We,je,Re,Ge,ze,Ue,Ve,Je,Qe,Xe,Ze,et,tt,st,lt,at,nt,it,dt,rt,ct,ot,ut,mt,gt,vt,yt,ht,St,pt,Ct,bt,Mt,Dt,Tt,wt,$t,ft,Lt,kt,Ht,Yt,Et,xt,Nt,_t;(n(this,"HTMLElement"),n(this,"input"),n(this,"type"),n(this,"months"),n(this,"jumpMonths"),n(this,"date"),n(this,"settings"),n(this,"locale"),n(this,"actions"),n(this,"popups"),n(this,"CSSClasses"),n(this,"DOMTemplates"),n(this,"currentType"),n(this,"reset",(()=>q(this))),n(this,"update",(()=>(e=>{var t;let s=null,l=null,a=null;(null==(t=e.settings.selected.dates)?void 0:t[0])||(s=e.settings.selected.dates,e.settings.selected.dates=e.selectedDates),e.settings.selected.month||(l=e.settings.selected.month,e.settings.selected.month=e.selectedMonth),e.settings.selected.year||(a=e.settings.selected.year,e.settings.selected.year=e.selectedYear),c(e),I(e),e.settings.selected.dates=s,e.settings.selected.month=l,e.settings.selected.year=a})(this))),n(this,"init",(()=>Q(this))),this.HTMLElement="string"==typeof e?document.querySelector(e):e,this.HTMLElement)&&(this.input=null!=(d=null==i?void 0:i.input)&&d,this.type=null!=(r=null==i?void 0:i.type)?r:"default",this.months=null!=(o=null==i?void 0:i.months)?o:2,this.jumpMonths=null!=(u=null==i?void 0:i.jumpMonths)?u:1,this.date={min:null!=(g=null==(m=null==i?void 0:i.date)?void 0:m.min)?g:"1970-01-01",max:null!=(y=null==(v=null==i?void 0:i.date)?void 0:v.max)?y:"2470-12-31",today:null!=(S=null==(h=null==i?void 0:i.date)?void 0:h.today)?S:new Date},this.settings={lang:null!=(C=null==(p=null==i?void 0:i.settings)?void 0:p.lang)?C:"en",iso8601:null==(M=null==(b=null==i?void 0:i.settings)?void 0:b.iso8601)||M,range:{min:null!=(w=null==(T=null==(D=null==i?void 0:i.settings)?void 0:D.range)?void 0:T.min)?w:this.date.min,max:null!=(L=null==(f=null==($=null==i?void 0:i.settings)?void 0:$.range)?void 0:f.max)?L:this.date.max,disablePast:null!=(Y=null==(H=null==(k=null==i?void 0:i.settings)?void 0:k.range)?void 0:H.disablePast)&&Y,disableGaps:null!=(N=null==(x=null==(E=null==i?void 0:i.settings)?void 0:E.range)?void 0:x.disableGaps)&&N,disableAllDays:null!=(F=null==(A=null==(_=null==i?void 0:i.settings)?void 0:_.range)?void 0:A.disableAllDays)&&F,disableWeekday:null!=(P=null==(O=null==(B=null==i?void 0:i.settings)?void 0:B.range)?void 0:O.disableWeekday)?P:null,disabled:null!=(j=null==(W=null==(K=null==i?void 0:i.settings)?void 0:K.range)?void 0:W.disabled)?j:null,enabled:null!=(z=null==(G=null==(R=null==i?void 0:i.settings)?void 0:R.range)?void 0:G.enabled)?z:null},selection:{day:null!=(J=null==(V=null==(U=null==i?void 0:i.settings)?void 0:U.selection)?void 0:V.day)?J:"single",month:null==(ae=null==(le=null==(se=null==i?void 0:i.settings)?void 0:se.selection)?void 0:le.month)||ae,year:null==(de=null==(ie=null==(ne=null==i?void 0:i.settings)?void 0:ne.selection)?void 0:ie.year)||de,time:null!=(oe=null==(ce=null==(re=null==i?void 0:i.settings)?void 0:re.selection)?void 0:ce.time)&&oe,controlTime:null!=(ge=null==(me=null==(ue=null==i?void 0:i.settings)?void 0:ue.selection)?void 0:me.controlTime)?ge:"all",stepHours:null!=(he=null==(ye=null==(ve=null==i?void 0:i.settings)?void 0:ve.selection)?void 0:ye.stepHours)?he:1,stepMinutes:null!=(Ce=null==(pe=null==(Se=null==i?void 0:i.settings)?void 0:Se.selection)?void 0:pe.stepMinutes)?Ce:1},selected:{dates:null!=(De=null==(Me=null==(be=null==i?void 0:i.settings)?void 0:be.selected)?void 0:Me.dates)?De:null,month:null!=($e=null==(we=null==(Te=null==i?void 0:i.settings)?void 0:Te.selected)?void 0:we.month)?$e:null,year:null!=(ke=null==(Le=null==(fe=null==i?void 0:i.settings)?void 0:fe.selected)?void 0:Le.year)?ke:null,holidays:null!=(Ee=null==(Ye=null==(He=null==i?void 0:i.settings)?void 0:He.selected)?void 0:Ye.holidays)?Ee:null,time:null!=(_e=null==(Ne=null==(xe=null==i?void 0:i.settings)?void 0:xe.selected)?void 0:Ne.time)?_e:null},visibility:{theme:null!=(Be=null==(Fe=null==(Ae=null==i?void 0:i.settings)?void 0:Ae.visibility)?void 0:Fe.theme)?Be:"system",themeDetect:null!=(Oe=null==(qe=null==(Ie=null==i?void 0:i.settings)?void 0:Ie.visibility)?void 0:qe.themeDetect)?Oe:"html[data-theme]",monthShort:null==(We=null==(Ke=null==(Pe=null==i?void 0:i.settings)?void 0:Pe.visibility)?void 0:Ke.monthShort)||We,weekNumbers:null!=(Ge=null==(Re=null==(je=null==i?void 0:i.settings)?void 0:je.visibility)?void 0:Re.weekNumbers)&&Ge,weekend:null==(Ve=null==(Ue=null==(ze=null==i?void 0:i.settings)?void 0:ze.visibility)?void 0:Ue.weekend)||Ve,today:null==(Xe=null==(Qe=null==(Je=null==i?void 0:i.settings)?void 0:Je.visibility)?void 0:Qe.today)||Xe,disabled:null!=(tt=null==(et=null==(Ze=null==i?void 0:i.settings)?void 0:Ze.visibility)?void 0:et.disabled)&&tt,daysOutside:null==(at=null==(lt=null==(st=null==i?void 0:i.settings)?void 0:st.visibility)?void 0:lt.daysOutside)||at}},this.locale={months:null!=(it=null==(nt=null==i?void 0:i.locale)?void 0:nt.months)?it:[],weekday:null!=(rt=null==(dt=null==i?void 0:i.locale)?void 0:dt.weekday)?rt:[]},this.actions={clickDay:null!=(ot=null==(ct=null==i?void 0:i.actions)?void 0:ct.clickDay)?ot:null,clickWeekNumber:null!=(mt=null==(ut=null==i?void 0:i.actions)?void 0:ut.clickWeekNumber)?mt:null,clickMonth:null!=(vt=null==(gt=null==i?void 0:i.actions)?void 0:gt.clickMonth)?vt:null,clickYear:null!=(ht=null==(yt=null==i?void 0:i.actions)?void 0:yt.clickYear)?ht:null,clickArrow:null!=(pt=null==(St=null==i?void 0:i.actions)?void 0:St.clickArrow)?pt:null,changeTime:null!=(bt=null==(Ct=null==i?void 0:i.actions)?void 0:Ct.changeTime)?bt:null,changeToInput:null!=(Dt=null==(Mt=null==i?void 0:i.actions)?void 0:Mt.changeToInput)?Dt:null,getDays:null!=(wt=null==(Tt=null==i?void 0:i.actions)?void 0:Tt.getDays)?wt:null},this.popups=null!=($t=null==i?void 0:i.popups)?$t:null,this.CSSClasses=(()=>{const e=((e,n)=>{for(var i in n||(n={}))s.call(n,i)&&a(e,i,n[i]);if(t)for(var i of t(n))l.call(n,i)&&a(e,i,n[i]);return e})({},te);return Object.keys(te).forEach((t=>{var s;(null==(s=null==i?void 0:i.CSSClasses)?void 0:s[t])?e[t]=i.CSSClasses[t]:e[t]=te[t]})),e})(),this.DOMTemplates={default:null!=(Lt=null==(ft=null==i?void 0:i.DOMTemplates)?void 0:ft.default)?Lt:(_t=this.CSSClasses,`\n\t
\n\t\t<#ArrowPrev />\n\t\t
\n\t\t\t<#Month />\n\t\t\t<#Year />\n\t\t
\n\t\t<#ArrowNext />\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:null!=(Ht=null==(kt=null==i?void 0:i.DOMTemplates)?void 0:kt.multiple)?Ht:X(this.CSSClasses),month:null!=(Et=null==(Yt=null==i?void 0:i.DOMTemplates)?void 0:Yt.month)?Et:Z(this.CSSClasses),year:null!=(Nt=null==(xt=null==i?void 0:i.DOMTemplates)?void 0:xt.year)?Nt:ee(this.CSSClasses)},this.currentType=this.type)}}})); diff --git a/package/build/vanilla-calendar.min.mjs b/package/build/vanilla-calendar.min.mjs index ae5adbb0..07f66521 100644 --- a/package/build/vanilla-calendar.min.mjs +++ b/package/build/vanilla-calendar.min.mjs @@ -603,7 +603,7 @@ const showMonth = (self) => { const selectedMonth = new Date(initDate.setMonth(self.selectedMonth + index)).getMonth(); months[index].dataset.calendarSelectedMonth = String(selectedMonth); months[index].innerText = self.locale.months[selectedMonth]; - if (!self.settings.selection.month) { + if (self.settings.selection.month === false || self.settings.selection.month === "only-arrows") { months[index].tabIndex = -1; months[index].classList.add(self.CSSClasses.monthDisabled); } else { @@ -621,7 +621,7 @@ const showYear = (self) => { const selectedYear = new Date(initDate.setFullYear(self.selectedYear, self.selectedMonth + index)).getFullYear(); years[index].dataset.calendarSelectedYear = String(selectedYear); years[index].innerText = String(selectedYear); - if (!self.settings.selection.year) { + if (self.settings.selection.year === false || self.settings.selection.year === "only-arrows") { years[index].tabIndex = -1; years[index].classList.add(self.CSSClasses.yearDisabled); } else { @@ -641,6 +641,7 @@ const createMonths = (self, target) => { return; if (self.settings.selection.month) monthsEl.classList.add(self.CSSClasses.monthsSelecting); + const activeMonthsID = self.jumpMonths > 1 ? self.locale.months.map((_, i) => selectedMonth - self.jumpMonths * i).concat(self.locale.months.map((_, i) => selectedMonth + self.jumpMonths * i)).filter((monthID) => monthID >= 0 && monthID <= 12) : Array.from(Array(12).keys()); const templateMonthEl = document.createElement("button"); templateMonthEl.type = "button"; templateMonthEl.className = self.CSSClasses.monthsMonth; @@ -650,11 +651,7 @@ const createMonths = (self, target) => { if (i === selectedMonth) { monthEl.classList.add(self.CSSClasses.monthsMonthSelected); } - if (i < self.dateMin.getMonth() && self.selectedYear === self.dateMin.getFullYear()) { - monthEl.classList.add(self.CSSClasses.monthsMonthDisabled); - monthEl.tabIndex = -1; - } - if (i > self.dateMax.getMonth() && self.selectedYear === self.dateMax.getFullYear()) { + if (i < self.dateMin.getMonth() && self.selectedYear === self.dateMin.getFullYear() || i > self.dateMax.getMonth() && self.selectedYear === self.dateMax.getFullYear() || i !== selectedMonth && !activeMonthsID.includes(i)) { monthEl.classList.add(self.CSSClasses.monthsMonthDisabled); monthEl.tabIndex = -1; } @@ -1236,15 +1233,12 @@ const handlerMultipleRanged = (self) => { }; const getColumnID = (self, columnClass, personalClass, id, dataAttr) => { const columnEls = self.HTMLElement.querySelectorAll(`.${self.CSSClasses.column}`); - const firstColumnID = Number(columnEls[0].querySelector(`.${personalClass}`).getAttribute(dataAttr)); - const lastColumnID = Number(columnEls[columnEls.length - 1].querySelector(`.${personalClass}`).getAttribute(dataAttr)); const indexColumn = [...columnEls].findIndex((column) => column.classList.contains(columnClass)); - if (firstColumnID === lastColumnID || indexColumn < 0) { - return id; - } - if (firstColumnID < lastColumnID || self.currentType !== "year" && firstColumnID > lastColumnID) { + const currentValue = Number(columnEls[indexColumn].querySelector(`.${personalClass}`).getAttribute(dataAttr)); + if (self.currentType === "month" && indexColumn >= 0) return id - indexColumn; - } + if (self.currentType === "year" && self.selectedYear !== currentValue) + return id - 1; return id; }; const clickCalendar = (self) => {