{"bugs":{"url":"https://github.com/material-components/material-components-web/issues"},"dist":{"shasum":"eb59e3f68d1be973765056c6f4d4297fe710baa9","tarball":"https://registry.npmjs.org/@material/menu/-/menu-13.0.0-canary.3dd611091.0.tgz","fileCount":38,"integrity":"sha512-NEPmJTRyshJ7Us6OEM1lNORADTTSze6Y4ok2A1KyhaJp3vlO9UkBLsBma2PDgkFlbGJu0u12JtgYWmP552VEuw==","signatures":[{"sig":"MEUCIQDulcz7t4D/YkNwc0qHok0u3Z2A9158jniI4t3KU0DxKgIgUK+RCTFSdjVEgIRTAwY+cEU/860DuumoKDH7VO4PeYA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":747975,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhC2HRCRA9TVsSAnZWagAAOeAP/igKPfPtzxFVZKLigS8H\nhIKCC1r1O50jZQAGUVKlfAUp2yJ2Ecc+unoLSY9q/7piJZVKhj9FuZnwrHuF\nWYAtnzyq4ZjpykL6VrgSNrXbP/fY4bMYqsZd3NepefQ4fU0vqwidCrY2RuBO\n7bvLpuijVXzY+UEBmunUKkDHvqVoKefHkrllh9eDHSyCkUR5CAhNqe7FyLtV\nQVmVCGdrxy161FtTpjBc2WUetp8RjO6j1usawXbZh9okrPKy7WryohlxpyHf\noRHkL/d5k6kAjRYiCzKKY86bngS3Ub77J2JHNcgVRMp++DSGNcgmwNsziwRo\n3bImybQMPZ2bePaKnuSaPEoT/e6LinMHSC+nVDJL2jVIhZBeuBvVX9ZgjtWJ\nF61pZLRUGDB3N+rjDakpMZkC9oTzbxKQeKI/6DRHHf9Sj/5gdmIoaRb/X7/b\njSdy3OlAbOi2hNkn5ray+HneNiC6AO5O4NTH6kTBPO5mJ5O89s+NEZoh/M2R\nqPCywxZfJ9Gvl8WxL+NLb1StorM2oRuYAoR8auoV+pBtOh9PJp9ME4WrGGVg\n4sniSY5u3T81Jmt6AMOcEMi8yp+EOYk5LCJOdF7wq7Oe6J4I+vtFIef82m2p\n/U3/fXC4imTgLslFUcqGp70EvTbOeAbQPStQrDZtLBDRZPSDK7kTMH1UUonG\nUUBd\r\n=j+6T\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/mdc.menu.js","name":"@material/menu","types":"dist/mdc.menu.d.ts","module":"index.js","readme":"<!--docs:\ntitle: \"Menus\"\nlayout: detail\nsection: components\nexcerpt: \"Non-cascading Material Design menus.\"\niconId: menu\npath: /catalog/menus/\n-->\n\n# Menus\n\nA menu displays a list of choices on a temporary surface. They appear when users interact with a button, action,\nor other control.\n\n## Design & API Documentation\n\n<ul class=\"icon-list\">\n  <li class=\"icon-list-item icon-list-item--spec\">\n    <a href=\"https://material.io/go/design-menus\">Material Design guidelines: Menus</a>\n  </li>\n  <li class=\"icon-list-item icon-list-item--link\">\n    <a href=\"https://material-components.github.io/material-components-web-catalog/#/component/menu\">Demo</a>\n  </li>\n</ul>\n\n## Installation\n\n```\nnpm install @material/menu\n```\n\n## Basic Usage\n\n### HTML Structure\n\n```html\n<div class=\"mdc-menu mdc-menu-surface\">\n  <ul class=\"mdc-list\" role=\"menu\" aria-hidden=\"true\" aria-orientation=\"vertical\" tabindex=\"-1\">\n    <li class=\"mdc-list-item\" role=\"menuitem\">\n      <span class=\"mdc-list-item__ripple\"></span>\n      <span class=\"mdc-list-item__text\">A Menu Item</span>\n    </li>\n    <li class=\"mdc-list-item\" role=\"menuitem\">\n      <span class=\"mdc-list-item__ripple\"></span>\n      <span class=\"mdc-list-item__text\">Another Menu Item</span>\n    </li>\n  </ul>\n</div>\n```\n\n### Styles\n\n```scss\n@use \"@material/list/mdc-list\";\n@use \"@material/menu-surface/mdc-menu-surface\";\n@use \"@material/menu/mdc-menu\";\n```\n\n### JavaScript Instantiation\n\n```js\nimport {MDCMenu} from '@material/menu';\n\nconst menu = new MDCMenu(document.querySelector('.mdc-menu'));\nmenu.open = true;\n```\n\n> See [Importing the JS component](../../docs/importing-js.md) for more information on how to import JavaScript.\n\n## Variants\n\n### Selection Group Menu\n\nMenus can contain a group of list items that can represent the selection state of elements within the group.\n\n```html\n<div class=\"mdc-menu mdc-menu-surface\" id=\"demo-menu\">\n  <ul class=\"mdc-list\" role=\"menu\" aria-hidden=\"true\" aria-orientation=\"vertical\" tabindex=\"-1\">\n    <li>\n      <ul class=\"mdc-menu__selection-group\">\n        <li class=\"mdc-list-item\" role=\"menuitem\">\n          <span class=\"mdc-list-item__ripple\"></span>\n          <span class=\"mdc-list-item__graphic mdc-menu__selection-group-icon\">\n            ...\n          </span>\n          <span class=\"mdc-list-item__text\">Single</span>\n        </li>\n        <li class=\"mdc-list-item\" role=\"menuitem\">\n          <span class=\"mdc-list-item__ripple\"></span>\n          <span class=\"mdc-list-item__graphic mdc-menu__selection-group-icon\">\n           ...\n          </span>\n          <span class=\"mdc-list-item__text\">1.15</span>\n        </li>\n      </ul>\n    </li>\n    <li class=\"mdc-list-divider\" role=\"separator\"></li>\n    <li class=\"mdc-list-item\" role=\"menuitem\">\n      <span class=\"mdc-list-item__ripple\"></span>\n      <span class=\"mdc-list-item__text\">Add space before paragraph</span>\n    </li>\n    ...\n  </ul>\n</div>\n```\n\n### Disabled Menu Items\n\nMenu items can be disabled by adding the `mdc-list-item--disabled` modifier class (from [MDC List](../mdc-list)).\nDisabled menu items will be excluded from keyboard navigation.\n\n### Anchors and Positioning\n\n#### Anchored To Parent\n\nThe menu can be positioned to automatically anchor to a parent element when opened.\n\n```html\n<div id=\"toolbar\" class=\"toolbar mdc-menu-surface--anchor\">\n  <div class=\"mdc-menu mdc-menu-surface\">\n  ...\n  </div>\n</div>\n```\n\n#### Anchor To Element Within Wrapper\n\nThe menu can be positioned to automatically anchor to another element, by wrapping the other element with the anchor class.\n\n```html\n<div id=\"demo-menu\" class=\"mdc-menu-surface--anchor\">\n  <button id=\"menu-button\">Open Menu</button>\n  <div class=\"mdc-menu mdc-menu-surface\">\n  ...\n  </div>\n</div>\n```\n\n#### Fixed Position\n\nThe menu can use fixed positioning when being displayed.\n\n```html\n<div class=\"mdc-menu mdc-menu-surface\">\n...\n</div>\n```\n\n```js\n// ...\nmenu.setFixedPosition(true);\n```\n\n#### Absolute Position\n\nThe menu can use absolutely positioned when being displayed.\n\n```html\n<div class=\"mdc-menu mdc-menu-surface\">\n...\n</div>\n```\n\n```js\n// ...\nmenu.setAbsolutePosition(100, 100);\n```\n\n## Style Customization\n\n### CSS Classes\n\nCSS Class | Description\n--- | ---\n`mdc-menu` | Required on the root element\n`mdc-menu-surface` | Required on the root element. See [`mdc-menu-surface` documentation](../mdc-menu-surface) for other `mdc-menu-surface` classes.\n`mdc-list` | Required on the nested `ul` element. See [`mdc-list` documentation](../mdc-list) for other `mdc-list` classes.\n`mdc-menu__selection-group` | Used to wrap a group of `mdc-list-item` elements that will represent a selection group.\n`mdc-menu__selection-group-icon` | Required when using a selection group to indicate which item is selected. Should contain an icon or svg that indicates the selected state of the list item.\n`mdc-menu-item--selected` | Used to indicate which element in a selection group is selected.\n\n### Sass Mixins\n\nMixin | Description\n--- | ---\n`width($width)` | Used to set the `width` of the menu. When used without units (e.g. `4` or `5`) it computes the `width` by multiplying by the base width (`56px`). When used with units (e.g. `240px`, `15%`, or `calc(200px + 10px)` it sets the `width` to the exact value provided.\n`min-width($min-width)` | Sets the `min-width` of the menu. Use with units (e.g. `240px`, `15%`, or `calc(200px + 10px)` only.\n\n> See [Menu Surface](../mdc-menu-surface/README.md#sass-mixins) and [List](../mdc-list/README.md#sass-mixins) documentation for additional style customization options.\n\n### Accessibility\n\nPlease see [Menu Button](https://www.w3.org/TR/wai-aria-practices/#menubutton) WAI-ARIA practices article for details on recommended Roles, States, and Properties for menu button (button that opens a menu).\n\nWith focus on the menu button:\n\n  * <kbd>Enter</kbd>, <kbd>Space</kbd> & <kbd>Down Arrow</kbd> opens the menu and places focus on the first menu item.\n  * <kbd>Up Arrow</kbd> opens the menu and moves focus to the last menu item.\n  * The focus is set to list root element (where `role=\"menu\"` is set) when clicked or touched. MDC List handles the keyboard navigation once it receives the focus.\n\nUse `setDefaultFocusState` method to set default focus state that will be focused every time when menu is opened.\n\nFocus state | Description\n--- | ---\n`DefaultFocusState.FIRST_ITEM` | Focuses the first menu item. Set this when menu button receives <kbd>Enter</kbd>, <kbd>Space</kbd>, <kbd>Down Arrow</kbd>.\n`DefaultFocusState.LAST_ITEM` | Focuses the last menu item. Set this when menu button receives <kbd>Up arrow</kbd>.\n`DefaultFocusState.LIST_ROOT` | Focuses the list root. Set this when menu button Clicked or Touched.\n`DefaultFocusState.NONE` | Does not change the focus. Set this if you do not want the menu to grab focus on open. (Autocomplete dropdown menu, for example).\n\n## `MDCMenu` Properties and Methods\n\nSee [Importing the JS component](../../docs/importing-js.md) for more information on how to import JavaScript.\n\nProperty | Value Type | Description\n--- | --- | ---\n`open` | Boolean | Proxies to the menu surface's `open` property.\n`items` | `Array<Element>` | Proxies to the list to query for all `.mdc-list-item` elements.\n`quickOpen` | Boolean | Proxies to the menu surface `quickOpen` property.\n`wrapFocus` | Boolean | Proxies to list's `wrapFocus` property.\n`hasTypeahead` | Boolean | Proxies to the list's `hasTypeahead` property.\n\nMethod Signature | Description\n--- | ---\n`setAnchorCorner(Corner) => void` | Proxies to the menu surface's `setAnchorCorner(Corner)` method.\n`setAnchorMargin(Partial<MDCMenuDistance>) => void` | Proxies to the menu surface's `setAnchorMargin(Partial<MDCMenuDistance>)` method.\n`setAbsolutePosition(x: number, y: number) => void` | Proxies to the menu surface's `setAbsolutePosition(x: number, y: number)` method.\n`setFixedPosition(isFixed: boolean) => void` | Proxies to the menu surface's `setFixedPosition(isFixed: boolean)` method.\n`setSelectedIndex(index: number) => void` | Sets the list item to the selected state at the specified index.\n`setIsHoisted(isHoisted: boolean) => void` | Proxies to the menu surface's `setIsHoisted(isHoisted: boolean)` method.\n`setAnchorElement(element: Element) => void` | Proxies to the menu surface's `setAnchorElement(element)` method.\n`getOptionByIndex(index: number) => Element \\| null` | Returns the list item at the `index` specified.\n`getPrimaryTextAtIndex(index: number) => string` | Returns the primary text at the `index` specified.\n`getDefaultFoundation() => MDCMenuFoundation` | Returns the foundation.\n`setDefaultFocusState(focusState: DefaultFocusState) => void` | Sets default focus state where the menu should focus every time when menu is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by default.\n`setEnabled(index: number, isEnabled: boolean) => void` | Sets the enabled state to `isEnabled` for the menu item at given `index`.\n`layout() => void` | Proxies to the list's layout method.\n`typeaheadMatchItem(nextChar: string) => number` | Adds a character to the typeahead buffer and returns index of the next item in the list matching the buffer.\n\n> See [Menu Surface](../mdc-menu-surface/README.md) and [List](../mdc-list/README.md) documentation for more information on proxied methods and properties.\n\n## Usage within Web Frameworks\n\nIf you are using a JavaScript framework, such as React or Angular, you can create a Menu for your framework. Depending on your needs, you can use the _Simple Approach: Wrapping MDC Web Vanilla Components_, or the _Advanced Approach: Using Foundations and Adapters_. Please follow the instructions [here](../../docs/integrating-into-frameworks.md).\n\n### `MDCMenuAdapter`\n\nMethod Signature | Description\n--- | ---\n`addClassToElementAtIndex(index: number, className: string) => void` | Adds the `className` class to the element at the `index` specified.\n`removeClassFromElementAtIndex(index: number, className: string) => void` | Removes the `className` class from the element at the `index` specified.\n`addAttributeToElementAtIndex(index: number, attr: string, value: string) => void` | Adds the `attr` attribute with value `value` to the element at the `index` specified.\n`removeAttributeFromElementAtIndex(index: number, attr: string) => void` | Removes the `attr` attribute from the element at the `index` specified.\n`elementContainsClass(element: Element, className: string) => boolean` | Returns true if the `element` contains the `className` class.\n`closeSurface(skipRestoreFocus?: boolean) => void` | Closes the menu surface, skipping restoring focus to the previously focused element if `skipRestoreFocus` is true.\n`getElementIndex(element: Element) => number` | Returns the `index` value of the `element`.\n`notifySelected(index: number) => void` | Emits a `MDCMenu:selected` event for the element at the `index` specified.\n`getMenuItemCount() => number` | Returns the menu item count.\n`focusItemAtIndex(index: number)` | Focuses the menu item at given index.\n`focusListRoot() => void` | Focuses the list root element.\n`getSelectedSiblingOfItemAtIndex(index: number) => number` | Returns selected list item index within the same selection group which is a sibling of item at given `index`.\n`isSelectableItemAtIndex(index: number) => boolean` | Returns true if menu item at specified index is contained within an `.mdc-menu__selection-group` element.\n\n### `MDCMenuFoundation`\n\nMethod Signature | Description\n--- | ---\n`handleKeydown(evt: Event) => void` | Event handler for the `keydown` events within the menu.\n`handleItemAction(listItem: Element) => void` | Event handler for list's action event.\n`handleMenuSurfaceOpened() => void` | Event handler for menu surface's opened event.\n`setDefaultFocusState(focusState: DefaultFocusState) => void` | Sets default focus state where the menu should focus every time when menu is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by default.\n`setSelectedIndex(index: number) => void` | Selects the list item at given `index`.\n`setEnabled(index: number, isEnabled: boolean) => void` | Sets the enabled state of the menu item at given `index`.\n\n### Events\n\nEvent Name | Data | Description\n--- | --- | ---\n`MDCMenu:selected` | `{detail: {item: Element, index: number}}` | Used to indicate when an element has been selected. This event also includes the item selected and the list index of that item.\n","gitHead":"fc6a6a59d9c86ac1f85efd94a4aa6a8e4c27c379","license":"MIT","_npmUser":{"name":"abhiomkar","email":"abhiomkar@gmail.com"},"homepage":"https://github.com/material-components/material-components-web#readme","keywords":["material components","material design","menu"],"repository":{"url":"git+https://github.com/material-components/material-components-web.git","type":"git","directory":"packages/mdc-menu"},"_npmVersion":"lerna/3.20.2/node@v10.24.1+x64 (linux)","description":"The Material Components for the web menu component","directories":{},"maintainers":[{"name":"material-admin","email":"aprigogin+npm@google.com"},{"name":"abhiomkar","email":"abhiomkar@gmail.com"},{"name":"azakus","email":"dfreedm2@gmail.com"},{"name":"bicknellr","email":"bicknellr@gmail.com"},{"name":"bwobrien","email":"obrien.test@gmail.com"},{"name":"lynnjepsen","email":"lynnjepsen@google.com"},{"name":"acdvorak","email":"acdvorak@gmail.com"},{"name":"kfranqueiro","email":"kenneth.franqueiro@gmail.com"},{"name":"aprigogin","email":"andrey.prigogin@gmail.com"},{"name":"patrickrodee","email":"prodee@google.com"},{"name":"bonniez","email":"bonniez@google.com"},{"name":"moog16","email":"mattgoo@gmail.com"},{"name":"williamernest","email":"williamernest@google.com"},{"name":"aomarks","email":"aomarks@gmail.com"},{"name":"emarquez","email":"emarquez@google.com"},{"name":"allanchen","email":"allanchen@google.com"},{"name":"esgonzalez","email":"esgonzalez@google.com"},{"name":"asyncliz","email":"asyncliz@gmail.com"},{"name":"candysonya","email":"wangchan518@gmail.com"},{"name":"ssuarez","email":"sayrisuarez@google.com"},{"name":"taylorv","email":"brian.t.vann@gmail.com"}],"sideEffects":false,"_nodeVersion":"10.24.1","dependencies":{"tslib":"^2.1.0","@material/dom":"13.0.0-canary.3dd611091.0","@material/rtl":"13.0.0-canary.3dd611091.0","@material/base":"13.0.0-canary.3dd611091.0","@material/list":"13.0.0-canary.3dd611091.0","@material/theme":"13.0.0-canary.3dd611091.0","@material/ripple":"13.0.0-canary.3dd611091.0","@material/elevation":"13.0.0-canary.3dd611091.0","@material/menu-surface":"13.0.0-canary.3dd611091.0","@material/feature-targeting":"13.0.0-canary.3dd611091.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/menu_13.0.0-canary.3dd611091.0_1628135889129_0.14463916584667547","host":"s3://npm-registry-packages"},"_id":"@material/menu@13.0.0-canary.3dd611091.0","version":"13.0.0-canary.3dd611091.0"}