@oslokommune/punkt-elements 16.0.3 → 16.1.0
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-CHXGzgLv.js → accordionitem-Cj74XruR.js} +31 -31
- package/dist/accordionitem-D7sWqDM_.cjs +34 -0
- package/dist/alert-C95U_RZ0.cjs +33 -0
- package/dist/{alert-BHSd2Vpj.js → alert-ca_hFi-u.js} +19 -20
- package/dist/async-directive-B158h3ba.cjs +5 -0
- package/dist/async-directive-CKx6pubI.js +65 -0
- package/dist/{button-CHUuxLQV.js → button-BRovt5nm.js} +10 -11
- package/dist/button-BXN_JPaH.cjs +27 -0
- package/dist/{card-Db9QSEqh.cjs → card-DfHo45CG.cjs} +11 -13
- package/dist/{card-CmfUyl_s.js → card-DvgCTN4B.js} +47 -51
- package/dist/{checkbox-D6nltMuc.js → checkbox-CbIUMIYt.js} +2 -2
- package/dist/{checkbox-Cpyay9_l.cjs → checkbox-mmn3v9ry.cjs} +1 -1
- package/dist/{combobox-TKTemUxN.js → combobox-CwW0md6G.js} +31 -31
- package/dist/combobox-TKL44xnV.cjs +135 -0
- package/dist/{consent-BQLkfN3d.cjs → consent-CIhFwuFO.cjs} +1 -1
- package/dist/{consent-knPF4PS_.js → consent-CgS1L1xF.js} +1 -1
- package/dist/{datepicker-CPNcXd-o.cjs → datepicker-oN9L0Wnm.cjs} +14 -14
- package/dist/{datepicker-MuQYeXhL.js → datepicker-qRWWzmbo.js} +51 -51
- package/dist/element-with-slot-1djk8KXi.js +240 -0
- package/dist/element-with-slot-yT8k1Z37.cjs +1 -0
- package/dist/helptext-B366oeR9.cjs +24 -0
- package/dist/{helptext-TFpeGJ1P.js → helptext-DepcDYFV.js} +32 -39
- package/dist/index.d.ts +39 -90
- package/dist/input-element-Xe9FTi2a.cjs +1 -0
- package/dist/{input-element-BGNbdzy2.js → input-element-n5U38pZ1.js} +8 -7
- package/dist/{input-wrapper-CaUY90qz.js → input-wrapper-B__6jW4U.js} +25 -28
- package/dist/{input-wrapper-JU4D2TGu.cjs → input-wrapper-BdFdJU-k.cjs} +7 -9
- package/dist/link-DLjXMpvi.cjs +7 -0
- package/dist/link-oGYvBLYL.js +53 -0
- package/dist/linkcard-BhVIc18n.js +54 -0
- package/dist/linkcard-C20WC6Nw.cjs +13 -0
- package/dist/{loader-BF9K1VCZ.js → loader-BHt9i5Xp.js} +12 -13
- package/dist/{loader-C1LI8Q4z.cjs → loader-DxAGCcNF.cjs} +2 -2
- package/dist/messagebox-B8LW0PSQ.cjs +13 -0
- package/dist/messagebox-DkspcMQg.js +69 -0
- package/dist/modal-Bfk_ncLQ.cjs +36 -0
- package/dist/{modal-CGHWsjk8.js → modal-p1rvuP8e.js} +26 -27
- 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 +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +2 -2
- package/dist/pkt-header.cjs +16 -17
- package/dist/pkt-header.js +62 -69
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +22 -22
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-options-controller-DIeKSpWv.cjs +1 -0
- package/dist/{pkt-options-controller-Z-bPox7n.js → pkt-options-controller-W4ITGQy9.js} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -2
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- 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 +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/{progressbar-Bxh335uT.cjs → progressbar-CC9Qr82_.cjs} +1 -1
- package/dist/{progressbar-GSA4Md1u.js → progressbar-CcX-xiPI.js} +1 -1
- package/dist/{radiobutton-CNHCpKn0.cjs → radiobutton-BUDQYAH-.cjs} +1 -1
- package/dist/{radiobutton-DgC27mb0.js → radiobutton-RW3h0tJj.js} +2 -2
- package/dist/ref-DBGHvw2G.js +42 -0
- package/dist/ref-DahIePMT.cjs +5 -0
- package/dist/select-PuEeK4jQ.cjs +49 -0
- package/dist/{select-7VuYtPZv.js → select-iXKeM3yz.js} +37 -37
- package/dist/{tabitem-DQRzgAT4.js → tabitem-DZSzwag2.js} +30 -30
- package/dist/{tabitem-BKv4eN0a.cjs → tabitem-Jenus4Qd.cjs} +13 -13
- package/dist/{tag-DZPqFiem.js → tag-CIWBLpjv.js} +17 -18
- package/dist/tag-DeE1OpmF.cjs +27 -0
- package/dist/{textarea-VpCEjVFx.js → textarea-DR9lVDN-.js} +13 -13
- package/dist/{textarea-CO7Ikug5.cjs → textarea-DtiYQWjy.cjs} +7 -7
- package/dist/{textinput-C2AZ9ss2.js → textinput-0Bttvt9V.js} +22 -22
- package/dist/{textinput-DRFZU3dA.cjs → textinput-cKrjvbJW.cjs} +9 -9
- package/package.json +3 -3
- package/src/components/accordion/accordionitem.ts +4 -6
- package/src/components/alert/alert.ts +4 -8
- package/src/components/button/button.ts +4 -12
- package/src/components/card/card.ts +4 -19
- package/src/components/combobox/combobox-base.ts +0 -5
- package/src/components/combobox/combobox-utils.ts +1 -1
- package/src/components/combobox/combobox.ts +2 -1
- package/src/components/datepicker/datepicker.ts +2 -8
- package/src/components/header/header-service.ts +5 -19
- package/src/components/header/header.ts +4 -13
- package/src/components/helptext/helptext.test.ts +2 -12
- package/src/components/helptext/helptext.ts +5 -19
- package/src/components/input-wrapper/input-wrapper.test.ts +3 -3
- package/src/components/input-wrapper/input-wrapper.ts +5 -16
- package/src/components/link/link.ts +4 -12
- package/src/components/linkcard/linkcard.test.ts +2 -2
- package/src/components/linkcard/linkcard.ts +4 -13
- package/src/components/loader/loader.ts +4 -12
- package/src/components/messagebox/messagebox.ts +4 -9
- package/src/components/modal/modal.ts +4 -7
- package/src/components/select/select.ts +2 -5
- package/src/components/tabs/tabitem.ts +4 -7
- package/src/components/tabs/tabs.ts +4 -13
- package/src/components/tag/tag.ts +6 -12
- package/src/components/textarea/textarea.ts +2 -8
- package/src/components/textinput/textinput.ts +2 -8
- package/dist/accordionitem-To95GT6b.cjs +0 -34
- package/dist/alert-BDXWFRcf.cjs +0 -33
- package/dist/button-VWxZW89G.cjs +0 -27
- package/dist/combobox-DX2BLzIm.cjs +0 -135
- package/dist/helptext-BjW1WdOn.cjs +0 -24
- package/dist/input-element-CSDVA3Y6.cjs +0 -1
- package/dist/link-Bscfb6s9.js +0 -54
- package/dist/link-CDuv1jxx.cjs +0 -7
- package/dist/linkcard-3WUL0CpY.cjs +0 -13
- package/dist/linkcard-wNgRxJ-S.js +0 -55
- package/dist/messagebox-Dmot5szX.cjs +0 -13
- package/dist/messagebox-LBEzcr6B.js +0 -70
- package/dist/modal-S9MOKOaz.cjs +0 -37
- package/dist/pkt-options-controller-BogGk-6J.cjs +0 -1
- package/dist/pkt-slot-controller-D4nKlom5.cjs +0 -1
- package/dist/pkt-slot-controller-D7CrjM52.js +0 -95
- package/dist/ref-CxLwrCxt.cjs +0 -9
- package/dist/ref-Dma3n3i8.js +0 -102
- package/dist/select-PWPy5gTB.cjs +0 -49
- package/dist/tag-DmbgBCKu.cjs +0 -27
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { E as l, P as C } from "./element-CV9utnHJ.js";
|
|
2
|
+
import { f as y } from "./async-directive-CKx6pubI.js";
|
|
3
|
+
import { e as O, t as D } from "./directive-oAbCiebi.js";
|
|
4
|
+
function T(s) {
|
|
5
|
+
return s.classList && (s.classList.contains("_dialog_overlay") || s.classList.contains("backdrop")) ? !0 : typeof s.hasAttribute == "function" && s.hasAttribute("data-skip");
|
|
6
|
+
}
|
|
7
|
+
function E(s) {
|
|
8
|
+
return s.nodeName === "OPTION" || s.nodeName === "DATA";
|
|
9
|
+
}
|
|
10
|
+
function b(s) {
|
|
11
|
+
var e;
|
|
12
|
+
return s.nodeType === Node.TEXT_NODE && ((e = s.nodeValue) == null ? void 0 : e.trim()) !== "";
|
|
13
|
+
}
|
|
14
|
+
const p = /* @__PURE__ */ new WeakMap();
|
|
15
|
+
function f(s) {
|
|
16
|
+
let e = p.get(s);
|
|
17
|
+
return e || (e = new m(s), p.set(s, e)), e;
|
|
18
|
+
}
|
|
19
|
+
const N = Symbol("default");
|
|
20
|
+
function g(s) {
|
|
21
|
+
return s === void 0 ? N : s;
|
|
22
|
+
}
|
|
23
|
+
function v(s, e) {
|
|
24
|
+
if (s.nodeType === Node.COMMENT_NODE) return !1;
|
|
25
|
+
if (s.nodeType === Node.TEXT_NODE)
|
|
26
|
+
return b(s) ? (u(e, N, s), !0) : !1;
|
|
27
|
+
if (s.nodeType === Node.ELEMENT_NODE) {
|
|
28
|
+
const t = s;
|
|
29
|
+
if (T(t) || E(t)) return !1;
|
|
30
|
+
if (t instanceof HTMLTemplateElement) {
|
|
31
|
+
const h = Array.from(t.content.childNodes), a = g(t.getAttribute("slot") ?? void 0);
|
|
32
|
+
for (const i of h)
|
|
33
|
+
u(e, a, i);
|
|
34
|
+
return !0;
|
|
35
|
+
}
|
|
36
|
+
const o = t.getAttribute("slot"), r = o !== null ? g(o) : N;
|
|
37
|
+
return u(e, r, s), !0;
|
|
38
|
+
}
|
|
39
|
+
return !1;
|
|
40
|
+
}
|
|
41
|
+
function u(s, e, t) {
|
|
42
|
+
let o = s.get(e);
|
|
43
|
+
o || (o = [], s.set(e, o)), o.push(t);
|
|
44
|
+
}
|
|
45
|
+
const c = class c {
|
|
46
|
+
constructor(e) {
|
|
47
|
+
this.observer = null, this.nodesBySlot = /* @__PURE__ */ new Map(), this.directives = /* @__PURE__ */ new Set(), this.observing = !1, this.trackedNodes = /* @__PURE__ */ new Set(), this.generation = 0, this.initialCollectionDone = !1, this.processingMutations = !1, this.placeholderToNode = /* @__PURE__ */ new Map(), this.nodeToPlaceholder = /* @__PURE__ */ new Map(), this.host = e;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Collect original children BEFORE Lit's first render.
|
|
51
|
+
* Must be called in connectedCallback or earlier.
|
|
52
|
+
* Safe to call multiple times — only the first call scans.
|
|
53
|
+
*/
|
|
54
|
+
collectNodes() {
|
|
55
|
+
if (this.initialCollectionDone) return;
|
|
56
|
+
this.initialCollectionDone = !0, this.generation++;
|
|
57
|
+
const e = Array.from(this.host.childNodes);
|
|
58
|
+
for (const t of e)
|
|
59
|
+
v(t, this.nodesBySlot) && this.trackedNodes.add(t);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Register a directive instance and start observing for dynamic changes.
|
|
63
|
+
*/
|
|
64
|
+
addDirective(e) {
|
|
65
|
+
this.directives.add(e), this.startObserving();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Unregister a directive instance. Stops observing if no directives remain.
|
|
69
|
+
*/
|
|
70
|
+
removeDirective(e) {
|
|
71
|
+
this.directives.delete(e), this.directives.size === 0 && this.stopObserving();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Returns nodes matching the given slot name.
|
|
75
|
+
*/
|
|
76
|
+
getNodes(e) {
|
|
77
|
+
return this.nodesBySlot.get(g(e)) ?? [];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Returns whether the given slot has any content.
|
|
81
|
+
*/
|
|
82
|
+
hasContent(e) {
|
|
83
|
+
return this.getNodes(e).length > 0;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Ensure a placeholder comment exists for a node that is about to be distributed.
|
|
87
|
+
* Called by the directive before Lit moves the node to the target position.
|
|
88
|
+
* The placeholder stays between Lit's ChildPart markers so that when the parent
|
|
89
|
+
* template conditionally removes the content, the MutationObserver can detect
|
|
90
|
+
* the placeholder removal and clean up the real node.
|
|
91
|
+
*/
|
|
92
|
+
ensurePlaceholder(e) {
|
|
93
|
+
if (this.nodeToPlaceholder.has(e) || e.parentNode !== this.host) return;
|
|
94
|
+
const t = document.createComment(c.PLACEHOLDER_PREFIX);
|
|
95
|
+
this.host.insertBefore(t, e), this.placeholderToNode.set(t, e), this.nodeToPlaceholder.set(e, t);
|
|
96
|
+
}
|
|
97
|
+
// --- Private ---
|
|
98
|
+
/**
|
|
99
|
+
* Start MutationObserver for dynamic child changes.
|
|
100
|
+
* Deferred via setTimeout to avoid catching Lit's first render mutations.
|
|
101
|
+
*/
|
|
102
|
+
startObserving() {
|
|
103
|
+
this.observing || (this.observing = !0, setTimeout(() => {
|
|
104
|
+
this.observing && (this.observer = new MutationObserver((e) => {
|
|
105
|
+
this.handleMutations(e);
|
|
106
|
+
}), this.observer.observe(this.host, { childList: !0 }));
|
|
107
|
+
}, 0));
|
|
108
|
+
}
|
|
109
|
+
stopObserving() {
|
|
110
|
+
var e;
|
|
111
|
+
this.observing && (this.observing = !1, (e = this.observer) == null || e.disconnect(), this.observer = null);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Handle MutationObserver mutations incrementally.
|
|
115
|
+
* Only processes nodes that are NOT already part of Lit's rendered template.
|
|
116
|
+
*
|
|
117
|
+
* Uses a guard flag to prevent recursive handling: when notifyDirectives()
|
|
118
|
+
* causes setValue() to move nodes (e.g., from host into a ChildPart container),
|
|
119
|
+
* that move triggers another mutation which must be ignored.
|
|
120
|
+
*/
|
|
121
|
+
handleMutations(e) {
|
|
122
|
+
var o, r, h;
|
|
123
|
+
if (this.processingMutations) return;
|
|
124
|
+
this.processingMutations = !0;
|
|
125
|
+
let t = !1;
|
|
126
|
+
for (const a of e)
|
|
127
|
+
if (a.target === this.host) {
|
|
128
|
+
for (const i of a.removedNodes) {
|
|
129
|
+
const n = this.placeholderToNode.get(i);
|
|
130
|
+
if (n) {
|
|
131
|
+
(o = n.parentNode) == null || o.removeChild(n), this.trackedNodes.delete(n), this.removeFromSlots(n), this.placeholderToNode.delete(i), this.nodeToPlaceholder.delete(n), t = !0;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (this.trackedNodes.has(i)) {
|
|
135
|
+
this.trackedNodes.delete(i), this.removeFromSlots(i);
|
|
136
|
+
const d = this.nodeToPlaceholder.get(i);
|
|
137
|
+
d && ((r = d.parentNode) == null || r.removeChild(d), this.placeholderToNode.delete(d), this.nodeToPlaceholder.delete(i)), t = !0;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
for (const i of a.addedNodes)
|
|
141
|
+
this.placeholderToNode.has(i) || !this.trackedNodes.has(i) && this.isUserContent(i) && v(i, this.nodesBySlot) && (this.trackedNodes.add(i), t = !0);
|
|
142
|
+
}
|
|
143
|
+
t && (this.generation++, this.notifyDirectives()), (h = this.observer) == null || h.takeRecords(), this.processingMutations = !1;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Determines if a node is user-provided content (not Lit's rendered template).
|
|
147
|
+
* Lit's rendered content includes comment markers and elements created by the template.
|
|
148
|
+
*/
|
|
149
|
+
isUserContent(e) {
|
|
150
|
+
if (e.nodeType === Node.COMMENT_NODE) return !1;
|
|
151
|
+
if (e.nodeType === Node.TEXT_NODE)
|
|
152
|
+
return b(e);
|
|
153
|
+
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
154
|
+
const t = e;
|
|
155
|
+
return !(T(t) || E(t));
|
|
156
|
+
}
|
|
157
|
+
return !1;
|
|
158
|
+
}
|
|
159
|
+
removeFromSlots(e) {
|
|
160
|
+
for (const [t, o] of this.nodesBySlot) {
|
|
161
|
+
const r = o.indexOf(e);
|
|
162
|
+
if (r !== -1) {
|
|
163
|
+
o.splice(r, 1), o.length === 0 && this.nodesBySlot.delete(t);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
notifyDirectives() {
|
|
169
|
+
for (const e of this.directives)
|
|
170
|
+
e.handleNodesChanged();
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
c.PLACEHOLDER_PREFIX = "pkt-slot";
|
|
174
|
+
let m = c;
|
|
175
|
+
class P extends y {
|
|
176
|
+
constructor(e) {
|
|
177
|
+
if (super(e), this.manager = null, this.lastGeneration = -1, e.type !== D.CHILD)
|
|
178
|
+
throw new Error("slotContent() can only be used in child expressions");
|
|
179
|
+
}
|
|
180
|
+
render(e, t) {
|
|
181
|
+
return l;
|
|
182
|
+
}
|
|
183
|
+
update(e, [t, o]) {
|
|
184
|
+
return this.slotName = o, this.manager || (this.manager = f(t), this.manager.collectNodes(), this.manager.addDirective(this)), this.ensurePlaceholders(), this.getNodesOrNoChange();
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Called by SlotManager when child mutations are detected.
|
|
188
|
+
* Uses setValue() to push an async update to Lit.
|
|
189
|
+
*/
|
|
190
|
+
handleNodesChanged() {
|
|
191
|
+
if (!this.isConnected || !this.manager) return;
|
|
192
|
+
this.ensurePlaceholders();
|
|
193
|
+
const e = this.getNodesOrNoChange();
|
|
194
|
+
e !== l && this.setValue(e);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Insert placeholders for nodes that are still direct children of the host.
|
|
198
|
+
* Must be called before Lit moves them to the target position.
|
|
199
|
+
*/
|
|
200
|
+
ensurePlaceholders() {
|
|
201
|
+
if (!this.manager) return;
|
|
202
|
+
const e = this.manager.getNodes(this.slotName);
|
|
203
|
+
for (const t of e)
|
|
204
|
+
this.manager.ensurePlaceholder(t);
|
|
205
|
+
}
|
|
206
|
+
disconnected() {
|
|
207
|
+
var e;
|
|
208
|
+
(e = this.manager) == null || e.removeDirective(this), this.manager = null, this.lastGeneration = -1;
|
|
209
|
+
}
|
|
210
|
+
reconnected() {
|
|
211
|
+
}
|
|
212
|
+
getNodesOrNoChange() {
|
|
213
|
+
if (!this.manager) return l;
|
|
214
|
+
const e = this.manager.generation;
|
|
215
|
+
return e === this.lastGeneration ? l : (this.lastGeneration = e, this.manager.getNodes(this.slotName));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
const L = O(P);
|
|
219
|
+
class A extends C {
|
|
220
|
+
/**
|
|
221
|
+
* Pre-collect children before Lit's first render clears them.
|
|
222
|
+
* This ensures slotContent() has access to the original children.
|
|
223
|
+
*/
|
|
224
|
+
connectedCallback() {
|
|
225
|
+
f(this).collectNodes(), super.connectedCallback();
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Checks if a slot has content distributed to it via the slotContent directive.
|
|
229
|
+
*
|
|
230
|
+
* @param slotName - Name of the slot. Omit for the default slot.
|
|
231
|
+
*/
|
|
232
|
+
hasSlotContent(e) {
|
|
233
|
+
return f(this).hasContent(e);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
export {
|
|
237
|
+
A as P,
|
|
238
|
+
E as i,
|
|
239
|
+
L as s
|
|
240
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const h=require("./element-CMTfByxQ.cjs"),y=require("./async-directive-B158h3ba.cjs"),E=require("./directive-C7oCP5Bh.cjs");function C(s){return s.classList&&(s.classList.contains("_dialog_overlay")||s.classList.contains("backdrop"))?!0:typeof s.hasAttribute=="function"&&s.hasAttribute("data-skip")}function p(s){return s.nodeName==="OPTION"||s.nodeName==="DATA"}function b(s){var e;return s.nodeType===Node.TEXT_NODE&&((e=s.nodeValue)==null?void 0:e.trim())!==""}const v=new WeakMap;function f(s){let e=v.get(s);return e||(e=new m(s),v.set(s,e)),e}const N=Symbol("default");function g(s){return s===void 0?N:s}function T(s,e){if(s.nodeType===Node.COMMENT_NODE)return!1;if(s.nodeType===Node.TEXT_NODE)return b(s)?(u(e,N,s),!0):!1;if(s.nodeType===Node.ELEMENT_NODE){const t=s;if(C(t)||p(t))return!1;if(t instanceof HTMLTemplateElement){const l=Array.from(t.content.childNodes),a=g(t.getAttribute("slot")??void 0);for(const i of l)u(e,a,i);return!0}const o=t.getAttribute("slot"),n=o!==null?g(o):N;return u(e,n,s),!0}return!1}function u(s,e,t){let o=s.get(e);o||(o=[],s.set(e,o)),o.push(t)}const c=class c{constructor(e){this.observer=null,this.nodesBySlot=new Map,this.directives=new Set,this.observing=!1,this.trackedNodes=new Set,this.generation=0,this.initialCollectionDone=!1,this.processingMutations=!1,this.placeholderToNode=new Map,this.nodeToPlaceholder=new Map,this.host=e}collectNodes(){if(this.initialCollectionDone)return;this.initialCollectionDone=!0,this.generation++;const e=Array.from(this.host.childNodes);for(const t of e)T(t,this.nodesBySlot)&&this.trackedNodes.add(t)}addDirective(e){this.directives.add(e),this.startObserving()}removeDirective(e){this.directives.delete(e),this.directives.size===0&&this.stopObserving()}getNodes(e){return this.nodesBySlot.get(g(e))??[]}hasContent(e){return this.getNodes(e).length>0}ensurePlaceholder(e){if(this.nodeToPlaceholder.has(e)||e.parentNode!==this.host)return;const t=document.createComment(c.PLACEHOLDER_PREFIX);this.host.insertBefore(t,e),this.placeholderToNode.set(t,e),this.nodeToPlaceholder.set(e,t)}startObserving(){this.observing||(this.observing=!0,setTimeout(()=>{this.observing&&(this.observer=new MutationObserver(e=>{this.handleMutations(e)}),this.observer.observe(this.host,{childList:!0}))},0))}stopObserving(){var e;this.observing&&(this.observing=!1,(e=this.observer)==null||e.disconnect(),this.observer=null)}handleMutations(e){var o,n,l;if(this.processingMutations)return;this.processingMutations=!0;let t=!1;for(const a of e)if(a.target===this.host){for(const i of a.removedNodes){const r=this.placeholderToNode.get(i);if(r){(o=r.parentNode)==null||o.removeChild(r),this.trackedNodes.delete(r),this.removeFromSlots(r),this.placeholderToNode.delete(i),this.nodeToPlaceholder.delete(r),t=!0;continue}if(this.trackedNodes.has(i)){this.trackedNodes.delete(i),this.removeFromSlots(i);const d=this.nodeToPlaceholder.get(i);d&&((n=d.parentNode)==null||n.removeChild(d),this.placeholderToNode.delete(d),this.nodeToPlaceholder.delete(i)),t=!0}}for(const i of a.addedNodes)this.placeholderToNode.has(i)||!this.trackedNodes.has(i)&&this.isUserContent(i)&&T(i,this.nodesBySlot)&&(this.trackedNodes.add(i),t=!0)}t&&(this.generation++,this.notifyDirectives()),(l=this.observer)==null||l.takeRecords(),this.processingMutations=!1}isUserContent(e){if(e.nodeType===Node.COMMENT_NODE)return!1;if(e.nodeType===Node.TEXT_NODE)return b(e);if(e.nodeType===Node.ELEMENT_NODE){const t=e;return!(C(t)||p(t))}return!1}removeFromSlots(e){for(const[t,o]of this.nodesBySlot){const n=o.indexOf(e);if(n!==-1){o.splice(n,1),o.length===0&&this.nodesBySlot.delete(t);return}}}notifyDirectives(){for(const e of this.directives)e.handleNodesChanged()}};c.PLACEHOLDER_PREFIX="pkt-slot";let m=c;class O extends y.f{constructor(e){if(super(e),this.manager=null,this.lastGeneration=-1,e.type!==E.t.CHILD)throw new Error("slotContent() can only be used in child expressions")}render(e,t){return h.E}update(e,[t,o]){return this.slotName=o,this.manager||(this.manager=f(t),this.manager.collectNodes(),this.manager.addDirective(this)),this.ensurePlaceholders(),this.getNodesOrNoChange()}handleNodesChanged(){if(!this.isConnected||!this.manager)return;this.ensurePlaceholders();const e=this.getNodesOrNoChange();e!==h.E&&this.setValue(e)}ensurePlaceholders(){if(!this.manager)return;const e=this.manager.getNodes(this.slotName);for(const t of e)this.manager.ensurePlaceholder(t)}disconnected(){var e;(e=this.manager)==null||e.removeDirective(this),this.manager=null,this.lastGeneration=-1}reconnected(){}getNodesOrNoChange(){if(!this.manager)return h.E;const e=this.manager.generation;return e===this.lastGeneration?h.E:(this.lastGeneration=e,this.manager.getNodes(this.slotName))}}const D=E.e(O);class P extends h.PktElement{connectedCallback(){f(this).collectNodes(),super.connectedCallback()}hasSlotContent(e){return f(this).hasContent(e)}}exports.PktElementWithSlot=P;exports.isOptionElement=p;exports.slotContent=D;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";const x=require("./element-with-slot-yT8k1Z37.cjs"),e=require("./element-CMTfByxQ.cjs"),h=require("./icon-Dj0oZZSa.cjs"),c=require("./class-map-Bokp1SoS.cjs"),u=require("./state-BNgpvY-A.cjs"),a=require("./utils-byXsEz1u.cjs"),d=require("./input-wrapper-EoSAbU-U.cjs");var k=Object.defineProperty,_=Object.getOwnPropertyDescriptor,r=(o,p,l,n)=>{for(var t=n>1?void 0:n?_(p,l):p,s=o.length-1,i;s>=0;s--)(i=o[s])&&(t=(n?i(p,l,t):i(t))||t);return n&&t&&k(p,l,t),t};exports.PktHelptext=class extends x.PktElementWithSlot{constructor(){super(...arguments),this.forId=a.uuidish(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=d.specs.props.helptextDropdownButton.default,this.isHelpTextOpen=!1}render(){const p=()=>{const s=!this.isHelpTextOpen;this.isHelpTextOpen=s,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:s}}))},l=c.e({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.hasSlotContent()}),n=()=>this.helptextDropdown?e.b`<div class="pkt-inputwrapper__helptext-expandable">
|
|
2
|
+
<button
|
|
3
|
+
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
4
|
+
type="button"
|
|
5
|
+
@click=${p}
|
|
6
|
+
>
|
|
7
|
+
<pkt-icon
|
|
8
|
+
class="pkt-btn__icon"
|
|
9
|
+
name="${this.isHelpTextOpen?"chevron-thin-up":"chevron-thin-down"}"
|
|
10
|
+
></pkt-icon>
|
|
11
|
+
<span class="pkt-btn__text">${h.o(this.helptextDropdownButton)}</span>
|
|
12
|
+
</button>
|
|
13
|
+
<div
|
|
14
|
+
class="${c.e({"pkt-inputwrapper__helptext":!0,"pkt-inputwrapper__helptext-expandable-open":this.isHelpTextOpen,"pkt-inputwrapper__helptext-expandable-closed":!this.isHelpTextOpen})}"
|
|
15
|
+
>
|
|
16
|
+
${h.o(this.helptextDropdown)}
|
|
17
|
+
</div>
|
|
18
|
+
</div>`:e.A,t=()=>e.b`<div class="${l}">
|
|
19
|
+
<div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
|
|
20
|
+
<div class="pkt-contents" name="helptext">${x.slotContent(this)}</div>
|
|
21
|
+
${this.helptext&&h.o(this.helptext)}
|
|
22
|
+
</div>
|
|
23
|
+
${n()}
|
|
24
|
+
</div>`;return e.b`${t()}`}};r([e.n({type:String,reflect:!0})],exports.PktHelptext.prototype,"forId",2);r([e.n({type:String})],exports.PktHelptext.prototype,"helptext",2);r([e.n({type:String})],exports.PktHelptext.prototype,"helptextDropdown",2);r([e.n({type:String})],exports.PktHelptext.prototype,"helptextDropdownButton",2);r([u.r()],exports.PktHelptext.prototype,"isHelpTextOpen",2);exports.PktHelptext=r([e.t("pkt-helptext")],exports.PktHelptext);
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import { P as
|
|
2
|
-
import {
|
|
1
|
+
import { P as u, s as c } from "./element-with-slot-1djk8KXi.js";
|
|
2
|
+
import { b as a, A as _, n as i, t as m } from "./element-CV9utnHJ.js";
|
|
3
3
|
import { o as x } from "./icon-D0IQAVwS.js";
|
|
4
4
|
import { e as d } from "./class-map-3ADKve8g.js";
|
|
5
|
-
import { r as
|
|
6
|
-
import { u as
|
|
7
|
-
import { s as
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return n && t && S(s, l, t), t;
|
|
5
|
+
import { r as w } from "./state-l4hGZdFJ.js";
|
|
6
|
+
import { u as v } from "./utils-DznhwRXm.js";
|
|
7
|
+
import { s as f } from "./input-wrapper-CDgenrYA.js";
|
|
8
|
+
var k = Object.defineProperty, b = Object.getOwnPropertyDescriptor, n = (s, p, r, o) => {
|
|
9
|
+
for (var t = o > 1 ? void 0 : o ? b(p, r) : p, l = s.length - 1, h; l >= 0; l--)
|
|
10
|
+
(h = s[l]) && (t = (o ? h(p, r, t) : h(t)) || t);
|
|
11
|
+
return o && t && k(p, r, t), t;
|
|
13
12
|
};
|
|
14
|
-
let e = class extends
|
|
13
|
+
let e = class extends u {
|
|
15
14
|
constructor() {
|
|
16
|
-
super(), this.
|
|
17
|
-
}
|
|
18
|
-
updateSlots(o) {
|
|
19
|
-
this.filledSlots = new Set(o);
|
|
15
|
+
super(...arguments), this.forId = v(), this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = f.props.helptextDropdownButton.default, this.isHelpTextOpen = !1;
|
|
20
16
|
}
|
|
21
17
|
render() {
|
|
22
|
-
const
|
|
18
|
+
const s = () => {
|
|
23
19
|
const t = !this.isHelpTextOpen;
|
|
24
20
|
this.isHelpTextOpen = t, this.dispatchEvent(
|
|
25
21
|
new CustomEvent("toggleHelpText", {
|
|
@@ -27,14 +23,14 @@ let e = class extends c {
|
|
|
27
23
|
detail: { isOpen: t }
|
|
28
24
|
})
|
|
29
25
|
);
|
|
30
|
-
},
|
|
26
|
+
}, p = d({
|
|
31
27
|
"pkt-inputwrapper__helptext-container": !0,
|
|
32
|
-
"pkt-inputwrapper__has-helptext": this.helptext || this.helptextDropdown || this.
|
|
33
|
-
}),
|
|
28
|
+
"pkt-inputwrapper__has-helptext": this.helptext || this.helptextDropdown || this.hasSlotContent()
|
|
29
|
+
}), r = () => this.helptextDropdown ? a`<div class="pkt-inputwrapper__helptext-expandable">
|
|
34
30
|
<button
|
|
35
31
|
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
36
32
|
type="button"
|
|
37
|
-
@click=${
|
|
33
|
+
@click=${s}
|
|
38
34
|
>
|
|
39
35
|
<pkt-icon
|
|
40
36
|
class="pkt-btn__icon"
|
|
@@ -51,36 +47,33 @@ let e = class extends c {
|
|
|
51
47
|
>
|
|
52
48
|
${x(this.helptextDropdown)}
|
|
53
49
|
</div>
|
|
54
|
-
</div>` :
|
|
55
|
-
return a`${a`<div class="${
|
|
50
|
+
</div>` : _;
|
|
51
|
+
return a`${a`<div class="${p}">
|
|
56
52
|
<div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
|
|
57
|
-
<div class="pkt-contents"
|
|
53
|
+
<div class="pkt-contents" name="helptext">${c(this)}</div>
|
|
58
54
|
${this.helptext && x(this.helptext)}
|
|
59
55
|
</div>
|
|
60
|
-
${
|
|
56
|
+
${r()}
|
|
61
57
|
</div>`}`;
|
|
62
58
|
}
|
|
63
59
|
};
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
n([
|
|
61
|
+
i({ type: String, reflect: !0 })
|
|
66
62
|
], e.prototype, "forId", 2);
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
n([
|
|
64
|
+
i({ type: String })
|
|
69
65
|
], e.prototype, "helptext", 2);
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
n([
|
|
67
|
+
i({ type: String })
|
|
72
68
|
], e.prototype, "helptextDropdown", 2);
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
n([
|
|
70
|
+
i({ type: String })
|
|
75
71
|
], e.prototype, "helptextDropdownButton", 2);
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
n([
|
|
73
|
+
w()
|
|
78
74
|
], e.prototype, "isHelpTextOpen", 2);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
], e.prototype, "filledSlots", 2);
|
|
82
|
-
e = p([
|
|
83
|
-
w("pkt-helptext")
|
|
75
|
+
e = n([
|
|
76
|
+
m("pkt-helptext")
|
|
84
77
|
], e);
|
|
85
78
|
export {
|
|
86
79
|
e as P
|