@oslokommune/punkt-elements 12.42.5 → 12.42.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/{combobox-Bsj1W0ad.cjs → combobox-CZJrOopi.cjs} +1 -1
- package/dist/{combobox-j5xdN9KE.js → combobox-hYeZxIku.js} +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +2 -2
- package/dist/{pkt-options-controller-DepYQBqb.js → pkt-options-controller-C_Yl_3P6.js} +7 -6
- package/dist/pkt-options-controller-ftMgG5DP.cjs +1 -0
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/{select-BkwZL7mg.cjs → select-BNGnC2U9.cjs} +2 -1
- package/dist/{select-BIej9f9R.js → select-Drl_8-OU.js} +18 -16
- package/package.json +3 -3
- package/src/components/select/select.ts +7 -2
- package/dist/pkt-options-controller-Ay9ELZTV.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [12.42.6](https://github.com/oslokommune/punkt/compare/12.42.5...12.42.6) (2025-06-18)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
Ingen
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
Ingen
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
|
|
8
25
|
## [12.42.5](https://github.com/oslokommune/punkt/compare/12.42.4...12.42.5) (2025-06-18)
|
|
9
26
|
|
|
10
27
|
### ⚠ BREAKING CHANGES
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const a=require("./element-90YeMNbV.cjs"),c=require("./if-defined-C8eotHpL.cjs"),d=require("./state-D-Recv7U.cjs"),r=require("./ref-B-w1vCo8.cjs"),O=require("./class-map-DWDPOqjO.cjs"),I=require("./repeat-CxQA3AeF.cjs"),$=require("./input-element-CInrWeac.cjs"),y=require("./pkt-options-controller-
|
|
1
|
+
"use strict";const a=require("./element-90YeMNbV.cjs"),c=require("./if-defined-C8eotHpL.cjs"),d=require("./state-D-Recv7U.cjs"),r=require("./ref-B-w1vCo8.cjs"),O=require("./class-map-DWDPOqjO.cjs"),I=require("./repeat-CxQA3AeF.cjs"),$=require("./input-element-CInrWeac.cjs"),y=require("./pkt-options-controller-ftMgG5DP.cjs"),w=require("./pkt-slot-controller-Da-RgXfS.cjs");require("./input-wrapper-Uw7_cZ4w.cjs");require("./icon-B1_BRNqf.cjs");require("./tag-lU4vz70a.cjs");require("./listbox-AjDNhDsQ.cjs");const C={displayValueAs:{default:"label"}},R={props:C};var V=Object.defineProperty,S=Object.getOwnPropertyDescriptor,o=(b,e,t,i)=>{for(var s=i>1?void 0:i?S(e,t):e,l=b.length-1,n;l>=0;l--)(n=b[l])&&(s=(i?n(e,t,s):n(s))||s);return i&&s&&V(e,t,s),s};exports.PktCombobox=class extends $.PktInputElement{constructor(){super(),this.helptextSlot=r.e(),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=R.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=r.e(),this.arrowRef=r.e(),this.listboxRef=r.e(),this.focusRef=r.e(),this.optionTagRef=r.e(),this.optionsController=new y.PktOptionsSlotController(this),this.slotController=new w.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){var e;if(super.connectedCallback(),document&&document.body.addEventListener("click",t=>{this._isOptionsOpen&&!this.contains(t.target)&&this.handleFocusOut(t)}),this._options=[],this.defaultOptions&&this.defaultOptions.length){const t=((e=this.options)==null?void 0:e.filter(i=>i.userAdded))||[];this.options=[...t,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=[...this.options]}if(this.optionsController.nodes.length){const t=[];this.optionsController.nodes.forEach(i=>{if(!i.textContent&&!i.getAttribute("value"))return null;const s={value:i.getAttribute("value")||i.textContent||"",label:i.textContent||i.getAttribute("value")||""};i.getAttribute("data-prefix")&&(s.prefix=i.getAttribute("data-prefix")||void 0),i.getAttribute("tagskincolor")&&(s.tagSkinColor=i.getAttribute("tagskincolor")),i.getAttribute("description")&&(s.description=i.getAttribute("description")||void 0),s.fulltext=s.value+s.label+(s.prefix||""),t.push(s)}),t.length&&(this.options=[...t],this._options=[...t])}}updated(e){var t;if(e.has("_value")&&this.valueChanged(this._value,e.get("_value")),e.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()),e.has("defaultOptions")&&this.defaultOptions.length){const i=((t=this.options)==null?void 0:t.filter(s=>s.userAdded))||[];this.options=[...i,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=[...this.options]}if(e.has("options")&&this.options.length){const s=this._options.filter(l=>l.userAdded).filter(l=>!this.options.some(n=>n.value===l.value));this._options=[...s,...this.options],this._options.forEach(l=>{if(l.value&&!l.label&&(l.label=l.value),l.selected&&!this._value.includes(l.value)){const n=[...this._value];this._value=[...this._value,l.value],this.valueChanged(this._value,n)}l.fulltext=l.value+l.label+(l.prefix||""),l.selected=l.selected||this._value.includes(l.value)})}e.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),super.updated(e)}attributeChangedCallback(e,t,i){e==="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]])),e==="options"&&(this._options=this.options,this._options.forEach(s=>{s.value&&!s.label&&(s.label=s.value),s.selected&&!this._value.includes(s.value)&&(this._value=[...this._value,s.value]),s.fulltext=s.value+s.label+(s.prefix||"")}),this._search=""),super.attributeChangedCallback(e,t,i)}render(){return a.x`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
.label=${this.label}
|
|
4
4
|
.helptext=${this.helptext}
|
|
@@ -5,7 +5,7 @@ import { e as _, n as v } from "./ref-DnSbnXsj.js";
|
|
|
5
5
|
import { e as w } from "./class-map-m7ZCZ49w.js";
|
|
6
6
|
import { c as R } from "./repeat-lUFq9w5d.js";
|
|
7
7
|
import { P as V } from "./input-element-BEvaQK4g.js";
|
|
8
|
-
import { P as S } from "./pkt-options-controller-
|
|
8
|
+
import { P as S } from "./pkt-options-controller-C_Yl_3P6.js";
|
|
9
9
|
import { P as C } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
10
10
|
import "./input-wrapper-DnyRiuHR.js";
|
|
11
11
|
import "./icon-CO1TLSs5.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1245,6 +1245,7 @@ export declare type TSelectOption = {
|
|
|
1245
1245
|
label: string;
|
|
1246
1246
|
selected?: boolean;
|
|
1247
1247
|
disabled?: boolean;
|
|
1248
|
+
hidden?: boolean;
|
|
1248
1249
|
};
|
|
1249
1250
|
|
|
1250
1251
|
export declare type TTagSkin = 'blue' | 'blue-dark' | 'blue-light' | 'green' | 'red' | 'yellow' | 'beige' | 'gray' | 'grey';
|
package/dist/pkt-combobox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./combobox-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./combobox-CZJrOopi.cjs"),o=e.PktCombobox;Object.defineProperty(exports,"PktCombobox",{enumerable:!0,get:()=>e.PktCombobox});exports.default=o;
|
package/dist/pkt-combobox.js
CHANGED
package/dist/pkt-index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./alert-BY97zZYx.cjs"),l=require("./accordionitem-Dz6jwPpb.cjs"),d=require("./backlink-CcAZfB1d.cjs"),b=require("./button-KzBZ-Bff.cjs"),k=require("./calendar-D4qfcRtv.cjs"),m=require("./card-CmdIb2X9.cjs"),g=require("./combobox-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./alert-BY97zZYx.cjs"),l=require("./accordionitem-Dz6jwPpb.cjs"),d=require("./backlink-CcAZfB1d.cjs"),b=require("./button-KzBZ-Bff.cjs"),k=require("./calendar-D4qfcRtv.cjs"),m=require("./card-CmdIb2X9.cjs"),g=require("./combobox-CZJrOopi.cjs"),h=require("./consent-B7w1--m7.cjs"),f=require("./checkbox-CiXWukkL.cjs"),t=require("./element-90YeMNbV.cjs"),y=require("./pkt-slot-controller-Da-RgXfS.cjs"),s=require("./ref-B-w1vCo8.cjs"),O=require("./class-map-DWDPOqjO.cjs"),j=require("./datepicker-CE5oM9D3.cjs"),q=require("./helptext-AqNI_oFG.cjs"),x=require("./heading-CxJ0IqpU.cjs"),C=require("./icon-B1_BRNqf.cjs"),v=require("./input-wrapper-Uw7_cZ4w.cjs"),S=require("./link-BWJrqWi7.cjs"),$=require("./linkcard-0KLDuaGM.cjs"),L=require("./loader--5h6NKGl.cjs"),_=require("./messagebox-IJOkv427.cjs"),A=require("./modal-CBURcXBd.cjs"),B=require("./progressbar-BrXtjUvh.cjs"),p=require("./radiobutton-x10h-JEh.cjs"),T=require("./tag-lU4vz70a.cjs"),I=require("./textarea-DcpZnWkt.cjs"),M=require("./textinput-DcES1ibY.cjs"),R=require("./select-BNGnC2U9.cjs");var H=Object.defineProperty,w=Object.getOwnPropertyDescriptor,o=(a,e,r,i)=>{for(var n=i>1?void 0:i?w(e,r):e,u=a.length-1,c;u>=0;u--)(c=a[u])&&(n=(i?c(e,r,n):c(n))||n);return i&&n&&H(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=s.e(),this.namedSlot=s.e(),this.slotController=new y.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(e=>{this._list.push(e.toUpperCase())}),super.connectedCallback()}render(){const e={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return t.x`
|
|
2
2
|
<div class="${O.e(e)}">
|
|
3
3
|
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
4
4
|
|
package/dist/pkt-index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { P as T } from "./button-OLSvT2Im.js";
|
|
|
5
5
|
import { c as f } from "./calendar-Df6-FDRW.js";
|
|
6
6
|
import { P as D } from "./calendar-Df6-FDRW.js";
|
|
7
7
|
import { P as G } from "./card-BxHlJq4J.js";
|
|
8
|
-
import { P as K } from "./combobox-
|
|
8
|
+
import { P as K } from "./combobox-hYeZxIku.js";
|
|
9
9
|
import { P as U } from "./consent-ChCTj6FB.js";
|
|
10
10
|
import { P as q } from "./checkbox-B67_cfqW.js";
|
|
11
11
|
import { P as k, t as h, x as P, n, a as c } from "./element-gAd63VwC.js";
|
|
@@ -27,7 +27,7 @@ import { P as ht, P as ct } from "./radiobutton-BaIDDCwK.js";
|
|
|
27
27
|
import { P as ut } from "./tag-CX-zbR-7.js";
|
|
28
28
|
import { P as vt } from "./textarea-CctE69uw.js";
|
|
29
29
|
import { P as bt } from "./textinput-BAPxDvKu.js";
|
|
30
|
-
import { P as $t } from "./select-
|
|
30
|
+
import { P as $t } from "./select-Drl_8-OU.js";
|
|
31
31
|
var g = Object.defineProperty, v = Object.getOwnPropertyDescriptor, s = (t, e, i, a) => {
|
|
32
32
|
for (var r = a > 1 ? void 0 : a ? v(e, i) : e, p = t.length - 1, l; p >= 0; p--)
|
|
33
33
|
(l = t[p]) && (r = (a ? l(e, i, r) : l(r)) || r);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as o } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
2
|
-
class
|
|
2
|
+
class d {
|
|
3
3
|
constructor(t) {
|
|
4
4
|
this.nodes = [], this.options = [], this.host = t, this.host.addController(this), this.nodes = [], this.options = [], this.observer = new MutationObserver((e) => this.handleMutations(e));
|
|
5
5
|
}
|
|
@@ -12,14 +12,15 @@ class a {
|
|
|
12
12
|
this.observer.disconnect();
|
|
13
13
|
}
|
|
14
14
|
addNode(t) {
|
|
15
|
-
(t.nodeName === "OPTION" || t.nodeName === "DATA") && (t.setAttribute("class", "pkt-hide"), t.setAttribute("hidden", "true"), t.setAttribute("data-skip", "true"), this.nodes.push(t));
|
|
15
|
+
(t.nodeName === "OPTION" || t.nodeName === "DATA") && (t.setAttribute("class", "pkt-hide"), t.setAttribute("role", "presentation"), t.setAttribute("aria-hidden", "true"), t.setAttribute("data-skip", "true"), this.nodes.push(t));
|
|
16
16
|
}
|
|
17
17
|
createOptions() {
|
|
18
18
|
this.options = this.nodes.map((t) => ({
|
|
19
|
-
value: t.getAttribute("value")
|
|
19
|
+
value: t.hasAttribute("value") ? t.getAttribute("value") ?? "" : t.textContent ?? "",
|
|
20
20
|
label: t.textContent || t.getAttribute("value") || "",
|
|
21
|
-
selected:
|
|
22
|
-
disabled:
|
|
21
|
+
selected: t.hasAttribute("selected"),
|
|
22
|
+
disabled: t.hasAttribute("disabled"),
|
|
23
|
+
hidden: t.hasAttribute("hidden")
|
|
23
24
|
})), this.host.setAttribute("options", JSON.stringify(this.options));
|
|
24
25
|
}
|
|
25
26
|
handleMutations(t) {
|
|
@@ -34,5 +35,5 @@ class a {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
export {
|
|
37
|
-
|
|
38
|
+
d as P
|
|
38
39
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("./pkt-slot-controller-Da-RgXfS.cjs");class h{constructor(t){this.nodes=[],this.options=[],this.host=t,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(e=>this.handleMutations(e))}hostConnected(){Array.from(this.host.childNodes).forEach(t=>{(t.nodeName==="OPTION"||t.nodeName==="DATA")&&this.addNode(t)}),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}addNode(t){(t.nodeName==="OPTION"||t.nodeName==="DATA")&&(t.setAttribute("class","pkt-hide"),t.setAttribute("role","presentation"),t.setAttribute("aria-hidden","true"),t.setAttribute("data-skip","true"),this.nodes.push(t))}createOptions(){this.options=this.nodes.map(t=>({value:t.hasAttribute("value")?t.getAttribute("value")??"":t.textContent??"",label:t.textContent||t.getAttribute("value")||"",selected:t.hasAttribute("selected"),disabled:t.hasAttribute("disabled"),hidden:t.hasAttribute("hidden")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(t){let e=!1;t.forEach(i=>{i.type==="childList"&&(i.addedNodes.forEach(s=>{o.isOptionElement(s)&&(this.addNode(s),e=!0)}),i.removedNodes.forEach(s=>{o.isOptionElement(s)&&(this.nodes=this.nodes.filter(r=>r!==s),e=!0)}))}),e&&this.createOptions()}}exports.PktOptionsSlotController=h;
|
package/dist/pkt-select.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./select-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./select-BNGnC2U9.cjs"),t=e.PktSelect;Object.defineProperty(exports,"PktSelect",{enumerable:!0,get:()=>e.PktSelect});exports.default=t;
|
package/dist/pkt-select.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const r=require("./element-90YeMNbV.cjs"),p=require("./state-D-Recv7U.cjs"),h=require("./ref-B-w1vCo8.cjs"),o=require("./if-defined-C8eotHpL.cjs"),d=require("./input-element-CInrWeac.cjs"),c=require("./pkt-options-controller-
|
|
1
|
+
"use strict";const r=require("./element-90YeMNbV.cjs"),p=require("./state-D-Recv7U.cjs"),h=require("./ref-B-w1vCo8.cjs"),o=require("./if-defined-C8eotHpL.cjs"),d=require("./input-element-CInrWeac.cjs"),c=require("./pkt-options-controller-ftMgG5DP.cjs"),v=require("./pkt-slot-controller-Da-RgXfS.cjs");require("./input-wrapper-Uw7_cZ4w.cjs");var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,a=(u,t,e,s)=>{for(var i=s>1?void 0:s?b(t,e):t,l=u.length-1,n;l>=0;l--)(n=u[l])&&(i=(s?n(t,e,i):n(i))||i);return s&&i&&f(t,e,i),i};exports.PktSelect=class extends d.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.options=[],this.value="",this._options=[],this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new c.PktOptionsSlotController(this),this.slotController=new v.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback();const t=this.options.length>0,e=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!t&&e?this.optionsController.nodes.forEach(s=>{const i={value:s.hasAttribute("value")?s.getAttribute("value")??"":s.textContent??"",label:s.textContent||s.getAttribute("value")||"",disabled:s.hasAttribute("disabled"),hidden:s.hasAttribute("hidden")};s.getAttribute("selected")&&!this.value&&(this.value=i.value),this._options.push(i)}):(this._options=this.options,this._options.forEach(s=>{s.selected&&!this.value&&(this.value=s.value)}))}add(t,e){var s,i,l;(s=this.inputRef.value)==null||s.add(t,e),this._options.push({value:t.value||t.text,label:t.text||t.value,selected:t.selected,disabled:t.disabled}),t.selected&&(this.value=t.value||t.text,this.selectedIndex=this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions),this.requestUpdate()}remove(t){var e,s;typeof t=="number"&&(this.selectedIndex===t&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),(s=this.inputRef.value)==null||s.remove(t))}item(t){var e;return(e=this.inputRef.value)==null?void 0:e.item(t)}namedItem(t){var e;return(e=this.inputRef.value)==null?void 0:e.namedItem(t)}showPicker(){var t;(t=this.inputRef.value)==null||t.showPicker()}attributeChangedCallback(t,e,s){var i,l;t==="options"&&(this._options=s?JSON.parse(s):[]),t==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex):this.options.findIndex(n=>n.value===s),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions,this.valueChanged(s,e)),super.attributeChangedCallback(t,e,s)}update(t){var e,s;super.update(t),t.has("value")&&this.value!==t.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((e=this.inputRef.value)==null?void 0:e.selectedIndex):this.options.findIndex(i=>i.value===this.value),this.selectedOptions=(s=this.inputRef.value)==null?void 0:s.selectedOptions,this.valueChanged(this.value,t.get("value"))),t.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(t){var e;super.firstUpdated(t),this.options.length&&(this._options=this.options),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(s=>s.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return r.x`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
?counter=${this.counter}
|
|
4
4
|
?disabled=${this.disabled}
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
value=${e.value}
|
|
39
39
|
?selected=${this.value==e.value||e.selected}
|
|
40
40
|
?disabled=${e.disabled}
|
|
41
|
+
?hidden=${e.hidden}
|
|
41
42
|
>
|
|
42
43
|
${e.label}
|
|
43
44
|
</option>`)}
|
|
@@ -3,15 +3,15 @@ import { r as f } from "./state-BxrO4zNJ.js";
|
|
|
3
3
|
import { e as u, n as d } from "./ref-DnSbnXsj.js";
|
|
4
4
|
import { o } from "./if-defined-Cj-3Kdsr.js";
|
|
5
5
|
import { P as b } from "./input-element-BEvaQK4g.js";
|
|
6
|
-
import { P as $ } from "./pkt-options-controller-
|
|
6
|
+
import { P as $ } from "./pkt-options-controller-C_Yl_3P6.js";
|
|
7
7
|
import { P as x } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
8
8
|
import "./input-wrapper-DnyRiuHR.js";
|
|
9
|
-
var m = Object.defineProperty, g = Object.getOwnPropertyDescriptor,
|
|
10
|
-
for (var l = i > 1 ? void 0 : i ? g(e, s) : e, n = t.length - 1,
|
|
11
|
-
(
|
|
9
|
+
var m = Object.defineProperty, g = Object.getOwnPropertyDescriptor, a = (t, e, s, i) => {
|
|
10
|
+
for (var l = i > 1 ? void 0 : i ? g(e, s) : e, n = t.length - 1, r; n >= 0; n--)
|
|
11
|
+
(r = t[n]) && (l = (i ? r(e, s, l) : r(l)) || l);
|
|
12
12
|
return i && l && m(e, s, l), l;
|
|
13
13
|
};
|
|
14
|
-
let
|
|
14
|
+
let h = class extends b {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(), this.inputRef = u(), this.helptextSlot = u(), this.options = [], this.value = "", this._options = [], this.selectedIndex = -1, this.selectedOptions = void 0, this.optionsController = new $(this), this.slotController = new x(this, this.helptextSlot), this.slotController.skipOptions = !0;
|
|
17
17
|
}
|
|
@@ -21,9 +21,10 @@ let a = class extends b {
|
|
|
21
21
|
const t = this.options.length > 0, e = this.optionsController.nodes.length && this.optionsController.nodes.length > 0;
|
|
22
22
|
!t && e ? this.optionsController.nodes.forEach((s) => {
|
|
23
23
|
const i = {
|
|
24
|
-
value: s.getAttribute("value")
|
|
24
|
+
value: s.hasAttribute("value") ? s.getAttribute("value") ?? "" : s.textContent ?? "",
|
|
25
25
|
label: s.textContent || s.getAttribute("value") || "",
|
|
26
|
-
disabled:
|
|
26
|
+
disabled: s.hasAttribute("disabled"),
|
|
27
|
+
hidden: s.hasAttribute("hidden")
|
|
27
28
|
};
|
|
28
29
|
s.getAttribute("selected") && !this.value && (this.value = i.value), this._options.push(i);
|
|
29
30
|
}) : (this._options = this.options, this._options.forEach((s) => {
|
|
@@ -123,6 +124,7 @@ let a = class extends b {
|
|
|
123
124
|
value=${e.value}
|
|
124
125
|
?selected=${this.value == e.value || e.selected}
|
|
125
126
|
?disabled=${e.disabled}
|
|
127
|
+
?hidden=${e.hidden}
|
|
126
128
|
>
|
|
127
129
|
${e.label}
|
|
128
130
|
</option>`
|
|
@@ -136,18 +138,18 @@ let a = class extends b {
|
|
|
136
138
|
return t == null || isNaN(t) ? null : t;
|
|
137
139
|
}
|
|
138
140
|
};
|
|
139
|
-
|
|
141
|
+
a([
|
|
140
142
|
c({ type: Array })
|
|
141
|
-
],
|
|
142
|
-
|
|
143
|
+
], h.prototype, "options", 2);
|
|
144
|
+
a([
|
|
143
145
|
c({ type: String })
|
|
144
|
-
],
|
|
145
|
-
|
|
146
|
+
], h.prototype, "value", 2);
|
|
147
|
+
a([
|
|
146
148
|
f()
|
|
147
|
-
],
|
|
148
|
-
|
|
149
|
+
], h.prototype, "_options", 2);
|
|
150
|
+
h = a([
|
|
149
151
|
v("pkt-select")
|
|
150
|
-
],
|
|
152
|
+
], h);
|
|
151
153
|
export {
|
|
152
|
-
|
|
154
|
+
h as P
|
|
153
155
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "12.42.
|
|
3
|
+
"version": "12.42.7",
|
|
4
4
|
"description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@oslokommune/punkt-assets": "^12.39.2",
|
|
34
|
-
"@oslokommune/punkt-css": "^12.42.
|
|
34
|
+
"@oslokommune/punkt-css": "^12.42.7",
|
|
35
35
|
"sass": "^1.78.0",
|
|
36
36
|
"typescript": "^5.6.2",
|
|
37
37
|
"vite": "^5.4.18",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
59
59
|
},
|
|
60
60
|
"license": "MIT",
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "c7b7988a22eb94069abbcfb1b31501b0d97a878c"
|
|
62
62
|
}
|
|
@@ -12,6 +12,7 @@ export type TSelectOption = {
|
|
|
12
12
|
label: string
|
|
13
13
|
selected?: boolean
|
|
14
14
|
disabled?: boolean
|
|
15
|
+
hidden?: boolean
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export interface IPktSelect {
|
|
@@ -68,9 +69,12 @@ export class PktSelect extends PktInputElement implements IPktSelect {
|
|
|
68
69
|
if (!optionsReceivedFromProps && checkIfOptionNodesInSlot) {
|
|
69
70
|
this.optionsController.nodes.forEach((node: Element) => {
|
|
70
71
|
const option: TSelectOption = {
|
|
71
|
-
value: node.
|
|
72
|
+
value: node.hasAttribute('value')
|
|
73
|
+
? (node.getAttribute('value') ?? '')
|
|
74
|
+
: (node.textContent ?? ''),
|
|
72
75
|
label: node.textContent || node.getAttribute('value') || '',
|
|
73
|
-
disabled:
|
|
76
|
+
disabled: node.hasAttribute('disabled'),
|
|
77
|
+
hidden: node.hasAttribute('hidden'),
|
|
74
78
|
}
|
|
75
79
|
if (node.getAttribute('selected') && !this.value) {
|
|
76
80
|
this.value = option.value
|
|
@@ -231,6 +235,7 @@ export class PktSelect extends PktInputElement implements IPktSelect {
|
|
|
231
235
|
value=${option.value}
|
|
232
236
|
?selected=${this.value == option.value || option.selected}
|
|
233
237
|
?disabled=${option.disabled}
|
|
238
|
+
?hidden=${option.hidden}
|
|
234
239
|
>
|
|
235
240
|
${option.label}
|
|
236
241
|
</option>`,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const o=require("./pkt-slot-controller-Da-RgXfS.cjs");class h{constructor(t){this.nodes=[],this.options=[],this.host=t,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(e=>this.handleMutations(e))}hostConnected(){Array.from(this.host.childNodes).forEach(t=>{(t.nodeName==="OPTION"||t.nodeName==="DATA")&&this.addNode(t)}),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}addNode(t){(t.nodeName==="OPTION"||t.nodeName==="DATA")&&(t.setAttribute("class","pkt-hide"),t.setAttribute("hidden","true"),t.setAttribute("data-skip","true"),this.nodes.push(t))}createOptions(){this.options=this.nodes.map(t=>({value:t.getAttribute("value")||t.textContent||"",label:t.textContent||t.getAttribute("value")||"",selected:!!t.getAttribute("selected"),disabled:!!t.getAttribute("disabled")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(t){let e=!1;t.forEach(i=>{i.type==="childList"&&(i.addedNodes.forEach(s=>{o.isOptionElement(s)&&(this.addNode(s),e=!0)}),i.removedNodes.forEach(s=>{o.isOptionElement(s)&&(this.nodes=this.nodes.filter(r=>r!==s),e=!0)}))}),e&&this.createOptions()}}exports.PktOptionsSlotController=h;
|