@material/menu
Advanced tools
Comparing version 15.0.0-canary.8175d5eff.0 to 15.0.0-canary.819498d8c.0
@@ -65,7 +65,7 @@ /** | ||
*/ | ||
getElementIndex(element: Element): number; | ||
getElementIndex(element: HTMLElement): number; | ||
/** | ||
* Emit an event when a menu item is selected. | ||
*/ | ||
notifySelected(evtData: MDCMenuItemEventDetail): void; | ||
notifySelected(eventData: MDCMenuItemEventDetail): void; | ||
/** @return Returns the menu item count. */ | ||
@@ -72,0 +72,0 @@ getMenuItemCount(): number; |
@@ -6,9 +6,17 @@ # Change Log | ||
# [15.0.0-canary.8175d5eff.0](https://github.com/material-components/material-components-web/compare/v14.0.0...v15.0.0-canary.8175d5eff.0) (2022-12-28) | ||
# [15.0.0-canary.819498d8c.0](https://github.com/material-components/material-components-web/compare/v14.0.0...v15.0.0-canary.819498d8c.0) (2024-03-15) | ||
### Bug Fixes | ||
* **menu:** Account for empty map being passed to theme mixin ([0c52ade](https://github.com/material-components/material-components-web/commit/0c52adeab4a46fb942e7ac64a950d094b54716f8)) | ||
* **menu:** do not require all for theme-styles ([1fb4b1a](https://github.com/material-components/material-components-web/commit/1fb4b1a063ecaec1ad0d508b3f5ae5aca3e96652)) | ||
* **menu:** make require-all a theme-styles param. ([c64a277](https://github.com/material-components/material-components-web/commit/c64a2776efe4f0aaaee5c32f5fb9ef3570483213)) | ||
### Features | ||
* **menu:** Add `static-styles` mixin ([a274583](https://github.com/material-components/material-components-web/commit/a274583b97fd1fe27eaaca9cba5f890173bebb2e)) | ||
* add elevation theming to menu ([86bde5c](https://github.com/material-components/material-components-web/commit/86bde5c063e806f975d836d6a875f2fdaa7cdc67)) | ||
* add icon support to menu theming ([40b18d0](https://github.com/material-components/material-components-web/commit/40b18d04314549060c2b4a28ed425cba9976687b)) | ||
* **menu:** working on theming API ([f1e0371](https://github.com/material-components/material-components-web/commit/f1e0371502ee9bfe48f3501a63f70a42bfd79cb8)) |
@@ -32,6 +32,6 @@ /** | ||
/** MDC Menu Factory */ | ||
export declare type MDCMenuFactory = (el: Element, foundation?: MDCMenuFoundation) => MDCMenu; | ||
export declare type MDCMenuFactory = (el: HTMLElement, foundation?: MDCMenuFoundation) => MDCMenu; | ||
/** MDC Menu */ | ||
export declare class MDCMenu extends MDCComponent<MDCMenuFoundation> { | ||
static attachTo(root: Element): MDCMenu; | ||
static attachTo(root: HTMLElement): MDCMenu; | ||
private menuSurfaceFactory; | ||
@@ -84,3 +84,3 @@ private listFactory; | ||
*/ | ||
get items(): Element[]; | ||
get items(): HTMLElement[]; | ||
/** | ||
@@ -87,0 +87,0 @@ * Turns on/off the underlying list's single selection mode. Used mainly |
@@ -59,7 +59,7 @@ /** | ||
} | ||
this.handleKeydown = function (evt) { | ||
_this.foundation.handleKeydown(evt); | ||
this.handleKeydown = function (event) { | ||
_this.foundation.handleKeydown(event); | ||
}; | ||
this.handleItemAction = function (evt) { | ||
_this.foundation.handleItemAction(_this.items[evt.detail.index]); | ||
this.handleItemAction = function (event) { | ||
_this.foundation.handleItemAction(_this.items[event.detail.index]); | ||
}; | ||
@@ -305,3 +305,3 @@ this.handleMenuSurfaceOpened = function () { | ||
var list = _this.items; | ||
list[index].setAttribute(attr, value); | ||
_this.safeSetAttribute(list[index], attr, value); | ||
}, | ||
@@ -323,6 +323,6 @@ removeAttributeFromElementAtIndex: function (index, attr) { | ||
getElementIndex: function (element) { return _this.items.indexOf(element); }, | ||
notifySelected: function (evtData) { | ||
notifySelected: function (eventData) { | ||
_this.emit(strings.SELECTED_EVENT, { | ||
index: evtData.index, | ||
item: _this.items[evtData.index], | ||
index: eventData.index, | ||
item: _this.items[eventData.index], | ||
}); | ||
@@ -329,0 +329,0 @@ }, |
@@ -44,3 +44,2 @@ /** | ||
}; | ||
private closeAnimationEndTimerId; | ||
private defaultFocusState; | ||
@@ -54,4 +53,4 @@ private selectedIndex; | ||
destroy(): void; | ||
handleKeydown(evt: KeyboardEvent): void; | ||
handleItemAction(listItem: Element): void; | ||
handleKeydown(event: KeyboardEvent): void; | ||
handleItemAction(listItem: HTMLElement): void; | ||
handleMenuSurfaceOpened(): void; | ||
@@ -58,0 +57,0 @@ /** |
@@ -26,3 +26,2 @@ /** | ||
import { cssClasses as listCssClasses } from '@material/list/constants'; | ||
import { MDCMenuSurfaceFoundation } from '@material/menu-surface/foundation'; | ||
import { cssClasses, DefaultFocusState, numbers, strings } from './constants'; | ||
@@ -34,3 +33,2 @@ /** MDC Menu Foundation */ | ||
var _this = _super.call(this, __assign(__assign({}, MDCMenuFoundation.defaultAdapter), adapter)) || this; | ||
_this.closeAnimationEndTimerId = 0; | ||
_this.defaultFocusState = DefaultFocusState.LIST_ROOT; | ||
@@ -89,9 +87,6 @@ _this.selectedIndex = -1; | ||
MDCMenuFoundation.prototype.destroy = function () { | ||
if (this.closeAnimationEndTimerId) { | ||
clearTimeout(this.closeAnimationEndTimerId); | ||
} | ||
this.adapter.closeSurface(); | ||
}; | ||
MDCMenuFoundation.prototype.handleKeydown = function (evt) { | ||
var key = evt.key, keyCode = evt.keyCode; | ||
MDCMenuFoundation.prototype.handleKeydown = function (event) { | ||
var key = event.key, keyCode = event.keyCode; | ||
var isTab = key === 'Tab' || keyCode === 9; | ||
@@ -103,3 +98,2 @@ if (isTab) { | ||
MDCMenuFoundation.prototype.handleItemAction = function (listItem) { | ||
var _this = this; | ||
var index = this.adapter.getElementIndex(listItem); | ||
@@ -112,12 +106,5 @@ if (index < 0) { | ||
this.adapter.closeSurface(skipRestoreFocus); | ||
// Wait for the menu to close before adding/removing classes that affect | ||
// styles. | ||
this.closeAnimationEndTimerId = setTimeout(function () { | ||
// Recompute the index in case the menu contents have changed. | ||
var recomputedIndex = _this.adapter.getElementIndex(listItem); | ||
if (recomputedIndex >= 0 && | ||
_this.adapter.isSelectableItemAtIndex(recomputedIndex)) { | ||
_this.setSelectedIndex(recomputedIndex); | ||
} | ||
}, MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION); | ||
if (this.adapter.isSelectableItemAtIndex(index)) { | ||
this.setSelectedIndex(index); | ||
} | ||
}; | ||
@@ -124,0 +111,0 @@ MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () { |
{ | ||
"name": "@material/menu", | ||
"version": "15.0.0-canary.8175d5eff.0", | ||
"version": "15.0.0-canary.819498d8c.0", | ||
"description": "The Material Components for the web menu component", | ||
@@ -20,16 +20,16 @@ "license": "MIT", | ||
"dependencies": { | ||
"@material/base": "15.0.0-canary.8175d5eff.0", | ||
"@material/dom": "15.0.0-canary.8175d5eff.0", | ||
"@material/elevation": "15.0.0-canary.8175d5eff.0", | ||
"@material/feature-targeting": "15.0.0-canary.8175d5eff.0", | ||
"@material/list": "15.0.0-canary.8175d5eff.0", | ||
"@material/menu-surface": "15.0.0-canary.8175d5eff.0", | ||
"@material/ripple": "15.0.0-canary.8175d5eff.0", | ||
"@material/rtl": "15.0.0-canary.8175d5eff.0", | ||
"@material/shape": "15.0.0-canary.8175d5eff.0", | ||
"@material/theme": "15.0.0-canary.8175d5eff.0", | ||
"@material/tokens": "15.0.0-canary.8175d5eff.0", | ||
"@material/base": "15.0.0-canary.819498d8c.0", | ||
"@material/dom": "15.0.0-canary.819498d8c.0", | ||
"@material/elevation": "15.0.0-canary.819498d8c.0", | ||
"@material/feature-targeting": "15.0.0-canary.819498d8c.0", | ||
"@material/list": "15.0.0-canary.819498d8c.0", | ||
"@material/menu-surface": "15.0.0-canary.819498d8c.0", | ||
"@material/ripple": "15.0.0-canary.819498d8c.0", | ||
"@material/rtl": "15.0.0-canary.819498d8c.0", | ||
"@material/shape": "15.0.0-canary.819498d8c.0", | ||
"@material/theme": "15.0.0-canary.819498d8c.0", | ||
"@material/tokens": "15.0.0-canary.819498d8c.0", | ||
"tslib": "^2.1.0" | ||
}, | ||
"gitHead": "c3bb551a6b32480853dcc8e29f7f8513d62154a2" | ||
"gitHead": "886876a8252aacefe1942b13ba9251af9204bcdd" | ||
} |
@@ -275,3 +275,3 @@ <!--docs: | ||
--- | --- | ||
`handleKeydown(evt: Event) => void` | Event handler for the `keydown` events within the menu. | ||
`handleKeydown(event: Event) => void` | Event handler for the `keydown` events within the menu. | ||
`handleItemAction(listItem: Element) => void` | Event handler for list's action event. | ||
@@ -278,0 +278,0 @@ `handleMenuSurfaceOpened() => void` | Event handler for menu surface's opened event. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1183254
39
9108
+ Added@material/animation@15.0.0-canary.819498d8c.0(transitive)
+ Added@material/base@15.0.0-canary.819498d8c.0(transitive)
+ Added@material/density@15.0.0-canary.819498d8c.0(transitive)
+ Added@material/dom@15.0.0-canary.819498d8c.0(transitive)
+ Added@material/elevation@15.0.0-canary.819498d8c.0(transitive)
+ Added@material/feature-targeting@15.0.0-canary.819498d8c.0(transitive)
+ Added@material/list@15.0.0-canary.819498d8c.0(transitive)
+ Added@material/menu-surface@15.0.0-canary.819498d8c.0(transitive)
+ Added@material/ripple@15.0.0-canary.819498d8c.0(transitive)
+ Added@material/rtl@15.0.0-canary.819498d8c.0(transitive)
+ Added@material/shape@15.0.0-canary.819498d8c.0(transitive)
+ Added@material/theme@15.0.0-canary.819498d8c.0(transitive)
+ Added@material/tokens@15.0.0-canary.819498d8c.0(transitive)
+ Added@material/typography@15.0.0-canary.819498d8c.0(transitive)
- Removed@material/animation@15.0.0-canary.8175d5eff.0(transitive)
- Removed@material/base@15.0.0-canary.8175d5eff.0(transitive)
- Removed@material/density@15.0.0-canary.8175d5eff.0(transitive)
- Removed@material/dom@15.0.0-canary.8175d5eff.0(transitive)
- Removed@material/elevation@15.0.0-canary.8175d5eff.0(transitive)
- Removed@material/feature-targeting@15.0.0-canary.8175d5eff.0(transitive)
- Removed@material/list@15.0.0-canary.8175d5eff.0(transitive)
- Removed@material/menu-surface@15.0.0-canary.8175d5eff.0(transitive)
- Removed@material/ripple@15.0.0-canary.8175d5eff.0(transitive)
- Removed@material/rtl@15.0.0-canary.8175d5eff.0(transitive)
- Removed@material/shape@15.0.0-canary.8175d5eff.0(transitive)
- Removed@material/theme@15.0.0-canary.8175d5eff.0(transitive)
- Removed@material/tokens@15.0.0-canary.8175d5eff.0(transitive)
- Removed@material/typography@15.0.0-canary.8175d5eff.0(transitive)
Updated@material/feature-targeting@15.0.0-canary.819498d8c.0