@postnord/web-components
Version:
PostNord Web Components
1,071 lines • 75.5 kB
JavaScript
/*!
* Built with Stencil
* By PostNord.
*/
import { r as registerInstance, c as createEvent, g as getElement, h, a as Host } from './index-5606614b.js';
import { u as uuidv4, j as getTotalHeightOffset, k as awaitTopbar, r as reduceMotion, e as en$1 } from './helpers-9dac5241.js';
import { a as arrow_left } from './arrow_left-f0d725e6.js';
import { a as arrow_right } from './arrow_right-1b36bbb0.js';
const icon$1 = '<svg class="pn-icon-svg" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" fill-rule="evenodd" d="M9 3.5a1 1 0 0 1 1 1V5h4v-.5a1 1 0 1 1 2 0V5h2a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3h2v-.5a1 1 0 0 1 1-1M8 7H6a1 1 0 0 0-1 1v1.5h14V8a1 1 0 0 0-1-1h-2v.5a1 1 0 1 1-2 0V7h-4v.5a1 1 0 0 1-2 0zm11 4.5H5V17a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1z" clip-rule="evenodd"/></svg>';
const calendar = icon$1;
const icon = '<svg class="pn-icon-svg" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" fill-rule="evenodd" d="M11.707 21.707a1 1 0 0 0 0-1.414L8.414 17H11.5a7.5 7.5 0 0 0 0-15H11a1 1 0 1 0 0 2h.5a5.5 5.5 0 1 1 0 11H8.414l3.293-3.293a1 1 0 0 0-1.414-1.414l-5 5a1 1 0 0 0 0 1.414l5 5a1 1 0 0 0 1.414 0M7 3a1 1 0 0 0 1 1h.01a1 1 0 0 0 0-2H8a1 1 0 0 0-1 1" clip-rule="evenodd"/></svg>';
const pn_return = icon;
const translations = {
CALENDAR_NAVIGATION: {
en: 'Calendar',
sv: 'Kalender',
da: 'Kalender',
fi: 'Kalenteri',
no: 'Kalender',
},
NEXT_YEAR: {
en: 'Scroll forward',
sv: 'Bläddra framåt',
da: 'Rul frem',
fi: 'Vieritä eteenpäin',
no: 'Rull fremover',
},
PREVIOUS_YEAR: {
en: 'Scroll backwards',
sv: 'Bläddra bakåt',
da: 'Rul baglæns',
fi: 'Vieritä taaksepäin',
no: 'Bla bakover',
},
NEXT_DATE: {
en: 'Next month',
sv: 'Nästa månad',
da: 'Næste måned',
fi: 'Ensi kuussa',
no: 'Neste måned',
},
PREVIOUS_DATE: {
en: 'Previous month',
sv: 'Föregående månad',
da: 'Forrige måned',
fi: 'Edellinen kuukausi',
no: 'Forrige måned',
},
SELECT_YEAR: {
en: 'Choose year',
sv: 'Välj år',
da: 'Vælg år',
fi: 'Valitse vuosi',
no: 'Velg år',
},
SELECT_MONTH: {
en: 'Choose month',
sv: 'Välj månad',
da: 'Vælg måned',
fi: 'Valitse kuukausi',
no: 'Velg måned',
},
SELECT_DATE: {
en: 'Choose date',
sv: 'Välj datum',
da: 'Vælg dato',
fi: 'Valitse päivämäärä',
no: 'Velg dato',
},
SELECTED_DATE: {
en: 'selected date is {date}.',
sv: 'valt datum är {date}.',
da: 'den valgte dato er {date}.',
fi: 'valittu päivämäärä on {date}.',
no: 'valgt dato er {date}.',
},
SELECTED_START_DATE: {
en: 'selected start date is {date}.',
sv: 'valt startdatum är {date}.',
da: 'den valgte startdato er {date}.',
fi: 'valittu aloituspäivä on {date}.',
no: 'valgt startdato er {date}.',
},
SELECTED_END_DATE: {
en: 'selected end date is {date}.',
sv: 'valt slutdatum är {date}.',
da: 'den valgte slutdato er {date}.',
fi: 'valittu lopetuspäivä on {date}.',
no: 'valgt sluttdato er {date}.',
},
WEEK_NAME: {
en: 'Week',
sv: 'Vecka',
da: 'Uge',
fi: 'Viikko',
no: 'Uke',
},
GO_CALENDAR: {
en: 'Calendar view',
sv: 'Kalendervyn',
da: 'Kalendervisning',
fi: 'Kalenterinäkymä',
no: 'Kalendervisning',
},
};
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var dayjs_min = {exports: {}};
(function (module, exports) {
!function(t,e){module.exports=e();}(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,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}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,!1)},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,!0);case"A":return $(s,u,!1);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,!0);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=!0),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}));
}(dayjs_min));
const dayjs = dayjs_min.exports;
var weekOfYear$1 = {exports: {}};
(function (module, exports) {
!function(e,t){module.exports=t();}(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,!0);return o<0?r(this).startOf("week").week():Math.ceil(o)},f.weeks=function(e){return void 0===e&&(e=null),this.week(e)};}}));
}(weekOfYear$1));
const weekOfYear = weekOfYear$1.exports;
var customParseFormat$1 = {exports: {}};
(function (module, exports) {
!function(e,t){module.exports=t();}(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,!1);}],a:[o,function(e){this.afternoon=d(e,!0);}],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=!0,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=!0===o[2],h=!0===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&&!0!==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);};}}));
}(customParseFormat$1));
const customParseFormat = customParseFormat$1.exports;
var isSameOrBefore$1 = {exports: {}};
(function (module, exports) {
!function(e,i){module.exports=i();}(commonjsGlobal,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
}(isSameOrBefore$1));
const isSameOrBefore = isSameOrBefore$1.exports;
var isSameOrAfter$1 = {exports: {}};
(function (module, exports) {
!function(e,t){module.exports=t();}(commonjsGlobal,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
}(isSameOrAfter$1));
const isSameOrAfter = isSameOrAfter$1.exports;
var toObject$1 = {exports: {}};
(function (module, exports) {
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){return function(t,e){e.prototype.toObject=function(){return {years:this.$y,months:this.$M,date:this.$D,hours:this.$H,minutes:this.$m,seconds:this.$s,milliseconds:this.$ms}};}}));
}(toObject$1));
const toObject = toObject$1.exports;
var sv = {exports: {}};
(function (module, exports) {
!function(e,t){module.exports=t(dayjs_min.exports);}(commonjsGlobal,(function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=t(e),d={name:"sv",weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekStart:1,yearStart:4,ordinal:function(e){var t=e%10;return "["+e+(1===t||2===t?"a":"e")+"]"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"}};return a.default.locale(d,null,!0),d}));
}(sv));
var en = {exports: {}};
(function (module, exports) {
!function(e,n){module.exports=n();}(commonjsGlobal,(function(){return {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(e){var n=["th","st","nd","rd"],t=e%100;return "["+e+(n[(t-20)%10]||n[t]||n[0])+"]"}}}));
}(en));
var da = {exports: {}};
(function (module, exports) {
!function(e,t){module.exports=t(dayjs_min.exports);}(commonjsGlobal,(function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=t(e),a={name:"da",weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn._man._tirs._ons._tors._fre._lør.".split("_"),weekdaysMin:"sø._ma._ti._on._to._fr._lø.".split("_"),months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj_juni_juli_aug._sept._okt._nov._dec.".split("_"),weekStart:1,yearStart:4,ordinal:function(e){return e+"."},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd [d.] D. MMMM YYYY [kl.] HH:mm"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"}};return d.default.locale(a,null,!0),a}));
}(da));
var fi = {exports: {}};
(function (module, exports) {
!function(u,e){module.exports=e(dayjs_min.exports);}(commonjsGlobal,(function(u){function e(u){return u&&"object"==typeof u&&"default"in u?u:{default:u}}var t=e(u);function n(u,e,t,n){var i={s:"muutama sekunti",m:"minuutti",mm:"%d minuuttia",h:"tunti",hh:"%d tuntia",d:"päivä",dd:"%d päivää",M:"kuukausi",MM:"%d kuukautta",y:"vuosi",yy:"%d vuotta",numbers:"nolla_yksi_kaksi_kolme_neljä_viisi_kuusi_seitsemän_kahdeksan_yhdeksän".split("_")},a={s:"muutaman sekunnin",m:"minuutin",mm:"%d minuutin",h:"tunnin",hh:"%d tunnin",d:"päivän",dd:"%d päivän",M:"kuukauden",MM:"%d kuukauden",y:"vuoden",yy:"%d vuoden",numbers:"nollan_yhden_kahden_kolmen_neljän_viiden_kuuden_seitsemän_kahdeksan_yhdeksän".split("_")},s=n&&!e?a:i,_=s[t];return u<10?_.replace("%d",s.numbers[u]):_.replace("%d",u)}var i={name:"fi",weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),ordinal:function(u){return u+"."},weekStart:1,yearStart:4,relativeTime:{future:"%s päästä",past:"%s sitten",s:n,m:n,mm:n,h:n,hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},formats:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"D. MMMM[ta] YYYY",LLL:"D. MMMM[ta] YYYY, [klo] HH.mm",LLLL:"dddd, D. MMMM[ta] YYYY, [klo] HH.mm",l:"D.M.YYYY",ll:"D. MMM YYYY",lll:"D. MMM YYYY, [klo] HH.mm",llll:"ddd, D. MMM YYYY, [klo] HH.mm"}};return t.default.locale(i,null,!0),i}));
}(fi));
var nb = {exports: {}};
(function (module, exports) {
!function(e,t){module.exports=t(dayjs_min.exports);}(commonjsGlobal,(function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),a={name:"nb",weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"sø._ma._ti._on._to._fr._lø.".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.".split("_"),ordinal:function(e){return e+"."},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] HH:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},relativeTime:{future:"om %s",past:"%s siden",s:"noen sekunder",m:"ett minutt",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dager",M:"en måned",MM:"%d måneder",y:"ett år",yy:"%d år"}};return n.default.locale(a,null,!0),a}));
}(nb));
dayjs.extend(weekOfYear);
dayjs.extend(customParseFormat);
dayjs.extend(isSameOrBefore);
dayjs.extend(isSameOrAfter);
dayjs.extend(toObject);
const CALENDAR = 'calendar';
const MONTHS = 'months';
const YEARS = 'years';
function getToday() {
return dayjs();
}
function getDayjsObject({ year, month, date }) {
return dayjs().set('year', year).set('month', month).set('date', date);
}
/** Validate the date. */
function validateDate(value, format) {
if (!value)
return false;
const val = typeof value === 'string' ? value : getDayjsObject(value);
return dayjs(val, format, true).isValid();
}
/**
* Get the Dayjs object with the value & format param.
**/
function getDate(value, format) {
const val = typeof value === 'string' ? value : getDayjsObject(value);
return dayjs(val, format);
}
/** Get a readable i18n format of the date. */
function getReadableDate(date, lang, format) {
const data = getDateJs(date);
return data.locale(lang === 'no' ? 'nb' : lang).format(format);
}
function getDateJs({ year, month, date, day }) {
const dateObject = dayjs().set('y', year).set('M', month).set('D', date);
if (typeof day === 'number')
return dateObject.set('d', day);
return dateObject;
}
function getDateObject(data, format) {
const dateObj = typeof data === 'string' ? getDate(data, format) : data;
const year = dateObj.get('year');
const month = dateObj.get('month');
const date = dateObj.get('date');
const day = dateObj.get('day');
return {
year,
month,
date,
day,
};
}
function getDiff(from, to, format) {
const dateFrom = getDate(from, format);
const dateTo = getDate(to, format);
return dateTo.diff(dateFrom, 'd');
}
function isBefore(data, max, format, type) {
const date = getDate(data, format);
const dateMax = getDate(max, format);
return date.isSameOrBefore(dateMax, type);
}
function isAfter(data, min, format, type) {
const date = getDate(data, format);
const dateMin = getDate(min, format);
return date.isSameOrAfter(dateMin, type);
}
function selectedDate(dateOne, dateTwo, format, type) {
if (!validateDate(dateOne, format) || !validateDate(dateTwo, format))
return false;
let date = getDate(dateOne, format);
let compare = getDate(dateTwo, format);
if (type === 'month') {
date = date.set('year', 2000);
compare = compare.set('year', 2000);
}
return date.isSame(compare, type);
}
function modifyDate({ data, amount = 1, unit, minus, plus, }) {
if (minus)
return data.subtract(amount, unit);
if (plus)
return data.add(amount, unit);
return data;
}
/** Set another year for the value. */
function setYear({ year, minus = false, plus = false, }) {
const data = dayjs().set('year', year);
return modifyDate({ data, unit: 'y', plus, minus }).year();
}
/**
* You select a month you wish to decrease or increase by 1.
*/
function setMonth({ month, minus = false, plus = false, }) {
const data = dayjs().set('month', month);
return modifyDate({ data, unit: 'M', plus, minus }).month();
}
function navigateGrid(code, data, disableWeekends, type) {
if (type === 'date')
return navDate(code, data, disableWeekends);
return navList(code, data, type);
}
function navDate(code, data, disableWeekend) {
const date = getDayjsObject(data);
const { space, enter, next, down, previous, upwards, pageDown, pageUp, end, home } = getCode(code);
if (space || enter)
return date;
if (next || down)
return date.add(next ? 1 : 7, 'day');
if (previous || upwards)
return date.subtract(previous ? 1 : 7, 'day');
if (pageDown)
return date.add(1, 'month');
if (pageUp)
return date.subtract(1, 'month');
const day = date.get('day');
const endDay = disableWeekend ? 5 : 7;
const startDay = day === 0 ? -6 : 1;
if (end && day !== 0)
return date.set('day', endDay);
if (home && day !== 1)
return date.set('day', startDay);
return date;
}
function navList(key, data, type) {
const date = getDayjsObject(data);
const enter = key.match(/^(Enter|Space)$/);
if (enter)
return date;
// Add one day
const next = key === 'ArrowRight';
// Minus one day
const previous = key === 'ArrowLeft';
// Add one week
const down = key === 'ArrowDown';
// Minus one week
const upwards = key === 'ArrowUp';
const setNumber = next || previous ? 1 : 3;
const { years, months } = date.toObject();
const dateValue = type === 'year' ? years : months;
const oppositeType = type === 'year' ? 'month' : 'year';
if (next || down)
return date.set(type, dateValue + setNumber).set(oppositeType, data[oppositeType]);
if (previous || upwards)
return date.set(type, dateValue - setNumber).set(oppositeType, data[oppositeType]);
return date;
}
function getGrid(year, month) {
const allDays = [];
const grid = [];
const date = dayjs().set('year', year).set('month', month);
const numberOfDays = date.daysInMonth();
for (let i = 0; numberOfDays > i; i++) {
const day = date.set('date', i);
const week = day.week();
allDays.push({
week,
day: day.day() + 1,
date: i + 1,
});
}
const weeks = [...new Set(allDays.map(({ week }) => week))];
weeks.forEach((week, index) => {
const list = allDays.filter(day => day.week === week);
if (index === 0 && list.length !== 7) {
const numberOfDaysOutsideWeek = 7 - list.length;
for (let i = 0; numberOfDaysOutsideWeek > i; i++) {
list.unshift({ week, blank: true });
}
}
if (index + 1 === weeks.length && list.length !== 7) {
const numberOfDaysOutsideWeek = 7 - list.length;
for (let i = 0; numberOfDaysOutsideWeek > i; i++) {
list.push({ week, blank: true });
}
}
grid.push({ week: week, list });
});
return grid;
}
function getCode(code) {
const enter = code === 'Enter';
const space = code === 'Space';
// Add/sub one day
const next = code === 'ArrowRight';
const previous = code === 'ArrowLeft';
// Add/sub one week
const down = code === 'ArrowDown';
const upwards = code === 'ArrowUp';
// Add/sub one month
const pageDown = code === 'PageDown';
const pageUp = code === 'PageUp';
// Go the first/last day of the week
const end = code === 'End';
const home = code === 'Home';
return {
enter,
space,
next,
previous,
down,
upwards,
pageDown,
pageUp,
end,
home,
};
}
const pnDatePickerCss = "/* Global utility variables */\n/* Input styles */\n/* Transition variables */\npn-date-picker {\n position: relative;\n display: block;\n}\n\npn-date-picker .pn-date-picker {\n width: 100%;\n display: flex;\n flex-wrap: wrap;\n gap: 0.25em;\n container-type: inline-size;\n /** The calendar dropdown */\n /* Month list */\n}\n@container (max-width: 24em) {\n pn-date-picker .pn-date-picker .pn-date-picker-container {\n flex: 1 1 20em;\n }\n pn-date-picker .pn-date-picker .pn-date-picker-range-icon {\n display: none;\n }\n}\npn-date-picker .pn-date-picker-container {\n display: block;\n flex: 1 1 11em;\n}\npn-date-picker .pn-date-picker-container[data-error] > .pn-date-picker-label {\n color: #a70707;\n}\npn-date-picker .pn-date-picker-container[data-error] > .pn-date-picker-field .pn-date-picker-input {\n border-color: #a70707;\n}\npn-date-picker .pn-date-picker-container[data-error] > .pn-date-picker-field .pn-date-picker-input:hover {\n border-color: #500715;\n}\npn-date-picker .pn-date-picker-container[data-error] > .pn-date-picker-field .pn-date-picker-input:focus-visible {\n background-color: #ffffff;\n border-color: #a70707;\n outline-color: #a70707;\n}\npn-date-picker .pn-date-picker-label {\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n font-weight: 400;\n color: #2d2013;\n margin: 0 0 0.25em 0;\n gap: 0.5em;\n -webkit-tap-highlight-color: transparent;\n transition-property: color;\n transition-duration: 0.2s;\n transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);\n}\n@media (prefers-reduced-motion: reduce) {\n pn-date-picker .pn-date-picker-label {\n transition-duration: 0s;\n transition-delay: 0s;\n }\n}\npn-date-picker .pn-date-picker-label > span {\n font-size: 0.875em;\n}\npn-date-picker .pn-date-picker-field {\n position: relative;\n display: flex;\n}\npn-date-picker .pn-date-picker-input {\n color: #2d2013;\n background-color: #ffffff;\n border: 0.0625em solid #969087;\n border-radius: 0.5em;\n padding: 0.75em;\n font-family: inherit;\n font-size: 1em;\n font-weight: 500;\n line-height: 1.5em;\n -webkit-font-smoothing: antialiased;\n -webkit-tap-highlight-color: transparent;\n outline: 0.2rem solid transparent;\n outline-offset: 0.2rem;\n transition-property: outline-color, background-color, border-color, color;\n transition-duration: 0.2s;\n transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);\n padding-right: 3em;\n flex: auto;\n width: 100%;\n}\npn-date-picker .pn-date-picker-input:-webkit-autofill, pn-date-picker .pn-date-picker-input:-webkit-autofill:hover, pn-date-picker .pn-date-picker-input:-webkit-autofill:focus, pn-date-picker .pn-date-picker-input:-webkit-autofill:active {\n -webkit-box-shadow: 0 0 0 10em #e0f8ff inset;\n -webkit-text-fill-color: #2d2013;\n}\npn-date-picker .pn-date-picker-input:focus-visible {\n outline-color: #005d92;\n background-color: #ffffff;\n border-color: #005d92;\n}\n@media (prefers-reduced-motion: reduce) {\n pn-date-picker .pn-date-picker-input {\n transition-duration: 0s;\n transition-delay: 0s;\n }\n}\npn-date-picker .pn-date-picker-input::placeholder {\n color: #5e554a;\n font-weight: normal;\n}\npn-date-picker .pn-date-picker-input:hover {\n border-color: #005d92;\n}\npn-date-picker .pn-date-picker-input:disabled {\n color: #5e554a;\n background-color: #f3f2f2;\n border-color: #f3f2f2;\n}\npn-date-picker .pn-date-picker-input::-webkit-calendar-picker-indicator {\n visibility: hidden;\n inline-size: 0;\n}\npn-date-picker .pn-date-picker-input::-webkit-textfield-decoration-container, pn-date-picker .pn-date-picker-input::-webkit-search-cancel-button, pn-date-picker .pn-date-picker-input::-webkit-inner-spin-button, pn-date-picker .pn-date-picker-input::-webkit-outer-spin-button, pn-date-picker .pn-date-picker-input::-webkit-search-decoration {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\npn-date-picker .pn-date-picker-input[data-active] {\n border-color: #005d92;\n}\npn-date-picker .pn-date-picker-input:read-only {\n border-color: #ffffff;\n}\npn-date-picker .pn-date-picker-range-icon {\n width: 1.5em;\n margin-bottom: 0.8125em;\n align-self: end;\n}\npn-date-picker .pn-date-picker-helpertext, pn-date-picker .pn-date-picker-error {\n color: #5e554a;\n font-size: 0.875em;\n font-weight: 400;\n margin: 0.25em 0 0 0;\n display: flex;\n flex-direction: column;\n gap: 0.25em;\n text-align: left;\n}\npn-date-picker .pn-date-picker-helpertext[hidden], pn-date-picker .pn-date-picker-error[hidden] {\n display: none;\n}\npn-date-picker .pn-date-picker-error {\n color: #a70707;\n}\npn-date-picker .pn-date-picker-toggle {\n position: absolute;\n top: 0.5em;\n right: 0.5em;\n border-radius: 50%;\n}\npn-date-picker .pn-date-picker-button {\n cursor: pointer;\n font-size: 1em;\n background-color: transparent;\n border: 0.0625em solid #969087;\n border-color: transparent;\n padding: 0.25em;\n margin: 0;\n flex: auto;\n border-radius: 3em;\n transition-property: outline-color, background-color, border-color;\n transition-duration: 0.2s;\n transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);\n outline: 0.2rem solid transparent;\n outline-offset: 0.2rem;\n}\npn-date-picker .pn-date-picker-button:first-child, pn-date-picker .pn-date-picker-button:last-child {\n flex: 0 0 auto;\n}\n@media (prefers-reduced-motion: reduce) {\n pn-date-picker .pn-date-picker-button {\n transition-duration: 0s;\n transition-delay: 0s;\n }\n}\npn-date-picker .pn-date-picker-button:focus {\n background-color: #ffffff;\n outline-color: #005d92;\n}\npn-date-picker .pn-date-picker-button:hover {\n background-color: #e0f8ff;\n}\npn-date-picker .pn-date-picker-button[data-active], pn-date-picker .pn-date-picker-button[data-range] {\n background-color: #e0f8ff;\n border-color: #005d92;\n}\npn-date-picker .pn-date-picker-button:disabled {\n cursor: not-allowed;\n}\npn-date-picker .pn-date-picker-button:disabled:hover {\n background-color: transparent;\n}\npn-date-picker .pn-date-picker-month {\n text-transform: capitalize;\n}\npn-date-picker .pn-date-picker-month[data-full] {\n display: none;\n}\n@media (min-width: 25em) {\n pn-date-picker .pn-date-picker-month[data-full] {\n display: inline;\n }\n}\npn-date-picker .pn-date-picker-month[data-abbr] {\n display: inline;\n}\n@media (min-width: 25em) {\n pn-date-picker .pn-date-picker-month[data-abbr] {\n display: none;\n }\n}\npn-date-picker .pn-date-picker-sr-only {\n position: absolute;\n height: 1px;\n width: 1px;\n overflow: hidden;\n clip: rect(1px, 1px, 1px, 1px);\n margin: -1px;\n white-space: nowrap;\n}\npn-date-picker .pn-date-picker-calendar {\n position: absolute;\n z-index: 4;\n top: calc(100% + 0.5em);\n left: var(--pn-calendar-offset-left);\n width: clamp(100%, 95vw, 20em);\n max-width: 20em;\n text-align: center;\n border-radius: 0.5em;\n background-color: #ffffff;\n overflow: hidden;\n visibility: hidden;\n box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.1);\n}\npn-date-picker .pn-date-picker-calendar[data-range] {\n width: 100%;\n max-width: unset;\n}\npn-date-picker .pn-date-picker-calendar[data-open], pn-date-picker .pn-date-picker-calendar[data-moving] {\n visibility: visible;\n}\npn-date-picker .pn-date-picker-calendar[data-direction=top] {\n top: unset;\n bottom: calc(100% + 0.5em);\n transform-origin: bottom left;\n}\npn-date-picker .pn-date-picker-calendar pn-button[hidden] {\n display: none;\n}\npn-date-picker .pn-date-picker-calendar pn-button span {\n text-transform: capitalize;\n}\npn-date-picker .pn-date-picker-wrapper {\n padding: 0.5em;\n}\npn-date-picker .pn-date-picker-title {\n margin: 0.5em auto 0;\n font-size: 0.875em;\n font-weight: 500;\n color: #2d2013;\n}\npn-date-picker .pn-date-picker-nav {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n margin-bottom: 1em;\n}\npn-date-picker .pn-date-picker-table {\n width: 100%;\n table-layout: fixed;\n border-spacing: 0;\n border: 0;\n margin: 0 0 0.5em;\n}\npn-date-picker .pn-date-picker-th {\n font-size: 0.75em;\n font-weight: 500;\n color: #5e554a;\n padding: 0.25em;\n border: 0;\n text-transform: capitalize;\n}\npn-date-picker .pn-date-picker-td {\n cursor: pointer;\n position: relative;\n padding: 0.25em;\n outline: 0;\n border: 0;\n line-height: 0;\n width: 2em;\n height: 2em;\n -webkit-tap-highlight-color: transparent;\n}\npn-date-picker .pn-date-picker-td-text {\n position: relative;\n display: block;\n line-height: 1.5em;\n border-radius: 0.5em;\n color: #2d2013;\n padding: 0.25em;\n transition-property: color, background-color, outline-color;\n transition-duration: 0.2s;\n transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);\n outline: 0.2rem solid transparent;\n outline-offset: 0.2rem;\n}\n@media (prefers-reduced-motion: reduce) {\n pn-date-picker .pn-date-picker-td-text {\n transition-duration: 0s;\n transition-delay: 0s;\n }\n}\npn-date-picker .pn-date-picker-td[data-blank] {\n cursor: auto;\n}\npn-date-picker .pn-date-picker-td[data-blank] .pn-date-picker-td-text {\n background-color: transparent;\n}\npn-date-picker .pn-date-picker-td-week {\n font-size: 0.75em;\n color: #5e554a;\n display: block;\n}\npn-date-picker .pn-date-picker-td:before {\n content: \"\";\n position: absolute;\n left: 0;\n top: 0.25em;\n height: calc(100% - 0.5em);\n width: 100%;\n background-color: transparent;\n border: 0.0625em solid transparent;\n border-radius: 0.5em;\n transition-property: border-color, background-color, width, transform, left;\n transition-duration: 0.2s;\n transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);\n}\n@media (prefers-reduced-motion: reduce) {\n pn-date-picker .pn-date-picker-td:before {\n transition-duration: 0s;\n transition-delay: 0s;\n }\n}\npn-date-picker .pn-date-picker-td[aria-disabled=true] {\n cursor: not-allowed;\n pointer-events: none;\n}\npn-date-picker .pn-date-picker-td[aria-disabled=true] > .pn-date-picker-td-text {\n color: #5e554a;\n background-color: #f3f2f2;\n}\npn-date-picker .pn-date-picker-td[aria-disabled=true]:focus > .pn-date-picker-td-text {\n outline-color: #a70707;\n}\npn-date-picker .pn-date-picker-td[aria-disabled=true]:hover > .pn-date-picker-td-text, pn-date-picker .pn-date-picker-td[aria-disabled=true]:focus > .pn-date-picker-td-text {\n background-color: #f3f2f2;\n}\npn-date-picker .pn-date-picker-td[aria-selected=true] .pn-date-picker-td-text {\n font-weight: 500;\n}\npn-date-picker .pn-date-picker-td[aria-selected=true]:before {\n border-color: #005d92;\n background-color: #effbff;\n}\npn-date-picker .pn-date-picker-td[aria-selected=true][data-single]:before {\n width: 2em;\n left: 50%;\n transform: translateX(-50%);\n}\npn-date-picker .pn-date-picker-td[aria-selected=true][data-range]:before {\n border-radius: 0;\n border-left: 0;\n border-right: 0;\n}\npn-date-picker .pn-date-picker-td[aria-selected=true][data-range-from]:before {\n border-radius: 0.5em 0 0 0.5em;\n border-right-width: 0;\n border-left-width: 0.0625em;\n}\npn-date-picker .pn-date-picker-td[aria-selected=true][data-range-to]:before {\n border-radius: 0 0.5em 0.5em 0;\n border-right-width: 0.0625em;\n border-left-width: 0;\n}\npn-date-picker .pn-date-picker-td[aria-selected=true][aria-disabled=true]:before {\n border-color: #a70707;\n background-color: #fdefee;\n}\npn-date-picker .pn-date-picker-td[aria-selected=true][aria-disabled=true] > .pn-date-picker-td-text {\n background-color: unset;\n}\npn-date-picker .pn-date-picker-td[aria-selected=true][aria-disabled=true]:focus > .pn-date-picker-td-text {\n background-color: #f3f2f2;\n}\npn-date-picker .pn-date-picker-td[aria-selected=false]:hover > .pn-date-picker-td-text {\n background-color: #e0f8ff;\n}\npn-date-picker .pn-date-picker-td[data-today] > .pn-date-picker-td-text {\n font-weight: 500;\n}\npn-date-picker .pn-date-picker-td[data-today] > .pn-date-picker-td-text::after {\n content: \"\";\n position: absolute;\n bottom: 0.25em;\n left: calc(50% - 0.125em);\n height: 0.25em;\n width: 0.25em;\n background-color: #005d92;\n border-radius: 50%;\n}\npn-date-picker .pn-date-picker-td[data-today] > .pn-date-picker-td-text:after {\n bottom: 0.15em;\n}\npn-date-picker .pn-date-picker-td[data-active][data-today] > .pn-date-picker-td-text:after {\n background-color: #005d92;\n}\npn-date-picker .pn-date-picker-td:focus-visible > .pn-date-picker-td-text {\n outline-color: #005d92;\n}\npn-date-picker .pn-date-picker-list {\n margin: 0 0 1em;\n padding: 0;\n list-style: none;\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n grid-gap: 0.5em;\n}\npn-date-picker .pn-date-picker-item > .pn-date-picker-button {\n display: block;\n width: 100%;\n border-radius: 0.5em;\n padding: 0.5em 0.25em;\n}\npn-date-picker .pn-date-picker-item > .pn-date-picker-button[data-today] {\n position: relative;\n font-weight: 500;\n}\npn-date-picker .pn-date-picker-item > .pn-date-picker-button[data-today]::after {\n content: \"\";\n position: absolute;\n bottom: 0.25em;\n left: calc(50% - 0.125em);\n height: 0.25em;\n width: 0.25em;\n background-color: #005d92;\n border-radius: 50%;\n}\npn-date-picker .pn-date-picker-chips > [slot=chips] {\n display: flex;\n justify-content: flex-start;\n flex-wrap: wrap;\n gap: 0.5em;\n margin-bottom: 0.5em;\n}\npn-date-picker .pn-date-picker-chips > [slot=chips]:empty {\n display: none;\n}\npn-date-picker .pn-date-picker-bottom {\n display: flex;\n justify-content: flex-end;\n gap: 0.5em;\n}\npn-date-picker .pn-date-picker-bottom[hidden] {\n display: none;\n}";
const PnDatePickerStyle0 = pnDatePickerCss;
const PnDatePicker = class {
constructor(hostRef) {
registerInstance(this, hostRef);
this.dateselection = createEvent(this, "dateselection", 7);
this.dateSelection = createEvent(this, "dateSelection", 7);
this.dateInvalid = createEvent(this, "dateInvalid", 7);
this.toggleCalendar = createEvent(this, "toggleCalendar", 7);
this.currentView = createEvent(this, "currentView", 7);
this.open = false;
this.openUp = false;
this.selectingTo = false;
this.grid = undefined;
this.viewYearStart = null;
this.dateViewYear = undefined;
this.dateViewMonth = undefined;
this.dateViewDate = undefined;
this.showHelperSlot = undefined;
this.showErrorSlot = undefined;
this.isClosing = false;
this.isExpanding = false;
this.labelFrom = undefined;
this.labelTo = undefined;
this.helpertext = undefined;
this.start = '';
this.end = '';
this.format = 'YYYY-MM-DD';
this.language = null;
this.dateId = this.id;
this.name = undefined;
this.placeholder = this.format;
this.endPlaceholder = this.format;
this.autocomplete = undefined;
this.list = undefined;
this.listEnd = undefined;
this.pattern = undefined;
this.range = false;
this.rangeLimit = undefined;
this.view = CALENDAR;
this.calendarUp = false;
this.weekNumbers = false;
this.disableTypeAhead = false;
this.disableWeekends = false;
this.disabledDates = undefined;
this.disableMaxLength = false;
this.required = false;
this.readonly = false;
this.disabled = false;
this.error = undefined;
this.invalid = false;
this.minDate = null;
this.maxDate = null;
}
id = `pn-date-picker-${uuidv4()}`;
idFrom = `${this.id}-from`;
idTo = `${this.id}-to`;
idFromButton = `${this.id}-from-button`;
idToButton = `${this.id}-to-button`;
idHelper = `${this.id}-helper`;
idError = `${this.id}-error`;
idCalendar = `${this.id}-calendar`;
calendarElement;
today = getToday();
animation;
animationDurationDefault = 400;
animationDuration = this.animationDurationDefault;
separators = [];
separatorRegex = /[^a-zA-Z\d\s:]/g;
listMonths = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
listWeek = [1, 2, 3, 4, 5, 6, 0];
get hostElement() { return getElement(this); }
watchMin() {
if (this.minDate === null)
return;
if (!validateDate(this.minDate, this.format))
this.minDate = null;
}
watchMax() {
if (this.maxDate === null)
return;
if (!validateDate(this.maxDate, this.format))
this.maxDate = null;
}
watchValue() {
if (!validateDate(this.start, this.format))
return this.dateInvalid.emit({ start: this.start });
const { year, month, date } = getDateObject(this.start, this.format);
this.setViewYear({ year });
this.setViewMonth({ month });
this.setViewDate({ date });
if (this.range && isAfter(this.start, this.end, this.format, 'date')) {
this.end = '';
}
this.emitSelection();
}
watchValueTo() {
if (!this.range)
return;
if (!validateDate(this.end, this.format))
return this.dateInvalid.emit({ end: this.end });
const date = getDate(this.end, this.format);
this.setViewYear({ year: date.year() });
this.setViewMonth({ month: date.month() });
this.setViewDate({ date: date.date() });
if (isAfter(this.start, this.end, this.format, 'date')) {
const value = this.start;
this.start = this.end;
this.end = value;
}
this.emitSelection();
}
handleFormat() {
this.separators.length = 0;
this.format
.split('')
.forEach((item, index) => this.separatorRegex.exec(item) && this.separators.push({ name: item, index }));
}
watchId() {
this.idFrom = `${this.dateId}-from`;
this.idTo = `${this.dateId}-to`;
this.idFromButton = `${this.id}-from-button`;
this.idToButton = `${this.id}-to-button`;
this.idHelper = `${this.dateId}-helper`;
this.idError = `${this.dateId}-error`;
this.idCalendar = `${this.dateId}-calendar`;
}
watchView() {
const data = this.getCurrentDateObject();
if (validateDate(data, this.format))
this.updateGrid();
}
watchOpen() {
this.toggleCalendar.emit(this.open);
this.gridHandler();
if (this.open)
this.addGlobalEventListeners();
else
return this.removeGlobalEventListeners();
this.calendarElement.style.removeProperty('--pn-calendar-offset-left');
this.openUp = this.calendarUp;
requestAnimationFrame(() => {
const rectHost = this.getRect(this.hostElement);
const { scrollHeight } = this.calendarElement;
const { innerHeight, innerWidth } = window;
const offsetTop = getTotalHeightOffset();
const spaceUpwards = rectHost.y - offsetTop;
const spaceDownwards = innerHeight - rectHost.bottom;
const fitUpwards = spaceUpwards > scrollHeight;
const fitDownwards = spaceDownwards > scrollHeight;
const openTop = (this.openUp && (fitUpwards || spaceUpwards > spaceDownwards)) || (!fitDownwards && fitUpwards);
this.openUp = openTop;
// Calc y-axis
const rectCal = this.getRect(this.calendarElement);
const widthMinusRight = innerWidth - rectCal.right;
const offset = 0 > widthMinusRight ? widthMinusRight - 8 : 0;
this.calendarElement.style.setProperty('--pn-calendar-offset-left', `${Math.floor(offset)}px`);
});
}
handleMessage() {
this.checkSlottedHelper();
this.checkSlottedError();
}
handleView() {
this.currentView.emit(this.view);
}
/**
* Use the new `dateSelection`. Its here for compatibility. Will be removed in v8.
* @deprecated Use the new `dateSelection`. Will be removed in v8.
**/
dateselection;
/** Emits on valid date selection. Either if the user selects a date in the calendar or writes it manually. */
dateSelection;
emitSelection() {
const data = {
start: this.start,
};
if (this.range) {
const days = getDiff(this.start, this.end, this.format);
data.end = this.end;
data.days = typeof days === 'number' ? days + 1 : null;
}
this.dateSelection.emit(data);
this.dateselection.emit(data);
}
/** Emitted when an invalid value is set. This can only be done if the user writes in the input itself. */
dateInvalid;
/** Emitted when the calendar is toggled. */
toggleCalendar;
/** Emmitted when you select a new view. */
currentView;
/**
* If the select is open and you resize the window.
* Remove all css props and disable the animations entierly.
**/
handleResize() {
if (!this.open)
return;
this.toggleGrid(false);
}
async componentWillLoad() {
this.watchMin();
this.watchMax();
this.watchId();
this.handleFormat();
this.handleMessage();
const valid = validateDate(this.start || this.end, this.format);
const data = valid && getDateObject(this.start || this.end, this.format);
const { year, month, date } = getDateObject(this.today);
this.setViewDate({ date: data.date || date });
this.setViewMonth({ month: data.month || month });
this.setViewYear({ year: data.year || year });
if (this.language === null)
await awaitTopbar(this.hostElement);
}
// Animation
gridHandler() {
if (this.open)
this.openGrid();
else
this.closeGrid();
}
openGrid() {
requestAnimationFrame(() => {
const { clientHeight, scrollHeight } = this.calendarElement;
const height = this.isClosing ? clientHeight : 0;
this.calendarElement.style.height = `${scrollHeight}px`;
this.isExpanding = true;
this.animateGrid(true, `${height}px`, `${this.calendarElement.scrollHeight}px`);
});
}
closeGrid() {
const { scrollHeight, clientHeight } = this.calendarElement;
const height = this.isExpanding ? clientHeight : scrollHeight;
this.calendarElement.style.height = `0px`;
this.isClosing = true;
this.animateGrid(false, `${height}px`, `0px`);
}
animateGrid(open, startHeight, endHeight) {
this.cancelAnimations();
if (reduceMotion())
this.animationDuration = 0;
else
this.animationDuration = this.animationDurationDefault;
this.animation = this.calendarElement.animate({
height: [startHeight, endHeight],
}, {
duration: this.animationDuration,
easing: 'cubic-bezier(0.6, 0, 0.2, 1)',
});
this.animation.onfinish = () => this.animationFinish();
this.animation.oncancel = () => (open ? (this.isExpanding = false) : (this.isClosing = false));
}
animationFinish() {
this.cancelAnimations();
this.calendarElement.style.height = this.isClosing ? '0px' : '';
this.isClosing = false;
this.isExpanding = false;
}
cancelAnimations() {
if (this.animation)
this.animation.cancel();
}
// End of Animation
globalEvents = (event) => {
const target = event.target;
const isWithinCalendar = target?.closest(this.hostElement.localName);
if (!isWithinCalendar)
this.toggleGrid(false);
};
addGlobalEventListeners() {
const root = this.hostElement.getRootNode();
root.addEventListener('click', this.globalEvents);
}
removeGlobalEventListeners() {
const root = this.hostElement.getRootNode();
root.removeEventListener('click', this.globalEvents);
}
translate(prop) {
return translations?.[prop?.toUpperCase()]?.[this.language || en$1] || prop?.toUpperCase();
}
translateDateText(customDate, format) {
return getReadableDate({ ...this.getCurrentDateObject(), ...customDate }, this.language, format);
}
getRect(element) {
return element.getBoundingClientRect();
}
toggleGrid(state, selecting) {
this.open = state ?? !this.open;
this.selectingTo = selecting;
}
hasHelperText() {
return this.helpertext?.length > 0 || this.showHelperSlot;
}
/** If any `error` text is present, either via prop/slot. */
hasErrorMessage() {
return this.error?.length > 0 || this.showErrorSlot;
}
/** If any `error` is active, either via the prop `invalid` or `error` prop/slot. */
hasError() {
return this.hasErrorMessage() || this.invalid || this.showErrorSlot;
}
checkSlottedHelper() {
const slottedHelper = this.hostElement.querySelector('[slot=helpertext]')?.textContent;
this.showHelperSlot = !!slottedHelper?.length;
}
checkSlottedError() {
const slottedError = this.hostElement.querySelector('[slot=error]')?.textContent;
this.showErrorSlot = !!slottedError?.length;
}
viewingCalendar() {
return this.view === CALENDAR;
}
viewingMonth() {
return this.view === MONTHS;
}
viewingYears() {
return this.view === YEARS;
}
viewType() {
return this.viewingCalendar() ? 'date' : this.viewingMonth() ? 'month' : 'year';
}
isBeforeMax(data) {
if (this.maxDate)
return isBefore(data, this.maxDate, this.format, this.viewType());
return true;
}
isAfterMin(data) {
if (this.minDate)
return isAfter(data, this.minDate, this.format, this.viewType());
return true;
}
isDisabledWeekend(day) {
if (!this.viewingCalendar())
return false;
return this.disableWeekends ? day >= 6 : false;
}
isDisabledDate(data) {
if (!this.disabledDates?.length || !this.viewingCalendar())
return false;
const list = this.disabledDates.split(',');
return !!list.find(disabledDate => selectedDate(disabledDate, data, this.format, this.viewType()));
}
isDisabled(data) {
const isAfterMaxDate = !this.isBeforeMax(data);
const isBeforeMinDate = !this.isAfterMin(data);
const weekendDisable = this.viewingCalendar() && this.isDisabledWeekend(data.day);
const manualDisable = this.isDisabledDate(data);
const disabled = isAfterMaxDate || isBeforeMinDate || weekendDisable || manualDisable;
return {
disabled,
manualDisable,
weekendDisable,
minMaxDisable: isAfterMaxDate || isBeforeMinDate,
};
}
updateGrid() {
this.grid = getGrid(this.dateViewYear, this.dateViewMonth);
}
getCurrentViewDate(data = this.getCurrentDateObject()) {
return getReadableDate(data, this.language, 'MMMM YYYY');
}
isSelected(data, to = false) {
const value = to ? this.end : this.start;
return selectedDate(value, this.getCurrentDateObject(data), this.format, this.viewType());
}
isToday(data) {
return selectedDate(this.today.format(this.format), this.getCurrentDateObject(data), this.format, this.viewType());
}
getCurrentDateObject({ year = this.dateViewYear, month = this.dateViewMonth, date = this.dateViewDate, day, } = {}) {
return {
year,
month,
date,
day,
};
}
/** Handle keyboard navigation in the calendar grid. */
calendarKeyboardNavigation(event, data, disabled = false) {
const validCodes = [
'Enter',
'Space',
'ArrowRight',
'ArrowLeft',
'ArrowUp',
'ArrowDown',
'Home',
'End',
'PageDown',
'PageUp',
'Escape',
];
if (!validCodes.includes(event.code))
return;
event.preventDefault();
if (event.code === 'Escape')
return this.toggleGrid(false);
const select = !disabled && event.code.match(/^(Enter|Space)$/);
if (select && this.viewingYears())
return this.setViewYear({ year: data.year, reset: true });
if (select && this.viewingMonth())
return this.setViewMonth({ month: data.month, grid: true, reset: true });
if (select && this.viewingCalendar())
return this.setValue(data.date);
const goToDate = this.navDirection(event, data);
if (!goToDate)
return;
const { year, month, date } = goToDate;
this.setViewYear({ year });
this.setViewMonth({ month, grid: true });
this.setViewDate({ date });
this.resetFocus();
}
navDirection(event, data) {
const { code } = event;
const nextDate = navigateGrid(code, data, this.disableWeekends, this.viewType());
const date = getDateObject(nextDate);
return date;
}
getYearGrid() {
const list = [];
let oldestInList = this.viewYearStart - 7;
for (let i = 0; 15 > i; i++) {
list.push(oldestInList++);
}
return list;
}
/** Defaults to the calendar view. */
setView(view) {
this.view = view;
requestAnimationFrame(() => this.focusCalendar());
}
setNavView(data) {
if (this.viewingYears())
return this.setViewYear({ ...data, grid: true });
return this.setViewMonth(data);
}
setViewYear({ year = this.dateViewYear, minus = false, plus = false, reset = false, grid = false, }) {
const nextYear = setYear({ year, minus, plus });
const start = this.viewYearStart;
const max = start + 7;
const min = start - 7;
if (grid) {
const minusVal = this.viewYearStart - 15;
const plusVal = this.viewYearStart + 15;
this.viewYearStart = minus ? minusVal : plusVal;
this.dateViewYear = this.viewYearStart;
}
else
this.dateViewYear = nextYear;
if (start === null || nextYear > max || min > nextYear)
this.viewYearStart = nextYear;
if (reset)
this.setView(CALENDAR);
}
setViewMonth({ month = this.dateViewMonth, minus = false, plus = false, reset = false, grid = false, }) {
const nextMonth = setMonth({ month, minus, plus });
this.dateViewMonth = nextMonth;
if (!grid && month === 0 && minus)
this.setViewYear({ minus: true });
if (!grid && month === 11 && plus)
this.setViewYear({ plus: true });
if (reset)
this.setView(CALENDAR);
}
setViewDate({ date }) {
this.dateViewDate = date;
}
handleSeparator(event) {
let value = event.target.value;
const foundSeparator = this.separators.find(({ index }) => index === value.length);
if (foundSeparator?.name) {
value += foundSeparator.name;
}
return value;
}
inputHandler(event, to = false) {
const propName = to ? 'end' : 'start';
const value = this.disableTypeAhead ? event.target.value : this.handleSeparator(event);
this[propName] = value;
}
setValue(date) {
const value = getReadableDate(this.getCurrentDateObject({ date }), this.language, this.format);
if (this.selectingTo)
this.end = value;
else
this.start = value;
this.setViewDate({ date });
if (!this.range || this.selectingTo) {
this.toggleGrid(false);
this.focusToggleCalendarButton();
}
if (this.range && !this.selectingTo)
this.selectingTo = true;
}
getDayAttributes(dateObject, blank) {
const data = this.getCurrentDateObject(dateObject);
const { disabled } = this.isDisabled(data);
if (blank)
return { 'data-blank': true };
function capitalize(text) {
return text.charAt(0).toUpperCase() + text.slice(1);
}
const type = this.viewType();
const value = data[type];
const disabledProp = type !== 'date' ? 'disabled' : 'aria-disabled';
const selectedProp = type !== 'date' ? 'aria-pressed' : 'aria-selected';
const selectedFrom = this.isSelected(data);
const selectedTo = this.isSelected(data, true);
const selected = selectedFrom || selectedTo;
const after = this.range && isAfter(data, this.start, this.format, this.viewType());
const before = this.range && isBefore(data, this.end, this.format, this.viewType());
const isBetween = after && before;
const isDisabled = disabled && (type === 'date' || !selected);
const tabbable = this[`dateView${capitalize(type)}`] === value;
const props = {
'onKeyDown': (e) => this.calendarKeyboardNavigation(e, data, isDisabled),
'tabindex': tabbable ? '0' : '-1',
[selectedProp]: (selected || isBetween)?.toString(),
'aria-current': this.isToday(data) ? 'date' : null,
'data-active': isDisabled ? null : selected,
'data-today': this.isToday(data),
'data-option': 'true',
[`data-${type}`]: value,
[disabledProp]: isDisabled ? 'true' : null,
};
const singleDate = selectedDate(this.start, this.end, this.format, 'date');
if (this.range && !singleDate) {
props['data-range'] = isBetween;
props['data-range-from'] = selectedFrom && this.end !== '';
props['data-range-to'] = selectedTo && this.start !== '';
}
else {
props['data-single'] = true;
}
if (this.viewingCalendar())
props.onClick = () => this.setValue(data.date);
if (this.viewingMonth())
props.onClick = () => this.setViewMonth({ month: data.month, reset: true });
if (this.viewingYears())
props.onClick = () => this.setViewYear({ year: data.year, reset: true });
if (isDisabled)
delete props.onClick;
return props;
}
/** Focus the button toggling the calendar. Handles the start/from date on its own. */
focusToggleCalendarButton() {
requestAnimationFrame(() => {
const id = this.range ? this.idToButton : this.idFromButton;
this.hostElement.querySelector(`#${id}`).focus({ preventScroll: true });
});
}
focusCalendar() {
requestAnimationFrame(() => {
const element = this.calendarTabElement({ first: true, grid: true });
element?.focus({ preventScroll: true });
});
}
resetFocus() {
if (this.open)
return this.focusCalendar();
else
this.focusToggleCalendarButton();
}
handleButtonBlur(event) {
if (event.code === 'Escape') {
event.preventDefault();
event.stopImmediatePropagation();
}
if (this.open && event.key === 'Tab')
return this.focusCalendar();
}
/**
* This function queries all tabbable elements inside the calendar popup.
* Since we allow slotted content it important that we have a function that takes all elements into account.
* With the `first` and `grid` argument, you can decide which one you want to get.
* There are fallbacks so you should never get an empty list of elements.
*/
calendarTabElement({ first, grid }) {
const focusableElements = ':is(input, select, button:not([tabindex="-1"]), td[tabindex="0"])';
const elements = this.calendarElement.querySelectorAll(focusableElements);
const list = Array.from(elements).filter(({ localName, offsetParent }) => focusableElements.includes(localName) && offsetParent !== null);
const gridEl = list.find(({ dataset, tabIndex }) => dataset.option && tabIndex === 0);
if (grid && gridEl)
return gridEl;
if (first)
return list.shift();
else
return list.pop();
}
/**
* We need to listen to the `Esc` and `Tab` key for the entire calendar popup.
* Regardless if you focus the grid, the nav buttons or slotted content,
* the popup will close if you press `Esc`. We also need to reset the focus when the user tabs.
*/
handleCalendarTabEsc(event) {
const target = event.target;
const tabElement = this.calendarTabElement({ first: event.shiftKey });
event.stopImmediatePropagation();
if (event.code === 'Escape') {
event.preventDefault();
this.toggleGrid(false);
this.focusToggleCalendarButton();
return;
}
if (event.code === 'Tab' && target.isEqualNode(tabElement)) {
event.preventDefault();
this.calendarTabElement({ first: !event.shiftKey }).focus({ preventScroll: true });
}
}
ariaDescribedby() {
const list = [];
if (this.hasErrorMessage())
list.push(this.idError);
else if (this.hasHelperText())
list.push(this.idHelper);
return list.length ? list.join(' ') : null;
}
/** Renders the date calendar grid. */
renderDateGrid() {
return (h("table", { role: "grid", class: "pn-date-picker-table", "aria-multiselectable": this.range ? 'true' : null }, h("caption", { class: "pn-date-picker-sr-only", key: this.getCurrentViewDate() }, this.getCurrentViewDate()), h("thead", { class: "pn-date-picker-thead" }, h("tr", { class: "pn-date-picker-tr" }, this.weekNumbers && h("th", { class: "pn-date-picker-th", scope: "col", "aria-hidden": "true" }), this.listWeek.map(index => (h("th", { class: "pn-date-picker-th", scope: "col", abbr: this.translateDateText({ day: index }, 'dddd') }, this.translateDateText({ day: index }, 'ddd')))))), h("tbody", { class: "pn-date-picker-tbody" }, this.grid?.map(({ week, list }) => (h("tr", { key: `${this.dateViewYear}-${week}`, class: "pn-date-picker-tr" }, this.weekNumbers && (h("td", { class: "pn-date-picker-td", "data-blank": true, "data-week": true, title: `${this.translate('WEEK_NAME')} ${week}`, "aria-hidden": "true" }, h("span", { class: "pn-date-picker-td-week" }, week))), list.map(({ day, date, blank }) => (h("td", { key: `${this.dateViewYear}-${this.dateViewMonth}-${date}`, class: "pn-date-picker-td", ...this.getDayAttributes({ date, day }, blank) }, h("span", { class: "pn-date-picker-td-text" }, date))))))))));
}
/** Renders the month calendar grid. */
renderMonthGrid() {
return (h("ul", { class: "pn-date-picker-list" }, this.listMonths.map(month => (h("li", { key: month, class: "pn-date-picker-item", "data-item": "month" }, h("button", { type: "button", class: "pn-date-picker-button", ...this.getDayAttributes({ month }, false) }, h("span", { class: "pn-date-picker-month", "data-full": true }, this.translateDateText({ month }, 'MMMM')), h("span", { class: "pn-date-picker-month", "data-abbr": true }, this.translateDateText({ month }, 'MMM'))))))));
}
/** Renders the year calendar grid. */
renderYearGrid() {
return (h("ul", { class: "pn-date-picker-list" }, this.getYearGrid()?.map(year => (h("li", { key: year, class: "pn-date-picker-item", "data-item": "year" }, h("button", { type: "button", class: "pn-date-picker-button", ...this.getDayAttributes({ year }, false) }, h("span", null, year)))))));
}
renderInput({ to = false } = {}) {
const id = to ? this.idTo : this.idFrom;
const idButton = to ? this.idToButton : this.idFromButton;
const label = to ? this.labelTo : this.labelFrom;
const value = to ? this.end : this.start;
const placeholder = to ? this.endPlaceholder : this.placeholder;
const list = to ? this.listEnd : this.list;
const editing = this.open ? (this.selectingTo ? to : !to) : false;
const defaultText = this.translate('SELECT_DATE');
const textProp = this.range ? (to ? 'END_' : 'START_') : '';
const dateText = this.translate(`SELECTED_${textProp}DATE`);
let textButton = defaultText;
if (value) {
textButton += `, ${dateText.replace('{date}', value)}`;
}
const showButton = !(this.disabled || this.readonly);
return (h("div", { class: "pn-date-picker-container", "data-error": this.hasError() }, h("label", { class: "pn-date-picker-label", htmlFor: id }, h("span", null, label)), h("div", { class: "pn-date-picker-field" }, h("input", { type: "text", id: id, class: "pn-date-picker-input", name: this.name, placeholder: placeholder, autocomplete: this.autocomplete, maxlength: this.disableMaxLength ? null : this.format.length, list: list, pattern: this.pattern, value: value, disabled: this.disabled, required: this.required, readonly: this.readonly, "aria-describedby": this.ariaDescribedby(), "aria-invalid": this.hasError()?.toString(), onInput: e => this.inputHandler(e, to), "data-active": editing }), showButton && (h("pn-button", { class: "pn-date-picker-toggle", buttonId: idButton, icon: calendar, iconOnly: true, appearance: "light", arialabel: textButton, ariaexpanded: this.open.toString(), ariacontrols: this.idCalendar, "data-active": this.open, "data-input": true, small: true, onPnClick: () => this.toggleGrid(null, to), onKeyDown: e => this.handleButtonBlur(e) })))));
}
render() {
return (h(Host, { key: '6122e6224b4aa8570a714522dc323088074f5185' }, h("div", { key: 'd7d3c86378c680d3ddd14d9f3cb073f4bb42e2cf', class: "pn-date-picker" }, this.renderInput(), this.range && (h("div", { key: '3f02b31a0e03aef31b84777d6047d1b328ff633d', class: "pn-date-picker-range-icon test" }, h("pn-icon", { key: 'ad328bd870726dea04b2496d2059a67de218ceac', icon: arrow_right }))), this.range && this.renderInput({ to: this.range })), h("div", { key: '71c8518c6500591a4c0d7dc72681d9bcad264641', id: this.idCalendar, class: "pn-date-picker-calendar", role: "dialog", "aria-label": this.translate('CALENDAR_NAVIGATION'), "data-open": this.open, "data-moving": this.isClosing || this.isExpanding, "data-direction": this.openUp ? 'top' : 'bottom', "data-range": this.range, style: { height: '0px' }, ref: el => (this.calendarElement = el), onKeyDown: e => this.handleCalendarTabEsc(e) }, h("div", { key: '277f45e3372d096521889fa4bca4c1971346f0d3', class: "pn-date-picker-wrapper" }, h("nav", { key: '06336288e1d9a65ba4aa796328b09003cb79271d', class: "pn-date-picker-nav", "aria-labelledby": this.idCalendar }, h("pn-button", { key: '6361907855287330a3e9c537ce02bd948baccaa4', hidden: this.viewingMonth(), small: true, appearance: "light", arialabel: this.translate(`PREVIOUS_${this.viewType().toUpperCase()}`), icon: arrow_left, iconOnly: true, onPnClick: () => this.setNavView({ minus: true }) }), h("pn-button", { key: '21ae6b846df3bd12b314cb6b40f6d60dc8a0cc02', hidden: !this.viewingCalendar(), small: true, appearance: "light", onPnClick: () => this.setView(MONTHS) }, h("span", { key: '9f555bfea7f07abb32d8e96e6d84b547b4946899', class: "pn-date-picker-month", "data-full": true }, this.translateDateText({ date: 1 }, 'MMMM')), h("span", { key: '0a434038cb6ceb7fb52e89161408da00c8f3e0e3', class: "pn-date-picker-month", "data-abbr": true }, this.translateDateText({ date: 1 }, 'MMM'))), h("h2", { key: 'c63bfdcb83caf9fe9aec34416060d4ffe6ae6b08', hidden: this.viewingCalendar(), class: "pn-date-picker-title" }, this.translate(`SELECT_${this.viewType().toUpperCase()}`)), h("pn-button", { key: '502e44a09ca6194365542c1223e3e994e2fbe9d0', hidden: !this.viewingCalendar(), small: true, appearance: "light", onPnClick: () => this.setView(YEARS) }, h("span", { key: 'e0e9bbe7234ae0ce544fc3b89c94c798f3a60123' }, this.dateViewYear)), h("pn-button", { key: 'f93f7301ab9b61cd386dcdb19df482a7b1f4a15d', hidden: this.viewingMonth(), small: true, appearance: "light", arialabel: this.translate(`NEXT_${this.viewType().toUpperCase()}`), icon: arrow_right, iconOnly: true, onPnClick: () => this.setNavView({ plus: true }) })), this.viewingYears() && this.renderYearGrid(), this.viewingMonth() && this.renderMonthGrid(), this.viewingCalendar() && this.renderDateGrid(), h("aside", { key: '3473b9b53b3d0007828a367f05dcbb6fb3959e7e', class: "pn-date-picker-chips" }, h("slot", { key: '94e47d8d7feb1caa5db4fd24d97500258e1c4f98', name: "chips" })), h("nav", { key: '2245cab78f67e9ecf3932bda19075b13cfa27d61', class: "pn-date-picker-bottom", hidden: this.viewingCalendar() }, h("pn-button", { key: 'e8163e75c8197331f7ab77ed6a2fb94fde445131', appearance: "light", variant: "outlined", small: true, icon: pn_return, onPnClick: () => this.setView(CALENDAR) }, h("span", { key: '3a9028867b88cb831ef4cfc35039a10299c8fdeb' }, this.translate('GO_CALENDAR')))))), h("p", { key: 'dd4412fdfff7ef9c1c254a09c38831908c10c010', id: this.idHelper, class: "pn-date-picker-helpertext", hidden: !this.hasHelperText() || this.hasError() }, h("span", { key: 'd61ee102ecb131c481e220c073fe268b9228ebbb' }, this.helpertext), h("slot", { key: '3d54b17455d0e7a2a72564856978eee3e3f8ef45', name: "helpertext" })), h("p", { key: 'f42fd4bdff5c0ad22c3de99725bf1dbedd5788c8', id: this.idError, class: "pn-date-picker-error", role: "alert", hidden: !this.hasErrorMessage() }, h("span", { key: '69d7fd68b1157960d095ace9a423a1a3a08702fc' }, this.error), h("slot", { key: 'd2676dccff19ee3a22fe62b077f44c509500f267', name: "error" }))));
}
static get watchers() { return {
"minDate": ["watchMin"],
"maxDate": ["watchMax"],
"start": ["watchValue"],
"end": ["watchValueTo"],
"format": ["handleFormat"],
"id": ["watchId"],
"dateViewYear": ["watchView"],
"dateViewMonth": ["watchView"],
"dateViewDate": ["watchView"],
"open": ["watchOpen"],
"helpertext": ["handleMessage"],
"error": ["handleMessage"],
"view": ["handleView"]
}; }
};
PnDatePicker.style = PnDatePickerStyle0;
export { PnDatePicker as pn_date_picker };
//# sourceMappingURL=pn-date-picker.entry.js.map