@oslokommune/punkt-elements 13.21.0 → 14.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.
@@ -0,0 +1,302 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./element-CJ_QKaki.cjs"),g=require("./pkt-slot-controller-BzddBp7z.cjs"),v=require("./if-defined-Bc9-_I01.cjs"),h=require("./ref-BFa5Utho.cjs"),d=require("./state-DSjcvzDN.cjs"),p=require("./class-map-C_erArZz.cjs");require("./button-abD9URn0.cjs");require("./icon-BGuizDwk.cjs");require("./link-Da3pZ_CW.cjs");require("./textinput-Dn704gQw.cjs");const u={fromAttribute(n){return n==null?!1:n===""||n==="true"||n===!0?!0:n==="false"||n===!1?!1:!!n},toAttribute(n){return n?"true":"false"}},b=n=>typeof n.target=="string"?{title:n.title,iconName:n.iconName,href:n.target}:{title:n.title,iconName:n.iconName,onClick:n.target},m=n=>{if(!n)return;const e=typeof n=="string"?new Date(n):n;if(!isNaN(e.getTime()))return e.toLocaleDateString("nb-NO",{day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"})};var f=Object.defineProperty,y=Object.getOwnPropertyDescriptor,k=(n,e,s,r)=>{for(var i=r>1?void 0:r?y(e,s):e,l=n.length-1,c;l>=0;l--)(c=n[l])&&(i=(r?c(e,s,i):c(i))||i);return r&&i&&f(e,s,i),i};exports.PktHeaderUserMenu=class extends t.PktElement{constructor(){super(...arguments),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(e,s){const r="href"in e,i=p.e({"pkt-user-menu__link":!0,"pkt-link-button":!r,"pkt-link":!r,"pkt-link--icon-left":!r,[s||""]:!!s});return r?t.x`
2
+ <pkt-link
3
+ icon-name=${e.iconName||t.E}
4
+ href=${e.href}
5
+ aria-hidden="true"
6
+ class="pkt-user-menu__link ${s||""}"
7
+ >
8
+ ${e.title}
9
+ </pkt-link>
10
+ `:t.x`
11
+ <button class=${i} type="button" @click=${()=>this.handleMenuItemClick(e)}>
12
+ ${e.iconName?t.x`<pkt-icon
13
+ name=${e.iconName}
14
+ class="pkt-link__icon"
15
+ aria-hidden="true"
16
+ ></pkt-icon>`:t.E}
17
+ ${e.title}
18
+ </button>
19
+ `}renderLinkSection(e){return t.x`
20
+ <ul class="pkt-user-menu__sublist">
21
+ ${e.map(s=>t.x`
22
+ <li class="pkt-user-menu__subitem">${this.renderLinkOrButton(s)}</li>
23
+ `)}
24
+ </ul>
25
+ `}render(){var s;const e=(s=this.userMenu)==null?void 0:s.map(b);return t.x`
26
+ <nav class="pkt-user-menu" aria-label="Meny for innlogget bruker">
27
+ <ul class="pkt-user-menu__list">
28
+ <!-- User section -->
29
+ ${this.user?t.x`
30
+ <li class="pkt-user-menu__item">
31
+ <div class="pkt-user-menu__label">Pålogget som</div>
32
+ <div class="pkt-user-menu__name" translate="no">${this.user.name}</div>
33
+ ${this.formattedLastLoggedIn?t.x`
34
+ <div class="pkt-user-menu__last-logged-in">
35
+ Sist pålogget: <time>${this.formattedLastLoggedIn}</time>
36
+ </div>
37
+ `:t.E}
38
+ </li>
39
+ `:t.E}
40
+
41
+ <!-- User menu items -->
42
+ ${e&&e.length>0?t.x`
43
+ <li class="pkt-user-menu__item">${this.renderLinkSection(e)}</li>
44
+ `:t.E}
45
+
46
+ <!-- Representing section -->
47
+ ${this.representing?t.x`
48
+ <li class="pkt-user-menu__item">
49
+ <div class="pkt-user-menu__label">Representerer</div>
50
+ <div class="pkt-user-menu__name" translate="no">${this.representing.name}</div>
51
+ ${this.representing.orgNumber?t.x`<div class="pkt-user-menu__org-number">
52
+ Org.nr. ${this.representing.orgNumber}
53
+ </div>`:t.E}
54
+ ${this.canChangeRepresentation?t.x`
55
+ <ul class="pkt-user-menu__sublist mt-size-16">
56
+ <li class="pkt-user-menu__subitem">
57
+ ${this.renderLinkOrButton({title:"Endre organisasjon",iconName:"cogwheel",onClick:()=>this.handleChangeRepresentation()})}
58
+ </li>
59
+ </ul>
60
+ `:t.E}
61
+ </li>
62
+ `:t.E}
63
+
64
+ <!-- Change representation without representing object -->
65
+ ${!this.representing&&this.canChangeRepresentation?t.x`
66
+ <li class="pkt-user-menu__item">
67
+ <ul class="pkt-user-menu__sublist">
68
+ <li class="pkt-user-menu__subitem">
69
+ ${this.renderLinkOrButton({title:"Endre organisasjon",iconName:"cogwheel",onClick:()=>this.handleChangeRepresentation()})}
70
+ </li>
71
+ </ul>
72
+ </li>
73
+ `:t.E}
74
+
75
+ <!-- Logout -->
76
+ ${this.logoutOnClick?t.x`
77
+ <li class="pkt-user-menu__item">
78
+ ${this.renderLinkOrButton({title:"Logg ut",iconName:"exit",onClick:()=>this.handleLogout()})}
79
+ </li>
80
+ `:t.E}
81
+ </ul>
82
+ </nav>
83
+ `}};k([t.n({type:Object})],exports.PktHeaderUserMenu.prototype,"user",2);k([t.n({type:String,attribute:"formatted-last-logged-in"})],exports.PktHeaderUserMenu.prototype,"formattedLastLoggedIn",2);k([t.n({type:Object})],exports.PktHeaderUserMenu.prototype,"representing",2);k([t.n({type:Array,attribute:"user-menu"})],exports.PktHeaderUserMenu.prototype,"userMenu",2);k([t.n({type:Boolean,attribute:"can-change-representation",converter:u})],exports.PktHeaderUserMenu.prototype,"canChangeRepresentation",2);k([t.n({type:Boolean,attribute:"logout-on-click",converter:u})],exports.PktHeaderUserMenu.prototype,"logoutOnClick",2);exports.PktHeaderUserMenu=k([t.t("pkt-header-user-menu")],exports.PktHeaderUserMenu);var S=Object.defineProperty,$=Object.getOwnPropertyDescriptor,o=(n,e,s,r)=>{for(var i=r>1?void 0:r?$(e,s):e,l=n.length-1,c;l>=0;l--)(c=n[l])&&(i=(r?c(e,s,i):c(i))||i);return r&&i&&S(e,s,i),i};const _="https://punkt-cdn.oslo.kommune.no/latest/logos/";exports.PktHeaderService=class extends t.PktElement{constructor(){super(),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.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.hasSlotContent=!1,this.alignSlotRight=!1,this.alignSearchRight=!1,this.defaultSlot=h.e(),this.headerRef=h.e(),this.userContainerRef=h.e(),this.slotContainerRef=h.e(),this.searchContainerRef=h.e(),this.slotContentRef=h.e(),this.searchMenuRef=h.e(),this.lastScrollPosition=0,this.savedScrollY=0,this.lastFocusedElement=null,this.shouldRestoreFocus=!1,this.handleScroll=()=>{if(!this.shouldHideOnScroll)return;const e=window.pageYOffset||document.documentElement.scrollTop;e<0||Math.abs(e-this.lastScrollPosition)<60||(this.isHidden=e>this.lastScrollPosition,this.lastScrollPosition=e)},this.handleClickOutside=e=>{const s=e.target;this.user&&this.openMenu==="user"&&!s.closest(".pkt-header-service__user-container")&&(this.openMenu="none"),this.openMenu==="slot"&&!s.closest(".pkt-header-service__slot-container")&&(this.openMenu="none"),this.openMenu==="search"&&!s.closest(".pkt-header-service__search-container")&&!s.closest(".pkt-header-service__search-input")&&(this.openMenu="none")},this.handleFocusOut=(e,s)=>{const r=e.relatedTarget;let i;switch(s){case"user":i=this.userContainerRef;break;case"slot":i=this.slotContainerRef;break;case"search":i=this.searchContainerRef;break;default:return}const l=i.value;l&&(!r||!l.contains(r))&&(this.openMenu="none")},this.handleEscapeKey=e=>{e.key==="Escape"&&this.openMenu!=="none"&&(e.preventDefault(),this.shouldRestoreFocus=!0,this.openMenu="none")},this.slotController=new g.PktSlotController(this,this.defaultSlot)}updateSlots(e){this.hasSlotContent=e.has(null)||e.has(void 0)}connectedCallback(){super.connectedCallback(),this.setupScrollListener()}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.resizeObserver)==null||e.disconnect(),window.removeEventListener("scroll",this.handleScroll),this.unlockScroll()}firstUpdated(){this.setupResizeObserver()}updated(e){if(super.updated(e),e.has("openedMenu")&&this.openedMenu!==this.openMenu&&(this.openMenu=this.openedMenu),(e.has("mobileBreakpoint")||e.has("tabletBreakpoint"))&&(this.updateIsMobile(),this.updateIsTablet()),e.has("openMenu")){const s=e.get("openMenu");this.openMenu!=="none"&&(s==="none"||s===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"&&s!=="none"&&(document.removeEventListener("mousedown",this.handleClickOutside),document.removeEventListener("keydown",this.handleEscapeKey),this.restoreFocus())}(e.has("openMenu")||e.has("isMobile"))&&this.updateScrollLock()}setupResizeObserver(){const e=this.headerRef.value;e&&(this.componentWidth=e.offsetWidth,this.updateIsMobile(),this.updateIsTablet(),this.resizeObserver=new ResizeObserver(s=>{for(const r of s)r.borderBoxSize&&r.borderBoxSize.length>0?this.componentWidth=r.borderBoxSize[0].inlineSize:this.componentWidth=r.contentRect.width,this.updateIsMobile(),this.updateIsTablet()}),this.resizeObserver.observe(e))}updateIsMobile(){this.isMobile=this.componentWidth<this.mobileBreakpoint}updateIsTablet(){this.isTablet=this.componentWidth<this.tabletBreakpoint}updateScrollLock(){this.position==="fixed"&&this.isMobile&&this.openMenu!=="none"?this.lockScroll():this.unlockScroll()}lockScroll(){const e=document.body,s=document.documentElement;this.savedScrollY=window.scrollY||window.pageYOffset;const r=window.innerWidth-s.clientWidth;r>0&&(e.style.paddingRight=`${r}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",s.classList.add("is-scroll-locked")}unlockScroll(){const e=document.body,s=document.documentElement;s.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"),s.classList.remove("is-scroll-locked"),window.scrollTo({top:this.savedScrollY}))}setupScrollListener(){window.addEventListener("scroll",this.handleScroll)}restoreFocus(){this.shouldRestoreFocus&&this.lastFocusedElement&&document.contains(this.lastFocusedElement)&&this.lastFocusedElement.focus(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1}checkDropdownAlignment(e){const s=e==="slot"?this.slotContainerRef:this.searchContainerRef,r=e==="slot"?this.slotContentRef:this.searchMenuRef;if(!s.value||!r.value||!this.isTablet||this.isMobile)return;const i=s.value.getBoundingClientRect(),l=r.value.offsetWidth,c=i.left+l>window.innerWidth;e==="slot"?this.alignSlotRight=c:this.alignSearchRight=c}handleMenuToggle(e){this.openMenu!=="none"?this.openMenu="none":(this.lastFocusedElement=document.activeElement,this.openMenu=e)}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){const s=e.target.value;this.handleSearchChange(s)}handleSearchKeyDown(e){e.key==="Enter"&&this.handleSearch(e.target.value)}get formattedLastLoggedIn(){var e;return m((e=this.user)==null?void 0:e.lastLoggedIn)}get isFixed(){return this.position==="fixed"}get shouldHideOnScroll(){return this.scrollBehavior==="hide"}get showLogoutInHeader(){return this.hasLogOut&&(this.logOutButtonPlacement==="header"||this.logOutButtonPlacement==="both")}get showLogoutInUserMenu(){return this.hasLogOut&&(this.logOutButtonPlacement==="userMenu"||this.logOutButtonPlacement==="both")}renderLogo(){if(this.hideLogo)return t.E;const e=t.x`
84
+ <pkt-icon name="oslologo" aria-hidden="true" path=${_}></pkt-icon>
85
+ `;return this.logoLink&&typeof this.logoLink=="string"?t.x`
86
+ <span class="pkt-header-service__logo">
87
+ <a href=${this.logoLink} aria-label="Tilbake til forside" @click=${this.handleLogoClick}>
88
+ ${e}
89
+ </a>
90
+ </span>
91
+ `:this.hasAttribute("logo-link")?t.x`
92
+ <span class="pkt-header-service__logo">
93
+ <button
94
+ aria-label="Tilbake til forside"
95
+ class="pkt-link-button pkt-link pkt-header-service__logo-link"
96
+ @click=${this.handleLogoClick}
97
+ >
98
+ ${e}
99
+ </button>
100
+ </span>
101
+ `:t.x`
102
+ <span class="pkt-header-service__logo" @click=${this.handleLogoClick}>${e}</span>
103
+ `}renderServiceName(){return this.serviceName?this.serviceLink&&typeof this.serviceLink=="string"?t.x`
104
+ <span class="pkt-header-service__service-name">
105
+ <pkt-link
106
+ href=${this.serviceLink}
107
+ class="pkt-header-service__service-link"
108
+ @click=${this.handleServiceClick}
109
+ >
110
+ ${this.serviceName}
111
+ </pkt-link>
112
+ </span>
113
+ `:this.hasAttribute("service-link")?t.x`
114
+ <span class="pkt-header-service__service-name">
115
+ <button
116
+ class="pkt-link-button pkt-link pkt-header-service__service-link"
117
+ @click=${this.handleServiceClick}
118
+ >
119
+ ${this.serviceName}
120
+ </button>
121
+ </span>
122
+ `:t.x`
123
+ <span class="pkt-header-service__service-name" @click=${this.handleServiceClick}>
124
+ <span class="pkt-header-service__service-link">${this.serviceName}</span>
125
+ </span>
126
+ `:t.E}renderSlotContainer(){const e=p.e({"pkt-header-service__slot-container":!0,"is-open":this.openMenu==="slot"}),s=p.e({"pkt-header-service__slot-content":!0,"align-right":this.alignSlotRight});return t.x`
127
+ <div
128
+ class=${e}
129
+ @focusout=${r=>this.handleFocusOut(r,"slot")}
130
+ ${h.n(this.slotContainerRef)}
131
+ >
132
+ ${this.isTablet&&this.hasSlotContent?t.x`
133
+ <pkt-button
134
+ skin="secondary"
135
+ variant="icon-only"
136
+ iconName="menu"
137
+ size=${this.isMobile?"small":"medium"}
138
+ state=${this.openMenu==="slot"?"active":"normal"}
139
+ @click=${()=>this.handleMenuToggle("slot")}
140
+ aria-expanded=${this.openMenu==="slot"}
141
+ aria-controls="mobile-slot-menu"
142
+ aria-label="Åpne meny"
143
+ >
144
+ Meny
145
+ </pkt-button>
146
+ `:t.E}
147
+ <div
148
+ class=${s}
149
+ id="mobile-slot-menu"
150
+ role=${this.isTablet?"menu":t.E}
151
+ aria-label=${this.isTablet?"Meny":t.E}
152
+ ${h.n(this.slotContentRef)}
153
+ ${h.n(this.defaultSlot)}
154
+ ></div>
155
+ </div>
156
+ `}renderSearch(){if(!this.showSearch)return t.E;if(this.isTablet){const e=p.e({"pkt-header-service__search-container":!0,"is-open":this.openMenu==="search"}),s=p.e({"pkt-header-service__mobile-menu":!0,"is-open":this.openMenu==="search","align-right":this.alignSearchRight});return t.x`
157
+ <div
158
+ class=${e}
159
+ @focusout=${r=>this.handleFocusOut(r,"search")}
160
+ ${h.n(this.searchContainerRef)}
161
+ >
162
+ <pkt-button
163
+ skin="secondary"
164
+ variant="icon-only"
165
+ iconName="magnifying-glass-big"
166
+ size=${this.isMobile?"small":"medium"}
167
+ @click=${()=>this.handleMenuToggle("search")}
168
+ state=${this.openMenu==="search"?"active":"normal"}
169
+ aria-expanded=${this.openMenu==="search"}
170
+ aria-controls="mobile-search-menu"
171
+ aria-label="Åpne søkefelt"
172
+ >
173
+ Søk
174
+ </pkt-button>
175
+ <div class=${s} ${h.n(this.searchMenuRef)}>
176
+ ${this.openMenu==="search"?t.x`
177
+ <pkt-textinput
178
+ id="mobile-search-menu"
179
+ class="pkt-header-service__search-input"
180
+ type="search"
181
+ label="Søk"
182
+ useWrapper="false"
183
+ placeholder=${this.searchPlaceholder}
184
+ value=${this.searchValue}
185
+ autofocus
186
+ fullwidth
187
+ @input=${this.handleSearchInputChange}
188
+ @keydown=${r=>{r.key==="Enter"&&this.handleSearch(r.target.value)}}
189
+ ></pkt-textinput>
190
+ `:t.E}
191
+ </div>
192
+ </div>
193
+ `}return t.x`
194
+ <pkt-textinput
195
+ id="header-service-search"
196
+ class="pkt-header-service__search-input"
197
+ type="search"
198
+ label="Søk"
199
+ useWrapper="false"
200
+ placeholder=${this.searchPlaceholder}
201
+ value=${this.searchValue}
202
+ @input=${this.handleSearchInputChange}
203
+ @keydown=${this.handleSearchKeyDown}
204
+ ></pkt-textinput>
205
+ `}renderUserButton(){var s;if(!this.user)return t.E;const e=p.e({"pkt-header-service__user-menu":this.isMobile===!1,"pkt-header-service__mobile-menu":this.isMobile===!0,"is-open":this.openMenu==="user"});return t.x`
206
+ <div
207
+ class="pkt-header-service__user-container"
208
+ @focusout=${r=>this.handleFocusOut(r,"user")}
209
+ ${h.n(this.userContainerRef)}
210
+ >
211
+ <pkt-button
212
+ class=${p.e({"pkt-header-service__user-button":!0,"pkt-header-service__user-button--mobile":this.isMobile})}
213
+ skin="secondary"
214
+ size=${this.isMobile?"small":"medium"}
215
+ state=${this.openMenu==="user"?"active":"normal"}
216
+ variant="icons-right-and-left"
217
+ iconName="user"
218
+ secondIconName=${this.openMenu==="user"?"chevron-thin-up":"chevron-thin-down"}
219
+ @click=${()=>this.handleMenuToggle("user")}
220
+ >
221
+ <span class="pkt-sr-only">Brukermeny: </span>
222
+ ${((s=this.representing)==null?void 0:s.name)||this.user.name}
223
+ </pkt-button>
224
+ ${this.openMenu==="user"&&this.user?t.x`
225
+ <div class=${e}>
226
+ <pkt-header-user-menu
227
+ .user=${this.user}
228
+ formatted-last-logged-in=${this.formattedLastLoggedIn||t.E}
229
+ .representing=${this.representing}
230
+ .userMenu=${this.userMenu}
231
+ ?can-change-representation=${this.canChangeRepresentation}
232
+ ?logout-on-click=${this.showLogoutInUserMenu}
233
+ @change-representation=${()=>this.dispatchEvent(new CustomEvent("change-representation",{bubbles:!0,composed:!0}))}
234
+ @log-out=${this.handleLogout}
235
+ ></pkt-header-user-menu>
236
+ </div>
237
+ `:t.E}
238
+ </div>
239
+ `}renderHeader(){const e=p.e({"pkt-header-service":!0,"pkt-header-service--compact":this.compact,"pkt-header-service--mobile":this.isMobile,"pkt-header-service--tablet":this.isTablet,"pkt-header-service--fixed":this.isFixed,"pkt-header-service--scroll-to-hide":this.shouldHideOnScroll,"pkt-header-service--hidden":this.isHidden}),s=p.e({"pkt-header-service__logo-area":!0,"pkt-header-service__logo-area--without-service":!this.serviceName});return t.x`
240
+ <header class=${e} ${h.n(this.headerRef)}>
241
+ <div class=${s}>${this.renderLogo()} ${this.renderServiceName()}</div>
242
+
243
+ <div class="pkt-header-service__content">
244
+ ${this.renderSlotContainer()} ${this.renderSearch()}
245
+ ${this.isTablet&&this.showLogoutInHeader?t.x`
246
+ <pkt-button
247
+ skin="secondary"
248
+ size=${this.isMobile?"small":"medium"}
249
+ variant="icon-only"
250
+ iconName="exit"
251
+ @click=${this.handleLogout}
252
+ >
253
+ Logg ut
254
+ </pkt-button>
255
+ `:t.E}
256
+ </div>
257
+
258
+ <div class="pkt-header-service__user">
259
+ ${this.renderUserButton()}
260
+ ${!this.isTablet&&this.showLogoutInHeader?t.x`
261
+ <pkt-button
262
+ skin="tertiary"
263
+ size="medium"
264
+ variant="icon-right"
265
+ iconName="exit"
266
+ @click=${this.handleLogout}
267
+ >
268
+ Logg ut
269
+ </pkt-button>
270
+ `:t.E}
271
+ </div>
272
+ </header>
273
+ `}render(){const e=this.renderHeader();if(this.isFixed){const s=p.e({"pkt-header-service-spacer":!0,"pkt-header-service-spacer--compact":this.compact,"pkt-header-service-spacer--has-user":!!this.user,"pkt-header-service-spacer--mobile":this.isMobile});return t.x`
274
+ <div class="pkt-header-service-wrapper">
275
+ ${e}
276
+ <div class=${s}></div>
277
+ </div>
278
+ `}return e}};o([t.n({type:String,attribute:"service-name"})],exports.PktHeaderService.prototype,"serviceName",2);o([t.n({type:String,attribute:"service-link"})],exports.PktHeaderService.prototype,"serviceLink",2);o([t.n({type:String,attribute:"logo-link"})],exports.PktHeaderService.prototype,"logoLink",2);o([t.n({type:String,attribute:"search-placeholder"})],exports.PktHeaderService.prototype,"searchPlaceholder",2);o([t.n({type:String,attribute:"search-value"})],exports.PktHeaderService.prototype,"searchValue",2);o([t.n({type:Number,attribute:"mobile-breakpoint"})],exports.PktHeaderService.prototype,"mobileBreakpoint",2);o([t.n({type:Number,attribute:"tablet-breakpoint"})],exports.PktHeaderService.prototype,"tabletBreakpoint",2);o([t.n({type:String,attribute:"opened-menu"})],exports.PktHeaderService.prototype,"openedMenu",2);o([t.n({type:String,attribute:"log-out-button-placement"})],exports.PktHeaderService.prototype,"logOutButtonPlacement",2);o([t.n({type:String})],exports.PktHeaderService.prototype,"position",2);o([t.n({type:String,attribute:"scroll-behavior"})],exports.PktHeaderService.prototype,"scrollBehavior",2);o([t.n({type:Boolean,attribute:"hide-logo",converter:u})],exports.PktHeaderService.prototype,"hideLogo",2);o([t.n({type:Boolean,converter:u})],exports.PktHeaderService.prototype,"compact",2);o([t.n({type:Boolean,attribute:"show-search",converter:u})],exports.PktHeaderService.prototype,"showSearch",2);o([t.n({type:Boolean,attribute:"can-change-representation",converter:u})],exports.PktHeaderService.prototype,"canChangeRepresentation",2);o([t.n({type:Boolean,attribute:"has-log-out",converter:u})],exports.PktHeaderService.prototype,"hasLogOut",2);o([t.n({type:Object})],exports.PktHeaderService.prototype,"user",2);o([t.n({type:Array,attribute:"user-menu"})],exports.PktHeaderService.prototype,"userMenu",2);o([t.n({type:Object})],exports.PktHeaderService.prototype,"representing",2);o([d.r()],exports.PktHeaderService.prototype,"isMobile",2);o([d.r()],exports.PktHeaderService.prototype,"isTablet",2);o([d.r()],exports.PktHeaderService.prototype,"openMenu",2);o([d.r()],exports.PktHeaderService.prototype,"isHidden",2);o([d.r()],exports.PktHeaderService.prototype,"componentWidth",2);o([d.r()],exports.PktHeaderService.prototype,"hasSlotContent",2);o([d.r()],exports.PktHeaderService.prototype,"alignSlotRight",2);o([d.r()],exports.PktHeaderService.prototype,"alignSearchRight",2);exports.PktHeaderService=o([t.t("pkt-header-service")],exports.PktHeaderService);var M=Object.defineProperty,P=Object.getOwnPropertyDescriptor,a=(n,e,s,r)=>{for(var i=r>1?void 0:r?P(e,s):e,l=n.length-1,c;l>=0;l--)(c=n[l])&&(i=(r?c(e,s,i):c(i))||i);return r&&i&&M(e,s,i),i};exports.PktHeader=class extends t.PktElement{constructor(){super(),this.defaultSlot=h.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.hideLogo=!1,this.compact=!1,this.showSearch=!1,this.canChangeRepresentation=!1,this.hasLogOut=!1,this.slotController=new g.PktSlotController(this,this.defaultSlot)}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(){const e=this.userMenu||[],s=this.userMenuFooter||[],r=this.userOptions||[];return s.length||r.length?[...e,...r,...s]:this.userMenu}render(){return t.x`
279
+ <pkt-header-service
280
+ service-name=${v.o(this.serviceName)}
281
+ service-link=${v.o(this.serviceLink)}
282
+ logo-link=${v.o(this.logoLink)}
283
+ search-placeholder=${this.searchPlaceholder}
284
+ search-value=${this.searchValue}
285
+ mobile-breakpoint=${this.mobileBreakpoint}
286
+ tablet-breakpoint=${this.tabletBreakpoint}
287
+ opened-menu=${this.openedMenu}
288
+ log-out-button-placement=${this.logOutButtonPlacement}
289
+ position=${this.position}
290
+ scroll-behavior=${this.scrollBehavior}
291
+ .hideLogo=${this.hideLogo}
292
+ .compact=${this.compact}
293
+ .showSearch=${this.showSearch}
294
+ .canChangeRepresentation=${this.canChangeRepresentation}
295
+ .hasLogOut=${this.hasLogOut}
296
+ .user=${this.user}
297
+ .userMenu=${this.effectiveUserMenu}
298
+ .representing=${this.representing}
299
+ >
300
+ <div class="pkt-contents" ${h.n(this.defaultSlot)}></div>
301
+ </pkt-header-service>
302
+ `}};a([t.n({type:String,attribute:"service-name"})],exports.PktHeader.prototype,"serviceName",2);a([t.n({type:String,attribute:"service-link"})],exports.PktHeader.prototype,"serviceLink",2);a([t.n({type:String,attribute:"logo-link"})],exports.PktHeader.prototype,"logoLink",2);a([t.n({type:String,attribute:"search-placeholder"})],exports.PktHeader.prototype,"searchPlaceholder",2);a([t.n({type:String,attribute:"search-value"})],exports.PktHeader.prototype,"searchValue",2);a([t.n({type:Number,attribute:"mobile-breakpoint"})],exports.PktHeader.prototype,"mobileBreakpoint",2);a([t.n({type:Number,attribute:"tablet-breakpoint"})],exports.PktHeader.prototype,"tabletBreakpoint",2);a([t.n({type:String,attribute:"opened-menu"})],exports.PktHeader.prototype,"openedMenu",2);a([t.n({type:String,attribute:"log-out-button-placement"})],exports.PktHeader.prototype,"logOutButtonPlacement",2);a([t.n({type:String})],exports.PktHeader.prototype,"position",2);a([t.n({type:String,attribute:"scroll-behavior"})],exports.PktHeader.prototype,"scrollBehavior",2);a([t.n({type:Boolean,attribute:"hide-logo",converter:u})],exports.PktHeader.prototype,"hideLogo",2);a([t.n({type:Boolean,converter:u})],exports.PktHeader.prototype,"compact",2);a([t.n({type:Boolean,attribute:"show-search",converter:u})],exports.PktHeader.prototype,"showSearch",2);a([t.n({type:Boolean,attribute:"can-change-representation",converter:u})],exports.PktHeader.prototype,"canChangeRepresentation",2);a([t.n({type:Boolean,attribute:"has-log-out",converter:u})],exports.PktHeader.prototype,"hasLogOut",2);a([t.n({type:Object})],exports.PktHeader.prototype,"user",2);a([t.n({type:Array,attribute:"user-menu"})],exports.PktHeader.prototype,"userMenu",2);a([t.n({type:Object})],exports.PktHeader.prototype,"representing",2);a([t.n({type:Array,attribute:"user-menu-footer"})],exports.PktHeader.prototype,"userMenuFooter",2);a([t.n({type:Array,attribute:"user-options"})],exports.PktHeader.prototype,"userOptions",2);exports.PktHeader=a([t.t("pkt-header")],exports.PktHeader);exports.formatLastLoggedIn=m;