@oslokommune/punkt-elements 12.42.11 → 12.42.13

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 (131) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/{accordionitem-aQHOrGzf.js → accordionitem-C9FI-NXW.js} +3 -3
  3. package/dist/{accordionitem-C4NQFQHo.cjs → accordionitem-DjAWPtsn.cjs} +1 -1
  4. package/dist/{alert-sBHt7DSh.js → alert-B0OUR9oD.js} +5 -5
  5. package/dist/{alert-DUWuhtFC.cjs → alert-BH0lJ2ny.cjs} +1 -1
  6. package/dist/{backlink-BnlrDl9O.js → backlink-B13JTp9D.js} +2 -2
  7. package/dist/{backlink-CcAZfB1d.cjs → backlink-C5jQRMwJ.cjs} +1 -1
  8. package/dist/{button-BT-FRGMk.cjs → button-CDocR7iN.cjs} +1 -1
  9. package/dist/{button-B4Oe8Ar0.js → button-DrrEvUy9.js} +4 -4
  10. package/dist/{calendar-D4qfcRtv.cjs → calendar-BZe2D4Sr.cjs} +1 -1
  11. package/dist/{calendar-Df6-FDRW.js → calendar-DevQhOup.js} +4 -4
  12. package/dist/{card-CXhVAeOG.cjs → card-Bx36j0q4.cjs} +1 -1
  13. package/dist/{card-0Kf9L0A_.js → card-Djnd-pgo.js} +6 -6
  14. package/dist/{checkbox-CiXWukkL.cjs → checkbox-CJ4tK9RC.cjs} +1 -1
  15. package/dist/{checkbox-B67_cfqW.js → checkbox-cD_5LDzV.js} +4 -4
  16. package/dist/{class-map-DWDPOqjO.cjs → class-map-BBG2gMX4.cjs} +1 -1
  17. package/dist/{class-map-m7ZCZ49w.js → class-map-BpTj9gtz.js} +1 -1
  18. package/dist/{combobox-Dq7F5v-u.cjs → combobox-Cv6i7BEk.cjs} +1 -1
  19. package/dist/{combobox-CsFDvh8U.js → combobox-kWGI4RHI.js} +11 -11
  20. package/dist/{consent-B17ZIuwm.js → consent-CftYu8Di.js} +3 -3
  21. package/dist/{consent-CILYIgC-.cjs → consent-DrS71kvz.cjs} +1 -1
  22. package/dist/{datepicker-DOf9XK9v.cjs → datepicker-BJe92Vor.cjs} +1 -1
  23. package/dist/{datepicker-Cz6seIz1.js → datepicker-LpbYHx8L.js} +11 -11
  24. package/dist/{directive-helpers-v9b0v7lu.cjs → directive-helpers-BBbxqP2W.cjs} +1 -1
  25. package/dist/{directive-helpers--4ibN__v.js → directive-helpers-r-kOS_Mf.js} +1 -1
  26. package/dist/element-6DBpyGQm.cjs +238 -0
  27. package/dist/{element-gAd63VwC.js → element-CgEWt74-.js} +7039 -7516
  28. package/dist/heading-BRE_iFtR.cjs +1 -0
  29. package/dist/heading-D6jXE_Mz.js +58 -0
  30. package/dist/{helptext-BG_b6ytC.js → helptext-B7eI0iBQ.js} +5 -5
  31. package/dist/{helptext-CC3qLmEz.cjs → helptext-CzQX6YVE.cjs} +1 -1
  32. package/dist/{icon-B1_BRNqf.cjs → icon-B_ryAy4Q.cjs} +1 -1
  33. package/dist/{icon-CO1TLSs5.js → icon-CC1js8eR.js} +1 -1
  34. package/dist/{if-defined-Cj-3Kdsr.js → if-defined-CmuO4Vz9.js} +1 -1
  35. package/dist/{if-defined-C8eotHpL.cjs → if-defined-Cni-RHLS.cjs} +1 -1
  36. package/dist/index.d.ts +33 -32
  37. package/dist/input-element-CHjLWeKt.cjs +1 -0
  38. package/dist/input-element-Cco4PA2M.js +700 -0
  39. package/dist/{input-wrapper-Dk0rKRlz.cjs → input-wrapper-BxZf8wEP.cjs} +1 -1
  40. package/dist/{input-wrapper-CC_R5w7V.js → input-wrapper-gz7ppKrK.js} +6 -6
  41. package/dist/{link-C9X0huxP.js → link-C76H6Qf1.js} +4 -4
  42. package/dist/{link-qTz-qNVI.cjs → link-DTkjNlmy.cjs} +1 -1
  43. package/dist/{linkcard-Bhk2ttou.js → linkcard-BVEsUPwG.js} +3 -3
  44. package/dist/{linkcard-CaBz6i7A.cjs → linkcard-BlMhPNry.cjs} +1 -1
  45. package/dist/{listbox-AjDNhDsQ.cjs → listbox-C4supLfR.cjs} +1 -1
  46. package/dist/{listbox-DCWdrjFp.js → listbox-CLsSW32I.js} +5 -5
  47. package/dist/{loader-BqYcg8Di.cjs → loader-CHPxY9c6.cjs} +1 -1
  48. package/dist/{loader-DMp859px.js → loader-Da4IOk_T.js} +5 -5
  49. package/dist/{messagebox-Do_nAUo3.cjs → messagebox-CqUBJs_D.cjs} +1 -1
  50. package/dist/{messagebox-_1f12rDq.js → messagebox-DwGdcdm7.js} +5 -5
  51. package/dist/{modal-C1inKvts.cjs → modal-BdA5aWGU.cjs} +1 -1
  52. package/dist/{modal-C3kEgTMj.js → modal-DcXPnFus.js} +5 -5
  53. package/dist/pkt-accordion.cjs +1 -1
  54. package/dist/pkt-accordion.js +2 -2
  55. package/dist/pkt-alert.cjs +1 -1
  56. package/dist/pkt-alert.js +1 -1
  57. package/dist/pkt-backlink.cjs +1 -1
  58. package/dist/pkt-backlink.js +1 -1
  59. package/dist/pkt-button.cjs +1 -1
  60. package/dist/pkt-button.js +1 -1
  61. package/dist/pkt-calendar.cjs +1 -1
  62. package/dist/pkt-calendar.js +1 -1
  63. package/dist/pkt-card.cjs +1 -1
  64. package/dist/pkt-card.js +1 -1
  65. package/dist/pkt-checkbox.cjs +1 -1
  66. package/dist/pkt-checkbox.js +1 -1
  67. package/dist/pkt-combobox.cjs +1 -1
  68. package/dist/pkt-combobox.js +1 -1
  69. package/dist/pkt-consent.cjs +1 -1
  70. package/dist/pkt-consent.js +1 -1
  71. package/dist/pkt-datepicker.cjs +1 -1
  72. package/dist/pkt-datepicker.js +1 -1
  73. package/dist/pkt-heading.cjs +1 -1
  74. package/dist/pkt-heading.js +1 -1
  75. package/dist/pkt-helptext.cjs +1 -1
  76. package/dist/pkt-helptext.js +1 -1
  77. package/dist/pkt-icon.cjs +1 -1
  78. package/dist/pkt-icon.js +1 -1
  79. package/dist/pkt-index.cjs +1 -1
  80. package/dist/pkt-index.js +29 -29
  81. package/dist/pkt-input-wrapper.cjs +1 -1
  82. package/dist/pkt-input-wrapper.js +1 -1
  83. package/dist/pkt-link.cjs +1 -1
  84. package/dist/pkt-link.js +1 -1
  85. package/dist/pkt-linkcard.cjs +1 -1
  86. package/dist/pkt-linkcard.js +1 -1
  87. package/dist/pkt-listbox.cjs +1 -1
  88. package/dist/pkt-listbox.js +1 -1
  89. package/dist/pkt-loader.cjs +1 -1
  90. package/dist/pkt-loader.js +1 -1
  91. package/dist/pkt-messagebox.cjs +1 -1
  92. package/dist/pkt-messagebox.js +1 -1
  93. package/dist/pkt-modal.cjs +1 -1
  94. package/dist/pkt-modal.js +1 -1
  95. package/dist/pkt-progressbar.cjs +1 -1
  96. package/dist/pkt-progressbar.js +2 -2
  97. package/dist/pkt-radiobutton.cjs +1 -1
  98. package/dist/pkt-radiobutton.js +1 -1
  99. package/dist/pkt-select.cjs +1 -1
  100. package/dist/pkt-select.js +1 -1
  101. package/dist/pkt-tag.cjs +1 -1
  102. package/dist/pkt-tag.js +1 -1
  103. package/dist/pkt-textarea.cjs +1 -1
  104. package/dist/pkt-textarea.js +1 -1
  105. package/dist/pkt-textinput.cjs +1 -1
  106. package/dist/pkt-textinput.js +1 -1
  107. package/dist/{progressbar-BrXtjUvh.cjs → progressbar-DhMBXkww.cjs} +1 -1
  108. package/dist/{progressbar-BSO0KWzv.js → progressbar-Dj_mI_A6.js} +5 -5
  109. package/dist/{radiobutton-x10h-JEh.cjs → radiobutton-0vVqu-GU.cjs} +1 -1
  110. package/dist/{radiobutton-BaIDDCwK.js → radiobutton-BcFRJFvI.js} +5 -5
  111. package/dist/{ref-DnSbnXsj.js → ref-BBYSqgeW.js} +2 -2
  112. package/dist/{ref-B-w1vCo8.cjs → ref-iJtiv3o2.cjs} +1 -1
  113. package/dist/{repeat-lUFq9w5d.js → repeat-C8BeHwYx.js} +2 -2
  114. package/dist/{repeat-CxQA3AeF.cjs → repeat-CDsZqct8.cjs} +1 -1
  115. package/dist/{select-BlL8T2BX.js → select-BaLHLuvH.js} +6 -6
  116. package/dist/{select-BkVSXR5K.cjs → select-CFpdOlDE.cjs} +1 -1
  117. package/dist/{state-BxrO4zNJ.js → state-Bo2bck5_.js} +1 -1
  118. package/dist/{state-D-Recv7U.cjs → state-DPobt-Yz.cjs} +1 -1
  119. package/dist/{tag-m7OTZaCG.js → tag-BWm6s48d.js} +6 -6
  120. package/dist/{tag-DrbI0ng3.cjs → tag-DPk3fpEg.cjs} +1 -1
  121. package/dist/{textarea-Dc1sUaxx.cjs → textarea-CViiuZdR.cjs} +1 -1
  122. package/dist/{textarea-Dk8hQMD2.js → textarea-EIFo7GZz.js} +9 -9
  123. package/dist/{textinput-6Ip-0aVY.js → textinput-BHS7b-Jt.js} +8 -8
  124. package/dist/{textinput-DuLZ26DB.cjs → textinput-_ZdyMA9O.cjs} +1 -1
  125. package/package.json +3 -3
  126. package/src/components/heading/heading.ts +64 -37
  127. package/dist/element-90YeMNbV.cjs +0 -238
  128. package/dist/heading-CGGKEZve.js +0 -59
  129. package/dist/heading-Cmh5bbTl.cjs +0 -1
  130. package/dist/input-element-BEvaQK4g.js +0 -229
  131. package/dist/input-element-CInrWeac.cjs +0 -1
@@ -1,4 +1,4 @@
1
- import { P as t } from "./select-BlL8T2BX.js";
1
+ import { P as t } from "./select-BaLHLuvH.js";
2
2
  const a = t;
3
3
  export {
4
4
  t as PktSelect,
package/dist/pkt-tag.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./tag-DrbI0ng3.cjs"),t=e.PktTag;Object.defineProperty(exports,"PktTag",{enumerable:!0,get:()=>e.PktTag});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./tag-DPk3fpEg.cjs"),t=e.PktTag;Object.defineProperty(exports,"PktTag",{enumerable:!0,get:()=>e.PktTag});exports.default=t;
package/dist/pkt-tag.js CHANGED
@@ -1,4 +1,4 @@
1
- import { P as a } from "./tag-m7OTZaCG.js";
1
+ import { P as a } from "./tag-BWm6s48d.js";
2
2
  const o = a;
3
3
  export {
4
4
  a as PktTag,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textarea-Dc1sUaxx.cjs"),t=e.PktTextarea;Object.defineProperty(exports,"PktTextarea",{enumerable:!0,get:()=>e.PktTextarea});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textarea-CViiuZdR.cjs"),t=e.PktTextarea;Object.defineProperty(exports,"PktTextarea",{enumerable:!0,get:()=>e.PktTextarea});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as a } from "./textarea-Dk8hQMD2.js";
1
+ import { P as a } from "./textarea-EIFo7GZz.js";
2
2
  const e = a;
3
3
  export {
4
4
  a as PktTextarea,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textinput-DuLZ26DB.cjs"),t=e.PktTextinput;Object.defineProperty(exports,"PktTextinput",{enumerable:!0,get:()=>e.PktTextinput});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textinput-_ZdyMA9O.cjs"),t=e.PktTextinput;Object.defineProperty(exports,"PktTextinput",{enumerable:!0,get:()=>e.PktTextinput});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as t } from "./textinput-6Ip-0aVY.js";
1
+ import { P as t } from "./textinput-BHS7b-Jt.js";
2
2
  const p = t;
3
3
  export {
4
4
  t as PktTextinput,
@@ -1,4 +1,4 @@
1
- "use strict";const n=require("./class-map-DWDPOqjO.cjs"),e=require("./element-90YeMNbV.cjs"),p=require("./state-D-Recv7U.cjs"),h=require("./ref-B-w1vCo8.cjs"),b=require("./directive-C7oCP5Bh.cjs"),d=require("./stringutils-CkVRq4jP.cjs");require("./icon-B1_BRNqf.cjs");/**
1
+ "use strict";const n=require("./class-map-BBG2gMX4.cjs"),e=require("./element-6DBpyGQm.cjs"),p=require("./state-DPobt-Yz.cjs"),h=require("./ref-iJtiv3o2.cjs"),b=require("./directive-C7oCP5Bh.cjs"),d=require("./stringutils-CkVRq4jP.cjs");require("./icon-B_ryAy4Q.cjs");/**
2
2
  * @license
3
3
  * Copyright 2018 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1,10 +1,10 @@
1
- import { e as n } from "./class-map-m7ZCZ49w.js";
2
- import { T as g, P as _, E as c, x as b, n as u, a as $ } from "./element-gAd63VwC.js";
3
- import { r as h } from "./state-BxrO4zNJ.js";
4
- import { e as y, n as A } from "./ref-DnSbnXsj.js";
1
+ import { e as n } from "./class-map-BpTj9gtz.js";
2
+ import { T as g, P as _, E as c, x as b, n as u, a as $ } from "./element-CgEWt74-.js";
3
+ import { r as h } from "./state-Bo2bck5_.js";
4
+ import { e as y, n as A } from "./ref-BBYSqgeW.js";
5
5
  import { e as x, i as T, t as k } from "./directive-oAbCiebi.js";
6
6
  import { u as d } from "./stringutils-DJjRa8dG.js";
7
- import "./icon-CO1TLSs5.js";
7
+ import "./icon-CC1js8eR.js";
8
8
  /**
9
9
  * @license
10
10
  * Copyright 2018 Google LLC
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("./element-90YeMNbV.cjs"),p=require("./state-D-Recv7U.cjs"),r=require("./input-element-CInrWeac.cjs"),o=require("./ref-B-w1vCo8.cjs"),u=require("./class-map-DWDPOqjO.cjs");var d=Object.defineProperty,k=Object.getOwnPropertyDescriptor,s=(l,t,n,c)=>{for(var i=c>1?void 0:c?k(t,n):t,h=l.length-1,a;h>=0;h--)(a=l[h])&&(i=(c?a(t,n,i):a(i))||i);return c&&i&&d(t,n,i),i};exports.PktRadioButton=class extends r.PktInputElement{constructor(){super(...arguments),this.inputRef=o.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(t,n,c){t==="defaultChecked"&&(this._checked=this.defaultChecked),t==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(t,n,c)}render(){const t=u.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),n=u.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),c=u.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),i=()=>e.x`
1
+ "use strict";const e=require("./element-6DBpyGQm.cjs"),p=require("./state-DPobt-Yz.cjs"),r=require("./input-element-CHjLWeKt.cjs"),o=require("./ref-iJtiv3o2.cjs"),u=require("./class-map-BBG2gMX4.cjs");var d=Object.defineProperty,k=Object.getOwnPropertyDescriptor,s=(l,t,n,c)=>{for(var i=c>1?void 0:c?k(t,n):t,h=l.length-1,a;h>=0;h--)(a=l[h])&&(i=(c?a(t,n,i):a(i))||i);return c&&i&&d(t,n,i),i};exports.PktRadioButton=class extends r.PktInputElement{constructor(){super(...arguments),this.inputRef=o.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(t,n,c){t==="defaultChecked"&&(this._checked=this.defaultChecked),t==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(t,n,c)}render(){const t=u.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),n=u.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),c=u.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),i=()=>e.x`
2
2
  <label class=${c} for=${this.id+"-internal"}>
3
3
  ${this.label}
4
4
  ${this.checkHelptext?e.x`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:e.E}
@@ -1,8 +1,8 @@
1
- import { x as n, E as u, n as p, a as d } from "./element-gAd63VwC.js";
2
- import { r as k } from "./state-BxrO4zNJ.js";
3
- import { P as f } from "./input-element-BEvaQK4g.js";
4
- import { e as _, n as b } from "./ref-DnSbnXsj.js";
5
- import { e as o } from "./class-map-m7ZCZ49w.js";
1
+ import { x as n, E as u, n as p, a as d } from "./element-CgEWt74-.js";
2
+ import { r as k } from "./state-Bo2bck5_.js";
3
+ import { P as f } from "./input-element-Cco4PA2M.js";
4
+ import { e as _, n as b } from "./ref-BBYSqgeW.js";
5
+ import { e as o } from "./class-map-BpTj9gtz.js";
6
6
  var $ = Object.defineProperty, v = Object.getOwnPropertyDescriptor, c = (e, i, s, l) => {
7
7
  for (var h = l > 1 ? void 0 : l ? v(i, s) : i, r = e.length - 1, a; r >= 0; r--)
8
8
  (a = e[r]) && (h = (l ? a(i, s, h) : a(h)) || h);
@@ -1,5 +1,5 @@
1
- import { E as l } from "./element-gAd63VwC.js";
2
- import { f as $ } from "./directive-helpers--4ibN__v.js";
1
+ import { E as l } from "./element-CgEWt74-.js";
2
+ import { f as $ } from "./directive-helpers-r-kOS_Mf.js";
3
3
  import { i as f, t as a, e as _ } from "./directive-oAbCiebi.js";
4
4
  /**
5
5
  * @license
@@ -1,4 +1,4 @@
1
- "use strict";const d=require("./element-90YeMNbV.cjs"),a=require("./directive-helpers-v9b0v7lu.cjs"),l=require("./directive-C7oCP5Bh.cjs");/**
1
+ "use strict";const d=require("./element-6DBpyGQm.cjs"),a=require("./directive-helpers-BBbxqP2W.cjs"),l=require("./directive-C7oCP5Bh.cjs");/**
2
2
  * @license
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1,6 +1,6 @@
1
- import { T as $ } from "./element-gAd63VwC.js";
1
+ import { T as $ } from "./element-CgEWt74-.js";
2
2
  import { e as A, i as M, t as b } from "./directive-oAbCiebi.js";
3
- import { p as j, v as h, r as v, M as x, m as C } from "./directive-helpers--4ibN__v.js";
3
+ import { p as j, v as h, r as v, M as x, m as C } from "./directive-helpers-r-kOS_Mf.js";
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2017 Google LLC
@@ -1,4 +1,4 @@
1
- "use strict";const m=require("./element-90YeMNbV.cjs"),x=require("./directive-C7oCP5Bh.cjs"),s=require("./directive-helpers-v9b0v7lu.cjs");/**
1
+ "use strict";const m=require("./element-6DBpyGQm.cjs"),x=require("./directive-C7oCP5Bh.cjs"),s=require("./directive-helpers-BBbxqP2W.cjs");/**
2
2
  * @license
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1,11 +1,11 @@
1
- import { x as p, n as c, a as v } from "./element-gAd63VwC.js";
2
- import { r as f } from "./state-BxrO4zNJ.js";
3
- import { e as u, n as d } from "./ref-DnSbnXsj.js";
4
- import { o } from "./if-defined-Cj-3Kdsr.js";
5
- import { P as b } from "./input-element-BEvaQK4g.js";
1
+ import { x as p, n as c, a as v } from "./element-CgEWt74-.js";
2
+ import { r as f } from "./state-Bo2bck5_.js";
3
+ import { e as u, n as d } from "./ref-BBYSqgeW.js";
4
+ import { o } from "./if-defined-CmuO4Vz9.js";
5
+ import { P as b } from "./input-element-Cco4PA2M.js";
6
6
  import { P as $ } from "./pkt-options-controller-CZO1nxZ8.js";
7
7
  import { P as x } from "./pkt-slot-controller-BPGj-LC5.js";
8
- import "./input-wrapper-CC_R5w7V.js";
8
+ import "./input-wrapper-gz7ppKrK.js";
9
9
  var m = Object.defineProperty, g = Object.getOwnPropertyDescriptor, h = (t, e, s, i) => {
10
10
  for (var l = i > 1 ? void 0 : i ? g(e, s) : e, a = t.length - 1, r; a >= 0; a--)
11
11
  (r = t[a]) && (l = (i ? r(e, s, l) : r(l)) || l);
@@ -1,4 +1,4 @@
1
- "use strict";const r=require("./element-90YeMNbV.cjs"),p=require("./state-D-Recv7U.cjs"),h=require("./ref-B-w1vCo8.cjs"),o=require("./if-defined-C8eotHpL.cjs"),d=require("./input-element-CInrWeac.cjs"),c=require("./pkt-options-controller-CiuBG6Lt.cjs"),v=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-Dk0rKRlz.cjs");var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,a=(u,t,e,s)=>{for(var i=s>1?void 0:s?b(t,e):t,l=u.length-1,n;l>=0;l--)(n=u[l])&&(i=(s?n(t,e,i):n(i))||i);return s&&i&&f(t,e,i),i};exports.PktSelect=class extends d.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.options=[],this.value="",this._options=[],this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new c.PktOptionsSlotController(this),this.slotController=new v.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback();const t=this.options.length>0,e=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!t&&e?this.optionsController.nodes.forEach(s=>{const i={value:s.hasAttribute("value")?s.getAttribute("value")??"":s.textContent??"",label:s.textContent||s.getAttribute("value")||"",disabled:s.hasAttribute("disabled"),hidden:s.hasAttribute("data-hidden")};s.getAttribute("selected")&&!this.value&&(this.value=i.value),this._options.push(i)}):(this._options=this.options,this._options.forEach(s=>{s.selected&&!this.value&&(this.value=s.value)}))}add(t,e){var s,i,l;(s=this.inputRef.value)==null||s.add(t,e),this._options.push({value:t.value||t.text,label:t.text||t.value,selected:t.selected,disabled:t.disabled}),t.selected&&(this.value=t.value||t.text,this.selectedIndex=this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions),this.requestUpdate()}remove(t){var e,s;typeof t=="number"&&(this.selectedIndex===t&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),(s=this.inputRef.value)==null||s.remove(t))}item(t){var e;return(e=this.inputRef.value)==null?void 0:e.item(t)}namedItem(t){var e;return(e=this.inputRef.value)==null?void 0:e.namedItem(t)}showPicker(){var t;(t=this.inputRef.value)==null||t.showPicker()}attributeChangedCallback(t,e,s){var i,l;t==="options"&&(this._options=s?JSON.parse(s):[]),t==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex):this.options.findIndex(n=>n.value===s),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions,this.valueChanged(s,e)),super.attributeChangedCallback(t,e,s)}update(t){var e,s;super.update(t),t.has("value")&&this.value!==t.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((e=this.inputRef.value)==null?void 0:e.selectedIndex):this.options.findIndex(i=>i.value===this.value),this.selectedOptions=(s=this.inputRef.value)==null?void 0:s.selectedOptions,this.valueChanged(this.value,t.get("value"))),t.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(t){var e;super.firstUpdated(t),this.options.length&&(this._options=this.options),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(s=>s.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return r.x`
1
+ "use strict";const r=require("./element-6DBpyGQm.cjs"),p=require("./state-DPobt-Yz.cjs"),h=require("./ref-iJtiv3o2.cjs"),o=require("./if-defined-Cni-RHLS.cjs"),d=require("./input-element-CHjLWeKt.cjs"),c=require("./pkt-options-controller-CiuBG6Lt.cjs"),v=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-BxZf8wEP.cjs");var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,a=(u,t,e,s)=>{for(var i=s>1?void 0:s?b(t,e):t,l=u.length-1,n;l>=0;l--)(n=u[l])&&(i=(s?n(t,e,i):n(i))||i);return s&&i&&f(t,e,i),i};exports.PktSelect=class extends d.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.options=[],this.value="",this._options=[],this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new c.PktOptionsSlotController(this),this.slotController=new v.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback();const t=this.options.length>0,e=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!t&&e?this.optionsController.nodes.forEach(s=>{const i={value:s.hasAttribute("value")?s.getAttribute("value")??"":s.textContent??"",label:s.textContent||s.getAttribute("value")||"",disabled:s.hasAttribute("disabled"),hidden:s.hasAttribute("data-hidden")};s.getAttribute("selected")&&!this.value&&(this.value=i.value),this._options.push(i)}):(this._options=this.options,this._options.forEach(s=>{s.selected&&!this.value&&(this.value=s.value)}))}add(t,e){var s,i,l;(s=this.inputRef.value)==null||s.add(t,e),this._options.push({value:t.value||t.text,label:t.text||t.value,selected:t.selected,disabled:t.disabled}),t.selected&&(this.value=t.value||t.text,this.selectedIndex=this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions),this.requestUpdate()}remove(t){var e,s;typeof t=="number"&&(this.selectedIndex===t&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),(s=this.inputRef.value)==null||s.remove(t))}item(t){var e;return(e=this.inputRef.value)==null?void 0:e.item(t)}namedItem(t){var e;return(e=this.inputRef.value)==null?void 0:e.namedItem(t)}showPicker(){var t;(t=this.inputRef.value)==null||t.showPicker()}attributeChangedCallback(t,e,s){var i,l;t==="options"&&(this._options=s?JSON.parse(s):[]),t==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex):this.options.findIndex(n=>n.value===s),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions,this.valueChanged(s,e)),super.attributeChangedCallback(t,e,s)}update(t){var e,s;super.update(t),t.has("value")&&this.value!==t.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((e=this.inputRef.value)==null?void 0:e.selectedIndex):this.options.findIndex(i=>i.value===this.value),this.selectedOptions=(s=this.inputRef.value)==null?void 0:s.selectedOptions,this.valueChanged(this.value,t.get("value"))),t.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(t){var e;super.firstUpdated(t),this.options.length&&(this._options=this.options),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(s=>s.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return r.x`
2
2
  <pkt-input-wrapper
3
3
  ?counter=${this.counter}
4
4
  ?disabled=${this.disabled}
@@ -1,4 +1,4 @@
1
- import { n as r } from "./element-gAd63VwC.js";
1
+ import { n as r } from "./element-CgEWt74-.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2017 Google LLC
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("./element-90YeMNbV.cjs");/**
1
+ "use strict";const e=require("./element-6DBpyGQm.cjs");/**
2
2
  * @license
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1,10 +1,10 @@
1
- import { e as u } from "./class-map-m7ZCZ49w.js";
2
- import { P as m, x as l, n as r, a as g } from "./element-gAd63VwC.js";
3
- import { r as k } from "./state-BxrO4zNJ.js";
1
+ import { e as u } from "./class-map-BpTj9gtz.js";
2
+ import { P as m, x as l, n as r, a as g } from "./element-CgEWt74-.js";
3
+ import { r as k } from "./state-Bo2bck5_.js";
4
4
  import { P as y } from "./pkt-slot-controller-BPGj-LC5.js";
5
- import { e as b, n as f } from "./ref-DnSbnXsj.js";
6
- import "./icon-CO1TLSs5.js";
7
- import { o as d } from "./if-defined-Cj-3Kdsr.js";
5
+ import { e as b, n as f } from "./ref-BBYSqgeW.js";
6
+ import "./icon-CC1js8eR.js";
7
+ import { o as d } from "./if-defined-CmuO4Vz9.js";
8
8
  const _ = {
9
9
  closeTag: {
10
10
  default: !1
@@ -1,4 +1,4 @@
1
- "use strict";const u=require("./class-map-DWDPOqjO.cjs"),t=require("./element-90YeMNbV.cjs"),k=require("./state-D-Recv7U.cjs"),g=require("./pkt-slot-controller-BzddBp7z.cjs"),c=require("./ref-B-w1vCo8.cjs");require("./icon-B1_BRNqf.cjs");const h=require("./if-defined-C8eotHpL.cjs"),f={closeTag:{default:!1},size:{default:"medium"},skin:{default:"blue"},type:{default:"button"}},r={props:f};var d=Object.defineProperty,y=Object.getOwnPropertyDescriptor,i=(n,e,o,a)=>{for(var s=a>1?void 0:a?y(e,o):e,l=n.length-1,p;l>=0;l--)(p=n[l])&&(s=(a?p(e,o,s):p(s))||s);return a&&s&&d(e,o,s),s};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closeTag=r.props.closeTag.default,this.size=r.props.size.default,this.skin=r.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=r.props.type.default,this.ariaLabel=null,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0,composed:!0}))},this.slotController=new g.PktSlotController(this,this.defaultSlot),this._isClosed=!1}firstUpdated(e){var o,a;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const s=(a=(o=this.defaultSlot.value)==null?void 0:o.textContent)==null?void 0:a.trim();s&&(this._ariaDescription=`Klikk for å fjerne ${s}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},o={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?t.x`
1
+ "use strict";const u=require("./class-map-BBG2gMX4.cjs"),t=require("./element-6DBpyGQm.cjs"),k=require("./state-DPobt-Yz.cjs"),g=require("./pkt-slot-controller-BzddBp7z.cjs"),c=require("./ref-iJtiv3o2.cjs");require("./icon-B_ryAy4Q.cjs");const h=require("./if-defined-Cni-RHLS.cjs"),f={closeTag:{default:!1},size:{default:"medium"},skin:{default:"blue"},type:{default:"button"}},r={props:f};var d=Object.defineProperty,y=Object.getOwnPropertyDescriptor,i=(n,e,o,a)=>{for(var s=a>1?void 0:a?y(e,o):e,l=n.length-1,p;l>=0;l--)(p=n[l])&&(s=(a?p(e,o,s):p(s))||s);return a&&s&&d(e,o,s),s};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closeTag=r.props.closeTag.default,this.size=r.props.size.default,this.skin=r.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=r.props.type.default,this.ariaLabel=null,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0,composed:!0}))},this.slotController=new g.PktSlotController(this,this.defaultSlot),this._isClosed=!1}firstUpdated(e){var o,a;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const s=(a=(o=this.defaultSlot.value)==null?void 0:o.textContent)==null?void 0:a.trim();s&&(this._ariaDescription=`Klikk for å fjerne ${s}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},o={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?t.x`
2
2
  <button
3
3
  class=${u.e(o)}
4
4
  type=${this.type}
@@ -1,4 +1,4 @@
1
- "use strict";const s=require("./element-90YeMNbV.cjs"),p=require("./if-defined-C8eotHpL.cjs"),c=require("./state-D-Recv7U.cjs"),l=require("./ref-B-w1vCo8.cjs"),$=require("./class-map-DWDPOqjO.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-v9b0v7lu.cjs"),x=require("./input-element-CInrWeac.cjs"),T=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-Dk0rKRlz.cjs");require("./icon-B1_BRNqf.cjs");/**
1
+ "use strict";const s=require("./element-6DBpyGQm.cjs"),p=require("./if-defined-Cni-RHLS.cjs"),c=require("./state-DPobt-Yz.cjs"),l=require("./ref-iJtiv3o2.cjs"),$=require("./class-map-BBG2gMX4.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-BBbxqP2W.cjs"),x=require("./input-element-CHjLWeKt.cjs"),T=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-BxZf8wEP.cjs");require("./icon-B_ryAy4Q.cjs");/**
2
2
  * @license
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1,14 +1,14 @@
1
- import { T as l, E as $, x as f, n as d, a as g } from "./element-gAd63VwC.js";
2
- import { o as u } from "./if-defined-Cj-3Kdsr.js";
3
- import { r as x } from "./state-BxrO4zNJ.js";
4
- import { e as m, n as c } from "./ref-DnSbnXsj.js";
5
- import { e as v } from "./class-map-m7ZCZ49w.js";
1
+ import { T as l, E as $, x as f, n as d, a as g } from "./element-CgEWt74-.js";
2
+ import { o as u } from "./if-defined-CmuO4Vz9.js";
3
+ import { r as x } from "./state-Bo2bck5_.js";
4
+ import { e as m, n as c } from "./ref-BBYSqgeW.js";
5
+ import { e as v } from "./class-map-BpTj9gtz.js";
6
6
  import { e as b, i as T, t as a } from "./directive-oAbCiebi.js";
7
- import { f as y, m as w } from "./directive-helpers--4ibN__v.js";
8
- import { P as C } from "./input-element-BEvaQK4g.js";
7
+ import { f as y, m as w } from "./directive-helpers-r-kOS_Mf.js";
8
+ import { P as C } from "./input-element-Cco4PA2M.js";
9
9
  import { P as E } from "./pkt-slot-controller-BPGj-LC5.js";
10
- import "./input-wrapper-CC_R5w7V.js";
11
- import "./icon-CO1TLSs5.js";
10
+ import "./input-wrapper-gz7ppKrK.js";
11
+ import "./icon-CC1js8eR.js";
12
12
  /**
13
13
  * @license
14
14
  * Copyright 2020 Google LLC
@@ -1,12 +1,12 @@
1
- import { E as p, x as h, n as a, a as $ } from "./element-gAd63VwC.js";
2
- import { o as u } from "./if-defined-Cj-3Kdsr.js";
3
- import { r as f } from "./state-BxrO4zNJ.js";
4
- import { e as m, n as d } from "./ref-DnSbnXsj.js";
5
- import { e as g } from "./class-map-m7ZCZ49w.js";
6
- import { P as x } from "./input-element-BEvaQK4g.js";
1
+ import { E as p, x as h, n as a, a as $ } from "./element-CgEWt74-.js";
2
+ import { o as u } from "./if-defined-CmuO4Vz9.js";
3
+ import { r as f } from "./state-Bo2bck5_.js";
4
+ import { e as m, n as d } from "./ref-BBYSqgeW.js";
5
+ import { e as g } from "./class-map-BpTj9gtz.js";
6
+ import { P as x } from "./input-element-Cco4PA2M.js";
7
7
  import { P as y } from "./pkt-slot-controller-BPGj-LC5.js";
8
- import "./input-wrapper-CC_R5w7V.js";
9
- import "./icon-CO1TLSs5.js";
8
+ import "./input-wrapper-gz7ppKrK.js";
9
+ import "./icon-CC1js8eR.js";
10
10
  var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (e, i, r, t) => {
11
11
  for (var n = t > 1 ? void 0 : t ? b(i, r) : i, l = e.length - 1, c; l >= 0; l--)
12
12
  (c = e[l]) && (n = (t ? c(i, r, n) : c(n)) || n);
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("./element-90YeMNbV.cjs"),a=require("./if-defined-C8eotHpL.cjs"),l=require("./state-D-Recv7U.cjs"),h=require("./ref-B-w1vCo8.cjs"),c=require("./class-map-DWDPOqjO.cjs"),x=require("./input-element-CInrWeac.cjs"),d=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-Dk0rKRlz.cjs");require("./icon-B1_BRNqf.cjs");var $=Object.defineProperty,f=Object.getOwnPropertyDescriptor,r=(u,i,s,n)=>{for(var e=n>1?void 0:n?f(i,s):i,o=u.length-1,p;o>=0;o--)(p=u[o])&&(e=(n?p(i,s,e):p(e))||e);return n&&e&&$(i,s,e),e};exports.PktTextinput=class extends x.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.value="",this.type="text",this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.slotController=new d.PktSlotController(this,this.helptextSlot)}attributeChangedCallback(i,s,n){i==="value"&&this.value!==s&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,s)),super.attributeChangedCallback(i,s,n)}updated(i){var s;super.updated(i),i.has("value")&&(this.counterCurrent=((s=this.value)==null?void 0:s.length)||0,this.valueChanged(this.value,i.get("value"))),i.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const i=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,s=c.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),n=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
1
+ "use strict";const t=require("./element-6DBpyGQm.cjs"),a=require("./if-defined-Cni-RHLS.cjs"),l=require("./state-DPobt-Yz.cjs"),h=require("./ref-iJtiv3o2.cjs"),c=require("./class-map-BBG2gMX4.cjs"),x=require("./input-element-CHjLWeKt.cjs"),d=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-BxZf8wEP.cjs");require("./icon-B_ryAy4Q.cjs");var $=Object.defineProperty,f=Object.getOwnPropertyDescriptor,r=(u,i,s,n)=>{for(var e=n>1?void 0:n?f(i,s):i,o=u.length-1,p;o>=0;o--)(p=u[o])&&(e=(n?p(i,s,e):p(e))||e);return n&&e&&$(i,s,e),e};exports.PktTextinput=class extends x.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.value="",this.type="text",this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.slotController=new d.PktSlotController(this,this.helptextSlot)}attributeChangedCallback(i,s,n){i==="value"&&this.value!==s&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,s)),super.attributeChangedCallback(i,s,n)}updated(i){var s;super.updated(i),i.has("value")&&(this.counterCurrent=((s=this.value)==null?void 0:s.length)||0,this.valueChanged(this.value,i.get("value"))),i.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const i=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,s=c.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),n=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
2
2
  <pkt-input-wrapper
3
3
  label="${this.label}"
4
4
  ?counter=${this.counter}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "12.42.11",
3
+ "version": "12.42.13",
4
4
  "description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@oslokommune/punkt-assets": "^12.42.11",
34
- "@oslokommune/punkt-css": "^12.42.11",
34
+ "@oslokommune/punkt-css": "^12.42.13",
35
35
  "sass": "^1.78.0",
36
36
  "typescript": "^5.6.2",
37
37
  "vite": "^5.4.18",
@@ -58,5 +58,5 @@
58
58
  "url": "https://github.com/oslokommune/punkt/issues"
59
59
  },
60
60
  "license": "MIT",
61
- "gitHead": "f5831df3345ab47a5fb829d207aaf7b05fa14b30"
61
+ "gitHead": "81079783b4ede62d8be446f042cbe3d61a3b5061"
62
62
  }
@@ -1,9 +1,6 @@
1
- import { PktElement } from '@/base-elements/element'
2
- import { PktSlotController } from '@/controllers/pkt-slot-controller'
3
- import { html } from 'lit'
1
+ import { PktShadowElement } from '@/base-elements/element'
2
+ import { html, PropertyValues } from 'lit'
4
3
  import { customElement, property } from 'lit/decorators.js'
5
- import { classMap } from 'lit/directives/class-map.js'
6
- import { createRef, ref, Ref } from 'lit/directives/ref.js'
7
4
 
8
5
  export type TPktHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6
9
6
  export type TPktHeadingSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'
@@ -11,49 +8,79 @@ export type TPktHeadingSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'
11
8
  export interface IPktHeading {
12
9
  size?: TPktHeadingSize
13
10
  level?: TPktHeadingLevel
14
- spacing?: boolean
15
11
  visuallyHidden?: boolean
16
- textAlign?: 'start' | 'center' | 'end'
12
+ align?: 'start' | 'center' | 'end'
17
13
  }
18
14
 
19
15
  @customElement('pkt-heading')
20
- export class PktHeading extends PktElement<IPktHeading> implements IPktHeading {
21
- defaultSlot: Ref<HTMLElement> = createRef()
22
-
23
- constructor() {
24
- super()
25
- this.slotController = new PktSlotController(this, this.defaultSlot)
26
- }
27
-
16
+ export class PktHeading extends PktShadowElement<IPktHeading> implements IPktHeading {
28
17
  @property({ type: String, reflect: true }) size: TPktHeadingSize = 'medium'
29
18
  @property({ type: Number, reflect: true }) level: TPktHeadingLevel = 2
30
- @property({ type: Boolean, reflect: true }) noSpacing: boolean = true
31
19
  @property({ type: Boolean, reflect: true }) visuallyHidden: boolean = false
32
20
  @property({ type: String, reflect: true }) align: 'start' | 'center' | 'end' = 'start'
33
21
 
34
- render() {
35
- const classes = {
36
- 'pkt-heading': true,
37
- [`pkt-heading--${this.size}`]: this.size,
38
- 'pkt-heading--noSpacing': this.noSpacing,
39
- 'pkt-sr-only': this.visuallyHidden,
40
- [`pkt-heading--${this.align}`]: this.align,
22
+ connectedCallback(): void {
23
+ super.connectedCallback()
24
+ this.setAttribute('role', 'heading')
25
+ this.setAttribute('aria-level', String(this.level))
26
+ this.updateHostClasses()
27
+ }
28
+
29
+ attributeChangedCallback(name: string, _old: string | null, value: string | null): void {
30
+ super.attributeChangedCallback(name, _old, value)
31
+ if (name === 'level' && value) {
32
+ this.setLevel(Number(value) as TPktHeadingLevel)
33
+ }
34
+ if (name === 'size' || name === 'visuallyHidden' || name === 'align') {
35
+ this.updateHostClasses()
41
36
  }
37
+ }
42
38
 
43
- switch (this.level) {
44
- case 2:
45
- return html`<h2 class=${classMap(classes)} ${ref(this.defaultSlot)}></h2>`
46
- case 3:
47
- return html`<h3 class=${classMap(classes)} ${ref(this.defaultSlot)}></h3>`
48
- case 4:
49
- return html`<h4 class=${classMap(classes)} ${ref(this.defaultSlot)}></h4>`
50
- case 5:
51
- return html`<h5 class=${classMap(classes)} ${ref(this.defaultSlot)}></h5>`
52
- case 6:
53
- return html`<h6 class=${classMap(classes)} ${ref(this.defaultSlot)}></h6>`
54
- case 1:
55
- default:
56
- return html`<h1 class=${classMap(classes)} ${ref(this.defaultSlot)}></h1>`
39
+ protected updated(_changedProperties: PropertyValues): void {
40
+ super.updated(_changedProperties)
41
+ if (_changedProperties.has('level')) {
42
+ this.setLevel(this.level)
43
+ }
44
+ if (
45
+ _changedProperties.has('size') ||
46
+ _changedProperties.has('visuallyHidden') ||
47
+ _changedProperties.has('align')
48
+ ) {
49
+ this.updateHostClasses()
57
50
  }
58
51
  }
52
+
53
+ private setLevel(level: TPktHeadingLevel): void {
54
+ if (level >= 1 && level <= 6) {
55
+ this.level = level
56
+ this.setAttribute('aria-level', String(level))
57
+ } else {
58
+ console.warn(`Invalid heading level: ${level}. Must be between 1 and 6.`)
59
+ }
60
+ }
61
+
62
+ private updateHostClasses() {
63
+ // Remove all possible classes first
64
+ this.classList.remove(
65
+ 'pkt-heading',
66
+ 'pkt-heading--xsmall',
67
+ 'pkt-heading--small',
68
+ 'pkt-heading--medium',
69
+ 'pkt-heading--large',
70
+ 'pkt-heading--xlarge',
71
+ 'pkt-sr-only',
72
+ 'pkt-heading--start',
73
+ 'pkt-heading--center',
74
+ 'pkt-heading--end',
75
+ )
76
+ // Add current classes
77
+ this.classList.add('pkt-heading')
78
+ if (this.size) this.classList.add(`pkt-heading--${this.size}`)
79
+ if (this.visuallyHidden) this.classList.add('pkt-sr-only')
80
+ if (this.align) this.classList.add(`pkt-heading--${this.align}`)
81
+ }
82
+
83
+ render() {
84
+ return html`<slot></slot>`
85
+ }
59
86
  }