@trintel/zooy 1.14.1 → 1.15.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.
@@ -1,1508 +0,0 @@
1
- import { n as m, t as St } from "./component-library-registry-BXnJ4Oqa.js";
2
- import { n as i, r as Pt, t as W } from "./attributes-DLvrzXzz.js";
3
- import { isDefAndNotNull as yt, objToPaths as kt } from "badu";
4
- import * as M from "ramda";
5
- import { TABLE_SORT_DIRECTION as Ct } from "@carbon/web-components/lib/components/data-table/defs.js";
6
- var At = /* @__PURE__ */ m({ cdsTableWrap: () => _t }), Q = (t, e, s) => {
7
- const n = customElements.get("cds-table"), o = customElements.get("cds-pagination"), a = customElements.get(n.selectorTableBatchActions);
8
- customElements.get("cds-popover");
9
- const r = e.dataBinder, c = e.pagination, d = e.skeleton, I = e.querySelector(n.selectorTableToolbarSearch), S = e.querySelector(n.selectorTableBatchActions), D = e.querySelector(n.selectorTableBody), L = [
10
- "button",
11
- "a",
12
- "input",
13
- "select",
14
- "textarea",
15
- '[role="button"]',
16
- ".cds--table-expand",
17
- ".cds--table-column-checkbox"
18
- ].join(","), Z = e.querySelectorAll(n.selectorHeaderCell + "[is-sortable]"), ct = e.isSortable || Z.length > 0, O = /* @__PURE__ */ Symbol(), R = /* @__PURE__ */ Symbol(), x = /* @__PURE__ */ new Map(), it = (l) => {
19
- t.listen(e, "click", (p) => {
20
- const u = p.target.closest(n.selectorTableRow);
21
- if (!u || p.composedPath().some((b) => b.matches && b.matches(L))) return;
22
- p.stopPropagation();
23
- const f = i(u);
24
- t.dispatchPanelEvent(l, { ...f });
25
- });
26
- }, lt = (l) => {
27
- t.listen(e, n.eventExpandoToggle, (p) => {
28
- const u = p.target, f = u.tagName === "CDS-TABLE-HEADER-ROW", b = p.detail.expanded, E = {
29
- tableAttrs: s,
30
- ...i(u),
31
- target: u,
32
- allRows: f,
33
- didExpand: b
34
- };
35
- t.dispatchPanelEvent(l, E);
36
- });
37
- }, dt = (l) => {
38
- x.set(O, (p) => {
39
- t.dispatchPanelEvent(l, p);
40
- });
41
- }, pt = (l) => {
42
- x.set(R, (p) => {
43
- const u = p.detail.selectedRows, f = Math.min(u.length, S.totalRowsCount), b = p.target, E = i(b), P = u.map(i), C = {
44
- tableAttrs: s,
45
- ...E,
46
- target: b,
47
- selectCount: f,
48
- selection: P
49
- };
50
- t.dispatchPanelEvent(l, C);
51
- });
52
- }, ut = (l) => {
53
- t.listen(e, n.eventTableRowSelect, (p) => {
54
- const u = p.target, f = p.detail.selectedRows || [], b = f.length, E = f.map(i), P = {
55
- tableAttrs: s,
56
- ...i(u),
57
- selectCount: b,
58
- selection: E,
59
- target: u
60
- };
61
- t.dispatchPanelEvent(l, P);
62
- });
63
- }, vt = () => {
64
- t.listen(e, n.eventBeforeSort, (l) => {
65
- const p = l.target, u = l.detail.oldSortDirection, f = l.detail.sortDirection, b = i(p), E = b.sortField, P = f === Ct.DESCENDING ? `-${E}` : E;
66
- l.cancelBubble = !0, l.stopPropagation(), l.preventDefault(), D.innerHTML = "", d && d.show(), Z.forEach((A, h) => {
67
- A === p ? (A.setAttribute("sort-active", "true"), A.setAttribute("sort-direction", f)) : (A.removeAttribute("sort-active"), A.setAttribute("sort-direction", "none"));
68
- });
69
- const C = { ordering: P };
70
- r.fetchData(C).then(() => {
71
- c.setData(r), d && d.hide();
72
- }), x.has(O) && x.get(O)({
73
- tableAttrs: s,
74
- ...b,
75
- sortNow: f,
76
- sortWas: u,
77
- sortField: E,
78
- ordering: P,
79
- target: p
80
- });
81
- });
82
- }, mt = () => {
83
- t.listen(e, n.eventTableRowSelectAll, (l) => {
84
- l.detail.selectedRows.length === 0 && e.querySelectorAll(n.selectorTableRow).forEach((p) => {
85
- p.disabled = !1, p.selected = !1;
86
- }), x.has(R) && x.get(R)(l);
87
- });
88
- }, ft = () => {
89
- t.listen(e, n.eventBeforeChangeSelectionAll, (l) => {
90
- l.stopPropagation(), l.detail.callback && l.detail.callback();
91
- });
92
- }, ht = (l) => {
93
- const p = e.querySelector("cds-table-header-row");
94
- t.listen(l, a.eventClickSelectAll, (u) => {
95
- u.stopPropagation(), p.dispatchEvent(new CustomEvent(n.eventBeforeChangeSelectionAll, {
96
- bubbles: !0,
97
- cancelable: !0,
98
- composed: !0,
99
- detail: {
100
- selected: !0,
101
- callback: () => {
102
- l.selectedRowsCount = l.totalRowsCount, e.querySelectorAll(n.selectorTableRow).forEach((f) => {
103
- f.disabled = !0;
104
- });
105
- }
106
- }
107
- }));
108
- });
109
- }, gt = (l) => {
110
- t.listen(l, "keydown", (p) => {
111
- if (p.key === "Enter") {
112
- d && d.show(), c.totalItems = 0, e.querySelector("cds-table-body").replaceChildren();
113
- const u = {
114
- search: l.value || "",
115
- offset: 0
116
- };
117
- r.fetchData(u).then(() => {
118
- c.setData(r), d && d.hide();
119
- });
120
- }
121
- });
122
- }, bt = (l) => {
123
- t.listen(l, n.eventSearchInput, (p) => {
124
- if ((p.detail.value || "") === "") {
125
- const u = {
126
- search: "",
127
- offset: 0
128
- };
129
- d && d.show(), r.fetchData(u).then(() => {
130
- d && d.hide(), c.setData(r);
131
- });
132
- }
133
- });
134
- }, Et = (l) => {
135
- l.caret = !1;
136
- const p = l.querySelector("cds-icon-button, button:not([slot])"), u = l.querySelectorAll("cds-checkbox"), f = l.querySelectorAll("cds-modal-footer-button"), b = [...l.querySelectorAll("cds-checkbox-group")].map(i).map(M.pathOr("noop", [
137
- "zoo",
138
- "filter",
139
- "field"
140
- ])).reduce((h, g) => (h[g] = null, h), { offset: 0 });
141
- if (!p || !f) {
142
- console.error("Improperly configured Batch Filter popover");
143
- return;
144
- }
145
- new MutationObserver(() => {
146
- l.classList.toggle("cds--overflow-menu--open", l.open);
147
- }).observe(l, {
148
- attributes: !0,
149
- attributeFilter: ["open"]
150
- });
151
- const E = /* @__PURE__ */ Symbol(), P = /* @__PURE__ */ Symbol(), C = [...f].reduce((h, g, w) => (g.hasAttribute("reset-filter") && h.set(E, g), g.hasAttribute("apply-filter") && h.set(P, g), h), /* @__PURE__ */ new Map()), A = () => {
152
- const h = /* @__PURE__ */ new Map();
153
- return u.forEach((g) => {
154
- const w = g.getAttribute("id");
155
- if (!w || !w.includes(":")) return;
156
- const [B, N] = w.split(":");
157
- h.has(B) || h.set(B, []), g.checked && h.get(B).push(N);
158
- }), h;
159
- };
160
- if (C.has(E)) {
161
- const h = (g) => g.checked = !1;
162
- t.listen(C.get(E), "click", (g) => {
163
- g.stopPropagation(), u.forEach(h), d && d.show(), r.fetchData(b).then(() => {
164
- c && c.setData(r), d && d.hide(), l.open = !1;
165
- });
166
- });
167
- }
168
- C.has(P) && t.listen(C.get(P), "click", (h) => {
169
- h.stopPropagation();
170
- const g = [...A()].reduce((w, [B, N]) => (w[B] = Array.isArray(N) && N.length === 0 ? null : N, w), { offset: 0 });
171
- d && d.show(), r.fetchData(g).then(() => {
172
- c && c.setData(r), d && d.hide(), l.open = !1;
173
- });
174
- }), t.listen(p, "click", (h) => {
175
- h.stopPropagation(), l.open = !l.open, l.classList.toggle("cds--overflow-menu--open", l.open);
176
- });
177
- }, Wt = () => {
178
- t.listen(c, o.eventPageSizeChanged, (l) => {
179
- const p = {
180
- limit: c.pageSize,
181
- offset: 0
182
- };
183
- r.fetchData(p).then(() => {
184
- c.setData(r);
185
- });
186
- });
187
- }, It = () => {
188
- t.listen(c, o.eventChangeCurrent, (l) => {
189
- const { page: p } = l.detail, u = c.pageSize, f = {
190
- limit: u,
191
- offset: (p - 1) * u
192
- };
193
- r.fetchData(f).then(() => {
194
- c.setData(r), d && d.hide();
195
- });
196
- });
197
- };
198
- r && c && (Wt(), It()), r && I && (gt(I), bt(I));
199
- const J = e.querySelector(n.selectorTableToolbarContent);
200
- if (J) {
201
- const l = J.querySelectorAll("cds-popover[data-batch-filter]");
202
- r && l && l.forEach(Et);
203
- }
204
- e.isSelectable && (mt(), ft(), S && ht(S)), r && ct && vt();
205
- const K = { zoo: { event: {
206
- row: {
207
- click: it,
208
- expand: lt,
209
- check: {
210
- one: ut,
211
- all: pt
212
- }
213
- },
214
- column: { sort: dt }
215
- } } };
216
- kt(s).forEach(([l, p]) => {
217
- M.hasPath(l, K) && M.path(l, K)(p);
218
- });
219
- }, wt = (t) => {
220
- const e = document.createElement("cds-pagination");
221
- return e.backwardText = "Previous page", e.forwardText = "Next page", e.itemsPerPageText = "Items per page:", e.pageSize = t.limit, e.size = "lg", [
222
- 10,
223
- 25,
224
- 50,
225
- 100,
226
- 500
227
- ].forEach((s) => {
228
- const n = document.createElement("cds-select-item");
229
- n.value = s.toString(), n.textContent = s.toString(), e.appendChild(n);
230
- }), e.setData = (s) => {
231
- if (s.isPaginated) {
232
- const { count: n } = M.pick(["count"], s.data), o = Math.ceil(n / s.limit);
233
- e.pagesUnknown = o > 100, e.totalItems = n, e.pagesUnknown ? e.formatStatusWithIndeterminateTotal = ({ start: a, end: r }) => `${a}–${r} of ${n} item${n <= 1 ? "" : "s"}` : delete e.formatStatusWithIndeterminateTotal;
234
- }
235
- }, e;
236
- }, Dt = (t) => {
237
- if (!t.parentNode) {
238
- console.error("[Carbon Table] Cannot create skeleton: table has no parent node");
239
- return;
240
- }
241
- const e = !!t.querySelector("cds-table-header-title"), s = !!t.querySelector("cds-table-header-description"), n = !!t.querySelector("cds-table-toolbar"), o = [...t.querySelectorAll("cds-table-header-cell")].length, a = t.hasAttribute("zebra"), r = t.getAttribute("size"), c = document.createElement("cds-table-skeleton");
242
- c.showHeader = e || s, c.showToolbar = n, c.zebra = a, c.columnCount = o, c.size = r, c.show = () => c.classList.remove("hidden"), c.hide = () => c.classList.add("hidden");
243
- const d = document.createElement("div");
244
- return d.classList.add("zoo-datatable-skeleton-wrapper"), t.parentNode.insertBefore(d, t), d.appendChild(c), d.appendChild(t), c;
245
- }, xt = (t, e) => {
246
- const s = e.getAttribute("zoo-url-api"), n = parseInt(e.getAttribute("data-page-size") || 25, 10);
247
- if (s) return new Pt(t, s, e, { urlParams: { limit: n } });
248
- }, _t = {
249
- selector: "cds-table",
250
- init: function(t) {
251
- const e = i(t), s = this, n = xt(s, t);
252
- if (yt(n)) {
253
- t.dataBinder = n;
254
- const o = Dt(t);
255
- t.skeleton = o;
256
- const a = wt(n);
257
- t.pagination = a, t.after(a), n.fetchData().then((r) => {
258
- o.hide(), a.setData(n), Q(s, t, e);
259
- });
260
- } else Q(s, t, e);
261
- }
262
- }, Bt = /* @__PURE__ */ m({ cdsPaginationWrap: () => Nt }), Nt = {
263
- selector: "cds-pagination",
264
- init: function(t) {
265
- const e = this, s = customElements.get("cds-pagination");
266
- let n = null;
267
- e.listen(t, s.eventChangeCurrent, (o) => {
268
- const a = o.detail.page, r = t.pageSize, c = (a - 1) * r;
269
- c !== n && (n = c, e.dispatchPanelEvent("pagination-changed-current", { detail: {
270
- page: a,
271
- pageSize: r,
272
- action: "page-change"
273
- } }));
274
- }), e.listen(t, s.eventPageSizeChanged, (o) => {
275
- const a = t.pageSize;
276
- n = null, e.dispatchPanelEvent("pagination-changed-page-size", { detail: {
277
- page: 1,
278
- pageSize: a,
279
- action: "page-size-change"
280
- } });
281
- });
282
- }
283
- }, Tt = /* @__PURE__ */ m({
284
- cdsModalBodyContentWrap: () => qt,
285
- cdsModalBodyWrap: () => Rt,
286
- cdsModalCloseButWrap: () => Ot,
287
- cdsModalFooterButWrap: () => $t,
288
- cdsModalFooterWrap: () => Ut,
289
- cdsModalHeaderWrap: () => Ft,
290
- cdsModalHeadingWrap: () => zt,
291
- cdsModalLabelWrap: () => Lt,
292
- cdsModalWrap: () => Mt
293
- }), Mt = {
294
- selector: "cds-modal",
295
- init: function(t) {
296
- const e = customElements.get("cds-modal"), s = i(t), n = W(t, "open-event", "event");
297
- n && this.listen(t, "cds-modal-beingopened", (r) => {
298
- this.dispatchPanelEvent(n, {
299
- ...s,
300
- action: "opened"
301
- });
302
- });
303
- const o = t.getAttribute("before-close-event");
304
- o && this.listen(t, e.eventBeforeClose, (r) => {
305
- this.dispatchPanelEvent(o, {
306
- ...s,
307
- action: "closing",
308
- cancelable: !0
309
- });
310
- }), this.listen(t, e.eventClose, (r) => {
311
- this.dispatchPanelEvent("destroy_me", {
312
- ...s,
313
- action: "closed",
314
- triggeredBy: r.detail?.triggeredBy
315
- });
316
- });
317
- const a = W(t, "primary-event", "event");
318
- a && this.listen(t, "cds-modal-primary-focus", (r) => {
319
- this.dispatchPanelEvent(a, {
320
- ...s,
321
- action: "primary"
322
- });
323
- });
324
- }
325
- }, Ft = { selector: "cds-modal-header" }, zt = { selector: "cds-modal-heading" }, Lt = { selector: "cds-modal-label" }, Ot = { selector: "cds-modal-close-button" }, Rt = { selector: "cds-modal-body" }, qt = { selector: "cds-modal-body-content" }, Ut = { selector: "cds-modal-footer" }, $t = {
326
- selector: "cds-modal-footer-button",
327
- init: function(t) {
328
- const e = i(t);
329
- if (t.getAttribute("type") === "submit") {
330
- this.listen(t, "click", (n) => {
331
- let o = t.closest("form");
332
- if (!o) {
333
- const a = t.getAttribute("form");
334
- a && (o = document.getElementById(a));
335
- }
336
- o && o.requestSubmit();
337
- });
338
- return;
339
- }
340
- const s = e.event;
341
- s && this.listen(t, "click", (n) => {
342
- n.stopPropagation(), this.dispatchPanelEvent(s, e);
343
- });
344
- }
345
- }, Ht = /* @__PURE__ */ m({
346
- cdsMenuButtonWrap: () => Gt,
347
- cdsMenuWrap: () => jt
348
- }), jt = {
349
- selector: "cds-menu",
350
- init: function(t) {
351
- const e = i(t), s = W(t, "open-event");
352
- s && this.listen(t, "cds-menu-opened", (o) => {
353
- this.dispatchPanelEvent(s, {
354
- ...e,
355
- action: "opened"
356
- });
357
- });
358
- const n = W(t, "close-event");
359
- n && this.listen(t, "cds-menu-closed", (o) => {
360
- this.dispatchPanelEvent(n, {
361
- ...e,
362
- action: "closed"
363
- });
364
- }), this.listen(t, "click", (o) => {
365
- if (o.target.tagName === "CDS-MENU-ITEM") {
366
- const a = i(o.target), r = a.event || e.event;
367
- r && (o.stopPropagation(), this.dispatchPanelEvent(r, {
368
- ...e,
369
- ...a
370
- }));
371
- }
372
- }), this.listen(t, "cds-item-changed", (o) => {
373
- const a = o.detail.triggeredBy, r = i(a), c = r.event || e.event;
374
- c && this.dispatchPanelEvent(c, {
375
- ...e,
376
- ...r,
377
- action: "selection-changed"
378
- });
379
- });
380
- }
381
- }, Gt = {
382
- selector: "cds-menu-button",
383
- init: function(t) {
384
- const e = i(t), s = t.querySelector("cds-menu");
385
- s && this.listen(s, "click", (n) => {
386
- if (n.target.tagName === "CDS-MENU-ITEM") {
387
- const o = i(n.target), a = o.event || e.event;
388
- a && (n.stopPropagation(), this.dispatchPanelEvent(a, {
389
- ...e,
390
- ...o
391
- }));
392
- }
393
- });
394
- }
395
- }, Vt = /* @__PURE__ */ m({
396
- cdsButFabWrap: () => Qt,
397
- cdsButtonWrap: () => Zt,
398
- cdsComboButWrap: () => Yt,
399
- cdsCopyButWrap: () => Xt,
400
- cdsIconButToggleWrap: () => Kt,
401
- cdsIconButWrap: () => Jt
402
- }), Zt = {
403
- selector: "cds-button",
404
- init: function(t) {
405
- const e = i(t);
406
- if (t.getAttribute("type") === "submit") {
407
- this.listen(t, "click", (n) => {
408
- let o = t.closest("form");
409
- if (!o) {
410
- const a = t.getAttribute("form");
411
- a && (o = document.getElementById(a));
412
- }
413
- o && o.requestSubmit();
414
- });
415
- return;
416
- }
417
- const s = e.event;
418
- s && this.listen(t, "click", (n) => {
419
- n.stopPropagation(), this.dispatchPanelEvent(s, i(t));
420
- });
421
- }
422
- }, Jt = {
423
- selector: "cds-icon-button:not([data-toggle])",
424
- event: "click",
425
- getData: (t, e) => e
426
- }, Kt = {
427
- selector: "cds-icon-button[data-toggle]",
428
- init: function(t) {
429
- const e = i(t);
430
- e.event && this.listen(t, "click", (s) => {
431
- s.stopPropagation(), t.isSelected = !t.isSelected, this.dispatchPanelEvent(e.event, {
432
- ...e,
433
- isOn: t.isSelected
434
- });
435
- });
436
- }
437
- }, Qt = {
438
- selector: "cds-button[data-fab]",
439
- event: "click",
440
- getData: (t, e) => e
441
- }, Xt = {
442
- selector: "cds-copy-button",
443
- init: function(t) {
444
- const e = i(t), s = e.event;
445
- s && this.listen(t, "click", (o) => {
446
- o.stopPropagation(), this.dispatchPanelEvent(s, {
447
- ...e,
448
- action: "copy"
449
- });
450
- });
451
- const n = t.getAttribute("success-event");
452
- if (n) {
453
- const o = new MutationObserver(() => {
454
- t.hasAttribute("feedback-shown") && this.dispatchPanelEvent(n, {
455
- ...e,
456
- action: "copied"
457
- });
458
- });
459
- o.observe(t, {
460
- attributes: !0,
461
- attributeFilter: ["feedback-shown"]
462
- }), t._copyObserver = o;
463
- }
464
- }
465
- }, Yt = {
466
- selector: "cds-combo-button",
467
- init: function(t) {
468
- const e = i(t);
469
- e.event && this.listen(t, "click", (n) => {
470
- const o = n.composedPath(), a = o.some((c) => c.tagName === "CDS-MENU-ITEM"), r = o.some((c) => c.tagName === "CDS-ICON-BUTTON");
471
- !a && !r && (n.stopPropagation(), this.dispatchPanelEvent(e.event, {
472
- ...e,
473
- action: "primary"
474
- }));
475
- });
476
- const s = t.querySelector("cds-menu");
477
- s && this.listen(s, "click", (n) => {
478
- if (n.target.tagName === "CDS-MENU-ITEM") {
479
- const o = i(n.target), a = o.event || W(t, "menu-event", "event");
480
- a && this.dispatchPanelEvent(a, {
481
- ...e,
482
- ...o,
483
- action: "menu-item"
484
- });
485
- }
486
- });
487
- }
488
- }, te = /* @__PURE__ */ m({
489
- cdsComboBoxWrap: () => se,
490
- cdsDropdownWrap: () => ee,
491
- cdsMultiSelectWrap: () => ne
492
- }), ee = {
493
- selector: "cds-dropdown",
494
- init: function(t) {
495
- const e = customElements.get("cds-dropdown"), s = i(t), n = s.event;
496
- n && this.listen(t, e.eventSelect, (a) => {
497
- this.dispatchPanelEvent(n, {
498
- ...s,
499
- value: t.value,
500
- selectedValue: a.detail?.item?.value,
501
- selectedText: a.detail?.item?.textContent?.trim()
502
- });
503
- });
504
- const o = t.getAttribute("toggle-event");
505
- o && this.listen(t, e.eventToggle, (a) => {
506
- this.dispatchPanelEvent(o, {
507
- ...s,
508
- open: t.hasAttribute("open")
509
- });
510
- });
511
- }
512
- }, se = {
513
- selector: "cds-combo-box",
514
- init: function(t) {
515
- const e = customElements.get("cds-combo-box"), s = i(t), n = s.event;
516
- n && this.listen(t, e.eventSelect, (a) => {
517
- const r = a.detail?.item;
518
- this.dispatchPanelEvent(n, {
519
- ...s,
520
- value: t.value,
521
- selectedValue: r?.value,
522
- selectedText: r?.textContent?.trim()
523
- });
524
- });
525
- const o = t.getAttribute("toggle-event");
526
- o && this.listen(t, e.eventToggle, (a) => {
527
- this.dispatchPanelEvent(o, {
528
- ...s,
529
- open: t.hasAttribute("open")
530
- });
531
- });
532
- }
533
- }, ne = {
534
- selector: "cds-multi-select",
535
- init: function(t) {
536
- const e = customElements.get("cds-multi-select"), s = i(t), n = s.event;
537
- n && this.listen(t, e.eventSelect, (a) => {
538
- const r = t.value ? t.value.split(",") : [];
539
- this.dispatchPanelEvent(n, {
540
- ...s,
541
- selectedItems: r
542
- });
543
- });
544
- const o = t.getAttribute("toggle-event");
545
- o && this.listen(t, e.eventToggle, (a) => {
546
- this.dispatchPanelEvent(o, {
547
- ...s,
548
- open: t.hasAttribute("open")
549
- });
550
- });
551
- }
552
- }, oe = /* @__PURE__ */ m({
553
- cdsDatePickerWrap: () => ae,
554
- cdsTimePickerWrap: () => re
555
- }), ae = {
556
- selector: "cds-date-picker",
557
- init: function(t) {
558
- const e = customElements.get("cds-date-picker"), s = i(t), n = t.querySelector('cds-date-picker-input[kind="from"]'), o = t.querySelector('cds-date-picker-input[kind="to"]'), a = n && o, r = s.event;
559
- r && this.listen(t, e.eventChange, (d) => {
560
- let I;
561
- a ? I = {
562
- from: n.value || "",
563
- to: o.value || ""
564
- } : I = t.value, this.dispatchPanelEvent(r, {
565
- ...s,
566
- value: I
567
- });
568
- });
569
- const c = t.getAttribute("error-event");
570
- c && this.listen(t, e.eventFlatpickrError, (d) => {
571
- this.dispatchPanelEvent(c, {
572
- ...s,
573
- error: d.detail
574
- });
575
- });
576
- }
577
- }, re = {
578
- selector: "cds-time-picker",
579
- event: "cds-time-picker-changed",
580
- getData: (t, e, s) => ({
581
- ...e,
582
- value: s.value
583
- })
584
- }, ce = /* @__PURE__ */ m({
585
- cdsFileUploaderButtonWrap: () => le,
586
- cdsFileUploaderDropContainerWrap: () => ue,
587
- cdsFileUploaderWrap: () => ie
588
- });
589
- function ot(t) {
590
- customElements.whenDefined(t).then((e) => {
591
- if (!(!e || e.prototype.__zooyAcceptCasePatched)) {
592
- if (typeof e.prototype._getFiles != "function") {
593
- console.warn(`[Zooy] ${t}._getFiles missing; accept case-insensitivity shim skipped (Carbon may have refactored).`);
594
- return;
595
- }
596
- e.prototype._getFiles = function(s, n) {
597
- if (n === void 0 && (n = (s.type === "drop" ? s.dataTransfer : s.target)?.files), !this.accept || !/^(change|drop)$/.test(s.type)) return Array.from(n ?? []);
598
- const o = new Set(this.accept.toLowerCase().split(/[\s,]+/).filter(Boolean));
599
- return Array.prototype.filter.call(n ?? [], ({ name: a, type: r = "" }) => {
600
- const c = a.match(/\.[^.]+$/), d = c ? c[0].toLowerCase() : void 0;
601
- return o.has(r.toLowerCase()) || d && o.has(d);
602
- });
603
- }, e.prototype.__zooyAcceptCasePatched = !0;
604
- }
605
- });
606
- }
607
- ot("cds-file-uploader-drop-container");
608
- ot("cds-file-uploader-button");
609
- var ie = {
610
- selector: "cds-file-uploader",
611
- init: function(t) {
612
- const e = i(t), s = e.event;
613
- if (s) {
614
- const o = t.querySelector('input[type="file"]');
615
- o && this.listen(o, "change", (a) => {
616
- this.dispatchPanelEvent(s, {
617
- ...e,
618
- files: Array.from(a.target.files || [])
619
- });
620
- });
621
- }
622
- const n = t.getAttribute("delete-event");
623
- n && this.listen(t, "cds-file-uploader-item-deleted", (o) => {
624
- this.dispatchPanelEvent(n, {
625
- ...e,
626
- fileName: o.detail?.fileName,
627
- fileId: o.detail?.fileId
628
- });
629
- });
630
- }
631
- };
632
- function at(t, e) {
633
- const s = new DataTransfer();
634
- for (const n of e) s.items.add(n);
635
- t.files = s.files, t.dispatchEvent(new Event("change", { bubbles: !0 }));
636
- }
637
- function rt(t) {
638
- const e = t.getAttribute("for");
639
- if (!e)
640
- return console.warn(`[Zooy] ${t.tagName.toLowerCase()} missing 'for' attribute; cannot bind to a form input.`, t), null;
641
- const s = t.ownerDocument.getElementById(e);
642
- return !s || s.tagName !== "INPUT" || s.type !== "file" ? (console.warn(`[Zooy] 'for=${e}' did not resolve to an <input type="file">.`, t), null) : s;
643
- }
644
- var le = {
645
- selector: "cds-file-uploader-button",
646
- init: function(t) {
647
- const e = rt(t), s = i(t), n = s.event;
648
- this.listen(t, "cds-file-uploader-button-changed", (o) => {
649
- const a = o.detail?.addedFiles || [];
650
- e && at(e, a), n && this.dispatchPanelEvent(n, {
651
- ...s,
652
- files: Array.from(a)
653
- });
654
- });
655
- }
656
- };
657
- function de(t, e, s, n) {
658
- const o = t.querySelector(`[data-file-list-for="${e}"]`);
659
- if (o) {
660
- o.replaceChildren();
661
- for (const a of s) {
662
- const r = t.createElement("cds-file-uploader-item");
663
- r.setAttribute("state", "edit"), r.textContent = a.name, r.addEventListener("cds-file-uploader-item-deleted", () => {
664
- n(a.name);
665
- }), o.appendChild(r);
666
- }
667
- }
668
- }
669
- function pe(t, e) {
670
- const s = new DataTransfer();
671
- for (const n of t.files) n.name !== e && s.items.add(n);
672
- t.files = s.files, t.dispatchEvent(new Event("change", { bubbles: !0 }));
673
- }
674
- var ue = {
675
- selector: "cds-file-uploader-drop-container",
676
- init: function(t) {
677
- const e = rt(t), s = i(t), n = s.event, o = t.getAttribute("for"), a = () => {
678
- if (!o || !e) return;
679
- const r = Array.from(e.files);
680
- de(t.ownerDocument, o, r, (c) => {
681
- pe(e, c), a();
682
- }), t.multiple || (t.style.display = r.length > 0 ? "none" : "");
683
- };
684
- this.listen(t, "cds-file-uploader-drop-container-changed", (r) => {
685
- const c = r.detail?.addedFiles || [], d = t.multiple ? c : c.slice(0, 1);
686
- e && at(e, d), a(), n && this.dispatchPanelEvent(n, {
687
- ...s,
688
- files: Array.from(d)
689
- });
690
- });
691
- }
692
- }, ve = /* @__PURE__ */ m({
693
- cdsAccordionWrap: () => fe,
694
- cdsContentSwitcherWrap: () => he,
695
- cdsTabsWrap: () => me
696
- }), me = {
697
- selector: "cds-tabs",
698
- init: function(t) {
699
- const e = customElements.get("cds-tabs"), s = i(t), n = t.getAttribute("before-select-event");
700
- n && this.listen(t, e.eventBeforeSelect, (a) => {
701
- this.dispatchPanelEvent(n, {
702
- ...s,
703
- tabValue: a.detail.value,
704
- cancelable: !0
705
- });
706
- });
707
- const o = s.event;
708
- o && this.listen(t, e.eventSelect, (a) => {
709
- const r = a.detail.item, c = i(r);
710
- this.dispatchPanelEvent(o, {
711
- ...s,
712
- ...c,
713
- tabValue: a.detail.value
714
- });
715
- });
716
- }
717
- }, fe = {
718
- selector: "cds-accordion",
719
- init: function(t) {
720
- const e = customElements.get("cds-accordion-item"), s = i(t);
721
- [...t.querySelectorAll("cds-accordion-item")].forEach((n) => {
722
- const o = i(n), a = o.event || s.event;
723
- a && this.listen(n, e.eventToggle, (r) => {
724
- this.dispatchPanelEvent(a, {
725
- ...s,
726
- ...o,
727
- open: r.detail.open
728
- });
729
- });
730
- });
731
- }
732
- }, he = {
733
- selector: "cds-content-switcher",
734
- init: function(t) {
735
- const e = customElements.get("cds-content-switcher"), s = i(t), n = t.getAttribute("before-select-event");
736
- n && this.listen(t, e.eventBeforeSelect, (a) => {
737
- this.dispatchPanelEvent(n, {
738
- ...s,
739
- value: a.detail.value,
740
- cancelable: !0
741
- });
742
- });
743
- const o = s.event;
744
- o && this.listen(t, e.eventSelect, (a) => {
745
- const r = a.detail.item, c = i(r);
746
- this.dispatchPanelEvent(o, {
747
- ...s,
748
- ...c,
749
- value: r.getAttribute("value")
750
- });
751
- });
752
- }
753
- }, ge = /* @__PURE__ */ m({
754
- cdsBreadCrumbWrap: () => We,
755
- cdsBreadcrumbItemWrap: () => be,
756
- cdsBreadcrumbLinkWrap: () => Ee
757
- }), be = { selector: "cds-breadcrumb-item" }, Ee = {
758
- selector: "cds-breadcrumb-link",
759
- event: "click",
760
- getData: (t, e, s) => (t.preventDefault(), {
761
- ...e,
762
- href: s.getAttribute("href")
763
- })
764
- }, We = {
765
- selector: "cds-breadcrumb",
766
- init: function(t) {
767
- const e = this, s = i(t), n = s.event;
768
- if (n) {
769
- const o = (r) => {
770
- e.dispatchPanelEvent(n, {
771
- ...s,
772
- ...r
773
- });
774
- };
775
- e.listen(t, "click", (r) => {
776
- const c = r.target.closest("cds-breadcrumb-link");
777
- if (c) {
778
- r.preventDefault(), r.stopPropagation();
779
- const d = i(c);
780
- o(d);
781
- }
782
- });
783
- const a = t.querySelector("cds-overflow-menu-body");
784
- a && e.listen(a, "cds-overflow-menu-item-clicked", (r) => {
785
- r.stopPropagation();
786
- const c = i(r.target);
787
- o(c);
788
- });
789
- }
790
- }
791
- }, Ie = /* @__PURE__ */ m({
792
- cdsNumberInputWrap: () => ye,
793
- cdsPasswordInputWrap: () => ke,
794
- cdsSearchWrap: () => Ce,
795
- cdsTextAreaWrap: () => Pe,
796
- cdsTextInputWrap: () => Se
797
- }), Se = {
798
- selector: "cds-text-input",
799
- multiEvent: !0,
800
- events: [{
801
- type: "input",
802
- attrName: "event",
803
- getData: (t, e) => ({
804
- ...e,
805
- value: t.currentTarget.value
806
- })
807
- }, {
808
- type: "change",
809
- attrName: "change-event",
810
- getData: (t, e) => ({
811
- ...e,
812
- value: t.currentTarget.value
813
- })
814
- }]
815
- }, Pe = {
816
- selector: "cds-textarea",
817
- multiEvent: !0,
818
- events: [{
819
- type: "input",
820
- attrName: "event",
821
- getData: (t, e) => ({
822
- ...e,
823
- value: t.currentTarget.value
824
- })
825
- }, {
826
- type: "change",
827
- attrName: "change-event",
828
- getData: (t, e) => ({
829
- ...e,
830
- value: t.currentTarget.value
831
- })
832
- }]
833
- }, ye = {
834
- selector: "cds-number-input",
835
- event: "cds-number-input",
836
- getData: (t, e, s) => ({
837
- ...e,
838
- value: t.detail.value,
839
- direction: t.detail.direction
840
- })
841
- }, ke = {
842
- selector: "cds-password-input",
843
- multiEvent: !0,
844
- events: [{
845
- type: "input",
846
- attrName: "event",
847
- getData: (t, e) => ({
848
- ...e,
849
- value: t.currentTarget.value
850
- })
851
- }, {
852
- type: "change",
853
- attrName: "change-event",
854
- getData: (t, e) => ({
855
- ...e,
856
- value: t.currentTarget.value
857
- })
858
- }]
859
- }, Ce = {
860
- selector: "cds-search",
861
- event: "cds-search-input",
862
- getData: (t, e, s) => ({
863
- ...e,
864
- value: s.value
865
- })
866
- }, Ae = /* @__PURE__ */ m({
867
- cdsCheckboxWrap: () => we,
868
- cdsRadioButGroupWrap: () => De,
869
- cdsSelectWrap: () => _e,
870
- cdsSliderWrap: () => Be,
871
- cdsToggleWrap: () => xe
872
- }), we = {
873
- selector: "cds-checkbox",
874
- event: "cds-checkbox-changed",
875
- getData: (t, e, s) => ({
876
- ...e,
877
- checked: t.detail.checked,
878
- value: s.value
879
- })
880
- }, De = {
881
- selector: "cds-radio-button-group",
882
- event: "cds-radio-button-group-changed",
883
- getData: (t, e) => ({
884
- ...e,
885
- value: t.detail?.value
886
- })
887
- }, xe = {
888
- selector: "cds-toggle",
889
- event: "cds-toggle-changed",
890
- getData: (t, e) => ({
891
- ...e,
892
- isOn: t.detail.checked,
893
- value: t.detail.checked
894
- })
895
- }, _e = {
896
- selector: "cds-select",
897
- event: "cds-select-selected",
898
- getData: (t, e) => ({
899
- ...e,
900
- value: t.detail.value
901
- })
902
- }, Be = {
903
- selector: "cds-slider",
904
- init: function(t) {
905
- const e = i(t), s = e.event;
906
- s && this.listen(t, "cds-slider-changed", (o) => {
907
- this.dispatchPanelEvent(s, {
908
- ...e,
909
- value: o.detail.value
910
- });
911
- });
912
- const n = t.getAttribute("input-event");
913
- n && this.listen(t, "cds-slider-input-changed", (o) => {
914
- this.dispatchPanelEvent(n, {
915
- ...e,
916
- value: o.detail.value
917
- });
918
- });
919
- }
920
- }, Ne = /* @__PURE__ */ m({
921
- cdsFilterTagWrap: () => Fe,
922
- cdsSDismissibleTagWrap: () => Me,
923
- cdsTagsWrap: () => Te
924
- }), Te = {
925
- selector: "cds-tag",
926
- event: "click",
927
- getData: (t, e) => e
928
- }, Me = {
929
- selector: "cds-dismissible-tag",
930
- init: function(t) {
931
- const e = i(t), s = t.getAttribute("click-event");
932
- s && this.listen(t, "click", (o) => {
933
- o.target.closest("button") || this.dispatchPanelEvent(s, { ...e });
934
- });
935
- const n = e.event;
936
- n && this.listen(t, "cds-dismissible-tag-closed", (o) => {
937
- this.dispatchPanelEvent(n, {
938
- ...e,
939
- action: "closed"
940
- });
941
- });
942
- }
943
- }, Fe = {
944
- selector: "cds-filter-tag",
945
- event: "cds-filter-tag-closed",
946
- getData: (t, e) => ({
947
- ...e,
948
- action: "remove"
949
- })
950
- }, ze = /* @__PURE__ */ m({
951
- cdsContainedListDescriptionWrap: () => qe,
952
- cdsContainedListItemWrap: () => Ue,
953
- cdsContainedListWrap: () => Re,
954
- cdsOverflowMenuWrap: () => Le,
955
- cdsStructuredListWrap: () => Oe,
956
- cdsTreeViewWrap: () => $e
957
- }), Le = {
958
- selector: "cds-overflow-menu",
959
- init: function(t) {
960
- const e = i(t), s = e.event, n = t.querySelector("cds-overflow-menu-body");
961
- s && n && this.listen(n, "cds-overflow-menu-item-clicked", (o) => {
962
- o.stopPropagation();
963
- const a = i(o.target);
964
- this.dispatchPanelEvent(s, {
965
- ...e,
966
- ...a
967
- });
968
- });
969
- }
970
- }, Oe = {
971
- selector: "cds-structured-list",
972
- init: function(t) {
973
- const e = i(t);
974
- [...t.querySelectorAll("cds-structured-list-row")].forEach((s) => {
975
- const n = i(s), o = n.event || e.event;
976
- o && this.listen(s, "click", (a) => {
977
- a.stopPropagation(), this.dispatchPanelEvent(o, {
978
- ...e,
979
- ...n
980
- });
981
- });
982
- }), t.hasAttribute("selection") && this.listen(t, "cds-structured-list-selected", (s) => {
983
- const n = s.detail.row, o = i(n), a = e.event;
984
- a && this.dispatchPanelEvent(a, {
985
- ...e,
986
- ...o
987
- });
988
- });
989
- }
990
- }, Re = { selector: "cds-contained-list" }, qe = { selector: "cds-contained-list-description" }, Ue = {
991
- selector: "cds-contained-list-item",
992
- event: "cds-contained-list-item-click",
993
- getData: (t, e) => e
994
- }, $e = {
995
- selector: "cds-tree-view",
996
- init: function(t) {
997
- const e = i(t);
998
- this.listen(t, "cds-tree-node-selected", (n) => {
999
- const o = n.detail.node, a = i(o), r = a.event || e.event;
1000
- r && this.dispatchPanelEvent(r, {
1001
- ...e,
1002
- ...a,
1003
- nodeId: o.id,
1004
- label: o.getAttribute("label")
1005
- });
1006
- });
1007
- const s = W(t, "expand-event");
1008
- s && this.listen(t, "cds-tree-node-expanded", (n) => {
1009
- this.dispatchPanelEvent(s, {
1010
- ...e,
1011
- nodeId: n.detail.node.id,
1012
- expanded: n.detail.expanded
1013
- });
1014
- });
1015
- }
1016
- }, He = /* @__PURE__ */ m({
1017
- cdsActionableNotificationWrap: () => Ve,
1018
- cdsInlineNotificationWrap: () => Ge,
1019
- cdsToastNotificationWrap: () => je
1020
- }), je = {
1021
- selector: "cds-toast-notification",
1022
- event: "cds-notification-closed",
1023
- getData: (t, e) => ({
1024
- ...e,
1025
- action: "closed"
1026
- })
1027
- }, Ge = {
1028
- selector: "cds-inline-notification",
1029
- event: "cds-notification-closed",
1030
- getData: (t, e) => ({
1031
- ...e,
1032
- action: "closed"
1033
- })
1034
- }, Ve = {
1035
- selector: "cds-actionable-notification",
1036
- init: function(t) {
1037
- const e = i(t), s = W(t, "close-event", "event");
1038
- s && this.listen(t, "cds-notification-closed", (o) => {
1039
- this.dispatchPanelEvent(s, {
1040
- ...e,
1041
- action: "closed"
1042
- });
1043
- });
1044
- const n = W(t, "action-event");
1045
- n && this.listen(t, "cds-notification-actioned", (o) => {
1046
- this.dispatchPanelEvent(n, {
1047
- ...e,
1048
- action: "actioned"
1049
- });
1050
- });
1051
- }
1052
- }, Ze = /* @__PURE__ */ m({
1053
- cdsClickableTileWrap: () => Ke,
1054
- cdsExpandableTileWrap: () => Qe,
1055
- cdsRadioTileWrap: () => Ye,
1056
- cdsSelectableTileWrap: () => Xe,
1057
- cdsTileGroupWrap: () => ts,
1058
- cdsTileWrap: () => Je
1059
- }), Je = { selector: "cds-tile" }, Ke = {
1060
- selector: "cds-clickable-tile",
1061
- init: function(t) {
1062
- const e = i(t), s = e.event;
1063
- if (s) {
1064
- const n = e.href || t.getAttribute("href") || "";
1065
- t.removeAttribute("href"), t.addEventListener("click", (o) => {
1066
- o.preventDefault(), o.stopPropagation(), this.dispatchPanelEvent(s, {
1067
- ...e,
1068
- href: n
1069
- });
1070
- }, !0);
1071
- }
1072
- }
1073
- }, Qe = {
1074
- selector: "cds-expandable-tile",
1075
- init: function(t) {
1076
- const e = i(t), s = t.getAttribute("before-toggle-event");
1077
- s && this.listen(t, "cds-expandable-tile-beingtoggled", (o) => {
1078
- this.dispatchPanelEvent(s, {
1079
- ...e,
1080
- expanded: o.detail.expanded,
1081
- cancelable: !0
1082
- });
1083
- });
1084
- const n = e.event;
1085
- n && this.listen(t, "cds-expandable-tile-toggled", (o) => {
1086
- this.dispatchPanelEvent(n, {
1087
- ...e,
1088
- expanded: o.detail.expanded
1089
- });
1090
- });
1091
- }
1092
- }, Xe = {
1093
- selector: "cds-selectable-tile",
1094
- event: "cds-selectable-tile-changed",
1095
- getData: (t, e, s) => ({
1096
- ...e,
1097
- selected: t.detail.selected,
1098
- value: s.value
1099
- })
1100
- }, Ye = {
1101
- selector: "cds-radio-tile",
1102
- event: "cds-radio-tile-selected",
1103
- getData: (t, e, s) => ({
1104
- ...e,
1105
- selected: t.detail.selected,
1106
- name: t.detail.name,
1107
- value: s.value
1108
- })
1109
- }, ts = {
1110
- selector: "cds-tile-group",
1111
- init: function(t) {
1112
- const e = i(t), s = e.event;
1113
- s && (this.listen(t, "cds-current-radio-tile-selection", (n) => {
1114
- const o = n.detail.target;
1115
- this.dispatchPanelEvent(s, {
1116
- ...e,
1117
- value: o?.value,
1118
- name: o?.name,
1119
- selected: o?.selected
1120
- });
1121
- }), this.listen(t, "cds-current-selectable-tile-selections", (n) => {
1122
- const o = n.detail.currentSelections || [];
1123
- this.dispatchPanelEvent(s, {
1124
- ...e,
1125
- values: o.map((a) => a.value),
1126
- names: o.map((a) => a.name),
1127
- count: o.length
1128
- });
1129
- }));
1130
- }
1131
- }, es = /* @__PURE__ */ m({
1132
- cdsInlineLoadingWrap: () => os,
1133
- cdsProgressBarWrap: () => ss,
1134
- cdsProgressIndicatorWrap: () => ns
1135
- }), ss = {
1136
- selector: "cds-progress-bar",
1137
- init: function(t) {
1138
- const e = i(t);
1139
- if (e.event) {
1140
- const s = new MutationObserver(() => {
1141
- const n = parseFloat(t.getAttribute("value") || "0");
1142
- n >= parseFloat(t.getAttribute("max") || "100") && this.dispatchPanelEvent(e.event, {
1143
- ...e,
1144
- value: n,
1145
- status: "complete"
1146
- });
1147
- });
1148
- s.observe(t, {
1149
- attributes: !0,
1150
- attributeFilter: ["value"]
1151
- }), t._progressObserver = s;
1152
- }
1153
- }
1154
- }, ns = {
1155
- selector: "cds-progress-indicator",
1156
- init: function(t) {
1157
- const e = i(t);
1158
- this.listen(t, "cds-progress-step-click", (s) => {
1159
- const n = s.target, o = i(n), a = o.event || e.event;
1160
- a && this.dispatchPanelEvent(a, {
1161
- ...e,
1162
- ...o,
1163
- stepIndex: n.getAttribute("data-index"),
1164
- stepLabel: n.getAttribute("label")
1165
- });
1166
- });
1167
- }
1168
- }, os = {
1169
- selector: "cds-inline-loading",
1170
- init: function(t) {
1171
- const e = i(t), s = e.event;
1172
- s && this.listen(t, "cds-inline-loading-onsuccess", (o) => {
1173
- this.dispatchPanelEvent(s, {
1174
- ...e,
1175
- status: "finished"
1176
- });
1177
- });
1178
- const n = t.getAttribute("status-event");
1179
- if (n) {
1180
- const o = new MutationObserver((a) => {
1181
- a.forEach((r) => {
1182
- if (r.attributeName === "status") {
1183
- const c = t.getAttribute("status");
1184
- this.dispatchPanelEvent(n, {
1185
- ...e,
1186
- status: c
1187
- });
1188
- }
1189
- });
1190
- });
1191
- o.observe(t, {
1192
- attributes: !0,
1193
- attributeFilter: ["status"]
1194
- }), t._statusObserver = o;
1195
- }
1196
- }
1197
- }, as = /* @__PURE__ */ m({
1198
- cdsPopoverWrap: () => cs,
1199
- cdsToggletipWrap: () => is,
1200
- cdsTooltipWrap: () => rs
1201
- }), rs = {
1202
- selector: "cds-tooltip",
1203
- init: function(t) {
1204
- const e = i(t), s = W(t, "open-event");
1205
- s && this.listen(t, "cds-tooltip-beingopened", (o) => {
1206
- this.dispatchPanelEvent(s, {
1207
- ...e,
1208
- action: "opened"
1209
- });
1210
- });
1211
- const n = W(t, "close-event");
1212
- n && this.listen(t, "cds-tooltip-closed", (o) => {
1213
- this.dispatchPanelEvent(n, {
1214
- ...e,
1215
- action: "closed"
1216
- });
1217
- });
1218
- }
1219
- }, cs = {
1220
- selector: "cds-popover",
1221
- init: function(t) {
1222
- const e = i(t), s = W(t, "open-event");
1223
- s && this.listen(t, "cds-popover-beingopened", (o) => {
1224
- this.dispatchPanelEvent(s, {
1225
- ...e,
1226
- action: "opened"
1227
- });
1228
- });
1229
- const n = W(t, "close-event");
1230
- n && this.listen(t, "cds-popover-closed", (o) => {
1231
- this.dispatchPanelEvent(n, {
1232
- ...e,
1233
- action: "closed"
1234
- });
1235
- });
1236
- }
1237
- }, is = {
1238
- selector: "cds-toggletip",
1239
- init: function(t) {
1240
- const e = i(t);
1241
- if (e.event) {
1242
- const s = new MutationObserver((n) => {
1243
- n.forEach((o) => {
1244
- if (o.attributeName === "open") {
1245
- const a = t.hasAttribute("open");
1246
- this.dispatchPanelEvent(e.event, {
1247
- ...e,
1248
- action: a ? "opened" : "closed",
1249
- open: a
1250
- });
1251
- }
1252
- });
1253
- });
1254
- s.observe(t, {
1255
- attributes: !0,
1256
- attributeFilter: ["open"]
1257
- }), t._toggletipObserver = s;
1258
- }
1259
- }
1260
- }, ls = /* @__PURE__ */ m({
1261
- cdsCodeSnipWrap: () => ps,
1262
- cdsLinkWrap: () => ds
1263
- }), ds = {
1264
- selector: "cds-link",
1265
- event: "click",
1266
- getData: (t, e, s) => ({
1267
- ...e,
1268
- href: s.getAttribute("href")
1269
- })
1270
- }, ps = {
1271
- selector: "cds-code-snippet",
1272
- event: "cds-copy-button-clicked",
1273
- getData: (t, e) => ({
1274
- ...e,
1275
- action: "copied"
1276
- })
1277
- }, us = /* @__PURE__ */ m({
1278
- cdsBadgeIndicatorWrap: () => Is,
1279
- cdsFormGroupWrap: () => fs,
1280
- cdsFormItemWrap: () => ms,
1281
- cdsFormWrap: () => vs,
1282
- cdsHeadingWrap: () => gs,
1283
- cdsIconIndicatorWrap: () => Ws,
1284
- cdsIconWrap: () => Es,
1285
- cdsLoadingWrap: () => Ss,
1286
- cdsSectionWrap: () => bs,
1287
- cdsSkeletonPlaceholderWrap: () => ys,
1288
- cdsSkeletonTextWrap: () => Ps,
1289
- cdsStackWrap: () => hs
1290
- }), vs = { selector: "cds-form" }, ms = { selector: "cds-form-item" }, fs = { selector: "cds-form-group" }, hs = { selector: "cds-stack" }, gs = { selector: "cds-heading" }, bs = { selector: "cds-section" }, Es = { selector: "cds-icon" }, Ws = { selector: "cds-icon-indicator" }, Is = { selector: "cds-badge-indicator" }, Ss = { selector: "cds-loading" }, Ps = { selector: "cds-skeleton-text" }, ys = { selector: "cds-skeleton-placeholder" };
1291
- function v(t) {
1292
- return Object.values(t).filter((e) => typeof e == "object" && e !== null && e.selector);
1293
- }
1294
- var ks = [
1295
- ...v(Bt),
1296
- ...v(At),
1297
- ...v(Tt),
1298
- ...v(Ht),
1299
- ...v(Vt),
1300
- ...v(te),
1301
- ...v(oe),
1302
- ...v(ce),
1303
- ...v(ve),
1304
- ...v(ge),
1305
- ...v(Ie),
1306
- ...v(Ae),
1307
- ...v(Ne),
1308
- ...v(ze),
1309
- ...v(He),
1310
- ...v(Ze),
1311
- ...v(es),
1312
- ...v(as),
1313
- ...v(ls),
1314
- ...v(us)
1315
- ];
1316
- function Cs() {
1317
- const t = /* @__PURE__ */ new Map();
1318
- return ks.forEach((e) => {
1319
- t.set(e.selector, e);
1320
- }), t;
1321
- }
1322
- var As = () => import("@carbon/web-components/es/components/accordion/index.js"), q = () => import("@carbon/web-components/es/components/breadcrumb/index.js"), ws = () => import("@carbon/web-components/es/components/stack/index.js"), Ds = () => import("@carbon/web-components/es/components/structured-list/index.js"), U = () => import("@carbon/web-components/es/components/contained-list/index.js"), _ = () => import("@carbon/web-components/es/components/tile/index.js"), xs = () => import("@carbon/web-components/es/components/tree-view/index.js"), _s = () => import("@carbon/web-components/es/components/link/index.js"), Bs = () => import("@carbon/web-components/es/components/tabs/index.js"), Ns = () => import("@carbon/web-components/es/components/content-switcher/index.js"), X = () => import("@carbon/web-components/es/components/menu/index.js"), Ts = () => import("@carbon/web-components/es/components/overflow-menu/index.js"), $ = () => import("@carbon/web-components/es/components/button/index.js"), Y = () => import("@carbon/web-components/es/components/icon-button/index.js"), Ms = () => import("@carbon/web-components/es/components/combo-button/index.js"), Fs = () => import("@carbon/web-components/es/components/copy-button/index.js"), zs = () => import("@carbon/web-components/es/components/checkbox/index.js"), Ls = () => import("@carbon/web-components/es/components/radio-button/index.js"), Os = () => import("@carbon/web-components/es/components/toggle/index.js"), H = () => import("@carbon/web-components/es/components/select/index.js"), Rs = () => import("@carbon/web-components/es/components/slider/index.js"), j = () => import("@carbon/web-components/es/components/text-input/index.js"), qs = () => import("@carbon/web-components/es/components/textarea/index.js"), Us = () => import("@carbon/web-components/es/components/number-input/index.js"), $s = () => import("@carbon/web-components/es/components/password-input/index.js"), tt = () => import("@carbon/web-components/es/components/search/index.js"), Hs = () => import("@carbon/web-components/es/components/combo-box/index.js"), js = () => import("@carbon/web-components/es/components/dropdown/index.js"), Gs = () => import("@carbon/web-components/es/components/multi-select/index.js"), Vs = () => import("@carbon/web-components/es/components/date-picker/index.js"), Zs = () => import("@carbon/web-components/es/components/time-picker/index.js"), T = () => import("@carbon/web-components/es/components/file-uploader/index.js"), et = () => import("@carbon/web-components/es/components/form/index.js"), Js = () => import("@carbon/web-components/es/components/form-group/index.js"), Ks = () => import("@carbon/web-components/es/components/data-table/index.js"), st = () => import("@carbon/web-components/es/components/pagination/index.js"), Qs = () => import("@carbon/web-components/es/components/code-snippet/index.js"), G = () => import("@carbon/web-components/es/components/tag/index.js"), Xs = () => import("@carbon/web-components/es/components/badge-indicator/index.js"), V = () => import("@carbon/web-components/es/components/notification/index.js"), Ys = () => import("@carbon/web-components/es/components/loading/index.js"), tn = () => import("@carbon/web-components/es/components/inline-loading/index.js"), en = () => import("@carbon/web-components/es/components/progress-bar/index.js"), sn = () => import("@carbon/web-components/es/components/progress-indicator/index.js"), nn = () => import("@carbon/web-components/es/components/skeleton-placeholder/index.js"), on = () => import("@carbon/web-components/es/components/skeleton-text/index.js"), y = () => import("@carbon/web-components/es/components/modal/index.js"), k = () => import("@carbon/web-components/es/components/tooltip/index.js"), an = () => import("@carbon/web-components/es/components/popover/index.js"), rn = () => import("@carbon/web-components/es/components/toggle-tip/index.js"), nt = () => import("@carbon/web-components/es/components/heading/index.js"), cn = () => import("@carbon/web-components/es/components/icon/index.js"), ln = () => import("@carbon/web-components/es/components/icon-indicator/index.js"), z = {
1323
- "cds-table": [
1324
- k,
1325
- $,
1326
- j,
1327
- tt,
1328
- H,
1329
- st,
1330
- Ks
1331
- ],
1332
- "cds-pagination": [
1333
- H,
1334
- j,
1335
- st
1336
- ],
1337
- "cds-button": [k, $],
1338
- "cds-icon-button:not([data-toggle])": [k, Y],
1339
- "cds-icon-button[data-toggle]": [k, Y],
1340
- "cds-button[data-fab]": [k, $],
1341
- "cds-copy-button": [k, Fs],
1342
- "cds-combo-button": [k, Ms],
1343
- "cds-checkbox": [zs],
1344
- "cds-radio-button-group": [Ls],
1345
- "cds-toggle": [Os],
1346
- "cds-select": [H],
1347
- "cds-slider": [Rs],
1348
- "cds-text-input": [j],
1349
- "cds-textarea": [qs],
1350
- "cds-number-input": [Us],
1351
- "cds-password-input": [k, $s],
1352
- "cds-search": [tt],
1353
- "cds-dropdown": [js],
1354
- "cds-combo-box": [Hs],
1355
- "cds-multi-select": [Gs],
1356
- "cds-date-picker": [Vs],
1357
- "cds-time-picker": [Zs],
1358
- "cds-file-uploader": [T],
1359
- "cds-file-uploader-button": [T],
1360
- "cds-file-uploader-drop-container": [T],
1361
- "cds-file-uploader-item": [T],
1362
- "cds-tabs": [Bs],
1363
- "cds-accordion": [As],
1364
- "cds-content-switcher": [Ns],
1365
- "cds-breadcrumb": [q],
1366
- "cds-breadcrumb-item": [q],
1367
- "cds-breadcrumb-link": [q],
1368
- "cds-menu": [X],
1369
- "cds-menu-button": [X],
1370
- "cds-overflow-menu": [Ts],
1371
- "cds-structured-list": [Ds],
1372
- "cds-contained-list": [U],
1373
- "cds-contained-list-item": [U],
1374
- "cds-contained-list-description": [U],
1375
- "cds-tree-view": [xs],
1376
- "cds-modal": [y],
1377
- "cds-modal-header": [y],
1378
- "cds-modal-heading": [y],
1379
- "cds-modal-label": [y],
1380
- "cds-modal-close-button": [y],
1381
- "cds-modal-body": [y],
1382
- "cds-modal-body-content": [y],
1383
- "cds-modal-footer": [y],
1384
- "cds-modal-footer-button": [y],
1385
- "cds-toast-notification": [V],
1386
- "cds-inline-notification": [V],
1387
- "cds-actionable-notification": [V],
1388
- "cds-tile": [_],
1389
- "cds-tile-group": [_],
1390
- "cds-clickable-tile": [_],
1391
- "cds-expandable-tile": [_],
1392
- "cds-selectable-tile": [_],
1393
- "cds-radio-tile": [_],
1394
- "cds-progress-bar": [en],
1395
- "cds-progress-indicator": [sn],
1396
- "cds-inline-loading": [tn],
1397
- "cds-tooltip": [k],
1398
- "cds-popover": [an],
1399
- "cds-toggletip": [rn],
1400
- "cds-tag": [G],
1401
- "cds-dismissible-tag": [G],
1402
- "cds-filter-tag": [G],
1403
- "cds-link": [_s],
1404
- "cds-code-snippet": [Qs],
1405
- "cds-form": [et],
1406
- "cds-form-item": [et],
1407
- "cds-form-group": [Js],
1408
- "cds-stack": [ws],
1409
- "cds-heading": [nt],
1410
- "cds-section": [nt],
1411
- "cds-icon": [cn],
1412
- "cds-icon-indicator": [ln],
1413
- "cds-badge-indicator": [Xs],
1414
- "cds-loading": [Ys],
1415
- "cds-skeleton-text": [on],
1416
- "cds-skeleton-placeholder": [nn]
1417
- };
1418
- function dn(t) {
1419
- const e = /* @__PURE__ */ new Map();
1420
- if (!t || !(t instanceof Element)) return e;
1421
- for (const n of Object.keys(F)) e.set(n, []);
1422
- for (const [n] of Object.entries(F)) t.matches(n) && e.get(n).push(t);
1423
- const s = t.querySelectorAll("*");
1424
- for (const n of s) for (const [o] of Object.entries(F)) n.matches(o) && e.get(o).push(n);
1425
- for (const [n, o] of e.entries()) o.length === 0 && e.delete(n);
1426
- return e;
1427
- }
1428
- function pn(t) {
1429
- const e = /* @__PURE__ */ new Set();
1430
- for (const [s, n] of t.entries()) n.length > 0 && z[s] && z[s].forEach((o) => e.add(o));
1431
- return e;
1432
- }
1433
- async function un(t, e) {
1434
- if (t.size === 0) return;
1435
- const s = Array.from(t).map(async (n) => (e.has(n) || e.set(n, n()), e.get(n)));
1436
- await Promise.all(s);
1437
- }
1438
- function vn(t, e) {
1439
- let s = 0;
1440
- for (const [n, o] of t.entries()) {
1441
- const a = F[n];
1442
- o.forEach((r) => {
1443
- if (a.init) {
1444
- a.init.call(e, r);
1445
- return;
1446
- }
1447
- if (a.multiEvent) {
1448
- const I = i(r);
1449
- a.events.forEach((S) => {
1450
- const D = W(r, S.attrName, "event");
1451
- D && e.listen(r, S.type, (L) => {
1452
- e.dispatchPanelEvent(D, S.getData(L, I, r));
1453
- });
1454
- });
1455
- return;
1456
- }
1457
- const c = i(r), d = c.event;
1458
- d && e.listen(r, a.event, (I) => {
1459
- I.stopPropagation();
1460
- const S = a.getData(I, c, r), D = S._eventOverride || d;
1461
- delete S._eventOverride, e.dispatchPanelEvent(D, S);
1462
- });
1463
- }), s += o.length;
1464
- }
1465
- return s;
1466
- }
1467
- var F = Object.fromEntries(Cs()), mn = async function(t, e) {
1468
- const s = dn(t);
1469
- if (s.size === 0) {
1470
- this.debugMe("[Carbon] No Carbon components found in panel");
1471
- return;
1472
- }
1473
- this.carbonComponents || (this.carbonComponents = /* @__PURE__ */ new Map());
1474
- for (const [a, r] of s.entries()) this.carbonComponents.set(a, r);
1475
- const n = pn(s);
1476
- if (n.size > 0) try {
1477
- await un(n, e);
1478
- } catch (a) {
1479
- console.error("[Carbon] Failed to load some component modules:", a);
1480
- }
1481
- const o = vn(s, this);
1482
- o > 0 && this.debugMe(`[Carbon] Total components initialized: ${o}`);
1483
- }, En = (t = {}) => {
1484
- const { preload: e = [] } = t, s = /* @__PURE__ */ new Map();
1485
- if (e.length > 0) {
1486
- const n = e.filter((a) => z[a] ? !0 : (console.warn(`[Carbon] No import found for selector: ${a}`), !1)), o = n.flatMap((a) => z[a].map((r) => (s.has(r) || s.set(r, r()), s.get(r))));
1487
- Promise.all(o).then(() => console.debug(`[Carbon] Preloaded: ${n.join(", ")}`)).catch((a) => console.warn("[Carbon] Preload error:", a));
1488
- }
1489
- St.register("carbon", {
1490
- cache: s,
1491
- render: async function(n, o) {
1492
- try {
1493
- await mn.call(this, n, o);
1494
- } catch (a) {
1495
- console.error("[Carbon] Initialization error:", a);
1496
- }
1497
- },
1498
- dispose: function(n) {
1499
- },
1500
- config: {
1501
- version: "2.0",
1502
- description: "IBM Carbon Design System Web Components"
1503
- }
1504
- }), console.debug("[Zooy] Carbon Design System library registered");
1505
- };
1506
- export {
1507
- En as registerCarbonLibrary
1508
- };