@oslokommune/punkt-react 13.5.11 → 13.5.13
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 +37 -0
- package/dist/punkt-react.es.js +77 -61
- package/dist/punkt-react.umd.js +127 -127
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,43 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [13.5.13](https://github.com/oslokommune/punkt/compare/13.5.12...13.5.13) (2025-09-12)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
* Bedre synk mellom options som props og options som elementer (#3017). * fix(elements,react): Bedre synk mellom options som props og options som elementer
|
|
18
|
+
* Fiks klaging på `showPicker` i tester
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Chores
|
|
22
|
+
Ingen
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## [13.5.12](https://github.com/oslokommune/punkt/compare/13.5.11...13.5.12) (2025-09-11)
|
|
28
|
+
|
|
29
|
+
### ⚠ BREAKING CHANGES
|
|
30
|
+
Ingen
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
Ingen
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
* Fix table styling (#3007).
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Chores
|
|
40
|
+
Ingen
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
|
|
8
45
|
## [13.5.7](https://github.com/oslokommune/punkt/compare/13.5.6...13.5.7) (2025-09-09)
|
|
9
46
|
|
|
10
47
|
### ⚠ BREAKING CHANGES
|
package/dist/punkt-react.es.js
CHANGED
|
@@ -28743,69 +28743,85 @@ var N6 = Object.defineProperty, I6 = Object.getOwnPropertyDescriptor, GS = (e, t
|
|
|
28743
28743
|
};
|
|
28744
28744
|
let Iv = class extends cn {
|
|
28745
28745
|
constructor() {
|
|
28746
|
-
super(), this.inputRef = gn(), this.helptextSlot = gn(), this.
|
|
28746
|
+
super(), this.inputRef = gn(), this.helptextSlot = gn(), this._optionsProp = [], this.value = "", this._options = [], this.selectedIndex = -1, this.selectedOptions = void 0, this.optionsController = new pU(this), this.slotController = new ni(this, this.helptextSlot), this.slotController.skipOptions = !0;
|
|
28747
|
+
}
|
|
28748
|
+
// Getter and setter for options to expose the actual parsed options
|
|
28749
|
+
get options() {
|
|
28750
|
+
return this._options.map((t) => ({
|
|
28751
|
+
...t,
|
|
28752
|
+
selected: t.value === this.value
|
|
28753
|
+
}));
|
|
28754
|
+
}
|
|
28755
|
+
set options(t) {
|
|
28756
|
+
this._optionsProp = t, this.requestUpdate("_optionsProp", this._options);
|
|
28747
28757
|
}
|
|
28748
|
-
// Used for initilization
|
|
28749
28758
|
connectedCallback() {
|
|
28750
28759
|
super.connectedCallback();
|
|
28751
|
-
const
|
|
28752
|
-
!
|
|
28753
|
-
const
|
|
28754
|
-
value:
|
|
28755
|
-
label:
|
|
28756
|
-
disabled:
|
|
28757
|
-
selected:
|
|
28758
|
-
hidden:
|
|
28760
|
+
const t = this._optionsProp.length > 0, a = this.optionsController.nodes.length && this.optionsController.nodes.length > 0;
|
|
28761
|
+
!t && a ? this.optionsController.nodes.forEach((o) => {
|
|
28762
|
+
const u = {
|
|
28763
|
+
value: o.hasAttribute("value") ? o.getAttribute("value") ?? "" : o.textContent ?? "",
|
|
28764
|
+
label: o.textContent || o.getAttribute("value") || "",
|
|
28765
|
+
disabled: o.hasAttribute("disabled"),
|
|
28766
|
+
selected: o.hasAttribute("selected"),
|
|
28767
|
+
hidden: o.hasAttribute("data-hidden")
|
|
28759
28768
|
};
|
|
28760
|
-
|
|
28761
|
-
}) : (this._options = this.
|
|
28762
|
-
|
|
28769
|
+
o.getAttribute("selected") && !this.value && (this.value = u.value), this._options.push(u);
|
|
28770
|
+
}) : (this._options = this._optionsProp, this._options.forEach((o) => {
|
|
28771
|
+
o.selected && !this.value && (this.value = o.value);
|
|
28763
28772
|
}));
|
|
28764
28773
|
}
|
|
28765
28774
|
// Support native Select method `add`
|
|
28766
|
-
add(
|
|
28767
|
-
|
|
28768
|
-
|
|
28769
|
-
|
|
28770
|
-
|
|
28771
|
-
|
|
28772
|
-
|
|
28773
|
-
|
|
28775
|
+
add(t, a) {
|
|
28776
|
+
const o = {
|
|
28777
|
+
value: t.value || t.text,
|
|
28778
|
+
label: t.text || t.value,
|
|
28779
|
+
selected: t.selected,
|
|
28780
|
+
disabled: t.disabled
|
|
28781
|
+
};
|
|
28782
|
+
if (a === void 0)
|
|
28783
|
+
this._options.push(o);
|
|
28784
|
+
else if (typeof a == "number")
|
|
28785
|
+
this._options.splice(a, 0, o);
|
|
28786
|
+
else {
|
|
28787
|
+
const u = a.value || a.text, d = this._options.findIndex((f) => f.value === u);
|
|
28788
|
+
d >= 0 ? this._options.splice(d, 0, o) : this._options.push(o);
|
|
28789
|
+
}
|
|
28790
|
+
t.selected && (this.value = t.value || t.text, this.selectedIndex = this._options.findIndex((u) => u.value === this.value)), this.requestUpdate();
|
|
28774
28791
|
}
|
|
28775
28792
|
// Support native Select method `remove`
|
|
28776
|
-
remove(
|
|
28777
|
-
var
|
|
28778
|
-
typeof
|
|
28793
|
+
remove(t) {
|
|
28794
|
+
var a;
|
|
28795
|
+
typeof t == "number" && (this.selectedIndex === t && (this.value = ((a = this._options[0]) == null ? void 0 : a.value) || ""), this._options.splice(t, 1), this.requestUpdate());
|
|
28779
28796
|
}
|
|
28780
28797
|
// Support native Select method `item`
|
|
28781
|
-
item(
|
|
28782
|
-
var
|
|
28783
|
-
return (
|
|
28798
|
+
item(t) {
|
|
28799
|
+
var a;
|
|
28800
|
+
return (a = this.inputRef.value) == null ? void 0 : a.item(t);
|
|
28784
28801
|
}
|
|
28785
28802
|
// Support native Select method `namedItem`
|
|
28786
|
-
namedItem(
|
|
28787
|
-
var
|
|
28788
|
-
return (
|
|
28803
|
+
namedItem(t) {
|
|
28804
|
+
var a;
|
|
28805
|
+
return (a = this.inputRef.value) == null ? void 0 : a.namedItem(t);
|
|
28789
28806
|
}
|
|
28790
28807
|
// Support native Select method `showPicker`
|
|
28791
28808
|
showPicker() {
|
|
28792
|
-
|
|
28793
|
-
(e = this.inputRef.value) == null || e.showPicker();
|
|
28809
|
+
this.inputRef.value && "showPicker" in this.inputRef.value && this.inputRef.value.showPicker();
|
|
28794
28810
|
}
|
|
28795
|
-
attributeChangedCallback(
|
|
28796
|
-
var
|
|
28797
|
-
|
|
28811
|
+
attributeChangedCallback(t, a, o) {
|
|
28812
|
+
var u, d;
|
|
28813
|
+
t === "options" && (this._options = o ? JSON.parse(o) : []), t === "value" && this.value !== a && (this.selectedIndex = this.touched ? this.returnNumberOrNull((u = this.inputRef.value) == null ? void 0 : u.selectedIndex) : this._options.findIndex((f) => f.value === o), this.selectedOptions = (d = this.inputRef.value) == null ? void 0 : d.selectedOptions, this.valueChanged(o, a)), super.attributeChangedCallback(t, a, o);
|
|
28798
28814
|
}
|
|
28799
|
-
update(
|
|
28800
|
-
var
|
|
28801
|
-
super.update(
|
|
28815
|
+
update(t) {
|
|
28816
|
+
var a, o;
|
|
28817
|
+
super.update(t), t.has("_optionsProp") && this._optionsProp.length > 0 && (this._options = this._optionsProp, this.requestUpdate("_options"), !this.value && this._options.length > 0 && (this.value = this._options[0].value, this.selectedIndex = 0)), t.has("value") && this.value !== t.get("value") && (this.selectedIndex = this.touched ? this.returnNumberOrNull((a = this.inputRef.value) == null ? void 0 : a.selectedIndex) : this._options.findIndex((u) => u.value === this.value), this.selectedOptions = (o = this.inputRef.value) == null ? void 0 : o.selectedOptions, this.valueChanged(this.value, t.get("value"))), t.has("id") && !this.name && this.id && (this.name = this.id);
|
|
28802
28818
|
}
|
|
28803
|
-
firstUpdated(
|
|
28804
|
-
var
|
|
28805
|
-
super.firstUpdated(
|
|
28819
|
+
firstUpdated(t) {
|
|
28820
|
+
var a;
|
|
28821
|
+
super.firstUpdated(t), this._optionsProp.length && (this._options = this._optionsProp), !this.value && this._options.length > 0 ? (this.value = this._options[0].value, this.selectedIndex = 0) : this.selectedIndex = this._options.findIndex((o) => o.value === this.value), this.selectedOptions = (a = this.inputRef.value) == null ? void 0 : a.selectedOptions;
|
|
28806
28822
|
}
|
|
28807
28823
|
render() {
|
|
28808
|
-
const
|
|
28824
|
+
const t = `pkt-input ${this.fullwidth ? "pkt-input--fullwidth" : ""}`;
|
|
28809
28825
|
return ke`
|
|
28810
28826
|
<pkt-input-wrapper
|
|
28811
28827
|
?counter=${this.counter}
|
|
@@ -28829,7 +28845,7 @@ let Iv = class extends cn {
|
|
|
28829
28845
|
tagText=${$t(this.tagText)}
|
|
28830
28846
|
>
|
|
28831
28847
|
<select
|
|
28832
|
-
class=${
|
|
28848
|
+
class=${t}
|
|
28833
28849
|
aria-invalid=${this.hasError}
|
|
28834
28850
|
aria-errormessage=${`${this.id}-error`}
|
|
28835
28851
|
aria-labelledby=${$t(this.ariaLabelledby)}
|
|
@@ -28837,28 +28853,28 @@ let Iv = class extends cn {
|
|
|
28837
28853
|
id=${this.id + "-input"}
|
|
28838
28854
|
name=${(this.name || this.id) + "-input"}
|
|
28839
28855
|
value=${this.value}
|
|
28840
|
-
@change=${(
|
|
28841
|
-
this.touched = !0, this.value =
|
|
28856
|
+
@change=${(a) => {
|
|
28857
|
+
this.touched = !0, this.value = a.target.value, a.stopImmediatePropagation();
|
|
28842
28858
|
}}
|
|
28843
|
-
@input=${(
|
|
28844
|
-
this.onInput(),
|
|
28859
|
+
@input=${(a) => {
|
|
28860
|
+
this.onInput(), a.stopImmediatePropagation();
|
|
28845
28861
|
}}
|
|
28846
|
-
@focus=${(
|
|
28847
|
-
this.onFocus(),
|
|
28862
|
+
@focus=${(a) => {
|
|
28863
|
+
this.onFocus(), a.stopImmediatePropagation();
|
|
28848
28864
|
}}
|
|
28849
|
-
@blur=${(
|
|
28850
|
-
this.onBlur(),
|
|
28865
|
+
@blur=${(a) => {
|
|
28866
|
+
this.onBlur(), a.stopImmediatePropagation();
|
|
28851
28867
|
}}
|
|
28852
28868
|
${dn(this.inputRef)}
|
|
28853
28869
|
>
|
|
28854
28870
|
${this._options.length > 0 ? this._options.map(
|
|
28855
|
-
(
|
|
28856
|
-
value=${
|
|
28857
|
-
?selected=${this.value ==
|
|
28858
|
-
?disabled=${
|
|
28859
|
-
?hidden=${
|
|
28871
|
+
(a) => ke`<option
|
|
28872
|
+
value=${a.value}
|
|
28873
|
+
?selected=${this.value == a.value || a.selected}
|
|
28874
|
+
?disabled=${a.disabled}
|
|
28875
|
+
?hidden=${a.hidden}
|
|
28860
28876
|
>
|
|
28861
|
-
${
|
|
28877
|
+
${a.label}
|
|
28862
28878
|
</option>`
|
|
28863
28879
|
) : ""}
|
|
28864
28880
|
</select>
|
|
@@ -28866,13 +28882,13 @@ let Iv = class extends cn {
|
|
|
28866
28882
|
</pkt-input-wrapper>
|
|
28867
28883
|
`;
|
|
28868
28884
|
}
|
|
28869
|
-
returnNumberOrNull(
|
|
28870
|
-
return
|
|
28885
|
+
returnNumberOrNull(t) {
|
|
28886
|
+
return t == null || isNaN(t) ? null : t;
|
|
28871
28887
|
}
|
|
28872
28888
|
};
|
|
28873
28889
|
GS([
|
|
28874
|
-
G({ type: Array })
|
|
28875
|
-
], Iv.prototype, "
|
|
28890
|
+
G({ type: Array, attribute: "options" })
|
|
28891
|
+
], Iv.prototype, "_optionsProp", 2);
|
|
28876
28892
|
GS([
|
|
28877
28893
|
G({ type: String })
|
|
28878
28894
|
], Iv.prototype, "value", 2);
|