123456 |
- /*!
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
- * v1.0.0-beta.97
- */
- import{r as t,c as e,h as a,H as i,g as r,F as s}from"./p-91755387.js";import{T as o,f as n,d as c,a as l,g as h,b as d,c as u,s as p,H as g,e as f,i as v,h as m,n as w,j as y}from"./p-64b5872b.js";import{c as x,d as b,n as k}from"./p-4ca93e87.js";import{c as D,a as z}from"./p-96bf42e5.js";import{C as _}from"./p-af9e6e54.js";import{u as C}from"./p-4d9ab6e1.js";import{i as A}from"./p-5ae3b7c4.js";import{H as P}from"./p-25482df1.js";import"./p-8dc9be64.js";import"./p-d5bfadd8.js";const S=class{constructor(a){t(this,a),this.calciteDatePickerChange=e(this,"calciteDatePickerChange",6),this.calciteDatePickerRangeChange=e(this,"calciteDatePickerRangeChange",6),this.intlPrevMonth=o.prevMonth,this.intlNextMonth=o.nextMonth,this.intlYear=o.year,this.scale="m",this.range=!1,this.proximitySelectionDisabled=!1,this.globalAttributes={},this.effectiveLocale="",this.keyDownHandler=t=>{"Escape"===t.key&&this.reset()},this.monthHeaderSelectChange=t=>{const e=new Date(t.detail);this.range?("end"===this.activeRange?this.activeEndDate=e:this.activeStartDate=e,this.mostRecentRangeValue=e):this.activeDate=e},this.monthActiveDateChange=t=>{const e=new Date(t.detail);this.range?("end"===this.activeRange?this.activeEndDate=e:this.activeStartDate=e,this.mostRecentRangeValue=e):this.activeDate=e},this.monthHoverChange=t=>{if(!this.startAsDate)return void(this.hoverRange=void 0);const e=new Date(t.detail);if(this.hoverRange={focused:this.activeRange||"start",start:this.startAsDate,end:this.endAsDate},this.proximitySelectionDisabled)this.endAsDate?this.hoverRange=void 0:e<this.startAsDate?this.hoverRange={focused:"start",start:e,end:this.startAsDate}:(this.hoverRange.end=e,this.hoverRange.focused="end");else if(this.endAsDate){const t=n(e,this.startAsDate),a=n(e,this.endAsDate);a>0?(this.hoverRange.end=e,this.hoverRange.focused="end"):t<0||t>a?(this.hoverRange.start=e,this.hoverRange.focused="start"):(this.hoverRange.end=e,this.hoverRange.focused="end")}else e<this.startAsDate?this.hoverRange={focused:"start",start:e,end:this.startAsDate}:(this.hoverRange.end=e,this.hoverRange.focused="end");t.stopPropagation()},this.monthMouseOutChange=()=>{this.hoverRange&&(this.hoverRange=void 0)},this.reset=()=>{var t,e,a,i,r,s;!Array.isArray(this.valueAsDate)&&this.valueAsDate&&(null===(t=this.valueAsDate)||void 0===t?void 0:t.getTime())!==(null===(e=this.activeDate)||void 0===e?void 0:e.getTime())&&(this.activeDate=new Date(this.valueAsDate)),this.startAsDate&&(null===(a=this.startAsDate)||void 0===a?void 0:a.getTime())!==(null===(i=this.activeStartDate)||void 0===i?void 0:i.getTime())&&(this.activeStartDate=new Date(this.startAsDate)),this.endAsDate&&(null===(r=this.endAsDate)||void 0===r?void 0:r.getTime())!==(null===(s=this.activeEndDate)||void 0===s?void 0:s.getTime())&&(this.activeEndDate=new Date(this.endAsDate))},this.monthDateChange=t=>{const e=new Date(t.detail);if(!this.range)return this.value=e?c(e):"",this.valueAsDate=e||null,this.activeDate=e||null,void this.calciteDatePickerChange.emit(e);if(!this.startAsDate||!this.endAsDate&&e<this.startAsDate)this.startAsDate&&this.setEndDate(new Date(this.startAsDate)),"end"==this.activeRange?this.setEndDate(e):this.setStartDate(e);else if(this.endAsDate)if(this.proximitySelectionDisabled)this.setStartDate(e),this.endAsDate=this.activeEndDate=this.end=void 0;else if(this.activeRange)"end"==this.activeRange?this.setEndDate(e):this.setStartDate(e);else{const t=n(e,this.startAsDate),a=n(e,this.endAsDate);0===a||t<0?this.setStartDate(e):0===t||a<0?this.setEndDate(e):t<a?this.setStartDate(e):this.setEndDate(e)}else this.setEndDate(e);this.calciteDatePickerChange.emit(e)}}handleValueAsDate(t){!Array.isArray(t)&&t&&t!==this.activeDate&&(this.activeDate=t)}handleRangeChange(){const{startAsDate:t,endAsDate:e}=this;this.activeEndDate=e,this.activeStartDate=t}onMinChanged(t){t&&(this.minAsDate=l(t))}onMaxChanged(t){t&&(this.maxAsDate=l(t))}connectedCallback(){x(this),Array.isArray(this.value)?(this.valueAsDate=h(this.value),this.start=this.value[0],this.end=this.value[1]):this.value&&(this.valueAsDate=l(this.value)),this.start&&this.setStartAsDate(l(this.start)),this.end&&this.setEndAsDate(l(this.end)),this.min&&(this.minAsDate=l(this.min)),this.max&&(this.maxAsDate=l(this.max))}disconnectedCallback(){b(this)}async componentWillLoad(){await this.loadLocaleData(),this.onMinChanged(this.min),this.onMaxChanged(this.max)}render(){var t;const e=d(this.range?this.startAsDate:this.valueAsDate,this.minAsDate,this.maxAsDate);let r=this.range?this.getActiveStartDate(e,this.minAsDate,this.maxAsDate):this.getActiveDate(e,this.minAsDate,this.maxAsDate);const s=this.range?d(this.endAsDate,this.minAsDate,this.maxAsDate):null,o=this.getActiveEndDate(s,this.minAsDate,this.maxAsDate);return"end"!==this.activeRange&&("end"!==(null===(t=this.hoverRange)||void 0===t?void 0:t.focused)||this.proximitySelectionDisabled&&!s)||!o||(r=o),this.range&&this.mostRecentRangeValue&&(r=this.mostRecentRangeValue),a(i,{onBlur:this.reset,onKeyDown:this.keyDownHandler,role:"application"},this.renderCalendar(r,this.range&&this.activeRange&&"start"===this.activeRange&&s||this.maxAsDate,this.range&&this.activeRange?"start"===this.activeRange?this.minAsDate:e||this.minAsDate:this.minAsDate,e,s))}valueHandler(t){Array.isArray(t)?(this.valueAsDate=h(t),this.start=t[0],this.end=t[1]):t&&(this.valueAsDate=l(t),this.start="",this.end="")}startWatcher(t){this.setStartAsDate(l(t))}endWatcher(t){this.setEndAsDate(l(t))}async loadLocaleData(){k.numberFormatOptions={numberingSystem:this.numberingSystem,locale:this.effectiveLocale,useGrouping:!1},this.localeData=await u(this.effectiveLocale)}renderCalendar(t,e,i,r,s){return this.localeData&&[a("calcite-date-picker-month-header",{activeDate:t,headingLevel:this.headingLevel||g,intlNextMonth:this.intlNextMonth,intlPrevMonth:this.intlPrevMonth,intlYear:this.intlYear,localeData:this.localeData,max:e,min:i,onCalciteDatePickerSelect:this.monthHeaderSelectChange,scale:this.scale,selectedDate:"end"===this.activeRange?s:r||new Date}),a("calcite-date-picker-month",{activeDate:t,endDate:this.range?s:void 0,hoverRange:this.hoverRange,localeData:this.localeData,max:e,min:i,onCalciteDatePickerActiveDateChange:this.monthActiveDateChange,onCalciteDatePickerSelect:this.monthDateChange,onCalciteInternalDatePickerHover:this.monthHoverChange,onCalciteInternalDatePickerMouseOut:this.monthMouseOutChange,scale:this.scale,selectedDate:"end"===this.activeRange?s:r,startDate:this.range?r:void 0})]}setStartAsDate(t,e){this.startAsDate=t,this.mostRecentRangeValue=this.startAsDate,e&&this.calciteDatePickerRangeChange.emit({startDate:t,endDate:this.endAsDate})}setEndAsDate(t,e){this.endAsDate=t?p(t):t,this.mostRecentRangeValue=this.endAsDate,e&&this.calciteDatePickerRangeChange.emit({startDate:this.startAsDate,endDate:t})}setEndDate(t){this.end=t?c(t):"",this.setEndAsDate(t,!0),this.activeEndDate=t||null}setStartDate(t){this.start=t?c(t):"",this.setStartAsDate(t,!0),this.activeStartDate=t||null}getActiveDate(t,e,a){return d(this.activeDate,e,a)||t||d(new Date,e,a)}getActiveStartDate(t,e,a){return d(this.activeStartDate,e,a)||t||d(new Date,e,a)}getActiveEndDate(t,e,a){return d(this.activeEndDate,e,a)||t||d(new Date,e,a)}static get assetsDirs(){return["assets"]}get el(){return r(this)}static get watchers(){return{valueAsDate:["handleValueAsDate"],startAsDate:["handleRangeChange"],endAsDate:["handleRangeChange"],min:["onMinChanged"],max:["onMaxChanged"],value:["valueHandler"],start:["startWatcher"],end:["endWatcher"],effectiveLocale:["loadLocaleData"]}}};S.style="@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{position:relative;display:inline-block;inline-size:100%;overflow:visible;border-radius:0px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-2);background-color:var(--calcite-ui-foreground-1);vertical-align:top}:host([scale=s]){max-inline-size:216px}:host([scale=m]){max-inline-size:286px}:host([scale=l]){max-inline-size:398px}";const M=class{constructor(a){t(this,a),this.calciteDaySelect=e(this,"calciteDaySelect",6),this.calciteInternalDayHover=e(this,"calciteInternalDayHover",6),this.disabled=!1,this.currentMonth=!1,this.selected=!1,this.highlighted=!1,this.range=!1,this.startOfRange=!1,this.endOfRange=!1,this.rangeHover=!1,this.active=!1,this.onClick=()=>{!this.disabled&&this.calciteDaySelect.emit()},this.keyDownHandler=t=>{A(t.key)&&(!this.disabled&&this.calciteDaySelect.emit(),t.preventDefault())}}mouseoverHandler(){this.calciteInternalDayHover.emit()}componentWillLoad(){this.parentDatePickerEl=D(this.el,"calcite-date-picker")}render(){if(this.parentDatePickerEl){const{numberingSystem:t,lang:e}=this.parentDatePickerEl;k.numberFormatOptions={useGrouping:!1,...t&&{numberingSystem:t},...e&&{locale:e}}}const t=k.localize(String(this.day)),e=z(this.el);return a(i,{onClick:this.onClick,onKeyDown:this.keyDownHandler,role:"gridcell"},a("div",{class:{"day-v-wrapper":!0,[_.rtl]:"rtl"===e}},a("div",{class:"day-wrapper"},a("span",{class:"day"},a("span",{class:"text"},t)))))}componentDidRender(){C(this,this.isTabbable)}isTabbable(){return this.active}get el(){return r(this)}};M.style="@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{display:flex;min-inline-size:0px;cursor:pointer;justify-content:center;color:var(--calcite-ui-text-3);inline-size:14.2857142857%}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.day-v-wrapper{flex:1 1 auto}.day-wrapper{display:flex;flex-direction:column;align-items:center}.day{display:flex;align-items:center;justify-content:center;border-radius:9999px;font-size:var(--calcite-font-size--2);line-height:1rem;line-height:1;color:var(--calcite-ui-text-3);opacity:var(--calcite-ui-opacity-disabled);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;background:none;box-shadow:0 0 0 2px transparent}.text{margin-block:1px 0px;margin-inline-start:0px}:host([scale=s]) .day-v-wrapper{padding-block:0.125rem}:host([scale=s]) .day-wrapper{padding:0px}:host([scale=s]) .day{block-size:27px;inline-size:27px;font-size:var(--calcite-font-size--2)}:host([scale=m]) .day-v-wrapper{padding-block:0.25rem}:host([scale=m]) .day-wrapper{padding-inline:0.25rem}:host([scale=m]) .day{block-size:33px;inline-size:33px;font-size:var(--calcite-font-size--1)}:host([scale=l]) .day-v-wrapper{padding-block:0.25rem}:host([scale=l]) .day-wrapper{padding-inline:0.25rem}:host([scale=l]) .day{block-size:43px;inline-size:43px;font-size:var(--calcite-font-size-0)}:host([current-month]) .day{opacity:1}:host(:hover:not([disabled])) .day,:host([active]:not([range])) .day{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}:host(:focus),:host([active]){outline:2px solid transparent;outline-offset:2px}:host(:focus:not([disabled])) .day{outline:2px solid var(--calcite-ui-brand);outline-offset:2px;box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}:host([selected]) .day{font-weight:var(--calcite-font-weight-medium);background-color:var(--calcite-ui-brand) !important;color:var(--calcite-ui-foreground-1) !important}:host([range][selected]) .day-wrapper{background-color:var(--calcite-ui-foreground-current)}:host([start-of-range]) .day-wrapper{border-start-start-radius:40%;border-end-start-radius:40%}:host([end-of-range]) .day-wrapper{border-start-end-radius:40%;border-end-end-radius:40%}:host([start-of-range]) :not(.calcite--rtl) .day-wrapper{box-shadow:inset 4px 0 var(--calcite-ui-foreground-1)}:host([start-of-range]) .calcite--rtl .day-wrapper{box-shadow:inset -4px 0 var(--calcite-ui-foreground-1)}:host([start-of-range]) .day{opacity:1}:host([end-of-range]) :not(.calcite--rtl) .day-wrapper{box-shadow:inset -4px 0 var(--calcite-ui-foreground-1)}:host([end-of-range]) .calcite--rtl .day-wrapper{box-shadow:inset 4px 0 var(--calcite-ui-foreground-1)}:host([end-of-range]) .day{opacity:1}:host([start-of-range]:not(:focus)) :not(.calcite--rtl) .day{box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}:host([start-of-range]:not(:focus)) .calcite--rtl .day{box-shadow:0 0 0 -2px var(--calcite-ui-foreground-1)}:host([end-of-range]:not(:focus)) :not(.calcite--rtl) .day{box-shadow:0 0 0 -2px var(--calcite-ui-foreground-1)}:host([end-of-range]:not(:focus)) .calcite--rtl .day{box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}:host([start-of-range][scale=l]) :not(.calcite--rtl) .day-wrapper{box-shadow:inset 8px 0 var(--calcite-ui-foreground-1)}:host([start-of-range][scale=l]) .calcite--rtl .day-wrapper{box-shadow:inset -8px 0 var(--calcite-ui-foreground-1)}:host([end-of-range][scale=l]) :not(.calcite--rtl) .day-wrapper{box-shadow:inset -8px 0 var(--calcite-ui-foreground-1)}:host([end-of-range][scale=l]) .calcite--rtl .day-wrapper{box-shadow:inset 8px 0 var(--calcite-ui-foreground-1)}:host([highlighted]) .day-wrapper{background-color:var(--calcite-ui-foreground-current)}:host([highlighted]) .day-wrapper .day{color:var(--calcite-ui-text-1)}:host([highlighted]:not([active]:focus)) .day{border-radius:0px;color:var(--calcite-ui-text-1)}:host([range-hover]:not([selected])) .day-wrapper{background-color:var(--calcite-ui-foreground-2)}:host([range-hover]:not([selected])) .day{border-radius:0px}:host([start-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper{background-image:linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));border-radius:0px;--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)}:host([start-of-range][range-hover]) .calcite--rtl .day-wrapper{background-image:linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));border-radius:0px;--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)}:host([end-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper{background-image:linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));border-radius:0px;--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)}:host([end-of-range][range-hover]) .calcite--rtl .day-wrapper{background-image:linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));border-radius:0px;--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)}:host(:hover[end-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,:host(:hover[start-of-range][range-hover]) .calcite--rtl .day-wrapper{background-image:linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1));border-radius:0px;--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)}:host(:hover[start-of-range][range-hover]) :not(.calcite--rtl) .day-wrapper,:host(:hover[end-of-range][range-hover]) .calcite--rtl .day-wrapper{background-image:linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1));border-radius:0px;--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)}:host(:hover[range-hover]:not([selected]).focused--start) :not(.calcite--rtl) .day-wrapper{background-image:linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2))}:host(:hover[range-hover]:not([selected]).focused--start) .calcite--rtl .day-wrapper{background-image:linear-gradient(to right, var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current))}:host(:hover[range-hover]:not([selected]).focused--start) .day{border-radius:9999px;opacity:1;box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}:host(:hover[range-hover]:not([selected]).focused--end) :not(.calcite--rtl) .day-wrapper{background-image:linear-gradient(to right, var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current))}:host(:hover[range-hover]:not([selected]).focused--end) .calcite--rtl .day-wrapper{background-image:linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2))}:host(:hover[range-hover]:not([selected]).focused--end) .day{border-radius:9999px;opacity:1;box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) :not(.calcite--rtl) .day-wrapper,:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) .calcite--rtl .day-wrapper{background-image:linear-gradient(to right, var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2))}:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) :not(.calcite--rtl) .day,:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) .calcite--rtl .day{border-radius:9999px;opacity:1;box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) :not(.calcite--rtl) .day-wrapper,:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) .calcite--rtl .day-wrapper{background-image:linear-gradient(to right, var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-1), var(--calcite-ui-foreground-1))}:host(:hover[range-hover]:not([selected]).focused--end.hover--outside-range) :not(.calcite--rtl) .day,:host(:hover[range-hover]:not([selected]).focused--start.hover--outside-range) .calcite--rtl .day{border-radius:9999px;opacity:1;box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}:host(:hover[start-of-range].hover--inside-range.focused--end) .day-wrapper,:host(:hover[end-of-range].hover--inside-range.focused--start) .day-wrapper{background-image:none}:host([start-of-range].hover--inside-range.focused--end) .day-wrapper,:host([end-of-range].hover--inside-range.focused--start) .day-wrapper{background-color:var(--calcite-ui-foreground-2)}:host([highlighted]:last-child) :not(.calcite--rtl) .day-wrapper,:host([range-hover]:last-child) :not(.calcite--rtl) .day-wrapper,:host([highlighted]:first-child) .calcite--rtl .day-wrapper,:host([range-hover]:first-child) .calcite--rtl .day-wrapper{box-shadow:inset -4px 0px 0px 0px var(--calcite-ui-foreground-1)}:host([highlighted]:first-child) :not(.calcite--rtl) .day-wrapper,:host([range-hover]:first-child) :not(.calcite--rtl) .day-wrapper,:host([highlighted]:last-child) .calcite--rtl .day-wrapper,:host([range-hover]:last-child) .calcite--rtl .day-wrapper{box-shadow:inset 4px 0px 0px 0px var(--calcite-ui-foreground-1)}:host([scale=s][highlighted]:last-child) :not(.calcite--rtl) .day-wrapper,:host([scale=s][range-hover]:last-child) :not(.calcite--rtl) .day-wrapper,:host([scale=s][highlighted]:first-child) .calcite--rtl .day-wrapper,:host([scale=s][range-hover]:first-child) .calcite--rtl .day-wrapper{box-shadow:inset -1px 0px 0px 0px var(--calcite-ui-foreground-1)}:host([scale=s][highlighted]:first-child) :not(.calcite--rtl) .day-wrapper,:host([scale=s][range-hover]:first-child) :not(.calcite--rtl) .day-wrapper,:host([scale=s][highlighted]:last-child) .calcite--rtl .day-wrapper,:host([scale=s][range-hover]:last-child) .calcite--rtl .day-wrapper{box-shadow:inset 1px 0px 0px 0px var(--calcite-ui-foreground-1)}:host([scale=l][highlighted]:first-child) :not(.calcite--rtl) .day-wrapper,:host([scale=l][range-hover]:first-child) :not(.calcite--rtl) .day-wrapper,:host([scale=l][highlighted]:last-child) .calcite--rtl .day-wrapper,:host([scale=l][range-hover]:last-child) .calcite--rtl .day-wrapper{box-shadow:inset 6px 0px 0px 0px var(--calcite-ui-foreground-1)}:host([highlighted]:first-child) .day-wrapper,:host([range-hover]:first-child) .day-wrapper{border-start-start-radius:45%;border-end-start-radius:45%}:host([highlighted]:last-child) .day-wrapper,:host([range-hover]:last-child) .day-wrapper{border-start-end-radius:45%;border-end-end-radius:45%}:host([scale=l][highlighted]:last-child) :not(.calcite--rtl) .day-wrapper,:host([scale=l][range-hover]:last-child) :not(.calcite--rtl) .day-wrapper,:host([scale=l][highlighted]:first-child) .calcite--rtl .day-wrapper,:host([scale=l][range-hover]:first-child) .calcite--rtl .day-wrapper{box-shadow:inset -6px 0px 0px 0px var(--calcite-ui-foreground-1)}@media (forced-colors: active){:host(:hover:not([disabled])) .day,:host([active]:not([range])) .day{border-radius:0px}:host([selected]){outline:2px solid canvasText}:host([selected]) .day{border-radius:0px;background-color:highlight}:host([range][selected]) .day-wrapper,:host([highlighted]) .day-wrapper,:host([range-hover]:not([selected])) .day-wrapper{background-color:highlight}:host([range][selected][start-of-range]) .day-wrapper,:host([range][selected][end-of-range]) .day-wrapper{background-color:canvas}}";const j=class{constructor(a){t(this,a),this.calciteDatePickerSelect=e(this,"calciteDatePickerSelect",6),this.calciteInternalDatePickerHover=e(this,"calciteInternalDatePickerHover",6),this.calciteDatePickerActiveDateChange=e(this,"calciteDatePickerActiveDateChange",6),this.calciteInternalDatePickerMouseOut=e(this,"calciteInternalDatePickerMouseOut",6),this.activeDate=new Date,this.keyDownHandler=t=>{if(t.defaultPrevented)return;const e="rtl"===this.el.dir;switch(t.key){case"ArrowUp":t.preventDefault(),this.addDays(-7);break;case"ArrowRight":t.preventDefault(),this.addDays(e?-1:1);break;case"ArrowDown":t.preventDefault(),this.addDays(7);break;case"ArrowLeft":t.preventDefault(),this.addDays(e?1:-1);break;case"PageUp":t.preventDefault(),this.addMonths(-1);break;case"PageDown":t.preventDefault(),this.addMonths(1);break;case"Home":t.preventDefault(),this.activeDate.setDate(1),this.addDays();break;case"End":t.preventDefault(),this.activeDate.setDate(new Date(this.activeDate.getFullYear(),this.activeDate.getMonth()+1,0).getDate()),this.addDays();break;case"Enter":case" ":t.preventDefault();break;case"Tab":this.activeFocus=!1}},this.disableActiveFocus=()=>{this.activeFocus=!1},this.dayHover=t=>{const e=t.target;e.disabled?this.calciteInternalDatePickerMouseOut.emit():this.calciteInternalDatePickerHover.emit(e.value),t.stopPropagation()},this.daySelect=t=>{this.calciteDatePickerSelect.emit(t.target.value)}}mouseoutHandler(){this.calciteInternalDatePickerMouseOut.emit()}render(){const t=this.activeDate.getMonth(),e=this.activeDate.getFullYear(),r=this.localeData.weekStart%7,{abbreviated:s,short:o,narrow:n}=this.localeData.days,c="s"===this.scale?n||o||s:o||s||n,l=[...c.slice(r,7),...c.slice(0,r)],h=this.getCurrentMonthDays(t,e),d=this.getPrevMonthdays(t,e,r),u=this.getNextMonthDays(t,e,r),p=[...d.map((a=>{const i=new Date(e,t-1,a);return this.renderDateDay(!1,a,i)})),...h.map((a=>{const i=new Date(e,t,a),r=f(i,this.activeDate);return this.renderDateDay(r,a,i,!0,!0)})),...u.map((a=>{const i=new Date(e,t+1,a);return this.renderDateDay(!1,a,i)}))],g=[];for(let t=0;t<p.length;t+=7)g.push(p.slice(t,t+7));return a(i,{onFocusOut:this.disableActiveFocus,onKeyDown:this.keyDownHandler},a("div",{class:"calender",role:"grid"},a("div",{class:"week-headers",role:"row"},l.map((t=>a("span",{class:"week-header",role:"columnheader"},t)))),g.map((t=>a("div",{class:"week-days",role:"row"},t)))))}addMonths(t){const e=new Date(this.activeDate);e.setMonth(this.activeDate.getMonth()+t),this.calciteDatePickerActiveDateChange.emit(d(e,this.min,this.max)),this.activeFocus=!0}addDays(t=0){const e=new Date(this.activeDate);e.setDate(this.activeDate.getDate()+t),this.calciteDatePickerActiveDateChange.emit(d(e,this.min,this.max)),this.activeFocus=!0}getPrevMonthdays(t,e,a){const i=new Date(e,t,0),r=i.getDate(),s=[];if(i.getDay()-6===a)return s;for(let t=i.getDay()-a;t>=0;t--)s.push(r-t);return s}getCurrentMonthDays(t,e){const a=new Date(e,t+1,0).getDate(),i=[];for(let t=0;t<a;t++)i.push(t+1);return i}getNextMonthDays(t,e,a){const i=new Date(e,t+1,0).getDay(),r=[];if(i===(a+6)%7)return r;for(let t=0;t<(6-(i-a))%7;t++)r.push(t+1);return r}betweenSelectedRange(t){return!(!(this.startDate&&this.endDate&&t>this.startDate&&t<this.endDate)||this.isRangeHover(t))}isSelected(t){return!!(f(t,this.selectedDate)||this.startDate&&f(t,this.startDate)||this.endDate&&f(t,this.endDate))}isStartOfRange(t){return!(!this.startDate||f(this.startDate,this.endDate)||!f(this.startDate,t)||this.isEndOfRange(t))}isEndOfRange(t){return!!(this.endDate&&!f(this.startDate,this.endDate)&&f(this.endDate,t)||!this.endDate&&this.hoverRange&&f(this.startDate,this.hoverRange.end)&&f(t,this.hoverRange.end))}renderDateDay(t,e,i,r,s){var o;const n=this.isFocusedOnStart(),c=this.isHoverInRange()||!this.endDate&&this.hoverRange&&f(null===(o=this.hoverRange)||void 0===o?void 0:o.end,this.startDate);return a("calcite-date-picker-day",{active:t,class:{"hover--inside-range":this.startDate&&c,"hover--outside-range":this.startDate&&!c,"focused--start":n,"focused--end":!n},currentMonth:r,day:e,disabled:!v(i,this.min,this.max),endOfRange:this.isEndOfRange(i),highlighted:this.betweenSelectedRange(i),key:i.toDateString(),onCalciteDaySelect:this.daySelect,onCalciteInternalDayHover:this.dayHover,range:!!this.startDate&&!!this.endDate&&!f(this.startDate,this.endDate),rangeHover:this.isRangeHover(i),ref:e=>{s&&t&&this.activeFocus&&(null==e||e.focus())},scale:this.scale,selected:this.isSelected(i),startOfRange:this.isStartOfRange(i),value:i})}isFocusedOnStart(){var t;return"start"===(null===(t=this.hoverRange)||void 0===t?void 0:t.focused)}isHoverInRange(){if(!this.hoverRange)return!1;const{start:t,end:e}=this.hoverRange;return!!(!this.isFocusedOnStart()&&this.startDate&&(!this.endDate||e<this.endDate)||this.isFocusedOnStart()&&this.startDate&&t>this.startDate)}isRangeHover(t){if(!this.hoverRange)return!1;const{start:e,end:a}=this.hoverRange,i=this.isFocusedOnStart(),r=this.isHoverInRange(),s=r&&(!i&&t>this.startDate&&(t<a||f(t,a))||i&&t<this.endDate&&(t>e||f(t,e))),o=!r&&(!i&&t>=this.endDate&&(t<a||f(t,a))||i&&(t<this.startDate||this.endDate&&f(t,this.startDate))&&(t>e||f(t,e)));return s||o}get el(){return r(this)}};j.style="@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}.calender{margin-block-end:0.25rem}.week-headers{display:flex;border-width:0px;border-block-start-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);padding-block:0px;padding-inline:0.25rem}.week-header{text-align:center;font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-3);inline-size:14.2857142857%}:host([scale=s]) .week-header{padding-inline:0px;padding-block:0.5rem 0.75rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=m]) .week-header{padding-inline:0px;padding-block:0.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=l]) .week-header{padding-inline:0px;padding-block:1rem 1.25rem;font-size:var(--calcite-font-size--1);line-height:1rem}.week-days{display:flex;flex-direction:row;padding-block:0px;padding-inline:6px}.week-days:focus{outline:2px solid transparent;outline-offset:2px}";const H=class{constructor(a){t(this,a),this.calciteDatePickerSelect=e(this,"calciteDatePickerSelect",6),this.globalAttributes={},this.onYearKey=t=>{const e=this.parseCalendarYear(t.target.value);switch(t.key){case"ArrowDown":t.preventDefault(),this.setYear({localizedYear:e,offset:-1});break;case"ArrowUp":t.preventDefault(),this.setYear({localizedYear:e,offset:1})}},this.onYearChange=t=>{this.setYear({localizedYear:this.parseCalendarYear(t.target.value)})},this.onYearInput=t=>{this.setYear({localizedYear:this.parseCalendarYear(t.target.value),commit:!1})},this.prevMonthClick=t=>{this.handleArrowClick(t,this.prevMonthDate)},this.prevMonthKeydown=t=>{A(t.key)&&this.prevMonthClick(t)},this.nextMonthClick=t=>{this.handleArrowClick(t,this.nextMonthDate)},this.nextMonthKeydown=t=>{A(t.key)&&this.nextMonthClick(t)},this.handleArrowClick=(t,e)=>{t.preventDefault(),this.calciteDatePickerSelect.emit(e)}}componentWillLoad(){this.parentDatePickerEl=D(this.el,"calcite-date-picker")}connectedCallback(){this.setNextPrevMonthDates()}render(){return a("div",{class:"header"},this.renderContent())}renderContent(){var t;if(!this.activeDate||!this.localeData)return null;if(this.parentDatePickerEl){const{numberingSystem:t,lang:e}=this.parentDatePickerEl;k.numberFormatOptions={useGrouping:!1,...t&&{numberingSystem:t},...e&&{locale:e}}}const e=this.activeDate.getMonth(),{months:i,unitOrder:r}=this.localeData,o=(i.wide||i.narrow||i.abbreviated)[e],n=this.formatCalendarYear(this.activeDate.getFullYear()),c="l"===this.scale?"m":"s",l=m(r),h=l.indexOf("y")<l.indexOf("m"),d=null===(t=this.localeData.year)||void 0===t?void 0:t.suffix;return a(s,null,a("a",{"aria-disabled":`${this.prevMonthDate.getMonth()===e}`,"aria-label":this.intlPrevMonth,class:"chevron",href:"#",onClick:this.prevMonthClick,onKeyDown:this.prevMonthKeydown,role:"button",tabindex:this.prevMonthDate.getMonth()===e?-1:0},a("calcite-icon",{"flip-rtl":!0,icon:"chevron-left",scale:c})),a("div",{class:{text:!0,"text--reverse":h}},a(P,{class:"month",level:this.headingLevel},o),a("span",{class:"year-wrap"},a("input",{"aria-label":this.intlYear,class:{year:!0,"year--suffix":!!d},inputmode:"numeric",maxlength:"4",minlength:"1",onChange:this.onYearChange,onInput:this.onYearInput,onKeyDown:this.onYearKey,pattern:"\\d*",ref:t=>this.yearInput=t,type:"text",value:n}),d&&a("span",{class:"suffix"},d))),a("a",{"aria-disabled":`${this.nextMonthDate.getMonth()===e}`,"aria-label":this.intlNextMonth,class:"chevron",href:"#",onClick:this.nextMonthClick,onKeyDown:this.nextMonthKeydown,role:"button",tabindex:this.nextMonthDate.getMonth()===e?-1:0},a("calcite-icon",{"flip-rtl":!0,icon:"chevron-right",scale:c})))}setNextPrevMonthDates(){this.activeDate&&(this.nextMonthDate=d(w(this.activeDate),this.min,this.max),this.prevMonthDate=d(y(this.activeDate),this.min,this.max))}formatCalendarYear(t){const{localeData:e}=this;return k.localize(`${t+("buddhist"===e["default-calendar"]?543:0)}`)}parseCalendarYear(t){const{localeData:e}=this,a="buddhist"===e["default-calendar"]?543:0,i=Number(k.delocalize(t))-a;return k.localize(`${i}`)}getInRangeDate({localizedYear:t,offset:e=0}){const{min:a,max:i,activeDate:r}=this,s=Number(k.delocalize(t)),o=s.toString().length,n=!isNaN(s)&&s+e,c=n&&(!a||a.getFullYear()<=n)&&(!i||i.getFullYear()>=n);if(n&&c&&o===t.length){const t=new Date(r);return t.setFullYear(n),d(t,a,i)}}setYear({localizedYear:t,commit:e=!0,offset:a=0}){const{yearInput:i,activeDate:r}=this,s=this.getInRangeDate({localizedYear:t,offset:a});s&&this.calciteDatePickerSelect.emit(s),e&&(i.value=this.formatCalendarYear((s||r).getFullYear()))}get el(){return r(this)}static get watchers(){return{min:["setNextPrevMonthDates"],max:["setNextPrevMonthDates"],activeDate:["setNextPrevMonthDates"]}}};H.style="@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{display:block}.header{display:flex;justify-content:space-between;padding-block:0px;padding-inline:0.25rem}:host([scale=s]) .text{margin-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=s]) .chevron{block-size:2.25rem}:host([scale=m]) .text{margin-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}:host([scale=m]) .chevron{block-size:3rem}:host([scale=l]) .text{margin-block:1rem;font-size:var(--calcite-font-size-1);line-height:1.5rem}:host([scale=l]) .chevron{block-size:3.5rem}.chevron{margin-inline:-0.25rem;box-sizing:content-box;display:flex;flex-grow:0;cursor:pointer;align-items:center;justify-content:center;border-style:none;background-color:var(--calcite-ui-foreground-1);padding-inline:0.25rem;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;inline-size:14.2857142857%}.chevron:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.chevron:hover,.chevron:focus{background-color:var(--calcite-ui-foreground-2);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1)}.chevron:active{background-color:var(--calcite-ui-foreground-3)}.chevron[aria-disabled=true]{pointer-events:none;opacity:0}.text{margin-block:auto;display:flex;inline-size:100%;flex:1 1 auto;align-items:center;justify-content:center;text-align:center;line-height:1}.text--reverse{flex-direction:row-reverse}.month,.year,.suffix{margin-inline:0.25rem;margin-block:auto;display:inline-block;background-color:var(--calcite-ui-foreground-1);font-weight:var(--calcite-font-weight-medium);line-height:1.25;color:var(--calcite-ui-text-1);font-size:inherit}.year{position:relative;inline-size:2.5rem;border-style:none;background-color:transparent;text-align:center;font-family:inherit;outline-color:transparent}.year:hover{transition-duration:100ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-property:outline-color;outline:2px solid var(--calcite-ui-border-2);outline-offset:2px}.year:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}.year--suffix{text-align:start}.year-wrap{position:relative}.suffix{inset-block-start:0px;white-space:nowrap;text-align:start;inset-inline-start:0}";export{S as calcite_date_picker,M as calcite_date_picker_day,j as calcite_date_picker_month,H as calcite_date_picker_month_header}
|