@oslokommune/punkt-elements 16.7.3 → 16.7.7
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.
- package/CHANGELOG.md +35 -0
- package/dist/accordion-BB1JrONI.cjs +34 -0
- package/dist/accordion-nNH87Y60.js +130 -0
- package/dist/alert-BEEnTiCb.cjs +33 -0
- package/dist/alert-ePJuDtmm.js +171 -0
- package/dist/async-directive-B9P1Qa0k.cjs +1 -0
- package/dist/async-directive-CaQiqjyV.js +55 -0
- package/dist/backlink-Ba03LlbB.cjs +13 -0
- package/dist/backlink-CiwXrQYD.js +38 -0
- package/dist/booleanish-BmcOU-43.js +11 -0
- package/dist/booleanish-jJLlnr6-.cjs +1 -0
- package/dist/breadcrumbs-CD1zib3s.cjs +43 -0
- package/dist/breadcrumbs-CpuVqWhF.js +76 -0
- package/dist/button-BIpd1xJh.js +95 -0
- package/dist/button-D-TOBaJB.cjs +27 -0
- package/dist/calendar-BzEtOJla.js +2031 -0
- package/dist/calendar-E5jJLt8D.cjs +90 -0
- package/dist/card-BYJu1MYm.js +339 -0
- package/dist/card-CUFhMVim.cjs +87 -0
- package/dist/checkbox-BARDb9iV.cjs +31 -0
- package/dist/checkbox-Cspxcvt_.js +111 -0
- package/dist/class-map-C8HuhNzZ.js +27 -0
- package/dist/class-map-CJ-msbHs.cjs +1 -0
- package/dist/classutils-DEL164Ur.js +7 -0
- package/dist/classutils-z8YsPlOf.cjs +1 -0
- package/dist/combobox-BcdLZRDU.js +984 -0
- package/dist/combobox-CGbFTWq_.cjs +135 -0
- package/dist/consent-DeB_5sWH.js +197 -0
- package/dist/consent-hwu7pp3S.cjs +11 -0
- package/dist/datepicker-DpmlsnH_.cjs +273 -0
- package/dist/datepicker-OVd8pmnZ.js +1125 -0
- package/dist/dialog-polyfill.esm-1hPr0gl9.js +280 -0
- package/dist/dialog-polyfill.esm-D3Oinvk0.cjs +1 -0
- package/dist/directive-3THFsVew.js +28 -0
- package/dist/directive-CJ2giQBZ.cjs +1 -0
- package/dist/directive-helpers-D1QSxY17.cjs +1 -0
- package/dist/directive-helpers-Dkv2gKgs.js +25 -0
- package/dist/element-DjtxO-1r.cjs +2 -0
- package/dist/element-cZ85T_aa.js +693 -0
- package/dist/element-with-slot-4J2o3SeU.js +166 -0
- package/dist/element-with-slot-CWoTGA1B.cjs +1 -0
- package/dist/header-DWgPgGfS.cjs +304 -0
- package/dist/header-a6ztVNp3.js +782 -0
- package/dist/heading-BgSWIRii.cjs +1 -0
- package/dist/heading-DiQLPxdf.js +73 -0
- package/dist/helptext-CCBKKLus.js +65 -0
- package/dist/helptext-D-3QfZv5.cjs +24 -0
- package/dist/icon-Co72KtgF.js +86 -0
- package/dist/icon-Dr8sfT2X.cjs +1 -0
- package/dist/if-defined-Cjj8qN-Z.js +5 -0
- package/dist/if-defined-XKOD_t_V.cjs +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/input-element-B1yxcfz4.cjs +1 -0
- package/dist/input-element-Bw1s6NlF.js +643 -0
- package/dist/input-wrapper-BRuVELpK.cjs +54 -0
- package/dist/input-wrapper-CDyHTR1V.js +164 -0
- package/dist/input-wrapper-Dwd-_sKm.cjs +1 -0
- package/dist/input-wrapper-YfTmpSSY.js +117 -0
- package/dist/link-CKAFMz9j.js +89 -0
- package/dist/link-CyTCpI0k.cjs +7 -0
- package/dist/linkcard-B0KOGaGj.js +55 -0
- package/dist/linkcard-BE4-FewK.cjs +13 -0
- package/dist/listbox-DCA2JoPV.cjs +106 -0
- package/dist/listbox-DuBgTFvH.js +397 -0
- package/dist/loader-6kFZUErT.js +66 -0
- package/dist/loader-CX2rsC01.cjs +16 -0
- package/dist/messagebox-Cwlg5sOr.js +110 -0
- package/dist/messagebox-Din9X53b.cjs +13 -0
- package/dist/modal-C_wtsh9m.js +209 -0
- package/dist/modal-DS_wUOIv.cjs +36 -0
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -7
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +2 -5
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +2 -5
- package/dist/pkt-breadcrumbs.cjs +1 -43
- package/dist/pkt-breadcrumbs.js +2 -81
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +2 -5
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +2 -5
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +2 -5
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +2 -5
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +2 -5
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +2 -5
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +5 -9
- package/dist/pkt-header.cjs +1 -304
- package/dist/pkt-header.js +2 -861
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +2 -5
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +2 -5
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +2 -5
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +30 -66
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +2 -5
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +2 -5
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +2 -5
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +2 -5
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +2 -5
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +2 -5
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +2 -5
- package/dist/pkt-options-controller-CRrI6WMk.js +43 -0
- package/dist/pkt-options-controller-CXUGx134.cjs +1 -0
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -5
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +2 -5
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +2 -5
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +2 -7
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +2 -5
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +2 -5
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +2 -5
- package/dist/pkt-timepicker.cjs +1 -191
- package/dist/pkt-timepicker.js +2 -560
- package/dist/progressbar-CdXtmOBb.cjs +17 -0
- package/dist/progressbar-Dy9AiYQz.js +113 -0
- package/dist/radiobutton-GOnpUbCW.cjs +31 -0
- package/dist/radiobutton-V_KPbup_.js +84 -0
- package/dist/ref-BaJ0mBT_.cjs +1 -0
- package/dist/ref-RS8Uv6uC.js +30 -0
- package/dist/repeat-Cepr3469.js +57 -0
- package/dist/repeat-CqcDYBxr.cjs +1 -0
- package/dist/select-BSAFd8Wa.js +164 -0
- package/dist/select-C2i8sOk5.cjs +49 -0
- package/dist/tabs-D8nL9rWx.cjs +37 -0
- package/dist/tabs-Y7utmJi9.js +318 -0
- package/dist/tag-DLthw5b4.cjs +27 -0
- package/dist/tag-VwykmuQR.js +179 -0
- package/dist/textarea-D7aGOyDf.cjs +46 -0
- package/dist/textarea-DYOBhJrN.js +115 -0
- package/dist/textinput-BUgntXnM.js +124 -0
- package/dist/textinput-DFh8_9cx.cjs +70 -0
- package/dist/timepicker-BIfE7KKJ.cjs +191 -0
- package/dist/timepicker-DaSwn1FA.js +503 -0
- package/dist/utils-CUqCKGvp.js +7 -0
- package/dist/utils-CjAbIttF.cjs +1 -0
- package/package.json +6 -6
- package/src/components/alert/alert.test.ts +1 -1
- package/src/components/alert/alert.ts +6 -6
- package/src/components/datepicker/datepicker-utils.test.ts +16 -23
- package/dist/accordionitem-_9AiCIvd.cjs +0 -34
- package/dist/accordionitem-dCfSrxh5.js +0 -140
- package/dist/alert-BtOk8yRH.cjs +0 -33
- package/dist/alert-DlY2_grU.js +0 -117
- package/dist/async-directive-CMzWMlZ5.js +0 -65
- package/dist/async-directive-DoMuclel.cjs +0 -5
- package/dist/backlink-Ce5Vldop.js +0 -49
- package/dist/backlink-y3dwjKPC.cjs +0 -13
- package/dist/booleanish-BKVonob4.cjs +0 -1
- package/dist/booleanish-C9R0tdXH.js +0 -11
- package/dist/button-B_TXwNzt.cjs +0 -27
- package/dist/button-BiY-wlKF.js +0 -139
- package/dist/calendar-B2pji2zn.cjs +0 -90
- package/dist/calendar-DhjQDC4C.js +0 -2140
- package/dist/card-BwMNB5Bb.cjs +0 -87
- package/dist/card-CGlmcMSR.js +0 -233
- package/dist/checkbox-BsJZYA26.js +0 -147
- package/dist/checkbox-CTY8f_qn.cjs +0 -31
- package/dist/class-map-CEnykyO_.js +0 -34
- package/dist/class-map-CsENJXf1.cjs +0 -5
- package/dist/classutils-BwNK82ZQ.cjs +0 -1
- package/dist/classutils-RQs1k6D9.js +0 -7
- package/dist/combobox-DSB5WOxg.js +0 -815
- package/dist/combobox-DbICIgKG.cjs +0 -135
- package/dist/consent-DkOQpbsg.cjs +0 -11
- package/dist/consent-SNWV_mMU.js +0 -175
- package/dist/datepicker-BEWl9iz3.cjs +0 -273
- package/dist/datepicker-euHyzXnb.js +0 -1170
- package/dist/dialog-polyfill.esm-CPKZe7AL.cjs +0 -1
- package/dist/dialog-polyfill.esm-CbjBMXAG.js +0 -395
- package/dist/directive-C7oCP5Bh.cjs +0 -5
- package/dist/directive-helpers-BP2WOx60.cjs +0 -5
- package/dist/directive-helpers-rm-28gIj.js +0 -38
- package/dist/directive-oAbCiebi.js +0 -27
- package/dist/element-CPpT3rFQ.js +0 -638
- package/dist/element-gR_VtSiD.cjs +0 -27
- package/dist/element-with-slot-Dqk6-TRR.js +0 -240
- package/dist/element-with-slot-ZX-up7jO.cjs +0 -1
- package/dist/heading-D2tVS6lS.js +0 -103
- package/dist/heading-DrzbgDb6.cjs +0 -1
- package/dist/helptext-BKtU4mas.js +0 -82
- package/dist/helptext-DcRC7wW2.cjs +0 -24
- package/dist/icon-CxQcIa5F.js +0 -105
- package/dist/icon-q81vqPK_.cjs +0 -9
- package/dist/if-defined-B0krMLad.js +0 -10
- package/dist/if-defined-BOW3ODSj.cjs +0 -5
- package/dist/input-element-8nLwuQS4.js +0 -837
- package/dist/input-element-DdVhUvva.cjs +0 -1
- package/dist/input-wrapper-Bs4CRNst.js +0 -181
- package/dist/input-wrapper-Bv9aqqVq.cjs +0 -54
- package/dist/input-wrapper-CDgenrYA.js +0 -6
- package/dist/input-wrapper-EoSAbU-U.cjs +0 -1
- package/dist/link-C0rl-86s.cjs +0 -7
- package/dist/link-Cdqgl60z.js +0 -55
- package/dist/linkcard-Dimu7Rlx.cjs +0 -13
- package/dist/linkcard-Lbq_UhjZ.js +0 -56
- package/dist/listbox-Bia4_tvN.js +0 -440
- package/dist/listbox-La2GZQei.cjs +0 -106
- package/dist/loader-D1ugDXGV.cjs +0 -16
- package/dist/loader-DyN6RGC5.js +0 -95
- package/dist/messagebox-BGMVm2t9.js +0 -71
- package/dist/messagebox-M0yIgCz9.cjs +0 -13
- package/dist/modal-CMO1RtIi.cjs +0 -36
- package/dist/modal-DjPQDE-Z.js +0 -156
- package/dist/pkt-options-controller-5LXbEzuk.cjs +0 -1
- package/dist/pkt-options-controller-B5YalfCb.js +0 -39
- package/dist/progressbar-BqlMzkM_.cjs +0 -21
- package/dist/progressbar-sbHDFC12.js +0 -162
- package/dist/radiobutton-5ZqVVtTT.cjs +0 -31
- package/dist/radiobutton-D8Ai8ETa.js +0 -113
- package/dist/ref-Bg_Swj5w.js +0 -42
- package/dist/ref-CL-Xk9Xm.cjs +0 -5
- package/dist/repeat-BD8TKgJb.js +0 -61
- package/dist/repeat-Cfq8CDlf.cjs +0 -5
- package/dist/select-De-n8on9.js +0 -230
- package/dist/select-dTWibR6_.cjs +0 -49
- package/dist/state-C_1EOo3D.js +0 -12
- package/dist/state-Dg-53wQ8.cjs +0 -5
- package/dist/tabitem-B9-jeV97.js +0 -334
- package/dist/tabitem-BnhzqfW3.cjs +0 -65
- package/dist/tag-CbwO8yvD.cjs +0 -27
- package/dist/tag-D4FI5t3y.js +0 -117
- package/dist/textarea-BmLaKzsc.cjs +0 -50
- package/dist/textarea-CMiSJaYL.js +0 -133
- package/dist/textinput-em9y4yrL.cjs +0 -70
- package/dist/textinput-r8udK0IX.js +0 -152
- package/dist/utils-DznhwRXm.js +0 -8
- package/dist/utils-byXsEz1u.cjs +0 -1
package/dist/pkt-header.js
CHANGED
|
@@ -1,861 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { o as $ } from "./if-defined-B0krMLad.js";
|
|
4
|
-
import { b as d } from "./booleanish-C9R0tdXH.js";
|
|
5
|
-
import { r as g } from "./state-C_1EOo3D.js";
|
|
6
|
-
import { e as k } from "./class-map-CEnykyO_.js";
|
|
7
|
-
import { e as b, n as f } from "./ref-Bg_Swj5w.js";
|
|
8
|
-
import "./button-BiY-wlKF.js";
|
|
9
|
-
import "./icon-CxQcIa5F.js";
|
|
10
|
-
import "./link-Cdqgl60z.js";
|
|
11
|
-
import "./textinput-r8udK0IX.js";
|
|
12
|
-
const L = (o) => typeof o.target == "string" ? { title: o.title, iconName: o.iconName, href: o.target } : { title: o.title, iconName: o.iconName, onClick: o.target }, w = (o) => L(o), O = (o) => {
|
|
13
|
-
if (!o) return;
|
|
14
|
-
const e = typeof o == "string" ? new Date(o) : o;
|
|
15
|
-
if (!isNaN(e.getTime()))
|
|
16
|
-
return e.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, y = (o, e, t, i) => {
|
|
25
|
-
for (var r = void 0, p = o.length - 1, m; p >= 0; p--)
|
|
26
|
-
(m = o[p]) && (r = m(e, t, r) || r);
|
|
27
|
-
return r && R(e, t, r), r;
|
|
28
|
-
};
|
|
29
|
-
class v 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, r = k({
|
|
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 || h}
|
|
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=${r} 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>` : h}
|
|
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
|
-
` : h}
|
|
107
|
-
</li>
|
|
108
|
-
` : h}
|
|
109
|
-
|
|
110
|
-
<!-- User menu items -->
|
|
111
|
-
${e && e.length > 0 ? n`
|
|
112
|
-
<li class="pkt-user-menu__item">${this.renderLinkSection(e)}</li>
|
|
113
|
-
` : h}
|
|
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>` : h}
|
|
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
|
-
` : h}
|
|
134
|
-
</li>
|
|
135
|
-
` : h}
|
|
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
|
-
` : h}
|
|
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
|
-
` : h}
|
|
162
|
-
</ul>
|
|
163
|
-
</nav>
|
|
164
|
-
`;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
y([
|
|
168
|
-
s({ type: Object })
|
|
169
|
-
], v.prototype, "user");
|
|
170
|
-
y([
|
|
171
|
-
s({ type: String, attribute: "formatted-last-logged-in" })
|
|
172
|
-
], v.prototype, "formattedLastLoggedIn");
|
|
173
|
-
y([
|
|
174
|
-
s({ type: Object })
|
|
175
|
-
], v.prototype, "representing");
|
|
176
|
-
y([
|
|
177
|
-
s({ type: Array, attribute: "user-menu" })
|
|
178
|
-
], v.prototype, "userMenu");
|
|
179
|
-
y([
|
|
180
|
-
s({
|
|
181
|
-
type: Boolean,
|
|
182
|
-
attribute: "can-change-representation",
|
|
183
|
-
converter: d
|
|
184
|
-
})
|
|
185
|
-
], v.prototype, "canChangeRepresentation");
|
|
186
|
-
y([
|
|
187
|
-
s({ type: Boolean, attribute: "logout-on-click", converter: d })
|
|
188
|
-
], v.prototype, "logoutOnClick");
|
|
189
|
-
try {
|
|
190
|
-
M("pkt-header-user-menu")(v);
|
|
191
|
-
} catch {
|
|
192
|
-
console.warn("Forsøker å definere <pkt-header-user-menu>, men den er allerede definert");
|
|
193
|
-
}
|
|
194
|
-
var B = Object.defineProperty, l = (o, e, t, i) => {
|
|
195
|
-
for (var r = void 0, p = o.length - 1, m; p >= 0; p--)
|
|
196
|
-
(m = o[p]) && (r = m(e, t, r) || r);
|
|
197
|
-
return r && B(e, t, r), r;
|
|
198
|
-
};
|
|
199
|
-
const E = "https://punkt-cdn.oslo.kommune.no/latest/logos/";
|
|
200
|
-
class a extends _ {
|
|
201
|
-
constructor() {
|
|
202
|
-
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 = b(), this.userContainerRef = b(), this.slotContainerRef = b(), this.searchContainerRef = b(), this.slotContentRef = b(), this.searchMenuRef = b(), this.lastScrollPosition = 0, this.savedScrollY = 0, this.lastFocusedElement = null, this.shouldRestoreFocus = !1, this.handleScroll = () => {
|
|
203
|
-
if (!this.shouldHideOnScroll) return;
|
|
204
|
-
const e = window.pageYOffset || document.documentElement.scrollTop;
|
|
205
|
-
e < 0 || Math.abs(e - this.lastScrollPosition) < 60 || (this.isHidden = e > this.lastScrollPosition, this.lastScrollPosition = e);
|
|
206
|
-
}, this.handleClickOutside = (e) => {
|
|
207
|
-
const t = e.target;
|
|
208
|
-
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");
|
|
209
|
-
}, this.handleFocusOut = (e, t) => {
|
|
210
|
-
const i = e.relatedTarget;
|
|
211
|
-
let r;
|
|
212
|
-
switch (t) {
|
|
213
|
-
case "user":
|
|
214
|
-
r = this.userContainerRef;
|
|
215
|
-
break;
|
|
216
|
-
case "slot":
|
|
217
|
-
r = this.slotContainerRef;
|
|
218
|
-
break;
|
|
219
|
-
case "search":
|
|
220
|
-
r = this.searchContainerRef;
|
|
221
|
-
break;
|
|
222
|
-
default:
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
const p = r.value;
|
|
226
|
-
p && (!i || !p.contains(i)) && (this.openMenu = "none");
|
|
227
|
-
}, this.handleEscapeKey = (e) => {
|
|
228
|
-
e.key === "Escape" && this.openMenu !== "none" && (e.preventDefault(), this.shouldRestoreFocus = !0, this.openMenu = "none");
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
connectedCallback() {
|
|
232
|
-
super.connectedCallback(), this.setupScrollListener();
|
|
233
|
-
}
|
|
234
|
-
disconnectedCallback() {
|
|
235
|
-
var e;
|
|
236
|
-
super.disconnectedCallback(), (e = this.resizeObserver) == null || e.disconnect(), window.removeEventListener("scroll", this.handleScroll), this.unlockScroll();
|
|
237
|
-
}
|
|
238
|
-
firstUpdated() {
|
|
239
|
-
this.setupResizeObserver();
|
|
240
|
-
}
|
|
241
|
-
updated(e) {
|
|
242
|
-
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")) {
|
|
243
|
-
const t = e.get("openMenu");
|
|
244
|
-
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(() => {
|
|
245
|
-
this.checkDropdownAlignment(this.openMenu);
|
|
246
|
-
})) : this.openMenu === "none" && t !== "none" && (document.removeEventListener("mousedown", this.handleClickOutside), document.removeEventListener("keydown", this.handleEscapeKey), this.restoreFocus());
|
|
247
|
-
}
|
|
248
|
-
(e.has("openMenu") || e.has("isMobile")) && this.updateScrollLock();
|
|
249
|
-
}
|
|
250
|
-
setupResizeObserver() {
|
|
251
|
-
const e = this.headerRef.value;
|
|
252
|
-
e && (this.componentWidth = e.offsetWidth, this.updateIsMobile(), this.updateIsTablet(), this.resizeObserver = new ResizeObserver((t) => {
|
|
253
|
-
for (const i of t)
|
|
254
|
-
i.borderBoxSize && i.borderBoxSize.length > 0 ? this.componentWidth = i.borderBoxSize[0].inlineSize : this.componentWidth = i.contentRect.width, this.updateIsMobile(), this.updateIsTablet();
|
|
255
|
-
}), this.resizeObserver.observe(e));
|
|
256
|
-
}
|
|
257
|
-
updateIsMobile() {
|
|
258
|
-
this.isMobile = this.componentWidth < this.mobileBreakpoint;
|
|
259
|
-
}
|
|
260
|
-
updateIsTablet() {
|
|
261
|
-
this.isTablet = this.componentWidth < this.tabletBreakpoint;
|
|
262
|
-
}
|
|
263
|
-
updateScrollLock() {
|
|
264
|
-
this.position === "fixed" && this.isMobile && this.openMenu !== "none" ? this.lockScroll() : this.unlockScroll();
|
|
265
|
-
}
|
|
266
|
-
lockScroll() {
|
|
267
|
-
const e = document.body, t = document.documentElement;
|
|
268
|
-
this.savedScrollY = window.scrollY || window.pageYOffset;
|
|
269
|
-
const i = window.innerWidth - t.clientWidth;
|
|
270
|
-
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");
|
|
271
|
-
}
|
|
272
|
-
unlockScroll() {
|
|
273
|
-
const e = document.body, t = document.documentElement;
|
|
274
|
-
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 }));
|
|
275
|
-
}
|
|
276
|
-
setupScrollListener() {
|
|
277
|
-
window.addEventListener("scroll", this.handleScroll);
|
|
278
|
-
}
|
|
279
|
-
restoreFocus() {
|
|
280
|
-
this.shouldRestoreFocus && this.lastFocusedElement && document.contains(this.lastFocusedElement) && this.lastFocusedElement.focus(), this.lastFocusedElement = null, this.shouldRestoreFocus = !1;
|
|
281
|
-
}
|
|
282
|
-
checkDropdownAlignment(e) {
|
|
283
|
-
const t = e === "slot" ? this.slotContainerRef : this.searchContainerRef, i = e === "slot" ? this.slotContentRef : this.searchMenuRef;
|
|
284
|
-
if (!t.value || !i.value || !this.isTablet || this.isMobile) return;
|
|
285
|
-
const r = t.value.getBoundingClientRect(), p = i.value.offsetWidth, m = r.left + p > window.innerWidth;
|
|
286
|
-
e === "slot" ? this.alignSlotRight = m : this.alignSearchRight = m;
|
|
287
|
-
}
|
|
288
|
-
handleMenuToggle(e) {
|
|
289
|
-
this.openMenu !== "none" ? this.openMenu = "none" : (this.lastFocusedElement = document.activeElement, this.openMenu = e);
|
|
290
|
-
}
|
|
291
|
-
handleLogoClick(e) {
|
|
292
|
-
this.dispatchEvent(
|
|
293
|
-
new CustomEvent("logo-click", {
|
|
294
|
-
bubbles: !0,
|
|
295
|
-
composed: !0,
|
|
296
|
-
detail: { originalEvent: e }
|
|
297
|
-
})
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
handleServiceClick(e) {
|
|
301
|
-
this.dispatchEvent(
|
|
302
|
-
new CustomEvent("service-click", {
|
|
303
|
-
bubbles: !0,
|
|
304
|
-
composed: !0,
|
|
305
|
-
detail: { originalEvent: e }
|
|
306
|
-
})
|
|
307
|
-
);
|
|
308
|
-
}
|
|
309
|
-
handleLogout() {
|
|
310
|
-
this.dispatchEvent(
|
|
311
|
-
new CustomEvent("log-out", {
|
|
312
|
-
bubbles: !0,
|
|
313
|
-
composed: !0
|
|
314
|
-
})
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
handleSearch(e) {
|
|
318
|
-
this.dispatchEvent(
|
|
319
|
-
new CustomEvent("search", {
|
|
320
|
-
detail: { query: e },
|
|
321
|
-
bubbles: !0,
|
|
322
|
-
composed: !0
|
|
323
|
-
})
|
|
324
|
-
);
|
|
325
|
-
}
|
|
326
|
-
handleSearchChange(e) {
|
|
327
|
-
this.dispatchEvent(
|
|
328
|
-
new CustomEvent("search-change", {
|
|
329
|
-
detail: { query: e },
|
|
330
|
-
bubbles: !0,
|
|
331
|
-
composed: !0
|
|
332
|
-
})
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
handleSearchInputChange(e) {
|
|
336
|
-
const t = e.target.value;
|
|
337
|
-
this.handleSearchChange(t);
|
|
338
|
-
}
|
|
339
|
-
handleSearchKeyDown(e) {
|
|
340
|
-
e.key === "Enter" && this.handleSearch(e.target.value);
|
|
341
|
-
}
|
|
342
|
-
get formattedLastLoggedIn() {
|
|
343
|
-
var e;
|
|
344
|
-
return O((e = this.user) == null ? void 0 : e.lastLoggedIn);
|
|
345
|
-
}
|
|
346
|
-
get isFixed() {
|
|
347
|
-
return this.position === "fixed";
|
|
348
|
-
}
|
|
349
|
-
get shouldHideOnScroll() {
|
|
350
|
-
return this.scrollBehavior === "hide";
|
|
351
|
-
}
|
|
352
|
-
get showLogoutInHeader() {
|
|
353
|
-
return this.hasLogOut && (this.logOutButtonPlacement === "header" || this.logOutButtonPlacement === "both");
|
|
354
|
-
}
|
|
355
|
-
get showLogoutInUserMenu() {
|
|
356
|
-
return this.hasLogOut && (this.logOutButtonPlacement === "userMenu" || this.logOutButtonPlacement === "both");
|
|
357
|
-
}
|
|
358
|
-
renderLogo() {
|
|
359
|
-
if (this.hideLogo) return h;
|
|
360
|
-
const e = n`
|
|
361
|
-
<pkt-icon name="oslologo" aria-hidden="true" path=${E}></pkt-icon>
|
|
362
|
-
`;
|
|
363
|
-
return this.logoLink && typeof this.logoLink == "string" ? n`
|
|
364
|
-
<span class="pkt-header-service__logo">
|
|
365
|
-
<a href=${this.logoLink} aria-label="Tilbake til forside" @click=${this.handleLogoClick}>
|
|
366
|
-
${e}
|
|
367
|
-
</a>
|
|
368
|
-
</span>
|
|
369
|
-
` : this.hasAttribute("logo-link") ? n`
|
|
370
|
-
<span class="pkt-header-service__logo">
|
|
371
|
-
<button
|
|
372
|
-
aria-label="Tilbake til forside"
|
|
373
|
-
class="pkt-link-button pkt-link pkt-header-service__logo-link"
|
|
374
|
-
@click=${this.handleLogoClick}
|
|
375
|
-
>
|
|
376
|
-
${e}
|
|
377
|
-
</button>
|
|
378
|
-
</span>
|
|
379
|
-
` : n`
|
|
380
|
-
<span class="pkt-header-service__logo" @click=${this.handleLogoClick}>${e}</span>
|
|
381
|
-
`;
|
|
382
|
-
}
|
|
383
|
-
renderServiceName() {
|
|
384
|
-
return this.serviceName ? this.serviceLink && typeof this.serviceLink == "string" ? n`
|
|
385
|
-
<span class="pkt-header-service__service-name">
|
|
386
|
-
<pkt-link
|
|
387
|
-
href=${this.serviceLink}
|
|
388
|
-
class="pkt-header-service__service-link"
|
|
389
|
-
@click=${this.handleServiceClick}
|
|
390
|
-
>
|
|
391
|
-
${this.serviceName}
|
|
392
|
-
</pkt-link>
|
|
393
|
-
</span>
|
|
394
|
-
` : this.hasAttribute("service-link") ? n`
|
|
395
|
-
<span class="pkt-header-service__service-name">
|
|
396
|
-
<button
|
|
397
|
-
class="pkt-link-button pkt-link pkt-header-service__service-link"
|
|
398
|
-
@click=${this.handleServiceClick}
|
|
399
|
-
>
|
|
400
|
-
${this.serviceName}
|
|
401
|
-
</button>
|
|
402
|
-
</span>
|
|
403
|
-
` : n`
|
|
404
|
-
<span class="pkt-header-service__service-name" @click=${this.handleServiceClick}>
|
|
405
|
-
<span class="pkt-header-service__service-link">${this.serviceName}</span>
|
|
406
|
-
</span>
|
|
407
|
-
` : h;
|
|
408
|
-
}
|
|
409
|
-
renderSlotContainer() {
|
|
410
|
-
if (!this.hasSlotContent()) return h;
|
|
411
|
-
const e = k({
|
|
412
|
-
"pkt-header-service__slot-container": !0,
|
|
413
|
-
"is-open": this.openMenu === "slot"
|
|
414
|
-
}), t = k({
|
|
415
|
-
"pkt-header-service__slot-content": !0,
|
|
416
|
-
"align-right": this.alignSlotRight
|
|
417
|
-
});
|
|
418
|
-
return n`
|
|
419
|
-
<div
|
|
420
|
-
class=${e}
|
|
421
|
-
@focusout=${(i) => this.handleFocusOut(i, "slot")}
|
|
422
|
-
${f(this.slotContainerRef)}
|
|
423
|
-
>
|
|
424
|
-
${this.isTablet && this.hasSlotContent() ? n`
|
|
425
|
-
<pkt-button
|
|
426
|
-
skin="secondary"
|
|
427
|
-
variant=${this.slotMenuVariant}
|
|
428
|
-
iconName="menu"
|
|
429
|
-
size=${this.isMobile ? "small" : "medium"}
|
|
430
|
-
state=${this.openMenu === "slot" ? "active" : "normal"}
|
|
431
|
-
@click=${() => this.handleMenuToggle("slot")}
|
|
432
|
-
aria-expanded=${this.openMenu === "slot"}
|
|
433
|
-
aria-controls="mobile-slot-menu"
|
|
434
|
-
aria-label="Åpne meny"
|
|
435
|
-
>
|
|
436
|
-
${this.slotMenuText}
|
|
437
|
-
</pkt-button>
|
|
438
|
-
` : h}
|
|
439
|
-
<div
|
|
440
|
-
class=${t}
|
|
441
|
-
id="mobile-slot-menu"
|
|
442
|
-
role=${this.isTablet ? "menu" : h}
|
|
443
|
-
aria-label=${this.isTablet ? "Meny" : h}
|
|
444
|
-
${f(this.slotContentRef)}
|
|
445
|
-
>
|
|
446
|
-
${S(this)}
|
|
447
|
-
</div>
|
|
448
|
-
</div>
|
|
449
|
-
`;
|
|
450
|
-
}
|
|
451
|
-
renderSearch() {
|
|
452
|
-
if (!this.showSearch) return h;
|
|
453
|
-
if (this.isTablet) {
|
|
454
|
-
const e = k({
|
|
455
|
-
"pkt-header-service__search-container": !0,
|
|
456
|
-
"is-open": this.openMenu === "search"
|
|
457
|
-
}), t = k({
|
|
458
|
-
"pkt-header-service__mobile-menu": !0,
|
|
459
|
-
"is-open": this.openMenu === "search",
|
|
460
|
-
"align-right": this.alignSearchRight
|
|
461
|
-
});
|
|
462
|
-
return n`
|
|
463
|
-
<div
|
|
464
|
-
class=${e}
|
|
465
|
-
@focusout=${(i) => this.handleFocusOut(i, "search")}
|
|
466
|
-
${f(this.searchContainerRef)}
|
|
467
|
-
>
|
|
468
|
-
<pkt-button
|
|
469
|
-
skin="secondary"
|
|
470
|
-
variant="icon-only"
|
|
471
|
-
iconName="magnifying-glass-big"
|
|
472
|
-
size=${this.isMobile ? "small" : "medium"}
|
|
473
|
-
@click=${() => this.handleMenuToggle("search")}
|
|
474
|
-
state=${this.openMenu === "search" ? "active" : "normal"}
|
|
475
|
-
aria-expanded=${this.openMenu === "search"}
|
|
476
|
-
aria-controls="mobile-search-menu"
|
|
477
|
-
aria-label="Åpne søkefelt"
|
|
478
|
-
>
|
|
479
|
-
Søk
|
|
480
|
-
</pkt-button>
|
|
481
|
-
<div class=${t} ${f(this.searchMenuRef)}>
|
|
482
|
-
${this.openMenu === "search" ? n`
|
|
483
|
-
<pkt-textinput
|
|
484
|
-
id="mobile-search-menu"
|
|
485
|
-
class="pkt-header-service__search-input"
|
|
486
|
-
type="search"
|
|
487
|
-
label="Søk"
|
|
488
|
-
useWrapper="false"
|
|
489
|
-
placeholder=${this.searchPlaceholder}
|
|
490
|
-
value=${this.searchValue}
|
|
491
|
-
autofocus
|
|
492
|
-
fullwidth
|
|
493
|
-
@input=${this.handleSearchInputChange}
|
|
494
|
-
@keydown=${(i) => {
|
|
495
|
-
i.key === "Enter" && this.handleSearch(i.target.value);
|
|
496
|
-
}}
|
|
497
|
-
></pkt-textinput>
|
|
498
|
-
` : h}
|
|
499
|
-
</div>
|
|
500
|
-
</div>
|
|
501
|
-
`;
|
|
502
|
-
}
|
|
503
|
-
return n`
|
|
504
|
-
<pkt-textinput
|
|
505
|
-
id="header-service-search"
|
|
506
|
-
class="pkt-header-service__search-input"
|
|
507
|
-
type="search"
|
|
508
|
-
label="Søk"
|
|
509
|
-
useWrapper="false"
|
|
510
|
-
placeholder=${this.searchPlaceholder}
|
|
511
|
-
value=${this.searchValue}
|
|
512
|
-
@input=${this.handleSearchInputChange}
|
|
513
|
-
@keydown=${this.handleSearchKeyDown}
|
|
514
|
-
></pkt-textinput>
|
|
515
|
-
`;
|
|
516
|
-
}
|
|
517
|
-
renderUserButton() {
|
|
518
|
-
var t;
|
|
519
|
-
if (!this.user) return h;
|
|
520
|
-
const e = k({
|
|
521
|
-
"pkt-header-service__user-menu": this.isMobile === !1,
|
|
522
|
-
"pkt-header-service__mobile-menu": this.isMobile === !0,
|
|
523
|
-
"is-open": this.openMenu === "user"
|
|
524
|
-
});
|
|
525
|
-
return n`
|
|
526
|
-
<div
|
|
527
|
-
class="pkt-header-service__user-container"
|
|
528
|
-
@focusout=${(i) => this.handleFocusOut(i, "user")}
|
|
529
|
-
${f(this.userContainerRef)}
|
|
530
|
-
>
|
|
531
|
-
<pkt-button
|
|
532
|
-
class=${k({
|
|
533
|
-
"pkt-header-service__user-button": !0,
|
|
534
|
-
"pkt-header-service__user-button--mobile": this.isMobile
|
|
535
|
-
})}
|
|
536
|
-
skin="secondary"
|
|
537
|
-
size=${this.isMobile ? "small" : "medium"}
|
|
538
|
-
state=${this.openMenu === "user" ? "active" : "normal"}
|
|
539
|
-
variant="icons-right-and-left"
|
|
540
|
-
iconName="user"
|
|
541
|
-
secondIconName=${this.openMenu === "user" ? "chevron-thin-up" : "chevron-thin-down"}
|
|
542
|
-
@click=${() => this.handleMenuToggle("user")}
|
|
543
|
-
>
|
|
544
|
-
<span class="pkt-sr-only">Brukermeny: </span>
|
|
545
|
-
<span>${((t = this.representing) == null ? void 0 : t.name) || this.user.name}</span>
|
|
546
|
-
</pkt-button>
|
|
547
|
-
${this.openMenu === "user" && this.user ? n`
|
|
548
|
-
<div class=${e}>
|
|
549
|
-
<pkt-header-user-menu
|
|
550
|
-
.user=${this.user}
|
|
551
|
-
formatted-last-logged-in=${this.formattedLastLoggedIn || h}
|
|
552
|
-
.representing=${this.representing}
|
|
553
|
-
.userMenu=${this.userMenu}
|
|
554
|
-
?can-change-representation=${this.canChangeRepresentation}
|
|
555
|
-
?logout-on-click=${this.showLogoutInUserMenu}
|
|
556
|
-
@change-representation=${() => this.dispatchEvent(
|
|
557
|
-
new CustomEvent("change-representation", { bubbles: !0, composed: !0 })
|
|
558
|
-
)}
|
|
559
|
-
@log-out=${this.handleLogout}
|
|
560
|
-
></pkt-header-user-menu>
|
|
561
|
-
</div>
|
|
562
|
-
` : h}
|
|
563
|
-
</div>
|
|
564
|
-
`;
|
|
565
|
-
}
|
|
566
|
-
renderHeader() {
|
|
567
|
-
const e = k({
|
|
568
|
-
"pkt-header-service": !0,
|
|
569
|
-
"pkt-header-service--compact": this.compact,
|
|
570
|
-
"pkt-header-service--mobile": this.isMobile,
|
|
571
|
-
"pkt-header-service--tablet": this.isTablet,
|
|
572
|
-
"pkt-header-service--fixed": this.isFixed,
|
|
573
|
-
"pkt-header-service--scroll-to-hide": this.shouldHideOnScroll,
|
|
574
|
-
"pkt-header-service--hidden": this.isHidden
|
|
575
|
-
}), t = k({
|
|
576
|
-
"pkt-header-service__logo-area": !0,
|
|
577
|
-
"pkt-header-service__logo-area--without-service": !this.serviceName
|
|
578
|
-
});
|
|
579
|
-
return n`
|
|
580
|
-
<header class=${e} ${f(this.headerRef)}>
|
|
581
|
-
<div class=${t}>${this.renderLogo()} ${this.renderServiceName()}</div>
|
|
582
|
-
|
|
583
|
-
${this.hasSlotContent() || this.showSearch || this.showLogoutInHeader ? n`<div class="pkt-header-service__content">
|
|
584
|
-
${this.renderSlotContainer()} ${this.renderSearch()}
|
|
585
|
-
${this.isTablet && this.showLogoutInHeader ? n`
|
|
586
|
-
<pkt-button
|
|
587
|
-
skin="secondary"
|
|
588
|
-
size=${this.isMobile ? "small" : "medium"}
|
|
589
|
-
variant="icon-only"
|
|
590
|
-
iconName="exit"
|
|
591
|
-
@click=${this.handleLogout}
|
|
592
|
-
>
|
|
593
|
-
Logg ut
|
|
594
|
-
</pkt-button>
|
|
595
|
-
` : h}
|
|
596
|
-
</div>` : h}
|
|
597
|
-
${this.user || !this.isTablet && this.showLogoutInHeader ? n`<div class="pkt-header-service__user">
|
|
598
|
-
${this.renderUserButton()}
|
|
599
|
-
${!this.isTablet && this.showLogoutInHeader ? n`
|
|
600
|
-
<pkt-button
|
|
601
|
-
skin="tertiary"
|
|
602
|
-
size="medium"
|
|
603
|
-
variant="icon-right"
|
|
604
|
-
iconName="exit"
|
|
605
|
-
@click=${this.handleLogout}
|
|
606
|
-
>
|
|
607
|
-
Logg ut
|
|
608
|
-
</pkt-button>
|
|
609
|
-
` : h}
|
|
610
|
-
</div>` : h}
|
|
611
|
-
</header>
|
|
612
|
-
`;
|
|
613
|
-
}
|
|
614
|
-
render() {
|
|
615
|
-
const e = this.renderHeader();
|
|
616
|
-
if (this.isFixed) {
|
|
617
|
-
const t = k({
|
|
618
|
-
"pkt-header-service-spacer": !0,
|
|
619
|
-
"pkt-header-service-spacer--compact": this.compact,
|
|
620
|
-
"pkt-header-service-spacer--has-user": !!this.user,
|
|
621
|
-
"pkt-header-service-spacer--mobile": this.isMobile
|
|
622
|
-
});
|
|
623
|
-
return n`
|
|
624
|
-
<div class="pkt-header-service-wrapper">
|
|
625
|
-
${e}
|
|
626
|
-
<div class=${t}></div>
|
|
627
|
-
</div>
|
|
628
|
-
`;
|
|
629
|
-
}
|
|
630
|
-
return e;
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
l([
|
|
634
|
-
s({ type: String, attribute: "service-name" })
|
|
635
|
-
], a.prototype, "serviceName");
|
|
636
|
-
l([
|
|
637
|
-
s({ type: String, attribute: "service-link" })
|
|
638
|
-
], a.prototype, "serviceLink");
|
|
639
|
-
l([
|
|
640
|
-
s({ type: String, attribute: "logo-link" })
|
|
641
|
-
], a.prototype, "logoLink");
|
|
642
|
-
l([
|
|
643
|
-
s({ type: String, attribute: "search-placeholder" })
|
|
644
|
-
], a.prototype, "searchPlaceholder");
|
|
645
|
-
l([
|
|
646
|
-
s({ type: String, attribute: "search-value" })
|
|
647
|
-
], a.prototype, "searchValue");
|
|
648
|
-
l([
|
|
649
|
-
s({ type: Number, attribute: "mobile-breakpoint" })
|
|
650
|
-
], a.prototype, "mobileBreakpoint");
|
|
651
|
-
l([
|
|
652
|
-
s({ type: Number, attribute: "tablet-breakpoint" })
|
|
653
|
-
], a.prototype, "tabletBreakpoint");
|
|
654
|
-
l([
|
|
655
|
-
s({ type: String, attribute: "opened-menu" })
|
|
656
|
-
], a.prototype, "openedMenu");
|
|
657
|
-
l([
|
|
658
|
-
s({ type: String, attribute: "log-out-button-placement" })
|
|
659
|
-
], a.prototype, "logOutButtonPlacement");
|
|
660
|
-
l([
|
|
661
|
-
s({ type: String })
|
|
662
|
-
], a.prototype, "position");
|
|
663
|
-
l([
|
|
664
|
-
s({ type: String, attribute: "scroll-behavior" })
|
|
665
|
-
], a.prototype, "scrollBehavior");
|
|
666
|
-
l([
|
|
667
|
-
s({ type: String, attribute: "slot-menu-variant" })
|
|
668
|
-
], a.prototype, "slotMenuVariant");
|
|
669
|
-
l([
|
|
670
|
-
s({ type: String, attribute: "slot-menu-text" })
|
|
671
|
-
], a.prototype, "slotMenuText");
|
|
672
|
-
l([
|
|
673
|
-
s({ type: Boolean, attribute: "hide-logo", converter: d })
|
|
674
|
-
], a.prototype, "hideLogo");
|
|
675
|
-
l([
|
|
676
|
-
s({ type: Boolean, converter: d })
|
|
677
|
-
], a.prototype, "compact");
|
|
678
|
-
l([
|
|
679
|
-
s({ type: Boolean, attribute: "show-search", converter: d })
|
|
680
|
-
], a.prototype, "showSearch");
|
|
681
|
-
l([
|
|
682
|
-
s({
|
|
683
|
-
type: Boolean,
|
|
684
|
-
attribute: "can-change-representation",
|
|
685
|
-
converter: d
|
|
686
|
-
})
|
|
687
|
-
], a.prototype, "canChangeRepresentation");
|
|
688
|
-
l([
|
|
689
|
-
s({ type: Boolean, attribute: "has-log-out", converter: d })
|
|
690
|
-
], a.prototype, "hasLogOut");
|
|
691
|
-
l([
|
|
692
|
-
s({ type: Object })
|
|
693
|
-
], a.prototype, "user");
|
|
694
|
-
l([
|
|
695
|
-
s({ type: Array, attribute: "user-menu" })
|
|
696
|
-
], a.prototype, "userMenu");
|
|
697
|
-
l([
|
|
698
|
-
s({ type: Object })
|
|
699
|
-
], a.prototype, "representing");
|
|
700
|
-
l([
|
|
701
|
-
g()
|
|
702
|
-
], a.prototype, "isMobile");
|
|
703
|
-
l([
|
|
704
|
-
g()
|
|
705
|
-
], a.prototype, "isTablet");
|
|
706
|
-
l([
|
|
707
|
-
g()
|
|
708
|
-
], a.prototype, "openMenu");
|
|
709
|
-
l([
|
|
710
|
-
g()
|
|
711
|
-
], a.prototype, "isHidden");
|
|
712
|
-
l([
|
|
713
|
-
g()
|
|
714
|
-
], a.prototype, "componentWidth");
|
|
715
|
-
l([
|
|
716
|
-
g()
|
|
717
|
-
], a.prototype, "alignSlotRight");
|
|
718
|
-
l([
|
|
719
|
-
g()
|
|
720
|
-
], a.prototype, "alignSearchRight");
|
|
721
|
-
try {
|
|
722
|
-
M("pkt-header-service")(a);
|
|
723
|
-
} catch {
|
|
724
|
-
console.warn("Forsøker å definere <pkt-header-service>, men den er allerede definert");
|
|
725
|
-
}
|
|
726
|
-
var P = Object.defineProperty, u = (o, e, t, i) => {
|
|
727
|
-
for (var r = void 0, p = o.length - 1, m; p >= 0; p--)
|
|
728
|
-
(m = o[p]) && (r = m(e, t, r) || r);
|
|
729
|
-
return r && P(e, t, r), r;
|
|
730
|
-
};
|
|
731
|
-
class c extends _ {
|
|
732
|
-
constructor() {
|
|
733
|
-
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;
|
|
734
|
-
}
|
|
735
|
-
firstUpdated(e) {
|
|
736
|
-
super.firstUpdated(e), this.emitDeprecationWarnings();
|
|
737
|
-
}
|
|
738
|
-
emitDeprecationWarnings() {
|
|
739
|
-
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.");
|
|
740
|
-
}
|
|
741
|
-
/**
|
|
742
|
-
* Convert deprecated props to new props
|
|
743
|
-
*/
|
|
744
|
-
get effectiveUserMenu() {
|
|
745
|
-
const e = this.userMenu || [], t = this.userMenuFooter || [], i = this.userOptions || [];
|
|
746
|
-
return t.length || i.length ? [...e, ...i, ...t] : this.userMenu;
|
|
747
|
-
}
|
|
748
|
-
render() {
|
|
749
|
-
return n`
|
|
750
|
-
<pkt-header-service
|
|
751
|
-
service-name=${$(this.serviceName)}
|
|
752
|
-
service-link=${$(this.serviceLink)}
|
|
753
|
-
logo-link=${$(this.logoLink)}
|
|
754
|
-
search-placeholder=${this.searchPlaceholder}
|
|
755
|
-
search-value=${this.searchValue}
|
|
756
|
-
mobile-breakpoint=${this.mobileBreakpoint}
|
|
757
|
-
tablet-breakpoint=${this.tabletBreakpoint}
|
|
758
|
-
opened-menu=${this.openedMenu}
|
|
759
|
-
log-out-button-placement=${this.logOutButtonPlacement}
|
|
760
|
-
position=${this.position}
|
|
761
|
-
scroll-behavior=${this.scrollBehavior}
|
|
762
|
-
slot-menu-variant=${this.slotMenuVariant}
|
|
763
|
-
slot-menu-text=${this.slotMenuText}
|
|
764
|
-
.hideLogo=${this.hideLogo}
|
|
765
|
-
.compact=${this.compact}
|
|
766
|
-
.showSearch=${this.showSearch}
|
|
767
|
-
.canChangeRepresentation=${this.canChangeRepresentation}
|
|
768
|
-
.hasLogOut=${this.hasLogOut}
|
|
769
|
-
.user=${this.user}
|
|
770
|
-
.userMenu=${this.effectiveUserMenu}
|
|
771
|
-
.representing=${this.representing}
|
|
772
|
-
>
|
|
773
|
-
${this.hasSlotContent() ? n`<div class="pkt-contents">${S(this)}</div>` : h}
|
|
774
|
-
</pkt-header-service>
|
|
775
|
-
`;
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
u([
|
|
779
|
-
s({ type: String, attribute: "service-name" })
|
|
780
|
-
], c.prototype, "serviceName");
|
|
781
|
-
u([
|
|
782
|
-
s({ type: String, attribute: "service-link" })
|
|
783
|
-
], c.prototype, "serviceLink");
|
|
784
|
-
u([
|
|
785
|
-
s({ type: String, attribute: "logo-link" })
|
|
786
|
-
], c.prototype, "logoLink");
|
|
787
|
-
u([
|
|
788
|
-
s({ type: String, attribute: "search-placeholder" })
|
|
789
|
-
], c.prototype, "searchPlaceholder");
|
|
790
|
-
u([
|
|
791
|
-
s({ type: String, attribute: "search-value" })
|
|
792
|
-
], c.prototype, "searchValue");
|
|
793
|
-
u([
|
|
794
|
-
s({ type: Number, attribute: "mobile-breakpoint" })
|
|
795
|
-
], c.prototype, "mobileBreakpoint");
|
|
796
|
-
u([
|
|
797
|
-
s({ type: Number, attribute: "tablet-breakpoint" })
|
|
798
|
-
], c.prototype, "tabletBreakpoint");
|
|
799
|
-
u([
|
|
800
|
-
s({ type: String, attribute: "opened-menu" })
|
|
801
|
-
], c.prototype, "openedMenu");
|
|
802
|
-
u([
|
|
803
|
-
s({ type: String, attribute: "log-out-button-placement" })
|
|
804
|
-
], c.prototype, "logOutButtonPlacement");
|
|
805
|
-
u([
|
|
806
|
-
s({ type: String })
|
|
807
|
-
], c.prototype, "position");
|
|
808
|
-
u([
|
|
809
|
-
s({ type: String, attribute: "scroll-behavior" })
|
|
810
|
-
], c.prototype, "scrollBehavior");
|
|
811
|
-
u([
|
|
812
|
-
s({ type: String, attribute: "slot-menu-variant" })
|
|
813
|
-
], c.prototype, "slotMenuVariant");
|
|
814
|
-
u([
|
|
815
|
-
s({ type: String, attribute: "slot-menu-text" })
|
|
816
|
-
], c.prototype, "slotMenuText");
|
|
817
|
-
u([
|
|
818
|
-
s({ type: Boolean, attribute: "hide-logo", converter: d })
|
|
819
|
-
], c.prototype, "hideLogo");
|
|
820
|
-
u([
|
|
821
|
-
s({ type: Boolean, converter: d })
|
|
822
|
-
], c.prototype, "compact");
|
|
823
|
-
u([
|
|
824
|
-
s({ type: Boolean, attribute: "show-search", converter: d })
|
|
825
|
-
], c.prototype, "showSearch");
|
|
826
|
-
u([
|
|
827
|
-
s({
|
|
828
|
-
type: Boolean,
|
|
829
|
-
attribute: "can-change-representation",
|
|
830
|
-
converter: d
|
|
831
|
-
})
|
|
832
|
-
], c.prototype, "canChangeRepresentation");
|
|
833
|
-
u([
|
|
834
|
-
s({ type: Boolean, attribute: "has-log-out", converter: d })
|
|
835
|
-
], c.prototype, "hasLogOut");
|
|
836
|
-
u([
|
|
837
|
-
s({ type: Object })
|
|
838
|
-
], c.prototype, "user");
|
|
839
|
-
u([
|
|
840
|
-
s({ type: Array, attribute: "user-menu" })
|
|
841
|
-
], c.prototype, "userMenu");
|
|
842
|
-
u([
|
|
843
|
-
s({ type: Object })
|
|
844
|
-
], c.prototype, "representing");
|
|
845
|
-
u([
|
|
846
|
-
s({ type: Array, attribute: "user-menu-footer" })
|
|
847
|
-
], c.prototype, "userMenuFooter");
|
|
848
|
-
u([
|
|
849
|
-
s({ type: Array, attribute: "user-options" })
|
|
850
|
-
], c.prototype, "userOptions");
|
|
851
|
-
try {
|
|
852
|
-
M("pkt-header")(c);
|
|
853
|
-
} catch {
|
|
854
|
-
console.warn("Forsøker å definere <pkt-header>, men den er allerede definert");
|
|
855
|
-
}
|
|
856
|
-
export {
|
|
857
|
-
c as PktHeader,
|
|
858
|
-
a as PktHeaderService,
|
|
859
|
-
v as PktHeaderUserMenu,
|
|
860
|
-
O as formatLastLoggedIn
|
|
861
|
-
};
|
|
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 };
|