@oslokommune/punkt-elements 16.16.1 → 16.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/{accordion-nNH87Y60.js → accordion-CU2tJ5vn.js} +23 -9
- package/dist/{accordion-BB1JrONI.cjs → accordion-DDZkjXFb.cjs} +20 -7
- package/dist/{checkbox-nTbihMxW.cjs → checkbox-BerAYcfK.cjs} +1 -1
- package/dist/{checkbox-Bjp43NxA.js → checkbox-CF5mSBR5.js} +1 -1
- package/dist/{combobox-C4Q6kQEs.cjs → combobox-DYttdLJ4.cjs} +1 -1
- package/dist/{combobox-CL9BLuxt.js → combobox-DjvRMKOD.js} +3 -3
- package/dist/components/header-menu/header-menu.d.ts +41 -0
- package/dist/components/header-menu/header-menu.test.d.ts +0 -0
- package/dist/components/header-menu/index.d.ts +5 -0
- package/dist/components/header-menu/types.d.ts +6 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/searchinput/index.d.ts +4 -0
- package/dist/components/searchinput/searchinput.d.ts +27 -0
- package/dist/components/searchinput/searchinput.test.d.ts +0 -0
- package/dist/{datepicker-DYd3JCs_.cjs → datepicker-D3QQbd_H.cjs} +1 -1
- package/dist/{datepicker-BUK1Qanw.js → datepicker-M_jcY3wp.js} +2 -2
- package/dist/docs/components/header-full.d.ts +13 -0
- package/dist/docs/components/header-menu.d.ts +8 -0
- package/dist/docs/components/searchinput.d.ts +14 -0
- package/dist/{fileupload-DjUAvBcP.cjs → fileupload-BD_0oMrW.cjs} +1 -1
- package/dist/{fileupload-DbmqRkz3.js → fileupload-F9UMO7eS.js} +3 -3
- package/dist/focus-modality-controller-BSZAQk8y.cjs +1 -0
- package/dist/focus-modality-controller-pzSZkDkH.js +29 -0
- package/dist/{header-Dps8o-ZY.cjs → header-DZranHLm.cjs} +2 -2
- package/dist/{header-T5O6sfCN.js → header-j0SSHF4C.js} +4 -3
- package/dist/header-menu-CPI1_5oZ.cjs +126 -0
- package/dist/header-menu-zhGYdnvz.js +319 -0
- package/dist/header-menu.d.ts +1 -0
- package/dist/{helptext-C5rG4VkA.js → helptext-BdqoW19r.js} +1 -1
- package/dist/{helptext-DQgStO4D.cjs → helptext-KWXjKljV.cjs} +1 -1
- package/dist/{input-element-CjebcQd1.js → input-element-B1ciW1N2.js} +1 -1
- package/dist/{input-element-FGcr5hGd.cjs → input-element-D0egtEnr.cjs} +1 -1
- package/dist/{input-wrapper-B_XFi211.cjs → input-wrapper-DOIWggEv.cjs} +1 -1
- package/dist/{input-wrapper-DBpMVSxt.js → input-wrapper-DVU68NcJ.js} +5 -29
- package/dist/{modal-B6591sWa.cjs → modal-C_LxgxzC.cjs} +1 -1
- package/dist/{modal-DyIC3uhs.js → modal-Ca7dETTw.js} +1 -1
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.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-header-menu.cjs +1 -0
- package/dist/pkt-header-menu.js +2 -0
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +24 -22
- 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-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-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 -0
- package/dist/pkt-searchinput.js +2 -0
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/{radiobutton-DvXr7tDk.cjs → radiobutton-B1Xg6XzP.cjs} +1 -1
- package/dist/{radiobutton-B-8-wWFf.js → radiobutton-BAn1V_mQ.js} +1 -1
- package/dist/searchinput-BVIaoetB.cjs +60 -0
- package/dist/searchinput-CIseS5tL.js +147 -0
- package/dist/searchinput.d.ts +1 -0
- package/dist/{select-D9B8Ighz.js → select-6XCVj1lP.js} +3 -3
- package/dist/{select-B75wzvyz.cjs → select-DO0xGhQQ.cjs} +1 -1
- package/dist/shared-types/header-menu.d.ts +108 -0
- package/dist/shared-types/index.d.ts +3 -0
- package/dist/shared-types/searchinput.d.ts +41 -0
- package/dist/shared-types/skin.d.ts +1 -1
- package/dist/shared-utils/header-menu/example-data.d.ts +11 -0
- package/dist/shared-utils/header-menu/fetch-header-footer-data.d.ts +12 -0
- package/dist/shared-utils/header-menu/icon-map.d.ts +34 -0
- package/dist/shared-utils/header-menu/index.d.ts +11 -0
- package/dist/shared-utils/header-menu/select-megamenu.d.ts +16 -0
- package/dist/tests/component-registry.d.ts +2 -0
- package/dist/{textarea-CjqprL6Y.cjs → textarea-CV6z3LDf.cjs} +1 -1
- package/dist/{textarea-CIWXMaAD.js → textarea-DBSNSvrX.js} +2 -2
- package/dist/{textinput-CxzAxM8E.js → textinput-BZZnFDk3.js} +2 -2
- package/dist/{textinput-B0VWmVIF.cjs → textinput-Dsc-8-BB.cjs} +1 -1
- package/dist/{timepicker-Cv9juQeB.cjs → timepicker-C2Ua6vHY.cjs} +1 -1
- package/dist/{timepicker-DXrpg5C7.js → timepicker-DDQ7CfOy.js} +2 -2
- package/package.json +2 -2
- package/src/components/accordion/accordionitem.ts +22 -5
- package/src/components/header/header-service.ts +1 -0
- package/src/components/header-menu/header-menu.test.ts +314 -0
- package/src/components/header-menu/header-menu.ts +401 -0
- package/src/components/header-menu/index.ts +6 -0
- package/src/components/header-menu/types.ts +31 -0
- package/src/components/index.ts +10 -0
- package/src/components/searchinput/index.ts +10 -0
- package/src/components/searchinput/searchinput.test.ts +312 -0
- package/src/components/searchinput/searchinput.ts +213 -0
- /package/dist/{consent-zh2npq2K.cjs → consent-B5dIDyLD.cjs} +0 -0
- /package/dist/{consent-f_IGyHss.js → consent-DSHrt9eS.js} +0 -0
- /package/dist/{dialog-polyfill.esm-BmVHGRTX.js → dialog-polyfill.esm-B7W3teD0.js} +0 -0
- /package/dist/{dialog-polyfill.esm-CXDsb3l-.cjs → dialog-polyfill.esm-BnAQvMQO.cjs} +0 -0
- /package/dist/{input-wrapper-CYCCx8MP.cjs → input-wrapper-CQGoyLdZ.cjs} +0 -0
- /package/dist/{input-wrapper-kw2y6Jp_.js → input-wrapper-DwSsP39J.js} +0 -0
- /package/dist/{link-B8zYc5WK.cjs → link-DMKjKawh.cjs} +0 -0
- /package/dist/{link-CjJcwcxR.js → link-F51Ho7CV.js} +0 -0
- /package/dist/{linkcard-C4x-NJMi.cjs → linkcard-CBmJbSoV.cjs} +0 -0
- /package/dist/{linkcard-Ddh5R_L-.js → linkcard-E07qJZMP.js} +0 -0
- /package/dist/{loader-CGQXAuyM.cjs → loader-q_eO6zaE.cjs} +0 -0
- /package/dist/{loader-DeizpX45.js → loader-teN65oWo.js} +0 -0
- /package/dist/{messagebox-DqoPqo4K.js → messagebox-Ct9lfe0Z.js} +0 -0
- /package/dist/{messagebox-Ccu29rDv.cjs → messagebox-D1QeQqb8.cjs} +0 -0
- /package/dist/{pkt-options-controller-DbLrdRwH.js → pkt-options-controller-CCB15L_G.js} +0 -0
- /package/dist/{pkt-options-controller-BPBb_O2K.cjs → pkt-options-controller-CeAQ-D-i.cjs} +0 -0
- /package/dist/{progressbar-CrwpnIkv.cjs → progressbar-Ca7pRjmt.cjs} +0 -0
- /package/dist/{progressbar-uC-0W6o4.js → progressbar-o-M17HPA.js} +0 -0
- /package/dist/{tabs-RnDtIFv3.cjs → tabs-CN_RIMWg.cjs} +0 -0
- /package/dist/{tabs-4eWA7CsK.js → tabs-ClI1XQDt.js} +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/controllers/focus-modality-controller.ts
|
|
2
|
+
var e = class {
|
|
3
|
+
constructor(e, t = null) {
|
|
4
|
+
this.pointerJustUsed = !1, this.handlePointerDown = () => {
|
|
5
|
+
this.pointerJustUsed = !0, this.pointerTimeoutId !== void 0 && clearTimeout(this.pointerTimeoutId), this.pointerTimeoutId = window.setTimeout(() => {
|
|
6
|
+
this.pointerJustUsed = !1, this.pointerTimeoutId = void 0;
|
|
7
|
+
}, 0);
|
|
8
|
+
}, this.handleFocusIn = () => {
|
|
9
|
+
this.setNavtype(this.pointerJustUsed ? "pointer" : void 0);
|
|
10
|
+
}, this.handleFocusOut = (e) => {
|
|
11
|
+
this.host.contains(e.relatedTarget) || this.setNavtype(void 0);
|
|
12
|
+
}, this.host = e, this.targetSelector = t, e.addController(this);
|
|
13
|
+
}
|
|
14
|
+
hostConnected() {
|
|
15
|
+
this.host.addEventListener("pointerdown", this.handlePointerDown, !0), this.host.addEventListener("focusin", this.handleFocusIn), this.host.addEventListener("focusout", this.handleFocusOut);
|
|
16
|
+
}
|
|
17
|
+
hostDisconnected() {
|
|
18
|
+
this.host.removeEventListener("pointerdown", this.handlePointerDown, !0), this.host.removeEventListener("focusin", this.handleFocusIn), this.host.removeEventListener("focusout", this.handleFocusOut), this.pointerTimeoutId !== void 0 && (clearTimeout(this.pointerTimeoutId), this.pointerTimeoutId = void 0);
|
|
19
|
+
}
|
|
20
|
+
getTarget() {
|
|
21
|
+
return this.targetSelector === null ? this.host : this.host.querySelector(this.targetSelector);
|
|
22
|
+
}
|
|
23
|
+
setNavtype(e) {
|
|
24
|
+
let t = this.getTarget();
|
|
25
|
+
t && (e === void 0 ? delete t.dataset.navtype : t.dataset.navtype = e);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { e as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
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-
|
|
1
|
+
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`
|
|
2
2
|
<pkt-link
|
|
3
3
|
icon-name=${n.iconName||e.l}
|
|
4
4
|
href=${n.href}
|
|
@@ -273,7 +273,7 @@ const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),
|
|
|
273
273
|
`}render(){let n=this.renderHeader();return this.isFixed?e.d`
|
|
274
274
|
<div class="pkt-header-service-wrapper">
|
|
275
275
|
${n}
|
|
276
|
-
<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})}></div>
|
|
276
|
+
<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>
|
|
277
277
|
</div>
|
|
278
278
|
`: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`
|
|
279
279
|
<pkt-header-service
|
|
@@ -6,8 +6,8 @@ import { t as u } from "./if-defined-Cjj8qN-Z.js";
|
|
|
6
6
|
import "./button-BIpd1xJh.js";
|
|
7
7
|
import { n as d, t as f } from "./ref-RS8Uv6uC.js";
|
|
8
8
|
import { t as p } from "./booleanish-CRaKZ75t.js";
|
|
9
|
-
import "./link-
|
|
10
|
-
import "./textinput-
|
|
9
|
+
import "./link-F51Ho7CV.js";
|
|
10
|
+
import "./textinput-BZZnFDk3.js";
|
|
11
11
|
//#region ../../shared-types/header.ts
|
|
12
12
|
var m = (e) => typeof e.target == "string" ? {
|
|
13
13
|
title: e.title,
|
|
@@ -588,7 +588,8 @@ var v = "https://punkt-cdn.oslo.kommune.no/latest/logos/", y = class extends l {
|
|
|
588
588
|
"pkt-header-service-spacer": !0,
|
|
589
589
|
"pkt-header-service-spacer--compact": this.compact,
|
|
590
590
|
"pkt-header-service-spacer--has-user": !!this.user,
|
|
591
|
-
"pkt-header-service-spacer--mobile": this.isMobile
|
|
591
|
+
"pkt-header-service-spacer--mobile": this.isMobile,
|
|
592
|
+
"pkt-header-service-spacer--tablet": this.isTablet
|
|
592
593
|
})}></div>
|
|
593
594
|
</div>
|
|
594
595
|
` : e;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`);require(`./icon-Dr8sfT2X.cjs`),require(`./accordion-DDZkjXFb.cjs`);const n=require(`./booleanish-B5EFqFpJ.cjs`);var r=`https://cdn.web.oslo.kommune.no/header-footer/header-footer.json`,i={automat:`parking-meter`,bike:`bicycle`,corona:`virus`,directions:`arrow-directions`,document:`document-plain`,"download-document":`document-download`,elcar:`electric-car`,"error-hexa":`alert-error`,"fire-emblem":`shield-fire`,"link-arrow":`arrow-link`,"linked-in":`linkedin`,"map-layer":`map-layers`,mobile:`mobile-phone`,neutral:`smiley-neutral`,placeholder:`placeholder-icon`,sad:`smiley-sad`,signing:`signature`,sky:`cloud`,smile:`smiley-smile`,"success-square":`alert-success`,trash:`trash-can`,treatment:`processing`,"warning-triangle":`alert-warning`};function a(e){return e&&(i[e]??e)}var o={"facebook.com":`facebook`,"fb.com":`facebook`,"instagram.com":`instagram`,"linkedin.com":`linkedin`,"x.com":`x`,"github.com":`github`};function s(e){return e.toLowerCase().replace(/^(?:www|m)\./,``)}function c(e,t){if(e)try{let t=o[s(new URL(e).hostname)];if(t)return t}catch{}if(t){let e=t.trim().toLowerCase().replace(/\s+/g,`-`);if(e){let t=a(e);if(t)return t}}}var l=`nb-NO`;function u(e,t=l){if(e)return e[t]??e[l]}async function d(e=r,t){let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`pkt-header-menu: failed to fetch ${e} (HTTP ${n.status})`);let i=await n.json();if(!i||typeof i!=`object`)throw Error(`pkt-header-menu: ${e} returned a non-object payload`);return i}var f=class extends e.t{constructor(...e){super(...e),this.dataUrl=r,this.locale=`nb-NO`,this.open=!1,this.ariaLabelledBy=``,this.mobileBreakpoint=768,this.loadState=`idle`,this.isMobile=!1,this.handleMediaChange=e=>{this.isMobile=e.matches}}connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-header-menu`),this.updateOpenClass(),this.setupMediaQuery(),this.data?(this.loadState=`ready`,this.dispatchEvent(new CustomEvent(`data-loaded`,{detail:{data:this.data},bubbles:!0,composed:!0}))):this.loadData()}updateOpenClass(){this.classList.toggle(`pkt-header-menu--open`,!!this.open)}disconnectedCallback(){super.disconnectedCallback(),this.abortController?.abort(),this.teardownMediaQuery()}updated(e){super.updated(e),e.has(`open`)&&this.updateOpenClass(),e.has(`mobileBreakpoint`)&&e.get(`mobileBreakpoint`)!==void 0&&this.setupMediaQuery(),e.has(`dataUrl`)&&e.get(`dataUrl`)!==void 0&&!this.data&&this.loadData(),e.has(`data`)&&e.get(`data`)!==void 0&&this.data&&(this.loadState=`ready`,this.dispatchEvent(new CustomEvent(`data-loaded`,{detail:{data:this.data},bubbles:!0,composed:!0})))}setupMediaQuery(){this.teardownMediaQuery(),!(typeof window>`u`||typeof window.matchMedia!=`function`)&&(this.mediaQuery=window.matchMedia(`(max-width: ${this.mobileBreakpoint-1}px)`),this.isMobile=this.mediaQuery.matches,this.mediaQuery.addEventListener(`change`,this.handleMediaChange))}teardownMediaQuery(){this.mediaQuery?.removeEventListener(`change`,this.handleMediaChange),this.mediaQuery=void 0}async loadData(){this.abortController?.abort(),this.abortController=new AbortController,this.loadState=`loading`;try{let e=await d(this.dataUrl,this.abortController.signal);this.fetchedData=e,this.loadState=`ready`,this.dispatchEvent(new CustomEvent(`data-loaded`,{detail:{data:e},bubbles:!0,composed:!0}))}catch(e){if(e.name===`AbortError`)return;this.loadState=`error`,this.dispatchEvent(new CustomEvent(`data-error`,{detail:{error:e},bubbles:!0,composed:!0}))}}get effectiveData(){return this.data??this.fetchedData}get localeData(){return u(this.effectiveData,this.locale)}render(){if(this.loadState===`loading`)return e.d`
|
|
2
|
+
<nav aria-busy="true">
|
|
3
|
+
<p class="pkt-header-menu__loading">Laster meny…</p>
|
|
4
|
+
</nav>
|
|
5
|
+
`;if(this.loadState===`error`||!this.localeData)return e.d`
|
|
6
|
+
<nav aria-hidden=${!this.open}>
|
|
7
|
+
<p class="pkt-header-menu__error">Kunne ikke laste meny.</p>
|
|
8
|
+
</nav>
|
|
9
|
+
`;let{megamenu:t,i18n:n}=this.localeData,r=n?.navAriaLabel||`Hovedmeny`;return this.isMobile?e.d`
|
|
10
|
+
<nav aria-label=${r}>
|
|
11
|
+
${this.renderMobileAccordion(t.services,t.sections)}
|
|
12
|
+
${this.renderButtons(t.buttons,!0)}
|
|
13
|
+
${this.renderFooter(t.links,t.some)}
|
|
14
|
+
</nav>
|
|
15
|
+
`:e.d`
|
|
16
|
+
<nav aria-label=${r}>
|
|
17
|
+
${this.renderServices(t.services)} ${this.renderButtons(t.buttons,!1)}
|
|
18
|
+
${this.renderSections(t.sections)}
|
|
19
|
+
${this.renderFooter(t.links,t.some)}
|
|
20
|
+
</nav>
|
|
21
|
+
`}renderMobileAccordion(t,n){return e.d`
|
|
22
|
+
<div class="pkt-header-menu__sections">
|
|
23
|
+
<pkt-accordion
|
|
24
|
+
class="pkt-header-menu__sections-inner"
|
|
25
|
+
skin="plus-minus"
|
|
26
|
+
name="header-menu-accordion"
|
|
27
|
+
>
|
|
28
|
+
<pkt-accordion-item
|
|
29
|
+
class="pkt-header-menu__section"
|
|
30
|
+
skin="plus-minus"
|
|
31
|
+
id="pkt-header-menu-services"
|
|
32
|
+
title=${t.title}
|
|
33
|
+
>
|
|
34
|
+
${this.renderServicesList(t)}
|
|
35
|
+
</pkt-accordion-item>
|
|
36
|
+
${n.map((t,n)=>e.d`
|
|
37
|
+
<pkt-accordion-item
|
|
38
|
+
class="pkt-header-menu__section"
|
|
39
|
+
skin="plus-minus"
|
|
40
|
+
id=${`pkt-header-menu-section-${n}`}
|
|
41
|
+
title=${t.title}
|
|
42
|
+
>
|
|
43
|
+
${this.renderSectionList(t.links)}
|
|
44
|
+
</pkt-accordion-item>
|
|
45
|
+
`)}
|
|
46
|
+
</pkt-accordion>
|
|
47
|
+
</div>
|
|
48
|
+
`}renderServicesList(t){return e.d`
|
|
49
|
+
<ul class="pkt-header-menu__services-list">
|
|
50
|
+
${t.links.map(t=>e.d`
|
|
51
|
+
<li class="pkt-header-menu__service">
|
|
52
|
+
<a class="pkt-header-menu__service-link" href=${t.url}>
|
|
53
|
+
<pkt-icon
|
|
54
|
+
class="pkt-header-menu__service-icon"
|
|
55
|
+
name=${a(t.icon)}
|
|
56
|
+
aria-hidden="true"
|
|
57
|
+
></pkt-icon>
|
|
58
|
+
<span class="pkt-header-menu__service-text">${t.text}</span>
|
|
59
|
+
</a>
|
|
60
|
+
</li>
|
|
61
|
+
`)}
|
|
62
|
+
</ul>
|
|
63
|
+
`}renderServices(t){return e.d`
|
|
64
|
+
<div class="pkt-header-menu__services">
|
|
65
|
+
<h2 class="pkt-header-menu__services-title">${t.title}</h2>
|
|
66
|
+
${this.renderServicesList(t)}
|
|
67
|
+
</div>
|
|
68
|
+
`}renderButtons(n,r){return!n||n.length===0?e.l:e.d`
|
|
69
|
+
<div class=${t.t({"pkt-header-menu__buttons":!0,"pkt-header-menu__buttons--mobile":r})}>
|
|
70
|
+
${n.map(t=>e.d`
|
|
71
|
+
<a
|
|
72
|
+
class="pkt-btn pkt-btn--secondary pkt-btn--icon-right pkt-btn--small"
|
|
73
|
+
href=${t.url}
|
|
74
|
+
>
|
|
75
|
+
<pkt-icon
|
|
76
|
+
class="pkt-btn__icon"
|
|
77
|
+
name=${t.iconName?a(t.iconName):`user`}
|
|
78
|
+
aria-hidden="true"
|
|
79
|
+
></pkt-icon>
|
|
80
|
+
<span class="pkt-btn__text">${t.text}</span>
|
|
81
|
+
</a>
|
|
82
|
+
`)}
|
|
83
|
+
</div>
|
|
84
|
+
`}renderSections(t){return!t||t.length===0?e.l:e.d`
|
|
85
|
+
<div class="pkt-header-menu__sections">
|
|
86
|
+
<div class="pkt-header-menu__sections-inner">
|
|
87
|
+
${t.map(t=>e.d`
|
|
88
|
+
<div class="pkt-header-menu__section">
|
|
89
|
+
<h2 class="pkt-header-menu__section-title">${t.title}</h2>
|
|
90
|
+
${this.renderSectionList(t.links)}
|
|
91
|
+
</div>
|
|
92
|
+
`)}
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
`}renderSectionList(t){return e.d`
|
|
96
|
+
<ul class="pkt-header-menu__section-list">
|
|
97
|
+
${t.map(t=>e.d`
|
|
98
|
+
<li>
|
|
99
|
+
<a class="pkt-header-menu__section-link" href=${t.url}>${t.text}</a>
|
|
100
|
+
</li>
|
|
101
|
+
`)}
|
|
102
|
+
</ul>
|
|
103
|
+
`}renderFooter(t,n){return(!t||t.length===0)&&(!n||n.length===0)?e.l:e.d`
|
|
104
|
+
<div class="pkt-header-menu__footer">
|
|
105
|
+
${t&&t.length>0?e.d`
|
|
106
|
+
<ul class="pkt-header-menu__footer-list">
|
|
107
|
+
${t.map(t=>e.d`
|
|
108
|
+
<li>
|
|
109
|
+
<a class="pkt-header-menu__footer-link" href=${t.url}>${t.text}</a>
|
|
110
|
+
</li>
|
|
111
|
+
`)}
|
|
112
|
+
</ul>
|
|
113
|
+
`:e.l}
|
|
114
|
+
${n&&n.length>0?e.d`
|
|
115
|
+
<ul class="pkt-header-menu__footer-list pkt-header-menu__footer-list--social">
|
|
116
|
+
${n.map(e=>this.renderSocialLink(e))}
|
|
117
|
+
</ul>
|
|
118
|
+
`:e.l}
|
|
119
|
+
</div>
|
|
120
|
+
`}renderSocialLink(t){let n=c(t.url,t.text);return e.d`
|
|
121
|
+
<li>
|
|
122
|
+
<a class="pkt-header-menu__social-link" href=${t.url} aria-label=${t.text}>
|
|
123
|
+
${n?e.d`<pkt-icon name=${n} aria-hidden="true"></pkt-icon>`:e.d`<span>${t.text}</span>`}
|
|
124
|
+
</a>
|
|
125
|
+
</li>
|
|
126
|
+
`}};e.r([e.s({type:String,attribute:`data-url`})],f.prototype,`dataUrl`,void 0),e.r([e.s({type:Object,attribute:!1})],f.prototype,`data`,void 0),e.r([e.s({type:String})],f.prototype,`locale`,void 0),e.r([e.s({type:Boolean,reflect:!0,converter:n.t})],f.prototype,`open`,void 0),e.r([e.s({type:String,attribute:`aria-labelledby`,reflect:!0})],f.prototype,`ariaLabelledBy`,void 0),e.r([e.s({type:Number,attribute:`mobile-breakpoint`})],f.prototype,`mobileBreakpoint`,void 0),e.r([e.o()],f.prototype,`loadState`,void 0),e.r([e.o()],f.prototype,`fetchedData`,void 0),e.r([e.o()],f.prototype,`isMobile`,void 0);try{e.c(`pkt-header-menu`)(f)}catch{console.warn(`Forsøker å definere <pkt-header-menu>, men den er allerede definert`)}var p=f;Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return p}});
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { c as e, d as t, l as n, o as r, r as i, s as a, t as o } from "./element-cZ85T_aa.js";
|
|
2
|
+
import { t as s } from "./class-map-C8HuhNzZ.js";
|
|
3
|
+
import "./icon-Co72KtgF.js";
|
|
4
|
+
import "./accordion-CU2tJ5vn.js";
|
|
5
|
+
import { t as c } from "./booleanish-CRaKZ75t.js";
|
|
6
|
+
//#region ../../shared-types/header-menu.ts
|
|
7
|
+
var l = "https://cdn.web.oslo.kommune.no/header-footer/header-footer.json", u = {
|
|
8
|
+
automat: "parking-meter",
|
|
9
|
+
bike: "bicycle",
|
|
10
|
+
corona: "virus",
|
|
11
|
+
directions: "arrow-directions",
|
|
12
|
+
document: "document-plain",
|
|
13
|
+
"download-document": "document-download",
|
|
14
|
+
elcar: "electric-car",
|
|
15
|
+
"error-hexa": "alert-error",
|
|
16
|
+
"fire-emblem": "shield-fire",
|
|
17
|
+
"link-arrow": "arrow-link",
|
|
18
|
+
"linked-in": "linkedin",
|
|
19
|
+
"map-layer": "map-layers",
|
|
20
|
+
mobile: "mobile-phone",
|
|
21
|
+
neutral: "smiley-neutral",
|
|
22
|
+
placeholder: "placeholder-icon",
|
|
23
|
+
sad: "smiley-sad",
|
|
24
|
+
signing: "signature",
|
|
25
|
+
sky: "cloud",
|
|
26
|
+
smile: "smiley-smile",
|
|
27
|
+
"success-square": "alert-success",
|
|
28
|
+
trash: "trash-can",
|
|
29
|
+
treatment: "processing",
|
|
30
|
+
"warning-triangle": "alert-warning"
|
|
31
|
+
};
|
|
32
|
+
function d(e) {
|
|
33
|
+
return e && (u[e] ?? e);
|
|
34
|
+
}
|
|
35
|
+
var f = {
|
|
36
|
+
"facebook.com": "facebook",
|
|
37
|
+
"fb.com": "facebook",
|
|
38
|
+
"instagram.com": "instagram",
|
|
39
|
+
"linkedin.com": "linkedin",
|
|
40
|
+
"x.com": "x",
|
|
41
|
+
"github.com": "github"
|
|
42
|
+
};
|
|
43
|
+
function p(e) {
|
|
44
|
+
return e.toLowerCase().replace(/^(?:www|m)\./, "");
|
|
45
|
+
}
|
|
46
|
+
function m(e, t) {
|
|
47
|
+
if (e) try {
|
|
48
|
+
let t = f[p(new URL(e).hostname)];
|
|
49
|
+
if (t) return t;
|
|
50
|
+
} catch {}
|
|
51
|
+
if (t) {
|
|
52
|
+
let e = t.trim().toLowerCase().replace(/\s+/g, "-");
|
|
53
|
+
if (e) {
|
|
54
|
+
let t = d(e);
|
|
55
|
+
if (t) return t;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region ../../shared-utils/header-menu/select-megamenu.ts
|
|
61
|
+
var h = "nb-NO";
|
|
62
|
+
function g(e, t = h) {
|
|
63
|
+
if (e) return e[t] ?? e[h];
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region ../../shared-utils/header-menu/fetch-header-footer-data.ts
|
|
67
|
+
async function _(e = l, t) {
|
|
68
|
+
let n = await fetch(e, { signal: t });
|
|
69
|
+
if (!n.ok) throw Error(`pkt-header-menu: failed to fetch ${e} (HTTP ${n.status})`);
|
|
70
|
+
let r = await n.json();
|
|
71
|
+
if (!r || typeof r != "object") throw Error(`pkt-header-menu: ${e} returned a non-object payload`);
|
|
72
|
+
return r;
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/components/header-menu/header-menu.ts
|
|
76
|
+
var v = class extends o {
|
|
77
|
+
constructor(...e) {
|
|
78
|
+
super(...e), this.dataUrl = l, this.locale = "nb-NO", this.open = !1, this.ariaLabelledBy = "", this.mobileBreakpoint = 768, this.loadState = "idle", this.isMobile = !1, this.handleMediaChange = (e) => {
|
|
79
|
+
this.isMobile = e.matches;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
connectedCallback() {
|
|
83
|
+
super.connectedCallback(), this.classList.add("pkt-header-menu"), this.updateOpenClass(), this.setupMediaQuery(), this.data ? (this.loadState = "ready", this.dispatchEvent(new CustomEvent("data-loaded", {
|
|
84
|
+
detail: { data: this.data },
|
|
85
|
+
bubbles: !0,
|
|
86
|
+
composed: !0
|
|
87
|
+
}))) : this.loadData();
|
|
88
|
+
}
|
|
89
|
+
updateOpenClass() {
|
|
90
|
+
this.classList.toggle("pkt-header-menu--open", !!this.open);
|
|
91
|
+
}
|
|
92
|
+
disconnectedCallback() {
|
|
93
|
+
super.disconnectedCallback(), this.abortController?.abort(), this.teardownMediaQuery();
|
|
94
|
+
}
|
|
95
|
+
updated(e) {
|
|
96
|
+
super.updated(e), e.has("open") && this.updateOpenClass(), e.has("mobileBreakpoint") && e.get("mobileBreakpoint") !== void 0 && this.setupMediaQuery(), e.has("dataUrl") && e.get("dataUrl") !== void 0 && !this.data && this.loadData(), e.has("data") && e.get("data") !== void 0 && this.data && (this.loadState = "ready", this.dispatchEvent(new CustomEvent("data-loaded", {
|
|
97
|
+
detail: { data: this.data },
|
|
98
|
+
bubbles: !0,
|
|
99
|
+
composed: !0
|
|
100
|
+
})));
|
|
101
|
+
}
|
|
102
|
+
setupMediaQuery() {
|
|
103
|
+
this.teardownMediaQuery(), !(typeof window > "u" || typeof window.matchMedia != "function") && (this.mediaQuery = window.matchMedia(`(max-width: ${this.mobileBreakpoint - 1}px)`), this.isMobile = this.mediaQuery.matches, this.mediaQuery.addEventListener("change", this.handleMediaChange));
|
|
104
|
+
}
|
|
105
|
+
teardownMediaQuery() {
|
|
106
|
+
this.mediaQuery?.removeEventListener("change", this.handleMediaChange), this.mediaQuery = void 0;
|
|
107
|
+
}
|
|
108
|
+
async loadData() {
|
|
109
|
+
this.abortController?.abort(), this.abortController = new AbortController(), this.loadState = "loading";
|
|
110
|
+
try {
|
|
111
|
+
let e = await _(this.dataUrl, this.abortController.signal);
|
|
112
|
+
this.fetchedData = e, this.loadState = "ready", this.dispatchEvent(new CustomEvent("data-loaded", {
|
|
113
|
+
detail: { data: e },
|
|
114
|
+
bubbles: !0,
|
|
115
|
+
composed: !0
|
|
116
|
+
}));
|
|
117
|
+
} catch (e) {
|
|
118
|
+
if (e.name === "AbortError") return;
|
|
119
|
+
this.loadState = "error", this.dispatchEvent(new CustomEvent("data-error", {
|
|
120
|
+
detail: { error: e },
|
|
121
|
+
bubbles: !0,
|
|
122
|
+
composed: !0
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
get effectiveData() {
|
|
127
|
+
return this.data ?? this.fetchedData;
|
|
128
|
+
}
|
|
129
|
+
get localeData() {
|
|
130
|
+
return g(this.effectiveData, this.locale);
|
|
131
|
+
}
|
|
132
|
+
render() {
|
|
133
|
+
if (this.loadState === "loading") return t`
|
|
134
|
+
<nav aria-busy="true">
|
|
135
|
+
<p class="pkt-header-menu__loading">Laster meny…</p>
|
|
136
|
+
</nav>
|
|
137
|
+
`;
|
|
138
|
+
if (this.loadState === "error" || !this.localeData) return t`
|
|
139
|
+
<nav aria-hidden=${!this.open}>
|
|
140
|
+
<p class="pkt-header-menu__error">Kunne ikke laste meny.</p>
|
|
141
|
+
</nav>
|
|
142
|
+
`;
|
|
143
|
+
let { megamenu: e, i18n: n } = this.localeData, r = n?.navAriaLabel || "Hovedmeny";
|
|
144
|
+
return this.isMobile ? t`
|
|
145
|
+
<nav aria-label=${r}>
|
|
146
|
+
${this.renderMobileAccordion(e.services, e.sections)}
|
|
147
|
+
${this.renderButtons(e.buttons, !0)}
|
|
148
|
+
${this.renderFooter(e.links, e.some)}
|
|
149
|
+
</nav>
|
|
150
|
+
` : t`
|
|
151
|
+
<nav aria-label=${r}>
|
|
152
|
+
${this.renderServices(e.services)} ${this.renderButtons(e.buttons, !1)}
|
|
153
|
+
${this.renderSections(e.sections)}
|
|
154
|
+
${this.renderFooter(e.links, e.some)}
|
|
155
|
+
</nav>
|
|
156
|
+
`;
|
|
157
|
+
}
|
|
158
|
+
renderMobileAccordion(e, n) {
|
|
159
|
+
return t`
|
|
160
|
+
<div class="pkt-header-menu__sections">
|
|
161
|
+
<pkt-accordion
|
|
162
|
+
class="pkt-header-menu__sections-inner"
|
|
163
|
+
skin="plus-minus"
|
|
164
|
+
name="header-menu-accordion"
|
|
165
|
+
>
|
|
166
|
+
<pkt-accordion-item
|
|
167
|
+
class="pkt-header-menu__section"
|
|
168
|
+
skin="plus-minus"
|
|
169
|
+
id="pkt-header-menu-services"
|
|
170
|
+
title=${e.title}
|
|
171
|
+
>
|
|
172
|
+
${this.renderServicesList(e)}
|
|
173
|
+
</pkt-accordion-item>
|
|
174
|
+
${n.map((e, n) => t`
|
|
175
|
+
<pkt-accordion-item
|
|
176
|
+
class="pkt-header-menu__section"
|
|
177
|
+
skin="plus-minus"
|
|
178
|
+
id=${`pkt-header-menu-section-${n}`}
|
|
179
|
+
title=${e.title}
|
|
180
|
+
>
|
|
181
|
+
${this.renderSectionList(e.links)}
|
|
182
|
+
</pkt-accordion-item>
|
|
183
|
+
`)}
|
|
184
|
+
</pkt-accordion>
|
|
185
|
+
</div>
|
|
186
|
+
`;
|
|
187
|
+
}
|
|
188
|
+
renderServicesList(e) {
|
|
189
|
+
return t`
|
|
190
|
+
<ul class="pkt-header-menu__services-list">
|
|
191
|
+
${e.links.map((e) => t`
|
|
192
|
+
<li class="pkt-header-menu__service">
|
|
193
|
+
<a class="pkt-header-menu__service-link" href=${e.url}>
|
|
194
|
+
<pkt-icon
|
|
195
|
+
class="pkt-header-menu__service-icon"
|
|
196
|
+
name=${d(e.icon)}
|
|
197
|
+
aria-hidden="true"
|
|
198
|
+
></pkt-icon>
|
|
199
|
+
<span class="pkt-header-menu__service-text">${e.text}</span>
|
|
200
|
+
</a>
|
|
201
|
+
</li>
|
|
202
|
+
`)}
|
|
203
|
+
</ul>
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
renderServices(e) {
|
|
207
|
+
return t`
|
|
208
|
+
<div class="pkt-header-menu__services">
|
|
209
|
+
<h2 class="pkt-header-menu__services-title">${e.title}</h2>
|
|
210
|
+
${this.renderServicesList(e)}
|
|
211
|
+
</div>
|
|
212
|
+
`;
|
|
213
|
+
}
|
|
214
|
+
renderButtons(e, r) {
|
|
215
|
+
return !e || e.length === 0 ? n : t`
|
|
216
|
+
<div class=${s({
|
|
217
|
+
"pkt-header-menu__buttons": !0,
|
|
218
|
+
"pkt-header-menu__buttons--mobile": r
|
|
219
|
+
})}>
|
|
220
|
+
${e.map((e) => t`
|
|
221
|
+
<a
|
|
222
|
+
class="pkt-btn pkt-btn--secondary pkt-btn--icon-right pkt-btn--small"
|
|
223
|
+
href=${e.url}
|
|
224
|
+
>
|
|
225
|
+
<pkt-icon
|
|
226
|
+
class="pkt-btn__icon"
|
|
227
|
+
name=${e.iconName ? d(e.iconName) : "user"}
|
|
228
|
+
aria-hidden="true"
|
|
229
|
+
></pkt-icon>
|
|
230
|
+
<span class="pkt-btn__text">${e.text}</span>
|
|
231
|
+
</a>
|
|
232
|
+
`)}
|
|
233
|
+
</div>
|
|
234
|
+
`;
|
|
235
|
+
}
|
|
236
|
+
renderSections(e) {
|
|
237
|
+
return !e || e.length === 0 ? n : t`
|
|
238
|
+
<div class="pkt-header-menu__sections">
|
|
239
|
+
<div class="pkt-header-menu__sections-inner">
|
|
240
|
+
${e.map((e) => t`
|
|
241
|
+
<div class="pkt-header-menu__section">
|
|
242
|
+
<h2 class="pkt-header-menu__section-title">${e.title}</h2>
|
|
243
|
+
${this.renderSectionList(e.links)}
|
|
244
|
+
</div>
|
|
245
|
+
`)}
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
`;
|
|
249
|
+
}
|
|
250
|
+
renderSectionList(e) {
|
|
251
|
+
return t`
|
|
252
|
+
<ul class="pkt-header-menu__section-list">
|
|
253
|
+
${e.map((e) => t`
|
|
254
|
+
<li>
|
|
255
|
+
<a class="pkt-header-menu__section-link" href=${e.url}>${e.text}</a>
|
|
256
|
+
</li>
|
|
257
|
+
`)}
|
|
258
|
+
</ul>
|
|
259
|
+
`;
|
|
260
|
+
}
|
|
261
|
+
renderFooter(e, r) {
|
|
262
|
+
return (!e || e.length === 0) && (!r || r.length === 0) ? n : t`
|
|
263
|
+
<div class="pkt-header-menu__footer">
|
|
264
|
+
${e && e.length > 0 ? t`
|
|
265
|
+
<ul class="pkt-header-menu__footer-list">
|
|
266
|
+
${e.map((e) => t`
|
|
267
|
+
<li>
|
|
268
|
+
<a class="pkt-header-menu__footer-link" href=${e.url}>${e.text}</a>
|
|
269
|
+
</li>
|
|
270
|
+
`)}
|
|
271
|
+
</ul>
|
|
272
|
+
` : n}
|
|
273
|
+
${r && r.length > 0 ? t`
|
|
274
|
+
<ul class="pkt-header-menu__footer-list pkt-header-menu__footer-list--social">
|
|
275
|
+
${r.map((e) => this.renderSocialLink(e))}
|
|
276
|
+
</ul>
|
|
277
|
+
` : n}
|
|
278
|
+
</div>
|
|
279
|
+
`;
|
|
280
|
+
}
|
|
281
|
+
renderSocialLink(e) {
|
|
282
|
+
let n = m(e.url, e.text);
|
|
283
|
+
return t`
|
|
284
|
+
<li>
|
|
285
|
+
<a class="pkt-header-menu__social-link" href=${e.url} aria-label=${e.text}>
|
|
286
|
+
${n ? t`<pkt-icon name=${n} aria-hidden="true"></pkt-icon>` : t`<span>${e.text}</span>`}
|
|
287
|
+
</a>
|
|
288
|
+
</li>
|
|
289
|
+
`;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
i([a({
|
|
293
|
+
type: String,
|
|
294
|
+
attribute: "data-url"
|
|
295
|
+
})], v.prototype, "dataUrl", void 0), i([a({
|
|
296
|
+
type: Object,
|
|
297
|
+
attribute: !1
|
|
298
|
+
})], v.prototype, "data", void 0), i([a({ type: String })], v.prototype, "locale", void 0), i([a({
|
|
299
|
+
type: Boolean,
|
|
300
|
+
reflect: !0,
|
|
301
|
+
converter: c
|
|
302
|
+
})], v.prototype, "open", void 0), i([a({
|
|
303
|
+
type: String,
|
|
304
|
+
attribute: "aria-labelledby",
|
|
305
|
+
reflect: !0
|
|
306
|
+
})], v.prototype, "ariaLabelledBy", void 0), i([a({
|
|
307
|
+
type: Number,
|
|
308
|
+
attribute: "mobile-breakpoint"
|
|
309
|
+
})], v.prototype, "mobileBreakpoint", void 0), i([r()], v.prototype, "loadState", void 0), i([r()], v.prototype, "fetchedData", void 0), i([r()], v.prototype, "isMobile", void 0);
|
|
310
|
+
try {
|
|
311
|
+
e("pkt-header-menu")(v);
|
|
312
|
+
} catch {
|
|
313
|
+
console.warn("Forsøker å definere <pkt-header-menu>, men den er allerede definert");
|
|
314
|
+
}
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/components/header-menu/index.ts
|
|
317
|
+
var y = v;
|
|
318
|
+
//#endregion
|
|
319
|
+
export { v as n, y as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -3,7 +3,7 @@ import { t as o } from "./class-map-C8HuhNzZ.js";
|
|
|
3
3
|
import { n as s, t as c } from "./element-with-slot-4J2o3SeU.js";
|
|
4
4
|
import { r as l } from "./icon-Co72KtgF.js";
|
|
5
5
|
import { n as u } from "./utils-BOOZ0ppt.js";
|
|
6
|
-
import { t as d } from "./input-wrapper-
|
|
6
|
+
import { t as d } from "./input-wrapper-DwSsP39J.js";
|
|
7
7
|
//#region src/components/helptext/helptext.ts
|
|
8
8
|
var f = class extends c {
|
|
9
9
|
constructor(...e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),n=require(`./element-with-slot-CWoTGA1B.cjs`),r=require(`./icon-Dr8sfT2X.cjs`),i=require(`./utils-CM67Oudc.cjs`),a=require(`./input-wrapper-
|
|
1
|
+
const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),n=require(`./element-with-slot-CWoTGA1B.cjs`),r=require(`./icon-Dr8sfT2X.cjs`),i=require(`./utils-CM67Oudc.cjs`),a=require(`./input-wrapper-CQGoyLdZ.cjs`);var o=class extends n.t{constructor(...e){super(...e),this.forId=i.n(),this.helptext=``,this.helptextDropdown=``,this.helptextDropdownButton=a.t.props.helptextDropdownButton.default,this.isHelpTextOpen=!1}render(){let i=()=>{let e=!this.isHelpTextOpen;this.isHelpTextOpen=e,this.dispatchEvent(new CustomEvent(`toggleHelpText`,{bubbles:!0,detail:{isOpen:e}}))},a=t.t({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.hasSlotContent()});return e.d`${e.d`<div class="${a}">
|
|
2
2
|
<div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
|
|
3
3
|
<div class="pkt-contents" name="helptext">${n.n(this)}</div>
|
|
4
4
|
${this.helptext&&r.r(this.helptext)}
|
|
@@ -2,7 +2,7 @@ import { i as e, r as t, s as n } from "./element-cZ85T_aa.js";
|
|
|
2
2
|
import { t as r } from "./element-with-slot-4J2o3SeU.js";
|
|
3
3
|
import { n as i } from "./utils-BOOZ0ppt.js";
|
|
4
4
|
import { t as a } from "./booleanish-CRaKZ75t.js";
|
|
5
|
-
import { t as o } from "./input-wrapper-
|
|
5
|
+
import { t as o } from "./input-wrapper-DwSsP39J.js";
|
|
6
6
|
//#region ../../node_modules/element-internals-polyfill/dist/index.js
|
|
7
7
|
(function(e) {
|
|
8
8
|
let t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), g = {
|