@oslokommune/punkt-elements 14.3.0 → 14.5.2

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 (149) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/{accordionitem-C_URrDjP.js → accordionitem-DB3tAjIZ.js} +4 -4
  3. package/dist/{accordionitem-DCZrHVNR.cjs → accordionitem-DHYmPA-o.cjs} +1 -1
  4. package/dist/{alert-UFQFbbzZ.js → alert-DqXar67l.js} +6 -6
  5. package/dist/{alert-SvqEDHuW.cjs → alert-GrKyqxuR.cjs} +1 -1
  6. package/dist/{backlink-C7qUmUzs.js → backlink-CqUcmiPQ.js} +11 -11
  7. package/dist/{backlink-BrIIpgJ7.cjs → backlink-QDcQd6vK.cjs} +1 -1
  8. package/dist/{button-DaM4jvhJ.cjs → button-R4l10Nqd.cjs} +1 -1
  9. package/dist/{button-CjXih_Nx.js → button-f36menSU.js} +5 -5
  10. package/dist/{calendar-CvfMj3fA.js → calendar-DiNuZ8Ai.js} +7 -8
  11. package/dist/{calendar-ZzLAjDpv.cjs → calendar-wuD6ZH0t.cjs} +3 -3
  12. package/dist/{card-C1gRTfXb.cjs → card-C2hWaMev.cjs} +1 -1
  13. package/dist/{card-CO3D8wQE.js → card-CnINxZma.js} +7 -7
  14. package/dist/{checkbox-C0TPnShf.cjs → checkbox-B-0FOdwi.cjs} +1 -1
  15. package/dist/{checkbox-CnhA52o_.js → checkbox-CkAwPK_E.js} +4 -4
  16. package/dist/{class-map-C_erArZz.cjs → class-map-CApIYSRo.cjs} +1 -1
  17. package/dist/{class-map-wy7PUk0P.js → class-map-Dt2jXOlF.js} +1 -1
  18. package/dist/{combobox-Dcp_fHcL.js → combobox-Dxa7XjLz.js} +55 -55
  19. package/dist/{combobox-C1xwAju5.cjs → combobox-yy6hIGmB.cjs} +13 -13
  20. package/dist/{consent-Daj-Xa7w.cjs → consent-FbFS1pmz.cjs} +1 -1
  21. package/dist/{consent-BO3Ga8N4.js → consent-c9PhWxnP.js} +3 -3
  22. package/dist/{datepicker-Bjb9GK1E.js → datepicker-C7GWMtXH.js} +222 -241
  23. package/dist/{datepicker-COIRRau0.cjs → datepicker-D_3vYgMt.cjs} +25 -25
  24. package/dist/{directive-helpers-BzAtj9by.js → directive-helpers-CQef4qUQ.js} +1 -1
  25. package/dist/{directive-helpers-4oOjKnGY.cjs → directive-helpers-CYIEJ8pI.cjs} +1 -1
  26. package/dist/{element-CRDRygXu.js → element-BXsf_NlG.js} +3 -3
  27. package/dist/{element-CJ_QKaki.cjs → element-aUzIoa1s.cjs} +3 -3
  28. package/dist/{heading-Dv_cH6N1.cjs → heading-CBepYb7H.cjs} +1 -1
  29. package/dist/{heading-BUdy170t.js → heading-J7dN9nRi.js} +13 -13
  30. package/dist/{helptext-hlcc584n.cjs → helptext-DebHGRsD.cjs} +1 -1
  31. package/dist/{helptext-Bn17Picx.js → helptext-DuyRRfCn.js} +5 -5
  32. package/dist/{icon-BB7e5iQN.js → icon-BgG6oO4Q.js} +1 -1
  33. package/dist/{icon-MRx-m0Or.cjs → icon-Dl9ZPqe6.cjs} +1 -1
  34. package/dist/{if-defined-Bc9-_I01.cjs → if-defined-BElHLTlB.cjs} +1 -1
  35. package/dist/{if-defined-BWZGb3bh.js → if-defined-CxHgig4I.js} +1 -1
  36. package/dist/index.d.ts +213 -55
  37. package/dist/input-element-DVZhYDJ_.js +840 -0
  38. package/dist/input-element-RBQVA8i0.cjs +1 -0
  39. package/dist/{input-wrapper-1PCXqtiu.js → input-wrapper-3qfjLkrP.js} +7 -7
  40. package/dist/{input-wrapper-CtBiAb04.cjs → input-wrapper-rgXsRNkk.cjs} +1 -1
  41. package/dist/{link-BboUBUcg.js → link-CZvcdRek.js} +4 -4
  42. package/dist/{link-Dw39h-YN.cjs → link-D85g20GS.cjs} +1 -1
  43. package/dist/{linkcard-DUA3kGGd.cjs → linkcard-B-9K02q8.cjs} +1 -1
  44. package/dist/{linkcard-BqJmHFu8.js → linkcard-C3RTcMqc.js} +4 -4
  45. package/dist/{listbox-mvKKzH-v.js → listbox-CLtowV6W.js} +36 -36
  46. package/dist/{listbox-DnoqOo5u.cjs → listbox-C_0RhGhk.cjs} +2 -2
  47. package/dist/{loader-DjGxT7C3.cjs → loader-1EXLdxfq.cjs} +1 -1
  48. package/dist/{loader-DIum_s_D.js → loader-Dci0SrOz.js} +5 -5
  49. package/dist/{messagebox-aPlConlJ.js → messagebox-CnZlttZp.js} +5 -5
  50. package/dist/{messagebox-ChIKVTO_.cjs → messagebox-dscnWgCd.cjs} +1 -1
  51. package/dist/{modal-B4qq0VFB.cjs → modal-ncKVjcyZ.cjs} +1 -1
  52. package/dist/{modal-jAUtM-NP.js → modal-wSGthXAC.js} +5 -5
  53. package/dist/pkt-accordion.cjs +1 -1
  54. package/dist/pkt-accordion.js +2 -2
  55. package/dist/pkt-alert.cjs +1 -1
  56. package/dist/pkt-alert.js +1 -1
  57. package/dist/pkt-backlink.cjs +1 -1
  58. package/dist/pkt-backlink.js +1 -1
  59. package/dist/pkt-button.cjs +1 -1
  60. package/dist/pkt-button.js +1 -1
  61. package/dist/pkt-calendar.cjs +1 -1
  62. package/dist/pkt-calendar.js +1 -1
  63. package/dist/pkt-card.cjs +1 -1
  64. package/dist/pkt-card.js +1 -1
  65. package/dist/pkt-checkbox.cjs +1 -1
  66. package/dist/pkt-checkbox.js +1 -1
  67. package/dist/pkt-combobox.cjs +1 -1
  68. package/dist/pkt-combobox.js +1 -1
  69. package/dist/pkt-consent.cjs +1 -1
  70. package/dist/pkt-consent.js +1 -1
  71. package/dist/pkt-datepicker.cjs +1 -1
  72. package/dist/pkt-datepicker.js +2 -2
  73. package/dist/pkt-header.cjs +1 -1
  74. package/dist/pkt-header.js +9 -9
  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 +1 -29
  82. package/dist/pkt-index.js +60 -157
  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-options-controller-DjBCEHU4.cjs +1 -0
  98. package/dist/{pkt-options-controller-CZO1nxZ8.js → pkt-options-controller-zn5cmMvL.js} +3 -3
  99. package/dist/pkt-progressbar.cjs +1 -1
  100. package/dist/pkt-progressbar.js +2 -2
  101. package/dist/pkt-radiobutton.cjs +1 -1
  102. package/dist/pkt-radiobutton.js +1 -1
  103. package/dist/pkt-select.cjs +1 -1
  104. package/dist/pkt-select.js +1 -1
  105. package/dist/pkt-tabs.cjs +1 -1
  106. package/dist/pkt-tabs.js +2 -2
  107. package/dist/pkt-tag.cjs +1 -1
  108. package/dist/pkt-tag.js +1 -1
  109. package/dist/pkt-textarea.cjs +1 -1
  110. package/dist/pkt-textarea.js +1 -1
  111. package/dist/pkt-textinput.cjs +1 -1
  112. package/dist/pkt-textinput.js +1 -1
  113. package/dist/{progressbar-CmAQ-DVW.cjs → progressbar-ClY1WgnM.cjs} +1 -1
  114. package/dist/{progressbar-CVt73-JQ.js → progressbar-D5WBW1Dm.js} +5 -5
  115. package/dist/{radiobutton-BkqaqO5E.cjs → radiobutton-iHuLnuAn.cjs} +1 -1
  116. package/dist/{radiobutton-Caq8-GhM.js → radiobutton-oA20HijB.js} +15 -15
  117. package/dist/{ref-Xa5dbh--.js → ref-BxiKhrfa.js} +2 -2
  118. package/dist/{ref-BFa5Utho.cjs → ref-C5iJMIE1.cjs} +1 -1
  119. package/dist/{repeat-CJ79egkN.js → repeat-B55jMEsG.js} +2 -2
  120. package/dist/{repeat-BZb41H64.cjs → repeat-DcYSFU2y.cjs} +1 -1
  121. package/dist/select-Bug9sfr5.js +228 -0
  122. package/dist/select-jbIbD7hW.cjs +49 -0
  123. package/dist/{state-DS_kr2Fy.js → state-DgnkjP0q.js} +1 -1
  124. package/dist/{state-DSjcvzDN.cjs → state-GDzxl12x.cjs} +1 -1
  125. package/dist/{tabitem-D5zyipN1.cjs → tabitem-CtltSqDK.cjs} +1 -1
  126. package/dist/{tabitem-NV2fzs_-.js → tabitem-CypTmORF.js} +30 -30
  127. package/dist/{tag-B02fKJ66.cjs → tag-BfjOlIyS.cjs} +1 -1
  128. package/dist/{tag-CES41g0D.js → tag-DgoTYNVA.js} +6 -6
  129. package/dist/{textarea-a6T4aJJU.js → textarea-Da9E3RM7.js} +9 -9
  130. package/dist/{textarea-DyUy8u7X.cjs → textarea-Dfa4_ZBy.cjs} +1 -1
  131. package/dist/{textinput-IN3b0nSH.cjs → textinput-CLM9fRjm.cjs} +1 -1
  132. package/dist/{textinput-DIuM70dd.js → textinput-DaMYc5gd.js} +8 -8
  133. package/package.json +2 -2
  134. package/src/components/checkbox/checkbox.ts +1 -1
  135. package/src/components/combobox/combobox.ts +2 -2
  136. package/src/components/datepicker/datepicker-utils.test.ts +0 -25
  137. package/src/components/datepicker/datepicker-utils.ts +0 -28
  138. package/src/components/datepicker/datepicker.ts +0 -6
  139. package/src/components/header/header.ts +2 -0
  140. package/src/components/index.ts +0 -1
  141. package/src/components/radiobutton/radiobutton.ts +1 -1
  142. package/src/components/select/select.ts +14 -47
  143. package/src/components/textarea/textarea.ts +1 -1
  144. package/src/components/textinput/textinput.ts +1 -1
  145. package/dist/input-element-B8M8Nppd.js +0 -708
  146. package/dist/input-element-D697OAJo.cjs +0 -1
  147. package/dist/pkt-options-controller-CiuBG6Lt.cjs +0 -1
  148. package/dist/select-3dwlk22G.cjs +0 -49
  149. package/dist/select-_C-yztI0.js +0 -173
@@ -1,47 +1,47 @@
1
- import { E as I, x as d, n as r, a as w } from "./element-CRDRygXu.js";
2
- import { o as f } from "./if-defined-BWZGb3bh.js";
3
- import { r as c } from "./state-DS_kr2Fy.js";
4
- import { e as _, n as v } from "./ref-Xa5dbh--.js";
5
- import { e as k } from "./class-map-wy7PUk0P.js";
6
- import { c as R } from "./repeat-CJ79egkN.js";
7
- import { P as V } from "./input-element-B8M8Nppd.js";
8
- import { P as A } from "./pkt-options-controller-CZO1nxZ8.js";
1
+ import { E as I, x as d, n as r, t as w } from "./element-BXsf_NlG.js";
2
+ import { o as f } from "./if-defined-CxHgig4I.js";
3
+ import { r as c } from "./state-DgnkjP0q.js";
4
+ import { e as _, n as v } from "./ref-BxiKhrfa.js";
5
+ import { e as k } from "./class-map-Dt2jXOlF.js";
6
+ import { c as R } from "./repeat-B55jMEsG.js";
7
+ import { P as V } from "./input-element-DVZhYDJ_.js";
8
+ import { P as A } from "./pkt-options-controller-zn5cmMvL.js";
9
9
  import { P as C } from "./pkt-slot-controller-BPGj-LC5.js";
10
- import "./input-wrapper-1PCXqtiu.js";
11
- import "./icon-BB7e5iQN.js";
12
- import "./tag-CES41g0D.js";
13
- import "./listbox-mvKKzH-v.js";
10
+ import "./input-wrapper-3qfjLkrP.js";
11
+ import "./icon-BgG6oO4Q.js";
12
+ import "./tag-DgoTYNVA.js";
13
+ import "./listbox-CLtowV6W.js";
14
14
  const S = { displayValueAs: { default: "label" } }, T = {
15
15
  props: S
16
16
  };
17
17
  var M = Object.defineProperty, P = Object.getOwnPropertyDescriptor, n = (t, e, i, s) => {
18
- for (var h = s > 1 ? void 0 : s ? P(e, i) : e, l = t.length - 1, a; l >= 0; l--)
19
- (a = t[l]) && (h = (s ? a(e, i, h) : a(h)) || h);
20
- return s && h && M(e, i, h), h;
18
+ for (var a = s > 1 ? void 0 : s ? P(e, i) : e, l = t.length - 1, h; l >= 0; l--)
19
+ (h = t[l]) && (a = (s ? h(e, i, a) : h(a)) || a);
20
+ return s && a && M(e, i, a), a;
21
21
  };
22
22
  let o = class extends V {
23
23
  constructor() {
24
- super(), this.helptextSlot = _(), this.value = "", this.options = [], this.defaultOptions = [], this.allowUserInput = !1, this.typeahead = !1, this.includeSearch = !1, this.searchPlaceholder = "", this.multiple = !1, this.maxlength = null, this.displayValueAs = T.props.displayValueAs.default, this.tagPlacement = null, this._options = [], this._isOptionsOpen = !1, this._value = [], this._userInfoMessage = "", this._addValueText = null, this._maxIsReached = !1, this._search = "", this._inputFocus = !1, this._editingSingleValue = !1, this.inputRef = _(), this.arrowRef = _(), this.listboxRef = _(), this.focusRef = _(), this.optionTagRef = _(), this.optionsController = new A(this), this.slotController = new C(this, this.helptextSlot), this.slotController.skipOptions = !0;
24
+ super(), this.helptextSlot = _(), this.value = "", this.options = [], this.defaultOptions = [], this.allowUserInput = !1, this.typeahead = !1, this.includeSearch = !1, this.searchPlaceholder = "", this.multiple = !1, this.maxlength = null, this.displayValueAs = T.props.displayValueAs.default, this.tagPlacement = null, this._options = [], this._value = [], this._isOptionsOpen = !1, this._userInfoMessage = "", this._addValueText = null, this._maxIsReached = !1, this._search = "", this._inputFocus = !1, this._editingSingleValue = !1, this.inputRef = _(), this.arrowRef = _(), this.listboxRef = _(), this.focusRef = _(), this.optionTagRef = _(), this.optionsController = new A(this), this.slotController = new C(this, this.helptextSlot), this.slotController.skipOptions = !0;
25
25
  }
26
26
  // Lifecycle methods
27
27
  connectedCallback() {
28
- var t;
29
- if (super.connectedCallback(), document && document.body.addEventListener("click", (e) => {
30
- this._isOptionsOpen && !this.contains(e.target) && this.handleFocusOut(e);
28
+ var t, e;
29
+ if (super.connectedCallback(), document && document.body.addEventListener("click", (i) => {
30
+ this._isOptionsOpen && !this.contains(i.target) && this.handleFocusOut(i);
31
31
  }), this._options = [], this.defaultOptions && this.defaultOptions.length) {
32
- const e = ((t = this.options) == null ? void 0 : t.filter((i) => i.userAdded)) || [];
33
- this.options = [...e, ...JSON.parse(JSON.stringify(this.defaultOptions))], this._options = Array.isArray(this.options) ? [...this.options] : [];
32
+ const i = ((t = this.options) == null ? void 0 : t.filter((s) => s.userAdded)) || [];
33
+ this.options = [...i, ...JSON.parse(JSON.stringify(this.defaultOptions))], this._options = Array.isArray(this.options) ? [...this.options] : [];
34
34
  }
35
- if (this.optionsController.nodes.length) {
36
- const e = [];
37
- this.optionsController.nodes.forEach((i) => {
38
- if (!i.textContent && !i.getAttribute("value")) return null;
39
- const s = {
40
- value: i.getAttribute("value") || i.textContent || "",
41
- label: i.textContent || i.getAttribute("value") || ""
35
+ if ((e = this.optionsController) != null && e.nodes && this.optionsController.nodes.length) {
36
+ const i = [];
37
+ this.optionsController.nodes.forEach((s) => {
38
+ if (!s.textContent && !s.getAttribute("value")) return null;
39
+ const a = {
40
+ value: s.getAttribute("value") || s.textContent || "",
41
+ label: s.textContent || s.getAttribute("value") || ""
42
42
  };
43
- i.getAttribute("data-prefix") && (s.prefix = i.getAttribute("data-prefix") || void 0), i.getAttribute("tagskincolor") && (s.tagSkinColor = i.getAttribute("tagskincolor")), i.getAttribute("description") && (s.description = i.getAttribute("description") || void 0), s.fulltext = s.value + s.label + (s.prefix || ""), e.push(s);
44
- }), e.length && (this.options = [...e], this._options = [...e]);
43
+ s.getAttribute("data-prefix") && (a.prefix = s.getAttribute("data-prefix") || void 0), s.getAttribute("tagskincolor") && (a.tagSkinColor = s.getAttribute("tagskincolor")), s.getAttribute("description") && (a.description = s.getAttribute("description") || void 0), a.fulltext = a.value + a.label + (a.prefix || ""), i.push(a);
44
+ }), i.length && (this.options = [...i], this._options = [...i]);
45
45
  }
46
46
  }
47
47
  updated(t) {
@@ -52,13 +52,13 @@ let o = class extends V {
52
52
  if (t.has("options")) {
53
53
  const s = (t.get("options") || this._options || []).filter((l) => l && l.userAdded).filter(
54
54
  (l) => !(Array.isArray(this.options) ? this.options : []).some(
55
- (a) => a.value === l.value
55
+ (h) => h.value === l.value
56
56
  )
57
- ), h = [...s, ...this.options];
58
- this._options = h, s.length > 0 && (this.options = h), this._options.forEach((l) => {
57
+ ), a = [...s, ...this.options];
58
+ this._options = a, s.length > 0 && (this.options = a), this._options.forEach((l) => {
59
59
  if (l.value && !l.label && (l.label = l.value), l.selected && !this._value.includes(l.value)) {
60
- const a = [...this._value];
61
- this._value = [...this._value, l.value], this.valueChanged(this._value, a);
60
+ const h = [...this._value];
61
+ this._value = [...this._value, l.value], this.valueChanged(this._value, h);
62
62
  }
63
63
  l.fulltext = l.value + l.label + (l.prefix || ""), l.selected = l.selected || this._value.includes(l.value);
64
64
  });
@@ -212,15 +212,15 @@ let o = class extends V {
212
212
  this._value,
213
213
  (s) => s,
214
214
  (s) => {
215
- var a;
216
- const h = this.findValueInOptions(s), l = (a = this.options.find((u) => u.value === s)) == null ? void 0 : a.tagSkinColor;
215
+ var h;
216
+ const a = this.findValueInOptions(s), l = (h = this.options.find((u) => u.value === s)) == null ? void 0 : h.tagSkinColor;
217
217
  return d`
218
218
  <pkt-tag
219
219
  skin=${l || "blue-dark"}
220
220
  ?closeTag=${!this.disabled}
221
221
  @close=${() => this.handleTagRemove(s)}
222
222
  >
223
- ${this.renderValueTag(h)}
223
+ ${this.renderValueTag(a)}
224
224
  </pkt-tag>
225
225
  `;
226
226
  }
@@ -260,8 +260,8 @@ let o = class extends V {
260
260
  ), t.inputType !== "deleteContentBackward") {
261
261
  const i = this._options.filter(
262
262
  (s) => {
263
- var h;
264
- return !s.selected && ((h = s.label) == null ? void 0 : h.toLowerCase().startsWith(this._search.toLowerCase()));
263
+ var a;
264
+ return !s.selected && ((a = s.label) == null ? void 0 : a.toLowerCase().startsWith(this._search.toLowerCase()));
265
265
  }
266
266
  );
267
267
  if (i.length > 0 && this.inputRef.value && this.inputRef.value.type !== "hidden") {
@@ -285,11 +285,11 @@ let o = class extends V {
285
285
  }
286
286
  }
287
287
  handleFocusOut(t) {
288
- var e, i, s, h, l;
289
- if (!this.disabled && ((i = (e = t.relatedTarget) == null ? void 0 : e.closest("pkt-combobox")) == null ? void 0 : i.id) !== this.id && ((h = (s = t.relatedTarget) == null ? void 0 : s.closest("pkt-combobox")) == null ? void 0 : h.id) !== this.id && ((l = t.target) == null ? void 0 : l.getAttribute("data-focusfix")) !== this.id && t.relatedTarget !== this.focusRef.value && t.relatedTarget !== this.inputRef.value && t.relatedTarget !== this.arrowRef.value && this._isOptionsOpen) {
288
+ var e, i, s, a, l;
289
+ if (!this.disabled && ((i = (e = t.relatedTarget) == null ? void 0 : e.closest("pkt-combobox")) == null ? void 0 : i.id) !== this.id && ((a = (s = t.relatedTarget) == null ? void 0 : s.closest("pkt-combobox")) == null ? void 0 : a.id) !== this.id && ((l = t.target) == null ? void 0 : l.getAttribute("data-focusfix")) !== this.id && t.relatedTarget !== this.focusRef.value && t.relatedTarget !== this.inputRef.value && t.relatedTarget !== this.arrowRef.value && this._isOptionsOpen) {
290
290
  if (this._inputFocus = !1, this._addValueText = null, this._userInfoMessage = "", this._search = "", this.inputRef.value && this.inputRef.value.type !== "hidden" && this.inputRef.value.value !== "") {
291
- const a = this.inputRef.value.value, u = this.findValueInOptions(a);
292
- !this._value.includes(a) && !u ? this.allowUserInput ? this.addNewUserValue(a) : this.multiple || this.removeValue(this._value[0]) : u && !this._value.includes(u.value) && this.setSelected(u.value), this.inputRef.value.value = "";
291
+ const h = this.inputRef.value.value, u = this.findValueInOptions(h);
292
+ !this._value.includes(h) && !u ? this.allowUserInput ? this.addNewUserValue(h) : this.multiple || this.removeValue(this._value[0]) : u && !this._value.includes(u.value) && this.setSelected(u.value), this.inputRef.value.value = "";
293
293
  }
294
294
  this._isOptionsOpen = !1, this.onBlur();
295
295
  }
@@ -352,19 +352,19 @@ let o = class extends V {
352
352
  !this.multiple && this._value[0] && this.removeValue(this._value[0]), this.resetComboboxInput(!1);
353
353
  return;
354
354
  }
355
- const i = this._value.find((a) => a.toLowerCase() === e), s = this._options.filter(
356
- (a) => {
355
+ const i = this._value.find((h) => h.toLowerCase() === e), s = this._options.filter(
356
+ (h) => {
357
357
  var u;
358
- return ((u = a.label) == null ? void 0 : u.toLowerCase().includes(e)) ?? !1;
358
+ return ((u = h.label) == null ? void 0 : u.toLowerCase().includes(e)) ?? !1;
359
359
  }
360
- ), h = s.find(
361
- (a) => {
360
+ ), a = s.find(
361
+ (h) => {
362
362
  var u;
363
- return ((u = a.label) == null ? void 0 : u.toLowerCase()) === e || a.value.toLowerCase() === e;
363
+ return ((u = h.label) == null ? void 0 : u.toLowerCase()) === e || h.value.toLowerCase() === e;
364
364
  }
365
365
  );
366
366
  switch (!0) {
367
- case ((s.length === 0 || !h) && this.allowUserInput):
367
+ case ((s.length === 0 || !a) && this.allowUserInput):
368
368
  this._addValueText = t, this._userInfoMessage = "";
369
369
  break;
370
370
  case (s.length === 0 && !this._options.length && !this.allowUserInput):
@@ -394,9 +394,9 @@ let o = class extends V {
394
394
  var O, $;
395
395
  if (this.disabled) return;
396
396
  this.touched = !0, this._userInfoMessage = "", this._addValueText = null;
397
- const e = ((O = this.findValueInOptions(t)) == null ? void 0 : O.value) || null, i = this._value.includes(t || e || ""), s = !!e, h = (($ = this._options.find((m) => m.value === t)) == null ? void 0 : $.disabled) || !1, l = !(t != null && t.trim()), a = !this.multiple, u = this.multiple, y = this.isMaxItemsReached();
397
+ const e = ((O = this.findValueInOptions(t)) == null ? void 0 : O.value) || null, i = this._value.includes(t || e || ""), s = !!e, a = (($ = this._options.find((m) => m.value === t)) == null ? void 0 : $.disabled) || !1, l = !(t != null && t.trim()), h = !this.multiple, u = this.multiple, y = this.isMaxItemsReached();
398
398
  let p = !1, b = !0, g = "", x = "";
399
- h || (!s && this.allowUserInput && !l ? (this.addNewUserValue(t), g = "Ny verdi lagt til", p = !u) : !s && !this.allowUserInput ? (a && this._value[0] && this.removeValue(this._value[0]), b = !1, p = !0, g = "Ingen treff i søket") : i ? (this.removeValue(e), p = !0) : l && a ? (this.removeAllSelected(), p = !0) : a ? (this._value[0] && this.removeSelected(this._value[0]), this.setSelected(e), p = !1, this.inputRef.value && this.inputRef.value.type !== "hidden" && (this.inputRef.value.value = "", this.inputRef.value.blur())) : u && !y ? (this.setSelected(e), p = !0) : u && y ? (this._userInfoMessage = "Maks antall valg nådd", b = !1, x = t) : (a && this.removeAllSelected(), this._userInfoMessage = "Ingen gyldig verdi valgt", b = !1, p = !0, x = t), this._isOptionsOpen = p, p || window.setTimeout(() => {
399
+ a || (!s && this.allowUserInput && !l ? (this.addNewUserValue(t), g = "Ny verdi lagt til", p = !u) : !s && !this.allowUserInput ? (h && this._value[0] && this.removeValue(this._value[0]), b = !1, p = !0, g = "Ingen treff i søket") : i ? (this.removeValue(e), p = !0) : l && h ? (this.removeAllSelected(), p = !0) : h ? (this._value[0] && this.removeSelected(this._value[0]), this.setSelected(e), p = !1, this.inputRef.value && this.inputRef.value.type !== "hidden" && (this.inputRef.value.value = "", this.inputRef.value.blur())) : u && !y ? (this.setSelected(e), p = !0) : u && y ? (this._userInfoMessage = "Maks antall valg nådd", b = !1, x = t) : (h && this.removeAllSelected(), this._userInfoMessage = "Ingen gyldig verdi valgt", b = !1, p = !0, x = t), this._isOptionsOpen = p, p || window.setTimeout(() => {
400
400
  var m;
401
401
  (m = this.focusRef.value) == null || m.focus();
402
402
  }, 0), this._userInfoMessage = g, this._search = x || "", this.resetComboboxInput(b), u && this.isMaxItemsReached());
@@ -504,10 +504,10 @@ n([
504
504
  ], o.prototype, "_options", 2);
505
505
  n([
506
506
  c()
507
- ], o.prototype, "_isOptionsOpen", 2);
507
+ ], o.prototype, "_value", 2);
508
508
  n([
509
509
  c()
510
- ], o.prototype, "_value", 2);
510
+ ], o.prototype, "_isOptionsOpen", 2);
511
511
  n([
512
512
  c()
513
513
  ], o.prototype, "_userInfoMessage", 2);
@@ -1,4 +1,4 @@
1
- "use strict";const a=require("./element-CJ_QKaki.cjs"),c=require("./if-defined-Bc9-_I01.cjs"),d=require("./state-DSjcvzDN.cjs"),r=require("./ref-BFa5Utho.cjs"),y=require("./class-map-C_erArZz.cjs"),O=require("./repeat-BZb41H64.cjs"),$=require("./input-element-D697OAJo.cjs"),I=require("./pkt-options-controller-CiuBG6Lt.cjs"),w=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-CtBiAb04.cjs");require("./icon-MRx-m0Or.cjs");require("./tag-B02fKJ66.cjs");require("./listbox-DnoqOo5u.cjs");const C={displayValueAs:{default:"label"}},R={props:C};var V=Object.defineProperty,A=Object.getOwnPropertyDescriptor,h=(v,t,e,i)=>{for(var s=i>1?void 0:i?A(t,e):t,n=v.length-1,l;n>=0;n--)(l=v[n])&&(s=(i?l(t,e,s):l(s))||s);return i&&s&&V(t,e,s),s};exports.PktCombobox=class extends $.PktInputElement{constructor(){super(),this.helptextSlot=r.e(),this.value="",this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder="",this.multiple=!1,this.maxlength=null,this.displayValueAs=R.props.displayValueAs.default,this.tagPlacement=null,this._options=[],this._isOptionsOpen=!1,this._value=[],this._userInfoMessage="",this._addValueText=null,this._maxIsReached=!1,this._search="",this._inputFocus=!1,this._editingSingleValue=!1,this.inputRef=r.e(),this.arrowRef=r.e(),this.listboxRef=r.e(),this.focusRef=r.e(),this.optionTagRef=r.e(),this.optionsController=new I.PktOptionsSlotController(this),this.slotController=new w.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){var t;if(super.connectedCallback(),document&&document.body.addEventListener("click",e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.handleFocusOut(e)}),this._options=[],this.defaultOptions&&this.defaultOptions.length){const e=((t=this.options)==null?void 0:t.filter(i=>i.userAdded))||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(this.optionsController.nodes.length){const e=[];this.optionsController.nodes.forEach(i=>{if(!i.textContent&&!i.getAttribute("value"))return null;const s={value:i.getAttribute("value")||i.textContent||"",label:i.textContent||i.getAttribute("value")||""};i.getAttribute("data-prefix")&&(s.prefix=i.getAttribute("data-prefix")||void 0),i.getAttribute("tagskincolor")&&(s.tagSkinColor=i.getAttribute("tagskincolor")),i.getAttribute("description")&&(s.description=i.getAttribute("description")||void 0),s.fulltext=s.value+s.label+(s.prefix||""),e.push(s)}),e.length&&(this.options=[...e],this._options=[...e])}}updated(t){if(t.has("_value")&&this.valueChanged(this._value,t.get("_value")),t.has("value")&&(Array.isArray(this.value)?this._value=this.value:this.value&&this.multiple?this._value=this.value.split(","):this.value?this._value=[this.value]:this._value=[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]]),this.isMaxItemsReached()),t.has("defaultOptions")&&this.defaultOptions.length){const e=(Array.isArray(this.options)?this.options:[]).filter(i=>i.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(t.has("options")){const s=(t.get("options")||this._options||[]).filter(l=>l&&l.userAdded).filter(l=>!(Array.isArray(this.options)?this.options:[]).some(o=>o.value===l.value)),n=[...s,...this.options];this._options=n,s.length>0&&(this.options=n),this._options.forEach(l=>{if(l.value&&!l.label&&(l.label=l.value),l.selected&&!this._value.includes(l.value)){const o=[...this._value];this._value=[...this._value,l.value],this.valueChanged(this._value,o)}l.fulltext=l.value+l.label+(l.prefix||""),l.selected=l.selected||this._value.includes(l.value)})}t.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),super.updated(t)}attributeChangedCallback(t,e,i){t==="value"&&(Array.isArray(this.value)?this._value=this.value:this.value&&this.multiple?this._value=this.value.split(","):this.value?this._value=[this.value]:this._value=[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]])),t==="options"&&(this._options=Array.isArray(this.options)?[...this.options]:[],this._options.forEach(s=>{s.value&&!s.label&&(s.label=s.value),s.selected&&!this._value.includes(s.value)&&(this._value=[...this._value,s.value]),s.fulltext=s.value+s.label+(s.prefix||"")}),this._search=""),super.attributeChangedCallback(t,e,i)}render(){return a.x`
1
+ "use strict";const o=require("./element-aUzIoa1s.cjs"),c=require("./if-defined-BElHLTlB.cjs"),d=require("./state-GDzxl12x.cjs"),r=require("./ref-C5iJMIE1.cjs"),y=require("./class-map-CApIYSRo.cjs"),O=require("./repeat-DcYSFU2y.cjs"),$=require("./input-element-RBQVA8i0.cjs"),I=require("./pkt-options-controller-DjBCEHU4.cjs"),w=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-rgXsRNkk.cjs");require("./icon-Dl9ZPqe6.cjs");require("./tag-BfjOlIyS.cjs");require("./listbox-C_0RhGhk.cjs");const C={displayValueAs:{default:"label"}},R={props:C};var V=Object.defineProperty,A=Object.getOwnPropertyDescriptor,n=(v,t,e,i)=>{for(var s=i>1?void 0:i?A(t,e):t,a=v.length-1,l;a>=0;a--)(l=v[a])&&(s=(i?l(t,e,s):l(s))||s);return i&&s&&V(t,e,s),s};exports.PktCombobox=class extends $.PktInputElement{constructor(){super(),this.helptextSlot=r.e(),this.value="",this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder="",this.multiple=!1,this.maxlength=null,this.displayValueAs=R.props.displayValueAs.default,this.tagPlacement=null,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage="",this._addValueText=null,this._maxIsReached=!1,this._search="",this._inputFocus=!1,this._editingSingleValue=!1,this.inputRef=r.e(),this.arrowRef=r.e(),this.listboxRef=r.e(),this.focusRef=r.e(),this.optionTagRef=r.e(),this.optionsController=new I.PktOptionsSlotController(this),this.slotController=new w.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){var t,e;if(super.connectedCallback(),document&&document.body.addEventListener("click",i=>{this._isOptionsOpen&&!this.contains(i.target)&&this.handleFocusOut(i)}),this._options=[],this.defaultOptions&&this.defaultOptions.length){const i=((t=this.options)==null?void 0:t.filter(s=>s.userAdded))||[];this.options=[...i,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if((e=this.optionsController)!=null&&e.nodes&&this.optionsController.nodes.length){const i=[];this.optionsController.nodes.forEach(s=>{if(!s.textContent&&!s.getAttribute("value"))return null;const a={value:s.getAttribute("value")||s.textContent||"",label:s.textContent||s.getAttribute("value")||""};s.getAttribute("data-prefix")&&(a.prefix=s.getAttribute("data-prefix")||void 0),s.getAttribute("tagskincolor")&&(a.tagSkinColor=s.getAttribute("tagskincolor")),s.getAttribute("description")&&(a.description=s.getAttribute("description")||void 0),a.fulltext=a.value+a.label+(a.prefix||""),i.push(a)}),i.length&&(this.options=[...i],this._options=[...i])}}updated(t){if(t.has("_value")&&this.valueChanged(this._value,t.get("_value")),t.has("value")&&(Array.isArray(this.value)?this._value=this.value:this.value&&this.multiple?this._value=this.value.split(","):this.value?this._value=[this.value]:this._value=[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]]),this.isMaxItemsReached()),t.has("defaultOptions")&&this.defaultOptions.length){const e=(Array.isArray(this.options)?this.options:[]).filter(i=>i.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(t.has("options")){const s=(t.get("options")||this._options||[]).filter(l=>l&&l.userAdded).filter(l=>!(Array.isArray(this.options)?this.options:[]).some(h=>h.value===l.value)),a=[...s,...this.options];this._options=a,s.length>0&&(this.options=a),this._options.forEach(l=>{if(l.value&&!l.label&&(l.label=l.value),l.selected&&!this._value.includes(l.value)){const h=[...this._value];this._value=[...this._value,l.value],this.valueChanged(this._value,h)}l.fulltext=l.value+l.label+(l.prefix||""),l.selected=l.selected||this._value.includes(l.value)})}t.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),super.updated(t)}attributeChangedCallback(t,e,i){t==="value"&&(Array.isArray(this.value)?this._value=this.value:this.value&&this.multiple?this._value=this.value.split(","):this.value?this._value=[this.value]:this._value=[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]])),t==="options"&&(this._options=Array.isArray(this.options)?[...this.options]:[],this._options.forEach(s=>{s.value&&!s.label&&(s.label=s.value),s.selected&&!this._value.includes(s.value)&&(this._value=[...this._value,s.value]),s.fulltext=s.value+s.label+(s.prefix||"")}),this._search=""),super.attributeChangedCallback(t,e,i)}render(){return o.x`
2
2
  <pkt-input-wrapper
3
3
  .label=${this.label}
4
4
  .helptext=${this.helptext}
@@ -26,9 +26,9 @@
26
26
  tabindex="-1"
27
27
  @click=${this.handleInputClick}
28
28
  >
29
- ${this.placeholder&&(!this._value.length||this.multiple&&this.tagPlacement=="outside")&&!this._inputFocus?a.x`<span class="pkt-combobox__placeholder" @click=${this.handlePlaceholderClick}
29
+ ${this.placeholder&&(!this._value.length||this.multiple&&this.tagPlacement=="outside")&&!this._inputFocus?o.x`<span class="pkt-combobox__placeholder" @click=${this.handlePlaceholderClick}
30
30
  >${this.placeholder}</span
31
- >`:this.tagPlacement!=="outside"?this.renderSingleOrMultipleValues():a.E}
31
+ >`:this.tagPlacement!=="outside"?this.renderSingleOrMultipleValues():o.E}
32
32
  ${this.renderInputField()}
33
33
  <div
34
34
  class="pkt-btn pkt-btn--tertiary pkt-combobox__arrow"
@@ -80,11 +80,11 @@
80
80
  ></pkt-listbox>
81
81
  </div>
82
82
 
83
- ${this.tagPlacement==="outside"&&this.multiple?a.x`<div class="pkt-combobox__tags-outside">
83
+ ${this.tagPlacement==="outside"&&this.multiple?o.x`<div class="pkt-combobox__tags-outside">
84
84
  ${this.renderSingleOrMultipleValues()}
85
- </div>`:a.E}
85
+ </div>`:o.E}
86
86
  </pkt-input-wrapper>
87
- `}renderInputField(){return this.typeahead||this.allowUserInput?a.x`
87
+ `}renderInputField(){return this.typeahead||this.allowUserInput?o.x`
88
88
  <div class="pkt-combobox__input-div combobox__input">
89
89
  <input
90
90
  type="text"
@@ -104,7 +104,7 @@
104
104
  ${r.n(this.inputRef)}
105
105
  />
106
106
  </div>
107
- `:a.x`
107
+ `:o.x`
108
108
  <input
109
109
  type="hidden"
110
110
  id="${this.id}-input"
@@ -112,18 +112,18 @@
112
112
  .value=${this._value.join(",")}
113
113
  ${r.n(this.inputRef)}
114
114
  />
115
- `}renderSingleOrMultipleValues(){const t=!this.multiple,e=this._editingSingleValue?null:this.renderValueTag(this.findValueInOptions(this._value[0])),i=O.c(this._value,s=>s,s=>{var o;const n=this.findValueInOptions(s),l=(o=this.options.find(u=>u.value===s))==null?void 0:o.tagSkinColor;return a.x`
115
+ `}renderSingleOrMultipleValues(){const t=!this.multiple,e=this._editingSingleValue?null:this.renderValueTag(this.findValueInOptions(this._value[0])),i=O.c(this._value,s=>s,s=>{var h;const a=this.findValueInOptions(s),l=(h=this.options.find(u=>u.value===s))==null?void 0:h.tagSkinColor;return o.x`
116
116
  <pkt-tag
117
117
  skin=${l||"blue-dark"}
118
118
  ?closeTag=${!this.disabled}
119
119
  @close=${()=>this.handleTagRemove(s)}
120
120
  >
121
- ${this.renderValueTag(n)}
121
+ ${this.renderValueTag(a)}
122
122
  </pkt-tag>
123
- `});return t?e:i}renderValueTag(t){if(!t)return"";switch(this.displayValueAs){case"prefixAndValue":return a.x`<span class="pkt-combobox__value" data-focusfix=${this.id}
123
+ `});return t?e:i}renderValueTag(t){if(!t)return"";switch(this.displayValueAs){case"prefixAndValue":return o.x`<span class="pkt-combobox__value" data-focusfix=${this.id}
124
124
  >${t.prefix||""} ${t.value}</span
125
- >`;case"value":return a.x`<span class="pkt-combobox__value" data-focusfix=${this.id}
125
+ >`;case"value":return o.x`<span class="pkt-combobox__value" data-focusfix=${this.id}
126
126
  >${t.value}</span
127
- >`;case"label":default:return a.x`<span class="pkt-combobox__value" data-focusfix=${this.id}
127
+ >`;case"label":default:return o.x`<span class="pkt-combobox__value" data-focusfix=${this.id}
128
128
  >${t.label||t.value}</span
129
- >`}}handleInput(t){if(t.stopPropagation(),t.stopImmediatePropagation(),this.disabled)return;this.touched=!0;const e=t.target;if(this._search=e.value,this.checkForMatches(),this.typeahead)if(this._search){if(this._options=this.options.filter(i=>{var s;return(s=i.fulltext)==null?void 0:s.toLowerCase().includes(this._search.toLowerCase())}),t.inputType!=="deleteContentBackward"){const i=this._options.filter(s=>{var n;return!s.selected&&((n=s.label)==null?void 0:n.toLowerCase().startsWith(this._search.toLowerCase()))});if(i.length>0&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const s=i[0];s!=null&&s.label&&(e.value=s.label,window.setTimeout(()=>e.setSelectionRange(this._search.length,e.value.length),0),e.selectionDirection="backward")}}}else this._options=[...this.options]}handleFocus(){if(!this.disabled){if(!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const t=this.findValueInOptions(this._value[0]);this._editingSingleValue=!0,this.inputRef.value.value=this.displayValueAs==="label"&&(t!=null&&t.label)?t.label:this._value[0]}this._inputFocus=!0,this._search="",this._options=[...this.options],this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleFocusOut(t){var e,i,s,n,l;if(!this.disabled&&((i=(e=t.relatedTarget)==null?void 0:e.closest("pkt-combobox"))==null?void 0:i.id)!==this.id&&((n=(s=t.relatedTarget)==null?void 0:s.closest("pkt-combobox"))==null?void 0:n.id)!==this.id&&((l=t.target)==null?void 0:l.getAttribute("data-focusfix"))!==this.id&&t.relatedTarget!==this.focusRef.value&&t.relatedTarget!==this.inputRef.value&&t.relatedTarget!==this.arrowRef.value&&this._isOptionsOpen){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage="",this._search="",this.inputRef.value&&this.inputRef.value.type!=="hidden"&&this.inputRef.value.value!==""){const o=this.inputRef.value.value,u=this.findValueInOptions(o);!this._value.includes(o)&&!u?this.allowUserInput?this.addNewUserValue(o):this.multiple||this.removeValue(this._value[0]):u&&!this._value.includes(u.value)&&this.setSelected(u.value),this.inputRef.value.value=""}this._isOptionsOpen=!1,this.onBlur()}}handleBlur(){this._inputFocus=!1,this._editingSingleValue=!1,this.onBlur()}handleInputClick(t){var e,i;if(this.disabled){t.preventDefault(),t.stopImmediatePropagation();return}t.currentTarget&&t.currentTarget!==this.arrowRef.value&&((e=this.inputRef.value)==null?void 0:e.type)!=="hidden"?((i=this.inputRef.value)==null||i.focus(),this.requestUpdate()):this.handleArrowClick(t)}handlePlaceholderClick(t){this.disabled||(t.stopPropagation(),this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()))}handleArrowClick(t){var e,i;this.disabled||t instanceof KeyboardEvent&&t.key&&t.key!=="Enter"&&t.key!==" "&&t.key!=="ArrowDown"||(t.stopImmediatePropagation(),t.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen?(e=this.listboxRef.value)==null||e.focusFirstOrSelectedOption():(i=this.arrowRef.value)==null||i.focus())}handleOptionToggled(t){this.toggleValue(t.detail)}handleSearch(t){t.stopPropagation(),this._search=t.detail.toLowerCase()}handleInputKeydown(t){var e,i,s;switch(t.key){case",":this.multiple&&(t.preventDefault(),this.addValue());break;case"Enter":t.preventDefault(),this.addValue();break;case"Backspace":!this._search&&((e=this.inputRef.value)==null?void 0:e.type)==="hidden"&&this.removeLastValue(t);break;case"Tab":case"ArrowDown":t.shiftKey||((i=this.listboxRef.value)==null||i.focusFirstOrSelectedOption(),t.preventDefault());break;case"Escape":this._isOptionsOpen=!1,(s=this.arrowRef.value)==null||s.focus(),t.preventDefault();break}}handleTagRemove(t){this.removeSelected(t)}blurInput(){this.inputRef.value&&this.inputRef.value.matches(":focus")&&this.inputRef.value.blur()}checkForMatches(){var l;const t=((l=this.inputRef.value)==null?void 0:l.value)||this._search||"",e=t.trim().toLowerCase()||"";if(!e){!this.multiple&&this._value[0]&&this.removeValue(this._value[0]),this.resetComboboxInput(!1);return}const i=this._value.find(o=>o.toLowerCase()===e),s=this._options.filter(o=>{var u;return((u=o.label)==null?void 0:u.toLowerCase().includes(e))??!1}),n=s.find(o=>{var u;return((u=o.label)==null?void 0:u.toLowerCase())===e||o.value.toLowerCase()===e});switch(!0){case((s.length===0||!n)&&this.allowUserInput):this._addValueText=t,this._userInfoMessage="";break;case(s.length===0&&!this._options.length&&!this.allowUserInput):this._addValueText=null,this._userInfoMessage="Ingen match i søket";break;case!!i:this._addValueText=null,this._userInfoMessage="Verdien er allerede valgt";break;case s.length>1:this._addValueText=null,this._userInfoMessage="";break;default:this._addValueText=null,this._userInfoMessage=""}}findValueInOptions(t){return this.options.find(e=>e.value===t||e.label===t)||null}findIndexInOptions(t){return this._options.findIndex(e=>e.value===t||e.label===t)}isMaxItemsReached(){const t=this.maxlength!==null&&this._value.length>=this.maxlength;return t?this._maxIsReached=!0:this._maxIsReached=!1,t}toggleValue(t){var g,k;if(this.disabled)return;this.touched=!0,this._userInfoMessage="",this._addValueText=null;const e=((g=this.findValueInOptions(t))==null?void 0:g.value)||null,i=this._value.includes(t||e||""),s=!!e,n=((k=this._options.find(_=>_.value===t))==null?void 0:k.disabled)||!1,l=!(t!=null&&t.trim()),o=!this.multiple,u=this.multiple,x=this.isMaxItemsReached();let p=!1,f=!0,b="",m="";n||(!s&&this.allowUserInput&&!l?(this.addNewUserValue(t),b="Ny verdi lagt til",p=!u):!s&&!this.allowUserInput?(o&&this._value[0]&&this.removeValue(this._value[0]),f=!1,p=!0,b="Ingen treff i søket"):i?(this.removeValue(e),p=!0):l&&o?(this.removeAllSelected(),p=!0):o?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(e),p=!1,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value="",this.inputRef.value.blur())):u&&!x?(this.setSelected(e),p=!0):u&&x?(this._userInfoMessage="Maks antall valg nådd",f=!1,m=t):(o&&this.removeAllSelected(),this._userInfoMessage="Ingen gyldig verdi valgt",f=!1,p=!0,m=t),this._isOptionsOpen=p,p||window.setTimeout(()=>{var _;(_=this.focusRef.value)==null||_.focus()},0),this._userInfoMessage=b,this._search=m||"",this.resetComboboxInput(f),u&&this.isMaxItemsReached())}setSelected(t){if(!this._value.includes(t)){if(this.multiple&&this.isMaxItemsReached()){this._userInfoMessage="Maks antall valg nådd";return}!this.multiple&&this.removeAllSelected(),this._value=t?[...this._value,t]:this._value,this._options=this._options.map(e=>(e.value===t&&(e.selected=!0),e)),this.resetComboboxInput(!0)}}removeSelected(t){if(!t)return;this._value=this._value.filter(i=>i!==t);const e=this.findValueInOptions(t);e?(e.selected=!1,e.userAdded?(this._options=[...this._options.filter(i=>i.value!==t)],this.options=[...this.options.filter(i=>i.value!==t)]):this._options=[...this._options,e]):!t&&!this.multiple&&(this._options=this._options.map(i=>(i.selected=!1,i)))}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage="For mange valgt";return}this._value=this._options.map(t=>t.value),this._options=this._options.map(t=>(t.selected=!0,t)),this.requestUpdate()}}removeAllSelected(){this._value=[],this._options=this._options.map(t=>(t.selected=!1,t)),this._options=this._options.filter(t=>!t.userAdded),this.requestUpdate()}addValue(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value.trim())||"";this._search=t,this.toggleValue(t)}removeValue(t){this._value=this.multiple?this._value.filter(e=>e!==t):[],this.removeSelected(t)}addNewUserValue(t){if(!t||t.trim()==="")return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[t],this._isOptionsOpen=!1,this.blurInput();else if(!this.findValueInOptions(t)){if(this.isMaxItemsReached())return;this._value=[...this._value,t]}const e={value:t,label:t,userAdded:!0};this.options=[e,...this.options],this._options=[e,...this._options],this.setSelected(t),this.requestUpdate()}resetComboboxInput(t=!0){if(this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&t)if(this._search="",this.multiple)this.inputRef.value.value="";else{const e=this.findValueInOptions(this._value[0]);window.setTimeout(()=>{!this.inputRef.value||this.inputRef.value.type==="hidden"||(this.inputRef.value.value=this.displayValueAs==="label"&&(e!=null&&e.label)?e.label:this._value[0]||"")},0),this._userInfoMessage=""}this._options=[...this.options]}removeLastValue(t){if(this._value.length===0)return;t.preventDefault();const e=this._value[this._value.length-1];e&&this.removeSelected(e),this.isMaxItemsReached()}};h([a.n({type:String,reflect:!0})],exports.PktCombobox.prototype,"value",2);h([a.n({type:Array})],exports.PktCombobox.prototype,"options",2);h([a.n({type:Array})],exports.PktCombobox.prototype,"defaultOptions",2);h([a.n({type:Boolean})],exports.PktCombobox.prototype,"allowUserInput",2);h([a.n({type:Boolean})],exports.PktCombobox.prototype,"typeahead",2);h([a.n({type:Boolean})],exports.PktCombobox.prototype,"includeSearch",2);h([a.n({type:String})],exports.PktCombobox.prototype,"searchPlaceholder",2);h([a.n({type:Boolean})],exports.PktCombobox.prototype,"multiple",2);h([a.n({type:Number})],exports.PktCombobox.prototype,"maxlength",2);h([a.n({type:String})],exports.PktCombobox.prototype,"displayValueAs",2);h([a.n({type:String})],exports.PktCombobox.prototype,"tagPlacement",2);h([d.r()],exports.PktCombobox.prototype,"_options",2);h([d.r()],exports.PktCombobox.prototype,"_isOptionsOpen",2);h([d.r()],exports.PktCombobox.prototype,"_value",2);h([d.r()],exports.PktCombobox.prototype,"_userInfoMessage",2);h([d.r()],exports.PktCombobox.prototype,"_addValueText",2);h([d.r()],exports.PktCombobox.prototype,"_maxIsReached",2);h([d.r()],exports.PktCombobox.prototype,"_search",2);h([d.r()],exports.PktCombobox.prototype,"_inputFocus",2);h([d.r()],exports.PktCombobox.prototype,"_editingSingleValue",2);exports.PktCombobox=h([a.t("pkt-combobox")],exports.PktCombobox);
129
+ >`}}handleInput(t){if(t.stopPropagation(),t.stopImmediatePropagation(),this.disabled)return;this.touched=!0;const e=t.target;if(this._search=e.value,this.checkForMatches(),this.typeahead)if(this._search){if(this._options=this.options.filter(i=>{var s;return(s=i.fulltext)==null?void 0:s.toLowerCase().includes(this._search.toLowerCase())}),t.inputType!=="deleteContentBackward"){const i=this._options.filter(s=>{var a;return!s.selected&&((a=s.label)==null?void 0:a.toLowerCase().startsWith(this._search.toLowerCase()))});if(i.length>0&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const s=i[0];s!=null&&s.label&&(e.value=s.label,window.setTimeout(()=>e.setSelectionRange(this._search.length,e.value.length),0),e.selectionDirection="backward")}}}else this._options=[...this.options]}handleFocus(){if(!this.disabled){if(!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const t=this.findValueInOptions(this._value[0]);this._editingSingleValue=!0,this.inputRef.value.value=this.displayValueAs==="label"&&(t!=null&&t.label)?t.label:this._value[0]}this._inputFocus=!0,this._search="",this._options=[...this.options],this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleFocusOut(t){var e,i,s,a,l;if(!this.disabled&&((i=(e=t.relatedTarget)==null?void 0:e.closest("pkt-combobox"))==null?void 0:i.id)!==this.id&&((a=(s=t.relatedTarget)==null?void 0:s.closest("pkt-combobox"))==null?void 0:a.id)!==this.id&&((l=t.target)==null?void 0:l.getAttribute("data-focusfix"))!==this.id&&t.relatedTarget!==this.focusRef.value&&t.relatedTarget!==this.inputRef.value&&t.relatedTarget!==this.arrowRef.value&&this._isOptionsOpen){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage="",this._search="",this.inputRef.value&&this.inputRef.value.type!=="hidden"&&this.inputRef.value.value!==""){const h=this.inputRef.value.value,u=this.findValueInOptions(h);!this._value.includes(h)&&!u?this.allowUserInput?this.addNewUserValue(h):this.multiple||this.removeValue(this._value[0]):u&&!this._value.includes(u.value)&&this.setSelected(u.value),this.inputRef.value.value=""}this._isOptionsOpen=!1,this.onBlur()}}handleBlur(){this._inputFocus=!1,this._editingSingleValue=!1,this.onBlur()}handleInputClick(t){var e,i;if(this.disabled){t.preventDefault(),t.stopImmediatePropagation();return}t.currentTarget&&t.currentTarget!==this.arrowRef.value&&((e=this.inputRef.value)==null?void 0:e.type)!=="hidden"?((i=this.inputRef.value)==null||i.focus(),this.requestUpdate()):this.handleArrowClick(t)}handlePlaceholderClick(t){this.disabled||(t.stopPropagation(),this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()))}handleArrowClick(t){var e,i;this.disabled||t instanceof KeyboardEvent&&t.key&&t.key!=="Enter"&&t.key!==" "&&t.key!=="ArrowDown"||(t.stopImmediatePropagation(),t.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen?(e=this.listboxRef.value)==null||e.focusFirstOrSelectedOption():(i=this.arrowRef.value)==null||i.focus())}handleOptionToggled(t){this.toggleValue(t.detail)}handleSearch(t){t.stopPropagation(),this._search=t.detail.toLowerCase()}handleInputKeydown(t){var e,i,s;switch(t.key){case",":this.multiple&&(t.preventDefault(),this.addValue());break;case"Enter":t.preventDefault(),this.addValue();break;case"Backspace":!this._search&&((e=this.inputRef.value)==null?void 0:e.type)==="hidden"&&this.removeLastValue(t);break;case"Tab":case"ArrowDown":t.shiftKey||((i=this.listboxRef.value)==null||i.focusFirstOrSelectedOption(),t.preventDefault());break;case"Escape":this._isOptionsOpen=!1,(s=this.arrowRef.value)==null||s.focus(),t.preventDefault();break}}handleTagRemove(t){this.removeSelected(t)}blurInput(){this.inputRef.value&&this.inputRef.value.matches(":focus")&&this.inputRef.value.blur()}checkForMatches(){var l;const t=((l=this.inputRef.value)==null?void 0:l.value)||this._search||"",e=t.trim().toLowerCase()||"";if(!e){!this.multiple&&this._value[0]&&this.removeValue(this._value[0]),this.resetComboboxInput(!1);return}const i=this._value.find(h=>h.toLowerCase()===e),s=this._options.filter(h=>{var u;return((u=h.label)==null?void 0:u.toLowerCase().includes(e))??!1}),a=s.find(h=>{var u;return((u=h.label)==null?void 0:u.toLowerCase())===e||h.value.toLowerCase()===e});switch(!0){case((s.length===0||!a)&&this.allowUserInput):this._addValueText=t,this._userInfoMessage="";break;case(s.length===0&&!this._options.length&&!this.allowUserInput):this._addValueText=null,this._userInfoMessage="Ingen match i søket";break;case!!i:this._addValueText=null,this._userInfoMessage="Verdien er allerede valgt";break;case s.length>1:this._addValueText=null,this._userInfoMessage="";break;default:this._addValueText=null,this._userInfoMessage=""}}findValueInOptions(t){return this.options.find(e=>e.value===t||e.label===t)||null}findIndexInOptions(t){return this._options.findIndex(e=>e.value===t||e.label===t)}isMaxItemsReached(){const t=this.maxlength!==null&&this._value.length>=this.maxlength;return t?this._maxIsReached=!0:this._maxIsReached=!1,t}toggleValue(t){var g,k;if(this.disabled)return;this.touched=!0,this._userInfoMessage="",this._addValueText=null;const e=((g=this.findValueInOptions(t))==null?void 0:g.value)||null,i=this._value.includes(t||e||""),s=!!e,a=((k=this._options.find(_=>_.value===t))==null?void 0:k.disabled)||!1,l=!(t!=null&&t.trim()),h=!this.multiple,u=this.multiple,x=this.isMaxItemsReached();let p=!1,f=!0,b="",m="";a||(!s&&this.allowUserInput&&!l?(this.addNewUserValue(t),b="Ny verdi lagt til",p=!u):!s&&!this.allowUserInput?(h&&this._value[0]&&this.removeValue(this._value[0]),f=!1,p=!0,b="Ingen treff i søket"):i?(this.removeValue(e),p=!0):l&&h?(this.removeAllSelected(),p=!0):h?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(e),p=!1,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value="",this.inputRef.value.blur())):u&&!x?(this.setSelected(e),p=!0):u&&x?(this._userInfoMessage="Maks antall valg nådd",f=!1,m=t):(h&&this.removeAllSelected(),this._userInfoMessage="Ingen gyldig verdi valgt",f=!1,p=!0,m=t),this._isOptionsOpen=p,p||window.setTimeout(()=>{var _;(_=this.focusRef.value)==null||_.focus()},0),this._userInfoMessage=b,this._search=m||"",this.resetComboboxInput(f),u&&this.isMaxItemsReached())}setSelected(t){if(!this._value.includes(t)){if(this.multiple&&this.isMaxItemsReached()){this._userInfoMessage="Maks antall valg nådd";return}!this.multiple&&this.removeAllSelected(),this._value=t?[...this._value,t]:this._value,this._options=this._options.map(e=>(e.value===t&&(e.selected=!0),e)),this.resetComboboxInput(!0)}}removeSelected(t){if(!t)return;this._value=this._value.filter(i=>i!==t);const e=this.findValueInOptions(t);e?(e.selected=!1,e.userAdded?(this._options=[...this._options.filter(i=>i.value!==t)],this.options=[...this.options.filter(i=>i.value!==t)]):this._options=[...this._options,e]):!t&&!this.multiple&&(this._options=this._options.map(i=>(i.selected=!1,i)))}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage="For mange valgt";return}this._value=this._options.map(t=>t.value),this._options=this._options.map(t=>(t.selected=!0,t)),this.requestUpdate()}}removeAllSelected(){this._value=[],this._options=this._options.map(t=>(t.selected=!1,t)),this._options=this._options.filter(t=>!t.userAdded),this.requestUpdate()}addValue(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value.trim())||"";this._search=t,this.toggleValue(t)}removeValue(t){this._value=this.multiple?this._value.filter(e=>e!==t):[],this.removeSelected(t)}addNewUserValue(t){if(!t||t.trim()==="")return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[t],this._isOptionsOpen=!1,this.blurInput();else if(!this.findValueInOptions(t)){if(this.isMaxItemsReached())return;this._value=[...this._value,t]}const e={value:t,label:t,userAdded:!0};this.options=[e,...this.options],this._options=[e,...this._options],this.setSelected(t),this.requestUpdate()}resetComboboxInput(t=!0){if(this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&t)if(this._search="",this.multiple)this.inputRef.value.value="";else{const e=this.findValueInOptions(this._value[0]);window.setTimeout(()=>{!this.inputRef.value||this.inputRef.value.type==="hidden"||(this.inputRef.value.value=this.displayValueAs==="label"&&(e!=null&&e.label)?e.label:this._value[0]||"")},0),this._userInfoMessage=""}this._options=[...this.options]}removeLastValue(t){if(this._value.length===0)return;t.preventDefault();const e=this._value[this._value.length-1];e&&this.removeSelected(e),this.isMaxItemsReached()}};n([o.n({type:String,reflect:!0})],exports.PktCombobox.prototype,"value",2);n([o.n({type:Array})],exports.PktCombobox.prototype,"options",2);n([o.n({type:Array})],exports.PktCombobox.prototype,"defaultOptions",2);n([o.n({type:Boolean})],exports.PktCombobox.prototype,"allowUserInput",2);n([o.n({type:Boolean})],exports.PktCombobox.prototype,"typeahead",2);n([o.n({type:Boolean})],exports.PktCombobox.prototype,"includeSearch",2);n([o.n({type:String})],exports.PktCombobox.prototype,"searchPlaceholder",2);n([o.n({type:Boolean})],exports.PktCombobox.prototype,"multiple",2);n([o.n({type:Number})],exports.PktCombobox.prototype,"maxlength",2);n([o.n({type:String})],exports.PktCombobox.prototype,"displayValueAs",2);n([o.n({type:String})],exports.PktCombobox.prototype,"tagPlacement",2);n([d.r()],exports.PktCombobox.prototype,"_options",2);n([d.r()],exports.PktCombobox.prototype,"_value",2);n([d.r()],exports.PktCombobox.prototype,"_isOptionsOpen",2);n([d.r()],exports.PktCombobox.prototype,"_userInfoMessage",2);n([d.r()],exports.PktCombobox.prototype,"_addValueText",2);n([d.r()],exports.PktCombobox.prototype,"_maxIsReached",2);n([d.r()],exports.PktCombobox.prototype,"_search",2);n([d.r()],exports.PktCombobox.prototype,"_inputFocus",2);n([d.r()],exports.PktCombobox.prototype,"_editingSingleValue",2);exports.PktCombobox=n([o.t("pkt-combobox")],exports.PktCombobox);
@@ -1,4 +1,4 @@
1
- "use strict";const o=require("./element-CJ_QKaki.cjs");require("./button-DaM4jvhJ.cjs");require("./icon-MRx-m0Or.cjs");const k={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"}}}}};var d=Object.defineProperty,p=Object.getOwnPropertyDescriptor,s=(r,e,t,n)=>{for(var i=n>1?void 0:n?p(e,t):e,a=r.length-1,l;a>=0;a--)(l=r[a])&&(i=(n?l(e,t,i):l(i))||i);return n&&i&&d(e,t,i),i};let c=null;function u(){return c||(c=new Promise((r,e)=>{if(document.querySelector("#oslo-consent-script")){r();return}const t=document.createElement("script");t.src="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js",t.id="oslo-consent-script",t.onload=()=>r(),t.onerror=e,document.head.appendChild(t);const n=document.createElement("link");n.href="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css",n.type="text/css",n.rel="stylesheet",n.id="oslo-consent-styles",document.head.appendChild(n)}),c)}exports.PktConsent=class extends o.PktElement{constructor(){super(),this.devMode=!1,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType="button",this.triggerText=null,this.i18nLanguage="nb"}connectedCallback(){super.connectedCallback(),this.triggerText=this.triggerText||k.i18n[this.i18nLanguage].contentPresentation.buttons.settings}disconnectedCallback(){var e;super.disconnectedCallback(),this._cookieEventHandler&&((e=window.__cookieEvents)==null||e.off("CookieManager.setCookie",this._cookieEventHandler))}returnJsonOrObject(e){let t;try{t=JSON.parse(e)}catch{t=e}return t}emitCookieConsents(e){const n=this.returnJsonOrObject(e.value).items.reduce((i,a)=>(i[a.name]=a.consent,i),{});this.dispatchEvent(new CustomEvent("toggle-consent",{detail:n,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 u(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event("CookieBannerReady",{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(e=>{if(e){const n={value:window.cookieBanner.cookieConsent.getConsentCookie()};window.setTimeout(()=>this.emitCookieConsents(n),0),this._cookieEventHandler&&window.__cookieEvents.off("CookieManager.setCookie",this._cookieEventHandler),this._cookieEventHandler=i=>{this.emitCookieConsents(i)},window.__cookieEvents.on("CookieManager.setCookie",this._cookieEventHandler)}})}openModal(e){var t;e.preventDefault(),(t=window.cookieBanner)!=null&&t.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType==="link"?o.x`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType==="footerlink"?o.x`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
1
+ "use strict";const o=require("./element-aUzIoa1s.cjs");require("./button-R4l10Nqd.cjs");require("./icon-Dl9ZPqe6.cjs");const k={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"}}}}};var d=Object.defineProperty,p=Object.getOwnPropertyDescriptor,s=(r,e,t,n)=>{for(var i=n>1?void 0:n?p(e,t):e,a=r.length-1,l;a>=0;a--)(l=r[a])&&(i=(n?l(e,t,i):l(i))||i);return n&&i&&d(e,t,i),i};let c=null;function u(){return c||(c=new Promise((r,e)=>{if(document.querySelector("#oslo-consent-script")){r();return}const t=document.createElement("script");t.src="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js",t.id="oslo-consent-script",t.onload=()=>r(),t.onerror=e,document.head.appendChild(t);const n=document.createElement("link");n.href="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css",n.type="text/css",n.rel="stylesheet",n.id="oslo-consent-styles",document.head.appendChild(n)}),c)}exports.PktConsent=class extends o.PktElement{constructor(){super(),this.devMode=!1,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType="button",this.triggerText=null,this.i18nLanguage="nb"}connectedCallback(){super.connectedCallback(),this.triggerText=this.triggerText||k.i18n[this.i18nLanguage].contentPresentation.buttons.settings}disconnectedCallback(){var e;super.disconnectedCallback(),this._cookieEventHandler&&((e=window.__cookieEvents)==null||e.off("CookieManager.setCookie",this._cookieEventHandler))}returnJsonOrObject(e){let t;try{t=JSON.parse(e)}catch{t=e}return t}emitCookieConsents(e){const n=this.returnJsonOrObject(e.value).items.reduce((i,a)=>(i[a.name]=a.consent,i),{});this.dispatchEvent(new CustomEvent("toggle-consent",{detail:n,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 u(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event("CookieBannerReady",{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(e=>{if(e){const n={value:window.cookieBanner.cookieConsent.getConsentCookie()};window.setTimeout(()=>this.emitCookieConsents(n),0),this._cookieEventHandler&&window.__cookieEvents.off("CookieManager.setCookie",this._cookieEventHandler),this._cookieEventHandler=i=>{this.emitCookieConsents(i)},window.__cookieEvents.on("CookieManager.setCookie",this._cookieEventHandler)}})}openModal(e){var t;e.preventDefault(),(t=window.cookieBanner)!=null&&t.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType==="link"?o.x`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType==="footerlink"?o.x`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
2
2
  <pkt-icon name="chevron-right" class="pkt-footer__link-icon"></pkt-icon>
3
3
  ${this.triggerText}
4
4
  </a>`:this.triggerType==="icon"?o.x`<pkt-button
@@ -1,6 +1,6 @@
1
- import { P as p, x as c, n as a, a as g } from "./element-CRDRygXu.js";
2
- import "./button-CjXih_Nx.js";
3
- import "./icon-BB7e5iQN.js";
1
+ import { P as p, x as c, n as a, t as g } from "./element-BXsf_NlG.js";
2
+ import "./button-f36menSU.js";
3
+ import "./icon-BgG6oO4Q.js";
4
4
  const u = {
5
5
  i18n: {
6
6
  nb: {