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