@oslokommune/punkt-elements 16.0.5 → 16.2.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 (151) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/{accordionitem-CHXGzgLv.js → accordionitem-Cj74XruR.js} +31 -31
  3. package/dist/accordionitem-D7sWqDM_.cjs +34 -0
  4. package/dist/alert-C95U_RZ0.cjs +33 -0
  5. package/dist/{alert-BHSd2Vpj.js → alert-ca_hFi-u.js} +19 -20
  6. package/dist/async-directive-B158h3ba.cjs +5 -0
  7. package/dist/async-directive-CKx6pubI.js +65 -0
  8. package/dist/{button-CHUuxLQV.js → button-BRovt5nm.js} +10 -11
  9. package/dist/button-BXN_JPaH.cjs +27 -0
  10. package/dist/{card-Db9QSEqh.cjs → card-DfHo45CG.cjs} +11 -13
  11. package/dist/{card-CmfUyl_s.js → card-DvgCTN4B.js} +47 -51
  12. package/dist/{checkbox-D6nltMuc.js → checkbox-CbIUMIYt.js} +2 -2
  13. package/dist/{checkbox-Cpyay9_l.cjs → checkbox-mmn3v9ry.cjs} +1 -1
  14. package/dist/{combobox-TKTemUxN.js → combobox-CwW0md6G.js} +31 -31
  15. package/dist/combobox-TKL44xnV.cjs +135 -0
  16. package/dist/{consent-BQLkfN3d.cjs → consent-CIhFwuFO.cjs} +1 -1
  17. package/dist/{consent-knPF4PS_.js → consent-CgS1L1xF.js} +1 -1
  18. package/dist/{datepicker-CPNcXd-o.cjs → datepicker-oN9L0Wnm.cjs} +14 -14
  19. package/dist/{datepicker-MuQYeXhL.js → datepicker-qRWWzmbo.js} +51 -51
  20. package/dist/element-with-slot-1djk8KXi.js +240 -0
  21. package/dist/element-with-slot-yT8k1Z37.cjs +1 -0
  22. package/dist/helptext-B366oeR9.cjs +24 -0
  23. package/dist/{helptext-TFpeGJ1P.js → helptext-DepcDYFV.js} +32 -39
  24. package/dist/index.d.ts +39 -90
  25. package/dist/input-element-Xe9FTi2a.cjs +1 -0
  26. package/dist/{input-element-BGNbdzy2.js → input-element-n5U38pZ1.js} +8 -7
  27. package/dist/{input-wrapper-CaUY90qz.js → input-wrapper-B__6jW4U.js} +25 -28
  28. package/dist/{input-wrapper-JU4D2TGu.cjs → input-wrapper-BdFdJU-k.cjs} +7 -9
  29. package/dist/link-DLjXMpvi.cjs +7 -0
  30. package/dist/link-oGYvBLYL.js +53 -0
  31. package/dist/linkcard-BhVIc18n.js +54 -0
  32. package/dist/linkcard-C20WC6Nw.cjs +13 -0
  33. package/dist/{loader-BF9K1VCZ.js → loader-BHt9i5Xp.js} +12 -13
  34. package/dist/{loader-C1LI8Q4z.cjs → loader-DxAGCcNF.cjs} +2 -2
  35. package/dist/messagebox-B8LW0PSQ.cjs +13 -0
  36. package/dist/messagebox-DkspcMQg.js +69 -0
  37. package/dist/modal-Bfk_ncLQ.cjs +36 -0
  38. package/dist/{modal-CGHWsjk8.js → modal-p1rvuP8e.js} +26 -27
  39. package/dist/pkt-accordion.cjs +1 -1
  40. package/dist/pkt-accordion.js +2 -2
  41. package/dist/pkt-alert.cjs +1 -1
  42. package/dist/pkt-alert.js +1 -1
  43. package/dist/pkt-button.cjs +1 -1
  44. package/dist/pkt-button.js +1 -1
  45. package/dist/pkt-card.cjs +1 -1
  46. package/dist/pkt-card.js +1 -1
  47. package/dist/pkt-checkbox.cjs +1 -1
  48. package/dist/pkt-checkbox.js +1 -1
  49. package/dist/pkt-combobox.cjs +1 -1
  50. package/dist/pkt-combobox.js +1 -1
  51. package/dist/pkt-consent.cjs +1 -1
  52. package/dist/pkt-consent.js +1 -1
  53. package/dist/pkt-datepicker.cjs +1 -1
  54. package/dist/pkt-datepicker.js +2 -2
  55. package/dist/pkt-header.cjs +16 -17
  56. package/dist/pkt-header.js +62 -69
  57. package/dist/pkt-helptext.cjs +1 -1
  58. package/dist/pkt-helptext.js +1 -1
  59. package/dist/pkt-index.cjs +1 -1
  60. package/dist/pkt-index.js +22 -22
  61. package/dist/pkt-input-wrapper.cjs +1 -1
  62. package/dist/pkt-input-wrapper.js +1 -1
  63. package/dist/pkt-link.cjs +1 -1
  64. package/dist/pkt-link.js +1 -1
  65. package/dist/pkt-linkcard.cjs +1 -1
  66. package/dist/pkt-linkcard.js +1 -1
  67. package/dist/pkt-loader.cjs +1 -1
  68. package/dist/pkt-loader.js +1 -1
  69. package/dist/pkt-messagebox.cjs +1 -1
  70. package/dist/pkt-messagebox.js +1 -1
  71. package/dist/pkt-modal.cjs +1 -1
  72. package/dist/pkt-modal.js +1 -1
  73. package/dist/pkt-options-controller-DIeKSpWv.cjs +1 -0
  74. package/dist/{pkt-options-controller-Z-bPox7n.js → pkt-options-controller-W4ITGQy9.js} +1 -1
  75. package/dist/pkt-progressbar.cjs +1 -1
  76. package/dist/pkt-progressbar.js +2 -2
  77. package/dist/pkt-radiobutton.cjs +1 -1
  78. package/dist/pkt-radiobutton.js +1 -1
  79. package/dist/pkt-select.cjs +1 -1
  80. package/dist/pkt-select.js +1 -1
  81. package/dist/pkt-tabs.cjs +1 -1
  82. package/dist/pkt-tabs.js +2 -2
  83. package/dist/pkt-tag.cjs +1 -1
  84. package/dist/pkt-tag.js +1 -1
  85. package/dist/pkt-textarea.cjs +1 -1
  86. package/dist/pkt-textarea.js +1 -1
  87. package/dist/pkt-textinput.cjs +1 -1
  88. package/dist/pkt-textinput.js +1 -1
  89. package/dist/{progressbar-Bxh335uT.cjs → progressbar-CC9Qr82_.cjs} +1 -1
  90. package/dist/{progressbar-GSA4Md1u.js → progressbar-CcX-xiPI.js} +1 -1
  91. package/dist/{radiobutton-CNHCpKn0.cjs → radiobutton-BUDQYAH-.cjs} +1 -1
  92. package/dist/{radiobutton-DgC27mb0.js → radiobutton-RW3h0tJj.js} +2 -2
  93. package/dist/ref-DBGHvw2G.js +42 -0
  94. package/dist/ref-DahIePMT.cjs +5 -0
  95. package/dist/select-PuEeK4jQ.cjs +49 -0
  96. package/dist/{select-7VuYtPZv.js → select-iXKeM3yz.js} +37 -37
  97. package/dist/{tabitem-DQRzgAT4.js → tabitem-DZSzwag2.js} +30 -30
  98. package/dist/{tabitem-BKv4eN0a.cjs → tabitem-Jenus4Qd.cjs} +13 -13
  99. package/dist/{tag-DZPqFiem.js → tag-CIWBLpjv.js} +17 -18
  100. package/dist/tag-DeE1OpmF.cjs +27 -0
  101. package/dist/{textarea-VpCEjVFx.js → textarea-DR9lVDN-.js} +13 -13
  102. package/dist/{textarea-CO7Ikug5.cjs → textarea-DtiYQWjy.cjs} +7 -7
  103. package/dist/{textinput-C2AZ9ss2.js → textinput-0Bttvt9V.js} +22 -22
  104. package/dist/{textinput-DRFZU3dA.cjs → textinput-cKrjvbJW.cjs} +9 -9
  105. package/package.json +3 -3
  106. package/src/components/accordion/accordionitem.ts +4 -6
  107. package/src/components/alert/alert.ts +4 -8
  108. package/src/components/button/button.ts +4 -12
  109. package/src/components/card/card.ts +4 -19
  110. package/src/components/combobox/combobox-base.ts +0 -5
  111. package/src/components/combobox/combobox-utils.ts +1 -1
  112. package/src/components/combobox/combobox.ts +2 -1
  113. package/src/components/datepicker/datepicker.ts +2 -8
  114. package/src/components/header/header-service.ts +5 -19
  115. package/src/components/header/header.ts +4 -13
  116. package/src/components/helptext/helptext.test.ts +2 -12
  117. package/src/components/helptext/helptext.ts +5 -19
  118. package/src/components/input-wrapper/input-wrapper.test.ts +3 -3
  119. package/src/components/input-wrapper/input-wrapper.ts +5 -16
  120. package/src/components/link/link.ts +4 -12
  121. package/src/components/linkcard/linkcard.test.ts +2 -2
  122. package/src/components/linkcard/linkcard.ts +4 -13
  123. package/src/components/loader/loader.ts +4 -12
  124. package/src/components/messagebox/messagebox.ts +4 -9
  125. package/src/components/modal/modal.ts +4 -7
  126. package/src/components/select/select.ts +2 -5
  127. package/src/components/tabs/tabitem.ts +4 -7
  128. package/src/components/tabs/tabs.ts +4 -13
  129. package/src/components/tag/tag.ts +6 -12
  130. package/src/components/textarea/textarea.ts +2 -8
  131. package/src/components/textinput/textinput.ts +2 -8
  132. package/dist/accordionitem-To95GT6b.cjs +0 -34
  133. package/dist/alert-BDXWFRcf.cjs +0 -33
  134. package/dist/button-VWxZW89G.cjs +0 -27
  135. package/dist/combobox-DX2BLzIm.cjs +0 -135
  136. package/dist/helptext-BjW1WdOn.cjs +0 -24
  137. package/dist/input-element-CSDVA3Y6.cjs +0 -1
  138. package/dist/link-Bscfb6s9.js +0 -54
  139. package/dist/link-CDuv1jxx.cjs +0 -7
  140. package/dist/linkcard-3WUL0CpY.cjs +0 -13
  141. package/dist/linkcard-wNgRxJ-S.js +0 -55
  142. package/dist/messagebox-Dmot5szX.cjs +0 -13
  143. package/dist/messagebox-LBEzcr6B.js +0 -70
  144. package/dist/modal-S9MOKOaz.cjs +0 -37
  145. package/dist/pkt-options-controller-BogGk-6J.cjs +0 -1
  146. package/dist/pkt-slot-controller-D4nKlom5.cjs +0 -1
  147. package/dist/pkt-slot-controller-D7CrjM52.js +0 -95
  148. package/dist/ref-CxLwrCxt.cjs +0 -9
  149. package/dist/ref-Dma3n3i8.js +0 -102
  150. package/dist/select-PWPy5gTB.cjs +0 -49
  151. package/dist/tag-DmbgBCKu.cjs +0 -27
@@ -1,8 +1,8 @@
1
- "use strict";const a=require("./element-CMTfByxQ.cjs"),g=require("./pkt-slot-controller-D4nKlom5.cjs"),v=require("./state-BNgpvY-A.cjs"),d=require("./ref-CxLwrCxt.cjs"),u=require("./if-defined-hKKmbsI8.cjs");/**
1
+ "use strict";const d=require("./element-with-slot-yT8k1Z37.cjs"),a=require("./element-CMTfByxQ.cjs"),x=require("./state-BNgpvY-A.cjs"),f=require("./ref-DahIePMT.cjs"),u=require("./if-defined-hKKmbsI8.cjs");/**
2
2
  * @license
3
3
  * Copyright 2021 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */let C=class extends Event{constructor(t,e,i,s){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=i,this.subscribe=s??!1}};/**
5
+ */let m=class extends Event{constructor(t,e,i,s){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=i,this.subscribe=s??!1}};/**
6
6
  * @license
7
7
  * Copyright 2021 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
@@ -10,33 +10,33 @@
10
10
  * @license
11
11
  * Copyright 2021 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */let k=class{constructor(t,e,i,s){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(r,o)=>{this.unsubscribe&&(this.unsubscribe!==o&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=r,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(r,o)),this.unsubscribe=o},this.host=t,e.context!==void 0){const r=e;this.context=r.context,this.callback=r.callback,this.subscribe=r.subscribe??!1}else this.context=e,this.callback=i,this.subscribe=s??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new C(this.context,this.host,this.t,this.subscribe))}};/**
13
+ */let w=class{constructor(t,e,i,s){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(r,o)=>{this.unsubscribe&&(this.unsubscribe!==o&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=r,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(r,o)),this.unsubscribe=o},this.host=t,e.context!==void 0){const r=e;this.context=r.context,this.callback=r.callback,this.subscribe=r.subscribe??!1}else this.context=e,this.callback=i,this.subscribe=s??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new m(this.context,this.host,this.t,this.subscribe))}};/**
14
14
  * @license
15
15
  * Copyright 2021 Google LLC
16
16
  * SPDX-License-Identifier: BSD-3-Clause
17
- */class m{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){const i=e||!Object.is(t,this.o);this.o=t,i&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(const[e,{disposer:i}]of this.subscriptions)e(this.o,i)},t!==void 0&&(this.value=t)}addCallback(t,e,i){if(!i)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});const{disposer:s}=this.subscriptions.get(t);t(this.value,s)}clearCallbacks(){this.subscriptions.clear()}}/**
17
+ */class C{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){const i=e||!Object.is(t,this.o);this.o=t,i&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(const[e,{disposer:i}]of this.subscriptions)e(this.o,i)},t!==void 0&&(this.value=t)}addCallback(t,e,i){if(!i)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});const{disposer:s}=this.subscriptions.get(t);t(this.value,s)}clearCallbacks(){this.subscriptions.clear()}}/**
18
18
  * @license
19
19
  * Copyright 2021 Google LLC
20
20
  * SPDX-License-Identifier: BSD-3-Clause
21
- */let $=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}};class w extends m{constructor(t,e,i){var s,r;super(e.context!==void 0?e.initialValue:i),this.onContextRequest=o=>{if(o.context!==this.context)return;const c=o.contextTarget??o.composedPath()[0];c!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,c,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;const c=new Set;for(const[f,{consumerHost:x}]of this.subscriptions)c.has(f)||(c.add(f),x.dispatchEvent(new C(this.context,x,f,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(r=(s=this.host).addController)==null||r.call(s,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new $(this.context,this.host))}}/**
21
+ */let $=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}};class g extends C{constructor(t,e,i){var s,r;super(e.context!==void 0?e.initialValue:i),this.onContextRequest=o=>{if(o.context!==this.context)return;const c=o.contextTarget??o.composedPath()[0];c!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,c,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;const c=new Set;for(const[v,{consumerHost:k}]of this.subscriptions)c.has(v)||(c.add(v),k.dispatchEvent(new m(this.context,k,v,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(r=(s=this.host).addController)==null||r.call(s,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new $(this.context,this.host))}}/**
22
22
  * @license
23
23
  * Copyright 2017 Google LLC
24
24
  * SPDX-License-Identifier: BSD-3-Clause
25
- */function P({context:n}){return(t,e)=>{const i=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(s){return i.get(this).setValue(s),t.set.call(this,s)},init(s){return i.set(this,new w(this,{context:n,initialValue:s})),s}};{t.constructor.addInitializer((o=>{i.set(o,new w(o,{context:n}))}));const s=Object.getOwnPropertyDescriptor(t,e);let r;if(s===void 0){const o=new WeakMap;r={get(){return o.get(this)},set(c){i.get(this).setValue(c),o.set(this,c)},configurable:!0,enumerable:!0}}else{const o=s.set;r={...s,set(c){i.get(this).setValue(c),o==null||o.call(this,c)}}}return void Object.defineProperty(t,e,r)}}}/**
25
+ */function P({context:n}){return(t,e)=>{const i=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(s){return i.get(this).setValue(s),t.set.call(this,s)},init(s){return i.set(this,new g(this,{context:n,initialValue:s})),s}};{t.constructor.addInitializer((o=>{i.set(o,new g(o,{context:n}))}));const s=Object.getOwnPropertyDescriptor(t,e);let r;if(s===void 0){const o=new WeakMap;r={get(){return o.get(this)},set(c){i.get(this).setValue(c),o.set(this,c)},configurable:!0,enumerable:!0}}else{const o=s.set;r={...s,set(c){i.get(this).setValue(c),o==null||o.call(this,c)}}}return void Object.defineProperty(t,e,r)}}}/**
26
26
  * @license
27
27
  * Copyright 2022 Google LLC
28
28
  * SPDX-License-Identifier: BSD-3-Clause
29
- */function S({context:n,subscribe:t}){return(e,i)=>{typeof i=="object"?i.addInitializer((function(){new k(this,{context:n,callback:s=>{e.set.call(this,s)},subscribe:t})})):e.constructor.addInitializer((s=>{new k(s,{context:n,callback:r=>{s[i]=r},subscribe:t})}))}}const y=Symbol("pkt-tabs-context");var _=Object.defineProperty,N=Object.getOwnPropertyDescriptor,p=(n,t,e,i)=>{for(var s=i>1?void 0:i?N(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&_(t,e,s),s};let b=class extends a.PktElement{constructor(){super(),this.arrowNav=!0,this.disableArrowNav=!1,this.tabRefs=[],this.tabCount=0,this.defaultSlot=d.e(),this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)},this.slotController=new g.PktSlotController(this,this.defaultSlot)}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}updated(t){(t.has("arrowNav")||t.has("disableArrowNav"))&&(this.context={...this.context,useArrowNav:this.useArrowNav})}registerTab(t,e){this.tabRefs[e]=t,this.tabCount=Math.max(this.tabCount,e+1)}handleClick(t){this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:t},bubbles:!0,composed:!0}))}handleKeyUp(t,e){var i,s;this.useArrowNav&&(t.code==="ArrowLeft"&&e!==0&&((i=this.tabRefs[e-1])==null||i.focus()),t.code==="ArrowRight"&&e<this.tabCount-1&&((s=this.tabRefs[e+1])==null||s.focus()),(t.code==="ArrowDown"||t.code==="Space")&&this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:e},bubbles:!0,composed:!0})))}render(){const t=this.useArrowNav?"tablist":"navigation";return a.b`
29
+ */function _({context:n,subscribe:t}){return(e,i)=>{typeof i=="object"?i.addInitializer((function(){new w(this,{context:n,callback:s=>{e.set.call(this,s)},subscribe:t})})):e.constructor.addInitializer((s=>{new w(s,{context:n,callback:r=>{s[i]=r},subscribe:t})}))}}const y=Symbol("pkt-tabs-context");var N=Object.defineProperty,R=Object.getOwnPropertyDescriptor,p=(n,t,e,i)=>{for(var s=i>1?void 0:i?R(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&N(t,e,s),s};let b=class extends d.PktElementWithSlot{constructor(){super(...arguments),this.arrowNav=!0,this.disableArrowNav=!1,this.tabRefs=[],this.tabCount=0,this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)}}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}updated(t){(t.has("arrowNav")||t.has("disableArrowNav"))&&(this.context={...this.context,useArrowNav:this.useArrowNav})}registerTab(t,e){this.tabRefs[e]=t,this.tabCount=Math.max(this.tabCount,e+1)}handleClick(t){this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:t},bubbles:!0,composed:!0}))}handleKeyUp(t,e){var i,s;this.useArrowNav&&(t.code==="ArrowLeft"&&e!==0&&((i=this.tabRefs[e-1])==null||i.focus()),t.code==="ArrowRight"&&e<this.tabCount-1&&((s=this.tabRefs[e+1])==null||s.focus()),(t.code==="ArrowDown"||t.code==="Space")&&this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:e},bubbles:!0,composed:!0})))}render(){const t=this.useArrowNav?"tablist":"navigation";return a.b`
30
30
  <div class="pkt-tabs">
31
- <div class="pkt-tabs__list" role=${t} ${d.n(this.defaultSlot)}></div>
31
+ <div class="pkt-tabs__list" role=${t}>${d.slotContent(this)}</div>
32
32
  </div>
33
- `}};p([a.n({type:Boolean,reflect:!0,attribute:"arrow-nav"})],b.prototype,"arrowNav",2);p([a.n({type:Boolean,reflect:!0,attribute:"disable-arrow-nav"})],b.prototype,"disableArrowNav",2);p([v.r()],b.prototype,"tabRefs",2);p([v.r()],b.prototype,"tabCount",2);p([P({context:y}),v.r()],b.prototype,"context",2);b=p([a.t("pkt-tabs")],b);const R=b;var A=Object.defineProperty,T=Object.getOwnPropertyDescriptor,l=(n,t,e,i)=>{for(var s=i>1?void 0:i?T(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&A(t,e,s),s};let h=class extends a.PktElement{constructor(){super(),this.active=!1,this.href="",this.icon="",this.controls="",this.tag="",this.tagSkin="blue",this.index=0,this.elementRef=d.e(),this.defaultSlot=d.e(),this.slotController=new g.PktSlotController(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index)})}handleClick(){this.context&&this.context.handleClick(this.index)}handleKeyUp(n){this.context&&this.context.handleKeyUp(n,this.index)}render(){var o;const n=((o=this.context)==null?void 0:o.useArrowNav)??!0,t=this.active?"active":"",e=n?"tab":void 0,i=n?this.active:void 0,s=this.active||!n?void 0:-1,r=a.b`
33
+ `}};p([a.n({type:Boolean,reflect:!0,attribute:"arrow-nav"})],b.prototype,"arrowNav",2);p([a.n({type:Boolean,reflect:!0,attribute:"disable-arrow-nav"})],b.prototype,"disableArrowNav",2);p([x.r()],b.prototype,"tabRefs",2);p([x.r()],b.prototype,"tabCount",2);p([P({context:y}),x.r()],b.prototype,"context",2);b=p([a.t("pkt-tabs")],b);const A=b;var S=Object.defineProperty,T=Object.getOwnPropertyDescriptor,l=(n,t,e,i)=>{for(var s=i>1?void 0:i?T(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&S(t,e,s),s};let h=class extends d.PktElementWithSlot{constructor(){super(),this.active=!1,this.href="",this.icon="",this.controls="",this.tag="",this.tagSkin="blue",this.index=0,this.elementRef=f.e()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index)})}handleClick(){this.context&&this.context.handleClick(this.index)}handleKeyUp(n){this.context&&this.context.handleKeyUp(n,this.index)}render(){var o;const n=((o=this.context)==null?void 0:o.useArrowNav)??!0,t=this.active?"active":"",e=n?"tab":void 0,i=n?this.active:void 0,s=this.active||!n?void 0:-1,r=a.b`
34
34
  ${this.icon?a.b`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>`:""}
35
- <span ${d.n(this.defaultSlot)}></span>
35
+ <span>${d.slotContent(this)}</span>
36
36
  ${this.tag?a.b`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:""}
37
37
  `;return this.href?a.b`
38
38
  <a
39
- ${d.n(this.elementRef)}
39
+ ${f.n(this.elementRef)}
40
40
  href=${this.href}
41
41
  class="pkt-tabs__link ${t}"
42
42
  role=${u.o(e)}
@@ -50,7 +50,7 @@
50
50
  </a>
51
51
  `:a.b`
52
52
  <button
53
- ${d.n(this.elementRef)}
53
+ ${f.n(this.elementRef)}
54
54
  type="button"
55
55
  class="pkt-tabs__button pkt-link-button ${t}"
56
56
  role=${u.o(e)}
@@ -62,4 +62,4 @@
62
62
  >
63
63
  ${r}
64
64
  </button>
65
- `}};l([a.n({type:Boolean,reflect:!0})],h.prototype,"active",2);l([a.n({type:String,reflect:!0})],h.prototype,"href",2);l([a.n({type:String,reflect:!0})],h.prototype,"icon",2);l([a.n({type:String,reflect:!0})],h.prototype,"controls",2);l([a.n({type:String,reflect:!0})],h.prototype,"tag",2);l([a.n({type:String,reflect:!0,attribute:"tag-skin"})],h.prototype,"tagSkin",2);l([a.n({type:Number,reflect:!0})],h.prototype,"index",2);l([S({context:y,subscribe:!0}),a.n({attribute:!1})],h.prototype,"context",2);h=l([a.t("pkt-tab-item")],h);const q=h;exports.PktTabItem_default=q;exports.PktTabs=R;
65
+ `}};l([a.n({type:Boolean,reflect:!0})],h.prototype,"active",2);l([a.n({type:String,reflect:!0})],h.prototype,"href",2);l([a.n({type:String,reflect:!0})],h.prototype,"icon",2);l([a.n({type:String,reflect:!0})],h.prototype,"controls",2);l([a.n({type:String,reflect:!0})],h.prototype,"tag",2);l([a.n({type:String,reflect:!0,attribute:"tag-skin"})],h.prototype,"tagSkin",2);l([a.n({type:Number,reflect:!0})],h.prototype,"index",2);l([_({context:y,subscribe:!0}),a.n({attribute:!1})],h.prototype,"context",2);h=l([a.t("pkt-tab-item")],h);const q=h;exports.PktTabItem_default=q;exports.PktTabs=A;
@@ -1,27 +1,26 @@
1
1
  import { e as d } from "./class-map-3ADKve8g.js";
2
- import { P as m, b as n, n as o, t as k } from "./element-CV9utnHJ.js";
3
- import { r as b } from "./state-l4hGZdFJ.js";
4
- import { P as y } from "./pkt-slot-controller-D7CrjM52.js";
5
- import { e as g, n as f } from "./ref-Dma3n3i8.js";
2
+ import { b as n, n as o, t as y } from "./element-CV9utnHJ.js";
3
+ import { r as f } from "./state-l4hGZdFJ.js";
4
+ import { P as k, s as b } from "./element-with-slot-1djk8KXi.js";
6
5
  import "./icon-D0IQAVwS.js";
7
6
  import { o as u } from "./if-defined-rXcLNTzN.js";
8
- const $ = { size: { default: "medium" }, skin: { default: "blue" }, closeTag: { default: !1 }, type: { default: "button" } }, l = {
9
- props: $
7
+ const g = { size: { default: "medium" }, skin: { default: "blue" }, closeTag: { default: !1 }, type: { default: "button" } }, l = {
8
+ props: g
10
9
  };
11
- var _ = Object.defineProperty, S = Object.getOwnPropertyDescriptor, e = (s, i, p, a) => {
12
- for (var r = a > 1 ? void 0 : a ? S(i, p) : i, c = s.length - 1, h; c >= 0; c--)
10
+ var m = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, e = (s, i, p, a) => {
11
+ for (var r = a > 1 ? void 0 : a ? _(i, p) : i, c = s.length - 1, h; c >= 0; c--)
13
12
  (h = s[c]) && (r = (a ? h(i, p, r) : h(r)) || r);
14
- return a && r && _(i, p, r), r;
13
+ return a && r && m(i, p, r), r;
15
14
  };
16
- let t = class extends m {
15
+ let t = class extends k {
17
16
  constructor() {
18
- super(), this.defaultSlot = g(), this.closeTag = l.props.closeTag.default, this.size = l.props.size.default, this.skin = l.props.skin.default, this.textStyle = null, this.iconName = void 0, this.type = l.props.type.default, this.ariaLabel = null, this.buttonTabindex = void 0, this._isClosed = !1, this._ariaDescription = null, this.close = (s) => {
17
+ super(), this.closeTag = l.props.closeTag.default, this.size = l.props.size.default, this.skin = l.props.skin.default, this.textStyle = null, this.iconName = void 0, this.type = l.props.type.default, this.ariaLabel = null, this.buttonTabindex = void 0, this._isClosed = !1, this._ariaDescription = null, this.close = (s) => {
19
18
  this._isClosed = !0, this.dispatchEvent(
20
19
  new CustomEvent("close", { detail: { origin: s }, bubbles: !1, composed: !0 })
21
20
  ), this.dispatchEvent(
22
21
  new CustomEvent("on-close", { detail: { origin: s }, bubbles: !1, composed: !0 })
23
22
  );
24
- }, this.slotController = new y(this, this.defaultSlot), this._isClosed = !1;
23
+ }, this._isClosed = !1;
25
24
  }
26
25
  /**
27
26
  * Lifecycle
@@ -29,7 +28,7 @@ let t = class extends m {
29
28
  firstUpdated(s) {
30
29
  var i, p;
31
30
  if (super.firstUpdated(s), this.closeTag && !this.ariaLabel) {
32
- const a = (p = (i = this.defaultSlot.value) == null ? void 0 : i.textContent) == null ? void 0 : p.trim();
31
+ const a = (p = (i = this.querySelector("button span, .pkt-tag > span")) == null ? void 0 : i.textContent) == null ? void 0 : p.trim();
33
32
  a && (this._ariaDescription = `Klikk for å fjerne ${a}`);
34
33
  }
35
34
  }
@@ -63,7 +62,7 @@ let t = class extends m {
63
62
  name=${this.iconName}
64
63
  aria-hidden="true"
65
64
  ></pkt-icon>`}
66
- <span ${f(this.defaultSlot)}></span>
65
+ <span>${b(this)}</span>
67
66
  <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
68
67
  </button>
69
68
  ` : n`
@@ -73,7 +72,7 @@ let t = class extends m {
73
72
  name=${this.iconName}
74
73
  aria-hidden="true"
75
74
  ></pkt-icon>`}
76
- <span ${f(this.defaultSlot)}></span>
75
+ <span>${b(this)}</span>
77
76
  </span>
78
77
  `;
79
78
  }
@@ -103,13 +102,13 @@ e([
103
102
  o({ type: Number, attribute: "button-tabindex" })
104
103
  ], t.prototype, "buttonTabindex", 2);
105
104
  e([
106
- b()
105
+ f()
107
106
  ], t.prototype, "_isClosed", 2);
108
107
  e([
109
- b()
108
+ f()
110
109
  ], t.prototype, "_ariaDescription", 2);
111
110
  t = e([
112
- k("pkt-tag")
111
+ y("pkt-tag")
113
112
  ], t);
114
113
  export {
115
114
  t as P
@@ -0,0 +1,27 @@
1
+ "use strict";const h=require("./class-map-Bokp1SoS.cjs"),t=require("./element-CMTfByxQ.cjs"),k=require("./state-BNgpvY-A.cjs"),c=require("./element-with-slot-yT8k1Z37.cjs");require("./icon-Dj0oZZSa.cjs");const u=require("./if-defined-hKKmbsI8.cjs"),g={size:{default:"medium"},skin:{default:"blue"},closeTag:{default:!1},type:{default:"button"}},o={props:g};var d=Object.defineProperty,b=Object.getOwnPropertyDescriptor,s=(r,e,a,n)=>{for(var i=n>1?void 0:n?b(e,a):e,p=r.length-1,l;p>=0;p--)(l=r[p])&&(i=(n?l(e,a,i):l(i))||i);return n&&i&&d(e,a,i),i};exports.PktTag=class extends c.PktElementWithSlot{constructor(){super(),this.closeTag=o.props.closeTag.default,this.size=o.props.size.default,this.skin=o.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=o.props.type.default,this.ariaLabel=null,this.buttonTabindex=void 0,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!1,composed:!0}))},this._isClosed=!1}firstUpdated(e){var a,n;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const i=(n=(a=this.querySelector("button span, .pkt-tag > span"))==null?void 0:a.textContent)==null?void 0:n.trim();i&&(this._ariaDescription=`Klikk for å fjerne ${i}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},a={"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.b`
2
+ <button
3
+ class=${h.e(a)}
4
+ type=${this.type}
5
+ tabindex=${u.o(this.buttonTabindex)}
6
+ @click=${this.close}
7
+ aria-label=${u.o(this.ariaLabel||void 0)}
8
+ aria-description=${u.o(this._ariaDescription||void 0)}
9
+ >
10
+ ${this.iconName&&t.b`<pkt-icon
11
+ class="pkt-tag__icon"
12
+ name=${this.iconName}
13
+ aria-hidden="true"
14
+ ></pkt-icon>`}
15
+ <span>${c.slotContent(this)}</span>
16
+ <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
17
+ </button>
18
+ `:t.b`
19
+ <span class=${h.e(e)}>
20
+ ${this.iconName&&t.b`<pkt-icon
21
+ class="pkt-tag__icon"
22
+ name=${this.iconName}
23
+ aria-hidden="true"
24
+ ></pkt-icon>`}
25
+ <span>${c.slotContent(this)}</span>
26
+ </span>
27
+ `}};s([t.n({type:Boolean,reflect:!0})],exports.PktTag.prototype,"closeTag",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"size",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"skin",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"textStyle",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"iconName",2);s([t.n({type:String})],exports.PktTag.prototype,"type",2);s([t.n({type:String})],exports.PktTag.prototype,"ariaLabel",2);s([t.n({type:Number,attribute:"button-tabindex"})],exports.PktTag.prototype,"buttonTabindex",2);s([k.r()],exports.PktTag.prototype,"_isClosed",2);s([k.r()],exports.PktTag.prototype,"_ariaDescription",2);exports.PktTag=s([t.t("pkt-tag")],exports.PktTag);
@@ -1,13 +1,13 @@
1
- import { E as l, A as $, b as g, n as d, t as f } from "./element-CV9utnHJ.js";
1
+ import { E as l, A as c, b as m, n as d, t as g } from "./element-CV9utnHJ.js";
2
2
  import { o as u } from "./if-defined-rXcLNTzN.js";
3
- import { r as x } from "./state-l4hGZdFJ.js";
4
- import { e as c, n as m } from "./ref-Dma3n3i8.js";
3
+ import { r as $ } from "./state-l4hGZdFJ.js";
4
+ import { e as f, n as x } from "./ref-DBGHvw2G.js";
5
5
  import { e as v } from "./class-map-3ADKve8g.js";
6
6
  import { e as b, i as T, t as a } from "./directive-oAbCiebi.js";
7
7
  import { r as y, p as w } from "./directive-helpers-CyPtA1_i.js";
8
- import { P as C } from "./input-element-BGNbdzy2.js";
9
- import { P as E } from "./pkt-slot-controller-D7CrjM52.js";
10
- import "./input-wrapper-CaUY90qz.js";
8
+ import { P as C } from "./input-element-n5U38pZ1.js";
9
+ import { s as E } from "./element-with-slot-1djk8KXi.js";
10
+ import "./input-wrapper-B__6jW4U.js";
11
11
  import "./icon-D0IQAVwS.js";
12
12
  /**
13
13
  * @license
@@ -23,7 +23,7 @@ const P = b(class extends T {
23
23
  return t;
24
24
  }
25
25
  update(t, [r]) {
26
- if (r === l || r === $) return r;
26
+ if (r === l || r === c) return r;
27
27
  const e = t.element, i = t.name;
28
28
  if (t.type === a.PROPERTY) {
29
29
  if (r === e[i]) return l;
@@ -40,7 +40,7 @@ var B = Object.defineProperty, I = Object.getOwnPropertyDescriptor, n = (t, r, e
40
40
  };
41
41
  let o = class extends C {
42
42
  constructor() {
43
- super(), this.inputRef = c(), this.helptextSlot = c(), this.value = "", this.autocomplete = "off", this.rows = null, this.counterCurrent = 0, this.slotController = new E(this, this.helptextSlot);
43
+ super(...arguments), this.inputRef = f(), this.value = "", this.autocomplete = "off", this.rows = null, this.counterCurrent = 0;
44
44
  }
45
45
  attributeChangedCallback(t, r, e) {
46
46
  t === "value" && this.value !== r && (this.counterCurrent = e ? e.length : 0, this.valueChanged(e, r)), super.attributeChangedCallback(t, r, e);
@@ -55,7 +55,7 @@ let o = class extends C {
55
55
  "pkt-input--fullwidth": this.fullwidth,
56
56
  "pkt-input--counter-error": this.counter && this.counterMaxLength && this.value.length && this.value.length > this.counterMaxLength
57
57
  }), r = this.ariaLabelledby || `${this.id}-input-label`;
58
- return g`<pkt-input-wrapper
58
+ return m`<pkt-input-wrapper
59
59
  label=${this.label}
60
60
  ?counter=${this.counter}
61
61
  ?disabled=${this.disabled}
@@ -78,9 +78,9 @@ let o = class extends C {
78
78
  .tagText=${this.tagText}
79
79
  class="pkt-textarea"
80
80
  >
81
- <div class="pkt-contents" ${m(this.helptextSlot)} name="helptext" slot="helptext"></div>
81
+ <div class="pkt-contents" slot="helptext">${E(this, "helptext")}</div>
82
82
  <textarea
83
- ${m(this.inputRef)}
83
+ ${x(this.inputRef)}
84
84
  class=${t}
85
85
  id=${this.id + "-input"}
86
86
  name=${(this.name || this.id) + "-input"}
@@ -121,10 +121,10 @@ n([
121
121
  d({ type: Number })
122
122
  ], o.prototype, "rows", 2);
123
123
  n([
124
- x()
124
+ $()
125
125
  ], o.prototype, "counterCurrent", 2);
126
126
  o = n([
127
- f("pkt-textarea")
127
+ g("pkt-textarea")
128
128
  ], o);
129
129
  export {
130
130
  o as P
@@ -1,8 +1,8 @@
1
- "use strict";const s=require("./element-CMTfByxQ.cjs"),p=require("./if-defined-hKKmbsI8.cjs"),c=require("./state-BNgpvY-A.cjs"),l=require("./ref-CxLwrCxt.cjs"),$=require("./class-map-Bokp1SoS.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-B3Vpl3xV.cjs"),x=require("./input-element-CSDVA3Y6.cjs"),g=require("./pkt-slot-controller-D4nKlom5.cjs");require("./input-wrapper-JU4D2TGu.cjs");require("./icon-Dj0oZZSa.cjs");/**
1
+ "use strict";const s=require("./element-CMTfByxQ.cjs"),h=require("./if-defined-hKKmbsI8.cjs"),c=require("./state-BNgpvY-A.cjs"),p=require("./ref-DahIePMT.cjs"),$=require("./class-map-Bokp1SoS.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-B3Vpl3xV.cjs"),g=require("./input-element-Xe9FTi2a.cjs"),x=require("./element-with-slot-yT8k1Z37.cjs");require("./input-wrapper-BdFdJU-k.cjs");require("./icon-Dj0oZZSa.cjs");/**
2
2
  * @license
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const T=a.e(class extends a.i{constructor(r){if(super(r),r.type!==a.t.PROPERTY&&r.type!==a.t.ATTRIBUTE&&r.type!==a.t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!d.r(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(r,[e]){if(e===s.E||e===s.A)return e;const i=r.element,t=r.name;if(r.type===a.t.PROPERTY){if(e===i[t])return s.E}else if(r.type===a.t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(t))return s.E}else if(r.type===a.t.ATTRIBUTE&&i.getAttribute(t)===e+"")return s.E;return d.p(r),e}});var v=Object.defineProperty,f=Object.getOwnPropertyDescriptor,o=(r,e,i,t)=>{for(var n=t>1?void 0:t?f(e,i):e,u=r.length-1,h;u>=0;u--)(h=r[u])&&(n=(t?h(e,i,n):h(n))||n);return t&&n&&v(e,i,n),n};exports.PktTextarea=class extends x.PktInputElement{constructor(){super(),this.inputRef=l.e(),this.helptextSlot=l.e(),this.value="",this.autocomplete="off",this.rows=null,this.counterCurrent=0,this.slotController=new g.PktSlotController(this,this.helptextSlot)}attributeChangedCallback(e,i,t){e==="value"&&this.value!==i&&(this.counterCurrent=t?t.length:0,this.valueChanged(t,i)),super.attributeChangedCallback(e,i,t)}updated(e){var i;super.updated(e),e.has("value")&&(this.counterCurrent=((i=this.value)==null?void 0:i.length)||0,this.valueChanged(this.value,e.get("value"))),e.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const e=$.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}),i=this.ariaLabelledby||`${this.id}-input-label`;return s.b`<pkt-input-wrapper
5
+ */const T=a.e(class extends a.i{constructor(r){if(super(r),r.type!==a.t.PROPERTY&&r.type!==a.t.ATTRIBUTE&&r.type!==a.t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!d.r(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(r,[e]){if(e===s.E||e===s.A)return e;const i=r.element,t=r.name;if(r.type===a.t.PROPERTY){if(e===i[t])return s.E}else if(r.type===a.t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(t))return s.E}else if(r.type===a.t.ATTRIBUTE&&i.getAttribute(t)===e+"")return s.E;return d.p(r),e}});var v=Object.defineProperty,f=Object.getOwnPropertyDescriptor,o=(r,e,i,t)=>{for(var n=t>1?void 0:t?f(e,i):e,u=r.length-1,l;u>=0;u--)(l=r[u])&&(n=(t?l(e,i,n):l(n))||n);return t&&n&&v(e,i,n),n};exports.PktTextarea=class extends g.PktInputElement{constructor(){super(...arguments),this.inputRef=p.e(),this.value="",this.autocomplete="off",this.rows=null,this.counterCurrent=0}attributeChangedCallback(e,i,t){e==="value"&&this.value!==i&&(this.counterCurrent=t?t.length:0,this.valueChanged(t,i)),super.attributeChangedCallback(e,i,t)}updated(e){var i;super.updated(e),e.has("value")&&(this.counterCurrent=((i=this.value)==null?void 0:i.length)||0,this.valueChanged(this.value,e.get("value"))),e.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const e=$.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}),i=this.ariaLabelledby||`${this.id}-input-label`;return s.b`<pkt-input-wrapper
6
6
  label=${this.label}
7
7
  ?counter=${this.counter}
8
8
  ?disabled=${this.disabled}
@@ -25,16 +25,16 @@
25
25
  .tagText=${this.tagText}
26
26
  class="pkt-textarea"
27
27
  >
28
- <div class="pkt-contents" ${l.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
28
+ <div class="pkt-contents" slot="helptext">${x.slotContent(this,"helptext")}</div>
29
29
  <textarea
30
- ${l.n(this.inputRef)}
30
+ ${p.n(this.inputRef)}
31
31
  class=${e}
32
32
  id=${this.id+"-input"}
33
33
  name=${(this.name||this.id)+"-input"}
34
- placeholder=${p.o(this.placeholder)}
34
+ placeholder=${h.o(this.placeholder)}
35
35
  .value=${T(this.value)}
36
- minlength=${p.o(this.minlength)}
37
- maxlength=${p.o(this.maxlength)}
36
+ minlength=${h.o(this.minlength)}
37
+ maxlength=${h.o(this.maxlength)}
38
38
  ?readonly=${this.readonly}
39
39
  autocomplete=${this.autocomplete}
40
40
  aria-labelledby=${i}
@@ -1,20 +1,20 @@
1
- import { A as p, b as h, n as a, t as $ } from "./element-CV9utnHJ.js";
2
- import { o as u } from "./if-defined-rXcLNTzN.js";
3
- import { r as f } from "./state-l4hGZdFJ.js";
4
- import { e as d, n as m } from "./ref-Dma3n3i8.js";
1
+ import { A as p, b as h, n as a, t as d } from "./element-CV9utnHJ.js";
2
+ import { o as l } from "./if-defined-rXcLNTzN.js";
3
+ import { r as m } from "./state-l4hGZdFJ.js";
4
+ import { e as $, n as f } from "./ref-DBGHvw2G.js";
5
5
  import { e as g } from "./class-map-3ADKve8g.js";
6
- import { P as x } from "./input-element-BGNbdzy2.js";
7
- import { P as v } from "./pkt-slot-controller-D7CrjM52.js";
8
- import "./input-wrapper-CaUY90qz.js";
6
+ import { P as x } from "./input-element-n5U38pZ1.js";
7
+ import { s as v } from "./element-with-slot-1djk8KXi.js";
8
+ import "./input-wrapper-B__6jW4U.js";
9
9
  import "./icon-D0IQAVwS.js";
10
10
  var y = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (i, e, r, t) => {
11
- for (var n = t > 1 ? void 0 : t ? b(e, r) : e, l = i.length - 1, c; l >= 0; l--)
12
- (c = i[l]) && (n = (t ? c(e, r, n) : c(n)) || n);
11
+ for (var n = t > 1 ? void 0 : t ? b(e, r) : e, u = i.length - 1, c; u >= 0; u--)
12
+ (c = i[u]) && (n = (t ? c(e, r, n) : c(n)) || n);
13
13
  return t && n && y(e, r, n), n;
14
14
  };
15
15
  let s = class extends x {
16
16
  constructor() {
17
- super(), this.inputRef = d(), this.helptextSlot = d(), 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 v(this, this.helptextSlot);
17
+ super(...arguments), this.inputRef = $(), 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;
18
18
  }
19
19
  attributeChangedCallback(i, e, r) {
20
20
  i === "value" && this.value !== e && (this.counterCurrent = r ? r.length : 0, this.valueChanged(r, e)), super.attributeChangedCallback(i, e, r);
@@ -54,23 +54,23 @@ let s = class extends x {
54
54
  .tagText=${this.tagText}
55
55
  class="pkt-textinput"
56
56
  >
57
- <div class="pkt-contents" ${m(this.helptextSlot)} name="helptext" slot="helptext"></div>
57
+ <div class="pkt-contents" slot="helptext">${v(this, "helptext")}</div>
58
58
  <div class="pkt-input__container">
59
59
  ${this.prefix ? h`<div class="pkt-input-prefix">${this.prefix}</div>` : p}
60
60
  <input
61
- ${m(this.inputRef)}
61
+ ${f(this.inputRef)}
62
62
  class=${e}
63
63
  type=${this.type}
64
64
  name=${(this.name || this.id) + "-input"}
65
65
  id=${this.id + "-input"}
66
- placeholder=${u(this.placeholder)}
66
+ placeholder=${l(this.placeholder)}
67
67
  aria-labelledby=${r}
68
68
  autocomplete=${this.autocomplete || "off"}
69
- minlength=${u(this.minlength || void 0)}
70
- maxlength=${u(this.maxlength || void 0)}
71
- min=${u(this.min || void 0)}
72
- max=${u(this.max || void 0)}
73
- step=${u(this.step || void 0)}
69
+ minlength=${l(this.minlength || void 0)}
70
+ maxlength=${l(this.maxlength || void 0)}
71
+ min=${l(this.min || void 0)}
72
+ max=${l(this.max || void 0)}
73
+ step=${l(this.step || void 0)}
74
74
  ?readonly=${this.readonly}
75
75
  size=${this.size || p}
76
76
  .value=${this.value}
@@ -92,8 +92,8 @@ let s = class extends x {
92
92
  @keydown=${(t) => {
93
93
  var n;
94
94
  if (t.key === "Enter") {
95
- const l = this.internals.form;
96
- l ? l.requestSubmit() : (n = this.inputRef.value) == null || n.blur();
95
+ const u = this.internals.form;
96
+ u ? u.requestSubmit() : (n = this.inputRef.value) == null || n.blur();
97
97
  }
98
98
  }}
99
99
  />
@@ -140,10 +140,10 @@ o([
140
140
  a({ type: Boolean })
141
141
  ], s.prototype, "omitSearchIcon", 2);
142
142
  o([
143
- f()
143
+ m()
144
144
  ], s.prototype, "counterCurrent", 2);
145
145
  s = o([
146
- $("pkt-textinput")
146
+ d("pkt-textinput")
147
147
  ], s);
148
148
  export {
149
149
  s as P
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("./element-CMTfByxQ.cjs"),a=require("./if-defined-hKKmbsI8.cjs"),l=require("./state-BNgpvY-A.cjs"),h=require("./ref-CxLwrCxt.cjs"),c=require("./class-map-Bokp1SoS.cjs"),d=require("./input-element-CSDVA3Y6.cjs"),$=require("./pkt-slot-controller-D4nKlom5.cjs");require("./input-wrapper-JU4D2TGu.cjs");require("./icon-Dj0oZZSa.cjs");var x=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&&x(i,s,e),e};exports.PktTextinput=class extends d.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 $.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.b`
1
+ "use strict";const t=require("./element-CMTfByxQ.cjs"),p=require("./if-defined-hKKmbsI8.cjs"),l=require("./state-BNgpvY-A.cjs"),h=require("./ref-DahIePMT.cjs"),c=require("./class-map-Bokp1SoS.cjs"),d=require("./input-element-Xe9FTi2a.cjs"),$=require("./element-with-slot-yT8k1Z37.cjs");require("./input-wrapper-BdFdJU-k.cjs");require("./icon-Dj0oZZSa.cjs");var x=Object.defineProperty,g=Object.getOwnPropertyDescriptor,r=(u,i,s,n)=>{for(var e=n>1?void 0:n?g(i,s):i,o=u.length-1,a;o>=0;o--)(a=u[o])&&(e=(n?a(i,s,e):a(e))||e);return n&&e&&x(i,s,e),e};exports.PktTextinput=class extends d.PktInputElement{constructor(){super(...arguments),this.inputRef=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}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.b`
2
2
  <pkt-input-wrapper
3
3
  label="${this.label}"
4
4
  ?counter=${this.counter}
@@ -23,7 +23,7 @@
23
23
  .tagText=${this.tagText}
24
24
  class="pkt-textinput"
25
25
  >
26
- <div class="pkt-contents" ${h.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
26
+ <div class="pkt-contents" slot="helptext">${$.slotContent(this,"helptext")}</div>
27
27
  <div class="pkt-input__container">
28
28
  ${this.prefix?t.b`<div class="pkt-input-prefix">${this.prefix}</div>`:t.A}
29
29
  <input
@@ -32,14 +32,14 @@
32
32
  type=${this.type}
33
33
  name=${(this.name||this.id)+"-input"}
34
34
  id=${this.id+"-input"}
35
- placeholder=${a.o(this.placeholder)}
35
+ placeholder=${p.o(this.placeholder)}
36
36
  aria-labelledby=${n}
37
37
  autocomplete=${this.autocomplete||"off"}
38
- minlength=${a.o(this.minlength||void 0)}
39
- maxlength=${a.o(this.maxlength||void 0)}
40
- min=${a.o(this.min||void 0)}
41
- max=${a.o(this.max||void 0)}
42
- step=${a.o(this.step||void 0)}
38
+ minlength=${p.o(this.minlength||void 0)}
39
+ maxlength=${p.o(this.maxlength||void 0)}
40
+ min=${p.o(this.min||void 0)}
41
+ max=${p.o(this.max||void 0)}
42
+ step=${p.o(this.step||void 0)}
43
43
  ?readonly=${this.readonly}
44
44
  size=${this.size||t.A}
45
45
  .value=${this.value}
@@ -50,7 +50,7 @@
50
50
  @change=${e=>{e.stopImmediatePropagation()}}
51
51
  @focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
52
52
  @blur=${e=>{this.value=e.target.value,this.onBlur(),e.stopImmediatePropagation()}}
53
- @keydown=${e=>{var o;if(e.key==="Enter"){const p=this.internals.form;p?p.requestSubmit():(o=this.inputRef.value)==null||o.blur()}}}
53
+ @keydown=${e=>{var o;if(e.key==="Enter"){const a=this.internals.form;a?a.requestSubmit():(o=this.inputRef.value)==null||o.blur()}}}
54
54
  />
55
55
  ${this.suffix?t.b`<div class="pkt-input-suffix">
56
56
  ${this.suffix}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "16.0.5",
3
+ "version": "16.2.0",
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",
@@ -42,7 +42,7 @@
42
42
  "@babel/preset-env": "^7.28.3",
43
43
  "@babel/preset-typescript": "^7.25.9",
44
44
  "@oslokommune/punkt-assets": "^16.0.0",
45
- "@oslokommune/punkt-css": "^16.0.5",
45
+ "@oslokommune/punkt-css": "^16.2.0",
46
46
  "@testing-library/jest-dom": "^6.6.3",
47
47
  "@typescript-eslint/eslint-plugin": "^8.46.0",
48
48
  "@typescript-eslint/parser": "^8.46.0",
@@ -79,5 +79,5 @@
79
79
  "url": "https://github.com/oslokommune/punkt/issues"
80
80
  },
81
81
  "license": "MIT",
82
- "gitHead": "422e54c85a36cf45cddb1705192572d8456f1406"
82
+ "gitHead": "554167272be133d1486fb9b041b3afe0980c5069"
83
83
  }
@@ -1,5 +1,5 @@
1
- import { PktElement } from '@/base-elements/element'
2
- import { PktSlotController } from '@/controllers/pkt-slot-controller'
1
+ import { PktElementWithSlot } from '@/base-elements/element-with-slot'
2
+ import { slotContent } from '@/directives/slot-content'
3
3
  import { html, PropertyValues } from 'lit'
4
4
  import { customElement, property } from 'lit/decorators.js'
5
5
  import { createRef, Ref, ref } from 'lit/directives/ref.js'
@@ -25,7 +25,7 @@ export interface IPktAccordionItem {
25
25
  }
26
26
 
27
27
  @customElement('pkt-accordion-item')
28
- export class PktAccordionItem extends PktElement implements IPktAccordionItem {
28
+ export class PktAccordionItem extends PktElementWithSlot implements IPktAccordionItem {
29
29
  @property({ type: Boolean }) defaultOpen: boolean = false
30
30
  @property({ type: String }) title: string = ''
31
31
  @property({ type: String, reflect: true }) skin: TPktAccordionSkin | undefined = undefined
@@ -34,11 +34,9 @@ export class PktAccordionItem extends PktElement implements IPktAccordionItem {
34
34
  @property({ type: String, reflect: true }) name: string | undefined = undefined
35
35
 
36
36
  accordionItemRef: Ref<HTMLDivElement> = createRef()
37
- defaultSlot: Ref<HTMLElement> = createRef()
38
37
 
39
38
  constructor() {
40
39
  super()
41
- this.slotController = new PktSlotController(this, this.defaultSlot)
42
40
  }
43
41
 
44
42
  protected firstUpdated(_changedProperties: PropertyValues): void {
@@ -75,7 +73,7 @@ export class PktAccordionItem extends PktElement implements IPktAccordionItem {
75
73
  id="pkt-accordion-item__content-${this.id}"
76
74
  role="region"
77
75
  >
78
- <div class="pkt-accordion-item__content-inner" ${ref(this.defaultSlot)}></div>
76
+ <div class="pkt-accordion-item__content-inner">${slotContent(this)}</div>
79
77
  </div>
80
78
  </details>
81
79
  `
@@ -1,9 +1,8 @@
1
1
  import { classMap } from 'lit/directives/class-map.js'
2
2
  import { customElement, property, state } from 'lit/decorators.js'
3
3
  import { html, nothing, PropertyValues } from 'lit'
4
- import { PktElement } from '@/base-elements/element'
5
- import { PktSlotController } from '@/controllers/pkt-slot-controller'
6
- import { ref, createRef, Ref } from 'lit/directives/ref.js'
4
+ import { PktElementWithSlot } from '@/base-elements/element-with-slot'
5
+ import { slotContent } from '@/directives/slot-content'
7
6
  import type { TAriaLive, TAlertSkin } from 'shared-types'
8
7
  import { updateClassAttribute } from '@/utils/classutils'
9
8
  import specs from 'componentSpecs/alert.json'
@@ -24,12 +23,9 @@ export interface IPktAlert {
24
23
  role?: string
25
24
  }
26
25
  @customElement('pkt-alert')
27
- export class PktAlert extends PktElement implements IPktAlert {
28
- defaultSlot: Ref<HTMLElement> = createRef()
29
-
26
+ export class PktAlert extends PktElementWithSlot implements IPktAlert {
30
27
  constructor() {
31
28
  super()
32
- this.slotController = new PktSlotController(this, this.defaultSlot)
33
29
  this._isClosed = false
34
30
  }
35
31
 
@@ -116,7 +112,7 @@ export class PktAlert extends PktElement implements IPktAlert {
116
112
  : nothing}
117
113
  ${this.title ? html`<div class="pkt-alert__title">${this.title}</div>` : nothing}
118
114
 
119
- <div class="pkt-alert__text" ${ref(this.defaultSlot)}></div>
115
+ <div class="pkt-alert__text">${slotContent(this)}</div>
120
116
 
121
117
  ${this.date
122
118
  ? html`<div class="pkt-alert__date">Sist oppdatert: ${this.date}</div>`
@@ -1,12 +1,11 @@
1
- import { PktElement } from '@/base-elements/element'
2
- import { PktSlotController } from '@/controllers/pkt-slot-controller'
1
+ import { PktElementWithSlot } from '@/base-elements/element-with-slot'
2
+ import { slotContent } from '@/directives/slot-content'
3
3
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon'
4
4
  import type { Booleanish, THTMLButtonType } from 'shared-types'
5
5
  import { html, nothing, PropertyValues } from 'lit'
6
6
  import { property, customElement } from 'lit/decorators.js'
7
7
  import { classMap } from 'lit/directives/class-map.js'
8
8
  import { ifDefined } from 'lit/directives/if-defined.js'
9
- import { createRef, Ref, ref } from 'lit/directives/ref.js'
10
9
 
11
10
  import '@/components/icon'
12
11
 
@@ -57,14 +56,7 @@ export interface IPktButton {
57
56
  loadingAnimationPath?: string
58
57
  }
59
58
  @customElement('pkt-button')
60
- export class PktButton extends PktElement<IPktButton> implements IPktButton {
61
- slotController: PktSlotController
62
- defaultSlot: Ref<HTMLElement> = createRef()
63
-
64
- constructor() {
65
- super()
66
- this.slotController = new PktSlotController(this, this.defaultSlot)
67
- }
59
+ export class PktButton extends PktElementWithSlot<IPktButton> implements IPktButton {
68
60
 
69
61
  // Properties
70
62
  @property({ type: String }) iconName: string = 'user'
@@ -177,7 +169,7 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
177
169
  path=${ifDefined(this.iconPath)}
178
170
  ></pkt-icon>`
179
171
  : nothing}
180
- <span class="pkt-btn__text" ${ref(this.defaultSlot)}></span>
172
+ <span class="pkt-btn__text">${slotContent(this)}</span>
181
173
  ${this.variant === 'icons-right-and-left'
182
174
  ? html`<pkt-icon
183
175
  class="pkt-btn__icon"