@nova-design-system/nova-react 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/cjs/{constants-98e2dcc2-C0SBCapP.js → constants-b97e736d-BzFAKCkR.js} +11 -0
  2. package/dist/cjs/{index-Byv3Vmev.js → index-Cn-oNJnW.js} +1839 -1420
  3. package/dist/cjs/index.js +1 -1
  4. package/dist/cjs/{nv-alert.entry-BXY4KXbF.js → nv-alert.entry-BFwufSUQ.js} +11 -11
  5. package/dist/cjs/{nv-avatar.entry-BnPSKkJJ.js → nv-avatar.entry-Do1K4s3s.js} +7 -7
  6. package/dist/cjs/nv-badge_2.entry-NTGHyFdg.js +204 -0
  7. package/dist/cjs/{nv-breadcrumb.entry-D5vGHLOG.js → nv-breadcrumb.entry-oPVGJYlk.js} +1 -1
  8. package/dist/cjs/{nv-breadcrumbs.entry-CsaqAsnb.js → nv-breadcrumbs.entry-BsOw153b.js} +1 -1
  9. package/dist/cjs/{nv-button.entry-DzZfGZGy.js → nv-button.entry-13tdBiRr.js} +7 -7
  10. package/dist/cjs/nv-calendar.entry-u9MgGb83.js +1064 -0
  11. package/dist/cjs/{nv-col.entry-Cng8NaTW.js → nv-col.entry-DFhv-GI7.js} +1 -1
  12. package/dist/cjs/{nv-datagrid.entry-BbAOzpiO.js → nv-datagrid.entry-BoB17gvI.js} +377 -40
  13. package/dist/cjs/{nv-datagridcolumn.entry-CRogHbVM.js → nv-datagridcolumn.entry-C3MYBmfS.js} +1 -1
  14. package/dist/cjs/{nv-dialog.entry-BSIZGYGF.js → nv-dialog.entry-OA3qL3Tx.js} +19 -13
  15. package/dist/cjs/{nv-dialogfooter_2.entry-Q4_li_QU.js → nv-dialogfooter_2.entry-LAQYSiGV.js} +3 -3
  16. package/dist/cjs/{nv-fieldcheckbox.entry-DmgzfmRd.js → nv-fieldcheckbox.entry-CP7SDzVO.js} +1 -1
  17. package/dist/cjs/{nv-fielddate.entry-qAvLX_Ru.js → nv-fielddate.entry-CD7PX6yA.js} +9 -18
  18. package/dist/cjs/{nv-fielddaterange.entry-DVB8Rwxk.js → nv-fielddaterange.entry-BVBVGmly.js} +27 -29
  19. package/dist/cjs/{nv-fielddropdown.entry-DKXmoXeW.js → nv-fielddropdown.entry-Nwric1vT.js} +13 -6
  20. package/dist/cjs/{nv-fielddropdownitem.entry-BVLVXi0e.js → nv-fielddropdownitem.entry-CiqSw5VL.js} +2 -2
  21. package/dist/cjs/{nv-fieldmultiselect.entry-DrTbd3Dj.js → nv-fieldmultiselect.entry-QKNIBcW1.js} +11 -5
  22. package/dist/cjs/nv-fieldnumber.entry-DfHcI-sO.js +130 -0
  23. package/dist/cjs/nv-fieldpassword.entry-b2pUmS8F.js +121 -0
  24. package/dist/cjs/{nv-fieldradio.entry-CVEY4v6F.js → nv-fieldradio.entry-Dxc6ZCyb.js} +4 -4
  25. package/dist/cjs/{nv-fieldselect.entry-BrCUuRWa.js → nv-fieldselect.entry-Cys0KRyG.js} +11 -7
  26. package/dist/cjs/nv-fieldtext.entry-DCZWLFFp.js +123 -0
  27. package/dist/cjs/{nv-fieldtextarea.entry-B4qiLmX1.js → nv-fieldtextarea.entry-DEeRdtZ7.js} +9 -5
  28. package/dist/cjs/{nv-fieldtime.entry-Bp2IWjhN.js → nv-fieldtime.entry-BqxiFlLI.js} +71 -68
  29. package/dist/cjs/nv-icon.entry-CzEdUDdA.js +79 -0
  30. package/dist/cjs/{nv-iconbutton_2.entry-BRPAGl2S.js → nv-iconbutton_2.entry-BLNrQz9Q.js} +3 -3
  31. package/dist/cjs/{nv-menu.entry-BiWiIZAm.js → nv-menu.entry-7IDfPmZ8.js} +4 -2
  32. package/dist/cjs/{nv-menuitem.entry-CFkXoZ_r.js → nv-menuitem.entry-B9cjy7O8.js} +2 -2
  33. package/dist/cjs/{nv-popover.entry-KT1iQUJk.js → nv-popover.entry-ChLYZ3zY.js} +2 -2
  34. package/dist/cjs/{nv-row.entry-Cs2GDrcu.js → nv-row.entry-DiLY8Vbc.js} +2 -2
  35. package/dist/cjs/{nv-stack.entry-Ci7pxGSo.js → nv-stack.entry-MpPzmg5_.js} +2 -2
  36. package/dist/cjs/{nv-table.entry-N4MV8Y6E.js → nv-table.entry-cME3Zuq2.js} +3 -3
  37. package/dist/cjs/{nv-tablecolumn.entry-CTz4jsZl.js → nv-tablecolumn.entry-DSctDxCS.js} +1 -1
  38. package/dist/cjs/{nv-toggle.entry-m10-ncYR.js → nv-toggle.entry-EBWm3Xy5.js} +3 -3
  39. package/dist/cjs/{nv-tooltip.entry-B6aRDto3.js → nv-tooltip.entry-q6rJLq1C.js} +2 -2
  40. package/dist/generated/components.js +4 -1
  41. package/dist/types/generated/components.d.ts +14 -7
  42. package/package.json +1 -1
  43. package/dist/cjs/nv-badge_2.entry-BsI3B8Rr.js +0 -195
  44. package/dist/cjs/nv-calendar.entry-CGKv_-gO.js +0 -1065
  45. package/dist/cjs/nv-fieldnumber.entry-DegbEHRL.js +0 -126
  46. package/dist/cjs/nv-fieldpassword.entry-gqjlEl7a.js +0 -117
  47. package/dist/cjs/nv-fieldtext.entry-q9NnqL5c.js +0 -119
  48. package/dist/cjs/nv-icon.entry-B1ax9cJS.js +0 -79
@@ -0,0 +1,1064 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-Cn-oNJnW.js');
4
+ var constantsB97e736d = require('./constants-b97e736d-BzFAKCkR.js');
5
+ var _commonjsHelpers1789f0cf = require('./_commonjsHelpers-1789f0cf-BJu3ubxk.js');
6
+ require('react');
7
+
8
+ var dayjs_min = {exports: {}};
9
+
10
+ (function (module, exports) {
11
+ !function(t,e){module.exports=e();}(_commonjsHelpers1789f0cf.commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,true),this.parse(t),this.$x=this.$x||t.x||{},this[p]=true;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,false)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case "YY":return String(e.$y).slice(-2);case "YYYY":return b.s(e.$y,4,"0");case "M":return a+1;case "MM":return b.s(a+1,2,"0");case "MMM":return h(n.monthsShort,a,c,3);case "MMMM":return h(c,a);case "D":return e.$D;case "DD":return b.s(e.$D,2,"0");case "d":return String(e.$W);case "dd":return h(n.weekdaysMin,e.$W,o,2);case "ddd":return h(n.weekdaysShort,e.$W,o,3);case "dddd":return o[e.$W];case "H":return String(s);case "HH":return b.s(s,2,"0");case "h":return d(1);case "hh":return d(2);case "a":return $(s,u,true);case "A":return $(s,u,false);case "m":return String(u);case "mm":return b.s(u,2,"0");case "s":return String(e.$s);case "ss":return b.s(e.$s,2,"0");case "SSS":return b.s(e.$ms,3,"0");case "Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,true);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=true),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
12
+ }(dayjs_min));
13
+
14
+ const dayjs = dayjs_min.exports;
15
+
16
+ var customParseFormat$1 = {exports: {}};
17
+
18
+ (function (module, exports) {
19
+ !function(e,t){module.exports=t();}(_commonjsHelpers1789f0cf.commonjsGlobal,(function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,i=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,s={},a=function(e){return (e=+e)+(e>68?1900:2e3)};var f=function(e){return function(t){this[e]=+t;}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e);}],u=function(e){var t=s[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=s.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},c={A:[o,function(e){this.afternoon=d(e,false);}],a:[o,function(e){this.afternoon=d(e,true);}],Q:[n,function(e){this.month=3*(e-1)+1;}],S:[n,function(e){this.milliseconds=100*+e;}],SS:[r,function(e){this.milliseconds=10*+e;}],SSS:[/\d{3}/,function(e){this.milliseconds=+e;}],s:[i,f("seconds")],ss:[i,f("seconds")],m:[i,f("minutes")],mm:[i,f("minutes")],H:[i,f("hours")],h:[i,f("hours")],HH:[i,f("hours")],hh:[i,f("hours")],D:[i,f("day")],DD:[r,f("day")],Do:[o,function(e){var t=s.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r);}],w:[i,f("week")],ww:[r,f("week")],M:[i,f("month")],MM:[r,f("month")],MMM:[o,function(e){var t=u("months"),n=(u("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[o,function(e){var t=u("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t;}],Y:[/[+-]?\d+/,f("year")],YY:[r,function(e){this.year=a(e);}],YYYY:[/\d{4}/,f("year")],Z:h,ZZ:h};function l(n){var r,i;r=n,i=s&&s.formats;for(var o=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=o.length,f=0;f<a;f+=1){var h=o[f],u=c[h],d=u&&u[0],l=u&&u[1];o[f]=l?{regex:d,parser:l}:h.replace(/^\[|\]$/g,"");}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var i=o[n];if("string"==typeof i)r+=i.length;else {var s=i.regex,f=i.parser,h=e.slice(r),u=s.exec(h)[0];f.call(t,u),e=e.replace(u,"");}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon;}}(t),t}}return function(e,t,n){n.p.customParseFormat=true,e&&e.parseTwoDigitYear&&(a=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,o=e.args;this.$u=r;var a=o[1];if("string"==typeof a){var f=true===o[2],h=true===o[3],u=f||h,d=o[2];h&&(d=o[2]),s=this.$locale(),!f&&d&&(s=n.Ls[d]),this.$d=function(e,t,n,r){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var i=l(t)(e),o=i.year,s=i.month,a=i.day,f=i.hours,h=i.minutes,u=i.seconds,d=i.milliseconds,c=i.zone,m=i.week,M=new Date,Y=a||(o||s?1:M.getDate()),p=o||M.getFullYear(),v=0;o&&!s||(v=s>0?s-1:M.getMonth());var D,w=f||0,g=h||0,y=u||0,L=d||0;return c?new Date(Date.UTC(p,v,Y,w,g,y,L+60*c.offset*1e3)):n?new Date(Date.UTC(p,v,Y,w,g,y,L)):(D=new Date(p,v,Y,w,g,y,L),m&&(D=r(D).week(m).toDate()),D)}catch(e){return new Date("")}}(t,a,r,n),this.init(),d&&true!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),s={};}else if(a instanceof Array)for(var c=a.length,m=1;m<=c;m+=1){o[1]=a[m-1];var M=n.apply(this,o);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===c&&(this.$d=new Date(""));}else i.call(this,e);};}}));
20
+ }(customParseFormat$1));
21
+
22
+ const customParseFormat = customParseFormat$1.exports;
23
+
24
+ var utc$1 = {exports: {}};
25
+
26
+ (function (module, exports) {
27
+ !function(t,i){module.exports=i();}(_commonjsHelpers1789f0cf.commonjsGlobal,(function(){var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:true,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:true});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:false})};var o=u.parse;u.parse=function(t){t.utc&&(this.$u=true),this.$utils().u(t.$offset)||(this.$offset=t.$offset),o.call(this,t);};var r=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds();}else r.call(this);};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){ void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s,o=this;if(f)return o.$offset=u,o.$u=0===s,o;if(0!==s){var r=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(o=this.local().add(u+r,t)).$offset=u,o.$x.$localOffset=r;}else o=this.utc();return o};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return !!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return "s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)};}}));
28
+ }(utc$1));
29
+
30
+ const utc = utc$1.exports;
31
+
32
+ var weekOfYear$1 = {exports: {}};
33
+
34
+ (function (module, exports) {
35
+ !function(e,t){module.exports=t();}(_commonjsHelpers1789f0cf.commonjsGlobal,(function(){var e="week",t="year";return function(i,n,r){var f=n.prototype;f.week=function(i){if(void 0===i&&(i=null),null!==i)return this.add(7*(i-this.week()),"day");var n=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var f=r(this).startOf(t).add(1,t).date(n),s=r(this).endOf(e);if(f.isBefore(s))return 1}var a=r(this).startOf(t).date(n).startOf(e).subtract(1,"millisecond"),o=this.diff(a,e,true);return o<0?r(this).startOf("week").week():Math.ceil(o)},f.weeks=function(e){return void 0===e&&(e=null),this.week(e)};}}));
36
+ }(weekOfYear$1));
37
+
38
+ const weekOfYear = weekOfYear$1.exports;
39
+
40
+ dayjs.extend(customParseFormat);
41
+ dayjs.extend(utc);
42
+ dayjs.extend(weekOfYear);
43
+ /**
44
+ * Formats a date to a string according to the format
45
+ * @param {Date} date - Date to format
46
+ * @returns {string} Formatted date
47
+ * @param {Object} options - Additional options
48
+ * @param {string} options.dateFormat - Date format (ex: 'YYYY-MM-DD', 'DD-MM-YYYY', etc.)
49
+ */
50
+ function formatDate(date, options) {
51
+ if (!date)
52
+ return '';
53
+ const isUTCMode = options.dateFormat.includes('Z');
54
+ const isISO8601Format = options.dateFormat === 'YYYY-MM-DD[T]HH:mm:ss[Z]';
55
+ // Special case for ISO 8601
56
+ if (isISO8601Format) {
57
+ // For the ISO 8601 format, use directly toISOString() which is standard
58
+ return date.toISOString();
59
+ }
60
+ // If the format is "Ticks", convert the time to C# ticks
61
+ if (options.dateFormat === 'Ticks') {
62
+ const ticks = date.getTime() * 10000 + 621355968000000000;
63
+ return ticks.toString();
64
+ }
65
+ // If the format is "X" (Unix Seconds)
66
+ if (options.dateFormat === 'X') {
67
+ return dayjs(date).unix().toString();
68
+ }
69
+ // If the format is "x" (Unix Milliseconds)
70
+ if (options.dateFormat === 'x') {
71
+ return date.getTime().toString();
72
+ }
73
+ // Otherwise, format according to the mode (UTC or local)
74
+ return isUTCMode
75
+ ? dayjs(date).utc().format(options.dateFormat)
76
+ : dayjs(date).format(options.dateFormat);
77
+ }
78
+ /**
79
+ * Checks if two dates are identical
80
+ * @param {Date | null} date - First date
81
+ * @param {Date | null} compareDate - Second date
82
+ * @param {Object} options - Additional options
83
+ * @param {boolean} options.isUTCMode - Whether the dates are in UTC mode
84
+ * @returns {boolean} true if the dates are identical
85
+ */
86
+ function isSameDate(date, compareDate, options) {
87
+ if (!date || !compareDate)
88
+ return false;
89
+ if (options.isUTCMode) {
90
+ return (date.getUTCFullYear() === compareDate.getUTCFullYear() &&
91
+ date.getUTCMonth() === compareDate.getUTCMonth() &&
92
+ date.getUTCDate() === compareDate.getUTCDate());
93
+ }
94
+ else {
95
+ return (date.getFullYear() === compareDate.getFullYear() &&
96
+ date.getMonth() === compareDate.getMonth() &&
97
+ date.getDate() === compareDate.getDate());
98
+ }
99
+ }
100
+ /**
101
+ * Checks if a date is identical or before another date
102
+ * @param {Date} date - Date to check
103
+ * @param {Date} compareDate - Reference date
104
+ * @param {Object} options - Additional options
105
+ * @param {boolean} options.isUTCMode - Whether the dates are in UTC mode
106
+ * @returns {boolean} true if `date` <= `compareDate`
107
+ */
108
+ function isSameOrBefore(date, compareDate, options) {
109
+ if (!date || !compareDate)
110
+ return false;
111
+ if (options.isUTCMode) {
112
+ return (date.getUTCFullYear() < compareDate.getUTCFullYear() ||
113
+ (date.getUTCFullYear() === compareDate.getUTCFullYear() &&
114
+ date.getUTCMonth() < compareDate.getUTCMonth()) ||
115
+ (date.getUTCFullYear() === compareDate.getUTCFullYear() &&
116
+ date.getUTCMonth() === compareDate.getUTCMonth() &&
117
+ date.getUTCDate() <= compareDate.getUTCDate()));
118
+ }
119
+ else {
120
+ return (date.getFullYear() < compareDate.getFullYear() ||
121
+ (date.getFullYear() === compareDate.getFullYear() &&
122
+ date.getMonth() < compareDate.getMonth()) ||
123
+ (date.getFullYear() === compareDate.getFullYear() &&
124
+ date.getMonth() === compareDate.getMonth() &&
125
+ date.getDate() <= compareDate.getDate()));
126
+ }
127
+ }
128
+ /**
129
+ * Checks if a date is identical or after another date
130
+ * @param {Date} date - Date to check
131
+ * @param {Date} compareDate - Reference date
132
+ * @param {Object} options - Additional options
133
+ * @param {boolean} options.isUTCMode - Whether the dates are in UTC mode
134
+ * @returns {boolean} true if `date` >= `compareDate`
135
+ */
136
+ function isSameOrAfter(date, compareDate, options) {
137
+ if (!date || !compareDate)
138
+ return false;
139
+ if (options.isUTCMode) {
140
+ return (date.getUTCFullYear() > compareDate.getUTCFullYear() ||
141
+ (date.getUTCFullYear() === compareDate.getUTCFullYear() &&
142
+ date.getUTCMonth() > compareDate.getUTCMonth()) ||
143
+ (date.getUTCFullYear() === compareDate.getUTCFullYear() &&
144
+ date.getUTCMonth() === compareDate.getUTCMonth() &&
145
+ date.getUTCDate() >= compareDate.getUTCDate()));
146
+ }
147
+ else {
148
+ return (date.getFullYear() > compareDate.getFullYear() ||
149
+ (date.getFullYear() === compareDate.getFullYear() &&
150
+ date.getMonth() > compareDate.getMonth()) ||
151
+ (date.getFullYear() === compareDate.getFullYear() &&
152
+ date.getMonth() === compareDate.getMonth() &&
153
+ date.getDate() >= compareDate.getDate()));
154
+ }
155
+ }
156
+ /**
157
+ * Calculates the ISO week number
158
+ * @param {Date} date - Date to calculate
159
+ * @returns {number} Week number
160
+ */
161
+ function getWeekNumber(date) {
162
+ const startOfYear = new Date(date.getFullYear(), 0, 1);
163
+ const pastDaysOfYear = (date.getTime() - startOfYear.getTime()) / 86400000;
164
+ return Math.ceil((pastDaysOfYear + startOfYear.getDay() + 1) / 7);
165
+ }
166
+ /**
167
+ * Convert a date string/Date to a Date without timezone offset
168
+ * @param {string | Date} dateInput - Date under string or Date object form
169
+ * @param {string} dateFormat - Date format (ex: 'YYYY-MM-DD', 'DD-MM-YYYY', etc.)
170
+ * @returns {Date} Date in Date form without timezone offset
171
+ */
172
+ function parseDate(dateInput, dateFormat) {
173
+ if (dateInput instanceof Date)
174
+ return dateInput;
175
+ const isUTCMode = dateFormat.includes('Z');
176
+ // Attempt to automatically detect ISO 8601 format (generated by toISOString())
177
+ // The regex checks the standard ISO format: YYYY-MM-DDTHH:mm:ss.sssZ
178
+ if (typeof dateInput === 'string' &&
179
+ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/.test(dateInput)) {
180
+ try {
181
+ const parsedDate = new Date(dateInput);
182
+ if (!isNaN(parsedDate.getTime())) {
183
+ return parsedDate;
184
+ }
185
+ }
186
+ catch (error) {
187
+ // If it fails, continue with other methods
188
+ console.error('Error parsing ISO date:', error);
189
+ }
190
+ }
191
+ // Handling Unix Seconds ("X") formats
192
+ if (dateFormat === 'X') {
193
+ const unixSeconds = Number(dateInput);
194
+ if (isNaN(unixSeconds))
195
+ return null;
196
+ return isUTCMode
197
+ ? dayjs.unix(unixSeconds).utc().toDate()
198
+ : dayjs.unix(unixSeconds).toDate();
199
+ }
200
+ // Handling Unix Milliseconds ("x") formats
201
+ if (dateFormat === 'x') {
202
+ const unixMilliseconds = Number(dateInput);
203
+ if (isNaN(unixMilliseconds))
204
+ return null;
205
+ return isUTCMode
206
+ ? dayjs(unixMilliseconds).utc().toDate()
207
+ : dayjs(unixMilliseconds).toDate();
208
+ }
209
+ // Handling C# Ticks format
210
+ if (dateFormat === 'Ticks') {
211
+ const ticks = Number(dateInput);
212
+ if (isNaN(ticks))
213
+ return null;
214
+ // Conversion of .NET ticks to milliseconds since Unix epoch
215
+ const unixMilliseconds = (ticks - 621355968000000000) / 10000;
216
+ return isUTCMode
217
+ ? dayjs(unixMilliseconds).utc().toDate()
218
+ : dayjs(unixMilliseconds).toDate();
219
+ }
220
+ // For all other formats, use customParseFormat in strict mode
221
+ let parsed;
222
+ if (isUTCMode) {
223
+ parsed = dayjs.utc(dateInput, dateFormat, true);
224
+ }
225
+ else {
226
+ parsed = dayjs(dateInput, dateFormat, true);
227
+ }
228
+ if (!parsed.isValid()) {
229
+ console.error(`Parsing error:`, {
230
+ dateInput,
231
+ dateFormat: dateFormat,
232
+ });
233
+ return null;
234
+ }
235
+ return parsed.toDate();
236
+ }
237
+
238
+ const nvCalendarCss = "nv-calendar{display:block}.datepicker-root{display:flex;justify-content:center;align-items:flex-start;width:auto}.datepicker-container{font-family:system-ui, sans-serif;display:flex;flex-direction:column;align-items:stretch;background:var(--components-calendar-background);border-radius:var(--calendar-radius);padding:var(--calendar-padding);box-shadow:0px var(--shadow-y-axis-md-1) var(--shadow-blur-md-1) var(--shadow-spread-md, 0) var(--shadow-color-opacity-0), 0px var(--shadow-y-axis-md-2) var(--shadow-blur-md-2) var(--shadow-spread-md, 0) var(--shadow-color-opacity-2);border:1px solid var(--components-calendar-border);width:auto;max-width:100%}.datepicker-container-single{max-width:300px}.datepicker-container-single .datepicker-wrapper:has(.shortcuts-placement-left),.datepicker-container-single .datepicker-wrapper:has(.shortcuts-placement-right){max-width:410px !important}.datepicker-container-single:has(.shortcuts-placement-left),.datepicker-container-single:has(.shortcuts-placement-right){max-width:410px !important}.datepicker-wrapper{display:flex;justify-content:center;align-items:flex-start;gap:var(--calendar-gap-x);width:auto;overflow-x:hidden}.datepicker-wrapper::-webkit-scrollbar{width:6px;height:6px}.datepicker-wrapper::-webkit-scrollbar-track{background-color:var(--color-level-10-background);border-radius:9999px}.datepicker-wrapper::-webkit-scrollbar-thumb{background-color:var(--color-gray-200);border-radius:9999px}.datepicker-wrapper.single{justify-content:center}.calendar-container{display:flex;flex-direction:column;align-items:center;padding:var(--calendar-padding);width:auto;position:relative}.calendar-separator{width:1px;background:var(--components-calendar-border);height:auto;min-height:100%;margin:0 10px}.header{display:flex;justify-content:start;align-items:center;margin-bottom:var(--calendar-header-margin-bottom);width:100%}.header nv-iconbutton{width:var(--calendar-header-button-size);height:var(--calendar-header-button-size)}.nav-buttons{display:flex;gap:var(--spacing-0);margin-left:auto}.nav-left{order:-1}.date-controls{display:flex;gap:var(--spacing-1);align-items:center;min-height:34px;justify-content:center}.datepicker-container-single .date-controls{justify-content:flex-start}.datepicker-container:not(.datepicker-container-single) .date-controls{justify-content:start;flex-grow:1}.date-controls .month-select,.date-controls .year-input{background:transparent !important}.calendar-wrapper:nth-child(n+2) .datepicker-container{margin-left:42px}.calendar-grid{display:grid;grid-template-columns:auto 1fr;column-gap:var(--calendar-weeks-calendar-gap-x);position:relative}.calendar-grid.slide-left{animation:slideLeft 0.3s ease-out}.calendar-grid.slide-right{animation:slideRight 0.3s ease-out}.week-numbers{display:grid;grid-template-rows:var(--calendar-cell-size) repeat(6, var(--calendar-cell-size));background:var(--components-calendar-weeks-background);color:var(--components-calendar-weeks-text);border-radius:var(--calendar-weeks-radius);width:var(--calendar-weeks-size);row-gap:var(--calendar-grid-gap-y)}.week-numbers .clickable{cursor:pointer}.week-numbers .clickable:hover{background-color:var(--components-calendar-weeks-background-hover);color:var(--components-calendar-weeks-text-hover);border-radius:var(--calendar-radius)}.week-header,.week-number{display:grid;place-items:center;font-size:var(--calendar-cell-font-size)}.week-header{font-weight:700;color:var(--components-calendar-weeks-text)}.week-number{color:var(--components-calendar-cell-text)}.days-container{display:grid;grid-template-rows:auto 1fr;row-gap:var(--calendar-grid-gap-y)}.days-header{display:grid;grid-template-columns:repeat(7, var(--calendar-cell-size));height:var(--calendar-cell-size)}.day-header{display:grid;place-items:center;font-size:var(--calendar-cell-font-size);color:var(--components-calendar-cell-text)}.days-grid{display:grid;grid-template-columns:repeat(7, var(--calendar-cell-size));grid-template-rows:repeat(6, var(--calendar-cell-size));animation:fadeIn 0.2s ease-in;row-gap:var(--calendar-grid-gap-y);z-index:0}.day{display:grid;place-items:center;width:var(--calendar-cell-size);height:var(--calendar-cell-size);font-size:var(--calendar-cell-font-size);border-radius:var(--calendar-cell-radius);cursor:pointer;border:none;background:transparent;transition:all 0.2s ease;text-align:center;animation:scaleIn 0.2s ease-out}.day:hover:not(.disabled,.empty,.selected){background:var(--components-calendar-cell-background-hover);color:var(--components-calendar-cell-text-hover)}.day.selected,.day.selected:hover .day.is-today.selected,.day.is-today.selected:hover{background:var(--components-calendar-cell-background-selected);color:var(--components-calendar-cell-text-selected) !important}.day.disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.day.outside-month{color:var(--components-calendar-cell-text);opacity:var(--opacity-disabled)}.day.outside-month.selected{opacity:1 !important;color:var(--components-calendar-cell-text-selected)}.day.outside-month.in-range{opacity:1 !important;background-color:var(--components-calendar-cell-background-in-range);color:var(--components-calendar-cell-text-in-range)}.day.in-range{background:var(--components-calendar-cell-background-in-range);color:var(--components-calendar-cell-text-in-range);border-radius:0;position:relative}.day.range-start,.day.range-start:focus,.day.range-start:hover,.day.range-end,.day.range-end:focus,.day.range-end:hover{background-color:var(--components-calendar-cell-background-selected) !important;color:var(--components-calendar-cell-text-selected) !important}.day.range-start,.day.range-end,.day.range-start.is-today,.day.range-end.is-today{background:var(--components-calendar-cell-background-selected);color:var(--components-calendar-cell-text-selected);position:relative;border-radius:var(--radius-rounded-full)}.day.range-start:hover,.day.range-end:hover,.day.range-start.is-today:hover,.day.range-end.is-today:hover{color:var(--components-calendar-cell-text-today)}.day.range-start:before,.day.range-end:before,.day.range-start.is-today:before,.day.range-end.is-today:before{content:\"\";position:absolute;bottom:0;left:0;right:0;top:0;z-index:-1;background-color:var(--components-calendar-cell-background-in-range);border-radius:var(--radius-rounded-full);width:auto;height:auto}.day.range-start:has(~.range-end):before,.day.range-start:has(+.in-range):before{border-top-right-radius:0;border-bottom-right-radius:0}.day.range-end:before{border-top-left-radius:0 !important;border-bottom-left-radius:0 !important}.day.outside-month.range-start,.day.outside-month.range-end{background:var(--components-calendar-cell-background-selected) !important;color:var(--components-calendar-cell-text-selected);opacity:1 !important}.day.is-today{font-weight:700;position:relative;color:var(--components-calendar-cell-text-today)}.day.is-today.range-start,.day.is-today.range-end{color:var(--components-calendar-cell-text-selected)}.day.is-today.range-start:hover,.day.is-today.range-end:hover{color:var(--components-calendar-cell-text-today)}.day.is-today::after{content:\"\";position:absolute;bottom:var(--spacing-1);left:50%;transform:translateX(-50%);width:var(--calendar-cell-dot-size);height:var(--calendar-cell-dot-size);background-color:currentColor;border-radius:50%}.day.is-today.selected::after{color:var(--components-calendar-cell-text-selected)}.day.is-today.selected::after::after{background-color:var(--components-calendar-cell-dot-selected)}.calendar-footer{display:flex;gap:var(--spacing-1);justify-content:flex-start;width:100%;flex-wrap:wrap}.footer-placement-left{justify-content:flex-start}.footer-placement-right{justify-content:flex-end}.footer-placement-center{justify-content:center}.datepicker-controls{display:flex;flex-direction:column;border-top:1px solid var(--components-calendar-border);padding:var(--calendar-controls-padding-top) var(--calendar-padding) var(--calendar-padding);gap:var(--calendar-grid-gap-y);margin-top:var(--calendar-controls-margin-top)}.datepicker-actions{display:flex;justify-content:flex-end;gap:var(--spacing-1);width:100%}.datepicker-actions slot-fb{display:contents !important}.calendar-footer+.datepicker-actions{margin-top:0}.shortcuts-placement-left,.shortcuts-placement-right{display:flex;flex-direction:column;gap:var(--spacing-1);margin-top:var(--spacing-4)}.shortcuts-placement-left{align-items:flex-end}.shortcuts-placement-right{align-items:flex-start}@keyframes slideLeft{from{opacity:0;transform:translateX(20px)}to{opacity:1;transform:translateX(0)}}@keyframes slideRight{from{opacity:0;transform:translateX(-20px)}to{opacity:1;transform:translateX(0)}}@keyframes fadeIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes scaleIn{from{opacity:0;transform:scale(0.9)}to{opacity:1;transform:scale(1)}}";
239
+ const NvCalendarStyle0 = nvCalendarCss;
240
+
241
+ const NvCalendar = class {
242
+ constructor(hostRef) {
243
+ index.registerInstance(this, hostRef);
244
+ this.singleDateChange = index.createEvent(this, "singleDateChange");
245
+ this.rangeDateChange = index.createEvent(this, "rangeDateChange");
246
+ /****************************************************************************/
247
+ //#region PROPERTIES
248
+ /**
249
+ * First day of the week (0 = Sunday, 1 = Monday, etc.)
250
+ * @default 0
251
+ */
252
+ this.firstDayOfWeek = 0;
253
+ /**
254
+ * Number of calendars to display
255
+ * @default 1
256
+ */
257
+ this.numberOfCalendars = 1;
258
+ /**
259
+ * Locale for date formatting
260
+ * @default 'en-BE'
261
+ */
262
+ this.locale = 'en-BE';
263
+ /**
264
+ * Date format (ex: 'YYYY-MM-DD', 'DD-MM-YYYY', etc.)
265
+ * @default 'YYYY-MM-DD'
266
+ * @note If the date format is in UTC mode, the date will be displayed in UTC time.
267
+ * @note If the date format is not in UTC mode, the date will be displayed in the local time.
268
+ */
269
+ this.dateFormat = 'YYYY-MM-DD';
270
+ /**
271
+ * Footer placement
272
+ * @default 'bottom'
273
+ */
274
+ this.shortcutsPlacement = 'bottom';
275
+ /**
276
+ * Selection type (single date or date range)
277
+ * @default 'single'
278
+ */
279
+ this.selectionType = 'single';
280
+ /**
281
+ * Show action buttons
282
+ */
283
+ this.showActions = false;
284
+ /** Cache for parsed disabled dates */
285
+ this.parsedDisabledDates = [];
286
+ //#endregion PROPERTIES
287
+ /****************************************************************************/
288
+ //#region STATE
289
+ this.currentDate = null;
290
+ this.selectedDate = null;
291
+ this.startDate = null;
292
+ this.endDate = null;
293
+ /** List of formatted months for the selector */
294
+ this.months = [];
295
+ /**
296
+ * Change the displayed month
297
+ * @param {number} offset - Month offset (-1 for previous, 1 for next)
298
+ */
299
+ this.changeMonth = (offset) => {
300
+ const newDate = new Date(this.currentDate);
301
+ // Ensure we only move by one month at a time
302
+ newDate.setUTCMonth(newDate.getUTCMonth() + offset);
303
+ // Add the appropriate animation class
304
+ const containers = this.el.querySelectorAll('.calendar-grid');
305
+ containers.forEach(container => {
306
+ // Remove existing animation classes
307
+ container.classList.remove('slide-left', 'slide-right');
308
+ // Add the new animation class
309
+ const animationClass = offset > 0 ? 'slide-left' : 'slide-right';
310
+ container.classList.add(animationClass);
311
+ // Remove the class after the animation
312
+ setTimeout(() => {
313
+ container.classList.remove(animationClass);
314
+ }, 300); // 300ms corresponds to $slide-duration in the SCSS
315
+ });
316
+ this.currentDate = newDate;
317
+ };
318
+ /**
319
+ * Handles date selection based on the mode
320
+ * @param {Date} date - Selected date
321
+ */
322
+ this.handleDateSelection = (date) => {
323
+ if (this.isDateDisabled(date)) {
324
+ return;
325
+ }
326
+ if (this.selectionType === 'single') {
327
+ this.handleSingleSelection(date);
328
+ }
329
+ else {
330
+ this.handleRangeSelection(date);
331
+ }
332
+ };
333
+ /**
334
+ * Handles single date selection
335
+ * @param {Date} date - Selected date
336
+ */
337
+ this.handleSingleSelection = (date) => {
338
+ if (!date)
339
+ return;
340
+ const formattedDate = formatDate(date, { dateFormat: this.dateFormat });
341
+ this.selectedDate = date;
342
+ this.singleDateChange.emit(formattedDate);
343
+ };
344
+ /**
345
+ * Handles range date selection
346
+ * @param {Date} date - Selected date
347
+ */
348
+ this.handleRangeSelection = (date) => {
349
+ if (!this.startDate || (this.startDate && this.endDate)) {
350
+ this.startDate = date;
351
+ this.endDate = null;
352
+ }
353
+ else {
354
+ this.endDate = date;
355
+ if (this.startDate > this.endDate) {
356
+ [this.startDate, this.endDate] = [this.endDate, this.startDate];
357
+ }
358
+ this.rangeDateChange.emit({
359
+ start: formatDate(this.startDate, { dateFormat: this.dateFormat }),
360
+ end: formatDate(this.endDate, { dateFormat: this.dateFormat }),
361
+ });
362
+ }
363
+ };
364
+ /**
365
+ * Checks if a date is disabled.
366
+ * Disabled if:
367
+ * - The date is before min (if defined)
368
+ * - The date is after max (if defined)
369
+ * - The date is in the disabledDates array
370
+ * @param {Date} date - Date to check
371
+ * @returns {boolean} true if the date is disabled
372
+ */
373
+ this.isDateDisabled = (date) => {
374
+ if (!date)
375
+ return true;
376
+ // Minimum bound check
377
+ if (this.min) {
378
+ const minDate = parseDate(this.min, this.dateFormat);
379
+ if (minDate && date < minDate) {
380
+ return true;
381
+ }
382
+ }
383
+ // Maximum bound check
384
+ if (this.max) {
385
+ const maxDate = parseDate(this.max, this.dateFormat);
386
+ if (maxDate && date > maxDate) {
387
+ return true;
388
+ }
389
+ }
390
+ // Check disabled dates
391
+ return this.parsedDisabledDates.some(disabledDate => isSameDate(date, disabledDate, { isUTCMode: this.isUTCMode }));
392
+ };
393
+ /**
394
+ * Checks if a date is in the selected range
395
+ * @param {Date} date - Date to check
396
+ * @returns {boolean} true if the date is in the range
397
+ */
398
+ this.isDateInRange = (date) => {
399
+ if (!date || !this.startDate || !this.endDate)
400
+ return false;
401
+ const checkDate = parseDate(date, this.dateFormat);
402
+ const startDate = parseDate(this.startDate, this.dateFormat);
403
+ const endDate = parseDate(this.endDate, this.dateFormat);
404
+ // Verify if startDate and endDate are valid
405
+ if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
406
+ return false;
407
+ }
408
+ // Verify that startDate is before endDate (additional security)
409
+ if (startDate > endDate)
410
+ return false;
411
+ // Comparison based only on the date (year, month, day)
412
+ return (isSameOrAfter(checkDate, startDate, { isUTCMode: this.isUTCMode }) &&
413
+ isSameOrBefore(checkDate, endDate, { isUTCMode: this.isUTCMode }));
414
+ };
415
+ /**
416
+ * Retrieves the localized day names
417
+ * @returns {string[]} Array of short day names
418
+ */
419
+ this.getDayNames = () => {
420
+ // If we have custom day names for this locale
421
+ if (constantsB97e736d.CUSTOM_DAY_NAMES[this.locale]) {
422
+ const days = [...constantsB97e736d.CUSTOM_DAY_NAMES[this.locale]];
423
+ // Reorganize the days based on the first day of the week
424
+ const firstDays = days.slice(0, this.firstDayOfWeek);
425
+ const remainingDays = days.slice(this.firstDayOfWeek);
426
+ return [...remainingDays, ...firstDays];
427
+ }
428
+ // Otherwise, use the default behavior
429
+ const formatter = new Intl.DateTimeFormat(this.locale, {
430
+ weekday: 'short',
431
+ });
432
+ const days = [...Array(7)].map((_, i) => formatter.format(new Date(2023, 0, i + 1)).toUpperCase());
433
+ // Reorganize the days based on the first day of the week
434
+ const firstDays = days.slice(0, this.firstDayOfWeek);
435
+ const remainingDays = days.slice(this.firstDayOfWeek);
436
+ return [...remainingDays, ...firstDays];
437
+ };
438
+ /**
439
+ * Generates the days of the current month
440
+ * @param {number} offset - Month offset (0 by default)
441
+ * @param {number} totalCalendars - Number of calendars to display (1 by default)
442
+ * @returns {Array<{ dayOfMonth: number | null, date: Date | null, isSelected: boolean, isDisabled: boolean }>} Array of formatted days
443
+ */
444
+ this.getDaysInMonth = (offset = 0, totalCalendars = 1) => {
445
+ const year = this.currentDate.getUTCFullYear();
446
+ const month = this.currentDate.getUTCMonth() + offset;
447
+ const firstDay = new Date(Date.UTC(year, month, 1));
448
+ const lastDay = new Date(Date.UTC(year, month + 1, 0));
449
+ const days = [];
450
+ // Correct calculation of offset for previous month days
451
+ // Use getUTCDay to stay consistent with UTC timezone
452
+ const dayOfWeekIndex = firstDay.getUTCDay(); // 0 = Sunday, 1 = Monday, etc.
453
+ // Adjust based on firstDayOfWeek (if week starts on Monday, offset is different)
454
+ const offsetDays = (dayOfWeekIndex - this.firstDayOfWeek + 7) % 7;
455
+ // Add the days of the previous month for the first calendar
456
+ if (offset === 0 && offsetDays > 0) {
457
+ const prevMonthLastDay = new Date(Date.UTC(year, month, 0)).getUTCDate();
458
+ for (let i = offsetDays; i > 0; i--) {
459
+ const date = new Date(Date.UTC(year, month - 1, prevMonthLastDay - i + 1));
460
+ days.push({
461
+ dayOfMonth: date.getUTCDate(),
462
+ date,
463
+ isCurrentMonth: false,
464
+ isDisabled: this.isDateDisabled(date),
465
+ });
466
+ }
467
+ }
468
+ // Add the days of the current month
469
+ for (let i = 1; i <= lastDay.getUTCDate(); i++) {
470
+ const date = new Date(Date.UTC(year, month, i));
471
+ days.push({
472
+ dayOfMonth: i,
473
+ date,
474
+ isCurrentMonth: true,
475
+ isDisabled: this.isDateDisabled(date),
476
+ });
477
+ }
478
+ // Add the days of the next month only for the last calendar
479
+ if (offset === totalCalendars - 1) {
480
+ const nextMonthDaysNeeded = 7 - (days.length % 7 || 7);
481
+ for (let i = 1; i <= nextMonthDaysNeeded; i++) {
482
+ const date = new Date(Date.UTC(year, month + 1, i));
483
+ days.push({
484
+ dayOfMonth: i,
485
+ date,
486
+ isCurrentMonth: false,
487
+ isDisabled: this.isDateDisabled(date),
488
+ });
489
+ }
490
+ }
491
+ return days;
492
+ };
493
+ /** Initializes the list of formatted months according to the locale */
494
+ this.initializeMonths = () => {
495
+ // If we have custom month names for this locale
496
+ if (constantsB97e736d.CUSTOM_MONTH_NAMES[this.locale]) {
497
+ this.months = constantsB97e736d.CUSTOM_MONTH_NAMES[this.locale].map((label, value) => ({
498
+ value,
499
+ label,
500
+ }));
501
+ return;
502
+ }
503
+ // Otherwise, use the default behavior
504
+ const formatter = new Intl.DateTimeFormat(this.locale, { month: 'short' });
505
+ this.months = Array.from({ length: 12 }, (_, i) => ({
506
+ value: i,
507
+ label: formatter.format(new Date(2000, i, 1)).toUpperCase(),
508
+ }));
509
+ };
510
+ /**
511
+ * Retrieves the localized abbreviation for "week"
512
+ * @returns {string} Localized abbreviation for "week"
513
+ */
514
+ this.getLocalizedWeekText = () => {
515
+ return constantsB97e736d.WEEK_ABBREVIATIONS[this.locale] || 'W';
516
+ };
517
+ /**
518
+ * Handles month change in the selector
519
+ * @param {Event} event - Month change event
520
+ * @param {number} calendarOffset - Calendar offset (0 by default)
521
+ */
522
+ this.handleMonthChange = (event, calendarOffset = 0) => {
523
+ const select = event.target;
524
+ const selectedMonth = parseInt(select.value, 10);
525
+ const currentMonth = this.currentDate.getUTCMonth();
526
+ // Calculate the difference considering the calendar offset
527
+ const monthDiff = selectedMonth - ((currentMonth + calendarOffset) % 12);
528
+ const newDate = new Date(this.currentDate);
529
+ newDate.setUTCMonth(newDate.getUTCMonth() + monthDiff);
530
+ this.currentDate = newDate;
531
+ };
532
+ /**
533
+ * Handles year change in the numeric entry
534
+ * @param {Event} event - Year change event
535
+ * @param {number} calendarOffset - Calendar offset (0 by default)
536
+ */
537
+ this.handleYearChange = (event, calendarOffset = 0) => {
538
+ const input = event.target;
539
+ const year = parseInt(input.value, 10);
540
+ if (!isNaN(year) && year >= 1900 && year <= 2100) {
541
+ const newDate = new Date(this.currentDate);
542
+ newDate.setUTCFullYear(year);
543
+ newDate.setUTCMonth(newDate.getUTCMonth() + calendarOffset);
544
+ this.currentDate = newDate;
545
+ }
546
+ };
547
+ /**
548
+ * Handles week selection
549
+ * @param {Date[]} weekDays - Selected week days
550
+ * @param {number} calendarIndex - Calendar index from which the selection is made
551
+ */
552
+ this.handleWeekSelection = (weekDays, calendarIndex) => {
553
+ if (this.selectionType !== 'range')
554
+ return;
555
+ const allDays = this.getDaysInMonth(calendarIndex, this.numberOfCalendars);
556
+ const weekStart = weekDays[0];
557
+ const weekEnd = weekDays[weekDays.length - 1];
558
+ if (!weekStart || !weekEnd)
559
+ return;
560
+ const selectedWeekDays = allDays.filter(day => day.date && day.date >= weekStart && day.date <= weekEnd);
561
+ const validDays = selectedWeekDays.filter(day => !this.isDateDisabled(day.date));
562
+ if (validDays.length > 0) {
563
+ this.startDate = validDays[0].date;
564
+ this.endDate = validDays[validDays.length - 1].date;
565
+ this.rangeDateChange.emit({
566
+ start: formatDate(this.startDate, { dateFormat: this.dateFormat }),
567
+ end: formatDate(this.endDate, { dateFormat: this.dateFormat }),
568
+ });
569
+ }
570
+ };
571
+ /**
572
+ * Checks if a date corresponds to today
573
+ * @param {Date} date - Date to check
574
+ * @returns {boolean} true if the date is today
575
+ */
576
+ this.isToday = (date) => {
577
+ const today = new Date();
578
+ return (date.getDate() === today.getDate() &&
579
+ date.getMonth() === today.getMonth() &&
580
+ date.getFullYear() === today.getFullYear());
581
+ };
582
+ /**
583
+ * Parse and cache the disabled dates
584
+ * @description Parse and cache the disabled dates
585
+ */
586
+ this.parseDisabledDates = () => {
587
+ if (!this.disabledDates) {
588
+ this.parsedDisabledDates = [];
589
+ return;
590
+ }
591
+ try {
592
+ this.parsedDisabledDates = this.disabledDates
593
+ .map(date => parseDate(date, this.dateFormat))
594
+ .filter(date => date !== null);
595
+ }
596
+ catch (error) {
597
+ console.error('Error parsing disabled dates:', error);
598
+ this.parsedDisabledDates = [];
599
+ }
600
+ };
601
+ /**
602
+ * Applies a shortcut selection
603
+ * @param {Object} shortcut - Shortcut to apply
604
+ * @param {string | Date} shortcut.singleValue - Selected date value
605
+ * @param {Object} shortcut.rangeValue - Start and end date values
606
+ * @param {string | Date} shortcut.rangeValue.start - Start date value
607
+ * @param {string | Date} shortcut.rangeValue.end - End date value
608
+ * @param {string} shortcut.label - Label
609
+ */
610
+ this.applyShortcut = (shortcut) => {
611
+ this.selectedDate = null;
612
+ this.startDate = null;
613
+ this.endDate = null;
614
+ if (shortcut.singleValue) {
615
+ const newDate = parseDate(shortcut.singleValue, this.dateFormat);
616
+ this.selectedDate = newDate;
617
+ this.singleDateChange.emit(formatDate(newDate, { dateFormat: this.dateFormat }));
618
+ this.singleValue = formatDate(newDate, { dateFormat: this.dateFormat });
619
+ if (!this.showActions) {
620
+ const event = new CustomEvent('closePopover', {
621
+ bubbles: true,
622
+ composed: true,
623
+ });
624
+ this.el.dispatchEvent(event);
625
+ }
626
+ this.forceCalendarUpdate(newDate);
627
+ }
628
+ else {
629
+ const start = parseDate(shortcut.rangeValue.start, this.dateFormat);
630
+ const end = parseDate(shortcut.rangeValue.end, this.dateFormat);
631
+ this.startDate = start;
632
+ this.endDate = end;
633
+ this.rangeDateChange.emit({
634
+ start: formatDate(start, { dateFormat: this.dateFormat }),
635
+ end: formatDate(end, { dateFormat: this.dateFormat }),
636
+ });
637
+ this.rangeValue = {
638
+ start: formatDate(start, { dateFormat: this.dateFormat }),
639
+ end: formatDate(end, { dateFormat: this.dateFormat }),
640
+ };
641
+ if (!this.showActions) {
642
+ const event = new CustomEvent('closePopover', {
643
+ bubbles: true,
644
+ composed: true,
645
+ });
646
+ this.el.dispatchEvent(event);
647
+ }
648
+ this.forceCalendarUpdate(end);
649
+ }
650
+ };
651
+ /**
652
+ * Method to force the complete calendar update (and fix the persistent hover problem)
653
+ * @param {Date} newDate - Date to force
654
+ */
655
+ this.forceCalendarUpdate = newDate => {
656
+ this.currentDate = new Date(newDate);
657
+ this.currentDate = new Date(this.currentDate); // Force a re-render
658
+ // Reset visually the hover/touch effect
659
+ requestAnimationFrame(() => {
660
+ const days = document.querySelectorAll('.day');
661
+ days.forEach(el => {
662
+ el.classList.remove('hover', 'active', 'touched');
663
+ el.style.pointerEvents = 'none';
664
+ });
665
+ // Add specific touch handling (for mobile)
666
+ document.body.addEventListener('touchstart', this.clearTouchState, {
667
+ passive: true,
668
+ });
669
+ // Reset the touch state after 50ms
670
+ setTimeout(() => {
671
+ days.forEach(el => {
672
+ el.style.pointerEvents = '';
673
+ });
674
+ }, 50);
675
+ });
676
+ };
677
+ /**
678
+ * Function to reset the touch effect (Mobile fix)
679
+ */
680
+ this.clearTouchState = () => {
681
+ document.querySelectorAll('.day').forEach(el => {
682
+ el.classList.remove('touched');
683
+ });
684
+ // Remove the listener after the first interaction
685
+ document.body.removeEventListener('touchstart', this.clearTouchState);
686
+ };
687
+ /**
688
+ * Handles month change with an offset
689
+ * @param {number} direction - Direction (-1 for previous, 1 for next)
690
+ * @returns {Function} Change month handler
691
+ */
692
+ this.getChangeMonthHandler = (direction) => {
693
+ return () => this.changeMonth(direction);
694
+ };
695
+ /**
696
+ * Handles month change from an event (ex: dropdown)
697
+ * @param {number} offset - Month offset (0 by default)
698
+ * @returns {Function} Change month handler
699
+ */
700
+ this.getHandleMonthChange = (offset) => {
701
+ return (event) => this.handleMonthChange(event, offset);
702
+ };
703
+ /**
704
+ * Handles year change from an event (ex: dropdown)
705
+ * @param {number} offset - Year offset (0 by default)
706
+ * @returns {Function} Change year handler
707
+ */
708
+ this.getHandleYearChange = (offset) => {
709
+ return (event) => this.handleYearChange(event, offset);
710
+ };
711
+ /**
712
+ * Handles day click
713
+ * @param {Date} date - Date to handle
714
+ * @param {boolean} isDisabled - Whether the date is disabled
715
+ * @returns {Function} Day click handler
716
+ */
717
+ this.getDayClickHandler = (date, isDisabled) => {
718
+ return isDisabled ? undefined : () => this.handleDateSelection(date);
719
+ };
720
+ /**
721
+ * Handles shortcut selection
722
+ * @param {Object} shortcut - Shortcut to handle
723
+ * @param {string | Date} shortcut.singleValue - Selected date value
724
+ * @param {Object} shortcut.rangeValue - Start and end date values
725
+ * @param {string | Date} shortcut.rangeValue.start - Start date value
726
+ * @param {string | Date} shortcut.rangeValue.end - End date value
727
+ * @param {string} shortcut.label - Label
728
+ * @returns {Function} Shortcut selection handler
729
+ */
730
+ this.getShortcutHandler = (shortcut) => {
731
+ return () => this.applyShortcut(shortcut);
732
+ };
733
+ /**
734
+ * Handles week selection
735
+ * @param {Date[]} dates - Dates to handle
736
+ * @param {number} index - Calendar index
737
+ * @returns {Function} Week selection handler
738
+ */
739
+ this.getWeekSelectionHandler = (dates, index) => {
740
+ return () => {
741
+ if (this.selectionType === 'range') {
742
+ this.handleWeekSelection(dates, index);
743
+ }
744
+ };
745
+ };
746
+ /**
747
+ * Resets the current selection
748
+ */
749
+ this.resetSelection = () => {
750
+ if (this.selectionType === 'single') {
751
+ this.selectedDate = null;
752
+ this.singleValue = null;
753
+ this.singleDateChange.emit('');
754
+ }
755
+ else {
756
+ this.startDate = null;
757
+ this.endDate = null;
758
+ this.rangeValue = null;
759
+ this.rangeDateChange.emit({ start: '', end: '' });
760
+ }
761
+ };
762
+ /**
763
+ * Confirms the current selection
764
+ */
765
+ this.confirmSelection = () => {
766
+ if (this.selectionType === 'single' && this.selectedDate) {
767
+ const dateStr = formatDate(this.selectedDate, {
768
+ dateFormat: this.dateFormat,
769
+ });
770
+ this.singleDateChange.emit(dateStr);
771
+ this.singleValue = dateStr;
772
+ const event = new CustomEvent('closePopover', {
773
+ bubbles: true,
774
+ composed: true,
775
+ });
776
+ this.el.dispatchEvent(event);
777
+ }
778
+ else if (this.selectionType === 'range' &&
779
+ this.startDate &&
780
+ this.endDate) {
781
+ this.rangeDateChange.emit({
782
+ start: formatDate(this.startDate, { dateFormat: this.dateFormat }),
783
+ end: formatDate(this.endDate, { dateFormat: this.dateFormat }),
784
+ });
785
+ this.rangeValue = {
786
+ start: formatDate(this.startDate, { dateFormat: this.dateFormat }),
787
+ end: formatDate(this.endDate, { dateFormat: this.dateFormat }),
788
+ };
789
+ const event = new CustomEvent('closePopover', {
790
+ bubbles: true,
791
+ composed: true,
792
+ });
793
+ this.el.dispatchEvent(event);
794
+ }
795
+ };
796
+ //#endregion METHODS
797
+ /****************************************************************************/
798
+ //#region RENDER
799
+ /**
800
+ * Renders the header
801
+ * @param {number} offset - Month offset
802
+ * @param {number} index - Calendar index
803
+ * @returns {JSX.Element} Header
804
+ * @description Renders the header of the calendar
805
+ */
806
+ this.renderHeader = (offset, index$1) => {
807
+ return (index.h("div", { class: "header" }, this.numberOfCalendars > 1 && index$1 === 0 && (index.h("nv-iconbutton", { class: "nav-left", emphasis: "lower", name: "chevron-left", onClick: this.getChangeMonthHandler(-1) })), index.h("div", { class: "date-controls" }, index.h("select", { class: "month-select mr-4", onChange: this.getHandleMonthChange(offset) }, this.months.map(month => (index.h("option", { key: month.value, value: month.value, selected: month.value === (this.currentDate.getUTCMonth() + offset) % 12 }, month.label)))), index.h("input", { type: "number", class: "year-input", min: "1950", max: "2100", value: this.currentDate.getUTCFullYear() +
808
+ Math.floor((this.currentDate.getUTCMonth() + offset) / 12), onChange: this.getHandleYearChange(offset) })), this.numberOfCalendars === 1 && (index.h("div", { class: "nav-buttons" }, index.h("nv-iconbutton", { emphasis: "lower", name: "chevron-left", onClick: this.getChangeMonthHandler(-1) }), index.h("nv-iconbutton", { emphasis: "lower", name: "chevron-right", onClick: this.getChangeMonthHandler(1) }))), this.numberOfCalendars > 1 && index$1 === this.numberOfCalendars - 1 && (index.h("nv-iconbutton", { emphasis: "lower", name: "chevron-right", onClick: this.getChangeMonthHandler(1), class: "nav-right" }))));
809
+ };
810
+ /**
811
+ * Renders the week numbers
812
+ * @param {Array<{date: Date}>} weeks - Weeks to render
813
+ * @param {number} index - Calendar index
814
+ * @returns {JSX.Element} Week numbers
815
+ * @description Renders the week numbers of the calendar
816
+ */
817
+ this.renderWeekNumbers = (
818
+ /** Weeks to render */
819
+ weeks,
820
+ /** Calendar index */
821
+ index$1) => {
822
+ return (index.h("div", { class: "week-numbers" }, index.h("div", { class: "week-header" }, this.getLocalizedWeekText()), weeks.map((week, weekIndex) => {
823
+ var _a;
824
+ const dates = week.map(d => d.date);
825
+ return (index.h("div", { class: `week-number ${this.selectionType === 'range' ? 'clickable' : ''}`, onClick: this.getWeekSelectionHandler(dates, index$1), key: `week-${weekIndex}` }, getWeekNumber(((_a = week.find(d => d.date)) === null || _a === void 0 ? void 0 : _a.date) || new Date())));
826
+ })));
827
+ };
828
+ this.renderDaysGrid = (
829
+ /** Days to render */
830
+ days) => {
831
+ return (index.h("div", { class: "days-grid" }, days.map(day => {
832
+ const date = day.date;
833
+ if (!date)
834
+ return null;
835
+ const isSelected = this.selectionType === 'single' &&
836
+ isSameDate(date, this.selectedDate, { isUTCMode: this.isUTCMode });
837
+ const isInRange = this.isDateInRange(date);
838
+ const isStart = isSameDate(date, this.startDate, {
839
+ isUTCMode: this.isUTCMode,
840
+ });
841
+ const isEnd = isSameDate(date, this.endDate, {
842
+ isUTCMode: this.isUTCMode,
843
+ });
844
+ const isToday = this.isToday(date);
845
+ const isOutsideMonth = !day.isCurrentMonth;
846
+ const dayClasses = [
847
+ 'day',
848
+ isSelected ? 'selected' : '',
849
+ isStart ? 'range-start' : '',
850
+ isEnd ? 'range-end' : '',
851
+ isInRange ? 'in-range' : '',
852
+ day.isDisabled ? 'disabled' : '',
853
+ isOutsideMonth ? 'outside-month' : '',
854
+ isToday ? 'is-today' : '',
855
+ ];
856
+ return (index.h("div", { class: dayClasses.filter(Boolean).join(' '), onClick: this.getDayClickHandler(date, day.isDisabled), "aria-disabled": day.isDisabled, key: `day-${date.toISOString()}` }, day.dayOfMonth));
857
+ })));
858
+ };
859
+ /**
860
+ * Renders the calendar
861
+ * @param {number} index - Calendar index
862
+ * @param {number} offset - Month offset
863
+ * @returns {JSX.Element} Calendar
864
+ * @description Renders the calendar of the calendar
865
+ */
866
+ this.renderCalendar = (
867
+ /** Calendar index */
868
+ index$1,
869
+ /** Month offset */
870
+ offset) => {
871
+ const days = this.getDaysInMonth(offset, this.numberOfCalendars);
872
+ const weeks = [];
873
+ for (let i = 0; i < days.length; i += 7) {
874
+ weeks.push(days.slice(i, i + 7));
875
+ }
876
+ return (index.h("div", { class: "calendar-wrapper" }, index.h("div", { class: "calendar-container", key: `calendar-${index$1}` }, this.renderHeader(offset, index$1), index.h("div", { class: "calendar-grid" }, this.showWeekNumbers && this.renderWeekNumbers(weeks, index$1), index.h("div", { class: "days-container" }, index.h("div", { class: "days-header" }, this.getDayNames().map(day => (index.h("div", { class: "day-header" }, day)))), this.renderDaysGrid(days)))), index$1 < this.numberOfCalendars - 1 && (index.h("div", { class: "calendar-separator" }))));
877
+ };
878
+ /**
879
+ * Renders the shortcuts
880
+ * @returns {JSX.Element} Shortcuts
881
+ * @description Renders the shortcuts of the calendar
882
+ */
883
+ this.renderShortcuts = () => {
884
+ if (!this.hasShortcuts) {
885
+ return null;
886
+ }
887
+ return (index.h("div", { class: `shortcuts-container shortcuts-placement-${this.shortcutsPlacement}` }, this.shortcuts.map(shortcut => (index.h("nv-button", { emphasis: "lower", size: "xs", "aria-label": shortcut.label, onClick: this.getShortcutHandler(shortcut) }, shortcut.label)))));
888
+ };
889
+ /**
890
+ * Renders the actions
891
+ * @returns {JSX.Element} Actions
892
+ * @description Renders the actions of the calendar
893
+ * @slot actions - Child content of the component.
894
+ */
895
+ this.renderActions = () => {
896
+ return (index.h("div", { class: "datepicker-actions" }, index.h("slot", { name: "actions" }, index.h("nv-button", { emphasis: "low", size: "xs", onClick: this.resetSelection }, "Cancel"), index.h("nv-button", { size: "xs", onClick: this.confirmSelection }, "OK"))));
897
+ };
898
+ }
899
+ //#endregion EVENTS
900
+ /****************************************************************************/
901
+ //#region WATCHERS
902
+ /**
903
+ * Watches the changes of the number of calendars
904
+ * @param {number} newValue - New number of calendars
905
+ */
906
+ validateNumberOfCalendars(newValue) {
907
+ if (newValue < 1 || newValue > 4) {
908
+ console.warn('numberOfCalendars must be between 1 and 4. Defaulting to 1.');
909
+ this.numberOfCalendars = 1;
910
+ }
911
+ }
912
+ /**
913
+ * Watches the changes of the selected date range
914
+ * @param {Object} newValue - New rangeValue value
915
+ * @param {string} newValue.start - Start date
916
+ * @param {string} newValue.end - End date
917
+ */
918
+ onRangeValueChange(newValue) {
919
+ if (newValue && newValue.start && newValue.end) {
920
+ try {
921
+ const { startDate, endDate } = this.validateDateRange(newValue.start, newValue.end);
922
+ this.startDate = startDate;
923
+ this.endDate = endDate;
924
+ this.currentDate = startDate;
925
+ }
926
+ catch (error) {
927
+ console.error('Invalid rangeValue:', error);
928
+ }
929
+ }
930
+ }
931
+ /**
932
+ * Watches the changes of the disabled dates
933
+ * @description Watches the changes of the disabled dates
934
+ */
935
+ handleDisabledDatesChange() {
936
+ this.parseDisabledDates();
937
+ }
938
+ /**
939
+ * Watches the changes of the single value
940
+ * @param {string} newValue - New single value
941
+ * @param {string} oldValue - Old single value
942
+ */
943
+ onSingleValueChange(newValue, oldValue) {
944
+ if (this.selectionType === 'single' && newValue !== oldValue && newValue) {
945
+ const parsedDate = parseDate(newValue, this.dateFormat);
946
+ if (parsedDate) {
947
+ this.selectedDate = parsedDate;
948
+ this.currentDate = parsedDate;
949
+ }
950
+ }
951
+ }
952
+ //#endregion WATCHERS
953
+ /****************************************************************************/
954
+ //#region LIFECYCLE
955
+ componentWillLoad() {
956
+ this.parseDisabledDates();
957
+ if (this.selectionType === 'single' && this.singleValue) {
958
+ this.selectedDate = parseDate(this.singleValue, this.dateFormat);
959
+ this.currentDate = this.selectedDate;
960
+ }
961
+ else if (this.selectionType === 'range' && this.rangeValue) {
962
+ try {
963
+ if (this.rangeValue.start && this.rangeValue.end) {
964
+ const { startDate, endDate, swapped } = this.validateDateRange(this.rangeValue.start, this.rangeValue.end);
965
+ this.startDate = startDate;
966
+ this.endDate = endDate;
967
+ this.currentDate = startDate;
968
+ if (swapped) {
969
+ // If dates were swapped, update the rangeValue property
970
+ this.rangeValue = {
971
+ start: formatDate(startDate, { dateFormat: this.dateFormat }),
972
+ end: formatDate(endDate, { dateFormat: this.dateFormat }),
973
+ };
974
+ }
975
+ }
976
+ }
977
+ catch (error) {
978
+ console.error('Invalid rangeValue:', error);
979
+ }
980
+ }
981
+ else {
982
+ this.currentDate = new Date();
983
+ }
984
+ this.initializeMonths();
985
+ }
986
+ //#endregion LIFECYCLE
987
+ /****************************************************************************/
988
+ //#region METHODS
989
+ /**
990
+ * Checks if shortcuts are visible
991
+ * @returns {boolean} true if shortcuts are visible
992
+ */
993
+ get hasShortcuts() {
994
+ return Boolean(this.shortcutsPlacement && this.shortcuts);
995
+ }
996
+ /**
997
+ * Checks if actions are visible
998
+ * @returns {boolean} true if actions are visible
999
+ */
1000
+ get hasActions() {
1001
+ return this.showActions;
1002
+ }
1003
+ /**
1004
+ * Checks if the date format is in UTC mode
1005
+ * @returns {boolean} true if the date format is in UTC mode
1006
+ */
1007
+ get isUTCMode() {
1008
+ return this.dateFormat.includes('Z');
1009
+ }
1010
+ /**
1011
+ * Validates and processes a date range, warning if start is after end
1012
+ * @param {string} startDateStr - Start date in ISO string format
1013
+ * @param {string} endDateStr - End date in ISO string format
1014
+ * @returns {object} Object containing the validated start and end dates
1015
+ */
1016
+ validateDateRange(startDateStr, endDateStr) {
1017
+ try {
1018
+ const startDate = parseDate(startDateStr, this.dateFormat);
1019
+ const endDate = parseDate(endDateStr, this.dateFormat);
1020
+ if (startDate && endDate && startDate > endDate) {
1021
+ console.warn(`Warning: startDate (${formatDate(startDate, {
1022
+ dateFormat: this.dateFormat,
1023
+ })}) is after endDate (${formatDate(endDate, {
1024
+ dateFormat: this.dateFormat,
1025
+ })})`);
1026
+ // Return dates in correct order, with swapped flag
1027
+ return {
1028
+ startDate: endDate,
1029
+ endDate: startDate,
1030
+ swapped: true,
1031
+ };
1032
+ }
1033
+ return {
1034
+ startDate,
1035
+ endDate,
1036
+ swapped: false,
1037
+ };
1038
+ }
1039
+ catch (error) {
1040
+ console.error('Invalid date range:', error);
1041
+ throw error; // Re-throw to let the caller handle it
1042
+ }
1043
+ }
1044
+ /**
1045
+ * Renders the datepicker
1046
+ * @returns {JSX.Element} Datepicker
1047
+ * @description Renders the datepicker of the calendar
1048
+ * @slot default - Child content of the component.
1049
+ */
1050
+ render() {
1051
+ return (index.h(index.Host, { key: 'd265f105851253b5aa2a40e055f8e51b5cb6b553' }, index.h("div", { key: 'c6e1ea923b17f7684243598109e4cffc767248d7', class: "datepicker-root" }, index.h("div", { key: '5fc4cfbf3f6d823c500408d0f81f5f15d3e654d7', class: `datepicker-container ${this.numberOfCalendars === 1 ? 'datepicker-container-single' : ''}` }, index.h("div", { key: '035dac25c8b8090e1a3a0ac2493865907f665da9', class: `datepicker-wrapper ${this.numberOfCalendars === 1 ? 'single' : ''}` }, this.shortcutsPlacement === 'left' && this.renderShortcuts(), Array.from({ length: this.numberOfCalendars }, (_, index) => this.renderCalendar(index, index)), this.shortcutsPlacement === 'right' && this.renderShortcuts()), ((this.hasShortcuts && this.shortcutsPlacement === 'bottom') ||
1052
+ this.hasActions) && (index.h("div", { key: '91c21c945ab53acda631a8c50fb1437665fce030', class: "datepicker-controls" }, this.shortcutsPlacement === 'bottom' && this.renderShortcuts(), this.hasActions && this.renderActions())))), index.h("slot", { key: '3799c412c842e406715c235d3288022c2a734ed2' })));
1053
+ }
1054
+ get el() { return index.getElement(this); }
1055
+ static get watchers() { return {
1056
+ "numberOfCalendars": ["validateNumberOfCalendars"],
1057
+ "rangeValue": ["onRangeValueChange"],
1058
+ "disabledDates": ["handleDisabledDatesChange"],
1059
+ "singleValue": ["onSingleValueChange"]
1060
+ }; }
1061
+ };
1062
+ NvCalendar.style = NvCalendarStyle0;
1063
+
1064
+ exports.nv_calendar = NvCalendar;