@oslokommune/punkt-elements 13.15.2 → 13.15.4

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 (78) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/{calendar-DtJh7UYD.js → calendar-Bz27nuTP.js} +161 -158
  3. package/dist/calendar-Dz1Cnzx5.cjs +115 -0
  4. package/dist/{checkbox-_5LbXU7N.js → checkbox-CCFBIf44.js} +21 -21
  5. package/dist/checkbox-UT6D1Wi0.cjs +31 -0
  6. package/dist/{combobox-BX1YbDHV.cjs → combobox-6WP1urZS.cjs} +1 -1
  7. package/dist/{combobox-BdDZU1bk.js → combobox-CtHgl1n2.js} +3 -3
  8. package/dist/{datepicker-C4joeEiQ.cjs → datepicker-DEO1C69C.cjs} +47 -47
  9. package/dist/{datepicker-lnxklOi4.js → datepicker-q9haFM81.js} +178 -203
  10. package/dist/{helptext-DuvVSH7d.js → helptext-Cs3QHeEy.js} +1 -1
  11. package/dist/helptext-EPTR9AIl.cjs +24 -0
  12. package/dist/{input-element-BcFmygSF.js → input-element-Dqu8udwd.js} +1 -1
  13. package/dist/input-element-KUsQQ-1d.cjs +1 -0
  14. package/dist/{input-wrapper-D9kFsTCN.cjs → input-wrapper-B-Qseywc.cjs} +2 -2
  15. package/dist/{input-wrapper-CiqUL7my.js → input-wrapper-Wu3Yv-bn.js} +2 -2
  16. package/dist/{listbox-CsGiqzD0.cjs → listbox-DnoqOo5u.cjs} +1 -1
  17. package/dist/{listbox-DlJevu8O.js → listbox-mvKKzH-v.js} +1 -1
  18. package/dist/pkt-calendar.cjs +1 -1
  19. package/dist/pkt-calendar.js +1 -1
  20. package/dist/pkt-checkbox.cjs +1 -1
  21. package/dist/pkt-checkbox.js +1 -1
  22. package/dist/pkt-combobox.cjs +1 -1
  23. package/dist/pkt-combobox.js +1 -1
  24. package/dist/pkt-datepicker.cjs +1 -1
  25. package/dist/pkt-datepicker.js +2 -2
  26. package/dist/pkt-helptext.cjs +1 -1
  27. package/dist/pkt-helptext.js +1 -1
  28. package/dist/pkt-index.cjs +1 -1
  29. package/dist/pkt-index.js +12 -12
  30. package/dist/pkt-input-wrapper.cjs +1 -1
  31. package/dist/pkt-input-wrapper.js +1 -1
  32. package/dist/pkt-listbox.cjs +1 -1
  33. package/dist/pkt-listbox.js +1 -1
  34. package/dist/pkt-progressbar.cjs +1 -1
  35. package/dist/pkt-progressbar.js +2 -2
  36. package/dist/pkt-radiobutton.cjs +1 -1
  37. package/dist/pkt-radiobutton.js +1 -1
  38. package/dist/pkt-select.cjs +1 -1
  39. package/dist/pkt-select.js +1 -1
  40. package/dist/pkt-textarea.cjs +1 -1
  41. package/dist/pkt-textarea.js +1 -1
  42. package/dist/pkt-textinput.cjs +1 -1
  43. package/dist/pkt-textinput.js +1 -1
  44. package/dist/{progressbar-CazcIzVT.cjs → progressbar-8gzOtJyh.cjs} +1 -1
  45. package/dist/{progressbar-BbVei20_.js → progressbar-kxcBEspG.js} +1 -1
  46. package/dist/{radiobutton-DODROIBF.js → radiobutton-DuAo3CdN.js} +1 -1
  47. package/dist/{radiobutton-D1fihs8R.cjs → radiobutton-FwxpKELo.cjs} +1 -1
  48. package/dist/{select-D7Ne5gv0.cjs → select-BbmLn1qh.cjs} +1 -1
  49. package/dist/{select-_KoHkDbx.js → select-wak-jukY.js} +2 -2
  50. package/dist/{textarea-DuOBX5is.js → textarea-CIb4VWtN.js} +2 -2
  51. package/dist/{textarea-CYHYvdCf.cjs → textarea-CzN0E0TV.cjs} +1 -1
  52. package/dist/{textinput-CrcXv_is.js → textinput-D5_RTkRY.js} +2 -2
  53. package/dist/{textinput-DYVtoRMy.cjs → textinput-D8v6D6ie.cjs} +1 -1
  54. package/dist/utils-DznhwRXm.js +8 -0
  55. package/dist/utils-byXsEz1u.cjs +1 -0
  56. package/package.json +2 -4
  57. package/src/components/calendar/calendar.constraints.test.ts +1 -1
  58. package/src/components/calendar/calendar.core.test.ts +1 -1
  59. package/src/components/calendar/calendar.selection.test.ts +1 -1
  60. package/src/components/calendar/calendar.ts +1 -1
  61. package/src/components/checkbox/checkbox.ts +5 -0
  62. package/src/components/datepicker/date-tags.ts +4 -4
  63. package/src/components/datepicker/datepicker-multiple.ts +3 -2
  64. package/src/components/datepicker/datepicker-range.ts +4 -3
  65. package/src/components/datepicker/datepicker-single.ts +3 -2
  66. package/src/components/datepicker/datepicker-utils.ts +7 -69
  67. package/src/components/datepicker/datepicker.core.test.ts +1 -1
  68. package/src/components/datepicker/datepicker.ts +11 -10
  69. package/src/components/helptext/helptext.ts +1 -1
  70. package/src/components/input-wrapper/input-wrapper.ts +1 -1
  71. package/src/components/listbox/listbox.ts +1 -1
  72. package/src/components/progressbar/progressbar.ts +1 -1
  73. package/dist/calendar-BaMrdMDZ.cjs +0 -115
  74. package/dist/checkbox-CTxc8wQe.cjs +0 -31
  75. package/dist/helptext-CVQP3pis.cjs +0 -24
  76. package/dist/input-element-j9znzLWz.cjs +0 -1
  77. package/dist/stringutils-CkVRq4jP.cjs +0 -1
  78. package/dist/stringutils-DJjRa8dG.js +0 -7
@@ -0,0 +1,115 @@
1
+ "use strict";const K=require("./class-map-C_erArZz.cjs"),c=require("./element-CJ_QKaki.cjs"),I=require("./state-DSjcvzDN.cjs");require("./icon-BGuizDwk.cjs");const ot=6048e5,wt=864e5,Z=Symbol.for("constructDateFrom");function S(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Z in e?e[Z](t):e instanceof Date?new e.constructor(t):new Date(t)}function k(e,t){return S(t||e,e)}function j(e,t,n){const r=k(e,n==null?void 0:n.in);return isNaN(t)?S(e,NaN):(t&&r.setDate(r.getDate()+t),r)}let bt={};function L(){return bt}function H(e,t){var l,o,u,d;const n=L(),r=(t==null?void 0:t.weekStartsOn)??((o=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:o.weekStartsOn)??n.weekStartsOn??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,a=k(e,t==null?void 0:t.in),s=a.getDay(),i=(s<r?7:0)+s-r;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function R(e,t){return H(e,{...t,weekStartsOn:1})}function ct(e,t){const n=k(e,t==null?void 0:t.in),r=n.getFullYear(),a=S(n,0);a.setFullYear(r+1,0,4),a.setHours(0,0,0,0);const s=R(a),i=S(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const l=R(i);return n.getTime()>=s.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function tt(e){const t=k(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function lt(e,...t){const n=S.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function G(e,t){const n=k(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function kt(e,t,n){const[r,a]=lt(n==null?void 0:n.in,e,t),s=G(r),i=G(a),l=+s-tt(s),o=+i-tt(i);return Math.round((l-o)/wt)}function Dt(e,t){const n=ct(e,t),r=S(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),R(r)}function St(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Mt(e){return!(!St(e)&&typeof e!="number"||isNaN(+k(e)))}function vt(e,t){const n=k(e,t==null?void 0:t.in);return n.setHours(23,59,59,999),n}function Tt(e,t){const[n,r]=lt(e,t.start,t.end);return{start:n,end:r}}function z(e,t){const{start:n,end:r}=Tt(t==null?void 0:t.in,e);let a=+n>+r;const s=a?+n:+r,i=a?r:n;i.setHours(0,0,0,0);let l=1;const o=[];for(;+i<=s;)o.push(S(n,i)),i.setDate(i.getDate()+l),i.setHours(0,0,0,0);return a?o.reverse():o}function xt(e,t){const n=k(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const Ot={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Pt=(e,t,n)=>{let r;const a=Ot[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Q(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Ct={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Nt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},$t={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},_t={date:Q({formats:Ct,defaultWidth:"full"}),time:Q({formats:Nt,defaultWidth:"full"}),dateTime:Q({formats:$t,defaultWidth:"full"})},Et={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Wt=(e,t,n,r)=>Et[e];function W(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):i;a=e.formattingValues[l]||e.formattingValues[i]}else{const i=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[l]||e.values[i]}const s=e.argumentCallback?e.argumentCallback(t):t;return a[s]}}const Yt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},At={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Ft={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Ht={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},It={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},qt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Rt=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Lt={ordinalNumber:Rt,era:W({values:Yt,defaultWidth:"wide"}),quarter:W({values:At,defaultWidth:"wide",argumentCallback:e=>e-1}),month:W({values:Ft,defaultWidth:"wide"}),day:W({values:Ht,defaultWidth:"wide"}),dayPeriod:W({values:It,defaultWidth:"wide",formattingValues:qt,defaultFormattingWidth:"wide"})};function Y(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(a);if(!s)return null;const i=s[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],o=Array.isArray(l)?Bt(l,m=>m.test(i)):Ut(l,m=>m.test(i));let u;u=e.valueCallback?e.valueCallback(o):o,u=n.valueCallback?n.valueCallback(u):u;const d=t.slice(i.length);return{value:u,rest:d}}}function Ut(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Bt(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function jt(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const a=r[0],s=t.match(e.parsePattern);if(!s)return null;let i=e.valueCallback?e.valueCallback(s[0]):s[0];i=n.valueCallback?n.valueCallback(i):i;const l=t.slice(a.length);return{value:i,rest:l}}}const zt=/^(\d+)(th|st|nd|rd)?/i,Qt=/\d+/i,Xt={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Gt={any:[/^b/i,/^(a|c)/i]},Vt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Jt={any:[/1/i,/2/i,/3/i,/4/i]},Kt={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Zt={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},te={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ee={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ne={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},re={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ae={ordinalNumber:jt({matchPattern:zt,parsePattern:Qt,valueCallback:e=>parseInt(e,10)}),era:Y({matchPatterns:Xt,defaultMatchWidth:"wide",parsePatterns:Gt,defaultParseWidth:"any"}),quarter:Y({matchPatterns:Vt,defaultMatchWidth:"wide",parsePatterns:Jt,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Y({matchPatterns:Kt,defaultMatchWidth:"wide",parsePatterns:Zt,defaultParseWidth:"any"}),day:Y({matchPatterns:te,defaultMatchWidth:"wide",parsePatterns:ee,defaultParseWidth:"any"}),dayPeriod:Y({matchPatterns:ne,defaultMatchWidth:"any",parsePatterns:re,defaultParseWidth:"any"})},se={code:"en-US",formatDistance:Pt,formatLong:_t,formatRelative:Wt,localize:Lt,match:ae,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ie(e,t){const n=k(e,t==null?void 0:t.in);return kt(n,xt(n))+1}function oe(e,t){const n=k(e,t==null?void 0:t.in),r=+R(n)-+Dt(n);return Math.round(r/ot)+1}function ut(e,t){var d,m,p,g;const n=k(e,t==null?void 0:t.in),r=n.getFullYear(),a=L(),s=(t==null?void 0:t.firstWeekContainsDate)??((m=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:m.firstWeekContainsDate)??a.firstWeekContainsDate??((g=(p=a.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??1,i=S((t==null?void 0:t.in)||e,0);i.setFullYear(r+1,0,s),i.setHours(0,0,0,0);const l=H(i,t),o=S((t==null?void 0:t.in)||e,0);o.setFullYear(r,0,s),o.setHours(0,0,0,0);const u=H(o,t);return+n>=+l?r+1:+n>=+u?r:r-1}function ce(e,t){var l,o,u,d;const n=L(),r=(t==null?void 0:t.firstWeekContainsDate)??((o=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:o.firstWeekContainsDate)??n.firstWeekContainsDate??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,a=ut(e,t),s=S((t==null?void 0:t.in)||e,0);return s.setFullYear(a,0,r),s.setHours(0,0,0,0),H(s,t)}function ht(e,t){const n=k(e,t==null?void 0:t.in),r=+H(n,t)-+ce(n,t);return Math.round(r/ot)+1}function h(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const M={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return h(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):h(n+1,2)},d(e,t){return h(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return h(e.getHours()%12||12,t.length)},H(e,t){return h(e.getHours(),t.length)},m(e,t){return h(e.getMinutes(),t.length)},s(e,t){return h(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return h(a,t.length)}},$={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},et={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return M.y(e,t)},Y:function(e,t,n,r){const a=ut(e,r),s=a>0?a:1-a;if(t==="YY"){const i=s%100;return h(i,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):h(s,t.length)},R:function(e,t){const n=ct(e);return h(n,t.length)},u:function(e,t){const n=e.getFullYear();return h(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return h(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return h(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return M.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return h(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const a=ht(e,r);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):h(a,t.length)},I:function(e,t,n){const r=oe(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):h(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):M.d(e,t)},D:function(e,t,n){const r=ie(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):h(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const a=e.getDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return h(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const a=e.getDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return h(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return h(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let a;switch(r===12?a=$.noon:r===0?a=$.midnight:a=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let a;switch(r>=17?a=$.evening:r>=12?a=$.afternoon:r>=4?a=$.morning:a=$.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return M.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):M.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):h(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):h(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):M.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):M.s(e,t)},S:function(e,t){return M.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return rt(r);case"XXXX":case"XX":return P(r);case"XXXXX":case"XXX":default:return P(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return rt(r);case"xxxx":case"xx":return P(r);case"xxxxx":case"xxx":default:return P(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+nt(r,":");case"OOOO":default:return"GMT"+P(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+nt(r,":");case"zzzz":default:return"GMT"+P(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return h(r,t.length)},T:function(e,t,n){return h(+e,t.length)}};function nt(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),s=r%60;return s===0?n+String(a):n+String(a)+t+h(s,2)}function rt(e,t){return e%60===0?(e>0?"-":"+")+h(Math.abs(e)/60,2):P(e,t)}function P(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=h(Math.trunc(r/60),2),s=h(r%60,2);return n+a+t+s}const at=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},dt=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},le=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return at(e,t);let s;switch(r){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",at(r,t)).replace("{{time}}",dt(a,t))},ue={p:dt,P:le},he=/^D+$/,de=/^Y+$/,fe=["D","DD","YY","YYYY"];function me(e){return he.test(e)}function ge(e){return de.test(e)}function ye(e,t,n){const r=pe(e,t,n);if(console.warn(r),fe.includes(e))throw new RangeError(r)}function pe(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const we=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,be=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ke=/^'([^]*?)'?$/,De=/''/g,Se=/[a-zA-Z]/;function Me(e,t,n){var d,m,p,g;const r=L(),a=r.locale??se,s=r.firstWeekContainsDate??((m=(d=r.locale)==null?void 0:d.options)==null?void 0:m.firstWeekContainsDate)??1,i=r.weekStartsOn??((g=(p=r.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??0,l=k(e,n==null?void 0:n.in);if(!Mt(l))throw new RangeError("Invalid time value");let o=t.match(be).map(w=>{const b=w[0];if(b==="p"||b==="P"){const E=ue[b];return E(w,a.formatLong)}return w}).join("").match(we).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const b=w[0];if(b==="'")return{isToken:!1,value:ve(w)};if(et[b])return{isToken:!0,value:w};if(b.match(Se))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:w}});a.localize.preprocessor&&(o=a.localize.preprocessor(l,o));const u={firstWeekContainsDate:s,weekStartsOn:i,locale:a};return o.map(w=>{if(!w.isToken)return w.value;const b=w.value;(ge(b)||me(b))&&ye(b,t,String(e));const E=et[b[0]];return E(l,b,a.localize,u)}).join("")}function ve(e){const t=e.match(ke);return t?t[1].replace(De,"'"):e}function Te(e,t){const n=k(e,t==null?void 0:t.in).getDay();return n===0?7:n}function xe(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const X={},F={};function C(e,t){try{const r=(X[e]||(X[e]=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format))(t).split("GMT")[1];return r in F?F[r]:st(r,r.split(":"))}catch{if(e in F)return F[e];const n=e==null?void 0:e.match(Oe);return n?st(e,n.slice(1)):NaN}}const Oe=/([+-]\d\d):?(\d\d)?/;function st(e,t){const n=+(t[0]||0),r=+(t[1]||0),a=+(t[2]||0)/60;return F[e]=n*60+r>0?n*60+r+a:n*60-r-a}class D extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(C(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),ft(this),V(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new D(...n,t):new D(Date.now(),t)}withTimeZone(t){return new D(+this,t)}getTimezoneOffset(){const t=-C(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),V(this),+this}[Symbol.for("constructDateFrom")](t){return new D(+new Date(t),this.timeZone)}}const it=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!it.test(e))return;const t=e.replace(it,"$1UTC");D.prototype[t]&&(e.startsWith("get")?D.prototype[e]=function(){return this.internal[t]()}:(D.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),Pe(this),+this},D.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),V(this),+this}))});function V(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-C(e.timeZone,e)*60))}function Pe(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),ft(e)}function ft(e){const t=C(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const a=-new Date(+e).getTimezoneOffset(),s=-new Date(+r).getTimezoneOffset(),i=a-s,l=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();i&&l&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+i);const o=a-n;o&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+o);const u=new Date(+e);u.setUTCSeconds(0);const d=a>0?u.getSeconds():(u.getSeconds()-60)%60,m=Math.round(-(C(e.timeZone,e)*60))%60;(m||d)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+m+d));const p=C(e.timeZone,e),g=p>0?Math.floor(p):Math.ceil(p),b=-new Date(+e).getTimezoneOffset()-g,E=g!==n,J=b-o;if(E&&J){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+J);const U=C(e.timeZone,e),pt=U>0?Math.floor(U):Math.ceil(U),B=g-pt;B&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+B),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+B))}}class T extends D{static tz(t,...n){return n.length?new T(...n,t):new T(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),a=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+a}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,a]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${r} ${n} ${a}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,a]=this.tzComponents();return`${t} GMT${n}${r}${a} (${xe(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),a=String(Math.abs(t)%60).padStart(2,"0");return[n,r,a]}withTimeZone(t){return new T(+this,t)}[Symbol.for("constructDateFrom")](t){return new T(+new Date(t),this.timeZone)}}window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const Ce=(e=window.pktTz)=>{const t=new T(new Date().toISOString(),e);return t.setHours(0,0,0,0),isNaN(t.getTime())?new Date:new Date(t.getFullYear(),t.getMonth(),t.getDate())};function x(e){if(!e||e==="")return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(e)){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r)}if(/^\d{4}-\d{2}$/.test(e)){const[t,n]=e.split("-").map(Number);return new Date(t,n-1,1)}return/^\d{4}$/.test(e)?new Date(Number(e),0,1):new Date(e)}const y=e=>{if(!e||isNaN(e.getTime()))return"";const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`},_=e=>{if(!e)return null;const t=x(e);return isNaN(t.getTime())?null:t},Ne=(e,t)=>{const n=N(e);return isNaN(n.getTime())?"":Me(n,t)},N=(e="",t)=>{const n=typeof e=="string"?x(e):e;return!n||isNaN(n.getTime())?new Date:t?t==="end"?vt(n):G(n):n},v=(e,t,n=1)=>{if(typeof e!="number"||typeof t!="number"||typeof n!="number"||isNaN(e)||isNaN(t)||isNaN(n))return new Date;const r=new Date(e,t,n);return isNaN(r.getTime())?new Date:r},A=e=>{let t;return typeof e=="number"?t=new T(e,window.pktTz):t=new T(e,window.pktTz),t.setHours(12,0,0,0),t},$e=e=>!e||isNaN(e.getTime())?"":new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:window.pktTz}).format(e),_e=(e,t,n)=>{if(!e||isNaN(e.getTime()))return!1;const r=t?N(t):null,a=n?N(n):null;return!(r&&e<r||a&&e>a)},Ee=(e,t)=>{if(!e||isNaN(e.getTime())||!Array.isArray(t))return!1;const n=y(e);return t.includes(n)},We=(e,t)=>{if(!e||isNaN(e.getTime())||!Array.isArray(t))return!1;const n=e.getDay().toString();return t.includes(n)},mt=(e,t,n,r,a)=>!(!e||isNaN(e.getTime())||!_e(e,t,n)||r&&Ee(e,r)||a&&We(e,a)),Ye=(e,t,n,r,a)=>e.filter(s=>{const i=_(s);return i&&mt(i,t,n,r,a)}),Ae=e=>e.slice().sort((t,n)=>{const r=_(t),a=_(n);return!r||!a?0:r.getTime()-a.getTime()}),Fe=(e,t)=>{const n=_(e),r=_(t);return!n||!r?!1:n<=r},gt=e=>e?Array.isArray(e)?e.filter(Boolean):String(e).split(",").map(t=>t.trim()).filter(Boolean):[],He=e=>e.join(","),yt=e=>gt(e),Ie=e=>e?x(e):null,qe=e=>{if(typeof e=="string")return e.split(",").map(t=>x(t));if(Array.isArray(e))return e.map(t=>x(t))},q={csvToArray:yt,stringToDate:Ie,stringsToDate:qe},Re={earliest:{default:null},latest:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},maxMultiple:{default:4},range:{default:!1}},O={props:Re};var Le=Object.defineProperty,Ue=Object.getOwnPropertyDescriptor,f=(e,t,n,r)=>{for(var a=r>1?void 0:r?Ue(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Le(t,n,a),a};exports.PktCalendar=class extends c.PktElement{constructor(){super(...arguments),this.multiple=O.props.multiple.default,this.maxMultiple=O.props.maxMultiple.default,this.range=O.props.range.default,this.weeknumbers=O.props.weeknumbers.default,this.withcontrols=O.props.withcontrols.default,this.selected=[],this.earliest=O.props.earliest.default,this.latest=O.props.latest.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.dayStrings=this.strings.dates.daysShort,this.dayStringsLong=this.strings.dates.days,this.monthStrings=this.strings.dates.months,this.weekString=this.strings.dates.week,this.prevMonthString=this.strings.dates.prevMonth,this.nextMonthString=this.strings.dates.nextMonth,this._selected=[],this.year=0,this.month=0,this.week=0,this.rangeHovered=null,this.inRange={},this.focusedDate=null,this.selectableDates=[],this.currentmonthtouched=!1,this.tabIndexSet=0}connectedCallback(){super.connectedCallback()}disconnectedCallback(){this.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback()}attributeChangedCallback(t,n,r){t==="selected"&&r&&this.convertSelected(),super.attributeChangedCallback(t,n,r)}updated(t){super.updated(t),t.has("selected")&&this.convertSelected()}firstUpdated(t){this.addEventListener("keydown",this.handleKeydown)}convertSelected(){if(typeof this.selected=="string"&&(this.selected=this.selected.split(",")),this.selected.length===1&&this.selected[0]===""&&(this.selected=[]),this._selected=this.selected.map(t=>x(t)),this.range&&this.selected.length===2){const t=z({start:this._selected[0],end:this._selected[1]});if(this.inRange={},Array.isArray(t)&&t.length){const n={};for(let r=0;r<t.length;r++){const a=t[r],s=a>this._selected[0]&&a<this._selected[1];n[y(a)]=s}this.inRange=n}}this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched&&(this.currentmonthtouched=!0),this.selected.length&&this.selected[0]!==""){const t=x(this.selected[this.selected.length-1]);this.currentmonth=isNaN(t.getTime())?A(new Date):t}else this.currentmonth===null&&(this.currentmonth=A(new Date));(!this.currentmonth||isNaN(this.currentmonth.getTime()))&&(this.currentmonth=A(new Date)),this.year=this.currentmonth.getFullYear(),this.month=this.currentmonth.getMonth()}handleKeydown(t){switch(t.key){case"ArrowLeft":this.handleArrowKey(t,-1);break;case"ArrowRight":this.handleArrowKey(t,1);break;case"ArrowUp":this.handleArrowKey(t,-7);break;case"ArrowDown":this.handleArrowKey(t,7);break}}handleArrowKey(t,n){var s,i,l,o,u;if(((s=t.target)==null?void 0:s.nodeName)==="INPUT"||((i=t.target)==null?void 0:i.nodeName)==="SELECT"||((l=t.target)==null?void 0:l.nodeName)==="BUTTON"&&!((u=(o=t.target)==null?void 0:o.dataset)!=null&&u.date))return;t.preventDefault(),this.focusedDate||this.focusOnCurrentDate();const r=this.focusedDate?N(this.focusedDate):v(this.year,this.month,1);let a=j(r,n);if(a){let d=this.querySelector(`button[data-date="${y(a)}"]`);if(d instanceof HTMLButtonElement){if(d.dataset.disabled){a=j(a,n);let m=this.querySelector(`button[data-date="${y(a)}"]`);for(;m&&m instanceof HTMLButtonElement&&m.dataset.disabled;)a=j(a,n),m=this.querySelector(`button[data-date="${y(a)}"]`);d=m}d instanceof HTMLButtonElement&&!d.dataset.disabled&&(this.focusedDate=y(a),d.focus())}}}render(){return c.x`
2
+ <div
3
+ class="pkt-calendar ${this.weeknumbers?"pkt-cal-weeknumbers":""}"
4
+ @focusout=${this.closeEvent}
5
+ @keydown=${t=>{t.key==="Escape"&&(t.preventDefault(),this.close())}}
6
+ >
7
+ <nav class="pkt-cal-month-nav">
8
+ <div>
9
+ <button
10
+ type="button"
11
+ aria-label="${this.prevMonthString}"
12
+ @click=${()=>this.isPrevMonthAllowed()&&this.prevMonth()}
13
+ @keydown=${t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.isPrevMonthAllowed()&&this.prevMonth())}}
14
+ class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only pkt-calendar__prev-month ${this.isPrevMonthAllowed()?"":"pkt-hide"}"
15
+ .data-disabled=${this.isPrevMonthAllowed()?c.E:"disabled"}
16
+ ?aria-disabled=${!this.isPrevMonthAllowed()}
17
+ tabindex=${this.isPrevMonthAllowed()?"0":"-1"}
18
+ >
19
+ <pkt-icon class="pkt-btn__icon" name="chevron-thin-left"></pkt-icon>
20
+ <span class="pkt-btn__text">${this.prevMonthString}</span>
21
+ </button>
22
+ </div>
23
+ ${this.renderMonthNav()}
24
+ <div>
25
+ <button
26
+ type="button"
27
+ aria-label="${this.nextMonthString}"
28
+ @click=${()=>this.isNextMonthAllowed()&&this.nextMonth()}
29
+ @keydown=${t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.isNextMonthAllowed()&&this.nextMonth())}}
30
+ class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only pkt-calendar__next-month ${this.isNextMonthAllowed()?"":"pkt-hide"}"
31
+ .data-disabled=${this.isNextMonthAllowed()?c.E:"disabled"}
32
+ ?aria-disabled=${!this.isNextMonthAllowed()}
33
+ tabindex=${this.isNextMonthAllowed()?"0":"-1"}
34
+ >
35
+ <pkt-icon class="pkt-btn__icon" name="chevron-thin-right"></pkt-icon>
36
+ <span class="pkt-btn__text">${this.nextMonthString}</span>
37
+ </button>
38
+ </div>
39
+ </nav>
40
+ <table
41
+ class="pkt-cal-days pkt-txt-12-medium pkt-calendar__body"
42
+ role="grid"
43
+ ?aria-multiselectable=${this.range||this.multiple}
44
+ >
45
+ <thead>
46
+ ${this.renderDayNames()}
47
+ </thead>
48
+ <tbody>
49
+ ${this.renderCalendarBody()}
50
+ </tbody>
51
+ </table>
52
+ </div>
53
+ `}renderDayNames(){const t=[];this.weeknumbers&&t.push(c.x`<th><div class="pkt-calendar__week-number">${this.weekString}</div></th>`);for(let n=0;n<this.dayStrings.length;n++)t.push(c.x`<th>
54
+ <div class="pkt-calendar__day-name" aria-label="${this.dayStringsLong[n]}">
55
+ ${this.dayStrings[n]}
56
+ </div>
57
+ </th>`);return c.x`<tr class="pkt-cal-week-row">
58
+ ${t}
59
+ </tr>`}renderMonthNav(){let t=[];return this.withcontrols?t.push(c.x`<div class="pkt-cal-month-picker">
60
+ <label for="${this.id}-monthnav" class="pkt-hide">${this.strings.dates.month}</label>
61
+ <select
62
+ aria-label="${this.strings.dates.month}"
63
+ class="pkt-input pkt-input-compact"
64
+ id="${this.id}-monthnav"
65
+ @change=${n=>{n.stopImmediatePropagation(),this.changeMonth(this.year,n.target.value)}}
66
+ >
67
+ ${this.monthStrings.map((n,r)=>c.x`<option value=${r} ?selected=${this.month===r}>${n}</option>`)}
68
+ </select>
69
+ <label for="${this.id}-yearnav" class="pkt-hide">${this.strings.dates.year}</label>
70
+ <input
71
+ aria-label="${this.strings.dates.year}"
72
+ class="pkt-input pkt-cal-input-year pkt-input-compact"
73
+ id="${this.id}-yearnav"
74
+ type="number"
75
+ size="4"
76
+ placeholder="0000"
77
+ @change=${n=>{n.stopImmediatePropagation(),this.changeMonth(n.target.value,this.month)}}
78
+ .value=${this.year}
79
+ />
80
+ </div> `):t.push(c.x`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
81
+ ${this.monthStrings[this.month]} ${this.year}
82
+ </div>`),t}renderDayView(t,n){var p;const r=v(this.year,this.month,t),a=y(r),s=a===y(n),i=this.selected.includes(a),l=$e(r),o=this.isExcluded(r)||!i&&this.multiple&&this.maxMultiple>0&&this.selected.length>=this.maxMultiple,u=this.focusedDate?this.focusedDate===a&&!o?"0":"-1":!o&&this.tabIndexSet===0||this.tabIndexSet===t?"0":"-1";u==="0"&&(this.tabIndexSet=t),this.selectableDates.push({currentDateISO:a,isDisabled:o,tabindex:u});const d={"pkt-cal-today":s,"pkt-cal-selected":i,"pkt-cal-in-range":this.inRange[a],"pkt-cal-excluded":this.isExcluded(r),"pkt-cal-in-range-first":this.range&&(this.selected.length===2||this.rangeHovered!==null)&&a===this.selected[0],"pkt-cal-in-range-last":this.range&&this.selected.length===2&&a===this.selected[1],"pkt-cal-range-hover":this.rangeHovered!==null&&a===y(this.rangeHovered)},m={"pkt-calendar__date":!0,"pkt-calendar__date--today":s,"pkt-calendar__date--selected":i,"pkt-calendar__date--disabled":o,"pkt-calendar__date--in-range":this.inRange[a],"pkt-calendar__date--in-range-hover":this.rangeHovered!==null&&a===y(this.rangeHovered),"pkt-calendar__date--range-start":this.range&&(this.selected.length===2||this.rangeHovered!==null)&&a===this.selected[0],"pkt-calendar__date--range-end":this.range&&this.selected.length===2&&a===this.selected[1]};return c.x`<td class=${K.e(d)}>
83
+ <button
84
+ type="button"
85
+ aria-pressed=${i?"true":"false"}
86
+ ?disabled=${o}
87
+ class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${K.e(m)}"
88
+ @mouseover=${()=>this.range&&!this.isExcluded(r)&&this.handleRangeHover(r)}
89
+ @focus=${()=>{this.range&&!this.isExcluded(r)&&this.handleRangeHover(r),this.focusedDate=a}}
90
+ aria-label="${l}"
91
+ tabindex=${(p=this.selectableDates.find(g=>g.currentDateISO===a))==null?void 0:p.tabindex}
92
+ data-disabled=${o?"disabled":c.E}
93
+ data-date=${a}
94
+ @keydown=${g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),this.handleDateSelect(r))}}
95
+ @click=${g=>{o||(g.preventDefault(),this.handleDateSelect(r))}}
96
+ >
97
+ <span class="pkt-btn__text pkt-txt-14-light">${t}</span>
98
+ </button>
99
+ </td>`}renderCalendarBody(){const t=Ce(),n=v(this.year,this.month,1),r=v(this.year,this.month+1,0),a=(n.getDay()+6)%7,s=r.getDate(),i=Math.ceil((s+a)/7),o=v(this.year,this.month,0).getDate();let u=1;this.week=ht(v(this.year,this.month,1));const d=[];for(let m=0;m<i;m++){const p=[];this.weeknumbers&&p.push(c.x`<td class="pkt-cal-week">${this.week}</td>`),this.week++;for(let g=1;g<8;g++)if(m===0&&g<a+1){const w=o-(a-g);p.push(c.x`<td class="pkt-cal-other">
100
+ <div
101
+ class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
102
+ data-disabled="disabled"
103
+ >
104
+ <span class="pkt-btn__text pkt-txt-14-light">${w}</span>
105
+ </div>
106
+ </td>`)}else u>s?(p.push(c.x`<td class="pkt-cal-other">
107
+ <div
108
+ class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
109
+ data-disabled="disabled"
110
+ >
111
+ <span class="pkt-btn__text pkt-txt-14-light">${u-s}</span>
112
+ </div>
113
+ </td>`),u++):(p.push(this.renderDayView(u,t)),u++);d.push(c.x`<tr class="pkt-cal-week-row" role="row">
114
+ ${p}
115
+ </tr>`)}return d}isExcluded(t){const n=this.excludedates.map(r=>typeof r=="string"?r:y(r));return!mt(t,this.earliest,this.latest,n,this.excludeweekdays)}isPrevMonthAllowed(){const t=v(this.year,this.month,0);return!(this.earliest&&N(this.earliest)>t)}prevMonth(){const t=this.month===0?11:this.month-1,n=this.month===0?this.year-1:this.year;this.changeMonth(n,t)}isNextMonthAllowed(){const t=v(this.month===11?this.year+1:this.year,this.month===11?0:this.month+1,1);return!(this.latest&&N(this.latest)<t)}nextMonth(){const t=this.month===11?0:this.month+1,n=this.month===11?this.year+1:this.year;this.changeMonth(n,t)}changeMonth(t,n){this.year=typeof t=="string"?parseInt(t):t,this.month=typeof n=="string"?parseInt(n):n,this.currentmonth=A(new Date(this.year,this.month,1)),this.tabIndexSet=0,this.focusedDate=null,this.selectableDates=[]}isRangeAllowed(t){let n=!0;if(this._selected.length===1){const r=z({start:this._selected[0],end:t});if(Array.isArray(r)&&r.length)for(let a=0;a<r.length;a++)this.excludedates.forEach(s=>{s>this._selected[0]&&s<t&&(n=!1)}),this.excludeweekdays.includes(Te(r[a]).toString())&&(n=!1)}return n}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}addToSelected(t){this.selected.includes(y(t))||(this.selected=[...this.selected,y(t)],this._selected=[...this._selected,t],this.range&&this.selected.length===2&&(this.convertSelected(),this.close()))}removeFromSelected(t){if(this.selected.length===1)this.emptySelected();else{const n=this.selected.indexOf(y(t)),r=[...this.selected],a=[...this._selected];r.splice(n,1),a.splice(n,1),this.selected=r,this._selected=a}}toggleSelected(t){const n=y(t);this.selected.includes(n)?this.removeFromSelected(t):this.maxMultiple&&this.selected.length>=this.maxMultiple||this.addToSelected(t)}handleRangeSelect(t){const n=y(t);return this.selected.includes(n)?this.selected.indexOf(n)===0?this.emptySelected():this.removeFromSelected(t):this.selected.length>1?(this.emptySelected(),this.addToSelected(t)):(this.selected.length===1&&!this.isRangeAllowed(t)&&this.emptySelected(),this.selected.length===1&&this._selected[0]>t&&this.emptySelected(),this.addToSelected(t)),Promise.resolve()}handleRangeHover(t){if(this.range&&this._selected.length===1&&this.isRangeAllowed(t)&&this._selected[0]<t){this.rangeHovered=t,this.inRange={};const n=z({start:this._selected[0],end:t});if(Array.isArray(n)&&n.length)for(let r=0;r<n.length;r++){const a=n[r],s=a>this._selected[0]&&a<t;this.inRange[y(a)]=s}}else this.rangeHovered=null}handleDateSelect(t){if(t)return this.range?this.handleRangeSelect(t):this.multiple?this.toggleSelected(t):(this.selected.includes(y(t))?this.emptySelected():(this.emptySelected(),this.addToSelected(t)),this.close()),this.dispatchEvent(new CustomEvent("date-selected",{detail:this.selected,bubbles:!0,composed:!0})),Promise.resolve()}focusOnCurrentDate(){const t=y(A(new Date)),n=this.querySelector(`button[data-date="${t}"]`);if(n instanceof HTMLButtonElement)this.focusedDate=t,n.focus();else{const r=this.selectableDates.find(a=>!a.isDisabled);if(r){const a=this.querySelector(`button[data-date="${r.currentDateISO}"]`);a instanceof HTMLButtonElement&&(this.focusedDate=r.currentDateISO,a.focus())}}}closeEvent(t){!this.contains(t.relatedTarget)&&!t.target.classList.contains("pkt-hide")&&this.close()}close(){this.dispatchEvent(new CustomEvent("close",{detail:!0,bubbles:!0,composed:!0}))}};f([c.n({type:Boolean})],exports.PktCalendar.prototype,"multiple",2);f([c.n({type:Number})],exports.PktCalendar.prototype,"maxMultiple",2);f([c.n({type:Boolean})],exports.PktCalendar.prototype,"range",2);f([c.n({type:Boolean})],exports.PktCalendar.prototype,"weeknumbers",2);f([c.n({type:Boolean})],exports.PktCalendar.prototype,"withcontrols",2);f([c.n({converter:q.csvToArray})],exports.PktCalendar.prototype,"selected",2);f([c.n({type:String})],exports.PktCalendar.prototype,"earliest",2);f([c.n({type:String})],exports.PktCalendar.prototype,"latest",2);f([c.n({converter:q.stringsToDate})],exports.PktCalendar.prototype,"excludedates",2);f([c.n({converter:q.csvToArray})],exports.PktCalendar.prototype,"excludeweekdays",2);f([c.n({converter:q.stringToDate})],exports.PktCalendar.prototype,"currentmonth",2);f([c.n({type:Array})],exports.PktCalendar.prototype,"dayStrings",2);f([c.n({type:Array})],exports.PktCalendar.prototype,"dayStringsLong",2);f([c.n({type:Array})],exports.PktCalendar.prototype,"monthStrings",2);f([c.n({type:String})],exports.PktCalendar.prototype,"weekString",2);f([c.n({type:String})],exports.PktCalendar.prototype,"prevMonthString",2);f([c.n({type:String})],exports.PktCalendar.prototype,"nextMonthString",2);f([c.n({type:Array})],exports.PktCalendar.prototype,"_selected",2);f([c.n({type:Number})],exports.PktCalendar.prototype,"year",2);f([c.n({type:Number})],exports.PktCalendar.prototype,"month",2);f([c.n({type:Number})],exports.PktCalendar.prototype,"week",2);f([c.n({type:Date})],exports.PktCalendar.prototype,"rangeHovered",2);f([I.r()],exports.PktCalendar.prototype,"inRange",2);f([I.r()],exports.PktCalendar.prototype,"focusedDate",2);f([I.r()],exports.PktCalendar.prototype,"selectableDates",2);f([I.r()],exports.PktCalendar.prototype,"currentmonthtouched",2);f([I.r()],exports.PktCalendar.prototype,"tabIndexSet",2);exports.PktCalendar=f([c.t("pkt-calendar")],exports.PktCalendar);exports.arrayToCsv=He;exports.converters=q;exports.csvToArray=yt;exports.filterSelectableDates=Ye;exports.formatISODate=y;exports.fromISOToDate=_;exports.fromISOtoLocal=Ne;exports.isValidDateRange=Fe;exports.newDate=N;exports.parseISODateString=x;exports.sortDateStrings=Ae;exports.valueToArray=gt;
@@ -1,11 +1,11 @@
1
- import { E as n, x as c, n as s, a as u } from "./element-CRDRygXu.js";
2
- import { P as k } from "./input-element-BcFmygSF.js";
1
+ import { E as o, x as p, n as s, a as u } from "./element-CRDRygXu.js";
2
+ import { P as k } from "./input-element-Dqu8udwd.js";
3
3
  import { e as f, n as g } from "./ref-Xa5dbh--.js";
4
4
  import { e as d } from "./class-map-wy7PUk0P.js";
5
- var b = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (t, a, p, h) => {
6
- for (var l = h > 1 ? void 0 : h ? y(a, p) : a, o = t.length - 1, r; o >= 0; o--)
7
- (r = t[o]) && (l = (h ? r(a, p, l) : r(l)) || l);
8
- return h && l && b(a, p, l), l;
5
+ var b = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (t, a, c, l) => {
6
+ for (var h = l > 1 ? void 0 : l ? y(a, c) : a, n = t.length - 1, r; n >= 0; n--)
7
+ (r = t[n]) && (h = (l ? r(a, c, h) : r(h)) || h);
8
+ return l && h && b(a, c, h), h;
9
9
  };
10
10
  let e = class extends k {
11
11
  constructor() {
@@ -14,14 +14,14 @@ let e = class extends k {
14
14
  connectedCallback() {
15
15
  super.connectedCallback();
16
16
  }
17
- attributeChangedCallback(t, a, p) {
18
- t === "defaultChecked" && !this.checked && (this.checked = this.defaultChecked), t === "checked" && (this.checked = this.checked === "" || this.checked === "true" || this.checked === !0), super.attributeChangedCallback(t, a, p);
17
+ attributeChangedCallback(t, a, c) {
18
+ t === "defaultChecked" && !this.checked && (this.checked = this.defaultChecked), t === "checked" && (this.checked = this.checked === "" || this.checked === "true" || this.checked === !0, this.inputRef.value && (this.inputRef.value.checked = this.checked)), super.attributeChangedCallback(t, a, c);
19
19
  }
20
20
  firstUpdated(t) {
21
21
  t.has("defaultChecked") && !this.checked && (this.checked = this.defaultChecked), super.firstUpdated(t);
22
22
  }
23
23
  updated(t) {
24
- t.has("defaultChecked") && !this.checked && (this.checked = this.defaultChecked), super.updated(t);
24
+ t.has("defaultChecked") && !this.checked && (this.checked = this.defaultChecked), t.has("checked") && this.inputRef.value && (this.inputRef.value.checked = this.checked === "" || this.checked === "true" || this.checked === !0), super.updated(t);
25
25
  }
26
26
  render() {
27
27
  const t = d({
@@ -31,26 +31,26 @@ let e = class extends k {
31
31
  }), a = d({
32
32
  "pkt-input-check__input-checkbox": !0,
33
33
  "pkt-input-check__input-checkbox--error": this.hasError
34
- }), p = d({
34
+ }), c = d({
35
35
  "pkt-input-check__input-label": !0,
36
36
  "pkt-input-check__input-label--disabled": this.disabled,
37
37
  "pkt-input-check__input-label--left": this.labelPosition === "left",
38
38
  "pkt-input-check__input-label--right": this.labelPosition === "right",
39
39
  "pkt-sr-only": this.hideLabel
40
- }), h = "pkt-tag pkt-tag--small pkt-tag--thin-text", l = () => c`
41
- ${this.tagText ? c`<span class=${h + " pkt-tag--gray"}>${this.tagText}</span>` : n}
42
- ${this.optionalTag ? c`<span class=${h + " pkt-tag--blue-light"}>${this.optionalText}</span>` : n}
43
- ${this.requiredTag ? c`<span class=${h + " pkt-tag--beige"}>${this.requiredText}</span>` : n}
44
- `, o = () => c`
45
- <label class=${p} for=${this.id + "-internal"}>
46
- ${this.label} ${l()}
47
- ${this.checkHelptext ? c`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>` : n}
40
+ }), l = "pkt-tag pkt-tag--small pkt-tag--thin-text", h = () => p`
41
+ ${this.tagText ? p`<span class=${l + " pkt-tag--gray"}>${this.tagText}</span>` : o}
42
+ ${this.optionalTag ? p`<span class=${l + " pkt-tag--blue-light"}>${this.optionalText}</span>` : o}
43
+ ${this.requiredTag ? p`<span class=${l + " pkt-tag--beige"}>${this.requiredText}</span>` : o}
44
+ `, n = () => p`
45
+ <label class=${c} for=${this.id + "-internal"}>
46
+ ${this.label} ${h()}
47
+ ${this.checkHelptext ? p`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>` : o}
48
48
  </label>
49
49
  `;
50
- return c`
50
+ return p`
51
51
  <div class="pkt-input-check">
52
52
  <div class=${t}>
53
- ${this.labelPosition === "left" ? o() : n}
53
+ ${this.labelPosition === "left" ? n() : o}
54
54
  <input
55
55
  id=${this.id + "-internal"}
56
56
  class=${a}
@@ -65,7 +65,7 @@ let e = class extends k {
65
65
  ?checked=${this.checked}
66
66
  role=${this.isSwitch ? "switch" : "checkbox"}
67
67
  />
68
- ${this.labelPosition === "right" ? o() : n}
68
+ ${this.labelPosition === "right" ? n() : o}
69
69
  </div>
70
70
  </div>
71
71
  `;
@@ -0,0 +1,31 @@
1
+ "use strict";const t=require("./element-CJ_QKaki.cjs"),r=require("./input-element-KUsQQ-1d.cjs"),o=require("./ref-BFa5Utho.cjs"),n=require("./class-map-C_erArZz.cjs");var k=Object.defineProperty,u=Object.getOwnPropertyDescriptor,i=(p,e,h,c)=>{for(var s=c>1?void 0:c?u(e,h):e,l=p.length-1,a;l>=0;l--)(a=p[l])&&(s=(c?a(e,h,s):a(s))||s);return c&&s&&k(e,h,s),s};exports.PktCheckbox=class extends r.PktInputElement{constructor(){super(...arguments),this.inputRef=o.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.isSwitch=!1,this.labelPosition="right",this.hideLabel=!1,this.checked=null,this.type="checkbox",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut"}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,h,c){e==="defaultChecked"&&!this.checked&&(this.checked=this.defaultChecked),e==="checked"&&(this.checked=this.checked===""||this.checked==="true"||this.checked===!0,this.inputRef.value&&(this.inputRef.value.checked=this.checked)),super.attributeChangedCallback(e,h,c)}firstUpdated(e){e.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),super.firstUpdated(e)}updated(e){e.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),e.has("checked")&&this.inputRef.value&&(this.inputRef.value.checked=this.checked===""||this.checked==="true"||this.checked===!0),super.updated(e)}render(){const e=n.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),h=n.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),c=n.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-input-check__input-label--left":this.labelPosition==="left","pkt-input-check__input-label--right":this.labelPosition==="right","pkt-sr-only":this.hideLabel}),s="pkt-tag pkt-tag--small pkt-tag--thin-text",l=()=>t.x`
2
+ ${this.tagText?t.x`<span class=${s+" pkt-tag--gray"}>${this.tagText}</span>`:t.E}
3
+ ${this.optionalTag?t.x`<span class=${s+" pkt-tag--blue-light"}>${this.optionalText}</span>`:t.E}
4
+ ${this.requiredTag?t.x`<span class=${s+" pkt-tag--beige"}>${this.requiredText}</span>`:t.E}
5
+ `,a=()=>t.x`
6
+ <label class=${c} for=${this.id+"-internal"}>
7
+ ${this.label} ${l()}
8
+ ${this.checkHelptext?t.x`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:t.E}
9
+ </label>
10
+ `;return t.x`
11
+ <div class="pkt-input-check">
12
+ <div class=${e}>
13
+ ${this.labelPosition==="left"?a():t.E}
14
+ <input
15
+ id=${this.id+"-internal"}
16
+ class=${h}
17
+ type="checkbox"
18
+ ?disabled=${this.disabled}
19
+ name=${this.name+"-internal"}
20
+ ${o.n(this.inputRef)}
21
+ @change=${this.handleChange}
22
+ @click=${this.handleClick}
23
+ @blur=${this.onBlur}
24
+ @focus=${this.onFocus}
25
+ ?checked=${this.checked}
26
+ role=${this.isSwitch?"switch":"checkbox"}
27
+ />
28
+ ${this.labelPosition==="right"?a():t.E}
29
+ </div>
30
+ </div>
31
+ `}handleClick(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),!1}handleChange(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),!1;this.toggleChecked(e)}toggleChecked(e){if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}const h=e.target;if(h&&h.disabled){e.preventDefault(),e.stopImmediatePropagation();return}e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this.checked=this.inputRef.value.matches(":checked"),this.valueChecked(this.checked))}};i([t.n({type:String,reflect:!0})],exports.PktCheckbox.prototype,"value",2);i([t.n({type:String})],exports.PktCheckbox.prototype,"checkHelptext",2);i([t.n({type:Boolean})],exports.PktCheckbox.prototype,"defaultChecked",2);i([t.n({type:Boolean})],exports.PktCheckbox.prototype,"hasTile",2);i([t.n({type:Boolean})],exports.PktCheckbox.prototype,"isSwitch",2);i([t.n({type:String})],exports.PktCheckbox.prototype,"labelPosition",2);i([t.n({type:Boolean})],exports.PktCheckbox.prototype,"hideLabel",2);i([t.n({type:Boolean,reflect:!0})],exports.PktCheckbox.prototype,"checked",2);i([t.n({type:String,reflect:!0})],exports.PktCheckbox.prototype,"type",2);i([t.n({type:String})],exports.PktCheckbox.prototype,"tagText",2);i([t.n({type:Boolean})],exports.PktCheckbox.prototype,"optionalTag",2);i([t.n({type:String})],exports.PktCheckbox.prototype,"optionalText",2);i([t.n({type:Boolean})],exports.PktCheckbox.prototype,"requiredTag",2);i([t.n({type:String})],exports.PktCheckbox.prototype,"requiredText",2);exports.PktCheckbox=i([t.t("pkt-checkbox")],exports.PktCheckbox);
@@ -1,4 +1,4 @@
1
- "use strict";const a=require("./element-CJ_QKaki.cjs"),c=require("./if-defined-Bc9-_I01.cjs"),d=require("./state-DSjcvzDN.cjs"),r=require("./ref-BFa5Utho.cjs"),y=require("./class-map-C_erArZz.cjs"),O=require("./repeat-BZb41H64.cjs"),$=require("./input-element-j9znzLWz.cjs"),I=require("./pkt-options-controller-CiuBG6Lt.cjs"),w=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-D9kFsTCN.cjs");require("./icon-BGuizDwk.cjs");require("./tag-EFUKrc8q.cjs");require("./listbox-CsGiqzD0.cjs");const C={displayValueAs:{default:"label"}},R={props:C};var V=Object.defineProperty,A=Object.getOwnPropertyDescriptor,h=(v,e,t,i)=>{for(var s=i>1?void 0:i?A(e,t):e,n=v.length-1,l;n>=0;n--)(l=v[n])&&(s=(i?l(e,t,s):l(s))||s);return i&&s&&V(e,t,s),s};exports.PktCombobox=class extends $.PktInputElement{constructor(){super(),this.helptextSlot=r.e(),this.value="",this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder="",this.multiple=!1,this.maxlength=null,this.displayValueAs=R.props.displayValueAs.default,this.tagPlacement=null,this._options=[],this._isOptionsOpen=!1,this._value=[],this._userInfoMessage="",this._addValueText=null,this._maxIsReached=!1,this._search="",this._inputFocus=!1,this._editingSingleValue=!1,this.inputRef=r.e(),this.arrowRef=r.e(),this.listboxRef=r.e(),this.focusRef=r.e(),this.optionTagRef=r.e(),this.optionsController=new I.PktOptionsSlotController(this),this.slotController=new w.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){var e;if(super.connectedCallback(),document&&document.body.addEventListener("click",t=>{this._isOptionsOpen&&!this.contains(t.target)&&this.handleFocusOut(t)}),this._options=[],this.defaultOptions&&this.defaultOptions.length){const t=((e=this.options)==null?void 0:e.filter(i=>i.userAdded))||[];this.options=[...t,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(this.optionsController.nodes.length){const t=[];this.optionsController.nodes.forEach(i=>{if(!i.textContent&&!i.getAttribute("value"))return null;const s={value:i.getAttribute("value")||i.textContent||"",label:i.textContent||i.getAttribute("value")||""};i.getAttribute("data-prefix")&&(s.prefix=i.getAttribute("data-prefix")||void 0),i.getAttribute("tagskincolor")&&(s.tagSkinColor=i.getAttribute("tagskincolor")),i.getAttribute("description")&&(s.description=i.getAttribute("description")||void 0),s.fulltext=s.value+s.label+(s.prefix||""),t.push(s)}),t.length&&(this.options=[...t],this._options=[...t])}}updated(e){if(e.has("_value")&&this.valueChanged(this._value,e.get("_value")),e.has("value")&&(Array.isArray(this.value)?this._value=this.value:this.value&&this.multiple?this._value=this.value.split(","):this.value?this._value=[this.value]:this._value=[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]]),this.isMaxItemsReached()),e.has("defaultOptions")&&this.defaultOptions.length){const t=(Array.isArray(this.options)?this.options:[]).filter(i=>i.userAdded)||[];this.options=[...t,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(e.has("options")){const s=(e.get("options")||this._options||[]).filter(l=>l&&l.userAdded).filter(l=>!(Array.isArray(this.options)?this.options:[]).some(o=>o.value===l.value)),n=[...s,...this.options];this._options=n,s.length>0&&(this.options=n),this._options.forEach(l=>{if(l.value&&!l.label&&(l.label=l.value),l.selected&&!this._value.includes(l.value)){const o=[...this._value];this._value=[...this._value,l.value],this.valueChanged(this._value,o)}l.fulltext=l.value+l.label+(l.prefix||""),l.selected=l.selected||this._value.includes(l.value)})}e.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),super.updated(e)}attributeChangedCallback(e,t,i){e==="value"&&(Array.isArray(this.value)?this._value=this.value:this.value&&this.multiple?this._value=this.value.split(","):this.value?this._value=[this.value]:this._value=[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]])),e==="options"&&(this._options=Array.isArray(this.options)?[...this.options]:[],this._options.forEach(s=>{s.value&&!s.label&&(s.label=s.value),s.selected&&!this._value.includes(s.value)&&(this._value=[...this._value,s.value]),s.fulltext=s.value+s.label+(s.prefix||"")}),this._search=""),super.attributeChangedCallback(e,t,i)}render(){return a.x`
1
+ "use strict";const a=require("./element-CJ_QKaki.cjs"),c=require("./if-defined-Bc9-_I01.cjs"),d=require("./state-DSjcvzDN.cjs"),r=require("./ref-BFa5Utho.cjs"),y=require("./class-map-C_erArZz.cjs"),O=require("./repeat-BZb41H64.cjs"),$=require("./input-element-KUsQQ-1d.cjs"),I=require("./pkt-options-controller-CiuBG6Lt.cjs"),w=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-B-Qseywc.cjs");require("./icon-BGuizDwk.cjs");require("./tag-EFUKrc8q.cjs");require("./listbox-DnoqOo5u.cjs");const C={displayValueAs:{default:"label"}},R={props:C};var V=Object.defineProperty,A=Object.getOwnPropertyDescriptor,h=(v,e,t,i)=>{for(var s=i>1?void 0:i?A(e,t):e,n=v.length-1,l;n>=0;n--)(l=v[n])&&(s=(i?l(e,t,s):l(s))||s);return i&&s&&V(e,t,s),s};exports.PktCombobox=class extends $.PktInputElement{constructor(){super(),this.helptextSlot=r.e(),this.value="",this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder="",this.multiple=!1,this.maxlength=null,this.displayValueAs=R.props.displayValueAs.default,this.tagPlacement=null,this._options=[],this._isOptionsOpen=!1,this._value=[],this._userInfoMessage="",this._addValueText=null,this._maxIsReached=!1,this._search="",this._inputFocus=!1,this._editingSingleValue=!1,this.inputRef=r.e(),this.arrowRef=r.e(),this.listboxRef=r.e(),this.focusRef=r.e(),this.optionTagRef=r.e(),this.optionsController=new I.PktOptionsSlotController(this),this.slotController=new w.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){var e;if(super.connectedCallback(),document&&document.body.addEventListener("click",t=>{this._isOptionsOpen&&!this.contains(t.target)&&this.handleFocusOut(t)}),this._options=[],this.defaultOptions&&this.defaultOptions.length){const t=((e=this.options)==null?void 0:e.filter(i=>i.userAdded))||[];this.options=[...t,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(this.optionsController.nodes.length){const t=[];this.optionsController.nodes.forEach(i=>{if(!i.textContent&&!i.getAttribute("value"))return null;const s={value:i.getAttribute("value")||i.textContent||"",label:i.textContent||i.getAttribute("value")||""};i.getAttribute("data-prefix")&&(s.prefix=i.getAttribute("data-prefix")||void 0),i.getAttribute("tagskincolor")&&(s.tagSkinColor=i.getAttribute("tagskincolor")),i.getAttribute("description")&&(s.description=i.getAttribute("description")||void 0),s.fulltext=s.value+s.label+(s.prefix||""),t.push(s)}),t.length&&(this.options=[...t],this._options=[...t])}}updated(e){if(e.has("_value")&&this.valueChanged(this._value,e.get("_value")),e.has("value")&&(Array.isArray(this.value)?this._value=this.value:this.value&&this.multiple?this._value=this.value.split(","):this.value?this._value=[this.value]:this._value=[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]]),this.isMaxItemsReached()),e.has("defaultOptions")&&this.defaultOptions.length){const t=(Array.isArray(this.options)?this.options:[]).filter(i=>i.userAdded)||[];this.options=[...t,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(e.has("options")){const s=(e.get("options")||this._options||[]).filter(l=>l&&l.userAdded).filter(l=>!(Array.isArray(this.options)?this.options:[]).some(o=>o.value===l.value)),n=[...s,...this.options];this._options=n,s.length>0&&(this.options=n),this._options.forEach(l=>{if(l.value&&!l.label&&(l.label=l.value),l.selected&&!this._value.includes(l.value)){const o=[...this._value];this._value=[...this._value,l.value],this.valueChanged(this._value,o)}l.fulltext=l.value+l.label+(l.prefix||""),l.selected=l.selected||this._value.includes(l.value)})}e.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),super.updated(e)}attributeChangedCallback(e,t,i){e==="value"&&(Array.isArray(this.value)?this._value=this.value:this.value&&this.multiple?this._value=this.value.split(","):this.value?this._value=[this.value]:this._value=[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]])),e==="options"&&(this._options=Array.isArray(this.options)?[...this.options]:[],this._options.forEach(s=>{s.value&&!s.label&&(s.label=s.value),s.selected&&!this._value.includes(s.value)&&(this._value=[...this._value,s.value]),s.fulltext=s.value+s.label+(s.prefix||"")}),this._search=""),super.attributeChangedCallback(e,t,i)}render(){return a.x`
2
2
  <pkt-input-wrapper
3
3
  .label=${this.label}
4
4
  .helptext=${this.helptext}
@@ -4,13 +4,13 @@ import { r as c } from "./state-DS_kr2Fy.js";
4
4
  import { e as _, n as v } from "./ref-Xa5dbh--.js";
5
5
  import { e as k } from "./class-map-wy7PUk0P.js";
6
6
  import { c as R } from "./repeat-CJ79egkN.js";
7
- import { P as V } from "./input-element-BcFmygSF.js";
7
+ import { P as V } from "./input-element-Dqu8udwd.js";
8
8
  import { P as A } from "./pkt-options-controller-CZO1nxZ8.js";
9
9
  import { P as C } from "./pkt-slot-controller-BPGj-LC5.js";
10
- import "./input-wrapper-CiqUL7my.js";
10
+ import "./input-wrapper-Wu3Yv-bn.js";
11
11
  import "./icon-1dy7UZcu.js";
12
12
  import "./tag-CqMgt01I.js";
13
- import "./listbox-DlJevu8O.js";
13
+ import "./listbox-mvKKzH-v.js";
14
14
  const S = { displayValueAs: { default: "label" } }, T = {
15
15
  props: S
16
16
  };