Socket
Socket
Sign inDemoInstall

@material/menu-surface

Package Overview
Dependencies
Maintainers
13
Versions
1656
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/menu-surface - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0-alpha.0

11

CHANGELOG.md

@@ -6,13 +6,12 @@ # Change Log

# [3.0.0](https://github.com/material-components/material-components-web/compare/v2.3.1...v3.0.0) (2019-06-25)
# [3.1.0-alpha.0](https://github.com/material-components/material-components-web/compare/v3.0.0...v3.1.0-alpha.0) (2019-07-16)
**Note:** Version bump only for package @material/menu-surface
### Bug Fixes
* **menu:** Fix bug where TAB does not respect the default browser tab order. ([#4789](https://github.com/material-components/material-components-web/issues/4789)) ([22237cd](https://github.com/material-components/material-components-web/commit/22237cd))
* **menu:** Remove code to focus on first/last element on TAB/SHIFT+TAB. ([#4786](https://github.com/material-components/material-components-web/issues/4786)) ([d3f8cb3](https://github.com/material-components/material-components-web/commit/d3f8cb3))
### BREAKING CHANGES
* **menu:** The following adapter methods were removed: isFirstElementFocused, isLastElementFocused, focusFirstElement, focusLastElement. The following functionality to handle TAB on menusurface has been removed: "If TAB and last element is focused => Focus on first element", "If SHIFT + TAB and first element is focused => Focus on last element"
# [3.1.0](https://github.com/material-components/material-components-web/compare/v3.0.0...v3.1.0) (2019-07-16)
**Note:** Version bump only for package @material/menu-surface
// Generated by dts-bundle v0.7.3
// Dependencies for this module:
// ../../../@material/base/component
// ../../../@material/base/foundation
// ../../@material/base/component
// ../../@material/base/foundation

@@ -6,0 +6,0 @@ declare module '@material/menu-surface' {

@@ -9,943 +9,1312 @@ /**

(function webpackUniversalModuleDefinition(root, factory) {
if (typeof exports === "object" && typeof module === "object") module.exports = factory(); else if (typeof define === "function" && define.amd) define([], factory); else if (typeof exports === "object") exports["menuSurface"] = factory(); else root["mdc"] = root["mdc"] || {},
root["mdc"]["menuSurface"] = factory();
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["menuSurface"] = factory();
else
root["mdc"] = root["mdc"] || {}, root["mdc"]["menuSurface"] = factory();
})(this, function() {
return function(modules) {
var installedModules = {};
function __webpack_require__(moduleId) {
if (installedModules[moduleId]) {
return installedModules[moduleId].exports;
}
var module = installedModules[moduleId] = {
i: moduleId,
l: false,
exports: {}
};
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
module.l = true;
return module.exports;
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./packages/mdc-menu-surface/index.ts");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./packages/mdc-base/component.ts":
/*!****************************************!*\
!*** ./packages/mdc-base/component.ts ***!
\****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var __read = this && this.__read || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o),
r,
ar = [],
e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
ar.push(r.value);
}
__webpack_require__.m = modules;
__webpack_require__.c = installedModules;
__webpack_require__.d = function(exports, name, getter) {
if (!__webpack_require__.o(exports, name)) {
Object.defineProperty(exports, name, {
configurable: false,
enumerable: true,
get: getter
});
} catch (error) {
e = { error: error };
} finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
} finally {
if (e) throw e.error;
}
}
return ar;
};
var __spread = this && this.__spread || function () {
for (var ar = [], i = 0; i < arguments.length; i++) {
ar = ar.concat(__read(arguments[i]));
}return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts");
var MDCComponent = /** @class */function () {
function MDCComponent(root, foundation) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
this.root_ = root;
this.initialize.apply(this, __spread(args));
// Note that we initialize foundation here and not within the constructor's default param so that
// this.root_ is defined and can be used within the foundation class.
this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation;
this.foundation_.init();
this.initialSyncWithDOM();
}
MDCComponent.attachTo = function (root) {
// Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
// returns an instantiated component with its root set to that element. Also note that in the cases of
// subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
// from getDefaultFoundation().
return new MDCComponent(root, new foundation_1.MDCFoundation({}));
};
/* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
MDCComponent.prototype.initialize = function () {
var _args = [];
for (var _i = 0; _i < arguments.length; _i++) {
_args[_i] = arguments[_i];
}
// Subclasses can override this to do any additional setup work that would be considered part of a
// "constructor". Essentially, it is a hook into the parent constructor before the foundation is
// initialized. Any additional arguments besides root and foundation will be passed in here.
};
MDCComponent.prototype.getDefaultFoundation = function () {
// Subclasses must override this method to return a properly configured foundation class for the
// component.
throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
};
MDCComponent.prototype.initialSyncWithDOM = function () {
// Subclasses should override this method if they need to perform work to synchronize with a host DOM
// object. An example of this would be a form control wrapper that needs to synchronize its internal state
// to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
// reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
};
MDCComponent.prototype.destroy = function () {
// Subclasses may implement this method to release any resources / deregister any listeners they have
// attached. An example of this might be deregistering a resize event from the window object.
this.foundation_.destroy();
};
MDCComponent.prototype.listen = function (evtType, handler, options) {
this.root_.addEventListener(evtType, handler, options);
};
MDCComponent.prototype.unlisten = function (evtType, handler, options) {
this.root_.removeEventListener(evtType, handler, options);
};
/**
* Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
*/
MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
if (shouldBubble === void 0) {
shouldBubble = false;
}
var evt;
if (typeof CustomEvent === 'function') {
evt = new CustomEvent(evtType, {
bubbles: shouldBubble,
detail: evtData
});
} else {
evt = document.createEvent('CustomEvent');
evt.initCustomEvent(evtType, shouldBubble, false, evtData);
}
this.root_.dispatchEvent(evt);
};
return MDCComponent;
}();
exports.MDCComponent = MDCComponent;
// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
exports.default = MDCComponent;
/***/ }),
/***/ "./packages/mdc-base/foundation.ts":
/*!*****************************************!*\
!*** ./packages/mdc-base/foundation.ts ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var MDCFoundation = /** @class */function () {
function MDCFoundation(adapter) {
if (adapter === void 0) {
adapter = {};
}
this.adapter_ = adapter;
}
Object.defineProperty(MDCFoundation, "cssClasses", {
get: function get() {
// Classes extending MDCFoundation should implement this method to return an object which exports every
// CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
return {};
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCFoundation, "strings", {
get: function get() {
// Classes extending MDCFoundation should implement this method to return an object which exports all
// semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
return {};
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCFoundation, "numbers", {
get: function get() {
// Classes extending MDCFoundation should implement this method to return an object which exports all
// of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
return {};
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCFoundation, "defaultAdapter", {
get: function get() {
// Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
// way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
// validation.
return {};
},
enumerable: true,
configurable: true
});
MDCFoundation.prototype.init = function () {
// Subclasses should override this method to perform initialization routines (registering events, etc.)
};
MDCFoundation.prototype.destroy = function () {
// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
};
return MDCFoundation;
}();
exports.MDCFoundation = MDCFoundation;
// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
exports.default = MDCFoundation;
/***/ }),
/***/ "./packages/mdc-menu-surface/component.ts":
/*!************************************************!*\
!*** ./packages/mdc-menu-surface/component.ts ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var __extends = this && this.__extends || function () {
var _extendStatics = function extendStatics(d, b) {
_extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
d.__proto__ = b;
} || function (d, b) {
for (var p in b) {
if (b.hasOwnProperty(p)) d[p] = b[p];
}
};
__webpack_require__.n = function(module) {
var getter = module && module.__esModule ? function getDefault() {
return module["default"];
} : function getModuleExports() {
return module;
};
__webpack_require__.d(getter, "a", getter);
return getter;
return _extendStatics(d, b);
};
return function (d, b) {
_extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
}();
var __importStar = this && this.__importStar || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) {
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
}result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts");
var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts");
var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-menu-surface/util.ts"));
var MDCMenuSurface = /** @class */function (_super) {
__extends(MDCMenuSurface, _super);
function MDCMenuSurface() {
return _super !== null && _super.apply(this, arguments) || this;
}
MDCMenuSurface.attachTo = function (root) {
return new MDCMenuSurface(root);
};
MDCMenuSurface.prototype.initialSyncWithDOM = function () {
var _this = this;
var parentEl = this.root_.parentElement;
this.anchorElement = parentEl && parentEl.classList.contains(constants_1.cssClasses.ANCHOR) ? parentEl : null;
if (this.root_.classList.contains(constants_1.cssClasses.FIXED)) {
this.setFixedPosition(true);
}
this.handleKeydown_ = function (evt) {
return _this.foundation_.handleKeydown(evt);
};
__webpack_require__.o = function(object, property) {
return Object.prototype.hasOwnProperty.call(object, property);
this.handleBodyClick_ = function (evt) {
return _this.foundation_.handleBodyClick(evt);
};
__webpack_require__.p = "";
return __webpack_require__(__webpack_require__.s = 134);
}({
0: function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var MDCFoundation = function() {
function MDCFoundation(adapter) {
if (adapter === void 0) {
adapter = {};
this.registerBodyClickListener_ = function () {
return document.body.addEventListener('click', _this.handleBodyClick_);
};
this.deregisterBodyClickListener_ = function () {
return document.body.removeEventListener('click', _this.handleBodyClick_);
};
this.listen('keydown', this.handleKeydown_);
this.listen(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener_);
this.listen(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener_);
};
MDCMenuSurface.prototype.destroy = function () {
this.unlisten('keydown', this.handleKeydown_);
this.unlisten(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener_);
this.unlisten(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener_);
_super.prototype.destroy.call(this);
};
MDCMenuSurface.prototype.isOpen = function () {
return this.foundation_.isOpen();
};
MDCMenuSurface.prototype.open = function () {
this.foundation_.open();
};
MDCMenuSurface.prototype.close = function (skipRestoreFocus) {
if (skipRestoreFocus === void 0) {
skipRestoreFocus = false;
}
this.foundation_.close(skipRestoreFocus);
};
Object.defineProperty(MDCMenuSurface.prototype, "quickOpen", {
set: function set(quickOpen) {
this.foundation_.setQuickOpen(quickOpen);
},
enumerable: true,
configurable: true
});
/**
* Removes the menu-surface from it's current location and appends it to the
* body to overcome any overflow:hidden issues.
*/
MDCMenuSurface.prototype.hoistMenuToBody = function () {
document.body.appendChild(this.root_);
this.setIsHoisted(true);
};
/** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */
MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) {
this.foundation_.setIsHoisted(isHoisted);
};
/** Sets the element that the menu-surface is anchored to. */
MDCMenuSurface.prototype.setMenuSurfaceAnchorElement = function (element) {
this.anchorElement = element;
};
/** Sets the menu-surface to position: fixed. */
MDCMenuSurface.prototype.setFixedPosition = function (isFixed) {
if (isFixed) {
this.root_.classList.add(constants_1.cssClasses.FIXED);
} else {
this.root_.classList.remove(constants_1.cssClasses.FIXED);
}
this.foundation_.setFixedPosition(isFixed);
};
/** Sets the absolute x/y position to position based on. Requires the menu to be hoisted. */
MDCMenuSurface.prototype.setAbsolutePosition = function (x, y) {
this.foundation_.setAbsolutePosition(x, y);
this.setIsHoisted(true);
};
/**
* @param corner Default anchor corner alignment of top-left surface corner.
*/
MDCMenuSurface.prototype.setAnchorCorner = function (corner) {
this.foundation_.setAnchorCorner(corner);
};
MDCMenuSurface.prototype.setAnchorMargin = function (margin) {
this.foundation_.setAnchorMargin(margin);
};
MDCMenuSurface.prototype.getDefaultFoundation = function () {
var _this = this;
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
var adapter = {
addClass: function addClass(className) {
return _this.root_.classList.add(className);
},
removeClass: function removeClass(className) {
return _this.root_.classList.remove(className);
},
hasClass: function hasClass(className) {
return _this.root_.classList.contains(className);
},
hasAnchor: function hasAnchor() {
return !!_this.anchorElement;
},
notifyClose: function notifyClose() {
return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT, {});
},
notifyOpen: function notifyOpen() {
return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, {});
},
isElementInContainer: function isElementInContainer(el) {
return _this.root_.contains(el);
},
isRtl: function isRtl() {
return getComputedStyle(_this.root_).getPropertyValue('direction') === 'rtl';
},
setTransformOrigin: function setTransformOrigin(origin) {
var propertyName = util.getTransformPropertyName(window) + "-origin";
_this.root_.style.setProperty(propertyName, origin);
},
isFocused: function isFocused() {
return document.activeElement === _this.root_;
},
saveFocus: function saveFocus() {
_this.previousFocus_ = document.activeElement;
},
restoreFocus: function restoreFocus() {
if (_this.root_.contains(document.activeElement)) {
if (_this.previousFocus_ && _this.previousFocus_.focus) {
_this.previousFocus_.focus();
}
this.adapter_ = adapter;
}
Object.defineProperty(MDCFoundation, "cssClasses", {
get: function get() {
return {};
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCFoundation, "strings", {
get: function get() {
return {};
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCFoundation, "numbers", {
get: function get() {
return {};
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCFoundation, "defaultAdapter", {
get: function get() {
return {};
},
enumerable: true,
configurable: true
});
MDCFoundation.prototype.init = function() {};
MDCFoundation.prototype.destroy = function() {};
return MDCFoundation;
}();
exports.MDCFoundation = MDCFoundation;
exports.default = MDCFoundation;
},
getInnerDimensions: function getInnerDimensions() {
return { width: _this.root_.offsetWidth, height: _this.root_.offsetHeight };
},
getAnchorDimensions: function getAnchorDimensions() {
return _this.anchorElement ? _this.anchorElement.getBoundingClientRect() : null;
},
getWindowDimensions: function getWindowDimensions() {
return { width: window.innerWidth, height: window.innerHeight };
},
getBodyDimensions: function getBodyDimensions() {
return { width: document.body.clientWidth, height: document.body.clientHeight };
},
getWindowScroll: function getWindowScroll() {
return { x: window.pageXOffset, y: window.pageYOffset };
},
setPosition: function setPosition(position) {
_this.root_.style.left = 'left' in position ? position.left + "px" : '';
_this.root_.style.right = 'right' in position ? position.right + "px" : '';
_this.root_.style.top = 'top' in position ? position.top + "px" : '';
_this.root_.style.bottom = 'bottom' in position ? position.bottom + "px" : '';
},
setMaxHeight: function setMaxHeight(height) {
_this.root_.style.maxHeight = height;
}
};
// tslint:enable:object-literal-sort-keys
return new foundation_1.MDCMenuSurfaceFoundation(adapter);
};
return MDCMenuSurface;
}(component_1.MDCComponent);
exports.MDCMenuSurface = MDCMenuSurface;
/***/ }),
/***/ "./packages/mdc-menu-surface/constants.ts":
/*!************************************************!*\
!*** ./packages/mdc-menu-surface/constants.ts ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var cssClasses = {
ANCHOR: 'mdc-menu-surface--anchor',
ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed',
ANIMATING_OPEN: 'mdc-menu-surface--animating-open',
FIXED: 'mdc-menu-surface--fixed',
OPEN: 'mdc-menu-surface--open',
ROOT: 'mdc-menu-surface'
};
exports.cssClasses = cssClasses;
// tslint:disable:object-literal-sort-keys
var strings = {
CLOSED_EVENT: 'MDCMenuSurface:closed',
OPENED_EVENT: 'MDCMenuSurface:opened',
FOCUSABLE_ELEMENTS: ['button:not(:disabled)', '[href]:not([aria-disabled="true"])', 'input:not(:disabled)', 'select:not(:disabled)', 'textarea:not(:disabled)', '[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(', ')
};
exports.strings = strings;
// tslint:enable:object-literal-sort-keys
var numbers = {
/** Total duration of menu-surface open animation. */
TRANSITION_OPEN_DURATION: 120,
/** Total duration of menu-surface close animation. */
TRANSITION_CLOSE_DURATION: 75,
/** Margin left to the edge of the viewport when menu-surface is at maximum possible height. */
MARGIN_TO_EDGE: 32,
/** Ratio of anchor width to menu-surface width for switching from corner positioning to center positioning. */
ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67
};
exports.numbers = numbers;
/**
* Enum for bits in the {@see Corner) bitmap.
*/
var CornerBit;
(function (CornerBit) {
CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
})(CornerBit || (CornerBit = {}));
exports.CornerBit = CornerBit;
/**
* Enum for representing an element corner for positioning the menu-surface.
*
* The START constants map to LEFT if element directionality is left
* to right and RIGHT if the directionality is right to left.
* Likewise END maps to RIGHT or LEFT depending on the directionality.
*/
var Corner;
(function (Corner) {
Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
Corner[Corner["TOP_START"] = 8] = "TOP_START";
Corner[Corner["TOP_END"] = 12] = "TOP_END";
Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
})(Corner || (Corner = {}));
exports.Corner = Corner;
/***/ }),
/***/ "./packages/mdc-menu-surface/foundation.ts":
/*!*************************************************!*\
!*** ./packages/mdc-menu-surface/foundation.ts ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var __extends = this && this.__extends || function () {
var _extendStatics = function extendStatics(d, b) {
_extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
d.__proto__ = b;
} || function (d, b) {
for (var p in b) {
if (b.hasOwnProperty(p)) d[p] = b[p];
}
};
return _extendStatics(d, b);
};
return function (d, b) {
_extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
}();
var __assign = this && this.__assign || function () {
__assign = Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
}
return t;
};
return __assign.apply(this, arguments);
};
var __values = this && this.__values || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator],
i = 0;
if (m) return m.call(o);
return {
next: function next() {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });
var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts");
var MDCMenuSurfaceFoundation = /** @class */function (_super) {
__extends(MDCMenuSurfaceFoundation, _super);
function MDCMenuSurfaceFoundation(adapter) {
var _this = _super.call(this, __assign({}, MDCMenuSurfaceFoundation.defaultAdapter, adapter)) || this;
_this.isOpen_ = false;
_this.isQuickOpen_ = false;
_this.isHoistedElement_ = false;
_this.isFixedPosition_ = false;
_this.openAnimationEndTimerId_ = 0;
_this.closeAnimationEndTimerId_ = 0;
_this.animationRequestId_ = 0;
_this.anchorCorner_ = constants_1.Corner.TOP_START;
_this.anchorMargin_ = { top: 0, right: 0, bottom: 0, left: 0 };
_this.position_ = { x: 0, y: 0 };
return _this;
}
Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", {
get: function get() {
return constants_1.cssClasses;
},
1: function(module, exports, __webpack_require__) {
"use strict";
var __read = this && this.__read || function(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
ar.push(r.value);
}
} catch (error) {
e = {
error: error
};
} finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
} finally {
if (e) throw e.error;
}
enumerable: true,
configurable: true
});
Object.defineProperty(MDCMenuSurfaceFoundation, "strings", {
get: function get() {
return constants_1.strings;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", {
get: function get() {
return constants_1.numbers;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", {
get: function get() {
return constants_1.Corner;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", {
/**
* @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types.
*/
get: function get() {
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
return {
addClass: function addClass() {
return undefined;
},
removeClass: function removeClass() {
return undefined;
},
hasClass: function hasClass() {
return false;
},
hasAnchor: function hasAnchor() {
return false;
},
isElementInContainer: function isElementInContainer() {
return false;
},
isFocused: function isFocused() {
return false;
},
isRtl: function isRtl() {
return false;
},
getInnerDimensions: function getInnerDimensions() {
return { height: 0, width: 0 };
},
getAnchorDimensions: function getAnchorDimensions() {
return null;
},
getWindowDimensions: function getWindowDimensions() {
return { height: 0, width: 0 };
},
getBodyDimensions: function getBodyDimensions() {
return { height: 0, width: 0 };
},
getWindowScroll: function getWindowScroll() {
return { x: 0, y: 0 };
},
setPosition: function setPosition() {
return undefined;
},
setMaxHeight: function setMaxHeight() {
return undefined;
},
setTransformOrigin: function setTransformOrigin() {
return undefined;
},
saveFocus: function saveFocus() {
return undefined;
},
restoreFocus: function restoreFocus() {
return undefined;
},
notifyClose: function notifyClose() {
return undefined;
},
notifyOpen: function notifyOpen() {
return undefined;
}
return ar;
};
var __spread = this && this.__spread || function() {
for (var ar = [], i = 0; i < arguments.length; i++) {
ar = ar.concat(__read(arguments[i]));
}
return ar;
};
Object.defineProperty(exports, "__esModule", {
value: true
});
var foundation_1 = __webpack_require__(0);
var MDCComponent = function() {
function MDCComponent(root, foundation) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
this.root_ = root;
this.initialize.apply(this, __spread(args));
this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation;
this.foundation_.init();
this.initialSyncWithDOM();
}
MDCComponent.attachTo = function(root) {
return new MDCComponent(root, new foundation_1.MDCFoundation({}));
};
MDCComponent.prototype.initialize = function() {
var _args = [];
for (var _i = 0; _i < arguments.length; _i++) {
_args[_i] = arguments[_i];
}
};
MDCComponent.prototype.getDefaultFoundation = function() {
throw new Error("Subclasses must override getDefaultFoundation to return a properly configured " + "foundation class");
};
MDCComponent.prototype.initialSyncWithDOM = function() {};
MDCComponent.prototype.destroy = function() {
this.foundation_.destroy();
};
MDCComponent.prototype.listen = function(evtType, handler, options) {
this.root_.addEventListener(evtType, handler, options);
};
MDCComponent.prototype.unlisten = function(evtType, handler, options) {
this.root_.removeEventListener(evtType, handler, options);
};
MDCComponent.prototype.emit = function(evtType, evtData, shouldBubble) {
if (shouldBubble === void 0) {
shouldBubble = false;
}
var evt;
if (typeof CustomEvent === "function") {
evt = new CustomEvent(evtType, {
bubbles: shouldBubble,
detail: evtData
});
} else {
evt = document.createEvent("CustomEvent");
evt.initCustomEvent(evtType, shouldBubble, false, evtData);
}
this.root_.dispatchEvent(evt);
};
return MDCComponent;
}();
exports.MDCComponent = MDCComponent;
exports.default = MDCComponent;
// tslint:enable:object-literal-sort-keys
},
13: function(module, exports, __webpack_require__) {
"use strict";
var __extends = this && this.__extends || function() {
var _extendStatics = function extendStatics(d, b) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d, b) {
d.__proto__ = b;
} || function(d, b) {
for (var p in b) {
if (b.hasOwnProperty(p)) d[p] = b[p];
}
};
return _extendStatics(d, b);
};
return function(d, b) {
_extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
}();
var __assign = this && this.__assign || function() {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
}
return t;
};
return __assign.apply(this, arguments);
};
var __values = this && this.__values || function(o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function next() {
if (o && i >= o.length) o = void 0;
return {
value: o && o[i++],
done: !o
};
}
};
};
Object.defineProperty(exports, "__esModule", {
value: true
});
var foundation_1 = __webpack_require__(0);
var constants_1 = __webpack_require__(9);
var MDCMenuSurfaceFoundation = function(_super) {
__extends(MDCMenuSurfaceFoundation, _super);
function MDCMenuSurfaceFoundation(adapter) {
var _this = _super.call(this, __assign({}, MDCMenuSurfaceFoundation.defaultAdapter, adapter)) || this;
_this.isOpen_ = false;
_this.isQuickOpen_ = false;
_this.isHoistedElement_ = false;
_this.isFixedPosition_ = false;
enumerable: true,
configurable: true
});
MDCMenuSurfaceFoundation.prototype.init = function () {
var _a = MDCMenuSurfaceFoundation.cssClasses,
ROOT = _a.ROOT,
OPEN = _a.OPEN;
if (!this.adapter_.hasClass(ROOT)) {
throw new Error(ROOT + " class required in root element.");
}
if (this.adapter_.hasClass(OPEN)) {
this.isOpen_ = true;
}
};
MDCMenuSurfaceFoundation.prototype.destroy = function () {
clearTimeout(this.openAnimationEndTimerId_);
clearTimeout(this.closeAnimationEndTimerId_);
// Cancel any currently running animations.
cancelAnimationFrame(this.animationRequestId_);
};
/**
* @param corner Default anchor corner alignment of top-left menu surface corner.
*/
MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) {
this.anchorCorner_ = corner;
};
/**
* @param margin Set of margin values from anchor.
*/
MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) {
this.anchorMargin_.top = margin.top || 0;
this.anchorMargin_.right = margin.right || 0;
this.anchorMargin_.bottom = margin.bottom || 0;
this.anchorMargin_.left = margin.left || 0;
};
/** Used to indicate if the menu-surface is hoisted to the body. */
MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) {
this.isHoistedElement_ = isHoisted;
};
/** Used to set the menu-surface calculations based on a fixed position menu. */
MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) {
this.isFixedPosition_ = isFixedPosition;
};
/** Sets the menu-surface position on the page. */
MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) {
this.position_.x = this.isFinite_(x) ? x : 0;
this.position_.y = this.isFinite_(y) ? y : 0;
};
MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) {
this.isQuickOpen_ = quickOpen;
};
MDCMenuSurfaceFoundation.prototype.isOpen = function () {
return this.isOpen_;
};
/**
* Open the menu surface.
*/
MDCMenuSurfaceFoundation.prototype.open = function () {
var _this = this;
this.adapter_.saveFocus();
if (!this.isQuickOpen_) {
this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
}
this.animationRequestId_ = requestAnimationFrame(function () {
_this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
_this.dimensions_ = _this.adapter_.getInnerDimensions();
_this.autoPosition_();
if (_this.isQuickOpen_) {
_this.adapter_.notifyOpen();
} else {
_this.openAnimationEndTimerId_ = setTimeout(function () {
_this.openAnimationEndTimerId_ = 0;
_this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
_this.adapter_.notifyOpen();
}, constants_1.numbers.TRANSITION_OPEN_DURATION);
}
});
this.isOpen_ = true;
};
/**
* Closes the menu surface.
*/
MDCMenuSurfaceFoundation.prototype.close = function (skipRestoreFocus) {
var _this = this;
if (skipRestoreFocus === void 0) {
skipRestoreFocus = false;
}
if (!this.isQuickOpen_) {
this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
}
requestAnimationFrame(function () {
_this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
if (_this.isQuickOpen_) {
_this.adapter_.notifyClose();
} else {
_this.closeAnimationEndTimerId_ = setTimeout(function () {
_this.closeAnimationEndTimerId_ = 0;
_this.animationRequestId_ = 0;
_this.anchorCorner_ = constants_1.Corner.TOP_START;
_this.anchorMargin_ = {
top: 0,
right: 0,
bottom: 0,
left: 0
};
_this.position_ = {
x: 0,
y: 0
};
return _this;
}
Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", {
get: function get() {
return constants_1.cssClasses;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCMenuSurfaceFoundation, "strings", {
get: function get() {
return constants_1.strings;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", {
get: function get() {
return constants_1.numbers;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", {
get: function get() {
return constants_1.Corner;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", {
get: function get() {
return {
addClass: function addClass() {
return undefined;
},
removeClass: function removeClass() {
return undefined;
},
hasClass: function hasClass() {
return false;
},
hasAnchor: function hasAnchor() {
return false;
},
isElementInContainer: function isElementInContainer() {
return false;
},
isFocused: function isFocused() {
return false;
},
isRtl: function isRtl() {
return false;
},
getInnerDimensions: function getInnerDimensions() {
return {
height: 0,
width: 0
};
},
getAnchorDimensions: function getAnchorDimensions() {
return null;
},
getWindowDimensions: function getWindowDimensions() {
return {
height: 0,
width: 0
};
},
getBodyDimensions: function getBodyDimensions() {
return {
height: 0,
width: 0
};
},
getWindowScroll: function getWindowScroll() {
return {
x: 0,
y: 0
};
},
setPosition: function setPosition() {
return undefined;
},
setMaxHeight: function setMaxHeight() {
return undefined;
},
setTransformOrigin: function setTransformOrigin() {
return undefined;
},
saveFocus: function saveFocus() {
return undefined;
},
restoreFocus: function restoreFocus() {
return undefined;
},
notifyClose: function notifyClose() {
return undefined;
},
notifyOpen: function notifyOpen() {
return undefined;
}
};
},
enumerable: true,
configurable: true
});
MDCMenuSurfaceFoundation.prototype.init = function() {
var _a = MDCMenuSurfaceFoundation.cssClasses, ROOT = _a.ROOT, OPEN = _a.OPEN;
if (!this.adapter_.hasClass(ROOT)) {
throw new Error(ROOT + " class required in root element.");
}
if (this.adapter_.hasClass(OPEN)) {
this.isOpen_ = true;
}
};
MDCMenuSurfaceFoundation.prototype.destroy = function() {
clearTimeout(this.openAnimationEndTimerId_);
clearTimeout(this.closeAnimationEndTimerId_);
cancelAnimationFrame(this.animationRequestId_);
};
MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function(corner) {
this.anchorCorner_ = corner;
};
MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function(margin) {
this.anchorMargin_.top = margin.top || 0;
this.anchorMargin_.right = margin.right || 0;
this.anchorMargin_.bottom = margin.bottom || 0;
this.anchorMargin_.left = margin.left || 0;
};
MDCMenuSurfaceFoundation.prototype.setIsHoisted = function(isHoisted) {
this.isHoistedElement_ = isHoisted;
};
MDCMenuSurfaceFoundation.prototype.setFixedPosition = function(isFixedPosition) {
this.isFixedPosition_ = isFixedPosition;
};
MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function(x, y) {
this.position_.x = this.isFinite_(x) ? x : 0;
this.position_.y = this.isFinite_(y) ? y : 0;
};
MDCMenuSurfaceFoundation.prototype.setQuickOpen = function(quickOpen) {
this.isQuickOpen_ = quickOpen;
};
MDCMenuSurfaceFoundation.prototype.isOpen = function() {
return this.isOpen_;
};
MDCMenuSurfaceFoundation.prototype.open = function() {
var _this = this;
this.adapter_.saveFocus();
if (!this.isQuickOpen_) {
this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
}
this.animationRequestId_ = requestAnimationFrame(function() {
_this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
_this.dimensions_ = _this.adapter_.getInnerDimensions();
_this.autoPosition_();
if (_this.isQuickOpen_) {
_this.adapter_.notifyOpen();
} else {
_this.openAnimationEndTimerId_ = setTimeout(function() {
_this.openAnimationEndTimerId_ = 0;
_this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
_this.adapter_.notifyOpen();
}, constants_1.numbers.TRANSITION_OPEN_DURATION);
}
});
this.isOpen_ = true;
};
MDCMenuSurfaceFoundation.prototype.close = function(skipRestoreFocus) {
var _this = this;
if (skipRestoreFocus === void 0) {
skipRestoreFocus = false;
}
if (!this.isQuickOpen_) {
this.adapter_.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
}
requestAnimationFrame(function() {
_this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
if (_this.isQuickOpen_) {
_this.adapter_.notifyClose();
} else {
_this.closeAnimationEndTimerId_ = setTimeout(function() {
_this.closeAnimationEndTimerId_ = 0;
_this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
_this.adapter_.notifyClose();
}, constants_1.numbers.TRANSITION_CLOSE_DURATION);
}
});
this.isOpen_ = false;
if (!skipRestoreFocus) {
this.maybeRestoreFocus_();
}
};
MDCMenuSurfaceFoundation.prototype.handleBodyClick = function(evt) {
var el = evt.target;
if (this.adapter_.isElementInContainer(el)) {
return;
}
this.close();
};
MDCMenuSurfaceFoundation.prototype.handleKeydown = function(evt) {
var keyCode = evt.keyCode, key = evt.key;
var isEscape = key === "Escape" || keyCode === 27;
if (isEscape) {
this.close();
}
};
MDCMenuSurfaceFoundation.prototype.autoPosition_ = function() {
var _a;
this.measurements_ = this.getAutoLayoutMeasurements_();
var corner = this.getOriginCorner_();
var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight_(corner);
var verticalAlignment = this.hasBit_(corner, constants_1.CornerBit.BOTTOM) ? "bottom" : "top";
var horizontalAlignment = this.hasBit_(corner, constants_1.CornerBit.RIGHT) ? "right" : "left";
var horizontalOffset = this.getHorizontalOriginOffset_(corner);
var verticalOffset = this.getVerticalOriginOffset_(corner);
var _b = this.measurements_, anchorSize = _b.anchorSize, surfaceSize = _b.surfaceSize;
var position = (_a = {}, _a[horizontalAlignment] = horizontalOffset, _a[verticalAlignment] = verticalOffset,
_a);
if (anchorSize.width / surfaceSize.width > constants_1.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
horizontalAlignment = "center";
}
if (this.isHoistedElement_ || this.isFixedPosition_) {
this.adjustPositionForHoistedElement_(position);
}
this.adapter_.setTransformOrigin(horizontalAlignment + " " + verticalAlignment);
this.adapter_.setPosition(position);
this.adapter_.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + "px" : "");
};
MDCMenuSurfaceFoundation.prototype.getAutoLayoutMeasurements_ = function() {
var anchorRect = this.adapter_.getAnchorDimensions();
var bodySize = this.adapter_.getBodyDimensions();
var viewportSize = this.adapter_.getWindowDimensions();
var windowScroll = this.adapter_.getWindowScroll();
if (!anchorRect) {
anchorRect = {
top: this.position_.y,
right: this.position_.x,
bottom: this.position_.y,
left: this.position_.x,
width: 0,
height: 0
};
}
return {
anchorSize: anchorRect,
bodySize: bodySize,
surfaceSize: this.dimensions_,
viewportDistance: {
top: anchorRect.top,
right: viewportSize.width - anchorRect.right,
bottom: viewportSize.height - anchorRect.bottom,
left: anchorRect.left
},
viewportSize: viewportSize,
windowScroll: windowScroll
};
};
MDCMenuSurfaceFoundation.prototype.getOriginCorner_ = function() {
var corner = constants_1.Corner.TOP_LEFT;
var _a = this.measurements_, viewportDistance = _a.viewportDistance, anchorSize = _a.anchorSize, surfaceSize = _a.surfaceSize;
var isBottomAligned = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
var availableTop = isBottomAligned ? viewportDistance.top + anchorSize.height + this.anchorMargin_.bottom : viewportDistance.top + this.anchorMargin_.top;
var availableBottom = isBottomAligned ? viewportDistance.bottom - this.anchorMargin_.bottom : viewportDistance.bottom + anchorSize.height - this.anchorMargin_.top;
var topOverflow = surfaceSize.height - availableTop;
var bottomOverflow = surfaceSize.height - availableBottom;
if (bottomOverflow > 0 && topOverflow < bottomOverflow) {
corner = this.setBit_(corner, constants_1.CornerBit.BOTTOM);
}
var isRtl = this.adapter_.isRtl();
var isFlipRtl = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.FLIP_RTL);
var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.RIGHT);
var isAlignedRight = avoidHorizontalOverlap && !isRtl || !avoidHorizontalOverlap && isFlipRtl && isRtl;
var availableLeft = isAlignedRight ? viewportDistance.left + anchorSize.width + this.anchorMargin_.right : viewportDistance.left + this.anchorMargin_.left;
var availableRight = isAlignedRight ? viewportDistance.right - this.anchorMargin_.right : viewportDistance.right + anchorSize.width - this.anchorMargin_.left;
var leftOverflow = surfaceSize.width - availableLeft;
var rightOverflow = surfaceSize.width - availableRight;
if (leftOverflow < 0 && isAlignedRight && isRtl || avoidHorizontalOverlap && !isAlignedRight && leftOverflow < 0 || rightOverflow > 0 && leftOverflow < rightOverflow) {
corner = this.setBit_(corner, constants_1.CornerBit.RIGHT);
}
return corner;
};
MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight_ = function(corner) {
var viewportDistance = this.measurements_.viewportDistance;
var maxHeight = 0;
var isBottomAligned = this.hasBit_(corner, constants_1.CornerBit.BOTTOM);
var isBottomAnchored = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
if (isBottomAligned) {
maxHeight = viewportDistance.top + this.anchorMargin_.top - MARGIN_TO_EDGE;
if (!isBottomAnchored) {
maxHeight += this.measurements_.anchorSize.height;
}
_this.adapter_.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
_this.adapter_.notifyClose();
}, constants_1.numbers.TRANSITION_CLOSE_DURATION);
}
});
this.isOpen_ = false;
if (!skipRestoreFocus) {
this.maybeRestoreFocus_();
}
};
/** Handle clicks and close if not within menu-surface element. */
MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) {
var el = evt.target;
if (this.adapter_.isElementInContainer(el)) {
return;
}
this.close();
};
/** Handle keys that close the surface. */
MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) {
var keyCode = evt.keyCode,
key = evt.key;
var isEscape = key === 'Escape' || keyCode === 27;
if (isEscape) {
this.close();
}
};
MDCMenuSurfaceFoundation.prototype.autoPosition_ = function () {
var _a;
// Compute measurements for autoposition methods reuse.
this.measurements_ = this.getAutoLayoutMeasurements_();
var corner = this.getOriginCorner_();
var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight_(corner);
var verticalAlignment = this.hasBit_(corner, constants_1.CornerBit.BOTTOM) ? 'bottom' : 'top';
var horizontalAlignment = this.hasBit_(corner, constants_1.CornerBit.RIGHT) ? 'right' : 'left';
var horizontalOffset = this.getHorizontalOriginOffset_(corner);
var verticalOffset = this.getVerticalOriginOffset_(corner);
var _b = this.measurements_,
anchorSize = _b.anchorSize,
surfaceSize = _b.surfaceSize;
var position = (_a = {}, _a[horizontalAlignment] = horizontalOffset, _a[verticalAlignment] = verticalOffset, _a);
// Center align when anchor width is comparable or greater than menu surface, otherwise keep corner.
if (anchorSize.width / surfaceSize.width > constants_1.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
horizontalAlignment = 'center';
}
// If the menu-surface has been hoisted to the body, it's no longer relative to the anchor element
if (this.isHoistedElement_ || this.isFixedPosition_) {
this.adjustPositionForHoistedElement_(position);
}
this.adapter_.setTransformOrigin(horizontalAlignment + " " + verticalAlignment);
this.adapter_.setPosition(position);
this.adapter_.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : '');
};
/**
* @return Measurements used to position menu surface popup.
*/
MDCMenuSurfaceFoundation.prototype.getAutoLayoutMeasurements_ = function () {
var anchorRect = this.adapter_.getAnchorDimensions();
var bodySize = this.adapter_.getBodyDimensions();
var viewportSize = this.adapter_.getWindowDimensions();
var windowScroll = this.adapter_.getWindowScroll();
if (!anchorRect) {
// tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
anchorRect = {
top: this.position_.y,
right: this.position_.x,
bottom: this.position_.y,
left: this.position_.x,
width: 0,
height: 0
};
// tslint:enable:object-literal-sort-keys
}
return {
anchorSize: anchorRect,
bodySize: bodySize,
surfaceSize: this.dimensions_,
viewportDistance: {
// tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
top: anchorRect.top,
right: viewportSize.width - anchorRect.right,
bottom: viewportSize.height - anchorRect.bottom,
left: anchorRect.left
},
viewportSize: viewportSize,
windowScroll: windowScroll
};
};
/**
* Computes the corner of the anchor from which to animate and position the menu surface.
*/
MDCMenuSurfaceFoundation.prototype.getOriginCorner_ = function () {
// Defaults: open from the top left.
var corner = constants_1.Corner.TOP_LEFT;
var _a = this.measurements_,
viewportDistance = _a.viewportDistance,
anchorSize = _a.anchorSize,
surfaceSize = _a.surfaceSize;
var isBottomAligned = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
var availableTop = isBottomAligned ? viewportDistance.top + anchorSize.height + this.anchorMargin_.bottom : viewportDistance.top + this.anchorMargin_.top;
var availableBottom = isBottomAligned ? viewportDistance.bottom - this.anchorMargin_.bottom : viewportDistance.bottom + anchorSize.height - this.anchorMargin_.top;
var topOverflow = surfaceSize.height - availableTop;
var bottomOverflow = surfaceSize.height - availableBottom;
if (bottomOverflow > 0 && topOverflow < bottomOverflow) {
corner = this.setBit_(corner, constants_1.CornerBit.BOTTOM);
}
var isRtl = this.adapter_.isRtl();
var isFlipRtl = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.FLIP_RTL);
var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.RIGHT);
var isAlignedRight = avoidHorizontalOverlap && !isRtl || !avoidHorizontalOverlap && isFlipRtl && isRtl;
var availableLeft = isAlignedRight ? viewportDistance.left + anchorSize.width + this.anchorMargin_.right : viewportDistance.left + this.anchorMargin_.left;
var availableRight = isAlignedRight ? viewportDistance.right - this.anchorMargin_.right : viewportDistance.right + anchorSize.width - this.anchorMargin_.left;
var leftOverflow = surfaceSize.width - availableLeft;
var rightOverflow = surfaceSize.width - availableRight;
if (leftOverflow < 0 && isAlignedRight && isRtl || avoidHorizontalOverlap && !isAlignedRight && leftOverflow < 0 || rightOverflow > 0 && leftOverflow < rightOverflow) {
corner = this.setBit_(corner, constants_1.CornerBit.RIGHT);
}
return corner;
};
/**
* @param corner Origin corner of the menu surface.
* @return Maximum height of the menu surface, based on available space. 0 indicates should not be set.
*/
MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight_ = function (corner) {
var viewportDistance = this.measurements_.viewportDistance;
var maxHeight = 0;
var isBottomAligned = this.hasBit_(corner, constants_1.CornerBit.BOTTOM);
var isBottomAnchored = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
// When maximum height is not specified, it is handled from CSS.
if (isBottomAligned) {
maxHeight = viewportDistance.top + this.anchorMargin_.top - MARGIN_TO_EDGE;
if (!isBottomAnchored) {
maxHeight += this.measurements_.anchorSize.height;
}
} else {
maxHeight = viewportDistance.bottom - this.anchorMargin_.bottom + this.measurements_.anchorSize.height - MARGIN_TO_EDGE;
if (isBottomAnchored) {
maxHeight -= this.measurements_.anchorSize.height;
}
}
return maxHeight;
};
/**
* @param corner Origin corner of the menu surface.
* @return Horizontal offset of menu surface origin corner from corresponding anchor corner.
*/
MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset_ = function (corner) {
var anchorSize = this.measurements_.anchorSize;
// isRightAligned corresponds to using the 'right' property on the surface.
var isRightAligned = this.hasBit_(corner, constants_1.CornerBit.RIGHT);
var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.RIGHT);
if (isRightAligned) {
var rightOffset = avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.left : this.anchorMargin_.right;
// For hoisted or fixed elements, adjust the offset by the difference between viewport width and body width so
// when we calculate the right value (`adjustPositionForHoistedElement_`) based on the element position,
// the right property is correct.
if (this.isHoistedElement_ || this.isFixedPosition_) {
return rightOffset - (this.measurements_.viewportSize.width - this.measurements_.bodySize.width);
}
return rightOffset;
}
return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.right : this.anchorMargin_.left;
};
/**
* @param corner Origin corner of the menu surface.
* @return Vertical offset of menu surface origin corner from corresponding anchor corner.
*/
MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset_ = function (corner) {
var anchorSize = this.measurements_.anchorSize;
var isBottomAligned = this.hasBit_(corner, constants_1.CornerBit.BOTTOM);
var avoidVerticalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
var y = 0;
if (isBottomAligned) {
y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin_.top : -this.anchorMargin_.bottom;
} else {
y = avoidVerticalOverlap ? anchorSize.height + this.anchorMargin_.bottom : this.anchorMargin_.top;
}
return y;
};
/** Calculates the offsets for positioning the menu-surface when the menu-surface has been hoisted to the body. */
MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement_ = function (position) {
var e_1, _a;
var _b = this.measurements_,
windowScroll = _b.windowScroll,
viewportDistance = _b.viewportDistance;
var props = Object.keys(position);
try {
for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
var prop = props_1_1.value;
var value = position[prop] || 0;
// Hoisted surfaces need to have the anchor elements location on the page added to the
// position properties for proper alignment on the body.
value += viewportDistance[prop];
// Surfaces that are absolutely positioned need to have additional calculations for scroll
// and bottom positioning.
if (!this.isFixedPosition_) {
if (prop === 'top') {
value += windowScroll.y;
} else if (prop === 'bottom') {
value -= windowScroll.y;
} else if (prop === 'left') {
value += windowScroll.x;
} else {
maxHeight = viewportDistance.bottom - this.anchorMargin_.bottom + this.measurements_.anchorSize.height - MARGIN_TO_EDGE;
if (isBottomAnchored) {
maxHeight -= this.measurements_.anchorSize.height;
}
// prop === 'right'
value -= windowScroll.x;
}
return maxHeight;
};
MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset_ = function(corner) {
var anchorSize = this.measurements_.anchorSize;
var isRightAligned = this.hasBit_(corner, constants_1.CornerBit.RIGHT);
var avoidHorizontalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.RIGHT);
if (isRightAligned) {
var rightOffset = avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.left : this.anchorMargin_.right;
if (this.isHoistedElement_ || this.isFixedPosition_) {
return rightOffset - (this.measurements_.viewportSize.width - this.measurements_.bodySize.width);
}
return rightOffset;
}
return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin_.right : this.anchorMargin_.left;
};
MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset_ = function(corner) {
var anchorSize = this.measurements_.anchorSize;
var isBottomAligned = this.hasBit_(corner, constants_1.CornerBit.BOTTOM);
var avoidVerticalOverlap = this.hasBit_(this.anchorCorner_, constants_1.CornerBit.BOTTOM);
var y = 0;
if (isBottomAligned) {
y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin_.top : -this.anchorMargin_.bottom;
} else {
y = avoidVerticalOverlap ? anchorSize.height + this.anchorMargin_.bottom : this.anchorMargin_.top;
}
return y;
};
MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement_ = function(position) {
var e_1, _a;
var _b = this.measurements_, windowScroll = _b.windowScroll, viewportDistance = _b.viewportDistance;
var props = Object.keys(position);
try {
for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
var prop = props_1_1.value;
var value = position[prop] || 0;
value += viewportDistance[prop];
if (!this.isFixedPosition_) {
if (prop === "top") {
value += windowScroll.y;
} else if (prop === "bottom") {
value -= windowScroll.y;
} else if (prop === "left") {
value += windowScroll.x;
} else {
value -= windowScroll.x;
}
}
position[prop] = value;
}
} catch (e_1_1) {
e_1 = {
error: e_1_1
};
} finally {
try {
if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);
} finally {
if (e_1) throw e_1.error;
}
}
};
MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus_ = function() {
var isRootFocused = this.adapter_.isFocused();
var childHasFocus = document.activeElement && this.adapter_.isElementInContainer(document.activeElement);
if (isRootFocused || childHasFocus) {
this.adapter_.restoreFocus();
}
};
MDCMenuSurfaceFoundation.prototype.hasBit_ = function(corner, bit) {
return Boolean(corner & bit);
};
MDCMenuSurfaceFoundation.prototype.setBit_ = function(corner, bit) {
return corner | bit;
};
MDCMenuSurfaceFoundation.prototype.isFinite_ = function(num) {
return typeof num === "number" && isFinite(num);
};
return MDCMenuSurfaceFoundation;
}(foundation_1.MDCFoundation);
exports.MDCMenuSurfaceFoundation = MDCMenuSurfaceFoundation;
exports.default = MDCMenuSurfaceFoundation;
},
134: function(module, exports, __webpack_require__) {
"use strict";
function __export(m) {
for (var p in m) {
if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
position[prop] = value;
}
var __importStar = this && this.__importStar || function(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) {
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
}
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", {
value: true
});
var util = __importStar(__webpack_require__(22));
exports.util = util;
var constants_1 = __webpack_require__(9);
exports.Corner = constants_1.Corner;
exports.CornerBit = constants_1.CornerBit;
__export(__webpack_require__(31));
__export(__webpack_require__(9));
__export(__webpack_require__(13));
},
22: function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var cachedCssTransformPropertyName_;
function getTransformPropertyName(globalObj, forceRefresh) {
if (forceRefresh === void 0) {
forceRefresh = false;
}
if (cachedCssTransformPropertyName_ === undefined || forceRefresh) {
var el = globalObj.document.createElement("div");
cachedCssTransformPropertyName_ = "transform" in el.style ? "transform" : "webkitTransform";
}
return cachedCssTransformPropertyName_;
} catch (e_1_1) {
e_1 = { error: e_1_1 };
} finally {
try {
if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);
} finally {
if (e_1) throw e_1.error;
}
exports.getTransformPropertyName = getTransformPropertyName;
},
31: function(module, exports, __webpack_require__) {
"use strict";
var __extends = this && this.__extends || function() {
var _extendStatics = function extendStatics(d, b) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(d, b) {
d.__proto__ = b;
} || function(d, b) {
for (var p in b) {
if (b.hasOwnProperty(p)) d[p] = b[p];
}
};
return _extendStatics(d, b);
};
return function(d, b) {
_extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
}();
var __importStar = this && this.__importStar || function(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) {
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
}
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", {
value: true
});
var component_1 = __webpack_require__(1);
var constants_1 = __webpack_require__(9);
var foundation_1 = __webpack_require__(13);
var util = __importStar(__webpack_require__(22));
var MDCMenuSurface = function(_super) {
__extends(MDCMenuSurface, _super);
function MDCMenuSurface() {
return _super !== null && _super.apply(this, arguments) || this;
}
MDCMenuSurface.attachTo = function(root) {
return new MDCMenuSurface(root);
};
MDCMenuSurface.prototype.initialSyncWithDOM = function() {
var _this = this;
var parentEl = this.root_.parentElement;
this.anchorElement = parentEl && parentEl.classList.contains(constants_1.cssClasses.ANCHOR) ? parentEl : null;
if (this.root_.classList.contains(constants_1.cssClasses.FIXED)) {
this.setFixedPosition(true);
}
this.handleKeydown_ = function(evt) {
return _this.foundation_.handleKeydown(evt);
};
this.handleBodyClick_ = function(evt) {
return _this.foundation_.handleBodyClick(evt);
};
this.registerBodyClickListener_ = function() {
return document.body.addEventListener("click", _this.handleBodyClick_);
};
this.deregisterBodyClickListener_ = function() {
return document.body.removeEventListener("click", _this.handleBodyClick_);
};
this.listen("keydown", this.handleKeydown_);
this.listen(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener_);
this.listen(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener_);
};
MDCMenuSurface.prototype.destroy = function() {
this.unlisten("keydown", this.handleKeydown_);
this.unlisten(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener_);
this.unlisten(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener_);
_super.prototype.destroy.call(this);
};
MDCMenuSurface.prototype.isOpen = function() {
return this.foundation_.isOpen();
};
MDCMenuSurface.prototype.open = function() {
this.foundation_.open();
};
MDCMenuSurface.prototype.close = function(skipRestoreFocus) {
if (skipRestoreFocus === void 0) {
skipRestoreFocus = false;
}
this.foundation_.close(skipRestoreFocus);
};
Object.defineProperty(MDCMenuSurface.prototype, "quickOpen", {
set: function set(quickOpen) {
this.foundation_.setQuickOpen(quickOpen);
},
enumerable: true,
configurable: true
});
MDCMenuSurface.prototype.hoistMenuToBody = function() {
document.body.appendChild(this.root_);
this.setIsHoisted(true);
};
MDCMenuSurface.prototype.setIsHoisted = function(isHoisted) {
this.foundation_.setIsHoisted(isHoisted);
};
MDCMenuSurface.prototype.setMenuSurfaceAnchorElement = function(element) {
this.anchorElement = element;
};
MDCMenuSurface.prototype.setFixedPosition = function(isFixed) {
if (isFixed) {
this.root_.classList.add(constants_1.cssClasses.FIXED);
} else {
this.root_.classList.remove(constants_1.cssClasses.FIXED);
}
this.foundation_.setFixedPosition(isFixed);
};
MDCMenuSurface.prototype.setAbsolutePosition = function(x, y) {
this.foundation_.setAbsolutePosition(x, y);
this.setIsHoisted(true);
};
MDCMenuSurface.prototype.setAnchorCorner = function(corner) {
this.foundation_.setAnchorCorner(corner);
};
MDCMenuSurface.prototype.setAnchorMargin = function(margin) {
this.foundation_.setAnchorMargin(margin);
};
MDCMenuSurface.prototype.getDefaultFoundation = function() {
var _this = this;
var adapter = {
addClass: function addClass(className) {
return _this.root_.classList.add(className);
},
removeClass: function removeClass(className) {
return _this.root_.classList.remove(className);
},
hasClass: function hasClass(className) {
return _this.root_.classList.contains(className);
},
hasAnchor: function hasAnchor() {
return !!_this.anchorElement;
},
notifyClose: function notifyClose() {
return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT, {});
},
notifyOpen: function notifyOpen() {
return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, {});
},
isElementInContainer: function isElementInContainer(el) {
return _this.root_.contains(el);
},
isRtl: function isRtl() {
return getComputedStyle(_this.root_).getPropertyValue("direction") === "rtl";
},
setTransformOrigin: function setTransformOrigin(origin) {
var propertyName = util.getTransformPropertyName(window) + "-origin";
_this.root_.style.setProperty(propertyName, origin);
},
isFocused: function isFocused() {
return document.activeElement === _this.root_;
},
saveFocus: function saveFocus() {
_this.previousFocus_ = document.activeElement;
},
restoreFocus: function restoreFocus() {
if (_this.root_.contains(document.activeElement)) {
if (_this.previousFocus_ && _this.previousFocus_.focus) {
_this.previousFocus_.focus();
}
}
},
getInnerDimensions: function getInnerDimensions() {
return {
width: _this.root_.offsetWidth,
height: _this.root_.offsetHeight
};
},
getAnchorDimensions: function getAnchorDimensions() {
return _this.anchorElement ? _this.anchorElement.getBoundingClientRect() : null;
},
getWindowDimensions: function getWindowDimensions() {
return {
width: window.innerWidth,
height: window.innerHeight
};
},
getBodyDimensions: function getBodyDimensions() {
return {
width: document.body.clientWidth,
height: document.body.clientHeight
};
},
getWindowScroll: function getWindowScroll() {
return {
x: window.pageXOffset,
y: window.pageYOffset
};
},
setPosition: function setPosition(position) {
_this.root_.style.left = "left" in position ? position.left + "px" : "";
_this.root_.style.right = "right" in position ? position.right + "px" : "";
_this.root_.style.top = "top" in position ? position.top + "px" : "";
_this.root_.style.bottom = "bottom" in position ? position.bottom + "px" : "";
},
setMaxHeight: function setMaxHeight(height) {
_this.root_.style.maxHeight = height;
}
};
return new foundation_1.MDCMenuSurfaceFoundation(adapter);
};
return MDCMenuSurface;
}(component_1.MDCComponent);
exports.MDCMenuSurface = MDCMenuSurface;
},
9: function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var cssClasses = {
ANCHOR: "mdc-menu-surface--anchor",
ANIMATING_CLOSED: "mdc-menu-surface--animating-closed",
ANIMATING_OPEN: "mdc-menu-surface--animating-open",
FIXED: "mdc-menu-surface--fixed",
OPEN: "mdc-menu-surface--open",
ROOT: "mdc-menu-surface"
};
exports.cssClasses = cssClasses;
var strings = {
CLOSED_EVENT: "MDCMenuSurface:closed",
OPENED_EVENT: "MDCMenuSurface:opened",
FOCUSABLE_ELEMENTS: [ "button:not(:disabled)", '[href]:not([aria-disabled="true"])', "input:not(:disabled)", "select:not(:disabled)", "textarea:not(:disabled)", '[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])' ].join(", ")
};
exports.strings = strings;
var numbers = {
TRANSITION_OPEN_DURATION: 120,
TRANSITION_CLOSE_DURATION: 75,
MARGIN_TO_EDGE: 32,
ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: .67
};
exports.numbers = numbers;
var CornerBit;
(function(CornerBit) {
CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
})(CornerBit || (CornerBit = {}));
exports.CornerBit = CornerBit;
var Corner;
(function(Corner) {
Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
Corner[Corner["TOP_START"] = 8] = "TOP_START";
Corner[Corner["TOP_END"] = 12] = "TOP_END";
Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
})(Corner || (Corner = {}));
exports.Corner = Corner;
}
});
};
/**
* The last focused element when the menu surface was opened should regain focus, if the user is
* focused on or within the menu surface when it is closed.
*/
MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus_ = function () {
var isRootFocused = this.adapter_.isFocused();
var childHasFocus = document.activeElement && this.adapter_.isElementInContainer(document.activeElement);
if (isRootFocused || childHasFocus) {
this.adapter_.restoreFocus();
}
};
MDCMenuSurfaceFoundation.prototype.hasBit_ = function (corner, bit) {
return Boolean(corner & bit); // tslint:disable-line:no-bitwise
};
MDCMenuSurfaceFoundation.prototype.setBit_ = function (corner, bit) {
return corner | bit; // tslint:disable-line:no-bitwise
};
/**
* isFinite that doesn't force conversion to number type.
* Equivalent to Number.isFinite in ES2015, which is not supported in IE.
*/
MDCMenuSurfaceFoundation.prototype.isFinite_ = function (num) {
return typeof num === 'number' && isFinite(num);
};
return MDCMenuSurfaceFoundation;
}(foundation_1.MDCFoundation);
exports.MDCMenuSurfaceFoundation = MDCMenuSurfaceFoundation;
// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
exports.default = MDCMenuSurfaceFoundation;
/***/ }),
/***/ "./packages/mdc-menu-surface/index.ts":
/*!********************************************!*\
!*** ./packages/mdc-menu-surface/index.ts ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @license
* Copyright 2019 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
function __export(m) {
for (var p in m) {
if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
}
var __importStar = this && this.__importStar || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) {
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
}result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-menu-surface/util.ts"));
exports.util = util;
var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts");
exports.Corner = constants_1.Corner;
exports.CornerBit = constants_1.CornerBit;
__export(__webpack_require__(/*! ./component */ "./packages/mdc-menu-surface/component.ts"));
__export(__webpack_require__(/*! ./constants */ "./packages/mdc-menu-surface/constants.ts"));
__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-menu-surface/foundation.ts"));
/***/ }),
/***/ "./packages/mdc-menu-surface/util.ts":
/*!*******************************************!*\
!*** ./packages/mdc-menu-surface/util.ts ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var cachedCssTransformPropertyName_;
/**
* Returns the name of the correct transform property to use on the current browser.
*/
function getTransformPropertyName(globalObj, forceRefresh) {
if (forceRefresh === void 0) {
forceRefresh = false;
}
if (cachedCssTransformPropertyName_ === undefined || forceRefresh) {
var el = globalObj.document.createElement('div');
cachedCssTransformPropertyName_ = 'transform' in el.style ? 'transform' : 'webkitTransform';
}
return cachedCssTransformPropertyName_;
}
exports.getTransformPropertyName = getTransformPropertyName;
/***/ })
/******/ });
});
//# sourceMappingURL=mdc.menuSurface.js.map

@@ -1,9 +0,1 @@

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.menuSurface=e():(t.mdc=t.mdc||{},t.mdc.menuSurface=e())}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=134)}({0:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){void 0===t&&(t={}),this.adapter_=t}return Object.defineProperty(t,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),t.prototype.init=function(){},t.prototype.destroy=function(){},t}();e.MDCFoundation=i,e.default=i},1:function(t,e,n){"use strict";var i=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,o,r=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(t){o={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s},o=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(i(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),s=function(){function t(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];this.root_=t,this.initialize.apply(this,o(n)),this.foundation_=void 0===e?this.getDefaultFoundation():e,this.foundation_.init(),this.initialSyncWithDOM()}return t.attachTo=function(e){return new t(e,new r.MDCFoundation({}))},t.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},t.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},t.prototype.initialSyncWithDOM=function(){},t.prototype.destroy=function(){this.foundation_.destroy()},t.prototype.listen=function(t,e,n){this.root_.addEventListener(t,e,n)},t.prototype.unlisten=function(t,e,n){this.root_.removeEventListener(t,e,n)},t.prototype.emit=function(t,e,n){void 0===n&&(n=!1);var i;"function"==typeof CustomEvent?i=new CustomEvent(t,{bubbles:n,detail:e}):(i=document.createEvent("CustomEvent"),i.initCustomEvent(t,n,!1,e)),this.root_.dispatchEvent(i)},t}();e.MDCComponent=s,e.default=s},13:function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},o.apply(this,arguments)},r=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}};Object.defineProperty(e,"__esModule",{value:!0});var s=n(0),a=n(9),u=function(t){function e(n){var i=t.call(this,o({},e.defaultAdapter,n))||this;return i.isOpen_=!1,i.isQuickOpen_=!1,i.isHoistedElement_=!1,i.isFixedPosition_=!1,i.openAnimationEndTimerId_=0,i.closeAnimationEndTimerId_=0,i.animationRequestId_=0,i.anchorCorner_=a.Corner.TOP_START,i.anchorMargin_={top:0,right:0,bottom:0,left:0},i.position_={x:0,y:0},i}return i(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return a.cssClasses},enumerable:!0,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return a.strings},enumerable:!0,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return a.numbers},enumerable:!0,configurable:!0}),Object.defineProperty(e,"Corner",{get:function(){return a.Corner},enumerable:!0,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){return!1},hasAnchor:function(){return!1},isElementInContainer:function(){return!1},isFocused:function(){return!1},isRtl:function(){return!1},getInnerDimensions:function(){return{height:0,width:0}},getAnchorDimensions:function(){return null},getWindowDimensions:function(){return{height:0,width:0}},getBodyDimensions:function(){return{height:0,width:0}},getWindowScroll:function(){return{x:0,y:0}},setPosition:function(){},setMaxHeight:function(){},setTransformOrigin:function(){},saveFocus:function(){},restoreFocus:function(){},notifyClose:function(){},notifyOpen:function(){}}},enumerable:!0,configurable:!0}),e.prototype.init=function(){var t=e.cssClasses,n=t.ROOT,i=t.OPEN;if(!this.adapter_.hasClass(n))throw new Error(n+" class required in root element.");this.adapter_.hasClass(i)&&(this.isOpen_=!0)},e.prototype.destroy=function(){clearTimeout(this.openAnimationEndTimerId_),clearTimeout(this.closeAnimationEndTimerId_),cancelAnimationFrame(this.animationRequestId_)},e.prototype.setAnchorCorner=function(t){this.anchorCorner_=t},e.prototype.setAnchorMargin=function(t){this.anchorMargin_.top=t.top||0,this.anchorMargin_.right=t.right||0,this.anchorMargin_.bottom=t.bottom||0,this.anchorMargin_.left=t.left||0},e.prototype.setIsHoisted=function(t){this.isHoistedElement_=t},e.prototype.setFixedPosition=function(t){this.isFixedPosition_=t},e.prototype.setAbsolutePosition=function(t,e){this.position_.x=this.isFinite_(t)?t:0,this.position_.y=this.isFinite_(e)?e:0},e.prototype.setQuickOpen=function(t){this.isQuickOpen_=t},e.prototype.isOpen=function(){return this.isOpen_},e.prototype.open=function(){var t=this;this.adapter_.saveFocus(),this.isQuickOpen_||this.adapter_.addClass(e.cssClasses.ANIMATING_OPEN),this.animationRequestId_=requestAnimationFrame(function(){t.adapter_.addClass(e.cssClasses.OPEN),t.dimensions_=t.adapter_.getInnerDimensions(),t.autoPosition_(),t.isQuickOpen_?t.adapter_.notifyOpen():t.openAnimationEndTimerId_=setTimeout(function(){t.openAnimationEndTimerId_=0,t.adapter_.removeClass(e.cssClasses.ANIMATING_OPEN),t.adapter_.notifyOpen()},a.numbers.TRANSITION_OPEN_DURATION)}),this.isOpen_=!0},e.prototype.close=function(t){var n=this;void 0===t&&(t=!1),this.isQuickOpen_||this.adapter_.addClass(e.cssClasses.ANIMATING_CLOSED),requestAnimationFrame(function(){n.adapter_.removeClass(e.cssClasses.OPEN),n.isQuickOpen_?n.adapter_.notifyClose():n.closeAnimationEndTimerId_=setTimeout(function(){n.closeAnimationEndTimerId_=0,n.adapter_.removeClass(e.cssClasses.ANIMATING_CLOSED),n.adapter_.notifyClose()},a.numbers.TRANSITION_CLOSE_DURATION)}),this.isOpen_=!1,t||this.maybeRestoreFocus_()},e.prototype.handleBodyClick=function(t){var e=t.target;this.adapter_.isElementInContainer(e)||this.close()},e.prototype.handleKeydown=function(t){var e=t.keyCode;("Escape"===t.key||27===e)&&this.close()},e.prototype.autoPosition_=function(){var t;this.measurements_=this.getAutoLayoutMeasurements_();var e=this.getOriginCorner_(),n=this.getMenuSurfaceMaxHeight_(e),i=this.hasBit_(e,a.CornerBit.BOTTOM)?"bottom":"top",o=this.hasBit_(e,a.CornerBit.RIGHT)?"right":"left",r=this.getHorizontalOriginOffset_(e),s=this.getVerticalOriginOffset_(e),u=this.measurements_,c=u.anchorSize,h=u.surfaceSize,f=(t={},t[o]=r,t[i]=s,t);c.width/h.width>a.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO&&(o="center"),(this.isHoistedElement_||this.isFixedPosition_)&&this.adjustPositionForHoistedElement_(f),this.adapter_.setTransformOrigin(o+" "+i),this.adapter_.setPosition(f),this.adapter_.setMaxHeight(n?n+"px":"")},e.prototype.getAutoLayoutMeasurements_=function(){var t=this.adapter_.getAnchorDimensions(),e=this.adapter_.getBodyDimensions(),n=this.adapter_.getWindowDimensions(),i=this.adapter_.getWindowScroll();return t||(t={top:this.position_.y,right:this.position_.x,bottom:this.position_.y,left:this.position_.x,width:0,height:0}),{anchorSize:t,bodySize:e,surfaceSize:this.dimensions_,viewportDistance:{top:t.top,right:n.width-t.right,bottom:n.height-t.bottom,left:t.left},viewportSize:n,windowScroll:i}},e.prototype.getOriginCorner_=function(){var t=a.Corner.TOP_LEFT,e=this.measurements_,n=e.viewportDistance,i=e.anchorSize,o=e.surfaceSize,r=this.hasBit_(this.anchorCorner_,a.CornerBit.BOTTOM),s=r?n.top+i.height+this.anchorMargin_.bottom:n.top+this.anchorMargin_.top,u=r?n.bottom-this.anchorMargin_.bottom:n.bottom+i.height-this.anchorMargin_.top,c=o.height-s,h=o.height-u;h>0&&c<h&&(t=this.setBit_(t,a.CornerBit.BOTTOM));var f=this.adapter_.isRtl(),d=this.hasBit_(this.anchorCorner_,a.CornerBit.FLIP_RTL),_=this.hasBit_(this.anchorCorner_,a.CornerBit.RIGHT),l=_&&!f||!_&&d&&f,p=l?n.left+i.width+this.anchorMargin_.right:n.left+this.anchorMargin_.left,m=l?n.right-this.anchorMargin_.right:n.right+i.width-this.anchorMargin_.left,y=o.width-p,O=o.width-m;return(y<0&&l&&f||_&&!l&&y<0||O>0&&y<O)&&(t=this.setBit_(t,a.CornerBit.RIGHT)),t},e.prototype.getMenuSurfaceMaxHeight_=function(t){var n=this.measurements_.viewportDistance,i=0,o=this.hasBit_(t,a.CornerBit.BOTTOM),r=this.hasBit_(this.anchorCorner_,a.CornerBit.BOTTOM),s=e.numbers.MARGIN_TO_EDGE;return o?(i=n.top+this.anchorMargin_.top-s,r||(i+=this.measurements_.anchorSize.height)):(i=n.bottom-this.anchorMargin_.bottom+this.measurements_.anchorSize.height-s,r&&(i-=this.measurements_.anchorSize.height)),i},e.prototype.getHorizontalOriginOffset_=function(t){var e=this.measurements_.anchorSize,n=this.hasBit_(t,a.CornerBit.RIGHT),i=this.hasBit_(this.anchorCorner_,a.CornerBit.RIGHT);if(n){var o=i?e.width-this.anchorMargin_.left:this.anchorMargin_.right;return this.isHoistedElement_||this.isFixedPosition_?o-(this.measurements_.viewportSize.width-this.measurements_.bodySize.width):o}return i?e.width-this.anchorMargin_.right:this.anchorMargin_.left},e.prototype.getVerticalOriginOffset_=function(t){var e=this.measurements_.anchorSize,n=this.hasBit_(t,a.CornerBit.BOTTOM),i=this.hasBit_(this.anchorCorner_,a.CornerBit.BOTTOM);return n?i?e.height-this.anchorMargin_.top:-this.anchorMargin_.bottom:i?e.height+this.anchorMargin_.bottom:this.anchorMargin_.top},e.prototype.adjustPositionForHoistedElement_=function(t){var e,n,i=this.measurements_,o=i.windowScroll,s=i.viewportDistance,a=Object.keys(t);try{for(var u=r(a),c=u.next();!c.done;c=u.next()){var h=c.value,f=t[h]||0;f+=s[h],this.isFixedPosition_||("top"===h?f+=o.y:"bottom"===h?f-=o.y:"left"===h?f+=o.x:f-=o.x),t[h]=f}}catch(t){e={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}},e.prototype.maybeRestoreFocus_=function(){var t=this.adapter_.isFocused(),e=document.activeElement&&this.adapter_.isElementInContainer(document.activeElement);(t||e)&&this.adapter_.restoreFocus()},e.prototype.hasBit_=function(t,e){return Boolean(t&e)},e.prototype.setBit_=function(t,e){return t|e},e.prototype.isFinite_=function(t){return"number"==typeof t&&isFinite(t)},e}(s.MDCFoundation);e.MDCMenuSurfaceFoundation=u,e.default=u},134:function(t,e,n){"use strict";function i(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}var o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var r=o(n(22));e.util=r;var s=n(9);e.Corner=s.Corner,e.CornerBit=s.CornerBit,i(n(31)),i(n(9)),i(n(13))},22:function(t,e,n){"use strict";function i(t,e){if(void 0===e&&(e=!1),void 0===o||e){var n=t.document.createElement("div");o="transform"in n.style?"transform":"webkitTransform"}return o}Object.defineProperty(e,"__esModule",{value:!0});var o;e.getTransformPropertyName=i},31:function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),s=n(9),a=n(13),u=o(n(22)),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.attachTo=function(t){return new e(t)},e.prototype.initialSyncWithDOM=function(){var t=this,e=this.root_.parentElement;this.anchorElement=e&&e.classList.contains(s.cssClasses.ANCHOR)?e:null,this.root_.classList.contains(s.cssClasses.FIXED)&&this.setFixedPosition(!0),this.handleKeydown_=function(e){return t.foundation_.handleKeydown(e)},this.handleBodyClick_=function(e){return t.foundation_.handleBodyClick(e)},this.registerBodyClickListener_=function(){return document.body.addEventListener("click",t.handleBodyClick_)},this.deregisterBodyClickListener_=function(){return document.body.removeEventListener("click",t.handleBodyClick_)},this.listen("keydown",this.handleKeydown_),this.listen(s.strings.OPENED_EVENT,this.registerBodyClickListener_),this.listen(s.strings.CLOSED_EVENT,this.deregisterBodyClickListener_)},e.prototype.destroy=function(){this.unlisten("keydown",this.handleKeydown_),this.unlisten(s.strings.OPENED_EVENT,this.registerBodyClickListener_),this.unlisten(s.strings.CLOSED_EVENT,this.deregisterBodyClickListener_),t.prototype.destroy.call(this)},e.prototype.isOpen=function(){return this.foundation_.isOpen()},e.prototype.open=function(){this.foundation_.open()},e.prototype.close=function(t){void 0===t&&(t=!1),this.foundation_.close(t)},Object.defineProperty(e.prototype,"quickOpen",{set:function(t){this.foundation_.setQuickOpen(t)},enumerable:!0,configurable:!0}),e.prototype.hoistMenuToBody=function(){document.body.appendChild(this.root_),this.setIsHoisted(!0)},e.prototype.setIsHoisted=function(t){this.foundation_.setIsHoisted(t)},e.prototype.setMenuSurfaceAnchorElement=function(t){this.anchorElement=t},e.prototype.setFixedPosition=function(t){t?this.root_.classList.add(s.cssClasses.FIXED):this.root_.classList.remove(s.cssClasses.FIXED),this.foundation_.setFixedPosition(t)},e.prototype.setAbsolutePosition=function(t,e){this.foundation_.setAbsolutePosition(t,e),this.setIsHoisted(!0)},e.prototype.setAnchorCorner=function(t){this.foundation_.setAnchorCorner(t)},e.prototype.setAnchorMargin=function(t){this.foundation_.setAnchorMargin(t)},e.prototype.getDefaultFoundation=function(){var t=this,e={addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},hasClass:function(e){return t.root_.classList.contains(e)},hasAnchor:function(){return!!t.anchorElement},notifyClose:function(){return t.emit(a.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT,{})},notifyOpen:function(){return t.emit(a.MDCMenuSurfaceFoundation.strings.OPENED_EVENT,{})},isElementInContainer:function(e){return t.root_.contains(e)},isRtl:function(){return"rtl"===getComputedStyle(t.root_).getPropertyValue("direction")},setTransformOrigin:function(e){var n=u.getTransformPropertyName(window)+"-origin";t.root_.style.setProperty(n,e)},isFocused:function(){return document.activeElement===t.root_},saveFocus:function(){t.previousFocus_=document.activeElement},restoreFocus:function(){t.root_.contains(document.activeElement)&&t.previousFocus_&&t.previousFocus_.focus&&t.previousFocus_.focus()},getInnerDimensions:function(){return{width:t.root_.offsetWidth,height:t.root_.offsetHeight}},getAnchorDimensions:function(){return t.anchorElement?t.anchorElement.getBoundingClientRect():null},getWindowDimensions:function(){return{width:window.innerWidth,height:window.innerHeight}},getBodyDimensions:function(){return{width:document.body.clientWidth,height:document.body.clientHeight}},getWindowScroll:function(){return{x:window.pageXOffset,y:window.pageYOffset}},setPosition:function(e){t.root_.style.left="left"in e?e.left+"px":"",t.root_.style.right="right"in e?e.right+"px":"",t.root_.style.top="top"in e?e.top+"px":"",t.root_.style.bottom="bottom"in e?e.bottom+"px":""},setMaxHeight:function(e){t.root_.style.maxHeight=e}};return new a.MDCMenuSurfaceFoundation(e)},e}(r.MDCComponent);e.MDCMenuSurface=c},9:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i={ANCHOR:"mdc-menu-surface--anchor",ANIMATING_CLOSED:"mdc-menu-surface--animating-closed",ANIMATING_OPEN:"mdc-menu-surface--animating-open",FIXED:"mdc-menu-surface--fixed",OPEN:"mdc-menu-surface--open",ROOT:"mdc-menu-surface"};e.cssClasses=i;var o={CLOSED_EVENT:"MDCMenuSurface:closed",OPENED_EVENT:"MDCMenuSurface:opened",FOCUSABLE_ELEMENTS:["button:not(:disabled)",'[href]:not([aria-disabled="true"])',"input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(", ")};e.strings=o;var r={TRANSITION_OPEN_DURATION:120,TRANSITION_CLOSE_DURATION:75,MARGIN_TO_EDGE:32,ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO:.67};e.numbers=r;var s;!function(t){t[t.BOTTOM=1]="BOTTOM",t[t.CENTER=2]="CENTER",t[t.RIGHT=4]="RIGHT",t[t.FLIP_RTL=8]="FLIP_RTL"}(s||(s={})),e.CornerBit=s;var a;!function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=4]="TOP_RIGHT",t[t.BOTTOM_LEFT=1]="BOTTOM_LEFT",t[t.BOTTOM_RIGHT=5]="BOTTOM_RIGHT",t[t.TOP_START=8]="TOP_START",t[t.TOP_END=12]="TOP_END",t[t.BOTTOM_START=9]="BOTTOM_START",t[t.BOTTOM_END=13]="BOTTOM_END"}(a||(a={})),e.Corner=a}})});
//# sourceMappingURL=mdc.menuSurface.min.js.map
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.menuSurface=e():(t.mdc=t.mdc||{},t.mdc.menuSurface=e())}(this,function(){return i={},o.m=n={0:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=(Object.defineProperty(o,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),o.prototype.init=function(){},o.prototype.destroy=function(){},o);function o(t){void 0===t&&(t={}),this.adapter_=t}e.MDCFoundation=i,e.default=i},1:function(t,e,n){"use strict";var i=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,o,r=n.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(i=r.next()).done;)s.push(i.value)}catch(t){o={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s},o=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(i(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),s=(a.attachTo=function(t){return new a(t,new r.MDCFoundation({}))},a.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},a.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},a.prototype.initialSyncWithDOM=function(){},a.prototype.destroy=function(){this.foundation_.destroy()},a.prototype.listen=function(t,e,n){this.root_.addEventListener(t,e,n)},a.prototype.unlisten=function(t,e,n){this.root_.removeEventListener(t,e,n)},a.prototype.emit=function(t,e,n){var i;void 0===n&&(n=!1),"function"==typeof CustomEvent?i=new CustomEvent(t,{bubbles:n,detail:e}):(i=document.createEvent("CustomEvent")).initCustomEvent(t,n,!1,e),this.root_.dispatchEvent(i)},a);function a(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];this.root_=t,this.initialize.apply(this,o(n)),this.foundation_=void 0===e?this.getDefaultFoundation():e,this.foundation_.init(),this.initialSyncWithDOM()}e.MDCComponent=s,e.default=s},138:function(t,n,e){"use strict";function i(t){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])}var o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(n,"__esModule",{value:!0});var r=o(e(22));n.util=r;var s=e(9);n.Corner=s.Corner,n.CornerBit=s.CornerBit,i(e(31)),i(e(9)),i(e(14))},14:function(t,e,n){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},f=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}};Object.defineProperty(e,"__esModule",{value:!0});var s,a=n(0),O=n(9),u=(s=a.MDCFoundation,o(c,s),Object.defineProperty(c,"cssClasses",{get:function(){return O.cssClasses},enumerable:!0,configurable:!0}),Object.defineProperty(c,"strings",{get:function(){return O.strings},enumerable:!0,configurable:!0}),Object.defineProperty(c,"numbers",{get:function(){return O.numbers},enumerable:!0,configurable:!0}),Object.defineProperty(c,"Corner",{get:function(){return O.Corner},enumerable:!0,configurable:!0}),Object.defineProperty(c,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){return!1},hasAnchor:function(){return!1},isElementInContainer:function(){return!1},isFocused:function(){return!1},isRtl:function(){return!1},getInnerDimensions:function(){return{height:0,width:0}},getAnchorDimensions:function(){return null},getWindowDimensions:function(){return{height:0,width:0}},getBodyDimensions:function(){return{height:0,width:0}},getWindowScroll:function(){return{x:0,y:0}},setPosition:function(){},setMaxHeight:function(){},setTransformOrigin:function(){},saveFocus:function(){},restoreFocus:function(){},notifyClose:function(){},notifyOpen:function(){}}},enumerable:!0,configurable:!0}),c.prototype.init=function(){var t=c.cssClasses,e=t.ROOT,n=t.OPEN;if(!this.adapter_.hasClass(e))throw new Error(e+" class required in root element.");this.adapter_.hasClass(n)&&(this.isOpen_=!0)},c.prototype.destroy=function(){clearTimeout(this.openAnimationEndTimerId_),clearTimeout(this.closeAnimationEndTimerId_),cancelAnimationFrame(this.animationRequestId_)},c.prototype.setAnchorCorner=function(t){this.anchorCorner_=t},c.prototype.setAnchorMargin=function(t){this.anchorMargin_.top=t.top||0,this.anchorMargin_.right=t.right||0,this.anchorMargin_.bottom=t.bottom||0,this.anchorMargin_.left=t.left||0},c.prototype.setIsHoisted=function(t){this.isHoistedElement_=t},c.prototype.setFixedPosition=function(t){this.isFixedPosition_=t},c.prototype.setAbsolutePosition=function(t,e){this.position_.x=this.isFinite_(t)?t:0,this.position_.y=this.isFinite_(e)?e:0},c.prototype.setQuickOpen=function(t){this.isQuickOpen_=t},c.prototype.isOpen=function(){return this.isOpen_},c.prototype.open=function(){var t=this;this.adapter_.saveFocus(),this.isQuickOpen_||this.adapter_.addClass(c.cssClasses.ANIMATING_OPEN),this.animationRequestId_=requestAnimationFrame(function(){t.adapter_.addClass(c.cssClasses.OPEN),t.dimensions_=t.adapter_.getInnerDimensions(),t.autoPosition_(),t.isQuickOpen_?t.adapter_.notifyOpen():t.openAnimationEndTimerId_=setTimeout(function(){t.openAnimationEndTimerId_=0,t.adapter_.removeClass(c.cssClasses.ANIMATING_OPEN),t.adapter_.notifyOpen()},O.numbers.TRANSITION_OPEN_DURATION)}),this.isOpen_=!0},c.prototype.close=function(t){var e=this;void 0===t&&(t=!1),this.isQuickOpen_||this.adapter_.addClass(c.cssClasses.ANIMATING_CLOSED),requestAnimationFrame(function(){e.adapter_.removeClass(c.cssClasses.OPEN),e.isQuickOpen_?e.adapter_.notifyClose():e.closeAnimationEndTimerId_=setTimeout(function(){e.closeAnimationEndTimerId_=0,e.adapter_.removeClass(c.cssClasses.ANIMATING_CLOSED),e.adapter_.notifyClose()},O.numbers.TRANSITION_CLOSE_DURATION)}),this.isOpen_=!1,t||this.maybeRestoreFocus_()},c.prototype.handleBodyClick=function(t){var e=t.target;this.adapter_.isElementInContainer(e)||this.close()},c.prototype.handleKeydown=function(t){var e=t.keyCode;"Escape"!==t.key&&27!==e||this.close()},c.prototype.autoPosition_=function(){var t;this.measurements_=this.getAutoLayoutMeasurements_();var e=this.getOriginCorner_(),n=this.getMenuSurfaceMaxHeight_(e),i=this.hasBit_(e,O.CornerBit.BOTTOM)?"bottom":"top",o=this.hasBit_(e,O.CornerBit.RIGHT)?"right":"left",r=this.getHorizontalOriginOffset_(e),s=this.getVerticalOriginOffset_(e),a=this.measurements_,u=a.anchorSize,c=a.surfaceSize,h=((t={})[o]=r,t[i]=s,t);u.width/c.width>O.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO&&(o="center"),(this.isHoistedElement_||this.isFixedPosition_)&&this.adjustPositionForHoistedElement_(h),this.adapter_.setTransformOrigin(o+" "+i),this.adapter_.setPosition(h),this.adapter_.setMaxHeight(n?n+"px":"")},c.prototype.getAutoLayoutMeasurements_=function(){var t=this.adapter_.getAnchorDimensions(),e=this.adapter_.getBodyDimensions(),n=this.adapter_.getWindowDimensions(),i=this.adapter_.getWindowScroll();return{anchorSize:t=t||{top:this.position_.y,right:this.position_.x,bottom:this.position_.y,left:this.position_.x,width:0,height:0},bodySize:e,surfaceSize:this.dimensions_,viewportDistance:{top:t.top,right:n.width-t.right,bottom:n.height-t.bottom,left:t.left},viewportSize:n,windowScroll:i}},c.prototype.getOriginCorner_=function(){var t=O.Corner.TOP_LEFT,e=this.measurements_,n=e.viewportDistance,i=e.anchorSize,o=e.surfaceSize,r=this.hasBit_(this.anchorCorner_,O.CornerBit.BOTTOM),s=r?n.top+i.height+this.anchorMargin_.bottom:n.top+this.anchorMargin_.top,a=r?n.bottom-this.anchorMargin_.bottom:n.bottom+i.height-this.anchorMargin_.top,u=o.height-s,c=o.height-a;0<c&&u<c&&(t=this.setBit_(t,O.CornerBit.BOTTOM));var h=this.adapter_.isRtl(),f=this.hasBit_(this.anchorCorner_,O.CornerBit.FLIP_RTL),d=this.hasBit_(this.anchorCorner_,O.CornerBit.RIGHT),l=d&&!h||!d&&f&&h,_=l?n.left+i.width+this.anchorMargin_.right:n.left+this.anchorMargin_.left,p=l?n.right-this.anchorMargin_.right:n.right+i.width-this.anchorMargin_.left,m=o.width-_,y=o.width-p;return(m<0&&l&&h||d&&!l&&m<0||0<y&&m<y)&&(t=this.setBit_(t,O.CornerBit.RIGHT)),t},c.prototype.getMenuSurfaceMaxHeight_=function(t){var e=this.measurements_.viewportDistance,n=0,i=this.hasBit_(t,O.CornerBit.BOTTOM),o=this.hasBit_(this.anchorCorner_,O.CornerBit.BOTTOM),r=c.numbers.MARGIN_TO_EDGE;return i?(n=e.top+this.anchorMargin_.top-r,o||(n+=this.measurements_.anchorSize.height)):(n=e.bottom-this.anchorMargin_.bottom+this.measurements_.anchorSize.height-r,o&&(n-=this.measurements_.anchorSize.height)),n},c.prototype.getHorizontalOriginOffset_=function(t){var e=this.measurements_.anchorSize,n=this.hasBit_(t,O.CornerBit.RIGHT),i=this.hasBit_(this.anchorCorner_,O.CornerBit.RIGHT);if(n){var o=i?e.width-this.anchorMargin_.left:this.anchorMargin_.right;return this.isHoistedElement_||this.isFixedPosition_?o-(this.measurements_.viewportSize.width-this.measurements_.bodySize.width):o}return i?e.width-this.anchorMargin_.right:this.anchorMargin_.left},c.prototype.getVerticalOriginOffset_=function(t){var e=this.measurements_.anchorSize,n=this.hasBit_(t,O.CornerBit.BOTTOM),i=this.hasBit_(this.anchorCorner_,O.CornerBit.BOTTOM);return n?i?e.height-this.anchorMargin_.top:-this.anchorMargin_.bottom:i?e.height+this.anchorMargin_.bottom:this.anchorMargin_.top},c.prototype.adjustPositionForHoistedElement_=function(t){var e,n,i=this.measurements_,o=i.windowScroll,r=i.viewportDistance,s=Object.keys(t);try{for(var a=f(s),u=a.next();!u.done;u=a.next()){var c=u.value,h=t[c]||0;h+=r[c],this.isFixedPosition_||("top"===c?h+=o.y:"bottom"===c?h-=o.y:"left"===c?h+=o.x:h-=o.x),t[c]=h}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}},c.prototype.maybeRestoreFocus_=function(){var t=this.adapter_.isFocused(),e=document.activeElement&&this.adapter_.isElementInContainer(document.activeElement);(t||e)&&this.adapter_.restoreFocus()},c.prototype.hasBit_=function(t,e){return Boolean(t&e)},c.prototype.setBit_=function(t,e){return t|e},c.prototype.isFinite_=function(t){return"number"==typeof t&&isFinite(t)},c);function c(t){var e=s.call(this,r({},c.defaultAdapter,t))||this;return e.isOpen_=!1,e.isQuickOpen_=!1,e.isHoistedElement_=!1,e.isFixedPosition_=!1,e.openAnimationEndTimerId_=0,e.closeAnimationEndTimerId_=0,e.animationRequestId_=0,e.anchorCorner_=O.Corner.TOP_START,e.anchorMargin_={top:0,right:0,bottom:0,left:0},e.position_={x:0,y:0},e}e.MDCMenuSurfaceFoundation=u,e.default=u},22:function(t,e,n){"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),e.getTransformPropertyName=function(t,e){if(void 0===e&&(e=!1),void 0===i||e){var n=t.document.createElement("div");i="transform"in n.style?"transform":"webkitTransform"}return i}},31:function(t,e,n){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var s,a=n(1),u=n(9),c=n(14),h=r(n(22)),f=(s=a.MDCComponent,o(d,s),d.attachTo=function(t){return new d(t)},d.prototype.initialSyncWithDOM=function(){var e=this,t=this.root_.parentElement;this.anchorElement=t&&t.classList.contains(u.cssClasses.ANCHOR)?t:null,this.root_.classList.contains(u.cssClasses.FIXED)&&this.setFixedPosition(!0),this.handleKeydown_=function(t){return e.foundation_.handleKeydown(t)},this.handleBodyClick_=function(t){return e.foundation_.handleBodyClick(t)},this.registerBodyClickListener_=function(){return document.body.addEventListener("click",e.handleBodyClick_)},this.deregisterBodyClickListener_=function(){return document.body.removeEventListener("click",e.handleBodyClick_)},this.listen("keydown",this.handleKeydown_),this.listen(u.strings.OPENED_EVENT,this.registerBodyClickListener_),this.listen(u.strings.CLOSED_EVENT,this.deregisterBodyClickListener_)},d.prototype.destroy=function(){this.unlisten("keydown",this.handleKeydown_),this.unlisten(u.strings.OPENED_EVENT,this.registerBodyClickListener_),this.unlisten(u.strings.CLOSED_EVENT,this.deregisterBodyClickListener_),s.prototype.destroy.call(this)},d.prototype.isOpen=function(){return this.foundation_.isOpen()},d.prototype.open=function(){this.foundation_.open()},d.prototype.close=function(t){void 0===t&&(t=!1),this.foundation_.close(t)},Object.defineProperty(d.prototype,"quickOpen",{set:function(t){this.foundation_.setQuickOpen(t)},enumerable:!0,configurable:!0}),d.prototype.hoistMenuToBody=function(){document.body.appendChild(this.root_),this.setIsHoisted(!0)},d.prototype.setIsHoisted=function(t){this.foundation_.setIsHoisted(t)},d.prototype.setMenuSurfaceAnchorElement=function(t){this.anchorElement=t},d.prototype.setFixedPosition=function(t){t?this.root_.classList.add(u.cssClasses.FIXED):this.root_.classList.remove(u.cssClasses.FIXED),this.foundation_.setFixedPosition(t)},d.prototype.setAbsolutePosition=function(t,e){this.foundation_.setAbsolutePosition(t,e),this.setIsHoisted(!0)},d.prototype.setAnchorCorner=function(t){this.foundation_.setAnchorCorner(t)},d.prototype.setAnchorMargin=function(t){this.foundation_.setAnchorMargin(t)},d.prototype.getDefaultFoundation=function(){var n=this,t={addClass:function(t){return n.root_.classList.add(t)},removeClass:function(t){return n.root_.classList.remove(t)},hasClass:function(t){return n.root_.classList.contains(t)},hasAnchor:function(){return!!n.anchorElement},notifyClose:function(){return n.emit(c.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT,{})},notifyOpen:function(){return n.emit(c.MDCMenuSurfaceFoundation.strings.OPENED_EVENT,{})},isElementInContainer:function(t){return n.root_.contains(t)},isRtl:function(){return"rtl"===getComputedStyle(n.root_).getPropertyValue("direction")},setTransformOrigin:function(t){var e=h.getTransformPropertyName(window)+"-origin";n.root_.style.setProperty(e,t)},isFocused:function(){return document.activeElement===n.root_},saveFocus:function(){n.previousFocus_=document.activeElement},restoreFocus:function(){n.root_.contains(document.activeElement)&&n.previousFocus_&&n.previousFocus_.focus&&n.previousFocus_.focus()},getInnerDimensions:function(){return{width:n.root_.offsetWidth,height:n.root_.offsetHeight}},getAnchorDimensions:function(){return n.anchorElement?n.anchorElement.getBoundingClientRect():null},getWindowDimensions:function(){return{width:window.innerWidth,height:window.innerHeight}},getBodyDimensions:function(){return{width:document.body.clientWidth,height:document.body.clientHeight}},getWindowScroll:function(){return{x:window.pageXOffset,y:window.pageYOffset}},setPosition:function(t){n.root_.style.left="left"in t?t.left+"px":"",n.root_.style.right="right"in t?t.right+"px":"",n.root_.style.top="top"in t?t.top+"px":"",n.root_.style.bottom="bottom"in t?t.bottom+"px":""},setMaxHeight:function(t){n.root_.style.maxHeight=t}};return new c.MDCMenuSurfaceFoundation(t)},d);function d(){return null!==s&&s.apply(this,arguments)||this}e.MDCMenuSurface=f},9:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.cssClasses={ANCHOR:"mdc-menu-surface--anchor",ANIMATING_CLOSED:"mdc-menu-surface--animating-closed",ANIMATING_OPEN:"mdc-menu-surface--animating-open",FIXED:"mdc-menu-surface--fixed",OPEN:"mdc-menu-surface--open",ROOT:"mdc-menu-surface"};var i={CLOSED_EVENT:"MDCMenuSurface:closed",OPENED_EVENT:"MDCMenuSurface:opened",FOCUSABLE_ELEMENTS:["button:not(:disabled)",'[href]:not([aria-disabled="true"])',"input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(", ")};e.strings=i;var o,r,s,a;e.numbers={TRANSITION_OPEN_DURATION:120,TRANSITION_CLOSE_DURATION:75,MARGIN_TO_EDGE:32,ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO:.67},(r=o=o||{})[r.BOTTOM=1]="BOTTOM",r[r.CENTER=2]="CENTER",r[r.RIGHT=4]="RIGHT",r[r.FLIP_RTL=8]="FLIP_RTL",e.CornerBit=o,(a=s=s||{})[a.TOP_LEFT=0]="TOP_LEFT",a[a.TOP_RIGHT=4]="TOP_RIGHT",a[a.BOTTOM_LEFT=1]="BOTTOM_LEFT",a[a.BOTTOM_RIGHT=5]="BOTTOM_RIGHT",a[a.TOP_START=8]="TOP_START",a[a.TOP_END=12]="TOP_END",a[a.BOTTOM_START=9]="BOTTOM_START",a[a.BOTTOM_END=13]="BOTTOM_END",e.Corner=s}},o.c=i,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=138);function o(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}var n,i});
{
"name": "@material/menu-surface",
"version": "3.0.0",
"version": "3.1.0-alpha.0",
"description": "The Material Components for the web menu surface component",

@@ -22,7 +22,7 @@ "license": "MIT",

"@material/base": "^3.0.0",
"@material/elevation": "^3.0.0",
"@material/elevation": "^3.1.0-alpha.0",
"@material/feature-targeting": "^3.0.0",
"@material/rtl": "^3.0.0",
"@material/shape": "^3.0.0",
"@material/theme": "^3.0.0",
"@material/theme": "^3.1.0-alpha.0",
"tslib": "^1.9.3"

@@ -33,3 +33,3 @@ },

},
"gitHead": "747f6ed544e3a3bb3fde71ceaa51359f2212bfb9"
"gitHead": "42b485550d87a4c3328a07847b4070d15f09af8f"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc