@material/web 1.0.1 → 1.0.2-nightly.33c1afe.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (335) hide show
  1. package/all.d.ts +2 -0
  2. package/all.js +2 -0
  3. package/all.js.map +1 -1
  4. package/button/elevated-button.js +5 -1
  5. package/button/elevated-button.js.map +1 -1
  6. package/button/internal/_elevation.scss +32 -32
  7. package/button/internal/_icon.scss +22 -23
  8. package/button/internal/_outlined-button.scss +21 -19
  9. package/button/internal/_shared.scss +84 -77
  10. package/button/internal/_touch-target.scss +4 -0
  11. package/button/internal/button.d.ts +7 -11
  12. package/button/internal/button.js +52 -38
  13. package/button/internal/button.js.map +1 -1
  14. package/button/internal/elevated-button.d.ts +1 -1
  15. package/button/internal/elevated-button.js +1 -1
  16. package/button/internal/elevated-button.js.map +1 -1
  17. package/button/internal/filled-button.d.ts +1 -1
  18. package/button/internal/filled-button.js +1 -1
  19. package/button/internal/filled-button.js.map +1 -1
  20. package/button/internal/filled-tonal-button.d.ts +1 -1
  21. package/button/internal/filled-tonal-button.js +1 -1
  22. package/button/internal/filled-tonal-button.js.map +1 -1
  23. package/button/internal/outlined-button.d.ts +1 -1
  24. package/button/internal/outlined-button.js +2 -2
  25. package/button/internal/outlined-button.js.map +1 -1
  26. package/button/internal/outlined-styles.css.js +1 -1
  27. package/button/internal/outlined-styles.css.js.map +1 -1
  28. package/button/internal/shared-elevation-styles.css.js +1 -1
  29. package/button/internal/shared-elevation-styles.css.js.map +1 -1
  30. package/button/internal/shared-styles.css.js +1 -1
  31. package/button/internal/shared-styles.css.js.map +1 -1
  32. package/checkbox/internal/checkbox.d.ts +20 -87
  33. package/checkbox/internal/checkbox.js +35 -153
  34. package/checkbox/internal/checkbox.js.map +1 -1
  35. package/chips/filter-chip.js +5 -1
  36. package/chips/filter-chip.js.map +1 -1
  37. package/chips/harness.js.map +1 -1
  38. package/chips/input-chip.js +6 -1
  39. package/chips/input-chip.js.map +1 -1
  40. package/chips/internal/_shared.scss +1 -0
  41. package/chips/internal/assist-chip.js +8 -4
  42. package/chips/internal/assist-chip.js.map +1 -1
  43. package/chips/internal/chip-set.js +6 -4
  44. package/chips/internal/chip-set.js.map +1 -1
  45. package/chips/internal/chip.d.ts +3 -0
  46. package/chips/internal/chip.js +7 -5
  47. package/chips/internal/chip.js.map +1 -1
  48. package/chips/internal/filter-chip.d.ts +2 -0
  49. package/chips/internal/filter-chip.js +11 -5
  50. package/chips/internal/filter-chip.js.map +1 -1
  51. package/chips/internal/input-chip.d.ts +2 -0
  52. package/chips/internal/input-chip.js +10 -4
  53. package/chips/internal/input-chip.js.map +1 -1
  54. package/chips/internal/multi-action-chip.js.map +1 -1
  55. package/chips/internal/shared-styles.css.js +1 -1
  56. package/chips/internal/shared-styles.css.js.map +1 -1
  57. package/chips/internal/trailing-icons.d.ts +1 -1
  58. package/chips/internal/trailing-icons.js +6 -5
  59. package/chips/internal/trailing-icons.js.map +1 -1
  60. package/common.d.ts +2 -0
  61. package/common.js +2 -0
  62. package/common.js.map +1 -1
  63. package/dialog/harness.js +1 -2
  64. package/dialog/harness.js.map +1 -1
  65. package/dialog/internal/_dialog.scss +1 -1
  66. package/dialog/internal/animations.js +14 -12
  67. package/dialog/internal/animations.js.map +1 -1
  68. package/dialog/internal/dialog-styles.css.js +1 -1
  69. package/dialog/internal/dialog-styles.css.js.map +1 -1
  70. package/dialog/internal/dialog.d.ts +6 -6
  71. package/dialog/internal/dialog.js +24 -24
  72. package/dialog/internal/dialog.js.map +1 -1
  73. package/fab/harness.js.map +1 -1
  74. package/fab/internal/_shared.scss +1 -0
  75. package/fab/internal/fab.js.map +1 -1
  76. package/fab/internal/shared-styles.css.js +1 -1
  77. package/fab/internal/shared-styles.css.js.map +1 -1
  78. package/fab/internal/shared.js +10 -11
  79. package/fab/internal/shared.js.map +1 -1
  80. package/field/harness.js.map +1 -1
  81. package/field/internal/_content.scss +185 -174
  82. package/field/internal/_filled-field.scss +147 -136
  83. package/field/internal/_label.scss +83 -72
  84. package/field/internal/_outlined-field.scss +276 -262
  85. package/field/internal/_supporting-text.scss +53 -42
  86. package/field/internal/field.js +26 -22
  87. package/field/internal/field.js.map +1 -1
  88. package/field/internal/filled-styles.css.js +1 -1
  89. package/field/internal/filled-styles.css.js.map +1 -1
  90. package/field/internal/outlined-styles.css.js +1 -1
  91. package/field/internal/outlined-styles.css.js.map +1 -1
  92. package/field/internal/shared-styles.css.js +1 -1
  93. package/field/internal/shared-styles.css.js.map +1 -1
  94. package/focus/internal/focus-ring.d.ts +2 -0
  95. package/focus/internal/focus-ring.js +3 -3
  96. package/focus/internal/focus-ring.js.map +1 -1
  97. package/icon/internal/_icon.scss +7 -4
  98. package/icon/internal/icon-styles.css.js +1 -1
  99. package/icon/internal/icon-styles.css.js.map +1 -1
  100. package/iconbutton/internal/icon-button.d.ts +9 -4
  101. package/iconbutton/internal/icon-button.js +35 -22
  102. package/iconbutton/internal/icon-button.js.map +1 -1
  103. package/internal/aria/aria.d.ts +4 -26
  104. package/internal/aria/aria.js +10 -28
  105. package/internal/aria/aria.js.map +1 -1
  106. package/internal/aria/delegate.js +2 -2
  107. package/internal/aria/delegate.js.map +1 -1
  108. package/internal/controller/attachable-controller.js +3 -5
  109. package/internal/controller/attachable-controller.js.map +1 -1
  110. package/internal/controller/form-submitter.d.ts +3 -5
  111. package/internal/controller/form-submitter.js +5 -7
  112. package/internal/controller/form-submitter.js.map +1 -1
  113. package/internal/controller/is-rtl.js +2 -2
  114. package/internal/controller/is-rtl.js.map +1 -1
  115. package/internal/controller/string-converter.js +1 -1
  116. package/internal/controller/string-converter.js.map +1 -1
  117. package/internal/motion/animation.js.map +1 -1
  118. package/labs/behaviors/constraint-validation.d.ts +133 -0
  119. package/labs/behaviors/constraint-validation.js +114 -0
  120. package/labs/behaviors/constraint-validation.js.map +1 -0
  121. package/labs/behaviors/element-internals.d.ts +45 -0
  122. package/labs/behaviors/element-internals.js +50 -0
  123. package/labs/behaviors/element-internals.js.map +1 -0
  124. package/labs/behaviors/focusable.d.ts +39 -0
  125. package/labs/behaviors/focusable.js +82 -0
  126. package/labs/behaviors/focusable.js.map +1 -0
  127. package/labs/behaviors/form-associated.d.ts +199 -0
  128. package/labs/behaviors/form-associated.js +155 -0
  129. package/labs/behaviors/form-associated.js.map +1 -0
  130. package/labs/behaviors/mixin.d.ts +54 -0
  131. package/labs/behaviors/mixin.js +7 -0
  132. package/labs/behaviors/mixin.js.map +1 -0
  133. package/labs/behaviors/on-report-validity.d.ts +70 -0
  134. package/labs/behaviors/on-report-validity.js +150 -0
  135. package/labs/behaviors/on-report-validity.js.map +1 -0
  136. package/labs/behaviors/validators/checkbox-validator.d.ts +31 -0
  137. package/labs/behaviors/validators/checkbox-validator.js +29 -0
  138. package/labs/behaviors/validators/checkbox-validator.js.map +1 -0
  139. package/labs/behaviors/validators/select-validator.d.ts +31 -0
  140. package/labs/behaviors/validators/select-validator.js +30 -0
  141. package/labs/behaviors/validators/select-validator.js.map +1 -0
  142. package/labs/behaviors/validators/validator.d.ts +92 -0
  143. package/labs/behaviors/validators/validator.js +83 -0
  144. package/labs/behaviors/validators/validator.js.map +1 -0
  145. package/labs/card/_elevated-card.scss +6 -0
  146. package/labs/card/_filled-card.scss +6 -0
  147. package/labs/card/_outlined-card.scss +6 -0
  148. package/labs/card/elevated-card.d.ts +18 -0
  149. package/labs/card/elevated-card.js +21 -0
  150. package/labs/card/elevated-card.js.map +1 -0
  151. package/labs/card/filled-card.d.ts +18 -0
  152. package/labs/card/filled-card.js +21 -0
  153. package/labs/card/filled-card.js.map +1 -0
  154. package/labs/card/internal/_elevated-card.scss +35 -0
  155. package/labs/card/internal/_filled-card.scss +35 -0
  156. package/labs/card/internal/_outlined-card.scss +39 -0
  157. package/labs/card/internal/_shared.scss +40 -0
  158. package/labs/card/internal/card.d.ts +13 -0
  159. package/labs/card/internal/card.js +20 -0
  160. package/labs/card/internal/card.js.map +1 -0
  161. package/labs/card/internal/elevated-styles.css.js +9 -0
  162. package/labs/card/internal/elevated-styles.css.js.map +1 -0
  163. package/labs/card/internal/elevated-styles.scss +10 -0
  164. package/labs/card/internal/filled-styles.css.js +9 -0
  165. package/labs/card/internal/filled-styles.css.js.map +1 -0
  166. package/labs/card/internal/filled-styles.scss +10 -0
  167. package/labs/card/internal/outlined-styles.css.js +9 -0
  168. package/labs/card/internal/outlined-styles.css.js.map +1 -0
  169. package/labs/card/internal/outlined-styles.scss +10 -0
  170. package/labs/card/internal/shared-styles.css.js +9 -0
  171. package/labs/card/internal/shared-styles.css.js.map +1 -0
  172. package/labs/card/internal/shared-styles.scss +10 -0
  173. package/labs/card/outlined-card.d.ts +18 -0
  174. package/labs/card/outlined-card.js +21 -0
  175. package/labs/card/outlined-card.js.map +1 -0
  176. package/labs/item/internal/item.js +8 -8
  177. package/labs/item/internal/item.js.map +1 -1
  178. package/labs/navigationbar/internal/constants.js.map +1 -1
  179. package/labs/navigationbar/internal/navigation-bar.d.ts +3 -0
  180. package/labs/navigationbar/internal/navigation-bar.js +18 -11
  181. package/labs/navigationbar/internal/navigation-bar.js.map +1 -1
  182. package/labs/navigationdrawer/internal/navigation-drawer-modal.d.ts +3 -0
  183. package/labs/navigationdrawer/internal/navigation-drawer-modal.js +10 -3
  184. package/labs/navigationdrawer/internal/navigation-drawer-modal.js.map +1 -1
  185. package/labs/navigationdrawer/internal/navigation-drawer.d.ts +3 -0
  186. package/labs/navigationdrawer/internal/navigation-drawer.js +8 -1
  187. package/labs/navigationdrawer/internal/navigation-drawer.js.map +1 -1
  188. package/labs/navigationtab/harness.js.map +1 -1
  189. package/labs/navigationtab/internal/navigation-tab.d.ts +6 -0
  190. package/labs/navigationtab/internal/navigation-tab.js +43 -27
  191. package/labs/navigationtab/internal/navigation-tab.js.map +1 -1
  192. package/labs/navigationtab/internal/state.js.map +1 -1
  193. package/labs/segmentedbutton/internal/_shared.scss +1 -0
  194. package/labs/segmentedbutton/internal/segmented-button.d.ts +3 -0
  195. package/labs/segmentedbutton/internal/segmented-button.js +26 -12
  196. package/labs/segmentedbutton/internal/segmented-button.js.map +1 -1
  197. package/labs/segmentedbutton/internal/shared-styles.css.js +1 -1
  198. package/labs/segmentedbutton/internal/shared-styles.css.js.map +1 -1
  199. package/labs/segmentedbuttonset/internal/segmented-button-set.d.ts +5 -0
  200. package/labs/segmentedbuttonset/internal/segmented-button-set.js +14 -9
  201. package/labs/segmentedbuttonset/internal/segmented-button-set.js.map +1 -1
  202. package/list/harness.d.ts +1 -1
  203. package/list/harness.js.map +1 -1
  204. package/list/internal/list-controller.d.ts +1 -1
  205. package/list/internal/list-controller.js +7 -3
  206. package/list/internal/list-controller.js.map +1 -1
  207. package/list/internal/list-navigation-helpers.js.map +1 -1
  208. package/list/internal/list.d.ts +2 -2
  209. package/list/internal/list.js +8 -6
  210. package/list/internal/list.js.map +1 -1
  211. package/list/internal/listitem/_list-item.scss +1 -0
  212. package/list/internal/listitem/harness.d.ts +1 -1
  213. package/list/internal/listitem/harness.js.map +1 -1
  214. package/list/internal/listitem/list-item-styles.css.js +1 -1
  215. package/list/internal/listitem/list-item-styles.css.js.map +1 -1
  216. package/list/internal/listitem/list-item.d.ts +3 -2
  217. package/list/internal/listitem/list-item.js +19 -20
  218. package/list/internal/listitem/list-item.js.map +1 -1
  219. package/list/list-item.d.ts +4 -12
  220. package/list/list-item.js +4 -12
  221. package/list/list-item.js.map +1 -1
  222. package/menu/harness.js.map +1 -1
  223. package/menu/internal/_menu.scss +12 -1
  224. package/menu/internal/controllers/menuItemController.js +9 -4
  225. package/menu/internal/controllers/menuItemController.js.map +1 -1
  226. package/menu/internal/controllers/shared.d.ts +9 -1
  227. package/menu/internal/controllers/shared.js +4 -4
  228. package/menu/internal/controllers/shared.js.map +1 -1
  229. package/menu/internal/controllers/surfacePositionController.d.ts +16 -2
  230. package/menu/internal/controllers/surfacePositionController.js +124 -54
  231. package/menu/internal/controllers/surfacePositionController.js.map +1 -1
  232. package/menu/internal/controllers/typeaheadController.js +19 -14
  233. package/menu/internal/controllers/typeaheadController.js.map +1 -1
  234. package/menu/internal/menu-styles.css.js +1 -1
  235. package/menu/internal/menu-styles.css.js.map +1 -1
  236. package/menu/internal/menu.d.ts +43 -12
  237. package/menu/internal/menu.js +124 -57
  238. package/menu/internal/menu.js.map +1 -1
  239. package/menu/internal/menuitem/harness.js.map +1 -1
  240. package/menu/internal/menuitem/menu-item.d.ts +3 -2
  241. package/menu/internal/menuitem/menu-item.js +18 -19
  242. package/menu/internal/menuitem/menu-item.js.map +1 -1
  243. package/menu/internal/submenu/sub-menu.d.ts +8 -8
  244. package/menu/internal/submenu/sub-menu.js +31 -22
  245. package/menu/internal/submenu/sub-menu.js.map +1 -1
  246. package/menu/internal/types.js.map +1 -1
  247. package/package.json +1 -1
  248. package/progress/internal/_circular-progress.scss +2 -2
  249. package/progress/internal/_linear-progress.scss +1 -1
  250. package/progress/internal/circular-progress-styles.css.js +1 -1
  251. package/progress/internal/circular-progress-styles.css.js.map +1 -1
  252. package/progress/internal/circular-progress.js +11 -10
  253. package/progress/internal/circular-progress.js.map +1 -1
  254. package/progress/internal/linear-progress-styles.css.js +1 -1
  255. package/progress/internal/linear-progress-styles.css.js.map +1 -1
  256. package/progress/internal/linear-progress.d.ts +1 -1
  257. package/progress/internal/linear-progress.js +3 -3
  258. package/progress/internal/linear-progress.js.map +1 -1
  259. package/progress/internal/progress.js +4 -2
  260. package/progress/internal/progress.js.map +1 -1
  261. package/radio/internal/radio.d.ts +11 -27
  262. package/radio/internal/radio.js +30 -54
  263. package/radio/internal/radio.js.map +1 -1
  264. package/radio/internal/single-selection-controller.js +1 -1
  265. package/radio/internal/single-selection-controller.js.map +1 -1
  266. package/ripple/internal/ripple.js +14 -9
  267. package/ripple/internal/ripple.js.map +1 -1
  268. package/select/filled-select.js +1 -2
  269. package/select/filled-select.js.map +1 -1
  270. package/select/harness.js +1 -1
  271. package/select/harness.js.map +1 -1
  272. package/select/internal/select.d.ts +26 -99
  273. package/select/internal/select.js +78 -187
  274. package/select/internal/select.js.map +1 -1
  275. package/select/internal/selectoption/select-option.d.ts +8 -6
  276. package/select/internal/selectoption/select-option.js +23 -22
  277. package/select/internal/selectoption/select-option.js.map +1 -1
  278. package/select/internal/selectoption/selectOptionController.js +1 -1
  279. package/select/internal/selectoption/selectOptionController.js.map +1 -1
  280. package/select/outlined-select.js +1 -2
  281. package/select/outlined-select.js.map +1 -1
  282. package/slider/harness.js +5 -5
  283. package/slider/harness.js.map +1 -1
  284. package/slider/internal/slider.d.ts +16 -25
  285. package/slider/internal/slider.js +110 -114
  286. package/slider/internal/slider.js.map +1 -1
  287. package/switch/internal/switch.d.ts +13 -89
  288. package/switch/internal/switch.js +32 -159
  289. package/switch/internal/switch.js.map +1 -1
  290. package/tabs/harness.js +3 -3
  291. package/tabs/harness.js.map +1 -1
  292. package/tabs/internal/_tab.scss +27 -35
  293. package/tabs/internal/primary-tab.d.ts +0 -2
  294. package/tabs/internal/tab-styles.css.js +1 -1
  295. package/tabs/internal/tab-styles.css.js.map +1 -1
  296. package/tabs/internal/tab.d.ts +4 -5
  297. package/tabs/internal/tab.js +34 -22
  298. package/tabs/internal/tab.js.map +1 -1
  299. package/tabs/internal/tabs.d.ts +6 -2
  300. package/tabs/internal/tabs.js +18 -11
  301. package/tabs/internal/tabs.js.map +1 -1
  302. package/textfield/filled-text-field.js +1 -2
  303. package/textfield/filled-text-field.js.map +1 -1
  304. package/textfield/harness.js +3 -2
  305. package/textfield/harness.js.map +1 -1
  306. package/textfield/internal/text-field.d.ts +26 -18
  307. package/textfield/internal/text-field.js +81 -58
  308. package/textfield/internal/text-field.js.map +1 -1
  309. package/textfield/outlined-text-field.js +1 -2
  310. package/textfield/outlined-text-field.js.map +1 -1
  311. package/tokens/_index.scss +3 -0
  312. package/tokens/_md-comp-elevated-card.scss +63 -0
  313. package/tokens/_md-comp-filled-card.scss +63 -0
  314. package/tokens/_md-comp-icon.scss +2 -0
  315. package/tokens/_md-comp-outlined-card.scss +69 -0
  316. package/tokens/_md-comp-test-table.scss +1 -0
  317. package/internal/controller/element-internals.d.ts +0 -35
  318. package/internal/controller/element-internals.js +0 -24
  319. package/internal/controller/element-internals.js.map +0 -1
  320. package/select/internal/filled-forced-colors-styles.css.js +0 -9
  321. package/select/internal/filled-forced-colors-styles.css.js.map +0 -1
  322. package/select/internal/filled-forced-colors-styles.scss +0 -29
  323. package/select/internal/outlined-forced-colors-styles.css.js +0 -9
  324. package/select/internal/outlined-forced-colors-styles.css.js.map +0 -1
  325. package/select/internal/outlined-forced-colors-styles.scss +0 -29
  326. package/textfield/internal/filled-forced-colors-styles.css.js +0 -9
  327. package/textfield/internal/filled-forced-colors-styles.css.js.map +0 -1
  328. package/textfield/internal/filled-forced-colors-styles.scss +0 -29
  329. package/textfield/internal/outlined-forced-colors-styles.css.js +0 -9
  330. package/textfield/internal/outlined-forced-colors-styles.css.js.map +0 -1
  331. package/textfield/internal/outlined-forced-colors-styles.scss +0 -29
  332. /package/{select/internal/filled-forced-colors-styles.css.d.ts → labs/card/internal/elevated-styles.css.d.ts} +0 -0
  333. /package/{select/internal/outlined-forced-colors-styles.css.d.ts → labs/card/internal/filled-styles.css.d.ts} +0 -0
  334. /package/{textfield/internal/filled-forced-colors-styles.css.d.ts → labs/card/internal/outlined-styles.css.d.ts} +0 -0
  335. /package/{textfield/internal/outlined-forced-colors-styles.css.d.ts → labs/card/internal/shared-styles.css.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAEvE;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAe;IACtC,QAAQ;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAU,CAAC;IAClE,CAAC;IACD;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAEQ,KAAK,CAAC,UAAU;QACvB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,OAAO,GACT,MAAM,CAAC,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC;QACnE,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,uDAAuD;IACvD,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAC3B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAA8B,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,CAAE,CAAC;QAC/D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,OAAO,CAAC,IAAI,CACR,wEAAwE,CAAC,CAAC;SAC/E;QACD,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IACjE,CAAC;CACF;AAED,+BAA+B;AAC/B,MAAM,mBAAoB,SAAQ,YAAY;IAC5C,4EAA4E;IACnE,qBAAqB;QAC5B,OAAO,KAAK,CAAC,qBAAqB,EAAE,CAAC;IACvC,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\n\nimport {FieldHarness} from '../field/harness.js';\nimport {Field} from '../field/internal/field.js';\nimport {Harness} from '../testing/harness.js';\n\nimport {Select} from './internal/select.js';\nimport {SelectOptionHarness} from './internal/selectoption/harness.js';\n\n/**\n * Test harness for menu.\n */\nexport class SelectHarness extends Harness<Select> {\n protected getField() {\n return this.element.renderRoot.querySelector('.field') as Field;\n }\n /**\n * Shows the menu and returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n return this.getField();\n }\n\n override async startHover() {\n const field = await this.getField();\n const element =\n await (new SelectFieldHardness(field)).getInteractiveElement();\n this.simulateStartHover(element);\n }\n\n /** @return ListItem harnesses for the menu's items. */\n getItems() {\n return this.element.options.map(\n (item) => new SelectOptionHarness(item as typeof item&LitElement));\n }\n\n async click() {\n const field = await this.getField();\n field.click();\n }\n\n async clickOption(index: number) {\n const menu = this.element.renderRoot.querySelector('md-menu')!;\n if (!menu.open) {\n console.warn(\n 'Internal menu is not open. Try calling SelectHarness.prototype.click()');\n }\n (await this.getItems()[index].getInteractiveElement()).click();\n }\n}\n\n// Private class (not exported)\nclass SelectFieldHardness extends FieldHarness {\n /* Expose so that we can call it from our internal code in SelectHarness. */\n override getInteractiveElement() {\n return super.getInteractiveElement();\n }\n}\n"]}
1
+ {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAEvE;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAe;IACtC,QAAQ;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAU,CAAC;IAClE,CAAC;IACD;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAEQ,KAAK,CAAC,UAAU;QACvB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,MAAM,IAAI,mBAAmB,CAC3C,KAAK,CACN,CAAC,qBAAqB,EAAE,CAAC;QAC1B,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,uDAAuD;IACvD,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAC7B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAAgC,CAAC,CACpE,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,CAAE,CAAC;QAC/D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,OAAO,CAAC,IAAI,CACV,wEAAwE,CACzE,CAAC;SACH;QACD,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IACjE,CAAC;CACF;AAED,+BAA+B;AAC/B,MAAM,mBAAoB,SAAQ,YAAY;IAC5C,4EAA4E;IACnE,qBAAqB;QAC5B,OAAO,KAAK,CAAC,qBAAqB,EAAE,CAAC;IACvC,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\n\nimport {FieldHarness} from '../field/harness.js';\nimport {Field} from '../field/internal/field.js';\nimport {Harness} from '../testing/harness.js';\n\nimport {Select} from './internal/select.js';\nimport {SelectOptionHarness} from './internal/selectoption/harness.js';\n\n/**\n * Test harness for menu.\n */\nexport class SelectHarness extends Harness<Select> {\n protected getField() {\n return this.element.renderRoot.querySelector('.field') as Field;\n }\n /**\n * Shows the menu and returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n return this.getField();\n }\n\n override async startHover() {\n const field = await this.getField();\n const element = await new SelectFieldHardness(\n field,\n ).getInteractiveElement();\n this.simulateStartHover(element);\n }\n\n /** @return ListItem harnesses for the menu's items. */\n getItems() {\n return this.element.options.map(\n (item) => new SelectOptionHarness(item as typeof item & LitElement),\n );\n }\n\n async click() {\n const field = await this.getField();\n field.click();\n }\n\n async clickOption(index: number) {\n const menu = this.element.renderRoot.querySelector('md-menu')!;\n if (!menu.open) {\n console.warn(\n 'Internal menu is not open. Try calling SelectHarness.prototype.click()',\n );\n }\n (await this.getItems()[index].getInteractiveElement()).click();\n }\n}\n\n// Private class (not exported)\nclass SelectFieldHardness extends FieldHarness {\n /* Expose so that we can call it from our internal code in SelectHarness. */\n override getInteractiveElement() {\n return super.getInteractiveElement();\n }\n}\n"]}
@@ -6,23 +6,29 @@
6
6
  import '../../menu/menu.js';
7
7
  import { LitElement, PropertyValues } from 'lit';
8
8
  import { StaticValue } from 'lit/static-html.js';
9
+ import { Field } from '../../field/internal/field.js';
10
+ import { createValidator, getValidityAnchor } from '../../labs/behaviors/constraint-validation.js';
11
+ import { getFormValue } from '../../labs/behaviors/form-associated.js';
12
+ import { onReportValidity } from '../../labs/behaviors/on-report-validity.js';
13
+ import { SelectValidator } from '../../labs/behaviors/validators/select-validator.js';
9
14
  import { SelectOption } from './selectoption/selectOptionController.js';
10
15
  declare const VALUE: unique symbol;
16
+ declare const selectBaseClass: import("../../labs/behaviors/mixin.js").MixinReturn<import("../../labs/behaviors/mixin.js").MixinReturn<import("../../labs/behaviors/mixin.js").MixinReturn<(abstract new (...args: any[]) => import("../../labs/behaviors/element-internals.js").WithElementInternals) & typeof LitElement & import("../../labs/behaviors/form-associated.js").FormAssociatedConstructor, import("../../labs/behaviors/form-associated.js").FormAssociated>, import("../../labs/behaviors/constraint-validation.js").ConstraintValidation>, import("../../labs/behaviors/on-report-validity.js").OnReportValidity>;
11
17
  /**
12
- * @fires input Fired when a selection is made by the user via mouse or keyboard
13
- * interaction.
14
- * @fires change Fired when a selection is made by the user via mouse or
15
- * keyboard interaction.
16
- * @fires opening Fired when the select's menu is about to open.
17
- * @fires opened Fired when the select's menu has finished animations and
18
- * opened.
19
- * @fires closing Fired when the select's menu is about to close.
20
- * @fires closed Fired when the select's menu has finished animations and
21
- * closed.
18
+ * @fires change {Event} The native `change` event on
19
+ * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event)
20
+ * --bubbles
21
+ * @fires input {InputEvent} The native `input` event on
22
+ * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event)
23
+ * --bubbles --composed
24
+ * @fires opening {Event} Fired when the select's menu is about to open.
25
+ * @fires opened {Event} Fired when the select's menu has finished animations
26
+ * and opened.
27
+ * @fires closing {Event} Fired when the select's menu is about to close.
28
+ * @fires closed {Event} Fired when the select's menu has finished animations
29
+ * and closed.
22
30
  */
23
- export declare abstract class Select extends LitElement {
24
- /** @nocollapse */
25
- static readonly formAssociated = true;
31
+ export declare abstract class Select extends selectBaseClass {
26
32
  /**
27
33
  * Opens the menu synchronously with no animation.
28
34
  */
@@ -31,10 +37,6 @@ export declare abstract class Select extends LitElement {
31
37
  * Whether or not the select is required.
32
38
  */
33
39
  required: boolean;
34
- /**
35
- * Disables the select.
36
- */
37
- disabled: boolean;
38
40
  /**
39
41
  * The error message that replaces supporting text when `error` is true. If
40
42
  * `errorText` is an empty string, then the supporting text will continue to
@@ -67,7 +69,7 @@ export declare abstract class Select extends LitElement {
67
69
  * position:fixed is useful for cases where select is inside of another
68
70
  * element with stacking context and hidden overflows such as `md-dialog`.
69
71
  */
70
- menuPositioning: 'absolute' | 'fixed';
72
+ menuPositioning: 'absolute' | 'fixed' | 'popover';
71
73
  /**
72
74
  * The max time between the keystrokes of the typeahead select / menu behavior
73
75
  * before it clears the typeahead buffer.
@@ -106,40 +108,6 @@ export declare abstract class Select extends LitElement {
106
108
  * NOTE: md-select only suppoprts single selection.
107
109
  */
108
110
  get selectedOptions(): SelectOption[];
109
- /**
110
- * The HTML name to use in form submission.
111
- */
112
- get name(): string;
113
- set name(name: string);
114
- /**
115
- * The associated form element with which this element's value will submit.
116
- */
117
- get form(): HTMLFormElement;
118
- /**
119
- * The labels this element is associated with.
120
- */
121
- get labels(): NodeList;
122
- /**
123
- * Returns a ValidityState object that represents the validity states of the
124
- * checkbox.
125
- *
126
- * Note that selects will only set `valueMissing` if unselected and
127
- * `required`.
128
- */
129
- get validity(): ValidityState;
130
- /**
131
- * Returns the native validation error message.
132
- *
133
- * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation#constraint_validation_process
134
- */
135
- get validationMessage(): string;
136
- /**
137
- * Returns whether an element will successfully validate based on forms
138
- * validation rules and constraints.
139
- *
140
- * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation#constraint_validation_process
141
- */
142
- get willValidate(): boolean;
143
111
  protected abstract readonly fieldTag: StaticValue;
144
112
  /**
145
113
  * Used for initializing select when the user sets the `value` directly.
@@ -171,8 +139,6 @@ export declare abstract class Select extends LitElement {
171
139
  private readonly menu;
172
140
  private readonly labelEl;
173
141
  private readonly leadingIcons;
174
- private customValidationMessage;
175
- private readonly internals;
176
142
  /**
177
143
  * Selects an option given the value of the option, and updates MdSelect's
178
144
  * value.
@@ -187,49 +153,9 @@ export declare abstract class Select extends LitElement {
187
153
  * Reset the select to its default value.
188
154
  */
189
155
  reset(): void;
190
- /**
191
- * Checks the select's native validation and returns whether or not the
192
- * element is valid.
193
- *
194
- * If invalid, this method will dispatch the `invalid` event.
195
- *
196
- * https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/checkValidity
197
- *
198
- * @return true if the select is valid, or false if not.
199
- */
200
- checkValidity(): boolean;
201
- /**
202
- * Checks the select's native validation and returns whether or not the
203
- * element is valid.
204
- *
205
- * If invalid, this method will dispatch the `invalid` event.
206
- *
207
- * This method will display or clear an error text message equal to the
208
- * select's `validationMessage`, unless the invalid event is canceled.
209
- *
210
- * Use `setCustomValidity()` to customize the `validationMessage`.
211
- *
212
- * This method can also be used to re-announce error messages to screen
213
- * readers.
214
- *
215
- * @return true if the select is valid, or false if not.
216
- */
217
- reportValidity(): boolean;
218
- /**
219
- * Sets the select's native validation error message. This is used to
220
- * customize `validationMessage`.
221
- *
222
- * When the error is not an empty string, the select is considered invalid
223
- * and `validity.customError` will be true.
224
- *
225
- * https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/setCustomValidity
226
- *
227
- * @param error The error message to display.
228
- */
229
- setCustomValidity(error: string): void;
156
+ [onReportValidity](invalidEvent: Event | null): void;
230
157
  protected update(changed: PropertyValues<Select>): void;
231
158
  protected render(): import("lit-html").TemplateResult<1>;
232
- protected updated(changed: PropertyValues<Select>): void;
233
159
  protected firstUpdated(changed: PropertyValues<Select>): Promise<void>;
234
160
  private getRenderClasses;
235
161
  private renderField;
@@ -303,11 +229,12 @@ export declare abstract class Select extends LitElement {
303
229
  */
304
230
  private dispatchInteractionEvents;
305
231
  private getErrorText;
306
- private syncValidity;
307
- private getRequiredValidationMessage;
308
- /** @private */
232
+ disabled: boolean;
233
+ name: string;
234
+ [getFormValue](): string;
309
235
  formResetCallback(): void;
310
- /** @private */
311
236
  formStateRestoreCallback(state: string): void;
237
+ [createValidator](): SelectValidator;
238
+ [getValidityAnchor](): Field;
312
239
  }
313
240
  export {};
@@ -12,25 +12,34 @@ import { classMap } from 'lit/directives/class-map.js';
12
12
  import { html as staticHtml } from 'lit/static-html.js';
13
13
  import { requestUpdateOnAriaChange } from '../../internal/aria/delegate.js';
14
14
  import { redispatchEvent } from '../../internal/controller/events.js';
15
+ import { createValidator, getValidityAnchor, mixinConstraintValidation, } from '../../labs/behaviors/constraint-validation.js';
16
+ import { mixinElementInternals } from '../../labs/behaviors/element-internals.js';
17
+ import { getFormValue, mixinFormAssociated, } from '../../labs/behaviors/form-associated.js';
18
+ import { mixinOnReportValidity, onReportValidity, } from '../../labs/behaviors/on-report-validity.js';
19
+ import { SelectValidator } from '../../labs/behaviors/validators/select-validator.js';
15
20
  import { getActiveItem } from '../../list/internal/list-navigation-helpers.js';
16
- import { isElementInSubtree, isSelectableKey } from '../../menu/internal/controllers/shared.js';
21
+ import { isElementInSubtree, isSelectableKey, } from '../../menu/internal/controllers/shared.js';
17
22
  import { TYPEAHEAD_RECORD } from '../../menu/internal/controllers/typeaheadController.js';
18
23
  import { DEFAULT_TYPEAHEAD_BUFFER_TIME } from '../../menu/internal/menu.js';
19
24
  import { getSelectedItems } from './shared.js';
20
25
  const VALUE = Symbol('value');
26
+ // Separate variable needed for closure.
27
+ const selectBaseClass = mixinOnReportValidity(mixinConstraintValidation(mixinFormAssociated(mixinElementInternals(LitElement))));
21
28
  /**
22
- * @fires input Fired when a selection is made by the user via mouse or keyboard
23
- * interaction.
24
- * @fires change Fired when a selection is made by the user via mouse or
25
- * keyboard interaction.
26
- * @fires opening Fired when the select's menu is about to open.
27
- * @fires opened Fired when the select's menu has finished animations and
28
- * opened.
29
- * @fires closing Fired when the select's menu is about to close.
30
- * @fires closed Fired when the select's menu has finished animations and
31
- * closed.
29
+ * @fires change {Event} The native `change` event on
30
+ * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event)
31
+ * --bubbles
32
+ * @fires input {InputEvent} The native `input` event on
33
+ * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event)
34
+ * --bubbles --composed
35
+ * @fires opening {Event} Fired when the select's menu is about to open.
36
+ * @fires opened {Event} Fired when the select's menu has finished animations
37
+ * and opened.
38
+ * @fires closing {Event} Fired when the select's menu is about to close.
39
+ * @fires closed {Event} Fired when the select's menu has finished animations
40
+ * and closed.
32
41
  */
33
- export class Select extends LitElement {
42
+ export class Select extends selectBaseClass {
34
43
  constructor() {
35
44
  super(...arguments);
36
45
  /**
@@ -41,10 +50,6 @@ export class Select extends LitElement {
41
50
  * Whether or not the select is required.
42
51
  */
43
52
  this.required = false;
44
- /**
45
- * Disables the select.
46
- */
47
- this.disabled = false;
48
53
  /**
49
54
  * The error message that replaces supporting text when `error` is true. If
50
55
  * `errorText` is an empty string, then the supporting text will continue to
@@ -77,7 +82,7 @@ export class Select extends LitElement {
77
82
  * position:fixed is useful for cases where select is inside of another
78
83
  * element with stacking context and hidden overflows such as `md-dialog`.
79
84
  */
80
- this.menuPositioning = 'absolute';
85
+ this.menuPositioning = 'popover';
81
86
  /**
82
87
  * The max time between the keystrokes of the typeahead select / menu behavior
83
88
  * before it clears the typeahead buffer.
@@ -118,8 +123,6 @@ export class Select extends LitElement {
118
123
  this.nativeErrorText = '';
119
124
  this.focused = false;
120
125
  this.open = false;
121
- this.customValidationMessage = '';
122
- this.internals = this /* needed for closure */.attachInternals();
123
126
  }
124
127
  /**
125
128
  * The value of the currently selected option.
@@ -164,57 +167,6 @@ export class Select extends LitElement {
164
167
  get selectedOptions() {
165
168
  return (this.getSelectedOptions() ?? []).map(([option]) => option);
166
169
  }
167
- /**
168
- * The HTML name to use in form submission.
169
- */
170
- get name() {
171
- return this.getAttribute('name') ?? '';
172
- }
173
- set name(name) {
174
- this.setAttribute('name', name);
175
- }
176
- /**
177
- * The associated form element with which this element's value will submit.
178
- */
179
- get form() {
180
- return this.internals.form;
181
- }
182
- /**
183
- * The labels this element is associated with.
184
- */
185
- get labels() {
186
- return this.internals.labels;
187
- }
188
- /**
189
- * Returns a ValidityState object that represents the validity states of the
190
- * checkbox.
191
- *
192
- * Note that selects will only set `valueMissing` if unselected and
193
- * `required`.
194
- */
195
- get validity() {
196
- this.syncValidity();
197
- return this.internals.validity;
198
- }
199
- /**
200
- * Returns the native validation error message.
201
- *
202
- * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation#constraint_validation_process
203
- */
204
- get validationMessage() {
205
- this.syncValidity();
206
- return this.internals.validationMessage;
207
- }
208
- /**
209
- * Returns whether an element will successfully validate based on forms
210
- * validation rules and constraints.
211
- *
212
- * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation#constraint_validation_process
213
- */
214
- get willValidate() {
215
- this.syncValidity();
216
- return this.internals.willValidate;
217
- }
218
170
  get hasError() {
219
171
  return this.error || this.nativeError;
220
172
  }
@@ -223,7 +175,7 @@ export class Select extends LitElement {
223
175
  * value.
224
176
  */
225
177
  select(value) {
226
- const optionToSelect = this.options.find(option => option.value === value);
178
+ const optionToSelect = this.options.find((option) => option.value === value);
227
179
  if (optionToSelect) {
228
180
  this.selectItem(optionToSelect);
229
181
  }
@@ -249,67 +201,17 @@ export class Select extends LitElement {
249
201
  this.nativeError = false;
250
202
  this.nativeErrorText = '';
251
203
  }
252
- /**
253
- * Checks the select's native validation and returns whether or not the
254
- * element is valid.
255
- *
256
- * If invalid, this method will dispatch the `invalid` event.
257
- *
258
- * https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/checkValidity
259
- *
260
- * @return true if the select is valid, or false if not.
261
- */
262
- checkValidity() {
263
- this.syncValidity();
264
- return this.internals.checkValidity();
265
- }
266
- /**
267
- * Checks the select's native validation and returns whether or not the
268
- * element is valid.
269
- *
270
- * If invalid, this method will dispatch the `invalid` event.
271
- *
272
- * This method will display or clear an error text message equal to the
273
- * select's `validationMessage`, unless the invalid event is canceled.
274
- *
275
- * Use `setCustomValidity()` to customize the `validationMessage`.
276
- *
277
- * This method can also be used to re-announce error messages to screen
278
- * readers.
279
- *
280
- * @return true if the select is valid, or false if not.
281
- */
282
- reportValidity() {
283
- let invalidEvent;
284
- this.addEventListener('invalid', event => {
285
- invalidEvent = event;
286
- }, { once: true });
287
- const valid = this.checkValidity();
204
+ [(_a = VALUE, onReportValidity)](invalidEvent) {
288
205
  if (invalidEvent?.defaultPrevented) {
289
- return valid;
206
+ return;
290
207
  }
208
+ invalidEvent?.preventDefault();
291
209
  const prevMessage = this.getErrorText();
292
- this.nativeError = !valid;
210
+ this.nativeError = !!invalidEvent;
293
211
  this.nativeErrorText = this.validationMessage;
294
212
  if (prevMessage === this.getErrorText()) {
295
213
  this.field?.reannounceError();
296
214
  }
297
- return valid;
298
- }
299
- /**
300
- * Sets the select's native validation error message. This is used to
301
- * customize `validationMessage`.
302
- *
303
- * When the error is not an empty string, the select is considered invalid
304
- * and `validity.customError` will be true.
305
- *
306
- * https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/setCustomValidity
307
- *
308
- * @param error The error message to display.
309
- */
310
- setCustomValidity(error) {
311
- this.customValidationMessage = error;
312
- this.syncValidity();
313
215
  }
314
216
  update(changed) {
315
217
  // In SSR the options will be ready to query, so try to figure out what
@@ -322,18 +224,12 @@ export class Select extends LitElement {
322
224
  render() {
323
225
  return html `
324
226
  <span
325
- class="select ${classMap(this.getRenderClasses())}"
326
- @focusout=${this.handleFocusout}>
327
- ${this.renderField()}
328
- ${this.renderMenu()}
227
+ class="select ${classMap(this.getRenderClasses())}"
228
+ @focusout=${this.handleFocusout}>
229
+ ${this.renderField()} ${this.renderMenu()}
329
230
  </span>
330
231
  `;
331
232
  }
332
- updated(changed) {
333
- if (changed.has('required')) {
334
- this.syncValidity();
335
- }
336
- }
337
233
  async firstUpdated(changed) {
338
234
  await this.menu?.updateComplete;
339
235
  // If this has been handled on update already due to SSR, try again.
@@ -342,7 +238,8 @@ export class Select extends LitElement {
342
238
  }
343
239
  // Case for when the DOM is streaming, there are no children, and a child
344
240
  // has [selected] set on it, we need to wait for DOM to render something.
345
- if (!this.lastSelectedOptionRecords.length && !isServer &&
241
+ if (!this.lastSelectedOptionRecords.length &&
242
+ !isServer &&
346
243
  !this.options.length) {
347
244
  setTimeout(() => {
348
245
  this.updateValueAndDisplayText();
@@ -399,21 +296,29 @@ export class Select extends LitElement {
399
296
  renderLeadingIcon() {
400
297
  return html `
401
298
  <span class="icon leading" slot="start">
402
- <slot name="leading-icon" @slotchange=${this.handleIconChange}></slot>
299
+ <slot name="leading-icon" @slotchange=${this.handleIconChange}></slot>
403
300
  </span>
404
- `;
301
+ `;
405
302
  }
406
303
  renderTrailingIcon() {
407
304
  return html `
408
305
  <span class="icon trailing" slot="end">
409
306
  <slot name="trailing-icon" @slotchange=${this.handleIconChange}>
410
307
  <svg height="5" viewBox="7 10 10 5" focusable="false">
411
- <polygon class="down" stroke="none" fill-rule="evenodd" points="7 10 12 15 17 10"></polygon>
412
- <polygon class="up" stroke="none" fill-rule="evenodd" points="7 15 12 10 17 15"></polygon>
308
+ <polygon
309
+ class="down"
310
+ stroke="none"
311
+ fill-rule="evenodd"
312
+ points="7 10 12 15 17 10"></polygon>
313
+ <polygon
314
+ class="up"
315
+ stroke="none"
316
+ fill-rule="evenodd"
317
+ points="7 15 12 10 17 15"></polygon>
413
318
  </svg>
414
319
  </slot>
415
320
  </span>
416
- `;
321
+ `;
417
322
  }
418
323
  renderLabel() {
419
324
  // need to render &nbsp; so that line-height can apply and give it a
@@ -422,30 +327,29 @@ export class Select extends LitElement {
422
327
  }
423
328
  renderMenu() {
424
329
  const ariaLabel = this.label || this.ariaLabel;
425
- return html `
426
- <md-menu
427
- id="listbox"
428
- default-focus="none"
429
- role="listbox"
430
- tabindex="-1"
431
- aria-label=${ariaLabel || nothing}
432
- stay-open-on-focusout
433
- part="menu"
434
- exportparts="focus-ring: menu-focus-ring"
435
- anchor="field"
436
- .open=${this.open}
437
- .quick=${this.quick}
438
- .positioning=${this.menuPositioning}
439
- .typeaheadDelay=${this.typeaheadDelay}
440
- @opening=${this.handleOpening}
441
- @opened=${this.redispatchEvent}
442
- @closing=${this.redispatchEvent}
443
- @closed=${this.handleClosed}
444
- @close-menu=${this.handleCloseMenu}
445
- @request-selection=${this.handleRequestSelection}
446
- @request-deselection=${this.handleRequestDeselection}>
447
- ${this.renderMenuContent()}
448
- </md-menu>`;
330
+ return html ` <md-menu
331
+ id="listbox"
332
+ default-focus="none"
333
+ role="listbox"
334
+ tabindex="-1"
335
+ aria-label=${ariaLabel || nothing}
336
+ stay-open-on-focusout
337
+ part="menu"
338
+ exportparts="focus-ring: menu-focus-ring"
339
+ anchor="field"
340
+ .open=${this.open}
341
+ .quick=${this.quick}
342
+ .positioning=${this.menuPositioning}
343
+ .typeaheadDelay=${this.typeaheadDelay}
344
+ @opening=${this.handleOpening}
345
+ @opened=${this.redispatchEvent}
346
+ @closing=${this.redispatchEvent}
347
+ @closed=${this.handleClosed}
348
+ @close-menu=${this.handleCloseMenu}
349
+ @request-selection=${this.handleRequestSelection}
350
+ @request-deselection=${this.handleRequestDeselection}>
351
+ ${this.renderMenuContent()}
352
+ </md-menu>`;
449
353
  }
450
354
  renderMenuContent() {
451
355
  return html `<slot></slot>`;
@@ -459,7 +363,8 @@ export class Select extends LitElement {
459
363
  return;
460
364
  }
461
365
  const typeaheadController = this.menu.typeaheadController;
462
- const isOpenKey = event.code === 'Space' || event.code === 'ArrowDown' ||
366
+ const isOpenKey = event.code === 'Space' ||
367
+ event.code === 'ArrowDown' ||
463
368
  event.code === 'Enter';
464
369
  // Do not open if currently typing ahead because the user may be typing the
465
370
  // spacebar to match a word with a space
@@ -549,8 +454,6 @@ export class Select extends LitElement {
549
454
  this[VALUE] = '';
550
455
  this.displayText = '';
551
456
  }
552
- this.internals.setFormValue(this.value);
553
- this.syncValidity();
554
457
  return hasSelectedOptionChanged;
555
458
  }
556
459
  /**
@@ -679,43 +582,31 @@ export class Select extends LitElement {
679
582
  getErrorText() {
680
583
  return this.error ? this.errorText : this.nativeErrorText;
681
584
  }
682
- syncValidity() {
683
- const valueMissing = this.required && !this.value;
684
- const customError = !!this.customValidationMessage;
685
- const validationMessage = this.customValidationMessage ||
686
- valueMissing && this.getRequiredValidationMessage() || '';
687
- this.internals.setValidity({ valueMissing, customError }, validationMessage);
688
- }
689
- // Returns the platform `<select>` validation message for i18n.
690
- getRequiredValidationMessage() {
691
- const select = document.createElement('select');
692
- select.required = true;
693
- return select.validationMessage;
585
+ [getFormValue]() {
586
+ return this.value;
694
587
  }
695
- /** @private */
696
588
  formResetCallback() {
697
589
  this.reset();
698
590
  }
699
- /** @private */
700
591
  formStateRestoreCallback(state) {
701
592
  this.value = state;
702
593
  }
594
+ [createValidator]() {
595
+ return new SelectValidator(() => this);
596
+ }
597
+ [getValidityAnchor]() {
598
+ return this.field;
599
+ }
703
600
  }
704
- _a = VALUE;
705
601
  (() => {
706
602
  requestUpdateOnAriaChange(Select);
707
603
  })();
708
- /** @nocollapse */
709
- Select.formAssociated = true;
710
604
  __decorate([
711
605
  property({ type: Boolean })
712
606
  ], Select.prototype, "quick", void 0);
713
607
  __decorate([
714
608
  property({ type: Boolean })
715
609
  ], Select.prototype, "required", void 0);
716
- __decorate([
717
- property({ type: Boolean, reflect: true })
718
- ], Select.prototype, "disabled", void 0);
719
610
  __decorate([
720
611
  property({ type: String, attribute: 'error-text' })
721
612
  ], Select.prototype, "errorText", void 0);