@oslokommune/punkt-elements 17.1.0 → 17.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/{accordion-DlNfuooe.cjs → accordion-B3GBlvUC.cjs} +2 -2
- package/dist/{accordion-DZq8Dnvh.js → accordion-BeLvLPrB.js} +12 -11
- package/dist/{alert-D7YR5Ru2.cjs → alert-Cs4Rmq_J.cjs} +1 -1
- package/dist/{alert-CbN5Bfdd.js → alert-DKK_Tb9J.js} +5 -5
- package/dist/{async-directive-DaiMzAU4.js → async-directive-BPf6K-V2.js} +9 -6
- package/dist/async-directive-Da7TJpnq.cjs +1 -0
- package/dist/{backlink-CxSKQSoA.cjs → backlink-CMmrKTe4.cjs} +1 -1
- package/dist/{backlink-eAD8xH5b.js → backlink-D1y26pj3.js} +3 -3
- package/dist/{breadcrumbs-CYKfjd4Q.cjs → breadcrumbs-B6JGhJgC.cjs} +1 -1
- package/dist/{breadcrumbs-CJP75InB.js → breadcrumbs-CcTQ3Grm.js} +2 -2
- package/dist/{button-D_M6dpeU.js → button-2-OSPJkj.js} +10 -10
- package/dist/{button-o0BRKpis.cjs → button-CE97NQIk.cjs} +2 -2
- package/dist/{calendar-7_ii5p5b.cjs → calendar-kn4SrtJy.cjs} +1 -1
- package/dist/{calendar-BCUnpa_x.js → calendar-pOW3R5Pw.js} +4 -4
- package/dist/{card-Cf_jOdya.cjs → card-CETDFkxR.cjs} +3 -3
- package/dist/{card-KB9C2f1R.js → card-zQ0eKRMV.js} +9 -8
- package/dist/{checkbox-C2eVUk13.js → checkbox-CH7NpINF.js} +12 -12
- package/dist/{checkbox-Ch23npOC.cjs → checkbox-CQNr_sEg.cjs} +8 -8
- package/dist/{class-map-DzzW3MwB.cjs → class-map-BeimMvPv.cjs} +1 -1
- package/dist/{class-map-BRV7-mcj.js → class-map-CnWCnBSX.js} +2 -2
- package/dist/{combobox-Db1fB0K7.cjs → combobox-Bvg0UO9w.cjs} +1 -1
- package/dist/{combobox-dSWHF8Ii.js → combobox-CRdYYlxu.js} +30 -35
- package/dist/components/accordion/accordion.d.ts +1 -1
- package/dist/components/accordion/accordionitem.d.ts +1 -1
- package/dist/components/alert/alert.d.ts +1 -1
- package/dist/components/backlink/backlink.d.ts +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +1 -1
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/card/card.d.ts +9 -9
- package/dist/components/checkbox/checkbox.d.ts +1 -1
- package/dist/components/combobox/combobox.d.ts +1 -1
- package/dist/components/consent/consent.d.ts +1 -1
- package/dist/components/datepicker/date-tags.d.ts +1 -1
- package/dist/components/datepicker/datepicker-multiple.d.ts +1 -1
- package/dist/components/datepicker/datepicker-popup.d.ts +1 -1
- package/dist/components/datepicker/datepicker-range.d.ts +1 -1
- package/dist/components/datepicker/datepicker-single.d.ts +1 -1
- package/dist/components/datepicker/datepicker-utils.d.ts +2 -2
- package/dist/components/datepicker/datepicker.d.ts +5 -5
- package/dist/components/fileupload/fileupload-base.d.ts +1 -1
- package/dist/components/fileupload/fileupload-renderers.d.ts +2 -2
- package/dist/components/fileupload/fileupload.d.ts +1 -1
- package/dist/components/header/header-user-menu.d.ts +1 -1
- package/dist/components/header/header.d.ts +1 -1
- package/dist/components/helptext/helptext.d.ts +1 -1
- package/dist/components/icon/icon.d.ts +1 -1
- package/dist/components/input-wrapper/input-wrapper.d.ts +1 -1
- package/dist/components/link/link.d.ts +1 -1
- package/dist/components/linkcard/linkcard.d.ts +1 -1
- package/dist/components/listbox/listbox.d.ts +1 -1
- package/dist/components/loader/loader.d.ts +1 -1
- package/dist/components/messagebox/messagebox.d.ts +1 -1
- package/dist/components/modal/modal.d.ts +1 -1
- package/dist/components/progressbar/progressbar.d.ts +1 -1
- package/dist/components/radiobutton/radiobutton.d.ts +1 -1
- package/dist/components/searchinput/searchinput.d.ts +1 -1
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/tabs/tabitem.d.ts +1 -1
- package/dist/components/tabs/tabs.d.ts +1 -1
- package/dist/components/tag/tag.d.ts +1 -1
- package/dist/components/textarea/textarea.d.ts +1 -1
- package/dist/components/textinput/textinput.d.ts +1 -1
- package/dist/components/timepicker/timepicker.d.ts +1 -1
- package/dist/{consent-C57oumuq.cjs → consent-CyY3RyoC.cjs} +1 -1
- package/dist/{consent-CibGBVvV.js → consent-DZEkhgJ1.js} +2 -2
- package/dist/{consume-BiOhrhEy.js → consume-BDnMAp2g.js} +6 -6
- package/dist/{consume-DKf5SmP9.cjs → consume-Le4HztPo.cjs} +1 -1
- package/dist/converters-BJ9Fe0kW.cjs +1 -0
- package/dist/{converters-BBfsEJV5.js → converters-CkjLSYpa.js} +200 -202
- package/dist/{datepicker-D9Qr98VO.js → datepicker-ButIas85.js} +18 -17
- package/dist/{datepicker-Ci6Oj0YL.cjs → datepicker-VTqSDQk5.cjs} +3 -3
- package/dist/dialog-polyfill.esm-B-g35ove.cjs +1 -0
- package/dist/{dialog-polyfill.esm-ChZRzCVh.js → dialog-polyfill.esm-DHSvqor8.js} +2 -2
- package/dist/{directive-helpers-CEtfS19L.cjs → directive-helpers-BlAV5EQD.cjs} +1 -1
- package/dist/{directive-helpers-BXtu2yHt.js → directive-helpers-CI8YZqku.js} +2 -2
- package/dist/directives/slot-content.d.ts +1 -1
- package/dist/docs/backlink.d.ts +1 -1
- package/dist/docs/components/accordion.d.ts +1 -1
- package/dist/docs/components/alert.d.ts +1 -1
- package/dist/docs/components/backlink.d.ts +1 -1
- package/dist/docs/components/breadcrumbs.d.ts +1 -1
- package/dist/docs/components/button.d.ts +1 -1
- package/dist/docs/components/calendar.d.ts +1 -1
- package/dist/docs/components/card.d.ts +1 -1
- package/dist/docs/components/checkbox.d.ts +1 -1
- package/dist/docs/components/combobox.d.ts +1 -1
- package/dist/docs/components/comboboxdemo.d.ts +1 -1
- package/dist/docs/components/consent.d.ts +1 -1
- package/dist/docs/components/datepicker.d.ts +1 -1
- package/dist/docs/components/datepickermultiple.d.ts +1 -1
- package/dist/docs/components/event-log.d.ts +1 -1
- package/dist/docs/components/fileupload.d.ts +1 -1
- package/dist/docs/components/footer.d.ts +1 -1
- package/dist/docs/components/form-sizes.d.ts +1 -1
- package/dist/docs/components/form.d.ts +1 -1
- package/dist/docs/components/header-full.d.ts +1 -1
- package/dist/docs/components/header-global-full.d.ts +1 -1
- package/dist/docs/components/header-global.d.ts +1 -1
- package/dist/docs/components/header-menu.d.ts +1 -1
- package/dist/docs/components/header.d.ts +1 -1
- package/dist/docs/components/heading.d.ts +1 -1
- package/dist/docs/components/icon.d.ts +1 -1
- package/dist/docs/components/input-wrapper.d.ts +1 -1
- package/dist/docs/components/link.d.ts +1 -1
- package/dist/docs/components/linkcard.d.ts +1 -1
- package/dist/docs/components/loader.d.ts +1 -1
- package/dist/docs/components/messagebox.d.ts +1 -1
- package/dist/docs/components/modal.d.ts +1 -1
- package/dist/docs/components/progressbar.d.ts +1 -1
- package/dist/docs/components/radiobutton.d.ts +1 -1
- package/dist/docs/components/searchinput.d.ts +1 -1
- package/dist/docs/components/select.d.ts +1 -1
- package/dist/docs/components/slots.d.ts +1 -1
- package/dist/docs/components/tabs.d.ts +1 -1
- package/dist/docs/components/tag.d.ts +1 -1
- package/dist/docs/components/textarea.d.ts +1 -1
- package/dist/docs/components/textinput.d.ts +1 -1
- package/dist/docs/components/timepicker.d.ts +1 -1
- package/dist/docs/components/verifisering.d.ts +1 -1
- package/dist/docs/header.d.ts +1 -1
- package/dist/docs/punkt-docs.d.ts +1 -1
- package/dist/element-BA8v6S7z.cjs +2 -0
- package/dist/{element-8RsANDBG.js → element-ChsFgr_B.js} +17 -15
- package/dist/{element-with-slot-N79a3tub.cjs → element-with-slot-Bj7nm7fO.cjs} +1 -1
- package/dist/{element-with-slot-DFNWwYys.js → element-with-slot-BvG9ctC-.js} +2 -2
- package/dist/fetch-header-footer-data-CUKV0biS.cjs +1 -0
- package/dist/{fileupload-DtAujY-k.cjs → fileupload-BeWiTAoW.cjs} +8 -8
- package/dist/{fileupload-D008usH2.js → fileupload-D5IQ9HDe.js} +22 -20
- package/dist/{footer-DmBOxk43.cjs → footer-DbYQUYNR.cjs} +1 -1
- package/dist/{footer-05rSMBWl.js → footer-DrR64HiK.js} +5 -5
- package/dist/{header-Dd8_GxXA.cjs → header-ClgIac6n.cjs} +12 -12
- package/dist/{header-iug8KwEF.js → header-KvJ1mGwA.js} +47 -37
- package/dist/{header-menu-DEMDRByb.cjs → header-menu-BAsUNKSx.cjs} +3 -3
- package/dist/{header-menu-CcXQsag0.js → header-menu-hVPXsb8g.js} +9 -7
- package/dist/{heading-DbLmrGyU.cjs → heading-CFmiSuCQ.cjs} +1 -1
- package/dist/{heading-V-gyod7_.js → heading-g-_IUB5T.js} +2 -2
- package/dist/{helptext-CpaW9Zwl.cjs → helptext-CTtKJcML.cjs} +1 -1
- package/dist/{helptext-BFGNgeqw.js → helptext-DZng1D5i.js} +14 -13
- package/dist/{icon-BlJZpl2L.cjs → icon-9iwd2F2l.cjs} +1 -1
- package/dist/{icon-8ZKcRaGi.js → icon-D-LA22xD.js} +2 -2
- package/dist/if-defined-B89_ZeCj.cjs +1 -0
- package/dist/if-defined-CGzIlZ9-.js +5 -0
- package/dist/{input-element-DPXwOJeT.js → input-element-DBMNBplu.js} +10 -8
- package/dist/{input-element-CmFzbxiZ.cjs → input-element-DYmQw-fH.cjs} +1 -1
- package/dist/{input-wrapper-CrJMQj_L.js → input-wrapper-BmxNvznr.js} +32 -26
- package/dist/{input-wrapper-CohL8Onb.cjs → input-wrapper-Q-B-aBeb.cjs} +20 -20
- package/dist/{link-C-0YV0XX.js → link-D-Eqm5KH.js} +8 -7
- package/dist/{link-BQXhsaBM.cjs → link-DK7gvmnj.cjs} +2 -2
- package/dist/{linkcard-BN34yjcT.cjs → linkcard-B29cmZqh.cjs} +1 -1
- package/dist/{linkcard-DGHxt0ef.js → linkcard-zqbg7Oqm.js} +4 -4
- package/dist/{listbox-CgjhUALC.cjs → listbox-Dc4rGdPi.cjs} +2 -2
- package/dist/{listbox-CMLqAc5-.js → listbox-va_E8afs.js} +6 -10
- package/dist/{loader-DFWbjQV5.cjs → loader-CMUkVJmE.cjs} +1 -1
- package/dist/{loader-CxcWuAB7.js → loader-D_RDICnw.js} +4 -4
- package/dist/{messagebox-D0kz1ic4.cjs → messagebox-Cv8LaSxv.cjs} +1 -1
- package/dist/{messagebox-DvlF8XbD.js → messagebox-Cw-OWDya.js} +7 -6
- package/dist/{modal-BQcORqnQ.cjs → modal-BtInv031.cjs} +1 -1
- package/dist/{modal-C9pamgry.js → modal-D0t_X2dX.js} +6 -6
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +1 -1
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +1 -1
- package/dist/pkt-breadcrumbs.cjs +1 -1
- package/dist/pkt-breadcrumbs.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -1
- package/dist/pkt-footer.cjs +1 -1
- package/dist/pkt-footer.js +1 -1
- package/dist/pkt-header-menu.cjs +1 -1
- package/dist/pkt-header-menu.js +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +33 -33
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/{pkt-options-controller-sblvLBnq.js → pkt-options-controller-B77vH3PE.js} +1 -1
- package/dist/{pkt-options-controller-DeyC9FDP.cjs → pkt-options-controller-C5EBX2T0.cjs} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-searchinput.cjs +1 -1
- package/dist/pkt-searchinput.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +1 -1
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/{progressbar-DtmVoP1j.js → progressbar-CbcfLerF.js} +6 -6
- package/dist/progressbar-D5MmnQId.cjs +17 -0
- package/dist/{radiobutton-DZHVyjoe.js → radiobutton-BUnf3EPi.js} +8 -8
- package/dist/{radiobutton-CGT4kJSf.cjs → radiobutton-DpsO1F-8.cjs} +4 -4
- package/dist/ref-CQoEIIp0.cjs +1 -0
- package/dist/{ref-CkGzlsAX.js → ref-CWD6PjVd.js} +9 -7
- package/dist/{repeat-CwZAKBjZ.js → repeat-C02g7d5S.js} +13 -12
- package/dist/{repeat-C_7HwdFQ.cjs → repeat-sY6B7fAT.cjs} +1 -1
- package/dist/{searchinput-1CESdZO9.cjs → searchinput-Bh975rjX.cjs} +1 -1
- package/dist/{searchinput-Dw1LAHgD.js → searchinput-DwnjsvJ1.js} +4 -4
- package/dist/{select-Duav6lVT.cjs → select-BOJi6H6T.cjs} +1 -1
- package/dist/{select-Cb8RH7lk.js → select-DMre80qs.js} +7 -7
- package/dist/shared-utils/date-utils.d.ts +16 -16
- package/dist/shared-utils/datepicker-utils.d.ts +11 -11
- package/dist/shared-utils/device-utils.d.ts +1 -1
- package/dist/shared-utils/utils.d.ts +2 -2
- package/dist/shared-utils/value-utils.d.ts +2 -2
- package/dist/{tabs-A665GUTo.cjs → tabs-Cf9ai0FD.cjs} +2 -2
- package/dist/{tabs-BV4w4QfM.js → tabs-TvxgbrCF.js} +7 -7
- package/dist/{tag-DaRo48qb.cjs → tag-CzojNU7z.cjs} +1 -1
- package/dist/{tag-rb23IBFT.js → tag-Ds6n1LIs.js} +5 -5
- package/dist/{textarea-bLTy-JGg.cjs → textarea-BydiLM9Z.cjs} +1 -1
- package/dist/{textarea-nyH0_IkD.js → textarea-vfzIcXhX.js} +10 -10
- package/dist/{textinput-B5Gk13OB.js → textinput-CMP2jPP_.js} +8 -8
- package/dist/{textinput-D3bL7BTc.cjs → textinput-DGdicNSx.cjs} +1 -1
- package/dist/{timepicker-BH9yjtLA.js → timepicker-ClwgYywH.js} +9 -11
- package/dist/{timepicker-lv-CQ8of.cjs → timepicker-DYrnLHqN.cjs} +1 -1
- package/package.json +7 -4
- package/dist/async-directive-Cj6po9Zy.cjs +0 -1
- package/dist/converters-Cd0fPEly.cjs +0 -1
- package/dist/dialog-polyfill.esm-J-GKtwrS.cjs +0 -1
- package/dist/element-DCm4GU7z.cjs +0 -2
- package/dist/fetch-header-footer-data-xohWFmYC.cjs +0 -1
- package/dist/if-defined-DfH9X3nd.js +0 -5
- package/dist/if-defined-h7sbeYue.cjs +0 -1
- package/dist/progressbar-fnJJsQkh.cjs +0 -17
- package/dist/ref-CYXJQuCZ.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-BA8v6S7z.cjs"),t=require("./class-map-BeimMvPv.cjs"),n=require("./element-with-slot-Bj7nm7fO.cjs");require("./icon-9iwd2F2l.cjs");const r=require("./if-defined-B89_ZeCj.cjs");require("./button-CE97NQIk.cjs");const i=require("./ref-CQoEIIp0.cjs"),a=require("./booleanish-BF8l4scU.cjs"),o=require("./fetch-header-footer-data-CUKV0biS.cjs"),s=require("./focus-trap-DSv4Ifqm.cjs"),c=require("./scroll-lock-BN8lOhV5.cjs");require("./link-DK7gvmnj.cjs"),require("./textinput-DGdicNSx.cjs"),require("./searchinput-Bh975rjX.cjs"),require("./header-menu-BAsUNKSx.cjs");var l=e=>typeof e.target==`string`?{title:e.title,iconName:e.iconName,href:e.target}:{title:e.title,iconName:e.iconName,onClick:e.target},u=e=>l(e),d=e=>{if(!e)return;let t=typeof e==`string`?new Date(e):e;if(!isNaN(t.getTime()))return t.toLocaleDateString(`nb-NO`,{day:`numeric`,month:`long`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})},f=class{constructor(e,t){this.isMobile=!1,this.isTablet=!1,this.isHidden=!1,this.pauseScrollHide=!1,this.componentWidth=typeof window<`u`?window.innerWidth:0,this.lastScrollPosition=0,this.scrollLockToken=c.t(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1,this.handleScroll=()=>{if(this.getOptions().scrollBehavior!==`hide`||this.pauseScrollHide)return;let e=window.pageYOffset||document.documentElement.scrollTop;if(e<0||Math.abs(e-this.lastScrollPosition)<60)return;let t=e>this.lastScrollPosition;this.lastScrollPosition=e,t!==this.isHidden&&(this.isHidden=t,this.host.requestUpdate())},this.host=e,this.getOptions=t,e.addController(this)}hostConnected(){window.addEventListener(`scroll`,this.handleScroll)}hostDisconnected(){this.resizeObserver?.disconnect(),window.removeEventListener(`scroll`,this.handleScroll),c.n(this.scrollLockToken,!1)}observe(e){e&&(this.componentWidth=e.offsetWidth,this.refreshBreakpoints(),this.resizeObserver=new ResizeObserver(e=>{for(let t of e)this.componentWidth=t.borderBoxSize&&t.borderBoxSize.length>0?t.borderBoxSize[0].inlineSize:t.contentRect.width,this.refreshBreakpoints()}),this.resizeObserver.observe(e))}refreshBreakpoints(){let{mobileBreakpoint:e,tabletBreakpoint:t}=this.getOptions(),n=this.componentWidth<e,r=this.componentWidth<t;(n!==this.isMobile||r!==this.isTablet)&&(this.isMobile=n,this.isTablet=r,this.host.requestUpdate())}setScrollLock(e){c.n(this.scrollLockToken,e)}captureFocus(){this.lastFocusedElement=document.activeElement}flagRestoreFocus(){this.shouldRestoreFocus=!0}restoreFocus(){this.shouldRestoreFocus&&this.lastFocusedElement&&document.contains(this.lastFocusedElement)&&this.lastFocusedElement.focus(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1}},p=class extends e.t{constructor(...e){super(...e),this.canChangeRepresentation=!1,this.logoutOnClick=!1}handleChangeRepresentation(){this.dispatchEvent(new CustomEvent(`change-representation`,{bubbles:!0,composed:!0}))}handleLogout(){this.dispatchEvent(new CustomEvent(`log-out`,{bubbles:!0,composed:!0}))}handleMenuItemClick(e){`onClick`in e&&typeof e.onClick==`function`&&e.onClick()}renderLinkOrButton(n,r){let i=`href`in n,a=t.t({"pkt-user-menu__link":!0,"pkt-link-button":!i,"pkt-link":!i,"pkt-link--icon-left":!i,[r||``]:!!r});return i?e.p`
|
|
2
2
|
<pkt-link
|
|
3
3
|
icon-name=${n.iconName||e.d}
|
|
4
4
|
href=${n.href}
|
|
@@ -262,12 +262,12 @@ const e=require("./element-DCm4GU7z.cjs"),t=require("./class-map-DzzW3MwB.cjs"),
|
|
|
262
262
|
`:e.d}
|
|
263
263
|
</div>`:e.d}
|
|
264
264
|
</header>
|
|
265
|
-
`}render(){let n=this.renderHeader();
|
|
265
|
+
`}render(){let n=this.renderHeader();if(this.isFixed){let r=t.t({"pkt-header-service-spacer":!0,"pkt-header-service-spacer--compact":this.compact,"pkt-header-service-spacer--has-user":!!this.user,"pkt-header-service-spacer--mobile":this.isMobile,"pkt-header-service-spacer--tablet":this.isTablet});return e.p`
|
|
266
266
|
<div class="pkt-header-service-wrapper">
|
|
267
267
|
${n}
|
|
268
|
-
<div class=${
|
|
268
|
+
<div class=${r}></div>
|
|
269
269
|
</div>
|
|
270
|
-
|
|
270
|
+
`}return n}};e.n([e.o({type:String,attribute:`service-name`})],h.prototype,`serviceName`,void 0),e.n([e.o({type:String,attribute:`service-link`})],h.prototype,`serviceLink`,void 0),e.n([e.o({type:String,attribute:`logo-link`})],h.prototype,`logoLink`,void 0),e.n([e.o({type:String,attribute:`logo-path`})],h.prototype,`logoPath`,void 0),e.n([e.o({type:String,attribute:`search-placeholder`})],h.prototype,`searchPlaceholder`,void 0),e.n([e.o({type:String,attribute:`search-value`})],h.prototype,`searchValue`,void 0),e.n([e.o({type:Number,attribute:`mobile-breakpoint`})],h.prototype,`mobileBreakpoint`,void 0),e.n([e.o({type:Number,attribute:`tablet-breakpoint`})],h.prototype,`tabletBreakpoint`,void 0),e.n([e.o({type:String,attribute:`opened-menu`})],h.prototype,`openedMenu`,void 0),e.n([e.o({type:String,attribute:`log-out-button-placement`})],h.prototype,`logOutButtonPlacement`,void 0),e.n([e.o({type:String})],h.prototype,`position`,void 0),e.n([e.o({type:String,attribute:`scroll-behavior`})],h.prototype,`scrollBehavior`,void 0),e.n([e.o({type:String,attribute:`slot-menu-variant`})],h.prototype,`slotMenuVariant`,void 0),e.n([e.o({type:String,attribute:`slot-menu-text`})],h.prototype,`slotMenuText`,void 0),e.n([e.o({type:Boolean,attribute:`hide-logo`,converter:a.t})],h.prototype,`hideLogo`,void 0),e.n([e.o({type:Boolean,converter:a.t})],h.prototype,`compact`,void 0),e.n([e.o({type:Boolean,attribute:`show-search`,converter:a.t})],h.prototype,`showSearch`,void 0),e.n([e.o({type:Boolean,attribute:`can-change-representation`,converter:a.t})],h.prototype,`canChangeRepresentation`,void 0),e.n([e.o({type:Boolean,attribute:`has-log-out`,converter:a.t})],h.prototype,`hasLogOut`,void 0),e.n([e.o({type:Object})],h.prototype,`user`,void 0),e.n([e.o({type:Array,attribute:`user-menu`})],h.prototype,`userMenu`,void 0),e.n([e.o({type:Object})],h.prototype,`representing`,void 0),e.n([e.a()],h.prototype,`openMenu`,void 0),e.n([e.a()],h.prototype,`alignSlotRight`,void 0),e.n([e.a()],h.prototype,`alignSearchRight`,void 0);try{e.s(`pkt-header-service`)(h)}catch{console.warn(`Forsøker å definere <pkt-header-service>, men den er allerede definert`)}var g=`https://punkt-cdn.oslo.kommune.no/latest/logos/`;typeof window<`u`&&(window.pktLogoPath=window.pktLogoPath||g);var _=`pkt-header-global-menu`,v=`pkt-header-global-menu-toggle`,y=`pkt-header-global-search-panel`,b=`pkt-header-global-search-toggle`,x=class extends e.t{constructor(...e){super(...e),this.locale=`nb-NO`,this.logoLink=o.o,this.logoPath=typeof window<`u`?window.pktLogoPath:g,this.position=`fixed`,this.scrollBehavior=`hide`,this.mobileBreakpoint=768,this.tabletBreakpoint=1024,this.logOutButtonPlacement=`none`,this.showSearch=!0,this.showContact=!0,this.canChangeRepresentation=!1,this.hasLogOut=!1,this.openMenu=`none`,this.loadError=!1,this.headerAnchor={top:0,left:0,width:0},this.headerRef=i.t(),this.menuContainerRef=i.t(),this.userContainerRef=i.t(),this.chrome=new f(this,()=>({mobileBreakpoint:this.mobileBreakpoint,tabletBreakpoint:this.tabletBreakpoint,position:this.position,scrollBehavior:this.scrollBehavior})),this.handleClickOutside=e=>{let t=e.target;this.openMenu===`user`&&!t.closest(`.pkt-header-global__user-container`)&&!t.closest(`.pkt-header-global__user-menu`)&&(this.openMenu=`none`),this.openMenu===`menu`&&!t.closest(`.pkt-header-menu`)&&!t.closest(`#${v}`)&&(this.openMenu=`none`),this.openMenu===`search`&&!t.closest(`.pkt-header-global__search-panel-inner`)&&!t.closest(`#${b}`)&&(this.openMenu=`none`)},this.handleEscapeKey=e=>{e.key===`Escape`&&this.openMenu!==`none`&&(e.preventDefault(),this.chrome.flagRestoreFocus(),this.openMenu=`none`)},this.handleOverlayKeydown=e=>{if(e.key!==`Tab`)return;let t=this.activeOverlay;if(!t||!t.panel||!t.toggle)return;let{panel:n,toggle:r}=t,i=s.n(n),a=s.t();if(a&&r.contains(a)){!e.shiftKey&&i.length>0&&(e.preventDefault(),i[0].focus());return}if(i.length===0)return;let o=i[0],c=i[i.length-1],l=!e.shiftKey&&a===c,u=e.shiftKey&&a===o;(l||u)&&(e.preventDefault(),this.openMenu=`none`,this.focusToggle(r))},this.handleOverlayFocusIn=e=>{let t=this.activeOverlay;if(!t||!t.panel)return;let n=e.target;n&&(t.panel.contains(n)||t.toggle?.contains(n)||(this.openMenu=`none`))}}get isMobile(){return this.chrome.isMobile}get isTablet(){return this.chrome.isTablet}get isHidden(){return this.chrome.isHidden}connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-header-global-host`),this.data?this.emitDataLoaded(this.data):this.loadData()}disconnectedCallback(){super.disconnectedCallback(),this.abortController?.abort(),document.removeEventListener(`mousedown`,this.handleClickOutside),document.removeEventListener(`keydown`,this.handleEscapeKey),document.removeEventListener(`keydown`,this.handleOverlayKeydown),document.removeEventListener(`focusin`,this.handleOverlayFocusIn)}firstUpdated(){this.chrome.observe(this.headerRef.value)}willUpdate(e){if(super.willUpdate(e),this.openMenu===`menu`||this.openMenu===`search`){let e=this.headerRef.value?.getBoundingClientRect();e&&(this.headerAnchor={top:e.top,left:e.left,width:e.width})}}get overlayAnchorStyle(){let{top:e,left:t,width:n}=this.headerAnchor;return`--pkt-header-global-top: ${e}px; --pkt-header-global-left: ${t}px; --pkt-header-global-width: ${n}px`}updated(e){if(super.updated(e),(e.has(`mobileBreakpoint`)||e.has(`tabletBreakpoint`))&&this.chrome.refreshBreakpoints(),e.has(`dataUrl`)&&e.get(`dataUrl`)!==void 0&&!this.data&&this.loadData(),e.has(`data`)&&this.data&&this.emitDataLoaded(this.data),e.has(`openMenu`)){let t=e.get(`openMenu`);this.openMenu!==`none`&&(t===`none`||t===void 0)?(document.addEventListener(`mousedown`,this.handleClickOutside),document.addEventListener(`keydown`,this.handleEscapeKey)):this.openMenu===`none`&&t&&t!==`none`&&(document.removeEventListener(`mousedown`,this.handleClickOutside),document.removeEventListener(`keydown`,this.handleEscapeKey),this.chrome.restoreFocus());let n=t===`menu`||t===`search`,r=this.openMenu===`menu`||this.openMenu===`search`;r&&!n?(document.addEventListener(`keydown`,this.handleOverlayKeydown),document.addEventListener(`focusin`,this.handleOverlayFocusIn)):!r&&n&&(document.removeEventListener(`keydown`,this.handleOverlayKeydown),document.removeEventListener(`focusin`,this.handleOverlayFocusIn)),this.openMenu===`search`&&t!==`search`&&requestAnimationFrame(()=>{this.querySelector(`#${y} input`)?.focus()}),this.chrome.pauseScrollHide=this.openMenu!==`none`,this.chrome.setScrollLock(this.openMenu===`menu`||this.openMenu===`search`)}}async loadData(){this.abortController?.abort(),this.abortController=new AbortController,this.loadError=!1;try{let e=await o.t(this.dataUrl,this.abortController.signal);this.fetchedData=e,this.emitDataLoaded(e)}catch(e){if(e.name===`AbortError`)return;this.loadError=!0,this.dispatchEvent(new CustomEvent(`data-error`,{detail:{error:e},bubbles:!0,composed:!0}))}}emitDataLoaded(e){this.dispatchEvent(new CustomEvent(`data-loaded`,{detail:{data:e},bubbles:!0,composed:!0}))}get effectiveData(){return this.data??this.fetchedData}get localeData(){return o.n(this.effectiveData,this.locale)}get shouldHideOnScroll(){return this.scrollBehavior===`hide`}get isFixed(){return this.position===`fixed`}get isSticky(){return this.position===`sticky`}toggleMenu(e){this.openMenu===e?this.openMenu=`none`:(this.chrome.captureFocus(),this.openMenu=e)}get activeOverlay(){return this.openMenu===`menu`?{panel:this.menuContainerRef.value??null,toggle:this.querySelector(`#${v}`)}:this.openMenu===`search`?{panel:this.querySelector(`#${y}`),toggle:this.querySelector(`#${b}`)}:null}focusToggle(e){(e?.querySelector(`button`)??e)?.focus()}handleSearch(e){this.dispatchEvent(new CustomEvent(`search`,{detail:{query:e},bubbles:!0,composed:!0}))}handleLogout(){this.dispatchEvent(new CustomEvent(`log-out`,{bubbles:!0,composed:!0}))}handleChangeRepresentation(){this.dispatchEvent(new CustomEvent(`change-representation`,{bubbles:!0,composed:!0}))}get formattedLastLoggedIn(){return d(this.user?.lastLoggedIn)}get showLogoutInUserMenu(){return this.hasLogOut&&(this.logOutButtonPlacement===`userMenu`||this.logOutButtonPlacement===`both`)}handleLogoClick(e){this.dispatchEvent(new CustomEvent(`logo-click`,{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}renderLogo(){let t=e.p`
|
|
271
271
|
<pkt-icon name="oslologo" aria-hidden="true" path=${r.t(this.logoPath)}></pkt-icon>
|
|
272
272
|
`;return e.p`
|
|
273
273
|
<span class="pkt-header-global__logo">
|
|
@@ -326,8 +326,8 @@ const e=require("./element-DCm4GU7z.cjs"),t=require("./class-map-DzzW3MwB.cjs"),
|
|
|
326
326
|
>
|
|
327
327
|
${t.i18n?.search||`Søk`}
|
|
328
328
|
</pkt-button>
|
|
329
|
-
`}renderSearchPanel(n){let i=n.search;if(this.openMenu!==`search`||!this.showSearch||!i)return e.d;let a=this.searchPlaceholder??i.input.placeholder;return e.p`
|
|
330
|
-
<div class=${
|
|
329
|
+
`}renderSearchPanel(n){let i=n.search;if(this.openMenu!==`search`||!this.showSearch||!i)return e.d;let a=this.searchPlaceholder??i.input.placeholder,o=t.t({"pkt-header-global__search-panel":!0,[`pkt-header-global__search-panel--${this.overlayBreakpointClass}`]:!!this.overlayBreakpointClass});return e.p`
|
|
330
|
+
<div class=${o} id=${y} style=${this.overlayAnchorStyle}>
|
|
331
331
|
<div class="pkt-header-global__search-panel-inner">
|
|
332
332
|
<pkt-searchinput
|
|
333
333
|
appearance="global"
|
|
@@ -377,9 +377,9 @@ const e=require("./element-DCm4GU7z.cjs"),t=require("./class-map-DzzW3MwB.cjs"),
|
|
|
377
377
|
`:e.d}
|
|
378
378
|
</div>
|
|
379
379
|
</div>
|
|
380
|
-
`}get overlayBreakpointClass(){return this.isMobile?`mobile`:this.isTablet?`tablet`:``}renderMenu(){
|
|
380
|
+
`}get overlayBreakpointClass(){return this.isMobile?`mobile`:this.isTablet?`tablet`:``}renderMenu(){if(this.openMenu!==`menu`)return e.d;let n=t.t({"pkt-header-global__menu":!0,[`pkt-header-global__menu--${this.overlayBreakpointClass}`]:!!this.overlayBreakpointClass});return e.p`
|
|
381
381
|
<div
|
|
382
|
-
class=${
|
|
382
|
+
class=${n}
|
|
383
383
|
id=${_}
|
|
384
384
|
style=${this.overlayAnchorStyle}
|
|
385
385
|
${i.n(this.menuContainerRef)}
|
|
@@ -397,7 +397,7 @@ const e=require("./element-DCm4GU7z.cjs"),t=require("./class-map-DzzW3MwB.cjs"),
|
|
|
397
397
|
</nav>
|
|
398
398
|
`}
|
|
399
399
|
</div>
|
|
400
|
-
|
|
400
|
+
`}renderHeader(){let n=t.t({"pkt-header-global":!0,"pkt-header-global--mobile":this.isMobile,"pkt-header-global--tablet":this.isTablet,"pkt-header-global--fixed":this.isFixed,"pkt-header-global--sticky":this.isSticky,"pkt-header-global--scroll-to-hide":this.shouldHideOnScroll,"pkt-header-global--hidden":this.isHidden}),r=this.localeData,a=this.isMobile;return e.p`
|
|
401
401
|
<header class=${n} ${i.n(this.headerRef)}>
|
|
402
402
|
<div class="pkt-header-global__logo-area">${this.renderLogo()}</div>
|
|
403
403
|
<div class="pkt-header-global__content">
|
|
@@ -408,13 +408,13 @@ const e=require("./element-DCm4GU7z.cjs"),t=require("./class-map-DzzW3MwB.cjs"),
|
|
|
408
408
|
</div>
|
|
409
409
|
${this.renderUser()}
|
|
410
410
|
</header>
|
|
411
|
-
`}render(){let n=this.renderHeader(),r=this.localeData,i=this.renderMenu(),a=r?this.renderSearchPanel(r):e.d;
|
|
411
|
+
`}render(){let n=this.renderHeader(),r=this.localeData,i=this.renderMenu(),a=r?this.renderSearchPanel(r):e.d;if(this.isFixed){let r=t.t({"pkt-header-global-spacer":!0,"pkt-header-global-spacer--mobile":this.isMobile,"pkt-header-global-spacer--tablet":this.isTablet&&!this.isMobile,"pkt-header-global-spacer--has-user":!!this.user});return e.p`
|
|
412
412
|
<div class="pkt-header-global-wrapper">
|
|
413
413
|
${n}
|
|
414
|
-
<div class=${
|
|
414
|
+
<div class=${r}></div>
|
|
415
415
|
${a}${i}
|
|
416
416
|
</div>
|
|
417
|
-
|
|
417
|
+
`}return e.p`${n}${a}${i}`}};e.n([e.o({type:String,attribute:`data-url`})],x.prototype,`dataUrl`,void 0),e.n([e.o({type:Object,attribute:!1})],x.prototype,`data`,void 0),e.n([e.o({type:String})],x.prototype,`locale`,void 0),e.n([e.o({type:String,attribute:`logo-link`})],x.prototype,`logoLink`,void 0),e.n([e.o({type:String,attribute:`logo-path`})],x.prototype,`logoPath`,void 0),e.n([e.o({type:String,attribute:`search-placeholder`})],x.prototype,`searchPlaceholder`,void 0),e.n([e.o({type:String})],x.prototype,`position`,void 0),e.n([e.o({type:String,attribute:`scroll-behavior`})],x.prototype,`scrollBehavior`,void 0),e.n([e.o({type:Number,attribute:`mobile-breakpoint`})],x.prototype,`mobileBreakpoint`,void 0),e.n([e.o({type:Number,attribute:`tablet-breakpoint`})],x.prototype,`tabletBreakpoint`,void 0),e.n([e.o({type:String,attribute:`log-out-button-placement`})],x.prototype,`logOutButtonPlacement`,void 0),e.n([e.o({type:Boolean,attribute:`show-search`,converter:a.t})],x.prototype,`showSearch`,void 0),e.n([e.o({type:Boolean,attribute:`show-contact`,converter:a.t})],x.prototype,`showContact`,void 0),e.n([e.o({type:Boolean,attribute:`can-change-representation`,converter:a.t})],x.prototype,`canChangeRepresentation`,void 0),e.n([e.o({type:Boolean,attribute:`has-log-out`,converter:a.t})],x.prototype,`hasLogOut`,void 0),e.n([e.o({type:Object})],x.prototype,`user`,void 0),e.n([e.o({type:Array,attribute:`user-menu`})],x.prototype,`userMenu`,void 0),e.n([e.o({type:Object})],x.prototype,`representing`,void 0),e.n([e.a()],x.prototype,`openMenu`,void 0),e.n([e.a()],x.prototype,`fetchedData`,void 0),e.n([e.a()],x.prototype,`loadError`,void 0),e.n([e.a()],x.prototype,`headerAnchor`,void 0);try{e.s(`pkt-header-global`)(x)}catch{console.warn(`Forsøker å definere <pkt-header-global>, men den er allerede definert`)}var S=class extends n.t{constructor(...e){super(...e),this.type=`service`,this.searchPlaceholder=`Søk`,this.searchValue=``,this.mobileBreakpoint=768,this.tabletBreakpoint=1280,this.openedMenu=`none`,this.logOutButtonPlacement=`none`,this.position=`fixed`,this.scrollBehavior=`hide`,this.slotMenuVariant=`icon-only`,this.slotMenuText=`Meny`,this.hideLogo=!1,this.compact=!1,this.canChangeRepresentation=!1,this.hasLogOut=!1,this.showContact=!0}firstUpdated(e){super.firstUpdated(e),this.emitDeprecationWarnings()}emitDeprecationWarnings(){this.userMenuFooter!==void 0&&console.warn(`[PktHeader] userMenuFooter is deprecated. Use userMenu instead.`),this.userOptions!==void 0&&console.warn(`[PktHeader] userOptions is deprecated. Use userMenu instead.`)}get effectiveUserMenu(){let e=this.userMenu||[],t=this.userMenuFooter||[],n=this.userOptions||[];return t.length||n.length?[...e,...n,...t]:this.userMenu}renderGlobal(){return e.p`
|
|
418
418
|
<pkt-header-global
|
|
419
419
|
data-url=${r.t(this.dataUrl)}
|
|
420
420
|
locale=${r.t(this.locale)}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { a as e, d as t, n, o as r, p as i, s as a, t as o } from "./element-
|
|
2
|
-
import { t as s } from "./class-map-
|
|
3
|
-
import { n as c, t as l } from "./element-with-slot-
|
|
4
|
-
import "./icon-
|
|
5
|
-
import { t as u } from "./if-defined-
|
|
6
|
-
import "./button-
|
|
7
|
-
import { n as d, t as f } from "./ref-
|
|
1
|
+
import { a as e, d as t, n, o as r, p as i, s as a, t as o } from "./element-ChsFgr_B.js";
|
|
2
|
+
import { t as s } from "./class-map-CnWCnBSX.js";
|
|
3
|
+
import { n as c, t as l } from "./element-with-slot-BvG9ctC-.js";
|
|
4
|
+
import "./icon-D-LA22xD.js";
|
|
5
|
+
import { t as u } from "./if-defined-CGzIlZ9-.js";
|
|
6
|
+
import "./button-2-OSPJkj.js";
|
|
7
|
+
import { n as d, t as f } from "./ref-CWD6PjVd.js";
|
|
8
8
|
import { t as p } from "./booleanish-OQJTYSrw.js";
|
|
9
9
|
import { n as m, o as h, t as g } from "./fetch-header-footer-data-Pc32etrk.js";
|
|
10
10
|
import { n as _, t as v } from "./focus-trap-DG3pEuyJ.js";
|
|
11
11
|
import { n as y, t as b } from "./scroll-lock-DAbNKAUy.js";
|
|
12
|
-
import "./link-
|
|
13
|
-
import "./textinput-
|
|
14
|
-
import "./searchinput-
|
|
15
|
-
import "./header-menu-
|
|
12
|
+
import "./link-D-Eqm5KH.js";
|
|
13
|
+
import "./textinput-CMP2jPP_.js";
|
|
14
|
+
import "./searchinput-DwnjsvJ1.js";
|
|
15
|
+
import "./header-menu-hVPXsb8g.js";
|
|
16
16
|
//#region ../../shared-types/header.ts
|
|
17
17
|
var x = (e) => typeof e.target == "string" ? {
|
|
18
18
|
title: e.title,
|
|
@@ -598,18 +598,22 @@ var D = class extends l {
|
|
|
598
598
|
}
|
|
599
599
|
render() {
|
|
600
600
|
let e = this.renderHeader();
|
|
601
|
-
|
|
601
|
+
if (this.isFixed) {
|
|
602
|
+
let t = s({
|
|
603
|
+
"pkt-header-service-spacer": !0,
|
|
604
|
+
"pkt-header-service-spacer--compact": this.compact,
|
|
605
|
+
"pkt-header-service-spacer--has-user": !!this.user,
|
|
606
|
+
"pkt-header-service-spacer--mobile": this.isMobile,
|
|
607
|
+
"pkt-header-service-spacer--tablet": this.isTablet
|
|
608
|
+
});
|
|
609
|
+
return i`
|
|
602
610
|
<div class="pkt-header-service-wrapper">
|
|
603
611
|
${e}
|
|
604
|
-
<div class=${
|
|
605
|
-
"pkt-header-service-spacer": !0,
|
|
606
|
-
"pkt-header-service-spacer--compact": this.compact,
|
|
607
|
-
"pkt-header-service-spacer--has-user": !!this.user,
|
|
608
|
-
"pkt-header-service-spacer--mobile": this.isMobile,
|
|
609
|
-
"pkt-header-service-spacer--tablet": this.isTablet
|
|
610
|
-
})}></div>
|
|
612
|
+
<div class=${t}></div>
|
|
611
613
|
</div>
|
|
612
|
-
|
|
614
|
+
`;
|
|
615
|
+
}
|
|
616
|
+
return e;
|
|
613
617
|
}
|
|
614
618
|
};
|
|
615
619
|
n([r({
|
|
@@ -940,12 +944,12 @@ var k = "pkt-header-global-menu", A = "pkt-header-global-menu-toggle", j = "pkt-
|
|
|
940
944
|
renderSearchPanel(e) {
|
|
941
945
|
let n = e.search;
|
|
942
946
|
if (this.openMenu !== "search" || !this.showSearch || !n) return t;
|
|
943
|
-
let r = this.searchPlaceholder ?? n.input.placeholder
|
|
944
|
-
return i`
|
|
945
|
-
<div class=${s({
|
|
947
|
+
let r = this.searchPlaceholder ?? n.input.placeholder, a = s({
|
|
946
948
|
"pkt-header-global__search-panel": !0,
|
|
947
949
|
[`pkt-header-global__search-panel--${this.overlayBreakpointClass}`]: !!this.overlayBreakpointClass
|
|
948
|
-
})
|
|
950
|
+
});
|
|
951
|
+
return i`
|
|
952
|
+
<div class=${a} id=${j} style=${this.overlayAnchorStyle}>
|
|
949
953
|
<div class="pkt-header-global__search-panel-inner">
|
|
950
954
|
<pkt-searchinput
|
|
951
955
|
appearance="global"
|
|
@@ -1009,12 +1013,14 @@ var k = "pkt-header-global-menu", A = "pkt-header-global-menu-toggle", j = "pkt-
|
|
|
1009
1013
|
return this.isMobile ? "mobile" : this.isTablet ? "tablet" : "";
|
|
1010
1014
|
}
|
|
1011
1015
|
renderMenu() {
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
class=${s({
|
|
1016
|
+
if (this.openMenu !== "menu") return t;
|
|
1017
|
+
let e = s({
|
|
1015
1018
|
"pkt-header-global__menu": !0,
|
|
1016
1019
|
[`pkt-header-global__menu--${this.overlayBreakpointClass}`]: !!this.overlayBreakpointClass
|
|
1017
|
-
})
|
|
1020
|
+
});
|
|
1021
|
+
return i`
|
|
1022
|
+
<div
|
|
1023
|
+
class=${e}
|
|
1018
1024
|
id=${k}
|
|
1019
1025
|
style=${this.overlayAnchorStyle}
|
|
1020
1026
|
${d(this.menuContainerRef)}
|
|
@@ -1032,7 +1038,7 @@ var k = "pkt-header-global-menu", A = "pkt-header-global-menu-toggle", j = "pkt-
|
|
|
1032
1038
|
</nav>
|
|
1033
1039
|
`}
|
|
1034
1040
|
</div>
|
|
1035
|
-
|
|
1041
|
+
`;
|
|
1036
1042
|
}
|
|
1037
1043
|
renderHeader() {
|
|
1038
1044
|
let e = s({
|
|
@@ -1059,18 +1065,22 @@ var k = "pkt-header-global-menu", A = "pkt-header-global-menu-toggle", j = "pkt-
|
|
|
1059
1065
|
}
|
|
1060
1066
|
render() {
|
|
1061
1067
|
let e = this.renderHeader(), n = this.localeData, r = this.renderMenu(), a = n ? this.renderSearchPanel(n) : t;
|
|
1062
|
-
|
|
1068
|
+
if (this.isFixed) {
|
|
1069
|
+
let t = s({
|
|
1070
|
+
"pkt-header-global-spacer": !0,
|
|
1071
|
+
"pkt-header-global-spacer--mobile": this.isMobile,
|
|
1072
|
+
"pkt-header-global-spacer--tablet": this.isTablet && !this.isMobile,
|
|
1073
|
+
"pkt-header-global-spacer--has-user": !!this.user
|
|
1074
|
+
});
|
|
1075
|
+
return i`
|
|
1063
1076
|
<div class="pkt-header-global-wrapper">
|
|
1064
1077
|
${e}
|
|
1065
|
-
<div class=${
|
|
1066
|
-
"pkt-header-global-spacer": !0,
|
|
1067
|
-
"pkt-header-global-spacer--mobile": this.isMobile,
|
|
1068
|
-
"pkt-header-global-spacer--tablet": this.isTablet && !this.isMobile,
|
|
1069
|
-
"pkt-header-global-spacer--has-user": !!this.user
|
|
1070
|
-
})}></div>
|
|
1078
|
+
<div class=${t}></div>
|
|
1071
1079
|
${a}${r}
|
|
1072
1080
|
</div>
|
|
1073
|
-
|
|
1081
|
+
`;
|
|
1082
|
+
}
|
|
1083
|
+
return i`${e}${a}${r}`;
|
|
1074
1084
|
}
|
|
1075
1085
|
};
|
|
1076
1086
|
n([r({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-BA8v6S7z.cjs"),t=require("./class-map-BeimMvPv.cjs");require("./icon-9iwd2F2l.cjs"),require("./accordion-B3GBlvUC.cjs");const n=require("./booleanish-BF8l4scU.cjs"),r=require("./fetch-header-footer-data-CUKV0biS.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
2
|
<nav aria-busy="true">
|
|
3
3
|
<p class="pkt-header-menu__loading">Laster meny…</p>
|
|
4
4
|
</nav>
|
|
@@ -65,8 +65,8 @@ const e=require("./element-DCm4GU7z.cjs"),t=require("./class-map-DzzW3MwB.cjs");
|
|
|
65
65
|
<h2 class="pkt-header-menu__services-title">${t.title}</h2>
|
|
66
66
|
${this.renderServicesList(t)}
|
|
67
67
|
</div>
|
|
68
|
-
`}renderButtons(n,i){
|
|
69
|
-
<div class=${
|
|
68
|
+
`}renderButtons(n,i){if(!n||n.length===0)return e.d;let a=t.t({"pkt-header-menu__buttons":!0,"pkt-header-menu__buttons--mobile":i});return e.p`
|
|
69
|
+
<div class=${a}>
|
|
70
70
|
${n.map(t=>e.p`
|
|
71
71
|
<a
|
|
72
72
|
class="pkt-btn pkt-btn--secondary pkt-btn--icon-right pkt-btn--small"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as e, d as t, n, o as r, p as i, s as a, t as o } from "./element-
|
|
2
|
-
import { t as s } from "./class-map-
|
|
3
|
-
import "./icon-
|
|
4
|
-
import "./accordion-
|
|
1
|
+
import { a as e, d as t, n, o as r, p as i, s as a, t as o } from "./element-ChsFgr_B.js";
|
|
2
|
+
import { t as s } from "./class-map-CnWCnBSX.js";
|
|
3
|
+
import "./icon-D-LA22xD.js";
|
|
4
|
+
import "./accordion-BeLvLPrB.js";
|
|
5
5
|
import { t as c } from "./booleanish-OQJTYSrw.js";
|
|
6
6
|
import { a as l, i as u, n as d, r as f, t as p } from "./fetch-header-footer-data-Pc32etrk.js";
|
|
7
7
|
//#region src/components/header-menu/header-menu.ts
|
|
@@ -144,11 +144,13 @@ var m = class extends o {
|
|
|
144
144
|
`;
|
|
145
145
|
}
|
|
146
146
|
renderButtons(e, n) {
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
if (!e || e.length === 0) return t;
|
|
148
|
+
let r = s({
|
|
149
149
|
"pkt-header-menu__buttons": !0,
|
|
150
150
|
"pkt-header-menu__buttons--mobile": n
|
|
151
|
-
})
|
|
151
|
+
});
|
|
152
|
+
return i`
|
|
153
|
+
<div class=${r}>
|
|
152
154
|
${e.map((e) => i`
|
|
153
155
|
<a
|
|
154
156
|
class="pkt-btn pkt-btn--secondary pkt-btn--icon-right pkt-btn--small"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-BA8v6S7z.cjs"),t=require("./element-with-slot-Bj7nm7fO.cjs");var n=class extends t.t{constructor(...e){super(...e),this.size=void 0,this.level=2,this.weight=void 0,this.visuallyHidden=!1,this.align=void 0}updated(e){super.updated(e),e.has(`level`)&&((this.level<1||this.level>6)&&console.warn(`Invalid heading level: ${this.level}. Must be between 1 and 6.`),this.hasAttribute(`size`)||(this.size=this.defaultSizeForLevel),this.hasAttribute(`weight`)||(this.weight=this.defaultWeightForLevel)),!this.hasAttribute(`size`)&&this.size===void 0&&(this.size=this.defaultSizeForLevel)}get defaultSizeForLevel(){switch(this.level){case 1:return`xlarge`;case 2:return`large`;case 3:return`medium`;case 4:return`small`;case 5:case 6:return`xsmall`;default:return`medium`}}get defaultWeightForLevel(){switch(this.level){case 1:case 2:return`regular`;case 3:case 4:case 5:case 6:return`medium`;default:return`medium`}}get headingClasses(){return[`pkt-heading`,this.size&&`pkt-heading--${this.size}`,this.weight&&`pkt-heading--fw-${this.weight}`,this.visuallyHidden&&`pkt-sr-only`,this.align&&`pkt-heading--${this.align}`].filter(Boolean).join(` `)}render(){let n=this.headingClasses,r=t.n(this);switch(this.level>=1&&this.level<=6?this.level:2){case 1:return e.p`<h1 class=${n}>${r}</h1>`;case 2:return e.p`<h2 class=${n}>${r}</h2>`;case 3:return e.p`<h3 class=${n}>${r}</h3>`;case 4:return e.p`<h4 class=${n}>${r}</h4>`;case 5:return e.p`<h5 class=${n}>${r}</h5>`;case 6:return e.p`<h6 class=${n}>${r}</h6>`;default:return e.p`<h2 class=${n}>${r}</h2>`}}};e.n([e.o({type:String,reflect:!0})],n.prototype,`size`,void 0),e.n([e.o({type:Number,reflect:!0})],n.prototype,`level`,void 0),e.n([e.o({type:String,reflect:!0})],n.prototype,`weight`,void 0),e.n([e.o({type:Boolean,reflect:!0})],n.prototype,`visuallyHidden`,void 0),e.n([e.o({type:String,reflect:!0})],n.prototype,`align`,void 0);try{e.s(`pkt-heading`)(n)}catch{console.warn(`Forsøker å definere <pkt-heading>, men den er allerede definert`)}var r=n;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as e, o as t, p as n, s as r } from "./element-
|
|
2
|
-
import { n as i, t as a } from "./element-with-slot-
|
|
1
|
+
import { n as e, o as t, p as n, s as r } from "./element-ChsFgr_B.js";
|
|
2
|
+
import { n as i, t as a } from "./element-with-slot-BvG9ctC-.js";
|
|
3
3
|
//#region src/components/heading/heading.ts
|
|
4
4
|
var o = class extends a {
|
|
5
5
|
constructor(...e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-BA8v6S7z.cjs"),t=require("./class-map-BeimMvPv.cjs"),n=require("./element-with-slot-Bj7nm7fO.cjs"),r=require("./icon-9iwd2F2l.cjs"),i=require("./utils-63cRpWut.cjs"),a=require("./input-wrapper-D5PR0rJn.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,7 +1,7 @@
|
|
|
1
|
-
import { a as e, d as t, n, o as r, p as i, s as a } from "./element-
|
|
2
|
-
import { t as o } from "./class-map-
|
|
3
|
-
import { n as s, t as c } from "./element-with-slot-
|
|
4
|
-
import { r as l } from "./icon-
|
|
1
|
+
import { a as e, d as t, n, o as r, p as i, s as a } from "./element-ChsFgr_B.js";
|
|
2
|
+
import { t as o } from "./class-map-CnWCnBSX.js";
|
|
3
|
+
import { n as s, t as c } from "./element-with-slot-BvG9ctC-.js";
|
|
4
|
+
import { r as l } from "./icon-D-LA22xD.js";
|
|
5
5
|
import { n as u } from "./utils-BwF4QSrq.js";
|
|
6
6
|
import { t as d } from "./input-wrapper-D-fPaTbY.js";
|
|
7
7
|
//#region src/components/helptext/helptext.ts
|
|
@@ -10,10 +10,17 @@ var f = class extends c {
|
|
|
10
10
|
super(...e), this.forId = u(), this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = d.props.helptextDropdownButton.default, this.isHelpTextOpen = !1;
|
|
11
11
|
}
|
|
12
12
|
render() {
|
|
13
|
-
|
|
13
|
+
let e = () => {
|
|
14
|
+
let e = !this.isHelpTextOpen;
|
|
15
|
+
this.isHelpTextOpen = e, this.dispatchEvent(new CustomEvent("toggleHelpText", {
|
|
16
|
+
bubbles: !0,
|
|
17
|
+
detail: { isOpen: e }
|
|
18
|
+
}));
|
|
19
|
+
}, n = o({
|
|
14
20
|
"pkt-inputwrapper__helptext-container": !0,
|
|
15
21
|
"pkt-inputwrapper__has-helptext": this.helptext || this.helptextDropdown || this.hasSlotContent()
|
|
16
|
-
})
|
|
22
|
+
});
|
|
23
|
+
return i`${i`<div class="${n}">
|
|
17
24
|
<div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
|
|
18
25
|
<div class="pkt-contents" name="helptext">${s(this)}</div>
|
|
19
26
|
${this.helptext && l(this.helptext)}
|
|
@@ -24,13 +31,7 @@ var f = class extends c {
|
|
|
24
31
|
type="button"
|
|
25
32
|
aria-expanded=${this.isHelpTextOpen ? "true" : "false"}
|
|
26
33
|
aria-controls="${this.forId}-helptext-expandable"
|
|
27
|
-
@click=${
|
|
28
|
-
let e = !this.isHelpTextOpen;
|
|
29
|
-
this.isHelpTextOpen = e, this.dispatchEvent(new CustomEvent("toggleHelpText", {
|
|
30
|
-
bubbles: !0,
|
|
31
|
-
detail: { isOpen: e }
|
|
32
|
-
}));
|
|
33
|
-
}}
|
|
34
|
+
@click=${e}
|
|
34
35
|
>
|
|
35
36
|
<pkt-icon
|
|
36
37
|
class="pkt-btn__icon"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-BA8v6S7z.cjs");var t=class extends e.l{constructor(t){if(super(t),this.it=e.d,t.type!==e.u.CHILD)throw Error(this.constructor.directiveName+`() can only be used in child bindings`)}render(t){if(t===e.d||t==null)return this._t=void 0,this.it=t;if(t===e.f)return t;if(typeof t!=`string`)throw Error(this.constructor.directiveName+`() called with a non-string value`);if(t===this.it)return this._t;this.it=t;let n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}};t.directiveName=`unsafeHTML`,t.resultType=1;var n=e.c(t),r=class extends t{};r.directiveName=`unsafeSVG`,r.resultType=2;var i=e.c(r),a=`https://punkt-cdn.oslo.kommune.no/latest/icons/`;typeof window<`u`&&(window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch,window.pktIconPath=window.pktIconPath||a);var o=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>`,s={},c=2,l=1500,u=typeof Storage<`u`&&typeof sessionStorage<`u`,d=e=>window.pktFetch(e).then(t=>{if(!t.ok)throw Error(`Missing icon: `+e);return t.text()}),f=async(e,t=c)=>{try{return await d(e)}catch{return t>0?(await new Promise(e=>setTimeout(e,l)),f(e,t-1)):(console.error(`Failed to fetch icon: `+e),o)}},p=async(e,t)=>{let n=t+e+`.svg`;return u&&sessionStorage.getItem(n)?sessionStorage.getItem(n):n in s?s[n]:typeof window<`u`&&typeof window.pktFetch==`function`?(s[n]=f(n).then(e=>(e!==o&&u&&sessionStorage.setItem(n,e),delete s[n],e)),s[n]):o},m=class extends e.t{constructor(...e){super(...e),this.path=typeof window<`u`?window.pktIconPath:a,this.name=``,this.ariaHidden=null,this.ariaLabel=null,this.icon=i(o),this._updatedProps=[]}get effectiveAriaHidden(){return this.ariaHidden!==null&&this.ariaHidden!==void 0?this.ariaHidden===``||this.ariaHidden===`true`:!this.ariaLabel}get effectiveAriaLabel(){return this.effectiveAriaHidden?null:this.ariaLabel||this.name||null}connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-icon`)}async attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),(e===`name`||e===`path`)&&this.getIcon(this.name)}async updated(e){super.updated(e),(e.has(`name`)||e.has(`path`))&&this.getIcon(this.name),this.applyAriaToSvg()}applyAriaToSvg(){let e=this.querySelector(`svg`);if(!e)return;e.setAttribute(`aria-hidden`,String(this.effectiveAriaHidden));let t=this.effectiveAriaLabel;t?e.setAttribute(`aria-label`,t):e.removeAttribute(`aria-label`)}async getIcon(e=``){if(this._updatedProps.length>0){this.path||=typeof window<`u`?window.pktIconPath:a;try{this.icon=i(await p(this.name||``,this.path))}catch{this.icon=i(o)}this._updatedProps=[]}else this._updatedProps.includes(e)||this._updatedProps.push(e)}render(){return e.p`${this.name&&this.icon}`}};e.n([e.o({type:String,reflect:!1})],m.prototype,`path`,void 0),e.n([e.o({type:String,reflect:!0})],m.prototype,`name`,void 0),e.n([e.o({type:String,attribute:`aria-hidden`,reflect:!0})],m.prototype,`ariaHidden`,void 0),e.n([e.o({type:String,attribute:`aria-label`,reflect:!0})],m.prototype,`ariaLabel`,void 0),e.n([e.o({type:SVGElement})],m.prototype,`icon`,void 0),e.n([e.o({type:Array,noAccessor:!0})],m.prototype,`_updatedProps`,void 0);try{e.s(`pkt-icon`)(m)}catch{console.warn(`Forsøker å definere <pkt-icon>, men den er allerede definert`)}var h=m;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as e, d as t, f as n, l as r, n as i, o as a, p as o, s, t as c, u as l } from "./element-
|
|
2
|
-
//#region node_modules/lit
|
|
1
|
+
import { c as e, d as t, f as n, l as r, n as i, o as a, p as o, s, t as c, u as l } from "./element-ChsFgr_B.js";
|
|
2
|
+
//#region ../../node_modules/lit-html/directives/unsafe-html.js
|
|
3
3
|
var u = class extends r {
|
|
4
4
|
constructor(e) {
|
|
5
5
|
if (super(e), this.it = t, e.type !== l.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./element-BA8v6S7z.cjs");var t=t=>t??e.d;Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as e, o as t, r as n } from "./element-
|
|
2
|
-
import { t as r } from "./element-with-slot-
|
|
1
|
+
import { n as e, o as t, r as n } from "./element-ChsFgr_B.js";
|
|
2
|
+
import { t as r } from "./element-with-slot-BvG9ctC-.js";
|
|
3
3
|
import { n as i } from "./utils-BwF4QSrq.js";
|
|
4
4
|
import { n as a, t as o } from "./booleanish-OQJTYSrw.js";
|
|
5
5
|
import { t as s } from "./input-wrapper-D-fPaTbY.js";
|
|
@@ -489,12 +489,14 @@ var X = "on", Z = "--checked", Q = ",", $ = class extends r {
|
|
|
489
489
|
this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 }, n.forms.messages.required, e) : e.validity?.typeMismatch || e.validity?.badInput ? this.internals.setValidity({ typeMismatch: !0 }, n.forms.messages.invalid, e) : e.validity?.patternMismatch ? this.internals.setValidity({ patternMismatch: !0 }, n.forms.messages.invalidPattern, e) : e.validity?.tooShort || this.minlength && this.minlength > 0 && this.value.length < this.minlength ? this.internals.setValidity({ tooShort: !0 }, n.forms.messages.tooShort, e) : e.validity?.tooLong || this.maxlength && this.maxlength > 0 && this.value.length > this.maxlength ? this.internals.setValidity({ tooLong: !0 }, n.forms.messages.tooLong, e) : e.validity?.rangeUnderflow ? this.internals.setValidity({ rangeUnderflow: !0 }, this.min ? n.forms.messages.rangeUnderflowMin.replace("{min}", this.min?.toString()) : n.forms.messages.rangeUnderflow, e) : e.validity?.stepMismatch ? this.internals.setValidity({ stepMismatch: !0 }, n.forms.messages.invalid, e) : e.validity?.rangeOverflow ? this.internals.setValidity({ rangeOverflow: !0 }, this.max ? n.forms.messages.rangeOverflowMax.replace("{max}", this.max?.toString()) : n.forms.messages.rangeOverflow, e) : e.validity?.customError ? this.internals.setValidity({ customError: !0 }, e.validationMessage, e) : this.internals.setValidity({});
|
|
490
490
|
}
|
|
491
491
|
setFormValue(e) {
|
|
492
|
-
if (this.internals)
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
492
|
+
if (this.internals) {
|
|
493
|
+
if (Array.isArray(e)) {
|
|
494
|
+
let t = new FormData();
|
|
495
|
+
e.forEach((e) => {
|
|
496
|
+
t.append(this.name, e);
|
|
497
|
+
}), this.internals.setFormValue(t);
|
|
498
|
+
} else this.internals.setFormValue(e);
|
|
499
|
+
}
|
|
498
500
|
}
|
|
499
501
|
coordinateRadioGroup() {
|
|
500
502
|
if (!this.form || !this.name || this.type !== "radio") return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./element-DCm4GU7z.cjs"),t=require("./element-with-slot-N79a3tub.cjs"),n=require("./utils-63cRpWut.cjs"),r=require("./booleanish-BF8l4scU.cjs"),i=require("./input-wrapper-D5PR0rJn.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}get ariaDescribedBy(){return this.ariaDescribedby}set ariaDescribedBy(e){this.ariaDescribedby=e}effectiveCounter(e){return this.counter??e}effectiveHasFieldset(e){return this.hasFieldset??e}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=null,this.hasError=!1,this.inline=!1,this.hasFieldset=null,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,attribute:`aria-describedby`})],$.prototype,`ariaDescribedby`,void 0),e.n([e.o({type:String,attribute:`aria-labelledby`})],$.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,converter:r.n})],$.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,converter:r.n})],$.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 $}});
|
|
1
|
+
const e=require("./element-BA8v6S7z.cjs"),t=require("./element-with-slot-Bj7nm7fO.cjs"),n=require("./utils-63cRpWut.cjs"),r=require("./booleanish-BF8l4scU.cjs"),i=require("./input-wrapper-D5PR0rJn.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}get ariaDescribedBy(){return this.ariaDescribedby}set ariaDescribedBy(e){this.ariaDescribedby=e}effectiveCounter(e){return this.counter??e}effectiveHasFieldset(e){return this.hasFieldset??e}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=null,this.hasError=!1,this.inline=!1,this.hasFieldset=null,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,attribute:`aria-describedby`})],$.prototype,`ariaDescribedby`,void 0),e.n([e.o({type:String,attribute:`aria-labelledby`})],$.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,converter:r.n})],$.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,converter:r.n})],$.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 $}});
|