@oslokommune/punkt-react 13.5.4 → 13.5.5
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 +61 -61
- package/dist/punkt-react.umd.js +15 -15
- package/package.json +3 -3
package/dist/punkt-react.es.js
CHANGED
|
@@ -28740,64 +28740,64 @@ let Iv = class extends cn {
|
|
|
28740
28740
|
// Used for initilization
|
|
28741
28741
|
connectedCallback() {
|
|
28742
28742
|
super.connectedCallback();
|
|
28743
|
-
const
|
|
28744
|
-
!
|
|
28745
|
-
const
|
|
28746
|
-
value:
|
|
28747
|
-
label:
|
|
28748
|
-
disabled:
|
|
28749
|
-
selected:
|
|
28750
|
-
hidden:
|
|
28743
|
+
const e = this.options.length > 0, t = this.optionsController.nodes.length && this.optionsController.nodes.length > 0;
|
|
28744
|
+
!e && t ? this.optionsController.nodes.forEach((a) => {
|
|
28745
|
+
const o = {
|
|
28746
|
+
value: a.hasAttribute("value") ? a.getAttribute("value") ?? "" : a.textContent ?? "",
|
|
28747
|
+
label: a.textContent || a.getAttribute("value") || "",
|
|
28748
|
+
disabled: a.hasAttribute("disabled"),
|
|
28749
|
+
selected: a.hasAttribute("selected"),
|
|
28750
|
+
hidden: a.hasAttribute("data-hidden")
|
|
28751
28751
|
};
|
|
28752
|
-
|
|
28753
|
-
}) : (this._options = this.options, this._options.forEach((
|
|
28754
|
-
|
|
28752
|
+
a.getAttribute("selected") && !this.value && (this.value = o.value), this._options.push(o);
|
|
28753
|
+
}) : (this._options = this.options, this._options.forEach((a) => {
|
|
28754
|
+
a.selected && !this.value && (this.value = a.value);
|
|
28755
28755
|
}));
|
|
28756
28756
|
}
|
|
28757
28757
|
// Support native Select method `add`
|
|
28758
|
-
add(
|
|
28759
|
-
var o, u
|
|
28760
|
-
(
|
|
28761
|
-
value:
|
|
28762
|
-
label:
|
|
28763
|
-
selected:
|
|
28764
|
-
disabled:
|
|
28765
|
-
}),
|
|
28758
|
+
add(e, t) {
|
|
28759
|
+
var a, o, u;
|
|
28760
|
+
(a = this.inputRef.value) == null || a.add(e, t), this._options.push({
|
|
28761
|
+
value: e.value || e.text,
|
|
28762
|
+
label: e.text || e.value,
|
|
28763
|
+
selected: e.selected,
|
|
28764
|
+
disabled: e.disabled
|
|
28765
|
+
}), e.selected && (this.value = e.value || e.text, this.selectedIndex = this.returnNumberOrNull((o = this.inputRef.value) == null ? void 0 : o.selectedIndex), this.selectedOptions = (u = this.inputRef.value) == null ? void 0 : u.selectedOptions), this.requestUpdate();
|
|
28766
28766
|
}
|
|
28767
28767
|
// Support native Select method `remove`
|
|
28768
|
-
remove(
|
|
28769
|
-
var
|
|
28770
|
-
typeof
|
|
28768
|
+
remove(e) {
|
|
28769
|
+
var t, a;
|
|
28770
|
+
typeof e == "number" && (this.selectedIndex === e && (this.value = ((t = this._options[0]) == null ? void 0 : t.value) || ""), (a = this.inputRef.value) == null || a.remove(e));
|
|
28771
28771
|
}
|
|
28772
28772
|
// Support native Select method `item`
|
|
28773
|
-
item(
|
|
28774
|
-
var
|
|
28775
|
-
return (
|
|
28773
|
+
item(e) {
|
|
28774
|
+
var t;
|
|
28775
|
+
return (t = this.inputRef.value) == null ? void 0 : t.item(e);
|
|
28776
28776
|
}
|
|
28777
28777
|
// Support native Select method `namedItem`
|
|
28778
|
-
namedItem(
|
|
28779
|
-
var
|
|
28780
|
-
return (
|
|
28778
|
+
namedItem(e) {
|
|
28779
|
+
var t;
|
|
28780
|
+
return (t = this.inputRef.value) == null ? void 0 : t.namedItem(e);
|
|
28781
28781
|
}
|
|
28782
28782
|
// Support native Select method `showPicker`
|
|
28783
28783
|
showPicker() {
|
|
28784
|
-
var
|
|
28785
|
-
(
|
|
28784
|
+
var e;
|
|
28785
|
+
(e = this.inputRef.value) == null || e.showPicker();
|
|
28786
28786
|
}
|
|
28787
|
-
attributeChangedCallback(t, a
|
|
28788
|
-
var
|
|
28789
|
-
|
|
28787
|
+
attributeChangedCallback(e, t, a) {
|
|
28788
|
+
var o, u;
|
|
28789
|
+
e === "options" && (this._options = a ? JSON.parse(a) : []), e === "value" && this.value !== t && (this.selectedIndex = this.touched ? this.returnNumberOrNull((o = this.inputRef.value) == null ? void 0 : o.selectedIndex) : this.options.findIndex((d) => d.value === a), this.selectedOptions = (u = this.inputRef.value) == null ? void 0 : u.selectedOptions, this.valueChanged(a, t)), super.attributeChangedCallback(e, t, a);
|
|
28790
28790
|
}
|
|
28791
|
-
update(
|
|
28792
|
-
var
|
|
28793
|
-
super.update(
|
|
28791
|
+
update(e) {
|
|
28792
|
+
var t, a;
|
|
28793
|
+
super.update(e), e.has("options") && (this._options = this.options, this.requestUpdate("_options"), !this.value && this._options.length > 0 && (this.value = this._options[0].value, this.selectedIndex = 0)), e.has("value") && this.value !== e.get("value") && (this.selectedIndex = this.touched ? this.returnNumberOrNull((t = this.inputRef.value) == null ? void 0 : t.selectedIndex) : this.options.findIndex((o) => o.value === this.value), this.selectedOptions = (a = this.inputRef.value) == null ? void 0 : a.selectedOptions, this.valueChanged(this.value, e.get("value"))), e.has("id") && !this.name && this.id && (this.name = this.id);
|
|
28794
28794
|
}
|
|
28795
|
-
firstUpdated(
|
|
28796
|
-
var
|
|
28797
|
-
super.firstUpdated(
|
|
28795
|
+
firstUpdated(e) {
|
|
28796
|
+
var t;
|
|
28797
|
+
super.firstUpdated(e), 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((a) => a.value === this.value), this.selectedOptions = (t = this.inputRef.value) == null ? void 0 : t.selectedOptions;
|
|
28798
28798
|
}
|
|
28799
28799
|
render() {
|
|
28800
|
-
const
|
|
28800
|
+
const e = `pkt-input ${this.fullwidth ? "pkt-input--fullwidth" : ""}`;
|
|
28801
28801
|
return ke`
|
|
28802
28802
|
<pkt-input-wrapper
|
|
28803
28803
|
?counter=${this.counter}
|
|
@@ -28821,7 +28821,7 @@ let Iv = class extends cn {
|
|
|
28821
28821
|
tagText=${$t(this.tagText)}
|
|
28822
28822
|
>
|
|
28823
28823
|
<select
|
|
28824
|
-
class=${
|
|
28824
|
+
class=${e}
|
|
28825
28825
|
aria-invalid=${this.hasError}
|
|
28826
28826
|
aria-errormessage=${`${this.id}-error`}
|
|
28827
28827
|
aria-labelledby=${$t(this.ariaLabelledby)}
|
|
@@ -28829,37 +28829,37 @@ let Iv = class extends cn {
|
|
|
28829
28829
|
id=${this.id + "-input"}
|
|
28830
28830
|
name=${(this.name || this.id) + "-input"}
|
|
28831
28831
|
value=${this.value}
|
|
28832
|
-
@change=${(
|
|
28833
|
-
this.touched = !0, this.value =
|
|
28832
|
+
@change=${(t) => {
|
|
28833
|
+
this.touched = !0, this.value = t.target.value, t.stopImmediatePropagation();
|
|
28834
28834
|
}}
|
|
28835
|
-
@input=${(
|
|
28836
|
-
this.onInput(),
|
|
28835
|
+
@input=${(t) => {
|
|
28836
|
+
this.onInput(), t.stopImmediatePropagation();
|
|
28837
28837
|
}}
|
|
28838
|
-
@focus=${(
|
|
28839
|
-
this.onFocus(),
|
|
28838
|
+
@focus=${(t) => {
|
|
28839
|
+
this.onFocus(), t.stopImmediatePropagation();
|
|
28840
28840
|
}}
|
|
28841
|
-
@blur=${(
|
|
28842
|
-
this.onBlur(),
|
|
28841
|
+
@blur=${(t) => {
|
|
28842
|
+
this.onBlur(), t.stopImmediatePropagation();
|
|
28843
28843
|
}}
|
|
28844
28844
|
${dn(this.inputRef)}
|
|
28845
28845
|
>
|
|
28846
|
-
${this._options.length > 0
|
|
28847
|
-
(
|
|
28848
|
-
|
|
28849
|
-
|
|
28850
|
-
|
|
28851
|
-
|
|
28852
|
-
|
|
28853
|
-
|
|
28854
|
-
|
|
28855
|
-
)}
|
|
28846
|
+
${this._options.length > 0 ? this._options.map(
|
|
28847
|
+
(t) => ke`<option
|
|
28848
|
+
value=${t.value}
|
|
28849
|
+
?selected=${this.value == t.value || t.selected}
|
|
28850
|
+
?disabled=${t.disabled}
|
|
28851
|
+
?hidden=${t.hidden}
|
|
28852
|
+
>
|
|
28853
|
+
${t.label}
|
|
28854
|
+
</option>`
|
|
28855
|
+
) : ""}
|
|
28856
28856
|
</select>
|
|
28857
28857
|
<div class="pkt-contents" ${dn(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
28858
28858
|
</pkt-input-wrapper>
|
|
28859
28859
|
`;
|
|
28860
28860
|
}
|
|
28861
|
-
returnNumberOrNull(
|
|
28862
|
-
return
|
|
28861
|
+
returnNumberOrNull(e) {
|
|
28862
|
+
return e == null || isNaN(e) ? null : e;
|
|
28863
28863
|
}
|
|
28864
28864
|
};
|
|
28865
28865
|
GS([
|
package/dist/punkt-react.umd.js
CHANGED
|
@@ -1395,7 +1395,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
1395
1395
|
${!this.suffix&&t?Se`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>`:Ke}
|
|
1396
1396
|
</div>
|
|
1397
1397
|
</pkt-input-wrapper>
|
|
1398
|
-
`}};Eu([G({type:String,reflect:!0})],Sl.prototype,"value",2),Eu([G({type:String})],Sl.prototype,"type",2),Eu([G({type:Number})],Sl.prototype,"size",2),Eu([G({type:String})],Sl.prototype,"autocomplete",2),Eu([G({type:String})],Sl.prototype,"iconNameRight",2),Eu([G({type:String})],Sl.prototype,"prefix",2),Eu([G({type:String})],Sl.prototype,"suffix",2),Eu([G({type:Boolean})],Sl.prototype,"omitSearchIcon",2),Eu([Fn()],Sl.prototype,"counterCurrent",2),Sl=Eu([hr("pkt-textinput")],Sl);var r4=Object.defineProperty,a4=Object.getOwnPropertyDescriptor,Sy=(e,t,a,o)=>{for(var u=o>1?void 0:o?a4(t,a):t,d=e.length-1,f;d>=0;d--)(f=e[d])&&(u=(o?f(t,a,u):f(u))||u);return o&&u&&r4(t,a,u),u};let Zm=class extends cn{constructor(){super(),this.inputRef=gn(),this.helptextSlot=gn(),this.options=[],this.value="",this._options=[],this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new II(this),this.slotController=new qa(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback();const
|
|
1398
|
+
`}};Eu([G({type:String,reflect:!0})],Sl.prototype,"value",2),Eu([G({type:String})],Sl.prototype,"type",2),Eu([G({type:Number})],Sl.prototype,"size",2),Eu([G({type:String})],Sl.prototype,"autocomplete",2),Eu([G({type:String})],Sl.prototype,"iconNameRight",2),Eu([G({type:String})],Sl.prototype,"prefix",2),Eu([G({type:String})],Sl.prototype,"suffix",2),Eu([G({type:Boolean})],Sl.prototype,"omitSearchIcon",2),Eu([Fn()],Sl.prototype,"counterCurrent",2),Sl=Eu([hr("pkt-textinput")],Sl);var r4=Object.defineProperty,a4=Object.getOwnPropertyDescriptor,Sy=(e,t,a,o)=>{for(var u=o>1?void 0:o?a4(t,a):t,d=e.length-1,f;d>=0;d--)(f=e[d])&&(u=(o?f(t,a,u):f(u))||u);return o&&u&&r4(t,a,u),u};let Zm=class extends cn{constructor(){super(),this.inputRef=gn(),this.helptextSlot=gn(),this.options=[],this.value="",this._options=[],this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new II(this),this.slotController=new qa(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback();const e=this.options.length>0,t=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!e&&t?this.optionsController.nodes.forEach(a=>{const o={value:a.hasAttribute("value")?a.getAttribute("value")??"":a.textContent??"",label:a.textContent||a.getAttribute("value")||"",disabled:a.hasAttribute("disabled"),selected:a.hasAttribute("selected"),hidden:a.hasAttribute("data-hidden")};a.getAttribute("selected")&&!this.value&&(this.value=o.value),this._options.push(o)}):(this._options=this.options,this._options.forEach(a=>{a.selected&&!this.value&&(this.value=a.value)}))}add(e,t){var a,o,u;(a=this.inputRef.value)==null||a.add(e,t),this._options.push({value:e.value||e.text,label:e.text||e.value,selected:e.selected,disabled:e.disabled}),e.selected&&(this.value=e.value||e.text,this.selectedIndex=this.returnNumberOrNull((o=this.inputRef.value)==null?void 0:o.selectedIndex),this.selectedOptions=(u=this.inputRef.value)==null?void 0:u.selectedOptions),this.requestUpdate()}remove(e){var t,a;typeof e=="number"&&(this.selectedIndex===e&&(this.value=((t=this._options[0])==null?void 0:t.value)||""),(a=this.inputRef.value)==null||a.remove(e))}item(e){var t;return(t=this.inputRef.value)==null?void 0:t.item(e)}namedItem(e){var t;return(t=this.inputRef.value)==null?void 0:t.namedItem(e)}showPicker(){var e;(e=this.inputRef.value)==null||e.showPicker()}attributeChangedCallback(e,t,a){var o,u;e==="options"&&(this._options=a?JSON.parse(a):[]),e==="value"&&this.value!==t&&(this.selectedIndex=this.touched?this.returnNumberOrNull((o=this.inputRef.value)==null?void 0:o.selectedIndex):this.options.findIndex(d=>d.value===a),this.selectedOptions=(u=this.inputRef.value)==null?void 0:u.selectedOptions,this.valueChanged(a,t)),super.attributeChangedCallback(e,t,a)}update(e){var t,a;super.update(e),e.has("options")&&(this._options=this.options,this.requestUpdate("_options"),!this.value&&this._options.length>0&&(this.value=this._options[0].value,this.selectedIndex=0)),e.has("value")&&this.value!==e.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((t=this.inputRef.value)==null?void 0:t.selectedIndex):this.options.findIndex(o=>o.value===this.value),this.selectedOptions=(a=this.inputRef.value)==null?void 0:a.selectedOptions,this.valueChanged(this.value,e.get("value"))),e.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(e){var t;super.firstUpdated(e),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(a=>a.value===this.value),this.selectedOptions=(t=this.inputRef.value)==null?void 0:t.selectedOptions}render(){const e=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return Se`
|
|
1399
1399
|
<pkt-input-wrapper
|
|
1400
1400
|
?counter=${this.counter}
|
|
1401
1401
|
?disabled=${this.disabled}
|
|
@@ -1418,7 +1418,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
1418
1418
|
tagText=${$t(this.tagText)}
|
|
1419
1419
|
>
|
|
1420
1420
|
<select
|
|
1421
|
-
class=${
|
|
1421
|
+
class=${e}
|
|
1422
1422
|
aria-invalid=${this.hasError}
|
|
1423
1423
|
aria-errormessage=${`${this.id}-error`}
|
|
1424
1424
|
aria-labelledby=${$t(this.ariaLabelledby)}
|
|
@@ -1426,24 +1426,24 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
1426
1426
|
id=${this.id+"-input"}
|
|
1427
1427
|
name=${(this.name||this.id)+"-input"}
|
|
1428
1428
|
value=${this.value}
|
|
1429
|
-
@change=${
|
|
1430
|
-
@input=${
|
|
1431
|
-
@focus=${
|
|
1432
|
-
@blur=${
|
|
1429
|
+
@change=${t=>{this.touched=!0,this.value=t.target.value,t.stopImmediatePropagation()}}
|
|
1430
|
+
@input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
|
|
1431
|
+
@focus=${t=>{this.onFocus(),t.stopImmediatePropagation()}}
|
|
1432
|
+
@blur=${t=>{this.onBlur(),t.stopImmediatePropagation()}}
|
|
1433
1433
|
${fn(this.inputRef)}
|
|
1434
1434
|
>
|
|
1435
|
-
${this._options.length>0
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1435
|
+
${this._options.length>0?this._options.map(t=>Se`<option
|
|
1436
|
+
value=${t.value}
|
|
1437
|
+
?selected=${this.value==t.value||t.selected}
|
|
1438
|
+
?disabled=${t.disabled}
|
|
1439
|
+
?hidden=${t.hidden}
|
|
1440
|
+
>
|
|
1441
|
+
${t.label}
|
|
1442
|
+
</option>`):""}
|
|
1443
1443
|
</select>
|
|
1444
1444
|
<div class="pkt-contents" ${fn(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
1445
1445
|
</pkt-input-wrapper>
|
|
1446
|
-
`}returnNumberOrNull(
|
|
1446
|
+
`}returnNumberOrNull(e){return e==null||isNaN(e)?null:e}};Sy([G({type:Array})],Zm.prototype,"options",2),Sy([G({type:String})],Zm.prototype,"value",2),Sy([Fn()],Zm.prototype,"_options",2),Zm=Sy([hr("pkt-select")],Zm);var i4=Object.defineProperty,o4=Object.getOwnPropertyDescriptor,Jm=(e,t,a,o)=>{for(var u=o>1?void 0:o?o4(t,a):t,d=e.length-1,f;d>=0;d--)(f=e[d])&&(u=(o?f(t,a,u):f(u))||u);return o&&u&&i4(t,a,u),u};let Uh=class extends pa{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=gn(),this.namedSlot=gn(),this.slotController=new qa(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 Se`
|
|
1447
1447
|
<div class="${Jt(e)}">
|
|
1448
1448
|
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
1449
1449
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "13.5.
|
|
3
|
+
"version": "13.5.5",
|
|
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.5.
|
|
41
|
+
"@oslokommune/punkt-elements": "^13.5.5",
|
|
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": "f65d3c81c0543cc360a34fe346b4e0585deb46ac"
|
|
114
114
|
}
|