@oslokommune/punkt-elements 12.43.2 → 13.1.0
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 +45 -0
- package/dist/checkbox-CTRbpbye.js +120 -0
- package/dist/checkbox-wJ26voZd.cjs +30 -0
- package/dist/{combobox-Cv6i7BEk.cjs → combobox-CijGa9Fr.cjs} +3 -2
- package/dist/{combobox-kWGI4RHI.js → combobox-Cwg9Rkmz.js} +3 -2
- package/dist/{datepicker-BJe92Vor.cjs → datepicker-BhrUneAP.cjs} +2 -1
- package/dist/{datepicker-LpbYHx8L.js → datepicker-CEfh3TTA.js} +3 -2
- package/dist/index.d.ts +14 -1
- package/dist/{input-element-CHjLWeKt.cjs → input-element-C4xJoM-X.cjs} +1 -1
- package/dist/{input-element-Cco4PA2M.js → input-element-NnrDmp4r.js} +14 -11
- package/dist/{input-wrapper-BxZf8wEP.cjs → input-wrapper-CZ-a00V7.cjs} +19 -15
- package/dist/input-wrapper-Dr__Sxql.js +189 -0
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +8 -8
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/radiobutton-CWxiIVfA.js +111 -0
- package/dist/radiobutton-CdT6v1oq.cjs +31 -0
- package/dist/{select-BaLHLuvH.js → select-CsgDatCa.js} +14 -13
- package/dist/{select-CFpdOlDE.cjs → select-DUeTm8ac.cjs} +11 -10
- package/dist/{textarea-EIFo7GZz.js → textarea-BZL8Mkm0.js} +5 -4
- package/dist/{textarea-CViiuZdR.cjs → textarea-CPXsMFUq.cjs} +2 -1
- package/dist/{textinput-BHS7b-Jt.js → textinput-DjPhmmkB.js} +26 -25
- package/dist/{textinput-_ZdyMA9O.cjs → textinput-aNI5kibM.cjs} +7 -6
- package/package.json +4 -4
- package/src/components/checkbox/checkbox.ts +22 -1
- package/src/components/combobox/combobox.ts +2 -0
- package/src/components/datepicker/datepicker.ts +1 -0
- package/src/components/input-wrapper/input-wrapper.ts +20 -20
- package/src/components/radiobutton/radiobutton.ts +22 -1
- package/src/components/select/select.ts +1 -0
- package/src/components/textarea/textarea.ts +4 -8
- package/src/components/textinput/textinput.ts +14 -28
- package/dist/checkbox-CJ4tK9RC.cjs +0 -26
- package/dist/checkbox-cD_5LDzV.js +0 -101
- package/dist/input-wrapper-gz7ppKrK.js +0 -188
- package/dist/radiobutton-0vVqu-GU.cjs +0 -27
- package/dist/radiobutton-BcFRJFvI.js +0 -92
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,51 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [13.1.0](https://github.com/oslokommune/punkt/compare/13.0.4...13.1.0) (2025-07-08)
|
|
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
|
+
|
|
25
|
+
## [13.0.0](https://github.com/oslokommune/punkt/compare/12.43.2...13.0.0) (2025-07-04)
|
|
26
|
+
|
|
27
|
+
### ⚠ BREAKING CHANGES
|
|
28
|
+
* Skjemaelementer tilbake til ren React. BREAKING CHANGE: select vil ikke lenger ta i mot et options-array, await window.customElements.whenDefined('pkt-xxx) må fjernes fra React-tester (ellers vil testene feile), mulig behov for justeringer i tester, ta gjerne en visuell og funksjonell avsjekk ved oppdatering
|
|
29
|
+
|
|
30
|
+
Skjemaelementer i React-pakken:
|
|
31
|
+
- Inputwrapper: Skriv tilbake til React, oppdater tester, oppdatere JSON med nye props tatt fra inputwrapper-elements
|
|
32
|
+
- TextInput: Skriv tilbake til React, oppdater tester
|
|
33
|
+
- Select: Skriv tilbake til React, oppdater tester (vil ikke lenger ta i mot et options-array)
|
|
34
|
+
- Checkbox: Skriv tilbake til React, oppdater tester
|
|
35
|
+
- TextArea: Skriv tilbake til React, oppdater tester
|
|
36
|
+
- RadioButton: Skriv tilbake til React, oppdater tester
|
|
37
|
+
- Switch: Skriv tilbake til React, oppdater tester
|
|
38
|
+
- Oppdatere test-utils for nevnte komponenter
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
Ingen
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
Ingen
|
|
46
|
+
|
|
47
|
+
### Chores
|
|
48
|
+
Ingen
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
|
|
8
53
|
## [12.42.13](https://github.com/oslokommune/punkt/compare/12.42.12...12.42.13) (2025-06-24)
|
|
9
54
|
|
|
10
55
|
### ⚠ BREAKING CHANGES
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { E as n, x as c, n as i, a as d } from "./element-CgEWt74-.js";
|
|
2
|
+
import { P as k } from "./input-element-NnrDmp4r.js";
|
|
3
|
+
import { e as b, n as f } from "./ref-BBYSqgeW.js";
|
|
4
|
+
import { e as u } from "./class-map-BpTj9gtz.js";
|
|
5
|
+
var g = Object.defineProperty, y = Object.getOwnPropertyDescriptor, e = (s, h, p, a) => {
|
|
6
|
+
for (var l = a > 1 ? void 0 : a ? y(h, p) : h, o = s.length - 1, r; o >= 0; o--)
|
|
7
|
+
(r = s[o]) && (l = (a ? r(h, p, l) : r(l)) || l);
|
|
8
|
+
return a && l && g(h, p, l), l;
|
|
9
|
+
};
|
|
10
|
+
let t = class extends k {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.inputRef = b(), this.value = "", this.checkHelptext = null, this.defaultChecked = !1, this.hasTile = !1, this.isSwitch = !1, this.labelPosition = "right", this.hideLabel = !1, this.checked = null, this.type = "checkbox", this.tagText = null, this.optionalTag = !1, this.optionalText = "Valgfritt", this.requiredTag = !1, this.requiredText = "Må fylles ut";
|
|
13
|
+
}
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
super.connectedCallback();
|
|
16
|
+
}
|
|
17
|
+
attributeChangedCallback(s, h, p) {
|
|
18
|
+
s === "defaultChecked" && !this.checked && (this.checked = this.defaultChecked), s === "checked" && (this.checked = this.checked === "" || this.checked === "true" || this.checked === !0), super.attributeChangedCallback(s, h, p);
|
|
19
|
+
}
|
|
20
|
+
firstUpdated(s) {
|
|
21
|
+
s.has("defaultChecked") && !this.checked && (this.checked = this.defaultChecked), super.firstUpdated(s);
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
const s = u({
|
|
25
|
+
"pkt-input-check__input": !0,
|
|
26
|
+
"pkt-input-check__input--tile": this.hasTile,
|
|
27
|
+
"pkt-input-check__input--tile-disabled": this.disabled && this.hasTile
|
|
28
|
+
}), h = u({
|
|
29
|
+
"pkt-input-check__input-checkbox": !0,
|
|
30
|
+
"pkt-input-check__input-checkbox--error": this.hasError
|
|
31
|
+
}), p = u({
|
|
32
|
+
"pkt-input-check__input-label": !0,
|
|
33
|
+
"pkt-input-check__input-label--disabled": this.disabled,
|
|
34
|
+
"pkt-input-check__input-label--left": this.labelPosition === "left",
|
|
35
|
+
"pkt-input-check__input-label--right": this.labelPosition === "right",
|
|
36
|
+
"pkt-sr-only": this.hideLabel
|
|
37
|
+
}), a = "pkt-tag pkt-tag--small pkt-tag--thin-text", l = () => c`
|
|
38
|
+
${this.tagText ? c`<span class=${a + " pkt-tag--gray"}>${this.tagText}</span>` : n}
|
|
39
|
+
${this.optionalTag ? c`<span class=${a + " pkt-tag--blue-light"}>${this.optionalText}</span>` : n}
|
|
40
|
+
${this.requiredTag ? c`<span class=${a + " pkt-tag--beige"}>${this.requiredText}</span>` : n}
|
|
41
|
+
`, o = () => c`
|
|
42
|
+
<label class=${p} for=${this.id + "-internal"}>
|
|
43
|
+
${this.label} ${l()}
|
|
44
|
+
${this.checkHelptext ? c`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>` : n}
|
|
45
|
+
</label>
|
|
46
|
+
`;
|
|
47
|
+
return c`
|
|
48
|
+
<div class="pkt-input-check">
|
|
49
|
+
<div class=${s}>
|
|
50
|
+
${this.labelPosition === "left" ? o() : n}
|
|
51
|
+
<input
|
|
52
|
+
id=${this.id + "-internal"}
|
|
53
|
+
class=${h}
|
|
54
|
+
type="checkbox"
|
|
55
|
+
?disabled=${this.disabled}
|
|
56
|
+
name=${this.name + "-internal"}
|
|
57
|
+
${f(this.inputRef)}
|
|
58
|
+
@change=${this.toggleChecked}
|
|
59
|
+
@blur=${this.onBlur}
|
|
60
|
+
@focus=${this.onFocus}
|
|
61
|
+
?checked=${this.checked}
|
|
62
|
+
role=${this.isSwitch ? "switch" : "checkbox"}
|
|
63
|
+
/>
|
|
64
|
+
${this.labelPosition === "right" ? o() : n}
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
`;
|
|
68
|
+
}
|
|
69
|
+
toggleChecked(s) {
|
|
70
|
+
s.stopImmediatePropagation(), this.touched = !0, this.inputRef.value && (this.checked = this.inputRef.value.matches(":checked"), this.valueChecked(this.checked));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
e([
|
|
74
|
+
i({ type: String, reflect: !0 })
|
|
75
|
+
], t.prototype, "value", 2);
|
|
76
|
+
e([
|
|
77
|
+
i({ type: String })
|
|
78
|
+
], t.prototype, "checkHelptext", 2);
|
|
79
|
+
e([
|
|
80
|
+
i({ type: Boolean })
|
|
81
|
+
], t.prototype, "defaultChecked", 2);
|
|
82
|
+
e([
|
|
83
|
+
i({ type: Boolean })
|
|
84
|
+
], t.prototype, "hasTile", 2);
|
|
85
|
+
e([
|
|
86
|
+
i({ type: Boolean })
|
|
87
|
+
], t.prototype, "isSwitch", 2);
|
|
88
|
+
e([
|
|
89
|
+
i({ type: String })
|
|
90
|
+
], t.prototype, "labelPosition", 2);
|
|
91
|
+
e([
|
|
92
|
+
i({ type: Boolean })
|
|
93
|
+
], t.prototype, "hideLabel", 2);
|
|
94
|
+
e([
|
|
95
|
+
i({ type: Boolean, reflect: !0 })
|
|
96
|
+
], t.prototype, "checked", 2);
|
|
97
|
+
e([
|
|
98
|
+
i({ type: String, reflect: !0 })
|
|
99
|
+
], t.prototype, "type", 2);
|
|
100
|
+
e([
|
|
101
|
+
i({ type: String })
|
|
102
|
+
], t.prototype, "tagText", 2);
|
|
103
|
+
e([
|
|
104
|
+
i({ type: Boolean })
|
|
105
|
+
], t.prototype, "optionalTag", 2);
|
|
106
|
+
e([
|
|
107
|
+
i({ type: String })
|
|
108
|
+
], t.prototype, "optionalText", 2);
|
|
109
|
+
e([
|
|
110
|
+
i({ type: Boolean })
|
|
111
|
+
], t.prototype, "requiredTag", 2);
|
|
112
|
+
e([
|
|
113
|
+
i({ type: String })
|
|
114
|
+
], t.prototype, "requiredText", 2);
|
|
115
|
+
t = e([
|
|
116
|
+
d("pkt-checkbox")
|
|
117
|
+
], t);
|
|
118
|
+
export {
|
|
119
|
+
t as P
|
|
120
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";const t=require("./element-6DBpyGQm.cjs"),k=require("./input-element-C4xJoM-X.cjs"),n=require("./ref-iJtiv3o2.cjs"),o=require("./class-map-BBG2gMX4.cjs");var r=Object.defineProperty,u=Object.getOwnPropertyDescriptor,i=(p,e,c,h)=>{for(var s=h>1?void 0:h?u(e,c):e,a=p.length-1,l;a>=0;a--)(l=p[a])&&(s=(h?l(e,c,s):l(s))||s);return h&&s&&r(e,c,s),s};exports.PktCheckbox=class extends k.PktInputElement{constructor(){super(...arguments),this.inputRef=n.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.isSwitch=!1,this.labelPosition="right",this.hideLabel=!1,this.checked=null,this.type="checkbox",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut"}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,c,h){e==="defaultChecked"&&!this.checked&&(this.checked=this.defaultChecked),e==="checked"&&(this.checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(e,c,h)}firstUpdated(e){e.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),super.firstUpdated(e)}render(){const e=o.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),c=o.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),h=o.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-input-check__input-label--left":this.labelPosition==="left","pkt-input-check__input-label--right":this.labelPosition==="right","pkt-sr-only":this.hideLabel}),s="pkt-tag pkt-tag--small pkt-tag--thin-text",a=()=>t.x`
|
|
2
|
+
${this.tagText?t.x`<span class=${s+" pkt-tag--gray"}>${this.tagText}</span>`:t.E}
|
|
3
|
+
${this.optionalTag?t.x`<span class=${s+" pkt-tag--blue-light"}>${this.optionalText}</span>`:t.E}
|
|
4
|
+
${this.requiredTag?t.x`<span class=${s+" pkt-tag--beige"}>${this.requiredText}</span>`:t.E}
|
|
5
|
+
`,l=()=>t.x`
|
|
6
|
+
<label class=${h} for=${this.id+"-internal"}>
|
|
7
|
+
${this.label} ${a()}
|
|
8
|
+
${this.checkHelptext?t.x`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:t.E}
|
|
9
|
+
</label>
|
|
10
|
+
`;return t.x`
|
|
11
|
+
<div class="pkt-input-check">
|
|
12
|
+
<div class=${e}>
|
|
13
|
+
${this.labelPosition==="left"?l():t.E}
|
|
14
|
+
<input
|
|
15
|
+
id=${this.id+"-internal"}
|
|
16
|
+
class=${c}
|
|
17
|
+
type="checkbox"
|
|
18
|
+
?disabled=${this.disabled}
|
|
19
|
+
name=${this.name+"-internal"}
|
|
20
|
+
${n.n(this.inputRef)}
|
|
21
|
+
@change=${this.toggleChecked}
|
|
22
|
+
@blur=${this.onBlur}
|
|
23
|
+
@focus=${this.onFocus}
|
|
24
|
+
?checked=${this.checked}
|
|
25
|
+
role=${this.isSwitch?"switch":"checkbox"}
|
|
26
|
+
/>
|
|
27
|
+
${this.labelPosition==="right"?l():t.E}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
`}toggleChecked(e){e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this.checked=this.inputRef.value.matches(":checked"),this.valueChecked(this.checked))}};i([t.n({type:String,reflect:!0})],exports.PktCheckbox.prototype,"value",2);i([t.n({type:String})],exports.PktCheckbox.prototype,"checkHelptext",2);i([t.n({type:Boolean})],exports.PktCheckbox.prototype,"defaultChecked",2);i([t.n({type:Boolean})],exports.PktCheckbox.prototype,"hasTile",2);i([t.n({type:Boolean})],exports.PktCheckbox.prototype,"isSwitch",2);i([t.n({type:String})],exports.PktCheckbox.prototype,"labelPosition",2);i([t.n({type:Boolean})],exports.PktCheckbox.prototype,"hideLabel",2);i([t.n({type:Boolean,reflect:!0})],exports.PktCheckbox.prototype,"checked",2);i([t.n({type:String,reflect:!0})],exports.PktCheckbox.prototype,"type",2);i([t.n({type:String})],exports.PktCheckbox.prototype,"tagText",2);i([t.n({type:Boolean})],exports.PktCheckbox.prototype,"optionalTag",2);i([t.n({type:String})],exports.PktCheckbox.prototype,"optionalText",2);i([t.n({type:Boolean})],exports.PktCheckbox.prototype,"requiredTag",2);i([t.n({type:String})],exports.PktCheckbox.prototype,"requiredText",2);exports.PktCheckbox=i([t.t("pkt-checkbox")],exports.PktCheckbox);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const a=require("./element-6DBpyGQm.cjs"),c=require("./if-defined-Cni-RHLS.cjs"),d=require("./state-DPobt-Yz.cjs"),r=require("./ref-iJtiv3o2.cjs"),O=require("./class-map-BBG2gMX4.cjs")
|
|
1
|
+
"use strict";const a=require("./element-6DBpyGQm.cjs"),c=require("./if-defined-Cni-RHLS.cjs"),d=require("./state-DPobt-Yz.cjs"),r=require("./ref-iJtiv3o2.cjs"),O=require("./class-map-BBG2gMX4.cjs"),$=require("./repeat-CDsZqct8.cjs"),I=require("./input-element-C4xJoM-X.cjs"),y=require("./pkt-options-controller-CiuBG6Lt.cjs"),w=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-CZ-a00V7.cjs");require("./icon-B_ryAy4Q.cjs");require("./tag-DPk3fpEg.cjs");require("./listbox-C4supLfR.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 I.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}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
.optionalText=${this.optionalText}
|
|
14
14
|
?requiredTag=${this.requiredTag}
|
|
15
15
|
.requiredText=${this.requiredText}
|
|
16
|
+
.tagText=${this.tagText}
|
|
16
17
|
?useWrapper=${this.useWrapper}
|
|
17
18
|
.forId=${this.allowUserInput||this.typeahead?this.id+"-input":this.id+"-arrow"}
|
|
18
19
|
class="pkt-combobox__wrapper"
|
|
@@ -104,7 +105,7 @@
|
|
|
104
105
|
.value=${this._value.join(",")}
|
|
105
106
|
${r.n(this.inputRef)}
|
|
106
107
|
/>
|
|
107
|
-
`}renderSingleOrMultipleValues(){const e=!this.multiple,t=this._editingSingleValue?null:this.renderValueTag(this.findValueInOptions(this._value[0])),i
|
|
108
|
+
`}renderSingleOrMultipleValues(){const e=!this.multiple,t=this._editingSingleValue?null:this.renderValueTag(this.findValueInOptions(this._value[0])),i=$.c(this._value,s=>s,s=>{var h;const l=this.findValueInOptions(s),n=(h=this.options.find(u=>u.value===s))==null?void 0:h.tagSkinColor;return a.x`
|
|
108
109
|
<pkt-tag
|
|
109
110
|
skin=${n||"blue-dark"}
|
|
110
111
|
?closeTag=${!this.disabled}
|
|
@@ -4,10 +4,10 @@ import { r as c } from "./state-Bo2bck5_.js";
|
|
|
4
4
|
import { e as _, n as v } from "./ref-BBYSqgeW.js";
|
|
5
5
|
import { e as w } from "./class-map-BpTj9gtz.js";
|
|
6
6
|
import { c as R } from "./repeat-C8BeHwYx.js";
|
|
7
|
-
import { P as V } from "./input-element-
|
|
7
|
+
import { P as V } from "./input-element-NnrDmp4r.js";
|
|
8
8
|
import { P as S } from "./pkt-options-controller-CZO1nxZ8.js";
|
|
9
9
|
import { P as C } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
10
|
-
import "./input-wrapper-
|
|
10
|
+
import "./input-wrapper-Dr__Sxql.js";
|
|
11
11
|
import "./icon-CC1js8eR.js";
|
|
12
12
|
import "./tag-BWm6s48d.js";
|
|
13
13
|
import "./listbox-CLsSW32I.js";
|
|
@@ -95,6 +95,7 @@ let h = class extends V {
|
|
|
95
95
|
.optionalText=${this.optionalText}
|
|
96
96
|
?requiredTag=${this.requiredTag}
|
|
97
97
|
.requiredText=${this.requiredText}
|
|
98
|
+
.tagText=${this.tagText}
|
|
98
99
|
?useWrapper=${this.useWrapper}
|
|
99
100
|
.forId=${this.allowUserInput || this.typeahead ? this.id + "-input" : this.id + "-arrow"}
|
|
100
101
|
class="pkt-combobox__wrapper"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const d=require("./class-map-BBG2gMX4.cjs"),p=require("./if-defined-Cni-RHLS.cjs"),s=require("./element-6DBpyGQm.cjs"),m=require("./state-DPobt-Yz.cjs"),h=require("./calendar-BZe2D4Sr.cjs"),k=require("./input-element-
|
|
1
|
+
"use strict";const d=require("./class-map-BBG2gMX4.cjs"),p=require("./if-defined-Cni-RHLS.cjs"),s=require("./element-6DBpyGQm.cjs"),m=require("./state-DPobt-Yz.cjs"),h=require("./calendar-BZe2D4Sr.cjs"),k=require("./input-element-C4xJoM-X.cjs"),r=require("./ref-iJtiv3o2.cjs"),v=require("./repeat-CDsZqct8.cjs");require("./icon-B_ryAy4Q.cjs");require("./input-wrapper-CZ-a00V7.cjs");require("./tag-DPk3fpEg.cjs");const $=require("./pkt-slot-controller-BzddBp7z.cjs"),y={dateformat:{default:"dd.MM.yyyy"},min:{default:null},max:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},o={props:y};var b=Object.defineProperty,x=Object.getOwnPropertyDescriptor,l=(c,t,e,i)=>{for(var a=i>1?void 0:i?x(t,e):t,n=c.length-1,u;n>=0;n--)(u=c[n])&&(a=(i?u(t,e,a):u(a))||a);return i&&a&&b(t,e,a),a};const g=c=>new Promise(t=>setTimeout(t,c));exports.PktDatepicker=class extends k.PktInputElement{constructor(){super(),this.value="",this._value=this.value?Array.isArray(this.value)?this.value:this.value.split(","):[],this.label="Datovelger",this.dateformat=o.props.dateformat.default,this.multiple=o.props.multiple.default,this.maxlength=null,this.range=o.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=o.props.weeknumbers.default,this.withcontrols=o.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.buttonClasses={},this.inputRef=r.e(),this.inputRefTo=r.e(),this.btnRef=r.e(),this.calRef=r.e(),this.popupRef=r.e(),this.helptextSlot=r.e(),this.addToSelected=t=>{const e=t.target;if(!e.value)return;const i=this.min?h.newDate(this.min):null,a=this.max?h.newDate(this.max):null,n=h.newDate(e.value.split(",")[0]);n&&!isNaN(n.getTime())&&(!i||n>=i)&&(!a||n<=a)&&this.calRef.value&&this.calRef.value.handleDateSelect(n),e.value=""},this.slotController=new $.PktSlotController(this,this.helptextSlot)}async connectedCallback(){super.connectedCallback();const t=navigator.userAgent,e=/iP(hone|od|ad)/.test(t);this.inputType=e?"text":"date",document&&document.body.addEventListener("click",i=>{var a,n;(a=this.inputRef)!=null&&a.value&&((n=this.btnRef)!=null&&n.value)&&!this.inputRef.value.contains(i.target)&&!(this.inputRefTo.value&&this.inputRefTo.value.contains(i.target))&&!this.btnRef.value.contains(i.target)&&!i.target.closest(".pkt-calendar-popup")&&this.calendarOpen&&(this.onBlur(),this.hideCalendar())}),this.value.length&&this._value.length===0&&(this._value=Array.isArray(this.value)?this.value:this.value.split(",")),this.min=this.min||o.props.min.default,this.max=this.max||o.props.max.default,typeof this.excludedates=="string"&&(this.excludedates=this.excludedates.split(",")),typeof this.excludeweekdays=="string"&&(this.excludeweekdays=this.excludeweekdays.split(",")),(this.multiple||this.range)&&this.name&&!this.name.endsWith("[]")&&(this.name=this.name+"[]"),this.calendarOpen&&(await g(20),this.handleCalendarPosition())}disconnectedCallback(){super.disconnectedCallback(),document&&document.body.removeEventListener("click",t=>{var e,i;(e=this.inputRef)!=null&&e.value&&((i=this.btnRef)!=null&&i.value)&&!this.inputRef.value.contains(t.target)&&!this.btnRef.value.contains(t.target)&&this.hideCalendar()})}attributeChangedCallback(t,e,i){if(t==="value"){if(this.range&&(i==null?void 0:i.split(",").length)===1)return;this.value!==e&&this.valueChanged(i,e)}t==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=(i==null?void 0:i.split(","))??[]),t==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=(i==null?void 0:i.split(","))??[]),super.attributeChangedCallback(t,e,i)}updated(t){if(t.has("value")){if(this.range&&this.value.length===1)return;this.valueChanged(this.value,t.get("value"))}super.updated(t)}renderInput(){return s.x`
|
|
2
2
|
<input
|
|
3
3
|
class="${d.e(this.inputClasses)}"
|
|
4
4
|
.type=${this.inputType}
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
?useWrapper=${this.useWrapper}
|
|
123
123
|
.optionalText=${this.optionalText}
|
|
124
124
|
.requiredText=${this.requiredText}
|
|
125
|
+
.tagText=${this.tagText}
|
|
125
126
|
.errorMessage=${this.errorMessage}
|
|
126
127
|
.helptext=${this.helptext}
|
|
127
128
|
.helptextDropdown=${this.helptextDropdown}
|
|
@@ -3,11 +3,11 @@ import { o } from "./if-defined-CmuO4Vz9.js";
|
|
|
3
3
|
import { x as u, E as g, n as r, a as w } from "./element-CgEWt74-.js";
|
|
4
4
|
import { r as k } from "./state-Bo2bck5_.js";
|
|
5
5
|
import { n as v, f as $, a as R, b as y, d as x } from "./calendar-DevQhOup.js";
|
|
6
|
-
import { P as C } from "./input-element-
|
|
6
|
+
import { P as C } from "./input-element-NnrDmp4r.js";
|
|
7
7
|
import { e as m, n as p } from "./ref-BBYSqgeW.js";
|
|
8
8
|
import { c as T } from "./repeat-C8BeHwYx.js";
|
|
9
9
|
import "./icon-CC1js8eR.js";
|
|
10
|
-
import "./input-wrapper-
|
|
10
|
+
import "./input-wrapper-Dr__Sxql.js";
|
|
11
11
|
import "./tag-BWm6s48d.js";
|
|
12
12
|
import { P as _ } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
13
13
|
const S = {
|
|
@@ -342,6 +342,7 @@ let l = class extends C {
|
|
|
342
342
|
?useWrapper=${this.useWrapper}
|
|
343
343
|
.optionalText=${this.optionalText}
|
|
344
344
|
.requiredText=${this.requiredText}
|
|
345
|
+
.tagText=${this.tagText}
|
|
345
346
|
.errorMessage=${this.errorMessage}
|
|
346
347
|
.helptext=${this.helptext}
|
|
347
348
|
.helptextDropdown=${this.helptextDropdown}
|
package/dist/index.d.ts
CHANGED
|
@@ -171,6 +171,7 @@ export declare interface IPktCombobox {
|
|
|
171
171
|
requiredText?: string;
|
|
172
172
|
searchPlaceholder?: string;
|
|
173
173
|
tagPlacement?: TPktComboboxTagPlacement | null;
|
|
174
|
+
tagText?: string | null;
|
|
174
175
|
value?: string | string[];
|
|
175
176
|
}
|
|
176
177
|
|
|
@@ -509,6 +510,11 @@ export declare class PktCheckbox extends PktInputElement {
|
|
|
509
510
|
hideLabel: boolean;
|
|
510
511
|
checked: boolean | string | null;
|
|
511
512
|
type: string;
|
|
513
|
+
tagText: string | null;
|
|
514
|
+
optionalTag: boolean;
|
|
515
|
+
optionalText: string;
|
|
516
|
+
requiredTag: boolean;
|
|
517
|
+
requiredText: string;
|
|
512
518
|
connectedCallback(): void;
|
|
513
519
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
514
520
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
@@ -789,6 +795,7 @@ declare class PktInputElement<T = {}> extends PktElement<Props_2 & T> {
|
|
|
789
795
|
label: string | null;
|
|
790
796
|
optionalText: string;
|
|
791
797
|
requiredText: string;
|
|
798
|
+
tagText: string | null;
|
|
792
799
|
dataTestid: string;
|
|
793
800
|
touched: boolean;
|
|
794
801
|
constructor();
|
|
@@ -827,6 +834,7 @@ export declare class PktInputWrapper extends PktElement<Props_4> {
|
|
|
827
834
|
optionalText: string;
|
|
828
835
|
requiredTag: boolean;
|
|
829
836
|
requiredText: string;
|
|
837
|
+
tagText: string | null;
|
|
830
838
|
hasError: boolean;
|
|
831
839
|
errorMessage: string;
|
|
832
840
|
disabled: boolean;
|
|
@@ -1006,6 +1014,11 @@ declare class PktRadioButton extends PktInputElement {
|
|
|
1006
1014
|
hasTile: boolean;
|
|
1007
1015
|
checked: boolean | string | null;
|
|
1008
1016
|
type: string;
|
|
1017
|
+
tagText: string | null;
|
|
1018
|
+
optionalTag: boolean;
|
|
1019
|
+
optionalText: string;
|
|
1020
|
+
requiredTag: boolean;
|
|
1021
|
+
requiredText: string;
|
|
1009
1022
|
_checked: boolean;
|
|
1010
1023
|
connectedCallback(): void;
|
|
1011
1024
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
@@ -1152,7 +1165,7 @@ declare type Props_2 = ElementProps<PktInputElement, 'defaultValue' | 'disabled'
|
|
|
1152
1165
|
|
|
1153
1166
|
declare type Props_3 = ElementProps<PktIcon, 'path' | 'name'>;
|
|
1154
1167
|
|
|
1155
|
-
declare type Props_4 = ElementProps<PktInputWrapper, 'forId' | 'label' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'counter' | 'counterCurrent' | 'counterMaxLength' | 'optionalTag' | 'optionalText' | 'requiredTag' | 'requiredText' | 'hasError' | 'errorMessage' | 'disabled' | 'inline' | 'ariaDescribedby' | 'hasFieldset' | 'useWrapper' | 'role'>;
|
|
1168
|
+
declare type Props_4 = ElementProps<PktInputWrapper, 'forId' | 'label' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'counter' | 'counterCurrent' | 'counterMaxLength' | 'optionalTag' | 'optionalText' | 'requiredTag' | 'requiredText' | 'tagText' | 'hasError' | 'errorMessage' | 'disabled' | 'inline' | 'ariaDescribedby' | 'hasFieldset' | 'useWrapper' | 'role'>;
|
|
1156
1169
|
|
|
1157
1170
|
declare type Props_5 = ElementProps<PktTextinput, 'value' | 'type' | 'size' | 'autocomplete' | 'iconNameRight' | 'prefix' | 'suffix' | 'omitSearchIcon'>;
|
|
1158
1171
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const r=require("./element-6DBpyGQm.cjs"),Mt=require("./state-DPobt-Yz.cjs"),kt=require("./stringutils-CkVRq4jP.cjs"),Vt=require("./input-wrapper-EoSAbU-U.cjs");(function(){(function(E){const s=new WeakMap,h=new WeakMap,p=new WeakMap,u=new WeakMap,y=new WeakMap,k=new WeakMap,F=new WeakMap,g=new WeakMap,C=new WeakMap,V=new WeakMap,S=new WeakMap,T=new WeakMap,$=new WeakMap,U=new WeakMap,I=new WeakMap,x={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDescription:"aria-description",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},nt=(e,t)=>{for(let i in x){t[i]=null;let a=null;const n=x[i];Object.defineProperty(t,i,{get(){return a},set(o){a=o,e.isConnected?M(e,n,o):V.set(e,t)}})}};function z(e){const t=u.get(e),{form:i}=t;X(e,i,t),Q(e,t.labels)}const K=(e,t=!1)=>{const i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(o){return u.has(o)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let a=i.nextNode();const n=!t||e.disabled;for(;a;)a.formDisabledCallback&&n&&W(a,e.disabled),a=i.nextNode()},j={attributes:!0,attributeFilter:["disabled","name"]},L=O()?new MutationObserver(e=>{for(const t of e){const i=t.target;if(t.attributeName==="disabled"&&(i.constructor.formAssociated?W(i,i.hasAttribute("disabled")):i.localName==="fieldset"&&K(i)),t.attributeName==="name"&&i.constructor.formAssociated){const a=u.get(i),n=C.get(i);a.setFormValue(n)}}}):{};function D(e){e.forEach(t=>{const{addedNodes:i,removedNodes:a}=t,n=Array.from(i),o=Array.from(a);n.forEach(l=>{var m;if(u.has(l)&&l.constructor.formAssociated&&z(l),V.has(l)){const f=V.get(l);Object.keys(x).filter(b=>f[b]!==null).forEach(b=>{M(l,x[b],f[b])}),V.delete(l)}if(I.has(l)){const f=I.get(l);M(l,"internals-valid",f.validity.valid.toString()),M(l,"internals-invalid",(!f.validity.valid).toString()),M(l,"aria-invalid",(!f.validity.valid).toString()),I.delete(l)}if(l.localName==="form"){const f=g.get(l),w=document.createTreeWalker(l,NodeFilter.SHOW_ELEMENT,{acceptNode(q){return u.has(q)&&q.constructor.formAssociated&&!(f&&f.has(q))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let b=w.nextNode();for(;b;)z(b),b=w.nextNode()}l.localName==="fieldset"&&((m=L.observe)===null||m===void 0||m.call(L,l,j),K(l,!0))}),o.forEach(l=>{const m=u.get(l);m&&p.get(m)&&G(m),F.has(l)&&F.get(l).disconnect()})})}function ot(e){e.forEach(t=>{const{removedNodes:i}=t;i.forEach(a=>{const n=$.get(t.target);u.has(a)&&Z(a),n.disconnect()})})}const lt=e=>{var t,i;const a=new MutationObserver(ot);!((t=window==null?void 0:window.ShadyDOM)===null||t===void 0)&&t.inUse&&e.mode&&e.host&&(e=e.host),(i=a.observe)===null||i===void 0||i.call(a,e,{childList:!0}),$.set(e,a)};O()&&new MutationObserver(D);const P={childList:!0,subtree:!0},M=(e,t,i)=>{e.getAttribute(t)!==i&&e.setAttribute(t,i)},W=(e,t)=>{e.toggleAttribute("internals-disabled",t),t?M(e,"aria-disabled","true"):e.removeAttribute("aria-disabled"),e.formDisabledCallback&&e.formDisabledCallback.apply(e,[t])},G=e=>{p.get(e).forEach(i=>{i.remove()}),p.set(e,[])},J=(e,t)=>{const i=document.createElement("input");return i.type="hidden",i.name=e.getAttribute("name"),e.after(i),p.get(t).push(i),i},ct=(e,t)=>{var i;p.set(t,[]),(i=L.observe)===null||i===void 0||i.call(L,e,j)},Q=(e,t)=>{if(t.length){Array.from(t).forEach(a=>a.addEventListener("click",e.click.bind(e)));let i=t[0].id;t[0].id||(i=`${t[0].htmlFor}_Label`,t[0].id=i),M(e,"aria-labelledby",i)}},N=e=>{const t=Array.from(e.elements).filter(o=>!o.tagName.includes("-")&&o.validity).map(o=>o.validity.valid),i=g.get(e)||[],a=Array.from(i).filter(o=>o.isConnected).map(o=>u.get(o).validity.valid),n=[...t,...a].includes(!1);e.toggleAttribute("internals-invalid",n),e.toggleAttribute("internals-valid",!n)},dt=e=>{N(R(e.target))},ht=e=>{N(R(e.target))},ut=e=>{const t=["button[type=submit]","input[type=submit]","button:not([type])"].map(i=>`${i}:not([disabled])`).map(i=>`${i}:not([form])${e.id?`,${i}[form='${e.id}']`:""}`).join(",");e.addEventListener("click",i=>{if(i.target.closest(t)){const n=g.get(e);if(e.noValidate)return;n.size&&Array.from(n).reverse().map(m=>u.get(m).reportValidity()).includes(!1)&&i.preventDefault()}})},ft=e=>{const t=g.get(e.target);t&&t.size&&t.forEach(i=>{i.constructor.formAssociated&&i.formResetCallback&&i.formResetCallback.apply(i)})},X=(e,t,i)=>{if(t){const a=g.get(t);if(a)a.add(e);else{const n=new Set;n.add(e),g.set(t,n),ut(t),t.addEventListener("reset",ft),t.addEventListener("input",dt),t.addEventListener("change",ht)}k.set(t,{ref:e,internals:i}),e.constructor.formAssociated&&e.formAssociatedCallback&&setTimeout(()=>{e.formAssociatedCallback.apply(e,[t])},0),N(t)}},R=e=>{let t=e.parentNode;return t&&t.tagName!=="FORM"&&(t=R(t)),t},v=(e,t,i=DOMException)=>{if(!e.constructor.formAssociated)throw new i(t)},Y=(e,t,i)=>{const a=g.get(e);return a&&a.size&&a.forEach(n=>{u.get(n)[i]()||(t=!1)}),t},Z=e=>{if(e.constructor.formAssociated){const t=u.get(e),{labels:i,form:a}=t;Q(e,i),X(e,a,t)}};function O(){return typeof MutationObserver<"u"}class pt{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}const mt=e=>(e.badInput=!1,e.customError=!1,e.patternMismatch=!1,e.rangeOverflow=!1,e.rangeUnderflow=!1,e.stepMismatch=!1,e.tooLong=!1,e.tooShort=!1,e.typeMismatch=!1,e.valid=!0,e.valueMissing=!1,e),yt=(e,t,i)=>(e.valid=gt(t),Object.keys(t).forEach(a=>e[a]=t[a]),i&&N(i),e),gt=e=>{let t=!0;for(let i in e)i!=="valid"&&e[i]!==!1&&(t=!1);return t},H=new WeakMap;function tt(e,t){e.toggleAttribute(t,!0),e.part&&e.part.add(t)}class B extends Set{static get isPolyfilled(){return!0}constructor(t){if(super(),!t||!t.tagName||t.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");H.set(this,t)}add(t){if(!/^--/.test(t)||typeof t!="string")throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`);const i=super.add(t),a=H.get(this),n=`state${t}`;return a.isConnected?tt(a,n):setTimeout(()=>{tt(a,n)}),i}clear(){for(let[t]of this.entries())this.delete(t);super.clear()}delete(t){const i=super.delete(t),a=H.get(this);return a.isConnected?(a.toggleAttribute(`state${t}`,!1),a.part&&a.part.remove(`state${t}`)):setTimeout(()=>{a.toggleAttribute(`state${t}`,!1),a.part&&a.part.remove(`state${t}`)}),i}}function et(e,t,i,a){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(e):a?a.value:t.get(e)}function bt(e,t,i,a,n){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,i),i}var A;class vt{constructor(t){A.set(this,void 0),bt(this,A,t);for(let i=0;i<t.length;i++){let a=t[i];this[i]=a,a.hasAttribute("name")&&(this[a.getAttribute("name")]=a)}Object.freeze(this)}get length(){return et(this,A,"f").length}[(A=new WeakMap,Symbol.iterator)](){return et(this,A,"f")[Symbol.iterator]()}item(t){return this[t]==null?null:this[t]}namedItem(t){return this[t]==null?null:this[t]}}function wt(){const e=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=i;const t=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=a;function i(...o){let l=e.apply(this,o);return Y(this,l,"checkValidity")}function a(...o){let l=t.apply(this,o);return Y(this,l,"reportValidity")}const{get:n}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...o){const l=n.call(this,...o),m=Array.from(g.get(this)||[]);if(m.length===0)return l;const f=Array.from(l).concat(m).sort((w,b)=>w.compareDocumentPosition?w.compareDocumentPosition(b)&2?1:-1:0);return new vt(f)}})}class it{static get isPolyfilled(){return!0}constructor(t){if(!t||!t.tagName||t.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");const i=t.getRootNode(),a=new pt;this.states=new B(t),s.set(this,t),h.set(this,a),u.set(t,this),nt(t,this),ct(t,this),Object.seal(this),i instanceof DocumentFragment&<(i)}checkValidity(){const t=s.get(this);if(v(t,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=h.get(this);if(!i.valid){const a=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});t.dispatchEvent(a)}return i.valid}get form(){const t=s.get(this);v(t,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let i;return t.constructor.formAssociated===!0&&(i=R(t)),i}get labels(){const t=s.get(this);v(t,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const i=t.getAttribute("id"),a=t.getRootNode();return a&&i?a.querySelectorAll(`[for="${i}"]`):[]}reportValidity(){const t=s.get(this);if(v(t,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=this.checkValidity(),a=T.get(this);if(a&&!t.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!i&&a&&(t.focus(),a.focus()),i}setFormValue(t){const i=s.get(this);if(v(i,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),G(this),t!=null&&!(t instanceof FormData)){if(i.getAttribute("name")){const a=J(i,this);a.value=t}}else t!=null&&t instanceof FormData&&Array.from(t).reverse().forEach(([a,n])=>{if(typeof n=="string"){const o=J(i,this);o.name=a,o.value=n}});C.set(i,t)}setValidity(t,i,a){const n=s.get(this);if(v(n,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!t)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");T.set(this,a);const o=h.get(this),l={};for(const w in t)l[w]=t[w];Object.keys(l).length===0&&mt(o);const m=Object.assign(Object.assign({},o),l);delete m.valid;const{valid:f}=yt(o,m,this.form);if(!f&&!i)throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");y.set(this,f?"":i),n.isConnected?(n.toggleAttribute("internals-invalid",!f),n.toggleAttribute("internals-valid",f),M(n,"aria-invalid",`${!f}`)):I.set(n,this)}get shadowRoot(){const t=s.get(this),i=S.get(t);return i||null}get validationMessage(){const t=s.get(this);return v(t,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),y.get(this)}get validity(){const t=s.get(this);return v(t,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),h.get(this)}get willValidate(){const t=s.get(this);return v(t,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(t.disabled||t.hasAttribute("disabled")||t.hasAttribute("readonly"))}}function Et(){if(typeof window>"u"||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class e extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const t=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(t,e);const i=new e;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(a=>a in i.internals)}let at=!1,st=!1;function _(e){st||(st=!0,window.CustomStateSet=B,e&&(HTMLElement.prototype.attachInternals=function(...t){const i=e.call(this,t);return i.states=new B(this),i}))}function rt(e=!0){if(!at){if(at=!0,typeof window<"u"&&(window.ElementInternals=it),typeof CustomElementRegistry<"u"){const t=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(i,a,n){if(a.formAssociated){const o=a.prototype.connectedCallback;a.prototype.connectedCallback=function(){U.has(this)||(U.set(this,!0),this.hasAttribute("disabled")&&W(this,!0)),o!=null&&o.apply(this),Z(this)}}t.call(this,i,a,n)}}if(typeof HTMLElement<"u"&&(HTMLElement.prototype.attachInternals=function(){if(this.tagName){if(this.tagName.indexOf("-")===-1)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.")}else return{};if(u.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new it(this)}),typeof Element<"u"){let t=function(...a){const n=i.apply(this,a);if(S.set(this,n),O()){const o=new MutationObserver(D);window.ShadyDOM?o.observe(this,P):o.observe(n,P),F.set(this,o)}return n};const i=Element.prototype.attachShadow;Element.prototype.attachShadow=t}O()&&typeof document<"u"&&new MutationObserver(D).observe(document.documentElement,P),typeof HTMLFormElement<"u"&&wt(),(e||typeof window<"u"&&!window.CustomStateSet)&&_()}}return!!customElements.polyfillWrapFlushCallback||(Et()?typeof window<"u"&&!window.CustomStateSet&&_(HTMLElement.prototype.attachInternals):rt(!1)),E.forceCustomStateSetPolyfill=_,E.forceElementInternalsPolyfill=rt,Object.defineProperty(E,"__esModule",{value:!0}),E})({})})();var Ft=Object.defineProperty,d=(E,s,h,p)=>{for(var u=void 0,y=E.length-1,k;y>=0;y--)(k=E[y])&&(u=k(s,h,u)||u);return u&&Ft(s,h,u),u};class c extends r.PktElement{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=kt.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Vt.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=r.translations.forms.labels.optional,this.requiredText=r.translations.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(s){var h,p,u,y,k,F,g,C,V,S,T;s&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},r.translations.forms.messages.required,s):(h=s.validity)!=null&&h.typeMismatch||(p=s.validity)!=null&&p.badInput?this.internals.setValidity({typeMismatch:!0},r.translations.forms.messages.invalid,s):(u=s.validity)!=null&&u.patternMismatch?this.internals.setValidity({patternMismatch:!0},r.translations.forms.messages.invalidPattern,s):(y=s.validity)!=null&&y.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},r.translations.forms.messages.tooShort,s):(k=s.validity)!=null&&k.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},r.translations.forms.messages.tooLong,s):(F=s.validity)!=null&&F.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?r.translations.forms.messages.rangeUnderflowMin.replace("{min}",(g=this.min)==null?void 0:g.toString()):r.translations.forms.messages.rangeUnderflow,s):(C=s.validity)!=null&&C.stepMismatch?this.internals.setValidity({stepMismatch:!0},r.translations.forms.messages.invalid,s):(V=s.validity)!=null&&V.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?r.translations.forms.messages.rangeOverflowMax.replace("{max}",(S=this.max)==null?void 0:S.toString()):r.translations.forms.messages.rangeOverflow,s):(T=s.validity)!=null&&T.customError?this.internals.setValidity({customError:!0},s.validationMessage,s):this.internals.setValidity({}))}setFormValue(s){if(this.internals)if(Array.isArray(s)){const h=new FormData;s.forEach(p=>{h.append(this.name,p)}),this.internals.setFormValue(h)}else this.internals.setFormValue(s)}valueChecked(s){if(!this.touched)return;const h=this.internals.form||this.closest("form"),p=h?new FormData(h):null;h&&h.querySelectorAll(`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`).forEach(u=>{const y=u;y.name===this.name&&y.value!==this.value&&y.checked&&(y.checked=!1)}),typeof s=="string"?(this.checked=s==="true",this.internals.ariaChecked=s==="true"):typeof s=="boolean"&&(this.checked=s,this.internals.ariaChecked=s),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),p&&p.append(this.name,this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue(null,null),p&&p.delete(this.name),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(s,h){(h!==this.value||h!==this._value)&&(typeof s=="string"?((this.multiple||this.range)&&s.includes(",")&&(s=s.split(",")),this.value=s,this._value=Array.isArray(s)?s:[s]):Array.isArray(s)?(this.value=this.multiple||this.range?s:s[0],this._value=s):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&h&&h.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(h==null?void 0:h.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const s=this.multiple||this.range?[]:"";this.value=s,this.internals.setFormValue(s),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:s,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}onChange(s){if(!this.touched){this.touched=!0,s&&this.setFormValue(s);return}typeof s!="string"&&!Array.isArray(s)||((this.range||this.multiple)&&!Array.isArray(s)&&s.includes(",")&&(s=s.split(",")),!this.multiple&&!this.range&&Array.isArray(s)&&(s=s[0]),this.setFormValue(s),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:s,bubbles:!0,composed:!0})))}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(s=>{s.selected=!1}),this.checked!==void 0?(this.checked=!1,this.internals.ariaChecked=!1,this.internals.setFormValue("",""),this.inputRef.value.checked=!1,this.valueChecked(this.checked)):(this.internals.setFormValue(""),this.value=this.defaultValue||(this.multiple||this.range?[]:""),this._value=this.value,this.valueChanged(this.value,null)),this.internals.ariaInvalid=!1}updated(s){super.updated(s),s.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(s){if(super.firstUpdated(s),!this.form){const h=this.internals.form||this.closest("form");this.form=h}if(this.value&&this.defaultValue!==null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=!0,this.checked=!0),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const h=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=h,this.internals.setFormValue(h?this.value||"on":"",h?this.value||"on":"")}else this.internals.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}}d([r.n()],c.prototype,"defaultValue");d([r.n({type:Boolean,reflect:!0})],c.prototype,"disabled");d([r.n({type:Boolean,reflect:!0})],c.prototype,"readonly");d([r.n({type:Boolean,reflect:!0})],c.prototype,"required");d([r.n({type:Number,reflect:!0})],c.prototype,"max");d([r.n({type:Number,reflect:!0})],c.prototype,"maxlength");d([r.n({type:Number,reflect:!0})],c.prototype,"min");d([r.n({type:Number,reflect:!0})],c.prototype,"minlength");d([r.n({type:Number,reflect:!0})],c.prototype,"step");d([r.n({type:String})],c.prototype,"ariaDescribedBy");d([r.n({type:String})],c.prototype,"ariaLabelledby");d([r.n({type:String,reflect:!0})],c.prototype,"name");d([r.n({type:String,reflect:!0})],c.prototype,"pattern");d([r.n({type:String,reflect:!0})],c.prototype,"placeholder");d([r.n({type:String,reflect:!0})],c.prototype,"id");d([r.n({type:Boolean})],c.prototype,"counter");d([r.n({type:Boolean})],c.prototype,"hasError");d([r.n({type:Boolean})],c.prototype,"inline");d([r.n({type:Boolean})],c.prototype,"hasFieldset");d([r.n({type:Boolean})],c.prototype,"optionalTag");d([r.n({type:Boolean})],c.prototype,"requiredTag");d([r.n({type:Boolean})],c.prototype,"skipForwardTestid");d([r.n({type:Boolean,reflect:!1})],c.prototype,"useWrapper");d([r.n({type:Boolean,reflect:!0})],c.prototype,"fullwidth");d([r.n({type:Number})],c.prototype,"counterMaxLength");d([r.n({type:String})],c.prototype,"errorMessage");d([r.n({type:String})],c.prototype,"helptext");d([r.n({type:String})],c.prototype,"helptextDropdown");d([r.n({type:String,reflect:!1})],c.prototype,"helptextDropdownButton");d([r.n({type:String})],c.prototype,"label");d([r.n({type:String,reflect:!1})],c.prototype,"optionalText");d([r.n({type:String,reflect:!1})],c.prototype,"requiredText");d([r.n({type:String,attribute:"data-testid"})],c.prototype,"dataTestid");d([Mt.r()],c.prototype,"touched");exports.PktInputElement=c;
|
|
1
|
+
"use strict";const r=require("./element-6DBpyGQm.cjs"),Mt=require("./state-DPobt-Yz.cjs"),kt=require("./stringutils-CkVRq4jP.cjs"),Vt=require("./input-wrapper-EoSAbU-U.cjs");(function(){(function(E){const s=new WeakMap,h=new WeakMap,p=new WeakMap,u=new WeakMap,y=new WeakMap,k=new WeakMap,F=new WeakMap,g=new WeakMap,C=new WeakMap,V=new WeakMap,T=new WeakMap,S=new WeakMap,$=new WeakMap,U=new WeakMap,x=new WeakMap,I={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDescription:"aria-description",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},nt=(e,t)=>{for(let i in I){t[i]=null;let a=null;const n=I[i];Object.defineProperty(t,i,{get(){return a},set(o){a=o,e.isConnected?M(e,n,o):V.set(e,t)}})}};function z(e){const t=u.get(e),{form:i}=t;X(e,i,t),Q(e,t.labels)}const K=(e,t=!1)=>{const i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(o){return u.has(o)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let a=i.nextNode();const n=!t||e.disabled;for(;a;)a.formDisabledCallback&&n&&W(a,e.disabled),a=i.nextNode()},j={attributes:!0,attributeFilter:["disabled","name"]},L=O()?new MutationObserver(e=>{for(const t of e){const i=t.target;if(t.attributeName==="disabled"&&(i.constructor.formAssociated?W(i,i.hasAttribute("disabled")):i.localName==="fieldset"&&K(i)),t.attributeName==="name"&&i.constructor.formAssociated){const a=u.get(i),n=C.get(i);a.setFormValue(n)}}}):{};function D(e){e.forEach(t=>{const{addedNodes:i,removedNodes:a}=t,n=Array.from(i),o=Array.from(a);n.forEach(l=>{var m;if(u.has(l)&&l.constructor.formAssociated&&z(l),V.has(l)){const f=V.get(l);Object.keys(I).filter(b=>f[b]!==null).forEach(b=>{M(l,I[b],f[b])}),V.delete(l)}if(x.has(l)){const f=x.get(l);M(l,"internals-valid",f.validity.valid.toString()),M(l,"internals-invalid",(!f.validity.valid).toString()),M(l,"aria-invalid",(!f.validity.valid).toString()),x.delete(l)}if(l.localName==="form"){const f=g.get(l),w=document.createTreeWalker(l,NodeFilter.SHOW_ELEMENT,{acceptNode(q){return u.has(q)&&q.constructor.formAssociated&&!(f&&f.has(q))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let b=w.nextNode();for(;b;)z(b),b=w.nextNode()}l.localName==="fieldset"&&((m=L.observe)===null||m===void 0||m.call(L,l,j),K(l,!0))}),o.forEach(l=>{const m=u.get(l);m&&p.get(m)&&G(m),F.has(l)&&F.get(l).disconnect()})})}function ot(e){e.forEach(t=>{const{removedNodes:i}=t;i.forEach(a=>{const n=$.get(t.target);u.has(a)&&Z(a),n.disconnect()})})}const lt=e=>{var t,i;const a=new MutationObserver(ot);!((t=window==null?void 0:window.ShadyDOM)===null||t===void 0)&&t.inUse&&e.mode&&e.host&&(e=e.host),(i=a.observe)===null||i===void 0||i.call(a,e,{childList:!0}),$.set(e,a)};O()&&new MutationObserver(D);const P={childList:!0,subtree:!0},M=(e,t,i)=>{e.getAttribute(t)!==i&&e.setAttribute(t,i)},W=(e,t)=>{e.toggleAttribute("internals-disabled",t),t?M(e,"aria-disabled","true"):e.removeAttribute("aria-disabled"),e.formDisabledCallback&&e.formDisabledCallback.apply(e,[t])},G=e=>{p.get(e).forEach(i=>{i.remove()}),p.set(e,[])},J=(e,t)=>{const i=document.createElement("input");return i.type="hidden",i.name=e.getAttribute("name"),e.after(i),p.get(t).push(i),i},ct=(e,t)=>{var i;p.set(t,[]),(i=L.observe)===null||i===void 0||i.call(L,e,j)},Q=(e,t)=>{if(t.length){Array.from(t).forEach(a=>a.addEventListener("click",e.click.bind(e)));let i=t[0].id;t[0].id||(i=`${t[0].htmlFor}_Label`,t[0].id=i),M(e,"aria-labelledby",i)}},N=e=>{const t=Array.from(e.elements).filter(o=>!o.tagName.includes("-")&&o.validity).map(o=>o.validity.valid),i=g.get(e)||[],a=Array.from(i).filter(o=>o.isConnected).map(o=>u.get(o).validity.valid),n=[...t,...a].includes(!1);e.toggleAttribute("internals-invalid",n),e.toggleAttribute("internals-valid",!n)},dt=e=>{N(R(e.target))},ht=e=>{N(R(e.target))},ut=e=>{const t=["button[type=submit]","input[type=submit]","button:not([type])"].map(i=>`${i}:not([disabled])`).map(i=>`${i}:not([form])${e.id?`,${i}[form='${e.id}']`:""}`).join(",");e.addEventListener("click",i=>{if(i.target.closest(t)){const n=g.get(e);if(e.noValidate)return;n.size&&Array.from(n).reverse().map(m=>u.get(m).reportValidity()).includes(!1)&&i.preventDefault()}})},ft=e=>{const t=g.get(e.target);t&&t.size&&t.forEach(i=>{i.constructor.formAssociated&&i.formResetCallback&&i.formResetCallback.apply(i)})},X=(e,t,i)=>{if(t){const a=g.get(t);if(a)a.add(e);else{const n=new Set;n.add(e),g.set(t,n),ut(t),t.addEventListener("reset",ft),t.addEventListener("input",dt),t.addEventListener("change",ht)}k.set(t,{ref:e,internals:i}),e.constructor.formAssociated&&e.formAssociatedCallback&&setTimeout(()=>{e.formAssociatedCallback.apply(e,[t])},0),N(t)}},R=e=>{let t=e.parentNode;return t&&t.tagName!=="FORM"&&(t=R(t)),t},v=(e,t,i=DOMException)=>{if(!e.constructor.formAssociated)throw new i(t)},Y=(e,t,i)=>{const a=g.get(e);return a&&a.size&&a.forEach(n=>{u.get(n)[i]()||(t=!1)}),t},Z=e=>{if(e.constructor.formAssociated){const t=u.get(e),{labels:i,form:a}=t;Q(e,i),X(e,a,t)}};function O(){return typeof MutationObserver<"u"}class pt{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}const mt=e=>(e.badInput=!1,e.customError=!1,e.patternMismatch=!1,e.rangeOverflow=!1,e.rangeUnderflow=!1,e.stepMismatch=!1,e.tooLong=!1,e.tooShort=!1,e.typeMismatch=!1,e.valid=!0,e.valueMissing=!1,e),yt=(e,t,i)=>(e.valid=gt(t),Object.keys(t).forEach(a=>e[a]=t[a]),i&&N(i),e),gt=e=>{let t=!0;for(let i in e)i!=="valid"&&e[i]!==!1&&(t=!1);return t},H=new WeakMap;function tt(e,t){e.toggleAttribute(t,!0),e.part&&e.part.add(t)}class B extends Set{static get isPolyfilled(){return!0}constructor(t){if(super(),!t||!t.tagName||t.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");H.set(this,t)}add(t){if(!/^--/.test(t)||typeof t!="string")throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`);const i=super.add(t),a=H.get(this),n=`state${t}`;return a.isConnected?tt(a,n):setTimeout(()=>{tt(a,n)}),i}clear(){for(let[t]of this.entries())this.delete(t);super.clear()}delete(t){const i=super.delete(t),a=H.get(this);return a.isConnected?(a.toggleAttribute(`state${t}`,!1),a.part&&a.part.remove(`state${t}`)):setTimeout(()=>{a.toggleAttribute(`state${t}`,!1),a.part&&a.part.remove(`state${t}`)}),i}}function et(e,t,i,a){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(e):a?a.value:t.get(e)}function bt(e,t,i,a,n){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,i),i}var A;class vt{constructor(t){A.set(this,void 0),bt(this,A,t);for(let i=0;i<t.length;i++){let a=t[i];this[i]=a,a.hasAttribute("name")&&(this[a.getAttribute("name")]=a)}Object.freeze(this)}get length(){return et(this,A,"f").length}[(A=new WeakMap,Symbol.iterator)](){return et(this,A,"f")[Symbol.iterator]()}item(t){return this[t]==null?null:this[t]}namedItem(t){return this[t]==null?null:this[t]}}function wt(){const e=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=i;const t=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=a;function i(...o){let l=e.apply(this,o);return Y(this,l,"checkValidity")}function a(...o){let l=t.apply(this,o);return Y(this,l,"reportValidity")}const{get:n}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...o){const l=n.call(this,...o),m=Array.from(g.get(this)||[]);if(m.length===0)return l;const f=Array.from(l).concat(m).sort((w,b)=>w.compareDocumentPosition?w.compareDocumentPosition(b)&2?1:-1:0);return new vt(f)}})}class it{static get isPolyfilled(){return!0}constructor(t){if(!t||!t.tagName||t.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");const i=t.getRootNode(),a=new pt;this.states=new B(t),s.set(this,t),h.set(this,a),u.set(t,this),nt(t,this),ct(t,this),Object.seal(this),i instanceof DocumentFragment&<(i)}checkValidity(){const t=s.get(this);if(v(t,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=h.get(this);if(!i.valid){const a=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});t.dispatchEvent(a)}return i.valid}get form(){const t=s.get(this);v(t,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let i;return t.constructor.formAssociated===!0&&(i=R(t)),i}get labels(){const t=s.get(this);v(t,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const i=t.getAttribute("id"),a=t.getRootNode();return a&&i?a.querySelectorAll(`[for="${i}"]`):[]}reportValidity(){const t=s.get(this);if(v(t,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=this.checkValidity(),a=S.get(this);if(a&&!t.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!i&&a&&(t.focus(),a.focus()),i}setFormValue(t){const i=s.get(this);if(v(i,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),G(this),t!=null&&!(t instanceof FormData)){if(i.getAttribute("name")){const a=J(i,this);a.value=t}}else t!=null&&t instanceof FormData&&Array.from(t).reverse().forEach(([a,n])=>{if(typeof n=="string"){const o=J(i,this);o.name=a,o.value=n}});C.set(i,t)}setValidity(t,i,a){const n=s.get(this);if(v(n,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!t)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");S.set(this,a);const o=h.get(this),l={};for(const w in t)l[w]=t[w];Object.keys(l).length===0&&mt(o);const m=Object.assign(Object.assign({},o),l);delete m.valid;const{valid:f}=yt(o,m,this.form);if(!f&&!i)throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");y.set(this,f?"":i),n.isConnected?(n.toggleAttribute("internals-invalid",!f),n.toggleAttribute("internals-valid",f),M(n,"aria-invalid",`${!f}`)):x.set(n,this)}get shadowRoot(){const t=s.get(this),i=T.get(t);return i||null}get validationMessage(){const t=s.get(this);return v(t,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),y.get(this)}get validity(){const t=s.get(this);return v(t,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),h.get(this)}get willValidate(){const t=s.get(this);return v(t,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(t.disabled||t.hasAttribute("disabled")||t.hasAttribute("readonly"))}}function Et(){if(typeof window>"u"||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class e extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const t=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(t,e);const i=new e;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(a=>a in i.internals)}let at=!1,st=!1;function _(e){st||(st=!0,window.CustomStateSet=B,e&&(HTMLElement.prototype.attachInternals=function(...t){const i=e.call(this,t);return i.states=new B(this),i}))}function rt(e=!0){if(!at){if(at=!0,typeof window<"u"&&(window.ElementInternals=it),typeof CustomElementRegistry<"u"){const t=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(i,a,n){if(a.formAssociated){const o=a.prototype.connectedCallback;a.prototype.connectedCallback=function(){U.has(this)||(U.set(this,!0),this.hasAttribute("disabled")&&W(this,!0)),o!=null&&o.apply(this),Z(this)}}t.call(this,i,a,n)}}if(typeof HTMLElement<"u"&&(HTMLElement.prototype.attachInternals=function(){if(this.tagName){if(this.tagName.indexOf("-")===-1)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.")}else return{};if(u.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new it(this)}),typeof Element<"u"){let t=function(...a){const n=i.apply(this,a);if(T.set(this,n),O()){const o=new MutationObserver(D);window.ShadyDOM?o.observe(this,P):o.observe(n,P),F.set(this,o)}return n};const i=Element.prototype.attachShadow;Element.prototype.attachShadow=t}O()&&typeof document<"u"&&new MutationObserver(D).observe(document.documentElement,P),typeof HTMLFormElement<"u"&&wt(),(e||typeof window<"u"&&!window.CustomStateSet)&&_()}}return!!customElements.polyfillWrapFlushCallback||(Et()?typeof window<"u"&&!window.CustomStateSet&&_(HTMLElement.prototype.attachInternals):rt(!1)),E.forceCustomStateSetPolyfill=_,E.forceElementInternalsPolyfill=rt,Object.defineProperty(E,"__esModule",{value:!0}),E})({})})();var Ft=Object.defineProperty,d=(E,s,h,p)=>{for(var u=void 0,y=E.length-1,k;y>=0;y--)(k=E[y])&&(u=k(s,h,u)||u);return u&&Ft(s,h,u),u};class c extends r.PktElement{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=kt.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Vt.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=r.translations.forms.labels.optional,this.requiredText=r.translations.forms.labels.required,this.tagText=null,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(s){var h,p,u,y,k,F,g,C,V,T,S;s&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},r.translations.forms.messages.required,s):(h=s.validity)!=null&&h.typeMismatch||(p=s.validity)!=null&&p.badInput?this.internals.setValidity({typeMismatch:!0},r.translations.forms.messages.invalid,s):(u=s.validity)!=null&&u.patternMismatch?this.internals.setValidity({patternMismatch:!0},r.translations.forms.messages.invalidPattern,s):(y=s.validity)!=null&&y.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},r.translations.forms.messages.tooShort,s):(k=s.validity)!=null&&k.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},r.translations.forms.messages.tooLong,s):(F=s.validity)!=null&&F.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?r.translations.forms.messages.rangeUnderflowMin.replace("{min}",(g=this.min)==null?void 0:g.toString()):r.translations.forms.messages.rangeUnderflow,s):(C=s.validity)!=null&&C.stepMismatch?this.internals.setValidity({stepMismatch:!0},r.translations.forms.messages.invalid,s):(V=s.validity)!=null&&V.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?r.translations.forms.messages.rangeOverflowMax.replace("{max}",(T=this.max)==null?void 0:T.toString()):r.translations.forms.messages.rangeOverflow,s):(S=s.validity)!=null&&S.customError?this.internals.setValidity({customError:!0},s.validationMessage,s):this.internals.setValidity({}))}setFormValue(s){if(this.internals)if(Array.isArray(s)){const h=new FormData;s.forEach(p=>{h.append(this.name,p)}),this.internals.setFormValue(h)}else this.internals.setFormValue(s)}valueChecked(s){if(!this.touched)return;const h=this.internals.form||this.closest("form"),p=h?new FormData(h):null;h&&h.querySelectorAll(`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`).forEach(u=>{const y=u;y.name===this.name&&y.value!==this.value&&y.checked&&(y.checked=!1)}),typeof s=="string"?(this.checked=s==="true",this.internals.ariaChecked=s==="true"):typeof s=="boolean"&&(this.checked=s,this.internals.ariaChecked=s),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),p&&p.append(this.name,this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue(null,null),p&&p.delete(this.name),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(s,h){(h!==this.value||h!==this._value)&&(typeof s=="string"?((this.multiple||this.range)&&s.includes(",")&&(s=s.split(",")),this.value=s,this._value=Array.isArray(s)?s:[s]):Array.isArray(s)?(this.value=this.multiple||this.range?s:s[0],this._value=s):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&h&&h.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(h==null?void 0:h.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const s=this.multiple||this.range?[]:"";this.value=s,this.internals.setFormValue(s),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:s,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}onChange(s){if(!this.touched){this.touched=!0,s&&this.setFormValue(s);return}typeof s!="string"&&!Array.isArray(s)||((this.range||this.multiple)&&!Array.isArray(s)&&s.includes(",")&&(s=s.split(",")),!this.multiple&&!this.range&&Array.isArray(s)&&(s=s[0]),this.setFormValue(s),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:s,bubbles:!0,composed:!0})))}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(s=>{s.selected=!1}),this.checked!==void 0?(this.checked=!1,this.internals.ariaChecked=!1,this.internals.setFormValue("",""),this.inputRef.value.checked=!1,this.valueChecked(this.checked)):(this.internals.setFormValue(""),this.value=this.defaultValue||(this.multiple||this.range?[]:""),this._value=this.value,this.valueChanged(this.value,null)),this.internals.ariaInvalid=!1}updated(s){super.updated(s),s.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(s){if(super.firstUpdated(s),!this.form){const h=this.internals.form||this.closest("form");this.form=h}if(this.value&&this.defaultValue!==null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=!0,this.checked=!0),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const h=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=h,this.internals.setFormValue(h?this.value||"on":"",h?this.value||"on":"")}else this.internals.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}}d([r.n()],c.prototype,"defaultValue");d([r.n({type:Boolean,reflect:!0})],c.prototype,"disabled");d([r.n({type:Boolean,reflect:!0})],c.prototype,"readonly");d([r.n({type:Boolean,reflect:!0})],c.prototype,"required");d([r.n({type:Number,reflect:!0})],c.prototype,"max");d([r.n({type:Number,reflect:!0})],c.prototype,"maxlength");d([r.n({type:Number,reflect:!0})],c.prototype,"min");d([r.n({type:Number,reflect:!0})],c.prototype,"minlength");d([r.n({type:Number,reflect:!0})],c.prototype,"step");d([r.n({type:String})],c.prototype,"ariaDescribedBy");d([r.n({type:String})],c.prototype,"ariaLabelledby");d([r.n({type:String,reflect:!0})],c.prototype,"name");d([r.n({type:String,reflect:!0})],c.prototype,"pattern");d([r.n({type:String,reflect:!0})],c.prototype,"placeholder");d([r.n({type:String,reflect:!0})],c.prototype,"id");d([r.n({type:Boolean})],c.prototype,"counter");d([r.n({type:Boolean})],c.prototype,"hasError");d([r.n({type:Boolean})],c.prototype,"inline");d([r.n({type:Boolean})],c.prototype,"hasFieldset");d([r.n({type:Boolean})],c.prototype,"optionalTag");d([r.n({type:Boolean})],c.prototype,"requiredTag");d([r.n({type:Boolean})],c.prototype,"skipForwardTestid");d([r.n({type:Boolean,reflect:!1})],c.prototype,"useWrapper");d([r.n({type:Boolean,reflect:!0})],c.prototype,"fullwidth");d([r.n({type:Number})],c.prototype,"counterMaxLength");d([r.n({type:String})],c.prototype,"errorMessage");d([r.n({type:String})],c.prototype,"helptext");d([r.n({type:String})],c.prototype,"helptextDropdown");d([r.n({type:String,reflect:!1})],c.prototype,"helptextDropdownButton");d([r.n({type:String})],c.prototype,"label");d([r.n({type:String,reflect:!1})],c.prototype,"optionalText");d([r.n({type:String,reflect:!1})],c.prototype,"requiredText");d([r.n({type:String,reflect:!1})],c.prototype,"tagText");d([r.n({type:String,attribute:"data-testid"})],c.prototype,"dataTestid");d([Mt.r()],c.prototype,"touched");exports.PktInputElement=c;
|
|
@@ -4,7 +4,7 @@ import { u as Fe } from "./stringutils-DJjRa8dG.js";
|
|
|
4
4
|
import { s as Ce } from "./input-wrapper-8iKEzDRZ.js";
|
|
5
5
|
(function() {
|
|
6
6
|
(function(M) {
|
|
7
|
-
const s = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(),
|
|
7
|
+
const s = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), L = {
|
|
8
8
|
ariaAtomic: "aria-atomic",
|
|
9
9
|
ariaAutoComplete: "aria-autocomplete",
|
|
10
10
|
ariaBusy: "aria-busy",
|
|
@@ -80,7 +80,7 @@ import { s as Ce } from "./input-wrapper-8iKEzDRZ.js";
|
|
|
80
80
|
for (const e of t) {
|
|
81
81
|
const i = e.target;
|
|
82
82
|
if (e.attributeName === "disabled" && (i.constructor.formAssociated ? W(i, i.hasAttribute("disabled")) : i.localName === "fieldset" && j(i)), e.attributeName === "name" && i.constructor.formAssociated) {
|
|
83
|
-
const a = u.get(i), r =
|
|
83
|
+
const a = u.get(i), r = T.get(i);
|
|
84
84
|
a.setFormValue(r);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -367,7 +367,7 @@ import { s as Ce } from "./input-wrapper-8iKEzDRZ.js";
|
|
|
367
367
|
n.name = a, n.value = r;
|
|
368
368
|
}
|
|
369
369
|
});
|
|
370
|
-
|
|
370
|
+
T.set(i, e);
|
|
371
371
|
}
|
|
372
372
|
setValidity(e, i, a) {
|
|
373
373
|
const r = s.get(this);
|
|
@@ -386,7 +386,7 @@ import { s as Ce } from "./input-wrapper-8iKEzDRZ.js";
|
|
|
386
386
|
y.set(this, f ? "" : i), r.isConnected ? (r.toggleAttribute("internals-invalid", !f), r.toggleAttribute("internals-valid", f), k(r, "aria-invalid", `${!f}`)) : I.set(r, this);
|
|
387
387
|
}
|
|
388
388
|
get shadowRoot() {
|
|
389
|
-
const e = s.get(this), i =
|
|
389
|
+
const e = s.get(this), i = S.get(e);
|
|
390
390
|
return i || null;
|
|
391
391
|
}
|
|
392
392
|
get validationMessage() {
|
|
@@ -458,7 +458,7 @@ import { s as Ce } from "./input-wrapper-8iKEzDRZ.js";
|
|
|
458
458
|
}), typeof Element < "u") {
|
|
459
459
|
let e = function(...a) {
|
|
460
460
|
const r = i.apply(this, a);
|
|
461
|
-
if (
|
|
461
|
+
if (S.set(this, r), D()) {
|
|
462
462
|
const n = new MutationObserver(P);
|
|
463
463
|
window.ShadyDOM ? n.observe(this, H) : n.observe(r, H), C.set(this, n);
|
|
464
464
|
}
|
|
@@ -473,20 +473,20 @@ import { s as Ce } from "./input-wrapper-8iKEzDRZ.js";
|
|
|
473
473
|
return !!customElements.polyfillWrapFlushCallback || (Me() ? typeof window < "u" && !window.CustomStateSet && q(HTMLElement.prototype.attachInternals) : ne(!1)), M.forceCustomStateSetPolyfill = q, M.forceElementInternalsPolyfill = ne, Object.defineProperty(M, "__esModule", { value: !0 }), M;
|
|
474
474
|
})({});
|
|
475
475
|
})();
|
|
476
|
-
var
|
|
476
|
+
var Te = Object.defineProperty, l = (M, s, h, p) => {
|
|
477
477
|
for (var u = void 0, y = M.length - 1, V; y >= 0; y--)
|
|
478
478
|
(V = M[y]) && (u = V(s, h, u) || u);
|
|
479
|
-
return u &&
|
|
479
|
+
return u && Te(s, h, u), u;
|
|
480
480
|
};
|
|
481
481
|
class c extends ke {
|
|
482
482
|
constructor() {
|
|
483
|
-
super(), this.defaultValue = null, this.disabled = !1, this.readonly = !1, this.required = !1, this.max = null, this.maxlength = null, this.min = null, this.minlength = null, this.step = null, this.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = null, this.placeholder = null, this.id = Fe(), this.counter = !1, this.hasError = !1, this.inline = !1, this.hasFieldset = !1, this.optionalTag = !1, this.requiredTag = !1, this.skipForwardTestid = !1, this.useWrapper = !0, this.fullwidth = !1, this.counterMaxLength = 0, this.errorMessage = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = Ce.props.helptextDropdownButton.default, this.label = null, this.optionalText = g.forms.labels.optional, this.requiredText = g.forms.labels.required, this.dataTestid = "", this.touched = !1, this.internals = this.attachInternals();
|
|
483
|
+
super(), this.defaultValue = null, this.disabled = !1, this.readonly = !1, this.required = !1, this.max = null, this.maxlength = null, this.min = null, this.minlength = null, this.step = null, this.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = null, this.placeholder = null, this.id = Fe(), this.counter = !1, this.hasError = !1, this.inline = !1, this.hasFieldset = !1, this.optionalTag = !1, this.requiredTag = !1, this.skipForwardTestid = !1, this.useWrapper = !0, this.fullwidth = !1, this.counterMaxLength = 0, this.errorMessage = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = Ce.props.helptextDropdownButton.default, this.label = null, this.optionalText = g.forms.labels.optional, this.requiredText = g.forms.labels.required, this.tagText = null, this.dataTestid = "", this.touched = !1, this.internals = this.attachInternals();
|
|
484
484
|
}
|
|
485
485
|
static get formAssociated() {
|
|
486
486
|
return !0;
|
|
487
487
|
}
|
|
488
488
|
manageValidity(s) {
|
|
489
|
-
var h, p, u, y, V, C, b,
|
|
489
|
+
var h, p, u, y, V, C, b, T, F, S, A;
|
|
490
490
|
s && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 }, g.forms.messages.required, s) : (h = s.validity) != null && h.typeMismatch || (p = s.validity) != null && p.badInput ? this.internals.setValidity({ typeMismatch: !0 }, g.forms.messages.invalid, s) : (u = s.validity) != null && u.patternMismatch ? this.internals.setValidity(
|
|
491
491
|
{ patternMismatch: !0 },
|
|
492
492
|
g.forms.messages.invalidPattern,
|
|
@@ -495,9 +495,9 @@ class c extends ke {
|
|
|
495
495
|
{ rangeUnderflow: !0 },
|
|
496
496
|
this.min ? g.forms.messages.rangeUnderflowMin.replace("{min}", (b = this.min) == null ? void 0 : b.toString()) : g.forms.messages.rangeUnderflow,
|
|
497
497
|
s
|
|
498
|
-
) : (
|
|
498
|
+
) : (T = s.validity) != null && T.stepMismatch ? this.internals.setValidity({ stepMismatch: !0 }, g.forms.messages.invalid, s) : (F = s.validity) != null && F.rangeOverflow ? this.internals.setValidity(
|
|
499
499
|
{ rangeOverflow: !0 },
|
|
500
|
-
this.max ? g.forms.messages.rangeOverflowMax.replace("{max}", (
|
|
500
|
+
this.max ? g.forms.messages.rangeOverflowMax.replace("{max}", (S = this.max) == null ? void 0 : S.toString()) : g.forms.messages.rangeOverflow,
|
|
501
501
|
s
|
|
502
502
|
) : (A = s.validity) != null && A.customError ? this.internals.setValidity({ customError: !0 }, s.validationMessage, s) : this.internals.setValidity({}));
|
|
503
503
|
}
|
|
@@ -689,6 +689,9 @@ l([
|
|
|
689
689
|
l([
|
|
690
690
|
d({ type: String, reflect: !1 })
|
|
691
691
|
], c.prototype, "requiredText");
|
|
692
|
+
l([
|
|
693
|
+
d({ type: String, reflect: !1 })
|
|
694
|
+
], c.prototype, "tagText");
|
|
692
695
|
l([
|
|
693
696
|
d({ type: String, attribute: "data-testid" })
|
|
694
697
|
], c.prototype, "dataTestid");
|