@vaadin/menu-bar 23.0.2 → 23.1.0-alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/menu-bar",
3
- "version": "23.0.2",
3
+ "version": "23.1.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,18 +35,18 @@
35
35
  "dependencies": {
36
36
  "@open-wc/dedupe-mixin": "^1.3.0",
37
37
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/button": "^23.0.2",
39
- "@vaadin/component-base": "^23.0.2",
40
- "@vaadin/vaadin-context-menu": "^23.0.2",
41
- "@vaadin/vaadin-lumo-styles": "^23.0.2",
42
- "@vaadin/vaadin-material-styles": "^23.0.2",
43
- "@vaadin/vaadin-themable-mixin": "^23.0.2"
38
+ "@vaadin/button": "23.1.0-alpha1",
39
+ "@vaadin/component-base": "23.1.0-alpha1",
40
+ "@vaadin/vaadin-context-menu": "23.1.0-alpha1",
41
+ "@vaadin/vaadin-lumo-styles": "23.1.0-alpha1",
42
+ "@vaadin/vaadin-material-styles": "23.1.0-alpha1",
43
+ "@vaadin/vaadin-themable-mixin": "23.1.0-alpha1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@esm-bundle/chai": "^4.3.4",
47
- "@vaadin/icon": "^23.0.2",
47
+ "@vaadin/icon": "23.1.0-alpha1",
48
48
  "@vaadin/testing-helpers": "^0.3.2",
49
49
  "sinon": "^9.2.1"
50
50
  },
51
- "gitHead": "a50f708dc0fe7d0cc10763f413838d71b1a0788b"
51
+ "gitHead": "5d0cdee069f866037c507265fafb4d0476795333"
52
52
  }
@@ -197,29 +197,6 @@ export const ButtonsMixin = (superClass) =>
197
197
  button.setAttribute('tabindex', disabled ? '-1' : '0');
198
198
  }
199
199
 
200
- /**
201
- * @param {string | null} theme
202
- * @protected
203
- * @override
204
- */
205
- _setTheme(theme) {
206
- super._setTheme(theme);
207
-
208
- // Initializing, do nothing
209
- if (!this.shadowRoot) {
210
- return;
211
- }
212
-
213
- this.__applyTheme(theme);
214
- }
215
-
216
- /** @private */
217
- __applyTheme(theme) {
218
- this._buttons.forEach((btn) => this._setButtonTheme(btn, theme));
219
-
220
- this.__detectOverflow();
221
- }
222
-
223
200
  /** @protected */
224
201
  _setButtonTheme(btn, hostTheme) {
225
202
  let theme = hostTheme;
@@ -277,9 +254,10 @@ export const ButtonsMixin = (superClass) =>
277
254
  this._appendButton(button);
278
255
  this._setButtonDisabled(button, item.disabled);
279
256
  this._initButtonAttrs(button);
257
+ this._setButtonTheme(button, this._theme);
280
258
  });
281
259
 
282
- this.__applyTheme(this.theme);
260
+ this.__detectOverflow();
283
261
  }
284
262
 
285
263
  /**
@@ -27,7 +27,7 @@ export const InteractionsMixin = (superClass) =>
27
27
  }
28
28
 
29
29
  static get observers() {
30
- return ['_itemsChanged(items, items.splices)', '_themeChanged(theme)'];
30
+ return ['_itemsChanged(items, items.splices)'];
31
31
  }
32
32
 
33
33
  /** @protected */
@@ -54,15 +54,6 @@ export const InteractionsMixin = (superClass) =>
54
54
  return this.getAttribute('dir') === 'rtl';
55
55
  }
56
56
 
57
- /** @private */
58
- _themeChanged(theme) {
59
- if (theme) {
60
- this._subMenu.setAttribute('theme', theme);
61
- } else {
62
- this._subMenu.removeAttribute('theme');
63
- }
64
- }
65
-
66
57
  /** @protected */
67
58
  _setExpanded(button, expanded) {
68
59
  button.toggleAttribute('expanded', expanded);
@@ -135,6 +135,12 @@ declare class MenuBar extends ButtonsMixin(DisabledMixin(InteractionsMixin(Eleme
135
135
  */
136
136
  i18n: MenuBarI18n;
137
137
 
138
+ /**
139
+ * A callback for the `_theme` property observer.
140
+ * It propagates the host theme to the buttons and the sub menu.
141
+ */
142
+ protected _themeChanged(theme: string | null): void;
143
+
138
144
  addEventListener<K extends keyof MenuBarEventMap>(
139
145
  type: K,
140
146
  listener: (this: MenuBar, ev: MenuBarEventMap[K]) => void,
@@ -201,6 +201,10 @@ class MenuBar extends ButtonsMixin(DisabledMixin(InteractionsMixin(ElementMixin(
201
201
  };
202
202
  }
203
203
 
204
+ static get observers() {
205
+ return ['_themeChanged(_theme)'];
206
+ }
207
+
204
208
  /**
205
209
  * Override method inherited from `DisabledMixin`
206
210
  * to update the `disabled` property for the buttons
@@ -218,6 +222,26 @@ class MenuBar extends ButtonsMixin(DisabledMixin(InteractionsMixin(ElementMixin(
218
222
  }
219
223
  }
220
224
 
225
+ /**
226
+ * A callback for the `_theme` property observer.
227
+ * It propagates the host theme to the buttons and the sub menu.
228
+ *
229
+ * @param {string | null} theme
230
+ * @protected
231
+ */
232
+ _themeChanged(theme) {
233
+ if (this.shadowRoot) {
234
+ this._buttons.forEach((btn) => this._setButtonTheme(btn, theme));
235
+ this.__detectOverflow();
236
+ }
237
+
238
+ if (theme) {
239
+ this._subMenu.setAttribute('theme', theme);
240
+ } else {
241
+ this._subMenu.removeAttribute('theme');
242
+ }
243
+ }
244
+
221
245
  /** @private */
222
246
  __updateButtonsDisabled(disabled) {
223
247
  this._buttons.forEach((btn) => {