material 3.0.0-next.1 → 3.0.1

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 (151) hide show
  1. package/README.md +9 -7
  2. package/dist/components/index.d.ts +1 -1
  3. package/dist/components/list/config.js +6 -1
  4. package/dist/components/list/constants.d.ts +10 -0
  5. package/dist/components/list/constants.js +4 -0
  6. package/dist/components/list/index.d.ts +2 -2
  7. package/dist/components/list/index.js +1 -1
  8. package/dist/components/list/list.d.ts +14 -10
  9. package/dist/components/list/list.js +2 -2
  10. package/dist/components/list/types.d.ts +15 -0
  11. package/dist/components/menu/features/position.js +6 -0
  12. package/dist/elements/css/fab-menu.css +1 -1
  13. package/dist/elements/css/fab-menu.js +1 -1
  14. package/dist/elements/css/list.css +1 -1
  15. package/dist/elements/css/list.js +1 -1
  16. package/dist/elements/css/menu.css +1 -1
  17. package/dist/elements/css/menu.js +1 -1
  18. package/dist/elements/css/text-field.css +1 -1
  19. package/dist/elements/css/text-field.js +1 -1
  20. package/dist/elements/list.d.ts +6 -0
  21. package/dist/elements/list.js +1 -0
  22. package/dist/elements/preupgrade/badge.css +1 -1
  23. package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
  24. package/dist/elements/preupgrade/bottom-sheet.css +1 -1
  25. package/dist/elements/preupgrade/button-group.css +2 -2
  26. package/dist/elements/preupgrade/button.css +1 -1
  27. package/dist/elements/preupgrade/card.css +1 -1
  28. package/dist/elements/preupgrade/carousel.css +1 -1
  29. package/dist/elements/preupgrade/checkbox.css +1 -1
  30. package/dist/elements/preupgrade/chips.css +1 -1
  31. package/dist/elements/preupgrade/datepicker.css +1 -1
  32. package/dist/elements/preupgrade/dialog.css +1 -1
  33. package/dist/elements/preupgrade/divider.css +1 -1
  34. package/dist/elements/preupgrade/drawer.css +1 -1
  35. package/dist/elements/preupgrade/extended-fab.css +1 -1
  36. package/dist/elements/preupgrade/fab-menu.css +1 -1
  37. package/dist/elements/preupgrade/fab.css +1 -1
  38. package/dist/elements/preupgrade/icon-button.css +1 -1
  39. package/dist/elements/preupgrade/list.css +1 -1
  40. package/dist/elements/preupgrade/loading-indicator.css +1 -1
  41. package/dist/elements/preupgrade/menu.css +1 -1
  42. package/dist/elements/preupgrade/navigation-bar.css +1 -1
  43. package/dist/elements/preupgrade/navigation-rail.css +1 -1
  44. package/dist/elements/preupgrade/progress.css +1 -1
  45. package/dist/elements/preupgrade/radios.css +1 -1
  46. package/dist/elements/preupgrade/search.css +1 -1
  47. package/dist/elements/preupgrade/select.css +1 -1
  48. package/dist/elements/preupgrade/side-sheet.css +1 -1
  49. package/dist/elements/preupgrade/slider.css +2 -2
  50. package/dist/elements/preupgrade/snackbar.css +1 -1
  51. package/dist/elements/preupgrade/split-button.css +1 -1
  52. package/dist/elements/preupgrade/switch.css +1 -1
  53. package/dist/elements/preupgrade/tabs.css +1 -1
  54. package/dist/elements/preupgrade/text-field.css +2 -2
  55. package/dist/elements/preupgrade/timepicker.css +1 -1
  56. package/dist/elements/preupgrade/toolbar.css +1 -1
  57. package/dist/elements/preupgrade/tooltip.css +1 -1
  58. package/dist/elements/preupgrade/top-app-bar.css +1 -1
  59. package/dist/elements/preupgrade.css +2 -2
  60. package/dist/elements/preupgrade.js +1 -1
  61. package/dist/package.json +1 -1
  62. package/dist/styles/badge.css +1 -1
  63. package/dist/styles/base.css +1 -1
  64. package/dist/styles/bottom-app-bar.css +1 -1
  65. package/dist/styles/bottom-sheet.css +1 -1
  66. package/dist/styles/button-group.css +1 -1
  67. package/dist/styles/button.css +1 -1
  68. package/dist/styles/card.css +1 -1
  69. package/dist/styles/carousel.css +1 -1
  70. package/dist/styles/checkbox.css +1 -1
  71. package/dist/styles/chips.css +1 -1
  72. package/dist/styles/contrast.css +1 -1
  73. package/dist/styles/datepicker.css +1 -1
  74. package/dist/styles/dialog.css +1 -1
  75. package/dist/styles/divider.css +1 -1
  76. package/dist/styles/drawer.css +1 -1
  77. package/dist/styles/extended-fab.css +1 -1
  78. package/dist/styles/fab-menu.css +2 -2
  79. package/dist/styles/fab.css +1 -1
  80. package/dist/styles/icon-button.css +1 -1
  81. package/dist/styles/list.css +2 -2
  82. package/dist/styles/loading-indicator.css +1 -1
  83. package/dist/styles/menu.css +2 -2
  84. package/dist/styles/navigation-bar.css +1 -1
  85. package/dist/styles/navigation-rail.css +1 -1
  86. package/dist/styles/progress.css +1 -1
  87. package/dist/styles/radios.css +1 -1
  88. package/dist/styles/search.css +1 -1
  89. package/dist/styles/select.css +1 -1
  90. package/dist/styles/side-sheet.css +1 -1
  91. package/dist/styles/slider.css +1 -1
  92. package/dist/styles/snackbar.css +1 -1
  93. package/dist/styles/split-button.css +1 -1
  94. package/dist/styles/switch.css +1 -1
  95. package/dist/styles/tabs.css +1 -1
  96. package/dist/styles/text-field.css +2 -2
  97. package/dist/styles/timepicker.css +1 -1
  98. package/dist/styles/toolbar.css +1 -1
  99. package/dist/styles/tooltip.css +1 -1
  100. package/dist/styles/top-app-bar.css +1 -1
  101. package/dist/styles/typography.css +1 -1
  102. package/dist/styles/utilities.css +1 -1
  103. package/dist/styles.css +2 -2
  104. package/dist/themes/autumn-contrast.css +1 -1
  105. package/dist/themes/autumn.css +1 -1
  106. package/dist/themes/baseline-contrast.css +1 -1
  107. package/dist/themes/baseline.css +1 -1
  108. package/dist/themes/brownbeige-contrast.css +1 -1
  109. package/dist/themes/brownbeige.css +1 -1
  110. package/dist/themes/content-contrast.css +1 -1
  111. package/dist/themes/content.css +1 -1
  112. package/dist/themes/desert-contrast.css +1 -1
  113. package/dist/themes/desert.css +1 -1
  114. package/dist/themes/expressive-contrast.css +1 -1
  115. package/dist/themes/expressive.css +1 -1
  116. package/dist/themes/fidelity-contrast.css +1 -1
  117. package/dist/themes/fidelity.css +1 -1
  118. package/dist/themes/forest-contrast.css +1 -1
  119. package/dist/themes/forest.css +1 -1
  120. package/dist/themes/fruit-salad-contrast.css +1 -1
  121. package/dist/themes/fruit-salad.css +1 -1
  122. package/dist/themes/highcontrast-contrast.css +1 -1
  123. package/dist/themes/highcontrast.css +1 -1
  124. package/dist/themes/monochrome-contrast.css +1 -1
  125. package/dist/themes/monochrome.css +1 -1
  126. package/dist/themes/neutral-contrast.css +1 -1
  127. package/dist/themes/neutral.css +1 -1
  128. package/dist/themes/ocean-contrast.css +1 -1
  129. package/dist/themes/ocean.css +1 -1
  130. package/dist/themes/rainbow-contrast.css +1 -1
  131. package/dist/themes/rainbow.css +1 -1
  132. package/dist/themes/sageivory-contrast.css +1 -1
  133. package/dist/themes/sageivory.css +1 -1
  134. package/dist/themes/spring-contrast.css +1 -1
  135. package/dist/themes/spring.css +1 -1
  136. package/dist/themes/summer-contrast.css +1 -1
  137. package/dist/themes/summer.css +1 -1
  138. package/dist/themes/sunset-contrast.css +1 -1
  139. package/dist/themes/sunset.css +1 -1
  140. package/dist/themes/tealcaramel-contrast.css +1 -1
  141. package/dist/themes/tealcaramel.css +1 -1
  142. package/dist/themes/vibrant-contrast.css +1 -1
  143. package/dist/themes/vibrant.css +1 -1
  144. package/package.json +1 -1
  145. package/src/styles/components/_fab-menu.scss +20 -1
  146. package/src/styles/components/_list.scss +45 -42
  147. package/src/styles/components/_menu.scss +32 -15
  148. package/src/styles/components/_text-field.scss +31 -0
  149. package/src/styles/elements/_button-group.scss +15 -0
  150. package/src/styles/elements/_slider.scss +39 -1
  151. package/src/styles/elements/_text-field.scss +140 -43
@@ -1,83 +1,180 @@
1
- // src/styles/elements/_text-field.scss
2
- // <m-text-field> before upgrade: the field's container, the label at rest and
3
- // the value on the input's line.
1
+ // <m-text-field> keeps the consumer's line box around its inline field,
2
+ // just as the upgraded host does. The surrogate carries the field's own
3
+ // typography, box and baseline; a tall inherited strut can enlarge the host.
4
4
  @use 'config' as c;
5
5
  @use 'field';
6
6
  @use '../abstract/variables' as v;
7
+ @use '../abstract/mixins' as m;
8
+ @use '../abstract/theme' as t;
7
9
 
8
10
  @include c.host('text-field') {
9
- @include field.field;
11
+ display: inline-block;
12
+ position: relative;
13
+ width: v.text-field('width');
10
14
 
11
- // A password or hidden field paints no value (#53): the value attribute can
12
- // hold a password or a token in clear text, and the shared rule above paints
13
- // it for every type. The space is the empty field's line box, so a password's
14
- // box does not move at upgrade; no mask either — its length is information
15
- // too. `i`: HTML reads an input's type case-insensitively, so
16
- // `type="PASSWORD"` upgrades to a masked input and must not paint here.
17
- &[type='password' i]::before,
18
- &[type='hidden' i]::before {
19
- content: ' ';
15
+ // The value (or a space holding its baseline) paints the inner field.
16
+ // Its half-pixel inset matches the input's baseline. The outer host must
17
+ // retain the page's typography, including the space below that baseline.
18
+ &::before {
19
+ content: attr(value) ' ';
20
+ display: inline-block;
21
+ box-sizing: border-box;
22
+ width: 100%;
23
+ height: v.text-field('height');
24
+ padding: 24.5px v.text-field('padding-horizontal') 0;
25
+ border-radius: v.text-field('border-radius') v.text-field('border-radius') 0 0;
26
+ border-bottom: v.text-field('border-width') solid t.color('on-surface-variant');
27
+ background-color: t.color('surface-container-highest');
28
+ color: t.color('on-surface');
29
+ white-space: pre;
30
+ // Clip the value without replacing its baseline with the bottom edge.
31
+ overflow: clip;
32
+ @include m.typography('body-large');
20
33
  }
21
34
 
22
- // A hidden field takes no space, before upgrade or after: the upgraded host
23
- // is not rendered at all — a host rule for `type="hidden"` in the element's
24
- // host styles, as for `[hidden]` — so reserving a box here would move the
25
- // page twice, at paint and at upgrade. `display: none` is that, and with it
26
- // the field's chrome never renders either; the value still submits with the
27
- // form, the element being form-associated.
28
- &[type='hidden' i] {
29
- display: none;
35
+ &:not([label])::before {
36
+ padding-top: 16.5px;
37
+ }
38
+
39
+ &[variant='outlined']::before {
40
+ padding-top: 15.5px;
41
+ border: v.text-field('border-width') solid t.color('outline');
42
+ border-radius: v.text-field('border-radius');
43
+ background: none;
44
+ }
45
+
46
+ &[density='compact'] {
47
+ &::before {
48
+ height: 40px;
49
+ padding-top: 13.5px;
50
+ @include m.typography('body-medium');
51
+ }
52
+
53
+ &:not([label])::before { padding-top: 10px; }
54
+ &[variant='outlined']::before { padding-top: 9px; }
55
+ }
56
+
57
+ // Reserve the helper/counter row under the field, keeping the fill and
58
+ // indicator inside the field's own box.
59
+ &[supporting-text]:not([supporting-text='']),
60
+ &[maxlength] {
61
+ &::before {
62
+ height: calc(#{v.text-field('height')} + #{field.$supporting-row});
63
+ border-bottom: field.$supporting-row solid transparent;
64
+ background-clip: padding-box;
65
+ background-image: linear-gradient(to top, #{t.color('on-surface-variant')} v.text-field('border-width'), transparent v.text-field('border-width'));
66
+ }
67
+
68
+ &[variant='outlined']::before {
69
+ padding-top: calc(15.5px + #{v.text-field('border-width')});
70
+ padding-left: calc(#{v.text-field('padding-horizontal')} + #{v.text-field('border-width')});
71
+ border-width: 0 0 field.$supporting-row;
72
+ border-radius: v.text-field('border-radius') / v.text-field('border-radius') v.text-field('border-radius') calc(#{v.text-field('border-radius')} + #{field.$supporting-row}) calc(#{v.text-field('border-radius')} + #{field.$supporting-row});
73
+ background-image: none;
74
+ box-shadow: inset 0 0 0 v.text-field('border-width') t.color('outline');
75
+ }
76
+
77
+ &[density='compact']::before {
78
+ height: calc(40px + #{field.$supporting-row});
79
+ }
80
+ }
81
+
82
+ &[label]::after {
83
+ content: attr(label);
84
+ white-space: nowrap;
85
+ position: absolute;
86
+ top: v.text-field('padding-vertical');
87
+ left: v.text-field('padding-horizontal');
88
+ color: t.color('on-surface-variant');
89
+ @include m.typography('body-large');
30
90
  }
31
91
 
32
- // Multiline is the textarea's box, not the single-line 56px one (FLO-425).
33
- // Height and padding-top are the component's (&--multiline). The padding-top
34
- // is where the first line starts: the inline sibling on this line aligns to
35
- // it. It is the single-line field's text (FLO-299): 16px, 24px under a
36
- // filled field's label, and outlined the same 16px less its own border.
92
+ &[label][value]:not([value=''])::after {
93
+ top: 8px;
94
+ @include m.typography('body-small');
95
+ }
96
+
97
+ &[variant='outlined'][label][value]:not([value=''])::after {
98
+ top: -8px;
99
+ padding: 0 4px;
100
+ left: 12px;
101
+ }
102
+
103
+ &[density='compact']::after {
104
+ top: 10px;
105
+ @include m.typography('body-medium');
106
+ }
107
+
108
+ // Multiline reserves the textarea's box and first line. Compact multiline
109
+ // keeps the compact single-line height, as the upgraded input does.
37
110
  &[type='multiline'] {
38
- height: v.text-field('height-multiline');
39
- padding-top: v.text-field('padding-top-multiline');
111
+ &::before {
112
+ height: v.text-field('height-multiline');
113
+ padding-top: v.text-field('padding-top-multiline');
114
+ }
40
115
 
41
- &[label] {
116
+ &[label]::before {
42
117
  padding-top: v.text-field('padding-top-multiline-label');
43
118
  }
44
119
 
45
- &[variant='outlined'] {
120
+ &[variant='outlined']::before {
46
121
  padding-top: calc(#{v.text-field('padding-top-multiline')} - #{v.text-field('border-width')});
47
122
  }
48
123
 
49
- // Compact multiline stays the compact field (40px), with the compact
50
- // single-line field's first line.
51
124
  &[density='compact'] {
52
- height: 40px;
53
- padding-top: v.text-field('padding-top-multiline-compact');
125
+ &::before {
126
+ height: 40px;
127
+ padding-top: v.text-field('padding-top-multiline-compact');
128
+ }
54
129
 
55
- &[label] {
130
+ &[label]::before {
56
131
  padding-top: v.text-field('padding-top-multiline-compact-label');
57
132
  }
58
133
 
59
- &[variant='outlined'] {
134
+ &[variant='outlined']::before {
60
135
  padding-top: calc(#{v.text-field('padding-top-multiline-compact')} - #{v.text-field('border-width')});
61
136
  }
62
137
  }
63
138
 
64
- // The supporting row is the single-line field's. Outlined drops its top
65
- // border for an inset ring, so the whole inset is padding there.
66
139
  &[supporting-text]:not([supporting-text='']),
67
140
  &[maxlength] {
68
- height: calc(#{v.text-field('height-multiline')} + #{field.$supporting-row});
141
+ &::before {
142
+ height: calc(#{v.text-field('height-multiline')} + #{field.$supporting-row});
143
+ }
69
144
 
70
- &[variant='outlined'] {
145
+ &[variant='outlined']::before {
71
146
  padding-top: v.text-field('padding-top-multiline');
72
147
  }
73
148
 
74
149
  &[density='compact'] {
75
- height: calc(40px + #{field.$supporting-row});
76
-
77
- &[variant='outlined'] {
150
+ &::before { height: calc(40px + #{field.$supporting-row}); }
151
+ &[variant='outlined']::before {
78
152
  padding-top: v.text-field('padding-top-multiline-compact');
79
153
  }
80
154
  }
81
155
  }
82
156
  }
157
+
158
+ // A password or hidden field paints no value (#53): the value attribute can
159
+ // hold a password or a token in clear text, and the shared rule above paints
160
+ // it for every type. The space is the empty field's line box, so a password's
161
+ // box does not move at upgrade; no mask either — its length is information
162
+ // too. `i`: HTML reads an input's type case-insensitively, so
163
+ // `type="PASSWORD"` upgrades to a masked input and must not paint here.
164
+ &[type='password' i]::before,
165
+ &[type='hidden' i]::before {
166
+ content: ' ';
167
+ }
168
+
169
+ // A hidden field takes no space, before upgrade or after: the upgraded host
170
+ // is not rendered at all — a host rule for `type="hidden"` in the element's
171
+ // host styles, as for `[hidden]` — so reserving a box here would move the
172
+ // page twice, at paint and at upgrade. `display: none` is that, and with it
173
+ // the field's chrome never renders either; the value still submits with the
174
+ // form, the element being form-associated.
175
+ &[type='hidden' i] {
176
+ display: none;
177
+ }
178
+
179
+ > * { display: none; }
83
180
  }