@@ -18,3 +18,263 @@ $mat-option-inline-icons: false !default;
1818 @return url (" package:#{$file } " )
1919 }
2020}
21+
22+ // Forces an element to take up the same space as its closest, positioned
23+ // ancestor or, if none exists, the root element.
24+ @mixin fit {
25+ bottom : 0 ;
26+ left : 0 ;
27+ position : absolute ;
28+ right : 0 ;
29+ top : 0 ;
30+ }
31+
32+ // clearfix forces the containing element to contain and be the same height as
33+ // the floated child elements.
34+ @mixin clearfix () {
35+ & ::before ,
36+ & ::after {
37+ content : ' ' ;
38+ display : table ;
39+ }
40+
41+ & ::after {
42+ clear : both ;
43+ }
44+ }
45+
46+ // Styles text that is used as a floating label over a material component.
47+ @mixin mat-input-header () {
48+ color : $mat-gray-600 ;
49+ // TODO(google): Migrate to extended mixin mat-font-caption
50+ font-size : $mat-font-size-caption ;
51+ font-weight : $mat-font-weight-regular ;
52+ }
53+
54+ @mixin clear-button () {
55+ background-color : transparent ;
56+ border : 0 ;
57+ color : inherit ;
58+ cursor : pointer ;
59+ display : block ;
60+ font-family : inherit ;
61+ position : relative ;
62+ }
63+
64+ // Note: this only supports square icons.
65+ @mixin icon-background (
66+ $icon-url , $background-size : 6 * $mat-grid , $icon-size : 3 * $mat-grid ) {
67+
68+ box-sizing : border-box ;
69+ flex-shrink : 0 ;
70+ flex-grow : 0 ;
71+
72+ background-image : mat-icon-image ($icon-url );
73+ background-position : center center ;
74+ background-repeat : no-repeat ;
75+ background-size : $icon-size $icon-size ;
76+ height : $background-size ;
77+ padding : (($background-size - $icon-size ) / 2 );
78+ width : $background-size ;
79+ }
80+
81+ // TODO(google): remove icon-button and glyph-button in favor of a more
82+ // standard way of creating glyph buttons (e.g. a glyph button component)
83+ // DEPRECATED: use <material-button icon> instead.
84+ @mixin icon-button (
85+ $icon-url , $button-size : 6 * $mat-grid , $icon-size : 3 * $mat-grid ) {
86+
87+ @include clear-button ();
88+ font-size : 0 ;
89+ height : $button-size ;
90+ outline : none ;
91+ width : $button-size ;
92+
93+ // Icon is in after pseudo element to isolate opacity fiddling.
94+ & ::after {
95+ @include icon-background ($icon-url , $button-size , $icon-size );
96+ content : ' ' ;
97+ display : block ;
98+ opacity : $mat-icon-opacity ;
99+ left : 0 ;
100+ position : absolute ;
101+ top : 0 ;
102+ transition : opacity $mat-transition-standard $mat-transition ;
103+ }
104+
105+ // Light theme - default
106+ & :focus ::after ,
107+ & :hover ::after ,
108+ & :active ::after {
109+ opacity : $mat-icon-opacity-hover ;
110+ }
111+
112+ & :disabled ::after {
113+ opacity : $mat-icon-opacity-disabled ;
114+ }
115+
116+ // Dark theme
117+ & .dark ::after {
118+ opacity : $mat-icon-dark-opacity ;
119+ }
120+
121+ & .dark :focus ::after ,
122+ & .dark :hover ::after ,
123+ & .dark :active ::after {
124+ opacity : $mat-icon-dark-opacity-hover ;
125+ outline : none ;
126+ }
127+
128+ & .dark :disabled ::after {
129+ opacity : $mat-icon-dark-opacity-disabled ;
130+ }
131+ }
132+
133+ // Similar to icon button, but to be used with a button containing an
134+ // acx `<glyph>` element.
135+ // DEPRECATED: use <material-button icon> instead.
136+ @mixin glyph-button ($button-size : 6 * $mat-grid , $circle : false) {
137+
138+ @include clear-button ();
139+ height : $button-size ;
140+ opacity : $mat-icon-opacity ;
141+ outline : none ;
142+ padding : 0 ;
143+ transition : opacity $mat-transition-standard $mat-transition ;
144+ width : $button-size ;
145+
146+ @if $circle {
147+ border-radius : $button-size / 2 ;
148+ }
149+
150+ // Light theme - default
151+ & :focus ,
152+ & :hover ,
153+ & :active {
154+ opacity : $mat-icon-opacity-hover ;
155+ }
156+
157+ & :disabled {
158+ opacity : $mat-icon-opacity-disabled ;
159+ }
160+
161+ // Dark theme
162+ & .dark {
163+ opacity : $mat-icon-dark-opacity ;
164+ }
165+
166+ & .dark :focus ,
167+ & .dark :hover ,
168+ & .dark :active {
169+ opacity : $mat-icon-dark-opacity-hover ;
170+ outline : none ;
171+ }
172+
173+ & .dark :disabled {
174+ opacity : $mat-icon-dark-opacity-disabled ;
175+ }
176+ }
177+
178+ // *** Deprecated
179+ // The following functions are deprecated.
180+ // The equivalent native CSS is available in all supported browsers.
181+
182+ @mixin box-sizing ($type :border-box ) {
183+ -moz-box-sizing : $type ; // Firefox < 29
184+ box-sizing : $type ; // Chrome, IE 8+, Opera, Safari 5.1
185+ }
186+
187+ @mixin flex-block () {
188+ display : -ms-flexbox ; // IE 10
189+ display : -webkit-flex ; // Chrome
190+ display : flex ; // Spec
191+ }
192+
193+ @mixin flex-justify-start () {
194+ -ms-flex-pack : start ; // IE 10
195+ -webkit-flex-align : start ;
196+ -webkit-justify-content : flex-start ; // safari
197+ justify-content : flex-start ;
198+ }
199+
200+ @mixin flex-justify-end () {
201+ -ms-flex-pack : end ; // IE 10
202+ -webkit-flex-align : end ;
203+ -webkit-justify-content : flex-end ; // safari
204+ justify-content : flex-end ;
205+ }
206+
207+ @mixin flex-justify-center () {
208+ -ms-flex-pack : center ; // IE 10
209+ -webkit-flex-align : center ;
210+ -webkit-justify-content : center ; // safari
211+ justify-content : center ;
212+ }
213+
214+ @mixin flex-justify-space-between () {
215+ -ms-flex-pack : justify ; // IE 10
216+ -webkit-flex-align : justify ;
217+ -webkit-justify-content : space-between ; // safari
218+ justify-content : space-between ;
219+ }
220+
221+ // DOES NOT WORK IN IE 10, it is the same as 'space-between'
222+ @mixin flex-justify-space-around () {
223+ -ms-flex-pack : justify ; // IE 10
224+ -webkit-flex-align : justify ;
225+ justify-content : space-around ;
226+ }
227+
228+ @mixin flex-align-start () {
229+ -ms-flex-align : start ; // IE 10
230+ -webkit-flex-align : start ;
231+ align-items : flex-start ;
232+ }
233+
234+ @mixin flex-align-end () {
235+ -ms-flex-align : end ; // IE 10
236+ -webkit-flex-align : end ;
237+ align-items : flex-end ;
238+ }
239+
240+ @mixin flex-align-center () {
241+ -ms-flex-align : center ; // IE 10
242+ -webkit-flex-align : center ;
243+ align-items : center ;
244+ }
245+
246+ @mixin flex-align-stretch () {
247+ -ms-flex-align : stretch ; // IE 10
248+ -webkit-flex-align : stretch ;
249+ align-items : stretch ;
250+ }
251+
252+ @mixin flex-align-baseline () {
253+ -ms-flex-align : baseline ; // IE 10
254+ -webkit-flex-align : baseline ;
255+ align-items : baseline ;
256+ }
257+
258+ @mixin flex-direction ($direction ) {
259+ -ms-flex-direction : $direction ; // IE 10
260+ -webkit-flex-direction : $direction ;
261+ flex-direction : $direction ;
262+ }
263+
264+ @mixin flex-grow ($amount ) {
265+ -ms-flex-positive : $amount ; // IE 10
266+ -webkit-flex-grow : $amount ;
267+ flex-grow : $amount ;
268+ }
269+
270+ @mixin flex-shrink ($amount ) {
271+ -ms-flex-negative : $amount ; // IE 10
272+ -webkit-flex-shrink : $amount ;
273+ flex-shrink : $amount ;
274+ }
275+
276+ @mixin flex ($values ...) {
277+ -ms-flex : $values ; // IE 10
278+ -webkit-flex : $values ;
279+ flex : $values ;
280+ }
0 commit comments