@oslokommune/punkt-elements 14.3.0 → 14.4.0
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 +17 -0
- package/dist/{checkbox-CnhA52o_.js → checkbox-DfVUNTjH.js} +1 -1
- package/dist/{checkbox-C0TPnShf.cjs → checkbox-uxeHrTLH.cjs} +1 -1
- package/dist/{combobox-C1xwAju5.cjs → combobox-CcyHcqdW.cjs} +13 -13
- package/dist/{combobox-Dcp_fHcL.js → combobox-MZsqmVL-.js} +45 -45
- package/dist/{datepicker-COIRRau0.cjs → datepicker-BeMs_vsm.cjs} +25 -25
- package/dist/{datepicker-Bjb9GK1E.js → datepicker-a2LvhbRb.js} +215 -234
- package/dist/index.d.ts +213 -14
- package/dist/input-element-CARcDzQB.js +840 -0
- package/dist/input-element-CiaV6jln.cjs +1 -0
- 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-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +2 -2
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +7 -7
- 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-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-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/{radiobutton-Caq8-GhM.js → radiobutton-BmgdSpYf.js} +1 -1
- package/dist/{radiobutton-BkqaqO5E.cjs → radiobutton-DVe09YxP.cjs} +1 -1
- package/dist/select-7KFOnLln.cjs +49 -0
- package/dist/select-CKqz-JKZ.js +228 -0
- package/dist/{textarea-a6T4aJJU.js → textarea-Bmrv_vve.js} +1 -1
- package/dist/{textarea-DyUy8u7X.cjs → textarea-VBUXPS1O.cjs} +1 -1
- package/dist/{textinput-IN3b0nSH.cjs → textinput-BkYKotc1.cjs} +1 -1
- package/dist/{textinput-DIuM70dd.js → textinput-Lp1crOmj.js} +1 -1
- 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/radiobutton/radiobutton.ts +1 -1
- package/src/components/select/select.ts +12 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("./element-CJ_QKaki.cjs"),St=require("./state-DSjcvzDN.cjs"),Ft=require("./utils-byXsEz1u.cjs"),Tt=require("./booleanish-BKVonob4.cjs"),xt=require("./input-wrapper-EoSAbU-U.cjs");var lt={},ct;function It(){return ct||(ct=1,(function(){(function(p){const a=new WeakMap,n=new WeakMap,f=new WeakMap,u=new WeakMap,b=new WeakMap,k=new WeakMap,C=new WeakMap,g=new WeakMap,A=new WeakMap,V=new WeakMap,S=new WeakMap,F=new WeakMap,z=new WeakMap,K=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"},ht=(e,t)=>{for(let i in I){t[i]=null;let s=null;const o=I[i];Object.defineProperty(t,i,{get(){return s},set(d){s=d,e.isConnected?M(e,o,d):V.set(e,t)}})}};function j(e){const t=u.get(e),{form:i}=t;Z(e,i,t),Y(e,t.labels)}const G=(e,t=!1)=>{const i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(d){return u.has(d)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let s=i.nextNode();const o=!t||e.disabled;for(;s;)s.formDisabledCallback&&o&&_(s,e.disabled),s=i.nextNode()},J={attributes:!0,attributeFilter:["disabled","name"]},R=O()?new MutationObserver(e=>{for(const t of e){const i=t.target;if(t.attributeName==="disabled"&&(i.constructor.formAssociated?_(i,i.hasAttribute("disabled")):i.localName==="fieldset"&&G(i)),t.attributeName==="name"&&i.constructor.formAssociated){const s=u.get(i),o=A.get(i);s.setFormValue(o)}}}):{};function P(e){e.forEach(t=>{const{addedNodes:i,removedNodes:s}=t,o=Array.from(i),d=Array.from(s);o.forEach(h=>{var y;if(u.has(h)&&h.constructor.formAssociated&&j(h),V.has(h)){const m=V.get(h);Object.keys(I).filter(v=>m[v]!==null).forEach(v=>{M(h,I[v],m[v])}),V.delete(h)}if(x.has(h)){const m=x.get(h);M(h,"internals-valid",m.validity.valid.toString()),M(h,"internals-invalid",(!m.validity.valid).toString()),M(h,"aria-invalid",(!m.validity.valid).toString()),x.delete(h)}if(h.localName==="form"){const m=g.get(h),E=document.createTreeWalker(h,NodeFilter.SHOW_ELEMENT,{acceptNode($){return u.has($)&&$.constructor.formAssociated&&!(m&&m.has($))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let v=E.nextNode();for(;v;)j(v),v=E.nextNode()}h.localName==="fieldset"&&((y=R.observe)===null||y===void 0||y.call(R,h,J),G(h,!0))}),d.forEach(h=>{const y=u.get(h);y&&f.get(y)&&Q(y),C.has(h)&&C.get(h).disconnect()})})}function ut(e){e.forEach(t=>{const{removedNodes:i}=t;i.forEach(s=>{const o=z.get(t.target);u.has(s)&&et(s),o.disconnect()})})}const ft=e=>{var t,i;const s=new MutationObserver(ut);!((t=window==null?void 0:window.ShadyDOM)===null||t===void 0)&&t.inUse&&e.mode&&e.host&&(e=e.host),(i=s.observe)===null||i===void 0||i.call(s,e,{childList:!0}),z.set(e,s)};O()&&new MutationObserver(P);const B={childList:!0,subtree:!0},M=(e,t,i)=>{e.getAttribute(t)!==i&&e.setAttribute(t,i)},_=(e,t)=>{e.toggleAttribute("internals-disabled",t),t?M(e,"aria-disabled","true"):e.removeAttribute("aria-disabled"),e.formDisabledCallback&&e.formDisabledCallback.apply(e,[t])},Q=e=>{f.get(e).forEach(i=>{i.remove()}),f.set(e,[])},X=(e,t)=>{const i=document.createElement("input");return i.type="hidden",i.name=e.getAttribute("name"),e.after(i),f.get(t).push(i),i},pt=(e,t)=>{var i;f.set(t,[]),(i=R.observe)===null||i===void 0||i.call(R,e,J)},Y=(e,t)=>{if(t.length){Array.from(t).forEach(s=>s.addEventListener("click",e.click.bind(e)));let i=t[0].id;t[0].id||(i=`${t[0].htmlFor}_Label`,t[0].id=i),M(e,"aria-labelledby",i)}},L=e=>{const t=Array.from(e.elements).filter(d=>!d.tagName.includes("-")&&d.validity).map(d=>d.validity.valid),i=g.get(e)||[],s=Array.from(i).filter(d=>d.isConnected).map(d=>u.get(d).validity.valid),o=[...t,...s].includes(!1);e.toggleAttribute("internals-invalid",o),e.toggleAttribute("internals-valid",!o)},mt=e=>{L(N(e.target))},yt=e=>{L(N(e.target))},gt=e=>{const t=["button[type=submit]","input[type=submit]","button:not([type])"].map(i=>`${i}:not([disabled])`).map(i=>`${i}:not([form])${e.id?`,${i}[form='${e.id}']`:""}`).join(",");e.addEventListener("click",i=>{if(i.target.closest(t)){const o=g.get(e);if(e.noValidate)return;o.size&&Array.from(o).reverse().map(y=>u.get(y).reportValidity()).includes(!1)&&i.preventDefault()}})},vt=e=>{const t=g.get(e.target);t&&t.size&&t.forEach(i=>{i.constructor.formAssociated&&i.formResetCallback&&i.formResetCallback.apply(i)})},Z=(e,t,i)=>{if(t){const s=g.get(t);if(s)s.add(e);else{const o=new Set;o.add(e),g.set(t,o),gt(t),t.addEventListener("reset",vt),t.addEventListener("input",mt),t.addEventListener("change",yt)}k.set(t,{ref:e,internals:i}),e.constructor.formAssociated&&e.formAssociatedCallback&&setTimeout(()=>{e.formAssociatedCallback.apply(e,[t])},0),L(t)}},N=e=>{let t=e.parentNode;return t&&t.tagName!=="FORM"&&(t=N(t)),t},w=(e,t,i=DOMException)=>{if(!e.constructor.formAssociated)throw new i(t)},tt=(e,t,i)=>{const s=g.get(e);return s&&s.size&&s.forEach(o=>{u.get(o)[i]()||(t=!1)}),t},et=e=>{if(e.constructor.formAssociated){const t=u.get(e),{labels:i,form:s}=t;Y(e,i),Z(e,s,t)}};function O(){return typeof MutationObserver<"u"}class bt{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 wt=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),Et=(e,t,i)=>(e.valid=Mt(t),Object.keys(t).forEach(s=>e[s]=t[s]),i&&L(i),e),Mt=e=>{let t=!0;for(let i in e)i!=="valid"&&e[i]!==!1&&(t=!1);return t},H=new WeakMap;function it(e,t){e.toggleAttribute(t,!0),e.part&&e.part.add(t)}class W extends Set{static get isPolyfilled(){return!0}constructor(t){if(super(),!t||!t.tagName||t.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");H.set(this,t)}add(t){if(!/^--/.test(t)||typeof t!="string")throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`);const i=super.add(t),s=H.get(this),o=`state${t}`;return s.isConnected?it(s,o):setTimeout(()=>{it(s,o)}),i}clear(){for(let[t]of this.entries())this.delete(t);super.clear()}delete(t){const i=super.delete(t),s=H.get(this);return s.isConnected?(s.toggleAttribute(`state${t}`,!1),s.part&&s.part.remove(`state${t}`)):setTimeout(()=>{s.toggleAttribute(`state${t}`,!1),s.part&&s.part.remove(`state${t}`)}),i}}function at(e,t,i,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?s:i==="a"?s.call(e):s?s.value:t.get(e)}function kt(e,t,i,s,o){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,i),i}var T;class Vt{constructor(t){T.set(this,void 0),kt(this,T,t);for(let i=0;i<t.length;i++){let s=t[i];this[i]=s,s.hasAttribute("name")&&(this[s.getAttribute("name")]=s)}Object.freeze(this)}get length(){return at(this,T,"f").length}[(T=new WeakMap,Symbol.iterator)](){return at(this,T,"f")[Symbol.iterator]()}item(t){return this[t]==null?null:this[t]}namedItem(t){return this[t]==null?null:this[t]}}function Ct(){const e=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=i;const t=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=s;function i(...d){let h=e.apply(this,d);return tt(this,h,"checkValidity")}function s(...d){let h=t.apply(this,d);return tt(this,h,"reportValidity")}const{get:o}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...d){const h=o.call(this,...d),y=Array.from(g.get(this)||[]);if(y.length===0)return h;const m=Array.from(h).concat(y).sort((E,v)=>E.compareDocumentPosition?E.compareDocumentPosition(v)&2?1:-1:0);return new Vt(m)}})}class st{static get isPolyfilled(){return!0}constructor(t){if(!t||!t.tagName||t.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");const i=t.getRootNode(),s=new bt;this.states=new W(t),a.set(this,t),n.set(this,s),u.set(t,this),ht(t,this),pt(t,this),Object.seal(this),i instanceof DocumentFragment&&ft(i)}checkValidity(){const t=a.get(this);if(w(t,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=n.get(this);if(!i.valid){const s=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});t.dispatchEvent(s)}return i.valid}get form(){const t=a.get(this);w(t,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let i;return t.constructor.formAssociated===!0&&(i=N(t)),i}get labels(){const t=a.get(this);w(t,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const i=t.getAttribute("id"),s=t.getRootNode();return s&&i?s.querySelectorAll(`[for="${i}"]`):[]}reportValidity(){const t=a.get(this);if(w(t,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=this.checkValidity(),s=F.get(this);if(s&&!t.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!i&&s&&(t.focus(),s.focus()),i}setFormValue(t){const i=a.get(this);if(w(i,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),Q(this),t!=null&&!(t instanceof FormData)){if(i.getAttribute("name")){const s=X(i,this);s.value=t}}else t!=null&&t instanceof FormData&&Array.from(t).reverse().forEach(([s,o])=>{if(typeof o=="string"){const d=X(i,this);d.name=s,d.value=o}});A.set(i,t)}setValidity(t,i,s){const o=a.get(this);if(w(o,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!t)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");F.set(this,s);const d=n.get(this),h={};for(const E in t)h[E]=t[E];Object.keys(h).length===0&&wt(d);const y=Object.assign(Object.assign({},d),h);delete y.valid;const{valid:m}=Et(d,y,this.form);if(!m&&!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.");b.set(this,m?"":i),o.isConnected?(o.toggleAttribute("internals-invalid",!m),o.toggleAttribute("internals-valid",m),M(o,"aria-invalid",`${!m}`)):x.set(o,this)}get shadowRoot(){const t=a.get(this),i=S.get(t);return i||null}get validationMessage(){const t=a.get(this);return w(t,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),b.get(this)}get validity(){const t=a.get(this);return w(t,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),n.get(this)}get willValidate(){const t=a.get(this);return w(t,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(t.disabled||t.hasAttribute("disabled")||t.hasAttribute("readonly"))}}function At(){if(typeof window>"u"||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class e extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const t=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(t,e);const i=new e;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(s=>s in i.internals)}let rt=!1,nt=!1;function q(e){nt||(nt=!0,window.CustomStateSet=W,e&&(HTMLElement.prototype.attachInternals=function(...t){const i=e.call(this,t);return i.states=new W(this),i}))}function ot(e=!0){if(!rt){if(rt=!0,typeof window<"u"&&(window.ElementInternals=st),typeof CustomElementRegistry<"u"){const t=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(i,s,o){if(s.formAssociated){const d=s.prototype.connectedCallback;s.prototype.connectedCallback=function(){K.has(this)||(K.set(this,!0),this.hasAttribute("disabled")&&_(this,!0)),d!=null&&d.apply(this),et(this)}}t.call(this,i,s,o)}}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 st(this)}),typeof Element<"u"){let t=function(...s){const o=i.apply(this,s);if(S.set(this,o),O()){const d=new MutationObserver(P);window.ShadyDOM?d.observe(this,B):d.observe(o,B),C.set(this,d)}return o};const i=Element.prototype.attachShadow;Element.prototype.attachShadow=t}O()&&typeof document<"u"&&new MutationObserver(P).observe(document.documentElement,B),typeof HTMLFormElement<"u"&&Ct(),(e||typeof window<"u"&&!window.CustomStateSet)&&q()}}return!!customElements.polyfillWrapFlushCallback||(At()?typeof window<"u"&&!window.CustomStateSet&&q(HTMLElement.prototype.attachInternals):ot(!1)),p.forceCustomStateSetPolyfill=q,p.forceElementInternalsPolyfill=ot,Object.defineProperty(p,"__esModule",{value:!0}),p})({})})()),lt}It();var Rt=Object.defineProperty,c=(p,a,n,f)=>{for(var u=void 0,b=p.length-1,k;b>=0;b--)(k=p[b])&&(u=k(a,n,u)||u);return u&&Rt(a,n,u),u};const dt="on",U="--checked",D=",";class l 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=Ft.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=xt.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(a){var n,f,u,b,k,C,g,A,V,S,F;if(!a){console.warn("manageValidity called without valid input element");return}this.required&&!this.value?this.internals.setValidity({valueMissing:!0},r.translations.forms.messages.required,a):(n=a.validity)!=null&&n.typeMismatch||(f=a.validity)!=null&&f.badInput?this.internals.setValidity({typeMismatch:!0},r.translations.forms.messages.invalid,a):(u=a.validity)!=null&&u.patternMismatch?this.internals.setValidity({patternMismatch:!0},r.translations.forms.messages.invalidPattern,a):(b=a.validity)!=null&&b.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},r.translations.forms.messages.tooShort,a):(k=a.validity)!=null&&k.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},r.translations.forms.messages.tooLong,a):(C=a.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,a):(A=a.validity)!=null&&A.stepMismatch?this.internals.setValidity({stepMismatch:!0},r.translations.forms.messages.invalid,a):(V=a.validity)!=null&&V.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?r.translations.forms.messages.rangeOverflowMax.replace("{max}",(S=this.max)==null?void 0:S.toString()):r.translations.forms.messages.rangeOverflow,a):(F=a.validity)!=null&&F.customError?this.internals.setValidity({customError:!0},a.validationMessage,a):this.internals.setValidity({})}setFormValue(a){if(this.internals)if(Array.isArray(a)){const n=new FormData;a.forEach(f=>{n.append(this.name,f)}),this.internals.setFormValue(n)}else this.internals.setFormValue(a)}coordinateRadioGroup(){if(!this.form||!this.name||this.type!=="radio")return;const a=`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`;this.form.querySelectorAll(a).forEach(n=>{var f;if(n!==this&&n.getAttribute("name")===this.name&&n.getAttribute("value")!==this.value){const u=n;u.checked&&(u.checked=!1,u.internals&&(u.internals.setFormValue(null),(f=u.internals.states)==null||f.delete(U)))}})}valueChecked(a){if(!this.touched)return;const n=this.internals.form||this.closest("form"),f=n?new FormData(n):null;if(this.type==="radio"&&this.coordinateRadioGroup(),typeof a=="string"?(this.checked=a==="true",this.internals.ariaChecked=String(a==="true")):typeof a=="boolean"&&(this.checked=a,this.internals.ariaChecked=String(a)),this.checked){const u=(typeof this.value=="string"?this.value:"")||dt;this.internals.setFormValue(u),f&&f.append(this.name,u),this.internals.states.add(U)}else this.internals.setFormValue(null),f&&f.delete(this.name),this.internals.states.delete(U);this.dispatchChangeEvents(this.checked),this.internals.reportValidity()}valueChanged(a,n){(n!==this.value||n!==this._value)&&(typeof a=="string"?((this.multiple||this.range)&&a.includes(D)&&(a=a.split(D)),this.value=a,this._value=Array.isArray(a)?a:[a]):Array.isArray(a)?(this.value=this.multiple||this.range?a:a[0],this._value=a):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&n&&n.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(n==null?void 0:n.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}dispatchChangeEvents(a){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:a,bubbles:!0,composed:!0}))}clearInputValue(){const a=this.multiple||this.range?[]:"";this.value=a,this.setFormValue(a),this.dispatchChangeEvents(a)}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(a){return(this.range||this.multiple)&&typeof a=="string"&&a.includes(D)?a.split(D):!this.multiple&&!this.range&&Array.isArray(a)?a[0]||"":a}validate(){var a,n;(a=this.inputRef)!=null&&a.value&&this.manageValidity(this.inputRef.value),(n=this.inputRefTo)!=null&&n.value&&this.manageValidity(this.inputRefTo.value)}onChange(a){if(!this.touched){this.touched=!0,a&&this.setFormValue(a);return}if(typeof a!="string"&&!Array.isArray(a))return;const n=this.normalizeValue(a);this.setFormValue(n),this.validate(),this.dispatchChangeEvents(n)}formResetCallback(){var a;if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(n=>{"selected"in n&&(n.selected=!1)}),this.checked!==void 0)this.checked=!1,this.internals.ariaChecked="false",this.internals.setFormValue(""),(a=this.inputRef)!=null&&a.value&&"checked"in this.inputRef.value&&(this.inputRef.value.checked=!1),this.valueChecked(this.checked);else{this.internals.setFormValue("");const n=this.defaultValue||(this.multiple||this.range?[]:"");this.value=n,this._value=Array.isArray(n)?n:[n],this.valueChanged(this.value,null)}this.internals.ariaInvalid="false"}updated(a){super.updated(a),a.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(a){if(super.firstUpdated(a),!this.form){const n=this.internals.form||this.closest("form");this.form=n}if(this.value&&this.defaultValue!==null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked="true",this.checked=!0),this.required&&(this.internals.ariaRequired="true"),this.disabled&&(this.internals.ariaDisabled="true"),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const n=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=String(n);const f=n?(typeof this.value=="string"?this.value:"")||dt:null;this.internals.setFormValue(f)}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))}}c([r.n({type:Boolean,reflect:!0})],l.prototype,"checked");c([r.n({type:Boolean})],l.prototype,"defaultChecked");c([r.n({type:Boolean})],l.prototype,"multiple");c([r.n({type:Boolean})],l.prototype,"range");c([r.n({type:String,reflect:!0})],l.prototype,"type");c([r.n()],l.prototype,"defaultValue");c([r.n({type:Boolean,reflect:!0})],l.prototype,"disabled");c([r.n({type:Boolean,reflect:!0})],l.prototype,"readonly");c([r.n({type:Boolean,reflect:!0})],l.prototype,"required");c([r.n({reflect:!0,converter:{fromAttribute:p=>p,toAttribute:p=>(p==null?void 0:p.toString())??null}})],l.prototype,"max");c([r.n({type:Number,reflect:!0})],l.prototype,"maxlength");c([r.n({reflect:!0,converter:{fromAttribute:p=>p,toAttribute:p=>(p==null?void 0:p.toString())??null}})],l.prototype,"min");c([r.n({type:Number,reflect:!0})],l.prototype,"minlength");c([r.n({type:Number,reflect:!0})],l.prototype,"step");c([r.n({type:String})],l.prototype,"ariaDescribedBy");c([r.n({type:String})],l.prototype,"ariaLabelledby");c([r.n({type:String,reflect:!0})],l.prototype,"name");c([r.n({type:String,reflect:!0})],l.prototype,"pattern");c([r.n({type:String,reflect:!0})],l.prototype,"placeholder");c([r.n({type:String,reflect:!0})],l.prototype,"id");c([r.n({type:Boolean})],l.prototype,"counter");c([r.n({type:Boolean})],l.prototype,"hasError");c([r.n({type:Boolean})],l.prototype,"inline");c([r.n({type:Boolean})],l.prototype,"hasFieldset");c([r.n({type:Boolean})],l.prototype,"optionalTag");c([r.n({type:Boolean})],l.prototype,"requiredTag");c([r.n({type:Boolean})],l.prototype,"skipForwardTestid");c([r.n({type:Boolean,reflect:!0,converter:Tt.booleanishConverter})],l.prototype,"useWrapper");c([r.n({type:Boolean,reflect:!0})],l.prototype,"fullwidth");c([r.n({type:Number})],l.prototype,"counterMaxLength");c([r.n({type:String})],l.prototype,"errorMessage");c([r.n({type:String})],l.prototype,"helptext");c([r.n({type:String})],l.prototype,"helptextDropdown");c([r.n({type:String,reflect:!1})],l.prototype,"helptextDropdownButton");c([r.n({type:String})],l.prototype,"label");c([r.n({type:String,reflect:!1})],l.prototype,"optionalText");c([r.n({type:String,reflect:!1})],l.prototype,"requiredText");c([r.n({type:String,reflect:!1})],l.prototype,"tagText");c([r.n({type:String,attribute:"data-testid"})],l.prototype,"dataTestid");c([St.r()],l.prototype,"touched");exports.PktInputElement=l;
|
package/dist/pkt-checkbox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./checkbox-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./checkbox-uxeHrTLH.cjs"),t=e.PktCheckbox;Object.defineProperty(exports,"PktCheckbox",{enumerable:!0,get:()=>e.PktCheckbox});exports.default=t;
|
package/dist/pkt-checkbox.js
CHANGED
package/dist/pkt-combobox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./combobox-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./combobox-CcyHcqdW.cjs"),o=e.PktCombobox;Object.defineProperty(exports,"PktCombobox",{enumerable:!0,get:()=>e.PktCombobox});exports.default=o;
|
package/dist/pkt-combobox.js
CHANGED
package/dist/pkt-datepicker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-BeMs_vsm.cjs"),t=e.PktDatepicker;Object.defineProperty(exports,"PktDatepicker",{enumerable:!0,get:()=>e.PktDatepicker});Object.defineProperty(exports,"PktDatepickerMultiple",{enumerable:!0,get:()=>e.PktDatepickerMultiple});Object.defineProperty(exports,"PktDatepickerRange",{enumerable:!0,get:()=>e.PktDatepickerRange});Object.defineProperty(exports,"PktDatepickerSingle",{enumerable:!0,get:()=>e.PktDatepickerSingle});exports.default=t;
|
package/dist/pkt-datepicker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as e } from "./datepicker-
|
|
2
|
-
import { d as p, c as i, b as c } from "./datepicker-
|
|
1
|
+
import { a as e } from "./datepicker-a2LvhbRb.js";
|
|
2
|
+
import { d as p, c as i, b as c } from "./datepicker-a2LvhbRb.js";
|
|
3
3
|
const a = e;
|
|
4
4
|
export {
|
|
5
5
|
e as PktDatepicker,
|
package/dist/pkt-header.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./element-CJ_QKaki.cjs"),g=require("./pkt-slot-controller-BzddBp7z.cjs"),v=require("./if-defined-Bc9-_I01.cjs"),h=require("./ref-BFa5Utho.cjs"),u=require("./booleanish-BKVonob4.cjs"),d=require("./state-DSjcvzDN.cjs"),p=require("./class-map-C_erArZz.cjs");require("./button-DaM4jvhJ.cjs");require("./icon-MRx-m0Or.cjs");require("./link-Dw39h-YN.cjs");require("./textinput-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./element-CJ_QKaki.cjs"),g=require("./pkt-slot-controller-BzddBp7z.cjs"),v=require("./if-defined-Bc9-_I01.cjs"),h=require("./ref-BFa5Utho.cjs"),u=require("./booleanish-BKVonob4.cjs"),d=require("./state-DSjcvzDN.cjs"),p=require("./class-map-C_erArZz.cjs");require("./button-DaM4jvhJ.cjs");require("./icon-MRx-m0Or.cjs");require("./link-Dw39h-YN.cjs");require("./textinput-BkYKotc1.cjs");const b=o=>typeof o.target=="string"?{title:o.title,iconName:o.iconName,href:o.target}:{title:o.title,iconName:o.iconName,onClick:o.target},f=o=>b(o),m=o=>{if(!o)return;const e=typeof o=="string"?new Date(o):o;if(!isNaN(e.getTime()))return e.toLocaleDateString("nb-NO",{day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"})};var y=Object.defineProperty,S=Object.getOwnPropertyDescriptor,k=(o,e,s,n)=>{for(var r=n>1?void 0:n?S(e,s):e,l=o.length-1,c;l>=0;l--)(c=o[l])&&(r=(n?c(e,s,r):c(r))||r);return n&&r&&y(e,s,r),r};exports.PktHeaderUserMenu=class extends t.PktElement{constructor(){super(...arguments),this.canChangeRepresentation=!1,this.logoutOnClick=!1}handleChangeRepresentation(){this.dispatchEvent(new CustomEvent("change-representation",{bubbles:!0,composed:!0}))}handleLogout(){this.dispatchEvent(new CustomEvent("log-out",{bubbles:!0,composed:!0}))}handleMenuItemClick(e){"onClick"in e&&typeof e.onClick=="function"&&e.onClick()}renderLinkOrButton(e,s){const n="href"in e,r=p.e({"pkt-user-menu__link":!0,"pkt-link-button":!n,"pkt-link":!n,"pkt-link--icon-left":!n,[s||""]:!!s});return n?t.x`
|
|
2
2
|
<pkt-link
|
|
3
3
|
icon-name=${e.iconName||t.E}
|
|
4
4
|
href=${e.href}
|
package/dist/pkt-header.js
CHANGED
|
@@ -8,7 +8,7 @@ import { e as g } from "./class-map-wy7PUk0P.js";
|
|
|
8
8
|
import "./button-CjXih_Nx.js";
|
|
9
9
|
import "./icon-BB7e5iQN.js";
|
|
10
10
|
import "./link-BboUBUcg.js";
|
|
11
|
-
import "./textinput-
|
|
11
|
+
import "./textinput-Lp1crOmj.js";
|
|
12
12
|
const C = (e) => typeof e.target == "string" ? { title: e.title, iconName: e.iconName, href: e.target } : { title: e.title, iconName: e.iconName, onClick: e.target }, L = (e) => C(e), w = (e) => {
|
|
13
13
|
if (!e) return;
|
|
14
14
|
const t = typeof e == "string" ? new Date(e) : e;
|
package/dist/pkt-index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./alert-SvqEDHuW.cjs"),P=require("./accordionitem-DCZrHVNR.cjs"),g=require("./backlink-BrIIpgJ7.cjs"),h=require("./button-DaM4jvhJ.cjs"),k=require("./calendar-ZzLAjDpv.cjs"),f=require("./card-C1gRTfXb.cjs"),y=require("./combobox-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./alert-SvqEDHuW.cjs"),P=require("./accordionitem-DCZrHVNR.cjs"),g=require("./backlink-BrIIpgJ7.cjs"),h=require("./button-DaM4jvhJ.cjs"),k=require("./calendar-ZzLAjDpv.cjs"),f=require("./card-C1gRTfXb.cjs"),y=require("./combobox-CcyHcqdW.cjs"),O=require("./consent-Daj-Xa7w.cjs"),j=require("./checkbox-uxeHrTLH.cjs"),t=require("./element-CJ_QKaki.cjs"),q=require("./pkt-slot-controller-BzddBp7z.cjs"),a=require("./ref-BFa5Utho.cjs"),x=require("./class-map-C_erArZz.cjs"),d=require("./datepicker-BeMs_vsm.cjs"),l=require("./pkt-header.cjs"),C=require("./helptext-hlcc584n.cjs"),v=require("./heading-Dv_cH6N1.cjs"),S=require("./icon-MRx-m0Or.cjs"),T=require("./input-wrapper-CtBiAb04.cjs"),$=require("./link-Dw39h-YN.cjs"),H=require("./linkcard-DUA3kGGd.cjs"),L=require("./loader-DjGxT7C3.cjs"),_=require("./messagebox-ChIKVTO_.cjs"),I=require("./modal-B4qq0VFB.cjs"),A=require("./progressbar-CmAQ-DVW.cjs"),p=require("./radiobutton-DVe09YxP.cjs"),B=require("./tag-B02fKJ66.cjs"),b=require("./tabitem-D5zyipN1.cjs"),M=require("./textarea-VBUXPS1O.cjs"),D=require("./textinput-BkYKotc1.cjs"),R=require("./select-7KFOnLln.cjs");var w=Object.defineProperty,E=Object.getOwnPropertyDescriptor,o=(s,e,r,i)=>{for(var n=i>1?void 0:i?E(e,r):e,u=s.length-1,c;u>=0;u--)(c=s[u])&&(n=(i?c(e,r,n):c(n))||n);return i&&n&&w(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=a.e(),this.namedSlot=a.e(),this.slotController=new q.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(e=>{this._list.push(e.toUpperCase())}),super.connectedCallback()}render(){const e={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return t.x`
|
|
2
2
|
<div class="${x.e(e)}">
|
|
3
3
|
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
4
4
|
|
package/dist/pkt-index.js
CHANGED
|
@@ -5,14 +5,14 @@ import { P as E } from "./button-CjXih_Nx.js";
|
|
|
5
5
|
import { c as d } from "./calendar-CvfMj3fA.js";
|
|
6
6
|
import { P as R } from "./calendar-CvfMj3fA.js";
|
|
7
7
|
import { P as M } from "./card-CO3D8wQE.js";
|
|
8
|
-
import { P as U } from "./combobox-
|
|
8
|
+
import { P as U } from "./combobox-MZsqmVL-.js";
|
|
9
9
|
import { P as N } from "./consent-BO3Ga8N4.js";
|
|
10
|
-
import { P as q } from "./checkbox-
|
|
10
|
+
import { P as q } from "./checkbox-DfVUNTjH.js";
|
|
11
11
|
import { P as f, t as h, x as l, n, a as c } from "./element-CRDRygXu.js";
|
|
12
12
|
import { P as x } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
13
13
|
import { e as m, n as k } from "./ref-Xa5dbh--.js";
|
|
14
14
|
import { e as u } from "./class-map-wy7PUk0P.js";
|
|
15
|
-
import { P as F, a as J } from "./datepicker-
|
|
15
|
+
import { P as F, a as J } from "./datepicker-a2LvhbRb.js";
|
|
16
16
|
import { PktHeader as V, PktHeaderService as X, PktHeaderUserMenu as Y } from "./pkt-header.js";
|
|
17
17
|
import { P as tt } from "./helptext-Bn17Picx.js";
|
|
18
18
|
import { P as rt } from "./heading-BUdy170t.js";
|
|
@@ -24,12 +24,12 @@ import { P as kt } from "./loader-DIum_s_D.js";
|
|
|
24
24
|
import { P as ft } from "./messagebox-aPlConlJ.js";
|
|
25
25
|
import { P as ct } from "./modal-jAUtM-NP.js";
|
|
26
26
|
import { P as ut } from "./progressbar-CVt73-JQ.js";
|
|
27
|
-
import { P as vt, P as bt } from "./radiobutton-
|
|
27
|
+
import { P as vt, P as bt } from "./radiobutton-BmgdSpYf.js";
|
|
28
28
|
import { P as Ct } from "./tag-CES41g0D.js";
|
|
29
29
|
import { a as yt, P as _t } from "./tabitem-NV2fzs_-.js";
|
|
30
|
-
import { P as Tt } from "./textarea-
|
|
31
|
-
import { P as At } from "./textinput-
|
|
32
|
-
import { P as wt } from "./select-
|
|
30
|
+
import { P as Tt } from "./textarea-Bmrv_vve.js";
|
|
31
|
+
import { P as At } from "./textinput-Lp1crOmj.js";
|
|
32
|
+
import { P as wt } from "./select-CKqz-JKZ.js";
|
|
33
33
|
var g = Object.defineProperty, v = Object.getOwnPropertyDescriptor, s = (t, e, i, a) => {
|
|
34
34
|
for (var r = a > 1 ? void 0 : a ? v(e, i) : e, p = t.length - 1, P; p >= 0; p--)
|
|
35
35
|
(P = t[p]) && (r = (a ? P(e, i, r) : P(r)) || r);
|
|
@@ -0,0 +1 @@
|
|
|
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.createOptions(),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.requestUpdate()}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;
|
|
@@ -6,7 +6,7 @@ class o {
|
|
|
6
6
|
hostConnected() {
|
|
7
7
|
Array.from(this.host.childNodes).forEach((t) => {
|
|
8
8
|
(t.nodeName === "OPTION" || t.nodeName === "DATA") && this.addNode(t);
|
|
9
|
-
}), this.observer.observe(this.host, { childList: !0, subtree: !1, attributes: !0 });
|
|
9
|
+
}), this.createOptions(), this.observer.observe(this.host, { childList: !0, subtree: !1, attributes: !0 });
|
|
10
10
|
}
|
|
11
11
|
hostDisconnected() {
|
|
12
12
|
this.observer.disconnect();
|
|
@@ -21,7 +21,7 @@ class o {
|
|
|
21
21
|
selected: t.hasAttribute("selected"),
|
|
22
22
|
disabled: t.hasAttribute("disabled"),
|
|
23
23
|
hidden: t.hasAttribute("data-hidden")
|
|
24
|
-
})), this.host.
|
|
24
|
+
})), this.host.requestUpdate();
|
|
25
25
|
}
|
|
26
26
|
handleMutations(t) {
|
|
27
27
|
let e = !1;
|
|
@@ -29,7 +29,7 @@ class o {
|
|
|
29
29
|
s.type === "childList" && (s.addedNodes.forEach((i) => {
|
|
30
30
|
r(i) && (this.addNode(i), e = !0);
|
|
31
31
|
}), s.removedNodes.forEach((i) => {
|
|
32
|
-
r(i) && (this.nodes = this.nodes.filter((
|
|
32
|
+
r(i) && (this.nodes = this.nodes.filter((a) => a !== i), e = !0);
|
|
33
33
|
})), s.type === "attributes" && r(s.target) && (this.addNode(s.target), e = !0);
|
|
34
34
|
}), e && this.createOptions();
|
|
35
35
|
}
|
package/dist/pkt-radiobutton.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./radiobutton-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./radiobutton-DVe09YxP.cjs"),e=t.PktRadioButton;Object.defineProperty(exports,"PktRadioButton",{enumerable:!0,get:()=>t.PktRadioButton});exports.default=e;
|
package/dist/pkt-radiobutton.js
CHANGED
package/dist/pkt-select.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./select-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./select-7KFOnLln.cjs"),t=e.PktSelect;Object.defineProperty(exports,"PktSelect",{enumerable:!0,get:()=>e.PktSelect});exports.default=t;
|
package/dist/pkt-select.js
CHANGED
package/dist/pkt-textarea.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textarea-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textarea-VBUXPS1O.cjs"),t=e.PktTextarea;Object.defineProperty(exports,"PktTextarea",{enumerable:!0,get:()=>e.PktTextarea});exports.default=t;
|
package/dist/pkt-textarea.js
CHANGED
package/dist/pkt-textinput.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textinput-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textinput-BkYKotc1.cjs"),t=e.PktTextinput;Object.defineProperty(exports,"PktTextinput",{enumerable:!0,get:()=>e.PktTextinput});exports.default=t;
|
package/dist/pkt-textinput.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { x as h, E as n, n as s, a as d } from "./element-CRDRygXu.js";
|
|
2
2
|
import { r as k } from "./state-DS_kr2Fy.js";
|
|
3
|
-
import { P as f } from "./input-element-
|
|
3
|
+
import { P as f } from "./input-element-CARcDzQB.js";
|
|
4
4
|
import { e as g, n as y } from "./ref-Xa5dbh--.js";
|
|
5
5
|
import { e as u } from "./class-map-wy7PUk0P.js";
|
|
6
6
|
var $ = Object.defineProperty, b = Object.getOwnPropertyDescriptor, i = (e, p, c, l) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-CJ_QKaki.cjs"),r=require("./state-DSjcvzDN.cjs"),u=require("./input-element-
|
|
1
|
+
"use strict";const t=require("./element-CJ_QKaki.cjs"),r=require("./state-DSjcvzDN.cjs"),u=require("./input-element-CiaV6jln.cjs"),h=require("./ref-BFa5Utho.cjs"),c=require("./class-map-C_erArZz.cjs");var d=Object.defineProperty,k=Object.getOwnPropertyDescriptor,i=(p,e,n,a)=>{for(var s=a>1?void 0:a?k(e,n):e,o=p.length-1,l;o>=0;o--)(l=p[o])&&(s=(a?l(e,n,s):l(s))||s);return a&&s&&d(e,n,s),s};exports.PktRadioButton=class extends u.PktInputElement{constructor(){super(...arguments),this.inputRef=h.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,n,a){e==="defaultChecked"&&(this._checked=this.defaultChecked),e==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(e,n,a)}render(){const e=c.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),n=c.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),a=c.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),s="pkt-tag pkt-tag--small pkt-tag--thin-text",o=()=>t.x`
|
|
2
2
|
${this.tagText?t.x`<span class=${s+" pkt-tag--gray"}>${this.tagText}</span>`:t.E}
|
|
3
3
|
${this.optionalTag?t.x`<span class=${s+" pkt-tag--blue-light"}>${this.optionalText}</span>`:t.E}
|
|
4
4
|
${this.requiredTag?t.x`<span class=${s+" pkt-tag--beige"}>${this.requiredText}</span>`:t.E}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";const p=require("./element-CJ_QKaki.cjs"),h=require("./ref-BFa5Utho.cjs"),l=require("./if-defined-Bc9-_I01.cjs"),c=require("./state-DSjcvzDN.cjs"),v=require("./input-element-CiaV6jln.cjs"),f=require("./pkt-options-controller-DjBCEHU4.cjs"),_=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-CtBiAb04.cjs");var $=Object.defineProperty,u=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&$(t,e,s),s};class a extends v.PktInputElement{constructor(){super(...arguments),this._optionsProp=[],this._options=[]}get options(){return this._options.map(t=>({...t,selected:this.isOptionSelected(t)}))}set options(t){this._optionsProp=t,this.requestUpdate("_optionsProp",this._options)}isOptionSelected(t){return Array.isArray(this.value)?this.value.includes(t.value):t.value===this.value}findOptionByValue(t){return this._options.find(e=>e.value===t)}getSelectedOptions(){return this._options.filter(t=>this.isOptionSelected(t))}parseOptions(){var i,s;const t=this._optionsProp.length>0,e=((s=(i=this.optionsController)==null?void 0:i.nodes)==null?void 0:s.length)&&this.optionsController.nodes.length>0;t?this._options=this._optionsProp:e&&(this._options=this.optionsController.options)}willUpdate(t){super.willUpdate(t),this.parseOptions()}}u([p.n({type:Array,attribute:"options"})],a.prototype,"_optionsProp");u([c.r()],a.prototype,"_options");var x=Object.defineProperty,b=Object.getOwnPropertyDescriptor,d=(r,t,e,i)=>{for(var s=i>1?void 0:i?b(t,e):t,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&x(t,e,s),s};exports.PktSelect=class extends a{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.value="",this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new f.PktOptionsSlotController(this),this.slotController=new _.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(t=>{t.selected&&!this.value&&(this.value=t.value)})}add(t,e){const i={value:t.value||t.text,label:t.text||t.value,selected:t.selected,disabled:t.disabled};if(e===void 0)this._options.push(i);else if(typeof e=="number")this._options.splice(e,0,i);else{const s=e.value||e.text,o=this._options.findIndex(n=>n.value===s);o>=0?this._options.splice(o,0,i):this._options.push(i)}t.selected&&(this.value=t.value||t.text,this.selectedIndex=this._options.findIndex(s=>s.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,i){var s,o;t==="options"&&(this._options=i?JSON.parse(i):[]),t==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((s=this.inputRef.value)==null?void 0:s.selectedIndex):this._options.findIndex(n=>n.value===i),this.selectedOptions=(o=this.inputRef.value)==null?void 0:o.selectedOptions,this.valueChanged(i,e)),super.attributeChangedCallback(t,e,i)}update(t){var e,i;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(s=>s.value===this.value),this.selectedOptions=(i=this.inputRef.value)==null?void 0:i.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(i=>i.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 p.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=${l.o(this.ariaDescribedBy)}
|
|
12
|
+
class="pkt-select"
|
|
13
|
+
errorMessage=${l.o(this.errorMessage)}
|
|
14
|
+
forId=${this.id+"-input"}
|
|
15
|
+
helptext=${l.o(this.helptext)}
|
|
16
|
+
helptextDropdown=${l.o(this.helptextDropdown)}
|
|
17
|
+
helptextDropdownButton=${l.o(this.helptextDropdownButton)}
|
|
18
|
+
label=${l.o(this.label)}
|
|
19
|
+
optionalText=${l.o(this.optionalText)}
|
|
20
|
+
requiredText=${l.o(this.requiredText)}
|
|
21
|
+
tagText=${l.o(this.tagText)}
|
|
22
|
+
>
|
|
23
|
+
<select
|
|
24
|
+
class=${t}
|
|
25
|
+
aria-invalid=${this.hasError}
|
|
26
|
+
aria-errormessage=${`${this.id}-error`}
|
|
27
|
+
aria-labelledby=${l.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
|
+
${h.n(this.inputRef)}
|
|
37
|
+
>
|
|
38
|
+
${this._options.length>0?this._options.map(e=>p.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" ${h.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
48
|
+
</pkt-input-wrapper>
|
|
49
|
+
`}returnNumberOrNull(t){return t==null||isNaN(t)?null:t}};d([p.n({type:String})],exports.PktSelect.prototype,"value",2);exports.PktSelect=d([p.t("pkt-select")],exports.PktSelect);
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { n as c, x as a, a as _ } from "./element-CRDRygXu.js";
|
|
2
|
+
import { e as u, n as d } from "./ref-Xa5dbh--.js";
|
|
3
|
+
import { o as n } from "./if-defined-BWZGb3bh.js";
|
|
4
|
+
import { r as $ } from "./state-DS_kr2Fy.js";
|
|
5
|
+
import { P as x } from "./input-element-CARcDzQB.js";
|
|
6
|
+
import { P as m } from "./pkt-options-controller-zn5cmMvL.js";
|
|
7
|
+
import { P as b } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
8
|
+
import "./input-wrapper-1PCXqtiu.js";
|
|
9
|
+
var P = Object.defineProperty, v = (e, t, s, o) => {
|
|
10
|
+
for (var i = void 0, l = e.length - 1, p; l >= 0; l--)
|
|
11
|
+
(p = e[l]) && (i = p(t, s, i) || i);
|
|
12
|
+
return i && P(t, s, i), i;
|
|
13
|
+
};
|
|
14
|
+
class h extends x {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments), this._optionsProp = [], this._options = [];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Public getter for options that includes selected state
|
|
20
|
+
* Override this in subclasses to customize the selected state logic
|
|
21
|
+
*/
|
|
22
|
+
get options() {
|
|
23
|
+
return this._options.map((t) => ({
|
|
24
|
+
...t,
|
|
25
|
+
selected: this.isOptionSelected(t)
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Public setter for options
|
|
30
|
+
*/
|
|
31
|
+
set options(t) {
|
|
32
|
+
this._optionsProp = t, this.requestUpdate("_optionsProp", this._options);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Determines if an option is selected
|
|
36
|
+
* Subclasses should override this to implement their selection logic
|
|
37
|
+
*
|
|
38
|
+
* @param option - The option to check
|
|
39
|
+
* @returns True if the option is selected
|
|
40
|
+
* @protected
|
|
41
|
+
*/
|
|
42
|
+
isOptionSelected(t) {
|
|
43
|
+
return Array.isArray(this.value) ? this.value.includes(t.value) : t.value === this.value;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Finds an option by its value
|
|
47
|
+
*
|
|
48
|
+
* @param value - The value to search for
|
|
49
|
+
* @returns The option if found, undefined otherwise
|
|
50
|
+
* @protected
|
|
51
|
+
*/
|
|
52
|
+
findOptionByValue(t) {
|
|
53
|
+
return this._options.find((s) => s.value === t);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Gets all currently selected options
|
|
57
|
+
*
|
|
58
|
+
* @returns Array of selected options
|
|
59
|
+
* @protected
|
|
60
|
+
*/
|
|
61
|
+
getSelectedOptions() {
|
|
62
|
+
return this._options.filter((t) => this.isOptionSelected(t));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Parses options from either props or slot controller
|
|
66
|
+
* Call this in connectedCallback to initialize options
|
|
67
|
+
*
|
|
68
|
+
* @protected
|
|
69
|
+
*/
|
|
70
|
+
parseOptions() {
|
|
71
|
+
var o, i;
|
|
72
|
+
const t = this._optionsProp.length > 0, s = ((i = (o = this.optionsController) == null ? void 0 : o.nodes) == null ? void 0 : i.length) && this.optionsController.nodes.length > 0;
|
|
73
|
+
t ? this._options = this._optionsProp : s && (this._options = this.optionsController.options);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Re-parse options when the component updates
|
|
77
|
+
* This ensures options stay in sync when they change dynamically
|
|
78
|
+
*
|
|
79
|
+
* @protected
|
|
80
|
+
*/
|
|
81
|
+
willUpdate(t) {
|
|
82
|
+
super.willUpdate(t), this.parseOptions();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
v([
|
|
86
|
+
c({ type: Array, attribute: "options" })
|
|
87
|
+
], h.prototype, "_optionsProp");
|
|
88
|
+
v([
|
|
89
|
+
$()
|
|
90
|
+
], h.prototype, "_options");
|
|
91
|
+
var g = Object.defineProperty, O = Object.getOwnPropertyDescriptor, f = (e, t, s, o) => {
|
|
92
|
+
for (var i = o > 1 ? void 0 : o ? O(t, s) : t, l = e.length - 1, p; l >= 0; l--)
|
|
93
|
+
(p = e[l]) && (i = (o ? p(t, s, i) : p(i)) || i);
|
|
94
|
+
return o && i && g(t, s, i), i;
|
|
95
|
+
};
|
|
96
|
+
let r = class extends h {
|
|
97
|
+
constructor() {
|
|
98
|
+
super(), this.inputRef = u(), this.helptextSlot = u(), this.value = "", this.selectedIndex = -1, this.selectedOptions = void 0, this.optionsController = new m(this), this.slotController = new b(this, this.helptextSlot), this.slotController.skipOptions = !0;
|
|
99
|
+
}
|
|
100
|
+
connectedCallback() {
|
|
101
|
+
super.connectedCallback(), this.parseOptions(), this._options.forEach((e) => {
|
|
102
|
+
e.selected && !this.value && (this.value = e.value);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
// Support native Select method `add`
|
|
106
|
+
add(e, t) {
|
|
107
|
+
const s = {
|
|
108
|
+
value: e.value || e.text,
|
|
109
|
+
label: e.text || e.value,
|
|
110
|
+
selected: e.selected,
|
|
111
|
+
disabled: e.disabled
|
|
112
|
+
};
|
|
113
|
+
if (t === void 0)
|
|
114
|
+
this._options.push(s);
|
|
115
|
+
else if (typeof t == "number")
|
|
116
|
+
this._options.splice(t, 0, s);
|
|
117
|
+
else {
|
|
118
|
+
const o = t.value || t.text, i = this._options.findIndex((l) => l.value === o);
|
|
119
|
+
i >= 0 ? this._options.splice(i, 0, s) : this._options.push(s);
|
|
120
|
+
}
|
|
121
|
+
e.selected && (this.value = e.value || e.text, this.selectedIndex = this._options.findIndex((o) => o.value === this.value)), this.requestUpdate();
|
|
122
|
+
}
|
|
123
|
+
// Support native Select method `remove`
|
|
124
|
+
remove(e) {
|
|
125
|
+
var t;
|
|
126
|
+
typeof e == "number" && (this.selectedIndex === e && (this.value = ((t = this._options[0]) == null ? void 0 : t.value) || ""), this._options.splice(e, 1), this.requestUpdate());
|
|
127
|
+
}
|
|
128
|
+
// Support native Select method `item`
|
|
129
|
+
item(e) {
|
|
130
|
+
var t;
|
|
131
|
+
return (t = this.inputRef.value) == null ? void 0 : t.item(e);
|
|
132
|
+
}
|
|
133
|
+
// Support native Select method `namedItem`
|
|
134
|
+
namedItem(e) {
|
|
135
|
+
var t;
|
|
136
|
+
return (t = this.inputRef.value) == null ? void 0 : t.namedItem(e);
|
|
137
|
+
}
|
|
138
|
+
// Support native Select method `showPicker`
|
|
139
|
+
showPicker() {
|
|
140
|
+
this.inputRef.value && "showPicker" in this.inputRef.value && this.inputRef.value.showPicker();
|
|
141
|
+
}
|
|
142
|
+
attributeChangedCallback(e, t, s) {
|
|
143
|
+
var o, i;
|
|
144
|
+
e === "options" && (this._options = s ? JSON.parse(s) : []), e === "value" && this.value !== t && (this.selectedIndex = this.touched ? this.returnNumberOrNull((o = this.inputRef.value) == null ? void 0 : o.selectedIndex) : this._options.findIndex((l) => l.value === s), this.selectedOptions = (i = this.inputRef.value) == null ? void 0 : i.selectedOptions, this.valueChanged(s, t)), super.attributeChangedCallback(e, t, s);
|
|
145
|
+
}
|
|
146
|
+
update(e) {
|
|
147
|
+
var t, s;
|
|
148
|
+
super.update(e), e.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)), e.has("value") && this.value !== e.get("value") && (this.selectedIndex = this.touched ? this.returnNumberOrNull((t = this.inputRef.value) == null ? void 0 : t.selectedIndex) : this._options.findIndex((o) => o.value === this.value), this.selectedOptions = (s = this.inputRef.value) == null ? void 0 : s.selectedOptions, this.valueChanged(this.value, e.get("value"))), e.has("id") && !this.name && this.id && (this.name = this.id);
|
|
149
|
+
}
|
|
150
|
+
firstUpdated(e) {
|
|
151
|
+
var t;
|
|
152
|
+
super.firstUpdated(e), 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 = (t = this.inputRef.value) == null ? void 0 : t.selectedOptions;
|
|
153
|
+
}
|
|
154
|
+
render() {
|
|
155
|
+
const e = `pkt-input ${this.fullwidth ? "pkt-input--fullwidth" : ""}`;
|
|
156
|
+
return a`
|
|
157
|
+
<pkt-input-wrapper
|
|
158
|
+
?counter=${this.counter}
|
|
159
|
+
?disabled=${this.disabled}
|
|
160
|
+
?hasError=${this.hasError}
|
|
161
|
+
?hasFieldset=${this.hasFieldset}
|
|
162
|
+
?inline=${this.inline}
|
|
163
|
+
?optionalTag=${this.optionalTag}
|
|
164
|
+
?requiredTag=${this.requiredTag}
|
|
165
|
+
useWrapper=${this.useWrapper}
|
|
166
|
+
ariaDescribedBy=${n(this.ariaDescribedBy)}
|
|
167
|
+
class="pkt-select"
|
|
168
|
+
errorMessage=${n(this.errorMessage)}
|
|
169
|
+
forId=${this.id + "-input"}
|
|
170
|
+
helptext=${n(this.helptext)}
|
|
171
|
+
helptextDropdown=${n(this.helptextDropdown)}
|
|
172
|
+
helptextDropdownButton=${n(this.helptextDropdownButton)}
|
|
173
|
+
label=${n(this.label)}
|
|
174
|
+
optionalText=${n(this.optionalText)}
|
|
175
|
+
requiredText=${n(this.requiredText)}
|
|
176
|
+
tagText=${n(this.tagText)}
|
|
177
|
+
>
|
|
178
|
+
<select
|
|
179
|
+
class=${e}
|
|
180
|
+
aria-invalid=${this.hasError}
|
|
181
|
+
aria-errormessage=${`${this.id}-error`}
|
|
182
|
+
aria-labelledby=${n(this.ariaLabelledby)}
|
|
183
|
+
?disabled=${this.disabled}
|
|
184
|
+
id=${this.id + "-input"}
|
|
185
|
+
name=${(this.name || this.id) + "-input"}
|
|
186
|
+
value=${this.value}
|
|
187
|
+
@change=${(t) => {
|
|
188
|
+
this.touched = !0, this.value = t.target.value, t.stopImmediatePropagation();
|
|
189
|
+
}}
|
|
190
|
+
@input=${(t) => {
|
|
191
|
+
this.onInput(), t.stopImmediatePropagation();
|
|
192
|
+
}}
|
|
193
|
+
@focus=${(t) => {
|
|
194
|
+
this.onFocus(), t.stopImmediatePropagation();
|
|
195
|
+
}}
|
|
196
|
+
@blur=${(t) => {
|
|
197
|
+
this.onBlur(), t.stopImmediatePropagation();
|
|
198
|
+
}}
|
|
199
|
+
${d(this.inputRef)}
|
|
200
|
+
>
|
|
201
|
+
${this._options.length > 0 ? this._options.map(
|
|
202
|
+
(t) => a`<option
|
|
203
|
+
value=${t.value}
|
|
204
|
+
?selected=${this.value == t.value || t.selected}
|
|
205
|
+
?disabled=${t.disabled}
|
|
206
|
+
?hidden=${t.hidden}
|
|
207
|
+
>
|
|
208
|
+
${t.label}
|
|
209
|
+
</option>`
|
|
210
|
+
) : ""}
|
|
211
|
+
</select>
|
|
212
|
+
<div class="pkt-contents" ${d(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
213
|
+
</pkt-input-wrapper>
|
|
214
|
+
`;
|
|
215
|
+
}
|
|
216
|
+
returnNumberOrNull(e) {
|
|
217
|
+
return e == null || isNaN(e) ? null : e;
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
f([
|
|
221
|
+
c({ type: String })
|
|
222
|
+
], r.prototype, "value", 2);
|
|
223
|
+
r = f([
|
|
224
|
+
_("pkt-select")
|
|
225
|
+
], r);
|
|
226
|
+
export {
|
|
227
|
+
r as P
|
|
228
|
+
};
|
|
@@ -5,7 +5,7 @@ import { e as m, n as c } from "./ref-Xa5dbh--.js";
|
|
|
5
5
|
import { e as v } from "./class-map-wy7PUk0P.js";
|
|
6
6
|
import { e as T, i as b, t as a } from "./directive-oAbCiebi.js";
|
|
7
7
|
import { f as y, m as w } from "./directive-helpers-BzAtj9by.js";
|
|
8
|
-
import { P as C } from "./input-element-
|
|
8
|
+
import { P as C } from "./input-element-CARcDzQB.js";
|
|
9
9
|
import { P as E } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
10
10
|
import "./input-wrapper-1PCXqtiu.js";
|
|
11
11
|
import "./icon-BB7e5iQN.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const s=require("./element-CJ_QKaki.cjs"),p=require("./if-defined-Bc9-_I01.cjs"),c=require("./state-DSjcvzDN.cjs"),l=require("./ref-BFa5Utho.cjs"),$=require("./class-map-C_erArZz.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-4oOjKnGY.cjs"),x=require("./input-element-
|
|
1
|
+
"use strict";const s=require("./element-CJ_QKaki.cjs"),p=require("./if-defined-Bc9-_I01.cjs"),c=require("./state-DSjcvzDN.cjs"),l=require("./ref-BFa5Utho.cjs"),$=require("./class-map-C_erArZz.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-4oOjKnGY.cjs"),x=require("./input-element-CiaV6jln.cjs"),T=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-CtBiAb04.cjs");require("./icon-MRx-m0Or.cjs");/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-CJ_QKaki.cjs"),a=require("./if-defined-Bc9-_I01.cjs"),l=require("./state-DSjcvzDN.cjs"),h=require("./ref-BFa5Utho.cjs"),c=require("./class-map-C_erArZz.cjs"),d=require("./input-element-
|
|
1
|
+
"use strict";const t=require("./element-CJ_QKaki.cjs"),a=require("./if-defined-Bc9-_I01.cjs"),l=require("./state-DSjcvzDN.cjs"),h=require("./ref-BFa5Utho.cjs"),c=require("./class-map-C_erArZz.cjs"),d=require("./input-element-CiaV6jln.cjs"),x=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-CtBiAb04.cjs");require("./icon-MRx-m0Or.cjs");var $=Object.defineProperty,f=Object.getOwnPropertyDescriptor,r=(u,i,s,n)=>{for(var e=n>1?void 0:n?f(i,s):i,o=u.length-1,p;o>=0;o--)(p=u[o])&&(e=(n?p(i,s,e):p(e))||e);return n&&e&&$(i,s,e),e};exports.PktTextinput=class extends d.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.value="",this.type="text",this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.slotController=new x.PktSlotController(this,this.helptextSlot)}attributeChangedCallback(i,s,n){i==="value"&&this.value!==s&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,s)),super.attributeChangedCallback(i,s,n)}updated(i){var s;super.updated(i),i.has("value")&&(this.counterCurrent=((s=this.value)==null?void 0:s.length)||0,this.valueChanged(this.value,i.get("value"))),i.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const i=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,s=c.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),n=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
label="${this.label}"
|
|
4
4
|
?counter=${this.counter}
|
|
@@ -3,7 +3,7 @@ import { o as u } from "./if-defined-BWZGb3bh.js";
|
|
|
3
3
|
import { r as f } from "./state-DS_kr2Fy.js";
|
|
4
4
|
import { e as d, n as m } from "./ref-Xa5dbh--.js";
|
|
5
5
|
import { e as g } from "./class-map-wy7PUk0P.js";
|
|
6
|
-
import { P as x } from "./input-element-
|
|
6
|
+
import { P as x } from "./input-element-CARcDzQB.js";
|
|
7
7
|
import { P as v } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
8
8
|
import "./input-wrapper-1PCXqtiu.js";
|
|
9
9
|
import "./icon-BB7e5iQN.js";
|