@shortfuse/materialdesignweb 0.7.1-0 → 0.7.1-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.
- package/bin/generate-css.js +1 -2
- package/components/Badge.js +40 -3
- package/components/Body.js +16 -2
- package/components/BottomAppBar.js +25 -2
- package/components/Box.js +33 -3
- package/components/Button.js +146 -9
- package/components/Card.js +111 -3
- package/components/Checkbox.js +91 -3
- package/components/CheckboxIcon.js +92 -4
- package/components/Chip.js +38 -2
- package/components/Dialog.js +237 -3
- package/components/DialogActions.js +3 -2
- package/components/Divider.js +44 -3
- package/components/ExtendedFab.js +27 -2
- package/components/Fab.js +26 -2
- package/components/FilterChip.js +83 -2
- package/components/Headline.js +16 -2
- package/components/Icon.js +80 -4
- package/components/IconButton.js +153 -2
- package/components/Label.js +16 -2
- package/components/Layout.js +21 -3
- package/components/List.js +15 -2
- package/components/ListItem.js +229 -3
- package/components/ListOption.js +37 -3
- package/components/ListSelect.js +12 -2
- package/components/Menu.js +173 -3
- package/components/MenuItem.js +55 -2
- package/components/Nav.js +19 -2
- package/components/NavBar.js +37 -2
- package/components/NavBarItem.js +44 -2
- package/components/NavDrawer.js +34 -2
- package/components/NavDrawerItem.js +44 -2
- package/components/NavItem.js +183 -3
- package/components/NavRail.js +50 -2
- package/components/NavRailItem.js +25 -2
- package/components/Pane.js +263 -3
- package/components/Progress.js +469 -10
- package/components/Radio.js +97 -3
- package/components/RadioIcon.js +77 -5
- package/components/Ripple.js +76 -3
- package/components/SegmentedButton.js +97 -2
- package/components/SegmentedButtonGroup.js +15 -2
- package/components/Select.js +54 -2
- package/components/Shape.js +55 -18
- package/components/Slider.js +309 -3
- package/components/Snackbar.js +82 -2
- package/components/Surface.js +13 -4
- package/components/Switch.js +67 -4
- package/components/SwitchIcon.js +272 -5
- package/components/Tab.js +87 -3
- package/components/TabContent.js +21 -21
- package/components/TabList.js +131 -2
- package/components/TextArea.js +97 -3
- package/components/Title.js +16 -2
- package/components/Tooltip.js +42 -2
- package/components/TopAppBar.js +212 -3
- package/core/template.js +36 -9
- package/mixins/ControlMixin.js +65 -2
- package/mixins/DensityMixin.js +17 -3
- package/mixins/FlexableMixin.js +81 -3
- package/mixins/RippleMixin.js +15 -4
- package/mixins/ShapeMixin.js +279 -8
- package/mixins/StateMixin.js +87 -5
- package/mixins/SurfaceMixin.js +152 -3
- package/mixins/TextFieldMixin.js +661 -2
- package/mixins/ThemableMixin.js +206 -3
- package/mixins/TooltipTriggerMixin.js +30 -4
- package/mixins/TouchTargetMixin.js +29 -4
- package/package.json +2 -1
- package/theming/loader.js +0 -2
- package/components/Badge.css +0 -38
- package/components/Body.css +0 -14
- package/components/BottomAppBar.css +0 -23
- package/components/Box.css +0 -31
- package/components/Button.css +0 -147
- package/components/Card.css +0 -109
- package/components/Checkbox.css +0 -89
- package/components/CheckboxIcon.css +0 -90
- package/components/Chip.css +0 -35
- package/components/Dialog.css +0 -235
- package/components/Divider.css +0 -41
- package/components/ExtendedFab.css +0 -24
- package/components/Fab.css +0 -23
- package/components/FilterChip.css +0 -80
- package/components/Headline.css +0 -14
- package/components/Icon.css +0 -76
- package/components/IconButton.css +0 -150
- package/components/Label.css +0 -14
- package/components/Layout.css +0 -19
- package/components/List.css +0 -12
- package/components/ListItem.css +0 -224
- package/components/ListOption.css +0 -34
- package/components/ListSelect.css +0 -9
- package/components/Menu.css +0 -171
- package/components/MenuItem.css +0 -53
- package/components/Nav.css +0 -17
- package/components/NavBar.css +0 -34
- package/components/NavBarItem.css +0 -41
- package/components/NavDrawer.css +0 -31
- package/components/NavDrawerItem.css +0 -42
- package/components/NavItem.css +0 -181
- package/components/NavRail.css +0 -47
- package/components/NavRailItem.css +0 -25
- package/components/Outline.css +0 -138
- package/components/Pane.css +0 -261
- package/components/Progress.css +0 -75
- package/components/ProgressCircle.css +0 -226
- package/components/ProgressLine.css +0 -155
- package/components/Radio.css +0 -95
- package/components/RadioIcon.css +0 -73
- package/components/Ripple.css +0 -74
- package/components/SegmentedButton.css +0 -94
- package/components/SegmentedButtonGroup.css +0 -12
- package/components/Select.css +0 -52
- package/components/Shape.css +0 -132
- package/components/Slider.css +0 -307
- package/components/Snackbar.css +0 -80
- package/components/Surface.css +0 -10
- package/components/Switch.css +0 -64
- package/components/SwitchIcon.css +0 -178
- package/components/SwitchIconAnimations.css +0 -89
- package/components/Tab.css +0 -85
- package/components/TabList.css +0 -129
- package/components/TextArea.css +0 -93
- package/components/Title.css +0 -14
- package/components/Tooltip.css +0 -40
- package/components/TopAppBar.css +0 -209
- package/mixins/ControlMixin.css +0 -57
- package/mixins/DensityMixin.css +0 -40
- package/mixins/FlexableMixin.css +0 -79
- package/mixins/RippleMixin.css +0 -12
- package/mixins/ShapeMixin.css +0 -135
- package/mixins/StateMixin.css +0 -82
- package/mixins/SurfaceMixin.css +0 -150
- package/mixins/TextFieldMixin.css +0 -657
- package/mixins/ThemableMixin.css +0 -204
- package/mixins/TooltipTriggerMixin.css +0 -27
- package/mixins/TouchTargetMixin.css +0 -26
package/components/Slider.js
CHANGED
|
@@ -3,8 +3,6 @@ import InputMixin from '../mixins/InputMixin.js';
|
|
|
3
3
|
import StateMixin from '../mixins/StateMixin.js';
|
|
4
4
|
import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
5
5
|
|
|
6
|
-
import styles from './Slider.css' assert { type: 'css' };
|
|
7
|
-
|
|
8
6
|
/**
|
|
9
7
|
* @param {string} value
|
|
10
8
|
* @param {number} onNaN
|
|
@@ -170,7 +168,6 @@ export default CustomElement
|
|
|
170
168
|
click: 'onControlFinish',
|
|
171
169
|
},
|
|
172
170
|
})
|
|
173
|
-
.css(styles)
|
|
174
171
|
.expressions({
|
|
175
172
|
computeTrackStyle({ ticks, _previewValue, min, max }) {
|
|
176
173
|
return [
|
|
@@ -203,4 +200,313 @@ export default CustomElement
|
|
|
203
200
|
this._previewValue = newValue;
|
|
204
201
|
},
|
|
205
202
|
})
|
|
203
|
+
.css`
|
|
204
|
+
/* https://m3.material.io/components/sliders/specs */
|
|
205
|
+
|
|
206
|
+
:host {
|
|
207
|
+
--mdw-ink: var(--mdw-color__on-primary);
|
|
208
|
+
--mdw-bg: var(--mdw-color__primary);
|
|
209
|
+
|
|
210
|
+
display: inline-block;
|
|
211
|
+
vertical-align: middle;
|
|
212
|
+
|
|
213
|
+
min-block-size: 40px;
|
|
214
|
+
min-inline-size: 88px;
|
|
215
|
+
|
|
216
|
+
background-color: transparent;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
:host,
|
|
220
|
+
:host([color]) {
|
|
221
|
+
background-color: transparent;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
#label {
|
|
225
|
+
position: absolute;
|
|
226
|
+
inset: 0;
|
|
227
|
+
|
|
228
|
+
display: block;
|
|
229
|
+
|
|
230
|
+
cursor: pointer;
|
|
231
|
+
|
|
232
|
+
z-index: 1;
|
|
233
|
+
|
|
234
|
+
/* border-radius: 50%; */
|
|
235
|
+
color: rgb(var(--mdw-bg));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
#control {
|
|
239
|
+
inset:0;
|
|
240
|
+
|
|
241
|
+
overflow: visible;
|
|
242
|
+
|
|
243
|
+
block-size: 100%;
|
|
244
|
+
min-block-size: 0;
|
|
245
|
+
inline-size: 100%;
|
|
246
|
+
min-inline-size: 0;
|
|
247
|
+
|
|
248
|
+
appearance: none;
|
|
249
|
+
|
|
250
|
+
cursor: inherit;
|
|
251
|
+
|
|
252
|
+
transform: none;
|
|
253
|
+
|
|
254
|
+
background-color: transparent;
|
|
255
|
+
color: inherit;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
#control::-webkit-slider-runnable-track {
|
|
259
|
+
/* stylelint-disable-next-line declaration-property-value-disallowed-list */
|
|
260
|
+
margin-inline: -10px;
|
|
261
|
+
|
|
262
|
+
appearance: none;
|
|
263
|
+
|
|
264
|
+
background-color: transparent;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
@supports (-moz-appearance:none ){
|
|
268
|
+
#control {
|
|
269
|
+
inset-inline: -10px;
|
|
270
|
+
|
|
271
|
+
inline-size: calc(100% + 20px);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
#control::-moz-range-track {
|
|
276
|
+
inline-size: calc(100% + 20px) !important;
|
|
277
|
+
|
|
278
|
+
appearance: none;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
#control::-webkit-slider-thumb {
|
|
282
|
+
display: block;
|
|
283
|
+
|
|
284
|
+
block-size: 20px;
|
|
285
|
+
inline-size: 20px;
|
|
286
|
+
|
|
287
|
+
-webkit-appearance: none;
|
|
288
|
+
cursor: inherit;
|
|
289
|
+
|
|
290
|
+
transform: scale(2);
|
|
291
|
+
|
|
292
|
+
background-color: transparent; /* Safari */
|
|
293
|
+
|
|
294
|
+
border-radius: 50%;
|
|
295
|
+
box-shadow: none; /* Safari */
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
#control::-moz-range-thumb {
|
|
299
|
+
display: block;
|
|
300
|
+
|
|
301
|
+
box-sizing: content-box;
|
|
302
|
+
block-size: 20px;
|
|
303
|
+
inline-size: 20px;
|
|
304
|
+
border: none;
|
|
305
|
+
|
|
306
|
+
appearance: none;
|
|
307
|
+
cursor: inherit;
|
|
308
|
+
|
|
309
|
+
transform: scale(2);
|
|
310
|
+
|
|
311
|
+
background-color: transparent;
|
|
312
|
+
border-radius: 50%;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
#track {
|
|
316
|
+
--value: 0.5;
|
|
317
|
+
position: absolute;
|
|
318
|
+
inset-block-start: 50%;
|
|
319
|
+
inset-inline: 0;
|
|
320
|
+
|
|
321
|
+
block-size: 4px;
|
|
322
|
+
margin-block-start: -2px;
|
|
323
|
+
|
|
324
|
+
pointer-events: none;
|
|
325
|
+
user-select: none;
|
|
326
|
+
|
|
327
|
+
background-color: rgb(var(--mdw-color__surface-variant));
|
|
328
|
+
border-radius: inherit;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
#thumb {
|
|
332
|
+
position: absolute;
|
|
333
|
+
inset-block-start: -18px;
|
|
334
|
+
inset-inline-start: -20px;
|
|
335
|
+
|
|
336
|
+
display: flex;
|
|
337
|
+
align-items: center;
|
|
338
|
+
justify-content: center;
|
|
339
|
+
overflow: hidden;
|
|
340
|
+
|
|
341
|
+
block-size: 40px;
|
|
342
|
+
inline-size: 40px;
|
|
343
|
+
|
|
344
|
+
pointer-events: none;
|
|
345
|
+
|
|
346
|
+
border-radius: 50%;
|
|
347
|
+
|
|
348
|
+
color: rgb(var(--mdw-bg));
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
#thumb::before {
|
|
352
|
+
content: '';
|
|
353
|
+
|
|
354
|
+
display: block;
|
|
355
|
+
|
|
356
|
+
block-size: 20px;
|
|
357
|
+
inline-size: 20px;
|
|
358
|
+
|
|
359
|
+
background-color: currentColor;
|
|
360
|
+
border-radius: 50%;
|
|
361
|
+
|
|
362
|
+
transition: background-color 100ms;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/* Inactive ticks */
|
|
366
|
+
|
|
367
|
+
#ticks::before,
|
|
368
|
+
#ticks::after {
|
|
369
|
+
content: '';
|
|
370
|
+
|
|
371
|
+
position: absolute;
|
|
372
|
+
inset: 0;
|
|
373
|
+
|
|
374
|
+
padding-inline: 10px;
|
|
375
|
+
|
|
376
|
+
background-clip: content-box;
|
|
377
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
378
|
+
background-image: radial-gradient(circle at center, var(--tick-color) 0, var(--tick-color) 1px, transparent 0);
|
|
379
|
+
background-position: center center;
|
|
380
|
+
background-repeat: repeat-x;
|
|
381
|
+
background-size: 0 100%;
|
|
382
|
+
background-size: calc(100% / var(--ticks, 0)) 2px;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
#ticks::before {
|
|
386
|
+
--tick-color: rgb(var(--mdw-color__on-surface-variant));
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
#ticks::after {
|
|
390
|
+
--tick-color: rgb(var(--mdw-ink));
|
|
391
|
+
/* TODO: Use single-paint implementation */
|
|
392
|
+
padding-inline-end: calc(100% - (100% * var(--value)) + 10px);
|
|
393
|
+
|
|
394
|
+
z-index: 1;
|
|
395
|
+
|
|
396
|
+
will-change: padding-inline-end;
|
|
397
|
+
}
|
|
398
|
+
/* Active Indicator */
|
|
399
|
+
#track-active {
|
|
400
|
+
position: absolute;
|
|
401
|
+
inset: 0;
|
|
402
|
+
|
|
403
|
+
overflow: hidden;
|
|
404
|
+
|
|
405
|
+
border-radius: 99px;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
#track-active::before {
|
|
409
|
+
content: '';
|
|
410
|
+
|
|
411
|
+
position: absolute;
|
|
412
|
+
inset: 0;
|
|
413
|
+
|
|
414
|
+
transform: scaleX(var(--value));
|
|
415
|
+
transform-origin: 0 0;
|
|
416
|
+
|
|
417
|
+
background-color: rgb(var(--mdw-bg));
|
|
418
|
+
|
|
419
|
+
will-change: transform;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
#thumb-anchor {
|
|
423
|
+
position: absolute;
|
|
424
|
+
inset-inline: 0;
|
|
425
|
+
|
|
426
|
+
display: flex;
|
|
427
|
+
align-items: flex-start;
|
|
428
|
+
flex-direction: column;
|
|
429
|
+
|
|
430
|
+
inline-size: 1%;
|
|
431
|
+
|
|
432
|
+
transform: translateX(calc(var(--value) * 100 * 100%));
|
|
433
|
+
transform-origin: 0 0;
|
|
434
|
+
z-index: 24;
|
|
435
|
+
|
|
436
|
+
will-change: transform;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
#thumb-label {
|
|
440
|
+
position: absolute;
|
|
441
|
+
inset-block-end: 14px;
|
|
442
|
+
|
|
443
|
+
display: flex;
|
|
444
|
+
align-items: center;
|
|
445
|
+
justify-content: center;
|
|
446
|
+
|
|
447
|
+
box-sizing: content-box;
|
|
448
|
+
margin-block-end: 6px;
|
|
449
|
+
|
|
450
|
+
transform: translateX(-50%) scale(1);
|
|
451
|
+
transform-origin: 50% 100%;
|
|
452
|
+
|
|
453
|
+
font-weight: var(--mdw-typescale__label-medium__font-weight);
|
|
454
|
+
line-height: var(--mdw-typescale__label-medium__line-height);
|
|
455
|
+
font-family: var(--mdw-typescale__label-medium__font-family);
|
|
456
|
+
letter-spacing: var(--mdw-typescale__label-medium__letter-spacing);
|
|
457
|
+
|
|
458
|
+
transition: transform 200ms;
|
|
459
|
+
will-change: transform;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
#thumb-label:is([hidden],[text=""]) {
|
|
463
|
+
transform: translateX(-50%) scale(0);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
#thumb-label::before {
|
|
467
|
+
content: attr(text);
|
|
468
|
+
|
|
469
|
+
display: flex;
|
|
470
|
+
align-items: center;
|
|
471
|
+
justify-content: center;
|
|
472
|
+
|
|
473
|
+
min-block-size: 28px;
|
|
474
|
+
min-inline-size: 28px;
|
|
475
|
+
|
|
476
|
+
z-index: 1;
|
|
477
|
+
|
|
478
|
+
background-color: rgb(var(--mdw-bg));
|
|
479
|
+
border-radius: 50%;
|
|
480
|
+
color: rgb(var(--mdw-ink));
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
#thumb-label::after {
|
|
484
|
+
/* Values from Figma SVG */
|
|
485
|
+
--x-start: 14.6446%; /*4.1005px*/
|
|
486
|
+
--x-end: 85.3554%;
|
|
487
|
+
--y: 70.7106%; /*24.0416px*/
|
|
488
|
+
|
|
489
|
+
content: "";
|
|
490
|
+
|
|
491
|
+
position: absolute;
|
|
492
|
+
inset: 0;
|
|
493
|
+
inset-block-end: -6px;
|
|
494
|
+
|
|
495
|
+
clip-path: polygon(var(--x-start) var(--y), var(--x-end) var(--y), 50% 100%, var(--x-start) var(--y));
|
|
496
|
+
|
|
497
|
+
background-color: rgb(var(--mdw-bg));
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
#track[disabled] {
|
|
501
|
+
background-color: rgb(var(--mdw-color__on-surface), calc(0.12 / 0.38));
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
#label[disabled],
|
|
505
|
+
#track[disabled] {
|
|
506
|
+
--mdw-bg: var(--mdw-color__on-surface);
|
|
507
|
+
cursor: not-allowed;
|
|
508
|
+
|
|
509
|
+
opacity: 0.38;
|
|
510
|
+
}
|
|
511
|
+
`
|
|
206
512
|
.autoRegister('mdw-slider');
|
package/components/Snackbar.js
CHANGED
|
@@ -7,7 +7,6 @@ import DensityMixin from '../mixins/DensityMixin.js';
|
|
|
7
7
|
import './Button.js';
|
|
8
8
|
import './IconButton.js';
|
|
9
9
|
|
|
10
|
-
import styles from './Snackbar.css' assert { type: 'css' };
|
|
11
10
|
import Surface from './Surface.js';
|
|
12
11
|
|
|
13
12
|
export default Surface
|
|
@@ -71,5 +70,86 @@ export default Surface
|
|
|
71
70
|
},
|
|
72
71
|
},
|
|
73
72
|
})
|
|
74
|
-
.css
|
|
73
|
+
.css`
|
|
74
|
+
/* https://m3.material.io/components/snackbar/specs */
|
|
75
|
+
|
|
76
|
+
:host {
|
|
77
|
+
--mdw-shape__size: var(--mdw-shape__small);
|
|
78
|
+
--mdw-surface__shadow: var(--mdw-surface__shadow__3);
|
|
79
|
+
--mdw-surface__tint: var(--mdw-surface__tint__3);
|
|
80
|
+
--mdw-shape__bg: rgb(var(--mdw-color__inverse-surface));
|
|
81
|
+
--mdw-ink: var(--mdw-color__inverse-on-surface);
|
|
82
|
+
|
|
83
|
+
--mdw-type__line-height: var(--mdw-typescale__body-medium__line-height);
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
|
|
87
|
+
padding-inline: 16px;
|
|
88
|
+
|
|
89
|
+
opacity: 0;
|
|
90
|
+
transform: translateY(25%) scaleY(0.25);
|
|
91
|
+
transform-origin: bottom center;
|
|
92
|
+
visibility: hidden; /* Remove from tab order */
|
|
93
|
+
z-index: 24;
|
|
94
|
+
|
|
95
|
+
font: var(--mdw-typescale__body-medium__font);
|
|
96
|
+
letter-spacing: var(--mdw-typescale__body-medium__letter-spacing);
|
|
97
|
+
|
|
98
|
+
transition: transform 200ms, opacity 200ms, visibility 200ms;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:host([action]) {
|
|
102
|
+
gap: 8px;
|
|
103
|
+
|
|
104
|
+
padding-inline-end: 8px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
:host([close-button]) {
|
|
108
|
+
gap: 4px;
|
|
109
|
+
|
|
110
|
+
padding-inline-end: 4px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:host([open]) {
|
|
114
|
+
opacity: 1;
|
|
115
|
+
transform: scale(1);
|
|
116
|
+
visibility: visible;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
#content {
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
|
|
123
|
+
flex: 1;
|
|
124
|
+
padding-block: max(2px, calc(14px + (var(--mdw-density) * 2px)));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
#slot {
|
|
128
|
+
display: block;
|
|
129
|
+
overflow-x: hidden;
|
|
130
|
+
overflow-y: hidden;
|
|
131
|
+
|
|
132
|
+
max-block-size: calc(var(--mdw-type__line-height) * 2);
|
|
133
|
+
|
|
134
|
+
text-align: start;
|
|
135
|
+
text-overflow: ellipsis;
|
|
136
|
+
text-transform: none;
|
|
137
|
+
white-space: normal;
|
|
138
|
+
word-break: break-word;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@supports(width: 1lh) {
|
|
142
|
+
#slot {
|
|
143
|
+
max-block-size: 2lh;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@supports(-webkit-line-clamp:1) {
|
|
148
|
+
#slot {
|
|
149
|
+
display: -webkit-box;
|
|
150
|
+
-webkit-box-orient: vertical;
|
|
151
|
+
-webkit-line-clamp: 2;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
`
|
|
75
155
|
.autoRegister('mdw-snackbar');
|
package/components/Surface.js
CHANGED
|
@@ -4,14 +4,12 @@ import ShapeMixin from '../mixins/ShapeMixin.js';
|
|
|
4
4
|
import SurfaceMixin from '../mixins/SurfaceMixin.js';
|
|
5
5
|
import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
6
6
|
|
|
7
|
-
import styles from './Surface.css' assert {type:'css'};
|
|
8
|
-
|
|
9
7
|
export default CustomElement
|
|
10
8
|
.mixin(ThemableMixin)
|
|
11
9
|
.mixin(FlexableMixin)
|
|
12
10
|
.mixin(SurfaceMixin)
|
|
13
11
|
.mixin(ShapeMixin)
|
|
14
|
-
.
|
|
12
|
+
.html/* html */`<slot id=slot></slot>`
|
|
15
13
|
.on({
|
|
16
14
|
composed() {
|
|
17
15
|
const { surface, shape, surfaceTint } = this.refs;
|
|
@@ -19,5 +17,16 @@ export default CustomElement
|
|
|
19
17
|
surface.append(shape);
|
|
20
18
|
},
|
|
21
19
|
})
|
|
22
|
-
.
|
|
20
|
+
.css`
|
|
21
|
+
:host {
|
|
22
|
+
--mdw-shape__bg: rgb(var(--mdw-color__surface));
|
|
23
|
+
--mdw-ink: var(--mdw-color__on-surface);
|
|
24
|
+
position: relative;
|
|
25
|
+
|
|
26
|
+
color: rgb(var(--mdw-ink));
|
|
27
|
+
|
|
28
|
+
font: var(--mdw-type__font);
|
|
29
|
+
letter-spacing: var(--mdw-type__letter-spacing);
|
|
30
|
+
}
|
|
31
|
+
`
|
|
23
32
|
.autoRegister('mdw-surface');
|
package/components/Switch.js
CHANGED
|
@@ -5,8 +5,6 @@ import StateMixin from '../mixins/StateMixin.js';
|
|
|
5
5
|
import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
6
6
|
import TouchTargetMixin from '../mixins/TouchTargetMixin.js';
|
|
7
7
|
|
|
8
|
-
import styles from './Switch.css' assert { type: 'css' };
|
|
9
|
-
|
|
10
8
|
export default CustomElement
|
|
11
9
|
.mixin(ThemableMixin)
|
|
12
10
|
.mixin(InputMixin) // Label as root
|
|
@@ -26,8 +24,6 @@ export default CustomElement
|
|
|
26
24
|
selectedSrc: 'string',
|
|
27
25
|
unselectedSrc: 'string',
|
|
28
26
|
})
|
|
29
|
-
.css(styles)
|
|
30
|
-
|
|
31
27
|
.on({
|
|
32
28
|
composed({ html }) {
|
|
33
29
|
const { state, label, control, touchTarget } = this.refs;
|
|
@@ -124,4 +120,71 @@ export default CustomElement
|
|
|
124
120
|
'~pointermove': 'onControlMouseOrTouch',
|
|
125
121
|
},
|
|
126
122
|
})
|
|
123
|
+
.css`
|
|
124
|
+
/* https://m3.material.io/components/switch/specs */
|
|
125
|
+
|
|
126
|
+
:host {
|
|
127
|
+
--mdw-ink: var(--mdw-color__on-primary);
|
|
128
|
+
--mdw-bg: var(--mdw-color__primary);
|
|
129
|
+
position: relative;
|
|
130
|
+
|
|
131
|
+
display: inline-flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
|
|
134
|
+
gap: 12px;
|
|
135
|
+
vertical-align: middle;
|
|
136
|
+
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
#touch-target {
|
|
140
|
+
z-index: 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
#label {
|
|
144
|
+
display: contents;
|
|
145
|
+
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
|
|
148
|
+
/* border-radius: 50%; */
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** Switch **/
|
|
152
|
+
|
|
153
|
+
#switch {
|
|
154
|
+
--mdw-bg: inherit;
|
|
155
|
+
--mdw-ink: inherit;
|
|
156
|
+
flex:1;
|
|
157
|
+
|
|
158
|
+
pointer-events: none;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** State **/
|
|
162
|
+
|
|
163
|
+
#state {
|
|
164
|
+
position: absolute;
|
|
165
|
+
inset: 50%;
|
|
166
|
+
|
|
167
|
+
block-size: 100%;
|
|
168
|
+
min-block-size: 40px;
|
|
169
|
+
inline-size: 100%;
|
|
170
|
+
min-inline-size: 40px;
|
|
171
|
+
|
|
172
|
+
pointer-events: none;
|
|
173
|
+
|
|
174
|
+
transform: translateX(-50%) translateY(-50%);
|
|
175
|
+
|
|
176
|
+
border-radius: 50%;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Disabled **/
|
|
180
|
+
|
|
181
|
+
#label[disabled] {
|
|
182
|
+
--mdw-ink: var(--mdw-color__on-surface); /* selected icon */
|
|
183
|
+
--mdw-bg: var(--mdw-color__surface);
|
|
184
|
+
cursor: not-allowed;
|
|
185
|
+
|
|
186
|
+
opacity: 0.38;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
`
|
|
127
190
|
.autoRegister('mdw-switch');
|