@oslokommune/punkt-elements 16.7.3 → 16.7.4
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 +18 -0
- package/dist/accordion-BB1JrONI.cjs +34 -0
- package/dist/accordion-nNH87Y60.js +130 -0
- package/dist/alert-BEEnTiCb.cjs +33 -0
- package/dist/alert-ePJuDtmm.js +171 -0
- package/dist/async-directive-B9P1Qa0k.cjs +1 -0
- package/dist/async-directive-CaQiqjyV.js +55 -0
- package/dist/backlink-Ba03LlbB.cjs +13 -0
- package/dist/backlink-CiwXrQYD.js +38 -0
- package/dist/booleanish-BmcOU-43.js +11 -0
- package/dist/booleanish-jJLlnr6-.cjs +1 -0
- package/dist/breadcrumbs-CD1zib3s.cjs +43 -0
- package/dist/breadcrumbs-CpuVqWhF.js +76 -0
- package/dist/button-BIpd1xJh.js +95 -0
- package/dist/button-D-TOBaJB.cjs +27 -0
- package/dist/calendar-BzEtOJla.js +2031 -0
- package/dist/calendar-E5jJLt8D.cjs +90 -0
- package/dist/card-BYJu1MYm.js +339 -0
- package/dist/card-CUFhMVim.cjs +87 -0
- package/dist/checkbox-BARDb9iV.cjs +31 -0
- package/dist/checkbox-Cspxcvt_.js +111 -0
- package/dist/class-map-C8HuhNzZ.js +27 -0
- package/dist/class-map-CJ-msbHs.cjs +1 -0
- package/dist/classutils-DEL164Ur.js +7 -0
- package/dist/classutils-z8YsPlOf.cjs +1 -0
- package/dist/combobox-BcdLZRDU.js +984 -0
- package/dist/combobox-CGbFTWq_.cjs +135 -0
- package/dist/consent-DeB_5sWH.js +197 -0
- package/dist/consent-hwu7pp3S.cjs +11 -0
- package/dist/datepicker-DpmlsnH_.cjs +273 -0
- package/dist/datepicker-OVd8pmnZ.js +1125 -0
- package/dist/dialog-polyfill.esm-1hPr0gl9.js +280 -0
- package/dist/dialog-polyfill.esm-D3Oinvk0.cjs +1 -0
- package/dist/directive-3THFsVew.js +28 -0
- package/dist/directive-CJ2giQBZ.cjs +1 -0
- package/dist/directive-helpers-D1QSxY17.cjs +1 -0
- package/dist/directive-helpers-Dkv2gKgs.js +25 -0
- package/dist/element-DjtxO-1r.cjs +2 -0
- package/dist/element-cZ85T_aa.js +693 -0
- package/dist/element-with-slot-4J2o3SeU.js +166 -0
- package/dist/element-with-slot-CWoTGA1B.cjs +1 -0
- package/dist/header-DWgPgGfS.cjs +304 -0
- package/dist/header-a6ztVNp3.js +782 -0
- package/dist/heading-BgSWIRii.cjs +1 -0
- package/dist/heading-DiQLPxdf.js +73 -0
- package/dist/helptext-CCBKKLus.js +65 -0
- package/dist/helptext-D-3QfZv5.cjs +24 -0
- package/dist/icon-Co72KtgF.js +86 -0
- package/dist/icon-Dr8sfT2X.cjs +1 -0
- package/dist/if-defined-Cjj8qN-Z.js +5 -0
- package/dist/if-defined-XKOD_t_V.cjs +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/input-element-B1yxcfz4.cjs +1 -0
- package/dist/input-element-Bw1s6NlF.js +643 -0
- package/dist/input-wrapper-BRuVELpK.cjs +54 -0
- package/dist/input-wrapper-CDyHTR1V.js +164 -0
- package/dist/input-wrapper-Dwd-_sKm.cjs +1 -0
- package/dist/input-wrapper-YfTmpSSY.js +117 -0
- package/dist/link-CKAFMz9j.js +89 -0
- package/dist/link-CyTCpI0k.cjs +7 -0
- package/dist/linkcard-B0KOGaGj.js +55 -0
- package/dist/linkcard-BE4-FewK.cjs +13 -0
- package/dist/listbox-DCA2JoPV.cjs +106 -0
- package/dist/listbox-DuBgTFvH.js +397 -0
- package/dist/loader-6kFZUErT.js +66 -0
- package/dist/loader-CX2rsC01.cjs +16 -0
- package/dist/messagebox-Cwlg5sOr.js +110 -0
- package/dist/messagebox-Din9X53b.cjs +13 -0
- package/dist/modal-C_wtsh9m.js +209 -0
- package/dist/modal-DS_wUOIv.cjs +36 -0
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -7
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +2 -5
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +2 -5
- package/dist/pkt-breadcrumbs.cjs +1 -43
- package/dist/pkt-breadcrumbs.js +2 -81
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +2 -5
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +2 -5
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +2 -5
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +2 -5
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +2 -5
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +2 -5
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +5 -9
- package/dist/pkt-header.cjs +1 -304
- package/dist/pkt-header.js +2 -861
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +2 -5
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +2 -5
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +2 -5
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +30 -66
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +2 -5
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +2 -5
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +2 -5
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +2 -5
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +2 -5
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +2 -5
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +2 -5
- package/dist/pkt-options-controller-CRrI6WMk.js +43 -0
- package/dist/pkt-options-controller-CXUGx134.cjs +1 -0
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -5
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +2 -5
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +2 -5
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +2 -7
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +2 -5
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +2 -5
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +2 -5
- package/dist/pkt-timepicker.cjs +1 -191
- package/dist/pkt-timepicker.js +2 -560
- package/dist/progressbar-CdXtmOBb.cjs +17 -0
- package/dist/progressbar-Dy9AiYQz.js +113 -0
- package/dist/radiobutton-GOnpUbCW.cjs +31 -0
- package/dist/radiobutton-V_KPbup_.js +84 -0
- package/dist/ref-BaJ0mBT_.cjs +1 -0
- package/dist/ref-RS8Uv6uC.js +30 -0
- package/dist/repeat-Cepr3469.js +57 -0
- package/dist/repeat-CqcDYBxr.cjs +1 -0
- package/dist/select-BSAFd8Wa.js +164 -0
- package/dist/select-C2i8sOk5.cjs +49 -0
- package/dist/tabs-D8nL9rWx.cjs +37 -0
- package/dist/tabs-Y7utmJi9.js +318 -0
- package/dist/tag-DLthw5b4.cjs +27 -0
- package/dist/tag-VwykmuQR.js +179 -0
- package/dist/textarea-D7aGOyDf.cjs +46 -0
- package/dist/textarea-DYOBhJrN.js +115 -0
- package/dist/textinput-BUgntXnM.js +124 -0
- package/dist/textinput-DFh8_9cx.cjs +70 -0
- package/dist/timepicker-BIfE7KKJ.cjs +191 -0
- package/dist/timepicker-DaSwn1FA.js +503 -0
- package/dist/utils-CUqCKGvp.js +7 -0
- package/dist/utils-CjAbIttF.cjs +1 -0
- package/package.json +6 -6
- package/src/components/alert/alert.test.ts +1 -1
- package/src/components/alert/alert.ts +6 -6
- package/src/components/datepicker/datepicker-utils.test.ts +16 -23
- package/dist/accordionitem-_9AiCIvd.cjs +0 -34
- package/dist/accordionitem-dCfSrxh5.js +0 -140
- package/dist/alert-BtOk8yRH.cjs +0 -33
- package/dist/alert-DlY2_grU.js +0 -117
- package/dist/async-directive-CMzWMlZ5.js +0 -65
- package/dist/async-directive-DoMuclel.cjs +0 -5
- package/dist/backlink-Ce5Vldop.js +0 -49
- package/dist/backlink-y3dwjKPC.cjs +0 -13
- package/dist/booleanish-BKVonob4.cjs +0 -1
- package/dist/booleanish-C9R0tdXH.js +0 -11
- package/dist/button-B_TXwNzt.cjs +0 -27
- package/dist/button-BiY-wlKF.js +0 -139
- package/dist/calendar-B2pji2zn.cjs +0 -90
- package/dist/calendar-DhjQDC4C.js +0 -2140
- package/dist/card-BwMNB5Bb.cjs +0 -87
- package/dist/card-CGlmcMSR.js +0 -233
- package/dist/checkbox-BsJZYA26.js +0 -147
- package/dist/checkbox-CTY8f_qn.cjs +0 -31
- package/dist/class-map-CEnykyO_.js +0 -34
- package/dist/class-map-CsENJXf1.cjs +0 -5
- package/dist/classutils-BwNK82ZQ.cjs +0 -1
- package/dist/classutils-RQs1k6D9.js +0 -7
- package/dist/combobox-DSB5WOxg.js +0 -815
- package/dist/combobox-DbICIgKG.cjs +0 -135
- package/dist/consent-DkOQpbsg.cjs +0 -11
- package/dist/consent-SNWV_mMU.js +0 -175
- package/dist/datepicker-BEWl9iz3.cjs +0 -273
- package/dist/datepicker-euHyzXnb.js +0 -1170
- package/dist/dialog-polyfill.esm-CPKZe7AL.cjs +0 -1
- package/dist/dialog-polyfill.esm-CbjBMXAG.js +0 -395
- package/dist/directive-C7oCP5Bh.cjs +0 -5
- package/dist/directive-helpers-BP2WOx60.cjs +0 -5
- package/dist/directive-helpers-rm-28gIj.js +0 -38
- package/dist/directive-oAbCiebi.js +0 -27
- package/dist/element-CPpT3rFQ.js +0 -638
- package/dist/element-gR_VtSiD.cjs +0 -27
- package/dist/element-with-slot-Dqk6-TRR.js +0 -240
- package/dist/element-with-slot-ZX-up7jO.cjs +0 -1
- package/dist/heading-D2tVS6lS.js +0 -103
- package/dist/heading-DrzbgDb6.cjs +0 -1
- package/dist/helptext-BKtU4mas.js +0 -82
- package/dist/helptext-DcRC7wW2.cjs +0 -24
- package/dist/icon-CxQcIa5F.js +0 -105
- package/dist/icon-q81vqPK_.cjs +0 -9
- package/dist/if-defined-B0krMLad.js +0 -10
- package/dist/if-defined-BOW3ODSj.cjs +0 -5
- package/dist/input-element-8nLwuQS4.js +0 -837
- package/dist/input-element-DdVhUvva.cjs +0 -1
- package/dist/input-wrapper-Bs4CRNst.js +0 -181
- package/dist/input-wrapper-Bv9aqqVq.cjs +0 -54
- package/dist/input-wrapper-CDgenrYA.js +0 -6
- package/dist/input-wrapper-EoSAbU-U.cjs +0 -1
- package/dist/link-C0rl-86s.cjs +0 -7
- package/dist/link-Cdqgl60z.js +0 -55
- package/dist/linkcard-Dimu7Rlx.cjs +0 -13
- package/dist/linkcard-Lbq_UhjZ.js +0 -56
- package/dist/listbox-Bia4_tvN.js +0 -440
- package/dist/listbox-La2GZQei.cjs +0 -106
- package/dist/loader-D1ugDXGV.cjs +0 -16
- package/dist/loader-DyN6RGC5.js +0 -95
- package/dist/messagebox-BGMVm2t9.js +0 -71
- package/dist/messagebox-M0yIgCz9.cjs +0 -13
- package/dist/modal-CMO1RtIi.cjs +0 -36
- package/dist/modal-DjPQDE-Z.js +0 -156
- package/dist/pkt-options-controller-5LXbEzuk.cjs +0 -1
- package/dist/pkt-options-controller-B5YalfCb.js +0 -39
- package/dist/progressbar-BqlMzkM_.cjs +0 -21
- package/dist/progressbar-sbHDFC12.js +0 -162
- package/dist/radiobutton-5ZqVVtTT.cjs +0 -31
- package/dist/radiobutton-D8Ai8ETa.js +0 -113
- package/dist/ref-Bg_Swj5w.js +0 -42
- package/dist/ref-CL-Xk9Xm.cjs +0 -5
- package/dist/repeat-BD8TKgJb.js +0 -61
- package/dist/repeat-Cfq8CDlf.cjs +0 -5
- package/dist/select-De-n8on9.js +0 -230
- package/dist/select-dTWibR6_.cjs +0 -49
- package/dist/state-C_1EOo3D.js +0 -12
- package/dist/state-Dg-53wQ8.cjs +0 -5
- package/dist/tabitem-B9-jeV97.js +0 -334
- package/dist/tabitem-BnhzqfW3.cjs +0 -65
- package/dist/tag-CbwO8yvD.cjs +0 -27
- package/dist/tag-D4FI5t3y.js +0 -117
- package/dist/textarea-BmLaKzsc.cjs +0 -50
- package/dist/textarea-CMiSJaYL.js +0 -133
- package/dist/textinput-em9y4yrL.cjs +0 -70
- package/dist/textinput-r8udK0IX.js +0 -152
- package/dist/utils-DznhwRXm.js +0 -8
- package/dist/utils-byXsEz1u.cjs +0 -1
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { t as d, b as l, A as o, n as s } from "./element-CPpT3rFQ.js";
|
|
2
|
-
import { r as k } from "./state-C_1EOo3D.js";
|
|
3
|
-
import { P as f } from "./input-element-8nLwuQS4.js";
|
|
4
|
-
import { e as g, n as y } from "./ref-Bg_Swj5w.js";
|
|
5
|
-
import { e as u } from "./class-map-CEnykyO_.js";
|
|
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
|
-
};
|
|
11
|
-
class e extends f {
|
|
12
|
-
constructor() {
|
|
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
|
-
}
|
|
15
|
-
connectedCallback() {
|
|
16
|
-
super.connectedCallback();
|
|
17
|
-
}
|
|
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
|
-
}
|
|
21
|
-
render() {
|
|
22
|
-
const t = u({
|
|
23
|
-
"pkt-input-check__input": !0,
|
|
24
|
-
"pkt-input-check__input--tile": this.hasTile,
|
|
25
|
-
"pkt-input-check__input--tile-disabled": this.disabled && this.hasTile
|
|
26
|
-
}), p = u({
|
|
27
|
-
"pkt-input-check__input-checkbox": !0,
|
|
28
|
-
"pkt-input-check__input-checkbox--error": this.hasError
|
|
29
|
-
}), c = u({
|
|
30
|
-
"pkt-input-check__input-label": !0,
|
|
31
|
-
"pkt-input-check__input-label--disabled": this.disabled,
|
|
32
|
-
"pkt-sr-only": this.hideLabel
|
|
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
|
-
<label class=${c} for=${this.id + "-internal"}>
|
|
39
|
-
${this.label} ${r()}
|
|
40
|
-
${this.checkHelptext ? l`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>` : o}
|
|
41
|
-
</label>
|
|
42
|
-
`;
|
|
43
|
-
return l`
|
|
44
|
-
<div class="pkt-input-check">
|
|
45
|
-
<div class=${t}>
|
|
46
|
-
<input
|
|
47
|
-
id=${this.id + "-internal"}
|
|
48
|
-
class=${p}
|
|
49
|
-
type="radio"
|
|
50
|
-
role="radio"
|
|
51
|
-
?disabled=${this.disabled}
|
|
52
|
-
form=""
|
|
53
|
-
name=${this.name + "-internal"}
|
|
54
|
-
${y(this.inputRef)}
|
|
55
|
-
@change=${this.toggleChecked}
|
|
56
|
-
@input=${this.onInput}
|
|
57
|
-
@blur=${this.onBlur}
|
|
58
|
-
@focus=${this.onFocus}
|
|
59
|
-
?checked=${this.checked}
|
|
60
|
-
/>
|
|
61
|
-
${h()}
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
`;
|
|
65
|
-
}
|
|
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
|
-
}
|
|
69
|
-
}
|
|
70
|
-
i([
|
|
71
|
-
s({ type: String, reflect: !0 })
|
|
72
|
-
], e.prototype, "value");
|
|
73
|
-
i([
|
|
74
|
-
s({ type: String })
|
|
75
|
-
], e.prototype, "checkHelptext");
|
|
76
|
-
i([
|
|
77
|
-
s({ type: Boolean })
|
|
78
|
-
], e.prototype, "defaultChecked");
|
|
79
|
-
i([
|
|
80
|
-
s({ type: Boolean })
|
|
81
|
-
], e.prototype, "hasTile");
|
|
82
|
-
i([
|
|
83
|
-
s({ type: Boolean, reflect: !0 })
|
|
84
|
-
], e.prototype, "checked");
|
|
85
|
-
i([
|
|
86
|
-
s({ type: String, reflect: !0 })
|
|
87
|
-
], e.prototype, "type");
|
|
88
|
-
i([
|
|
89
|
-
s({ type: String })
|
|
90
|
-
], e.prototype, "tagText");
|
|
91
|
-
i([
|
|
92
|
-
s({ type: Boolean })
|
|
93
|
-
], e.prototype, "optionalTag");
|
|
94
|
-
i([
|
|
95
|
-
s({ type: String })
|
|
96
|
-
], e.prototype, "optionalText");
|
|
97
|
-
i([
|
|
98
|
-
s({ type: Boolean })
|
|
99
|
-
], e.prototype, "requiredTag");
|
|
100
|
-
i([
|
|
101
|
-
s({ type: String })
|
|
102
|
-
], e.prototype, "requiredText");
|
|
103
|
-
i([
|
|
104
|
-
k()
|
|
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
|
-
}
|
|
111
|
-
export {
|
|
112
|
-
e as P
|
|
113
|
-
};
|
package/dist/ref-Bg_Swj5w.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { A as o } from "./element-CPpT3rFQ.js";
|
|
2
|
-
import { f as n } from "./async-directive-CMzWMlZ5.js";
|
|
3
|
-
import { e as r } from "./directive-oAbCiebi.js";
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2020 Google LLC
|
|
7
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8
|
-
*/
|
|
9
|
-
const G = () => new c();
|
|
10
|
-
class c {
|
|
11
|
-
}
|
|
12
|
-
const e = /* @__PURE__ */ new WeakMap(), p = r(class extends n {
|
|
13
|
-
render(t) {
|
|
14
|
-
return o;
|
|
15
|
-
}
|
|
16
|
-
update(t, [i]) {
|
|
17
|
-
var h;
|
|
18
|
-
const s = i !== this.G;
|
|
19
|
-
return s && this.G !== void 0 && this.rt(void 0), (s || this.lt !== this.ct) && (this.G = i, this.ht = (h = t.options) == null ? void 0 : h.host, this.rt(this.ct = t.element)), o;
|
|
20
|
-
}
|
|
21
|
-
rt(t) {
|
|
22
|
-
if (this.isConnected || (t = void 0), typeof this.G == "function") {
|
|
23
|
-
const i = this.ht ?? globalThis;
|
|
24
|
-
let s = e.get(i);
|
|
25
|
-
s === void 0 && (s = /* @__PURE__ */ new WeakMap(), e.set(i, s)), s.get(this.G) !== void 0 && this.G.call(this.ht, void 0), s.set(this.G, t), t !== void 0 && this.G.call(this.ht, t);
|
|
26
|
-
} else this.G.value = t;
|
|
27
|
-
}
|
|
28
|
-
get lt() {
|
|
29
|
-
var t, i;
|
|
30
|
-
return typeof this.G == "function" ? (t = e.get(this.ht ?? globalThis)) == null ? void 0 : t.get(this.G) : (i = this.G) == null ? void 0 : i.value;
|
|
31
|
-
}
|
|
32
|
-
disconnected() {
|
|
33
|
-
this.lt === this.ct && this.rt(void 0);
|
|
34
|
-
}
|
|
35
|
-
reconnected() {
|
|
36
|
-
this.rt(this.ct);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
export {
|
|
40
|
-
G as e,
|
|
41
|
-
p as n
|
|
42
|
-
};
|
package/dist/ref-CL-Xk9Xm.cjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("./element-gR_VtSiD.cjs"),o=require("./async-directive-DoMuclel.cjs"),c=require("./directive-C7oCP5Bh.cjs");/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const r=()=>new l;class l{}const s=new WeakMap,d=c.e(class extends o.f{render(t){return n.A}update(t,[e]){var h;const i=e!==this.G;return i&&this.G!==void 0&&this.rt(void 0),(i||this.lt!==this.ct)&&(this.G=e,this.ht=(h=t.options)==null?void 0:h.host,this.rt(this.ct=t.element)),n.A}rt(t){if(this.isConnected||(t=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let i=s.get(e);i===void 0&&(i=new WeakMap,s.set(e,i)),i.get(this.G)!==void 0&&this.G.call(this.ht,void 0),i.set(this.G,t),t!==void 0&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){var t,e;return typeof this.G=="function"?(t=s.get(this.ht??globalThis))==null?void 0:t.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});exports.e=r;exports.n=d;
|
package/dist/repeat-BD8TKgJb.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { E as w } from "./element-CPpT3rFQ.js";
|
|
2
|
-
import { e as A, i as E, t as M } from "./directive-oAbCiebi.js";
|
|
3
|
-
import { M as b, u as p, v, h as x, p as j } from "./directive-helpers-rm-28gIj.js";
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2017 Google LLC
|
|
7
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8
|
-
*/
|
|
9
|
-
const k = (s, c, a) => {
|
|
10
|
-
const h = /* @__PURE__ */ new Map();
|
|
11
|
-
for (let e = c; e <= a; e++) h.set(s[e], e);
|
|
12
|
-
return h;
|
|
13
|
-
}, I = A(class extends E {
|
|
14
|
-
constructor(s) {
|
|
15
|
-
if (super(s), s.type !== M.CHILD) throw Error("repeat() can only be used in text expressions");
|
|
16
|
-
}
|
|
17
|
-
dt(s, c, a) {
|
|
18
|
-
let h;
|
|
19
|
-
a === void 0 ? a = c : c !== void 0 && (h = c);
|
|
20
|
-
const e = [], i = [];
|
|
21
|
-
let l = 0;
|
|
22
|
-
for (const u of s) e[l] = h ? h(u, l) : l, i[l] = a(u, l), l++;
|
|
23
|
-
return { values: i, keys: e };
|
|
24
|
-
}
|
|
25
|
-
render(s, c, a) {
|
|
26
|
-
return this.dt(s, c, a).values;
|
|
27
|
-
}
|
|
28
|
-
update(s, [c, a, h]) {
|
|
29
|
-
const e = b(s), { values: i, keys: l } = this.dt(c, a, h);
|
|
30
|
-
if (!Array.isArray(e)) return this.ut = l, i;
|
|
31
|
-
const u = this.ut ?? (this.ut = []), f = [];
|
|
32
|
-
let m, $, t = 0, o = e.length - 1, r = 0, n = i.length - 1;
|
|
33
|
-
for (; t <= o && r <= n; ) if (e[t] === null) t++;
|
|
34
|
-
else if (e[o] === null) o--;
|
|
35
|
-
else if (u[t] === l[r]) f[r] = p(e[t], i[r]), t++, r++;
|
|
36
|
-
else if (u[o] === l[n]) f[n] = p(e[o], i[n]), o--, n--;
|
|
37
|
-
else if (u[t] === l[n]) f[n] = p(e[t], i[n]), v(s, f[n + 1], e[t]), t++, n--;
|
|
38
|
-
else if (u[o] === l[r]) f[r] = p(e[o], i[r]), v(s, e[t], e[o]), o--, r++;
|
|
39
|
-
else if (m === void 0 && (m = k(l, r, n), $ = k(u, t, o)), m.has(u[t])) if (m.has(u[o])) {
|
|
40
|
-
const d = $.get(l[r]), y = d !== void 0 ? e[d] : null;
|
|
41
|
-
if (y === null) {
|
|
42
|
-
const g = v(s, e[t]);
|
|
43
|
-
p(g, i[r]), f[r] = g;
|
|
44
|
-
} else f[r] = p(y, i[r]), v(s, e[t], y), e[d] = null;
|
|
45
|
-
r++;
|
|
46
|
-
} else x(e[o]), o--;
|
|
47
|
-
else x(e[t]), t++;
|
|
48
|
-
for (; r <= n; ) {
|
|
49
|
-
const d = v(s, f[n + 1]);
|
|
50
|
-
p(d, i[r]), f[r++] = d;
|
|
51
|
-
}
|
|
52
|
-
for (; t <= o; ) {
|
|
53
|
-
const d = e[t++];
|
|
54
|
-
d !== null && x(d);
|
|
55
|
-
}
|
|
56
|
-
return this.ut = l, j(s, f), w;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
export {
|
|
60
|
-
I as c
|
|
61
|
-
};
|
package/dist/repeat-Cfq8CDlf.cjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";const w=require("./element-gR_VtSiD.cjs"),x=require("./directive-C7oCP5Bh.cjs"),s=require("./directive-helpers-BP2WOx60.cjs");/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const q=(l,v,d)=>{const a=new Map;for(let e=v;e<=d;e++)a.set(l[e],e);return a},m=x.e(class extends x.i{constructor(l){if(super(l),l.type!==x.t.CHILD)throw Error("repeat() can only be used in text expressions")}dt(l,v,d){let a;d===void 0?d=v:v!==void 0&&(a=v);const e=[],o=[];let n=0;for(const c of l)e[n]=a?a(c,n):n,o[n]=d(c,n),n++;return{values:o,keys:e}}render(l,v,d){return this.dt(l,v,d).values}update(l,[v,d,a]){const e=s.M(l),{values:o,keys:n}=this.dt(v,d,a);if(!Array.isArray(e))return this.ut=n,o;const c=this.ut??(this.ut=[]),f=[];let p,g,t=0,i=e.length-1,r=0,u=o.length-1;for(;t<=i&&r<=u;)if(e[t]===null)t++;else if(e[i]===null)i--;else if(c[t]===n[r])f[r]=s.u(e[t],o[r]),t++,r++;else if(c[i]===n[u])f[u]=s.u(e[i],o[u]),i--,u--;else if(c[t]===n[u])f[u]=s.u(e[t],o[u]),s.v(l,f[u+1],e[t]),t++,u--;else if(c[i]===n[r])f[r]=s.u(e[i],o[r]),s.v(l,e[t],e[i]),i--,r++;else if(p===void 0&&(p=q(n,r,u),g=q(c,t,i)),p.has(c[t]))if(p.has(c[i])){const h=g.get(n[r]),y=h!==void 0?e[h]:null;if(y===null){const k=s.v(l,e[t]);s.u(k,o[r]),f[r]=k}else f[r]=s.u(y,o[r]),s.v(l,e[t],y),e[h]=null;r++}else s.h(e[i]),i--;else s.h(e[t]),t++;for(;r<=u;){const h=s.v(l,f[u+1]);s.u(h,o[r]),f[r++]=h}for(;t<=i;){const h=e[t++];h!==null&&s.h(h)}return this.ut=n,s.p(l,f),w.E}});exports.c=m;
|
package/dist/select-De-n8on9.js
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/select-dTWibR6_.cjs
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
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;
|
package/dist/state-C_1EOo3D.js
DELETED