@vaadin/menu-bar 24.7.0-alpha8 → 24.7.0-beta1

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": "24.7.0-alpha8",
3
+ "version": "24.7.0-beta1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,22 +37,22 @@
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
39
  "@polymer/polymer": "^3.0.0",
40
- "@vaadin/a11y-base": "24.7.0-alpha8",
41
- "@vaadin/button": "24.7.0-alpha8",
42
- "@vaadin/component-base": "24.7.0-alpha8",
43
- "@vaadin/context-menu": "24.7.0-alpha8",
44
- "@vaadin/item": "24.7.0-alpha8",
45
- "@vaadin/list-box": "24.7.0-alpha8",
46
- "@vaadin/overlay": "24.7.0-alpha8",
47
- "@vaadin/vaadin-lumo-styles": "24.7.0-alpha8",
48
- "@vaadin/vaadin-material-styles": "24.7.0-alpha8",
49
- "@vaadin/vaadin-themable-mixin": "24.7.0-alpha8",
40
+ "@vaadin/a11y-base": "24.7.0-beta1",
41
+ "@vaadin/button": "24.7.0-beta1",
42
+ "@vaadin/component-base": "24.7.0-beta1",
43
+ "@vaadin/context-menu": "24.7.0-beta1",
44
+ "@vaadin/item": "24.7.0-beta1",
45
+ "@vaadin/list-box": "24.7.0-beta1",
46
+ "@vaadin/overlay": "24.7.0-beta1",
47
+ "@vaadin/vaadin-lumo-styles": "24.7.0-beta1",
48
+ "@vaadin/vaadin-material-styles": "24.7.0-beta1",
49
+ "@vaadin/vaadin-themable-mixin": "24.7.0-beta1",
50
50
  "lit": "^3.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@vaadin/chai-plugins": "24.7.0-alpha8",
54
- "@vaadin/icon": "24.7.0-alpha8",
55
- "@vaadin/test-runner-commands": "24.7.0-alpha8",
53
+ "@vaadin/chai-plugins": "24.7.0-beta1",
54
+ "@vaadin/icon": "24.7.0-beta1",
55
+ "@vaadin/test-runner-commands": "24.7.0-beta1",
56
56
  "@vaadin/testing-helpers": "^1.1.0",
57
57
  "sinon": "^18.0.0"
58
58
  },
@@ -60,5 +60,5 @@
60
60
  "web-types.json",
61
61
  "web-types.lit.json"
62
62
  ],
63
- "gitHead": "d015035192480fcc8cc9df5d00a950f177b83c32"
63
+ "gitHead": "4043c518ef9b915cde612d2907ddc9bd10e5af17"
64
64
  }
@@ -11,7 +11,7 @@ import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js
11
11
  import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
12
12
  import type { ResizeMixinClass } from '@vaadin/component-base/src/resize-mixin.js';
13
13
 
14
- export interface MenuBarItem {
14
+ export type MenuBarItem<TItemData extends object = object> = {
15
15
  /**
16
16
  * Text to be set as the menu button component's textContent.
17
17
  */
@@ -37,40 +37,40 @@ export interface MenuBarItem {
37
37
  /**
38
38
  * Array of submenu items.
39
39
  */
40
- children?: SubMenuItem[];
40
+ children?: Array<SubMenuItem<TItemData>>;
41
41
 
42
42
  /**
43
43
  * Class/classes to be set to the class attribute of the button.
44
44
  */
45
45
  className?: string;
46
- }
46
+ } & TItemData;
47
47
 
48
- export interface SubMenuItem {
48
+ export type SubMenuItem<TItemData extends object = object> = {
49
49
  text?: string;
50
50
  component?: HTMLElement | string;
51
51
  disabled?: boolean;
52
52
  theme?: string[] | string;
53
53
  checked?: boolean;
54
54
  className?: string;
55
- children?: SubMenuItem[];
56
- }
55
+ children?: Array<SubMenuItem<TItemData>>;
56
+ } & TItemData;
57
57
 
58
58
  export interface MenuBarI18n {
59
59
  moreOptions: string;
60
60
  }
61
61
 
62
- export declare function MenuBarMixin<T extends Constructor<HTMLElement>>(
62
+ export declare function MenuBarMixin<T extends Constructor<HTMLElement>, TItem extends MenuBarItem = MenuBarItem>(
63
63
  base: T,
64
64
  ): Constructor<ControllerMixinClass> &
65
65
  Constructor<DisabledMixinClass> &
66
66
  Constructor<FocusMixinClass> &
67
67
  Constructor<KeyboardDirectionMixinClass> &
68
68
  Constructor<KeyboardMixinClass> &
69
- Constructor<MenuBarMixinClass> &
69
+ Constructor<MenuBarMixinClass<TItem>> &
70
70
  Constructor<ResizeMixinClass> &
71
71
  T;
72
72
 
73
- export declare class MenuBarMixinClass {
73
+ export declare class MenuBarMixinClass<TItem extends MenuBarItem = MenuBarItem> {
74
74
  /**
75
75
  * Defines a hierarchical structure, where root level items represent menu bar buttons,
76
76
  * and `children` property configures a submenu with items to be opened below
@@ -118,7 +118,7 @@ export declare class MenuBarMixinClass {
118
118
  * window.Vaadin.featureFlags.accessibleDisabledButtons = true;
119
119
  * ```
120
120
  */
121
- items: MenuBarItem[];
121
+ items: TItem[];
122
122
 
123
123
  /**
124
124
  * The object used to localize this component.
@@ -183,3 +183,11 @@ export declare class MenuBarMixinClass {
183
183
 
184
184
  protected _hasOverflow: boolean;
185
185
  }
186
+
187
+ export declare interface MenuBarMixinClass
188
+ extends ControllerMixinClass,
189
+ DisabledMixinClass,
190
+ FocusMixinClass,
191
+ KeyboardDirectionMixinClass,
192
+ KeyboardMixinClass,
193
+ ResizeMixinClass {}
@@ -3,23 +3,25 @@
3
3
  * Copyright (c) 2019 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { DisabledMixin } from '@vaadin/a11y-base/src/disabled-mixin.js';
7
- import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
8
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
- import { type MenuBarItem, MenuBarMixin } from './vaadin-menu-bar-mixin.js';
6
+ import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
7
+ import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
8
+ import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
+ import type { MenuBarItem, MenuBarMixinClass } from './vaadin-menu-bar-mixin.js';
10
10
 
11
11
  export { MenuBarItem, MenuBarI18n, SubMenuItem } from './vaadin-menu-bar-mixin.js';
12
12
 
13
13
  /**
14
14
  * Fired when a submenu item or menu bar button without children is clicked.
15
15
  */
16
- export type MenuBarItemSelectedEvent = CustomEvent<{ value: MenuBarItem }>;
16
+ export type MenuBarItemSelectedEvent<TItem extends MenuBarItem = MenuBarItem> = CustomEvent<{ value: TItem }>;
17
17
 
18
- export interface MenuBarCustomEventMap {
19
- 'item-selected': MenuBarItemSelectedEvent;
18
+ export interface MenuBarCustomEventMap<TItem extends MenuBarItem = MenuBarItem> {
19
+ 'item-selected': MenuBarItemSelectedEvent<TItem>;
20
20
  }
21
21
 
22
- export interface MenuBarEventMap extends HTMLElementEventMap, MenuBarCustomEventMap {}
22
+ export interface MenuBarEventMap<TItem extends MenuBarItem = MenuBarItem>
23
+ extends HTMLElementEventMap,
24
+ MenuBarCustomEventMap<TItem> {}
23
25
 
24
26
  /**
25
27
  * `<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering
@@ -77,20 +79,26 @@ export interface MenuBarEventMap extends HTMLElementEventMap, MenuBarCustomEvent
77
79
  *
78
80
  * @fires {CustomEvent} item-selected - Fired when a submenu item or menu bar button without children is clicked.
79
81
  */
80
- declare class MenuBar extends MenuBarMixin(DisabledMixin(ElementMixin(ThemableMixin(HTMLElement)))) {
81
- addEventListener<K extends keyof MenuBarEventMap>(
82
+ declare class MenuBar<TItem extends MenuBarItem = MenuBarItem> extends HTMLElement {
83
+ addEventListener<K extends keyof MenuBarEventMap<TItem>>(
82
84
  type: K,
83
- listener: (this: MenuBar, ev: MenuBarEventMap[K]) => void,
85
+ listener: (this: MenuBar<TItem>, ev: MenuBarEventMap<TItem>[K]) => void,
84
86
  options?: AddEventListenerOptions | boolean,
85
87
  ): void;
86
88
 
87
- removeEventListener<K extends keyof MenuBarEventMap>(
89
+ removeEventListener<K extends keyof MenuBarEventMap<TItem>>(
88
90
  type: K,
89
- listener: (this: MenuBar, ev: MenuBarEventMap[K]) => void,
91
+ listener: (this: MenuBar<TItem>, ev: MenuBarEventMap<TItem>[K]) => void,
90
92
  options?: EventListenerOptions | boolean,
91
93
  ): void;
92
94
  }
93
95
 
96
+ interface MenuBar<TItem extends MenuBarItem = MenuBarItem>
97
+ extends MenuBarMixinClass<TItem>,
98
+ DisabledMixinClass,
99
+ ElementMixinClass,
100
+ ThemableMixinClass {}
101
+
94
102
  declare global {
95
103
  interface HTMLElementTagNameMap {
96
104
  'vaadin-menu-bar': MenuBar;
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/menu-bar",
4
- "version": "24.7.0-alpha8",
4
+ "version": "24.7.0-beta1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-menu-bar",
11
- "description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-overlay).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.\n\nNote: the `theme` attribute value set on `<vaadin-menu-bar>` is\npropagated to the internal components listed above.",
11
+ "description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-beta1/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-beta1/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-beta1/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-beta1/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-beta1/#/elements/vaadin-overlay).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.\n\nNote: the `theme` attribute value set on `<vaadin-menu-bar>` is\npropagated to the internal components listed above.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/menu-bar",
4
- "version": "24.7.0-alpha8",
4
+ "version": "24.7.0-beta1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,7 +16,7 @@
16
16
  "elements": [
17
17
  {
18
18
  "name": "vaadin-menu-bar",
19
- "description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-overlay).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.\n\nNote: the `theme` attribute value set on `<vaadin-menu-bar>` is\npropagated to the internal components listed above.",
19
+ "description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-beta1/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-beta1/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-beta1/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-beta1/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-beta1/#/elements/vaadin-overlay).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.\n\nNote: the `theme` attribute value set on `<vaadin-menu-bar>` is\npropagated to the internal components listed above.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {