wj-elements 0.1.128 → 0.1.130

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 (105) hide show
  1. package/README.md +8 -4
  2. package/dist/assets/tags.json +3252 -22012
  3. package/dist/dark.css +211 -203
  4. package/dist/{infinite-scroll.element-DcO1E5Es.js → infinite-scroll.element-BmojLp3Z.js} +54 -44
  5. package/dist/light.css +511 -496
  6. package/dist/{list.element-TZXMx1rt.js → list.element-Ce1vIm1O.js} +3 -9
  7. package/dist/localize.js +4 -4
  8. package/dist/{popup.element-l8v-dMoK.js → popup.element-4DNn6DjX.js} +44 -53
  9. package/dist/{router-links-I2vcmVCs.js → router-links-CJnOdbas.js} +30 -77
  10. package/dist/styles.css +485 -473
  11. package/dist/wje-accordion-item.js +13 -11
  12. package/dist/wje-accordion.js +51 -14
  13. package/dist/wje-animation.js +149 -25
  14. package/dist/wje-aside.js +7 -12
  15. package/dist/wje-avatar.js +12 -15
  16. package/dist/wje-badge.js +24 -19
  17. package/dist/wje-breadcrumb.js +36 -44
  18. package/dist/wje-breadcrumbs.js +84 -27
  19. package/dist/wje-button-group.js +17 -23
  20. package/dist/wje-button.js +117 -66
  21. package/dist/wje-card-content.js +10 -13
  22. package/dist/wje-card-controls.js +10 -13
  23. package/dist/wje-card-header.js +5 -9
  24. package/dist/wje-card-subtitle.js +5 -8
  25. package/dist/wje-card-title.js +5 -8
  26. package/dist/wje-card.js +13 -14
  27. package/dist/wje-carousel-item.js +26 -1
  28. package/dist/wje-carousel.js +141 -24
  29. package/dist/wje-checkbox.js +300 -51
  30. package/dist/wje-chip.js +31 -12
  31. package/dist/wje-col.js +11 -15
  32. package/dist/wje-color-picker.js +92 -64
  33. package/dist/wje-container.js +6 -10
  34. package/dist/wje-copy-button.js +14 -18
  35. package/dist/wje-dialog.js +89 -5
  36. package/dist/wje-divider.js +2 -5
  37. package/dist/wje-dropdown.js +57 -24
  38. package/dist/wje-element.js +393 -218
  39. package/dist/wje-fetchAndParseCSS.js +2 -1
  40. package/dist/wje-file-upload-item.js +12 -19
  41. package/dist/wje-file-upload.js +117 -68
  42. package/dist/wje-footer.js +3 -10
  43. package/dist/wje-form.js +23 -1
  44. package/dist/wje-format-digital.js +5 -13
  45. package/dist/wje-grid.js +24 -3
  46. package/dist/wje-header.js +3 -10
  47. package/dist/wje-icon-picker.js +15 -31
  48. package/dist/wje-icon.js +10 -10
  49. package/dist/wje-img-comparer.js +8 -18
  50. package/dist/wje-img.js +5 -11
  51. package/dist/wje-infinite-scroll.js +1 -1
  52. package/dist/wje-input-file.js +20 -17
  53. package/dist/wje-input.js +51 -62
  54. package/dist/wje-item.js +31 -4
  55. package/dist/wje-kanban.js +37 -53
  56. package/dist/wje-label.js +4 -21
  57. package/dist/wje-list.js +1 -1
  58. package/dist/wje-main.js +4 -11
  59. package/dist/wje-masonry.js +21 -26
  60. package/dist/wje-master.js +201 -348
  61. package/dist/wje-menu-button.js +5 -13
  62. package/dist/wje-menu-item.js +211 -30
  63. package/dist/wje-menu-label.js +4 -11
  64. package/dist/wje-menu.js +6 -15
  65. package/dist/wje-option.js +19 -26
  66. package/dist/wje-options.js +148 -48
  67. package/dist/wje-orgchart-group.js +10 -17
  68. package/dist/wje-orgchart-item.js +13 -157
  69. package/dist/wje-orgchart.js +4 -10
  70. package/dist/wje-popup.js +1 -1
  71. package/dist/wje-progress-bar.js +17 -27
  72. package/dist/wje-qr-code.js +29 -13
  73. package/dist/wje-radio-group.js +21 -43
  74. package/dist/wje-radio.js +46 -8
  75. package/dist/wje-rate.js +38 -58
  76. package/dist/wje-relative-time.js +51 -43
  77. package/dist/wje-reorder-dropzone.js +20 -2
  78. package/dist/wje-reorder-handle.js +62 -3
  79. package/dist/wje-reorder-item.js +20 -2
  80. package/dist/wje-reorder.js +93 -36
  81. package/dist/wje-route.js +3 -9
  82. package/dist/wje-router-link.js +10 -14
  83. package/dist/wje-router-outlet.js +35 -37
  84. package/dist/wje-routerx.js +231 -338
  85. package/dist/wje-row.js +8 -20
  86. package/dist/wje-select.js +80 -104
  87. package/dist/wje-slider.js +17 -33
  88. package/dist/wje-sliding-container.js +127 -55
  89. package/dist/wje-split-view.js +15 -21
  90. package/dist/wje-status.js +9 -13
  91. package/dist/wje-step.js +18 -0
  92. package/dist/wje-stepper.js +65 -4734
  93. package/dist/wje-store.js +193 -90
  94. package/dist/wje-tab-group.js +7 -16
  95. package/dist/wje-tab-panel.js +4 -13
  96. package/dist/wje-tab.js +6 -14
  97. package/dist/wje-textarea.js +128 -42
  98. package/dist/wje-thumbnail.js +10 -23
  99. package/dist/wje-toast.js +38 -74
  100. package/dist/wje-toggle.js +24 -29
  101. package/dist/wje-toolbar-action.js +11 -15
  102. package/dist/wje-toolbar.js +11 -16
  103. package/dist/wje-tooltip.js +35 -23
  104. package/dist/wje-visually-hidden.js +10 -14
  105. package/package.json +22 -4
@@ -2,12 +2,11 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import WJElement, { event } from "./wje-element.js";
5
- const styles = "/*\n[ WJ Menu Label ]\n*/\n\n:host {\n display: inline-flex;\n}\n@media (min-width: 768px) {\n :host {\n display: none;\n }\n}";
5
+ const styles = "/*\n[ WJ Menu Label ]\n*/\n\n:host {\n display: inline-flex;\n}\n@media (min-width: 768px) {\n :host {\n display: none;\n }\n}\n";
6
6
  class MenuButton extends WJElement {
7
7
  /**
8
8
  * Creates an instance of MenuButton.
9
- *
10
- * @constructor
9
+ * @class
11
10
  */
12
11
  constructor() {
13
12
  super();
@@ -15,7 +14,6 @@ class MenuButton extends WJElement {
15
14
  }
16
15
  /**
17
16
  * Returns the CSS styles for the component.
18
- *
19
17
  * @static
20
18
  * @returns {CSSStyleSheet}
21
19
  */
@@ -24,7 +22,6 @@ class MenuButton extends WJElement {
24
22
  }
25
23
  /**
26
24
  * Returns the list of attributes to observe for changes.
27
- *
28
25
  * @static
29
26
  * @returns {Array<string>}
30
27
  */
@@ -38,22 +35,17 @@ class MenuButton extends WJElement {
38
35
  this.isShadowRoot = "open";
39
36
  }
40
37
  /**
41
- * Draws the component.
42
- *
43
- * @param {Object} context - The context for drawing.
44
- * @param {Object} store - The store for drawing.
45
- * @param {Object} params - The parameters for drawing.
38
+ * Draws the component for the menu button.
46
39
  * @returns {DocumentFragment}
47
40
  */
48
- draw(context, store, params) {
41
+ draw() {
49
42
  let fragment = document.createDocumentFragment();
50
43
  let slot = document.createElement("slot");
51
44
  fragment.appendChild(slot);
52
45
  return fragment;
53
46
  }
54
47
  /**
55
- * Refreshes the component after drawing.
56
- * Adds a click event listener that toggles the "open" class on the content element.
48
+ * Refreshes the component after drawing. Adds a click event listener that toggles the "open" class on the content element.
57
49
  */
58
50
  afterDraw() {
59
51
  event.addListener(this, "click", null, (e) => {
@@ -1,13 +1,190 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { b as bindRouterLinks } from "./router-links-CJnOdbas.js";
4
5
  import WJElement, { WjElementUtils, event } from "./wje-element.js";
5
- import { b as bindRouterLinks } from "./router-links-I2vcmVCs.js";
6
- const styles = '/*\n[ WJ Menu Item ]\n*/\n\n:host {\n --wje-menu-item-safe-triangle-cursor-x: 0;\n --wje-menu-item-safe-triangle-cursor-y: 0;\n --wje-menu-item-safe-triangle-submenu-start-x: 0;\n --wje-menu-item-safe-triangle-submenu-start-y: 0;\n --wje-menu-item-safe-triangle-submenu-end-x: 0;\n --wje-menu-item-safe-triangle-submenu-end-y: 0;\n\n display: block;\n .native-menu-item {\n background: var(--wje-menu-item-background);\n position: relative;\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n justify-content: center;\n color: var(--wje-menu-item-color);\n padding-top: var(--wje-menu-item-padding-top);\n padding-bottom: var(--wje-menu-item-padding-bottom);\n transition: var(--wje-transition-fast) fill;\n user-select: none;\n white-space: nowrap;\n cursor: pointer;\n width: 100%;\n\n &:hover {\n color: var(--wje-menu-item-color-hover);\n background: var(--wje-menu-item-background-hover);\n }\n\n &:focus {\n color: var(--wje-menu-item-color-focus);\n background: var(--wje-menu-item-background-focus);\n }\n\n &:active {\n color: var(--wje-menu-item-color-active);\n background: var(--wje-menu-item-background-active);\n }\n\n .label {\n flex: 1 1 auto;\n display: inline-block;\n text-overflow: ellipsis;\n overflow: hidden;\n line-height: normal;\n }\n\n .check-icon {\n flex: 0 0 auto;\n display: var(--wje-menu-item-check-icon-display, flex);\n align-items: center;\n justify-content: center;\n width: var(--wje-menu-item-check-icon-width, 1.5rem);\n visibility: hidden;\n\n &.checked {\n visibility: visible;\n }\n }\n\n &.expanded-submenu {\n color: var(--wje-menu-item-color-active);\n background: var(--wje-menu-item-background-active);\n\n &:hover {\n color: var(--wje-menu-item-color-hover);\n background: var(--wje-menu-item-background-hover);\n }\n\n &::after {\n content: "";\n position: fixed;\n z-index: 1;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n clip-path: polygon(\n var(--wje-menu-item-safe-triangle-cursor-x) var(--wje-menu-item-safe-triangle-cursor-y),\n var(--wje-menu-item-safe-triangle-submenu-start-x) var(--wje-menu-item-safe-triangle-submenu-start-y),\n var(--wje-menu-item-safe-triangle-submenu-end-x) var(--wje-menu-item-safe-triangle-submenu-end-y)\n );\n }\n }\n }\n}\n\n:host(.collapse) {\n\n ::slotted([slot="start"]) {\n margin: 0;\n /*width: auto;*/\n /*display: contents;*/\n }\n\n ::slotted([slot="end"]) {\n display: none;\n }\n\n .label,\n .check-icon,\n .submenu-icon {\n display: none;\n }\n\n}\n.submenu-icon {\n --wje-icon-size: 14px !important;\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 1.5rem;\n visibility: var(--wje-menu-item-icon-visibility);\n}\n\n.has-submenu {\n .submenu-icon {\n --wje-menu-item-icon-visibility: visible;\n }\n}\n\n.submenu-icon.collapse {\n flex: none;\n /*right: 10px;*/\n position: relative;\n}\n\n:host(:focus-visible) {\n outline: none;\n}\n\n::slotted([slot="start"]) {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n margin-inline-end: .5rem;\n}\n\n::slotted([slot="end"]) {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n margin-inline-start: .5rem;\n}\n\n:host(.wje-menu-variant-nav) {\n /*posun 2 a x urovne o 1 rem*/\n ::slotted([slot="submenu"]) {\n --wje-menu-border-width: 0 !important;\n --wje-menu-margin-inline: 2rem 0 !important;\n }\n}\n\n/*:host {*/\n/* ::slotted([slot="start"]) {*/\n/* width: 1.5rem;*/\n/* }*/\n/*}*/\n\n:host(.wje-menu-variant-context) {\n display: block;\n}\n\n:host(.active) {\n color: var(--wje-menu-item-color-active);\n background: var(--wje-menu-item-background-active);\n}\n\n:host(.open) {\n color: var(--wje-menu-item-color-active);\n background: var(--wje-menu-item-background-active);\n}';
6
+ const styles = `/*
7
+ [ WJ Menu Item ]
8
+ */
9
+
10
+ :host {
11
+ --wje-menu-item-safe-triangle-cursor-x: 0;
12
+ --wje-menu-item-safe-triangle-cursor-y: 0;
13
+ --wje-menu-item-safe-triangle-submenu-start-x: 0;
14
+ --wje-menu-item-safe-triangle-submenu-start-y: 0;
15
+ --wje-menu-item-safe-triangle-submenu-end-x: 0;
16
+ --wje-menu-item-safe-triangle-submenu-end-y: 0;
17
+
18
+ display: block;
19
+ .native-menu-item {
20
+ background: var(--wje-menu-item-background);
21
+ position: relative;
22
+ display: flex;
23
+ flex-wrap: nowrap;
24
+ align-items: center;
25
+ justify-content: center;
26
+ color: var(--wje-menu-item-color);
27
+ padding-top: var(--wje-menu-item-padding-top);
28
+ padding-bottom: var(--wje-menu-item-padding-bottom);
29
+ transition: var(--wje-transition-fast) fill;
30
+ user-select: none;
31
+ white-space: nowrap;
32
+ cursor: pointer;
33
+ width: 100%;
34
+
35
+ &:hover {
36
+ color: var(--wje-menu-item-color-hover);
37
+ background: var(--wje-menu-item-background-hover);
38
+ }
39
+
40
+ &:focus {
41
+ color: var(--wje-menu-item-color-focus);
42
+ background: var(--wje-menu-item-background-focus);
43
+ }
44
+
45
+ &:active {
46
+ color: var(--wje-menu-item-color-active);
47
+ background: var(--wje-menu-item-background-active);
48
+ }
49
+
50
+ .label {
51
+ flex: 1 1 auto;
52
+ display: inline-block;
53
+ text-overflow: ellipsis;
54
+ overflow: hidden;
55
+ line-height: normal;
56
+ }
57
+
58
+ .check-icon {
59
+ flex: 0 0 auto;
60
+ display: var(--wje-menu-item-check-icon-display, flex);
61
+ align-items: center;
62
+ justify-content: center;
63
+ width: var(--wje-menu-item-check-icon-width, 1.5rem);
64
+ visibility: hidden;
65
+
66
+ &.checked {
67
+ visibility: visible;
68
+ }
69
+ }
70
+
71
+ &.expanded-submenu {
72
+ color: var(--wje-menu-item-color-active);
73
+ background: var(--wje-menu-item-background-active);
74
+
75
+ &:hover {
76
+ color: var(--wje-menu-item-color-hover);
77
+ background: var(--wje-menu-item-background-hover);
78
+ }
79
+
80
+ &::after {
81
+ content: '';
82
+ position: fixed;
83
+ z-index: 1;
84
+ top: 0;
85
+ right: 0;
86
+ bottom: 0;
87
+ left: 0;
88
+ clip-path: polygon(
89
+ var(--wje-menu-item-safe-triangle-cursor-x) var(--wje-menu-item-safe-triangle-cursor-y),
90
+ var(--wje-menu-item-safe-triangle-submenu-start-x)
91
+ var(--wje-menu-item-safe-triangle-submenu-start-y),
92
+ var(--wje-menu-item-safe-triangle-submenu-end-x) var(--wje-menu-item-safe-triangle-submenu-end-y)
93
+ );
94
+ }
95
+ }
96
+ }
97
+ }
98
+
99
+ :host(.collapse) {
100
+ ::slotted([slot='start']) {
101
+ margin: 0;
102
+ /*width: auto;*/
103
+ /*display: contents;*/
104
+ }
105
+
106
+ ::slotted([slot='end']) {
107
+ display: none;
108
+ }
109
+
110
+ .label,
111
+ .check-icon,
112
+ .submenu-icon {
113
+ display: none;
114
+ }
115
+ }
116
+ .submenu-icon {
117
+ --wje-icon-size: 14px !important;
118
+ flex: 0 0 auto;
119
+ display: flex;
120
+ align-items: center;
121
+ justify-content: center;
122
+ width: 1.5rem;
123
+ visibility: var(--wje-menu-item-icon-visibility);
124
+ }
125
+
126
+ .has-submenu {
127
+ .submenu-icon {
128
+ --wje-menu-item-icon-visibility: visible;
129
+ }
130
+ }
131
+
132
+ .submenu-icon.collapse {
133
+ flex: none;
134
+ /*right: 10px;*/
135
+ position: relative;
136
+ }
137
+
138
+ :host(:focus-visible) {
139
+ outline: none;
140
+ }
141
+
142
+ ::slotted([slot='start']) {
143
+ flex: 0 0 auto;
144
+ display: flex;
145
+ align-items: center;
146
+ margin-inline-end: 0.5rem;
147
+ }
148
+
149
+ ::slotted([slot='end']) {
150
+ flex: 0 0 auto;
151
+ display: flex;
152
+ align-items: center;
153
+ margin-inline-start: 0.5rem;
154
+ }
155
+
156
+ :host(.wje-menu-variant-nav) {
157
+ /*posun 2 a x urovne o 1 rem*/
158
+ ::slotted([slot='submenu']) {
159
+ --wje-menu-border-width: 0 !important;
160
+ --wje-menu-margin-inline: 2rem 0 !important;
161
+ }
162
+ }
163
+
164
+ /*:host {*/
165
+ /* ::slotted([slot="start"]) {*/
166
+ /* width: 1.5rem;*/
167
+ /* }*/
168
+ /*}*/
169
+
170
+ :host(.wje-menu-variant-context) {
171
+ display: block;
172
+ }
173
+
174
+ :host(.active) {
175
+ color: var(--wje-menu-item-color-active);
176
+ background: var(--wje-menu-item-background-active);
177
+ }
178
+
179
+ :host(.open) {
180
+ color: var(--wje-menu-item-color-active);
181
+ background: var(--wje-menu-item-background-active);
182
+ }
183
+ `;
7
184
  class MenuItem extends WJElement {
8
185
  /**
9
186
  * Constructor for MenuItem class.
10
- * @constructor
187
+ * @class
11
188
  */
12
189
  constructor() {
13
190
  super();
@@ -20,6 +197,10 @@ class MenuItem extends WJElement {
20
197
  this.showSubmenu();
21
198
  }
22
199
  });
200
+ /**
201
+ * Handles the click event on the MenuItem.
202
+ * @param {object} e
203
+ */
23
204
  __publicField(this, "clickHandler", (e) => {
24
205
  switch (this.variant) {
25
206
  case "NAV":
@@ -50,8 +231,7 @@ class MenuItem extends WJElement {
50
231
  });
51
232
  /**
52
233
  * Checks if the submenu should be hidden based on the event.
53
- *
54
- * @param {Event} e - The event object.
234
+ * @param {Event} e The event object.
55
235
  */
56
236
  __publicField(this, "shouldHideSubmenu", (e) => {
57
237
  if (this.collapse || this.variant === "CONTEXT" && this.hasSubmenu) {
@@ -81,7 +261,6 @@ class MenuItem extends WJElement {
81
261
  this.style.setProperty("--wje-menu-item-safe-triangle-submenu-end-x", `${left}px`);
82
262
  this.style.setProperty("--wje-menu-item-safe-triangle-submenu-end-y", `${top + height}px`);
83
263
  });
84
- bindRouterLinks(this, { selector: false });
85
264
  this._collapsible = false;
86
265
  }
87
266
  /**
@@ -122,8 +301,7 @@ class MenuItem extends WJElement {
122
301
  * @returns {boolean} True if the closest parent has the collapse attribute, false otherwise.
123
302
  */
124
303
  get collapse() {
125
- if (this.closest("[collapse]"))
126
- return true;
304
+ if (this.closest("[collapse]")) return true;
127
305
  return false;
128
306
  }
129
307
  /**
@@ -151,19 +329,15 @@ class MenuItem extends WJElement {
151
329
  /**
152
330
  * Removes the active attribute from the menu before drawing the MenuItem.
153
331
  */
154
- beforeDraw(context, store, params) {
332
+ beforeDraw() {
155
333
  var _a;
156
334
  (_a = this.querySelector("wje-menu")) == null ? void 0 : _a.removeAttribute("active");
157
335
  }
158
336
  /**
159
- * Draws the MenuItem element.
160
- *
161
- * @param {Object} context - The context for drawing.
162
- * @param {Object} store - The store for drawing.
163
- * @param {Object} params - The parameters for drawing.
337
+ * Draws the MenuItem element and sets the variant and collapse attributes.
164
338
  * @returns {DocumentFragment} The fragment to be appended to the MenuItem.
165
339
  */
166
- draw(context, store, params) {
340
+ draw() {
167
341
  var _a, _b, _c;
168
342
  this.hasSubmenu = WjElementUtils.hasSlot(this, "submenu");
169
343
  let fragment = document.createDocumentFragment();
@@ -188,7 +362,8 @@ class MenuItem extends WJElement {
188
362
  checkedIcon.setAttribute("part", "check");
189
363
  checkedIcon.classList.add("check-icon");
190
364
  checkedIcon.innerHTML = `<wje-icon name="check"></wje-icon>`;
191
- this.hasAttribute("checked") ? checkedIcon.classList.add("checked") : checkedIcon.classList.remove("checked");
365
+ if (this.hasAttribute("checked")) checkedIcon.classList.add("checked");
366
+ else checkedIcon.classList.remove("checked");
192
367
  let start = document.createElement("slot");
193
368
  start.name = "start";
194
369
  let slot = document.createElement("slot");
@@ -204,7 +379,8 @@ class MenuItem extends WJElement {
204
379
  submenuIcon.setAttribute("part", "submenu-icon");
205
380
  submenuIcon.classList.add("submenu-icon", submenuIconClass);
206
381
  submenuIcon.innerHTML = this.collapse ? `<wje-icon name="chevron-down"></wje-icon>` : `<wje-icon name="chevron-right"></wje-icon>`;
207
- this.hasSubmenu ? native.classList.add("has-submenu") : native.classList.remove("has-submenu");
382
+ if (this.hasSubmenu) native.classList.add("has-submenu");
383
+ else native.classList.remove("has-submenu");
208
384
  native.appendChild(checkedIcon);
209
385
  native.appendChild(start);
210
386
  native.appendChild(slot);
@@ -242,6 +418,7 @@ class MenuItem extends WJElement {
242
418
  * Adds event listeners after drawing the MenuItem.
243
419
  */
244
420
  afterDraw() {
421
+ this.unbindRouterLinks = bindRouterLinks(this.parentElement, { selector: false });
245
422
  this.addEventListener("mousemove", this.dispatchMove);
246
423
  this.addEventListener("wje-popup:reposition", this.dispatchReposition);
247
424
  event.addListener(this, "mouseenter", null, this.mouseenterHandler);
@@ -249,17 +426,9 @@ class MenuItem extends WJElement {
249
426
  event.addListener(this, "focusout", null, this.shouldHideSubmenu);
250
427
  event.addListener(this, "click", null, this.clickHandler);
251
428
  }
252
- beforeDisconnect() {
253
- event.removeListener(this, "mousemove", null, this.dispatchMove);
254
- event.removeListener(this, "wje-popup:reposition", null, this.dispatchReposition);
255
- event.removeListener(this, "mouseenter", null, this.mouseenterHandler);
256
- event.removeListener(this, "mouseleave", null, this.shouldHideSubmenu);
257
- event.removeListener(this, "focusout", null, this.shouldHideSubmenu);
258
- event.removeListener(this, "click", null, this.clickHandler);
259
- }
260
429
  /**
261
430
  * Creates a tooltip for the MenuItem when it is collapsed.
262
- * @param {HTMLElement} native - The native MenuItem element.
431
+ * @param {HTMLElement} native The native MenuItem element.
263
432
  * @returns {HTMLElement} The tooltip element.
264
433
  */
265
434
  collapseItem(native) {
@@ -306,7 +475,7 @@ class MenuItem extends WJElement {
306
475
  * Toggles the active state of the submenu element.
307
476
  * If the submenu is not active, it sets the "active" attribute.
308
477
  * If the submenu is already active, it removes the "active" attribute.
309
- * @param {Event} e - The event object.
478
+ * @param {Event} e The event object.
310
479
  */
311
480
  submenuToggle(e) {
312
481
  if (this.hasSubmenu) {
@@ -314,8 +483,7 @@ class MenuItem extends WJElement {
314
483
  if (!submenuElements.hasAttribute("active")) {
315
484
  submenuElements.setAttribute("active", "");
316
485
  } else {
317
- if (this === e.target)
318
- submenuElements.removeAttribute("active");
486
+ if (this === e.target) submenuElements.removeAttribute("active");
319
487
  }
320
488
  }
321
489
  }
@@ -342,11 +510,24 @@ class MenuItem extends WJElement {
342
510
  }
343
511
  }
344
512
  /**
345
- * Clears the innerHTML of the context before disconnecting the MenuItem.
513
+ * Gets the text from the element and returns it.
346
514
  */
347
515
  beforeDisconnect() {
516
+ var _a;
517
+ event.removeListener(this, "mousemove", null, this.dispatchMove);
518
+ event.removeListener(this, "wje-popup:reposition", null, this.dispatchReposition);
519
+ event.removeListener(this, "mouseenter", null, this.mouseenterHandler);
520
+ event.removeListener(this, "mouseleave", null, this.shouldHideSubmenu);
521
+ event.removeListener(this, "focusout", null, this.shouldHideSubmenu);
522
+ event.removeListener(this, "click", null, this.clickHandler);
348
523
  this.context.innerHTML = "";
524
+ (_a = this.unbindRouterLinks) == null ? void 0 : _a.call(this);
349
525
  }
526
+ /**
527
+ * Extracts and returns the concatenated text content from all text nodes within the specified element.
528
+ * @param {HTMLElement} element The HTML element from which to extract text content.
529
+ * @returns {string} The concatenated and trimmed text content from the element's text nodes.
530
+ */
350
531
  getTextFromElement(element) {
351
532
  let text = "";
352
533
  for (let node of element.childNodes) {
@@ -2,12 +2,11 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import WJElement, { WjElementUtils } from "./wje-element.js";
5
- const styles = "/*\n[ Menu Label ]\n*/\n\n:host {\n --wje-letter-spacing: .025rem;\n --wje-menu-label-color: var(--wje-color-contrast-6);\n --wje-padding-top: 0;\n --wje-padding-bottom: 0;\n --wje-padding-start: 1.5rem;\n --wje-padding-end: 1.5rem;\n}\n\n.native-menu-label {\n font-size: var(--wje-menu-label-font-size);\n display: inline-block;\n font-weight: var(--wje-menu-label-weight);\n letter-spacing: var(--wje-letter-spacing);\n color: var(--wje-menu-label-color);\n padding: var(--wje-padding-top) var(--wje-padding-start) var(--wje-padding-bottom) var(--wje-padding-end);\n}";
5
+ const styles = "/*\n[ Menu Label ]\n*/\n\n:host {\n --wje-letter-spacing: 0.025rem;\n --wje-menu-label-color: var(--wje-color-contrast-6);\n --wje-padding-top: 0;\n --wje-padding-bottom: 0;\n --wje-padding-start: 1.5rem;\n --wje-padding-end: 1.5rem;\n}\n\n.native-menu-label {\n font-size: var(--wje-menu-label-font-size);\n display: inline-block;\n font-weight: var(--wje-menu-label-weight);\n letter-spacing: var(--wje-letter-spacing);\n color: var(--wje-menu-label-color);\n padding: var(--wje-padding-top) var(--wje-padding-start) var(--wje-padding-bottom) var(--wje-padding-end);\n}\n";
6
6
  class MenuLabel extends WJElement {
7
7
  /**
8
8
  * Creates an instance of MenuLabel.
9
- *
10
- * @constructor
9
+ * @class
11
10
  */
12
11
  constructor() {
13
12
  super();
@@ -16,7 +15,6 @@ class MenuLabel extends WJElement {
16
15
  }
17
16
  /**
18
17
  * Returns the CSS styles for the component.
19
- *
20
18
  * @static
21
19
  * @returns {CSSStyleSheet}
22
20
  */
@@ -25,7 +23,6 @@ class MenuLabel extends WJElement {
25
23
  }
26
24
  /**
27
25
  * Returns the list of attributes to observe for changes.
28
- *
29
26
  * @static
30
27
  * @returns {Array<string>}
31
28
  */
@@ -39,14 +36,10 @@ class MenuLabel extends WJElement {
39
36
  this.isShadowRoot = "open";
40
37
  }
41
38
  /**
42
- * Draws the component.
43
- *
44
- * @param {Object} context - The context for drawing.
45
- * @param {Object} store - The store for drawing.
46
- * @param {Object} params - The parameters for drawing.
39
+ * Draws the component for the menu label.
47
40
  * @returns {DocumentFragment}
48
41
  */
49
- draw(context, store, params) {
42
+ draw() {
50
43
  let fragment = document.createDocumentFragment();
51
44
  let slot = document.createElement("slot");
52
45
  slot.setAttribute("part", "native");
package/dist/wje-menu.js CHANGED
@@ -2,12 +2,11 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import WJElement from "./wje-element.js";
5
- const styles = "/*\n[ Wj Menu ]\n*/\n\n:host {\n display: none;\n background: var(--wje-menu-background);\n position: relative;\n border-width: var(--wje-menu-border-width);\n border-style: var(--wje-menu-border-style);\n border-color: var(--wje-menu-border-color);\n z-index: var(--wje-menu-z-index, 8);\n box-shadow: var(--wje-menu-shadow);\n border-radius: var(--wje-menu-border-radius);\n padding-top: var(--wje-menu-padding-top);\n padding-bottom: var(--wje-menu-padding-bottom);\n padding-inline: var(--wje-menu-padding-inline);\n margin-top: var(--wje-menu-margin-top);\n margin-bottom: var(--wje-menu-margin-bottom);\n margin-inline: var(--wje-menu-margin-inline);\n overflow: auto;\n overscroll-behavior: none;\n .native-menu {\n display: flex;\n flex-direction: column;\n width: 100%;\n ::slotted(wje-button) {\n margin: 0;\n }\n }\n}\n\n:host(.wje-menu-collapse) {\n width: var(--wje-menu-collapse-width);\n}\n\n:host([collapse]) {\n box-shadow: none;\n}\n\n:host([variant=context]) {\n display: block !important;\n margin-left: var(--wje-menu-submenu-offset);\n}\n\n:host([variant=megamenu]) .native-menu {\n flex-direction: row;\n align-items: end;\n flex-wrap: nowrap;\n .check-icon {\n display: none;\n }\n}\n\n:host([active]) {\n display: flex !important;\n}";
5
+ const styles = "/*\n[ Wj Menu ]\n*/\n\n:host {\n display: none;\n background: var(--wje-menu-background);\n position: relative;\n border-width: var(--wje-menu-border-width);\n border-style: var(--wje-menu-border-style);\n border-color: var(--wje-menu-border-color);\n z-index: var(--wje-menu-z-index, 8);\n box-shadow: var(--wje-menu-shadow);\n border-radius: var(--wje-menu-border-radius);\n padding-top: var(--wje-menu-padding-top);\n padding-bottom: var(--wje-menu-padding-bottom);\n padding-inline: var(--wje-menu-padding-inline);\n margin-top: var(--wje-menu-margin-top);\n margin-bottom: var(--wje-menu-margin-bottom);\n margin-inline: var(--wje-menu-margin-inline);\n overflow: auto;\n overscroll-behavior: none;\n .native-menu {\n display: flex;\n flex-direction: column;\n width: 100%;\n ::slotted(wje-button) {\n margin: 0;\n }\n }\n}\n\n:host(.wje-menu-collapse) {\n width: var(--wje-menu-collapse-width);\n}\n\n:host([collapse]) {\n box-shadow: none;\n}\n\n:host([variant='context']) {\n display: block !important;\n margin-left: var(--wje-menu-submenu-offset);\n}\n\n:host([variant='megamenu']) .native-menu {\n flex-direction: row;\n align-items: end;\n flex-wrap: nowrap;\n .check-icon {\n display: none;\n }\n}\n\n:host([active]) {\n display: flex !important;\n}\n";
6
6
  class Menu extends WJElement {
7
7
  /**
8
8
  * Creates an instance of Menu.
9
- *
10
- * @constructor
9
+ * @class
11
10
  */
12
11
  constructor() {
13
12
  super();
@@ -15,7 +14,6 @@ class Menu extends WJElement {
15
14
  }
16
15
  /**
17
16
  * Returns the CSS styles for the component.
18
- *
19
17
  * @static
20
18
  * @returns {CSSStyleSheet}
21
19
  */
@@ -24,7 +22,6 @@ class Menu extends WJElement {
24
22
  }
25
23
  /**
26
24
  * Returns the list of attributes to observe for changes.
27
- *
28
25
  * @static
29
26
  * @returns {Array<string>}
30
27
  */
@@ -38,18 +35,13 @@ class Menu extends WJElement {
38
35
  this.isShadowRoot = "open";
39
36
  }
40
37
  /**
41
- * Draws the component.
42
- *
43
- * @param {Object} context - The context for drawing.
44
- * @param {Object} store - The store for drawing.
45
- * @param {Object} params - The parameters for drawing.
38
+ * Draws the component for the menu.
46
39
  * @returns {DocumentFragment}
47
40
  */
48
- draw(context, store, params) {
41
+ draw() {
49
42
  let fragment = document.createDocumentFragment();
50
43
  this.classList.remove("wje-menu-collapse");
51
- if (this.hasAttribute("collapse"))
52
- this.classList.add("wje-menu-collapse");
44
+ if (this.hasAttribute("collapse")) this.classList.add("wje-menu-collapse");
53
45
  let native = document.createElement("div");
54
46
  native.setAttribute("part", "native");
55
47
  native.classList.add("native-menu");
@@ -63,8 +55,7 @@ class Menu extends WJElement {
63
55
  */
64
56
  afterDraw() {
65
57
  Array.from(this.children).forEach((child) => {
66
- if (child.tagName.includes("-"))
67
- child.refresh();
58
+ if (child.tagName.includes("-")) child.refresh();
68
59
  });
69
60
  }
70
61
  /**
@@ -3,12 +3,11 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import WJElement, { event } from "./wje-element.js";
5
5
  import Icon from "./wje-icon.js";
6
- const styles = '/*\n[ WJ Option ]\n*/\n\n:host {\n display: block;\n wje-icon {\n visibility: hidden;\n margin-inline: 0.5rem;\n }\n}\n\n:host([selected]) {\n wje-icon {\n visibility: visible;\n }\n}\n\n:host([disabled]){\n background-color: lightgray;\n opacity: .3;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n.native-option {\n display: flex;\n align-items: center;\n padding-top: var(--wje-option-padding-top);\n padding-bottom: var(--wje-option-padding-bottom);\n}\n\n.native-option:hover {\n background-color: var(--wje-option-highlighted);\n}\n\n::slotted([slot="start"]) {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n margin-inline-end: .5rem;\n}\n\n::slotted([slot="end"]) {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n margin-inline: auto .5rem;\n}';
6
+ const styles = "/*\n[ WJ Option ]\n*/\n\n:host {\n display: block;\n wje-icon {\n visibility: hidden;\n margin-inline: 0.5rem;\n }\n}\n\n:host([selected]) {\n wje-icon {\n visibility: visible;\n }\n}\n\n:host([disabled]) {\n background-color: lightgray;\n opacity: 0.3;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n.native-option {\n display: flex;\n align-items: center;\n padding-top: var(--wje-option-padding-top);\n padding-bottom: var(--wje-option-padding-bottom);\n}\n\n.native-option:hover {\n background-color: var(--wje-option-highlighted);\n}\n\n::slotted([slot='start']) {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n margin-inline-end: 0.5rem;\n}\n\n::slotted([slot='end']) {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n margin-inline: auto 0.5rem;\n}\n";
7
7
  class Option extends WJElement {
8
8
  /**
9
9
  * Creates an instance of Option.
10
- *
11
- * @constructor
10
+ * @class
12
11
  */
13
12
  constructor() {
14
13
  super();
@@ -22,31 +21,28 @@ class Option extends WJElement {
22
21
  }
23
22
  /**
24
23
  * Sets the selected attribute of the option.
25
- *
26
- * @param {boolean} value - The value to set.
24
+ * @param {boolean} value The value to set.
27
25
  */
28
26
  set selected(value) {
29
- value ? this.setAttribute("selected", "") : this.removeAttribute("selected");
27
+ if (value) this.setAttribute("selected", "");
28
+ else this.removeAttribute("selected");
30
29
  }
31
30
  /**
32
31
  * Sets the value attribute of the option.
33
- *
34
- * @param {string} value - The value to set.
32
+ * @param {string} value The value to set.
35
33
  */
36
34
  set value(value) {
37
35
  this.setAttribute("value", value);
38
36
  }
39
37
  /**
40
38
  * Sets the text content of the option.
41
- *
42
- * @param {string} value - The text to set.
39
+ * @param {string} value The text to set.
43
40
  */
44
41
  set text(value) {
45
42
  this.innerText = value;
46
43
  }
47
44
  /**
48
45
  * Returns the CSS styles for the component.
49
- *
50
46
  * @static
51
47
  * @returns {CSSStyleSheet}
52
48
  */
@@ -55,7 +51,6 @@ class Option extends WJElement {
55
51
  }
56
52
  /**
57
53
  * Returns the list of attributes to observe for changes.
58
- *
59
54
  * @static
60
55
  * @returns {Array<string>}
61
56
  */
@@ -69,14 +64,10 @@ class Option extends WJElement {
69
64
  this.isShadowRoot = "open";
70
65
  }
71
66
  /**
72
- * Draws the component.
73
- *
74
- * @param {Object} context - The context for drawing.
75
- * @param {Object} store - The store for drawing.
76
- * @param {Object} params - The parameters for drawing.
67
+ * Draws the component for the option.
77
68
  * @returns {DocumentFragment}
78
69
  */
79
- draw(context, store, params) {
70
+ draw() {
80
71
  let fragment = document.createDocumentFragment();
81
72
  let element = document.createElement("div");
82
73
  element.classList.add("native-option");
@@ -101,14 +92,16 @@ class Option extends WJElement {
101
92
  afterDraw() {
102
93
  event.addListener(this, "click", null, (e, b, c) => {
103
94
  if (this.hasAttribute("disabled")) return;
104
- this.dispatchEvent(new CustomEvent("wje-option:change", {
105
- bubbles: true,
106
- composed: true,
107
- detail: {
108
- value: this.value,
109
- text: this.text
110
- }
111
- }));
95
+ this.dispatchEvent(
96
+ new CustomEvent("wje-option:change", {
97
+ bubbles: true,
98
+ composed: true,
99
+ detail: {
100
+ value: this.value,
101
+ text: this.text
102
+ }
103
+ })
104
+ );
112
105
  });
113
106
  }
114
107
  }