@oslokommune/punkt-react 12.42.5 → 12.42.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/punkt-react.es.js +77 -74
- package/dist/punkt-react.umd.js +22 -21
- package/package.json +3 -3
package/dist/punkt-react.es.js
CHANGED
|
@@ -25741,14 +25741,15 @@ let xA = class {
|
|
|
25741
25741
|
this.observer.disconnect();
|
|
25742
25742
|
}
|
|
25743
25743
|
addNode(n) {
|
|
25744
|
-
(n.nodeName === "OPTION" || n.nodeName === "DATA") && (n.setAttribute("class", "pkt-hide"), n.setAttribute("hidden", "true"), n.setAttribute("data-skip", "true"), this.nodes.push(n));
|
|
25744
|
+
(n.nodeName === "OPTION" || n.nodeName === "DATA") && (n.setAttribute("class", "pkt-hide"), n.setAttribute("role", "presentation"), n.setAttribute("aria-hidden", "true"), n.setAttribute("data-skip", "true"), this.nodes.push(n));
|
|
25745
25745
|
}
|
|
25746
25746
|
createOptions() {
|
|
25747
25747
|
this.options = this.nodes.map((n) => ({
|
|
25748
|
-
value: n.getAttribute("value")
|
|
25748
|
+
value: n.hasAttribute("value") ? n.getAttribute("value") ?? "" : n.textContent ?? "",
|
|
25749
25749
|
label: n.textContent || n.getAttribute("value") || "",
|
|
25750
|
-
selected:
|
|
25751
|
-
disabled:
|
|
25750
|
+
selected: n.hasAttribute("selected"),
|
|
25751
|
+
disabled: n.hasAttribute("disabled"),
|
|
25752
|
+
hidden: n.hasAttribute("hidden")
|
|
25752
25753
|
})), this.host.setAttribute("options", JSON.stringify(this.options));
|
|
25753
25754
|
}
|
|
25754
25755
|
handleMutations(n) {
|
|
@@ -28071,23 +28072,23 @@ let ca = class extends Kr {
|
|
|
28071
28072
|
constructor() {
|
|
28072
28073
|
super(), this.ariaLabel = null, this.ariaLabelledby = null, this.ariaValueText = null, this.ariaLive = "polite", this.id = th(), this.role = "progressbar", this.skin = "dark-blue", this.statusPlacement = "following", this.statusType = "none", this.title = "", this.titlePosition = "left", this.valueCurrent = 0, this.valueMax = 100, this.valueMin = 0, this.labelWidth = 0, this.progressbarId = this.id, this.computedAriaLabelledby = null, this.computedAriaValueText = "", this.labelRef = pn(), this.progressBarRef = pn();
|
|
28073
28074
|
}
|
|
28074
|
-
firstUpdated(
|
|
28075
|
-
super.firstUpdated(
|
|
28075
|
+
firstUpdated(r) {
|
|
28076
|
+
super.firstUpdated(r), this.setComputedValues(), this.syncAttributes();
|
|
28076
28077
|
}
|
|
28077
|
-
updated(
|
|
28078
|
-
super.updated(
|
|
28078
|
+
updated(r) {
|
|
28079
|
+
super.updated(r), r.has("valueCurrent") && this.labelRef.value && (this.labelWidth = this.labelRef.value.getBoundingClientRect().width || 0), r.has("id") && this.id && (this.progressBarId = this.id), (r.has("statusType") || r.has("id") || r.has("ariaLabelledby")) && (this.progressbarId = this.id || th(), this.computedAriaLabelledby = this.ariaLabelledby || `${this.progressbarId}-title`), (r.has("ariaValueText") || r.has("valueCurrent") || r.has("valueMax")) && (this.computedAriaValueText = this.statusType === "fraction" && !this.ariaValueText ? `${this.valueCurrent} av ${this.valueMax - this.valueMin}` : this.ariaValueText || ""), this.syncAttributes();
|
|
28079
28080
|
}
|
|
28080
28081
|
render() {
|
|
28081
|
-
const
|
|
28082
|
+
const r = this.statusType !== "none", n = this.valueMax - this.valueMin, i = this.valueCurrent / n * 100, l = this.statusType === "fraction" ? Math.round(i) : Math.round((this.valueCurrent - this.valueMin) / (this.valueMax - this.valueMin) * 100), c = `${this.valueCurrent} av ${n}`, h = Ot({
|
|
28082
28083
|
"pkt-progressbar__bar": !0,
|
|
28083
28084
|
[`pkt-progressbar__bar--${this.skin}`]: !!this.skin
|
|
28084
|
-
}),
|
|
28085
|
+
}), m = Ot({
|
|
28085
28086
|
"pkt-progressbar__title": !0,
|
|
28086
28087
|
"pkt-progressbar__title-center": this.titlePosition === "center"
|
|
28087
|
-
}),
|
|
28088
|
+
}), D = Ot({
|
|
28088
28089
|
"pkt-progressbar__status": !0,
|
|
28089
28090
|
"pkt-progressbar__status--center": this.statusPlacement === "center"
|
|
28090
|
-
}),
|
|
28091
|
+
}), C = Ot({
|
|
28091
28092
|
"pkt-progressbar__status-placement--following": this.statusPlacement === "following",
|
|
28092
28093
|
"pkt-progressbar__status-placement--center": this.statusPlacement === "center",
|
|
28093
28094
|
"pkt-progressbar__status-placement--left": this.statusPlacement === "left"
|
|
@@ -28097,18 +28098,18 @@ let ca = class extends Kr {
|
|
|
28097
28098
|
.ref=${this.progressBarRef}
|
|
28098
28099
|
style=${fI({
|
|
28099
28100
|
"--pkt-progress-label-width": `${this.labelWidth}px`,
|
|
28100
|
-
"--pkt-progress-width": `${
|
|
28101
|
+
"--pkt-progress-width": `${l}%`
|
|
28101
28102
|
})}
|
|
28102
28103
|
>
|
|
28103
|
-
${this.title ? be`<p id=${`${this.progressBarId}-title`} class=${
|
|
28104
|
+
${this.title ? be`<p id=${`${this.progressBarId}-title`} class=${m}>${this.title}</p>` : Ve}
|
|
28104
28105
|
|
|
28105
28106
|
<div class="pkt-progressbar__bar-wrapper">
|
|
28106
|
-
<div class=${
|
|
28107
|
+
<div class=${h}></div>
|
|
28107
28108
|
</div>
|
|
28108
28109
|
|
|
28109
|
-
${
|
|
28110
|
-
<span class=${
|
|
28111
|
-
${this.statusType === "percentage" ? `${
|
|
28110
|
+
${r ? be`<div class=${D}>
|
|
28111
|
+
<span class=${C} ${Gt(this.labelRef)}>
|
|
28112
|
+
${this.statusType === "percentage" ? `${l}%` : c}
|
|
28112
28113
|
</span>
|
|
28113
28114
|
</div>` : Ve}
|
|
28114
28115
|
</div>`;
|
|
@@ -28120,8 +28121,8 @@ let ca = class extends Kr {
|
|
|
28120
28121
|
syncAttributes() {
|
|
28121
28122
|
this._handleAttribute("aria-live", this.ariaLive), this._handleAttribute("aria-valuenow", this.valueCurrent), this._handleAttribute("aria-valuemin", this.valueMin), this._handleAttribute("aria-valuemax", this.valueMax), this._handleAttribute("aria-valuetext", this.computedAriaValueText), this._handleAttribute("aria-label", this.ariaLabel), this._handleAttribute("role", this.role), this._handleAttribute("aria-atomic", "true"), this._handleAttribute("id", this.progressbarId), this.ariaLabel || this._handleAttribute("aria-labelledby", this.computedAriaLabelledby);
|
|
28122
28123
|
}
|
|
28123
|
-
_handleAttribute(
|
|
28124
|
-
|
|
28124
|
+
_handleAttribute(r, n) {
|
|
28125
|
+
n == null || n === "" ? this.removeAttribute(r) : this.setAttribute(r, String(n));
|
|
28125
28126
|
}
|
|
28126
28127
|
};
|
|
28127
28128
|
za([
|
|
@@ -28530,62 +28531,63 @@ let tg = class extends dn {
|
|
|
28530
28531
|
// Used for initilization
|
|
28531
28532
|
connectedCallback() {
|
|
28532
28533
|
super.connectedCallback();
|
|
28533
|
-
const
|
|
28534
|
-
!
|
|
28535
|
-
const
|
|
28536
|
-
value:
|
|
28537
|
-
label:
|
|
28538
|
-
disabled:
|
|
28534
|
+
const n = this.options.length > 0, i = this.optionsController.nodes.length && this.optionsController.nodes.length > 0;
|
|
28535
|
+
!n && i ? this.optionsController.nodes.forEach((l) => {
|
|
28536
|
+
const c = {
|
|
28537
|
+
value: l.hasAttribute("value") ? l.getAttribute("value") ?? "" : l.textContent ?? "",
|
|
28538
|
+
label: l.textContent || l.getAttribute("value") || "",
|
|
28539
|
+
disabled: l.hasAttribute("disabled"),
|
|
28540
|
+
hidden: l.hasAttribute("hidden")
|
|
28539
28541
|
};
|
|
28540
|
-
|
|
28541
|
-
}) : (this._options = this.options, this._options.forEach((
|
|
28542
|
-
|
|
28542
|
+
l.getAttribute("selected") && !this.value && (this.value = c.value), this._options.push(c);
|
|
28543
|
+
}) : (this._options = this.options, this._options.forEach((l) => {
|
|
28544
|
+
l.selected && !this.value && (this.value = l.value);
|
|
28543
28545
|
}));
|
|
28544
28546
|
}
|
|
28545
28547
|
// Support native Select method `add`
|
|
28546
|
-
add(
|
|
28547
|
-
var
|
|
28548
|
-
(
|
|
28549
|
-
value:
|
|
28550
|
-
label:
|
|
28551
|
-
selected:
|
|
28552
|
-
disabled:
|
|
28553
|
-
}),
|
|
28548
|
+
add(n, i) {
|
|
28549
|
+
var l, c, h;
|
|
28550
|
+
(l = this.inputRef.value) == null || l.add(n, i), this._options.push({
|
|
28551
|
+
value: n.value || n.text,
|
|
28552
|
+
label: n.text || n.value,
|
|
28553
|
+
selected: n.selected,
|
|
28554
|
+
disabled: n.disabled
|
|
28555
|
+
}), n.selected && (this.value = n.value || n.text, this.selectedIndex = this.returnNumberOrNull((c = this.inputRef.value) == null ? void 0 : c.selectedIndex), this.selectedOptions = (h = this.inputRef.value) == null ? void 0 : h.selectedOptions), this.requestUpdate();
|
|
28554
28556
|
}
|
|
28555
28557
|
// Support native Select method `remove`
|
|
28556
|
-
remove(
|
|
28557
|
-
var
|
|
28558
|
-
typeof
|
|
28558
|
+
remove(n) {
|
|
28559
|
+
var i, l;
|
|
28560
|
+
typeof n == "number" && (this.selectedIndex === n && (this.value = ((i = this._options[0]) == null ? void 0 : i.value) || ""), (l = this.inputRef.value) == null || l.remove(n));
|
|
28559
28561
|
}
|
|
28560
28562
|
// Support native Select method `item`
|
|
28561
|
-
item(
|
|
28562
|
-
var
|
|
28563
|
-
return (
|
|
28563
|
+
item(n) {
|
|
28564
|
+
var i;
|
|
28565
|
+
return (i = this.inputRef.value) == null ? void 0 : i.item(n);
|
|
28564
28566
|
}
|
|
28565
28567
|
// Support native Select method `namedItem`
|
|
28566
|
-
namedItem(
|
|
28567
|
-
var
|
|
28568
|
-
return (
|
|
28568
|
+
namedItem(n) {
|
|
28569
|
+
var i;
|
|
28570
|
+
return (i = this.inputRef.value) == null ? void 0 : i.namedItem(n);
|
|
28569
28571
|
}
|
|
28570
28572
|
// Support native Select method `showPicker`
|
|
28571
28573
|
showPicker() {
|
|
28572
|
-
var
|
|
28573
|
-
(
|
|
28574
|
+
var n;
|
|
28575
|
+
(n = this.inputRef.value) == null || n.showPicker();
|
|
28574
28576
|
}
|
|
28575
|
-
attributeChangedCallback(
|
|
28576
|
-
var
|
|
28577
|
-
|
|
28577
|
+
attributeChangedCallback(n, i, l) {
|
|
28578
|
+
var c, h;
|
|
28579
|
+
n === "options" && (this._options = l ? JSON.parse(l) : []), n === "value" && this.value !== i && (this.selectedIndex = this.touched ? this.returnNumberOrNull((c = this.inputRef.value) == null ? void 0 : c.selectedIndex) : this.options.findIndex((m) => m.value === l), this.selectedOptions = (h = this.inputRef.value) == null ? void 0 : h.selectedOptions, this.valueChanged(l, i)), super.attributeChangedCallback(n, i, l);
|
|
28578
28580
|
}
|
|
28579
|
-
update(
|
|
28580
|
-
var
|
|
28581
|
-
super.update(
|
|
28581
|
+
update(n) {
|
|
28582
|
+
var i, l;
|
|
28583
|
+
super.update(n), n.has("value") && this.value !== n.get("value") && (this.selectedIndex = this.touched ? this.returnNumberOrNull((i = this.inputRef.value) == null ? void 0 : i.selectedIndex) : this.options.findIndex((c) => c.value === this.value), this.selectedOptions = (l = this.inputRef.value) == null ? void 0 : l.selectedOptions, this.valueChanged(this.value, n.get("value"))), n.has("id") && !this.name && this.id && (this.name = this.id);
|
|
28582
28584
|
}
|
|
28583
|
-
firstUpdated(
|
|
28584
|
-
var
|
|
28585
|
-
super.firstUpdated(
|
|
28585
|
+
firstUpdated(n) {
|
|
28586
|
+
var i;
|
|
28587
|
+
super.firstUpdated(n), this.options.length && (this._options = this.options), !this.value && this._options.length > 0 ? (this.value = this._options[0].value, this.selectedIndex = 0) : this.selectedIndex = this._options.findIndex((l) => l.value === this.value), this.selectedOptions = (i = this.inputRef.value) == null ? void 0 : i.selectedOptions;
|
|
28586
28588
|
}
|
|
28587
28589
|
render() {
|
|
28588
|
-
const
|
|
28590
|
+
const n = `pkt-input ${this.fullwidth ? "pkt-input--fullwidth" : ""}`;
|
|
28589
28591
|
return be`
|
|
28590
28592
|
<pkt-input-wrapper
|
|
28591
28593
|
?counter=${this.counter}
|
|
@@ -28608,7 +28610,7 @@ let tg = class extends dn {
|
|
|
28608
28610
|
requiredText=${an(this.requiredText)}
|
|
28609
28611
|
>
|
|
28610
28612
|
<select
|
|
28611
|
-
class=${
|
|
28613
|
+
class=${n}
|
|
28612
28614
|
aria-invalid=${this.hasError}
|
|
28613
28615
|
aria-errormessage=${`${this.id}-error`}
|
|
28614
28616
|
aria-labelledby=${an(this.ariaLabelledby)}
|
|
@@ -28616,27 +28618,28 @@ let tg = class extends dn {
|
|
|
28616
28618
|
id=${this.id + "-input"}
|
|
28617
28619
|
name=${(this.name || this.id) + "-input"}
|
|
28618
28620
|
value=${this.value}
|
|
28619
|
-
@change=${(
|
|
28620
|
-
this.touched = !0, this.value =
|
|
28621
|
+
@change=${(i) => {
|
|
28622
|
+
this.touched = !0, this.value = i.target.value, i.stopImmediatePropagation();
|
|
28621
28623
|
}}
|
|
28622
|
-
@input=${(
|
|
28623
|
-
this.onInput(),
|
|
28624
|
+
@input=${(i) => {
|
|
28625
|
+
this.onInput(), i.stopImmediatePropagation();
|
|
28624
28626
|
}}
|
|
28625
|
-
@focus=${(
|
|
28626
|
-
this.onFocus(),
|
|
28627
|
+
@focus=${(i) => {
|
|
28628
|
+
this.onFocus(), i.stopImmediatePropagation();
|
|
28627
28629
|
}}
|
|
28628
|
-
@blur=${(
|
|
28629
|
-
this.onBlur(),
|
|
28630
|
+
@blur=${(i) => {
|
|
28631
|
+
this.onBlur(), i.stopImmediatePropagation();
|
|
28630
28632
|
}}
|
|
28631
28633
|
${Gt(this.inputRef)}
|
|
28632
28634
|
>
|
|
28633
28635
|
${this._options.length > 0 && this._options.map(
|
|
28634
|
-
(
|
|
28635
|
-
value=${
|
|
28636
|
-
?selected=${this.value ==
|
|
28637
|
-
?disabled=${
|
|
28636
|
+
(i) => be`<option
|
|
28637
|
+
value=${i.value}
|
|
28638
|
+
?selected=${this.value == i.value || i.selected}
|
|
28639
|
+
?disabled=${i.disabled}
|
|
28640
|
+
?hidden=${i.hidden}
|
|
28638
28641
|
>
|
|
28639
|
-
${
|
|
28642
|
+
${i.label}
|
|
28640
28643
|
</option>`
|
|
28641
28644
|
)}
|
|
28642
28645
|
</select>
|
|
@@ -28644,8 +28647,8 @@ let tg = class extends dn {
|
|
|
28644
28647
|
</pkt-input-wrapper>
|
|
28645
28648
|
`;
|
|
28646
28649
|
}
|
|
28647
|
-
returnNumberOrNull(
|
|
28648
|
-
return
|
|
28650
|
+
returnNumberOrNull(n) {
|
|
28651
|
+
return n == null || isNaN(n) ? null : n;
|
|
28649
28652
|
}
|
|
28650
28653
|
};
|
|
28651
28654
|
Ew([
|
package/dist/punkt-react.umd.js
CHANGED
|
@@ -646,7 +646,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
646
646
|
* @license
|
|
647
647
|
* Copyright 2017 Google LLC
|
|
648
648
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
649
|
-
*/const z_=(r,n,i)=>{const l=new Map;for(let c=n;c<=i;c++)l.set(r[c],c);return l},h0=Rf(class extends Sh{constructor(r){if(super(r),r.type!==fl.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,n,i){let l;i===void 0?i=n:n!==void 0&&(l=n);const c=[],h=[];let m=0;for(const D of r)c[m]=l?l(D,m):m,h[m]=i(D,m),m++;return{values:h,keys:c}}render(r,n,i){return this.dt(r,n,i).values}update(r,[n,i,l]){const c=yP(r),{values:h,keys:m}=this.dt(n,i,l);if(!Array.isArray(c))return this.ut=m,h;const D=this.ut??(this.ut=[]),C=[];let T,$,N=0,O=c.length-1,R=0,j=h.length-1;for(;N<=O&&R<=j;)if(c[N]===null)N++;else if(c[O]===null)O--;else if(D[N]===m[R])C[R]=Lf(c[N],h[R]),N++,R++;else if(D[O]===m[j])C[j]=Lf(c[O],h[j]),O--,j--;else if(D[N]===m[j])C[j]=Lf(c[N],h[j]),Eg(r,C[j+1],c[N]),N++,j--;else if(D[O]===m[R])C[R]=Lf(c[O],h[R]),Eg(r,c[N],c[O]),O--,R++;else if(T===void 0&&(T=z_(m,R,j),$=z_(D,N,O)),T.has(D[N]))if(T.has(D[O])){const Q=$.get(m[R]),G=Q!==void 0?c[Q]:null;if(G===null){const Se=Eg(r,c[N]);Lf(Se,h[R]),C[R]=Se}else C[R]=Lf(G,h[R]),Eg(r,c[N],G),c[Q]=null;R++}else r0(c[O]),O--;else r0(c[N]),N++;for(;R<=j;){const Q=Eg(r,C[j+1]);Lf(Q,h[R]),C[R++]=Q}for(;N<=O;){const Q=c[N++];Q!==null&&r0(Q)}return this.ut=m,b_(r,C),vo}}),U_=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),zf=()=>{const r=U_(),n=U_();return r.slice(0,8)+"-"+r.slice(8,12)+"-4"+r.slice(13)+"-a"+n.slice(1,4)+"-"+n.slice(4)},f3={helptextDropdownButton:{default:"Les mer <span class='pkt-sr-only'>om feltet</span>"},counter:{default:!1},optionalTag:{default:!1},optionalText:{default:"Valgfritt"},requiredTag:{default:!1},requiredText:{default:"Må fylles ut"},hasError:{default:!1},disabled:{default:!1},inline:{default:!1},hasFieldset:{default:!1},useWrapper:{default:!0}},Qo={props:f3};var p3=Object.defineProperty,Pn=(r,n,i,l)=>{for(var c=void 0,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=m(n,i,c)||c);return c&&p3(n,i,c),c};let dn=class extends Hr{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=zf(),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=Qo.props.helptextDropdownButton.default,this.label=null,this.optionalText=Wi.forms.labels.optional,this.requiredText=Wi.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(n){var i,l,c,h,m,D,C,T,$,N,O;n&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},Wi.forms.messages.required,n):(i=n.validity)!=null&&i.typeMismatch||(l=n.validity)!=null&&l.badInput?this.internals.setValidity({typeMismatch:!0},Wi.forms.messages.invalid,n):(c=n.validity)!=null&&c.patternMismatch?this.internals.setValidity({patternMismatch:!0},Wi.forms.messages.invalidPattern,n):(h=n.validity)!=null&&h.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},Wi.forms.messages.tooShort,n):(m=n.validity)!=null&&m.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},Wi.forms.messages.tooLong,n):(D=n.validity)!=null&&D.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?Wi.forms.messages.rangeUnderflowMin.replace("{min}",(C=this.min)==null?void 0:C.toString()):Wi.forms.messages.rangeUnderflow,n):(T=n.validity)!=null&&T.stepMismatch?this.internals.setValidity({stepMismatch:!0},Wi.forms.messages.invalid,n):($=n.validity)!=null&&$.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?Wi.forms.messages.rangeOverflowMax.replace("{max}",(N=this.max)==null?void 0:N.toString()):Wi.forms.messages.rangeOverflow,n):(O=n.validity)!=null&&O.customError?this.internals.setValidity({customError:!0},n.validationMessage,n):this.internals.setValidity({}))}setFormValue(n){if(this.internals)if(Array.isArray(n)){const i=new FormData;n.forEach(l=>{i.append(this.name,l)}),this.internals.setFormValue(i)}else this.internals.setFormValue(n)}valueChecked(n){if(!this.touched)return;const i=this.internals.form||this.closest("form"),l=i?new FormData(i):null;i&&i.querySelectorAll(`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`).forEach(c=>{const h=c;h.name===this.name&&h.value!==this.value&&h.checked&&(h.checked=!1)}),typeof n=="string"?(this.checked=n==="true",this.internals.ariaChecked=n==="true"):typeof n=="boolean"&&(this.checked=n,this.internals.ariaChecked=n),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),l&&l.append(this.name,this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue(null,null),l&&l.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(n,i){(i!==this.value||i!==this._value)&&(typeof n=="string"?((this.multiple||this.range)&&n.includes(",")&&(n=n.split(",")),this.value=n,this._value=Array.isArray(n)?n:[n]):Array.isArray(n)?(this.value=this.multiple||this.range?n:n[0],this._value=n):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&i&&i.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(i==null?void 0:i.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const n=this.multiple||this.range?[]:"";this.value=n,this.internals.setFormValue(n),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:n,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(n){if(!this.touched){this.touched=!0,n&&this.setFormValue(n);return}typeof n!="string"&&!Array.isArray(n)||((this.range||this.multiple)&&!Array.isArray(n)&&n.includes(",")&&(n=n.split(",")),!this.multiple&&!this.range&&Array.isArray(n)&&(n=n[0]),this.setFormValue(n),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:n,bubbles:!0,composed:!0})))}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(n=>{n.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(n){super.updated(n),n.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(n){if(super.firstUpdated(n),!this.form){const i=this.internals.form||this.closest("form");this.form=i}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 i=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=i,this.internals.setFormValue(i?this.value||"on":"",i?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))}};Pn([z()],dn.prototype,"defaultValue"),Pn([z({type:Boolean,reflect:!0})],dn.prototype,"disabled"),Pn([z({type:Boolean,reflect:!0})],dn.prototype,"readonly"),Pn([z({type:Boolean,reflect:!0})],dn.prototype,"required"),Pn([z({type:Number,reflect:!0})],dn.prototype,"max"),Pn([z({type:Number,reflect:!0})],dn.prototype,"maxlength"),Pn([z({type:Number,reflect:!0})],dn.prototype,"min"),Pn([z({type:Number,reflect:!0})],dn.prototype,"minlength"),Pn([z({type:Number,reflect:!0})],dn.prototype,"step"),Pn([z({type:String})],dn.prototype,"ariaDescribedBy"),Pn([z({type:String})],dn.prototype,"ariaLabelledby"),Pn([z({type:String,reflect:!0})],dn.prototype,"name"),Pn([z({type:String,reflect:!0})],dn.prototype,"pattern"),Pn([z({type:String,reflect:!0})],dn.prototype,"placeholder"),Pn([z({type:String,reflect:!0})],dn.prototype,"id"),Pn([z({type:Boolean})],dn.prototype,"counter"),Pn([z({type:Boolean})],dn.prototype,"hasError"),Pn([z({type:Boolean})],dn.prototype,"inline"),Pn([z({type:Boolean})],dn.prototype,"hasFieldset"),Pn([z({type:Boolean})],dn.prototype,"optionalTag"),Pn([z({type:Boolean})],dn.prototype,"requiredTag"),Pn([z({type:Boolean})],dn.prototype,"skipForwardTestid"),Pn([z({type:Boolean,reflect:!1})],dn.prototype,"useWrapper"),Pn([z({type:Boolean,reflect:!0})],dn.prototype,"fullwidth"),Pn([z({type:Number})],dn.prototype,"counterMaxLength"),Pn([z({type:String})],dn.prototype,"errorMessage"),Pn([z({type:String})],dn.prototype,"helptext"),Pn([z({type:String})],dn.prototype,"helptextDropdown"),Pn([z({type:String,reflect:!1})],dn.prototype,"helptextDropdownButton"),Pn([z({type:String})],dn.prototype,"label"),Pn([z({type:String,reflect:!1})],dn.prototype,"optionalText"),Pn([z({type:String,reflect:!1})],dn.prototype,"requiredText"),Pn([z({type:String,attribute:"data-testid"})],dn.prototype,"dataTestid"),Pn([$n()],dn.prototype,"touched");let H_=class{constructor(n){this.nodes=[],this.options=[],this.host=n,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(i=>this.handleMutations(i))}hostConnected(){Array.from(this.host.childNodes).forEach(n=>{(n.nodeName==="OPTION"||n.nodeName==="DATA")&&this.addNode(n)}),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}addNode(n){(n.nodeName==="OPTION"||n.nodeName==="DATA")&&(n.setAttribute("class","pkt-hide"),n.setAttribute("hidden","true"),n.setAttribute("data-skip","true"),this.nodes.push(n))}createOptions(){this.options=this.nodes.map(n=>({value:n.getAttribute("value")||n.textContent||"",label:n.textContent||n.getAttribute("value")||"",selected:!!n.getAttribute("selected"),disabled:!!n.getAttribute("disabled")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(n){let i=!1;n.forEach(l=>{l.type==="childList"&&(l.addedNodes.forEach(c=>{xg(c)&&(this.addNode(c),i=!0)}),l.removedNodes.forEach(c=>{xg(c)&&(this.nodes=this.nodes.filter(h=>h!==c),i=!0)}))}),i&&this.createOptions()}};var h3=Object.defineProperty,m3=Object.getOwnPropertyDescriptor,Ah=(r,n,i,l)=>{for(var c=l>1?void 0:l?m3(n,i):n,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(n,i,c):m(c))||c);return l&&c&&h3(n,i,c),c};let Ed=class extends Hr{constructor(){super(),this.defaultSlot=pn(),this.forId=zf(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Qo.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.slotController=new Ca(this,this.defaultSlot)}render(){const n=()=>{const l=!this.isHelpTextOpen;this.isHelpTextOpen=l,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:l}}))},i=()=>this.helptextDropdown?be`<div class="pkt-inputwrapper__helptext-expandable">
|
|
649
|
+
*/const z_=(r,n,i)=>{const l=new Map;for(let c=n;c<=i;c++)l.set(r[c],c);return l},h0=Rf(class extends Sh{constructor(r){if(super(r),r.type!==fl.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,n,i){let l;i===void 0?i=n:n!==void 0&&(l=n);const c=[],h=[];let m=0;for(const D of r)c[m]=l?l(D,m):m,h[m]=i(D,m),m++;return{values:h,keys:c}}render(r,n,i){return this.dt(r,n,i).values}update(r,[n,i,l]){const c=yP(r),{values:h,keys:m}=this.dt(n,i,l);if(!Array.isArray(c))return this.ut=m,h;const D=this.ut??(this.ut=[]),C=[];let T,$,N=0,O=c.length-1,R=0,j=h.length-1;for(;N<=O&&R<=j;)if(c[N]===null)N++;else if(c[O]===null)O--;else if(D[N]===m[R])C[R]=Lf(c[N],h[R]),N++,R++;else if(D[O]===m[j])C[j]=Lf(c[O],h[j]),O--,j--;else if(D[N]===m[j])C[j]=Lf(c[N],h[j]),Eg(r,C[j+1],c[N]),N++,j--;else if(D[O]===m[R])C[R]=Lf(c[O],h[R]),Eg(r,c[N],c[O]),O--,R++;else if(T===void 0&&(T=z_(m,R,j),$=z_(D,N,O)),T.has(D[N]))if(T.has(D[O])){const Q=$.get(m[R]),G=Q!==void 0?c[Q]:null;if(G===null){const Se=Eg(r,c[N]);Lf(Se,h[R]),C[R]=Se}else C[R]=Lf(G,h[R]),Eg(r,c[N],G),c[Q]=null;R++}else r0(c[O]),O--;else r0(c[N]),N++;for(;R<=j;){const Q=Eg(r,C[j+1]);Lf(Q,h[R]),C[R++]=Q}for(;N<=O;){const Q=c[N++];Q!==null&&r0(Q)}return this.ut=m,b_(r,C),vo}}),U_=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),zf=()=>{const r=U_(),n=U_();return r.slice(0,8)+"-"+r.slice(8,12)+"-4"+r.slice(13)+"-a"+n.slice(1,4)+"-"+n.slice(4)},f3={helptextDropdownButton:{default:"Les mer <span class='pkt-sr-only'>om feltet</span>"},counter:{default:!1},optionalTag:{default:!1},optionalText:{default:"Valgfritt"},requiredTag:{default:!1},requiredText:{default:"Må fylles ut"},hasError:{default:!1},disabled:{default:!1},inline:{default:!1},hasFieldset:{default:!1},useWrapper:{default:!0}},Qo={props:f3};var p3=Object.defineProperty,Pn=(r,n,i,l)=>{for(var c=void 0,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=m(n,i,c)||c);return c&&p3(n,i,c),c};let dn=class extends Hr{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=zf(),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=Qo.props.helptextDropdownButton.default,this.label=null,this.optionalText=Wi.forms.labels.optional,this.requiredText=Wi.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(n){var i,l,c,h,m,D,C,T,$,N,O;n&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},Wi.forms.messages.required,n):(i=n.validity)!=null&&i.typeMismatch||(l=n.validity)!=null&&l.badInput?this.internals.setValidity({typeMismatch:!0},Wi.forms.messages.invalid,n):(c=n.validity)!=null&&c.patternMismatch?this.internals.setValidity({patternMismatch:!0},Wi.forms.messages.invalidPattern,n):(h=n.validity)!=null&&h.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},Wi.forms.messages.tooShort,n):(m=n.validity)!=null&&m.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},Wi.forms.messages.tooLong,n):(D=n.validity)!=null&&D.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?Wi.forms.messages.rangeUnderflowMin.replace("{min}",(C=this.min)==null?void 0:C.toString()):Wi.forms.messages.rangeUnderflow,n):(T=n.validity)!=null&&T.stepMismatch?this.internals.setValidity({stepMismatch:!0},Wi.forms.messages.invalid,n):($=n.validity)!=null&&$.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?Wi.forms.messages.rangeOverflowMax.replace("{max}",(N=this.max)==null?void 0:N.toString()):Wi.forms.messages.rangeOverflow,n):(O=n.validity)!=null&&O.customError?this.internals.setValidity({customError:!0},n.validationMessage,n):this.internals.setValidity({}))}setFormValue(n){if(this.internals)if(Array.isArray(n)){const i=new FormData;n.forEach(l=>{i.append(this.name,l)}),this.internals.setFormValue(i)}else this.internals.setFormValue(n)}valueChecked(n){if(!this.touched)return;const i=this.internals.form||this.closest("form"),l=i?new FormData(i):null;i&&i.querySelectorAll(`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`).forEach(c=>{const h=c;h.name===this.name&&h.value!==this.value&&h.checked&&(h.checked=!1)}),typeof n=="string"?(this.checked=n==="true",this.internals.ariaChecked=n==="true"):typeof n=="boolean"&&(this.checked=n,this.internals.ariaChecked=n),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),l&&l.append(this.name,this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue(null,null),l&&l.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(n,i){(i!==this.value||i!==this._value)&&(typeof n=="string"?((this.multiple||this.range)&&n.includes(",")&&(n=n.split(",")),this.value=n,this._value=Array.isArray(n)?n:[n]):Array.isArray(n)?(this.value=this.multiple||this.range?n:n[0],this._value=n):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&i&&i.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(i==null?void 0:i.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const n=this.multiple||this.range?[]:"";this.value=n,this.internals.setFormValue(n),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:n,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(n){if(!this.touched){this.touched=!0,n&&this.setFormValue(n);return}typeof n!="string"&&!Array.isArray(n)||((this.range||this.multiple)&&!Array.isArray(n)&&n.includes(",")&&(n=n.split(",")),!this.multiple&&!this.range&&Array.isArray(n)&&(n=n[0]),this.setFormValue(n),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:n,bubbles:!0,composed:!0})))}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(n=>{n.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(n){super.updated(n),n.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(n){if(super.firstUpdated(n),!this.form){const i=this.internals.form||this.closest("form");this.form=i}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 i=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=i,this.internals.setFormValue(i?this.value||"on":"",i?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))}};Pn([z()],dn.prototype,"defaultValue"),Pn([z({type:Boolean,reflect:!0})],dn.prototype,"disabled"),Pn([z({type:Boolean,reflect:!0})],dn.prototype,"readonly"),Pn([z({type:Boolean,reflect:!0})],dn.prototype,"required"),Pn([z({type:Number,reflect:!0})],dn.prototype,"max"),Pn([z({type:Number,reflect:!0})],dn.prototype,"maxlength"),Pn([z({type:Number,reflect:!0})],dn.prototype,"min"),Pn([z({type:Number,reflect:!0})],dn.prototype,"minlength"),Pn([z({type:Number,reflect:!0})],dn.prototype,"step"),Pn([z({type:String})],dn.prototype,"ariaDescribedBy"),Pn([z({type:String})],dn.prototype,"ariaLabelledby"),Pn([z({type:String,reflect:!0})],dn.prototype,"name"),Pn([z({type:String,reflect:!0})],dn.prototype,"pattern"),Pn([z({type:String,reflect:!0})],dn.prototype,"placeholder"),Pn([z({type:String,reflect:!0})],dn.prototype,"id"),Pn([z({type:Boolean})],dn.prototype,"counter"),Pn([z({type:Boolean})],dn.prototype,"hasError"),Pn([z({type:Boolean})],dn.prototype,"inline"),Pn([z({type:Boolean})],dn.prototype,"hasFieldset"),Pn([z({type:Boolean})],dn.prototype,"optionalTag"),Pn([z({type:Boolean})],dn.prototype,"requiredTag"),Pn([z({type:Boolean})],dn.prototype,"skipForwardTestid"),Pn([z({type:Boolean,reflect:!1})],dn.prototype,"useWrapper"),Pn([z({type:Boolean,reflect:!0})],dn.prototype,"fullwidth"),Pn([z({type:Number})],dn.prototype,"counterMaxLength"),Pn([z({type:String})],dn.prototype,"errorMessage"),Pn([z({type:String})],dn.prototype,"helptext"),Pn([z({type:String})],dn.prototype,"helptextDropdown"),Pn([z({type:String,reflect:!1})],dn.prototype,"helptextDropdownButton"),Pn([z({type:String})],dn.prototype,"label"),Pn([z({type:String,reflect:!1})],dn.prototype,"optionalText"),Pn([z({type:String,reflect:!1})],dn.prototype,"requiredText"),Pn([z({type:String,attribute:"data-testid"})],dn.prototype,"dataTestid"),Pn([$n()],dn.prototype,"touched");let H_=class{constructor(n){this.nodes=[],this.options=[],this.host=n,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(i=>this.handleMutations(i))}hostConnected(){Array.from(this.host.childNodes).forEach(n=>{(n.nodeName==="OPTION"||n.nodeName==="DATA")&&this.addNode(n)}),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}addNode(n){(n.nodeName==="OPTION"||n.nodeName==="DATA")&&(n.setAttribute("class","pkt-hide"),n.setAttribute("role","presentation"),n.setAttribute("aria-hidden","true"),n.setAttribute("data-skip","true"),this.nodes.push(n))}createOptions(){this.options=this.nodes.map(n=>({value:n.hasAttribute("value")?n.getAttribute("value")??"":n.textContent??"",label:n.textContent||n.getAttribute("value")||"",selected:n.hasAttribute("selected"),disabled:n.hasAttribute("disabled"),hidden:n.hasAttribute("hidden")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(n){let i=!1;n.forEach(l=>{l.type==="childList"&&(l.addedNodes.forEach(c=>{xg(c)&&(this.addNode(c),i=!0)}),l.removedNodes.forEach(c=>{xg(c)&&(this.nodes=this.nodes.filter(h=>h!==c),i=!0)}))}),i&&this.createOptions()}};var h3=Object.defineProperty,m3=Object.getOwnPropertyDescriptor,Ah=(r,n,i,l)=>{for(var c=l>1?void 0:l?m3(n,i):n,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(n,i,c):m(c))||c);return l&&c&&h3(n,i,c),c};let Ed=class extends Hr{constructor(){super(),this.defaultSlot=pn(),this.forId=zf(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Qo.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.slotController=new Ca(this,this.defaultSlot)}render(){const n=()=>{const l=!this.isHelpTextOpen;this.isHelpTextOpen=l,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:l}}))},i=()=>this.helptextDropdown?be`<div class="pkt-inputwrapper__helptext-expandable">
|
|
650
650
|
<button
|
|
651
651
|
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
652
652
|
type="button"
|
|
@@ -1194,23 +1194,23 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
1194
1194
|
* @license
|
|
1195
1195
|
* Copyright 2018 Google LLC
|
|
1196
1196
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1197
|
-
*/const V_="important",K3=" !"+V_,Q3=Rf(class extends Sh{constructor(r){var n;if(super(r),r.type!==fl.ATTRIBUTE||r.name!=="style"||((n=r.strings)==null?void 0:n.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((n,i)=>{const l=r[i];return l==null?n:n+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${l};`},"")}update(r,[n]){const{style:i}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(n)),this.render(n);for(const l of this.ft)n[l]==null&&(this.ft.delete(l),l.includes("-")?i.removeProperty(l):i[l]=null);for(const l in n){const c=n[l];if(c!=null){this.ft.add(l);const h=typeof c=="string"&&c.endsWith(K3);l.includes("-")||h?i.setProperty(l,h?c.slice(0,-11):c,h?V_:""):i[l]=c}}return vo}});var X3=Object.defineProperty,J3=Object.getOwnPropertyDescriptor,xa=(r,n,i,l)=>{for(var c=l>1?void 0:l?J3(n,i):n,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(n,i,c):m(c))||c);return l&&c&&X3(n,i,c),c};let ia=class extends Hr{constructor(){super(),this.ariaLabel=null,this.ariaLabelledby=null,this.ariaValueText=null,this.ariaLive="polite",this.id=zf(),this.role="progressbar",this.skin="dark-blue",this.statusPlacement="following",this.statusType="none",this.title="",this.titlePosition="left",this.valueCurrent=0,this.valueMax=100,this.valueMin=0,this.labelWidth=0,this.progressbarId=this.id,this.computedAriaLabelledby=null,this.computedAriaValueText="",this.labelRef=pn(),this.progressBarRef=pn()}firstUpdated(
|
|
1197
|
+
*/const V_="important",K3=" !"+V_,Q3=Rf(class extends Sh{constructor(r){var n;if(super(r),r.type!==fl.ATTRIBUTE||r.name!=="style"||((n=r.strings)==null?void 0:n.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((n,i)=>{const l=r[i];return l==null?n:n+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${l};`},"")}update(r,[n]){const{style:i}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(n)),this.render(n);for(const l of this.ft)n[l]==null&&(this.ft.delete(l),l.includes("-")?i.removeProperty(l):i[l]=null);for(const l in n){const c=n[l];if(c!=null){this.ft.add(l);const h=typeof c=="string"&&c.endsWith(K3);l.includes("-")||h?i.setProperty(l,h?c.slice(0,-11):c,h?V_:""):i[l]=c}}return vo}});var X3=Object.defineProperty,J3=Object.getOwnPropertyDescriptor,xa=(r,n,i,l)=>{for(var c=l>1?void 0:l?J3(n,i):n,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(n,i,c):m(c))||c);return l&&c&&X3(n,i,c),c};let ia=class extends Hr{constructor(){super(),this.ariaLabel=null,this.ariaLabelledby=null,this.ariaValueText=null,this.ariaLive="polite",this.id=zf(),this.role="progressbar",this.skin="dark-blue",this.statusPlacement="following",this.statusType="none",this.title="",this.titlePosition="left",this.valueCurrent=0,this.valueMax=100,this.valueMin=0,this.labelWidth=0,this.progressbarId=this.id,this.computedAriaLabelledby=null,this.computedAriaValueText="",this.labelRef=pn(),this.progressBarRef=pn()}firstUpdated(r){super.firstUpdated(r),this.setComputedValues(),this.syncAttributes()}updated(r){super.updated(r),r.has("valueCurrent")&&this.labelRef.value&&(this.labelWidth=this.labelRef.value.getBoundingClientRect().width||0),r.has("id")&&this.id&&(this.progressBarId=this.id),(r.has("statusType")||r.has("id")||r.has("ariaLabelledby"))&&(this.progressbarId=this.id||zf(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`),(r.has("ariaValueText")||r.has("valueCurrent")||r.has("valueMax"))&&(this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""),this.syncAttributes()}render(){const r=this.statusType!=="none",n=this.valueMax-this.valueMin,i=this.valueCurrent/n*100,l=this.statusType==="fraction"?Math.round(i):Math.round((this.valueCurrent-this.valueMin)/(this.valueMax-this.valueMin)*100),c=`${this.valueCurrent} av ${n}`,h=Bt({"pkt-progressbar__bar":!0,[`pkt-progressbar__bar--${this.skin}`]:!!this.skin}),m=Bt({"pkt-progressbar__title":!0,"pkt-progressbar__title-center":this.titlePosition==="center"}),D=Bt({"pkt-progressbar__status":!0,"pkt-progressbar__status--center":this.statusPlacement==="center"}),C=Bt({"pkt-progressbar__status-placement--following":this.statusPlacement==="following","pkt-progressbar__status-placement--center":this.statusPlacement==="center","pkt-progressbar__status-placement--left":this.statusPlacement==="left"});return be` <div
|
|
1198
1198
|
class="pkt-progressbar__container"
|
|
1199
1199
|
.ref=${this.progressBarRef}
|
|
1200
|
-
style=${Q3({"--pkt-progress-label-width":`${this.labelWidth}px`,"--pkt-progress-width":`${
|
|
1200
|
+
style=${Q3({"--pkt-progress-label-width":`${this.labelWidth}px`,"--pkt-progress-width":`${l}%`})}
|
|
1201
1201
|
>
|
|
1202
|
-
${this.title?be`<p id=${`${this.progressBarId}-title`} class=${
|
|
1202
|
+
${this.title?be`<p id=${`${this.progressBarId}-title`} class=${m}>${this.title}</p>`:Ve}
|
|
1203
1203
|
|
|
1204
1204
|
<div class="pkt-progressbar__bar-wrapper">
|
|
1205
|
-
<div class=${
|
|
1205
|
+
<div class=${h}></div>
|
|
1206
1206
|
</div>
|
|
1207
1207
|
|
|
1208
|
-
${
|
|
1209
|
-
<span class=${
|
|
1210
|
-
${this.statusType==="percentage"?`${
|
|
1208
|
+
${r?be`<div class=${D}>
|
|
1209
|
+
<span class=${C} ${Vt(this.labelRef)}>
|
|
1210
|
+
${this.statusType==="percentage"?`${l}%`:c}
|
|
1211
1211
|
</span>
|
|
1212
1212
|
</div>`:Ve}
|
|
1213
|
-
</div>`}setComputedValues(){this.progressbarId=this.id||zf(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`,this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""}syncAttributes(){this._handleAttribute("aria-live",this.ariaLive),this._handleAttribute("aria-valuenow",this.valueCurrent),this._handleAttribute("aria-valuemin",this.valueMin),this._handleAttribute("aria-valuemax",this.valueMax),this._handleAttribute("aria-valuetext",this.computedAriaValueText),this._handleAttribute("aria-label",this.ariaLabel),this._handleAttribute("role",this.role),this._handleAttribute("aria-atomic","true"),this._handleAttribute("id",this.progressbarId),this.ariaLabel||this._handleAttribute("aria-labelledby",this.computedAriaLabelledby)}_handleAttribute(n
|
|
1213
|
+
</div>`}setComputedValues(){this.progressbarId=this.id||zf(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`,this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""}syncAttributes(){this._handleAttribute("aria-live",this.ariaLive),this._handleAttribute("aria-valuenow",this.valueCurrent),this._handleAttribute("aria-valuemin",this.valueMin),this._handleAttribute("aria-valuemax",this.valueMax),this._handleAttribute("aria-valuetext",this.computedAriaValueText),this._handleAttribute("aria-label",this.ariaLabel),this._handleAttribute("role",this.role),this._handleAttribute("aria-atomic","true"),this._handleAttribute("id",this.progressbarId),this.ariaLabel||this._handleAttribute("aria-labelledby",this.computedAriaLabelledby)}_handleAttribute(r,n){n==null||n===""?this.removeAttribute(r):this.setAttribute(r,String(n))}};xa([z({type:String})],ia.prototype,"ariaLabel",2),xa([z({type:String,reflect:!0})],ia.prototype,"ariaLabelledby",2),xa([z({type:String,reflect:!0})],ia.prototype,"ariaValueText",2),xa([z({type:String})],ia.prototype,"ariaLive",2),xa([z({type:String,reflect:!0})],ia.prototype,"id",2),xa([z({type:String})],ia.prototype,"role",2),xa([z({type:String})],ia.prototype,"skin",2),xa([z({type:String})],ia.prototype,"statusPlacement",2),xa([z({type:String})],ia.prototype,"statusType",2),xa([z({type:String,reflect:!0})],ia.prototype,"title",2),xa([z({type:String})],ia.prototype,"titlePosition",2),xa([z({type:Number,reflect:!0})],ia.prototype,"valueCurrent",2),xa([z({type:Number})],ia.prototype,"valueMax",2),xa([z({type:Number})],ia.prototype,"valueMin",2),xa([$n()],ia.prototype,"labelWidth",2),xa([$n()],ia.prototype,"progressbarId",2),xa([$n()],ia.prototype,"computedAriaLabelledby",2),xa([$n()],ia.prototype,"computedAriaValueText",2),ia=xa([fr("pkt-progressbar")],ia);var Z3=Object.defineProperty,eO=Object.getOwnPropertyDescriptor,Fd=(r,n,i,l)=>{for(var c=l>1?void 0:l?eO(n,i):n,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(n,i,c):m(c))||c);return l&&c&&Z3(n,i,c),c};let mu=class extends dn{constructor(){super(...arguments),this.inputRef=pn(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(r,n,i){r==="defaultChecked"&&(this._checked=this.defaultChecked),r==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(r,n,i)}render(){const r=Bt({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),n=Bt({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),i=Bt({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),l=()=>be`
|
|
1214
1214
|
<label class=${i} for=${this.id+"-internal"}>
|
|
1215
1215
|
${this.label}
|
|
1216
1216
|
${this.checkHelptext?be`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:Ve}
|
|
@@ -1352,7 +1352,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
1352
1352
|
${!this.suffix&&n?be`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>`:Ve}
|
|
1353
1353
|
</div>
|
|
1354
1354
|
</pkt-input-wrapper>
|
|
1355
|
-
`}};gu([z({type:String,reflect:!0})],Fs.prototype,"value",2),gu([z({type:String})],Fs.prototype,"type",2),gu([z({type:Number})],Fs.prototype,"size",2),gu([z({type:String})],Fs.prototype,"autocomplete",2),gu([z({type:String})],Fs.prototype,"iconNameRight",2),gu([z({type:String})],Fs.prototype,"prefix",2),gu([z({type:String})],Fs.prototype,"suffix",2),gu([z({type:Boolean})],Fs.prototype,"omitSearchIcon",2),gu([$n()],Fs.prototype,"counterCurrent",2),Fs=gu([fr("pkt-textinput")],Fs);var oO=Object.defineProperty,sO=Object.getOwnPropertyDescriptor,rb=(r,n,i,l)=>{for(var c=l>1?void 0:l?sO(n,i):n,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(n,i,c):m(c))||c);return l&&c&&oO(n,i,c),c};let Nh=class extends dn{constructor(){super(),this.inputRef=pn(),this.helptextSlot=pn(),this.options=[],this.value="",this._options=[],this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new H_(this),this.slotController=new Ca(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback();const
|
|
1355
|
+
`}};gu([z({type:String,reflect:!0})],Fs.prototype,"value",2),gu([z({type:String})],Fs.prototype,"type",2),gu([z({type:Number})],Fs.prototype,"size",2),gu([z({type:String})],Fs.prototype,"autocomplete",2),gu([z({type:String})],Fs.prototype,"iconNameRight",2),gu([z({type:String})],Fs.prototype,"prefix",2),gu([z({type:String})],Fs.prototype,"suffix",2),gu([z({type:Boolean})],Fs.prototype,"omitSearchIcon",2),gu([$n()],Fs.prototype,"counterCurrent",2),Fs=gu([fr("pkt-textinput")],Fs);var oO=Object.defineProperty,sO=Object.getOwnPropertyDescriptor,rb=(r,n,i,l)=>{for(var c=l>1?void 0:l?sO(n,i):n,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(n,i,c):m(c))||c);return l&&c&&oO(n,i,c),c};let Nh=class extends dn{constructor(){super(),this.inputRef=pn(),this.helptextSlot=pn(),this.options=[],this.value="",this._options=[],this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new H_(this),this.slotController=new Ca(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback();const n=this.options.length>0,i=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!n&&i?this.optionsController.nodes.forEach(l=>{const c={value:l.hasAttribute("value")?l.getAttribute("value")??"":l.textContent??"",label:l.textContent||l.getAttribute("value")||"",disabled:l.hasAttribute("disabled"),hidden:l.hasAttribute("hidden")};l.getAttribute("selected")&&!this.value&&(this.value=c.value),this._options.push(c)}):(this._options=this.options,this._options.forEach(l=>{l.selected&&!this.value&&(this.value=l.value)}))}add(n,i){var l,c,h;(l=this.inputRef.value)==null||l.add(n,i),this._options.push({value:n.value||n.text,label:n.text||n.value,selected:n.selected,disabled:n.disabled}),n.selected&&(this.value=n.value||n.text,this.selectedIndex=this.returnNumberOrNull((c=this.inputRef.value)==null?void 0:c.selectedIndex),this.selectedOptions=(h=this.inputRef.value)==null?void 0:h.selectedOptions),this.requestUpdate()}remove(n){var i,l;typeof n=="number"&&(this.selectedIndex===n&&(this.value=((i=this._options[0])==null?void 0:i.value)||""),(l=this.inputRef.value)==null||l.remove(n))}item(n){var i;return(i=this.inputRef.value)==null?void 0:i.item(n)}namedItem(n){var i;return(i=this.inputRef.value)==null?void 0:i.namedItem(n)}showPicker(){var n;(n=this.inputRef.value)==null||n.showPicker()}attributeChangedCallback(n,i,l){var c,h;n==="options"&&(this._options=l?JSON.parse(l):[]),n==="value"&&this.value!==i&&(this.selectedIndex=this.touched?this.returnNumberOrNull((c=this.inputRef.value)==null?void 0:c.selectedIndex):this.options.findIndex(m=>m.value===l),this.selectedOptions=(h=this.inputRef.value)==null?void 0:h.selectedOptions,this.valueChanged(l,i)),super.attributeChangedCallback(n,i,l)}update(n){var i,l;super.update(n),n.has("value")&&this.value!==n.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex):this.options.findIndex(c=>c.value===this.value),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions,this.valueChanged(this.value,n.get("value"))),n.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(n){var i;super.firstUpdated(n),this.options.length&&(this._options=this.options),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(l=>l.value===this.value),this.selectedOptions=(i=this.inputRef.value)==null?void 0:i.selectedOptions}render(){const n=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return be`
|
|
1356
1356
|
<pkt-input-wrapper
|
|
1357
1357
|
?counter=${this.counter}
|
|
1358
1358
|
?disabled=${this.disabled}
|
|
@@ -1374,7 +1374,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
1374
1374
|
requiredText=${en(this.requiredText)}
|
|
1375
1375
|
>
|
|
1376
1376
|
<select
|
|
1377
|
-
class=${
|
|
1377
|
+
class=${n}
|
|
1378
1378
|
aria-invalid=${this.hasError}
|
|
1379
1379
|
aria-errormessage=${`${this.id}-error`}
|
|
1380
1380
|
aria-labelledby=${en(this.ariaLabelledby)}
|
|
@@ -1382,23 +1382,24 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
1382
1382
|
id=${this.id+"-input"}
|
|
1383
1383
|
name=${(this.name||this.id)+"-input"}
|
|
1384
1384
|
value=${this.value}
|
|
1385
|
-
@change=${
|
|
1386
|
-
@input=${
|
|
1387
|
-
@focus=${
|
|
1388
|
-
@blur=${
|
|
1385
|
+
@change=${i=>{this.touched=!0,this.value=i.target.value,i.stopImmediatePropagation()}}
|
|
1386
|
+
@input=${i=>{this.onInput(),i.stopImmediatePropagation()}}
|
|
1387
|
+
@focus=${i=>{this.onFocus(),i.stopImmediatePropagation()}}
|
|
1388
|
+
@blur=${i=>{this.onBlur(),i.stopImmediatePropagation()}}
|
|
1389
1389
|
${Vt(this.inputRef)}
|
|
1390
1390
|
>
|
|
1391
|
-
${this._options.length>0&&this._options.map(
|
|
1392
|
-
value=${
|
|
1393
|
-
?selected=${this.value==
|
|
1394
|
-
?disabled=${
|
|
1391
|
+
${this._options.length>0&&this._options.map(i=>be`<option
|
|
1392
|
+
value=${i.value}
|
|
1393
|
+
?selected=${this.value==i.value||i.selected}
|
|
1394
|
+
?disabled=${i.disabled}
|
|
1395
|
+
?hidden=${i.hidden}
|
|
1395
1396
|
>
|
|
1396
|
-
${
|
|
1397
|
+
${i.label}
|
|
1397
1398
|
</option>`)}
|
|
1398
1399
|
</select>
|
|
1399
1400
|
<div class="pkt-contents" ${Vt(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
1400
1401
|
</pkt-input-wrapper>
|
|
1401
|
-
`}returnNumberOrNull(
|
|
1402
|
+
`}returnNumberOrNull(n){return n==null||isNaN(n)?null:n}};rb([z({type:Array})],Nh.prototype,"options",2),rb([z({type:String})],Nh.prototype,"value",2),rb([$n()],Nh.prototype,"_options",2),Nh=rb([fr("pkt-select")],Nh);var lO=Object.defineProperty,uO=Object.getOwnPropertyDescriptor,Bg=(r,n,i,l)=>{for(var c=l>1?void 0:l?uO(n,i):n,h=r.length-1,m;h>=0;h--)(m=r[h])&&(c=(l?m(n,i,c):m(c))||c);return l&&c&&lO(n,i,c),c};let Oh=class extends Hr{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=pn(),this.namedSlot=pn(),this.slotController=new Ca(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(r=>{this._list.push(r.toUpperCase())}),super.connectedCallback()}render(){const r={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return be`
|
|
1402
1403
|
<div class="${Bt(r)}">
|
|
1403
1404
|
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
1404
1405
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "12.42.
|
|
3
|
+
"version": "12.42.6",
|
|
4
4
|
"description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@lit-labs/ssr-dom-shim": "^1.2.1",
|
|
40
40
|
"@lit/react": "^1.0.7",
|
|
41
|
-
"@oslokommune/punkt-elements": "^12.42.
|
|
41
|
+
"@oslokommune/punkt-elements": "^12.42.6",
|
|
42
42
|
"angular-html-parser": "^6.0.2",
|
|
43
43
|
"html-format": "^1.1.7",
|
|
44
44
|
"prettier": "^3.3.3",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
113
113
|
},
|
|
114
114
|
"license": "MIT",
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "1d82a7a76a25908e1453c48520da98dfeeae19c2"
|
|
116
116
|
}
|