@oslokommune/punkt-elements 14.3.0 → 14.5.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 +34 -0
- package/dist/{accordionitem-C_URrDjP.js → accordionitem-DB3tAjIZ.js} +4 -4
- package/dist/{accordionitem-DCZrHVNR.cjs → accordionitem-DHYmPA-o.cjs} +1 -1
- package/dist/{alert-UFQFbbzZ.js → alert-DqXar67l.js} +6 -6
- package/dist/{alert-SvqEDHuW.cjs → alert-GrKyqxuR.cjs} +1 -1
- package/dist/{backlink-C7qUmUzs.js → backlink-CqUcmiPQ.js} +11 -11
- package/dist/{backlink-BrIIpgJ7.cjs → backlink-QDcQd6vK.cjs} +1 -1
- package/dist/{button-DaM4jvhJ.cjs → button-R4l10Nqd.cjs} +1 -1
- package/dist/{button-CjXih_Nx.js → button-f36menSU.js} +5 -5
- package/dist/{calendar-CvfMj3fA.js → calendar-DiNuZ8Ai.js} +7 -8
- package/dist/{calendar-ZzLAjDpv.cjs → calendar-wuD6ZH0t.cjs} +3 -3
- package/dist/{card-C1gRTfXb.cjs → card-C2hWaMev.cjs} +1 -1
- package/dist/{card-CO3D8wQE.js → card-CnINxZma.js} +7 -7
- package/dist/{checkbox-C0TPnShf.cjs → checkbox-B-0FOdwi.cjs} +1 -1
- package/dist/{checkbox-CnhA52o_.js → checkbox-CkAwPK_E.js} +4 -4
- package/dist/{class-map-C_erArZz.cjs → class-map-CApIYSRo.cjs} +1 -1
- package/dist/{class-map-wy7PUk0P.js → class-map-Dt2jXOlF.js} +1 -1
- package/dist/{combobox-Dcp_fHcL.js → combobox-Dxa7XjLz.js} +55 -55
- package/dist/{combobox-C1xwAju5.cjs → combobox-yy6hIGmB.cjs} +13 -13
- package/dist/{consent-Daj-Xa7w.cjs → consent-FbFS1pmz.cjs} +1 -1
- package/dist/{consent-BO3Ga8N4.js → consent-c9PhWxnP.js} +3 -3
- package/dist/{datepicker-Bjb9GK1E.js → datepicker-C7GWMtXH.js} +222 -241
- package/dist/{datepicker-COIRRau0.cjs → datepicker-D_3vYgMt.cjs} +25 -25
- package/dist/{directive-helpers-BzAtj9by.js → directive-helpers-CQef4qUQ.js} +1 -1
- package/dist/{directive-helpers-4oOjKnGY.cjs → directive-helpers-CYIEJ8pI.cjs} +1 -1
- package/dist/{element-CRDRygXu.js → element-BXsf_NlG.js} +3 -3
- package/dist/{element-CJ_QKaki.cjs → element-aUzIoa1s.cjs} +3 -3
- package/dist/{heading-Dv_cH6N1.cjs → heading-CBepYb7H.cjs} +1 -1
- package/dist/{heading-BUdy170t.js → heading-J7dN9nRi.js} +13 -13
- package/dist/{helptext-hlcc584n.cjs → helptext-DebHGRsD.cjs} +1 -1
- package/dist/{helptext-Bn17Picx.js → helptext-DuyRRfCn.js} +5 -5
- package/dist/{icon-BB7e5iQN.js → icon-BgG6oO4Q.js} +1 -1
- package/dist/{icon-MRx-m0Or.cjs → icon-Dl9ZPqe6.cjs} +1 -1
- package/dist/{if-defined-Bc9-_I01.cjs → if-defined-BElHLTlB.cjs} +1 -1
- package/dist/{if-defined-BWZGb3bh.js → if-defined-CxHgig4I.js} +1 -1
- package/dist/index.d.ts +213 -55
- package/dist/input-element-DVZhYDJ_.js +840 -0
- package/dist/input-element-RBQVA8i0.cjs +1 -0
- package/dist/{input-wrapper-1PCXqtiu.js → input-wrapper-3qfjLkrP.js} +7 -7
- package/dist/{input-wrapper-CtBiAb04.cjs → input-wrapper-rgXsRNkk.cjs} +1 -1
- package/dist/{link-BboUBUcg.js → link-CZvcdRek.js} +4 -4
- package/dist/{link-Dw39h-YN.cjs → link-D85g20GS.cjs} +1 -1
- package/dist/{linkcard-DUA3kGGd.cjs → linkcard-B-9K02q8.cjs} +1 -1
- package/dist/{linkcard-BqJmHFu8.js → linkcard-C3RTcMqc.js} +4 -4
- package/dist/{listbox-mvKKzH-v.js → listbox-CLtowV6W.js} +36 -36
- package/dist/{listbox-DnoqOo5u.cjs → listbox-C_0RhGhk.cjs} +2 -2
- package/dist/{loader-DjGxT7C3.cjs → loader-1EXLdxfq.cjs} +1 -1
- package/dist/{loader-DIum_s_D.js → loader-Dci0SrOz.js} +5 -5
- package/dist/{messagebox-aPlConlJ.js → messagebox-CnZlttZp.js} +5 -5
- package/dist/{messagebox-ChIKVTO_.cjs → messagebox-dscnWgCd.cjs} +1 -1
- package/dist/{modal-B4qq0VFB.cjs → modal-ncKVjcyZ.cjs} +1 -1
- package/dist/{modal-jAUtM-NP.js → modal-wSGthXAC.js} +5 -5
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -2
- 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-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 +2 -2
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +9 -9
- 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 -29
- package/dist/pkt-index.js +60 -157
- 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-DjBCEHU4.cjs +1 -0
- package/dist/{pkt-options-controller-CZO1nxZ8.js → pkt-options-controller-zn5cmMvL.js} +3 -3
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -2
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.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 +2 -2
- 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/{progressbar-CmAQ-DVW.cjs → progressbar-ClY1WgnM.cjs} +1 -1
- package/dist/{progressbar-CVt73-JQ.js → progressbar-D5WBW1Dm.js} +5 -5
- package/dist/{radiobutton-BkqaqO5E.cjs → radiobutton-iHuLnuAn.cjs} +1 -1
- package/dist/{radiobutton-Caq8-GhM.js → radiobutton-oA20HijB.js} +15 -15
- package/dist/{ref-Xa5dbh--.js → ref-BxiKhrfa.js} +2 -2
- package/dist/{ref-BFa5Utho.cjs → ref-C5iJMIE1.cjs} +1 -1
- package/dist/{repeat-CJ79egkN.js → repeat-B55jMEsG.js} +2 -2
- package/dist/{repeat-BZb41H64.cjs → repeat-DcYSFU2y.cjs} +1 -1
- package/dist/select-Bug9sfr5.js +228 -0
- package/dist/select-jbIbD7hW.cjs +49 -0
- package/dist/{state-DS_kr2Fy.js → state-DgnkjP0q.js} +1 -1
- package/dist/{state-DSjcvzDN.cjs → state-GDzxl12x.cjs} +1 -1
- package/dist/{tabitem-D5zyipN1.cjs → tabitem-CtltSqDK.cjs} +1 -1
- package/dist/{tabitem-NV2fzs_-.js → tabitem-CypTmORF.js} +30 -30
- package/dist/{tag-B02fKJ66.cjs → tag-BfjOlIyS.cjs} +1 -1
- package/dist/{tag-CES41g0D.js → tag-DgoTYNVA.js} +6 -6
- package/dist/{textarea-a6T4aJJU.js → textarea-Da9E3RM7.js} +9 -9
- package/dist/{textarea-DyUy8u7X.cjs → textarea-Dfa4_ZBy.cjs} +1 -1
- package/dist/{textinput-IN3b0nSH.cjs → textinput-CLM9fRjm.cjs} +1 -1
- package/dist/{textinput-DIuM70dd.js → textinput-DaMYc5gd.js} +8 -8
- package/package.json +2 -2
- package/src/components/checkbox/checkbox.ts +1 -1
- package/src/components/combobox/combobox.ts +2 -2
- package/src/components/datepicker/datepicker-utils.test.ts +0 -25
- package/src/components/datepicker/datepicker-utils.ts +0 -28
- package/src/components/datepicker/datepicker.ts +0 -6
- package/src/components/header/header.ts +2 -0
- package/src/components/index.ts +0 -1
- package/src/components/radiobutton/radiobutton.ts +1 -1
- package/src/components/select/select.ts +14 -47
- package/src/components/textarea/textarea.ts +1 -1
- package/src/components/textinput/textinput.ts +1 -1
- package/dist/input-element-B8M8Nppd.js +0 -708
- package/dist/input-element-D697OAJo.cjs +0 -1
- package/dist/pkt-options-controller-CiuBG6Lt.cjs +0 -1
- package/dist/select-3dwlk22G.cjs +0 -49
- package/dist/select-_C-yztI0.js +0 -173
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("./element-CJ_QKaki.cjs"),Ve=require("./state-DSjcvzDN.cjs"),Ce=require("./utils-byXsEz1u.cjs"),Fe=require("./booleanish-BKVonob4.cjs"),Te=require("./input-wrapper-EoSAbU-U.cjs");var ne={},oe;function Se(){return oe||(oe=1,(function(){(function(E){const s=new WeakMap,h=new WeakMap,p=new WeakMap,u=new WeakMap,y=new WeakMap,k=new WeakMap,C=new WeakMap,g=new WeakMap,F=new WeakMap,V=new WeakMap,T=new WeakMap,S=new WeakMap,$=new WeakMap,U=new WeakMap,x=new WeakMap,I={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",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"},le=(t,e)=>{for(let i in I){e[i]=null;let a=null;const n=I[i];Object.defineProperty(e,i,{get(){return a},set(o){a=o,t.isConnected?M(t,n,o):V.set(t,e)}})}};function z(t){const e=u.get(t),{form:i}=e;X(t,i,e),Q(t,e.labels)}const K=(t,e=!1)=>{const i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(o){return u.has(o)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let a=i.nextNode();const n=!e||t.disabled;for(;a;)a.formDisabledCallback&&n&&W(a,t.disabled),a=i.nextNode()},j={attributes:!0,attributeFilter:["disabled","name"]},L=O()?new MutationObserver(t=>{for(const e of t){const i=e.target;if(e.attributeName==="disabled"&&(i.constructor.formAssociated?W(i,i.hasAttribute("disabled")):i.localName==="fieldset"&&K(i)),e.attributeName==="name"&&i.constructor.formAssociated){const a=u.get(i),n=F.get(i);a.setFormValue(n)}}}):{};function D(t){t.forEach(e=>{const{addedNodes:i,removedNodes:a}=e,n=Array.from(i),o=Array.from(a);n.forEach(l=>{var m;if(u.has(l)&&l.constructor.formAssociated&&z(l),V.has(l)){const f=V.get(l);Object.keys(I).filter(b=>f[b]!==null).forEach(b=>{M(l,I[b],f[b])}),V.delete(l)}if(x.has(l)){const f=x.get(l);M(l,"internals-valid",f.validity.valid.toString()),M(l,"internals-invalid",(!f.validity.valid).toString()),M(l,"aria-invalid",(!f.validity.valid).toString()),x.delete(l)}if(l.localName==="form"){const f=g.get(l),w=document.createTreeWalker(l,NodeFilter.SHOW_ELEMENT,{acceptNode(_){return u.has(_)&&_.constructor.formAssociated&&!(f&&f.has(_))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let b=w.nextNode();for(;b;)z(b),b=w.nextNode()}l.localName==="fieldset"&&((m=L.observe)===null||m===void 0||m.call(L,l,j),K(l,!0))}),o.forEach(l=>{const m=u.get(l);m&&p.get(m)&&G(m),C.has(l)&&C.get(l).disconnect()})})}function ce(t){t.forEach(e=>{const{removedNodes:i}=e;i.forEach(a=>{const n=$.get(e.target);u.has(a)&&Z(a),n.disconnect()})})}const de=t=>{var e,i;const a=new MutationObserver(ce);!((e=window==null?void 0:window.ShadyDOM)===null||e===void 0)&&e.inUse&&t.mode&&t.host&&(t=t.host),(i=a.observe)===null||i===void 0||i.call(a,t,{childList:!0}),$.set(t,a)};O()&&new MutationObserver(D);const P={childList:!0,subtree:!0},M=(t,e,i)=>{t.getAttribute(e)!==i&&t.setAttribute(e,i)},W=(t,e)=>{t.toggleAttribute("internals-disabled",e),e?M(t,"aria-disabled","true"):t.removeAttribute("aria-disabled"),t.formDisabledCallback&&t.formDisabledCallback.apply(t,[e])},G=t=>{p.get(t).forEach(i=>{i.remove()}),p.set(t,[])},J=(t,e)=>{const i=document.createElement("input");return i.type="hidden",i.name=t.getAttribute("name"),t.after(i),p.get(e).push(i),i},he=(t,e)=>{var i;p.set(e,[]),(i=L.observe)===null||i===void 0||i.call(L,t,j)},Q=(t,e)=>{if(e.length){Array.from(e).forEach(a=>a.addEventListener("click",t.click.bind(t)));let i=e[0].id;e[0].id||(i=`${e[0].htmlFor}_Label`,e[0].id=i),M(t,"aria-labelledby",i)}},N=t=>{const e=Array.from(t.elements).filter(o=>!o.tagName.includes("-")&&o.validity).map(o=>o.validity.valid),i=g.get(t)||[],a=Array.from(i).filter(o=>o.isConnected).map(o=>u.get(o).validity.valid),n=[...e,...a].includes(!1);t.toggleAttribute("internals-invalid",n),t.toggleAttribute("internals-valid",!n)},ue=t=>{N(R(t.target))},fe=t=>{N(R(t.target))},pe=t=>{const e=["button[type=submit]","input[type=submit]","button:not([type])"].map(i=>`${i}:not([disabled])`).map(i=>`${i}:not([form])${t.id?`,${i}[form='${t.id}']`:""}`).join(",");t.addEventListener("click",i=>{if(i.target.closest(e)){const n=g.get(t);if(t.noValidate)return;n.size&&Array.from(n).reverse().map(m=>u.get(m).reportValidity()).includes(!1)&&i.preventDefault()}})},me=t=>{const e=g.get(t.target);e&&e.size&&e.forEach(i=>{i.constructor.formAssociated&&i.formResetCallback&&i.formResetCallback.apply(i)})},X=(t,e,i)=>{if(e){const a=g.get(e);if(a)a.add(t);else{const n=new Set;n.add(t),g.set(e,n),pe(e),e.addEventListener("reset",me),e.addEventListener("input",ue),e.addEventListener("change",fe)}k.set(e,{ref:t,internals:i}),t.constructor.formAssociated&&t.formAssociatedCallback&&setTimeout(()=>{t.formAssociatedCallback.apply(t,[e])},0),N(e)}},R=t=>{let e=t.parentNode;return e&&e.tagName!=="FORM"&&(e=R(e)),e},v=(t,e,i=DOMException)=>{if(!t.constructor.formAssociated)throw new i(e)},Y=(t,e,i)=>{const a=g.get(t);return a&&a.size&&a.forEach(n=>{u.get(n)[i]()||(e=!1)}),e},Z=t=>{if(t.constructor.formAssociated){const e=u.get(t),{labels:i,form:a}=e;Q(t,i),X(t,a,e)}};function O(){return typeof MutationObserver<"u"}class ye{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)}}const ge=t=>(t.badInput=!1,t.customError=!1,t.patternMismatch=!1,t.rangeOverflow=!1,t.rangeUnderflow=!1,t.stepMismatch=!1,t.tooLong=!1,t.tooShort=!1,t.typeMismatch=!1,t.valid=!0,t.valueMissing=!1,t),be=(t,e,i)=>(t.valid=ve(e),Object.keys(e).forEach(a=>t[a]=e[a]),i&&N(i),t),ve=t=>{let e=!0;for(let i in t)i!=="valid"&&t[i]!==!1&&(e=!1);return e},q=new WeakMap;function ee(t,e){t.toggleAttribute(e,!0),t.part&&t.part.add(e)}class H extends Set{static get isPolyfilled(){return!0}constructor(e){if(super(),!e||!e.tagName||e.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");q.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 '--'.`);const i=super.add(e),a=q.get(this),n=`state${e}`;return a.isConnected?ee(a,n):setTimeout(()=>{ee(a,n)}),i}clear(){for(let[e]of this.entries())this.delete(e);super.clear()}delete(e){const i=super.delete(e),a=q.get(this);return a.isConnected?(a.toggleAttribute(`state${e}`,!1),a.part&&a.part.remove(`state${e}`)):setTimeout(()=>{a.toggleAttribute(`state${e}`,!1),a.part&&a.part.remove(`state${e}`)}),i}}function te(t,e,i,a){if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(t):a?a.value:e.get(t)}function we(t,e,i,a,n){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var A;class Ee{constructor(e){A.set(this,void 0),we(this,A,e);for(let i=0;i<e.length;i++){let a=e[i];this[i]=a,a.hasAttribute("name")&&(this[a.getAttribute("name")]=a)}Object.freeze(this)}get length(){return te(this,A,"f").length}[(A=new WeakMap,Symbol.iterator)](){return te(this,A,"f")[Symbol.iterator]()}item(e){return this[e]==null?null:this[e]}namedItem(e){return this[e]==null?null:this[e]}}function Me(){const t=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=i;const e=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=a;function i(...o){let l=t.apply(this,o);return Y(this,l,"checkValidity")}function a(...o){let l=e.apply(this,o);return Y(this,l,"reportValidity")}const{get:n}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...o){const l=n.call(this,...o),m=Array.from(g.get(this)||[]);if(m.length===0)return l;const f=Array.from(l).concat(m).sort((w,b)=>w.compareDocumentPosition?w.compareDocumentPosition(b)&2?1:-1:0);return new Ee(f)}})}class ie{static get isPolyfilled(){return!0}constructor(e){if(!e||!e.tagName||e.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");const i=e.getRootNode(),a=new ye;this.states=new H(e),s.set(this,e),h.set(this,a),u.set(e,this),le(e,this),he(e,this),Object.seal(this),i instanceof DocumentFragment&&de(i)}checkValidity(){const e=s.get(this);if(v(e,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=h.get(this);if(!i.valid){const a=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});e.dispatchEvent(a)}return i.valid}get form(){const e=s.get(this);v(e,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let i;return e.constructor.formAssociated===!0&&(i=R(e)),i}get labels(){const e=s.get(this);v(e,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const i=e.getAttribute("id"),a=e.getRootNode();return a&&i?a.querySelectorAll(`[for="${i}"]`):[]}reportValidity(){const e=s.get(this);if(v(e,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=this.checkValidity(),a=S.get(this);if(a&&!e.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!i&&a&&(e.focus(),a.focus()),i}setFormValue(e){const i=s.get(this);if(v(i,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),G(this),e!=null&&!(e instanceof FormData)){if(i.getAttribute("name")){const a=J(i,this);a.value=e}}else e!=null&&e instanceof FormData&&Array.from(e).reverse().forEach(([a,n])=>{if(typeof n=="string"){const o=J(i,this);o.name=a,o.value=n}});F.set(i,e)}setValidity(e,i,a){const n=s.get(this);if(v(n,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!e)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");S.set(this,a);const o=h.get(this),l={};for(const w in e)l[w]=e[w];Object.keys(l).length===0&&ge(o);const m=Object.assign(Object.assign({},o),l);delete m.valid;const{valid:f}=be(o,m,this.form);if(!f&&!i)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.");y.set(this,f?"":i),n.isConnected?(n.toggleAttribute("internals-invalid",!f),n.toggleAttribute("internals-valid",f),M(n,"aria-invalid",`${!f}`)):x.set(n,this)}get shadowRoot(){const e=s.get(this),i=T.get(e);return i||null}get validationMessage(){const e=s.get(this);return v(e,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),y.get(this)}get validity(){const e=s.get(this);return v(e,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),h.get(this)}get willValidate(){const e=s.get(this);return v(e,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(e.disabled||e.hasAttribute("disabled")||e.hasAttribute("readonly"))}}function ke(){if(typeof window>"u"||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class t extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const e=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(e,t);const i=new t;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(a=>a in i.internals)}let ae=!1,se=!1;function B(t){se||(se=!0,window.CustomStateSet=H,t&&(HTMLElement.prototype.attachInternals=function(...e){const i=t.call(this,e);return i.states=new H(this),i}))}function re(t=!0){if(!ae){if(ae=!0,typeof window<"u"&&(window.ElementInternals=ie),typeof CustomElementRegistry<"u"){const e=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(i,a,n){if(a.formAssociated){const o=a.prototype.connectedCallback;a.prototype.connectedCallback=function(){U.has(this)||(U.set(this,!0),this.hasAttribute("disabled")&&W(this,!0)),o!=null&&o.apply(this),Z(this)}}e.call(this,i,a,n)}}if(typeof HTMLElement<"u"&&(HTMLElement.prototype.attachInternals=function(){if(this.tagName){if(this.tagName.indexOf("-")===-1)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.")}else return{};if(u.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new ie(this)}),typeof Element<"u"){let e=function(...a){const n=i.apply(this,a);if(T.set(this,n),O()){const o=new MutationObserver(D);window.ShadyDOM?o.observe(this,P):o.observe(n,P),C.set(this,o)}return n};const i=Element.prototype.attachShadow;Element.prototype.attachShadow=e}O()&&typeof document<"u"&&new MutationObserver(D).observe(document.documentElement,P),typeof HTMLFormElement<"u"&&Me(),(t||typeof window<"u"&&!window.CustomStateSet)&&B()}}return!!customElements.polyfillWrapFlushCallback||(ke()?typeof window<"u"&&!window.CustomStateSet&&B(HTMLElement.prototype.attachInternals):re(!1)),E.forceCustomStateSetPolyfill=B,E.forceElementInternalsPolyfill=re,Object.defineProperty(E,"__esModule",{value:!0}),E})({})})()),ne}Se();var Ae=Object.defineProperty,d=(E,s,h,p)=>{for(var u=void 0,y=E.length-1,k;y>=0;y--)(k=E[y])&&(u=k(s,h,u)||u);return u&&Ae(s,h,u),u};class c extends r.PktElement{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=Ce.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Te.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=r.translations.forms.labels.optional,this.requiredText=r.translations.forms.labels.required,this.tagText=null,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(s){var h,p,u,y,k,C,g,F,V,T,S;s&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},r.translations.forms.messages.required,s):(h=s.validity)!=null&&h.typeMismatch||(p=s.validity)!=null&&p.badInput?this.internals.setValidity({typeMismatch:!0},r.translations.forms.messages.invalid,s):(u=s.validity)!=null&&u.patternMismatch?this.internals.setValidity({patternMismatch:!0},r.translations.forms.messages.invalidPattern,s):(y=s.validity)!=null&&y.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},r.translations.forms.messages.tooShort,s):(k=s.validity)!=null&&k.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},r.translations.forms.messages.tooLong,s):(C=s.validity)!=null&&C.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?r.translations.forms.messages.rangeUnderflowMin.replace("{min}",(g=this.min)==null?void 0:g.toString()):r.translations.forms.messages.rangeUnderflow,s):(F=s.validity)!=null&&F.stepMismatch?this.internals.setValidity({stepMismatch:!0},r.translations.forms.messages.invalid,s):(V=s.validity)!=null&&V.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?r.translations.forms.messages.rangeOverflowMax.replace("{max}",(T=this.max)==null?void 0:T.toString()):r.translations.forms.messages.rangeOverflow,s):(S=s.validity)!=null&&S.customError?this.internals.setValidity({customError:!0},s.validationMessage,s):this.internals.setValidity({}))}setFormValue(s){if(this.internals)if(Array.isArray(s)){const h=new FormData;s.forEach(p=>{h.append(this.name,p)}),this.internals.setFormValue(h)}else this.internals.setFormValue(s)}valueChecked(s){if(!this.touched)return;const h=this.internals.form||this.closest("form"),p=h?new FormData(h):null;h&&h.querySelectorAll(`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`).forEach(u=>{const y=u;y.name===this.name&&y.value!==this.value&&y.checked&&(y.checked=!1)}),typeof s=="string"?(this.checked=s==="true",this.internals.ariaChecked=s==="true"):typeof s=="boolean"&&(this.checked=s,this.internals.ariaChecked=s),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),p&&p.append(this.name,this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue(null,null),p&&p.delete(this.name),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(s,h){(h!==this.value||h!==this._value)&&(typeof s=="string"?((this.multiple||this.range)&&s.includes(",")&&(s=s.split(",")),this.value=s,this._value=Array.isArray(s)?s:[s]):Array.isArray(s)?(this.value=this.multiple||this.range?s:s[0],this._value=s):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&h&&h.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(h==null?void 0:h.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const s=this.multiple||this.range?[]:"";this.value=s,this.internals.setFormValue(s),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:s,bubbles:!0,composed:!0}))}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}))}onChange(s){if(!this.touched){this.touched=!0,s&&this.setFormValue(s);return}typeof s!="string"&&!Array.isArray(s)||((this.range||this.multiple)&&!Array.isArray(s)&&s.includes(",")&&(s=s.split(",")),!this.multiple&&!this.range&&Array.isArray(s)&&(s=s[0]),this.setFormValue(s),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:s,bubbles:!0,composed:!0})))}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(s=>{"selected"in s&&(s.selected=!1)}),this.checked!==void 0?(this.checked=!1,this.internals.ariaChecked=!1,this.internals.setFormValue("",""),this.inputRef.value.checked=!1,this.valueChecked(this.checked)):(this.internals.setFormValue(""),this.value=this.defaultValue||(this.multiple||this.range?[]:""),this._value=this.value,this.valueChanged(this.value,null)),this.internals.ariaInvalid=!1}updated(s){super.updated(s),s.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(s){if(super.firstUpdated(s),!this.form){const h=this.internals.form||this.closest("form");this.form=h}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=!0,this.checked=!0),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const h=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=h,this.internals.setFormValue(h?this.value||"on":"",h?this.value||"on":"")}else this.internals.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))}}d([r.n()],c.prototype,"defaultValue");d([r.n({type:Boolean,reflect:!0})],c.prototype,"disabled");d([r.n({type:Boolean,reflect:!0})],c.prototype,"readonly");d([r.n({type:Boolean,reflect:!0})],c.prototype,"required");d([r.n({type:Number,reflect:!0})],c.prototype,"max");d([r.n({type:Number,reflect:!0})],c.prototype,"maxlength");d([r.n({type:Number,reflect:!0})],c.prototype,"min");d([r.n({type:Number,reflect:!0})],c.prototype,"minlength");d([r.n({type:Number,reflect:!0})],c.prototype,"step");d([r.n({type:String})],c.prototype,"ariaDescribedBy");d([r.n({type:String})],c.prototype,"ariaLabelledby");d([r.n({type:String,reflect:!0})],c.prototype,"name");d([r.n({type:String,reflect:!0})],c.prototype,"pattern");d([r.n({type:String,reflect:!0})],c.prototype,"placeholder");d([r.n({type:String,reflect:!0})],c.prototype,"id");d([r.n({type:Boolean})],c.prototype,"counter");d([r.n({type:Boolean})],c.prototype,"hasError");d([r.n({type:Boolean})],c.prototype,"inline");d([r.n({type:Boolean})],c.prototype,"hasFieldset");d([r.n({type:Boolean})],c.prototype,"optionalTag");d([r.n({type:Boolean})],c.prototype,"requiredTag");d([r.n({type:Boolean})],c.prototype,"skipForwardTestid");d([r.n({type:Boolean,reflect:!0,converter:Fe.booleanishConverter})],c.prototype,"useWrapper");d([r.n({type:Boolean,reflect:!0})],c.prototype,"fullwidth");d([r.n({type:Number})],c.prototype,"counterMaxLength");d([r.n({type:String})],c.prototype,"errorMessage");d([r.n({type:String})],c.prototype,"helptext");d([r.n({type:String})],c.prototype,"helptextDropdown");d([r.n({type:String,reflect:!1})],c.prototype,"helptextDropdownButton");d([r.n({type:String})],c.prototype,"label");d([r.n({type:String,reflect:!1})],c.prototype,"optionalText");d([r.n({type:String,reflect:!1})],c.prototype,"requiredText");d([r.n({type:String,reflect:!1})],c.prototype,"tagText");d([r.n({type:String,attribute:"data-testid"})],c.prototype,"dataTestid");d([Ve.r()],c.prototype,"touched");exports.PktInputElement=c;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("./pkt-slot-controller-BzddBp7z.cjs");class a{constructor(t){this.nodes=[],this.options=[],this.host=t,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(e=>this.handleMutations(e))}hostConnected(){Array.from(this.host.childNodes).forEach(t=>{(t.nodeName==="OPTION"||t.nodeName==="DATA")&&this.addNode(t)}),this.observer.observe(this.host,{childList:!0,subtree:!1,attributes:!0})}hostDisconnected(){this.observer.disconnect()}addNode(t){(t.nodeName==="OPTION"||t.nodeName==="DATA")&&(t.hasAttribute("hidden")&&!t.hasAttribute("data-skip")&&t.setAttribute("data-hidden","true"),!t.hasAttribute("hidden")&&t.hasAttribute("data-skip")&&t.hasAttribute("data-hidden")&&t.removeAttribute("data-hidden"),t.setAttribute("class","pkt-hide"),t.setAttribute("data-skip","true"),t.setAttribute("hidden","true"),this.nodes.push(t))}createOptions(){this.options=this.nodes.map(t=>({value:t.hasAttribute("value")?t.getAttribute("value")??"":t.textContent??"",label:t.textContent||t.getAttribute("value")||"",selected:t.hasAttribute("selected"),disabled:t.hasAttribute("disabled"),hidden:t.hasAttribute("data-hidden")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(t){let e=!1;t.forEach(s=>{s.type==="childList"&&(s.addedNodes.forEach(i=>{r.isOptionElement(i)&&(this.addNode(i),e=!0)}),s.removedNodes.forEach(i=>{r.isOptionElement(i)&&(this.nodes=this.nodes.filter(h=>h!==i),e=!0)})),s.type==="attributes"&&r.isOptionElement(s.target)&&(this.addNode(s.target),e=!0)}),e&&this.createOptions()}}exports.PktOptionsSlotController=a;
|
package/dist/select-3dwlk22G.cjs
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";const h=require("./element-CJ_QKaki.cjs"),u=require("./state-DSjcvzDN.cjs"),r=require("./ref-BFa5Utho.cjs"),o=require("./if-defined-Bc9-_I01.cjs"),d=require("./input-element-D697OAJo.cjs"),c=require("./pkt-options-controller-CiuBG6Lt.cjs"),v=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-CtBiAb04.cjs");var f=Object.defineProperty,_=Object.getOwnPropertyDescriptor,a=(p,t,e,s)=>{for(var i=s>1?void 0:s?_(t,e):t,l=p.length-1,n;l>=0;l--)(n=p[l])&&(i=(s?n(t,e,i):n(i))||i);return s&&i&&f(t,e,i),i};exports.PktSelect=class extends d.PktInputElement{constructor(){super(),this.inputRef=r.e(),this.helptextSlot=r.e(),this._optionsProp=[],this.value="",this._options=[],this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new c.PktOptionsSlotController(this),this.slotController=new v.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}get options(){return this._options.map(t=>({...t,selected:t.value===this.value}))}set options(t){this._optionsProp=t,this.requestUpdate("_optionsProp",this._options)}connectedCallback(){super.connectedCallback();const t=this._optionsProp.length>0,e=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!t&&e?this.optionsController.nodes.forEach(s=>{const i={value:s.hasAttribute("value")?s.getAttribute("value")??"":s.textContent??"",label:s.textContent||s.getAttribute("value")||"",disabled:s.hasAttribute("disabled"),selected:s.hasAttribute("selected"),hidden:s.hasAttribute("data-hidden")};s.getAttribute("selected")&&!this.value&&(this.value=i.value),this._options.push(i)}):(this._options=this._optionsProp,this._options.forEach(s=>{s.selected&&!this.value&&(this.value=s.value)}))}add(t,e){const s={value:t.value||t.text,label:t.text||t.value,selected:t.selected,disabled:t.disabled};if(e===void 0)this._options.push(s);else if(typeof e=="number")this._options.splice(e,0,s);else{const i=e.value||e.text,l=this._options.findIndex(n=>n.value===i);l>=0?this._options.splice(l,0,s):this._options.push(s)}t.selected&&(this.value=t.value||t.text,this.selectedIndex=this._options.findIndex(i=>i.value===this.value)),this.requestUpdate()}remove(t){var e;typeof t=="number"&&(this.selectedIndex===t&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),this._options.splice(t,1),this.requestUpdate())}item(t){var e;return(e=this.inputRef.value)==null?void 0:e.item(t)}namedItem(t){var e;return(e=this.inputRef.value)==null?void 0:e.namedItem(t)}showPicker(){this.inputRef.value&&"showPicker"in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(t,e,s){var i,l;t==="options"&&(this._options=s?JSON.parse(s):[]),t==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex):this._options.findIndex(n=>n.value===s),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions,this.valueChanged(s,e)),super.attributeChangedCallback(t,e,s)}update(t){var e,s;super.update(t),t.has("_optionsProp")&&this._optionsProp.length>0&&(this._options=this._optionsProp,this.requestUpdate("_options"),!this.value&&this._options.length>0&&(this.value=this._options[0].value,this.selectedIndex=0)),t.has("value")&&this.value!==t.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((e=this.inputRef.value)==null?void 0:e.selectedIndex):this._options.findIndex(i=>i.value===this.value),this.selectedOptions=(s=this.inputRef.value)==null?void 0:s.selectedOptions,this.valueChanged(this.value,t.get("value"))),t.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(t){var e;super.firstUpdated(t),this._optionsProp.length&&(this._options=this._optionsProp),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(s=>s.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return h.x`
|
|
2
|
-
<pkt-input-wrapper
|
|
3
|
-
?counter=${this.counter}
|
|
4
|
-
?disabled=${this.disabled}
|
|
5
|
-
?hasError=${this.hasError}
|
|
6
|
-
?hasFieldset=${this.hasFieldset}
|
|
7
|
-
?inline=${this.inline}
|
|
8
|
-
?optionalTag=${this.optionalTag}
|
|
9
|
-
?requiredTag=${this.requiredTag}
|
|
10
|
-
useWrapper=${this.useWrapper}
|
|
11
|
-
ariaDescribedBy=${o.o(this.ariaDescribedBy)}
|
|
12
|
-
class="pkt-select"
|
|
13
|
-
errorMessage=${o.o(this.errorMessage)}
|
|
14
|
-
forId=${this.id+"-input"}
|
|
15
|
-
helptext=${o.o(this.helptext)}
|
|
16
|
-
helptextDropdown=${o.o(this.helptextDropdown)}
|
|
17
|
-
helptextDropdownButton=${o.o(this.helptextDropdownButton)}
|
|
18
|
-
label=${o.o(this.label)}
|
|
19
|
-
optionalText=${o.o(this.optionalText)}
|
|
20
|
-
requiredText=${o.o(this.requiredText)}
|
|
21
|
-
tagText=${o.o(this.tagText)}
|
|
22
|
-
>
|
|
23
|
-
<select
|
|
24
|
-
class=${t}
|
|
25
|
-
aria-invalid=${this.hasError}
|
|
26
|
-
aria-errormessage=${`${this.id}-error`}
|
|
27
|
-
aria-labelledby=${o.o(this.ariaLabelledby)}
|
|
28
|
-
?disabled=${this.disabled}
|
|
29
|
-
id=${this.id+"-input"}
|
|
30
|
-
name=${(this.name||this.id)+"-input"}
|
|
31
|
-
value=${this.value}
|
|
32
|
-
@change=${e=>{this.touched=!0,this.value=e.target.value,e.stopImmediatePropagation()}}
|
|
33
|
-
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
34
|
-
@focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
|
|
35
|
-
@blur=${e=>{this.onBlur(),e.stopImmediatePropagation()}}
|
|
36
|
-
${r.n(this.inputRef)}
|
|
37
|
-
>
|
|
38
|
-
${this._options.length>0?this._options.map(e=>h.x`<option
|
|
39
|
-
value=${e.value}
|
|
40
|
-
?selected=${this.value==e.value||e.selected}
|
|
41
|
-
?disabled=${e.disabled}
|
|
42
|
-
?hidden=${e.hidden}
|
|
43
|
-
>
|
|
44
|
-
${e.label}
|
|
45
|
-
</option>`):""}
|
|
46
|
-
</select>
|
|
47
|
-
<div class="pkt-contents" ${r.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
48
|
-
</pkt-input-wrapper>
|
|
49
|
-
`}returnNumberOrNull(t){return t==null||isNaN(t)?null:t}};a([h.n({type:Array,attribute:"options"})],exports.PktSelect.prototype,"_optionsProp",2);a([h.n({type:String})],exports.PktSelect.prototype,"value",2);a([u.r()],exports.PktSelect.prototype,"_options",2);exports.PktSelect=a([h.t("pkt-select")],exports.PktSelect);
|
package/dist/select-_C-yztI0.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { x as r, n as c, a as v } from "./element-CRDRygXu.js";
|
|
2
|
-
import { r as f } from "./state-DS_kr2Fy.js";
|
|
3
|
-
import { e as u, n as d } from "./ref-Xa5dbh--.js";
|
|
4
|
-
import { o as l } from "./if-defined-BWZGb3bh.js";
|
|
5
|
-
import { P as _ } from "./input-element-B8M8Nppd.js";
|
|
6
|
-
import { P as x } from "./pkt-options-controller-CZO1nxZ8.js";
|
|
7
|
-
import { P as b } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
8
|
-
import "./input-wrapper-1PCXqtiu.js";
|
|
9
|
-
var $ = Object.defineProperty, m = Object.getOwnPropertyDescriptor, a = (t, e, s, i) => {
|
|
10
|
-
for (var o = i > 1 ? void 0 : i ? m(e, s) : e, n = t.length - 1, p; n >= 0; n--)
|
|
11
|
-
(p = t[n]) && (o = (i ? p(e, s, o) : p(o)) || o);
|
|
12
|
-
return i && o && $(e, s, o), o;
|
|
13
|
-
};
|
|
14
|
-
let h = class extends _ {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(), this.inputRef = u(), this.helptextSlot = u(), this._optionsProp = [], this.value = "", this._options = [], this.selectedIndex = -1, this.selectedOptions = void 0, this.optionsController = new x(this), this.slotController = new b(this, this.helptextSlot), this.slotController.skipOptions = !0;
|
|
17
|
-
}
|
|
18
|
-
// Getter and setter for options to expose the actual parsed options
|
|
19
|
-
get options() {
|
|
20
|
-
return this._options.map((t) => ({
|
|
21
|
-
...t,
|
|
22
|
-
selected: t.value === this.value
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
set options(t) {
|
|
26
|
-
this._optionsProp = t, this.requestUpdate("_optionsProp", this._options);
|
|
27
|
-
}
|
|
28
|
-
connectedCallback() {
|
|
29
|
-
super.connectedCallback();
|
|
30
|
-
const t = this._optionsProp.length > 0, e = this.optionsController.nodes.length && this.optionsController.nodes.length > 0;
|
|
31
|
-
!t && e ? this.optionsController.nodes.forEach((s) => {
|
|
32
|
-
const i = {
|
|
33
|
-
value: s.hasAttribute("value") ? s.getAttribute("value") ?? "" : s.textContent ?? "",
|
|
34
|
-
label: s.textContent || s.getAttribute("value") || "",
|
|
35
|
-
disabled: s.hasAttribute("disabled"),
|
|
36
|
-
selected: s.hasAttribute("selected"),
|
|
37
|
-
hidden: s.hasAttribute("data-hidden")
|
|
38
|
-
};
|
|
39
|
-
s.getAttribute("selected") && !this.value && (this.value = i.value), this._options.push(i);
|
|
40
|
-
}) : (this._options = this._optionsProp, this._options.forEach((s) => {
|
|
41
|
-
s.selected && !this.value && (this.value = s.value);
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
// Support native Select method `add`
|
|
45
|
-
add(t, e) {
|
|
46
|
-
const s = {
|
|
47
|
-
value: t.value || t.text,
|
|
48
|
-
label: t.text || t.value,
|
|
49
|
-
selected: t.selected,
|
|
50
|
-
disabled: t.disabled
|
|
51
|
-
};
|
|
52
|
-
if (e === void 0)
|
|
53
|
-
this._options.push(s);
|
|
54
|
-
else if (typeof e == "number")
|
|
55
|
-
this._options.splice(e, 0, s);
|
|
56
|
-
else {
|
|
57
|
-
const i = e.value || e.text, o = this._options.findIndex((n) => n.value === i);
|
|
58
|
-
o >= 0 ? this._options.splice(o, 0, s) : this._options.push(s);
|
|
59
|
-
}
|
|
60
|
-
t.selected && (this.value = t.value || t.text, this.selectedIndex = this._options.findIndex((i) => i.value === this.value)), this.requestUpdate();
|
|
61
|
-
}
|
|
62
|
-
// Support native Select method `remove`
|
|
63
|
-
remove(t) {
|
|
64
|
-
var e;
|
|
65
|
-
typeof t == "number" && (this.selectedIndex === t && (this.value = ((e = this._options[0]) == null ? void 0 : e.value) || ""), this._options.splice(t, 1), this.requestUpdate());
|
|
66
|
-
}
|
|
67
|
-
// Support native Select method `item`
|
|
68
|
-
item(t) {
|
|
69
|
-
var e;
|
|
70
|
-
return (e = this.inputRef.value) == null ? void 0 : e.item(t);
|
|
71
|
-
}
|
|
72
|
-
// Support native Select method `namedItem`
|
|
73
|
-
namedItem(t) {
|
|
74
|
-
var e;
|
|
75
|
-
return (e = this.inputRef.value) == null ? void 0 : e.namedItem(t);
|
|
76
|
-
}
|
|
77
|
-
// Support native Select method `showPicker`
|
|
78
|
-
showPicker() {
|
|
79
|
-
this.inputRef.value && "showPicker" in this.inputRef.value && this.inputRef.value.showPicker();
|
|
80
|
-
}
|
|
81
|
-
attributeChangedCallback(t, e, s) {
|
|
82
|
-
var i, o;
|
|
83
|
-
t === "options" && (this._options = s ? JSON.parse(s) : []), t === "value" && this.value !== e && (this.selectedIndex = this.touched ? this.returnNumberOrNull((i = this.inputRef.value) == null ? void 0 : i.selectedIndex) : this._options.findIndex((n) => n.value === s), this.selectedOptions = (o = this.inputRef.value) == null ? void 0 : o.selectedOptions, this.valueChanged(s, e)), super.attributeChangedCallback(t, e, s);
|
|
84
|
-
}
|
|
85
|
-
update(t) {
|
|
86
|
-
var e, s;
|
|
87
|
-
super.update(t), t.has("_optionsProp") && this._optionsProp.length > 0 && (this._options = this._optionsProp, this.requestUpdate("_options"), !this.value && this._options.length > 0 && (this.value = this._options[0].value, this.selectedIndex = 0)), t.has("value") && this.value !== t.get("value") && (this.selectedIndex = this.touched ? this.returnNumberOrNull((e = this.inputRef.value) == null ? void 0 : e.selectedIndex) : this._options.findIndex((i) => i.value === this.value), this.selectedOptions = (s = this.inputRef.value) == null ? void 0 : s.selectedOptions, this.valueChanged(this.value, t.get("value"))), t.has("id") && !this.name && this.id && (this.name = this.id);
|
|
88
|
-
}
|
|
89
|
-
firstUpdated(t) {
|
|
90
|
-
var e;
|
|
91
|
-
super.firstUpdated(t), this._optionsProp.length && (this._options = this._optionsProp), !this.value && this._options.length > 0 ? (this.value = this._options[0].value, this.selectedIndex = 0) : this.selectedIndex = this._options.findIndex((s) => s.value === this.value), this.selectedOptions = (e = this.inputRef.value) == null ? void 0 : e.selectedOptions;
|
|
92
|
-
}
|
|
93
|
-
render() {
|
|
94
|
-
const t = `pkt-input ${this.fullwidth ? "pkt-input--fullwidth" : ""}`;
|
|
95
|
-
return r`
|
|
96
|
-
<pkt-input-wrapper
|
|
97
|
-
?counter=${this.counter}
|
|
98
|
-
?disabled=${this.disabled}
|
|
99
|
-
?hasError=${this.hasError}
|
|
100
|
-
?hasFieldset=${this.hasFieldset}
|
|
101
|
-
?inline=${this.inline}
|
|
102
|
-
?optionalTag=${this.optionalTag}
|
|
103
|
-
?requiredTag=${this.requiredTag}
|
|
104
|
-
useWrapper=${this.useWrapper}
|
|
105
|
-
ariaDescribedBy=${l(this.ariaDescribedBy)}
|
|
106
|
-
class="pkt-select"
|
|
107
|
-
errorMessage=${l(this.errorMessage)}
|
|
108
|
-
forId=${this.id + "-input"}
|
|
109
|
-
helptext=${l(this.helptext)}
|
|
110
|
-
helptextDropdown=${l(this.helptextDropdown)}
|
|
111
|
-
helptextDropdownButton=${l(this.helptextDropdownButton)}
|
|
112
|
-
label=${l(this.label)}
|
|
113
|
-
optionalText=${l(this.optionalText)}
|
|
114
|
-
requiredText=${l(this.requiredText)}
|
|
115
|
-
tagText=${l(this.tagText)}
|
|
116
|
-
>
|
|
117
|
-
<select
|
|
118
|
-
class=${t}
|
|
119
|
-
aria-invalid=${this.hasError}
|
|
120
|
-
aria-errormessage=${`${this.id}-error`}
|
|
121
|
-
aria-labelledby=${l(this.ariaLabelledby)}
|
|
122
|
-
?disabled=${this.disabled}
|
|
123
|
-
id=${this.id + "-input"}
|
|
124
|
-
name=${(this.name || this.id) + "-input"}
|
|
125
|
-
value=${this.value}
|
|
126
|
-
@change=${(e) => {
|
|
127
|
-
this.touched = !0, this.value = e.target.value, e.stopImmediatePropagation();
|
|
128
|
-
}}
|
|
129
|
-
@input=${(e) => {
|
|
130
|
-
this.onInput(), e.stopImmediatePropagation();
|
|
131
|
-
}}
|
|
132
|
-
@focus=${(e) => {
|
|
133
|
-
this.onFocus(), e.stopImmediatePropagation();
|
|
134
|
-
}}
|
|
135
|
-
@blur=${(e) => {
|
|
136
|
-
this.onBlur(), e.stopImmediatePropagation();
|
|
137
|
-
}}
|
|
138
|
-
${d(this.inputRef)}
|
|
139
|
-
>
|
|
140
|
-
${this._options.length > 0 ? this._options.map(
|
|
141
|
-
(e) => r`<option
|
|
142
|
-
value=${e.value}
|
|
143
|
-
?selected=${this.value == e.value || e.selected}
|
|
144
|
-
?disabled=${e.disabled}
|
|
145
|
-
?hidden=${e.hidden}
|
|
146
|
-
>
|
|
147
|
-
${e.label}
|
|
148
|
-
</option>`
|
|
149
|
-
) : ""}
|
|
150
|
-
</select>
|
|
151
|
-
<div class="pkt-contents" ${d(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
152
|
-
</pkt-input-wrapper>
|
|
153
|
-
`;
|
|
154
|
-
}
|
|
155
|
-
returnNumberOrNull(t) {
|
|
156
|
-
return t == null || isNaN(t) ? null : t;
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
a([
|
|
160
|
-
c({ type: Array, attribute: "options" })
|
|
161
|
-
], h.prototype, "_optionsProp", 2);
|
|
162
|
-
a([
|
|
163
|
-
c({ type: String })
|
|
164
|
-
], h.prototype, "value", 2);
|
|
165
|
-
a([
|
|
166
|
-
f()
|
|
167
|
-
], h.prototype, "_options", 2);
|
|
168
|
-
h = a([
|
|
169
|
-
v("pkt-select")
|
|
170
|
-
], h);
|
|
171
|
-
export {
|
|
172
|
-
h as P
|
|
173
|
-
};
|