@oslokommune/punkt-elements 18.9.5 → 19.0.0
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 +17 -0
- package/dist/{accordion-CsrLQXEA.cjs → accordion-BLMbI8SQ.cjs} +1 -1
- package/dist/{accordion-DoxhiwK-.js → accordion-Bwka5Mxo.js} +5 -5
- package/dist/{alert-DH3VqNqh.cjs → alert-Cfr6t5uz.cjs} +1 -1
- package/dist/{alert-DxAGxSX_.js → alert-DaXpwnzT.js} +6 -6
- package/dist/{async-directive-BSwJ8-GL.js → async-directive-C8UAk8Mv.js} +2 -2
- package/dist/{async-directive-CfPXShXu.cjs → async-directive-U0EE5r36.cjs} +1 -1
- package/dist/{backlink-CGc7r9CS.js → backlink-BjJwDjuP.js} +3 -3
- package/dist/{backlink-CDH824db.cjs → backlink-DM220m4q.cjs} +1 -1
- package/dist/{breadcrumbs-DRGhIXmN.js → breadcrumbs-B1pDtQy8.js} +2 -2
- package/dist/{breadcrumbs-B37tsIoh.cjs → breadcrumbs-BUmbj-hP.cjs} +1 -1
- package/dist/{button-D6QhHPWH.js → button-BUl8uWWh.js} +5 -5
- package/dist/{button-Cx6Xdp6t.cjs → button-CCR4eyt_.cjs} +1 -1
- package/dist/{calendar-CAwIY7x_.cjs → calendar-BuSfyUR9.cjs} +1 -1
- package/dist/{calendar-42o_q-jI.js → calendar-KUQ1dFeX.js} +3 -3
- package/dist/{card-cyZE94EO.js → card-27RxxKxW.js} +6 -6
- package/dist/{card-CB72gwBC.cjs → card-B-RKnu_C.cjs} +1 -1
- package/dist/{checkbox-BhyUp6l6.js → checkbox-CTf4GatI.js} +4 -4
- package/dist/{checkbox-DJfH-vTj.cjs → checkbox-DlzVGBum.cjs} +1 -1
- package/dist/{class-map-DupQbnhE.cjs → class-map-B0FX3YsK.cjs} +1 -1
- package/dist/{class-map-DSoj1J68.js → class-map-D5GHsely.js} +1 -1
- package/dist/{combobox-CFgPKb3j.cjs → combobox-CNCM-Psm.cjs} +1 -1
- package/dist/{combobox-Cei828v1.js → combobox-Dym_phvv.js} +12 -12
- package/dist/components/header/header-service.d.ts +1 -1
- package/dist/components/header/types.d.ts +1 -1
- package/dist/{consent-CsgKWDsR.js → consent-BeoP4rOa.js} +2 -2
- package/dist/{consent-DnE6IPEj.cjs → consent-Cle1hkPg.cjs} +1 -1
- package/dist/{datepicker-D6os8IVu.cjs → datepicker-BtEZMsWH.cjs} +1 -1
- package/dist/{datepicker-DMiZ3BBw.js → datepicker-Ct4dbs4e.js} +11 -11
- package/dist/{directive-helpers-2mcpDDv5.cjs → directive-helpers-BushnrQQ.cjs} +1 -1
- package/dist/{directive-helpers-ChEduoup.js → directive-helpers-DpyLJPJm.js} +1 -1
- package/dist/{element-D_mCyFeX.cjs → element-CewjrA4g.cjs} +1 -1
- package/dist/{element-J8nynuVk.js → element-CqC-sGuC.js} +11 -1
- package/dist/{element-with-slot-BOuXlWSY.js → element-with-slot-D_OKDlYo.js} +2 -2
- package/dist/{element-with-slot-C66Jck5e.cjs → element-with-slot-MCvSBwUv.cjs} +1 -1
- package/dist/{fileupload-2nliUg_z.cjs → fileupload-BVAgrofy.cjs} +1 -1
- package/dist/{fileupload-BpkvNlxN.js → fileupload-Dqf_94m2.js} +8 -8
- package/dist/{footer-ByAxlj9_.js → footer-Bf6RFuia.js} +4 -4
- package/dist/{footer-Ca3DM544.cjs → footer-XrX6LFHY.cjs} +1 -1
- package/dist/{header-CP332MCg.cjs → header-DMMt5FtF.cjs} +64 -50
- package/dist/{header-CCJeadiL.js → header-fkKhLsyE.js} +182 -167
- package/dist/{header-menu-CIuu8_UC.js → header-menu-CUHrJCvx.js} +4 -4
- package/dist/{header-menu-B9ABa0WW.cjs → header-menu-DYZsigfH.cjs} +1 -1
- package/dist/{heading-4ZHACOeL.cjs → heading-BDdX4JiM.cjs} +1 -1
- package/dist/{heading-BHWdVbvN.js → heading-ELXWxyTv.js} +2 -2
- package/dist/{helptext-BESB9Vlq.js → helptext-BQkrYsoV.js} +4 -4
- package/dist/{helptext-6HsH-I6a.cjs → helptext-DQe6GO75.cjs} +1 -1
- package/dist/{icon-DkVqRWbC.js → icon-B2v30QUk.js} +1 -1
- package/dist/{icon-BzxBkRyE.cjs → icon-Clz68-Kz.cjs} +1 -1
- package/dist/{if-defined-BILLSM7i.js → if-defined-BNXGXCwT.js} +1 -1
- package/dist/if-defined-CjRKmMQs.cjs +1 -0
- package/dist/{input-element-BWxgs8L-.js → input-element-BTzuDh4h.js} +2 -2
- package/dist/{input-element-PN5nWd1A.cjs → input-element-BdIWsDl-.cjs} +1 -1
- package/dist/{input-wrapper-D64Qn-QH.cjs → input-wrapper-BIrQijWT.cjs} +1 -1
- package/dist/{input-wrapper-Bg06k-cj.js → input-wrapper-CvFMiqIt.js} +6 -6
- package/dist/{link-Bk7aDZCC.cjs → link-1JEWpEDG.cjs} +1 -1
- package/dist/{link-C7fOEv66.js → link-BxKWhYsn.js} +4 -4
- package/dist/{linkcard-Bguo9oCv.js → linkcard-CICSZ7pK.js} +4 -4
- package/dist/{linkcard-rZpQuO1Z.cjs → linkcard-DXOkeQUy.cjs} +1 -1
- package/dist/{listbox-CrQboPG6.js → listbox-DcCrI15L.js} +4 -4
- package/dist/{listbox-kV4OO1Qa.cjs → listbox-DsYaWvLu.cjs} +1 -1
- package/dist/{loader-BAn68gBb.cjs → loader-BA__N62k.cjs} +1 -1
- package/dist/{loader-C3gwO0i3.js → loader-nIl61aTv.js} +4 -4
- package/dist/{messagebox-WH2HjT5I.cjs → messagebox-CdNMgTz4.cjs} +1 -1
- package/dist/{messagebox-DAE59dMX.js → messagebox-D0qxveug.js} +4 -4
- package/dist/{modal-DdC1_qT3.js → modal-D5tGq-nN.js} +5 -5
- package/dist/{modal-DZm_fn3K.cjs → modal-i3Qxv38H.cjs} +1 -1
- 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-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +1 -1
- package/dist/pkt-breadcrumbs.cjs +1 -1
- package/dist/pkt-breadcrumbs.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-card.cjs +1 -1
- package/dist/pkt-card.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 -1
- package/dist/pkt-footer.js +1 -1
- 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 +1 -1
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +34 -34
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/{pkt-options-controller-DXAAVcBJ.cjs → pkt-options-controller-BClk341e.cjs} +1 -1
- package/dist/{pkt-options-controller-XcIgx_v1.js → pkt-options-controller-v2bPM9iU.js} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.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-tag.cjs +1 -1
- package/dist/pkt-tag.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/{progressbar-D1x6MwdY.js → progressbar-4WyR4T72.js} +5 -5
- package/dist/{progressbar-DsE4-qaW.cjs → progressbar-CJFGbev-.cjs} +1 -1
- package/dist/{radiobutton-CnGhAnjp.cjs → radiobutton-BQRtv7PK.cjs} +1 -1
- package/dist/{radiobutton-DWdn1O48.js → radiobutton-D7308uCY.js} +4 -4
- package/dist/{ref-DNowxdYH.js → ref-37-yxmc4.js} +2 -2
- package/dist/{ref-AuNEkS5a.cjs → ref-HT6KRjxp.cjs} +1 -1
- package/dist/{repeat-B3ksuY2F.cjs → repeat-Ddge5HTp.cjs} +1 -1
- package/dist/{repeat-CZ1oMXnW.js → repeat-DntD73oB.js} +2 -2
- package/dist/{searchinput-vi7twt5b.cjs → searchinput-D1cJ73Ki.cjs} +1 -1
- package/dist/{searchinput-CmyWnNr6.js → searchinput-j4IvYRzj.js} +4 -4
- package/dist/{select-CM-CcWab.js → select-B4gbFOil.js} +7 -7
- package/dist/{select-D761TXmv.cjs → select-oIF7UVvV.cjs} +1 -1
- package/dist/shared-strings/nb.d.ts +10 -0
- package/dist/{tabs-hiTrWsXq.cjs → tabs-95BpwB6j.cjs} +1 -1
- package/dist/{tabs-kxsX1ZEf.js → tabs-DexV26qJ.js} +4 -4
- package/dist/{tag-CGlxtBOH.cjs → tag-CQEyjF32.cjs} +1 -1
- package/dist/{tag-bztxjcF0.js → tag-DoUC99hn.js} +5 -5
- package/dist/{textarea-D3SeDZ1r.js → textarea-DGSMKcqK.js} +9 -9
- package/dist/{textarea-4s_SiG0_.cjs → textarea-DNFX958g.cjs} +1 -1
- package/dist/{textinput-uDRbleIa.cjs → textinput-Bzkdo2mN.cjs} +1 -1
- package/dist/{textinput-Dje0Zcsa.js → textinput-DpLeElI_.js} +8 -8
- package/dist/{timepicker-D9liFW1z.js → timepicker-CCNQeX5Q.js} +8 -8
- package/dist/{timepicker-CAD2AYFr.cjs → timepicker-DCzhlRuc.cjs} +1 -1
- package/package.json +3 -3
- package/src/components/header/header-global.test.ts +8 -0
- package/src/components/header/header-global.ts +13 -2
- package/src/components/header/header-service.test.ts +54 -0
- package/src/components/header/header-service.ts +20 -7
- package/src/components/header/header-user-menu.ts +10 -8
- package/src/components/header/types.ts +3 -2
- package/dist/if-defined-BbUZeoaQ.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-CewjrA4g.cjs"),t=require("./class-map-B0FX3YsK.cjs"),n=require("./if-defined-CjRKmMQs.cjs"),r=require("./format-B8meU8Tm.cjs"),i=require("./element-with-slot-MCvSBwUv.cjs");require("./icon-Clz68-Kz.cjs"),require("./button-CCR4eyt_.cjs");const a=require("./ref-HT6KRjxp.cjs"),o=require("./booleanish-BF8l4scU.cjs"),s=require("./fetch-header-footer-data-CUKV0biS.cjs"),c=require("./focus-trap-DSv4Ifqm.cjs"),l=require("./scroll-lock-BN8lOhV5.cjs");require("./link-1JEWpEDG.cjs"),require("./textinput-Bzkdo2mN.cjs"),require("./searchinput-D1cJ73Ki.cjs"),require("./header-menu-DYZsigfH.cjs");var u=e=>typeof e.target==`string`?{title:e.title,iconName:e.iconName,href:e.target}:{title:e.title,iconName:e.iconName,onClick:e.target},d=e=>u(e),f=e=>{if(!e)return;let t=typeof e==`string`?new Date(e):e;if(!isNaN(t.getTime()))return t.toLocaleDateString(`nb-NO`,{day:`numeric`,month:`long`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})},p=class{constructor(e,t){this.isMobile=!1,this.isTablet=!1,this.isHidden=!1,this.pauseScrollHide=!1,this.componentWidth=typeof window<`u`?window.innerWidth:0,this.lastScrollPosition=0,this.scrollLockToken=l.t(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1,this.handleScroll=()=>{if(this.getOptions().scrollBehavior!==`hide`||this.pauseScrollHide)return;let e=window.pageYOffset||document.documentElement.scrollTop;if(e<0||Math.abs(e-this.lastScrollPosition)<60)return;let t=e>this.lastScrollPosition;this.lastScrollPosition=e,t!==this.isHidden&&(this.isHidden=t,this.host.requestUpdate())},this.host=e,this.getOptions=t,e.addController(this)}hostConnected(){window.addEventListener(`scroll`,this.handleScroll)}hostDisconnected(){this.resizeObserver?.disconnect(),window.removeEventListener(`scroll`,this.handleScroll),l.n(this.scrollLockToken,!1)}observe(e){e&&(this.componentWidth=e.offsetWidth,this.refreshBreakpoints(),this.resizeObserver=new ResizeObserver(e=>{for(let t of e)this.componentWidth=t.borderBoxSize&&t.borderBoxSize.length>0?t.borderBoxSize[0].inlineSize:t.contentRect.width,this.refreshBreakpoints()}),this.resizeObserver.observe(e))}refreshBreakpoints(){let{mobileBreakpoint:e,tabletBreakpoint:t}=this.getOptions(),n=this.componentWidth<e,r=this.componentWidth<t;(n!==this.isMobile||r!==this.isTablet)&&(this.isMobile=n,this.isTablet=r,this.host.requestUpdate())}setScrollLock(e){l.n(this.scrollLockToken,e)}captureFocus(){this.lastFocusedElement=document.activeElement}flagRestoreFocus(){this.shouldRestoreFocus=!0}restoreFocus(){this.shouldRestoreFocus&&this.lastFocusedElement&&document.contains(this.lastFocusedElement)&&this.lastFocusedElement.focus(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1}},m=class extends e.t{constructor(...e){super(...e),this.canChangeRepresentation=!1,this.logoutOnClick=!1}handleChangeRepresentation(){this.dispatchEvent(new CustomEvent(`change-representation`,{bubbles:!0,composed:!0}))}handleLogout(){this.dispatchEvent(new CustomEvent(`log-out`,{bubbles:!0,composed:!0}))}handleMenuItemClick(e){`onClick`in e&&typeof e.onClick==`function`&&e.onClick()}renderLinkOrButton(n,r){let i=`href`in n,a=t.t({"pkt-user-menu__link":!0,"pkt-link-button":!i,"pkt-link":!i,"pkt-link--icon-left":!i,[r||``]:!!r});return i?e._`
|
|
2
2
|
<pkt-link
|
|
3
3
|
icon-name=${n.iconName||e.h}
|
|
4
4
|
href=${n.href}
|
|
@@ -21,17 +21,17 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
21
21
|
<li class="pkt-user-menu__subitem">${this.renderLinkOrButton(t)}</li>
|
|
22
22
|
`)}
|
|
23
23
|
</ul>
|
|
24
|
-
`}render(){let t=this.userMenu?.map(
|
|
25
|
-
<nav class="pkt-user-menu" aria-label
|
|
24
|
+
`}render(){let t=this.userMenu?.map(d),n=this.pktStrings.get(`header`);return e._`
|
|
25
|
+
<nav class="pkt-user-menu" aria-label=${n.userMenuLabel}>
|
|
26
26
|
<ul class="pkt-user-menu__list">
|
|
27
27
|
<!-- User section -->
|
|
28
28
|
${this.user?e._`
|
|
29
29
|
<li class="pkt-user-menu__item">
|
|
30
|
-
<div class="pkt-user-menu__label"
|
|
30
|
+
<div class="pkt-user-menu__label">${n.loggedInAs}</div>
|
|
31
31
|
<div class="pkt-user-menu__name" translate="no">${this.user.name}</div>
|
|
32
32
|
${this.formattedLastLoggedIn?e._`
|
|
33
33
|
<div class="pkt-user-menu__last-logged-in">
|
|
34
|
-
|
|
34
|
+
${n.lastLoggedIn} <time>${this.formattedLastLoggedIn}</time>
|
|
35
35
|
</div>
|
|
36
36
|
`:e.h}
|
|
37
37
|
</li>
|
|
@@ -45,15 +45,15 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
45
45
|
<!-- Representing section -->
|
|
46
46
|
${this.representing?e._`
|
|
47
47
|
<li class="pkt-user-menu__item">
|
|
48
|
-
<div class="pkt-user-menu__label"
|
|
48
|
+
<div class="pkt-user-menu__label">${n.representing}</div>
|
|
49
49
|
<div class="pkt-user-menu__name" translate="no">${this.representing.name}</div>
|
|
50
50
|
${this.representing.orgNumber?e._`<div class="pkt-user-menu__org-number">
|
|
51
|
-
|
|
51
|
+
${r.t(n.orgNumber,{number:this.representing.orgNumber})}
|
|
52
52
|
</div>`:e.h}
|
|
53
53
|
${this.canChangeRepresentation?e._`
|
|
54
54
|
<ul class="pkt-user-menu__sublist mt-size-16">
|
|
55
55
|
<li class="pkt-user-menu__subitem">
|
|
56
|
-
${this.renderLinkOrButton({title
|
|
56
|
+
${this.renderLinkOrButton({title:n.changeRepresentation,iconName:`cogwheel`,onClick:()=>this.handleChangeRepresentation()})}
|
|
57
57
|
</li>
|
|
58
58
|
</ul>
|
|
59
59
|
`:e.h}
|
|
@@ -65,7 +65,7 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
65
65
|
<li class="pkt-user-menu__item">
|
|
66
66
|
<ul class="pkt-user-menu__sublist">
|
|
67
67
|
<li class="pkt-user-menu__subitem">
|
|
68
|
-
${this.renderLinkOrButton({title
|
|
68
|
+
${this.renderLinkOrButton({title:n.changeRepresentation,iconName:`cogwheel`,onClick:()=>this.handleChangeRepresentation()})}
|
|
69
69
|
</li>
|
|
70
70
|
</ul>
|
|
71
71
|
</li>
|
|
@@ -74,20 +74,28 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
74
74
|
<!-- Logout -->
|
|
75
75
|
${this.logoutOnClick?e._`
|
|
76
76
|
<li class="pkt-user-menu__item">
|
|
77
|
-
${this.renderLinkOrButton({title
|
|
77
|
+
${this.renderLinkOrButton({title:n.logOut,iconName:`exit`,onClick:()=>this.handleLogout()})}
|
|
78
78
|
</li>
|
|
79
79
|
`:e.h}
|
|
80
80
|
</ul>
|
|
81
81
|
</nav>
|
|
82
|
-
`}};e.n([e.u({type:Object})],
|
|
82
|
+
`}};e.n([e.u({type:Object})],m.prototype,`user`,void 0),e.n([e.u({type:String,attribute:`formatted-last-logged-in`})],m.prototype,`formattedLastLoggedIn`,void 0),e.n([e.u({type:Object})],m.prototype,`representing`,void 0),e.n([e.u({type:Array,attribute:`user-menu`})],m.prototype,`userMenu`,void 0),e.n([e.u({type:Boolean,attribute:`can-change-representation`,converter:o.t})],m.prototype,`canChangeRepresentation`,void 0),e.n([e.u({type:Boolean,attribute:`logout-on-click`,converter:o.t})],m.prototype,`logoutOnClick`,void 0);try{e.d(`pkt-header-user-menu`)(m)}catch{console.warn(`Forsøker å definere <pkt-header-user-menu>, men den er allerede definert`)}var h=`https://punkt-cdn.oslo.kommune.no/latest/logos/`;typeof window<`u`&&(window.pktLogoPath=window.pktLogoPath||h);var g=class extends i.t{constructor(...e){super(...e),this.logoLink=s.o,this.logoPath=typeof window<`u`?window.pktLogoPath:h,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.hideLogo=!1,this.compact=!1,this.showSearch=!1,this.canChangeRepresentation=!1,this.hasLogOut=!1,this.openMenu=`none`,this.alignSlotRight=!1,this.alignSearchRight=!1,this.headerRef=a.t(),this.userContainerRef=a.t(),this.slotContainerRef=a.t(),this.searchContainerRef=a.t(),this.slotContentRef=a.t(),this.searchMenuRef=a.t(),this.chrome=new p(this,()=>({mobileBreakpoint:this.mobileBreakpoint,tabletBreakpoint:this.tabletBreakpoint,position:this.position,scrollBehavior:this.scrollBehavior})),this.handleClickOutside=e=>{let t=e.target;this.user&&this.openMenu===`user`&&!t.closest(`.pkt-header-service__user-container`)&&(this.openMenu=`none`),this.openMenu===`slot`&&!t.closest(`.pkt-header-service__slot-container`)&&(this.openMenu=`none`),this.openMenu===`search`&&!t.closest(`.pkt-header-service__search-container`)&&!t.closest(`.pkt-header-service__search-input`)&&(this.openMenu=`none`)},this.handleSlotContentClick=e=>{if(!this.isTablet||this.openMenu!==`slot`)return;let t=e.target.closest(`a[href], button, [role="link"], [role="button"], [role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]`);!t||!this.slotContentRef.value?.contains(t)||t.closest(`[data-pkt-header-keep-open]`)||t.disabled||t.getAttribute(`aria-disabled`)===`true`||(this.openMenu=`none`)},this.handleFocusOut=(e,t)=>{let n=e.relatedTarget,r;switch(t){case`user`:r=this.userContainerRef;break;case`slot`:r=this.slotContainerRef;break;case`search`:r=this.searchContainerRef;break;default:return}let i=r.value;i&&(!n||!i.contains(n))&&(this.openMenu=`none`)},this.handleEscapeKey=e=>{e.key===`Escape`&&this.openMenu!==`none`&&(e.preventDefault(),this.chrome.flagRestoreFocus(),this.openMenu=`none`)}}get isMobile(){return this.chrome.isMobile}get isTablet(){return this.chrome.isTablet}get isHidden(){return this.chrome.isHidden}firstUpdated(){this.chrome.observe(this.headerRef.value)}updated(e){if(super.updated(e),e.has(`openedMenu`)&&this.openedMenu!==this.openMenu&&(this.openMenu=this.openedMenu),(e.has(`mobileBreakpoint`)||e.has(`tabletBreakpoint`))&&this.chrome.refreshBreakpoints(),e.has(`openMenu`)){let t=e.get(`openMenu`);this.openMenu!==`none`&&(t===`none`||t===void 0)?(document.addEventListener(`mousedown`,this.handleClickOutside),document.addEventListener(`keydown`,this.handleEscapeKey),(this.openMenu===`slot`||this.openMenu===`search`)&&requestAnimationFrame(()=>{this.checkDropdownAlignment(this.openMenu)})):this.openMenu===`none`&&t!==`none`&&(document.removeEventListener(`mousedown`,this.handleClickOutside),document.removeEventListener(`keydown`,this.handleEscapeKey),this.chrome.restoreFocus())}this.chrome.setScrollLock((this.isFixed||this.isSticky)&&this.isMobile&&this.openMenu!==`none`)}checkDropdownAlignment(e){let t=e===`slot`?this.slotContainerRef:this.searchContainerRef,n=e===`slot`?this.slotContentRef:this.searchMenuRef;if(!t.value||!n.value||!this.isTablet||this.isMobile)return;let r=t.value.getBoundingClientRect(),i=n.value.offsetWidth,a=r.left+i>window.innerWidth;e===`slot`?this.alignSlotRight=a:this.alignSearchRight=a}handleMenuToggle(e){this.openMenu===`none`?(this.chrome.captureFocus(),this.openMenu=e):this.openMenu=`none`}handleLogoClick(e){this.dispatchEvent(new CustomEvent(`logo-click`,{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}handleServiceClick(e){this.dispatchEvent(new CustomEvent(`service-click`,{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}handleLogout(){this.dispatchEvent(new CustomEvent(`log-out`,{bubbles:!0,composed:!0}))}handleSearch(e){this.dispatchEvent(new CustomEvent(`search`,{detail:{query:e},bubbles:!0,composed:!0}))}handleSearchChange(e){this.dispatchEvent(new CustomEvent(`search-change`,{detail:{query:e},bubbles:!0,composed:!0}))}handleSearchInputChange(e){let t=e.target.value;this.handleSearchChange(t)}handleSearchKeyDown(e){e.key===`Enter`&&this.handleSearch(e.target.value)}get formattedLastLoggedIn(){return f(this.user?.lastLoggedIn)}get isFixed(){return this.position===`fixed`}get isSticky(){return this.position===`sticky`}get shouldHideOnScroll(){return this.scrollBehavior===`hide`}get showLogoutInHeader(){return this.hasLogOut&&(this.logOutButtonPlacement===`header`||this.logOutButtonPlacement===`both`)}get showLogoutInUserMenu(){return this.hasLogOut&&(this.logOutButtonPlacement===`userMenu`||this.logOutButtonPlacement===`both`)}get headerStrings(){return this.pktStrings.get(`header`)}renderLogo(){if(this.hideLogo)return e.h;let t=e._`
|
|
83
83
|
<pkt-icon name="oslologo" aria-hidden="true" path=${this.logoPath}></pkt-icon>
|
|
84
|
-
`;return e._`
|
|
84
|
+
`;return this.logoLink?e._`
|
|
85
85
|
<span class="pkt-header-service__logo">
|
|
86
|
-
<a
|
|
86
|
+
<a
|
|
87
|
+
href=${this.logoLink}
|
|
88
|
+
aria-label=${this.headerStrings.logoLabel}
|
|
89
|
+
@click=${this.handleLogoClick}
|
|
90
|
+
>
|
|
87
91
|
${t}
|
|
88
92
|
</a>
|
|
89
93
|
</span>
|
|
90
|
-
|
|
94
|
+
`:e._`
|
|
95
|
+
<span class="pkt-header-service__logo" role="img" aria-label=${this.headerStrings.logoAlt}>
|
|
96
|
+
${t}
|
|
97
|
+
</span>
|
|
98
|
+
`}renderServiceName(){return this.serviceName?this.serviceLink&&typeof this.serviceLink==`string`?e._`
|
|
91
99
|
<span class="pkt-header-service__service-name" translate="no">
|
|
92
100
|
<pkt-link
|
|
93
101
|
href=${this.serviceLink}
|
|
@@ -114,11 +122,11 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
114
122
|
>
|
|
115
123
|
<span class="pkt-header-service__service-link">${this.serviceName}</span>
|
|
116
124
|
</span>
|
|
117
|
-
`:e.h}renderSlotContainer(){if(!this.hasSlotContent())return e.h;let n=t.t({"pkt-header-service__slot-container":!0,"is-open":this.openMenu===`slot`}),
|
|
125
|
+
`:e.h}renderSlotContainer(){if(!this.hasSlotContent())return e.h;let n=t.t({"pkt-header-service__slot-container":!0,"is-open":this.openMenu===`slot`}),r=t.t({"pkt-header-service__slot-content":!0,"align-right":this.alignSlotRight});return e._`
|
|
118
126
|
<div
|
|
119
127
|
class=${n}
|
|
120
128
|
@focusout=${e=>this.handleFocusOut(e,`slot`)}
|
|
121
|
-
${
|
|
129
|
+
${a.n(this.slotContainerRef)}
|
|
122
130
|
>
|
|
123
131
|
${this.isTablet&&this.hasSlotContent()?e._`
|
|
124
132
|
<pkt-button
|
|
@@ -132,25 +140,25 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
132
140
|
aria-controls="mobile-slot-menu"
|
|
133
141
|
aria-label=${this.headerStrings.openMenu}
|
|
134
142
|
>
|
|
135
|
-
${this.slotMenuText}
|
|
143
|
+
${this.slotMenuText??this.headerStrings.menu}
|
|
136
144
|
</pkt-button>
|
|
137
145
|
`:e.h}
|
|
138
146
|
<div
|
|
139
|
-
class=${
|
|
147
|
+
class=${r}
|
|
140
148
|
id="mobile-slot-menu"
|
|
141
149
|
role=${this.isTablet?`group`:e.h}
|
|
142
|
-
aria-label=${this.isTablet
|
|
150
|
+
aria-label=${this.isTablet?this.headerStrings.menu:e.h}
|
|
143
151
|
@click=${this.handleSlotContentClick}
|
|
144
|
-
${
|
|
152
|
+
${a.n(this.slotContentRef)}
|
|
145
153
|
>
|
|
146
|
-
${
|
|
154
|
+
${i.r(this)}
|
|
147
155
|
</div>
|
|
148
156
|
</div>
|
|
149
157
|
`}renderSearch(){if(!this.showSearch)return e.h;if(this.isTablet){let n=t.t({"pkt-header-service__search-container":!0,"is-open":this.openMenu===`search`}),r=t.t({"pkt-header-service__mobile-menu":!0,"is-open":this.openMenu===`search`,"align-right":this.alignSearchRight});return e._`
|
|
150
158
|
<div
|
|
151
159
|
class=${n}
|
|
152
160
|
@focusout=${e=>this.handleFocusOut(e,`search`)}
|
|
153
|
-
${
|
|
161
|
+
${a.n(this.searchContainerRef)}
|
|
154
162
|
>
|
|
155
163
|
<pkt-button
|
|
156
164
|
skin="secondary"
|
|
@@ -165,7 +173,7 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
165
173
|
>
|
|
166
174
|
${this.headerStrings.search}
|
|
167
175
|
</pkt-button>
|
|
168
|
-
<div class=${r} ${
|
|
176
|
+
<div class=${r} ${a.n(this.searchMenuRef)}>
|
|
169
177
|
${this.openMenu===`search`?e._`
|
|
170
178
|
<pkt-textinput
|
|
171
179
|
id="mobile-search-menu"
|
|
@@ -199,7 +207,7 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
199
207
|
<div
|
|
200
208
|
class="pkt-header-service__user-container"
|
|
201
209
|
@focusout=${e=>this.handleFocusOut(e,`user`)}
|
|
202
|
-
${
|
|
210
|
+
${a.n(this.userContainerRef)}
|
|
203
211
|
>
|
|
204
212
|
<pkt-button
|
|
205
213
|
class=${t.t({"pkt-header-service__user-button":!0,"pkt-header-service__user-button--mobile":this.isMobile})}
|
|
@@ -211,12 +219,13 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
211
219
|
secondIconName=${this.openMenu===`user`?`chevron-thin-up`:`chevron-thin-down`}
|
|
212
220
|
@click=${()=>this.handleMenuToggle(`user`)}
|
|
213
221
|
>
|
|
214
|
-
<span class="pkt-sr-only"
|
|
222
|
+
<span class="pkt-sr-only">${this.headerStrings.userMenuButton} </span>
|
|
215
223
|
<span translate="no">${this.representing?.name||this.user.name}</span>
|
|
216
224
|
</pkt-button>
|
|
217
225
|
${this.openMenu===`user`&&this.user?e._`
|
|
218
226
|
<div class=${n}>
|
|
219
227
|
<pkt-header-user-menu
|
|
228
|
+
.strings=${this.strings}
|
|
220
229
|
.user=${this.user}
|
|
221
230
|
formatted-last-logged-in=${this.formattedLastLoggedIn||e.h}
|
|
222
231
|
.representing=${this.representing}
|
|
@@ -230,7 +239,7 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
230
239
|
`:e.h}
|
|
231
240
|
</div>
|
|
232
241
|
`}renderHeader(){let n=t.t({"pkt-header-service":!0,"pkt-header-service--compact":this.compact,"pkt-header-service--mobile":this.isMobile,"pkt-header-service--tablet":this.isTablet,"pkt-header-service--fixed":this.isFixed,"pkt-header-service--sticky":this.isSticky,"pkt-header-service--scroll-to-hide":this.shouldHideOnScroll,"pkt-header-service--hidden":this.isHidden}),r=t.t({"pkt-header-service__logo-area":!0,"pkt-header-service__logo-area--without-service":!this.serviceName});return e._`
|
|
233
|
-
<header class=${n} ${
|
|
242
|
+
<header class=${n} ${a.n(this.headerRef)}>
|
|
234
243
|
<div class=${r}>${this.renderLogo()} ${this.renderServiceName()}</div>
|
|
235
244
|
|
|
236
245
|
${this.hasSlotContent()||this.showSearch||this.showLogoutInHeader?e._`<div class="pkt-header-service__content">
|
|
@@ -243,7 +252,7 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
243
252
|
iconName="exit"
|
|
244
253
|
@click=${this.handleLogout}
|
|
245
254
|
>
|
|
246
|
-
|
|
255
|
+
${this.headerStrings.logOut}
|
|
247
256
|
</pkt-button>
|
|
248
257
|
`:e.h}
|
|
249
258
|
</div>`:e.h}
|
|
@@ -257,7 +266,7 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
257
266
|
iconName="exit"
|
|
258
267
|
@click=${this.handleLogout}
|
|
259
268
|
>
|
|
260
|
-
|
|
269
|
+
${this.headerStrings.logOut}
|
|
261
270
|
</pkt-button>
|
|
262
271
|
`:e.h}
|
|
263
272
|
</div>`:e.h}
|
|
@@ -267,15 +276,19 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
267
276
|
${n}
|
|
268
277
|
<div class=${r}></div>
|
|
269
278
|
</div>
|
|
270
|
-
`}return n}};e.n([e.u({type:String,attribute:`service-name`})],
|
|
279
|
+
`}return n}};e.n([e.u({type:String,attribute:`service-name`})],g.prototype,`serviceName`,void 0),e.n([e.u({type:String,attribute:`service-link`})],g.prototype,`serviceLink`,void 0),e.n([e.u({type:String,attribute:`logo-link`})],g.prototype,`logoLink`,void 0),e.n([e.u({type:String,attribute:`logo-path`})],g.prototype,`logoPath`,void 0),e.n([e.u({type:String,attribute:`search-placeholder`})],g.prototype,`searchPlaceholder`,void 0),e.n([e.u({type:String,attribute:`search-value`})],g.prototype,`searchValue`,void 0),e.n([e.u({type:Number,attribute:`mobile-breakpoint`})],g.prototype,`mobileBreakpoint`,void 0),e.n([e.u({type:Number,attribute:`tablet-breakpoint`})],g.prototype,`tabletBreakpoint`,void 0),e.n([e.u({type:String,attribute:`opened-menu`})],g.prototype,`openedMenu`,void 0),e.n([e.u({type:String,attribute:`log-out-button-placement`})],g.prototype,`logOutButtonPlacement`,void 0),e.n([e.u({type:String})],g.prototype,`position`,void 0),e.n([e.u({type:String,attribute:`scroll-behavior`})],g.prototype,`scrollBehavior`,void 0),e.n([e.u({type:String,attribute:`slot-menu-variant`})],g.prototype,`slotMenuVariant`,void 0),e.n([e.u({type:String,attribute:`slot-menu-text`})],g.prototype,`slotMenuText`,void 0),e.n([e.u({type:Boolean,attribute:`hide-logo`,converter:o.t})],g.prototype,`hideLogo`,void 0),e.n([e.u({type:Boolean,converter:o.t})],g.prototype,`compact`,void 0),e.n([e.u({type:Boolean,attribute:`show-search`,converter:o.t})],g.prototype,`showSearch`,void 0),e.n([e.u({type:Boolean,attribute:`can-change-representation`,converter:o.t})],g.prototype,`canChangeRepresentation`,void 0),e.n([e.u({type:Boolean,attribute:`has-log-out`,converter:o.t})],g.prototype,`hasLogOut`,void 0),e.n([e.u({type:Object})],g.prototype,`user`,void 0),e.n([e.u({type:Array,attribute:`user-menu`})],g.prototype,`userMenu`,void 0),e.n([e.u({type:Object})],g.prototype,`representing`,void 0),e.n([e.l()],g.prototype,`openMenu`,void 0),e.n([e.l()],g.prototype,`alignSlotRight`,void 0),e.n([e.l()],g.prototype,`alignSearchRight`,void 0);try{e.d(`pkt-header-service`)(g)}catch{console.warn(`Forsøker å definere <pkt-header-service>, men den er allerede definert`)}var _=`https://punkt-cdn.oslo.kommune.no/latest/logos/`;typeof window<`u`&&(window.pktLogoPath=window.pktLogoPath||_);var v=`pkt-header-global-menu`,y=`pkt-header-global-menu-toggle`,b=`pkt-header-global-search-panel`,x=`pkt-header-global-search-toggle`,S=class extends e.t{constructor(...e){super(...e),this.locale=`nb-NO`,this.logoLink=s.o,this.logoPath=typeof window<`u`?window.pktLogoPath:_,this.position=`fixed`,this.scrollBehavior=`hide`,this.mobileBreakpoint=768,this.tabletBreakpoint=1024,this.logOutButtonPlacement=`none`,this.showSearch=!0,this.showContact=!0,this.canChangeRepresentation=!1,this.hasLogOut=!1,this.openMenu=`none`,this.loadError=!1,this.headerAnchor={top:0,left:0,width:0},this.headerRef=a.t(),this.menuContainerRef=a.t(),this.userContainerRef=a.t(),this.chrome=new p(this,()=>({mobileBreakpoint:this.mobileBreakpoint,tabletBreakpoint:this.tabletBreakpoint,position:this.position,scrollBehavior:this.scrollBehavior})),this.handleClickOutside=e=>{let t=e.target;this.openMenu===`user`&&!t.closest(`.pkt-header-global__user-container`)&&!t.closest(`.pkt-header-global__user-menu`)&&(this.openMenu=`none`),this.openMenu===`menu`&&!t.closest(`.pkt-header-menu`)&&!t.closest(`#${y}`)&&(this.openMenu=`none`),this.openMenu===`search`&&!t.closest(`.pkt-header-global__search-panel-inner`)&&!t.closest(`#${x}`)&&(this.openMenu=`none`)},this.handleEscapeKey=e=>{e.key===`Escape`&&this.openMenu!==`none`&&(e.preventDefault(),this.chrome.flagRestoreFocus(),this.openMenu=`none`)},this.handleOverlayKeydown=e=>{if(e.key!==`Tab`)return;let t=this.activeOverlay;if(!t||!t.panel||!t.toggle)return;let{panel:n,toggle:r}=t,i=c.n(n),a=c.t();if(a&&r.contains(a)){!e.shiftKey&&i.length>0&&(e.preventDefault(),i[0].focus());return}if(i.length===0)return;let o=i[0],s=i[i.length-1],l=!e.shiftKey&&a===s,u=e.shiftKey&&a===o;(l||u)&&(e.preventDefault(),this.openMenu=`none`,this.focusToggle(r))},this.handleOverlayFocusIn=e=>{let t=this.activeOverlay;if(!t||!t.panel)return;let n=e.target;n&&(t.panel.contains(n)||t.toggle?.contains(n)||(this.openMenu=`none`))}}get isMobile(){return this.chrome.isMobile}get isTablet(){return this.chrome.isTablet}get isHidden(){return this.chrome.isHidden}connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-header-global-host`),this.data?this.emitDataLoaded(this.data):this.loadData()}disconnectedCallback(){super.disconnectedCallback(),this.abortController?.abort(),document.removeEventListener(`mousedown`,this.handleClickOutside),document.removeEventListener(`keydown`,this.handleEscapeKey),document.removeEventListener(`keydown`,this.handleOverlayKeydown),document.removeEventListener(`focusin`,this.handleOverlayFocusIn)}firstUpdated(){this.chrome.observe(this.headerRef.value)}willUpdate(e){if(super.willUpdate(e),this.openMenu===`menu`||this.openMenu===`search`){let e=this.headerRef.value?.getBoundingClientRect();e&&(this.headerAnchor={top:e.top,left:e.left,width:e.width})}}get overlayAnchorStyle(){let{top:e,left:t,width:n}=this.headerAnchor;return`--pkt-header-global-top: ${e}px; --pkt-header-global-left: ${t}px; --pkt-header-global-width: ${n}px`}updated(e){if(super.updated(e),(e.has(`mobileBreakpoint`)||e.has(`tabletBreakpoint`))&&this.chrome.refreshBreakpoints(),e.has(`dataUrl`)&&e.get(`dataUrl`)!==void 0&&!this.data&&this.loadData(),e.has(`data`)&&this.data&&this.emitDataLoaded(this.data),e.has(`openMenu`)){let t=e.get(`openMenu`);this.openMenu!==`none`&&(t===`none`||t===void 0)?(document.addEventListener(`mousedown`,this.handleClickOutside),document.addEventListener(`keydown`,this.handleEscapeKey)):this.openMenu===`none`&&t&&t!==`none`&&(document.removeEventListener(`mousedown`,this.handleClickOutside),document.removeEventListener(`keydown`,this.handleEscapeKey),this.chrome.restoreFocus());let n=t===`menu`||t===`search`,r=this.openMenu===`menu`||this.openMenu===`search`;r&&!n?(document.addEventListener(`keydown`,this.handleOverlayKeydown),document.addEventListener(`focusin`,this.handleOverlayFocusIn)):!r&&n&&(document.removeEventListener(`keydown`,this.handleOverlayKeydown),document.removeEventListener(`focusin`,this.handleOverlayFocusIn)),this.openMenu===`search`&&t!==`search`&&requestAnimationFrame(()=>{this.querySelector(`#${b} input`)?.focus()}),this.chrome.pauseScrollHide=this.openMenu!==`none`,this.chrome.setScrollLock(this.openMenu===`menu`||this.openMenu===`search`)}}async loadData(){this.abortController?.abort(),this.abortController=new AbortController,this.loadError=!1;try{let e=await s.t(this.dataUrl,this.abortController.signal);this.fetchedData=e,this.emitDataLoaded(e)}catch(e){if(e.name===`AbortError`)return;this.loadError=!0,this.dispatchEvent(new CustomEvent(`data-error`,{detail:{error:e},bubbles:!0,composed:!0}))}}emitDataLoaded(e){this.dispatchEvent(new CustomEvent(`data-loaded`,{detail:{data:e},bubbles:!0,composed:!0}))}get effectiveData(){return this.data??this.fetchedData}get localeData(){return s.n(this.effectiveData,this.locale)}get shouldHideOnScroll(){return this.scrollBehavior===`hide`}get isFixed(){return this.position===`fixed`}get isSticky(){return this.position===`sticky`}toggleMenu(e){this.openMenu===e?this.openMenu=`none`:(this.chrome.captureFocus(),this.openMenu=e)}get activeOverlay(){return this.openMenu===`menu`?{panel:this.menuContainerRef.value??null,toggle:this.querySelector(`#${y}`)}:this.openMenu===`search`?{panel:this.querySelector(`#${b}`),toggle:this.querySelector(`#${x}`)}:null}focusToggle(e){(e?.querySelector(`button`)??e)?.focus()}handleSearch(e){this.dispatchEvent(new CustomEvent(`search`,{detail:{query:e},bubbles:!0,composed:!0}))}handleLogout(){this.dispatchEvent(new CustomEvent(`log-out`,{bubbles:!0,composed:!0}))}handleChangeRepresentation(){this.dispatchEvent(new CustomEvent(`change-representation`,{bubbles:!0,composed:!0}))}get formattedLastLoggedIn(){return f(this.user?.lastLoggedIn)}get showLogoutInUserMenu(){return this.hasLogOut&&(this.logOutButtonPlacement===`userMenu`||this.logOutButtonPlacement===`both`)}handleLogoClick(e){this.dispatchEvent(new CustomEvent(`logo-click`,{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}renderLogo(){let t=this.pktStrings.get(`header`),r=e._`
|
|
271
280
|
<pkt-icon name="oslologo" aria-hidden="true" path=${n.t(this.logoPath)}></pkt-icon>
|
|
272
|
-
`;return e._`
|
|
281
|
+
`;return this.logoLink?e._`
|
|
273
282
|
<span class="pkt-header-global__logo">
|
|
274
|
-
<a href=${this.logoLink} aria-label
|
|
275
|
-
${
|
|
283
|
+
<a href=${this.logoLink} aria-label=${t.logoLabel} @click=${this.handleLogoClick}>
|
|
284
|
+
${r}
|
|
276
285
|
</a>
|
|
277
286
|
</span>
|
|
278
|
-
|
|
287
|
+
`:e._`
|
|
288
|
+
<span class="pkt-header-global__logo" role="img" aria-label=${t.logoAlt}>
|
|
289
|
+
${r}
|
|
290
|
+
</span>
|
|
291
|
+
`}renderSearch(t){if(!this.showSearch)return e.h;let r=t.search;if(!r)return e.h;let i=this.searchPlaceholder??r.input.placeholder;return e._`
|
|
279
292
|
<div class="pkt-header-global__search">
|
|
280
293
|
<pkt-searchinput
|
|
281
294
|
appearance="global"
|
|
@@ -296,7 +309,7 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
296
309
|
</a>
|
|
297
310
|
`:e.h}get isLoading(){return!this.localeData&&!this.loadError}renderMenuToggle(t){let n=t?.i18n?.menu||this.pktStrings.get(`header`).menu,r=this.openMenu===`menu`;return e._`
|
|
298
311
|
<pkt-button
|
|
299
|
-
id=${
|
|
312
|
+
id=${y}
|
|
300
313
|
class="pkt-header-global__menu-toggle"
|
|
301
314
|
skin=${this.isMobile?`tertiary`:`secondary`}
|
|
302
315
|
variant=${this.isMobile?`icon-only`:`icon-right`}
|
|
@@ -304,7 +317,7 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
304
317
|
size=${this.isTablet?`small`:`medium`}
|
|
305
318
|
state=${r?`active`:`normal`}
|
|
306
319
|
aria-expanded=${r}
|
|
307
|
-
aria-controls=${
|
|
320
|
+
aria-controls=${v}
|
|
308
321
|
?disabled=${this.isLoading}
|
|
309
322
|
@click=${()=>this.toggleMenu(`menu`)}
|
|
310
323
|
>
|
|
@@ -312,7 +325,7 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
312
325
|
</pkt-button>
|
|
313
326
|
`}renderSearchToggle(t){if(!this.showSearch||!t.search)return e.h;let r=this.openMenu===`search`;return e._`
|
|
314
327
|
<pkt-button
|
|
315
|
-
id=${
|
|
328
|
+
id=${x}
|
|
316
329
|
class="pkt-header-global__search-toggle"
|
|
317
330
|
skin="primary"
|
|
318
331
|
color=${n.t(r?void 0:`yellow`)}
|
|
@@ -321,13 +334,13 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
321
334
|
size=${this.isMobile?`small`:`medium`}
|
|
322
335
|
state=${r?`active`:`normal`}
|
|
323
336
|
aria-expanded=${r}
|
|
324
|
-
aria-controls=${
|
|
337
|
+
aria-controls=${b}
|
|
325
338
|
@click=${()=>this.toggleMenu(`search`)}
|
|
326
339
|
>
|
|
327
340
|
${t.i18n?.search||this.pktStrings.get(`header`).search}
|
|
328
341
|
</pkt-button>
|
|
329
342
|
`}renderSearchPanel(r){let i=r.search;if(this.openMenu!==`search`||!this.showSearch||!i)return e.h;let a=this.searchPlaceholder??i.input.placeholder,o=t.t({"pkt-header-global__search-panel":!0,[`pkt-header-global__search-panel--${this.overlayBreakpointClass}`]:!!this.overlayBreakpointClass});return e._`
|
|
330
|
-
<div class=${o} id=${
|
|
343
|
+
<div class=${o} id=${b} style=${this.overlayAnchorStyle}>
|
|
331
344
|
<div class="pkt-header-global__search-panel-inner">
|
|
332
345
|
<pkt-searchinput
|
|
333
346
|
appearance="global"
|
|
@@ -346,7 +359,7 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
346
359
|
<div class="pkt-header-global__user">
|
|
347
360
|
<div
|
|
348
361
|
class="pkt-header-global__user-container ${n?`is-open`:``}"
|
|
349
|
-
${
|
|
362
|
+
${a.n(this.userContainerRef)}
|
|
350
363
|
>
|
|
351
364
|
<pkt-button
|
|
352
365
|
class="pkt-header-global__user-button"
|
|
@@ -358,12 +371,13 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
358
371
|
secondIconName=${n?`chevron-thin-up`:`chevron-thin-down`}
|
|
359
372
|
@click=${()=>this.toggleMenu(`user`)}
|
|
360
373
|
>
|
|
361
|
-
<span class="pkt-sr-only"
|
|
374
|
+
<span class="pkt-sr-only">${this.pktStrings.get(`header`).userMenuButton} </span>
|
|
362
375
|
<span translate="no">${this.representing?.name||this.user.name}</span>
|
|
363
376
|
</pkt-button>
|
|
364
377
|
${n?e._`
|
|
365
378
|
<div class=${r}>
|
|
366
379
|
<pkt-header-user-menu
|
|
380
|
+
.strings=${this.strings}
|
|
367
381
|
.user=${this.user}
|
|
368
382
|
formatted-last-logged-in=${this.formattedLastLoggedIn||e.h}
|
|
369
383
|
.representing=${this.representing}
|
|
@@ -380,9 +394,9 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
380
394
|
`}get overlayBreakpointClass(){return this.isMobile?`mobile`:this.isTablet?`tablet`:``}renderMenu(){if(this.openMenu!==`menu`)return e.h;let n=t.t({"pkt-header-global__menu":!0,[`pkt-header-global__menu--${this.overlayBreakpointClass}`]:!!this.overlayBreakpointClass});return e._`
|
|
381
395
|
<div
|
|
382
396
|
class=${n}
|
|
383
|
-
id=${
|
|
397
|
+
id=${v}
|
|
384
398
|
style=${this.overlayAnchorStyle}
|
|
385
|
-
${
|
|
399
|
+
${a.n(this.menuContainerRef)}
|
|
386
400
|
>
|
|
387
401
|
${this.localeData?e._`
|
|
388
402
|
<pkt-header-menu
|
|
@@ -397,14 +411,14 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
397
411
|
</nav>
|
|
398
412
|
`}
|
|
399
413
|
</div>
|
|
400
|
-
`}renderHeader(){let n=t.t({"pkt-header-global":!0,"pkt-header-global--mobile":this.isMobile,"pkt-header-global--tablet":this.isTablet,"pkt-header-global--fixed":this.isFixed,"pkt-header-global--sticky":this.isSticky,"pkt-header-global--scroll-to-hide":this.shouldHideOnScroll,"pkt-header-global--hidden":this.isHidden}),r=this.localeData,
|
|
401
|
-
<header class=${n} ${
|
|
414
|
+
`}renderHeader(){let n=t.t({"pkt-header-global":!0,"pkt-header-global--mobile":this.isMobile,"pkt-header-global--tablet":this.isTablet,"pkt-header-global--fixed":this.isFixed,"pkt-header-global--sticky":this.isSticky,"pkt-header-global--scroll-to-hide":this.shouldHideOnScroll,"pkt-header-global--hidden":this.isHidden}),r=this.localeData,i=this.isMobile;return e._`
|
|
415
|
+
<header class=${n} ${a.n(this.headerRef)}>
|
|
402
416
|
<div class="pkt-header-global__logo-area">${this.renderLogo()}</div>
|
|
403
417
|
<div class="pkt-header-global__content">
|
|
404
|
-
${!
|
|
405
|
-
${
|
|
418
|
+
${!i&&r?this.renderSearch(r):e.h}
|
|
419
|
+
${i&&r?this.renderSearchToggle(r):e.h}
|
|
406
420
|
${this.renderMenuToggle(r)}
|
|
407
|
-
${!
|
|
421
|
+
${!i&&r?this.renderContact(r):e.h}
|
|
408
422
|
</div>
|
|
409
423
|
${this.renderUser()}
|
|
410
424
|
</header>
|
|
@@ -414,7 +428,7 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
414
428
|
<div class=${r}></div>
|
|
415
429
|
${a}${i}
|
|
416
430
|
</div>
|
|
417
|
-
`}return e._`${n}${a}${i}`}};e.n([e.u({type:String,attribute:`data-url`})],
|
|
431
|
+
`}return e._`${n}${a}${i}`}};e.n([e.u({type:String,attribute:`data-url`})],S.prototype,`dataUrl`,void 0),e.n([e.u({type:Object,attribute:!1})],S.prototype,`data`,void 0),e.n([e.u({type:String})],S.prototype,`locale`,void 0),e.n([e.u({type:String,attribute:`logo-link`})],S.prototype,`logoLink`,void 0),e.n([e.u({type:String,attribute:`logo-path`})],S.prototype,`logoPath`,void 0),e.n([e.u({type:String,attribute:`search-placeholder`})],S.prototype,`searchPlaceholder`,void 0),e.n([e.u({type:String})],S.prototype,`position`,void 0),e.n([e.u({type:String,attribute:`scroll-behavior`})],S.prototype,`scrollBehavior`,void 0),e.n([e.u({type:Number,attribute:`mobile-breakpoint`})],S.prototype,`mobileBreakpoint`,void 0),e.n([e.u({type:Number,attribute:`tablet-breakpoint`})],S.prototype,`tabletBreakpoint`,void 0),e.n([e.u({type:String,attribute:`log-out-button-placement`})],S.prototype,`logOutButtonPlacement`,void 0),e.n([e.u({type:Boolean,attribute:`show-search`,converter:o.t})],S.prototype,`showSearch`,void 0),e.n([e.u({type:Boolean,attribute:`show-contact`,converter:o.t})],S.prototype,`showContact`,void 0),e.n([e.u({type:Boolean,attribute:`can-change-representation`,converter:o.t})],S.prototype,`canChangeRepresentation`,void 0),e.n([e.u({type:Boolean,attribute:`has-log-out`,converter:o.t})],S.prototype,`hasLogOut`,void 0),e.n([e.u({type:Object})],S.prototype,`user`,void 0),e.n([e.u({type:Array,attribute:`user-menu`})],S.prototype,`userMenu`,void 0),e.n([e.u({type:Object})],S.prototype,`representing`,void 0),e.n([e.l()],S.prototype,`openMenu`,void 0),e.n([e.l()],S.prototype,`fetchedData`,void 0),e.n([e.l()],S.prototype,`loadError`,void 0),e.n([e.l()],S.prototype,`headerAnchor`,void 0);try{e.d(`pkt-header-global`)(S)}catch{console.warn(`Forsøker å definere <pkt-header-global>, men den er allerede definert`)}var C=class extends i.t{constructor(...e){super(...e),this.type=`service`,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.canChangeRepresentation=!1,this.hasLogOut=!1,this.showContact=!0}firstUpdated(e){super.firstUpdated(e),this.emitDeprecationWarnings()}emitDeprecationWarnings(){this.userMenuFooter!==void 0&&console.warn(`[PktHeader] userMenuFooter is deprecated. Use userMenu instead.`),this.userOptions!==void 0&&console.warn(`[PktHeader] userOptions is deprecated. Use userMenu instead.`)}get effectiveUserMenu(){let e=this.userMenu||[],t=this.userMenuFooter||[],n=this.userOptions||[];return t.length||n.length?[...e,...n,...t]:this.userMenu}renderGlobal(){return e._`
|
|
418
432
|
<pkt-header-global
|
|
419
433
|
data-url=${n.t(this.dataUrl)}
|
|
420
434
|
locale=${n.t(this.locale)}
|
|
@@ -460,6 +474,6 @@ const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),
|
|
|
460
474
|
.userMenu=${this.effectiveUserMenu}
|
|
461
475
|
.representing=${this.representing}
|
|
462
476
|
>
|
|
463
|
-
${this.hasSlotContent()?e._`<div class="pkt-contents">${
|
|
477
|
+
${this.hasSlotContent()?e._`<div class="pkt-contents">${i.r(this)}</div>`:e.h}
|
|
464
478
|
</pkt-header-service>
|
|
465
|
-
`}};e.n([e.u({type:String})],
|
|
479
|
+
`}};e.n([e.u({type:String})],C.prototype,`type`,void 0),e.n([e.u({type:String,attribute:`service-name`})],C.prototype,`serviceName`,void 0),e.n([e.u({type:String,attribute:`service-link`})],C.prototype,`serviceLink`,void 0),e.n([e.u({type:String,attribute:`logo-link`})],C.prototype,`logoLink`,void 0),e.n([e.u({type:String,attribute:`logo-path`})],C.prototype,`logoPath`,void 0),e.n([e.u({type:String,attribute:`search-placeholder`})],C.prototype,`searchPlaceholder`,void 0),e.n([e.u({type:String,attribute:`search-value`})],C.prototype,`searchValue`,void 0),e.n([e.u({type:Number,attribute:`mobile-breakpoint`})],C.prototype,`mobileBreakpoint`,void 0),e.n([e.u({type:Number,attribute:`tablet-breakpoint`})],C.prototype,`tabletBreakpoint`,void 0),e.n([e.u({type:String,attribute:`opened-menu`})],C.prototype,`openedMenu`,void 0),e.n([e.u({type:String,attribute:`log-out-button-placement`})],C.prototype,`logOutButtonPlacement`,void 0),e.n([e.u({type:String})],C.prototype,`position`,void 0),e.n([e.u({type:String,attribute:`scroll-behavior`})],C.prototype,`scrollBehavior`,void 0),e.n([e.u({type:String,attribute:`slot-menu-variant`})],C.prototype,`slotMenuVariant`,void 0),e.n([e.u({type:String,attribute:`slot-menu-text`})],C.prototype,`slotMenuText`,void 0),e.n([e.u({type:Boolean,attribute:`hide-logo`,converter:o.t})],C.prototype,`hideLogo`,void 0),e.n([e.u({type:Boolean,converter:o.t})],C.prototype,`compact`,void 0),e.n([e.u({type:Boolean,attribute:`show-search`,converter:o.t})],C.prototype,`showSearch`,void 0),e.n([e.u({type:Boolean,attribute:`can-change-representation`,converter:o.t})],C.prototype,`canChangeRepresentation`,void 0),e.n([e.u({type:Boolean,attribute:`has-log-out`,converter:o.t})],C.prototype,`hasLogOut`,void 0),e.n([e.u({type:Object})],C.prototype,`user`,void 0),e.n([e.u({type:Array,attribute:`user-menu`})],C.prototype,`userMenu`,void 0),e.n([e.u({type:Object})],C.prototype,`representing`,void 0),e.n([e.u({type:String,attribute:`data-url`})],C.prototype,`dataUrl`,void 0),e.n([e.u({type:Object,attribute:!1})],C.prototype,`data`,void 0),e.n([e.u({type:String})],C.prototype,`locale`,void 0),e.n([e.u({type:Boolean,attribute:`show-contact`,converter:o.t})],C.prototype,`showContact`,void 0),e.n([e.u({type:Array,attribute:`user-menu-footer`})],C.prototype,`userMenuFooter`,void 0),e.n([e.u({type:Array,attribute:`user-options`})],C.prototype,`userOptions`,void 0);try{e.d(`pkt-header`)(C)}catch{console.warn(`Forsøker å definere <pkt-header>, men den er allerede definert`)}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return C}});
|