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

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 (534) hide show
  1. package/README.md +4 -4
  2. package/autocomplete/autocomplete-item.js.map +1 -1
  3. package/autocomplete/autocomplete-list.js.map +1 -1
  4. package/autocomplete/autocomplete-surface.js.map +1 -1
  5. package/autocomplete/filled-autocomplete.d.ts +0 -2
  6. package/autocomplete/filled-autocomplete.js +0 -7
  7. package/autocomplete/filled-autocomplete.js.map +1 -1
  8. package/autocomplete/lib/_filled-autocomplete.scss +22 -28
  9. package/autocomplete/lib/_outlined-autocomplete.scss +23 -29
  10. package/autocomplete/lib/_shared.scss +6 -10
  11. package/autocomplete/lib/autocomplete.d.ts +2 -2
  12. package/autocomplete/lib/autocomplete.js +4 -5
  13. package/autocomplete/lib/autocomplete.js.map +1 -1
  14. package/autocomplete/lib/autocompletelist/autocomplete-list-styles.scss +2 -0
  15. package/autocomplete/lib/autocompletesurface/autocomplete-surface-styles.scss +2 -0
  16. package/autocomplete/lib/filled-styles.css.js +1 -1
  17. package/autocomplete/lib/filled-styles.css.js.map +1 -1
  18. package/autocomplete/lib/filled-styles.scss +2 -0
  19. package/autocomplete/lib/outlined-styles.css.js +1 -1
  20. package/autocomplete/lib/outlined-styles.css.js.map +1 -1
  21. package/autocomplete/lib/outlined-styles.scss +2 -0
  22. package/autocomplete/lib/shared-styles.scss +2 -0
  23. package/autocomplete/outlined-autocomplete.d.ts +0 -2
  24. package/autocomplete/outlined-autocomplete.js +0 -7
  25. package/autocomplete/outlined-autocomplete.js.map +1 -1
  26. package/badge/badge.js.map +1 -1
  27. package/badge/lib/_badge.scss +10 -13
  28. package/badge/lib/badge-styles.css.js +1 -1
  29. package/badge/lib/badge-styles.css.js.map +1 -1
  30. package/badge/lib/badge-styles.scss +2 -0
  31. package/badge/lib/badge.js.map +1 -1
  32. package/button/elevated-button.js.map +1 -1
  33. package/button/elevated-link-button.js.map +1 -1
  34. package/button/filled-button.js.map +1 -1
  35. package/button/filled-link-button.js.map +1 -1
  36. package/button/lib/_elevated-button.scss +10 -15
  37. package/button/lib/_elevation.scss +4 -1
  38. package/button/lib/_filled-button.scss +12 -14
  39. package/button/lib/_icon.scss +1 -0
  40. package/button/lib/_outlined-button.scss +10 -15
  41. package/button/lib/_shared.scss +14 -19
  42. package/button/lib/_text-button.scss +12 -14
  43. package/button/lib/_tonal-button.scss +10 -15
  44. package/button/lib/button.js.map +1 -1
  45. package/button/lib/elevated-styles.css.js +1 -1
  46. package/button/lib/elevated-styles.css.js.map +1 -1
  47. package/button/lib/elevated-styles.scss +2 -0
  48. package/button/lib/filled-styles.css.js +1 -1
  49. package/button/lib/filled-styles.css.js.map +1 -1
  50. package/button/lib/filled-styles.scss +2 -0
  51. package/button/lib/link-button.js.map +1 -1
  52. package/button/lib/outlined-styles.css.js +1 -1
  53. package/button/lib/outlined-styles.css.js.map +1 -1
  54. package/button/lib/outlined-styles.scss +2 -0
  55. package/button/lib/shared-elevation-styles.scss +2 -0
  56. package/button/lib/shared-styles.css.js +1 -1
  57. package/button/lib/shared-styles.css.js.map +1 -1
  58. package/button/lib/shared-styles.scss +2 -0
  59. package/button/lib/text-styles.css.js +1 -1
  60. package/button/lib/text-styles.css.js.map +1 -1
  61. package/button/lib/text-styles.scss +2 -0
  62. package/button/lib/tonal-styles.css.js +1 -1
  63. package/button/lib/tonal-styles.css.js.map +1 -1
  64. package/button/lib/tonal-styles.scss +2 -0
  65. package/button/outlined-button.js.map +1 -1
  66. package/button/outlined-link-button.js.map +1 -1
  67. package/button/text-button.js.map +1 -1
  68. package/button/text-link-button.js.map +1 -1
  69. package/button/tonal-button.js.map +1 -1
  70. package/button/tonal-link-button.js.map +1 -1
  71. package/checkbox/checkbox.js.map +1 -1
  72. package/checkbox/lib/_checkbox.scss +26 -31
  73. package/checkbox/lib/checkbox-styles.css.js +1 -1
  74. package/checkbox/lib/checkbox-styles.css.js.map +1 -1
  75. package/checkbox/lib/checkbox-styles.scss +2 -0
  76. package/checkbox/lib/checkbox.js +6 -6
  77. package/checkbox/lib/checkbox.js.map +1 -1
  78. package/checkbox/lib/forced-colors-styles.scss +2 -0
  79. package/chips/action/delete-action.js.map +1 -1
  80. package/chips/action/lib/action.js +4 -4
  81. package/chips/action/lib/action.js.map +1 -1
  82. package/chips/action/lib/link-action.js +1 -1
  83. package/chips/action/lib/link-action.js.map +1 -1
  84. package/chips/action/lib/primary-action.js.map +1 -1
  85. package/chips/action/lib/selectable-action.js.map +1 -1
  86. package/chips/action/link-action.js.map +1 -1
  87. package/chips/action/presentational-action.js.map +1 -1
  88. package/chips/action/primary-action.js.map +1 -1
  89. package/chips/action/selectable-action.js.map +1 -1
  90. package/chips/chip/lib/_assist-chip-theme.scss +4 -0
  91. package/chips/chip/lib/_chip-theme.scss +29 -40
  92. package/chips/chip/lib/_chip.scss +2 -0
  93. package/chips/chip/lib/_filter-chip-theme.scss +4 -0
  94. package/chips/chip/lib/_input-chip-theme.scss +4 -0
  95. package/chips/chip/lib/_suggestion-chip-theme.scss +4 -0
  96. package/chips/chip/lib/chip.js.map +1 -1
  97. package/chips/chip/lib/foundation.js +4 -4
  98. package/chips/chip/lib/foundation.js.map +1 -1
  99. package/chips/chip/lib/link-chip.js.map +1 -1
  100. package/chips/chip/lib/selectable-chip.js.map +1 -1
  101. package/chips/chip/lib/types.d.ts +2 -2
  102. package/chips/chipset/lib/_chip-set-theme.scss +2 -0
  103. package/chips/chipset/lib/_chip-set.scss +2 -0
  104. package/chips/chipset/lib/foundation.js +3 -3
  105. package/chips/chipset/lib/foundation.js.map +1 -1
  106. package/chips/chipset/lib/types.d.ts +3 -3
  107. package/controller/events.js +4 -0
  108. package/controller/events.js.map +1 -1
  109. package/controller/form-controller.js.map +1 -1
  110. package/controller/foundation.d.ts +1 -1
  111. package/controller/observer.d.ts +2 -2
  112. package/dialog/dialog.js.map +1 -1
  113. package/dialog/harness.d.ts +2 -2
  114. package/dialog/harness.js +11 -8
  115. package/dialog/harness.js.map +1 -1
  116. package/dialog/lib/_dialog.scss +7 -11
  117. package/dialog/lib/_tokens.scss +9 -6
  118. package/dialog/lib/dialog-styles.css.js +1 -1
  119. package/dialog/lib/dialog-styles.css.js.map +1 -1
  120. package/dialog/lib/dialog-styles.scss +2 -0
  121. package/dialog/lib/dialog.js +9 -7
  122. package/dialog/lib/dialog.js.map +1 -1
  123. package/divider/divider.js.map +1 -1
  124. package/divider/lib/_divider.scss +2 -0
  125. package/divider/lib/divider-styles.scss +2 -0
  126. package/divider/lib/divider.js.map +1 -1
  127. package/elevation/elevation.js.map +1 -1
  128. package/elevation/lib/_elevation.scss +4 -0
  129. package/elevation/lib/_md-comp-elevation.scss +4 -0
  130. package/elevation/lib/elevation-styles.scss +2 -0
  131. package/elevation/lib/elevation.js.map +1 -1
  132. package/fab/fab-extended.js.map +1 -1
  133. package/fab/fab.js.map +1 -1
  134. package/fab/lib/_fab-extended.scss +18 -11
  135. package/fab/lib/_fab.scss +7 -2
  136. package/fab/lib/_shared.scss +16 -8
  137. package/fab/lib/fab-extended-styles.css.js +1 -1
  138. package/fab/lib/fab-extended-styles.css.js.map +1 -1
  139. package/fab/lib/fab-extended-styles.scss +2 -0
  140. package/fab/lib/fab-shared-styles.css.js +1 -1
  141. package/fab/lib/fab-shared-styles.css.js.map +1 -1
  142. package/fab/lib/fab-shared-styles.scss +2 -0
  143. package/fab/lib/fab-shared.d.ts +9 -15
  144. package/fab/lib/fab-shared.js +21 -33
  145. package/fab/lib/fab-shared.js.map +1 -1
  146. package/fab/lib/fab-styles.css.js +1 -1
  147. package/fab/lib/fab-styles.css.js.map +1 -1
  148. package/fab/lib/fab-styles.scss +2 -0
  149. package/field/filled-field.d.ts +1 -1
  150. package/field/filled-field.js +1 -1
  151. package/field/filled-field.js.map +1 -1
  152. package/field/harness.js +1 -1
  153. package/field/harness.js.map +1 -1
  154. package/field/lib/_content.scss +35 -50
  155. package/field/lib/_filled-field.scss +60 -79
  156. package/field/lib/_label.scss +26 -63
  157. package/field/lib/_md-comp-filled-field.scss +14 -2
  158. package/field/lib/_md-comp-outlined-field.scss +15 -4
  159. package/field/lib/_outlined-field.scss +96 -110
  160. package/field/lib/_shared.scss +13 -35
  161. package/field/lib/_supporting-text.scss +25 -52
  162. package/field/lib/field.d.ts +14 -31
  163. package/field/lib/field.js +77 -97
  164. package/field/lib/field.js.map +1 -1
  165. package/field/lib/filled-field.d.ts +10 -16
  166. package/field/lib/filled-field.js +14 -37
  167. package/field/lib/filled-field.js.map +1 -1
  168. package/field/lib/filled-styles.css.js +1 -1
  169. package/field/lib/filled-styles.css.js.map +1 -1
  170. package/field/lib/outlined-field.d.ts +4 -10
  171. package/field/lib/outlined-field.js +13 -33
  172. package/field/lib/outlined-field.js.map +1 -1
  173. package/field/lib/outlined-styles.css.js +1 -1
  174. package/field/lib/outlined-styles.css.js.map +1 -1
  175. package/field/lib/shared-styles.css.js +1 -1
  176. package/field/lib/shared-styles.css.js.map +1 -1
  177. package/field/outlined-field.d.ts +1 -1
  178. package/field/outlined-field.js +1 -1
  179. package/field/outlined-field.js.map +1 -1
  180. package/focus/focus-ring.js.map +1 -1
  181. package/focus/lib/_focus-ring.scss +7 -13
  182. package/focus/lib/_md-comp-focus-ring.scss +4 -0
  183. package/focus/lib/focus-ring-styles.css.js +1 -1
  184. package/focus/lib/focus-ring-styles.css.js.map +1 -1
  185. package/focus/lib/focus-ring-styles.scss +2 -0
  186. package/focus/lib/focus-ring.js.map +1 -1
  187. package/icon/icon.js.map +1 -1
  188. package/icon/lib/_icon.scss +2 -0
  189. package/icon/lib/icon-styles.scss +2 -0
  190. package/iconbutton/filled-icon-button-toggle.js.map +1 -1
  191. package/iconbutton/filled-icon-button.js.map +1 -1
  192. package/iconbutton/filled-link-icon-button.js.map +1 -1
  193. package/iconbutton/filled-tonal-icon-button-toggle.js.map +1 -1
  194. package/iconbutton/filled-tonal-icon-button.js.map +1 -1
  195. package/iconbutton/filled-tonal-link-icon-button.js.map +1 -1
  196. package/iconbutton/lib/_filled-icon-button.scss +19 -19
  197. package/iconbutton/lib/_filled-tonal-icon-button.scss +19 -19
  198. package/iconbutton/lib/_outlined-icon-button.scss +20 -16
  199. package/iconbutton/lib/_shared.scss +8 -8
  200. package/iconbutton/lib/_standard-icon-button.scss +21 -18
  201. package/iconbutton/lib/filled-styles.css.js +1 -1
  202. package/iconbutton/lib/filled-styles.css.js.map +1 -1
  203. package/iconbutton/lib/filled-styles.scss +2 -0
  204. package/iconbutton/lib/filled-tonal-styles.css.js +1 -1
  205. package/iconbutton/lib/filled-tonal-styles.css.js.map +1 -1
  206. package/iconbutton/lib/filled-tonal-styles.scss +2 -0
  207. package/iconbutton/lib/icon-button-toggle.js.map +1 -1
  208. package/iconbutton/lib/icon-button.js.map +1 -1
  209. package/iconbutton/lib/link-icon-button.js.map +1 -1
  210. package/iconbutton/lib/outlined-styles.css.js +1 -1
  211. package/iconbutton/lib/outlined-styles.css.js.map +1 -1
  212. package/iconbutton/lib/outlined-styles.scss +2 -0
  213. package/iconbutton/lib/shared-styles.scss +2 -0
  214. package/iconbutton/lib/standard-styles.css.js +1 -1
  215. package/iconbutton/lib/standard-styles.css.js.map +1 -1
  216. package/iconbutton/lib/standard-styles.scss +2 -0
  217. package/iconbutton/outlined-icon-button-toggle.js.map +1 -1
  218. package/iconbutton/outlined-icon-button.js.map +1 -1
  219. package/iconbutton/outlined-link-icon-button.js.map +1 -1
  220. package/iconbutton/standard-icon-button-toggle.js.map +1 -1
  221. package/iconbutton/standard-icon-button.js.map +1 -1
  222. package/iconbutton/standard-link-icon-button.js.map +1 -1
  223. package/list/lib/_list.scss +6 -2
  224. package/list/lib/avatar/_list-item-avatar.scss +2 -0
  225. package/list/lib/avatar/list-item-avatar-styles.scss +2 -0
  226. package/list/lib/avatar/list-item-avatar.js.map +1 -1
  227. package/list/lib/icon/_list-item-icon.scss +4 -0
  228. package/list/lib/icon/list-item-icon-styles.scss +2 -0
  229. package/list/lib/image/_list-item-image.scss +5 -1
  230. package/list/lib/image/list-item-image-styles.scss +2 -0
  231. package/list/lib/image/list-item-image.js.map +1 -1
  232. package/list/lib/list-styles.css.js +1 -1
  233. package/list/lib/list-styles.css.js.map +1 -1
  234. package/list/lib/list-styles.scss +2 -0
  235. package/list/lib/list.js +3 -1
  236. package/list/lib/list.js.map +1 -1
  237. package/list/lib/listitem/_list-item.scss +31 -30
  238. package/list/lib/listitem/list-item-private-styles.css.js +1 -1
  239. package/list/lib/listitem/list-item-private-styles.css.js.map +1 -1
  240. package/list/lib/listitem/list-item-private-styles.scss +2 -0
  241. package/list/lib/listitem/list-item-styles.css.js +1 -1
  242. package/list/lib/listitem/list-item-styles.css.js.map +1 -1
  243. package/list/lib/listitem/list-item-styles.scss +2 -0
  244. package/list/lib/listitem/list-item.d.ts +1 -1
  245. package/list/lib/listitem/list-item.js +3 -1
  246. package/list/lib/listitem/list-item.js.map +1 -1
  247. package/list/lib/listitemlink/list-item-link.js.map +1 -1
  248. package/list/lib/video/_list-item-video.scss +5 -1
  249. package/list/lib/video/list-item-video-styles.scss +2 -0
  250. package/list/lib/video/list-item-video.js.map +1 -1
  251. package/list/list-item-avatar.js.map +1 -1
  252. package/list/list-item-icon.js.map +1 -1
  253. package/list/list-item-image.js.map +1 -1
  254. package/list/list-item-link.js.map +1 -1
  255. package/list/list-item-video.js.map +1 -1
  256. package/list/list-item.js.map +1 -1
  257. package/list/list.js.map +1 -1
  258. package/menu/lib/_menu.scss +7 -4
  259. package/menu/lib/menu-styles.css.js +1 -1
  260. package/menu/lib/menu-styles.css.js.map +1 -1
  261. package/menu/lib/menu-styles.scss +2 -0
  262. package/menu/lib/menu.d.ts +1 -1
  263. package/menu/lib/menu.js.map +1 -1
  264. package/menu/lib/menuitem/_menu-item.scss +17 -9
  265. package/menu/lib/menuitem/menu-item-private-styles.css.js +1 -1
  266. package/menu/lib/menuitem/menu-item-private-styles.css.js.map +1 -1
  267. package/menu/lib/menuitem/menu-item-private-styles.scss +2 -0
  268. package/menu/lib/menuitem/menu-item-styles.css.js +1 -1
  269. package/menu/lib/menuitem/menu-item-styles.css.js.map +1 -1
  270. package/menu/lib/menuitem/menu-item-styles.scss +2 -0
  271. package/menu/lib/menuitem/menu-item.js.map +1 -1
  272. package/menu/lib/menuitemlink/menu-item-link.js.map +1 -1
  273. package/menu/lib/shared.d.ts +3 -3
  274. package/menu/lib/submenuitem/sub-menu-item.js.map +1 -1
  275. package/menu/lib/surfacePositionController.d.ts +1 -1
  276. package/menu/lib/typeaheadController.d.ts +1 -1
  277. package/menu/menu-item-link.js.map +1 -1
  278. package/menu/menu-item.js.map +1 -1
  279. package/menu/menu.js.map +1 -1
  280. package/menu/sub-menu-item.js.map +1 -1
  281. package/menusurface/lib/_md-comp-menu-surface.scss +4 -0
  282. package/menusurface/lib/_menu-surface.scss +4 -0
  283. package/menusurface/lib/foundation.js +31 -31
  284. package/menusurface/lib/foundation.js.map +1 -1
  285. package/menusurface/lib/menu-surface-styles.scss +2 -0
  286. package/menusurface/lib/menu-surface.d.ts +2 -2
  287. package/menusurface/lib/menu-surface.js.map +1 -1
  288. package/menusurface/menu-surface.js.map +1 -1
  289. package/navigationbar/lib/_navigation-bar.scss +2 -0
  290. package/navigationbar/lib/constants.d.ts +1 -1
  291. package/navigationbar/lib/navigation-bar-styles.scss +2 -0
  292. package/navigationbar/lib/navigation-bar.js.map +1 -1
  293. package/navigationbar/navigation-bar.js.map +1 -1
  294. package/navigationdrawer/lib/_navigation-drawer-modal.scss +11 -2
  295. package/navigationdrawer/lib/_navigation-drawer.scss +10 -5
  296. package/navigationdrawer/lib/_shared.scss +4 -8
  297. package/navigationdrawer/lib/navigation-drawer-modal-styles.css.js +1 -1
  298. package/navigationdrawer/lib/navigation-drawer-modal-styles.css.js.map +1 -1
  299. package/navigationdrawer/lib/navigation-drawer-modal-styles.scss +2 -0
  300. package/navigationdrawer/lib/navigation-drawer-modal.js.map +1 -1
  301. package/navigationdrawer/lib/navigation-drawer-styles.css.js +1 -1
  302. package/navigationdrawer/lib/navigation-drawer-styles.css.js.map +1 -1
  303. package/navigationdrawer/lib/navigation-drawer-styles.scss +2 -0
  304. package/navigationdrawer/lib/navigation-drawer.js.map +1 -1
  305. package/navigationdrawer/lib/shared-styles.scss +2 -0
  306. package/navigationdrawer/navigation-drawer-modal.js.map +1 -1
  307. package/navigationdrawer/navigation-drawer.js.map +1 -1
  308. package/navigationtab/lib/_navigation-tab.scss +26 -22
  309. package/navigationtab/lib/navigation-tab-styles.css.js +1 -1
  310. package/navigationtab/lib/navigation-tab-styles.css.js.map +1 -1
  311. package/navigationtab/lib/navigation-tab-styles.scss +2 -0
  312. package/navigationtab/lib/navigation-tab.js +4 -4
  313. package/navigationtab/lib/navigation-tab.js.map +1 -1
  314. package/navigationtab/navigation-tab.js.map +1 -1
  315. package/package.json +2 -2
  316. package/radio/lib/_radio.scss +16 -14
  317. package/radio/lib/forced-colors-styles.scss +2 -0
  318. package/radio/lib/radio-styles.css.js +1 -1
  319. package/radio/lib/radio-styles.css.js.map +1 -1
  320. package/radio/lib/radio-styles.scss +2 -0
  321. package/radio/lib/radio.js +21 -21
  322. package/radio/lib/radio.js.map +1 -1
  323. package/radio/radio.js.map +1 -1
  324. package/ripple/directive.d.ts +1 -33
  325. package/ripple/directive.js +7 -194
  326. package/ripple/directive.js.map +1 -1
  327. package/ripple/lib/_md-comp-ripple.scss +20 -19
  328. package/ripple/lib/_ripple.scss +20 -20
  329. package/ripple/lib/ripple-styles.css.js +1 -1
  330. package/ripple/lib/ripple-styles.css.js.map +1 -1
  331. package/ripple/lib/ripple-styles.scss +2 -0
  332. package/ripple/lib/ripple.d.ts +50 -48
  333. package/ripple/lib/ripple.js +214 -76
  334. package/ripple/lib/ripple.js.map +1 -1
  335. package/ripple/ripple.d.ts +9 -1
  336. package/ripple/ripple.js +9 -1
  337. package/ripple/ripple.js.map +1 -1
  338. package/sass/_assert.scss +2 -0
  339. package/sass/_color-scheme.scss +4 -0
  340. package/sass/_color.scss +4 -0
  341. package/sass/_elevation.scss +4 -0
  342. package/sass/_feature-flags.scss +2 -0
  343. package/sass/_map-ext.scss +2 -0
  344. package/sass/_resolvers.scss +4 -4
  345. package/sass/_shape.scss +75 -27
  346. package/sass/_string-ext.scss +44 -0
  347. package/sass/_theme.scss +4 -0
  348. package/sass/_typography.scss +18 -93
  349. package/sass/_var.scss +4 -0
  350. package/segmentedbutton/lib/_outlined-segmented-button.scss +4 -0
  351. package/segmentedbutton/lib/_shared.scss +18 -22
  352. package/segmentedbutton/lib/outlined-styles.css.js +1 -1
  353. package/segmentedbutton/lib/outlined-styles.css.js.map +1 -1
  354. package/segmentedbutton/lib/outlined-styles.scss +2 -0
  355. package/segmentedbutton/lib/segmented-button.js +4 -4
  356. package/segmentedbutton/lib/segmented-button.js.map +1 -1
  357. package/segmentedbutton/lib/shared-styles.css.js +1 -1
  358. package/segmentedbutton/lib/shared-styles.css.js.map +1 -1
  359. package/segmentedbutton/lib/shared-styles.scss +2 -0
  360. package/segmentedbutton/outlined-segmented-button.js.map +1 -1
  361. package/segmentedbuttonset/lib/_outlined-segmented-button-set.scss +9 -5
  362. package/segmentedbuttonset/lib/_shared.scss +0 -13
  363. package/segmentedbuttonset/lib/outlined-styles.css.js +1 -1
  364. package/segmentedbuttonset/lib/outlined-styles.css.js.map +1 -1
  365. package/segmentedbuttonset/lib/outlined-styles.scss +2 -0
  366. package/segmentedbuttonset/lib/segmented-button-set.js.map +1 -1
  367. package/segmentedbuttonset/lib/shared-styles.scss +2 -0
  368. package/segmentedbuttonset/outlined-segmented-button-set.js.map +1 -1
  369. package/slider/_slider.scss +6 -0
  370. package/slider/harness.d.ts +20 -0
  371. package/slider/harness.js +63 -0
  372. package/slider/harness.js.map +1 -0
  373. package/slider/lib/_slider.scss +503 -0
  374. package/slider/lib/_tokens.scss +66 -0
  375. package/slider/lib/forced-colors-styles.css.js +9 -0
  376. package/slider/lib/forced-colors-styles.css.js.map +1 -0
  377. package/slider/lib/forced-colors-styles.scss +53 -0
  378. package/slider/lib/slider-styles.css.js +9 -0
  379. package/slider/lib/slider-styles.css.js.map +1 -0
  380. package/slider/lib/slider-styles.scss +8 -0
  381. package/slider/lib/slider.d.ts +158 -0
  382. package/slider/lib/slider.js +575 -0
  383. package/slider/lib/slider.js.map +1 -0
  384. package/slider/slider.d.ts +28 -0
  385. package/slider/slider.js +32 -0
  386. package/slider/slider.js.map +1 -0
  387. package/switch/lib/README.md +55 -0
  388. package/switch/lib/_handle.scss +17 -18
  389. package/switch/lib/_icon.scss +4 -0
  390. package/switch/lib/_switch.scss +11 -18
  391. package/switch/lib/_track.scss +2 -0
  392. package/switch/lib/switch-styles.css.js +1 -1
  393. package/switch/lib/switch-styles.css.js.map +1 -1
  394. package/switch/lib/switch-styles.scss +2 -0
  395. package/switch/lib/switch.js +9 -9
  396. package/switch/lib/switch.js.map +1 -1
  397. package/switch/switch.js.map +1 -1
  398. package/textfield/filled-text-field.d.ts +1 -1
  399. package/textfield/filled-text-field.js +1 -2
  400. package/textfield/filled-text-field.js.map +1 -1
  401. package/textfield/harness.js +1 -1
  402. package/textfield/harness.js.map +1 -1
  403. package/textfield/lib/_filled-text-field.scss +25 -21
  404. package/textfield/lib/_icon.scss +41 -56
  405. package/textfield/lib/_input.scss +17 -36
  406. package/textfield/lib/_outlined-text-field.scss +26 -21
  407. package/textfield/lib/_shared.scss +10 -29
  408. package/textfield/lib/filled-forced-colors-styles.scss +2 -0
  409. package/textfield/lib/filled-styles.css.js +1 -1
  410. package/textfield/lib/filled-styles.css.js.map +1 -1
  411. package/textfield/lib/filled-styles.scss +2 -0
  412. package/textfield/lib/filled-text-field.d.ts +6 -5
  413. package/textfield/lib/filled-text-field.js +8 -7
  414. package/textfield/lib/filled-text-field.js.map +1 -1
  415. package/textfield/lib/outlined-forced-colors-styles.scss +2 -0
  416. package/textfield/lib/outlined-styles.css.js +1 -1
  417. package/textfield/lib/outlined-styles.css.js.map +1 -1
  418. package/textfield/lib/outlined-styles.scss +2 -0
  419. package/textfield/lib/outlined-text-field.d.ts +6 -5
  420. package/textfield/lib/outlined-text-field.js +8 -7
  421. package/textfield/lib/outlined-text-field.js.map +1 -1
  422. package/textfield/lib/shared-styles.css.js +1 -1
  423. package/textfield/lib/shared-styles.css.js.map +1 -1
  424. package/textfield/lib/shared-styles.scss +2 -0
  425. package/textfield/lib/text-field.d.ts +40 -88
  426. package/textfield/lib/text-field.js +194 -270
  427. package/textfield/lib/text-field.js.map +1 -1
  428. package/textfield/outlined-text-field.d.ts +1 -1
  429. package/textfield/outlined-text-field.js +1 -2
  430. package/textfield/outlined-text-field.js.map +1 -1
  431. package/tokens/_index.scss +1 -1
  432. package/tokens/{v0_152 → v0_160}/_md-comp-assist-chip.scss +1 -1
  433. package/tokens/{v0_152 → v0_160}/_md-comp-badge.scss +1 -1
  434. package/tokens/{v0_152 → v0_160}/_md-comp-banner.scss +1 -1
  435. package/tokens/{v0_152 → v0_160}/_md-comp-bottom-app-bar.scss +1 -1
  436. package/tokens/{v0_152 → v0_160}/_md-comp-carousel-item.scss +1 -1
  437. package/tokens/{v0_152 → v0_160}/_md-comp-checkbox.scss +4 -15
  438. package/tokens/{v0_152 → v0_160}/_md-comp-circular-progress-indicator.scss +1 -1
  439. package/tokens/{v0_152 → v0_160}/_md-comp-data-table.scss +1 -3
  440. package/tokens/{v0_152 → v0_160}/_md-comp-date-input-modal.scss +10 -10
  441. package/tokens/{v0_152 → v0_160}/_md-comp-date-picker-docked.scss +23 -23
  442. package/tokens/{v0_152 → v0_160}/_md-comp-date-picker-modal.scss +34 -34
  443. package/tokens/{v0_152 → v0_160}/_md-comp-dialog.scss +1 -1
  444. package/tokens/{v0_152 → v0_160}/_md-comp-divider.scss +1 -1
  445. package/tokens/{v0_152 → v0_160}/_md-comp-elevated-button.scss +1 -1
  446. package/tokens/{v0_152 → v0_160}/_md-comp-elevated-card.scss +1 -1
  447. package/tokens/{v0_152 → v0_160}/_md-comp-extended-fab-branded.scss +1 -1
  448. package/tokens/{v0_152 → v0_160}/_md-comp-extended-fab-primary.scss +1 -1
  449. package/tokens/{v0_152 → v0_160}/_md-comp-extended-fab-secondary.scss +1 -1
  450. package/tokens/{v0_152 → v0_160}/_md-comp-extended-fab-surface.scss +1 -1
  451. package/tokens/{v0_152 → v0_160}/_md-comp-extended-fab-tertiary.scss +1 -1
  452. package/tokens/{v0_152 → v0_160}/_md-comp-fab-branded-large.scss +1 -1
  453. package/tokens/{v0_152 → v0_160}/_md-comp-fab-branded.scss +1 -1
  454. package/tokens/{v0_152 → v0_160}/_md-comp-fab-primary-large.scss +1 -1
  455. package/tokens/{v0_152 → v0_160}/_md-comp-fab-primary-small.scss +1 -1
  456. package/tokens/{v0_152 → v0_160}/_md-comp-fab-primary.scss +1 -1
  457. package/tokens/{v0_152 → v0_160}/_md-comp-fab-secondary-large.scss +1 -1
  458. package/tokens/{v0_152 → v0_160}/_md-comp-fab-secondary-small.scss +1 -1
  459. package/tokens/{v0_152 → v0_160}/_md-comp-fab-secondary.scss +1 -1
  460. package/tokens/{v0_152 → v0_160}/_md-comp-fab-surface-large.scss +1 -1
  461. package/tokens/{v0_152 → v0_160}/_md-comp-fab-surface-small.scss +1 -1
  462. package/tokens/{v0_152 → v0_160}/_md-comp-fab-surface.scss +1 -1
  463. package/tokens/{v0_152 → v0_160}/_md-comp-fab-tertiary-large.scss +1 -1
  464. package/tokens/{v0_152 → v0_160}/_md-comp-fab-tertiary-small.scss +1 -1
  465. package/tokens/{v0_152 → v0_160}/_md-comp-fab-tertiary.scss +1 -1
  466. package/tokens/{v0_152 → v0_160}/_md-comp-filled-autocomplete.scss +1 -1
  467. package/tokens/{v0_152 → v0_160}/_md-comp-filled-button.scss +1 -1
  468. package/tokens/{v0_152 → v0_160}/_md-comp-filled-card.scss +1 -1
  469. package/tokens/{v0_152 → v0_160}/_md-comp-filled-icon-button.scss +1 -1
  470. package/tokens/{v0_152 → v0_160}/_md-comp-filled-menu-button.scss +1 -1
  471. package/tokens/{v0_152 → v0_160}/_md-comp-filled-select.scss +1 -1
  472. package/tokens/{v0_152 → v0_160}/_md-comp-filled-text-field.scss +1 -1
  473. package/tokens/{v0_152 → v0_160}/_md-comp-filled-tonal-button.scss +1 -1
  474. package/tokens/{v0_152 → v0_160}/_md-comp-filled-tonal-icon-button.scss +1 -1
  475. package/tokens/{v0_152 → v0_160}/_md-comp-filter-chip.scss +1 -1
  476. package/tokens/{v0_152 → v0_160}/_md-comp-full-screen-dialog.scss +1 -1
  477. package/tokens/{v0_152 → v0_160}/_md-comp-icon-button.scss +1 -1
  478. package/tokens/{v0_152 → v0_160}/_md-comp-input-chip.scss +1 -1
  479. package/tokens/{v0_152 → v0_160}/_md-comp-linear-progress-indicator.scss +1 -1
  480. package/tokens/{v0_152 → v0_160}/_md-comp-list.scss +1 -1
  481. package/tokens/{v0_152 → v0_160}/_md-comp-menu.scss +1 -1
  482. package/tokens/{v0_152 → v0_160}/_md-comp-navigation-bar.scss +1 -1
  483. package/tokens/{v0_152 → v0_160}/_md-comp-navigation-drawer.scss +1 -1
  484. package/tokens/{v0_152 → v0_160}/_md-comp-navigation-rail.scss +1 -1
  485. package/tokens/{v0_152 → v0_160}/_md-comp-outlined-autocomplete.scss +1 -1
  486. package/tokens/{v0_152 → v0_160}/_md-comp-outlined-button.scss +1 -1
  487. package/tokens/{v0_152 → v0_160}/_md-comp-outlined-card.scss +1 -1
  488. package/tokens/{v0_152 → v0_160}/_md-comp-outlined-icon-button.scss +1 -1
  489. package/tokens/{v0_152 → v0_160}/_md-comp-outlined-menu-button.scss +1 -1
  490. package/tokens/{v0_152 → v0_160}/_md-comp-outlined-segmented-button.scss +1 -1
  491. package/tokens/{v0_152 → v0_160}/_md-comp-outlined-select.scss +1 -1
  492. package/tokens/{v0_152 → v0_160}/_md-comp-outlined-text-field.scss +1 -1
  493. package/tokens/{v0_152 → v0_160}/_md-comp-plain-tooltip.scss +1 -1
  494. package/tokens/{v0_152 → v0_160}/_md-comp-primary-navigation-tab.scss +1 -3
  495. package/tokens/{v0_152 → v0_160}/_md-comp-radio-button.scss +1 -1
  496. package/tokens/{v0_152 → v0_160}/_md-comp-rich-tooltip.scss +1 -1
  497. package/tokens/{v0_152 → v0_160}/_md-comp-scrim.scss +1 -1
  498. package/tokens/{v0_152 → v0_160}/_md-comp-search-bar.scss +1 -1
  499. package/tokens/{v0_152 → v0_160}/_md-comp-search-view.scss +1 -1
  500. package/tokens/{v0_152 → v0_160}/_md-comp-secondary-navigation-tab.scss +1 -3
  501. package/tokens/{v0_152 → v0_160}/_md-comp-sheet-bottom.scss +1 -1
  502. package/tokens/{v0_152 → v0_160}/_md-comp-sheet-floating.scss +1 -1
  503. package/tokens/{v0_152 → v0_160}/_md-comp-sheet-side.scss +10 -10
  504. package/tokens/{v0_152 → v0_160}/_md-comp-slider.scss +1 -1
  505. package/tokens/{v0_152 → v0_160}/_md-comp-snackbar.scss +1 -1
  506. package/tokens/{v0_152 → v0_160}/_md-comp-standard-menu-button.scss +1 -1
  507. package/tokens/{v0_152 → v0_160}/_md-comp-suggestion-chip.scss +1 -1
  508. package/tokens/{v0_152 → v0_160}/_md-comp-switch.scss +1 -1
  509. package/tokens/{v0_152 → v0_160}/_md-comp-text-button.scss +1 -1
  510. package/tokens/{v0_152 → v0_160}/_md-comp-time-input.scss +1 -1
  511. package/tokens/{v0_152 → v0_160}/_md-comp-time-picker.scss +1 -1
  512. package/tokens/{v0_152 → v0_160}/_md-comp-top-app-bar-large.scss +1 -1
  513. package/tokens/{v0_152 → v0_160}/_md-comp-top-app-bar-medium.scss +1 -1
  514. package/tokens/{v0_152 → v0_160}/_md-comp-top-app-bar-small-centered.scss +1 -1
  515. package/tokens/{v0_152 → v0_160}/_md-comp-top-app-bar-small.scss +1 -1
  516. package/tokens/{v0_152 → v0_160}/_md-ref-palette.scss +1 -1
  517. package/tokens/{v0_152 → v0_160}/_md-ref-typeface.scss +1 -1
  518. package/tokens/{v0_152 → v0_160}/_md-sys-color.scss +217 -1
  519. package/tokens/{v0_152 → v0_160}/_md-sys-elevation.scss +1 -1
  520. package/tokens/{v0_152 → v0_160}/_md-sys-motion.scss +1 -1
  521. package/tokens/{v0_152 → v0_160}/_md-sys-shape.scss +1 -1
  522. package/tokens/{v0_152 → v0_160}/_md-sys-state.scss +1 -1
  523. package/tokens/{v0_152 → v0_160}/_md-sys-typescale.scss +1 -1
  524. package/tokens/v0_160/index.test.css.d.ts +1 -0
  525. package/tokens/v0_160/lib.test.css.d.ts +1 -0
  526. /package/{tokens/v0_152/index.test.css.d.ts → slider/lib/forced-colors-styles.css.d.ts} +0 -0
  527. /package/{tokens/v0_152/lib.test.css.d.ts → slider/lib/slider-styles.css.d.ts} +0 -0
  528. /package/tokens/{v0_152 → v0_160}/_index.scss +0 -0
  529. /package/tokens/{v0_152 → v0_160}/index.test.css.js +0 -0
  530. /package/tokens/{v0_152 → v0_160}/index.test.css.js.map +0 -0
  531. /package/tokens/{v0_152 → v0_160}/index.test.scss +0 -0
  532. /package/tokens/{v0_152 → v0_160}/lib.test.css.js +0 -0
  533. /package/tokens/{v0_152 → v0_160}/lib.test.css.js.map +0 -0
  534. /package/tokens/{v0_152 → v0_160}/lib.test.scss +0 -0
@@ -4,10 +4,9 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { __decorate, __metadata } from "tslib";
7
- import { html, LitElement } from 'lit';
7
+ import { html, LitElement, nothing } from 'lit';
8
8
  import { property, query, queryAssignedElements, state } from 'lit/decorators.js';
9
9
  import { classMap } from 'lit/directives/class-map.js';
10
- import { ifDefined } from 'lit/directives/if-defined.js';
11
10
  import { live } from 'lit/directives/live.js';
12
11
  import { styleMap } from 'lit/directives/style-map.js';
13
12
  import { html as staticHtml } from 'lit/static-html.js';
@@ -15,8 +14,94 @@ import { redispatchEvent } from '../../controller/events.js';
15
14
  import { FormController, getFormValue } from '../../controller/form-controller.js';
16
15
  import { stringConverter } from '../../controller/string-converter.js';
17
16
  import { ariaProperty } from '../../decorators/aria-property.js';
18
- /** @soyCompatible */
17
+ /**
18
+ * A text field component.
19
+ */
19
20
  export class TextField extends LitElement {
21
+ // FormElement
22
+ get form() {
23
+ return this.closest('form');
24
+ }
25
+ [getFormValue]() {
26
+ return this.value;
27
+ }
28
+ /**
29
+ * Gets or sets the direction in which selection occurred.
30
+ */
31
+ get selectionDirection() {
32
+ return this.getInput().selectionDirection;
33
+ }
34
+ set selectionDirection(value) {
35
+ this.getInput().selectionDirection = value;
36
+ }
37
+ /**
38
+ * Gets or sets the end position or offset of a text selection.
39
+ */
40
+ get selectionEnd() {
41
+ return this.getInput().selectionEnd;
42
+ }
43
+ set selectionEnd(value) {
44
+ this.getInput().selectionEnd = value;
45
+ }
46
+ /**
47
+ * Gets or sets the starting position or offset of a text selection.
48
+ */
49
+ get selectionStart() {
50
+ return this.getInput().selectionStart;
51
+ }
52
+ set selectionStart(value) {
53
+ this.getInput().selectionStart = value;
54
+ }
55
+ /**
56
+ * Returns the native validation error message that would be displayed upon
57
+ * calling `reportValidity()`.
58
+ *
59
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/validationMessage
60
+ */
61
+ get validationMessage() {
62
+ return this.getInput().validationMessage;
63
+ }
64
+ /**
65
+ * Returns a ValidityState object that represents the validity states of the
66
+ * text field.
67
+ *
68
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/validity
69
+ */
70
+ get validity() {
71
+ return this.getInput().validity;
72
+ }
73
+ /**
74
+ * The text field's value as a number.
75
+ */
76
+ get valueAsNumber() {
77
+ return this.getInput().valueAsNumber;
78
+ }
79
+ set valueAsNumber(value) {
80
+ this.getInput().valueAsNumber = value;
81
+ this.value = this.getInput().value;
82
+ }
83
+ /**
84
+ * The text field's value as a Date.
85
+ */
86
+ get valueAsDate() {
87
+ return this.getInput().valueAsDate;
88
+ }
89
+ set valueAsDate(value) {
90
+ this.getInput().valueAsDate = value;
91
+ this.value = this.getInput().value;
92
+ }
93
+ /**
94
+ * Returns whether an element will successfully validate based on forms
95
+ * validation rules and constraints.
96
+ *
97
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/willValidate
98
+ */
99
+ get willValidate() {
100
+ return this.getInput().willValidate;
101
+ }
102
+ get hasError() {
103
+ return this.error || this.nativeError;
104
+ }
20
105
  constructor() {
21
106
  super();
22
107
  this.disabled = false;
@@ -77,13 +162,10 @@ export class TextField extends LitElement {
77
162
  */
78
163
  this.textDirection = '';
79
164
  // ARIA
80
- // TODO(b/210730484): replace with @soyParam annotation
81
165
  this.ariaAutoComplete = null;
82
166
  this.ariaControls = null;
83
167
  this.ariaActiveDescendant = null;
84
168
  this.ariaExpanded = null;
85
- // tslint:disable:decorator-placement
86
- // @ts-ignore(b/264292293): Use `override` with TS 4.9+
87
169
  this.role = null;
88
170
  this.name = '';
89
171
  // <input> properties
@@ -135,7 +217,6 @@ export class TextField extends LitElement {
135
217
  * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step
136
218
  */
137
219
  this.step = '';
138
- // TODO(b/237284412): replace with exported types
139
220
  this.type = 'text';
140
221
  /**
141
222
  * Returns true when the text field has been interacted with. Native
@@ -171,98 +252,11 @@ export class TextField extends LitElement {
171
252
  * `reportValidity()`.
172
253
  */
173
254
  this.nativeErrorText = '';
174
- /** @soyUniqueAttribute */
175
- this.counterId = 'counter';
176
- /** @soyUniqueAttribute */
177
- this.supportingTextId = 'support';
178
255
  this.addController(new FormController(this));
179
- // TODO(b/244574653): replace this.handleClick with this.focus
180
- this.addEventListener('click', this.handleClick);
256
+ this.addEventListener('click', this.focus);
181
257
  this.addEventListener('focusin', this.handleFocusin);
182
258
  this.addEventListener('focusout', this.handleFocusout);
183
259
  }
184
- // tslint:enable:decorator-placement
185
- // FormElement
186
- get form() {
187
- return this.closest('form');
188
- }
189
- [getFormValue]() {
190
- return this.value;
191
- }
192
- /**
193
- * Gets or sets the direction in which selection occurred.
194
- */
195
- get selectionDirection() {
196
- return this.getInput().selectionDirection;
197
- }
198
- set selectionDirection(value) {
199
- this.getInput().selectionDirection = value;
200
- }
201
- /**
202
- * Gets or sets the end position or offset of a text selection.
203
- */
204
- get selectionEnd() {
205
- return this.getInput().selectionEnd;
206
- }
207
- set selectionEnd(value) {
208
- this.getInput().selectionEnd = value;
209
- }
210
- /**
211
- * Gets or sets the starting position or offset of a text selection.
212
- */
213
- get selectionStart() {
214
- return this.getInput().selectionStart;
215
- }
216
- set selectionStart(value) {
217
- this.getInput().selectionStart = value;
218
- }
219
- /**
220
- * Returns the native validation error message that would be displayed upon
221
- * calling `reportValidity()`.
222
- *
223
- * https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/validationMessage
224
- */
225
- get validationMessage() {
226
- return this.getInput().validationMessage;
227
- }
228
- /**
229
- * Returns a ValidityState object that represents the validity states of the
230
- * text field.
231
- *
232
- * https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/validity
233
- */
234
- get validity() {
235
- return this.getInput().validity;
236
- }
237
- /**
238
- * The text field's value as a number.
239
- */
240
- get valueAsNumber() {
241
- return this.getInput().valueAsNumber;
242
- }
243
- set valueAsNumber(value) {
244
- this.getInput().valueAsNumber = value;
245
- this.value = this.getInput().value;
246
- }
247
- /**
248
- * The text field's value as a Date.
249
- */
250
- get valueAsDate() {
251
- return this.getInput().valueAsDate;
252
- }
253
- set valueAsDate(value) {
254
- this.getInput().valueAsDate = value;
255
- this.value = this.getInput().value;
256
- }
257
- /**
258
- * Returns whether an element will successfully validate based on forms
259
- * validation rules and constraints.
260
- *
261
- * https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/willValidate
262
- */
263
- get willValidate() {
264
- return this.getInput().willValidate;
265
- }
266
260
  /**
267
261
  * Checks the text field's native validation and returns whether or not the
268
262
  * element is valid.
@@ -286,15 +280,7 @@ export class TextField extends LitElement {
286
280
  // button, to the input when focus is requested.
287
281
  return;
288
282
  }
289
- // TODO(b/210731759): replace with super.focus() once SSR supports
290
- // delegating focus
291
- this.getInput().focus();
292
- }
293
- /**
294
- * Unfocuses the text field.
295
- */
296
- blur() {
297
- this.getInput().blur();
283
+ super.focus();
298
284
  }
299
285
  /**
300
286
  * Checks the text field's native validation and returns whether or not the
@@ -404,40 +390,65 @@ export class TextField extends LitElement {
404
390
  this.nativeError = false;
405
391
  this.nativeErrorText = '';
406
392
  }
407
- /** @soyTemplate */
393
+ update(changedProperties) {
394
+ // Consider a value change anything that is not the initial empty string
395
+ // value.
396
+ const valueHasChanged = changedProperties.has('value') &&
397
+ changedProperties.get('value') !== undefined;
398
+ if (valueHasChanged && !this.ignoreNextValueChange) {
399
+ this.valueHasChanged = true;
400
+ }
401
+ if (this.ignoreNextValueChange) {
402
+ this.ignoreNextValueChange = false;
403
+ }
404
+ super.update(changedProperties);
405
+ }
408
406
  render() {
407
+ const classes = {
408
+ 'disabled': this.disabled,
409
+ 'error': !this.disabled && this.hasError,
410
+ };
409
411
  return html `
410
- <span class="md3-text-field ${classMap(this.getRenderClasses())}">
412
+ <span class="text-field ${classMap(classes)}">
411
413
  ${this.renderField()}
412
414
  </span>
413
415
  `;
414
416
  }
415
- /** @soyTemplate */
416
- getRenderClasses() {
417
- return {
418
- 'md3-text-field--disabled': this.disabled,
419
- 'md3-text-field--error': this.getError(),
420
- };
421
- }
422
- /** @soyTemplate */
423
- getError() {
424
- return this.error || this.nativeError;
417
+ updated(changedProperties) {
418
+ // Keep changedProperties arg so that subclasses may call it
419
+ // If a property such as `type` changes and causes the internal <input>
420
+ // value to change without dispatching an event, re-sync it.
421
+ const value = this.getInput().value;
422
+ if (this.value !== value) {
423
+ // Don't consider these updates (such as setting `defaultValue`) as
424
+ // the developer directly changing the `value`.
425
+ this.ignoreNextValueChange = true;
426
+ // Note this is typically inefficient in updated() since it schedules
427
+ // another update. However, it is needed for the <input> to fully render
428
+ // before checking its value.
429
+ this.value = value;
430
+ }
431
+ if (this.refreshErrorAlert) {
432
+ // The past render cycle removed the role="alert" from the error message.
433
+ // Re-add it after an animation frame to re-announce the error.
434
+ requestAnimationFrame(() => {
435
+ this.refreshErrorAlert = false;
436
+ });
437
+ }
425
438
  }
426
- /** @soyTemplate */
427
439
  renderField() {
428
440
  const prefix = this.renderPrefix();
429
441
  const suffix = this.renderSuffix();
430
442
  const input = this.renderInput();
431
- const inputValue = this.getInputValue();
432
443
  return staticHtml `<${this.fieldTag}
433
- class="md3-text-field__field"
444
+ class="field"
434
445
  ?disabled=${this.disabled}
435
- ?error=${this.getError()}
446
+ ?error=${this.hasError}
436
447
  ?focused=${this.focused}
437
448
  ?hasEnd=${this.hasTrailingIcon}
438
449
  ?hasStart=${this.hasLeadingIcon}
439
450
  .label=${this.label}
440
- ?populated=${!!inputValue}
451
+ ?populated=${!!this.getInputValue()}
441
452
  ?required=${this.required}
442
453
  >
443
454
  ${this.renderLeadingIcon()}
@@ -447,74 +458,44 @@ export class TextField extends LitElement {
447
458
  ${this.renderCounter()}
448
459
  </${this.fieldTag}>`;
449
460
  }
450
- /**
451
- * @soyTemplate
452
- * @slotName start
453
- */
454
461
  renderLeadingIcon() {
455
462
  return html `
456
- <span class="md3-text-field__icon md3-text-field__icon--leading"
457
- slot="start">
463
+ <span class="icon leading" slot="start">
458
464
  <slot name="leadingicon" @slotchange=${this.handleIconChange}></slot>
459
465
  </span>
460
466
  `;
461
467
  }
462
- /**
463
- * @soyTemplate
464
- * @slotName end
465
- */
466
468
  renderTrailingIcon() {
467
469
  return html `
468
- <span class="md3-text-field__icon md3-text-field__icon--trailing"
469
- slot="end">
470
+ <span class="icon trailing" slot="end">
470
471
  <slot name="trailingicon" @slotchange=${this.handleIconChange}></slot>
471
472
  </span>
472
473
  `;
473
474
  }
474
- /** @soyTemplate */
475
475
  renderInput() {
476
- // TODO(b/237283903): remove when custom isTruthy directive is supported
477
- const placeholderValue = this.placeholder || undefined;
478
- const ariaActiveDescendantValue = this.ariaActiveDescendant || undefined;
479
- const ariaAutoCompleteValue = this.ariaAutoComplete || undefined;
480
- const ariaControlsValue = this.ariaControls || undefined;
481
- const ariaDescribedByValue = this.getAriaDescribedBy() || undefined;
482
- const ariaExpandedValue = this.ariaExpanded || undefined;
483
- const ariaLabelValue = this.ariaLabel || this.label || undefined;
484
- const ariaLabelledByValue = this.ariaLabelledBy || undefined;
485
- const maxValue = this.max || undefined;
486
- const maxLengthValue = this.maxLength > -1 ? this.maxLength : undefined;
487
- const minValue = this.min || undefined;
488
- const minLengthValue = this.minLength > -1 ? this.minLength : undefined;
489
- const patternValue = this.pattern || undefined;
490
- const roleValue = this.role || undefined;
491
- const stepValue = this.step || undefined;
492
- /** @styleMap */
493
476
  const style = { direction: this.textDirection };
494
477
  // TODO(b/243805848): remove `as unknown as number` once lit analyzer is
495
478
  // fixed
496
479
  return html `<input
497
- class="md3-text-field__input"
498
480
  style=${styleMap(style)}
499
- aria-activedescendant=${ifDefined(ariaActiveDescendantValue)}
500
- aria-autocomplete=${ifDefined(ariaAutoCompleteValue)}
501
- aria-controls=${ifDefined(ariaControlsValue)}
502
- aria-describedby=${ifDefined(ariaDescribedByValue)}
503
- aria-expanded=${ifDefined(ariaExpandedValue)}
504
- aria-invalid=${this.getError()}
505
- aria-label=${ifDefined(ariaLabelValue)}
506
- aria-labelledby=${ifDefined(ariaLabelledByValue)}
481
+ aria-activedescendant=${this.ariaActiveDescendant || nothing}
482
+ aria-autocomplete=${this.ariaAutoComplete || nothing}
483
+ aria-controls=${this.ariaControls || nothing}
484
+ aria-describedby=${this.getAriaDescribedBy() || nothing}
485
+ aria-expanded=${this.ariaExpanded || nothing}
486
+ aria-invalid=${this.hasError}
487
+ aria-label=${this.ariaLabel || this.label || nothing}
507
488
  ?disabled=${this.disabled}
508
- max=${ifDefined(maxValue)}
509
- maxlength=${ifDefined(maxLengthValue)}
510
- min=${ifDefined(minValue)}
511
- minlength=${ifDefined(minLengthValue)}
512
- pattern=${ifDefined(patternValue)}
513
- placeholder=${ifDefined(placeholderValue)}
514
- role=${ifDefined(roleValue)}
489
+ max=${(this.max || nothing)}
490
+ maxlength=${this.maxLength > -1 ? this.maxLength : nothing}
491
+ min=${(this.min || nothing)}
492
+ minlength=${this.minLength > -1 ? this.minLength : nothing}
493
+ pattern=${this.pattern || nothing}
494
+ placeholder=${this.placeholder || nothing}
495
+ role=${this.role || nothing}
515
496
  ?readonly=${this.readOnly}
516
497
  ?required=${this.required}
517
- step=${ifDefined(stepValue)}
498
+ step=${(this.step || nothing)}
518
499
  type=${this.type}
519
500
  .value=${live(this.getInputValue())}
520
501
  @change=${this.redispatchEvent}
@@ -522,131 +503,80 @@ export class TextField extends LitElement {
522
503
  @select=${this.redispatchEvent}
523
504
  >`;
524
505
  }
525
- /** @soyTemplate */
526
506
  getInputValue() {
527
507
  const alwaysShowValue = this.dirty || this.valueHasChanged;
528
- return alwaysShowValue ? this.value : this.defaultValue || this.value;
508
+ if (alwaysShowValue) {
509
+ return this.value;
510
+ }
511
+ return this.defaultValue || this.value;
529
512
  }
530
- /** @soyTemplate */
531
513
  getAriaDescribedBy() {
532
- const hasSupport = !!this.getSupportingText();
533
- const hasCounter = this.hasCounter();
534
- // TODO(b/244609052): remove parens
535
- return (hasSupport || hasCounter) ?
536
- `${hasSupport ? this.supportingTextId : ''} ${hasCounter ? this.counterId : ''}` :
537
- '';
514
+ const ids = [];
515
+ if (this.getSupportingText()) {
516
+ ids.push('support');
517
+ }
518
+ if (this.getCounterText()) {
519
+ ids.push('counter');
520
+ }
521
+ return ids.join(' ');
538
522
  }
539
- /** @soyTemplate */
540
523
  renderPrefix() {
541
- return this.prefixText ?
542
- html `<span class="md3-text-field__prefix">${this.prefixText}</span>` :
543
- html ``;
544
- // TODO(b/217441842): Create shared function once argument bug is fixed
545
- // return this.renderAffix(/* isSuffix */ false);
524
+ return this.renderAffix(this.prefixText, /* isSuffix */ false);
546
525
  }
547
- /** @soyTemplate */
548
526
  renderSuffix() {
549
- return this.suffixText ?
550
- html `<span class="md3-text-field__suffix">${this.suffixText}</span>` :
551
- html ``;
552
- // TODO(b/217441842): Create shared function once argument bug is fixed
553
- // return this.renderAffix(/* isSuffix */ true);
527
+ return this.renderAffix(this.suffixText, /* isSuffix */ true);
528
+ }
529
+ renderAffix(text, isSuffix) {
530
+ if (!text) {
531
+ return nothing;
532
+ }
533
+ const classes = {
534
+ 'suffix': isSuffix,
535
+ 'prefix': !isSuffix,
536
+ };
537
+ return html `<span class="${classMap(classes)}">${text}</span>`;
554
538
  }
555
- /**
556
- * @soyTemplate
557
- * @slotName supporting-text
558
- */
559
539
  renderSupportingText() {
560
- const shouldAlert = this.shouldErrorAnnounce();
561
540
  const text = this.getSupportingText();
562
- const template = html `<span id=${this.supportingTextId}
563
- slot="supporting-text"
564
- role=${ifDefined(shouldAlert ? 'alert' : undefined)}>${text}</span>`;
565
- return text ? template : html ``;
541
+ if (!text) {
542
+ return nothing;
543
+ }
544
+ return html `<span id="support"
545
+ slot="supporting-text"
546
+ role=${this.shouldErrorAnnounce() ? 'alert' : nothing}>${text}</span>`;
566
547
  }
567
- /** @soyTemplate */
568
548
  getSupportingText() {
569
549
  const errorText = this.getErrorText();
570
- return this.getError() && errorText ? errorText : this.supportingText;
550
+ return this.hasError && errorText ? errorText : this.supportingText;
571
551
  }
572
- /** @soyTemplate */
573
552
  getErrorText() {
574
553
  return this.error ? this.errorText : this.nativeErrorText;
575
554
  }
576
- /** @soyTemplate */
577
555
  shouldErrorAnnounce() {
578
556
  // Announce if there is an error and error text visible.
579
557
  // If refreshErrorAlert is true, do not announce. This will remove the
580
558
  // role="alert" attribute. Another render cycle will happen after an
581
559
  // animation frame to re-add the role.
582
- return this.getError() && !!this.getErrorText() && !this.refreshErrorAlert;
560
+ return this.hasError && !!this.getErrorText() && !this.refreshErrorAlert;
583
561
  }
584
- /**
585
- * @soyTemplate
586
- * @slotName supporting-text-end
587
- */
588
562
  renderCounter() {
589
- const counter = html `<span id=${this.counterId}
590
- class="md3-text-field__counter"
591
- slot="supporting-text-end">${this.getCounterText()}</span>`;
563
+ const text = this.getCounterText();
564
+ if (!text) {
565
+ return nothing;
566
+ }
592
567
  // TODO(b/244473435): add aria-label and announcements
593
- return this.hasCounter() ? counter : html ``;
568
+ return html `<span id="counter"
569
+ class="counter"
570
+ slot="supporting-text-end">${text}</span>`;
594
571
  }
595
- // TODO(b/244197198): replace with !!this.getCounterText()
596
- /** @soyTemplate */
597
- hasCounter() {
598
- return this.maxLength > -1;
599
- }
600
- /** @soyTemplate */
601
572
  getCounterText() {
602
- // TODO(b/244197198): replace with string return
603
- const length = this.value.length;
604
- return this.hasCounter() ? html `${length} / ${this.maxLength}` : html ``;
605
- }
606
- update(changedProperties) {
607
- // Consider a value change anything that is not the initial empty string
608
- // value.
609
- const valueHasChanged = changedProperties.has('value') &&
610
- changedProperties.get('value') !== undefined;
611
- if (valueHasChanged && !this.ignoreNextValueChange) {
612
- this.valueHasChanged = true;
613
- }
614
- if (this.ignoreNextValueChange) {
615
- this.ignoreNextValueChange = false;
616
- }
617
- super.update(changedProperties);
618
- }
619
- updated(changedProperties) {
620
- // If a property such as `type` changes and causes the internal <input>
621
- // value to change without dispatching an event, re-sync it.
622
- const value = this.getInput().value;
623
- if (this.value !== value) {
624
- // Don't consider these updates (such as setting `defaultValue`) as
625
- // the developer directly changing the `value`.
626
- this.ignoreNextValueChange = true;
627
- // Note this is typically inefficient in updated() since it schedules
628
- // another update. However, it is needed for the <input> to fully render
629
- // before checking its value.
630
- this.value = value;
631
- }
632
- if (this.refreshErrorAlert) {
633
- // The past render cycle removed the role="alert" from the error message.
634
- // Re-add it after an animation frame to re-announce the error.
635
- requestAnimationFrame(() => {
636
- this.refreshErrorAlert = false;
637
- });
638
- }
639
- }
640
- /** @bubbleWizEvent */
641
- handleClick() {
642
- this.focus();
573
+ return this.maxLength > -1 ? `${this.value.length} / ${this.maxLength}` :
574
+ '';
643
575
  }
644
- /** @bubbleWizEvent */
645
- handleFocusin(event) {
576
+ handleFocusin() {
646
577
  this.focused = true;
647
578
  }
648
- /** @bubbleWizEvent */
649
- handleFocusout(event) {
579
+ handleFocusout() {
650
580
  if (this.matches(':focus-within')) {
651
581
  // Changing focus to another child within the text field, like a button
652
582
  return;
@@ -692,7 +622,7 @@ export class TextField extends LitElement {
692
622
  this.hasTrailingIcon = this.trailingIcons.length > 0;
693
623
  }
694
624
  }
695
- TextField.shadowRootOptions = { mode: 'open', delegatesFocus: true };
625
+ TextField.shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
696
626
  __decorate([
697
627
  property({ type: Boolean, reflect: true }),
698
628
  __metadata("design:type", Object)
@@ -775,12 +705,6 @@ __decorate([
775
705
  ,
776
706
  __metadata("design:type", String)
777
707
  ], TextField.prototype, "ariaLabel", void 0);
778
- __decorate([
779
- property({ type: String, attribute: 'data-aria-labelledby', noAccessor: true }),
780
- ariaProperty // tslint:disable-line:no-new-decorators
781
- ,
782
- __metadata("design:type", String)
783
- ], TextField.prototype, "ariaLabelledBy", void 0);
784
708
  __decorate([
785
709
  property({ type: String, attribute: 'data-role', noAccessor: true }),
786
710
  ariaProperty // tslint:disable-line:no-new-decorators
@@ -852,7 +776,7 @@ __decorate([
852
776
  __metadata("design:type", Object)
853
777
  ], TextField.prototype, "nativeErrorText", void 0);
854
778
  __decorate([
855
- query('.md3-text-field__input'),
779
+ query('input'),
856
780
  __metadata("design:type", HTMLInputElement)
857
781
  ], TextField.prototype, "input", void 0);
858
782
  __decorate([