Socket
Socket
Sign inDemoInstall

@material/snackbar

Package Overview
Dependencies
Maintainers
10
Versions
1684
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/snackbar - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

146

dist/mdc.snackbar.js

@@ -78,3 +78,3 @@ /*!

/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 77);
/******/ return __webpack_require__(__webpack_require__.s = 80);
/******/ })

@@ -366,4 +366,6 @@ /************************************************************************/

/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__component__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__selection_control__ = __webpack_require__(3);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCFoundation", function() { return __WEBPACK_IMPORTED_MODULE_0__foundation__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__component__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionControlState", function() { return __WEBPACK_IMPORTED_MODULE_2__selection_control__["a"]; });
/**

@@ -390,8 +392,42 @@ * Copyright 2016 Google Inc.

/***/ }),
/***/ 77:
/***/ 3:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SelectionControlState; });
/**
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @typedef {!{
* checked: boolean,
* indeterminate: boolean,
* disabled: boolean,
* value: ?string
* }}
*/
var SelectionControlState = void 0;
/***/ }),
/***/ 80:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(78);
module.exports = __webpack_require__(81);

@@ -401,3 +437,3 @@

/***/ 78:
/***/ 81:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

@@ -409,4 +445,4 @@

/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation__ = __webpack_require__(79);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__material_animation__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation__ = __webpack_require__(82);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__material_animation__ = __webpack_require__(9);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCSnackbarFoundation", function() { return __WEBPACK_IMPORTED_MODULE_1__foundation__["a"]; });

@@ -530,6 +566,6 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

registerTransitionEndHandler: function registerTransitionEndHandler(handler) {
return _this2.root_.addEventListener(__WEBPACK_IMPORTED_MODULE_2__material_animation__["getCorrectEventName"](window, 'transitionend'), handler);
return _this2.root_.addEventListener(Object(__WEBPACK_IMPORTED_MODULE_2__material_animation__["getCorrectEventName"])(window, 'transitionend'), handler);
},
deregisterTransitionEndHandler: function deregisterTransitionEndHandler(handler) {
return _this2.root_.removeEventListener(__WEBPACK_IMPORTED_MODULE_2__material_animation__["getCorrectEventName"](window, 'transitionend'), handler);
return _this2.root_.removeEventListener(Object(__WEBPACK_IMPORTED_MODULE_2__material_animation__["getCorrectEventName"])(window, 'transitionend'), handler);
}

@@ -558,3 +594,3 @@ });

/***/ 79:
/***/ 82:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

@@ -564,3 +600,3 @@

/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constants__ = __webpack_require__(80);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constants__ = __webpack_require__(83);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

@@ -862,6 +898,50 @@

/***/ 8:
/***/ 83:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cssClasses; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return strings; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return numbers; });
/**
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var cssClasses = {
ROOT: 'mdc-snackbar',
TEXT: 'mdc-snackbar__text',
ACTION_WRAPPER: 'mdc-snackbar__action-wrapper',
ACTION_BUTTON: 'mdc-snackbar__action-button',
ACTIVE: 'mdc-snackbar--active',
MULTILINE: 'mdc-snackbar--multiline',
ACTION_ON_BOTTOM: 'mdc-snackbar--action-on-bottom'
};
var strings = {
TEXT_SELECTOR: '.mdc-snackbar__text',
ACTION_WRAPPER_SELECTOR: '.mdc-snackbar__action-wrapper',
ACTION_BUTTON_SELECTOR: '.mdc-snackbar__action-button'
};
var numbers = {
MESSAGE_TIMEOUT: 2750
};
/***/ }),
/***/ 9:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

@@ -1009,46 +1089,2 @@ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformStyleProperties", function() { return transformStyleProperties; });

/***/ }),
/***/ 80:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cssClasses; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return strings; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return numbers; });
/**
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var cssClasses = {
ROOT: 'mdc-snackbar',
TEXT: 'mdc-snackbar__text',
ACTION_WRAPPER: 'mdc-snackbar__action-wrapper',
ACTION_BUTTON: 'mdc-snackbar__action-button',
ACTIVE: 'mdc-snackbar--active',
MULTILINE: 'mdc-snackbar--multiline',
ACTION_ON_BOTTOM: 'mdc-snackbar--action-on-bottom'
};
var strings = {
TEXT_SELECTOR: '.mdc-snackbar__text',
ACTION_WRAPPER_SELECTOR: '.mdc-snackbar__action-wrapper',
ACTION_BUTTON_SELECTOR: '.mdc-snackbar__action-button'
};
var numbers = {
MESSAGE_TIMEOUT: 2750
};
/***/ })

@@ -1055,0 +1091,0 @@

@@ -6,2 +6,2 @@ /*!

*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.snackbar=e():(t.mdc=t.mdc||{},t.mdc.snackbar=e())}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.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="/assets/",e(e.s=77)}({0:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t),this.adapter_=e}return r(t,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),r(t,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),t}();e.a=a},1:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=n(0),a=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;i(this,t),this.root_=e;for(var r=arguments.length,a=Array(r>2?r-2:0),o=2;o<r;o++)a[o-2]=arguments[o];this.initialize.apply(this,a),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return a(t,null,[{key:"attachTo",value:function(e){return new t(e,new r.a)}}]),a(t,[{key:"initialize",value:function(){}},{key:"getDefaultFoundation",value:function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")}},{key:"initialSyncWithDOM",value:function(){}},{key:"destroy",value:function(){this.foundation_.destroy()}},{key:"listen",value:function(t,e){this.root_.addEventListener(t,e)}},{key:"unlisten",value:function(t,e){this.root_.removeEventListener(t,e)}},{key:"emit",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=void 0;"function"==typeof CustomEvent?i=new CustomEvent(t,{detail:e,bubbles:n}):(i=document.createEvent("CustomEvent"),i.initCustomEvent(t,n,!1,e)),this.root_.dispatchEvent(i)}}]),t}();e.a=o},2:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(1);n.d(e,"MDCFoundation",function(){return i.a}),n.d(e,"MDCComponent",function(){return r.a})},77:function(t,e,n){t.exports=n(78)},78:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"MDCSnackbar",function(){return d});var o=n(2),s=n(79),u=n(8);n.d(e,"MDCSnackbarFoundation",function(){return s.a});var c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),d=function(t){function e(){return i(this,e),r(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),c(e,[{key:"show",value:function(t){this.foundation_.show(t)}},{key:"getDefaultFoundation",value:function(){var t=this,e=s.a.strings,n=e.TEXT_SELECTOR,i=e.ACTION_BUTTON_SELECTOR,r=function(){return t.root_.querySelector(n)},a=function(){return t.root_.querySelector(i)};return new s.a({addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},setAriaHidden:function(){return t.root_.setAttribute("aria-hidden","true")},unsetAriaHidden:function(){return t.root_.removeAttribute("aria-hidden")},setActionAriaHidden:function(){return a().setAttribute("aria-hidden","true")},unsetActionAriaHidden:function(){return a().removeAttribute("aria-hidden")},setActionText:function(t){a().textContent=t},setMessageText:function(t){r().textContent=t},setFocus:function(){return a().focus()},visibilityIsHidden:function(){return document.hidden},registerCapturedBlurHandler:function(t){return a().addEventListener("blur",t,!0)},deregisterCapturedBlurHandler:function(t){return a().removeEventListener("blur",t,!0)},registerVisibilityChangeHandler:function(t){return document.addEventListener("visibilitychange",t)},deregisterVisibilityChangeHandler:function(t){return document.removeEventListener("visibilitychange",t)},registerCapturedInteractionHandler:function(t,e){return document.body.addEventListener(t,e,!0)},deregisterCapturedInteractionHandler:function(t,e){return document.body.removeEventListener(t,e,!0)},registerActionClickHandler:function(t){return a().addEventListener("click",t)},deregisterActionClickHandler:function(t){return a().removeEventListener("click",t)},registerTransitionEndHandler:function(e){return t.root_.addEventListener(u.getCorrectEventName(window,"transitionend"),e)},deregisterTransitionEndHandler:function(e){return t.root_.removeEventListener(u.getCorrectEventName(window,"transitionend"),e)}})}},{key:"dismissesOnAction",get:function(){return this.foundation_.dismissesOnAction()},set:function(t){this.foundation_.setDismissOnAction(t)}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(o.MDCComponent)},79:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=n(2),s=n(80),u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),d=function(t){function e(t){i(this,e);var n=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,u(e.defaultAdapter,t)));return n.active_=!1,n.actionWasClicked_=!1,n.dismissOnAction_=!0,n.firstFocus_=!0,n.pointerDownRecognized_=!1,n.snackbarHasFocus_=!1,n.snackbarData_=null,n.queue_=[],n.actionClickHandler_=function(){n.actionWasClicked_=!0,n.invokeAction_()},n.visibilitychangeHandler_=function(){clearTimeout(n.timeoutId_),n.snackbarHasFocus_=!0,n.adapter_.visibilityIsHidden()||setTimeout(n.cleanup_.bind(n),n.snackbarData_.timeout||s.b.MESSAGE_TIMEOUT)},n.interactionHandler_=function(t){"touchstart"!=t.type&&"mousedown"!=t.type||(n.pointerDownRecognized_=!0),n.handlePossibleTabKeyboardFocus_(t),"focus"==t.type&&(n.pointerDownRecognized_=!1)},n.blurHandler_=function(){clearTimeout(n.timeoutId_),n.snackbarHasFocus_=!1,n.timeoutId_=setTimeout(n.cleanup_.bind(n),n.snackbarData_.timeout||s.b.MESSAGE_TIMEOUT)},n}return a(e,t),c(e,[{key:"active",get:function(){return this.active_}}],[{key:"cssClasses",get:function(){return s.a}},{key:"strings",get:function(){return s.c}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},setAriaHidden:function(){},unsetAriaHidden:function(){},setActionAriaHidden:function(){},unsetActionAriaHidden:function(){},setActionText:function(){},setMessageText:function(){},setFocus:function(){},visibilityIsHidden:function(){return!1},registerCapturedBlurHandler:function(){},deregisterCapturedBlurHandler:function(){},registerVisibilityChangeHandler:function(){},deregisterVisibilityChangeHandler:function(){},registerCapturedInteractionHandler:function(){},deregisterCapturedInteractionHandler:function(){},registerActionClickHandler:function(){},deregisterActionClickHandler:function(){},registerTransitionEndHandler:function(){},deregisterTransitionEndHandler:function(){}}}}]),c(e,[{key:"init",value:function(){this.adapter_.registerActionClickHandler(this.actionClickHandler_),this.adapter_.setAriaHidden(),this.adapter_.setActionAriaHidden()}},{key:"destroy",value:function(){var t=this;this.adapter_.deregisterActionClickHandler(this.actionClickHandler_),this.adapter_.deregisterCapturedBlurHandler(this.blurHandler_),this.adapter_.deregisterVisibilityChangeHandler(this.visibilitychangeHandler_),["touchstart","mousedown","focus"].forEach(function(e){t.adapter_.deregisterCapturedInteractionHandler(e,t.interactionHandler_)})}},{key:"dismissesOnAction",value:function(){return this.dismissOnAction_}},{key:"setDismissOnAction",value:function(t){this.dismissOnAction_=!!t}},{key:"show",value:function(t){var e=this;if(clearTimeout(this.timeoutId_),this.snackbarData_=t,this.firstFocus_=!0,this.adapter_.registerVisibilityChangeHandler(this.visibilitychangeHandler_),this.adapter_.registerCapturedBlurHandler(this.blurHandler_),["touchstart","mousedown","focus"].forEach(function(t){e.adapter_.registerCapturedInteractionHandler(t,e.interactionHandler_)}),!this.snackbarData_)throw new Error("Please provide a data object with at least a message to display.");if(!this.snackbarData_.message)throw new Error("Please provide a message to be displayed.");if(this.snackbarData_.actionHandler&&!this.snackbarData_.actionText)throw new Error("Please provide action text with the handler.");this.active&&this.queue_.push(this.snackbarData_);var n=s.a.ACTIVE,i=s.a.MULTILINE,r=s.a.ACTION_ON_BOTTOM;this.adapter_.setMessageText(this.snackbarData_.message),this.snackbarData_.multiline&&(this.adapter_.addClass(i),this.snackbarData_.actionOnBottom&&this.adapter_.addClass(r)),this.snackbarData_.actionHandler?(this.adapter_.setActionText(this.snackbarData_.actionText),this.actionHandler_=this.snackbarData_.actionHandler,this.setActionHidden_(!1)):(this.setActionHidden_(!0),this.actionHandler_=null,this.adapter_.setActionText(null)),this.active_=!0,this.adapter_.addClass(n),this.adapter_.unsetAriaHidden(),this.timeoutId_=setTimeout(this.cleanup_.bind(this),this.snackbarData_.timeout||s.b.MESSAGE_TIMEOUT)}},{key:"handlePossibleTabKeyboardFocus_",value:function(){this.firstFocus_&&!this.pointerDownRecognized_&&this.setFocusOnAction_(),this.firstFocus_=!1}},{key:"setFocusOnAction_",value:function(){this.adapter_.setFocus(),this.snackbarHasFocus_=!0,this.firstFocus_=!1}},{key:"invokeAction_",value:function(){try{if(!this.actionHandler_)return;this.actionHandler_()}finally{this.dismissOnAction_&&this.cleanup_()}}},{key:"cleanup_",value:function(){var t=this;if(!this.snackbarHasFocus_||this.actionWasClicked_){var e=s.a.ACTIVE,n=s.a.MULTILINE,i=s.a.ACTION_ON_BOTTOM;this.adapter_.removeClass(e);var r=function e(){clearTimeout(t.timeoutId_),t.adapter_.deregisterTransitionEndHandler(e),t.adapter_.removeClass(n),t.adapter_.removeClass(i),t.setActionHidden_(!0),t.adapter_.setAriaHidden(),t.active_=!1,t.snackbarHasFocus_=!1,t.showNext_()};this.adapter_.registerTransitionEndHandler(r)}}},{key:"showNext_",value:function(){this.queue_.length&&this.show(this.queue_.shift())}},{key:"setActionHidden_",value:function(t){t?this.adapter_.setActionAriaHidden():this.adapter_.unsetActionAriaHidden()}}]),e}(o.MDCFoundation);e.a=d},8:function(t,e,n){"use strict";function i(t){return void 0!==t.document&&"function"==typeof t.document.createElement}function r(t){return t in c||t in d}function a(t,e,n){return e[t].styleProperty in n.style?e[t].noPrefix:e[t].webkitPrefix}function o(t,e){if(!i(t)||!r(e))return e;var n=e in c?c:d,o=t.document.createElement("div");return n===c?a(e,n,o):n[e].noPrefix in o.style?n[e].noPrefix:n[e].webkitPrefix}function s(t,e){return o(t,e)}function u(t,e){return o(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"transformStyleProperties",function(){return l}),e.getCorrectEventName=s,e.getCorrectPropertyName=u;var c={animationstart:{noPrefix:"animationstart",webkitPrefix:"webkitAnimationStart",styleProperty:"animation"},animationend:{noPrefix:"animationend",webkitPrefix:"webkitAnimationEnd",styleProperty:"animation"},animationiteration:{noPrefix:"animationiteration",webkitPrefix:"webkitAnimationIteration",styleProperty:"animation"},transitionend:{noPrefix:"transitionend",webkitPrefix:"webkitTransitionEnd",styleProperty:"transition"}},d={animation:{noPrefix:"animation",webkitPrefix:"-webkit-animation"},transform:{noPrefix:"transform",webkitPrefix:"-webkit-transform"},transition:{noPrefix:"transition",webkitPrefix:"-webkit-transition"}},l=["transform","WebkitTransform","MozTransform","OTransform","MSTransform"]},80:function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n.d(e,"c",function(){return r}),n.d(e,"b",function(){return a});var i={ROOT:"mdc-snackbar",TEXT:"mdc-snackbar__text",ACTION_WRAPPER:"mdc-snackbar__action-wrapper",ACTION_BUTTON:"mdc-snackbar__action-button",ACTIVE:"mdc-snackbar--active",MULTILINE:"mdc-snackbar--multiline",ACTION_ON_BOTTOM:"mdc-snackbar--action-on-bottom"},r={TEXT_SELECTOR:".mdc-snackbar__text",ACTION_WRAPPER_SELECTOR:".mdc-snackbar__action-wrapper",ACTION_BUTTON_SELECTOR:".mdc-snackbar__action-button"},a={MESSAGE_TIMEOUT:2750}}})});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.snackbar=e():(t.mdc=t.mdc||{},t.mdc.snackbar=e())}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.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="/assets/",e(e.s=80)}({0:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t),this.adapter_=e}return r(t,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),r(t,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),t}();e.a=a},1:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=n(0),a=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;i(this,t),this.root_=e;for(var r=arguments.length,a=Array(r>2?r-2:0),o=2;o<r;o++)a[o-2]=arguments[o];this.initialize.apply(this,a),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return a(t,null,[{key:"attachTo",value:function(e){return new t(e,new r.a)}}]),a(t,[{key:"initialize",value:function(){}},{key:"getDefaultFoundation",value:function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")}},{key:"initialSyncWithDOM",value:function(){}},{key:"destroy",value:function(){this.foundation_.destroy()}},{key:"listen",value:function(t,e){this.root_.addEventListener(t,e)}},{key:"unlisten",value:function(t,e){this.root_.removeEventListener(t,e)}},{key:"emit",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=void 0;"function"==typeof CustomEvent?i=new CustomEvent(t,{detail:e,bubbles:n}):(i=document.createEvent("CustomEvent"),i.initCustomEvent(t,n,!1,e)),this.root_.dispatchEvent(i)}}]),t}();e.a=o},2:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(1),a=n(3);n.d(e,"MDCFoundation",function(){return i.a}),n.d(e,"MDCComponent",function(){return r.a}),n.d(e,"SelectionControlState",function(){return a.a})},3:function(t,e,n){"use strict";n.d(e,"a",function(){return i});var i=void 0},80:function(t,e,n){t.exports=n(81)},81:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"MDCSnackbar",function(){return d});var o=n(2),s=n(82),u=n(9);n.d(e,"MDCSnackbarFoundation",function(){return s.a});var c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),d=function(t){function e(){return i(this,e),r(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),c(e,[{key:"show",value:function(t){this.foundation_.show(t)}},{key:"getDefaultFoundation",value:function(){var t=this,e=s.a.strings,n=e.TEXT_SELECTOR,i=e.ACTION_BUTTON_SELECTOR,r=function(){return t.root_.querySelector(n)},a=function(){return t.root_.querySelector(i)};return new s.a({addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},setAriaHidden:function(){return t.root_.setAttribute("aria-hidden","true")},unsetAriaHidden:function(){return t.root_.removeAttribute("aria-hidden")},setActionAriaHidden:function(){return a().setAttribute("aria-hidden","true")},unsetActionAriaHidden:function(){return a().removeAttribute("aria-hidden")},setActionText:function(t){a().textContent=t},setMessageText:function(t){r().textContent=t},setFocus:function(){return a().focus()},visibilityIsHidden:function(){return document.hidden},registerCapturedBlurHandler:function(t){return a().addEventListener("blur",t,!0)},deregisterCapturedBlurHandler:function(t){return a().removeEventListener("blur",t,!0)},registerVisibilityChangeHandler:function(t){return document.addEventListener("visibilitychange",t)},deregisterVisibilityChangeHandler:function(t){return document.removeEventListener("visibilitychange",t)},registerCapturedInteractionHandler:function(t,e){return document.body.addEventListener(t,e,!0)},deregisterCapturedInteractionHandler:function(t,e){return document.body.removeEventListener(t,e,!0)},registerActionClickHandler:function(t){return a().addEventListener("click",t)},deregisterActionClickHandler:function(t){return a().removeEventListener("click",t)},registerTransitionEndHandler:function(e){return t.root_.addEventListener(Object(u.getCorrectEventName)(window,"transitionend"),e)},deregisterTransitionEndHandler:function(e){return t.root_.removeEventListener(Object(u.getCorrectEventName)(window,"transitionend"),e)}})}},{key:"dismissesOnAction",get:function(){return this.foundation_.dismissesOnAction()},set:function(t){this.foundation_.setDismissOnAction(t)}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(o.MDCComponent)},82:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=n(2),s=n(83),u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),d=function(t){function e(t){i(this,e);var n=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,u(e.defaultAdapter,t)));return n.active_=!1,n.actionWasClicked_=!1,n.dismissOnAction_=!0,n.firstFocus_=!0,n.pointerDownRecognized_=!1,n.snackbarHasFocus_=!1,n.snackbarData_=null,n.queue_=[],n.actionClickHandler_=function(){n.actionWasClicked_=!0,n.invokeAction_()},n.visibilitychangeHandler_=function(){clearTimeout(n.timeoutId_),n.snackbarHasFocus_=!0,n.adapter_.visibilityIsHidden()||setTimeout(n.cleanup_.bind(n),n.snackbarData_.timeout||s.b.MESSAGE_TIMEOUT)},n.interactionHandler_=function(t){"touchstart"!=t.type&&"mousedown"!=t.type||(n.pointerDownRecognized_=!0),n.handlePossibleTabKeyboardFocus_(t),"focus"==t.type&&(n.pointerDownRecognized_=!1)},n.blurHandler_=function(){clearTimeout(n.timeoutId_),n.snackbarHasFocus_=!1,n.timeoutId_=setTimeout(n.cleanup_.bind(n),n.snackbarData_.timeout||s.b.MESSAGE_TIMEOUT)},n}return a(e,t),c(e,[{key:"active",get:function(){return this.active_}}],[{key:"cssClasses",get:function(){return s.a}},{key:"strings",get:function(){return s.c}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},setAriaHidden:function(){},unsetAriaHidden:function(){},setActionAriaHidden:function(){},unsetActionAriaHidden:function(){},setActionText:function(){},setMessageText:function(){},setFocus:function(){},visibilityIsHidden:function(){return!1},registerCapturedBlurHandler:function(){},deregisterCapturedBlurHandler:function(){},registerVisibilityChangeHandler:function(){},deregisterVisibilityChangeHandler:function(){},registerCapturedInteractionHandler:function(){},deregisterCapturedInteractionHandler:function(){},registerActionClickHandler:function(){},deregisterActionClickHandler:function(){},registerTransitionEndHandler:function(){},deregisterTransitionEndHandler:function(){}}}}]),c(e,[{key:"init",value:function(){this.adapter_.registerActionClickHandler(this.actionClickHandler_),this.adapter_.setAriaHidden(),this.adapter_.setActionAriaHidden()}},{key:"destroy",value:function(){var t=this;this.adapter_.deregisterActionClickHandler(this.actionClickHandler_),this.adapter_.deregisterCapturedBlurHandler(this.blurHandler_),this.adapter_.deregisterVisibilityChangeHandler(this.visibilitychangeHandler_),["touchstart","mousedown","focus"].forEach(function(e){t.adapter_.deregisterCapturedInteractionHandler(e,t.interactionHandler_)})}},{key:"dismissesOnAction",value:function(){return this.dismissOnAction_}},{key:"setDismissOnAction",value:function(t){this.dismissOnAction_=!!t}},{key:"show",value:function(t){var e=this;if(clearTimeout(this.timeoutId_),this.snackbarData_=t,this.firstFocus_=!0,this.adapter_.registerVisibilityChangeHandler(this.visibilitychangeHandler_),this.adapter_.registerCapturedBlurHandler(this.blurHandler_),["touchstart","mousedown","focus"].forEach(function(t){e.adapter_.registerCapturedInteractionHandler(t,e.interactionHandler_)}),!this.snackbarData_)throw new Error("Please provide a data object with at least a message to display.");if(!this.snackbarData_.message)throw new Error("Please provide a message to be displayed.");if(this.snackbarData_.actionHandler&&!this.snackbarData_.actionText)throw new Error("Please provide action text with the handler.");this.active&&this.queue_.push(this.snackbarData_);var n=s.a.ACTIVE,i=s.a.MULTILINE,r=s.a.ACTION_ON_BOTTOM;this.adapter_.setMessageText(this.snackbarData_.message),this.snackbarData_.multiline&&(this.adapter_.addClass(i),this.snackbarData_.actionOnBottom&&this.adapter_.addClass(r)),this.snackbarData_.actionHandler?(this.adapter_.setActionText(this.snackbarData_.actionText),this.actionHandler_=this.snackbarData_.actionHandler,this.setActionHidden_(!1)):(this.setActionHidden_(!0),this.actionHandler_=null,this.adapter_.setActionText(null)),this.active_=!0,this.adapter_.addClass(n),this.adapter_.unsetAriaHidden(),this.timeoutId_=setTimeout(this.cleanup_.bind(this),this.snackbarData_.timeout||s.b.MESSAGE_TIMEOUT)}},{key:"handlePossibleTabKeyboardFocus_",value:function(){this.firstFocus_&&!this.pointerDownRecognized_&&this.setFocusOnAction_(),this.firstFocus_=!1}},{key:"setFocusOnAction_",value:function(){this.adapter_.setFocus(),this.snackbarHasFocus_=!0,this.firstFocus_=!1}},{key:"invokeAction_",value:function(){try{if(!this.actionHandler_)return;this.actionHandler_()}finally{this.dismissOnAction_&&this.cleanup_()}}},{key:"cleanup_",value:function(){var t=this;if(!this.snackbarHasFocus_||this.actionWasClicked_){var e=s.a.ACTIVE,n=s.a.MULTILINE,i=s.a.ACTION_ON_BOTTOM;this.adapter_.removeClass(e);var r=function e(){clearTimeout(t.timeoutId_),t.adapter_.deregisterTransitionEndHandler(e),t.adapter_.removeClass(n),t.adapter_.removeClass(i),t.setActionHidden_(!0),t.adapter_.setAriaHidden(),t.active_=!1,t.snackbarHasFocus_=!1,t.showNext_()};this.adapter_.registerTransitionEndHandler(r)}}},{key:"showNext_",value:function(){this.queue_.length&&this.show(this.queue_.shift())}},{key:"setActionHidden_",value:function(t){t?this.adapter_.setActionAriaHidden():this.adapter_.unsetActionAriaHidden()}}]),e}(o.MDCFoundation);e.a=d},83:function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n.d(e,"c",function(){return r}),n.d(e,"b",function(){return a});var i={ROOT:"mdc-snackbar",TEXT:"mdc-snackbar__text",ACTION_WRAPPER:"mdc-snackbar__action-wrapper",ACTION_BUTTON:"mdc-snackbar__action-button",ACTIVE:"mdc-snackbar--active",MULTILINE:"mdc-snackbar--multiline",ACTION_ON_BOTTOM:"mdc-snackbar--action-on-bottom"},r={TEXT_SELECTOR:".mdc-snackbar__text",ACTION_WRAPPER_SELECTOR:".mdc-snackbar__action-wrapper",ACTION_BUTTON_SELECTOR:".mdc-snackbar__action-button"},a={MESSAGE_TIMEOUT:2750}},9:function(t,e,n){"use strict";function i(t){return void 0!==t.document&&"function"==typeof t.document.createElement}function r(t){return t in c||t in d}function a(t,e,n){return e[t].styleProperty in n.style?e[t].noPrefix:e[t].webkitPrefix}function o(t,e){if(!i(t)||!r(e))return e;var n=e in c?c:d,o=t.document.createElement("div");return n===c?a(e,n,o):n[e].noPrefix in o.style?n[e].noPrefix:n[e].webkitPrefix}function s(t,e){return o(t,e)}function u(t,e){return o(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"transformStyleProperties",function(){return f}),e.getCorrectEventName=s,e.getCorrectPropertyName=u;var c={animationstart:{noPrefix:"animationstart",webkitPrefix:"webkitAnimationStart",styleProperty:"animation"},animationend:{noPrefix:"animationend",webkitPrefix:"webkitAnimationEnd",styleProperty:"animation"},animationiteration:{noPrefix:"animationiteration",webkitPrefix:"webkitAnimationIteration",styleProperty:"animation"},transitionend:{noPrefix:"transitionend",webkitPrefix:"webkitTransitionEnd",styleProperty:"transition"}},d={animation:{noPrefix:"animation",webkitPrefix:"-webkit-animation"},transform:{noPrefix:"transform",webkitPrefix:"-webkit-transform"},transition:{noPrefix:"transition",webkitPrefix:"-webkit-transition"}},f=["transform","WebkitTransform","MozTransform","OTransform","MSTransform"]}})});
{
"name": "@material/snackbar",
"description": "The Material Components for the web snackbar component",
"version": "0.3.0",
"version": "0.3.1",
"license": "Apache-2.0",

@@ -17,9 +17,9 @@ "keywords": [

"dependencies": {
"@material/animation": "^0.2.3",
"@material/base": "^0.2.2",
"@material/button": "^0.3.9",
"@material/rtl": "^0.1.6",
"@material/theme": "^0.1.5",
"@material/typography": "^0.2.2"
"@material/animation": "^0.3.0",
"@material/base": "^0.2.3",
"@material/button": "^0.3.10",
"@material/rtl": "^0.1.7",
"@material/theme": "^0.1.6",
"@material/typography": "^0.2.3"
}
}

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