@oslokommune/punkt-react 13.6.7 → 13.6.8
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/dist/punkt-react.es.js
CHANGED
|
@@ -5946,7 +5946,7 @@ let Rt = class extends pt {
|
|
|
5946
5946
|
filterOptions() {
|
|
5947
5947
|
this.searchValue ? this._filteredOptions = this.options.filter((t) => {
|
|
5948
5948
|
var r;
|
|
5949
|
-
return (t.label + t.value).toLowerCase().includes(((r = this.searchValue) == null ? void 0 : r.toLowerCase()) || "");
|
|
5949
|
+
return (t.fulltext || t.label + t.value + (t.prefix || "")).toLowerCase().includes(((r = this.searchValue) == null ? void 0 : r.toLowerCase()) || "");
|
|
5950
5950
|
}) : this._filteredOptions = [...this.options];
|
|
5951
5951
|
}
|
|
5952
5952
|
isLetterOrSpace(t) {
|
|
@@ -6375,7 +6375,7 @@ let it = class extends ge {
|
|
|
6375
6375
|
case ((i.length === 0 || !o) && this.allowUserInput):
|
|
6376
6376
|
this._addValueText = r, this._userInfoMessage = "";
|
|
6377
6377
|
break;
|
|
6378
|
-
case (i.length === 0 && !this.allowUserInput):
|
|
6378
|
+
case (i.length === 0 && !this._options.length && !this.allowUserInput):
|
|
6379
6379
|
this._addValueText = null, this._userInfoMessage = "Ingen match i søket";
|
|
6380
6380
|
break;
|
|
6381
6381
|
case !!a:
|
package/dist/punkt-react.umd.js
CHANGED
|
@@ -617,7 +617,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
617
617
|
role="searchbox"
|
|
618
618
|
/>
|
|
619
619
|
</div>
|
|
620
|
-
`:V}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 r=t.currentTarget,n=r.dataset.value,a=r.dataset.type,i=r.dataset.selected==="true";if(!(!this.getOptionElements().length&&(!this.customUserInput||!this.allowUserInput&&this.customUserInput)&&a!=="new-option"&&a!=="searchbox"))switch(t.key){case" ":case"Enter":this.toggleOption(r),t.preventDefault();break;case"Backspace":n&&(i?this.toggleOption(r):this.closeOptions()),t.preventDefault();break;case"Escape":case"Tab":this.closeOptions();break;case"ArrowDown":t.altKey?this.focusLastOption():a==="searchbox"||a==="new-option"?this.focusFirstOption():this.focusNextOption(r),t.preventDefault();break;case"ArrowUp":if(t.altKey)this.focusFirstOption();else if(r.dataset.index==="0"&&this.includeSearch){const o=this.querySelector('[role="searchbox"]');o&&o.focus()}else if(r.dataset.index==="0"&&this.customUserInput){const o=this.querySelector('[data-type="new-option"]');o&&o.focus()}else this.focusPreviousOption(r);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 r=t.nextElementSibling;r&&this.focusAndScrollIntoView(r)}focusPreviousOption(t){const r=t.previousElementSibling;if(t.dataset.index==="0"&&this.includeSearch){const n=this.querySelector('[role="searchbox"]');n&&this.focusAndScrollIntoView(n)}else r&&this.focusAndScrollIntoView(r)}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(r=>r.dataset.selected==="true");if(this.allowUserInput&&this.customUserInput){const r=this.querySelector('[data-type="new-option"]');this.focusAndScrollIntoView(r)}else if(t)this.focusAndScrollIntoView(t);else if(this.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){const r=this.querySelector('[role="searchbox"]');window.setTimeout(()=>r.focus(),0)}else this.focusFirstOption()}toggleOption(t){const r=t instanceof HTMLElement?t.dataset.disabled:t.disabled;if(this.disabled||r)return;const n=t instanceof HTMLElement?t.dataset.value:t.value;this.dispatchEvent(new CustomEvent("option-toggle",{detail:n,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 r;return(t.label+t.value).toLowerCase().includes(((r=this.searchValue)==null?void 0:r.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 r=this.getOptionElements().find(n=>{var a;return(a=n.textContent)==null?void 0:a.trim().toLowerCase().startsWith(this.typeAheadString)});r&&this.focusAndScrollIntoView(r)}getOptionElements(){return this._filteredOptions.length?Array.from(this.querySelectorAll('[role="option"]:not([data-disabled])')||[]):[]}};Ft([_({type:String})],xt.prototype,"id",2),Ft([_({type:String})],xt.prototype,"label",2),Ft([_({type:Array})],xt.prototype,"options",2),Ft([_({type:Boolean,reflect:!0})],xt.prototype,"isOpen",2),Ft([_({type:Boolean})],xt.prototype,"disabled",2),Ft([_({type:Boolean})],xt.prototype,"includeSearch",2),Ft([_({type:Boolean})],xt.prototype,"isMultiSelect",2),Ft([_({type:Boolean})],xt.prototype,"allowUserInput",2),Ft([_({type:Boolean})],xt.prototype,"maxIsReached",2),Ft([_({type:String})],xt.prototype,"customUserInput",2),Ft([_({type:String})],xt.prototype,"searchPlaceholder",2),Ft([_({type:String})],xt.prototype,"searchValue",2),Ft([_({type:Number})],xt.prototype,"maxLength",2),Ft([_({type:String})],xt.prototype,"userMessage",2),Ft([Oe()],xt.prototype,"_filteredOptions",2),xt=Ft([Ue("pkt-listbox")],xt);const RT={displayValueAs:{default:"label"}},IT={props:RT};var OT=Object.defineProperty,LT=Object.getOwnPropertyDescriptor,dt=(e,t,r,n)=>{for(var a=n>1?void 0:n?LT(t,r):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(a=(n?o(t,r,a):o(a))||a);return n&&a&&OT(t,r,a),a};let at=class extends me{constructor(){super(),this.helptextSlot=Se(),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=IT.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=Se(),this.arrowRef=Se(),this.listboxRef=Se(),this.focusRef=Se(),this.optionTagRef=Se(),this.optionsController=new fm(this),this.slotController=new At(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){var t;if(super.connectedCallback(),document&&document.body.addEventListener("click",r=>{this._isOptionsOpen&&!this.contains(r.target)&&this.handleFocusOut(r)}),this._options=[],this.defaultOptions&&this.defaultOptions.length){const r=((t=this.options)==null?void 0:t.filter(n=>n.userAdded))||[];this.options=[...r,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(this.optionsController.nodes.length){const r=[];this.optionsController.nodes.forEach(n=>{if(!n.textContent&&!n.getAttribute("value"))return null;const a={value:n.getAttribute("value")||n.textContent||"",label:n.textContent||n.getAttribute("value")||""};n.getAttribute("data-prefix")&&(a.prefix=n.getAttribute("data-prefix")||void 0),n.getAttribute("tagskincolor")&&(a.tagSkinColor=n.getAttribute("tagskincolor")),n.getAttribute("description")&&(a.description=n.getAttribute("description")||void 0),a.fulltext=a.value+a.label+(a.prefix||""),r.push(a)}),r.length&&(this.options=[...r],this._options=[...r])}}updated(t){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 r=(Array.isArray(this.options)?this.options:[]).filter(n=>n.userAdded)||[];this.options=[...r,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(t.has("options")){const r=(t.get("options")||this._options||[]).filter(a=>a&&a.userAdded).filter(a=>!(Array.isArray(this.options)?this.options:[]).some(i=>i.value===a.value)),n=[...r,...this.options];this._options=n,r.length>0&&(this.options=n),this._options.forEach(a=>{if(a.value&&!a.label&&(a.label=a.value),a.selected&&!this._value.includes(a.value)){const i=[...this._value];this._value=[...this._value,a.value],this.valueChanged(this._value,i)}a.fulltext=a.value+a.label+(a.prefix||""),a.selected=a.selected||this._value.includes(a.value)})}t.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),super.updated(t)}attributeChangedCallback(t,r,n){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=Array.isArray(this.options)?[...this.options]:[],this._options.forEach(a=>{a.value&&!a.label&&(a.label=a.value),a.selected&&!this._value.includes(a.value)&&(this._value=[...this._value,a.value]),a.fulltext=a.value+a.label+(a.prefix||"")}),this._search=""),super.attributeChangedCallback(t,r,n)}render(){return M`
|
|
620
|
+
`:V}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 r=t.currentTarget,n=r.dataset.value,a=r.dataset.type,i=r.dataset.selected==="true";if(!(!this.getOptionElements().length&&(!this.customUserInput||!this.allowUserInput&&this.customUserInput)&&a!=="new-option"&&a!=="searchbox"))switch(t.key){case" ":case"Enter":this.toggleOption(r),t.preventDefault();break;case"Backspace":n&&(i?this.toggleOption(r):this.closeOptions()),t.preventDefault();break;case"Escape":case"Tab":this.closeOptions();break;case"ArrowDown":t.altKey?this.focusLastOption():a==="searchbox"||a==="new-option"?this.focusFirstOption():this.focusNextOption(r),t.preventDefault();break;case"ArrowUp":if(t.altKey)this.focusFirstOption();else if(r.dataset.index==="0"&&this.includeSearch){const o=this.querySelector('[role="searchbox"]');o&&o.focus()}else if(r.dataset.index==="0"&&this.customUserInput){const o=this.querySelector('[data-type="new-option"]');o&&o.focus()}else this.focusPreviousOption(r);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 r=t.nextElementSibling;r&&this.focusAndScrollIntoView(r)}focusPreviousOption(t){const r=t.previousElementSibling;if(t.dataset.index==="0"&&this.includeSearch){const n=this.querySelector('[role="searchbox"]');n&&this.focusAndScrollIntoView(n)}else r&&this.focusAndScrollIntoView(r)}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(r=>r.dataset.selected==="true");if(this.allowUserInput&&this.customUserInput){const r=this.querySelector('[data-type="new-option"]');this.focusAndScrollIntoView(r)}else if(t)this.focusAndScrollIntoView(t);else if(this.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){const r=this.querySelector('[role="searchbox"]');window.setTimeout(()=>r.focus(),0)}else this.focusFirstOption()}toggleOption(t){const r=t instanceof HTMLElement?t.dataset.disabled:t.disabled;if(this.disabled||r)return;const n=t instanceof HTMLElement?t.dataset.value:t.value;this.dispatchEvent(new CustomEvent("option-toggle",{detail:n,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 r;return(t.fulltext||t.label+t.value+(t.prefix||"")).toLowerCase().includes(((r=this.searchValue)==null?void 0:r.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 r=this.getOptionElements().find(n=>{var a;return(a=n.textContent)==null?void 0:a.trim().toLowerCase().startsWith(this.typeAheadString)});r&&this.focusAndScrollIntoView(r)}getOptionElements(){return this._filteredOptions.length?Array.from(this.querySelectorAll('[role="option"]:not([data-disabled])')||[]):[]}};Ft([_({type:String})],xt.prototype,"id",2),Ft([_({type:String})],xt.prototype,"label",2),Ft([_({type:Array})],xt.prototype,"options",2),Ft([_({type:Boolean,reflect:!0})],xt.prototype,"isOpen",2),Ft([_({type:Boolean})],xt.prototype,"disabled",2),Ft([_({type:Boolean})],xt.prototype,"includeSearch",2),Ft([_({type:Boolean})],xt.prototype,"isMultiSelect",2),Ft([_({type:Boolean})],xt.prototype,"allowUserInput",2),Ft([_({type:Boolean})],xt.prototype,"maxIsReached",2),Ft([_({type:String})],xt.prototype,"customUserInput",2),Ft([_({type:String})],xt.prototype,"searchPlaceholder",2),Ft([_({type:String})],xt.prototype,"searchValue",2),Ft([_({type:Number})],xt.prototype,"maxLength",2),Ft([_({type:String})],xt.prototype,"userMessage",2),Ft([Oe()],xt.prototype,"_filteredOptions",2),xt=Ft([Ue("pkt-listbox")],xt);const RT={displayValueAs:{default:"label"}},IT={props:RT};var OT=Object.defineProperty,LT=Object.getOwnPropertyDescriptor,dt=(e,t,r,n)=>{for(var a=n>1?void 0:n?LT(t,r):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(a=(n?o(t,r,a):o(a))||a);return n&&a&&OT(t,r,a),a};let at=class extends me{constructor(){super(),this.helptextSlot=Se(),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=IT.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=Se(),this.arrowRef=Se(),this.listboxRef=Se(),this.focusRef=Se(),this.optionTagRef=Se(),this.optionsController=new fm(this),this.slotController=new At(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){var t;if(super.connectedCallback(),document&&document.body.addEventListener("click",r=>{this._isOptionsOpen&&!this.contains(r.target)&&this.handleFocusOut(r)}),this._options=[],this.defaultOptions&&this.defaultOptions.length){const r=((t=this.options)==null?void 0:t.filter(n=>n.userAdded))||[];this.options=[...r,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(this.optionsController.nodes.length){const r=[];this.optionsController.nodes.forEach(n=>{if(!n.textContent&&!n.getAttribute("value"))return null;const a={value:n.getAttribute("value")||n.textContent||"",label:n.textContent||n.getAttribute("value")||""};n.getAttribute("data-prefix")&&(a.prefix=n.getAttribute("data-prefix")||void 0),n.getAttribute("tagskincolor")&&(a.tagSkinColor=n.getAttribute("tagskincolor")),n.getAttribute("description")&&(a.description=n.getAttribute("description")||void 0),a.fulltext=a.value+a.label+(a.prefix||""),r.push(a)}),r.length&&(this.options=[...r],this._options=[...r])}}updated(t){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 r=(Array.isArray(this.options)?this.options:[]).filter(n=>n.userAdded)||[];this.options=[...r,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(t.has("options")){const r=(t.get("options")||this._options||[]).filter(a=>a&&a.userAdded).filter(a=>!(Array.isArray(this.options)?this.options:[]).some(i=>i.value===a.value)),n=[...r,...this.options];this._options=n,r.length>0&&(this.options=n),this._options.forEach(a=>{if(a.value&&!a.label&&(a.label=a.value),a.selected&&!this._value.includes(a.value)){const i=[...this._value];this._value=[...this._value,a.value],this.valueChanged(this._value,i)}a.fulltext=a.value+a.label+(a.prefix||""),a.selected=a.selected||this._value.includes(a.value)})}t.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),super.updated(t)}attributeChangedCallback(t,r,n){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=Array.isArray(this.options)?[...this.options]:[],this._options.forEach(a=>{a.value&&!a.label&&(a.label=a.value),a.selected&&!this._value.includes(a.value)&&(this._value=[...this._value,a.value]),a.fulltext=a.value+a.label+(a.prefix||"")}),this._search=""),super.attributeChangedCallback(t,r,n)}render(){return M`
|
|
621
621
|
<pkt-input-wrapper
|
|
622
622
|
.label=${this.label}
|
|
623
623
|
.helptext=${this.helptext}
|
|
@@ -745,7 +745,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
745
745
|
>${t.value}</span
|
|
746
746
|
>`;case"label":default:return M`<span class="pkt-combobox__value" data-focusfix=${this.id}
|
|
747
747
|
>${t.label||t.value}</span
|
|
748
|
-
>`}}handleInput(t){if(t.stopPropagation(),t.stopImmediatePropagation(),this.disabled)return;this.touched=!0;const r=t.target;if(this._search=r.value,this.checkForMatches(),this.typeahead)if(this._search){if(this._options=this.options.filter(n=>{var a;return(a=n.fulltext)==null?void 0:a.toLowerCase().includes(this._search.toLowerCase())}),t.inputType!=="deleteContentBackward"){const n=this._options.filter(a=>{var i;return!a.selected&&((i=a.label)==null?void 0:i.toLowerCase().startsWith(this._search.toLowerCase()))});if(n.length>0&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const a=n[0];a!=null&&a.label&&(r.value=a.label,window.setTimeout(()=>r.setSelectionRange(this._search.length,r.value.length),0),r.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 r,n,a,i,o;if(!this.disabled&&((n=(r=t.relatedTarget)==null?void 0:r.closest("pkt-combobox"))==null?void 0:n.id)!==this.id&&((i=(a=t.relatedTarget)==null?void 0:a.closest("pkt-combobox"))==null?void 0:i.id)!==this.id&&((o=t.target)==null?void 0:o.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 u=this.inputRef.value.value,c=this.findValueInOptions(u);!this._value.includes(u)&&!c?this.allowUserInput?this.addNewUserValue(u):this.multiple||this.removeValue(this._value[0]):c&&!this._value.includes(c.value)&&this.setSelected(c.value),this.inputRef.value.value=""}this._isOptionsOpen=!1,this.onBlur()}}handleBlur(){this._inputFocus=!1,this._editingSingleValue=!1,this.onBlur()}handleInputClick(t){var r,n;this.disabled||(t.currentTarget&&t.currentTarget!==this.arrowRef.value&&((r=this.inputRef.value)==null?void 0:r.type)!=="hidden"?((n=this.inputRef.value)==null||n.focus(),this.requestUpdate()):this.handleArrowClick(t))}handlePlaceholderClick(t){this.disabled||(t.stopPropagation(),this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()))}handleArrowClick(t){var r,n;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?(r=this.listboxRef.value)==null||r.focusFirstOrSelectedOption():(n=this.arrowRef.value)==null||n.focus())}handleOptionToggled(t){this.toggleValue(t.detail)}handleSearch(t){t.stopPropagation(),this._search=t.detail.toLowerCase()}handleInputKeydown(t){var r,n,a;switch(t.key){case",":this.multiple&&(t.preventDefault(),this.addValue());break;case"Enter":t.preventDefault(),this.addValue();break;case"Backspace":!this._search&&((r=this.inputRef.value)==null?void 0:r.type)==="hidden"&&this.removeLastValue(t);break;case"Tab":case"ArrowDown":t.shiftKey||((n=this.listboxRef.value)==null||n.focusFirstOrSelectedOption(),t.preventDefault());break;case"Escape":this._isOptionsOpen=!1,(a=this.arrowRef.value)==null||a.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 r=((t=this.inputRef.value)==null?void 0:t.value)||this._search||"",n=r.trim().toLowerCase()||"";if(!n){!this.multiple&&this._value[0]&&this.removeValue(this._value[0]),this.resetComboboxInput(!1);return}const a=this._value.find(u=>u.toLowerCase()===n),i=this._options.filter(u=>{var c;return((c=u.label)==null?void 0:c.toLowerCase().includes(n))??!1}),o=i.find(u=>{var c;return((c=u.label)==null?void 0:c.toLowerCase())===n||u.value.toLowerCase()===n});switch(!0){case((i.length===0||!o)&&this.allowUserInput):this._addValueText=r,this._userInfoMessage="";break;case(i.length===0&&!this.allowUserInput):this._addValueText=null,this._userInfoMessage="Ingen match i søket";break;case!!a:this._addValueText=null,this._userInfoMessage="Verdien er allerede valgt";break;case i.length>1:this._addValueText=null,this._userInfoMessage="";break;default:this._addValueText=null,this._userInfoMessage=""}}findValueInOptions(t){return this.options.find(r=>r.value===t||r.label===t)||null}findIndexInOptions(t){return this._options.findIndex(r=>r.value===t||r.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 r,n;if(this.disabled)return;this.touched=!0,this._userInfoMessage="",this._addValueText=null;const a=((r=this.findValueInOptions(t))==null?void 0:r.value)||null,i=this._value.includes(t||a||""),o=!!a,u=((n=this._options.find(k=>k.value===t))==null?void 0:n.disabled)||!1,c=!(t!=null&&t.trim()),p=!this.multiple,g=this.multiple,m=this.isMaxItemsReached();let b=!1,y=!0,E="",w="";u||(!o&&this.allowUserInput&&!c?(this.addNewUserValue(t),E="Ny verdi lagt til",b=!g):!o&&!this.allowUserInput?(p&&this._value[0]&&this.removeValue(this._value[0]),y=!1,b=!0,E="Ingen treff i søket"):i?(this.removeValue(a),b=!0):c&&p?(this.removeAllSelected(),b=!0):p?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(a),b=!1,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value="",this.inputRef.value.blur())):g&&!m?(this.setSelected(a),b=!0):g&&m?(this._userInfoMessage="Maks antall valg nådd",y=!1,w=t):(p&&this.removeAllSelected(),this._userInfoMessage="Ingen gyldig verdi valgt",y=!1,b=!0,w=t),this._isOptionsOpen=b,b||window.setTimeout(()=>{var k;(k=this.focusRef.value)==null||k.focus()},0),this._userInfoMessage=E,this._search=w||"",this.resetComboboxInput(y),g&&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(r=>(r.value===t&&(r.selected=!0),r)),this.resetComboboxInput(!0)}}removeSelected(t){if(!t)return;this._value=this._value.filter(n=>n!==t);const r=this.findValueInOptions(t);r?(r.selected=!1,r.userAdded?(this._options=[...this._options.filter(n=>n.value!==t)],this.options=[...this.options.filter(n=>n.value!==t)]):this._options=[...this._options,r]):!t&&!this.multiple&&(this._options=this._options.map(n=>(n.selected=!1,n)))}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 r=((t=this.inputRef.value)==null?void 0:t.value.trim())||"";this._search=r,this.toggleValue(r)}removeValue(t){this._value=this.multiple?this._value.filter(r=>r!==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 r={value:t,label:t,userAdded:!0};this.options=[r,...this.options],this._options=[r,...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 r=this.findValueInOptions(this._value[0]);window.setTimeout(()=>{!this.inputRef.value||this.inputRef.value.type==="hidden"||(this.inputRef.value.value=this.displayValueAs==="label"&&r!=null&&r.label?r.label:this._value[0]||"")},0),this._userInfoMessage=""}this._options=[...this.options]}removeLastValue(t){if(this._value.length===0)return;t.preventDefault();const r=this._value[this._value.length-1];r&&this.removeSelected(r),this.isMaxItemsReached()}};dt([_({type:String,reflect:!0})],at.prototype,"value",2),dt([_({type:Array})],at.prototype,"options",2),dt([_({type:Array})],at.prototype,"defaultOptions",2),dt([_({type:Boolean})],at.prototype,"allowUserInput",2),dt([_({type:Boolean})],at.prototype,"typeahead",2),dt([_({type:Boolean})],at.prototype,"includeSearch",2),dt([_({type:String})],at.prototype,"searchPlaceholder",2),dt([_({type:Boolean})],at.prototype,"multiple",2),dt([_({type:Number})],at.prototype,"maxlength",2),dt([_({type:String})],at.prototype,"displayValueAs",2),dt([_({type:String})],at.prototype,"tagPlacement",2),dt([Oe()],at.prototype,"_options",2),dt([Oe()],at.prototype,"_isOptionsOpen",2),dt([Oe()],at.prototype,"_value",2),dt([Oe()],at.prototype,"_userInfoMessage",2),dt([Oe()],at.prototype,"_addValueText",2),dt([Oe()],at.prototype,"_maxIsReached",2),dt([Oe()],at.prototype,"_search",2),dt([Oe()],at.prototype,"_inputFocus",2),dt([Oe()],at.prototype,"_editingSingleValue",2),at=dt([Ue("pkt-combobox")],at);const FT={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 $T=Object.defineProperty,MT=Object.getOwnPropertyDescriptor,Cr=(e,t,r,n)=>{for(var a=n>1?void 0:n?MT(t,r):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(a=(n?o(t,r,a):o(a))||a);return n&&a&&$T(t,r,a),a};let Xo=null;function BT(){return Xo||(Xo=new Promise((e,t)=>{if(document.querySelector("#oslo-consent-script")){e();return}const r=document.createElement("script");r.src="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js",r.id="oslo-consent-script",r.onload=()=>e(),r.onerror=t,document.head.appendChild(r);const n=document.createElement("link");n.href="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css",n.type="text/css",n.rel="stylesheet",n.id="oslo-consent-styles",document.head.appendChild(n)}),Xo)}let pr=class extends ct{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||FT.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 r;try{r=JSON.parse(t)}catch{r=t}return r}emitCookieConsents(t){const r=this.returnJsonOrObject(t.value).items.reduce((n,a)=>(n[a.name]=a.consent,n),{});this.dispatchEvent(new CustomEvent("toggle-consent",{detail:r,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 BT(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event("CookieBannerReady",{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(t=>{if(t){const r={value:window.cookieBanner.cookieConsent.getConsentCookie()};window.setTimeout(()=>this.emitCookieConsents(r),0),this._cookieEventHandler&&window.__cookieEvents.off("CookieManager.setCookie",this._cookieEventHandler),this._cookieEventHandler=n=>{this.emitCookieConsents(n)},window.__cookieEvents.on("CookieManager.setCookie",this._cookieEventHandler)}})}openModal(t){var r;t.preventDefault(),(r=window.cookieBanner)!=null&&r.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType==="link"?M`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType==="footerlink"?M`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
|
|
748
|
+
>`}}handleInput(t){if(t.stopPropagation(),t.stopImmediatePropagation(),this.disabled)return;this.touched=!0;const r=t.target;if(this._search=r.value,this.checkForMatches(),this.typeahead)if(this._search){if(this._options=this.options.filter(n=>{var a;return(a=n.fulltext)==null?void 0:a.toLowerCase().includes(this._search.toLowerCase())}),t.inputType!=="deleteContentBackward"){const n=this._options.filter(a=>{var i;return!a.selected&&((i=a.label)==null?void 0:i.toLowerCase().startsWith(this._search.toLowerCase()))});if(n.length>0&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const a=n[0];a!=null&&a.label&&(r.value=a.label,window.setTimeout(()=>r.setSelectionRange(this._search.length,r.value.length),0),r.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 r,n,a,i,o;if(!this.disabled&&((n=(r=t.relatedTarget)==null?void 0:r.closest("pkt-combobox"))==null?void 0:n.id)!==this.id&&((i=(a=t.relatedTarget)==null?void 0:a.closest("pkt-combobox"))==null?void 0:i.id)!==this.id&&((o=t.target)==null?void 0:o.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 u=this.inputRef.value.value,c=this.findValueInOptions(u);!this._value.includes(u)&&!c?this.allowUserInput?this.addNewUserValue(u):this.multiple||this.removeValue(this._value[0]):c&&!this._value.includes(c.value)&&this.setSelected(c.value),this.inputRef.value.value=""}this._isOptionsOpen=!1,this.onBlur()}}handleBlur(){this._inputFocus=!1,this._editingSingleValue=!1,this.onBlur()}handleInputClick(t){var r,n;this.disabled||(t.currentTarget&&t.currentTarget!==this.arrowRef.value&&((r=this.inputRef.value)==null?void 0:r.type)!=="hidden"?((n=this.inputRef.value)==null||n.focus(),this.requestUpdate()):this.handleArrowClick(t))}handlePlaceholderClick(t){this.disabled||(t.stopPropagation(),this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()))}handleArrowClick(t){var r,n;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?(r=this.listboxRef.value)==null||r.focusFirstOrSelectedOption():(n=this.arrowRef.value)==null||n.focus())}handleOptionToggled(t){this.toggleValue(t.detail)}handleSearch(t){t.stopPropagation(),this._search=t.detail.toLowerCase()}handleInputKeydown(t){var r,n,a;switch(t.key){case",":this.multiple&&(t.preventDefault(),this.addValue());break;case"Enter":t.preventDefault(),this.addValue();break;case"Backspace":!this._search&&((r=this.inputRef.value)==null?void 0:r.type)==="hidden"&&this.removeLastValue(t);break;case"Tab":case"ArrowDown":t.shiftKey||((n=this.listboxRef.value)==null||n.focusFirstOrSelectedOption(),t.preventDefault());break;case"Escape":this._isOptionsOpen=!1,(a=this.arrowRef.value)==null||a.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 r=((t=this.inputRef.value)==null?void 0:t.value)||this._search||"",n=r.trim().toLowerCase()||"";if(!n){!this.multiple&&this._value[0]&&this.removeValue(this._value[0]),this.resetComboboxInput(!1);return}const a=this._value.find(u=>u.toLowerCase()===n),i=this._options.filter(u=>{var c;return((c=u.label)==null?void 0:c.toLowerCase().includes(n))??!1}),o=i.find(u=>{var c;return((c=u.label)==null?void 0:c.toLowerCase())===n||u.value.toLowerCase()===n});switch(!0){case((i.length===0||!o)&&this.allowUserInput):this._addValueText=r,this._userInfoMessage="";break;case(i.length===0&&!this._options.length&&!this.allowUserInput):this._addValueText=null,this._userInfoMessage="Ingen match i søket";break;case!!a:this._addValueText=null,this._userInfoMessage="Verdien er allerede valgt";break;case i.length>1:this._addValueText=null,this._userInfoMessage="";break;default:this._addValueText=null,this._userInfoMessage=""}}findValueInOptions(t){return this.options.find(r=>r.value===t||r.label===t)||null}findIndexInOptions(t){return this._options.findIndex(r=>r.value===t||r.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 r,n;if(this.disabled)return;this.touched=!0,this._userInfoMessage="",this._addValueText=null;const a=((r=this.findValueInOptions(t))==null?void 0:r.value)||null,i=this._value.includes(t||a||""),o=!!a,u=((n=this._options.find(k=>k.value===t))==null?void 0:n.disabled)||!1,c=!(t!=null&&t.trim()),p=!this.multiple,g=this.multiple,m=this.isMaxItemsReached();let b=!1,y=!0,E="",w="";u||(!o&&this.allowUserInput&&!c?(this.addNewUserValue(t),E="Ny verdi lagt til",b=!g):!o&&!this.allowUserInput?(p&&this._value[0]&&this.removeValue(this._value[0]),y=!1,b=!0,E="Ingen treff i søket"):i?(this.removeValue(a),b=!0):c&&p?(this.removeAllSelected(),b=!0):p?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(a),b=!1,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value="",this.inputRef.value.blur())):g&&!m?(this.setSelected(a),b=!0):g&&m?(this._userInfoMessage="Maks antall valg nådd",y=!1,w=t):(p&&this.removeAllSelected(),this._userInfoMessage="Ingen gyldig verdi valgt",y=!1,b=!0,w=t),this._isOptionsOpen=b,b||window.setTimeout(()=>{var k;(k=this.focusRef.value)==null||k.focus()},0),this._userInfoMessage=E,this._search=w||"",this.resetComboboxInput(y),g&&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(r=>(r.value===t&&(r.selected=!0),r)),this.resetComboboxInput(!0)}}removeSelected(t){if(!t)return;this._value=this._value.filter(n=>n!==t);const r=this.findValueInOptions(t);r?(r.selected=!1,r.userAdded?(this._options=[...this._options.filter(n=>n.value!==t)],this.options=[...this.options.filter(n=>n.value!==t)]):this._options=[...this._options,r]):!t&&!this.multiple&&(this._options=this._options.map(n=>(n.selected=!1,n)))}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 r=((t=this.inputRef.value)==null?void 0:t.value.trim())||"";this._search=r,this.toggleValue(r)}removeValue(t){this._value=this.multiple?this._value.filter(r=>r!==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 r={value:t,label:t,userAdded:!0};this.options=[r,...this.options],this._options=[r,...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 r=this.findValueInOptions(this._value[0]);window.setTimeout(()=>{!this.inputRef.value||this.inputRef.value.type==="hidden"||(this.inputRef.value.value=this.displayValueAs==="label"&&r!=null&&r.label?r.label:this._value[0]||"")},0),this._userInfoMessage=""}this._options=[...this.options]}removeLastValue(t){if(this._value.length===0)return;t.preventDefault();const r=this._value[this._value.length-1];r&&this.removeSelected(r),this.isMaxItemsReached()}};dt([_({type:String,reflect:!0})],at.prototype,"value",2),dt([_({type:Array})],at.prototype,"options",2),dt([_({type:Array})],at.prototype,"defaultOptions",2),dt([_({type:Boolean})],at.prototype,"allowUserInput",2),dt([_({type:Boolean})],at.prototype,"typeahead",2),dt([_({type:Boolean})],at.prototype,"includeSearch",2),dt([_({type:String})],at.prototype,"searchPlaceholder",2),dt([_({type:Boolean})],at.prototype,"multiple",2),dt([_({type:Number})],at.prototype,"maxlength",2),dt([_({type:String})],at.prototype,"displayValueAs",2),dt([_({type:String})],at.prototype,"tagPlacement",2),dt([Oe()],at.prototype,"_options",2),dt([Oe()],at.prototype,"_isOptionsOpen",2),dt([Oe()],at.prototype,"_value",2),dt([Oe()],at.prototype,"_userInfoMessage",2),dt([Oe()],at.prototype,"_addValueText",2),dt([Oe()],at.prototype,"_maxIsReached",2),dt([Oe()],at.prototype,"_search",2),dt([Oe()],at.prototype,"_inputFocus",2),dt([Oe()],at.prototype,"_editingSingleValue",2),at=dt([Ue("pkt-combobox")],at);const FT={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 $T=Object.defineProperty,MT=Object.getOwnPropertyDescriptor,Cr=(e,t,r,n)=>{for(var a=n>1?void 0:n?MT(t,r):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(a=(n?o(t,r,a):o(a))||a);return n&&a&&$T(t,r,a),a};let Xo=null;function BT(){return Xo||(Xo=new Promise((e,t)=>{if(document.querySelector("#oslo-consent-script")){e();return}const r=document.createElement("script");r.src="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js",r.id="oslo-consent-script",r.onload=()=>e(),r.onerror=t,document.head.appendChild(r);const n=document.createElement("link");n.href="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css",n.type="text/css",n.rel="stylesheet",n.id="oslo-consent-styles",document.head.appendChild(n)}),Xo)}let pr=class extends ct{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||FT.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 r;try{r=JSON.parse(t)}catch{r=t}return r}emitCookieConsents(t){const r=this.returnJsonOrObject(t.value).items.reduce((n,a)=>(n[a.name]=a.consent,n),{});this.dispatchEvent(new CustomEvent("toggle-consent",{detail:r,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 BT(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event("CookieBannerReady",{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(t=>{if(t){const r={value:window.cookieBanner.cookieConsent.getConsentCookie()};window.setTimeout(()=>this.emitCookieConsents(r),0),this._cookieEventHandler&&window.__cookieEvents.off("CookieManager.setCookie",this._cookieEventHandler),this._cookieEventHandler=n=>{this.emitCookieConsents(n)},window.__cookieEvents.on("CookieManager.setCookie",this._cookieEventHandler)}})}openModal(t){var r;t.preventDefault(),(r=window.cookieBanner)!=null&&r.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType==="link"?M`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType==="footerlink"?M`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
|
|
749
749
|
<pkt-icon name="chevron-right" class="pkt-footer__link-icon"></pkt-icon>
|
|
750
750
|
${this.triggerText}
|
|
751
751
|
</a>`:this.triggerType==="icon"?M`<pkt-button
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "13.6.
|
|
3
|
+
"version": "13.6.8",
|
|
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.6.
|
|
41
|
+
"@oslokommune/punkt-elements": "^13.6.8",
|
|
42
42
|
"prettier": "^3.3.3",
|
|
43
43
|
"react-element-to-jsx-string": "^15.0.0",
|
|
44
44
|
"react-hook-form": "^7.53.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
111
111
|
},
|
|
112
112
|
"license": "MIT",
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "79b8e663e5cd8ebdaa23497da8c37fbabf6a4aea"
|
|
114
114
|
}
|