mtrl 0.2.8 → 0.3.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.
- package/index.ts +4 -0
- package/package.json +1 -1
- package/src/components/button/button.ts +34 -5
- package/src/components/navigation/api.ts +131 -96
- package/src/components/navigation/features/controller.ts +273 -0
- package/src/components/navigation/features/items.ts +133 -64
- package/src/components/navigation/navigation.ts +17 -2
- package/src/components/navigation/system/core.ts +302 -0
- package/src/components/navigation/system/events.ts +240 -0
- package/src/components/navigation/system/index.ts +184 -0
- package/src/components/navigation/system/mobile.ts +278 -0
- package/src/components/navigation/system/state.ts +77 -0
- package/src/components/navigation/system/types.ts +364 -0
- package/src/components/slider/config.ts +20 -2
- package/src/components/slider/features/controller.ts +737 -0
- package/src/components/slider/features/handlers.ts +18 -16
- package/src/components/slider/features/index.ts +3 -2
- package/src/components/slider/features/range.ts +104 -0
- package/src/components/slider/schema.ts +141 -0
- package/src/components/slider/slider.ts +34 -13
- package/src/components/switch/api.ts +16 -0
- package/src/components/switch/config.ts +1 -18
- package/src/components/switch/features.ts +198 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/switch/switch.ts +3 -3
- package/src/components/switch/types.ts +14 -2
- package/src/components/textfield/api.ts +53 -0
- package/src/components/textfield/features.ts +322 -0
- package/src/components/textfield/textfield.ts +8 -0
- package/src/components/textfield/types.ts +12 -3
- package/src/components/timepicker/clockdial.ts +1 -4
- package/src/core/compose/features/textinput.ts +15 -2
- package/src/core/composition/features/dom.ts +45 -0
- package/src/core/composition/features/icon.ts +131 -0
- package/src/core/composition/features/index.ts +12 -0
- package/src/core/composition/features/label.ts +155 -0
- package/src/core/composition/features/layout.ts +47 -0
- package/src/core/composition/index.ts +26 -0
- package/src/core/index.ts +1 -1
- package/src/core/layout/README.md +350 -0
- package/src/core/layout/array.ts +181 -0
- package/src/core/layout/create.ts +55 -0
- package/src/core/layout/index.ts +26 -0
- package/src/core/layout/object.ts +124 -0
- package/src/core/layout/processor.ts +58 -0
- package/src/core/layout/result.ts +85 -0
- package/src/core/layout/types.ts +125 -0
- package/src/core/layout/utils.ts +136 -0
- package/src/index.ts +1 -0
- package/src/styles/abstract/_variables.scss +28 -0
- package/src/styles/components/_navigation-mobile.scss +244 -0
- package/src/styles/components/_navigation-system.scss +151 -0
- package/src/styles/components/_switch.scss +133 -69
- package/src/styles/components/_textfield.scss +259 -27
- package/demo/build.ts +0 -349
- package/demo/index.html +0 -110
- package/demo/main.js +0 -448
- package/demo/styles.css +0 -239
- package/server.ts +0 -86
- package/src/components/slider/features/slider.ts +0 -318
- package/src/components/slider/features/structure.ts +0 -181
- package/src/components/slider/features/ui.ts +0 -388
- package/src/components/textfield/constants.ts +0 -100
- package/src/core/layout/index.js +0 -95
|
@@ -28,7 +28,8 @@ $component: '#{base.$prefix}-textfield';
|
|
|
28
28
|
border-radius: 2px;
|
|
29
29
|
color: t.color('on-surface-variant');
|
|
30
30
|
transition: transform v.motion('duration-short4') v.motion('easing-emphasized'),
|
|
31
|
-
color v.motion('duration-short2') v.motion('easing-standard')
|
|
31
|
+
color v.motion('duration-short2') v.motion('easing-standard'),
|
|
32
|
+
left v.motion('duration-short4') v.motion('easing-emphasized');
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
// Input element
|
|
@@ -68,6 +69,65 @@ $component: '#{base.$prefix}-textfield';
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
}
|
|
72
|
+
|
|
73
|
+
// Leading icon
|
|
74
|
+
&-leading-icon {
|
|
75
|
+
position: absolute;
|
|
76
|
+
left: 12px;
|
|
77
|
+
top: 50%;
|
|
78
|
+
transform: translateY(-50%);
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
width: 24px;
|
|
83
|
+
height: 24px;
|
|
84
|
+
pointer-events: none;
|
|
85
|
+
color: t.color('on-surface-variant');
|
|
86
|
+
z-index: 1;
|
|
87
|
+
|
|
88
|
+
svg {
|
|
89
|
+
width: 20px;
|
|
90
|
+
height: 20px;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Trailing icon
|
|
95
|
+
&-trailing-icon {
|
|
96
|
+
position: absolute;
|
|
97
|
+
right: 12px;
|
|
98
|
+
top: 50%;
|
|
99
|
+
transform: translateY(-50%);
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
width: 24px;
|
|
104
|
+
height: 24px;
|
|
105
|
+
color: t.color('on-surface-variant');
|
|
106
|
+
z-index: 1;
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
|
|
109
|
+
svg {
|
|
110
|
+
width: 20px;
|
|
111
|
+
height: 20px;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Adjustments when icons are present
|
|
116
|
+
&--with-leading-icon {
|
|
117
|
+
.#{$component}-label {
|
|
118
|
+
left: 44px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.#{$component}-input {
|
|
122
|
+
padding-left: 44px;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&--with-trailing-icon {
|
|
127
|
+
.#{$component}-input {
|
|
128
|
+
padding-right: 44px;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
71
131
|
|
|
72
132
|
// Error state
|
|
73
133
|
&--error {
|
|
@@ -76,6 +136,11 @@ $component: '#{base.$prefix}-textfield';
|
|
|
76
136
|
.#{$component}-label {
|
|
77
137
|
color: t.color('error');
|
|
78
138
|
}
|
|
139
|
+
|
|
140
|
+
.#{$component}-leading-icon,
|
|
141
|
+
.#{$component}-trailing-icon {
|
|
142
|
+
color: t.color('error');
|
|
143
|
+
}
|
|
79
144
|
}
|
|
80
145
|
|
|
81
146
|
// Disabled state
|
|
@@ -85,15 +150,20 @@ $component: '#{base.$prefix}-textfield';
|
|
|
85
150
|
background-color: t.alpha('on-surface', 0.04);
|
|
86
151
|
pointer-events: none;
|
|
87
152
|
|
|
88
|
-
& ~ .#{$component}-label
|
|
153
|
+
& ~ .#{$component}-label,
|
|
154
|
+
& ~ .#{$component}-leading-icon,
|
|
155
|
+
& ~ .#{$component}-trailing-icon {
|
|
89
156
|
color: t.color('on-surface');
|
|
90
157
|
opacity: 0.38;
|
|
91
158
|
}
|
|
92
159
|
}
|
|
93
160
|
|
|
94
|
-
// Helper text
|
|
161
|
+
// Helper text / Supporting text
|
|
95
162
|
&-helper {
|
|
96
163
|
@include m.typography('body-small');
|
|
164
|
+
position: absolute;
|
|
165
|
+
bottom: -18px;
|
|
166
|
+
left: 16px;
|
|
97
167
|
margin-top: 4px;
|
|
98
168
|
color: t.color('on-surface-variant');
|
|
99
169
|
|
|
@@ -127,6 +197,35 @@ $component: '#{base.$prefix}-textfield';
|
|
|
127
197
|
margin-left: 0;
|
|
128
198
|
margin-right: 4px;
|
|
129
199
|
}
|
|
200
|
+
|
|
201
|
+
&-leading-icon {
|
|
202
|
+
left: auto;
|
|
203
|
+
right: 12px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
&-trailing-icon {
|
|
207
|
+
right: auto;
|
|
208
|
+
left: 12px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
&--with-leading-icon {
|
|
212
|
+
.#{$component}-label {
|
|
213
|
+
left: auto;
|
|
214
|
+
right: 44px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.#{$component}-input {
|
|
218
|
+
padding-left: 16px;
|
|
219
|
+
padding-right: 44px;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
&--with-trailing-icon {
|
|
224
|
+
.#{$component}-input {
|
|
225
|
+
padding-right: 16px;
|
|
226
|
+
padding-left: 44px;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
130
229
|
}
|
|
131
230
|
|
|
132
231
|
// ===== FILLED VARIANT =====
|
|
@@ -139,10 +238,6 @@ $component: '#{base.$prefix}-textfield';
|
|
|
139
238
|
@include m.motion-transition(background-color, border-color);
|
|
140
239
|
|
|
141
240
|
|
|
142
|
-
&:focus {
|
|
143
|
-
padding-bottom: 6px;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
241
|
// Autofill styles for filled variant
|
|
147
242
|
&:-webkit-autofill {
|
|
148
243
|
border-radius: f.get-shape('extra-small') f.get-shape('extra-small') 0 0;
|
|
@@ -171,7 +266,7 @@ $component: '#{base.$prefix}-textfield';
|
|
|
171
266
|
background-color: t.color('primary');
|
|
172
267
|
border-radius: 0;
|
|
173
268
|
pointer-events: none;
|
|
174
|
-
transition: 0.
|
|
269
|
+
transition: 0.2s opacity ease;
|
|
175
270
|
}
|
|
176
271
|
|
|
177
272
|
// Populated field (not empty) or focused field label position
|
|
@@ -191,12 +286,12 @@ $component: '#{base.$prefix}-textfield';
|
|
|
191
286
|
}
|
|
192
287
|
}
|
|
193
288
|
|
|
194
|
-
// Hover state
|
|
195
|
-
&:hover {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
289
|
+
// // Hover state
|
|
290
|
+
// &:hover {
|
|
291
|
+
// .#{$component}-label {
|
|
292
|
+
// color: t.color('primary');
|
|
293
|
+
// }
|
|
294
|
+
// }
|
|
200
295
|
|
|
201
296
|
// Error state
|
|
202
297
|
&.#{$component}--error {
|
|
@@ -220,17 +315,74 @@ $component: '#{base.$prefix}-textfield';
|
|
|
220
315
|
}
|
|
221
316
|
}
|
|
222
317
|
|
|
318
|
+
// Icon adjustments for filled variant
|
|
319
|
+
&.#{$component}--with-leading-icon {
|
|
320
|
+
.#{$component}-input {
|
|
321
|
+
padding: 20px 16px 7px 44px;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.#{$component}-label {
|
|
325
|
+
left: 44px;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
&:not(.#{$component}--empty) .#{$component}-label,
|
|
329
|
+
&.#{$component}--focused .#{$component}-label {
|
|
330
|
+
transform: translateY(-95%) scale(0.75);
|
|
331
|
+
// Keep the label aligned with input text when focused/filled
|
|
332
|
+
left: 44px;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.#{$component}-leading-icon {
|
|
336
|
+
top: 28px;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
&.#{$component}--with-trailing-icon {
|
|
341
|
+
.#{$component}-input {
|
|
342
|
+
padding-right: 44px;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.#{$component}-trailing-icon {
|
|
346
|
+
top: 28px;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
223
350
|
// RTL support
|
|
224
351
|
@include m.rtl {
|
|
225
352
|
.#{$component}-label {
|
|
226
353
|
left: auto;
|
|
227
354
|
right: 16px;
|
|
228
355
|
}
|
|
356
|
+
|
|
357
|
+
&.#{$component}--with-leading-icon {
|
|
358
|
+
.#{$component}-input {
|
|
359
|
+
padding: 20px 44px 7px 16px;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.#{$component}-label {
|
|
363
|
+
left: auto;
|
|
364
|
+
right: 44px;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
&:not(.#{$component}--empty) .#{$component}-label,
|
|
368
|
+
&.#{$component}--focused .#{$component}-label {
|
|
369
|
+
// Keep the label aligned with input text when focused/filled in RTL
|
|
370
|
+
right: 44px;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
&.#{$component}--with-trailing-icon {
|
|
375
|
+
.#{$component}-input {
|
|
376
|
+
padding-right: 16px;
|
|
377
|
+
padding-left: 44px;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
229
380
|
}
|
|
230
381
|
}
|
|
231
382
|
|
|
232
383
|
// ===== OUTLINED VARIANT =====
|
|
233
384
|
&--outlined {
|
|
385
|
+
background-color: inherit;
|
|
234
386
|
border-radius: f.get-shape('extra-small');
|
|
235
387
|
@include m.motion-transition(border-color);
|
|
236
388
|
|
|
@@ -259,6 +411,7 @@ $component: '#{base.$prefix}-textfield';
|
|
|
259
411
|
}
|
|
260
412
|
|
|
261
413
|
.#{$component}-label {
|
|
414
|
+
background-color: inherit;
|
|
262
415
|
padding: 0 4px;
|
|
263
416
|
left: 12px;
|
|
264
417
|
top: 49%;
|
|
@@ -270,19 +423,17 @@ $component: '#{base.$prefix}-textfield';
|
|
|
270
423
|
opacity: 0;
|
|
271
424
|
width: 100%;
|
|
272
425
|
height: 100%;
|
|
273
|
-
border:
|
|
426
|
+
border: 1.5px solid t.color('primary');
|
|
274
427
|
border-radius: f.get-shape('extra-small');
|
|
275
428
|
pointer-events: none;
|
|
276
|
-
transition: 0.
|
|
429
|
+
transition: 0.1s opacity ease;
|
|
277
430
|
}
|
|
278
431
|
|
|
279
432
|
// Populated field (not empty) or focused field label position
|
|
280
433
|
&:not(.#{$component}--empty) .#{$component}-label,
|
|
281
434
|
&.#{$component}--focused .#{$component}-label {
|
|
282
435
|
padding: 0 4px;
|
|
283
|
-
background-color: t.color('surface');
|
|
284
436
|
transform: translateY(-147%) scale(0.75);
|
|
285
|
-
|
|
286
437
|
}
|
|
287
438
|
|
|
288
439
|
// Focus state
|
|
@@ -295,18 +446,10 @@ $component: '#{base.$prefix}-textfield';
|
|
|
295
446
|
border-width: 2px;
|
|
296
447
|
}
|
|
297
448
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
// Hover state
|
|
301
|
-
&:hover {
|
|
449
|
+
|
|
302
450
|
.#{$component}-label {
|
|
303
451
|
color: t.color('primary');
|
|
304
452
|
}
|
|
305
|
-
|
|
306
|
-
&::before {
|
|
307
|
-
opacity: 1;
|
|
308
|
-
border: 1px solid t.color('primary');
|
|
309
|
-
}
|
|
310
453
|
}
|
|
311
454
|
|
|
312
455
|
// Error state
|
|
@@ -330,6 +473,29 @@ $component: '#{base.$prefix}-textfield';
|
|
|
330
473
|
}
|
|
331
474
|
}
|
|
332
475
|
|
|
476
|
+
// Icon adjustments for outlined variant
|
|
477
|
+
&.#{$component}--with-leading-icon {
|
|
478
|
+
.#{$component}-input {
|
|
479
|
+
padding-left: 44px;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.#{$component}-label {
|
|
483
|
+
left: 44px;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
&:not(.#{$component}--empty) .#{$component}-label,
|
|
487
|
+
&.#{$component}--focused .#{$component}-label {
|
|
488
|
+
// For outlined variant, move label to default position
|
|
489
|
+
left: 13px;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
&.#{$component}--with-trailing-icon {
|
|
494
|
+
.#{$component}-input {
|
|
495
|
+
padding-right: 44px;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
333
499
|
// RTL support
|
|
334
500
|
@include m.rtl {
|
|
335
501
|
&:not(.#{$component}--empty) .#{$component}-label,
|
|
@@ -345,6 +511,72 @@ $component: '#{base.$prefix}-textfield';
|
|
|
345
511
|
&.#{$component}--error .#{$component}-label {
|
|
346
512
|
right: 12px;
|
|
347
513
|
}
|
|
514
|
+
|
|
515
|
+
&.#{$component}--with-leading-icon {
|
|
516
|
+
.#{$component}-input {
|
|
517
|
+
padding-left: 16px;
|
|
518
|
+
padding-right: 44px;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.#{$component}-label {
|
|
522
|
+
left: auto;
|
|
523
|
+
right: 44px;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
&:not(.#{$component}--empty) .#{$component}-label,
|
|
527
|
+
&.#{$component}--focused .#{$component}-label {
|
|
528
|
+
// For outlined variant in RTL, move label to default position
|
|
529
|
+
right: 13px;
|
|
530
|
+
left: auto;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
&.#{$component}--with-trailing-icon {
|
|
535
|
+
.#{$component}-input {
|
|
536
|
+
padding-right: 16px;
|
|
537
|
+
padding-left: 44px;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// Multiline styles
|
|
544
|
+
&--multiline {
|
|
545
|
+
.#{$component}-input {
|
|
546
|
+
min-height: 100px;
|
|
547
|
+
height: auto;
|
|
548
|
+
resize: vertical;
|
|
549
|
+
padding-top: 12px;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
&--filled {
|
|
553
|
+
.#{$component}-input {
|
|
554
|
+
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
&--outlined {
|
|
559
|
+
.#{$component}-input {
|
|
560
|
+
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
.#{$component}-label {
|
|
566
|
+
top: 24px;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
// Support for multiline inputs
|
|
572
|
+
&-input[type="multiline"] {
|
|
573
|
+
min-height: 100px;
|
|
574
|
+
resize: vertical;
|
|
575
|
+
|
|
576
|
+
& ~ .#{$component}-leading-icon,
|
|
577
|
+
& ~ .#{$component}-trailing-icon {
|
|
578
|
+
top: 20px;
|
|
579
|
+
transform: none;
|
|
348
580
|
}
|
|
349
581
|
}
|
|
350
582
|
}
|