@material/web 1.0.0-pre.5 → 1.0.0-pre.6

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 (472) hide show
  1. package/README.md +1 -1
  2. package/badge/lib/badge-styles.css.js +1 -1
  3. package/badge/lib/badge-styles.css.js.map +1 -1
  4. package/button/lib/_elevation.scss +7 -13
  5. package/button/lib/_outlined-button.scss +1 -1
  6. package/button/lib/_shared.scss +5 -0
  7. package/button/lib/_text-button.scss +1 -1
  8. package/button/lib/_tonal-button.scss +1 -1
  9. package/button/lib/button.d.ts +14 -1
  10. package/button/lib/button.js +36 -14
  11. package/button/lib/button.js.map +1 -1
  12. package/button/lib/elevated-button.d.ts +3 -0
  13. package/button/lib/elevated-button.js +4 -2
  14. package/button/lib/elevated-button.js.map +1 -1
  15. package/button/lib/elevated-styles.css.js +1 -1
  16. package/button/lib/elevated-styles.css.js.map +1 -1
  17. package/button/lib/filled-button.d.ts +3 -1
  18. package/button/lib/filled-button.js +4 -3
  19. package/button/lib/filled-button.js.map +1 -1
  20. package/button/lib/filled-styles.css.js +1 -1
  21. package/button/lib/filled-styles.css.js.map +1 -1
  22. package/button/lib/outlined-button.d.ts +3 -0
  23. package/button/lib/outlined-button.js +3 -1
  24. package/button/lib/outlined-button.js.map +1 -1
  25. package/button/lib/outlined-styles.css.js +1 -1
  26. package/button/lib/outlined-styles.css.js.map +1 -1
  27. package/button/lib/shared-elevation-styles.css.js +1 -1
  28. package/button/lib/shared-elevation-styles.css.js.map +1 -1
  29. package/button/lib/shared-styles.css.js +1 -1
  30. package/button/lib/shared-styles.css.js.map +1 -1
  31. package/button/lib/text-button.d.ts +3 -0
  32. package/button/lib/text-button.js +3 -1
  33. package/button/lib/text-button.js.map +1 -1
  34. package/button/lib/text-styles.css.js +1 -1
  35. package/button/lib/text-styles.css.js.map +1 -1
  36. package/button/lib/tonal-button.d.ts +3 -1
  37. package/button/lib/tonal-button.js +4 -3
  38. package/button/lib/tonal-button.js.map +1 -1
  39. package/button/lib/tonal-styles.css.js +1 -1
  40. package/button/lib/tonal-styles.css.js.map +1 -1
  41. package/checkbox/lib/checkbox-styles.css.js +1 -1
  42. package/checkbox/lib/checkbox-styles.css.js.map +1 -1
  43. package/chips/lib/_shared.scss +63 -33
  44. package/chips/lib/assist-styles.css.js +1 -1
  45. package/chips/lib/assist-styles.css.js.map +1 -1
  46. package/chips/lib/chip.js +1 -1
  47. package/chips/lib/chip.js.map +1 -1
  48. package/chips/lib/shared-styles.css.js +1 -1
  49. package/chips/lib/shared-styles.css.js.map +1 -1
  50. package/chips/lib/suggestion-styles.css.js +1 -1
  51. package/chips/lib/suggestion-styles.css.js.map +1 -1
  52. package/circularprogress/_circular-progress.scss +6 -0
  53. package/circularprogress/circular-progress.d.ts +24 -0
  54. package/circularprogress/circular-progress.js +27 -0
  55. package/circularprogress/circular-progress.js.map +1 -0
  56. package/circularprogress/harness.d.ts +12 -0
  57. package/circularprogress/harness.js +12 -0
  58. package/circularprogress/harness.js.map +1 -0
  59. package/circularprogress/lib/_circular-progress.scss +282 -0
  60. package/circularprogress/lib/circular-progress-styles.css.js +9 -0
  61. package/circularprogress/lib/circular-progress-styles.css.js.map +1 -0
  62. package/circularprogress/lib/circular-progress-styles.scss +8 -0
  63. package/circularprogress/lib/circular-progress.d.ts +29 -0
  64. package/circularprogress/lib/circular-progress.js +98 -0
  65. package/circularprogress/lib/circular-progress.js.map +1 -0
  66. package/dialog/lib/_dialog.scss +1 -6
  67. package/dialog/lib/dialog-styles.css.js +1 -1
  68. package/dialog/lib/dialog-styles.css.js.map +1 -1
  69. package/dialog/lib/dialog.js +1 -1
  70. package/dialog/lib/dialog.js.map +1 -1
  71. package/elevation/lib/_elevation.scss +13 -48
  72. package/elevation/lib/elevation-styles.css.js +1 -1
  73. package/elevation/lib/elevation-styles.css.js.map +1 -1
  74. package/elevation/lib/elevation.d.ts +0 -8
  75. package/elevation/lib/elevation.js +1 -25
  76. package/elevation/lib/elevation.js.map +1 -1
  77. package/fab/lib/_shared.scss +18 -21
  78. package/fab/lib/fab-extended-styles.css.js +1 -1
  79. package/fab/lib/fab-extended-styles.css.js.map +1 -1
  80. package/fab/lib/fab-shared-styles.css.js +1 -1
  81. package/fab/lib/fab-shared-styles.css.js.map +1 -1
  82. package/fab/lib/fab-shared.js +1 -1
  83. package/fab/lib/fab-shared.js.map +1 -1
  84. package/fab/lib/fab-styles.css.js +1 -1
  85. package/fab/lib/fab-styles.css.js.map +1 -1
  86. package/field/lib/filled-styles.css.js +1 -1
  87. package/field/lib/filled-styles.css.js.map +1 -1
  88. package/field/lib/outlined-styles.css.js +1 -1
  89. package/field/lib/outlined-styles.css.js.map +1 -1
  90. package/focus/lib/_focus-ring.scss +30 -20
  91. package/focus/lib/focus-ring-styles.css.js +1 -1
  92. package/focus/lib/focus-ring-styles.css.js.map +1 -1
  93. package/focus/strong-focus.d.ts +11 -0
  94. package/focus/strong-focus.js +11 -1
  95. package/focus/strong-focus.js.map +1 -1
  96. package/iconbutton/filled-icon-button.js +1 -0
  97. package/iconbutton/filled-icon-button.js.map +1 -1
  98. package/iconbutton/filled-tonal-icon-button.js +1 -0
  99. package/iconbutton/filled-tonal-icon-button.js.map +1 -1
  100. package/iconbutton/harness.d.ts +1 -2
  101. package/iconbutton/harness.js.map +1 -1
  102. package/iconbutton/lib/filled-styles.css.js +1 -1
  103. package/iconbutton/lib/filled-styles.css.js.map +1 -1
  104. package/iconbutton/lib/filled-tonal-styles.css.js +1 -1
  105. package/iconbutton/lib/filled-tonal-styles.css.js.map +1 -1
  106. package/iconbutton/lib/icon-button.d.ts +33 -2
  107. package/iconbutton/lib/icon-button.js +104 -16
  108. package/iconbutton/lib/icon-button.js.map +1 -1
  109. package/iconbutton/lib/outlined-styles.css.js +1 -1
  110. package/iconbutton/lib/outlined-styles.css.js.map +1 -1
  111. package/iconbutton/lib/standard-styles.css.js +1 -1
  112. package/iconbutton/lib/standard-styles.css.js.map +1 -1
  113. package/list/harness.d.ts +1 -0
  114. package/list/harness.js +1 -0
  115. package/list/harness.js.map +1 -1
  116. package/list/lib/_list.scss +0 -1
  117. package/list/lib/list-styles.css.js +1 -1
  118. package/list/lib/list-styles.css.js.map +1 -1
  119. package/list/lib/list.js +2 -0
  120. package/list/lib/list.js.map +1 -1
  121. package/list/lib/listitem/_list-item.scss +9 -13
  122. package/list/lib/listitem/forced-colors-styles.css.js +9 -0
  123. package/list/lib/listitem/forced-colors-styles.css.js.map +1 -0
  124. package/list/lib/listitem/forced-colors-styles.scss +23 -0
  125. package/list/lib/listitem/list-item-styles.css.js +1 -1
  126. package/list/lib/listitem/list-item-styles.css.js.map +1 -1
  127. package/list/lib/listitem/list-item.d.ts +3 -3
  128. package/list/lib/listitem/list-item.js +3 -3
  129. package/list/lib/listitem/list-item.js.map +1 -1
  130. package/list/list-item-link.js +2 -1
  131. package/list/list-item-link.js.map +1 -1
  132. package/list/list-item.js +2 -1
  133. package/list/list-item.js.map +1 -1
  134. package/menu/harness.d.ts +1 -0
  135. package/menu/harness.js +1 -0
  136. package/menu/harness.js.map +1 -1
  137. package/menu/lib/_menu.scss +5 -10
  138. package/menu/lib/forced-colors-styles.css.d.ts +1 -0
  139. package/menu/lib/forced-colors-styles.css.js +9 -0
  140. package/menu/lib/forced-colors-styles.css.js.map +1 -0
  141. package/menu/lib/forced-colors-styles.scss +12 -0
  142. package/menu/lib/menu-styles.css.js +1 -1
  143. package/menu/lib/menu-styles.css.js.map +1 -1
  144. package/menu/lib/menu.d.ts +12 -1
  145. package/menu/lib/menu.js +42 -4
  146. package/menu/lib/menu.js.map +1 -1
  147. package/menu/lib/menuitem/_menu-item.scss +5 -11
  148. package/menu/lib/menuitem/forced-colors-styles.css.d.ts +1 -0
  149. package/menu/lib/menuitem/forced-colors-styles.css.js +9 -0
  150. package/menu/lib/menuitem/forced-colors-styles.css.js.map +1 -0
  151. package/menu/lib/menuitem/forced-colors-styles.scss +22 -0
  152. package/menu/lib/menuitem/menu-item-styles.css.js +1 -1
  153. package/menu/lib/menuitem/menu-item-styles.css.js.map +1 -1
  154. package/menu/lib/shared.d.ts +10 -0
  155. package/menu/lib/shared.js +23 -0
  156. package/menu/lib/shared.js.map +1 -1
  157. package/menu/lib/submenuitem/sub-menu-item.d.ts +4 -0
  158. package/menu/lib/submenuitem/sub-menu-item.js +12 -0
  159. package/menu/lib/submenuitem/sub-menu-item.js.map +1 -1
  160. package/menu/lib/typeaheadController.d.ts +10 -2
  161. package/menu/lib/typeaheadController.js +20 -14
  162. package/menu/lib/typeaheadController.js.map +1 -1
  163. package/menu/menu-item-link.js +3 -1
  164. package/menu/menu-item-link.js.map +1 -1
  165. package/menu/menu-item.js +4 -2
  166. package/menu/menu-item.js.map +1 -1
  167. package/menu/menu.js +2 -1
  168. package/menu/menu.js.map +1 -1
  169. package/menu/sub-menu-item.js +3 -1
  170. package/menu/sub-menu-item.js.map +1 -1
  171. package/navigationbar/lib/_navigation-bar.scss +3 -6
  172. package/navigationbar/lib/navigation-bar-styles.css.js +1 -1
  173. package/navigationbar/lib/navigation-bar-styles.css.js.map +1 -1
  174. package/navigationbar/lib/navigation-bar.js +2 -2
  175. package/navigationbar/lib/navigation-bar.js.map +1 -1
  176. package/navigationdrawer/lib/_navigation-drawer-modal.scss +10 -11
  177. package/navigationdrawer/lib/_navigation-drawer.scss +9 -14
  178. package/navigationdrawer/lib/navigation-drawer-modal-styles.css.js +1 -1
  179. package/navigationdrawer/lib/navigation-drawer-modal-styles.css.js.map +1 -1
  180. package/navigationdrawer/lib/navigation-drawer-styles.css.js +1 -1
  181. package/navigationdrawer/lib/navigation-drawer-styles.css.js.map +1 -1
  182. package/navigationdrawer/lib/navigation-drawer.js +1 -1
  183. package/navigationdrawer/lib/navigation-drawer.js.map +1 -1
  184. package/navigationtab/lib/navigation-tab-styles.css.js +1 -1
  185. package/navigationtab/lib/navigation-tab-styles.css.js.map +1 -1
  186. package/package.json +2 -1
  187. package/radio/lib/radio-styles.css.js +1 -1
  188. package/radio/lib/radio-styles.css.js.map +1 -1
  189. package/ripple/lib/_md-comp-ripple.scss +3 -3
  190. package/ripple/lib/ripple-styles.css.js +1 -1
  191. package/ripple/lib/ripple-styles.css.js.map +1 -1
  192. package/segmentedbutton/lib/outlined-styles.css.js +1 -1
  193. package/segmentedbutton/lib/outlined-styles.css.js.map +1 -1
  194. package/segmentedbuttonset/lib/outlined-styles.css.js +1 -1
  195. package/segmentedbuttonset/lib/outlined-styles.css.js.map +1 -1
  196. package/slider/lib/_slider.scss +1 -7
  197. package/slider/lib/_tokens.scss +5 -0
  198. package/slider/lib/slider-styles.css.js +1 -1
  199. package/slider/lib/slider-styles.css.js.map +1 -1
  200. package/slider/lib/slider.js +1 -1
  201. package/slider/lib/slider.js.map +1 -1
  202. package/switch/lib/switch-styles.css.js +1 -1
  203. package/switch/lib/switch-styles.css.js.map +1 -1
  204. package/textfield/lib/filled-styles.css.js +1 -1
  205. package/textfield/lib/filled-styles.css.js.map +1 -1
  206. package/textfield/lib/outlined-styles.css.js +1 -1
  207. package/textfield/lib/outlined-styles.css.js.map +1 -1
  208. package/tokens/_index.scss +3 -0
  209. package/tokens/_md-comp-assist-chip.scss +69 -14
  210. package/tokens/_md-comp-badge.scss +8 -1
  211. package/tokens/_md-comp-banner.scss +1 -1
  212. package/tokens/_md-comp-bottom-app-bar.scss +1 -1
  213. package/tokens/_md-comp-carousel-item.scss +1 -1
  214. package/tokens/_md-comp-checkbox.scss +1 -1
  215. package/tokens/_md-comp-circular-progress-indicator.scss +17 -2
  216. package/tokens/_md-comp-data-table.scss +1 -1
  217. package/tokens/_md-comp-date-input-modal.scss +1 -1
  218. package/tokens/_md-comp-date-picker-docked.scss +1 -1
  219. package/tokens/_md-comp-date-picker-modal.scss +1 -1
  220. package/tokens/_md-comp-dialog.scss +10 -1
  221. package/tokens/_md-comp-divider.scss +1 -1
  222. package/tokens/_md-comp-elevated-button.scss +80 -20
  223. package/tokens/_md-comp-elevated-card.scss +1 -1
  224. package/tokens/_md-comp-elevation.scss +28 -0
  225. package/tokens/_md-comp-extended-fab-branded.scss +8 -1
  226. package/tokens/_md-comp-extended-fab-primary.scss +8 -1
  227. package/tokens/_md-comp-extended-fab-secondary.scss +8 -1
  228. package/tokens/_md-comp-extended-fab-surface.scss +8 -1
  229. package/tokens/_md-comp-extended-fab-tertiary.scss +8 -1
  230. package/tokens/_md-comp-fab-branded-large.scss +1 -1
  231. package/tokens/_md-comp-fab-branded.scss +1 -1
  232. package/tokens/_md-comp-fab-primary-large.scss +1 -1
  233. package/tokens/_md-comp-fab-primary-small.scss +1 -1
  234. package/tokens/_md-comp-fab-primary.scss +1 -1
  235. package/tokens/_md-comp-fab-secondary-large.scss +1 -1
  236. package/tokens/_md-comp-fab-secondary-small.scss +1 -1
  237. package/tokens/_md-comp-fab-secondary.scss +1 -1
  238. package/tokens/_md-comp-fab-surface-large.scss +1 -1
  239. package/tokens/_md-comp-fab-surface-small.scss +1 -1
  240. package/tokens/_md-comp-fab-surface.scss +1 -1
  241. package/tokens/_md-comp-fab-tertiary-large.scss +1 -1
  242. package/tokens/_md-comp-fab-tertiary-small.scss +1 -1
  243. package/tokens/_md-comp-fab-tertiary.scss +1 -1
  244. package/tokens/_md-comp-filled-autocomplete.scss +1 -1
  245. package/tokens/_md-comp-filled-button.scss +80 -20
  246. package/tokens/_md-comp-filled-card.scss +1 -1
  247. package/tokens/_md-comp-filled-icon-button.scss +1 -1
  248. package/tokens/_md-comp-filled-menu-button.scss +1 -1
  249. package/tokens/_md-comp-filled-select.scss +1 -1
  250. package/tokens/_md-comp-filled-text-field.scss +10 -1
  251. package/tokens/_md-comp-filled-tonal-button.scss +80 -20
  252. package/tokens/_md-comp-filled-tonal-icon-button.scss +1 -1
  253. package/tokens/_md-comp-filter-chip.scss +201 -11
  254. package/tokens/_md-comp-focus-ring.scss +46 -0
  255. package/tokens/_md-comp-full-screen-dialog.scss +1 -1
  256. package/tokens/_md-comp-icon-button.scss +1 -1
  257. package/tokens/_md-comp-input-chip.scss +194 -11
  258. package/tokens/_md-comp-linear-progress-indicator.scss +1 -1
  259. package/tokens/_md-comp-list.scss +18 -1
  260. package/tokens/_md-comp-menu.scss +1 -1
  261. package/tokens/_md-comp-navigation-bar.scss +1 -1
  262. package/tokens/_md-comp-navigation-drawer.scss +1 -1
  263. package/tokens/_md-comp-navigation-rail.scss +1 -1
  264. package/tokens/_md-comp-outlined-autocomplete.scss +1 -1
  265. package/tokens/_md-comp-outlined-button.scss +77 -19
  266. package/tokens/_md-comp-outlined-card.scss +1 -1
  267. package/tokens/_md-comp-outlined-icon-button.scss +1 -1
  268. package/tokens/_md-comp-outlined-menu-button.scss +1 -1
  269. package/tokens/_md-comp-outlined-segmented-button.scss +10 -1
  270. package/tokens/_md-comp-outlined-select.scss +1 -1
  271. package/tokens/_md-comp-outlined-text-field.scss +10 -1
  272. package/tokens/_md-comp-plain-tooltip.scss +1 -1
  273. package/tokens/_md-comp-primary-navigation-tab.scss +10 -1
  274. package/tokens/_md-comp-radio-button.scss +1 -1
  275. package/tokens/_md-comp-rich-tooltip.scss +1 -1
  276. package/tokens/_md-comp-scrim.scss +1 -1
  277. package/tokens/_md-comp-search-bar.scss +1 -1
  278. package/tokens/_md-comp-search-view.scss +1 -1
  279. package/tokens/_md-comp-secondary-navigation-tab.scss +9 -1
  280. package/tokens/_md-comp-sheet-bottom.scss +1 -1
  281. package/tokens/_md-comp-sheet-floating.scss +1 -1
  282. package/tokens/_md-comp-sheet-side.scss +1 -1
  283. package/tokens/_md-comp-slider.scss +10 -1
  284. package/tokens/_md-comp-snackbar.scss +1 -1
  285. package/tokens/_md-comp-standard-menu-button.scss +1 -1
  286. package/tokens/_md-comp-suggestion-chip.scss +65 -14
  287. package/tokens/_md-comp-switch.scss +1 -1
  288. package/tokens/_md-comp-test-table.scss +31 -0
  289. package/tokens/_md-comp-text-button.scss +70 -19
  290. package/tokens/_md-comp-time-input.scss +1 -1
  291. package/tokens/_md-comp-time-picker.scss +1 -1
  292. package/tokens/_md-comp-top-app-bar-large.scss +1 -1
  293. package/tokens/_md-comp-top-app-bar-medium.scss +1 -1
  294. package/tokens/_md-comp-top-app-bar-small-centered.scss +1 -1
  295. package/tokens/_md-comp-top-app-bar-small.scss +1 -1
  296. package/tokens/_md-ref-palette.scss +1 -1
  297. package/tokens/_md-ref-typeface.scss +24 -2
  298. package/tokens/_md-sys-color.scss +1 -1
  299. package/tokens/_md-sys-elevation.scss +1 -1
  300. package/tokens/_md-sys-motion.scss +1 -1
  301. package/tokens/_md-sys-shape.scss +1 -1
  302. package/tokens/_md-sys-state.scss +1 -1
  303. package/tokens/_md-sys-typescale.scss +36 -2
  304. package/tokens/_values.scss +111 -0
  305. package/tokens/{v0_161 → v0_172}/_md-comp-assist-chip.scss +3 -4
  306. package/tokens/{v0_161 → v0_172}/_md-comp-badge.scss +1 -1
  307. package/tokens/{v0_161 → v0_172}/_md-comp-banner.scss +2 -4
  308. package/tokens/{v0_161 → v0_172}/_md-comp-bottom-app-bar.scss +3 -5
  309. package/tokens/{v0_161 → v0_172}/_md-comp-carousel-item.scss +1 -3
  310. package/tokens/{v0_161 → v0_172}/_md-comp-checkbox.scss +1 -1
  311. package/tokens/{v0_161 → v0_172}/_md-comp-circular-progress-indicator.scss +1 -1
  312. package/tokens/{v0_161 → v0_172}/_md-comp-data-table.scss +2 -2
  313. package/tokens/{v0_161 → v0_172}/_md-comp-date-input-modal.scss +2 -4
  314. package/tokens/{v0_161 → v0_172}/_md-comp-date-picker-docked.scss +2 -4
  315. package/tokens/{v0_161 → v0_172}/_md-comp-date-picker-modal.scss +2 -4
  316. package/tokens/{v0_161 → v0_172}/_md-comp-dialog.scss +2 -4
  317. package/tokens/{v0_161 → v0_172}/_md-comp-divider.scss +1 -1
  318. package/tokens/{v0_161 → v0_172}/_md-comp-elevated-button.scss +2 -4
  319. package/tokens/{v0_161 → v0_172}/_md-comp-elevated-card.scss +2 -4
  320. package/tokens/{v0_161 → v0_172}/_md-comp-extended-fab-branded.scss +4 -4
  321. package/tokens/{v0_161 → v0_172}/_md-comp-extended-fab-primary.scss +1 -1
  322. package/tokens/{v0_161 → v0_172}/_md-comp-extended-fab-secondary.scss +1 -1
  323. package/tokens/{v0_161 → v0_172}/_md-comp-extended-fab-surface.scss +4 -4
  324. package/tokens/{v0_161 → v0_172}/_md-comp-extended-fab-tertiary.scss +1 -1
  325. package/tokens/{v0_161 → v0_172}/_md-comp-fab-branded-large.scss +4 -4
  326. package/tokens/{v0_161 → v0_172}/_md-comp-fab-branded.scss +4 -4
  327. package/tokens/{v0_161 → v0_172}/_md-comp-fab-primary-large.scss +1 -1
  328. package/tokens/{v0_161 → v0_172}/_md-comp-fab-primary-small.scss +1 -1
  329. package/tokens/{v0_161 → v0_172}/_md-comp-fab-primary.scss +1 -1
  330. package/tokens/{v0_161 → v0_172}/_md-comp-fab-secondary-large.scss +1 -1
  331. package/tokens/{v0_161 → v0_172}/_md-comp-fab-secondary-small.scss +1 -1
  332. package/tokens/{v0_161 → v0_172}/_md-comp-fab-secondary.scss +1 -1
  333. package/tokens/{v0_161 → v0_172}/_md-comp-fab-surface-large.scss +4 -4
  334. package/tokens/{v0_161 → v0_172}/_md-comp-fab-surface-small.scss +4 -4
  335. package/tokens/{v0_161 → v0_172}/_md-comp-fab-surface.scss +4 -4
  336. package/tokens/{v0_161 → v0_172}/_md-comp-fab-tertiary-large.scss +1 -1
  337. package/tokens/{v0_161 → v0_172}/_md-comp-fab-tertiary-small.scss +1 -1
  338. package/tokens/{v0_161 → v0_172}/_md-comp-fab-tertiary.scss +1 -1
  339. package/tokens/{v0_161 → v0_172}/_md-comp-filled-autocomplete.scss +4 -6
  340. package/tokens/{v0_161 → v0_172}/_md-comp-filled-button.scss +1 -1
  341. package/tokens/{v0_161 → v0_172}/_md-comp-filled-card.scss +3 -2
  342. package/tokens/{v0_161 → v0_172}/_md-comp-filled-icon-button.scss +2 -2
  343. package/tokens/{v0_161 → v0_172}/_md-comp-filled-menu-button.scss +1 -1
  344. package/tokens/{v0_161 → v0_172}/_md-comp-filled-select.scss +4 -6
  345. package/tokens/{v0_161 → v0_172}/_md-comp-filled-text-field.scss +3 -2
  346. package/tokens/{v0_161 → v0_172}/_md-comp-filled-tonal-button.scss +1 -1
  347. package/tokens/{v0_161 → v0_172}/_md-comp-filled-tonal-icon-button.scss +2 -2
  348. package/tokens/{v0_161 → v0_172}/_md-comp-filter-chip.scss +2 -4
  349. package/tokens/{v0_161 → v0_172}/_md-comp-full-screen-dialog.scss +3 -3
  350. package/tokens/{v0_161 → v0_172}/_md-comp-icon-button.scss +1 -1
  351. package/tokens/{v0_161 → v0_172}/_md-comp-input-chip.scss +1 -1
  352. package/tokens/{v0_161 → v0_172}/_md-comp-linear-progress-indicator.scss +2 -2
  353. package/tokens/{v0_161 → v0_172}/_md-comp-list.scss +1 -1
  354. package/tokens/{v0_161 → v0_172}/_md-comp-menu.scss +3 -5
  355. package/tokens/{v0_161 → v0_172}/_md-comp-navigation-bar.scss +2 -4
  356. package/tokens/{v0_161 → v0_172}/_md-comp-navigation-drawer.scss +4 -4
  357. package/tokens/{v0_161 → v0_172}/_md-comp-navigation-rail.scss +1 -16
  358. package/tokens/{v0_161 → v0_172}/_md-comp-outlined-autocomplete.scss +4 -6
  359. package/tokens/{v0_161 → v0_172}/_md-comp-outlined-button.scss +1 -1
  360. package/tokens/{v0_161 → v0_172}/_md-comp-outlined-card.scss +1 -3
  361. package/tokens/{v0_161 → v0_172}/_md-comp-outlined-icon-button.scss +1 -1
  362. package/tokens/{v0_161 → v0_172}/_md-comp-outlined-menu-button.scss +1 -1
  363. package/tokens/{v0_161 → v0_172}/_md-comp-outlined-segmented-button.scss +1 -1
  364. package/tokens/{v0_161 → v0_172}/_md-comp-outlined-select.scss +4 -6
  365. package/tokens/{v0_161 → v0_172}/_md-comp-outlined-text-field.scss +1 -1
  366. package/tokens/{v0_161 → v0_172}/_md-comp-plain-tooltip.scss +1 -1
  367. package/tokens/{v0_161 → v0_172}/_md-comp-primary-navigation-tab.scss +1 -1
  368. package/tokens/{v0_161 → v0_172}/_md-comp-radio-button.scss +1 -1
  369. package/tokens/{v0_161 → v0_172}/_md-comp-rich-tooltip.scss +3 -5
  370. package/tokens/{v0_161 → v0_172}/_md-comp-scrim.scss +1 -1
  371. package/tokens/{v0_161 → v0_172}/_md-comp-search-bar.scss +2 -4
  372. package/tokens/{v0_161 → v0_172}/_md-comp-search-view.scss +2 -4
  373. package/tokens/{v0_161 → v0_172}/_md-comp-secondary-navigation-tab.scss +3 -3
  374. package/tokens/{v0_161 → v0_172}/_md-comp-sheet-bottom.scss +3 -4
  375. package/tokens/{v0_161 → v0_172}/_md-comp-sheet-floating.scss +3 -5
  376. package/tokens/{v0_161 → v0_172}/_md-comp-sheet-side.scss +4 -4
  377. package/tokens/{v0_161 → v0_172}/_md-comp-slider.scss +3 -2
  378. package/tokens/{v0_161 → v0_172}/_md-comp-snackbar.scss +1 -1
  379. package/tokens/{v0_161 → v0_172}/_md-comp-standard-menu-button.scss +1 -1
  380. package/tokens/{v0_161 → v0_172}/_md-comp-suggestion-chip.scss +3 -4
  381. package/tokens/{v0_161 → v0_172}/_md-comp-switch.scss +13 -11
  382. package/tokens/{v0_161 → v0_172}/_md-comp-text-button.scss +1 -1
  383. package/tokens/{v0_161 → v0_172}/_md-comp-time-input.scss +3 -4
  384. package/tokens/{v0_161 → v0_172}/_md-comp-time-picker.scss +5 -5
  385. package/tokens/{v0_161 → v0_172}/_md-comp-top-app-bar-large.scss +1 -3
  386. package/tokens/{v0_161 → v0_172}/_md-comp-top-app-bar-medium.scss +1 -3
  387. package/tokens/{v0_161 → v0_172}/_md-comp-top-app-bar-small-centered.scss +3 -1
  388. package/tokens/{v0_161 → v0_172}/_md-comp-top-app-bar-small.scss +3 -3
  389. package/tokens/{v0_161 → v0_172}/_md-ref-palette.scss +23 -23
  390. package/tokens/{v0_161 → v0_172}/_md-ref-typeface.scss +1 -1
  391. package/tokens/{v0_161 → v0_172}/_md-sys-color.scss +9 -9
  392. package/tokens/{v0_161 → v0_172}/_md-sys-elevation.scss +1 -1
  393. package/tokens/{v0_161 → v0_172}/_md-sys-motion.scss +1 -1
  394. package/tokens/{v0_161 → v0_172}/_md-sys-shape.scss +1 -1
  395. package/tokens/{v0_161 → v0_172}/_md-sys-state.scss +1 -1
  396. package/tokens/{v0_161 → v0_172}/_md-sys-typescale.scss +1 -1
  397. package/tokens/v0_172/index.test.css.d.ts +1 -0
  398. package/tokens/v0_172/lib.test.css.d.ts +1 -0
  399. package/button/elevated-link-button.d.ts +0 -36
  400. package/button/elevated-link-button.js +0 -41
  401. package/button/elevated-link-button.js.map +0 -1
  402. package/button/filled-link-button.d.ts +0 -34
  403. package/button/filled-link-button.js +0 -39
  404. package/button/filled-link-button.js.map +0 -1
  405. package/button/lib/elevated-link-button.d.ts +0 -13
  406. package/button/lib/elevated-link-button.js +0 -21
  407. package/button/lib/elevated-link-button.js.map +0 -1
  408. package/button/lib/filled-link-button.d.ts +0 -14
  409. package/button/lib/filled-link-button.js +0 -22
  410. package/button/lib/filled-link-button.js.map +0 -1
  411. package/button/lib/link-button.d.ts +0 -24
  412. package/button/lib/link-button.js +0 -59
  413. package/button/lib/link-button.js.map +0 -1
  414. package/button/lib/outlined-link-button.d.ts +0 -12
  415. package/button/lib/outlined-link-button.js +0 -20
  416. package/button/lib/outlined-link-button.js.map +0 -1
  417. package/button/lib/text-link-button.d.ts +0 -10
  418. package/button/lib/text-link-button.js +0 -16
  419. package/button/lib/text-link-button.js.map +0 -1
  420. package/button/lib/tonal-link-button.d.ts +0 -14
  421. package/button/lib/tonal-link-button.js +0 -22
  422. package/button/lib/tonal-link-button.js.map +0 -1
  423. package/button/outlined-link-button.d.ts +0 -36
  424. package/button/outlined-link-button.js +0 -40
  425. package/button/outlined-link-button.js.map +0 -1
  426. package/button/text-link-button.d.ts +0 -34
  427. package/button/text-link-button.js +0 -38
  428. package/button/text-link-button.js.map +0 -1
  429. package/button/tonal-link-button.d.ts +0 -35
  430. package/button/tonal-link-button.js +0 -40
  431. package/button/tonal-link-button.js.map +0 -1
  432. package/elevation/lib/_md-comp-elevation.scss +0 -27
  433. package/focus/lib/_md-comp-focus-ring.scss +0 -30
  434. package/iconbutton/filled-icon-button-toggle.d.ts +0 -31
  435. package/iconbutton/filled-icon-button-toggle.js +0 -40
  436. package/iconbutton/filled-icon-button-toggle.js.map +0 -1
  437. package/iconbutton/filled-link-icon-button.d.ts +0 -31
  438. package/iconbutton/filled-link-icon-button.js +0 -39
  439. package/iconbutton/filled-link-icon-button.js.map +0 -1
  440. package/iconbutton/filled-tonal-icon-button-toggle.d.ts +0 -31
  441. package/iconbutton/filled-tonal-icon-button-toggle.js +0 -40
  442. package/iconbutton/filled-tonal-icon-button-toggle.js.map +0 -1
  443. package/iconbutton/filled-tonal-link-icon-button.d.ts +0 -31
  444. package/iconbutton/filled-tonal-link-icon-button.js +0 -39
  445. package/iconbutton/filled-tonal-link-icon-button.js.map +0 -1
  446. package/iconbutton/lib/icon-button-toggle.d.ts +0 -34
  447. package/iconbutton/lib/icon-button-toggle.js +0 -87
  448. package/iconbutton/lib/icon-button-toggle.js.map +0 -1
  449. package/iconbutton/lib/link-icon-button.d.ts +0 -23
  450. package/iconbutton/lib/link-icon-button.js +0 -58
  451. package/iconbutton/lib/link-icon-button.js.map +0 -1
  452. package/iconbutton/outlined-icon-button-toggle.d.ts +0 -31
  453. package/iconbutton/outlined-icon-button-toggle.js +0 -39
  454. package/iconbutton/outlined-icon-button-toggle.js.map +0 -1
  455. package/iconbutton/outlined-link-icon-button.d.ts +0 -31
  456. package/iconbutton/outlined-link-icon-button.js +0 -39
  457. package/iconbutton/outlined-link-icon-button.js.map +0 -1
  458. package/iconbutton/standard-icon-button-toggle.d.ts +0 -31
  459. package/iconbutton/standard-icon-button-toggle.js +0 -39
  460. package/iconbutton/standard-icon-button-toggle.js.map +0 -1
  461. package/iconbutton/standard-link-icon-button.d.ts +0 -31
  462. package/iconbutton/standard-link-icon-button.js +0 -39
  463. package/iconbutton/standard-link-icon-button.js.map +0 -1
  464. /package/{tokens/v0_161/index.test.css.d.ts → circularprogress/lib/circular-progress-styles.css.d.ts} +0 -0
  465. /package/{tokens/v0_161/lib.test.css.d.ts → list/lib/listitem/forced-colors-styles.css.d.ts} +0 -0
  466. /package/tokens/{v0_161 → v0_172}/_index.scss +0 -0
  467. /package/tokens/{v0_161 → v0_172}/index.test.css.js +0 -0
  468. /package/tokens/{v0_161 → v0_172}/index.test.css.js.map +0 -0
  469. /package/tokens/{v0_161 → v0_172}/index.test.scss +0 -0
  470. /package/tokens/{v0_161 → v0_172}/lib.test.css.js +0 -0
  471. /package/tokens/{v0_161 → v0_172}/lib.test.css.js.map +0 -0
  472. /package/tokens/{v0_161 → v0_172}/lib.test.scss +0 -0
@@ -39,21 +39,20 @@ $_custom-property-prefix: 'menu';
39
39
 
40
40
  @include md-list.theme(
41
41
  (
42
- list-item-container-color: var(--_container-color),
42
+ 'list-item-container-color': var(--_container-color),
43
43
  )
44
44
  );
45
45
 
46
46
  @include elevation.theme(
47
47
  (
48
- level: var(--_container-elevation),
49
- shadow-color: var(--_container-shadow-color),
50
- surface-tint: var(--_container-surface-tint-layer-color),
48
+ 'level': var(--_container-elevation),
49
+ 'shadow-color': var(--_container-shadow-color),
51
50
  )
52
51
  );
53
52
 
54
53
  @include focus-ring.theme(
55
54
  (
56
- shape: var(--_container-shape),
55
+ 'shape': var(--_container-shape),
57
56
  )
58
57
  );
59
58
 
@@ -81,6 +80,7 @@ $_custom-property-prefix: 'menu';
81
80
  display: block;
82
81
  overflow: auto;
83
82
  min-width: inherit;
83
+ border-radius: inherit;
84
84
  }
85
85
 
86
86
  &.has-overflow md-list {
@@ -102,11 +102,6 @@ $_custom-property-prefix: 'menu';
102
102
  max-height: inherit;
103
103
  }
104
104
  }
105
-
106
- md-elevation {
107
- position: absolute;
108
- inset: 0;
109
- }
110
105
  }
111
106
 
112
107
  @function _resolve-tokens($tokens) {
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { css } from 'lit';
7
+ export const styles = css `@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}/*# sourceMappingURL=forced-colors-styles.css.map */
8
+ `;
9
+ //# sourceMappingURL=forced-colors-styles.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forced-colors-styles.css.js","sourceRoot":"","sources":["forced-colors-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}/*# sourceMappingURL=forced-colors-styles.css.map */\n`;\n "]}
@@ -0,0 +1,12 @@
1
+ //
2
+ // Copyright 2023 Google LLC
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ //
5
+
6
+ @media (forced-colors: active) {
7
+ .menu {
8
+ border-style: solid;
9
+ border-color: CanvasText;
10
+ border-width: 1px;
11
+ }
12
+ }
@@ -4,6 +4,6 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { css } from 'lit';
7
- export const styles = css `:host{--_container-color: var(--md-menu-container-color, var(--md-sys-color-surface, #fffbfe));--_container-elevation: var(--md-menu-container-elevation, 2);--_container-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));--_container-shape: var(--md-menu-container-shape, 4px);--_container-surface-tint-layer-color: var(--md-menu-container-surface-tint-layer-color, var(--md-sys-color-primary, #6750a4));--md-list-container-color:var(--_container-color);--md-elevation-level:var(--_container-elevation);--md-elevation-shadow-color:var(--_container-shadow-color);--md-elevation-surface-tint:var(--_container-surface-tint-layer-color);--md-focus-ring-shape-start-start:var(--md-focus-ring-shape, var(--_container-shape));--md-focus-ring-shape-start-end:var(--md-focus-ring-shape, var(--_container-shape));--md-focus-ring-shape-end-end:var(--md-focus-ring-shape, var(--_container-shape));--md-focus-ring-shape-end-start:var(--md-focus-ring-shape, var(--_container-shape));min-width:300px}.menu{border-radius:var(--_container-shape);display:none;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit}.menu.fixed{position:fixed}.menu md-list{height:inherit;max-height:inherit;display:block;overflow:auto;min-width:inherit}.menu.has-overflow md-list{overflow:visible}.menu.animating md-list{pointer-events:none;overflow:hidden}.menu.animating ::slotted(.hidden){opacity:0}.menu slot{display:block;height:inherit;max-height:inherit}md-elevation{position:absolute;inset:0}/*# sourceMappingURL=menu-styles.css.map */
7
+ export const styles = css `:host{--_container-color: var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));--_container-elevation: var(--md-menu-container-elevation, 2);--_container-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));--_container-shape: var(--md-menu-container-shape, 4px);--md-list-container-color:var(--_container-color);--md-elevation-level:var(--_container-elevation);--md-elevation-shadow-color:var(--_container-shadow-color);--md-focus-ring-shape-start-start:var(--md-focus-ring-shape, var(--_container-shape));--md-focus-ring-shape-start-end:var(--md-focus-ring-shape, var(--_container-shape));--md-focus-ring-shape-end-end:var(--md-focus-ring-shape, var(--_container-shape));--md-focus-ring-shape-end-start:var(--md-focus-ring-shape, var(--_container-shape));min-width:300px}.menu{border-radius:var(--_container-shape);display:none;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit}.menu.fixed{position:fixed}.menu md-list{height:inherit;max-height:inherit;display:block;overflow:auto;min-width:inherit;border-radius:inherit}.menu.has-overflow md-list{overflow:visible}.menu.animating md-list{pointer-events:none;overflow:hidden}.menu.animating ::slotted(.hidden){opacity:0}.menu slot{display:block;height:inherit;max-height:inherit}/*# sourceMappingURL=menu-styles.css.map */
8
8
  `;
9
9
  //# sourceMappingURL=menu-styles.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"menu-styles.css.js","sourceRoot":"","sources":["menu-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--_container-color: var(--md-menu-container-color, var(--md-sys-color-surface, #fffbfe));--_container-elevation: var(--md-menu-container-elevation, 2);--_container-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));--_container-shape: var(--md-menu-container-shape, 4px);--_container-surface-tint-layer-color: var(--md-menu-container-surface-tint-layer-color, var(--md-sys-color-primary, #6750a4));--md-list-container-color:var(--_container-color);--md-elevation-level:var(--_container-elevation);--md-elevation-shadow-color:var(--_container-shadow-color);--md-elevation-surface-tint:var(--_container-surface-tint-layer-color);--md-focus-ring-shape-start-start:var(--md-focus-ring-shape, var(--_container-shape));--md-focus-ring-shape-start-end:var(--md-focus-ring-shape, var(--_container-shape));--md-focus-ring-shape-end-end:var(--md-focus-ring-shape, var(--_container-shape));--md-focus-ring-shape-end-start:var(--md-focus-ring-shape, var(--_container-shape));min-width:300px}.menu{border-radius:var(--_container-shape);display:none;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit}.menu.fixed{position:fixed}.menu md-list{height:inherit;max-height:inherit;display:block;overflow:auto;min-width:inherit}.menu.has-overflow md-list{overflow:visible}.menu.animating md-list{pointer-events:none;overflow:hidden}.menu.animating ::slotted(.hidden){opacity:0}.menu slot{display:block;height:inherit;max-height:inherit}md-elevation{position:absolute;inset:0}/*# sourceMappingURL=menu-styles.css.map */\n`;\n "]}
1
+ {"version":3,"file":"menu-styles.css.js","sourceRoot":"","sources":["menu-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--_container-color: var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));--_container-elevation: var(--md-menu-container-elevation, 2);--_container-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));--_container-shape: var(--md-menu-container-shape, 4px);--md-list-container-color:var(--_container-color);--md-elevation-level:var(--_container-elevation);--md-elevation-shadow-color:var(--_container-shadow-color);--md-focus-ring-shape-start-start:var(--md-focus-ring-shape, var(--_container-shape));--md-focus-ring-shape-start-end:var(--md-focus-ring-shape, var(--_container-shape));--md-focus-ring-shape-end-end:var(--md-focus-ring-shape, var(--_container-shape));--md-focus-ring-shape-end-start:var(--md-focus-ring-shape, var(--_container-shape));min-width:300px}.menu{border-radius:var(--_container-shape);display:none;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit}.menu.fixed{position:fixed}.menu md-list{height:inherit;max-height:inherit;display:block;overflow:auto;min-width:inherit;border-radius:inherit}.menu.has-overflow md-list{overflow:visible}.menu.animating md-list{pointer-events:none;overflow:hidden}.menu.animating ::slotted(.hidden){opacity:0}.menu slot{display:block;height:inherit;max-height:inherit}/*# sourceMappingURL=menu-styles.css.map */\n`;\n "]}
@@ -105,9 +105,19 @@ export declare abstract class Menu extends LitElement {
105
105
  */
106
106
  menuCorner: Corner;
107
107
  /**
108
- * Keeps the user clicks outside the menu
108
+ * Keeps the user clicks outside the menu.
109
+ *
110
+ * NOTE: clicking outside may still cause focusout to close the menu so see
111
+ * `stayOpenOnFocusout`.
109
112
  */
110
113
  stayOpenOnOutsideClick: boolean;
114
+ /**
115
+ * Keeps the menu open when focus leaves the menu's composed subtree.
116
+ *
117
+ * NOTE: Focusout behavior will stop propagation of the focusout event. Set
118
+ * this property to true to opt-out of menu's focuout handling altogether.
119
+ */
120
+ stayOpenOnFocusout: boolean;
111
121
  /**
112
122
  * After closing, does not restore focus to the last focused element before
113
123
  * the menu was opened.
@@ -167,6 +177,7 @@ export declare abstract class Menu extends LitElement {
167
177
  fixed: boolean;
168
178
  'has-overflow': boolean;
169
179
  };
180
+ protected handleFocusout(e: FocusEvent): Promise<void>;
170
181
  protected handleListFocus(): void;
171
182
  protected handleListClick(): void;
172
183
  protected handleListKeydown(e: KeyboardEvent): void;
package/menu/lib/menu.js CHANGED
@@ -18,6 +18,7 @@ import { MdFocusRing } from '../../focus/focus-ring.js';
18
18
  import { pointerPress, shouldShowStrongFocus } from '../../focus/strong-focus.js';
19
19
  import { List } from '../../list/lib/list.js';
20
20
  import { createAnimationSignal, EASING } from '../../motion/animation.js';
21
+ import { isElementInSubtree } from './shared.js';
21
22
  import { SurfacePositionController } from './surfacePositionController.js';
22
23
  import { TypeaheadController } from './typeaheadController.js';
23
24
  /**
@@ -121,9 +122,19 @@ export class Menu extends LitElement {
121
122
  */
122
123
  this.menuCorner = 'START_START';
123
124
  /**
124
- * Keeps the user clicks outside the menu
125
+ * Keeps the user clicks outside the menu.
126
+ *
127
+ * NOTE: clicking outside may still cause focusout to close the menu so see
128
+ * `stayOpenOnFocusout`.
125
129
  */
126
130
  this.stayOpenOnOutsideClick = false;
131
+ /**
132
+ * Keeps the menu open when focus leaves the menu's composed subtree.
133
+ *
134
+ * NOTE: Focusout behavior will stop propagation of the focusout event. Set
135
+ * this property to true to opt-out of menu's focuout handling altogether.
136
+ */
137
+ this.stayOpenOnFocusout = false;
127
138
  /**
128
139
  * After closing, does not restore focus to the last focused element before
129
140
  * the menu was opened.
@@ -266,8 +277,9 @@ export class Menu extends LitElement {
266
277
  // tints content
267
278
  return html `
268
279
  <div
269
- class="menu ${classMap(this.getSurfaceClasses())}"
270
- style=${styleMap(this.menuPositionController.surfaceStyles)}>
280
+ class="menu ${classMap(this.getSurfaceClasses())}"
281
+ style=${styleMap(this.menuPositionController.surfaceStyles)}
282
+ @focusout=${this.handleFocusout}>
271
283
  ${this.renderList()}
272
284
  ${this.renderElevation()}
273
285
  ${this.renderFocusRing()}
@@ -304,7 +316,7 @@ export class Menu extends LitElement {
304
316
  * Renders the elevation component.
305
317
  */
306
318
  renderElevation() {
307
- return html `<md-elevation shadow surface></md-elevation>`;
319
+ return html `<md-elevation></md-elevation>`;
308
320
  }
309
321
  /**
310
322
  * Renders the focus ring component.
@@ -319,6 +331,28 @@ export class Menu extends LitElement {
319
331
  'has-overflow': this.hasOverflow,
320
332
  };
321
333
  }
334
+ async handleFocusout(e) {
335
+ if (this.stayOpenOnFocusout) {
336
+ return;
337
+ }
338
+ // Stop propagation to prevent nested menus from interfering with each other
339
+ e.stopPropagation();
340
+ if (e.relatedTarget) {
341
+ // Don't close the menu if we are switching focus between menu,
342
+ // md-menu-item, and md-list
343
+ if (isElementInSubtree(e.relatedTarget, this)) {
344
+ return;
345
+ }
346
+ }
347
+ const oldRestoreFocus = this.skipRestoreFocus;
348
+ // allow focus to continue to the next focused object rather than returning
349
+ this.skipRestoreFocus = true;
350
+ this.close();
351
+ // await for close
352
+ await this.updateComplete;
353
+ // return to previous behavior
354
+ this.skipRestoreFocus = oldRestoreFocus;
355
+ }
322
356
  handleListFocus() {
323
357
  this.focusRing.visible = shouldShowStrongFocus();
324
358
  }
@@ -622,6 +656,10 @@ __decorate([
622
656
  property({ type: Boolean, attribute: 'stay-open-on-outside-click' }),
623
657
  __metadata("design:type", Object)
624
658
  ], Menu.prototype, "stayOpenOnOutsideClick", void 0);
659
+ __decorate([
660
+ property({ type: Boolean, attribute: 'stay-open-on-focusout' }),
661
+ __metadata("design:type", Object)
662
+ ], Menu.prototype, "stayOpenOnFocusout", void 0);
625
663
  __decorate([
626
664
  property({ type: Boolean, attribute: 'skip-restore-focus' }),
627
665
  __metadata("design:type", Object)
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,6BAA6B;AAC7B,mCAAmC;AACnC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,2BAA2B,CAAC;AACnC,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAC,YAAY,EAAC,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAC,YAAY,EAAE,qBAAqB,EAAC,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAC,qBAAqB,EAAE,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAIxE,OAAO,EAAS,yBAAyB,EAAwB,MAAM,gCAAgC,CAAC;AACxG,OAAO,EAAC,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAI7D;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAOjD;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,YAAiC,QAAQ;IAElE,MAAM,QAAQ,GAAG,SAAS,CAAC,aAAmC,CAAC;IAE/D,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,IAAI,CAAC;KACb;IAED,IAAI,QAAQ,CAAC,UAAU,EAAE;QACvB,OAAO,iBAAiB,CAAC,QAAQ,CA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EAAE;;6CAAkC;AAkJ1C;IAAC,YAAY,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;;qCACC,aAAa;;6CAE3C","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Required for @ariaProperty\n// tslint:disable:no-new-decorators\nimport '../../list/list.js';\nimport '../../focus/focus-ring.js';\nimport '../../elevation/elevation.js';\n\nimport {html, isServer, LitElement} from 'lit';\nimport {eventOptions, property, query, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {styleMap} from 'lit/directives/style-map.js';\n\nimport {ariaProperty} from '../../decorators/aria-property.js';\nimport {MdFocusRing} from '../../focus/focus-ring.js';\nimport {pointerPress, shouldShowStrongFocus} from '../../focus/strong-focus.js';\nimport {List} from '../../list/lib/list.js';\nimport {createAnimationSignal, EASING} from '../../motion/animation.js';\nimport {ARIARole} from '../../types/aria.js';\n\nimport {ActivateTypeaheadEvent, DeactivateTypeaheadEvent, MenuItem} from './shared.js';\nimport {Corner, SurfacePositionController, SurfacePositionTarget} from './surfacePositionController.js';\nimport {TypeaheadController} from './typeaheadController.js';\n\nexport {Corner} from './surfacePositionController.js';\n\n/**\n * The default value for the typeahead buffer time in Milliseconds.\n */\nexport const DEFAULT_TYPEAHEAD_BUFFER_TIME = 200;\n\n/**\n * Element to focus on when menu is first opened.\n */\nexport type DefaultFocusState = 'NONE'|'LIST_ROOT'|'FIRST_ITEM'|'LAST_ITEM';\n\n/**\n * Gets the currently focused element on the page.\n *\n * @param activeDoc The document or shadowroot from which to start the search.\n * Defaults to `window.document`\n * @return Returns the currently deeply focused element or `null` if none.\n */\nfunction getFocusedElement(activeDoc: Document|ShadowRoot = document):\n HTMLElement|null {\n const activeEl = activeDoc.activeElement as HTMLElement | null;\n\n if (!activeEl) {\n return null;\n }\n\n if (activeEl.shadowRoot) {\n return getFocusedElement(activeEl.shadowRoot) ?? activeEl;\n }\n\n return activeEl;\n}\n\n/**\n * @fires opening Fired before the opening animation begins\n * @fires opened Fired once the menu is open, after any animations\n * @fires closing Fired before the closing animation begins\n * @fires closed Fired once the menu is closed, after any animations\n */\nexport abstract class Menu extends LitElement {\n @query('md-list') protected readonly listElement!: List|null;\n @query('.menu') protected readonly surfaceEl!: HTMLElement|null;\n @query('slot') protected readonly slotEl!: HTMLSlotElement|null;\n @query('md-focus-ring') protected readonly focusRing!: MdFocusRing;\n\n @ariaProperty\n @property({type: String, attribute: 'data-aria-label', noAccessor: true})\n override ariaLabel!: string;\n\n /**\n * The element in which the menu should align to.\n */\n @property({attribute: false})\n anchor: HTMLElement&Partial<SurfacePositionTarget>|null = null;\n /**\n * Makes the element use `position:fixed` instead of `position:absolute`. In\n * most cases, the menu should position itself above most other\n * `position:absolute` or `position:fixed` elements when placed inside of\n * them. e.g. using a menu inside of an `md-dialog`.\n *\n * __NOTE__: Fixed menus will not scroll with the page and will be fixed to\n * the window instead.\n */\n @property({type: Boolean}) fixed = false;\n /**\n * Skips the opening and closing animations.\n */\n @property({type: Boolean}) quick = false;\n /**\n * Displays overflow content like a submenu.\n *\n * __NOTE__: This may cause adverse effects if you set\n * `md-menu {max-height:...}`\n * and have items overflowing items in the \"y\" direction.\n */\n @property({type: Boolean, attribute: 'has-overflow'}) hasOverflow = false;\n /**\n * Opens the menu and makes it visible. Alternative to the `.show()` and\n * `.close()` methods\n */\n @property({type: Boolean, reflect: true}) open = false;\n /**\n * Offsets the menu's inline alignment from the anchor by the given number in\n * pixels. This value is direction aware and will follow the LTR / RTL\n * direction.\n *\n * e.g. LTR: positive -> right, negative -> left\n * RTL: positive -> left, negative -> right\n */\n @property({type: Number, attribute: 'x-offset'}) xOffset = 0;\n /**\n * Offsets the menu's block alignment from the anchor by the given number in\n * pixels.\n *\n * e.g. positive -> down, negative -> up\n */\n @property({type: Number, attribute: 'y-offset'}) yOffset = 0;\n /**\n * The tabindex of the underlying list element.\n */\n @property({type: Number, attribute: 'list-tab-index'}) listTabIndex = 0;\n /**\n * The role of the underlying list element.\n */\n @ariaProperty\n @property({type: String, attribute: 'data-role', noAccessor: true})\n override role: ARIARole = 'list';\n /**\n * The max time between the keystrokes of the typeahead menu behavior before\n * it clears the typeahead buffer.\n */\n @property({type: Number, attribute: 'typeahead-delay'})\n typeaheadBufferTime = DEFAULT_TYPEAHEAD_BUFFER_TIME;\n /**\n * The corner of the anchor which to align the menu in the standard logical\n * property style of <block>_<inline>.\n */\n @property({type: String, attribute: 'anchor-corner'})\n anchorCorner: Corner = 'END_START';\n /**\n * The corner of the menu which to align the anchor in the standard logical\n * property style of <block>_<inline>.\n */\n @property({type: String, attribute: 'menu-corner'})\n menuCorner: Corner = 'START_START';\n /**\n * Keeps the user clicks outside the menu\n */\n @property({type: Boolean, attribute: 'stay-open-on-outside-click'})\n stayOpenOnOutsideClick = false;\n /**\n * After closing, does not restore focus to the last focused element before\n * the menu was opened.\n */\n @property({type: Boolean, attribute: 'skip-restore-focus'})\n skipRestoreFocus = false;\n /**\n * The element that should be focused by default once opened.\n */\n @property({type: String, attribute: 'default-focus'})\n defaultFocus: DefaultFocusState = 'LIST_ROOT';\n\n @state() protected typeaheadActive = true;\n\n protected openCloseAnimationSignal = createAnimationSignal();\n\n /**\n * Whether the menu is animating upwards or downwards when opening. This is\n * helpful for calculating some animation calculations.\n */\n protected get openDirection(): 'UP'|'DOWN' {\n const menuCornerBlock = this.menuCorner.split('_')[0];\n return menuCornerBlock === 'START' ? 'DOWN' : 'UP';\n }\n\n /**\n * The element that was focused before the menu opened.\n */\n protected lastFocusedElement: HTMLElement|null = null;\n\n /**\n * Handles typeahead navigation through the menu.\n */\n typeaheadController = new TypeaheadController(() => {\n return {\n getItems: () => this.items,\n typeaheadBufferTime: this.typeaheadBufferTime,\n active: this.typeaheadActive\n };\n });\n\n /**\n * Handles positioning the surface and aligning it to the anchor.\n */\n protected menuPositionController = new SurfacePositionController(this, () => {\n return {\n anchorCorner: this.anchorCorner,\n surfaceCorner: this.menuCorner,\n surfaceEl: this.surfaceEl,\n anchorEl: this.anchor,\n isTopLayer: this.fixed,\n isOpen: this.open,\n xOffset: this.xOffset,\n yOffset: this.yOffset,\n onOpen: this.onOpened,\n beforeClose: this.beforeClose,\n onClose: this.onClosed,\n };\n });\n\n /**\n * The menu items associated with this menu. The items must be `MenuItem`s and\n * have both the `md-menu-item` and `md-list-item` attributes.\n */\n get items(): MenuItem[] {\n const listElement = this.listElement;\n\n if (listElement) {\n return listElement.items.filter(el => el.hasAttribute('md-menu-item')) as\n MenuItem[];\n }\n\n return [];\n }\n\n override render() {\n return this.renderSurface();\n }\n\n /**\n * Renders the positionable surface element and its contents.\n */\n protected renderSurface() {\n // TODO(b/274140618): elevation should be an underlay, not an overlay that\n // tints content\n return html`\n <div\n class=\"menu ${classMap(this.getSurfaceClasses())}\"\n style=${styleMap(this.menuPositionController.surfaceStyles)}>\n ${this.renderList()}\n ${this.renderElevation()}\n ${this.renderFocusRing()}\n </div>\n `;\n }\n\n /**\n * Renders the List element and its items\n */\n protected renderList() {\n return html`\n <md-list\n .ariaLabel=${this.ariaLabel}\n .role=${this.role}\n listTabIndex=${this.listTabIndex}\n @focus=${this.handleListFocus}\n @blur=${this.handleListBlur}\n @click=${this.handleListClick}\n @keydown=${this.handleListKeydown}>\n ${this.renderMenuItems()}\n </md-list>`;\n }\n\n /**\n * Renders the menu items' slot\n */\n protected renderMenuItems() {\n return html`<slot\n @close-menu=${this.onCloseMenu}\n @deactivate-items=${this.onDeactivateItems}\n @deactivate-typeahead=${this.handleDeactivateTypeahead}\n @activate-typeahead=${this.handleActivateTypeahead}></slot>`;\n }\n\n /**\n * Renders the elevation component.\n */\n protected renderElevation() {\n return html`<md-elevation shadow surface></md-elevation>`;\n }\n\n /**\n * Renders the focus ring component.\n */\n protected renderFocusRing() {\n return html`<md-focus-ring></md-focus-ring>`;\n }\n\n protected getSurfaceClasses() {\n return {\n open: this.open,\n fixed: this.fixed,\n 'has-overflow': this.hasOverflow,\n };\n }\n\n protected handleListFocus() {\n this.focusRing.visible = shouldShowStrongFocus();\n }\n\n protected handleListClick() {\n pointerPress();\n this.focusRing.visible = shouldShowStrongFocus();\n }\n\n // Capture so that we can grab the event before it reaches the list item\n // istelf. Specifically useful for the case where typeahead encounters a space\n // and we don't want the menu item to close the menu.\n @eventOptions({capture: true})\n protected handleListKeydown(e: KeyboardEvent) {\n this.typeaheadController.onKeydown(e);\n }\n\n protected handleListBlur() {\n this.focusRing.visible = false;\n }\n\n /**\n * Saves the last focused element focuses the new element based on\n * `defaultFocus`, and animates open.\n */\n protected onOpened = () => {\n this.lastFocusedElement = getFocusedElement();\n\n if (!this.listElement) return;\n\n const items = this.listElement.items;\n const activeItemRecord = List.getActiveItem(items);\n\n if (activeItemRecord && this.defaultFocus !== 'NONE') {\n activeItemRecord.item.active = false;\n }\n\n switch (this.defaultFocus) {\n case 'FIRST_ITEM':\n const first = List.getFirstActivatableItem(items);\n if (first) {\n first.active = true;\n }\n break;\n case 'LAST_ITEM':\n const last = List.getLastActivatableItem(items);\n if (last) {\n last.active = true;\n }\n break;\n case 'LIST_ROOT':\n this.listElement?.focus();\n break;\n default:\n case 'NONE':\n // Do nothing.\n break;\n }\n\n if (this.quick) {\n this.dispatchEvent(new Event('opening'));\n this.dispatchEvent(new Event('opened'));\n } else {\n this.animateOpen();\n }\n };\n\n /**\n * Animates closed.\n */\n protected beforeClose = async () => {\n this.open = false;\n\n if (!this.skipRestoreFocus) {\n this.lastFocusedElement?.focus?.();\n }\n\n if (!this.quick) {\n await this.animateClose();\n }\n };\n\n /**\n * Focuses the last focused element.\n */\n protected onClosed = () => {\n if (this.quick) {\n this.dispatchEvent(new Event('closing'));\n this.dispatchEvent(new Event('closed'));\n }\n };\n\n /**\n * Performs the opening animation:\n *\n * https://direct.googleplex.com/#/spec/295000003+271060003\n */\n protected animateOpen() {\n const surfaceEl = this.surfaceEl;\n const slotEl = this.slotEl;\n\n if (!surfaceEl || !slotEl) return;\n\n const openDirection = this.openDirection;\n this.dispatchEvent(new Event('opening'));\n // needs to be imperative because we don't want to mix animation and Lit\n // render timing\n surfaceEl.classList.toggle('animating', true);\n\n const signal = this.openCloseAnimationSignal.start();\n const height = surfaceEl.offsetHeight;\n const openingUpwards = openDirection === 'UP';\n const children = this.items;\n const FULL_DURATION = 500;\n const SURFACE_OPACITY_DURATION = 50;\n const ITEM_OPACITY_DURATION = 250;\n // We want to fit every child fade-in animation within the full duration of\n // the animation.\n const DELAY_BETWEEN_ITEMS =\n (FULL_DURATION - ITEM_OPACITY_DURATION) / children.length;\n\n const surfaceHeightAnimation =\n surfaceEl.animate([{height: '0px'}, {height: `${height}px`}], {\n duration: FULL_DURATION,\n easing: EASING.EMPHASIZED,\n });\n // When we are opening upwards, we want to make sure the last item is always\n // in view, so we need to translate it upwards the opposite direction of the\n // height animation\n const upPositionCorrectionAnimation = slotEl.animate(\n [\n {transform: openingUpwards ? `translateY(-${height}px)` : ''},\n {transform: ''}\n ],\n {duration: FULL_DURATION, easing: EASING.EMPHASIZED});\n\n const surfaceOpacityAnimation = surfaceEl.animate(\n [{opacity: 0}, {opacity: 1}], SURFACE_OPACITY_DURATION);\n\n const childrenAnimations: Array<[HTMLElement, Animation]> = [];\n\n for (let i = 0; i < children.length; i++) {\n // If we are animating upwards, then reverse the children list.\n const directionalIndex = openingUpwards ? children.length - 1 - i : i;\n const child = children[directionalIndex];\n const animation = child.animate([{opacity: 0}, {opacity: 1}], {\n duration: ITEM_OPACITY_DURATION,\n delay: DELAY_BETWEEN_ITEMS * i,\n });\n\n // Make them all initially hidden and then clean up at the end of each\n // animation.\n child.classList.toggle('hidden', true);\n animation.addEventListener('finish', () => {\n child.classList.toggle('hidden', false);\n });\n\n childrenAnimations.push([child, animation]);\n }\n\n signal.addEventListener('abort', () => {\n surfaceHeightAnimation.cancel();\n upPositionCorrectionAnimation.cancel();\n surfaceOpacityAnimation.cancel();\n childrenAnimations.forEach(([child, animation]) => {\n child.classList.toggle('hidden', false);\n animation.cancel();\n });\n });\n\n surfaceHeightAnimation.addEventListener('finish', () => {\n surfaceEl.classList.toggle('animating', false);\n this.openCloseAnimationSignal.finish();\n this.dispatchEvent(new Event('opened'));\n });\n }\n\n /**\n * Performs the closing animation:\n *\n * https://direct.googleplex.com/#/spec/295000003+271060003\n */\n protected animateClose() {\n let resolve!: (value: unknown) => void;\n let reject!: () => void;\n\n // This promise blocks the surface position controller from setting\n // display: none on the surface which will interfere with this animation.\n const animationEnded = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n\n const surfaceEl = this.surfaceEl;\n const slotEl = this.slotEl;\n\n if (!surfaceEl || !slotEl) {\n reject();\n return animationEnded;\n }\n\n const openDirection = this.openDirection;\n const closingDownwards = openDirection === 'UP';\n this.dispatchEvent(new Event('closing'));\n // needs to be imperative because we don't want to mix animation and Lit\n // render timing\n surfaceEl.classList.toggle('animating', true);\n const signal = this.openCloseAnimationSignal.start();\n const height = surfaceEl.offsetHeight;\n const children = this.items;\n const FULL_DURATION = 150;\n const SURFACE_OPACITY_DURATION = 50;\n // The surface fades away at the very end\n const SURFACE_OPACITY_DELAY = FULL_DURATION - SURFACE_OPACITY_DURATION;\n const ITEM_OPACITY_DURATION = 50;\n const ITEM_OPACITY_INITIAL_DELAY = 50;\n const END_HEIGHT_PRECENTAGE = .35;\n\n // We want to fit every child fade-out animation within the full duration of\n // the animation.\n const DELAY_BETWEEN_ITEMS =\n (FULL_DURATION - ITEM_OPACITY_INITIAL_DELAY - ITEM_OPACITY_DURATION) /\n children.length;\n\n // The mock has the animation shrink to 35%\n const surfaceHeightAnimation = surfaceEl.animate(\n [\n {height: `${height}px`},\n {height: `${height * END_HEIGHT_PRECENTAGE}px`}\n ],\n {\n duration: FULL_DURATION,\n easing: EASING.EMPHASIZED_ACCELERATE,\n });\n\n // When we are closing downwards, we want to make sure the last item is\n // always in view, so we need to translate it upwards the opposite direction\n // of the height animation\n const downPositionCorrectionAnimation = slotEl.animate(\n [\n {transform: ''}, {\n transform: closingDownwards ?\n `translateY(-${height * (1 - END_HEIGHT_PRECENTAGE)}px)` :\n ''\n }\n ],\n {duration: FULL_DURATION, easing: EASING.EMPHASIZED_ACCELERATE});\n\n const surfaceOpacityAnimation = surfaceEl.animate(\n [{opacity: 1}, {opacity: 0}],\n {duration: SURFACE_OPACITY_DURATION, delay: SURFACE_OPACITY_DELAY});\n\n const childrenAnimations: Array<[HTMLElement, Animation]> = [];\n\n for (let i = 0; i < children.length; i++) {\n // If the animation is closing upwards, then reverse the list of\n // children so that we animate in the opposite direction.\n const directionalIndex = closingDownwards ? i : children.length - 1 - i;\n const child = children[directionalIndex];\n const animation = child.animate([{opacity: 1}, {opacity: 0}], {\n duration: ITEM_OPACITY_DURATION,\n delay: ITEM_OPACITY_INITIAL_DELAY + DELAY_BETWEEN_ITEMS * i,\n });\n\n // Make sure the items stay hidden at the end of each child animation.\n // We clean this up at the end of the overall animation.\n animation.addEventListener('finish', () => {\n child.classList.toggle('hidden', true);\n });\n childrenAnimations.push([child, animation]);\n }\n\n signal.addEventListener('abort', () => {\n surfaceHeightAnimation.cancel();\n downPositionCorrectionAnimation.cancel();\n surfaceOpacityAnimation.cancel();\n childrenAnimations.forEach(([child, animation]) => {\n animation.cancel();\n child.classList.toggle('hidden', false);\n });\n reject();\n });\n\n surfaceHeightAnimation.addEventListener('finish', () => {\n surfaceEl.classList.toggle('animating', false);\n childrenAnimations.forEach(([child]) => {\n child.classList.toggle('hidden', false);\n });\n this.openCloseAnimationSignal.finish();\n this.dispatchEvent(new Event('closed'));\n resolve(true);\n });\n\n return animationEnded;\n }\n\n override connectedCallback() {\n super.connectedCallback();\n if (!isServer) {\n window.addEventListener('click', this.onWindowClick, {capture: true});\n }\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n if (!isServer) {\n window.removeEventListener('click', this.onWindowClick, {capture: true});\n }\n }\n\n protected onWindowClick = (e: MouseEvent) => {\n if (!this.stayOpenOnOutsideClick && !e.composedPath().includes(this)) {\n this.open = false;\n }\n };\n\n protected onCloseMenu(e: Event) {\n this.close();\n }\n\n protected onDeactivateItems(e: Event) {\n e.stopPropagation();\n const items = this.items;\n for (const item of items) {\n item.active = false;\n }\n }\n\n protected handleDeactivateTypeahead(e: DeactivateTypeaheadEvent) {\n // stopPropagation so that this does not deactivate any typeaheads in menus\n // nested above it e.g. md-sub-menu-item\n e.stopPropagation();\n this.typeaheadActive = false;\n }\n\n protected handleActivateTypeahead(e: ActivateTypeaheadEvent) {\n // stopPropagation so that this does not activate any typeaheads in menus\n // nested above it e.g. md-sub-menu-item\n e.stopPropagation();\n this.typeaheadActive = true;\n }\n\n override focus() {\n this.listElement?.focus();\n }\n\n close() {\n this.open = false;\n this.items.forEach(item => {\n item.close?.();\n });\n }\n\n show() {\n this.open = true;\n }\n}\n"]}
1
+ {"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,6BAA6B;AAC7B,mCAAmC;AACnC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,2BAA2B,CAAC;AACnC,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAC,YAAY,EAAC,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAC,YAAY,EAAE,qBAAqB,EAAC,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAC,qBAAqB,EAAE,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAGxE,OAAO,EA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IAAC,YAAY,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;;qCACC,aAAa;;6CAE3C","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Required for @ariaProperty\n// tslint:disable:no-new-decorators\nimport '../../list/list.js';\nimport '../../focus/focus-ring.js';\nimport '../../elevation/elevation.js';\n\nimport {html, isServer, LitElement} from 'lit';\nimport {eventOptions, property, query, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {styleMap} from 'lit/directives/style-map.js';\n\nimport {ariaProperty} from '../../decorators/aria-property.js';\nimport {MdFocusRing} from '../../focus/focus-ring.js';\nimport {pointerPress, shouldShowStrongFocus} from '../../focus/strong-focus.js';\nimport {List} from '../../list/lib/list.js';\nimport {createAnimationSignal, EASING} from '../../motion/animation.js';\nimport {ARIARole} from '../../types/aria.js';\n\nimport {ActivateTypeaheadEvent, DeactivateTypeaheadEvent, isElementInSubtree, MenuItem} from './shared.js';\nimport {Corner, SurfacePositionController, SurfacePositionTarget} from './surfacePositionController.js';\nimport {TypeaheadController} from './typeaheadController.js';\n\nexport {Corner} from './surfacePositionController.js';\n\n/**\n * The default value for the typeahead buffer time in Milliseconds.\n */\nexport const DEFAULT_TYPEAHEAD_BUFFER_TIME = 200;\n\n/**\n * Element to focus on when menu is first opened.\n */\nexport type DefaultFocusState = 'NONE'|'LIST_ROOT'|'FIRST_ITEM'|'LAST_ITEM';\n\n/**\n * Gets the currently focused element on the page.\n *\n * @param activeDoc The document or shadowroot from which to start the search.\n * Defaults to `window.document`\n * @return Returns the currently deeply focused element or `null` if none.\n */\nfunction getFocusedElement(activeDoc: Document|ShadowRoot = document):\n HTMLElement|null {\n const activeEl = activeDoc.activeElement as HTMLElement | null;\n\n if (!activeEl) {\n return null;\n }\n\n if (activeEl.shadowRoot) {\n return getFocusedElement(activeEl.shadowRoot) ?? activeEl;\n }\n\n return activeEl;\n}\n\n/**\n * @fires opening Fired before the opening animation begins\n * @fires opened Fired once the menu is open, after any animations\n * @fires closing Fired before the closing animation begins\n * @fires closed Fired once the menu is closed, after any animations\n */\nexport abstract class Menu extends LitElement {\n @query('md-list') protected readonly listElement!: List|null;\n @query('.menu') protected readonly surfaceEl!: HTMLElement|null;\n @query('slot') protected readonly slotEl!: HTMLSlotElement|null;\n @query('md-focus-ring') protected readonly focusRing!: MdFocusRing;\n\n @ariaProperty\n @property({type: String, attribute: 'data-aria-label', noAccessor: true})\n override ariaLabel!: string;\n\n /**\n * The element in which the menu should align to.\n */\n @property({attribute: false})\n anchor: HTMLElement&Partial<SurfacePositionTarget>|null = null;\n /**\n * Makes the element use `position:fixed` instead of `position:absolute`. In\n * most cases, the menu should position itself above most other\n * `position:absolute` or `position:fixed` elements when placed inside of\n * them. e.g. using a menu inside of an `md-dialog`.\n *\n * __NOTE__: Fixed menus will not scroll with the page and will be fixed to\n * the window instead.\n */\n @property({type: Boolean}) fixed = false;\n /**\n * Skips the opening and closing animations.\n */\n @property({type: Boolean}) quick = false;\n /**\n * Displays overflow content like a submenu.\n *\n * __NOTE__: This may cause adverse effects if you set\n * `md-menu {max-height:...}`\n * and have items overflowing items in the \"y\" direction.\n */\n @property({type: Boolean, attribute: 'has-overflow'}) hasOverflow = false;\n /**\n * Opens the menu and makes it visible. Alternative to the `.show()` and\n * `.close()` methods\n */\n @property({type: Boolean, reflect: true}) open = false;\n /**\n * Offsets the menu's inline alignment from the anchor by the given number in\n * pixels. This value is direction aware and will follow the LTR / RTL\n * direction.\n *\n * e.g. LTR: positive -> right, negative -> left\n * RTL: positive -> left, negative -> right\n */\n @property({type: Number, attribute: 'x-offset'}) xOffset = 0;\n /**\n * Offsets the menu's block alignment from the anchor by the given number in\n * pixels.\n *\n * e.g. positive -> down, negative -> up\n */\n @property({type: Number, attribute: 'y-offset'}) yOffset = 0;\n /**\n * The tabindex of the underlying list element.\n */\n @property({type: Number, attribute: 'list-tab-index'}) listTabIndex = 0;\n /**\n * The role of the underlying list element.\n */\n @ariaProperty\n @property({type: String, attribute: 'data-role', noAccessor: true})\n override role: ARIARole = 'list';\n /**\n * The max time between the keystrokes of the typeahead menu behavior before\n * it clears the typeahead buffer.\n */\n @property({type: Number, attribute: 'typeahead-delay'})\n typeaheadBufferTime = DEFAULT_TYPEAHEAD_BUFFER_TIME;\n /**\n * The corner of the anchor which to align the menu in the standard logical\n * property style of <block>_<inline>.\n */\n @property({type: String, attribute: 'anchor-corner'})\n anchorCorner: Corner = 'END_START';\n /**\n * The corner of the menu which to align the anchor in the standard logical\n * property style of <block>_<inline>.\n */\n @property({type: String, attribute: 'menu-corner'})\n menuCorner: Corner = 'START_START';\n /**\n * Keeps the user clicks outside the menu.\n *\n * NOTE: clicking outside may still cause focusout to close the menu so see\n * `stayOpenOnFocusout`.\n */\n @property({type: Boolean, attribute: 'stay-open-on-outside-click'})\n stayOpenOnOutsideClick = false;\n /**\n * Keeps the menu open when focus leaves the menu's composed subtree.\n *\n * NOTE: Focusout behavior will stop propagation of the focusout event. Set\n * this property to true to opt-out of menu's focuout handling altogether.\n */\n @property({type: Boolean, attribute: 'stay-open-on-focusout'})\n stayOpenOnFocusout = false;\n /**\n * After closing, does not restore focus to the last focused element before\n * the menu was opened.\n */\n @property({type: Boolean, attribute: 'skip-restore-focus'})\n skipRestoreFocus = false;\n /**\n * The element that should be focused by default once opened.\n */\n @property({type: String, attribute: 'default-focus'})\n defaultFocus: DefaultFocusState = 'LIST_ROOT';\n\n @state() protected typeaheadActive = true;\n\n protected openCloseAnimationSignal = createAnimationSignal();\n\n /**\n * Whether the menu is animating upwards or downwards when opening. This is\n * helpful for calculating some animation calculations.\n */\n protected get openDirection(): 'UP'|'DOWN' {\n const menuCornerBlock = this.menuCorner.split('_')[0];\n return menuCornerBlock === 'START' ? 'DOWN' : 'UP';\n }\n\n /**\n * The element that was focused before the menu opened.\n */\n protected lastFocusedElement: HTMLElement|null = null;\n\n /**\n * Handles typeahead navigation through the menu.\n */\n typeaheadController = new TypeaheadController(() => {\n return {\n getItems: () => this.items,\n typeaheadBufferTime: this.typeaheadBufferTime,\n active: this.typeaheadActive\n };\n });\n\n /**\n * Handles positioning the surface and aligning it to the anchor.\n */\n protected menuPositionController = new SurfacePositionController(this, () => {\n return {\n anchorCorner: this.anchorCorner,\n surfaceCorner: this.menuCorner,\n surfaceEl: this.surfaceEl,\n anchorEl: this.anchor,\n isTopLayer: this.fixed,\n isOpen: this.open,\n xOffset: this.xOffset,\n yOffset: this.yOffset,\n onOpen: this.onOpened,\n beforeClose: this.beforeClose,\n onClose: this.onClosed,\n };\n });\n\n /**\n * The menu items associated with this menu. The items must be `MenuItem`s and\n * have both the `md-menu-item` and `md-list-item` attributes.\n */\n get items(): MenuItem[] {\n const listElement = this.listElement;\n\n if (listElement) {\n return listElement.items.filter(el => el.hasAttribute('md-menu-item')) as\n MenuItem[];\n }\n\n return [];\n }\n\n override render() {\n return this.renderSurface();\n }\n\n /**\n * Renders the positionable surface element and its contents.\n */\n protected renderSurface() {\n // TODO(b/274140618): elevation should be an underlay, not an overlay that\n // tints content\n return html`\n <div\n class=\"menu ${classMap(this.getSurfaceClasses())}\"\n style=${styleMap(this.menuPositionController.surfaceStyles)}\n @focusout=${this.handleFocusout}>\n ${this.renderList()}\n ${this.renderElevation()}\n ${this.renderFocusRing()}\n </div>\n `;\n }\n\n /**\n * Renders the List element and its items\n */\n protected renderList() {\n return html`\n <md-list\n .ariaLabel=${this.ariaLabel}\n .role=${this.role}\n listTabIndex=${this.listTabIndex}\n @focus=${this.handleListFocus}\n @blur=${this.handleListBlur}\n @click=${this.handleListClick}\n @keydown=${this.handleListKeydown}>\n ${this.renderMenuItems()}\n </md-list>`;\n }\n\n /**\n * Renders the menu items' slot\n */\n protected renderMenuItems() {\n return html`<slot\n @close-menu=${this.onCloseMenu}\n @deactivate-items=${this.onDeactivateItems}\n @deactivate-typeahead=${this.handleDeactivateTypeahead}\n @activate-typeahead=${this.handleActivateTypeahead}></slot>`;\n }\n\n /**\n * Renders the elevation component.\n */\n protected renderElevation() {\n return html`<md-elevation></md-elevation>`;\n }\n\n /**\n * Renders the focus ring component.\n */\n protected renderFocusRing() {\n return html`<md-focus-ring></md-focus-ring>`;\n }\n\n protected getSurfaceClasses() {\n return {\n open: this.open,\n fixed: this.fixed,\n 'has-overflow': this.hasOverflow,\n };\n }\n\n protected async handleFocusout(e: FocusEvent) {\n if (this.stayOpenOnFocusout) {\n return;\n }\n\n // Stop propagation to prevent nested menus from interfering with each other\n e.stopPropagation();\n\n if (e.relatedTarget) {\n // Don't close the menu if we are switching focus between menu,\n // md-menu-item, and md-list\n if (isElementInSubtree(e.relatedTarget, this)) {\n return;\n }\n }\n\n const oldRestoreFocus = this.skipRestoreFocus;\n // allow focus to continue to the next focused object rather than returning\n this.skipRestoreFocus = true;\n this.close();\n // await for close\n await this.updateComplete;\n // return to previous behavior\n this.skipRestoreFocus = oldRestoreFocus;\n }\n\n protected handleListFocus() {\n this.focusRing.visible = shouldShowStrongFocus();\n }\n\n protected handleListClick() {\n pointerPress();\n this.focusRing.visible = shouldShowStrongFocus();\n }\n\n // Capture so that we can grab the event before it reaches the list item\n // istelf. Specifically useful for the case where typeahead encounters a space\n // and we don't want the menu item to close the menu.\n @eventOptions({capture: true})\n protected handleListKeydown(e: KeyboardEvent) {\n this.typeaheadController.onKeydown(e);\n }\n\n protected handleListBlur() {\n this.focusRing.visible = false;\n }\n\n /**\n * Saves the last focused element focuses the new element based on\n * `defaultFocus`, and animates open.\n */\n protected onOpened = () => {\n this.lastFocusedElement = getFocusedElement();\n\n if (!this.listElement) return;\n\n const items = this.listElement.items;\n const activeItemRecord = List.getActiveItem(items);\n\n if (activeItemRecord && this.defaultFocus !== 'NONE') {\n activeItemRecord.item.active = false;\n }\n\n switch (this.defaultFocus) {\n case 'FIRST_ITEM':\n const first = List.getFirstActivatableItem(items);\n if (first) {\n first.active = true;\n }\n break;\n case 'LAST_ITEM':\n const last = List.getLastActivatableItem(items);\n if (last) {\n last.active = true;\n }\n break;\n case 'LIST_ROOT':\n this.listElement?.focus();\n break;\n default:\n case 'NONE':\n // Do nothing.\n break;\n }\n\n if (this.quick) {\n this.dispatchEvent(new Event('opening'));\n this.dispatchEvent(new Event('opened'));\n } else {\n this.animateOpen();\n }\n };\n\n /**\n * Animates closed.\n */\n protected beforeClose = async () => {\n this.open = false;\n\n if (!this.skipRestoreFocus) {\n this.lastFocusedElement?.focus?.();\n }\n\n if (!this.quick) {\n await this.animateClose();\n }\n };\n\n /**\n * Focuses the last focused element.\n */\n protected onClosed = () => {\n if (this.quick) {\n this.dispatchEvent(new Event('closing'));\n this.dispatchEvent(new Event('closed'));\n }\n };\n\n /**\n * Performs the opening animation:\n *\n * https://direct.googleplex.com/#/spec/295000003+271060003\n */\n protected animateOpen() {\n const surfaceEl = this.surfaceEl;\n const slotEl = this.slotEl;\n\n if (!surfaceEl || !slotEl) return;\n\n const openDirection = this.openDirection;\n this.dispatchEvent(new Event('opening'));\n // needs to be imperative because we don't want to mix animation and Lit\n // render timing\n surfaceEl.classList.toggle('animating', true);\n\n const signal = this.openCloseAnimationSignal.start();\n const height = surfaceEl.offsetHeight;\n const openingUpwards = openDirection === 'UP';\n const children = this.items;\n const FULL_DURATION = 500;\n const SURFACE_OPACITY_DURATION = 50;\n const ITEM_OPACITY_DURATION = 250;\n // We want to fit every child fade-in animation within the full duration of\n // the animation.\n const DELAY_BETWEEN_ITEMS =\n (FULL_DURATION - ITEM_OPACITY_DURATION) / children.length;\n\n const surfaceHeightAnimation =\n surfaceEl.animate([{height: '0px'}, {height: `${height}px`}], {\n duration: FULL_DURATION,\n easing: EASING.EMPHASIZED,\n });\n // When we are opening upwards, we want to make sure the last item is always\n // in view, so we need to translate it upwards the opposite direction of the\n // height animation\n const upPositionCorrectionAnimation = slotEl.animate(\n [\n {transform: openingUpwards ? `translateY(-${height}px)` : ''},\n {transform: ''}\n ],\n {duration: FULL_DURATION, easing: EASING.EMPHASIZED});\n\n const surfaceOpacityAnimation = surfaceEl.animate(\n [{opacity: 0}, {opacity: 1}], SURFACE_OPACITY_DURATION);\n\n const childrenAnimations: Array<[HTMLElement, Animation]> = [];\n\n for (let i = 0; i < children.length; i++) {\n // If we are animating upwards, then reverse the children list.\n const directionalIndex = openingUpwards ? children.length - 1 - i : i;\n const child = children[directionalIndex];\n const animation = child.animate([{opacity: 0}, {opacity: 1}], {\n duration: ITEM_OPACITY_DURATION,\n delay: DELAY_BETWEEN_ITEMS * i,\n });\n\n // Make them all initially hidden and then clean up at the end of each\n // animation.\n child.classList.toggle('hidden', true);\n animation.addEventListener('finish', () => {\n child.classList.toggle('hidden', false);\n });\n\n childrenAnimations.push([child, animation]);\n }\n\n signal.addEventListener('abort', () => {\n surfaceHeightAnimation.cancel();\n upPositionCorrectionAnimation.cancel();\n surfaceOpacityAnimation.cancel();\n childrenAnimations.forEach(([child, animation]) => {\n child.classList.toggle('hidden', false);\n animation.cancel();\n });\n });\n\n surfaceHeightAnimation.addEventListener('finish', () => {\n surfaceEl.classList.toggle('animating', false);\n this.openCloseAnimationSignal.finish();\n this.dispatchEvent(new Event('opened'));\n });\n }\n\n /**\n * Performs the closing animation:\n *\n * https://direct.googleplex.com/#/spec/295000003+271060003\n */\n protected animateClose() {\n let resolve!: (value: unknown) => void;\n let reject!: () => void;\n\n // This promise blocks the surface position controller from setting\n // display: none on the surface which will interfere with this animation.\n const animationEnded = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n\n const surfaceEl = this.surfaceEl;\n const slotEl = this.slotEl;\n\n if (!surfaceEl || !slotEl) {\n reject();\n return animationEnded;\n }\n\n const openDirection = this.openDirection;\n const closingDownwards = openDirection === 'UP';\n this.dispatchEvent(new Event('closing'));\n // needs to be imperative because we don't want to mix animation and Lit\n // render timing\n surfaceEl.classList.toggle('animating', true);\n const signal = this.openCloseAnimationSignal.start();\n const height = surfaceEl.offsetHeight;\n const children = this.items;\n const FULL_DURATION = 150;\n const SURFACE_OPACITY_DURATION = 50;\n // The surface fades away at the very end\n const SURFACE_OPACITY_DELAY = FULL_DURATION - SURFACE_OPACITY_DURATION;\n const ITEM_OPACITY_DURATION = 50;\n const ITEM_OPACITY_INITIAL_DELAY = 50;\n const END_HEIGHT_PRECENTAGE = .35;\n\n // We want to fit every child fade-out animation within the full duration of\n // the animation.\n const DELAY_BETWEEN_ITEMS =\n (FULL_DURATION - ITEM_OPACITY_INITIAL_DELAY - ITEM_OPACITY_DURATION) /\n children.length;\n\n // The mock has the animation shrink to 35%\n const surfaceHeightAnimation = surfaceEl.animate(\n [\n {height: `${height}px`},\n {height: `${height * END_HEIGHT_PRECENTAGE}px`}\n ],\n {\n duration: FULL_DURATION,\n easing: EASING.EMPHASIZED_ACCELERATE,\n });\n\n // When we are closing downwards, we want to make sure the last item is\n // always in view, so we need to translate it upwards the opposite direction\n // of the height animation\n const downPositionCorrectionAnimation = slotEl.animate(\n [\n {transform: ''}, {\n transform: closingDownwards ?\n `translateY(-${height * (1 - END_HEIGHT_PRECENTAGE)}px)` :\n ''\n }\n ],\n {duration: FULL_DURATION, easing: EASING.EMPHASIZED_ACCELERATE});\n\n const surfaceOpacityAnimation = surfaceEl.animate(\n [{opacity: 1}, {opacity: 0}],\n {duration: SURFACE_OPACITY_DURATION, delay: SURFACE_OPACITY_DELAY});\n\n const childrenAnimations: Array<[HTMLElement, Animation]> = [];\n\n for (let i = 0; i < children.length; i++) {\n // If the animation is closing upwards, then reverse the list of\n // children so that we animate in the opposite direction.\n const directionalIndex = closingDownwards ? i : children.length - 1 - i;\n const child = children[directionalIndex];\n const animation = child.animate([{opacity: 1}, {opacity: 0}], {\n duration: ITEM_OPACITY_DURATION,\n delay: ITEM_OPACITY_INITIAL_DELAY + DELAY_BETWEEN_ITEMS * i,\n });\n\n // Make sure the items stay hidden at the end of each child animation.\n // We clean this up at the end of the overall animation.\n animation.addEventListener('finish', () => {\n child.classList.toggle('hidden', true);\n });\n childrenAnimations.push([child, animation]);\n }\n\n signal.addEventListener('abort', () => {\n surfaceHeightAnimation.cancel();\n downPositionCorrectionAnimation.cancel();\n surfaceOpacityAnimation.cancel();\n childrenAnimations.forEach(([child, animation]) => {\n animation.cancel();\n child.classList.toggle('hidden', false);\n });\n reject();\n });\n\n surfaceHeightAnimation.addEventListener('finish', () => {\n surfaceEl.classList.toggle('animating', false);\n childrenAnimations.forEach(([child]) => {\n child.classList.toggle('hidden', false);\n });\n this.openCloseAnimationSignal.finish();\n this.dispatchEvent(new Event('closed'));\n resolve(true);\n });\n\n return animationEnded;\n }\n\n override connectedCallback() {\n super.connectedCallback();\n if (!isServer) {\n window.addEventListener('click', this.onWindowClick, {capture: true});\n }\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n if (!isServer) {\n window.removeEventListener('click', this.onWindowClick, {capture: true});\n }\n }\n\n protected onWindowClick = (e: MouseEvent) => {\n if (!this.stayOpenOnOutsideClick && !e.composedPath().includes(this)) {\n this.open = false;\n }\n };\n\n protected onCloseMenu(e: Event) {\n this.close();\n }\n\n protected onDeactivateItems(e: Event) {\n e.stopPropagation();\n const items = this.items;\n for (const item of items) {\n item.active = false;\n }\n }\n\n protected handleDeactivateTypeahead(e: DeactivateTypeaheadEvent) {\n // stopPropagation so that this does not deactivate any typeaheads in menus\n // nested above it e.g. md-sub-menu-item\n e.stopPropagation();\n this.typeaheadActive = false;\n }\n\n protected handleActivateTypeahead(e: ActivateTypeaheadEvent) {\n // stopPropagation so that this does not activate any typeaheads in menus\n // nested above it e.g. md-sub-menu-item\n e.stopPropagation();\n this.typeaheadActive = true;\n }\n\n override focus() {\n this.listElement?.focus();\n }\n\n close() {\n this.open = false;\n this.items.forEach(item => {\n item.close?.();\n });\n }\n\n show() {\n this.open = true;\n }\n}\n"]}
@@ -36,22 +36,16 @@ $_custom-property-prefix: 'menu';
36
36
  }
37
37
 
38
38
  .list-item {
39
- :host([active]) &,
40
- :host(:active) &,
41
- &:focus {
39
+ :host([selected]) & {
42
40
  background-color: var(--_list-item-selected-container-color);
43
41
  }
44
42
  }
45
43
 
46
- /*
47
- Set the ripple opacity to 0 if there is a submenu that is hovered.
48
- */
44
+ // Set the ripple opacity to 0 if there is a submenu that is hovered.
49
45
  .list-item:has(.submenu:hover) {
50
- /*
51
- Have to use ripple theme directly because :has selector in this case does
52
- not work in this case with the :has selector, thus we cannot override the
53
- custom props set in :host
54
- */
46
+ // Have to use ripple theme directly because :has selector in this case does
47
+ // not work in this case with the :has selector, thus we cannot override the
48
+ // custom props set in :host
55
49
  @include ripple.theme(
56
50
  (
57
51
  hover-opacity: 0,
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { css } from 'lit';
7
+ export const styles = css `@media(forced-colors: active){.list-item{position:relative}:host([selected]) .list-item:not(:has(.focus-ring[visible]))::before{content:"";position:absolute;inset:0;box-sizing:border-box;border-radius:inherit;pointer-events:none;border:3px double CanvasText}}/*# sourceMappingURL=forced-colors-styles.css.map */
8
+ `;
9
+ //# sourceMappingURL=forced-colors-styles.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forced-colors-styles.css.js","sourceRoot":"","sources":["forced-colors-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`@media(forced-colors: active){.list-item{position:relative}:host([selected]) .list-item:not(:has(.focus-ring[visible]))::before{content:\"\";position:absolute;inset:0;box-sizing:border-box;border-radius:inherit;pointer-events:none;border:3px double CanvasText}}/*# sourceMappingURL=forced-colors-styles.css.map */\n`;\n "]}
@@ -0,0 +1,22 @@
1
+ //
2
+ // Copyright 2023 Google LLC
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ //
5
+
6
+ @media (forced-colors: active) {
7
+ .list-item {
8
+ position: relative;
9
+ }
10
+
11
+ // Show double border only when selected, and the current list item does not
12
+ // have a focus ring on it.
13
+ :host([selected]) .list-item:not(:has(.focus-ring[visible]))::before {
14
+ content: '';
15
+ position: absolute;
16
+ inset: 0;
17
+ box-sizing: border-box;
18
+ border-radius: inherit;
19
+ pointer-events: none;
20
+ border: 3px double CanvasText;
21
+ }
22
+ }
@@ -4,6 +4,6 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { css } from 'lit';
7
- export const styles = css `:host{--_list-item-selected-container-color: var(--md-menu-list-item-selected-container-color, var(--md-sys-color-surface-variant, #e7e0ec))}:host([active]) .list-item,:host(:active) .list-item,.list-item:focus{background-color:var(--_list-item-selected-container-color)}.list-item:has(.submenu:hover){--md-ripple-hover-opacity:0}/*# sourceMappingURL=menu-item-styles.css.map */
7
+ export const styles = css `:host{--_list-item-selected-container-color: var(--md-menu-list-item-selected-container-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}:host([selected]) .list-item{background-color:var(--_list-item-selected-container-color)}.list-item:has(.submenu:hover){--md-ripple-hover-opacity:0}/*# sourceMappingURL=menu-item-styles.css.map */
8
8
  `;
9
9
  //# sourceMappingURL=menu-item-styles.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"menu-item-styles.css.js","sourceRoot":"","sources":["menu-item-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--_list-item-selected-container-color: var(--md-menu-list-item-selected-container-color, var(--md-sys-color-surface-variant, #e7e0ec))}:host([active]) .list-item,:host(:active) .list-item,.list-item:focus{background-color:var(--_list-item-selected-container-color)}.list-item:has(.submenu:hover){--md-ripple-hover-opacity:0}/*# sourceMappingURL=menu-item-styles.css.map */\n`;\n "]}
1
+ {"version":3,"file":"menu-item-styles.css.js","sourceRoot":"","sources":["menu-item-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--_list-item-selected-container-color: var(--md-menu-list-item-selected-container-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}:host([selected]) .list-item{background-color:var(--_list-item-selected-container-color)}.list-item:has(.submenu:hover){--md-ripple-hover-opacity:0}/*# sourceMappingURL=menu-item-styles.css.map */\n`;\n "]}
@@ -147,4 +147,14 @@ export declare function isClosableKey(code: string): code is Values<typeof KEYDO
147
147
  * menu item.
148
148
  */
149
149
  export declare function isSelectableKey(code: string): code is Values<typeof SELECTION_KEY>;
150
+ /**
151
+ * Determines whether a target element is contained inside another element's
152
+ * composed tree.
153
+ *
154
+ * @param target The potential contained element.
155
+ * @param container The potential containing element of the target.
156
+ * @returns Whether the target element is contained inside the container's
157
+ * composed subtree
158
+ */
159
+ export declare function isElementInSubtree(target: EventTarget, container: EventTarget): boolean;
150
160
  export {};
@@ -98,4 +98,27 @@ export function isClosableKey(code) {
98
98
  export function isSelectableKey(code) {
99
99
  return Object.values(SELECTION_KEY).some(value => (value === code));
100
100
  }
101
+ /**
102
+ * Determines whether a target element is contained inside another element's
103
+ * composed tree.
104
+ *
105
+ * @param target The potential contained element.
106
+ * @param container The potential containing element of the target.
107
+ * @returns Whether the target element is contained inside the container's
108
+ * composed subtree
109
+ */
110
+ export function isElementInSubtree(target, container) {
111
+ // Dispatch a composed, bubbling event to check its path to see if the
112
+ // newly-focused element is contained in container's subtree
113
+ const focusEv = new Event('md-contains', { bubbles: true, composed: true });
114
+ let composedPath = [];
115
+ const listener = (ev) => {
116
+ composedPath = ev.composedPath();
117
+ };
118
+ container.addEventListener('md-contains', listener);
119
+ target.dispatchEvent(focusEv);
120
+ container.removeEventListener('md-contains', listener);
121
+ const isContained = composedPath.length > 0;
122
+ return isContained;
123
+ }
101
124
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgEH;;;GAGG;AACH,MAAM,OAAO,cAAkD,SAAQ,KAAK;IAE1E,YAAmB,SAAmB,EAAW,MAAS;QACxD,KAAK,CAAC,YAAY,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;QADpC,cAAS,GAAT,SAAS,CAAU;QAAW,WAAM,GAAN,MAAM,CAAG;QAExD,IAAI,CAAC,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;CACF;AAED;;;GAGG;AACH,2BAA2B;AAC3B,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAA,cAA8B,CAAA,CAAC;AAEpE;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C;QACE,KAAK,CAAC,kBAAkB,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;IAC7D,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD;QACE,KAAK,CAAC,sBAAsB,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;IACjE,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C;QACE,KAAK,CAAC,oBAAoB,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;IAC/D,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,WAAW;CACT,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACN,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,eAAe,EAAE,iBAAiB;IAClC,OAAO,EAAE,SAAS;CACV,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,aAAa,CAAC,KAAK;IAC1B,KAAK,EAAE,aAAa,CAAC,KAAK;CAClB,CAAC;AAIX;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IAExC,OAAO,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAE1C,OAAO,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC;AACtE,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ListItem} from '../../list/lib/listitem/list-item.js';\n\n/**\n * Interface specific to menu item and not list item.\n */\ninterface MenuItemSelf {\n /**\n * The visible headline text of the item.\n */\n headline: string;\n /**\n * Whether or not the item is in the selected visual state (focuses on\n * selection).\n */\n active: boolean;\n /**\n * If it is a sub-menu-item, a method that can close the submenu.\n */\n close?: () => void;\n /**\n * Focuses the item.\n */\n focus: () => void;\n}\n\n/**\n * The interface of every menu item interactive with a menu. All menu items\n * should implement this interface to be compatible with md-menu. Additionally\n * they should have both the `md-menu-item` and `md-list-item` attributes set.\n */\nexport type MenuItem = MenuItemSelf&ListItem;\n\n/**\n * The reason the `close-menu` event was dispatched.\n */\nexport interface Reason {\n kind: string;\n}\n\n/**\n * The click selection reason for the `close-menu` event. The menu was closed\n * because an item was selected via user click.\n */\nexport interface ClickReason extends Reason {\n kind: typeof CLOSE_REASON.CLICK_SELECTION;\n}\n\n/**\n * The keydown reason for the `close-menu` event. The menu was closed\n * because a specific key was pressed. The default closing keys for\n * `md-menu-item` are, Space, Enter or Escape.\n */\nexport interface KeydownReason extends Reason {\n kind: typeof CLOSE_REASON.KEYDOWN;\n key: string;\n}\n\n/**\n * The default menu closing reasons for the material md-menu package.\n */\nexport type DefaultReasons = ClickReason|KeydownReason;\n\n/**\n * The event that closes any parent menus. It is recommended to subclass and\n * dispatch this event rather than creating your own `close-menu` event.\n */\nexport class CloseMenuEvent<T extends Reason = DefaultReasons> extends Event {\n readonly itemPath: MenuItem[];\n constructor(public initiator: MenuItem, readonly reason: T) {\n super('close-menu', {bubbles: true, composed: true});\n this.itemPath = [initiator];\n }\n}\n\n/**\n * The default close menu event used by md-menu. To create your own `close-menu`\n * event, you should subclass the `CloseMenuEvent` instead.\n */\n// tslint:disable-next-line\nexport const DefaultCloseMenuEvent = CloseMenuEvent<DefaultReasons>;\n\n/**\n * The event that requests the parent md-menu to deactivate all other items.\n */\nexport class DeactivateItemsEvent extends Event {\n constructor() {\n super('deactivate-items', {bubbles: true, composed: true});\n }\n}\n\n/**\n * Requests the typeahead functionality of containing menu be deactivated.\n */\nexport class DeactivateTypeaheadEvent extends Event {\n constructor() {\n super('deactivate-typeahead', {bubbles: true, composed: true});\n }\n}\n\n/**\n * Requests the typeahead functionality of containing menu be activated.\n */\nexport class ActivateTypeaheadEvent extends Event {\n constructor() {\n super('activate-typeahead', {bubbles: true, composed: true});\n }\n}\n\n/**\n * Keys that are used to navigate menus.\n */\nexport const NAVIGABLE_KEY = {\n UP: 'ArrowUp',\n DOWN: 'ArrowDown',\n RIGHT: 'ArrowRight',\n LEFT: 'ArrowLeft',\n} as const;\n\n/**\n * Keys that are used for selection in menus.\n */\nexport const SELECTION_KEY = {\n SPACE: 'Space',\n ENTER: 'Enter',\n} as const;\n\n/**\n * Default close `Reason` kind values.\n */\nexport const CLOSE_REASON = {\n CLICK_SELECTION: 'CLICK_SELECTION',\n KEYDOWN: 'KEYDOWN',\n} as const;\n\n/**\n * Keys that can close menus.\n */\nexport const KEYDOWN_CLOSE_KEYS = {\n ESCAPE: 'Escape',\n SPACE: SELECTION_KEY.SPACE,\n ENTER: SELECTION_KEY.ENTER,\n} as const;\n\ntype Values<T> = T[keyof T];\n\n/**\n * Determines whether the given key code is a key code that should close the\n * menu.\n *\n * @param code The KeyboardEvent code to check.\n * @return Whether or not the key code is in the predetermined list to close the\n * menu.\n */\nexport function isClosableKey(code: string):\n code is Values<typeof KEYDOWN_CLOSE_KEYS> {\n return Object.values(KEYDOWN_CLOSE_KEYS).some(value => (value === code));\n}\n\n/**\n * Determines whether the given key code is a key code that should select a menu\n * item.\n *\n * @param code They KeyboardEvent code to check.\n * @return Whether or not the key code is in the predetermined list to select a\n * menu item.\n */\nexport function isSelectableKey(code: string):\n code is Values<typeof SELECTION_KEY> {\n return Object.values(SELECTION_KEY).some(value => (value === code));\n}\n"]}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgEH;;;GAGG;AACH,MAAM,OAAO,cAAkD,SAAQ,KAAK;IAE1E,YAAmB,SAAmB,EAAW,MAAS;QACxD,KAAK,CAAC,YAAY,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAA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C,KAAK;IAC1B,KAAK,EAAE,aAAa,CAAC,KAAK;CAClB,CAAC;AAIX;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IAExC,OAAO,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAE1C,OAAO,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC;AACtE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAC9B,MAAmB,EAAE,SAAsB;IAC7C,sEAAsE;IACtE,4DAA4D;IAC5D,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,aAAa,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;IAC1E,IAAI,YAAY,GAAkB,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,CAAC,EAAS,EAAE,EAAE;QAC7B,YAAY,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC;IACnC,CAAC,CAAC;IAEF,SAAS,CAAC,gBAAgB,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACpD,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9B,SAAS,CAAC,mBAAmB,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAEvD,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IAC5C,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ListItem} from '../../list/lib/listitem/list-item.js';\n\n/**\n * Interface specific to menu item and not list item.\n */\ninterface MenuItemSelf {\n /**\n * The visible headline text of the item.\n */\n headline: string;\n /**\n * Whether or not the item is in the selected visual state (focuses on\n * selection).\n */\n active: boolean;\n /**\n * If it is a sub-menu-item, a method that can close the submenu.\n */\n close?: () => void;\n /**\n * Focuses the item.\n */\n focus: () => void;\n}\n\n/**\n * The interface of every menu item interactive with a menu. All menu items\n * should implement this interface to be compatible with md-menu. Additionally\n * they should have both the `md-menu-item` and `md-list-item` attributes set.\n */\nexport type MenuItem = MenuItemSelf&ListItem;\n\n/**\n * The reason the `close-menu` event was dispatched.\n */\nexport interface Reason {\n kind: string;\n}\n\n/**\n * The click selection reason for the `close-menu` event. The menu was closed\n * because an item was selected via user click.\n */\nexport interface ClickReason extends Reason {\n kind: typeof CLOSE_REASON.CLICK_SELECTION;\n}\n\n/**\n * The keydown reason for the `close-menu` event. The menu was closed\n * because a specific key was pressed. The default closing keys for\n * `md-menu-item` are, Space, Enter or Escape.\n */\nexport interface KeydownReason extends Reason {\n kind: typeof CLOSE_REASON.KEYDOWN;\n key: string;\n}\n\n/**\n * The default menu closing reasons for the material md-menu package.\n */\nexport type DefaultReasons = ClickReason|KeydownReason;\n\n/**\n * The event that closes any parent menus. It is recommended to subclass and\n * dispatch this event rather than creating your own `close-menu` event.\n */\nexport class CloseMenuEvent<T extends Reason = DefaultReasons> extends Event {\n readonly itemPath: MenuItem[];\n constructor(public initiator: MenuItem, readonly reason: T) {\n super('close-menu', {bubbles: true, composed: true});\n this.itemPath = [initiator];\n }\n}\n\n/**\n * The default close menu event used by md-menu. To create your own `close-menu`\n * event, you should subclass the `CloseMenuEvent` instead.\n */\n// tslint:disable-next-line\nexport const DefaultCloseMenuEvent = CloseMenuEvent<DefaultReasons>;\n\n/**\n * The event that requests the parent md-menu to deactivate all other items.\n */\nexport class DeactivateItemsEvent extends Event {\n constructor() {\n super('deactivate-items', {bubbles: true, composed: true});\n }\n}\n\n/**\n * Requests the typeahead functionality of containing menu be deactivated.\n */\nexport class DeactivateTypeaheadEvent extends Event {\n constructor() {\n super('deactivate-typeahead', {bubbles: true, composed: true});\n }\n}\n\n/**\n * Requests the typeahead functionality of containing menu be activated.\n */\nexport class ActivateTypeaheadEvent extends Event {\n constructor() {\n super('activate-typeahead', {bubbles: true, composed: true});\n }\n}\n\n/**\n * Keys that are used to navigate menus.\n */\nexport const NAVIGABLE_KEY = {\n UP: 'ArrowUp',\n DOWN: 'ArrowDown',\n RIGHT: 'ArrowRight',\n LEFT: 'ArrowLeft',\n} as const;\n\n/**\n * Keys that are used for selection in menus.\n */\nexport const SELECTION_KEY = {\n SPACE: 'Space',\n ENTER: 'Enter',\n} as const;\n\n/**\n * Default close `Reason` kind values.\n */\nexport const CLOSE_REASON = {\n CLICK_SELECTION: 'CLICK_SELECTION',\n KEYDOWN: 'KEYDOWN',\n} as const;\n\n/**\n * Keys that can close menus.\n */\nexport const KEYDOWN_CLOSE_KEYS = {\n ESCAPE: 'Escape',\n SPACE: SELECTION_KEY.SPACE,\n ENTER: SELECTION_KEY.ENTER,\n} as const;\n\ntype Values<T> = T[keyof T];\n\n/**\n * Determines whether the given key code is a key code that should close the\n * menu.\n *\n * @param code The KeyboardEvent code to check.\n * @return Whether or not the key code is in the predetermined list to close the\n * menu.\n */\nexport function isClosableKey(code: string):\n code is Values<typeof KEYDOWN_CLOSE_KEYS> {\n return Object.values(KEYDOWN_CLOSE_KEYS).some(value => (value === code));\n}\n\n/**\n * Determines whether the given key code is a key code that should select a menu\n * item.\n *\n * @param code They KeyboardEvent code to check.\n * @return Whether or not the key code is in the predetermined list to select a\n * menu item.\n */\nexport function isSelectableKey(code: string):\n code is Values<typeof SELECTION_KEY> {\n return Object.values(SELECTION_KEY).some(value => (value === code));\n}\n\n/**\n * Determines whether a target element is contained inside another element's\n * composed tree.\n *\n * @param target The potential contained element.\n * @param container The potential containing element of the target.\n * @returns Whether the target element is contained inside the container's\n * composed subtree\n */\nexport function isElementInSubtree(\n target: EventTarget, container: EventTarget) {\n // Dispatch a composed, bubbling event to check its path to see if the\n // newly-focused element is contained in container's subtree\n const focusEv = new Event('md-contains', {bubbles: true, composed: true});\n let composedPath: EventTarget[] = [];\n const listener = (ev: Event) => {\n composedPath = ev.composedPath();\n };\n\n container.addEventListener('md-contains', listener);\n target.dispatchEvent(focusEv);\n container.removeEventListener('md-contains', listener);\n\n const isContained = composedPath.length > 0;\n return isContained;\n}\n"]}
@@ -33,6 +33,10 @@ export declare class SubMenuItem extends MenuItemEl {
33
33
  * The delay between ponterleave and the submenu closing.
34
34
  */
35
35
  hoverCloseDelay: number;
36
+ /**
37
+ * Sets the item in the selected visual state when a submenu is opened.
38
+ */
39
+ selected: boolean;
36
40
  protected menus: Menu[];
37
41
  protected keepOpenOnClick: boolean;
38
42
  protected previousOpenTimeout: number;