@oslokommune/punkt-elements 16.7.1 → 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 +17 -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 +16 -16
- package/dist/pkt-timepicker.js +91 -89
- 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 +6 -1
- 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
package/dist/tabitem-CB8wkKmv.js
DELETED
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
import { P as k, s as $ } from "./element-with-slot-Dqk6-TRR.js";
|
|
2
|
-
import { b as p, n as h, t as y } from "./element-CPpT3rFQ.js";
|
|
3
|
-
import { r as f } from "./state-C_1EOo3D.js";
|
|
4
|
-
import { e as _, n as w } from "./ref-Bg_Swj5w.js";
|
|
5
|
-
import { o as u } from "./if-defined-B0krMLad.js";
|
|
6
|
-
/**
|
|
7
|
-
* @license
|
|
8
|
-
* Copyright 2021 Google LLC
|
|
9
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
10
|
-
*/
|
|
11
|
-
let C = class extends Event {
|
|
12
|
-
constructor(t, s, i, e) {
|
|
13
|
-
super("context-request", { bubbles: !0, composed: !0 }), this.context = t, this.contextTarget = s, this.callback = i, this.subscribe = e ?? !1;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @license
|
|
18
|
-
* Copyright 2021 Google LLC
|
|
19
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* @license
|
|
23
|
-
* Copyright 2021 Google LLC
|
|
24
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
-
*/
|
|
26
|
-
let m = class {
|
|
27
|
-
constructor(t, s, i, e) {
|
|
28
|
-
if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (n, r) => {
|
|
29
|
-
this.unsubscribe && (this.unsubscribe !== r && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = n, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(n, r)), this.unsubscribe = r;
|
|
30
|
-
}, this.host = t, s.context !== void 0) {
|
|
31
|
-
const n = s;
|
|
32
|
-
this.context = n.context, this.callback = n.callback, this.subscribe = n.subscribe ?? !1;
|
|
33
|
-
} else this.context = s, this.callback = i, this.subscribe = e ?? !1;
|
|
34
|
-
this.host.addController(this);
|
|
35
|
-
}
|
|
36
|
-
hostConnected() {
|
|
37
|
-
this.dispatchRequest();
|
|
38
|
-
}
|
|
39
|
-
hostDisconnected() {
|
|
40
|
-
this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0);
|
|
41
|
-
}
|
|
42
|
-
dispatchRequest() {
|
|
43
|
-
this.host.dispatchEvent(new C(this.context, this.host, this.t, this.subscribe));
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* @license
|
|
48
|
-
* Copyright 2021 Google LLC
|
|
49
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
50
|
-
*/
|
|
51
|
-
class N {
|
|
52
|
-
get value() {
|
|
53
|
-
return this.o;
|
|
54
|
-
}
|
|
55
|
-
set value(t) {
|
|
56
|
-
this.setValue(t);
|
|
57
|
-
}
|
|
58
|
-
setValue(t, s = !1) {
|
|
59
|
-
const i = s || !Object.is(t, this.o);
|
|
60
|
-
this.o = t, i && this.updateObservers();
|
|
61
|
-
}
|
|
62
|
-
constructor(t) {
|
|
63
|
-
this.subscriptions = /* @__PURE__ */ new Map(), this.updateObservers = () => {
|
|
64
|
-
for (const [s, { disposer: i }] of this.subscriptions) s(this.o, i);
|
|
65
|
-
}, t !== void 0 && (this.value = t);
|
|
66
|
-
}
|
|
67
|
-
addCallback(t, s, i) {
|
|
68
|
-
if (!i) return void t(this.value);
|
|
69
|
-
this.subscriptions.has(t) || this.subscriptions.set(t, { disposer: () => {
|
|
70
|
-
this.subscriptions.delete(t);
|
|
71
|
-
}, consumerHost: s });
|
|
72
|
-
const { disposer: e } = this.subscriptions.get(t);
|
|
73
|
-
t(this.value, e);
|
|
74
|
-
}
|
|
75
|
-
clearCallbacks() {
|
|
76
|
-
this.subscriptions.clear();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* @license
|
|
81
|
-
* Copyright 2021 Google LLC
|
|
82
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
83
|
-
*/
|
|
84
|
-
let R = class extends Event {
|
|
85
|
-
constructor(t, s) {
|
|
86
|
-
super("context-provider", { bubbles: !0, composed: !0 }), this.context = t, this.contextTarget = s;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
class g extends N {
|
|
90
|
-
constructor(t, s, i) {
|
|
91
|
-
var e, n;
|
|
92
|
-
super(s.context !== void 0 ? s.initialValue : i), this.onContextRequest = (r) => {
|
|
93
|
-
if (r.context !== this.context) return;
|
|
94
|
-
const a = r.contextTarget ?? r.composedPath()[0];
|
|
95
|
-
a !== this.host && (r.stopPropagation(), this.addCallback(r.callback, a, r.subscribe));
|
|
96
|
-
}, this.onProviderRequest = (r) => {
|
|
97
|
-
if (r.context !== this.context || (r.contextTarget ?? r.composedPath()[0]) === this.host) return;
|
|
98
|
-
const a = /* @__PURE__ */ new Set();
|
|
99
|
-
for (const [v, { consumerHost: x }] of this.subscriptions) a.has(v) || (a.add(v), x.dispatchEvent(new C(this.context, x, v, !0)));
|
|
100
|
-
r.stopPropagation();
|
|
101
|
-
}, this.host = t, s.context !== void 0 ? this.context = s.context : this.context = s, this.attachListeners(), (n = (e = this.host).addController) == null || n.call(e, this);
|
|
102
|
-
}
|
|
103
|
-
attachListeners() {
|
|
104
|
-
this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
|
|
105
|
-
}
|
|
106
|
-
hostConnected() {
|
|
107
|
-
this.host.dispatchEvent(new R(this.context, this.host));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* @license
|
|
112
|
-
* Copyright 2017 Google LLC
|
|
113
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
114
|
-
*/
|
|
115
|
-
function A({ context: o }) {
|
|
116
|
-
return (t, s) => {
|
|
117
|
-
const i = /* @__PURE__ */ new WeakMap();
|
|
118
|
-
if (typeof s == "object") return { get() {
|
|
119
|
-
return t.get.call(this);
|
|
120
|
-
}, set(e) {
|
|
121
|
-
return i.get(this).setValue(e), t.set.call(this, e);
|
|
122
|
-
}, init(e) {
|
|
123
|
-
return i.set(this, new g(this, { context: o, initialValue: e })), e;
|
|
124
|
-
} };
|
|
125
|
-
{
|
|
126
|
-
t.constructor.addInitializer(((r) => {
|
|
127
|
-
i.set(r, new g(r, { context: o }));
|
|
128
|
-
}));
|
|
129
|
-
const e = Object.getOwnPropertyDescriptor(t, s);
|
|
130
|
-
let n;
|
|
131
|
-
if (e === void 0) {
|
|
132
|
-
const r = /* @__PURE__ */ new WeakMap();
|
|
133
|
-
n = { get() {
|
|
134
|
-
return r.get(this);
|
|
135
|
-
}, set(a) {
|
|
136
|
-
i.get(this).setValue(a), r.set(this, a);
|
|
137
|
-
}, configurable: !0, enumerable: !0 };
|
|
138
|
-
} else {
|
|
139
|
-
const r = e.set;
|
|
140
|
-
n = { ...e, set(a) {
|
|
141
|
-
i.get(this).setValue(a), r == null || r.call(this, a);
|
|
142
|
-
} };
|
|
143
|
-
}
|
|
144
|
-
return void Object.defineProperty(t, s, n);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* @license
|
|
150
|
-
* Copyright 2022 Google LLC
|
|
151
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
152
|
-
*/
|
|
153
|
-
function O({ context: o, subscribe: t }) {
|
|
154
|
-
return (s, i) => {
|
|
155
|
-
typeof i == "object" ? i.addInitializer((function() {
|
|
156
|
-
new m(this, { context: o, callback: (e) => {
|
|
157
|
-
s.set.call(this, e);
|
|
158
|
-
}, subscribe: t });
|
|
159
|
-
})) : s.constructor.addInitializer(((e) => {
|
|
160
|
-
new m(e, { context: o, callback: (n) => {
|
|
161
|
-
e[i] = n;
|
|
162
|
-
}, subscribe: t });
|
|
163
|
-
}));
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
const P = Symbol("pkt-tabs-context");
|
|
167
|
-
var S = Object.defineProperty, T = Object.getOwnPropertyDescriptor, d = (o, t, s, i) => {
|
|
168
|
-
for (var e = i > 1 ? void 0 : i ? T(t, s) : t, n = o.length - 1, r; n >= 0; n--)
|
|
169
|
-
(r = o[n]) && (e = (i ? r(t, s, e) : r(e)) || e);
|
|
170
|
-
return i && e && S(t, s, e), e;
|
|
171
|
-
};
|
|
172
|
-
let b = class extends k {
|
|
173
|
-
constructor() {
|
|
174
|
-
super(...arguments), 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
|
-
// Update context when properties change
|
|
185
|
-
updated(o) {
|
|
186
|
-
(o.has("arrowNav") || o.has("disableArrowNav")) && (this.context = {
|
|
187
|
-
...this.context,
|
|
188
|
-
useArrowNav: this.useArrowNav
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
registerTab(o, t) {
|
|
192
|
-
this.tabRefs[t] = o, this.tabCount = Math.max(this.tabCount, t + 1);
|
|
193
|
-
}
|
|
194
|
-
handleClick(o) {
|
|
195
|
-
this.dispatchEvent(
|
|
196
|
-
new CustomEvent("tab-selected", {
|
|
197
|
-
detail: { index: o },
|
|
198
|
-
bubbles: !0,
|
|
199
|
-
composed: !0
|
|
200
|
-
})
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
handleKeyUp(o, t) {
|
|
204
|
-
var s, i;
|
|
205
|
-
this.useArrowNav && (o.code === "ArrowLeft" && t !== 0 && ((s = this.tabRefs[t - 1]) == null || s.focus()), o.code === "ArrowRight" && t < this.tabCount - 1 && ((i = this.tabRefs[t + 1]) == null || i.focus()), (o.code === "ArrowDown" || o.code === "Space") && this.dispatchEvent(
|
|
206
|
-
new CustomEvent("tab-selected", {
|
|
207
|
-
detail: { index: t },
|
|
208
|
-
bubbles: !0,
|
|
209
|
-
composed: !0
|
|
210
|
-
})
|
|
211
|
-
));
|
|
212
|
-
}
|
|
213
|
-
render() {
|
|
214
|
-
const o = this.useArrowNav ? "tablist" : "navigation";
|
|
215
|
-
return p`
|
|
216
|
-
<div class="pkt-tabs">
|
|
217
|
-
<div class="pkt-tabs__list" role=${o}>${$(this)}</div>
|
|
218
|
-
</div>
|
|
219
|
-
`;
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
d([
|
|
223
|
-
h({ type: Boolean, reflect: !0, attribute: "arrow-nav" })
|
|
224
|
-
], b.prototype, "arrowNav", 2);
|
|
225
|
-
d([
|
|
226
|
-
h({ type: Boolean, reflect: !0, attribute: "disable-arrow-nav" })
|
|
227
|
-
], b.prototype, "disableArrowNav", 2);
|
|
228
|
-
d([
|
|
229
|
-
f()
|
|
230
|
-
], b.prototype, "tabRefs", 2);
|
|
231
|
-
d([
|
|
232
|
-
f()
|
|
233
|
-
], b.prototype, "tabCount", 2);
|
|
234
|
-
d([
|
|
235
|
-
A({ context: P }),
|
|
236
|
-
f()
|
|
237
|
-
], b.prototype, "context", 2);
|
|
238
|
-
b = d([
|
|
239
|
-
y("pkt-tabs")
|
|
240
|
-
], b);
|
|
241
|
-
const M = b;
|
|
242
|
-
var j = Object.defineProperty, q = Object.getOwnPropertyDescriptor, l = (o, t, s, i) => {
|
|
243
|
-
for (var e = i > 1 ? void 0 : i ? q(t, s) : t, n = o.length - 1, r; n >= 0; n--)
|
|
244
|
-
(r = o[n]) && (e = (i ? r(t, s, e) : r(e)) || e);
|
|
245
|
-
return i && e && j(t, s, e), e;
|
|
246
|
-
};
|
|
247
|
-
let c = class extends k {
|
|
248
|
-
constructor() {
|
|
249
|
-
super(), this.active = !1, this.href = "", this.icon = "", this.controls = "", this.tag = "", this.tagSkin = "blue", this.index = 0, this.elementRef = _();
|
|
250
|
-
}
|
|
251
|
-
connectedCallback() {
|
|
252
|
-
super.connectedCallback(), this.updateComplete.then(() => {
|
|
253
|
-
this.elementRef.value && this.context && this.context.registerTab(this.elementRef.value, this.index);
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
handleClick() {
|
|
257
|
-
this.context && this.context.handleClick(this.index);
|
|
258
|
-
}
|
|
259
|
-
handleKeyUp(o) {
|
|
260
|
-
this.context && this.context.handleKeyUp(o, this.index);
|
|
261
|
-
}
|
|
262
|
-
render() {
|
|
263
|
-
var r;
|
|
264
|
-
const o = ((r = this.context) == null ? void 0 : r.useArrowNav) ?? !0, t = this.active ? "active" : "", s = o ? "tab" : void 0, i = o ? this.active : void 0, e = this.active || !o ? void 0 : -1, n = p`
|
|
265
|
-
${this.icon ? p`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>` : ""}
|
|
266
|
-
<span>${$(this)}</span>
|
|
267
|
-
${this.tag ? p`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>` : ""}
|
|
268
|
-
`;
|
|
269
|
-
return this.href ? p`
|
|
270
|
-
<a
|
|
271
|
-
${w(this.elementRef)}
|
|
272
|
-
href=${this.href}
|
|
273
|
-
class="pkt-tabs__link ${t}"
|
|
274
|
-
role=${u(s)}
|
|
275
|
-
aria-selected=${u(i)}
|
|
276
|
-
aria-controls=${u(this.controls || void 0)}
|
|
277
|
-
tabindex=${u(e)}
|
|
278
|
-
@click=${this.handleClick}
|
|
279
|
-
@keyup=${this.handleKeyUp}
|
|
280
|
-
>
|
|
281
|
-
${n}
|
|
282
|
-
</a>
|
|
283
|
-
` : p`
|
|
284
|
-
<button
|
|
285
|
-
${w(this.elementRef)}
|
|
286
|
-
type="button"
|
|
287
|
-
class="pkt-tabs__button pkt-link-button ${t}"
|
|
288
|
-
role=${u(s)}
|
|
289
|
-
aria-selected=${u(i)}
|
|
290
|
-
aria-controls=${u(this.controls || void 0)}
|
|
291
|
-
tabindex=${u(e)}
|
|
292
|
-
@click=${this.handleClick}
|
|
293
|
-
@keyup=${this.handleKeyUp}
|
|
294
|
-
>
|
|
295
|
-
${n}
|
|
296
|
-
</button>
|
|
297
|
-
`;
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
l([
|
|
301
|
-
h({ type: Boolean, reflect: !0 })
|
|
302
|
-
], c.prototype, "active", 2);
|
|
303
|
-
l([
|
|
304
|
-
h({ type: String, reflect: !0 })
|
|
305
|
-
], c.prototype, "href", 2);
|
|
306
|
-
l([
|
|
307
|
-
h({ type: String, reflect: !0 })
|
|
308
|
-
], c.prototype, "icon", 2);
|
|
309
|
-
l([
|
|
310
|
-
h({ type: String, reflect: !0 })
|
|
311
|
-
], c.prototype, "controls", 2);
|
|
312
|
-
l([
|
|
313
|
-
h({ type: String, reflect: !0 })
|
|
314
|
-
], c.prototype, "tag", 2);
|
|
315
|
-
l([
|
|
316
|
-
h({ type: String, reflect: !0, attribute: "tag-skin" })
|
|
317
|
-
], c.prototype, "tagSkin", 2);
|
|
318
|
-
l([
|
|
319
|
-
h({ type: Number, reflect: !0 })
|
|
320
|
-
], c.prototype, "index", 2);
|
|
321
|
-
l([
|
|
322
|
-
O({ context: P, subscribe: !0 }),
|
|
323
|
-
h({ attribute: !1 })
|
|
324
|
-
], c.prototype, "context", 2);
|
|
325
|
-
c = l([
|
|
326
|
-
y("pkt-tab-item")
|
|
327
|
-
], c);
|
|
328
|
-
const B = c;
|
|
329
|
-
export {
|
|
330
|
-
B as P,
|
|
331
|
-
M as a
|
|
332
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";const d=require("./element-with-slot-ZX-up7jO.cjs"),a=require("./element-gR_VtSiD.cjs"),x=require("./state-Dg-53wQ8.cjs"),f=require("./ref-CL-Xk9Xm.cjs"),u=require("./if-defined-BOW3ODSj.cjs");/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2021 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/let m=class extends Event{constructor(t,e,i,s){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=i,this.subscribe=s??!1}};/**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright 2021 Google LLC
|
|
8
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*//**
|
|
10
|
-
* @license
|
|
11
|
-
* Copyright 2021 Google LLC
|
|
12
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/let w=class{constructor(t,e,i,s){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(r,o)=>{this.unsubscribe&&(this.unsubscribe!==o&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=r,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(r,o)),this.unsubscribe=o},this.host=t,e.context!==void 0){const r=e;this.context=r.context,this.callback=r.callback,this.subscribe=r.subscribe??!1}else this.context=e,this.callback=i,this.subscribe=s??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new m(this.context,this.host,this.t,this.subscribe))}};/**
|
|
14
|
-
* @license
|
|
15
|
-
* Copyright 2021 Google LLC
|
|
16
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
-
*/class C{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){const i=e||!Object.is(t,this.o);this.o=t,i&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(const[e,{disposer:i}]of this.subscriptions)e(this.o,i)},t!==void 0&&(this.value=t)}addCallback(t,e,i){if(!i)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});const{disposer:s}=this.subscriptions.get(t);t(this.value,s)}clearCallbacks(){this.subscriptions.clear()}}/**
|
|
18
|
-
* @license
|
|
19
|
-
* Copyright 2021 Google LLC
|
|
20
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
-
*/let $=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}};class g extends C{constructor(t,e,i){var s,r;super(e.context!==void 0?e.initialValue:i),this.onContextRequest=o=>{if(o.context!==this.context)return;const c=o.contextTarget??o.composedPath()[0];c!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,c,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;const c=new Set;for(const[v,{consumerHost:k}]of this.subscriptions)c.has(v)||(c.add(v),k.dispatchEvent(new m(this.context,k,v,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(r=(s=this.host).addController)==null||r.call(s,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new $(this.context,this.host))}}/**
|
|
22
|
-
* @license
|
|
23
|
-
* Copyright 2017 Google LLC
|
|
24
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
-
*/function P({context:n}){return(t,e)=>{const i=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(s){return i.get(this).setValue(s),t.set.call(this,s)},init(s){return i.set(this,new g(this,{context:n,initialValue:s})),s}};{t.constructor.addInitializer((o=>{i.set(o,new g(o,{context:n}))}));const s=Object.getOwnPropertyDescriptor(t,e);let r;if(s===void 0){const o=new WeakMap;r={get(){return o.get(this)},set(c){i.get(this).setValue(c),o.set(this,c)},configurable:!0,enumerable:!0}}else{const o=s.set;r={...s,set(c){i.get(this).setValue(c),o==null||o.call(this,c)}}}return void Object.defineProperty(t,e,r)}}}/**
|
|
26
|
-
* @license
|
|
27
|
-
* Copyright 2022 Google LLC
|
|
28
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
29
|
-
*/function _({context:n,subscribe:t}){return(e,i)=>{typeof i=="object"?i.addInitializer((function(){new w(this,{context:n,callback:s=>{e.set.call(this,s)},subscribe:t})})):e.constructor.addInitializer((s=>{new w(s,{context:n,callback:r=>{s[i]=r},subscribe:t})}))}}const y=Symbol("pkt-tabs-context");var N=Object.defineProperty,R=Object.getOwnPropertyDescriptor,p=(n,t,e,i)=>{for(var s=i>1?void 0:i?R(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&N(t,e,s),s};let b=class extends d.PktElementWithSlot{constructor(){super(...arguments),this.arrowNav=!0,this.disableArrowNav=!1,this.tabRefs=[],this.tabCount=0,this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)}}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}updated(t){(t.has("arrowNav")||t.has("disableArrowNav"))&&(this.context={...this.context,useArrowNav:this.useArrowNav})}registerTab(t,e){this.tabRefs[e]=t,this.tabCount=Math.max(this.tabCount,e+1)}handleClick(t){this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:t},bubbles:!0,composed:!0}))}handleKeyUp(t,e){var i,s;this.useArrowNav&&(t.code==="ArrowLeft"&&e!==0&&((i=this.tabRefs[e-1])==null||i.focus()),t.code==="ArrowRight"&&e<this.tabCount-1&&((s=this.tabRefs[e+1])==null||s.focus()),(t.code==="ArrowDown"||t.code==="Space")&&this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:e},bubbles:!0,composed:!0})))}render(){const t=this.useArrowNav?"tablist":"navigation";return a.b`
|
|
30
|
-
<div class="pkt-tabs">
|
|
31
|
-
<div class="pkt-tabs__list" role=${t}>${d.slotContent(this)}</div>
|
|
32
|
-
</div>
|
|
33
|
-
`}};p([a.n({type:Boolean,reflect:!0,attribute:"arrow-nav"})],b.prototype,"arrowNav",2);p([a.n({type:Boolean,reflect:!0,attribute:"disable-arrow-nav"})],b.prototype,"disableArrowNav",2);p([x.r()],b.prototype,"tabRefs",2);p([x.r()],b.prototype,"tabCount",2);p([P({context:y}),x.r()],b.prototype,"context",2);b=p([a.t("pkt-tabs")],b);const A=b;var S=Object.defineProperty,T=Object.getOwnPropertyDescriptor,l=(n,t,e,i)=>{for(var s=i>1?void 0:i?T(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&S(t,e,s),s};let h=class extends d.PktElementWithSlot{constructor(){super(),this.active=!1,this.href="",this.icon="",this.controls="",this.tag="",this.tagSkin="blue",this.index=0,this.elementRef=f.e()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index)})}handleClick(){this.context&&this.context.handleClick(this.index)}handleKeyUp(n){this.context&&this.context.handleKeyUp(n,this.index)}render(){var o;const n=((o=this.context)==null?void 0:o.useArrowNav)??!0,t=this.active?"active":"",e=n?"tab":void 0,i=n?this.active:void 0,s=this.active||!n?void 0:-1,r=a.b`
|
|
34
|
-
${this.icon?a.b`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>`:""}
|
|
35
|
-
<span>${d.slotContent(this)}</span>
|
|
36
|
-
${this.tag?a.b`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:""}
|
|
37
|
-
`;return this.href?a.b`
|
|
38
|
-
<a
|
|
39
|
-
${f.n(this.elementRef)}
|
|
40
|
-
href=${this.href}
|
|
41
|
-
class="pkt-tabs__link ${t}"
|
|
42
|
-
role=${u.o(e)}
|
|
43
|
-
aria-selected=${u.o(i)}
|
|
44
|
-
aria-controls=${u.o(this.controls||void 0)}
|
|
45
|
-
tabindex=${u.o(s)}
|
|
46
|
-
@click=${this.handleClick}
|
|
47
|
-
@keyup=${this.handleKeyUp}
|
|
48
|
-
>
|
|
49
|
-
${r}
|
|
50
|
-
</a>
|
|
51
|
-
`:a.b`
|
|
52
|
-
<button
|
|
53
|
-
${f.n(this.elementRef)}
|
|
54
|
-
type="button"
|
|
55
|
-
class="pkt-tabs__button pkt-link-button ${t}"
|
|
56
|
-
role=${u.o(e)}
|
|
57
|
-
aria-selected=${u.o(i)}
|
|
58
|
-
aria-controls=${u.o(this.controls||void 0)}
|
|
59
|
-
tabindex=${u.o(s)}
|
|
60
|
-
@click=${this.handleClick}
|
|
61
|
-
@keyup=${this.handleKeyUp}
|
|
62
|
-
>
|
|
63
|
-
${r}
|
|
64
|
-
</button>
|
|
65
|
-
`}};l([a.n({type:Boolean,reflect:!0})],h.prototype,"active",2);l([a.n({type:String,reflect:!0})],h.prototype,"href",2);l([a.n({type:String,reflect:!0})],h.prototype,"icon",2);l([a.n({type:String,reflect:!0})],h.prototype,"controls",2);l([a.n({type:String,reflect:!0})],h.prototype,"tag",2);l([a.n({type:String,reflect:!0,attribute:"tag-skin"})],h.prototype,"tagSkin",2);l([a.n({type:Number,reflect:!0})],h.prototype,"index",2);l([_({context:y,subscribe:!0}),a.n({attribute:!1})],h.prototype,"context",2);h=l([a.t("pkt-tab-item")],h);const q=h;exports.PktTabItem_default=q;exports.PktTabs=A;
|
package/dist/tag-X6xdjR0N.cjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";const h=require("./class-map-CsENJXf1.cjs"),t=require("./element-gR_VtSiD.cjs"),k=require("./state-Dg-53wQ8.cjs"),c=require("./element-with-slot-ZX-up7jO.cjs");require("./icon-Bqj9oBbl.cjs");const u=require("./if-defined-BOW3ODSj.cjs"),g={size:{default:"medium"},skin:{default:"blue"},closeTag:{default:!1},type:{default:"button"}},o={props:g};var d=Object.defineProperty,b=Object.getOwnPropertyDescriptor,s=(r,e,a,n)=>{for(var i=n>1?void 0:n?b(e,a):e,p=r.length-1,l;p>=0;p--)(l=r[p])&&(i=(n?l(e,a,i):l(i))||i);return n&&i&&d(e,a,i),i};exports.PktTag=class extends c.PktElementWithSlot{constructor(){super(),this.closeTag=o.props.closeTag.default,this.size=o.props.size.default,this.skin=o.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=o.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){var a,n;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const i=(n=(a=this.querySelector("button span, .pkt-tag > span"))==null?void 0:a.textContent)==null?void 0:n.trim();i&&(this._ariaDescription=`Klikk for å fjerne ${i}`)}}render(){const e={"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?t.b`
|
|
2
|
-
<button
|
|
3
|
-
class=${h.e(a)}
|
|
4
|
-
type=${this.type}
|
|
5
|
-
tabindex=${u.o(this.buttonTabindex)}
|
|
6
|
-
@click=${this.close}
|
|
7
|
-
aria-label=${u.o(this.ariaLabel||void 0)}
|
|
8
|
-
aria-description=${u.o(this._ariaDescription||void 0)}
|
|
9
|
-
>
|
|
10
|
-
${this.iconName&&t.b`<pkt-icon
|
|
11
|
-
class="pkt-tag__icon"
|
|
12
|
-
name=${this.iconName}
|
|
13
|
-
aria-hidden="true"
|
|
14
|
-
></pkt-icon>`}
|
|
15
|
-
<span>${c.slotContent(this)}</span>
|
|
16
|
-
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
17
|
-
</button>
|
|
18
|
-
`:t.b`
|
|
19
|
-
<span class=${h.e(e)}>
|
|
20
|
-
${this.iconName&&t.b`<pkt-icon
|
|
21
|
-
class="pkt-tag__icon"
|
|
22
|
-
name=${this.iconName}
|
|
23
|
-
aria-hidden="true"
|
|
24
|
-
></pkt-icon>`}
|
|
25
|
-
<span>${c.slotContent(this)}</span>
|
|
26
|
-
</span>
|
|
27
|
-
`}};s([t.n({type:Boolean,reflect:!0})],exports.PktTag.prototype,"closeTag",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"size",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"skin",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"textStyle",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"iconName",2);s([t.n({type:String})],exports.PktTag.prototype,"type",2);s([t.n({type:String})],exports.PktTag.prototype,"ariaLabel",2);s([t.n({type:Number,attribute:"button-tabindex"})],exports.PktTag.prototype,"buttonTabindex",2);s([k.r()],exports.PktTag.prototype,"_isClosed",2);s([k.r()],exports.PktTag.prototype,"_ariaDescription",2);exports.PktTag=s([t.t("pkt-tag")],exports.PktTag);
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("./element-gR_VtSiD.cjs"),h=require("./if-defined-BOW3ODSj.cjs"),c=require("./state-Dg-53wQ8.cjs"),p=require("./ref-CL-Xk9Xm.cjs"),$=require("./class-map-CsENJXf1.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-BP2WOx60.cjs"),g=require("./input-element-DdVhUvva.cjs"),x=require("./element-with-slot-ZX-up7jO.cjs");require("./input-wrapper-B0MkQ0IZ.cjs");require("./icon-Bqj9oBbl.cjs");/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const T=a.e(class extends a.i{constructor(r){if(super(r),r.type!==a.t.PROPERTY&&r.type!==a.t.ATTRIBUTE&&r.type!==a.t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!d.r(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(r,[e]){if(e===s.E||e===s.A)return e;const i=r.element,t=r.name;if(r.type===a.t.PROPERTY){if(e===i[t])return s.E}else if(r.type===a.t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(t))return s.E}else if(r.type===a.t.ATTRIBUTE&&i.getAttribute(t)===e+"")return s.E;return d.p(r),e}});var v=Object.defineProperty,f=Object.getOwnPropertyDescriptor,o=(r,e,i,t)=>{for(var n=t>1?void 0:t?f(e,i):e,u=r.length-1,l;u>=0;u--)(l=r[u])&&(n=(t?l(e,i,n):l(n))||n);return t&&n&&v(e,i,n),n};exports.PktTextarea=class extends g.PktInputElement{constructor(){super(...arguments),this.inputRef=p.e(),this.value="",this.autocomplete="off",this.rows=null,this.counterCurrent=0}attributeChangedCallback(e,i,t){e==="value"&&this.value!==i&&(this.counterCurrent=t?t.length:0,this.valueChanged(t,i)),super.attributeChangedCallback(e,i,t)}updated(e){var i;super.updated(e),e.has("value")&&(this.counterCurrent=((i=this.value)==null?void 0:i.length)||0,this.valueChanged(this.value,e.get("value"))),e.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const e=$.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),i=this.ariaLabelledby||`${this.id}-input-label`;return s.b`<pkt-input-wrapper
|
|
6
|
-
label=${this.label}
|
|
7
|
-
?counter=${this.counter}
|
|
8
|
-
?disabled=${this.disabled}
|
|
9
|
-
?hasError=${this.hasError}
|
|
10
|
-
?inline=${this.inline}
|
|
11
|
-
?optionalTag=${this.optionalTag}
|
|
12
|
-
?required=${this.required}
|
|
13
|
-
?requiredTag=${this.requiredTag}
|
|
14
|
-
useWrapper=${this.useWrapper}
|
|
15
|
-
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
16
|
-
.counterCurrent=${this.counterCurrent}
|
|
17
|
-
.counterMaxLength=${this.counterMaxLength}
|
|
18
|
-
.errorMessage=${this.errorMessage}
|
|
19
|
-
.forId="${this.id+"-input"}"
|
|
20
|
-
.helptext=${this.helptext}
|
|
21
|
-
.helptextDropdown=${this.helptextDropdown}
|
|
22
|
-
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
23
|
-
.optionalText=${this.optionalText}
|
|
24
|
-
.requiredText=${this.requiredText}
|
|
25
|
-
.tagText=${this.tagText}
|
|
26
|
-
class="pkt-textarea"
|
|
27
|
-
>
|
|
28
|
-
<div class="pkt-contents" slot="helptext">${x.slotContent(this,"helptext")}</div>
|
|
29
|
-
<textarea
|
|
30
|
-
${p.n(this.inputRef)}
|
|
31
|
-
class=${e}
|
|
32
|
-
id=${this.id+"-input"}
|
|
33
|
-
name=${(this.name||this.id)+"-input"}
|
|
34
|
-
placeholder=${h.o(this.placeholder)}
|
|
35
|
-
.value=${T(this.value)}
|
|
36
|
-
minlength=${h.o(this.minlength)}
|
|
37
|
-
maxlength=${h.o(this.maxlength)}
|
|
38
|
-
?readonly=${this.readonly}
|
|
39
|
-
autocomplete=${this.autocomplete}
|
|
40
|
-
aria-labelledby=${i}
|
|
41
|
-
aria-invalid=${this.hasError}
|
|
42
|
-
aria-errormessage=${`${this.id}-error`}
|
|
43
|
-
rows=${this.rows}
|
|
44
|
-
?disabled=${this.disabled}
|
|
45
|
-
@input=${t=>{this.value=t.target.value,this.onInput(),t.stopImmediatePropagation()}}
|
|
46
|
-
@change=${t=>{t.stopImmediatePropagation()}}
|
|
47
|
-
@focus=${t=>{this.onFocus(),t.stopImmediatePropagation()}}
|
|
48
|
-
@blur=${t=>{this.value=t.target.value,this.onBlur(),t.stopImmediatePropagation()}}
|
|
49
|
-
></textarea>
|
|
50
|
-
</pkt-input-wrapper>`}};o([s.n({type:String,reflect:!0})],exports.PktTextarea.prototype,"value",2);o([s.n({type:String})],exports.PktTextarea.prototype,"autocomplete",2);o([s.n({type:Number})],exports.PktTextarea.prototype,"rows",2);o([c.r()],exports.PktTextarea.prototype,"counterCurrent",2);exports.PktTextarea=o([s.t("pkt-textarea")],exports.PktTextarea);
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("./element-gR_VtSiD.cjs"),p=require("./if-defined-BOW3ODSj.cjs"),l=require("./state-Dg-53wQ8.cjs"),h=require("./ref-CL-Xk9Xm.cjs"),c=require("./class-map-CsENJXf1.cjs"),d=require("./input-element-DdVhUvva.cjs"),$=require("./element-with-slot-ZX-up7jO.cjs");require("./input-wrapper-B0MkQ0IZ.cjs");require("./icon-Bqj9oBbl.cjs");var x=Object.defineProperty,g=Object.getOwnPropertyDescriptor,r=(u,i,s,n)=>{for(var e=n>1?void 0:n?g(i,s):i,o=u.length-1,a;o>=0;o--)(a=u[o])&&(e=(n?a(i,s,e):a(e))||e);return n&&e&&x(i,s,e),e};exports.PktTextinput=class extends d.PktInputElement{constructor(){super(...arguments),this.inputRef=h.e(),this.value="",this.type="text",this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0}attributeChangedCallback(i,s,n){i==="value"&&this.value!==s&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,s)),super.attributeChangedCallback(i,s,n)}updated(i){var s;super.updated(i),i.has("value")&&(this.counterCurrent=((s=this.value)==null?void 0:s.length)||0,this.valueChanged(this.value,i.get("value"))),i.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const i=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,s=c.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),n=this.ariaLabelledby||`${this.id}-input-label`;return t.b`
|
|
2
|
-
<pkt-input-wrapper
|
|
3
|
-
label="${this.label}"
|
|
4
|
-
?counter=${this.counter}
|
|
5
|
-
?disabled=${this.disabled}
|
|
6
|
-
?hasError=${this.hasError}
|
|
7
|
-
?hasFieldset=${this.hasFieldset}
|
|
8
|
-
?inline=${this.inline}
|
|
9
|
-
?optionalTag=${this.optionalTag}
|
|
10
|
-
?required=${this.required}
|
|
11
|
-
?requiredTag=${this.requiredTag}
|
|
12
|
-
useWrapper=${this.useWrapper}
|
|
13
|
-
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
14
|
-
.counterCurrent=${this.counterCurrent}
|
|
15
|
-
.counterMaxLength=${this.counterMaxLength}
|
|
16
|
-
.errorMessage=${this.errorMessage}
|
|
17
|
-
.forId="${this.id+"-input"}"
|
|
18
|
-
.helptext=${this.helptext}
|
|
19
|
-
.helptextDropdown=${this.helptextDropdown}
|
|
20
|
-
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
21
|
-
.optionalText=${this.optionalText}
|
|
22
|
-
.requiredText=${this.requiredText}
|
|
23
|
-
.tagText=${this.tagText}
|
|
24
|
-
class="pkt-textinput"
|
|
25
|
-
>
|
|
26
|
-
<div class="pkt-contents" slot="helptext">${$.slotContent(this,"helptext")}</div>
|
|
27
|
-
<div class="pkt-input__container">
|
|
28
|
-
${this.prefix?t.b`<div class="pkt-input-prefix">${this.prefix}</div>`:t.A}
|
|
29
|
-
<input
|
|
30
|
-
${h.n(this.inputRef)}
|
|
31
|
-
class=${s}
|
|
32
|
-
type=${this.type}
|
|
33
|
-
name=${(this.name||this.id)+"-input"}
|
|
34
|
-
id=${this.id+"-input"}
|
|
35
|
-
placeholder=${p.o(this.placeholder)}
|
|
36
|
-
aria-labelledby=${n}
|
|
37
|
-
autocomplete=${this.autocomplete||"off"}
|
|
38
|
-
minlength=${p.o(this.minlength||void 0)}
|
|
39
|
-
maxlength=${p.o(this.maxlength||void 0)}
|
|
40
|
-
min=${p.o(this.min||void 0)}
|
|
41
|
-
max=${p.o(this.max||void 0)}
|
|
42
|
-
step=${p.o(this.step||void 0)}
|
|
43
|
-
?readonly=${this.readonly}
|
|
44
|
-
size=${this.size||t.A}
|
|
45
|
-
.value=${this.value}
|
|
46
|
-
?disabled=${this.disabled}
|
|
47
|
-
aria-invalid=${this.hasError}
|
|
48
|
-
aria-errormessage=${`${this.id}-error`}
|
|
49
|
-
@input=${e=>{this.value=e.target.value,this.onInput(),e.stopImmediatePropagation()}}
|
|
50
|
-
@change=${e=>{e.stopImmediatePropagation()}}
|
|
51
|
-
@focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
|
|
52
|
-
@blur=${e=>{this.value=e.target.value,this.onBlur(),e.stopImmediatePropagation()}}
|
|
53
|
-
@keydown=${e=>{var o;if(e.key==="Enter"){const a=this.internals.form;a?a.requestSubmit():(o=this.inputRef.value)==null||o.blur()}}}
|
|
54
|
-
/>
|
|
55
|
-
${this.suffix?t.b`<div class="pkt-input-suffix">
|
|
56
|
-
${this.suffix}
|
|
57
|
-
${this.iconNameRight?t.b`<pkt-icon
|
|
58
|
-
class="pkt-input-suffix-icon"
|
|
59
|
-
name=${this.iconNameRight}
|
|
60
|
-
></pkt-icon>`:t.A}
|
|
61
|
-
${i?t.b`<pkt-icon
|
|
62
|
-
class="pkt-input-suffix-icon"
|
|
63
|
-
name="magnifying-glass-big"
|
|
64
|
-
></pkt-icon>`:t.A}
|
|
65
|
-
</div>`:t.A}
|
|
66
|
-
${!this.suffix&&this.iconNameRight?t.b`<pkt-icon class="pkt-input-icon" name=${this.iconNameRight}></pkt-icon>`:t.A}
|
|
67
|
-
${!this.suffix&&i?t.b`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>`:t.A}
|
|
68
|
-
</div>
|
|
69
|
-
</pkt-input-wrapper>
|
|
70
|
-
`}};r([t.n({type:String,reflect:!0})],exports.PktTextinput.prototype,"value",2);r([t.n({type:String})],exports.PktTextinput.prototype,"type",2);r([t.n({type:Number})],exports.PktTextinput.prototype,"size",2);r([t.n({type:String})],exports.PktTextinput.prototype,"autocomplete",2);r([t.n({type:String})],exports.PktTextinput.prototype,"iconNameRight",2);r([t.n({type:String})],exports.PktTextinput.prototype,"prefix",2);r([t.n({type:String})],exports.PktTextinput.prototype,"suffix",2);r([t.n({type:Boolean})],exports.PktTextinput.prototype,"omitSearchIcon",2);r([l.r()],exports.PktTextinput.prototype,"counterCurrent",2);exports.PktTextinput=r([t.t("pkt-textinput")],exports.PktTextinput);
|