@oslokommune/punkt-elements 16.7.0 → 16.7.3
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 +34 -0
- package/dist/accordionitem-_9AiCIvd.cjs +34 -0
- package/dist/{accordionitem-ZlaXvjt5.js → accordionitem-dCfSrxh5.js} +57 -55
- package/dist/alert-BtOk8yRH.cjs +33 -0
- package/dist/{alert-BuAXrnKl.js → alert-DlY2_grU.js} +48 -46
- package/dist/backlink-Ce5Vldop.js +49 -0
- package/dist/backlink-y3dwjKPC.cjs +13 -0
- package/dist/button-B_TXwNzt.cjs +27 -0
- package/dist/{button-DEyvt1LI.js → button-BiY-wlKF.js} +79 -77
- package/dist/calendar-B2pji2zn.cjs +90 -0
- package/dist/{calendar-S63oreVW.js → calendar-DhjQDC4C.js} +689 -687
- package/dist/card-BwMNB5Bb.cjs +87 -0
- package/dist/{card-DDiLfuO4.js → card-CGlmcMSR.js} +99 -97
- package/dist/checkbox-BsJZYA26.js +147 -0
- package/dist/checkbox-CTY8f_qn.cjs +31 -0
- package/dist/{combobox-BmxSecfE.js → combobox-DSB5WOxg.js} +223 -226
- package/dist/{combobox-Hb2V-fPX.cjs → combobox-DbICIgKG.cjs} +4 -4
- package/dist/consent-DkOQpbsg.cjs +11 -0
- package/dist/{consent-iXyx5v6J.js → consent-SNWV_mMU.js} +48 -46
- package/dist/datepicker-BEWl9iz3.cjs +273 -0
- package/dist/{datepicker-CZl7b8Na.js → datepicker-euHyzXnb.js} +341 -329
- package/dist/{heading-CKt7cVn7.js → heading-D2tVS6lS.js} +30 -28
- package/dist/heading-DrzbgDb6.cjs +1 -0
- package/dist/helptext-BKtU4mas.js +82 -0
- package/dist/helptext-DcRC7wW2.cjs +24 -0
- package/dist/icon-CxQcIa5F.js +105 -0
- package/dist/icon-q81vqPK_.cjs +9 -0
- package/dist/input-wrapper-Bs4CRNst.js +181 -0
- package/dist/input-wrapper-Bv9aqqVq.cjs +54 -0
- package/dist/link-C0rl-86s.cjs +7 -0
- package/dist/link-Cdqgl60z.js +55 -0
- package/dist/linkcard-Dimu7Rlx.cjs +13 -0
- package/dist/linkcard-Lbq_UhjZ.js +56 -0
- package/dist/{listbox-BQKDZvZn.js → listbox-Bia4_tvN.js} +131 -129
- package/dist/listbox-La2GZQei.cjs +106 -0
- package/dist/loader-D1ugDXGV.cjs +16 -0
- package/dist/{loader-Ci3CHU8k.js → loader-DyN6RGC5.js} +51 -49
- package/dist/messagebox-BGMVm2t9.js +71 -0
- package/dist/messagebox-M0yIgCz9.cjs +13 -0
- package/dist/modal-CMO1RtIi.cjs +36 -0
- package/dist/{modal-DzGe1g8Z.js → modal-DjPQDE-Z.js} +53 -51
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -2
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +3 -4
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +2 -3
- package/dist/pkt-breadcrumbs.cjs +11 -11
- package/dist/pkt-breadcrumbs.js +30 -28
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +3 -4
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +2 -3
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +2 -3
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +3 -4
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +3 -4
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +2 -3
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +7 -8
- package/dist/pkt-header.cjs +35 -35
- package/dist/pkt-header.js +224 -218
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +3 -4
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +3 -4
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +3 -4
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +26 -26
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +2 -3
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +2 -3
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +3 -4
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +3 -4
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +3 -4
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +3 -4
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +3 -4
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -3
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +3 -4
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +3 -4
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +2 -2
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +3 -4
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +3 -4
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +3 -4
- package/dist/pkt-timepicker.cjs +22 -19
- package/dist/pkt-timepicker.js +84 -76
- package/dist/progressbar-BqlMzkM_.cjs +21 -0
- package/dist/{progressbar-By7e0lEI.js → progressbar-sbHDFC12.js} +88 -88
- package/dist/radiobutton-5ZqVVtTT.cjs +31 -0
- package/dist/{radiobutton-6frNG9J_.js → radiobutton-D8Ai8ETa.js} +44 -42
- package/dist/select-De-n8on9.js +230 -0
- package/dist/select-dTWibR6_.cjs +49 -0
- package/dist/tabitem-B9-jeV97.js +334 -0
- package/dist/tabitem-BnhzqfW3.cjs +65 -0
- package/dist/tag-CbwO8yvD.cjs +27 -0
- package/dist/{tag-BuCpqaks.js → tag-D4FI5t3y.js} +42 -40
- package/dist/textarea-BmLaKzsc.cjs +50 -0
- package/dist/{textarea-Bzuymclz.js → textarea-CMiSJaYL.js} +62 -60
- package/dist/textinput-em9y4yrL.cjs +70 -0
- package/dist/{textinput-9lHjs4ce.js → textinput-r8udK0IX.js} +57 -55
- package/package.json +2 -2
- package/src/components/accordion/accordion.ts +6 -1
- package/src/components/accordion/accordionitem.ts +6 -1
- package/src/components/alert/alert.ts +6 -1
- package/src/components/backlink/backlink.ts +6 -1
- package/src/components/breadcrumbs/breadcrumbs.ts +6 -1
- package/src/components/button/button.ts +6 -1
- package/src/components/calendar/calendar.ts +6 -1
- package/src/components/card/card.ts +6 -1
- package/src/components/checkbox/checkbox.ts +6 -1
- package/src/components/combobox/combobox.ts +6 -1
- package/src/components/consent/consent.ts +6 -1
- package/src/components/datepicker/date-tags.ts +6 -1
- package/src/components/datepicker/datepicker-multiple.ts +6 -1
- package/src/components/datepicker/datepicker-popup.ts +6 -1
- package/src/components/datepicker/datepicker-range.ts +6 -1
- package/src/components/datepicker/datepicker-single.ts +6 -1
- package/src/components/datepicker/datepicker.ts +6 -1
- package/src/components/header/header-service.ts +6 -1
- package/src/components/header/header-user-menu.ts +6 -1
- package/src/components/header/header.ts +6 -1
- package/src/components/heading/heading.ts +6 -1
- package/src/components/helptext/helptext.ts +6 -1
- package/src/components/icon/icon.ts +6 -1
- package/src/components/input-wrapper/input-wrapper.ts +6 -1
- package/src/components/link/link.ts +6 -1
- package/src/components/linkcard/linkcard.ts +6 -1
- package/src/components/listbox/listbox.ts +6 -1
- package/src/components/loader/loader.ts +6 -1
- package/src/components/messagebox/messagebox.ts +6 -1
- package/src/components/modal/modal.ts +6 -1
- package/src/components/progressbar/progressbar.ts +6 -1
- package/src/components/radiobutton/radiobutton.ts +6 -1
- package/src/components/select/select.ts +6 -1
- package/src/components/tabs/tabitem.ts +6 -1
- package/src/components/tabs/tabs.ts +6 -1
- package/src/components/tag/tag.ts +6 -1
- package/src/components/textarea/textarea.ts +6 -1
- package/src/components/textinput/textinput.ts +6 -1
- package/src/components/timepicker/timepicker.ts +14 -2
- package/dist/accordionitem-D1Agl1bB.cjs +0 -34
- package/dist/alert-DFkFNTxh.cjs +0 -33
- package/dist/backlink-EiAXUUZP.cjs +0 -13
- package/dist/backlink-V4DAt17e.js +0 -47
- package/dist/button-DYv5Dg4M.cjs +0 -27
- package/dist/calendar-HIE9nxcc.cjs +0 -90
- package/dist/card-CyeH6l1c.cjs +0 -87
- package/dist/checkbox-BLlwTABj.cjs +0 -31
- package/dist/checkbox-ejBUa5qQ.js +0 -145
- package/dist/consent-ruWAEVXW.cjs +0 -11
- package/dist/datepicker-D2H7U6MS.cjs +0 -273
- package/dist/heading-Cvz8m1xL.cjs +0 -1
- package/dist/helptext-5Mzp65-F.cjs +0 -24
- package/dist/helptext-jIoWRcCF.js +0 -80
- package/dist/icon-BlKA8YuW.js +0 -103
- package/dist/icon-Bqj9oBbl.cjs +0 -9
- package/dist/input-wrapper-B0MkQ0IZ.cjs +0 -54
- package/dist/input-wrapper-B2JpK016.js +0 -179
- package/dist/link-R_lNhViF.cjs +0 -7
- package/dist/link-Z_GizclR.js +0 -53
- package/dist/linkcard-BlQvdB1a.js +0 -54
- package/dist/linkcard-C7HbSLlX.cjs +0 -13
- package/dist/listbox-CGgV9MAe.cjs +0 -106
- package/dist/loader-e2gs_1xz.cjs +0 -16
- package/dist/messagebox-Bf-XMlvW.js +0 -69
- package/dist/messagebox-D67w71VX.cjs +0 -13
- package/dist/modal-CyvEkbfQ.cjs +0 -36
- package/dist/progressbar-DsJ2B9Vm.cjs +0 -21
- package/dist/radiobutton-Bv-BZ1Hw.cjs +0 -31
- package/dist/select-CXZt1nHS.js +0 -228
- package/dist/select-WFhS4Vfp.cjs +0 -49
- package/dist/tabitem-CB8wkKmv.js +0 -332
- package/dist/tabitem-DZpspU4Q.cjs +0 -65
- package/dist/tag-X6xdjR0N.cjs +0 -27
- package/dist/textarea-DoeHJ7HR.cjs +0 -50
- package/dist/textinput-BNsLd26i.cjs +0 -70
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";const t=require("./element-gR_VtSiD.cjs"),u=require("./state-Dg-53wQ8.cjs"),d=require("./input-element-DdVhUvva.cjs"),o=require("./ref-CL-Xk9Xm.cjs"),h=require("./class-map-CsENJXf1.cjs");var k=Object.defineProperty,s=(c,i,a,p)=>{for(var n=void 0,l=c.length-1,r;l>=0;l--)(r=c[l])&&(n=r(i,a,n)||n);return n&&k(i,a,n),n};class e extends d.PktInputElement{constructor(){super(...arguments),this.inputRef=o.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(i,a,p){i==="defaultChecked"&&(this._checked=this.defaultChecked),i==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(i,a,p)}render(){const i=h.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),a=h.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),p=h.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),n="pkt-tag pkt-tag--small pkt-tag--thin-text",l=()=>t.b`
|
|
2
|
+
${this.tagText?t.b`<span class=${n+" pkt-tag--gray"}>${this.tagText}</span>`:t.A}
|
|
3
|
+
${this.optionalTag?t.b`<span class=${n+" pkt-tag--blue-light"}>${this.optionalText}</span>`:t.A}
|
|
4
|
+
${this.requiredTag?t.b`<span class=${n+" pkt-tag--beige"}>${this.requiredText}</span>`:t.A}
|
|
5
|
+
`,r=()=>t.b`
|
|
6
|
+
<label class=${p} for=${this.id+"-internal"}>
|
|
7
|
+
${this.label} ${l()}
|
|
8
|
+
${this.checkHelptext?t.b`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:t.A}
|
|
9
|
+
</label>
|
|
10
|
+
`;return t.b`
|
|
11
|
+
<div class="pkt-input-check">
|
|
12
|
+
<div class=${i}>
|
|
13
|
+
<input
|
|
14
|
+
id=${this.id+"-internal"}
|
|
15
|
+
class=${a}
|
|
16
|
+
type="radio"
|
|
17
|
+
role="radio"
|
|
18
|
+
?disabled=${this.disabled}
|
|
19
|
+
form=""
|
|
20
|
+
name=${this.name+"-internal"}
|
|
21
|
+
${o.n(this.inputRef)}
|
|
22
|
+
@change=${this.toggleChecked}
|
|
23
|
+
@input=${this.onInput}
|
|
24
|
+
@blur=${this.onBlur}
|
|
25
|
+
@focus=${this.onFocus}
|
|
26
|
+
?checked=${this.checked}
|
|
27
|
+
/>
|
|
28
|
+
${r()}
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
`}toggleChecked(i=null){i&&i.preventDefault(),i&&i.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(":checked"),this.valueChecked(this._checked))}}s([t.n({type:String,reflect:!0})],e.prototype,"value");s([t.n({type:String})],e.prototype,"checkHelptext");s([t.n({type:Boolean})],e.prototype,"defaultChecked");s([t.n({type:Boolean})],e.prototype,"hasTile");s([t.n({type:Boolean,reflect:!0})],e.prototype,"checked");s([t.n({type:String,reflect:!0})],e.prototype,"type");s([t.n({type:String})],e.prototype,"tagText");s([t.n({type:Boolean})],e.prototype,"optionalTag");s([t.n({type:String})],e.prototype,"optionalText");s([t.n({type:Boolean})],e.prototype,"requiredTag");s([t.n({type:String})],e.prototype,"requiredText");s([u.r()],e.prototype,"_checked");try{t.t("pkt-radiobutton")(e)}catch{console.warn("Forsøker å definere <pkt-radiobutton>, men den er allerede definert")}exports.PktRadioButton=e;
|
|
@@ -1,111 +1,113 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as d, b as l, A as o, n as s } from "./element-CPpT3rFQ.js";
|
|
2
2
|
import { r as k } from "./state-C_1EOo3D.js";
|
|
3
3
|
import { P as f } from "./input-element-8nLwuQS4.js";
|
|
4
|
-
import { e as g, n as
|
|
4
|
+
import { e as g, n as y } from "./ref-Bg_Swj5w.js";
|
|
5
5
|
import { e as u } from "./class-map-CEnykyO_.js";
|
|
6
|
-
var
|
|
7
|
-
for (var
|
|
8
|
-
(
|
|
9
|
-
return
|
|
6
|
+
var b = Object.defineProperty, i = (n, t, p, c) => {
|
|
7
|
+
for (var a = void 0, r = n.length - 1, h; r >= 0; r--)
|
|
8
|
+
(h = n[r]) && (a = h(t, p, a) || a);
|
|
9
|
+
return a && b(t, p, a), a;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
class e extends f {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments), this.inputRef = g(), this.value = "", this.checkHelptext = null, this.defaultChecked = !1, this.hasTile = !1, this.checked = null, this.type = "radio", this.tagText = null, this.optionalTag = !1, this.optionalText = "Valgfritt", this.requiredTag = !1, this.requiredText = "Må fylles ut", this._checked = !1;
|
|
14
14
|
}
|
|
15
15
|
connectedCallback() {
|
|
16
16
|
super.connectedCallback();
|
|
17
17
|
}
|
|
18
|
-
attributeChangedCallback(
|
|
19
|
-
|
|
18
|
+
attributeChangedCallback(t, p, c) {
|
|
19
|
+
t === "defaultChecked" && (this._checked = this.defaultChecked), t === "checked" && (this._checked = this.checked === "" || this.checked === "true" || this.checked === !0), super.attributeChangedCallback(t, p, c);
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
|
-
const
|
|
22
|
+
const t = u({
|
|
23
23
|
"pkt-input-check__input": !0,
|
|
24
24
|
"pkt-input-check__input--tile": this.hasTile,
|
|
25
25
|
"pkt-input-check__input--tile-disabled": this.disabled && this.hasTile
|
|
26
|
-
}),
|
|
26
|
+
}), p = u({
|
|
27
27
|
"pkt-input-check__input-checkbox": !0,
|
|
28
28
|
"pkt-input-check__input-checkbox--error": this.hasError
|
|
29
29
|
}), c = u({
|
|
30
30
|
"pkt-input-check__input-label": !0,
|
|
31
31
|
"pkt-input-check__input-label--disabled": this.disabled,
|
|
32
32
|
"pkt-sr-only": this.hideLabel
|
|
33
|
-
}),
|
|
34
|
-
${this.tagText ?
|
|
35
|
-
${this.optionalTag ?
|
|
36
|
-
${this.requiredTag ?
|
|
37
|
-
`,
|
|
33
|
+
}), a = "pkt-tag pkt-tag--small pkt-tag--thin-text", r = () => l`
|
|
34
|
+
${this.tagText ? l`<span class=${a + " pkt-tag--gray"}>${this.tagText}</span>` : o}
|
|
35
|
+
${this.optionalTag ? l`<span class=${a + " pkt-tag--blue-light"}>${this.optionalText}</span>` : o}
|
|
36
|
+
${this.requiredTag ? l`<span class=${a + " pkt-tag--beige"}>${this.requiredText}</span>` : o}
|
|
37
|
+
`, h = () => l`
|
|
38
38
|
<label class=${c} for=${this.id + "-internal"}>
|
|
39
|
-
${this.label} ${
|
|
40
|
-
${this.checkHelptext ?
|
|
39
|
+
${this.label} ${r()}
|
|
40
|
+
${this.checkHelptext ? l`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>` : o}
|
|
41
41
|
</label>
|
|
42
42
|
`;
|
|
43
|
-
return
|
|
43
|
+
return l`
|
|
44
44
|
<div class="pkt-input-check">
|
|
45
|
-
<div class=${
|
|
45
|
+
<div class=${t}>
|
|
46
46
|
<input
|
|
47
47
|
id=${this.id + "-internal"}
|
|
48
|
-
class=${
|
|
48
|
+
class=${p}
|
|
49
49
|
type="radio"
|
|
50
50
|
role="radio"
|
|
51
51
|
?disabled=${this.disabled}
|
|
52
52
|
form=""
|
|
53
53
|
name=${this.name + "-internal"}
|
|
54
|
-
${
|
|
54
|
+
${y(this.inputRef)}
|
|
55
55
|
@change=${this.toggleChecked}
|
|
56
56
|
@input=${this.onInput}
|
|
57
57
|
@blur=${this.onBlur}
|
|
58
58
|
@focus=${this.onFocus}
|
|
59
59
|
?checked=${this.checked}
|
|
60
60
|
/>
|
|
61
|
-
${
|
|
61
|
+
${h()}
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
64
64
|
`;
|
|
65
65
|
}
|
|
66
|
-
toggleChecked(
|
|
67
|
-
|
|
66
|
+
toggleChecked(t = null) {
|
|
67
|
+
t && t.preventDefault(), t && t.stopImmediatePropagation(), this.touched = !0, this.inputRef.value && (this._checked = this.inputRef.value.matches(":checked"), this.valueChecked(this._checked));
|
|
68
68
|
}
|
|
69
|
-
}
|
|
69
|
+
}
|
|
70
70
|
i([
|
|
71
71
|
s({ type: String, reflect: !0 })
|
|
72
|
-
],
|
|
72
|
+
], e.prototype, "value");
|
|
73
73
|
i([
|
|
74
74
|
s({ type: String })
|
|
75
|
-
],
|
|
75
|
+
], e.prototype, "checkHelptext");
|
|
76
76
|
i([
|
|
77
77
|
s({ type: Boolean })
|
|
78
|
-
],
|
|
78
|
+
], e.prototype, "defaultChecked");
|
|
79
79
|
i([
|
|
80
80
|
s({ type: Boolean })
|
|
81
|
-
],
|
|
81
|
+
], e.prototype, "hasTile");
|
|
82
82
|
i([
|
|
83
83
|
s({ type: Boolean, reflect: !0 })
|
|
84
|
-
],
|
|
84
|
+
], e.prototype, "checked");
|
|
85
85
|
i([
|
|
86
86
|
s({ type: String, reflect: !0 })
|
|
87
|
-
],
|
|
87
|
+
], e.prototype, "type");
|
|
88
88
|
i([
|
|
89
89
|
s({ type: String })
|
|
90
|
-
],
|
|
90
|
+
], e.prototype, "tagText");
|
|
91
91
|
i([
|
|
92
92
|
s({ type: Boolean })
|
|
93
|
-
],
|
|
93
|
+
], e.prototype, "optionalTag");
|
|
94
94
|
i([
|
|
95
95
|
s({ type: String })
|
|
96
|
-
],
|
|
96
|
+
], e.prototype, "optionalText");
|
|
97
97
|
i([
|
|
98
98
|
s({ type: Boolean })
|
|
99
|
-
],
|
|
99
|
+
], e.prototype, "requiredTag");
|
|
100
100
|
i([
|
|
101
101
|
s({ type: String })
|
|
102
|
-
],
|
|
102
|
+
], e.prototype, "requiredText");
|
|
103
103
|
i([
|
|
104
104
|
k()
|
|
105
|
-
],
|
|
106
|
-
|
|
107
|
-
d("pkt-radiobutton")
|
|
108
|
-
|
|
105
|
+
], e.prototype, "_checked");
|
|
106
|
+
try {
|
|
107
|
+
d("pkt-radiobutton")(e);
|
|
108
|
+
} catch {
|
|
109
|
+
console.warn("Forsøker å definere <pkt-radiobutton>, men den er allerede definert");
|
|
110
|
+
}
|
|
109
111
|
export {
|
|
110
|
-
|
|
112
|
+
e as P
|
|
111
113
|
};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { n as h, t as c, b as a } from "./element-CPpT3rFQ.js";
|
|
2
|
+
import { e as v, n as f } from "./ref-Bg_Swj5w.js";
|
|
3
|
+
import { o as n } from "./if-defined-B0krMLad.js";
|
|
4
|
+
import { r as _ } from "./state-C_1EOo3D.js";
|
|
5
|
+
import { P as $ } from "./input-element-8nLwuQS4.js";
|
|
6
|
+
import { P as x } from "./pkt-options-controller-B5YalfCb.js";
|
|
7
|
+
import { s as m } from "./element-with-slot-Dqk6-TRR.js";
|
|
8
|
+
import "./input-wrapper-Bs4CRNst.js";
|
|
9
|
+
var b = Object.defineProperty, u = (r, t, e, i) => {
|
|
10
|
+
for (var s = void 0, o = r.length - 1, l; o >= 0; o--)
|
|
11
|
+
(l = r[o]) && (s = l(t, e, s) || s);
|
|
12
|
+
return s && b(t, e, s), s;
|
|
13
|
+
};
|
|
14
|
+
class p extends $ {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments), this._optionsProp = [], this._options = [];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Public getter for options that includes selected state
|
|
20
|
+
* Override this in subclasses to customize the selected state logic
|
|
21
|
+
*/
|
|
22
|
+
get options() {
|
|
23
|
+
return this._options.map((t) => ({
|
|
24
|
+
...t,
|
|
25
|
+
selected: this.isOptionSelected(t)
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Public setter for options
|
|
30
|
+
*/
|
|
31
|
+
set options(t) {
|
|
32
|
+
this._optionsProp = t, this.requestUpdate("_optionsProp", this._options);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Determines if an option is selected
|
|
36
|
+
* Subclasses should override this to implement their selection logic
|
|
37
|
+
*
|
|
38
|
+
* @param option - The option to check
|
|
39
|
+
* @returns True if the option is selected
|
|
40
|
+
* @protected
|
|
41
|
+
*/
|
|
42
|
+
isOptionSelected(t) {
|
|
43
|
+
return Array.isArray(this.value) ? this.value.includes(t.value) : t.value === this.value;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Finds an option by its value
|
|
47
|
+
*
|
|
48
|
+
* @param value - The value to search for
|
|
49
|
+
* @returns The option if found, undefined otherwise
|
|
50
|
+
* @protected
|
|
51
|
+
*/
|
|
52
|
+
findOptionByValue(t) {
|
|
53
|
+
return this._options.find((e) => e.value === t);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Gets all currently selected options
|
|
57
|
+
*
|
|
58
|
+
* @returns Array of selected options
|
|
59
|
+
* @protected
|
|
60
|
+
*/
|
|
61
|
+
getSelectedOptions() {
|
|
62
|
+
return this._options.filter((t) => this.isOptionSelected(t));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Parses options from either props or slot controller
|
|
66
|
+
* Call this in connectedCallback to initialize options
|
|
67
|
+
*
|
|
68
|
+
* @protected
|
|
69
|
+
*/
|
|
70
|
+
parseOptions() {
|
|
71
|
+
var i, s;
|
|
72
|
+
const t = this._optionsProp.length > 0, e = ((s = (i = this.optionsController) == null ? void 0 : i.nodes) == null ? void 0 : s.length) && this.optionsController.nodes.length > 0;
|
|
73
|
+
t ? this._options = this._optionsProp : e && (this._options = this.optionsController.options);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Re-parse options when the component updates
|
|
77
|
+
* This ensures options stay in sync when they change dynamically
|
|
78
|
+
*
|
|
79
|
+
* @protected
|
|
80
|
+
*/
|
|
81
|
+
willUpdate(t) {
|
|
82
|
+
super.willUpdate(t), this.parseOptions();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
u([
|
|
86
|
+
h({ type: Array, attribute: "options" })
|
|
87
|
+
], p.prototype, "_optionsProp");
|
|
88
|
+
u([
|
|
89
|
+
_()
|
|
90
|
+
], p.prototype, "_options");
|
|
91
|
+
var g = Object.defineProperty, I = (r, t, e, i) => {
|
|
92
|
+
for (var s = void 0, o = r.length - 1, l; o >= 0; o--)
|
|
93
|
+
(l = r[o]) && (s = l(t, e, s) || s);
|
|
94
|
+
return s && g(t, e, s), s;
|
|
95
|
+
};
|
|
96
|
+
class d extends p {
|
|
97
|
+
constructor() {
|
|
98
|
+
super(), this.inputRef = v(), this.value = "", this.selectedIndex = -1, this.selectedOptions = void 0, this.optionsController = new x(this);
|
|
99
|
+
}
|
|
100
|
+
connectedCallback() {
|
|
101
|
+
super.connectedCallback(), this.parseOptions(), this._options.forEach((t) => {
|
|
102
|
+
t.selected && !this.value && (this.value = t.value);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
// Support native Select method `add`
|
|
106
|
+
add(t, e) {
|
|
107
|
+
const i = {
|
|
108
|
+
value: t.value || t.text,
|
|
109
|
+
label: t.text || t.value,
|
|
110
|
+
selected: t.selected,
|
|
111
|
+
disabled: t.disabled
|
|
112
|
+
};
|
|
113
|
+
if (e === void 0)
|
|
114
|
+
this._options.push(i);
|
|
115
|
+
else if (typeof e == "number")
|
|
116
|
+
this._options.splice(e, 0, i);
|
|
117
|
+
else {
|
|
118
|
+
const s = e.value || e.text, o = this._options.findIndex((l) => l.value === s);
|
|
119
|
+
o >= 0 ? this._options.splice(o, 0, i) : this._options.push(i);
|
|
120
|
+
}
|
|
121
|
+
t.selected && (this.value = t.value || t.text, this.selectedIndex = this._options.findIndex((s) => s.value === this.value)), this.requestUpdate();
|
|
122
|
+
}
|
|
123
|
+
// Support native Select method `remove`
|
|
124
|
+
remove(t) {
|
|
125
|
+
var e;
|
|
126
|
+
typeof t == "number" && (this.selectedIndex === t && (this.value = ((e = this._options[0]) == null ? void 0 : e.value) || ""), this._options.splice(t, 1), this.requestUpdate());
|
|
127
|
+
}
|
|
128
|
+
// Support native Select method `item`
|
|
129
|
+
item(t) {
|
|
130
|
+
var e;
|
|
131
|
+
return (e = this.inputRef.value) == null ? void 0 : e.item(t);
|
|
132
|
+
}
|
|
133
|
+
// Support native Select method `namedItem`
|
|
134
|
+
namedItem(t) {
|
|
135
|
+
var e;
|
|
136
|
+
return (e = this.inputRef.value) == null ? void 0 : e.namedItem(t);
|
|
137
|
+
}
|
|
138
|
+
// Support native Select method `showPicker`
|
|
139
|
+
showPicker() {
|
|
140
|
+
this.inputRef.value && "showPicker" in this.inputRef.value && this.inputRef.value.showPicker();
|
|
141
|
+
}
|
|
142
|
+
attributeChangedCallback(t, e, i) {
|
|
143
|
+
var s, o;
|
|
144
|
+
t === "options" && (this._options = i ? JSON.parse(i) : []), t === "value" && this.value !== e && (this.selectedIndex = this.touched ? this.returnNumberOrNull((s = this.inputRef.value) == null ? void 0 : s.selectedIndex) : this._options.findIndex((l) => l.value === i), this.selectedOptions = (o = this.inputRef.value) == null ? void 0 : o.selectedOptions, this.valueChanged(i, e)), super.attributeChangedCallback(t, e, i);
|
|
145
|
+
}
|
|
146
|
+
update(t) {
|
|
147
|
+
var e, i;
|
|
148
|
+
super.update(t), t.has("_optionsProp") && this._optionsProp.length > 0 && (this._options = this._optionsProp, this.requestUpdate("_options"), !this.value && this._options.length > 0 && (this.value = this._options[0].value, this.selectedIndex = 0)), t.has("value") && this.value !== t.get("value") && (this.selectedIndex = this.touched ? this.returnNumberOrNull((e = this.inputRef.value) == null ? void 0 : e.selectedIndex) : this._options.findIndex((s) => s.value === this.value), this.selectedOptions = (i = this.inputRef.value) == null ? void 0 : i.selectedOptions, this.valueChanged(this.value, t.get("value"))), t.has("id") && !this.name && this.id && (this.name = this.id);
|
|
149
|
+
}
|
|
150
|
+
firstUpdated(t) {
|
|
151
|
+
var e;
|
|
152
|
+
super.firstUpdated(t), this._optionsProp.length && (this._options = this._optionsProp), !this.value && this._options.length > 0 ? (this.value = this._options[0].value, this.selectedIndex = 0) : this.selectedIndex = this._options.findIndex((i) => i.value === this.value), this.selectedOptions = (e = this.inputRef.value) == null ? void 0 : e.selectedOptions;
|
|
153
|
+
}
|
|
154
|
+
render() {
|
|
155
|
+
const t = `pkt-input ${this.fullwidth ? "pkt-input--fullwidth" : ""}`;
|
|
156
|
+
return a`
|
|
157
|
+
<pkt-input-wrapper
|
|
158
|
+
?counter=${this.counter}
|
|
159
|
+
?disabled=${this.disabled}
|
|
160
|
+
?hasError=${this.hasError}
|
|
161
|
+
?hasFieldset=${this.hasFieldset}
|
|
162
|
+
?inline=${this.inline}
|
|
163
|
+
?optionalTag=${this.optionalTag}
|
|
164
|
+
?requiredTag=${this.requiredTag}
|
|
165
|
+
useWrapper=${this.useWrapper}
|
|
166
|
+
ariaDescribedBy=${n(this.ariaDescribedBy)}
|
|
167
|
+
class="pkt-select"
|
|
168
|
+
errorMessage=${n(this.errorMessage)}
|
|
169
|
+
forId=${this.id + "-input"}
|
|
170
|
+
helptext=${n(this.helptext)}
|
|
171
|
+
helptextDropdown=${n(this.helptextDropdown)}
|
|
172
|
+
helptextDropdownButton=${n(this.helptextDropdownButton)}
|
|
173
|
+
label=${n(this.label)}
|
|
174
|
+
optionalText=${n(this.optionalText)}
|
|
175
|
+
requiredText=${n(this.requiredText)}
|
|
176
|
+
tagText=${n(this.tagText)}
|
|
177
|
+
>
|
|
178
|
+
<select
|
|
179
|
+
class=${t}
|
|
180
|
+
aria-invalid=${this.hasError}
|
|
181
|
+
aria-errormessage=${`${this.id}-error`}
|
|
182
|
+
aria-labelledby=${n(this.ariaLabelledby)}
|
|
183
|
+
?disabled=${this.disabled}
|
|
184
|
+
id=${this.id + "-input"}
|
|
185
|
+
name=${(this.name || this.id) + "-input"}
|
|
186
|
+
value=${this.value}
|
|
187
|
+
@change=${(e) => {
|
|
188
|
+
this.touched = !0, this.value = e.target.value, e.stopImmediatePropagation();
|
|
189
|
+
}}
|
|
190
|
+
@input=${(e) => {
|
|
191
|
+
this.onInput(), e.stopImmediatePropagation();
|
|
192
|
+
}}
|
|
193
|
+
@focus=${(e) => {
|
|
194
|
+
this.onFocus(), e.stopImmediatePropagation();
|
|
195
|
+
}}
|
|
196
|
+
@blur=${(e) => {
|
|
197
|
+
this.onBlur(), e.stopImmediatePropagation();
|
|
198
|
+
}}
|
|
199
|
+
${f(this.inputRef)}
|
|
200
|
+
>
|
|
201
|
+
${this._options.length > 0 ? this._options.map(
|
|
202
|
+
(e) => a`<option
|
|
203
|
+
value=${e.value}
|
|
204
|
+
?selected=${this.value == e.value || e.selected}
|
|
205
|
+
?disabled=${e.disabled}
|
|
206
|
+
?hidden=${e.hidden}
|
|
207
|
+
>
|
|
208
|
+
${e.label}
|
|
209
|
+
</option>`
|
|
210
|
+
) : ""}
|
|
211
|
+
</select>
|
|
212
|
+
<div class="pkt-contents" slot="helptext">${m(this, "helptext")}</div>
|
|
213
|
+
</pkt-input-wrapper>
|
|
214
|
+
`;
|
|
215
|
+
}
|
|
216
|
+
returnNumberOrNull(t) {
|
|
217
|
+
return t == null || isNaN(t) ? null : t;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
I([
|
|
221
|
+
h({ type: String })
|
|
222
|
+
], d.prototype, "value");
|
|
223
|
+
try {
|
|
224
|
+
c("pkt-select")(d);
|
|
225
|
+
} catch {
|
|
226
|
+
console.warn("Forsøker å definere <pkt-select>, men den er allerede definert");
|
|
227
|
+
}
|
|
228
|
+
export {
|
|
229
|
+
d as P
|
|
230
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";const p=require("./element-gR_VtSiD.cjs"),u=require("./ref-CL-Xk9Xm.cjs"),n=require("./if-defined-BOW3ODSj.cjs"),c=require("./state-Dg-53wQ8.cjs"),v=require("./input-element-DdVhUvva.cjs"),f=require("./pkt-options-controller-5LXbEzuk.cjs"),_=require("./element-with-slot-ZX-up7jO.cjs");require("./input-wrapper-Bv9aqqVq.cjs");var $=Object.defineProperty,d=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,l;o>=0;o--)(l=r[o])&&(s=l(t,e,s)||s);return s&&$(t,e,s),s};class h extends v.PktInputElement{constructor(){super(...arguments),this._optionsProp=[],this._options=[]}get options(){return this._options.map(t=>({...t,selected:this.isOptionSelected(t)}))}set options(t){this._optionsProp=t,this.requestUpdate("_optionsProp",this._options)}isOptionSelected(t){return Array.isArray(this.value)?this.value.includes(t.value):t.value===this.value}findOptionByValue(t){return this._options.find(e=>e.value===t)}getSelectedOptions(){return this._options.filter(t=>this.isOptionSelected(t))}parseOptions(){var i,s;const t=this._optionsProp.length>0,e=((s=(i=this.optionsController)==null?void 0:i.nodes)==null?void 0:s.length)&&this.optionsController.nodes.length>0;t?this._options=this._optionsProp:e&&(this._options=this.optionsController.options)}willUpdate(t){super.willUpdate(t),this.parseOptions()}}d([p.n({type:Array,attribute:"options"})],h.prototype,"_optionsProp");d([c.r()],h.prototype,"_options");var x=Object.defineProperty,b=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,l;o>=0;o--)(l=r[o])&&(s=l(t,e,s)||s);return s&&x(t,e,s),s};class a extends h{constructor(){super(),this.inputRef=u.e(),this.value="",this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new f.PktOptionsSlotController(this)}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(t=>{t.selected&&!this.value&&(this.value=t.value)})}add(t,e){const i={value:t.value||t.text,label:t.text||t.value,selected:t.selected,disabled:t.disabled};if(e===void 0)this._options.push(i);else if(typeof e=="number")this._options.splice(e,0,i);else{const s=e.value||e.text,o=this._options.findIndex(l=>l.value===s);o>=0?this._options.splice(o,0,i):this._options.push(i)}t.selected&&(this.value=t.value||t.text,this.selectedIndex=this._options.findIndex(s=>s.value===this.value)),this.requestUpdate()}remove(t){var e;typeof t=="number"&&(this.selectedIndex===t&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),this._options.splice(t,1),this.requestUpdate())}item(t){var e;return(e=this.inputRef.value)==null?void 0:e.item(t)}namedItem(t){var e;return(e=this.inputRef.value)==null?void 0:e.namedItem(t)}showPicker(){this.inputRef.value&&"showPicker"in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(t,e,i){var s,o;t==="options"&&(this._options=i?JSON.parse(i):[]),t==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((s=this.inputRef.value)==null?void 0:s.selectedIndex):this._options.findIndex(l=>l.value===i),this.selectedOptions=(o=this.inputRef.value)==null?void 0:o.selectedOptions,this.valueChanged(i,e)),super.attributeChangedCallback(t,e,i)}update(t){var e,i;super.update(t),t.has("_optionsProp")&&this._optionsProp.length>0&&(this._options=this._optionsProp,this.requestUpdate("_options"),!this.value&&this._options.length>0&&(this.value=this._options[0].value,this.selectedIndex=0)),t.has("value")&&this.value!==t.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((e=this.inputRef.value)==null?void 0:e.selectedIndex):this._options.findIndex(s=>s.value===this.value),this.selectedOptions=(i=this.inputRef.value)==null?void 0:i.selectedOptions,this.valueChanged(this.value,t.get("value"))),t.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(t){var e;super.firstUpdated(t),this._optionsProp.length&&(this._options=this._optionsProp),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(i=>i.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return p.b`
|
|
2
|
+
<pkt-input-wrapper
|
|
3
|
+
?counter=${this.counter}
|
|
4
|
+
?disabled=${this.disabled}
|
|
5
|
+
?hasError=${this.hasError}
|
|
6
|
+
?hasFieldset=${this.hasFieldset}
|
|
7
|
+
?inline=${this.inline}
|
|
8
|
+
?optionalTag=${this.optionalTag}
|
|
9
|
+
?requiredTag=${this.requiredTag}
|
|
10
|
+
useWrapper=${this.useWrapper}
|
|
11
|
+
ariaDescribedBy=${n.o(this.ariaDescribedBy)}
|
|
12
|
+
class="pkt-select"
|
|
13
|
+
errorMessage=${n.o(this.errorMessage)}
|
|
14
|
+
forId=${this.id+"-input"}
|
|
15
|
+
helptext=${n.o(this.helptext)}
|
|
16
|
+
helptextDropdown=${n.o(this.helptextDropdown)}
|
|
17
|
+
helptextDropdownButton=${n.o(this.helptextDropdownButton)}
|
|
18
|
+
label=${n.o(this.label)}
|
|
19
|
+
optionalText=${n.o(this.optionalText)}
|
|
20
|
+
requiredText=${n.o(this.requiredText)}
|
|
21
|
+
tagText=${n.o(this.tagText)}
|
|
22
|
+
>
|
|
23
|
+
<select
|
|
24
|
+
class=${t}
|
|
25
|
+
aria-invalid=${this.hasError}
|
|
26
|
+
aria-errormessage=${`${this.id}-error`}
|
|
27
|
+
aria-labelledby=${n.o(this.ariaLabelledby)}
|
|
28
|
+
?disabled=${this.disabled}
|
|
29
|
+
id=${this.id+"-input"}
|
|
30
|
+
name=${(this.name||this.id)+"-input"}
|
|
31
|
+
value=${this.value}
|
|
32
|
+
@change=${e=>{this.touched=!0,this.value=e.target.value,e.stopImmediatePropagation()}}
|
|
33
|
+
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
34
|
+
@focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
|
|
35
|
+
@blur=${e=>{this.onBlur(),e.stopImmediatePropagation()}}
|
|
36
|
+
${u.n(this.inputRef)}
|
|
37
|
+
>
|
|
38
|
+
${this._options.length>0?this._options.map(e=>p.b`<option
|
|
39
|
+
value=${e.value}
|
|
40
|
+
?selected=${this.value==e.value||e.selected}
|
|
41
|
+
?disabled=${e.disabled}
|
|
42
|
+
?hidden=${e.hidden}
|
|
43
|
+
>
|
|
44
|
+
${e.label}
|
|
45
|
+
</option>`):""}
|
|
46
|
+
</select>
|
|
47
|
+
<div class="pkt-contents" slot="helptext">${_.slotContent(this,"helptext")}</div>
|
|
48
|
+
</pkt-input-wrapper>
|
|
49
|
+
`}returnNumberOrNull(t){return t==null||isNaN(t)?null:t}}b([p.n({type:String})],a.prototype,"value");try{p.t("pkt-select")(a)}catch{console.warn("Forsøker å definere <pkt-select>, men den er allerede definert")}exports.PktSelect=a;
|