@oslokommune/punkt-elements 12.42.11 → 12.42.12

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 (145) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/{accordionitem-aQHOrGzf.js → accordionitem-Be6vyX31.js} +8 -7
  3. package/dist/{accordionitem-C4NQFQHo.cjs → accordionitem-ogt0KNGP.cjs} +5 -5
  4. package/dist/{alert-sBHt7DSh.js → alert-CZyqekhG.js} +22 -21
  5. package/dist/alert-DifeONO7.cjs +32 -0
  6. package/dist/{backlink-BnlrDl9O.js → backlink-C3dfam09.js} +12 -11
  7. package/dist/backlink-C9qmM67k.cjs +13 -0
  8. package/dist/{button-B4Oe8Ar0.js → button-OoC1RGJL.js} +8 -7
  9. package/dist/button-zO41ySZl.cjs +19 -0
  10. package/dist/calendar-BYYJH15O.cjs +108 -0
  11. package/dist/{calendar-Df6-FDRW.js → calendar-qEV4u3xs.js} +11 -10
  12. package/dist/{card-CXhVAeOG.cjs → card-CJue0Esh.cjs} +1 -1
  13. package/dist/{card-0Kf9L0A_.js → card-p-fcc7Wh.js} +9 -8
  14. package/dist/{checkbox-B67_cfqW.js → checkbox-BLI7dfpW.js} +4 -4
  15. package/dist/{checkbox-CiXWukkL.cjs → checkbox-iLywLQwL.cjs} +1 -1
  16. package/dist/{class-map-m7ZCZ49w.js → class-map-DO0E7GkW.js} +1 -1
  17. package/dist/{class-map-DWDPOqjO.cjs → class-map-dph2jLEp.cjs} +1 -1
  18. package/dist/{combobox-Dq7F5v-u.cjs → combobox-BJOVpwAW.cjs} +1 -1
  19. package/dist/{combobox-CsFDvh8U.js → combobox-C_Zj-ZxE.js} +11 -11
  20. package/dist/consent-BkgHuZ37.cjs +11 -0
  21. package/dist/{consent-B17ZIuwm.js → consent-C0pd0E2Q.js} +6 -5
  22. package/dist/{datepicker-DOf9XK9v.cjs → datepicker--I3DF-Ci.cjs} +1 -1
  23. package/dist/{datepicker-Cz6seIz1.js → datepicker-Y6-ORa5u.js} +11 -11
  24. package/dist/{directive-helpers--4ibN__v.js → directive-helpers-D2BEk_ct.js} +1 -1
  25. package/dist/{directive-helpers-v9b0v7lu.cjs → directive-helpers-lOXMtxMR.cjs} +2 -2
  26. package/dist/{element-gAd63VwC.js → element-Cfyyg4nF.js} +8658 -9250
  27. package/dist/element-DUJa1sRq.cjs +212 -0
  28. package/dist/heading-BWV1JThP.js +58 -0
  29. package/dist/heading-C6U6xiqH.cjs +1 -0
  30. package/dist/helptext-BxHMB-XH.cjs +24 -0
  31. package/dist/{helptext-BG_b6ytC.js → helptext-C7oP6VRp.js} +19 -18
  32. package/dist/{icon-CO1TLSs5.js → icon-DPnB79MP.js} +12 -11
  33. package/dist/{icon-B1_BRNqf.cjs → icon-RJ9Op-BB.cjs} +3 -3
  34. package/dist/if-defined-BQOEcjlp.cjs +5 -0
  35. package/dist/{if-defined-Cj-3Kdsr.js → if-defined-I-IZkUY2.js} +1 -1
  36. package/dist/index.d.ts +7 -6
  37. package/dist/input-element-B2JauW-Y.cjs +1 -0
  38. package/dist/{input-element-BEvaQK4g.js → input-element-CaCDNzdI.js} +7 -6
  39. package/dist/{input-wrapper-CC_R5w7V.js → input-wrapper-BDm0DwAW.js} +14 -13
  40. package/dist/{input-wrapper-Dk0rKRlz.cjs → input-wrapper-DrJgi10C.cjs} +4 -4
  41. package/dist/{link-C9X0huxP.js → link-BzKHhT3c.js} +12 -11
  42. package/dist/link-Dhs4dS0S.cjs +7 -0
  43. package/dist/{linkcard-Bhk2ttou.js → linkcard-CyepaY-g.js} +14 -13
  44. package/dist/{linkcard-CaBz6i7A.cjs → linkcard-Czsb01sQ.cjs} +1 -1
  45. package/dist/{listbox-AjDNhDsQ.cjs → listbox-BIcmMiAK.cjs} +7 -7
  46. package/dist/{listbox-DCWdrjFp.js → listbox-Br7v_BsA.js} +11 -10
  47. package/dist/lit-element-DHqqtYbj.cjs +27 -0
  48. package/dist/lit-element-DcUrSbRH.js +595 -0
  49. package/dist/loader-5lt2W9RX.cjs +11 -0
  50. package/dist/{loader-DMp859px.js → loader-Co35Rkbv.js} +16 -15
  51. package/dist/messagebox-BSUbetVQ.cjs +12 -0
  52. package/dist/{messagebox-_1f12rDq.js → messagebox-CQXmoqzD.js} +18 -17
  53. package/dist/modal-5PZ-TDkV.cjs +36 -0
  54. package/dist/{modal-C3kEgTMj.js → modal-DuubDFPT.js} +27 -26
  55. package/dist/pkt-accordion.cjs +1 -1
  56. package/dist/pkt-accordion.js +2 -2
  57. package/dist/pkt-alert.cjs +1 -1
  58. package/dist/pkt-alert.js +1 -1
  59. package/dist/pkt-backlink.cjs +1 -1
  60. package/dist/pkt-backlink.js +1 -1
  61. package/dist/pkt-button.cjs +1 -1
  62. package/dist/pkt-button.js +1 -1
  63. package/dist/pkt-calendar.cjs +1 -1
  64. package/dist/pkt-calendar.js +1 -1
  65. package/dist/pkt-card.cjs +1 -1
  66. package/dist/pkt-card.js +1 -1
  67. package/dist/pkt-checkbox.cjs +1 -1
  68. package/dist/pkt-checkbox.js +1 -1
  69. package/dist/pkt-combobox.cjs +1 -1
  70. package/dist/pkt-combobox.js +1 -1
  71. package/dist/pkt-consent.cjs +1 -1
  72. package/dist/pkt-consent.js +1 -1
  73. package/dist/pkt-datepicker.cjs +1 -1
  74. package/dist/pkt-datepicker.js +1 -1
  75. package/dist/pkt-heading.cjs +1 -1
  76. package/dist/pkt-heading.js +1 -1
  77. package/dist/pkt-helptext.cjs +1 -1
  78. package/dist/pkt-helptext.js +1 -1
  79. package/dist/pkt-icon.cjs +1 -1
  80. package/dist/pkt-icon.js +1 -1
  81. package/dist/pkt-index.cjs +3 -3
  82. package/dist/pkt-index.js +63 -62
  83. package/dist/pkt-input-wrapper.cjs +1 -1
  84. package/dist/pkt-input-wrapper.js +1 -1
  85. package/dist/pkt-link.cjs +1 -1
  86. package/dist/pkt-link.js +1 -1
  87. package/dist/pkt-linkcard.cjs +1 -1
  88. package/dist/pkt-linkcard.js +1 -1
  89. package/dist/pkt-listbox.cjs +1 -1
  90. package/dist/pkt-listbox.js +1 -1
  91. package/dist/pkt-loader.cjs +1 -1
  92. package/dist/pkt-loader.js +1 -1
  93. package/dist/pkt-messagebox.cjs +1 -1
  94. package/dist/pkt-messagebox.js +1 -1
  95. package/dist/pkt-modal.cjs +1 -1
  96. package/dist/pkt-modal.js +1 -1
  97. package/dist/pkt-progressbar.cjs +1 -1
  98. package/dist/pkt-progressbar.js +2 -2
  99. package/dist/pkt-radiobutton.cjs +1 -1
  100. package/dist/pkt-radiobutton.js +1 -1
  101. package/dist/pkt-select.cjs +1 -1
  102. package/dist/pkt-select.js +1 -1
  103. package/dist/pkt-tag.cjs +1 -1
  104. package/dist/pkt-tag.js +1 -1
  105. package/dist/pkt-textarea.cjs +1 -1
  106. package/dist/pkt-textarea.js +1 -1
  107. package/dist/pkt-textinput.cjs +1 -1
  108. package/dist/pkt-textinput.js +1 -1
  109. package/dist/{progressbar-BSO0KWzv.js → progressbar-B75UwwRZ.js} +14 -13
  110. package/dist/{progressbar-BrXtjUvh.cjs → progressbar-DF8IG5IY.cjs} +7 -7
  111. package/dist/{radiobutton-BaIDDCwK.js → radiobutton-CDO-HMP_.js} +5 -5
  112. package/dist/{radiobutton-x10h-JEh.cjs → radiobutton-DUpADoLc.cjs} +1 -1
  113. package/dist/{ref-B-w1vCo8.cjs → ref-BMQZJJEo.cjs} +1 -1
  114. package/dist/{ref-DnSbnXsj.js → ref-DX488m2G.js} +2 -2
  115. package/dist/{repeat-CxQA3AeF.cjs → repeat-B93vZu9q.cjs} +1 -1
  116. package/dist/{repeat-lUFq9w5d.js → repeat-Dl4RVQIF.js} +2 -2
  117. package/dist/select-CE5L--Xw.cjs +48 -0
  118. package/dist/{select-BlL8T2BX.js → select-q7qkLeW4.js} +20 -20
  119. package/dist/{state-BxrO4zNJ.js → state-P2J1I2ny.js} +1 -1
  120. package/dist/{state-D-Recv7U.cjs → state-y-GU-VH8.cjs} +1 -1
  121. package/dist/{tag-m7OTZaCG.js → tag-OSIRLJc0.js} +21 -20
  122. package/dist/tag-sEPrma2U.cjs +18 -0
  123. package/dist/{textarea-Dk8hQMD2.js → textarea-BIvwbRBK.js} +22 -22
  124. package/dist/{textarea-Dc1sUaxx.cjs → textarea-BuhpS5Jj.cjs} +1 -1
  125. package/dist/{textinput-6Ip-0aVY.js → textinput-BFbenR3I.js} +8 -8
  126. package/dist/{textinput-DuLZ26DB.cjs → textinput-BUMlqXQC.cjs} +1 -1
  127. package/package.json +3 -3
  128. package/src/components/heading/heading.ts +63 -37
  129. package/dist/alert-DUWuhtFC.cjs +0 -32
  130. package/dist/backlink-CcAZfB1d.cjs +0 -13
  131. package/dist/button-BT-FRGMk.cjs +0 -19
  132. package/dist/calendar-D4qfcRtv.cjs +0 -108
  133. package/dist/consent-CILYIgC-.cjs +0 -11
  134. package/dist/element-90YeMNbV.cjs +0 -238
  135. package/dist/heading-CGGKEZve.js +0 -59
  136. package/dist/heading-Cmh5bbTl.cjs +0 -1
  137. package/dist/helptext-CC3qLmEz.cjs +0 -24
  138. package/dist/if-defined-C8eotHpL.cjs +0 -5
  139. package/dist/input-element-CInrWeac.cjs +0 -1
  140. package/dist/link-qTz-qNVI.cjs +0 -7
  141. package/dist/loader-BqYcg8Di.cjs +0 -11
  142. package/dist/messagebox-Do_nAUo3.cjs +0 -12
  143. package/dist/modal-C1inKvts.cjs +0 -36
  144. package/dist/select-BkVSXR5K.cjs +0 -48
  145. package/dist/tag-DrbI0ng3.cjs +0 -18
@@ -1,59 +0,0 @@
1
- import { P as f, x as l, n as o, a as d } from "./element-gAd63VwC.js";
2
- import { P as g } from "./pkt-slot-controller-BPGj-LC5.js";
3
- import { e as r } from "./class-map-m7ZCZ49w.js";
4
- import { e as $, n as i } from "./ref-DnSbnXsj.js";
5
- var S = Object.defineProperty, y = Object.getOwnPropertyDescriptor, a = (t, n, p, h) => {
6
- for (var e = h > 1 ? void 0 : h ? y(n, p) : n, u = t.length - 1, c; u >= 0; u--)
7
- (c = t[u]) && (e = (h ? c(n, p, e) : c(e)) || e);
8
- return h && e && S(n, p, e), e;
9
- };
10
- let s = class extends f {
11
- constructor() {
12
- super(), this.defaultSlot = $(), this.size = "medium", this.level = 2, this.noSpacing = !0, this.visuallyHidden = !1, this.align = "start", this.slotController = new g(this, this.defaultSlot);
13
- }
14
- render() {
15
- const t = {
16
- "pkt-heading": !0,
17
- [`pkt-heading--${this.size}`]: this.size,
18
- "pkt-heading--noSpacing": this.noSpacing,
19
- "pkt-sr-only": this.visuallyHidden,
20
- [`pkt-heading--${this.align}`]: this.align
21
- };
22
- switch (this.level) {
23
- case 2:
24
- return l`<h2 class=${r(t)} ${i(this.defaultSlot)}></h2>`;
25
- case 3:
26
- return l`<h3 class=${r(t)} ${i(this.defaultSlot)}></h3>`;
27
- case 4:
28
- return l`<h4 class=${r(t)} ${i(this.defaultSlot)}></h4>`;
29
- case 5:
30
- return l`<h5 class=${r(t)} ${i(this.defaultSlot)}></h5>`;
31
- case 6:
32
- return l`<h6 class=${r(t)} ${i(this.defaultSlot)}></h6>`;
33
- case 1:
34
- default:
35
- return l`<h1 class=${r(t)} ${i(this.defaultSlot)}></h1>`;
36
- }
37
- }
38
- };
39
- a([
40
- o({ type: String, reflect: !0 })
41
- ], s.prototype, "size", 2);
42
- a([
43
- o({ type: Number, reflect: !0 })
44
- ], s.prototype, "level", 2);
45
- a([
46
- o({ type: Boolean, reflect: !0 })
47
- ], s.prototype, "noSpacing", 2);
48
- a([
49
- o({ type: Boolean, reflect: !0 })
50
- ], s.prototype, "visuallyHidden", 2);
51
- a([
52
- o({ type: String, reflect: !0 })
53
- ], s.prototype, "align", 2);
54
- s = a([
55
- d("pkt-heading")
56
- ], s);
57
- export {
58
- s as P
59
- };
@@ -1 +0,0 @@
1
- "use strict";const e=require("./element-90YeMNbV.cjs"),c=require("./pkt-slot-controller-BzddBp7z.cjs"),l=require("./class-map-DWDPOqjO.cjs"),n=require("./ref-B-w1vCo8.cjs");var p=Object.defineProperty,d=Object.getOwnPropertyDescriptor,r=(a,t,o,i)=>{for(var s=i>1?void 0:i?d(t,o):t,h=a.length-1,u;h>=0;h--)(u=a[h])&&(s=(i?u(t,o,s):u(s))||s);return i&&s&&p(t,o,s),s};exports.PktHeading=class extends e.PktElement{constructor(){super(),this.defaultSlot=n.e(),this.size="medium",this.level=2,this.noSpacing=!0,this.visuallyHidden=!1,this.align="start",this.slotController=new c.PktSlotController(this,this.defaultSlot)}render(){const t={"pkt-heading":!0,[`pkt-heading--${this.size}`]:this.size,"pkt-heading--noSpacing":this.noSpacing,"pkt-sr-only":this.visuallyHidden,[`pkt-heading--${this.align}`]:this.align};switch(this.level){case 2:return e.x`<h2 class=${l.e(t)} ${n.n(this.defaultSlot)}></h2>`;case 3:return e.x`<h3 class=${l.e(t)} ${n.n(this.defaultSlot)}></h3>`;case 4:return e.x`<h4 class=${l.e(t)} ${n.n(this.defaultSlot)}></h4>`;case 5:return e.x`<h5 class=${l.e(t)} ${n.n(this.defaultSlot)}></h5>`;case 6:return e.x`<h6 class=${l.e(t)} ${n.n(this.defaultSlot)}></h6>`;case 1:default:return e.x`<h1 class=${l.e(t)} ${n.n(this.defaultSlot)}></h1>`}}};r([e.n({type:String,reflect:!0})],exports.PktHeading.prototype,"size",2);r([e.n({type:Number,reflect:!0})],exports.PktHeading.prototype,"level",2);r([e.n({type:Boolean,reflect:!0})],exports.PktHeading.prototype,"noSpacing",2);r([e.n({type:Boolean,reflect:!0})],exports.PktHeading.prototype,"visuallyHidden",2);r([e.n({type:String,reflect:!0})],exports.PktHeading.prototype,"align",2);exports.PktHeading=r([e.t("pkt-heading")],exports.PktHeading);
@@ -1,24 +0,0 @@
1
- "use strict";const t=require("./element-90YeMNbV.cjs"),x=require("./ref-B-w1vCo8.cjs"),h=require("./icon-B1_BRNqf.cjs"),u=require("./class-map-DWDPOqjO.cjs"),a=require("./state-D-Recv7U.cjs"),c=require("./stringutils-CkVRq4jP.cjs"),d=require("./input-wrapper-EoSAbU-U.cjs"),k=require("./pkt-slot-controller-BzddBp7z.cjs");var w=Object.defineProperty,_=Object.getOwnPropertyDescriptor,n=(o,p,r,l)=>{for(var e=l>1?void 0:l?_(p,r):p,s=o.length-1,i;s>=0;s--)(i=o[s])&&(e=(l?i(p,r,e):i(e))||e);return l&&e&&w(p,r,e),e};exports.PktHelptext=class extends t.PktElement{constructor(){super(),this.defaultSlot=x.e(),this.forId=c.uuidish(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=d.specs.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.filledSlots=new Set,this.slotController=new k.PktSlotController(this,this.defaultSlot)}updateSlots(p){this.filledSlots=new Set(p)}render(){const p=()=>{const s=!this.isHelpTextOpen;this.isHelpTextOpen=s,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:s}}))},r=u.e({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.filledSlots.size>0}),l=()=>this.helptextDropdown?t.x`<div class="pkt-inputwrapper__helptext-expandable">
2
- <button
3
- class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
4
- type="button"
5
- @click=${p}
6
- >
7
- <pkt-icon
8
- class="pkt-btn__icon"
9
- name="${this.isHelpTextOpen?"chevron-thin-up":"chevron-thin-down"}"
10
- ></pkt-icon>
11
- <span class="pkt-btn__text">${h.o(this.helptextDropdownButton)}</span>
12
- </button>
13
- <div
14
- class="${u.e({"pkt-inputwrapper__helptext":!0,"pkt-inputwrapper__helptext-expandable-open":this.isHelpTextOpen,"pkt-inputwrapper__helptext-expandable-closed":!this.isHelpTextOpen})}"
15
- >
16
- ${h.o(this.helptextDropdown)}
17
- </div>
18
- </div>`:t.E,e=()=>t.x`<div class="${r}">
19
- <div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
20
- <div class="pkt-contents" ${x.n(this.defaultSlot)} name="helptext"></div>
21
- ${this.helptext&&h.o(this.helptext)}
22
- </div>
23
- ${l()}
24
- </div>`;return t.x`${e()}`}};n([t.n({type:String,reflect:!0})],exports.PktHelptext.prototype,"forId",2);n([t.n({type:String})],exports.PktHelptext.prototype,"helptext",2);n([t.n({type:String})],exports.PktHelptext.prototype,"helptextDropdown",2);n([t.n({type:String})],exports.PktHelptext.prototype,"helptextDropdownButton",2);n([a.r()],exports.PktHelptext.prototype,"isHelpTextOpen",2);n([a.r()],exports.PktHelptext.prototype,"filledSlots",2);exports.PktHelptext=n([t.t("pkt-helptext")],exports.PktHelptext);
@@ -1,5 +0,0 @@
1
- "use strict";const t=require("./element-90YeMNbV.cjs");/**
2
- * @license
3
- * Copyright 2018 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const o=e=>e??t.E;exports.o=o;
@@ -1 +0,0 @@
1
- "use strict";const e=require("./element-90YeMNbV.cjs"),y=require("./state-D-Recv7U.cjs"),g=require("./stringutils-CkVRq4jP.cjs"),v=require("./input-wrapper-EoSAbU-U.cjs");var b=Object.defineProperty,i=(o,t,a,l)=>{for(var r=void 0,n=o.length-1,h;n>=0;n--)(h=o[n])&&(r=h(t,a,r)||r);return r&&b(t,a,r),r};class s extends e.PktElement{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=g.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=v.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.translations.forms.labels.optional,this.requiredText=e.translations.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(t){var a,l,r,n,h,u,p,d,f,c,m;t&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.translations.forms.messages.required,t):(a=t.validity)!=null&&a.typeMismatch||(l=t.validity)!=null&&l.badInput?this.internals.setValidity({typeMismatch:!0},e.translations.forms.messages.invalid,t):(r=t.validity)!=null&&r.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.translations.forms.messages.invalidPattern,t):(n=t.validity)!=null&&n.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},e.translations.forms.messages.tooShort,t):(h=t.validity)!=null&&h.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},e.translations.forms.messages.tooLong,t):(u=t.validity)!=null&&u.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?e.translations.forms.messages.rangeUnderflowMin.replace("{min}",(p=this.min)==null?void 0:p.toString()):e.translations.forms.messages.rangeUnderflow,t):(d=t.validity)!=null&&d.stepMismatch?this.internals.setValidity({stepMismatch:!0},e.translations.forms.messages.invalid,t):(f=t.validity)!=null&&f.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?e.translations.forms.messages.rangeOverflowMax.replace("{max}",(c=this.max)==null?void 0:c.toString()):e.translations.forms.messages.rangeOverflow,t):(m=t.validity)!=null&&m.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({}))}setFormValue(t){if(this.internals)if(Array.isArray(t)){const a=new FormData;t.forEach(l=>{a.append(this.name,l)}),this.internals.setFormValue(a)}else this.internals.setFormValue(t)}valueChecked(t){if(!this.touched)return;const a=this.internals.form||this.closest("form"),l=a?new FormData(a):null;a&&a.querySelectorAll(`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`).forEach(r=>{const n=r;n.name===this.name&&n.value!==this.value&&n.checked&&(n.checked=!1)}),typeof t=="string"?(this.checked=t==="true",this.internals.ariaChecked=t==="true"):typeof t=="boolean"&&(this.checked=t,this.internals.ariaChecked=t),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),l&&l.append(this.name,this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue(null,null),l&&l.delete(this.name),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(t,a){(a!==this.value||a!==this._value)&&(typeof t=="string"?((this.multiple||this.range)&&t.includes(",")&&(t=t.split(",")),this.value=t,this._value=Array.isArray(t)?t:[t]):Array.isArray(t)?(this.value=this.multiple||this.range?t:t[0],this._value=t):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&a&&a.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(a==null?void 0:a.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const t=this.multiple||this.range?[]:"";this.value=t,this.internals.setFormValue(t),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}onChange(t){if(!this.touched){this.touched=!0,t&&this.setFormValue(t);return}typeof t!="string"&&!Array.isArray(t)||((this.range||this.multiple)&&!Array.isArray(t)&&t.includes(",")&&(t=t.split(",")),!this.multiple&&!this.range&&Array.isArray(t)&&(t=t[0]),this.setFormValue(t),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0})))}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(t=>{t.selected=!1}),this.checked!==void 0?(this.checked=!1,this.internals.ariaChecked=!1,this.internals.setFormValue("",""),this.inputRef.value.checked=!1,this.valueChecked(this.checked)):(this.internals.setFormValue(""),this.value=this.defaultValue||(this.multiple||this.range?[]:""),this._value=this.value,this.valueChanged(this.value,null)),this.internals.ariaInvalid=!1}updated(t){super.updated(t),t.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(t){if(super.firstUpdated(t),!this.form){const a=this.internals.form||this.closest("form");this.form=a}if(this.value&&this.defaultValue!==null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=!0,this.checked=!0),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const a=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=a,this.internals.setFormValue(a?this.value||"on":"",a?this.value||"on":"")}else this.internals.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}}i([e.n()],s.prototype,"defaultValue");i([e.n({type:Boolean,reflect:!0})],s.prototype,"disabled");i([e.n({type:Boolean,reflect:!0})],s.prototype,"readonly");i([e.n({type:Boolean,reflect:!0})],s.prototype,"required");i([e.n({type:Number,reflect:!0})],s.prototype,"max");i([e.n({type:Number,reflect:!0})],s.prototype,"maxlength");i([e.n({type:Number,reflect:!0})],s.prototype,"min");i([e.n({type:Number,reflect:!0})],s.prototype,"minlength");i([e.n({type:Number,reflect:!0})],s.prototype,"step");i([e.n({type:String})],s.prototype,"ariaDescribedBy");i([e.n({type:String})],s.prototype,"ariaLabelledby");i([e.n({type:String,reflect:!0})],s.prototype,"name");i([e.n({type:String,reflect:!0})],s.prototype,"pattern");i([e.n({type:String,reflect:!0})],s.prototype,"placeholder");i([e.n({type:String,reflect:!0})],s.prototype,"id");i([e.n({type:Boolean})],s.prototype,"counter");i([e.n({type:Boolean})],s.prototype,"hasError");i([e.n({type:Boolean})],s.prototype,"inline");i([e.n({type:Boolean})],s.prototype,"hasFieldset");i([e.n({type:Boolean})],s.prototype,"optionalTag");i([e.n({type:Boolean})],s.prototype,"requiredTag");i([e.n({type:Boolean})],s.prototype,"skipForwardTestid");i([e.n({type:Boolean,reflect:!1})],s.prototype,"useWrapper");i([e.n({type:Boolean,reflect:!0})],s.prototype,"fullwidth");i([e.n({type:Number})],s.prototype,"counterMaxLength");i([e.n({type:String})],s.prototype,"errorMessage");i([e.n({type:String})],s.prototype,"helptext");i([e.n({type:String})],s.prototype,"helptextDropdown");i([e.n({type:String,reflect:!1})],s.prototype,"helptextDropdownButton");i([e.n({type:String})],s.prototype,"label");i([e.n({type:String,reflect:!1})],s.prototype,"optionalText");i([e.n({type:String,reflect:!1})],s.prototype,"requiredText");i([e.n({type:String,attribute:"data-testid"})],s.prototype,"dataTestid");i([y.r()],s.prototype,"touched");exports.PktInputElement=s;
@@ -1,7 +0,0 @@
1
- "use strict";const t=require("./element-90YeMNbV.cjs"),f=require("./pkt-slot-controller-BzddBp7z.cjs"),c=require("./ref-B-w1vCo8.cjs"),h=require("./class-map-DWDPOqjO.cjs");require("./icon-B1_BRNqf.cjs");const k={href:{default:"#"},target:{default:"_self"},external:{default:!1}},a={props:k};var u=Object.defineProperty,P=Object.getOwnPropertyDescriptor,n=(o,r,s,i)=>{for(var e=i>1?void 0:i?P(r,s):r,l=o.length-1,p;l>=0;l--)(p=o[l])&&(e=(i?p(r,s,e):p(e))||e);return i&&e&&u(r,s,e),e};exports.PktLink=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.href=a.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=a.props.external.default,this.target=a.props.target.default,this.slotController=new f.PktSlotController(this,this.defaultSlot)}render(){const r={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return t.x`<a
2
- class=${h.e(r)}
3
- href=${this.href}
4
- .target=${this.target}
5
- .rel=${this.external?"noopener noreferrer":t.E}
6
- >${this.iconName?t.x`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>`:""} <span ${c.n(this.defaultSlot)}>Link</span></a
7
- >`}};n([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"href",2);n([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"iconName",2);n([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"iconPosition",2);n([t.n({type:Boolean,reflect:!0})],exports.PktLink.prototype,"external",2);n([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"target",2);exports.PktLink=n([t.t("pkt-link")],exports.PktLink);
@@ -1,11 +0,0 @@
1
- "use strict";const t=require("./element-90YeMNbV.cjs"),d=require("./class-map-DWDPOqjO.cjs"),h=require("./state-D-Recv7U.cjs"),p=require("./ref-B-w1vCo8.cjs"),u=require("./pkt-slot-controller-BzddBp7z.cjs");require("./icon-B1_BRNqf.cjs");var c=Object.defineProperty,y=Object.getOwnPropertyDescriptor,s=(r,e,a,o)=>{for(var i=o>1?void 0:o?y(e,a):e,n=r.length-1,l;n>=0;n--)(l=r[n])&&(i=(o?l(e,a,i):l(i))||i);return o&&i&&c(e,a,i),i};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/latest/animations/";exports.PktLoader=class extends t.PktElement{constructor(){super(),this.defaultSlot=p.e(),this.delay=0,this.inline=!1,this.isLoading=!0,this.message=null,this.size="medium",this.variant="shapes",this.loadingAnimationPath=window.pktAnimationPath,this._shouldDisplayLoader=!1,this.slotController=new u.PktSlotController(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this._shouldDisplayLoader=this.delay===0,this.delay>0&&this.setupLoader()}updated(e){e.has("delay")&&this.setupLoader()}render(){const e=d.e({"pkt-loader":!0,[`pkt-loader--${this.inline?"inline":"box"}`]:!0,[`pkt-loader--${this.size}`]:!0}),a=d.e({"pkt-contents":!0,"pkt-hide":this.isLoading});return t.x`<div role="status" aria-live="polite" .aria-busy=${this.isLoading} class=${e}>
2
- ${this.isLoading&&this._shouldDisplayLoader?t.x`<div class="pkt-loader__spinner">
3
- <pkt-icon
4
- name=${this.getVariant(this.variant)}
5
- path=${this.loadingAnimationPath}
6
- class="pkt-loader__svg pkt-loader__${this.variant}"
7
- ></pkt-icon>
8
- ${this.message&&t.x`<p>${this.message}</p>`}
9
- </div>`:t.E}
10
- <div class=${a} ${p.n(this.defaultSlot)}></div>
11
- </div>`}getVariant(e){switch(e){case"blue":return"spinner-blue";case"rainbow":return"spinner";default:return"loader"}}setupLoader(){this.delay>0&&(this._shouldDisplayLoader=!1,setTimeout(()=>{this._shouldDisplayLoader=!0,this.requestUpdate()},this.delay))}};s([t.n({type:Number})],exports.PktLoader.prototype,"delay",2);s([t.n({type:Boolean})],exports.PktLoader.prototype,"inline",2);s([t.n({type:Boolean})],exports.PktLoader.prototype,"isLoading",2);s([t.n({type:String})],exports.PktLoader.prototype,"message",2);s([t.n({type:String})],exports.PktLoader.prototype,"size",2);s([t.n({type:String})],exports.PktLoader.prototype,"variant",2);s([t.n({type:String})],exports.PktLoader.prototype,"loadingAnimationPath",2);s([h.r()],exports.PktLoader.prototype,"_shouldDisplayLoader",2);exports.PktLoader=s([t.t("pkt-loader")],exports.PktLoader);
@@ -1,12 +0,0 @@
1
- "use strict";const e=require("./element-90YeMNbV.cjs"),u=require("./pkt-slot-controller-BzddBp7z.cjs"),n=require("./ref-B-w1vCo8.cjs"),b=require("./class-map-DWDPOqjO.cjs"),d=require("./state-D-Recv7U.cjs");require("./icon-B1_BRNqf.cjs");const k=require("./classutils-BwNK82ZQ.cjs"),h={skin:{default:"beige"},compact:{default:!1},closable:{default:!1}},p={props:h};var f=Object.defineProperty,x=Object.getOwnPropertyDescriptor,o=(i,t,a,l)=>{for(var s=l>1?void 0:l?x(t,a):t,r=i.length-1,c;r>=0;r--)(c=i[r])&&(s=(l?c(t,a,s):c(s))||s);return l&&s&&f(t,a,s),s};exports.PktMessagebox=class extends e.PktElement{constructor(){super(),this.defaultSlot=n.e(),this.closable=p.props.closable.default,this.compact=p.props.compact.default,this.title="",this.skin=p.props.skin.default,this._isClosed=!1,this.close=t=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:t},bubbles:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:t},bubbles:!0}))},this.slotController=new u.PktSlotController(this,this.defaultSlot),this._isClosed=!1}updated(t){super.updated(t),t.has("_isClosed")&&k.updateClassAttribute(this,"pkt-hide",this._isClosed)}render(){const t={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed};return e.x`<div class=${b.e(t)}>
2
- ${this.closable?e.x`<div class="pkt-messagebox__close">
3
- <button
4
- @click=${this.close}
5
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
6
- >
7
- <pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
8
- </button>
9
- </div>`:e.E}
10
- ${this.title?e.x`<div class="pkt-messagebox__title">${this.title}</div>`:e.E}
11
- <div class="pkt-messagebox__text" ${n.n(this.defaultSlot)}></div>
12
- </div>`}};o([e.n({type:Boolean,reflect:!0})],exports.PktMessagebox.prototype,"closable",2);o([e.n({type:Boolean,reflect:!0})],exports.PktMessagebox.prototype,"compact",2);o([e.n({type:String,reflect:!0})],exports.PktMessagebox.prototype,"title",2);o([e.n({type:String,reflect:!0})],exports.PktMessagebox.prototype,"skin",2);o([d.r()],exports.PktMessagebox.prototype,"_isClosed",2);exports.PktMessagebox=o([e.t("pkt-messagebox")],exports.PktMessagebox);
@@ -1,36 +0,0 @@
1
- "use strict";const d=require("./class-map-DWDPOqjO.cjs"),o=require("./element-90YeMNbV.cjs"),u=require("./state-D-Recv7U.cjs"),k=require("./pkt-slot-controller-BzddBp7z.cjs"),r=require("./ref-B-w1vCo8.cjs");require("./icon-B1_BRNqf.cjs");const m={hideCloseButton:{default:!1},closeOnBackdropClick:{default:!1},size:{default:"medium"}},h={props:m};var v=Object.defineProperty,f=Object.getOwnPropertyDescriptor,l=(c,t,e,i)=>{for(var s=i>1?void 0:i?f(t,e):t,n=c.length-1,a;n>=0;n--)(a=c[n])&&(s=(i?a(t,e,s):a(s))||s);return i&&s&&v(t,e,s),s};exports.PktModal=class extends o.PktElement{constructor(){super(),this.headingText="",this.removePadding=!1,this.hideCloseButton=h.props.hideCloseButton.default,this.closeOnBackdropClick=h.props.closeOnBackdropClick.default,this.closeButtonSkin="blue",this.size=h.props.size.default,this.variant="dialog",this.drawerPosition="right",this.transparentBackdrop=!1,this.defaultSlot=r.e(),this.dialogRef=r.e(),this._isOpen=!1,this.close=(t,e=!1)=>{var s;if(!this._isOpen)return;this._isOpen=!1,document.body.classList.remove("pkt-modal--open");const i=document.activeElement;i&&!this.isElementInViewport(i)&&i.scrollIntoView({behavior:"smooth",block:"nearest"}),this.dispatchEvent(new CustomEvent("close",{detail:{origin:t},bubbles:!0,composed:!0})),e||(s=this.dialogRef.value)==null||s.close(),this.requestUpdate()},this.showModal=(t=null)=>{var i;this._isOpen=!0,(i=this.dialogRef.value)==null||i.showModal();const e=document.querySelector(".pkt-modal");requestAnimationFrame(()=>{var s;this.dialogRef.value&&((s=this.dialogRef.value)==null||s.focus())}),e&&document.body.classList.add("pkt-modal--open"),this.dispatchEvent(new CustomEvent("showModal",{detail:{origin:t},bubbles:!0,composed:!0})),this.requestUpdate()},this.slotController=new k.PktSlotController(this,this.defaultSlot),this._isOpen=!1}async connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown.bind(this)),document.addEventListener("click",this.handleBackdropClick.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("click",this.handleBackdropClick)}async firstUpdated(t){super.firstUpdated(t),this.dialogRef.value&&!window.HTMLDialogElement&&!this.dialogRef.value.showModal&&("document"in window&&"createElement"in document&&(await Promise.resolve().then(()=>require("./dialog-polyfill.esm-CPKZe7AL.cjs")).then(i=>i.default)).registerDialog(this.dialogRef.value),this.dialogRef.value.addEventListener("close",()=>{this.close(new Event("close"),!0)}))}handleKeyDown(t){t.key==="Escape"&&this.close(t)}handleBackdropClick(t){var e;this.closeOnBackdropClick&&t.target===((e=this.dialogRef)==null?void 0:e.value)&&this.close(t)}isElementInViewport(t){const e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){const t={"pkt-modal":!0,"pkt-modal--removePadding":this.removePadding??!1,"pkt-modal--noHeadingText":this.headingText===""||this.headingText===void 0,"pkt-modal--noShadow":this.closeButtonSkin==="yellow-filled","pkt-modal--transparentBackdrop":this.transparentBackdrop??!1,[`pkt-modal--${this.size}`]:this.size!==void 0,[`pkt-modal__${this.variant}`]:this.variant!==void 0,[`pkt-modal__drawer--${this.drawerPosition}`]:this.variant==="drawer"},e={"pkt-modal__headingText":!0,"pkt-txt-24":!0},i={"pkt-modal__content":!0,"pkt-txt-18-light":!0},s=this.closeButtonSkin==="blue",n={"pkt-modal__closeButton":!0,[`pkt-modal__closeButton--${this.closeButtonSkin}`]:!0},a={"pkt-btn":!0,[`pkt-btn--${s?"tertiary":"primary"}`]:!0,"pkt-btn--icon-only":!0,"pkt-btn--medium":!0};return o.x`
2
- <dialog
3
- class=${d.e(t)}
4
- ${r.n(this.dialogRef)}
5
- aria-labelledby="pkt-modal__headingText"
6
- aria-describedby="pkt-modal__content"
7
- @close=${p=>this.close(p,!0)}
8
- >
9
- <div class="pkt-modal__wrapper">
10
- ${this.headingText||!this.hideCloseButton?o.x`<div class="pkt-modal__header">
11
- <div class="pkt-modal__header-background"></div>
12
- ${this.headingText?o.x`<h1 id="pkt-modal__headingText" class=${d.e(e)}>
13
- ${this.headingText}
14
- </h1>`:o.x`<div class="pkt-modal__headingText"></div>`}
15
- ${this.hideCloseButton?o.x`<div class="pkt-modal__noCloseButton"></div>`:o.x`<div class="${d.e(n)}">
16
- <pkt-button
17
- @click=${p=>this.close(p)}
18
- class=${d.e(a)}
19
- aria-label="close"
20
- iconname="close"
21
- variant="icon-only"
22
- >
23
- Lukk
24
- </pkt-button>
25
- </div>`}
26
- </div>`:o.E}
27
- <div class="pkt-modal__container">
28
- <div
29
- id="pkt-modal__content"
30
- class=${d.e(i)}
31
- ${r.n(this.defaultSlot)}
32
- ></div>
33
- </div>
34
- </div>
35
- </dialog>
36
- `}};l([o.n({type:String})],exports.PktModal.prototype,"headingText",2);l([o.n({type:Boolean})],exports.PktModal.prototype,"removePadding",2);l([o.n({type:Boolean})],exports.PktModal.prototype,"hideCloseButton",2);l([o.n({type:Boolean})],exports.PktModal.prototype,"closeOnBackdropClick",2);l([o.n({type:String})],exports.PktModal.prototype,"closeButtonSkin",2);l([o.n({type:String})],exports.PktModal.prototype,"size",2);l([o.n({type:String})],exports.PktModal.prototype,"variant",2);l([o.n({type:String})],exports.PktModal.prototype,"drawerPosition",2);l([o.n({type:Boolean})],exports.PktModal.prototype,"transparentBackdrop",2);l([u.r()],exports.PktModal.prototype,"_isOpen",2);exports.PktModal=l([o.t("pkt-modal")],exports.PktModal);
@@ -1,48 +0,0 @@
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`
2
- <pkt-input-wrapper
3
- ?counter=${this.counter}
4
- ?disabled=${this.disabled}
5
- ?hasError=${this.hasError}
6
- ?hasFieldset=${this.hasFieldset}
7
- ?inline=${this.inline}
8
- ?optionalTag=${this.optionalTag}
9
- ?requiredTag=${this.requiredTag}
10
- ?useWrapper=${this.useWrapper}
11
- ariaDescribedBy=${o.o(this.ariaDescribedBy)}
12
- class="pkt-select"
13
- errorMessage=${o.o(this.errorMessage)}
14
- forId=${this.id+"-input"}
15
- helptext=${o.o(this.helptext)}
16
- helptextDropdown=${o.o(this.helptextDropdown)}
17
- helptextDropdownButton=${o.o(this.helptextDropdownButton)}
18
- label=${o.o(this.label)}
19
- optionalText=${o.o(this.optionalText)}
20
- requiredText=${o.o(this.requiredText)}
21
- >
22
- <select
23
- class=${t}
24
- aria-invalid=${this.hasError}
25
- aria-errormessage=${`${this.id}-error`}
26
- aria-labelledby=${o.o(this.ariaLabelledby)}
27
- ?disabled=${this.disabled}
28
- id=${this.id+"-input"}
29
- name=${(this.name||this.id)+"-input"}
30
- value=${this.value}
31
- @change=${e=>{this.touched=!0,this.value=e.target.value,e.stopImmediatePropagation()}}
32
- @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
33
- @focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
34
- @blur=${e=>{this.onBlur(),e.stopImmediatePropagation()}}
35
- ${h.n(this.inputRef)}
36
- >
37
- ${this._options.length>0&&this._options.map(e=>r.x`<option
38
- value=${e.value}
39
- ?selected=${this.value==e.value||e.selected}
40
- ?disabled=${e.disabled}
41
- ?hidden=${e.hidden}
42
- >
43
- ${e.label}
44
- </option>`)}
45
- </select>
46
- <div class="pkt-contents" ${h.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
47
- </pkt-input-wrapper>
48
- `}returnNumberOrNull(t){return t==null||isNaN(t)?null:t}};a([r.n({type:Array})],exports.PktSelect.prototype,"options",2);a([r.n({type:String})],exports.PktSelect.prototype,"value",2);a([p.r()],exports.PktSelect.prototype,"_options",2);exports.PktSelect=a([r.t("pkt-select")],exports.PktSelect);
@@ -1,18 +0,0 @@
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`
2
- <button
3
- class=${u.e(o)}
4
- type=${this.type}
5
- @click=${this.close}
6
- aria-label=${h.o(this.ariaLabel||void 0)}
7
- aria-description=${h.o(this._ariaDescription||void 0)}
8
- >
9
- ${this.iconName&&t.x`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
10
- <span ${c.n(this.defaultSlot)}></span>
11
- <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
12
- </button>
13
- `:t.x`
14
- <span class=${u.e(e)}>
15
- ${this.iconName&&t.x`<pkt-icon class="pkt-tag__icon" name=${this.iconName}></pkt-icon>`}
16
- <span ${c.n(this.defaultSlot)}></span>
17
- </span>
18
- `}};i([t.n({type:Boolean,reflect:!0})],exports.PktTag.prototype,"closeTag",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"size",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"skin",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"textStyle",2);i([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"iconName",2);i([t.n({type:String})],exports.PktTag.prototype,"type",2);i([t.n({type:String})],exports.PktTag.prototype,"ariaLabel",2);i([k.r()],exports.PktTag.prototype,"_isClosed",2);i([k.r()],exports.PktTag.prototype,"_ariaDescription",2);exports.PktTag=i([t.t("pkt-tag")],exports.PktTag);