@material/list
Advanced tools
Comparing version 0.38.1 to 0.39.0-0
@@ -20,2 +20,3 @@ /** | ||
const cssClasses = { | ||
ROOT: 'mdc-list', | ||
LIST_ITEM_CLASS: 'mdc-list-item', | ||
@@ -22,0 +23,0 @@ LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected', |
@@ -78,3 +78,3 @@ /*! | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 107); | ||
/******/ return __webpack_require__(__webpack_require__.s = 45); | ||
/******/ }) | ||
@@ -361,15 +361,6 @@ /************************************************************************/ | ||
/***/ 107: | ||
/***/ 22: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCList", function() { return MDCList; }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base_component__ = __webpack_require__(1); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation__ = __webpack_require__(108); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__adapter__ = __webpack_require__(53); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__constants__ = __webpack_require__(54); | ||
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCListFoundation", function() { return __WEBPACK_IMPORTED_MODULE_1__foundation__["a"]; }); | ||
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; }; | ||
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; }; }(); | ||
@@ -379,6 +370,2 @@ | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
/** | ||
@@ -401,214 +388,168 @@ * @license | ||
/* eslint no-unused-vars: [2, {"args": "none"}] */ | ||
/** | ||
* @extends MDCComponent<!MDCListFoundation> | ||
* Adapter for MDC List. Provides an interface for managing focus. | ||
* | ||
* Additionally, provides type information for the adapter to the Closure | ||
* compiler. | ||
* | ||
* Implement this adapter for your framework of choice to delegate updates to | ||
* the component in your framework of choice. See architecture documentation | ||
* for more details. | ||
* https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md | ||
* | ||
* @record | ||
*/ | ||
var MDCListAdapter = function () { | ||
function MDCListAdapter() { | ||
_classCallCheck(this, MDCListAdapter); | ||
} | ||
var MDCList = function (_MDCComponent) { | ||
_inherits(MDCList, _MDCComponent); | ||
_createClass(MDCListAdapter, [{ | ||
key: "getListItemCount", | ||
/** @param {...?} args */ | ||
function MDCList() { | ||
var _ref; | ||
/** @return {number} */ | ||
value: function getListItemCount() {} | ||
_classCallCheck(this, MDCList); | ||
/** | ||
* @return {number} */ | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
}, { | ||
key: "getFocusedElementIndex", | ||
value: function getFocusedElementIndex() {} | ||
/** @private {!Function} */ | ||
var _this = _possibleConstructorReturn(this, (_ref = MDCList.__proto__ || Object.getPrototypeOf(MDCList)).call.apply(_ref, [this].concat(args))); | ||
/** @param {Element} node */ | ||
_this.handleKeydown_; | ||
/** @private {!Function} */ | ||
_this.handleClick_; | ||
/** @private {!Function} */ | ||
_this.focusInEventListener_; | ||
/** @private {!Function} */ | ||
_this.focusOutEventListener_; | ||
return _this; | ||
} | ||
}, { | ||
key: "getListItemIndex", | ||
value: function getListItemIndex(node) {} | ||
/** | ||
* @param {!Element} root | ||
* @return {!MDCList} | ||
*/ | ||
/** | ||
* @param {number} index | ||
* @param {string} attribute | ||
* @param {string} value | ||
*/ | ||
}, { | ||
key: "setAttributeForElementIndex", | ||
value: function setAttributeForElementIndex(index, attribute, value) {} | ||
_createClass(MDCList, [{ | ||
key: 'destroy', | ||
value: function destroy() { | ||
this.root_.removeEventListener('keydown', this.handleKeydown_); | ||
this.root_.removeEventListener('click', this.handleClick_); | ||
this.root_.removeEventListener('focusin', this.focusInEventListener_); | ||
this.root_.removeEventListener('focusout', this.focusOutEventListener_); | ||
} | ||
/** | ||
* @param {number} index | ||
* @param {string} attribute | ||
*/ | ||
}, { | ||
key: 'initialSyncWithDOM', | ||
value: function initialSyncWithDOM() { | ||
this.handleKeydown_ = this.foundation_.handleKeydown.bind(this.foundation_); | ||
this.handleClick_ = this.foundation_.handleClick.bind(this.foundation_); | ||
this.focusInEventListener_ = this.foundation_.handleFocusIn.bind(this.foundation_); | ||
this.focusOutEventListener_ = this.foundation_.handleFocusOut.bind(this.foundation_); | ||
this.root_.addEventListener('keydown', this.handleKeydown_); | ||
this.root_.addEventListener('focusin', this.focusInEventListener_); | ||
this.root_.addEventListener('focusout', this.focusOutEventListener_); | ||
this.layout(); | ||
} | ||
}, { | ||
key: 'layout', | ||
value: function layout() { | ||
var direction = this.root_.getAttribute(__WEBPACK_IMPORTED_MODULE_3__constants__["b" /* strings */].ARIA_ORIENTATION); | ||
this.vertical = direction !== __WEBPACK_IMPORTED_MODULE_3__constants__["b" /* strings */].ARIA_ORIENTATION_HORIZONTAL; | ||
key: "removeAttributeForElementIndex", | ||
value: function removeAttributeForElementIndex(index, attribute) {} | ||
// List items need to have at least tabindex=-1 to be focusable. | ||
[].slice.call(this.root_.querySelectorAll('.mdc-list-item:not([tabindex])')).forEach(function (ele) { | ||
ele.setAttribute('tabindex', -1); | ||
}); | ||
/** | ||
* @param {number} index | ||
* @param {string} className | ||
*/ | ||
// Child button/a elements are not tabbable until the list item is focused. | ||
[].slice.call(this.root_.querySelectorAll(__WEBPACK_IMPORTED_MODULE_3__constants__["b" /* strings */].FOCUSABLE_CHILD_ELEMENTS)).forEach(function (ele) { | ||
return ele.setAttribute('tabindex', -1); | ||
}); | ||
} | ||
}, { | ||
key: "addClassForElementIndex", | ||
value: function addClassForElementIndex(index, className) {} | ||
/** @param {boolean} value */ | ||
/** | ||
* @param {number} index | ||
* @param {string} className | ||
*/ | ||
}, { | ||
key: 'getDefaultFoundation', | ||
key: "removeClassForElementIndex", | ||
value: function removeClassForElementIndex(index, className) {} | ||
/** | ||
* Focuses list item at the index specified. | ||
* @param {number} index | ||
*/ | ||
/** @return {!MDCListFoundation} */ | ||
value: function getDefaultFoundation() { | ||
var _this2 = this; | ||
return new __WEBPACK_IMPORTED_MODULE_1__foundation__["a" /* default */]( /** @type {!MDCListAdapter} */_extends({ | ||
getListItemCount: function getListItemCount() { | ||
return _this2.listElements_.length; | ||
}, | ||
getFocusedElementIndex: function getFocusedElementIndex() { | ||
return _this2.listElements_.indexOf(document.activeElement); | ||
}, | ||
getListItemIndex: function getListItemIndex(node) { | ||
return _this2.listElements_.indexOf(node); | ||
}, | ||
setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) { | ||
var element = _this2.listElements_[index]; | ||
if (element) { | ||
element.setAttribute(attr, value); | ||
} | ||
}, | ||
removeAttributeForElementIndex: function removeAttributeForElementIndex(index, attr) { | ||
var element = _this2.listElements_[index]; | ||
if (element) { | ||
element.removeAttribute(attr); | ||
} | ||
}, | ||
addClassForElementIndex: function addClassForElementIndex(index, className) { | ||
var element = _this2.listElements_[index]; | ||
if (element) { | ||
element.classList.add(className); | ||
} | ||
}, | ||
removeClassForElementIndex: function removeClassForElementIndex(index, className) { | ||
var element = _this2.listElements_[index]; | ||
if (element) { | ||
element.classList.remove(className); | ||
} | ||
}, | ||
isListItem: function isListItem(target) { | ||
return target.classList.contains(__WEBPACK_IMPORTED_MODULE_3__constants__["a" /* cssClasses */].LIST_ITEM_CLASS); | ||
}, | ||
focusItemAtIndex: function focusItemAtIndex(index) { | ||
var element = _this2.listElements_[index]; | ||
if (element) { | ||
element.focus(); | ||
} | ||
}, | ||
isElementFocusable: function isElementFocusable(ele) { | ||
if (!ele) return false; | ||
var matches = Element.prototype.matches; | ||
if (!matches) { | ||
// IE uses a different name for the same functionality | ||
matches = Element.prototype.msMatchesSelector; | ||
} | ||
return matches.call(ele, __WEBPACK_IMPORTED_MODULE_3__constants__["b" /* strings */].FOCUSABLE_CHILD_ELEMENTS); | ||
}, | ||
setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) { | ||
var element = _this2.listElements_[listItemIndex]; | ||
var listItemChildren = [].slice.call(element.querySelectorAll(__WEBPACK_IMPORTED_MODULE_3__constants__["b" /* strings */].FOCUSABLE_CHILD_ELEMENTS)); | ||
listItemChildren.forEach(function (ele) { | ||
return ele.setAttribute('tabindex', tabIndexValue); | ||
}); | ||
} | ||
})); | ||
} | ||
}, { | ||
key: 'vertical', | ||
set: function set(value) { | ||
this.foundation_.setVerticalOrientation(value); | ||
} | ||
key: "focusItemAtIndex", | ||
value: function focusItemAtIndex(index) {} | ||
/** @return Array<!Element>*/ | ||
/** | ||
* Checks if the provided element is a focusable sub-element. | ||
* @param {Element} ele | ||
*/ | ||
}, { | ||
key: 'listElements_', | ||
get: function get() { | ||
return [].slice.call(this.root_.querySelectorAll(__WEBPACK_IMPORTED_MODULE_3__constants__["b" /* strings */].ENABLED_ITEMS_SELECTOR)); | ||
} | ||
key: "isElementFocusable", | ||
value: function isElementFocusable(ele) {} | ||
/** @param {boolean} value */ | ||
/** | ||
* Checks if the provided element is contains the mdc-list-item class. | ||
* @param {Element} ele | ||
*/ | ||
}, { | ||
key: 'wrapFocus', | ||
set: function set(value) { | ||
this.foundation_.setWrapFocus(value); | ||
} | ||
key: "isListItem", | ||
value: function isListItem(ele) {} | ||
/** @param {boolean} isSingleSelectionList */ | ||
/** | ||
* Sets the tabindex to the value specified for all button/a element children of | ||
* the list item at the index specified. | ||
* @param {number} listItemIndex | ||
* @param {number} tabIndexValue | ||
*/ | ||
}, { | ||
key: 'singleSelection', | ||
set: function set(isSingleSelectionList) { | ||
if (isSingleSelectionList) { | ||
this.root_.addEventListener('click', this.handleClick_); | ||
} else { | ||
this.root_.removeEventListener('click', this.handleClick_); | ||
} | ||
key: "setTabIndexForListItemChildren", | ||
value: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) {} | ||
}]); | ||
this.foundation_.setSingleSelection(isSingleSelectionList); | ||
var selectedElement = this.root_.querySelector('.mdc-list-item--selected'); | ||
return MDCListAdapter; | ||
}(); | ||
if (selectedElement) { | ||
this.selectedIndex = this.listElements_.indexOf(selectedElement); | ||
} | ||
} | ||
/* unused harmony default export */ var _unused_webpack_default_export = (MDCListAdapter); | ||
/** @param {number} index */ | ||
/***/ }), | ||
}, { | ||
key: 'selectedIndex', | ||
set: function set(index) { | ||
this.foundation_.setSelectedIndex(index); | ||
} | ||
}], [{ | ||
key: 'attachTo', | ||
value: function attachTo(root) { | ||
return new MDCList(root); | ||
} | ||
}]); | ||
/***/ 23: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
return MDCList; | ||
}(__WEBPACK_IMPORTED_MODULE_0__material_base_component__["a" /* default */]); | ||
"use strict"; | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return strings; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cssClasses; }); | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
*/ | ||
/** @enum {string} */ | ||
var cssClasses = { | ||
ROOT: 'mdc-list', | ||
LIST_ITEM_CLASS: 'mdc-list-item', | ||
LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected' | ||
}; | ||
/** @enum {string} */ | ||
var strings = { | ||
ARIA_ORIENTATION: 'aria-orientation', | ||
ARIA_ORIENTATION_HORIZONTAL: 'horizontal', | ||
ARIA_SELECTED: 'aria-selected', | ||
FOCUSABLE_CHILD_ELEMENTS: '.' + cssClasses.LIST_ITEM_CLASS + ' button:not(:disabled), .' + cssClasses.LIST_ITEM_CLASS + ' a', | ||
ENABLED_ITEMS_SELECTOR: '.mdc-list-item:not(.mdc-list-item--disabled)' | ||
}; | ||
/***/ }), | ||
/***/ 108: | ||
/***/ 40: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -618,4 +559,4 @@ | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base_foundation__ = __webpack_require__(0); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__adapter__ = __webpack_require__(53); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constants__ = __webpack_require__(54); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__adapter__ = __webpack_require__(22); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constants__ = __webpack_require__(23); | ||
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; }; | ||
@@ -984,6 +925,15 @@ | ||
/***/ 53: | ||
/***/ 45: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCList", function() { return MDCList; }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base_component__ = __webpack_require__(1); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation__ = __webpack_require__(40); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__adapter__ = __webpack_require__(22); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__constants__ = __webpack_require__(23); | ||
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCListFoundation", function() { return __WEBPACK_IMPORTED_MODULE_1__foundation__["a"]; }); | ||
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; }; | ||
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; }; }(); | ||
@@ -993,2 +943,6 @@ | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
/** | ||
@@ -1011,164 +965,211 @@ * @license | ||
/* eslint no-unused-vars: [2, {"args": "none"}] */ | ||
/** | ||
* Adapter for MDC List. Provides an interface for managing focus. | ||
* | ||
* Additionally, provides type information for the adapter to the Closure | ||
* compiler. | ||
* | ||
* Implement this adapter for your framework of choice to delegate updates to | ||
* the component in your framework of choice. See architecture documentation | ||
* for more details. | ||
* https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md | ||
* | ||
* @record | ||
* @extends MDCComponent<!MDCListFoundation> | ||
*/ | ||
var MDCListAdapter = function () { | ||
function MDCListAdapter() { | ||
_classCallCheck(this, MDCListAdapter); | ||
} | ||
_createClass(MDCListAdapter, [{ | ||
key: "getListItemCount", | ||
var MDCList = function (_MDCComponent) { | ||
_inherits(MDCList, _MDCComponent); | ||
/** @return {number} */ | ||
value: function getListItemCount() {} | ||
/** @param {...?} args */ | ||
function MDCList() { | ||
var _ref; | ||
/** | ||
* @return {number} */ | ||
_classCallCheck(this, MDCList); | ||
}, { | ||
key: "getFocusedElementIndex", | ||
value: function getFocusedElementIndex() {} | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
/** @param {Element} node */ | ||
/** @private {!Function} */ | ||
var _this = _possibleConstructorReturn(this, (_ref = MDCList.__proto__ || Object.getPrototypeOf(MDCList)).call.apply(_ref, [this].concat(args))); | ||
}, { | ||
key: "getListItemIndex", | ||
value: function getListItemIndex(node) {} | ||
_this.handleKeydown_; | ||
/** @private {!Function} */ | ||
_this.handleClick_; | ||
/** @private {!Function} */ | ||
_this.focusInEventListener_; | ||
/** @private {!Function} */ | ||
_this.focusOutEventListener_; | ||
return _this; | ||
} | ||
/** | ||
* @param {number} index | ||
* @param {string} attribute | ||
* @param {string} value | ||
*/ | ||
/** | ||
* @param {!Element} root | ||
* @return {!MDCList} | ||
*/ | ||
_createClass(MDCList, [{ | ||
key: 'destroy', | ||
value: function destroy() { | ||
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: "setAttributeForElementIndex", | ||
value: function setAttributeForElementIndex(index, attribute, value) {} | ||
key: 'initialSyncWithDOM', | ||
value: function initialSyncWithDOM() { | ||
this.handleKeydown_ = this.foundation_.handleKeydown.bind(this.foundation_); | ||
this.handleClick_ = this.foundation_.handleClick.bind(this.foundation_); | ||
this.focusInEventListener_ = this.foundation_.handleFocusIn.bind(this.foundation_); | ||
this.focusOutEventListener_ = this.foundation_.handleFocusOut.bind(this.foundation_); | ||
this.root_.addEventListener('keydown', this.handleKeydown_); | ||
this.root_.addEventListener('focusin', this.focusInEventListener_); | ||
this.root_.addEventListener('focusout', this.focusOutEventListener_); | ||
this.layout(); | ||
} | ||
}, { | ||
key: 'layout', | ||
value: function layout() { | ||
var direction = this.root_.getAttribute(__WEBPACK_IMPORTED_MODULE_3__constants__["b" /* strings */].ARIA_ORIENTATION); | ||
this.vertical = direction !== __WEBPACK_IMPORTED_MODULE_3__constants__["b" /* strings */].ARIA_ORIENTATION_HORIZONTAL; | ||
/** | ||
* @param {number} index | ||
* @param {string} attribute | ||
*/ | ||
// List items need to have at least tabindex=-1 to be focusable. | ||
[].slice.call(this.root_.querySelectorAll('.mdc-list-item:not([tabindex])')).forEach(function (ele) { | ||
ele.setAttribute('tabindex', -1); | ||
}); | ||
}, { | ||
key: "removeAttributeForElementIndex", | ||
value: function removeAttributeForElementIndex(index, attribute) {} | ||
// Child button/a elements are not tabbable until the list item is focused. | ||
[].slice.call(this.root_.querySelectorAll(__WEBPACK_IMPORTED_MODULE_3__constants__["b" /* strings */].FOCUSABLE_CHILD_ELEMENTS)).forEach(function (ele) { | ||
return ele.setAttribute('tabindex', -1); | ||
}); | ||
} | ||
/** | ||
* @param {number} index | ||
* @param {string} className | ||
*/ | ||
/** @param {boolean} value */ | ||
}, { | ||
key: "addClassForElementIndex", | ||
value: function addClassForElementIndex(index, className) {} | ||
key: 'getDefaultFoundation', | ||
/** | ||
* @param {number} index | ||
* @param {string} className | ||
*/ | ||
}, { | ||
key: "removeClassForElementIndex", | ||
value: function removeClassForElementIndex(index, className) {} | ||
/** @return {!MDCListFoundation} */ | ||
value: function getDefaultFoundation() { | ||
var _this2 = this; | ||
/** | ||
* Focuses list item at the index specified. | ||
* @param {number} index | ||
*/ | ||
return new __WEBPACK_IMPORTED_MODULE_1__foundation__["a" /* default */]( /** @type {!MDCListAdapter} */_extends({ | ||
getListItemCount: function getListItemCount() { | ||
return _this2.listElements_.length; | ||
}, | ||
getFocusedElementIndex: function getFocusedElementIndex() { | ||
return _this2.listElements_.indexOf(document.activeElement); | ||
}, | ||
getListItemIndex: function getListItemIndex(node) { | ||
return _this2.listElements_.indexOf(node); | ||
}, | ||
setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) { | ||
var element = _this2.listElements_[index]; | ||
if (element) { | ||
element.setAttribute(attr, value); | ||
} | ||
}, | ||
removeAttributeForElementIndex: function removeAttributeForElementIndex(index, attr) { | ||
var element = _this2.listElements_[index]; | ||
if (element) { | ||
element.removeAttribute(attr); | ||
} | ||
}, | ||
addClassForElementIndex: function addClassForElementIndex(index, className) { | ||
var element = _this2.listElements_[index]; | ||
if (element) { | ||
element.classList.add(className); | ||
} | ||
}, | ||
removeClassForElementIndex: function removeClassForElementIndex(index, className) { | ||
var element = _this2.listElements_[index]; | ||
if (element) { | ||
element.classList.remove(className); | ||
} | ||
}, | ||
isListItem: function isListItem(target) { | ||
return target.classList.contains(__WEBPACK_IMPORTED_MODULE_3__constants__["a" /* cssClasses */].LIST_ITEM_CLASS); | ||
}, | ||
focusItemAtIndex: function focusItemAtIndex(index) { | ||
var element = _this2.listElements_[index]; | ||
if (element) { | ||
element.focus(); | ||
} | ||
}, | ||
isElementFocusable: function isElementFocusable(ele) { | ||
if (!ele) return false; | ||
var matches = Element.prototype.matches; | ||
if (!matches) { | ||
// IE uses a different name for the same functionality | ||
matches = Element.prototype.msMatchesSelector; | ||
} | ||
return matches.call(ele, __WEBPACK_IMPORTED_MODULE_3__constants__["b" /* strings */].FOCUSABLE_CHILD_ELEMENTS); | ||
}, | ||
setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) { | ||
var element = _this2.listElements_[listItemIndex]; | ||
var listItemChildren = [].slice.call(element.querySelectorAll(__WEBPACK_IMPORTED_MODULE_3__constants__["b" /* strings */].FOCUSABLE_CHILD_ELEMENTS)); | ||
listItemChildren.forEach(function (ele) { | ||
return ele.setAttribute('tabindex', tabIndexValue); | ||
}); | ||
} | ||
})); | ||
} | ||
}, { | ||
key: "focusItemAtIndex", | ||
value: function focusItemAtIndex(index) {} | ||
key: 'vertical', | ||
set: function set(value) { | ||
this.foundation_.setVerticalOrientation(value); | ||
} | ||
/** | ||
* Checks if the provided element is a focusable sub-element. | ||
* @param {Element} ele | ||
*/ | ||
/** @return Array<!Element>*/ | ||
}, { | ||
key: "isElementFocusable", | ||
value: function isElementFocusable(ele) {} | ||
key: 'listElements_', | ||
get: function get() { | ||
return [].slice.call(this.root_.querySelectorAll(__WEBPACK_IMPORTED_MODULE_3__constants__["b" /* strings */].ENABLED_ITEMS_SELECTOR)); | ||
} | ||
/** | ||
* Checks if the provided element is contains the mdc-list-item class. | ||
* @param {Element} ele | ||
*/ | ||
/** @param {boolean} value */ | ||
}, { | ||
key: "isListItem", | ||
value: function isListItem(ele) {} | ||
key: 'wrapFocus', | ||
set: function set(value) { | ||
this.foundation_.setWrapFocus(value); | ||
} | ||
/** | ||
* Sets the tabindex to the value specified for all button/a element children of | ||
* the list item at the index specified. | ||
* @param {number} listItemIndex | ||
* @param {number} tabIndexValue | ||
*/ | ||
/** @param {boolean} isSingleSelectionList */ | ||
}, { | ||
key: "setTabIndexForListItemChildren", | ||
value: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) {} | ||
}]); | ||
key: 'singleSelection', | ||
set: function set(isSingleSelectionList) { | ||
if (isSingleSelectionList) { | ||
this.root_.addEventListener('click', this.handleClick_); | ||
} else { | ||
this.root_.removeEventListener('click', this.handleClick_); | ||
} | ||
return MDCListAdapter; | ||
}(); | ||
this.foundation_.setSingleSelection(isSingleSelectionList); | ||
var selectedElement = this.root_.querySelector('.mdc-list-item--selected'); | ||
/* unused harmony default export */ var _unused_webpack_default_export = (MDCListAdapter); | ||
if (selectedElement) { | ||
this.selectedIndex = this.listElements_.indexOf(selectedElement); | ||
} | ||
} | ||
/***/ }), | ||
/** @param {number} index */ | ||
/***/ 54: | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
}, { | ||
key: 'selectedIndex', | ||
set: function set(index) { | ||
this.foundation_.setSelectedIndex(index); | ||
} | ||
}], [{ | ||
key: 'attachTo', | ||
value: function attachTo(root) { | ||
return new MDCList(root); | ||
} | ||
}]); | ||
"use strict"; | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return strings; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cssClasses; }); | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
*/ | ||
return MDCList; | ||
}(__WEBPACK_IMPORTED_MODULE_0__material_base_component__["a" /* default */]); | ||
/** @enum {string} */ | ||
var cssClasses = { | ||
LIST_ITEM_CLASS: 'mdc-list-item', | ||
LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected' | ||
}; | ||
/** @enum {string} */ | ||
var strings = { | ||
ARIA_ORIENTATION: 'aria-orientation', | ||
ARIA_ORIENTATION_HORIZONTAL: 'horizontal', | ||
ARIA_SELECTED: 'aria-selected', | ||
FOCUSABLE_CHILD_ELEMENTS: '.' + cssClasses.LIST_ITEM_CLASS + ' button:not(:disabled), .' + cssClasses.LIST_ITEM_CLASS + ' a', | ||
ENABLED_ITEMS_SELECTOR: '.mdc-list-item:not(.mdc-list-item--disabled)' | ||
}; | ||
/***/ }) | ||
@@ -1175,0 +1176,0 @@ |
@@ -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=107)}({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}}(),r=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=r},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),r=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(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,r=Array(o>2?o-2:0),s=2;s<o;s++)r[s-2]=arguments[s];this.initialize.apply(this,r),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return r(e,null,[{key:"attachTo",value:function(t){return new e(t,new o.a)}}]),r(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=s},107: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 r(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 d});var s=n(1),a=n(108),u=(n(53),n(54));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},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}}(),d=function(e){function t(){var e;i(this,t);for(var n=arguments.length,r=Array(n),s=0;s<n;s++)r[s]=arguments[s];var a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(r)));return a.handleKeydown_,a.handleClick_,a.focusInEventListener_,a.focusOutEventListener_,a}return r(t,e),c(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.handleKeydown_=this.foundation_.handleKeydown.bind(this.foundation_),this.handleClick_=this.foundation_.handleClick.bind(this.foundation_),this.focusInEventListener_=this.foundation_.handleFocusIn.bind(this.foundation_),this.focusOutEventListener_=this.foundation_.handleFocusOut.bind(this.foundation_),this.root_.addEventListener("keydown",this.handleKeydown_),this.root_.addEventListener("focusin",this.focusInEventListener_),this.root_.addEventListener("focusout",this.focusOutEventListener_),this.layout()}},{key:"layout",value:function(){var e=this.root_.getAttribute(u.b.ARIA_ORIENTATION);this.vertical=e!==u.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(u.b.FOCUSABLE_CHILD_ELEMENTS)).forEach(function(e){return e.setAttribute("tabindex",-1)})}},{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)},getListItemIndex:function(t){return e.listElements_.indexOf(t)},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)},isListItem:function(e){return e.classList.contains(u.a.LIST_ITEM_CLASS)},focusItemAtIndex:function(t){var n=e.listElements_[t];n&&n.focus()},isElementFocusable:function(e){if(!e)return!1;var t=Element.prototype.matches;return t||(t=Element.prototype.msMatchesSelector),t.call(e,u.b.FOCUSABLE_CHILD_ELEMENTS)},setTabIndexForListItemChildren:function(t,n){var i=e.listElements_[t];[].slice.call(i.querySelectorAll(u.b.FOCUSABLE_CHILD_ELEMENTS)).forEach(function(e){return e.setAttribute("tabindex",n)})}}))}},{key:"vertical",set:function(e){this.foundation_.setVerticalOrientation(e)}},{key:"listElements_",get:function(){return[].slice.call(this.root_.querySelectorAll(u.b.ENABLED_ITEMS_SELECTOR))}},{key:"wrapFocus",set:function(e){this.foundation_.setWrapFocus(e)}},{key:"singleSelection",set:function(e){e?this.root_.addEventListener("click",this.handleClick_):this.root_.removeEventListener("click",this.handleClick_),this.foundation_.setSingleSelection(e);var t=this.root_.querySelector(".mdc-list-item--selected");t&&(this.selectedIndex=this.listElements_.indexOf(t))}},{key:"selectedIndex",set:function(e){this.foundation_.setSelectedIndex(e)}}],[{key:"attachTo",value:function(e){return new t(e)}}]),t}(s.a)},108: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 r(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 s=n(0),a=(n(53),n(54)),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},l=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}}(),c=["input","button","textarea","select"],d=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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}return r(t,e),l(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(){},getListItemIndex:function(){},setAttributeForElementIndex:function(){},removeAttributeForElementIndex:function(){},addClassForElementIndex:function(){},removeClassForElementIndex:function(){},focusItemAtIndex:function(){},isElementFocusable:function(){},isListItem:function(){},setTabIndexForListItemChildren:function(){}}}}]),l(t,[{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:"setSelectedIndex",value:function(e){if(e===this.selectedIndex_)return this.adapter_.removeAttributeForElementIndex(this.selectedIndex_,a.b.ARIA_SELECTED),this.adapter_.removeClassForElementIndex(this.selectedIndex_,a.a.LIST_ITEM_SELECTED_CLASS),this.selectedIndex_>=0&&(this.adapter_.setAttributeForElementIndex(this.selectedIndex_,"tabindex",-1),this.adapter_.setAttributeForElementIndex(0,"tabindex",0)),void(this.selectedIndex_=-1);this.selectedIndex_>=0&&(this.adapter_.removeAttributeForElementIndex(this.selectedIndex_,a.b.ARIA_SELECTED),this.adapter_.removeClassForElementIndex(this.selectedIndex_,a.a.LIST_ITEM_SELECTED_CLASS),this.adapter_.setAttributeForElementIndex(this.selectedIndex_,"tabindex",-1)),e>=0&&this.adapter_.getListItemCount()>e&&(this.selectedIndex_=e,this.adapter_.setAttributeForElementIndex(this.selectedIndex_,a.b.ARIA_SELECTED,!0),this.adapter_.addClassForElementIndex(this.selectedIndex_,a.a.LIST_ITEM_SELECTED_CLASS),this.adapter_.setAttributeForElementIndex(this.selectedIndex_,"tabindex",0),0!==this.selectedIndex_&&this.adapter_.setAttributeForElementIndex(0,"tabindex",-1))}},{key:"handleFocusIn",value:function(e){var t=this.getListItem_(e.target);if(t){var n=this.adapter_.getListItemIndex(t);n>=0&&this.adapter_.setTabIndexForListItemChildren(n,0)}}},{key:"handleFocusOut",value:function(e){var t=this.getListItem_(e.target);if(t){var n=this.adapter_.getListItemIndex(t);n>=0&&this.adapter_.setTabIndexForListItemChildren(n,-1)}}},{key:"handleKeydown",value:function(e){var t="ArrowLeft"===e.key||37===e.keyCode,n="ArrowUp"===e.key||38===e.keyCode,i="ArrowRight"===e.key||39===e.keyCode,o="ArrowDown"===e.key||40===e.keyCode,r="Home"===e.key||36===e.keyCode,s="End"===e.key||35===e.keyCode,a="Enter"===e.key||13===e.keyCode,u="Space"===e.key||32===e.keyCode,l=this.adapter_.getFocusedElementIndex();-1===l&&(l=this.adapter_.getListItemIndex(this.getListItem_(e.target)))<0||(this.isVertical_&&o||!this.isVertical_&&i?(this.preventDefaultEvent_(e),this.focusNextElement(l)):this.isVertical_&&n||!this.isVertical_&&t?(this.preventDefaultEvent_(e),this.focusPrevElement(l)):r?(this.preventDefaultEvent_(e),this.focusFirstElement()):s?(this.preventDefaultEvent_(e),this.focusLastElement()):this.isSingleSelectionList_&&(a||u)&&(this.preventDefaultEvent_(e),this.adapter_.isListItem(e.target)&&this.setSelectedIndex(l)))}},{key:"handleClick",value:function(){var e=this.adapter_.getFocusedElementIndex();-1!==e&&this.setSelectedIndex(e)}},{key:"preventDefaultEvent_",value:function(e){var t=(""+e.target.tagName).toLowerCase();-1===c.indexOf(t)&&e.preventDefault()}},{key:"focusNextElement",value:function(e){var t=this.adapter_.getListItemCount(),n=e+1;if(n>=t){if(!this.wrapFocus_)return;n=0}this.adapter_.focusItemAtIndex(n)}},{key:"focusPrevElement",value:function(e){var t=e-1;if(t<0){if(!this.wrapFocus_)return;t=this.adapter_.getListItemCount()-1}this.adapter_.focusItemAtIndex(t)}},{key:"focusFirstElement",value:function(){this.adapter_.getListItemCount()>0&&this.adapter_.focusItemAtIndex(0)}},{key:"focusLastElement",value:function(){var e=this.adapter_.getListItemCount()-1;e>=0&&this.adapter_.focusItemAtIndex(e)}},{key:"getListItem_",value:function(e){for(;!this.adapter_.isListItem(e);){if(!e.parentElement)return null;e=e.parentElement}return e}}]),t}(s.a);t.a=d},53: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:"getListItemIndex",value:function(e){}},{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:"isElementFocusable",value:function(e){}},{key:"isListItem",value:function(e){}},{key:"setTabIndexForListItemChildren",value:function(e,t){}}])}()},54: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=45)}({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}}(),r=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=r},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),r=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(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,r=Array(o>2?o-2:0),s=2;s<o;s++)r[s-2]=arguments[s];this.initialize.apply(this,r),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return r(e,null,[{key:"attachTo",value:function(t){return new e(t,new o.a)}}]),r(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=s},22: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:"getListItemIndex",value:function(e){}},{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:"isElementFocusable",value:function(e){}},{key:"isListItem",value:function(e){}},{key:"setTabIndexForListItemChildren",value:function(e,t){}}])}()},23:function(e,t,n){"use strict";n.d(t,"b",function(){return o}),n.d(t,"a",function(){return i});/** | ||
* @license | ||
@@ -23,3 +23,3 @@ * Copyright 2018 Google Inc. All Rights Reserved. | ||
*/ | ||
var i={LIST_ITEM_CLASS:"mdc-list-item",LIST_ITEM_SELECTED_CLASS:"mdc-list-item--selected"},o={ARIA_ORIENTATION:"aria-orientation",ARIA_ORIENTATION_HORIZONTAL:"horizontal",ARIA_SELECTED:"aria-selected",FOCUSABLE_CHILD_ELEMENTS:"."+i.LIST_ITEM_CLASS+" button:not(:disabled), ."+i.LIST_ITEM_CLASS+" a",ENABLED_ITEMS_SELECTOR:".mdc-list-item:not(.mdc-list-item--disabled)"}}})}); | ||
var i={ROOT:"mdc-list",LIST_ITEM_CLASS:"mdc-list-item",LIST_ITEM_SELECTED_CLASS:"mdc-list-item--selected"},o={ARIA_ORIENTATION:"aria-orientation",ARIA_ORIENTATION_HORIZONTAL:"horizontal",ARIA_SELECTED:"aria-selected",FOCUSABLE_CHILD_ELEMENTS:"."+i.LIST_ITEM_CLASS+" button:not(:disabled), ."+i.LIST_ITEM_CLASS+" a",ENABLED_ITEMS_SELECTOR:".mdc-list-item:not(.mdc-list-item--disabled)"}},40: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 r(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 s=n(0),a=(n(22),n(23)),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},l=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}}(),c=["input","button","textarea","select"],d=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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}return r(t,e),l(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(){},getListItemIndex:function(){},setAttributeForElementIndex:function(){},removeAttributeForElementIndex:function(){},addClassForElementIndex:function(){},removeClassForElementIndex:function(){},focusItemAtIndex:function(){},isElementFocusable:function(){},isListItem:function(){},setTabIndexForListItemChildren:function(){}}}}]),l(t,[{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:"setSelectedIndex",value:function(e){if(e===this.selectedIndex_)return this.adapter_.removeAttributeForElementIndex(this.selectedIndex_,a.b.ARIA_SELECTED),this.adapter_.removeClassForElementIndex(this.selectedIndex_,a.a.LIST_ITEM_SELECTED_CLASS),this.selectedIndex_>=0&&(this.adapter_.setAttributeForElementIndex(this.selectedIndex_,"tabindex",-1),this.adapter_.setAttributeForElementIndex(0,"tabindex",0)),void(this.selectedIndex_=-1);this.selectedIndex_>=0&&(this.adapter_.removeAttributeForElementIndex(this.selectedIndex_,a.b.ARIA_SELECTED),this.adapter_.removeClassForElementIndex(this.selectedIndex_,a.a.LIST_ITEM_SELECTED_CLASS),this.adapter_.setAttributeForElementIndex(this.selectedIndex_,"tabindex",-1)),e>=0&&this.adapter_.getListItemCount()>e&&(this.selectedIndex_=e,this.adapter_.setAttributeForElementIndex(this.selectedIndex_,a.b.ARIA_SELECTED,!0),this.adapter_.addClassForElementIndex(this.selectedIndex_,a.a.LIST_ITEM_SELECTED_CLASS),this.adapter_.setAttributeForElementIndex(this.selectedIndex_,"tabindex",0),0!==this.selectedIndex_&&this.adapter_.setAttributeForElementIndex(0,"tabindex",-1))}},{key:"handleFocusIn",value:function(e){var t=this.getListItem_(e.target);if(t){var n=this.adapter_.getListItemIndex(t);n>=0&&this.adapter_.setTabIndexForListItemChildren(n,0)}}},{key:"handleFocusOut",value:function(e){var t=this.getListItem_(e.target);if(t){var n=this.adapter_.getListItemIndex(t);n>=0&&this.adapter_.setTabIndexForListItemChildren(n,-1)}}},{key:"handleKeydown",value:function(e){var t="ArrowLeft"===e.key||37===e.keyCode,n="ArrowUp"===e.key||38===e.keyCode,i="ArrowRight"===e.key||39===e.keyCode,o="ArrowDown"===e.key||40===e.keyCode,r="Home"===e.key||36===e.keyCode,s="End"===e.key||35===e.keyCode,a="Enter"===e.key||13===e.keyCode,u="Space"===e.key||32===e.keyCode,l=this.adapter_.getFocusedElementIndex();-1===l&&(l=this.adapter_.getListItemIndex(this.getListItem_(e.target)))<0||(this.isVertical_&&o||!this.isVertical_&&i?(this.preventDefaultEvent_(e),this.focusNextElement(l)):this.isVertical_&&n||!this.isVertical_&&t?(this.preventDefaultEvent_(e),this.focusPrevElement(l)):r?(this.preventDefaultEvent_(e),this.focusFirstElement()):s?(this.preventDefaultEvent_(e),this.focusLastElement()):this.isSingleSelectionList_&&(a||u)&&(this.preventDefaultEvent_(e),this.adapter_.isListItem(e.target)&&this.setSelectedIndex(l)))}},{key:"handleClick",value:function(){var e=this.adapter_.getFocusedElementIndex();-1!==e&&this.setSelectedIndex(e)}},{key:"preventDefaultEvent_",value:function(e){var t=(""+e.target.tagName).toLowerCase();-1===c.indexOf(t)&&e.preventDefault()}},{key:"focusNextElement",value:function(e){var t=this.adapter_.getListItemCount(),n=e+1;if(n>=t){if(!this.wrapFocus_)return;n=0}this.adapter_.focusItemAtIndex(n)}},{key:"focusPrevElement",value:function(e){var t=e-1;if(t<0){if(!this.wrapFocus_)return;t=this.adapter_.getListItemCount()-1}this.adapter_.focusItemAtIndex(t)}},{key:"focusFirstElement",value:function(){this.adapter_.getListItemCount()>0&&this.adapter_.focusItemAtIndex(0)}},{key:"focusLastElement",value:function(){var e=this.adapter_.getListItemCount()-1;e>=0&&this.adapter_.focusItemAtIndex(e)}},{key:"getListItem_",value:function(e){for(;!this.adapter_.isListItem(e);){if(!e.parentElement)return null;e=e.parentElement}return e}}]),t}(s.a);t.a=d},45: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 r(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 d});var s=n(1),a=n(40),u=(n(22),n(23));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},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}}(),d=function(e){function t(){var e;i(this,t);for(var n=arguments.length,r=Array(n),s=0;s<n;s++)r[s]=arguments[s];var a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(r)));return a.handleKeydown_,a.handleClick_,a.focusInEventListener_,a.focusOutEventListener_,a}return r(t,e),c(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.handleKeydown_=this.foundation_.handleKeydown.bind(this.foundation_),this.handleClick_=this.foundation_.handleClick.bind(this.foundation_),this.focusInEventListener_=this.foundation_.handleFocusIn.bind(this.foundation_),this.focusOutEventListener_=this.foundation_.handleFocusOut.bind(this.foundation_),this.root_.addEventListener("keydown",this.handleKeydown_),this.root_.addEventListener("focusin",this.focusInEventListener_),this.root_.addEventListener("focusout",this.focusOutEventListener_),this.layout()}},{key:"layout",value:function(){var e=this.root_.getAttribute(u.b.ARIA_ORIENTATION);this.vertical=e!==u.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(u.b.FOCUSABLE_CHILD_ELEMENTS)).forEach(function(e){return e.setAttribute("tabindex",-1)})}},{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)},getListItemIndex:function(t){return e.listElements_.indexOf(t)},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)},isListItem:function(e){return e.classList.contains(u.a.LIST_ITEM_CLASS)},focusItemAtIndex:function(t){var n=e.listElements_[t];n&&n.focus()},isElementFocusable:function(e){if(!e)return!1;var t=Element.prototype.matches;return t||(t=Element.prototype.msMatchesSelector),t.call(e,u.b.FOCUSABLE_CHILD_ELEMENTS)},setTabIndexForListItemChildren:function(t,n){var i=e.listElements_[t];[].slice.call(i.querySelectorAll(u.b.FOCUSABLE_CHILD_ELEMENTS)).forEach(function(e){return e.setAttribute("tabindex",n)})}}))}},{key:"vertical",set:function(e){this.foundation_.setVerticalOrientation(e)}},{key:"listElements_",get:function(){return[].slice.call(this.root_.querySelectorAll(u.b.ENABLED_ITEMS_SELECTOR))}},{key:"wrapFocus",set:function(e){this.foundation_.setWrapFocus(e)}},{key:"singleSelection",set:function(e){e?this.root_.addEventListener("click",this.handleClick_):this.root_.removeEventListener("click",this.handleClick_),this.foundation_.setSingleSelection(e);var t=this.root_.querySelector(".mdc-list-item--selected");t&&(this.selectedIndex=this.listElements_.indexOf(t))}},{key:"selectedIndex",set:function(e){this.foundation_.setSelectedIndex(e)}}],[{key:"attachTo",value:function(e){return new t(e)}}]),t}(s.a)}})}); | ||
//# sourceMappingURL=mdc.list.min.js.map |
{ | ||
"name": "@material/list", | ||
"description": "The Material Components for the web list component", | ||
"version": "0.38.1", | ||
"version": "0.39.0-0", | ||
"license": "Apache-2.0", | ||
@@ -20,4 +20,4 @@ "keywords": [ | ||
"@material/theme": "^0.38.0", | ||
"@material/typography": "^0.38.0" | ||
"@material/typography": "^0.39.0-0" | ||
} | ||
} |
@@ -80,3 +80,3 @@ <!--docs: | ||
> NOTE: Make sure that there are no white-space characters before primary and secondary text. | ||
> NOTE: Make sure there are no white-space characters before primary and secondary text content. | ||
@@ -83,0 +83,0 @@ ### List Groups |
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
133551
2060
+ Added@material/typography@0.39.0(transitive)
- Removed@material/typography@0.38.0(transitive)