@material/list
Advanced tools
Comparing version 0.43.0 to 0.44.0
@@ -87,8 +87,2 @@ /** | ||
/** | ||
* If the given element has an href, follows the link. | ||
* @param {!Element} ele | ||
*/ | ||
followHref(ele) {} | ||
/** | ||
* @param {number} index | ||
@@ -119,2 +113,7 @@ * @return {boolean} Returns true if radio button is present at given list item index. | ||
/** | ||
* Notifies user action on list item. | ||
*/ | ||
notifyAction(index) {} | ||
/** | ||
* @return {boolean} Returns true when the current focused element is inside list root. | ||
@@ -121,0 +120,0 @@ */ |
@@ -50,2 +50,3 @@ /** | ||
ENABLED_ITEMS_SELECTOR: '.mdc-list-item:not(.mdc-list-item--disabled)', | ||
ACTION_EVENT: 'MDCList:action', | ||
}; | ||
@@ -52,0 +53,0 @@ |
@@ -494,11 +494,2 @@ /*! | ||
/** | ||
* If the given element has an href, follows the link. | ||
* @param {!Element} ele | ||
*/ | ||
}, { | ||
key: "followHref", | ||
value: function followHref(ele) {} | ||
/** | ||
* @param {number} index | ||
@@ -541,2 +532,10 @@ * @return {boolean} Returns true if radio button is present at given list item index. | ||
/** | ||
* Notifies user action on list item. | ||
*/ | ||
}, { | ||
key: "notifyAction", | ||
value: function notifyAction(index) {} | ||
/** | ||
* @return {boolean} Returns true when the current focused element is inside list root. | ||
@@ -609,3 +608,4 @@ */ | ||
FOCUSABLE_CHILD_ELEMENTS: '.' + cssClasses.LIST_ITEM_CLASS + ' button:not(:disabled), .' + cssClasses.LIST_ITEM_CLASS + ' a,\n .' + cssClasses.LIST_ITEM_CLASS + ' input[type="radio"]:not(:disabled),\n .' + cssClasses.LIST_ITEM_CLASS + ' input[type="checkbox"]:not(:disabled)', | ||
ENABLED_ITEMS_SELECTOR: '.mdc-list-item:not(.mdc-list-item--disabled)' | ||
ENABLED_ITEMS_SELECTOR: '.mdc-list-item:not(.mdc-list-item--disabled)', | ||
ACTION_EVENT: 'MDCList:action' | ||
}; | ||
@@ -703,3 +703,2 @@ | ||
setTabIndexForListItemChildren: function setTabIndexForListItemChildren() {}, | ||
followHref: function followHref() {}, | ||
hasRadioAtIndex: function hasRadioAtIndex() {}, | ||
@@ -709,2 +708,3 @@ hasCheckboxAtIndex: function hasCheckboxAtIndex() {}, | ||
setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex() {}, | ||
notifyAction: function notifyAction() {}, | ||
isFocusInsideList: function isFocusInsideList() {} | ||
@@ -916,9 +916,11 @@ } | ||
if (isRootListItem) { | ||
// Return early if enter key is pressed on anchor element which triggers synthetic MouseEvent event. | ||
if (evt.target.tagName === 'A' && isEnter) return; | ||
this.preventDefaultEvent_(evt); | ||
if (this.isSelectableList_()) { | ||
this.setSelectedIndexOnAction_(currentIndex); | ||
this.preventDefaultEvent_(evt); | ||
} | ||
// Explicitly activate links, since we're preventing default on Enter, and Space doesn't activate them. | ||
this.adapter_.followHref(currentIndex); | ||
this.adapter_.notifyAction(currentIndex); | ||
} | ||
@@ -950,2 +952,4 @@ } | ||
this.adapter_.notifyAction(index); | ||
this.setTabindexAtIndex_(index); | ||
@@ -1557,8 +1561,2 @@ this.focusedItemIndex_ = index; | ||
}, | ||
followHref: function followHref(index) { | ||
var listItem = _this3.listElements[index]; | ||
if (listItem && listItem.href) { | ||
listItem.click(); | ||
} | ||
}, | ||
hasCheckboxAtIndex: function hasCheckboxAtIndex(index) { | ||
@@ -1586,2 +1584,5 @@ var listItem = _this3.listElements[index]; | ||
}, | ||
notifyAction: function notifyAction(index) { | ||
_this3.emit(__WEBPACK_IMPORTED_MODULE_4__constants__["b" /* strings */].ACTION_EVENT, index, /** shouldBubble */true); | ||
}, | ||
isFocusInsideList: function isFocusInsideList() { | ||
@@ -1588,0 +1589,0 @@ return _this3.root_.contains(document.activeElement); |
@@ -6,3 +6,3 @@ /*! | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.list=t():(e.mdc=e.mdc||{},e.mdc.list=t())}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=25)}({0:function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this.adapter_=t}return o(e,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),o(e,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),e}();t.a=s},1:function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(0),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;i(this,e),this.root_=t;for(var o=arguments.length,s=Array(o>2?o-2:0),r=2;r<o;r++)s[r-2]=arguments[r];this.initialize.apply(this,s),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return s(e,null,[{key:"attachTo",value:function(t){return new e(t,new o.a)}}]),s(e,[{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(e,t){this.root_.addEventListener(e,t)}},{key:"unlisten",value:function(e,t){this.root_.removeEventListener(e,t)}},{key:"emit",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=void 0;"function"==typeof CustomEvent?i=new CustomEvent(e,{detail:t,bubbles:n}):(i=document.createEvent("CustomEvent"),i.initCustomEvent(e,n,!1,t)),this.root_.dispatchEvent(i)}}]),e}();t.a=r},10:function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();!function(){function e(){i(this,e)}o(e,[{key:"getListItemCount",value:function(){}},{key:"getFocusedElementIndex",value:function(){}},{key:"setAttributeForElementIndex",value:function(e,t,n){}},{key:"removeAttributeForElementIndex",value:function(e,t){}},{key:"addClassForElementIndex",value:function(e,t){}},{key:"removeClassForElementIndex",value:function(e,t){}},{key:"focusItemAtIndex",value:function(e){}},{key:"setTabIndexForListItemChildren",value:function(e,t){}},{key:"followHref",value:function(e){}},{key:"hasRadioAtIndex",value:function(e){}},{key:"hasCheckboxAtIndex",value:function(e){}},{key:"isCheckboxCheckedAtIndex",value:function(e){}},{key:"setCheckedCheckboxOrRadioAtIndex",value:function(e,t){}},{key:"isFocusInsideList",value:function(){}}])}()},11:function(e,t,n){"use strict";n.d(t,"b",function(){return o}),n.d(t,"a",function(){return i});/** | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.list=t():(e.mdc=e.mdc||{},e.mdc.list=t())}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=25)}({0:function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this.adapter_=t}return o(e,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),o(e,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),e}();t.a=s},1:function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(0),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;i(this,e),this.root_=t;for(var o=arguments.length,s=Array(o>2?o-2:0),r=2;r<o;r++)s[r-2]=arguments[r];this.initialize.apply(this,s),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return s(e,null,[{key:"attachTo",value:function(t){return new e(t,new o.a)}}]),s(e,[{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(e,t){this.root_.addEventListener(e,t)}},{key:"unlisten",value:function(e,t){this.root_.removeEventListener(e,t)}},{key:"emit",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=void 0;"function"==typeof CustomEvent?i=new CustomEvent(e,{detail:t,bubbles:n}):(i=document.createEvent("CustomEvent"),i.initCustomEvent(e,n,!1,t)),this.root_.dispatchEvent(i)}}]),e}();t.a=r},10:function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();!function(){function e(){i(this,e)}o(e,[{key:"getListItemCount",value:function(){}},{key:"getFocusedElementIndex",value:function(){}},{key:"setAttributeForElementIndex",value:function(e,t,n){}},{key:"removeAttributeForElementIndex",value:function(e,t){}},{key:"addClassForElementIndex",value:function(e,t){}},{key:"removeClassForElementIndex",value:function(e,t){}},{key:"focusItemAtIndex",value:function(e){}},{key:"setTabIndexForListItemChildren",value:function(e,t){}},{key:"hasRadioAtIndex",value:function(e){}},{key:"hasCheckboxAtIndex",value:function(e){}},{key:"isCheckboxCheckedAtIndex",value:function(e){}},{key:"setCheckedCheckboxOrRadioAtIndex",value:function(e,t){}},{key:"notifyAction",value:function(e){}},{key:"isFocusInsideList",value:function(){}}])}()},11:function(e,t,n){"use strict";n.d(t,"b",function(){return o}),n.d(t,"a",function(){return i});/** | ||
* @license | ||
@@ -29,3 +29,3 @@ * Copyright 2018 Google Inc. | ||
*/ | ||
var i={ROOT:"mdc-list",LIST_ITEM_CLASS:"mdc-list-item",LIST_ITEM_SELECTED_CLASS:"mdc-list-item--selected",LIST_ITEM_ACTIVATED_CLASS:"mdc-list-item--activated"},o={ARIA_ORIENTATION:"aria-orientation",ARIA_ORIENTATION_HORIZONTAL:"horizontal",ARIA_SELECTED:"aria-selected",ARIA_CHECKED:"aria-checked",ARIA_CHECKED_RADIO_SELECTOR:'[role="radio"][aria-checked="true"]',ARIA_ROLE_CHECKBOX_SELECTOR:'[role="checkbox"]',ARIA_CHECKED_CHECKBOX_SELECTOR:'[role="checkbox"][aria-checked="true"]',RADIO_SELECTOR:'input[type="radio"]:not(:disabled)',CHECKBOX_SELECTOR:'input[type="checkbox"]:not(:disabled)',CHECKBOX_RADIO_SELECTOR:'input[type="checkbox"]:not(:disabled), input[type="radio"]:not(:disabled)',CHILD_ELEMENTS_TO_TOGGLE_TABINDEX:"."+i.LIST_ITEM_CLASS+" button:not(:disabled),\n ."+i.LIST_ITEM_CLASS+" a",FOCUSABLE_CHILD_ELEMENTS:"."+i.LIST_ITEM_CLASS+" button:not(:disabled), ."+i.LIST_ITEM_CLASS+" a,\n ."+i.LIST_ITEM_CLASS+' input[type="radio"]:not(:disabled),\n .'+i.LIST_ITEM_CLASS+' input[type="checkbox"]:not(:disabled)',ENABLED_ITEMS_SELECTOR:".mdc-list-item:not(.mdc-list-item--disabled)"}},15:function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var r=n(0),a=(n(10),n(11)),u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=["input","button","textarea","select"],d=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,u(t.defaultAdapter,e)));return n.wrapFocus_=!1,n.isVertical_=!0,n.isSingleSelectionList_=!1,n.selectedIndex_=-1,n.focusedItemIndex_=-1,n.useActivatedClass_=!1,n.isCheckboxList_=!1,n.isRadioList_=!1,n}return s(t,e),c(t,null,[{key:"strings",get:function(){return a.b}},{key:"cssClasses",get:function(){return a.a}},{key:"defaultAdapter",get:function(){return{getListItemCount:function(){},getFocusedElementIndex:function(){},setAttributeForElementIndex:function(){},removeAttributeForElementIndex:function(){},addClassForElementIndex:function(){},removeClassForElementIndex:function(){},focusItemAtIndex:function(){},setTabIndexForListItemChildren:function(){},followHref:function(){},hasRadioAtIndex:function(){},hasCheckboxAtIndex:function(){},isCheckboxCheckedAtIndex:function(){},setCheckedCheckboxOrRadioAtIndex:function(){},isFocusInsideList:function(){}}}}]),c(t,[{key:"layout",value:function(){0!==this.adapter_.getListItemCount()&&(this.adapter_.hasCheckboxAtIndex(0)?this.isCheckboxList_=!0:this.adapter_.hasRadioAtIndex(0)&&(this.isRadioList_=!0))}},{key:"setWrapFocus",value:function(e){this.wrapFocus_=e}},{key:"setVerticalOrientation",value:function(e){this.isVertical_=e}},{key:"setSingleSelection",value:function(e){this.isSingleSelectionList_=e}},{key:"setUseActivatedClass",value:function(e){this.useActivatedClass_=e}},{key:"getSelectedIndex",value:function(){return this.selectedIndex_}},{key:"setSelectedIndex",value:function(e){this.isIndexValid_(e)&&(this.isCheckboxList_?this.setCheckboxAtIndex_(e):this.isRadioList_?this.setRadioAtIndex_(e):this.setSingleSelectionAtIndex_(e))}},{key:"handleFocusIn",value:function(e,t){t>=0&&this.adapter_.setTabIndexForListItemChildren(t,0)}},{key:"handleFocusOut",value:function(e,t){var n=this;t>=0&&this.adapter_.setTabIndexForListItemChildren(t,-1),setTimeout(function(){n.adapter_.isFocusInsideList()||n.setTabindexToFirstSelectedItem_()},0)}},{key:"handleKeydown",value:function(e,t,n){var i="ArrowLeft"===e.key||37===e.keyCode,o="ArrowUp"===e.key||38===e.keyCode,s="ArrowRight"===e.key||39===e.keyCode,r="ArrowDown"===e.key||40===e.keyCode,a="Home"===e.key||36===e.keyCode,u="End"===e.key||35===e.keyCode,c="Enter"===e.key||13===e.keyCode,l="Space"===e.key||32===e.keyCode,d=this.adapter_.getFocusedElementIndex(),f=-1;-1===d&&(d=n)<0||(this.isVertical_&&r||!this.isVertical_&&s?(this.preventDefaultEvent_(e),f=this.focusNextElement(d)):this.isVertical_&&o||!this.isVertical_&&i?(this.preventDefaultEvent_(e),f=this.focusPrevElement(d)):a?(this.preventDefaultEvent_(e),f=this.focusFirstElement()):u?(this.preventDefaultEvent_(e),f=this.focusLastElement()):(c||l)&&t&&(this.isSelectableList_()&&(this.setSelectedIndexOnAction_(d),this.preventDefaultEvent_(e)),this.adapter_.followHref(d)),this.focusedItemIndex_=d,f>=0&&(this.setTabindexAtIndex_(f),this.focusedItemIndex_=f))}},{key:"handleClick",value:function(e,t){-1!==e&&(this.isSelectableList_()&&this.setSelectedIndexOnAction_(e,t),this.setTabindexAtIndex_(e),this.focusedItemIndex_=e)}},{key:"preventDefaultEvent_",value:function(e){var t=(""+e.target.tagName).toLowerCase();-1===l.indexOf(t)&&e.preventDefault()}},{key:"focusNextElement",value:function(e){var t=this.adapter_.getListItemCount(),n=e+1;if(n>=t){if(!this.wrapFocus_)return e;n=0}return this.adapter_.focusItemAtIndex(n),n}},{key:"focusPrevElement",value:function(e){var t=e-1;if(t<0){if(!this.wrapFocus_)return e;t=this.adapter_.getListItemCount()-1}return this.adapter_.focusItemAtIndex(t),t}},{key:"focusFirstElement",value:function(){return this.adapter_.focusItemAtIndex(0),0}},{key:"focusLastElement",value:function(){var e=this.adapter_.getListItemCount()-1;return this.adapter_.focusItemAtIndex(e),e}},{key:"setSingleSelectionAtIndex_",value:function(e){var t=a.a.LIST_ITEM_SELECTED_CLASS;this.useActivatedClass_&&(t=a.a.LIST_ITEM_ACTIVATED_CLASS),this.selectedIndex_>=0&&this.selectedIndex_!==e&&(this.adapter_.removeClassForElementIndex(this.selectedIndex_,t),this.adapter_.setAttributeForElementIndex(this.selectedIndex_,a.b.ARIA_SELECTED,"false")),this.adapter_.addClassForElementIndex(e,t),this.adapter_.setAttributeForElementIndex(e,a.b.ARIA_SELECTED,"true"),this.selectedIndex_=e}},{key:"setRadioAtIndex_",value:function(e){this.adapter_.setCheckedCheckboxOrRadioAtIndex(e,!0),this.selectedIndex_>=0&&this.adapter_.setAttributeForElementIndex(this.selectedIndex_,a.b.ARIA_CHECKED,"false"),this.adapter_.setAttributeForElementIndex(e,a.b.ARIA_CHECKED,"true"),this.selectedIndex_=e}},{key:"setCheckboxAtIndex_",value:function(e){for(var t=0;t<this.adapter_.getListItemCount();t++){var n=!1;e.indexOf(t)>=0&&(n=!0),this.adapter_.setCheckedCheckboxOrRadioAtIndex(t,n),this.adapter_.setAttributeForElementIndex(t,a.b.ARIA_CHECKED,n?"true":"false")}this.selectedIndex_=e}},{key:"setTabindexAtIndex_",value:function(e){-1===this.focusedItemIndex_&&0!==e?this.adapter_.setAttributeForElementIndex(0,"tabindex",-1):this.focusedItemIndex_>=0&&this.focusedItemIndex_!==e&&this.adapter_.setAttributeForElementIndex(this.focusedItemIndex_,"tabindex",-1),this.adapter_.setAttributeForElementIndex(e,"tabindex",0)}},{key:"isSelectableList_",value:function(){return this.isSingleSelectionList_||this.isCheckboxList_||this.isRadioList_}},{key:"setTabindexToFirstSelectedItem_",value:function(){var e=0;this.isSelectableList_()&&("number"==typeof this.selectedIndex_&&-1!==this.selectedIndex_?e=this.selectedIndex_:this.selectedIndex_ instanceof Array&&this.selectedIndex_.length>0&&(e=this.selectedIndex_.reduce(function(e,t){return Math.min(e,t)}))),this.setTabindexAtIndex_(e)}},{key:"isIndexValid_",value:function(e){var t=this;if(e instanceof Array){if(!this.isCheckboxList_)throw new Error("MDCListFoundation: Array of index is only supported for checkbox based list");return 0===e.length||e.some(function(e){return t.isIndexInRange_(e)})}if("number"==typeof e){if(this.isCheckboxList_)throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: "+e);return this.isIndexInRange_(e)}return!1}},{key:"isIndexInRange_",value:function(e){var t=this.adapter_.getListItemCount();return e>=0&&e<t}},{key:"setSelectedIndexOnAction_",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.isCheckboxList_?this.toggleCheckboxAtIndex_(e,t):this.setSelectedIndex(e)}},{key:"toggleCheckboxAtIndex_",value:function(e,t){var n=this.adapter_.isCheckboxCheckedAtIndex(e);t&&(n=!n,this.adapter_.setCheckedCheckboxOrRadioAtIndex(e,n)),this.adapter_.setAttributeForElementIndex(e,a.b.ARIA_CHECKED,n?"true":"false"),-1===this.selectedIndex_&&(this.selectedIndex_=[]),n?this.selectedIndex_.push(e):this.selectedIndex_=this.selectedIndex_.filter(function(t){return t!==e})}}]),t}(r.a);t.a=d},25:function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"MDCList",function(){return f});var r=n(1),a=n(15),u=(n(10),n(8)),c=n(11);n.d(t,"MDCListFoundation",function(){return a.a});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},d=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),f=function(e){function t(){var e;i(this,t);for(var n=arguments.length,s=Array(n),r=0;r<n;r++)s[r]=arguments[r];var a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s)));return a.handleKeydown_,a.handleClick_,a.focusInEventListener_,a.focusOutEventListener_,a}return s(t,e),d(t,[{key:"destroy",value:function(){this.root_.removeEventListener("keydown",this.handleKeydown_),this.root_.removeEventListener("click",this.handleClick_),this.root_.removeEventListener("focusin",this.focusInEventListener_),this.root_.removeEventListener("focusout",this.focusOutEventListener_)}},{key:"initialSyncWithDOM",value:function(){this.handleClick_=this.handleClickEvent_.bind(this),this.handleKeydown_=this.handleKeydownEvent_.bind(this),this.focusInEventListener_=this.handleFocusInEvent_.bind(this),this.focusOutEventListener_=this.handleFocusOutEvent_.bind(this),this.root_.addEventListener("keydown",this.handleKeydown_),this.root_.addEventListener("focusin",this.focusInEventListener_),this.root_.addEventListener("focusout",this.focusOutEventListener_),this.root_.addEventListener("click",this.handleClick_),this.layout(),this.initializeListType()}},{key:"layout",value:function(){var e=this.root_.getAttribute(c.b.ARIA_ORIENTATION);this.vertical=e!==c.b.ARIA_ORIENTATION_HORIZONTAL,[].slice.call(this.root_.querySelectorAll(".mdc-list-item:not([tabindex])")).forEach(function(e){e.setAttribute("tabindex",-1)}),[].slice.call(this.root_.querySelectorAll(c.b.FOCUSABLE_CHILD_ELEMENTS)).forEach(function(e){return e.setAttribute("tabindex",-1)}),this.foundation_.layout()}},{key:"getListItemIndex_",value:function(e){for(var t=e.target,n=-1;!t.classList.contains(c.a.LIST_ITEM_CLASS)&&!t.classList.contains(c.a.ROOT);)t=t.parentElement;return t.classList.contains(c.a.LIST_ITEM_CLASS)&&(n=this.listElements.indexOf(t)),n}},{key:"handleFocusInEvent_",value:function(e){var t=this.getListItemIndex_(e);this.foundation_.handleFocusIn(e,t)}},{key:"handleFocusOutEvent_",value:function(e){var t=this.getListItemIndex_(e);this.foundation_.handleFocusOut(e,t)}},{key:"handleKeydownEvent_",value:function(e){var t=this.getListItemIndex_(e);t>=0&&this.foundation_.handleKeydown(e,e.target.classList.contains(c.a.LIST_ITEM_CLASS),t)}},{key:"handleClickEvent_",value:function(e){var t=this.getListItemIndex_(e),n=!Object(u.matches)(e.target,c.b.CHECKBOX_RADIO_SELECTOR);this.foundation_.handleClick(t,n)}},{key:"initializeListType",value:function(){var e=this,t=this.root_.querySelectorAll(c.b.ARIA_ROLE_CHECKBOX_SELECTOR),n=this.root_.querySelector("."+c.a.LIST_ITEM_ACTIVATED_CLASS+",\n ."+c.a.LIST_ITEM_SELECTED_CLASS),i=this.root_.querySelector(c.b.ARIA_CHECKED_RADIO_SELECTOR);if(t.length){var o=this.root_.querySelectorAll(c.b.ARIA_CHECKED_CHECKBOX_SELECTOR);this.selectedIndex=[].map.call(o,function(t){return e.listElements.indexOf(t)})}else n?(n.classList.contains(c.a.LIST_ITEM_ACTIVATED_CLASS)&&this.foundation_.setUseActivatedClass(!0),this.singleSelection=!0,this.selectedIndex=this.listElements.indexOf(n)):i&&(this.selectedIndex=this.listElements.indexOf(i))}},{key:"getDefaultFoundation",value:function(){var e=this;return new a.a(l({getListItemCount:function(){return e.listElements.length},getFocusedElementIndex:function(){return e.listElements.indexOf(document.activeElement)},setAttributeForElementIndex:function(t,n,i){var o=e.listElements[t];o&&o.setAttribute(n,i)},removeAttributeForElementIndex:function(t,n){var i=e.listElements[t];i&&i.removeAttribute(n)},addClassForElementIndex:function(t,n){var i=e.listElements[t];i&&i.classList.add(n)},removeClassForElementIndex:function(t,n){var i=e.listElements[t];i&&i.classList.remove(n)},focusItemAtIndex:function(t){var n=e.listElements[t];n&&n.focus()},setTabIndexForListItemChildren:function(t,n){var i=e.listElements[t];[].slice.call(i.querySelectorAll(c.b.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX)).forEach(function(e){return e.setAttribute("tabindex",n)})},followHref:function(t){var n=e.listElements[t];n&&n.href&&n.click()},hasCheckboxAtIndex:function(t){return!!e.listElements[t].querySelector(c.b.CHECKBOX_SELECTOR)},hasRadioAtIndex:function(t){return!!e.listElements[t].querySelector(c.b.RADIO_SELECTOR)},isCheckboxCheckedAtIndex:function(t){return e.listElements[t].querySelector(c.b.CHECKBOX_SELECTOR).checked},setCheckedCheckboxOrRadioAtIndex:function(t,n){var i=e.listElements[t],o=i.querySelector(c.b.CHECKBOX_RADIO_SELECTOR);o.checked=n;var s=document.createEvent("Event");s.initEvent("change",!0,!0),o.dispatchEvent(s)},isFocusInsideList:function(){return e.root_.contains(document.activeElement)}}))}},{key:"vertical",set:function(e){this.foundation_.setVerticalOrientation(e)}},{key:"listElements",get:function(){return[].slice.call(this.root_.querySelectorAll(c.b.ENABLED_ITEMS_SELECTOR))}},{key:"wrapFocus",set:function(e){this.foundation_.setWrapFocus(e)}},{key:"singleSelection",set:function(e){this.foundation_.setSingleSelection(e)}},{key:"selectedIndex",get:function(){return this.foundation_.getSelectedIndex()},set:function(e){this.foundation_.setSelectedIndex(e)}}],[{key:"attachTo",value:function(e){return new t(e)}}]),t}(r.a)},8:function(e,t,n){"use strict";/** | ||
var i={ROOT:"mdc-list",LIST_ITEM_CLASS:"mdc-list-item",LIST_ITEM_SELECTED_CLASS:"mdc-list-item--selected",LIST_ITEM_ACTIVATED_CLASS:"mdc-list-item--activated"},o={ARIA_ORIENTATION:"aria-orientation",ARIA_ORIENTATION_HORIZONTAL:"horizontal",ARIA_SELECTED:"aria-selected",ARIA_CHECKED:"aria-checked",ARIA_CHECKED_RADIO_SELECTOR:'[role="radio"][aria-checked="true"]',ARIA_ROLE_CHECKBOX_SELECTOR:'[role="checkbox"]',ARIA_CHECKED_CHECKBOX_SELECTOR:'[role="checkbox"][aria-checked="true"]',RADIO_SELECTOR:'input[type="radio"]:not(:disabled)',CHECKBOX_SELECTOR:'input[type="checkbox"]:not(:disabled)',CHECKBOX_RADIO_SELECTOR:'input[type="checkbox"]:not(:disabled), input[type="radio"]:not(:disabled)',CHILD_ELEMENTS_TO_TOGGLE_TABINDEX:"."+i.LIST_ITEM_CLASS+" button:not(:disabled),\n ."+i.LIST_ITEM_CLASS+" a",FOCUSABLE_CHILD_ELEMENTS:"."+i.LIST_ITEM_CLASS+" button:not(:disabled), ."+i.LIST_ITEM_CLASS+" a,\n ."+i.LIST_ITEM_CLASS+' input[type="radio"]:not(:disabled),\n .'+i.LIST_ITEM_CLASS+' input[type="checkbox"]:not(:disabled)',ENABLED_ITEMS_SELECTOR:".mdc-list-item:not(.mdc-list-item--disabled)",ACTION_EVENT:"MDCList:action"}},15:function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var r=n(0),a=(n(10),n(11)),u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=["input","button","textarea","select"],d=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,u(t.defaultAdapter,e)));return n.wrapFocus_=!1,n.isVertical_=!0,n.isSingleSelectionList_=!1,n.selectedIndex_=-1,n.focusedItemIndex_=-1,n.useActivatedClass_=!1,n.isCheckboxList_=!1,n.isRadioList_=!1,n}return s(t,e),c(t,null,[{key:"strings",get:function(){return a.b}},{key:"cssClasses",get:function(){return a.a}},{key:"defaultAdapter",get:function(){return{getListItemCount:function(){},getFocusedElementIndex:function(){},setAttributeForElementIndex:function(){},removeAttributeForElementIndex:function(){},addClassForElementIndex:function(){},removeClassForElementIndex:function(){},focusItemAtIndex:function(){},setTabIndexForListItemChildren:function(){},hasRadioAtIndex:function(){},hasCheckboxAtIndex:function(){},isCheckboxCheckedAtIndex:function(){},setCheckedCheckboxOrRadioAtIndex:function(){},notifyAction:function(){},isFocusInsideList:function(){}}}}]),c(t,[{key:"layout",value:function(){0!==this.adapter_.getListItemCount()&&(this.adapter_.hasCheckboxAtIndex(0)?this.isCheckboxList_=!0:this.adapter_.hasRadioAtIndex(0)&&(this.isRadioList_=!0))}},{key:"setWrapFocus",value:function(e){this.wrapFocus_=e}},{key:"setVerticalOrientation",value:function(e){this.isVertical_=e}},{key:"setSingleSelection",value:function(e){this.isSingleSelectionList_=e}},{key:"setUseActivatedClass",value:function(e){this.useActivatedClass_=e}},{key:"getSelectedIndex",value:function(){return this.selectedIndex_}},{key:"setSelectedIndex",value:function(e){this.isIndexValid_(e)&&(this.isCheckboxList_?this.setCheckboxAtIndex_(e):this.isRadioList_?this.setRadioAtIndex_(e):this.setSingleSelectionAtIndex_(e))}},{key:"handleFocusIn",value:function(e,t){t>=0&&this.adapter_.setTabIndexForListItemChildren(t,0)}},{key:"handleFocusOut",value:function(e,t){var n=this;t>=0&&this.adapter_.setTabIndexForListItemChildren(t,-1),setTimeout(function(){n.adapter_.isFocusInsideList()||n.setTabindexToFirstSelectedItem_()},0)}},{key:"handleKeydown",value:function(e,t,n){var i="ArrowLeft"===e.key||37===e.keyCode,o="ArrowUp"===e.key||38===e.keyCode,s="ArrowRight"===e.key||39===e.keyCode,r="ArrowDown"===e.key||40===e.keyCode,a="Home"===e.key||36===e.keyCode,u="End"===e.key||35===e.keyCode,c="Enter"===e.key||13===e.keyCode,l="Space"===e.key||32===e.keyCode,d=this.adapter_.getFocusedElementIndex(),f=-1;if(!(-1===d&&(d=n)<0)){if(this.isVertical_&&r||!this.isVertical_&&s)this.preventDefaultEvent_(e),f=this.focusNextElement(d);else if(this.isVertical_&&o||!this.isVertical_&&i)this.preventDefaultEvent_(e),f=this.focusPrevElement(d);else if(a)this.preventDefaultEvent_(e),f=this.focusFirstElement();else if(u)this.preventDefaultEvent_(e),f=this.focusLastElement();else if((c||l)&&t){if("A"===e.target.tagName&&c)return;this.preventDefaultEvent_(e),this.isSelectableList_()&&this.setSelectedIndexOnAction_(d),this.adapter_.notifyAction(d)}this.focusedItemIndex_=d,f>=0&&(this.setTabindexAtIndex_(f),this.focusedItemIndex_=f)}}},{key:"handleClick",value:function(e,t){-1!==e&&(this.isSelectableList_()&&this.setSelectedIndexOnAction_(e,t),this.adapter_.notifyAction(e),this.setTabindexAtIndex_(e),this.focusedItemIndex_=e)}},{key:"preventDefaultEvent_",value:function(e){var t=(""+e.target.tagName).toLowerCase();-1===l.indexOf(t)&&e.preventDefault()}},{key:"focusNextElement",value:function(e){var t=this.adapter_.getListItemCount(),n=e+1;if(n>=t){if(!this.wrapFocus_)return e;n=0}return this.adapter_.focusItemAtIndex(n),n}},{key:"focusPrevElement",value:function(e){var t=e-1;if(t<0){if(!this.wrapFocus_)return e;t=this.adapter_.getListItemCount()-1}return this.adapter_.focusItemAtIndex(t),t}},{key:"focusFirstElement",value:function(){return this.adapter_.focusItemAtIndex(0),0}},{key:"focusLastElement",value:function(){var e=this.adapter_.getListItemCount()-1;return this.adapter_.focusItemAtIndex(e),e}},{key:"setSingleSelectionAtIndex_",value:function(e){var t=a.a.LIST_ITEM_SELECTED_CLASS;this.useActivatedClass_&&(t=a.a.LIST_ITEM_ACTIVATED_CLASS),this.selectedIndex_>=0&&this.selectedIndex_!==e&&(this.adapter_.removeClassForElementIndex(this.selectedIndex_,t),this.adapter_.setAttributeForElementIndex(this.selectedIndex_,a.b.ARIA_SELECTED,"false")),this.adapter_.addClassForElementIndex(e,t),this.adapter_.setAttributeForElementIndex(e,a.b.ARIA_SELECTED,"true"),this.selectedIndex_=e}},{key:"setRadioAtIndex_",value:function(e){this.adapter_.setCheckedCheckboxOrRadioAtIndex(e,!0),this.selectedIndex_>=0&&this.adapter_.setAttributeForElementIndex(this.selectedIndex_,a.b.ARIA_CHECKED,"false"),this.adapter_.setAttributeForElementIndex(e,a.b.ARIA_CHECKED,"true"),this.selectedIndex_=e}},{key:"setCheckboxAtIndex_",value:function(e){for(var t=0;t<this.adapter_.getListItemCount();t++){var n=!1;e.indexOf(t)>=0&&(n=!0),this.adapter_.setCheckedCheckboxOrRadioAtIndex(t,n),this.adapter_.setAttributeForElementIndex(t,a.b.ARIA_CHECKED,n?"true":"false")}this.selectedIndex_=e}},{key:"setTabindexAtIndex_",value:function(e){-1===this.focusedItemIndex_&&0!==e?this.adapter_.setAttributeForElementIndex(0,"tabindex",-1):this.focusedItemIndex_>=0&&this.focusedItemIndex_!==e&&this.adapter_.setAttributeForElementIndex(this.focusedItemIndex_,"tabindex",-1),this.adapter_.setAttributeForElementIndex(e,"tabindex",0)}},{key:"isSelectableList_",value:function(){return this.isSingleSelectionList_||this.isCheckboxList_||this.isRadioList_}},{key:"setTabindexToFirstSelectedItem_",value:function(){var e=0;this.isSelectableList_()&&("number"==typeof this.selectedIndex_&&-1!==this.selectedIndex_?e=this.selectedIndex_:this.selectedIndex_ instanceof Array&&this.selectedIndex_.length>0&&(e=this.selectedIndex_.reduce(function(e,t){return Math.min(e,t)}))),this.setTabindexAtIndex_(e)}},{key:"isIndexValid_",value:function(e){var t=this;if(e instanceof Array){if(!this.isCheckboxList_)throw new Error("MDCListFoundation: Array of index is only supported for checkbox based list");return 0===e.length||e.some(function(e){return t.isIndexInRange_(e)})}if("number"==typeof e){if(this.isCheckboxList_)throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: "+e);return this.isIndexInRange_(e)}return!1}},{key:"isIndexInRange_",value:function(e){var t=this.adapter_.getListItemCount();return e>=0&&e<t}},{key:"setSelectedIndexOnAction_",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.isCheckboxList_?this.toggleCheckboxAtIndex_(e,t):this.setSelectedIndex(e)}},{key:"toggleCheckboxAtIndex_",value:function(e,t){var n=this.adapter_.isCheckboxCheckedAtIndex(e);t&&(n=!n,this.adapter_.setCheckedCheckboxOrRadioAtIndex(e,n)),this.adapter_.setAttributeForElementIndex(e,a.b.ARIA_CHECKED,n?"true":"false"),-1===this.selectedIndex_&&(this.selectedIndex_=[]),n?this.selectedIndex_.push(e):this.selectedIndex_=this.selectedIndex_.filter(function(t){return t!==e})}}]),t}(r.a);t.a=d},25:function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"MDCList",function(){return f});var r=n(1),a=n(15),u=(n(10),n(8)),c=n(11);n.d(t,"MDCListFoundation",function(){return a.a});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},d=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),f=function(e){function t(){var e;i(this,t);for(var n=arguments.length,s=Array(n),r=0;r<n;r++)s[r]=arguments[r];var a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s)));return a.handleKeydown_,a.handleClick_,a.focusInEventListener_,a.focusOutEventListener_,a}return s(t,e),d(t,[{key:"destroy",value:function(){this.root_.removeEventListener("keydown",this.handleKeydown_),this.root_.removeEventListener("click",this.handleClick_),this.root_.removeEventListener("focusin",this.focusInEventListener_),this.root_.removeEventListener("focusout",this.focusOutEventListener_)}},{key:"initialSyncWithDOM",value:function(){this.handleClick_=this.handleClickEvent_.bind(this),this.handleKeydown_=this.handleKeydownEvent_.bind(this),this.focusInEventListener_=this.handleFocusInEvent_.bind(this),this.focusOutEventListener_=this.handleFocusOutEvent_.bind(this),this.root_.addEventListener("keydown",this.handleKeydown_),this.root_.addEventListener("focusin",this.focusInEventListener_),this.root_.addEventListener("focusout",this.focusOutEventListener_),this.root_.addEventListener("click",this.handleClick_),this.layout(),this.initializeListType()}},{key:"layout",value:function(){var e=this.root_.getAttribute(c.b.ARIA_ORIENTATION);this.vertical=e!==c.b.ARIA_ORIENTATION_HORIZONTAL,[].slice.call(this.root_.querySelectorAll(".mdc-list-item:not([tabindex])")).forEach(function(e){e.setAttribute("tabindex",-1)}),[].slice.call(this.root_.querySelectorAll(c.b.FOCUSABLE_CHILD_ELEMENTS)).forEach(function(e){return e.setAttribute("tabindex",-1)}),this.foundation_.layout()}},{key:"getListItemIndex_",value:function(e){for(var t=e.target,n=-1;!t.classList.contains(c.a.LIST_ITEM_CLASS)&&!t.classList.contains(c.a.ROOT);)t=t.parentElement;return t.classList.contains(c.a.LIST_ITEM_CLASS)&&(n=this.listElements.indexOf(t)),n}},{key:"handleFocusInEvent_",value:function(e){var t=this.getListItemIndex_(e);this.foundation_.handleFocusIn(e,t)}},{key:"handleFocusOutEvent_",value:function(e){var t=this.getListItemIndex_(e);this.foundation_.handleFocusOut(e,t)}},{key:"handleKeydownEvent_",value:function(e){var t=this.getListItemIndex_(e);t>=0&&this.foundation_.handleKeydown(e,e.target.classList.contains(c.a.LIST_ITEM_CLASS),t)}},{key:"handleClickEvent_",value:function(e){var t=this.getListItemIndex_(e),n=!Object(u.matches)(e.target,c.b.CHECKBOX_RADIO_SELECTOR);this.foundation_.handleClick(t,n)}},{key:"initializeListType",value:function(){var e=this,t=this.root_.querySelectorAll(c.b.ARIA_ROLE_CHECKBOX_SELECTOR),n=this.root_.querySelector("."+c.a.LIST_ITEM_ACTIVATED_CLASS+",\n ."+c.a.LIST_ITEM_SELECTED_CLASS),i=this.root_.querySelector(c.b.ARIA_CHECKED_RADIO_SELECTOR);if(t.length){var o=this.root_.querySelectorAll(c.b.ARIA_CHECKED_CHECKBOX_SELECTOR);this.selectedIndex=[].map.call(o,function(t){return e.listElements.indexOf(t)})}else n?(n.classList.contains(c.a.LIST_ITEM_ACTIVATED_CLASS)&&this.foundation_.setUseActivatedClass(!0),this.singleSelection=!0,this.selectedIndex=this.listElements.indexOf(n)):i&&(this.selectedIndex=this.listElements.indexOf(i))}},{key:"getDefaultFoundation",value:function(){var e=this;return new a.a(l({getListItemCount:function(){return e.listElements.length},getFocusedElementIndex:function(){return e.listElements.indexOf(document.activeElement)},setAttributeForElementIndex:function(t,n,i){var o=e.listElements[t];o&&o.setAttribute(n,i)},removeAttributeForElementIndex:function(t,n){var i=e.listElements[t];i&&i.removeAttribute(n)},addClassForElementIndex:function(t,n){var i=e.listElements[t];i&&i.classList.add(n)},removeClassForElementIndex:function(t,n){var i=e.listElements[t];i&&i.classList.remove(n)},focusItemAtIndex:function(t){var n=e.listElements[t];n&&n.focus()},setTabIndexForListItemChildren:function(t,n){var i=e.listElements[t];[].slice.call(i.querySelectorAll(c.b.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX)).forEach(function(e){return e.setAttribute("tabindex",n)})},hasCheckboxAtIndex:function(t){return!!e.listElements[t].querySelector(c.b.CHECKBOX_SELECTOR)},hasRadioAtIndex:function(t){return!!e.listElements[t].querySelector(c.b.RADIO_SELECTOR)},isCheckboxCheckedAtIndex:function(t){return e.listElements[t].querySelector(c.b.CHECKBOX_SELECTOR).checked},setCheckedCheckboxOrRadioAtIndex:function(t,n){var i=e.listElements[t],o=i.querySelector(c.b.CHECKBOX_RADIO_SELECTOR);o.checked=n;var s=document.createEvent("Event");s.initEvent("change",!0,!0),o.dispatchEvent(s)},notifyAction:function(t){e.emit(c.b.ACTION_EVENT,t,!0)},isFocusInsideList:function(){return e.root_.contains(document.activeElement)}}))}},{key:"vertical",set:function(e){this.foundation_.setVerticalOrientation(e)}},{key:"listElements",get:function(){return[].slice.call(this.root_.querySelectorAll(c.b.ENABLED_ITEMS_SELECTOR))}},{key:"wrapFocus",set:function(e){this.foundation_.setWrapFocus(e)}},{key:"singleSelection",set:function(e){this.foundation_.setSingleSelection(e)}},{key:"selectedIndex",get:function(){return this.foundation_.getSelectedIndex()},set:function(e){this.foundation_.setSelectedIndex(e)}}],[{key:"attachTo",value:function(e){return new t(e)}}]),t}(r.a)},8:function(e,t,n){"use strict";/** | ||
* @license | ||
@@ -32,0 +32,0 @@ * Copyright 2018 Google Inc. |
@@ -56,3 +56,2 @@ /** | ||
setTabIndexForListItemChildren: () => {}, | ||
followHref: () => {}, | ||
hasRadioAtIndex: () => {}, | ||
@@ -62,2 +61,3 @@ hasCheckboxAtIndex: () => {}, | ||
setCheckedCheckboxOrRadioAtIndex: () => {}, | ||
notifyAction: () => {}, | ||
isFocusInsideList: () => {}, | ||
@@ -230,9 +230,11 @@ }); | ||
if (isRootListItem) { | ||
// Return early if enter key is pressed on anchor element which triggers synthetic MouseEvent event. | ||
if (evt.target.tagName === 'A' && isEnter) return; | ||
this.preventDefaultEvent_(evt); | ||
if (this.isSelectableList_()) { | ||
this.setSelectedIndexOnAction_(currentIndex); | ||
this.preventDefaultEvent_(evt); | ||
} | ||
// Explicitly activate links, since we're preventing default on Enter, and Space doesn't activate them. | ||
this.adapter_.followHref(currentIndex); | ||
this.adapter_.notifyAction(currentIndex); | ||
} | ||
@@ -261,2 +263,4 @@ } | ||
this.adapter_.notifyAction(index); | ||
this.setTabindexAtIndex_(index); | ||
@@ -263,0 +267,0 @@ this.focusedItemIndex_ = index; |
@@ -257,8 +257,2 @@ /** | ||
}, | ||
followHref: (index) => { | ||
const listItem = this.listElements[index]; | ||
if (listItem && listItem.href) { | ||
listItem.click(); | ||
} | ||
}, | ||
hasCheckboxAtIndex: (index) => { | ||
@@ -286,2 +280,5 @@ const listItem = this.listElements[index]; | ||
}, | ||
notifyAction: (index) => { | ||
this.emit(strings.ACTION_EVENT, index, /** shouldBubble */ true); | ||
}, | ||
isFocusInsideList: () => { | ||
@@ -288,0 +285,0 @@ return this.root_.contains(document.activeElement); |
{ | ||
"name": "@material/list", | ||
"description": "The Material Components for the web list component", | ||
"version": "0.43.0", | ||
"version": "0.44.0", | ||
"license": "MIT", | ||
@@ -19,8 +19,8 @@ "main": "dist/mdc.list.js", | ||
"@material/dom": "^0.41.0", | ||
"@material/ripple": "^0.43.0", | ||
"@material/ripple": "^0.44.0", | ||
"@material/rtl": "^0.42.0", | ||
"@material/shape": "^0.43.0", | ||
"@material/theme": "^0.43.0", | ||
"@material/typography": "^0.43.0" | ||
"@material/typography": "^0.44.0" | ||
} | ||
} |
@@ -509,3 +509,2 @@ <!--docs: | ||
`setTabIndexForListItemChildren(index: Number, value: Number) => void` | Sets the `tabindex` attribute to `value` for each child button or anchor element in the list item at the `index` specified. | ||
`followHref(element: Element) => void` | If the given element has an href, follows the link. | ||
`hasRadioAtIndex(index: number) => boolean` | Returns true if radio button is present at given list item index. | ||
@@ -515,2 +514,3 @@ `hasCheckboxAtIndex(index: number) => boolean` | Returns true if checkbox is present at given list item index. | ||
`setCheckedCheckboxOrRadioAtIndex(index: number, isChecked: boolean) => void` | Sets the checked status of checkbox or radio at given list item index. | ||
`notifyAction(index: number) => void` | Notifies user action on list item including keyboard and mouse actions. | ||
`isFocusInsideList() => boolean` | Returns true if the current focused element is inside list root. | ||
@@ -517,0 +517,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
489736
2997
+ Added@material/feature-targeting@0.44.1(transitive)
+ Added@material/ripple@0.44.1(transitive)
+ Added@material/typography@0.44.1(transitive)
- Removed@material/ripple@0.43.0(transitive)
- Removed@material/typography@0.43.0(transitive)
Updated@material/ripple@^0.44.0
Updated@material/typography@^0.44.0