@@ -3024,6 +3024,7 @@ class pl {
30243024 p ( this , "customClass" , [ ] ) ;
30253025 p ( this , "quickActions" , ! 0 ) ;
30263026 p ( this , "onChange" ) ;
3027+ p ( this , "position" , "bottom" ) ;
30273028 p ( this , "_container" ) ;
30283029 p ( this , "_calendarWrapper" ) ;
30293030 p ( this , "_datepickerInput" ) ;
@@ -3053,7 +3054,10 @@ class pl {
30533054 p ( this , "_isSetted" , ! 1 ) ;
30543055 var a , r , i , o , u , d , _ , c , m , w , k , M , b , O , W , L , F , q , Pe , be , ve , qe , ze , Ze , Je , H , z , re , K , Z , U , ke , Fe , ft , Qe , Xe , mt , _t , Es , Ws , Ls , Ps , Fs , Ns ;
30553056 const n = document . documentElement ;
3056- this . options = Object . assign ( this , s ) , n . style . setProperty ( "--accentColor" , ( a = this . options . accentColor ) != null ? a : this . accentColor ) , this . onChange = this . options . onChange , this . _inputSelector = t , this . locale = {
3057+ this . options = Object . assign ( this , s ) , n . style . setProperty (
3058+ "--accentColor" ,
3059+ ( a = this . options . accentColor ) != null ? a : this . accentColor
3060+ ) , this . onChange = this . options . onChange , this . _inputSelector = t , this . locale = {
30573061 format : ( o = ( i = ( r = this . options ) == null ? void 0 : r . locale ) == null ? void 0 : i . format ) != null ? o : this . _systemFormat ,
30583062 lang : {
30593063 code : ( c = ( _ = ( d = ( u = this . options ) == null ? void 0 : u . locale ) == null ? void 0 : d . lang ) == null ? void 0 : _ . code ) != null ? c : "en" ,
@@ -3079,23 +3083,57 @@ class pl {
30793083 nowDay : this . _nowDay ,
30803084 quickActions : this . options . quickActions ,
30813085 locale : this . options . locale
3082- } ) , this . _helpers . render ( ) , l . updateLocale ( ( Ws = ( Es = ( _t = this . options ) == null ? void 0 : _t . locale ) == null ? void 0 : Es . lang ) == null ? void 0 : Ws . code , { months : ( Ps = ( Ls = this . options . locale ) == null ? void 0 : Ls . lang ) == null ? void 0 : Ps . months , weekdays : ( Ns = ( Fs = this . options . locale ) == null ? void 0 : Fs . lang ) == null ? void 0 : Ns . weekdays } ) , this . _container = document . querySelector ( ".calendarify" ) , this . _datepickerInput = document . querySelector ( t ) , this . _datesWrapperEl = this . _container . querySelector ( ".dates-wrapper" ) , this . _monthsWrapperEl = this . _container . querySelector ( ".months-wrapper" ) , this . _yearsWrapperEl = this . _container . querySelector ( ".years-wrapper" ) , this . _expandButton = this . _container . querySelector ( '.calendarify__navigations button[data-action="expand"]' ) , this . _dateButtons = this . _container . querySelectorAll ( ".date-button" ) , this . _prevButton = this . _container . querySelector ( '.calendarify__navigations button[data-action="prev"]' ) , this . _nextButton = this . _container . querySelector ( '.calendarify__navigations button[data-action="next"]' ) , this . _calendarWrapper = this . _container . querySelector ( ".calendarify__calendar" ) , this . _quickButtons = this . _container . querySelectorAll ( ".quick-actions button" ) , this . _wrapperEls = this . _calendarWrapper . querySelectorAll ( ".wrapper:not(:last-child, :nth-child(3))" ) , this . _yearRangeButton = this . _container . querySelector ( '.calendarify__navigations button[data-action="year-range"]' ) ;
3086+ } ) , this . _helpers . render ( ) , l . updateLocale ( ( Ws = ( Es = ( _t = this . options ) == null ? void 0 : _t . locale ) == null ? void 0 : Es . lang ) == null ? void 0 : Ws . code , {
3087+ months : ( Ps = ( Ls = this . options . locale ) == null ? void 0 : Ls . lang ) == null ? void 0 : Ps . months ,
3088+ weekdays : ( Ns = ( Fs = this . options . locale ) == null ? void 0 : Fs . lang ) == null ? void 0 : Ns . weekdays
3089+ } ) , this . _container = document . querySelector ( ".calendarify" ) , this . _datepickerInput = document . querySelector (
3090+ t
3091+ ) , this . _datesWrapperEl = this . _container . querySelector (
3092+ ".dates-wrapper"
3093+ ) , this . _monthsWrapperEl = this . _container . querySelector (
3094+ ".months-wrapper"
3095+ ) , this . _yearsWrapperEl = this . _container . querySelector (
3096+ ".years-wrapper"
3097+ ) , this . _expandButton = this . _container . querySelector (
3098+ '.calendarify__navigations button[data-action="expand"]'
3099+ ) , this . _dateButtons = this . _container . querySelectorAll (
3100+ ".date-button"
3101+ ) , this . _prevButton = this . _container . querySelector (
3102+ '.calendarify__navigations button[data-action="prev"]'
3103+ ) , this . _nextButton = this . _container . querySelector (
3104+ '.calendarify__navigations button[data-action="next"]'
3105+ ) , this . _calendarWrapper = this . _container . querySelector (
3106+ ".calendarify__calendar"
3107+ ) , this . _quickButtons = this . _container . querySelectorAll (
3108+ ".quick-actions button"
3109+ ) , this . _wrapperEls = this . _calendarWrapper . querySelectorAll (
3110+ ".wrapper:not(:last-child, :nth-child(3))"
3111+ ) , this . _yearRangeButton = this . _container . querySelector (
3112+ '.calendarify__navigations button[data-action="year-range"]'
3113+ ) ;
30833114 }
30843115 init ( ) {
30853116 l . suppressDeprecationWarnings = ! 0 , this . showValue ( ) , this . changeState ( ) , this . _datepickerInput . spellcheck = ! 1 , this . _datepickerInput . autocomplete = "off" , this . _datepickerInput . addEventListener ( "input" , ( t ) => {
30863117 const s = t . target ;
30873118 s . value = this . _outputDate ;
30883119 } ) , this . stylingContainer ( ) , this . _prevButton . addEventListener ( "click" , this . prevMonth . bind ( this ) ) , this . _nextButton . addEventListener ( "click" , this . nextMonth . bind ( this ) ) , this . _expandButton . addEventListener ( "click" , this . expand . bind ( this ) ) , this . _datepickerInput . addEventListener ( "focus" , ( ) => {
30893120 this . _wasExecuted = ! 0 , this . _container . classList . add ( "show" ) ;
3090- } ) , window . addEventListener ( "click" , this . hideOnOutsideClick . bind ( this ) ) , this . _quickButtons . forEach ( ( t ) => t . addEventListener ( "click" , this . quickAction . bind ( this ) ) ) ;
3121+ } ) , window . addEventListener ( "click" , this . hideOnOutsideClick . bind ( this ) ) , this . _quickButtons . forEach (
3122+ ( t ) => t . addEventListener ( "click" , this . quickAction . bind ( this ) )
3123+ ) ;
30913124 }
30923125 stylingContainer ( ) {
30933126 var n , a , r ;
3094- ( n = this . options ) != null && n . isDark && this . _container . setAttribute ( "data-theme" , "dark" ) , ( a = this . options ) != null && a . zIndex && this . _container . style . setProperty ( "--z-index" , String ( this . options . zIndex ) ) , ( r = this . options ) != null && r . customClass && this . customClass . forEach ( ( i ) => this . _container . classList . add ( i ) ) ;
3127+ ( n = this . options ) != null && n . isDark && this . _container . setAttribute ( "data-theme" , "dark" ) , ( a = this . options ) != null && a . zIndex && this . _container . style . setProperty (
3128+ "--z-index" ,
3129+ String ( this . options . zIndex )
3130+ ) , ( r = this . options ) != null && r . customClass && this . customClass . forEach (
3131+ ( i ) => this . _container . classList . add ( i )
3132+ ) ;
30953133 const { _datepickerInput : t , _container : s } = this ;
30963134 fl ( t , s , ( ) => {
30973135 ml ( t , s , {
3098- placement : "bottom" ,
3136+ placement : this . position ,
30993137 middleware : [ ul ( 10 ) , ll ( ) ]
31003138 } ) . then ( ( { x : i , y : o } ) => {
31013139 Object . assign ( this . _container . style , { top : `${ o } px` , left : `${ i } px` } ) ;
@@ -3134,15 +3172,28 @@ class pl {
31343172 }
31353173 showMonths ( ) {
31363174 this . _expandButton . classList . add ( "d-none" ) , this . _yearRangeButton . classList . remove ( "d-none" ) ;
3137- const t = this . _monthsWrapperEl . querySelectorAll ( "button" ) ;
3138- t . forEach ( ( s ) => s . addEventListener ( "click" , ( n ) => this . changeMonth ( n , t ) ) ) , this . _yearRangeButton . addEventListener ( "click" , this . showYears . bind ( this ) ) ;
3175+ const t = this . _monthsWrapperEl . querySelectorAll (
3176+ "button"
3177+ ) ;
3178+ t . forEach (
3179+ ( s ) => s . addEventListener (
3180+ "click" ,
3181+ ( n ) => this . changeMonth ( n , t )
3182+ )
3183+ ) , this . _yearRangeButton . addEventListener ( "click" , this . showYears . bind ( this ) ) ;
31393184 }
31403185 showYears ( ) {
3141- this . _expandedMode = "years" , this . _monthsWrapperEl . classList . add ( "d-none" ) , this . _yearsWrapperEl . classList . remove ( "d-none" ) , this . _yearsWrapperEl . innerHTML = `${ this . _years . map ( ( s ) => `<li><button class="${ s == this . _nowYear ? "active" : "" } " data-date="${ s } " type="button">${ s } </button></li>` ) . join ( "" ) } ` , this . _yearsWrapperEl . querySelectorAll ( "button" ) . forEach ( ( s ) => s . addEventListener ( "click" , this . changeYear . bind ( this ) ) ) , this . changeState ( ) ;
3186+ this . _expandedMode = "years" , this . _monthsWrapperEl . classList . add ( "d-none" ) , this . _yearsWrapperEl . classList . remove ( "d-none" ) , this . _yearsWrapperEl . innerHTML = `${ this . _years . map ( ( s ) => `<li><button class="${ s == this . _nowYear ? "active" : "" } " data-date="${ s } " type="button">${ s } </button></li>` ) . join ( "" ) } ` , this . _yearsWrapperEl . querySelectorAll (
3187+ "button"
3188+ ) . forEach (
3189+ ( s ) => s . addEventListener ( "click" , this . changeYear . bind ( this ) )
3190+ ) , this . changeState ( ) ;
31423191 }
31433192 changeYear ( t ) {
31443193 const n = t . target . getAttribute ( "data-date" ) , a = l ( this . _nowMonth ) . format ( "MM" ) ;
3145- this . _date = l ( `${ n } -${ a } -${ this . _nowDay } ` ) . format ( this . _systemFormat ) , this . _nowYear = n , this . _yearsWrapperEl . classList . add ( "d-none" ) , this . _monthsWrapperEl . classList . remove ( "d-none" ) , this . _expandedMode = "months" , this . changeState ( ) ;
3194+ this . _date = l ( `${ n } -${ a } -${ this . _nowDay } ` ) . format (
3195+ this . _systemFormat
3196+ ) , this . _nowYear = n , this . _yearsWrapperEl . classList . add ( "d-none" ) , this . _monthsWrapperEl . classList . remove ( "d-none" ) , this . _expandedMode = "months" , this . changeState ( ) ;
31463197 }
31473198 changeMonth ( t , s ) {
31483199 this . _wrapperEls . forEach ( ( o ) => o . classList . remove ( "d-none" ) ) , s . forEach ( ( o ) => o . classList . remove ( "active" ) ) ;
@@ -3190,24 +3241,38 @@ class pl {
31903241 this . _yearRangeButton . textContent = l ( this . _date ) . format ( "YYYY" ) ;
31913242 break ;
31923243 }
3193- if ( this . renderDates ( ) , this . _dateButtons = this . _datesWrapperEl . querySelectorAll ( ".date-button" ) , this . _dateButtons . forEach ( ( r ) => r . addEventListener ( "click" , this . setDate . bind ( this ) ) ) , this . _expandedMode == "months" && this . _dates . slice ( 0 , 7 ) . every ( ( i ) => i . disabled ) )
3244+ if ( this . renderDates ( ) , this . _dateButtons = this . _datesWrapperEl . querySelectorAll (
3245+ ".date-button"
3246+ ) , this . _dateButtons . forEach (
3247+ ( r ) => r . addEventListener ( "click" , this . setDate . bind ( this ) )
3248+ ) , this . _expandedMode == "months" && this . _dates . slice ( 0 , 7 ) . every ( ( i ) => i . disabled ) )
31943249 for ( let i = 0 ; i < 7 ; i ++ )
31953250 ( a = this . _dateButtons [ i ] . parentElement ) == null || a . classList . add ( "d-none" ) ;
31963251 }
31973252 loopDaysMonths ( ) {
3198- const t = l ( this . _date ) . daysInMonth ( ) , s = l ( new Date ( this . _nowMonth ) ) . isoWeekday ( ) , n = l ( this . _date ) . subtract ( 1 , "months" ) . daysInMonth ( ) ;
3253+ const t = l ( this . _date ) . daysInMonth ( ) , s = l (
3254+ new Date ( this . _nowMonth )
3255+ ) . isoWeekday ( ) , n = l ( this . _date ) . subtract ( 1 , "months" ) . daysInMonth ( ) ;
31993256 for ( let a = 1 ; a <= s ; a ++ )
3200- this . _dates . unshift ( { disabled : ! 0 , date : String ( n + 1 - a ) } ) ;
3257+ this . _dates . unshift ( {
3258+ disabled : ! 0 ,
3259+ date : String ( n + 1 - a )
3260+ } ) ;
32013261 for ( let a = 1 ; a <= t ; a ++ )
32023262 this . _dates . push ( { disabled : ! 1 , date : String ( a ) } ) ;
32033263 }
32043264 renderDates ( ) {
3205- this . _datesWrapperEl . innerHTML = `${ this . _dates . map ( ( t ) => `<li><button ${ t . disabled ? "disabled" : "" } type="button" class="date-button ${ this . _helpers . getHolidayClass ( { date : t . date , nowMonth : this . _nowMonth } ) } ${ this . _nowDay == String ( t . date ) ? "active" : "" } ">${ t . date } </button></li>` ) . join ( "" ) } ` ;
3265+ this . _datesWrapperEl . innerHTML = `${ this . _dates . map ( ( t ) => `<li><button ${ t . disabled ? "disabled" : "" } type="button" class="date-button ${ this . _helpers . getHolidayClass ( {
3266+ date : t . date ,
3267+ nowMonth : this . _nowMonth
3268+ } ) } ${ this . _nowDay == String ( t . date ) ? "active" : "" } ">${ t . date } </button></li>`) . join ( "" ) } `;
32063269 }
32073270 setDate ( t ) {
32083271 this . _isSetted = ! 0 ;
32093272 const s = t . target ;
3210- this . _dateButtons . forEach ( ( n ) => n . classList . remove ( "active" ) ) , this . _nowDay = String ( s . textContent ) , this . _date = `${ l ( `${ this . _nowMonth } -${ this . _nowDay } ` ) . format ( this . _systemFormat ) } ` , this . showValue ( ) , s . classList . add ( "active" ) ;
3273+ this . _dateButtons . forEach ( ( n ) => n . classList . remove ( "active" ) ) , this . _nowDay = String ( s . textContent ) , this . _date = `${ l ( `${ this . _nowMonth } -${ this . _nowDay } ` ) . format (
3274+ this . _systemFormat
3275+ ) } `, this . showValue ( ) , s . classList . add ( "active" ) ;
32113276 }
32123277 prevMonth ( ) {
32133278 if ( this . _isExpanded )
0 commit comments