@oslokommune/punkt-elements
Version:
Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo
304 lines (299 loc) • 27.4 kB
JavaScript
const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),n=require(`./element-with-slot-CWoTGA1B.cjs`);require(`./icon-Dr8sfT2X.cjs`);const r=require(`./if-defined-XKOD_t_V.cjs`);require(`./button-D-TOBaJB.cjs`);const i=require(`./ref-BaJ0mBT_.cjs`),a=require(`./booleanish-B5EFqFpJ.cjs`);require(`./link-DMKjKawh.cjs`),require(`./textinput-Dsc-8-BB.cjs`);var o=e=>typeof e.target==`string`?{title:e.title,iconName:e.iconName,href:e.target}:{title:e.title,iconName:e.iconName,onClick:e.target},s=e=>o(e),c=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`})},l=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.d`
<pkt-link
icon-name=${n.iconName||e.l}
href=${n.href}
aria-hidden="true"
class="pkt-user-menu__link ${r||``}"
>
${n.title}
</pkt-link>
`:e.d`
<button class=${a} type="button" @click=${()=>this.handleMenuItemClick(n)}>
${n.iconName?e.d`<pkt-icon
name=${n.iconName}
class="pkt-link__icon"
aria-hidden="true"
></pkt-icon>`:e.l}
${n.title}
</button>
`}renderLinkSection(t){return e.d`
<ul class="pkt-user-menu__sublist">
${t.map(t=>e.d`
<li class="pkt-user-menu__subitem">${this.renderLinkOrButton(t)}</li>
`)}
</ul>
`}render(){let t=this.userMenu?.map(s);return e.d`
<nav class="pkt-user-menu" aria-label="Meny for innlogget bruker">
<ul class="pkt-user-menu__list">
<!-- User section -->
${this.user?e.d`
<li class="pkt-user-menu__item">
<div class="pkt-user-menu__label">Pålogget som</div>
<div class="pkt-user-menu__name" translate="no">${this.user.name}</div>
${this.formattedLastLoggedIn?e.d`
<div class="pkt-user-menu__last-logged-in">
Sist pålogget: <time>${this.formattedLastLoggedIn}</time>
</div>
`:e.l}
</li>
`:e.l}
<!-- User menu items -->
${t&&t.length>0?e.d`
<li class="pkt-user-menu__item">${this.renderLinkSection(t)}</li>
`:e.l}
<!-- Representing section -->
${this.representing?e.d`
<li class="pkt-user-menu__item">
<div class="pkt-user-menu__label">Representerer</div>
<div class="pkt-user-menu__name" translate="no">${this.representing.name}</div>
${this.representing.orgNumber?e.d`<div class="pkt-user-menu__org-number">
Org.nr. ${this.representing.orgNumber}
</div>`:e.l}
${this.canChangeRepresentation?e.d`
<ul class="pkt-user-menu__sublist mt-size-16">
<li class="pkt-user-menu__subitem">
${this.renderLinkOrButton({title:`Endre organisasjon`,iconName:`cogwheel`,onClick:()=>this.handleChangeRepresentation()})}
</li>
</ul>
`:e.l}
</li>
`:e.l}
<!-- Change representation without representing object -->
${!this.representing&&this.canChangeRepresentation?e.d`
<li class="pkt-user-menu__item">
<ul class="pkt-user-menu__sublist">
<li class="pkt-user-menu__subitem">
${this.renderLinkOrButton({title:`Endre organisasjon`,iconName:`cogwheel`,onClick:()=>this.handleChangeRepresentation()})}
</li>
</ul>
</li>
`:e.l}
<!-- Logout -->
${this.logoutOnClick?e.d`
<li class="pkt-user-menu__item">
${this.renderLinkOrButton({title:`Logg ut`,iconName:`exit`,onClick:()=>this.handleLogout()})}
</li>
`:e.l}
</ul>
</nav>
`}};e.r([e.s({type:Object})],l.prototype,`user`,void 0),e.r([e.s({type:String,attribute:`formatted-last-logged-in`})],l.prototype,`formattedLastLoggedIn`,void 0),e.r([e.s({type:Object})],l.prototype,`representing`,void 0),e.r([e.s({type:Array,attribute:`user-menu`})],l.prototype,`userMenu`,void 0),e.r([e.s({type:Boolean,attribute:`can-change-representation`,converter:a.t})],l.prototype,`canChangeRepresentation`,void 0),e.r([e.s({type:Boolean,attribute:`logout-on-click`,converter:a.t})],l.prototype,`logoutOnClick`,void 0);try{e.c(`pkt-header-user-menu`)(l)}catch{console.warn(`Forsøker å definere <pkt-header-user-menu>, men den er allerede definert`)}var u=`https://punkt-cdn.oslo.kommune.no/latest/logos/`,d=class extends n.t{constructor(...e){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,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=i.t(),this.userContainerRef=i.t(),this.slotContainerRef=i.t(),this.searchContainerRef=i.t(),this.slotContentRef=i.t(),this.searchMenuRef=i.t(),this.lastScrollPosition=0,this.savedScrollY=0,this.lastFocusedElement=null,this.shouldRestoreFocus=!1,this.handleScroll=()=>{if(!this.shouldHideOnScroll)return;let 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=>{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.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.shouldRestoreFocus=!0,this.openMenu=`none`)}}connectedCallback(){super.connectedCallback(),this.setupScrollListener()}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.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`)){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.restoreFocus())}(e.has(`openMenu`)||e.has(`isMobile`))&&this.updateScrollLock()}setupResizeObserver(){let e=this.headerRef.value;e&&(this.componentWidth=e.offsetWidth,this.updateIsMobile(),this.updateIsTablet(),this.resizeObserver=new ResizeObserver(e=>{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()}),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(){let e=document.body,t=document.documentElement;this.savedScrollY=window.scrollY||window.pageYOffset;let n=window.innerWidth-t.clientWidth;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`)}unlockScroll(){let e=document.body,t=document.documentElement;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}))}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){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.lastFocusedElement=document.activeElement,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 c(this.user?.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 e.l;let t=e.d`
<pkt-icon name="oslologo" aria-hidden="true" path=${u}></pkt-icon>
`;return this.logoLink&&typeof this.logoLink==`string`?e.d`
<span class="pkt-header-service__logo">
<a href=${this.logoLink} aria-label="Tilbake til forside" @click=${this.handleLogoClick}>
${t}
</a>
</span>
`:this.hasAttribute(`logo-link`)?e.d`
<span class="pkt-header-service__logo">
<button
aria-label="Tilbake til forside"
class="pkt-link-button pkt-link pkt-header-service__logo-link"
@click=${this.handleLogoClick}
>
${t}
</button>
</span>
`:e.d`
<span class="pkt-header-service__logo" @click=${this.handleLogoClick}>${t}</span>
`}renderServiceName(){return this.serviceName?this.serviceLink&&typeof this.serviceLink==`string`?e.d`
<span class="pkt-header-service__service-name">
<pkt-link
href=${this.serviceLink}
class="pkt-header-service__service-link"
@click=${this.handleServiceClick}
>
${this.serviceName}
</pkt-link>
</span>
`:this.hasAttribute(`service-link`)?e.d`
<span class="pkt-header-service__service-name">
<button
class="pkt-link-button pkt-link pkt-header-service__service-link"
@click=${this.handleServiceClick}
>
${this.serviceName}
</button>
</span>
`:e.d`
<span class="pkt-header-service__service-name" @click=${this.handleServiceClick}>
<span class="pkt-header-service__service-link">${this.serviceName}</span>
</span>
`:e.l}renderSlotContainer(){if(!this.hasSlotContent())return e.l;let r=t.t({"pkt-header-service__slot-container":!0,"is-open":this.openMenu===`slot`}),a=t.t({"pkt-header-service__slot-content":!0,"align-right":this.alignSlotRight});return e.d`
<div
class=${r}
@focusout=${e=>this.handleFocusOut(e,`slot`)}
${i.n(this.slotContainerRef)}
>
${this.isTablet&&this.hasSlotContent()?e.d`
<pkt-button
skin="secondary"
variant=${this.slotMenuVariant}
iconName="menu"
size=${this.isMobile?`small`:`medium`}
state=${this.openMenu===`slot`?`active`:`normal`}
@click=${()=>this.handleMenuToggle(`slot`)}
aria-expanded=${this.openMenu===`slot`}
aria-controls="mobile-slot-menu"
aria-label="Åpne meny"
>
${this.slotMenuText}
</pkt-button>
`:e.l}
<div
class=${a}
id="mobile-slot-menu"
role=${this.isTablet?`menu`:e.l}
aria-label=${this.isTablet?`Meny`:e.l}
${i.n(this.slotContentRef)}
>
${n.n(this)}
</div>
</div>
`}renderSearch(){if(!this.showSearch)return e.l;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.d`
<div
class=${n}
@focusout=${e=>this.handleFocusOut(e,`search`)}
${i.n(this.searchContainerRef)}
>
<pkt-button
skin="secondary"
variant="icon-only"
iconName="magnifying-glass-big"
size=${this.isMobile?`small`:`medium`}
@click=${()=>this.handleMenuToggle(`search`)}
state=${this.openMenu===`search`?`active`:`normal`}
aria-expanded=${this.openMenu===`search`}
aria-controls="mobile-search-menu"
aria-label="Åpne søkefelt"
>
Søk
</pkt-button>
<div class=${r} ${i.n(this.searchMenuRef)}>
${this.openMenu===`search`?e.d`
<pkt-textinput
id="mobile-search-menu"
class="pkt-header-service__search-input"
type="search"
label="Søk"
useWrapper="false"
placeholder=${this.searchPlaceholder}
value=${this.searchValue}
autofocus
fullwidth
@input=${this.handleSearchInputChange}
@keydown=${e=>{e.key===`Enter`&&this.handleSearch(e.target.value)}}
></pkt-textinput>
`:e.l}
</div>
</div>
`}return e.d`
<pkt-textinput
id="header-service-search"
class="pkt-header-service__search-input"
type="search"
label="Søk"
useWrapper="false"
placeholder=${this.searchPlaceholder}
value=${this.searchValue}
@input=${this.handleSearchInputChange}
@keydown=${this.handleSearchKeyDown}
></pkt-textinput>
`}renderUserButton(){if(!this.user)return e.l;let n=t.t({"pkt-header-service__user-menu":this.isMobile===!1,"pkt-header-service__mobile-menu":this.isMobile===!0,"is-open":this.openMenu===`user`});return e.d`
<div
class="pkt-header-service__user-container"
@focusout=${e=>this.handleFocusOut(e,`user`)}
${i.n(this.userContainerRef)}
>
<pkt-button
class=${t.t({"pkt-header-service__user-button":!0,"pkt-header-service__user-button--mobile":this.isMobile})}
skin="secondary"
size=${this.isMobile?`small`:`medium`}
state=${this.openMenu===`user`?`active`:`normal`}
variant="icons-right-and-left"
iconName="user"
secondIconName=${this.openMenu===`user`?`chevron-thin-up`:`chevron-thin-down`}
@click=${()=>this.handleMenuToggle(`user`)}
>
<span class="pkt-sr-only">Brukermeny: </span>
<span>${this.representing?.name||this.user.name}</span>
</pkt-button>
${this.openMenu===`user`&&this.user?e.d`
<div class=${n}>
<pkt-header-user-menu
.user=${this.user}
formatted-last-logged-in=${this.formattedLastLoggedIn||e.l}
.representing=${this.representing}
.userMenu=${this.userMenu}
?can-change-representation=${this.canChangeRepresentation}
?logout-on-click=${this.showLogoutInUserMenu}
@change-representation=${()=>this.dispatchEvent(new CustomEvent(`change-representation`,{bubbles:!0,composed:!0}))}
@log-out=${this.handleLogout}
></pkt-header-user-menu>
</div>
`:e.l}
</div>
`}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--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.d`
<header class=${n} ${i.n(this.headerRef)}>
<div class=${r}>${this.renderLogo()} ${this.renderServiceName()}</div>
${this.hasSlotContent()||this.showSearch||this.showLogoutInHeader?e.d`<div class="pkt-header-service__content">
${this.renderSlotContainer()} ${this.renderSearch()}
${this.isTablet&&this.showLogoutInHeader?e.d`
<pkt-button
skin="secondary"
size=${this.isMobile?`small`:`medium`}
variant="icon-only"
iconName="exit"
@click=${this.handleLogout}
>
Logg ut
</pkt-button>
`:e.l}
</div>`:e.l}
${this.user||!this.isTablet&&this.showLogoutInHeader?e.d`<div class="pkt-header-service__user">
${this.renderUserButton()}
${!this.isTablet&&this.showLogoutInHeader?e.d`
<pkt-button
skin="tertiary"
size="medium"
variant="icon-right"
iconName="exit"
@click=${this.handleLogout}
>
Logg ut
</pkt-button>
`:e.l}
</div>`:e.l}
</header>
`}render(){let n=this.renderHeader();return this.isFixed?e.d`
<div class="pkt-header-service-wrapper">
${n}
<div class=${t.t({"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,"pkt-header-service-spacer--tablet":this.isTablet})}></div>
</div>
`:n}};e.r([e.s({type:String,attribute:`service-name`})],d.prototype,`serviceName`,void 0),e.r([e.s({type:String,attribute:`service-link`})],d.prototype,`serviceLink`,void 0),e.r([e.s({type:String,attribute:`logo-link`})],d.prototype,`logoLink`,void 0),e.r([e.s({type:String,attribute:`search-placeholder`})],d.prototype,`searchPlaceholder`,void 0),e.r([e.s({type:String,attribute:`search-value`})],d.prototype,`searchValue`,void 0),e.r([e.s({type:Number,attribute:`mobile-breakpoint`})],d.prototype,`mobileBreakpoint`,void 0),e.r([e.s({type:Number,attribute:`tablet-breakpoint`})],d.prototype,`tabletBreakpoint`,void 0),e.r([e.s({type:String,attribute:`opened-menu`})],d.prototype,`openedMenu`,void 0),e.r([e.s({type:String,attribute:`log-out-button-placement`})],d.prototype,`logOutButtonPlacement`,void 0),e.r([e.s({type:String})],d.prototype,`position`,void 0),e.r([e.s({type:String,attribute:`scroll-behavior`})],d.prototype,`scrollBehavior`,void 0),e.r([e.s({type:String,attribute:`slot-menu-variant`})],d.prototype,`slotMenuVariant`,void 0),e.r([e.s({type:String,attribute:`slot-menu-text`})],d.prototype,`slotMenuText`,void 0),e.r([e.s({type:Boolean,attribute:`hide-logo`,converter:a.t})],d.prototype,`hideLogo`,void 0),e.r([e.s({type:Boolean,converter:a.t})],d.prototype,`compact`,void 0),e.r([e.s({type:Boolean,attribute:`show-search`,converter:a.t})],d.prototype,`showSearch`,void 0),e.r([e.s({type:Boolean,attribute:`can-change-representation`,converter:a.t})],d.prototype,`canChangeRepresentation`,void 0),e.r([e.s({type:Boolean,attribute:`has-log-out`,converter:a.t})],d.prototype,`hasLogOut`,void 0),e.r([e.s({type:Object})],d.prototype,`user`,void 0),e.r([e.s({type:Array,attribute:`user-menu`})],d.prototype,`userMenu`,void 0),e.r([e.s({type:Object})],d.prototype,`representing`,void 0),e.r([e.o()],d.prototype,`isMobile`,void 0),e.r([e.o()],d.prototype,`isTablet`,void 0),e.r([e.o()],d.prototype,`openMenu`,void 0),e.r([e.o()],d.prototype,`isHidden`,void 0),e.r([e.o()],d.prototype,`componentWidth`,void 0),e.r([e.o()],d.prototype,`alignSlotRight`,void 0),e.r([e.o()],d.prototype,`alignSearchRight`,void 0);try{e.c(`pkt-header-service`)(d)}catch{console.warn(`Forsøker å definere <pkt-header-service>, men den er allerede definert`)}var f=class extends n.t{constructor(...e){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}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}render(){return e.d`
<pkt-header-service
service-name=${r.t(this.serviceName)}
service-link=${r.t(this.serviceLink)}
logo-link=${r.t(this.logoLink)}
search-placeholder=${this.searchPlaceholder}
search-value=${this.searchValue}
mobile-breakpoint=${this.mobileBreakpoint}
tablet-breakpoint=${this.tabletBreakpoint}
opened-menu=${this.openedMenu}
log-out-button-placement=${this.logOutButtonPlacement}
position=${this.position}
scroll-behavior=${this.scrollBehavior}
slot-menu-variant=${this.slotMenuVariant}
slot-menu-text=${this.slotMenuText}
.hideLogo=${this.hideLogo}
.compact=${this.compact}
.showSearch=${this.showSearch}
.canChangeRepresentation=${this.canChangeRepresentation}
.hasLogOut=${this.hasLogOut}
.user=${this.user}
.userMenu=${this.effectiveUserMenu}
.representing=${this.representing}
>
${this.hasSlotContent()?e.d`<div class="pkt-contents">${n.n(this)}</div>`:e.l}
</pkt-header-service>
`}};e.r([e.s({type:String,attribute:`service-name`})],f.prototype,`serviceName`,void 0),e.r([e.s({type:String,attribute:`service-link`})],f.prototype,`serviceLink`,void 0),e.r([e.s({type:String,attribute:`logo-link`})],f.prototype,`logoLink`,void 0),e.r([e.s({type:String,attribute:`search-placeholder`})],f.prototype,`searchPlaceholder`,void 0),e.r([e.s({type:String,attribute:`search-value`})],f.prototype,`searchValue`,void 0),e.r([e.s({type:Number,attribute:`mobile-breakpoint`})],f.prototype,`mobileBreakpoint`,void 0),e.r([e.s({type:Number,attribute:`tablet-breakpoint`})],f.prototype,`tabletBreakpoint`,void 0),e.r([e.s({type:String,attribute:`opened-menu`})],f.prototype,`openedMenu`,void 0),e.r([e.s({type:String,attribute:`log-out-button-placement`})],f.prototype,`logOutButtonPlacement`,void 0),e.r([e.s({type:String})],f.prototype,`position`,void 0),e.r([e.s({type:String,attribute:`scroll-behavior`})],f.prototype,`scrollBehavior`,void 0),e.r([e.s({type:String,attribute:`slot-menu-variant`})],f.prototype,`slotMenuVariant`,void 0),e.r([e.s({type:String,attribute:`slot-menu-text`})],f.prototype,`slotMenuText`,void 0),e.r([e.s({type:Boolean,attribute:`hide-logo`,converter:a.t})],f.prototype,`hideLogo`,void 0),e.r([e.s({type:Boolean,converter:a.t})],f.prototype,`compact`,void 0),e.r([e.s({type:Boolean,attribute:`show-search`,converter:a.t})],f.prototype,`showSearch`,void 0),e.r([e.s({type:Boolean,attribute:`can-change-representation`,converter:a.t})],f.prototype,`canChangeRepresentation`,void 0),e.r([e.s({type:Boolean,attribute:`has-log-out`,converter:a.t})],f.prototype,`hasLogOut`,void 0),e.r([e.s({type:Object})],f.prototype,`user`,void 0),e.r([e.s({type:Array,attribute:`user-menu`})],f.prototype,`userMenu`,void 0),e.r([e.s({type:Object})],f.prototype,`representing`,void 0),e.r([e.s({type:Array,attribute:`user-menu-footer`})],f.prototype,`userMenuFooter`,void 0),e.r([e.s({type:Array,attribute:`user-options`})],f.prototype,`userOptions`,void 0);try{e.c(`pkt-header`)(f)}catch{console.warn(`Forsøker å definere <pkt-header>, men den er allerede definert`)}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});