@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
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { c as e, d as t, o as n, r, s as i } from "./element-cZ85T_aa.js";
|
|
2
|
+
import { n as a, t as o } from "./element-with-slot-4J2o3SeU.js";
|
|
3
|
+
import { t as s } from "./if-defined-Cjj8qN-Z.js";
|
|
4
|
+
import { n as c, t as l } from "./ref-RS8Uv6uC.js";
|
|
5
|
+
//#region ../../node_modules/@lit/context/lib/context-request-event.js
|
|
6
|
+
var u = class extends Event {
|
|
7
|
+
constructor(e, t, n, r) {
|
|
8
|
+
super("context-request", {
|
|
9
|
+
bubbles: !0,
|
|
10
|
+
composed: !0
|
|
11
|
+
}), this.context = e, this.contextTarget = t, this.callback = n, this.subscribe = r ?? !1;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region ../../node_modules/@lit/context/lib/create-context.js
|
|
16
|
+
function d(e) {
|
|
17
|
+
return e;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region ../../node_modules/@lit/context/lib/controllers/context-consumer.js
|
|
21
|
+
var f = class {
|
|
22
|
+
constructor(e, t, n, r) {
|
|
23
|
+
if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (e, t) => {
|
|
24
|
+
this.unsubscribe && (this.unsubscribe !== t && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = e, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(e, t)), this.unsubscribe = t;
|
|
25
|
+
}, this.host = e, t.context !== void 0) {
|
|
26
|
+
let e = t;
|
|
27
|
+
this.context = e.context, this.callback = e.callback, this.subscribe = e.subscribe ?? !1;
|
|
28
|
+
} else this.context = t, this.callback = n, this.subscribe = r ?? !1;
|
|
29
|
+
this.host.addController(this);
|
|
30
|
+
}
|
|
31
|
+
hostConnected() {
|
|
32
|
+
this.dispatchRequest();
|
|
33
|
+
}
|
|
34
|
+
hostDisconnected() {
|
|
35
|
+
this.unsubscribe &&= (this.unsubscribe(), void 0);
|
|
36
|
+
}
|
|
37
|
+
dispatchRequest() {
|
|
38
|
+
this.host.dispatchEvent(new u(this.context, this.host, this.t, this.subscribe));
|
|
39
|
+
}
|
|
40
|
+
}, p = class {
|
|
41
|
+
get value() {
|
|
42
|
+
return this.o;
|
|
43
|
+
}
|
|
44
|
+
set value(e) {
|
|
45
|
+
this.setValue(e);
|
|
46
|
+
}
|
|
47
|
+
setValue(e, t = !1) {
|
|
48
|
+
let n = t || !Object.is(e, this.o);
|
|
49
|
+
this.o = e, n && this.updateObservers();
|
|
50
|
+
}
|
|
51
|
+
constructor(e) {
|
|
52
|
+
this.subscriptions = /* @__PURE__ */ new Map(), this.updateObservers = () => {
|
|
53
|
+
for (let [e, { disposer: t }] of this.subscriptions) e(this.o, t);
|
|
54
|
+
}, e !== void 0 && (this.value = e);
|
|
55
|
+
}
|
|
56
|
+
addCallback(e, t, n) {
|
|
57
|
+
if (!n) return void e(this.value);
|
|
58
|
+
this.subscriptions.has(e) || this.subscriptions.set(e, {
|
|
59
|
+
disposer: () => {
|
|
60
|
+
this.subscriptions.delete(e);
|
|
61
|
+
},
|
|
62
|
+
consumerHost: t
|
|
63
|
+
});
|
|
64
|
+
let { disposer: r } = this.subscriptions.get(e);
|
|
65
|
+
e(this.value, r);
|
|
66
|
+
}
|
|
67
|
+
clearCallbacks() {
|
|
68
|
+
this.subscriptions.clear();
|
|
69
|
+
}
|
|
70
|
+
}, m = class extends Event {
|
|
71
|
+
constructor(e, t) {
|
|
72
|
+
super("context-provider", {
|
|
73
|
+
bubbles: !0,
|
|
74
|
+
composed: !0
|
|
75
|
+
}), this.context = e, this.contextTarget = t;
|
|
76
|
+
}
|
|
77
|
+
}, h = class extends p {
|
|
78
|
+
constructor(e, t, n) {
|
|
79
|
+
super(t.context === void 0 ? n : t.initialValue), this.onContextRequest = (e) => {
|
|
80
|
+
if (e.context !== this.context) return;
|
|
81
|
+
let t = e.contextTarget ?? e.composedPath()[0];
|
|
82
|
+
t !== this.host && (e.stopPropagation(), this.addCallback(e.callback, t, e.subscribe));
|
|
83
|
+
}, this.onProviderRequest = (e) => {
|
|
84
|
+
if (e.context !== this.context || (e.contextTarget ?? e.composedPath()[0]) === this.host) return;
|
|
85
|
+
let t = /* @__PURE__ */ new Set();
|
|
86
|
+
for (let [e, { consumerHost: n }] of this.subscriptions) t.has(e) || (t.add(e), n.dispatchEvent(new u(this.context, n, e, !0)));
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
}, this.host = e, t.context === void 0 ? this.context = t : this.context = t.context, this.attachListeners(), this.host.addController?.(this);
|
|
89
|
+
}
|
|
90
|
+
attachListeners() {
|
|
91
|
+
this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
|
|
92
|
+
}
|
|
93
|
+
hostConnected() {
|
|
94
|
+
this.host.dispatchEvent(new m(this.context, this.host));
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region ../../node_modules/@lit/context/lib/decorators/provide.js
|
|
99
|
+
function g({ context: e }) {
|
|
100
|
+
return (t, n) => {
|
|
101
|
+
let r = /* @__PURE__ */ new WeakMap();
|
|
102
|
+
if (typeof n == "object") return {
|
|
103
|
+
get() {
|
|
104
|
+
return t.get.call(this);
|
|
105
|
+
},
|
|
106
|
+
set(e) {
|
|
107
|
+
return r.get(this).setValue(e), t.set.call(this, e);
|
|
108
|
+
},
|
|
109
|
+
init(t) {
|
|
110
|
+
return r.set(this, new h(this, {
|
|
111
|
+
context: e,
|
|
112
|
+
initialValue: t
|
|
113
|
+
})), t;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
{
|
|
117
|
+
t.constructor.addInitializer(((t) => {
|
|
118
|
+
r.set(t, new h(t, { context: e }));
|
|
119
|
+
}));
|
|
120
|
+
let i = Object.getOwnPropertyDescriptor(t, n), a;
|
|
121
|
+
if (i === void 0) {
|
|
122
|
+
let e = /* @__PURE__ */ new WeakMap();
|
|
123
|
+
a = {
|
|
124
|
+
get() {
|
|
125
|
+
return e.get(this);
|
|
126
|
+
},
|
|
127
|
+
set(t) {
|
|
128
|
+
r.get(this).setValue(t), e.set(this, t);
|
|
129
|
+
},
|
|
130
|
+
configurable: !0,
|
|
131
|
+
enumerable: !0
|
|
132
|
+
};
|
|
133
|
+
} else {
|
|
134
|
+
let e = i.set;
|
|
135
|
+
a = {
|
|
136
|
+
...i,
|
|
137
|
+
set(t) {
|
|
138
|
+
r.get(this).setValue(t), e?.call(this, t);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
Object.defineProperty(t, n, a);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region ../../node_modules/@lit/context/lib/decorators/consume.js
|
|
149
|
+
function _({ context: e, subscribe: t }) {
|
|
150
|
+
return (n, r) => {
|
|
151
|
+
typeof r == "object" ? r.addInitializer((function() {
|
|
152
|
+
new f(this, {
|
|
153
|
+
context: e,
|
|
154
|
+
callback: (e) => {
|
|
155
|
+
n.set.call(this, e);
|
|
156
|
+
},
|
|
157
|
+
subscribe: t
|
|
158
|
+
});
|
|
159
|
+
})) : n.constructor.addInitializer(((n) => {
|
|
160
|
+
new f(n, {
|
|
161
|
+
context: e,
|
|
162
|
+
callback: (e) => {
|
|
163
|
+
n[r] = e;
|
|
164
|
+
},
|
|
165
|
+
subscribe: t
|
|
166
|
+
});
|
|
167
|
+
}));
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/components/tabs/tabs-context.ts
|
|
172
|
+
var v = d(Symbol("pkt-tabs-context")), y = class extends o {
|
|
173
|
+
constructor(...e) {
|
|
174
|
+
super(...e), this.arrowNav = !0, this.disableArrowNav = !1, this.tabRefs = [], this.tabCount = 0, this.context = {
|
|
175
|
+
useArrowNav: this.useArrowNav,
|
|
176
|
+
registerTab: this.registerTab.bind(this),
|
|
177
|
+
handleClick: this.handleClick.bind(this),
|
|
178
|
+
handleKeyUp: this.handleKeyUp.bind(this)
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
get useArrowNav() {
|
|
182
|
+
return this.arrowNav && !this.disableArrowNav;
|
|
183
|
+
}
|
|
184
|
+
updated(e) {
|
|
185
|
+
(e.has("arrowNav") || e.has("disableArrowNav")) && (this.context = {
|
|
186
|
+
...this.context,
|
|
187
|
+
useArrowNav: this.useArrowNav
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
registerTab(e, t) {
|
|
191
|
+
this.tabRefs[t] = e, this.tabCount = Math.max(this.tabCount, t + 1);
|
|
192
|
+
}
|
|
193
|
+
handleClick(e) {
|
|
194
|
+
this.dispatchEvent(new CustomEvent("tab-selected", {
|
|
195
|
+
detail: { index: e },
|
|
196
|
+
bubbles: !0,
|
|
197
|
+
composed: !0
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
handleKeyUp(e, t) {
|
|
201
|
+
this.useArrowNav && (e.code === "ArrowLeft" && t !== 0 && this.tabRefs[t - 1]?.focus(), e.code === "ArrowRight" && t < this.tabCount - 1 && this.tabRefs[t + 1]?.focus(), (e.code === "ArrowDown" || e.code === "Space") && this.dispatchEvent(new CustomEvent("tab-selected", {
|
|
202
|
+
detail: { index: t },
|
|
203
|
+
bubbles: !0,
|
|
204
|
+
composed: !0
|
|
205
|
+
})));
|
|
206
|
+
}
|
|
207
|
+
render() {
|
|
208
|
+
return t`
|
|
209
|
+
<div class="pkt-tabs">
|
|
210
|
+
<div class="pkt-tabs__list" role=${this.useArrowNav ? "tablist" : "navigation"}>${a(this)}</div>
|
|
211
|
+
</div>
|
|
212
|
+
`;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
r([i({
|
|
216
|
+
type: Boolean,
|
|
217
|
+
reflect: !0,
|
|
218
|
+
attribute: "arrow-nav"
|
|
219
|
+
})], y.prototype, "arrowNav", void 0), r([i({
|
|
220
|
+
type: Boolean,
|
|
221
|
+
reflect: !0,
|
|
222
|
+
attribute: "disable-arrow-nav"
|
|
223
|
+
})], y.prototype, "disableArrowNav", void 0), r([n()], y.prototype, "tabRefs", void 0), r([n()], y.prototype, "tabCount", void 0), r([g({ context: v }), n()], y.prototype, "context", void 0);
|
|
224
|
+
try {
|
|
225
|
+
e("pkt-tabs")(y);
|
|
226
|
+
} catch {
|
|
227
|
+
console.warn("Forsøker å definere <pkt-tabs>, men den er allerede definert");
|
|
228
|
+
}
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/components/tabs/tabitem.ts
|
|
231
|
+
var b = class extends o {
|
|
232
|
+
constructor() {
|
|
233
|
+
super(), this.active = !1, this.href = "", this.icon = "", this.controls = "", this.tag = "", this.tagSkin = "blue", this.index = 0, this.elementRef = l();
|
|
234
|
+
}
|
|
235
|
+
connectedCallback() {
|
|
236
|
+
super.connectedCallback(), this.updateComplete.then(() => {
|
|
237
|
+
this.elementRef.value && this.context && this.context.registerTab(this.elementRef.value, this.index);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
handleClick() {
|
|
241
|
+
this.context && this.context.handleClick(this.index);
|
|
242
|
+
}
|
|
243
|
+
handleKeyUp(e) {
|
|
244
|
+
this.context && this.context.handleKeyUp(e, this.index);
|
|
245
|
+
}
|
|
246
|
+
render() {
|
|
247
|
+
let e = this.context?.useArrowNav ?? !0, n = this.active ? "active" : "", r = e ? "tab" : void 0, i = e ? this.active : void 0, o = this.active || !e ? void 0 : -1, l = t`
|
|
248
|
+
${this.icon ? t`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>` : ""}
|
|
249
|
+
<span>${a(this)}</span>
|
|
250
|
+
${this.tag ? t`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>` : ""}
|
|
251
|
+
`;
|
|
252
|
+
return this.href ? t`
|
|
253
|
+
<a
|
|
254
|
+
${c(this.elementRef)}
|
|
255
|
+
href=${this.href}
|
|
256
|
+
class="pkt-tabs__link ${n}"
|
|
257
|
+
role=${s(r)}
|
|
258
|
+
aria-selected=${s(i)}
|
|
259
|
+
aria-controls=${s(this.controls || void 0)}
|
|
260
|
+
tabindex=${s(o)}
|
|
261
|
+
@click=${this.handleClick}
|
|
262
|
+
@keyup=${this.handleKeyUp}
|
|
263
|
+
>
|
|
264
|
+
${l}
|
|
265
|
+
</a>
|
|
266
|
+
` : t`
|
|
267
|
+
<button
|
|
268
|
+
${c(this.elementRef)}
|
|
269
|
+
type="button"
|
|
270
|
+
class="pkt-tabs__button pkt-link-button ${n}"
|
|
271
|
+
role=${s(r)}
|
|
272
|
+
aria-selected=${s(i)}
|
|
273
|
+
aria-controls=${s(this.controls || void 0)}
|
|
274
|
+
tabindex=${s(o)}
|
|
275
|
+
@click=${this.handleClick}
|
|
276
|
+
@keyup=${this.handleKeyUp}
|
|
277
|
+
>
|
|
278
|
+
${l}
|
|
279
|
+
</button>
|
|
280
|
+
`;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
r([i({
|
|
284
|
+
type: Boolean,
|
|
285
|
+
reflect: !0
|
|
286
|
+
})], b.prototype, "active", void 0), r([i({
|
|
287
|
+
type: String,
|
|
288
|
+
reflect: !0
|
|
289
|
+
})], b.prototype, "href", void 0), r([i({
|
|
290
|
+
type: String,
|
|
291
|
+
reflect: !0
|
|
292
|
+
})], b.prototype, "icon", void 0), r([i({
|
|
293
|
+
type: String,
|
|
294
|
+
reflect: !0
|
|
295
|
+
})], b.prototype, "controls", void 0), r([i({
|
|
296
|
+
type: String,
|
|
297
|
+
reflect: !0
|
|
298
|
+
})], b.prototype, "tag", void 0), r([i({
|
|
299
|
+
type: String,
|
|
300
|
+
reflect: !0,
|
|
301
|
+
attribute: "tag-skin"
|
|
302
|
+
})], b.prototype, "tagSkin", void 0), r([i({
|
|
303
|
+
type: Number,
|
|
304
|
+
reflect: !0
|
|
305
|
+
})], b.prototype, "index", void 0), r([_({
|
|
306
|
+
context: v,
|
|
307
|
+
subscribe: !0
|
|
308
|
+
}), i({ attribute: !1 })], b.prototype, "context", void 0);
|
|
309
|
+
try {
|
|
310
|
+
e("pkt-tab-item")(b);
|
|
311
|
+
} catch {
|
|
312
|
+
console.warn("Forsøker å definere <pkt-tab-item>, men den er allerede definert");
|
|
313
|
+
}
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region src/components/tabs/index.ts
|
|
316
|
+
var x = y;
|
|
317
|
+
//#endregion
|
|
318
|
+
export { b as n, y as r, x as t };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),n=require(`./element-with-slot-CWoTGA1B.cjs`);require(`./icon-Dr8sfT2X.cjs`);const r=require(`./if-defined-XKOD_t_V.cjs`);var i={name:`pkt-tag`,react:`PktTag`,"css-class":`pkt-tag`,isElement:!0,"dark-mode":!0,props:{size:{name:`Størrelse`,description:`Størrelsen på taggen`,required:!1,default:`medium`,type:[`small`,`medium`,`large`],category:`ui`},iconName:{name:`Ikon`,description:`Navnet på ikonet som skal vises i taggen`,type:`icon`,required:!1,category:`ui`},skin:{name:`Utseende`,description:`Utseendet til taggen`,required:!1,default:`blue`,type:[`blue`,`blue-light`,`blue-dark`,`green`,`red`,`beige`,`yellow`,`gray`],category:`ui`},closeTag:{name:`Lukk tag`,description:`Skal taggen ha en lukkeknapp?`,type:`boolean`,required:!1,default:!1,category:`ui`},textStyle:{name:`Tekststil`,description:`Stilen på teksten i taggen`,required:!1,default:`normal-text`,type:[`thin-text`,`normal-text`],category:`ui`},type:{name:`Type, dersom lukkeknapp`,description:`Type tag, brukes for å spesifisere om det er en knapp, submit eller reset`,required:!1,default:`button`,type:[`button`,`submit`,`reset`],category:`tech`},ariaLabel:{name:`aria-label`,description:`aria-label for taggen, brukes for tilgjengelighet`,type:`string`,required:!1,category:`accessibility`}},slots:{default:{description:`Teksten til tag`}}},a=class extends n.t{constructor(){super(),this.closeTag=i.props.closeTag.default,this.size=i.props.size.default,this.skin=i.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=i.props.type.default,this.ariaLabel=null,this.buttonTabindex=void 0,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent(`on-close`,{detail:{origin:e},bubbles:!1,composed:!0}))},this._isClosed=!1}firstUpdated(e){if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){let e=this.querySelector(`button span, .pkt-tag > span`)?.textContent?.trim();e&&(this._ariaDescription=`Klikk for å fjerne ${e}`)}}render(){let i={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},a={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?e.d`
|
|
2
|
+
<button
|
|
3
|
+
class=${t.t(a)}
|
|
4
|
+
type=${this.type}
|
|
5
|
+
tabindex=${r.t(this.buttonTabindex)}
|
|
6
|
+
@click=${this.close}
|
|
7
|
+
aria-label=${r.t(this.ariaLabel||void 0)}
|
|
8
|
+
aria-description=${r.t(this._ariaDescription||void 0)}
|
|
9
|
+
>
|
|
10
|
+
${this.iconName&&e.d`<pkt-icon
|
|
11
|
+
class="pkt-tag__icon"
|
|
12
|
+
name=${this.iconName}
|
|
13
|
+
aria-hidden="true"
|
|
14
|
+
></pkt-icon>`}
|
|
15
|
+
<span>${n.n(this)}</span>
|
|
16
|
+
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
17
|
+
</button>
|
|
18
|
+
`:e.d`
|
|
19
|
+
<span class=${t.t(i)}>
|
|
20
|
+
${this.iconName&&e.d`<pkt-icon
|
|
21
|
+
class="pkt-tag__icon"
|
|
22
|
+
name=${this.iconName}
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
></pkt-icon>`}
|
|
25
|
+
<span>${n.n(this)}</span>
|
|
26
|
+
</span>
|
|
27
|
+
`}};e.r([e.s({type:Boolean,reflect:!0})],a.prototype,`closeTag`,void 0),e.r([e.s({type:String,reflect:!0})],a.prototype,`size`,void 0),e.r([e.s({type:String,reflect:!0})],a.prototype,`skin`,void 0),e.r([e.s({type:String,reflect:!0})],a.prototype,`textStyle`,void 0),e.r([e.s({type:String,reflect:!0})],a.prototype,`iconName`,void 0),e.r([e.s({type:String})],a.prototype,`type`,void 0),e.r([e.s({type:String})],a.prototype,`ariaLabel`,void 0),e.r([e.s({type:Number,attribute:`button-tabindex`})],a.prototype,`buttonTabindex`,void 0),e.r([e.o()],a.prototype,`_isClosed`,void 0),e.r([e.o()],a.prototype,`_ariaDescription`,void 0);try{e.c(`pkt-tag`)(a)}catch{console.warn(`Forsøker å definere <pkt-tag>, men den er allerede definert`)}var o=a;Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { c as e, d as t, o as n, r, s as i } from "./element-cZ85T_aa.js";
|
|
2
|
+
import { t as a } from "./class-map-C8HuhNzZ.js";
|
|
3
|
+
import { n as o, t as s } from "./element-with-slot-4J2o3SeU.js";
|
|
4
|
+
import "./icon-Co72KtgF.js";
|
|
5
|
+
import { t as c } from "./if-defined-Cjj8qN-Z.js";
|
|
6
|
+
var l = {
|
|
7
|
+
name: "pkt-tag",
|
|
8
|
+
react: "PktTag",
|
|
9
|
+
"css-class": "pkt-tag",
|
|
10
|
+
isElement: !0,
|
|
11
|
+
"dark-mode": !0,
|
|
12
|
+
props: {
|
|
13
|
+
size: {
|
|
14
|
+
name: "Størrelse",
|
|
15
|
+
description: "Størrelsen på taggen",
|
|
16
|
+
required: !1,
|
|
17
|
+
default: "medium",
|
|
18
|
+
type: [
|
|
19
|
+
"small",
|
|
20
|
+
"medium",
|
|
21
|
+
"large"
|
|
22
|
+
],
|
|
23
|
+
category: "ui"
|
|
24
|
+
},
|
|
25
|
+
iconName: {
|
|
26
|
+
name: "Ikon",
|
|
27
|
+
description: "Navnet på ikonet som skal vises i taggen",
|
|
28
|
+
type: "icon",
|
|
29
|
+
required: !1,
|
|
30
|
+
category: "ui"
|
|
31
|
+
},
|
|
32
|
+
skin: {
|
|
33
|
+
name: "Utseende",
|
|
34
|
+
description: "Utseendet til taggen",
|
|
35
|
+
required: !1,
|
|
36
|
+
default: "blue",
|
|
37
|
+
type: [
|
|
38
|
+
"blue",
|
|
39
|
+
"blue-light",
|
|
40
|
+
"blue-dark",
|
|
41
|
+
"green",
|
|
42
|
+
"red",
|
|
43
|
+
"beige",
|
|
44
|
+
"yellow",
|
|
45
|
+
"gray"
|
|
46
|
+
],
|
|
47
|
+
category: "ui"
|
|
48
|
+
},
|
|
49
|
+
closeTag: {
|
|
50
|
+
name: "Lukk tag",
|
|
51
|
+
description: "Skal taggen ha en lukkeknapp?",
|
|
52
|
+
type: "boolean",
|
|
53
|
+
required: !1,
|
|
54
|
+
default: !1,
|
|
55
|
+
category: "ui"
|
|
56
|
+
},
|
|
57
|
+
textStyle: {
|
|
58
|
+
name: "Tekststil",
|
|
59
|
+
description: "Stilen på teksten i taggen",
|
|
60
|
+
required: !1,
|
|
61
|
+
default: "normal-text",
|
|
62
|
+
type: ["thin-text", "normal-text"],
|
|
63
|
+
category: "ui"
|
|
64
|
+
},
|
|
65
|
+
type: {
|
|
66
|
+
name: "Type, dersom lukkeknapp",
|
|
67
|
+
description: "Type tag, brukes for å spesifisere om det er en knapp, submit eller reset",
|
|
68
|
+
required: !1,
|
|
69
|
+
default: "button",
|
|
70
|
+
type: [
|
|
71
|
+
"button",
|
|
72
|
+
"submit",
|
|
73
|
+
"reset"
|
|
74
|
+
],
|
|
75
|
+
category: "tech"
|
|
76
|
+
},
|
|
77
|
+
ariaLabel: {
|
|
78
|
+
name: "aria-label",
|
|
79
|
+
description: "aria-label for taggen, brukes for tilgjengelighet",
|
|
80
|
+
type: "string",
|
|
81
|
+
required: !1,
|
|
82
|
+
category: "accessibility"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
slots: { default: { description: "Teksten til tag" } }
|
|
86
|
+
}, u = class extends s {
|
|
87
|
+
constructor() {
|
|
88
|
+
super(), this.closeTag = l.props.closeTag.default, this.size = l.props.size.default, this.skin = l.props.skin.default, this.textStyle = null, this.iconName = void 0, this.type = l.props.type.default, this.ariaLabel = null, this.buttonTabindex = void 0, this._isClosed = !1, this._ariaDescription = null, this.close = (e) => {
|
|
89
|
+
this._isClosed = !0, this.dispatchEvent(new CustomEvent("close", {
|
|
90
|
+
detail: { origin: e },
|
|
91
|
+
bubbles: !1,
|
|
92
|
+
composed: !0
|
|
93
|
+
})), this.dispatchEvent(new CustomEvent("on-close", {
|
|
94
|
+
detail: { origin: e },
|
|
95
|
+
bubbles: !1,
|
|
96
|
+
composed: !0
|
|
97
|
+
}));
|
|
98
|
+
}, this._isClosed = !1;
|
|
99
|
+
}
|
|
100
|
+
firstUpdated(e) {
|
|
101
|
+
if (super.firstUpdated(e), this.closeTag && !this.ariaLabel) {
|
|
102
|
+
let e = this.querySelector("button span, .pkt-tag > span")?.textContent?.trim();
|
|
103
|
+
e && (this._ariaDescription = `Klikk for å fjerne ${e}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
render() {
|
|
107
|
+
let e = {
|
|
108
|
+
"pkt-tag": !0,
|
|
109
|
+
[`pkt-tag--${this.size}`]: !!this.size,
|
|
110
|
+
[`pkt-tag--${this.skin}`]: !!this.skin,
|
|
111
|
+
[`pkt-tag--${this.textStyle}`]: !!this.textStyle
|
|
112
|
+
}, n = {
|
|
113
|
+
"pkt-tag": !0,
|
|
114
|
+
"pkt-btn": !0,
|
|
115
|
+
"pkt-btn--tertiary": !0,
|
|
116
|
+
[`pkt-tag--${this.textStyle}`]: !!this.textStyle,
|
|
117
|
+
[`pkt-tag--${this.size}`]: !!this.size,
|
|
118
|
+
[`pkt-tag--${this.skin}`]: !!this.skin,
|
|
119
|
+
"pkt-btn--icons-right-and-left": this.closeTag && !!this.iconName,
|
|
120
|
+
"pkt-hide": this._isClosed
|
|
121
|
+
};
|
|
122
|
+
return this.closeTag ? t`
|
|
123
|
+
<button
|
|
124
|
+
class=${a(n)}
|
|
125
|
+
type=${this.type}
|
|
126
|
+
tabindex=${c(this.buttonTabindex)}
|
|
127
|
+
@click=${this.close}
|
|
128
|
+
aria-label=${c(this.ariaLabel || void 0)}
|
|
129
|
+
aria-description=${c(this._ariaDescription || void 0)}
|
|
130
|
+
>
|
|
131
|
+
${this.iconName && t`<pkt-icon
|
|
132
|
+
class="pkt-tag__icon"
|
|
133
|
+
name=${this.iconName}
|
|
134
|
+
aria-hidden="true"
|
|
135
|
+
></pkt-icon>`}
|
|
136
|
+
<span>${o(this)}</span>
|
|
137
|
+
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
138
|
+
</button>
|
|
139
|
+
` : t`
|
|
140
|
+
<span class=${a(e)}>
|
|
141
|
+
${this.iconName && t`<pkt-icon
|
|
142
|
+
class="pkt-tag__icon"
|
|
143
|
+
name=${this.iconName}
|
|
144
|
+
aria-hidden="true"
|
|
145
|
+
></pkt-icon>`}
|
|
146
|
+
<span>${o(this)}</span>
|
|
147
|
+
</span>
|
|
148
|
+
`;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
r([i({
|
|
152
|
+
type: Boolean,
|
|
153
|
+
reflect: !0
|
|
154
|
+
})], u.prototype, "closeTag", void 0), r([i({
|
|
155
|
+
type: String,
|
|
156
|
+
reflect: !0
|
|
157
|
+
})], u.prototype, "size", void 0), r([i({
|
|
158
|
+
type: String,
|
|
159
|
+
reflect: !0
|
|
160
|
+
})], u.prototype, "skin", void 0), r([i({
|
|
161
|
+
type: String,
|
|
162
|
+
reflect: !0
|
|
163
|
+
})], u.prototype, "textStyle", void 0), r([i({
|
|
164
|
+
type: String,
|
|
165
|
+
reflect: !0
|
|
166
|
+
})], u.prototype, "iconName", void 0), r([i({ type: String })], u.prototype, "type", void 0), r([i({ type: String })], u.prototype, "ariaLabel", void 0), r([i({
|
|
167
|
+
type: Number,
|
|
168
|
+
attribute: "button-tabindex"
|
|
169
|
+
})], u.prototype, "buttonTabindex", void 0), r([n()], u.prototype, "_isClosed", void 0), r([n()], u.prototype, "_ariaDescription", void 0);
|
|
170
|
+
try {
|
|
171
|
+
e("pkt-tag")(u);
|
|
172
|
+
} catch {
|
|
173
|
+
console.warn("Forsøker å definere <pkt-tag>, men den er allerede definert");
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/components/tag/index.ts
|
|
177
|
+
var d = u;
|
|
178
|
+
//#endregion
|
|
179
|
+
export { u as n, d as t };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const e=require(`./element-DjtxO-1r.cjs`),t=require(`./directive-CJ2giQBZ.cjs`),n=require(`./class-map-CJ-msbHs.cjs`),r=require(`./directive-helpers-D1QSxY17.cjs`),i=require(`./element-with-slot-CWoTGA1B.cjs`);require(`./icon-Dr8sfT2X.cjs`);const a=require(`./if-defined-XKOD_t_V.cjs`),o=require(`./ref-BaJ0mBT_.cjs`),s=require(`./input-element-B1yxcfz4.cjs`);require(`./input-wrapper-BRuVELpK.cjs`);var c=t.t(class extends t.n{constructor(e){if(super(e),e.type!==t.r.PROPERTY&&e.type!==t.r.ATTRIBUTE&&e.type!==t.r.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!r.i(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(n,[i]){if(i===e.u||i===e.l)return i;let a=n.element,o=n.name;if(n.type===t.r.PROPERTY){if(i===a[o])return e.u}else if(n.type===t.r.BOOLEAN_ATTRIBUTE){if(!!i===a.hasAttribute(o))return e.u}else if(n.type===t.r.ATTRIBUTE&&a.getAttribute(o)===i+``)return e.u;return r.r(n),i}}),l=class extends s.t{constructor(...e){super(...e),this.inputRef=o.t(),this.value=``,this.autocomplete=`off`,this.rows=null,this.counterCurrent=0}attributeChangedCallback(e,t,n){e===`value`&&this.value!==t&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,t)),super.attributeChangedCallback(e,t,n)}updated(e){super.updated(e),e.has(`value`)&&(this.counterCurrent=this.value?.length||0,this.valueChanged(this.value,e.get(`value`))),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}render(){let t=n.t({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),r=this.ariaLabelledby||`${this.id}-input-label`;return e.d`<pkt-input-wrapper
|
|
2
|
+
label=${this.label}
|
|
3
|
+
?counter=${this.counter}
|
|
4
|
+
?disabled=${this.disabled}
|
|
5
|
+
?hasError=${this.hasError}
|
|
6
|
+
?inline=${this.inline}
|
|
7
|
+
?optionalTag=${this.optionalTag}
|
|
8
|
+
?required=${this.required}
|
|
9
|
+
?requiredTag=${this.requiredTag}
|
|
10
|
+
useWrapper=${this.useWrapper}
|
|
11
|
+
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
12
|
+
.counterCurrent=${this.counterCurrent}
|
|
13
|
+
.counterMaxLength=${this.counterMaxLength}
|
|
14
|
+
.errorMessage=${this.errorMessage}
|
|
15
|
+
.forId="${this.id+`-input`}"
|
|
16
|
+
.helptext=${this.helptext}
|
|
17
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
18
|
+
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
19
|
+
.optionalText=${this.optionalText}
|
|
20
|
+
.requiredText=${this.requiredText}
|
|
21
|
+
.tagText=${this.tagText}
|
|
22
|
+
class="pkt-textarea"
|
|
23
|
+
>
|
|
24
|
+
<div class="pkt-contents" slot="helptext">${i.n(this,`helptext`)}</div>
|
|
25
|
+
<textarea
|
|
26
|
+
${o.n(this.inputRef)}
|
|
27
|
+
class=${t}
|
|
28
|
+
id=${this.id+`-input`}
|
|
29
|
+
name=${(this.name||this.id)+`-input`}
|
|
30
|
+
placeholder=${a.t(this.placeholder)}
|
|
31
|
+
.value=${c(this.value)}
|
|
32
|
+
minlength=${a.t(this.minlength)}
|
|
33
|
+
maxlength=${a.t(this.maxlength)}
|
|
34
|
+
?readonly=${this.readonly}
|
|
35
|
+
autocomplete=${this.autocomplete}
|
|
36
|
+
aria-labelledby=${r}
|
|
37
|
+
aria-invalid=${this.hasError}
|
|
38
|
+
aria-errormessage=${`${this.id}-error`}
|
|
39
|
+
rows=${this.rows}
|
|
40
|
+
?disabled=${this.disabled}
|
|
41
|
+
@input=${e=>{this.value=e.target.value,this.onInput(),e.stopImmediatePropagation()}}
|
|
42
|
+
@change=${e=>{e.stopImmediatePropagation()}}
|
|
43
|
+
@focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
|
|
44
|
+
@blur=${e=>{this.value=e.target.value,this.onBlur(),e.stopImmediatePropagation()}}
|
|
45
|
+
></textarea>
|
|
46
|
+
</pkt-input-wrapper>`}};e.r([e.s({type:String,reflect:!0})],l.prototype,`value`,void 0),e.r([e.s({type:String})],l.prototype,`autocomplete`,void 0),e.r([e.s({type:Number})],l.prototype,`rows`,void 0),e.r([e.o()],l.prototype,`counterCurrent`,void 0);try{e.c(`pkt-textarea`)(l)}catch{console.warn(`Forsøker å definere <pkt-textarea>, men den er allerede definert`)}var u=l;Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return u}});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { c as e, d as t, l as n, o as r, r as i, s as a, u as o } from "./element-cZ85T_aa.js";
|
|
2
|
+
import { n as s, r as c, t as l } from "./directive-3THFsVew.js";
|
|
3
|
+
import { t as u } from "./class-map-C8HuhNzZ.js";
|
|
4
|
+
import { i as d, r as f } from "./directive-helpers-Dkv2gKgs.js";
|
|
5
|
+
import { n as p } from "./element-with-slot-4J2o3SeU.js";
|
|
6
|
+
import "./icon-Co72KtgF.js";
|
|
7
|
+
import { t as m } from "./if-defined-Cjj8qN-Z.js";
|
|
8
|
+
import { n as h, t as g } from "./ref-RS8Uv6uC.js";
|
|
9
|
+
import { t as _ } from "./input-element-Bw1s6NlF.js";
|
|
10
|
+
import "./input-wrapper-YfTmpSSY.js";
|
|
11
|
+
//#region ../../node_modules/lit-html/directives/live.js
|
|
12
|
+
var v = l(class extends s {
|
|
13
|
+
constructor(e) {
|
|
14
|
+
if (super(e), e.type !== c.PROPERTY && e.type !== c.ATTRIBUTE && e.type !== c.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
|
|
15
|
+
if (!d(e)) throw Error("`live` bindings can only contain a single expression");
|
|
16
|
+
}
|
|
17
|
+
render(e) {
|
|
18
|
+
return e;
|
|
19
|
+
}
|
|
20
|
+
update(e, [t]) {
|
|
21
|
+
if (t === o || t === n) return t;
|
|
22
|
+
let r = e.element, i = e.name;
|
|
23
|
+
if (e.type === c.PROPERTY) {
|
|
24
|
+
if (t === r[i]) return o;
|
|
25
|
+
} else if (e.type === c.BOOLEAN_ATTRIBUTE) {
|
|
26
|
+
if (!!t === r.hasAttribute(i)) return o;
|
|
27
|
+
} else if (e.type === c.ATTRIBUTE && r.getAttribute(i) === t + "") return o;
|
|
28
|
+
return f(e), t;
|
|
29
|
+
}
|
|
30
|
+
}), y = class extends _ {
|
|
31
|
+
constructor(...e) {
|
|
32
|
+
super(...e), this.inputRef = g(), this.value = "", this.autocomplete = "off", this.rows = null, this.counterCurrent = 0;
|
|
33
|
+
}
|
|
34
|
+
attributeChangedCallback(e, t, n) {
|
|
35
|
+
e === "value" && this.value !== t && (this.counterCurrent = n ? n.length : 0, this.valueChanged(n, t)), super.attributeChangedCallback(e, t, n);
|
|
36
|
+
}
|
|
37
|
+
updated(e) {
|
|
38
|
+
super.updated(e), e.has("value") && (this.counterCurrent = this.value?.length || 0, this.valueChanged(this.value, e.get("value"))), e.has("id") && !this.name && this.id && (this.name = this.id);
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
let e = u({
|
|
42
|
+
"pkt-input": !0,
|
|
43
|
+
"pkt-input--fullwidth": this.fullwidth,
|
|
44
|
+
"pkt-input--counter-error": this.counter && this.counterMaxLength && this.value.length && this.value.length > this.counterMaxLength
|
|
45
|
+
}), n = this.ariaLabelledby || `${this.id}-input-label`;
|
|
46
|
+
return t`<pkt-input-wrapper
|
|
47
|
+
label=${this.label}
|
|
48
|
+
?counter=${this.counter}
|
|
49
|
+
?disabled=${this.disabled}
|
|
50
|
+
?hasError=${this.hasError}
|
|
51
|
+
?inline=${this.inline}
|
|
52
|
+
?optionalTag=${this.optionalTag}
|
|
53
|
+
?required=${this.required}
|
|
54
|
+
?requiredTag=${this.requiredTag}
|
|
55
|
+
useWrapper=${this.useWrapper}
|
|
56
|
+
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
57
|
+
.counterCurrent=${this.counterCurrent}
|
|
58
|
+
.counterMaxLength=${this.counterMaxLength}
|
|
59
|
+
.errorMessage=${this.errorMessage}
|
|
60
|
+
.forId="${this.id + "-input"}"
|
|
61
|
+
.helptext=${this.helptext}
|
|
62
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
63
|
+
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
64
|
+
.optionalText=${this.optionalText}
|
|
65
|
+
.requiredText=${this.requiredText}
|
|
66
|
+
.tagText=${this.tagText}
|
|
67
|
+
class="pkt-textarea"
|
|
68
|
+
>
|
|
69
|
+
<div class="pkt-contents" slot="helptext">${p(this, "helptext")}</div>
|
|
70
|
+
<textarea
|
|
71
|
+
${h(this.inputRef)}
|
|
72
|
+
class=${e}
|
|
73
|
+
id=${this.id + "-input"}
|
|
74
|
+
name=${(this.name || this.id) + "-input"}
|
|
75
|
+
placeholder=${m(this.placeholder)}
|
|
76
|
+
.value=${v(this.value)}
|
|
77
|
+
minlength=${m(this.minlength)}
|
|
78
|
+
maxlength=${m(this.maxlength)}
|
|
79
|
+
?readonly=${this.readonly}
|
|
80
|
+
autocomplete=${this.autocomplete}
|
|
81
|
+
aria-labelledby=${n}
|
|
82
|
+
aria-invalid=${this.hasError}
|
|
83
|
+
aria-errormessage=${`${this.id}-error`}
|
|
84
|
+
rows=${this.rows}
|
|
85
|
+
?disabled=${this.disabled}
|
|
86
|
+
@input=${(e) => {
|
|
87
|
+
this.value = e.target.value, this.onInput(), e.stopImmediatePropagation();
|
|
88
|
+
}}
|
|
89
|
+
@change=${(e) => {
|
|
90
|
+
e.stopImmediatePropagation();
|
|
91
|
+
}}
|
|
92
|
+
@focus=${(e) => {
|
|
93
|
+
this.onFocus(), e.stopImmediatePropagation();
|
|
94
|
+
}}
|
|
95
|
+
@blur=${(e) => {
|
|
96
|
+
this.value = e.target.value, this.onBlur(), e.stopImmediatePropagation();
|
|
97
|
+
}}
|
|
98
|
+
></textarea>
|
|
99
|
+
</pkt-input-wrapper>`;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
i([a({
|
|
103
|
+
type: String,
|
|
104
|
+
reflect: !0
|
|
105
|
+
})], y.prototype, "value", void 0), i([a({ type: String })], y.prototype, "autocomplete", void 0), i([a({ type: Number })], y.prototype, "rows", void 0), i([r()], y.prototype, "counterCurrent", void 0);
|
|
106
|
+
try {
|
|
107
|
+
e("pkt-textarea")(y);
|
|
108
|
+
} catch {
|
|
109
|
+
console.warn("Forsøker å definere <pkt-textarea>, men den er allerede definert");
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/components/textarea/index.ts
|
|
113
|
+
var b = y;
|
|
114
|
+
//#endregion
|
|
115
|
+
export { y as n, b as t };
|