@oslokommune/punkt-elements 16.7.3 → 16.7.4

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 (248) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/accordion-BB1JrONI.cjs +34 -0
  3. package/dist/accordion-nNH87Y60.js +130 -0
  4. package/dist/alert-BEEnTiCb.cjs +33 -0
  5. package/dist/alert-ePJuDtmm.js +171 -0
  6. package/dist/async-directive-B9P1Qa0k.cjs +1 -0
  7. package/dist/async-directive-CaQiqjyV.js +55 -0
  8. package/dist/backlink-Ba03LlbB.cjs +13 -0
  9. package/dist/backlink-CiwXrQYD.js +38 -0
  10. package/dist/booleanish-BmcOU-43.js +11 -0
  11. package/dist/booleanish-jJLlnr6-.cjs +1 -0
  12. package/dist/breadcrumbs-CD1zib3s.cjs +43 -0
  13. package/dist/breadcrumbs-CpuVqWhF.js +76 -0
  14. package/dist/button-BIpd1xJh.js +95 -0
  15. package/dist/button-D-TOBaJB.cjs +27 -0
  16. package/dist/calendar-BzEtOJla.js +2031 -0
  17. package/dist/calendar-E5jJLt8D.cjs +90 -0
  18. package/dist/card-BYJu1MYm.js +339 -0
  19. package/dist/card-CUFhMVim.cjs +87 -0
  20. package/dist/checkbox-BARDb9iV.cjs +31 -0
  21. package/dist/checkbox-Cspxcvt_.js +111 -0
  22. package/dist/class-map-C8HuhNzZ.js +27 -0
  23. package/dist/class-map-CJ-msbHs.cjs +1 -0
  24. package/dist/classutils-DEL164Ur.js +7 -0
  25. package/dist/classutils-z8YsPlOf.cjs +1 -0
  26. package/dist/combobox-BcdLZRDU.js +984 -0
  27. package/dist/combobox-CGbFTWq_.cjs +135 -0
  28. package/dist/consent-DeB_5sWH.js +197 -0
  29. package/dist/consent-hwu7pp3S.cjs +11 -0
  30. package/dist/datepicker-DpmlsnH_.cjs +273 -0
  31. package/dist/datepicker-OVd8pmnZ.js +1125 -0
  32. package/dist/dialog-polyfill.esm-1hPr0gl9.js +280 -0
  33. package/dist/dialog-polyfill.esm-D3Oinvk0.cjs +1 -0
  34. package/dist/directive-3THFsVew.js +28 -0
  35. package/dist/directive-CJ2giQBZ.cjs +1 -0
  36. package/dist/directive-helpers-D1QSxY17.cjs +1 -0
  37. package/dist/directive-helpers-Dkv2gKgs.js +25 -0
  38. package/dist/element-DjtxO-1r.cjs +2 -0
  39. package/dist/element-cZ85T_aa.js +693 -0
  40. package/dist/element-with-slot-4J2o3SeU.js +166 -0
  41. package/dist/element-with-slot-CWoTGA1B.cjs +1 -0
  42. package/dist/header-DWgPgGfS.cjs +304 -0
  43. package/dist/header-a6ztVNp3.js +782 -0
  44. package/dist/heading-BgSWIRii.cjs +1 -0
  45. package/dist/heading-DiQLPxdf.js +73 -0
  46. package/dist/helptext-CCBKKLus.js +65 -0
  47. package/dist/helptext-D-3QfZv5.cjs +24 -0
  48. package/dist/icon-Co72KtgF.js +86 -0
  49. package/dist/icon-Dr8sfT2X.cjs +1 -0
  50. package/dist/if-defined-Cjj8qN-Z.js +5 -0
  51. package/dist/if-defined-XKOD_t_V.cjs +1 -0
  52. package/dist/index.d.ts +1 -2
  53. package/dist/input-element-B1yxcfz4.cjs +1 -0
  54. package/dist/input-element-Bw1s6NlF.js +643 -0
  55. package/dist/input-wrapper-BRuVELpK.cjs +54 -0
  56. package/dist/input-wrapper-CDyHTR1V.js +164 -0
  57. package/dist/input-wrapper-Dwd-_sKm.cjs +1 -0
  58. package/dist/input-wrapper-YfTmpSSY.js +117 -0
  59. package/dist/link-CKAFMz9j.js +89 -0
  60. package/dist/link-CyTCpI0k.cjs +7 -0
  61. package/dist/linkcard-B0KOGaGj.js +55 -0
  62. package/dist/linkcard-BE4-FewK.cjs +13 -0
  63. package/dist/listbox-DCA2JoPV.cjs +106 -0
  64. package/dist/listbox-DuBgTFvH.js +397 -0
  65. package/dist/loader-6kFZUErT.js +66 -0
  66. package/dist/loader-CX2rsC01.cjs +16 -0
  67. package/dist/messagebox-Cwlg5sOr.js +110 -0
  68. package/dist/messagebox-Din9X53b.cjs +13 -0
  69. package/dist/modal-C_wtsh9m.js +209 -0
  70. package/dist/modal-DS_wUOIv.cjs +36 -0
  71. package/dist/pkt-accordion.cjs +1 -1
  72. package/dist/pkt-accordion.js +2 -7
  73. package/dist/pkt-alert.cjs +1 -1
  74. package/dist/pkt-alert.js +2 -5
  75. package/dist/pkt-backlink.cjs +1 -1
  76. package/dist/pkt-backlink.js +2 -5
  77. package/dist/pkt-breadcrumbs.cjs +1 -43
  78. package/dist/pkt-breadcrumbs.js +2 -81
  79. package/dist/pkt-button.cjs +1 -1
  80. package/dist/pkt-button.js +2 -5
  81. package/dist/pkt-calendar.cjs +1 -1
  82. package/dist/pkt-calendar.js +2 -5
  83. package/dist/pkt-card.cjs +1 -1
  84. package/dist/pkt-card.js +2 -5
  85. package/dist/pkt-checkbox.cjs +1 -1
  86. package/dist/pkt-checkbox.js +2 -5
  87. package/dist/pkt-combobox.cjs +1 -1
  88. package/dist/pkt-combobox.js +2 -5
  89. package/dist/pkt-consent.cjs +1 -1
  90. package/dist/pkt-consent.js +2 -5
  91. package/dist/pkt-datepicker.cjs +1 -1
  92. package/dist/pkt-datepicker.js +5 -9
  93. package/dist/pkt-header.cjs +1 -304
  94. package/dist/pkt-header.js +2 -861
  95. package/dist/pkt-heading.cjs +1 -1
  96. package/dist/pkt-heading.js +2 -5
  97. package/dist/pkt-helptext.cjs +1 -1
  98. package/dist/pkt-helptext.js +2 -5
  99. package/dist/pkt-icon.cjs +1 -1
  100. package/dist/pkt-icon.js +2 -5
  101. package/dist/pkt-index.cjs +1 -1
  102. package/dist/pkt-index.js +30 -66
  103. package/dist/pkt-input-wrapper.cjs +1 -1
  104. package/dist/pkt-input-wrapper.js +2 -5
  105. package/dist/pkt-link.cjs +1 -1
  106. package/dist/pkt-link.js +2 -5
  107. package/dist/pkt-linkcard.cjs +1 -1
  108. package/dist/pkt-linkcard.js +2 -5
  109. package/dist/pkt-listbox.cjs +1 -1
  110. package/dist/pkt-listbox.js +2 -5
  111. package/dist/pkt-loader.cjs +1 -1
  112. package/dist/pkt-loader.js +2 -5
  113. package/dist/pkt-messagebox.cjs +1 -1
  114. package/dist/pkt-messagebox.js +2 -5
  115. package/dist/pkt-modal.cjs +1 -1
  116. package/dist/pkt-modal.js +2 -5
  117. package/dist/pkt-options-controller-CRrI6WMk.js +43 -0
  118. package/dist/pkt-options-controller-CXUGx134.cjs +1 -0
  119. package/dist/pkt-progressbar.cjs +1 -1
  120. package/dist/pkt-progressbar.js +2 -5
  121. package/dist/pkt-radiobutton.cjs +1 -1
  122. package/dist/pkt-radiobutton.js +2 -5
  123. package/dist/pkt-select.cjs +1 -1
  124. package/dist/pkt-select.js +2 -5
  125. package/dist/pkt-tabs.cjs +1 -1
  126. package/dist/pkt-tabs.js +2 -7
  127. package/dist/pkt-tag.cjs +1 -1
  128. package/dist/pkt-tag.js +2 -5
  129. package/dist/pkt-textarea.cjs +1 -1
  130. package/dist/pkt-textarea.js +2 -5
  131. package/dist/pkt-textinput.cjs +1 -1
  132. package/dist/pkt-textinput.js +2 -5
  133. package/dist/pkt-timepicker.cjs +1 -191
  134. package/dist/pkt-timepicker.js +2 -560
  135. package/dist/progressbar-CdXtmOBb.cjs +17 -0
  136. package/dist/progressbar-Dy9AiYQz.js +113 -0
  137. package/dist/radiobutton-GOnpUbCW.cjs +31 -0
  138. package/dist/radiobutton-V_KPbup_.js +84 -0
  139. package/dist/ref-BaJ0mBT_.cjs +1 -0
  140. package/dist/ref-RS8Uv6uC.js +30 -0
  141. package/dist/repeat-Cepr3469.js +57 -0
  142. package/dist/repeat-CqcDYBxr.cjs +1 -0
  143. package/dist/select-BSAFd8Wa.js +164 -0
  144. package/dist/select-C2i8sOk5.cjs +49 -0
  145. package/dist/tabs-D8nL9rWx.cjs +37 -0
  146. package/dist/tabs-Y7utmJi9.js +318 -0
  147. package/dist/tag-DLthw5b4.cjs +27 -0
  148. package/dist/tag-VwykmuQR.js +179 -0
  149. package/dist/textarea-D7aGOyDf.cjs +46 -0
  150. package/dist/textarea-DYOBhJrN.js +115 -0
  151. package/dist/textinput-BUgntXnM.js +124 -0
  152. package/dist/textinput-DFh8_9cx.cjs +70 -0
  153. package/dist/timepicker-BIfE7KKJ.cjs +191 -0
  154. package/dist/timepicker-DaSwn1FA.js +503 -0
  155. package/dist/utils-CUqCKGvp.js +7 -0
  156. package/dist/utils-CjAbIttF.cjs +1 -0
  157. package/package.json +6 -6
  158. package/src/components/alert/alert.test.ts +1 -1
  159. package/src/components/alert/alert.ts +6 -6
  160. package/src/components/datepicker/datepicker-utils.test.ts +16 -23
  161. package/dist/accordionitem-_9AiCIvd.cjs +0 -34
  162. package/dist/accordionitem-dCfSrxh5.js +0 -140
  163. package/dist/alert-BtOk8yRH.cjs +0 -33
  164. package/dist/alert-DlY2_grU.js +0 -117
  165. package/dist/async-directive-CMzWMlZ5.js +0 -65
  166. package/dist/async-directive-DoMuclel.cjs +0 -5
  167. package/dist/backlink-Ce5Vldop.js +0 -49
  168. package/dist/backlink-y3dwjKPC.cjs +0 -13
  169. package/dist/booleanish-BKVonob4.cjs +0 -1
  170. package/dist/booleanish-C9R0tdXH.js +0 -11
  171. package/dist/button-B_TXwNzt.cjs +0 -27
  172. package/dist/button-BiY-wlKF.js +0 -139
  173. package/dist/calendar-B2pji2zn.cjs +0 -90
  174. package/dist/calendar-DhjQDC4C.js +0 -2140
  175. package/dist/card-BwMNB5Bb.cjs +0 -87
  176. package/dist/card-CGlmcMSR.js +0 -233
  177. package/dist/checkbox-BsJZYA26.js +0 -147
  178. package/dist/checkbox-CTY8f_qn.cjs +0 -31
  179. package/dist/class-map-CEnykyO_.js +0 -34
  180. package/dist/class-map-CsENJXf1.cjs +0 -5
  181. package/dist/classutils-BwNK82ZQ.cjs +0 -1
  182. package/dist/classutils-RQs1k6D9.js +0 -7
  183. package/dist/combobox-DSB5WOxg.js +0 -815
  184. package/dist/combobox-DbICIgKG.cjs +0 -135
  185. package/dist/consent-DkOQpbsg.cjs +0 -11
  186. package/dist/consent-SNWV_mMU.js +0 -175
  187. package/dist/datepicker-BEWl9iz3.cjs +0 -273
  188. package/dist/datepicker-euHyzXnb.js +0 -1170
  189. package/dist/dialog-polyfill.esm-CPKZe7AL.cjs +0 -1
  190. package/dist/dialog-polyfill.esm-CbjBMXAG.js +0 -395
  191. package/dist/directive-C7oCP5Bh.cjs +0 -5
  192. package/dist/directive-helpers-BP2WOx60.cjs +0 -5
  193. package/dist/directive-helpers-rm-28gIj.js +0 -38
  194. package/dist/directive-oAbCiebi.js +0 -27
  195. package/dist/element-CPpT3rFQ.js +0 -638
  196. package/dist/element-gR_VtSiD.cjs +0 -27
  197. package/dist/element-with-slot-Dqk6-TRR.js +0 -240
  198. package/dist/element-with-slot-ZX-up7jO.cjs +0 -1
  199. package/dist/heading-D2tVS6lS.js +0 -103
  200. package/dist/heading-DrzbgDb6.cjs +0 -1
  201. package/dist/helptext-BKtU4mas.js +0 -82
  202. package/dist/helptext-DcRC7wW2.cjs +0 -24
  203. package/dist/icon-CxQcIa5F.js +0 -105
  204. package/dist/icon-q81vqPK_.cjs +0 -9
  205. package/dist/if-defined-B0krMLad.js +0 -10
  206. package/dist/if-defined-BOW3ODSj.cjs +0 -5
  207. package/dist/input-element-8nLwuQS4.js +0 -837
  208. package/dist/input-element-DdVhUvva.cjs +0 -1
  209. package/dist/input-wrapper-Bs4CRNst.js +0 -181
  210. package/dist/input-wrapper-Bv9aqqVq.cjs +0 -54
  211. package/dist/input-wrapper-CDgenrYA.js +0 -6
  212. package/dist/input-wrapper-EoSAbU-U.cjs +0 -1
  213. package/dist/link-C0rl-86s.cjs +0 -7
  214. package/dist/link-Cdqgl60z.js +0 -55
  215. package/dist/linkcard-Dimu7Rlx.cjs +0 -13
  216. package/dist/linkcard-Lbq_UhjZ.js +0 -56
  217. package/dist/listbox-Bia4_tvN.js +0 -440
  218. package/dist/listbox-La2GZQei.cjs +0 -106
  219. package/dist/loader-D1ugDXGV.cjs +0 -16
  220. package/dist/loader-DyN6RGC5.js +0 -95
  221. package/dist/messagebox-BGMVm2t9.js +0 -71
  222. package/dist/messagebox-M0yIgCz9.cjs +0 -13
  223. package/dist/modal-CMO1RtIi.cjs +0 -36
  224. package/dist/modal-DjPQDE-Z.js +0 -156
  225. package/dist/pkt-options-controller-5LXbEzuk.cjs +0 -1
  226. package/dist/pkt-options-controller-B5YalfCb.js +0 -39
  227. package/dist/progressbar-BqlMzkM_.cjs +0 -21
  228. package/dist/progressbar-sbHDFC12.js +0 -162
  229. package/dist/radiobutton-5ZqVVtTT.cjs +0 -31
  230. package/dist/radiobutton-D8Ai8ETa.js +0 -113
  231. package/dist/ref-Bg_Swj5w.js +0 -42
  232. package/dist/ref-CL-Xk9Xm.cjs +0 -5
  233. package/dist/repeat-BD8TKgJb.js +0 -61
  234. package/dist/repeat-Cfq8CDlf.cjs +0 -5
  235. package/dist/select-De-n8on9.js +0 -230
  236. package/dist/select-dTWibR6_.cjs +0 -49
  237. package/dist/state-C_1EOo3D.js +0 -12
  238. package/dist/state-Dg-53wQ8.cjs +0 -5
  239. package/dist/tabitem-B9-jeV97.js +0 -334
  240. package/dist/tabitem-BnhzqfW3.cjs +0 -65
  241. package/dist/tag-CbwO8yvD.cjs +0 -27
  242. package/dist/tag-D4FI5t3y.js +0 -117
  243. package/dist/textarea-BmLaKzsc.cjs +0 -50
  244. package/dist/textarea-CMiSJaYL.js +0 -133
  245. package/dist/textinput-em9y4yrL.cjs +0 -70
  246. package/dist/textinput-r8udK0IX.js +0 -152
  247. package/dist/utils-DznhwRXm.js +0 -8
  248. package/dist/utils-byXsEz1u.cjs +0 -1
@@ -0,0 +1,166 @@
1
+ import { t as e, u as t } from "./element-cZ85T_aa.js";
2
+ import { r as n, t as r } from "./directive-3THFsVew.js";
3
+ import { t as i } from "./async-directive-CaQiqjyV.js";
4
+ //#region src/controllers/pkt-slot-utils.ts
5
+ function a(e) {
6
+ return e.classList && (e.classList.contains("_dialog_overlay") || e.classList.contains("backdrop")) ? !0 : typeof e.hasAttribute == "function" && e.hasAttribute("data-skip");
7
+ }
8
+ function o(e) {
9
+ return e.nodeName === "OPTION" || e.nodeName === "DATA";
10
+ }
11
+ function s(e) {
12
+ return e.nodeType === Node.TEXT_NODE && e.nodeValue?.trim() !== "";
13
+ }
14
+ //#endregion
15
+ //#region src/directives/slot-content.ts
16
+ var c = /* @__PURE__ */ new WeakMap();
17
+ function l(e) {
18
+ let t = c.get(e);
19
+ return t || (t = new m(e), c.set(e, t)), t;
20
+ }
21
+ var u = Symbol("default");
22
+ function d(e) {
23
+ return e === void 0 ? u : e;
24
+ }
25
+ function f(e, t) {
26
+ if (e.nodeType === Node.COMMENT_NODE) return !1;
27
+ if (e.nodeType === Node.TEXT_NODE) return s(e) ? (p(t, u, e), !0) : !1;
28
+ if (e.nodeType === Node.ELEMENT_NODE) {
29
+ let n = e;
30
+ if (a(n) || o(n)) return !1;
31
+ if (n instanceof HTMLTemplateElement) {
32
+ let e = Array.from(n.content.childNodes), r = d(n.getAttribute("slot") ?? void 0);
33
+ for (let n of e) p(t, r, n);
34
+ return !0;
35
+ }
36
+ let r = n.getAttribute("slot");
37
+ return p(t, r === null ? u : d(r), e), !0;
38
+ }
39
+ return !1;
40
+ }
41
+ function p(e, t, n) {
42
+ let r = e.get(t);
43
+ r || (r = [], e.set(t, r)), r.push(n);
44
+ }
45
+ var m = class e {
46
+ static {
47
+ this.PLACEHOLDER_PREFIX = "pkt-slot";
48
+ }
49
+ constructor(e) {
50
+ this.observer = null, this.nodesBySlot = /* @__PURE__ */ new Map(), this.directives = /* @__PURE__ */ new Set(), this.observing = !1, this.trackedNodes = /* @__PURE__ */ new Set(), this.generation = 0, this.initialCollectionDone = !1, this.processingMutations = !1, this.placeholderToNode = /* @__PURE__ */ new Map(), this.nodeToPlaceholder = /* @__PURE__ */ new Map(), this.host = e;
51
+ }
52
+ collectNodes() {
53
+ if (this.initialCollectionDone) return;
54
+ this.initialCollectionDone = !0, this.generation++;
55
+ let e = Array.from(this.host.childNodes);
56
+ for (let t of e) f(t, this.nodesBySlot) && this.trackedNodes.add(t);
57
+ }
58
+ addDirective(e) {
59
+ this.directives.add(e), this.startObserving();
60
+ }
61
+ removeDirective(e) {
62
+ this.directives.delete(e), this.directives.size === 0 && this.stopObserving();
63
+ }
64
+ getNodes(e) {
65
+ return this.nodesBySlot.get(d(e)) ?? [];
66
+ }
67
+ hasContent(e) {
68
+ return this.getNodes(e).length > 0;
69
+ }
70
+ ensurePlaceholder(t) {
71
+ if (this.nodeToPlaceholder.has(t) || t.parentNode !== this.host) return;
72
+ let n = document.createComment(e.PLACEHOLDER_PREFIX);
73
+ this.host.insertBefore(n, t), this.placeholderToNode.set(n, t), this.nodeToPlaceholder.set(t, n);
74
+ }
75
+ startObserving() {
76
+ this.observing || (this.observing = !0, setTimeout(() => {
77
+ this.observing && (this.observer = new MutationObserver((e) => {
78
+ this.handleMutations(e);
79
+ }), this.observer.observe(this.host, { childList: !0 }));
80
+ }, 0));
81
+ }
82
+ stopObserving() {
83
+ this.observing && (this.observing = !1, this.observer?.disconnect(), this.observer = null);
84
+ }
85
+ handleMutations(e) {
86
+ if (this.processingMutations) return;
87
+ this.processingMutations = !0;
88
+ let t = !1;
89
+ for (let n of e) if (n.target === this.host) {
90
+ for (let e of n.removedNodes) {
91
+ let n = this.placeholderToNode.get(e);
92
+ if (n) {
93
+ n.parentNode?.removeChild(n), this.trackedNodes.delete(n), this.removeFromSlots(n), this.placeholderToNode.delete(e), this.nodeToPlaceholder.delete(n), t = !0;
94
+ continue;
95
+ }
96
+ if (this.trackedNodes.has(e)) {
97
+ this.trackedNodes.delete(e), this.removeFromSlots(e);
98
+ let n = this.nodeToPlaceholder.get(e);
99
+ n && (n.parentNode?.removeChild(n), this.placeholderToNode.delete(n), this.nodeToPlaceholder.delete(e)), t = !0;
100
+ }
101
+ }
102
+ for (let e of n.addedNodes) this.placeholderToNode.has(e) || !this.trackedNodes.has(e) && this.isUserContent(e) && f(e, this.nodesBySlot) && (this.trackedNodes.add(e), t = !0);
103
+ }
104
+ t && (this.generation++, this.notifyDirectives()), this.observer?.takeRecords(), this.processingMutations = !1;
105
+ }
106
+ isUserContent(e) {
107
+ if (e.nodeType === Node.COMMENT_NODE) return !1;
108
+ if (e.nodeType === Node.TEXT_NODE) return s(e);
109
+ if (e.nodeType === Node.ELEMENT_NODE) {
110
+ let t = e;
111
+ return !(a(t) || o(t));
112
+ }
113
+ return !1;
114
+ }
115
+ removeFromSlots(e) {
116
+ for (let [t, n] of this.nodesBySlot) {
117
+ let r = n.indexOf(e);
118
+ if (r !== -1) {
119
+ n.splice(r, 1), n.length === 0 && this.nodesBySlot.delete(t);
120
+ return;
121
+ }
122
+ }
123
+ }
124
+ notifyDirectives() {
125
+ for (let e of this.directives) e.handleNodesChanged();
126
+ }
127
+ }, h = r(class extends i {
128
+ constructor(e) {
129
+ if (super(e), this.manager = null, this.lastGeneration = -1, e.type !== n.CHILD) throw Error("slotContent() can only be used in child expressions");
130
+ }
131
+ render(e, n) {
132
+ return t;
133
+ }
134
+ update(e, [t, n]) {
135
+ return this.slotName = n, this.manager || (this.manager = l(t), this.manager.collectNodes(), this.manager.addDirective(this)), this.ensurePlaceholders(), this.getNodesOrNoChange();
136
+ }
137
+ handleNodesChanged() {
138
+ if (!this.isConnected || !this.manager) return;
139
+ this.ensurePlaceholders();
140
+ let e = this.getNodesOrNoChange();
141
+ e !== t && this.setValue(e);
142
+ }
143
+ ensurePlaceholders() {
144
+ if (!this.manager) return;
145
+ let e = this.manager.getNodes(this.slotName);
146
+ for (let t of e) this.manager.ensurePlaceholder(t);
147
+ }
148
+ disconnected() {
149
+ this.manager?.removeDirective(this), this.manager = null, this.lastGeneration = -1;
150
+ }
151
+ reconnected() {}
152
+ getNodesOrNoChange() {
153
+ if (!this.manager) return t;
154
+ let e = this.manager.generation;
155
+ return e === this.lastGeneration ? t : (this.lastGeneration = e, this.manager.getNodes(this.slotName));
156
+ }
157
+ }), g = class extends e {
158
+ connectedCallback() {
159
+ l(this).collectNodes(), super.connectedCallback();
160
+ }
161
+ hasSlotContent(e) {
162
+ return l(this).hasContent(e);
163
+ }
164
+ };
165
+ //#endregion
166
+ export { h as n, o as r, g as t };
@@ -0,0 +1 @@
1
+ const e=require(`./element-DjtxO-1r.cjs`),t=require(`./directive-CJ2giQBZ.cjs`),n=require(`./async-directive-B9P1Qa0k.cjs`);function r(e){return e.classList&&(e.classList.contains(`_dialog_overlay`)||e.classList.contains(`backdrop`))?!0:typeof e.hasAttribute==`function`&&e.hasAttribute(`data-skip`)}function i(e){return e.nodeName===`OPTION`||e.nodeName===`DATA`}function a(e){return e.nodeType===Node.TEXT_NODE&&e.nodeValue?.trim()!==``}var o=new WeakMap;function s(e){let t=o.get(e);return t||(t=new f(e),o.set(e,t)),t}var c=Symbol(`default`);function l(e){return e===void 0?c:e}function u(e,t){if(e.nodeType===Node.COMMENT_NODE)return!1;if(e.nodeType===Node.TEXT_NODE)return a(e)?(d(t,c,e),!0):!1;if(e.nodeType===Node.ELEMENT_NODE){let n=e;if(r(n)||i(n))return!1;if(n instanceof HTMLTemplateElement){let e=Array.from(n.content.childNodes),r=l(n.getAttribute(`slot`)??void 0);for(let n of e)d(t,r,n);return!0}let a=n.getAttribute(`slot`);return d(t,a===null?c:l(a),e),!0}return!1}function d(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}var f=class e{static{this.PLACEHOLDER_PREFIX=`pkt-slot`}constructor(e){this.observer=null,this.nodesBySlot=new Map,this.directives=new Set,this.observing=!1,this.trackedNodes=new Set,this.generation=0,this.initialCollectionDone=!1,this.processingMutations=!1,this.placeholderToNode=new Map,this.nodeToPlaceholder=new Map,this.host=e}collectNodes(){if(this.initialCollectionDone)return;this.initialCollectionDone=!0,this.generation++;let e=Array.from(this.host.childNodes);for(let t of e)u(t,this.nodesBySlot)&&this.trackedNodes.add(t)}addDirective(e){this.directives.add(e),this.startObserving()}removeDirective(e){this.directives.delete(e),this.directives.size===0&&this.stopObserving()}getNodes(e){return this.nodesBySlot.get(l(e))??[]}hasContent(e){return this.getNodes(e).length>0}ensurePlaceholder(t){if(this.nodeToPlaceholder.has(t)||t.parentNode!==this.host)return;let n=document.createComment(e.PLACEHOLDER_PREFIX);this.host.insertBefore(n,t),this.placeholderToNode.set(n,t),this.nodeToPlaceholder.set(t,n)}startObserving(){this.observing||(this.observing=!0,setTimeout(()=>{this.observing&&(this.observer=new MutationObserver(e=>{this.handleMutations(e)}),this.observer.observe(this.host,{childList:!0}))},0))}stopObserving(){this.observing&&(this.observing=!1,this.observer?.disconnect(),this.observer=null)}handleMutations(e){if(this.processingMutations)return;this.processingMutations=!0;let t=!1;for(let n of e)if(n.target===this.host){for(let e of n.removedNodes){let n=this.placeholderToNode.get(e);if(n){n.parentNode?.removeChild(n),this.trackedNodes.delete(n),this.removeFromSlots(n),this.placeholderToNode.delete(e),this.nodeToPlaceholder.delete(n),t=!0;continue}if(this.trackedNodes.has(e)){this.trackedNodes.delete(e),this.removeFromSlots(e);let n=this.nodeToPlaceholder.get(e);n&&(n.parentNode?.removeChild(n),this.placeholderToNode.delete(n),this.nodeToPlaceholder.delete(e)),t=!0}}for(let e of n.addedNodes)this.placeholderToNode.has(e)||!this.trackedNodes.has(e)&&this.isUserContent(e)&&u(e,this.nodesBySlot)&&(this.trackedNodes.add(e),t=!0)}t&&(this.generation++,this.notifyDirectives()),this.observer?.takeRecords(),this.processingMutations=!1}isUserContent(e){if(e.nodeType===Node.COMMENT_NODE)return!1;if(e.nodeType===Node.TEXT_NODE)return a(e);if(e.nodeType===Node.ELEMENT_NODE){let t=e;return!(r(t)||i(t))}return!1}removeFromSlots(e){for(let[t,n]of this.nodesBySlot){let r=n.indexOf(e);if(r!==-1){n.splice(r,1),n.length===0&&this.nodesBySlot.delete(t);return}}}notifyDirectives(){for(let e of this.directives)e.handleNodesChanged()}},p=class extends n.t{constructor(e){if(super(e),this.manager=null,this.lastGeneration=-1,e.type!==t.r.CHILD)throw Error(`slotContent() can only be used in child expressions`)}render(t,n){return e.u}update(e,[t,n]){return this.slotName=n,this.manager||(this.manager=s(t),this.manager.collectNodes(),this.manager.addDirective(this)),this.ensurePlaceholders(),this.getNodesOrNoChange()}handleNodesChanged(){if(!this.isConnected||!this.manager)return;this.ensurePlaceholders();let t=this.getNodesOrNoChange();t!==e.u&&this.setValue(t)}ensurePlaceholders(){if(!this.manager)return;let e=this.manager.getNodes(this.slotName);for(let t of e)this.manager.ensurePlaceholder(t)}disconnected(){this.manager?.removeDirective(this),this.manager=null,this.lastGeneration=-1}reconnected(){}getNodesOrNoChange(){if(!this.manager)return e.u;let t=this.manager.generation;return t===this.lastGeneration?e.u:(this.lastGeneration=t,this.manager.getNodes(this.slotName))}},m=t.t(p),h=class extends e.t{connectedCallback(){s(this).collectNodes(),super.connectedCallback()}hasSlotContent(e){return s(this).hasContent(e)}};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return h}});
@@ -0,0 +1,304 @@
1
+ const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),n=require(`./element-with-slot-CWoTGA1B.cjs`);require(`./icon-Dr8sfT2X.cjs`);const r=require(`./if-defined-XKOD_t_V.cjs`);require(`./button-D-TOBaJB.cjs`);const i=require(`./ref-BaJ0mBT_.cjs`),a=require(`./booleanish-jJLlnr6-.cjs`);require(`./link-CyTCpI0k.cjs`),require(`./textinput-DFh8_9cx.cjs`);var o=e=>typeof e.target==`string`?{title:e.title,iconName:e.iconName,href:e.target}:{title:e.title,iconName:e.iconName,onClick:e.target},s=e=>o(e),c=e=>{if(!e)return;let t=typeof e==`string`?new Date(e):e;if(!isNaN(t.getTime()))return t.toLocaleDateString(`nb-NO`,{day:`numeric`,month:`long`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})},l=class extends e.t{constructor(...e){super(...e),this.canChangeRepresentation=!1,this.logoutOnClick=!1}handleChangeRepresentation(){this.dispatchEvent(new CustomEvent(`change-representation`,{bubbles:!0,composed:!0}))}handleLogout(){this.dispatchEvent(new CustomEvent(`log-out`,{bubbles:!0,composed:!0}))}handleMenuItemClick(e){`onClick`in e&&typeof e.onClick==`function`&&e.onClick()}renderLinkOrButton(n,r){let i=`href`in n,a=t.t({"pkt-user-menu__link":!0,"pkt-link-button":!i,"pkt-link":!i,"pkt-link--icon-left":!i,[r||``]:!!r});return i?e.d`
2
+ <pkt-link
3
+ icon-name=${n.iconName||e.l}
4
+ href=${n.href}
5
+ aria-hidden="true"
6
+ class="pkt-user-menu__link ${r||``}"
7
+ >
8
+ ${n.title}
9
+ </pkt-link>
10
+ `:e.d`
11
+ <button class=${a} type="button" @click=${()=>this.handleMenuItemClick(n)}>
12
+ ${n.iconName?e.d`<pkt-icon
13
+ name=${n.iconName}
14
+ class="pkt-link__icon"
15
+ aria-hidden="true"
16
+ ></pkt-icon>`:e.l}
17
+ ${n.title}
18
+ </button>
19
+ `}renderLinkSection(t){return e.d`
20
+ <ul class="pkt-user-menu__sublist">
21
+ ${t.map(t=>e.d`
22
+ <li class="pkt-user-menu__subitem">${this.renderLinkOrButton(t)}</li>
23
+ `)}
24
+ </ul>
25
+ `}render(){let t=this.userMenu?.map(s);return e.d`
26
+ <nav class="pkt-user-menu" aria-label="Meny for innlogget bruker">
27
+ <ul class="pkt-user-menu__list">
28
+ <!-- User section -->
29
+ ${this.user?e.d`
30
+ <li class="pkt-user-menu__item">
31
+ <div class="pkt-user-menu__label">Pålogget som</div>
32
+ <div class="pkt-user-menu__name" translate="no">${this.user.name}</div>
33
+ ${this.formattedLastLoggedIn?e.d`
34
+ <div class="pkt-user-menu__last-logged-in">
35
+ Sist pålogget: <time>${this.formattedLastLoggedIn}</time>
36
+ </div>
37
+ `:e.l}
38
+ </li>
39
+ `:e.l}
40
+
41
+ <!-- User menu items -->
42
+ ${t&&t.length>0?e.d`
43
+ <li class="pkt-user-menu__item">${this.renderLinkSection(t)}</li>
44
+ `:e.l}
45
+
46
+ <!-- Representing section -->
47
+ ${this.representing?e.d`
48
+ <li class="pkt-user-menu__item">
49
+ <div class="pkt-user-menu__label">Representerer</div>
50
+ <div class="pkt-user-menu__name" translate="no">${this.representing.name}</div>
51
+ ${this.representing.orgNumber?e.d`<div class="pkt-user-menu__org-number">
52
+ Org.nr. ${this.representing.orgNumber}
53
+ </div>`:e.l}
54
+ ${this.canChangeRepresentation?e.d`
55
+ <ul class="pkt-user-menu__sublist mt-size-16">
56
+ <li class="pkt-user-menu__subitem">
57
+ ${this.renderLinkOrButton({title:`Endre organisasjon`,iconName:`cogwheel`,onClick:()=>this.handleChangeRepresentation()})}
58
+ </li>
59
+ </ul>
60
+ `:e.l}
61
+ </li>
62
+ `:e.l}
63
+
64
+ <!-- Change representation without representing object -->
65
+ ${!this.representing&&this.canChangeRepresentation?e.d`
66
+ <li class="pkt-user-menu__item">
67
+ <ul class="pkt-user-menu__sublist">
68
+ <li class="pkt-user-menu__subitem">
69
+ ${this.renderLinkOrButton({title:`Endre organisasjon`,iconName:`cogwheel`,onClick:()=>this.handleChangeRepresentation()})}
70
+ </li>
71
+ </ul>
72
+ </li>
73
+ `:e.l}
74
+
75
+ <!-- Logout -->
76
+ ${this.logoutOnClick?e.d`
77
+ <li class="pkt-user-menu__item">
78
+ ${this.renderLinkOrButton({title:`Logg ut`,iconName:`exit`,onClick:()=>this.handleLogout()})}
79
+ </li>
80
+ `:e.l}
81
+ </ul>
82
+ </nav>
83
+ `}};e.r([e.s({type:Object})],l.prototype,`user`,void 0),e.r([e.s({type:String,attribute:`formatted-last-logged-in`})],l.prototype,`formattedLastLoggedIn`,void 0),e.r([e.s({type:Object})],l.prototype,`representing`,void 0),e.r([e.s({type:Array,attribute:`user-menu`})],l.prototype,`userMenu`,void 0),e.r([e.s({type:Boolean,attribute:`can-change-representation`,converter:a.t})],l.prototype,`canChangeRepresentation`,void 0),e.r([e.s({type:Boolean,attribute:`logout-on-click`,converter:a.t})],l.prototype,`logoutOnClick`,void 0);try{e.c(`pkt-header-user-menu`)(l)}catch{console.warn(`Forsøker å definere <pkt-header-user-menu>, men den er allerede definert`)}var u=`https://punkt-cdn.oslo.kommune.no/latest/logos/`,d=class extends n.t{constructor(...e){super(...e),this.searchPlaceholder=`Søk`,this.searchValue=``,this.mobileBreakpoint=768,this.tabletBreakpoint=1280,this.openedMenu=`none`,this.logOutButtonPlacement=`none`,this.position=`fixed`,this.scrollBehavior=`hide`,this.slotMenuVariant=`icon-only`,this.slotMenuText=`Meny`,this.hideLogo=!1,this.compact=!1,this.showSearch=!1,this.canChangeRepresentation=!1,this.hasLogOut=!1,this.isMobile=!1,this.isTablet=!1,this.openMenu=`none`,this.isHidden=!1,this.componentWidth=typeof window<`u`?window.innerWidth:0,this.alignSlotRight=!1,this.alignSearchRight=!1,this.headerRef=i.t(),this.userContainerRef=i.t(),this.slotContainerRef=i.t(),this.searchContainerRef=i.t(),this.slotContentRef=i.t(),this.searchMenuRef=i.t(),this.lastScrollPosition=0,this.savedScrollY=0,this.lastFocusedElement=null,this.shouldRestoreFocus=!1,this.handleScroll=()=>{if(!this.shouldHideOnScroll)return;let e=window.pageYOffset||document.documentElement.scrollTop;e<0||Math.abs(e-this.lastScrollPosition)<60||(this.isHidden=e>this.lastScrollPosition,this.lastScrollPosition=e)},this.handleClickOutside=e=>{let t=e.target;this.user&&this.openMenu===`user`&&!t.closest(`.pkt-header-service__user-container`)&&(this.openMenu=`none`),this.openMenu===`slot`&&!t.closest(`.pkt-header-service__slot-container`)&&(this.openMenu=`none`),this.openMenu===`search`&&!t.closest(`.pkt-header-service__search-container`)&&!t.closest(`.pkt-header-service__search-input`)&&(this.openMenu=`none`)},this.handleFocusOut=(e,t)=>{let n=e.relatedTarget,r;switch(t){case`user`:r=this.userContainerRef;break;case`slot`:r=this.slotContainerRef;break;case`search`:r=this.searchContainerRef;break;default:return}let i=r.value;i&&(!n||!i.contains(n))&&(this.openMenu=`none`)},this.handleEscapeKey=e=>{e.key===`Escape`&&this.openMenu!==`none`&&(e.preventDefault(),this.shouldRestoreFocus=!0,this.openMenu=`none`)}}connectedCallback(){super.connectedCallback(),this.setupScrollListener()}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect(),window.removeEventListener(`scroll`,this.handleScroll),this.unlockScroll()}firstUpdated(){this.setupResizeObserver()}updated(e){if(super.updated(e),e.has(`openedMenu`)&&this.openedMenu!==this.openMenu&&(this.openMenu=this.openedMenu),(e.has(`mobileBreakpoint`)||e.has(`tabletBreakpoint`))&&(this.updateIsMobile(),this.updateIsTablet()),e.has(`openMenu`)){let t=e.get(`openMenu`);this.openMenu!==`none`&&(t===`none`||t===void 0)?(document.addEventListener(`mousedown`,this.handleClickOutside),document.addEventListener(`keydown`,this.handleEscapeKey),(this.openMenu===`slot`||this.openMenu===`search`)&&requestAnimationFrame(()=>{this.checkDropdownAlignment(this.openMenu)})):this.openMenu===`none`&&t!==`none`&&(document.removeEventListener(`mousedown`,this.handleClickOutside),document.removeEventListener(`keydown`,this.handleEscapeKey),this.restoreFocus())}(e.has(`openMenu`)||e.has(`isMobile`))&&this.updateScrollLock()}setupResizeObserver(){let e=this.headerRef.value;e&&(this.componentWidth=e.offsetWidth,this.updateIsMobile(),this.updateIsTablet(),this.resizeObserver=new ResizeObserver(e=>{for(let t of e)t.borderBoxSize&&t.borderBoxSize.length>0?this.componentWidth=t.borderBoxSize[0].inlineSize:this.componentWidth=t.contentRect.width,this.updateIsMobile(),this.updateIsTablet()}),this.resizeObserver.observe(e))}updateIsMobile(){this.isMobile=this.componentWidth<this.mobileBreakpoint}updateIsTablet(){this.isTablet=this.componentWidth<this.tabletBreakpoint}updateScrollLock(){this.position===`fixed`&&this.isMobile&&this.openMenu!==`none`?this.lockScroll():this.unlockScroll()}lockScroll(){let e=document.body,t=document.documentElement;this.savedScrollY=window.scrollY||window.pageYOffset;let n=window.innerWidth-t.clientWidth;n>0&&(e.style.paddingRight=`${n}px`),e.style.position=`fixed`,e.style.top=`-${this.savedScrollY}px`,e.style.left=`0`,e.style.right=`0`,e.style.width=`100%`,e.style.overflow=`hidden`,t.classList.add(`is-scroll-locked`)}unlockScroll(){let e=document.body,t=document.documentElement;t.classList.contains(`is-scroll-locked`)&&(e.style.removeProperty(`position`),e.style.removeProperty(`top`),e.style.removeProperty(`left`),e.style.removeProperty(`right`),e.style.removeProperty(`width`),e.style.removeProperty(`overflow`),e.style.removeProperty(`padding-right`),t.classList.remove(`is-scroll-locked`),window.scrollTo({top:this.savedScrollY}))}setupScrollListener(){window.addEventListener(`scroll`,this.handleScroll)}restoreFocus(){this.shouldRestoreFocus&&this.lastFocusedElement&&document.contains(this.lastFocusedElement)&&this.lastFocusedElement.focus(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1}checkDropdownAlignment(e){let t=e===`slot`?this.slotContainerRef:this.searchContainerRef,n=e===`slot`?this.slotContentRef:this.searchMenuRef;if(!t.value||!n.value||!this.isTablet||this.isMobile)return;let r=t.value.getBoundingClientRect(),i=n.value.offsetWidth,a=r.left+i>window.innerWidth;e===`slot`?this.alignSlotRight=a:this.alignSearchRight=a}handleMenuToggle(e){this.openMenu===`none`?(this.lastFocusedElement=document.activeElement,this.openMenu=e):this.openMenu=`none`}handleLogoClick(e){this.dispatchEvent(new CustomEvent(`logo-click`,{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}handleServiceClick(e){this.dispatchEvent(new CustomEvent(`service-click`,{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}handleLogout(){this.dispatchEvent(new CustomEvent(`log-out`,{bubbles:!0,composed:!0}))}handleSearch(e){this.dispatchEvent(new CustomEvent(`search`,{detail:{query:e},bubbles:!0,composed:!0}))}handleSearchChange(e){this.dispatchEvent(new CustomEvent(`search-change`,{detail:{query:e},bubbles:!0,composed:!0}))}handleSearchInputChange(e){let t=e.target.value;this.handleSearchChange(t)}handleSearchKeyDown(e){e.key===`Enter`&&this.handleSearch(e.target.value)}get formattedLastLoggedIn(){return c(this.user?.lastLoggedIn)}get isFixed(){return this.position===`fixed`}get shouldHideOnScroll(){return this.scrollBehavior===`hide`}get showLogoutInHeader(){return this.hasLogOut&&(this.logOutButtonPlacement===`header`||this.logOutButtonPlacement===`both`)}get showLogoutInUserMenu(){return this.hasLogOut&&(this.logOutButtonPlacement===`userMenu`||this.logOutButtonPlacement===`both`)}renderLogo(){if(this.hideLogo)return e.l;let t=e.d`
84
+ <pkt-icon name="oslologo" aria-hidden="true" path=${u}></pkt-icon>
85
+ `;return this.logoLink&&typeof this.logoLink==`string`?e.d`
86
+ <span class="pkt-header-service__logo">
87
+ <a href=${this.logoLink} aria-label="Tilbake til forside" @click=${this.handleLogoClick}>
88
+ ${t}
89
+ </a>
90
+ </span>
91
+ `:this.hasAttribute(`logo-link`)?e.d`
92
+ <span class="pkt-header-service__logo">
93
+ <button
94
+ aria-label="Tilbake til forside"
95
+ class="pkt-link-button pkt-link pkt-header-service__logo-link"
96
+ @click=${this.handleLogoClick}
97
+ >
98
+ ${t}
99
+ </button>
100
+ </span>
101
+ `:e.d`
102
+ <span class="pkt-header-service__logo" @click=${this.handleLogoClick}>${t}</span>
103
+ `}renderServiceName(){return this.serviceName?this.serviceLink&&typeof this.serviceLink==`string`?e.d`
104
+ <span class="pkt-header-service__service-name">
105
+ <pkt-link
106
+ href=${this.serviceLink}
107
+ class="pkt-header-service__service-link"
108
+ @click=${this.handleServiceClick}
109
+ >
110
+ ${this.serviceName}
111
+ </pkt-link>
112
+ </span>
113
+ `:this.hasAttribute(`service-link`)?e.d`
114
+ <span class="pkt-header-service__service-name">
115
+ <button
116
+ class="pkt-link-button pkt-link pkt-header-service__service-link"
117
+ @click=${this.handleServiceClick}
118
+ >
119
+ ${this.serviceName}
120
+ </button>
121
+ </span>
122
+ `:e.d`
123
+ <span class="pkt-header-service__service-name" @click=${this.handleServiceClick}>
124
+ <span class="pkt-header-service__service-link">${this.serviceName}</span>
125
+ </span>
126
+ `:e.l}renderSlotContainer(){if(!this.hasSlotContent())return e.l;let r=t.t({"pkt-header-service__slot-container":!0,"is-open":this.openMenu===`slot`}),a=t.t({"pkt-header-service__slot-content":!0,"align-right":this.alignSlotRight});return e.d`
127
+ <div
128
+ class=${r}
129
+ @focusout=${e=>this.handleFocusOut(e,`slot`)}
130
+ ${i.n(this.slotContainerRef)}
131
+ >
132
+ ${this.isTablet&&this.hasSlotContent()?e.d`
133
+ <pkt-button
134
+ skin="secondary"
135
+ variant=${this.slotMenuVariant}
136
+ iconName="menu"
137
+ size=${this.isMobile?`small`:`medium`}
138
+ state=${this.openMenu===`slot`?`active`:`normal`}
139
+ @click=${()=>this.handleMenuToggle(`slot`)}
140
+ aria-expanded=${this.openMenu===`slot`}
141
+ aria-controls="mobile-slot-menu"
142
+ aria-label="Åpne meny"
143
+ >
144
+ ${this.slotMenuText}
145
+ </pkt-button>
146
+ `:e.l}
147
+ <div
148
+ class=${a}
149
+ id="mobile-slot-menu"
150
+ role=${this.isTablet?`menu`:e.l}
151
+ aria-label=${this.isTablet?`Meny`:e.l}
152
+ ${i.n(this.slotContentRef)}
153
+ >
154
+ ${n.n(this)}
155
+ </div>
156
+ </div>
157
+ `}renderSearch(){if(!this.showSearch)return e.l;if(this.isTablet){let n=t.t({"pkt-header-service__search-container":!0,"is-open":this.openMenu===`search`}),r=t.t({"pkt-header-service__mobile-menu":!0,"is-open":this.openMenu===`search`,"align-right":this.alignSearchRight});return e.d`
158
+ <div
159
+ class=${n}
160
+ @focusout=${e=>this.handleFocusOut(e,`search`)}
161
+ ${i.n(this.searchContainerRef)}
162
+ >
163
+ <pkt-button
164
+ skin="secondary"
165
+ variant="icon-only"
166
+ iconName="magnifying-glass-big"
167
+ size=${this.isMobile?`small`:`medium`}
168
+ @click=${()=>this.handleMenuToggle(`search`)}
169
+ state=${this.openMenu===`search`?`active`:`normal`}
170
+ aria-expanded=${this.openMenu===`search`}
171
+ aria-controls="mobile-search-menu"
172
+ aria-label="Åpne søkefelt"
173
+ >
174
+ Søk
175
+ </pkt-button>
176
+ <div class=${r} ${i.n(this.searchMenuRef)}>
177
+ ${this.openMenu===`search`?e.d`
178
+ <pkt-textinput
179
+ id="mobile-search-menu"
180
+ class="pkt-header-service__search-input"
181
+ type="search"
182
+ label="Søk"
183
+ useWrapper="false"
184
+ placeholder=${this.searchPlaceholder}
185
+ value=${this.searchValue}
186
+ autofocus
187
+ fullwidth
188
+ @input=${this.handleSearchInputChange}
189
+ @keydown=${e=>{e.key===`Enter`&&this.handleSearch(e.target.value)}}
190
+ ></pkt-textinput>
191
+ `:e.l}
192
+ </div>
193
+ </div>
194
+ `}return e.d`
195
+ <pkt-textinput
196
+ id="header-service-search"
197
+ class="pkt-header-service__search-input"
198
+ type="search"
199
+ label="Søk"
200
+ useWrapper="false"
201
+ placeholder=${this.searchPlaceholder}
202
+ value=${this.searchValue}
203
+ @input=${this.handleSearchInputChange}
204
+ @keydown=${this.handleSearchKeyDown}
205
+ ></pkt-textinput>
206
+ `}renderUserButton(){if(!this.user)return e.l;let n=t.t({"pkt-header-service__user-menu":this.isMobile===!1,"pkt-header-service__mobile-menu":this.isMobile===!0,"is-open":this.openMenu===`user`});return e.d`
207
+ <div
208
+ class="pkt-header-service__user-container"
209
+ @focusout=${e=>this.handleFocusOut(e,`user`)}
210
+ ${i.n(this.userContainerRef)}
211
+ >
212
+ <pkt-button
213
+ class=${t.t({"pkt-header-service__user-button":!0,"pkt-header-service__user-button--mobile":this.isMobile})}
214
+ skin="secondary"
215
+ size=${this.isMobile?`small`:`medium`}
216
+ state=${this.openMenu===`user`?`active`:`normal`}
217
+ variant="icons-right-and-left"
218
+ iconName="user"
219
+ secondIconName=${this.openMenu===`user`?`chevron-thin-up`:`chevron-thin-down`}
220
+ @click=${()=>this.handleMenuToggle(`user`)}
221
+ >
222
+ <span class="pkt-sr-only">Brukermeny: </span>
223
+ <span>${this.representing?.name||this.user.name}</span>
224
+ </pkt-button>
225
+ ${this.openMenu===`user`&&this.user?e.d`
226
+ <div class=${n}>
227
+ <pkt-header-user-menu
228
+ .user=${this.user}
229
+ formatted-last-logged-in=${this.formattedLastLoggedIn||e.l}
230
+ .representing=${this.representing}
231
+ .userMenu=${this.userMenu}
232
+ ?can-change-representation=${this.canChangeRepresentation}
233
+ ?logout-on-click=${this.showLogoutInUserMenu}
234
+ @change-representation=${()=>this.dispatchEvent(new CustomEvent(`change-representation`,{bubbles:!0,composed:!0}))}
235
+ @log-out=${this.handleLogout}
236
+ ></pkt-header-user-menu>
237
+ </div>
238
+ `:e.l}
239
+ </div>
240
+ `}renderHeader(){let n=t.t({"pkt-header-service":!0,"pkt-header-service--compact":this.compact,"pkt-header-service--mobile":this.isMobile,"pkt-header-service--tablet":this.isTablet,"pkt-header-service--fixed":this.isFixed,"pkt-header-service--scroll-to-hide":this.shouldHideOnScroll,"pkt-header-service--hidden":this.isHidden}),r=t.t({"pkt-header-service__logo-area":!0,"pkt-header-service__logo-area--without-service":!this.serviceName});return e.d`
241
+ <header class=${n} ${i.n(this.headerRef)}>
242
+ <div class=${r}>${this.renderLogo()} ${this.renderServiceName()}</div>
243
+
244
+ ${this.hasSlotContent()||this.showSearch||this.showLogoutInHeader?e.d`<div class="pkt-header-service__content">
245
+ ${this.renderSlotContainer()} ${this.renderSearch()}
246
+ ${this.isTablet&&this.showLogoutInHeader?e.d`
247
+ <pkt-button
248
+ skin="secondary"
249
+ size=${this.isMobile?`small`:`medium`}
250
+ variant="icon-only"
251
+ iconName="exit"
252
+ @click=${this.handleLogout}
253
+ >
254
+ Logg ut
255
+ </pkt-button>
256
+ `:e.l}
257
+ </div>`:e.l}
258
+ ${this.user||!this.isTablet&&this.showLogoutInHeader?e.d`<div class="pkt-header-service__user">
259
+ ${this.renderUserButton()}
260
+ ${!this.isTablet&&this.showLogoutInHeader?e.d`
261
+ <pkt-button
262
+ skin="tertiary"
263
+ size="medium"
264
+ variant="icon-right"
265
+ iconName="exit"
266
+ @click=${this.handleLogout}
267
+ >
268
+ Logg ut
269
+ </pkt-button>
270
+ `:e.l}
271
+ </div>`:e.l}
272
+ </header>
273
+ `}render(){let n=this.renderHeader();return this.isFixed?e.d`
274
+ <div class="pkt-header-service-wrapper">
275
+ ${n}
276
+ <div class=${t.t({"pkt-header-service-spacer":!0,"pkt-header-service-spacer--compact":this.compact,"pkt-header-service-spacer--has-user":!!this.user,"pkt-header-service-spacer--mobile":this.isMobile})}></div>
277
+ </div>
278
+ `:n}};e.r([e.s({type:String,attribute:`service-name`})],d.prototype,`serviceName`,void 0),e.r([e.s({type:String,attribute:`service-link`})],d.prototype,`serviceLink`,void 0),e.r([e.s({type:String,attribute:`logo-link`})],d.prototype,`logoLink`,void 0),e.r([e.s({type:String,attribute:`search-placeholder`})],d.prototype,`searchPlaceholder`,void 0),e.r([e.s({type:String,attribute:`search-value`})],d.prototype,`searchValue`,void 0),e.r([e.s({type:Number,attribute:`mobile-breakpoint`})],d.prototype,`mobileBreakpoint`,void 0),e.r([e.s({type:Number,attribute:`tablet-breakpoint`})],d.prototype,`tabletBreakpoint`,void 0),e.r([e.s({type:String,attribute:`opened-menu`})],d.prototype,`openedMenu`,void 0),e.r([e.s({type:String,attribute:`log-out-button-placement`})],d.prototype,`logOutButtonPlacement`,void 0),e.r([e.s({type:String})],d.prototype,`position`,void 0),e.r([e.s({type:String,attribute:`scroll-behavior`})],d.prototype,`scrollBehavior`,void 0),e.r([e.s({type:String,attribute:`slot-menu-variant`})],d.prototype,`slotMenuVariant`,void 0),e.r([e.s({type:String,attribute:`slot-menu-text`})],d.prototype,`slotMenuText`,void 0),e.r([e.s({type:Boolean,attribute:`hide-logo`,converter:a.t})],d.prototype,`hideLogo`,void 0),e.r([e.s({type:Boolean,converter:a.t})],d.prototype,`compact`,void 0),e.r([e.s({type:Boolean,attribute:`show-search`,converter:a.t})],d.prototype,`showSearch`,void 0),e.r([e.s({type:Boolean,attribute:`can-change-representation`,converter:a.t})],d.prototype,`canChangeRepresentation`,void 0),e.r([e.s({type:Boolean,attribute:`has-log-out`,converter:a.t})],d.prototype,`hasLogOut`,void 0),e.r([e.s({type:Object})],d.prototype,`user`,void 0),e.r([e.s({type:Array,attribute:`user-menu`})],d.prototype,`userMenu`,void 0),e.r([e.s({type:Object})],d.prototype,`representing`,void 0),e.r([e.o()],d.prototype,`isMobile`,void 0),e.r([e.o()],d.prototype,`isTablet`,void 0),e.r([e.o()],d.prototype,`openMenu`,void 0),e.r([e.o()],d.prototype,`isHidden`,void 0),e.r([e.o()],d.prototype,`componentWidth`,void 0),e.r([e.o()],d.prototype,`alignSlotRight`,void 0),e.r([e.o()],d.prototype,`alignSearchRight`,void 0);try{e.c(`pkt-header-service`)(d)}catch{console.warn(`Forsøker å definere <pkt-header-service>, men den er allerede definert`)}var f=class extends n.t{constructor(...e){super(...e),this.searchPlaceholder=`Søk`,this.searchValue=``,this.mobileBreakpoint=768,this.tabletBreakpoint=1280,this.openedMenu=`none`,this.logOutButtonPlacement=`none`,this.position=`fixed`,this.scrollBehavior=`hide`,this.slotMenuVariant=`icon-only`,this.slotMenuText=`Meny`,this.hideLogo=!1,this.compact=!1,this.showSearch=!1,this.canChangeRepresentation=!1,this.hasLogOut=!1}firstUpdated(e){super.firstUpdated(e),this.emitDeprecationWarnings()}emitDeprecationWarnings(){this.userMenuFooter!==void 0&&console.warn(`[PktHeader] userMenuFooter is deprecated. Use userMenu instead.`),this.userOptions!==void 0&&console.warn(`[PktHeader] userOptions is deprecated. Use userMenu instead.`)}get effectiveUserMenu(){let e=this.userMenu||[],t=this.userMenuFooter||[],n=this.userOptions||[];return t.length||n.length?[...e,...n,...t]:this.userMenu}render(){return e.d`
279
+ <pkt-header-service
280
+ service-name=${r.t(this.serviceName)}
281
+ service-link=${r.t(this.serviceLink)}
282
+ logo-link=${r.t(this.logoLink)}
283
+ search-placeholder=${this.searchPlaceholder}
284
+ search-value=${this.searchValue}
285
+ mobile-breakpoint=${this.mobileBreakpoint}
286
+ tablet-breakpoint=${this.tabletBreakpoint}
287
+ opened-menu=${this.openedMenu}
288
+ log-out-button-placement=${this.logOutButtonPlacement}
289
+ position=${this.position}
290
+ scroll-behavior=${this.scrollBehavior}
291
+ slot-menu-variant=${this.slotMenuVariant}
292
+ slot-menu-text=${this.slotMenuText}
293
+ .hideLogo=${this.hideLogo}
294
+ .compact=${this.compact}
295
+ .showSearch=${this.showSearch}
296
+ .canChangeRepresentation=${this.canChangeRepresentation}
297
+ .hasLogOut=${this.hasLogOut}
298
+ .user=${this.user}
299
+ .userMenu=${this.effectiveUserMenu}
300
+ .representing=${this.representing}
301
+ >
302
+ ${this.hasSlotContent()?e.d`<div class="pkt-contents">${n.n(this)}</div>`:e.l}
303
+ </pkt-header-service>
304
+ `}};e.r([e.s({type:String,attribute:`service-name`})],f.prototype,`serviceName`,void 0),e.r([e.s({type:String,attribute:`service-link`})],f.prototype,`serviceLink`,void 0),e.r([e.s({type:String,attribute:`logo-link`})],f.prototype,`logoLink`,void 0),e.r([e.s({type:String,attribute:`search-placeholder`})],f.prototype,`searchPlaceholder`,void 0),e.r([e.s({type:String,attribute:`search-value`})],f.prototype,`searchValue`,void 0),e.r([e.s({type:Number,attribute:`mobile-breakpoint`})],f.prototype,`mobileBreakpoint`,void 0),e.r([e.s({type:Number,attribute:`tablet-breakpoint`})],f.prototype,`tabletBreakpoint`,void 0),e.r([e.s({type:String,attribute:`opened-menu`})],f.prototype,`openedMenu`,void 0),e.r([e.s({type:String,attribute:`log-out-button-placement`})],f.prototype,`logOutButtonPlacement`,void 0),e.r([e.s({type:String})],f.prototype,`position`,void 0),e.r([e.s({type:String,attribute:`scroll-behavior`})],f.prototype,`scrollBehavior`,void 0),e.r([e.s({type:String,attribute:`slot-menu-variant`})],f.prototype,`slotMenuVariant`,void 0),e.r([e.s({type:String,attribute:`slot-menu-text`})],f.prototype,`slotMenuText`,void 0),e.r([e.s({type:Boolean,attribute:`hide-logo`,converter:a.t})],f.prototype,`hideLogo`,void 0),e.r([e.s({type:Boolean,converter:a.t})],f.prototype,`compact`,void 0),e.r([e.s({type:Boolean,attribute:`show-search`,converter:a.t})],f.prototype,`showSearch`,void 0),e.r([e.s({type:Boolean,attribute:`can-change-representation`,converter:a.t})],f.prototype,`canChangeRepresentation`,void 0),e.r([e.s({type:Boolean,attribute:`has-log-out`,converter:a.t})],f.prototype,`hasLogOut`,void 0),e.r([e.s({type:Object})],f.prototype,`user`,void 0),e.r([e.s({type:Array,attribute:`user-menu`})],f.prototype,`userMenu`,void 0),e.r([e.s({type:Object})],f.prototype,`representing`,void 0),e.r([e.s({type:Array,attribute:`user-menu-footer`})],f.prototype,`userMenuFooter`,void 0),e.r([e.s({type:Array,attribute:`user-options`})],f.prototype,`userOptions`,void 0);try{e.c(`pkt-header`)(f)}catch{console.warn(`Forsøker å definere <pkt-header>, men den er allerede definert`)}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});