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

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 (522) hide show
  1. package/README.md +5 -5
  2. package/badge/lib/_badge.scss +2 -10
  3. package/button/lib/_elevated-button.scss +5 -30
  4. package/button/lib/_elevation.scss +1 -16
  5. package/button/lib/_filled-button.scss +4 -31
  6. package/button/lib/_icon.scss +1 -0
  7. package/button/lib/_outlined-button.scss +6 -23
  8. package/button/lib/_shared.scss +20 -54
  9. package/button/lib/_text-button.scss +8 -34
  10. package/button/lib/_tonal-button.scss +5 -28
  11. package/button/lib/button.d.ts +2 -0
  12. package/button/lib/button.js +5 -1
  13. package/button/lib/button.js.map +1 -1
  14. package/button/lib/elevated-styles.css.js +1 -1
  15. package/button/lib/elevated-styles.css.js.map +1 -1
  16. package/button/lib/filled-styles.css.js +1 -1
  17. package/button/lib/filled-styles.css.js.map +1 -1
  18. package/button/lib/outlined-styles.css.js +1 -1
  19. package/button/lib/outlined-styles.css.js.map +1 -1
  20. package/button/lib/shared-styles.css.js +1 -1
  21. package/button/lib/shared-styles.css.js.map +1 -1
  22. package/button/lib/text-styles.css.js +1 -1
  23. package/button/lib/text-styles.css.js.map +1 -1
  24. package/button/lib/tonal-styles.css.js +1 -1
  25. package/button/lib/tonal-styles.css.js.map +1 -1
  26. package/checkbox/lib/_checkbox.scss +1 -2
  27. package/checkbox/lib/checkbox-styles.css.js +1 -1
  28. package/checkbox/lib/checkbox-styles.css.js.map +1 -1
  29. package/chips/_assist-chip.scss +6 -0
  30. package/chips/_suggestion-chip.scss +6 -0
  31. package/chips/assist-chip.d.ts +20 -0
  32. package/chips/assist-chip.js +24 -0
  33. package/chips/assist-chip.js.map +1 -0
  34. package/chips/lib/_assist-chip.scss +27 -0
  35. package/chips/lib/_shared.scss +183 -0
  36. package/chips/lib/_suggestion-chip.scss +30 -0
  37. package/chips/lib/assist-chip.d.ts +11 -0
  38. package/chips/lib/assist-chip.js +12 -0
  39. package/chips/lib/assist-chip.js.map +1 -0
  40. package/chips/lib/assist-styles.css.js +9 -0
  41. package/chips/lib/assist-styles.css.js.map +1 -0
  42. package/{menusurface/lib/menu-surface-styles.scss → chips/lib/assist-styles.scss} +3 -3
  43. package/chips/lib/chip.d.ts +29 -0
  44. package/chips/lib/chip.js +110 -0
  45. package/chips/lib/chip.js.map +1 -0
  46. package/chips/lib/shared-styles.css.js +9 -0
  47. package/chips/lib/shared-styles.css.js.map +1 -0
  48. package/{autocomplete → chips}/lib/shared-styles.scss +1 -1
  49. package/chips/lib/suggestion-chip.d.ts +11 -0
  50. package/chips/lib/suggestion-chip.js +12 -0
  51. package/chips/lib/suggestion-chip.js.map +1 -0
  52. package/chips/lib/suggestion-styles.css.js +9 -0
  53. package/chips/lib/suggestion-styles.css.js.map +1 -0
  54. package/{autocomplete/lib/autocompletelist/autocomplete-list-styles.scss → chips/lib/suggestion-styles.scss} +3 -3
  55. package/chips/suggestion-chip.d.ts +20 -0
  56. package/chips/suggestion-chip.js +24 -0
  57. package/chips/suggestion-chip.js.map +1 -0
  58. package/dialog/lib/_dialog.scss +7 -5
  59. package/dialog/lib/_tokens.scss +1 -2
  60. package/dialog/lib/dialog-styles.css.js +1 -1
  61. package/dialog/lib/dialog-styles.css.js.map +1 -1
  62. package/dialog/lib/dialog.js +1 -1
  63. package/dialog/lib/dialog.js.map +1 -1
  64. package/elevation/lib/_elevation.scss +1 -21
  65. package/elevation/lib/elevation-styles.css.js +1 -1
  66. package/elevation/lib/elevation-styles.css.js.map +1 -1
  67. package/fab/lib/_fab-extended.scss +3 -10
  68. package/fab/lib/_fab.scss +0 -3
  69. package/fab/lib/_shared.scss +3 -25
  70. package/fab/lib/fab-extended-styles.css.js +1 -1
  71. package/fab/lib/fab-extended-styles.css.js.map +1 -1
  72. package/fab/lib/fab-shared-styles.css.js +1 -1
  73. package/fab/lib/fab-shared-styles.css.js.map +1 -1
  74. package/fab/lib/fab-shared.d.ts +0 -1
  75. package/fab/lib/fab-shared.js +1 -7
  76. package/fab/lib/fab-shared.js.map +1 -1
  77. package/field/lib/field.d.ts +4 -1
  78. package/field/lib/field.js +7 -0
  79. package/field/lib/field.js.map +1 -1
  80. package/focus/lib/_focus-ring.scss +13 -7
  81. package/focus/lib/_md-comp-focus-ring.scss +1 -2
  82. package/focus/lib/focus-ring-styles.css.js +1 -1
  83. package/focus/lib/focus-ring-styles.css.js.map +1 -1
  84. package/iconbutton/lib/_filled-icon-button.scss +1 -12
  85. package/iconbutton/lib/_filled-tonal-icon-button.scss +1 -12
  86. package/iconbutton/lib/_outlined-icon-button.scss +1 -13
  87. package/iconbutton/lib/_shared.scss +10 -6
  88. package/iconbutton/lib/_standard-icon-button.scss +5 -12
  89. package/iconbutton/lib/filled-styles.css.js +1 -1
  90. package/iconbutton/lib/filled-styles.css.js.map +1 -1
  91. package/iconbutton/lib/filled-tonal-styles.css.js +1 -1
  92. package/iconbutton/lib/filled-tonal-styles.css.js.map +1 -1
  93. package/iconbutton/lib/icon-button.js +0 -2
  94. package/iconbutton/lib/icon-button.js.map +1 -1
  95. package/iconbutton/lib/outlined-styles.css.js +1 -1
  96. package/iconbutton/lib/outlined-styles.css.js.map +1 -1
  97. package/iconbutton/lib/shared-styles.css.js +1 -1
  98. package/iconbutton/lib/shared-styles.css.js.map +1 -1
  99. package/iconbutton/lib/standard-styles.css.js +1 -1
  100. package/iconbutton/lib/standard-styles.css.js.map +1 -1
  101. package/list/lib/_list.scss +15 -8
  102. package/list/lib/list-styles.css.js +1 -1
  103. package/list/lib/list-styles.css.js.map +1 -1
  104. package/list/lib/listitem/_list-item.scss +41 -44
  105. package/list/lib/listitem/list-item-styles.css.js +1 -1
  106. package/list/lib/listitem/list-item-styles.css.js.map +1 -1
  107. package/list/lib/listitem/list-item.d.ts +1 -0
  108. package/list/lib/listitem/list-item.js +4 -1
  109. package/list/lib/listitem/list-item.js.map +1 -1
  110. package/menu/lib/_menu.scss +6 -9
  111. package/menu/lib/menu-styles.css.js +1 -1
  112. package/menu/lib/menu-styles.css.js.map +1 -1
  113. package/menu/lib/menu.d.ts +22 -9
  114. package/menu/lib/menu.js +74 -26
  115. package/menu/lib/menu.js.map +1 -1
  116. package/menu/lib/menuitem/menu-item.js +1 -1
  117. package/menu/lib/menuitem/menu-item.js.map +1 -1
  118. package/menu/lib/menuitemlink/menu-item-link.js +2 -1
  119. package/menu/lib/menuitemlink/menu-item-link.js.map +1 -1
  120. package/menu/lib/shared.d.ts +16 -0
  121. package/menu/lib/shared.js +16 -0
  122. package/menu/lib/shared.js.map +1 -1
  123. package/menu/lib/submenuitem/sub-menu-item.d.ts +4 -0
  124. package/menu/lib/submenuitem/sub-menu-item.js +9 -2
  125. package/menu/lib/submenuitem/sub-menu-item.js.map +1 -1
  126. package/menu/lib/surfacePositionController.d.ts +10 -2
  127. package/menu/lib/surfacePositionController.js +6 -2
  128. package/menu/lib/surfacePositionController.js.map +1 -1
  129. package/menu/lib/typeaheadController.d.ts +5 -0
  130. package/menu/lib/typeaheadController.js +7 -3
  131. package/menu/lib/typeaheadController.js.map +1 -1
  132. package/navigationbar/lib/_navigation-bar.scss +1 -4
  133. package/navigationdrawer/lib/_navigation-drawer-modal.scss +0 -3
  134. package/navigationdrawer/lib/_navigation-drawer.scss +0 -3
  135. package/navigationdrawer/lib/_shared.scss +0 -9
  136. package/navigationtab/lib/_navigation-tab.scss +4 -10
  137. package/navigationtab/lib/navigation-tab-styles.css.js +1 -1
  138. package/navigationtab/lib/navigation-tab-styles.css.js.map +1 -1
  139. package/package.json +1 -1
  140. package/radio/lib/_radio.scss +1 -2
  141. package/radio/lib/radio-styles.css.js +1 -1
  142. package/radio/lib/radio-styles.css.js.map +1 -1
  143. package/segmentedbutton/lib/_shared.scss +0 -2
  144. package/segmentedbuttonset/lib/outlined-styles.css.js +1 -1
  145. package/segmentedbuttonset/lib/outlined-styles.css.js.map +1 -1
  146. package/slider/lib/_slider.scss +1 -4
  147. package/slider/lib/_tokens.scss +2 -8
  148. package/slider/lib/slider-styles.css.js +1 -1
  149. package/slider/lib/slider-styles.css.js.map +1 -1
  150. package/textfield/lib/_filled-text-field.scss +1 -7
  151. package/textfield/lib/_outlined-text-field.scss +1 -7
  152. package/tokens/_index.scss +101 -2
  153. package/tokens/_md-comp-assist-chip.scss +68 -0
  154. package/tokens/_md-comp-badge.scss +34 -0
  155. package/tokens/_md-comp-banner.scss +23 -0
  156. package/tokens/_md-comp-bottom-app-bar.scss +21 -0
  157. package/tokens/_md-comp-carousel-item.scss +23 -0
  158. package/tokens/_md-comp-checkbox.scss +21 -0
  159. package/tokens/_md-comp-circular-progress-indicator.scss +22 -0
  160. package/tokens/_md-comp-data-table.scss +23 -0
  161. package/tokens/_md-comp-date-input-modal.scss +23 -0
  162. package/tokens/_md-comp-date-picker-docked.scss +25 -0
  163. package/tokens/_md-comp-date-picker-modal.scss +25 -0
  164. package/tokens/_md-comp-dialog.scss +43 -0
  165. package/tokens/_md-comp-divider.scss +17 -0
  166. package/tokens/_md-comp-elevated-button.scss +58 -0
  167. package/tokens/_md-comp-elevated-card.scss +23 -0
  168. package/tokens/_md-comp-extended-fab-branded.scss +38 -0
  169. package/tokens/_md-comp-extended-fab-primary.scss +38 -0
  170. package/tokens/_md-comp-extended-fab-secondary.scss +41 -0
  171. package/tokens/_md-comp-extended-fab-surface.scss +38 -0
  172. package/tokens/_md-comp-extended-fab-tertiary.scss +41 -0
  173. package/tokens/_md-comp-fab-branded-large.scss +23 -0
  174. package/tokens/_md-comp-fab-branded.scss +23 -0
  175. package/tokens/_md-comp-fab-primary-large.scss +23 -0
  176. package/tokens/_md-comp-fab-primary-small.scss +23 -0
  177. package/tokens/_md-comp-fab-primary.scss +23 -0
  178. package/tokens/_md-comp-fab-secondary-large.scss +23 -0
  179. package/tokens/_md-comp-fab-secondary-small.scss +23 -0
  180. package/tokens/_md-comp-fab-secondary.scss +23 -0
  181. package/tokens/_md-comp-fab-surface-large.scss +23 -0
  182. package/tokens/_md-comp-fab-surface-small.scss +23 -0
  183. package/tokens/_md-comp-fab-surface.scss +23 -0
  184. package/tokens/_md-comp-fab-tertiary-large.scss +23 -0
  185. package/tokens/_md-comp-fab-tertiary-small.scss +23 -0
  186. package/tokens/_md-comp-fab-tertiary.scss +23 -0
  187. package/tokens/_md-comp-filled-autocomplete.scss +25 -0
  188. package/tokens/_md-comp-filled-button.scss +58 -0
  189. package/tokens/_md-comp-filled-card.scss +23 -0
  190. package/tokens/_md-comp-filled-icon-button.scss +21 -0
  191. package/tokens/_md-comp-filled-menu-button.scss +25 -0
  192. package/tokens/_md-comp-filled-select.scss +25 -0
  193. package/tokens/_md-comp-filled-text-field.scss +46 -0
  194. package/tokens/_md-comp-filled-tonal-button.scss +59 -0
  195. package/tokens/_md-comp-filled-tonal-icon-button.scss +24 -0
  196. package/tokens/_md-comp-filter-chip.scss +38 -0
  197. package/tokens/_md-comp-full-screen-dialog.scss +25 -0
  198. package/tokens/_md-comp-icon-button.scss +21 -0
  199. package/tokens/_md-comp-input-chip.scss +38 -0
  200. package/tokens/_md-comp-linear-progress-indicator.scss +22 -0
  201. package/tokens/_md-comp-list.scss +58 -0
  202. package/tokens/_md-comp-menu.scss +21 -0
  203. package/tokens/_md-comp-navigation-bar.scss +25 -0
  204. package/tokens/_md-comp-navigation-drawer.scss +25 -0
  205. package/tokens/_md-comp-navigation-rail.scss +25 -0
  206. package/tokens/_md-comp-outlined-autocomplete.scss +28 -0
  207. package/tokens/_md-comp-outlined-button.scss +56 -0
  208. package/tokens/_md-comp-outlined-card.scss +23 -0
  209. package/tokens/_md-comp-outlined-icon-button.scss +21 -0
  210. package/tokens/_md-comp-outlined-menu-button.scss +23 -0
  211. package/tokens/_md-comp-outlined-segmented-button.scss +38 -0
  212. package/tokens/_md-comp-outlined-select.scss +25 -0
  213. package/tokens/_md-comp-outlined-text-field.scss +44 -0
  214. package/tokens/_md-comp-plain-tooltip.scss +21 -0
  215. package/tokens/_md-comp-primary-navigation-tab.scss +41 -0
  216. package/tokens/_md-comp-radio-button.scss +19 -0
  217. package/tokens/_md-comp-rich-tooltip.scss +25 -0
  218. package/tokens/_md-comp-scrim.scss +17 -0
  219. package/tokens/_md-comp-search-bar.scss +25 -0
  220. package/tokens/_md-comp-search-view.scss +23 -0
  221. package/tokens/_md-comp-secondary-navigation-tab.scss +41 -0
  222. package/tokens/_md-comp-sheet-bottom.scss +21 -0
  223. package/tokens/_md-comp-sheet-floating.scss +21 -0
  224. package/tokens/_md-comp-sheet-side.scss +25 -0
  225. package/tokens/_md-comp-slider.scss +38 -0
  226. package/tokens/_md-comp-snackbar.scss +25 -0
  227. package/tokens/_md-comp-standard-menu-button.scss +23 -0
  228. package/tokens/_md-comp-suggestion-chip.scss +72 -0
  229. package/tokens/_md-comp-switch.scss +21 -0
  230. package/tokens/_md-comp-text-button.scss +56 -0
  231. package/tokens/_md-comp-time-input.scss +25 -0
  232. package/tokens/_md-comp-time-picker.scss +25 -0
  233. package/tokens/_md-comp-top-app-bar-large.scss +23 -0
  234. package/tokens/_md-comp-top-app-bar-medium.scss +23 -0
  235. package/tokens/_md-comp-top-app-bar-small-centered.scss +26 -0
  236. package/tokens/_md-comp-top-app-bar-small.scss +23 -0
  237. package/tokens/_md-ref-palette.scss +12 -0
  238. package/tokens/_md-ref-typeface.scss +12 -0
  239. package/tokens/_md-sys-color.scss +25 -0
  240. package/tokens/_md-sys-elevation.scss +30 -0
  241. package/tokens/_md-sys-motion.scss +12 -0
  242. package/tokens/_md-sys-shape.scss +12 -0
  243. package/tokens/_md-sys-state.scss +12 -0
  244. package/tokens/_md-sys-typescale.scss +17 -0
  245. package/autocomplete/_filled-autocomplete.scss +0 -6
  246. package/autocomplete/_outlined-autocomplete.scss +0 -6
  247. package/autocomplete/autocomplete-item.d.ts +0 -19
  248. package/autocomplete/autocomplete-item.js +0 -22
  249. package/autocomplete/autocomplete-item.js.map +0 -1
  250. package/autocomplete/autocomplete-list.d.ts +0 -19
  251. package/autocomplete/autocomplete-list.js +0 -23
  252. package/autocomplete/autocomplete-list.js.map +0 -1
  253. package/autocomplete/autocomplete-surface.d.ts +0 -19
  254. package/autocomplete/autocomplete-surface.js +0 -23
  255. package/autocomplete/autocomplete-surface.js.map +0 -1
  256. package/autocomplete/filled-autocomplete.d.ts +0 -28
  257. package/autocomplete/filled-autocomplete.js +0 -46
  258. package/autocomplete/filled-autocomplete.js.map +0 -1
  259. package/autocomplete/lib/_filled-autocomplete.scss +0 -189
  260. package/autocomplete/lib/_outlined-autocomplete.scss +0 -178
  261. package/autocomplete/lib/_shared.scss +0 -25
  262. package/autocomplete/lib/autocomplete.d.ts +0 -54
  263. package/autocomplete/lib/autocomplete.js +0 -265
  264. package/autocomplete/lib/autocomplete.js.map +0 -1
  265. package/autocomplete/lib/autocompleteitem/autocomplete-item.d.ts +0 -11
  266. package/autocomplete/lib/autocompleteitem/autocomplete-item.js +0 -14
  267. package/autocomplete/lib/autocompleteitem/autocomplete-item.js.map +0 -1
  268. package/autocomplete/lib/autocompleteitem/harness.d.ts +0 -11
  269. package/autocomplete/lib/autocompleteitem/harness.js +0 -12
  270. package/autocomplete/lib/autocompleteitem/harness.js.map +0 -1
  271. package/autocomplete/lib/autocompletelist/_autocomplete-list.scss +0 -13
  272. package/autocomplete/lib/autocompletelist/autocomplete-list-styles.css.js +0 -9
  273. package/autocomplete/lib/autocompletelist/autocomplete-list-styles.css.js.map +0 -1
  274. package/autocomplete/lib/autocompletelist/autocomplete-list.d.ts +0 -14
  275. package/autocomplete/lib/autocompletelist/autocomplete-list.js +0 -21
  276. package/autocomplete/lib/autocompletelist/autocomplete-list.js.map +0 -1
  277. package/autocomplete/lib/autocompletelist/harness.d.ts +0 -11
  278. package/autocomplete/lib/autocompletelist/harness.js +0 -12
  279. package/autocomplete/lib/autocompletelist/harness.js.map +0 -1
  280. package/autocomplete/lib/autocompletesurface/_autocomplete-surface.scss +0 -13
  281. package/autocomplete/lib/autocompletesurface/autocomplete-surface-styles.css.js +0 -9
  282. package/autocomplete/lib/autocompletesurface/autocomplete-surface-styles.css.js.map +0 -1
  283. package/autocomplete/lib/autocompletesurface/autocomplete-surface-styles.scss +0 -10
  284. package/autocomplete/lib/autocompletesurface/autocomplete-surface.d.ts +0 -13
  285. package/autocomplete/lib/autocompletesurface/autocomplete-surface.js +0 -21
  286. package/autocomplete/lib/autocompletesurface/autocomplete-surface.js.map +0 -1
  287. package/autocomplete/lib/filled-styles.css.d.ts +0 -1
  288. package/autocomplete/lib/filled-styles.css.js +0 -9
  289. package/autocomplete/lib/filled-styles.css.js.map +0 -1
  290. package/autocomplete/lib/filled-styles.scss +0 -10
  291. package/autocomplete/lib/outlined-styles.css.d.ts +0 -1
  292. package/autocomplete/lib/outlined-styles.css.js +0 -9
  293. package/autocomplete/lib/outlined-styles.css.js.map +0 -1
  294. package/autocomplete/lib/outlined-styles.scss +0 -10
  295. package/autocomplete/lib/shared-styles.css.js +0 -9
  296. package/autocomplete/lib/shared-styles.css.js.map +0 -1
  297. package/autocomplete/outlined-autocomplete.d.ts +0 -28
  298. package/autocomplete/outlined-autocomplete.js +0 -46
  299. package/autocomplete/outlined-autocomplete.js.map +0 -1
  300. package/chips/action/delete-action.d.ts +0 -18
  301. package/chips/action/delete-action.js +0 -20
  302. package/chips/action/delete-action.js.map +0 -1
  303. package/chips/action/lib/action.d.ts +0 -47
  304. package/chips/action/lib/action.js +0 -162
  305. package/chips/action/lib/action.js.map +0 -1
  306. package/chips/action/lib/constants.d.ts +0 -62
  307. package/chips/action/lib/constants.js +0 -69
  308. package/chips/action/lib/constants.js.map +0 -1
  309. package/chips/action/lib/delete-action.d.ts +0 -20
  310. package/chips/action/lib/delete-action.js +0 -65
  311. package/chips/action/lib/delete-action.js.map +0 -1
  312. package/chips/action/lib/events.d.ts +0 -14
  313. package/chips/action/lib/events.js +0 -16
  314. package/chips/action/lib/events.js.map +0 -1
  315. package/chips/action/lib/link-action.d.ts +0 -19
  316. package/chips/action/lib/link-action.js +0 -55
  317. package/chips/action/lib/link-action.js.map +0 -1
  318. package/chips/action/lib/presentational-action.d.ts +0 -15
  319. package/chips/action/lib/presentational-action.js +0 -30
  320. package/chips/action/lib/presentational-action.js.map +0 -1
  321. package/chips/action/lib/primary-action.d.ts +0 -28
  322. package/chips/action/lib/primary-action.js +0 -88
  323. package/chips/action/lib/primary-action.js.map +0 -1
  324. package/chips/action/lib/selectable-action.d.ts +0 -17
  325. package/chips/action/lib/selectable-action.js +0 -67
  326. package/chips/action/lib/selectable-action.js.map +0 -1
  327. package/chips/action/lib/types.d.ts +0 -23
  328. package/chips/action/lib/types.js +0 -7
  329. package/chips/action/lib/types.js.map +0 -1
  330. package/chips/action/link-action.d.ts +0 -18
  331. package/chips/action/link-action.js +0 -20
  332. package/chips/action/link-action.js.map +0 -1
  333. package/chips/action/presentational-action.d.ts +0 -18
  334. package/chips/action/presentational-action.js +0 -20
  335. package/chips/action/presentational-action.js.map +0 -1
  336. package/chips/action/primary-action.d.ts +0 -18
  337. package/chips/action/primary-action.js +0 -20
  338. package/chips/action/primary-action.js.map +0 -1
  339. package/chips/action/selectable-action.d.ts +0 -18
  340. package/chips/action/selectable-action.js +0 -20
  341. package/chips/action/selectable-action.js.map +0 -1
  342. package/chips/chip/lib/_assist-chip-theme.scss +0 -99
  343. package/chips/chip/lib/_chip-theme.scss +0 -1285
  344. package/chips/chip/lib/_chip.scss +0 -444
  345. package/chips/chip/lib/_filter-chip-theme.scss +0 -130
  346. package/chips/chip/lib/_input-chip-theme.scss +0 -91
  347. package/chips/chip/lib/_suggestion-chip-theme.scss +0 -92
  348. package/chips/chip/lib/action-chip.d.ts +0 -18
  349. package/chips/chip/lib/action-chip.js +0 -39
  350. package/chips/chip/lib/action-chip.js.map +0 -1
  351. package/chips/chip/lib/adapter.d.ts +0 -50
  352. package/chips/chip/lib/adapter.js +0 -7
  353. package/chips/chip/lib/adapter.js.map +0 -1
  354. package/chips/chip/lib/animationframe.d.ts +0 -31
  355. package/chips/chip/lib/animationframe.js +0 -66
  356. package/chips/chip/lib/animationframe.js.map +0 -1
  357. package/chips/chip/lib/chip.d.ts +0 -43
  358. package/chips/chip/lib/chip.js +0 -134
  359. package/chips/chip/lib/chip.js.map +0 -1
  360. package/chips/chip/lib/constants.d.ts +0 -43
  361. package/chips/chip/lib/constants.js +0 -48
  362. package/chips/chip/lib/constants.js.map +0 -1
  363. package/chips/chip/lib/foundation.d.ts +0 -41
  364. package/chips/chip/lib/foundation.js +0 -255
  365. package/chips/chip/lib/foundation.js.map +0 -1
  366. package/chips/chip/lib/link-chip.d.ts +0 -21
  367. package/chips/chip/lib/link-chip.js +0 -53
  368. package/chips/chip/lib/link-chip.js.map +0 -1
  369. package/chips/chip/lib/presentational-chip.d.ts +0 -18
  370. package/chips/chip/lib/presentational-chip.js +0 -39
  371. package/chips/chip/lib/presentational-chip.js.map +0 -1
  372. package/chips/chip/lib/selectable-chip.d.ts +0 -22
  373. package/chips/chip/lib/selectable-chip.js +0 -57
  374. package/chips/chip/lib/selectable-chip.js.map +0 -1
  375. package/chips/chip/lib/types.d.ts +0 -42
  376. package/chips/chip/lib/types.js +0 -7
  377. package/chips/chip/lib/types.js.map +0 -1
  378. package/chips/chipset/lib/_chip-set-theme.scss +0 -50
  379. package/chips/chipset/lib/_chip-set.scss +0 -48
  380. package/chips/chipset/lib/adapter.d.ts +0 -45
  381. package/chips/chipset/lib/adapter.js +0 -7
  382. package/chips/chipset/lib/adapter.js.map +0 -1
  383. package/chips/chipset/lib/constants.d.ts +0 -26
  384. package/chips/chipset/lib/constants.js +0 -30
  385. package/chips/chipset/lib/constants.js.map +0 -1
  386. package/chips/chipset/lib/foundation.d.ts +0 -68
  387. package/chips/chipset/lib/foundation.js +0 -314
  388. package/chips/chipset/lib/foundation.js.map +0 -1
  389. package/chips/chipset/lib/types.d.ts +0 -41
  390. package/chips/chipset/lib/types.js +0 -7
  391. package/chips/chipset/lib/types.js.map +0 -1
  392. package/menusurface/_menu-surface.scss +0 -6
  393. package/menusurface/lib/_md-comp-menu-surface.scss +0 -31
  394. package/menusurface/lib/_menu-surface.scss +0 -122
  395. package/menusurface/lib/adapter.d.ts +0 -46
  396. package/menusurface/lib/adapter.js +0 -7
  397. package/menusurface/lib/adapter.js.map +0 -1
  398. package/menusurface/lib/constants.d.ts +0 -71
  399. package/menusurface/lib/constants.js +0 -83
  400. package/menusurface/lib/constants.js.map +0 -1
  401. package/menusurface/lib/foundation.d.ts +0 -176
  402. package/menusurface/lib/foundation.js +0 -544
  403. package/menusurface/lib/foundation.js.map +0 -1
  404. package/menusurface/lib/menu-surface-styles.css.d.ts +0 -1
  405. package/menusurface/lib/menu-surface-styles.css.js +0 -9
  406. package/menusurface/lib/menu-surface-styles.css.js.map +0 -1
  407. package/menusurface/lib/menu-surface.d.ts +0 -62
  408. package/menusurface/lib/menu-surface.js +0 -347
  409. package/menusurface/lib/menu-surface.js.map +0 -1
  410. package/menusurface/lib/types.d.ts +0 -19
  411. package/menusurface/lib/types.js +0 -7
  412. package/menusurface/lib/types.js.map +0 -1
  413. package/menusurface/menu-surface.d.ts +0 -14
  414. package/menusurface/menu-surface.js +0 -17
  415. package/menusurface/menu-surface.js.map +0 -1
  416. package/sass/_elevation.scss +0 -159
  417. package/sass/_resolvers.scss +0 -16
  418. package/sass/_typography.scss +0 -39
  419. package/tokens/v0_160/_index.scss +0 -107
  420. package/tokens/v0_160/_md-comp-assist-chip.scss +0 -109
  421. package/tokens/v0_160/_md-comp-badge.scss +0 -58
  422. package/tokens/v0_160/_md-comp-banner.scss +0 -75
  423. package/tokens/v0_160/_md-comp-bottom-app-bar.scss +0 -35
  424. package/tokens/v0_160/_md-comp-carousel-item.scss +0 -65
  425. package/tokens/v0_160/_md-comp-checkbox.scss +0 -126
  426. package/tokens/v0_160/_md-comp-circular-progress-indicator.scss +0 -39
  427. package/tokens/v0_160/_md-comp-data-table.scss +0 -96
  428. package/tokens/v0_160/_md-comp-date-input-modal.scss +0 -89
  429. package/tokens/v0_160/_md-comp-date-picker-docked.scss +0 -246
  430. package/tokens/v0_160/_md-comp-date-picker-modal.scss +0 -305
  431. package/tokens/v0_160/_md-comp-dialog.scss +0 -123
  432. package/tokens/v0_160/_md-comp-divider.scss +0 -25
  433. package/tokens/v0_160/_md-comp-elevated-button.scss +0 -91
  434. package/tokens/v0_160/_md-comp-elevated-card.scss +0 -59
  435. package/tokens/v0_160/_md-comp-extended-fab-branded.scss +0 -86
  436. package/tokens/v0_160/_md-comp-extended-fab-primary.scss +0 -94
  437. package/tokens/v0_160/_md-comp-extended-fab-secondary.scss +0 -95
  438. package/tokens/v0_160/_md-comp-extended-fab-surface.scss +0 -90
  439. package/tokens/v0_160/_md-comp-extended-fab-tertiary.scss +0 -95
  440. package/tokens/v0_160/_md-comp-fab-branded-large.scss +0 -60
  441. package/tokens/v0_160/_md-comp-fab-branded.scss +0 -60
  442. package/tokens/v0_160/_md-comp-fab-primary-large.scss +0 -65
  443. package/tokens/v0_160/_md-comp-fab-primary-small.scss +0 -65
  444. package/tokens/v0_160/_md-comp-fab-primary.scss +0 -65
  445. package/tokens/v0_160/_md-comp-fab-secondary-large.scss +0 -66
  446. package/tokens/v0_160/_md-comp-fab-secondary-small.scss +0 -66
  447. package/tokens/v0_160/_md-comp-fab-secondary.scss +0 -66
  448. package/tokens/v0_160/_md-comp-fab-surface-large.scss +0 -64
  449. package/tokens/v0_160/_md-comp-fab-surface-small.scss +0 -64
  450. package/tokens/v0_160/_md-comp-fab-surface.scss +0 -64
  451. package/tokens/v0_160/_md-comp-fab-tertiary-large.scss +0 -66
  452. package/tokens/v0_160/_md-comp-fab-tertiary-small.scss +0 -66
  453. package/tokens/v0_160/_md-comp-fab-tertiary.scss +0 -66
  454. package/tokens/v0_160/_md-comp-filled-autocomplete.scss +0 -267
  455. package/tokens/v0_160/_md-comp-filled-button.scss +0 -89
  456. package/tokens/v0_160/_md-comp-filled-card.scss +0 -58
  457. package/tokens/v0_160/_md-comp-filled-icon-button.scss +0 -79
  458. package/tokens/v0_160/_md-comp-filled-menu-button.scss +0 -98
  459. package/tokens/v0_160/_md-comp-filled-select.scss +0 -272
  460. package/tokens/v0_160/_md-comp-filled-text-field.scss +0 -189
  461. package/tokens/v0_160/_md-comp-filled-tonal-button.scss +0 -99
  462. package/tokens/v0_160/_md-comp-filled-tonal-icon-button.scss +0 -86
  463. package/tokens/v0_160/_md-comp-filter-chip.scss +0 -209
  464. package/tokens/v0_160/_md-comp-full-screen-dialog.scss +0 -111
  465. package/tokens/v0_160/_md-comp-icon-button.scss +0 -70
  466. package/tokens/v0_160/_md-comp-input-chip.scss +0 -184
  467. package/tokens/v0_160/_md-comp-linear-progress-indicator.scss +0 -41
  468. package/tokens/v0_160/_md-comp-list.scss +0 -248
  469. package/tokens/v0_160/_md-comp-menu.scss +0 -121
  470. package/tokens/v0_160/_md-comp-navigation-bar.scss +0 -114
  471. package/tokens/v0_160/_md-comp-navigation-drawer.scss +0 -162
  472. package/tokens/v0_160/_md-comp-navigation-rail.scss +0 -131
  473. package/tokens/v0_160/_md-comp-outlined-autocomplete.scss +0 -257
  474. package/tokens/v0_160/_md-comp-outlined-button.scss +0 -84
  475. package/tokens/v0_160/_md-comp-outlined-card.scss +0 -65
  476. package/tokens/v0_160/_md-comp-outlined-icon-button.scss +0 -79
  477. package/tokens/v0_160/_md-comp-outlined-menu-button.scss +0 -94
  478. package/tokens/v0_160/_md-comp-outlined-segmented-button.scss +0 -112
  479. package/tokens/v0_160/_md-comp-outlined-select.scss +0 -262
  480. package/tokens/v0_160/_md-comp-outlined-text-field.scss +0 -171
  481. package/tokens/v0_160/_md-comp-plain-tooltip.scss +0 -55
  482. package/tokens/v0_160/_md-comp-primary-navigation-tab.scss +0 -121
  483. package/tokens/v0_160/_md-comp-radio-button.scss +0 -68
  484. package/tokens/v0_160/_md-comp-rich-tooltip.scss +0 -121
  485. package/tokens/v0_160/_md-comp-scrim.scss +0 -25
  486. package/tokens/v0_160/_md-comp-search-bar.scss +0 -99
  487. package/tokens/v0_160/_md-comp-search-view.scss +0 -93
  488. package/tokens/v0_160/_md-comp-secondary-navigation-tab.scss +0 -84
  489. package/tokens/v0_160/_md-comp-sheet-bottom.scss +0 -45
  490. package/tokens/v0_160/_md-comp-sheet-floating.scss +0 -34
  491. package/tokens/v0_160/_md-comp-sheet-side.scss +0 -91
  492. package/tokens/v0_160/_md-comp-slider.scss +0 -114
  493. package/tokens/v0_160/_md-comp-snackbar.scss +0 -127
  494. package/tokens/v0_160/_md-comp-standard-menu-button.scss +0 -98
  495. package/tokens/v0_160/_md-comp-suggestion-chip.scss +0 -125
  496. package/tokens/v0_160/_md-comp-switch.scss +0 -136
  497. package/tokens/v0_160/_md-comp-text-button.scss +0 -77
  498. package/tokens/v0_160/_md-comp-time-input.scss +0 -218
  499. package/tokens/v0_160/_md-comp-time-picker.scss +0 -264
  500. package/tokens/v0_160/_md-comp-top-app-bar-large.scss +0 -63
  501. package/tokens/v0_160/_md-comp-top-app-bar-medium.scss +0 -63
  502. package/tokens/v0_160/_md-comp-top-app-bar-small-centered.scss +0 -66
  503. package/tokens/v0_160/_md-comp-top-app-bar-small.scss +0 -64
  504. package/tokens/v0_160/_md-ref-palette.scss +0 -107
  505. package/tokens/v0_160/_md-ref-typeface.scss +0 -21
  506. package/tokens/v0_160/_md-sys-color.scss +0 -904
  507. package/tokens/v0_160/_md-sys-elevation.scss +0 -21
  508. package/tokens/v0_160/_md-sys-motion.scss +0 -53
  509. package/tokens/v0_160/_md-sys-shape.scss +0 -30
  510. package/tokens/v0_160/_md-sys-state.scss +0 -19
  511. package/tokens/v0_160/_md-sys-typescale.scss +0 -284
  512. package/tokens/v0_160/index.test.css.d.ts +0 -1
  513. package/tokens/v0_160/index.test.css.js +0 -9
  514. package/tokens/v0_160/index.test.css.js.map +0 -1
  515. package/tokens/v0_160/index.test.scss +0 -584
  516. package/tokens/v0_160/lib.test.css.d.ts +0 -1
  517. package/tokens/v0_160/lib.test.css.js +0 -9
  518. package/tokens/v0_160/lib.test.css.js.map +0 -1
  519. package/tokens/v0_160/lib.test.scss +0 -663
  520. /package/{autocomplete/lib/autocompletelist/autocomplete-list-styles.css.d.ts → chips/lib/assist-styles.css.d.ts} +0 -0
  521. /package/{autocomplete → chips}/lib/shared-styles.css.d.ts +0 -0
  522. /package/{autocomplete/lib/autocompletesurface/autocomplete-surface-styles.css.d.ts → chips/lib/suggestion-styles.css.d.ts} +0 -0
@@ -1,544 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2022 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { Corner, CornerBit, cssClasses, numbers, strings } from './constants.js';
7
- export class MDCMenuSurfaceFoundation {
8
- static get cssClasses() {
9
- return cssClasses;
10
- }
11
- static get strings() {
12
- return strings;
13
- }
14
- static get numbers() {
15
- return numbers;
16
- }
17
- static get Corner() {
18
- return Corner;
19
- }
20
- /**
21
- * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types.
22
- */
23
- static get defaultAdapter() {
24
- // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
25
- return {
26
- addClass: () => undefined,
27
- removeClass: () => undefined,
28
- hasClass: () => false,
29
- hasAnchor: () => false,
30
- isElementInContainer: () => false,
31
- isFocused: () => false,
32
- isRtl: () => false,
33
- getInnerDimensions: () => ({ height: 0, width: 0 }),
34
- getAnchorDimensions: () => null,
35
- getWindowDimensions: () => ({ height: 0, width: 0 }),
36
- getBodyDimensions: () => ({ height: 0, width: 0 }),
37
- getWindowScroll: () => ({ x: 0, y: 0 }),
38
- setPosition: () => undefined,
39
- setMaxHeight: () => undefined,
40
- setTransformOrigin: () => undefined,
41
- saveFocus: () => undefined,
42
- restoreFocus: () => undefined,
43
- notifyClose: () => undefined,
44
- notifyClosing: () => undefined,
45
- notifyOpen: () => undefined,
46
- notifyOpening: () => undefined,
47
- };
48
- // tslint:enable:object-literal-sort-keys
49
- }
50
- constructor(adapter) {
51
- this.isSurfaceOpen = false;
52
- this.isQuickOpen = false;
53
- this.isHoistedElement = false;
54
- this.isFixedPosition = false;
55
- this.isHorizontallyCenteredOnViewport = false;
56
- this.maxHeight = 0;
57
- this.openBottomBias = 0;
58
- this.openAnimationEndTimerId = 0;
59
- this.closeAnimationEndTimerId = 0;
60
- this.animationRequestId = 0;
61
- this.anchorCorner = Corner.TOP_START;
62
- /**
63
- * Corner of the menu surface to which menu surface is attached to anchor.
64
- *
65
- * Anchor corner --->+----------+
66
- * | ANCHOR |
67
- * +----------+
68
- * Origin corner --->+--------------+
69
- * | |
70
- * | |
71
- * | MENU SURFACE |
72
- * | |
73
- * | |
74
- * +--------------+
75
- */
76
- this.originCorner = Corner.TOP_START;
77
- this.anchorMargin = { top: 0, right: 0, bottom: 0, left: 0 };
78
- this.position = { x: 0, y: 0 };
79
- this.adapter = { ...MDCMenuSurfaceFoundation.defaultAdapter, ...adapter };
80
- }
81
- init() {
82
- const { ROOT, OPEN } = MDCMenuSurfaceFoundation.cssClasses;
83
- if (!this.adapter.hasClass(ROOT)) {
84
- throw new Error(`${ROOT} class required in root element.`);
85
- }
86
- if (this.adapter.hasClass(OPEN)) {
87
- this.isSurfaceOpen = true;
88
- }
89
- }
90
- destroy() {
91
- clearTimeout(this.openAnimationEndTimerId);
92
- clearTimeout(this.closeAnimationEndTimerId);
93
- // Cancel any currently running animations.
94
- cancelAnimationFrame(this.animationRequestId);
95
- }
96
- /**
97
- * @param corner Default anchor corner alignment of top-left menu surface
98
- * corner.
99
- */
100
- setAnchorCorner(corner) {
101
- this.anchorCorner = corner;
102
- }
103
- /**
104
- * Flips menu corner horizontally.
105
- */
106
- flipCornerHorizontally() {
107
- this.originCorner = this.originCorner ^ CornerBit.RIGHT;
108
- }
109
- /**
110
- * @param margin Set of margin values from anchor.
111
- */
112
- setAnchorMargin(margin) {
113
- this.anchorMargin.top = margin.top || 0;
114
- this.anchorMargin.right = margin.right || 0;
115
- this.anchorMargin.bottom = margin.bottom || 0;
116
- this.anchorMargin.left = margin.left || 0;
117
- }
118
- /** Used to indicate if the menu-surface is hoisted to the body. */
119
- setIsHoisted(isHoisted) {
120
- this.isHoistedElement = isHoisted;
121
- }
122
- /**
123
- * Used to set the menu-surface calculations based on a fixed position menu.
124
- */
125
- setFixedPosition(isFixedPosition) {
126
- this.isFixedPosition = isFixedPosition;
127
- }
128
- /**
129
- * @return Returns true if menu is in fixed (`position: fixed`) position.
130
- */
131
- isFixed() {
132
- return this.isFixedPosition;
133
- }
134
- /** Sets the menu-surface position on the page. */
135
- setAbsolutePosition(x, y) {
136
- this.position.x = this.isFinite(x) ? x : 0;
137
- this.position.y = this.isFinite(y) ? y : 0;
138
- }
139
- /** Sets whether menu-surface should be horizontally centered to viewport. */
140
- setIsHorizontallyCenteredOnViewport(isCentered) {
141
- this.isHorizontallyCenteredOnViewport = isCentered;
142
- }
143
- setQuickOpen(quickOpen) {
144
- this.isQuickOpen = quickOpen;
145
- }
146
- /**
147
- * Sets maximum menu-surface height on open.
148
- * @param maxHeight The desired max-height. Set to 0 (default) to
149
- * automatically calculate max height based on available viewport space.
150
- */
151
- setMaxHeight(maxHeight) {
152
- this.maxHeight = maxHeight;
153
- }
154
- /**
155
- * Set to a positive integer to influence the menu to preferentially open
156
- * below the anchor instead of above.
157
- * @param bias A value of `x` simulates an extra `x` pixels of available space
158
- * below the menu during positioning calculations.
159
- */
160
- setOpenBottomBias(bias) {
161
- this.openBottomBias = bias;
162
- }
163
- isOpen() {
164
- return this.isSurfaceOpen;
165
- }
166
- /**
167
- * Open the menu surface.
168
- */
169
- open() {
170
- if (this.isSurfaceOpen) {
171
- return;
172
- }
173
- this.adapter.notifyOpening();
174
- this.adapter.saveFocus();
175
- if (this.isQuickOpen) {
176
- this.isSurfaceOpen = true;
177
- this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
178
- this.dimensions = this.adapter.getInnerDimensions();
179
- this.autoposition();
180
- this.adapter.notifyOpen();
181
- }
182
- else {
183
- this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
184
- this.animationRequestId = requestAnimationFrame(() => {
185
- this.dimensions = this.adapter.getInnerDimensions();
186
- this.autoposition();
187
- this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
188
- this.openAnimationEndTimerId = setTimeout(() => {
189
- this.openAnimationEndTimerId = 0;
190
- this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
191
- this.adapter.notifyOpen();
192
- }, numbers.TRANSITION_OPEN_DURATION);
193
- });
194
- this.isSurfaceOpen = true;
195
- }
196
- }
197
- /**
198
- * Closes the menu surface.
199
- */
200
- close(skipRestoreFocus = false) {
201
- if (!this.isSurfaceOpen) {
202
- return;
203
- }
204
- this.adapter.notifyClosing();
205
- if (this.isQuickOpen) {
206
- this.isSurfaceOpen = false;
207
- if (!skipRestoreFocus) {
208
- this.maybeRestoreFocus();
209
- }
210
- this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
211
- this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
212
- this.adapter.notifyClose();
213
- return;
214
- }
215
- this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
216
- requestAnimationFrame(() => {
217
- this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
218
- this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
219
- this.closeAnimationEndTimerId = setTimeout(() => {
220
- this.closeAnimationEndTimerId = 0;
221
- this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
222
- this.adapter.notifyClose();
223
- }, numbers.TRANSITION_CLOSE_DURATION);
224
- });
225
- this.isSurfaceOpen = false;
226
- if (!skipRestoreFocus) {
227
- this.maybeRestoreFocus();
228
- }
229
- }
230
- /** Handle clicks and close if not within menu-surface element. */
231
- handleBodyClick(evt) {
232
- const el = evt.target;
233
- if (this.adapter.isElementInContainer(el)) {
234
- return;
235
- }
236
- this.close();
237
- }
238
- /** Handle keys that close the surface. */
239
- handleKeydown(evt) {
240
- const { keyCode, key } = evt;
241
- const isEscape = key === 'Escape' || keyCode === 27;
242
- if (isEscape) {
243
- this.close();
244
- }
245
- }
246
- autoposition() {
247
- // Compute measurements for autoposition methods reuse.
248
- this.measurements = this.getAutoLayoutmeasurements();
249
- const corner = this.getOriginCorner();
250
- const maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight(corner);
251
- const verticalAlignment = this.hasBit(corner, CornerBit.BOTTOM) ? 'bottom' : 'top';
252
- let horizontalAlignment = this.hasBit(corner, CornerBit.RIGHT) ? 'right' : 'left';
253
- const horizontalOffset = this.getHorizontalOriginOffset(corner);
254
- const verticalOffset = this.getVerticalOriginOffset(corner);
255
- const { anchorSize, surfaceSize } = this.measurements;
256
- const position = {
257
- [horizontalAlignment]: horizontalOffset,
258
- [verticalAlignment]: verticalOffset,
259
- };
260
- // Center align when anchor width is comparable or greater than menu
261
- // surface, otherwise keep corner.
262
- if (anchorSize.width / surfaceSize.width >
263
- numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
264
- horizontalAlignment = 'center';
265
- }
266
- // If the menu-surface has been hoisted to the body, it's no longer relative
267
- // to the anchor element
268
- if (this.isHoistedElement || this.isFixedPosition) {
269
- this.adjustPositionForHoistedElement(position);
270
- }
271
- this.adapter.setTransformOrigin(`${horizontalAlignment} ${verticalAlignment}`);
272
- this.adapter.setPosition(position);
273
- this.adapter.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : '');
274
- // If it is opened from the top then add is-open-below class
275
- if (!this.hasBit(corner, CornerBit.BOTTOM)) {
276
- this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
277
- }
278
- }
279
- /**
280
- * @return Measurements used to position menu surface popup.
281
- */
282
- getAutoLayoutmeasurements() {
283
- let anchorRect = this.adapter.getAnchorDimensions();
284
- const bodySize = this.adapter.getBodyDimensions();
285
- const viewportSize = this.adapter.getWindowDimensions();
286
- const windowScroll = this.adapter.getWindowScroll();
287
- if (!anchorRect) {
288
- // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
289
- anchorRect = {
290
- top: this.position.y,
291
- right: this.position.x,
292
- bottom: this.position.y,
293
- left: this.position.x,
294
- width: 0,
295
- height: 0,
296
- };
297
- // tslint:enable:object-literal-sort-keys
298
- }
299
- return {
300
- anchorSize: anchorRect,
301
- bodySize,
302
- surfaceSize: this.dimensions,
303
- viewportDistance: {
304
- // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
305
- top: anchorRect.top,
306
- right: viewportSize.width - anchorRect.right,
307
- bottom: viewportSize.height - anchorRect.bottom,
308
- left: anchorRect.left,
309
- // tslint:enable:object-literal-sort-keys
310
- },
311
- viewportSize,
312
- windowScroll,
313
- };
314
- }
315
- /**
316
- * Computes the corner of the anchor from which to animate and position the
317
- * menu surface.
318
- *
319
- * Only LEFT or RIGHT bit is used to position the menu surface ignoring RTL
320
- * context. E.g., menu surface will be positioned from right side on TOP_END.
321
- */
322
- getOriginCorner() {
323
- let corner = this.originCorner;
324
- const { viewportDistance, anchorSize, surfaceSize } = this.measurements;
325
- const { MARGIN_TO_EDGE } = MDCMenuSurfaceFoundation.numbers;
326
- const isAnchoredToBottom = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);
327
- let availableTop;
328
- let availableBottom;
329
- if (isAnchoredToBottom) {
330
- availableTop =
331
- viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.bottom;
332
- availableBottom =
333
- viewportDistance.bottom - MARGIN_TO_EDGE - this.anchorMargin.bottom;
334
- }
335
- else {
336
- availableTop =
337
- viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.top;
338
- availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE +
339
- anchorSize.height - this.anchorMargin.top;
340
- }
341
- const isAvailableBottom = availableBottom - surfaceSize.height > 0;
342
- if (!isAvailableBottom &&
343
- availableTop > availableBottom + this.openBottomBias) {
344
- // Attach bottom side of surface to the anchor.
345
- corner = this.setBit(corner, CornerBit.BOTTOM);
346
- }
347
- const isRtl = this.adapter.isRtl();
348
- const isFlipRtl = this.hasBit(this.anchorCorner, CornerBit.FLIP_RTL);
349
- const hasRightBit = this.hasBit(this.anchorCorner, CornerBit.RIGHT) ||
350
- this.hasBit(corner, CornerBit.RIGHT);
351
- // Whether surface attached to right side of anchor element.
352
- let isAnchoredToRight = false;
353
- // Anchored to start
354
- if (isRtl && isFlipRtl) {
355
- isAnchoredToRight = !hasRightBit;
356
- }
357
- else {
358
- // Anchored to right
359
- isAnchoredToRight = hasRightBit;
360
- }
361
- let availableLeft;
362
- let availableRight;
363
- if (isAnchoredToRight) {
364
- availableLeft =
365
- viewportDistance.left + anchorSize.width + this.anchorMargin.right;
366
- availableRight = viewportDistance.right - this.anchorMargin.right;
367
- }
368
- else {
369
- availableLeft = viewportDistance.left + this.anchorMargin.left;
370
- availableRight =
371
- viewportDistance.right + anchorSize.width - this.anchorMargin.left;
372
- }
373
- const isAvailableLeft = availableLeft - surfaceSize.width > 0;
374
- const isAvailableRight = availableRight - surfaceSize.width > 0;
375
- const isOriginCornerAlignedToEnd = this.hasBit(corner, CornerBit.FLIP_RTL) &&
376
- this.hasBit(corner, CornerBit.RIGHT);
377
- if (isAvailableRight && isOriginCornerAlignedToEnd && isRtl ||
378
- !isAvailableLeft && isOriginCornerAlignedToEnd) {
379
- // Attach left side of surface to the anchor.
380
- corner = this.unsetBit(corner, CornerBit.RIGHT);
381
- }
382
- else if (isAvailableLeft && isAnchoredToRight && isRtl ||
383
- (isAvailableLeft && !isAnchoredToRight && hasRightBit) ||
384
- (!isAvailableRight && availableLeft >= availableRight)) {
385
- // Attach right side of surface to the anchor.
386
- corner = this.setBit(corner, CornerBit.RIGHT);
387
- }
388
- return corner;
389
- }
390
- /**
391
- * @param corner Origin corner of the menu surface.
392
- * @return Maximum height of the menu surface, based on available space. 0
393
- * indicates should not be set.
394
- */
395
- getMenuSurfaceMaxHeight(corner) {
396
- if (this.maxHeight > 0) {
397
- return this.maxHeight;
398
- }
399
- const { viewportDistance } = this.measurements;
400
- let maxHeight = 0;
401
- const isBottomAligned = this.hasBit(corner, CornerBit.BOTTOM);
402
- const isBottomAnchored = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);
403
- const { MARGIN_TO_EDGE } = MDCMenuSurfaceFoundation.numbers;
404
- // When maximum height is not specified, it is handled from CSS.
405
- if (isBottomAligned) {
406
- maxHeight = viewportDistance.top + this.anchorMargin.top - MARGIN_TO_EDGE;
407
- if (!isBottomAnchored) {
408
- maxHeight += this.measurements.anchorSize.height;
409
- }
410
- }
411
- else {
412
- maxHeight = viewportDistance.bottom - this.anchorMargin.bottom +
413
- this.measurements.anchorSize.height - MARGIN_TO_EDGE;
414
- if (isBottomAnchored) {
415
- maxHeight -= this.measurements.anchorSize.height;
416
- }
417
- }
418
- return maxHeight;
419
- }
420
- /**
421
- * @param corner Origin corner of the menu surface.
422
- * @return Horizontal offset of menu surface origin corner from corresponding
423
- * anchor corner.
424
- */
425
- getHorizontalOriginOffset(corner) {
426
- const { anchorSize } = this.measurements;
427
- // isRightAligned corresponds to using the 'right' property on the surface.
428
- const isRightAligned = this.hasBit(corner, CornerBit.RIGHT);
429
- const avoidHorizontalOverlap = this.hasBit(this.anchorCorner, CornerBit.RIGHT);
430
- if (isRightAligned) {
431
- const rightOffset = avoidHorizontalOverlap ?
432
- anchorSize.width - this.anchorMargin.left :
433
- this.anchorMargin.right;
434
- // For hoisted or fixed elements, adjust the offset by the difference
435
- // between viewport width and body width so when we calculate the right
436
- // value (`adjustPositionForHoistedElement`) based on the element
437
- // position, the right property is correct.
438
- if (this.isHoistedElement || this.isFixedPosition) {
439
- return rightOffset -
440
- (this.measurements.viewportSize.width -
441
- this.measurements.bodySize.width);
442
- }
443
- return rightOffset;
444
- }
445
- return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.right :
446
- this.anchorMargin.left;
447
- }
448
- /**
449
- * @param corner Origin corner of the menu surface.
450
- * @return Vertical offset of menu surface origin corner from corresponding
451
- * anchor corner.
452
- */
453
- getVerticalOriginOffset(corner) {
454
- const { anchorSize } = this.measurements;
455
- const isBottomAligned = this.hasBit(corner, CornerBit.BOTTOM);
456
- const avoidVerticalOverlap = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);
457
- let y = 0;
458
- if (isBottomAligned) {
459
- y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin.top :
460
- -this.anchorMargin.bottom;
461
- }
462
- else {
463
- y = avoidVerticalOverlap ?
464
- (anchorSize.height + this.anchorMargin.bottom) :
465
- this.anchorMargin.top;
466
- }
467
- return y;
468
- }
469
- /**
470
- * Calculates the offsets for positioning the menu-surface when the
471
- * menu-surface has been hoisted to the body.
472
- */
473
- adjustPositionForHoistedElement(position) {
474
- const { windowScroll, viewportDistance, surfaceSize, viewportSize } = this.measurements;
475
- const props = Object.keys(position);
476
- for (const prop of props) {
477
- let value = position[prop] || 0;
478
- if (this.isHorizontallyCenteredOnViewport &&
479
- (prop === 'left' || prop === 'right')) {
480
- position[prop] = (viewportSize.width - surfaceSize.width) / 2;
481
- continue;
482
- }
483
- // Hoisted surfaces need to have the anchor elements location on the page
484
- // added to the position properties for proper alignment on the body.
485
- value += viewportDistance[prop];
486
- // Surfaces that are absolutely positioned need to have additional
487
- // calculations for scroll and bottom positioning.
488
- if (!this.isFixedPosition) {
489
- if (prop === 'top') {
490
- value += windowScroll.y;
491
- }
492
- else if (prop === 'bottom') {
493
- value -= windowScroll.y;
494
- }
495
- else if (prop === 'left') {
496
- value += windowScroll.x;
497
- }
498
- else { // prop === 'right'
499
- value -= windowScroll.x;
500
- }
501
- }
502
- position[prop] = value;
503
- }
504
- }
505
- /**
506
- * The last focused element when the menu surface was opened should regain
507
- * focus, if the user is focused on or within the menu surface when it is
508
- * closed.
509
- */
510
- maybeRestoreFocus() {
511
- const isRootFocused = this.adapter.isFocused();
512
- const ownerDocument = this.adapter.getOwnerDocument ?
513
- this.adapter.getOwnerDocument() :
514
- document;
515
- const childHasFocus = ownerDocument.activeElement &&
516
- this.adapter.isElementInContainer(ownerDocument.activeElement);
517
- if (isRootFocused || childHasFocus) {
518
- // Wait before restoring focus when closing the menu surface. This is
519
- // important because if a touch event triggered the menu close, and the
520
- // subsequent mouse event occurs after focus is restored, then the
521
- // restored focus would be lost.
522
- setTimeout(() => {
523
- this.adapter.restoreFocus();
524
- }, numbers.TOUCH_EVENT_WAIT_MS);
525
- }
526
- }
527
- hasBit(corner, bit) {
528
- return Boolean(corner & bit); // tslint:disable-line:no-bitwise
529
- }
530
- setBit(corner, bit) {
531
- return corner | bit; // tslint:disable-line:no-bitwise
532
- }
533
- unsetBit(corner, bit) {
534
- return corner ^ bit;
535
- }
536
- /**
537
- * isFinite that doesn't force conversion to number type.
538
- * Equivalent to Number.isFinite in ES2015, which is not supported in IE.
539
- */
540
- isFinite(num) {
541
- return typeof num === 'number' && isFinite(num);
542
- }
543
- }
544
- //# sourceMappingURL=foundation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"foundation.js","sourceRoot":"","sources":["foundation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAY/E,MAAM,OAAO,wBAAwB;IACnC,MAAM,KAAK,UAAU;QACnB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,KAAK,OAAO;QAChB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,KAAK,OAAO;QAChB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,MAAM,KAAK,cAAc;QACvB,wGAAwG;QACxG,OAAO;YACL,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS;YACzB,WAAW,EAAE,GAAG,EAAE,CAAC,SAAS;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AQ,CAAC,MAAc,EAAE,GAAc;QAC7C,OAAO,MAAM,GAAG,GAAG,CAAC;IACtB,CAAC;IAED;;;OAGG;IACK,QAAQ,CAAC,GAAW;QAC1B,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {MDCMenuSurfaceAdapter} from './adapter.js';\nimport {Corner, CornerBit, cssClasses, numbers, strings} from './constants.js';\nimport {MDCMenuDimensions, MDCMenuDistance, MDCMenuPoint} from './types.js';\n\ninterface AutoLayoutMeasurements {\n anchorSize: MDCMenuDimensions;\n bodySize: MDCMenuDimensions;\n surfaceSize: MDCMenuDimensions;\n viewportDistance: MDCMenuDistance;\n viewportSize: MDCMenuDimensions;\n windowScroll: MDCMenuPoint;\n}\n\nexport class MDCMenuSurfaceFoundation {\n static get cssClasses() {\n return cssClasses;\n }\n\n static get strings() {\n return strings;\n }\n\n static get numbers() {\n return numbers;\n }\n\n static get Corner() {\n return Corner;\n }\n\n /**\n * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types.\n */\n static get defaultAdapter(): MDCMenuSurfaceAdapter {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClass: () => undefined,\n removeClass: () => undefined,\n hasClass: () => false,\n hasAnchor: () => false,\n\n isElementInContainer: () => false,\n isFocused: () => false,\n isRtl: () => false,\n\n getInnerDimensions: () => ({height: 0, width: 0}),\n getAnchorDimensions: () => null,\n getWindowDimensions: () => ({height: 0, width: 0}),\n getBodyDimensions: () => ({height: 0, width: 0}),\n getWindowScroll: () => ({x: 0, y: 0}),\n setPosition: () => undefined,\n setMaxHeight: () => undefined,\n setTransformOrigin: () => undefined,\n\n saveFocus: () => undefined,\n restoreFocus: () => undefined,\n\n notifyClose: () => undefined,\n notifyClosing: () => undefined,\n notifyOpen: () => undefined,\n notifyOpening: () => undefined,\n };\n // tslint:enable:object-literal-sort-keys\n }\n\n private readonly adapter: MDCMenuSurfaceAdapter;\n private isSurfaceOpen = false;\n private isQuickOpen = false;\n private isHoistedElement = false;\n private isFixedPosition = false;\n private isHorizontallyCenteredOnViewport = false;\n\n private maxHeight = 0;\n private openBottomBias = 0;\n\n private openAnimationEndTimerId = 0;\n private closeAnimationEndTimerId = 0;\n private animationRequestId = 0;\n\n private anchorCorner: Corner = Corner.TOP_START;\n\n /**\n * Corner of the menu surface to which menu surface is attached to anchor.\n *\n * Anchor corner --->+----------+\n * | ANCHOR |\n * +----------+\n * Origin corner --->+--------------+\n * | |\n * | |\n * | MENU SURFACE |\n * | |\n * | |\n * +--------------+\n */\n private originCorner: Corner = Corner.TOP_START;\n private readonly anchorMargin:\n MDCMenuDistance = {top: 0, right: 0, bottom: 0, left: 0};\n private readonly position: MDCMenuPoint = {x: 0, y: 0};\n\n private dimensions!: MDCMenuDimensions; // assigned in open()\n private measurements!: AutoLayoutMeasurements; // assigned in open()\n\n constructor(adapter: Partial<MDCMenuSurfaceAdapter>) {\n this.adapter = {...MDCMenuSurfaceFoundation.defaultAdapter, ...adapter};\n }\n\n init() {\n const {ROOT, OPEN} = MDCMenuSurfaceFoundation.cssClasses;\n\n if (!this.adapter.hasClass(ROOT)) {\n throw new Error(`${ROOT} class required in root element.`);\n }\n\n if (this.adapter.hasClass(OPEN)) {\n this.isSurfaceOpen = true;\n }\n }\n\n destroy() {\n clearTimeout(this.openAnimationEndTimerId);\n clearTimeout(this.closeAnimationEndTimerId);\n // Cancel any currently running animations.\n cancelAnimationFrame(this.animationRequestId);\n }\n\n /**\n * @param corner Default anchor corner alignment of top-left menu surface\n * corner.\n */\n setAnchorCorner(corner: Corner) {\n this.anchorCorner = corner;\n }\n\n /**\n * Flips menu corner horizontally.\n */\n flipCornerHorizontally() {\n this.originCorner = this.originCorner ^ CornerBit.RIGHT;\n }\n\n /**\n * @param margin Set of margin values from anchor.\n */\n setAnchorMargin(margin: Partial<MDCMenuDistance>) {\n this.anchorMargin.top = margin.top || 0;\n this.anchorMargin.right = margin.right || 0;\n this.anchorMargin.bottom = margin.bottom || 0;\n this.anchorMargin.left = margin.left || 0;\n }\n\n /** Used to indicate if the menu-surface is hoisted to the body. */\n setIsHoisted(isHoisted: boolean) {\n this.isHoistedElement = isHoisted;\n }\n\n /**\n * Used to set the menu-surface calculations based on a fixed position menu.\n */\n setFixedPosition(isFixedPosition: boolean) {\n this.isFixedPosition = isFixedPosition;\n }\n\n /**\n * @return Returns true if menu is in fixed (`position: fixed`) position.\n */\n isFixed() {\n return this.isFixedPosition;\n }\n\n /** Sets the menu-surface position on the page. */\n setAbsolutePosition(x: number, y: number) {\n this.position.x = this.isFinite(x) ? x : 0;\n this.position.y = this.isFinite(y) ? y : 0;\n }\n\n /** Sets whether menu-surface should be horizontally centered to viewport. */\n setIsHorizontallyCenteredOnViewport(isCentered: boolean) {\n this.isHorizontallyCenteredOnViewport = isCentered;\n }\n\n setQuickOpen(quickOpen: boolean) {\n this.isQuickOpen = quickOpen;\n }\n\n /**\n * Sets maximum menu-surface height on open.\n * @param maxHeight The desired max-height. Set to 0 (default) to\n * automatically calculate max height based on available viewport space.\n */\n setMaxHeight(maxHeight: number) {\n this.maxHeight = maxHeight;\n }\n\n /**\n * Set to a positive integer to influence the menu to preferentially open\n * below the anchor instead of above.\n * @param bias A value of `x` simulates an extra `x` pixels of available space\n * below the menu during positioning calculations.\n */\n setOpenBottomBias(bias: number) {\n this.openBottomBias = bias;\n }\n\n isOpen() {\n return this.isSurfaceOpen;\n }\n\n /**\n * Open the menu surface.\n */\n open() {\n if (this.isSurfaceOpen) {\n return;\n }\n\n this.adapter.notifyOpening();\n this.adapter.saveFocus();\n\n if (this.isQuickOpen) {\n this.isSurfaceOpen = true;\n this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);\n this.dimensions = this.adapter.getInnerDimensions();\n this.autoposition();\n this.adapter.notifyOpen();\n } else {\n this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);\n this.animationRequestId = requestAnimationFrame(() => {\n this.dimensions = this.adapter.getInnerDimensions();\n this.autoposition();\n this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);\n this.openAnimationEndTimerId = setTimeout(() => {\n this.openAnimationEndTimerId = 0;\n this.adapter.removeClass(\n MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);\n this.adapter.notifyOpen();\n }, numbers.TRANSITION_OPEN_DURATION);\n });\n\n this.isSurfaceOpen = true;\n }\n }\n\n /**\n * Closes the menu surface.\n */\n close(skipRestoreFocus = false) {\n if (!this.isSurfaceOpen) {\n return;\n }\n\n this.adapter.notifyClosing();\n\n if (this.isQuickOpen) {\n this.isSurfaceOpen = false;\n if (!skipRestoreFocus) {\n this.maybeRestoreFocus();\n }\n\n this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);\n this.adapter.removeClass(\n MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);\n this.adapter.notifyClose();\n\n return;\n }\n\n this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);\n requestAnimationFrame(() => {\n this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);\n this.adapter.removeClass(\n MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);\n this.closeAnimationEndTimerId = setTimeout(() => {\n this.closeAnimationEndTimerId = 0;\n this.adapter.removeClass(\n MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);\n this.adapter.notifyClose();\n }, numbers.TRANSITION_CLOSE_DURATION);\n });\n\n this.isSurfaceOpen = false;\n if (!skipRestoreFocus) {\n this.maybeRestoreFocus();\n }\n }\n\n /** Handle clicks and close if not within menu-surface element. */\n handleBodyClick(evt: MouseEvent) {\n const el = evt.target as Element;\n if (this.adapter.isElementInContainer(el)) {\n return;\n }\n this.close();\n }\n\n /** Handle keys that close the surface. */\n handleKeydown(evt: KeyboardEvent) {\n const {keyCode, key} = evt;\n\n const isEscape = key === 'Escape' || keyCode === 27;\n if (isEscape) {\n this.close();\n }\n }\n\n private autoposition() {\n // Compute measurements for autoposition methods reuse.\n this.measurements = this.getAutoLayoutmeasurements();\n\n const corner = this.getOriginCorner();\n const maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight(corner);\n const verticalAlignment =\n this.hasBit(corner, CornerBit.BOTTOM) ? 'bottom' : 'top';\n let horizontalAlignment =\n this.hasBit(corner, CornerBit.RIGHT) ? 'right' : 'left';\n const horizontalOffset = this.getHorizontalOriginOffset(corner);\n const verticalOffset = this.getVerticalOriginOffset(corner);\n const {anchorSize, surfaceSize} = this.measurements;\n\n const position: Partial<MDCMenuDistance> = {\n [horizontalAlignment]: horizontalOffset,\n [verticalAlignment]: verticalOffset,\n };\n\n // Center align when anchor width is comparable or greater than menu\n // surface, otherwise keep corner.\n if (anchorSize.width / surfaceSize.width >\n numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {\n horizontalAlignment = 'center';\n }\n\n // If the menu-surface has been hoisted to the body, it's no longer relative\n // to the anchor element\n if (this.isHoistedElement || this.isFixedPosition) {\n this.adjustPositionForHoistedElement(position);\n }\n\n this.adapter.setTransformOrigin(\n `${horizontalAlignment} ${verticalAlignment}`);\n this.adapter.setPosition(position);\n this.adapter.setMaxHeight(\n maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : '');\n\n // If it is opened from the top then add is-open-below class\n if (!this.hasBit(corner, CornerBit.BOTTOM)) {\n this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);\n }\n }\n\n /**\n * @return Measurements used to position menu surface popup.\n */\n private getAutoLayoutmeasurements(): AutoLayoutMeasurements {\n let anchorRect = this.adapter.getAnchorDimensions();\n const bodySize = this.adapter.getBodyDimensions();\n const viewportSize = this.adapter.getWindowDimensions();\n const windowScroll = this.adapter.getWindowScroll();\n\n if (!anchorRect) {\n // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together\n anchorRect = {\n top: this.position.y,\n right: this.position.x,\n bottom: this.position.y,\n left: this.position.x,\n width: 0,\n height: 0,\n } as any;\n // tslint:enable:object-literal-sort-keys\n }\n\n return {\n anchorSize: anchorRect!,\n bodySize,\n surfaceSize: this.dimensions,\n viewportDistance: {\n // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together\n top: anchorRect!.top,\n right: viewportSize.width - anchorRect!.right,\n bottom: viewportSize.height - anchorRect!.bottom,\n left: anchorRect!.left,\n // tslint:enable:object-literal-sort-keys\n },\n viewportSize,\n windowScroll,\n };\n }\n\n /**\n * Computes the corner of the anchor from which to animate and position the\n * menu surface.\n *\n * Only LEFT or RIGHT bit is used to position the menu surface ignoring RTL\n * context. E.g., menu surface will be positioned from right side on TOP_END.\n */\n private getOriginCorner(): Corner {\n let corner = this.originCorner;\n\n const {viewportDistance, anchorSize, surfaceSize} = this.measurements;\n const {MARGIN_TO_EDGE} = MDCMenuSurfaceFoundation.numbers;\n\n const isAnchoredToBottom = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);\n\n let availableTop;\n let availableBottom;\n if (isAnchoredToBottom) {\n availableTop =\n viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.bottom;\n availableBottom =\n viewportDistance.bottom - MARGIN_TO_EDGE - this.anchorMargin.bottom;\n } else {\n availableTop =\n viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.top;\n availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE +\n anchorSize.height - this.anchorMargin.top;\n }\n\n const isAvailableBottom = availableBottom - surfaceSize.height > 0;\n if (!isAvailableBottom &&\n availableTop > availableBottom + this.openBottomBias) {\n // Attach bottom side of surface to the anchor.\n corner = this.setBit(corner, CornerBit.BOTTOM);\n }\n\n const isRtl = this.adapter.isRtl();\n const isFlipRtl = this.hasBit(this.anchorCorner, CornerBit.FLIP_RTL);\n const hasRightBit = this.hasBit(this.anchorCorner, CornerBit.RIGHT) ||\n this.hasBit(corner, CornerBit.RIGHT);\n\n // Whether surface attached to right side of anchor element.\n let isAnchoredToRight = false;\n\n // Anchored to start\n if (isRtl && isFlipRtl) {\n isAnchoredToRight = !hasRightBit;\n } else {\n // Anchored to right\n isAnchoredToRight = hasRightBit;\n }\n\n let availableLeft;\n let availableRight;\n if (isAnchoredToRight) {\n availableLeft =\n viewportDistance.left + anchorSize.width + this.anchorMargin.right;\n availableRight = viewportDistance.right - this.anchorMargin.right;\n } else {\n availableLeft = viewportDistance.left + this.anchorMargin.left;\n availableRight =\n viewportDistance.right + anchorSize.width - this.anchorMargin.left;\n }\n\n const isAvailableLeft = availableLeft - surfaceSize.width > 0;\n const isAvailableRight = availableRight - surfaceSize.width > 0;\n const isOriginCornerAlignedToEnd =\n this.hasBit(corner, CornerBit.FLIP_RTL) &&\n this.hasBit(corner, CornerBit.RIGHT);\n\n if (isAvailableRight && isOriginCornerAlignedToEnd && isRtl ||\n !isAvailableLeft && isOriginCornerAlignedToEnd) {\n // Attach left side of surface to the anchor.\n corner = this.unsetBit(corner, CornerBit.RIGHT);\n } else if (\n isAvailableLeft && isAnchoredToRight && isRtl ||\n (isAvailableLeft && !isAnchoredToRight && hasRightBit) ||\n (!isAvailableRight && availableLeft >= availableRight)) {\n // Attach right side of surface to the anchor.\n corner = this.setBit(corner, CornerBit.RIGHT);\n }\n\n return corner;\n }\n\n /**\n * @param corner Origin corner of the menu surface.\n * @return Maximum height of the menu surface, based on available space. 0\n * indicates should not be set.\n */\n private getMenuSurfaceMaxHeight(corner: Corner): number {\n if (this.maxHeight > 0) {\n return this.maxHeight;\n }\n\n const {viewportDistance} = this.measurements;\n\n let maxHeight = 0;\n const isBottomAligned = this.hasBit(corner, CornerBit.BOTTOM);\n const isBottomAnchored = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);\n const {MARGIN_TO_EDGE} = MDCMenuSurfaceFoundation.numbers;\n\n // When maximum height is not specified, it is handled from CSS.\n if (isBottomAligned) {\n maxHeight = viewportDistance.top + this.anchorMargin.top - MARGIN_TO_EDGE;\n if (!isBottomAnchored) {\n maxHeight += this.measurements.anchorSize.height;\n }\n } else {\n maxHeight = viewportDistance.bottom - this.anchorMargin.bottom +\n this.measurements.anchorSize.height - MARGIN_TO_EDGE;\n if (isBottomAnchored) {\n maxHeight -= this.measurements.anchorSize.height;\n }\n }\n\n return maxHeight;\n }\n\n /**\n * @param corner Origin corner of the menu surface.\n * @return Horizontal offset of menu surface origin corner from corresponding\n * anchor corner.\n */\n private getHorizontalOriginOffset(corner: Corner): number {\n const {anchorSize} = this.measurements;\n\n // isRightAligned corresponds to using the 'right' property on the surface.\n const isRightAligned = this.hasBit(corner, CornerBit.RIGHT);\n const avoidHorizontalOverlap =\n this.hasBit(this.anchorCorner, CornerBit.RIGHT);\n\n if (isRightAligned) {\n const rightOffset = avoidHorizontalOverlap ?\n anchorSize.width - this.anchorMargin.left :\n this.anchorMargin.right;\n\n // For hoisted or fixed elements, adjust the offset by the difference\n // between viewport width and body width so when we calculate the right\n // value (`adjustPositionForHoistedElement`) based on the element\n // position, the right property is correct.\n if (this.isHoistedElement || this.isFixedPosition) {\n return rightOffset -\n (this.measurements.viewportSize.width -\n this.measurements.bodySize.width);\n }\n\n return rightOffset;\n }\n\n return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.right :\n this.anchorMargin.left;\n }\n\n /**\n * @param corner Origin corner of the menu surface.\n * @return Vertical offset of menu surface origin corner from corresponding\n * anchor corner.\n */\n private getVerticalOriginOffset(corner: Corner): number {\n const {anchorSize} = this.measurements;\n const isBottomAligned = this.hasBit(corner, CornerBit.BOTTOM);\n const avoidVerticalOverlap =\n this.hasBit(this.anchorCorner, CornerBit.BOTTOM);\n\n let y = 0;\n if (isBottomAligned) {\n y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin.top :\n -this.anchorMargin.bottom;\n } else {\n y = avoidVerticalOverlap ?\n (anchorSize.height + this.anchorMargin.bottom) :\n this.anchorMargin.top;\n }\n return y;\n }\n\n /**\n * Calculates the offsets for positioning the menu-surface when the\n * menu-surface has been hoisted to the body.\n */\n private adjustPositionForHoistedElement(position: Partial<MDCMenuDistance>) {\n const {windowScroll, viewportDistance, surfaceSize, viewportSize} =\n this.measurements;\n\n const props =\n Object.keys(position) as Array<keyof Partial<MDCMenuDistance>>;\n\n for (const prop of props) {\n let value = position[prop] || 0;\n\n if (this.isHorizontallyCenteredOnViewport &&\n (prop === 'left' || prop === 'right')) {\n position[prop] = (viewportSize.width - surfaceSize.width) / 2;\n continue;\n }\n\n // Hoisted surfaces need to have the anchor elements location on the page\n // added to the position properties for proper alignment on the body.\n value += viewportDistance[prop];\n\n // Surfaces that are absolutely positioned need to have additional\n // calculations for scroll and bottom positioning.\n if (!this.isFixedPosition) {\n if (prop === 'top') {\n value += windowScroll.y;\n } else if (prop === 'bottom') {\n value -= windowScroll.y;\n } else if (prop === 'left') {\n value += windowScroll.x;\n } else { // prop === 'right'\n value -= windowScroll.x;\n }\n }\n\n position[prop] = value;\n }\n }\n\n /**\n * The last focused element when the menu surface was opened should regain\n * focus, if the user is focused on or within the menu surface when it is\n * closed.\n */\n private maybeRestoreFocus() {\n const isRootFocused = this.adapter.isFocused();\n const ownerDocument = this.adapter.getOwnerDocument ?\n this.adapter.getOwnerDocument() :\n document;\n const childHasFocus = ownerDocument.activeElement &&\n this.adapter.isElementInContainer(ownerDocument.activeElement);\n if (isRootFocused || childHasFocus) {\n // Wait before restoring focus when closing the menu surface. This is\n // important because if a touch event triggered the menu close, and the\n // subsequent mouse event occurs after focus is restored, then the\n // restored focus would be lost.\n setTimeout(() => {\n this.adapter.restoreFocus();\n }, numbers.TOUCH_EVENT_WAIT_MS);\n }\n }\n\n private hasBit(corner: Corner, bit: CornerBit): boolean {\n return Boolean(corner & bit); // tslint:disable-line:no-bitwise\n }\n\n private setBit(corner: Corner, bit: CornerBit): Corner {\n return corner | bit; // tslint:disable-line:no-bitwise\n }\n\n private unsetBit(corner: Corner, bit: CornerBit): Corner {\n return corner ^ bit;\n }\n\n /**\n * isFinite that doesn't force conversion to number type.\n * Equivalent to Number.isFinite in ES2015, which is not supported in IE.\n */\n private isFinite(num: number): boolean {\n return typeof num === 'number' && isFinite(num);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- export declare const styles: import("lit").CSSResult;
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2022 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { css } from 'lit';
7
- export const styles = css `:host{--_container-elevation: var(--md-menu-surface-container-elevation, 2);--_container-shadow-color: var(--md-menu-surface-container-shadow-color, var(--md-sys-color-shadow, #000));--_container-shape: var(--md-menu-surface-container-shape, 4px);--_container-surface-tint-layer-color: var(--md-menu-surface-container-surface-tint-layer-color, var(--md-sys-color-primary, #6750a4))}.md3-menu-surface{border-radius:var(--_container-shape);box-sizing:border-box;display:none;opacity:0;overflow:auto;margin:0;max-height:calc(100vh - 32px);max-width:calc(100vw - 32px);padding:0;position:absolute;transform:scale(1);transform-origin:top left;transition:opacity .03s linear,transform .12s cubic-bezier(0, 0, 0.2, 1),height 250ms cubic-bezier(0, 0, 0.2, 1);will-change:transform,opacity;z-index:8;--md-elevation-level:var(--_container-elevation);--md-elevation-shadow-color:var(--_container-shadow-color);--md-elevation-surface-tint:var(--_container-surface-tint-layer-color)}.md3-menu-surface md-elevation{z-index:0}.md3-menu-surface:focus{outline:none}.md3-menu-surface--animating-open{display:inline-block;opacity:0;transform:scale(0.8)}.md3-menu-surface--open{display:inline-block;opacity:1;transform:scale(1)}.md3-menu-surface--animating-closed{display:inline-block;opacity:0;transition:opacity .075s linear}.md3-menu-surface--anchor{overflow:visible;position:relative}.md3-menu-surface--fixed{position:fixed}.md3-menu-surface--fullwidth{width:100%}.md3-menu-surface--is-open-below{border-top-left-radius:0px;border-top-right-radius:0px}/*# sourceMappingURL=menu-surface-styles.css.map */
8
- `;
9
- //# sourceMappingURL=menu-surface-styles.css.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"menu-surface-styles.css.js","sourceRoot":"","sources":["menu-surface-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--_container-elevation: var(--md-menu-surface-container-elevation, 2);--_container-shadow-color: var(--md-menu-surface-container-shadow-color, var(--md-sys-color-shadow, #000));--_container-shape: var(--md-menu-surface-container-shape, 4px);--_container-surface-tint-layer-color: var(--md-menu-surface-container-surface-tint-layer-color, var(--md-sys-color-primary, #6750a4))}.md3-menu-surface{border-radius:var(--_container-shape);box-sizing:border-box;display:none;opacity:0;overflow:auto;margin:0;max-height:calc(100vh - 32px);max-width:calc(100vw - 32px);padding:0;position:absolute;transform:scale(1);transform-origin:top left;transition:opacity .03s linear,transform .12s cubic-bezier(0, 0, 0.2, 1),height 250ms cubic-bezier(0, 0, 0.2, 1);will-change:transform,opacity;z-index:8;--md-elevation-level:var(--_container-elevation);--md-elevation-shadow-color:var(--_container-shadow-color);--md-elevation-surface-tint:var(--_container-surface-tint-layer-color)}.md3-menu-surface md-elevation{z-index:0}.md3-menu-surface:focus{outline:none}.md3-menu-surface--animating-open{display:inline-block;opacity:0;transform:scale(0.8)}.md3-menu-surface--open{display:inline-block;opacity:1;transform:scale(1)}.md3-menu-surface--animating-closed{display:inline-block;opacity:0;transition:opacity .075s linear}.md3-menu-surface--anchor{overflow:visible;position:relative}.md3-menu-surface--fixed{position:fixed}.md3-menu-surface--fullwidth{width:100%}.md3-menu-surface--is-open-below{border-top-left-radius:0px;border-top-right-radius:0px}/*# sourceMappingURL=menu-surface-styles.css.map */\n`;\n "]}