@oslokommune/punkt-elements 16.26.7 → 17.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +110 -0
- package/dist/accordion-CbXDxOho.cjs +47 -0
- package/dist/{accordion-CBdIk9gw.js → accordion-DEUHQ4JD.js} +45 -35
- package/dist/{alert-HHTGY0sp.js → alert-CbtVGrHD.js} +31 -17
- package/dist/{alert-B8dLsiTz.cjs → alert-CkUnbPdA.cjs} +5 -5
- package/dist/base-elements/input-element.d.ts +1 -0
- package/dist/button-Cod17rKo.js +115 -0
- package/dist/{button-B5tQpKeG.cjs → button-gvDXtBMC.cjs} +5 -2
- package/dist/{calendar-DIzGBdbh.cjs → calendar-BVXW8DqC.cjs} +1 -1
- package/dist/{calendar-CjlUA-Lb.js → calendar-CjC4qlh6.js} +1 -1
- package/dist/{checkbox-Bt_sC_90.cjs → checkbox-8uxbeU30.cjs} +1 -1
- package/dist/{checkbox-D03BC2Va.js → checkbox-DJDphhqz.js} +1 -1
- package/dist/{combobox-CoQBTWqL.js → combobox-Du5yr-xM.js} +16 -2
- package/dist/combobox-hKrbYLUe.cjs +136 -0
- package/dist/components/accordion/accordion-context.d.ts +7 -0
- package/dist/components/accordion/accordion.d.ts +2 -0
- package/dist/components/accordion/accordionitem.d.ts +1 -0
- package/dist/components/alert/alert.d.ts +5 -0
- package/dist/components/alert/alert.test.d.ts +1 -0
- package/dist/components/button/button.d.ts +4 -1
- package/dist/components/datepicker/datepicker-base.d.ts +2 -0
- package/dist/components/datepicker/datepicker-utils.d.ts +2 -2
- package/dist/components/footer/footer-base.d.ts +44 -0
- package/dist/components/footer/footer-simple.d.ts +20 -0
- package/dist/components/footer/footer.accessibility.test.d.ts +0 -0
- package/dist/components/footer/footer.d.ts +22 -0
- package/dist/components/footer/footer.test.d.ts +0 -0
- package/dist/components/footer/index.d.ts +3 -0
- package/dist/components/footer/types.d.ts +16 -0
- package/dist/components/header/header-chrome-controller.d.ts +44 -0
- package/dist/components/header/header-global.accessibility.test.d.ts +0 -0
- package/dist/components/header/header-global.d.ts +78 -0
- package/dist/components/header/header-global.test.d.ts +0 -0
- package/dist/components/header/header-service.accessibility.test.d.ts +0 -0
- package/dist/components/header/header-service.d.ts +6 -21
- package/dist/components/header/header-service.test.d.ts +1 -1
- package/dist/components/header/header.d.ts +11 -3
- package/dist/components/header/header.test.d.ts +0 -0
- package/dist/components/header/index.d.ts +2 -1
- package/dist/components/header/types.d.ts +28 -2
- package/dist/components/header-menu/header-menu.d.ts +4 -5
- package/dist/components/header-menu/types.d.ts +1 -1
- package/dist/components/index.d.ts +5 -3
- package/dist/components/input-wrapper/input-wrapper.d.ts +2 -0
- package/dist/components/input-wrapper/input-wrapper.test.d.ts +1 -0
- package/dist/components/searchinput/searchinput.d.ts +5 -0
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.test.d.ts +1 -0
- package/dist/components/textarea/textarea.test.d.ts +2 -0
- package/dist/components/textinput/textinput.test.d.ts +1 -0
- package/dist/components/timepicker/timepicker.d.ts +2 -0
- package/dist/components/timepicker/timepicker.test.d.ts +3 -0
- package/dist/consent--Nw43WFU.cjs +18 -0
- package/dist/{consent-D5sY6JK3.js → consent-B2hSTCGC.js} +14 -7
- package/dist/consume-BiOhrhEy.js +167 -0
- package/dist/consume-DKf5SmP9.cjs +1 -0
- package/dist/{converters-BKGBRBpS.js → converters-BBfsEJV5.js} +25 -25
- package/dist/{converters-9jHlXDyy.cjs → converters-Cd0fPEly.cjs} +1 -1
- package/dist/{datepicker-BE5Ll0W4.js → datepicker--Fq8q-J3.js} +30 -12
- package/dist/{datepicker-x4xM3KQz.cjs → datepicker-CEoBYTBU.cjs} +11 -7
- package/dist/docs/components/alert.d.ts +3 -0
- package/dist/docs/components/footer.d.ts +9 -0
- package/dist/docs/components/form-sizes.d.ts +10 -0
- package/dist/docs/components/header-global-full.d.ts +20 -0
- package/dist/docs/components/header-global.d.ts +14 -0
- package/dist/docs/components/searchinput.d.ts +6 -3
- package/dist/fetch-header-footer-data-Pc32etrk.js +88 -0
- package/dist/fetch-header-footer-data-xohWFmYC.cjs +1 -0
- package/dist/fileupload-CGKUJrlj.cjs +401 -0
- package/dist/{fileupload-2hf8YNhO.js → fileupload-D4gQN64T.js} +156 -176
- package/dist/focus-trap-DG3pEuyJ.js +60 -0
- package/dist/focus-trap-DSv4Ifqm.cjs +1 -0
- package/dist/footer-BIrJeRuZ.js +303 -0
- package/dist/footer-Ber-jqM1.cjs +114 -0
- package/dist/footer.d.ts +1 -0
- package/dist/header-BFk1an4z.cjs +465 -0
- package/dist/header-Deg_LGJo.js +1287 -0
- package/dist/header-menu-BHqK4QA6.cjs +126 -0
- package/dist/{header-menu-C8b5vd3n.js → header-menu-GFtJKM4j.js} +25 -97
- package/dist/{helptext-OfqH5npD.js → helptext-C_brWCIT.js} +1 -1
- package/dist/{helptext-eckq4JEX.cjs → helptext-Cq5rNaAC.cjs} +1 -1
- package/dist/{input-element-ZGOWsvKM.cjs → input-element-B0qLbEdF.cjs} +1 -1
- package/dist/{input-element-BFHpeoV8.js → input-element-C0RnXi-J.js} +5 -2
- package/dist/{input-wrapper-DwwE0JcO.js → input-wrapper-BweP6t3O.js} +12 -0
- package/dist/{input-wrapper-BRjQB4zM.cjs → input-wrapper-DPkkiG7S.cjs} +13 -11
- package/dist/{input-wrapper-DaA98B5l.js → input-wrapper-fWV5P4MN.js} +22 -15
- package/dist/{input-wrapper-LcZjpt0L.cjs → input-wrapper-wh3fWIhk.cjs} +1 -1
- package/dist/modal-CPnFteYS.cjs +35 -0
- package/dist/{modal-C6pScpdG.js → modal-xNK_wpHk.js} +11 -20
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +1 -1
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -1
- package/dist/pkt-footer.cjs +1 -0
- package/dist/pkt-footer.js +2 -0
- package/dist/pkt-header-menu.cjs +1 -1
- package/dist/pkt-header-menu.js +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +2 -2
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +27 -26
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-searchinput.cjs +1 -1
- package/dist/pkt-searchinput.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/{radiobutton-DGO6H2Ki.js → radiobutton-C6htwDrT.js} +1 -1
- package/dist/{radiobutton-DY1WWepJ.cjs → radiobutton-DjWBoSHv.cjs} +1 -1
- package/dist/scroll-lock-BN8lOhV5.cjs +1 -0
- package/dist/scroll-lock-DAbNKAUy.js +18 -0
- package/dist/searchinput-CfUVfpqL.js +156 -0
- package/dist/searchinput-DGjeN1YI.cjs +60 -0
- package/dist/{select-D4_HQFkh.cjs → select-CZvAW7W2.cjs} +2 -1
- package/dist/{select-BwHUIlwQ.js → select-CsBXXbLP.js} +4 -3
- package/dist/setupTests.d.ts +0 -0
- package/dist/shared-types/footer.d.ts +95 -0
- package/dist/shared-types/{header-menu.d.ts → header-footer.d.ts} +51 -4
- package/dist/shared-types/header.d.ts +1 -1
- package/dist/shared-types/index.d.ts +6 -4
- package/dist/shared-types/searchinput.d.ts +2 -0
- package/dist/shared-types/select.d.ts +3 -2
- package/dist/shared-types/size.d.ts +4 -0
- package/dist/shared-types/timepicker.d.ts +0 -6
- package/dist/shared-utils/datepicker-utils.d.ts +5 -4
- package/dist/shared-utils/fileupload/focus-trap.d.ts +4 -10
- package/dist/shared-utils/focus-trap/index.d.ts +22 -0
- package/dist/shared-utils/{header-menu → header-footer}/example-data.d.ts +5 -4
- package/dist/shared-utils/header-footer/external-domain.d.ts +26 -0
- package/dist/shared-utils/{header-menu → header-footer}/fetch-header-footer-data.d.ts +6 -2
- package/dist/shared-utils/{header-menu → header-footer}/index.d.ts +2 -1
- package/dist/shared-utils/{header-menu → header-footer}/select-megamenu.d.ts +1 -1
- package/dist/shared-utils/scroll-lock/index.d.ts +24 -0
- package/dist/tabs-BqrKLCjd.js +214 -0
- package/dist/tabs-q62MK_-r.cjs +40 -0
- package/dist/{textarea-D6M7ZhtA.js → textarea-Cm392CEI.js} +5 -3
- package/dist/{textarea-Bt_Zs8gq.cjs → textarea-sTcZxOIB.cjs} +3 -2
- package/dist/{textinput-EDKjcUdg.cjs → textinput-DqJbTglM.cjs} +3 -2
- package/dist/{textinput-oU2EvFsi.js → textinput-TSPcBcih.js} +5 -3
- package/dist/{timepicker-CgOL2sd9.cjs → timepicker-CqFYMV8q.cjs} +8 -7
- package/dist/{timepicker-_G0V_HV3.js → timepicker-DWbgTDKq.js} +10 -9
- package/package.json +3 -3
- package/src/components/accordion/accordion-context.ts +8 -0
- package/src/components/accordion/accordion.test.ts +44 -0
- package/src/components/accordion/accordion.ts +13 -3
- package/src/components/accordion/accordionitem.ts +9 -1
- package/src/components/alert/alert.test.ts +51 -2
- package/src/components/alert/alert.ts +11 -5
- package/src/components/breadcrumbs/breadcrumbs.test.ts +11 -3
- package/src/components/button/button.test.ts +23 -0
- package/src/components/button/button.ts +28 -3
- package/src/components/combobox/combobox.core.test.ts +20 -0
- package/src/components/combobox/combobox.ts +2 -0
- package/src/components/consent/consent.test.ts +6 -3
- package/src/components/consent/consent.ts +15 -7
- package/src/components/datepicker/datepicker-base.ts +5 -1
- package/src/components/datepicker/datepicker-utils.test.ts +10 -0
- package/src/components/datepicker/datepicker.core.test.ts +17 -0
- package/src/components/datepicker/datepicker.ts +8 -0
- package/src/components/footer/footer-base.ts +238 -0
- package/src/components/footer/footer-simple.ts +71 -0
- package/src/components/footer/footer.accessibility.test.ts +66 -0
- package/src/components/footer/footer.test.ts +238 -0
- package/src/components/footer/footer.ts +81 -0
- package/src/components/footer/index.ts +4 -0
- package/src/components/footer/types.ts +21 -0
- package/src/components/header/header-chrome-controller.ts +123 -0
- package/src/components/header/header-global.accessibility.test.ts +110 -0
- package/src/components/header/header-global.test.ts +329 -0
- package/src/components/header/header-global.ts +648 -0
- package/src/components/header/header-service.accessibility.test.ts +79 -0
- package/src/components/header/header-service.test.ts +32 -12
- package/src/components/header/header-service.ts +38 -162
- package/src/components/header/header-user-menu.ts +0 -1
- package/src/components/header/header.test.ts +84 -0
- package/src/components/header/header.ts +52 -5
- package/src/components/header/index.ts +6 -0
- package/src/components/header/types.ts +38 -0
- package/src/components/header-menu/header-menu.test.ts +131 -10
- package/src/components/header-menu/header-menu.ts +23 -24
- package/src/components/header-menu/types.ts +1 -1
- package/src/components/index.ts +18 -2
- package/src/components/input-wrapper/input-wrapper.test.ts +45 -0
- package/src/components/input-wrapper/input-wrapper.ts +17 -9
- package/src/components/modal/modal.ts +8 -9
- package/src/components/searchinput/searchinput.test.ts +43 -0
- package/src/components/searchinput/searchinput.ts +29 -12
- package/src/components/select/index.ts +1 -1
- package/src/components/select/select.test.ts +28 -0
- package/src/components/select/select.ts +4 -3
- package/src/components/textarea/textarea.test.ts +16 -0
- package/src/components/textarea/textarea.ts +3 -1
- package/src/components/textinput/textinput.test.ts +28 -0
- package/src/components/textinput/textinput.ts +3 -1
- package/src/components/timepicker/timepicker.test.ts +26 -0
- package/src/components/timepicker/timepicker.ts +12 -6
- package/dist/accordion-FISAiAbX.cjs +0 -47
- package/dist/button-C_YzTSuU.js +0 -96
- package/dist/combobox-D6H9rWPV.cjs +0 -135
- package/dist/consent-X3wvhteO.cjs +0 -10
- package/dist/fileupload-BLVrslUX.cjs +0 -401
- package/dist/header-CFrsaq0c.cjs +0 -310
- package/dist/header-D_xvPR4R.js +0 -801
- package/dist/header-menu-DMdP_c6X.cjs +0 -126
- package/dist/modal-DKU7PnjJ.cjs +0 -35
- package/dist/searchinput-CyO5k4Q4.js +0 -148
- package/dist/searchinput-DG6YetL1.cjs +0 -60
- package/dist/shared-utils/modal-scroll-lock.d.ts +0 -10
- package/dist/tabs-CGo0ODPa.cjs +0 -40
- package/dist/tabs-ChdR0D1C.js +0 -379
- /package/dist/shared-utils/{header-menu → header-footer}/icon-map.d.ts +0 -0
package/dist/header-D_xvPR4R.js
DELETED
|
@@ -1,801 +0,0 @@
|
|
|
1
|
-
import { a as e, d as t, n, o as r, p as i, s as a, t as o } from "./element-BoJrqauR.js";
|
|
2
|
-
import { t as s } from "./class-map-CAQCRB1W.js";
|
|
3
|
-
import { n as c, t as l } from "./element-with-slot-mXLg8gg8.js";
|
|
4
|
-
import "./icon-DGFEIlco.js";
|
|
5
|
-
import { t as u } from "./if-defined-D0bnetLJ.js";
|
|
6
|
-
import "./button-C_YzTSuU.js";
|
|
7
|
-
import { n as d, t as f } from "./ref-WGS0u7i2.js";
|
|
8
|
-
import { t as p } from "./booleanish-MfutDT_4.js";
|
|
9
|
-
import "./link-FmkQvSQL.js";
|
|
10
|
-
import "./textinput-oU2EvFsi.js";
|
|
11
|
-
//#region ../../shared-types/header.ts
|
|
12
|
-
var m = (e) => typeof e.target == "string" ? {
|
|
13
|
-
title: e.title,
|
|
14
|
-
iconName: e.iconName,
|
|
15
|
-
href: e.target
|
|
16
|
-
} : {
|
|
17
|
-
title: e.title,
|
|
18
|
-
iconName: e.iconName,
|
|
19
|
-
onClick: e.target
|
|
20
|
-
}, h = (e) => m(e), g = (e) => {
|
|
21
|
-
if (!e) return;
|
|
22
|
-
let t = typeof e == "string" ? new Date(e) : e;
|
|
23
|
-
if (!isNaN(t.getTime())) return t.toLocaleDateString("nb-NO", {
|
|
24
|
-
day: "numeric",
|
|
25
|
-
month: "long",
|
|
26
|
-
year: "numeric",
|
|
27
|
-
hour: "2-digit",
|
|
28
|
-
minute: "2-digit"
|
|
29
|
-
});
|
|
30
|
-
}, _ = class extends o {
|
|
31
|
-
constructor(...e) {
|
|
32
|
-
super(...e), this.canChangeRepresentation = !1, this.logoutOnClick = !1;
|
|
33
|
-
}
|
|
34
|
-
handleChangeRepresentation() {
|
|
35
|
-
this.dispatchEvent(new CustomEvent("change-representation", {
|
|
36
|
-
bubbles: !0,
|
|
37
|
-
composed: !0
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
handleLogout() {
|
|
41
|
-
this.dispatchEvent(new CustomEvent("log-out", {
|
|
42
|
-
bubbles: !0,
|
|
43
|
-
composed: !0
|
|
44
|
-
}));
|
|
45
|
-
}
|
|
46
|
-
handleMenuItemClick(e) {
|
|
47
|
-
"onClick" in e && typeof e.onClick == "function" && e.onClick();
|
|
48
|
-
}
|
|
49
|
-
renderLinkOrButton(e, n) {
|
|
50
|
-
let r = "href" in e, a = s({
|
|
51
|
-
"pkt-user-menu__link": !0,
|
|
52
|
-
"pkt-link-button": !r,
|
|
53
|
-
"pkt-link": !r,
|
|
54
|
-
"pkt-link--icon-left": !r,
|
|
55
|
-
[n || ""]: !!n
|
|
56
|
-
});
|
|
57
|
-
return r ? i`
|
|
58
|
-
<pkt-link
|
|
59
|
-
icon-name=${e.iconName || t}
|
|
60
|
-
href=${e.href}
|
|
61
|
-
aria-hidden="true"
|
|
62
|
-
class="pkt-user-menu__link ${n || ""}"
|
|
63
|
-
>
|
|
64
|
-
${e.title}
|
|
65
|
-
</pkt-link>
|
|
66
|
-
` : i`
|
|
67
|
-
<button class=${a} type="button" @click=${() => this.handleMenuItemClick(e)}>
|
|
68
|
-
${e.iconName ? i`<pkt-icon
|
|
69
|
-
name=${e.iconName}
|
|
70
|
-
class="pkt-link__icon"
|
|
71
|
-
aria-hidden="true"
|
|
72
|
-
></pkt-icon>` : t}
|
|
73
|
-
${e.title}
|
|
74
|
-
</button>
|
|
75
|
-
`;
|
|
76
|
-
}
|
|
77
|
-
renderLinkSection(e) {
|
|
78
|
-
return i`
|
|
79
|
-
<ul class="pkt-user-menu__sublist">
|
|
80
|
-
${e.map((e) => i`
|
|
81
|
-
<li class="pkt-user-menu__subitem">${this.renderLinkOrButton(e)}</li>
|
|
82
|
-
`)}
|
|
83
|
-
</ul>
|
|
84
|
-
`;
|
|
85
|
-
}
|
|
86
|
-
render() {
|
|
87
|
-
let e = this.userMenu?.map(h);
|
|
88
|
-
return i`
|
|
89
|
-
<nav class="pkt-user-menu" aria-label="Meny for innlogget bruker">
|
|
90
|
-
<ul class="pkt-user-menu__list">
|
|
91
|
-
<!-- User section -->
|
|
92
|
-
${this.user ? i`
|
|
93
|
-
<li class="pkt-user-menu__item">
|
|
94
|
-
<div class="pkt-user-menu__label">Pålogget som</div>
|
|
95
|
-
<div class="pkt-user-menu__name" translate="no">${this.user.name}</div>
|
|
96
|
-
${this.formattedLastLoggedIn ? i`
|
|
97
|
-
<div class="pkt-user-menu__last-logged-in">
|
|
98
|
-
Sist pålogget: <time>${this.formattedLastLoggedIn}</time>
|
|
99
|
-
</div>
|
|
100
|
-
` : t}
|
|
101
|
-
</li>
|
|
102
|
-
` : t}
|
|
103
|
-
|
|
104
|
-
<!-- User menu items -->
|
|
105
|
-
${e && e.length > 0 ? i`
|
|
106
|
-
<li class="pkt-user-menu__item">${this.renderLinkSection(e)}</li>
|
|
107
|
-
` : t}
|
|
108
|
-
|
|
109
|
-
<!-- Representing section -->
|
|
110
|
-
${this.representing ? i`
|
|
111
|
-
<li class="pkt-user-menu__item">
|
|
112
|
-
<div class="pkt-user-menu__label">Representerer</div>
|
|
113
|
-
<div class="pkt-user-menu__name" translate="no">${this.representing.name}</div>
|
|
114
|
-
${this.representing.orgNumber ? i`<div class="pkt-user-menu__org-number">
|
|
115
|
-
Org.nr. ${this.representing.orgNumber}
|
|
116
|
-
</div>` : t}
|
|
117
|
-
${this.canChangeRepresentation ? i`
|
|
118
|
-
<ul class="pkt-user-menu__sublist mt-size-16">
|
|
119
|
-
<li class="pkt-user-menu__subitem">
|
|
120
|
-
${this.renderLinkOrButton({
|
|
121
|
-
title: "Endre organisasjon",
|
|
122
|
-
iconName: "cogwheel",
|
|
123
|
-
onClick: () => this.handleChangeRepresentation()
|
|
124
|
-
})}
|
|
125
|
-
</li>
|
|
126
|
-
</ul>
|
|
127
|
-
` : t}
|
|
128
|
-
</li>
|
|
129
|
-
` : t}
|
|
130
|
-
|
|
131
|
-
<!-- Change representation without representing object -->
|
|
132
|
-
${!this.representing && this.canChangeRepresentation ? i`
|
|
133
|
-
<li class="pkt-user-menu__item">
|
|
134
|
-
<ul class="pkt-user-menu__sublist">
|
|
135
|
-
<li class="pkt-user-menu__subitem">
|
|
136
|
-
${this.renderLinkOrButton({
|
|
137
|
-
title: "Endre organisasjon",
|
|
138
|
-
iconName: "cogwheel",
|
|
139
|
-
onClick: () => this.handleChangeRepresentation()
|
|
140
|
-
})}
|
|
141
|
-
</li>
|
|
142
|
-
</ul>
|
|
143
|
-
</li>
|
|
144
|
-
` : t}
|
|
145
|
-
|
|
146
|
-
<!-- Logout -->
|
|
147
|
-
${this.logoutOnClick ? i`
|
|
148
|
-
<li class="pkt-user-menu__item">
|
|
149
|
-
${this.renderLinkOrButton({
|
|
150
|
-
title: "Logg ut",
|
|
151
|
-
iconName: "exit",
|
|
152
|
-
onClick: () => this.handleLogout()
|
|
153
|
-
})}
|
|
154
|
-
</li>
|
|
155
|
-
` : t}
|
|
156
|
-
</ul>
|
|
157
|
-
</nav>
|
|
158
|
-
`;
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
n([r({ type: Object })], _.prototype, "user", void 0), n([r({
|
|
162
|
-
type: String,
|
|
163
|
-
attribute: "formatted-last-logged-in"
|
|
164
|
-
})], _.prototype, "formattedLastLoggedIn", void 0), n([r({ type: Object })], _.prototype, "representing", void 0), n([r({
|
|
165
|
-
type: Array,
|
|
166
|
-
attribute: "user-menu"
|
|
167
|
-
})], _.prototype, "userMenu", void 0), n([r({
|
|
168
|
-
type: Boolean,
|
|
169
|
-
attribute: "can-change-representation",
|
|
170
|
-
converter: p
|
|
171
|
-
})], _.prototype, "canChangeRepresentation", void 0), n([r({
|
|
172
|
-
type: Boolean,
|
|
173
|
-
attribute: "logout-on-click",
|
|
174
|
-
converter: p
|
|
175
|
-
})], _.prototype, "logoutOnClick", void 0);
|
|
176
|
-
try {
|
|
177
|
-
a("pkt-header-user-menu")(_);
|
|
178
|
-
} catch {
|
|
179
|
-
console.warn("Forsøker å definere <pkt-header-user-menu>, men den er allerede definert");
|
|
180
|
-
}
|
|
181
|
-
//#endregion
|
|
182
|
-
//#region src/components/header/header-service.ts
|
|
183
|
-
var v = "https://punkt-cdn.oslo.kommune.no/latest/logos/";
|
|
184
|
-
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || v);
|
|
185
|
-
var y = class extends l {
|
|
186
|
-
constructor(...e) {
|
|
187
|
-
super(...e), this.logoPath = typeof window < "u" ? window.pktLogoPath : v, 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 = () => {
|
|
188
|
-
if (!this.shouldHideOnScroll) return;
|
|
189
|
-
let e = window.pageYOffset || document.documentElement.scrollTop;
|
|
190
|
-
e < 0 || Math.abs(e - this.lastScrollPosition) < 60 || (this.isHidden = e > this.lastScrollPosition, this.lastScrollPosition = e);
|
|
191
|
-
}, this.handleClickOutside = (e) => {
|
|
192
|
-
let t = e.target;
|
|
193
|
-
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");
|
|
194
|
-
}, this.handleSlotContentClick = (e) => {
|
|
195
|
-
if (!this.isTablet || this.openMenu !== "slot") return;
|
|
196
|
-
let t = e.target.closest("a[href], button, [role=\"link\"], [role=\"button\"], [role=\"menuitem\"], [role=\"menuitemradio\"], [role=\"menuitemcheckbox\"]");
|
|
197
|
-
!t || !this.slotContentRef.value?.contains(t) || t.closest("[data-pkt-header-keep-open]") || t.disabled || t.getAttribute("aria-disabled") === "true" || (this.openMenu = "none");
|
|
198
|
-
}, this.handleFocusOut = (e, t) => {
|
|
199
|
-
let n = e.relatedTarget, r;
|
|
200
|
-
switch (t) {
|
|
201
|
-
case "user":
|
|
202
|
-
r = this.userContainerRef;
|
|
203
|
-
break;
|
|
204
|
-
case "slot":
|
|
205
|
-
r = this.slotContainerRef;
|
|
206
|
-
break;
|
|
207
|
-
case "search":
|
|
208
|
-
r = this.searchContainerRef;
|
|
209
|
-
break;
|
|
210
|
-
default: return;
|
|
211
|
-
}
|
|
212
|
-
let i = r.value;
|
|
213
|
-
i && (!n || !i.contains(n)) && (this.openMenu = "none");
|
|
214
|
-
}, this.handleEscapeKey = (e) => {
|
|
215
|
-
e.key === "Escape" && this.openMenu !== "none" && (e.preventDefault(), this.shouldRestoreFocus = !0, this.openMenu = "none");
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
connectedCallback() {
|
|
219
|
-
super.connectedCallback(), this.setupScrollListener();
|
|
220
|
-
}
|
|
221
|
-
disconnectedCallback() {
|
|
222
|
-
super.disconnectedCallback(), this.resizeObserver?.disconnect(), window.removeEventListener("scroll", this.handleScroll), this.unlockScroll();
|
|
223
|
-
}
|
|
224
|
-
firstUpdated() {
|
|
225
|
-
this.setupResizeObserver();
|
|
226
|
-
}
|
|
227
|
-
updated(e) {
|
|
228
|
-
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")) {
|
|
229
|
-
let t = e.get("openMenu");
|
|
230
|
-
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(() => {
|
|
231
|
-
this.checkDropdownAlignment(this.openMenu);
|
|
232
|
-
})) : this.openMenu === "none" && t !== "none" && (document.removeEventListener("mousedown", this.handleClickOutside), document.removeEventListener("keydown", this.handleEscapeKey), this.restoreFocus());
|
|
233
|
-
}
|
|
234
|
-
(e.has("openMenu") || e.has("isMobile")) && this.updateScrollLock();
|
|
235
|
-
}
|
|
236
|
-
setupResizeObserver() {
|
|
237
|
-
let e = this.headerRef.value;
|
|
238
|
-
e && (this.componentWidth = e.offsetWidth, this.updateIsMobile(), this.updateIsTablet(), this.resizeObserver = new ResizeObserver((e) => {
|
|
239
|
-
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();
|
|
240
|
-
}), this.resizeObserver.observe(e));
|
|
241
|
-
}
|
|
242
|
-
updateIsMobile() {
|
|
243
|
-
this.isMobile = this.componentWidth < this.mobileBreakpoint;
|
|
244
|
-
}
|
|
245
|
-
updateIsTablet() {
|
|
246
|
-
this.isTablet = this.componentWidth < this.tabletBreakpoint;
|
|
247
|
-
}
|
|
248
|
-
updateScrollLock() {
|
|
249
|
-
this.position === "fixed" && this.isMobile && this.openMenu !== "none" ? this.lockScroll() : this.unlockScroll();
|
|
250
|
-
}
|
|
251
|
-
lockScroll() {
|
|
252
|
-
let e = document.body, t = document.documentElement;
|
|
253
|
-
this.savedScrollY = window.scrollY || window.pageYOffset;
|
|
254
|
-
let n = window.innerWidth - t.clientWidth;
|
|
255
|
-
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");
|
|
256
|
-
}
|
|
257
|
-
unlockScroll() {
|
|
258
|
-
let e = document.body, t = document.documentElement;
|
|
259
|
-
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 }));
|
|
260
|
-
}
|
|
261
|
-
setupScrollListener() {
|
|
262
|
-
window.addEventListener("scroll", this.handleScroll);
|
|
263
|
-
}
|
|
264
|
-
restoreFocus() {
|
|
265
|
-
this.shouldRestoreFocus && this.lastFocusedElement && document.contains(this.lastFocusedElement) && this.lastFocusedElement.focus(), this.lastFocusedElement = null, this.shouldRestoreFocus = !1;
|
|
266
|
-
}
|
|
267
|
-
checkDropdownAlignment(e) {
|
|
268
|
-
let t = e === "slot" ? this.slotContainerRef : this.searchContainerRef, n = e === "slot" ? this.slotContentRef : this.searchMenuRef;
|
|
269
|
-
if (!t.value || !n.value || !this.isTablet || this.isMobile) return;
|
|
270
|
-
let r = t.value.getBoundingClientRect(), i = n.value.offsetWidth, a = r.left + i > window.innerWidth;
|
|
271
|
-
e === "slot" ? this.alignSlotRight = a : this.alignSearchRight = a;
|
|
272
|
-
}
|
|
273
|
-
handleMenuToggle(e) {
|
|
274
|
-
this.openMenu === "none" ? (this.lastFocusedElement = document.activeElement, this.openMenu = e) : this.openMenu = "none";
|
|
275
|
-
}
|
|
276
|
-
handleLogoClick(e) {
|
|
277
|
-
this.dispatchEvent(new CustomEvent("logo-click", {
|
|
278
|
-
bubbles: !0,
|
|
279
|
-
composed: !0,
|
|
280
|
-
detail: { originalEvent: e }
|
|
281
|
-
}));
|
|
282
|
-
}
|
|
283
|
-
handleServiceClick(e) {
|
|
284
|
-
this.dispatchEvent(new CustomEvent("service-click", {
|
|
285
|
-
bubbles: !0,
|
|
286
|
-
composed: !0,
|
|
287
|
-
detail: { originalEvent: e }
|
|
288
|
-
}));
|
|
289
|
-
}
|
|
290
|
-
handleLogout() {
|
|
291
|
-
this.dispatchEvent(new CustomEvent("log-out", {
|
|
292
|
-
bubbles: !0,
|
|
293
|
-
composed: !0
|
|
294
|
-
}));
|
|
295
|
-
}
|
|
296
|
-
handleSearch(e) {
|
|
297
|
-
this.dispatchEvent(new CustomEvent("search", {
|
|
298
|
-
detail: { query: e },
|
|
299
|
-
bubbles: !0,
|
|
300
|
-
composed: !0
|
|
301
|
-
}));
|
|
302
|
-
}
|
|
303
|
-
handleSearchChange(e) {
|
|
304
|
-
this.dispatchEvent(new CustomEvent("search-change", {
|
|
305
|
-
detail: { query: e },
|
|
306
|
-
bubbles: !0,
|
|
307
|
-
composed: !0
|
|
308
|
-
}));
|
|
309
|
-
}
|
|
310
|
-
handleSearchInputChange(e) {
|
|
311
|
-
let t = e.target.value;
|
|
312
|
-
this.handleSearchChange(t);
|
|
313
|
-
}
|
|
314
|
-
handleSearchKeyDown(e) {
|
|
315
|
-
e.key === "Enter" && this.handleSearch(e.target.value);
|
|
316
|
-
}
|
|
317
|
-
get formattedLastLoggedIn() {
|
|
318
|
-
return g(this.user?.lastLoggedIn);
|
|
319
|
-
}
|
|
320
|
-
get isFixed() {
|
|
321
|
-
return this.position === "fixed";
|
|
322
|
-
}
|
|
323
|
-
get shouldHideOnScroll() {
|
|
324
|
-
return this.scrollBehavior === "hide";
|
|
325
|
-
}
|
|
326
|
-
get showLogoutInHeader() {
|
|
327
|
-
return this.hasLogOut && (this.logOutButtonPlacement === "header" || this.logOutButtonPlacement === "both");
|
|
328
|
-
}
|
|
329
|
-
get showLogoutInUserMenu() {
|
|
330
|
-
return this.hasLogOut && (this.logOutButtonPlacement === "userMenu" || this.logOutButtonPlacement === "both");
|
|
331
|
-
}
|
|
332
|
-
renderLogo() {
|
|
333
|
-
if (this.hideLogo) return t;
|
|
334
|
-
let e = i`
|
|
335
|
-
<pkt-icon name="oslologo" aria-hidden="true" path=${this.logoPath}></pkt-icon>
|
|
336
|
-
`;
|
|
337
|
-
return this.logoLink && typeof this.logoLink == "string" ? i`
|
|
338
|
-
<span class="pkt-header-service__logo">
|
|
339
|
-
<a href=${this.logoLink} aria-label="Tilbake til forside" @click=${this.handleLogoClick}>
|
|
340
|
-
${e}
|
|
341
|
-
</a>
|
|
342
|
-
</span>
|
|
343
|
-
` : this.hasAttribute("logo-link") ? i`
|
|
344
|
-
<span class="pkt-header-service__logo">
|
|
345
|
-
<button
|
|
346
|
-
aria-label="Tilbake til forside"
|
|
347
|
-
class="pkt-link-button pkt-link pkt-header-service__logo-link"
|
|
348
|
-
@click=${this.handleLogoClick}
|
|
349
|
-
>
|
|
350
|
-
${e}
|
|
351
|
-
</button>
|
|
352
|
-
</span>
|
|
353
|
-
` : i`
|
|
354
|
-
<span class="pkt-header-service__logo" @click=${this.handleLogoClick}>${e}</span>
|
|
355
|
-
`;
|
|
356
|
-
}
|
|
357
|
-
renderServiceName() {
|
|
358
|
-
return this.serviceName ? this.serviceLink && typeof this.serviceLink == "string" ? i`
|
|
359
|
-
<span class="pkt-header-service__service-name" translate="no">
|
|
360
|
-
<pkt-link
|
|
361
|
-
href=${this.serviceLink}
|
|
362
|
-
class="pkt-header-service__service-link"
|
|
363
|
-
@click=${this.handleServiceClick}
|
|
364
|
-
>
|
|
365
|
-
${this.serviceName}
|
|
366
|
-
</pkt-link>
|
|
367
|
-
</span>
|
|
368
|
-
` : this.hasAttribute("service-link") ? i`
|
|
369
|
-
<span class="pkt-header-service__service-name" translate="no">
|
|
370
|
-
<button
|
|
371
|
-
class="pkt-link-button pkt-link pkt-header-service__service-link"
|
|
372
|
-
@click=${this.handleServiceClick}
|
|
373
|
-
>
|
|
374
|
-
${this.serviceName}
|
|
375
|
-
</button>
|
|
376
|
-
</span>
|
|
377
|
-
` : i`
|
|
378
|
-
<span
|
|
379
|
-
class="pkt-header-service__service-name"
|
|
380
|
-
translate="no"
|
|
381
|
-
@click=${this.handleServiceClick}
|
|
382
|
-
>
|
|
383
|
-
<span class="pkt-header-service__service-link">${this.serviceName}</span>
|
|
384
|
-
</span>
|
|
385
|
-
` : t;
|
|
386
|
-
}
|
|
387
|
-
renderSlotContainer() {
|
|
388
|
-
if (!this.hasSlotContent()) return t;
|
|
389
|
-
let e = s({
|
|
390
|
-
"pkt-header-service__slot-container": !0,
|
|
391
|
-
"is-open": this.openMenu === "slot"
|
|
392
|
-
}), n = s({
|
|
393
|
-
"pkt-header-service__slot-content": !0,
|
|
394
|
-
"align-right": this.alignSlotRight
|
|
395
|
-
});
|
|
396
|
-
return i`
|
|
397
|
-
<div
|
|
398
|
-
class=${e}
|
|
399
|
-
@focusout=${(e) => this.handleFocusOut(e, "slot")}
|
|
400
|
-
${d(this.slotContainerRef)}
|
|
401
|
-
>
|
|
402
|
-
${this.isTablet && this.hasSlotContent() ? i`
|
|
403
|
-
<pkt-button
|
|
404
|
-
skin="secondary"
|
|
405
|
-
variant=${this.slotMenuVariant}
|
|
406
|
-
iconName="menu"
|
|
407
|
-
size=${this.isMobile ? "small" : "medium"}
|
|
408
|
-
state=${this.openMenu === "slot" ? "active" : "normal"}
|
|
409
|
-
@click=${() => this.handleMenuToggle("slot")}
|
|
410
|
-
aria-expanded=${this.openMenu === "slot"}
|
|
411
|
-
aria-controls="mobile-slot-menu"
|
|
412
|
-
aria-label="Åpne meny"
|
|
413
|
-
>
|
|
414
|
-
${this.slotMenuText}
|
|
415
|
-
</pkt-button>
|
|
416
|
-
` : t}
|
|
417
|
-
<div
|
|
418
|
-
class=${n}
|
|
419
|
-
id="mobile-slot-menu"
|
|
420
|
-
role=${this.isTablet ? "menu" : t}
|
|
421
|
-
aria-label=${this.isTablet ? "Meny" : t}
|
|
422
|
-
@click=${this.handleSlotContentClick}
|
|
423
|
-
${d(this.slotContentRef)}
|
|
424
|
-
>
|
|
425
|
-
${c(this)}
|
|
426
|
-
</div>
|
|
427
|
-
</div>
|
|
428
|
-
`;
|
|
429
|
-
}
|
|
430
|
-
renderSearch() {
|
|
431
|
-
if (!this.showSearch) return t;
|
|
432
|
-
if (this.isTablet) {
|
|
433
|
-
let e = s({
|
|
434
|
-
"pkt-header-service__search-container": !0,
|
|
435
|
-
"is-open": this.openMenu === "search"
|
|
436
|
-
}), n = s({
|
|
437
|
-
"pkt-header-service__mobile-menu": !0,
|
|
438
|
-
"is-open": this.openMenu === "search",
|
|
439
|
-
"align-right": this.alignSearchRight
|
|
440
|
-
});
|
|
441
|
-
return i`
|
|
442
|
-
<div
|
|
443
|
-
class=${e}
|
|
444
|
-
@focusout=${(e) => this.handleFocusOut(e, "search")}
|
|
445
|
-
${d(this.searchContainerRef)}
|
|
446
|
-
>
|
|
447
|
-
<pkt-button
|
|
448
|
-
skin="secondary"
|
|
449
|
-
variant="icon-only"
|
|
450
|
-
iconName="magnifying-glass-big"
|
|
451
|
-
size=${this.isMobile ? "small" : "medium"}
|
|
452
|
-
@click=${() => this.handleMenuToggle("search")}
|
|
453
|
-
state=${this.openMenu === "search" ? "active" : "normal"}
|
|
454
|
-
aria-expanded=${this.openMenu === "search"}
|
|
455
|
-
aria-controls="mobile-search-menu"
|
|
456
|
-
aria-label="Åpne søkefelt"
|
|
457
|
-
>
|
|
458
|
-
Søk
|
|
459
|
-
</pkt-button>
|
|
460
|
-
<div class=${n} ${d(this.searchMenuRef)}>
|
|
461
|
-
${this.openMenu === "search" ? i`
|
|
462
|
-
<pkt-textinput
|
|
463
|
-
id="mobile-search-menu"
|
|
464
|
-
class="pkt-header-service__search-input"
|
|
465
|
-
type="search"
|
|
466
|
-
label="Søk"
|
|
467
|
-
useWrapper="false"
|
|
468
|
-
placeholder=${this.searchPlaceholder}
|
|
469
|
-
value=${this.searchValue}
|
|
470
|
-
autofocus
|
|
471
|
-
fullwidth
|
|
472
|
-
@input=${this.handleSearchInputChange}
|
|
473
|
-
@keydown=${(e) => {
|
|
474
|
-
e.key === "Enter" && this.handleSearch(e.target.value);
|
|
475
|
-
}}
|
|
476
|
-
></pkt-textinput>
|
|
477
|
-
` : t}
|
|
478
|
-
</div>
|
|
479
|
-
</div>
|
|
480
|
-
`;
|
|
481
|
-
}
|
|
482
|
-
return i`
|
|
483
|
-
<pkt-textinput
|
|
484
|
-
id="header-service-search"
|
|
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
|
-
@input=${this.handleSearchInputChange}
|
|
492
|
-
@keydown=${this.handleSearchKeyDown}
|
|
493
|
-
></pkt-textinput>
|
|
494
|
-
`;
|
|
495
|
-
}
|
|
496
|
-
renderUserButton() {
|
|
497
|
-
if (!this.user) return t;
|
|
498
|
-
let e = s({
|
|
499
|
-
"pkt-header-service__user-menu": this.isMobile === !1,
|
|
500
|
-
"pkt-header-service__mobile-menu": this.isMobile === !0,
|
|
501
|
-
"is-open": this.openMenu === "user"
|
|
502
|
-
});
|
|
503
|
-
return i`
|
|
504
|
-
<div
|
|
505
|
-
class="pkt-header-service__user-container"
|
|
506
|
-
@focusout=${(e) => this.handleFocusOut(e, "user")}
|
|
507
|
-
${d(this.userContainerRef)}
|
|
508
|
-
>
|
|
509
|
-
<pkt-button
|
|
510
|
-
class=${s({
|
|
511
|
-
"pkt-header-service__user-button": !0,
|
|
512
|
-
"pkt-header-service__user-button--mobile": this.isMobile
|
|
513
|
-
})}
|
|
514
|
-
skin="secondary"
|
|
515
|
-
size=${this.isMobile ? "small" : "medium"}
|
|
516
|
-
state=${this.openMenu === "user" ? "active" : "normal"}
|
|
517
|
-
variant="icons-right-and-left"
|
|
518
|
-
iconName="user"
|
|
519
|
-
secondIconName=${this.openMenu === "user" ? "chevron-thin-up" : "chevron-thin-down"}
|
|
520
|
-
@click=${() => this.handleMenuToggle("user")}
|
|
521
|
-
>
|
|
522
|
-
<span class="pkt-sr-only">Brukermeny: </span>
|
|
523
|
-
<span translate="no">${this.representing?.name || this.user.name}</span>
|
|
524
|
-
</pkt-button>
|
|
525
|
-
${this.openMenu === "user" && this.user ? i`
|
|
526
|
-
<div class=${e}>
|
|
527
|
-
<pkt-header-user-menu
|
|
528
|
-
.user=${this.user}
|
|
529
|
-
formatted-last-logged-in=${this.formattedLastLoggedIn || t}
|
|
530
|
-
.representing=${this.representing}
|
|
531
|
-
.userMenu=${this.userMenu}
|
|
532
|
-
?can-change-representation=${this.canChangeRepresentation}
|
|
533
|
-
?logout-on-click=${this.showLogoutInUserMenu}
|
|
534
|
-
@change-representation=${() => this.dispatchEvent(new CustomEvent("change-representation", {
|
|
535
|
-
bubbles: !0,
|
|
536
|
-
composed: !0
|
|
537
|
-
}))}
|
|
538
|
-
@log-out=${this.handleLogout}
|
|
539
|
-
></pkt-header-user-menu>
|
|
540
|
-
</div>
|
|
541
|
-
` : t}
|
|
542
|
-
</div>
|
|
543
|
-
`;
|
|
544
|
-
}
|
|
545
|
-
renderHeader() {
|
|
546
|
-
let e = s({
|
|
547
|
-
"pkt-header-service": !0,
|
|
548
|
-
"pkt-header-service--compact": this.compact,
|
|
549
|
-
"pkt-header-service--mobile": this.isMobile,
|
|
550
|
-
"pkt-header-service--tablet": this.isTablet,
|
|
551
|
-
"pkt-header-service--fixed": this.isFixed,
|
|
552
|
-
"pkt-header-service--scroll-to-hide": this.shouldHideOnScroll,
|
|
553
|
-
"pkt-header-service--hidden": this.isHidden
|
|
554
|
-
}), n = s({
|
|
555
|
-
"pkt-header-service__logo-area": !0,
|
|
556
|
-
"pkt-header-service__logo-area--without-service": !this.serviceName
|
|
557
|
-
});
|
|
558
|
-
return i`
|
|
559
|
-
<header class=${e} ${d(this.headerRef)}>
|
|
560
|
-
<div class=${n}>${this.renderLogo()} ${this.renderServiceName()}</div>
|
|
561
|
-
|
|
562
|
-
${this.hasSlotContent() || this.showSearch || this.showLogoutInHeader ? i`<div class="pkt-header-service__content">
|
|
563
|
-
${this.renderSlotContainer()} ${this.renderSearch()}
|
|
564
|
-
${this.isTablet && this.showLogoutInHeader ? i`
|
|
565
|
-
<pkt-button
|
|
566
|
-
skin="secondary"
|
|
567
|
-
size=${this.isMobile ? "small" : "medium"}
|
|
568
|
-
variant="icon-only"
|
|
569
|
-
iconName="exit"
|
|
570
|
-
@click=${this.handleLogout}
|
|
571
|
-
>
|
|
572
|
-
Logg ut
|
|
573
|
-
</pkt-button>
|
|
574
|
-
` : t}
|
|
575
|
-
</div>` : t}
|
|
576
|
-
${this.user || !this.isTablet && this.showLogoutInHeader ? i`<div class="pkt-header-service__user">
|
|
577
|
-
${this.renderUserButton()}
|
|
578
|
-
${!this.isTablet && this.showLogoutInHeader ? i`
|
|
579
|
-
<pkt-button
|
|
580
|
-
skin="tertiary"
|
|
581
|
-
size="medium"
|
|
582
|
-
variant="icon-right"
|
|
583
|
-
iconName="exit"
|
|
584
|
-
@click=${this.handleLogout}
|
|
585
|
-
>
|
|
586
|
-
Logg ut
|
|
587
|
-
</pkt-button>
|
|
588
|
-
` : t}
|
|
589
|
-
</div>` : t}
|
|
590
|
-
</header>
|
|
591
|
-
`;
|
|
592
|
-
}
|
|
593
|
-
render() {
|
|
594
|
-
let e = this.renderHeader();
|
|
595
|
-
return this.isFixed ? i`
|
|
596
|
-
<div class="pkt-header-service-wrapper">
|
|
597
|
-
${e}
|
|
598
|
-
<div class=${s({
|
|
599
|
-
"pkt-header-service-spacer": !0,
|
|
600
|
-
"pkt-header-service-spacer--compact": this.compact,
|
|
601
|
-
"pkt-header-service-spacer--has-user": !!this.user,
|
|
602
|
-
"pkt-header-service-spacer--mobile": this.isMobile,
|
|
603
|
-
"pkt-header-service-spacer--tablet": this.isTablet
|
|
604
|
-
})}></div>
|
|
605
|
-
</div>
|
|
606
|
-
` : e;
|
|
607
|
-
}
|
|
608
|
-
};
|
|
609
|
-
n([r({
|
|
610
|
-
type: String,
|
|
611
|
-
attribute: "service-name"
|
|
612
|
-
})], y.prototype, "serviceName", void 0), n([r({
|
|
613
|
-
type: String,
|
|
614
|
-
attribute: "service-link"
|
|
615
|
-
})], y.prototype, "serviceLink", void 0), n([r({
|
|
616
|
-
type: String,
|
|
617
|
-
attribute: "logo-link"
|
|
618
|
-
})], y.prototype, "logoLink", void 0), n([r({
|
|
619
|
-
type: String,
|
|
620
|
-
attribute: "logo-path"
|
|
621
|
-
})], y.prototype, "logoPath", void 0), n([r({
|
|
622
|
-
type: String,
|
|
623
|
-
attribute: "search-placeholder"
|
|
624
|
-
})], y.prototype, "searchPlaceholder", void 0), n([r({
|
|
625
|
-
type: String,
|
|
626
|
-
attribute: "search-value"
|
|
627
|
-
})], y.prototype, "searchValue", void 0), n([r({
|
|
628
|
-
type: Number,
|
|
629
|
-
attribute: "mobile-breakpoint"
|
|
630
|
-
})], y.prototype, "mobileBreakpoint", void 0), n([r({
|
|
631
|
-
type: Number,
|
|
632
|
-
attribute: "tablet-breakpoint"
|
|
633
|
-
})], y.prototype, "tabletBreakpoint", void 0), n([r({
|
|
634
|
-
type: String,
|
|
635
|
-
attribute: "opened-menu"
|
|
636
|
-
})], y.prototype, "openedMenu", void 0), n([r({
|
|
637
|
-
type: String,
|
|
638
|
-
attribute: "log-out-button-placement"
|
|
639
|
-
})], y.prototype, "logOutButtonPlacement", void 0), n([r({ type: String })], y.prototype, "position", void 0), n([r({
|
|
640
|
-
type: String,
|
|
641
|
-
attribute: "scroll-behavior"
|
|
642
|
-
})], y.prototype, "scrollBehavior", void 0), n([r({
|
|
643
|
-
type: String,
|
|
644
|
-
attribute: "slot-menu-variant"
|
|
645
|
-
})], y.prototype, "slotMenuVariant", void 0), n([r({
|
|
646
|
-
type: String,
|
|
647
|
-
attribute: "slot-menu-text"
|
|
648
|
-
})], y.prototype, "slotMenuText", void 0), n([r({
|
|
649
|
-
type: Boolean,
|
|
650
|
-
attribute: "hide-logo",
|
|
651
|
-
converter: p
|
|
652
|
-
})], y.prototype, "hideLogo", void 0), n([r({
|
|
653
|
-
type: Boolean,
|
|
654
|
-
converter: p
|
|
655
|
-
})], y.prototype, "compact", void 0), n([r({
|
|
656
|
-
type: Boolean,
|
|
657
|
-
attribute: "show-search",
|
|
658
|
-
converter: p
|
|
659
|
-
})], y.prototype, "showSearch", void 0), n([r({
|
|
660
|
-
type: Boolean,
|
|
661
|
-
attribute: "can-change-representation",
|
|
662
|
-
converter: p
|
|
663
|
-
})], y.prototype, "canChangeRepresentation", void 0), n([r({
|
|
664
|
-
type: Boolean,
|
|
665
|
-
attribute: "has-log-out",
|
|
666
|
-
converter: p
|
|
667
|
-
})], y.prototype, "hasLogOut", void 0), n([r({ type: Object })], y.prototype, "user", void 0), n([r({
|
|
668
|
-
type: Array,
|
|
669
|
-
attribute: "user-menu"
|
|
670
|
-
})], y.prototype, "userMenu", void 0), n([r({ type: Object })], y.prototype, "representing", void 0), n([e()], y.prototype, "isMobile", void 0), n([e()], y.prototype, "isTablet", void 0), n([e()], y.prototype, "openMenu", void 0), n([e()], y.prototype, "isHidden", void 0), n([e()], y.prototype, "componentWidth", void 0), n([e()], y.prototype, "alignSlotRight", void 0), n([e()], y.prototype, "alignSearchRight", void 0);
|
|
671
|
-
try {
|
|
672
|
-
a("pkt-header-service")(y);
|
|
673
|
-
} catch {
|
|
674
|
-
console.warn("Forsøker å definere <pkt-header-service>, men den er allerede definert");
|
|
675
|
-
}
|
|
676
|
-
//#endregion
|
|
677
|
-
//#region src/components/header/header.ts
|
|
678
|
-
var b = class extends l {
|
|
679
|
-
constructor(...e) {
|
|
680
|
-
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;
|
|
681
|
-
}
|
|
682
|
-
firstUpdated(e) {
|
|
683
|
-
super.firstUpdated(e), this.emitDeprecationWarnings();
|
|
684
|
-
}
|
|
685
|
-
emitDeprecationWarnings() {
|
|
686
|
-
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.");
|
|
687
|
-
}
|
|
688
|
-
get effectiveUserMenu() {
|
|
689
|
-
let e = this.userMenu || [], t = this.userMenuFooter || [], n = this.userOptions || [];
|
|
690
|
-
return t.length || n.length ? [
|
|
691
|
-
...e,
|
|
692
|
-
...n,
|
|
693
|
-
...t
|
|
694
|
-
] : this.userMenu;
|
|
695
|
-
}
|
|
696
|
-
render() {
|
|
697
|
-
return i`
|
|
698
|
-
<pkt-header-service
|
|
699
|
-
service-name=${u(this.serviceName)}
|
|
700
|
-
service-link=${u(this.serviceLink)}
|
|
701
|
-
logo-link=${u(this.logoLink)}
|
|
702
|
-
logo-path=${u(this.logoPath)}
|
|
703
|
-
search-placeholder=${this.searchPlaceholder}
|
|
704
|
-
search-value=${this.searchValue}
|
|
705
|
-
mobile-breakpoint=${this.mobileBreakpoint}
|
|
706
|
-
tablet-breakpoint=${this.tabletBreakpoint}
|
|
707
|
-
opened-menu=${this.openedMenu}
|
|
708
|
-
log-out-button-placement=${this.logOutButtonPlacement}
|
|
709
|
-
position=${this.position}
|
|
710
|
-
scroll-behavior=${this.scrollBehavior}
|
|
711
|
-
slot-menu-variant=${this.slotMenuVariant}
|
|
712
|
-
slot-menu-text=${this.slotMenuText}
|
|
713
|
-
.hideLogo=${this.hideLogo}
|
|
714
|
-
.compact=${this.compact}
|
|
715
|
-
.showSearch=${this.showSearch}
|
|
716
|
-
.canChangeRepresentation=${this.canChangeRepresentation}
|
|
717
|
-
.hasLogOut=${this.hasLogOut}
|
|
718
|
-
.user=${this.user}
|
|
719
|
-
.userMenu=${this.effectiveUserMenu}
|
|
720
|
-
.representing=${this.representing}
|
|
721
|
-
>
|
|
722
|
-
${this.hasSlotContent() ? i`<div class="pkt-contents">${c(this)}</div>` : t}
|
|
723
|
-
</pkt-header-service>
|
|
724
|
-
`;
|
|
725
|
-
}
|
|
726
|
-
};
|
|
727
|
-
n([r({
|
|
728
|
-
type: String,
|
|
729
|
-
attribute: "service-name"
|
|
730
|
-
})], b.prototype, "serviceName", void 0), n([r({
|
|
731
|
-
type: String,
|
|
732
|
-
attribute: "service-link"
|
|
733
|
-
})], b.prototype, "serviceLink", void 0), n([r({
|
|
734
|
-
type: String,
|
|
735
|
-
attribute: "logo-link"
|
|
736
|
-
})], b.prototype, "logoLink", void 0), n([r({
|
|
737
|
-
type: String,
|
|
738
|
-
attribute: "logo-path"
|
|
739
|
-
})], b.prototype, "logoPath", void 0), n([r({
|
|
740
|
-
type: String,
|
|
741
|
-
attribute: "search-placeholder"
|
|
742
|
-
})], b.prototype, "searchPlaceholder", void 0), n([r({
|
|
743
|
-
type: String,
|
|
744
|
-
attribute: "search-value"
|
|
745
|
-
})], b.prototype, "searchValue", void 0), n([r({
|
|
746
|
-
type: Number,
|
|
747
|
-
attribute: "mobile-breakpoint"
|
|
748
|
-
})], b.prototype, "mobileBreakpoint", void 0), n([r({
|
|
749
|
-
type: Number,
|
|
750
|
-
attribute: "tablet-breakpoint"
|
|
751
|
-
})], b.prototype, "tabletBreakpoint", void 0), n([r({
|
|
752
|
-
type: String,
|
|
753
|
-
attribute: "opened-menu"
|
|
754
|
-
})], b.prototype, "openedMenu", void 0), n([r({
|
|
755
|
-
type: String,
|
|
756
|
-
attribute: "log-out-button-placement"
|
|
757
|
-
})], b.prototype, "logOutButtonPlacement", void 0), n([r({ type: String })], b.prototype, "position", void 0), n([r({
|
|
758
|
-
type: String,
|
|
759
|
-
attribute: "scroll-behavior"
|
|
760
|
-
})], b.prototype, "scrollBehavior", void 0), n([r({
|
|
761
|
-
type: String,
|
|
762
|
-
attribute: "slot-menu-variant"
|
|
763
|
-
})], b.prototype, "slotMenuVariant", void 0), n([r({
|
|
764
|
-
type: String,
|
|
765
|
-
attribute: "slot-menu-text"
|
|
766
|
-
})], b.prototype, "slotMenuText", void 0), n([r({
|
|
767
|
-
type: Boolean,
|
|
768
|
-
attribute: "hide-logo",
|
|
769
|
-
converter: p
|
|
770
|
-
})], b.prototype, "hideLogo", void 0), n([r({
|
|
771
|
-
type: Boolean,
|
|
772
|
-
converter: p
|
|
773
|
-
})], b.prototype, "compact", void 0), n([r({
|
|
774
|
-
type: Boolean,
|
|
775
|
-
attribute: "show-search",
|
|
776
|
-
converter: p
|
|
777
|
-
})], b.prototype, "showSearch", void 0), n([r({
|
|
778
|
-
type: Boolean,
|
|
779
|
-
attribute: "can-change-representation",
|
|
780
|
-
converter: p
|
|
781
|
-
})], b.prototype, "canChangeRepresentation", void 0), n([r({
|
|
782
|
-
type: Boolean,
|
|
783
|
-
attribute: "has-log-out",
|
|
784
|
-
converter: p
|
|
785
|
-
})], b.prototype, "hasLogOut", void 0), n([r({ type: Object })], b.prototype, "user", void 0), n([r({
|
|
786
|
-
type: Array,
|
|
787
|
-
attribute: "user-menu"
|
|
788
|
-
})], b.prototype, "userMenu", void 0), n([r({ type: Object })], b.prototype, "representing", void 0), n([r({
|
|
789
|
-
type: Array,
|
|
790
|
-
attribute: "user-menu-footer"
|
|
791
|
-
})], b.prototype, "userMenuFooter", void 0), n([r({
|
|
792
|
-
type: Array,
|
|
793
|
-
attribute: "user-options"
|
|
794
|
-
})], b.prototype, "userOptions", void 0);
|
|
795
|
-
try {
|
|
796
|
-
a("pkt-header")(b);
|
|
797
|
-
} catch {
|
|
798
|
-
console.warn("Forsøker å definere <pkt-header>, men den er allerede definert");
|
|
799
|
-
}
|
|
800
|
-
//#endregion
|
|
801
|
-
export { g as i, y as n, _ as r, b as t };
|