{"bugs":{"url":"https://github.com/material-components/material-components-web/issues"},"dist":{"shasum":"ed2e6f2d98c1f6331f2cf3a3ebca8d81ff19d04b","tarball":"https://registry.npmjs.org/@material/menu-surface/-/menu-surface-12.0.0-canary.de48eff0d.0.tgz","fileCount":38,"integrity":"sha512-LP71Xf3Iq6eSmQTUVjb8VjoKAJwpVXuwoftyue0Srh2Cb60wb/Ovm+Sek1swIIUGU3N/2Rj3KzkWB51JY8rDOw==","signatures":[{"sig":"MEUCID4JWFBoCTopIXSM9G1W8mm6v98dJ5nbPWebzpZIySmBAiEAztX2Ng2TJMptVFVimSoN/TYVAfqTaLHIvW+dPnOO54c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":373784,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg8GusCRA9TVsSAnZWagAAmT0P/AzyErY2q7DTskfNzsjN\nV13/+delsRtAK11g94TF8vfwD8NFhIa/iT+hr4yMJTbNAZzEAsOmvODZ1lpA\nHrw+4/Z4jPEPIRCsAscLlI9+hCNsqNkhbV0Lj1DFBr5EWQiZ+xF2DixkAM9H\nQckKQ50VHubEfC7LfI2l1raV5teaJBNaVSvnfz87yaDjkMLcJ03O2q1fmptD\nP7d8bw6fHN7g+MfGetj976/wO4IxVLVbRDkCiiTwJwm3cy93F1pw1EnBn++X\nz2YdWzfYLWgf4R4yVVopgYLipjzjHP4lxfMY3HZWFiA0kul2e+KjlJ4wuIGM\nm5p8snvK+DaVOhNOdKyk2e2e3MGlc8S4hkMkqrfEdKUroUPe4ooU3r4rRksH\nCBz/ZpNK4S33ltpzM62OqlcSNo1H1Vw5RjaAL+/TY0cz0vZAQH9NOO1aPINM\nZyUzX3yVCp47iI7n+uGAGaBOe1VXzBKv0Bid0jx6Ye76RDb1p32W41SQ8LX7\nySHVV6UdGcoAtJHhRk/yeO0KFtiOrX6lgsUDYWgo4Q379xu0PQAxKKzUiNnP\n//0BAkvGFvxjFD0PBRq7bOMOqcT2xnIEMSo8vOO9g52q6fJNYMIO94kRPzjK\nJ1vXwobm1sq+UBAtAJ2hhyoULisL2It/UjcWr+oInOR2L/U2FH5hKDWu4qRJ\nkjQf\r\n=YXGa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/mdc.menuSurface.js","name":"@material/menu-surface","types":"dist/mdc.menuSurface.d.ts","module":"index.js","readme":"<!--docs:\ntitle: \"Menu Surface\"\nlayout: detail\nsection: components\nexcerpt: \"Material Design menu surface.\"\niconId: menu\npath: /catalog/menu-surface/\n-->\n\n# Menu Surface\n\nThe MDC Menu Surface component is a reusable surface that appears above the content of the\npage and can be positioned adjacent to an element. Menu Surfaces require JavaScript to properly position\nthemselves when opening.\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/guidelines/components/menus.html\">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-surface\n```\n\n## Usage\n\n### HTML Structure\n\n```html\n<div class=\"mdc-menu-surface\">\n...\n</div>\n```\n\n### Styles\n\n```css\n@use \"@material/menu-surface/mdc-menu-surface\";\n```\n\n### JavaScript Instantiation\n\n```js\nimport {MDCMenuSurface} from '@material/menu-surface';\n\nconst menuSurface = new MDCMenuSurface(document.querySelector('.mdc-menu-surface'));\n```\n\n> See [Importing the JS component](../../docs/importing-js.md) for more information on how to import JavaScript.\n\n\n## Variants\n\n### Anchors and Positioning\n\n#### Anchored To Parent\n\nThe menu surface 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-surface\">\n  ...\n  </div>\n</div>\n```\n\n#### Anchor To Element Within Wrapper\n\nThe menu surface can be positioned to automatically anchor to another element, by wrapping the other element with the anchor class.\n\n```html\n<div class=\"mdc-menu-surface--anchor\">\n  <button id=\"menu-surface-button\">Open Menu Surface</button>\n  <div class=\"mdc-menu-surface\">\n  ...\n  </div>\n</div>\n```\n\n#### Fixed Position\n\nThe menu surface can use fixed positioning when being displayed.\n\n```html\n<div class=\"mdc-menu-surface mdc-menu-surface--fixed\">\n...\n</div>\n```\n\nOr in JS:\n\n```js\n// ...\nmenuSurface.setFixedPosition(true);\n```\n\n#### Absolute Position\n\nThe menu surface can use absolute positioning when being displayed. This requires that the element containing the\nmenu has the `position: relative` style.\n\n```html\n<div class=\"mdc-menu-surface\">\n...\n</div>\n```\n\n```js\n// ...\nmenuSurface.setAbsolutePosition(100, 100);\n```\n\n## Style Customization\n\n### CSS Classes\n\nCSS Class | Description\n--- | ---\n`mdc-menu-surface` | Mandatory.\n`mdc-menu-surface--animating-open` | Indicates the menu surface is currently animating open. This class is removed once the animation completes.\n`mdc-menu-surface--open` | Indicates the menu surface is currently open, or is currently animating open.\n`mdc-menu-surface--animating-closed` | Indicates the menu surface is currently animating closed. This class is removed once the animation completes.\n`mdc-menu-surface--anchor` | Used to indicate which element the menu should be anchored to.\n`mdc-menu-surface--fixed` | Used to indicate that the menu is using fixed positioning.\n`mdc-menu-surface--fullwidth`| Sets the menu-surface's width to match that of its parent anchor. Do not use with `mdc-menu-surface--fixed` or if hoisting to body.\n\n### Sass Mixins\n\nMixin | Description\n--- | ---\n`ink-color($color)` | Sets the `color` property of the `mdc-menu-surface`.\n`fill-color($color)` | Sets the `background-color` property of the `mdc-menu-surface`.\n`shape-radius($radius, $rtl-reflexive)` | Sets the rounded shape to menu surface with given radius size. Set `$rtl-reflexive` to true to flip radius values in RTL context, defaults to false.\n\n## Constants & Types\n\nConstant Name | Description\n--- | ---\n`Corner` | Enum for representing an element corner for positioning the menu-surface. See [constants.ts](./constants.ts).\n\nType Name | Description\n--- | ---\n`MDCMenuDimensions` | Width/height of an element. See [types.ts](./types.ts).\n`MDCMenuDistance` | Margin values representing the distance from anchor point that the menu surface should be shown. See [types.ts](./types.ts).\n`MDCMenuPoint` | X/Y coordinates. See [types.ts](./types.ts).\n\n## `MDCMenuSurface` Properties and Methods\n\nProperty | Value Type | Description\n--- | --- | ---\n`quickOpen` | `boolean` | Proxies to the foundation's `setQuickOpen()` method.\n`anchorElement` | `Element` | Gets or sets the element that the surface is anchored to, or `null` if the surface is not anchored. Defaults to the root element's parent `mdc-menu-surface--anchor` element if present.\n\nMethod Signature | Description\n--- | ---\n`isOpen() => boolean` | Proxies to the foundation's `isOpen` method.\n`open() => void` | Proxies to the foundation's `open` method.\n`close(skipRestoreFocus: boolean) => void` | Proxies to the foundation's `close` method.\n`setAnchorCorner(Corner) => void` | Proxies to the foundation's `setAnchorCorner(Corner)` method.\n`setAnchorMargin(Partial<MDCMenuDistance>) => void` | Proxies to the foundation's `setAnchorMargin(Partial<MDCMenuDistance>)` method.\n`setFixedPosition(isFixed: boolean) => void` | Adds the `mdc-menu-surface--fixed` class to the `mdc-menu-surface` element. Proxies to the foundation's `setIsHoisted()` and `setFixedPosition()` methods.\n`setAbsolutePosition(x: number, y: number) => void` | Proxies to the foundation's `setAbsolutePosition(x, y)` method. Used to set the absolute x/y position of the menu on the page. Should only be used when the menu is hoisted to the body.\n`setMenuSurfaceAnchorElement(element: Element) => void` | Sets the element used as an anchor for `menu-surface` positioning logic.\n`setIsHoisted() => void` | Proxies to the foundation's `setIsHoisted` method.\n`getDefaultFoundation() => MDCMenuSurfaceFoundation` | Returns the foundation.\n\n### Events\n\nEvent Name | Data | Description\n--- | --- | ---\n`MDCMenuSurface:closed` | none | Event emitted after the menu surface is closed.\n`MDCMenuSurface:closing` | none | Event emitted when the menu surface is closing, but animation may not have completed yet.\n`MDCMenuSurface:opened` | none | Event emitted after the menu surface is opened.\n\n## Usage Within Frameworks\n\nIf you are using a JavaScript framework, such as React or Angular, you can create a Menu Surface 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### `MDCMenuSurfaceAdapter`\n\nMethod Signature | Description\n--- | ---\n`addClass(className: string) => void` | Adds a class to the root element.\n`removeClass(className: string) => void` | Removes a class from the root element.\n`hasClass(className: string) => boolean` | Returns a boolean indicating whether the root element has a given class.\n`hasAnchor: () => boolean` | Returns whether the menu surface has an anchor for positioning.\n`notifyClose() => void` | Dispatches an event notifying listeners that the menu surface has been closed.\n`notifyOpen() => void` | Dispatches an event notifying listeners that the menu surface has been opened.\n`isElementInContainer(el: Element) => boolean` | Returns true if the `el` Element is inside the `mdc-menu-surface` container.\n`isRtl() => boolean` | Returns boolean indicating whether the current environment is RTL.\n`setTransformOrigin(value: string) => void` | Sets the transform origin for the menu surface element.\n`isFocused() => boolean` | Returns a boolean value indicating whether the root element of the menu surface is focused.\n`saveFocus() => void` | Stores the currently focused element on the document, for restoring with `restoreFocus`.\n`restoreFocus() => void` | Restores the previously saved focus state, by making the previously focused element the active focus again.\n`getInnerDimensions() => MDCMenuDimensions` | Returns an object with the items container width and height.\n`getAnchorDimensions() => ClientRect \\| null` | Returns an object with the dimensions and position of the anchor.\n`getBodyDimensions() => MDCMenuDimensions` | Returns an object with width and height of the body, in pixels.\n`getWindowDimensions() => MDCMenuDimensions` | Returns an object with width and height of the viewport, in pixels.\n`getWindowScroll() => MDCMenuPoint` | Returns an object with the amount the body has been scrolled on the `x` and `y` axis.\n`setPosition(position: Partial<MDCMenuDistance>) => void` | Sets the position of the menu surface element.\n`setMaxHeight(value: string) => void` | Sets `max-height` style for the menu surface element.\n\n### `MDCMenuSurfaceFoundation`\n\nMethod Signature | Description\n--- | ---\n`setAnchorCorner(corner: Corner) => void` | Sets the corner that the menu surface will be anchored to. See [constants.ts](./constants.ts)\n`setAnchorMargin(margin: Partial<MDCMenuDistance>) => void` | Sets the distance from the anchor point that the menu surface should be shown.\n`setIsHoisted(isHoisted: boolean) => void` | Sets whether the menu surface has been hoisted to the body so that the offsets are calculated relative to the page and not the anchor.\n`setFixedPosition(isFixed: boolean) => void` | Sets whether the menu surface is using fixed positioning.\n`setAbsolutePosition(x: number, y: number) => void` | Sets the absolute x/y position of the menu. Should only be used when the menu is hoisted or using fixed positioning.\n`handleBodyClick(event: MouseEvent) => void` | Method used as the callback function for the `click` event.\n`handleKeydown(event: KeyboardEvent) => void` | Method used as the callback function for the `keydown` events.\n`open() => void` | Opens the menu surface.\n`close() => void` | Closes the menu.\n`isOpen() => boolean` | Returns a boolean indicating whether the menu surface is open.\n`setQuickOpen(quickOpen: boolean) => void` | Sets whether the menu surface should open and close without animation when the `open`/`close` methods are called.\n","gitHead":"121530dfc073c7b24dc1cb75732a0d4c0e6a3f28","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 surface"],"repository":{"url":"git+https://github.com/material-components/material-components-web.git","type":"git","directory":"packages/mdc-menu-surface"},"_npmVersion":"lerna/3.20.2/node@v10.24.1+x64 (linux)","description":"The Material Components for the web menu surface component","directories":{},"maintainers":[{"name":"abhiomkar","email":"abhiomkar@gmail.com"},{"name":"azakus","email":"dfreedm2@gmail.com"},{"name":"bicknellr","email":"bicknellr@gmail.com"},{"name":"material-admin","email":"aprigogin+npm@google.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/rtl":"12.0.0-canary.de48eff0d.0","@material/base":"12.0.0-canary.de48eff0d.0","@material/shape":"12.0.0-canary.de48eff0d.0","@material/theme":"12.0.0-canary.de48eff0d.0","@material/animation":"12.0.0-canary.de48eff0d.0","@material/elevation":"12.0.0-canary.de48eff0d.0","@material/feature-targeting":"12.0.0-canary.de48eff0d.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/menu-surface_12.0.0-canary.de48eff0d.0_1626368940611_0.5094058743276315","host":"s3://npm-registry-packages"},"_id":"@material/menu-surface@12.0.0-canary.de48eff0d.0","version":"12.0.0-canary.de48eff0d.0"}