@oslokommune/punkt-elements 16.7.1 → 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 (286) hide show
  1. package/CHANGELOG.md +35 -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 -6
  75. package/dist/pkt-backlink.cjs +1 -1
  76. package/dist/pkt-backlink.js +2 -6
  77. package/dist/pkt-breadcrumbs.cjs +1 -43
  78. package/dist/pkt-breadcrumbs.js +2 -79
  79. package/dist/pkt-button.cjs +1 -1
  80. package/dist/pkt-button.js +2 -6
  81. package/dist/pkt-calendar.cjs +1 -1
  82. package/dist/pkt-calendar.js +2 -6
  83. package/dist/pkt-card.cjs +1 -1
  84. package/dist/pkt-card.js +2 -6
  85. package/dist/pkt-checkbox.cjs +1 -1
  86. package/dist/pkt-checkbox.js +2 -6
  87. package/dist/pkt-combobox.cjs +1 -1
  88. package/dist/pkt-combobox.js +2 -6
  89. package/dist/pkt-consent.cjs +1 -1
  90. package/dist/pkt-consent.js +2 -6
  91. package/dist/pkt-datepicker.cjs +1 -1
  92. package/dist/pkt-datepicker.js +5 -10
  93. package/dist/pkt-header.cjs +1 -304
  94. package/dist/pkt-header.js +2 -855
  95. package/dist/pkt-heading.cjs +1 -1
  96. package/dist/pkt-heading.js +2 -6
  97. package/dist/pkt-helptext.cjs +1 -1
  98. package/dist/pkt-helptext.js +2 -6
  99. package/dist/pkt-icon.cjs +1 -1
  100. package/dist/pkt-icon.js +2 -6
  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 -6
  105. package/dist/pkt-link.cjs +1 -1
  106. package/dist/pkt-link.js +2 -6
  107. package/dist/pkt-linkcard.cjs +1 -1
  108. package/dist/pkt-linkcard.js +2 -6
  109. package/dist/pkt-listbox.cjs +1 -1
  110. package/dist/pkt-listbox.js +2 -6
  111. package/dist/pkt-loader.cjs +1 -1
  112. package/dist/pkt-loader.js +2 -6
  113. package/dist/pkt-messagebox.cjs +1 -1
  114. package/dist/pkt-messagebox.js +2 -6
  115. package/dist/pkt-modal.cjs +1 -1
  116. package/dist/pkt-modal.js +2 -6
  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 -6
  121. package/dist/pkt-radiobutton.cjs +1 -1
  122. package/dist/pkt-radiobutton.js +2 -6
  123. package/dist/pkt-select.cjs +1 -1
  124. package/dist/pkt-select.js +2 -6
  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 -6
  129. package/dist/pkt-textarea.cjs +1 -1
  130. package/dist/pkt-textarea.js +2 -6
  131. package/dist/pkt-textinput.cjs +1 -1
  132. package/dist/pkt-textinput.js +2 -6
  133. package/dist/pkt-timepicker.cjs +1 -191
  134. package/dist/pkt-timepicker.js +2 -558
  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/accordion/accordion.ts +6 -1
  159. package/src/components/accordion/accordionitem.ts +6 -1
  160. package/src/components/alert/alert.test.ts +1 -1
  161. package/src/components/alert/alert.ts +12 -7
  162. package/src/components/backlink/backlink.ts +6 -1
  163. package/src/components/breadcrumbs/breadcrumbs.ts +6 -1
  164. package/src/components/button/button.ts +6 -1
  165. package/src/components/calendar/calendar.ts +6 -1
  166. package/src/components/card/card.ts +6 -1
  167. package/src/components/checkbox/checkbox.ts +6 -1
  168. package/src/components/combobox/combobox.ts +6 -1
  169. package/src/components/consent/consent.ts +6 -1
  170. package/src/components/datepicker/date-tags.ts +6 -1
  171. package/src/components/datepicker/datepicker-multiple.ts +6 -1
  172. package/src/components/datepicker/datepicker-popup.ts +6 -1
  173. package/src/components/datepicker/datepicker-range.ts +6 -1
  174. package/src/components/datepicker/datepicker-single.ts +6 -1
  175. package/src/components/datepicker/datepicker-utils.test.ts +16 -23
  176. package/src/components/datepicker/datepicker.ts +6 -1
  177. package/src/components/header/header-service.ts +6 -1
  178. package/src/components/header/header-user-menu.ts +6 -1
  179. package/src/components/header/header.ts +6 -1
  180. package/src/components/heading/heading.ts +6 -1
  181. package/src/components/helptext/helptext.ts +6 -1
  182. package/src/components/icon/icon.ts +6 -1
  183. package/src/components/input-wrapper/input-wrapper.ts +6 -1
  184. package/src/components/link/link.ts +6 -1
  185. package/src/components/linkcard/linkcard.ts +6 -1
  186. package/src/components/listbox/listbox.ts +6 -1
  187. package/src/components/loader/loader.ts +6 -1
  188. package/src/components/messagebox/messagebox.ts +6 -1
  189. package/src/components/modal/modal.ts +6 -1
  190. package/src/components/progressbar/progressbar.ts +6 -1
  191. package/src/components/radiobutton/radiobutton.ts +6 -1
  192. package/src/components/select/select.ts +6 -1
  193. package/src/components/tabs/tabitem.ts +6 -1
  194. package/src/components/tabs/tabs.ts +6 -1
  195. package/src/components/tag/tag.ts +6 -1
  196. package/src/components/textarea/textarea.ts +6 -1
  197. package/src/components/textinput/textinput.ts +6 -1
  198. package/src/components/timepicker/timepicker.ts +6 -1
  199. package/dist/accordionitem-D1Agl1bB.cjs +0 -34
  200. package/dist/accordionitem-ZlaXvjt5.js +0 -138
  201. package/dist/alert-BuAXrnKl.js +0 -115
  202. package/dist/alert-DFkFNTxh.cjs +0 -33
  203. package/dist/async-directive-CMzWMlZ5.js +0 -65
  204. package/dist/async-directive-DoMuclel.cjs +0 -5
  205. package/dist/backlink-EiAXUUZP.cjs +0 -13
  206. package/dist/backlink-V4DAt17e.js +0 -47
  207. package/dist/booleanish-BKVonob4.cjs +0 -1
  208. package/dist/booleanish-C9R0tdXH.js +0 -11
  209. package/dist/button-DEyvt1LI.js +0 -137
  210. package/dist/button-DYv5Dg4M.cjs +0 -27
  211. package/dist/calendar-HIE9nxcc.cjs +0 -90
  212. package/dist/calendar-S63oreVW.js +0 -2138
  213. package/dist/card-CyeH6l1c.cjs +0 -87
  214. package/dist/card-DDiLfuO4.js +0 -231
  215. package/dist/checkbox-BLlwTABj.cjs +0 -31
  216. package/dist/checkbox-ejBUa5qQ.js +0 -145
  217. package/dist/class-map-CEnykyO_.js +0 -34
  218. package/dist/class-map-CsENJXf1.cjs +0 -5
  219. package/dist/classutils-BwNK82ZQ.cjs +0 -1
  220. package/dist/classutils-RQs1k6D9.js +0 -7
  221. package/dist/combobox-BmxSecfE.js +0 -818
  222. package/dist/combobox-Hb2V-fPX.cjs +0 -135
  223. package/dist/consent-iXyx5v6J.js +0 -173
  224. package/dist/consent-ruWAEVXW.cjs +0 -11
  225. package/dist/datepicker-CZl7b8Na.js +0 -1158
  226. package/dist/datepicker-D2H7U6MS.cjs +0 -273
  227. package/dist/dialog-polyfill.esm-CPKZe7AL.cjs +0 -1
  228. package/dist/dialog-polyfill.esm-CbjBMXAG.js +0 -395
  229. package/dist/directive-C7oCP5Bh.cjs +0 -5
  230. package/dist/directive-helpers-BP2WOx60.cjs +0 -5
  231. package/dist/directive-helpers-rm-28gIj.js +0 -38
  232. package/dist/directive-oAbCiebi.js +0 -27
  233. package/dist/element-CPpT3rFQ.js +0 -638
  234. package/dist/element-gR_VtSiD.cjs +0 -27
  235. package/dist/element-with-slot-Dqk6-TRR.js +0 -240
  236. package/dist/element-with-slot-ZX-up7jO.cjs +0 -1
  237. package/dist/heading-CKt7cVn7.js +0 -101
  238. package/dist/heading-Cvz8m1xL.cjs +0 -1
  239. package/dist/helptext-5Mzp65-F.cjs +0 -24
  240. package/dist/helptext-jIoWRcCF.js +0 -80
  241. package/dist/icon-BlKA8YuW.js +0 -103
  242. package/dist/icon-Bqj9oBbl.cjs +0 -9
  243. package/dist/if-defined-B0krMLad.js +0 -10
  244. package/dist/if-defined-BOW3ODSj.cjs +0 -5
  245. package/dist/input-element-8nLwuQS4.js +0 -837
  246. package/dist/input-element-DdVhUvva.cjs +0 -1
  247. package/dist/input-wrapper-B0MkQ0IZ.cjs +0 -54
  248. package/dist/input-wrapper-B2JpK016.js +0 -179
  249. package/dist/input-wrapper-CDgenrYA.js +0 -6
  250. package/dist/input-wrapper-EoSAbU-U.cjs +0 -1
  251. package/dist/link-R_lNhViF.cjs +0 -7
  252. package/dist/link-Z_GizclR.js +0 -53
  253. package/dist/linkcard-BlQvdB1a.js +0 -54
  254. package/dist/linkcard-C7HbSLlX.cjs +0 -13
  255. package/dist/listbox-BQKDZvZn.js +0 -438
  256. package/dist/listbox-CGgV9MAe.cjs +0 -106
  257. package/dist/loader-Ci3CHU8k.js +0 -93
  258. package/dist/loader-e2gs_1xz.cjs +0 -16
  259. package/dist/messagebox-Bf-XMlvW.js +0 -69
  260. package/dist/messagebox-D67w71VX.cjs +0 -13
  261. package/dist/modal-CyvEkbfQ.cjs +0 -36
  262. package/dist/modal-DzGe1g8Z.js +0 -154
  263. package/dist/pkt-options-controller-5LXbEzuk.cjs +0 -1
  264. package/dist/pkt-options-controller-B5YalfCb.js +0 -39
  265. package/dist/progressbar-By7e0lEI.js +0 -162
  266. package/dist/progressbar-DsJ2B9Vm.cjs +0 -21
  267. package/dist/radiobutton-6frNG9J_.js +0 -111
  268. package/dist/radiobutton-Bv-BZ1Hw.cjs +0 -31
  269. package/dist/ref-Bg_Swj5w.js +0 -42
  270. package/dist/ref-CL-Xk9Xm.cjs +0 -5
  271. package/dist/repeat-BD8TKgJb.js +0 -61
  272. package/dist/repeat-Cfq8CDlf.cjs +0 -5
  273. package/dist/select-CXZt1nHS.js +0 -228
  274. package/dist/select-WFhS4Vfp.cjs +0 -49
  275. package/dist/state-C_1EOo3D.js +0 -12
  276. package/dist/state-Dg-53wQ8.cjs +0 -5
  277. package/dist/tabitem-CB8wkKmv.js +0 -332
  278. package/dist/tabitem-DZpspU4Q.cjs +0 -65
  279. package/dist/tag-BuCpqaks.js +0 -115
  280. package/dist/tag-X6xdjR0N.cjs +0 -27
  281. package/dist/textarea-Bzuymclz.js +0 -131
  282. package/dist/textarea-DoeHJ7HR.cjs +0 -50
  283. package/dist/textinput-9lHjs4ce.js +0 -150
  284. package/dist/textinput-BNsLd26i.cjs +0 -70
  285. package/dist/utils-DznhwRXm.js +0 -8
  286. package/dist/utils-byXsEz1u.cjs +0 -1
@@ -1,855 +1,2 @@
1
- import { P as M, s as S } from "./element-with-slot-Dqk6-TRR.js";
2
- import { P as C, A as l, b as n, n as s, t as _ } from "./element-CPpT3rFQ.js";
3
- import { o as $ } from "./if-defined-B0krMLad.js";
4
- import { b as d } from "./booleanish-C9R0tdXH.js";
5
- import { r as k } from "./state-C_1EOo3D.js";
6
- import { e as g } from "./class-map-CEnykyO_.js";
7
- import { e as f, n as y } from "./ref-Bg_Swj5w.js";
8
- import "./button-DEyvt1LI.js";
9
- import "./icon-BlKA8YuW.js";
10
- import "./link-Z_GizclR.js";
11
- import "./textinput-9lHjs4ce.js";
12
- const L = (e) => typeof e.target == "string" ? { title: e.title, iconName: e.iconName, href: e.target } : { title: e.title, iconName: e.iconName, onClick: e.target }, w = (e) => L(e), O = (e) => {
13
- if (!e) return;
14
- const t = typeof e == "string" ? new Date(e) : e;
15
- if (!isNaN(t.getTime()))
16
- return t.toLocaleDateString("nb-NO", {
17
- day: "numeric",
18
- month: "long",
19
- year: "numeric",
20
- hour: "2-digit",
21
- minute: "2-digit"
22
- });
23
- };
24
- var R = Object.defineProperty, B = Object.getOwnPropertyDescriptor, b = (e, t, i, u) => {
25
- for (var a = u > 1 ? void 0 : u ? B(t, i) : t, p = e.length - 1, m; p >= 0; p--)
26
- (m = e[p]) && (a = (u ? m(t, i, a) : m(a)) || a);
27
- return u && a && R(t, i, a), a;
28
- };
29
- let v = class extends C {
30
- constructor() {
31
- super(...arguments), this.canChangeRepresentation = !1, this.logoutOnClick = !1;
32
- }
33
- handleChangeRepresentation() {
34
- this.dispatchEvent(
35
- new CustomEvent("change-representation", {
36
- bubbles: !0,
37
- composed: !0
38
- })
39
- );
40
- }
41
- handleLogout() {
42
- this.dispatchEvent(
43
- new CustomEvent("log-out", {
44
- bubbles: !0,
45
- composed: !0
46
- })
47
- );
48
- }
49
- handleMenuItemClick(e) {
50
- "onClick" in e && typeof e.onClick == "function" && e.onClick();
51
- }
52
- renderLinkOrButton(e, t) {
53
- const i = "href" in e, u = g({
54
- "pkt-user-menu__link": !0,
55
- "pkt-link-button": !i,
56
- "pkt-link": !i,
57
- "pkt-link--icon-left": !i,
58
- [t || ""]: !!t
59
- });
60
- return i ? n`
61
- <pkt-link
62
- icon-name=${e.iconName || l}
63
- href=${e.href}
64
- aria-hidden="true"
65
- class="pkt-user-menu__link ${t || ""}"
66
- >
67
- ${e.title}
68
- </pkt-link>
69
- ` : n`
70
- <button class=${u} type="button" @click=${() => this.handleMenuItemClick(e)}>
71
- ${e.iconName ? n`<pkt-icon
72
- name=${e.iconName}
73
- class="pkt-link__icon"
74
- aria-hidden="true"
75
- ></pkt-icon>` : l}
76
- ${e.title}
77
- </button>
78
- `;
79
- }
80
- renderLinkSection(e) {
81
- return n`
82
- <ul class="pkt-user-menu__sublist">
83
- ${e.map(
84
- (t) => n`
85
- <li class="pkt-user-menu__subitem">${this.renderLinkOrButton(t)}</li>
86
- `
87
- )}
88
- </ul>
89
- `;
90
- }
91
- render() {
92
- var t;
93
- const e = (t = this.userMenu) == null ? void 0 : t.map(w);
94
- return n`
95
- <nav class="pkt-user-menu" aria-label="Meny for innlogget bruker">
96
- <ul class="pkt-user-menu__list">
97
- <!-- User section -->
98
- ${this.user ? n`
99
- <li class="pkt-user-menu__item">
100
- <div class="pkt-user-menu__label">Pålogget som</div>
101
- <div class="pkt-user-menu__name" translate="no">${this.user.name}</div>
102
- ${this.formattedLastLoggedIn ? n`
103
- <div class="pkt-user-menu__last-logged-in">
104
- Sist pålogget: <time>${this.formattedLastLoggedIn}</time>
105
- </div>
106
- ` : l}
107
- </li>
108
- ` : l}
109
-
110
- <!-- User menu items -->
111
- ${e && e.length > 0 ? n`
112
- <li class="pkt-user-menu__item">${this.renderLinkSection(e)}</li>
113
- ` : l}
114
-
115
- <!-- Representing section -->
116
- ${this.representing ? n`
117
- <li class="pkt-user-menu__item">
118
- <div class="pkt-user-menu__label">Representerer</div>
119
- <div class="pkt-user-menu__name" translate="no">${this.representing.name}</div>
120
- ${this.representing.orgNumber ? n`<div class="pkt-user-menu__org-number">
121
- Org.nr. ${this.representing.orgNumber}
122
- </div>` : l}
123
- ${this.canChangeRepresentation ? n`
124
- <ul class="pkt-user-menu__sublist mt-size-16">
125
- <li class="pkt-user-menu__subitem">
126
- ${this.renderLinkOrButton({
127
- title: "Endre organisasjon",
128
- iconName: "cogwheel",
129
- onClick: () => this.handleChangeRepresentation()
130
- })}
131
- </li>
132
- </ul>
133
- ` : l}
134
- </li>
135
- ` : l}
136
-
137
- <!-- Change representation without representing object -->
138
- ${!this.representing && this.canChangeRepresentation ? n`
139
- <li class="pkt-user-menu__item">
140
- <ul class="pkt-user-menu__sublist">
141
- <li class="pkt-user-menu__subitem">
142
- ${this.renderLinkOrButton({
143
- title: "Endre organisasjon",
144
- iconName: "cogwheel",
145
- onClick: () => this.handleChangeRepresentation()
146
- })}
147
- </li>
148
- </ul>
149
- </li>
150
- ` : l}
151
-
152
- <!-- Logout -->
153
- ${this.logoutOnClick ? n`
154
- <li class="pkt-user-menu__item">
155
- ${this.renderLinkOrButton({
156
- title: "Logg ut",
157
- iconName: "exit",
158
- onClick: () => this.handleLogout()
159
- })}
160
- </li>
161
- ` : l}
162
- </ul>
163
- </nav>
164
- `;
165
- }
166
- };
167
- b([
168
- s({ type: Object })
169
- ], v.prototype, "user", 2);
170
- b([
171
- s({ type: String, attribute: "formatted-last-logged-in" })
172
- ], v.prototype, "formattedLastLoggedIn", 2);
173
- b([
174
- s({ type: Object })
175
- ], v.prototype, "representing", 2);
176
- b([
177
- s({ type: Array, attribute: "user-menu" })
178
- ], v.prototype, "userMenu", 2);
179
- b([
180
- s({
181
- type: Boolean,
182
- attribute: "can-change-representation",
183
- converter: d
184
- })
185
- ], v.prototype, "canChangeRepresentation", 2);
186
- b([
187
- s({ type: Boolean, attribute: "logout-on-click", converter: d })
188
- ], v.prototype, "logoutOnClick", 2);
189
- v = b([
190
- _("pkt-header-user-menu")
191
- ], v);
192
- var E = Object.defineProperty, P = Object.getOwnPropertyDescriptor, r = (e, t, i, u) => {
193
- for (var a = u > 1 ? void 0 : u ? P(t, i) : t, p = e.length - 1, m; p >= 0; p--)
194
- (m = e[p]) && (a = (u ? m(t, i, a) : m(a)) || a);
195
- return u && a && E(t, i, a), a;
196
- };
197
- const x = "https://punkt-cdn.oslo.kommune.no/latest/logos/";
198
- let o = class extends M {
199
- constructor() {
200
- super(...arguments), 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 = f(), this.userContainerRef = f(), this.slotContainerRef = f(), this.searchContainerRef = f(), this.slotContentRef = f(), this.searchMenuRef = f(), this.lastScrollPosition = 0, this.savedScrollY = 0, this.lastFocusedElement = null, this.shouldRestoreFocus = !1, this.handleScroll = () => {
201
- if (!this.shouldHideOnScroll) return;
202
- const e = window.pageYOffset || document.documentElement.scrollTop;
203
- e < 0 || Math.abs(e - this.lastScrollPosition) < 60 || (this.isHidden = e > this.lastScrollPosition, this.lastScrollPosition = e);
204
- }, this.handleClickOutside = (e) => {
205
- const t = e.target;
206
- 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");
207
- }, this.handleFocusOut = (e, t) => {
208
- const i = e.relatedTarget;
209
- let u;
210
- switch (t) {
211
- case "user":
212
- u = this.userContainerRef;
213
- break;
214
- case "slot":
215
- u = this.slotContainerRef;
216
- break;
217
- case "search":
218
- u = this.searchContainerRef;
219
- break;
220
- default:
221
- return;
222
- }
223
- const a = u.value;
224
- a && (!i || !a.contains(i)) && (this.openMenu = "none");
225
- }, this.handleEscapeKey = (e) => {
226
- e.key === "Escape" && this.openMenu !== "none" && (e.preventDefault(), this.shouldRestoreFocus = !0, this.openMenu = "none");
227
- };
228
- }
229
- connectedCallback() {
230
- super.connectedCallback(), this.setupScrollListener();
231
- }
232
- disconnectedCallback() {
233
- var e;
234
- super.disconnectedCallback(), (e = this.resizeObserver) == null || e.disconnect(), window.removeEventListener("scroll", this.handleScroll), this.unlockScroll();
235
- }
236
- firstUpdated() {
237
- this.setupResizeObserver();
238
- }
239
- updated(e) {
240
- 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")) {
241
- const t = e.get("openMenu");
242
- 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(() => {
243
- this.checkDropdownAlignment(this.openMenu);
244
- })) : this.openMenu === "none" && t !== "none" && (document.removeEventListener("mousedown", this.handleClickOutside), document.removeEventListener("keydown", this.handleEscapeKey), this.restoreFocus());
245
- }
246
- (e.has("openMenu") || e.has("isMobile")) && this.updateScrollLock();
247
- }
248
- setupResizeObserver() {
249
- const e = this.headerRef.value;
250
- e && (this.componentWidth = e.offsetWidth, this.updateIsMobile(), this.updateIsTablet(), this.resizeObserver = new ResizeObserver((t) => {
251
- for (const i of t)
252
- i.borderBoxSize && i.borderBoxSize.length > 0 ? this.componentWidth = i.borderBoxSize[0].inlineSize : this.componentWidth = i.contentRect.width, this.updateIsMobile(), this.updateIsTablet();
253
- }), this.resizeObserver.observe(e));
254
- }
255
- updateIsMobile() {
256
- this.isMobile = this.componentWidth < this.mobileBreakpoint;
257
- }
258
- updateIsTablet() {
259
- this.isTablet = this.componentWidth < this.tabletBreakpoint;
260
- }
261
- updateScrollLock() {
262
- this.position === "fixed" && this.isMobile && this.openMenu !== "none" ? this.lockScroll() : this.unlockScroll();
263
- }
264
- lockScroll() {
265
- const e = document.body, t = document.documentElement;
266
- this.savedScrollY = window.scrollY || window.pageYOffset;
267
- const i = window.innerWidth - t.clientWidth;
268
- i > 0 && (e.style.paddingRight = `${i}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");
269
- }
270
- unlockScroll() {
271
- const e = document.body, t = document.documentElement;
272
- 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 }));
273
- }
274
- setupScrollListener() {
275
- window.addEventListener("scroll", this.handleScroll);
276
- }
277
- restoreFocus() {
278
- this.shouldRestoreFocus && this.lastFocusedElement && document.contains(this.lastFocusedElement) && this.lastFocusedElement.focus(), this.lastFocusedElement = null, this.shouldRestoreFocus = !1;
279
- }
280
- checkDropdownAlignment(e) {
281
- const t = e === "slot" ? this.slotContainerRef : this.searchContainerRef, i = e === "slot" ? this.slotContentRef : this.searchMenuRef;
282
- if (!t.value || !i.value || !this.isTablet || this.isMobile) return;
283
- const u = t.value.getBoundingClientRect(), a = i.value.offsetWidth, p = u.left + a > window.innerWidth;
284
- e === "slot" ? this.alignSlotRight = p : this.alignSearchRight = p;
285
- }
286
- handleMenuToggle(e) {
287
- this.openMenu !== "none" ? this.openMenu = "none" : (this.lastFocusedElement = document.activeElement, this.openMenu = e);
288
- }
289
- handleLogoClick(e) {
290
- this.dispatchEvent(
291
- new CustomEvent("logo-click", {
292
- bubbles: !0,
293
- composed: !0,
294
- detail: { originalEvent: e }
295
- })
296
- );
297
- }
298
- handleServiceClick(e) {
299
- this.dispatchEvent(
300
- new CustomEvent("service-click", {
301
- bubbles: !0,
302
- composed: !0,
303
- detail: { originalEvent: e }
304
- })
305
- );
306
- }
307
- handleLogout() {
308
- this.dispatchEvent(
309
- new CustomEvent("log-out", {
310
- bubbles: !0,
311
- composed: !0
312
- })
313
- );
314
- }
315
- handleSearch(e) {
316
- this.dispatchEvent(
317
- new CustomEvent("search", {
318
- detail: { query: e },
319
- bubbles: !0,
320
- composed: !0
321
- })
322
- );
323
- }
324
- handleSearchChange(e) {
325
- this.dispatchEvent(
326
- new CustomEvent("search-change", {
327
- detail: { query: e },
328
- bubbles: !0,
329
- composed: !0
330
- })
331
- );
332
- }
333
- handleSearchInputChange(e) {
334
- const t = e.target.value;
335
- this.handleSearchChange(t);
336
- }
337
- handleSearchKeyDown(e) {
338
- e.key === "Enter" && this.handleSearch(e.target.value);
339
- }
340
- get formattedLastLoggedIn() {
341
- var e;
342
- return O((e = this.user) == null ? void 0 : e.lastLoggedIn);
343
- }
344
- get isFixed() {
345
- return this.position === "fixed";
346
- }
347
- get shouldHideOnScroll() {
348
- return this.scrollBehavior === "hide";
349
- }
350
- get showLogoutInHeader() {
351
- return this.hasLogOut && (this.logOutButtonPlacement === "header" || this.logOutButtonPlacement === "both");
352
- }
353
- get showLogoutInUserMenu() {
354
- return this.hasLogOut && (this.logOutButtonPlacement === "userMenu" || this.logOutButtonPlacement === "both");
355
- }
356
- renderLogo() {
357
- if (this.hideLogo) return l;
358
- const e = n`
359
- <pkt-icon name="oslologo" aria-hidden="true" path=${x}></pkt-icon>
360
- `;
361
- return this.logoLink && typeof this.logoLink == "string" ? n`
362
- <span class="pkt-header-service__logo">
363
- <a href=${this.logoLink} aria-label="Tilbake til forside" @click=${this.handleLogoClick}>
364
- ${e}
365
- </a>
366
- </span>
367
- ` : this.hasAttribute("logo-link") ? n`
368
- <span class="pkt-header-service__logo">
369
- <button
370
- aria-label="Tilbake til forside"
371
- class="pkt-link-button pkt-link pkt-header-service__logo-link"
372
- @click=${this.handleLogoClick}
373
- >
374
- ${e}
375
- </button>
376
- </span>
377
- ` : n`
378
- <span class="pkt-header-service__logo" @click=${this.handleLogoClick}>${e}</span>
379
- `;
380
- }
381
- renderServiceName() {
382
- return this.serviceName ? this.serviceLink && typeof this.serviceLink == "string" ? n`
383
- <span class="pkt-header-service__service-name">
384
- <pkt-link
385
- href=${this.serviceLink}
386
- class="pkt-header-service__service-link"
387
- @click=${this.handleServiceClick}
388
- >
389
- ${this.serviceName}
390
- </pkt-link>
391
- </span>
392
- ` : this.hasAttribute("service-link") ? n`
393
- <span class="pkt-header-service__service-name">
394
- <button
395
- class="pkt-link-button pkt-link pkt-header-service__service-link"
396
- @click=${this.handleServiceClick}
397
- >
398
- ${this.serviceName}
399
- </button>
400
- </span>
401
- ` : n`
402
- <span class="pkt-header-service__service-name" @click=${this.handleServiceClick}>
403
- <span class="pkt-header-service__service-link">${this.serviceName}</span>
404
- </span>
405
- ` : l;
406
- }
407
- renderSlotContainer() {
408
- if (!this.hasSlotContent()) return l;
409
- const e = g({
410
- "pkt-header-service__slot-container": !0,
411
- "is-open": this.openMenu === "slot"
412
- }), t = g({
413
- "pkt-header-service__slot-content": !0,
414
- "align-right": this.alignSlotRight
415
- });
416
- return n`
417
- <div
418
- class=${e}
419
- @focusout=${(i) => this.handleFocusOut(i, "slot")}
420
- ${y(this.slotContainerRef)}
421
- >
422
- ${this.isTablet && this.hasSlotContent() ? n`
423
- <pkt-button
424
- skin="secondary"
425
- variant=${this.slotMenuVariant}
426
- iconName="menu"
427
- size=${this.isMobile ? "small" : "medium"}
428
- state=${this.openMenu === "slot" ? "active" : "normal"}
429
- @click=${() => this.handleMenuToggle("slot")}
430
- aria-expanded=${this.openMenu === "slot"}
431
- aria-controls="mobile-slot-menu"
432
- aria-label="Åpne meny"
433
- >
434
- ${this.slotMenuText}
435
- </pkt-button>
436
- ` : l}
437
- <div
438
- class=${t}
439
- id="mobile-slot-menu"
440
- role=${this.isTablet ? "menu" : l}
441
- aria-label=${this.isTablet ? "Meny" : l}
442
- ${y(this.slotContentRef)}
443
- >
444
- ${S(this)}
445
- </div>
446
- </div>
447
- `;
448
- }
449
- renderSearch() {
450
- if (!this.showSearch) return l;
451
- if (this.isTablet) {
452
- const e = g({
453
- "pkt-header-service__search-container": !0,
454
- "is-open": this.openMenu === "search"
455
- }), t = g({
456
- "pkt-header-service__mobile-menu": !0,
457
- "is-open": this.openMenu === "search",
458
- "align-right": this.alignSearchRight
459
- });
460
- return n`
461
- <div
462
- class=${e}
463
- @focusout=${(i) => this.handleFocusOut(i, "search")}
464
- ${y(this.searchContainerRef)}
465
- >
466
- <pkt-button
467
- skin="secondary"
468
- variant="icon-only"
469
- iconName="magnifying-glass-big"
470
- size=${this.isMobile ? "small" : "medium"}
471
- @click=${() => this.handleMenuToggle("search")}
472
- state=${this.openMenu === "search" ? "active" : "normal"}
473
- aria-expanded=${this.openMenu === "search"}
474
- aria-controls="mobile-search-menu"
475
- aria-label="Åpne søkefelt"
476
- >
477
- Søk
478
- </pkt-button>
479
- <div class=${t} ${y(this.searchMenuRef)}>
480
- ${this.openMenu === "search" ? n`
481
- <pkt-textinput
482
- id="mobile-search-menu"
483
- class="pkt-header-service__search-input"
484
- type="search"
485
- label="Søk"
486
- useWrapper="false"
487
- placeholder=${this.searchPlaceholder}
488
- value=${this.searchValue}
489
- autofocus
490
- fullwidth
491
- @input=${this.handleSearchInputChange}
492
- @keydown=${(i) => {
493
- i.key === "Enter" && this.handleSearch(i.target.value);
494
- }}
495
- ></pkt-textinput>
496
- ` : l}
497
- </div>
498
- </div>
499
- `;
500
- }
501
- return n`
502
- <pkt-textinput
503
- id="header-service-search"
504
- class="pkt-header-service__search-input"
505
- type="search"
506
- label="Søk"
507
- useWrapper="false"
508
- placeholder=${this.searchPlaceholder}
509
- value=${this.searchValue}
510
- @input=${this.handleSearchInputChange}
511
- @keydown=${this.handleSearchKeyDown}
512
- ></pkt-textinput>
513
- `;
514
- }
515
- renderUserButton() {
516
- var t;
517
- if (!this.user) return l;
518
- const e = g({
519
- "pkt-header-service__user-menu": this.isMobile === !1,
520
- "pkt-header-service__mobile-menu": this.isMobile === !0,
521
- "is-open": this.openMenu === "user"
522
- });
523
- return n`
524
- <div
525
- class="pkt-header-service__user-container"
526
- @focusout=${(i) => this.handleFocusOut(i, "user")}
527
- ${y(this.userContainerRef)}
528
- >
529
- <pkt-button
530
- class=${g({
531
- "pkt-header-service__user-button": !0,
532
- "pkt-header-service__user-button--mobile": this.isMobile
533
- })}
534
- skin="secondary"
535
- size=${this.isMobile ? "small" : "medium"}
536
- state=${this.openMenu === "user" ? "active" : "normal"}
537
- variant="icons-right-and-left"
538
- iconName="user"
539
- secondIconName=${this.openMenu === "user" ? "chevron-thin-up" : "chevron-thin-down"}
540
- @click=${() => this.handleMenuToggle("user")}
541
- >
542
- <span class="pkt-sr-only">Brukermeny: </span>
543
- <span>${((t = this.representing) == null ? void 0 : t.name) || this.user.name}</span>
544
- </pkt-button>
545
- ${this.openMenu === "user" && this.user ? n`
546
- <div class=${e}>
547
- <pkt-header-user-menu
548
- .user=${this.user}
549
- formatted-last-logged-in=${this.formattedLastLoggedIn || l}
550
- .representing=${this.representing}
551
- .userMenu=${this.userMenu}
552
- ?can-change-representation=${this.canChangeRepresentation}
553
- ?logout-on-click=${this.showLogoutInUserMenu}
554
- @change-representation=${() => this.dispatchEvent(
555
- new CustomEvent("change-representation", { bubbles: !0, composed: !0 })
556
- )}
557
- @log-out=${this.handleLogout}
558
- ></pkt-header-user-menu>
559
- </div>
560
- ` : l}
561
- </div>
562
- `;
563
- }
564
- renderHeader() {
565
- const e = g({
566
- "pkt-header-service": !0,
567
- "pkt-header-service--compact": this.compact,
568
- "pkt-header-service--mobile": this.isMobile,
569
- "pkt-header-service--tablet": this.isTablet,
570
- "pkt-header-service--fixed": this.isFixed,
571
- "pkt-header-service--scroll-to-hide": this.shouldHideOnScroll,
572
- "pkt-header-service--hidden": this.isHidden
573
- }), t = g({
574
- "pkt-header-service__logo-area": !0,
575
- "pkt-header-service__logo-area--without-service": !this.serviceName
576
- });
577
- return n`
578
- <header class=${e} ${y(this.headerRef)}>
579
- <div class=${t}>${this.renderLogo()} ${this.renderServiceName()}</div>
580
-
581
- ${this.hasSlotContent() || this.showSearch || this.showLogoutInHeader ? n`<div class="pkt-header-service__content">
582
- ${this.renderSlotContainer()} ${this.renderSearch()}
583
- ${this.isTablet && this.showLogoutInHeader ? n`
584
- <pkt-button
585
- skin="secondary"
586
- size=${this.isMobile ? "small" : "medium"}
587
- variant="icon-only"
588
- iconName="exit"
589
- @click=${this.handleLogout}
590
- >
591
- Logg ut
592
- </pkt-button>
593
- ` : l}
594
- </div>` : l}
595
- ${this.user || !this.isTablet && this.showLogoutInHeader ? n`<div class="pkt-header-service__user">
596
- ${this.renderUserButton()}
597
- ${!this.isTablet && this.showLogoutInHeader ? n`
598
- <pkt-button
599
- skin="tertiary"
600
- size="medium"
601
- variant="icon-right"
602
- iconName="exit"
603
- @click=${this.handleLogout}
604
- >
605
- Logg ut
606
- </pkt-button>
607
- ` : l}
608
- </div>` : l}
609
- </header>
610
- `;
611
- }
612
- render() {
613
- const e = this.renderHeader();
614
- if (this.isFixed) {
615
- const t = g({
616
- "pkt-header-service-spacer": !0,
617
- "pkt-header-service-spacer--compact": this.compact,
618
- "pkt-header-service-spacer--has-user": !!this.user,
619
- "pkt-header-service-spacer--mobile": this.isMobile
620
- });
621
- return n`
622
- <div class="pkt-header-service-wrapper">
623
- ${e}
624
- <div class=${t}></div>
625
- </div>
626
- `;
627
- }
628
- return e;
629
- }
630
- };
631
- r([
632
- s({ type: String, attribute: "service-name" })
633
- ], o.prototype, "serviceName", 2);
634
- r([
635
- s({ type: String, attribute: "service-link" })
636
- ], o.prototype, "serviceLink", 2);
637
- r([
638
- s({ type: String, attribute: "logo-link" })
639
- ], o.prototype, "logoLink", 2);
640
- r([
641
- s({ type: String, attribute: "search-placeholder" })
642
- ], o.prototype, "searchPlaceholder", 2);
643
- r([
644
- s({ type: String, attribute: "search-value" })
645
- ], o.prototype, "searchValue", 2);
646
- r([
647
- s({ type: Number, attribute: "mobile-breakpoint" })
648
- ], o.prototype, "mobileBreakpoint", 2);
649
- r([
650
- s({ type: Number, attribute: "tablet-breakpoint" })
651
- ], o.prototype, "tabletBreakpoint", 2);
652
- r([
653
- s({ type: String, attribute: "opened-menu" })
654
- ], o.prototype, "openedMenu", 2);
655
- r([
656
- s({ type: String, attribute: "log-out-button-placement" })
657
- ], o.prototype, "logOutButtonPlacement", 2);
658
- r([
659
- s({ type: String })
660
- ], o.prototype, "position", 2);
661
- r([
662
- s({ type: String, attribute: "scroll-behavior" })
663
- ], o.prototype, "scrollBehavior", 2);
664
- r([
665
- s({ type: String, attribute: "slot-menu-variant" })
666
- ], o.prototype, "slotMenuVariant", 2);
667
- r([
668
- s({ type: String, attribute: "slot-menu-text" })
669
- ], o.prototype, "slotMenuText", 2);
670
- r([
671
- s({ type: Boolean, attribute: "hide-logo", converter: d })
672
- ], o.prototype, "hideLogo", 2);
673
- r([
674
- s({ type: Boolean, converter: d })
675
- ], o.prototype, "compact", 2);
676
- r([
677
- s({ type: Boolean, attribute: "show-search", converter: d })
678
- ], o.prototype, "showSearch", 2);
679
- r([
680
- s({
681
- type: Boolean,
682
- attribute: "can-change-representation",
683
- converter: d
684
- })
685
- ], o.prototype, "canChangeRepresentation", 2);
686
- r([
687
- s({ type: Boolean, attribute: "has-log-out", converter: d })
688
- ], o.prototype, "hasLogOut", 2);
689
- r([
690
- s({ type: Object })
691
- ], o.prototype, "user", 2);
692
- r([
693
- s({ type: Array, attribute: "user-menu" })
694
- ], o.prototype, "userMenu", 2);
695
- r([
696
- s({ type: Object })
697
- ], o.prototype, "representing", 2);
698
- r([
699
- k()
700
- ], o.prototype, "isMobile", 2);
701
- r([
702
- k()
703
- ], o.prototype, "isTablet", 2);
704
- r([
705
- k()
706
- ], o.prototype, "openMenu", 2);
707
- r([
708
- k()
709
- ], o.prototype, "isHidden", 2);
710
- r([
711
- k()
712
- ], o.prototype, "componentWidth", 2);
713
- r([
714
- k()
715
- ], o.prototype, "alignSlotRight", 2);
716
- r([
717
- k()
718
- ], o.prototype, "alignSearchRight", 2);
719
- o = r([
720
- _("pkt-header-service")
721
- ], o);
722
- var N = Object.defineProperty, T = Object.getOwnPropertyDescriptor, c = (e, t, i, u) => {
723
- for (var a = u > 1 ? void 0 : u ? T(t, i) : t, p = e.length - 1, m; p >= 0; p--)
724
- (m = e[p]) && (a = (u ? m(t, i, a) : m(a)) || a);
725
- return u && a && N(t, i, a), a;
726
- };
727
- let h = class extends M {
728
- constructor() {
729
- super(...arguments), 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;
730
- }
731
- firstUpdated(e) {
732
- super.firstUpdated(e), this.emitDeprecationWarnings();
733
- }
734
- emitDeprecationWarnings() {
735
- 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.");
736
- }
737
- /**
738
- * Convert deprecated props to new props
739
- */
740
- get effectiveUserMenu() {
741
- const e = this.userMenu || [], t = this.userMenuFooter || [], i = this.userOptions || [];
742
- return t.length || i.length ? [...e, ...i, ...t] : this.userMenu;
743
- }
744
- render() {
745
- return n`
746
- <pkt-header-service
747
- service-name=${$(this.serviceName)}
748
- service-link=${$(this.serviceLink)}
749
- logo-link=${$(this.logoLink)}
750
- search-placeholder=${this.searchPlaceholder}
751
- search-value=${this.searchValue}
752
- mobile-breakpoint=${this.mobileBreakpoint}
753
- tablet-breakpoint=${this.tabletBreakpoint}
754
- opened-menu=${this.openedMenu}
755
- log-out-button-placement=${this.logOutButtonPlacement}
756
- position=${this.position}
757
- scroll-behavior=${this.scrollBehavior}
758
- slot-menu-variant=${this.slotMenuVariant}
759
- slot-menu-text=${this.slotMenuText}
760
- .hideLogo=${this.hideLogo}
761
- .compact=${this.compact}
762
- .showSearch=${this.showSearch}
763
- .canChangeRepresentation=${this.canChangeRepresentation}
764
- .hasLogOut=${this.hasLogOut}
765
- .user=${this.user}
766
- .userMenu=${this.effectiveUserMenu}
767
- .representing=${this.representing}
768
- >
769
- ${this.hasSlotContent() ? n`<div class="pkt-contents">${S(this)}</div>` : l}
770
- </pkt-header-service>
771
- `;
772
- }
773
- };
774
- c([
775
- s({ type: String, attribute: "service-name" })
776
- ], h.prototype, "serviceName", 2);
777
- c([
778
- s({ type: String, attribute: "service-link" })
779
- ], h.prototype, "serviceLink", 2);
780
- c([
781
- s({ type: String, attribute: "logo-link" })
782
- ], h.prototype, "logoLink", 2);
783
- c([
784
- s({ type: String, attribute: "search-placeholder" })
785
- ], h.prototype, "searchPlaceholder", 2);
786
- c([
787
- s({ type: String, attribute: "search-value" })
788
- ], h.prototype, "searchValue", 2);
789
- c([
790
- s({ type: Number, attribute: "mobile-breakpoint" })
791
- ], h.prototype, "mobileBreakpoint", 2);
792
- c([
793
- s({ type: Number, attribute: "tablet-breakpoint" })
794
- ], h.prototype, "tabletBreakpoint", 2);
795
- c([
796
- s({ type: String, attribute: "opened-menu" })
797
- ], h.prototype, "openedMenu", 2);
798
- c([
799
- s({ type: String, attribute: "log-out-button-placement" })
800
- ], h.prototype, "logOutButtonPlacement", 2);
801
- c([
802
- s({ type: String })
803
- ], h.prototype, "position", 2);
804
- c([
805
- s({ type: String, attribute: "scroll-behavior" })
806
- ], h.prototype, "scrollBehavior", 2);
807
- c([
808
- s({ type: String, attribute: "slot-menu-variant" })
809
- ], h.prototype, "slotMenuVariant", 2);
810
- c([
811
- s({ type: String, attribute: "slot-menu-text" })
812
- ], h.prototype, "slotMenuText", 2);
813
- c([
814
- s({ type: Boolean, attribute: "hide-logo", converter: d })
815
- ], h.prototype, "hideLogo", 2);
816
- c([
817
- s({ type: Boolean, converter: d })
818
- ], h.prototype, "compact", 2);
819
- c([
820
- s({ type: Boolean, attribute: "show-search", converter: d })
821
- ], h.prototype, "showSearch", 2);
822
- c([
823
- s({
824
- type: Boolean,
825
- attribute: "can-change-representation",
826
- converter: d
827
- })
828
- ], h.prototype, "canChangeRepresentation", 2);
829
- c([
830
- s({ type: Boolean, attribute: "has-log-out", converter: d })
831
- ], h.prototype, "hasLogOut", 2);
832
- c([
833
- s({ type: Object })
834
- ], h.prototype, "user", 2);
835
- c([
836
- s({ type: Array, attribute: "user-menu" })
837
- ], h.prototype, "userMenu", 2);
838
- c([
839
- s({ type: Object })
840
- ], h.prototype, "representing", 2);
841
- c([
842
- s({ type: Array, attribute: "user-menu-footer" })
843
- ], h.prototype, "userMenuFooter", 2);
844
- c([
845
- s({ type: Array, attribute: "user-options" })
846
- ], h.prototype, "userOptions", 2);
847
- h = c([
848
- _("pkt-header")
849
- ], h);
850
- export {
851
- h as PktHeader,
852
- o as PktHeaderService,
853
- v as PktHeaderUserMenu,
854
- O as formatLastLoggedIn
855
- };
1
+ import { i as e, n as t, r as n, t as r } from "./header-a6ztVNp3.js";
2
+ export { r as PktHeader, t as PktHeaderService, n as PktHeaderUserMenu, e as formatLastLoggedIn };