mtrl 0.2.6 → 0.2.8

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 (226) hide show
  1. package/demo/build.ts +349 -0
  2. package/demo/index.html +110 -0
  3. package/demo/main.js +448 -0
  4. package/demo/styles.css +239 -0
  5. package/index.ts +18 -0
  6. package/package.json +14 -3
  7. package/server.ts +86 -0
  8. package/src/components/badge/api.ts +70 -63
  9. package/src/components/badge/badge.ts +16 -2
  10. package/src/components/badge/config.ts +66 -13
  11. package/src/components/badge/features.ts +51 -42
  12. package/src/components/badge/index.ts +27 -2
  13. package/src/components/badge/types.ts +62 -30
  14. package/src/components/bottom-app-bar/bottom-app-bar.ts +154 -0
  15. package/src/components/bottom-app-bar/config.ts +29 -0
  16. package/src/components/bottom-app-bar/index.ts +17 -0
  17. package/src/components/bottom-app-bar/types.ts +114 -0
  18. package/src/components/button/api.ts +5 -0
  19. package/src/components/button/button.ts +0 -1
  20. package/src/components/button/config.ts +6 -2
  21. package/src/components/button/index.ts +10 -2
  22. package/src/components/button/types.ts +20 -2
  23. package/src/components/card/card.ts +13 -25
  24. package/src/components/card/config.ts +83 -30
  25. package/src/components/card/content.ts +8 -10
  26. package/src/components/card/features.ts +4 -3
  27. package/src/components/card/index.ts +29 -2
  28. package/src/components/card/types.ts +33 -22
  29. package/src/components/checkbox/config.ts +3 -4
  30. package/src/components/checkbox/index.ts +1 -2
  31. package/src/components/checkbox/types.ts +12 -3
  32. package/src/components/chip/api.ts +170 -221
  33. package/src/components/chip/chip.ts +34 -302
  34. package/src/components/chip/config.ts +1 -2
  35. package/src/components/chip/index.ts +10 -2
  36. package/src/components/chip/types.ts +224 -35
  37. package/src/components/datepicker/api.ts +265 -0
  38. package/src/components/datepicker/config.ts +141 -0
  39. package/src/components/datepicker/datepicker.ts +341 -0
  40. package/src/components/datepicker/index.ts +12 -0
  41. package/src/components/datepicker/render.ts +450 -0
  42. package/src/components/datepicker/types.ts +397 -0
  43. package/src/components/datepicker/utils.ts +289 -0
  44. package/src/components/dialog/api.ts +55 -21
  45. package/src/components/dialog/config.ts +12 -9
  46. package/src/components/dialog/dialog.ts +6 -3
  47. package/src/components/dialog/features.ts +345 -151
  48. package/src/components/dialog/index.ts +38 -8
  49. package/src/components/dialog/types.ts +40 -14
  50. package/src/components/divider/config.ts +81 -0
  51. package/src/components/divider/divider.ts +37 -0
  52. package/src/components/divider/features.ts +207 -0
  53. package/src/components/divider/index.ts +9 -0
  54. package/src/components/divider/types.ts +55 -0
  55. package/src/components/extended-fab/api.ts +141 -0
  56. package/src/components/extended-fab/config.ts +112 -0
  57. package/src/components/extended-fab/extended-fab.ts +125 -0
  58. package/src/components/extended-fab/index.ts +9 -0
  59. package/src/components/extended-fab/types.ts +304 -0
  60. package/src/components/fab/api.ts +97 -0
  61. package/src/components/fab/config.ts +93 -0
  62. package/src/components/fab/fab.ts +67 -0
  63. package/src/components/fab/index.ts +9 -0
  64. package/src/components/fab/types.ts +251 -0
  65. package/src/components/list/config.ts +4 -5
  66. package/src/components/list/features.ts +6 -7
  67. package/src/components/list/index.ts +7 -9
  68. package/src/components/list/list-item.ts +12 -13
  69. package/src/components/list/types.ts +50 -5
  70. package/src/components/list/utils.ts +30 -3
  71. package/src/components/menu/features/items-manager.ts +9 -9
  72. package/src/components/menu/features/positioning.ts +7 -7
  73. package/src/components/menu/features/visibility.ts +7 -7
  74. package/src/components/menu/index.ts +7 -9
  75. package/src/components/menu/menu-item.ts +6 -6
  76. package/src/components/menu/menu.ts +22 -0
  77. package/src/components/menu/types.ts +29 -10
  78. package/src/components/menu/utils.ts +67 -0
  79. package/src/components/navigation/api.ts +78 -50
  80. package/src/components/navigation/config.ts +22 -10
  81. package/src/components/navigation/features/items.ts +284 -0
  82. package/src/components/navigation/index.ts +0 -6
  83. package/src/components/navigation/nav-item.ts +70 -33
  84. package/src/components/navigation/navigation.ts +53 -3
  85. package/src/components/navigation/types.ts +117 -70
  86. package/src/components/progress/api.ts +2 -3
  87. package/src/components/progress/config.ts +2 -3
  88. package/src/components/progress/index.ts +0 -1
  89. package/src/components/progress/progress.ts +1 -2
  90. package/src/components/progress/types.ts +186 -33
  91. package/src/components/radios/config.ts +1 -1
  92. package/src/components/radios/index.ts +0 -1
  93. package/src/components/radios/types.ts +0 -7
  94. package/src/components/search/api.ts +203 -0
  95. package/src/components/search/config.ts +86 -0
  96. package/src/components/search/features/index.ts +4 -0
  97. package/src/components/search/features/search.ts +717 -0
  98. package/src/components/search/features/states.ts +169 -0
  99. package/src/components/search/features/structure.ts +197 -0
  100. package/src/components/search/index.ts +7 -0
  101. package/src/components/search/search.ts +52 -0
  102. package/src/components/search/types.ts +175 -0
  103. package/src/components/segmented-button/config.ts +80 -0
  104. package/src/components/segmented-button/index.ts +4 -0
  105. package/src/components/segmented-button/segment.ts +154 -0
  106. package/src/components/segmented-button/segmented-button.ts +249 -0
  107. package/src/components/segmented-button/types.ts +254 -0
  108. package/src/components/slider/accessibility.md +5 -5
  109. package/src/components/slider/api.ts +41 -120
  110. package/src/components/slider/config.ts +51 -47
  111. package/src/components/slider/features/handlers.ts +495 -0
  112. package/src/components/slider/features/index.ts +1 -2
  113. package/src/components/slider/features/slider.ts +66 -84
  114. package/src/components/slider/features/states.ts +195 -0
  115. package/src/components/slider/features/structure.ts +136 -206
  116. package/src/components/slider/features/ui.ts +145 -206
  117. package/src/components/slider/index.ts +2 -11
  118. package/src/components/slider/slider.ts +9 -12
  119. package/src/components/slider/types.ts +67 -26
  120. package/src/components/snackbar/config.ts +2 -3
  121. package/src/components/snackbar/constants.ts +0 -32
  122. package/src/components/snackbar/index.ts +0 -1
  123. package/src/components/snackbar/position.ts +9 -1
  124. package/src/components/snackbar/types.ts +122 -46
  125. package/src/components/switch/config.ts +2 -3
  126. package/src/components/switch/index.ts +0 -1
  127. package/src/components/switch/types.ts +3 -2
  128. package/src/components/tabs/config.ts +3 -4
  129. package/src/components/tabs/features.ts +4 -2
  130. package/src/components/tabs/index.ts +0 -15
  131. package/src/components/tabs/indicator.ts +73 -13
  132. package/src/components/tabs/tab-api.ts +12 -4
  133. package/src/components/tabs/tab.ts +18 -6
  134. package/src/components/tabs/types.ts +23 -5
  135. package/src/components/textfield/config.ts +2 -3
  136. package/src/components/textfield/index.ts +0 -1
  137. package/src/components/textfield/types.ts +17 -3
  138. package/src/components/timepicker/README.md +277 -0
  139. package/src/components/timepicker/api.ts +632 -0
  140. package/src/components/timepicker/clockdial.ts +482 -0
  141. package/src/components/timepicker/config.ts +228 -0
  142. package/src/components/timepicker/index.ts +3 -0
  143. package/src/components/timepicker/render.ts +613 -0
  144. package/src/components/timepicker/timepicker.ts +117 -0
  145. package/src/components/timepicker/types.ts +336 -0
  146. package/src/components/timepicker/utils.ts +241 -0
  147. package/src/components/tooltip/api.ts +1 -1
  148. package/src/components/tooltip/config.ts +27 -6
  149. package/src/components/tooltip/index.ts +0 -1
  150. package/src/components/tooltip/types.ts +13 -3
  151. package/src/components/top-app-bar/config.ts +83 -0
  152. package/src/components/top-app-bar/index.ts +11 -0
  153. package/src/components/top-app-bar/top-app-bar.ts +316 -0
  154. package/src/components/top-app-bar/types.ts +140 -0
  155. package/src/core/build/_ripple.scss +6 -6
  156. package/src/core/build/ripple.ts +72 -95
  157. package/src/core/compose/features/icon.ts +3 -1
  158. package/src/core/compose/features/ripple.ts +4 -1
  159. package/src/core/compose/features/textlabel.ts +23 -2
  160. package/src/core/dom/create.ts +5 -0
  161. package/src/index.ts +9 -0
  162. package/src/styles/abstract/_theme.scss +9 -1
  163. package/src/styles/components/_badge.scss +182 -0
  164. package/src/styles/components/_bottom-app-bar.scss +103 -0
  165. package/src/{components/button/_styles.scss → styles/components/_button.scss} +0 -10
  166. package/src/{components/checkbox/_styles.scss → styles/components/_checkbox.scss} +0 -2
  167. package/src/styles/components/_datepicker.scss +358 -0
  168. package/src/styles/components/_dialog.scss +259 -0
  169. package/src/styles/components/_divider.scss +57 -0
  170. package/src/styles/components/_extended-fab.scss +267 -0
  171. package/src/styles/components/_fab.scss +225 -0
  172. package/src/{components/navigation/_styles.scss → styles/components/_navigation.scss} +1 -0
  173. package/src/styles/components/_search.scss +306 -0
  174. package/src/styles/components/_segmented-button.scss +117 -0
  175. package/src/{components/slider/_styles.scss → styles/components/_slider.scss} +83 -24
  176. package/src/{components/switch/_styles.scss → styles/components/_switch.scss} +0 -2
  177. package/src/{components/tabs/_styles.scss → styles/components/_tabs.scss} +95 -33
  178. package/src/{components/textfield/_styles.scss → styles/components/_textfield.scss} +70 -67
  179. package/src/styles/components/_timepicker.scss +451 -0
  180. package/src/styles/components/_top-app-bar.scss +225 -0
  181. package/src/styles/main.scss +98 -49
  182. package/src/styles/themes/_autumn.scss +21 -0
  183. package/src/styles/themes/_base-theme.scss +61 -0
  184. package/src/styles/themes/_baseline.scss +58 -0
  185. package/src/styles/themes/_bluekhaki.scss +125 -0
  186. package/src/styles/themes/_brownbeige.scss +125 -0
  187. package/src/styles/themes/_browngreen.scss +125 -0
  188. package/src/styles/themes/_forest.scss +6 -0
  189. package/src/styles/themes/_greenbeige.scss +125 -0
  190. package/src/styles/themes/_material.scss +125 -0
  191. package/src/styles/themes/_ocean.scss +6 -0
  192. package/src/styles/themes/_sageivory.scss +125 -0
  193. package/src/styles/themes/_spring.scss +6 -0
  194. package/src/styles/themes/_summer.scss +5 -0
  195. package/src/styles/themes/_sunset.scss +5 -0
  196. package/src/styles/themes/_tealcaramel.scss +125 -0
  197. package/src/styles/themes/_winter.scss +6 -0
  198. package/src/components/badge/_styles.scss +0 -174
  199. package/src/components/badge/constants.ts +0 -30
  200. package/src/components/button/constants.ts +0 -11
  201. package/src/components/card/constants.ts +0 -84
  202. package/src/components/dialog/_styles.scss +0 -213
  203. package/src/components/dialog/constants.ts +0 -32
  204. package/src/components/menu/constants.ts +0 -154
  205. package/src/components/navigation/constants.ts +0 -200
  206. package/src/components/navigation/features/items.js +0 -192
  207. package/src/components/progress/constants.ts +0 -29
  208. package/src/components/slider/features/appearance.ts +0 -94
  209. package/src/components/slider/features/disabled.ts +0 -68
  210. package/src/components/slider/features/events.ts +0 -164
  211. package/src/components/slider/features/interactions.ts +0 -396
  212. package/src/components/slider/features/keyboard.ts +0 -233
  213. package/src/components/switch/constants.ts +0 -80
  214. package/src/components/tabs/constants.ts +0 -89
  215. package/src/core/collection/adapters/mongodb.js +0 -232
  216. /package/src/{components/card/_styles.scss → styles/components/_card.scss} +0 -0
  217. /package/src/{components/carousel/_styles.scss → styles/components/_carousel.scss} +0 -0
  218. /package/src/{components/chip/_styles.scss → styles/components/_chip.scss} +0 -0
  219. /package/src/{components/list/_styles.scss → styles/components/_list.scss} +0 -0
  220. /package/src/{components/menu/_styles.scss → styles/components/_menu.scss} +0 -0
  221. /package/src/{components/progress/_styles.scss → styles/components/_progress.scss} +0 -0
  222. /package/src/{components/radios/_styles.scss → styles/components/_radios.scss} +0 -0
  223. /package/src/{components/sheet/_styles.scss → styles/components/_sheet.scss} +0 -0
  224. /package/src/{components/snackbar/_styles.scss → styles/components/_snackbar.scss} +0 -0
  225. /package/src/{components/tooltip/_styles.scss → styles/components/_tooltip.scss} +0 -0
  226. /package/src/styles/utilities/{_color.scss → _colors.scss} +0 -0
@@ -25,11 +25,18 @@ $container: '#{base.$prefix}-tabs';
25
25
  &:has(.#{$component}--icon-and-text) {
26
26
  min-height: 64px;
27
27
  }
28
+
29
+ // Primary indicator specific styling
30
+ .#{$container}-indicator {
31
+ height: 4px;
32
+ border-radius: 3px 3px 0 0;
33
+ background-color: t.color('primary');
34
+ }
28
35
  }
29
36
 
30
37
  &--secondary {
31
38
  min-height: 48px;
32
- // Tab indicator styling
39
+ // Tab indicator styling for secondary variant
33
40
  .#{$container}-indicator {
34
41
  height: 2px;
35
42
  border-radius: 0;
@@ -63,13 +70,10 @@ $container: '#{base.$prefix}-tabs';
63
70
  background-color: t.color('outline-variant'); // MD3: Outline variant color
64
71
  }
65
72
 
66
- // Tab indicator styling
73
+ // Tab indicator styling - base styles
67
74
  &-indicator {
68
75
  position: absolute;
69
76
  bottom: 1px;
70
- height: 4px;
71
- background-color: t.color('primary');
72
- border-radius: 3px 3px 0 0;
73
77
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1),
74
78
  width 250ms cubic-bezier(0.4, 0, 0.2, 1);
75
79
  z-index: 1; // Ensure indicator appears above divider
@@ -86,7 +90,7 @@ $container: '#{base.$prefix}-tabs';
86
90
  max-width: 360px;
87
91
  padding: 0 16px;
88
92
  border: none;
89
- border-radius: 5px;
93
+ border-radius: 5px 5px 0 0;
90
94
  background-color: transparent;
91
95
  color: t.color('on-surface-variant');
92
96
  cursor: pointer;
@@ -122,12 +126,12 @@ $container: '#{base.$prefix}-tabs';
122
126
 
123
127
  &:focus-visible {
124
128
  outline: 2px solid t.color('primary');
125
- outline-offset: 0;
129
+ outline-offset: -2px;
126
130
  z-index: 1;
127
131
  }
128
132
 
129
133
  // Disabled state
130
- &:disabled, &[disabled], &--disabled {
134
+ &--disabled, &:disabled {
131
135
  pointer-events: none;
132
136
  opacity: 0.38;
133
137
  }
@@ -189,44 +193,102 @@ $container: '#{base.$prefix}-tabs';
189
193
  }
190
194
  }
191
195
 
192
- // Active Tab - Apply to both primary and secondary
193
- &--active {
194
- color: t.color('primary'); // MD3: Primary color
195
-
196
- .#{$component}-icon {
197
- color: t.color('primary'); // MD3: Primary color
198
- }
199
-
200
- // Hover state for active tabs
201
- &:hover:not(:disabled):not([disabled]) {
202
- background-color: t.alpha('primary', 0.08);
196
+ // ACTIVE TAB STATES - PRIMARY VARIANT
197
+ .#{$container}--primary & {
198
+ // Active Tab Base State - Apply to primary variant
199
+ &--active {
200
+ color: t.color('primary');
201
+
202
+ .#{$component}-icon {
203
+ color: t.color('primary');
204
+ }
205
+
206
+ // Hover state for active tabs
207
+ &:hover, &.#{$component}--hover {
208
+ background-color: t.alpha('primary', 0.08);
209
+ }
210
+
211
+ // Focused state for active tabs
212
+ &:focus-visible, &.#{$component}--focus {
213
+ background-color: t.alpha('primary', 0.1);
214
+ outline-color: t.color('primary');
215
+ }
216
+
217
+ // Pressed state for active tabs
218
+ &:active, &.#{$component}--pressed {
219
+ background-color: t.alpha('primary', 0.12);
220
+ }
203
221
  }
204
222
 
205
- // Pressed state for active tabs
206
- &:active:not(:disabled):not([disabled]) {
207
- background-color: t.alpha('primary', 0.12);
223
+ // Inactive Tabs - Primary variant
224
+ &:not(.#{$component}--active):not(.#{$component}--disabled):not(:disabled) {
225
+ color: t.color('on-surface-variant');
226
+
227
+ // Hover state for inactive tabs
228
+ &:hover, &.#{$component}--hover {
229
+ background-color: t.alpha('on-surface-variant', 0.08);
230
+ }
231
+
232
+ // Focused state for inactive tabs
233
+ &:focus-visible, &.#{$component}--focus {
234
+ background-color: t.alpha('on-surface-variant', 0.1);
235
+ outline-color: t.color('on-surface-variant');
236
+ }
237
+
238
+ // Pressed state for inactive tabs
239
+ &:active, &.#{$component}--pressed {
240
+ background-color: t.alpha('on-surface-variant', 0.12);
241
+ }
208
242
  }
209
243
  }
210
244
 
211
- // Secondary variant overrides
245
+ // ACTIVE TAB STATES - SECONDARY VARIANT
212
246
  .#{$container}--secondary & {
247
+ // Active Tab - Secondary variant
213
248
  &--active {
214
249
  color: t.color('on-surface');
215
250
 
216
251
  .#{$component}-icon {
217
252
  color: t.color('on-surface');
218
253
  }
254
+
255
+ // Hover state for active tabs - secondary
256
+ &:hover, &.#{$component}--hover {
257
+ background-color: t.alpha('on-surface', 0.08);
258
+ }
259
+
260
+ // Focused state for active tabs - secondary
261
+ &:focus-visible, &.#{$component}--focus {
262
+ background-color: t.alpha('on-surface', 0.1);
263
+ outline-color: t.color('on-surface');
264
+ }
265
+
266
+ // Pressed state for active tabs - secondary
267
+ &:active, &.#{$component}--pressed {
268
+ background-color: t.alpha('on-surface', 0.12);
269
+ }
270
+ }
271
+
272
+ // Inactive Tabs - Secondary variant
273
+ &:not(.#{$component}--active):not(.#{$component}--disabled):not(:disabled) {
274
+ color: t.color('on-surface-variant');
275
+
276
+ // Hover state for inactive tabs - secondary
277
+ &:hover, &.#{$component}--hover {
278
+ background-color: t.alpha('on-surface-variant', 0.08);
279
+ }
280
+
281
+ // Focused state for inactive tabs - secondary
282
+ &:focus-visible, &.#{$component}--focus {
283
+ background-color: t.alpha('on-surface-variant', 0.1);
284
+ outline-color: t.color('on-surface-variant');
285
+ }
286
+
287
+ // Pressed state for inactive tabs - secondary
288
+ &:active, &.#{$component}--pressed {
289
+ background-color: t.alpha('on-surface-variant', 0.12);
290
+ }
219
291
  }
220
- }
221
-
222
- // Hover state for inactive tabs
223
- &:hover:not(:disabled):not(&--active):not([disabled]) {
224
- background-color: t.alpha('on-surface-variant', 0.08);
225
- }
226
-
227
- // Pressed state for inactive tabs
228
- &:active:not(:disabled):not([disabled]):not(&--active) {
229
- background-color: t.alpha('on-surface-variant', 0.12);
230
292
  }
231
293
 
232
294
  // Ripple effect styling
@@ -131,14 +131,14 @@ $component: '#{base.$prefix}-textfield';
131
131
 
132
132
  // ===== FILLED VARIANT =====
133
133
  &--filled {
134
- border-bottom: 1px solid t.color('outline');
135
-
136
134
  .#{$component}-input {
137
135
  background-color: t.color('surface-container-highest');
138
136
  padding: 20px 16px 7px;
137
+ border-bottom: 1px solid t.color('outline');
139
138
  border-radius: f.get-shape('extra-small') f.get-shape('extra-small') 0 0;
140
139
  @include m.motion-transition(background-color, border-color);
141
-
140
+
141
+
142
142
  &:focus {
143
143
  padding-bottom: 6px;
144
144
  }
@@ -161,6 +161,19 @@ $component: '#{base.$prefix}-textfield';
161
161
  }
162
162
  }
163
163
 
164
+ &::before {
165
+ content: '';
166
+ position: absolute;
167
+ opacity: 0;
168
+ bottom: 0;
169
+ width: 100%;
170
+ height: 2px;
171
+ background-color: t.color('primary');
172
+ border-radius: 0;
173
+ pointer-events: none;
174
+ transition: 0.3s opacity ease;
175
+ }
176
+
164
177
  // Populated field (not empty) or focused field label position
165
178
  &:not(.#{$component}--empty) .#{$component}-label,
166
179
  &.#{$component}--focused .#{$component}-label {
@@ -168,48 +181,33 @@ $component: '#{base.$prefix}-textfield';
168
181
  }
169
182
 
170
183
  // Focus state
171
- &.#{$component}--focused {
172
- border-bottom: 2px solid t.color('primary');
173
-
184
+ &.#{$component}--focused {
174
185
  .#{$component}-label {
175
186
  color: t.color('primary');
176
187
  }
177
188
 
178
- .#{$component}-input {
179
- height: 55px;
180
- padding: 20px 16px 6px;
181
- }
182
-
183
-
184
- &:hover {
185
- border-bottom: 2px solid t.color('primary');
189
+ &::before {
190
+ opacity: 1
186
191
  }
187
192
  }
188
193
 
189
194
  // Hover state
190
- &:hover {
191
- border-bottom: 1px solid t.color('primary');
192
-
195
+ &:hover {
193
196
  .#{$component}-label {
194
197
  color: t.color('primary');
195
198
  }
196
199
  }
197
200
 
198
201
  // Error state
199
- &.#{$component}--error {
200
- border-bottom: 2px solid t.color('error');
201
-
202
+ &.#{$component}--error {
203
+ &::before {
204
+ opacity: 1;
205
+ background-color: t.color('error');
206
+ }
207
+
202
208
  .#{$component}-label {
203
209
  color: t.color('error');
204
210
  }
205
-
206
- &:hover {
207
- border-bottom: 2px solid t.color('error');
208
- }
209
-
210
- &.#{$component}--focused {
211
- border-bottom: 2px solid t.color('error');
212
- }
213
211
  }
214
212
 
215
213
  // Disabled state
@@ -233,13 +231,13 @@ $component: '#{base.$prefix}-textfield';
233
231
 
234
232
  // ===== OUTLINED VARIANT =====
235
233
  &--outlined {
236
- border: 1px solid t.color('outline');
237
234
  border-radius: f.get-shape('extra-small');
238
235
  @include m.motion-transition(border-color);
239
236
 
240
237
  .#{$component}-input {
241
238
  background-color: transparent;
242
- padding: 13px 16px 14px;
239
+ padding: 12px 15px 13px;
240
+ border: 1px solid t.color('outline');
243
241
  @include m.motion-transition(padding);
244
242
 
245
243
  // Autofill styles for outlined variant
@@ -249,8 +247,6 @@ $component: '#{base.$prefix}-textfield';
249
247
  & ~ .#{$component}-label {
250
248
  background-color: t.color('surface');
251
249
  transform: translateY(-145%) scale(0.75);
252
- left: 13px;
253
- padding: 0 4px;
254
250
  }
255
251
  }
256
252
 
@@ -258,73 +254,80 @@ $component: '#{base.$prefix}-textfield';
258
254
  & ~ .#{$component}-label {
259
255
  background-color: t.color('surface');
260
256
  transform: translateY(-145%) scale(0.75);
261
- left: 13px;
262
- padding: 0 4px;
263
257
  }
264
258
  }
265
259
  }
266
260
 
261
+ .#{$component}-label {
262
+ padding: 0 4px;
263
+ left: 12px;
264
+ top: 49%;
265
+ }
266
+
267
+ &::before {
268
+ content: '';
269
+ position: absolute;
270
+ opacity: 0;
271
+ width: 100%;
272
+ height: 100%;
273
+ border: 2px solid t.color('primary');
274
+ border-radius: f.get-shape('extra-small');
275
+ pointer-events: none;
276
+ transition: 0.2s opacity ease;
277
+ }
278
+
267
279
  // Populated field (not empty) or focused field label position
268
280
  &:not(.#{$component}--empty) .#{$component}-label,
269
281
  &.#{$component}--focused .#{$component}-label {
270
- background-color: t.color('surface');
271
- transform: translateY(-145%) scale(0.75);
272
- left: 13px;
273
282
  padding: 0 4px;
283
+ background-color: t.color('surface');
284
+ transform: translateY(-147%) scale(0.75);
285
+
274
286
  }
275
287
 
276
288
  // Focus state
277
289
  &.#{$component}--focused {
278
- border: 2px solid t.color('primary');
279
-
280
- .#{$component}-label {
281
- color: t.color('primary');
282
- border-radius: 2px;
283
- left: 12px;
290
+ &::before {
291
+ opacity: 1;
284
292
  }
285
-
286
- .#{$component}-input {
287
- height: 54px;
288
- padding: 12px 15px 13px;
289
- }
290
-
291
293
  &:hover {
292
- border: 2px solid t.color('primary');
294
+ &::before {
295
+ border-width: 2px;
296
+ }
293
297
  }
294
298
  }
295
299
 
296
300
  // Hover state
297
- &:hover {
298
- border: 1px solid t.color('primary');
299
-
301
+ &:hover {
300
302
  .#{$component}-label {
301
303
  color: t.color('primary');
302
304
  }
305
+
306
+ &::before {
307
+ opacity: 1;
308
+ border: 1px solid t.color('primary');
309
+ }
303
310
  }
304
311
 
305
312
  // Error state
306
- &.#{$component}--error {
307
- border: 2px solid t.color('error');
308
-
313
+ &.#{$component}--error {
314
+ &::before {
315
+ opacity: 1;
316
+ border: 2px solid t.color('error');
317
+ }
318
+
309
319
  .#{$component}-label {
310
320
  color: t.color('error');
311
- left: 12px;
312
- }
313
-
314
- .#{$component}-input {
315
- padding: 12px 15px 13px;
316
- }
317
-
318
- &:hover,
319
- &.#{$component}--focused {
320
- border: 2px solid t.color('error');
321
321
  }
322
322
  }
323
323
 
324
324
  // Disabled state
325
325
  &.#{$component}--disabled {
326
- border-color: t.alpha('on-surface', 0.38);
327
326
  pointer-events: none;
327
+ &::before {
328
+ opacity: 1;
329
+ border: 1px solid t.alpha('on-surface', 0.38);
330
+ }
328
331
  }
329
332
 
330
333
  // RTL support