@material/web 1.0.0-pre.7 → 1.0.0-pre.8

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 (321) hide show
  1. package/README.md +3 -3
  2. package/aria/aria.js +37 -13
  3. package/aria/aria.js.map +1 -1
  4. package/aria/delegate.d.ts +1 -1
  5. package/aria/delegate.js +1 -1
  6. package/aria/delegate.js.map +1 -1
  7. package/badge/lib/badge.d.ts +0 -3
  8. package/badge/lib/badge.js +4 -6
  9. package/badge/lib/badge.js.map +1 -1
  10. package/button/lib/_elevated-button.scss +35 -6
  11. package/button/lib/_filled-button.scss +35 -3
  12. package/button/lib/_outlined-button.scss +35 -6
  13. package/button/lib/_shared.scss +4 -2
  14. package/button/lib/_text-button.scss +35 -6
  15. package/button/lib/_tonal-button.scss +34 -7
  16. package/button/lib/button.d.ts +23 -26
  17. package/button/lib/button.js +12 -30
  18. package/button/lib/button.js.map +1 -1
  19. package/button/lib/elevated-button.d.ts +6 -4
  20. package/button/lib/elevated-button.js.map +1 -1
  21. package/button/lib/elevated-styles.css.js +1 -1
  22. package/button/lib/elevated-styles.css.js.map +1 -1
  23. package/button/lib/filled-button.d.ts +6 -4
  24. package/button/lib/filled-button.js.map +1 -1
  25. package/button/lib/filled-styles.css.js +1 -1
  26. package/button/lib/filled-styles.css.js.map +1 -1
  27. package/button/lib/outlined-button.d.ts +6 -4
  28. package/button/lib/outlined-button.js.map +1 -1
  29. package/button/lib/outlined-styles.css.js +1 -1
  30. package/button/lib/outlined-styles.css.js.map +1 -1
  31. package/button/lib/shared-styles.css.js +1 -1
  32. package/button/lib/shared-styles.css.js.map +1 -1
  33. package/button/lib/text-button.d.ts +5 -2
  34. package/button/lib/text-button.js.map +1 -1
  35. package/button/lib/text-styles.css.js +1 -1
  36. package/button/lib/text-styles.css.js.map +1 -1
  37. package/button/lib/tonal-button.d.ts +6 -4
  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.scss +48 -47
  42. package/checkbox/lib/checkbox-styles.css.js +1 -1
  43. package/checkbox/lib/checkbox-styles.css.js.map +1 -1
  44. package/checkbox/lib/checkbox.d.ts +2 -6
  45. package/checkbox/lib/checkbox.js +3 -20
  46. package/checkbox/lib/checkbox.js.map +1 -1
  47. package/checkbox/lib/forced-colors-styles.css.js +1 -1
  48. package/checkbox/lib/forced-colors-styles.css.js.map +1 -1
  49. package/chips/assist-chip.js +2 -1
  50. package/chips/assist-chip.js.map +1 -1
  51. package/chips/filter-chip.js +2 -1
  52. package/chips/filter-chip.js.map +1 -1
  53. package/chips/lib/_assist-chip.scss +37 -3
  54. package/chips/lib/_elevated.scss +60 -0
  55. package/chips/lib/_filter-chip.scss +43 -9
  56. package/chips/lib/_shared.scss +36 -76
  57. package/chips/lib/_suggestion-chip.scss +36 -5
  58. package/chips/lib/assist-chip.d.ts +12 -0
  59. package/chips/lib/assist-chip.js +64 -0
  60. package/chips/lib/assist-chip.js.map +1 -1
  61. package/chips/lib/assist-styles.css.js +1 -1
  62. package/chips/lib/assist-styles.css.js.map +1 -1
  63. package/chips/lib/chip.d.ts +19 -16
  64. package/chips/lib/chip.js +43 -63
  65. package/chips/lib/chip.js.map +1 -1
  66. package/chips/lib/elevated-styles.css.d.ts +1 -0
  67. package/chips/lib/elevated-styles.css.js +9 -0
  68. package/chips/lib/elevated-styles.css.js.map +1 -0
  69. package/chips/lib/elevated-styles.scss +10 -0
  70. package/chips/lib/filter-chip.d.ts +6 -1
  71. package/chips/lib/filter-chip.js +38 -5
  72. package/chips/lib/filter-chip.js.map +1 -1
  73. package/chips/lib/filter-styles.css.js +1 -1
  74. package/chips/lib/filter-styles.css.js.map +1 -1
  75. package/chips/lib/shared-styles.css.js +1 -1
  76. package/chips/lib/shared-styles.css.js.map +1 -1
  77. package/chips/lib/suggestion-chip.d.ts +2 -2
  78. package/chips/lib/suggestion-chip.js +4 -2
  79. package/chips/lib/suggestion-chip.js.map +1 -1
  80. package/chips/lib/suggestion-styles.css.js +1 -1
  81. package/chips/lib/suggestion-styles.css.js.map +1 -1
  82. package/chips/suggestion-chip.js +2 -1
  83. package/chips/suggestion-chip.js.map +1 -1
  84. package/circularprogress/lib/_circular-progress.scss +13 -7
  85. package/circularprogress/lib/circular-progress-styles.css.js +1 -1
  86. package/circularprogress/lib/circular-progress-styles.css.js.map +1 -1
  87. package/circularprogress/lib/circular-progress.d.ts +5 -6
  88. package/circularprogress/lib/circular-progress.js +1 -2
  89. package/circularprogress/lib/circular-progress.js.map +1 -1
  90. package/dialog/lib/_dialog.scss +0 -1
  91. package/dialog/lib/_tokens.scss +0 -1
  92. package/dialog/lib/dialog.d.ts +10 -10
  93. package/dialog/lib/dialog.js +8 -7
  94. package/dialog/lib/dialog.js.map +1 -1
  95. package/elevation/lib/elevation.d.ts +1 -1
  96. package/elevation/lib/elevation.js.map +1 -1
  97. package/fab/branded-fab.d.ts +3 -0
  98. package/fab/lib/_fab-branded.scss +58 -4
  99. package/fab/lib/_fab.scss +80 -6
  100. package/fab/lib/_shared.scss +8 -3
  101. package/fab/lib/fab-branded-styles.css.js +1 -1
  102. package/fab/lib/fab-branded-styles.css.js.map +1 -1
  103. package/fab/lib/fab-styles.css.js +1 -1
  104. package/fab/lib/fab-styles.css.js.map +1 -1
  105. package/fab/lib/fab.d.ts +4 -0
  106. package/fab/lib/forced-colors-styles.css.js +1 -1
  107. package/fab/lib/forced-colors-styles.css.js.map +1 -1
  108. package/fab/lib/shared-styles.css.js +1 -1
  109. package/fab/lib/shared-styles.css.js.map +1 -1
  110. package/fab/lib/shared.d.ts +12 -15
  111. package/fab/lib/shared.js +2 -26
  112. package/fab/lib/shared.js.map +1 -1
  113. package/field/lib/_filled-field.scss +47 -12
  114. package/field/lib/_outlined-field.scss +39 -12
  115. package/field/lib/filled-styles.css.js +1 -1
  116. package/field/lib/filled-styles.css.js.map +1 -1
  117. package/field/lib/outlined-styles.css.js +1 -1
  118. package/field/lib/outlined-styles.css.js.map +1 -1
  119. package/focus/focus-ring.d.ts +2 -0
  120. package/focus/focus-ring.js +2 -0
  121. package/focus/focus-ring.js.map +1 -1
  122. package/focus/lib/_focus-ring.scss +49 -34
  123. package/focus/lib/focus-ring-styles.css.js +1 -1
  124. package/focus/lib/focus-ring-styles.css.js.map +1 -1
  125. package/focus/lib/focus-ring.d.ts +59 -12
  126. package/focus/lib/focus-ring.js +116 -11
  127. package/focus/lib/focus-ring.js.map +1 -1
  128. package/iconbutton/filled-icon-button.d.ts +6 -2
  129. package/iconbutton/filled-icon-button.js.map +1 -1
  130. package/iconbutton/filled-tonal-icon-button.d.ts +6 -2
  131. package/iconbutton/filled-tonal-icon-button.js.map +1 -1
  132. package/iconbutton/harness.d.ts +1 -1
  133. package/iconbutton/harness.js +4 -1
  134. package/iconbutton/harness.js.map +1 -1
  135. package/iconbutton/lib/_filled-icon-button.scss +38 -13
  136. package/iconbutton/lib/_filled-tonal-icon-button.scss +38 -11
  137. package/iconbutton/lib/_outlined-icon-button.scss +38 -13
  138. package/iconbutton/lib/_shared.scss +4 -6
  139. package/iconbutton/lib/_standard-icon-button.scss +14 -14
  140. package/iconbutton/lib/filled-styles.css.js +1 -1
  141. package/iconbutton/lib/filled-styles.css.js.map +1 -1
  142. package/iconbutton/lib/filled-tonal-styles.css.js +1 -1
  143. package/iconbutton/lib/filled-tonal-styles.css.js.map +1 -1
  144. package/iconbutton/lib/icon-button.d.ts +17 -21
  145. package/iconbutton/lib/icon-button.js +12 -28
  146. package/iconbutton/lib/icon-button.js.map +1 -1
  147. package/iconbutton/lib/outlined-styles.css.js +1 -1
  148. package/iconbutton/lib/outlined-styles.css.js.map +1 -1
  149. package/iconbutton/lib/shared-styles.css.js +1 -1
  150. package/iconbutton/lib/shared-styles.css.js.map +1 -1
  151. package/iconbutton/lib/standard-styles.css.js +1 -1
  152. package/iconbutton/lib/standard-styles.css.js.map +1 -1
  153. package/iconbutton/outlined-icon-button.d.ts +5 -2
  154. package/iconbutton/outlined-icon-button.js.map +1 -1
  155. package/iconbutton/standard-icon-button.d.ts +5 -2
  156. package/iconbutton/standard-icon-button.js.map +1 -1
  157. package/linearprogress/lib/_linear-progress.scss +78 -72
  158. package/linearprogress/lib/linear-progress.d.ts +5 -5
  159. package/linearprogress/lib/linear-progress.js +1 -1
  160. package/linearprogress/lib/linear-progress.js.map +1 -1
  161. package/list/lib/_list.scss +4 -2
  162. package/list/lib/list.d.ts +7 -12
  163. package/list/lib/list.js +2 -11
  164. package/list/lib/list.js.map +1 -1
  165. package/list/lib/listitem/_list-item.scss +8 -4
  166. package/list/lib/listitem/list-item-styles.css.js +1 -1
  167. package/list/lib/listitem/list-item-styles.css.js.map +1 -1
  168. package/list/lib/listitem/list-item.d.ts +27 -27
  169. package/list/lib/listitem/list-item.js +4 -29
  170. package/list/lib/listitem/list-item.js.map +1 -1
  171. package/list/lib/listitemlink/list-item-link.js +1 -3
  172. package/list/lib/listitemlink/list-item-link.js.map +1 -1
  173. package/menu/lib/_menu.scss +4 -2
  174. package/menu/lib/menu-styles.css.js +1 -1
  175. package/menu/lib/menu-styles.css.js.map +1 -1
  176. package/menu/lib/menu.d.ts +31 -39
  177. package/menu/lib/menu.js +14 -20
  178. package/menu/lib/menu.js.map +1 -1
  179. package/menu/lib/menuitem/_menu-item.scss +4 -2
  180. package/menu/lib/shared.d.ts +14 -0
  181. package/menu/lib/shared.js +18 -0
  182. package/menu/lib/shared.js.map +1 -1
  183. package/menu/lib/submenuitem/sub-menu-item.d.ts +16 -11
  184. package/menu/lib/submenuitem/sub-menu-item.js +20 -3
  185. package/menu/lib/submenuitem/sub-menu-item.js.map +1 -1
  186. package/menu/lib/typeaheadController.d.ts +9 -9
  187. package/menu/lib/typeaheadController.js.map +1 -1
  188. package/navigationbar/lib/navigation-bar.d.ts +2 -2
  189. package/navigationbar/lib/navigation-bar.js.map +1 -1
  190. package/navigationdrawer/lib/_navigation-drawer-modal.scss +0 -3
  191. package/navigationdrawer/lib/_navigation-drawer.scss +0 -3
  192. package/navigationdrawer/lib/_shared.scss +1 -4
  193. package/navigationdrawer/lib/navigation-drawer-modal-styles.css.js +1 -1
  194. package/navigationdrawer/lib/navigation-drawer-modal-styles.css.js.map +1 -1
  195. package/navigationdrawer/lib/navigation-drawer-modal.d.ts +3 -3
  196. package/navigationdrawer/lib/navigation-drawer-modal.js.map +1 -1
  197. package/navigationdrawer/lib/navigation-drawer-styles.css.js +1 -1
  198. package/navigationdrawer/lib/navigation-drawer-styles.css.js.map +1 -1
  199. package/navigationdrawer/lib/navigation-drawer.d.ts +2 -2
  200. package/navigationdrawer/lib/navigation-drawer.js.map +1 -1
  201. package/navigationdrawer/lib/shared-styles.css.js +1 -1
  202. package/navigationdrawer/lib/shared-styles.css.js.map +1 -1
  203. package/navigationtab/lib/_navigation-tab.scss +2 -2
  204. package/navigationtab/lib/navigation-tab-styles.css.js +1 -1
  205. package/navigationtab/lib/navigation-tab-styles.css.js.map +1 -1
  206. package/navigationtab/lib/navigation-tab.d.ts +9 -17
  207. package/navigationtab/lib/navigation-tab.js +3 -22
  208. package/navigationtab/lib/navigation-tab.js.map +1 -1
  209. package/navigationtab/lib/state.d.ts +1 -1
  210. package/navigationtab/lib/state.js.map +1 -1
  211. package/package.json +1 -1
  212. package/radio/lib/_radio.scss +1 -1
  213. package/radio/lib/radio-styles.css.js +1 -1
  214. package/radio/lib/radio-styles.css.js.map +1 -1
  215. package/radio/lib/radio.d.ts +2 -7
  216. package/radio/lib/radio.js +2 -22
  217. package/radio/lib/radio.js.map +1 -1
  218. package/ripple/lib/ripple.js +4 -0
  219. package/ripple/lib/ripple.js.map +1 -1
  220. package/segmentedbutton/lib/segmented-button.d.ts +15 -21
  221. package/segmentedbutton/lib/segmented-button.js +3 -24
  222. package/segmentedbutton/lib/segmented-button.js.map +1 -1
  223. package/segmentedbuttonset/lib/_outlined-segmented-button-set.scss +32 -13
  224. package/segmentedbuttonset/lib/outlined-styles.css.js +1 -1
  225. package/segmentedbuttonset/lib/outlined-styles.css.js.map +1 -1
  226. package/segmentedbuttonset/lib/segmented-button-set.d.ts +1 -1
  227. package/segmentedbuttonset/lib/segmented-button-set.js.map +1 -1
  228. package/select/lib/_filled-select.scss +66 -7
  229. package/select/lib/_outlined-select.scss +41 -7
  230. package/select/lib/filled-select-styles.css.js +1 -1
  231. package/select/lib/filled-select-styles.css.js.map +1 -1
  232. package/select/lib/outlined-select-styles.css.js +1 -1
  233. package/select/lib/outlined-select-styles.css.js.map +1 -1
  234. package/select/lib/select.d.ts +46 -48
  235. package/select/lib/select.js +21 -19
  236. package/select/lib/select.js.map +1 -1
  237. package/slider/harness.d.ts +1 -1
  238. package/slider/harness.js +9 -9
  239. package/slider/harness.js.map +1 -1
  240. package/slider/lib/_slider.scss +6 -6
  241. package/slider/lib/slider-styles.css.js +1 -1
  242. package/slider/lib/slider-styles.css.js.map +1 -1
  243. package/slider/lib/slider.d.ts +22 -51
  244. package/slider/lib/slider.js +18 -54
  245. package/slider/lib/slider.js.map +1 -1
  246. package/switch/lib/_switch.scss +63 -18
  247. package/switch/lib/switch-styles.css.js +1 -1
  248. package/switch/lib/switch-styles.css.js.map +1 -1
  249. package/switch/lib/switch.d.ts +0 -5
  250. package/switch/lib/switch.js +2 -27
  251. package/switch/lib/switch.js.map +1 -1
  252. package/textfield/harness.d.ts +1 -1
  253. package/textfield/harness.js.map +1 -1
  254. package/textfield/lib/_filled-text-field.scss +70 -14
  255. package/textfield/lib/_outlined-text-field.scss +60 -35
  256. package/textfield/lib/filled-forced-colors-styles.css.js +1 -1
  257. package/textfield/lib/filled-forced-colors-styles.css.js.map +1 -1
  258. package/textfield/lib/filled-styles.css.js +1 -1
  259. package/textfield/lib/filled-styles.css.js.map +1 -1
  260. package/textfield/lib/outlined-forced-colors-styles.css.js +1 -1
  261. package/textfield/lib/outlined-forced-colors-styles.css.js.map +1 -1
  262. package/textfield/lib/outlined-styles.css.js +1 -1
  263. package/textfield/lib/outlined-styles.css.js.map +1 -1
  264. package/textfield/lib/text-field.d.ts +1 -1
  265. package/textfield/lib/text-field.js.map +1 -1
  266. package/tokens/_index.scss +2 -18
  267. package/tokens/_md-comp-assist-chip.scss +0 -9
  268. package/tokens/_md-comp-checkbox.scss +78 -1
  269. package/tokens/_md-comp-circular-progress-indicator.scss +39 -13
  270. package/tokens/_md-comp-elevated-button.scss +0 -10
  271. package/tokens/_md-comp-fab-branded.scss +6 -31
  272. package/tokens/_md-comp-fab.scss +9 -50
  273. package/tokens/_md-comp-filled-button.scss +0 -10
  274. package/{field/lib → tokens}/_md-comp-filled-field.scss +91 -9
  275. package/tokens/_md-comp-filled-icon-button.scss +46 -1
  276. package/tokens/_md-comp-filled-select.scss +4 -30
  277. package/tokens/_md-comp-filled-text-field.scss +93 -9
  278. package/tokens/_md-comp-filled-tonal-button.scss +0 -11
  279. package/tokens/_md-comp-filled-tonal-icon-button.scss +45 -3
  280. package/tokens/_md-comp-filter-chip.scss +0 -10
  281. package/tokens/_md-comp-focus-ring.scss +23 -24
  282. package/tokens/_md-comp-icon-button.scss +37 -1
  283. package/tokens/_md-comp-input-chip.scss +0 -10
  284. package/tokens/_md-comp-linear-progress-indicator.scss +23 -8
  285. package/tokens/_md-comp-list-item.scss +0 -27
  286. package/tokens/_md-comp-list.scss +3 -29
  287. package/tokens/_md-comp-menu-item.scss +3 -29
  288. package/tokens/_md-comp-menu.scss +0 -23
  289. package/tokens/_md-comp-outlined-button.scss +0 -10
  290. package/{field/lib → tokens}/_md-comp-outlined-field.scss +85 -9
  291. package/tokens/_md-comp-outlined-icon-button.scss +41 -1
  292. package/tokens/_md-comp-outlined-segmented-button.scss +57 -11
  293. package/tokens/_md-comp-outlined-select.scss +1 -28
  294. package/tokens/_md-comp-outlined-text-field.scss +85 -8
  295. package/tokens/_md-comp-suggestion-chip.scss +0 -9
  296. package/tokens/_md-comp-switch.scss +81 -1
  297. package/tokens/_md-comp-text-button.scss +0 -10
  298. package/tokens/_values.scss +2 -7
  299. package/types/aria.d.ts +0 -2
  300. package/focus/strong-focus.d.ts +0 -56
  301. package/focus/strong-focus.js +0 -101
  302. package/focus/strong-focus.js.map +0 -1
  303. package/sass/_shape.scss +0 -154
  304. package/tokens/_md-comp-extended-fab-branded.scss +0 -45
  305. package/tokens/_md-comp-extended-fab-primary.scss +0 -45
  306. package/tokens/_md-comp-extended-fab-secondary.scss +0 -48
  307. package/tokens/_md-comp-extended-fab-surface.scss +0 -45
  308. package/tokens/_md-comp-extended-fab-tertiary.scss +0 -48
  309. package/tokens/_md-comp-fab-branded-large.scss +0 -23
  310. package/tokens/_md-comp-fab-primary-large.scss +0 -23
  311. package/tokens/_md-comp-fab-primary-small.scss +0 -23
  312. package/tokens/_md-comp-fab-primary.scss +0 -23
  313. package/tokens/_md-comp-fab-secondary-large.scss +0 -23
  314. package/tokens/_md-comp-fab-secondary-small.scss +0 -23
  315. package/tokens/_md-comp-fab-secondary.scss +0 -23
  316. package/tokens/_md-comp-fab-surface-large.scss +0 -23
  317. package/tokens/_md-comp-fab-surface-small.scss +0 -23
  318. package/tokens/_md-comp-fab-surface.scss +0 -23
  319. package/tokens/_md-comp-fab-tertiary-large.scss +0 -23
  320. package/tokens/_md-comp-fab-tertiary-small.scss +0 -23
  321. package/tokens/_md-comp-fab-tertiary.scss +0 -23
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,2BAA2B,CAAC;AACnC,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACxD,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OA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QAAQ,CAAC,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC;0CACO;AAErC;IAAR,KAAK,EAAE;6CAAkC;AAgL1C;IADC,YAAY,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;6CAG7B","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../list/list.js';\nimport '../../focus/focus-ring.js';\nimport '../../elevation/elevation.js';\n\nimport {html, isServer, LitElement, nothing} 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 {requestUpdateOnAriaChange} from '../../aria/delegate.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 {ARIAMixinStrict, 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 static {\n requestUpdateOnAriaChange(this);\n }\n\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 /**\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 @property() type: ARIARole = 'menu';\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({attribute: 'anchor-corner'}) 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({attribute: 'menu-corner'}) 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({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.renderElevation()}\n ${this.renderList()}\n ${this.renderFocusRing()}\n </div>\n `;\n }\n\n /**\n * Renders the List element and its items\n */\n protected renderList() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <md-list\n aria-label=${ariaLabel || nothing}\n type=${this.type}\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 item.selected = 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,OAAO,oBAAoB,CAAC;AAC5B,OAAO,2BAA2B,CAAC;AACnC,O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,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAC,CAAC;8CAClC;AAKzB;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC;0CACO;AAErC;IAAR,KAAK,EAAE;6CAAgC;AAwKxC;IADC,YAAY,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;6CAG7B","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../list/list.js';\nimport '../../focus/focus-ring.js';\nimport '../../elevation/elevation.js';\n\nimport {html, isServer, LitElement, nothing} 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 {requestUpdateOnAriaChange} from '../../aria/delegate.js';\nimport {List} from '../../list/lib/list.js';\nimport {createAnimationSignal, EASING} from '../../motion/animation.js';\nimport {ARIAMixinStrict, 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 static {\n requestUpdateOnAriaChange(this);\n }\n\n @query('md-list') private readonly listElement!: List|null;\n @query('.menu') private readonly surfaceEl!: HTMLElement|null;\n @query('slot') private readonly slotEl!: HTMLSlotElement|null;\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 @property() type: ARIARole = 'menu';\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({attribute: 'anchor-corner'}) 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({attribute: 'menu-corner'}) 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({attribute: 'default-focus'})\n defaultFocus: DefaultFocusState = 'LIST_ROOT';\n\n @state() private typeaheadActive = true;\n\n private readonly 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 private 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 private 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 private readonly menuPositionController =\n 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 protected override render() {\n return this.renderSurface();\n }\n\n /**\n * Renders the positionable surface element and its contents.\n */\n private 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.renderElevation()}\n ${this.renderList()}\n ${this.renderFocusRing()}\n </div>\n `;\n }\n\n /**\n * Renders the List element and its items\n */\n private renderList() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <md-list\n id=\"list\"\n aria-label=${ariaLabel || nothing}\n type=${this.type}\n listTabIndex=${this.listTabIndex}\n @keydown=${this.handleListKeydown}>\n ${this.renderMenuItems()}\n </md-list>`;\n }\n\n /**\n * Renders the menu items' slot\n */\n private 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}\n @stay-open-on-focusout=${this.handleStayOpenOnFocusout}\n @close-on-focusout=${this.handleCloseOnFocusout}></slot>`;\n }\n\n /**\n * Renders the elevation component.\n */\n private renderElevation() {\n return html`<md-elevation></md-elevation>`;\n }\n\n /**\n * Renders the focus ring component.\n */\n private renderFocusRing() {\n return html`<md-focus-ring for=\"list\"></md-focus-ring>`;\n }\n\n private getSurfaceClasses() {\n return {\n open: this.open,\n fixed: this.fixed,\n 'has-overflow': this.hasOverflow,\n };\n }\n\n private 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 // 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 private handleListKeydown(e: KeyboardEvent) {\n this.typeaheadController.onKeydown(e);\n }\n\n /**\n * Saves the last focused element focuses the new element based on\n * `defaultFocus`, and animates open.\n */\n private readonly 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 private readonly 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 private readonly 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 private 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 private 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 private readonly onWindowClick = (e: MouseEvent) => {\n if (!this.stayOpenOnOutsideClick && !e.composedPath().includes(this)) {\n this.open = false;\n }\n };\n\n private onCloseMenu() {\n this.close();\n }\n\n private onDeactivateItems(e: Event) {\n e.stopPropagation();\n const items = this.items;\n for (const item of items) {\n item.active = false;\n item.selected = false;\n }\n }\n\n private 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 private 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 private handleStayOpenOnFocusout(e:Event) {\n e.stopPropagation();\n this.stayOpenOnFocusout = true;\n }\n\n private handleCloseOnFocusout(e:Event) {\n e.stopPropagation();\n this.stayOpenOnFocusout = false;\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"]}
@@ -19,7 +19,9 @@
19
19
  $tokens: theme.validate-theme(tokens.md-comp-menu-item-values(), $tokens);
20
20
 
21
21
  @each $token, $value in $tokens {
22
- --md-menu-item-#{$token}: #{$value};
22
+ @if $value {
23
+ --md-menu-item-#{$token}: #{$value};
24
+ }
23
25
  }
24
26
  }
25
27
 
@@ -28,7 +30,7 @@
28
30
 
29
31
  :host {
30
32
  @each $token, $value in $tokens {
31
- --_#{$token}: #{$value};
33
+ --_#{$token}: var(--md-menu-item-#{$token}, #{$value});
32
34
  }
33
35
 
34
36
  @include list-item.theme(
@@ -72,6 +72,20 @@ export declare class CloseMenuEvent<T extends Reason = DefaultReasons> extends E
72
72
  readonly itemPath: MenuItem[];
73
73
  constructor(initiator: MenuItem, reason: T);
74
74
  }
75
+ /**
76
+ * The event that signals to the menu that it should stay open on the focusout
77
+ * event.
78
+ */
79
+ export declare class StayOpenOnFocusoutEvent extends Event {
80
+ constructor();
81
+ }
82
+ /**
83
+ * The event that signals to the menu that it should close open on the focusout
84
+ * event.
85
+ */
86
+ export declare class CloseOnFocusoutEvent extends Event {
87
+ constructor();
88
+ }
75
89
  /**
76
90
  * The default close menu event used by md-menu. To create your own `close-menu`
77
91
  * event, you should subclass the `CloseMenuEvent` instead.
@@ -15,6 +15,24 @@ export class CloseMenuEvent extends Event {
15
15
  this.itemPath = [initiator];
16
16
  }
17
17
  }
18
+ /**
19
+ * The event that signals to the menu that it should stay open on the focusout
20
+ * event.
21
+ */
22
+ export class StayOpenOnFocusoutEvent extends Event {
23
+ constructor() {
24
+ super('stay-open-on-focusout', { bubbles: true, composed: true });
25
+ }
26
+ }
27
+ /**
28
+ * The event that signals to the menu that it should close open on the focusout
29
+ * event.
30
+ */
31
+ export class CloseOnFocusoutEvent extends Event {
32
+ constructor() {
33
+ super('close-on-focusout', { bubbles: true, composed: true });
34
+ }
35
+ }
18
36
  /**
19
37
  * The default close menu event used by md-menu. To create your own `close-menu`
20
38
  * event, you should subclass the `CloseMenuEvent` instead.
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoEH;;;GAGG;AACH,MAAM,OAAO,cAAkD,SAAQ,KAAK;IAE1E,YAAmB,SAAmB,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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 the currently active item of interest (focuses\n * upon activation).\n */\n active: boolean;\n /**\n * Whether or not the item is in the selected visual state.\n */\n selected?: 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"]}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoEH;;;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,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD;QACE,KAAK,CAAC,uBAAuB,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;IAClE,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C;QACE,KAAK,CAAC,mBAAmB,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;IAC9D,CAAC;CACF;AAED;;;GAGG;AACH,2BAA2B;AAC3B,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAA,cAA8B,CAAA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I,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 the currently active item of interest (focuses\n * upon activation).\n */\n active: boolean;\n /**\n * Whether or not the item is in the selected visual state.\n */\n selected?: 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 event that signals to the menu that it should stay open on the focusout\n * event.\n */\nexport class StayOpenOnFocusoutEvent extends Event {\n constructor() {\n super('stay-open-on-focusout', {bubbles: true, composed: true});\n }\n}\n\n/**\n * The event that signals to the menu that it should close open on the focusout\n * event.\n */\nexport class CloseOnFocusoutEvent extends Event {\n constructor() {\n super('close-on-focusout', {bubbles: true, composed: true});\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"]}
@@ -3,9 +3,8 @@
3
3
  * Copyright 2023 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { Corner, Menu } from '../menu.js';
6
+ import { Corner } from '../menu.js';
7
7
  import { MenuItemEl } from '../menuitem/menu-item.js';
8
- import { CloseMenuEvent } from '../shared.js';
9
8
  /**
10
9
  * @fires deactivate-items {DeactivateItemsEvent} Requests the parent menu to
11
10
  * deselect other items when a submenu opens
@@ -13,6 +12,12 @@ import { CloseMenuEvent } from '../shared.js';
13
12
  * to deactivate the typeahead functionality when a submenu opens
14
13
  * @fires activate-typeahead {DeactivateItemsEvent} Requests the parent menu to
15
14
  * activate the typeahead functionality when a submenu closes
15
+ * @fires stay-open-on-focusout {StayOpenOnFocusoutEvent} Requests the parent
16
+ * menu to stay open when focusout event is fired or has a `null`
17
+ * `relatedTarget` when submenu is opened.
18
+ * @fires close-on-focusout {CloseOnFocusoutEvent} Requests the parent
19
+ * menu to close when focusout event is fired or has a `null`
20
+ * `relatedTarget` When submenu is closed.
16
21
  */
17
22
  export declare class SubMenuItem extends MenuItemEl {
18
23
  /**
@@ -35,11 +40,11 @@ export declare class SubMenuItem extends MenuItemEl {
35
40
  * Sets the item in the selected visual state when a submenu is opened.
36
41
  */
37
42
  selected: boolean;
38
- protected menus: Menu[];
43
+ private readonly menus;
39
44
  protected keepOpenOnClick: boolean;
40
- protected previousOpenTimeout: number;
41
- protected previousCloseTimeout: number;
42
- protected get submenuEl(): Menu | undefined;
45
+ private previousOpenTimeout;
46
+ private previousCloseTimeout;
47
+ private get submenuEl();
43
48
  /**
44
49
  * Starts the default 400ms countdown to open the submenu.
45
50
  */
@@ -60,9 +65,9 @@ export declare class SubMenuItem extends MenuItemEl {
60
65
  /**
61
66
  * Renders the slot for the submenu.
62
67
  */
63
- protected renderSubMenu(): import("lit-html").TemplateResult<1>;
64
- protected onCloseSubmenu(e: CloseMenuEvent): void;
65
- protected onSubMenuKeydown(e: KeyboardEvent): Promise<void>;
68
+ private renderSubMenu;
69
+ private onCloseSubmenu;
70
+ private onSubMenuKeydown;
66
71
  /**
67
72
  * Shows the submenu.
68
73
  *
@@ -82,7 +87,7 @@ export declare class SubMenuItem extends MenuItemEl {
82
87
  * @param code The native KeyboardEvent code.
83
88
  * @return Whether or not the key code should open the submenu.
84
89
  */
85
- protected isSubmenuOpenKey(code: string): boolean;
90
+ private isSubmenuOpenKey;
86
91
  /**
87
92
  * Determines whether the given KeyboardEvent code is one that should close
88
93
  * the submenu. This is RTL-aware. By default right, left, or escape.
@@ -90,5 +95,5 @@ export declare class SubMenuItem extends MenuItemEl {
90
95
  * @param code The native KeyboardEvent code.
91
96
  * @return Whether or not the key code should close the submenu.
92
97
  */
93
- protected isSubmenuCloseKey(code: string): boolean;
98
+ private isSubmenuCloseKey;
94
99
  }
@@ -8,7 +8,7 @@ import { html } from 'lit';
8
8
  import { property, queryAssignedElements } from 'lit/decorators.js';
9
9
  import { List } from '../../../list/lib/list.js';
10
10
  import { MenuItemEl } from '../menuitem/menu-item.js';
11
- import { ActivateTypeaheadEvent, CLOSE_REASON, DeactivateItemsEvent, DeactivateTypeaheadEvent, KEYDOWN_CLOSE_KEYS, NAVIGABLE_KEY, SELECTION_KEY } from '../shared.js';
11
+ import { ActivateTypeaheadEvent, CLOSE_REASON, CloseOnFocusoutEvent, DeactivateItemsEvent, DeactivateTypeaheadEvent, KEYDOWN_CLOSE_KEYS, NAVIGABLE_KEY, SELECTION_KEY, StayOpenOnFocusoutEvent } from '../shared.js';
12
12
  function stopPropagation(e) {
13
13
  e.stopPropagation();
14
14
  }
@@ -19,6 +19,12 @@ function stopPropagation(e) {
19
19
  * to deactivate the typeahead functionality when a submenu opens
20
20
  * @fires activate-typeahead {DeactivateItemsEvent} Requests the parent menu to
21
21
  * activate the typeahead functionality when a submenu closes
22
+ * @fires stay-open-on-focusout {StayOpenOnFocusoutEvent} Requests the parent
23
+ * menu to stay open when focusout event is fired or has a `null`
24
+ * `relatedTarget` when submenu is opened.
25
+ * @fires close-on-focusout {CloseOnFocusoutEvent} Requests the parent
26
+ * menu to close when focusout event is fired or has a `null`
27
+ * `relatedTarget` When submenu is closed.
22
28
  */
23
29
  export class SubMenuItem extends MenuItemEl {
24
30
  constructor() {
@@ -134,6 +140,8 @@ export class SubMenuItem extends MenuItemEl {
134
140
  }
135
141
  onCloseSubmenu(e) {
136
142
  e.itemPath.push(this);
143
+ // Restore focusout behavior
144
+ this.dispatchEvent(new CloseOnFocusoutEvent());
137
145
  this.dispatchEvent(new ActivateTypeaheadEvent());
138
146
  // Escape should only close one menu not all of the menus unlike space or
139
147
  // click selection which should close all menus.
@@ -143,7 +151,7 @@ export class SubMenuItem extends MenuItemEl {
143
151
  this.active = true;
144
152
  this.selected = false;
145
153
  // It might already be active so manually focus
146
- this.listItemRoot.focus();
154
+ this.listItemRoot?.focus();
147
155
  return;
148
156
  }
149
157
  this.active = false;
@@ -159,7 +167,7 @@ export class SubMenuItem extends MenuItemEl {
159
167
  return;
160
168
  this.close(() => {
161
169
  List.deactivateActiveItem(this.submenuEl.items);
162
- this.listItemRoot.focus();
170
+ this.listItemRoot?.focus();
163
171
  this.active = true;
164
172
  });
165
173
  }
@@ -184,8 +192,15 @@ export class SubMenuItem extends MenuItemEl {
184
192
  // keyboard after hover.
185
193
  menu.defaultFocus = 'LIST_ROOT';
186
194
  menu.skipRestoreFocus = true;
195
+ menu.stayOpenOnOutsideClick = true;
196
+ menu.stayOpenOnFocusout = true;
187
197
  // Menu could already be opened because of mouse interaction
188
198
  const menuAlreadyOpen = menu.open;
199
+ // We want the parent to stay open in the case such that a middle submenu
200
+ // has a submenuitem hovered which opens a third submenut. Then if you hover
201
+ // on yet another middle menu-item (not submenuitem) then focusout Event's
202
+ // relatedTarget will be `null` thus, causing all the menus to close
203
+ this.dispatchEvent(new StayOpenOnFocusoutEvent());
189
204
  menu.show();
190
205
  // Deactivate other items. This can be the case if the user has tabbed
191
206
  // around the menu and then mouses over an md-sub-menu.
@@ -213,6 +228,8 @@ export class SubMenuItem extends MenuItemEl {
213
228
  this.dispatchEvent(new ActivateTypeaheadEvent());
214
229
  menu.quick = true;
215
230
  menu.close();
231
+ // Restore focusout behavior.
232
+ this.dispatchEvent(new CloseOnFocusoutEvent());
216
233
  this.active = false;
217
234
  this.selected = false;
218
235
  menu.addEventListener('closed', onClosed, { once: true });
@@ -1 +1 @@
1
- {"version":3,"file":"sub-menu-item.js","sourceRoot":"","sources":["sub-menu-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAElE,OAAO,EAAC,IAAI,EAAC,MAAM,2BAA2B,CAAC;AAE/C,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,sBAAsB,EAAE,YAAY,EAAkB,oBAAoB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,aAAa,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAEpL,SAAS,eAAe,CAAC,CAAQ;IAC/B,CAAC,CAAC,eAAe,EAAE,CAAC;AACtB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,WAAY,SAAQ,UAAU;IAA3C;;QACE;;WAEG;QACqC,iBAAY,GAAW,WAAW,CAAC;QAC3E;;WAEG;QACmC,eAAU,GAAW,aAAa,CAAC;QACzE;;WAEG;QACsD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,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CAAkB;AAG3D;IADC,qBAAqB,CAAC,EAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0CAC/B","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html} from 'lit';\nimport {property, queryAssignedElements} from 'lit/decorators.js';\n\nimport {List} from '../../../list/lib/list.js';\nimport {Corner, Menu} from '../menu.js';\nimport {MenuItemEl} from '../menuitem/menu-item.js';\nimport {ActivateTypeaheadEvent, CLOSE_REASON, CloseMenuEvent, DeactivateItemsEvent, DeactivateTypeaheadEvent, KEYDOWN_CLOSE_KEYS, NAVIGABLE_KEY, SELECTION_KEY} from '../shared.js';\n\nfunction stopPropagation(e: Event) {\n e.stopPropagation();\n}\n\n/**\n * @fires deactivate-items {DeactivateItemsEvent} Requests the parent menu to\n * deselect other items when a submenu opens\n * @fires deactivate-typeahead {DeactivateItemsEvent} Requests the parent menu\n * to deactivate the typeahead functionality when a submenu opens\n * @fires activate-typeahead {DeactivateItemsEvent} Requests the parent menu to\n * activate the typeahead functionality when a submenu closes\n */\nexport class SubMenuItem extends MenuItemEl {\n /**\n * The anchorCorner to set on the submenu.\n */\n @property({attribute: 'anchor-corner'}) anchorCorner: Corner = 'START_END';\n /**\n * The menuCorner to set on the submenu.\n */\n @property({attribute: 'menu-corner'}) menuCorner: Corner = 'START_START';\n /**\n * The delay between pointerenter and submenu opening.\n */\n @property({type: Number, attribute: 'hover-open-delay'}) hoverOpenDelay = 400;\n /**\n * The delay between ponterleave and the submenu closing.\n */\n @property({type: Number, attribute: 'hover-close-delay'})\n hoverCloseDelay = 400;\n /**\n * Sets the item in the selected visual state when a submenu is opened.\n */\n @property({type: Boolean, reflect: true}) selected = false;\n\n @queryAssignedElements({slot: 'submenu', flatten: true})\n protected menus!: Menu[];\n\n protected override keepOpenOnClick = true;\n protected previousOpenTimeout = 0;\n protected previousCloseTimeout = 0;\n\n protected get submenuEl(): Menu|undefined {\n return this.menus[0];\n }\n\n /**\n * Starts the default 400ms countdown to open the submenu.\n */\n protected override onPointerenter = () => {\n clearTimeout(this.previousOpenTimeout);\n clearTimeout(this.previousCloseTimeout);\n if (this.submenuEl?.open) return;\n\n // Open synchronously if delay is 0. (screenshot tests infra\n // would never resolve otherwise)\n if (!this.hoverOpenDelay) {\n this.show();\n } else {\n this.previousOpenTimeout = setTimeout(() => {\n this.show();\n }, this.hoverOpenDelay);\n }\n };\n\n /**\n * Starts the default 400ms countdown to close the submenu.\n */\n protected override onPointerleave = () => {\n clearTimeout(this.previousCloseTimeout);\n clearTimeout(this.previousOpenTimeout);\n\n // Close synchronously if delay is 0. (screenshot tests infra\n // would never resolve otherwise)\n if (!this.hoverCloseDelay) {\n this.close();\n } else {\n this.previousCloseTimeout = setTimeout(() => {\n this.close();\n }, this.hoverCloseDelay);\n }\n };\n\n protected override onClick() {\n this.show();\n }\n\n /**\n * On item keydown handles opening the submenu.\n */\n protected override onKeydown(e: KeyboardEvent) {\n const shouldOpenSubmenu = this.isSubmenuOpenKey(e.code);\n\n if (e.code === SELECTION_KEY.SPACE) {\n // prevent space from scrolling. Only open the submenu.\n e.preventDefault();\n }\n\n if (!shouldOpenSubmenu) {\n super.onKeydown(e);\n return;\n }\n\n const submenu = this.submenuEl;\n if (!submenu) return;\n\n const submenuItems = submenu.items;\n const firstActivatableItem = List.getFirstActivatableItem(submenuItems);\n\n if (firstActivatableItem) {\n this.show(() => {\n firstActivatableItem.active = true;\n });\n\n return;\n }\n }\n\n /**\n * Render the submenu at the end\n */\n protected override renderEnd() {\n return html`${super.renderEnd()}${this.renderSubMenu()}`;\n }\n\n /**\n * Renders the slot for the submenu.\n */\n protected renderSubMenu() {\n return html`<span class=\"submenu\"><slot\n name=\"submenu\"\n @pointerdown=${stopPropagation}\n @click=${stopPropagation}\n @keydown=${this.onSubMenuKeydown}\n @close-menu=${this.onCloseSubmenu}\n ></slot></span>`;\n }\n\n protected onCloseSubmenu(e: CloseMenuEvent) {\n e.itemPath.push(this);\n this.dispatchEvent(new ActivateTypeaheadEvent());\n // Escape should only close one menu not all of the menus unlike space or\n // click selection which should close all menus.\n if (e.reason.kind === CLOSE_REASON.KEYDOWN &&\n e.reason.key === KEYDOWN_CLOSE_KEYS.ESCAPE) {\n e.stopPropagation();\n this.active = true;\n this.selected = false;\n // It might already be active so manually focus\n this.listItemRoot.focus();\n return;\n }\n\n this.active = false;\n this.selected = false;\n }\n\n protected async onSubMenuKeydown(e: KeyboardEvent) {\n // Stop propagation so that we don't accidentally close every parent menu.\n // Additionally, we want to isolate things like the typeahead keydowns\n // from bubbling up to the parent menu and confounding things.\n e.stopPropagation();\n const shouldClose = this.isSubmenuCloseKey(e.code);\n\n if (!shouldClose) return;\n\n this.close(() => {\n List.deactivateActiveItem(this.submenuEl!.items);\n this.listItemRoot.focus();\n this.active = true;\n });\n }\n\n /**\n * Shows the submenu.\n *\n * @param onOpened A function to call after the menu is opened.\n */\n show(onOpened = () => {}) {\n const menu = this.submenuEl;\n if (!menu) return;\n\n menu.quick = true;\n // Submenus are in overflow when not fixed. Can remove once we have native\n // popup support\n menu.hasOverflow = true;\n menu.anchorCorner = this.anchorCorner;\n menu.menuCorner = this.menuCorner;\n menu.anchor = this;\n // We manually set focus with `active` on keyboard navigation. And we\n // want to focus the root on hover, so the user can pick up navigation with\n // keyboard after hover.\n menu.defaultFocus = 'LIST_ROOT';\n menu.skipRestoreFocus = true;\n\n // Menu could already be opened because of mouse interaction\n const menuAlreadyOpen = menu.open;\n menu.show();\n\n // Deactivate other items. This can be the case if the user has tabbed\n // around the menu and then mouses over an md-sub-menu.\n this.dispatchEvent(new DeactivateItemsEvent());\n this.dispatchEvent(new DeactivateTypeaheadEvent());\n this.selected = true;\n\n // This is the case of mouse hovering when already opened via keyboard or\n // vice versa\n if (menuAlreadyOpen) {\n onOpened();\n } else {\n menu.addEventListener('opened', onOpened, {once: true});\n }\n }\n\n /**\n * Closes the submenu.\n *\n * @param onClosed A function to call after the menu is closed.\n */\n close(onClosed = () => {}) {\n const menu = this.submenuEl;\n if (!menu || !menu.open) return;\n\n this.dispatchEvent(new ActivateTypeaheadEvent());\n menu.quick = true;\n menu.close();\n this.active = false;\n this.selected = false;\n menu.addEventListener('closed', onClosed, {once: true});\n }\n\n /**\n * Determines whether the given KeyboardEvent code is one that should open\n * the submenu. This is RTL-aware. By default, left, right, space, or enter.\n *\n * @param code The native KeyboardEvent code.\n * @return Whether or not the key code should open the submenu.\n */\n protected isSubmenuOpenKey(code: string) {\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const arrowEnterKey = isRtl ? NAVIGABLE_KEY.LEFT : NAVIGABLE_KEY.RIGHT;\n switch (code) {\n case arrowEnterKey:\n case SELECTION_KEY.SPACE:\n case SELECTION_KEY.ENTER:\n return true;\n default:\n return false;\n }\n }\n\n /**\n * Determines whether the given KeyboardEvent code is one that should close\n * the submenu. This is RTL-aware. By default right, left, or escape.\n *\n * @param code The native KeyboardEvent code.\n * @return Whether or not the key code should close the submenu.\n */\n protected isSubmenuCloseKey(code: string) {\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const arrowEnterKey = isRtl ? NAVIGABLE_KEY.RIGHT : NAVIGABLE_KEY.LEFT;\n switch (code) {\n case arrowEnterKey:\n case KEYDOWN_CLOSE_KEYS.ESCAPE:\n return true;\n default:\n return false;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"sub-menu-item.js","sourceRoot":"","sources":["sub-menu-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAElE,OAAO,EAAC,IAAI,EAAC,MAAM,2BAA2B,CAAC;AAE/C,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,sBAAsB,EAAE,YAAY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AAiB,CAAC,IAAY;QACpC,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC;QACzD,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC;QACvE,QAAQ,IAAI,EAAE;YACZ,KAAK,aAAa,CAAC;YACnB,KAAK,kBAAkB,CAAC,MAAM;gBAC5B,OAAO,IAAI,CAAC;YACd;gBACE,OAAO,KAAK,CAAC;SAChB;IACH,CAAC;CACF;AAxQyC;IAAvC,QAAQ,CAAC,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC;iDAAoC;AAIrC;IAArC,QAAQ,CAAC,EAAC,SAAS,EAAE,aAAa,EAAC,CAAC;+CAAoC;AAIhB;IAAxD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAC,CAAC;mDAAsB;AAK9E;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAC,CAAC;oDACnC;AAIoB;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CAAkB;AAG3D;IADC,qBAAqB,CAAC,EAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0CACxB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html} from 'lit';\nimport {property, queryAssignedElements} from 'lit/decorators.js';\n\nimport {List} from '../../../list/lib/list.js';\nimport {Corner, Menu} from '../menu.js';\nimport {MenuItemEl} from '../menuitem/menu-item.js';\nimport {ActivateTypeaheadEvent, CLOSE_REASON, CloseMenuEvent, CloseOnFocusoutEvent, DeactivateItemsEvent, DeactivateTypeaheadEvent, KEYDOWN_CLOSE_KEYS, NAVIGABLE_KEY, SELECTION_KEY, StayOpenOnFocusoutEvent} from '../shared.js';\n\nfunction stopPropagation(e: Event) {\n e.stopPropagation();\n}\n\n/**\n * @fires deactivate-items {DeactivateItemsEvent} Requests the parent menu to\n * deselect other items when a submenu opens\n * @fires deactivate-typeahead {DeactivateItemsEvent} Requests the parent menu\n * to deactivate the typeahead functionality when a submenu opens\n * @fires activate-typeahead {DeactivateItemsEvent} Requests the parent menu to\n * activate the typeahead functionality when a submenu closes\n * @fires stay-open-on-focusout {StayOpenOnFocusoutEvent} Requests the parent\n * menu to stay open when focusout event is fired or has a `null`\n * `relatedTarget` when submenu is opened.\n * @fires close-on-focusout {CloseOnFocusoutEvent} Requests the parent\n * menu to close when focusout event is fired or has a `null`\n * `relatedTarget` When submenu is closed.\n */\nexport class SubMenuItem extends MenuItemEl {\n /**\n * The anchorCorner to set on the submenu.\n */\n @property({attribute: 'anchor-corner'}) anchorCorner: Corner = 'START_END';\n /**\n * The menuCorner to set on the submenu.\n */\n @property({attribute: 'menu-corner'}) menuCorner: Corner = 'START_START';\n /**\n * The delay between pointerenter and submenu opening.\n */\n @property({type: Number, attribute: 'hover-open-delay'}) hoverOpenDelay = 400;\n /**\n * The delay between ponterleave and the submenu closing.\n */\n @property({type: Number, attribute: 'hover-close-delay'})\n hoverCloseDelay = 400;\n /**\n * Sets the item in the selected visual state when a submenu is opened.\n */\n @property({type: Boolean, reflect: true}) selected = false;\n\n @queryAssignedElements({slot: 'submenu', flatten: true})\n private readonly menus!: Menu[];\n\n protected override keepOpenOnClick = true;\n private previousOpenTimeout = 0;\n private previousCloseTimeout = 0;\n\n private get submenuEl(): Menu|undefined {\n return this.menus[0];\n }\n\n /**\n * Starts the default 400ms countdown to open the submenu.\n */\n protected override onPointerenter = () => {\n clearTimeout(this.previousOpenTimeout);\n clearTimeout(this.previousCloseTimeout);\n if (this.submenuEl?.open) return;\n\n // Open synchronously if delay is 0. (screenshot tests infra\n // would never resolve otherwise)\n if (!this.hoverOpenDelay) {\n this.show();\n } else {\n this.previousOpenTimeout = setTimeout(() => {\n this.show();\n }, this.hoverOpenDelay);\n }\n };\n\n /**\n * Starts the default 400ms countdown to close the submenu.\n */\n protected override onPointerleave = () => {\n clearTimeout(this.previousCloseTimeout);\n clearTimeout(this.previousOpenTimeout);\n\n // Close synchronously if delay is 0. (screenshot tests infra\n // would never resolve otherwise)\n if (!this.hoverCloseDelay) {\n this.close();\n } else {\n this.previousCloseTimeout = setTimeout(() => {\n this.close();\n }, this.hoverCloseDelay);\n }\n };\n\n protected override onClick() {\n this.show();\n }\n\n /**\n * On item keydown handles opening the submenu.\n */\n protected override onKeydown(e: KeyboardEvent) {\n const shouldOpenSubmenu = this.isSubmenuOpenKey(e.code);\n\n if (e.code === SELECTION_KEY.SPACE) {\n // prevent space from scrolling. Only open the submenu.\n e.preventDefault();\n }\n\n if (!shouldOpenSubmenu) {\n super.onKeydown(e);\n return;\n }\n\n const submenu = this.submenuEl;\n if (!submenu) return;\n\n const submenuItems = submenu.items;\n const firstActivatableItem = List.getFirstActivatableItem(submenuItems);\n\n if (firstActivatableItem) {\n this.show(() => {\n firstActivatableItem.active = true;\n });\n\n return;\n }\n }\n\n /**\n * Render the submenu at the end\n */\n protected override renderEnd() {\n return html`${super.renderEnd()}${this.renderSubMenu()}`;\n }\n\n /**\n * Renders the slot for the submenu.\n */\n private renderSubMenu() {\n return html`<span class=\"submenu\"><slot\n name=\"submenu\"\n @pointerdown=${stopPropagation}\n @click=${stopPropagation}\n @keydown=${this.onSubMenuKeydown}\n @close-menu=${this.onCloseSubmenu}\n ></slot></span>`;\n }\n\n private onCloseSubmenu(e: CloseMenuEvent) {\n e.itemPath.push(this);\n // Restore focusout behavior\n this.dispatchEvent(new CloseOnFocusoutEvent());\n this.dispatchEvent(new ActivateTypeaheadEvent());\n // Escape should only close one menu not all of the menus unlike space or\n // click selection which should close all menus.\n if (e.reason.kind === CLOSE_REASON.KEYDOWN &&\n e.reason.key === KEYDOWN_CLOSE_KEYS.ESCAPE) {\n e.stopPropagation();\n this.active = true;\n this.selected = false;\n // It might already be active so manually focus\n this.listItemRoot?.focus();\n return;\n }\n\n this.active = false;\n this.selected = false;\n }\n\n private async onSubMenuKeydown(e: KeyboardEvent) {\n // Stop propagation so that we don't accidentally close every parent menu.\n // Additionally, we want to isolate things like the typeahead keydowns\n // from bubbling up to the parent menu and confounding things.\n e.stopPropagation();\n const shouldClose = this.isSubmenuCloseKey(e.code);\n\n if (!shouldClose) return;\n\n this.close(() => {\n List.deactivateActiveItem(this.submenuEl!.items);\n this.listItemRoot?.focus();\n this.active = true;\n });\n }\n\n /**\n * Shows the submenu.\n *\n * @param onOpened A function to call after the menu is opened.\n */\n show(onOpened = () => {}) {\n const menu = this.submenuEl;\n if (!menu) return;\n\n menu.quick = true;\n // Submenus are in overflow when not fixed. Can remove once we have native\n // popup support\n menu.hasOverflow = true;\n menu.anchorCorner = this.anchorCorner;\n menu.menuCorner = this.menuCorner;\n menu.anchor = this;\n // We manually set focus with `active` on keyboard navigation. And we\n // want to focus the root on hover, so the user can pick up navigation with\n // keyboard after hover.\n menu.defaultFocus = 'LIST_ROOT';\n menu.skipRestoreFocus = true;\n menu.stayOpenOnOutsideClick = true;\n menu.stayOpenOnFocusout = true;\n\n // Menu could already be opened because of mouse interaction\n const menuAlreadyOpen = menu.open;\n // We want the parent to stay open in the case such that a middle submenu\n // has a submenuitem hovered which opens a third submenut. Then if you hover\n // on yet another middle menu-item (not submenuitem) then focusout Event's\n // relatedTarget will be `null` thus, causing all the menus to close\n this.dispatchEvent(new StayOpenOnFocusoutEvent());\n menu.show();\n\n // Deactivate other items. This can be the case if the user has tabbed\n // around the menu and then mouses over an md-sub-menu.\n this.dispatchEvent(new DeactivateItemsEvent());\n this.dispatchEvent(new DeactivateTypeaheadEvent());\n this.selected = true;\n\n // This is the case of mouse hovering when already opened via keyboard or\n // vice versa\n if (menuAlreadyOpen) {\n onOpened();\n } else {\n menu.addEventListener('opened', onOpened, {once: true});\n }\n }\n\n /**\n * Closes the submenu.\n *\n * @param onClosed A function to call after the menu is closed.\n */\n close(onClosed = () => {}) {\n const menu = this.submenuEl;\n if (!menu || !menu.open) return;\n\n this.dispatchEvent(new ActivateTypeaheadEvent());\n menu.quick = true;\n menu.close();\n // Restore focusout behavior.\n this.dispatchEvent(new CloseOnFocusoutEvent());\n this.active = false;\n this.selected = false;\n menu.addEventListener('closed', onClosed, {once: true});\n }\n\n /**\n * Determines whether the given KeyboardEvent code is one that should open\n * the submenu. This is RTL-aware. By default, left, right, space, or enter.\n *\n * @param code The native KeyboardEvent code.\n * @return Whether or not the key code should open the submenu.\n */\n private isSubmenuOpenKey(code: string) {\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const arrowEnterKey = isRtl ? NAVIGABLE_KEY.LEFT : NAVIGABLE_KEY.RIGHT;\n switch (code) {\n case arrowEnterKey:\n case SELECTION_KEY.SPACE:\n case SELECTION_KEY.ENTER:\n return true;\n default:\n return false;\n }\n }\n\n /**\n * Determines whether the given KeyboardEvent code is one that should close\n * the submenu. This is RTL-aware. By default right, left, or escape.\n *\n * @param code The native KeyboardEvent code.\n * @return Whether or not the key code should close the submenu.\n */\n private isSubmenuCloseKey(code: string) {\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const arrowEnterKey = isRtl ? NAVIGABLE_KEY.RIGHT : NAVIGABLE_KEY.LEFT;\n switch (code) {\n case arrowEnterKey:\n case KEYDOWN_CLOSE_KEYS.ESCAPE:\n return true;\n default:\n return false;\n }\n }\n}\n"]}
@@ -67,19 +67,19 @@ export declare const TYPEAHEAD_RECORD: {
67
67
  * ```
68
68
  */
69
69
  export declare class TypeaheadController {
70
- protected getProperties: () => TypeaheadControllerProperties;
70
+ private readonly getProperties;
71
71
  /**
72
72
  * Array of tuples that helps with indexing.
73
73
  */
74
- protected typeaheadRecords: TypeaheadRecord[];
74
+ private typeaheadRecords;
75
75
  /**
76
76
  * Currently-typed text since last buffer timeout
77
77
  */
78
- protected typaheadBuffer: string;
78
+ private typaheadBuffer;
79
79
  /**
80
80
  * The timeout id from the current buffer's setTimeout
81
81
  */
82
- protected cancelTypeaheadTimeout: number;
82
+ private cancelTypeaheadTimeout;
83
83
  /**
84
84
  * If we are currently "typing"
85
85
  */
@@ -99,8 +99,8 @@ export declare class TypeaheadController {
99
99
  * }
100
100
  */
101
101
  constructor(getProperties: () => TypeaheadControllerProperties);
102
- protected get items(): MenuItem[];
103
- protected get active(): boolean;
102
+ private get items();
103
+ private get active();
104
104
  /**
105
105
  * Apply this listener to the element that will receive `keydown` events that
106
106
  * should trigger this controller.
@@ -111,7 +111,7 @@ export declare class TypeaheadController {
111
111
  /**
112
112
  * Sets up typingahead
113
113
  */
114
- protected beginTypeahead(e: KeyboardEvent): void;
114
+ private beginTypeahead;
115
115
  /**
116
116
  * Performs the typeahead. Based on the normalized items and the current text
117
117
  * buffer, finds the _next_ item with matching text and activates it.
@@ -148,10 +148,10 @@ export declare class TypeaheadController {
148
148
  *
149
149
  * activates Olive
150
150
  */
151
- protected typeahead(e: KeyboardEvent): void;
151
+ private typeahead;
152
152
  /**
153
153
  * Ends the current typeahead and clears the buffer.
154
154
  */
155
- protected endTypeahead: () => void;
155
+ private readonly endTypeahead;
156
156
  }
157
157
  export {};