@limetech/lime-elements 35.0.0-next.9 → 35.0.0

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 (266) hide show
  1. package/dist/cjs/checkbox.template-b6c6562c.js +43 -0
  2. package/dist/cjs/{component-f7ef9087.js → component-66df95e7.js} +190 -132
  3. package/dist/cjs/{component-f532119f.js → component-67144c1c.js} +47 -3
  4. package/dist/cjs/{component-ed21410d.js → component-ae3bfacf.js} +367 -235
  5. package/dist/cjs/{component-2faaa141.js → component-cf490570.js} +213 -143
  6. package/dist/cjs/{component-10dbdd60.js → component-dd795ff0.js} +7 -5
  7. package/dist/cjs/{dateFormatter-26eac73a.js → dateFormatter-34b77ead.js} +37 -31
  8. package/dist/cjs/{index-e63a89d7.js → index-2a28697b.js} +27 -1
  9. package/dist/cjs/lime-elements.cjs.js +3 -3
  10. package/dist/cjs/limel-badge.cjs.entry.js +4 -4
  11. package/dist/cjs/limel-banner.cjs.entry.js +2 -2
  12. package/dist/cjs/limel-button-group.cjs.entry.js +3 -3
  13. package/dist/cjs/limel-button.cjs.entry.js +3 -3
  14. package/dist/cjs/limel-checkbox.cjs.entry.js +136 -90
  15. package/dist/cjs/limel-chip-set.cjs.entry.js +235 -191
  16. package/dist/cjs/limel-circular-progress.cjs.entry.js +3 -3
  17. package/dist/cjs/limel-code-editor.cjs.entry.js +50 -23
  18. package/dist/cjs/limel-collapsible-section.cjs.entry.js +2 -2
  19. package/dist/cjs/limel-color-picker-palette_2.cjs.entry.js +3 -3
  20. package/dist/cjs/limel-color-picker.cjs.entry.js +2 -2
  21. package/dist/cjs/limel-config.cjs.entry.js +2 -2
  22. package/dist/cjs/limel-date-picker.cjs.entry.js +8 -8
  23. package/dist/cjs/limel-dialog.cjs.entry.js +9 -10
  24. package/dist/cjs/limel-file.cjs.entry.js +11 -9
  25. package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +971 -657
  26. package/dist/cjs/limel-flex-container.cjs.entry.js +6 -2
  27. package/dist/cjs/limel-form.cjs.entry.js +423 -449
  28. package/dist/cjs/limel-grid.cjs.entry.js +2 -2
  29. package/dist/cjs/limel-header.cjs.entry.js +2 -2
  30. package/dist/cjs/limel-icon-button.cjs.entry.js +6 -6
  31. package/dist/cjs/limel-icon.cjs.entry.js +2 -2
  32. package/dist/cjs/limel-input-field.cjs.entry.js +12 -10
  33. package/dist/cjs/limel-linear-progress.cjs.entry.js +4 -4
  34. package/dist/cjs/limel-list_3.cjs.entry.js +154 -91
  35. package/dist/cjs/limel-menu-list.cjs.entry.js +87 -74
  36. package/dist/cjs/limel-menu.cjs.entry.js +2 -2
  37. package/dist/cjs/limel-picker.cjs.entry.js +4 -7
  38. package/dist/cjs/limel-popover-surface.cjs.entry.js +3 -3
  39. package/dist/cjs/limel-progress-flow-item.cjs.entry.js +2 -2
  40. package/dist/cjs/limel-progress-flow.cjs.entry.js +2 -2
  41. package/dist/cjs/limel-select.cjs.entry.js +6 -6
  42. package/dist/cjs/limel-slider.cjs.entry.js +34 -7
  43. package/dist/cjs/limel-snackbar.cjs.entry.js +79 -73
  44. package/dist/cjs/limel-spinner.cjs.entry.js +2 -2
  45. package/dist/cjs/limel-switch.cjs.entry.js +498 -202
  46. package/dist/cjs/limel-tab-bar.cjs.entry.js +263 -186
  47. package/dist/cjs/limel-tab-panel.cjs.entry.js +2 -2
  48. package/dist/cjs/limel-table.cjs.entry.js +73 -13
  49. package/dist/cjs/limel-tooltip_2.cjs.entry.js +3 -3
  50. package/dist/cjs/loader.cjs.js +3 -3
  51. package/dist/cjs/{moment-d287c0ed.js → moment-5c6581b7.js} +94 -79
  52. package/dist/collection/collection-manifest.json +2 -2
  53. package/dist/collection/components/badge/badge.css +9 -15
  54. package/dist/collection/components/badge/badge.js +2 -2
  55. package/dist/collection/components/button/button.css +333 -145
  56. package/dist/collection/components/button-group/button-group.css +30 -5
  57. package/dist/collection/components/checkbox/checkbox.css +71 -20
  58. package/dist/collection/components/checkbox/checkbox.js +5 -4
  59. package/dist/collection/components/checkbox/checkbox.template.js +24 -20
  60. package/dist/collection/components/chip-set/chip-set.css +367 -34
  61. package/dist/collection/components/circular-progress/circular-progress.css +2 -2
  62. package/dist/collection/components/code-editor/code-editor.css +8 -13
  63. package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.css +1 -1
  64. package/dist/collection/components/dialog/dialog.css +153 -109
  65. package/dist/collection/components/dialog/dialog.js +7 -0
  66. package/dist/collection/components/file/icon-background-colors.js +2 -1
  67. package/dist/collection/components/file/icon-fill-colors.js +2 -1
  68. package/dist/collection/components/file/icons.js +1 -1
  69. package/dist/collection/components/flex-container/flex-container.js +10 -0
  70. package/dist/collection/components/form/fields/schema-field.js +0 -1
  71. package/dist/collection/components/form/form.css +5 -1
  72. package/dist/collection/components/form/form.js +34 -0
  73. package/dist/collection/components/form/form.types.js +0 -1
  74. package/dist/collection/components/form/templates/common.js +4 -1
  75. package/dist/collection/components/icon-button/icon-button.css +116 -59
  76. package/dist/collection/components/icon-button/icon-button.js +1 -0
  77. package/dist/collection/components/input-field/input-field.css +344 -29
  78. package/dist/collection/components/input-field/input-field.js +5 -3
  79. package/dist/collection/components/linear-progress/linear-progress.css +14 -2
  80. package/dist/collection/components/list/list-renderer.js +1 -4
  81. package/dist/collection/components/list/list.css +938 -93
  82. package/dist/collection/components/list/list.js +13 -6
  83. package/dist/collection/components/menu-list/menu-list-renderer.js +1 -4
  84. package/dist/collection/components/menu-list/menu-list.css +938 -93
  85. package/dist/collection/components/menu-surface/menu-surface.css +31 -7
  86. package/dist/collection/components/picker/picker.js +4 -6
  87. package/dist/collection/components/popover-surface/popover-surface.css +1 -0
  88. package/dist/collection/components/select/select.css +424 -17
  89. package/dist/collection/components/select/select.template.js +1 -1
  90. package/dist/collection/components/slider/slider.css +49 -2
  91. package/dist/collection/components/snackbar/snackbar.css +588 -301
  92. package/dist/collection/components/switch/switch.css +592 -222
  93. package/dist/collection/components/switch/switch.js +18 -12
  94. package/dist/collection/components/tab-bar/tab-bar.css +77 -48
  95. package/dist/collection/components/table/table.css +219 -165
  96. package/dist/collection/components/table/table.js +99 -15
  97. package/dist/collection/components/table/table.types.js +0 -1
  98. package/dist/collection/style/functions.scss +3 -1
  99. package/dist/collection/style/internal/lime-theme.scss +30 -31
  100. package/dist/collection/style/internal/lime-typography.scss +55 -56
  101. package/dist/esm/checkbox.template-2f1bbc98.js +41 -0
  102. package/dist/esm/{component-89e0ce26.js → component-19eb6e2b.js} +7 -5
  103. package/dist/esm/{component-2630c3d7.js → component-288691f3.js} +367 -235
  104. package/dist/esm/{component-d682c974.js → component-410aad5a.js} +44 -4
  105. package/dist/esm/{component-429e92ee.js → component-5b4ac85a.js} +213 -143
  106. package/dist/esm/{component-834d85a1.js → component-fffa3419.js} +190 -132
  107. package/dist/esm/{dateFormatter-c9b41548.js → dateFormatter-ed618478.js} +37 -31
  108. package/dist/esm/{index-2316f345.js → index-11cd0b60.js} +27 -1
  109. package/dist/esm/lime-elements.js +3 -3
  110. package/dist/esm/limel-badge.entry.js +4 -4
  111. package/dist/esm/limel-banner.entry.js +2 -2
  112. package/dist/esm/limel-button-group.entry.js +3 -3
  113. package/dist/esm/limel-button.entry.js +3 -3
  114. package/dist/esm/limel-checkbox.entry.js +136 -90
  115. package/dist/esm/limel-chip-set.entry.js +235 -191
  116. package/dist/esm/limel-circular-progress.entry.js +3 -3
  117. package/dist/esm/limel-code-editor.entry.js +50 -23
  118. package/dist/esm/limel-collapsible-section.entry.js +2 -2
  119. package/dist/esm/limel-color-picker-palette_2.entry.js +3 -3
  120. package/dist/esm/limel-color-picker.entry.js +2 -2
  121. package/dist/esm/limel-config.entry.js +2 -2
  122. package/dist/esm/limel-date-picker.entry.js +8 -8
  123. package/dist/esm/limel-dialog.entry.js +9 -10
  124. package/dist/esm/limel-file.entry.js +11 -9
  125. package/dist/esm/limel-flatpickr-adapter.entry.js +971 -657
  126. package/dist/esm/limel-flex-container.entry.js +6 -2
  127. package/dist/esm/limel-form.entry.js +424 -450
  128. package/dist/esm/limel-grid.entry.js +2 -2
  129. package/dist/esm/limel-header.entry.js +2 -2
  130. package/dist/esm/limel-icon-button.entry.js +6 -6
  131. package/dist/esm/limel-icon.entry.js +2 -2
  132. package/dist/esm/limel-input-field.entry.js +12 -10
  133. package/dist/esm/limel-linear-progress.entry.js +4 -4
  134. package/dist/esm/limel-list_3.entry.js +154 -91
  135. package/dist/esm/limel-menu-list.entry.js +87 -74
  136. package/dist/esm/limel-menu.entry.js +2 -2
  137. package/dist/esm/limel-picker.entry.js +4 -7
  138. package/dist/esm/limel-popover-surface.entry.js +3 -3
  139. package/dist/esm/limel-progress-flow-item.entry.js +2 -2
  140. package/dist/esm/limel-progress-flow.entry.js +2 -2
  141. package/dist/esm/limel-select.entry.js +6 -6
  142. package/dist/esm/limel-slider.entry.js +34 -7
  143. package/dist/esm/limel-snackbar.entry.js +79 -73
  144. package/dist/esm/limel-spinner.entry.js +2 -2
  145. package/dist/esm/limel-switch.entry.js +498 -202
  146. package/dist/esm/limel-tab-bar.entry.js +263 -186
  147. package/dist/esm/limel-tab-panel.entry.js +2 -2
  148. package/dist/esm/limel-table.entry.js +73 -13
  149. package/dist/esm/limel-tooltip_2.entry.js +3 -3
  150. package/dist/esm/loader.js +3 -3
  151. package/dist/esm/{moment-8dadd938.js → moment-29c213b7.js} +94 -79
  152. package/dist/esm/polyfills/css-shim.js +1 -1
  153. package/dist/lime-elements/lime-elements.esm.js +1 -1
  154. package/dist/lime-elements/p-04b5bc13.entry.js +82 -0
  155. package/dist/lime-elements/p-101af376.entry.js +1 -0
  156. package/dist/lime-elements/p-1c284626.js +73 -0
  157. package/dist/lime-elements/p-1ede893b.js +1 -0
  158. package/dist/lime-elements/p-2639edf9.entry.js +73 -0
  159. package/dist/lime-elements/p-2da6e2a3.entry.js +1 -0
  160. package/dist/lime-elements/p-2ff40ce6.js +3 -0
  161. package/dist/lime-elements/{p-887d5bda.entry.js → p-358706b6.entry.js} +1 -1
  162. package/dist/lime-elements/p-36ecbd03.entry.js +1 -0
  163. package/dist/lime-elements/p-404e1465.entry.js +1 -0
  164. package/dist/lime-elements/p-42b67933.entry.js +1 -0
  165. package/dist/lime-elements/p-440454ed.entry.js +1 -0
  166. package/dist/lime-elements/{p-076bd4dc.js → p-48d4ef20.js} +3 -3
  167. package/dist/lime-elements/p-53e01330.entry.js +1 -0
  168. package/dist/lime-elements/p-5908c21d.entry.js +1 -0
  169. package/dist/lime-elements/p-5b7a8c61.entry.js +20 -0
  170. package/dist/lime-elements/p-63e25a0a.entry.js +1 -0
  171. package/dist/lime-elements/p-6e7809a6.entry.js +1 -0
  172. package/dist/lime-elements/p-705334c1.entry.js +1 -0
  173. package/dist/lime-elements/p-716a6acd.entry.js +16 -0
  174. package/dist/lime-elements/p-71efe2ca.entry.js +37 -0
  175. package/dist/lime-elements/{p-e1928c0e.js → p-72e03943.js} +1 -1
  176. package/dist/lime-elements/p-80327bb8.entry.js +16 -0
  177. package/dist/lime-elements/p-83ea517b.entry.js +1 -0
  178. package/dist/lime-elements/p-87a1e1cb.entry.js +1 -0
  179. package/dist/lime-elements/{p-8ad5e143.entry.js → p-94899019.entry.js} +1 -1
  180. package/dist/lime-elements/p-95f275ab.entry.js +1 -0
  181. package/dist/lime-elements/p-96f4b892.entry.js +131 -0
  182. package/dist/lime-elements/p-97d6c4a6.entry.js +1 -0
  183. package/dist/lime-elements/p-a465084b.entry.js +82 -0
  184. package/dist/lime-elements/p-a5af84a7.entry.js +1 -0
  185. package/dist/lime-elements/p-b91dc1ef.entry.js +1 -0
  186. package/dist/lime-elements/p-bd8c9384.entry.js +1 -0
  187. package/dist/lime-elements/p-c4b38454.entry.js +1 -0
  188. package/dist/lime-elements/p-c7953a05.entry.js +82 -0
  189. package/dist/lime-elements/p-c80acfb2.entry.js +59 -0
  190. package/dist/lime-elements/p-cbc43682.js +81 -0
  191. package/dist/lime-elements/{p-ace9affc.js → p-d0a7de87.js} +2 -2
  192. package/dist/lime-elements/p-d1ee4501.entry.js +37 -0
  193. package/dist/lime-elements/p-d74fa89e.entry.js +1 -0
  194. package/dist/lime-elements/p-da962c64.entry.js +1 -0
  195. package/dist/lime-elements/p-dfba92de.js +126 -0
  196. package/dist/lime-elements/p-dfbe015e.entry.js +1 -0
  197. package/dist/lime-elements/p-e83dddcd.entry.js +126 -0
  198. package/dist/lime-elements/p-e98d76e8.entry.js +59 -0
  199. package/dist/lime-elements/{p-92146da6.js → p-e9a95b8f.js} +1 -1
  200. package/dist/lime-elements/p-eae8c615.entry.js +1 -0
  201. package/dist/lime-elements/p-ed65468d.entry.js +1 -0
  202. package/dist/lime-elements/p-f0c9dadd.entry.js +1 -0
  203. package/dist/lime-elements/style/functions.scss +3 -1
  204. package/dist/lime-elements/style/internal/lime-theme.scss +30 -31
  205. package/dist/lime-elements/style/internal/lime-typography.scss +55 -56
  206. package/dist/types/components/badge/badge.d.ts +1 -1
  207. package/dist/types/components/checkbox/checkbox.d.ts +3 -2
  208. package/dist/types/components/checkbox/checkbox.template.d.ts +1 -0
  209. package/dist/types/components/dialog/dialog.d.ts +7 -0
  210. package/dist/types/components/flex-container/flex-container.d.ts +7 -0
  211. package/dist/types/components/form/fields/array-field.d.ts +0 -1
  212. package/dist/types/components/form/fields/object-field.d.ts +2 -2
  213. package/dist/types/components/form/form.d.ts +8 -1
  214. package/dist/types/components/form/form.types.d.ts +6 -0
  215. package/dist/types/components/picker/picker.d.ts +2 -1
  216. package/dist/types/components/switch/switch.d.ts +2 -2
  217. package/dist/types/components/table/table.d.ts +10 -1
  218. package/dist/types/components/table/table.types.d.ts +13 -0
  219. package/dist/types/components.d.ts +20 -4
  220. package/dist/types/stencil-public-runtime.d.ts +6 -4
  221. package/package.json +30 -43
  222. package/dist/cjs/checkbox.template-50eb8b76.js +0 -39
  223. package/dist/esm/checkbox.template-50f7c07b.js +0 -37
  224. package/dist/lime-elements/p-041ae00c.entry.js +0 -1
  225. package/dist/lime-elements/p-0ce9165f.entry.js +0 -1
  226. package/dist/lime-elements/p-0fd208f3.entry.js +0 -82
  227. package/dist/lime-elements/p-143705b1.entry.js +0 -1
  228. package/dist/lime-elements/p-1876a96a.entry.js +0 -1
  229. package/dist/lime-elements/p-1fb5340d.entry.js +0 -1
  230. package/dist/lime-elements/p-250f55be.js +0 -1
  231. package/dist/lime-elements/p-29f054cc.entry.js +0 -37
  232. package/dist/lime-elements/p-31fecf5d.entry.js +0 -1
  233. package/dist/lime-elements/p-34c7872e.entry.js +0 -1
  234. package/dist/lime-elements/p-3ae6bb75.entry.js +0 -82
  235. package/dist/lime-elements/p-3ae6dfba.entry.js +0 -73
  236. package/dist/lime-elements/p-468e940e.entry.js +0 -16
  237. package/dist/lime-elements/p-4932c029.entry.js +0 -1
  238. package/dist/lime-elements/p-4b5af81b.entry.js +0 -1
  239. package/dist/lime-elements/p-510bb5a4.entry.js +0 -1
  240. package/dist/lime-elements/p-58cbe99d.entry.js +0 -1
  241. package/dist/lime-elements/p-597cbe05.entry.js +0 -1
  242. package/dist/lime-elements/p-6003f817.entry.js +0 -1
  243. package/dist/lime-elements/p-668795a7.js +0 -73
  244. package/dist/lime-elements/p-714fde78.entry.js +0 -1
  245. package/dist/lime-elements/p-7476efe0.entry.js +0 -1
  246. package/dist/lime-elements/p-8a2c1038.entry.js +0 -16
  247. package/dist/lime-elements/p-902347b9.js +0 -81
  248. package/dist/lime-elements/p-90c6fa15.js +0 -126
  249. package/dist/lime-elements/p-90f3e17c.entry.js +0 -37
  250. package/dist/lime-elements/p-a2cf74c1.entry.js +0 -1
  251. package/dist/lime-elements/p-a397bab7.js +0 -3
  252. package/dist/lime-elements/p-a4c532a7.entry.js +0 -1
  253. package/dist/lime-elements/p-be56ffab.entry.js +0 -1
  254. package/dist/lime-elements/p-c306c953.entry.js +0 -1
  255. package/dist/lime-elements/p-c35874db.entry.js +0 -1
  256. package/dist/lime-elements/p-c8c8a946.entry.js +0 -59
  257. package/dist/lime-elements/p-ca664c9f.entry.js +0 -1
  258. package/dist/lime-elements/p-d2c74396.entry.js +0 -1
  259. package/dist/lime-elements/p-d48ad9f7.entry.js +0 -126
  260. package/dist/lime-elements/p-d93a3b07.entry.js +0 -16
  261. package/dist/lime-elements/p-df8faeb4.entry.js +0 -59
  262. package/dist/lime-elements/p-dfe0a58b.entry.js +0 -1
  263. package/dist/lime-elements/p-e275f502.entry.js +0 -37
  264. package/dist/lime-elements/p-e881e98d.entry.js +0 -1
  265. package/dist/lime-elements/p-f2c706b8.entry.js +0 -131
  266. package/dist/lime-elements/p-fc30b8e3.entry.js +0 -1
@@ -1,4 +1,4 @@
1
- import { M as MDCFoundation, a as MDCComponent } from './component-d682c974.js';
1
+ import { M as MDCFoundation, a as MDCComponent } from './component-410aad5a.js';
2
2
  import { m as matches, c as closest } from './ponyfill-30263d5e.js';
3
3
  import { n as normalizeKey } from './keyboard-4b9e12e3.js';
4
4
  import { g as getCorrectPropertyName } from './util-f1bde91c.js';
@@ -54,10 +54,23 @@ var numbers$1 = {
54
54
  TRANSITION_OPEN_DURATION: 120,
55
55
  /** Total duration of menu-surface close animation. */
56
56
  TRANSITION_CLOSE_DURATION: 75,
57
- /** Margin left to the edge of the viewport when menu-surface is at maximum possible height. Also used as a viewport margin. */
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
+ */
58
61
  MARGIN_TO_EDGE: 32,
59
- /** Ratio of anchor width to menu-surface width for switching from corner positioning to center positioning. */
62
+ /**
63
+ * Ratio of anchor width to menu-surface width for switching from corner
64
+ * positioning to center positioning.
65
+ */
60
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,
61
74
  };
62
75
  /**
63
76
  * Enum for bits in the {@see Corner) bitmap.
@@ -556,16 +569,16 @@ var MDCListFoundation = /** @class */ (function (_super) {
556
569
  __extends$1(MDCListFoundation, _super);
557
570
  function MDCListFoundation(adapter) {
558
571
  var _this = _super.call(this, __assign$1(__assign$1({}, MDCListFoundation.defaultAdapter), adapter)) || this;
559
- _this.wrapFocus_ = false;
560
- _this.isVertical_ = true;
561
- _this.isSingleSelectionList_ = false;
562
- _this.selectedIndex_ = numbers.UNSET_INDEX;
572
+ _this.wrapFocus = false;
573
+ _this.isVertical = true;
574
+ _this.isSingleSelectionList = false;
575
+ _this.selectedIndex = numbers.UNSET_INDEX;
563
576
  _this.focusedItemIndex = numbers.UNSET_INDEX;
564
- _this.useActivatedClass_ = false;
565
- _this.useSelectedAttr_ = false;
566
- _this.ariaCurrentAttrValue_ = null;
567
- _this.isCheckboxList_ = false;
568
- _this.isRadioList_ = false;
577
+ _this.useActivatedClass = false;
578
+ _this.useSelectedAttr = false;
579
+ _this.ariaCurrentAttrValue = null;
580
+ _this.isCheckboxList = false;
581
+ _this.isRadioList = false;
569
582
  _this.hasTypeahead = false;
570
583
  // Transiently holds current typeahead prefix from user.
571
584
  _this.typeaheadState = initState();
@@ -624,10 +637,10 @@ var MDCListFoundation = /** @class */ (function (_super) {
624
637
  }
625
638
  // TODO(b/172274142): consider all items when determining the list's type.
626
639
  if (this.adapter.hasCheckboxAtIndex(0)) {
627
- this.isCheckboxList_ = true;
640
+ this.isCheckboxList = true;
628
641
  }
629
642
  else if (this.adapter.hasRadioAtIndex(0)) {
630
- this.isRadioList_ = true;
643
+ this.isRadioList = true;
631
644
  }
632
645
  else {
633
646
  this.maybeInitializeSingleSelection();
@@ -636,25 +649,27 @@ var MDCListFoundation = /** @class */ (function (_super) {
636
649
  this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex();
637
650
  }
638
651
  };
639
- /**
640
- * Sets the private wrapFocus_ variable.
641
- */
652
+ /** Returns the index of the item that was last focused. */
653
+ MDCListFoundation.prototype.getFocusedItemIndex = function () {
654
+ return this.focusedItemIndex;
655
+ };
656
+ /** Toggles focus wrapping with keyboard navigation. */
642
657
  MDCListFoundation.prototype.setWrapFocus = function (value) {
643
- this.wrapFocus_ = value;
658
+ this.wrapFocus = value;
644
659
  };
645
660
  /**
646
- * Sets the isVertical_ private variable.
661
+ * Toggles orientation direction for keyboard navigation (true for vertical,
662
+ * false for horizontal).
647
663
  */
648
664
  MDCListFoundation.prototype.setVerticalOrientation = function (value) {
649
- this.isVertical_ = value;
665
+ this.isVertical = value;
650
666
  };
651
- /**
652
- * Sets the isSingleSelectionList_ private variable.
653
- */
667
+ /** Toggles single-selection behavior. */
654
668
  MDCListFoundation.prototype.setSingleSelection = function (value) {
655
- this.isSingleSelectionList_ = value;
669
+ this.isSingleSelectionList = value;
656
670
  if (value) {
657
671
  this.maybeInitializeSingleSelection();
672
+ this.selectedIndex = this.getSelectedIndexFromDOM();
658
673
  }
659
674
  };
660
675
  /**
@@ -662,6 +677,19 @@ var MDCListFoundation = /** @class */ (function (_super) {
662
677
  * initializes the internal state to match the selected item.
663
678
  */
664
679
  MDCListFoundation.prototype.maybeInitializeSingleSelection = function () {
680
+ var selectedItemIndex = this.getSelectedIndexFromDOM();
681
+ if (selectedItemIndex === numbers.UNSET_INDEX)
682
+ return;
683
+ var hasActivatedClass = this.adapter.listItemAtIndexHasClass(selectedItemIndex, cssClasses.LIST_ITEM_ACTIVATED_CLASS);
684
+ if (hasActivatedClass) {
685
+ this.setUseActivatedClass(true);
686
+ }
687
+ this.isSingleSelectionList = true;
688
+ this.selectedIndex = selectedItemIndex;
689
+ };
690
+ /** @return Index of the first selected item based on the DOM state. */
691
+ MDCListFoundation.prototype.getSelectedIndexFromDOM = function () {
692
+ var selectedIndex = numbers.UNSET_INDEX;
665
693
  var listItemsCount = this.adapter.getListItemCount();
666
694
  for (var i = 0; i < listItemsCount; i++) {
667
695
  var hasSelectedClass = this.adapter.listItemAtIndexHasClass(i, cssClasses.LIST_ITEM_SELECTED_CLASS);
@@ -669,13 +697,10 @@ var MDCListFoundation = /** @class */ (function (_super) {
669
697
  if (!(hasSelectedClass || hasActivatedClass)) {
670
698
  continue;
671
699
  }
672
- if (hasActivatedClass) {
673
- this.setUseActivatedClass(true);
674
- }
675
- this.isSingleSelectionList_ = true;
676
- this.selectedIndex_ = i;
677
- return;
700
+ selectedIndex = i;
701
+ break;
678
702
  }
703
+ return selectedIndex;
679
704
  };
680
705
  /**
681
706
  * Sets whether typeahead is enabled on the list.
@@ -694,39 +719,39 @@ var MDCListFoundation = /** @class */ (function (_super) {
694
719
  return this.hasTypeahead &&
695
720
  isTypingInProgress(this.typeaheadState);
696
721
  };
697
- /**
698
- * Sets the useActivatedClass_ private variable.
699
- */
722
+ /** Toggle use of the "activated" CSS class. */
700
723
  MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) {
701
- this.useActivatedClass_ = useActivated;
724
+ this.useActivatedClass = useActivated;
702
725
  };
703
726
  /**
704
- * Sets the useSelectedAttr_ private variable.
727
+ * Toggles use of the selected attribute (true for aria-selected, false for
728
+ * aria-checked).
705
729
  */
706
730
  MDCListFoundation.prototype.setUseSelectedAttribute = function (useSelected) {
707
- this.useSelectedAttr_ = useSelected;
731
+ this.useSelectedAttr = useSelected;
708
732
  };
709
733
  MDCListFoundation.prototype.getSelectedIndex = function () {
710
- return this.selectedIndex_;
734
+ return this.selectedIndex;
711
735
  };
712
- MDCListFoundation.prototype.setSelectedIndex = function (index) {
713
- if (!this.isIndexValid_(index)) {
736
+ MDCListFoundation.prototype.setSelectedIndex = function (index, _a) {
737
+ var _b = _a === void 0 ? {} : _a, forceUpdate = _b.forceUpdate;
738
+ if (!this.isIndexValid(index)) {
714
739
  return;
715
740
  }
716
- if (this.isCheckboxList_) {
717
- this.setCheckboxAtIndex_(index);
741
+ if (this.isCheckboxList) {
742
+ this.setCheckboxAtIndex(index);
718
743
  }
719
- else if (this.isRadioList_) {
720
- this.setRadioAtIndex_(index);
744
+ else if (this.isRadioList) {
745
+ this.setRadioAtIndex(index);
721
746
  }
722
747
  else {
723
- this.setSingleSelectionAtIndex_(index);
748
+ this.setSingleSelectionAtIndex(index, { forceUpdate: forceUpdate });
724
749
  }
725
750
  };
726
751
  /**
727
752
  * Focus in handler for the list items.
728
753
  */
729
- MDCListFoundation.prototype.handleFocusIn = function (_, listItemIndex) {
754
+ MDCListFoundation.prototype.handleFocusIn = function (listItemIndex) {
730
755
  if (listItemIndex >= 0) {
731
756
  this.focusedItemIndex = listItemIndex;
732
757
  this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '0');
@@ -736,7 +761,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
736
761
  /**
737
762
  * Focus out handler for the list items.
738
763
  */
739
- MDCListFoundation.prototype.handleFocusOut = function (_, listItemIndex) {
764
+ MDCListFoundation.prototype.handleFocusOut = function (listItemIndex) {
740
765
  var _this = this;
741
766
  if (listItemIndex >= 0) {
742
767
  this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '-1');
@@ -765,7 +790,8 @@ var MDCListFoundation = /** @class */ (function (_super) {
765
790
  var isEnd = normalizeKey(event) === 'End';
766
791
  var isEnter = normalizeKey(event) === 'Enter';
767
792
  var isSpace = normalizeKey(event) === 'Spacebar';
768
- // Have to check both upper and lower case, because having caps lock on affects the value.
793
+ // Have to check both upper and lower case, because having caps lock on
794
+ // affects the value.
769
795
  var isLetterA = event.key === 'A' || event.key === 'a';
770
796
  if (this.adapter.isRootFocused()) {
771
797
  if (isArrowUp || isEnd) {
@@ -802,12 +828,12 @@ var MDCListFoundation = /** @class */ (function (_super) {
802
828
  return;
803
829
  }
804
830
  }
805
- if ((this.isVertical_ && isArrowDown) ||
806
- (!this.isVertical_ && isArrowRight)) {
831
+ if ((this.isVertical && isArrowDown) ||
832
+ (!this.isVertical && isArrowRight)) {
807
833
  preventDefaultEvent(event);
808
834
  this.focusNextElement(currentIndex);
809
835
  }
810
- else if ((this.isVertical_ && isArrowUp) || (!this.isVertical_ && isArrowLeft)) {
836
+ else if ((this.isVertical && isArrowUp) || (!this.isVertical && isArrowLeft)) {
811
837
  preventDefaultEvent(event);
812
838
  this.focusPrevElement(currentIndex);
813
839
  }
@@ -819,9 +845,11 @@ var MDCListFoundation = /** @class */ (function (_super) {
819
845
  preventDefaultEvent(event);
820
846
  this.focusLastElement();
821
847
  }
822
- else if (isLetterA && event.ctrlKey && this.isCheckboxList_) {
848
+ else if (isLetterA && event.ctrlKey && this.isCheckboxList) {
823
849
  event.preventDefault();
824
- this.toggleAll(this.selectedIndex_ === numbers.UNSET_INDEX ? [] : this.selectedIndex_);
850
+ this.toggleAll(this.selectedIndex === numbers.UNSET_INDEX ?
851
+ [] :
852
+ this.selectedIndex);
825
853
  }
826
854
  else if (isEnter || isSpace) {
827
855
  if (isRootListItem) {
@@ -836,8 +864,8 @@ var MDCListFoundation = /** @class */ (function (_super) {
836
864
  return;
837
865
  }
838
866
  if (!this.isTypeaheadInProgress()) {
839
- if (this.isSelectableList_()) {
840
- this.setSelectedIndexOnAction_(currentIndex);
867
+ if (this.isSelectableList()) {
868
+ this.setSelectedIndexOnAction(currentIndex);
841
869
  }
842
870
  this.adapter.notifyAction(currentIndex);
843
871
  }
@@ -867,8 +895,8 @@ var MDCListFoundation = /** @class */ (function (_super) {
867
895
  if (this.adapter.listItemAtIndexHasClass(index, cssClasses.LIST_ITEM_DISABLED_CLASS)) {
868
896
  return;
869
897
  }
870
- if (this.isSelectableList_()) {
871
- this.setSelectedIndexOnAction_(index, toggleCheckbox);
898
+ if (this.isSelectableList()) {
899
+ this.setSelectedIndexOnAction(index, toggleCheckbox);
872
900
  }
873
901
  this.adapter.notifyAction(index);
874
902
  };
@@ -879,7 +907,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
879
907
  var count = this.adapter.getListItemCount();
880
908
  var nextIndex = index + 1;
881
909
  if (nextIndex >= count) {
882
- if (this.wrapFocus_) {
910
+ if (this.wrapFocus) {
883
911
  nextIndex = 0;
884
912
  }
885
913
  else {
@@ -896,7 +924,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
896
924
  MDCListFoundation.prototype.focusPrevElement = function (index) {
897
925
  var prevIndex = index - 1;
898
926
  if (prevIndex < 0) {
899
- if (this.wrapFocus_) {
927
+ if (this.wrapFocus) {
900
928
  prevIndex = this.adapter.getListItemCount() - 1;
901
929
  }
902
930
  else {
@@ -926,7 +954,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
926
954
  * @param isEnabled Sets the list item to enabled or disabled.
927
955
  */
928
956
  MDCListFoundation.prototype.setEnabled = function (itemIndex, isEnabled) {
929
- if (!this.isIndexValid_(itemIndex)) {
957
+ if (!this.isIndexValid(itemIndex)) {
930
958
  return;
931
959
  }
932
960
  if (isEnabled) {
@@ -938,41 +966,42 @@ var MDCListFoundation = /** @class */ (function (_super) {
938
966
  this.adapter.setAttributeForElementIndex(itemIndex, strings.ARIA_DISABLED, 'true');
939
967
  }
940
968
  };
941
- MDCListFoundation.prototype.setSingleSelectionAtIndex_ = function (index) {
942
- if (this.selectedIndex_ === index) {
969
+ MDCListFoundation.prototype.setSingleSelectionAtIndex = function (index, _a) {
970
+ var _b = _a === void 0 ? {} : _a, forceUpdate = _b.forceUpdate;
971
+ if (this.selectedIndex === index && !forceUpdate) {
943
972
  return;
944
973
  }
945
974
  var selectedClassName = cssClasses.LIST_ITEM_SELECTED_CLASS;
946
- if (this.useActivatedClass_) {
975
+ if (this.useActivatedClass) {
947
976
  selectedClassName = cssClasses.LIST_ITEM_ACTIVATED_CLASS;
948
977
  }
949
- if (this.selectedIndex_ !== numbers.UNSET_INDEX) {
950
- this.adapter.removeClassForElementIndex(this.selectedIndex_, selectedClassName);
978
+ if (this.selectedIndex !== numbers.UNSET_INDEX) {
979
+ this.adapter.removeClassForElementIndex(this.selectedIndex, selectedClassName);
951
980
  }
952
- this.setAriaForSingleSelectionAtIndex_(index);
981
+ this.setAriaForSingleSelectionAtIndex(index);
953
982
  this.setTabindexAtIndex(index);
954
983
  if (index !== numbers.UNSET_INDEX) {
955
984
  this.adapter.addClassForElementIndex(index, selectedClassName);
956
985
  }
957
- this.selectedIndex_ = index;
986
+ this.selectedIndex = index;
958
987
  };
959
988
  /**
960
989
  * Sets aria attribute for single selection at given index.
961
990
  */
962
- MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex_ = function (index) {
991
+ MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex = function (index) {
963
992
  // Detect the presence of aria-current and get the value only during list
964
993
  // initialization when it is in unset state.
965
- if (this.selectedIndex_ === numbers.UNSET_INDEX) {
966
- this.ariaCurrentAttrValue_ =
994
+ if (this.selectedIndex === numbers.UNSET_INDEX) {
995
+ this.ariaCurrentAttrValue =
967
996
  this.adapter.getAttributeForElementIndex(index, strings.ARIA_CURRENT);
968
997
  }
969
- var isAriaCurrent = this.ariaCurrentAttrValue_ !== null;
998
+ var isAriaCurrent = this.ariaCurrentAttrValue !== null;
970
999
  var ariaAttribute = isAriaCurrent ? strings.ARIA_CURRENT : strings.ARIA_SELECTED;
971
- if (this.selectedIndex_ !== numbers.UNSET_INDEX) {
972
- this.adapter.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false');
1000
+ if (this.selectedIndex !== numbers.UNSET_INDEX) {
1001
+ this.adapter.setAttributeForElementIndex(this.selectedIndex, ariaAttribute, 'false');
973
1002
  }
974
1003
  if (index !== numbers.UNSET_INDEX) {
975
- var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true';
1004
+ var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue : 'true';
976
1005
  this.adapter.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue);
977
1006
  }
978
1007
  };
@@ -980,22 +1009,22 @@ var MDCListFoundation = /** @class */ (function (_super) {
980
1009
  * Returns the attribute to use for indicating selection status.
981
1010
  */
982
1011
  MDCListFoundation.prototype.getSelectionAttribute = function () {
983
- return this.useSelectedAttr_ ? strings.ARIA_SELECTED : strings.ARIA_CHECKED;
1012
+ return this.useSelectedAttr ? strings.ARIA_SELECTED : strings.ARIA_CHECKED;
984
1013
  };
985
1014
  /**
986
1015
  * Toggles radio at give index. Radio doesn't change the checked state if it
987
1016
  * is already checked.
988
1017
  */
989
- MDCListFoundation.prototype.setRadioAtIndex_ = function (index) {
1018
+ MDCListFoundation.prototype.setRadioAtIndex = function (index) {
990
1019
  var selectionAttribute = this.getSelectionAttribute();
991
1020
  this.adapter.setCheckedCheckboxOrRadioAtIndex(index, true);
992
- if (this.selectedIndex_ !== numbers.UNSET_INDEX) {
993
- this.adapter.setAttributeForElementIndex(this.selectedIndex_, selectionAttribute, 'false');
1021
+ if (this.selectedIndex !== numbers.UNSET_INDEX) {
1022
+ this.adapter.setAttributeForElementIndex(this.selectedIndex, selectionAttribute, 'false');
994
1023
  }
995
1024
  this.adapter.setAttributeForElementIndex(index, selectionAttribute, 'true');
996
- this.selectedIndex_ = index;
1025
+ this.selectedIndex = index;
997
1026
  };
998
- MDCListFoundation.prototype.setCheckboxAtIndex_ = function (index) {
1027
+ MDCListFoundation.prototype.setCheckboxAtIndex = function (index) {
999
1028
  var selectionAttribute = this.getSelectionAttribute();
1000
1029
  for (var i = 0; i < this.adapter.getListItemCount(); i++) {
1001
1030
  var isChecked = false;
@@ -1005,7 +1034,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
1005
1034
  this.adapter.setCheckedCheckboxOrRadioAtIndex(i, isChecked);
1006
1035
  this.adapter.setAttributeForElementIndex(i, selectionAttribute, isChecked ? 'true' : 'false');
1007
1036
  }
1008
- this.selectedIndex_ = index;
1037
+ this.selectedIndex = index;
1009
1038
  };
1010
1039
  MDCListFoundation.prototype.setTabindexAtIndex = function (index) {
1011
1040
  if (this.focusedItemIndex === numbers.UNSET_INDEX && index !== 0) {
@@ -1020,9 +1049,9 @@ var MDCListFoundation = /** @class */ (function (_super) {
1020
1049
  // Set the previous selection's tabindex to -1. We need this because
1021
1050
  // in selection menus that are not visible, programmatically setting an
1022
1051
  // option will not change focus but will change where tabindex should be 0.
1023
- if (!(this.selectedIndex_ instanceof Array) &&
1024
- this.selectedIndex_ !== index) {
1025
- this.adapter.setAttributeForElementIndex(this.selectedIndex_, 'tabindex', '-1');
1052
+ if (!(this.selectedIndex instanceof Array) &&
1053
+ this.selectedIndex !== index) {
1054
+ this.adapter.setAttributeForElementIndex(this.selectedIndex, 'tabindex', '-1');
1026
1055
  }
1027
1056
  if (index !== numbers.UNSET_INDEX) {
1028
1057
  this.adapter.setAttributeForElementIndex(index, 'tabindex', '0');
@@ -1032,53 +1061,56 @@ var MDCListFoundation = /** @class */ (function (_super) {
1032
1061
  * @return Return true if it is single selectin list, checkbox list or radio
1033
1062
  * list.
1034
1063
  */
1035
- MDCListFoundation.prototype.isSelectableList_ = function () {
1036
- return this.isSingleSelectionList_ || this.isCheckboxList_ ||
1037
- this.isRadioList_;
1064
+ MDCListFoundation.prototype.isSelectableList = function () {
1065
+ return this.isSingleSelectionList || this.isCheckboxList ||
1066
+ this.isRadioList;
1038
1067
  };
1039
1068
  MDCListFoundation.prototype.setTabindexToFirstSelectedOrFocusedItem = function () {
1040
1069
  var targetIndex = this.getFirstSelectedOrFocusedItemIndex();
1041
1070
  this.setTabindexAtIndex(targetIndex);
1042
1071
  };
1043
1072
  MDCListFoundation.prototype.getFirstSelectedOrFocusedItemIndex = function () {
1044
- var targetIndex = this.focusedItemIndex >= 0 ? this.focusedItemIndex : 0;
1045
- if (this.isSelectableList_()) {
1046
- if (typeof this.selectedIndex_ === 'number' &&
1047
- this.selectedIndex_ !== numbers.UNSET_INDEX) {
1048
- targetIndex = this.selectedIndex_;
1049
- }
1050
- else if (isNumberArray(this.selectedIndex_) &&
1051
- this.selectedIndex_.length > 0) {
1052
- targetIndex = this.selectedIndex_.reduce(function (currentIndex, minIndex) { return Math.min(currentIndex, minIndex); });
1053
- }
1073
+ // Action lists retain focus on the most recently focused item.
1074
+ if (!this.isSelectableList()) {
1075
+ return Math.max(this.focusedItemIndex, 0);
1054
1076
  }
1055
- return targetIndex;
1077
+ // Single-selection lists focus the selected item.
1078
+ if (typeof this.selectedIndex === 'number' &&
1079
+ this.selectedIndex !== numbers.UNSET_INDEX) {
1080
+ return this.selectedIndex;
1081
+ }
1082
+ // Multiple-selection lists focus the first selected item.
1083
+ if (isNumberArray(this.selectedIndex) && this.selectedIndex.length > 0) {
1084
+ return this.selectedIndex.reduce(function (minIndex, currentIndex) { return Math.min(minIndex, currentIndex); });
1085
+ }
1086
+ // Selection lists without a selection focus the first item.
1087
+ return 0;
1056
1088
  };
1057
- MDCListFoundation.prototype.isIndexValid_ = function (index) {
1089
+ MDCListFoundation.prototype.isIndexValid = function (index) {
1058
1090
  var _this = this;
1059
1091
  if (index instanceof Array) {
1060
- if (!this.isCheckboxList_) {
1092
+ if (!this.isCheckboxList) {
1061
1093
  throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list');
1062
1094
  }
1063
1095
  if (index.length === 0) {
1064
1096
  return true;
1065
1097
  }
1066
1098
  else {
1067
- return index.some(function (i) { return _this.isIndexInRange_(i); });
1099
+ return index.some(function (i) { return _this.isIndexInRange(i); });
1068
1100
  }
1069
1101
  }
1070
1102
  else if (typeof index === 'number') {
1071
- if (this.isCheckboxList_) {
1103
+ if (this.isCheckboxList) {
1072
1104
  throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: " + index);
1073
1105
  }
1074
- return this.isIndexInRange_(index) ||
1075
- this.isSingleSelectionList_ && index === numbers.UNSET_INDEX;
1106
+ return this.isIndexInRange(index) ||
1107
+ this.isSingleSelectionList && index === numbers.UNSET_INDEX;
1076
1108
  }
1077
1109
  else {
1078
1110
  return false;
1079
1111
  }
1080
1112
  };
1081
- MDCListFoundation.prototype.isIndexInRange_ = function (index) {
1113
+ MDCListFoundation.prototype.isIndexInRange = function (index) {
1082
1114
  var listSize = this.adapter.getListItemCount();
1083
1115
  return index >= 0 && index < listSize;
1084
1116
  };
@@ -1087,16 +1119,16 @@ var MDCListFoundation = /** @class */ (function (_super) {
1087
1119
  * toggleCheckbox value. User interaction should not toggle list item(s) when
1088
1120
  * disabled.
1089
1121
  */
1090
- MDCListFoundation.prototype.setSelectedIndexOnAction_ = function (index, toggleCheckbox) {
1122
+ MDCListFoundation.prototype.setSelectedIndexOnAction = function (index, toggleCheckbox) {
1091
1123
  if (toggleCheckbox === void 0) { toggleCheckbox = true; }
1092
- if (this.isCheckboxList_) {
1093
- this.toggleCheckboxAtIndex_(index, toggleCheckbox);
1124
+ if (this.isCheckboxList) {
1125
+ this.toggleCheckboxAtIndex(index, toggleCheckbox);
1094
1126
  }
1095
1127
  else {
1096
1128
  this.setSelectedIndex(index);
1097
1129
  }
1098
1130
  };
1099
- MDCListFoundation.prototype.toggleCheckboxAtIndex_ = function (index, toggleCheckbox) {
1131
+ MDCListFoundation.prototype.toggleCheckboxAtIndex = function (index, toggleCheckbox) {
1100
1132
  var selectionAttribute = this.getSelectionAttribute();
1101
1133
  var isChecked = this.adapter.isCheckboxCheckedAtIndex(index);
1102
1134
  if (toggleCheckbox) {
@@ -1106,16 +1138,16 @@ var MDCListFoundation = /** @class */ (function (_super) {
1106
1138
  this.adapter.setAttributeForElementIndex(index, selectionAttribute, isChecked ? 'true' : 'false');
1107
1139
  // If none of the checkbox items are selected and selectedIndex is not
1108
1140
  // initialized then provide a default value.
1109
- var selectedIndexes = this.selectedIndex_ === numbers.UNSET_INDEX ?
1141
+ var selectedIndexes = this.selectedIndex === numbers.UNSET_INDEX ?
1110
1142
  [] :
1111
- this.selectedIndex_.slice();
1143
+ this.selectedIndex.slice();
1112
1144
  if (isChecked) {
1113
1145
  selectedIndexes.push(index);
1114
1146
  }
1115
1147
  else {
1116
1148
  selectedIndexes = selectedIndexes.filter(function (i) { return i !== index; });
1117
1149
  }
1118
- this.selectedIndex_ = selectedIndexes;
1150
+ this.selectedIndex = selectedIndexes;
1119
1151
  };
1120
1152
  MDCListFoundation.prototype.focusItemAtIndex = function (index) {
1121
1153
  this.adapter.focusItemAtIndex(index);
@@ -1125,7 +1157,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
1125
1157
  var count = this.adapter.getListItemCount();
1126
1158
  // If all items are selected, deselect everything.
1127
1159
  if (currentlySelectedIndexes.length === count) {
1128
- this.setCheckboxAtIndex_([]);
1160
+ this.setCheckboxAtIndex([]);
1129
1161
  }
1130
1162
  else {
1131
1163
  // Otherwise select all enabled options.
@@ -1136,7 +1168,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
1136
1168
  allIndexes.push(i);
1137
1169
  }
1138
1170
  }
1139
- this.setCheckboxAtIndex_(allIndexes);
1171
+ this.setCheckboxAtIndex(allIndexes);
1140
1172
  }
1141
1173
  };
1142
1174
  /**
@@ -1524,7 +1556,7 @@ var MDCList = /** @class */ (function (_super) {
1524
1556
  */
1525
1557
  MDCList.prototype.handleFocusInEvent = function (evt) {
1526
1558
  var index = this.getListItemIndex(evt.target);
1527
- this.foundation.handleFocusIn(evt, index);
1559
+ this.foundation.handleFocusIn(index);
1528
1560
  };
1529
1561
  /**
1530
1562
  * Used to figure out which element was clicked before sending the event to
@@ -1532,7 +1564,7 @@ var MDCList = /** @class */ (function (_super) {
1532
1564
  */
1533
1565
  MDCList.prototype.handleFocusOutEvent = function (evt) {
1534
1566
  var index = this.getListItemIndex(evt.target);
1535
- this.foundation.handleFocusOut(evt, index);
1567
+ this.foundation.handleFocusOut(index);
1536
1568
  };
1537
1569
  /**
1538
1570
  * Used to figure out which element was focused when keydown event occurred
@@ -1744,7 +1776,8 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
1744
1776
  cancelAnimationFrame(this.animationRequestId);
1745
1777
  };
1746
1778
  /**
1747
- * @param corner Default anchor corner alignment of top-left menu surface corner.
1779
+ * @param corner Default anchor corner alignment of top-left menu surface
1780
+ * corner.
1748
1781
  */
1749
1782
  MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) {
1750
1783
  this.anchorCorner = corner;
@@ -1768,10 +1801,18 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
1768
1801
  MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) {
1769
1802
  this.isHoistedElement = isHoisted;
1770
1803
  };
1771
- /** Used to set the menu-surface calculations based on a fixed position menu. */
1804
+ /**
1805
+ * Used to set the menu-surface calculations based on a fixed position menu.
1806
+ */
1772
1807
  MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) {
1773
1808
  this.isFixedPosition = isFixedPosition;
1774
1809
  };
1810
+ /**
1811
+ * @return Returns true if menu is in fixed (`position: fixed`) position.
1812
+ */
1813
+ MDCMenuSurfaceFoundation.prototype.isFixed = function () {
1814
+ return this.isFixedPosition;
1815
+ };
1775
1816
  /** Sets the menu-surface position on the page. */
1776
1817
  MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) {
1777
1818
  this.position.x = this.isFinite(x) ? x : 0;
@@ -1814,9 +1855,9 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
1814
1855
  else {
1815
1856
  this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
1816
1857
  this.animationRequestId = requestAnimationFrame(function () {
1817
- _this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
1818
1858
  _this.dimensions = _this.adapter.getInnerDimensions();
1819
1859
  _this.autoposition();
1860
+ _this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
1820
1861
  _this.openAnimationEndTimerId = setTimeout(function () {
1821
1862
  _this.openAnimationEndTimerId = 0;
1822
1863
  _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
@@ -1892,11 +1933,14 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
1892
1933
  _a[horizontalAlignment] = horizontalOffset,
1893
1934
  _a[verticalAlignment] = verticalOffset,
1894
1935
  _a);
1895
- // Center align when anchor width is comparable or greater than menu surface, otherwise keep corner.
1896
- if (anchorSize.width / surfaceSize.width > numbers$1.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
1936
+ // Center align when anchor width is comparable or greater than menu
1937
+ // surface, otherwise keep corner.
1938
+ if (anchorSize.width / surfaceSize.width >
1939
+ numbers$1.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
1897
1940
  horizontalAlignment = 'center';
1898
1941
  }
1899
- // If the menu-surface has been hoisted to the body, it's no longer relative to the anchor element
1942
+ // If the menu-surface has been hoisted to the body, it's no longer relative
1943
+ // to the anchor element
1900
1944
  if (this.isHoistedElement || this.isFixedPosition) {
1901
1945
  this.adjustPositionForHoistedElement(position);
1902
1946
  }
@@ -2020,7 +2064,8 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
2020
2064
  };
2021
2065
  /**
2022
2066
  * @param corner Origin corner of the menu surface.
2023
- * @return Maximum height of the menu surface, based on available space. 0 indicates should not be set.
2067
+ * @return Maximum height of the menu surface, based on available space. 0
2068
+ * indicates should not be set.
2024
2069
  */
2025
2070
  MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight = function (corner) {
2026
2071
  if (this.maxHeight > 0) {
@@ -2049,7 +2094,8 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
2049
2094
  };
2050
2095
  /**
2051
2096
  * @param corner Origin corner of the menu surface.
2052
- * @return Horizontal offset of menu surface origin corner from corresponding anchor corner.
2097
+ * @return Horizontal offset of menu surface origin corner from corresponding
2098
+ * anchor corner.
2053
2099
  */
2054
2100
  MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset = function (corner) {
2055
2101
  var anchorSize = this.measurements.anchorSize;
@@ -2076,7 +2122,8 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
2076
2122
  };
2077
2123
  /**
2078
2124
  * @param corner Origin corner of the menu surface.
2079
- * @return Vertical offset of menu surface origin corner from corresponding anchor corner.
2125
+ * @return Vertical offset of menu surface origin corner from corresponding
2126
+ * anchor corner.
2080
2127
  */
2081
2128
  MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset = function (corner) {
2082
2129
  var anchorSize = this.measurements.anchorSize;
@@ -2094,7 +2141,10 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
2094
2141
  }
2095
2142
  return y;
2096
2143
  };
2097
- /** Calculates the offsets for positioning the menu-surface when the menu-surface has been hoisted to the body. */
2144
+ /**
2145
+ * Calculates the offsets for positioning the menu-surface when the
2146
+ * menu-surface has been hoisted to the body.
2147
+ */
2098
2148
  MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement = function (position) {
2099
2149
  var e_1, _a;
2100
2150
  var _b = this.measurements, windowScroll = _b.windowScroll, viewportDistance = _b.viewportDistance, surfaceSize = _b.surfaceSize, viewportSize = _b.viewportSize;
@@ -2108,11 +2158,11 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
2108
2158
  position[prop] = (viewportSize.width - surfaceSize.width) / 2;
2109
2159
  continue;
2110
2160
  }
2111
- // Hoisted surfaces need to have the anchor elements location on the page added to the
2112
- // position properties for proper alignment on the body.
2161
+ // Hoisted surfaces need to have the anchor elements location on the page
2162
+ // added to the position properties for proper alignment on the body.
2113
2163
  value += viewportDistance[prop];
2114
- // Surfaces that are absolutely positioned need to have additional calculations for scroll
2115
- // and bottom positioning.
2164
+ // Surfaces that are absolutely positioned need to have additional
2165
+ // calculations for scroll and bottom positioning.
2116
2166
  if (!this.isFixedPosition) {
2117
2167
  if (prop === 'top') {
2118
2168
  value += windowScroll.y;
@@ -2139,15 +2189,23 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
2139
2189
  }
2140
2190
  };
2141
2191
  /**
2142
- * The last focused element when the menu surface was opened should regain focus, if the user is
2143
- * focused on or within the menu surface when it is closed.
2192
+ * The last focused element when the menu surface was opened should regain
2193
+ * focus, if the user is focused on or within the menu surface when it is
2194
+ * closed.
2144
2195
  */
2145
2196
  MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus = function () {
2197
+ var _this = this;
2146
2198
  var isRootFocused = this.adapter.isFocused();
2147
2199
  var childHasFocus = document.activeElement &&
2148
2200
  this.adapter.isElementInContainer(document.activeElement);
2149
2201
  if (isRootFocused || childHasFocus) {
2150
- this.adapter.restoreFocus();
2202
+ // Wait before restoring focus when closing the menu surface. This is
2203
+ // important because if a touch event triggered the menu close, and the
2204
+ // subsequent mouse event occurs after focus is restored, then the
2205
+ // restored focus would be lost.
2206
+ setTimeout(function () {
2207
+ _this.adapter.restoreFocus();
2208
+ }, numbers$1.TOUCH_EVENT_WAIT_MS);
2151
2209
  }
2152
2210
  };
2153
2211
  MDCMenuSurfaceFoundation.prototype.hasBit = function (corner, bit) {