@material/web 1.0.0-pre.0 → 1.0.0-pre.2

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 (423) hide show
  1. package/README.md +66 -19
  2. package/autocomplete/lib/_filled-autocomplete.scss +1 -34
  3. package/autocomplete/lib/_outlined-autocomplete.scss +1 -34
  4. package/autocomplete/lib/autocomplete.d.ts +0 -4
  5. package/autocomplete/lib/autocomplete.js +5 -12
  6. package/autocomplete/lib/autocomplete.js.map +1 -1
  7. package/autocomplete/lib/autocompleteitem/autocomplete-item.d.ts +2 -2
  8. package/autocomplete/lib/autocompleteitem/autocomplete-item.js +2 -2
  9. package/autocomplete/lib/autocompleteitem/autocomplete-item.js.map +1 -1
  10. package/autocomplete/lib/autocompletelist/autocomplete-list.d.ts +1 -1
  11. package/autocomplete/lib/autocompletelist/autocomplete-list.js +2 -2
  12. package/autocomplete/lib/autocompletelist/autocomplete-list.js.map +1 -1
  13. package/autocomplete/lib/filled-styles.css.js +1 -1
  14. package/autocomplete/lib/filled-styles.css.js.map +1 -1
  15. package/autocomplete/lib/outlined-styles.css.js +1 -1
  16. package/autocomplete/lib/outlined-styles.css.js.map +1 -1
  17. package/button/lib/_elevation.scss +1 -1
  18. package/button/lib/_icon.scss +12 -29
  19. package/button/lib/_shared.scss +1 -0
  20. package/button/lib/button.d.ts +1 -14
  21. package/button/lib/button.js +6 -42
  22. package/button/lib/button.js.map +1 -1
  23. package/button/lib/filled-styles.css.js +1 -1
  24. package/button/lib/filled-styles.css.js.map +1 -1
  25. package/button/lib/link-button.d.ts +0 -1
  26. package/button/lib/link-button.js +0 -5
  27. package/button/lib/link-button.js.map +1 -1
  28. package/button/lib/shared-elevation-styles.css.js +1 -1
  29. package/button/lib/shared-elevation-styles.css.js.map +1 -1
  30. package/button/lib/shared-styles.css.js +1 -1
  31. package/button/lib/shared-styles.css.js.map +1 -1
  32. package/checkbox/checkbox.d.ts +11 -2
  33. package/checkbox/checkbox.js +11 -2
  34. package/checkbox/checkbox.js.map +1 -1
  35. package/checkbox/lib/checkbox.d.ts +28 -0
  36. package/checkbox/lib/checkbox.js +30 -1
  37. package/checkbox/lib/checkbox.js.map +1 -1
  38. package/chips/chip/lib/_chip-theme.scss +1 -1
  39. package/dialog/_dialog.scss +6 -0
  40. package/dialog/dialog.d.ts +38 -0
  41. package/dialog/dialog.js +41 -0
  42. package/dialog/dialog.js.map +1 -0
  43. package/dialog/harness.d.ts +18 -0
  44. package/dialog/harness.js +55 -0
  45. package/dialog/harness.js.map +1 -0
  46. package/dialog/lib/_dialog.scss +386 -0
  47. package/dialog/lib/_tokens.scss +86 -0
  48. package/{elevationold/lib/elevation-overlay-styles.css.d.ts → dialog/lib/dialog-styles.css.d.ts} +0 -0
  49. package/dialog/lib/dialog-styles.css.js +9 -0
  50. package/dialog/lib/dialog-styles.css.js.map +1 -0
  51. package/dialog/lib/dialog-styles.scss +8 -0
  52. package/dialog/lib/dialog.d.ts +190 -0
  53. package/dialog/lib/dialog.js +566 -0
  54. package/dialog/lib/dialog.js.map +1 -0
  55. package/divider/_divider.scss +6 -0
  56. package/divider/divider.d.ts +24 -0
  57. package/divider/divider.js +27 -0
  58. package/divider/divider.js.map +1 -0
  59. package/divider/lib/_divider.scss +54 -0
  60. package/{list/lib/divider/list-divider-styles.css.d.ts → divider/lib/divider-styles.css.d.ts} +0 -0
  61. package/divider/lib/divider-styles.css.js +9 -0
  62. package/divider/lib/divider-styles.css.js.map +1 -0
  63. package/divider/lib/divider-styles.scss +8 -0
  64. package/divider/lib/divider.d.ts +23 -0
  65. package/divider/lib/divider.js +41 -0
  66. package/divider/lib/divider.js.map +1 -0
  67. package/elevation/lib/_elevation.scss +1 -1
  68. package/elevation/lib/_md-comp-elevation.scss +1 -1
  69. package/elevation/lib/elevation-styles.css.js +1 -1
  70. package/elevation/lib/elevation-styles.css.js.map +1 -1
  71. package/fab/lib/_shared.scss +1 -1
  72. package/fab/lib/fab-shared-styles.css.js +1 -1
  73. package/fab/lib/fab-shared-styles.css.js.map +1 -1
  74. package/field/lib/_filled-field.scss +5 -2
  75. package/field/lib/_md-comp-filled-field.scss +3 -1
  76. package/field/lib/_md-comp-outlined-field.scss +1 -1
  77. package/field/lib/_shared.scss +2 -0
  78. package/field/lib/field.d.ts +0 -2
  79. package/field/lib/field.js +2 -4
  80. package/field/lib/field.js.map +1 -1
  81. package/field/lib/filled-styles.css.js +1 -1
  82. package/field/lib/filled-styles.css.js.map +1 -1
  83. package/field/lib/outlined-styles.css.js +1 -1
  84. package/field/lib/outlined-styles.css.js.map +1 -1
  85. package/field/lib/shared-styles.css.js +1 -1
  86. package/field/lib/shared-styles.css.js.map +1 -1
  87. package/focus/lib/_focus-ring.scss +3 -10
  88. package/focus/lib/focus-ring-styles.css.js +1 -1
  89. package/focus/lib/focus-ring-styles.css.js.map +1 -1
  90. package/focus/lib/focus-ring.d.ts +1 -4
  91. package/focus/lib/focus-ring.js +2 -11
  92. package/focus/lib/focus-ring.js.map +1 -1
  93. package/icon/lib/_icon.scss +8 -5
  94. package/icon/lib/icon-styles.css.js +1 -1
  95. package/icon/lib/icon-styles.css.js.map +1 -1
  96. package/iconbutton/lib/_filled-icon-button.scss +1 -1
  97. package/iconbutton/lib/_filled-tonal-icon-button.scss +1 -1
  98. package/iconbutton/lib/_outlined-icon-button.scss +9 -22
  99. package/iconbutton/lib/_shared.scss +14 -40
  100. package/iconbutton/lib/_standard-icon-button.scss +6 -14
  101. package/iconbutton/lib/filled-styles.css.js +1 -1
  102. package/iconbutton/lib/filled-styles.css.js.map +1 -1
  103. package/iconbutton/lib/filled-tonal-styles.css.js +1 -1
  104. package/iconbutton/lib/filled-tonal-styles.css.js.map +1 -1
  105. package/iconbutton/lib/icon-button-toggle.d.ts +13 -42
  106. package/iconbutton/lib/icon-button-toggle.js +33 -103
  107. package/iconbutton/lib/icon-button-toggle.js.map +1 -1
  108. package/iconbutton/lib/icon-button.d.ts +2 -4
  109. package/iconbutton/lib/icon-button.js +3 -9
  110. package/iconbutton/lib/icon-button.js.map +1 -1
  111. package/iconbutton/lib/outlined-styles.css.js +1 -1
  112. package/iconbutton/lib/outlined-styles.css.js.map +1 -1
  113. package/iconbutton/lib/shared-styles.css.js +1 -1
  114. package/iconbutton/lib/shared-styles.css.js.map +1 -1
  115. package/iconbutton/lib/standard-styles.css.js +1 -1
  116. package/iconbutton/lib/standard-styles.css.js.map +1 -1
  117. package/list/lib/_list.scss +32 -40
  118. package/list/lib/avatar/_list-item-avatar.scss +1 -1
  119. package/list/lib/avatar/list-item-avatar-styles.css.js +1 -1
  120. package/list/lib/avatar/list-item-avatar-styles.css.js.map +1 -1
  121. package/list/lib/avatar/list-item-avatar.d.ts +9 -4
  122. package/list/lib/avatar/list-item-avatar.js +24 -11
  123. package/list/lib/avatar/list-item-avatar.js.map +1 -1
  124. package/list/lib/icon/_list-item-icon.scss +3 -1
  125. package/list/lib/icon/list-item-icon-styles.css.js +1 -1
  126. package/list/lib/icon/list-item-icon-styles.css.js.map +1 -1
  127. package/list/lib/icon/list-item-icon.d.ts +0 -3
  128. package/list/lib/icon/list-item-icon.js +1 -12
  129. package/list/lib/icon/list-item-icon.js.map +1 -1
  130. package/list/lib/image/_list-item-image.scss +1 -1
  131. package/list/lib/image/list-item-image-styles.css.js +1 -1
  132. package/list/lib/image/list-item-image-styles.css.js.map +1 -1
  133. package/list/lib/image/list-item-image.d.ts +11 -4
  134. package/list/lib/image/list-item-image.js +24 -13
  135. package/list/lib/image/list-item-image.js.map +1 -1
  136. package/list/lib/list-styles.css.js +1 -1
  137. package/list/lib/list-styles.css.js.map +1 -1
  138. package/list/lib/list.d.ts +99 -28
  139. package/list/lib/list.js +210 -111
  140. package/list/lib/list.js.map +1 -1
  141. package/list/lib/listitem/_list-item.scss +104 -39
  142. package/list/lib/listitem/harness.js +2 -1
  143. package/list/lib/listitem/harness.js.map +1 -1
  144. package/{menu/lib/menu-button-styles.css.d.ts → list/lib/listitem/list-item-private-styles.css.d.ts} +0 -0
  145. package/list/lib/listitem/list-item-private-styles.css.js +9 -0
  146. package/list/lib/listitem/list-item-private-styles.css.js.map +1 -0
  147. package/list/lib/listitem/list-item-private-styles.scss +8 -0
  148. package/list/lib/listitem/list-item-styles.css.js +1 -1
  149. package/list/lib/listitem/list-item-styles.css.js.map +1 -1
  150. package/list/lib/listitem/list-item.d.ts +99 -43
  151. package/list/lib/listitem/list-item.js +201 -172
  152. package/list/lib/listitem/list-item.js.map +1 -1
  153. package/list/lib/listitemlink/list-item-link.d.ts +17 -0
  154. package/list/lib/listitemlink/list-item-link.js +42 -0
  155. package/list/lib/listitemlink/list-item-link.js.map +1 -0
  156. package/list/lib/video/_list-item-video.scss +10 -4
  157. package/list/lib/video/list-item-video-styles.css.js +1 -1
  158. package/list/lib/video/list-item-video-styles.css.js.map +1 -1
  159. package/list/lib/video/list-item-video.d.ts +43 -4
  160. package/list/lib/video/list-item-video.js +90 -12
  161. package/list/lib/video/list-item-video.js.map +1 -1
  162. package/list/list-item-avatar.d.ts +2 -1
  163. package/list/list-item-avatar.js +2 -1
  164. package/list/list-item-avatar.js.map +1 -1
  165. package/list/list-item-icon.d.ts +2 -1
  166. package/list/list-item-icon.js +2 -1
  167. package/list/list-item-icon.js.map +1 -1
  168. package/list/list-item-image.d.ts +2 -1
  169. package/list/list-item-image.js +2 -1
  170. package/list/list-item-image.js.map +1 -1
  171. package/list/list-item-link.d.ts +35 -0
  172. package/list/list-item-link.js +39 -0
  173. package/list/list-item-link.js.map +1 -0
  174. package/list/list-item-video.d.ts +2 -1
  175. package/list/list-item-video.js +2 -1
  176. package/list/list-item-video.js.map +1 -1
  177. package/list/list-item.d.ts +18 -2
  178. package/list/list-item.js +20 -3
  179. package/list/list-item.js.map +1 -1
  180. package/list/list.d.ts +15 -1
  181. package/list/list.js +15 -1
  182. package/list/list.js.map +1 -1
  183. package/menu/_menu-item.scss +6 -0
  184. package/menu/_menu.scss +6 -0
  185. package/menu/harness.d.ts +5 -0
  186. package/menu/harness.js +22 -0
  187. package/menu/harness.js.map +1 -1
  188. package/menu/lib/_menu.scss +61 -62
  189. package/menu/lib/menu-styles.css.js +1 -1
  190. package/menu/lib/menu-styles.css.js.map +1 -1
  191. package/menu/lib/menu.d.ts +176 -42
  192. package/menu/lib/menu.js +506 -246
  193. package/menu/lib/menu.js.map +1 -1
  194. package/menu/lib/menuitem/_menu-item.scss +115 -0
  195. package/{tokens/v0_150/index.test.css.d.ts → menu/lib/menuitem/menu-item-private-styles.css.d.ts} +0 -0
  196. package/menu/lib/menuitem/menu-item-private-styles.css.js +9 -0
  197. package/menu/lib/menuitem/menu-item-private-styles.css.js.map +1 -0
  198. package/menu/lib/menuitem/menu-item-private-styles.scss +8 -0
  199. package/{tokens/v0_150/lib.test.css.d.ts → menu/lib/menuitem/menu-item-styles.css.d.ts} +0 -0
  200. package/menu/lib/menuitem/menu-item-styles.css.js +9 -0
  201. package/menu/lib/menuitem/menu-item-styles.css.js.map +1 -0
  202. package/menu/lib/menuitem/menu-item-styles.scss +8 -0
  203. package/menu/lib/menuitem/menu-item.d.ts +20 -3
  204. package/menu/lib/menuitem/menu-item.js +42 -3
  205. package/menu/lib/menuitem/menu-item.js.map +1 -1
  206. package/menu/lib/menuitemlink/menu-item-link.d.ts +25 -0
  207. package/menu/lib/menuitemlink/menu-item-link.js +51 -0
  208. package/menu/lib/menuitemlink/menu-item-link.js.map +1 -0
  209. package/menu/lib/shared.d.ts +134 -0
  210. package/menu/lib/shared.js +85 -0
  211. package/menu/lib/shared.js.map +1 -0
  212. package/menu/lib/submenuitem/harness.d.ts +11 -0
  213. package/menu/lib/submenuitem/harness.js +12 -0
  214. package/menu/lib/submenuitem/harness.js.map +1 -0
  215. package/menu/lib/submenuitem/sub-menu-item.d.ts +89 -0
  216. package/menu/lib/submenuitem/sub-menu-item.js +266 -0
  217. package/menu/lib/submenuitem/sub-menu-item.js.map +1 -0
  218. package/menu/lib/surfacePositionController.d.ts +117 -0
  219. package/menu/lib/surfacePositionController.js +196 -0
  220. package/menu/lib/surfacePositionController.js.map +1 -0
  221. package/menu/lib/typeaheadController.d.ts +144 -0
  222. package/menu/lib/typeaheadController.js +242 -0
  223. package/menu/lib/typeaheadController.js.map +1 -0
  224. package/menu/menu-item-link.d.ts +33 -0
  225. package/menu/menu-item-link.js +37 -0
  226. package/menu/menu-item-link.js.map +1 -0
  227. package/menu/menu-item.d.ts +19 -2
  228. package/menu/menu-item.js +22 -4
  229. package/menu/menu-item.js.map +1 -1
  230. package/menu/menu.d.ts +45 -0
  231. package/menu/menu.js +43 -0
  232. package/menu/menu.js.map +1 -1
  233. package/menu/sub-menu-item.d.ts +60 -0
  234. package/menu/sub-menu-item.js +64 -0
  235. package/menu/sub-menu-item.js.map +1 -0
  236. package/menusurface/lib/_menu-surface.scss +1 -1
  237. package/menusurface/lib/menu-surface-styles.css.js +1 -1
  238. package/menusurface/lib/menu-surface-styles.css.js.map +1 -1
  239. package/motion/animation.d.ts +20 -3
  240. package/motion/animation.js +39 -4
  241. package/motion/animation.js.map +1 -1
  242. package/navigationbar/lib/_navigation-bar.scss +9 -9
  243. package/navigationbar/lib/navigation-bar-styles.css.js +1 -1
  244. package/navigationbar/lib/navigation-bar-styles.css.js.map +1 -1
  245. package/navigationdrawer/lib/_navigation-drawer.scss +1 -1
  246. package/navigationdrawer/lib/navigation-drawer-styles.css.js +1 -1
  247. package/navigationdrawer/lib/navigation-drawer-styles.css.js.map +1 -1
  248. package/navigationtab/lib/_navigation-tab.scss +8 -19
  249. package/navigationtab/lib/navigation-tab-styles.css.js +1 -1
  250. package/navigationtab/lib/navigation-tab-styles.css.js.map +1 -1
  251. package/package.json +1 -8
  252. package/radio/lib/_radio.scss +21 -22
  253. package/radio/lib/radio-styles.css.js +1 -1
  254. package/radio/lib/radio-styles.css.js.map +1 -1
  255. package/radio/lib/radio.d.ts +10 -1
  256. package/radio/lib/radio.js +12 -3
  257. package/radio/lib/radio.js.map +1 -1
  258. package/radio/radio.d.ts +16 -1
  259. package/radio/radio.js +16 -1
  260. package/radio/radio.js.map +1 -1
  261. package/ripple/lib/_ripple.scss +5 -21
  262. package/ripple/lib/ripple-styles.css.js +1 -1
  263. package/ripple/lib/ripple-styles.css.js.map +1 -1
  264. package/ripple/lib/ripple.js +2 -2
  265. package/ripple/lib/ripple.js.map +1 -1
  266. package/sass/_map-ext.scss +24 -0
  267. package/sass/_string-ext.scss +23 -0
  268. package/segmentedbuttonset/lib/segmented-button-set.d.ts +0 -2
  269. package/segmentedbuttonset/lib/segmented-button-set.js +0 -2
  270. package/segmentedbuttonset/lib/segmented-button-set.js.map +1 -1
  271. package/switch/lib/_handle.scss +56 -9
  272. package/switch/lib/_icon.scss +36 -0
  273. package/switch/lib/_switch.scss +1 -115
  274. package/switch/lib/_track.scss +39 -0
  275. package/switch/lib/switch-styles.css.js +1 -1
  276. package/switch/lib/switch-styles.css.js.map +1 -1
  277. package/switch/lib/switch.d.ts +3 -0
  278. package/switch/lib/switch.js +3 -0
  279. package/switch/lib/switch.js.map +1 -1
  280. package/textfield/lib/_filled-text-field.scss +4 -2
  281. package/textfield/lib/_outlined-text-field.scss +3 -2
  282. package/textfield/lib/filled-styles.css.js +1 -1
  283. package/textfield/lib/filled-styles.css.js.map +1 -1
  284. package/textfield/lib/outlined-styles.css.js +1 -1
  285. package/textfield/lib/outlined-styles.css.js.map +1 -1
  286. package/textfield/lib/text-field.d.ts +0 -2
  287. package/textfield/lib/text-field.js +0 -2
  288. package/textfield/lib/text-field.js.map +1 -1
  289. package/tokens/_index.scss +1 -1
  290. package/tokens/{v0_150 → v0_152}/_index.scss +1 -1
  291. package/tokens/{v0_150 → v0_152}/_md-comp-assist-chip.scss +2 -2
  292. package/tokens/{v0_150 → v0_152}/_md-comp-badge.scss +2 -2
  293. package/tokens/{v0_150 → v0_152}/_md-comp-banner.scss +2 -43
  294. package/tokens/{v0_150 → v0_152}/_md-comp-bottom-app-bar.scss +3 -4
  295. package/tokens/{v0_150 → v0_152}/_md-comp-carousel-item.scss +2 -2
  296. package/tokens/{v0_150 → v0_152}/_md-comp-checkbox.scss +2 -12
  297. package/tokens/{v0_150 → v0_152}/_md-comp-circular-progress-indicator.scss +2 -2
  298. package/tokens/{v0_150 → v0_152}/_md-comp-data-table.scss +2 -4
  299. package/tokens/{v0_150 → v0_152}/_md-comp-date-input-modal.scss +2 -2
  300. package/tokens/{v0_150 → v0_152}/_md-comp-date-picker-docked.scss +2 -2
  301. package/tokens/{v0_150 → v0_152}/_md-comp-date-picker-modal.scss +2 -2
  302. package/tokens/{v0_150 → v0_152}/_md-comp-dialog.scss +2 -25
  303. package/tokens/{v0_150 → v0_152}/_md-comp-divider.scss +2 -2
  304. package/tokens/{v0_150 → v0_152}/_md-comp-elevated-button.scss +2 -2
  305. package/tokens/{v0_150 → v0_152}/_md-comp-elevated-card.scss +2 -2
  306. package/tokens/{v0_150 → v0_152}/_md-comp-extended-fab-branded.scss +2 -2
  307. package/tokens/{v0_150 → v0_152}/_md-comp-extended-fab-primary.scss +2 -2
  308. package/tokens/{v0_150 → v0_152}/_md-comp-extended-fab-secondary.scss +2 -2
  309. package/tokens/{v0_150 → v0_152}/_md-comp-extended-fab-surface.scss +2 -2
  310. package/tokens/{v0_150 → v0_152}/_md-comp-extended-fab-tertiary.scss +2 -4
  311. package/tokens/{v0_150 → v0_152}/_md-comp-fab-branded-large.scss +2 -3
  312. package/tokens/{v0_150 → v0_152}/_md-comp-fab-branded.scss +2 -2
  313. package/tokens/{v0_150 → v0_152}/_md-comp-fab-primary-large.scss +2 -2
  314. package/tokens/{v0_150 → v0_152}/_md-comp-fab-primary-small.scss +2 -2
  315. package/tokens/{v0_150 → v0_152}/_md-comp-fab-primary.scss +2 -2
  316. package/tokens/{v0_150 → v0_152}/_md-comp-fab-secondary-large.scss +2 -2
  317. package/tokens/{v0_150 → v0_152}/_md-comp-fab-secondary-small.scss +2 -2
  318. package/tokens/{v0_150 → v0_152}/_md-comp-fab-secondary.scss +2 -2
  319. package/tokens/{v0_150 → v0_152}/_md-comp-fab-surface-large.scss +2 -2
  320. package/tokens/{v0_150 → v0_152}/_md-comp-fab-surface-small.scss +2 -2
  321. package/tokens/{v0_150 → v0_152}/_md-comp-fab-surface.scss +2 -2
  322. package/tokens/{v0_150 → v0_152}/_md-comp-fab-tertiary-large.scss +2 -2
  323. package/tokens/{v0_150 → v0_152}/_md-comp-fab-tertiary-small.scss +2 -2
  324. package/tokens/{v0_150 → v0_152}/_md-comp-fab-tertiary.scss +2 -2
  325. package/tokens/{v0_150 → v0_152}/_md-comp-filled-autocomplete.scss +2 -3
  326. package/tokens/{v0_150 → v0_152}/_md-comp-filled-button.scss +2 -8
  327. package/tokens/{v0_150 → v0_152}/_md-comp-filled-card.scss +2 -4
  328. package/tokens/{v0_150 → v0_152}/_md-comp-filled-icon-button.scss +2 -2
  329. package/tokens/{v0_150 → v0_152}/_md-comp-filled-menu-button.scss +2 -2
  330. package/tokens/{v0_150 → v0_152}/_md-comp-filled-select.scss +2 -6
  331. package/tokens/{v0_150 → v0_152}/_md-comp-filled-text-field.scss +2 -3
  332. package/tokens/{v0_150 → v0_152}/_md-comp-filled-tonal-button.scss +2 -2
  333. package/tokens/{v0_150 → v0_152}/_md-comp-filled-tonal-icon-button.scss +2 -2
  334. package/tokens/{v0_150 → v0_152}/_md-comp-filter-chip.scss +2 -30
  335. package/tokens/{v0_150 → v0_152}/_md-comp-full-screen-dialog.scss +3 -53
  336. package/tokens/{v0_150 → v0_152}/_md-comp-icon-button.scss +3 -3
  337. package/tokens/{v0_150 → v0_152}/_md-comp-input-chip.scss +2 -52
  338. package/tokens/{v0_150 → v0_152}/_md-comp-linear-progress-indicator.scss +2 -2
  339. package/tokens/{v0_150 → v0_152}/_md-comp-list.scss +3 -12
  340. package/tokens/{v0_150 → v0_152}/_md-comp-menu.scss +2 -4
  341. package/tokens/{v0_150 → v0_152}/_md-comp-navigation-bar.scss +2 -9
  342. package/tokens/{v0_150 → v0_152}/_md-comp-navigation-drawer.scss +2 -8
  343. package/tokens/{v0_150 → v0_152}/_md-comp-navigation-rail.scss +2 -39
  344. package/tokens/{v0_150 → v0_152}/_md-comp-outlined-autocomplete.scss +2 -3
  345. package/tokens/{v0_150 → v0_152}/_md-comp-outlined-button.scss +2 -6
  346. package/tokens/{v0_150 → v0_152}/_md-comp-outlined-card.scss +2 -2
  347. package/tokens/{v0_150 → v0_152}/_md-comp-outlined-icon-button.scss +2 -4
  348. package/tokens/{v0_150 → v0_152}/_md-comp-outlined-menu-button.scss +2 -2
  349. package/tokens/{v0_150 → v0_152}/_md-comp-outlined-segmented-button.scss +2 -2
  350. package/tokens/{v0_150 → v0_152}/_md-comp-outlined-select.scss +2 -6
  351. package/tokens/{v0_150 → v0_152}/_md-comp-outlined-text-field.scss +2 -3
  352. package/tokens/{v0_150 → v0_152}/_md-comp-plain-tooltip.scss +2 -2
  353. package/tokens/{v0_150 → v0_152}/_md-comp-primary-navigation-tab.scss +2 -2
  354. package/tokens/{v0_150 → v0_152}/_md-comp-radio-button.scss +2 -2
  355. package/tokens/{v0_150 → v0_152}/_md-comp-rich-tooltip.scss +2 -2
  356. package/tokens/{v0_150 → v0_152}/_md-comp-scrim.scss +2 -2
  357. package/tokens/{v0_150 → v0_152}/_md-comp-search-bar.scss +2 -2
  358. package/tokens/{v0_150 → v0_152}/_md-comp-search-view.scss +2 -2
  359. package/tokens/{v0_150 → v0_152}/_md-comp-secondary-navigation-tab.scss +2 -2
  360. package/tokens/{v0_150 → v0_152}/_md-comp-sheet-bottom.scss +2 -2
  361. package/tokens/{v0_150 → v0_152}/_md-comp-sheet-floating.scss +2 -2
  362. package/tokens/{v0_150 → v0_152}/_md-comp-sheet-side.scss +4 -2
  363. package/tokens/{v0_150 → v0_152}/_md-comp-slider.scss +2 -4
  364. package/tokens/{v0_150 → v0_152}/_md-comp-snackbar.scss +2 -2
  365. package/tokens/{v0_150 → v0_152}/_md-comp-standard-menu-button.scss +2 -2
  366. package/tokens/{v0_150 → v0_152}/_md-comp-suggestion-chip.scss +2 -2
  367. package/tokens/{v0_150 → v0_152}/_md-comp-switch.scss +2 -11
  368. package/tokens/{v0_150 → v0_152}/_md-comp-text-button.scss +2 -6
  369. package/tokens/{v0_150 → v0_152}/_md-comp-time-input.scss +2 -2
  370. package/tokens/{v0_150 → v0_152}/_md-comp-time-picker.scss +2 -5
  371. package/tokens/{v0_150 → v0_152}/_md-comp-top-app-bar-large.scss +2 -2
  372. package/tokens/{v0_150 → v0_152}/_md-comp-top-app-bar-medium.scss +2 -2
  373. package/tokens/{v0_150 → v0_152}/_md-comp-top-app-bar-small-centered.scss +2 -3
  374. package/tokens/{v0_150 → v0_152}/_md-comp-top-app-bar-small.scss +2 -3
  375. package/tokens/{v0_150 → v0_152}/_md-ref-palette.scss +2 -2
  376. package/tokens/{v0_150 → v0_152}/_md-ref-typeface.scss +2 -2
  377. package/tokens/{v0_150 → v0_152}/_md-sys-color.scss +2 -20
  378. package/tokens/{v0_150 → v0_152}/_md-sys-elevation.scss +4 -13
  379. package/tokens/{v0_150 → v0_152}/_md-sys-motion.scss +2 -2
  380. package/tokens/{v0_150 → v0_152}/_md-sys-shape.scss +2 -2
  381. package/tokens/{v0_150 → v0_152}/_md-sys-state.scss +2 -2
  382. package/tokens/{v0_150 → v0_152}/_md-sys-typescale.scss +2 -3
  383. package/tokens/v0_152/index.test.css.d.ts +1 -0
  384. package/tokens/{v0_150 → v0_152}/index.test.css.js +0 -0
  385. package/tokens/{v0_150 → v0_152}/index.test.css.js.map +0 -0
  386. package/tokens/{v0_150 → v0_152}/index.test.scss +1 -1
  387. package/tokens/v0_152/lib.test.css.d.ts +1 -0
  388. package/tokens/{v0_150 → v0_152}/lib.test.css.js +0 -0
  389. package/tokens/{v0_150 → v0_152}/lib.test.css.js.map +0 -0
  390. package/tokens/{v0_150 → v0_152}/lib.test.scss +1 -1
  391. package/CHANGELOG.md +0 -141
  392. package/elevationold/lib/elevation-overlay-styles.css.js +0 -9
  393. package/elevationold/lib/elevation-overlay-styles.css.js.map +0 -1
  394. package/list/lib/_tokens.scss +0 -80
  395. package/list/lib/divider/_list-divider.scss +0 -46
  396. package/list/lib/divider/list-divider-styles.css.js +0 -9
  397. package/list/lib/divider/list-divider-styles.css.js.map +0 -1
  398. package/list/lib/divider/list-divider-styles.scss +0 -8
  399. package/list/lib/divider/list-divider.d.ts +0 -13
  400. package/list/lib/divider/list-divider.js +0 -32
  401. package/list/lib/divider/list-divider.js.map +0 -1
  402. package/list/list-divider.d.ts +0 -19
  403. package/list/list-divider.js +0 -22
  404. package/list/list-divider.js.map +0 -1
  405. package/menu/lib/_menu-button.scss +0 -14
  406. package/menu/lib/adapter.d.ts +0 -66
  407. package/menu/lib/adapter.js +0 -7
  408. package/menu/lib/adapter.js.map +0 -1
  409. package/menu/lib/constants.d.ts +0 -22
  410. package/menu/lib/constants.js +0 -23
  411. package/menu/lib/constants.js.map +0 -1
  412. package/menu/lib/foundation.d.ts +0 -49
  413. package/menu/lib/foundation.js +0 -123
  414. package/menu/lib/foundation.js.map +0 -1
  415. package/menu/lib/menu-button-styles.css.js +0 -9
  416. package/menu/lib/menu-button-styles.css.js.map +0 -1
  417. package/menu/lib/menu-button-styles.scss +0 -8
  418. package/menu/lib/menu-button.d.ts +0 -27
  419. package/menu/lib/menu-button.js +0 -93
  420. package/menu/lib/menu-button.js.map +0 -1
  421. package/menu/menu-button.d.ts +0 -14
  422. package/menu/menu-button.js +0 -17
  423. package/menu/menu-button.js.map +0 -1
@@ -3,44 +3,115 @@
3
3
  * Copyright 2021 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import '../../elevation/elevation.js';
7
- import { LitElement, PropertyValues, TemplateResult } from 'lit';
6
+ import { LitElement, TemplateResult } from 'lit';
8
7
  import { ClassInfo } from 'lit/directives/class-map.js';
9
8
  import { ARIARole } from '../../types/aria.js';
10
9
  import { ListItem } from './listitem/list-item.js';
11
- /** @soyCompatible */
12
10
  export declare class List extends LitElement {
13
11
  static shadowRootOptions: ShadowRootInit;
14
12
  ariaLabel: string;
15
13
  ariaActivedescendant: string;
16
14
  role: ARIARole;
17
- listId: string;
15
+ /**
16
+ * The tabindex of the underlying list.
17
+ */
18
18
  listTabIndex: number;
19
- items: ListItem[];
20
- activeListItem: ListItem | null;
21
19
  listRoot: HTMLElement;
22
- listItemTagName: string;
23
- protected assignedElements: HTMLElement[] | null;
24
- firstUpdated(changedProperties: PropertyValues): void;
25
- /** @soyTemplate */
20
+ /**
21
+ * An array of activatable and disableable list items. Queries every assigned
22
+ * element that has the `md-list-item` attribute.
23
+ *
24
+ * _NOTE:_ This is a shallow, flattened query via
25
+ * `HTMLSlotElement.queryAssignedElements` and thus will _only_ include direct
26
+ * children / directly slotted elements.
27
+ */
28
+ items: ListItem[];
26
29
  render(): TemplateResult;
27
- /** @soyTemplate */
28
- protected getRenderClasses(): ClassInfo;
30
+ /**
31
+ * Renders the main list element.
32
+ */
33
+ protected renderList(): TemplateResult<1>;
34
+ /**
35
+ * The classes to be applied to the underlying list.
36
+ */
37
+ protected getListClasses(): ClassInfo;
38
+ /**
39
+ * The content to be slotted into the list.
40
+ */
41
+ protected renderContent(): TemplateResult<1>;
42
+ /**
43
+ * Handles keyboard navigation in the list.
44
+ *
45
+ * @param event {KeyboardEvent} The keyboard event that triggers this handler.
46
+ */
29
47
  handleKeydown(event: KeyboardEvent): void;
30
- protected activateListItem(item: ListItem): void;
31
- protected deactivateListItem(item: ListItem): void;
32
- protected isListItemActive(item: ListItem): boolean;
33
- protected handleAction(event: CustomEvent): void;
34
- activateFirstItem(): void;
35
- activateLastItem(): void;
36
- resetActiveListItem(): void;
37
- focusListRoot(): void;
38
- /** Updates `this.items` based on slot elements in the DOM. */
39
- protected updateItems(): void;
40
- /** @return Whether the given element is a list item element. */
41
- private isListItem;
42
- private getFirstItem;
43
- private getLastItem;
44
- private getPrevItem;
45
- private getNextItem;
48
+ /**
49
+ * Activates the first non-disabled item of a given array of items.
50
+ *
51
+ * @param items {Array<ListItem>} The items from which to activate the
52
+ * first item.
53
+ */
54
+ static activateFirstItem<T extends ListItem>(items: T[]): void;
55
+ /**
56
+ * Activates the last non-disabled item of a given array of items.
57
+ *
58
+ * @param items {Array<ListItem>} The items from which to activate the
59
+ * last item.
60
+ */
61
+ static activateLastItem<T extends ListItem>(items: T[]): void;
62
+ /**
63
+ * Deactivates the currently active item of a given array of items.
64
+ *
65
+ * @param items {Array<ListItem>} The items from which to deactivate the
66
+ * active item.
67
+ * @returns A record of the deleselcted activated item including the item and
68
+ * the index of the item or `null` if none are deactivated.
69
+ */
70
+ static deactivateActiveItem<T extends ListItem>(items: T[]): {
71
+ item: T;
72
+ index: number;
73
+ };
74
+ focus(): void;
75
+ /**
76
+ * Retrieves the the first activated item of a given array of items.
77
+ *
78
+ * @param items {Array<ListItem>} The items to search.
79
+ * @returns A record of the first activated item including the item and the
80
+ * index of the item or `null` if none are activated.
81
+ */
82
+ static getActiveItem<T extends ListItem>(items: T[]): {
83
+ item: T;
84
+ index: number;
85
+ };
86
+ /**
87
+ * Retrieves the the first non-disabled item of a given array of items. This
88
+ * the first item that is not disabled.
89
+ *
90
+ * @param items {Array<ListItem>} The items to search.
91
+ * @returns The first activatable item or `null` if none are activatable.
92
+ */
93
+ static getFirstActivatableItem<T extends ListItem>(items: T[]): T;
94
+ /**
95
+ * Retrieves the the last non-disabled item of a given array of items.
96
+ *
97
+ * @param items {Array<ListItem>} The items to search.
98
+ * @returns The last activatable item or `null` if none are activatable.
99
+ */
100
+ static getLastActivatableItem<T extends ListItem>(items: T[]): T;
101
+ /**
102
+ * Retrieves the the next non-disabled item of a given array of items.
103
+ *
104
+ * @param items {Array<ListItem>} The items to search.
105
+ * @param index {{index: number}} The index to search from.
106
+ * @returns The next activatable item or `null` if none are activatable.
107
+ */
108
+ protected static getNextItem<T extends ListItem>(items: T[], index: number): T;
109
+ /**
110
+ * Retrieves the the previous non-disabled item of a given array of items.
111
+ *
112
+ * @param items {Array<ListItem>} The items to search.
113
+ * @param index {{index: number}} The index to search from.
114
+ * @returns The previous activatable item or `null` if none are activatable.
115
+ */
116
+ protected static getPrevItem<T extends ListItem>(items: T[], index: number): T;
46
117
  }
package/list/lib/list.js CHANGED
@@ -4,165 +4,268 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { __decorate, __metadata } from "tslib";
7
- import '../../elevation/elevation.js';
7
+ // Required for @ariaProperty
8
+ // tslint:disable:no-new-decorators
8
9
  import { html, LitElement } from 'lit';
9
10
  import { property, query, queryAssignedElements } from 'lit/decorators.js';
10
11
  import { classMap } from 'lit/directives/class-map.js';
11
12
  import { ifDefined } from 'lit/directives/if-defined.js';
12
13
  import { ariaProperty } from '../../decorators/aria-property.js';
13
- const NAVIGATABLE_KEYS = {
14
+ const NAVIGABLE_KEYS = {
14
15
  ArrowDown: 'ArrowDown',
15
16
  ArrowUp: 'ArrowUp',
16
17
  Home: 'Home',
17
18
  End: 'End',
18
19
  };
19
- /** @soyCompatible */
20
+ const navigableKeySet = new Set(Object.values(NAVIGABLE_KEYS));
21
+ function isNavigableKey(key) {
22
+ return navigableKeySet.has(key);
23
+ }
24
+ // tslint:disable-next-line:enforce-comments-on-exported-symbols
20
25
  export class List extends LitElement {
21
26
  constructor() {
22
27
  super(...arguments);
23
28
  // @ts-ignore(b/264292293): Use `override` with TS 4.9+
24
29
  this.role = 'list';
25
- this.listId = '';
30
+ /**
31
+ * The tabindex of the underlying list.
32
+ */
26
33
  this.listTabIndex = 0;
27
- this.items = [];
28
- this.activeListItem = null;
29
- this.listItemTagName = 'md-list-item';
30
- }
31
- firstUpdated(changedProperties) {
32
- super.firstUpdated(changedProperties);
33
- this.updateItems();
34
34
  }
35
- /** @soyTemplate */
36
35
  render() {
36
+ return this.renderList();
37
+ }
38
+ /**
39
+ * Renders the main list element.
40
+ */
41
+ renderList() {
37
42
  return html `
38
- <ul class="md3-list ${classMap(this.getRenderClasses())}"
39
- aria-label="${ifDefined(this.ariaLabel)}"
40
- id=${ifDefined(this.listId || undefined)}
41
- tabindex=${this.listTabIndex}
42
- role=${this.role}
43
- @action=${this.handleAction}
44
- @keydown=${this.handleKeydown}
45
- >
46
- <span><slot></slot></span>
47
- <md-elevation surface></md-elevation>
48
- </ul>
49
- `;
43
+ <ul class="md3-list ${classMap(this.getListClasses())}"
44
+ aria-label="${ifDefined(this.ariaLabel)}"
45
+ tabindex=${this.listTabIndex}
46
+ role=${this.role}
47
+ @keydown=${this.handleKeydown}
48
+ >
49
+ ${this.renderContent()}
50
+ </ul>
51
+ `;
50
52
  }
51
- /** @soyTemplate */
52
- getRenderClasses() {
53
+ /**
54
+ * The classes to be applied to the underlying list.
55
+ */
56
+ getListClasses() {
53
57
  return {};
54
58
  }
59
+ /**
60
+ * The content to be slotted into the list.
61
+ */
62
+ renderContent() {
63
+ return html `<span><slot @click=${(e) => {
64
+ e.stopPropagation();
65
+ }}></slot></span>`;
66
+ }
67
+ /**
68
+ * Handles keyboard navigation in the list.
69
+ *
70
+ * @param event {KeyboardEvent} The keyboard event that triggers this handler.
71
+ */
55
72
  handleKeydown(event) {
56
- if (Object.values(NAVIGATABLE_KEYS).indexOf(event.key) === -1)
73
+ const key = event.key;
74
+ if (!isNavigableKey(key)) {
57
75
  return;
58
- for (const item of this.items) {
59
- if (this.isListItemActive(item)) {
60
- this.activeListItem = item;
61
- }
62
- this.deactivateListItem(item);
63
76
  }
64
- if (event.key === NAVIGATABLE_KEYS.ArrowDown) {
65
- event.preventDefault();
66
- if (this.activeListItem) {
67
- this.activeListItem = this.getNextItem(this.activeListItem);
68
- }
69
- else {
70
- this.activeListItem = this.getFirstItem();
71
- }
72
- }
73
- if (event.key === NAVIGATABLE_KEYS.ArrowUp) {
74
- event.preventDefault();
75
- if (this.activeListItem) {
76
- this.activeListItem = this.getPrevItem(this.activeListItem);
77
- }
78
- else {
79
- this.activeListItem = this.getLastItem();
80
- }
81
- }
82
- if (event.key === NAVIGATABLE_KEYS.Home) {
83
- event.preventDefault();
84
- this.activeListItem = this.getFirstItem();
77
+ // do not use this.items directly so we don't re-query the DOM unnecessarily
78
+ const items = this.items;
79
+ if (!items.length) {
80
+ return;
85
81
  }
86
- if (event.key === NAVIGATABLE_KEYS.End) {
87
- event.preventDefault();
88
- this.activeListItem = this.getLastItem();
82
+ const activeItemRecord = List.getActiveItem(items);
83
+ if (activeItemRecord) {
84
+ activeItemRecord.item.active = false;
89
85
  }
90
- if (this.activeListItem) {
91
- this.activateListItem(this.activeListItem);
86
+ event.preventDefault();
87
+ switch (key) {
88
+ // Activate the next item
89
+ case NAVIGABLE_KEYS.ArrowDown:
90
+ if (activeItemRecord) {
91
+ const next = List.getNextItem(items, activeItemRecord.index);
92
+ if (next)
93
+ next.active = true;
94
+ }
95
+ else {
96
+ List.activateFirstItem(items);
97
+ }
98
+ break;
99
+ // Activate the previous item
100
+ case NAVIGABLE_KEYS.ArrowUp:
101
+ if (activeItemRecord) {
102
+ const prev = List.getPrevItem(items, activeItemRecord.index);
103
+ if (prev)
104
+ prev.active = true;
105
+ }
106
+ else {
107
+ items[items.length - 1].active = true;
108
+ }
109
+ break;
110
+ // Activate the first item
111
+ case NAVIGABLE_KEYS.Home:
112
+ List.activateFirstItem(items);
113
+ break;
114
+ // Activate the last item
115
+ case NAVIGABLE_KEYS.End:
116
+ List.activateLastItem(items);
117
+ break;
118
+ default:
119
+ break;
92
120
  }
93
121
  }
94
- activateListItem(item) {
95
- item.activate();
96
- }
97
- deactivateListItem(item) {
98
- item.deactivate();
99
- }
100
- isListItemActive(item) {
101
- return item.isActive();
102
- }
103
- handleAction(event) { }
104
- activateFirstItem() {
105
- this.activeListItem = this.getFirstItem();
106
- this.activeListItem.activate();
122
+ /**
123
+ * Activates the first non-disabled item of a given array of items.
124
+ *
125
+ * @param items {Array<ListItem>} The items from which to activate the
126
+ * first item.
127
+ */
128
+ static activateFirstItem(items) {
129
+ // NOTE: These selector functions are static and not on the instance such
130
+ // that multiple operations can be chained and we do not have to re-query
131
+ // the DOM
132
+ const firstItem = List.getFirstActivatableItem(items);
133
+ if (firstItem) {
134
+ firstItem.active = true;
135
+ }
107
136
  }
108
- activateLastItem() {
109
- this.activeListItem = this.getLastItem();
110
- this.activeListItem.activate();
137
+ /**
138
+ * Activates the last non-disabled item of a given array of items.
139
+ *
140
+ * @param items {Array<ListItem>} The items from which to activate the
141
+ * last item.
142
+ */
143
+ static activateLastItem(items) {
144
+ const lastItem = List.getLastActivatableItem(items);
145
+ if (lastItem) {
146
+ lastItem.active = true;
147
+ }
111
148
  }
112
- resetActiveListItem() {
113
- this.activeListItem = null;
149
+ /**
150
+ * Deactivates the currently active item of a given array of items.
151
+ *
152
+ * @param items {Array<ListItem>} The items from which to deactivate the
153
+ * active item.
154
+ * @returns A record of the deleselcted activated item including the item and
155
+ * the index of the item or `null` if none are deactivated.
156
+ */
157
+ static deactivateActiveItem(items) {
158
+ const activeItem = List.getActiveItem(items);
159
+ if (activeItem) {
160
+ activeItem.item.active = false;
161
+ }
162
+ return activeItem;
114
163
  }
115
- focusListRoot() {
164
+ focus() {
116
165
  this.listRoot.focus();
117
166
  }
118
- /** Updates `this.items` based on slot elements in the DOM. */
119
- updateItems() {
120
- const elements = this.assignedElements || [];
121
- this.items = elements.filter(this.isListItem, this);
122
- }
123
- /** @return Whether the given element is a list item element. */
124
- isListItem(element) {
125
- return element.tagName.toLowerCase() === this.listItemTagName;
167
+ /**
168
+ * Retrieves the the first activated item of a given array of items.
169
+ *
170
+ * @param items {Array<ListItem>} The items to search.
171
+ * @returns A record of the first activated item including the item and the
172
+ * index of the item or `null` if none are activated.
173
+ */
174
+ static getActiveItem(items) {
175
+ for (let i = 0; i < items.length; i++) {
176
+ const item = items[i];
177
+ if (item.active) {
178
+ return {
179
+ item,
180
+ index: i,
181
+ };
182
+ }
183
+ }
184
+ return null;
126
185
  }
127
- getFirstItem() {
128
- return this.items[0];
186
+ /**
187
+ * Retrieves the the first non-disabled item of a given array of items. This
188
+ * the first item that is not disabled.
189
+ *
190
+ * @param items {Array<ListItem>} The items to search.
191
+ * @returns The first activatable item or `null` if none are activatable.
192
+ */
193
+ static getFirstActivatableItem(items) {
194
+ for (const item of items) {
195
+ if (!item.disabled) {
196
+ return item;
197
+ }
198
+ }
199
+ return null;
129
200
  }
130
- getLastItem() {
131
- return this.items[this.items.length - 1];
201
+ /**
202
+ * Retrieves the the last non-disabled item of a given array of items.
203
+ *
204
+ * @param items {Array<ListItem>} The items to search.
205
+ * @returns The last activatable item or `null` if none are activatable.
206
+ */
207
+ static getLastActivatableItem(items) {
208
+ for (let i = items.length - 1; i >= 0; i--) {
209
+ const item = items[i];
210
+ if (!item.disabled) {
211
+ return item;
212
+ }
213
+ }
214
+ return null;
132
215
  }
133
- getPrevItem(item) {
134
- const curIndex = this.items.indexOf(item);
135
- return this.items[curIndex === 0 ? this.items.length - 1 : curIndex - 1];
216
+ /**
217
+ * Retrieves the the next non-disabled item of a given array of items.
218
+ *
219
+ * @param items {Array<ListItem>} The items to search.
220
+ * @param index {{index: number}} The index to search from.
221
+ * @returns The next activatable item or `null` if none are activatable.
222
+ */
223
+ static getNextItem(items, index) {
224
+ for (let i = 1; i < items.length; i++) {
225
+ const nextIndex = (i + index) % items.length;
226
+ const item = items[nextIndex];
227
+ if (!item.disabled) {
228
+ return item;
229
+ }
230
+ }
231
+ return null;
136
232
  }
137
- getNextItem(item) {
138
- const curIndex = this.items.indexOf(item);
139
- return this.items[(curIndex + 1) % this.items.length];
233
+ /**
234
+ * Retrieves the the previous non-disabled item of a given array of items.
235
+ *
236
+ * @param items {Array<ListItem>} The items to search.
237
+ * @param index {{index: number}} The index to search from.
238
+ * @returns The previous activatable item or `null` if none are activatable.
239
+ */
240
+ static getPrevItem(items, index) {
241
+ for (let i = 1; i < items.length; i++) {
242
+ const prevIndex = (index - i + items.length) % items.length;
243
+ const item = items[prevIndex];
244
+ if (!item.disabled) {
245
+ return item;
246
+ }
247
+ }
248
+ return null;
140
249
  }
141
250
  }
142
251
  List.shadowRootOptions = { mode: 'open', delegatesFocus: true };
143
252
  __decorate([
144
- ariaProperty // tslint:disable-line:no-new-decorators
145
- ,
253
+ ariaProperty,
146
254
  property({ type: String, attribute: 'data-aria-label', noAccessor: true }),
147
255
  __metadata("design:type", String)
148
256
  ], List.prototype, "ariaLabel", void 0);
149
257
  __decorate([
150
- ariaProperty // tslint:disable-line:no-new-decorators
151
- ,
258
+ ariaProperty,
152
259
  property({ type: String, attribute: 'data-aria-activedescendant', noAccessor: true }),
153
260
  __metadata("design:type", String)
154
261
  ], List.prototype, "ariaActivedescendant", void 0);
155
262
  __decorate([
156
- ariaProperty // tslint:disable-line:no-new-decorators
157
- // tslint:disable-next-line:decorator-placement
263
+ ariaProperty
264
+ // tslint:disable-next-line
158
265
  ,
159
266
  property({ type: String, attribute: 'data-role', noAccessor: true }),
160
267
  __metadata("design:type", String)
161
268
  ], List.prototype, "role", void 0);
162
- __decorate([
163
- property({ type: String }),
164
- __metadata("design:type", Object)
165
- ], List.prototype, "listId", void 0);
166
269
  __decorate([
167
270
  property({ type: Number }),
168
271
  __metadata("design:type", Number)
@@ -172,11 +275,7 @@ __decorate([
172
275
  __metadata("design:type", HTMLElement)
173
276
  ], List.prototype, "listRoot", void 0);
174
277
  __decorate([
175
- property({ type: String }),
176
- __metadata("design:type", Object)
177
- ], List.prototype, "listItemTagName", void 0);
178
- __decorate([
179
- queryAssignedElements({ flatten: true }),
278
+ queryAssignedElements({ flatten: true, selector: '[md-list-item]' }),
180
279
  __metadata("design:type", Array)
181
- ], List.prototype, "assignedElements", void 0);
280
+ ], List.prototype, "items", void 0);
182
281
  //# sourceMappingURL=list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAiC,MAAM,KAAK,CAAC;AACrE,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AACzE,OA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AAC,WAAW,CAAC;8BAAY,WAAW;sCAAC;AAEjB;IAAzB,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;;6CAAkC;AAG3D;IADC,qBAAqB,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;;8CACS","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../elevation/elevation.js';\n\nimport {html, LitElement, PropertyValues, TemplateResult} from 'lit';\nimport {property, query, queryAssignedElements} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {ifDefined} from 'lit/directives/if-defined.js';\n\nimport {ariaProperty} from '../../decorators/aria-property.js';\nimport {ARIARole} from '../../types/aria.js';\n\nimport {ListItem} from './listitem/list-item.js';\n\nconst NAVIGATABLE_KEYS = {\n ArrowDown: 'ArrowDown',\n ArrowUp: 'ArrowUp',\n Home: 'Home',\n End: 'End',\n};\n\n/** @soyCompatible */\nexport class List extends LitElement {\n static override shadowRootOptions:\n ShadowRootInit = {mode: 'open', delegatesFocus: true};\n\n @ariaProperty // tslint:disable-line:no-new-decorators\n @property({type: String, attribute: 'data-aria-label', noAccessor: true})\n override ariaLabel!: string;\n\n @ariaProperty // tslint:disable-line:no-new-decorators\n @property(\n {type: String, attribute: 'data-aria-activedescendant', noAccessor: true})\n ariaActivedescendant!: string;\n\n @ariaProperty // tslint:disable-line:no-new-decorators\n // tslint:disable-next-line:decorator-placement\n @property({type: String, attribute: 'data-role', noAccessor: true})\n // @ts-ignore(b/264292293): Use `override` with TS 4.9+\n role: ARIARole = 'list';\n\n @property({type: String}) listId = '';\n\n @property({type: Number}) listTabIndex: number = 0;\n\n items: ListItem[] = [];\n activeListItem: ListItem|null = null;\n\n @query('.md3-list') listRoot!: HTMLElement;\n\n @property({type: String}) listItemTagName = 'md-list-item';\n\n @queryAssignedElements({flatten: true})\n protected assignedElements!: HTMLElement[]|null;\n\n override firstUpdated(changedProperties: PropertyValues) {\n super.firstUpdated(changedProperties);\n\n this.updateItems();\n }\n\n /** @soyTemplate */\n override render(): TemplateResult {\n return html`\n <ul class=\"md3-list ${classMap(this.getRenderClasses())}\"\n aria-label=\"${ifDefined(this.ariaLabel)}\"\n id=${ifDefined(this.listId || undefined)}\n tabindex=${this.listTabIndex}\n role=${this.role}\n @action=${this.handleAction}\n @keydown=${this.handleKeydown}\n >\n <span><slot></slot></span>\n <md-elevation surface></md-elevation>\n </ul>\n `;\n }\n\n /** @soyTemplate */\n protected getRenderClasses(): ClassInfo {\n return {};\n }\n\n handleKeydown(event: KeyboardEvent) {\n if (Object.values(NAVIGATABLE_KEYS).indexOf(event.key) === -1) return;\n\n for (const item of this.items) {\n if (this.isListItemActive(item)) {\n this.activeListItem = item;\n }\n\n this.deactivateListItem(item);\n }\n\n if (event.key === NAVIGATABLE_KEYS.ArrowDown) {\n event.preventDefault();\n if (this.activeListItem) {\n this.activeListItem = this.getNextItem(this.activeListItem);\n } else {\n this.activeListItem = this.getFirstItem();\n }\n }\n\n if (event.key === NAVIGATABLE_KEYS.ArrowUp) {\n event.preventDefault();\n if (this.activeListItem) {\n this.activeListItem = this.getPrevItem(this.activeListItem);\n } else {\n this.activeListItem = this.getLastItem();\n }\n }\n\n if (event.key === NAVIGATABLE_KEYS.Home) {\n event.preventDefault();\n this.activeListItem = this.getFirstItem();\n }\n\n if (event.key === NAVIGATABLE_KEYS.End) {\n event.preventDefault();\n this.activeListItem = this.getLastItem();\n }\n\n if (this.activeListItem) {\n this.activateListItem(this.activeListItem);\n }\n }\n\n protected activateListItem(item: ListItem) {\n item.activate();\n }\n\n protected deactivateListItem(item: ListItem) {\n item.deactivate();\n }\n\n protected isListItemActive(item: ListItem): boolean {\n return item.isActive();\n }\n\n protected handleAction(event: CustomEvent) {}\n\n activateFirstItem() {\n this.activeListItem = this.getFirstItem();\n this.activeListItem.activate();\n }\n\n activateLastItem() {\n this.activeListItem = this.getLastItem();\n this.activeListItem.activate();\n }\n\n resetActiveListItem() {\n this.activeListItem = null;\n }\n\n focusListRoot() {\n this.listRoot.focus();\n }\n\n /** Updates `this.items` based on slot elements in the DOM. */\n protected updateItems() {\n const elements = this.assignedElements || [];\n this.items = elements.filter(this.isListItem, this);\n }\n\n /** @return Whether the given element is a list item element. */\n private isListItem(element: Element): element is ListItem {\n return element.tagName.toLowerCase() === this.listItemTagName;\n }\n\n private getFirstItem(): ListItem {\n return this.items[0];\n }\n\n private getLastItem(): ListItem {\n return this.items[this.items.length - 1];\n }\n\n private getPrevItem(item: ListItem): ListItem {\n const curIndex = this.items.indexOf(item);\n return this.items[curIndex === 0 ? this.items.length - 1 : curIndex - 1];\n }\n\n private getNextItem(item: ListItem): ListItem {\n const curIndex = this.items.indexOf(item);\n return this.items[(curIndex + 1) % this.items.length];\n }\n}\n"]}
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,6BAA6B;AAC7B,mCAAmC;AAEnC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAY,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,SAAS,EAAC,MAAM,8BAA8B,CAAC;AAEvD,OAAO,EAAC,YAAY,EAAC,MAAM,mCAAmC,CAAC;AAK/D,MAAM,cAAc,GAAG;IACrB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;CACF,CAAC;AAIX,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;AAE/D,SAAS,cAAc,CAAC,GAAW;IACjC,OAAO,eAAe,CAAC,GAAG,CAAC,GAAwB,CAAC,CAAC;AACvD,CA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,SAAS,EAAE,4BAA4B,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC;;kDAChD;AAM9B;IAJC,YAAY;IACb,2BAA2B;;IAC1B,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC;;kCAE3C;AAKE;IAAzB,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;;0CAA0B;AAE/B;IAAnB,KAAK,CAAC,WAAW,CAAC;8BAAY,WAAW;sCAAC;AAW3C;IADC,qBAAqB,CAAC,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAC,CAAC;;mCAChD","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Required for @ariaProperty\n// tslint:disable:no-new-decorators\n\nimport {html, LitElement, TemplateResult} from 'lit';\nimport {property, query, queryAssignedElements} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {ifDefined} from 'lit/directives/if-defined.js';\n\nimport {ariaProperty} from '../../decorators/aria-property.js';\nimport {ARIARole} from '../../types/aria.js';\n\nimport {ListItem} from './listitem/list-item.js';\n\nconst NAVIGABLE_KEYS = {\n ArrowDown: 'ArrowDown',\n ArrowUp: 'ArrowUp',\n Home: 'Home',\n End: 'End',\n} as const;\n\ntype NavigatableValues = typeof NAVIGABLE_KEYS[keyof typeof NAVIGABLE_KEYS];\n\nconst navigableKeySet = new Set(Object.values(NAVIGABLE_KEYS));\n\nfunction isNavigableKey(key: string): key is NavigatableValues {\n return navigableKeySet.has(key as NavigatableValues);\n}\n\n// tslint:disable-next-line:enforce-comments-on-exported-symbols\nexport class List extends LitElement {\n static override shadowRootOptions:\n ShadowRootInit = {mode: 'open', delegatesFocus: true};\n\n @ariaProperty\n @property({type: String, attribute: 'data-aria-label', noAccessor: true})\n override ariaLabel!: string;\n\n @ariaProperty\n @property(\n {type: String, attribute: 'data-aria-activedescendant', noAccessor: true})\n ariaActivedescendant!: string;\n\n @ariaProperty\n // tslint:disable-next-line\n @property({type: String, attribute: 'data-role', noAccessor: true})\n // @ts-ignore(b/264292293): Use `override` with TS 4.9+\n role: ARIARole = 'list';\n\n /**\n * The tabindex of the underlying list.\n */\n @property({type: Number}) listTabIndex: number = 0;\n\n @query('.md3-list') listRoot!: HTMLElement;\n\n /**\n * An array of activatable and disableable list items. Queries every assigned\n * element that has the `md-list-item` attribute.\n *\n * _NOTE:_ This is a shallow, flattened query via\n * `HTMLSlotElement.queryAssignedElements` and thus will _only_ include direct\n * children / directly slotted elements.\n */\n @queryAssignedElements({flatten: true, selector: '[md-list-item]'})\n items!: ListItem[];\n\n override render(): TemplateResult {\n return this.renderList();\n }\n\n /**\n * Renders the main list element.\n */\n protected renderList() {\n return html`\n <ul class=\"md3-list ${classMap(this.getListClasses())}\"\n aria-label=\"${ifDefined(this.ariaLabel)}\"\n tabindex=${this.listTabIndex}\n role=${this.role}\n @keydown=${this.handleKeydown}\n >\n ${this.renderContent()}\n </ul>\n `;\n }\n\n /**\n * The classes to be applied to the underlying list.\n */\n protected getListClasses(): ClassInfo {\n return {};\n }\n\n /**\n * The content to be slotted into the list.\n */\n protected renderContent() {\n return html`<span><slot @click=${(e: Event) => {\n e.stopPropagation();\n }}></slot></span>`;\n }\n\n /**\n * Handles keyboard navigation in the list.\n *\n * @param event {KeyboardEvent} The keyboard event that triggers this handler.\n */\n handleKeydown(event: KeyboardEvent) {\n const key = event.key;\n if (!isNavigableKey(key)) {\n return;\n }\n // do not use this.items directly so we don't re-query the DOM unnecessarily\n const items = this.items;\n\n if (!items.length) {\n return;\n }\n\n const activeItemRecord = List.getActiveItem(items);\n\n if (activeItemRecord) {\n activeItemRecord.item.active = false;\n }\n\n event.preventDefault();\n\n switch (key) {\n // Activate the next item\n case NAVIGABLE_KEYS.ArrowDown:\n if (activeItemRecord) {\n const next = List.getNextItem(items, activeItemRecord.index);\n\n if (next) next.active = true;\n } else {\n List.activateFirstItem(items);\n }\n break;\n\n // Activate the previous item\n case NAVIGABLE_KEYS.ArrowUp:\n if (activeItemRecord) {\n const prev = List.getPrevItem(items, activeItemRecord.index);\n if (prev) prev.active = true;\n } else {\n items[items.length - 1].active = true;\n }\n break;\n\n // Activate the first item\n case NAVIGABLE_KEYS.Home:\n List.activateFirstItem(items);\n break;\n\n // Activate the last item\n case NAVIGABLE_KEYS.End:\n List.activateLastItem(items);\n break;\n\n default:\n break;\n }\n }\n\n /**\n * Activates the first non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items from which to activate the\n * first item.\n */\n static activateFirstItem<T extends ListItem>(items: T[]) {\n // NOTE: These selector functions are static and not on the instance such\n // that multiple operations can be chained and we do not have to re-query\n // the DOM\n const firstItem = List.getFirstActivatableItem(items);\n if (firstItem) {\n firstItem.active = true;\n }\n }\n\n /**\n * Activates the last non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items from which to activate the\n * last item.\n */\n static activateLastItem<T extends ListItem>(items: T[]) {\n const lastItem = List.getLastActivatableItem(items);\n if (lastItem) {\n lastItem.active = true;\n }\n }\n\n /**\n * Deactivates the currently active item of a given array of items.\n *\n * @param items {Array<ListItem>} The items from which to deactivate the\n * active item.\n * @returns A record of the deleselcted activated item including the item and\n * the index of the item or `null` if none are deactivated.\n */\n static deactivateActiveItem<T extends ListItem>(items: T[]) {\n const activeItem = List.getActiveItem(items);\n if (activeItem) {\n activeItem.item.active = false;\n }\n return activeItem;\n }\n\n override focus() {\n this.listRoot.focus();\n }\n\n /**\n * Retrieves the the first activated item of a given array of items.\n *\n * @param items {Array<ListItem>} The items to search.\n * @returns A record of the first activated item including the item and the\n * index of the item or `null` if none are activated.\n */\n static getActiveItem<T extends ListItem>(items: T[]) {\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n if (item.active) {\n return {\n item,\n index: i,\n };\n }\n }\n return null;\n }\n\n /**\n * Retrieves the the first non-disabled item of a given array of items. This\n * the first item that is not disabled.\n *\n * @param items {Array<ListItem>} The items to search.\n * @returns The first activatable item or `null` if none are activatable.\n */\n static getFirstActivatableItem<T extends ListItem>(items: T[]) {\n for (const item of items) {\n if (!item.disabled) {\n return item;\n }\n }\n\n return null;\n }\n\n /**\n * Retrieves the the last non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items to search.\n * @returns The last activatable item or `null` if none are activatable.\n */\n static getLastActivatableItem<T extends ListItem>(items: T[]) {\n for (let i = items.length - 1; i >= 0; i--) {\n const item = items[i];\n if (!item.disabled) {\n return item;\n }\n }\n\n return null;\n }\n\n /**\n * Retrieves the the next non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items to search.\n * @param index {{index: number}} The index to search from.\n * @returns The next activatable item or `null` if none are activatable.\n */\n protected static getNextItem<T extends ListItem>(items: T[], index: number) {\n for (let i = 1; i < items.length; i++) {\n const nextIndex = (i + index) % items.length;\n const item = items[nextIndex];\n if (!item.disabled) {\n return item;\n }\n }\n return null;\n }\n\n /**\n * Retrieves the the previous non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items to search.\n * @param index {{index: number}} The index to search from.\n * @returns The previous activatable item or `null` if none are activatable.\n */\n protected static getPrevItem<T extends ListItem>(items: T[], index: number) {\n for (let i = 1; i < items.length; i++) {\n const prevIndex = (index - i + items.length) % items.length;\n const item = items[prevIndex];\n\n if (!item.disabled) {\n return item;\n }\n }\n return null;\n }\n}\n"]}