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

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 (238) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +41 -41
  3. package/controller/form-controller.d.ts +1 -1
  4. package/controller/form-controller.js +21 -29
  5. package/controller/form-controller.js.map +1 -1
  6. package/field/lib/_content.scss +91 -13
  7. package/field/lib/_filled-field.scss +19 -57
  8. package/field/lib/_label.scss +1 -2
  9. package/field/lib/_md-comp-filled-field.scss +123 -64
  10. package/field/lib/_md-comp-outlined-field.scss +100 -59
  11. package/field/lib/_outlined-field.scss +13 -11
  12. package/field/lib/_shared.scss +21 -17
  13. package/field/lib/field.d.ts +2 -1
  14. package/field/lib/field.js +73 -62
  15. package/field/lib/field.js.map +1 -1
  16. package/field/lib/filled-field.d.ts +0 -5
  17. package/field/lib/filled-field.js +2 -41
  18. package/field/lib/filled-field.js.map +1 -1
  19. package/field/lib/filled-styles.css.js +1 -1
  20. package/field/lib/filled-styles.css.js.map +1 -1
  21. package/field/lib/outlined-field.js +1 -1
  22. package/field/lib/outlined-field.js.map +1 -1
  23. package/field/lib/outlined-styles.css.js +1 -1
  24. package/field/lib/outlined-styles.css.js.map +1 -1
  25. package/field/lib/shared-styles.css.js +1 -1
  26. package/field/lib/shared-styles.css.js.map +1 -1
  27. package/icon/lib/_icon.scss +1 -1
  28. package/icon/lib/_md-comp-icon.scss +1 -2
  29. package/icon/lib/icon-styles.css.js +1 -1
  30. package/icon/lib/icon-styles.css.js.map +1 -1
  31. package/list/lib/_list.scss +19 -9
  32. package/list/lib/list-styles.css.js +1 -1
  33. package/list/lib/list-styles.css.js.map +1 -1
  34. package/list/lib/listitem/_list-item.scss +293 -102
  35. package/list/lib/listitem/list-item-styles.css.js +1 -1
  36. package/list/lib/listitem/list-item-styles.css.js.map +1 -1
  37. package/list/lib/listitem/list-item.d.ts +7 -6
  38. package/list/lib/listitem/list-item.js +22 -26
  39. package/list/lib/listitem/list-item.js.map +1 -1
  40. package/list/list-item-link.d.ts +18 -0
  41. package/list/list-item-link.js +19 -2
  42. package/list/list-item-link.js.map +1 -1
  43. package/list/list-item.d.ts +19 -0
  44. package/list/list-item.js +20 -2
  45. package/list/list-item.js.map +1 -1
  46. package/menu/lib/_menu.scss +26 -5
  47. package/menu/lib/menu-styles.css.js +1 -1
  48. package/menu/lib/menu-styles.css.js.map +1 -1
  49. package/menu/lib/menu.js +8 -7
  50. package/menu/lib/menu.js.map +1 -1
  51. package/menu/lib/menuitem/_menu-item.scss +39 -79
  52. package/menu/lib/menuitem/menu-item-styles.css.js +1 -1
  53. package/menu/lib/menuitem/menu-item-styles.css.js.map +1 -1
  54. package/menu/lib/submenuitem/sub-menu-item.d.ts +0 -1
  55. package/menu/lib/submenuitem/sub-menu-item.js +0 -1
  56. package/menu/lib/submenuitem/sub-menu-item.js.map +1 -1
  57. package/menu/menu-item-link.js +1 -2
  58. package/menu/menu-item-link.js.map +1 -1
  59. package/menu/menu-item.js +2 -3
  60. package/menu/menu-item.js.map +1 -1
  61. package/menu/sub-menu-item.js +1 -2
  62. package/menu/sub-menu-item.js.map +1 -1
  63. package/menusurface/lib/_md-comp-menu-surface.scss +1 -1
  64. package/package.json +1 -1
  65. package/textfield/lib/_filled-text-field.scss +98 -96
  66. package/textfield/lib/_icon.scss +11 -55
  67. package/textfield/lib/_input.scss +4 -6
  68. package/textfield/lib/_outlined-text-field.scss +87 -88
  69. package/textfield/lib/filled-styles.css.js +1 -1
  70. package/textfield/lib/filled-styles.css.js.map +1 -1
  71. package/textfield/lib/outlined-styles.css.js +1 -1
  72. package/textfield/lib/outlined-styles.css.js.map +1 -1
  73. package/textfield/lib/shared-styles.css.js +1 -1
  74. package/textfield/lib/shared-styles.css.js.map +1 -1
  75. package/tokens/_index.scss +1 -1
  76. package/tokens/v0_161/_index.scss +107 -0
  77. package/tokens/v0_161/_md-comp-assist-chip.scss +109 -0
  78. package/tokens/v0_161/_md-comp-badge.scss +58 -0
  79. package/tokens/v0_161/_md-comp-banner.scss +75 -0
  80. package/tokens/v0_161/_md-comp-bottom-app-bar.scss +35 -0
  81. package/tokens/v0_161/_md-comp-carousel-item.scss +65 -0
  82. package/tokens/v0_161/_md-comp-checkbox.scss +126 -0
  83. package/tokens/v0_161/_md-comp-circular-progress-indicator.scss +39 -0
  84. package/tokens/v0_161/_md-comp-data-table.scss +96 -0
  85. package/tokens/v0_161/_md-comp-date-input-modal.scss +89 -0
  86. package/tokens/v0_161/_md-comp-date-picker-docked.scss +246 -0
  87. package/tokens/v0_161/_md-comp-date-picker-modal.scss +305 -0
  88. package/tokens/v0_161/_md-comp-dialog.scss +123 -0
  89. package/tokens/v0_161/_md-comp-divider.scss +25 -0
  90. package/tokens/v0_161/_md-comp-elevated-button.scss +91 -0
  91. package/tokens/v0_161/_md-comp-elevated-card.scss +59 -0
  92. package/tokens/v0_161/_md-comp-extended-fab-branded.scss +86 -0
  93. package/tokens/v0_161/_md-comp-extended-fab-primary.scss +94 -0
  94. package/tokens/v0_161/_md-comp-extended-fab-secondary.scss +95 -0
  95. package/tokens/v0_161/_md-comp-extended-fab-surface.scss +90 -0
  96. package/tokens/v0_161/_md-comp-extended-fab-tertiary.scss +95 -0
  97. package/tokens/v0_161/_md-comp-fab-branded-large.scss +60 -0
  98. package/tokens/v0_161/_md-comp-fab-branded.scss +60 -0
  99. package/tokens/v0_161/_md-comp-fab-primary-large.scss +65 -0
  100. package/tokens/v0_161/_md-comp-fab-primary-small.scss +65 -0
  101. package/tokens/v0_161/_md-comp-fab-primary.scss +65 -0
  102. package/tokens/v0_161/_md-comp-fab-secondary-large.scss +66 -0
  103. package/tokens/v0_161/_md-comp-fab-secondary-small.scss +66 -0
  104. package/tokens/v0_161/_md-comp-fab-secondary.scss +66 -0
  105. package/tokens/v0_161/_md-comp-fab-surface-large.scss +64 -0
  106. package/tokens/v0_161/_md-comp-fab-surface-small.scss +64 -0
  107. package/tokens/v0_161/_md-comp-fab-surface.scss +64 -0
  108. package/tokens/v0_161/_md-comp-fab-tertiary-large.scss +66 -0
  109. package/tokens/v0_161/_md-comp-fab-tertiary-small.scss +66 -0
  110. package/tokens/v0_161/_md-comp-fab-tertiary.scss +66 -0
  111. package/tokens/v0_161/_md-comp-filled-autocomplete.scss +267 -0
  112. package/tokens/v0_161/_md-comp-filled-button.scss +89 -0
  113. package/tokens/v0_161/_md-comp-filled-card.scss +58 -0
  114. package/tokens/v0_161/_md-comp-filled-icon-button.scss +79 -0
  115. package/tokens/v0_161/_md-comp-filled-menu-button.scss +98 -0
  116. package/tokens/v0_161/_md-comp-filled-select.scss +272 -0
  117. package/tokens/v0_161/_md-comp-filled-text-field.scss +189 -0
  118. package/tokens/v0_161/_md-comp-filled-tonal-button.scss +99 -0
  119. package/tokens/v0_161/_md-comp-filled-tonal-icon-button.scss +86 -0
  120. package/tokens/v0_161/_md-comp-filter-chip.scss +209 -0
  121. package/tokens/v0_161/_md-comp-full-screen-dialog.scss +111 -0
  122. package/tokens/v0_161/_md-comp-icon-button.scss +70 -0
  123. package/tokens/v0_161/_md-comp-input-chip.scss +184 -0
  124. package/tokens/v0_161/_md-comp-linear-progress-indicator.scss +41 -0
  125. package/tokens/v0_161/_md-comp-list.scss +248 -0
  126. package/tokens/v0_161/_md-comp-menu.scss +37 -0
  127. package/tokens/v0_161/_md-comp-navigation-bar.scss +114 -0
  128. package/tokens/v0_161/_md-comp-navigation-drawer.scss +162 -0
  129. package/tokens/v0_161/_md-comp-navigation-rail.scss +131 -0
  130. package/tokens/v0_161/_md-comp-outlined-autocomplete.scss +257 -0
  131. package/tokens/v0_161/_md-comp-outlined-button.scss +84 -0
  132. package/tokens/v0_161/_md-comp-outlined-card.scss +65 -0
  133. package/tokens/v0_161/_md-comp-outlined-icon-button.scss +79 -0
  134. package/tokens/v0_161/_md-comp-outlined-menu-button.scss +94 -0
  135. package/tokens/v0_161/_md-comp-outlined-segmented-button.scss +112 -0
  136. package/tokens/v0_161/_md-comp-outlined-select.scss +262 -0
  137. package/tokens/v0_161/_md-comp-outlined-text-field.scss +171 -0
  138. package/tokens/v0_161/_md-comp-plain-tooltip.scss +55 -0
  139. package/tokens/v0_161/_md-comp-primary-navigation-tab.scss +121 -0
  140. package/tokens/v0_161/_md-comp-radio-button.scss +68 -0
  141. package/tokens/v0_161/_md-comp-rich-tooltip.scss +121 -0
  142. package/tokens/v0_161/_md-comp-scrim.scss +25 -0
  143. package/tokens/v0_161/_md-comp-search-bar.scss +99 -0
  144. package/tokens/v0_161/_md-comp-search-view.scss +93 -0
  145. package/tokens/v0_161/_md-comp-secondary-navigation-tab.scss +84 -0
  146. package/tokens/v0_161/_md-comp-sheet-bottom.scss +45 -0
  147. package/tokens/v0_161/_md-comp-sheet-floating.scss +34 -0
  148. package/tokens/v0_161/_md-comp-sheet-side.scss +91 -0
  149. package/tokens/v0_161/_md-comp-slider.scss +114 -0
  150. package/tokens/v0_161/_md-comp-snackbar.scss +127 -0
  151. package/tokens/v0_161/_md-comp-standard-menu-button.scss +98 -0
  152. package/tokens/v0_161/_md-comp-suggestion-chip.scss +125 -0
  153. package/tokens/v0_161/_md-comp-switch.scss +136 -0
  154. package/tokens/v0_161/_md-comp-text-button.scss +77 -0
  155. package/tokens/v0_161/_md-comp-time-input.scss +218 -0
  156. package/tokens/v0_161/_md-comp-time-picker.scss +264 -0
  157. package/tokens/v0_161/_md-comp-top-app-bar-large.scss +63 -0
  158. package/tokens/v0_161/_md-comp-top-app-bar-medium.scss +63 -0
  159. package/tokens/v0_161/_md-comp-top-app-bar-small-centered.scss +66 -0
  160. package/tokens/v0_161/_md-comp-top-app-bar-small.scss +64 -0
  161. package/tokens/v0_161/_md-ref-palette.scss +107 -0
  162. package/tokens/v0_161/_md-ref-typeface.scss +21 -0
  163. package/tokens/v0_161/_md-sys-color.scss +904 -0
  164. package/tokens/v0_161/_md-sys-elevation.scss +21 -0
  165. package/tokens/v0_161/_md-sys-motion.scss +53 -0
  166. package/tokens/v0_161/_md-sys-shape.scss +30 -0
  167. package/tokens/v0_161/_md-sys-state.scss +19 -0
  168. package/tokens/v0_161/_md-sys-typescale.scss +284 -0
  169. package/tokens/v0_161/index.test.css.js +9 -0
  170. package/tokens/v0_161/index.test.css.js.map +1 -0
  171. package/tokens/v0_161/index.test.scss +584 -0
  172. package/tokens/v0_161/lib.test.css.js +9 -0
  173. package/tokens/v0_161/lib.test.css.js.map +1 -0
  174. package/tokens/v0_161/lib.test.scss +663 -0
  175. package/controller/foundation.d.ts +0 -24
  176. package/controller/foundation.js +0 -18
  177. package/controller/foundation.js.map +0 -1
  178. package/controller/observer-foundation.d.ts +0 -25
  179. package/controller/observer-foundation.js +0 -37
  180. package/controller/observer-foundation.js.map +0 -1
  181. package/controller/observer.d.ts +0 -52
  182. package/controller/observer.js +0 -149
  183. package/controller/observer.js.map +0 -1
  184. package/decorators/bound.d.ts +0 -40
  185. package/decorators/bound.js +0 -49
  186. package/decorators/bound.js.map +0 -1
  187. package/list/lib/avatar/_list-item-avatar.scss +0 -40
  188. package/list/lib/avatar/list-item-avatar-styles.css.js +0 -9
  189. package/list/lib/avatar/list-item-avatar-styles.css.js.map +0 -1
  190. package/list/lib/avatar/list-item-avatar-styles.scss +0 -10
  191. package/list/lib/avatar/list-item-avatar.d.ts +0 -21
  192. package/list/lib/avatar/list-item-avatar.js +0 -48
  193. package/list/lib/avatar/list-item-avatar.js.map +0 -1
  194. package/list/lib/icon/_list-item-icon.scss +0 -71
  195. package/list/lib/icon/list-item-icon-styles.css.js +0 -9
  196. package/list/lib/icon/list-item-icon-styles.css.js.map +0 -1
  197. package/list/lib/icon/list-item-icon-styles.scss +0 -10
  198. package/list/lib/icon/list-item-icon.d.ts +0 -9
  199. package/list/lib/icon/list-item-icon.js +0 -15
  200. package/list/lib/icon/list-item-icon.js.map +0 -1
  201. package/list/lib/image/_list-item-image.scss +0 -63
  202. package/list/lib/image/list-item-image-styles.css.d.ts +0 -1
  203. package/list/lib/image/list-item-image-styles.css.js +0 -9
  204. package/list/lib/image/list-item-image-styles.css.js.map +0 -1
  205. package/list/lib/image/list-item-image-styles.scss +0 -10
  206. package/list/lib/image/list-item-image.d.ts +0 -21
  207. package/list/lib/image/list-item-image.js +0 -48
  208. package/list/lib/image/list-item-image.js.map +0 -1
  209. package/list/lib/listitem/list-item-private-styles.css.d.ts +0 -1
  210. package/list/lib/listitem/list-item-private-styles.css.js +0 -9
  211. package/list/lib/listitem/list-item-private-styles.css.js.map +0 -1
  212. package/list/lib/listitem/list-item-private-styles.scss +0 -10
  213. package/list/lib/video/_list-item-video.scss +0 -71
  214. package/list/lib/video/list-item-video-styles.css.d.ts +0 -1
  215. package/list/lib/video/list-item-video-styles.css.js +0 -9
  216. package/list/lib/video/list-item-video-styles.css.js.map +0 -1
  217. package/list/lib/video/list-item-video-styles.scss +0 -10
  218. package/list/lib/video/list-item-video.d.ts +0 -53
  219. package/list/lib/video/list-item-video.js +0 -115
  220. package/list/lib/video/list-item-video.js.map +0 -1
  221. package/list/list-item-avatar.d.ts +0 -20
  222. package/list/list-item-avatar.js +0 -23
  223. package/list/list-item-avatar.js.map +0 -1
  224. package/list/list-item-icon.d.ts +0 -20
  225. package/list/list-item-icon.js +0 -23
  226. package/list/list-item-icon.js.map +0 -1
  227. package/list/list-item-image.d.ts +0 -20
  228. package/list/list-item-image.js +0 -23
  229. package/list/list-item-image.js.map +0 -1
  230. package/list/list-item-video.d.ts +0 -20
  231. package/list/list-item-video.js +0 -23
  232. package/list/list-item-video.js.map +0 -1
  233. package/menu/lib/menuitem/menu-item-private-styles.css.d.ts +0 -1
  234. package/menu/lib/menuitem/menu-item-private-styles.css.js +0 -9
  235. package/menu/lib/menuitem/menu-item-private-styles.css.js.map +0 -1
  236. package/menu/lib/menuitem/menu-item-private-styles.scss +0 -10
  237. /package/{list/lib/avatar/list-item-avatar-styles.css.d.ts → tokens/v0_161/index.test.css.d.ts} +0 -0
  238. /package/{list/lib/icon/list-item-icon-styles.css.d.ts → tokens/v0_161/lib.test.css.d.ts} +0 -0
package/LICENSE CHANGED
@@ -187,7 +187,7 @@
187
187
  same "printed page" as the copyright notice for easier
188
188
  identification within third-party archives.
189
189
 
190
- Copyright [yyyy] [name of copyright owner]
190
+ Copyright 2018-2023 Google, Inc.
191
191
 
192
192
  Licensed under the Apache License, Version 2.0 (the "License");
193
193
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -25,36 +25,36 @@ changes.
25
25
 
26
26
  **Stable** components are reviewed, documented, and API complete.
27
27
 
28
- - 🔴 Not started
28
+ - Not started
29
29
  - 🟡 In progress
30
- - 🟢 Complete
30
+ - Complete
31
31
 
32
32
  ### 1.0 Components
33
33
 
34
34
  Component | Alpha | Beta | Stable
35
35
  ----------------------------- | :---: | :--: | :----:
36
- Button | 🟢 | 🟢 | 🔴
37
- FAB | 🟢 | 🔴 | 🔴
38
- Icon button | 🟢 | 🔴 | 🔴
39
- Checkbox | 🟢 | 🟢 | 🔴
40
- Chips | 🔴 | 🔴 | 🔴
41
- Dialog | 🟢 | 🟢 | 🔴
42
- Divider | 🟢 | 🟢 | 🟡
43
- Elevation | 🟢 | 🔴 | 🔴
44
- Focus ring | 🟢 | 🔴 | 🔴
45
- Field | 🟢 | 🟢 | 🔴
46
- Icon | 🟢 | 🔴 | 🔴
47
- List | 🟢 | 🟢 | 🟡
48
- Menu | 🟢 | 🟢 | 🟡
49
- Progress indicator (circular) | 🔴 | 🔴 | 🔴
50
- Progress indicator (linear) | 🔴 | 🔴 | 🔴
51
- Radio button | 🟢 | 🟢 | 🔴
52
- Ripple | 🟢 | 🟢 | 🟡
53
- Select | 🟡 | 🔴 | 🔴
54
- Slider | 🟢 | 🟢 | 🔴
55
- Switch | 🟢 | 🟢 | 🔴
56
- Tabs | 🔴 | 🔴 | 🔴
57
- Text field | 🟢 | 🟢 | 🟡
36
+ Button | | |
37
+ FAB | | |
38
+ Icon button | | |
39
+ Checkbox | | |
40
+ Chips | | |
41
+ Dialog | | |
42
+ Divider | | | 🟡
43
+ Elevation | | |
44
+ Focus ring | | |
45
+ Field | | | 🟡
46
+ Icon | | |
47
+ List | | 🟡 | 🟡
48
+ Menu | | 🟡 | 🟡
49
+ Progress indicator (circular) | | |
50
+ Progress indicator (linear) | | |
51
+ Radio button | | |
52
+ Ripple | | | 🟡
53
+ Select | 🟡 | |
54
+ Slider | | |
55
+ Switch | | |
56
+ Tabs | | |
57
+ Text field | | | 🟡
58
58
 
59
59
  ### 1.1+ Components
60
60
 
@@ -62,20 +62,20 @@ These components are planned for release after 1.0.
62
62
 
63
63
  Component | Alpha | Beta | Stable
64
64
  ----------------- | :---: | :--: | :----:
65
- Autocomplete | 🟡 | 🔴 | 🔴
66
- Badge | 🟡 | 🔴 | 🔴
67
- Banner | 🔴 | 🔴 | 🔴
68
- Bottom app bar | 🔴 | 🔴 | 🔴
69
- Bottom sheet | 🔴 | 🔴 | 🔴
70
- Segmented button | 🟡 | 🔴 | 🔴
71
- Card | 🔴 | 🔴 | 🔴
72
- Data table | 🔴 | 🔴 | 🔴
73
- Date picker | 🔴 | 🔴 | 🔴
74
- Navigation bar | 🟡 | 🔴 | 🔴
75
- Navigation drawer | 🟡 | 🔴 | 🔴
76
- Navigation rail | 🔴 | 🔴 | 🔴
77
- Search | 🔴 | 🔴 | 🔴
78
- Snackbar | 🔴 | 🔴 | 🔴
79
- Time picker | 🔴 | 🔴 | 🔴
80
- Tooltip | 🔴 | 🔴 | 🔴
81
- Top app bar | 🔴 | 🔴 | 🔴
65
+ Autocomplete | 🟡 | |
66
+ Badge | 🟡 | |
67
+ Banner | | |
68
+ Bottom app bar | | |
69
+ Bottom sheet | | |
70
+ Segmented button | 🟡 | |
71
+ Card | | |
72
+ Data table | | |
73
+ Date picker | | |
74
+ Navigation bar | 🟡 | |
75
+ Navigation drawer | 🟡 | |
76
+ Navigation rail | | |
77
+ Search | | |
78
+ Snackbar | | |
79
+ Time picker | | |
80
+ Tooltip | | |
81
+ Top app bar | | |
@@ -62,5 +62,5 @@ export declare class FormController implements ReactiveController {
62
62
  constructor(element: FormElement);
63
63
  hostConnected(): void;
64
64
  hostDisconnected(): void;
65
- private formDataListener;
65
+ private readonly formDataListener;
66
66
  }
@@ -3,8 +3,6 @@
3
3
  * Copyright 2021 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { __decorate, __metadata } from "tslib";
7
- import { bound } from '../decorators/bound.js';
8
6
  import { isFormAssociated } from './form-associated.js';
9
7
  import { shimLabelSupport, SUPPORTS_FACE_LABEL } from './shim-label-activation.js';
10
8
  /**
@@ -30,6 +28,27 @@ export class FormController {
30
28
  */
31
29
  constructor(element) {
32
30
  this.element = element;
31
+ this.formDataListener = (event) => {
32
+ if (this.element.disabled) {
33
+ // Check for truthiness since some elements may not support disabling.
34
+ return;
35
+ }
36
+ const value = this.element[getFormValue]();
37
+ // If given a `FormData` instance, append all values to the form. This
38
+ // allows elements to customize what is added beyond a single name/value
39
+ // pair.
40
+ if (value instanceof FormData) {
41
+ for (const [key, dataValue] of value) {
42
+ event.formData.append(key, dataValue);
43
+ }
44
+ return;
45
+ }
46
+ // Do not associate the value with the form if there is no value or no name.
47
+ if (value === null || !this.element.name) {
48
+ return;
49
+ }
50
+ event.formData.append(this.element.name, value);
51
+ };
33
52
  }
34
53
  hostConnected() {
35
54
  // If the component internals are not in Shadow DOM, subscribing to form
@@ -51,32 +70,5 @@ export class FormController {
51
70
  hostDisconnected() {
52
71
  this.form?.removeEventListener('formdata', this.formDataListener);
53
72
  }
54
- formDataListener(event) {
55
- if (this.element.disabled) {
56
- // Check for truthiness since some elements may not support disabling.
57
- return;
58
- }
59
- const value = this.element[getFormValue]();
60
- // If given a `FormData` instance, append all values to the form. This
61
- // allows elements to customize what is added beyond a single name/value
62
- // pair.
63
- if (value instanceof FormData) {
64
- for (const [key, dataValue] of value) {
65
- event.formData.append(key, dataValue);
66
- }
67
- return;
68
- }
69
- // Do not associate the value with the form if there is no value or no name.
70
- if (value === null || !this.element.name) {
71
- return;
72
- }
73
- event.formData.append(this.element.name, value);
74
- }
75
73
  }
76
- __decorate([
77
- bound,
78
- __metadata("design:type", Function),
79
- __metadata("design:paramtypes", [FormDataEvent]),
80
- __metadata("design:returntype", void 0)
81
- ], FormController.prototype, "formDataListener", null);
82
74
  //# sourceMappingURL=form-controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-controller.js","sourceRoot":"","sources":["form-controller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAIH,OAAO,EAAC,KAAK,EAAC,MAAM,wBAAwB,CAAC;AAE7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAC,gBAAgB,EAAE,mBAAmB,EAAC,MAAM,4BAA4B,CAAC;AAkCjF;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,OAAO,cAAc;IAGzB;;;;OAIG;IACH,YAA6B,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;IAAG,CAAC;IAErD,aAAa;QACX,wEAAwE;QACxE,0EAA0E;QAC1E,sBAAsB;QACtB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE;YACtD,OAAO;SACR;QAED,wEAAwE;QACxE,iCAAiC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAC9B,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE/D,uEAAuE;QACvE,2CAA2C;QAC3C,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC1D,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAA2B,CAAC,CAAC;SACvE;IACH,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACpE,CAAC;IAGO,gBAAgB,CAAC,KAAoB;QAC3C,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YACzB,sEAAsE;YACtE,OAAO;SACR;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QAC3C,sEAAsE;QACtE,wEAAwE;QACxE,QAAQ;QACR,IAAI,KAAK,YAAY,QAAQ,EAAE;YAC7B,KAAK,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,IAAI,KAAK,EAAE;gBACpC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;aACvC;YACD,OAAO;SACR;QAED,4EAA4E;QAC5E,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YACxC,OAAO;SACR;QAED,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;CACF;AAzBC;IAAC,KAAK;;qCAC0B,aAAa;;sDAuB5C","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ReactiveController, ReactiveControllerHost} from 'lit';\n\nimport {bound} from '../decorators/bound.js';\n\nimport {isFormAssociated} from './form-associated.js';\nimport {shimLabelSupport, SUPPORTS_FACE_LABEL} from './shim-label-activation.js';\n\ndeclare global {\n interface Window {\n ShadyDOM?: {inUse: boolean;};\n }\n}\n\n/**\n * An element that `FormController` may use.\n */\nexport interface FormElement extends ReactiveControllerHost, HTMLElement {\n /**\n * The `<form>` that this element is associated with.\n */\n readonly form: HTMLFormElement|null;\n /**\n * The name of the element in the form. This property should reflect to a\n * `name` attribute.\n */\n name: string;\n /**\n * Whether or not this element is disabled. If present, this property should\n * reflect to a `disabled` attribute.\n */\n disabled?: boolean;\n /**\n * A function that retrieves the current form value for this element.\n *\n * @return The current form value, or `null` if there is no value.\n */\n [getFormValue](): string|File|FormData|null;\n}\n\n/**\n * A unique symbol key for `FormController` elements to implement their\n * `getFormValue()` function.\n */\nexport const getFormValue = Symbol('getFormValue');\n\n/**\n * A `ReactiveController` that adds `<form>` support to an element.\n *\n * Elements should also set `static formAssociated = true` which\n * provides platform support for forms. When an element is form associated,\n * it can be activated via clicks on associated label elements. It is the\n * responsibility of the element to process this click and perform any necessary\n * activation tasks, for example focusing and clicking on an internal element.\n *\n */\nexport class FormController implements ReactiveController {\n private form?: HTMLFormElement|null;\n\n /**\n * Creates a new `FormController` for the given element.\n *\n * @param element The element to add `<form>` support to.\n */\n constructor(private readonly element: FormElement) {}\n\n hostConnected() {\n // If the component internals are not in Shadow DOM, subscribing to form\n // data events could lead to duplicated data, which may not work correctly\n // on the server side.\n if (!this.element.shadowRoot || window.ShadyDOM?.inUse) {\n return;\n }\n\n // Preserve a reference to the form, since on hostDisconnected it may be\n // null if the child was removed.\n this.form = this.element.form;\n this.form?.addEventListener('formdata', this.formDataListener);\n\n // TODO(b/261871554) Label activation shim is currently only needed for\n // Safari. Remove it when no longer needed.\n if (isFormAssociated(this.element) && !SUPPORTS_FACE_LABEL) {\n shimLabelSupport(this.element.getRootNode() as Document | ShadowRoot);\n }\n }\n\n hostDisconnected() {\n this.form?.removeEventListener('formdata', this.formDataListener);\n }\n\n @bound\n private formDataListener(event: FormDataEvent) {\n if (this.element.disabled) {\n // Check for truthiness since some elements may not support disabling.\n return;\n }\n\n const value = this.element[getFormValue]();\n // If given a `FormData` instance, append all values to the form. This\n // allows elements to customize what is added beyond a single name/value\n // pair.\n if (value instanceof FormData) {\n for (const [key, dataValue] of value) {\n event.formData.append(key, dataValue);\n }\n return;\n }\n\n // Do not associate the value with the form if there is no value or no name.\n if (value === null || !this.element.name) {\n return;\n }\n\n event.formData.append(this.element.name, value);\n }\n}\n"]}
1
+ {"version":3,"file":"form-controller.js","sourceRoot":"","sources":["form-controller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAC,gBAAgB,EAAE,mBAAmB,EAAC,MAAM,4BAA4B,CAAC;AAkCjF;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,OAAO,cAAc;IAGzB;;;;OAIG;IACH,YAA6B,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;QA0BhC,qBAAgB,GAAG,CAAC,KAAoB,EAAE,EAAE;YAC3D,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACzB,sEAAsE;gBACtE,OAAO;aACR;YAED,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YAC3C,sEAAsE;YACtE,wEAAwE;YACxE,QAAQ;YACR,IAAI,KAAK,YAAY,QAAQ,EAAE;gBAC7B,KAAK,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,IAAI,KAAK,EAAE;oBACpC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;iBACvC;gBACD,OAAO;aACR;YAED,4EAA4E;YAC5E,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;gBACxC,OAAO;aACR;YAED,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAClD,CAAC,CAAC;IAjDkD,CAAC;IAErD,aAAa;QACX,wEAAwE;QACxE,0EAA0E;QAC1E,sBAAsB;QACtB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE;YACtD,OAAO;SACR;QAED,wEAAwE;QACxE,iCAAiC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAC9B,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE/D,uEAAuE;QACvE,2CAA2C;QAC3C,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC1D,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAA2B,CAAC,CAAC;SACvE;IACH,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACpE,CAAC;CA0BF","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ReactiveController, ReactiveControllerHost} from 'lit';\n\nimport {isFormAssociated} from './form-associated.js';\nimport {shimLabelSupport, SUPPORTS_FACE_LABEL} from './shim-label-activation.js';\n\ndeclare global {\n interface Window {\n ShadyDOM?: {inUse: boolean;};\n }\n}\n\n/**\n * An element that `FormController` may use.\n */\nexport interface FormElement extends ReactiveControllerHost, HTMLElement {\n /**\n * The `<form>` that this element is associated with.\n */\n readonly form: HTMLFormElement|null;\n /**\n * The name of the element in the form. This property should reflect to a\n * `name` attribute.\n */\n name: string;\n /**\n * Whether or not this element is disabled. If present, this property should\n * reflect to a `disabled` attribute.\n */\n disabled?: boolean;\n /**\n * A function that retrieves the current form value for this element.\n *\n * @return The current form value, or `null` if there is no value.\n */\n [getFormValue](): string|File|FormData|null;\n}\n\n/**\n * A unique symbol key for `FormController` elements to implement their\n * `getFormValue()` function.\n */\nexport const getFormValue = Symbol('getFormValue');\n\n/**\n * A `ReactiveController` that adds `<form>` support to an element.\n *\n * Elements should also set `static formAssociated = true` which\n * provides platform support for forms. When an element is form associated,\n * it can be activated via clicks on associated label elements. It is the\n * responsibility of the element to process this click and perform any necessary\n * activation tasks, for example focusing and clicking on an internal element.\n *\n */\nexport class FormController implements ReactiveController {\n private form?: HTMLFormElement|null;\n\n /**\n * Creates a new `FormController` for the given element.\n *\n * @param element The element to add `<form>` support to.\n */\n constructor(private readonly element: FormElement) {}\n\n hostConnected() {\n // If the component internals are not in Shadow DOM, subscribing to form\n // data events could lead to duplicated data, which may not work correctly\n // on the server side.\n if (!this.element.shadowRoot || window.ShadyDOM?.inUse) {\n return;\n }\n\n // Preserve a reference to the form, since on hostDisconnected it may be\n // null if the child was removed.\n this.form = this.element.form;\n this.form?.addEventListener('formdata', this.formDataListener);\n\n // TODO(b/261871554) Label activation shim is currently only needed for\n // Safari. Remove it when no longer needed.\n if (isFormAssociated(this.element) && !SUPPORTS_FACE_LABEL) {\n shimLabelSupport(this.element.getRootNode() as Document | ShadowRoot);\n }\n }\n\n hostDisconnected() {\n this.form?.removeEventListener('formdata', this.formDataListener);\n }\n\n private readonly formDataListener = (event: FormDataEvent) => {\n if (this.element.disabled) {\n // Check for truthiness since some elements may not support disabling.\n return;\n }\n\n const value = this.element[getFormValue]();\n // If given a `FormData` instance, append all values to the form. This\n // allows elements to customize what is added beyond a single name/value\n // pair.\n if (value instanceof FormData) {\n for (const [key, dataValue] of value) {\n event.formData.append(key, dataValue);\n }\n return;\n }\n\n // Do not associate the value with the form if there is no value or no name.\n if (value === null || !this.element.name) {\n return;\n }\n\n event.formData.append(this.element.name, value);\n };\n}\n"]}
@@ -4,14 +4,16 @@
4
4
  //
5
5
 
6
6
  // go/keep-sorted start
7
+ @use 'sass:map';
7
8
  @use 'sass:math';
8
9
  // go/keep-sorted end
9
10
  // go/keep-sorted start
10
- @use '../../motion/animation';
11
+ @use '../../tokens';
11
12
  // go/keep-sorted end
12
13
 
14
+ $_md-sys-motion: tokens.md-sys-motion-values();
13
15
  // Duration of the label animation.
14
- $_label-duration: 150ms;
16
+ $_label-duration: map.get($_md-sys-motion, 'duration-short3');
15
17
  // Duration of the content's visibility animation.
16
18
  $_visible-duration: math.round(math.div($_label-duration * 5, 9));
17
19
  // Short delay when entering (focusing/populating) so that the label may move
@@ -23,7 +25,6 @@ $_enter-delay: $_label-duration - $_visible-duration;
23
25
  .middle,
24
26
  .end {
25
27
  display: flex;
26
- align-items: center;
27
28
  box-sizing: border-box;
28
29
  height: 100%;
29
30
  // Relative position for absolutely positioned labels (to avoid interfering
@@ -31,12 +32,36 @@ $_enter-delay: $_label-duration - $_visible-duration;
31
32
  position: relative;
32
33
  }
33
34
 
35
+ .start {
36
+ color: var(--_leading-content-color);
37
+ }
38
+
39
+ .end {
40
+ color: var(--_trailing-content-color);
41
+ }
42
+
34
43
  .start,
35
44
  .end {
45
+ align-items: center;
36
46
  justify-content: center;
37
47
  }
38
48
 
49
+ // TODO(b/239188049): remove when layout tokens are ready
50
+ .with-start .start,
51
+ .with-end .end {
52
+ min-width: 48px;
53
+ }
54
+
55
+ .with-start .start {
56
+ margin-inline-end: 4px;
57
+ }
58
+
59
+ .with-end .end {
60
+ margin-inline-start: 4px;
61
+ }
62
+
39
63
  .middle {
64
+ align-items: stretch;
40
65
  // The container of the field aligns sections by "center". Only the middle
41
66
  // section opts in to baseline alignment.
42
67
  //
@@ -49,13 +74,16 @@ $_enter-delay: $_label-duration - $_visible-duration;
49
74
  }
50
75
 
51
76
  .content {
52
- display: flex;
53
- flex: 1;
54
- opacity: 0;
55
- transition: animation.standard(opacity, $_visible-duration);
56
77
  // Content elements provided to the field (such as <input>) may use
57
78
  // `currentColor` to inherit this property.
58
79
  color: var(--_content-color);
80
+ display: flex;
81
+ flex: 1;
82
+ // Content elements provided to the field (such as <input>) may inherit font
83
+ font: var(--_content-type);
84
+ opacity: 0;
85
+ transition: opacity $_visible-duration
86
+ map.get($_md-sys-motion, 'easing-emphasized');
59
87
  }
60
88
 
61
89
  .no-label .content,
@@ -65,33 +93,83 @@ $_enter-delay: $_label-duration - $_visible-duration;
65
93
  transition-delay: $_enter-delay;
66
94
  }
67
95
 
68
- .disabled.no-label .content,
69
- .disabled.focused .content,
70
- .disabled.populated .content {
71
- opacity: var(--_disabled-content-opacity);
72
- }
73
-
74
96
  :hover .content {
75
97
  color: var(--_hover-content-color);
76
98
  }
77
99
 
100
+ :hover .start {
101
+ color: var(--_hover-leading-content-color);
102
+ }
103
+
104
+ :hover .end {
105
+ color: var(--_hover-trailing-content-color);
106
+ }
107
+
78
108
  .focused .content {
79
109
  color: var(--_focus-content-color);
80
110
  }
81
111
 
112
+ .focused .start {
113
+ color: var(--_focus-leading-content-color);
114
+ }
115
+
116
+ .focused .end {
117
+ color: var(--_focus-trailing-content-color);
118
+ }
119
+
82
120
  .disabled .content {
83
121
  color: var(--_disabled-content-color);
84
122
  }
85
123
 
124
+ .disabled.no-label .content,
125
+ .disabled.focused .content,
126
+ .disabled.populated .content {
127
+ opacity: var(--_disabled-content-opacity);
128
+ }
129
+
130
+ .disabled .start {
131
+ color: var(--_disabled-leading-content-color);
132
+ opacity: var(--_disabled-leading-content-opacity);
133
+ }
134
+
135
+ .disabled .end {
136
+ color: var(--_disabled-trailing-content-color);
137
+ opacity: var(--_disabled-trailing-content-opacity);
138
+ }
139
+
86
140
  .error .content {
87
141
  color: var(--_error-content-color);
88
142
  }
89
143
 
144
+ .error .start {
145
+ color: var(--_error-leading-content-color);
146
+ }
147
+
148
+ .error .end {
149
+ color: var(--_error-trailing-content-color);
150
+ }
151
+
90
152
  .error:hover .content {
91
153
  color: var(--_error-hover-content-color);
92
154
  }
93
155
 
156
+ .error:hover .start {
157
+ color: var(--_error-hover-leading-content-color);
158
+ }
159
+
160
+ .error:hover .end {
161
+ color: var(--_error-hover-trailing-content-color);
162
+ }
163
+
94
164
  .error.focused .content {
95
165
  color: var(--_error-focus-content-color);
96
166
  }
167
+
168
+ .error.focused .start {
169
+ color: var(--_error-focus-leading-content-color);
170
+ }
171
+
172
+ .error.focused .end {
173
+ color: var(--_error-focus-trailing-content-color);
174
+ }
97
175
  }
@@ -7,13 +7,13 @@
7
7
  @use 'sass:map';
8
8
  // go/keep-sorted end
9
9
  // go/keep-sorted start
10
- @use '../../motion/animation';
11
10
  @use '../../sass/shape';
12
11
  @use '../../sass/theme';
12
+ @use '../../tokens';
13
13
  @use './md-comp-filled-field';
14
14
  // go/keep-sorted end
15
15
 
16
- $_animation-duration: 150ms;
16
+ $_md-sys-motion: tokens.md-sys-motion-values();
17
17
 
18
18
  @mixin theme($tokens) {
19
19
  $reference: md-comp-filled-field.values();
@@ -35,63 +35,35 @@ $_animation-duration: 150ms;
35
35
  }
36
36
  }
37
37
 
38
- .container {
39
- border-start-start-radius: var(--_container-shape-start-start);
40
- border-start-end-radius: var(--_container-shape-start-end);
41
- border-end-end-radius: var(--_container-shape-end-end);
42
- border-end-start-radius: var(--_container-shape-end-start);
43
- // If bottom corner radii are set, prevent the active indicator from
44
- // overflowing.
45
- overflow: hidden;
46
- // Needed for negative z-index below to place background and state layer
47
- // behind content.
48
- z-index: 0;
49
-
50
- // ::before is used for background color so that opacity may be changed
51
- // without affecting content
52
- &::before {
53
- background: var(--_container-color);
54
- }
55
-
56
- // ::after is used for the state layer color and opacity
57
- &::after {
58
- visibility: hidden;
59
- }
60
-
61
- &::before,
62
- &::after {
63
- border-radius: inherit;
64
- content: '';
65
- display: flex;
66
- height: 100%;
67
- position: absolute;
68
- width: 100%;
69
- z-index: -1;
70
- }
38
+ .background,
39
+ .state-layer {
40
+ border-radius: inherit;
41
+ inset: 0;
42
+ pointer-events: none;
43
+ position: absolute;
71
44
  }
72
45
 
73
- .label.floating {
74
- position: absolute;
75
- top: 0;
46
+ .background {
47
+ background: var(--_container-color);
76
48
  }
77
49
 
78
50
  .state-layer {
79
- border-radius: inherit;
80
- height: 100%;
81
- position: absolute;
82
- width: 100%;
83
51
  visibility: hidden;
84
- z-index: -1;
85
52
  }
86
53
 
87
54
  .field:not(.disabled):hover .state-layer {
88
55
  visibility: visible;
89
56
  }
90
57
 
58
+ .label.floating {
59
+ position: absolute;
60
+ top: 0;
61
+ }
62
+
91
63
  .active-indicator {
64
+ inset: auto 0 0 0;
92
65
  // Prevent click events on the indicator element since it has no width and
93
66
  // causes bugs when handled by the foundation for updating transform-origin.
94
- inset: auto 0 0 0;
95
67
  pointer-events: none;
96
68
  position: absolute;
97
69
  width: 100%;
@@ -109,23 +81,13 @@ $_animation-duration: 150ms;
109
81
  // focused indicator
110
82
  &::after {
111
83
  opacity: 0;
112
- transform: scaleX(0);
113
- // The element needs to update the transform-origin style attribute in
114
- // response to click events. Psuedo elements cannot have their style
115
- // updated, but their transform-origin can be inherited.
116
- transform-origin: inherit;
117
- // Add two transitions: opacity and a delayed transform. With a non-delayed
118
- // transform transition on the focus selector without an opacity transition,
119
- // this will result in the indicator scaling on enter and fading on exit.
120
- transition: animation.standard(opacity, $_animation-duration),
121
- transform 0s ease $_animation-duration;
84
+ transition: opacity map.get($_md-sys-motion, 'duration-short3')
85
+ map.get($_md-sys-motion, 'easing-emphasized');
122
86
  }
123
87
  }
124
88
 
125
89
  .focused .active-indicator::after {
126
90
  opacity: 1;
127
- transform: scaleX(1);
128
- transition: animation.standard(transform, $_animation-duration);
129
91
  }
130
92
 
131
93
  .field:not(.with-start) .start {
@@ -167,7 +129,7 @@ $_animation-duration: 150ms;
167
129
  opacity: var(--_disabled-active-indicator-opacity);
168
130
  }
169
131
 
170
- .disabled .container::before {
132
+ .disabled .background {
171
133
  background: var(--_disabled-container-color);
172
134
  opacity: var(--_disabled-container-opacity);
173
135
  }
@@ -28,13 +28,12 @@
28
28
  position: absolute;
29
29
  top: 50%;
30
30
  transform: translateY(-50%);
31
- /*rtl:ignore*/
32
- transform-origin: top left;
33
31
  }
34
32
 
35
33
  .label.floating {
36
34
  font-size: var(--_label-text-populated-size);
37
35
  line-height: var(--_label-text-populated-line-height);
36
+ transform-origin: top left;
38
37
  }
39
38
 
40
39
  .label.hidden {