@oslokommune/punkt-elements 20.0.3 → 20.1.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 (193) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/{accordion-5N_ptxrN.cjs → accordion-CSSp30G1.cjs} +1 -1
  3. package/dist/{accordion-C5cu1xXT.js → accordion-DIjltHSH.js} +11 -14
  4. package/dist/{alert-DkyTTo7S.cjs → alert-0a5lX0pL.cjs} +12 -12
  5. package/dist/{alert-CA1fDbyc.js → alert-ZrB-P881.js} +36 -38
  6. package/dist/{async-directive-DCLIOGR8.cjs → async-directive-Bn7zgxUy.cjs} +1 -1
  7. package/dist/{async-directive-BcS8rfeC.js → async-directive-Ct3Mrb1M.js} +10 -11
  8. package/dist/{backlink-CXOxMeyt.cjs → backlink-BAvqdPlG.cjs} +1 -1
  9. package/dist/{backlink-CDBRcaAu.js → backlink-MBTAhQuD.js} +5 -7
  10. package/dist/{booleanish-OQJTYSrw.js → booleanish-CBa3Cr2h.js} +1 -2
  11. package/dist/{breadcrumbs-5oUaCef3.js → breadcrumbs-DtEt1-wn.js} +3 -4
  12. package/dist/{button-Bswo1C0M.js → button-CJzu0l5A.js} +45 -35
  13. package/dist/button-DHVRpzpS.cjs +32 -0
  14. package/dist/{calendar-BOd-9PDd.js → calendar-CkAAgviq.js} +66 -76
  15. package/dist/calendar-xYEsKilS.cjs +85 -0
  16. package/dist/{card-CKStAH0Q.js → card-CsEfBJcP.js} +10 -12
  17. package/dist/{card-BbV4OBqb.cjs → card-XznwedEG.cjs} +1 -1
  18. package/dist/{checkbox-iMOdzpJ_.cjs → checkbox-Cg7wnn8U.cjs} +1 -1
  19. package/dist/{checkbox-DIJbuqWm.js → checkbox-XvlUQmg5.js} +8 -10
  20. package/dist/{checkbox-group-Kua6HuRE.cjs → checkbox-group-BF29zyLd.cjs} +1 -1
  21. package/dist/{checkbox-group-DLLbWgQb.js → checkbox-group-CRIV5CX0.js} +8 -10
  22. package/dist/{class-map-BDwVSgLb.js → class-map-C9n5CNC8.js} +2 -3
  23. package/dist/{classutils-DcYnSgfc.js → classutils-C4jETHHk.js} +1 -2
  24. package/dist/{combobox-Pxa80TeZ.js → combobox-CDJcIkNJ.js} +63 -66
  25. package/dist/combobox-DuXavWEY.cjs +139 -0
  26. package/dist/{consent-UkinU27V.cjs → consent-BOSXNt4Y.cjs} +1 -1
  27. package/dist/{consent-p-0n2b9x.js → consent-DwppvYBR.js} +5 -7
  28. package/dist/{consume-Bp12si68.js → consume-C6aWEFx-.js} +4 -8
  29. package/dist/{converters-CW6SN0TT.cjs → converters-Dp64-kF1.cjs} +1 -1
  30. package/dist/{converters-CYgQrWVm.js → converters-v_GK06o3.js} +36 -72
  31. package/dist/{datepicker-Cpiu_Nrf.cjs → datepicker-Cnrbqm62.cjs} +53 -53
  32. package/dist/{datepicker-BpxUWiIC.js → datepicker-DHdFA8Dx.js} +82 -88
  33. package/dist/define-component-spec-wHP10r2x.js +5 -0
  34. package/dist/{dialog-polyfill.esm-D39dWbRt.js → dialog-polyfill.esm-BGBREnq_.js} +2 -3
  35. package/dist/dialog-polyfill.esm-BPk0-8XP.cjs +1 -0
  36. package/dist/{directive-helpers-BoDzpPID.js → directive-helpers-KMRvtO9j.js} +2 -3
  37. package/dist/{element-DLgZkx5L.js → element-Bwc-likm.js} +9 -18
  38. package/dist/{element-with-slot-mG-h7Sjw.js → element-with-slot-47quDZRt.js} +4 -6
  39. package/dist/{element-with-slot-CeKuRE3_.cjs → element-with-slot-D_8fAzCW.cjs} +1 -1
  40. package/dist/{fetch-header-footer-data-Pc32etrk.js → fetch-header-footer-data-CPVt_P8s.js} +3 -6
  41. package/dist/{fileupload-vPDmtXiM.js → fileupload-BQw5nlzQ.js} +25 -36
  42. package/dist/{fileupload-DXJtAagE.cjs → fileupload-Cjde62AR.cjs} +1 -1
  43. package/dist/{focus-modality-controller-Dc2S-KqR.js → focus-modality-controller-DVsT6GeR.js} +1 -2
  44. package/dist/focus-trap-C-PcFOw6.js +42 -0
  45. package/dist/focus-trap-C9tsr-xL.cjs +1 -0
  46. package/dist/{footer-CpE05IW2.cjs → footer-NQaQc2DH.cjs} +9 -9
  47. package/dist/{footer-D8t0PCPC.js → footer-SbOYv50e.js} +20 -24
  48. package/dist/{format-BTeSVkED.js → format-DwjTfa9h.js} +1 -2
  49. package/dist/{header-ChT1hHNA.js → header-CZnKVVt4.js} +22 -26
  50. package/dist/{header-CiwHNHKD.cjs → header-YbbGgmsD.cjs} +2 -2
  51. package/dist/{header-menu-Dq9lwNr1.cjs → header-menu-BJMMwrCR.cjs} +1 -1
  52. package/dist/{header-menu-BrjsNjBH.js → header-menu-k2ACrfOv.js} +9 -11
  53. package/dist/{heading-DAkjw2Am.cjs → heading-BNlor2MU.cjs} +1 -1
  54. package/dist/{heading-CMZmPEL9.js → heading-SYKHysr8.js} +19 -21
  55. package/dist/{helptext-Bse1LpRd.cjs → helptext-CQaNvbiv.cjs} +9 -9
  56. package/dist/{helptext-BFQzrOw4.js → helptext-kKmVQkwo.js} +20 -22
  57. package/dist/{icon-C1oCGwEe.js → icon-CZDw42U7.js} +5 -8
  58. package/dist/if-defined-B3pYog2C.js +4 -0
  59. package/dist/{input-element-2LHxo0em.cjs → input-element-CfZIyfon.cjs} +1 -1
  60. package/dist/{input-element-De40zUox.js → input-element-DE0FzjgP.js} +19 -25
  61. package/dist/{input-wrapper-C_Rzwxx7.cjs → input-wrapper-CbYMk21W.cjs} +1 -1
  62. package/dist/{input-wrapper-DkpJS1hR.js → input-wrapper-DYg1VHPv.js} +13 -15
  63. package/dist/{link-DLPpwjq4.js → link-Bc4zf-Dj.js} +19 -22
  64. package/dist/link-lPrxhYq0.cjs +7 -0
  65. package/dist/{linkcard-DIG6VYpl.cjs → linkcard-Bih7HS2t.cjs} +1 -1
  66. package/dist/{linkcard-Dr-r8jBO.js → linkcard-LCFAdVsG.js} +7 -9
  67. package/dist/{listbox-HrH4JonS.cjs → listbox-Du8llYth.cjs} +10 -10
  68. package/dist/{listbox-DAvIBH4P.js → listbox-df8gHweY.js} +17 -19
  69. package/dist/{loader-CFidlqSG.js → loader-C-2b3bGK.js} +9 -12
  70. package/dist/{loader-DTIrOtTo.cjs → loader-DiQSwWpb.cjs} +1 -1
  71. package/dist/{messagebox-BLYx3AL7.cjs → messagebox-BiG-fJX9.cjs} +1 -1
  72. package/dist/{messagebox-B_07P0QA.js → messagebox-CH3bKoJO.js} +9 -11
  73. package/dist/modal-B3rnE83a.cjs +37 -0
  74. package/dist/{modal-CA_M2Ix6.js → modal-SBJ8aGvM.js} +33 -35
  75. package/dist/{option-group-element-DzM8YznZ.js → option-group-element-DtSw52Dr.js} +7 -8
  76. package/dist/{option-group-element-CVNaBIlP.cjs → option-group-element-dN0ntPZk.cjs} +1 -1
  77. package/dist/pkt-accordion.cjs +1 -1
  78. package/dist/pkt-accordion.js +1 -1
  79. package/dist/pkt-alert.cjs +1 -1
  80. package/dist/pkt-alert.js +1 -1
  81. package/dist/pkt-backlink.cjs +1 -1
  82. package/dist/pkt-backlink.js +1 -1
  83. package/dist/pkt-breadcrumbs.js +1 -1
  84. package/dist/pkt-button.cjs +1 -1
  85. package/dist/pkt-button.js +1 -1
  86. package/dist/pkt-calendar.cjs +1 -1
  87. package/dist/pkt-calendar.js +1 -1
  88. package/dist/pkt-card.cjs +1 -1
  89. package/dist/pkt-card.js +1 -1
  90. package/dist/pkt-checkbox-group.cjs +1 -1
  91. package/dist/pkt-checkbox-group.js +1 -1
  92. package/dist/pkt-checkbox.cjs +1 -1
  93. package/dist/pkt-checkbox.js +1 -1
  94. package/dist/pkt-combobox.cjs +1 -1
  95. package/dist/pkt-combobox.js +1 -1
  96. package/dist/pkt-consent.cjs +1 -1
  97. package/dist/pkt-consent.js +1 -1
  98. package/dist/pkt-datepicker.cjs +1 -1
  99. package/dist/pkt-datepicker.js +2 -3
  100. package/dist/pkt-fileupload.cjs +1 -1
  101. package/dist/pkt-fileupload.js +1 -1
  102. package/dist/pkt-footer.cjs +1 -1
  103. package/dist/pkt-footer.js +1 -1
  104. package/dist/pkt-header-menu.cjs +1 -1
  105. package/dist/pkt-header-menu.js +1 -1
  106. package/dist/pkt-header.cjs +1 -1
  107. package/dist/pkt-header.js +1 -1
  108. package/dist/pkt-heading.cjs +1 -1
  109. package/dist/pkt-heading.js +1 -1
  110. package/dist/pkt-helptext.cjs +1 -1
  111. package/dist/pkt-helptext.js +1 -1
  112. package/dist/pkt-icon.js +1 -1
  113. package/dist/pkt-index.cjs +1 -1
  114. package/dist/pkt-index.js +37 -37
  115. package/dist/pkt-input-wrapper.cjs +1 -1
  116. package/dist/pkt-input-wrapper.js +1 -1
  117. package/dist/pkt-link.cjs +1 -1
  118. package/dist/pkt-link.js +1 -1
  119. package/dist/pkt-linkcard.cjs +1 -1
  120. package/dist/pkt-linkcard.js +1 -1
  121. package/dist/pkt-listbox.cjs +1 -1
  122. package/dist/pkt-listbox.js +1 -1
  123. package/dist/pkt-loader.cjs +1 -1
  124. package/dist/pkt-loader.js +1 -1
  125. package/dist/pkt-messagebox.cjs +1 -1
  126. package/dist/pkt-messagebox.js +1 -1
  127. package/dist/pkt-modal.cjs +1 -1
  128. package/dist/pkt-modal.js +1 -1
  129. package/dist/{pkt-options-controller-CzvBlEPD.js → pkt-options-controller-Dz7DP0wC.js} +2 -3
  130. package/dist/{pkt-options-controller-9zoH1OBW.cjs → pkt-options-controller-WsHVdPJA.cjs} +1 -1
  131. package/dist/pkt-progressbar.cjs +1 -1
  132. package/dist/pkt-progressbar.js +1 -1
  133. package/dist/pkt-radio-group.cjs +1 -1
  134. package/dist/pkt-radio-group.js +1 -1
  135. package/dist/pkt-radiobutton.cjs +1 -1
  136. package/dist/pkt-radiobutton.js +1 -1
  137. package/dist/pkt-searchinput.cjs +1 -1
  138. package/dist/pkt-searchinput.js +1 -1
  139. package/dist/pkt-select.cjs +1 -1
  140. package/dist/pkt-select.js +1 -1
  141. package/dist/pkt-tabs.cjs +1 -1
  142. package/dist/pkt-tabs.js +1 -1
  143. package/dist/pkt-tag.cjs +1 -1
  144. package/dist/pkt-tag.js +1 -1
  145. package/dist/pkt-textarea.cjs +1 -1
  146. package/dist/pkt-textarea.js +1 -1
  147. package/dist/pkt-textinput.cjs +1 -1
  148. package/dist/pkt-textinput.js +1 -1
  149. package/dist/pkt-timepicker.cjs +1 -1
  150. package/dist/pkt-timepicker.js +1 -1
  151. package/dist/{progressbar-CfCc2zhp.js → progressbar-DlbkKRgP.js} +9 -11
  152. package/dist/{progressbar-BdqIhC1Z.cjs → progressbar-Wyq_Q1Ur.cjs} +1 -1
  153. package/dist/{provide-_MnlMGnw.js → provide-DFu2tSv_.js} +3 -5
  154. package/dist/{radio-group-BRY_74od.js → radio-group-bRF8fnPW.js} +8 -10
  155. package/dist/{radio-group-CsUgnEv0.cjs → radio-group-u1IH7g-4.cjs} +1 -1
  156. package/dist/{radiobutton-CQhuG2lj.cjs → radiobutton-86ZvvDmJ.cjs} +1 -1
  157. package/dist/{radiobutton-lHnq8wX_.js → radiobutton-Bf6aFfYt.js} +8 -10
  158. package/dist/{ref-B6p6mQkO.cjs → ref-C6VUWwmF.cjs} +1 -1
  159. package/dist/{ref-BAegS9BR.js → ref-qE1RBrI7.js} +3 -4
  160. package/dist/{repeat-Cy1M16Di.js → repeat-c2P6osbb.js} +3 -4
  161. package/dist/{scroll-lock-CR-g54ai.js → scroll-lock-C9jzbJ4E.js} +1 -2
  162. package/dist/{searchinput-TAqMUJ0B.cjs → searchinput-D5l64Mkb.cjs} +7 -7
  163. package/dist/{searchinput-BLGaXkP6.js → searchinput-DN8kDZQ1.js} +18 -20
  164. package/dist/{select-Dle67Uwv.cjs → select-C7kAlSxs.cjs} +15 -15
  165. package/dist/{select-BvtUxW0Q.js → select-CXIEM2qY.js} +15 -18
  166. package/dist/shared-types/button.d.ts +13 -0
  167. package/dist/shared-types/index.d.ts +1 -1
  168. package/dist/shared-types-BvRk9kiK.js +0 -0
  169. package/dist/{tabs-BmmTUKuC.js → tabs-Cg16Sl3u.js} +57 -60
  170. package/dist/tabs-n7hQWwyI.cjs +40 -0
  171. package/dist/{tag-BZdC0voc.cjs → tag-BAikRN2Y.cjs} +1 -1
  172. package/dist/{tag-Cam7ISOF.js → tag-HXcXopyA.js} +9 -11
  173. package/dist/{textarea-Djp5L2Zd.js → textarea-12le8b4I.js} +12 -14
  174. package/dist/{textarea-DSX3jMlI.cjs → textarea-CRcSfWgX.cjs} +1 -1
  175. package/dist/{textinput-CBrOZcvL.js → textinput-CC0zxUBT.js} +11 -13
  176. package/dist/{textinput-CN2F3Q3H.cjs → textinput-Dooq2n8W.cjs} +1 -1
  177. package/dist/{timepicker-CkaJkIGn.cjs → timepicker-BM4I5w-i.cjs} +20 -20
  178. package/dist/{timepicker-CT4wfrgQ.js → timepicker-Cz81VQu3.js} +27 -28
  179. package/dist/{utils-BwF4QSrq.js → utils-Dn5ykFtS.js} +1 -2
  180. package/package.json +10 -10
  181. package/src/components/button/button.ts +14 -14
  182. package/dist/button-bVWAX98x.cjs +0 -32
  183. package/dist/calendar-CDTCgTJn.cjs +0 -85
  184. package/dist/combobox-CWL8T3UK.cjs +0 -139
  185. package/dist/define-component-spec-BYOSeplU.js +0 -6
  186. package/dist/dialog-polyfill.esm-CW51hN2p.cjs +0 -1
  187. package/dist/focus-trap-DG3pEuyJ.js +0 -60
  188. package/dist/focus-trap-DSv4Ifqm.cjs +0 -1
  189. package/dist/if-defined-DiYi2v_Q.js +0 -5
  190. package/dist/link-pkFJ11Zd.cjs +0 -7
  191. package/dist/modal-BvTfLfFq.cjs +0 -37
  192. package/dist/shared-types-A6iGIX-f.js +0 -1
  193. package/dist/tabs-B96Orh6O.cjs +0 -40
@@ -1,17 +1,17 @@
1
- import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-DLgZkx5L.js";
2
- import { t as o } from "./class-map-BDwVSgLb.js";
3
- import { t as s } from "./format-BTeSVkED.js";
4
- import { n as c } from "./element-with-slot-mG-h7Sjw.js";
5
- import "./icon-C1oCGwEe.js";
6
- import { r as l } from "./input-wrapper-DkpJS1hR.js";
7
- import "./tag-Cam7ISOF.js";
8
- import { t as u } from "./if-defined-DiYi2v_Q.js";
9
- import { n as d, t as f } from "./ref-BAegS9BR.js";
10
- import { t as p } from "./repeat-Cy1M16Di.js";
11
- import { a as m, c as h, i as g, l as _, o as v, r as y, s as b } from "./listbox-DAvIBH4P.js";
12
- import { t as x } from "./input-element-De40zUox.js";
13
- import { t as S } from "./pkt-options-controller-CzvBlEPD.js";
14
- //#region ../../shared-types/combobox.ts
1
+ import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-Bwc-likm.js";
2
+ import { t as o } from "./if-defined-B3pYog2C.js";
3
+ import { n as s, t as c } from "./ref-qE1RBrI7.js";
4
+ import { t as l } from "./class-map-C9n5CNC8.js";
5
+ import { t as u } from "./repeat-c2P6osbb.js";
6
+ import { a as d, c as f, i as p, l as m, o as h, r as g, s as _ } from "./listbox-df8gHweY.js";
7
+ import { n as v } from "./element-with-slot-47quDZRt.js";
8
+ import { t as y } from "./input-element-DE0FzjgP.js";
9
+ import { t as b } from "./pkt-options-controller-Dz7DP0wC.js";
10
+ import { t as x } from "./format-DwjTfa9h.js";
11
+ import { r as S } from "./input-wrapper-DYg1VHPv.js";
12
+ import "./icon-CZDw42U7.js";
13
+ import "./tag-HXcXopyA.js";
14
+ // ../../shared-types/combobox.ts
15
15
  var C = {
16
16
  multiple: !1,
17
17
  typeahead: !1,
@@ -41,7 +41,7 @@ var C = {
41
41
  action: "none",
42
42
  value: null
43
43
  };
44
- let a = g(n, e);
44
+ let a = p(n, e);
45
45
  return !t.includes(e) && !a ? r ? {
46
46
  action: "addUserValue",
47
47
  value: e
@@ -59,7 +59,7 @@ var C = {
59
59
  value: null
60
60
  };
61
61
  }, E = (e, t, n, r, i) => e.trim().toLowerCase() ? {
62
- ...h(e, t, n, r),
62
+ ...f(e, t, n, r),
63
63
  shouldRemoveValue: !1,
64
64
  shouldResetInput: !1
65
65
  } : {
@@ -68,7 +68,7 @@ var C = {
68
68
  shouldRemoveValue: !i && !!t[0],
69
69
  shouldResetInput: !0
70
70
  }, D = (e, t, n) => {
71
- let r = g(t, e);
71
+ let r = p(t, e);
72
72
  return n === "label" && r?.label ? r.label : e;
73
73
  }, O = {
74
74
  markOptionSelected(e, t) {
@@ -104,7 +104,7 @@ var C = {
104
104
  value: e.getAttribute("value") || e.textContent || "",
105
105
  label: e.textContent || e.getAttribute("value") || ""
106
106
  };
107
- e.getAttribute("data-prefix") && (n.prefix = e.getAttribute("data-prefix") || void 0), e.getAttribute("tagskincolor") && (n.tagSkinColor = e.getAttribute("tagskincolor")), e.getAttribute("description") && (n.description = e.getAttribute("description") || void 0), n.fulltext = y(n), t.push(n);
107
+ e.getAttribute("data-prefix") && (n.prefix = e.getAttribute("data-prefix") || void 0), e.getAttribute("tagskincolor") && (n.tagSkinColor = e.getAttribute("tagskincolor")), e.getAttribute("description") && (n.description = e.getAttribute("description") || void 0), n.fulltext = g(n), t.push(n);
108
108
  }), t;
109
109
  } }, A = {
110
110
  cloneOptions(e) {
@@ -113,7 +113,7 @@ var C = {
113
113
  syncOptionsWithValues(e, t) {
114
114
  let n = [...t];
115
115
  return e.forEach((e) => {
116
- e.value && !e.label && (e.label = e.value), e.selected && !n.includes(e.value) && n.push(e.value), e.fulltext = y(e), e.selected = e.selected || n.includes(e.value);
116
+ e.value && !e.label && (e.label = e.value), e.selected && !n.includes(e.value) && n.push(e.value), e.fulltext = g(e), e.selected = e.selected || n.includes(e.value);
117
117
  }), {
118
118
  options: e,
119
119
  newValues: n
@@ -122,9 +122,9 @@ var C = {
122
122
  mergeWithUserAdded(e, t, n) {
123
123
  return [...t.filter((e) => e?.userAdded && n.includes(e.value)).filter((t) => !(Array.isArray(e) ? e : []).some((e) => e.value === t.value)), ...e];
124
124
  }
125
- }, j = class extends x {
125
+ }, j = class extends y {
126
126
  constructor() {
127
- super(), this.value = "", this.options = [], this.defaultOptions = [], this.allowUserInput = C.allowUserInput, this.typeahead = C.typeahead, this.includeSearch = C.includeSearch, this.searchPlaceholder = null, this.multiple = C.multiple, this.maxlength = null, this.displayValueAs = C.displayValueAs, this.tagPlacement = null, this.isOpen = !1, this._options = [], this._value = [], this._isOptionsOpen = !1, this._userInfoMessage = "", this._messageValue = null, this._addValueText = null, this._maxIsReached = !1, this._search = "", this._inputFocus = !1, this._skipInputTab = !1, this._optionsFromSlot = !1, this._lastSlotGeneration = 0, this._suppressNextOpen = !1, this.inputRef = f(), this.triggerRef = f(), this.listboxRef = f(), this._pendingDispatchFrom = null, this.optionsController = new S(this);
127
+ super(), this.value = "", this.options = [], this.defaultOptions = [], this.allowUserInput = C.allowUserInput, this.typeahead = C.typeahead, this.includeSearch = C.includeSearch, this.searchPlaceholder = null, this.multiple = C.multiple, this.maxlength = null, this.displayValueAs = C.displayValueAs, this.tagPlacement = null, this.isOpen = !1, this._options = [], this._value = [], this._isOptionsOpen = !1, this._userInfoMessage = "", this._messageValue = null, this._addValueText = null, this._maxIsReached = !1, this._search = "", this._inputFocus = !1, this._skipInputTab = !1, this._optionsFromSlot = !1, this._lastSlotGeneration = 0, this._suppressNextOpen = !1, this.inputRef = c(), this.triggerRef = c(), this.listboxRef = c(), this._pendingDispatchFrom = null, this.optionsController = new b(this);
128
128
  }
129
129
  get _hasTextInput() {
130
130
  return this.typeahead || this.allowUserInput;
@@ -150,7 +150,7 @@ var C = {
150
150
  return Array.isArray(e) ? this.multiple ? e : e.length > 0 ? [e[0]] : [] : e && this.multiple ? e.split(",") : e ? [e] : [];
151
151
  }
152
152
  updateMaxReached() {
153
- this._maxIsReached = _(this._value.length, this.maxlength);
153
+ this._maxIsReached = m(this._value.length, this.maxlength);
154
154
  }
155
155
  syncPublicValue() {
156
156
  let e = this.multiple ? this._value.join(",") : this._value[0] || "";
@@ -193,24 +193,23 @@ i([a({
193
193
  type: Boolean,
194
194
  attribute: "open"
195
195
  })], j.prototype, "isOpen", void 0), i([r()], j.prototype, "_options", void 0), i([r()], j.prototype, "_value", void 0), i([r()], j.prototype, "_isOptionsOpen", void 0), i([r()], j.prototype, "_userInfoMessage", void 0), i([r()], j.prototype, "_messageValue", void 0), i([r()], j.prototype, "_addValueText", void 0), i([r()], j.prototype, "_maxIsReached", void 0), i([r()], j.prototype, "_search", void 0), i([r()], j.prototype, "_inputFocus", void 0), i([r()], j.prototype, "_skipInputTab", void 0);
196
- //#endregion
197
- //#region src/components/combobox/combobox-value.ts
196
+ // src/components/combobox/combobox-value.ts
198
197
  var M = class extends j {
199
198
  toggleValue(e) {
200
199
  if (this.isDisabled) return;
201
200
  this.touched = !0, this._userInfoMessage = "", this._addValueText = null;
202
- let t = g(this.options, e)?.value || null, n = this._value.includes(e || t || ""), r = !!t, i = this._options.find((t) => t.value === e)?.disabled || !1, a = !e?.trim(), o = !this.multiple, s = this.multiple, c = _(this._value.length, this.maxlength), l = !1, u = !0, d = "", f = null, p = "";
203
- i || (!r && this.allowUserInput && !a ? (this.addNewUserValue(e), d = "valueAdded", l = s) : !r && !this.allowUserInput ? (o && this._value[0] && this.removeValue(this._value[0]), u = !1, l = !0, d = "noResults") : n ? (this.removeValue(t), l = !0, o && this._hasTextInput && this.inputRef.value && this.inputRef.value.type !== "hidden" && (this.inputRef.value.value = "")) : a && o ? (this.removeAllSelected(), l = !0) : o ? (this._value[0] && this.removeSelected(this._value[0]), this.setSelected(t), l = !1, d = "valueSelected", f = this._hasTextInput ? D(t || "", this.options, this.displayValueAs) : b(g(this.options, t), this.displayValueAs)) : s && !c ? (this.setSelected(t), l = !0) : s && c ? (d = "maxSelected", u = !1, p = e) : (o && this.removeAllSelected(), d = "noValidValue", u = !1, l = !0, p = e), this._isOptionsOpen = l, l || window.setTimeout(() => {
201
+ let t = p(this.options, e)?.value || null, n = this._value.includes(e || t || ""), r = !!t, i = this._options.find((t) => t.value === e)?.disabled || !1, a = !e?.trim(), o = !this.multiple, s = this.multiple, c = m(this._value.length, this.maxlength), l = !1, u = !0, d = "", f = null, h = "";
202
+ i || (!r && this.allowUserInput && !a ? (this.addNewUserValue(e), d = "valueAdded", l = s) : !r && !this.allowUserInput ? (o && this._value[0] && this.removeValue(this._value[0]), u = !1, l = !0, d = "noResults") : n ? (this.removeValue(t), l = !0, o && this._hasTextInput && this.inputRef.value && this.inputRef.value.type !== "hidden" && (this.inputRef.value.value = "")) : a && o ? (this.removeAllSelected(), l = !0) : o ? (this._value[0] && this.removeSelected(this._value[0]), this.setSelected(t), l = !1, d = "valueSelected", f = this._hasTextInput ? D(t || "", this.options, this.displayValueAs) : _(p(this.options, t), this.displayValueAs)) : s && !c ? (this.setSelected(t), l = !0) : s && c ? (d = "maxSelected", u = !1, h = e) : (o && this.removeAllSelected(), d = "noValidValue", u = !1, l = !0, h = e), this._isOptionsOpen = l, l || window.setTimeout(() => {
204
203
  this.focusAfterCommit();
205
- }, 0), this._search = p || "", this.resetComboboxInput(u), this._userInfoMessage = d, this._messageValue = f, s && this.updateMaxReached());
204
+ }, 0), this._search = h || "", this.resetComboboxInput(u), this._userInfoMessage = d, this._messageValue = f, s && this.updateMaxReached());
206
205
  }
207
206
  setSelected(e) {
208
- this._value.includes(e) || (this.multiple && _(this._value.length, this.maxlength) ? this._userInfoMessage = "maxSelected" : (!this.multiple && this.removeAllSelected(), this._value = e ? [...this._value, e] : this._value, O.markOptionSelected(this._options, e), this.resetComboboxInput(!0)));
207
+ this._value.includes(e) || (this.multiple && m(this._value.length, this.maxlength) ? this._userInfoMessage = "maxSelected" : (!this.multiple && this.removeAllSelected(), this._value = e ? [...this._value, e] : this._value, O.markOptionSelected(this._options, e), this.resetComboboxInput(!0)));
209
208
  }
210
209
  removeSelected(e) {
211
210
  if (!e) return;
212
211
  this._value = this._value.filter((t) => t !== e);
213
- let t = g(this.options, e);
212
+ let t = p(this.options, e);
214
213
  t && (O.markOptionDeselected(this.options, e), t.userAdded ? (this._options = [...this._options.filter((t) => t.value !== e)], this.options = [...this.options.filter((t) => t.value !== e)]) : this._options.some((t) => t.value === e) ? this.refreshOptionsFromValue() : this._options = [...this._options, t]);
215
214
  }
216
215
  addAllOptions() {
@@ -229,8 +228,8 @@ var M = class extends j {
229
228
  addNewUserValue(e) {
230
229
  if (!e || e.trim() === "") return;
231
230
  if (!this.multiple) this._value[0] && this.removeSelected(this._value[0]), this._value = [e];
232
- else if (!g(this.options, e)) {
233
- if (_(this._value.length, this.maxlength)) return;
231
+ else if (!p(this.options, e)) {
232
+ if (m(this._value.length, this.maxlength)) return;
234
233
  this._value = [...this._value, e];
235
234
  }
236
235
  let t = {
@@ -263,7 +262,7 @@ var M = class extends j {
263
262
  let t = e.target;
264
263
  if (this._search = t.value, this.checkForMatches(), this.typeahead) {
265
264
  if (this._search) {
266
- let { filtered: n, suggestion: r } = v(this.options, this._search);
265
+ let { filtered: n, suggestion: r } = h(this.options, this._search);
267
266
  this._options = n, e.inputType !== "deleteContentBackward" && r?.label && this.inputRef.value && this.inputRef.value.type !== "hidden" && (t.value = r.label, window.setTimeout(() => t.setSelectionRange(this._search.length, t.value.length), 0), t.selectionDirection = "backward");
268
267
  } else this.refreshOptionsFromValue();
269
268
  }
@@ -285,7 +284,7 @@ var M = class extends j {
285
284
  if (!this.multiple) {
286
285
  if (!e) this._value[0] && this.removeSelected(this._value[0]);
287
286
  else {
288
- let t = g(this.options, e);
287
+ let t = p(this.options, e);
289
288
  t && t.value !== this._value[0] ? (this._value[0] && this.removeSelected(this._value[0]), this.setSelected(t.value)) : !t && this.allowUserInput && (this._value[0] && this.removeSelected(this._value[0]), this.addNewUserValue(e));
290
289
  }
291
290
  } else if (e !== "") {
@@ -503,13 +502,13 @@ var M = class extends j {
503
502
  render() {
504
503
  return e`
505
504
  <pkt-input-wrapper
506
- ${c(this, ["helptext"])}
505
+ ${v(this, ["helptext"])}
507
506
  .strings=${this.strings}
508
507
  .size=${this.inputSize}
509
508
  .label=${this.label}
510
509
  .helptext=${this.helptext}
511
- .helptextDropdown=${u(this.helptextDropdown)}
512
- .helptextDropdownButton=${u(this.helptextDropdownButton)}
510
+ .helptextDropdown=${o(this.helptextDropdown)}
511
+ .helptextDropdownButton=${o(this.helptextDropdownButton)}
513
512
  ?fullwidth=${this.fullwidth}
514
513
  ?counter=${this.effectiveCounter(!!this.multiple && this.maxlength != null)}
515
514
  .counterCurrent=${this._value.length}
@@ -531,7 +530,7 @@ var M = class extends j {
531
530
  >
532
531
  <div class="pkt-combobox" @focusout=${this.handleFocusOut}>
533
532
  <div
534
- class=${o({
533
+ class=${l({
535
534
  "pkt-combobox__input": !0,
536
535
  [`pkt-combobox__input--${this.inputSize}`]: !0,
537
536
  "pkt-combobox__input--fullwidth": this.fullwidth,
@@ -539,27 +538,27 @@ var M = class extends j {
539
538
  "pkt-combobox__input--error": this.hasError,
540
539
  "pkt-combobox__input--disabled": this.isDisabled
541
540
  })}
542
- id=${u(this._hasTextInput ? void 0 : `${this.id}-combobox`)}
543
- role=${u(this._hasTextInput ? void 0 : "combobox")}
544
- aria-expanded=${u(this._hasTextInput ? void 0 : this._isOptionsOpen ? "true" : "false")}
545
- aria-controls=${u(this._hasTextInput ? void 0 : `${this.id}-listbox`)}
546
- aria-haspopup=${u(this._hasTextInput ? void 0 : "listbox")}
547
- aria-describedby=${u(this._hasTextInput ? void 0 : this._describedBy())}
548
- aria-labelledby=${u(this._hasTextInput ? void 0 : `${this.id}-combobox-label`)}
549
- aria-activedescendant=${u(!this._hasTextInput && this._isOptionsOpen && this._value[0] && g(this.options, this._value[0]) ? `${this.id}-listbox-${m(this._options, this._value[0])}` : void 0)}
550
- aria-description=${u(this._selectionDescription || void 0)}
541
+ id=${o(this._hasTextInput ? void 0 : `${this.id}-combobox`)}
542
+ role=${o(this._hasTextInput ? void 0 : "combobox")}
543
+ aria-expanded=${o(this._hasTextInput ? void 0 : this._isOptionsOpen ? "true" : "false")}
544
+ aria-controls=${o(this._hasTextInput ? void 0 : `${this.id}-listbox`)}
545
+ aria-haspopup=${o(this._hasTextInput ? void 0 : "listbox")}
546
+ aria-describedby=${o(this._hasTextInput ? void 0 : this._describedBy())}
547
+ aria-labelledby=${o(this._hasTextInput ? void 0 : `${this.id}-combobox-label`)}
548
+ aria-activedescendant=${o(!this._hasTextInput && this._isOptionsOpen && this._value[0] && p(this.options, this._value[0]) ? `${this.id}-listbox-${d(this._options, this._value[0])}` : void 0)}
549
+ aria-description=${o(this._selectionDescription || void 0)}
551
550
  tabindex=${this._hasTextInput || this.isDisabled ? "-1" : "0"}
552
551
  @click=${this.handleInputClick}
553
552
  @keydown=${this._hasTextInput ? n : this.handleSelectOnlyKeydown}
554
553
  @blur=${this.restoreInputTab}
555
- ${d(this.triggerRef)}
554
+ ${s(this.triggerRef)}
556
555
  >
557
556
  ${!this._hasTextInput && this.placeholder && (!this._value.length || this.multiple && this.tagPlacement == "outside") && !this._inputFocus ? e`<span class="pkt-combobox__placeholder" @click=${this.handlePlaceholderClick}
558
557
  >${this.placeholder}</span
559
558
  >` : this.tagPlacement === "outside" ? n : this.renderSingleOrMultipleValues()}
560
559
  ${this.renderInputField()}
561
560
  <pkt-icon
562
- class=${o({
561
+ class=${l({
563
562
  "pkt-combobox__arrow-icon": !0,
564
563
  "pkt-combobox__arrow-icon--open": this._isOptionsOpen
565
564
  })}
@@ -579,8 +578,8 @@ var M = class extends j {
579
578
  ?is-multi-select=${this.multiple}
580
579
  ?allow-user-input=${this.allowUserInput && !this._maxIsReached}
581
580
  ?max-is-reached=${this._maxIsReached}
582
- .customUserInput=${u(this._addValueText)}
583
- .userMessage=${this._userInfoMessage ? s(this.pktStrings.get("combobox")[this._userInfoMessage], { value: this._messageValue ?? "" }) : ""}
581
+ .customUserInput=${o(this._addValueText)}
582
+ .userMessage=${this._userInfoMessage ? x(this.pktStrings.get("combobox")[this._userInfoMessage], { value: this._messageValue ?? "" }) : ""}
584
583
  @search=${this.handleSearch}
585
584
  @option-toggle=${this.handleOptionToggled}
586
585
  @select-all=${this.addAllOptions}
@@ -588,7 +587,7 @@ var M = class extends j {
588
587
  @tab-close=${() => this.closeAndProcessInput()}
589
588
  .searchValue=${this._search || null}
590
589
  .maxLength=${this.maxlength || 0}
591
- ${d(this.listboxRef)}
590
+ ${s(this.listboxRef)}
592
591
  ></pkt-listbox>
593
592
  </div>
594
593
 
@@ -599,7 +598,7 @@ var M = class extends j {
599
598
  `;
600
599
  }
601
600
  _describedBy() {
602
- return l({
601
+ return S({
603
602
  id: this._hasTextInput ? `${this.id}-input` : `${this.id}-combobox`,
604
603
  hasHelptext: !!this.helptext || this.hasSlotContent("helptext"),
605
604
  ariaDescribedby: this.ariaDescribedby
@@ -612,25 +611,25 @@ var M = class extends j {
612
611
  type="text"
613
612
  id="${this.id}-input"
614
613
  name=${(this.name || this.id) + "-input"}
615
- placeholder=${u(!this._value.length || this.multiple && this.tagPlacement === "outside" ? this.placeholder : void 0)}
614
+ placeholder=${o(!this._value.length || this.multiple && this.tagPlacement === "outside" ? this.placeholder : void 0)}
616
615
  @input=${this.handleInput}
617
616
  @change=${(e) => {
618
617
  e.stopPropagation(), e.stopImmediatePropagation();
619
618
  }}
620
- tabindex=${u(this._skipInputTab ? "-1" : void 0)}
619
+ tabindex=${o(this._skipInputTab ? "-1" : void 0)}
621
620
  @keydown=${this.handleInputKeydown}
622
621
  @focus=${this.handleFocus}
623
622
  @blur=${this.handleBlur}
624
623
  autocomplete="off"
625
624
  role="combobox"
626
625
  aria-expanded=${this._isOptionsOpen ? "true" : "false"}
627
- aria-label=${u(this.label)}
628
- aria-describedby=${u(this._describedBy())}
626
+ aria-label=${o(this.label)}
627
+ aria-describedby=${o(this._describedBy())}
629
628
  aria-autocomplete=${this.typeahead ? "both" : this.allowUserInput ? "list" : "none"}
630
629
  aria-controls="${this.id}-listbox"
631
- aria-activedescendant=${u(this._isOptionsOpen && this._value[0] && g(this.options, this._value[0]) ? `${this.id}-listbox-${m(this._options, this._value[0])}` : void 0)}
632
- aria-description=${u(this._selectionDescription || void 0)}
633
- ${d(this.inputRef)}
630
+ aria-activedescendant=${o(this._isOptionsOpen && this._value[0] && p(this.options, this._value[0]) ? `${this.id}-listbox-${d(this._options, this._value[0])}` : void 0)}
631
+ aria-description=${o(this._selectionDescription || void 0)}
632
+ ${s(this.inputRef)}
634
633
  />
635
634
  </div>
636
635
  ` : e`
@@ -639,16 +638,16 @@ var M = class extends j {
639
638
  id="${this.id}-input"
640
639
  name=${(this.name || this.id) + "-input"}
641
640
  .value=${this._value.join(",")}
642
- ${d(this.inputRef)}
641
+ ${s(this.inputRef)}
643
642
  />
644
643
  `;
645
644
  }
646
645
  renderSingleOrMultipleValues() {
647
646
  if (!this.multiple && this._hasTextInput) return n;
648
- let t = !this.multiple, r = this.renderValueTag(g(this.options, this._value[0])), i = this.tagPlacement === "outside", a = e`
647
+ let t = !this.multiple, r = this.renderValueTag(p(this.options, this._value[0])), i = this.tagPlacement === "outside", a = e`
649
648
  <ul role="list" class="pkt-combobox__tag-list">
650
- ${p(this._value, (e) => e, (t, r) => {
651
- let a = g(this.options, t), o = a?.tagSkinColor;
649
+ ${u(this._value, (e) => e, (t, r) => {
650
+ let a = p(this.options, t), o = a?.tagSkinColor;
652
651
  return e`
653
652
  <li
654
653
  role="listitem"
@@ -685,8 +684,6 @@ try {
685
684
  } catch {
686
685
  console.warn("Forsøker å definere <pkt-combobox>, men den er allerede definert");
687
686
  }
688
- //#endregion
689
- //#region src/components/combobox/index.ts
687
+ // src/components/combobox/index.ts
690
688
  var F = P;
691
- //#endregion
692
689
  export { P as n, F as t };
@@ -0,0 +1,139 @@
1
+ const e=require("./element-CEarCnHH.cjs"),t=require("./if-defined-Ci4ZQsgL.cjs"),n=require("./ref-C6VUWwmF.cjs"),r=require("./class-map-C82GtM1w.cjs"),i=require("./repeat-CjvNrcUr.cjs"),a=require("./listbox-Du8llYth.cjs"),o=require("./element-with-slot-D_8fAzCW.cjs"),s=require("./input-element-CfZIyfon.cjs"),c=require("./pkt-options-controller-WsHVdPJA.cjs"),l=require("./format-B8meU8Tm.cjs"),u=require("./input-wrapper-CbYMk21W.cjs");require("./icon-5A378_yh.cjs"),require("./tag-BAikRN2Y.cjs");var d={multiple:!1,typeahead:!1,includeSearch:!1,allowUserInput:!1,displayValueAs:`label`,inputSize:`medium`,disabled:!1,hasError:!1,required:!1,requiredTag:!1,optionalTag:!1,fullwidth:!1,inline:!1,useWrapper:!0},f=(e,t,n)=>{switch(e){case`,`:return n?`addValue`:null;case`Enter`:return`addValue`;case`Tab`:case`ArrowDown`:return t?null:`focusListbox`;case`Escape`:return`closeOptions`;default:return null}},p=(e,t,n,r,i)=>{if(!e)return{action:`none`,value:null};let o=a.i(n,e);return!t.includes(e)&&!o?r?{action:`addUserValue`,value:e}:i?{action:`none`,value:null}:{action:`removeValue`,value:t[0]}:o&&!t.includes(o.value)?{action:`selectOption`,value:o.value}:{action:`none`,value:null}},m=(e,t,n,r,i)=>e.trim().toLowerCase()?{...a.c(e,t,n,r),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:``,shouldRemoveValue:!i&&!!t[0],shouldResetInput:!0},h=(e,t,n)=>{let r=a.i(t,e);return n===`label`&&r?.label?r.label:e},g={markOptionSelected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!0;break}}},markOptionDeselected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!1;break}}},markAllSelected(e){for(let t of e)t.selected=!0},markAllDeselected(e){for(let t of e)t.selected=!1},removeUserAddedOptions(e){return e.filter(e=>!e.userAdded)}},_={parseOptionsFromSlot(e){let t=[];return e.forEach(e=>{if(!e.textContent&&!e.getAttribute(`value`))return;let n={value:e.getAttribute(`value`)||e.textContent||``,label:e.textContent||e.getAttribute(`value`)||``};e.getAttribute(`data-prefix`)&&(n.prefix=e.getAttribute(`data-prefix`)||void 0),e.getAttribute(`tagskincolor`)&&(n.tagSkinColor=e.getAttribute(`tagskincolor`)),e.getAttribute(`description`)&&(n.description=e.getAttribute(`description`)||void 0),n.fulltext=a.r(n),t.push(n)}),t}},v={cloneOptions(e){return Array.isArray(e)?e.map(e=>({...e})):[]},syncOptionsWithValues(e,t){let n=[...t];return e.forEach(e=>{e.value&&!e.label&&(e.label=e.value),e.selected&&!n.includes(e.value)&&n.push(e.value),e.fulltext=a.r(e),e.selected=e.selected||n.includes(e.value)}),{options:e,newValues:n}},mergeWithUserAdded(e,t,n){return[...t.filter(e=>e?.userAdded&&n.includes(e.value)).filter(t=>!(Array.isArray(e)?e:[]).some(e=>e.value===t.value)),...e]}},y=class extends s.t{constructor(){super(),this.value=``,this.options=[],this.defaultOptions=[],this.allowUserInput=d.allowUserInput,this.typeahead=d.typeahead,this.includeSearch=d.includeSearch,this.searchPlaceholder=null,this.multiple=d.multiple,this.maxlength=null,this.displayValueAs=d.displayValueAs,this.tagPlacement=null,this.isOpen=!1,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage=``,this._messageValue=null,this._addValueText=null,this._maxIsReached=!1,this._search=``,this._inputFocus=!1,this._skipInputTab=!1,this._optionsFromSlot=!1,this._lastSlotGeneration=0,this._suppressNextOpen=!1,this.inputRef=n.t(),this.triggerRef=n.t(),this.listboxRef=n.t(),this._pendingDispatchFrom=null,this.optionsController=new c.t(this)}get _hasTextInput(){return this.typeahead||this.allowUserInput}get _selectionDescription(){if(this.multiple&&this._value.length!==0)return`${this._value.length} valgt`}focusTrigger(){this._hasTextInput?this.inputRef.value?.focus():this.triggerRef.value?.focus()}focusAfterCommit(){this._skipInputTab=!0;let e=this.inputRef.value;e&&e.type!==`hidden`&&e.setAttribute(`tabindex`,`-1`),this.triggerRef.value?.focus()}restoreInputTab(){this._skipInputTab=!1}parseValue(){return this.parseToValues(this.value)}parseToValues(e){return Array.isArray(e)?this.multiple?e:e.length>0?[e[0]]:[]:e&&this.multiple?e.split(`,`):e?[e]:[]}updateMaxReached(){this._maxIsReached=a.l(this._value.length,this.maxlength)}syncPublicValue(){let e=this.multiple?this._value.join(`,`):this._value[0]||``;e!==(Array.isArray(this.value)?this.value.join(`,`):String(this.value||``))&&(this.value=e)}dispatchValueChange(e){let t=this._value;if(e?.join(`,`)!==t.join(`,`)){let e=this.multiple?[...t]:t[0]||``;this.onChange(e)}else t.length===0&&e&&e.length>0&&this.clearInputValue()}onChange(e){this.touched=!0,super.onChange(e)}valueChanged(){}};e.n([e.u({type:String,reflect:!0})],y.prototype,`value`,void 0),e.n([e.u({type:Array})],y.prototype,`options`,void 0),e.n([e.u({type:Array,attribute:`default-options`})],y.prototype,`defaultOptions`,void 0),e.n([e.u({type:Boolean,attribute:`allow-user-input`})],y.prototype,`allowUserInput`,void 0),e.n([e.u({type:Boolean})],y.prototype,`typeahead`,void 0),e.n([e.u({type:Boolean,attribute:`include-search`})],y.prototype,`includeSearch`,void 0),e.n([e.u({type:String,attribute:`search-placeholder`})],y.prototype,`searchPlaceholder`,void 0),e.n([e.u({type:Boolean})],y.prototype,`multiple`,void 0),e.n([e.u({type:Number})],y.prototype,`maxlength`,void 0),e.n([e.u({type:String,attribute:`display-value-as`})],y.prototype,`displayValueAs`,void 0),e.n([e.u({type:String,attribute:`tag-placement`})],y.prototype,`tagPlacement`,void 0),e.n([e.u({type:Boolean,attribute:`open`})],y.prototype,`isOpen`,void 0),e.n([e.l()],y.prototype,`_options`,void 0),e.n([e.l()],y.prototype,`_value`,void 0),e.n([e.l()],y.prototype,`_isOptionsOpen`,void 0),e.n([e.l()],y.prototype,`_userInfoMessage`,void 0),e.n([e.l()],y.prototype,`_messageValue`,void 0),e.n([e.l()],y.prototype,`_addValueText`,void 0),e.n([e.l()],y.prototype,`_maxIsReached`,void 0),e.n([e.l()],y.prototype,`_search`,void 0),e.n([e.l()],y.prototype,`_inputFocus`,void 0),e.n([e.l()],y.prototype,`_skipInputTab`,void 0);var b=class extends y{toggleValue(e){if(this.isDisabled)return;this.touched=!0,this._userInfoMessage=``,this._addValueText=null;let t=a.i(this.options,e)?.value||null,n=this._value.includes(e||t||``),r=!!t,i=this._options.find(t=>t.value===e)?.disabled||!1,o=!e?.trim(),s=!this.multiple,c=this.multiple,l=a.l(this._value.length,this.maxlength),u=!1,d=!0,f=``,p=null,m=``;i||(!r&&this.allowUserInput&&!o?(this.addNewUserValue(e),f=`valueAdded`,u=c):!r&&!this.allowUserInput?(s&&this._value[0]&&this.removeValue(this._value[0]),d=!1,u=!0,f=`noResults`):n?(this.removeValue(t),u=!0,s&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``)):o&&s?(this.removeAllSelected(),u=!0):s?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t),u=!1,f=`valueSelected`,p=this._hasTextInput?h(t||``,this.options,this.displayValueAs):a.s(a.i(this.options,t),this.displayValueAs)):c&&!l?(this.setSelected(t),u=!0):c&&l?(f=`maxSelected`,d=!1,m=e):(s&&this.removeAllSelected(),f=`noValidValue`,d=!1,u=!0,m=e),this._isOptionsOpen=u,u||window.setTimeout(()=>{this.focusAfterCommit()},0),this._search=m||``,this.resetComboboxInput(d),this._userInfoMessage=f,this._messageValue=p,c&&this.updateMaxReached())}setSelected(e){this._value.includes(e)||(this.multiple&&a.l(this._value.length,this.maxlength)?this._userInfoMessage=`maxSelected`:(!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,g.markOptionSelected(this._options,e),this.resetComboboxInput(!0)))}removeSelected(e){if(!e)return;this._value=this._value.filter(t=>t!==e);let t=a.i(this.options,e);t&&(g.markOptionDeselected(this.options,e),t.userAdded?(this._options=[...this._options.filter(t=>t.value!==e)],this.options=[...this.options.filter(t=>t.value!==e)]):this._options.some(t=>t.value===e)?this.refreshOptionsFromValue():this._options=[...this._options,t])}addAllOptions(){this.multiple&&(this.maxlength&&this._options.length>this.maxlength?this._userInfoMessage=`tooManySelected`:(this._value=this._options.map(e=>e.value),g.markAllSelected(this._options),this.requestUpdate()))}removeAllSelected(){this._value=[],g.markAllDeselected(this._options),this._options=g.removeUserAddedOptions(this._options),this.requestUpdate()}addValue(){let e=this.inputRef.value?.value.trim()||``;this._search=e,e&&this._value.includes(e)?(this.resetComboboxInput(!0),this._userInfoMessage=`alreadySelected`):this.toggleValue(e)}removeValue(e){this._value=this.multiple?this._value.filter(t=>t!==e):[],this.removeSelected(e)}addNewUserValue(e){if(!e||e.trim()===``)return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[e];else if(!a.i(this.options,e)){if(a.l(this._value.length,this.maxlength))return;this._value=[...this._value,e]}let t={value:e,label:e,userAdded:!0,selected:!0};this.options=[t,...this.options],this._options=[t,...this._options],this.resetComboboxInput(!0),this.multiple||(this._isOptionsOpen=!1,window.setTimeout(()=>{this.focusAfterCommit()},0)),this.requestUpdate()}refreshOptionsFromValue(){let e=v.cloneOptions(this.options);e.forEach(e=>e.selected=this._value.includes(e.value)),this._options=v.syncOptionsWithValues(e,this._value).options}resetComboboxInput(e=!0){this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!==`hidden`&&e&&(this._search=``,this.multiple?this.inputRef.value.value=``:(this.inputRef.value.value=this._value[0]?h(this._value[0],this.options,this.displayValueAs):``,this._userInfoMessage=``)),this.refreshOptionsFromValue()}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();let t=this._value[this._value.length-1];t&&this.removeSelected(t),this.updateMaxReached()}},x=class extends b{handleInput(e){if(e.stopPropagation(),e.stopImmediatePropagation(),this.isDisabled)return;this.touched=!0;let t=e.target;if(this._search=t.value,this.checkForMatches(),this.typeahead){if(this._search){let{filtered:n,suggestion:r}=a.o(this.options,this._search);this._options=n,e.inputType!==`deleteContentBackward`&&r?.label&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(t.value=r.label,window.setTimeout(()=>t.setSelectionRange(this._search.length,t.value.length),0),t.selectionDirection=`backward`)}else this.refreshOptionsFromValue()}}handleFocus(){this.isDisabled||(this._skipInputTab=!1,this._suppressNextOpen?(this._suppressNextOpen=!1,this._inputFocus=!0,this.requestUpdate()):(!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=h(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search=``,this.refreshOptionsFromValue(),this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()))}handleCloseOptions(){this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),this.focusTrigger()}handleFocusOut(e){if(this.isDisabled||!this._isOptionsOpen)return;let t=e.relatedTarget;t?.closest(`pkt-combobox`)?.id===this.id||e.target?.classList?.contains(`pkt-combobox__value`)||t===this.inputRef.value||t===this.triggerRef.value||this.closeAndProcessInput()}closeAndProcessInput(){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage=``,this._search=``,this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=this.inputRef.value.value;if(!this.multiple){if(!e)this._value[0]&&this.removeSelected(this._value[0]);else{let t=a.i(this.options,e);t&&t.value!==this._value[0]?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t.value)):!t&&this.allowUserInput&&(this._value[0]&&this.removeSelected(this._value[0]),this.addNewUserValue(e))}}else if(e!==``){let{action:t,value:n}=p(e,this._value,this.options,this.allowUserInput,this.multiple);switch(t){case`addUserValue`:this.addNewUserValue(n);break;case`selectOption`:this.setSelected(n);break;case`removeValue`:this.removeValue(n)}}!this.multiple&&this._value[0]?this.inputRef.value.value=h(this._value[0],this.options,this.displayValueAs):this.inputRef.value.value=``}this._isOptionsOpen=!1,this.onBlur()}handleBlur(){this._inputFocus=!1,this.onBlur()}handleInputClick(e){this.isDisabled?(e.preventDefault(),e.stopImmediatePropagation()):this._hasTextInput?(this.inputRef.value?.focus(),this.requestUpdate()):(e.stopImmediatePropagation(),e.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen&&this.listboxRef.value?.focusFirstOrSelectedOption())}handlePlaceholderClick(e){this.isDisabled||(e.stopPropagation(),this._hasTextInput&&this.inputRef.value?(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()):(this._isOptionsOpen=!this._isOptionsOpen,this.requestUpdate()))}handleSelectOnlyKeydown(e){if(!this.isDisabled)switch(e.key){case`Enter`:case` `:case`ArrowDown`:case`ArrowUp`:e.preventDefault(),this._isOptionsOpen?this._isOptionsOpen=!1:(this._isOptionsOpen=!0,this.listboxRef.value?.focusFirstOrSelectedOption());break;case`Escape`:this._isOptionsOpen&&=(e.preventDefault(),!1);break;case`Home`:case`End`:e.preventDefault(),this._isOptionsOpen||=!0,this.listboxRef.value?.focusFirstOrSelectedOption();break;case`ArrowLeft`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.focusTag(this._value.length-1));break;case`Backspace`:case`Delete`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.removeSelected(this._value[this._value.length-1]))}}handleOptionToggled(e){this.toggleValue(e.detail)}handleSearch(e){e.stopPropagation(),this._search=e.detail.toLowerCase(),this.checkForMatches()}handleInputKeydown(e){if(e.key===`Backspace`){let t=!this.inputRef.value?.value;!this._search&&t&&this.multiple&&this._value.length>0&&this.removeLastValue(e);return}if(e.key===`ArrowLeft`&&this.multiple&&this._value.length>0){let t=this.inputRef.value;if(t&&t.selectionStart===0&&!t.value){e.preventDefault(),this.focusTag(this._value.length-1);return}}let t=f(e.key,e.shiftKey,this.multiple);if(t&&(e.key!==`Tab`||this._isOptionsOpen)){if(t===`focusListbox`&&e.key===`Tab`&&!this.listboxRef.value?.querySelector(`[role="option"]:not([data-disabled]), [data-type="new-option"]`))this.closeAndProcessInput();else switch(e.preventDefault(),t){case`addValue`:this.addValue();break;case`focusListbox`:this.listboxRef.value?.focusFirstOrSelectedOption();break;case`closeOptions`:this._isOptionsOpen=!1}}}handleTagRemove(e){this.removeSelected(e),this._hasTextInput&&this.inputRef.value&&(this._inputFocus=!0,this.inputRef.value.focus(),this.requestUpdate())}getInsideTags(){return Array.from(this.querySelectorAll(`.pkt-combobox__input .pkt-combobox__tag-list pkt-tag`))}focusTag(e){let t=this.getInsideTags();t.forEach((t,n)=>{t.buttonTabindex=n===e?0:-1}),(t[e]?.querySelector(`button`))?.focus()}resetTagTabindices(){this.getInsideTags().forEach(e=>{e.buttonTabindex=-1})}handleTagKeydown(e,t){e.stopPropagation();let n=()=>{this.resetTagTabindices(),this._hasTextInput&&this.inputRef.value?this.inputRef.value.focus():this.triggerRef.value?.focus()};switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&this.focusTag(t-1);break;case`ArrowRight`:e.preventDefault(),t<this._value.length-1?this.focusTag(t+1):n();break;case`Backspace`:case`Delete`:e.preventDefault();{let e=this._value[t],r=t>=this._value.length-1?t-1:t;this.removeSelected(e),r>=0?(this.requestUpdate(),this.updateComplete.then(()=>this.focusTag(r))):n()}break;case`Tab`:this.resetTagTabindices();break;case`Escape`:e.preventDefault(),n()}}checkForMatches(){let e=m(this.inputRef.value?.value||this._search||``,this._value,this.options,this.allowUserInput,this.multiple);e.shouldRemoveValue&&this.removeValue(this._value[0]),e.shouldResetInput?this.resetComboboxInput(!1):(this._addValueText=e.addValueText,this._userInfoMessage=e.userInfoMessage)}},S=class extends x{constructor(...e){super(...e),this.handleBodyClick=e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.closeAndProcessInput()}}connectedCallback(){if(super.connectedCallback(),document?.body.addEventListener(`click`,this.handleBodyClick),this._options=[],this.defaultOptions&&this.defaultOptions.length){let e=this.options?.filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=v.cloneOptions(this.options)}if(this.optionsController?.nodes&&this.optionsController.nodes.length){let e=_.parseOptionsFromSlot(this.optionsController.nodes);e.length&&(this.options=[...e],this._options=[...e],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}disconnectedCallback(){super.disconnectedCallback(),document?.body.removeEventListener(`click`,this.handleBodyClick)}firstUpdated(e){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(e)}willUpdate(e){if(this._optionsFromSlot&&this.optionsController){let e=this.optionsController.generation;if(e!==this._lastSlotGeneration){this._lastSlotGeneration=e;let t=_.parseOptionsFromSlot(this.optionsController.nodes),n=this._options.filter(e=>e.userAdded);this.options=[...n,...t]}}if(super.willUpdate(e),e.has(`isOpen`)&&(this._isOptionsOpen=this.isOpen),e.has(`defaultOptions`)&&this.defaultOptions.length){let e=(Array.isArray(this.options)?this.options:[]).filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=v.cloneOptions(this.options)}let t=e.has(`value`),n=e.has(`_value`);if(t){let e=[...this._value],t=this.parseValue();t.join(`,`)!==this._value.join(`,`)&&(this._value=t,this._options.forEach(e=>e.selected=t.includes(e.value)),this._options=[...this._options]),this._pendingDispatchFrom??=e}else n&&(this._pendingDispatchFrom??=e.get(`_value`)??[]);if(e.has(`defaultValue`)&&this.defaultValue!=null&&!this._value.length){let e=this.parseToValues(this.defaultValue);e.length&&(this._pendingDispatchFrom??=[...this._value],this._value=e,this._options.forEach(t=>t.selected=e.includes(t.value)),this._options=[...this._options])}if(e.has(`options`)){let t=e.get(`options`)||this._options||[],n=v.mergeWithUserAdded(v.cloneOptions(this.options),t,this._value);this._options=n,n.length>this.options.length&&(this.options=n);let r=v.syncOptionsWithValues(this._options,this._value);this._options=r.options,r.newValues.length>this._value.length&&(this._pendingDispatchFrom??=[...this._value],this._value=r.newValues)}(t||n||e.has(`options`)||e.has(`defaultValue`))&&this.updateMaxReached(),this._pendingDispatchFrom&&this.syncPublicValue()}updated(e){if(this._pendingDispatchFrom){let e=this._pendingDispatchFrom;this._pendingDispatchFrom=null,this.dispatchValueChange(e)}if(e.has(`_search`)&&this.dispatchEvent(new CustomEvent(`search`,{detail:this._search,bubbles:!1})),!this._isOptionsOpen&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=!this.multiple&&this._value[0]?h(this._value[0],this.options,this.displayValueAs):``;this.inputRef.value.value!==e&&(this.inputRef.value.value=e)}this.classList.add(`pkt-combobox-component`),this.classList.toggle(`pkt-combobox-component--fullwidth`,!!this.fullwidth),super.updated(e)}formResetCallback(){this.touched=!1;let e=this.defaultValue||(this.multiple,``);this.value=e,this._value=this.parseValue(),this._options=this._options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this.options=this.options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this._search=``,this._isOptionsOpen=!1,this._userInfoMessage=``,this._addValueText=null,this._inputFocus=!1,this.updateMaxReached(),this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``),this.setFormValue(``),this.internals.ariaInvalid=`false`,this.requestUpdate()}attributeChangedCallback(e,t,n){if(e===`options`){this._options=v.cloneOptions(this.options);let e=v.syncOptionsWithValues(this._options,this._value);this._options=e.options,e.newValues.length>this._value.length&&(this._value=e.newValues),this._search=``}super.attributeChangedCallback(e,t,n)}render(){return e._`
2
+ <pkt-input-wrapper
3
+ ${o.n(this,[`helptext`])}
4
+ .strings=${this.strings}
5
+ .size=${this.inputSize}
6
+ .label=${this.label}
7
+ .helptext=${this.helptext}
8
+ .helptextDropdown=${t.t(this.helptextDropdown)}
9
+ .helptextDropdownButton=${t.t(this.helptextDropdownButton)}
10
+ ?fullwidth=${this.fullwidth}
11
+ ?counter=${this.effectiveCounter(!!this.multiple&&this.maxlength!=null)}
12
+ .counterCurrent=${this._value.length}
13
+ .counterMaxLength=${this.maxlength??0}
14
+ ?hasError=${this.hasError}
15
+ ?inline=${this.inline}
16
+ ?disabled=${this.isDisabled}
17
+ .errorMessage=${this.errorMessage}
18
+ ?optionalTag=${this.optionalTag}
19
+ .optionalText=${this.optionalText}
20
+ ?requiredTag=${this.requiredTag}
21
+ .requiredText=${this.requiredText}
22
+ .tagText=${this.tagText}
23
+ useWrapper=${this.useWrapper}
24
+ .forId=${this._hasTextInput?this.id+`-input`:this.id+`-combobox`}
25
+ ?hasFieldset=${this.effectiveHasFieldset(!this._hasTextInput)}
26
+ class="pkt-combobox__wrapper"
27
+ @labelClick=${this.handleInputClick}
28
+ >
29
+ <div class="pkt-combobox" @focusout=${this.handleFocusOut}>
30
+ <div
31
+ class=${r.t({"pkt-combobox__input":!0,[`pkt-combobox__input--${this.inputSize}`]:!0,"pkt-combobox__input--fullwidth":this.fullwidth,"pkt-combobox__input--open":this._isOptionsOpen,"pkt-combobox__input--error":this.hasError,"pkt-combobox__input--disabled":this.isDisabled})}
32
+ id=${t.t(this._hasTextInput?void 0:`${this.id}-combobox`)}
33
+ role=${t.t(this._hasTextInput?void 0:`combobox`)}
34
+ aria-expanded=${t.t(this._hasTextInput?void 0:this._isOptionsOpen?`true`:`false`)}
35
+ aria-controls=${t.t(this._hasTextInput?void 0:`${this.id}-listbox`)}
36
+ aria-haspopup=${t.t(this._hasTextInput?void 0:`listbox`)}
37
+ aria-describedby=${t.t(this._hasTextInput?void 0:this._describedBy())}
38
+ aria-labelledby=${t.t(this._hasTextInput?void 0:`${this.id}-combobox-label`)}
39
+ aria-activedescendant=${t.t(!this._hasTextInput&&this._isOptionsOpen&&this._value[0]&&a.i(this.options,this._value[0])?`${this.id}-listbox-${a.a(this._options,this._value[0])}`:void 0)}
40
+ aria-description=${t.t(this._selectionDescription||void 0)}
41
+ tabindex=${this._hasTextInput||this.isDisabled?`-1`:`0`}
42
+ @click=${this.handleInputClick}
43
+ @keydown=${this._hasTextInput?e.h:this.handleSelectOnlyKeydown}
44
+ @blur=${this.restoreInputTab}
45
+ ${n.n(this.triggerRef)}
46
+ >
47
+ ${!this._hasTextInput&&this.placeholder&&(!this._value.length||this.multiple&&this.tagPlacement==`outside`)&&!this._inputFocus?e._`<span class="pkt-combobox__placeholder" @click=${this.handlePlaceholderClick}
48
+ >${this.placeholder}</span
49
+ >`:this.tagPlacement===`outside`?e.h:this.renderSingleOrMultipleValues()}
50
+ ${this.renderInputField()}
51
+ <pkt-icon
52
+ class=${r.t({"pkt-combobox__arrow-icon":!0,"pkt-combobox__arrow-icon--open":this._isOptionsOpen})}
53
+ name="chevron-thin-down"
54
+ aria-hidden="true"
55
+ ></pkt-icon>
56
+ </div>
57
+
58
+ <pkt-listbox
59
+ id="${this.id}-listbox"
60
+ .options=${this._options}
61
+ .isOpen=${this._isOptionsOpen}
62
+ .searchPlaceholder=${this.searchPlaceholder}
63
+ .label="Liste: ${this.label||``}"
64
+ ?disabled=${this.isDisabled}
65
+ ?include-search=${this.includeSearch}
66
+ ?is-multi-select=${this.multiple}
67
+ ?allow-user-input=${this.allowUserInput&&!this._maxIsReached}
68
+ ?max-is-reached=${this._maxIsReached}
69
+ .customUserInput=${t.t(this._addValueText)}
70
+ .userMessage=${this._userInfoMessage?l.t(this.pktStrings.get(`combobox`)[this._userInfoMessage],{value:this._messageValue??``}):``}
71
+ @search=${this.handleSearch}
72
+ @option-toggle=${this.handleOptionToggled}
73
+ @select-all=${this.addAllOptions}
74
+ @close-options=${this.handleCloseOptions}
75
+ @tab-close=${()=>this.closeAndProcessInput()}
76
+ .searchValue=${this._search||null}
77
+ .maxLength=${this.maxlength||0}
78
+ ${n.n(this.listboxRef)}
79
+ ></pkt-listbox>
80
+ </div>
81
+
82
+ ${this.tagPlacement===`outside`&&this.multiple?e._`<div class="pkt-combobox__tags-outside">
83
+ ${this.renderSingleOrMultipleValues()}
84
+ </div>`:e.h}
85
+ </pkt-input-wrapper>
86
+ `}_describedBy(){return u.r({id:this._hasTextInput?`${this.id}-input`:`${this.id}-combobox`,hasHelptext:!!this.helptext||this.hasSlotContent(`helptext`),ariaDescribedby:this.ariaDescribedby})}renderInputField(){return this.typeahead||this.allowUserInput?e._`
87
+ <div class="pkt-combobox__input-div combobox__input">
88
+ <input
89
+ type="text"
90
+ id="${this.id}-input"
91
+ name=${(this.name||this.id)+`-input`}
92
+ placeholder=${t.t(!this._value.length||this.multiple&&this.tagPlacement===`outside`?this.placeholder:void 0)}
93
+ @input=${this.handleInput}
94
+ @change=${e=>{e.stopPropagation(),e.stopImmediatePropagation()}}
95
+ tabindex=${t.t(this._skipInputTab?`-1`:void 0)}
96
+ @keydown=${this.handleInputKeydown}
97
+ @focus=${this.handleFocus}
98
+ @blur=${this.handleBlur}
99
+ autocomplete="off"
100
+ role="combobox"
101
+ aria-expanded=${this._isOptionsOpen?`true`:`false`}
102
+ aria-label=${t.t(this.label)}
103
+ aria-describedby=${t.t(this._describedBy())}
104
+ aria-autocomplete=${this.typeahead?`both`:this.allowUserInput?`list`:`none`}
105
+ aria-controls="${this.id}-listbox"
106
+ aria-activedescendant=${t.t(this._isOptionsOpen&&this._value[0]&&a.i(this.options,this._value[0])?`${this.id}-listbox-${a.a(this._options,this._value[0])}`:void 0)}
107
+ aria-description=${t.t(this._selectionDescription||void 0)}
108
+ ${n.n(this.inputRef)}
109
+ />
110
+ </div>
111
+ `:e._`
112
+ <input
113
+ type="hidden"
114
+ id="${this.id}-input"
115
+ name=${(this.name||this.id)+`-input`}
116
+ .value=${this._value.join(`,`)}
117
+ ${n.n(this.inputRef)}
118
+ />
119
+ `}renderSingleOrMultipleValues(){if(!this.multiple&&this._hasTextInput)return e.h;let t=!this.multiple,n=this.renderValueTag(a.i(this.options,this._value[0])),r=this.tagPlacement===`outside`,o=e._`
120
+ <ul role="list" class="pkt-combobox__tag-list">
121
+ ${i.t(this._value,e=>e,(t,n)=>{let i=a.i(this.options,t),o=i?.tagSkinColor;return e._`
122
+ <li
123
+ role="listitem"
124
+ @click=${r?e.h:e=>e.stopPropagation()}
125
+ @mousedown=${r?e.h:e=>e.preventDefault()}
126
+ >
127
+ <pkt-tag
128
+ skin=${o||`blue`}
129
+ ?closeTag=${!this.isDisabled}
130
+ .buttonTabindex=${r?void 0:-1}
131
+ @close=${()=>this.handleTagRemove(t)}
132
+ @keydown=${r?e.h:e=>this.handleTagKeydown(e,n)}
133
+ >
134
+ ${this.renderValueTag(i)}
135
+ </pkt-tag>
136
+ </li>
137
+ `})}
138
+ </ul>
139
+ `;return!t&&this._value.length===0?e.h:t?n:o}renderValueTag(t){if(!t)return``;switch(this.displayValueAs){case`prefixAndValue`:return e._`<span class="pkt-combobox__value">${t.prefix||``} ${t.value}</span>`;case`value`:return e._`<span class="pkt-combobox__value">${t.value}</span>`;default:return e._`<span class="pkt-combobox__value">${t.label||t.value}</span>`}}};try{e.d(`pkt-combobox`)(S)}catch{console.warn(`Forsøker å definere <pkt-combobox>, men den er allerede definert`)}var C=S;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return C}});
@@ -1,4 +1,4 @@
1
- const e=require("./element-CEarCnHH.cjs");require("./shared-types-BvRk9kiK.cjs"),require("./button-bVWAX98x.cjs");var t={i18n:{nb:{contentPresentation:{title:`Oslo kommune bruker informasjonskapsler`,description:[`For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.`,`Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss.`],buttons:{accept:`Godta alle`,reject:`Kun nødvendige`,settings:`Innstillinger for informasjonskapsler`}},contentSettings:{title:`Innstillinger for informasjonskapsler`,description:[`Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.`,`Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler».`],buttons:{back:`Tilbake`,save:`Lagre innstillinger`}}},en:{contentPresentation:{title:`Before you visit Oslo kommune ...`,description:[`This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.`,`To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites.`],buttons:{accept:`Yes, I accept`,reject:`Only necessary`,settings:`Go to settings`}},contentSettings:{title:`Her kan du aktivt velge mellom ulike informasjonskapsler`,description:[`For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider`],buttons:{back:`Back`,save:`Save settings`}}}},cookies:[{name:`statistics`,defaultValue:null,i18n:{nb:{title:`Statistikk og analyse`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å innhente data om statistikk og brukeradferd.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Statistics and analytics`,description:`Select your preference for statistics and analytics`,buttons:{yes:`Yes`,no:`No`}}}},{name:`survey`,defaultValue:null,i18n:{nb:{title:`Skriftlige tilbakemeldinger`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å vise responsfelt og registrere tilbakemeldinger.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Survey`,description:`Select your preference for survey`,buttons:{yes:`Yes`,no:`No`}}}},{name:`functional`,defaultValue:!0,i18n:{nb:{title:`Funksjonelle informasjonskapsler`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler for å gjøre ulike funksjoner på nettstedet mulige (for eksempel skjemaer og barnehagevelger).`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Functional cookies`,description:`For the website to function optimally, we recommend that you accept these cookies`,buttons:{yes:`Yes`,no:`No`}}}}]},n={devMode:!1,i18nLanguage:`nb`,triggerType:`button`},r=null;function i(){return r||(r=new Promise((e,t)=>{if(document.querySelector(`#oslo-consent-script`)){e();return}let n=document.createElement(`script`);n.src=`https://cdn.web.oslo.kommune.no/cb/cb-v2.0.0.js`,n.id=`oslo-consent-script`,n.onload=()=>e(),n.onerror=t,document.head.appendChild(n);let r=document.createElement(`link`);r.href=`https://cdn.web.oslo.kommune.no/cb/cb-v2.0.0.css`,r.type=`text/css`,r.rel=`stylesheet`,r.id=`oslo-consent-styles`,document.head.appendChild(r)}),r)}var a=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}},o=e=>a(e.value).items.reduce((e,t)=>(e[t.name]=t.consent,e),{}),s=class extends e.t{constructor(...e){super(...e),this.devMode=n.devMode,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType=n.triggerType,this.triggerText=null,this.i18nLanguage=n.i18nLanguage}connectedCallback(){super.connectedCallback();let e=Object.prototype.hasOwnProperty.call(t.i18n,this.i18nLanguage)?this.i18nLanguage:`nb`;this.triggerText=this.triggerText||t.i18n[e].contentPresentation.buttons.settings}disconnectedCallback(){super.disconnectedCallback(),this._cookieEventHandler&&window.__cookieEvents?.off(`CookieManager.setCookie`,this._cookieEventHandler)}returnJsonOrObject(e){return a(e)}emitCookieConsents(e){this.dispatchEvent(new CustomEvent(`toggle-consent`,{detail:o(e),bubbles:!0,cancelable:!1}))}async firstUpdated(e){window.cookieBanner_googleAnalyticsId=this.googleAnalyticsId,window.cookieBanner_hotjarId=this.hotjarId,this.cookieDomain&&(window.cookieBanner_cookieDomain=this.cookieDomain),this.cookieSecure&&(window.cookieBanner_cookieSecure=this.cookieSecure),this.cookieExpiryDays&&(window.cookieBanner_cookieExpiryDays=this.cookieExpiryDays),this.devMode&&(window.cookieBanner_devMode=this.devMode),await i(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event(`CookieBannerReady`,{bubbles:!0,cancelable:!0}));let e=window.cookieBanner,t=window.__cookieEvents;e&&t&&e.cookieConsent.validateConsentCookie().then(n=>{if(!n)return;let r=e.cookieConsent.getConsentCookie();window.setTimeout(()=>this.emitCookieConsents({value:r}),0),this._cookieEventHandler&&t.off(`CookieManager.setCookie`,this._cookieEventHandler),this._cookieEventHandler=e=>this.emitCookieConsents(e),t.on(`CookieManager.setCookie`,this._cookieEventHandler)})}openModal(e){e.preventDefault(),window.cookieBanner?.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner?.openCookieModal())}render(){return this.triggerType===`link`?e._`<a href="#" class="pkt-link" aria-haspopup="dialog" @click=${this.openModal}
1
+ const e=require("./element-CEarCnHH.cjs");require("./shared-types-BvRk9kiK.cjs"),require("./button-DHVRpzpS.cjs");var t={i18n:{nb:{contentPresentation:{title:`Oslo kommune bruker informasjonskapsler`,description:[`For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.`,`Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss.`],buttons:{accept:`Godta alle`,reject:`Kun nødvendige`,settings:`Innstillinger for informasjonskapsler`}},contentSettings:{title:`Innstillinger for informasjonskapsler`,description:[`Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.`,`Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler».`],buttons:{back:`Tilbake`,save:`Lagre innstillinger`}}},en:{contentPresentation:{title:`Before you visit Oslo kommune ...`,description:[`This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.`,`To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites.`],buttons:{accept:`Yes, I accept`,reject:`Only necessary`,settings:`Go to settings`}},contentSettings:{title:`Her kan du aktivt velge mellom ulike informasjonskapsler`,description:[`For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider`],buttons:{back:`Back`,save:`Save settings`}}}},cookies:[{name:`statistics`,defaultValue:null,i18n:{nb:{title:`Statistikk og analyse`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å innhente data om statistikk og brukeradferd.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Statistics and analytics`,description:`Select your preference for statistics and analytics`,buttons:{yes:`Yes`,no:`No`}}}},{name:`survey`,defaultValue:null,i18n:{nb:{title:`Skriftlige tilbakemeldinger`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å vise responsfelt og registrere tilbakemeldinger.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Survey`,description:`Select your preference for survey`,buttons:{yes:`Yes`,no:`No`}}}},{name:`functional`,defaultValue:!0,i18n:{nb:{title:`Funksjonelle informasjonskapsler`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler for å gjøre ulike funksjoner på nettstedet mulige (for eksempel skjemaer og barnehagevelger).`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Functional cookies`,description:`For the website to function optimally, we recommend that you accept these cookies`,buttons:{yes:`Yes`,no:`No`}}}}]},n={devMode:!1,i18nLanguage:`nb`,triggerType:`button`},r=null;function i(){return r||(r=new Promise((e,t)=>{if(document.querySelector(`#oslo-consent-script`)){e();return}let n=document.createElement(`script`);n.src=`https://cdn.web.oslo.kommune.no/cb/cb-v2.0.0.js`,n.id=`oslo-consent-script`,n.onload=()=>e(),n.onerror=t,document.head.appendChild(n);let r=document.createElement(`link`);r.href=`https://cdn.web.oslo.kommune.no/cb/cb-v2.0.0.css`,r.type=`text/css`,r.rel=`stylesheet`,r.id=`oslo-consent-styles`,document.head.appendChild(r)}),r)}var a=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}},o=e=>a(e.value).items.reduce((e,t)=>(e[t.name]=t.consent,e),{}),s=class extends e.t{constructor(...e){super(...e),this.devMode=n.devMode,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType=n.triggerType,this.triggerText=null,this.i18nLanguage=n.i18nLanguage}connectedCallback(){super.connectedCallback();let e=Object.prototype.hasOwnProperty.call(t.i18n,this.i18nLanguage)?this.i18nLanguage:`nb`;this.triggerText=this.triggerText||t.i18n[e].contentPresentation.buttons.settings}disconnectedCallback(){super.disconnectedCallback(),this._cookieEventHandler&&window.__cookieEvents?.off(`CookieManager.setCookie`,this._cookieEventHandler)}returnJsonOrObject(e){return a(e)}emitCookieConsents(e){this.dispatchEvent(new CustomEvent(`toggle-consent`,{detail:o(e),bubbles:!0,cancelable:!1}))}async firstUpdated(e){window.cookieBanner_googleAnalyticsId=this.googleAnalyticsId,window.cookieBanner_hotjarId=this.hotjarId,this.cookieDomain&&(window.cookieBanner_cookieDomain=this.cookieDomain),this.cookieSecure&&(window.cookieBanner_cookieSecure=this.cookieSecure),this.cookieExpiryDays&&(window.cookieBanner_cookieExpiryDays=this.cookieExpiryDays),this.devMode&&(window.cookieBanner_devMode=this.devMode),await i(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event(`CookieBannerReady`,{bubbles:!0,cancelable:!0}));let e=window.cookieBanner,t=window.__cookieEvents;e&&t&&e.cookieConsent.validateConsentCookie().then(n=>{if(!n)return;let r=e.cookieConsent.getConsentCookie();window.setTimeout(()=>this.emitCookieConsents({value:r}),0),this._cookieEventHandler&&t.off(`CookieManager.setCookie`,this._cookieEventHandler),this._cookieEventHandler=e=>this.emitCookieConsents(e),t.on(`CookieManager.setCookie`,this._cookieEventHandler)})}openModal(e){e.preventDefault(),window.cookieBanner?.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner?.openCookieModal())}render(){return this.triggerType===`link`?e._`<a href="#" class="pkt-link" aria-haspopup="dialog" @click=${this.openModal}
2
2
  >${this.triggerText}</a
3
3
  >`:this.triggerType===`footerlink`?e._`<a
4
4
  href="#"
@@ -1,7 +1,7 @@
1
- import { _ as e, d as t, n, t as r, u as i } from "./element-DLgZkx5L.js";
2
- import "./shared-types-A6iGIX-f.js";
3
- import "./button-Bswo1C0M.js";
4
- //#region ../../shared-strings/consent.ts
1
+ import { _ as e, d as t, n, t as r, u as i } from "./element-Bwc-likm.js";
2
+ import "./shared-types-BvRk9kiK.js";
3
+ import "./button-CJzu0l5A.js";
4
+ // ../../shared-strings/consent.ts
5
5
  var a = {
6
6
  i18n: {
7
7
  nb: {
@@ -202,8 +202,6 @@ try {
202
202
  } catch {
203
203
  console.warn("Forsøker å definere <pkt-consent>, men den er allerede definert");
204
204
  }
205
- //#endregion
206
- //#region src/components/consent/index.ts
205
+ // src/components/consent/index.ts
207
206
  var f = d;
208
- //#endregion
209
207
  export { d as n, f as t };
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/@lit/context/lib/context-request-event.js
1
+ // ../../node_modules/@lit/context/lib/context-request-event.js
2
2
  var e = class extends Event {
3
3
  constructor(e, t, n, r) {
4
4
  super("context-request", {
@@ -7,13 +7,11 @@ var e = class extends Event {
7
7
  }), this.context = e, this.contextTarget = t, this.callback = n, this.subscribe = r ?? !1;
8
8
  }
9
9
  };
10
- //#endregion
11
- //#region ../../node_modules/@lit/context/lib/create-context.js
10
+ // ../../node_modules/@lit/context/lib/create-context.js
12
11
  function t(e) {
13
12
  return e;
14
13
  }
15
- //#endregion
16
- //#region ../../node_modules/@lit/context/lib/controllers/context-consumer.js
14
+ // ../../node_modules/@lit/context/lib/controllers/context-consumer.js
17
15
  var n = class {
18
16
  constructor(e, t, n, r) {
19
17
  if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (e, t) => {
@@ -34,8 +32,7 @@ var n = class {
34
32
  this.host.dispatchEvent(new e(this.context, this.host, this.t, this.subscribe));
35
33
  }
36
34
  };
37
- //#endregion
38
- //#region ../../node_modules/@lit/context/lib/decorators/consume.js
35
+ // ../../node_modules/@lit/context/lib/decorators/consume.js
39
36
  function r({ context: e, subscribe: t }) {
40
37
  return (r, i) => {
41
38
  typeof i == "object" ? i.addInitializer((function() {
@@ -57,5 +54,4 @@ function r({ context: e, subscribe: t }) {
57
54
  }));
58
55
  };
59
56
  }
60
- //#endregion
61
57
  export { t as n, e as r, r as t };