@oslokommune/punkt-elements 18.7.0 → 18.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/dist/{accordion-NO9LYXaN.cjs → accordion-CsrLQXEA.cjs} +1 -1
- package/dist/{accordion-BI-Qiznz.js → accordion-DoxhiwK-.js} +5 -5
- package/dist/{alert-HFqn-cvb.cjs → alert-DH3VqNqh.cjs} +1 -1
- package/dist/{alert-CayKowTW.js → alert-DxAGxSX_.js} +6 -6
- package/dist/{async-directive-CAZoZMez.js → async-directive-BSwJ8-GL.js} +2 -2
- package/dist/{async-directive-DlB0Sf4j.cjs → async-directive-CfPXShXu.cjs} +1 -1
- package/dist/{backlink-DYO8qA9C.cjs → backlink-CDH824db.cjs} +1 -1
- package/dist/{backlink-BHtxOlTw.js → backlink-CGc7r9CS.js} +3 -3
- package/dist/{breadcrumbs-HG9wzGtr.cjs → breadcrumbs-B37tsIoh.cjs} +1 -1
- package/dist/{breadcrumbs-BlRDuZbZ.js → breadcrumbs-DRGhIXmN.js} +2 -2
- package/dist/{button-CIb0IxTg.cjs → button-Cx6Xdp6t.cjs} +1 -1
- package/dist/{button-DWMHtdWk.js → button-D6QhHPWH.js} +5 -5
- package/dist/{calendar-CBghTpkZ.js → calendar-42o_q-jI.js} +3 -3
- package/dist/{calendar-CA1mz04B.cjs → calendar-CAwIY7x_.cjs} +1 -1
- package/dist/{card-CsSNvjZV.cjs → card-CB72gwBC.cjs} +1 -1
- package/dist/{card-PXDm9JXv.js → card-cyZE94EO.js} +6 -6
- package/dist/{checkbox-DReZOEy2.js → checkbox-C6JdANel.js} +4 -4
- package/dist/{checkbox-CMu4pF8-.cjs → checkbox-CddODhna.cjs} +1 -1
- package/dist/{class-map-BL_YL_Ed.js → class-map-DSoj1J68.js} +1 -1
- package/dist/{class-map-BEib48YL.cjs → class-map-DupQbnhE.cjs} +1 -1
- package/dist/{combobox-DcBFiuwP.js → combobox-Cqqokx73.js} +172 -128
- package/dist/combobox-N3NP77le.cjs +137 -0
- package/dist/components/combobox/combobox-base.d.ts +14 -12
- package/dist/components/combobox/combobox-handlers.d.ts +1 -0
- package/dist/components/combobox/combobox-utils.d.ts +3 -1
- package/dist/components/combobox/combobox-value.d.ts +5 -0
- package/dist/components/combobox/combobox.attributes.test.d.ts +0 -0
- package/dist/components/combobox/combobox.d.ts +31 -2
- package/dist/components/combobox/combobox.preselection.test.d.ts +0 -0
- package/dist/components/combobox/index.d.ts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/listbox/listbox.d.ts +3 -1
- package/dist/{consent-Yt1MpkUy.js → consent-CsgKWDsR.js} +2 -2
- package/dist/{consent-D1SMUJLs.cjs → consent-DnE6IPEj.cjs} +1 -1
- package/dist/{datepicker-NSWMVoGi.cjs → datepicker-BzRhOIkG.cjs} +1 -1
- package/dist/{datepicker-DboWQcrh.js → datepicker-CtSYgxMs.js} +11 -11
- package/dist/{directive-helpers-Ddr8wUxL.cjs → directive-helpers-2mcpDDv5.cjs} +1 -1
- package/dist/{directive-helpers-CohhRNQz.js → directive-helpers-ChEduoup.js} +1 -1
- package/dist/{element-DRc10X2R.cjs → element-D_mCyFeX.cjs} +1 -1
- package/dist/{element-e2MAMNEP.js → element-J8nynuVk.js} +1 -0
- package/dist/{element-with-slot-GwTT3WRD.js → element-with-slot-BOuXlWSY.js} +2 -2
- package/dist/{element-with-slot-DgtT8lCH.cjs → element-with-slot-C66Jck5e.cjs} +1 -1
- package/dist/{fileupload-BYVtnSaI.cjs → fileupload-3OtW4Xlo.cjs} +1 -1
- package/dist/{fileupload-CqxWUH0y.js → fileupload-PJWEBD88.js} +8 -8
- package/dist/{footer-YrlXRq7e.js → footer-ByAxlj9_.js} +4 -4
- package/dist/{footer-CLSihvYS.cjs → footer-Ca3DM544.cjs} +1 -1
- package/dist/{header-DsaPCLjJ.js → header-CxfDtS3Y.js} +11 -11
- package/dist/{header-DzVHM7gZ.cjs → header-D2SD2JLt.cjs} +1 -1
- package/dist/{header-menu-wcnhBSzs.cjs → header-menu-B9ABa0WW.cjs} +1 -1
- package/dist/{header-menu-DKAcUFzh.js → header-menu-CIuu8_UC.js} +4 -4
- package/dist/{heading-OfJKjUi2.cjs → heading-4ZHACOeL.cjs} +1 -1
- package/dist/{heading-C23xQS4l.js → heading-BHWdVbvN.js} +2 -2
- package/dist/{helptext-DyHzv2ZG.cjs → helptext-6HsH-I6a.cjs} +1 -1
- package/dist/{helptext-DqdOdYRj.js → helptext-BESB9Vlq.js} +4 -4
- package/dist/{icon-DBFTFd-J.cjs → icon-BzxBkRyE.cjs} +1 -1
- package/dist/{icon-jEFbKTB_.js → icon-DkVqRWbC.js} +1 -1
- package/dist/{if-defined-r8tKY4tG.js → if-defined-BILLSM7i.js} +1 -1
- package/dist/if-defined-BbUZeoaQ.cjs +1 -0
- package/dist/{input-element-kvI_5er5.cjs → input-element-DhIEFeuP.cjs} +1 -1
- package/dist/{input-element-BiUfK_gU.js → input-element-Qb0w3ChW.js} +2 -2
- package/dist/{input-wrapper-Bwh720ke.js → input-wrapper-Bg06k-cj.js} +6 -6
- package/dist/{input-wrapper-wyvCnWPp.cjs → input-wrapper-D64Qn-QH.cjs} +1 -1
- package/dist/{link-BWAhHUku.cjs → link-Bk7aDZCC.cjs} +1 -1
- package/dist/{link-BvjWWWlc.js → link-C7fOEv66.js} +4 -4
- package/dist/{linkcard-6CbGf4I_.js → linkcard-Bguo9oCv.js} +4 -4
- package/dist/{linkcard-D6fRaZSc.cjs → linkcard-rZpQuO1Z.cjs} +1 -1
- package/dist/{listbox-CsP0qbU1.js → listbox-CrQboPG6.js} +80 -63
- package/dist/listbox-kV4OO1Qa.cjs +111 -0
- package/dist/{loader-B5t78Yk7.cjs → loader-BAn68gBb.cjs} +1 -1
- package/dist/{loader-BS7EJqxD.js → loader-C3gwO0i3.js} +4 -4
- package/dist/{messagebox-Bt0IvUlD.js → messagebox-DAE59dMX.js} +4 -4
- package/dist/{messagebox-DBVUz-DN.cjs → messagebox-WH2HjT5I.cjs} +1 -1
- package/dist/{modal-C1g2fiUq.cjs → modal-DZm_fn3K.cjs} +1 -1
- package/dist/{modal-z5RzZ-fr.js → modal-DdC1_qT3.js} +5 -5
- 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 +34 -34
- 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-AFYyv3-b.cjs → pkt-options-controller-DXAAVcBJ.cjs} +1 -1
- package/dist/{pkt-options-controller-DKkmDDzT.js → pkt-options-controller-XcIgx_v1.js} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-searchinput.cjs +1 -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-BPHLC7ce.js → progressbar-D1x6MwdY.js} +5 -5
- package/dist/{progressbar-BpcsDCnG.cjs → progressbar-DsE4-qaW.cjs} +1 -1
- package/dist/{radiobutton-bGdAEz26.js → radiobutton-B2P48MMf.js} +4 -4
- package/dist/{radiobutton-B6pzZQZV.cjs → radiobutton-CdwYbHnx.cjs} +1 -1
- package/dist/{ref-BkV4Cd8U.cjs → ref-AuNEkS5a.cjs} +1 -1
- package/dist/{ref-lE1mGUOL.js → ref-DNowxdYH.js} +2 -2
- package/dist/{repeat-uBgVG8Ch.cjs → repeat-B3ksuY2F.cjs} +1 -1
- package/dist/{repeat-CCnTfedv.js → repeat-CZ1oMXnW.js} +2 -2
- package/dist/{searchinput-DrUcPajl.js → searchinput-CmyWnNr6.js} +4 -4
- package/dist/{searchinput-CiPB8xvh.cjs → searchinput-vi7twt5b.cjs} +1 -1
- package/dist/{select-ay8WHI7p.cjs → select-TAwBNhhf.cjs} +1 -1
- package/dist/{select-D7r2s7Cw.js → select-c15YAQbr.js} +7 -7
- package/dist/shared-strings/nb.d.ts +1 -0
- package/dist/{tabs-DqzPOdi9.cjs → tabs-hiTrWsXq.cjs} +1 -1
- package/dist/{tabs-DHvCjUi4.js → tabs-kxsX1ZEf.js} +4 -4
- package/dist/{tag-Cojf4jgA.cjs → tag-CGlxtBOH.cjs} +1 -1
- package/dist/{tag-D2Xvsy1i.js → tag-bztxjcF0.js} +5 -5
- package/dist/{textarea-s4IDLsBi.cjs → textarea-BHGZhMN4.cjs} +1 -1
- package/dist/{textarea-CzAL8e6L.js → textarea-BPQVrOp9.js} +9 -9
- package/dist/{textinput-B9w4jhIP.cjs → textinput-Cv4tal5W.cjs} +1 -1
- package/dist/{textinput-DT3HR9eU.js → textinput-DHGUOsIA.js} +8 -8
- package/dist/{timepicker-C-Ip5Jgl.cjs → timepicker-BBUYnYzM.cjs} +1 -1
- package/dist/{timepicker-BE0UouVr.js → timepicker-C8DHbOpM.js} +8 -8
- package/package.json +3 -3
- package/src/components/combobox/combobox-base.ts +42 -28
- package/src/components/combobox/combobox-handlers.ts +11 -5
- package/src/components/combobox/combobox-utils.ts +9 -1
- package/src/components/combobox/combobox-value.ts +32 -16
- package/src/components/combobox/combobox.accessibility.test.ts +29 -3
- package/src/components/combobox/combobox.attributes.test.ts +82 -0
- package/src/components/combobox/combobox.core.test.ts +46 -1
- package/src/components/combobox/combobox.interaction.test.ts +167 -0
- package/src/components/combobox/combobox.preselection.test.ts +271 -0
- package/src/components/combobox/combobox.ts +143 -79
- package/src/components/combobox/index.ts +6 -1
- package/src/components/index.ts +1 -0
- package/src/components/listbox/listbox.ts +56 -29
- package/dist/combobox-BZm_12qR.cjs +0 -140
- package/dist/if-defined-BeVQnl3C.cjs +0 -1
- package/dist/listbox-D95b5zAd.cjs +0 -106
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./element-DRc10X2R.cjs"),t=require("./format-B8meU8Tm.cjs"),n=require("./element-with-slot-DgtT8lCH.cjs"),r=require("./booleanish-BF8l4scU.cjs"),i=require("./utils-63cRpWut.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 n.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=i.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=null,this.label=null,this.tagText=null,this.inputSize=`medium`,this.dataTestid=``,this.touched=!1,this._initialized=!1,this._didInitDerivedState=!1,this.internals=this.attachInternals()}manageValidity(e){if(!e){console.warn(`manageValidity called without valid input element`);return}let n=this.pktStrings.get(`validation`);this.required&&!this.value?this.internals.setValidity({valueMissing:!0},n.valueMissing,e):e.validity?.typeMismatch||e.validity?.badInput?this.internals.setValidity({typeMismatch:!0},n.typeMismatch,e):e.validity?.patternMismatch?this.internals.setValidity({patternMismatch:!0},n.patternMismatch,e):e.validity?.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},n.tooShort,e):e.validity?.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},n.tooLong,e):e.validity?.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?t.t(n.rangeUnderflowMin,{min:this.min.toString()}):n.rangeUnderflow,e):e.validity?.stepMismatch?this.internals.setValidity({stepMismatch:!0},n.typeMismatch,e):e.validity?.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?t.t(n.rangeOverflowMax,{max:this.max.toString()}):n.rangeOverflow,e):e.validity?.customError?this.internals.setValidity({customError:!0},e.validationMessage,e):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`)))}willUpdate(e){super.willUpdate(e),!this._didInitDerivedState&&(this._didInitDerivedState=!0,this.form||=this.internals.form||this.closest(`form`),this.defaultChecked&&(this.checked=!0),this.id&&!this.name&&(this.name=this.id),this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null))}firstUpdated(e){if(super.firstUpdated(e),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.required&&(this.internals.ariaRequired=`true`),this.disabled&&(this.internals.ariaDisabled=`true`),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.u({type:Boolean,reflect:!0})],$.prototype,`checked`,void 0),e.n([e.u({type:Boolean})],$.prototype,`defaultChecked`,void 0),e.n([e.u({type:Boolean})],$.prototype,`multiple`,void 0),e.n([e.u({type:Boolean})],$.prototype,`range`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`type`,void 0),e.n([e.u()],$.prototype,`defaultValue`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`disabled`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`readonly`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`required`,void 0),e.n([e.u({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`max`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`maxlength`,void 0),e.n([e.u({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`min`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`minlength`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`step`,void 0),e.n([e.u({type:String,attribute:`aria-describedby`})],$.prototype,`ariaDescribedby`,void 0),e.n([e.u({type:String,attribute:`aria-labelledby`})],$.prototype,`ariaLabelledby`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`name`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`pattern`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`placeholder`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`id`,void 0),e.n([e.u({type:Boolean,converter:r.n})],$.prototype,`counter`,void 0),e.n([e.u({type:Boolean})],$.prototype,`hasError`,void 0),e.n([e.u({type:Boolean})],$.prototype,`inline`,void 0),e.n([e.u({type:Boolean,converter:r.n})],$.prototype,`hasFieldset`,void 0),e.n([e.u({type:Boolean})],$.prototype,`optionalTag`,void 0),e.n([e.u({type:Boolean})],$.prototype,`requiredTag`,void 0),e.n([e.u({type:Boolean})],$.prototype,`skipForwardTestid`,void 0),e.n([e.u({type:Boolean,reflect:!0,converter:r.t})],$.prototype,`useWrapper`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`fullwidth`,void 0),e.n([e.u({type:Number})],$.prototype,`counterMaxLength`,void 0),e.n([e.u({type:String})],$.prototype,`errorMessage`,void 0),e.n([e.u({type:String})],$.prototype,`helptext`,void 0),e.n([e.u({type:String})],$.prototype,`helptextDropdown`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`helptextDropdownButton`,void 0),e.n([e.u({type:String})],$.prototype,`label`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`optionalText`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`requiredText`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`tagText`,void 0),e.n([e.u({type:String,attribute:`input-size`})],$.prototype,`inputSize`,void 0),e.n([e.u({type:String,attribute:`data-testid`})],$.prototype,`dataTestid`,void 0),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
|
|
1
|
+
const e=require("./element-D_mCyFeX.cjs"),t=require("./format-B8meU8Tm.cjs"),n=require("./element-with-slot-C66Jck5e.cjs"),r=require("./booleanish-BF8l4scU.cjs"),i=require("./utils-63cRpWut.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 n.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=i.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=null,this.label=null,this.tagText=null,this.inputSize=`medium`,this.dataTestid=``,this.touched=!1,this._initialized=!1,this._didInitDerivedState=!1,this.internals=this.attachInternals()}manageValidity(e){if(!e){console.warn(`manageValidity called without valid input element`);return}let n=this.pktStrings.get(`validation`);this.required&&!this.value?this.internals.setValidity({valueMissing:!0},n.valueMissing,e):e.validity?.typeMismatch||e.validity?.badInput?this.internals.setValidity({typeMismatch:!0},n.typeMismatch,e):e.validity?.patternMismatch?this.internals.setValidity({patternMismatch:!0},n.patternMismatch,e):e.validity?.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},n.tooShort,e):e.validity?.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},n.tooLong,e):e.validity?.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?t.t(n.rangeUnderflowMin,{min:this.min.toString()}):n.rangeUnderflow,e):e.validity?.stepMismatch?this.internals.setValidity({stepMismatch:!0},n.typeMismatch,e):e.validity?.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?t.t(n.rangeOverflowMax,{max:this.max.toString()}):n.rangeOverflow,e):e.validity?.customError?this.internals.setValidity({customError:!0},e.validationMessage,e):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`)))}willUpdate(e){super.willUpdate(e),!this._didInitDerivedState&&(this._didInitDerivedState=!0,this.form||=this.internals.form||this.closest(`form`),this.defaultChecked&&(this.checked=!0),this.id&&!this.name&&(this.name=this.id),this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null))}firstUpdated(e){if(super.firstUpdated(e),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.required&&(this.internals.ariaRequired=`true`),this.disabled&&(this.internals.ariaDisabled=`true`),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.u({type:Boolean,reflect:!0})],$.prototype,`checked`,void 0),e.n([e.u({type:Boolean})],$.prototype,`defaultChecked`,void 0),e.n([e.u({type:Boolean})],$.prototype,`multiple`,void 0),e.n([e.u({type:Boolean})],$.prototype,`range`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`type`,void 0),e.n([e.u()],$.prototype,`defaultValue`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`disabled`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`readonly`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`required`,void 0),e.n([e.u({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`max`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`maxlength`,void 0),e.n([e.u({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`min`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`minlength`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`step`,void 0),e.n([e.u({type:String,attribute:`aria-describedby`})],$.prototype,`ariaDescribedby`,void 0),e.n([e.u({type:String,attribute:`aria-labelledby`})],$.prototype,`ariaLabelledby`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`name`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`pattern`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`placeholder`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`id`,void 0),e.n([e.u({type:Boolean,converter:r.n})],$.prototype,`counter`,void 0),e.n([e.u({type:Boolean})],$.prototype,`hasError`,void 0),e.n([e.u({type:Boolean})],$.prototype,`inline`,void 0),e.n([e.u({type:Boolean,converter:r.n})],$.prototype,`hasFieldset`,void 0),e.n([e.u({type:Boolean})],$.prototype,`optionalTag`,void 0),e.n([e.u({type:Boolean})],$.prototype,`requiredTag`,void 0),e.n([e.u({type:Boolean})],$.prototype,`skipForwardTestid`,void 0),e.n([e.u({type:Boolean,reflect:!0,converter:r.t})],$.prototype,`useWrapper`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`fullwidth`,void 0),e.n([e.u({type:Number})],$.prototype,`counterMaxLength`,void 0),e.n([e.u({type:String})],$.prototype,`errorMessage`,void 0),e.n([e.u({type:String})],$.prototype,`helptext`,void 0),e.n([e.u({type:String})],$.prototype,`helptextDropdown`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`helptextDropdownButton`,void 0),e.n([e.u({type:String})],$.prototype,`label`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`optionalText`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`requiredText`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`tagText`,void 0),e.n([e.u({type:String,attribute:`input-size`})],$.prototype,`inputSize`,void 0),e.n([e.u({type:String,attribute:`data-testid`})],$.prototype,`dataTestid`,void 0),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as e, u as t } from "./element-
|
|
1
|
+
import { n as e, u as t } from "./element-J8nynuVk.js";
|
|
2
2
|
import { t as n } from "./format-BTeSVkED.js";
|
|
3
|
-
import { t as r } from "./element-with-slot-
|
|
3
|
+
import { t as r } from "./element-with-slot-BOuXlWSY.js";
|
|
4
4
|
import { n as i, t as a } from "./booleanish-OQJTYSrw.js";
|
|
5
5
|
import { n as o } from "./utils-BwF4QSrq.js";
|
|
6
6
|
//#region ../../node_modules/element-internals-polyfill/dist/maps.js
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { _ as e, d as t, h as n, n as r, u as i } from "./element-
|
|
2
|
-
import { t as a } from "./if-defined-
|
|
1
|
+
import { _ as e, d as t, h as n, n as r, u as i } from "./element-J8nynuVk.js";
|
|
2
|
+
import { t as a } from "./if-defined-BILLSM7i.js";
|
|
3
3
|
import { t as o } from "./format-BTeSVkED.js";
|
|
4
|
-
import { r as s, t as c } from "./element-with-slot-
|
|
5
|
-
import "./alert-
|
|
6
|
-
import { r as l } from "./icon-
|
|
4
|
+
import { r as s, t as c } from "./element-with-slot-BOuXlWSY.js";
|
|
5
|
+
import "./alert-DxAGxSX_.js";
|
|
6
|
+
import { r as l } from "./icon-DkVqRWbC.js";
|
|
7
7
|
import { t as u } from "./booleanish-OQJTYSrw.js";
|
|
8
8
|
import { n as d } from "./utils-BwF4QSrq.js";
|
|
9
|
-
import "./helptext-
|
|
9
|
+
import "./helptext-BESB9Vlq.js";
|
|
10
10
|
import { t as f } from "./focus-modality-controller-Dc2S-KqR.js";
|
|
11
11
|
//#region ../../shared-utils/forms/described-by.ts
|
|
12
12
|
var p = (e) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-D_mCyFeX.cjs"),t=require("./if-defined-BbUZeoaQ.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-C66Jck5e.cjs");require("./alert-DH3VqNqh.cjs");const i=require("./icon-BzxBkRyE.cjs"),a=require("./booleanish-BF8l4scU.cjs"),o=require("./utils-63cRpWut.cjs");require("./helptext-6HsH-I6a.cjs");const s=require("./focus-modality-controller-C1ocyv2J.cjs");var c=e=>{let t=[];return e.hasHelptext&&t.push(`${e.id}-helptext`),e.hasCounter&&t.push(`${e.id}-counter-status`),e.ariaDescribedby&&t.push(e.ariaDescribedby),t.length?t.join(` `):void 0},l=e=>`${e}-counter-status`,u=(e,t)=>!!t&&t>0&&(e??0)>t,d={name:`pkt-input-wrapper`,react:`PktInputWrapper`,"css-class":`pkt-inputwrapper`,isElement:!0,isPureReact:!0,events:{toggleHelpText:{description:`Event for å vise eller skjule hjelpetekst i dropdown`}},slots:{default:{description:`Innholdet i input-wrapperen, som kan være et skjemaelement eller en annen komponent`}},props:{forId:{name:`For ID`,description:`Id-en til skjemaelementet som dette wrapper rundt`,type:`string`,required:!0,category:`tech`},label:{name:`Merkelapp`,description:`Merkelapp for skjemaelementet`,type:`string`,required:!0,category:`contents`},helptext:{name:`Hjelpetekst`,description:`Hjelpetekst for skjemaelementet`,type:`string`,category:`contents`},helptextDropdown:{name:`Hjelpetekst i dropdown`,description:`Hjelpetekst som vises i ekspanderende felt`,type:`string`,category:`contents`},helptextDropdownButton:{name:`Tekst i hjelpetekst-knapp`,description:`Tekst som vises i knappen for å vise hjelpetekst i dropdown`,default:`Les mer <span class='pkt-sr-only'>om feltet</span>`,type:`string`,category:`contents`},ariaDescribedby:{name:`aria-describedby`,description:`Id-en til elementet som beskriver skjemaelementet`,type:`string`,category:`accessibility`},counter:{name:`Teller`,description:`Teller for antall tegn i skjemaelementet`,type:`boolean`,default:!1,category:`ui`},counterCurrent:{name:`Tellerverdi`,description:`Tellerens nåværende verdi`,type:`number`,category:`ui`,showIf:{counter:!0}},counterMaxLength:{name:`Maks tegn i teller`,description:`Maks antall tegn som kan skrives i skjemaelementet`,type:`number`,category:`ui`,showIf:{counter:!0}},counterPosition:{name:`Tellerplassering`,description:`Telleren sin plassering i forhold til elementet`,type:[`top`,`bottom`],default:`bottom`,category:`ui`,showIf:{counter:!0}},optionalTag:{name:`Vise valgfritt-merking`,description:`Viser en merking som indikerer at feltet er valgfritt`,type:`boolean`,default:!1,category:`ui`},optionalText:{name:`Valgfritt-tekst`,description:`Tekst som vises i valgfritt-merkingen`,type:`string`,default:`Valgfritt`,category:`contents`},requiredTag:{name:`Vise påkrevd-merking`,description:`Viser en merking som indikerer at feltet er påkrevd`,type:`boolean`,default:!1,category:`ui`},requiredText:{name:`Påkrevd-tekst`,description:`Tekst som vises i påkrevd-merkingen`,type:`string`,default:`Må fylles ut`,category:`contents`},tagText:{type:`string`,name:`Tag-tekst`,description:`Tekst som vises i en tag ved siden av label`,category:`ui`},hasError:{name:`Feil`,description:`Indikerer at skjemaelementet har en feil`,type:`boolean`,default:!1,category:`ui`},errorMessage:{name:`Feilmelding`,description:`Feilmelding som vises når skjemaelementet har en feil`,type:`string`,category:`contents`},disabled:{name:`Deaktivert`,description:`Indikerer at skjemaelementet er deaktivert`,type:`boolean`,default:!1,category:`tech`},inline:{name:`Inline`,description:`Indikerer at skjemaelementet skal flyte sammen med sidens innhold`,type:`boolean`,default:!1,category:`ui`},hasFieldset:{name:`Er fieldset`,description:`Indikerer at innholdet er et fieldset`,type:`boolean`,default:!1,category:`ui`},useWrapper:{name:`Bruk wrapper`,description:`Indikerer om skjemaelementet skal bruke en wrapper`,type:`boolean`,displayAsFalse:!0,default:!0,category:`ui`},role:{name:`Rolle`,description:`ARIA-rolle på wrapperen. Settes ikke som standard. Bruk hasFieldset for reelle grupper.`,type:`string`,default:null,category:`accessibility`},size:{name:`Størrelse`,description:`Visuell størrelse. small: kompakt wrapper og felt (42px). xsmall: samme wrapper som small, felt 36px.`,attribute:`input-wrapper-size`,type:[`small`,`medium`,`xsmall`],default:`medium`,category:`ui`}}},f=class extends r.t{constructor(...e){super(...e),this.forId=o.n(),this.label=``,this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=d.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.counterError=null,this.counterPosition=`bottom`,this.optionalTag=d.props.optionalTag.default,this.requiredTag=d.props.requiredTag.default,this.tagText=null,this.hasError=d.props.hasError.default,this.errorMessage=``,this.disabled=d.props.disabled.default,this.inline=d.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=d.props.hasFieldset.default,this.role=null,this.useWrapper=d.props.useWrapper.default,this.size=`medium`,this.focusModality=new s.t(this)}updated(e){super.updated(e),this.classList.add(`pkt-inputwrapper`),this.classList.toggle(`pkt-inputwrapper--error`,this.hasError),this.classList.toggle(`pkt-inputwrapper--disabled`,this.disabled),this.classList.toggle(`pkt-inputwrapper--inline`,this.inline),this.classList.toggle(`pkt-inputwrapper--medium`,this.size===`medium`),this.classList.toggle(`pkt-inputwrapper--small`,this.size===`small`),this.classList.toggle(`pkt-inputwrapper--xsmall`,this.size===`xsmall`),this.role?this.setAttribute(`aria-labelledby`,`${this.forId}-label`):this.removeAttribute(`aria-labelledby`)}render(){let a=`pkt-tag pkt-tag--small pkt-tag--thin-text`,o=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:e.h,s=this.pktStrings.get(`forms`),c=()=>e._`
|
|
2
2
|
${this.tagText?e._`<span class=${a+` pkt-tag--gray`}>${this.tagText}</span>`:e.h}
|
|
3
3
|
${this.optionalTag?e._`<span class=${a+` pkt-tag--blue-light`}
|
|
4
4
|
>${this.optionalText??s.optional}</span
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-D_mCyFeX.cjs"),t=require("./class-map-DupQbnhE.cjs"),n=require("./element-with-slot-C66Jck5e.cjs"),r=require("./define-component-spec-DBNd2FJY.cjs");require("./icon-BzxBkRyE.cjs");var i={href:{type:`string`,description:`Mål-URL for lenken.`,required:!0,reactOnly:!0},className:{type:`string`,description:`CSS-klasser Punkt har satt på lenken.`,required:!0,reactOnly:!0},children:{type:`ReactNode`,description:`Innhold/label som skal rendres inni lenken.`,required:!0,reactOnly:!0},props:{type:`AnchorHTMLAttributes<HTMLAnchorElement>`,description:`Resten av anchor-attributter (f.eks. <code>onClick</code>, <code>aria-*</code>) som skal spreades på lenken.`,required:!0,reactOnly:!0}},a={name:`Egendefinert lenkekomponent`,description:`React: Funksjon for å rendre en egendefinert lenkekomponent (f.eks. Next.js Link eller React Router Link). Mottar et <code>IRenderLink</code>-objekt med href, className, children og props. Standard er et vanlig <code><a></code>-element.`,type:`(args: IRenderLink) => ReactNode`,relatedTypes:[`IRenderLink`],category:`tech`,reactOnly:!0},o={IRenderLink:{title:`IRenderLink`,description:`Objektet som sendes til <code>renderLink</code> i Link, BackLink og Breadcrumbs. Kun React — brukes til å bytte ut standard <code><a></code> med f.eks. Next.js Link eller React Router Link.`,properties:i}},s=r.t({name:`pkt-link`,react:`PktLink`,"css-class":`pkt-link`,"dark-mode":!0,isElement:!0,props:{href:{name:`URL`,description:`URL til lenken`,type:`string`,default:`#`,category:`contents`},target:{name:`Mål`,description:`Mål for lenken`,type:[`_blank`,`_self`,`_parent`,`_top`],default:`_self`,category:`tech`},iconName:{name:`Ikon`,description:`Ikon som skal vises ved siden av lenketeksten`,type:`icon`,category:`ui`},iconPosition:{name:`Ikonposisjon`,description:`Posisjonen til ikonet i forhold til lenketeksten`,type:[`left`,`right`],category:`ui`},renderLink:a},types:{...o},slots:{default:{description:`Innholdet i lenken`}}}).props,c=class extends n.t{constructor(...e){super(...e),this.href=s.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=!1,this.target=s.target.default}render(){let r={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition===`left`||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition===`right`,"pkt-link--external":this.external},i=this.target&&this.target!==`_self`?this.target:e.h;return e._`<a
|
|
2
2
|
class=${t.t(r)}
|
|
3
3
|
href=${this.href}
|
|
4
4
|
target=${i}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as e, d as t, h as n, n as r, u as i } from "./element-
|
|
2
|
-
import { t as a } from "./class-map-
|
|
3
|
-
import { r as o, t as s } from "./element-with-slot-
|
|
1
|
+
import { _ as e, d as t, h as n, n as r, u as i } from "./element-J8nynuVk.js";
|
|
2
|
+
import { t as a } from "./class-map-DSoj1J68.js";
|
|
3
|
+
import { r as o, t as s } from "./element-with-slot-BOuXlWSY.js";
|
|
4
4
|
import { t as c } from "./define-component-spec-BYOSeplU.js";
|
|
5
|
-
import "./icon-
|
|
5
|
+
import "./icon-DkVqRWbC.js";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/components/link/link.ts
|
|
8
8
|
var l = c({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as e, d as t, n, u as r } from "./element-
|
|
2
|
-
import { t as i } from "./if-defined-
|
|
3
|
-
import { r as a, t as o } from "./element-with-slot-
|
|
4
|
-
import "./icon-
|
|
1
|
+
import { _ as e, d as t, n, u as r } from "./element-J8nynuVk.js";
|
|
2
|
+
import { t as i } from "./if-defined-BILLSM7i.js";
|
|
3
|
+
import { r as a, t as o } from "./element-with-slot-BOuXlWSY.js";
|
|
4
|
+
import "./icon-DkVqRWbC.js";
|
|
5
5
|
//#region src/components/linkcard/linkcard.ts
|
|
6
6
|
var s = class extends o {
|
|
7
7
|
constructor(...e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-D_mCyFeX.cjs"),t=require("./if-defined-BbUZeoaQ.cjs"),n=require("./element-with-slot-C66Jck5e.cjs");require("./icon-BzxBkRyE.cjs");var r=class extends n.t{constructor(...e){super(...e),this.title=``,this.href=`#`,this.iconName=``,this.external=!1,this.openInNewTab=!1,this.skin=void 0}render(){let r=[`pkt-linkcard`,this.skin&&`pkt-linkcard--${this.skin}`].filter(Boolean).join(` `),i=[`pkt-linkcard__title`,this.external&&`pkt-link pkt-link--external`].filter(Boolean).join(` `),a=this.pktStrings.get(`linkcard`),o=this.openInNewTab?a.openInNewTab:``;return e._`
|
|
2
2
|
<a
|
|
3
3
|
href=${this.href}
|
|
4
4
|
class=${r}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as e, d as t, h as n, l as r, n as i, t as a, u as o } from "./element-
|
|
2
|
-
import { t as s } from "./class-map-
|
|
3
|
-
import { t as c } from "./if-defined-
|
|
4
|
-
import { t as l } from "./repeat-
|
|
1
|
+
import { _ as e, d as t, h as n, l as r, n as i, t as a, u as o } from "./element-J8nynuVk.js";
|
|
2
|
+
import { t as s } from "./class-map-DSoj1J68.js";
|
|
3
|
+
import { t as c } from "./if-defined-BILLSM7i.js";
|
|
4
|
+
import { t as l } from "./repeat-CZ1oMXnW.js";
|
|
5
5
|
import { n as u } from "./utils-BwF4QSrq.js";
|
|
6
6
|
//#region ../../shared-utils/combobox/option-utils.ts
|
|
7
7
|
var d = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label === t)) || null, f = (e, t) => {
|
|
@@ -13,6 +13,13 @@ var d = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
13
13
|
let n = t.toLowerCase();
|
|
14
14
|
return e.filter((e) => (e.fulltext || e.value + (e.label || "") + (e.prefix || "")).toLowerCase().includes(n));
|
|
15
15
|
}, m = (e) => e.value + (e.label || "") + (e.prefix || ""), h = (e, t) => t !== null && e >= t, g = (e, t) => {
|
|
16
|
+
if (!e) return "";
|
|
17
|
+
switch (t) {
|
|
18
|
+
case "prefixAndValue": return `${e.prefix || ""} ${e.value}`.trim();
|
|
19
|
+
case "value": return e.value;
|
|
20
|
+
default: return e.label || e.value;
|
|
21
|
+
}
|
|
22
|
+
}, _ = (e, t) => {
|
|
16
23
|
if (!t) return {
|
|
17
24
|
filtered: [...e],
|
|
18
25
|
suggestion: null
|
|
@@ -22,7 +29,7 @@ var d = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
22
29
|
filtered: r,
|
|
23
30
|
suggestion: r.find((e) => !e.selected && e.label?.toLowerCase().startsWith(n)) || null
|
|
24
31
|
};
|
|
25
|
-
},
|
|
32
|
+
}, v = (e, t, n, r) => {
|
|
26
33
|
if (!e.trim()) return {
|
|
27
34
|
addValueText: null,
|
|
28
35
|
userInfoMessage: ""
|
|
@@ -41,7 +48,7 @@ var d = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
41
48
|
addValueText: null,
|
|
42
49
|
userInfoMessage: ""
|
|
43
50
|
};
|
|
44
|
-
},
|
|
51
|
+
}, y = (e) => /^[\p{L} ]$/u.test(e), b = (e = 500) => {
|
|
45
52
|
let t = "", n;
|
|
46
53
|
return {
|
|
47
54
|
append: (r) => (t += r.toLowerCase(), n !== void 0 && clearTimeout(n), n = setTimeout(() => {
|
|
@@ -52,39 +59,39 @@ var d = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
52
59
|
},
|
|
53
60
|
getBuffer: () => t
|
|
54
61
|
};
|
|
55
|
-
},
|
|
62
|
+
}, x = (e, t) => {
|
|
56
63
|
let n = t.toLowerCase();
|
|
57
64
|
return e.findIndex((e) => e.textContent?.trim().toLowerCase().startsWith(n));
|
|
58
|
-
},
|
|
65
|
+
}, S = (e) => {
|
|
59
66
|
e.scrollIntoView({ block: "nearest" }), window.setTimeout(() => e.focus(), 0);
|
|
60
|
-
},
|
|
67
|
+
}, C = (e) => Array.from(e.querySelectorAll("[role=\"option\"]:not([data-disabled])") || []), w = (e) => {
|
|
61
68
|
let t = e.nextElementSibling;
|
|
62
|
-
t &&
|
|
63
|
-
},
|
|
69
|
+
t && S(t);
|
|
70
|
+
}, T = (e, t, n) => {
|
|
64
71
|
let r = e.previousElementSibling;
|
|
65
72
|
if (e.dataset.index === "0" && n) {
|
|
66
73
|
let e = t.querySelector("[role=\"searchbox\"]");
|
|
67
|
-
e &&
|
|
68
|
-
} else r &&
|
|
69
|
-
}, T = (e) => {
|
|
70
|
-
let t = S(e);
|
|
71
|
-
t[0] && x(t[0]);
|
|
74
|
+
e && S(e);
|
|
75
|
+
} else r && S(r);
|
|
72
76
|
}, E = (e) => {
|
|
73
|
-
let t =
|
|
74
|
-
|
|
75
|
-
}, D = (e
|
|
77
|
+
let t = C(e);
|
|
78
|
+
t[0] && S(t[0]);
|
|
79
|
+
}, D = (e) => {
|
|
80
|
+
let t = C(e), n = t[t.length - 1];
|
|
81
|
+
n && S(n);
|
|
82
|
+
}, O = (e, t) => {
|
|
76
83
|
if (t.disabled) return;
|
|
77
|
-
let n =
|
|
84
|
+
let n = C(e);
|
|
78
85
|
if (t.allowUserInput && t.customUserInput) {
|
|
79
86
|
let t = e.querySelector("[data-type=\"new-option\"]");
|
|
80
87
|
if (t) {
|
|
81
|
-
|
|
88
|
+
S(t);
|
|
82
89
|
return;
|
|
83
90
|
}
|
|
84
91
|
}
|
|
85
92
|
let r = n.find((e) => e.dataset.selected === "true");
|
|
86
93
|
if (r) {
|
|
87
|
-
|
|
94
|
+
S(r);
|
|
88
95
|
return;
|
|
89
96
|
}
|
|
90
97
|
if (t.includeSearch && !(document.activeElement instanceof HTMLInputElement)) {
|
|
@@ -94,29 +101,35 @@ var d = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
94
101
|
return;
|
|
95
102
|
}
|
|
96
103
|
}
|
|
97
|
-
n[0] &&
|
|
98
|
-
},
|
|
104
|
+
n[0] && S(n[0]);
|
|
105
|
+
}, k = class extends a {
|
|
99
106
|
constructor(...e) {
|
|
100
|
-
super(...e), this.id = u(), this.label = null, this.options = [], this.isOpen = !1, this.disabled = !1, this.includeSearch = !1, this.isMultiSelect = !1, this.allowUserInput = !1, this.maxIsReached = !1, this.customUserInput = null, this.searchPlaceholder = null, this.searchValue = null, this.maxLength = 0, this.userMessage = null, this._selectedOptions = 0, this.typeahead =
|
|
107
|
+
super(...e), this.id = u(), this._listboxId = u(), this.label = null, this.options = [], this.isOpen = !1, this.disabled = !1, this.includeSearch = !1, this.isMultiSelect = !1, this.allowUserInput = !1, this.maxIsReached = !1, this.customUserInput = null, this.searchPlaceholder = null, this.searchValue = null, this.maxLength = 0, this.userMessage = null, this._selectedOptions = 0, this.typeahead = b(), this._filteredOptions = [];
|
|
101
108
|
}
|
|
102
109
|
connectedCallback() {
|
|
103
|
-
super.connectedCallback()
|
|
110
|
+
super.connectedCallback();
|
|
111
|
+
let e = this.getAttribute("id");
|
|
112
|
+
e ? this.adoptHostId(e) : this.id && (this._listboxId = this.id), this.includeSearch && !this.searchValue && (this.searchValue = ""), this.options.length > 0 && this.filterOptions(), this.setAttribute("tabindex", "-1"), this.addEventListener("focus", this.focusFirstOrSelectedOption);
|
|
104
113
|
}
|
|
105
114
|
disconnectedCallback() {
|
|
106
115
|
super.disconnectedCallback(), this.typeahead.reset();
|
|
107
116
|
}
|
|
108
|
-
updated(e) {
|
|
109
|
-
(e.has("options") || e.has("searchValue")) && this.filterOptions(), super.updated(e);
|
|
110
|
-
}
|
|
111
117
|
attributeChangedCallback(e, t, n) {
|
|
112
|
-
(e === "options" || e === "search-value") && this.filterOptions(), super.attributeChangedCallback(e, t, n);
|
|
118
|
+
(e === "options" || e === "search-value") && this.filterOptions(), super.attributeChangedCallback(e, t, n), e === "id" && n && this.adoptHostId(n);
|
|
113
119
|
}
|
|
114
120
|
get _hasOptions() {
|
|
115
121
|
return this._filteredOptions.length > 0 || this.options.length > 0;
|
|
116
122
|
}
|
|
123
|
+
adoptHostId(e) {
|
|
124
|
+
this._listboxId = e, this.removeAttribute("id");
|
|
125
|
+
}
|
|
126
|
+
willUpdate(e) {
|
|
127
|
+
super.willUpdate(e), (e.has("options") || e.has("searchValue")) && this.filterOptions();
|
|
128
|
+
}
|
|
117
129
|
render() {
|
|
118
130
|
return e`
|
|
119
131
|
<div
|
|
132
|
+
id=${this._listboxId}
|
|
120
133
|
class=${s({
|
|
121
134
|
"pkt-listbox": !0,
|
|
122
135
|
"pkt-listbox__open": this.isOpen,
|
|
@@ -137,19 +150,20 @@ var d = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
137
150
|
<div aria-live="polite" class="pkt-visually-hidden">${this.userMessage}</div>
|
|
138
151
|
`;
|
|
139
152
|
}
|
|
140
|
-
renderCheckboxOrCheckIcon(t
|
|
153
|
+
renderCheckboxOrCheckIcon(t) {
|
|
141
154
|
return this.isMultiSelect ? e`
|
|
142
155
|
<input
|
|
143
156
|
class="pkt-input-check__input-checkbox"
|
|
144
157
|
type="checkbox"
|
|
145
|
-
|
|
158
|
+
inert
|
|
159
|
+
aria-hidden="true"
|
|
146
160
|
tabindex="-1"
|
|
147
161
|
value=${t.value}
|
|
148
162
|
@change=${(e) => {
|
|
149
163
|
e.stopPropagation();
|
|
150
164
|
}}
|
|
151
165
|
.checked=${t.selected}
|
|
152
|
-
|
|
166
|
+
?checked=${t.selected}
|
|
153
167
|
?disabled=${this.disabled || t.disabled || this.maxIsReached && !t.selected}
|
|
154
168
|
/>
|
|
155
169
|
` : t.selected ? e`<pkt-icon name="check-big"></pkt-icon>` : n;
|
|
@@ -182,19 +196,22 @@ var d = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
182
196
|
data-index=${r}
|
|
183
197
|
data-value=${t.value}
|
|
184
198
|
data-selected=${t.selected ? "true" : "false"}
|
|
185
|
-
|
|
199
|
+
data-disabled=${c(this.disabled || t.disabled || this.maxIsReached && !t.selected ? "true" : void 0)}
|
|
186
200
|
aria-disabled=${this.disabled || t.disabled || this.maxIsReached && !t.selected ? "true" : "false"}
|
|
187
201
|
role="option"
|
|
188
|
-
id=${`${this.
|
|
202
|
+
id=${`${this._listboxId}-${r}`}
|
|
189
203
|
>
|
|
190
|
-
${this.renderCheckboxOrCheckIcon(t
|
|
191
|
-
<span
|
|
204
|
+
${this.renderCheckboxOrCheckIcon(t)}
|
|
205
|
+
<span
|
|
206
|
+
class="pkt-listbox__option-label"
|
|
207
|
+
id=${this._listboxId + "-option-label-" + r}
|
|
208
|
+
>
|
|
192
209
|
${t.prefix ? e`<span class="pkt-listbox__option-prefix">${t.prefix}</span>` : n}
|
|
193
210
|
${t.label || t.value}
|
|
194
211
|
</span>
|
|
195
212
|
${t.description ? e`<span class="pkt-listbox__option-description pkt-txt-14-light"
|
|
196
|
-
|
|
197
|
-
|
|
213
|
+
>${t.description}</span
|
|
214
|
+
>` : n}
|
|
198
215
|
</li>
|
|
199
216
|
`)}
|
|
200
217
|
`;
|
|
@@ -279,7 +296,7 @@ var d = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
279
296
|
}
|
|
280
297
|
handleOptionKeydown(e) {
|
|
281
298
|
let t = e.currentTarget, n = t.dataset.value, r = t.dataset.type, i = t.dataset.selected === "true";
|
|
282
|
-
if (!(!
|
|
299
|
+
if (!(!C(this).length && (!this.customUserInput || !this.allowUserInput && this.customUserInput) && r !== "new-option" && r !== "searchbox")) switch (e.key) {
|
|
283
300
|
case " ":
|
|
284
301
|
case "Enter":
|
|
285
302
|
this.toggleOption(t), e.preventDefault();
|
|
@@ -294,30 +311,30 @@ var d = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
294
311
|
this.tabClose();
|
|
295
312
|
break;
|
|
296
313
|
case "ArrowDown":
|
|
297
|
-
e.altKey ?
|
|
314
|
+
e.altKey ? D(this) : r === "searchbox" || r === "new-option" ? E(this) : w(t), e.preventDefault();
|
|
298
315
|
break;
|
|
299
316
|
case "ArrowUp":
|
|
300
|
-
if (e.altKey)
|
|
317
|
+
if (e.altKey) E(this);
|
|
301
318
|
else if (t.dataset.index === "0" && this.includeSearch) {
|
|
302
319
|
let e = this.querySelector("[role=\"searchbox\"]");
|
|
303
320
|
e && e.focus();
|
|
304
321
|
} else if (t.dataset.index === "0" && this.customUserInput) {
|
|
305
322
|
let e = this.querySelector("[data-type=\"new-option\"]");
|
|
306
323
|
e && e.focus();
|
|
307
|
-
} else
|
|
324
|
+
} else T(t, this, this.includeSearch);
|
|
308
325
|
e.preventDefault();
|
|
309
326
|
break;
|
|
310
327
|
case "Home":
|
|
311
|
-
|
|
328
|
+
E(this), e.preventDefault();
|
|
312
329
|
break;
|
|
313
330
|
case "End":
|
|
314
|
-
|
|
331
|
+
D(this), e.preventDefault();
|
|
315
332
|
break;
|
|
316
|
-
default: (e.metaKey || e.ctrlKey) && e.key === "a" && (this.selectAll(), e.preventDefault()),
|
|
333
|
+
default: (e.metaKey || e.ctrlKey) && e.key === "a" && (this.selectAll(), e.preventDefault()), y(e.key) && (this.handleTypeAhead(e.key), e.preventDefault());
|
|
317
334
|
}
|
|
318
335
|
}
|
|
319
336
|
focusFirstOrSelectedOption() {
|
|
320
|
-
|
|
337
|
+
O(this, {
|
|
321
338
|
disabled: this.disabled,
|
|
322
339
|
allowUserInput: this.allowUserInput,
|
|
323
340
|
customUserInput: this.customUserInput,
|
|
@@ -346,49 +363,49 @@ var d = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
346
363
|
this._filteredOptions = p(this.options, this.searchValue);
|
|
347
364
|
}
|
|
348
365
|
handleTypeAhead(e) {
|
|
349
|
-
let t = this.typeahead.append(e), n =
|
|
350
|
-
r >= 0 &&
|
|
366
|
+
let t = this.typeahead.append(e), n = C(this), r = x(n, t);
|
|
367
|
+
r >= 0 && S(n[r]);
|
|
351
368
|
}
|
|
352
369
|
};
|
|
353
|
-
i([o({ type: String })],
|
|
370
|
+
i([o({ type: String })], k.prototype, "id", void 0), i([r()], k.prototype, "_listboxId", void 0), i([o({ type: String })], k.prototype, "label", void 0), i([o({ type: Array })], k.prototype, "options", void 0), i([o({
|
|
354
371
|
type: Boolean,
|
|
355
372
|
reflect: !0,
|
|
356
373
|
attribute: "is-open"
|
|
357
|
-
})],
|
|
374
|
+
})], k.prototype, "isOpen", void 0), i([o({ type: Boolean })], k.prototype, "disabled", void 0), i([o({
|
|
358
375
|
type: Boolean,
|
|
359
376
|
attribute: "include-search"
|
|
360
|
-
})],
|
|
377
|
+
})], k.prototype, "includeSearch", void 0), i([o({
|
|
361
378
|
type: Boolean,
|
|
362
379
|
attribute: "is-multi-select"
|
|
363
|
-
})],
|
|
380
|
+
})], k.prototype, "isMultiSelect", void 0), i([o({
|
|
364
381
|
type: Boolean,
|
|
365
382
|
attribute: "allow-user-input"
|
|
366
|
-
})],
|
|
383
|
+
})], k.prototype, "allowUserInput", void 0), i([o({
|
|
367
384
|
type: Boolean,
|
|
368
385
|
attribute: "max-is-reached"
|
|
369
|
-
})],
|
|
386
|
+
})], k.prototype, "maxIsReached", void 0), i([o({
|
|
370
387
|
type: String,
|
|
371
388
|
attribute: "custom-user-input"
|
|
372
|
-
})],
|
|
389
|
+
})], k.prototype, "customUserInput", void 0), i([o({
|
|
373
390
|
type: String,
|
|
374
391
|
attribute: "search-placeholder"
|
|
375
|
-
})],
|
|
392
|
+
})], k.prototype, "searchPlaceholder", void 0), i([o({
|
|
376
393
|
type: String,
|
|
377
394
|
attribute: "search-value"
|
|
378
|
-
})],
|
|
395
|
+
})], k.prototype, "searchValue", void 0), i([o({
|
|
379
396
|
type: Number,
|
|
380
397
|
attribute: "max-length"
|
|
381
|
-
})],
|
|
398
|
+
})], k.prototype, "maxLength", void 0), i([o({
|
|
382
399
|
type: String,
|
|
383
400
|
attribute: "user-message"
|
|
384
|
-
})],
|
|
401
|
+
})], k.prototype, "userMessage", void 0), i([r()], k.prototype, "_filteredOptions", void 0);
|
|
385
402
|
try {
|
|
386
|
-
t("pkt-listbox")(
|
|
403
|
+
t("pkt-listbox")(k);
|
|
387
404
|
} catch {
|
|
388
405
|
console.warn("Forsøker å definere <pkt-listbox>, men den er allerede definert");
|
|
389
406
|
}
|
|
390
407
|
//#endregion
|
|
391
408
|
//#region src/components/listbox/index.ts
|
|
392
|
-
var
|
|
409
|
+
var A = k;
|
|
393
410
|
//#endregion
|
|
394
|
-
export { f as a,
|
|
411
|
+
export { f as a, v as c, d as i, h as l, k as n, _ as o, m as r, g as s, A as t };
|