@oslokommune/punkt-react 13.2.3 → 13.2.4

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.
@@ -820,7 +820,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
820
820
  role="searchbox"
821
821
  />
822
822
  </div>
823
- `:qe}handleSearchInput(t){this.searchValue=t.target.value,this.dispatchEvent(new CustomEvent("search",{detail:this.searchValue,bubbles:!1}))}handleSearchKeydown(t){switch(t.key){case"Enter":t.preventDefault();break;case"ArrowUp":case"Escape":this.closeOptions(),t.preventDefault();break;case"ArrowDown":case"Tab":this.focusFirstOrSelectedOption();break}}handleOptionKeydown(t){const i=t.currentTarget,l=i.dataset.value,c=i.dataset.type,h=i.dataset.selected==="true";if(!(!this.getOptionElements().length&&(!this.customUserInput||!this.allowUserInput&&this.customUserInput)&&c!=="new-option"&&c!=="searchbox"))switch(t.key){case" ":case"Enter":this.toggleOption(i),t.preventDefault();break;case"Backspace":l&&(h?this.toggleOption(i):this.closeOptions()),t.preventDefault();break;case"Escape":case"Tab":this.closeOptions();break;case"ArrowDown":t.altKey?this.focusLastOption():c==="searchbox"||c==="new-option"?this.focusFirstOption():this.focusNextOption(i),t.preventDefault();break;case"ArrowUp":if(t.altKey)this.focusFirstOption();else if(i.dataset.index==="0"&&this.includeSearch){const m=this.querySelector('[role="searchbox"]');m&&m.focus()}else if(i.dataset.index==="0"&&this.customUserInput){const m=this.querySelector('[data-type="new-option"]');m&&m.focus()}else this.focusPreviousOption(i);t.preventDefault();break;case"Home":this.focusFirstOption(),t.preventDefault();break;case"End":this.focusLastOption(),t.preventDefault();break;default:(t.metaKey||t.ctrlKey)&&t.key==="a"&&(this.selectAll(),t.preventDefault()),this.isLetterOrSpace(t.key)&&(this.handleTypeAhead(t.key),t.preventDefault());break}}focusAndScrollIntoView(t){t.scrollIntoView({block:"nearest"}),window.setTimeout(()=>t.focus(),0)}focusNextOption(t){const i=t.nextElementSibling;i&&this.focusAndScrollIntoView(i)}focusPreviousOption(t){const i=t.previousElementSibling;if(t.dataset.index==="0"&&this.includeSearch){const l=this.querySelector('[role="searchbox"]');l&&this.focusAndScrollIntoView(l)}else i&&this.focusAndScrollIntoView(i)}focusFirstOption(){const t=this.getOptionElements()[0];t&&this.focusAndScrollIntoView(t)}focusLastOption(){const t=this.getOptionElements().pop();t&&this.focusAndScrollIntoView(t)}focusFirstOrSelectedOption(){if(this.disabled)return;const t=this.getOptionElements().find(i=>i.dataset.selected==="true");if(this.allowUserInput&&this.customUserInput){const i=this.querySelector('[data-type="new-option"]');this.focusAndScrollIntoView(i)}else if(t)this.focusAndScrollIntoView(t);else if(this.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){const i=this.querySelector('[role="searchbox"]');window.setTimeout(()=>i.focus(),0)}else this.focusFirstOption()}toggleOption(t){const i=t instanceof HTMLElement?t.dataset.disabled:t.disabled;if(this.disabled||i)return;const l=t instanceof HTMLElement?t.dataset.value:t.value;this.dispatchEvent(new CustomEvent("option-toggle",{detail:l,bubbles:!1}))}selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!1}))}closeOptions(){this.dispatchEvent(new CustomEvent("close-options",{bubbles:!1}))}filterOptions(){this.searchValue?this._filteredOptions=this.options.filter(t=>{var i;return(t.label+t.value).toLowerCase().includes(((i=this.searchValue)==null?void 0:i.toLowerCase())||"")}):this._filteredOptions=[...this.options]}isLetterOrSpace(t){return/^[\p{L} ]$/u.test(t)}handleTypeAhead(t){this.typeAheadString+=t.toLowerCase(),this.typeAheadTimeout&&clearTimeout(this.typeAheadTimeout),this.typeAheadTimeout=window.setTimeout(()=>{this.typeAheadString=""},500);const i=this.getOptionElements().find(l=>{var c;return(c=l.textContent)==null?void 0:c.trim().toLowerCase().startsWith(this.typeAheadString)});i&&this.focusAndScrollIntoView(i)}getOptionElements(){return this._filteredOptions.length?Array.from(this.querySelectorAll('[role="option"]:not([data-disabled])')||[]):[]}};Di([z({type:String})],ri.prototype,"id",2),Di([z({type:String})],ri.prototype,"label",2),Di([z({type:Array})],ri.prototype,"options",2),Di([z({type:Boolean,reflect:!0})],ri.prototype,"isOpen",2),Di([z({type:Boolean})],ri.prototype,"disabled",2),Di([z({type:Boolean})],ri.prototype,"includeSearch",2),Di([z({type:Boolean})],ri.prototype,"isMultiSelect",2),Di([z({type:Boolean})],ri.prototype,"allowUserInput",2),Di([z({type:Boolean})],ri.prototype,"maxIsReached",2),Di([z({type:String})],ri.prototype,"customUserInput",2),Di([z({type:String})],ri.prototype,"searchPlaceholder",2),Di([z({type:String})],ri.prototype,"searchValue",2),Di([z({type:Number})],ri.prototype,"maxLength",2),Di([z({type:String})],ri.prototype,"userMessage",2),Di([Pn()],ri.prototype,"_filteredOptions",2),ri=Di([pr("pkt-listbox")],ri);const D3={displayValueAs:{default:"label"}},S3={props:D3};var x3=Object.defineProperty,C3=Object.getOwnPropertyDescriptor,na=(r,t,i,l)=>{for(var c=l>1?void 0:l?C3(t,i):t,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(t,i,c):m(c))||c);return l&&c&&x3(t,i,c),c};let Ur=class extends un{constructor(){super(),this.helptextSlot=hn(),this.value="",this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder="",this.multiple=!1,this.maxlength=null,this.displayValueAs=S3.props.displayValueAs.default,this.tagPlacement=null,this._options=[],this._isOptionsOpen=!1,this._value=[],this._userInfoMessage="",this._addValueText=null,this._maxIsReached=!1,this._search="",this._inputFocus=!1,this._editingSingleValue=!1,this.inputRef=hn(),this.arrowRef=hn(),this.listboxRef=hn(),this.focusRef=hn(),this.optionTagRef=hn(),this.optionsController=new GC(this),this.slotController=new za(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){var t;if(super.connectedCallback(),document&&document.body.addEventListener("click",i=>{this._isOptionsOpen&&!this.contains(i.target)&&this.handleFocusOut(i)}),this._options=[],this.defaultOptions&&this.defaultOptions.length){const i=((t=this.options)==null?void 0:t.filter(l=>l.userAdded))||[];this.options=[...i,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=[...this.options]}if(this.optionsController.nodes.length){const i=[];this.optionsController.nodes.forEach(l=>{if(!l.textContent&&!l.getAttribute("value"))return null;const c={value:l.getAttribute("value")||l.textContent||"",label:l.textContent||l.getAttribute("value")||""};l.getAttribute("data-prefix")&&(c.prefix=l.getAttribute("data-prefix")||void 0),l.getAttribute("tagskincolor")&&(c.tagSkinColor=l.getAttribute("tagskincolor")),l.getAttribute("description")&&(c.description=l.getAttribute("description")||void 0),c.fulltext=c.value+c.label+(c.prefix||""),i.push(c)}),i.length&&(this.options=[...i],this._options=[...i])}}updated(t){var i;if(t.has("_value")&&this.valueChanged(this._value,t.get("_value")),t.has("value")&&(this._value=Array.isArray(this.value)?this.value:this.value?this.value.split(","):[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]]),this.isMaxItemsReached()),t.has("defaultOptions")&&this.defaultOptions.length){const l=((i=this.options)==null?void 0:i.filter(c=>c.userAdded))||[];this.options=[...l,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=[...this.options]}if(t.has("options")&&this.options.length){const l=this._options.filter(c=>c.userAdded).filter(c=>!this.options.some(h=>h.value===c.value));this._options=[...l,...this.options],this._options.forEach(c=>{if(c.value&&!c.label&&(c.label=c.value),c.selected&&!this._value.includes(c.value)){const h=[...this._value];this._value=[...this._value,c.value],this.valueChanged(this._value,h)}c.fulltext=c.value+c.label+(c.prefix||""),c.selected=c.selected||this._value.includes(c.value)})}t.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),super.updated(t)}attributeChangedCallback(t,i,l){t==="value"&&(this._value=Array.isArray(this.value)?this.value:this.value?this.value.split(","):[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]])),t==="options"&&(this._options=this.options,this._options.forEach(c=>{c.value&&!c.label&&(c.label=c.value),c.selected&&!this._value.includes(c.value)&&(this._value=[...this._value,c.value]),c.fulltext=c.value+c.label+(c.prefix||"")}),this._search=""),super.attributeChangedCallback(t,i,l)}render(){return ye`
823
+ `:qe}handleSearchInput(t){this.searchValue=t.target.value,this.dispatchEvent(new CustomEvent("search",{detail:this.searchValue,bubbles:!1}))}handleSearchKeydown(t){switch(t.key){case"Enter":t.preventDefault();break;case"ArrowUp":case"Escape":this.closeOptions(),t.preventDefault();break;case"ArrowDown":case"Tab":this.focusFirstOrSelectedOption();break}}handleOptionKeydown(t){const i=t.currentTarget,l=i.dataset.value,c=i.dataset.type,h=i.dataset.selected==="true";if(!(!this.getOptionElements().length&&(!this.customUserInput||!this.allowUserInput&&this.customUserInput)&&c!=="new-option"&&c!=="searchbox"))switch(t.key){case" ":case"Enter":this.toggleOption(i),t.preventDefault();break;case"Backspace":l&&(h?this.toggleOption(i):this.closeOptions()),t.preventDefault();break;case"Escape":case"Tab":this.closeOptions();break;case"ArrowDown":t.altKey?this.focusLastOption():c==="searchbox"||c==="new-option"?this.focusFirstOption():this.focusNextOption(i),t.preventDefault();break;case"ArrowUp":if(t.altKey)this.focusFirstOption();else if(i.dataset.index==="0"&&this.includeSearch){const m=this.querySelector('[role="searchbox"]');m&&m.focus()}else if(i.dataset.index==="0"&&this.customUserInput){const m=this.querySelector('[data-type="new-option"]');m&&m.focus()}else this.focusPreviousOption(i);t.preventDefault();break;case"Home":this.focusFirstOption(),t.preventDefault();break;case"End":this.focusLastOption(),t.preventDefault();break;default:(t.metaKey||t.ctrlKey)&&t.key==="a"&&(this.selectAll(),t.preventDefault()),this.isLetterOrSpace(t.key)&&(this.handleTypeAhead(t.key),t.preventDefault());break}}focusAndScrollIntoView(t){t.scrollIntoView({block:"nearest"}),window.setTimeout(()=>t.focus(),0)}focusNextOption(t){const i=t.nextElementSibling;i&&this.focusAndScrollIntoView(i)}focusPreviousOption(t){const i=t.previousElementSibling;if(t.dataset.index==="0"&&this.includeSearch){const l=this.querySelector('[role="searchbox"]');l&&this.focusAndScrollIntoView(l)}else i&&this.focusAndScrollIntoView(i)}focusFirstOption(){const t=this.getOptionElements()[0];t&&this.focusAndScrollIntoView(t)}focusLastOption(){const t=this.getOptionElements().pop();t&&this.focusAndScrollIntoView(t)}focusFirstOrSelectedOption(){if(this.disabled)return;const t=this.getOptionElements().find(i=>i.dataset.selected==="true");if(this.allowUserInput&&this.customUserInput){const i=this.querySelector('[data-type="new-option"]');this.focusAndScrollIntoView(i)}else if(t)this.focusAndScrollIntoView(t);else if(this.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){const i=this.querySelector('[role="searchbox"]');window.setTimeout(()=>i.focus(),0)}else this.focusFirstOption()}toggleOption(t){const i=t instanceof HTMLElement?t.dataset.disabled:t.disabled;if(this.disabled||i)return;const l=t instanceof HTMLElement?t.dataset.value:t.value;this.dispatchEvent(new CustomEvent("option-toggle",{detail:l,bubbles:!1}))}selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!1}))}closeOptions(){this.dispatchEvent(new CustomEvent("close-options",{bubbles:!1}))}filterOptions(){this.searchValue?this._filteredOptions=this.options.filter(t=>{var i;return(t.label+t.value).toLowerCase().includes(((i=this.searchValue)==null?void 0:i.toLowerCase())||"")}):this._filteredOptions=[...this.options]}isLetterOrSpace(t){return/^[\p{L} ]$/u.test(t)}handleTypeAhead(t){this.typeAheadString+=t.toLowerCase(),this.typeAheadTimeout&&clearTimeout(this.typeAheadTimeout),this.typeAheadTimeout=window.setTimeout(()=>{this.typeAheadString=""},500);const i=this.getOptionElements().find(l=>{var c;return(c=l.textContent)==null?void 0:c.trim().toLowerCase().startsWith(this.typeAheadString)});i&&this.focusAndScrollIntoView(i)}getOptionElements(){return this._filteredOptions.length?Array.from(this.querySelectorAll('[role="option"]:not([data-disabled])')||[]):[]}};Di([z({type:String})],ri.prototype,"id",2),Di([z({type:String})],ri.prototype,"label",2),Di([z({type:Array})],ri.prototype,"options",2),Di([z({type:Boolean,reflect:!0})],ri.prototype,"isOpen",2),Di([z({type:Boolean})],ri.prototype,"disabled",2),Di([z({type:Boolean})],ri.prototype,"includeSearch",2),Di([z({type:Boolean})],ri.prototype,"isMultiSelect",2),Di([z({type:Boolean})],ri.prototype,"allowUserInput",2),Di([z({type:Boolean})],ri.prototype,"maxIsReached",2),Di([z({type:String})],ri.prototype,"customUserInput",2),Di([z({type:String})],ri.prototype,"searchPlaceholder",2),Di([z({type:String})],ri.prototype,"searchValue",2),Di([z({type:Number})],ri.prototype,"maxLength",2),Di([z({type:String})],ri.prototype,"userMessage",2),Di([Pn()],ri.prototype,"_filteredOptions",2),ri=Di([pr("pkt-listbox")],ri);const D3={displayValueAs:{default:"label"}},S3={props:D3};var x3=Object.defineProperty,C3=Object.getOwnPropertyDescriptor,na=(r,t,i,l)=>{for(var c=l>1?void 0:l?C3(t,i):t,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(t,i,c):m(c))||c);return l&&c&&x3(t,i,c),c};let Ur=class extends un{constructor(){super(),this.helptextSlot=hn(),this.value="",this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder="",this.multiple=!1,this.maxlength=null,this.displayValueAs=S3.props.displayValueAs.default,this.tagPlacement=null,this._options=[],this._isOptionsOpen=!1,this._value=[],this._userInfoMessage="",this._addValueText=null,this._maxIsReached=!1,this._search="",this._inputFocus=!1,this._editingSingleValue=!1,this.inputRef=hn(),this.arrowRef=hn(),this.listboxRef=hn(),this.focusRef=hn(),this.optionTagRef=hn(),this.optionsController=new GC(this),this.slotController=new za(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){var t;if(super.connectedCallback(),document&&document.body.addEventListener("click",i=>{this._isOptionsOpen&&!this.contains(i.target)&&this.handleFocusOut(i)}),this._options=[],this.defaultOptions&&this.defaultOptions.length){const i=((t=this.options)==null?void 0:t.filter(l=>l.userAdded))||[];this.options=[...i,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=[...this.options]}if(this.optionsController.nodes.length){const i=[];this.optionsController.nodes.forEach(l=>{if(!l.textContent&&!l.getAttribute("value"))return null;const c={value:l.getAttribute("value")||l.textContent||"",label:l.textContent||l.getAttribute("value")||""};l.getAttribute("data-prefix")&&(c.prefix=l.getAttribute("data-prefix")||void 0),l.getAttribute("tagskincolor")&&(c.tagSkinColor=l.getAttribute("tagskincolor")),l.getAttribute("description")&&(c.description=l.getAttribute("description")||void 0),c.fulltext=c.value+c.label+(c.prefix||""),i.push(c)}),i.length&&(this.options=[...i],this._options=[...i])}}updated(t){var i;if(t.has("_value")&&this.valueChanged(this._value,t.get("_value")),t.has("value")&&(Array.isArray(this.value)?this._value=this.value:this.value&&this.multiple?this._value=this.value.split(","):this.value?this._value=[this.value]:this._value=[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]]),this.isMaxItemsReached()),t.has("defaultOptions")&&this.defaultOptions.length){const l=((i=this.options)==null?void 0:i.filter(c=>c.userAdded))||[];this.options=[...l,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=[...this.options]}if(t.has("options")&&this.options.length){const l=this._options.filter(c=>c.userAdded).filter(c=>!this.options.some(h=>h.value===c.value));this._options=[...l,...this.options],this._options.forEach(c=>{if(c.value&&!c.label&&(c.label=c.value),c.selected&&!this._value.includes(c.value)){const h=[...this._value];this._value=[...this._value,c.value],this.valueChanged(this._value,h)}c.fulltext=c.value+c.label+(c.prefix||""),c.selected=c.selected||this._value.includes(c.value)})}t.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),super.updated(t)}attributeChangedCallback(t,i,l){t==="value"&&(Array.isArray(this.value)?this._value=this.value:this.value&&this.multiple?this._value=this.value.split(","):this.value?this._value=[this.value]:this._value=[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]])),t==="options"&&(this._options=this.options,this._options.forEach(c=>{c.value&&!c.label&&(c.label=c.value),c.selected&&!this._value.includes(c.value)&&(this._value=[...this._value,c.value]),c.fulltext=c.value+c.label+(c.prefix||"")}),this._search=""),super.attributeChangedCallback(t,i,l)}render(){return ye`
824
824
  <pkt-input-wrapper
825
825
  .label=${this.label}
826
826
  .helptext=${this.helptext}
@@ -935,7 +935,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
935
935
  >
936
936
  ${this.renderValueTag(m)}
937
937
  </pkt-tag>
938
- `});return t?i:l}renderValueTag(t){if(!t)return"";switch(this.displayValueAs){case"prefixAndValue":return ye`<span data-focusfix=${this.id}>${t.prefix||""} ${t.value}</span>`;case"value":return ye`<span data-focusfix=${this.id}>${t.value}</span>`;case"label":default:return ye`<span data-focusfix=${this.id}>${t.label||t.value}</span>`}}handleInput(t){if(t.stopPropagation(),t.stopImmediatePropagation(),this.disabled)return;this.touched=!0;const i=t.target;if(this._search=i.value,this.checkForMatches(),this.typeahead)if(this._search){if(this._options=this.options.filter(l=>{var c;return(c=l.fulltext)==null?void 0:c.toLowerCase().includes(this._search.toLowerCase())}),t.inputType!=="deleteContentBackward"){const l=this._options.filter(c=>{var h;return!c.selected&&((h=c.label)==null?void 0:h.toLowerCase().startsWith(this._search.toLowerCase()))});if(l.length>0&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const c=l[0];c!=null&&c.label&&(i.value=c.label,window.setTimeout(()=>i.setSelectionRange(this._search.length,i.value.length),0),i.selectionDirection="backward")}}}else this._options=[...this.options]}handleFocus(){if(!this.disabled){if(!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const t=this.findValueInOptions(this._value[0]);this._editingSingleValue=!0,this.inputRef.value.value=this.displayValueAs==="label"&&t!=null&&t.label?t.label:this._value[0]}this._inputFocus=!0,this._search="",this._options=[...this.options],this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleFocusOut(t){var i,l,c,h,m;if(!this.disabled&&((l=(i=t.relatedTarget)==null?void 0:i.closest("pkt-combobox"))==null?void 0:l.id)!==this.id&&((h=(c=t.relatedTarget)==null?void 0:c.closest("pkt-combobox"))==null?void 0:h.id)!==this.id&&((m=t.target)==null?void 0:m.getAttribute("data-focusfix"))!==this.id&&t.relatedTarget!==this.focusRef.value&&t.relatedTarget!==this.inputRef.value&&t.relatedTarget!==this.arrowRef.value&&this._isOptionsOpen){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage="",this._search="",this.inputRef.value&&this.inputRef.value.type!=="hidden"&&this.inputRef.value.value!==""){const D=this.inputRef.value.value,x=this.findValueInOptions(D);!this._value.includes(D)&&!x?this.allowUserInput?this.addNewUserValue(D):this.multiple||this.removeValue(this._value[0]):x&&!this._value.includes(x.value)&&this.setSelected(x.value),this.inputRef.value.value=""}this._isOptionsOpen=!1,this.onBlur()}}handleBlur(){this._inputFocus=!1,this._editingSingleValue=!1,this.onBlur()}handleInputClick(t){var i,l;this.disabled||(t.currentTarget&&t.currentTarget!==this.arrowRef.value&&((i=this.inputRef.value)==null?void 0:i.type)!=="hidden"?(l=this.inputRef.value)==null||l.focus():this.handleArrowClick(t))}handleArrowClick(t){var i,l;this.disabled||t instanceof KeyboardEvent&&t.key&&t.key!=="Enter"&&t.key!==" "&&t.key!=="ArrowDown"||(t.stopImmediatePropagation(),t.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen?(i=this.listboxRef.value)==null||i.focusFirstOrSelectedOption():(l=this.arrowRef.value)==null||l.focus())}handleOptionToggled(t){this.toggleValue(t.detail)}handleSearch(t){t.stopPropagation(),this._search=t.detail.toLowerCase()}handleInputKeydown(t){var i,l,c;switch(t.key){case",":case"Enter":t.preventDefault(),this.addValue();break;case"Backspace":!this._search&&((i=this.inputRef.value)==null?void 0:i.type)==="hidden"&&this.removeLastValue(t);break;case"Tab":case"ArrowDown":t.shiftKey||((l=this.listboxRef.value)==null||l.focusFirstOrSelectedOption(),t.preventDefault());break;case"Escape":this._isOptionsOpen=!1,(c=this.arrowRef.value)==null||c.focus(),t.preventDefault();break}}handleTagRemove(t){this.removeSelected(t)}blurInput(){this.inputRef.value&&this.inputRef.value.matches(":focus")&&this.inputRef.value.blur()}checkForMatches(){var t;const i=((t=this.inputRef.value)==null?void 0:t.value)||this._search||"",l=i.trim().toLowerCase()||"";if(!l){!this.multiple&&this._value[0]&&this.removeValue(this._value[0]),this.resetComboboxInput(!1);return}const c=this._value.find(D=>D.toLowerCase()===l),h=this._options.filter(D=>{var x;return((x=D.label)==null?void 0:x.toLowerCase().includes(l))??!1}),m=h.find(D=>{var x;return((x=D.label)==null?void 0:x.toLowerCase())===l||D.value.toLowerCase()===l});switch(!0){case((h.length===0||!m)&&this.allowUserInput):this._addValueText=i,this._userInfoMessage="";break;case(h.length===0&&!this.allowUserInput):this._addValueText=null,this._userInfoMessage="Ingen match i søket";break;case!!c:this._addValueText=null,this._userInfoMessage="Verdien er allerede valgt";break;case h.length>1:this._addValueText=null,this._userInfoMessage="";break;default:this._addValueText=null,this._userInfoMessage=""}}findValueInOptions(t){return this.options.find(i=>i.value===t||i.label===t)||null}findIndexInOptions(t){return this._options.findIndex(i=>i.value===t||i.label===t)}isMaxItemsReached(){const t=this.maxlength!==null&&this._value.length>=this.maxlength;return t?this._maxIsReached=!0:this._maxIsReached=!1,t}toggleValue(t){var i,l;if(this.disabled)return;this.touched=!0,this._userInfoMessage="",this._addValueText=null;const c=((i=this.findValueInOptions(t))==null?void 0:i.value)||null,h=this._value.includes(t||c||""),m=!!c,D=((l=this._options.find(V=>V.value===t))==null?void 0:l.disabled)||!1,x=!(t!=null&&t.trim()),E=!this.multiple,A=this.multiple,N=this.isMaxItemsReached();let L=!1,O=!0,M="",X="";D||(!m&&this.allowUserInput&&!x?(this.addNewUserValue(t),M="Ny verdi lagt til",L=!A):!m&&!this.allowUserInput?(E&&this._value[0]&&this.removeValue(this._value[0]),O=!1,L=!0,M="Ingen treff i søket"):h?(this.removeValue(c),L=!0):x&&E?(this.removeAllSelected(),L=!0):E?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(c),L=!1,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value="",this.inputRef.value.blur())):A&&!N?(this.setSelected(c),L=!0):A&&N?(this._userInfoMessage="Maks antall valg nådd",O=!1,X=t):(E&&this.removeAllSelected(),this._userInfoMessage="Ingen gyldig verdi valgt",O=!1,L=!0,X=t),this._isOptionsOpen=L,L||window.setTimeout(()=>{var V;(V=this.focusRef.value)==null||V.focus()},0),this._userInfoMessage=M,this._search=X||"",this.resetComboboxInput(O),A&&this.isMaxItemsReached())}setSelected(t){if(!this._value.includes(t)){if(this.multiple&&this.isMaxItemsReached()){this._userInfoMessage="Maks antall valg nådd";return}!this.multiple&&this.removeAllSelected(),this._value=t?[...this._value,t]:this._value,this._options=this._options.map(i=>(i.value===t&&(i.selected=!0),i)),this.resetComboboxInput(!0)}}removeSelected(t){if(!t)return;this._value=this._value.filter(l=>l!==t);const i=this.findValueInOptions(t);i?(i.selected=!1,i.userAdded?(this._options=[...this._options.filter(l=>l.value!==t)],this.options=[...this.options.filter(l=>l.value!==t)]):this._options=[...this._options,i]):!t&&!this.multiple&&(this._options=this._options.map(l=>(l.selected=!1,l)))}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage="For mange valgt";return}this._value=this._options.map(t=>t.value),this._options=this._options.map(t=>(t.selected=!0,t)),this.requestUpdate()}}removeAllSelected(){this._value=[],this._options=this._options.map(t=>(t.selected=!1,t)),this._options=this._options.filter(t=>!t.userAdded),this.requestUpdate()}addValue(){var t;const i=((t=this.inputRef.value)==null?void 0:t.value.trim())||"";this._search=i,this.toggleValue(i)}removeValue(t){this._value=this.multiple?this._value.filter(i=>i!==t):[],this.removeSelected(t)}addNewUserValue(t){if(!t||t.trim()==="")return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[t],this._isOptionsOpen=!1,this.blurInput();else if(!this.findValueInOptions(t)){if(this.isMaxItemsReached())return;this._value=[...this._value,t]}const i={value:t,label:t,userAdded:!0};this.options=[i,...this.options],this._options=[i,...this._options],this.setSelected(t),this.requestUpdate()}resetComboboxInput(t=!0){if(this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&t)if(this._search="",this.multiple)this.inputRef.value.value="";else{const i=this.findValueInOptions(this._value[0]);window.setTimeout(()=>{!this.inputRef.value||this.inputRef.value.type==="hidden"||(this.inputRef.value.value=this.displayValueAs==="label"&&i!=null&&i.label?i.label:this._value[0]||"")},0),this._userInfoMessage=""}this._options=[...this.options]}removeLastValue(t){if(this._value.length===0)return;t.preventDefault();const i=this._value[this._value.length-1];i&&this.removeSelected(i),this.isMaxItemsReached()}};na([z({type:String,reflect:!0})],Ur.prototype,"value",2),na([z({type:Array})],Ur.prototype,"options",2),na([z({type:Array})],Ur.prototype,"defaultOptions",2),na([z({type:Boolean})],Ur.prototype,"allowUserInput",2),na([z({type:Boolean})],Ur.prototype,"typeahead",2),na([z({type:Boolean})],Ur.prototype,"includeSearch",2),na([z({type:String})],Ur.prototype,"searchPlaceholder",2),na([z({type:Boolean})],Ur.prototype,"multiple",2),na([z({type:Number})],Ur.prototype,"maxlength",2),na([z({type:String})],Ur.prototype,"displayValueAs",2),na([z({type:String})],Ur.prototype,"tagPlacement",2),na([Pn()],Ur.prototype,"_options",2),na([Pn()],Ur.prototype,"_isOptionsOpen",2),na([Pn()],Ur.prototype,"_value",2),na([Pn()],Ur.prototype,"_userInfoMessage",2),na([Pn()],Ur.prototype,"_addValueText",2),na([Pn()],Ur.prototype,"_maxIsReached",2),na([Pn()],Ur.prototype,"_search",2),na([Pn()],Ur.prototype,"_inputFocus",2),na([Pn()],Ur.prototype,"_editingSingleValue",2),Ur=na([pr("pkt-combobox")],Ur);const _3={i18n:{nb:{contentPresentation:{title:"Oslo kommune bruker informasjonskapsler",description:["For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.","Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss."],buttons:{accept:"Godta alle",reject:"Kun nødvendige",settings:"Innstillinger for informasjonskapsler"}},contentSettings:{title:"Innstillinger for informasjonskapsler",description:["Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.","Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler»."],buttons:{back:"Tilbake",save:"Lagre innstillinger"}}},en:{contentPresentation:{title:"Before you visit Oslo kommune ...",description:["This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.","To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites."],buttons:{accept:"Yes, I accept",reject:"Only necessary",settings:"Go to settings"}},contentSettings:{title:"Her kan du aktivt velge mellom ulike informasjonskapsler",description:["For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider"],buttons:{back:"Back",save:"Save settings"}}}}};var E3=Object.defineProperty,T3=Object.getOwnPropertyDescriptor,gu=(r,t,i,l)=>{for(var c=l>1?void 0:l?T3(t,i):t,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(t,i,c):m(c))||c);return l&&c&&E3(t,i,c),c};let v0=null;function F3(){return v0||(v0=new Promise((r,t)=>{if(document.querySelector("#oslo-consent-script")){r();return}const i=document.createElement("script");i.src="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js",i.id="oslo-consent-script",i.onload=()=>r(),i.onerror=t,document.head.appendChild(i);const l=document.createElement("link");l.href="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css",l.type="text/css",l.rel="stylesheet",l.id="oslo-consent-styles",document.head.appendChild(l)}),v0)}let Ns=class extends da{constructor(){super(),this.devMode=!1,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType="button",this.triggerText=null,this.i18nLanguage="nb"}connectedCallback(){super.connectedCallback(),this.triggerText=this.triggerText||_3.i18n[this.i18nLanguage].contentPresentation.buttons.settings}disconnectedCallback(){var t;super.disconnectedCallback(),this._cookieEventHandler&&((t=window.__cookieEvents)==null||t.off("CookieManager.setCookie",this._cookieEventHandler))}returnJsonOrObject(t){let i;try{i=JSON.parse(t)}catch{i=t}return i}emitCookieConsents(t){const i=this.returnJsonOrObject(t.value).items.reduce((l,c)=>(l[c.name]=c.consent,l),{});this.dispatchEvent(new CustomEvent("toggle-consent",{detail:i,bubbles:!0,cancelable:!1}))}async firstUpdated(t){window.cookieBanner_googleAnalyticsId=this.googleAnalyticsId,window.cookieBanner_hotjarId=this.hotjarId,this.cookieDomain&&(window.cookieBanner_cookieDomain=this.cookieDomain),this.cookieSecure&&(window.cookieBanner_cookieSecure=this.cookieSecure),this.cookieExpiryDays&&(window.cookieBanner_cookieExpiryDays=this.cookieExpiryDays),this.devMode&&(window.cookieBanner_devMode=this.devMode),await F3(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event("CookieBannerReady",{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(t=>{if(t){const i={value:window.cookieBanner.cookieConsent.getConsentCookie()};window.setTimeout(()=>this.emitCookieConsents(i),0),this._cookieEventHandler&&window.__cookieEvents.off("CookieManager.setCookie",this._cookieEventHandler),this._cookieEventHandler=l=>{this.emitCookieConsents(l)},window.__cookieEvents.on("CookieManager.setCookie",this._cookieEventHandler)}})}openModal(t){var i;t.preventDefault(),(i=window.cookieBanner)!=null&&i.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType==="link"?ye`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType==="footerlink"?ye`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
938
+ `});return t?i:l}renderValueTag(t){if(!t)return"";switch(this.displayValueAs){case"prefixAndValue":return ye`<span data-focusfix=${this.id}>${t.prefix||""} ${t.value}</span>`;case"value":return ye`<span data-focusfix=${this.id}>${t.value}</span>`;case"label":default:return ye`<span data-focusfix=${this.id}>${t.label||t.value}</span>`}}handleInput(t){if(t.stopPropagation(),t.stopImmediatePropagation(),this.disabled)return;this.touched=!0;const i=t.target;if(this._search=i.value,this.checkForMatches(),this.typeahead)if(this._search){if(this._options=this.options.filter(l=>{var c;return(c=l.fulltext)==null?void 0:c.toLowerCase().includes(this._search.toLowerCase())}),t.inputType!=="deleteContentBackward"){const l=this._options.filter(c=>{var h;return!c.selected&&((h=c.label)==null?void 0:h.toLowerCase().startsWith(this._search.toLowerCase()))});if(l.length>0&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const c=l[0];c!=null&&c.label&&(i.value=c.label,window.setTimeout(()=>i.setSelectionRange(this._search.length,i.value.length),0),i.selectionDirection="backward")}}}else this._options=[...this.options]}handleFocus(){if(!this.disabled){if(!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const t=this.findValueInOptions(this._value[0]);this._editingSingleValue=!0,this.inputRef.value.value=this.displayValueAs==="label"&&t!=null&&t.label?t.label:this._value[0]}this._inputFocus=!0,this._search="",this._options=[...this.options],this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleFocusOut(t){var i,l,c,h,m;if(!this.disabled&&((l=(i=t.relatedTarget)==null?void 0:i.closest("pkt-combobox"))==null?void 0:l.id)!==this.id&&((h=(c=t.relatedTarget)==null?void 0:c.closest("pkt-combobox"))==null?void 0:h.id)!==this.id&&((m=t.target)==null?void 0:m.getAttribute("data-focusfix"))!==this.id&&t.relatedTarget!==this.focusRef.value&&t.relatedTarget!==this.inputRef.value&&t.relatedTarget!==this.arrowRef.value&&this._isOptionsOpen){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage="",this._search="",this.inputRef.value&&this.inputRef.value.type!=="hidden"&&this.inputRef.value.value!==""){const D=this.inputRef.value.value,x=this.findValueInOptions(D);!this._value.includes(D)&&!x?this.allowUserInput?this.addNewUserValue(D):this.multiple||this.removeValue(this._value[0]):x&&!this._value.includes(x.value)&&this.setSelected(x.value),this.inputRef.value.value=""}this._isOptionsOpen=!1,this.onBlur()}}handleBlur(){this._inputFocus=!1,this._editingSingleValue=!1,this.onBlur()}handleInputClick(t){var i,l;this.disabled||(t.currentTarget&&t.currentTarget!==this.arrowRef.value&&((i=this.inputRef.value)==null?void 0:i.type)!=="hidden"?(l=this.inputRef.value)==null||l.focus():this.handleArrowClick(t))}handleArrowClick(t){var i,l;this.disabled||t instanceof KeyboardEvent&&t.key&&t.key!=="Enter"&&t.key!==" "&&t.key!=="ArrowDown"||(t.stopImmediatePropagation(),t.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen?(i=this.listboxRef.value)==null||i.focusFirstOrSelectedOption():(l=this.arrowRef.value)==null||l.focus())}handleOptionToggled(t){this.toggleValue(t.detail)}handleSearch(t){t.stopPropagation(),this._search=t.detail.toLowerCase()}handleInputKeydown(t){var i,l,c;switch(t.key){case",":this.multiple&&(t.preventDefault(),this.addValue());break;case"Enter":t.preventDefault(),this.addValue();break;case"Backspace":!this._search&&((i=this.inputRef.value)==null?void 0:i.type)==="hidden"&&this.removeLastValue(t);break;case"Tab":case"ArrowDown":t.shiftKey||((l=this.listboxRef.value)==null||l.focusFirstOrSelectedOption(),t.preventDefault());break;case"Escape":this._isOptionsOpen=!1,(c=this.arrowRef.value)==null||c.focus(),t.preventDefault();break}}handleTagRemove(t){this.removeSelected(t)}blurInput(){this.inputRef.value&&this.inputRef.value.matches(":focus")&&this.inputRef.value.blur()}checkForMatches(){var t;const i=((t=this.inputRef.value)==null?void 0:t.value)||this._search||"",l=i.trim().toLowerCase()||"";if(!l){!this.multiple&&this._value[0]&&this.removeValue(this._value[0]),this.resetComboboxInput(!1);return}const c=this._value.find(D=>D.toLowerCase()===l),h=this._options.filter(D=>{var x;return((x=D.label)==null?void 0:x.toLowerCase().includes(l))??!1}),m=h.find(D=>{var x;return((x=D.label)==null?void 0:x.toLowerCase())===l||D.value.toLowerCase()===l});switch(!0){case((h.length===0||!m)&&this.allowUserInput):this._addValueText=i,this._userInfoMessage="";break;case(h.length===0&&!this.allowUserInput):this._addValueText=null,this._userInfoMessage="Ingen match i søket";break;case!!c:this._addValueText=null,this._userInfoMessage="Verdien er allerede valgt";break;case h.length>1:this._addValueText=null,this._userInfoMessage="";break;default:this._addValueText=null,this._userInfoMessage=""}}findValueInOptions(t){return this.options.find(i=>i.value===t||i.label===t)||null}findIndexInOptions(t){return this._options.findIndex(i=>i.value===t||i.label===t)}isMaxItemsReached(){const t=this.maxlength!==null&&this._value.length>=this.maxlength;return t?this._maxIsReached=!0:this._maxIsReached=!1,t}toggleValue(t){var i,l;if(this.disabled)return;this.touched=!0,this._userInfoMessage="",this._addValueText=null;const c=((i=this.findValueInOptions(t))==null?void 0:i.value)||null,h=this._value.includes(t||c||""),m=!!c,D=((l=this._options.find(V=>V.value===t))==null?void 0:l.disabled)||!1,x=!(t!=null&&t.trim()),E=!this.multiple,A=this.multiple,N=this.isMaxItemsReached();let L=!1,O=!0,M="",X="";D||(!m&&this.allowUserInput&&!x?(this.addNewUserValue(t),M="Ny verdi lagt til",L=!A):!m&&!this.allowUserInput?(E&&this._value[0]&&this.removeValue(this._value[0]),O=!1,L=!0,M="Ingen treff i søket"):h?(this.removeValue(c),L=!0):x&&E?(this.removeAllSelected(),L=!0):E?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(c),L=!1,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value="",this.inputRef.value.blur())):A&&!N?(this.setSelected(c),L=!0):A&&N?(this._userInfoMessage="Maks antall valg nådd",O=!1,X=t):(E&&this.removeAllSelected(),this._userInfoMessage="Ingen gyldig verdi valgt",O=!1,L=!0,X=t),this._isOptionsOpen=L,L||window.setTimeout(()=>{var V;(V=this.focusRef.value)==null||V.focus()},0),this._userInfoMessage=M,this._search=X||"",this.resetComboboxInput(O),A&&this.isMaxItemsReached())}setSelected(t){if(!this._value.includes(t)){if(this.multiple&&this.isMaxItemsReached()){this._userInfoMessage="Maks antall valg nådd";return}!this.multiple&&this.removeAllSelected(),this._value=t?[...this._value,t]:this._value,this._options=this._options.map(i=>(i.value===t&&(i.selected=!0),i)),this.resetComboboxInput(!0)}}removeSelected(t){if(!t)return;this._value=this._value.filter(l=>l!==t);const i=this.findValueInOptions(t);i?(i.selected=!1,i.userAdded?(this._options=[...this._options.filter(l=>l.value!==t)],this.options=[...this.options.filter(l=>l.value!==t)]):this._options=[...this._options,i]):!t&&!this.multiple&&(this._options=this._options.map(l=>(l.selected=!1,l)))}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage="For mange valgt";return}this._value=this._options.map(t=>t.value),this._options=this._options.map(t=>(t.selected=!0,t)),this.requestUpdate()}}removeAllSelected(){this._value=[],this._options=this._options.map(t=>(t.selected=!1,t)),this._options=this._options.filter(t=>!t.userAdded),this.requestUpdate()}addValue(){var t;const i=((t=this.inputRef.value)==null?void 0:t.value.trim())||"";this._search=i,this.toggleValue(i)}removeValue(t){this._value=this.multiple?this._value.filter(i=>i!==t):[],this.removeSelected(t)}addNewUserValue(t){if(!t||t.trim()==="")return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[t],this._isOptionsOpen=!1,this.blurInput();else if(!this.findValueInOptions(t)){if(this.isMaxItemsReached())return;this._value=[...this._value,t]}const i={value:t,label:t,userAdded:!0};this.options=[i,...this.options],this._options=[i,...this._options],this.setSelected(t),this.requestUpdate()}resetComboboxInput(t=!0){if(this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&t)if(this._search="",this.multiple)this.inputRef.value.value="";else{const i=this.findValueInOptions(this._value[0]);window.setTimeout(()=>{!this.inputRef.value||this.inputRef.value.type==="hidden"||(this.inputRef.value.value=this.displayValueAs==="label"&&i!=null&&i.label?i.label:this._value[0]||"")},0),this._userInfoMessage=""}this._options=[...this.options]}removeLastValue(t){if(this._value.length===0)return;t.preventDefault();const i=this._value[this._value.length-1];i&&this.removeSelected(i),this.isMaxItemsReached()}};na([z({type:String,reflect:!0})],Ur.prototype,"value",2),na([z({type:Array})],Ur.prototype,"options",2),na([z({type:Array})],Ur.prototype,"defaultOptions",2),na([z({type:Boolean})],Ur.prototype,"allowUserInput",2),na([z({type:Boolean})],Ur.prototype,"typeahead",2),na([z({type:Boolean})],Ur.prototype,"includeSearch",2),na([z({type:String})],Ur.prototype,"searchPlaceholder",2),na([z({type:Boolean})],Ur.prototype,"multiple",2),na([z({type:Number})],Ur.prototype,"maxlength",2),na([z({type:String})],Ur.prototype,"displayValueAs",2),na([z({type:String})],Ur.prototype,"tagPlacement",2),na([Pn()],Ur.prototype,"_options",2),na([Pn()],Ur.prototype,"_isOptionsOpen",2),na([Pn()],Ur.prototype,"_value",2),na([Pn()],Ur.prototype,"_userInfoMessage",2),na([Pn()],Ur.prototype,"_addValueText",2),na([Pn()],Ur.prototype,"_maxIsReached",2),na([Pn()],Ur.prototype,"_search",2),na([Pn()],Ur.prototype,"_inputFocus",2),na([Pn()],Ur.prototype,"_editingSingleValue",2),Ur=na([pr("pkt-combobox")],Ur);const _3={i18n:{nb:{contentPresentation:{title:"Oslo kommune bruker informasjonskapsler",description:["For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.","Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss."],buttons:{accept:"Godta alle",reject:"Kun nødvendige",settings:"Innstillinger for informasjonskapsler"}},contentSettings:{title:"Innstillinger for informasjonskapsler",description:["Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.","Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler»."],buttons:{back:"Tilbake",save:"Lagre innstillinger"}}},en:{contentPresentation:{title:"Before you visit Oslo kommune ...",description:["This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.","To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites."],buttons:{accept:"Yes, I accept",reject:"Only necessary",settings:"Go to settings"}},contentSettings:{title:"Her kan du aktivt velge mellom ulike informasjonskapsler",description:["For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider"],buttons:{back:"Back",save:"Save settings"}}}}};var E3=Object.defineProperty,T3=Object.getOwnPropertyDescriptor,gu=(r,t,i,l)=>{for(var c=l>1?void 0:l?T3(t,i):t,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(t,i,c):m(c))||c);return l&&c&&E3(t,i,c),c};let v0=null;function F3(){return v0||(v0=new Promise((r,t)=>{if(document.querySelector("#oslo-consent-script")){r();return}const i=document.createElement("script");i.src="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js",i.id="oslo-consent-script",i.onload=()=>r(),i.onerror=t,document.head.appendChild(i);const l=document.createElement("link");l.href="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css",l.type="text/css",l.rel="stylesheet",l.id="oslo-consent-styles",document.head.appendChild(l)}),v0)}let Ns=class extends da{constructor(){super(),this.devMode=!1,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType="button",this.triggerText=null,this.i18nLanguage="nb"}connectedCallback(){super.connectedCallback(),this.triggerText=this.triggerText||_3.i18n[this.i18nLanguage].contentPresentation.buttons.settings}disconnectedCallback(){var t;super.disconnectedCallback(),this._cookieEventHandler&&((t=window.__cookieEvents)==null||t.off("CookieManager.setCookie",this._cookieEventHandler))}returnJsonOrObject(t){let i;try{i=JSON.parse(t)}catch{i=t}return i}emitCookieConsents(t){const i=this.returnJsonOrObject(t.value).items.reduce((l,c)=>(l[c.name]=c.consent,l),{});this.dispatchEvent(new CustomEvent("toggle-consent",{detail:i,bubbles:!0,cancelable:!1}))}async firstUpdated(t){window.cookieBanner_googleAnalyticsId=this.googleAnalyticsId,window.cookieBanner_hotjarId=this.hotjarId,this.cookieDomain&&(window.cookieBanner_cookieDomain=this.cookieDomain),this.cookieSecure&&(window.cookieBanner_cookieSecure=this.cookieSecure),this.cookieExpiryDays&&(window.cookieBanner_cookieExpiryDays=this.cookieExpiryDays),this.devMode&&(window.cookieBanner_devMode=this.devMode),await F3(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event("CookieBannerReady",{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(t=>{if(t){const i={value:window.cookieBanner.cookieConsent.getConsentCookie()};window.setTimeout(()=>this.emitCookieConsents(i),0),this._cookieEventHandler&&window.__cookieEvents.off("CookieManager.setCookie",this._cookieEventHandler),this._cookieEventHandler=l=>{this.emitCookieConsents(l)},window.__cookieEvents.on("CookieManager.setCookie",this._cookieEventHandler)}})}openModal(t){var i;t.preventDefault(),(i=window.cookieBanner)!=null&&i.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType==="link"?ye`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType==="footerlink"?ye`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
939
939
  <pkt-icon name="chevron-right" class="pkt-footer__link-icon"></pkt-icon>
940
940
  ${this.triggerText}
941
941
  </a>`:this.triggerType==="icon"?ye`<pkt-button
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "13.2.3",
3
+ "version": "13.2.4",
4
4
  "description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "@lit-labs/ssr-dom-shim": "^1.2.1",
40
40
  "@lit/react": "^1.0.7",
41
- "@oslokommune/punkt-elements": "^13.2.3",
41
+ "@oslokommune/punkt-elements": "^13.2.4",
42
42
  "angular-html-parser": "^6.0.2",
43
43
  "html-format": "^1.1.7",
44
44
  "prettier": "^3.3.3",
@@ -112,5 +112,5 @@
112
112
  "url": "https://github.com/oslokommune/punkt/issues"
113
113
  },
114
114
  "license": "MIT",
115
- "gitHead": "60cd8b0f004380bc7a85246af4f2b8c4aa5243b9"
115
+ "gitHead": "f777f10f0637de10ff45fe6a5b6d9c7e4abd70ff"
116
116
  }