1 |
|
2 | /**
|
3 | * Mixin that creates a new stacking context.
|
4 | * see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
|
5 | */
|
6 | @mixin md-stacking-context() {
|
7 | position: relative;
|
8 |
|
9 | // Use a transform to create a new stacking context.
|
10 | transform: translate3d(0, 0, 0);
|
11 | }
|
12 |
|
13 | /**
|
14 | * This mixin hides an element visually.
|
15 | * That means it's still accessible for screen-readers but not visible in view.
|
16 | */
|
17 | @mixin md-visually-hidden {
|
18 | border: 0;
|
19 | clip: rect(0 0 0 0);
|
20 | height: 1px;
|
21 | margin: -1px;
|
22 | overflow: hidden;
|
23 | padding: 0;
|
24 | position: absolute;
|
25 | text-transform: none;
|
26 | width: 1px;
|
27 | }
|
28 |
|
29 | /**
|
30 | * Forces an element to grow to fit floated contents; used as as an alternative to
|
31 | * `overflow: hidden;` because it doesn't cut off contents.
|
32 | */
|
33 | @mixin md-clearfix {
|
34 | &::before, &::after {
|
35 | content: '';
|
36 | clear: both;
|
37 | display: table;
|
38 | }
|
39 | }
|
40 |
|
41 | /**
|
42 | * A mixin, which generates temporary ink ripple on a given component.
|
43 | * When $bindToParent is set to true, it will check for the focused class on the same selector as you included
|
44 | * that mixin.
|
45 | * It is also possible to specify the color palette of the temporary ripple. By default it uses the
|
46 | * accent palette for its background.
|
47 | */
|
48 | @mixin md-temporary-ink-ripple($component, $bindToParent: false, $palette: $md-accent) {
|
49 | // TODO(mtlin): Replace when ink ripple component is implemented.
|
50 | // A placeholder ink ripple, shown when keyboard focused.
|
51 | .md-ink-ripple {
|
52 | border-radius: 50%;
|
53 | opacity: 0;
|
54 | height: 48px;
|
55 | left: 50%;
|
56 | overflow: hidden;
|
57 | pointer-events: none;
|
58 | position: absolute;
|
59 | top: 50%;
|
60 | transform: translate(-50%, -50%);
|
61 | transition: opacity ease 280ms, background-color ease 280ms;
|
62 | width: 48px;
|
63 | }
|
64 |
|
65 | // Fade in when radio focused.
|
66 | #{if($bindToParent, '&', '')}.md-#{$component}-focused .md-ink-ripple {
|
67 | opacity: 1;
|
68 | background-color: md-color($palette, 0.26);
|
69 | }
|
70 |
|
71 | // TODO(mtlin): This corresponds to disabled focus state, but it's unclear how to enter into
|
72 | // this state.
|
73 | #{if($bindToParent, '&', '')}.md-#{$component}-disabled .md-ink-ripple {
|
74 | background-color: #000;
|
75 | }
|
76 | }
|