@oslokommune/punkt-elements 12.4.3 → 12.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/class-map-Ch54kkX5.cjs +5 -0
  2. package/dist/{class-map-CL_lSLwn.js → class-map-DunDFQn7.js} +8 -8
  3. package/dist/{directive-DA0-wdk7.js → directive-Cxhakbpr.js} +3 -3
  4. package/dist/{directive-19_ixLKS.cjs → directive-DtixNHDT.cjs} +1 -1
  5. package/dist/{index-Bc9mksHI.cjs → index-BR7VtlYg.cjs} +14 -14
  6. package/dist/index-Bpc07w_P.cjs +9 -0
  7. package/dist/{index-m5WP1NKD.js → index-CsTujnXs.js} +93 -93
  8. package/dist/index-CyqOyy_9.js +88 -0
  9. package/dist/{index-BUZITHLd.cjs → index-DSyh6tUw.cjs} +8 -8
  10. package/dist/{index-DQ5xnGw6.js → index-dgAzBeRk.js} +10 -13
  11. package/dist/index.d.ts +5 -8
  12. package/dist/pkt-alert.cjs +8 -8
  13. package/dist/pkt-alert.js +20 -20
  14. package/dist/pkt-calendar.cjs +1 -1
  15. package/dist/pkt-calendar.js +5 -5
  16. package/dist/pkt-card.cjs +10 -10
  17. package/dist/pkt-card.js +7 -7
  18. package/dist/pkt-component-template.cjs +6 -6
  19. package/dist/pkt-component-template.js +14 -14
  20. package/dist/pkt-datepicker.cjs +48 -48
  21. package/dist/pkt-datepicker.js +32 -32
  22. package/dist/pkt-element.cjs +1 -1
  23. package/dist/pkt-element.js +1 -1
  24. package/dist/pkt-icon.cjs +1 -1
  25. package/dist/pkt-icon.js +3 -3
  26. package/dist/pkt-index.cjs +1 -1
  27. package/dist/pkt-index.js +2 -2
  28. package/dist/pkt-input-wrapper.cjs +28 -28
  29. package/dist/pkt-input-wrapper.js +8 -8
  30. package/dist/pkt-link.cjs +4 -4
  31. package/dist/pkt-link.js +9 -9
  32. package/dist/pkt-messagebox.cjs +6 -6
  33. package/dist/pkt-messagebox.js +7 -7
  34. package/dist/pkt-tag.cjs +8 -8
  35. package/dist/pkt-tag.js +11 -11
  36. package/dist/{ref-bNNrgsqL.js → ref-By_W8A-f.js} +41 -41
  37. package/dist/ref-C3InMDfU.cjs +13 -0
  38. package/package.json +3 -3
  39. package/src/components/calendar/index.ts +0 -7
  40. package/src/components/icon/index.ts +16 -12
  41. package/dist/class-map-BQ5k1q3A.cjs +0 -5
  42. package/dist/index-BFqUD8HI.cjs +0 -9
  43. package/dist/index-exzYRW0z.js +0 -82
  44. package/dist/ref-BdbjJbqo.cjs +0 -13
@@ -0,0 +1,5 @@
1
+ "use strict";const a=require("./index-DSyh6tUw.cjs"),r=require("./directive-DtixNHDT.cjs");/**
2
+ * @license
3
+ * Copyright 2018 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */const c=r.e(class extends r.i{constructor(s){var e;if(super(s),s.type!==r.t$1.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var i,o;if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>t!=="")));for(const t in e)e[t]&&!((i=this.nt)!=null&&i.has(t))&&this.st.add(t);return this.render(e)}const n=s.element.classList;for(const t of this.st)t in e||(n.remove(t),this.st.delete(t));for(const t in e){const h=!!e[t];h===this.st.has(t)||(o=this.nt)!=null&&o.has(t)||(h?(n.add(t),this.st.add(t)):(n.remove(t),this.st.delete(t)))}return a.T}});exports.e=c;
@@ -1,5 +1,5 @@
1
- import { R as a } from "./index-m5WP1NKD.js";
2
- import { e as h, i as d, a as c } from "./directive-DA0-wdk7.js";
1
+ import { T as a } from "./index-CsTujnXs.js";
2
+ import { e as h, i as d, a as c } from "./directive-Cxhakbpr.js";
3
3
  /**
4
4
  * @license
5
5
  * Copyright 2018 Google LLC
@@ -14,21 +14,21 @@ const u = h(class extends d {
14
14
  return " " + Object.keys(s).filter((e) => s[e]).join(" ") + " ";
15
15
  }
16
16
  update(s, [e]) {
17
- var r, n;
17
+ var n, i;
18
18
  if (this.st === void 0) {
19
19
  this.st = /* @__PURE__ */ new Set(), s.strings !== void 0 && (this.nt = new Set(s.strings.join(" ").split(/\s/).filter((t) => t !== "")));
20
- for (const t in e) e[t] && !((r = this.nt) != null && r.has(t)) && this.st.add(t);
20
+ for (const t in e) e[t] && !((n = this.nt) != null && n.has(t)) && this.st.add(t);
21
21
  return this.render(e);
22
22
  }
23
- const i = s.element.classList;
24
- for (const t of this.st) t in e || (i.remove(t), this.st.delete(t));
23
+ const r = s.element.classList;
24
+ for (const t of this.st) t in e || (r.remove(t), this.st.delete(t));
25
25
  for (const t in e) {
26
26
  const o = !!e[t];
27
- o === this.st.has(t) || (n = this.nt) != null && n.has(t) || (o ? (i.add(t), this.st.add(t)) : (i.remove(t), this.st.delete(t)));
27
+ o === this.st.has(t) || (i = this.nt) != null && i.has(t) || (o ? (r.add(t), this.st.add(t)) : (r.remove(t), this.st.delete(t)));
28
28
  }
29
29
  return a;
30
30
  }
31
31
  });
32
32
  export {
33
- u as R
33
+ u as e
34
34
  };
@@ -14,14 +14,14 @@ const r = (s) => (t, e) => {
14
14
  * SPDX-License-Identifier: BSD-3-Clause
15
15
  */
16
16
  const n = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, E = (s) => (...t) => ({ _$litDirective$: s, values: t });
17
- class T {
17
+ class $ {
18
18
  constructor(t) {
19
19
  }
20
20
  get _$AU() {
21
21
  return this._$AM._$AU;
22
22
  }
23
23
  _$AT(t, e, i) {
24
- this.t = t, this._$AM = e, this.i = i;
24
+ this._$Ct = t, this._$AM = e, this._$Ci = i;
25
25
  }
26
26
  _$AS(t, e) {
27
27
  return this.update(t, e);
@@ -33,6 +33,6 @@ class T {
33
33
  export {
34
34
  n as a,
35
35
  E as e,
36
- T as i,
36
+ $ as i,
37
37
  r as t
38
38
  };
@@ -6,4 +6,4 @@
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const n={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},E=i=>(...t)=>({_$litDirective$:i,values:t});class u{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this.t=t,this._$AM=e,this.i=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}exports.e=E;exports.i=u;exports.t=r;exports.t$1=n;
9
+ */const n={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},$=i=>(...t)=>({_$litDirective$:i,values:t});class E{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}exports.e=$;exports.i=E;exports.t=r;exports.t$1=n;
@@ -1,6 +1,6 @@
1
- "use strict";const a=require("./index-BUZITHLd.cjs"),v=require("./converters-DhM11VlY.cjs"),O=require("./directive-19_ixLKS.cjs"),$=require("./class-map-BQ5k1q3A.cjs");require("./index-BFqUD8HI.cjs");function k(i){const e=Object.prototype.toString.call(i);return i instanceof Date||typeof i=="object"&&e==="[object Date]"?new i.constructor(+i):typeof i=="number"||e==="[object Number]"||typeof i=="string"||e==="[object String]"?new Date(i):new Date(NaN)}function D(i,e){return i instanceof Date?new i.constructor(e):new Date(e)}const S=6048e5,P=864e5;let _={};function w(){return _}function m(i,e){var h,c,d,u;const t=w(),s=(e==null?void 0:e.weekStartsOn)??((c=(h=e==null?void 0:e.locale)==null?void 0:h.options)==null?void 0:c.weekStartsOn)??t.weekStartsOn??((u=(d=t.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,n=k(i),r=n.getDay(),l=(r<s?7:0)+r-s;return n.setDate(n.getDate()-l),n.setHours(0,0,0,0),n}function b(i,e){const t=k(i.start),s=k(i.end);let n=+t>+s;const r=n?+t:+s,l=n?s:t;l.setHours(0,0,0,0);let h=1;const c=[];for(;+l<=r;)c.push(k(l)),l.setDate(l.getDate()+h),l.setHours(0,0,0,0);return n?c.reverse():c}function M(i,e){var u,p,f,y;const t=k(i),s=t.getFullYear(),n=w(),r=(e==null?void 0:e.firstWeekContainsDate)??((p=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:p.firstWeekContainsDate)??n.firstWeekContainsDate??((y=(f=n.locale)==null?void 0:f.options)==null?void 0:y.firstWeekContainsDate)??1,l=D(i,0);l.setFullYear(s+1,0,r),l.setHours(0,0,0,0);const h=m(l,e),c=D(i,0);c.setFullYear(s,0,r),c.setHours(0,0,0,0);const d=m(c,e);return t.getTime()>=h.getTime()?s+1:t.getTime()>=d.getTime()?s:s-1}function A(i,e){var h,c,d,u;const t=w(),s=(e==null?void 0:e.firstWeekContainsDate)??((c=(h=e==null?void 0:e.locale)==null?void 0:h.options)==null?void 0:c.firstWeekContainsDate)??t.firstWeekContainsDate??((u=(d=t.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??1,n=M(i,e),r=D(i,0);return r.setFullYear(n,0,s),r.setHours(0,0,0,0),m(r,e)}function x(i,e){const t=k(i),s=+m(t,e)-+A(t,e);return Math.round(s/S)+1}function I(i){let t=k(i).getDay();return t===0&&(t=7),t}const T="pkt-calendar",E={id:{type:"string",name:"ID",description:"Unique identifier for the calendar"},currentmonth:{type:"date",converter:"stringToDate",description:"The current month to display"},selected:{type:"array",converter:"csvToArray",reflect:!0,items:{type:"date"},description:"Array of selected dates"},excludeweekdays:{type:"array",converter:"csvToArray",items:{type:"string"},description:"Array of weekdays (1-7) to exclude"},excludedates:{type:"array",converter:"stringsToDate",items:{type:"date"},description:"Array of specific dates to exclude"},earliest:{type:"date",converter:"stringToDate",default:null,description:"Earliest selectable date"},latest:{type:"date",converter:"stringToDate",default:null,description:"Latest selectable date"},weeknumbers:{type:"boolean",reflect:!0,default:!1,description:"Show week numbers in calendar"},withcontrols:{type:"boolean",reflect:!0,default:!1,description:"Show month and year navigation controls"},multiple:{type:"boolean",reflect:!0,default:!1,description:"Allow multiple date selection"},maxMultiple:{type:"number",default:4,description:"Maximum number of dates that can be selected"},range:{type:"boolean",reflect:!0,default:!1,description:"Allow date range selection"}},R={"date-selected":{description:"Returns ISO formatted date string"}},g={name:T,"css-class":"pkt-calendar",props:E,events:R};var H=Object.defineProperty,W=Object.getOwnPropertyDescriptor,o=(i,e,t,s)=>{for(var n=s>1?void 0:s?W(e,t):e,r=i.length-1,l;r>=0;r--)(l=i[r])&&(n=(s?l(e,t,n):l(n))||n);return s&&n&&H(e,t,n),n};exports.PktCalendar=class extends a.PktElement{constructor(){super(),this.multiple=g.props.multiple.default,this.maxMultiple=g.props.maxMultiple.default,this.range=g.props.range.default,this.weeknumbers=g.props.weeknumbers.default,this.withcontrols=g.props.withcontrols.default,this.selected=[],this.earliest=g.props.earliest.default,this.latest=g.props.latest.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.dayStrings=this.strings.dates.daysShort,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}connectedCallback(){super.connectedCallback()}disconnectedCallback(){this.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback()}attributeChangedCallback(e,t,s){e==="selected"&&s&&this.convertSelected(),super.attributeChangedCallback(e,t,s)}updated(e){e.has("selected")&&this.convertSelected(),super.updated(e)}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(e=>new Date(e)),this.range&&this.selected.length===2){const e=b({start:new Date(this.selected[0]),end:new Date(this.selected[1])});if(this.inRange={},Array.isArray(e)&&e.length){const t={};for(let s=0;s<e.length;s++)t[this.formatISODate(e[s])]=this.isInRange(e[s]);this.inRange=t}}this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched){this.currentmonthtouched=!0;return}this.selected.length&&this.selected[0]!==""?this.currentmonth=new Date(this.selected[this.selected.length-1]):this.currentmonth===null&&(this.currentmonth=new Date),this.year=this.currentmonth.getFullYear(),this.month=this.currentmonth.getMonth()}handleKeydown(e){switch(e.key){case"ArrowLeft":this.handleArrowKey(e,-1);break;case"ArrowRight":this.handleArrowKey(e,1);break;case"ArrowUp":this.handleArrowKey(e,-7);break;case"ArrowDown":this.handleArrowKey(e,7);break}}handleArrowKey(e,t){if(e.preventDefault(),!this.focusedDate)return;const s=new Date(this.focusedDate);let n=new Date(s.setDate(s.getDate()+t));if(n){let r=this.querySelector(`div[data-date="${this.formatISODate(n)}"]`);if(r instanceof HTMLDivElement){if(r.dataset.disabled){let l=new Date(s.setDate(s.getDate()+t)),h=this.querySelector(`div[data-date="${this.formatISODate(l)}"]`);for(;h&&h instanceof HTMLDivElement&&h.dataset.disabled;)l=new Date(l.setDate(l.getDate()+t)),h=this.querySelector(`div[data-date="${this.formatISODate(l)}"]`);r=h}r instanceof HTMLDivElement&&!r.dataset.disabled&&r.focus()}}}render(){return a.ke`
1
+ "use strict";const a=require("./index-DSyh6tUw.cjs"),v=require("./converters-DhM11VlY.cjs"),O=require("./directive-DtixNHDT.cjs"),$=require("./class-map-Ch54kkX5.cjs");require("./index-Bpc07w_P.cjs");function k(i){const e=Object.prototype.toString.call(i);return i instanceof Date||typeof i=="object"&&e==="[object Date]"?new i.constructor(+i):typeof i=="number"||e==="[object Number]"||typeof i=="string"||e==="[object String]"?new Date(i):new Date(NaN)}function D(i,e){return i instanceof Date?new i.constructor(e):new Date(e)}const S=6048e5,P=864e5;let _={};function w(){return _}function m(i,e){var h,c,d,u;const t=w(),s=(e==null?void 0:e.weekStartsOn)??((c=(h=e==null?void 0:e.locale)==null?void 0:h.options)==null?void 0:c.weekStartsOn)??t.weekStartsOn??((u=(d=t.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,n=k(i),r=n.getDay(),l=(r<s?7:0)+r-s;return n.setDate(n.getDate()-l),n.setHours(0,0,0,0),n}function b(i,e){const t=k(i.start),s=k(i.end);let n=+t>+s;const r=n?+t:+s,l=n?s:t;l.setHours(0,0,0,0);let h=1;const c=[];for(;+l<=r;)c.push(k(l)),l.setDate(l.getDate()+h),l.setHours(0,0,0,0);return n?c.reverse():c}function x(i,e){var u,p,f,y;const t=k(i),s=t.getFullYear(),n=w(),r=(e==null?void 0:e.firstWeekContainsDate)??((p=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:p.firstWeekContainsDate)??n.firstWeekContainsDate??((y=(f=n.locale)==null?void 0:f.options)==null?void 0:y.firstWeekContainsDate)??1,l=D(i,0);l.setFullYear(s+1,0,r),l.setHours(0,0,0,0);const h=m(l,e),c=D(i,0);c.setFullYear(s,0,r),c.setHours(0,0,0,0);const d=m(c,e);return t.getTime()>=h.getTime()?s+1:t.getTime()>=d.getTime()?s:s-1}function A(i,e){var h,c,d,u;const t=w(),s=(e==null?void 0:e.firstWeekContainsDate)??((c=(h=e==null?void 0:e.locale)==null?void 0:h.options)==null?void 0:c.firstWeekContainsDate)??t.firstWeekContainsDate??((u=(d=t.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??1,n=x(i,e),r=D(i,0);return r.setFullYear(n,0,s),r.setHours(0,0,0,0),m(r,e)}function M(i,e){const t=k(i),s=+m(t,e)-+A(t,e);return Math.round(s/S)+1}function I(i){let t=k(i).getDay();return t===0&&(t=7),t}const T="pkt-calendar",E={id:{type:"string",name:"ID",description:"Unique identifier for the calendar"},currentmonth:{type:"date",converter:"stringToDate",description:"The current month to display"},selected:{type:"array",converter:"csvToArray",reflect:!0,items:{type:"date"},description:"Array of selected dates"},excludeweekdays:{type:"array",converter:"csvToArray",items:{type:"string"},description:"Array of weekdays (1-7) to exclude"},excludedates:{type:"array",converter:"stringsToDate",items:{type:"date"},description:"Array of specific dates to exclude"},earliest:{type:"date",converter:"stringToDate",default:null,description:"Earliest selectable date"},latest:{type:"date",converter:"stringToDate",default:null,description:"Latest selectable date"},weeknumbers:{type:"boolean",reflect:!0,default:!1,description:"Show week numbers in calendar"},withcontrols:{type:"boolean",reflect:!0,default:!1,description:"Show month and year navigation controls"},multiple:{type:"boolean",reflect:!0,default:!1,description:"Allow multiple date selection"},maxMultiple:{type:"number",default:4,description:"Maximum number of dates that can be selected"},range:{type:"boolean",reflect:!0,default:!1,description:"Allow date range selection"}},H={"date-selected":{description:"Returns ISO formatted date string"}},g={name:T,"css-class":"pkt-calendar",props:E,events:H};var R=Object.defineProperty,W=Object.getOwnPropertyDescriptor,o=(i,e,t,s)=>{for(var n=s>1?void 0:s?W(e,t):e,r=i.length-1,l;r>=0;r--)(l=i[r])&&(n=(s?l(e,t,n):l(n))||n);return s&&n&&R(e,t,n),n};exports.PktCalendar=class extends a.PktElement{constructor(){super(...arguments),this.multiple=g.props.multiple.default,this.maxMultiple=g.props.maxMultiple.default,this.range=g.props.range.default,this.weeknumbers=g.props.weeknumbers.default,this.withcontrols=g.props.withcontrols.default,this.selected=[],this.earliest=g.props.earliest.default,this.latest=g.props.latest.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.dayStrings=this.strings.dates.daysShort,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}connectedCallback(){super.connectedCallback()}disconnectedCallback(){this.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback()}attributeChangedCallback(e,t,s){e==="selected"&&s&&this.convertSelected(),super.attributeChangedCallback(e,t,s)}updated(e){e.has("selected")&&this.convertSelected(),super.updated(e)}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(e=>new Date(e)),this.range&&this.selected.length===2){const e=b({start:new Date(this.selected[0]),end:new Date(this.selected[1])});if(this.inRange={},Array.isArray(e)&&e.length){const t={};for(let s=0;s<e.length;s++)t[this.formatISODate(e[s])]=this.isInRange(e[s]);this.inRange=t}}this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched){this.currentmonthtouched=!0;return}this.selected.length&&this.selected[0]!==""?this.currentmonth=new Date(this.selected[this.selected.length-1]):this.currentmonth===null&&(this.currentmonth=new Date),this.year=this.currentmonth.getFullYear(),this.month=this.currentmonth.getMonth()}handleKeydown(e){switch(e.key){case"ArrowLeft":this.handleArrowKey(e,-1);break;case"ArrowRight":this.handleArrowKey(e,1);break;case"ArrowUp":this.handleArrowKey(e,-7);break;case"ArrowDown":this.handleArrowKey(e,7);break}}handleArrowKey(e,t){if(e.preventDefault(),!this.focusedDate)return;const s=new Date(this.focusedDate);let n=new Date(s.setDate(s.getDate()+t));if(n){let r=this.querySelector(`div[data-date="${this.formatISODate(n)}"]`);if(r instanceof HTMLDivElement){if(r.dataset.disabled){let l=new Date(s.setDate(s.getDate()+t)),h=this.querySelector(`div[data-date="${this.formatISODate(l)}"]`);for(;h&&h instanceof HTMLDivElement&&h.dataset.disabled;)l=new Date(l.setDate(l.getDate()+t)),h=this.querySelector(`div[data-date="${this.formatISODate(l)}"]`);r=h}r instanceof HTMLDivElement&&!r.dataset.disabled&&r.focus()}}}render(){return a.x`
2
2
  <div
3
- class="pkt-calendar ${this.weeknumbers?"pkt-cal-weeknumbers":a.D}"
3
+ class="pkt-calendar ${this.weeknumbers?"pkt-cal-weeknumbers":a.E}"
4
4
  @focusout=${this.closeEvent}
5
5
  @keydown=${e=>{e.key==="Escape"&&(e.preventDefault(),this.close())}}
6
6
  >
@@ -9,7 +9,7 @@
9
9
  @click=${this.isPrevMonthAllowed()&&this.prevMonth}
10
10
  @keydown=${e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.isNextMonthAllowed()&&this.prevMonth())}}
11
11
  class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
12
- .data-disabled=${this.isPrevMonthAllowed()?a.D:"disabled"}
12
+ .data-disabled=${this.isPrevMonthAllowed()?a.E:"disabled"}
13
13
  ?aria-disabled=${!this.isPrevMonthAllowed()}
14
14
  tabindex="0"
15
15
  >
@@ -21,7 +21,7 @@
21
21
  @click=${this.isNextMonthAllowed()&&this.nextMonth}
22
22
  @keydown=${e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.isNextMonthAllowed()&&this.nextMonth())}}
23
23
  class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
24
- .data-disabled=${this.isNextMonthAllowed()?a.D:"disabled"}
24
+ .data-disabled=${this.isNextMonthAllowed()?a.E:"disabled"}
25
25
  ?aria-disabled=${!this.isNextMonthAllowed()}
26
26
  tabindex="0"
27
27
  >
@@ -37,14 +37,14 @@
37
37
  ${this.renderDayNames()} ${this.renderCalendarBody()}
38
38
  </table>
39
39
  </div>
40
- `}renderDayNames(){const e=[];this.weeknumbers&&e.push(a.ke`<td><div>${this.weekString}<div></td>`);for(let t=0;t<this.dayStrings.length;t++)e.push(a.ke`<td><div>${this.dayStrings[t]}</div></td>`);return a.ke`<tr class="pkt-cal-week-row" role="presentation">
40
+ `}renderDayNames(){const e=[];this.weeknumbers&&e.push(a.x`<td><div>${this.weekString}<div></td>`);for(let t=0;t<this.dayStrings.length;t++)e.push(a.x`<td><div>${this.dayStrings[t]}</div></td>`);return a.x`<tr class="pkt-cal-week-row" role="presentation">
41
41
  ${e}
42
- </tr>`}renderMonthNav(){let e=[];return this.withcontrols?e.push(a.ke`<div class="pkt-cal-month-picker">
42
+ </tr>`}renderMonthNav(){let e=[];return this.withcontrols?e.push(a.x`<div class="pkt-cal-month-picker">
43
43
  <select
44
44
  class="pkt-input pkt-input-compact"
45
45
  @change=${t=>{this.changeMonth(this.year,t.target.value)}}
46
46
  >
47
- ${this.monthStrings.map((t,s)=>a.ke`<option value=${s} ?selected=${this.month===s}>${t}</option>`)}
47
+ ${this.monthStrings.map((t,s)=>a.x`<option value=${s} ?selected=${this.month===s}>${t}</option>`)}
48
48
  </select>
49
49
  <input
50
50
  class="pkt-input pkt-cal-input-year pkt-input-compact"
@@ -54,9 +54,9 @@
54
54
  @change=${t=>{this.changeMonth(t.target.value,this.month)}}
55
55
  .value=${this.year}
56
56
  />
57
- </div> `):e.push(a.ke`<div class="pkt-txt-16-medium" aria-live="polite">
57
+ </div> `):e.push(a.x`<div class="pkt-txt-16-medium" aria-live="polite">
58
58
  ${this.monthStrings[this.month]} ${this.year}
59
- </div>`),e}renderDayView(e,t,s){const n=new Date(this.year,this.month,e,12),r=this.formatISODate(n),l=r===this.formatISODate(t),h=this.selected.includes(r),c=this.isExcluded(s,n)||!h&&this.multiple&&this.maxMultiple>0&&this.selected.length>=this.maxMultiple,d=this.focusedDate?this.focusedDate===r?"0":"-1":e===1?"0":"-1";this.selectableDates.push({currentDateISO:r,isDisabled:c});const u={"pkt-cal-today":l,"pkt-cal-selected":h,"pkt-cal-in-range":this.inRange[r],"pkt-cal-excluded":this.isExcluded(s,n),"pkt-cal-in-range-first":this.range&&(this.selected.length===2||this.rangeHovered!==null)&&r===this.selected[0],"pkt-cal-in-range-last":this.range&&this.selected.length===2&&r===this.selected[1],"pkt-cal-range-hover":this.rangeHovered!==null&&r===this.formatISODate(this.rangeHovered)};return a.ke`<td class=${$.Rt(u)}>
59
+ </div>`),e}renderDayView(e,t,s){const n=new Date(this.year,this.month,e,12),r=this.formatISODate(n),l=r===this.formatISODate(t),h=this.selected.includes(r),c=this.isExcluded(s,n)||!h&&this.multiple&&this.maxMultiple>0&&this.selected.length>=this.maxMultiple,d=this.focusedDate?this.focusedDate===r?"0":"-1":e===1?"0":"-1";this.selectableDates.push({currentDateISO:r,isDisabled:c});const u={"pkt-cal-today":l,"pkt-cal-selected":h,"pkt-cal-in-range":this.inRange[r],"pkt-cal-excluded":this.isExcluded(s,n),"pkt-cal-in-range-first":this.range&&(this.selected.length===2||this.rangeHovered!==null)&&r===this.selected[0],"pkt-cal-in-range-last":this.range&&this.selected.length===2&&r===this.selected[1],"pkt-cal-range-hover":this.rangeHovered!==null&&r===this.formatISODate(this.rangeHovered)};return a.x`<td class=${$.e(u)}>
60
60
  <div
61
61
  ?aria-selected=${h}
62
62
  role="gridcell"
@@ -64,27 +64,27 @@
64
64
  @mouseover=${()=>this.range&&!this.isExcluded(s,n)&&this.handleRangeHover(n)}
65
65
  @focus=${()=>{this.range&&!this.isExcluded(s,n)&&this.handleRangeHover(n),this.focusedDate=r}}
66
66
  tabindex=${d}
67
- data-disabled=${c?"disabled":a.D}
67
+ data-disabled=${c?"disabled":a.E}
68
68
  data-date=${r}
69
69
  @keydown=${p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),this.handleDateSelect(n))}}
70
70
  @click=${p=>{c||(p.preventDefault(),this.handleDateSelect(n))}}
71
71
  >
72
72
  <span class="pkt-btn__text pkt-txt-14-light">${e}</span>
73
73
  </div>
74
- </td>`}renderCalendarBody(){const e=new Date,t=new Date(this.year,this.month,1,12),s=new Date(this.year,this.month+1,0,12),n=(t.getDay()+6)%7,r=s.getDate(),l=Math.ceil((r+n)/7),c=new Date(this.year,this.month,0,12).getDate();let d=1;this.week=x(new Date(this.year,this.month,1,12));const u=[];for(let p=0;p<l;p++){const f=[];this.weeknumbers&&f.push(a.ke`<td class="pkt-cal-week">${this.week}</td>`),this.week++;for(let y=1;y<8;y++)if(p===0&&y<n+1){const C=c-(n-y);f.push(a.ke`<td class="pkt-cal-other">
74
+ </td>`}renderCalendarBody(){const e=new Date,t=new Date(this.year,this.month,1,12),s=new Date(this.year,this.month+1,0,12),n=(t.getDay()+6)%7,r=s.getDate(),l=Math.ceil((r+n)/7),c=new Date(this.year,this.month,0,12).getDate();let d=1;this.week=M(new Date(this.year,this.month,1,12));const u=[];for(let p=0;p<l;p++){const f=[];this.weeknumbers&&f.push(a.x`<td class="pkt-cal-week">${this.week}</td>`),this.week++;for(let y=1;y<8;y++)if(p===0&&y<n+1){const C=c-(n-y);f.push(a.x`<td class="pkt-cal-other">
75
75
  <div
76
76
  class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
77
77
  data-disabled="disabled"
78
78
  >
79
79
  <span class="pkt-btn__text pkt-txt-14-light">${C}</span>
80
80
  </div>
81
- </td>`)}else d>r?(f.push(a.ke`<td class="pkt-cal-other">
81
+ </td>`)}else d>r?(f.push(a.x`<td class="pkt-cal-other">
82
82
  <div
83
83
  class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
84
84
  data-disabled="disabled"
85
85
  >
86
86
  <span class="pkt-btn__text pkt-txt-14-light">${d-r}</span>
87
87
  </div>
88
- </td>`),d++):(f.push(this.renderDayView(d,e,y)),d++);u.push(a.ke`<tr class="pkt-cal-week-row" role="row">
88
+ </td>`),d++):(f.push(this.renderDayView(d,e,y)),d++);u.push(a.x`<tr class="pkt-cal-week-row" role="row">
89
89
  ${f}
90
- </tr>`)}return u}isExcluded(e,t){return this.excludeweekdays.includes(e.toString())||this.earliest&&t<new Date(this.earliest)||this.latest&&t>new Date(this.latest)?!0:this.excludedates.some(s=>typeof s=="string"?s===this.formatISODate(t):s.toDateString()===t.toDateString())}formatISODate(e){return e.toISOString().split("T")[0]}isPrevMonthAllowed(){const e=new Date(this.year,this.month,0,12);return!(this.earliest&&new Date(this.earliest)>e)}prevMonth(){const e=this.month===0?11:this.month-1,t=this.month===0?this.year-1:this.year;this.changeMonth(t,e)}isNextMonthAllowed(){const e=new Date(this.year,this.month===11?0:this.month+1,1,12);return!(this.latest&&new Date(this.latest)<e)}nextMonth(){const e=this.month===11?0:this.month+1,t=this.month===11?this.year+1:this.year;this.changeMonth(t,e)}changeMonth(e,t){this.year=e,this.month=t,this.selectableDates=[],this.requestUpdate()}isInRange(e){if(this.range&&this.selected.length===2){if(e>new Date(this.selected[0])&&e<new Date(this.selected[1]))return!0}else if(this.range&&this.selected.length===1&&this.rangeHovered&&e>new Date(this.selected[0])&&e<this.rangeHovered)return!0;return!1}isRangeAllowed(e){let t=!0;if(this._selected.length===1){const s=b({start:this._selected[0],end:e});if(Array.isArray(s)&&s.length)for(let n=0;n<s.length;n++)this.excludedates.forEach(r=>{r>this._selected[0]&&r<e&&(t=!1)}),this.excludeweekdays.includes(I(s[n]).toString())&&(t=!1)}return t}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}addToSelected(e){this.selected.includes(this.formatISODate(e))||(this.selected=[...this.selected,this.formatISODate(e)],this._selected=[...this._selected,e],this.range&&this.selected.length===2&&this.close())}removeFromSelected(e){if(this.selected.length===1)this.emptySelected();else{const t=this.selected.indexOf(this.formatISODate(e)),s=[...this.selected],n=[...this._selected];s.splice(t,1),n.splice(t,1),this.selected=s,this._selected=n}}toggleSelected(e){const t=this.formatISODate(e);this.selected.includes(t)?this.removeFromSelected(e):this.maxMultiple&&this.selected.length>=this.maxMultiple||this.addToSelected(e)}handleRangeSelect(e){const t=this.formatISODate(e);return this.selected.includes(t)?this.selected.indexOf(t)===0?this.emptySelected():this.removeFromSelected(e):this.selected.length>1?(this.emptySelected(),this.addToSelected(e)):(this.selected.length===1&&!this.isRangeAllowed(e)&&this.emptySelected(),this.selected.length===1&&this._selected[0]>e&&this.emptySelected(),this.addToSelected(e)),Promise.resolve()}handleRangeHover(e){if(this.range&&this._selected.length===1&&this.isRangeAllowed(e)&&this._selected[0]<e){this.rangeHovered=e,this.inRange={};const t=b({start:this._selected[0],end:e});if(Array.isArray(t)&&t.length)for(let s=0;s<t.length;s++)this.inRange[this.formatISODate(t[s])]=this.isInRange(t[s])}else this.rangeHovered=null}handleDateSelect(e){if(e)return this.range?this.handleRangeSelect(e):this.multiple?this.toggleSelected(e):(this.selected.includes(this.formatISODate(e))?this.emptySelected():(this.emptySelected(),this.addToSelected(e)),this.close()),this.dispatchEvent(new CustomEvent("date-selected",{detail:this.selected,bubbles:!0,composed:!0})),Promise.resolve()}focusOnCurrentDate(){const e=this.formatISODate(new Date),t=this.querySelector(`div[data-date="${e}"]`);if(t instanceof HTMLDivElement)t.focus();else{const s=this.selectableDates.find(n=>!n.isDisabled);if(s){const n=this.querySelector(`div[data-date="${s.currentDateISO}"]`);n instanceof HTMLDivElement&&n.focus()}}}closeEvent(e){this.contains(e.relatedTarget)||this.close()}close(){this.dispatchEvent(new CustomEvent("close",{detail:!0,bubbles:!0,composed:!0}))}};o([a.n({type:Boolean})],exports.PktCalendar.prototype,"multiple",2);o([a.n({type:Number})],exports.PktCalendar.prototype,"maxMultiple",2);o([a.n({type:Boolean})],exports.PktCalendar.prototype,"range",2);o([a.n({type:Boolean})],exports.PktCalendar.prototype,"weeknumbers",2);o([a.n({type:Boolean})],exports.PktCalendar.prototype,"withcontrols",2);o([a.n({converter:v.converters.csvToArray})],exports.PktCalendar.prototype,"selected",2);o([a.n({type:String})],exports.PktCalendar.prototype,"earliest",2);o([a.n({type:String})],exports.PktCalendar.prototype,"latest",2);o([a.n({converter:v.converters.stringsToDate})],exports.PktCalendar.prototype,"excludedates",2);o([a.n({converter:v.converters.csvToArray})],exports.PktCalendar.prototype,"excludeweekdays",2);o([a.n({converter:v.converters.stringToDate})],exports.PktCalendar.prototype,"currentmonth",2);o([a.n({type:Array})],exports.PktCalendar.prototype,"dayStrings",2);o([a.n({type:Array})],exports.PktCalendar.prototype,"monthStrings",2);o([a.n({type:String})],exports.PktCalendar.prototype,"weekString",2);o([a.n({type:String})],exports.PktCalendar.prototype,"prevMonthString",2);o([a.n({type:String})],exports.PktCalendar.prototype,"nextMonthString",2);o([a.n({type:Array})],exports.PktCalendar.prototype,"_selected",2);o([a.n({type:Number})],exports.PktCalendar.prototype,"year",2);o([a.n({type:Number})],exports.PktCalendar.prototype,"month",2);o([a.n({type:Number})],exports.PktCalendar.prototype,"week",2);o([a.n({type:Date})],exports.PktCalendar.prototype,"rangeHovered",2);o([a.r()],exports.PktCalendar.prototype,"inRange",2);o([a.r()],exports.PktCalendar.prototype,"focusedDate",2);o([a.r()],exports.PktCalendar.prototype,"selectableDates",2);o([a.r()],exports.PktCalendar.prototype,"currentmonthtouched",2);exports.PktCalendar=o([O.t("pkt-calendar")],exports.PktCalendar);exports.constructFrom=D;exports.getDefaultOptions=w;exports.getWeek=x;exports.getWeekYear=M;exports.millisecondsInDay=P;exports.millisecondsInWeek=S;exports.startOfWeek=m;exports.toDate=k;
90
+ </tr>`)}return u}isExcluded(e,t){return this.excludeweekdays.includes(e.toString())||this.earliest&&t<new Date(this.earliest)||this.latest&&t>new Date(this.latest)?!0:this.excludedates.some(s=>typeof s=="string"?s===this.formatISODate(t):s.toDateString()===t.toDateString())}formatISODate(e){return e.toISOString().split("T")[0]}isPrevMonthAllowed(){const e=new Date(this.year,this.month,0,12);return!(this.earliest&&new Date(this.earliest)>e)}prevMonth(){const e=this.month===0?11:this.month-1,t=this.month===0?this.year-1:this.year;this.changeMonth(t,e)}isNextMonthAllowed(){const e=new Date(this.year,this.month===11?0:this.month+1,1,12);return!(this.latest&&new Date(this.latest)<e)}nextMonth(){const e=this.month===11?0:this.month+1,t=this.month===11?this.year+1:this.year;this.changeMonth(t,e)}changeMonth(e,t){this.year=e,this.month=t,this.selectableDates=[],this.requestUpdate()}isInRange(e){if(this.range&&this.selected.length===2){if(e>new Date(this.selected[0])&&e<new Date(this.selected[1]))return!0}else if(this.range&&this.selected.length===1&&this.rangeHovered&&e>new Date(this.selected[0])&&e<this.rangeHovered)return!0;return!1}isRangeAllowed(e){let t=!0;if(this._selected.length===1){const s=b({start:this._selected[0],end:e});if(Array.isArray(s)&&s.length)for(let n=0;n<s.length;n++)this.excludedates.forEach(r=>{r>this._selected[0]&&r<e&&(t=!1)}),this.excludeweekdays.includes(I(s[n]).toString())&&(t=!1)}return t}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}addToSelected(e){this.selected.includes(this.formatISODate(e))||(this.selected=[...this.selected,this.formatISODate(e)],this._selected=[...this._selected,e],this.range&&this.selected.length===2&&this.close())}removeFromSelected(e){if(this.selected.length===1)this.emptySelected();else{const t=this.selected.indexOf(this.formatISODate(e)),s=[...this.selected],n=[...this._selected];s.splice(t,1),n.splice(t,1),this.selected=s,this._selected=n}}toggleSelected(e){const t=this.formatISODate(e);this.selected.includes(t)?this.removeFromSelected(e):this.maxMultiple&&this.selected.length>=this.maxMultiple||this.addToSelected(e)}handleRangeSelect(e){const t=this.formatISODate(e);return this.selected.includes(t)?this.selected.indexOf(t)===0?this.emptySelected():this.removeFromSelected(e):this.selected.length>1?(this.emptySelected(),this.addToSelected(e)):(this.selected.length===1&&!this.isRangeAllowed(e)&&this.emptySelected(),this.selected.length===1&&this._selected[0]>e&&this.emptySelected(),this.addToSelected(e)),Promise.resolve()}handleRangeHover(e){if(this.range&&this._selected.length===1&&this.isRangeAllowed(e)&&this._selected[0]<e){this.rangeHovered=e,this.inRange={};const t=b({start:this._selected[0],end:e});if(Array.isArray(t)&&t.length)for(let s=0;s<t.length;s++)this.inRange[this.formatISODate(t[s])]=this.isInRange(t[s])}else this.rangeHovered=null}handleDateSelect(e){if(e)return this.range?this.handleRangeSelect(e):this.multiple?this.toggleSelected(e):(this.selected.includes(this.formatISODate(e))?this.emptySelected():(this.emptySelected(),this.addToSelected(e)),this.close()),this.dispatchEvent(new CustomEvent("date-selected",{detail:this.selected,bubbles:!0,composed:!0})),Promise.resolve()}focusOnCurrentDate(){const e=this.formatISODate(new Date),t=this.querySelector(`div[data-date="${e}"]`);if(t instanceof HTMLDivElement)t.focus();else{const s=this.selectableDates.find(n=>!n.isDisabled);if(s){const n=this.querySelector(`div[data-date="${s.currentDateISO}"]`);n instanceof HTMLDivElement&&n.focus()}}}closeEvent(e){this.contains(e.relatedTarget)||this.close()}close(){this.dispatchEvent(new CustomEvent("close",{detail:!0,bubbles:!0,composed:!0}))}};o([a.n({type:Boolean})],exports.PktCalendar.prototype,"multiple",2);o([a.n({type:Number})],exports.PktCalendar.prototype,"maxMultiple",2);o([a.n({type:Boolean})],exports.PktCalendar.prototype,"range",2);o([a.n({type:Boolean})],exports.PktCalendar.prototype,"weeknumbers",2);o([a.n({type:Boolean})],exports.PktCalendar.prototype,"withcontrols",2);o([a.n({converter:v.converters.csvToArray})],exports.PktCalendar.prototype,"selected",2);o([a.n({type:String})],exports.PktCalendar.prototype,"earliest",2);o([a.n({type:String})],exports.PktCalendar.prototype,"latest",2);o([a.n({converter:v.converters.stringsToDate})],exports.PktCalendar.prototype,"excludedates",2);o([a.n({converter:v.converters.csvToArray})],exports.PktCalendar.prototype,"excludeweekdays",2);o([a.n({converter:v.converters.stringToDate})],exports.PktCalendar.prototype,"currentmonth",2);o([a.n({type:Array})],exports.PktCalendar.prototype,"dayStrings",2);o([a.n({type:Array})],exports.PktCalendar.prototype,"monthStrings",2);o([a.n({type:String})],exports.PktCalendar.prototype,"weekString",2);o([a.n({type:String})],exports.PktCalendar.prototype,"prevMonthString",2);o([a.n({type:String})],exports.PktCalendar.prototype,"nextMonthString",2);o([a.n({type:Array})],exports.PktCalendar.prototype,"_selected",2);o([a.n({type:Number})],exports.PktCalendar.prototype,"year",2);o([a.n({type:Number})],exports.PktCalendar.prototype,"month",2);o([a.n({type:Number})],exports.PktCalendar.prototype,"week",2);o([a.n({type:Date})],exports.PktCalendar.prototype,"rangeHovered",2);o([a.r()],exports.PktCalendar.prototype,"inRange",2);o([a.r()],exports.PktCalendar.prototype,"focusedDate",2);o([a.r()],exports.PktCalendar.prototype,"selectableDates",2);o([a.r()],exports.PktCalendar.prototype,"currentmonthtouched",2);exports.PktCalendar=o([O.t("pkt-calendar")],exports.PktCalendar);exports.constructFrom=D;exports.getDefaultOptions=w;exports.getWeek=M;exports.getWeekYear=x;exports.millisecondsInDay=P;exports.millisecondsInWeek=S;exports.startOfWeek=m;exports.toDate=k;
@@ -0,0 +1,9 @@
1
+ "use strict";const o=require("./index-DSyh6tUw.cjs"),r=require("./directive-DtixNHDT.cjs");/**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */class h extends r.i{constructor(t){if(super(t),this.it=o.E,t.type!==r.t$1.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===o.E||t==null)return this._t=void 0,this.it=t;if(t===o.T)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const s=[t];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}h.directiveName="unsafeHTML",h.resultType=1;const f=r.e(h);/**
6
+ * @license
7
+ * Copyright 2017 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ */class d extends h{}d.directiveName="unsafeSVG",d.resultType=2;const w=r.e(d);var g=Object.defineProperty,v=Object.getOwnPropertyDescriptor,c=(e,t,s,n)=>{for(var i=n>1?void 0:n?v(t,s):t,l=e.length-1,p;l>=0;l--)(p=e[l])&&(i=(n?p(t,s,i):p(i))||i);return n&&i&&g(t,s,i),i};window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch;window.pktIconPath=window.pktIconPath||"https://punkt-cdn.oslo.kommune.no/latest/icons/";const P=e=>new Promise(t=>setTimeout(t,e)),a='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',u={},k=async(e,t)=>{let s=0;for(;u[t+e+".svg"]==="fetching"&&(s++,!(s>50));)await P(50);return localStorage.getItem(t+e+".svg")?Promise.resolve(localStorage.getItem(t+e+".svg")):typeof window.pktFetch=="function"?(u[t+e+".svg"]="fetching",Promise.resolve(window.pktFetch(t+e+".svg").then(n=>n.ok?n.text():(console.error("Missing icon: "+t+e+".svg"),a)).then(n=>(n!==a&&localStorage.setItem(t+e+".svg",n),u[t+e+".svg"]="fetched",n)))):Promise.resolve(a)};exports.PktIcon=class extends o.PktElement{constructor(){super(...arguments),this.path=window.pktIconPath,this.name="",this.icon=w(a),this._updatedProps=[]}connectedCallback(){super.connectedCallback(),this.classList.add("pkt-icon")}async attributeChangedCallback(t,s,n){super.attributeChangedCallback(t,s,n),(t==="name"||t==="path")&&this.getIcon(this.name)}async updated(t){super.updated(t),(t.has("name")||t.has("path"))&&this.getIcon(this.name)}async getIcon(t=""){this._updatedProps.length>0?(this.path||(this.path,window.pktIconPath),this.icon=w(await k(this.name||"",this.path).then(s=>s)),this._updatedProps=[]):this._updatedProps.includes(t)||this._updatedProps.push(t)}render(){return o.x`${this.name&&this.icon}`}};c([o.n({type:String,reflect:!1})],exports.PktIcon.prototype,"path",2);c([o.n({type:String,reflect:!0})],exports.PktIcon.prototype,"name",2);c([o.n({type:SVGElement})],exports.PktIcon.prototype,"icon",2);c([o.n({type:Array,noAccessor:!0})],exports.PktIcon.prototype,"_updatedProps",2);exports.PktIcon=c([r.t("pkt-icon")],exports.PktIcon);exports.o=f;