wj-elements 0.7.7 → 0.8.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.
Files changed (233) hide show
  1. package/dist/animations.js +28 -51
  2. package/dist/animations.js.map +1 -1
  3. package/dist/base-path.js +19 -31
  4. package/dist/base-path.js.map +1 -1
  5. package/dist/custom-elements.json +11504 -11499
  6. package/dist/dark.css +1 -302
  7. package/dist/date.js +16 -36
  8. package/dist/date.js.map +1 -1
  9. package/dist/element-utils.js +20 -81
  10. package/dist/element-utils.js.map +1 -1
  11. package/dist/event.js +49 -165
  12. package/dist/event.js.map +1 -1
  13. package/dist/form-associated-element-BjeJn7j8.js +101 -0
  14. package/dist/{form-associated-element-DEQ4y-jn.js.map → form-associated-element-BjeJn7j8.js.map} +1 -1
  15. package/dist/icon-DmsqtDpL.js +102 -0
  16. package/dist/{icon-CReYMzAK.js.map → icon-DmsqtDpL.js.map} +1 -1
  17. package/dist/light.css +1 -731
  18. package/dist/localize.js +36 -111
  19. package/dist/localize.js.map +1 -1
  20. package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +3 -2
  21. package/dist/permissions.js +14 -41
  22. package/dist/permissions.js.map +1 -1
  23. package/dist/popup.element-CbkhthPP.js +806 -0
  24. package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
  25. package/dist/router-links-CNsJ-elb.js +105 -0
  26. package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
  27. package/dist/skeleton.css +1 -197
  28. package/dist/styles.css +1 -866
  29. package/dist/universal-service.js +48 -109
  30. package/dist/universal-service.js.map +1 -1
  31. package/dist/utils.js +11 -18
  32. package/dist/utils.js.map +1 -1
  33. package/dist/web-types.json +760 -760
  34. package/dist/wje-accordion-item.js +33 -106
  35. package/dist/wje-accordion-item.js.map +1 -1
  36. package/dist/wje-accordion.js +19 -84
  37. package/dist/wje-accordion.js.map +1 -1
  38. package/dist/wje-animation.js +37 -4258
  39. package/dist/wje-animation.js.map +1 -1
  40. package/dist/wje-aside.js +9 -34
  41. package/dist/wje-aside.js.map +1 -1
  42. package/dist/wje-avatar.js +36 -126
  43. package/dist/wje-avatar.js.map +1 -1
  44. package/dist/wje-badge.js +10 -52
  45. package/dist/wje-badge.js.map +1 -1
  46. package/dist/wje-breadcrumb.js +205 -672
  47. package/dist/wje-breadcrumb.js.map +1 -1
  48. package/dist/wje-breadcrumbs.js +177 -633
  49. package/dist/wje-breadcrumbs.js.map +1 -1
  50. package/dist/wje-button-group.js +48 -153
  51. package/dist/wje-button-group.js.map +1 -1
  52. package/dist/wje-button.js +92 -413
  53. package/dist/wje-button.js.map +1 -1
  54. package/dist/wje-card-content.js +7 -30
  55. package/dist/wje-card-content.js.map +1 -1
  56. package/dist/wje-card-controls.js +7 -30
  57. package/dist/wje-card-controls.js.map +1 -1
  58. package/dist/wje-card-header.js +7 -30
  59. package/dist/wje-card-header.js.map +1 -1
  60. package/dist/wje-card-subtitle.js +7 -34
  61. package/dist/wje-card-subtitle.js.map +1 -1
  62. package/dist/wje-card-title.js +7 -34
  63. package/dist/wje-card-title.js.map +1 -1
  64. package/dist/wje-card.js +15 -71
  65. package/dist/wje-card.js.map +1 -1
  66. package/dist/wje-carousel-item.js +12 -56
  67. package/dist/wje-carousel-item.js.map +1 -1
  68. package/dist/wje-carousel.js +154 -509
  69. package/dist/wje-carousel.js.map +1 -1
  70. package/dist/wje-checkbox.js +50 -227
  71. package/dist/wje-checkbox.js.map +1 -1
  72. package/dist/wje-chip.js +43 -160
  73. package/dist/wje-chip.js.map +1 -1
  74. package/dist/wje-col.js +7 -20
  75. package/dist/wje-col.js.map +1 -1
  76. package/dist/wje-color-picker.js +445 -1464
  77. package/dist/wje-color-picker.js.map +1 -1
  78. package/dist/wje-container.js +9 -35
  79. package/dist/wje-container.js.map +1 -1
  80. package/dist/wje-copy-button.js +64 -204
  81. package/dist/wje-copy-button.js.map +1 -1
  82. package/dist/wje-dialog.js +85 -553
  83. package/dist/wje-dialog.js.map +1 -1
  84. package/dist/wje-divider.js +7 -34
  85. package/dist/wje-divider.js.map +1 -1
  86. package/dist/wje-dropdown.js +78 -305
  87. package/dist/wje-dropdown.js.map +1 -1
  88. package/dist/wje-element.js +191 -700
  89. package/dist/wje-element.js.map +1 -1
  90. package/dist/wje-file-upload-item.js +51 -156
  91. package/dist/wje-file-upload-item.js.map +1 -1
  92. package/dist/wje-file-upload.js +181 -619
  93. package/dist/wje-file-upload.js.map +1 -1
  94. package/dist/wje-footer.js +7 -31
  95. package/dist/wje-footer.js.map +1 -1
  96. package/dist/wje-form.js +7 -32
  97. package/dist/wje-form.js.map +1 -1
  98. package/dist/wje-format-digital.js +26 -118
  99. package/dist/wje-format-digital.js.map +1 -1
  100. package/dist/wje-grid.js +7 -33
  101. package/dist/wje-grid.js.map +1 -1
  102. package/dist/wje-header.js +9 -35
  103. package/dist/wje-header.js.map +1 -1
  104. package/dist/wje-icon-library.js +12 -18
  105. package/dist/wje-icon-library.js.map +1 -1
  106. package/dist/wje-icon-picker.js +65 -320
  107. package/dist/wje-icon-picker.js.map +1 -1
  108. package/dist/wje-icon.js +1 -1
  109. package/dist/wje-img-comparer.js +37 -114
  110. package/dist/wje-img-comparer.js.map +1 -1
  111. package/dist/wje-img.js +50 -198
  112. package/dist/wje-img.js.map +1 -1
  113. package/dist/wje-infinite-scroll.js +94 -346
  114. package/dist/wje-infinite-scroll.js.map +1 -1
  115. package/dist/wje-input-file.js +23 -84
  116. package/dist/wje-input-file.js.map +1 -1
  117. package/dist/wje-input.js +78 -392
  118. package/dist/wje-input.js.map +1 -1
  119. package/dist/wje-item.js +11 -64
  120. package/dist/wje-item.js.map +1 -1
  121. package/dist/wje-kanban.js +124 -401
  122. package/dist/wje-kanban.js.map +1 -1
  123. package/dist/wje-label.js +9 -32
  124. package/dist/wje-label.js.map +1 -1
  125. package/dist/wje-level-indicator.js +38 -157
  126. package/dist/wje-level-indicator.js.map +1 -1
  127. package/dist/wje-list.js +10 -40
  128. package/dist/wje-list.js.map +1 -1
  129. package/dist/wje-main.js +7 -31
  130. package/dist/wje-main.js.map +1 -1
  131. package/dist/wje-masonry.js +66 -211
  132. package/dist/wje-masonry.js.map +1 -1
  133. package/dist/wje-master.js +45 -161
  134. package/dist/wje-master.js.map +1 -1
  135. package/dist/wje-menu-button.js +10 -38
  136. package/dist/wje-menu-button.js.map +1 -1
  137. package/dist/wje-menu-item.js +127 -577
  138. package/dist/wje-menu-item.js.map +1 -1
  139. package/dist/wje-menu-label.js +9 -35
  140. package/dist/wje-menu-label.js.map +1 -1
  141. package/dist/wje-menu.js +14 -49
  142. package/dist/wje-menu.js.map +1 -1
  143. package/dist/wje-option.js +48 -279
  144. package/dist/wje-option.js.map +1 -1
  145. package/dist/wje-options.js +130 -384
  146. package/dist/wje-options.js.map +1 -1
  147. package/dist/wje-orgchart-group.js +16 -52
  148. package/dist/wje-orgchart-group.js.map +1 -1
  149. package/dist/wje-orgchart-item.js +24 -93
  150. package/dist/wje-orgchart-item.js.map +1 -1
  151. package/dist/wje-orgchart.js +18 -68
  152. package/dist/wje-orgchart.js.map +1 -1
  153. package/dist/wje-pagination.js +113 -397
  154. package/dist/wje-pagination.js.map +1 -1
  155. package/dist/wje-popup.js +3 -3
  156. package/dist/wje-popup.js.map +1 -1
  157. package/dist/wje-progress-bar.js +53 -205
  158. package/dist/wje-progress-bar.js.map +1 -1
  159. package/dist/wje-qr-code.js +398 -2980
  160. package/dist/wje-qr-code.js.map +1 -1
  161. package/dist/wje-radio-group.js +52 -190
  162. package/dist/wje-radio-group.js.map +1 -1
  163. package/dist/wje-radio.js +24 -118
  164. package/dist/wje-radio.js.map +1 -1
  165. package/dist/wje-rate.js +62 -266
  166. package/dist/wje-rate.js.map +1 -1
  167. package/dist/wje-relative-time.js +24 -99
  168. package/dist/wje-relative-time.js.map +1 -1
  169. package/dist/wje-reorder-dropzone.js +9 -31
  170. package/dist/wje-reorder-dropzone.js.map +1 -1
  171. package/dist/wje-reorder-handle.js +67 -204
  172. package/dist/wje-reorder-handle.js.map +1 -1
  173. package/dist/wje-reorder-item.js +14 -44
  174. package/dist/wje-reorder-item.js.map +1 -1
  175. package/dist/wje-reorder.js +61 -246
  176. package/dist/wje-reorder.js.map +1 -1
  177. package/dist/wje-route.js +6 -24
  178. package/dist/wje-route.js.map +1 -1
  179. package/dist/wje-router-link.js +11 -39
  180. package/dist/wje-router-link.js.map +1 -1
  181. package/dist/wje-router-outlet.js +76 -172
  182. package/dist/wje-router-outlet.js.map +1 -1
  183. package/dist/wje-routerx.js +537 -1331
  184. package/dist/wje-routerx.js.map +1 -1
  185. package/dist/wje-row.js +9 -31
  186. package/dist/wje-row.js.map +1 -1
  187. package/dist/wje-select.js +326 -1152
  188. package/dist/wje-select.js.map +1 -1
  189. package/dist/wje-slider.js +44 -225
  190. package/dist/wje-slider.js.map +1 -1
  191. package/dist/wje-sliding-container.js +295 -1319
  192. package/dist/wje-sliding-container.js.map +1 -1
  193. package/dist/wje-split-view.js +35 -121
  194. package/dist/wje-split-view.js.map +1 -1
  195. package/dist/wje-status.js +14 -45
  196. package/dist/wje-status.js.map +1 -1
  197. package/dist/wje-step.js +9 -32
  198. package/dist/wje-step.js.map +1 -1
  199. package/dist/wje-stepper.js +109 -357
  200. package/dist/wje-stepper.js.map +1 -1
  201. package/dist/wje-store.js +67 -360
  202. package/dist/wje-store.js.map +1 -1
  203. package/dist/wje-tab-group.js +85 -314
  204. package/dist/wje-tab-group.js.map +1 -1
  205. package/dist/wje-tab-panel.js +7 -28
  206. package/dist/wje-tab-panel.js.map +1 -1
  207. package/dist/wje-tab.js +21 -198
  208. package/dist/wje-tab.js.map +1 -1
  209. package/dist/wje-textarea.js +64 -264
  210. package/dist/wje-textarea.js.map +1 -1
  211. package/dist/wje-thumbnail.js +10 -51
  212. package/dist/wje-thumbnail.js.map +1 -1
  213. package/dist/wje-toast.js +127 -632
  214. package/dist/wje-toast.js.map +1 -1
  215. package/dist/wje-toggle.js +52 -177
  216. package/dist/wje-toggle.js.map +1 -1
  217. package/dist/wje-toolbar-action.js +128 -456
  218. package/dist/wje-toolbar-action.js.map +1 -1
  219. package/dist/wje-toolbar.js +75 -270
  220. package/dist/wje-toolbar.js.map +1 -1
  221. package/dist/wje-tooltip.js +50 -161
  222. package/dist/wje-tooltip.js.map +1 -1
  223. package/dist/wje-tree-item.js +70 -301
  224. package/dist/wje-tree-item.js.map +1 -1
  225. package/dist/wje-tree.js +145 -489
  226. package/dist/wje-tree.js.map +1 -1
  227. package/dist/wje-visually-hidden.js +7 -34
  228. package/dist/wje-visually-hidden.js.map +1 -1
  229. package/package.json +3 -2
  230. package/dist/form-associated-element-DEQ4y-jn.js +0 -245
  231. package/dist/icon-CReYMzAK.js +0 -245
  232. package/dist/popup.element-CwXvVFK7.js +0 -2133
  233. package/dist/router-links-wjqCnncc.js +0 -156
@@ -7,101 +7,36 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
7
7
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
8
8
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
- var _onMenuItemCustom;
11
- import WJElement from "./wje-element.js";
12
- import { P as Popup } from "./popup.element-CwXvVFK7.js";
13
- import { event } from "./event.js";
14
- const _Dropdown = class _Dropdown extends WJElement {
15
- /**
16
- * Creates an instance of Dropdown.
17
- * @class
18
- */
10
+ var _t;
11
+ import t from "./wje-element.js";
12
+ import { P as e } from "./popup.element-CbkhthPP.js";
13
+ import { event as i } from "./event.js";
14
+ const _s = class _s extends t {
19
15
  constructor() {
20
16
  super();
21
- /**
22
- * The placement of the dropdown.
23
- * @type {{"wje-popup": Popup}}
24
- */
25
- __publicField(this, "dependencies", {
26
- "wje-popup": Popup
27
- });
28
- /**
29
- * Sets the placement of the dropdown.
30
- * @type {string}
31
- */
17
+ __publicField(this, "dependencies", { "wje-popup": e });
32
18
  __publicField(this, "className", "Dropdown");
33
- /**
34
- * Callback function to handle other dropdowns being opened. Close the dropdown if it is not the target and collapse is enabled.
35
- * @param {Event} e The event object.
36
- */
37
- __publicField(this, "otherDropdownOpennedCallback", (e) => {
38
- if (e.detail.detail.target !== this) {
39
- this.classList.remove("active");
40
- this.popup.hide();
41
- }
19
+ __publicField(this, "otherDropdownOpennedCallback", (t2) => {
20
+ t2.detail.detail.target !== this && (this.classList.remove("active"), this.popup.hide());
42
21
  });
43
- /**
44
- * Handles popup hide events and closes only the dropdown that owns the popup.
45
- * This prevents nested dropdowns from collapsing their parent dropdown when the
46
- * child popup is hidden.
47
- * @param {Event} e The popup hide event.
48
- */
49
- __publicField(this, "popupHideCallback", (e) => {
50
- if (this.classList.contains("active") && e.target === this) {
51
- this.toggleCallback(e);
52
- }
22
+ __publicField(this, "popupHideCallback", (t2) => {
23
+ this.classList.contains("active") && t2.target === this && this.toggleCallback(t2);
53
24
  });
54
- /**
55
- * Handles delegated clicks from inside the popup and closes the dropdown when a leaf menu item is selected.
56
- * This works even when the menu is portaled, because we rely on the composed path.
57
- */
58
- __publicField(this, "onMenuItemClick", (e) => {
59
- const path = typeof e.composedPath === "function" ? e.composedPath() : [];
60
- const item = path.find((n) => n && n.tagName === "WJE-MENU-ITEM");
61
- if (!item) return;
62
- const owner = this.getMenuItemOwner(path, item);
63
- if (owner && owner !== this) return;
64
- if (item.hasAttribute("disabled") || item.getAttribute("aria-disabled") === "true") return;
65
- if (typeof item.querySelector === "function" && item.querySelector("wje-menu")) return;
66
- this.onClose();
25
+ __publicField(this, "onMenuItemClick", (t2) => {
26
+ const e2 = "function" == typeof t2.composedPath ? t2.composedPath() : [], i2 = e2.find((t3) => t3 && "WJE-MENU-ITEM" === t3.tagName);
27
+ if (!i2) return;
28
+ const s2 = this.getMenuItemOwner(e2, i2);
29
+ s2 && s2 !== this || i2.hasAttribute("disabled") || "true" === i2.getAttribute("aria-disabled") || "function" == typeof i2.querySelector && i2.querySelector("wje-menu") || this.onClose();
67
30
  });
68
- /**
69
- * @summary Toggles the dropdown element between active and inactive states.
70
- * Calls the `onOpen` method if the element is currently inactive,
71
- * and calls the `onClose` method if the element is currently active.
72
- * @param {Event} e The event object.
73
- */
74
- __publicField(this, "toggleCallback", (e) => {
75
- if (this.classList.contains("active")) {
76
- e.stopPropagation();
77
- this.onClose();
78
- } else {
79
- e.stopPropagation();
80
- this.onOpen(e);
81
- }
31
+ __publicField(this, "toggleCallback", (t2) => {
32
+ this.classList.contains("active") ? (t2.stopPropagation(), this.onClose()) : (t2.stopPropagation(), this.onOpen(t2));
82
33
  });
83
- /**
84
- * Open the popup element.
85
- * @param {object} e
86
- */
87
- __publicField(this, "onOpen", (e) => {
88
- this.classList.add("active");
89
- this.syncAria();
90
- Promise.resolve(this.beforeShow(this)).then((res) => {
91
- if (!this.classList.contains("active")) {
92
- throw new Error("beforeShow method returned false or not string");
93
- }
94
- this.popup.show(true);
95
- this.syncPopupOwner();
96
- event.addListener(document, "wje-menu-item:click", null, __privateGet(this, _onMenuItemCustom), false);
97
- event.dispatchCustomEvent(this, "wje-dropdown:open", {
98
- bubbles: true,
99
- detail: { target: this }
100
- });
101
- Promise.resolve(this.afterShow(this));
102
- }).catch((error) => {
103
- this.classList.remove("active");
104
- this.popup.hide(true);
34
+ __publicField(this, "onOpen", (t2) => {
35
+ this.classList.add("active"), this.syncAria(), Promise.resolve(this.beforeShow(this)).then((t3) => {
36
+ if (!this.classList.contains("active")) throw new Error("beforeShow method returned false or not string");
37
+ this.popup.show(true), this.syncPopupOwner(), i.addListener(document, "wje-menu-item:click", null, __privateGet(this, _t), false), i.dispatchCustomEvent(this, "wje-dropdown:open", { bubbles: true, detail: { target: this } }), Promise.resolve(this.afterShow(this));
38
+ }).catch((t3) => {
39
+ this.classList.remove("active"), this.popup.hide(true);
105
40
  });
106
41
  });
107
42
  __publicField(this, "beforeClose", () => {
@@ -109,278 +44,116 @@ const _Dropdown = class _Dropdown extends WJElement {
109
44
  __publicField(this, "afterClose", () => {
110
45
  });
111
46
  __publicField(this, "onClose", () => {
112
- this.classList.remove("active");
113
- this.syncAria();
114
- Promise.resolve(this.beforeClose(this)).then((res) => {
115
- if (this.classList.contains("active")) {
116
- throw new Error("beforeShow method returned false or not string");
117
- }
118
- this.popup.hide(true);
119
- event.removeListener(document, "wje-menu-item:click", null, __privateGet(this, _onMenuItemCustom), false);
120
- event.dispatchCustomEvent(this, "wje-dropdown:close", {
121
- bubbles: true,
122
- detail: { target: this }
123
- });
124
- Promise.resolve(this.afterClose(this));
125
- }).catch((error) => {
126
- this.classList.add("active");
127
- this.popup.show(true);
47
+ this.classList.remove("active"), this.syncAria(), Promise.resolve(this.beforeClose(this)).then((t2) => {
48
+ if (this.classList.contains("active")) throw new Error("beforeShow method returned false or not string");
49
+ this.popup.hide(true), i.removeListener(document, "wje-menu-item:click", null, __privateGet(this, _t), false), i.dispatchCustomEvent(this, "wje-dropdown:close", { bubbles: true, detail: { target: this } }), Promise.resolve(this.afterClose(this));
50
+ }).catch((t2) => {
51
+ this.classList.add("active"), this.popup.show(true);
128
52
  });
129
53
  });
130
- __privateAdd(this, _onMenuItemCustom, (e) => {
131
- const path = typeof e.composedPath === "function" ? e.composedPath() : [];
132
- if (!this.popup || !this.popup.floatingEl || !path.includes(this.popup.floatingEl)) return;
133
- const item = path.find((n) => n && n.tagName === "WJE-MENU-ITEM");
134
- if (!item) return;
135
- const owner = this.getMenuItemOwner(path, item);
136
- if (owner && owner !== this) return;
137
- if (item.hasAttribute("disabled") || item.getAttribute("aria-disabled") === "true") return;
138
- if (item.hasAttribute("has-submenu")) return;
139
- this.classList.remove("active");
140
- this.popup.hide(true);
54
+ __privateAdd(this, _t, (t2) => {
55
+ const e2 = "function" == typeof t2.composedPath ? t2.composedPath() : [];
56
+ if (!this.popup || !this.popup.floatingEl || !e2.includes(this.popup.floatingEl)) return;
57
+ const i2 = e2.find((t3) => t3 && "WJE-MENU-ITEM" === t3.tagName);
58
+ if (!i2) return;
59
+ const s2 = this.getMenuItemOwner(e2, i2);
60
+ s2 && s2 !== this || i2.hasAttribute("disabled") || "true" === i2.getAttribute("aria-disabled") || i2.hasAttribute("has-submenu") || (this.classList.remove("active"), this.popup.hide(true));
141
61
  });
142
- this._instanceId = ++_Dropdown._instanceId;
62
+ this._instanceId = ++_s._instanceId;
143
63
  }
144
- /**
145
- * Sets or removes the 'portaled' attribute on the element.
146
- * When the value is truthy, the attribute 'portaled' is added to the element.
147
- * When the value is falsy, the attribute 'portaled' is removed from the element.
148
- * @param {boolean} value Determines whether to add or remove the 'portaled' attribute.
149
- */
150
- set portaled(value) {
151
- if (value) {
152
- this.setAttribute("portaled", value);
153
- } else {
154
- this.removeAttribute("portaled");
155
- }
64
+ set portaled(t2) {
65
+ t2 ? this.setAttribute("portaled", t2) : this.removeAttribute("portaled");
156
66
  }
157
- /**
158
- * Getter method for the `portaled` property.
159
- * Checks if the `portaled` attribute is present on the element.
160
- * @returns {boolean} Returns `true` if the `portaled` attribute exists, otherwise `false`.
161
- */
162
67
  get portaled() {
163
68
  return this.getAttribute("portaled") || "";
164
69
  }
165
- /**
166
- * Checks whether the element has the 'portaled' attribute.
167
- * @returns {boolean} True if the element has the 'portaled' attribute, otherwise false.
168
- */
169
70
  get isPortaled() {
170
71
  return this.hasAttribute("portaled");
171
72
  }
172
- /**
173
- * Sets the placement of the dropdown.
174
- * @param value
175
- */
176
- set trigger(value) {
177
- this.setAttribute("trigger", value);
73
+ set trigger(t2) {
74
+ this.setAttribute("trigger", t2);
178
75
  }
179
- /**
180
- * Gets the placement of the dropdown.
181
- * @returns {string|string}
182
- */
183
76
  get trigger() {
184
77
  return this.getAttribute("trigger") || "click";
185
78
  }
186
- set mobilePresentation(value) {
187
- if (value) {
188
- this.setAttribute("mobile-presentation", value);
189
- } else {
190
- this.removeAttribute("mobile-presentation");
191
- }
79
+ set mobilePresentation(t2) {
80
+ t2 ? this.setAttribute("mobile-presentation", t2) : this.removeAttribute("mobile-presentation");
192
81
  }
193
82
  get mobilePresentation() {
194
83
  return this.getAttribute("mobile-presentation");
195
84
  }
196
- set mobileBreakPoint(value) {
197
- if (value) {
198
- this.setAttribute("mobile-break-point", value);
199
- } else {
200
- this.removeAttribute("mobile-break-point");
201
- }
85
+ set mobileBreakPoint(t2) {
86
+ t2 ? this.setAttribute("mobile-break-point", t2) : this.removeAttribute("mobile-break-point");
202
87
  }
203
88
  get mobileBreakPoint() {
204
89
  return this.getAttribute("mobile-break-point") || "768";
205
90
  }
206
- /**
207
- * Getter for the CSS stylesheet.
208
- * @returns {string[]}
209
- */
210
91
  static get observedAttributes() {
211
92
  return ["active", "mobile-presentation", "mobile-break-point"];
212
93
  }
213
- /**
214
- * Sets up the attributes for the dropdown.
215
- */
216
94
  setupAttributes() {
217
95
  this.isShadowRoot = "open";
218
96
  }
219
- /**
220
- * Removes the popup element.
221
- */
222
97
  beforeDraw() {
223
98
  var _a;
224
- (_a = this.popup) == null ? void 0 : _a.remove();
225
- this.popup = null;
99
+ (_a = this.popup) == null ? void 0 : _a.remove(), this.popup = null;
226
100
  }
227
- /**
228
- * Draws the dropdown element and returns the created document fragment.
229
- * @returns {DocumentFragment}
230
- */
231
101
  draw() {
232
- let fragment = document.createDocumentFragment();
102
+ let t2 = document.createDocumentFragment();
233
103
  this.classList.add("wje-placement", "wje-" + this.placement || "wje-start");
234
- let native = document.createElement("div");
235
- native.setAttribute("part", "native");
236
- native.classList.add("native-dropdown");
237
- let tooltip = document.createElement("wje-tooltip");
238
- tooltip.setAttribute("content", this.tooltip);
239
- let anchorSlot = document.createElement("slot");
240
- anchorSlot.setAttribute("name", "trigger");
241
- anchorSlot.setAttribute("slot", "anchor");
242
- let slot = document.createElement("slot");
243
- let popup = document.createElement("wje-popup");
244
- popup.setAttribute("placement", this.placement);
245
- popup.setAttribute("offset", this.offset);
246
- popup.setAttribute("part", "popup");
247
- popup.setAttribute("exportparts", "native:popup-native, backdrop:backdrop");
248
- if (this.mobilePresentation) {
249
- popup.setAttribute("mobile-presentation", this.mobilePresentation);
250
- popup.setAttribute("mobile-break-point", this.mobileBreakPoint);
251
- }
252
- if (this.isPortaled) popup.setAttribute("portal", this.portaled);
253
- popup.append(anchorSlot, slot);
254
- popup.setAttribute("manual", "");
255
- native.appendChild(popup);
256
- fragment.appendChild(native);
257
- this.popup = popup;
258
- this.anchorSlot = anchorSlot;
259
- return fragment;
104
+ let e2 = document.createElement("div");
105
+ e2.setAttribute("part", "native"), e2.classList.add("native-dropdown"), document.createElement("wje-tooltip").setAttribute("content", this.tooltip);
106
+ let i2 = document.createElement("slot");
107
+ i2.setAttribute("name", "trigger"), i2.setAttribute("slot", "anchor");
108
+ let s2 = document.createElement("slot"), o = document.createElement("wje-popup");
109
+ return o.setAttribute("placement", this.placement), o.setAttribute("offset", this.offset), o.setAttribute("part", "popup"), o.setAttribute("exportparts", "native:popup-native, backdrop:backdrop"), this.mobilePresentation && (o.setAttribute("mobile-presentation", this.mobilePresentation), o.setAttribute("mobile-break-point", this.mobileBreakPoint)), this.isPortaled && o.setAttribute("portal", this.portaled), o.append(i2, s2), o.setAttribute("manual", ""), e2.appendChild(o), t2.appendChild(e2), this.popup = o, this.anchorSlot = i2, t2;
260
110
  }
261
- /**
262
- * Adds event listeners for the mouseenter and mouseleave events.
263
- */
264
111
  afterDraw() {
265
- this.syncPopupOwner();
266
- this.syncOwnedContentOwner();
267
- event.addListener(this, "wje-popup:hide", null, this.popupHideCallback);
268
- event.addListener(this.popup, "click", null, this.onMenuItemClick, { capture: true });
269
- if (this.trigger !== "click") {
270
- event.addListener(this, "mouseenter", null, this.onOpen);
271
- event.addListener(this, "mouseleave", null, this.onClose);
272
- } else {
273
- event.addListener(this.anchorSlot, "click", null, this.toggleCallback, { capture: true });
274
- }
275
- if (this.hasAttribute("collapsible")) {
276
- event.addListener(
277
- Array.from(this.querySelectorAll("wje-menu-item")),
278
- "click",
279
- "wje-menu-item:click",
280
- this.onClose
281
- );
282
- }
283
- this.onSlotChange = () => this.syncAria();
284
- this.anchorSlot.addEventListener("slotchange", this.onSlotChange);
285
- this.syncAria();
112
+ this.syncPopupOwner(), this.syncOwnedContentOwner(), i.addListener(this, "wje-popup:hide", null, this.popupHideCallback), i.addListener(this.popup, "click", null, this.onMenuItemClick, { capture: true }), "click" !== this.trigger ? (i.addListener(this, "mouseenter", null, this.onOpen), i.addListener(this, "mouseleave", null, this.onClose)) : i.addListener(this.anchorSlot, "click", null, this.toggleCallback, { capture: true }), this.hasAttribute("collapsible") && i.addListener(Array.from(this.querySelectorAll("wje-menu-item")), "click", "wje-menu-item:click", this.onClose), this.onSlotChange = () => this.syncAria(), this.anchorSlot.addEventListener("slotchange", this.onSlotChange), this.syncAria();
286
113
  }
287
- /**
288
- * Adds event listeners for the mouseenter and mouseleave events.
289
- */
290
114
  afterDisconnect() {
291
115
  var _a;
292
- event.removeListener(this, "mouseenter", null, this.onOpen);
293
- event.removeListener(this, "mouseleave", null, this.onClose);
294
- event.removeListener(this.anchorSlot, "click", null, this.toggleCallback, { capture: true });
295
- event.removeListener(this, "wje-popup:hide", null, this.popupHideCallback);
296
- event.removeListener(this.popup, "click", null, this.onMenuItemClick, { capture: true });
297
- event.removeListener(document, "wje-menu-item:click", null, __privateGet(this, _onMenuItemCustom), false);
298
- (_a = this.anchorSlot) == null ? void 0 : _a.removeEventListener("slotchange", this.onSlotChange);
116
+ i.removeListener(this, "mouseenter", null, this.onOpen), i.removeListener(this, "mouseleave", null, this.onClose), i.removeListener(this.anchorSlot, "click", null, this.toggleCallback, { capture: true }), i.removeListener(this, "wje-popup:hide", null, this.popupHideCallback), i.removeListener(this.popup, "click", null, this.onMenuItemClick, { capture: true }), i.removeListener(document, "wje-menu-item:click", null, __privateGet(this, _t), false), (_a = this.anchorSlot) == null ? void 0 : _a.removeEventListener("slotchange", this.onSlotChange);
299
117
  }
300
- /**
301
- * Assigns the current dropdown instance as the owner of its popup layers.
302
- * Owner metadata is later used to resolve which dropdown should react to
303
- * delegated menu-item clicks, including portaled popup content.
304
- */
305
118
  syncPopupOwner() {
306
- if (!this.popup) return;
307
- this.popup.ownerDropdown = this;
308
- if (this.popup.native) {
309
- this.popup.native.ownerDropdown = this;
310
- }
311
- if (this.popup.floatingEl) {
312
- this.popup.floatingEl.ownerDropdown = this;
313
- }
119
+ this.popup && (this.popup.ownerDropdown = this, this.popup.native && (this.popup.native.ownerDropdown = this), this.popup.floatingEl && (this.popup.floatingEl.ownerDropdown = this));
314
120
  }
315
- /**
316
- * Recursively assigns owner metadata to the dropdown content subtree while
317
- * leaving nested dropdown roots untouched, so each nested dropdown can keep
318
- * its own ownership boundary.
319
- * @param {HTMLElement} [root] The subtree root whose children should inherit this dropdown owner. Defaults to the current dropdown.
320
- */
321
- syncOwnedContentOwner(root = this) {
322
- const children = Array.from(root.children || []);
323
- for (const child of children) {
324
- if (child.tagName === "WJE-DROPDOWN" && child !== this) {
325
- continue;
326
- }
327
- child.ownerDropdown = this;
328
- this.syncOwnedContentOwner(child);
329
- }
121
+ syncOwnedContentOwner(t2 = this) {
122
+ const e2 = Array.from(t2.children || []);
123
+ for (const t3 of e2) "WJE-DROPDOWN" === t3.tagName && t3 !== this || (t3.ownerDropdown = this, this.syncOwnedContentOwner(t3));
330
124
  }
331
- /**
332
- * Resolves the dropdown that owns a clicked menu item. The lookup prefers
333
- * explicit owner metadata and falls back to DOM traversal so both regular
334
- * and portaled dropdown content can be scoped correctly.
335
- * @param {EventTarget[]} path The composed event path.
336
- * @param {HTMLElement} item The clicked menu item element.
337
- * @returns {HTMLElement|null} The owning dropdown element or null when it cannot be resolved.
338
- */
339
- getMenuItemOwner(path, item) {
125
+ getMenuItemOwner(t2, e2) {
340
126
  var _a;
341
- if (item == null ? void 0 : item.ownerDropdown) return item.ownerDropdown;
342
- if (item == null ? void 0 : item.closest) {
343
- const closestDropdown = item.closest("wje-dropdown");
344
- if (closestDropdown) return closestDropdown;
127
+ if (e2 == null ? void 0 : e2.ownerDropdown) return e2.ownerDropdown;
128
+ if (e2 == null ? void 0 : e2.closest) {
129
+ const t3 = e2.closest("wje-dropdown");
130
+ if (t3) return t3;
345
131
  }
346
- const ownerFromPath = (_a = path.find((node) => node == null ? void 0 : node.ownerDropdown)) == null ? void 0 : _a.ownerDropdown;
347
- if (ownerFromPath) return ownerFromPath;
348
- const dropdownFromPath = path.find((node) => (node == null ? void 0 : node.tagName) === "WJE-DROPDOWN");
349
- if (dropdownFromPath) return dropdownFromPath;
350
- return null;
132
+ const i2 = (_a = t2.find((t3) => t3 == null ? void 0 : t3.ownerDropdown)) == null ? void 0 : _a.ownerDropdown;
133
+ if (i2) return i2;
134
+ const s2 = t2.find((t3) => "WJE-DROPDOWN" === (t3 == null ? void 0 : t3.tagName));
135
+ return s2 || null;
351
136
  }
352
- /**
353
- * @summary Returns the content to be displayed before showing the dropdown.
354
- * @returns {any} The content to be displayed.
355
- */
356
137
  beforeShow() {
357
138
  return this.content;
358
139
  }
359
- /**
360
- * This method is called after the dropdown is shown.
361
- */
362
140
  afterShow() {
363
141
  }
364
- /**
365
- * Syncs ARIA attributes for the trigger element.
366
- */
367
142
  syncAria() {
368
143
  var _a, _b, _c, _d;
369
- const triggerEl = (_c = (_b = (_a = this.anchorSlot) == null ? void 0 : _a.assignedElements) == null ? void 0 : _b.call(_a, { flatten: true })) == null ? void 0 : _c[0];
370
- if (!triggerEl) return;
371
- const popupId = ((_d = this.popup) == null ? void 0 : _d.id) || `wje-dropdown-popup-${this._instanceId}`;
372
- if (this.popup && !this.popup.id) this.popup.id = popupId;
373
- const hasMenu = !!this.querySelector("wje-menu");
374
- triggerEl.setAttribute("aria-haspopup", hasMenu ? "menu" : "dialog");
375
- triggerEl.setAttribute("aria-expanded", this.classList.contains("active") ? "true" : "false");
376
- triggerEl.setAttribute("aria-controls", popupId);
144
+ const t2 = (_c = (_b = (_a = this.anchorSlot) == null ? void 0 : _a.assignedElements) == null ? void 0 : _b.call(_a, { flatten: true })) == null ? void 0 : _c[0];
145
+ if (!t2) return;
146
+ const e2 = ((_d = this.popup) == null ? void 0 : _d.id) || `wje-dropdown-popup-${this._instanceId}`;
147
+ this.popup && !this.popup.id && (this.popup.id = e2);
148
+ const i2 = !!this.querySelector("wje-menu");
149
+ t2.setAttribute("aria-haspopup", i2 ? "menu" : "dialog"), t2.setAttribute("aria-expanded", this.classList.contains("active") ? "true" : "false"), t2.setAttribute("aria-controls", e2);
377
150
  }
378
151
  };
379
- _onMenuItemCustom = new WeakMap();
380
- __publicField(_Dropdown, "_instanceId", 0);
381
- let Dropdown = _Dropdown;
382
- Dropdown.define("wje-dropdown", Dropdown);
152
+ _t = new WeakMap();
153
+ __publicField(_s, "_instanceId", 0);
154
+ let s = _s;
155
+ s.define("wje-dropdown", s);
383
156
  export {
384
- Dropdown as default
157
+ s as default
385
158
  };
386
159
  //# sourceMappingURL=wje-dropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wje-dropdown.js","sources":["../packages/wje-dropdown/dropdown.element.js","../packages/wje-dropdown/dropdown.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport Popup from '../wje-popup/popup.element.js';\n\n/**\n * `Dropdown` is a custom element that displays a dropdown menu.\n * @summary This element represents a dropdown menu.\n * @documentation https://elements.webjet.sk/components/dropdown\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the dropdown.\n * @csspart popup-native - The exported native popup panel part.\n * @csspart backdrop - The exported mobile bottom sheet backdrop part.\n * @slot trigger - The slot for the trigger of the dropdown.\n * @slot - The default slot for the dropdown.\n * @property {string} mobilePresentation - Enables a responsive presentation, currently \"bottom-sheet\".\n * @property {string} mobileBreakPoint - Viewport width where the mobile presentation becomes active. Defaults to \"768\".\n * @attribute {string} mobile-presentation - Enables a responsive presentation, currently \"bottom-sheet\".\n * @attribute {string} mobile-break-point - Viewport width where the mobile presentation becomes active. Defaults to \"768\".\n * // @fires wje-dropdown:open - Event fired when the dropdown is opened.\n * // @fires wje-dropdown:close - Event fired when the dropdown is closed.\n * @cssproperty [--wje-popup-backdrop-background=var(--wje-backdrop)] - Backdrop background used by mobile bottom sheet dropdowns.\n * @cssproperty [--wje-popup-backdrop-opacity=1] - Backdrop opacity used by mobile bottom sheet dropdowns.\n * @cssproperty [--wje-popup-mobile-background=var(--wje-select-options-background-color)] - Background of the mobile bottom sheet panel.\n * @cssproperty [--wje-popup-mobile-border-radius=var(--wje-border-radius-large) var(--wje-border-radius-large) 0 0] - Border radius of the mobile bottom sheet panel.\n * @cssproperty [--wje-popup-mobile-box-shadow=0 -8px 32px rgba(0, 0, 0, 0.16)] - Shadow of the mobile bottom sheet panel.\n * @cssproperty [--wje-popup-mobile-max-height=90vh] - Maximum height of the mobile bottom sheet panel.\n * @cssproperty [--wje-popup-mobile-transition-duration=250ms] - Transition duration for the mobile bottom sheet and backdrop.\n * @cssproperty [--wje-popup-mobile-transition-easing=ease] - Transition easing for the mobile bottom sheet and backdrop.\n * @tag wje-dropdown\n */\nexport default class Dropdown extends WJElement {\n static _instanceId = 0;\n /**\n * Creates an instance of Dropdown.\n * @class\n */\n constructor() {\n super();\n this._instanceId = ++Dropdown._instanceId;\n }\n\n /**\n * The placement of the dropdown.\n * @type {{\"wje-popup\": Popup}}\n */\n dependencies = {\n 'wje-popup': Popup,\n };\n\n /**\n * Sets or removes the 'portaled' attribute on the element.\n * When the value is truthy, the attribute 'portaled' is added to the element.\n * When the value is falsy, the attribute 'portaled' is removed from the element.\n * @param {boolean} value Determines whether to add or remove the 'portaled' attribute.\n */\n set portaled(value) {\n if (value) {\n this.setAttribute('portaled', value);\n } else {\n this.removeAttribute('portaled');\n }\n }\n\n /**\n * Getter method for the `portaled` property.\n * Checks if the `portaled` attribute is present on the element.\n * @returns {boolean} Returns `true` if the `portaled` attribute exists, otherwise `false`.\n */\n get portaled() {\n return this.getAttribute('portaled') || '';\n }\n\n /**\n * Checks whether the element has the 'portaled' attribute.\n * @returns {boolean} True if the element has the 'portaled' attribute, otherwise false.\n */\n get isPortaled() {\n return this.hasAttribute('portaled');\n }\n\n /**\n * Sets the placement of the dropdown.\n * @param value\n */\n set trigger(value) {\n this.setAttribute('trigger', value);\n }\n\n /**\n * Gets the placement of the dropdown.\n * @returns {string|string}\n */\n get trigger() {\n return this.getAttribute('trigger') || 'click';\n }\n\n set mobilePresentation(value) {\n if (value) {\n this.setAttribute('mobile-presentation', value);\n } else {\n this.removeAttribute('mobile-presentation');\n }\n }\n\n get mobilePresentation() {\n return this.getAttribute('mobile-presentation');\n }\n\n set mobileBreakPoint(value) {\n if (value) {\n this.setAttribute('mobile-break-point', value);\n } else {\n this.removeAttribute('mobile-break-point');\n }\n }\n\n get mobileBreakPoint() {\n return this.getAttribute('mobile-break-point') || '768';\n }\n\n /**\n * Sets the placement of the dropdown.\n * @type {string}\n */\n className = 'Dropdown';\n\n /**\n * Getter for the CSS stylesheet.\n * @returns {string[]}\n */\n static get observedAttributes() {\n return ['active', 'mobile-presentation', 'mobile-break-point'];\n }\n\n /**\n * Callback function to handle other dropdowns being opened. Close the dropdown if it is not the target and collapse is enabled.\n * @param {Event} e The event object.\n */\n otherDropdownOpennedCallback = (e) => {\n if (e.detail.detail.target !== this) {\n this.classList.remove('active');\n this.popup.hide();\n }\n };\n\n /**\n * Sets up the attributes for the dropdown.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Removes the popup element.\n */\n beforeDraw() {\n this.popup?.remove();\n this.popup = null;\n }\n\n /**\n * Draws the dropdown element and returns the created document fragment.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n this.classList.add('wje-placement', 'wje-' + this.placement || 'wje-start');\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-dropdown');\n\n let tooltip = document.createElement('wje-tooltip');\n tooltip.setAttribute('content', this.tooltip);\n\n let anchorSlot = document.createElement('slot');\n anchorSlot.setAttribute('name', 'trigger');\n anchorSlot.setAttribute('slot', 'anchor');\n\n let slot = document.createElement('slot');\n\n let popup = document.createElement('wje-popup');\n popup.setAttribute('placement', this.placement);\n popup.setAttribute('offset', this.offset);\n popup.setAttribute('part', 'popup');\n popup.setAttribute('exportparts', 'native:popup-native, backdrop:backdrop');\n\n if (this.mobilePresentation) {\n popup.setAttribute('mobile-presentation', this.mobilePresentation);\n popup.setAttribute('mobile-break-point', this.mobileBreakPoint);\n }\n\n if (this.isPortaled) popup.setAttribute('portal', this.portaled);\n\n popup.append(anchorSlot, slot);\n\n // if(this.trigger === \"click\")\n popup.setAttribute('manual', '');\n\n native.appendChild(popup);\n\n fragment.appendChild(native);\n\n this.popup = popup;\n this.anchorSlot = anchorSlot;\n\n return fragment;\n }\n\n /**\n * Adds event listeners for the mouseenter and mouseleave events.\n */\n afterDraw() {\n this.syncPopupOwner();\n this.syncOwnedContentOwner();\n\n event.addListener(this, 'wje-popup:hide', null, this.popupHideCallback);\n\n // Close when any actionable wje-menu-item inside the popup is clicked (works across Shadow DOM via composed path)\n event.addListener(this.popup, 'click', null, this.onMenuItemClick, { capture: true });\n\n if (this.trigger !== 'click') {\n event.addListener(this, 'mouseenter', null, this.onOpen);\n event.addListener(this, 'mouseleave', null, this.onClose);\n } else {\n event.addListener(this.anchorSlot, 'click', null, this.toggleCallback, { capture: true });\n }\n\n if (this.hasAttribute('collapsible')) {\n event.addListener(\n Array.from(this.querySelectorAll('wje-menu-item')),\n 'click',\n 'wje-menu-item:click',\n this.onClose\n );\n }\n\n this.onSlotChange = () => this.syncAria();\n this.anchorSlot.addEventListener('slotchange', this.onSlotChange);\n\n this.syncAria();\n }\n\n /**\n * Adds event listeners for the mouseenter and mouseleave events.\n */\n afterDisconnect() {\n event.removeListener(this, 'mouseenter', null, this.onOpen);\n event.removeListener(this, 'mouseleave', null, this.onClose);\n event.removeListener(this.anchorSlot, 'click', null, this.toggleCallback, { capture: true });\n event.removeListener(this, 'wje-popup:hide', null, this.popupHideCallback);\n event.removeListener(this.popup, 'click', null, this.onMenuItemClick, { capture: true });\n event.removeListener(document, 'wje-menu-item:click', null, this.#onMenuItemCustom, false);\n this.anchorSlot?.removeEventListener('slotchange', this.onSlotChange);\n }\n\n /**\n * Handles popup hide events and closes only the dropdown that owns the popup.\n * This prevents nested dropdowns from collapsing their parent dropdown when the\n * child popup is hidden.\n * @param {Event} e The popup hide event.\n */\n popupHideCallback = (e) => {\n if (this.classList.contains('active') && e.target === this) {\n this.toggleCallback(e);\n }\n };\n\n /**\n * Assigns the current dropdown instance as the owner of its popup layers.\n * Owner metadata is later used to resolve which dropdown should react to\n * delegated menu-item clicks, including portaled popup content.\n */\n syncPopupOwner() {\n if (!this.popup) return;\n\n this.popup.ownerDropdown = this;\n\n if (this.popup.native) {\n this.popup.native.ownerDropdown = this;\n }\n\n if (this.popup.floatingEl) {\n this.popup.floatingEl.ownerDropdown = this;\n }\n }\n\n /**\n * Recursively assigns owner metadata to the dropdown content subtree while\n * leaving nested dropdown roots untouched, so each nested dropdown can keep\n * its own ownership boundary.\n * @param {HTMLElement} [root] The subtree root whose children should inherit this dropdown owner. Defaults to the current dropdown.\n */\n syncOwnedContentOwner(root = this) {\n const children = Array.from(root.children || []);\n\n for (const child of children) {\n if (child.tagName === 'WJE-DROPDOWN' && child !== this) {\n continue;\n }\n\n child.ownerDropdown = this;\n this.syncOwnedContentOwner(child);\n }\n }\n\n /**\n * Resolves the dropdown that owns a clicked menu item. The lookup prefers\n * explicit owner metadata and falls back to DOM traversal so both regular\n * and portaled dropdown content can be scoped correctly.\n * @param {EventTarget[]} path The composed event path.\n * @param {HTMLElement} item The clicked menu item element.\n * @returns {HTMLElement|null} The owning dropdown element or null when it cannot be resolved.\n */\n getMenuItemOwner(path, item) {\n if (item?.ownerDropdown) return item.ownerDropdown;\n\n if (item?.closest) {\n const closestDropdown = item.closest('wje-dropdown');\n if (closestDropdown) return closestDropdown;\n }\n\n const ownerFromPath = path.find((node) => node?.ownerDropdown)?.ownerDropdown;\n if (ownerFromPath) return ownerFromPath;\n\n const dropdownFromPath = path.find((node) => node?.tagName === 'WJE-DROPDOWN');\n if (dropdownFromPath) return dropdownFromPath;\n\n return null;\n }\n\n /**\n * Handles delegated clicks from inside the popup and closes the dropdown when a leaf menu item is selected.\n * This works even when the menu is portaled, because we rely on the composed path.\n */\n onMenuItemClick = (e) => {\n // Find nearest wje-menu-item in the composed path\n const path = typeof e.composedPath === 'function' ? e.composedPath() : [];\n const item = path.find((n) => n && n.tagName === 'WJE-MENU-ITEM');\n if (!item) return;\n\n const owner = this.getMenuItemOwner(path, item);\n if (owner && owner !== this) return;\n\n // Ignore disabled items\n if (item.hasAttribute('disabled') || item.getAttribute('aria-disabled') === 'true') return;\n\n // If this item contains a nested submenu (wje-menu), it's not a leaf -> don't close yet\n if (typeof item.querySelector === 'function' && item.querySelector('wje-menu')) return;\n\n // Leaf item selected -> close dropdown (which calls popup.hide(true) inside onClose)\n this.onClose();\n };\n\n /**\n * @summary Toggles the dropdown element between active and inactive states.\n * Calls the `onOpen` method if the element is currently inactive,\n * and calls the `onClose` method if the element is currently active.\n * @param {Event} e The event object.\n */\n toggleCallback = (e) => {\n if (this.classList.contains('active')) {\n e.stopPropagation();\n this.onClose();\n } else {\n e.stopPropagation();\n this.onOpen(e);\n }\n };\n\n /**\n * @summary Returns the content to be displayed before showing the dropdown.\n * @returns {any} The content to be displayed.\n */\n beforeShow() {\n return this.content;\n }\n\n /**\n * This method is called after the dropdown is shown.\n */\n afterShow() {\n // Do nothing\n }\n\n /**\n * Open the popup element.\n * @param {object} e\n */\n onOpen = (e) => {\n this.classList.add('active');\n this.syncAria();\n Promise.resolve(this.beforeShow(this))\n .then((res) => {\n if (!this.classList.contains('active')) {\n throw new Error('beforeShow method returned false or not string');\n }\n\n this.popup.show(true); // Show tooltip\n this.syncPopupOwner();\n\n event.addListener(document, 'wje-menu-item:click', null, this.#onMenuItemCustom, false);\n\n event.dispatchCustomEvent(this, 'wje-dropdown:open', {\n bubbles: true,\n detail: { target: this },\n });\n\n Promise.resolve(this.afterShow(this));\n })\n .catch((error) => {\n // ak je nejaka chyba tak to len zatvorime\n this.classList.remove('active');\n this.popup.hide(true);\n });\n };\n\n beforeClose = () => {\n // Do nothing\n };\n\n afterClose = () => {\n // Do nothing\n };\n\n onClose = () => {\n this.classList.remove('active');\n this.syncAria();\n Promise.resolve(this.beforeClose(this))\n .then((res) => {\n if (this.classList.contains('active')) {\n throw new Error('beforeShow method returned false or not string');\n }\n\n this.popup.hide(true); // Show tooltip\n\n event.removeListener(document, 'wje-menu-item:click', null, this.#onMenuItemCustom, false);\n\n event.dispatchCustomEvent(this, 'wje-dropdown:close', {\n bubbles: true,\n detail: { target: this },\n });\n\n Promise.resolve(this.afterClose(this));\n })\n .catch((error) => {\n this.classList.add('active');\n this.popup.show(true);\n });\n };\n\n /**\n * Syncs ARIA attributes for the trigger element.\n */\n syncAria() {\n const triggerEl = this.anchorSlot?.assignedElements?.({ flatten: true })?.[0];\n if (!triggerEl) return;\n\n const popupId = this.popup?.id || `wje-dropdown-popup-${this._instanceId}`;\n if (this.popup && !this.popup.id) this.popup.id = popupId;\n\n const hasMenu = !!this.querySelector('wje-menu');\n triggerEl.setAttribute('aria-haspopup', hasMenu ? 'menu' : 'dialog');\n triggerEl.setAttribute('aria-expanded', this.classList.contains('active') ? 'true' : 'false');\n triggerEl.setAttribute('aria-controls', popupId);\n }\n\n #onMenuItemCustom = (e) => {\n const path = typeof e.composedPath === 'function' ? e.composedPath() : [];\n if (!this.popup || !this.popup.floatingEl || !path.includes(this.popup.floatingEl)) return;\n\n const item = path.find((n) => n && n.tagName === 'WJE-MENU-ITEM');\n if (!item) return;\n const owner = this.getMenuItemOwner(path, item);\n if (owner && owner !== this) return;\n if (item.hasAttribute('disabled') || item.getAttribute('aria-disabled') === 'true') return;\n if (item.hasAttribute('has-submenu')) return; // parent; nezatváraj\n\n // Zavri len tento dropdown. NEvolaj stopPropagation na custom evente,\n // aby fungovali aj tvoje app-level listenery (riadok 480).\n this.classList.remove('active');\n this.popup.hide(true);\n };\n}\n","import Dropdown from './dropdown.element.js';\n\nexport default Dropdown;\n\nDropdown.define('wje-dropdown', Dropdown);\n"],"names":[],"mappings":";;;;;;;;;;;;;AA8Be,MAAM,YAAN,MAAM,kBAAiB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5C,cAAc;AACV,UAAK;AAQT;AAAA;AAAA;AAAA;AAAA,wCAAe;AAAA,MACX,aAAa;AAAA,IACrB;AA6EI;AAAA;AAAA;AAAA;AAAA,qCAAY;AAcZ;AAAA;AAAA;AAAA;AAAA,wDAA+B,CAAC,MAAM;AAClC,UAAI,EAAE,OAAO,OAAO,WAAW,MAAM;AACjC,aAAK,UAAU,OAAO,QAAQ;AAC9B,aAAK,MAAM,KAAI;AAAA,MACnB;AAAA,IACJ;AAwHA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6CAAoB,CAAC,MAAM;AACvB,UAAI,KAAK,UAAU,SAAS,QAAQ,KAAK,EAAE,WAAW,MAAM;AACxD,aAAK,eAAe,CAAC;AAAA,MACzB;AAAA,IACJ;AAqEA;AAAA;AAAA;AAAA;AAAA,2CAAkB,CAAC,MAAM;AAErB,YAAM,OAAO,OAAO,EAAE,iBAAiB,aAAa,EAAE,aAAY,IAAK,CAAA;AACvE,YAAM,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,EAAE,YAAY,eAAe;AAChE,UAAI,CAAC,KAAM;AAEX,YAAM,QAAQ,KAAK,iBAAiB,MAAM,IAAI;AAC9C,UAAI,SAAS,UAAU,KAAM;AAG7B,UAAI,KAAK,aAAa,UAAU,KAAK,KAAK,aAAa,eAAe,MAAM,OAAQ;AAGpF,UAAI,OAAO,KAAK,kBAAkB,cAAc,KAAK,cAAc,UAAU,EAAG;AAGhF,WAAK,QAAO;AAAA,IAChB;AAQA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0CAAiB,CAAC,MAAM;AACpB,UAAI,KAAK,UAAU,SAA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6BAAM,cAAe,QAAO,KAAK;AAErC,QAAI,6BAAM,SAAS;AACf,YAAM,kBAAkB,KAAK,QAAQ,cAAc;AACnD,UAAI,gBAAiB,QAAO;AAAA,IAChC;AAEA,UAAM,iBAAgB,UAAK,KAAK,CAAC,SAAS,6BAAM,aAAa,MAAvC,mBAA0C;AAChE,QAAI,cAAe,QAAO;AAE1B,UAAM,mBAAmB,KAAK,KAAK,CAAC,UAAS,6BAAM,aAAY,cAAc;AAC7E,QAAI,iBAAkB,QAAO;AAE7B,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA,EA6CA,aAAa;AACT,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AAAA,EAEZ;AAAA;AAAA;AAAA;AAAA,EAuEA,WAAW;;AACP,UAAM,aAAY,sBAAK,eAAL,mBAAiB,qBAAjB,4BAAoC,EAAE,SAAS,YAA/C,mBAAyD;AAC3E,QAAI,CAAC,UAAW;AAEhB,UAAM,YAAU,UAAK,UAAL,mBAAY,OAAM,sBAAsB,KAAK,WAAW;AACxE,QAAI,KAAK,SAAS,CAAC,KAAK,MAAM,GAAI,MAAK,MAAM,KAAK;AAElD,UAAM,UAAU,CAAC,CAAC,KAAK,cAAc,UAAU;AAC/C,cAAU,aAAa,iBAAiB,UAAU,SAAS,QAAQ;AACnE,cAAU,aAAa,iBAAiB,KAAK,UAAU,SAAS,QAAQ,IAAI,SAAS,OAAO;AAC5F,cAAU,aAAa,iBAAiB,OAAO;AAAA,EACnD;AAkBJ;AAhBI;AArbA,cADiB,WACV,eAAc;AADV,IAAM,WAAN;AC1Bf,SAAS,OAAO,gBAAgB,QAAQ;"}
1
+ {"version":3,"file":"wje-dropdown.js","sources":["../packages/wje-dropdown/dropdown.element.js","../packages/wje-dropdown/dropdown.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport Popup from '../wje-popup/popup.element.js';\n\n/**\n * `Dropdown` is a custom element that displays a dropdown menu.\n * @summary This element represents a dropdown menu.\n * @documentation https://elements.webjet.sk/components/dropdown\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the dropdown.\n * @csspart popup-native - The exported native popup panel part.\n * @csspart backdrop - The exported mobile bottom sheet backdrop part.\n * @slot trigger - The slot for the trigger of the dropdown.\n * @slot - The default slot for the dropdown.\n * @property {string} mobilePresentation - Enables a responsive presentation, currently \"bottom-sheet\".\n * @property {string} mobileBreakPoint - Viewport width where the mobile presentation becomes active. Defaults to \"768\".\n * @attribute {string} mobile-presentation - Enables a responsive presentation, currently \"bottom-sheet\".\n * @attribute {string} mobile-break-point - Viewport width where the mobile presentation becomes active. Defaults to \"768\".\n * // @fires wje-dropdown:open - Event fired when the dropdown is opened.\n * // @fires wje-dropdown:close - Event fired when the dropdown is closed.\n * @cssproperty [--wje-popup-backdrop-background=var(--wje-backdrop)] - Backdrop background used by mobile bottom sheet dropdowns.\n * @cssproperty [--wje-popup-backdrop-opacity=1] - Backdrop opacity used by mobile bottom sheet dropdowns.\n * @cssproperty [--wje-popup-mobile-background=var(--wje-select-options-background-color)] - Background of the mobile bottom sheet panel.\n * @cssproperty [--wje-popup-mobile-border-radius=var(--wje-border-radius-large) var(--wje-border-radius-large) 0 0] - Border radius of the mobile bottom sheet panel.\n * @cssproperty [--wje-popup-mobile-box-shadow=0 -8px 32px rgba(0, 0, 0, 0.16)] - Shadow of the mobile bottom sheet panel.\n * @cssproperty [--wje-popup-mobile-max-height=90vh] - Maximum height of the mobile bottom sheet panel.\n * @cssproperty [--wje-popup-mobile-transition-duration=250ms] - Transition duration for the mobile bottom sheet and backdrop.\n * @cssproperty [--wje-popup-mobile-transition-easing=ease] - Transition easing for the mobile bottom sheet and backdrop.\n * @tag wje-dropdown\n */\nexport default class Dropdown extends WJElement {\n static _instanceId = 0;\n /**\n * Creates an instance of Dropdown.\n * @class\n */\n constructor() {\n super();\n this._instanceId = ++Dropdown._instanceId;\n }\n\n /**\n * The placement of the dropdown.\n * @type {{\"wje-popup\": Popup}}\n */\n dependencies = {\n 'wje-popup': Popup,\n };\n\n /**\n * Sets or removes the 'portaled' attribute on the element.\n * When the value is truthy, the attribute 'portaled' is added to the element.\n * When the value is falsy, the attribute 'portaled' is removed from the element.\n * @param {boolean} value Determines whether to add or remove the 'portaled' attribute.\n */\n set portaled(value) {\n if (value) {\n this.setAttribute('portaled', value);\n } else {\n this.removeAttribute('portaled');\n }\n }\n\n /**\n * Getter method for the `portaled` property.\n * Checks if the `portaled` attribute is present on the element.\n * @returns {boolean} Returns `true` if the `portaled` attribute exists, otherwise `false`.\n */\n get portaled() {\n return this.getAttribute('portaled') || '';\n }\n\n /**\n * Checks whether the element has the 'portaled' attribute.\n * @returns {boolean} True if the element has the 'portaled' attribute, otherwise false.\n */\n get isPortaled() {\n return this.hasAttribute('portaled');\n }\n\n /**\n * Sets the placement of the dropdown.\n * @param value\n */\n set trigger(value) {\n this.setAttribute('trigger', value);\n }\n\n /**\n * Gets the placement of the dropdown.\n * @returns {string|string}\n */\n get trigger() {\n return this.getAttribute('trigger') || 'click';\n }\n\n set mobilePresentation(value) {\n if (value) {\n this.setAttribute('mobile-presentation', value);\n } else {\n this.removeAttribute('mobile-presentation');\n }\n }\n\n get mobilePresentation() {\n return this.getAttribute('mobile-presentation');\n }\n\n set mobileBreakPoint(value) {\n if (value) {\n this.setAttribute('mobile-break-point', value);\n } else {\n this.removeAttribute('mobile-break-point');\n }\n }\n\n get mobileBreakPoint() {\n return this.getAttribute('mobile-break-point') || '768';\n }\n\n /**\n * Sets the placement of the dropdown.\n * @type {string}\n */\n className = 'Dropdown';\n\n /**\n * Getter for the CSS stylesheet.\n * @returns {string[]}\n */\n static get observedAttributes() {\n return ['active', 'mobile-presentation', 'mobile-break-point'];\n }\n\n /**\n * Callback function to handle other dropdowns being opened. Close the dropdown if it is not the target and collapse is enabled.\n * @param {Event} e The event object.\n */\n otherDropdownOpennedCallback = (e) => {\n if (e.detail.detail.target !== this) {\n this.classList.remove('active');\n this.popup.hide();\n }\n };\n\n /**\n * Sets up the attributes for the dropdown.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Removes the popup element.\n */\n beforeDraw() {\n this.popup?.remove();\n this.popup = null;\n }\n\n /**\n * Draws the dropdown element and returns the created document fragment.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n this.classList.add('wje-placement', 'wje-' + this.placement || 'wje-start');\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-dropdown');\n\n let tooltip = document.createElement('wje-tooltip');\n tooltip.setAttribute('content', this.tooltip);\n\n let anchorSlot = document.createElement('slot');\n anchorSlot.setAttribute('name', 'trigger');\n anchorSlot.setAttribute('slot', 'anchor');\n\n let slot = document.createElement('slot');\n\n let popup = document.createElement('wje-popup');\n popup.setAttribute('placement', this.placement);\n popup.setAttribute('offset', this.offset);\n popup.setAttribute('part', 'popup');\n popup.setAttribute('exportparts', 'native:popup-native, backdrop:backdrop');\n\n if (this.mobilePresentation) {\n popup.setAttribute('mobile-presentation', this.mobilePresentation);\n popup.setAttribute('mobile-break-point', this.mobileBreakPoint);\n }\n\n if (this.isPortaled) popup.setAttribute('portal', this.portaled);\n\n popup.append(anchorSlot, slot);\n\n // if(this.trigger === \"click\")\n popup.setAttribute('manual', '');\n\n native.appendChild(popup);\n\n fragment.appendChild(native);\n\n this.popup = popup;\n this.anchorSlot = anchorSlot;\n\n return fragment;\n }\n\n /**\n * Adds event listeners for the mouseenter and mouseleave events.\n */\n afterDraw() {\n this.syncPopupOwner();\n this.syncOwnedContentOwner();\n\n event.addListener(this, 'wje-popup:hide', null, this.popupHideCallback);\n\n // Close when any actionable wje-menu-item inside the popup is clicked (works across Shadow DOM via composed path)\n event.addListener(this.popup, 'click', null, this.onMenuItemClick, { capture: true });\n\n if (this.trigger !== 'click') {\n event.addListener(this, 'mouseenter', null, this.onOpen);\n event.addListener(this, 'mouseleave', null, this.onClose);\n } else {\n event.addListener(this.anchorSlot, 'click', null, this.toggleCallback, { capture: true });\n }\n\n if (this.hasAttribute('collapsible')) {\n event.addListener(\n Array.from(this.querySelectorAll('wje-menu-item')),\n 'click',\n 'wje-menu-item:click',\n this.onClose\n );\n }\n\n this.onSlotChange = () => this.syncAria();\n this.anchorSlot.addEventListener('slotchange', this.onSlotChange);\n\n this.syncAria();\n }\n\n /**\n * Adds event listeners for the mouseenter and mouseleave events.\n */\n afterDisconnect() {\n event.removeListener(this, 'mouseenter', null, this.onOpen);\n event.removeListener(this, 'mouseleave', null, this.onClose);\n event.removeListener(this.anchorSlot, 'click', null, this.toggleCallback, { capture: true });\n event.removeListener(this, 'wje-popup:hide', null, this.popupHideCallback);\n event.removeListener(this.popup, 'click', null, this.onMenuItemClick, { capture: true });\n event.removeListener(document, 'wje-menu-item:click', null, this.#onMenuItemCustom, false);\n this.anchorSlot?.removeEventListener('slotchange', this.onSlotChange);\n }\n\n /**\n * Handles popup hide events and closes only the dropdown that owns the popup.\n * This prevents nested dropdowns from collapsing their parent dropdown when the\n * child popup is hidden.\n * @param {Event} e The popup hide event.\n */\n popupHideCallback = (e) => {\n if (this.classList.contains('active') && e.target === this) {\n this.toggleCallback(e);\n }\n };\n\n /**\n * Assigns the current dropdown instance as the owner of its popup layers.\n * Owner metadata is later used to resolve which dropdown should react to\n * delegated menu-item clicks, including portaled popup content.\n */\n syncPopupOwner() {\n if (!this.popup) return;\n\n this.popup.ownerDropdown = this;\n\n if (this.popup.native) {\n this.popup.native.ownerDropdown = this;\n }\n\n if (this.popup.floatingEl) {\n this.popup.floatingEl.ownerDropdown = this;\n }\n }\n\n /**\n * Recursively assigns owner metadata to the dropdown content subtree while\n * leaving nested dropdown roots untouched, so each nested dropdown can keep\n * its own ownership boundary.\n * @param {HTMLElement} [root] The subtree root whose children should inherit this dropdown owner. Defaults to the current dropdown.\n */\n syncOwnedContentOwner(root = this) {\n const children = Array.from(root.children || []);\n\n for (const child of children) {\n if (child.tagName === 'WJE-DROPDOWN' && child !== this) {\n continue;\n }\n\n child.ownerDropdown = this;\n this.syncOwnedContentOwner(child);\n }\n }\n\n /**\n * Resolves the dropdown that owns a clicked menu item. The lookup prefers\n * explicit owner metadata and falls back to DOM traversal so both regular\n * and portaled dropdown content can be scoped correctly.\n * @param {EventTarget[]} path The composed event path.\n * @param {HTMLElement} item The clicked menu item element.\n * @returns {HTMLElement|null} The owning dropdown element or null when it cannot be resolved.\n */\n getMenuItemOwner(path, item) {\n if (item?.ownerDropdown) return item.ownerDropdown;\n\n if (item?.closest) {\n const closestDropdown = item.closest('wje-dropdown');\n if (closestDropdown) return closestDropdown;\n }\n\n const ownerFromPath = path.find((node) => node?.ownerDropdown)?.ownerDropdown;\n if (ownerFromPath) return ownerFromPath;\n\n const dropdownFromPath = path.find((node) => node?.tagName === 'WJE-DROPDOWN');\n if (dropdownFromPath) return dropdownFromPath;\n\n return null;\n }\n\n /**\n * Handles delegated clicks from inside the popup and closes the dropdown when a leaf menu item is selected.\n * This works even when the menu is portaled, because we rely on the composed path.\n */\n onMenuItemClick = (e) => {\n // Find nearest wje-menu-item in the composed path\n const path = typeof e.composedPath === 'function' ? e.composedPath() : [];\n const item = path.find((n) => n && n.tagName === 'WJE-MENU-ITEM');\n if (!item) return;\n\n const owner = this.getMenuItemOwner(path, item);\n if (owner && owner !== this) return;\n\n // Ignore disabled items\n if (item.hasAttribute('disabled') || item.getAttribute('aria-disabled') === 'true') return;\n\n // If this item contains a nested submenu (wje-menu), it's not a leaf -> don't close yet\n if (typeof item.querySelector === 'function' && item.querySelector('wje-menu')) return;\n\n // Leaf item selected -> close dropdown (which calls popup.hide(true) inside onClose)\n this.onClose();\n };\n\n /**\n * @summary Toggles the dropdown element between active and inactive states.\n * Calls the `onOpen` method if the element is currently inactive,\n * and calls the `onClose` method if the element is currently active.\n * @param {Event} e The event object.\n */\n toggleCallback = (e) => {\n if (this.classList.contains('active')) {\n e.stopPropagation();\n this.onClose();\n } else {\n e.stopPropagation();\n this.onOpen(e);\n }\n };\n\n /**\n * @summary Returns the content to be displayed before showing the dropdown.\n * @returns {any} The content to be displayed.\n */\n beforeShow() {\n return this.content;\n }\n\n /**\n * This method is called after the dropdown is shown.\n */\n afterShow() {\n // Do nothing\n }\n\n /**\n * Open the popup element.\n * @param {object} e\n */\n onOpen = (e) => {\n this.classList.add('active');\n this.syncAria();\n Promise.resolve(this.beforeShow(this))\n .then((res) => {\n if (!this.classList.contains('active')) {\n throw new Error('beforeShow method returned false or not string');\n }\n\n this.popup.show(true); // Show tooltip\n this.syncPopupOwner();\n\n event.addListener(document, 'wje-menu-item:click', null, this.#onMenuItemCustom, false);\n\n event.dispatchCustomEvent(this, 'wje-dropdown:open', {\n bubbles: true,\n detail: { target: this },\n });\n\n Promise.resolve(this.afterShow(this));\n })\n .catch((error) => {\n // ak je nejaka chyba tak to len zatvorime\n this.classList.remove('active');\n this.popup.hide(true);\n });\n };\n\n beforeClose = () => {\n // Do nothing\n };\n\n afterClose = () => {\n // Do nothing\n };\n\n onClose = () => {\n this.classList.remove('active');\n this.syncAria();\n Promise.resolve(this.beforeClose(this))\n .then((res) => {\n if (this.classList.contains('active')) {\n throw new Error('beforeShow method returned false or not string');\n }\n\n this.popup.hide(true); // Show tooltip\n\n event.removeListener(document, 'wje-menu-item:click', null, this.#onMenuItemCustom, false);\n\n event.dispatchCustomEvent(this, 'wje-dropdown:close', {\n bubbles: true,\n detail: { target: this },\n });\n\n Promise.resolve(this.afterClose(this));\n })\n .catch((error) => {\n this.classList.add('active');\n this.popup.show(true);\n });\n };\n\n /**\n * Syncs ARIA attributes for the trigger element.\n */\n syncAria() {\n const triggerEl = this.anchorSlot?.assignedElements?.({ flatten: true })?.[0];\n if (!triggerEl) return;\n\n const popupId = this.popup?.id || `wje-dropdown-popup-${this._instanceId}`;\n if (this.popup && !this.popup.id) this.popup.id = popupId;\n\n const hasMenu = !!this.querySelector('wje-menu');\n triggerEl.setAttribute('aria-haspopup', hasMenu ? 'menu' : 'dialog');\n triggerEl.setAttribute('aria-expanded', this.classList.contains('active') ? 'true' : 'false');\n triggerEl.setAttribute('aria-controls', popupId);\n }\n\n #onMenuItemCustom = (e) => {\n const path = typeof e.composedPath === 'function' ? e.composedPath() : [];\n if (!this.popup || !this.popup.floatingEl || !path.includes(this.popup.floatingEl)) return;\n\n const item = path.find((n) => n && n.tagName === 'WJE-MENU-ITEM');\n if (!item) return;\n const owner = this.getMenuItemOwner(path, item);\n if (owner && owner !== this) return;\n if (item.hasAttribute('disabled') || item.getAttribute('aria-disabled') === 'true') return;\n if (item.hasAttribute('has-submenu')) return; // parent; nezatváraj\n\n // Zavri len tento dropdown. NEvolaj stopPropagation na custom evente,\n // aby fungovali aj tvoje app-level listenery (riadok 480).\n this.classList.remove('active');\n this.popup.hide(true);\n };\n}\n","import Dropdown from './dropdown.element.js';\n\nexport default Dropdown;\n\nDropdown.define('wje-dropdown', Dropdown);\n"],"names":["Dropdown","WJElement","super","dependencies","Popup","className","otherDropdownOpennedCallback","e","detail","target","this","classList","remove","popup","hide","popupHideCallback","contains","toggleCallback","onMenuItemClick","path","composedPath","item","find","n","tagName","owner","getMenuItemOwner","hasAttribute","getAttribute","querySelector","onClose","stopPropagation","onOpen","add","syncAria","Promise","resolve","beforeShow","then","res","Error","show","syncPopupOwner","event","addListener","document","dispatchCustomEvent","bubbles","afterShow","catch","error","beforeClose","afterClose","removeListener","onMenuItemCustom","floatingEl","includes","_instanceId","value","setAttribute","removeAttribute","portaled","trigger","mobilePresentation","mobileBreakPoint","observedAttributes","setupAttributes","isShadowRoot","beforeDraw","fragment","createDocumentFragment","placement","native","createElement","tooltip","anchorSlot","slot","offset","isPortaled","append","appendChild","afterDraw","syncOwnedContentOwner","capture","Array","from","querySelectorAll","onSlotChange","addEventListener","afterDisconnect","removeEventListener","ownerDropdown","root","children","child","closest","closestDropdown","ownerFromPath","node","dropdownFromPath","content","triggerEl","assignedElements","flatten","popupId","id","hasMenu","static","define"],"mappings":";;;;;;;;;;;;;AA8Be,MAAMA,KA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