@nova-design-system/nova-react 3.0.0-beta.47 → 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
@@ -1,1065 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('./index-Byv3Vmev.js');
4
- var _commonjsHelpers1789f0cf = require('./_commonjsHelpers-1789f0cf-BJu3ubxk.js');
5
- var constants98e2dcc2 = require('./constants-98e2dcc2-C0SBCapP.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
- 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.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)}}";
41
- const NvCalendarStyle0 = nvCalendarCss;
42
-
43
- // Extend dayjs with plugins
44
- dayjs.extend(customParseFormat);
45
- dayjs.extend(utc);
46
- dayjs.extend(weekOfYear);
47
- const NvCalendar = class {
48
- constructor(hostRef) {
49
- index.registerInstance(this, hostRef);
50
- this.singleDateChange = index.createEvent(this, "singleDateChange");
51
- this.rangeDateChange = index.createEvent(this, "rangeDateChange");
52
- /****************************************************************************/
53
- //#region PROPERTIES
54
- /**
55
- * First day of the week (0 = Sunday, 1 = Monday, etc.)
56
- * @default 0
57
- */
58
- this.firstDayOfWeek = 0;
59
- /**
60
- * Number of calendars to display
61
- * @default 1
62
- */
63
- this.numberOfCalendars = 1;
64
- /**
65
- * Selected date (ISO string format)
66
- * ex: "2025-03-15"
67
- */
68
- this.singleValue = '';
69
- /**
70
- * Selected date range
71
- * format: { start: ISO string, end: ISO string }
72
- * ex: { start: "2025-03-15", end: "2025-03-20" }
73
- */
74
- this.rangeValue = '';
75
- /**
76
- * Minimum date for selection (ISO string format, ex: "2025-01-01")
77
- */
78
- this.min = '';
79
- /**
80
- * Maximum date for selection (ISO string format, ex: "2025-12-31")
81
- */
82
- this.max = '';
83
- /** Disabled dates (ISO string array)
84
- * @default '[]'
85
- */
86
- this.disabledDates = '';
87
- /** Locale for date formatting
88
- * @default 'en-BE'
89
- */
90
- this.locale = 'en-BE';
91
- /** Date format (ex: 'YYYY-MM-DD', 'DD-MM-YYYY', etc.)
92
- * @default 'YYYY-MM-DD'
93
- * @note If the date format is in UTC mode, the date will be displayed in UTC time.
94
- * @note If the date format is not in UTC mode, the date will be displayed in the local time.
95
- */
96
- this.dateFormat = 'YYYY-MM-DD';
97
- /**
98
- * Footer placement
99
- * @default 'bottom'
100
- */
101
- this.shortcutsPlacement = 'bottom';
102
- /**
103
- * Selection type (single date or date range)
104
- * @default 'single'
105
- */
106
- this.selectionType = 'single';
107
- /**
108
- * Show action buttons
109
- * @default false
110
- */
111
- this.showActions = false;
112
- /**
113
- * Custom actions to display in the footer
114
- * JSON array of objects with the following properties:
115
- * - label: string
116
- * - onClick: function
117
- * @default '[]'
118
- */
119
- this.shortcuts = '[]';
120
- /** Cache for parsed disabled dates */
121
- this.parsedDisabledDates = [];
122
- /** Selected date */
123
- this.selectedDate = null;
124
- /** Start date */
125
- this.startDate = null;
126
- /** End date */
127
- this.endDate = null;
128
- /** List of formatted months for the selector */
129
- this.months = [];
130
- /**
131
- * Resets the current selection
132
- */
133
- this.resetSelection = () => {
134
- if (this.selectionType === 'single') {
135
- this.selectedDate = null;
136
- this.singleValue = '';
137
- this.singleDateChange.emit('');
138
- }
139
- else {
140
- this.startDate = null;
141
- this.endDate = null;
142
- this.rangeValue = '';
143
- this.rangeDateChange.emit({ start: '', end: '' });
144
- }
145
- };
146
- /**
147
- * Confirms the current selection
148
- */
149
- this.confirmSelection = () => {
150
- if (this.selectionType === 'single' && this.selectedDate) {
151
- const dateStr = this.formatDate(this.selectedDate);
152
- this.singleDateChange.emit(dateStr);
153
- this.singleValue = dateStr;
154
- const event = new CustomEvent('closePopover', {
155
- bubbles: true,
156
- composed: true,
157
- });
158
- this.el.dispatchEvent(event);
159
- }
160
- else if (this.selectionType === 'range' &&
161
- this.startDate &&
162
- this.endDate) {
163
- this.rangeDateChange.emit({
164
- start: this.formatDate(this.startDate),
165
- end: this.formatDate(this.endDate),
166
- });
167
- this.rangeValue = JSON.stringify({
168
- start: this.formatDate(this.startDate),
169
- end: this.formatDate(this.endDate),
170
- });
171
- const event = new CustomEvent('closePopover', {
172
- bubbles: true,
173
- composed: true,
174
- });
175
- this.el.dispatchEvent(event);
176
- }
177
- };
178
- }
179
- //#endregion EVENTS
180
- /****************************************************************************/
181
- //#region LIFECYCLE
182
- componentWillLoad() {
183
- this.parseDisabledDates();
184
- if (this.selectionType === 'single' && this.singleValue) {
185
- this.selectedDate = this.parseDate(this.singleValue);
186
- this.currentDate = this.selectedDate;
187
- }
188
- else if (this.selectionType === 'range' && this.rangeValue) {
189
- try {
190
- let parsed;
191
- if (typeof this.rangeValue === 'string') {
192
- parsed = JSON.parse(this.rangeValue);
193
- }
194
- else {
195
- parsed = this.rangeValue;
196
- }
197
- if (parsed.start && parsed.end) {
198
- this.startDate = this.parseDate(parsed.start);
199
- this.endDate = this.parseDate(parsed.end);
200
- this.currentDate = this.startDate;
201
- if (this.startDate && this.endDate && this.startDate > this.endDate) {
202
- console.warn(`Warning: startDate (${this.formatDate(this.startDate)}) is after endDate (${this.formatDate(this.endDate)})`);
203
- // [this.startDate, this.endDate] = [this.endDate, this.startDate];
204
- throw new Error('startDate cannot be after endDate');
205
- }
206
- }
207
- }
208
- catch (error) {
209
- console.error('Invalid JSON for rangeValue:', error);
210
- }
211
- }
212
- else {
213
- this.currentDate = new Date();
214
- }
215
- this.initializeMonths();
216
- }
217
- // componentDidLoad() {
218
- // if (this.rangeValue) {
219
- // this.onRangeValueChange(this.rangeValue);
220
- // }
221
- // }
222
- //#endregion LIFECYCLE
223
- /****************************************************************************/
224
- //#region METHODS
225
- /**
226
- * Change the displayed month
227
- * @param {number} offset - Month offset (-1 for previous, 1 for next)
228
- */
229
- changeMonth(offset) {
230
- const newDate = new Date(this.currentDate);
231
- // Ensure we only move by one month at a time
232
- newDate.setUTCMonth(newDate.getUTCMonth() + offset);
233
- // Add the appropriate animation class
234
- const containers = this.el.querySelectorAll('.calendar-grid');
235
- containers.forEach(container => {
236
- // Remove existing animation classes
237
- container.classList.remove('slide-left', 'slide-right');
238
- // Add the new animation class
239
- const animationClass = offset > 0 ? 'slide-left' : 'slide-right';
240
- container.classList.add(animationClass);
241
- // Remove the class after the animation
242
- setTimeout(() => {
243
- container.classList.remove(animationClass);
244
- }, 300); // 300ms corresponds to $slide-duration in the SCSS
245
- });
246
- this.currentDate = newDate;
247
- }
248
- /**
249
- * Handles date selection based on the mode
250
- * @param {Date} date - Selected date
251
- */
252
- handleDateSelection(date) {
253
- if (this.isDateDisabled(date)) {
254
- return;
255
- }
256
- if (this.selectionType === 'single') {
257
- this.handleSingleSelection(date);
258
- }
259
- else {
260
- this.handleRangeSelection(date);
261
- }
262
- }
263
- /**
264
- * Handles single date selection
265
- * @param {Date} date - Selected date
266
- */
267
- handleSingleSelection(date) {
268
- if (!date)
269
- return;
270
- const formattedDate = this.formatDate(date);
271
- this.selectedDate = date;
272
- this.singleDateChange.emit(formattedDate);
273
- }
274
- /**
275
- * Handles range date selection
276
- * @param {Date} date - Selected date
277
- */
278
- handleRangeSelection(date) {
279
- if (!this.startDate || (this.startDate && this.endDate)) {
280
- this.startDate = date;
281
- this.endDate = null;
282
- }
283
- else {
284
- this.endDate = date;
285
- if (this.startDate > this.endDate) {
286
- [this.startDate, this.endDate] = [this.endDate, this.startDate];
287
- }
288
- this.rangeDateChange.emit({
289
- start: this.formatDate(this.startDate),
290
- end: this.formatDate(this.endDate),
291
- });
292
- }
293
- }
294
- /**
295
- * Calculates the ISO week number
296
- * @param {Date} date - Date to calculate
297
- * @returns {number} Week number
298
- */
299
- getWeekNumber(date) {
300
- const startOfYear = new Date(date.getFullYear(), 0, 1);
301
- const pastDaysOfYear = (date.getTime() - startOfYear.getTime()) / 86400000;
302
- return Math.ceil((pastDaysOfYear + startOfYear.getDay() + 1) / 7);
303
- }
304
- /**
305
- * Checks if a date is disabled.
306
- * Disabled if:
307
- * - The date is before min (if defined)
308
- * - The date is after max (if defined)
309
- * - The date is in the disabledDates array
310
- * @param {Date} date - Date to check
311
- * @returns {boolean} true if the date is disabled
312
- */
313
- isDateDisabled(date) {
314
- if (!date)
315
- return true;
316
- // Minimum bound check
317
- if (this.min) {
318
- const minDate = this.parseDate(this.min);
319
- if (minDate && date < minDate) {
320
- return true;
321
- }
322
- }
323
- // Maximum bound check
324
- if (this.max) {
325
- const maxDate = this.parseDate(this.max);
326
- if (maxDate && date > maxDate) {
327
- return true;
328
- }
329
- }
330
- // Check disabled dates
331
- return this.parsedDisabledDates.some(disabledDate => this.isSameDate(date, disabledDate));
332
- }
333
- /**
334
- * Checks if a date is in the selected range
335
- * @param {Date} date - Date to check
336
- * @returns {boolean} true if the date is in the range
337
- */
338
- isDateInRange(date) {
339
- if (!date || !this.startDate || !this.endDate)
340
- return false;
341
- const checkDate = this.parseDate(date);
342
- const startDate = this.parseDate(this.startDate);
343
- const endDate = this.parseDate(this.endDate);
344
- // Verify if startDate and endDate are valid
345
- if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
346
- return false;
347
- }
348
- // Verify that startDate is before endDate (additional security)
349
- if (startDate > endDate)
350
- return false;
351
- // Comparison based only on the date (year, month, day)
352
- return (this.isSameOrAfter(checkDate, startDate) &&
353
- this.isSameOrBefore(checkDate, endDate));
354
- }
355
- /**
356
- * Retrieves the localized day names
357
- * @returns {string[]} Array of short day names
358
- */
359
- getDayNames() {
360
- // If we have custom day names for this locale
361
- if (constants98e2dcc2.CUSTOM_DAY_NAMES[this.locale]) {
362
- const days = [...constants98e2dcc2.CUSTOM_DAY_NAMES[this.locale]];
363
- // Reorganize the days based on the first day of the week
364
- const firstDays = days.slice(0, this.firstDayOfWeek);
365
- const remainingDays = days.slice(this.firstDayOfWeek);
366
- return [...remainingDays, ...firstDays];
367
- }
368
- // Otherwise, use the default behavior
369
- const formatter = new Intl.DateTimeFormat(this.locale, {
370
- weekday: 'short',
371
- });
372
- const days = [...Array(7)].map((_, i) => formatter.format(new Date(2023, 0, i + 1)).toUpperCase());
373
- // Reorganize the days based on the first day of the week
374
- const firstDays = days.slice(0, this.firstDayOfWeek);
375
- const remainingDays = days.slice(this.firstDayOfWeek);
376
- return [...remainingDays, ...firstDays];
377
- }
378
- /**
379
- * Generates the days of the current month
380
- * @param {number} offset - Month offset (0 by default)
381
- * @param {number} totalCalendars - Number of calendars to display (1 by default)
382
- * @returns {Array<{ dayOfMonth: number | null, date: Date | null, isSelected: boolean, isDisabled: boolean }>} Array of formatted days
383
- */
384
- getDaysInMonth(offset = 0, totalCalendars = 1) {
385
- const year = this.currentDate.getUTCFullYear();
386
- const month = this.currentDate.getUTCMonth() + offset;
387
- const firstDay = new Date(Date.UTC(year, month, 1));
388
- const lastDay = new Date(Date.UTC(year, month + 1, 0));
389
- const days = [];
390
- // Correct calculation of offset for previous month days
391
- // Use getUTCDay to stay consistent with UTC timezone
392
- const dayOfWeekIndex = firstDay.getUTCDay(); // 0 = Sunday, 1 = Monday, etc.
393
- // Adjust based on firstDayOfWeek (if week starts on Monday, offset is different)
394
- const offsetDays = (dayOfWeekIndex - this.firstDayOfWeek + 7) % 7;
395
- // Add the days of the previous month for the first calendar
396
- if (offset === 0 && offsetDays > 0) {
397
- const prevMonthLastDay = new Date(Date.UTC(year, month, 0)).getUTCDate();
398
- for (let i = offsetDays; i > 0; i--) {
399
- const date = new Date(Date.UTC(year, month - 1, prevMonthLastDay - i + 1));
400
- days.push({
401
- dayOfMonth: date.getUTCDate(),
402
- date,
403
- isCurrentMonth: false,
404
- isDisabled: this.isDateDisabled(date),
405
- });
406
- }
407
- }
408
- // Add the days of the current month
409
- for (let i = 1; i <= lastDay.getUTCDate(); i++) {
410
- const date = new Date(Date.UTC(year, month, i));
411
- days.push({
412
- dayOfMonth: i,
413
- date,
414
- isCurrentMonth: true,
415
- isDisabled: this.isDateDisabled(date),
416
- });
417
- }
418
- // Add the days of the next month only for the last calendar
419
- if (offset === totalCalendars - 1) {
420
- const nextMonthDaysNeeded = 7 - (days.length % 7 || 7);
421
- for (let i = 1; i <= nextMonthDaysNeeded; i++) {
422
- const date = new Date(Date.UTC(year, month + 1, i));
423
- days.push({
424
- dayOfMonth: i,
425
- date,
426
- isCurrentMonth: false,
427
- isDisabled: this.isDateDisabled(date),
428
- });
429
- }
430
- }
431
- return days;
432
- }
433
- /** Initializes the list of formatted months according to the locale */
434
- initializeMonths() {
435
- // If we have custom month names for this locale
436
- if (constants98e2dcc2.CUSTOM_MONTH_NAMES[this.locale]) {
437
- this.months = constants98e2dcc2.CUSTOM_MONTH_NAMES[this.locale].map((label, value) => ({
438
- value,
439
- label,
440
- }));
441
- return;
442
- }
443
- // Otherwise, use the default behavior
444
- const formatter = new Intl.DateTimeFormat(this.locale, { month: 'short' });
445
- this.months = Array.from({ length: 12 }, (_, i) => ({
446
- value: i,
447
- label: formatter.format(new Date(2000, i, 1)).toUpperCase(),
448
- }));
449
- }
450
- /**
451
- * Retrieves the localized abbreviation for "week"
452
- * @returns {string} Localized abbreviation for "week"
453
- */
454
- getLocalizedWeekText() {
455
- return constants98e2dcc2.WEEK_ABBREVIATIONS[this.locale] || 'W';
456
- }
457
- /**
458
- * Handles month change in the selector
459
- * @param {Event} event - Month change event
460
- * @param {number} calendarOffset - Calendar offset (0 by default)
461
- */
462
- handleMonthChange(event, calendarOffset = 0) {
463
- const select = event.target;
464
- const selectedMonth = parseInt(select.value, 10);
465
- const currentMonth = this.currentDate.getUTCMonth();
466
- // Calculate the difference considering the calendar offset
467
- const monthDiff = selectedMonth - ((currentMonth + calendarOffset) % 12);
468
- const newDate = new Date(this.currentDate);
469
- newDate.setUTCMonth(newDate.getUTCMonth() + monthDiff);
470
- this.currentDate = newDate;
471
- }
472
- /**
473
- * Handles year change in the numeric entry
474
- * @param {Event} event - Year change event
475
- * @param {number} calendarOffset - Calendar offset (0 by default)
476
- */
477
- handleYearChange(event, calendarOffset = 0) {
478
- const input = event.target;
479
- const year = parseInt(input.value, 10);
480
- if (!isNaN(year) && year >= 1900 && year <= 2100) {
481
- const newDate = new Date(this.currentDate);
482
- newDate.setUTCFullYear(year);
483
- newDate.setUTCMonth(newDate.getUTCMonth() + calendarOffset);
484
- this.currentDate = newDate;
485
- }
486
- }
487
- /**
488
- * Handles week selection
489
- * @param {Date[]} weekDays - Selected week days
490
- * @param {number} calendarIndex - Calendar index from which the selection is made
491
- */
492
- handleWeekSelection(weekDays, calendarIndex) {
493
- if (this.selectionType !== 'range')
494
- return;
495
- const allDays = this.getDaysInMonth(calendarIndex, this.numberOfCalendars);
496
- const weekStart = weekDays[0];
497
- const weekEnd = weekDays[weekDays.length - 1];
498
- if (!weekStart || !weekEnd)
499
- return;
500
- const selectedWeekDays = allDays.filter(day => day.date && day.date >= weekStart && day.date <= weekEnd);
501
- const validDays = selectedWeekDays.filter(day => !this.isDateDisabled(day.date));
502
- if (validDays.length > 0) {
503
- this.startDate = validDays[0].date;
504
- this.endDate = validDays[validDays.length - 1].date;
505
- this.rangeDateChange.emit({
506
- start: this.formatDate(this.startDate),
507
- end: this.formatDate(this.endDate),
508
- });
509
- }
510
- }
511
- /**
512
- * Checks if a date corresponds to today
513
- * @param {Date} date - Date to check
514
- * @returns {boolean} true if the date is today
515
- */
516
- isToday(date) {
517
- const today = new Date();
518
- return (date.getDate() === today.getDate() &&
519
- date.getMonth() === today.getMonth() &&
520
- date.getFullYear() === today.getFullYear());
521
- }
522
- /**
523
- * Watches the changes of the number of calendars
524
- * @watch numberOfCalendars
525
- * @param {number} newValue - New number of calendars
526
- */
527
- validateNumberOfCalendars(newValue) {
528
- if (newValue < 1 || newValue > 4) {
529
- console.warn('numberOfCalendars must be between 1 and 4. Defaulting to 1.');
530
- this.numberOfCalendars = 1;
531
- }
532
- }
533
- /**
534
- * Watches the changes of the selected date range
535
- * @watch rangeValue
536
- * @param {Object} newValue - New rangeValue value
537
- * @param {string} newValue.start - Start date
538
- * @param {string} newValue.end - End date
539
- */
540
- onRangeValueChange(newValue) {
541
- if (newValue) {
542
- try {
543
- const parsed = JSON.parse(newValue);
544
- if (parsed.start && parsed.end) {
545
- this.startDate = this.parseDate(parsed.start);
546
- this.endDate = this.parseDate(parsed.end);
547
- this.currentDate = this.parseDate(parsed.start);
548
- }
549
- }
550
- catch (error) {
551
- console.error('Invalid JSON for rangeValue:', error);
552
- }
553
- }
554
- }
555
- /**
556
- * Watches the changes of the disabled dates
557
- * @watch disabledDates
558
- * @description Watches the changes of the disabled dates
559
- */
560
- handleDisabledDatesChange() {
561
- this.parseDisabledDates();
562
- }
563
- /**
564
- * Watches the changes of the single value
565
- * @watch singleValue
566
- * @param {string} newValue - New single value
567
- * @param {string} oldValue - Old single value
568
- */
569
- onSingleValueChange(newValue, oldValue) {
570
- if (this.selectionType === 'single' && newValue !== oldValue && newValue) {
571
- const parsedDate = this.parseDate(newValue);
572
- if (parsedDate) {
573
- this.selectedDate = parsedDate;
574
- this.currentDate = parsedDate;
575
- }
576
- }
577
- }
578
- /**
579
- * Convert a date string/Date to a Date without timezone offset
580
- * @param {string | Date} dateInput - Date under string or Date object form
581
- * @returns {Date} Date in Date form without timezone offset
582
- */
583
- parseDate(dateInput) {
584
- if (dateInput instanceof Date)
585
- return dateInput;
586
- // Attempt to automatically detect ISO 8601 format (generated by toISOString())
587
- // The regex checks the standard ISO format: YYYY-MM-DDTHH:mm:ss.sssZ
588
- if (typeof dateInput === 'string' &&
589
- /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/.test(dateInput)) {
590
- try {
591
- const parsedDate = new Date(dateInput);
592
- if (!isNaN(parsedDate.getTime())) {
593
- return parsedDate;
594
- }
595
- }
596
- catch (error) {
597
- // If it fails, continue with other methods
598
- console.error('Error parsing ISO date:', error);
599
- }
600
- }
601
- // Handling Unix Seconds ("X") formats
602
- if (this.dateFormat === 'X') {
603
- const unixSeconds = Number(dateInput);
604
- if (isNaN(unixSeconds))
605
- return null;
606
- return this.isUTCMode
607
- ? dayjs.unix(unixSeconds).utc().toDate()
608
- : dayjs.unix(unixSeconds).toDate();
609
- }
610
- // Handling Unix Milliseconds ("x") formats
611
- if (this.dateFormat === 'x') {
612
- const unixMilliseconds = Number(dateInput);
613
- if (isNaN(unixMilliseconds))
614
- return null;
615
- return this.isUTCMode
616
- ? dayjs(unixMilliseconds).utc().toDate()
617
- : dayjs(unixMilliseconds).toDate();
618
- }
619
- // Handling C# Ticks format
620
- if (this.dateFormat === 'Ticks') {
621
- const ticks = Number(dateInput);
622
- if (isNaN(ticks))
623
- return null;
624
- // Conversion of .NET ticks to milliseconds since Unix epoch
625
- const unixMilliseconds = (ticks - 621355968000000000) / 10000;
626
- return this.isUTCMode
627
- ? dayjs(unixMilliseconds).utc().toDate()
628
- : dayjs(unixMilliseconds).toDate();
629
- }
630
- // For all other formats, use customParseFormat in strict mode
631
- let parsed;
632
- if (this.isUTCMode) {
633
- parsed = dayjs.utc(dateInput, this.dateFormat, true);
634
- }
635
- else {
636
- parsed = dayjs(dateInput, this.dateFormat, true);
637
- }
638
- if (!parsed.isValid()) {
639
- console.error(`Parsing error:`, {
640
- dateInput,
641
- dateFormat: this.dateFormat,
642
- });
643
- return null;
644
- }
645
- return parsed.toDate();
646
- }
647
- /**
648
- * Checks if the date format is in UTC mode
649
- * @returns {boolean} true if the date format is in UTC mode
650
- */
651
- get isUTCMode() {
652
- return this.dateFormat.includes('Z');
653
- }
654
- /**
655
- * Checks if the date format is ISO 8601
656
- * @returns {boolean} true if the format is ISO 8601
657
- */
658
- get isISO8601Format() {
659
- return this.dateFormat === 'YYYY-MM-DD[T]HH:mm:ss[Z]';
660
- }
661
- /**
662
- * Formats a date to a string according to the format
663
- * @param {Date} date - Date to format
664
- * @returns {string} Formatted date
665
- */
666
- formatDate(date) {
667
- if (!date)
668
- return '';
669
- // Special case for ISO 8601
670
- if (this.isISO8601Format) {
671
- // For the ISO 8601 format, use directly toISOString() which is standard
672
- return date.toISOString();
673
- }
674
- // If the format is "Ticks", convert the time to C# ticks
675
- if (this.dateFormat === 'Ticks') {
676
- const ticks = date.getTime() * 10000 + 621355968000000000;
677
- return ticks.toString();
678
- }
679
- // If the format is "X" (Unix Seconds)
680
- if (this.dateFormat === 'X') {
681
- return dayjs(date).unix().toString();
682
- }
683
- // If the format is "x" (Unix Milliseconds)
684
- if (this.dateFormat === 'x') {
685
- return date.getTime().toString();
686
- }
687
- // Otherwise, format according to the mode (UTC or local)
688
- return this.isUTCMode
689
- ? dayjs(date).utc().format(this.dateFormat)
690
- : dayjs(date).format(this.dateFormat);
691
- }
692
- /**
693
- * Parse and cache the disabled dates
694
- * @description Parse and cache the disabled dates
695
- */
696
- parseDisabledDates() {
697
- if (!this.disabledDates) {
698
- this.parsedDisabledDates = [];
699
- return;
700
- }
701
- try {
702
- const disabledDatesArray = JSON.parse(this.disabledDates);
703
- this.parsedDisabledDates = disabledDatesArray
704
- .map(date => this.parseDate(date))
705
- .filter(date => date !== null);
706
- }
707
- catch (error) {
708
- console.error('Error parsing disabled dates:', error);
709
- this.parsedDisabledDates = [];
710
- }
711
- }
712
- /**
713
- * Checks if two dates are identical
714
- * @param {Date | null} date1 - First date
715
- * @param {Date | null} date2 - Second date
716
- * @returns {boolean} true if the dates are identical
717
- */
718
- isSameDate(date1, date2) {
719
- if (!date1 || !date2)
720
- return false;
721
- if (this.isUTCMode) {
722
- return (date1.getUTCFullYear() === date2.getUTCFullYear() &&
723
- date1.getUTCMonth() === date2.getUTCMonth() &&
724
- date1.getUTCDate() === date2.getUTCDate());
725
- }
726
- else {
727
- return (date1.getFullYear() === date2.getFullYear() &&
728
- date1.getMonth() === date2.getMonth() &&
729
- date1.getDate() === date2.getDate());
730
- }
731
- }
732
- /**
733
- * Checks if a date is identical or after another date
734
- * @param {Date} date - Date to check
735
- * @param {Date} compareDate - Reference date
736
- * @returns {boolean} true if `date` >= `compareDate`
737
- */
738
- isSameOrAfter(date, compareDate) {
739
- if (this.isUTCMode) {
740
- return (date.getUTCFullYear() > compareDate.getUTCFullYear() ||
741
- (date.getUTCFullYear() === compareDate.getUTCFullYear() &&
742
- date.getUTCMonth() > compareDate.getUTCMonth()) ||
743
- (date.getUTCFullYear() === compareDate.getUTCFullYear() &&
744
- date.getUTCMonth() === compareDate.getUTCMonth() &&
745
- date.getUTCDate() >= compareDate.getUTCDate()));
746
- }
747
- else {
748
- return (date.getFullYear() > compareDate.getFullYear() ||
749
- (date.getFullYear() === compareDate.getFullYear() &&
750
- date.getMonth() > compareDate.getMonth()) ||
751
- (date.getFullYear() === compareDate.getFullYear() &&
752
- date.getMonth() === compareDate.getMonth() &&
753
- date.getDate() >= compareDate.getDate()));
754
- }
755
- }
756
- /**
757
- * Checks if a date is identical or before another date
758
- * @param {Date} date - Date to check
759
- * @param {Date} compareDate - Reference date
760
- * @returns {boolean} true if `date` <= `compareDate`
761
- */
762
- isSameOrBefore(date, compareDate) {
763
- if (this.isUTCMode) {
764
- return (date.getUTCFullYear() < compareDate.getUTCFullYear() ||
765
- (date.getUTCFullYear() === compareDate.getUTCFullYear() &&
766
- date.getUTCMonth() < compareDate.getUTCMonth()) ||
767
- (date.getUTCFullYear() === compareDate.getUTCFullYear() &&
768
- date.getUTCMonth() === compareDate.getUTCMonth() &&
769
- date.getUTCDate() <= compareDate.getUTCDate()));
770
- }
771
- else {
772
- return (date.getFullYear() < compareDate.getFullYear() ||
773
- (date.getFullYear() === compareDate.getFullYear() &&
774
- date.getMonth() < compareDate.getMonth()) ||
775
- (date.getFullYear() === compareDate.getFullYear() &&
776
- date.getMonth() === compareDate.getMonth() &&
777
- date.getDate() <= compareDate.getDate()));
778
- }
779
- }
780
- /**
781
- * Applies a shortcut selection
782
- * @param {Object} shortcut - Shortcut to apply
783
- * @param {string | Date} shortcut.singleValue - Selected date value
784
- * @param {Object} shortcut.rangeValue - Start and end date values
785
- * @param {string | Date} shortcut.rangeValue.start - Start date value
786
- * @param {string | Date} shortcut.rangeValue.end - End date value
787
- * @param {string} shortcut.label - Label
788
- */
789
- applyShortcut(shortcut) {
790
- this.selectedDate = null;
791
- this.startDate = null;
792
- this.endDate = null;
793
- if (shortcut.singleValue) {
794
- const newDate = this.parseDate(shortcut.singleValue);
795
- this.selectedDate = newDate;
796
- this.singleDateChange.emit(this.formatDate(newDate));
797
- this.singleValue = this.formatDate(newDate);
798
- if (!this.showActions) {
799
- const event = new CustomEvent('closePopover', {
800
- bubbles: true,
801
- composed: true,
802
- });
803
- this.el.dispatchEvent(event);
804
- }
805
- this.forceCalendarUpdate(newDate);
806
- }
807
- else {
808
- const start = this.parseDate(shortcut.rangeValue.start);
809
- const end = this.parseDate(shortcut.rangeValue.end);
810
- this.startDate = start;
811
- this.endDate = end;
812
- this.rangeDateChange.emit({
813
- start: this.formatDate(start),
814
- end: this.formatDate(end),
815
- });
816
- this.rangeValue = JSON.stringify({
817
- start: this.formatDate(start),
818
- end: this.formatDate(end),
819
- });
820
- if (!this.showActions) {
821
- const event = new CustomEvent('closePopover', {
822
- bubbles: true,
823
- composed: true,
824
- });
825
- this.el.dispatchEvent(event);
826
- }
827
- this.forceCalendarUpdate(end);
828
- }
829
- }
830
- /**
831
- * Method to force the complete calendar update (and fix the persistent hover problem)
832
- * @param {Date} newDate - Date to force
833
- */
834
- forceCalendarUpdate(newDate) {
835
- this.currentDate = new Date(newDate);
836
- this.currentDate = new Date(this.currentDate); // Force a re-render
837
- // Reset visually the hover/touch effect
838
- requestAnimationFrame(() => {
839
- const days = document.querySelectorAll('.day');
840
- days.forEach(el => {
841
- el.classList.remove('hover', 'active', 'touched');
842
- el.style.pointerEvents = 'none';
843
- });
844
- // Add specific touch handling (for mobile)
845
- document.body.addEventListener('touchstart', this.clearTouchState, {
846
- passive: true,
847
- });
848
- // Reset the touch state after 50ms
849
- setTimeout(() => {
850
- days.forEach(el => {
851
- el.style.pointerEvents = '';
852
- });
853
- }, 50);
854
- });
855
- }
856
- /**
857
- * Function to reset the touch effect (Mobile fix)
858
- */
859
- clearTouchState() {
860
- document.querySelectorAll('.day').forEach(el => {
861
- el.classList.remove('touched');
862
- });
863
- // Remove the listener after the first interaction
864
- document.body.removeEventListener('touchstart', this.clearTouchState);
865
- }
866
- /**
867
- * Handles month change with an offset
868
- * @param {number} direction - Direction (-1 for previous, 1 for next)
869
- * @returns {Function} Change month handler
870
- */
871
- getChangeMonthHandler(direction) {
872
- return () => this.changeMonth(direction);
873
- }
874
- /**
875
- * Handles month change from an event (ex: dropdown)
876
- * @param {number} offset - Month offset (0 by default)
877
- * @returns {Function} Change month handler
878
- */
879
- getHandleMonthChange(offset) {
880
- return (event) => this.handleMonthChange(event, offset);
881
- }
882
- /**
883
- * Handles year change from an event (ex: dropdown)
884
- * @param {number} offset - Year offset (0 by default)
885
- * @returns {Function} Change year handler
886
- */
887
- getHandleYearChange(offset) {
888
- return (event) => this.handleYearChange(event, offset);
889
- }
890
- /**
891
- * Handles day click
892
- * @param {Date} date - Date to handle
893
- * @param {boolean} isDisabled - Whether the date is disabled
894
- * @returns {Function} Day click handler
895
- */
896
- getDayClickHandler(date, isDisabled) {
897
- return isDisabled ? undefined : () => this.handleDateSelection(date);
898
- }
899
- /**
900
- * Handles shortcut selection
901
- * @param {Object} shortcut - Shortcut to handle
902
- * @param {string | Date} shortcut.singleValue - Selected date value
903
- * @param {Object} shortcut.rangeValue - Start and end date values
904
- * @param {string | Date} shortcut.rangeValue.start - Start date value
905
- * @param {string | Date} shortcut.rangeValue.end - End date value
906
- * @param {string} shortcut.label - Label
907
- * @returns {Function} Shortcut selection handler
908
- */
909
- getShortcutHandler(shortcut) {
910
- return () => this.applyShortcut(shortcut);
911
- }
912
- /**
913
- * Handles week selection
914
- * @param {Date[]} dates - Dates to handle
915
- * @param {number} index - Calendar index
916
- * @returns {Function} Week selection handler
917
- */
918
- getWeekSelectionHandler(dates, index) {
919
- return () => {
920
- if (this.selectionType === 'range') {
921
- this.handleWeekSelection(dates, index);
922
- }
923
- };
924
- }
925
- parsedShortcuts() {
926
- try {
927
- return this.shortcuts ? JSON.parse(this.shortcuts) : [];
928
- }
929
- catch (error) {
930
- console.error('Invalid JSON for shortcuts:', error);
931
- return [];
932
- }
933
- }
934
- /**
935
- * Checks if shortcuts are visible
936
- * @returns {boolean} true if shortcuts are visible
937
- */
938
- get hasShortcuts() {
939
- return (this.shortcutsPlacement === 'bottom' && this.parsedShortcuts().length > 0);
940
- }
941
- /**
942
- * Checks if actions are visible
943
- * @returns {boolean} true if actions are visible
944
- */
945
- get hasActions() {
946
- return this.showActions;
947
- }
948
- //#endregion METHODS
949
- /****************************************************************************/
950
- //#region RENDER
951
- /**
952
- * Renders the header
953
- * @param {number} offset - Month offset
954
- * @param {number} index - Calendar index
955
- * @returns {JSX.Element} Header
956
- * @description Renders the header of the calendar
957
- */
958
- renderHeader(offset, index$1) {
959
- 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() +
960
- 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" }))));
961
- }
962
- /**
963
- * Renders the week numbers
964
- * @param {Array<{date: Date}>} weeks - Weeks to render
965
- * @param {number} index - Calendar index
966
- * @returns {JSX.Element} Week numbers
967
- * @description Renders the week numbers of the calendar
968
- */
969
- renderWeekNumbers(
970
- /** Weeks to render */
971
- weeks,
972
- /** Calendar index */
973
- index$1) {
974
- return (index.h("div", { class: "week-numbers" }, index.h("div", { class: "week-header" }, this.getLocalizedWeekText()), weeks.map((week, weekIndex) => {
975
- var _a;
976
- const dates = week.map(d => d.date);
977
- return (index.h("div", { class: `week-number ${this.selectionType === 'range' ? 'clickable' : ''}`, onClick: this.getWeekSelectionHandler(dates, index$1), key: `week-${weekIndex}` }, this.getWeekNumber(((_a = week.find(d => d.date)) === null || _a === void 0 ? void 0 : _a.date) || new Date())));
978
- })));
979
- }
980
- renderDaysGrid(
981
- /** Days to render */
982
- days) {
983
- return (index.h("div", { class: "days-grid" }, days.map(day => {
984
- const date = day.date;
985
- if (!date)
986
- return null;
987
- const isSelected = this.selectionType === 'single' &&
988
- this.isSameDate(date, this.selectedDate);
989
- const isInRange = this.isDateInRange(date);
990
- const isStart = this.isSameDate(date, this.startDate);
991
- const isEnd = this.isSameDate(date, this.endDate);
992
- const isToday = this.isToday(date);
993
- const isOutsideMonth = !day.isCurrentMonth;
994
- const dayClasses = [
995
- 'day',
996
- isSelected ? 'selected' : '',
997
- isStart ? 'range-start' : '',
998
- isEnd ? 'range-end' : '',
999
- isInRange ? 'in-range' : '',
1000
- day.isDisabled ? 'disabled' : '',
1001
- isOutsideMonth ? 'outside-month' : '',
1002
- isToday ? 'is-today' : '',
1003
- ];
1004
- 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));
1005
- })));
1006
- }
1007
- /**
1008
- * Renders the calendar
1009
- * @param {number} index - Calendar index
1010
- * @param {number} offset - Month offset
1011
- * @returns {JSX.Element} Calendar
1012
- * @description Renders the calendar of the calendar
1013
- */
1014
- renderCalendar(
1015
- /** Calendar index */
1016
- index$1,
1017
- /** Month offset */
1018
- offset) {
1019
- const days = this.getDaysInMonth(offset, this.numberOfCalendars);
1020
- const weeks = [];
1021
- for (let i = 0; i < days.length; i += 7) {
1022
- weeks.push(days.slice(i, i + 7));
1023
- }
1024
- 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" }))));
1025
- }
1026
- /**
1027
- * Renders the shortcuts
1028
- * @returns {JSX.Element} Shortcuts
1029
- * @description Renders the shortcuts of the calendar
1030
- */
1031
- renderShortcuts() {
1032
- if (!this.parsedShortcuts().length) {
1033
- return null;
1034
- }
1035
- return (index.h("div", { class: `shortcuts-container shortcuts-placement-${this.shortcutsPlacement}` }, this.parsedShortcuts().map(shortcut => (index.h("nv-button", { emphasis: "lower", size: "xs", "aria-label": shortcut.label, onClick: this.getShortcutHandler(shortcut) }, shortcut.label)))));
1036
- }
1037
- /**
1038
- * Renders the actions
1039
- * @returns {JSX.Element} Actions
1040
- * @description Renders the actions of the calendar
1041
- * @slot actions - Child content of the component.
1042
- */
1043
- renderActions() {
1044
- 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"))));
1045
- }
1046
- /**
1047
- * Renders the datepicker
1048
- * @returns {JSX.Element} Datepicker
1049
- * @description Renders the datepicker of the calendar
1050
- * @slot default - Child content of the component.
1051
- */
1052
- render() {
1053
- return (index.h(index.Host, { key: '89300da9f694aa926855452414e7e036f75f2de6' }, index.h("div", { key: '467ef9fc9d6523eec3712bf779d49fdf50c55617', class: "datepicker-root" }, index.h("div", { key: '990f2cb18dcad96cab0f8dfb62e6c57049475440', class: `datepicker-container ${this.numberOfCalendars === 1 ? 'datepicker-container-single' : ''}` }, index.h("div", { key: 'c0dedf1007cbc6a87bd591925c9994474c876afc', 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.hasActions) && (index.h("div", { key: 'ef81eaf952fbe569be7e1d3ee6cb59de0e137fe4', class: "datepicker-controls" }, this.hasShortcuts && this.renderShortcuts(), this.hasActions && this.renderActions())))), index.h("slot", { key: 'e1281217950b5cb02952a69b081d4fcce5863b4d' })));
1054
- }
1055
- get el() { return index.getElement(this); }
1056
- static get watchers() { return {
1057
- "numberOfCalendars": ["validateNumberOfCalendars"],
1058
- "rangeValue": ["onRangeValueChange"],
1059
- "disabledDates": ["handleDisabledDatesChange"],
1060
- "singleValue": ["onSingleValueChange"]
1061
- }; }
1062
- };
1063
- NvCalendar.style = NvCalendarStyle0;
1064
-
1065
- exports.nv_calendar = NvCalendar;