@oslokommune/punkt-elements 16.26.7 → 17.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +110 -0
- package/dist/accordion-CbXDxOho.cjs +47 -0
- package/dist/{accordion-CBdIk9gw.js → accordion-DEUHQ4JD.js} +45 -35
- package/dist/{alert-HHTGY0sp.js → alert-CbtVGrHD.js} +31 -17
- package/dist/{alert-B8dLsiTz.cjs → alert-CkUnbPdA.cjs} +5 -5
- package/dist/base-elements/input-element.d.ts +1 -0
- package/dist/button-Cod17rKo.js +115 -0
- package/dist/{button-B5tQpKeG.cjs → button-gvDXtBMC.cjs} +5 -2
- package/dist/{calendar-DIzGBdbh.cjs → calendar-BVXW8DqC.cjs} +1 -1
- package/dist/{calendar-CjlUA-Lb.js → calendar-CjC4qlh6.js} +1 -1
- package/dist/{checkbox-Bt_sC_90.cjs → checkbox-8uxbeU30.cjs} +1 -1
- package/dist/{checkbox-D03BC2Va.js → checkbox-DJDphhqz.js} +1 -1
- package/dist/{combobox-CoQBTWqL.js → combobox-Du5yr-xM.js} +16 -2
- package/dist/combobox-hKrbYLUe.cjs +136 -0
- package/dist/components/accordion/accordion-context.d.ts +7 -0
- package/dist/components/accordion/accordion.d.ts +2 -0
- package/dist/components/accordion/accordionitem.d.ts +1 -0
- package/dist/components/alert/alert.d.ts +5 -0
- package/dist/components/alert/alert.test.d.ts +1 -0
- package/dist/components/button/button.d.ts +4 -1
- package/dist/components/datepicker/datepicker-base.d.ts +2 -0
- package/dist/components/datepicker/datepicker-utils.d.ts +2 -2
- package/dist/components/footer/footer-base.d.ts +44 -0
- package/dist/components/footer/footer-simple.d.ts +20 -0
- package/dist/components/footer/footer.accessibility.test.d.ts +0 -0
- package/dist/components/footer/footer.d.ts +22 -0
- package/dist/components/footer/footer.test.d.ts +0 -0
- package/dist/components/footer/index.d.ts +3 -0
- package/dist/components/footer/types.d.ts +16 -0
- package/dist/components/header/header-chrome-controller.d.ts +44 -0
- package/dist/components/header/header-global.accessibility.test.d.ts +0 -0
- package/dist/components/header/header-global.d.ts +78 -0
- package/dist/components/header/header-global.test.d.ts +0 -0
- package/dist/components/header/header-service.accessibility.test.d.ts +0 -0
- package/dist/components/header/header-service.d.ts +6 -21
- package/dist/components/header/header-service.test.d.ts +1 -1
- package/dist/components/header/header.d.ts +11 -3
- package/dist/components/header/header.test.d.ts +0 -0
- package/dist/components/header/index.d.ts +2 -1
- package/dist/components/header/types.d.ts +28 -2
- package/dist/components/header-menu/header-menu.d.ts +4 -5
- package/dist/components/header-menu/types.d.ts +1 -1
- package/dist/components/index.d.ts +5 -3
- package/dist/components/input-wrapper/input-wrapper.d.ts +2 -0
- package/dist/components/input-wrapper/input-wrapper.test.d.ts +1 -0
- package/dist/components/searchinput/searchinput.d.ts +5 -0
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.test.d.ts +1 -0
- package/dist/components/textarea/textarea.test.d.ts +2 -0
- package/dist/components/textinput/textinput.test.d.ts +1 -0
- package/dist/components/timepicker/timepicker.d.ts +2 -0
- package/dist/components/timepicker/timepicker.test.d.ts +3 -0
- package/dist/consent--Nw43WFU.cjs +18 -0
- package/dist/{consent-D5sY6JK3.js → consent-B2hSTCGC.js} +14 -7
- package/dist/consume-BiOhrhEy.js +167 -0
- package/dist/consume-DKf5SmP9.cjs +1 -0
- package/dist/{converters-BKGBRBpS.js → converters-BBfsEJV5.js} +25 -25
- package/dist/{converters-9jHlXDyy.cjs → converters-Cd0fPEly.cjs} +1 -1
- package/dist/{datepicker-BE5Ll0W4.js → datepicker--Fq8q-J3.js} +30 -12
- package/dist/{datepicker-x4xM3KQz.cjs → datepicker-CEoBYTBU.cjs} +11 -7
- package/dist/docs/components/alert.d.ts +3 -0
- package/dist/docs/components/footer.d.ts +9 -0
- package/dist/docs/components/form-sizes.d.ts +10 -0
- package/dist/docs/components/header-global-full.d.ts +20 -0
- package/dist/docs/components/header-global.d.ts +14 -0
- package/dist/docs/components/searchinput.d.ts +6 -3
- package/dist/fetch-header-footer-data-Pc32etrk.js +88 -0
- package/dist/fetch-header-footer-data-xohWFmYC.cjs +1 -0
- package/dist/fileupload-CGKUJrlj.cjs +401 -0
- package/dist/{fileupload-2hf8YNhO.js → fileupload-D4gQN64T.js} +156 -176
- package/dist/focus-trap-DG3pEuyJ.js +60 -0
- package/dist/focus-trap-DSv4Ifqm.cjs +1 -0
- package/dist/footer-BIrJeRuZ.js +303 -0
- package/dist/footer-Ber-jqM1.cjs +114 -0
- package/dist/footer.d.ts +1 -0
- package/dist/header-BFk1an4z.cjs +465 -0
- package/dist/header-Deg_LGJo.js +1287 -0
- package/dist/header-menu-BHqK4QA6.cjs +126 -0
- package/dist/{header-menu-C8b5vd3n.js → header-menu-GFtJKM4j.js} +25 -97
- package/dist/{helptext-OfqH5npD.js → helptext-C_brWCIT.js} +1 -1
- package/dist/{helptext-eckq4JEX.cjs → helptext-Cq5rNaAC.cjs} +1 -1
- package/dist/{input-element-ZGOWsvKM.cjs → input-element-B0qLbEdF.cjs} +1 -1
- package/dist/{input-element-BFHpeoV8.js → input-element-C0RnXi-J.js} +5 -2
- package/dist/{input-wrapper-DwwE0JcO.js → input-wrapper-BweP6t3O.js} +12 -0
- package/dist/{input-wrapper-BRjQB4zM.cjs → input-wrapper-DPkkiG7S.cjs} +13 -11
- package/dist/{input-wrapper-DaA98B5l.js → input-wrapper-fWV5P4MN.js} +22 -15
- package/dist/{input-wrapper-LcZjpt0L.cjs → input-wrapper-wh3fWIhk.cjs} +1 -1
- package/dist/modal-CPnFteYS.cjs +35 -0
- package/dist/{modal-C6pScpdG.js → modal-xNK_wpHk.js} +11 -20
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +1 -1
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -1
- package/dist/pkt-footer.cjs +1 -0
- package/dist/pkt-footer.js +2 -0
- package/dist/pkt-header-menu.cjs +1 -1
- package/dist/pkt-header-menu.js +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +2 -2
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +27 -26
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-searchinput.cjs +1 -1
- package/dist/pkt-searchinput.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/{radiobutton-DGO6H2Ki.js → radiobutton-C6htwDrT.js} +1 -1
- package/dist/{radiobutton-DY1WWepJ.cjs → radiobutton-DjWBoSHv.cjs} +1 -1
- package/dist/scroll-lock-BN8lOhV5.cjs +1 -0
- package/dist/scroll-lock-DAbNKAUy.js +18 -0
- package/dist/searchinput-CfUVfpqL.js +156 -0
- package/dist/searchinput-DGjeN1YI.cjs +60 -0
- package/dist/{select-D4_HQFkh.cjs → select-CZvAW7W2.cjs} +2 -1
- package/dist/{select-BwHUIlwQ.js → select-CsBXXbLP.js} +4 -3
- package/dist/setupTests.d.ts +0 -0
- package/dist/shared-types/footer.d.ts +95 -0
- package/dist/shared-types/{header-menu.d.ts → header-footer.d.ts} +51 -4
- package/dist/shared-types/header.d.ts +1 -1
- package/dist/shared-types/index.d.ts +6 -4
- package/dist/shared-types/searchinput.d.ts +2 -0
- package/dist/shared-types/select.d.ts +3 -2
- package/dist/shared-types/size.d.ts +4 -0
- package/dist/shared-types/timepicker.d.ts +0 -6
- package/dist/shared-utils/datepicker-utils.d.ts +5 -4
- package/dist/shared-utils/fileupload/focus-trap.d.ts +4 -10
- package/dist/shared-utils/focus-trap/index.d.ts +22 -0
- package/dist/shared-utils/{header-menu → header-footer}/example-data.d.ts +5 -4
- package/dist/shared-utils/header-footer/external-domain.d.ts +26 -0
- package/dist/shared-utils/{header-menu → header-footer}/fetch-header-footer-data.d.ts +6 -2
- package/dist/shared-utils/{header-menu → header-footer}/index.d.ts +2 -1
- package/dist/shared-utils/{header-menu → header-footer}/select-megamenu.d.ts +1 -1
- package/dist/shared-utils/scroll-lock/index.d.ts +24 -0
- package/dist/tabs-BqrKLCjd.js +214 -0
- package/dist/tabs-q62MK_-r.cjs +40 -0
- package/dist/{textarea-D6M7ZhtA.js → textarea-Cm392CEI.js} +5 -3
- package/dist/{textarea-Bt_Zs8gq.cjs → textarea-sTcZxOIB.cjs} +3 -2
- package/dist/{textinput-EDKjcUdg.cjs → textinput-DqJbTglM.cjs} +3 -2
- package/dist/{textinput-oU2EvFsi.js → textinput-TSPcBcih.js} +5 -3
- package/dist/{timepicker-CgOL2sd9.cjs → timepicker-CqFYMV8q.cjs} +8 -7
- package/dist/{timepicker-_G0V_HV3.js → timepicker-DWbgTDKq.js} +10 -9
- package/package.json +3 -3
- package/src/components/accordion/accordion-context.ts +8 -0
- package/src/components/accordion/accordion.test.ts +44 -0
- package/src/components/accordion/accordion.ts +13 -3
- package/src/components/accordion/accordionitem.ts +9 -1
- package/src/components/alert/alert.test.ts +51 -2
- package/src/components/alert/alert.ts +11 -5
- package/src/components/breadcrumbs/breadcrumbs.test.ts +11 -3
- package/src/components/button/button.test.ts +23 -0
- package/src/components/button/button.ts +28 -3
- package/src/components/combobox/combobox.core.test.ts +20 -0
- package/src/components/combobox/combobox.ts +2 -0
- package/src/components/consent/consent.test.ts +6 -3
- package/src/components/consent/consent.ts +15 -7
- package/src/components/datepicker/datepicker-base.ts +5 -1
- package/src/components/datepicker/datepicker-utils.test.ts +10 -0
- package/src/components/datepicker/datepicker.core.test.ts +17 -0
- package/src/components/datepicker/datepicker.ts +8 -0
- package/src/components/footer/footer-base.ts +238 -0
- package/src/components/footer/footer-simple.ts +71 -0
- package/src/components/footer/footer.accessibility.test.ts +66 -0
- package/src/components/footer/footer.test.ts +238 -0
- package/src/components/footer/footer.ts +81 -0
- package/src/components/footer/index.ts +4 -0
- package/src/components/footer/types.ts +21 -0
- package/src/components/header/header-chrome-controller.ts +123 -0
- package/src/components/header/header-global.accessibility.test.ts +110 -0
- package/src/components/header/header-global.test.ts +329 -0
- package/src/components/header/header-global.ts +648 -0
- package/src/components/header/header-service.accessibility.test.ts +79 -0
- package/src/components/header/header-service.test.ts +32 -12
- package/src/components/header/header-service.ts +38 -162
- package/src/components/header/header-user-menu.ts +0 -1
- package/src/components/header/header.test.ts +84 -0
- package/src/components/header/header.ts +52 -5
- package/src/components/header/index.ts +6 -0
- package/src/components/header/types.ts +38 -0
- package/src/components/header-menu/header-menu.test.ts +131 -10
- package/src/components/header-menu/header-menu.ts +23 -24
- package/src/components/header-menu/types.ts +1 -1
- package/src/components/index.ts +18 -2
- package/src/components/input-wrapper/input-wrapper.test.ts +45 -0
- package/src/components/input-wrapper/input-wrapper.ts +17 -9
- package/src/components/modal/modal.ts +8 -9
- package/src/components/searchinput/searchinput.test.ts +43 -0
- package/src/components/searchinput/searchinput.ts +29 -12
- package/src/components/select/index.ts +1 -1
- package/src/components/select/select.test.ts +28 -0
- package/src/components/select/select.ts +4 -3
- package/src/components/textarea/textarea.test.ts +16 -0
- package/src/components/textarea/textarea.ts +3 -1
- package/src/components/textinput/textinput.test.ts +28 -0
- package/src/components/textinput/textinput.ts +3 -1
- package/src/components/timepicker/timepicker.test.ts +26 -0
- package/src/components/timepicker/timepicker.ts +12 -6
- package/dist/accordion-FISAiAbX.cjs +0 -47
- package/dist/button-C_YzTSuU.js +0 -96
- package/dist/combobox-D6H9rWPV.cjs +0 -135
- package/dist/consent-X3wvhteO.cjs +0 -10
- package/dist/fileupload-BLVrslUX.cjs +0 -401
- package/dist/header-CFrsaq0c.cjs +0 -310
- package/dist/header-D_xvPR4R.js +0 -801
- package/dist/header-menu-DMdP_c6X.cjs +0 -126
- package/dist/modal-DKU7PnjJ.cjs +0 -35
- package/dist/searchinput-CyO5k4Q4.js +0 -148
- package/dist/searchinput-DG6YetL1.cjs +0 -60
- package/dist/shared-utils/modal-scroll-lock.d.ts +0 -10
- package/dist/tabs-CGo0ODPa.cjs +0 -40
- package/dist/tabs-ChdR0D1C.js +0 -379
- /package/dist/shared-utils/{header-menu → header-footer}/icon-map.d.ts +0 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs");require("./icon-B8PVq2O6.cjs"),require("./accordion-CbXDxOho.cjs");const n=require("./booleanish-B9Kf0nES.cjs"),r=require("./fetch-header-footer-data-xohWFmYC.cjs");var i=class extends e.t{constructor(...e){super(...e),this.dataUrl=r.a,this.locale=`nb-NO`,this.open=!1,this.mobileBreakpoint=768,this.loadState=`idle`,this.isMobile=!1,this.menuWidth=0}connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-header-menu`),this.updateOpenClass(),this.observeWidth(),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.resizeObserver?.disconnect(),this.resizeObserver=void 0}updated(e){super.updated(e),e.has(`open`)&&this.updateOpenClass(),e.has(`mobileBreakpoint`)&&e.get(`mobileBreakpoint`)!==void 0&&this.refreshIsMobile(),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})))}observeWidth(){typeof ResizeObserver>`u`||(this.menuWidth=this.offsetWidth,this.refreshIsMobile(),this.resizeObserver=new ResizeObserver(e=>{for(let t of e)this.menuWidth=t.borderBoxSize&&t.borderBoxSize.length>0?t.borderBoxSize[0].inlineSize:t.contentRect.width,this.refreshIsMobile()}),this.resizeObserver.observe(this))}refreshIsMobile(){this.isMobile=this.menuWidth<this.mobileBreakpoint}async loadData(){this.abortController?.abort(),this.abortController=new AbortController,this.loadState=`loading`;try{let e=await r.t(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 r.n(this.effectiveData,this.locale)}render(){if(this.loadState===`loading`)return e.p`
|
|
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.p`
|
|
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.p`
|
|
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.p`
|
|
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.p`
|
|
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.p`
|
|
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.p`
|
|
49
|
+
<ul class="pkt-header-menu__services-list">
|
|
50
|
+
${t.links.map(t=>e.p`
|
|
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=${r.i(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.p`
|
|
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,i){return!n||n.length===0?e.d:e.p`
|
|
69
|
+
<div class=${t.t({"pkt-header-menu__buttons":!0,"pkt-header-menu__buttons--mobile":i})}>
|
|
70
|
+
${n.map(t=>e.p`
|
|
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?r.i(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.d:e.p`
|
|
85
|
+
<div class="pkt-header-menu__sections">
|
|
86
|
+
<div class="pkt-header-menu__sections-inner">
|
|
87
|
+
${t.map(t=>e.p`
|
|
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.p`
|
|
96
|
+
<ul class="pkt-header-menu__section-list">
|
|
97
|
+
${t.map(t=>e.p`
|
|
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.d:e.p`
|
|
104
|
+
<div class="pkt-header-menu__footer">
|
|
105
|
+
${t&&t.length>0?e.p`
|
|
106
|
+
<ul class="pkt-header-menu__footer-list">
|
|
107
|
+
${t.map(t=>e.p`
|
|
108
|
+
<li>
|
|
109
|
+
<a class="pkt-header-menu__footer-link" href=${t.url}>${t.text}</a>
|
|
110
|
+
</li>
|
|
111
|
+
`)}
|
|
112
|
+
</ul>
|
|
113
|
+
`:e.d}
|
|
114
|
+
${n&&n.length>0?e.p`
|
|
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.d}
|
|
119
|
+
</div>
|
|
120
|
+
`}renderSocialLink(t){let n=r.r(t.url,t.text);return e.p`
|
|
121
|
+
<li>
|
|
122
|
+
<a class="pkt-header-menu__social-link" href=${t.url} aria-label=${t.text}>
|
|
123
|
+
${n?e.p`<pkt-icon name=${n} aria-hidden="true"></pkt-icon>`:e.p`<span>${t.text}</span>`}
|
|
124
|
+
</a>
|
|
125
|
+
</li>
|
|
126
|
+
`}};e.n([e.o({type:String,attribute:`data-url`})],i.prototype,`dataUrl`,void 0),e.n([e.o({type:Object,attribute:!1})],i.prototype,`data`,void 0),e.n([e.o({type:String})],i.prototype,`locale`,void 0),e.n([e.o({type:Boolean,reflect:!0,converter:n.t})],i.prototype,`open`,void 0),e.n([e.o({type:Number,attribute:`mobile-breakpoint`})],i.prototype,`mobileBreakpoint`,void 0),e.n([e.a()],i.prototype,`loadState`,void 0),e.n([e.a()],i.prototype,`fetchedData`,void 0),e.n([e.a()],i.prototype,`isMobile`,void 0);try{e.s(`pkt-header-menu`)(i)}catch{console.warn(`Forsøker å definere <pkt-header-menu>, men den er allerede definert`)}var a=i;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|
|
@@ -1,86 +1,16 @@
|
|
|
1
1
|
import { a as e, d as t, n, o as r, p as i, s as a, t as o } from "./element-BoJrqauR.js";
|
|
2
2
|
import { t as s } from "./class-map-CAQCRB1W.js";
|
|
3
3
|
import "./icon-DGFEIlco.js";
|
|
4
|
-
import "./accordion-
|
|
4
|
+
import "./accordion-DEUHQ4JD.js";
|
|
5
5
|
import { t as c } from "./booleanish-MfutDT_4.js";
|
|
6
|
-
|
|
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
|
|
6
|
+
import { a as l, i as u, n as d, r as f, t as p } from "./fetch-header-footer-data-Pc32etrk.js";
|
|
75
7
|
//#region src/components/header-menu/header-menu.ts
|
|
76
|
-
var
|
|
8
|
+
var m = class extends o {
|
|
77
9
|
constructor(...e) {
|
|
78
|
-
super(...e), this.dataUrl = l, this.locale = "nb-NO", this.open = !1, this.
|
|
79
|
-
this.isMobile = e.matches;
|
|
80
|
-
};
|
|
10
|
+
super(...e), this.dataUrl = l, this.locale = "nb-NO", this.open = !1, this.mobileBreakpoint = 768, this.loadState = "idle", this.isMobile = !1, this.menuWidth = 0;
|
|
81
11
|
}
|
|
82
12
|
connectedCallback() {
|
|
83
|
-
super.connectedCallback(), this.classList.add("pkt-header-menu"), this.updateOpenClass(), this.
|
|
13
|
+
super.connectedCallback(), this.classList.add("pkt-header-menu"), this.updateOpenClass(), this.observeWidth(), this.data ? (this.loadState = "ready", this.dispatchEvent(new CustomEvent("data-loaded", {
|
|
84
14
|
detail: { data: this.data },
|
|
85
15
|
bubbles: !0,
|
|
86
16
|
composed: !0
|
|
@@ -90,25 +20,27 @@ var v = class extends o {
|
|
|
90
20
|
this.classList.toggle("pkt-header-menu--open", !!this.open);
|
|
91
21
|
}
|
|
92
22
|
disconnectedCallback() {
|
|
93
|
-
super.disconnectedCallback(), this.abortController?.abort(), this.
|
|
23
|
+
super.disconnectedCallback(), this.abortController?.abort(), this.resizeObserver?.disconnect(), this.resizeObserver = void 0;
|
|
94
24
|
}
|
|
95
25
|
updated(e) {
|
|
96
|
-
super.updated(e), e.has("open") && this.updateOpenClass(), e.has("mobileBreakpoint") && e.get("mobileBreakpoint") !== void 0 && this.
|
|
26
|
+
super.updated(e), e.has("open") && this.updateOpenClass(), e.has("mobileBreakpoint") && e.get("mobileBreakpoint") !== void 0 && this.refreshIsMobile(), 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
27
|
detail: { data: this.data },
|
|
98
28
|
bubbles: !0,
|
|
99
29
|
composed: !0
|
|
100
30
|
})));
|
|
101
31
|
}
|
|
102
|
-
|
|
103
|
-
|
|
32
|
+
observeWidth() {
|
|
33
|
+
typeof ResizeObserver > "u" || (this.menuWidth = this.offsetWidth, this.refreshIsMobile(), this.resizeObserver = new ResizeObserver((e) => {
|
|
34
|
+
for (let t of e) this.menuWidth = t.borderBoxSize && t.borderBoxSize.length > 0 ? t.borderBoxSize[0].inlineSize : t.contentRect.width, this.refreshIsMobile();
|
|
35
|
+
}), this.resizeObserver.observe(this));
|
|
104
36
|
}
|
|
105
|
-
|
|
106
|
-
this.
|
|
37
|
+
refreshIsMobile() {
|
|
38
|
+
this.isMobile = this.menuWidth < this.mobileBreakpoint;
|
|
107
39
|
}
|
|
108
40
|
async loadData() {
|
|
109
41
|
this.abortController?.abort(), this.abortController = new AbortController(), this.loadState = "loading";
|
|
110
42
|
try {
|
|
111
|
-
let e = await
|
|
43
|
+
let e = await p(this.dataUrl, this.abortController.signal);
|
|
112
44
|
this.fetchedData = e, this.loadState = "ready", this.dispatchEvent(new CustomEvent("data-loaded", {
|
|
113
45
|
detail: { data: e },
|
|
114
46
|
bubbles: !0,
|
|
@@ -127,7 +59,7 @@ var v = class extends o {
|
|
|
127
59
|
return this.data ?? this.fetchedData;
|
|
128
60
|
}
|
|
129
61
|
get localeData() {
|
|
130
|
-
return
|
|
62
|
+
return d(this.effectiveData, this.locale);
|
|
131
63
|
}
|
|
132
64
|
render() {
|
|
133
65
|
if (this.loadState === "loading") return i`
|
|
@@ -193,7 +125,7 @@ var v = class extends o {
|
|
|
193
125
|
<a class="pkt-header-menu__service-link" href=${e.url}>
|
|
194
126
|
<pkt-icon
|
|
195
127
|
class="pkt-header-menu__service-icon"
|
|
196
|
-
name=${
|
|
128
|
+
name=${u(e.icon)}
|
|
197
129
|
aria-hidden="true"
|
|
198
130
|
></pkt-icon>
|
|
199
131
|
<span class="pkt-header-menu__service-text">${e.text}</span>
|
|
@@ -224,7 +156,7 @@ var v = class extends o {
|
|
|
224
156
|
>
|
|
225
157
|
<pkt-icon
|
|
226
158
|
class="pkt-btn__icon"
|
|
227
|
-
name=${e.iconName ?
|
|
159
|
+
name=${e.iconName ? u(e.iconName) : "user"}
|
|
228
160
|
aria-hidden="true"
|
|
229
161
|
></pkt-icon>
|
|
230
162
|
<span class="pkt-btn__text">${e.text}</span>
|
|
@@ -279,7 +211,7 @@ var v = class extends o {
|
|
|
279
211
|
`;
|
|
280
212
|
}
|
|
281
213
|
renderSocialLink(e) {
|
|
282
|
-
let t =
|
|
214
|
+
let t = f(e.url, e.text);
|
|
283
215
|
return i`
|
|
284
216
|
<li>
|
|
285
217
|
<a class="pkt-header-menu__social-link" href=${e.url} aria-label=${e.text}>
|
|
@@ -292,28 +224,24 @@ var v = class extends o {
|
|
|
292
224
|
n([r({
|
|
293
225
|
type: String,
|
|
294
226
|
attribute: "data-url"
|
|
295
|
-
})],
|
|
227
|
+
})], m.prototype, "dataUrl", void 0), n([r({
|
|
296
228
|
type: Object,
|
|
297
229
|
attribute: !1
|
|
298
|
-
})],
|
|
230
|
+
})], m.prototype, "data", void 0), n([r({ type: String })], m.prototype, "locale", void 0), n([r({
|
|
299
231
|
type: Boolean,
|
|
300
232
|
reflect: !0,
|
|
301
233
|
converter: c
|
|
302
|
-
})],
|
|
303
|
-
type: String,
|
|
304
|
-
attribute: "aria-labelledby",
|
|
305
|
-
reflect: !0
|
|
306
|
-
})], v.prototype, "ariaLabelledBy", void 0), n([r({
|
|
234
|
+
})], m.prototype, "open", void 0), n([r({
|
|
307
235
|
type: Number,
|
|
308
236
|
attribute: "mobile-breakpoint"
|
|
309
|
-
})],
|
|
237
|
+
})], m.prototype, "mobileBreakpoint", void 0), n([e()], m.prototype, "loadState", void 0), n([e()], m.prototype, "fetchedData", void 0), n([e()], m.prototype, "isMobile", void 0);
|
|
310
238
|
try {
|
|
311
|
-
a("pkt-header-menu")(
|
|
239
|
+
a("pkt-header-menu")(m);
|
|
312
240
|
} catch {
|
|
313
241
|
console.warn("Forsøker å definere <pkt-header-menu>, men den er allerede definert");
|
|
314
242
|
}
|
|
315
243
|
//#endregion
|
|
316
244
|
//#region src/components/header-menu/index.ts
|
|
317
|
-
var
|
|
245
|
+
var h = m;
|
|
318
246
|
//#endregion
|
|
319
|
-
export {
|
|
247
|
+
export { m as n, h as t };
|
|
@@ -3,7 +3,7 @@ import { t as o } from "./class-map-CAQCRB1W.js";
|
|
|
3
3
|
import { n as s, t as c } from "./element-with-slot-mXLg8gg8.js";
|
|
4
4
|
import { r as l } from "./icon-DGFEIlco.js";
|
|
5
5
|
import { n as u } from "./utils-BwF4QSrq.js";
|
|
6
|
-
import { t as d } from "./input-wrapper-
|
|
6
|
+
import { t as d } from "./input-wrapper-BweP6t3O.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-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs"),n=require("./element-with-slot-BY7Jc-q8.cjs"),r=require("./icon-B8PVq2O6.cjs"),i=require("./utils-63cRpWut.cjs"),a=require("./input-wrapper-
|
|
1
|
+
const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs"),n=require("./element-with-slot-BY7Jc-q8.cjs"),r=require("./icon-B8PVq2O6.cjs"),i=require("./utils-63cRpWut.cjs"),a=require("./input-wrapper-wh3fWIhk.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.p`${e.p`<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)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./element-DJzurxgt.cjs"),t=require("./element-with-slot-BY7Jc-q8.cjs"),n=require("./utils-63cRpWut.cjs"),r=require("./booleanish-B9Kf0nES.cjs"),i=require("./input-wrapper-LcZjpt0L.cjs");var a=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,p=new WeakMap,m=new WeakMap,h=new WeakMap,g=new WeakMap,_=new WeakMap,v=new WeakMap,y=new WeakMap,b=(e,t,n)=>{e.getAttribute(t)!==n&&e.setAttribute(t,n)},x=(e,t)=>{e.toggleAttribute(`internals-disabled`,t),t?b(e,`aria-disabled`,`true`):e.removeAttribute(`aria-disabled`),e.formDisabledCallback&&e.formDisabledCallback.apply(e,[t])},S=e=>{s.get(e).forEach(e=>{e.remove()}),s.set(e,[])},C=(e,t)=>{let n=document.createElement(`input`);return n.type=`hidden`,n.name=e.getAttribute(`name`),e.after(n),s.get(t).push(n),n},w=(e,t)=>{if(t.length){let n=Array.from(t);n.forEach(t=>t.addEventListener(`click`,e.click.bind(e)));let[r]=n,i=r.id;r.id||=(i=`${r.htmlFor}_Label`,i),b(e,`aria-labelledby`,i)}},T=e=>{let t=Array.from(e.elements).filter(e=>!e.tagName.includes(`-`)&&e.validity).map(e=>e.validity.valid),n=f.get(e)||[],r=Array.from(n).filter(e=>e.isConnected).map(e=>c.get(e).validity.valid),i=[...t,...r].includes(!1);e.toggleAttribute(`internals-invalid`,i),e.toggleAttribute(`internals-valid`,!i)},ee=e=>{T(O(e.target))},E=e=>{T(O(e.target))},te=e=>{let t=[`button[type=submit]`,`input[type=submit]`,`button:not([type])`].map(e=>`${e}:not([disabled])`).map(t=>`${t}:not([form])${e.id?`,${t}[form='${e.id}']`:``}`).join(`,`);e.addEventListener(`click`,n=>{if(n.target.closest(t)){let t=f.get(e);if(e.noValidate)return;t.size&&Array.from(t).reverse().map(e=>c.get(e).reportValidity()).includes(!1)&&n.preventDefault()}})},ne=e=>{let t=f.get(e.target);t&&t.size&&t.forEach(e=>{e.constructor.formAssociated&&e.formResetCallback&&e.formResetCallback.apply(e)})},D=(e,t,n)=>{if(t){let r=f.get(t);if(r)r.add(e);else{let n=new Set;n.add(e),f.set(t,n),te(t),t.addEventListener(`reset`,ne),t.addEventListener(`input`,ee),t.addEventListener(`change`,E)}u.set(t,{ref:e,internals:n}),e.constructor.formAssociated&&e.formAssociatedCallback&&setTimeout(()=>{e.formAssociatedCallback.apply(e,[t])},0),T(t)}},O=e=>{let t=e.parentNode;return t&&t.tagName!==`FORM`&&(t=O(t)),t},k=(e,t,n=DOMException)=>{if(!e.constructor.formAssociated)throw new n(t)},A=(e,t,n)=>{let r=f.get(e);return r&&r.size&&r.forEach(e=>{c.get(e)[n]()||(t=!1)}),t},j=e=>{let t=!1;if(e.constructor.formAssociated){let n=c.get(e);n===void 0&&(e.attachInternals(),n=c.get(e),t=!0);let{labels:r,form:i}=n;w(e,r),D(e,i,n)}return t};function M(){return typeof MutationObserver<`u`}var N={ariaAtomic:`aria-atomic`,ariaAutoComplete:`aria-autocomplete`,ariaBrailleLabel:`aria-braillelabel`,ariaBrailleRoleDescription:`aria-brailleroledescription`,ariaBusy:`aria-busy`,ariaChecked:`aria-checked`,ariaColCount:`aria-colcount`,ariaColIndex:`aria-colindex`,ariaColIndexText:`aria-colindextext`,ariaColSpan:`aria-colspan`,ariaCurrent:`aria-current`,ariaDescription:`aria-description`,ariaDisabled:`aria-disabled`,ariaExpanded:`aria-expanded`,ariaHasPopup:`aria-haspopup`,ariaHidden:`aria-hidden`,ariaInvalid:`aria-invalid`,ariaKeyShortcuts:`aria-keyshortcuts`,ariaLabel:`aria-label`,ariaLevel:`aria-level`,ariaLive:`aria-live`,ariaModal:`aria-modal`,ariaMultiLine:`aria-multiline`,ariaMultiSelectable:`aria-multiselectable`,ariaOrientation:`aria-orientation`,ariaPlaceholder:`aria-placeholder`,ariaPosInSet:`aria-posinset`,ariaPressed:`aria-pressed`,ariaReadOnly:`aria-readonly`,ariaRelevant:`aria-relevant`,ariaRequired:`aria-required`,ariaRoleDescription:`aria-roledescription`,ariaRowCount:`aria-rowcount`,ariaRowIndex:`aria-rowindex`,ariaRowIndexText:`aria-rowindextext`,ariaRowSpan:`aria-rowspan`,ariaSelected:`aria-selected`,ariaSetSize:`aria-setsize`,ariaSort:`aria-sort`,ariaValueMax:`aria-valuemax`,ariaValueMin:`aria-valuemin`,ariaValueNow:`aria-valuenow`,ariaValueText:`aria-valuetext`,role:`role`},P=(e,t)=>{for(let n in N){t[n]=null;let r=null,i=N[n];Object.defineProperty(t,n,{get(){return r},set(n){r=n,e.isConnected?b(e,i,n):m.set(e,t)}})}},re=(e,t)=>{s.set(t,[]),R.observe?.(e,L)};function F(e){let t=c.get(e),{form:n}=t;D(e,n,t),w(e,t.labels)}var I=(e,t=!1)=>{let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return c.has(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode(),i=!t||e.disabled;for(;r;)r.formDisabledCallback&&i&&x(r,e.disabled),r=n.nextNode()},L={attributes:!0,attributeFilter:[`disabled`,`name`]},R=M()?new MutationObserver(e=>{for(let t of e){let e=t.target;if(t.attributeName===`disabled`&&(e.constructor.formAssociated?x(e,e.hasAttribute(`disabled`)):e.localName===`fieldset`&&I(e)),t.attributeName===`name`&&e.constructor.formAssociated){let t=c.get(e),n=p.get(e);t.setFormValue(n)}}}):{};function z(e){e.forEach(e=>{let{addedNodes:t,removedNodes:n}=e,r=Array.from(t),i=Array.from(n);r.forEach(e=>{if(c.has(e)&&e.constructor.formAssociated&&F(e),m.has(e)){let t=m.get(e);Object.keys(N).filter(e=>t[e]!==null).forEach(n=>{b(e,N[n],t[n])}),m.delete(e)}if(y.has(e)){let t=y.get(e);b(e,`internals-valid`,t.validity.valid.toString()),b(e,`internals-invalid`,(!t.validity.valid).toString()),b(e,`aria-invalid`,(!t.validity.valid).toString()),y.delete(e)}if(e.localName===`form`){let t=f.get(e),n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return c.has(e)&&e.constructor.formAssociated&&!(t&&t.has(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode();for(;r;)F(r),r=n.nextNode()}e.localName===`fieldset`&&(R.observe?.(e,L),I(e,!0))}),i.forEach(e=>{let t=c.get(e);t&&s.get(t)&&S(t),d.has(e)&&d.get(e).disconnect()})})}function ie(e){e.forEach(e=>{let{removedNodes:t}=e;t.forEach(t=>{let n=_.get(e.target);c.has(t)&&j(t),n.disconnect()})})}var ae=e=>{let t=new MutationObserver(ie);window?.ShadyDOM?.inUse&&e.mode&&e.host&&(e=e.host),t.observe?.(e,{childList:!0}),_.set(e,t)};M()&&new MutationObserver(z);var B={childList:!0,subtree:!0},oe=class{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}},se=e=>(e.badInput=!1,e.customError=!1,e.patternMismatch=!1,e.rangeOverflow=!1,e.rangeUnderflow=!1,e.stepMismatch=!1,e.tooLong=!1,e.tooShort=!1,e.typeMismatch=!1,e.valid=!0,e.valueMissing=!1,e),ce=(e,t,n)=>(e.valid=le(t),Object.keys(t).forEach(n=>e[n]=t[n]),n&&T(n),e),le=e=>{let t=!0;for(let n in e)n!==`valid`&&e[n]!==!1&&(t=!1);return t},V=new WeakMap;function H(e,t){e.toggleAttribute(t,!0),e.part&&e.part.add(t)}var U=class extends Set{static get isPolyfilled(){return!0}constructor(e){if(super(),!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);V.set(this,e)}add(e){if(!/^--/.test(e)||typeof e!=`string`)throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${e} must start with '--'.`);let t=super.add(e),n=V.get(this),r=`state${e}`;return n.isConnected?H(n,r):setTimeout(()=>{H(n,r)}),t}clear(){for(let[e]of this.entries())this.delete(e);super.clear()}delete(e){let t=super.delete(e),n=V.get(this);return n.isConnected?(n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)):setTimeout(()=>{n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)}),t}},ue=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},W=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},G,de=class{constructor(e){G.set(this,void 0),ue(this,G,e,`f`);for(let t=0;t<e.length;t++){let n=e[t];this[t]=n,n.hasAttribute(`name`)&&(this[n.getAttribute(`name`)]=n)}Object.freeze(this)}get length(){return W(this,G,`f`).length}[(G=new WeakMap,Symbol.iterator)](){return W(this,G,`f`)[Symbol.iterator]()}item(e){return this[e]==null?null:this[e]}namedItem(e){return this[e]==null?null:this[e]}};function fe(){let e=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=n;let t=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=r;function n(...t){let n=e.apply(this,t);return A(this,n,`checkValidity`)}function r(...e){let n=t.apply(this,e);return A(this,n,`reportValidity`)}let{get:i}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,`elements`);Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...e){let t=i.call(this,...e),n=Array.from(f.get(this)||[]);return n.length===0?t:new de(Array.from(t).concat(n).sort((e,t)=>e.compareDocumentPosition?e.compareDocumentPosition(t)&2?1:-1:0))}})}var K=class{static get isPolyfilled(){return!0}constructor(e){if(!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);let t=e.getRootNode(),n=new oe;this.states=new U(e),a.set(this,e),o.set(this,n),c.set(e,this),P(e,this),re(e,this),Object.seal(this),t instanceof DocumentFragment&&ae(t)}checkValidity(){let e=a.get(this);if(k(e,`Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let t=o.get(this);if(!t.valid){let t=new Event(`invalid`,{bubbles:!1,cancelable:!0,composed:!1});e.dispatchEvent(t)}return t.valid}get form(){let e=a.get(this);k(e,`Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.`);let t;return e.constructor.formAssociated===!0&&(t=O(e)),t}get labels(){let e=a.get(this);k(e,`Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.`);let t=e.getAttribute(`id`),n=e.getRootNode();return n&&t?n.querySelectorAll(`[for="${t}"]`):[]}reportValidity(){let e=a.get(this);if(k(e,`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let t=this.checkValidity(),n=g.get(this);if(n&&!e.constructor.formAssociated)throw new DOMException(`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`);return!t&&n&&(e.focus(),n.focus()),t}setFormValue(e){let t=a.get(this);if(k(t,`Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element.`),S(this),e!=null&&!(e instanceof FormData)){if(t.getAttribute(`name`)){let n=C(t,this);n.value=e}}else e!=null&&e instanceof FormData&&Array.from(e).reverse().forEach(([e,n])=>{if(typeof n==`string`){let r=C(t,this);r.name=e,r.value=n}});p.set(t,e)}setValidity(e,t,n){let r=a.get(this);if(k(r,`Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!e)throw TypeError(`Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.`);g.set(this,n);let i=o.get(this),s={};for(let t in e)s[t]=e[t];Object.keys(s).length===0&&se(i);let c={...i,...s};delete c.valid;let{valid:u}=ce(i,c,this.form);if(!u&&!t)throw new DOMException(`Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.`);l.set(this,u?``:t),r.isConnected?(r.toggleAttribute(`internals-invalid`,!u),r.toggleAttribute(`internals-valid`,u),b(r,`aria-invalid`,`${!u}`)):y.set(r,this)}get shadowRoot(){let e=a.get(this);return h.get(e)||null}get validationMessage(){return k(a.get(this),`Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element.`),l.get(this)}get validity(){return k(a.get(this),`Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element.`),o.get(this)}get willValidate(){let e=a.get(this);return k(e,`Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element.`),!(e.matches(`:disabled`)||e.disabled||e.hasAttribute(`disabled`)||e.hasAttribute(`readonly`))}};function pe(){if(typeof window>`u`||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class e extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}let t=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,``)}`;customElements.define(t,e);let n=new e;return[`shadowRoot`,`form`,`willValidate`,`validity`,`validationMessage`,`labels`,`setFormValue`,`setValidity`,`checkValidity`,`reportValidity`].every(e=>e in n.internals)}var q=!1,J=!1;function Y(e){J||(J=!0,window.CustomStateSet=U,e&&(HTMLElement.prototype.attachInternals=function(...t){let n=e.call(this,t);return n.states=new U(this),n}))}function me(e=!0){let t=!1;if(!q){if(q=!0,typeof window<`u`&&(window.ElementInternals=K),typeof CustomElementRegistry<`u`){let e=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(n,r,i){if(r.formAssociated){let e=r.prototype.connectedCallback;r.prototype.connectedCallback=function(){v.has(this)||(v.set(this,!0),this.hasAttribute(`disabled`)&&x(this,!0)),e?.apply(this),t=j(this)}}e.call(this,n,r,i)}}if(typeof HTMLElement<`u`&&(HTMLElement.prototype.attachInternals=function(){if(!this.tagName)return{};if(this.tagName.indexOf(`-`)===-1)throw Error(`Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.`);if(c.has(this)&&!t)throw new DOMException(`DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.`);return new K(this)}),typeof Element<`u`){function n(...t){let n=e.apply(this,t);if(h.set(this,n),M()){let e=new MutationObserver(z);window.ShadyDOM?e.observe(this,B):e.observe(n,B),d.set(this,e)}return n}let e=Element.prototype.attachShadow;Element.prototype.attachShadow=n}M()&&typeof document<`u`&&new MutationObserver(z).observe(document.documentElement,B),typeof HTMLFormElement<`u`&&fe(),(e||typeof window<`u`&&!window.CustomStateSet)&&Y()}}customElements.polyfillWrapFlushCallback||(pe()?typeof window<`u`&&!window.CustomStateSet&&Y(HTMLElement.prototype.attachInternals):me(!1));var X=`on`,Z=`--checked`,Q=`,`,$=class extends t.t{static get formAssociated(){return!0}constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name=``,this.pattern=null,this.placeholder=null,this.id=n.n(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage=``,this.helptext=``,this.helptextDropdown=``,this.helptextDropdownButton=i.t.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.r.forms.labels.optional,this.requiredText=e.r.forms.labels.required,this.tagText=null,this.dataTestid=``,this.touched=!1,this._initialized=!1,this.internals=this.attachInternals()}manageValidity(t){if(!t){console.warn(`manageValidity called without valid input element`);return}this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.r.forms.messages.required,t):t.validity?.typeMismatch||t.validity?.badInput?this.internals.setValidity({typeMismatch:!0},e.r.forms.messages.invalid,t):t.validity?.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.r.forms.messages.invalidPattern,t):t.validity?.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},e.r.forms.messages.tooShort,t):t.validity?.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},e.r.forms.messages.tooLong,t):t.validity?.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?e.r.forms.messages.rangeUnderflowMin.replace(`{min}`,this.min?.toString()):e.r.forms.messages.rangeUnderflow,t):t.validity?.stepMismatch?this.internals.setValidity({stepMismatch:!0},e.r.forms.messages.invalid,t):t.validity?.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?e.r.forms.messages.rangeOverflowMax.replace(`{max}`,this.max?.toString()):e.r.forms.messages.rangeOverflow,t):t.validity?.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({})}setFormValue(e){if(this.internals)if(Array.isArray(e)){let t=new FormData;e.forEach(e=>{t.append(this.name,e)}),this.internals.setFormValue(t)}else this.internals.setFormValue(e)}coordinateRadioGroup(){if(!this.form||!this.name||this.type!==`radio`)return;let e=`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`;this.form.querySelectorAll(e).forEach(e=>{if(e!==this&&e.getAttribute(`name`)===this.name&&e.getAttribute(`value`)!==this.value){let t=e;t.checked&&(t.checked=!1,t.internals&&(t.internals.setFormValue(null),t.internals.states?.delete(Z)))}})}valueChecked(e){if(!this.touched)return;let t=this.internals.form||this.closest(`form`),n=t?new FormData(t):null;if(this.type===`radio`&&this.coordinateRadioGroup(),typeof e==`string`?(this.checked=e===`true`,this.internals.ariaChecked=String(e===`true`)):typeof e==`boolean`&&(this.checked=e,this.internals.ariaChecked=String(e)),this.checked){let e=(typeof this.value==`string`?this.value:``)||X;this.internals.setFormValue(e),n&&n.append(this.name,e),this.internals.states.add(Z)}else this.internals.setFormValue(null),n&&n.delete(this.name),this.internals.states.delete(Z);this.dispatchChangeEvents(this.checked),this.internals.reportValidity()}valueChanged(e,t){let n=e;if(typeof n==`number`||typeof n==`boolean`)e=String(n);else if(n!=null&&typeof n!=`string`&&!Array.isArray(n)){let e=typeof n==`object`?n?.constructor?.name??`object`:typeof n;console.warn(`${this.localName}: value må være en streng eller et tall, men fikk ${e}. Verdien ignoreres. For dato-/tidsfelt, send en ISO-formatert streng (f.eks. "2026-07-09" eller "13:45").`)}(t!==this.value||t!==this._value)&&(typeof e==`string`?((this.multiple||this.range)&&e.includes(Q)&&(e=e.split(Q)),this.value=e,this._value=Array.isArray(e)?e:[e]):Array.isArray(e)?(this.value=this.multiple||this.range?e:e[0],this._value=e):(this.value=``,this._value=[]),(!this.value||this.value.length===0)&&t&&t.length!==0?this.clearInputValue():this.value&&this.value.toString()!==t?.toString()&&this.onChange(this.value))}dispatchChangeEvents(e){this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`value-change`,{detail:e,bubbles:!0,composed:!0}))}clearInputValue(){let e=this.multiple||this.range?[]:``;this.value=e,this.setFormValue(e),this.dispatchChangeEvents(e)}onFocus(){this.dispatchEvent(new FocusEvent(`focus`,{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent(`blur`,{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent(`input`,{bubbles:!0,composed:!0}))}normalizeValue(e){return(this.range||this.multiple)&&typeof e==`string`&&e.includes(Q)?e.split(Q):!this.multiple&&!this.range&&Array.isArray(e)?e[0]||``:e}validate(){this.inputRef?.value&&this.manageValidity(this.inputRef.value),this.inputRefTo?.value&&this.manageValidity(this.inputRefTo.value)}onChange(e){if(this.touched=!0,typeof e!=`string`&&!Array.isArray(e))return;let t=this.normalizeValue(e);this.setFormValue(t),this.validate(),this._initialized&&this.dispatchChangeEvents(t)}formResetCallback(){if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(e=>{`selected`in e&&(e.selected=!1)}),this.checked!==void 0)this.checked=!1,this.internals.ariaChecked=`false`,this.internals.setFormValue(``),this.inputRef?.value&&`checked`in this.inputRef.value&&(this.inputRef.value.checked=!1),this.valueChecked(this.checked);else{this.internals.setFormValue(``);let e=this.defaultValue||(this.multiple||this.range?[]:``);this.value=e,this._value=Array.isArray(e)?e:[e],this.valueChanged(this.value,null)}this.internals.ariaInvalid=`false`}updated(e){super.updated(e),e.has(`dataTestid`)&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute(`data-testid`)||this.setAttribute(`data-testid`,this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute(`data-testid`)))}firstUpdated(e){if(super.firstUpdated(e),!this.form){let e=this.internals.form||this.closest(`form`);this.form=e}if(this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=`true`,this.checked=!0),this.required&&(this.internals.ariaRequired=`true`),this.disabled&&(this.internals.ariaDisabled=`true`),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){let e=this.checked===``||this.checked===`true`||this.checked===!0;this.internals.ariaChecked=String(e);let t=e?(typeof this.value==`string`?this.value:``)||X:null;this.internals.setFormValue(t)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute(`form`,``),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute(`form`,``),this.manageValidity(this.inputRefTo.value)),this.updateComplete.then(()=>{this._initialized=!0})}};e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`checked`,void 0),e.n([e.o({type:Boolean})],$.prototype,`defaultChecked`,void 0),e.n([e.o({type:Boolean})],$.prototype,`multiple`,void 0),e.n([e.o({type:Boolean})],$.prototype,`range`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`type`,void 0),e.n([e.o()],$.prototype,`defaultValue`,void 0),e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`disabled`,void 0),e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`readonly`,void 0),e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`required`,void 0),e.n([e.o({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`max`,void 0),e.n([e.o({type:Number,reflect:!0})],$.prototype,`maxlength`,void 0),e.n([e.o({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`min`,void 0),e.n([e.o({type:Number,reflect:!0})],$.prototype,`minlength`,void 0),e.n([e.o({type:Number,reflect:!0})],$.prototype,`step`,void 0),e.n([e.o({type:String})],$.prototype,`ariaDescribedBy`,void 0),e.n([e.o({type:String})],$.prototype,`ariaLabelledby`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`name`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`pattern`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`placeholder`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`id`,void 0),e.n([e.o({type:Boolean})],$.prototype,`counter`,void 0),e.n([e.o({type:Boolean})],$.prototype,`hasError`,void 0),e.n([e.o({type:Boolean})],$.prototype,`inline`,void 0),e.n([e.o({type:Boolean})],$.prototype,`hasFieldset`,void 0),e.n([e.o({type:Boolean})],$.prototype,`optionalTag`,void 0),e.n([e.o({type:Boolean})],$.prototype,`requiredTag`,void 0),e.n([e.o({type:Boolean})],$.prototype,`skipForwardTestid`,void 0),e.n([e.o({type:Boolean,reflect:!0,converter:r.t})],$.prototype,`useWrapper`,void 0),e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`fullwidth`,void 0),e.n([e.o({type:Number})],$.prototype,`counterMaxLength`,void 0),e.n([e.o({type:String})],$.prototype,`errorMessage`,void 0),e.n([e.o({type:String})],$.prototype,`helptext`,void 0),e.n([e.o({type:String})],$.prototype,`helptextDropdown`,void 0),e.n([e.o({type:String,reflect:!1})],$.prototype,`helptextDropdownButton`,void 0),e.n([e.o({type:String})],$.prototype,`label`,void 0),e.n([e.o({type:String,reflect:!1})],$.prototype,`optionalText`,void 0),e.n([e.o({type:String,reflect:!1})],$.prototype,`requiredText`,void 0),e.n([e.o({type:String,reflect:!1})],$.prototype,`tagText`,void 0),e.n([e.o({type:String,attribute:`data-testid`})],$.prototype,`dataTestid`,void 0),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
|
|
1
|
+
const e=require("./element-DJzurxgt.cjs"),t=require("./element-with-slot-BY7Jc-q8.cjs"),n=require("./utils-63cRpWut.cjs"),r=require("./booleanish-B9Kf0nES.cjs"),i=require("./input-wrapper-wh3fWIhk.cjs");var a=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,p=new WeakMap,m=new WeakMap,h=new WeakMap,g=new WeakMap,_=new WeakMap,v=new WeakMap,y=new WeakMap,b=(e,t,n)=>{e.getAttribute(t)!==n&&e.setAttribute(t,n)},x=(e,t)=>{e.toggleAttribute(`internals-disabled`,t),t?b(e,`aria-disabled`,`true`):e.removeAttribute(`aria-disabled`),e.formDisabledCallback&&e.formDisabledCallback.apply(e,[t])},S=e=>{s.get(e).forEach(e=>{e.remove()}),s.set(e,[])},C=(e,t)=>{let n=document.createElement(`input`);return n.type=`hidden`,n.name=e.getAttribute(`name`),e.after(n),s.get(t).push(n),n},w=(e,t)=>{if(t.length){let n=Array.from(t);n.forEach(t=>t.addEventListener(`click`,e.click.bind(e)));let[r]=n,i=r.id;r.id||=(i=`${r.htmlFor}_Label`,i),b(e,`aria-labelledby`,i)}},T=e=>{let t=Array.from(e.elements).filter(e=>!e.tagName.includes(`-`)&&e.validity).map(e=>e.validity.valid),n=f.get(e)||[],r=Array.from(n).filter(e=>e.isConnected).map(e=>c.get(e).validity.valid),i=[...t,...r].includes(!1);e.toggleAttribute(`internals-invalid`,i),e.toggleAttribute(`internals-valid`,!i)},ee=e=>{T(O(e.target))},E=e=>{T(O(e.target))},te=e=>{let t=[`button[type=submit]`,`input[type=submit]`,`button:not([type])`].map(e=>`${e}:not([disabled])`).map(t=>`${t}:not([form])${e.id?`,${t}[form='${e.id}']`:``}`).join(`,`);e.addEventListener(`click`,n=>{if(n.target.closest(t)){let t=f.get(e);if(e.noValidate)return;t.size&&Array.from(t).reverse().map(e=>c.get(e).reportValidity()).includes(!1)&&n.preventDefault()}})},ne=e=>{let t=f.get(e.target);t&&t.size&&t.forEach(e=>{e.constructor.formAssociated&&e.formResetCallback&&e.formResetCallback.apply(e)})},D=(e,t,n)=>{if(t){let r=f.get(t);if(r)r.add(e);else{let n=new Set;n.add(e),f.set(t,n),te(t),t.addEventListener(`reset`,ne),t.addEventListener(`input`,ee),t.addEventListener(`change`,E)}u.set(t,{ref:e,internals:n}),e.constructor.formAssociated&&e.formAssociatedCallback&&setTimeout(()=>{e.formAssociatedCallback.apply(e,[t])},0),T(t)}},O=e=>{let t=e.parentNode;return t&&t.tagName!==`FORM`&&(t=O(t)),t},k=(e,t,n=DOMException)=>{if(!e.constructor.formAssociated)throw new n(t)},A=(e,t,n)=>{let r=f.get(e);return r&&r.size&&r.forEach(e=>{c.get(e)[n]()||(t=!1)}),t},j=e=>{let t=!1;if(e.constructor.formAssociated){let n=c.get(e);n===void 0&&(e.attachInternals(),n=c.get(e),t=!0);let{labels:r,form:i}=n;w(e,r),D(e,i,n)}return t};function M(){return typeof MutationObserver<`u`}var N={ariaAtomic:`aria-atomic`,ariaAutoComplete:`aria-autocomplete`,ariaBrailleLabel:`aria-braillelabel`,ariaBrailleRoleDescription:`aria-brailleroledescription`,ariaBusy:`aria-busy`,ariaChecked:`aria-checked`,ariaColCount:`aria-colcount`,ariaColIndex:`aria-colindex`,ariaColIndexText:`aria-colindextext`,ariaColSpan:`aria-colspan`,ariaCurrent:`aria-current`,ariaDescription:`aria-description`,ariaDisabled:`aria-disabled`,ariaExpanded:`aria-expanded`,ariaHasPopup:`aria-haspopup`,ariaHidden:`aria-hidden`,ariaInvalid:`aria-invalid`,ariaKeyShortcuts:`aria-keyshortcuts`,ariaLabel:`aria-label`,ariaLevel:`aria-level`,ariaLive:`aria-live`,ariaModal:`aria-modal`,ariaMultiLine:`aria-multiline`,ariaMultiSelectable:`aria-multiselectable`,ariaOrientation:`aria-orientation`,ariaPlaceholder:`aria-placeholder`,ariaPosInSet:`aria-posinset`,ariaPressed:`aria-pressed`,ariaReadOnly:`aria-readonly`,ariaRelevant:`aria-relevant`,ariaRequired:`aria-required`,ariaRoleDescription:`aria-roledescription`,ariaRowCount:`aria-rowcount`,ariaRowIndex:`aria-rowindex`,ariaRowIndexText:`aria-rowindextext`,ariaRowSpan:`aria-rowspan`,ariaSelected:`aria-selected`,ariaSetSize:`aria-setsize`,ariaSort:`aria-sort`,ariaValueMax:`aria-valuemax`,ariaValueMin:`aria-valuemin`,ariaValueNow:`aria-valuenow`,ariaValueText:`aria-valuetext`,role:`role`},P=(e,t)=>{for(let n in N){t[n]=null;let r=null,i=N[n];Object.defineProperty(t,n,{get(){return r},set(n){r=n,e.isConnected?b(e,i,n):m.set(e,t)}})}},re=(e,t)=>{s.set(t,[]),R.observe?.(e,L)};function F(e){let t=c.get(e),{form:n}=t;D(e,n,t),w(e,t.labels)}var I=(e,t=!1)=>{let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return c.has(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode(),i=!t||e.disabled;for(;r;)r.formDisabledCallback&&i&&x(r,e.disabled),r=n.nextNode()},L={attributes:!0,attributeFilter:[`disabled`,`name`]},R=M()?new MutationObserver(e=>{for(let t of e){let e=t.target;if(t.attributeName===`disabled`&&(e.constructor.formAssociated?x(e,e.hasAttribute(`disabled`)):e.localName===`fieldset`&&I(e)),t.attributeName===`name`&&e.constructor.formAssociated){let t=c.get(e),n=p.get(e);t.setFormValue(n)}}}):{};function z(e){e.forEach(e=>{let{addedNodes:t,removedNodes:n}=e,r=Array.from(t),i=Array.from(n);r.forEach(e=>{if(c.has(e)&&e.constructor.formAssociated&&F(e),m.has(e)){let t=m.get(e);Object.keys(N).filter(e=>t[e]!==null).forEach(n=>{b(e,N[n],t[n])}),m.delete(e)}if(y.has(e)){let t=y.get(e);b(e,`internals-valid`,t.validity.valid.toString()),b(e,`internals-invalid`,(!t.validity.valid).toString()),b(e,`aria-invalid`,(!t.validity.valid).toString()),y.delete(e)}if(e.localName===`form`){let t=f.get(e),n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return c.has(e)&&e.constructor.formAssociated&&!(t&&t.has(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode();for(;r;)F(r),r=n.nextNode()}e.localName===`fieldset`&&(R.observe?.(e,L),I(e,!0))}),i.forEach(e=>{let t=c.get(e);t&&s.get(t)&&S(t),d.has(e)&&d.get(e).disconnect()})})}function ie(e){e.forEach(e=>{let{removedNodes:t}=e;t.forEach(t=>{let n=_.get(e.target);c.has(t)&&j(t),n.disconnect()})})}var ae=e=>{let t=new MutationObserver(ie);window?.ShadyDOM?.inUse&&e.mode&&e.host&&(e=e.host),t.observe?.(e,{childList:!0}),_.set(e,t)};M()&&new MutationObserver(z);var B={childList:!0,subtree:!0},oe=class{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}},se=e=>(e.badInput=!1,e.customError=!1,e.patternMismatch=!1,e.rangeOverflow=!1,e.rangeUnderflow=!1,e.stepMismatch=!1,e.tooLong=!1,e.tooShort=!1,e.typeMismatch=!1,e.valid=!0,e.valueMissing=!1,e),ce=(e,t,n)=>(e.valid=le(t),Object.keys(t).forEach(n=>e[n]=t[n]),n&&T(n),e),le=e=>{let t=!0;for(let n in e)n!==`valid`&&e[n]!==!1&&(t=!1);return t},V=new WeakMap;function H(e,t){e.toggleAttribute(t,!0),e.part&&e.part.add(t)}var U=class extends Set{static get isPolyfilled(){return!0}constructor(e){if(super(),!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);V.set(this,e)}add(e){if(!/^--/.test(e)||typeof e!=`string`)throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${e} must start with '--'.`);let t=super.add(e),n=V.get(this),r=`state${e}`;return n.isConnected?H(n,r):setTimeout(()=>{H(n,r)}),t}clear(){for(let[e]of this.entries())this.delete(e);super.clear()}delete(e){let t=super.delete(e),n=V.get(this);return n.isConnected?(n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)):setTimeout(()=>{n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)}),t}},ue=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},W=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},G,de=class{constructor(e){G.set(this,void 0),ue(this,G,e,`f`);for(let t=0;t<e.length;t++){let n=e[t];this[t]=n,n.hasAttribute(`name`)&&(this[n.getAttribute(`name`)]=n)}Object.freeze(this)}get length(){return W(this,G,`f`).length}[(G=new WeakMap,Symbol.iterator)](){return W(this,G,`f`)[Symbol.iterator]()}item(e){return this[e]==null?null:this[e]}namedItem(e){return this[e]==null?null:this[e]}};function fe(){let e=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=n;let t=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=r;function n(...t){let n=e.apply(this,t);return A(this,n,`checkValidity`)}function r(...e){let n=t.apply(this,e);return A(this,n,`reportValidity`)}let{get:i}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,`elements`);Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...e){let t=i.call(this,...e),n=Array.from(f.get(this)||[]);return n.length===0?t:new de(Array.from(t).concat(n).sort((e,t)=>e.compareDocumentPosition?e.compareDocumentPosition(t)&2?1:-1:0))}})}var K=class{static get isPolyfilled(){return!0}constructor(e){if(!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);let t=e.getRootNode(),n=new oe;this.states=new U(e),a.set(this,e),o.set(this,n),c.set(e,this),P(e,this),re(e,this),Object.seal(this),t instanceof DocumentFragment&&ae(t)}checkValidity(){let e=a.get(this);if(k(e,`Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let t=o.get(this);if(!t.valid){let t=new Event(`invalid`,{bubbles:!1,cancelable:!0,composed:!1});e.dispatchEvent(t)}return t.valid}get form(){let e=a.get(this);k(e,`Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.`);let t;return e.constructor.formAssociated===!0&&(t=O(e)),t}get labels(){let e=a.get(this);k(e,`Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.`);let t=e.getAttribute(`id`),n=e.getRootNode();return n&&t?n.querySelectorAll(`[for="${t}"]`):[]}reportValidity(){let e=a.get(this);if(k(e,`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let t=this.checkValidity(),n=g.get(this);if(n&&!e.constructor.formAssociated)throw new DOMException(`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`);return!t&&n&&(e.focus(),n.focus()),t}setFormValue(e){let t=a.get(this);if(k(t,`Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element.`),S(this),e!=null&&!(e instanceof FormData)){if(t.getAttribute(`name`)){let n=C(t,this);n.value=e}}else e!=null&&e instanceof FormData&&Array.from(e).reverse().forEach(([e,n])=>{if(typeof n==`string`){let r=C(t,this);r.name=e,r.value=n}});p.set(t,e)}setValidity(e,t,n){let r=a.get(this);if(k(r,`Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!e)throw TypeError(`Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.`);g.set(this,n);let i=o.get(this),s={};for(let t in e)s[t]=e[t];Object.keys(s).length===0&&se(i);let c={...i,...s};delete c.valid;let{valid:u}=ce(i,c,this.form);if(!u&&!t)throw new DOMException(`Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.`);l.set(this,u?``:t),r.isConnected?(r.toggleAttribute(`internals-invalid`,!u),r.toggleAttribute(`internals-valid`,u),b(r,`aria-invalid`,`${!u}`)):y.set(r,this)}get shadowRoot(){let e=a.get(this);return h.get(e)||null}get validationMessage(){return k(a.get(this),`Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element.`),l.get(this)}get validity(){return k(a.get(this),`Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element.`),o.get(this)}get willValidate(){let e=a.get(this);return k(e,`Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element.`),!(e.matches(`:disabled`)||e.disabled||e.hasAttribute(`disabled`)||e.hasAttribute(`readonly`))}};function pe(){if(typeof window>`u`||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class e extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}let t=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,``)}`;customElements.define(t,e);let n=new e;return[`shadowRoot`,`form`,`willValidate`,`validity`,`validationMessage`,`labels`,`setFormValue`,`setValidity`,`checkValidity`,`reportValidity`].every(e=>e in n.internals)}var q=!1,J=!1;function Y(e){J||(J=!0,window.CustomStateSet=U,e&&(HTMLElement.prototype.attachInternals=function(...t){let n=e.call(this,t);return n.states=new U(this),n}))}function me(e=!0){let t=!1;if(!q){if(q=!0,typeof window<`u`&&(window.ElementInternals=K),typeof CustomElementRegistry<`u`){let e=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(n,r,i){if(r.formAssociated){let e=r.prototype.connectedCallback;r.prototype.connectedCallback=function(){v.has(this)||(v.set(this,!0),this.hasAttribute(`disabled`)&&x(this,!0)),e?.apply(this),t=j(this)}}e.call(this,n,r,i)}}if(typeof HTMLElement<`u`&&(HTMLElement.prototype.attachInternals=function(){if(!this.tagName)return{};if(this.tagName.indexOf(`-`)===-1)throw Error(`Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.`);if(c.has(this)&&!t)throw new DOMException(`DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.`);return new K(this)}),typeof Element<`u`){function n(...t){let n=e.apply(this,t);if(h.set(this,n),M()){let e=new MutationObserver(z);window.ShadyDOM?e.observe(this,B):e.observe(n,B),d.set(this,e)}return n}let e=Element.prototype.attachShadow;Element.prototype.attachShadow=n}M()&&typeof document<`u`&&new MutationObserver(z).observe(document.documentElement,B),typeof HTMLFormElement<`u`&&fe(),(e||typeof window<`u`&&!window.CustomStateSet)&&Y()}}customElements.polyfillWrapFlushCallback||(pe()?typeof window<`u`&&!window.CustomStateSet&&Y(HTMLElement.prototype.attachInternals):me(!1));var X=`on`,Z=`--checked`,Q=`,`,$=class extends t.t{static get formAssociated(){return!0}constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name=``,this.pattern=null,this.placeholder=null,this.id=n.n(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage=``,this.helptext=``,this.helptextDropdown=``,this.helptextDropdownButton=i.t.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.r.forms.labels.optional,this.requiredText=e.r.forms.labels.required,this.tagText=null,this.inputSize=`medium`,this.dataTestid=``,this.touched=!1,this._initialized=!1,this.internals=this.attachInternals()}manageValidity(t){if(!t){console.warn(`manageValidity called without valid input element`);return}this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.r.forms.messages.required,t):t.validity?.typeMismatch||t.validity?.badInput?this.internals.setValidity({typeMismatch:!0},e.r.forms.messages.invalid,t):t.validity?.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.r.forms.messages.invalidPattern,t):t.validity?.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},e.r.forms.messages.tooShort,t):t.validity?.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},e.r.forms.messages.tooLong,t):t.validity?.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?e.r.forms.messages.rangeUnderflowMin.replace(`{min}`,this.min?.toString()):e.r.forms.messages.rangeUnderflow,t):t.validity?.stepMismatch?this.internals.setValidity({stepMismatch:!0},e.r.forms.messages.invalid,t):t.validity?.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?e.r.forms.messages.rangeOverflowMax.replace(`{max}`,this.max?.toString()):e.r.forms.messages.rangeOverflow,t):t.validity?.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({})}setFormValue(e){if(this.internals)if(Array.isArray(e)){let t=new FormData;e.forEach(e=>{t.append(this.name,e)}),this.internals.setFormValue(t)}else this.internals.setFormValue(e)}coordinateRadioGroup(){if(!this.form||!this.name||this.type!==`radio`)return;let e=`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`;this.form.querySelectorAll(e).forEach(e=>{if(e!==this&&e.getAttribute(`name`)===this.name&&e.getAttribute(`value`)!==this.value){let t=e;t.checked&&(t.checked=!1,t.internals&&(t.internals.setFormValue(null),t.internals.states?.delete(Z)))}})}valueChecked(e){if(!this.touched)return;let t=this.internals.form||this.closest(`form`),n=t?new FormData(t):null;if(this.type===`radio`&&this.coordinateRadioGroup(),typeof e==`string`?(this.checked=e===`true`,this.internals.ariaChecked=String(e===`true`)):typeof e==`boolean`&&(this.checked=e,this.internals.ariaChecked=String(e)),this.checked){let e=(typeof this.value==`string`?this.value:``)||X;this.internals.setFormValue(e),n&&n.append(this.name,e),this.internals.states.add(Z)}else this.internals.setFormValue(null),n&&n.delete(this.name),this.internals.states.delete(Z);this.dispatchChangeEvents(this.checked),this.internals.reportValidity()}valueChanged(e,t){let n=e;if(typeof n==`number`||typeof n==`boolean`)e=String(n);else if(n!=null&&typeof n!=`string`&&!Array.isArray(n)){let e=typeof n==`object`?n?.constructor?.name??`object`:typeof n;console.warn(`${this.localName}: value må være en streng eller et tall, men fikk ${e}. Verdien ignoreres. For dato-/tidsfelt, send en ISO-formatert streng (f.eks. "2026-07-09" eller "13:45").`)}(t!==this.value||t!==this._value)&&(typeof e==`string`?((this.multiple||this.range)&&e.includes(Q)&&(e=e.split(Q)),this.value=e,this._value=Array.isArray(e)?e:[e]):Array.isArray(e)?(this.value=this.multiple||this.range?e:e[0],this._value=e):(this.value=``,this._value=[]),(!this.value||this.value.length===0)&&t&&t.length!==0?this.clearInputValue():this.value&&this.value.toString()!==t?.toString()&&this.onChange(this.value))}dispatchChangeEvents(e){this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`value-change`,{detail:e,bubbles:!0,composed:!0}))}clearInputValue(){let e=this.multiple||this.range?[]:``;this.value=e,this.setFormValue(e),this.dispatchChangeEvents(e)}onFocus(){this.dispatchEvent(new FocusEvent(`focus`,{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent(`blur`,{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent(`input`,{bubbles:!0,composed:!0}))}normalizeValue(e){return(this.range||this.multiple)&&typeof e==`string`&&e.includes(Q)?e.split(Q):!this.multiple&&!this.range&&Array.isArray(e)?e[0]||``:e}validate(){this.inputRef?.value&&this.manageValidity(this.inputRef.value),this.inputRefTo?.value&&this.manageValidity(this.inputRefTo.value)}onChange(e){if(this.touched=!0,typeof e!=`string`&&!Array.isArray(e))return;let t=this.normalizeValue(e);this.setFormValue(t),this.validate(),this._initialized&&this.dispatchChangeEvents(t)}formResetCallback(){if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(e=>{`selected`in e&&(e.selected=!1)}),this.checked!==void 0)this.checked=!1,this.internals.ariaChecked=`false`,this.internals.setFormValue(``),this.inputRef?.value&&`checked`in this.inputRef.value&&(this.inputRef.value.checked=!1),this.valueChecked(this.checked);else{this.internals.setFormValue(``);let e=this.defaultValue||(this.multiple||this.range?[]:``);this.value=e,this._value=Array.isArray(e)?e:[e],this.valueChanged(this.value,null)}this.internals.ariaInvalid=`false`}updated(e){super.updated(e),e.has(`dataTestid`)&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute(`data-testid`)||this.setAttribute(`data-testid`,this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute(`data-testid`)))}firstUpdated(e){if(super.firstUpdated(e),!this.form){let e=this.internals.form||this.closest(`form`);this.form=e}if(this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=`true`,this.checked=!0),this.required&&(this.internals.ariaRequired=`true`),this.disabled&&(this.internals.ariaDisabled=`true`),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){let e=this.checked===``||this.checked===`true`||this.checked===!0;this.internals.ariaChecked=String(e);let t=e?(typeof this.value==`string`?this.value:``)||X:null;this.internals.setFormValue(t)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute(`form`,``),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute(`form`,``),this.manageValidity(this.inputRefTo.value)),this.updateComplete.then(()=>{this._initialized=!0})}};e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`checked`,void 0),e.n([e.o({type:Boolean})],$.prototype,`defaultChecked`,void 0),e.n([e.o({type:Boolean})],$.prototype,`multiple`,void 0),e.n([e.o({type:Boolean})],$.prototype,`range`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`type`,void 0),e.n([e.o()],$.prototype,`defaultValue`,void 0),e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`disabled`,void 0),e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`readonly`,void 0),e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`required`,void 0),e.n([e.o({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`max`,void 0),e.n([e.o({type:Number,reflect:!0})],$.prototype,`maxlength`,void 0),e.n([e.o({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`min`,void 0),e.n([e.o({type:Number,reflect:!0})],$.prototype,`minlength`,void 0),e.n([e.o({type:Number,reflect:!0})],$.prototype,`step`,void 0),e.n([e.o({type:String})],$.prototype,`ariaDescribedBy`,void 0),e.n([e.o({type:String})],$.prototype,`ariaLabelledby`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`name`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`pattern`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`placeholder`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`id`,void 0),e.n([e.o({type:Boolean})],$.prototype,`counter`,void 0),e.n([e.o({type:Boolean})],$.prototype,`hasError`,void 0),e.n([e.o({type:Boolean})],$.prototype,`inline`,void 0),e.n([e.o({type:Boolean})],$.prototype,`hasFieldset`,void 0),e.n([e.o({type:Boolean})],$.prototype,`optionalTag`,void 0),e.n([e.o({type:Boolean})],$.prototype,`requiredTag`,void 0),e.n([e.o({type:Boolean})],$.prototype,`skipForwardTestid`,void 0),e.n([e.o({type:Boolean,reflect:!0,converter:r.t})],$.prototype,`useWrapper`,void 0),e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`fullwidth`,void 0),e.n([e.o({type:Number})],$.prototype,`counterMaxLength`,void 0),e.n([e.o({type:String})],$.prototype,`errorMessage`,void 0),e.n([e.o({type:String})],$.prototype,`helptext`,void 0),e.n([e.o({type:String})],$.prototype,`helptextDropdown`,void 0),e.n([e.o({type:String,reflect:!1})],$.prototype,`helptextDropdownButton`,void 0),e.n([e.o({type:String})],$.prototype,`label`,void 0),e.n([e.o({type:String,reflect:!1})],$.prototype,`optionalText`,void 0),e.n([e.o({type:String,reflect:!1})],$.prototype,`requiredText`,void 0),e.n([e.o({type:String,reflect:!1})],$.prototype,`tagText`,void 0),e.n([e.o({type:String,attribute:`input-size`})],$.prototype,`inputSize`,void 0),e.n([e.o({type:String,attribute:`data-testid`})],$.prototype,`dataTestid`,void 0),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
|
|
@@ -2,7 +2,7 @@ import { n as e, o as t, r as n } from "./element-BoJrqauR.js";
|
|
|
2
2
|
import { t as r } from "./element-with-slot-mXLg8gg8.js";
|
|
3
3
|
import { n as i } from "./utils-BwF4QSrq.js";
|
|
4
4
|
import { t as a } from "./booleanish-MfutDT_4.js";
|
|
5
|
-
import { t as o } from "./input-wrapper-
|
|
5
|
+
import { t as o } from "./input-wrapper-BweP6t3O.js";
|
|
6
6
|
//#region ../../node_modules/element-internals-polyfill/dist/maps.js
|
|
7
7
|
var s = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), ee = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), x = (e, t, n) => {
|
|
8
8
|
e.getAttribute(t) !== n && e.setAttribute(t, n);
|
|
@@ -467,7 +467,7 @@ var X = "on", Z = "--checked", Q = ",", $ = class extends r {
|
|
|
467
467
|
return !0;
|
|
468
468
|
}
|
|
469
469
|
constructor() {
|
|
470
|
-
super(), this.defaultValue = null, this.disabled = !1, this.readonly = !1, this.required = !1, this.max = null, this.maxlength = null, this.min = null, this.minlength = null, this.step = null, this.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = null, this.placeholder = null, this.id = i(), this.counter = !1, this.hasError = !1, this.inline = !1, this.hasFieldset = !1, this.optionalTag = !1, this.requiredTag = !1, this.skipForwardTestid = !1, this.useWrapper = !0, this.fullwidth = !1, this.counterMaxLength = 0, this.errorMessage = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = o.props.helptextDropdownButton.default, this.label = null, this.optionalText = n.forms.labels.optional, this.requiredText = n.forms.labels.required, this.tagText = null, this.dataTestid = "", this.touched = !1, this._initialized = !1, this.internals = this.attachInternals();
|
|
470
|
+
super(), this.defaultValue = null, this.disabled = !1, this.readonly = !1, this.required = !1, this.max = null, this.maxlength = null, this.min = null, this.minlength = null, this.step = null, this.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = null, this.placeholder = null, this.id = i(), this.counter = !1, this.hasError = !1, this.inline = !1, this.hasFieldset = !1, this.optionalTag = !1, this.requiredTag = !1, this.skipForwardTestid = !1, this.useWrapper = !0, this.fullwidth = !1, this.counterMaxLength = 0, this.errorMessage = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = o.props.helptextDropdownButton.default, this.label = null, this.optionalText = n.forms.labels.optional, this.requiredText = n.forms.labels.required, this.tagText = null, this.inputSize = "medium", this.dataTestid = "", this.touched = !1, this._initialized = !1, this.internals = this.attachInternals();
|
|
471
471
|
}
|
|
472
472
|
manageValidity(e) {
|
|
473
473
|
if (!e) {
|
|
@@ -653,6 +653,9 @@ e([t({
|
|
|
653
653
|
type: String,
|
|
654
654
|
reflect: !1
|
|
655
655
|
})], $.prototype, "tagText", void 0), e([t({
|
|
656
|
+
type: String,
|
|
657
|
+
attribute: "input-size"
|
|
658
|
+
})], $.prototype, "inputSize", void 0), e([t({
|
|
656
659
|
type: String,
|
|
657
660
|
attribute: "data-testid"
|
|
658
661
|
})], $.prototype, "dataTestid", void 0);
|
|
@@ -157,6 +157,18 @@ var e = {
|
|
|
157
157
|
type: "string",
|
|
158
158
|
default: "group",
|
|
159
159
|
category: "accessibility"
|
|
160
|
+
},
|
|
161
|
+
size: {
|
|
162
|
+
name: "Størrelse",
|
|
163
|
+
description: "Visuell størrelse. small: kompakt wrapper og felt (42px). xsmall: samme wrapper som small, felt 36px.",
|
|
164
|
+
attribute: "input-wrapper-size",
|
|
165
|
+
type: [
|
|
166
|
+
"small",
|
|
167
|
+
"medium",
|
|
168
|
+
"xsmall"
|
|
169
|
+
],
|
|
170
|
+
default: "medium",
|
|
171
|
+
category: "ui"
|
|
160
172
|
}
|
|
161
173
|
}
|
|
162
174
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs"),n=require("./element-with-slot-BY7Jc-q8.cjs");require("./alert-
|
|
1
|
+
const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs"),n=require("./element-with-slot-BY7Jc-q8.cjs");require("./alert-CkUnbPdA.cjs");const r=require("./icon-B8PVq2O6.cjs"),i=require("./if-defined-DrwbxQOj.cjs"),a=require("./utils-63cRpWut.cjs"),o=require("./booleanish-B9Kf0nES.cjs"),s=require("./input-wrapper-wh3fWIhk.cjs");require("./helptext-Cq5rNaAC.cjs");const c=require("./focus-modality-controller-C1ocyv2J.cjs");var l=class extends n.t{constructor(...e){super(...e),this.forId=a.n(),this.label=``,this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=s.t.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.counterError=null,this.counterPosition=`bottom`,this.optionalTag=s.t.props.optionalTag.default,this.optionalText=s.t.props.optionalText.default,this.requiredTag=s.t.props.requiredTag.default,this.requiredText=s.t.props.requiredText.default,this.tagText=null,this.hasError=s.t.props.hasError.default,this.errorMessage=``,this.disabled=s.t.props.disabled.default,this.inline=s.t.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=s.t.props.hasFieldset.default,this.role=`group`,this.useWrapper=s.t.props.useWrapper.default,this.size=`medium`,this.focusModality=new c.t(this,`.pkt-inputwrapper`)}updated(e){super.updated(e)}render(){let a={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline,"pkt-inputwrapper--small":this.size===`small`,"pkt-inputwrapper--xsmall":this.size===`xsmall`},o=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:e.d,c=()=>e.p`
|
|
2
2
|
${this.tagText?e.p`<span class=${`pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--gray`}>${this.tagText}</span>`:e.d}
|
|
3
3
|
${this.optionalTag?e.p`<span class=${`pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light`}>${this.optionalText}</span>`:e.d}
|
|
4
4
|
${this.requiredTag?e.p`<span class=${`pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige`}>${this.requiredText}</span>`:e.d}
|
|
@@ -35,15 +35,17 @@ const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs"),
|
|
|
35
35
|
`,d=()=>this.counter?e.p`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
|
|
36
36
|
${this.counterError?this.counterError:e.d} ${this.counterCurrent||0}
|
|
37
37
|
${this.counterMaxLength?`/${this.counterMaxLength}`:e.d}
|
|
38
|
-
</div>`:e.d,f=()=>this.hasError&&this.errorMessage?e.p`<pkt-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
</div>`:e.d,f=()=>this.hasError&&this.errorMessage?e.p`<div class="pkt-inputwrapper__alert-wrapper">
|
|
39
|
+
<pkt-alert
|
|
40
|
+
skin="error"
|
|
41
|
+
.size=${this.size===`medium`?`small`:`xsmall`}
|
|
42
|
+
id=${`${this.forId}-error`}
|
|
43
|
+
aria-live="assertive"
|
|
44
|
+
aria-atomic="true"
|
|
45
|
+
>
|
|
46
|
+
${r.r(this.errorMessage)}
|
|
47
|
+
</pkt-alert>
|
|
48
|
+
</div>`:e.d,p=()=>e.p`
|
|
47
49
|
${l()}
|
|
48
50
|
${u()}
|
|
49
51
|
${this.counterPosition===`top`?d():e.d}
|
|
@@ -52,4 +54,4 @@ const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs"),
|
|
|
52
54
|
${f()}
|
|
53
55
|
`;return e.p`<div class=${t.t(a)}>${this.hasFieldset?e.p`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${o}">
|
|
54
56
|
${p()}
|
|
55
|
-
</fieldset>`:e.p`<div class="pkt-inputwrapper__fieldset">${p()}</div>`}</div> `}toggleDropdown(e){this.dispatchEvent(new CustomEvent(`toggleHelpText`,{bubbles:!1,detail:{isOpen:e.detail.isOpen}}))}handleLabelClick(){this.dispatchEvent(new CustomEvent(`labelClick`,{bubbles:!0,composed:!0,detail:`label clicked`}))}};e.n([e.o({type:String})],l.prototype,`forId`,void 0),e.n([e.o({type:String})],l.prototype,`label`,void 0),e.n([e.o({type:String})],l.prototype,`helptext`,void 0),e.n([e.o({type:String})],l.prototype,`helptextDropdown`,void 0),e.n([e.o({type:String})],l.prototype,`helptextDropdownButton`,void 0),e.n([e.o({type:Boolean})],l.prototype,`counter`,void 0),e.n([e.o({type:Number})],l.prototype,`counterCurrent`,void 0),e.n([e.o({type:Number})],l.prototype,`counterMaxLength`,void 0),e.n([e.o({type:String})],l.prototype,`counterError`,void 0),e.n([e.o({type:String,reflect:!1})],l.prototype,`counterPosition`,void 0),e.n([e.o({type:Boolean})],l.prototype,`optionalTag`,void 0),e.n([e.o({type:String})],l.prototype,`optionalText`,void 0),e.n([e.o({type:Boolean})],l.prototype,`requiredTag`,void 0),e.n([e.o({type:String})],l.prototype,`requiredText`,void 0),e.n([e.o({type:String})],l.prototype,`tagText`,void 0),e.n([e.o({type:Boolean})],l.prototype,`hasError`,void 0),e.n([e.o({type:String})],l.prototype,`errorMessage`,void 0),e.n([e.o({type:Boolean})],l.prototype,`disabled`,void 0),e.n([e.o({type:Boolean})],l.prototype,`inline`,void 0),e.n([e.o({type:String})],l.prototype,`ariaDescribedby`,void 0),e.n([e.o({type:Boolean})],l.prototype,`hasFieldset`,void 0),e.n([e.o({type:String,reflect:!0})],l.prototype,`role`,void 0),e.n([e.o({type:Boolean,reflect:!0,converter:o.t})],l.prototype,`useWrapper`,void 0);try{e.s(`pkt-input-wrapper`)(l)}catch{console.warn(`Forsøker å definere <pkt-input-wrapper>, men den er allerede definert`)}var u=l;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|
|
57
|
+
</fieldset>`:e.p`<div class="pkt-inputwrapper__fieldset">${p()}</div>`}</div> `}toggleDropdown(e){this.dispatchEvent(new CustomEvent(`toggleHelpText`,{bubbles:!1,detail:{isOpen:e.detail.isOpen}}))}handleLabelClick(){this.dispatchEvent(new CustomEvent(`labelClick`,{bubbles:!0,composed:!0,detail:`label clicked`}))}};e.n([e.o({type:String})],l.prototype,`forId`,void 0),e.n([e.o({type:String})],l.prototype,`label`,void 0),e.n([e.o({type:String})],l.prototype,`helptext`,void 0),e.n([e.o({type:String})],l.prototype,`helptextDropdown`,void 0),e.n([e.o({type:String})],l.prototype,`helptextDropdownButton`,void 0),e.n([e.o({type:Boolean})],l.prototype,`counter`,void 0),e.n([e.o({type:Number})],l.prototype,`counterCurrent`,void 0),e.n([e.o({type:Number})],l.prototype,`counterMaxLength`,void 0),e.n([e.o({type:String})],l.prototype,`counterError`,void 0),e.n([e.o({type:String,reflect:!1})],l.prototype,`counterPosition`,void 0),e.n([e.o({type:Boolean})],l.prototype,`optionalTag`,void 0),e.n([e.o({type:String})],l.prototype,`optionalText`,void 0),e.n([e.o({type:Boolean})],l.prototype,`requiredTag`,void 0),e.n([e.o({type:String})],l.prototype,`requiredText`,void 0),e.n([e.o({type:String})],l.prototype,`tagText`,void 0),e.n([e.o({type:Boolean})],l.prototype,`hasError`,void 0),e.n([e.o({type:String})],l.prototype,`errorMessage`,void 0),e.n([e.o({type:Boolean})],l.prototype,`disabled`,void 0),e.n([e.o({type:Boolean})],l.prototype,`inline`,void 0),e.n([e.o({type:String})],l.prototype,`ariaDescribedby`,void 0),e.n([e.o({type:Boolean})],l.prototype,`hasFieldset`,void 0),e.n([e.o({type:String,reflect:!0})],l.prototype,`role`,void 0),e.n([e.o({type:Boolean,reflect:!0,converter:o.t})],l.prototype,`useWrapper`,void 0),e.n([e.o({type:String,attribute:`input-wrapper-size`})],l.prototype,`size`,void 0);try{e.s(`pkt-input-wrapper`)(l)}catch{console.warn(`Forsøker å definere <pkt-input-wrapper>, men den er allerede definert`)}var u=l;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|