material 3.0.0-next.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/README.md +59 -370
  2. package/dist/components/badge/index.d.ts +1 -1
  3. package/dist/components/badge/index.js +1 -1
  4. package/dist/components/button/index.d.ts +1 -1
  5. package/dist/components/button/index.js +1 -1
  6. package/dist/components/card/index.d.ts +1 -1
  7. package/dist/components/card/index.js +1 -1
  8. package/dist/components/checkbox/index.d.ts +1 -1
  9. package/dist/components/checkbox/index.js +1 -1
  10. package/dist/components/chips/index.d.ts +1 -1
  11. package/dist/components/chips/index.js +1 -1
  12. package/dist/components/datepicker/index.d.ts +1 -1
  13. package/dist/components/datepicker/index.js +1 -1
  14. package/dist/components/dialog/index.d.ts +1 -1
  15. package/dist/components/dialog/index.js +1 -1
  16. package/dist/components/divider/index.d.ts +1 -1
  17. package/dist/components/divider/index.js +1 -1
  18. package/dist/components/drawer/index.d.ts +1 -1
  19. package/dist/components/drawer/index.js +1 -1
  20. package/dist/components/index.d.ts +1 -1
  21. package/dist/components/list/config.js +6 -1
  22. package/dist/components/list/constants.d.ts +10 -0
  23. package/dist/components/list/constants.js +4 -0
  24. package/dist/components/list/index.d.ts +3 -3
  25. package/dist/components/list/index.js +2 -2
  26. package/dist/components/list/list.d.ts +17 -0
  27. package/dist/components/list/list.js +2 -2
  28. package/dist/components/list/types.d.ts +29 -1
  29. package/dist/components/loading-indicator/index.d.ts +1 -1
  30. package/dist/components/loading-indicator/index.js +1 -1
  31. package/dist/components/menu/index.d.ts +1 -1
  32. package/dist/components/menu/index.js +1 -1
  33. package/dist/components/progress/index.d.ts +1 -1
  34. package/dist/components/progress/index.js +1 -1
  35. package/dist/components/progress/types.d.ts +20 -10
  36. package/dist/components/radios/index.d.ts +1 -1
  37. package/dist/components/radios/index.js +1 -1
  38. package/dist/components/search/index.d.ts +1 -1
  39. package/dist/components/search/index.js +1 -1
  40. package/dist/components/select/index.d.ts +1 -1
  41. package/dist/components/select/index.js +1 -1
  42. package/dist/components/slider/index.d.ts +1 -1
  43. package/dist/components/slider/index.js +1 -1
  44. package/dist/components/slider/types.d.ts +7 -0
  45. package/dist/components/snackbar/index.d.ts +1 -1
  46. package/dist/components/snackbar/index.js +1 -1
  47. package/dist/components/split-button/index.d.ts +1 -1
  48. package/dist/components/split-button/index.js +1 -1
  49. package/dist/components/switch/index.d.ts +1 -1
  50. package/dist/components/switch/index.js +1 -1
  51. package/dist/components/tabs/index.d.ts +1 -0
  52. package/dist/components/tabs/index.js +1 -0
  53. package/dist/components/tabs/types.d.ts +15 -3
  54. package/dist/components/text-field/features/placement.js +7 -4
  55. package/dist/components/timepicker/index.d.ts +1 -1
  56. package/dist/components/timepicker/index.js +1 -1
  57. package/dist/components/tooltip/index.d.ts +1 -1
  58. package/dist/components/tooltip/index.js +1 -1
  59. package/dist/core/compose/features/textinput.js +3 -1
  60. package/dist/core/compose/index.d.ts +1 -1
  61. package/dist/core/dom/html.d.ts +1 -1
  62. package/dist/elements/css/button.css +1 -1
  63. package/dist/elements/css/button.js +1 -1
  64. package/dist/elements/css/card.css +1 -1
  65. package/dist/elements/css/card.js +1 -1
  66. package/dist/elements/css/checkbox.css +1 -1
  67. package/dist/elements/css/checkbox.js +1 -1
  68. package/dist/elements/css/chips.css +1 -1
  69. package/dist/elements/css/chips.js +1 -1
  70. package/dist/elements/css/dialog.css +1 -1
  71. package/dist/elements/css/dialog.js +1 -1
  72. package/dist/elements/css/extended-fab.css +1 -1
  73. package/dist/elements/css/extended-fab.js +1 -1
  74. package/dist/elements/css/fab-menu.css +1 -1
  75. package/dist/elements/css/fab-menu.js +1 -1
  76. package/dist/elements/css/fab.css +1 -1
  77. package/dist/elements/css/fab.js +1 -1
  78. package/dist/elements/css/hosts/switch.css +1 -1
  79. package/dist/elements/css/hosts/text-field.css +1 -1
  80. package/dist/elements/css/icon-button.css +1 -1
  81. package/dist/elements/css/icon-button.js +1 -1
  82. package/dist/elements/css/list.css +1 -1
  83. package/dist/elements/css/list.js +1 -1
  84. package/dist/elements/css/menu.css +1 -1
  85. package/dist/elements/css/menu.js +1 -1
  86. package/dist/elements/css/radios.css +1 -1
  87. package/dist/elements/css/radios.js +1 -1
  88. package/dist/elements/css/select.css +1 -1
  89. package/dist/elements/css/select.js +1 -1
  90. package/dist/elements/css/side-sheet.css +1 -1
  91. package/dist/elements/css/side-sheet.js +1 -1
  92. package/dist/elements/css/slider.css +1 -1
  93. package/dist/elements/css/slider.js +1 -1
  94. package/dist/elements/css/snackbar.css +1 -1
  95. package/dist/elements/css/snackbar.js +1 -1
  96. package/dist/elements/css/switch.css +1 -1
  97. package/dist/elements/css/switch.js +1 -1
  98. package/dist/elements/css/text-field.css +1 -1
  99. package/dist/elements/css/text-field.js +1 -1
  100. package/dist/elements/define.d.ts +20 -0
  101. package/dist/elements/list.d.ts +6 -0
  102. package/dist/elements/list.js +1 -0
  103. package/dist/elements/preupgrade/badge.css +1 -1
  104. package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
  105. package/dist/elements/preupgrade/bottom-sheet.css +1 -1
  106. package/dist/elements/preupgrade/button-group.css +1 -1
  107. package/dist/elements/preupgrade/button.css +2 -2
  108. package/dist/elements/preupgrade/card.css +1 -1
  109. package/dist/elements/preupgrade/carousel.css +1 -1
  110. package/dist/elements/preupgrade/checkbox.css +2 -2
  111. package/dist/elements/preupgrade/chips.css +1 -1
  112. package/dist/elements/preupgrade/datepicker.css +1 -1
  113. package/dist/elements/preupgrade/dialog.css +1 -1
  114. package/dist/elements/preupgrade/divider.css +1 -1
  115. package/dist/elements/preupgrade/drawer.css +1 -1
  116. package/dist/elements/preupgrade/extended-fab.css +1 -1
  117. package/dist/elements/preupgrade/fab-menu.css +1 -1
  118. package/dist/elements/preupgrade/fab.css +1 -1
  119. package/dist/elements/preupgrade/icon-button.css +1 -1
  120. package/dist/elements/preupgrade/list.css +2 -2
  121. package/dist/elements/preupgrade/loading-indicator.css +1 -1
  122. package/dist/elements/preupgrade/menu.css +1 -1
  123. package/dist/elements/preupgrade/navigation-bar.css +1 -1
  124. package/dist/elements/preupgrade/navigation-rail.css +1 -1
  125. package/dist/elements/preupgrade/progress.css +1 -1
  126. package/dist/elements/preupgrade/radios.css +2 -2
  127. package/dist/elements/preupgrade/search.css +1 -1
  128. package/dist/elements/preupgrade/select.css +1 -1
  129. package/dist/elements/preupgrade/side-sheet.css +1 -1
  130. package/dist/elements/preupgrade/slider.css +1 -1
  131. package/dist/elements/preupgrade/snackbar.css +1 -1
  132. package/dist/elements/preupgrade/split-button.css +1 -1
  133. package/dist/elements/preupgrade/switch.css +2 -2
  134. package/dist/elements/preupgrade/tabs.css +1 -1
  135. package/dist/elements/preupgrade/text-field.css +2 -2
  136. package/dist/elements/preupgrade/timepicker.css +1 -1
  137. package/dist/elements/preupgrade/toolbar.css +1 -1
  138. package/dist/elements/preupgrade/tooltip.css +1 -1
  139. package/dist/elements/preupgrade/top-app-bar.css +1 -1
  140. package/dist/elements/preupgrade.css +2 -2
  141. package/dist/elements/preupgrade.js +1 -1
  142. package/dist/elements/styles.d.ts +13 -1
  143. package/dist/elements/switch.d.ts +1 -0
  144. package/dist/elements/switch.js +1 -0
  145. package/dist/elements/text-field.js +1 -5
  146. package/dist/package.json +28 -4
  147. package/dist/styles/badge.css +1 -1
  148. package/dist/styles/base.css +1 -1
  149. package/dist/styles/bottom-app-bar.css +1 -1
  150. package/dist/styles/bottom-sheet.css +1 -1
  151. package/dist/styles/button-group.css +1 -1
  152. package/dist/styles/button.css +2 -2
  153. package/dist/styles/card.css +2 -2
  154. package/dist/styles/carousel.css +1 -1
  155. package/dist/styles/checkbox.css +2 -2
  156. package/dist/styles/chips.css +2 -2
  157. package/dist/styles/contrast.css +1 -1
  158. package/dist/styles/datepicker.css +1 -1
  159. package/dist/styles/dialog.css +2 -2
  160. package/dist/styles/divider.css +1 -1
  161. package/dist/styles/drawer.css +1 -1
  162. package/dist/styles/extended-fab.css +2 -2
  163. package/dist/styles/fab-menu.css +2 -2
  164. package/dist/styles/fab.css +2 -2
  165. package/dist/styles/icon-button.css +2 -2
  166. package/dist/styles/list.css +2 -2
  167. package/dist/styles/loading-indicator.css +1 -1
  168. package/dist/styles/menu.css +2 -2
  169. package/dist/styles/navigation-bar.css +1 -1
  170. package/dist/styles/navigation-rail.css +1 -1
  171. package/dist/styles/progress.css +1 -1
  172. package/dist/styles/radios.css +2 -2
  173. package/dist/styles/search.css +1 -1
  174. package/dist/styles/select.css +2 -2
  175. package/dist/styles/side-sheet.css +2 -2
  176. package/dist/styles/slider.css +2 -2
  177. package/dist/styles/snackbar.css +2 -2
  178. package/dist/styles/split-button.css +1 -1
  179. package/dist/styles/switch.css +2 -2
  180. package/dist/styles/tabs.css +1 -1
  181. package/dist/styles/text-field.css +2 -2
  182. package/dist/styles/timepicker.css +1 -1
  183. package/dist/styles/toolbar.css +1 -1
  184. package/dist/styles/tooltip.css +1 -1
  185. package/dist/styles/top-app-bar.css +1 -1
  186. package/dist/styles/typography.css +1 -1
  187. package/dist/styles/utilities.css +1 -1
  188. package/dist/styles.css +2 -2
  189. package/dist/themes/autumn-contrast.css +1 -1
  190. package/dist/themes/autumn.css +1 -1
  191. package/dist/themes/baseline-contrast.css +1 -1
  192. package/dist/themes/baseline.css +1 -1
  193. package/dist/themes/brownbeige-contrast.css +1 -1
  194. package/dist/themes/brownbeige.css +1 -1
  195. package/dist/themes/content-contrast.css +1 -1
  196. package/dist/themes/content.css +1 -1
  197. package/dist/themes/desert-contrast.css +1 -1
  198. package/dist/themes/desert.css +1 -1
  199. package/dist/themes/expressive-contrast.css +1 -1
  200. package/dist/themes/expressive.css +1 -1
  201. package/dist/themes/fidelity-contrast.css +1 -1
  202. package/dist/themes/fidelity.css +1 -1
  203. package/dist/themes/forest-contrast.css +1 -1
  204. package/dist/themes/forest.css +1 -1
  205. package/dist/themes/fruit-salad-contrast.css +1 -1
  206. package/dist/themes/fruit-salad.css +1 -1
  207. package/dist/themes/highcontrast-contrast.css +1 -1
  208. package/dist/themes/highcontrast.css +1 -1
  209. package/dist/themes/monochrome-contrast.css +1 -1
  210. package/dist/themes/monochrome.css +1 -1
  211. package/dist/themes/neutral-contrast.css +1 -1
  212. package/dist/themes/neutral.css +1 -1
  213. package/dist/themes/ocean-contrast.css +1 -1
  214. package/dist/themes/ocean.css +1 -1
  215. package/dist/themes/rainbow-contrast.css +1 -1
  216. package/dist/themes/rainbow.css +1 -1
  217. package/dist/themes/sageivory-contrast.css +1 -1
  218. package/dist/themes/sageivory.css +1 -1
  219. package/dist/themes/spring-contrast.css +1 -1
  220. package/dist/themes/spring.css +1 -1
  221. package/dist/themes/summer-contrast.css +1 -1
  222. package/dist/themes/summer.css +1 -1
  223. package/dist/themes/sunset-contrast.css +1 -1
  224. package/dist/themes/sunset.css +1 -1
  225. package/dist/themes/tealcaramel-contrast.css +1 -1
  226. package/dist/themes/tealcaramel.css +1 -1
  227. package/dist/themes/vibrant-contrast.css +1 -1
  228. package/dist/themes/vibrant.css +1 -1
  229. package/package.json +28 -4
  230. package/src/styles/abstract/_mixins.scss +17 -5
  231. package/src/styles/abstract/_variables.scss +1 -1
  232. package/src/styles/components/_button.scss +10 -7
  233. package/src/styles/components/_checkbox.scss +10 -0
  234. package/src/styles/components/_chips.scss +10 -0
  235. package/src/styles/components/_dialog.scss +16 -0
  236. package/src/styles/components/_fab-menu.scss +20 -1
  237. package/src/styles/components/_icon-button.scss +6 -0
  238. package/src/styles/components/_list.scss +48 -4
  239. package/src/styles/components/_menu.scss +8 -0
  240. package/src/styles/components/_radios.scss +22 -4
  241. package/src/styles/components/_select.scss +13 -29
  242. package/src/styles/components/_side-sheet.scss +22 -0
  243. package/src/styles/components/_slider.scss +3 -3
  244. package/src/styles/components/_switch.scss +19 -0
  245. package/src/styles/components/_text-field.scss +97 -319
  246. package/src/styles/elements/_button.scss +17 -1
  247. package/src/styles/elements/_checkbox.scss +16 -0
  248. package/src/styles/elements/_list.scss +6 -0
  249. package/src/styles/elements/_radios.scss +3 -2
  250. package/src/styles/elements/_switch.scss +52 -0
  251. package/src/styles/elements/_text-field.scss +21 -0
  252. package/dist/LICENSE +0 -21
  253. package/dist/README.md +0 -438
@@ -20,7 +20,8 @@ $component: '#{base.$prefix}-radios';
20
20
  // them (a 12px margin made the pitch 60px).
21
21
  }
22
22
 
23
- // Horizontal layout
23
+ // Horizontal layout. align-items stays flex-start: options on one line share
24
+ // the start edge, and the next line starts after the tallest row.
24
25
  &--horizontal {
25
26
  flex-direction: row;
26
27
  flex-wrap: wrap;
@@ -92,14 +93,17 @@ $component: '#{base.$prefix}-radios';
92
93
  }
93
94
  }
94
95
 
95
- // Radio label
96
+ // Radio label. The row is at least 48dp and grows with a wrapping label.
97
+ // 4px of vertical padding leaves a 40px content box, so a one-line row stays
98
+ // 48px: the control's top is 4px and the 20px circle's top is 14px. The
99
+ // circle stays centred on the label block (align-items: center).
96
100
  &__label {
97
101
  position: relative;
98
102
  display: inline-flex;
99
103
  align-items: center;
100
104
  cursor: pointer;
101
- padding: 8px 0;
102
- height: 48px;
105
+ padding: 4px 0;
106
+ min-height: 48px;
103
107
  color: t.color('on-surface');
104
108
 
105
109
  // Body Large, as the checkbox and switch labels: a list item's headline.
@@ -112,6 +116,14 @@ $component: '#{base.$prefix}-radios';
112
116
  margin-inline: 0 8px;
113
117
  }
114
118
  }
119
+
120
+ // An empty label leaves the 40px control. The row is the 48dp target and
121
+ // the control is centred in it: the circle inset is 14px and the state
122
+ // layer inset is 4px. Without the width the row would be 40px.
123
+ &:has(> .#{$component}__text:empty) {
124
+ min-width: 48px;
125
+ justify-content: center;
126
+ }
115
127
  }
116
128
 
117
129
  // Radio control: the 40dp state layer area
@@ -192,5 +204,11 @@ $component: '#{base.$prefix}-radios';
192
204
  // margin-left, 0px in right-to-left layouts). FLO-266.
193
205
  &__text {
194
206
  margin-inline-start: 8px;
207
+
208
+ // An empty span would still take the 8px gap and push the control to the
209
+ // inline start. Taking no space lets the unlabelled row centre it.
210
+ &:empty {
211
+ display: none;
212
+ }
195
213
  }
196
214
  }
@@ -8,9 +8,10 @@
8
8
  $component: "#{base.$prefix}-select";
9
9
 
10
10
  .#{$component} {
11
- // Base styles - building on text field base
11
+ // Base styles - building on text field base. No width of its own: unsized,
12
+ // a select is the text field's 280px, as <m-select> is; it took 100% of
13
+ // its container, which the text field never did.
12
14
  position: relative;
13
- width: 100%;
14
15
  cursor: pointer;
15
16
 
16
17
  // Menu when it's a direct child of select (container mode)
@@ -22,6 +23,10 @@ $component: "#{base.$prefix}-select";
22
23
  right: 0;
23
24
  z-index: 1;
24
25
  margin-top: 0;
26
+ // The field's width, as in the top layer (Compose
27
+ // exposedDropdownSize(matchAnchorWidth = true)): the menu's own 280px
28
+ // maximum left it short of a wider field. Its 112px minimum stays.
29
+ max-width: none;
25
30
  }
26
31
 
27
32
  // Transition
@@ -125,33 +130,12 @@ $component: "#{base.$prefix}-select";
125
130
 
126
131
  .#{base.$prefix}-menu__item {
127
132
  min-height: 3rem;
128
-
129
- // Selected state
130
- &--selected {
131
- background-color: t.alpha("primary", 0.12);
132
- color: t.color("primary");
133
- font-weight: 500;
134
-
135
- &::after {
136
- content: "";
137
- display: block;
138
- position: absolute;
139
- right: 12px;
140
- width: 18px;
141
- height: 18px;
142
- // Use mask-image instead of background-image
143
- mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
144
- -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
145
- mask-size: contain;
146
- -webkit-mask-size: contain;
147
- mask-repeat: no-repeat;
148
- -webkit-mask-repeat: no-repeat;
149
- mask-position: center;
150
- -webkit-mask-position: center;
151
- // Use currentColor to match the text color
152
- background-color: currentColor;
153
- }
154
- }
133
+ // The selected option is the menu's own, in every layer:
134
+ // secondary-container and on-secondary-container
135
+ // (md.comp.menu.list-item.selected.container.color and
136
+ // .label-text.color, m3.material.io), with the menu's mark. The
137
+ // rule that was here gave the top layer the primary colour at
138
+ // 12% and a second mark.
155
139
  }
156
140
  }
157
141
 
@@ -88,6 +88,12 @@ $component: "#{base.$prefix}-side-sheet";
88
88
 
89
89
  // 16dp on the icon side, per the specs' start padding with an icon
90
90
  &__close {
91
+ // The button is the layer's and the 48px target's containing block. That
92
+ // cannot come from the state layer's `:where()` rule alone: it adds no
93
+ // specificity, so a page reset like `button { position: static }` would
94
+ // win, and the layer and the target would anchor to the sheet's
95
+ // container instead.
96
+ position: relative;
91
97
  flex: 0 0 auto;
92
98
  display: inline-flex;
93
99
  align-items: center;
@@ -108,6 +114,22 @@ $component: "#{base.$prefix}-side-sheet";
108
114
  outline: 3px solid t.color("secondary");
109
115
  outline-offset: 2px;
110
116
  }
117
+
118
+ // FLO-579: the 40px button carries a 48px target, the icon button's own
119
+ // mechanism (its --xs/--s ::after): the box reaches 4px past each edge.
120
+ // The `position: relative` above is the button's own, so the box anchors
121
+ // to the button whatever the page does to buttons.
122
+ // m3.material.io, Density: "The default target size should be at least
123
+ // 48x48 CSS pixels".
124
+ &::after {
125
+ content: "";
126
+ position: absolute;
127
+ width: 48px;
128
+ height: 48px;
129
+ top: 50%;
130
+ left: 50%;
131
+ transform: translate(-50%, -50%);
132
+ }
111
133
  }
112
134
 
113
135
  &__content {
@@ -54,11 +54,11 @@ $component: '#{base.$prefix}-slider';
54
54
  outline: none;
55
55
  }
56
56
 
57
- // Label styles
57
+ // Label
58
+ // Body Large, as the checkbox, radio and switch labels (FLO-587).
58
59
  &__label {
59
60
  display: block;
60
- font-size: 18px;
61
- font-weight: 400;
61
+ @include m.typography('body-large');
62
62
  color: t.color('on-surface');
63
63
  margin-bottom: 4px;
64
64
  // labelPosition: 'end' puts it below the track.
@@ -29,6 +29,25 @@ $component: '#{base.$prefix}-switch';
29
29
  column-gap: 12px;
30
30
  }
31
31
 
32
+ // A switch with neither a label nor supporting text is its own target: no
33
+ // gap (the 12px belongs between text and the track, and there is none), so
34
+ // the root is the 52px track's width and 48px tall with the 32px track
35
+ // centred. M3 "Switch" -> Specs -> Measurements: Track 32x52dp and "Target:
36
+ // Size 48dp", with no height for a label row; its Accessibility section:
37
+ // "Don't apply density to switches by default — this lowers their targets
38
+ // below our best practice of 48x48 CSS pixels." So this row is 48 tall —
39
+ // the root's 4px above and below leave the container 40 — while a switch
40
+ // with a label, and one whose only text is its supporting text (`__helper`,
41
+ // which stands where the label would), keeps the 56px row and the gap.
42
+ // `:where` keeps this rule's weight level with `--dense`, which follows and
43
+ // so still wins: a switch that opts into the denser row keeps it.
44
+ &:where(:not(:has(.#{$component}__label, .#{$component}__helper))) {
45
+ .#{$component}__container {
46
+ column-gap: 0;
47
+ min-height: 40px;
48
+ }
49
+ }
50
+
32
51
  // Content wrapper. The gap is on the container, so it stays between the label
33
52
  // and the track whichever side the label is on, in either direction.
34
53
  &__content {