@ptcwebops/ptcw-design 6.3.21 → 6.3.22-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/dist/cjs/{component-35540bfb.js → component-4dd13907.js} +2643 -832
  2. package/dist/cjs/featured-list.cjs.entry.js +1 -1
  3. package/dist/cjs/innovator-toggle-container.cjs.entry.js +1 -1
  4. package/dist/cjs/jumbotron-sub-menu.cjs.entry.js +1 -1
  5. package/dist/cjs/list-item.cjs.entry.js +1 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/modal-form-example.cjs.entry.js +94 -0
  8. package/dist/cjs/ptc-back-to-top.cjs.entry.js +1 -16
  9. package/dist/cjs/ptc-bio-card.cjs.entry.js +5 -20
  10. package/dist/cjs/ptc-card_2.cjs.entry.js +5 -10
  11. package/dist/cjs/ptc-case-studies-slider.cjs.entry.js +6 -2
  12. package/dist/cjs/ptc-close-icon_2.cjs.entry.js +17 -32
  13. package/dist/cjs/ptc-data-lookup.cjs.entry.js +1 -2
  14. package/dist/cjs/ptc-dynamic-card.cjs.entry.js +1 -1
  15. package/dist/cjs/ptc-enhanced-product-listing-card.cjs.entry.js +1 -1
  16. package/dist/cjs/ptc-featured-list.cjs.entry.js +1 -1
  17. package/dist/cjs/ptc-filter-level-theater.cjs.entry.js +1 -1
  18. package/dist/cjs/{ptc-form-checkbox_2.cjs.entry.js → ptc-form-checkbox_4.cjs.entry.js} +787 -5
  19. package/dist/cjs/ptc-icon-list.cjs.entry.js +1 -1
  20. package/dist/cjs/ptc-info-tile.cjs.entry.js +1 -2
  21. package/dist/cjs/ptc-jumbotron.cjs.entry.js +1 -1
  22. package/dist/cjs/ptc-nav-skip-to-content.cjs.entry.js +3 -28
  23. package/dist/cjs/ptc-para.cjs.entry.js +1 -1
  24. package/dist/cjs/ptc-podcast-card.cjs.entry.js +1 -1
  25. package/dist/cjs/ptc-previous-url.cjs.entry.js +10 -2
  26. package/dist/cjs/ptc-pricing-packaging-table.cjs.entry.js +11 -9
  27. package/dist/cjs/ptc-pricing-tabs.cjs.entry.js +1 -1
  28. package/dist/cjs/ptc-product-card.cjs.entry.js +2 -2
  29. package/dist/cjs/ptc-product-category.cjs.entry.js +1 -1
  30. package/dist/cjs/ptc-product-dropdown.cjs.entry.js +2 -2
  31. package/dist/cjs/ptc-product-highlight-card.cjs.entry.js +1 -1
  32. package/dist/cjs/ptc-product-list.cjs.entry.js +1 -7
  33. package/dist/cjs/ptc-product-sidebar.cjs.entry.js +6 -38
  34. package/dist/cjs/ptc-readmore-char.cjs.entry.js +1 -1
  35. package/dist/cjs/ptc-readmore-v3.cjs.entry.js +1 -1
  36. package/dist/cjs/ptc-related-card-rail.cjs.entry.js +32 -90
  37. package/dist/cjs/ptc-tooltip-v2.cjs.entry.js +1 -1
  38. package/dist/cjs/ptc-value-led-speed-bump.cjs.entry.js +1 -1
  39. package/dist/cjs/ptc-white-paper.cjs.entry.js +10 -6
  40. package/dist/cjs/ptcw-design.cjs.js +1 -1
  41. package/dist/cjs/tab-header.cjs.entry.js +1 -1
  42. package/dist/collection/collection-manifest.json +1 -0
  43. package/dist/collection/components/icon-asset/media/designer-v6.0.6.svg +30 -2
  44. package/dist/collection/components/innovator-toggle-container/innovator-toggle-container.css +6 -6
  45. package/dist/collection/components/jumbotron-sub-menu/jumbotron-sub-menu.css +0 -1
  46. package/dist/collection/components/list-item/list-item.css +0 -4
  47. package/dist/collection/components/organism-bundles/bundle-featured-list/featured-list.css +3 -3
  48. package/dist/collection/components/organism-bundles/form/modal-from-example/modal-form-example.css +26 -0
  49. package/dist/collection/components/organism-bundles/form/modal-from-example/modal-form-example.js +99 -0
  50. package/dist/collection/components/ptc-back-to-top/ptc-back-to-top.css +0 -4
  51. package/dist/collection/components/ptc-back-to-top/ptc-back-to-top.js +0 -15
  52. package/dist/collection/components/ptc-bio-card/ptc-bio-card.css +6 -10
  53. package/dist/collection/components/ptc-bio-card/ptc-bio-card.js +4 -19
  54. package/dist/collection/components/ptc-case-studies-slider/ptc-case-studies-slider.css +6 -6
  55. package/dist/collection/components/ptc-case-studies-slider/ptc-case-studies-slider.js +5 -1
  56. package/dist/collection/components/ptc-container/ptc-container.js +2 -2
  57. package/dist/collection/components/ptc-dynamic-card/ptc-dynamic-card.css +1 -1
  58. package/dist/collection/components/ptc-enhanced-product-listing-card/ptc-enhanced-product-listing-card.css +0 -16
  59. package/dist/collection/components/ptc-featured-list/ptc-featured-list.css +6 -6
  60. package/dist/collection/components/ptc-filter-level-theater/ptc-filter-level-theater.css +6 -6
  61. package/dist/collection/components/ptc-icon-list/ptc-icon-list.css +0 -3
  62. package/dist/collection/components/ptc-info-tile/ptc-info-tile.js +1 -20
  63. package/dist/collection/components/ptc-jumbotron/ptc-jumbotron.css +6 -6
  64. package/dist/collection/components/ptc-modal/ptc-modal.css +4 -0
  65. package/dist/collection/components/ptc-modal/ptc-modal.js +18 -50
  66. package/dist/collection/components/ptc-nav-skip-to-content/ptc-nav-skip-to-content.css +0 -7
  67. package/dist/collection/components/ptc-nav-skip-to-content/ptc-nav-skip-to-content.js +2 -78
  68. package/dist/collection/components/ptc-para/ptc-para.css +3 -0
  69. package/dist/collection/components/ptc-para/ptc-para.js +2 -2
  70. package/dist/collection/components/ptc-podcast-card/ptc-podcast-card.css +6 -6
  71. package/dist/collection/components/ptc-preloader-section/ptc-preloader-section.css +0 -419
  72. package/dist/collection/components/ptc-preloader-section/ptc-preloader-section.js +4 -9
  73. package/dist/collection/components/ptc-previous-url/ptc-previous-url.css +16 -0
  74. package/dist/collection/components/ptc-previous-url/ptc-previous-url.js +27 -1
  75. package/dist/collection/components/ptc-pricing-packaging-table/ptc-pricing-packaging-table.js +11 -9
  76. package/dist/collection/components/ptc-pricing-tabs/ptc-pricing-tabs.js +1 -1
  77. package/dist/collection/components/ptc-product-card/ptc-product-card.css +6 -10
  78. package/dist/collection/components/ptc-product-card/ptc-product-card.js +1 -1
  79. package/dist/collection/components/ptc-product-category/ptc-product-category.css +6 -6
  80. package/dist/collection/components/ptc-product-dropdown/ptc-product-dropdown.css +0 -8
  81. package/dist/collection/components/ptc-product-dropdown/ptc-product-dropdown.js +1 -1
  82. package/dist/collection/components/ptc-product-highlight-card/ptc-product-highlight-card.css +6 -6
  83. package/dist/collection/components/ptc-product-list/ptc-product-list.js +1 -7
  84. package/dist/collection/components/ptc-product-sidebar/ptc-product-sidebar.css +0 -12
  85. package/dist/collection/components/ptc-product-sidebar/ptc-product-sidebar.js +5 -37
  86. package/dist/collection/components/ptc-readmore-char/ptc-readmore-char.css +6 -6
  87. package/dist/collection/components/ptc-readmore-v3/ptc-readmore-v3.css +6 -6
  88. package/dist/collection/components/ptc-related-card-rail/ptc-related-card-rail.css +2 -1
  89. package/dist/collection/components/ptc-related-card-rail/ptc-related-card-rail.js +33 -113
  90. package/dist/collection/components/ptc-textfield/ptc-textfield.js +19 -19
  91. package/dist/collection/components/ptc-tooltip-v2/ptc-tooltip-v2.css +6 -6
  92. package/dist/collection/components/ptc-value-led-speed-bump/ptc-value-led-speed-bump.css +6 -6
  93. package/dist/collection/components/ptc-white-paper/ptc-white-paper.css +6 -6
  94. package/dist/collection/components/ptc-white-paper/ptc-white-paper.js +9 -5
  95. package/dist/collection/components/tab-header/tab-header.js +1 -1
  96. package/dist/collection/stories/Card.stories.js +148 -3
  97. package/dist/collection/stories/Link.stories.js +13 -25
  98. package/dist/collection/stories/Paragraph.stories.js +10 -18
  99. package/dist/collection/stories/Select.stories.js +8 -5
  100. package/dist/collection/stories/Textfield.stories.js +28 -71
  101. package/dist/collection/stories/Title.stories.js +16 -28
  102. package/dist/collection/stories/organisms/eSupport/CaseTracker/preview.stories.js +45 -0
  103. package/dist/collection/stories/organisms/eSupport/SupportArticle/preview.stories.js +47 -0
  104. package/dist/collection/stories/organisms/eSupport/SupportPage/preview.stories.js +157 -0
  105. package/dist/custom-elements/index.d.ts +6 -0
  106. package/dist/custom-elements/index.js +230 -293
  107. package/dist/esm/{component-8c53e377.js → component-9c921cc6.js} +2592 -793
  108. package/dist/esm/featured-list.entry.js +1 -1
  109. package/dist/esm/innovator-toggle-container.entry.js +1 -1
  110. package/dist/esm/jumbotron-sub-menu.entry.js +1 -1
  111. package/dist/esm/list-item.entry.js +1 -1
  112. package/dist/esm/loader.js +1 -1
  113. package/dist/esm/modal-form-example.entry.js +90 -0
  114. package/dist/esm/ptc-back-to-top.entry.js +1 -16
  115. package/dist/esm/ptc-bio-card.entry.js +5 -20
  116. package/dist/esm/ptc-card_2.entry.js +5 -10
  117. package/dist/esm/ptc-case-studies-slider.entry.js +6 -2
  118. package/dist/esm/ptc-close-icon_2.entry.js +17 -32
  119. package/dist/esm/ptc-data-lookup.entry.js +1 -2
  120. package/dist/esm/ptc-dynamic-card.entry.js +1 -1
  121. package/dist/esm/ptc-enhanced-product-listing-card.entry.js +1 -1
  122. package/dist/esm/ptc-featured-list.entry.js +1 -1
  123. package/dist/esm/ptc-filter-level-theater.entry.js +1 -1
  124. package/dist/esm/{ptc-form-checkbox_2.entry.js → ptc-form-checkbox_4.entry.js} +784 -4
  125. package/dist/esm/ptc-icon-list.entry.js +1 -1
  126. package/dist/esm/ptc-info-tile.entry.js +1 -2
  127. package/dist/esm/ptc-jumbotron.entry.js +1 -1
  128. package/dist/esm/ptc-nav-skip-to-content.entry.js +3 -28
  129. package/dist/esm/ptc-para.entry.js +1 -1
  130. package/dist/esm/ptc-podcast-card.entry.js +1 -1
  131. package/dist/esm/ptc-previous-url.entry.js +10 -2
  132. package/dist/esm/ptc-pricing-packaging-table.entry.js +11 -9
  133. package/dist/esm/ptc-pricing-tabs.entry.js +1 -1
  134. package/dist/esm/ptc-product-card.entry.js +2 -2
  135. package/dist/esm/ptc-product-category.entry.js +1 -1
  136. package/dist/esm/ptc-product-dropdown.entry.js +2 -2
  137. package/dist/esm/ptc-product-highlight-card.entry.js +1 -1
  138. package/dist/esm/ptc-product-list.entry.js +1 -7
  139. package/dist/esm/ptc-product-sidebar.entry.js +6 -38
  140. package/dist/esm/ptc-readmore-char.entry.js +1 -1
  141. package/dist/esm/ptc-readmore-v3.entry.js +1 -1
  142. package/dist/esm/ptc-related-card-rail.entry.js +32 -90
  143. package/dist/esm/ptc-tooltip-v2.entry.js +1 -1
  144. package/dist/esm/ptc-value-led-speed-bump.entry.js +1 -1
  145. package/dist/esm/ptc-white-paper.entry.js +10 -6
  146. package/dist/esm/ptcw-design.js +1 -1
  147. package/dist/esm/tab-header.entry.js +1 -1
  148. package/dist/ptcw-design/media/designer-v6.0.6.svg +30 -2
  149. package/dist/ptcw-design/{p-752bba1c.entry.js → p-0529caaa.entry.js} +1 -1
  150. package/dist/ptcw-design/p-072a76d3.entry.js +1 -0
  151. package/dist/ptcw-design/{p-a791c53a.entry.js → p-0b515839.entry.js} +1 -1
  152. package/dist/ptcw-design/p-0d223232.entry.js +1 -0
  153. package/dist/ptcw-design/p-0de4cd11.entry.js +1 -0
  154. package/dist/ptcw-design/p-21aa746d.entry.js +1 -0
  155. package/dist/ptcw-design/{p-24776ca2.entry.js → p-2cc7e2a8.entry.js} +1 -1
  156. package/dist/ptcw-design/p-32f64f48.entry.js +1 -0
  157. package/dist/ptcw-design/p-3dac861d.entry.js +1 -0
  158. package/dist/ptcw-design/{p-d089dc37.entry.js → p-3dd0ded9.entry.js} +1 -1
  159. package/dist/ptcw-design/{p-4d8f6f46.entry.js → p-445329ed.entry.js} +1 -1
  160. package/dist/ptcw-design/{p-68ed2afe.entry.js → p-48c5eab8.entry.js} +1 -1
  161. package/dist/ptcw-design/p-4b192f5e.entry.js +1 -0
  162. package/dist/ptcw-design/p-4f93c631.entry.js +1 -0
  163. package/dist/ptcw-design/p-5311c6e1.entry.js +1 -0
  164. package/dist/ptcw-design/p-58e91cb8.entry.js +1 -0
  165. package/dist/ptcw-design/p-5db7f70b.entry.js +1 -0
  166. package/dist/ptcw-design/p-67c248ec.entry.js +1 -0
  167. package/dist/ptcw-design/p-71fbb799.entry.js +1 -0
  168. package/dist/ptcw-design/p-75390f63.entry.js +1 -0
  169. package/dist/ptcw-design/{p-e3b1af2b.entry.js → p-7793babb.entry.js} +1 -1
  170. package/dist/ptcw-design/p-799afee5.entry.js +1 -0
  171. package/dist/ptcw-design/p-8038bf31.entry.js +1 -0
  172. package/dist/ptcw-design/p-9501995f.entry.js +1 -0
  173. package/dist/ptcw-design/p-97b9f41b.entry.js +1 -0
  174. package/dist/ptcw-design/p-99ee8a0e.entry.js +1 -0
  175. package/dist/ptcw-design/p-9d612f1f.entry.js +1 -0
  176. package/dist/ptcw-design/p-a89b986a.entry.js +68 -0
  177. package/dist/ptcw-design/p-b50f71dd.entry.js +1 -0
  178. package/dist/ptcw-design/{p-757954b2.entry.js → p-b570e9a5.entry.js} +1 -1
  179. package/dist/ptcw-design/p-baff4d44.entry.js +1 -0
  180. package/dist/ptcw-design/p-bcab66bf.js +336 -0
  181. package/dist/ptcw-design/p-c788f16f.entry.js +1 -0
  182. package/dist/ptcw-design/{p-18ac526f.entry.js → p-d73cc053.entry.js} +1 -1
  183. package/dist/ptcw-design/p-de960790.entry.js +1 -0
  184. package/dist/ptcw-design/p-e6a272d9.entry.js +1 -0
  185. package/dist/ptcw-design/p-f1734520.entry.js +1 -0
  186. package/dist/ptcw-design/{p-0ddf2a09.entry.js → p-f867ebe6.entry.js} +1 -1
  187. package/dist/ptcw-design/p-fe40421e.entry.js +1 -0
  188. package/dist/ptcw-design/ptcw-design.css +2 -2
  189. package/dist/ptcw-design/ptcw-design.esm.js +1 -1
  190. package/dist/types/components/organism-bundles/form/modal-from-example/modal-form-example.d.ts +25 -0
  191. package/dist/types/components/ptc-bio-card/ptc-bio-card.d.ts +1 -1
  192. package/dist/types/components/ptc-container/ptc-container.d.ts +1 -1
  193. package/dist/types/components/ptc-info-tile/ptc-info-tile.d.ts +0 -1
  194. package/dist/types/components/ptc-mobile-select/mobile-select/dist/mobile-select.d.ts +209 -0
  195. package/dist/types/components/ptc-modal/ptc-modal.d.ts +2 -2
  196. package/dist/types/components/ptc-nav-skip-to-content/ptc-nav-skip-to-content.d.ts +0 -6
  197. package/dist/types/components/ptc-para/ptc-para.d.ts +1 -1
  198. package/dist/types/components/ptc-previous-url/ptc-previous-url.d.ts +2 -0
  199. package/dist/types/components/ptc-product-list/ptc-product-list.d.ts +1 -1
  200. package/dist/types/components/ptc-product-sidebar/ptc-product-sidebar.d.ts +3 -6
  201. package/dist/types/components/ptc-related-card-rail/ptc-related-card-rail.d.ts +5 -12
  202. package/dist/types/components/ptc-textfield/ptc-textfield.d.ts +0 -54
  203. package/dist/types/components.d.ts +21 -126
  204. package/dist/types/utils/eloqua.d.ts +9 -0
  205. package/package.json +2 -6
  206. package/readme.md +5 -1
  207. package/dist/cjs/component-1b8ad4d2.js +0 -1819
  208. package/dist/cjs/ptc-multi-select_2.cjs.entry.js +0 -670
  209. package/dist/cjs/validation-messages-33a4f26b.js +0 -126
  210. package/dist/collection/stories/Jumbotron.stories.js +0 -763
  211. package/dist/esm/component-9beac35b.js +0 -1802
  212. package/dist/esm/ptc-multi-select_2.entry.js +0 -665
  213. package/dist/esm/validation-messages-adbb6518.js +0 -124
  214. package/dist/ptcw-design/p-00e21489.entry.js +0 -1
  215. package/dist/ptcw-design/p-05c29cc2.entry.js +0 -1
  216. package/dist/ptcw-design/p-13e338a5.entry.js +0 -1
  217. package/dist/ptcw-design/p-1454ba84.entry.js +0 -1
  218. package/dist/ptcw-design/p-18a5a338.js +0 -1
  219. package/dist/ptcw-design/p-352e87c0.entry.js +0 -1
  220. package/dist/ptcw-design/p-38e5e590.entry.js +0 -1
  221. package/dist/ptcw-design/p-4737a0f6.entry.js +0 -1
  222. package/dist/ptcw-design/p-4ca956c1.entry.js +0 -1
  223. package/dist/ptcw-design/p-593b8eff.entry.js +0 -1
  224. package/dist/ptcw-design/p-73a853fc.entry.js +0 -1
  225. package/dist/ptcw-design/p-75431fa1.entry.js +0 -1
  226. package/dist/ptcw-design/p-98426799.js +0 -203
  227. package/dist/ptcw-design/p-98844b50.js +0 -134
  228. package/dist/ptcw-design/p-a2c7df64.entry.js +0 -1
  229. package/dist/ptcw-design/p-a58698ca.entry.js +0 -1
  230. package/dist/ptcw-design/p-acdd9a1d.entry.js +0 -1
  231. package/dist/ptcw-design/p-ad821a01.entry.js +0 -1
  232. package/dist/ptcw-design/p-b6255525.entry.js +0 -1
  233. package/dist/ptcw-design/p-b7fa9f2c.entry.js +0 -1
  234. package/dist/ptcw-design/p-b963ec8c.entry.js +0 -68
  235. package/dist/ptcw-design/p-bb9a879f.entry.js +0 -1
  236. package/dist/ptcw-design/p-bf84ecc0.entry.js +0 -1
  237. package/dist/ptcw-design/p-c82eaf9d.entry.js +0 -1
  238. package/dist/ptcw-design/p-cad4b517.entry.js +0 -1
  239. package/dist/ptcw-design/p-d6845e91.entry.js +0 -1
  240. package/dist/ptcw-design/p-db1dcce0.entry.js +0 -1
  241. package/dist/ptcw-design/p-ddb898c7.entry.js +0 -1
  242. package/dist/ptcw-design/p-e6619d63.entry.js +0 -1
  243. package/dist/ptcw-design/p-f9256e3d.entry.js +0 -1
  244. package/dist/ptcw-design/p-fbd9c8fc.entry.js +0 -1
@@ -1,10 +1,94 @@
1
1
  'use strict';
2
2
 
3
- const component = require('./component-1b8ad4d2.js');
3
+ /******************************************************************************
4
+ Copyright (c) Microsoft Corporation.
5
+
6
+ Permission to use, copy, modify, and/or distribute this software for any
7
+ purpose with or without fee is hereby granted.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
16
+ ***************************************************************************** */
17
+ /* global Reflect, Promise, SuppressedError, Symbol */
18
+
19
+ var extendStatics = function(d, b) {
20
+ extendStatics = Object.setPrototypeOf ||
21
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
23
+ return extendStatics(d, b);
24
+ };
25
+
26
+ function __extends(d, b) {
27
+ if (typeof b !== "function" && b !== null)
28
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29
+ extendStatics(d, b);
30
+ function __() { this.constructor = d; }
31
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32
+ }
33
+
34
+ exports.__assign = function() {
35
+ exports.__assign = Object.assign || function __assign(t) {
36
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
37
+ s = arguments[i];
38
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
39
+ }
40
+ return t;
41
+ };
42
+ return exports.__assign.apply(this, arguments);
43
+ };
44
+
45
+ function __values(o) {
46
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
47
+ if (m) return m.call(o);
48
+ if (o && typeof o.length === "number") return {
49
+ next: function () {
50
+ if (o && i >= o.length) o = void 0;
51
+ return { value: o && o[i++], done: !o };
52
+ }
53
+ };
54
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
55
+ }
56
+
57
+ function __read(o, n) {
58
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
59
+ if (!m) return o;
60
+ var i = m.call(o), r, ar = [], e;
61
+ try {
62
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
63
+ }
64
+ catch (error) { e = { error: error }; }
65
+ finally {
66
+ try {
67
+ if (r && !r.done && (m = i["return"])) m.call(i);
68
+ }
69
+ finally { if (e) throw e.error; }
70
+ }
71
+ return ar;
72
+ }
73
+
74
+ function __spreadArray(to, from, pack) {
75
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
76
+ if (ar || !(i in from)) {
77
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
78
+ ar[i] = from[i];
79
+ }
80
+ }
81
+ return to.concat(ar || Array.prototype.slice.call(from));
82
+ }
83
+
84
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
85
+ var e = new Error(message);
86
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
87
+ };
4
88
 
5
89
  /**
6
90
  * @license
7
- * Copyright 2018 Google Inc.
91
+ * Copyright 2016 Google Inc.
8
92
  *
9
93
  * Permission is hereby granted, free of charge, to any person obtaining a copy
10
94
  * of this software and associated documentation files (the "Software"), to deal
@@ -24,86 +108,60 @@ const component = require('./component-1b8ad4d2.js');
24
108
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
109
  * THE SOFTWARE.
26
110
  */
27
- var cssClasses$4 = {
28
- ANCHOR: 'mdc-menu-surface--anchor',
29
- ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed',
30
- ANIMATING_OPEN: 'mdc-menu-surface--animating-open',
31
- FIXED: 'mdc-menu-surface--fixed',
32
- IS_OPEN_BELOW: 'mdc-menu-surface--is-open-below',
33
- OPEN: 'mdc-menu-surface--open',
34
- ROOT: 'mdc-menu-surface',
35
- };
36
- // tslint:disable:object-literal-sort-keys
37
- var strings$5 = {
38
- CLOSED_EVENT: 'MDCMenuSurface:closed',
39
- CLOSING_EVENT: 'MDCMenuSurface:closing',
40
- OPENED_EVENT: 'MDCMenuSurface:opened',
41
- OPENING_EVENT: 'MDCMenuSurface:opening',
42
- FOCUSABLE_ELEMENTS: [
43
- 'button:not(:disabled)',
44
- '[href]:not([aria-disabled="true"])',
45
- 'input:not(:disabled)',
46
- 'select:not(:disabled)',
47
- 'textarea:not(:disabled)',
48
- '[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])',
49
- ].join(', '),
50
- };
51
- // tslint:enable:object-literal-sort-keys
52
- var numbers$3 = {
53
- /** Total duration of menu-surface open animation. */
54
- TRANSITION_OPEN_DURATION: 120,
55
- /** Total duration of menu-surface close animation. */
56
- TRANSITION_CLOSE_DURATION: 75,
57
- /**
58
- * Margin left to the edge of the viewport when menu-surface is at maximum
59
- * possible height. Also used as a viewport margin.
60
- */
61
- MARGIN_TO_EDGE: 32,
62
- /**
63
- * Ratio of anchor width to menu-surface width for switching from corner
64
- * positioning to center positioning.
65
- */
66
- ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67,
67
- /**
68
- * Amount of time to wait before restoring focus when closing the menu
69
- * surface. This is important because if a touch event triggered the menu
70
- * close, and the subsequent mouse event occurs after focus is restored, then
71
- * the restored focus would be lost.
72
- */
73
- TOUCH_EVENT_WAIT_MS: 30,
74
- };
75
- /**
76
- * Enum for bits in the {@see Corner) bitmap.
77
- */
78
- var CornerBit;
79
- (function (CornerBit) {
80
- CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
81
- CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
82
- CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
83
- CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
84
- })(CornerBit || (CornerBit = {}));
85
- /**
86
- * Enum for representing an element corner for positioning the menu-surface.
87
- *
88
- * The START constants map to LEFT if element directionality is left
89
- * to right and RIGHT if the directionality is right to left.
90
- * Likewise END maps to RIGHT or LEFT depending on the directionality.
91
- */
92
- var Corner;
93
- (function (Corner) {
94
- Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
95
- Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
96
- Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
97
- Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
98
- Corner[Corner["TOP_START"] = 8] = "TOP_START";
99
- Corner[Corner["TOP_END"] = 12] = "TOP_END";
100
- Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
101
- Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
102
- })(Corner || (Corner = {}));
111
+ var MDCFoundation = /** @class */ (function () {
112
+ function MDCFoundation(adapter) {
113
+ if (adapter === void 0) { adapter = {}; }
114
+ this.adapter = adapter;
115
+ }
116
+ Object.defineProperty(MDCFoundation, "cssClasses", {
117
+ get: function () {
118
+ // Classes extending MDCFoundation should implement this method to return an object which exports every
119
+ // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
120
+ return {};
121
+ },
122
+ enumerable: false,
123
+ configurable: true
124
+ });
125
+ Object.defineProperty(MDCFoundation, "strings", {
126
+ get: function () {
127
+ // Classes extending MDCFoundation should implement this method to return an object which exports all
128
+ // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
129
+ return {};
130
+ },
131
+ enumerable: false,
132
+ configurable: true
133
+ });
134
+ Object.defineProperty(MDCFoundation, "numbers", {
135
+ get: function () {
136
+ // Classes extending MDCFoundation should implement this method to return an object which exports all
137
+ // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
138
+ return {};
139
+ },
140
+ enumerable: false,
141
+ configurable: true
142
+ });
143
+ Object.defineProperty(MDCFoundation, "defaultAdapter", {
144
+ get: function () {
145
+ // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
146
+ // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
147
+ // validation.
148
+ return {};
149
+ },
150
+ enumerable: false,
151
+ configurable: true
152
+ });
153
+ MDCFoundation.prototype.init = function () {
154
+ // Subclasses should override this method to perform initialization routines (registering events, etc.)
155
+ };
156
+ MDCFoundation.prototype.destroy = function () {
157
+ // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
158
+ };
159
+ return MDCFoundation;
160
+ }());
103
161
 
104
162
  /**
105
163
  * @license
106
- * Copyright 2018 Google Inc.
164
+ * Copyright 2016 Google Inc.
107
165
  *
108
166
  * Permission is hereby granted, free of charge, to any person obtaining a copy
109
167
  * of this software and associated documentation files (the "Software"), to deal
@@ -123,64 +181,86 @@ var Corner;
123
181
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
124
182
  * THE SOFTWARE.
125
183
  */
126
- var _a, _b;
127
- var cssClasses$3 = {
128
- LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated',
129
- LIST_ITEM_CLASS: 'mdc-list-item',
130
- LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled',
131
- LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected',
132
- LIST_ITEM_TEXT_CLASS: 'mdc-list-item__text',
133
- LIST_ITEM_PRIMARY_TEXT_CLASS: 'mdc-list-item__primary-text',
134
- ROOT: 'mdc-list',
135
- };
136
- var evolutionClassNameMap = (_a = {},
137
- _a["" + cssClasses$3.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-list-item--activated',
138
- _a["" + cssClasses$3.LIST_ITEM_CLASS] = 'mdc-list-item',
139
- _a["" + cssClasses$3.LIST_ITEM_DISABLED_CLASS] = 'mdc-list-item--disabled',
140
- _a["" + cssClasses$3.LIST_ITEM_SELECTED_CLASS] = 'mdc-list-item--selected',
141
- _a["" + cssClasses$3.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-list-item__primary-text',
142
- _a["" + cssClasses$3.ROOT] = 'mdc-list',
143
- _a);
144
- var deprecatedClassNameMap = (_b = {},
145
- _b["" + cssClasses$3.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-deprecated-list-item--activated',
146
- _b["" + cssClasses$3.LIST_ITEM_CLASS] = 'mdc-deprecated-list-item',
147
- _b["" + cssClasses$3.LIST_ITEM_DISABLED_CLASS] = 'mdc-deprecated-list-item--disabled',
148
- _b["" + cssClasses$3.LIST_ITEM_SELECTED_CLASS] = 'mdc-deprecated-list-item--selected',
149
- _b["" + cssClasses$3.LIST_ITEM_TEXT_CLASS] = 'mdc-deprecated-list-item__text',
150
- _b["" + cssClasses$3.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-deprecated-list-item__primary-text',
151
- _b["" + cssClasses$3.ROOT] = 'mdc-deprecated-list',
152
- _b);
153
- var strings$4 = {
154
- ACTION_EVENT: 'MDCList:action',
155
- SELECTION_CHANGE_EVENT: 'MDCList:selectionChange',
156
- ARIA_CHECKED: 'aria-checked',
157
- ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]',
158
- ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]',
159
- ARIA_CURRENT: 'aria-current',
160
- ARIA_DISABLED: 'aria-disabled',
161
- ARIA_ORIENTATION: 'aria-orientation',
162
- ARIA_ORIENTATION_HORIZONTAL: 'horizontal',
163
- ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]',
164
- ARIA_SELECTED: 'aria-selected',
165
- ARIA_INTERACTIVE_ROLES_SELECTOR: '[role="listbox"], [role="menu"]',
166
- ARIA_MULTI_SELECTABLE_SELECTOR: '[aria-multiselectable="true"]',
167
- CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"], input[type="radio"]',
168
- CHECKBOX_SELECTOR: 'input[type="checkbox"]',
169
- CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses$3.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses$3.LIST_ITEM_CLASS + " a,\n ." + deprecatedClassNameMap[cssClasses$3.LIST_ITEM_CLASS] + " button:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$3.LIST_ITEM_CLASS] + " a\n ",
170
- DEPRECATED_SELECTOR: '.mdc-deprecated-list',
171
- FOCUSABLE_CHILD_ELEMENTS: "\n ." + cssClasses$3.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses$3.LIST_ITEM_CLASS + " a,\n ." + cssClasses$3.LIST_ITEM_CLASS + " input[type=\"radio\"]:not(:disabled),\n ." + cssClasses$3.LIST_ITEM_CLASS + " input[type=\"checkbox\"]:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$3.LIST_ITEM_CLASS] + " button:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$3.LIST_ITEM_CLASS] + " a,\n ." + deprecatedClassNameMap[cssClasses$3.LIST_ITEM_CLASS] + " input[type=\"radio\"]:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$3.LIST_ITEM_CLASS] + " input[type=\"checkbox\"]:not(:disabled)\n ",
172
- RADIO_SELECTOR: 'input[type="radio"]',
173
- SELECTED_ITEM_SELECTOR: '[aria-selected="true"], [aria-current="true"]',
174
- };
175
- var numbers$2 = {
176
- UNSET_INDEX: -1,
177
- TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS: 300
178
- };
179
- var evolutionAttribute = 'evolution';
184
+ var MDCComponent = /** @class */ (function () {
185
+ function MDCComponent(root, foundation) {
186
+ var args = [];
187
+ for (var _i = 2; _i < arguments.length; _i++) {
188
+ args[_i - 2] = arguments[_i];
189
+ }
190
+ this.root = root;
191
+ this.initialize.apply(this, __spreadArray([], __read(args)));
192
+ // Note that we initialize foundation here and not within the constructor's
193
+ // default param so that this.root is defined and can be used within the
194
+ // foundation class.
195
+ this.foundation =
196
+ foundation === undefined ? this.getDefaultFoundation() : foundation;
197
+ this.foundation.init();
198
+ this.initialSyncWithDOM();
199
+ }
200
+ MDCComponent.attachTo = function (root) {
201
+ // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
202
+ // returns an instantiated component with its root set to that element. Also note that in the cases of
203
+ // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
204
+ // from getDefaultFoundation().
205
+ return new MDCComponent(root, new MDCFoundation({}));
206
+ };
207
+ /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
208
+ MDCComponent.prototype.initialize = function () {
209
+ var _args = [];
210
+ for (var _i = 0; _i < arguments.length; _i++) {
211
+ _args[_i] = arguments[_i];
212
+ }
213
+ // Subclasses can override this to do any additional setup work that would be considered part of a
214
+ // "constructor". Essentially, it is a hook into the parent constructor before the foundation is
215
+ // initialized. Any additional arguments besides root and foundation will be passed in here.
216
+ };
217
+ MDCComponent.prototype.getDefaultFoundation = function () {
218
+ // Subclasses must override this method to return a properly configured foundation class for the
219
+ // component.
220
+ throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' +
221
+ 'foundation class');
222
+ };
223
+ MDCComponent.prototype.initialSyncWithDOM = function () {
224
+ // Subclasses should override this method if they need to perform work to synchronize with a host DOM
225
+ // object. An example of this would be a form control wrapper that needs to synchronize its internal state
226
+ // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
227
+ // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
228
+ };
229
+ MDCComponent.prototype.destroy = function () {
230
+ // Subclasses may implement this method to release any resources / deregister any listeners they have
231
+ // attached. An example of this might be deregistering a resize event from the window object.
232
+ this.foundation.destroy();
233
+ };
234
+ MDCComponent.prototype.listen = function (evtType, handler, options) {
235
+ this.root.addEventListener(evtType, handler, options);
236
+ };
237
+ MDCComponent.prototype.unlisten = function (evtType, handler, options) {
238
+ this.root.removeEventListener(evtType, handler, options);
239
+ };
240
+ /**
241
+ * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
242
+ */
243
+ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
244
+ if (shouldBubble === void 0) { shouldBubble = false; }
245
+ var evt;
246
+ if (typeof CustomEvent === 'function') {
247
+ evt = new CustomEvent(evtType, {
248
+ bubbles: shouldBubble,
249
+ detail: evtData,
250
+ });
251
+ }
252
+ else {
253
+ evt = document.createEvent('CustomEvent');
254
+ evt.initCustomEvent(evtType, shouldBubble, false, evtData);
255
+ }
256
+ this.root.dispatchEvent(evt);
257
+ };
258
+ return MDCComponent;
259
+ }());
180
260
 
181
261
  /**
182
262
  * @license
183
- * Copyright 2020 Google Inc.
263
+ * Copyright 2018 Google Inc.
184
264
  *
185
265
  * Permission is hereby granted, free of charge, to any person obtaining a copy
186
266
  * of this software and associated documentation files (the "Software"), to deal
@@ -201,106 +281,57 @@ var evolutionAttribute = 'evolution';
201
281
  * THE SOFTWARE.
202
282
  */
203
283
  /**
204
- * KEY provides normalized string values for keys.
284
+ * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain.
285
+ * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.
205
286
  */
206
- var KEY = {
207
- UNKNOWN: 'Unknown',
208
- BACKSPACE: 'Backspace',
209
- ENTER: 'Enter',
210
- SPACEBAR: 'Spacebar',
211
- PAGE_UP: 'PageUp',
212
- PAGE_DOWN: 'PageDown',
213
- END: 'End',
214
- HOME: 'Home',
215
- ARROW_LEFT: 'ArrowLeft',
216
- ARROW_UP: 'ArrowUp',
217
- ARROW_RIGHT: 'ArrowRight',
218
- ARROW_DOWN: 'ArrowDown',
219
- DELETE: 'Delete',
220
- ESCAPE: 'Escape',
221
- TAB: 'Tab',
222
- };
223
- var normalizedKeys = new Set();
224
- // IE11 has no support for new Map with iterable so we need to initialize this
225
- // by hand.
226
- normalizedKeys.add(KEY.BACKSPACE);
227
- normalizedKeys.add(KEY.ENTER);
228
- normalizedKeys.add(KEY.SPACEBAR);
229
- normalizedKeys.add(KEY.PAGE_UP);
230
- normalizedKeys.add(KEY.PAGE_DOWN);
231
- normalizedKeys.add(KEY.END);
232
- normalizedKeys.add(KEY.HOME);
233
- normalizedKeys.add(KEY.ARROW_LEFT);
234
- normalizedKeys.add(KEY.ARROW_UP);
235
- normalizedKeys.add(KEY.ARROW_RIGHT);
236
- normalizedKeys.add(KEY.ARROW_DOWN);
237
- normalizedKeys.add(KEY.DELETE);
238
- normalizedKeys.add(KEY.ESCAPE);
239
- normalizedKeys.add(KEY.TAB);
240
- var KEY_CODE = {
241
- BACKSPACE: 8,
242
- ENTER: 13,
243
- SPACEBAR: 32,
244
- PAGE_UP: 33,
245
- PAGE_DOWN: 34,
246
- END: 35,
247
- HOME: 36,
248
- ARROW_LEFT: 37,
249
- ARROW_UP: 38,
250
- ARROW_RIGHT: 39,
251
- ARROW_DOWN: 40,
252
- DELETE: 46,
253
- ESCAPE: 27,
254
- TAB: 9,
255
- };
256
- var mappedKeyCodes = new Map();
257
- // IE11 has no support for new Map with iterable so we need to initialize this
258
- // by hand.
259
- mappedKeyCodes.set(KEY_CODE.BACKSPACE, KEY.BACKSPACE);
260
- mappedKeyCodes.set(KEY_CODE.ENTER, KEY.ENTER);
261
- mappedKeyCodes.set(KEY_CODE.SPACEBAR, KEY.SPACEBAR);
262
- mappedKeyCodes.set(KEY_CODE.PAGE_UP, KEY.PAGE_UP);
263
- mappedKeyCodes.set(KEY_CODE.PAGE_DOWN, KEY.PAGE_DOWN);
264
- mappedKeyCodes.set(KEY_CODE.END, KEY.END);
265
- mappedKeyCodes.set(KEY_CODE.HOME, KEY.HOME);
266
- mappedKeyCodes.set(KEY_CODE.ARROW_LEFT, KEY.ARROW_LEFT);
267
- mappedKeyCodes.set(KEY_CODE.ARROW_UP, KEY.ARROW_UP);
268
- mappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, KEY.ARROW_RIGHT);
269
- mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, KEY.ARROW_DOWN);
270
- mappedKeyCodes.set(KEY_CODE.DELETE, KEY.DELETE);
271
- mappedKeyCodes.set(KEY_CODE.ESCAPE, KEY.ESCAPE);
272
- mappedKeyCodes.set(KEY_CODE.TAB, KEY.TAB);
273
- var navigationKeys = new Set();
274
- // IE11 has no support for new Set with iterable so we need to initialize this
275
- // by hand.
276
- navigationKeys.add(KEY.PAGE_UP);
277
- navigationKeys.add(KEY.PAGE_DOWN);
278
- navigationKeys.add(KEY.END);
279
- navigationKeys.add(KEY.HOME);
280
- navigationKeys.add(KEY.ARROW_LEFT);
281
- navigationKeys.add(KEY.ARROW_UP);
282
- navigationKeys.add(KEY.ARROW_RIGHT);
283
- navigationKeys.add(KEY.ARROW_DOWN);
287
+ function closest(element, selector) {
288
+ if (element.closest) {
289
+ return element.closest(selector);
290
+ }
291
+ var el = element;
292
+ while (el) {
293
+ if (matches(el, selector)) {
294
+ return el;
295
+ }
296
+ el = el.parentElement;
297
+ }
298
+ return null;
299
+ }
300
+ function matches(element, selector) {
301
+ var nativeMatches = element.matches
302
+ || element.webkitMatchesSelector
303
+ || element.msMatchesSelector;
304
+ return nativeMatches.call(element, selector);
305
+ }
284
306
  /**
285
- * normalizeKey returns the normalized string for a navigational action.
307
+ * Used to compute the estimated scroll width of elements. When an element is
308
+ * hidden due to display: none; being applied to a parent element, the width is
309
+ * returned as 0. However, the element will have a true width once no longer
310
+ * inside a display: none context. This method computes an estimated width when
311
+ * the element is hidden or returns the true width when the element is visble.
312
+ * @param {Element} element the element whose width to estimate
286
313
  */
287
- function normalizeKey(evt) {
288
- var key = evt.key;
289
- // If the event already has a normalized key, return it
290
- if (normalizedKeys.has(key)) {
291
- return key;
292
- }
293
- // tslint:disable-next-line:deprecation
294
- var mappedKey = mappedKeyCodes.get(evt.keyCode);
295
- if (mappedKey) {
296
- return mappedKey;
314
+ function estimateScrollWidth(element) {
315
+ // Check the offsetParent. If the element inherits display: none from any
316
+ // parent, the offsetParent property will be null (see
317
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).
318
+ // This check ensures we only clone the node when necessary.
319
+ var htmlEl = element;
320
+ if (htmlEl.offsetParent !== null) {
321
+ return htmlEl.scrollWidth;
297
322
  }
298
- return KEY.UNKNOWN;
323
+ var clone = htmlEl.cloneNode(true);
324
+ clone.style.setProperty('position', 'absolute');
325
+ clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
326
+ document.documentElement.appendChild(clone);
327
+ var scrollWidth = clone.scrollWidth;
328
+ document.documentElement.removeChild(clone);
329
+ return scrollWidth;
299
330
  }
300
331
 
301
332
  /**
302
333
  * @license
303
- * Copyright 2020 Google Inc.
334
+ * Copyright 2016 Google Inc.
304
335
  *
305
336
  * Permission is hereby granted, free of charge, to any person obtaining a copy
306
337
  * of this software and associated documentation files (the "Software"), to deal
@@ -320,27 +351,131 @@ function normalizeKey(evt) {
320
351
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
321
352
  * THE SOFTWARE.
322
353
  */
323
- var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];
354
+ var cssClasses$8 = {
355
+ LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above',
356
+ LABEL_REQUIRED: 'mdc-floating-label--required',
357
+ LABEL_SHAKE: 'mdc-floating-label--shake',
358
+ ROOT: 'mdc-floating-label',
359
+ };
360
+
324
361
  /**
325
- * Ensures that preventDefault is only called if the containing element
326
- * doesn't consume the event, and it will cause an unintended scroll.
362
+ * @license
363
+ * Copyright 2016 Google Inc.
327
364
  *
328
- * @param evt keyboard event to be prevented.
365
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
366
+ * of this software and associated documentation files (the "Software"), to deal
367
+ * in the Software without restriction, including without limitation the rights
368
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
369
+ * copies of the Software, and to permit persons to whom the Software is
370
+ * furnished to do so, subject to the following conditions:
371
+ *
372
+ * The above copyright notice and this permission notice shall be included in
373
+ * all copies or substantial portions of the Software.
374
+ *
375
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
376
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
377
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
378
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
379
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
380
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
381
+ * THE SOFTWARE.
329
382
  */
330
- var preventDefaultEvent = function (evt) {
331
- var target = evt.target;
332
- if (!target) {
333
- return;
334
- }
335
- var tagName = ("" + target.tagName).toLowerCase();
336
- if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {
337
- evt.preventDefault();
383
+ var MDCFloatingLabelFoundation = /** @class */ (function (_super) {
384
+ __extends(MDCFloatingLabelFoundation, _super);
385
+ function MDCFloatingLabelFoundation(adapter) {
386
+ var _this = _super.call(this, exports.__assign(exports.__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this;
387
+ _this.shakeAnimationEndHandler = function () {
388
+ _this.handleShakeAnimationEnd();
389
+ };
390
+ return _this;
338
391
  }
339
- };
392
+ Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", {
393
+ get: function () {
394
+ return cssClasses$8;
395
+ },
396
+ enumerable: false,
397
+ configurable: true
398
+ });
399
+ Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", {
400
+ /**
401
+ * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types.
402
+ */
403
+ get: function () {
404
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
405
+ return {
406
+ addClass: function () { return undefined; },
407
+ removeClass: function () { return undefined; },
408
+ getWidth: function () { return 0; },
409
+ registerInteractionHandler: function () { return undefined; },
410
+ deregisterInteractionHandler: function () { return undefined; },
411
+ };
412
+ // tslint:enable:object-literal-sort-keys
413
+ },
414
+ enumerable: false,
415
+ configurable: true
416
+ });
417
+ MDCFloatingLabelFoundation.prototype.init = function () {
418
+ this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler);
419
+ };
420
+ MDCFloatingLabelFoundation.prototype.destroy = function () {
421
+ this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler);
422
+ };
423
+ /**
424
+ * Returns the width of the label element.
425
+ */
426
+ MDCFloatingLabelFoundation.prototype.getWidth = function () {
427
+ return this.adapter.getWidth();
428
+ };
429
+ /**
430
+ * Styles the label to produce a shake animation to indicate an error.
431
+ * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class.
432
+ */
433
+ MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) {
434
+ var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
435
+ if (shouldShake) {
436
+ this.adapter.addClass(LABEL_SHAKE);
437
+ }
438
+ else {
439
+ this.adapter.removeClass(LABEL_SHAKE);
440
+ }
441
+ };
442
+ /**
443
+ * Styles the label to float or dock.
444
+ * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label.
445
+ */
446
+ MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) {
447
+ var _a = MDCFloatingLabelFoundation.cssClasses, LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE, LABEL_SHAKE = _a.LABEL_SHAKE;
448
+ if (shouldFloat) {
449
+ this.adapter.addClass(LABEL_FLOAT_ABOVE);
450
+ }
451
+ else {
452
+ this.adapter.removeClass(LABEL_FLOAT_ABOVE);
453
+ this.adapter.removeClass(LABEL_SHAKE);
454
+ }
455
+ };
456
+ /**
457
+ * Styles the label as required.
458
+ * @param isRequired If true, adds an asterisk to the label, indicating that it is required.
459
+ */
460
+ MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) {
461
+ var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED;
462
+ if (isRequired) {
463
+ this.adapter.addClass(LABEL_REQUIRED);
464
+ }
465
+ else {
466
+ this.adapter.removeClass(LABEL_REQUIRED);
467
+ }
468
+ };
469
+ MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd = function () {
470
+ var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
471
+ this.adapter.removeClass(LABEL_SHAKE);
472
+ };
473
+ return MDCFloatingLabelFoundation;
474
+ }(MDCFoundation));
340
475
 
341
476
  /**
342
477
  * @license
343
- * Copyright 2020 Google Inc.
478
+ * Copyright 2016 Google Inc.
344
479
  *
345
480
  * Permission is hereby granted, free of charge, to any person obtaining a copy
346
481
  * of this software and associated documentation files (the "Software"), to deal
@@ -360,86 +495,680 @@ var preventDefaultEvent = function (evt) {
360
495
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
361
496
  * THE SOFTWARE.
362
497
  */
498
+ var MDCFloatingLabel = /** @class */ (function (_super) {
499
+ __extends(MDCFloatingLabel, _super);
500
+ function MDCFloatingLabel() {
501
+ return _super !== null && _super.apply(this, arguments) || this;
502
+ }
503
+ MDCFloatingLabel.attachTo = function (root) {
504
+ return new MDCFloatingLabel(root);
505
+ };
506
+ /**
507
+ * Styles the label to produce the label shake for errors.
508
+ * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class.
509
+ */
510
+ MDCFloatingLabel.prototype.shake = function (shouldShake) {
511
+ this.foundation.shake(shouldShake);
512
+ };
513
+ /**
514
+ * Styles the label to float/dock.
515
+ * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class.
516
+ */
517
+ MDCFloatingLabel.prototype.float = function (shouldFloat) {
518
+ this.foundation.float(shouldFloat);
519
+ };
520
+ /**
521
+ * Styles the label as required.
522
+ * @param isRequired If true, adds an asterisk to the label, indicating that it is required.
523
+ */
524
+ MDCFloatingLabel.prototype.setRequired = function (isRequired) {
525
+ this.foundation.setRequired(isRequired);
526
+ };
527
+ MDCFloatingLabel.prototype.getWidth = function () {
528
+ return this.foundation.getWidth();
529
+ };
530
+ MDCFloatingLabel.prototype.getDefaultFoundation = function () {
531
+ var _this = this;
532
+ // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
533
+ // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
534
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
535
+ var adapter = {
536
+ addClass: function (className) { return _this.root.classList.add(className); },
537
+ removeClass: function (className) { return _this.root.classList.remove(className); },
538
+ getWidth: function () { return estimateScrollWidth(_this.root); },
539
+ registerInteractionHandler: function (evtType, handler) {
540
+ return _this.listen(evtType, handler);
541
+ },
542
+ deregisterInteractionHandler: function (evtType, handler) {
543
+ return _this.unlisten(evtType, handler);
544
+ },
545
+ };
546
+ // tslint:enable:object-literal-sort-keys
547
+ return new MDCFloatingLabelFoundation(adapter);
548
+ };
549
+ return MDCFloatingLabel;
550
+ }(MDCComponent));
551
+
363
552
  /**
364
- * Initializes a state object for typeahead. Use the same reference for calls to
365
- * typeahead functions.
553
+ * @license
554
+ * Copyright 2018 Google Inc.
366
555
  *
367
- * @return The current state of the typeahead process. Each state reference
368
- * represents a typeahead instance as the reference is typically mutated
369
- * in-place.
556
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
557
+ * of this software and associated documentation files (the "Software"), to deal
558
+ * in the Software without restriction, including without limitation the rights
559
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
560
+ * copies of the Software, and to permit persons to whom the Software is
561
+ * furnished to do so, subject to the following conditions:
562
+ *
563
+ * The above copyright notice and this permission notice shall be included in
564
+ * all copies or substantial portions of the Software.
565
+ *
566
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
567
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
568
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
569
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
570
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
571
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
572
+ * THE SOFTWARE.
370
573
  */
371
- function initState() {
372
- var state = {
373
- bufferClearTimeout: 0,
374
- currentFirstChar: '',
375
- sortedIndexCursor: 0,
376
- typeaheadBuffer: '',
377
- };
378
- return state;
379
- }
574
+ var cssClasses$7 = {
575
+ LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active',
576
+ LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating',
577
+ };
578
+
380
579
  /**
381
- * Initializes typeahead state by indexing the current list items by primary
382
- * text into the sortedIndexByFirstChar data structure.
580
+ * @license
581
+ * Copyright 2018 Google Inc.
383
582
  *
384
- * @param listItemCount numer of items in the list
385
- * @param getPrimaryTextByItemIndex function that returns the primary text at a
386
- * given index
583
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
584
+ * of this software and associated documentation files (the "Software"), to deal
585
+ * in the Software without restriction, including without limitation the rights
586
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
587
+ * copies of the Software, and to permit persons to whom the Software is
588
+ * furnished to do so, subject to the following conditions:
387
589
  *
388
- * @return Map that maps the first character of the primary text to the full
389
- * list text and it's index
590
+ * The above copyright notice and this permission notice shall be included in
591
+ * all copies or substantial portions of the Software.
592
+ *
593
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
594
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
595
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
596
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
597
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
598
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
599
+ * THE SOFTWARE.
390
600
  */
391
- function initSortedIndex(listItemCount, getPrimaryTextByItemIndex) {
392
- var sortedIndexByFirstChar = new Map();
393
- // Aggregate item text to index mapping
394
- for (var i = 0; i < listItemCount; i++) {
395
- var primaryText = getPrimaryTextByItemIndex(i).trim();
396
- if (!primaryText) {
397
- continue;
398
- }
399
- var firstChar = primaryText[0].toLowerCase();
400
- if (!sortedIndexByFirstChar.has(firstChar)) {
401
- sortedIndexByFirstChar.set(firstChar, []);
402
- }
403
- sortedIndexByFirstChar.get(firstChar).push({ text: primaryText.toLowerCase(), index: i });
601
+ var MDCLineRippleFoundation = /** @class */ (function (_super) {
602
+ __extends(MDCLineRippleFoundation, _super);
603
+ function MDCLineRippleFoundation(adapter) {
604
+ var _this = _super.call(this, exports.__assign(exports.__assign({}, MDCLineRippleFoundation.defaultAdapter), adapter)) || this;
605
+ _this.transitionEndHandler = function (evt) {
606
+ _this.handleTransitionEnd(evt);
607
+ };
608
+ return _this;
404
609
  }
405
- // Sort the mapping
406
- // TODO(b/157162694): Investigate replacing forEach with Map.values()
407
- sortedIndexByFirstChar.forEach(function (values) {
408
- values.sort(function (first, second) {
409
- return first.index - second.index;
410
- });
610
+ Object.defineProperty(MDCLineRippleFoundation, "cssClasses", {
611
+ get: function () {
612
+ return cssClasses$7;
613
+ },
614
+ enumerable: false,
615
+ configurable: true
411
616
  });
412
- return sortedIndexByFirstChar;
413
- }
617
+ Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", {
618
+ /**
619
+ * See {@link MDCLineRippleAdapter} for typing information on parameters and return types.
620
+ */
621
+ get: function () {
622
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
623
+ return {
624
+ addClass: function () { return undefined; },
625
+ removeClass: function () { return undefined; },
626
+ hasClass: function () { return false; },
627
+ setStyle: function () { return undefined; },
628
+ registerEventHandler: function () { return undefined; },
629
+ deregisterEventHandler: function () { return undefined; },
630
+ };
631
+ // tslint:enable:object-literal-sort-keys
632
+ },
633
+ enumerable: false,
634
+ configurable: true
635
+ });
636
+ MDCLineRippleFoundation.prototype.init = function () {
637
+ this.adapter.registerEventHandler('transitionend', this.transitionEndHandler);
638
+ };
639
+ MDCLineRippleFoundation.prototype.destroy = function () {
640
+ this.adapter.deregisterEventHandler('transitionend', this.transitionEndHandler);
641
+ };
642
+ MDCLineRippleFoundation.prototype.activate = function () {
643
+ this.adapter.removeClass(cssClasses$7.LINE_RIPPLE_DEACTIVATING);
644
+ this.adapter.addClass(cssClasses$7.LINE_RIPPLE_ACTIVE);
645
+ };
646
+ MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) {
647
+ this.adapter.setStyle('transform-origin', xCoordinate + "px center");
648
+ };
649
+ MDCLineRippleFoundation.prototype.deactivate = function () {
650
+ this.adapter.addClass(cssClasses$7.LINE_RIPPLE_DEACTIVATING);
651
+ };
652
+ MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) {
653
+ // Wait for the line ripple to be either transparent or opaque
654
+ // before emitting the animation end event
655
+ var isDeactivating = this.adapter.hasClass(cssClasses$7.LINE_RIPPLE_DEACTIVATING);
656
+ if (evt.propertyName === 'opacity') {
657
+ if (isDeactivating) {
658
+ this.adapter.removeClass(cssClasses$7.LINE_RIPPLE_ACTIVE);
659
+ this.adapter.removeClass(cssClasses$7.LINE_RIPPLE_DEACTIVATING);
660
+ }
661
+ }
662
+ };
663
+ return MDCLineRippleFoundation;
664
+ }(MDCFoundation));
665
+
414
666
  /**
415
- * Given the next desired character from the user, it attempts to find the next
416
- * list option matching the buffer. Wraps around if at the end of options.
667
+ * @license
668
+ * Copyright 2018 Google Inc.
417
669
  *
418
- * @param opts Options and accessors
419
- * - nextChar - the next character to match against items
420
- * - sortedIndexByFirstChar - output of `initSortedIndex(...)`
421
- * - focusedItemIndex - the index of the currently focused item
422
- * - focusItemAtIndex - function that focuses a list item at given index
423
- * - skipFocus - whether or not to focus the matched item
424
- * - isItemAtIndexDisabled - function that determines whether an item at a
425
- * given index is disabled
426
- * @param state The typeahead state instance. See `initState`.
670
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
671
+ * of this software and associated documentation files (the "Software"), to deal
672
+ * in the Software without restriction, including without limitation the rights
673
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
674
+ * copies of the Software, and to permit persons to whom the Software is
675
+ * furnished to do so, subject to the following conditions:
427
676
  *
428
- * @return The index of the matched item, or -1 if no match.
677
+ * The above copyright notice and this permission notice shall be included in
678
+ * all copies or substantial portions of the Software.
679
+ *
680
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
681
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
682
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
683
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
684
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
685
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
686
+ * THE SOFTWARE.
429
687
  */
430
- function matchItem(opts, state) {
431
- var nextChar = opts.nextChar, focusItemAtIndex = opts.focusItemAtIndex, sortedIndexByFirstChar = opts.sortedIndexByFirstChar, focusedItemIndex = opts.focusedItemIndex, skipFocus = opts.skipFocus, isItemAtIndexDisabled = opts.isItemAtIndexDisabled;
432
- clearTimeout(state.bufferClearTimeout);
433
- state.bufferClearTimeout = setTimeout(function () {
434
- clearBuffer(state);
435
- }, numbers$2.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS);
436
- state.typeaheadBuffer = state.typeaheadBuffer + nextChar;
437
- var index;
438
- if (state.typeaheadBuffer.length === 1) {
439
- index = matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state);
688
+ var MDCLineRipple = /** @class */ (function (_super) {
689
+ __extends(MDCLineRipple, _super);
690
+ function MDCLineRipple() {
691
+ return _super !== null && _super.apply(this, arguments) || this;
440
692
  }
441
- else {
442
- index = matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state);
693
+ MDCLineRipple.attachTo = function (root) {
694
+ return new MDCLineRipple(root);
695
+ };
696
+ /**
697
+ * Activates the line ripple
698
+ */
699
+ MDCLineRipple.prototype.activate = function () {
700
+ this.foundation.activate();
701
+ };
702
+ /**
703
+ * Deactivates the line ripple
704
+ */
705
+ MDCLineRipple.prototype.deactivate = function () {
706
+ this.foundation.deactivate();
707
+ };
708
+ /**
709
+ * Sets the transform origin given a user's click location.
710
+ * The `rippleCenter` is the x-coordinate of the middle of the ripple.
711
+ */
712
+ MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) {
713
+ this.foundation.setRippleCenter(xCoordinate);
714
+ };
715
+ MDCLineRipple.prototype.getDefaultFoundation = function () {
716
+ var _this = this;
717
+ // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
718
+ // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
719
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
720
+ var adapter = {
721
+ addClass: function (className) { return _this.root.classList.add(className); },
722
+ removeClass: function (className) { return _this.root.classList.remove(className); },
723
+ hasClass: function (className) { return _this.root.classList.contains(className); },
724
+ setStyle: function (propertyName, value) { return _this.root.style.setProperty(propertyName, value); },
725
+ registerEventHandler: function (evtType, handler) { return _this.listen(evtType, handler); },
726
+ deregisterEventHandler: function (evtType, handler) { return _this.unlisten(evtType, handler); },
727
+ };
728
+ // tslint:enable:object-literal-sort-keys
729
+ return new MDCLineRippleFoundation(adapter);
730
+ };
731
+ return MDCLineRipple;
732
+ }(MDCComponent));
733
+
734
+ /**
735
+ * @license
736
+ * Copyright 2018 Google Inc.
737
+ *
738
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
739
+ * of this software and associated documentation files (the "Software"), to deal
740
+ * in the Software without restriction, including without limitation the rights
741
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
742
+ * copies of the Software, and to permit persons to whom the Software is
743
+ * furnished to do so, subject to the following conditions:
744
+ *
745
+ * The above copyright notice and this permission notice shall be included in
746
+ * all copies or substantial portions of the Software.
747
+ *
748
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
749
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
750
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
751
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
752
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
753
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
754
+ * THE SOFTWARE.
755
+ */
756
+ var cssClasses$6 = {
757
+ ANCHOR: 'mdc-menu-surface--anchor',
758
+ ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed',
759
+ ANIMATING_OPEN: 'mdc-menu-surface--animating-open',
760
+ FIXED: 'mdc-menu-surface--fixed',
761
+ IS_OPEN_BELOW: 'mdc-menu-surface--is-open-below',
762
+ OPEN: 'mdc-menu-surface--open',
763
+ ROOT: 'mdc-menu-surface',
764
+ };
765
+ // tslint:disable:object-literal-sort-keys
766
+ var strings$7 = {
767
+ CLOSED_EVENT: 'MDCMenuSurface:closed',
768
+ CLOSING_EVENT: 'MDCMenuSurface:closing',
769
+ OPENED_EVENT: 'MDCMenuSurface:opened',
770
+ OPENING_EVENT: 'MDCMenuSurface:opening',
771
+ FOCUSABLE_ELEMENTS: [
772
+ 'button:not(:disabled)',
773
+ '[href]:not([aria-disabled="true"])',
774
+ 'input:not(:disabled)',
775
+ 'select:not(:disabled)',
776
+ 'textarea:not(:disabled)',
777
+ '[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])',
778
+ ].join(', '),
779
+ };
780
+ // tslint:enable:object-literal-sort-keys
781
+ var numbers$5 = {
782
+ /** Total duration of menu-surface open animation. */
783
+ TRANSITION_OPEN_DURATION: 120,
784
+ /** Total duration of menu-surface close animation. */
785
+ TRANSITION_CLOSE_DURATION: 75,
786
+ /**
787
+ * Margin left to the edge of the viewport when menu-surface is at maximum
788
+ * possible height. Also used as a viewport margin.
789
+ */
790
+ MARGIN_TO_EDGE: 32,
791
+ /**
792
+ * Ratio of anchor width to menu-surface width for switching from corner
793
+ * positioning to center positioning.
794
+ */
795
+ ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67,
796
+ /**
797
+ * Amount of time to wait before restoring focus when closing the menu
798
+ * surface. This is important because if a touch event triggered the menu
799
+ * close, and the subsequent mouse event occurs after focus is restored, then
800
+ * the restored focus would be lost.
801
+ */
802
+ TOUCH_EVENT_WAIT_MS: 30,
803
+ };
804
+ /**
805
+ * Enum for bits in the {@see Corner) bitmap.
806
+ */
807
+ var CornerBit;
808
+ (function (CornerBit) {
809
+ CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
810
+ CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
811
+ CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
812
+ CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
813
+ })(CornerBit || (CornerBit = {}));
814
+ /**
815
+ * Enum for representing an element corner for positioning the menu-surface.
816
+ *
817
+ * The START constants map to LEFT if element directionality is left
818
+ * to right and RIGHT if the directionality is right to left.
819
+ * Likewise END maps to RIGHT or LEFT depending on the directionality.
820
+ */
821
+ var Corner;
822
+ (function (Corner) {
823
+ Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
824
+ Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
825
+ Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
826
+ Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
827
+ Corner[Corner["TOP_START"] = 8] = "TOP_START";
828
+ Corner[Corner["TOP_END"] = 12] = "TOP_END";
829
+ Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
830
+ Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
831
+ })(Corner || (Corner = {}));
832
+
833
+ /**
834
+ * @license
835
+ * Copyright 2018 Google Inc.
836
+ *
837
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
838
+ * of this software and associated documentation files (the "Software"), to deal
839
+ * in the Software without restriction, including without limitation the rights
840
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
841
+ * copies of the Software, and to permit persons to whom the Software is
842
+ * furnished to do so, subject to the following conditions:
843
+ *
844
+ * The above copyright notice and this permission notice shall be included in
845
+ * all copies or substantial portions of the Software.
846
+ *
847
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
848
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
849
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
850
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
851
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
852
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
853
+ * THE SOFTWARE.
854
+ */
855
+ var _a, _b;
856
+ var cssClasses$5 = {
857
+ LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated',
858
+ LIST_ITEM_CLASS: 'mdc-list-item',
859
+ LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled',
860
+ LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected',
861
+ LIST_ITEM_TEXT_CLASS: 'mdc-list-item__text',
862
+ LIST_ITEM_PRIMARY_TEXT_CLASS: 'mdc-list-item__primary-text',
863
+ ROOT: 'mdc-list',
864
+ };
865
+ var evolutionClassNameMap = (_a = {},
866
+ _a["" + cssClasses$5.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-list-item--activated',
867
+ _a["" + cssClasses$5.LIST_ITEM_CLASS] = 'mdc-list-item',
868
+ _a["" + cssClasses$5.LIST_ITEM_DISABLED_CLASS] = 'mdc-list-item--disabled',
869
+ _a["" + cssClasses$5.LIST_ITEM_SELECTED_CLASS] = 'mdc-list-item--selected',
870
+ _a["" + cssClasses$5.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-list-item__primary-text',
871
+ _a["" + cssClasses$5.ROOT] = 'mdc-list',
872
+ _a);
873
+ var deprecatedClassNameMap = (_b = {},
874
+ _b["" + cssClasses$5.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-deprecated-list-item--activated',
875
+ _b["" + cssClasses$5.LIST_ITEM_CLASS] = 'mdc-deprecated-list-item',
876
+ _b["" + cssClasses$5.LIST_ITEM_DISABLED_CLASS] = 'mdc-deprecated-list-item--disabled',
877
+ _b["" + cssClasses$5.LIST_ITEM_SELECTED_CLASS] = 'mdc-deprecated-list-item--selected',
878
+ _b["" + cssClasses$5.LIST_ITEM_TEXT_CLASS] = 'mdc-deprecated-list-item__text',
879
+ _b["" + cssClasses$5.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-deprecated-list-item__primary-text',
880
+ _b["" + cssClasses$5.ROOT] = 'mdc-deprecated-list',
881
+ _b);
882
+ var strings$6 = {
883
+ ACTION_EVENT: 'MDCList:action',
884
+ SELECTION_CHANGE_EVENT: 'MDCList:selectionChange',
885
+ ARIA_CHECKED: 'aria-checked',
886
+ ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]',
887
+ ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]',
888
+ ARIA_CURRENT: 'aria-current',
889
+ ARIA_DISABLED: 'aria-disabled',
890
+ ARIA_ORIENTATION: 'aria-orientation',
891
+ ARIA_ORIENTATION_HORIZONTAL: 'horizontal',
892
+ ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]',
893
+ ARIA_SELECTED: 'aria-selected',
894
+ ARIA_INTERACTIVE_ROLES_SELECTOR: '[role="listbox"], [role="menu"]',
895
+ ARIA_MULTI_SELECTABLE_SELECTOR: '[aria-multiselectable="true"]',
896
+ CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"], input[type="radio"]',
897
+ CHECKBOX_SELECTOR: 'input[type="checkbox"]',
898
+ CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses$5.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses$5.LIST_ITEM_CLASS + " a,\n ." + deprecatedClassNameMap[cssClasses$5.LIST_ITEM_CLASS] + " button:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$5.LIST_ITEM_CLASS] + " a\n ",
899
+ DEPRECATED_SELECTOR: '.mdc-deprecated-list',
900
+ FOCUSABLE_CHILD_ELEMENTS: "\n ." + cssClasses$5.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses$5.LIST_ITEM_CLASS + " a,\n ." + cssClasses$5.LIST_ITEM_CLASS + " input[type=\"radio\"]:not(:disabled),\n ." + cssClasses$5.LIST_ITEM_CLASS + " input[type=\"checkbox\"]:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$5.LIST_ITEM_CLASS] + " button:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$5.LIST_ITEM_CLASS] + " a,\n ." + deprecatedClassNameMap[cssClasses$5.LIST_ITEM_CLASS] + " input[type=\"radio\"]:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$5.LIST_ITEM_CLASS] + " input[type=\"checkbox\"]:not(:disabled)\n ",
901
+ RADIO_SELECTOR: 'input[type="radio"]',
902
+ SELECTED_ITEM_SELECTOR: '[aria-selected="true"], [aria-current="true"]',
903
+ };
904
+ var numbers$4 = {
905
+ UNSET_INDEX: -1,
906
+ TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS: 300
907
+ };
908
+ var evolutionAttribute = 'evolution';
909
+
910
+ /**
911
+ * @license
912
+ * Copyright 2020 Google Inc.
913
+ *
914
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
915
+ * of this software and associated documentation files (the "Software"), to deal
916
+ * in the Software without restriction, including without limitation the rights
917
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
918
+ * copies of the Software, and to permit persons to whom the Software is
919
+ * furnished to do so, subject to the following conditions:
920
+ *
921
+ * The above copyright notice and this permission notice shall be included in
922
+ * all copies or substantial portions of the Software.
923
+ *
924
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
925
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
926
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
927
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
928
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
929
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
930
+ * THE SOFTWARE.
931
+ */
932
+ /**
933
+ * KEY provides normalized string values for keys.
934
+ */
935
+ var KEY = {
936
+ UNKNOWN: 'Unknown',
937
+ BACKSPACE: 'Backspace',
938
+ ENTER: 'Enter',
939
+ SPACEBAR: 'Spacebar',
940
+ PAGE_UP: 'PageUp',
941
+ PAGE_DOWN: 'PageDown',
942
+ END: 'End',
943
+ HOME: 'Home',
944
+ ARROW_LEFT: 'ArrowLeft',
945
+ ARROW_UP: 'ArrowUp',
946
+ ARROW_RIGHT: 'ArrowRight',
947
+ ARROW_DOWN: 'ArrowDown',
948
+ DELETE: 'Delete',
949
+ ESCAPE: 'Escape',
950
+ TAB: 'Tab',
951
+ };
952
+ var normalizedKeys = new Set();
953
+ // IE11 has no support for new Map with iterable so we need to initialize this
954
+ // by hand.
955
+ normalizedKeys.add(KEY.BACKSPACE);
956
+ normalizedKeys.add(KEY.ENTER);
957
+ normalizedKeys.add(KEY.SPACEBAR);
958
+ normalizedKeys.add(KEY.PAGE_UP);
959
+ normalizedKeys.add(KEY.PAGE_DOWN);
960
+ normalizedKeys.add(KEY.END);
961
+ normalizedKeys.add(KEY.HOME);
962
+ normalizedKeys.add(KEY.ARROW_LEFT);
963
+ normalizedKeys.add(KEY.ARROW_UP);
964
+ normalizedKeys.add(KEY.ARROW_RIGHT);
965
+ normalizedKeys.add(KEY.ARROW_DOWN);
966
+ normalizedKeys.add(KEY.DELETE);
967
+ normalizedKeys.add(KEY.ESCAPE);
968
+ normalizedKeys.add(KEY.TAB);
969
+ var KEY_CODE = {
970
+ BACKSPACE: 8,
971
+ ENTER: 13,
972
+ SPACEBAR: 32,
973
+ PAGE_UP: 33,
974
+ PAGE_DOWN: 34,
975
+ END: 35,
976
+ HOME: 36,
977
+ ARROW_LEFT: 37,
978
+ ARROW_UP: 38,
979
+ ARROW_RIGHT: 39,
980
+ ARROW_DOWN: 40,
981
+ DELETE: 46,
982
+ ESCAPE: 27,
983
+ TAB: 9,
984
+ };
985
+ var mappedKeyCodes = new Map();
986
+ // IE11 has no support for new Map with iterable so we need to initialize this
987
+ // by hand.
988
+ mappedKeyCodes.set(KEY_CODE.BACKSPACE, KEY.BACKSPACE);
989
+ mappedKeyCodes.set(KEY_CODE.ENTER, KEY.ENTER);
990
+ mappedKeyCodes.set(KEY_CODE.SPACEBAR, KEY.SPACEBAR);
991
+ mappedKeyCodes.set(KEY_CODE.PAGE_UP, KEY.PAGE_UP);
992
+ mappedKeyCodes.set(KEY_CODE.PAGE_DOWN, KEY.PAGE_DOWN);
993
+ mappedKeyCodes.set(KEY_CODE.END, KEY.END);
994
+ mappedKeyCodes.set(KEY_CODE.HOME, KEY.HOME);
995
+ mappedKeyCodes.set(KEY_CODE.ARROW_LEFT, KEY.ARROW_LEFT);
996
+ mappedKeyCodes.set(KEY_CODE.ARROW_UP, KEY.ARROW_UP);
997
+ mappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, KEY.ARROW_RIGHT);
998
+ mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, KEY.ARROW_DOWN);
999
+ mappedKeyCodes.set(KEY_CODE.DELETE, KEY.DELETE);
1000
+ mappedKeyCodes.set(KEY_CODE.ESCAPE, KEY.ESCAPE);
1001
+ mappedKeyCodes.set(KEY_CODE.TAB, KEY.TAB);
1002
+ var navigationKeys = new Set();
1003
+ // IE11 has no support for new Set with iterable so we need to initialize this
1004
+ // by hand.
1005
+ navigationKeys.add(KEY.PAGE_UP);
1006
+ navigationKeys.add(KEY.PAGE_DOWN);
1007
+ navigationKeys.add(KEY.END);
1008
+ navigationKeys.add(KEY.HOME);
1009
+ navigationKeys.add(KEY.ARROW_LEFT);
1010
+ navigationKeys.add(KEY.ARROW_UP);
1011
+ navigationKeys.add(KEY.ARROW_RIGHT);
1012
+ navigationKeys.add(KEY.ARROW_DOWN);
1013
+ /**
1014
+ * normalizeKey returns the normalized string for a navigational action.
1015
+ */
1016
+ function normalizeKey(evt) {
1017
+ var key = evt.key;
1018
+ // If the event already has a normalized key, return it
1019
+ if (normalizedKeys.has(key)) {
1020
+ return key;
1021
+ }
1022
+ // tslint:disable-next-line:deprecation
1023
+ var mappedKey = mappedKeyCodes.get(evt.keyCode);
1024
+ if (mappedKey) {
1025
+ return mappedKey;
1026
+ }
1027
+ return KEY.UNKNOWN;
1028
+ }
1029
+
1030
+ /**
1031
+ * @license
1032
+ * Copyright 2020 Google Inc.
1033
+ *
1034
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
1035
+ * of this software and associated documentation files (the "Software"), to deal
1036
+ * in the Software without restriction, including without limitation the rights
1037
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1038
+ * copies of the Software, and to permit persons to whom the Software is
1039
+ * furnished to do so, subject to the following conditions:
1040
+ *
1041
+ * The above copyright notice and this permission notice shall be included in
1042
+ * all copies or substantial portions of the Software.
1043
+ *
1044
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1045
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1046
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1047
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1048
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1049
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1050
+ * THE SOFTWARE.
1051
+ */
1052
+ var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];
1053
+ /**
1054
+ * Ensures that preventDefault is only called if the containing element
1055
+ * doesn't consume the event, and it will cause an unintended scroll.
1056
+ *
1057
+ * @param evt keyboard event to be prevented.
1058
+ */
1059
+ var preventDefaultEvent = function (evt) {
1060
+ var target = evt.target;
1061
+ if (!target) {
1062
+ return;
1063
+ }
1064
+ var tagName = ("" + target.tagName).toLowerCase();
1065
+ if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {
1066
+ evt.preventDefault();
1067
+ }
1068
+ };
1069
+
1070
+ /**
1071
+ * @license
1072
+ * Copyright 2020 Google Inc.
1073
+ *
1074
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
1075
+ * of this software and associated documentation files (the "Software"), to deal
1076
+ * in the Software without restriction, including without limitation the rights
1077
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1078
+ * copies of the Software, and to permit persons to whom the Software is
1079
+ * furnished to do so, subject to the following conditions:
1080
+ *
1081
+ * The above copyright notice and this permission notice shall be included in
1082
+ * all copies or substantial portions of the Software.
1083
+ *
1084
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1085
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1086
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1087
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1088
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1089
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1090
+ * THE SOFTWARE.
1091
+ */
1092
+ /**
1093
+ * Initializes a state object for typeahead. Use the same reference for calls to
1094
+ * typeahead functions.
1095
+ *
1096
+ * @return The current state of the typeahead process. Each state reference
1097
+ * represents a typeahead instance as the reference is typically mutated
1098
+ * in-place.
1099
+ */
1100
+ function initState() {
1101
+ var state = {
1102
+ bufferClearTimeout: 0,
1103
+ currentFirstChar: '',
1104
+ sortedIndexCursor: 0,
1105
+ typeaheadBuffer: '',
1106
+ };
1107
+ return state;
1108
+ }
1109
+ /**
1110
+ * Initializes typeahead state by indexing the current list items by primary
1111
+ * text into the sortedIndexByFirstChar data structure.
1112
+ *
1113
+ * @param listItemCount numer of items in the list
1114
+ * @param getPrimaryTextByItemIndex function that returns the primary text at a
1115
+ * given index
1116
+ *
1117
+ * @return Map that maps the first character of the primary text to the full
1118
+ * list text and it's index
1119
+ */
1120
+ function initSortedIndex(listItemCount, getPrimaryTextByItemIndex) {
1121
+ var sortedIndexByFirstChar = new Map();
1122
+ // Aggregate item text to index mapping
1123
+ for (var i = 0; i < listItemCount; i++) {
1124
+ var primaryText = getPrimaryTextByItemIndex(i).trim();
1125
+ if (!primaryText) {
1126
+ continue;
1127
+ }
1128
+ var firstChar = primaryText[0].toLowerCase();
1129
+ if (!sortedIndexByFirstChar.has(firstChar)) {
1130
+ sortedIndexByFirstChar.set(firstChar, []);
1131
+ }
1132
+ sortedIndexByFirstChar.get(firstChar).push({ text: primaryText.toLowerCase(), index: i });
1133
+ }
1134
+ // Sort the mapping
1135
+ // TODO(b/157162694): Investigate replacing forEach with Map.values()
1136
+ sortedIndexByFirstChar.forEach(function (values) {
1137
+ values.sort(function (first, second) {
1138
+ return first.index - second.index;
1139
+ });
1140
+ });
1141
+ return sortedIndexByFirstChar;
1142
+ }
1143
+ /**
1144
+ * Given the next desired character from the user, it attempts to find the next
1145
+ * list option matching the buffer. Wraps around if at the end of options.
1146
+ *
1147
+ * @param opts Options and accessors
1148
+ * - nextChar - the next character to match against items
1149
+ * - sortedIndexByFirstChar - output of `initSortedIndex(...)`
1150
+ * - focusedItemIndex - the index of the currently focused item
1151
+ * - focusItemAtIndex - function that focuses a list item at given index
1152
+ * - skipFocus - whether or not to focus the matched item
1153
+ * - isItemAtIndexDisabled - function that determines whether an item at a
1154
+ * given index is disabled
1155
+ * @param state The typeahead state instance. See `initState`.
1156
+ *
1157
+ * @return The index of the matched item, or -1 if no match.
1158
+ */
1159
+ function matchItem(opts, state) {
1160
+ var nextChar = opts.nextChar, focusItemAtIndex = opts.focusItemAtIndex, sortedIndexByFirstChar = opts.sortedIndexByFirstChar, focusedItemIndex = opts.focusedItemIndex, skipFocus = opts.skipFocus, isItemAtIndexDisabled = opts.isItemAtIndexDisabled;
1161
+ clearTimeout(state.bufferClearTimeout);
1162
+ state.bufferClearTimeout = setTimeout(function () {
1163
+ clearBuffer(state);
1164
+ }, numbers$4.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS);
1165
+ state.typeaheadBuffer = state.typeaheadBuffer + nextChar;
1166
+ var index;
1167
+ if (state.typeaheadBuffer.length === 1) {
1168
+ index = matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state);
1169
+ }
1170
+ else {
1171
+ index = matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state);
443
1172
  }
444
1173
  if (index !== -1 && !skipFocus) {
445
1174
  focusItemAtIndex(index);
@@ -655,15 +1384,15 @@ function createModifierChecker(event) {
655
1384
  };
656
1385
  }
657
1386
  var MDCListFoundation = /** @class */ (function (_super) {
658
- component.__extends(MDCListFoundation, _super);
1387
+ __extends(MDCListFoundation, _super);
659
1388
  function MDCListFoundation(adapter) {
660
- var _this = _super.call(this, component.__assign(component.__assign({}, MDCListFoundation.defaultAdapter), adapter)) || this;
1389
+ var _this = _super.call(this, exports.__assign(exports.__assign({}, MDCListFoundation.defaultAdapter), adapter)) || this;
661
1390
  _this.wrapFocus = false;
662
1391
  _this.isVertical = true;
663
1392
  _this.isSingleSelectionList = false;
664
1393
  _this.areDisabledItemsFocusable = true;
665
- _this.selectedIndex = numbers$2.UNSET_INDEX;
666
- _this.focusedItemIndex = numbers$2.UNSET_INDEX;
1394
+ _this.selectedIndex = numbers$4.UNSET_INDEX;
1395
+ _this.focusedItemIndex = numbers$4.UNSET_INDEX;
667
1396
  _this.useActivatedClass = false;
668
1397
  _this.useSelectedAttr = false;
669
1398
  _this.ariaCurrentAttrValue = null;
@@ -678,21 +1407,21 @@ var MDCListFoundation = /** @class */ (function (_super) {
678
1407
  }
679
1408
  Object.defineProperty(MDCListFoundation, "strings", {
680
1409
  get: function () {
681
- return strings$4;
1410
+ return strings$6;
682
1411
  },
683
1412
  enumerable: false,
684
1413
  configurable: true
685
1414
  });
686
1415
  Object.defineProperty(MDCListFoundation, "cssClasses", {
687
1416
  get: function () {
688
- return cssClasses$3;
1417
+ return cssClasses$5;
689
1418
  },
690
1419
  enumerable: false,
691
1420
  configurable: true
692
1421
  });
693
1422
  Object.defineProperty(MDCListFoundation, "numbers", {
694
1423
  get: function () {
695
- return numbers$2;
1424
+ return numbers$4;
696
1425
  },
697
1426
  enumerable: false,
698
1427
  configurable: true
@@ -773,9 +1502,9 @@ var MDCListFoundation = /** @class */ (function (_super) {
773
1502
  */
774
1503
  MDCListFoundation.prototype.maybeInitializeSingleSelection = function () {
775
1504
  var selectedItemIndex = this.getSelectedIndexFromDOM();
776
- if (selectedItemIndex === numbers$2.UNSET_INDEX)
1505
+ if (selectedItemIndex === numbers$4.UNSET_INDEX)
777
1506
  return;
778
- var hasActivatedClass = this.adapter.listItemAtIndexHasClass(selectedItemIndex, cssClasses$3.LIST_ITEM_ACTIVATED_CLASS);
1507
+ var hasActivatedClass = this.adapter.listItemAtIndexHasClass(selectedItemIndex, cssClasses$5.LIST_ITEM_ACTIVATED_CLASS);
779
1508
  if (hasActivatedClass) {
780
1509
  this.setUseActivatedClass(true);
781
1510
  }
@@ -784,11 +1513,11 @@ var MDCListFoundation = /** @class */ (function (_super) {
784
1513
  };
785
1514
  /** @return Index of the first selected item based on the DOM state. */
786
1515
  MDCListFoundation.prototype.getSelectedIndexFromDOM = function () {
787
- var selectedIndex = numbers$2.UNSET_INDEX;
1516
+ var selectedIndex = numbers$4.UNSET_INDEX;
788
1517
  var listItemsCount = this.adapter.getListItemCount();
789
1518
  for (var i = 0; i < listItemsCount; i++) {
790
- var hasSelectedClass = this.adapter.listItemAtIndexHasClass(i, cssClasses$3.LIST_ITEM_SELECTED_CLASS);
791
- var hasActivatedClass = this.adapter.listItemAtIndexHasClass(i, cssClasses$3.LIST_ITEM_ACTIVATED_CLASS);
1519
+ var hasSelectedClass = this.adapter.listItemAtIndexHasClass(i, cssClasses$5.LIST_ITEM_SELECTED_CLASS);
1520
+ var hasActivatedClass = this.adapter.listItemAtIndexHasClass(i, cssClasses$5.LIST_ITEM_ACTIVATED_CLASS);
792
1521
  if (!(hasSelectedClass || hasActivatedClass)) {
793
1522
  continue;
794
1523
  }
@@ -873,7 +1602,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
873
1602
  }, 0);
874
1603
  };
875
1604
  MDCListFoundation.prototype.isIndexDisabled = function (index) {
876
- return this.adapter.listItemAtIndexHasClass(index, cssClasses$3.LIST_ITEM_DISABLED_CLASS);
1605
+ return this.adapter.listItemAtIndexHasClass(index, cssClasses$5.LIST_ITEM_DISABLED_CLASS);
877
1606
  };
878
1607
  /**
879
1608
  * Key handler for the list.
@@ -993,7 +1722,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
993
1722
  }
994
1723
  else if (isLetterA && eventHasModifiers(['Control']) && this.isCheckboxList) {
995
1724
  event.preventDefault();
996
- this.checkboxListToggleAll(this.selectedIndex === numbers$2.UNSET_INDEX ?
1725
+ this.checkboxListToggleAll(this.selectedIndex === numbers$4.UNSET_INDEX ?
997
1726
  [] :
998
1727
  this.selectedIndex, true);
999
1728
  }
@@ -1059,7 +1788,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
1059
1788
  MDCListFoundation.prototype.handleClick = function (index, isCheckboxAlreadyUpdatedInAdapter, event) {
1060
1789
  var _a;
1061
1790
  var eventHasModifiers = createModifierChecker(event);
1062
- if (index === numbers$2.UNSET_INDEX) {
1791
+ if (index === numbers$4.UNSET_INDEX) {
1063
1792
  return;
1064
1793
  }
1065
1794
  if (this.isIndexDisabled(index)) {
@@ -1152,12 +1881,12 @@ var MDCListFoundation = /** @class */ (function (_super) {
1152
1881
  return;
1153
1882
  }
1154
1883
  if (isEnabled) {
1155
- this.adapter.removeClassForElementIndex(itemIndex, cssClasses$3.LIST_ITEM_DISABLED_CLASS);
1156
- this.adapter.setAttributeForElementIndex(itemIndex, strings$4.ARIA_DISABLED, 'false');
1884
+ this.adapter.removeClassForElementIndex(itemIndex, cssClasses$5.LIST_ITEM_DISABLED_CLASS);
1885
+ this.adapter.setAttributeForElementIndex(itemIndex, strings$6.ARIA_DISABLED, 'false');
1157
1886
  }
1158
1887
  else {
1159
- this.adapter.addClassForElementIndex(itemIndex, cssClasses$3.LIST_ITEM_DISABLED_CLASS);
1160
- this.adapter.setAttributeForElementIndex(itemIndex, strings$4.ARIA_DISABLED, 'true');
1888
+ this.adapter.addClassForElementIndex(itemIndex, cssClasses$5.LIST_ITEM_DISABLED_CLASS);
1889
+ this.adapter.setAttributeForElementIndex(itemIndex, strings$6.ARIA_DISABLED, 'true');
1161
1890
  }
1162
1891
  };
1163
1892
  MDCListFoundation.prototype.setSingleSelectionAtIndex = function (index, options) {
@@ -1165,16 +1894,16 @@ var MDCListFoundation = /** @class */ (function (_super) {
1165
1894
  if (this.selectedIndex === index && !options.forceUpdate) {
1166
1895
  return;
1167
1896
  }
1168
- var selectedClassName = cssClasses$3.LIST_ITEM_SELECTED_CLASS;
1897
+ var selectedClassName = cssClasses$5.LIST_ITEM_SELECTED_CLASS;
1169
1898
  if (this.useActivatedClass) {
1170
- selectedClassName = cssClasses$3.LIST_ITEM_ACTIVATED_CLASS;
1899
+ selectedClassName = cssClasses$5.LIST_ITEM_ACTIVATED_CLASS;
1171
1900
  }
1172
- if (this.selectedIndex !== numbers$2.UNSET_INDEX) {
1901
+ if (this.selectedIndex !== numbers$4.UNSET_INDEX) {
1173
1902
  this.adapter.removeClassForElementIndex(this.selectedIndex, selectedClassName);
1174
1903
  }
1175
1904
  this.setAriaForSingleSelectionAtIndex(index);
1176
1905
  this.setTabindexAtIndex(index);
1177
- if (index !== numbers$2.UNSET_INDEX) {
1906
+ if (index !== numbers$4.UNSET_INDEX) {
1178
1907
  this.adapter.addClassForElementIndex(index, selectedClassName);
1179
1908
  }
1180
1909
  this.selectedIndex = index;
@@ -1190,16 +1919,16 @@ var MDCListFoundation = /** @class */ (function (_super) {
1190
1919
  MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex = function (index) {
1191
1920
  // Detect the presence of aria-current and get the value only during list
1192
1921
  // initialization when it is in unset state.
1193
- if (this.selectedIndex === numbers$2.UNSET_INDEX) {
1922
+ if (this.selectedIndex === numbers$4.UNSET_INDEX) {
1194
1923
  this.ariaCurrentAttrValue =
1195
- this.adapter.getAttributeForElementIndex(index, strings$4.ARIA_CURRENT);
1924
+ this.adapter.getAttributeForElementIndex(index, strings$6.ARIA_CURRENT);
1196
1925
  }
1197
1926
  var isAriaCurrent = this.ariaCurrentAttrValue !== null;
1198
- var ariaAttribute = isAriaCurrent ? strings$4.ARIA_CURRENT : strings$4.ARIA_SELECTED;
1199
- if (this.selectedIndex !== numbers$2.UNSET_INDEX) {
1927
+ var ariaAttribute = isAriaCurrent ? strings$6.ARIA_CURRENT : strings$6.ARIA_SELECTED;
1928
+ if (this.selectedIndex !== numbers$4.UNSET_INDEX) {
1200
1929
  this.adapter.setAttributeForElementIndex(this.selectedIndex, ariaAttribute, 'false');
1201
1930
  }
1202
- if (index !== numbers$2.UNSET_INDEX) {
1931
+ if (index !== numbers$4.UNSET_INDEX) {
1203
1932
  var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue : 'true';
1204
1933
  this.adapter.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue);
1205
1934
  }
@@ -1208,7 +1937,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
1208
1937
  * Returns the attribute to use for indicating selection status.
1209
1938
  */
1210
1939
  MDCListFoundation.prototype.getSelectionAttribute = function () {
1211
- return this.useSelectedAttr ? strings$4.ARIA_SELECTED : strings$4.ARIA_CHECKED;
1940
+ return this.useSelectedAttr ? strings$6.ARIA_SELECTED : strings$6.ARIA_CHECKED;
1212
1941
  };
1213
1942
  /**
1214
1943
  * Toggles radio at give index. Radio doesn't change the checked state if it
@@ -1221,7 +1950,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
1221
1950
  if (this.selectedIndex === index && !options.forceUpdate) {
1222
1951
  return;
1223
1952
  }
1224
- if (this.selectedIndex !== numbers$2.UNSET_INDEX) {
1953
+ if (this.selectedIndex !== numbers$4.UNSET_INDEX) {
1225
1954
  this.adapter.setAttributeForElementIndex(this.selectedIndex, selectionAttribute, 'false');
1226
1955
  }
1227
1956
  this.adapter.setAttributeForElementIndex(index, selectionAttribute, 'true');
@@ -1239,7 +1968,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
1239
1968
  // need to know about the currently selected indices and can avoid
1240
1969
  // constructing the `Set` for performance reasons.
1241
1970
  var currentlySelected = options.isUserInteraction ?
1242
- new Set(currentIndex === numbers$2.UNSET_INDEX ? [] :
1971
+ new Set(currentIndex === numbers$4.UNSET_INDEX ? [] :
1243
1972
  currentIndex) :
1244
1973
  null;
1245
1974
  var selectionAttribute = this.getSelectionAttribute();
@@ -1275,11 +2004,11 @@ var MDCListFoundation = /** @class */ (function (_super) {
1275
2004
  */
1276
2005
  MDCListFoundation.prototype.toggleCheckboxRange = function (fromIndex, toIndex, toggleIndex) {
1277
2006
  this.lastSelectedIndex = toggleIndex;
1278
- var currentlySelected = new Set(this.selectedIndex === numbers$2.UNSET_INDEX ?
2007
+ var currentlySelected = new Set(this.selectedIndex === numbers$4.UNSET_INDEX ?
1279
2008
  [] :
1280
2009
  this.selectedIndex);
1281
2010
  var newIsChecked = !(currentlySelected === null || currentlySelected === void 0 ? void 0 : currentlySelected.has(toggleIndex));
1282
- var _a = component.__read([fromIndex, toIndex].sort(), 2), startIndex = _a[0], endIndex = _a[1];
2011
+ var _a = __read([fromIndex, toIndex].sort(), 2), startIndex = _a[0], endIndex = _a[1];
1283
2012
  var selectionAttribute = this.getSelectionAttribute();
1284
2013
  var changedIndices = [];
1285
2014
  for (var i = startIndex; i <= endIndex; i++) {
@@ -1304,12 +2033,12 @@ var MDCListFoundation = /** @class */ (function (_super) {
1304
2033
  // If the selected value has changed, update and notify the selection change
1305
2034
  // to the adapter.
1306
2035
  if (changedIndices.length) {
1307
- this.selectedIndex = component.__spreadArray([], component.__read(currentlySelected));
2036
+ this.selectedIndex = __spreadArray([], __read(currentlySelected));
1308
2037
  this.adapter.notifySelectionChange(changedIndices);
1309
2038
  }
1310
2039
  };
1311
2040
  MDCListFoundation.prototype.setTabindexAtIndex = function (index) {
1312
- if (this.focusedItemIndex === numbers$2.UNSET_INDEX && index !== 0) {
2041
+ if (this.focusedItemIndex === numbers$4.UNSET_INDEX && index !== 0) {
1313
2042
  // If some list item was selected set first list item's tabindex to -1.
1314
2043
  // Generally, tabindex is set to 0 on first list item of list that has no
1315
2044
  // preselected items.
@@ -1325,7 +2054,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
1325
2054
  this.selectedIndex !== index) {
1326
2055
  this.adapter.setAttributeForElementIndex(this.selectedIndex, 'tabindex', '-1');
1327
2056
  }
1328
- if (index !== numbers$2.UNSET_INDEX) {
2057
+ if (index !== numbers$4.UNSET_INDEX) {
1329
2058
  this.adapter.setAttributeForElementIndex(index, 'tabindex', '0');
1330
2059
  }
1331
2060
  };
@@ -1348,7 +2077,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
1348
2077
  }
1349
2078
  // Single-selection lists focus the selected item.
1350
2079
  if (typeof this.selectedIndex === 'number' &&
1351
- this.selectedIndex !== numbers$2.UNSET_INDEX) {
2080
+ this.selectedIndex !== numbers$4.UNSET_INDEX) {
1352
2081
  return this.selectedIndex;
1353
2082
  }
1354
2083
  // Multiple-selection lists focus the first selected item.
@@ -1377,7 +2106,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
1377
2106
  throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: " + index);
1378
2107
  }
1379
2108
  return this.isIndexInRange(index) ||
1380
- this.isSingleSelectionList && index === numbers$2.UNSET_INDEX;
2109
+ this.isSingleSelectionList && index === numbers$4.UNSET_INDEX;
1381
2110
  }
1382
2111
  else {
1383
2112
  return false;
@@ -1425,7 +2154,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
1425
2154
  this.adapter.setAttributeForElementIndex(index, selectionAttribute, newCheckedValue ? 'true' : 'false');
1426
2155
  // If none of the checkbox items are selected and selectedIndex is not
1427
2156
  // initialized then provide a default value.
1428
- var selectedIndexes = this.selectedIndex === numbers$2.UNSET_INDEX ?
2157
+ var selectedIndexes = this.selectedIndex === numbers$4.UNSET_INDEX ?
1429
2158
  [] :
1430
2159
  this.selectedIndex.slice();
1431
2160
  if (newCheckedValue) {
@@ -1502,7 +2231,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
1502
2231
  clearBuffer(this.typeaheadState);
1503
2232
  };
1504
2233
  return MDCListFoundation;
1505
- }(component.MDCFoundation));
2234
+ }(MDCFoundation));
1506
2235
 
1507
2236
  /**
1508
2237
  * @license
@@ -1527,7 +2256,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
1527
2256
  * THE SOFTWARE.
1528
2257
  */
1529
2258
  var MDCList = /** @class */ (function (_super) {
1530
- component.__extends(MDCList, _super);
2259
+ __extends(MDCList, _super);
1531
2260
  function MDCList() {
1532
2261
  return _super !== null && _super.apply(this, arguments) || this;
1533
2262
  }
@@ -1540,7 +2269,7 @@ var MDCList = /** @class */ (function (_super) {
1540
2269
  });
1541
2270
  Object.defineProperty(MDCList.prototype, "listElements", {
1542
2271
  get: function () {
1543
- return Array.from(this.root.querySelectorAll("." + this.classNameMap[cssClasses$3.LIST_ITEM_CLASS]));
2272
+ return Array.from(this.root.querySelectorAll("." + this.classNameMap[cssClasses$5.LIST_ITEM_CLASS]));
1544
2273
  },
1545
2274
  enumerable: false,
1546
2275
  configurable: true
@@ -1606,12 +2335,12 @@ var MDCList = /** @class */ (function (_super) {
1606
2335
  if (this.isEvolutionEnabled) {
1607
2336
  this.classNameMap = evolutionClassNameMap;
1608
2337
  }
1609
- else if (component.matches(this.root, strings$4.DEPRECATED_SELECTOR)) {
2338
+ else if (matches(this.root, strings$6.DEPRECATED_SELECTOR)) {
1610
2339
  this.classNameMap = deprecatedClassNameMap;
1611
2340
  }
1612
2341
  else {
1613
2342
  this.classNameMap =
1614
- Object.values(cssClasses$3)
2343
+ Object.values(cssClasses$5)
1615
2344
  .reduce(function (obj, className) {
1616
2345
  obj[className] = className;
1617
2346
  return obj;
@@ -1636,10 +2365,10 @@ var MDCList = /** @class */ (function (_super) {
1636
2365
  this.unlisten('focusout', this.focusOutEventListener);
1637
2366
  };
1638
2367
  MDCList.prototype.layout = function () {
1639
- var direction = this.root.getAttribute(strings$4.ARIA_ORIENTATION);
1640
- this.vertical = direction !== strings$4.ARIA_ORIENTATION_HORIZONTAL;
1641
- var itemSelector = "." + this.classNameMap[cssClasses$3.LIST_ITEM_CLASS] + ":not([tabindex])";
1642
- var childSelector = strings$4.FOCUSABLE_CHILD_ELEMENTS;
2368
+ var direction = this.root.getAttribute(strings$6.ARIA_ORIENTATION);
2369
+ this.vertical = direction !== strings$6.ARIA_ORIENTATION_HORIZONTAL;
2370
+ var itemSelector = "." + this.classNameMap[cssClasses$5.LIST_ITEM_CLASS] + ":not([tabindex])";
2371
+ var childSelector = strings$6.FOCUSABLE_CHILD_ELEMENTS;
1643
2372
  // List items need to have at least tabindex=-1 to be focusable.
1644
2373
  var itemEls = this.root.querySelectorAll(itemSelector);
1645
2374
  if (itemEls.length) {
@@ -1666,11 +2395,11 @@ var MDCList = /** @class */ (function (_super) {
1666
2395
  */
1667
2396
  MDCList.prototype.getPrimaryText = function (item) {
1668
2397
  var _a;
1669
- var primaryText = item.querySelector("." + this.classNameMap[cssClasses$3.LIST_ITEM_PRIMARY_TEXT_CLASS]);
2398
+ var primaryText = item.querySelector("." + this.classNameMap[cssClasses$5.LIST_ITEM_PRIMARY_TEXT_CLASS]);
1670
2399
  if (this.isEvolutionEnabled || primaryText) {
1671
2400
  return (_a = primaryText === null || primaryText === void 0 ? void 0 : primaryText.textContent) !== null && _a !== void 0 ? _a : '';
1672
2401
  }
1673
- var singleLineText = item.querySelector("." + this.classNameMap[cssClasses$3.LIST_ITEM_TEXT_CLASS]);
2402
+ var singleLineText = item.querySelector("." + this.classNameMap[cssClasses$5.LIST_ITEM_TEXT_CLASS]);
1674
2403
  return (singleLineText && singleLineText.textContent) || '';
1675
2404
  };
1676
2405
  /**
@@ -1679,10 +2408,10 @@ var MDCList = /** @class */ (function (_super) {
1679
2408
  MDCList.prototype.initializeListType = function () {
1680
2409
  var _this = this;
1681
2410
  this.isInteractive =
1682
- component.matches(this.root, strings$4.ARIA_INTERACTIVE_ROLES_SELECTOR);
2411
+ matches(this.root, strings$6.ARIA_INTERACTIVE_ROLES_SELECTOR);
1683
2412
  if (this.isEvolutionEnabled && this.isInteractive) {
1684
- var selection = Array.from(this.root.querySelectorAll(strings$4.SELECTED_ITEM_SELECTOR), function (listItem) { return _this.listElements.indexOf(listItem); });
1685
- if (component.matches(this.root, strings$4.ARIA_MULTI_SELECTABLE_SELECTOR)) {
2413
+ var selection = Array.from(this.root.querySelectorAll(strings$6.SELECTED_ITEM_SELECTOR), function (listItem) { return _this.listElements.indexOf(listItem); });
2414
+ if (matches(this.root, strings$6.ARIA_MULTI_SELECTABLE_SELECTOR)) {
1686
2415
  this.selectedIndex = selection;
1687
2416
  }
1688
2417
  else if (selection.length > 0) {
@@ -1690,10 +2419,10 @@ var MDCList = /** @class */ (function (_super) {
1690
2419
  }
1691
2420
  return;
1692
2421
  }
1693
- var checkboxListItems = this.root.querySelectorAll(strings$4.ARIA_ROLE_CHECKBOX_SELECTOR);
1694
- var radioSelectedListItem = this.root.querySelector(strings$4.ARIA_CHECKED_RADIO_SELECTOR);
2422
+ var checkboxListItems = this.root.querySelectorAll(strings$6.ARIA_ROLE_CHECKBOX_SELECTOR);
2423
+ var radioSelectedListItem = this.root.querySelector(strings$6.ARIA_CHECKED_RADIO_SELECTOR);
1695
2424
  if (checkboxListItems.length) {
1696
- var preselectedItems = this.root.querySelectorAll(strings$4.ARIA_CHECKED_CHECKBOX_SELECTOR);
2425
+ var preselectedItems = this.root.querySelectorAll(strings$6.ARIA_CHECKED_CHECKBOX_SELECTOR);
1697
2426
  this.selectedIndex = Array.from(preselectedItems, function (listItem) { return _this.listElements.indexOf(listItem); });
1698
2427
  }
1699
2428
  else if (radioSelectedListItem) {
@@ -1751,15 +2480,15 @@ var MDCList = /** @class */ (function (_super) {
1751
2480
  },
1752
2481
  hasCheckboxAtIndex: function (index) {
1753
2482
  var listItem = _this.listElements[index];
1754
- return !!listItem.querySelector(strings$4.CHECKBOX_SELECTOR);
2483
+ return !!listItem.querySelector(strings$6.CHECKBOX_SELECTOR);
1755
2484
  },
1756
2485
  hasRadioAtIndex: function (index) {
1757
2486
  var listItem = _this.listElements[index];
1758
- return !!listItem.querySelector(strings$4.RADIO_SELECTOR);
2487
+ return !!listItem.querySelector(strings$6.RADIO_SELECTOR);
1759
2488
  },
1760
2489
  isCheckboxCheckedAtIndex: function (index) {
1761
2490
  var listItem = _this.listElements[index];
1762
- var toggleEl = listItem.querySelector(strings$4.CHECKBOX_SELECTOR);
2491
+ var toggleEl = listItem.querySelector(strings$6.CHECKBOX_SELECTOR);
1763
2492
  return toggleEl.checked;
1764
2493
  },
1765
2494
  isFocusInsideList: function () {
@@ -1771,10 +2500,10 @@ var MDCList = /** @class */ (function (_super) {
1771
2500
  return _this.listElements[index].classList.contains(_this.classNameMap[className]);
1772
2501
  },
1773
2502
  notifyAction: function (index) {
1774
- _this.emit(strings$4.ACTION_EVENT, { index: index }, /** shouldBubble */ true);
2503
+ _this.emit(strings$6.ACTION_EVENT, { index: index }, /** shouldBubble */ true);
1775
2504
  },
1776
2505
  notifySelectionChange: function (changedIndices) {
1777
- _this.emit(strings$4.SELECTION_CHANGE_EVENT, { changedIndices: changedIndices }, /** shouldBubble */ true);
2506
+ _this.emit(strings$6.SELECTION_CHANGE_EVENT, { changedIndices: changedIndices }, /** shouldBubble */ true);
1778
2507
  },
1779
2508
  removeClassForElementIndex: function (index, className) {
1780
2509
  var element = _this.listElements[index];
@@ -1790,7 +2519,7 @@ var MDCList = /** @class */ (function (_super) {
1790
2519
  },
1791
2520
  setCheckedCheckboxOrRadioAtIndex: function (index, isChecked) {
1792
2521
  var listItem = _this.listElements[index];
1793
- var toggleEl = listItem.querySelector(strings$4.CHECKBOX_RADIO_SELECTOR);
2522
+ var toggleEl = listItem.querySelector(strings$6.CHECKBOX_RADIO_SELECTOR);
1794
2523
  toggleEl.checked = isChecked;
1795
2524
  var event = document.createEvent('Event');
1796
2525
  event.initEvent('change', true, true);
@@ -1798,7 +2527,7 @@ var MDCList = /** @class */ (function (_super) {
1798
2527
  },
1799
2528
  setTabIndexForListItemChildren: function (listItemIndex, tabIndexValue) {
1800
2529
  var element = _this.listElements[listItemIndex];
1801
- var selector = strings$4.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX;
2530
+ var selector = strings$6.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX;
1802
2531
  Array.prototype.forEach.call(element.querySelectorAll(selector), function (el) {
1803
2532
  el.setAttribute('tabindex', tabIndexValue);
1804
2533
  });
@@ -1812,7 +2541,7 @@ var MDCList = /** @class */ (function (_super) {
1812
2541
  */
1813
2542
  MDCList.prototype.ensureFocusable = function () {
1814
2543
  if (this.isEvolutionEnabled && this.isInteractive) {
1815
- if (!this.root.querySelector("." + this.classNameMap[cssClasses$3.LIST_ITEM_CLASS] + "[tabindex=\"0\"]")) {
2544
+ if (!this.root.querySelector("." + this.classNameMap[cssClasses$5.LIST_ITEM_CLASS] + "[tabindex=\"0\"]")) {
1816
2545
  var index = this.initialFocusIndex();
1817
2546
  if (index !== -1) {
1818
2547
  this.listElements[index].tabIndex = 0;
@@ -1825,10 +2554,10 @@ var MDCList = /** @class */ (function (_super) {
1825
2554
  return this.selectedIndex[0];
1826
2555
  }
1827
2556
  if (typeof this.selectedIndex === 'number' &&
1828
- this.selectedIndex !== numbers$2.UNSET_INDEX) {
2557
+ this.selectedIndex !== numbers$4.UNSET_INDEX) {
1829
2558
  return this.selectedIndex;
1830
2559
  }
1831
- var el = this.root.querySelector("." + this.classNameMap[cssClasses$3.LIST_ITEM_CLASS] + ":not(." + this.classNameMap[cssClasses$3.LIST_ITEM_DISABLED_CLASS] + ")");
2560
+ var el = this.root.querySelector("." + this.classNameMap[cssClasses$5.LIST_ITEM_CLASS] + ":not(." + this.classNameMap[cssClasses$5.LIST_ITEM_DISABLED_CLASS] + ")");
1832
2561
  if (el === null) {
1833
2562
  return -1;
1834
2563
  }
@@ -1839,10 +2568,10 @@ var MDCList = /** @class */ (function (_super) {
1839
2568
  * if there is no list item
1840
2569
  */
1841
2570
  MDCList.prototype.getListItemIndex = function (el) {
1842
- var nearestParent = component.closest(el, "." + this.classNameMap[cssClasses$3.LIST_ITEM_CLASS] + ", ." + this.classNameMap[cssClasses$3.ROOT]);
2571
+ var nearestParent = closest(el, "." + this.classNameMap[cssClasses$5.LIST_ITEM_CLASS] + ", ." + this.classNameMap[cssClasses$5.ROOT]);
1843
2572
  // Get the index of the element if it is a list item.
1844
2573
  if (nearestParent &&
1845
- component.matches(nearestParent, "." + this.classNameMap[cssClasses$3.LIST_ITEM_CLASS])) {
2574
+ matches(nearestParent, "." + this.classNameMap[cssClasses$5.LIST_ITEM_CLASS])) {
1846
2575
  return this.listElements.indexOf(nearestParent);
1847
2576
  }
1848
2577
  return -1;
@@ -1870,7 +2599,7 @@ var MDCList = /** @class */ (function (_super) {
1870
2599
  MDCList.prototype.handleKeydownEvent = function (evt) {
1871
2600
  var index = this.getListItemIndex(evt.target);
1872
2601
  var target = evt.target;
1873
- this.foundation.handleKeydown(evt, target.classList.contains(this.classNameMap[cssClasses$3.LIST_ITEM_CLASS]), index);
2602
+ this.foundation.handleKeydown(evt, target.classList.contains(this.classNameMap[cssClasses$5.LIST_ITEM_CLASS]), index);
1874
2603
  };
1875
2604
  /**
1876
2605
  * Used to figure out which element was clicked before sending the event to
@@ -1881,11 +2610,11 @@ var MDCList = /** @class */ (function (_super) {
1881
2610
  var target = evt.target;
1882
2611
  // Toggle the checkbox only if it's not the target of the event, or the
1883
2612
  // checkbox will have 2 change events.
1884
- var toggleCheckbox = !component.matches(target, strings$4.CHECKBOX_RADIO_SELECTOR);
2613
+ var toggleCheckbox = !matches(target, strings$6.CHECKBOX_RADIO_SELECTOR);
1885
2614
  this.foundation.handleClick(index, toggleCheckbox, evt);
1886
2615
  };
1887
2616
  return MDCList;
1888
- }(component.MDCComponent));
2617
+ }(MDCComponent));
1889
2618
 
1890
2619
  /**
1891
2620
  * @license
@@ -1910,9 +2639,9 @@ var MDCList = /** @class */ (function (_super) {
1910
2639
  * THE SOFTWARE.
1911
2640
  */
1912
2641
  var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
1913
- component.__extends(MDCMenuSurfaceFoundation, _super);
2642
+ __extends(MDCMenuSurfaceFoundation, _super);
1914
2643
  function MDCMenuSurfaceFoundation(adapter) {
1915
- var _this = _super.call(this, component.__assign(component.__assign({}, MDCMenuSurfaceFoundation.defaultAdapter), adapter)) || this;
2644
+ var _this = _super.call(this, exports.__assign(exports.__assign({}, MDCMenuSurfaceFoundation.defaultAdapter), adapter)) || this;
1916
2645
  _this.isSurfaceOpen = false;
1917
2646
  _this.isQuickOpen = false;
1918
2647
  _this.isHoistedElement = false;
@@ -1945,21 +2674,21 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
1945
2674
  }
1946
2675
  Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", {
1947
2676
  get: function () {
1948
- return cssClasses$4;
2677
+ return cssClasses$6;
1949
2678
  },
1950
2679
  enumerable: false,
1951
2680
  configurable: true
1952
2681
  });
1953
2682
  Object.defineProperty(MDCMenuSurfaceFoundation, "strings", {
1954
2683
  get: function () {
1955
- return strings$5;
2684
+ return strings$7;
1956
2685
  },
1957
2686
  enumerable: false,
1958
2687
  configurable: true
1959
2688
  });
1960
2689
  Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", {
1961
2690
  get: function () {
1962
- return numbers$3;
2691
+ return numbers$5;
1963
2692
  },
1964
2693
  enumerable: false,
1965
2694
  configurable: true
@@ -2117,7 +2846,7 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
2117
2846
  _this.openAnimationEndTimerId = 0;
2118
2847
  _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
2119
2848
  _this.adapter.notifyOpen();
2120
- }, numbers$3.TRANSITION_OPEN_DURATION);
2849
+ }, numbers$5.TRANSITION_OPEN_DURATION);
2121
2850
  });
2122
2851
  this.isSurfaceOpen = true;
2123
2852
  }
@@ -2150,7 +2879,7 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
2150
2879
  _this.closeAnimationEndTimerId = 0;
2151
2880
  _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
2152
2881
  _this.adapter.notifyClose();
2153
- }, numbers$3.TRANSITION_CLOSE_DURATION);
2882
+ }, numbers$5.TRANSITION_CLOSE_DURATION);
2154
2883
  });
2155
2884
  this.isSurfaceOpen = false;
2156
2885
  if (!skipRestoreFocus) {
@@ -2191,7 +2920,7 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
2191
2920
  // Center align when anchor width is comparable or greater than menu
2192
2921
  // surface, otherwise keep corner.
2193
2922
  if (anchorSize.width / surfaceSize.width >
2194
- numbers$3.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
2923
+ numbers$5.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
2195
2924
  horizontalAlignment = 'center';
2196
2925
  }
2197
2926
  // If the menu-surface has been hoisted to the body, it's no longer relative
@@ -2406,7 +3135,7 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
2406
3135
  var _b = this.measurements, windowScroll = _b.windowScroll, viewportDistance = _b.viewportDistance, surfaceSize = _b.surfaceSize, viewportSize = _b.viewportSize;
2407
3136
  var props = Object.keys(position);
2408
3137
  try {
2409
- for (var props_1 = component.__values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
3138
+ for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
2410
3139
  var prop = props_1_1.value;
2411
3140
  var value = position[prop] || 0;
2412
3141
  if (this.isHorizontallyCenteredOnViewport &&
@@ -2464,7 +3193,7 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
2464
3193
  // restored focus would be lost.
2465
3194
  setTimeout(function () {
2466
3195
  _this.adapter.restoreFocus();
2467
- }, numbers$3.TOUCH_EVENT_WAIT_MS);
3196
+ }, numbers$5.TOUCH_EVENT_WAIT_MS);
2468
3197
  }
2469
3198
  };
2470
3199
  MDCMenuSurfaceFoundation.prototype.hasBit = function (corner, bit) {
@@ -2484,7 +3213,87 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
2484
3213
  return typeof num === 'number' && isFinite(num);
2485
3214
  };
2486
3215
  return MDCMenuSurfaceFoundation;
2487
- }(component.MDCFoundation));
3216
+ }(MDCFoundation));
3217
+
3218
+ /**
3219
+ * @license
3220
+ * Copyright 2016 Google Inc.
3221
+ *
3222
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
3223
+ * of this software and associated documentation files (the "Software"), to deal
3224
+ * in the Software without restriction, including without limitation the rights
3225
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3226
+ * copies of the Software, and to permit persons to whom the Software is
3227
+ * furnished to do so, subject to the following conditions:
3228
+ *
3229
+ * The above copyright notice and this permission notice shall be included in
3230
+ * all copies or substantial portions of the Software.
3231
+ *
3232
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3233
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3234
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3235
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3236
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3237
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3238
+ * THE SOFTWARE.
3239
+ */
3240
+ var cssPropertyNameMap = {
3241
+ animation: {
3242
+ prefixed: '-webkit-animation',
3243
+ standard: 'animation',
3244
+ },
3245
+ transform: {
3246
+ prefixed: '-webkit-transform',
3247
+ standard: 'transform',
3248
+ },
3249
+ transition: {
3250
+ prefixed: '-webkit-transition',
3251
+ standard: 'transition',
3252
+ },
3253
+ };
3254
+ var jsEventTypeMap = {
3255
+ animationend: {
3256
+ cssProperty: 'animation',
3257
+ prefixed: 'webkitAnimationEnd',
3258
+ standard: 'animationend',
3259
+ },
3260
+ animationiteration: {
3261
+ cssProperty: 'animation',
3262
+ prefixed: 'webkitAnimationIteration',
3263
+ standard: 'animationiteration',
3264
+ },
3265
+ animationstart: {
3266
+ cssProperty: 'animation',
3267
+ prefixed: 'webkitAnimationStart',
3268
+ standard: 'animationstart',
3269
+ },
3270
+ transitionend: {
3271
+ cssProperty: 'transition',
3272
+ prefixed: 'webkitTransitionEnd',
3273
+ standard: 'transitionend',
3274
+ },
3275
+ };
3276
+ function isWindow(windowObj) {
3277
+ return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function';
3278
+ }
3279
+ function getCorrectPropertyName(windowObj, cssProperty) {
3280
+ if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) {
3281
+ var el = windowObj.document.createElement('div');
3282
+ var _a = cssPropertyNameMap[cssProperty], standard = _a.standard, prefixed = _a.prefixed;
3283
+ var isStandard = standard in el.style;
3284
+ return isStandard ? standard : prefixed;
3285
+ }
3286
+ return cssProperty;
3287
+ }
3288
+ function getCorrectEventName(windowObj, eventType) {
3289
+ if (isWindow(windowObj) && eventType in jsEventTypeMap) {
3290
+ var el = windowObj.document.createElement('div');
3291
+ var _a = jsEventTypeMap[eventType], standard = _a.standard, prefixed = _a.prefixed, cssProperty = _a.cssProperty;
3292
+ var isStandard = cssProperty in el.style;
3293
+ return isStandard ? standard : prefixed;
3294
+ }
3295
+ return eventType;
3296
+ }
2488
3297
 
2489
3298
  /**
2490
3299
  * @license
@@ -2509,7 +3318,7 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
2509
3318
  * THE SOFTWARE.
2510
3319
  */
2511
3320
  var MDCMenuSurface = /** @class */ (function (_super) {
2512
- component.__extends(MDCMenuSurface, _super);
3321
+ __extends(MDCMenuSurface, _super);
2513
3322
  function MDCMenuSurface() {
2514
3323
  return _super !== null && _super.apply(this, arguments) || this;
2515
3324
  }
@@ -2519,8 +3328,8 @@ var MDCMenuSurface = /** @class */ (function (_super) {
2519
3328
  MDCMenuSurface.prototype.initialSyncWithDOM = function () {
2520
3329
  var _this = this;
2521
3330
  var parentEl = this.root.parentElement;
2522
- this.anchorElement = parentEl && parentEl.classList.contains(cssClasses$4.ANCHOR) ? parentEl : null;
2523
- if (this.root.classList.contains(cssClasses$4.FIXED)) {
3331
+ this.anchorElement = parentEl && parentEl.classList.contains(cssClasses$6.ANCHOR) ? parentEl : null;
3332
+ if (this.root.classList.contains(cssClasses$6.FIXED)) {
2524
3333
  this.setFixedPosition(true);
2525
3334
  }
2526
3335
  this.handleKeydown = function (event) {
@@ -2538,13 +3347,13 @@ var MDCMenuSurface = /** @class */ (function (_super) {
2538
3347
  document.body.removeEventListener('click', _this.handleBodyClick, { capture: true });
2539
3348
  };
2540
3349
  this.listen('keydown', this.handleKeydown);
2541
- this.listen(strings$5.OPENED_EVENT, this.registerBodyClickListener);
2542
- this.listen(strings$5.CLOSED_EVENT, this.deregisterBodyClickListener);
3350
+ this.listen(strings$7.OPENED_EVENT, this.registerBodyClickListener);
3351
+ this.listen(strings$7.CLOSED_EVENT, this.deregisterBodyClickListener);
2543
3352
  };
2544
3353
  MDCMenuSurface.prototype.destroy = function () {
2545
3354
  this.unlisten('keydown', this.handleKeydown);
2546
- this.unlisten(strings$5.OPENED_EVENT, this.registerBodyClickListener);
2547
- this.unlisten(strings$5.CLOSED_EVENT, this.deregisterBodyClickListener);
3355
+ this.unlisten(strings$7.OPENED_EVENT, this.registerBodyClickListener);
3356
+ this.unlisten(strings$7.CLOSED_EVENT, this.deregisterBodyClickListener);
2548
3357
  _super.prototype.destroy.call(this);
2549
3358
  };
2550
3359
  MDCMenuSurface.prototype.isOpen = function () {
@@ -2575,10 +3384,10 @@ var MDCMenuSurface = /** @class */ (function (_super) {
2575
3384
  /** Sets the menu-surface to position: fixed. */
2576
3385
  MDCMenuSurface.prototype.setFixedPosition = function (isFixed) {
2577
3386
  if (isFixed) {
2578
- this.root.classList.add(cssClasses$4.FIXED);
3387
+ this.root.classList.add(cssClasses$6.FIXED);
2579
3388
  }
2580
3389
  else {
2581
- this.root.classList.remove(cssClasses$4.FIXED);
3390
+ this.root.classList.remove(cssClasses$6.FIXED);
2582
3391
  }
2583
3392
  this.foundation.setFixedPosition(isFixed);
2584
3393
  };
@@ -2623,7 +3432,7 @@ var MDCMenuSurface = /** @class */ (function (_super) {
2623
3432
  return getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl';
2624
3433
  },
2625
3434
  setTransformOrigin: function (origin) {
2626
- var propertyName = component.getCorrectPropertyName(window, 'transform') + "-origin";
3435
+ var propertyName = getCorrectPropertyName(window, 'transform') + "-origin";
2627
3436
  _this.root.style.setProperty(propertyName, origin);
2628
3437
  },
2629
3438
  isFocused: function () { return document.activeElement === _this.root; },
@@ -2671,54 +3480,237 @@ var MDCMenuSurface = /** @class */ (function (_super) {
2671
3480
  // tslint:enable:object-literal-sort-keys
2672
3481
  return new MDCMenuSurfaceFoundation(adapter);
2673
3482
  };
2674
- return MDCMenuSurface;
2675
- }(component.MDCComponent));
2676
-
2677
- /**
2678
- * @license
2679
- * Copyright 2018 Google Inc.
2680
- *
2681
- * Permission is hereby granted, free of charge, to any person obtaining a copy
2682
- * of this software and associated documentation files (the "Software"), to deal
2683
- * in the Software without restriction, including without limitation the rights
2684
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2685
- * copies of the Software, and to permit persons to whom the Software is
2686
- * furnished to do so, subject to the following conditions:
2687
- *
2688
- * The above copyright notice and this permission notice shall be included in
2689
- * all copies or substantial portions of the Software.
2690
- *
2691
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2692
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2693
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2694
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2695
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2696
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2697
- * THE SOFTWARE.
2698
- */
2699
- var cssClasses$2 = {
2700
- MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected',
2701
- MENU_SELECTION_GROUP: 'mdc-menu__selection-group',
2702
- ROOT: 'mdc-menu',
2703
- };
2704
- var strings$3 = {
2705
- ARIA_CHECKED_ATTR: 'aria-checked',
2706
- ARIA_DISABLED_ATTR: 'aria-disabled',
2707
- CHECKBOX_SELECTOR: 'input[type="checkbox"]',
2708
- LIST_SELECTOR: '.mdc-list,.mdc-deprecated-list',
2709
- SELECTED_EVENT: 'MDCMenu:selected',
2710
- SKIP_RESTORE_FOCUS: 'data-menu-item-skip-restore-focus',
2711
- };
2712
- var numbers$1 = {
2713
- FOCUS_ROOT_INDEX: -1,
2714
- };
2715
- var DefaultFocusState;
2716
- (function (DefaultFocusState) {
2717
- DefaultFocusState[DefaultFocusState["NONE"] = 0] = "NONE";
2718
- DefaultFocusState[DefaultFocusState["LIST_ROOT"] = 1] = "LIST_ROOT";
2719
- DefaultFocusState[DefaultFocusState["FIRST_ITEM"] = 2] = "FIRST_ITEM";
2720
- DefaultFocusState[DefaultFocusState["LAST_ITEM"] = 3] = "LAST_ITEM";
2721
- })(DefaultFocusState || (DefaultFocusState = {}));
3483
+ return MDCMenuSurface;
3484
+ }(MDCComponent));
3485
+
3486
+ /**
3487
+ * @license
3488
+ * Copyright 2018 Google Inc.
3489
+ *
3490
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
3491
+ * of this software and associated documentation files (the "Software"), to deal
3492
+ * in the Software without restriction, including without limitation the rights
3493
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3494
+ * copies of the Software, and to permit persons to whom the Software is
3495
+ * furnished to do so, subject to the following conditions:
3496
+ *
3497
+ * The above copyright notice and this permission notice shall be included in
3498
+ * all copies or substantial portions of the Software.
3499
+ *
3500
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3501
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3502
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3503
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3504
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3505
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3506
+ * THE SOFTWARE.
3507
+ */
3508
+ var cssClasses$4 = {
3509
+ MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected',
3510
+ MENU_SELECTION_GROUP: 'mdc-menu__selection-group',
3511
+ ROOT: 'mdc-menu',
3512
+ };
3513
+ var strings$5 = {
3514
+ ARIA_CHECKED_ATTR: 'aria-checked',
3515
+ ARIA_DISABLED_ATTR: 'aria-disabled',
3516
+ CHECKBOX_SELECTOR: 'input[type="checkbox"]',
3517
+ LIST_SELECTOR: '.mdc-list,.mdc-deprecated-list',
3518
+ SELECTED_EVENT: 'MDCMenu:selected',
3519
+ SKIP_RESTORE_FOCUS: 'data-menu-item-skip-restore-focus',
3520
+ };
3521
+ var numbers$3 = {
3522
+ FOCUS_ROOT_INDEX: -1,
3523
+ };
3524
+ var DefaultFocusState;
3525
+ (function (DefaultFocusState) {
3526
+ DefaultFocusState[DefaultFocusState["NONE"] = 0] = "NONE";
3527
+ DefaultFocusState[DefaultFocusState["LIST_ROOT"] = 1] = "LIST_ROOT";
3528
+ DefaultFocusState[DefaultFocusState["FIRST_ITEM"] = 2] = "FIRST_ITEM";
3529
+ DefaultFocusState[DefaultFocusState["LAST_ITEM"] = 3] = "LAST_ITEM";
3530
+ })(DefaultFocusState || (DefaultFocusState = {}));
3531
+
3532
+ /**
3533
+ * @license
3534
+ * Copyright 2018 Google Inc.
3535
+ *
3536
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
3537
+ * of this software and associated documentation files (the "Software"), to deal
3538
+ * in the Software without restriction, including without limitation the rights
3539
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3540
+ * copies of the Software, and to permit persons to whom the Software is
3541
+ * furnished to do so, subject to the following conditions:
3542
+ *
3543
+ * The above copyright notice and this permission notice shall be included in
3544
+ * all copies or substantial portions of the Software.
3545
+ *
3546
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3547
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3548
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3549
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3550
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3551
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3552
+ * THE SOFTWARE.
3553
+ */
3554
+ var MDCMenuFoundation = /** @class */ (function (_super) {
3555
+ __extends(MDCMenuFoundation, _super);
3556
+ function MDCMenuFoundation(adapter) {
3557
+ var _this = _super.call(this, exports.__assign(exports.__assign({}, MDCMenuFoundation.defaultAdapter), adapter)) || this;
3558
+ _this.closeAnimationEndTimerId = 0;
3559
+ _this.defaultFocusState = DefaultFocusState.LIST_ROOT;
3560
+ _this.selectedIndex = -1;
3561
+ return _this;
3562
+ }
3563
+ Object.defineProperty(MDCMenuFoundation, "cssClasses", {
3564
+ get: function () {
3565
+ return cssClasses$4;
3566
+ },
3567
+ enumerable: false,
3568
+ configurable: true
3569
+ });
3570
+ Object.defineProperty(MDCMenuFoundation, "strings", {
3571
+ get: function () {
3572
+ return strings$5;
3573
+ },
3574
+ enumerable: false,
3575
+ configurable: true
3576
+ });
3577
+ Object.defineProperty(MDCMenuFoundation, "numbers", {
3578
+ get: function () {
3579
+ return numbers$3;
3580
+ },
3581
+ enumerable: false,
3582
+ configurable: true
3583
+ });
3584
+ Object.defineProperty(MDCMenuFoundation, "defaultAdapter", {
3585
+ /**
3586
+ * @see {@link MDCMenuAdapter} for typing information on parameters and return types.
3587
+ */
3588
+ get: function () {
3589
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
3590
+ return {
3591
+ addClassToElementAtIndex: function () { return undefined; },
3592
+ removeClassFromElementAtIndex: function () { return undefined; },
3593
+ addAttributeToElementAtIndex: function () { return undefined; },
3594
+ removeAttributeFromElementAtIndex: function () { return undefined; },
3595
+ getAttributeFromElementAtIndex: function () { return null; },
3596
+ elementContainsClass: function () { return false; },
3597
+ closeSurface: function () { return undefined; },
3598
+ getElementIndex: function () { return -1; },
3599
+ notifySelected: function () { return undefined; },
3600
+ getMenuItemCount: function () { return 0; },
3601
+ focusItemAtIndex: function () { return undefined; },
3602
+ focusListRoot: function () { return undefined; },
3603
+ getSelectedSiblingOfItemAtIndex: function () { return -1; },
3604
+ isSelectableItemAtIndex: function () { return false; },
3605
+ };
3606
+ // tslint:enable:object-literal-sort-keys
3607
+ },
3608
+ enumerable: false,
3609
+ configurable: true
3610
+ });
3611
+ MDCMenuFoundation.prototype.destroy = function () {
3612
+ if (this.closeAnimationEndTimerId) {
3613
+ clearTimeout(this.closeAnimationEndTimerId);
3614
+ }
3615
+ this.adapter.closeSurface();
3616
+ };
3617
+ MDCMenuFoundation.prototype.handleKeydown = function (evt) {
3618
+ var key = evt.key, keyCode = evt.keyCode;
3619
+ var isTab = key === 'Tab' || keyCode === 9;
3620
+ if (isTab) {
3621
+ this.adapter.closeSurface(/** skipRestoreFocus */ true);
3622
+ }
3623
+ };
3624
+ MDCMenuFoundation.prototype.handleItemAction = function (listItem) {
3625
+ var _this = this;
3626
+ var index = this.adapter.getElementIndex(listItem);
3627
+ if (index < 0) {
3628
+ return;
3629
+ }
3630
+ this.adapter.notifySelected({ index: index });
3631
+ var skipRestoreFocus = this.adapter.getAttributeFromElementAtIndex(index, strings$5.SKIP_RESTORE_FOCUS) === 'true';
3632
+ this.adapter.closeSurface(skipRestoreFocus);
3633
+ // Wait for the menu to close before adding/removing classes that affect styles.
3634
+ this.closeAnimationEndTimerId = setTimeout(function () {
3635
+ // Recompute the index in case the menu contents have changed.
3636
+ var recomputedIndex = _this.adapter.getElementIndex(listItem);
3637
+ if (recomputedIndex >= 0 &&
3638
+ _this.adapter.isSelectableItemAtIndex(recomputedIndex)) {
3639
+ _this.setSelectedIndex(recomputedIndex);
3640
+ }
3641
+ }, MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION);
3642
+ };
3643
+ MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () {
3644
+ switch (this.defaultFocusState) {
3645
+ case DefaultFocusState.FIRST_ITEM:
3646
+ this.adapter.focusItemAtIndex(0);
3647
+ break;
3648
+ case DefaultFocusState.LAST_ITEM:
3649
+ this.adapter.focusItemAtIndex(this.adapter.getMenuItemCount() - 1);
3650
+ break;
3651
+ case DefaultFocusState.NONE:
3652
+ // Do nothing.
3653
+ break;
3654
+ default:
3655
+ this.adapter.focusListRoot();
3656
+ break;
3657
+ }
3658
+ };
3659
+ /**
3660
+ * Sets default focus state where the menu should focus every time when menu
3661
+ * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
3662
+ * default.
3663
+ */
3664
+ MDCMenuFoundation.prototype.setDefaultFocusState = function (focusState) {
3665
+ this.defaultFocusState = focusState;
3666
+ };
3667
+ /** @return Index of the currently selected list item within the menu. */
3668
+ MDCMenuFoundation.prototype.getSelectedIndex = function () {
3669
+ return this.selectedIndex;
3670
+ };
3671
+ /**
3672
+ * Selects the list item at `index` within the menu.
3673
+ * @param index Index of list item within the menu.
3674
+ */
3675
+ MDCMenuFoundation.prototype.setSelectedIndex = function (index) {
3676
+ this.validatedIndex(index);
3677
+ if (!this.adapter.isSelectableItemAtIndex(index)) {
3678
+ throw new Error('MDCMenuFoundation: No selection group at specified index.');
3679
+ }
3680
+ var prevSelectedIndex = this.adapter.getSelectedSiblingOfItemAtIndex(index);
3681
+ if (prevSelectedIndex >= 0) {
3682
+ this.adapter.removeAttributeFromElementAtIndex(prevSelectedIndex, strings$5.ARIA_CHECKED_ATTR);
3683
+ this.adapter.removeClassFromElementAtIndex(prevSelectedIndex, cssClasses$4.MENU_SELECTED_LIST_ITEM);
3684
+ }
3685
+ this.adapter.addClassToElementAtIndex(index, cssClasses$4.MENU_SELECTED_LIST_ITEM);
3686
+ this.adapter.addAttributeToElementAtIndex(index, strings$5.ARIA_CHECKED_ATTR, 'true');
3687
+ this.selectedIndex = index;
3688
+ };
3689
+ /**
3690
+ * Sets the enabled state to isEnabled for the menu item at the given index.
3691
+ * @param index Index of the menu item
3692
+ * @param isEnabled The desired enabled state of the menu item.
3693
+ */
3694
+ MDCMenuFoundation.prototype.setEnabled = function (index, isEnabled) {
3695
+ this.validatedIndex(index);
3696
+ if (isEnabled) {
3697
+ this.adapter.removeClassFromElementAtIndex(index, cssClasses$5.LIST_ITEM_DISABLED_CLASS);
3698
+ this.adapter.addAttributeToElementAtIndex(index, strings$5.ARIA_DISABLED_ATTR, 'false');
3699
+ }
3700
+ else {
3701
+ this.adapter.addClassToElementAtIndex(index, cssClasses$5.LIST_ITEM_DISABLED_CLASS);
3702
+ this.adapter.addAttributeToElementAtIndex(index, strings$5.ARIA_DISABLED_ATTR, 'true');
3703
+ }
3704
+ };
3705
+ MDCMenuFoundation.prototype.validatedIndex = function (index) {
3706
+ var menuSize = this.adapter.getMenuItemCount();
3707
+ var isIndexInRange = index >= 0 && index < menuSize;
3708
+ if (!isIndexInRange) {
3709
+ throw new Error('MDCMenuFoundation: No list item at specified index.');
3710
+ }
3711
+ };
3712
+ return MDCMenuFoundation;
3713
+ }(MDCFoundation));
2722
3714
 
2723
3715
  /**
2724
3716
  * @license
@@ -2742,166 +3734,319 @@ var DefaultFocusState;
2742
3734
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2743
3735
  * THE SOFTWARE.
2744
3736
  */
2745
- var MDCMenuFoundation = /** @class */ (function (_super) {
2746
- component.__extends(MDCMenuFoundation, _super);
2747
- function MDCMenuFoundation(adapter) {
2748
- var _this = _super.call(this, component.__assign(component.__assign({}, MDCMenuFoundation.defaultAdapter), adapter)) || this;
2749
- _this.closeAnimationEndTimerId = 0;
2750
- _this.defaultFocusState = DefaultFocusState.LIST_ROOT;
2751
- _this.selectedIndex = -1;
2752
- return _this;
3737
+ var MDCMenu = /** @class */ (function (_super) {
3738
+ __extends(MDCMenu, _super);
3739
+ function MDCMenu() {
3740
+ return _super !== null && _super.apply(this, arguments) || this;
2753
3741
  }
2754
- Object.defineProperty(MDCMenuFoundation, "cssClasses", {
3742
+ MDCMenu.attachTo = function (root) {
3743
+ return new MDCMenu(root);
3744
+ };
3745
+ MDCMenu.prototype.initialize = function (menuSurfaceFactory, listFactory) {
3746
+ if (menuSurfaceFactory === void 0) { menuSurfaceFactory = function (el) { return new MDCMenuSurface(el); }; }
3747
+ if (listFactory === void 0) { listFactory = function (el) { return new MDCList(el); }; }
3748
+ this.menuSurfaceFactory = menuSurfaceFactory;
3749
+ this.listFactory = listFactory;
3750
+ };
3751
+ MDCMenu.prototype.initialSyncWithDOM = function () {
3752
+ var _this = this;
3753
+ this.menuSurface = this.menuSurfaceFactory(this.root);
3754
+ var list = this.root.querySelector(strings$5.LIST_SELECTOR);
3755
+ if (list) {
3756
+ this.list = this.listFactory(list);
3757
+ this.list.wrapFocus = true;
3758
+ }
3759
+ else {
3760
+ this.list = null;
3761
+ }
3762
+ this.handleKeydown = function (evt) {
3763
+ _this.foundation.handleKeydown(evt);
3764
+ };
3765
+ this.handleItemAction = function (evt) {
3766
+ _this.foundation.handleItemAction(_this.items[evt.detail.index]);
3767
+ };
3768
+ this.handleMenuSurfaceOpened = function () {
3769
+ _this.foundation.handleMenuSurfaceOpened();
3770
+ };
3771
+ this.menuSurface.listen(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened);
3772
+ this.listen('keydown', this.handleKeydown);
3773
+ this.listen(MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction);
3774
+ };
3775
+ MDCMenu.prototype.destroy = function () {
3776
+ if (this.list) {
3777
+ this.list.destroy();
3778
+ }
3779
+ this.menuSurface.destroy();
3780
+ this.menuSurface.unlisten(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened);
3781
+ this.unlisten('keydown', this.handleKeydown);
3782
+ this.unlisten(MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction);
3783
+ _super.prototype.destroy.call(this);
3784
+ };
3785
+ Object.defineProperty(MDCMenu.prototype, "open", {
2755
3786
  get: function () {
2756
- return cssClasses$2;
3787
+ return this.menuSurface.isOpen();
3788
+ },
3789
+ set: function (value) {
3790
+ if (value) {
3791
+ this.menuSurface.open();
3792
+ }
3793
+ else {
3794
+ this.menuSurface.close();
3795
+ }
2757
3796
  },
2758
3797
  enumerable: false,
2759
3798
  configurable: true
2760
3799
  });
2761
- Object.defineProperty(MDCMenuFoundation, "strings", {
3800
+ Object.defineProperty(MDCMenu.prototype, "wrapFocus", {
2762
3801
  get: function () {
2763
- return strings$3;
3802
+ return this.list ? this.list.wrapFocus : false;
3803
+ },
3804
+ set: function (value) {
3805
+ if (this.list) {
3806
+ this.list.wrapFocus = value;
3807
+ }
2764
3808
  },
2765
3809
  enumerable: false,
2766
3810
  configurable: true
2767
3811
  });
2768
- Object.defineProperty(MDCMenuFoundation, "numbers", {
3812
+ Object.defineProperty(MDCMenu.prototype, "hasTypeahead", {
3813
+ /**
3814
+ * Sets whether the menu has typeahead functionality.
3815
+ * @param value Whether typeahead is enabled.
3816
+ */
3817
+ set: function (value) {
3818
+ if (this.list) {
3819
+ this.list.hasTypeahead = value;
3820
+ }
3821
+ },
3822
+ enumerable: false,
3823
+ configurable: true
3824
+ });
3825
+ Object.defineProperty(MDCMenu.prototype, "typeaheadInProgress", {
3826
+ /**
3827
+ * @return Whether typeahead logic is currently matching some user prefix.
3828
+ */
2769
3829
  get: function () {
2770
- return numbers$1;
3830
+ return this.list ? this.list.typeaheadInProgress : false;
2771
3831
  },
2772
3832
  enumerable: false,
2773
3833
  configurable: true
2774
3834
  });
2775
- Object.defineProperty(MDCMenuFoundation, "defaultAdapter", {
3835
+ /**
3836
+ * Given the next desired character from the user, adds it to the typeahead
3837
+ * buffer. Then, attempts to find the next option matching the buffer. Wraps
3838
+ * around if at the end of options.
3839
+ *
3840
+ * @param nextChar The next character to add to the prefix buffer.
3841
+ * @param startingIndex The index from which to start matching. Only relevant
3842
+ * when starting a new match sequence. To start a new match sequence,
3843
+ * clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer
3844
+ * to clear after a set interval defined in list foundation. Defaults to
3845
+ * the currently focused index.
3846
+ * @return The index of the matched item, or -1 if no match.
3847
+ */
3848
+ MDCMenu.prototype.typeaheadMatchItem = function (nextChar, startingIndex) {
3849
+ if (this.list) {
3850
+ return this.list.typeaheadMatchItem(nextChar, startingIndex);
3851
+ }
3852
+ return -1;
3853
+ };
3854
+ /**
3855
+ * Layout the underlying list element in the case of any dynamic updates
3856
+ * to its structure.
3857
+ */
3858
+ MDCMenu.prototype.layout = function () {
3859
+ if (this.list) {
3860
+ this.list.layout();
3861
+ }
3862
+ };
3863
+ Object.defineProperty(MDCMenu.prototype, "items", {
2776
3864
  /**
2777
- * @see {@link MDCMenuAdapter} for typing information on parameters and return types.
3865
+ * Return the items within the menu. Note that this only contains the set of elements within
3866
+ * the items container that are proper list items, and not supplemental / presentational DOM
3867
+ * elements.
2778
3868
  */
2779
3869
  get: function () {
2780
- // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
2781
- return {
2782
- addClassToElementAtIndex: function () { return undefined; },
2783
- removeClassFromElementAtIndex: function () { return undefined; },
2784
- addAttributeToElementAtIndex: function () { return undefined; },
2785
- removeAttributeFromElementAtIndex: function () { return undefined; },
2786
- getAttributeFromElementAtIndex: function () { return null; },
2787
- elementContainsClass: function () { return false; },
2788
- closeSurface: function () { return undefined; },
2789
- getElementIndex: function () { return -1; },
2790
- notifySelected: function () { return undefined; },
2791
- getMenuItemCount: function () { return 0; },
2792
- focusItemAtIndex: function () { return undefined; },
2793
- focusListRoot: function () { return undefined; },
2794
- getSelectedSiblingOfItemAtIndex: function () { return -1; },
2795
- isSelectableItemAtIndex: function () { return false; },
2796
- };
2797
- // tslint:enable:object-literal-sort-keys
3870
+ return this.list ? this.list.listElements : [];
3871
+ },
3872
+ enumerable: false,
3873
+ configurable: true
3874
+ });
3875
+ Object.defineProperty(MDCMenu.prototype, "singleSelection", {
3876
+ /**
3877
+ * Turns on/off the underlying list's single selection mode. Used mainly
3878
+ * by select menu.
3879
+ *
3880
+ * @param singleSelection Whether to enable single selection mode.
3881
+ */
3882
+ set: function (singleSelection) {
3883
+ if (this.list) {
3884
+ this.list.singleSelection = singleSelection;
3885
+ }
3886
+ },
3887
+ enumerable: false,
3888
+ configurable: true
3889
+ });
3890
+ Object.defineProperty(MDCMenu.prototype, "selectedIndex", {
3891
+ /**
3892
+ * Retrieves the selected index. Only applicable to select menus.
3893
+ * @return The selected index, which is a number for single selection and
3894
+ * radio lists, and an array of numbers for checkbox lists.
3895
+ */
3896
+ get: function () {
3897
+ return this.list ? this.list.selectedIndex : numbers$4.UNSET_INDEX;
3898
+ },
3899
+ /**
3900
+ * Sets the selected index of the list. Only applicable to select menus.
3901
+ * @param index The selected index, which is a number for single selection and
3902
+ * radio lists, and an array of numbers for checkbox lists.
3903
+ */
3904
+ set: function (index) {
3905
+ if (this.list) {
3906
+ this.list.selectedIndex = index;
3907
+ }
3908
+ },
3909
+ enumerable: false,
3910
+ configurable: true
3911
+ });
3912
+ Object.defineProperty(MDCMenu.prototype, "quickOpen", {
3913
+ set: function (quickOpen) {
3914
+ this.menuSurface.quickOpen = quickOpen;
2798
3915
  },
2799
3916
  enumerable: false,
2800
3917
  configurable: true
2801
3918
  });
2802
- MDCMenuFoundation.prototype.destroy = function () {
2803
- if (this.closeAnimationEndTimerId) {
2804
- clearTimeout(this.closeAnimationEndTimerId);
2805
- }
2806
- this.adapter.closeSurface();
2807
- };
2808
- MDCMenuFoundation.prototype.handleKeydown = function (evt) {
2809
- var key = evt.key, keyCode = evt.keyCode;
2810
- var isTab = key === 'Tab' || keyCode === 9;
2811
- if (isTab) {
2812
- this.adapter.closeSurface(/** skipRestoreFocus */ true);
2813
- }
2814
- };
2815
- MDCMenuFoundation.prototype.handleItemAction = function (listItem) {
2816
- var _this = this;
2817
- var index = this.adapter.getElementIndex(listItem);
2818
- if (index < 0) {
2819
- return;
2820
- }
2821
- this.adapter.notifySelected({ index: index });
2822
- var skipRestoreFocus = this.adapter.getAttributeFromElementAtIndex(index, strings$3.SKIP_RESTORE_FOCUS) === 'true';
2823
- this.adapter.closeSurface(skipRestoreFocus);
2824
- // Wait for the menu to close before adding/removing classes that affect styles.
2825
- this.closeAnimationEndTimerId = setTimeout(function () {
2826
- // Recompute the index in case the menu contents have changed.
2827
- var recomputedIndex = _this.adapter.getElementIndex(listItem);
2828
- if (recomputedIndex >= 0 &&
2829
- _this.adapter.isSelectableItemAtIndex(recomputedIndex)) {
2830
- _this.setSelectedIndex(recomputedIndex);
2831
- }
2832
- }, MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION);
2833
- };
2834
- MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () {
2835
- switch (this.defaultFocusState) {
2836
- case DefaultFocusState.FIRST_ITEM:
2837
- this.adapter.focusItemAtIndex(0);
2838
- break;
2839
- case DefaultFocusState.LAST_ITEM:
2840
- this.adapter.focusItemAtIndex(this.adapter.getMenuItemCount() - 1);
2841
- break;
2842
- case DefaultFocusState.NONE:
2843
- // Do nothing.
2844
- break;
2845
- default:
2846
- this.adapter.focusListRoot();
2847
- break;
2848
- }
2849
- };
2850
3919
  /**
2851
3920
  * Sets default focus state where the menu should focus every time when menu
2852
3921
  * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
2853
3922
  * default.
3923
+ * @param focusState Default focus state.
2854
3924
  */
2855
- MDCMenuFoundation.prototype.setDefaultFocusState = function (focusState) {
2856
- this.defaultFocusState = focusState;
3925
+ MDCMenu.prototype.setDefaultFocusState = function (focusState) {
3926
+ this.foundation.setDefaultFocusState(focusState);
2857
3927
  };
2858
- /** @return Index of the currently selected list item within the menu. */
2859
- MDCMenuFoundation.prototype.getSelectedIndex = function () {
2860
- return this.selectedIndex;
3928
+ /**
3929
+ * @param corner Default anchor corner alignment of top-left menu corner.
3930
+ */
3931
+ MDCMenu.prototype.setAnchorCorner = function (corner) {
3932
+ this.menuSurface.setAnchorCorner(corner);
3933
+ };
3934
+ MDCMenu.prototype.setAnchorMargin = function (margin) {
3935
+ this.menuSurface.setAnchorMargin(margin);
2861
3936
  };
2862
3937
  /**
2863
- * Selects the list item at `index` within the menu.
2864
- * @param index Index of list item within the menu.
3938
+ * Sets the list item as the selected row at the specified index.
3939
+ * @param index Index of list item within menu.
2865
3940
  */
2866
- MDCMenuFoundation.prototype.setSelectedIndex = function (index) {
2867
- this.validatedIndex(index);
2868
- if (!this.adapter.isSelectableItemAtIndex(index)) {
2869
- throw new Error('MDCMenuFoundation: No selection group at specified index.');
2870
- }
2871
- var prevSelectedIndex = this.adapter.getSelectedSiblingOfItemAtIndex(index);
2872
- if (prevSelectedIndex >= 0) {
2873
- this.adapter.removeAttributeFromElementAtIndex(prevSelectedIndex, strings$3.ARIA_CHECKED_ATTR);
2874
- this.adapter.removeClassFromElementAtIndex(prevSelectedIndex, cssClasses$2.MENU_SELECTED_LIST_ITEM);
2875
- }
2876
- this.adapter.addClassToElementAtIndex(index, cssClasses$2.MENU_SELECTED_LIST_ITEM);
2877
- this.adapter.addAttributeToElementAtIndex(index, strings$3.ARIA_CHECKED_ATTR, 'true');
2878
- this.selectedIndex = index;
3941
+ MDCMenu.prototype.setSelectedIndex = function (index) {
3942
+ this.foundation.setSelectedIndex(index);
2879
3943
  };
2880
3944
  /**
2881
3945
  * Sets the enabled state to isEnabled for the menu item at the given index.
2882
3946
  * @param index Index of the menu item
2883
3947
  * @param isEnabled The desired enabled state of the menu item.
2884
3948
  */
2885
- MDCMenuFoundation.prototype.setEnabled = function (index, isEnabled) {
2886
- this.validatedIndex(index);
2887
- if (isEnabled) {
2888
- this.adapter.removeClassFromElementAtIndex(index, cssClasses$3.LIST_ITEM_DISABLED_CLASS);
2889
- this.adapter.addAttributeToElementAtIndex(index, strings$3.ARIA_DISABLED_ATTR, 'false');
3949
+ MDCMenu.prototype.setEnabled = function (index, isEnabled) {
3950
+ this.foundation.setEnabled(index, isEnabled);
3951
+ };
3952
+ /**
3953
+ * @return The item within the menu at the index specified.
3954
+ */
3955
+ MDCMenu.prototype.getOptionByIndex = function (index) {
3956
+ var items = this.items;
3957
+ if (index < items.length) {
3958
+ return this.items[index];
2890
3959
  }
2891
3960
  else {
2892
- this.adapter.addClassToElementAtIndex(index, cssClasses$3.LIST_ITEM_DISABLED_CLASS);
2893
- this.adapter.addAttributeToElementAtIndex(index, strings$3.ARIA_DISABLED_ATTR, 'true');
3961
+ return null;
2894
3962
  }
2895
3963
  };
2896
- MDCMenuFoundation.prototype.validatedIndex = function (index) {
2897
- var menuSize = this.adapter.getMenuItemCount();
2898
- var isIndexInRange = index >= 0 && index < menuSize;
2899
- if (!isIndexInRange) {
2900
- throw new Error('MDCMenuFoundation: No list item at specified index.');
3964
+ /**
3965
+ * @param index A menu item's index.
3966
+ * @return The primary text within the menu at the index specified.
3967
+ */
3968
+ MDCMenu.prototype.getPrimaryTextAtIndex = function (index) {
3969
+ var item = this.getOptionByIndex(index);
3970
+ if (item && this.list) {
3971
+ return this.list.getPrimaryText(item) || '';
2901
3972
  }
3973
+ return '';
2902
3974
  };
2903
- return MDCMenuFoundation;
2904
- }(component.MDCFoundation));
3975
+ MDCMenu.prototype.setFixedPosition = function (isFixed) {
3976
+ this.menuSurface.setFixedPosition(isFixed);
3977
+ };
3978
+ MDCMenu.prototype.setIsHoisted = function (isHoisted) {
3979
+ this.menuSurface.setIsHoisted(isHoisted);
3980
+ };
3981
+ MDCMenu.prototype.setAbsolutePosition = function (x, y) {
3982
+ this.menuSurface.setAbsolutePosition(x, y);
3983
+ };
3984
+ /**
3985
+ * Sets the element that the menu-surface is anchored to.
3986
+ */
3987
+ MDCMenu.prototype.setAnchorElement = function (element) {
3988
+ this.menuSurface.anchorElement = element;
3989
+ };
3990
+ MDCMenu.prototype.getDefaultFoundation = function () {
3991
+ var _this = this;
3992
+ // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
3993
+ // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
3994
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
3995
+ var adapter = {
3996
+ addClassToElementAtIndex: function (index, className) {
3997
+ var list = _this.items;
3998
+ list[index].classList.add(className);
3999
+ },
4000
+ removeClassFromElementAtIndex: function (index, className) {
4001
+ var list = _this.items;
4002
+ list[index].classList.remove(className);
4003
+ },
4004
+ addAttributeToElementAtIndex: function (index, attr, value) {
4005
+ var list = _this.items;
4006
+ list[index].setAttribute(attr, value);
4007
+ },
4008
+ removeAttributeFromElementAtIndex: function (index, attr) {
4009
+ var list = _this.items;
4010
+ list[index].removeAttribute(attr);
4011
+ },
4012
+ getAttributeFromElementAtIndex: function (index, attr) {
4013
+ var list = _this.items;
4014
+ return list[index].getAttribute(attr);
4015
+ },
4016
+ elementContainsClass: function (element, className) {
4017
+ return element.classList.contains(className);
4018
+ },
4019
+ closeSurface: function (skipRestoreFocus) {
4020
+ _this.menuSurface.close(skipRestoreFocus);
4021
+ },
4022
+ getElementIndex: function (element) { return _this.items.indexOf(element); },
4023
+ notifySelected: function (evtData) {
4024
+ _this.emit(strings$5.SELECTED_EVENT, {
4025
+ index: evtData.index,
4026
+ item: _this.items[evtData.index],
4027
+ });
4028
+ },
4029
+ getMenuItemCount: function () { return _this.items.length; },
4030
+ focusItemAtIndex: function (index) {
4031
+ _this.items[index].focus();
4032
+ },
4033
+ focusListRoot: function () {
4034
+ _this.root.querySelector(strings$5.LIST_SELECTOR).focus();
4035
+ },
4036
+ isSelectableItemAtIndex: function (index) {
4037
+ return !!closest(_this.items[index], "." + cssClasses$4.MENU_SELECTION_GROUP);
4038
+ },
4039
+ getSelectedSiblingOfItemAtIndex: function (index) {
4040
+ var selectionGroupEl = closest(_this.items[index], "." + cssClasses$4.MENU_SELECTION_GROUP);
4041
+ var selectedItemEl = selectionGroupEl.querySelector("." + cssClasses$4.MENU_SELECTED_LIST_ITEM);
4042
+ return selectedItemEl ? _this.items.indexOf(selectedItemEl) : -1;
4043
+ },
4044
+ };
4045
+ // tslint:enable:object-literal-sort-keys
4046
+ return new MDCMenuFoundation(adapter);
4047
+ };
4048
+ return MDCMenu;
4049
+ }(MDCComponent));
2905
4050
 
2906
4051
  /**
2907
4052
  * @license
@@ -2925,319 +4070,973 @@ var MDCMenuFoundation = /** @class */ (function (_super) {
2925
4070
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2926
4071
  * THE SOFTWARE.
2927
4072
  */
2928
- var MDCMenu = /** @class */ (function (_super) {
2929
- component.__extends(MDCMenu, _super);
2930
- function MDCMenu() {
2931
- return _super !== null && _super.apply(this, arguments) || this;
2932
- }
2933
- MDCMenu.attachTo = function (root) {
2934
- return new MDCMenu(root);
2935
- };
2936
- MDCMenu.prototype.initialize = function (menuSurfaceFactory, listFactory) {
2937
- if (menuSurfaceFactory === void 0) { menuSurfaceFactory = function (el) { return new MDCMenuSurface(el); }; }
2938
- if (listFactory === void 0) { listFactory = function (el) { return new MDCList(el); }; }
2939
- this.menuSurfaceFactory = menuSurfaceFactory;
2940
- this.listFactory = listFactory;
2941
- };
2942
- MDCMenu.prototype.initialSyncWithDOM = function () {
2943
- var _this = this;
2944
- this.menuSurface = this.menuSurfaceFactory(this.root);
2945
- var list = this.root.querySelector(strings$3.LIST_SELECTOR);
2946
- if (list) {
2947
- this.list = this.listFactory(list);
2948
- this.list.wrapFocus = true;
2949
- }
2950
- else {
2951
- this.list = null;
2952
- }
2953
- this.handleKeydown = function (evt) {
2954
- _this.foundation.handleKeydown(evt);
2955
- };
2956
- this.handleItemAction = function (evt) {
2957
- _this.foundation.handleItemAction(_this.items[evt.detail.index]);
2958
- };
2959
- this.handleMenuSurfaceOpened = function () {
2960
- _this.foundation.handleMenuSurfaceOpened();
2961
- };
2962
- this.menuSurface.listen(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened);
2963
- this.listen('keydown', this.handleKeydown);
2964
- this.listen(MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction);
2965
- };
2966
- MDCMenu.prototype.destroy = function () {
2967
- if (this.list) {
2968
- this.list.destroy();
2969
- }
2970
- this.menuSurface.destroy();
2971
- this.menuSurface.unlisten(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened);
2972
- this.unlisten('keydown', this.handleKeydown);
2973
- this.unlisten(MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction);
2974
- _super.prototype.destroy.call(this);
2975
- };
2976
- Object.defineProperty(MDCMenu.prototype, "open", {
4073
+ var strings$4 = {
4074
+ NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch',
4075
+ };
4076
+ var numbers$2 = {
4077
+ // This should stay in sync with $mdc-notched-outline-padding * 2.
4078
+ NOTCH_ELEMENT_PADDING: 8,
4079
+ };
4080
+ var cssClasses$3 = {
4081
+ NO_LABEL: 'mdc-notched-outline--no-label',
4082
+ OUTLINE_NOTCHED: 'mdc-notched-outline--notched',
4083
+ OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded',
4084
+ };
4085
+
4086
+ /**
4087
+ * @license
4088
+ * Copyright 2017 Google Inc.
4089
+ *
4090
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4091
+ * of this software and associated documentation files (the "Software"), to deal
4092
+ * in the Software without restriction, including without limitation the rights
4093
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4094
+ * copies of the Software, and to permit persons to whom the Software is
4095
+ * furnished to do so, subject to the following conditions:
4096
+ *
4097
+ * The above copyright notice and this permission notice shall be included in
4098
+ * all copies or substantial portions of the Software.
4099
+ *
4100
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4101
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4102
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4103
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4104
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4105
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4106
+ * THE SOFTWARE.
4107
+ */
4108
+ var MDCNotchedOutlineFoundation = /** @class */ (function (_super) {
4109
+ __extends(MDCNotchedOutlineFoundation, _super);
4110
+ function MDCNotchedOutlineFoundation(adapter) {
4111
+ return _super.call(this, exports.__assign(exports.__assign({}, MDCNotchedOutlineFoundation.defaultAdapter), adapter)) || this;
4112
+ }
4113
+ Object.defineProperty(MDCNotchedOutlineFoundation, "strings", {
2977
4114
  get: function () {
2978
- return this.menuSurface.isOpen();
2979
- },
2980
- set: function (value) {
2981
- if (value) {
2982
- this.menuSurface.open();
2983
- }
2984
- else {
2985
- this.menuSurface.close();
2986
- }
4115
+ return strings$4;
2987
4116
  },
2988
4117
  enumerable: false,
2989
4118
  configurable: true
2990
4119
  });
2991
- Object.defineProperty(MDCMenu.prototype, "wrapFocus", {
4120
+ Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", {
2992
4121
  get: function () {
2993
- return this.list ? this.list.wrapFocus : false;
2994
- },
2995
- set: function (value) {
2996
- if (this.list) {
2997
- this.list.wrapFocus = value;
2998
- }
4122
+ return cssClasses$3;
2999
4123
  },
3000
4124
  enumerable: false,
3001
4125
  configurable: true
3002
4126
  });
3003
- Object.defineProperty(MDCMenu.prototype, "hasTypeahead", {
3004
- /**
3005
- * Sets whether the menu has typeahead functionality.
3006
- * @param value Whether typeahead is enabled.
3007
- */
3008
- set: function (value) {
3009
- if (this.list) {
3010
- this.list.hasTypeahead = value;
3011
- }
4127
+ Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", {
4128
+ get: function () {
4129
+ return numbers$2;
3012
4130
  },
3013
4131
  enumerable: false,
3014
4132
  configurable: true
3015
4133
  });
3016
- Object.defineProperty(MDCMenu.prototype, "typeaheadInProgress", {
4134
+ Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", {
3017
4135
  /**
3018
- * @return Whether typeahead logic is currently matching some user prefix.
4136
+ * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types.
3019
4137
  */
3020
4138
  get: function () {
3021
- return this.list ? this.list.typeaheadInProgress : false;
4139
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
4140
+ return {
4141
+ addClass: function () { return undefined; },
4142
+ removeClass: function () { return undefined; },
4143
+ setNotchWidthProperty: function () { return undefined; },
4144
+ removeNotchWidthProperty: function () { return undefined; },
4145
+ };
4146
+ // tslint:enable:object-literal-sort-keys
3022
4147
  },
3023
4148
  enumerable: false,
3024
4149
  configurable: true
3025
4150
  });
3026
4151
  /**
3027
- * Given the next desired character from the user, adds it to the typeahead
3028
- * buffer. Then, attempts to find the next option matching the buffer. Wraps
3029
- * around if at the end of options.
3030
- *
3031
- * @param nextChar The next character to add to the prefix buffer.
3032
- * @param startingIndex The index from which to start matching. Only relevant
3033
- * when starting a new match sequence. To start a new match sequence,
3034
- * clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer
3035
- * to clear after a set interval defined in list foundation. Defaults to
3036
- * the currently focused index.
3037
- * @return The index of the matched item, or -1 if no match.
4152
+ * Adds the outline notched selector and updates the notch width calculated based off of notchWidth.
3038
4153
  */
3039
- MDCMenu.prototype.typeaheadMatchItem = function (nextChar, startingIndex) {
3040
- if (this.list) {
3041
- return this.list.typeaheadMatchItem(nextChar, startingIndex);
4154
+ MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) {
4155
+ var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
4156
+ if (notchWidth > 0) {
4157
+ notchWidth += numbers$2.NOTCH_ELEMENT_PADDING; // Add padding from left/right.
3042
4158
  }
3043
- return -1;
4159
+ this.adapter.setNotchWidthProperty(notchWidth);
4160
+ this.adapter.addClass(OUTLINE_NOTCHED);
3044
4161
  };
3045
4162
  /**
3046
- * Layout the underlying list element in the case of any dynamic updates
3047
- * to its structure.
4163
+ * Removes notched outline selector to close the notch in the outline.
3048
4164
  */
3049
- MDCMenu.prototype.layout = function () {
3050
- if (this.list) {
3051
- this.list.layout();
4165
+ MDCNotchedOutlineFoundation.prototype.closeNotch = function () {
4166
+ var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
4167
+ this.adapter.removeClass(OUTLINE_NOTCHED);
4168
+ this.adapter.removeNotchWidthProperty();
4169
+ };
4170
+ return MDCNotchedOutlineFoundation;
4171
+ }(MDCFoundation));
4172
+
4173
+ /**
4174
+ * @license
4175
+ * Copyright 2017 Google Inc.
4176
+ *
4177
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4178
+ * of this software and associated documentation files (the "Software"), to deal
4179
+ * in the Software without restriction, including without limitation the rights
4180
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4181
+ * copies of the Software, and to permit persons to whom the Software is
4182
+ * furnished to do so, subject to the following conditions:
4183
+ *
4184
+ * The above copyright notice and this permission notice shall be included in
4185
+ * all copies or substantial portions of the Software.
4186
+ *
4187
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4188
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4189
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4190
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4191
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4192
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4193
+ * THE SOFTWARE.
4194
+ */
4195
+ var MDCNotchedOutline = /** @class */ (function (_super) {
4196
+ __extends(MDCNotchedOutline, _super);
4197
+ function MDCNotchedOutline() {
4198
+ return _super !== null && _super.apply(this, arguments) || this;
4199
+ }
4200
+ MDCNotchedOutline.attachTo = function (root) {
4201
+ return new MDCNotchedOutline(root);
4202
+ };
4203
+ MDCNotchedOutline.prototype.initialSyncWithDOM = function () {
4204
+ this.notchElement =
4205
+ this.root.querySelector(strings$4.NOTCH_ELEMENT_SELECTOR);
4206
+ var label = this.root.querySelector('.' + MDCFloatingLabelFoundation.cssClasses.ROOT);
4207
+ if (label) {
4208
+ label.style.transitionDuration = '0s';
4209
+ this.root.classList.add(cssClasses$3.OUTLINE_UPGRADED);
4210
+ requestAnimationFrame(function () {
4211
+ label.style.transitionDuration = '';
4212
+ });
4213
+ }
4214
+ else {
4215
+ this.root.classList.add(cssClasses$3.NO_LABEL);
3052
4216
  }
3053
4217
  };
3054
- Object.defineProperty(MDCMenu.prototype, "items", {
3055
- /**
3056
- * Return the items within the menu. Note that this only contains the set of elements within
3057
- * the items container that are proper list items, and not supplemental / presentational DOM
3058
- * elements.
3059
- */
3060
- get: function () {
3061
- return this.list ? this.list.listElements : [];
3062
- },
3063
- enumerable: false,
3064
- configurable: true
3065
- });
3066
- Object.defineProperty(MDCMenu.prototype, "singleSelection", {
3067
- /**
3068
- * Turns on/off the underlying list's single selection mode. Used mainly
3069
- * by select menu.
3070
- *
3071
- * @param singleSelection Whether to enable single selection mode.
3072
- */
3073
- set: function (singleSelection) {
3074
- if (this.list) {
3075
- this.list.singleSelection = singleSelection;
4218
+ /**
4219
+ * Updates classes and styles to open the notch to the specified width.
4220
+ * @param notchWidth The notch width in the outline.
4221
+ */
4222
+ MDCNotchedOutline.prototype.notch = function (notchWidth) {
4223
+ this.foundation.notch(notchWidth);
4224
+ };
4225
+ /**
4226
+ * Updates classes and styles to close the notch.
4227
+ */
4228
+ MDCNotchedOutline.prototype.closeNotch = function () {
4229
+ this.foundation.closeNotch();
4230
+ };
4231
+ MDCNotchedOutline.prototype.getDefaultFoundation = function () {
4232
+ var _this = this;
4233
+ // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
4234
+ // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
4235
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
4236
+ var adapter = {
4237
+ addClass: function (className) { return _this.root.classList.add(className); },
4238
+ removeClass: function (className) { return _this.root.classList.remove(className); },
4239
+ setNotchWidthProperty: function (width) {
4240
+ _this.notchElement.style.setProperty('width', width + 'px');
4241
+ },
4242
+ removeNotchWidthProperty: function () {
4243
+ _this.notchElement.style.removeProperty('width');
4244
+ },
4245
+ };
4246
+ // tslint:enable:object-literal-sort-keys
4247
+ return new MDCNotchedOutlineFoundation(adapter);
4248
+ };
4249
+ return MDCNotchedOutline;
4250
+ }(MDCComponent));
4251
+
4252
+ /**
4253
+ * @license
4254
+ * Copyright 2019 Google Inc.
4255
+ *
4256
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4257
+ * of this software and associated documentation files (the "Software"), to deal
4258
+ * in the Software without restriction, including without limitation the rights
4259
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4260
+ * copies of the Software, and to permit persons to whom the Software is
4261
+ * furnished to do so, subject to the following conditions:
4262
+ *
4263
+ * The above copyright notice and this permission notice shall be included in
4264
+ * all copies or substantial portions of the Software.
4265
+ *
4266
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4267
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4268
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4269
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4270
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4271
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4272
+ * THE SOFTWARE.
4273
+ */
4274
+ /**
4275
+ * Determine whether the current browser supports passive event listeners, and
4276
+ * if so, use them.
4277
+ */
4278
+ function applyPassive(globalObj) {
4279
+ if (globalObj === void 0) { globalObj = window; }
4280
+ return supportsPassiveOption(globalObj) ?
4281
+ { passive: true } :
4282
+ false;
4283
+ }
4284
+ function supportsPassiveOption(globalObj) {
4285
+ if (globalObj === void 0) { globalObj = window; }
4286
+ // See
4287
+ // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
4288
+ var passiveSupported = false;
4289
+ try {
4290
+ var options = {
4291
+ // This function will be called when the browser
4292
+ // attempts to access the passive property.
4293
+ get passive() {
4294
+ passiveSupported = true;
4295
+ return false;
3076
4296
  }
4297
+ };
4298
+ var handler = function () { };
4299
+ globalObj.document.addEventListener('test', handler, options);
4300
+ globalObj.document.removeEventListener('test', handler, options);
4301
+ }
4302
+ catch (err) {
4303
+ passiveSupported = false;
4304
+ }
4305
+ return passiveSupported;
4306
+ }
4307
+
4308
+ /**
4309
+ * @license
4310
+ * Copyright 2016 Google Inc.
4311
+ *
4312
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4313
+ * of this software and associated documentation files (the "Software"), to deal
4314
+ * in the Software without restriction, including without limitation the rights
4315
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4316
+ * copies of the Software, and to permit persons to whom the Software is
4317
+ * furnished to do so, subject to the following conditions:
4318
+ *
4319
+ * The above copyright notice and this permission notice shall be included in
4320
+ * all copies or substantial portions of the Software.
4321
+ *
4322
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4323
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4324
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4325
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4326
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4327
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4328
+ * THE SOFTWARE.
4329
+ */
4330
+ var cssClasses$2 = {
4331
+ // Ripple is a special case where the "root" component is really a "mixin" of sorts,
4332
+ // given that it's an 'upgrade' to an existing component. That being said it is the root
4333
+ // CSS class that all other CSS classes derive from.
4334
+ BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
4335
+ FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
4336
+ FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
4337
+ ROOT: 'mdc-ripple-upgraded',
4338
+ UNBOUNDED: 'mdc-ripple-upgraded--unbounded',
4339
+ };
4340
+ var strings$3 = {
4341
+ VAR_FG_SCALE: '--mdc-ripple-fg-scale',
4342
+ VAR_FG_SIZE: '--mdc-ripple-fg-size',
4343
+ VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
4344
+ VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
4345
+ VAR_LEFT: '--mdc-ripple-left',
4346
+ VAR_TOP: '--mdc-ripple-top',
4347
+ };
4348
+ var numbers$1 = {
4349
+ DEACTIVATION_TIMEOUT_MS: 225,
4350
+ FG_DEACTIVATION_MS: 150,
4351
+ INITIAL_ORIGIN_SCALE: 0.6,
4352
+ PADDING: 10,
4353
+ TAP_DELAY_MS: 300, // Delay between touch and simulated mouse events on touch devices
4354
+ };
4355
+
4356
+ /**
4357
+ * Stores result from supportsCssVariables to avoid redundant processing to
4358
+ * detect CSS custom variable support.
4359
+ */
4360
+ var supportsCssVariables_;
4361
+ function supportsCssVariables(windowObj, forceRefresh) {
4362
+ if (forceRefresh === void 0) { forceRefresh = false; }
4363
+ var CSS = windowObj.CSS;
4364
+ var supportsCssVars = supportsCssVariables_;
4365
+ if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
4366
+ return supportsCssVariables_;
4367
+ }
4368
+ var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
4369
+ if (!supportsFunctionPresent) {
4370
+ return false;
4371
+ }
4372
+ var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
4373
+ // See: https://bugs.webkit.org/show_bug.cgi?id=154669
4374
+ // See: README section on Safari
4375
+ var weAreFeatureDetectingSafari10plus = (CSS.supports('(--css-vars: yes)') &&
4376
+ CSS.supports('color', '#00000000'));
4377
+ supportsCssVars =
4378
+ explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
4379
+ if (!forceRefresh) {
4380
+ supportsCssVariables_ = supportsCssVars;
4381
+ }
4382
+ return supportsCssVars;
4383
+ }
4384
+ function getNormalizedEventCoords(evt, pageOffset, clientRect) {
4385
+ if (!evt) {
4386
+ return { x: 0, y: 0 };
4387
+ }
4388
+ var x = pageOffset.x, y = pageOffset.y;
4389
+ var documentX = x + clientRect.left;
4390
+ var documentY = y + clientRect.top;
4391
+ var normalizedX;
4392
+ var normalizedY;
4393
+ // Determine touch point relative to the ripple container.
4394
+ if (evt.type === 'touchstart') {
4395
+ var touchEvent = evt;
4396
+ normalizedX = touchEvent.changedTouches[0].pageX - documentX;
4397
+ normalizedY = touchEvent.changedTouches[0].pageY - documentY;
4398
+ }
4399
+ else {
4400
+ var mouseEvent = evt;
4401
+ normalizedX = mouseEvent.pageX - documentX;
4402
+ normalizedY = mouseEvent.pageY - documentY;
4403
+ }
4404
+ return { x: normalizedX, y: normalizedY };
4405
+ }
4406
+
4407
+ /**
4408
+ * @license
4409
+ * Copyright 2016 Google Inc.
4410
+ *
4411
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4412
+ * of this software and associated documentation files (the "Software"), to deal
4413
+ * in the Software without restriction, including without limitation the rights
4414
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4415
+ * copies of the Software, and to permit persons to whom the Software is
4416
+ * furnished to do so, subject to the following conditions:
4417
+ *
4418
+ * The above copyright notice and this permission notice shall be included in
4419
+ * all copies or substantial portions of the Software.
4420
+ *
4421
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4422
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4423
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4424
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4425
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4426
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4427
+ * THE SOFTWARE.
4428
+ */
4429
+ // Activation events registered on the root element of each instance for activation
4430
+ var ACTIVATION_EVENT_TYPES = [
4431
+ 'touchstart', 'pointerdown', 'mousedown', 'keydown',
4432
+ ];
4433
+ // Deactivation events registered on documentElement when a pointer-related down event occurs
4434
+ var POINTER_DEACTIVATION_EVENT_TYPES = [
4435
+ 'touchend', 'pointerup', 'mouseup', 'contextmenu',
4436
+ ];
4437
+ // simultaneous nested activations
4438
+ var activatedTargets = [];
4439
+ var MDCRippleFoundation = /** @class */ (function (_super) {
4440
+ __extends(MDCRippleFoundation, _super);
4441
+ function MDCRippleFoundation(adapter) {
4442
+ var _this = _super.call(this, exports.__assign(exports.__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
4443
+ _this.activationAnimationHasEnded = false;
4444
+ _this.activationTimer = 0;
4445
+ _this.fgDeactivationRemovalTimer = 0;
4446
+ _this.fgScale = '0';
4447
+ _this.frame = { width: 0, height: 0 };
4448
+ _this.initialSize = 0;
4449
+ _this.layoutFrame = 0;
4450
+ _this.maxRadius = 0;
4451
+ _this.unboundedCoords = { left: 0, top: 0 };
4452
+ _this.activationState = _this.defaultActivationState();
4453
+ _this.activationTimerCallback = function () {
4454
+ _this.activationAnimationHasEnded = true;
4455
+ _this.runDeactivationUXLogicIfReady();
4456
+ };
4457
+ _this.activateHandler = function (e) {
4458
+ _this.activateImpl(e);
4459
+ };
4460
+ _this.deactivateHandler = function () {
4461
+ _this.deactivateImpl();
4462
+ };
4463
+ _this.focusHandler = function () {
4464
+ _this.handleFocus();
4465
+ };
4466
+ _this.blurHandler = function () {
4467
+ _this.handleBlur();
4468
+ };
4469
+ _this.resizeHandler = function () {
4470
+ _this.layout();
4471
+ };
4472
+ return _this;
4473
+ }
4474
+ Object.defineProperty(MDCRippleFoundation, "cssClasses", {
4475
+ get: function () {
4476
+ return cssClasses$2;
3077
4477
  },
3078
4478
  enumerable: false,
3079
4479
  configurable: true
3080
- });
3081
- Object.defineProperty(MDCMenu.prototype, "selectedIndex", {
3082
- /**
3083
- * Retrieves the selected index. Only applicable to select menus.
3084
- * @return The selected index, which is a number for single selection and
3085
- * radio lists, and an array of numbers for checkbox lists.
3086
- */
3087
- get: function () {
3088
- return this.list ? this.list.selectedIndex : numbers$2.UNSET_INDEX;
3089
- },
3090
- /**
3091
- * Sets the selected index of the list. Only applicable to select menus.
3092
- * @param index The selected index, which is a number for single selection and
3093
- * radio lists, and an array of numbers for checkbox lists.
3094
- */
3095
- set: function (index) {
3096
- if (this.list) {
3097
- this.list.selectedIndex = index;
3098
- }
4480
+ });
4481
+ Object.defineProperty(MDCRippleFoundation, "strings", {
4482
+ get: function () {
4483
+ return strings$3;
3099
4484
  },
3100
4485
  enumerable: false,
3101
4486
  configurable: true
3102
4487
  });
3103
- Object.defineProperty(MDCMenu.prototype, "quickOpen", {
3104
- set: function (quickOpen) {
3105
- this.menuSurface.quickOpen = quickOpen;
4488
+ Object.defineProperty(MDCRippleFoundation, "numbers", {
4489
+ get: function () {
4490
+ return numbers$1;
3106
4491
  },
3107
4492
  enumerable: false,
3108
4493
  configurable: true
3109
4494
  });
3110
- /**
3111
- * Sets default focus state where the menu should focus every time when menu
3112
- * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
3113
- * default.
3114
- * @param focusState Default focus state.
3115
- */
3116
- MDCMenu.prototype.setDefaultFocusState = function (focusState) {
3117
- this.foundation.setDefaultFocusState(focusState);
4495
+ Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
4496
+ get: function () {
4497
+ return {
4498
+ addClass: function () { return undefined; },
4499
+ browserSupportsCssVars: function () { return true; },
4500
+ computeBoundingRect: function () {
4501
+ return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });
4502
+ },
4503
+ containsEventTarget: function () { return true; },
4504
+ deregisterDocumentInteractionHandler: function () { return undefined; },
4505
+ deregisterInteractionHandler: function () { return undefined; },
4506
+ deregisterResizeHandler: function () { return undefined; },
4507
+ getWindowPageOffset: function () { return ({ x: 0, y: 0 }); },
4508
+ isSurfaceActive: function () { return true; },
4509
+ isSurfaceDisabled: function () { return true; },
4510
+ isUnbounded: function () { return true; },
4511
+ registerDocumentInteractionHandler: function () { return undefined; },
4512
+ registerInteractionHandler: function () { return undefined; },
4513
+ registerResizeHandler: function () { return undefined; },
4514
+ removeClass: function () { return undefined; },
4515
+ updateCssVariable: function () { return undefined; },
4516
+ };
4517
+ },
4518
+ enumerable: false,
4519
+ configurable: true
4520
+ });
4521
+ MDCRippleFoundation.prototype.init = function () {
4522
+ var _this = this;
4523
+ var supportsPressRipple = this.supportsPressRipple();
4524
+ this.registerRootHandlers(supportsPressRipple);
4525
+ if (supportsPressRipple) {
4526
+ var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED;
4527
+ requestAnimationFrame(function () {
4528
+ _this.adapter.addClass(ROOT_1);
4529
+ if (_this.adapter.isUnbounded()) {
4530
+ _this.adapter.addClass(UNBOUNDED_1);
4531
+ // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
4532
+ _this.layoutInternal();
4533
+ }
4534
+ });
4535
+ }
4536
+ };
4537
+ MDCRippleFoundation.prototype.destroy = function () {
4538
+ var _this = this;
4539
+ if (this.supportsPressRipple()) {
4540
+ if (this.activationTimer) {
4541
+ clearTimeout(this.activationTimer);
4542
+ this.activationTimer = 0;
4543
+ this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
4544
+ }
4545
+ if (this.fgDeactivationRemovalTimer) {
4546
+ clearTimeout(this.fgDeactivationRemovalTimer);
4547
+ this.fgDeactivationRemovalTimer = 0;
4548
+ this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
4549
+ }
4550
+ var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED;
4551
+ requestAnimationFrame(function () {
4552
+ _this.adapter.removeClass(ROOT_2);
4553
+ _this.adapter.removeClass(UNBOUNDED_2);
4554
+ _this.removeCssVars();
4555
+ });
4556
+ }
4557
+ this.deregisterRootHandlers();
4558
+ this.deregisterDeactivationHandlers();
3118
4559
  };
3119
4560
  /**
3120
- * @param corner Default anchor corner alignment of top-left menu corner.
4561
+ * @param evt Optional event containing position information.
3121
4562
  */
3122
- MDCMenu.prototype.setAnchorCorner = function (corner) {
3123
- this.menuSurface.setAnchorCorner(corner);
4563
+ MDCRippleFoundation.prototype.activate = function (evt) {
4564
+ this.activateImpl(evt);
3124
4565
  };
3125
- MDCMenu.prototype.setAnchorMargin = function (margin) {
3126
- this.menuSurface.setAnchorMargin(margin);
4566
+ MDCRippleFoundation.prototype.deactivate = function () {
4567
+ this.deactivateImpl();
3127
4568
  };
3128
- /**
3129
- * Sets the list item as the selected row at the specified index.
3130
- * @param index Index of list item within menu.
3131
- */
3132
- MDCMenu.prototype.setSelectedIndex = function (index) {
3133
- this.foundation.setSelectedIndex(index);
4569
+ MDCRippleFoundation.prototype.layout = function () {
4570
+ var _this = this;
4571
+ if (this.layoutFrame) {
4572
+ cancelAnimationFrame(this.layoutFrame);
4573
+ }
4574
+ this.layoutFrame = requestAnimationFrame(function () {
4575
+ _this.layoutInternal();
4576
+ _this.layoutFrame = 0;
4577
+ });
4578
+ };
4579
+ MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
4580
+ var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
4581
+ if (unbounded) {
4582
+ this.adapter.addClass(UNBOUNDED);
4583
+ }
4584
+ else {
4585
+ this.adapter.removeClass(UNBOUNDED);
4586
+ }
4587
+ };
4588
+ MDCRippleFoundation.prototype.handleFocus = function () {
4589
+ var _this = this;
4590
+ requestAnimationFrame(function () { return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); });
4591
+ };
4592
+ MDCRippleFoundation.prototype.handleBlur = function () {
4593
+ var _this = this;
4594
+ requestAnimationFrame(function () { return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); });
3134
4595
  };
3135
4596
  /**
3136
- * Sets the enabled state to isEnabled for the menu item at the given index.
3137
- * @param index Index of the menu item
3138
- * @param isEnabled The desired enabled state of the menu item.
4597
+ * We compute this property so that we are not querying information about the client
4598
+ * until the point in time where the foundation requests it. This prevents scenarios where
4599
+ * client-side feature-detection may happen too early, such as when components are rendered on the server
4600
+ * and then initialized at mount time on the client.
3139
4601
  */
3140
- MDCMenu.prototype.setEnabled = function (index, isEnabled) {
3141
- this.foundation.setEnabled(index, isEnabled);
4602
+ MDCRippleFoundation.prototype.supportsPressRipple = function () {
4603
+ return this.adapter.browserSupportsCssVars();
4604
+ };
4605
+ MDCRippleFoundation.prototype.defaultActivationState = function () {
4606
+ return {
4607
+ activationEvent: undefined,
4608
+ hasDeactivationUXRun: false,
4609
+ isActivated: false,
4610
+ isProgrammatic: false,
4611
+ wasActivatedByPointer: false,
4612
+ wasElementMadeActive: false,
4613
+ };
3142
4614
  };
3143
4615
  /**
3144
- * @return The item within the menu at the index specified.
4616
+ * supportsPressRipple Passed from init to save a redundant function call
3145
4617
  */
3146
- MDCMenu.prototype.getOptionByIndex = function (index) {
3147
- var items = this.items;
3148
- if (index < items.length) {
3149
- return this.items[index];
4618
+ MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
4619
+ var e_1, _a;
4620
+ if (supportsPressRipple) {
4621
+ try {
4622
+ for (var ACTIVATION_EVENT_TYPES_1 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next(); !ACTIVATION_EVENT_TYPES_1_1.done; ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next()) {
4623
+ var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
4624
+ this.adapter.registerInteractionHandler(evtType, this.activateHandler);
4625
+ }
4626
+ }
4627
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4628
+ finally {
4629
+ try {
4630
+ if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);
4631
+ }
4632
+ finally { if (e_1) throw e_1.error; }
4633
+ }
4634
+ if (this.adapter.isUnbounded()) {
4635
+ this.adapter.registerResizeHandler(this.resizeHandler);
4636
+ }
4637
+ }
4638
+ this.adapter.registerInteractionHandler('focus', this.focusHandler);
4639
+ this.adapter.registerInteractionHandler('blur', this.blurHandler);
4640
+ };
4641
+ MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
4642
+ var e_2, _a;
4643
+ if (evt.type === 'keydown') {
4644
+ this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
3150
4645
  }
3151
4646
  else {
3152
- return null;
4647
+ try {
4648
+ for (var POINTER_DEACTIVATION_EVENT_TYPES_1 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next(); !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done; POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next()) {
4649
+ var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
4650
+ this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
4651
+ }
4652
+ }
4653
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
4654
+ finally {
4655
+ try {
4656
+ if (POINTER_DEACTIVATION_EVENT_TYPES_1_1 && !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_1.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_1);
4657
+ }
4658
+ finally { if (e_2) throw e_2.error; }
4659
+ }
3153
4660
  }
3154
4661
  };
3155
- /**
3156
- * @param index A menu item's index.
3157
- * @return The primary text within the menu at the index specified.
3158
- */
3159
- MDCMenu.prototype.getPrimaryTextAtIndex = function (index) {
3160
- var item = this.getOptionByIndex(index);
3161
- if (item && this.list) {
3162
- return this.list.getPrimaryText(item) || '';
4662
+ MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
4663
+ var e_3, _a;
4664
+ try {
4665
+ for (var ACTIVATION_EVENT_TYPES_2 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next(); !ACTIVATION_EVENT_TYPES_2_1.done; ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next()) {
4666
+ var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
4667
+ this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
4668
+ }
4669
+ }
4670
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
4671
+ finally {
4672
+ try {
4673
+ if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);
4674
+ }
4675
+ finally { if (e_3) throw e_3.error; }
4676
+ }
4677
+ this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
4678
+ this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
4679
+ if (this.adapter.isUnbounded()) {
4680
+ this.adapter.deregisterResizeHandler(this.resizeHandler);
3163
4681
  }
3164
- return '';
3165
4682
  };
3166
- MDCMenu.prototype.setFixedPosition = function (isFixed) {
3167
- this.menuSurface.setFixedPosition(isFixed);
4683
+ MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
4684
+ var e_4, _a;
4685
+ this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
4686
+ try {
4687
+ for (var POINTER_DEACTIVATION_EVENT_TYPES_2 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next(); !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done; POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next()) {
4688
+ var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
4689
+ this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
4690
+ }
4691
+ }
4692
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
4693
+ finally {
4694
+ try {
4695
+ if (POINTER_DEACTIVATION_EVENT_TYPES_2_1 && !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_2.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_2);
4696
+ }
4697
+ finally { if (e_4) throw e_4.error; }
4698
+ }
3168
4699
  };
3169
- MDCMenu.prototype.setIsHoisted = function (isHoisted) {
3170
- this.menuSurface.setIsHoisted(isHoisted);
4700
+ MDCRippleFoundation.prototype.removeCssVars = function () {
4701
+ var _this = this;
4702
+ var rippleStrings = MDCRippleFoundation.strings;
4703
+ var keys = Object.keys(rippleStrings);
4704
+ keys.forEach(function (key) {
4705
+ if (key.indexOf('VAR_') === 0) {
4706
+ _this.adapter.updateCssVariable(rippleStrings[key], null);
4707
+ }
4708
+ });
3171
4709
  };
3172
- MDCMenu.prototype.setAbsolutePosition = function (x, y) {
3173
- this.menuSurface.setAbsolutePosition(x, y);
4710
+ MDCRippleFoundation.prototype.activateImpl = function (evt) {
4711
+ var _this = this;
4712
+ if (this.adapter.isSurfaceDisabled()) {
4713
+ return;
4714
+ }
4715
+ var activationState = this.activationState;
4716
+ if (activationState.isActivated) {
4717
+ return;
4718
+ }
4719
+ // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
4720
+ var previousActivationEvent = this.previousActivationEvent;
4721
+ var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
4722
+ if (isSameInteraction) {
4723
+ return;
4724
+ }
4725
+ activationState.isActivated = true;
4726
+ activationState.isProgrammatic = evt === undefined;
4727
+ activationState.activationEvent = evt;
4728
+ activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
4729
+ var hasActivatedChild = evt !== undefined &&
4730
+ activatedTargets.length > 0 &&
4731
+ activatedTargets.some(function (target) { return _this.adapter.containsEventTarget(target); });
4732
+ if (hasActivatedChild) {
4733
+ // Immediately reset activation state, while preserving logic that prevents touch follow-on events
4734
+ this.resetActivationState();
4735
+ return;
4736
+ }
4737
+ if (evt !== undefined) {
4738
+ activatedTargets.push(evt.target);
4739
+ this.registerDeactivationHandlers(evt);
4740
+ }
4741
+ activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
4742
+ if (activationState.wasElementMadeActive) {
4743
+ this.animateActivation();
4744
+ }
4745
+ requestAnimationFrame(function () {
4746
+ // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
4747
+ activatedTargets = [];
4748
+ if (!activationState.wasElementMadeActive
4749
+ && evt !== undefined
4750
+ && (evt.key === ' ' || evt.keyCode === 32)) {
4751
+ // If space was pressed, try again within an rAF call to detect :active, because different UAs report
4752
+ // active states inconsistently when they're called within event handling code:
4753
+ // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
4754
+ // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
4755
+ // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
4756
+ // variable is set within a rAF callback for a submit button interaction (#2241).
4757
+ activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
4758
+ if (activationState.wasElementMadeActive) {
4759
+ _this.animateActivation();
4760
+ }
4761
+ }
4762
+ if (!activationState.wasElementMadeActive) {
4763
+ // Reset activation state immediately if element was not made active.
4764
+ _this.activationState = _this.defaultActivationState();
4765
+ }
4766
+ });
3174
4767
  };
3175
- /**
3176
- * Sets the element that the menu-surface is anchored to.
3177
- */
3178
- MDCMenu.prototype.setAnchorElement = function (element) {
3179
- this.menuSurface.anchorElement = element;
4768
+ MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
4769
+ return (evt !== undefined && evt.type === 'keydown') ?
4770
+ this.adapter.isSurfaceActive() :
4771
+ true;
3180
4772
  };
3181
- MDCMenu.prototype.getDefaultFoundation = function () {
4773
+ MDCRippleFoundation.prototype.animateActivation = function () {
3182
4774
  var _this = this;
3183
- // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
3184
- // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
3185
- // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
3186
- var adapter = {
3187
- addClassToElementAtIndex: function (index, className) {
3188
- var list = _this.items;
3189
- list[index].classList.add(className);
3190
- },
3191
- removeClassFromElementAtIndex: function (index, className) {
3192
- var list = _this.items;
3193
- list[index].classList.remove(className);
3194
- },
3195
- addAttributeToElementAtIndex: function (index, attr, value) {
3196
- var list = _this.items;
3197
- list[index].setAttribute(attr, value);
3198
- },
3199
- removeAttributeFromElementAtIndex: function (index, attr) {
3200
- var list = _this.items;
3201
- list[index].removeAttribute(attr);
3202
- },
3203
- getAttributeFromElementAtIndex: function (index, attr) {
3204
- var list = _this.items;
3205
- return list[index].getAttribute(attr);
4775
+ var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
4776
+ var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION;
4777
+ var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
4778
+ this.layoutInternal();
4779
+ var translateStart = '';
4780
+ var translateEnd = '';
4781
+ if (!this.adapter.isUnbounded()) {
4782
+ var _c = this.getFgTranslationCoordinates(), startPoint = _c.startPoint, endPoint = _c.endPoint;
4783
+ translateStart = startPoint.x + "px, " + startPoint.y + "px";
4784
+ translateEnd = endPoint.x + "px, " + endPoint.y + "px";
4785
+ }
4786
+ this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
4787
+ this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
4788
+ // Cancel any ongoing activation/deactivation animations
4789
+ clearTimeout(this.activationTimer);
4790
+ clearTimeout(this.fgDeactivationRemovalTimer);
4791
+ this.rmBoundedActivationClasses();
4792
+ this.adapter.removeClass(FG_DEACTIVATION);
4793
+ // Force layout in order to re-trigger the animation.
4794
+ this.adapter.computeBoundingRect();
4795
+ this.adapter.addClass(FG_ACTIVATION);
4796
+ this.activationTimer = setTimeout(function () {
4797
+ _this.activationTimerCallback();
4798
+ }, DEACTIVATION_TIMEOUT_MS);
4799
+ };
4800
+ MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
4801
+ var _a = this.activationState, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer;
4802
+ var startPoint;
4803
+ if (wasActivatedByPointer) {
4804
+ startPoint = getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
4805
+ }
4806
+ else {
4807
+ startPoint = {
4808
+ x: this.frame.width / 2,
4809
+ y: this.frame.height / 2,
4810
+ };
4811
+ }
4812
+ // Center the element around the start point.
4813
+ startPoint = {
4814
+ x: startPoint.x - (this.initialSize / 2),
4815
+ y: startPoint.y - (this.initialSize / 2),
4816
+ };
4817
+ var endPoint = {
4818
+ x: (this.frame.width / 2) - (this.initialSize / 2),
4819
+ y: (this.frame.height / 2) - (this.initialSize / 2),
4820
+ };
4821
+ return { startPoint: startPoint, endPoint: endPoint };
4822
+ };
4823
+ MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
4824
+ var _this = this;
4825
+ // This method is called both when a pointing device is released, and when the activation animation ends.
4826
+ // The deactivation animation should only run after both of those occur.
4827
+ var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
4828
+ var _a = this.activationState, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated;
4829
+ var activationHasEnded = hasDeactivationUXRun || !isActivated;
4830
+ if (activationHasEnded && this.activationAnimationHasEnded) {
4831
+ this.rmBoundedActivationClasses();
4832
+ this.adapter.addClass(FG_DEACTIVATION);
4833
+ this.fgDeactivationRemovalTimer = setTimeout(function () {
4834
+ _this.adapter.removeClass(FG_DEACTIVATION);
4835
+ }, numbers$1.FG_DEACTIVATION_MS);
4836
+ }
4837
+ };
4838
+ MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
4839
+ var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
4840
+ this.adapter.removeClass(FG_ACTIVATION);
4841
+ this.activationAnimationHasEnded = false;
4842
+ this.adapter.computeBoundingRect();
4843
+ };
4844
+ MDCRippleFoundation.prototype.resetActivationState = function () {
4845
+ var _this = this;
4846
+ this.previousActivationEvent = this.activationState.activationEvent;
4847
+ this.activationState = this.defaultActivationState();
4848
+ // Touch devices may fire additional events for the same interaction within a short time.
4849
+ // Store the previous event until it's safe to assume that subsequent events are for new interactions.
4850
+ setTimeout(function () { return _this.previousActivationEvent = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
4851
+ };
4852
+ MDCRippleFoundation.prototype.deactivateImpl = function () {
4853
+ var _this = this;
4854
+ var activationState = this.activationState;
4855
+ // This can happen in scenarios such as when you have a keyup event that blurs the element.
4856
+ if (!activationState.isActivated) {
4857
+ return;
4858
+ }
4859
+ var state = exports.__assign({}, activationState);
4860
+ if (activationState.isProgrammatic) {
4861
+ requestAnimationFrame(function () {
4862
+ _this.animateDeactivation(state);
4863
+ });
4864
+ this.resetActivationState();
4865
+ }
4866
+ else {
4867
+ this.deregisterDeactivationHandlers();
4868
+ requestAnimationFrame(function () {
4869
+ _this.activationState.hasDeactivationUXRun = true;
4870
+ _this.animateDeactivation(state);
4871
+ _this.resetActivationState();
4872
+ });
4873
+ }
4874
+ };
4875
+ MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
4876
+ var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive;
4877
+ if (wasActivatedByPointer || wasElementMadeActive) {
4878
+ this.runDeactivationUXLogicIfReady();
4879
+ }
4880
+ };
4881
+ MDCRippleFoundation.prototype.layoutInternal = function () {
4882
+ var _this = this;
4883
+ this.frame = this.adapter.computeBoundingRect();
4884
+ var maxDim = Math.max(this.frame.height, this.frame.width);
4885
+ // Surface diameter is treated differently for unbounded vs. bounded ripples.
4886
+ // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
4887
+ // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
4888
+ // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
4889
+ // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
4890
+ // `overflow: hidden`.
4891
+ var getBoundedRadius = function () {
4892
+ var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
4893
+ return hypotenuse + MDCRippleFoundation.numbers.PADDING;
4894
+ };
4895
+ this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
4896
+ // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
4897
+ var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
4898
+ // Unbounded ripple size should always be even number to equally center align.
4899
+ if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
4900
+ this.initialSize = initialSize - 1;
4901
+ }
4902
+ else {
4903
+ this.initialSize = initialSize;
4904
+ }
4905
+ this.fgScale = "" + this.maxRadius / this.initialSize;
4906
+ this.updateLayoutCssVars();
4907
+ };
4908
+ MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
4909
+ var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE;
4910
+ this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
4911
+ this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
4912
+ if (this.adapter.isUnbounded()) {
4913
+ this.unboundedCoords = {
4914
+ left: Math.round((this.frame.width / 2) - (this.initialSize / 2)),
4915
+ top: Math.round((this.frame.height / 2) - (this.initialSize / 2)),
4916
+ };
4917
+ this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
4918
+ this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
4919
+ }
4920
+ };
4921
+ return MDCRippleFoundation;
4922
+ }(MDCFoundation));
4923
+
4924
+ /**
4925
+ * @license
4926
+ * Copyright 2016 Google Inc.
4927
+ *
4928
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4929
+ * of this software and associated documentation files (the "Software"), to deal
4930
+ * in the Software without restriction, including without limitation the rights
4931
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4932
+ * copies of the Software, and to permit persons to whom the Software is
4933
+ * furnished to do so, subject to the following conditions:
4934
+ *
4935
+ * The above copyright notice and this permission notice shall be included in
4936
+ * all copies or substantial portions of the Software.
4937
+ *
4938
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4939
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4940
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4941
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4942
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4943
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4944
+ * THE SOFTWARE.
4945
+ */
4946
+ var MDCRipple = /** @class */ (function (_super) {
4947
+ __extends(MDCRipple, _super);
4948
+ function MDCRipple() {
4949
+ var _this = _super !== null && _super.apply(this, arguments) || this;
4950
+ _this.disabled = false;
4951
+ return _this;
4952
+ }
4953
+ MDCRipple.attachTo = function (root, opts) {
4954
+ if (opts === void 0) { opts = {
4955
+ isUnbounded: undefined
4956
+ }; }
4957
+ var ripple = new MDCRipple(root);
4958
+ // Only override unbounded behavior if option is explicitly specified
4959
+ if (opts.isUnbounded !== undefined) {
4960
+ ripple.unbounded = opts.isUnbounded;
4961
+ }
4962
+ return ripple;
4963
+ };
4964
+ MDCRipple.createAdapter = function (instance) {
4965
+ return {
4966
+ addClass: function (className) { return instance.root.classList.add(className); },
4967
+ browserSupportsCssVars: function () { return supportsCssVariables(window); },
4968
+ computeBoundingRect: function () { return instance.root.getBoundingClientRect(); },
4969
+ containsEventTarget: function (target) { return instance.root.contains(target); },
4970
+ deregisterDocumentInteractionHandler: function (evtType, handler) {
4971
+ return document.documentElement.removeEventListener(evtType, handler, applyPassive());
3206
4972
  },
3207
- elementContainsClass: function (element, className) {
3208
- return element.classList.contains(className);
4973
+ deregisterInteractionHandler: function (evtType, handler) {
4974
+ return instance.root
4975
+ .removeEventListener(evtType, handler, applyPassive());
3209
4976
  },
3210
- closeSurface: function (skipRestoreFocus) {
3211
- _this.menuSurface.close(skipRestoreFocus);
4977
+ deregisterResizeHandler: function (handler) {
4978
+ return window.removeEventListener('resize', handler);
3212
4979
  },
3213
- getElementIndex: function (element) { return _this.items.indexOf(element); },
3214
- notifySelected: function (evtData) {
3215
- _this.emit(strings$3.SELECTED_EVENT, {
3216
- index: evtData.index,
3217
- item: _this.items[evtData.index],
3218
- });
4980
+ getWindowPageOffset: function () {
4981
+ return ({ x: window.pageXOffset, y: window.pageYOffset });
3219
4982
  },
3220
- getMenuItemCount: function () { return _this.items.length; },
3221
- focusItemAtIndex: function (index) {
3222
- _this.items[index].focus();
4983
+ isSurfaceActive: function () { return matches(instance.root, ':active'); },
4984
+ isSurfaceDisabled: function () { return Boolean(instance.disabled); },
4985
+ isUnbounded: function () { return Boolean(instance.unbounded); },
4986
+ registerDocumentInteractionHandler: function (evtType, handler) {
4987
+ return document.documentElement.addEventListener(evtType, handler, applyPassive());
3223
4988
  },
3224
- focusListRoot: function () {
3225
- _this.root.querySelector(strings$3.LIST_SELECTOR).focus();
4989
+ registerInteractionHandler: function (evtType, handler) {
4990
+ return instance.root
4991
+ .addEventListener(evtType, handler, applyPassive());
3226
4992
  },
3227
- isSelectableItemAtIndex: function (index) {
3228
- return !!component.closest(_this.items[index], "." + cssClasses$2.MENU_SELECTION_GROUP);
4993
+ registerResizeHandler: function (handler) {
4994
+ return window.addEventListener('resize', handler);
3229
4995
  },
3230
- getSelectedSiblingOfItemAtIndex: function (index) {
3231
- var selectionGroupEl = component.closest(_this.items[index], "." + cssClasses$2.MENU_SELECTION_GROUP);
3232
- var selectedItemEl = selectionGroupEl.querySelector("." + cssClasses$2.MENU_SELECTED_LIST_ITEM);
3233
- return selectedItemEl ? _this.items.indexOf(selectedItemEl) : -1;
4996
+ removeClass: function (className) { return instance.root.classList.remove(className); },
4997
+ updateCssVariable: function (varName, value) {
4998
+ return instance.root.style.setProperty(varName, value);
3234
4999
  },
3235
5000
  };
3236
- // tslint:enable:object-literal-sort-keys
3237
- return new MDCMenuFoundation(adapter);
3238
5001
  };
3239
- return MDCMenu;
3240
- }(component.MDCComponent));
5002
+ Object.defineProperty(MDCRipple.prototype, "unbounded", {
5003
+ get: function () {
5004
+ return Boolean(this.isUnbounded);
5005
+ },
5006
+ set: function (unbounded) {
5007
+ this.isUnbounded = Boolean(unbounded);
5008
+ this.setUnbounded();
5009
+ },
5010
+ enumerable: false,
5011
+ configurable: true
5012
+ });
5013
+ MDCRipple.prototype.activate = function () {
5014
+ this.foundation.activate();
5015
+ };
5016
+ MDCRipple.prototype.deactivate = function () {
5017
+ this.foundation.deactivate();
5018
+ };
5019
+ MDCRipple.prototype.layout = function () {
5020
+ this.foundation.layout();
5021
+ };
5022
+ MDCRipple.prototype.getDefaultFoundation = function () {
5023
+ return new MDCRippleFoundation(MDCRipple.createAdapter(this));
5024
+ };
5025
+ MDCRipple.prototype.initialSyncWithDOM = function () {
5026
+ var root = this.root;
5027
+ this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset;
5028
+ };
5029
+ /**
5030
+ * Closure Compiler throws an access control error when directly accessing a
5031
+ * protected or private property inside a getter/setter, like unbounded above.
5032
+ * By accessing the protected property inside a method, we solve that problem.
5033
+ * That's why this function exists.
5034
+ */
5035
+ MDCRipple.prototype.setUnbounded = function () {
5036
+ this.foundation.setUnbounded(Boolean(this.isUnbounded));
5037
+ };
5038
+ return MDCRipple;
5039
+ }(MDCComponent));
3241
5040
 
3242
5041
  /**
3243
5042
  * @license
@@ -3316,7 +5115,7 @@ var numbers = {
3316
5115
  * THE SOFTWARE.
3317
5116
  */
3318
5117
  var MDCSelectFoundation = /** @class */ (function (_super) {
3319
- component.__extends(MDCSelectFoundation, _super);
5118
+ __extends(MDCSelectFoundation, _super);
3320
5119
  /* istanbul ignore next: optional argument is not a branch statement */
3321
5120
  /**
3322
5121
  * @param adapter
@@ -3324,7 +5123,7 @@ var MDCSelectFoundation = /** @class */ (function (_super) {
3324
5123
  */
3325
5124
  function MDCSelectFoundation(adapter, foundationMap) {
3326
5125
  if (foundationMap === void 0) { foundationMap = {}; }
3327
- var _this = _super.call(this, component.__assign(component.__assign({}, MDCSelectFoundation.defaultAdapter), adapter)) || this;
5126
+ var _this = _super.call(this, exports.__assign(exports.__assign({}, MDCSelectFoundation.defaultAdapter), adapter)) || this;
3328
5127
  // Disabled state
3329
5128
  _this.disabled = false;
3330
5129
  // isMenuOpen is used to track the state of the menu by listening to the
@@ -3731,7 +5530,7 @@ var MDCSelectFoundation = /** @class */ (function (_super) {
3731
5530
  this.recentlyClicked = true;
3732
5531
  };
3733
5532
  return MDCSelectFoundation;
3734
- }(component.MDCFoundation));
5533
+ }(MDCFoundation));
3735
5534
 
3736
5535
  /**
3737
5536
  * @license
@@ -3787,9 +5586,9 @@ var cssClasses = {
3787
5586
  * THE SOFTWARE.
3788
5587
  */
3789
5588
  var MDCSelectHelperTextFoundation = /** @class */ (function (_super) {
3790
- component.__extends(MDCSelectHelperTextFoundation, _super);
5589
+ __extends(MDCSelectHelperTextFoundation, _super);
3791
5590
  function MDCSelectHelperTextFoundation(adapter) {
3792
- return _super.call(this, component.__assign(component.__assign({}, MDCSelectHelperTextFoundation.defaultAdapter), adapter)) || this;
5591
+ return _super.call(this, exports.__assign(exports.__assign({}, MDCSelectHelperTextFoundation.defaultAdapter), adapter)) || this;
3793
5592
  }
3794
5593
  Object.defineProperty(MDCSelectHelperTextFoundation, "cssClasses", {
3795
5594
  get: function () {
@@ -3931,7 +5730,7 @@ var MDCSelectHelperTextFoundation = /** @class */ (function (_super) {
3931
5730
  this.adapter.setAttr(strings$1.ARIA_HIDDEN, 'true');
3932
5731
  };
3933
5732
  return MDCSelectHelperTextFoundation;
3934
- }(component.MDCFoundation));
5733
+ }(MDCFoundation));
3935
5734
 
3936
5735
  /**
3937
5736
  * @license
@@ -3956,7 +5755,7 @@ var MDCSelectHelperTextFoundation = /** @class */ (function (_super) {
3956
5755
  * THE SOFTWARE.
3957
5756
  */
3958
5757
  var MDCSelectHelperText = /** @class */ (function (_super) {
3959
- component.__extends(MDCSelectHelperText, _super);
5758
+ __extends(MDCSelectHelperText, _super);
3960
5759
  function MDCSelectHelperText() {
3961
5760
  return _super !== null && _super.apply(this, arguments) || this;
3962
5761
  }
@@ -3991,7 +5790,7 @@ var MDCSelectHelperText = /** @class */ (function (_super) {
3991
5790
  return new MDCSelectHelperTextFoundation(adapter);
3992
5791
  };
3993
5792
  return MDCSelectHelperText;
3994
- }(component.MDCComponent));
5793
+ }(MDCComponent));
3995
5794
 
3996
5795
  /**
3997
5796
  * @license
@@ -4044,9 +5843,9 @@ var strings = {
4044
5843
  */
4045
5844
  var INTERACTION_EVENTS = ['click', 'keydown'];
4046
5845
  var MDCSelectIconFoundation = /** @class */ (function (_super) {
4047
- component.__extends(MDCSelectIconFoundation, _super);
5846
+ __extends(MDCSelectIconFoundation, _super);
4048
5847
  function MDCSelectIconFoundation(adapter) {
4049
- var _this = _super.call(this, component.__assign(component.__assign({}, MDCSelectIconFoundation.defaultAdapter), adapter)) || this;
5848
+ var _this = _super.call(this, exports.__assign(exports.__assign({}, MDCSelectIconFoundation.defaultAdapter), adapter)) || this;
4050
5849
  _this.savedTabIndex = null;
4051
5850
  _this.interactionHandler = function (evt) {
4052
5851
  _this.handleInteraction(evt);
@@ -4084,7 +5883,7 @@ var MDCSelectIconFoundation = /** @class */ (function (_super) {
4084
5883
  var e_1, _a;
4085
5884
  this.savedTabIndex = this.adapter.getAttr('tabindex');
4086
5885
  try {
4087
- for (var INTERACTION_EVENTS_1 = component.__values(INTERACTION_EVENTS), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {
5886
+ for (var INTERACTION_EVENTS_1 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {
4088
5887
  var evtType = INTERACTION_EVENTS_1_1.value;
4089
5888
  this.adapter.registerInteractionHandler(evtType, this.interactionHandler);
4090
5889
  }
@@ -4100,7 +5899,7 @@ var MDCSelectIconFoundation = /** @class */ (function (_super) {
4100
5899
  MDCSelectIconFoundation.prototype.destroy = function () {
4101
5900
  var e_2, _a;
4102
5901
  try {
4103
- for (var INTERACTION_EVENTS_2 = component.__values(INTERACTION_EVENTS), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {
5902
+ for (var INTERACTION_EVENTS_2 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {
4104
5903
  var evtType = INTERACTION_EVENTS_2_1.value;
4105
5904
  this.adapter.deregisterInteractionHandler(evtType, this.interactionHandler);
4106
5905
  }
@@ -4139,7 +5938,7 @@ var MDCSelectIconFoundation = /** @class */ (function (_super) {
4139
5938
  }
4140
5939
  };
4141
5940
  return MDCSelectIconFoundation;
4142
- }(component.MDCFoundation));
5941
+ }(MDCFoundation));
4143
5942
 
4144
5943
  /**
4145
5944
  * @license
@@ -4164,7 +5963,7 @@ var MDCSelectIconFoundation = /** @class */ (function (_super) {
4164
5963
  * THE SOFTWARE.
4165
5964
  */
4166
5965
  var MDCSelectIcon = /** @class */ (function (_super) {
4167
- component.__extends(MDCSelectIcon, _super);
5966
+ __extends(MDCSelectIcon, _super);
4168
5967
  function MDCSelectIcon() {
4169
5968
  return _super !== null && _super.apply(this, arguments) || this;
4170
5969
  }
@@ -4203,7 +6002,7 @@ var MDCSelectIcon = /** @class */ (function (_super) {
4203
6002
  return new MDCSelectIconFoundation(adapter);
4204
6003
  };
4205
6004
  return MDCSelectIcon;
4206
- }(component.MDCComponent));
6005
+ }(MDCComponent));
4207
6006
 
4208
6007
  /**
4209
6008
  * @license
@@ -4228,7 +6027,7 @@ var MDCSelectIcon = /** @class */ (function (_super) {
4228
6027
  * THE SOFTWARE.
4229
6028
  */
4230
6029
  var MDCSelect = /** @class */ (function (_super) {
4231
- component.__extends(MDCSelect, _super);
6030
+ __extends(MDCSelect, _super);
4232
6031
  function MDCSelect() {
4233
6032
  return _super !== null && _super.apply(this, arguments) || this;
4234
6033
  }
@@ -4236,9 +6035,9 @@ var MDCSelect = /** @class */ (function (_super) {
4236
6035
  return new MDCSelect(root);
4237
6036
  };
4238
6037
  MDCSelect.prototype.initialize = function (labelFactory, lineRippleFactory, outlineFactory, menuFactory, iconFactory, helperTextFactory) {
4239
- if (labelFactory === void 0) { labelFactory = function (el) { return new component.MDCFloatingLabel(el); }; }
4240
- if (lineRippleFactory === void 0) { lineRippleFactory = function (el) { return new component.MDCLineRipple(el); }; }
4241
- if (outlineFactory === void 0) { outlineFactory = function (el) { return new component.MDCNotchedOutline(el); }; }
6038
+ if (labelFactory === void 0) { labelFactory = function (el) { return new MDCFloatingLabel(el); }; }
6039
+ if (lineRippleFactory === void 0) { lineRippleFactory = function (el) { return new MDCLineRipple(el); }; }
6040
+ if (outlineFactory === void 0) { outlineFactory = function (el) { return new MDCNotchedOutline(el); }; }
4242
6041
  if (menuFactory === void 0) { menuFactory = function (el) { return new MDCMenu(el); }; }
4243
6042
  if (iconFactory === void 0) { iconFactory = function (el) { return new MDCSelectIcon(el); }; }
4244
6043
  if (helperTextFactory === void 0) { helperTextFactory = function (el) { return new MDCSelectHelperText(el); }; }
@@ -4308,10 +6107,10 @@ var MDCSelect = /** @class */ (function (_super) {
4308
6107
  this.selectAnchor.addEventListener('blur', this.handleBlur);
4309
6108
  this.selectAnchor.addEventListener('click', this.handleClick);
4310
6109
  this.selectAnchor.addEventListener('keydown', this.handleKeydown);
4311
- this.menu.listen(strings$5.CLOSED_EVENT, this.handleMenuClosed);
4312
- this.menu.listen(strings$5.CLOSING_EVENT, this.handleMenuClosing);
4313
- this.menu.listen(strings$5.OPENED_EVENT, this.handleMenuOpened);
4314
- this.menu.listen(strings$3.SELECTED_EVENT, this.handleMenuItemAction);
6110
+ this.menu.listen(strings$7.CLOSED_EVENT, this.handleMenuClosed);
6111
+ this.menu.listen(strings$7.CLOSING_EVENT, this.handleMenuClosing);
6112
+ this.menu.listen(strings$7.OPENED_EVENT, this.handleMenuOpened);
6113
+ this.menu.listen(strings$5.SELECTED_EVENT, this.handleMenuItemAction);
4315
6114
  if (this.hiddenInput) {
4316
6115
  if (this.hiddenInput.value) {
4317
6116
  // If the hidden input already has a value, use it to restore the
@@ -4329,9 +6128,9 @@ var MDCSelect = /** @class */ (function (_super) {
4329
6128
  this.selectAnchor.removeEventListener('blur', this.handleBlur);
4330
6129
  this.selectAnchor.removeEventListener('keydown', this.handleKeydown);
4331
6130
  this.selectAnchor.removeEventListener('click', this.handleClick);
4332
- this.menu.unlisten(strings$5.CLOSED_EVENT, this.handleMenuClosed);
4333
- this.menu.unlisten(strings$5.OPENED_EVENT, this.handleMenuOpened);
4334
- this.menu.unlisten(strings$3.SELECTED_EVENT, this.handleMenuItemAction);
6131
+ this.menu.unlisten(strings$7.CLOSED_EVENT, this.handleMenuClosed);
6132
+ this.menu.unlisten(strings$7.OPENED_EVENT, this.handleMenuOpened);
6133
+ this.menu.unlisten(strings$5.SELECTED_EVENT, this.handleMenuItemAction);
4335
6134
  this.menu.destroy();
4336
6135
  if (this.ripple) {
4337
6136
  this.ripple.destroy();
@@ -4484,7 +6283,7 @@ var MDCSelect = /** @class */ (function (_super) {
4484
6283
  MDCSelect.prototype.getDefaultFoundation = function () {
4485
6284
  // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
4486
6285
  // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
4487
- var adapter = component.__assign(component.__assign(component.__assign(component.__assign({}, this.getSelectAdapterMethods()), this.getCommonAdapterMethods()), this.getOutlineAdapterMethods()), this.getLabelAdapterMethods());
6286
+ var adapter = exports.__assign(exports.__assign(exports.__assign(exports.__assign({}, this.getSelectAdapterMethods()), this.getCommonAdapterMethods()), this.getOutlineAdapterMethods()), this.getLabelAdapterMethods());
4488
6287
  return new MDCSelectFoundation(adapter, this.getFoundationMap());
4489
6288
  };
4490
6289
  /**
@@ -4503,13 +6302,13 @@ var MDCSelect = /** @class */ (function (_super) {
4503
6302
  // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
4504
6303
  // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
4505
6304
  // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
4506
- var adapter = component.__assign(component.__assign({}, component.MDCRipple.createAdapter({ root: this.selectAnchor })), { registerInteractionHandler: function (evtType, handler) {
6305
+ var adapter = exports.__assign(exports.__assign({}, MDCRipple.createAdapter({ root: this.selectAnchor })), { registerInteractionHandler: function (evtType, handler) {
4507
6306
  _this.selectAnchor.addEventListener(evtType, handler);
4508
6307
  }, deregisterInteractionHandler: function (evtType, handler) {
4509
6308
  _this.selectAnchor.removeEventListener(evtType, handler);
4510
6309
  } });
4511
6310
  // tslint:enable:object-literal-sort-keys
4512
- return new component.MDCRipple(this.selectAnchor, new component.MDCRippleFoundation(adapter));
6311
+ return new MDCRipple(this.selectAnchor, new MDCRippleFoundation(adapter));
4513
6312
  };
4514
6313
  MDCSelect.prototype.getSelectAdapterMethods = function () {
4515
6314
  var _this = this;
@@ -4660,6 +6459,18 @@ var MDCSelect = /** @class */ (function (_super) {
4660
6459
  };
4661
6460
  };
4662
6461
  return MDCSelect;
4663
- }(component.MDCComponent));
6462
+ }(MDCComponent));
4664
6463
 
6464
+ exports.MDCComponent = MDCComponent;
6465
+ exports.MDCFloatingLabel = MDCFloatingLabel;
6466
+ exports.MDCFoundation = MDCFoundation;
6467
+ exports.MDCLineRipple = MDCLineRipple;
6468
+ exports.MDCNotchedOutline = MDCNotchedOutline;
6469
+ exports.MDCRipple = MDCRipple;
6470
+ exports.MDCRippleFoundation = MDCRippleFoundation;
4665
6471
  exports.MDCSelect = MDCSelect;
6472
+ exports.__extends = __extends;
6473
+ exports.__values = __values;
6474
+ exports.applyPassive = applyPassive;
6475
+ exports.getCorrectEventName = getCorrectEventName;
6476
+ exports.matches = matches;