UNPKG

3.01 kBSCSSView Raw
1//
2// Copyright 2019 Google Inc.
3//
4// Permission is hereby granted, free of charge, to any person obtaining a copy
5// of this software and associated documentation files (the "Software"), to deal
6// in the Software without restriction, including without limitation the rights
7// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8// copies of the Software, and to permit persons to whom the Software is
9// furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20// THE SOFTWARE.
21//
22
23// stylelint-disable selector-class-pattern --
24// Selector '.mdc-*' should only be used in this project.
25
26@use '@material/feature-targeting/feature-targeting';
27@use '@material/rtl/rtl';
28@use '@material/theme/theme';
29@use '@material/typography/typography';
30@use './variables';
31
32@mixin core-styles($query: feature-targeting.all()) {
33 $feat-color: feature-targeting.create-target($query, color);
34 $feat-structure: feature-targeting.create-target($query, structure);
35
36 .mdc-form-field {
37 @include typography.typography(body2, $query);
38
39 @include feature-targeting.targets($feat-color) {
40 @include theme.property(color, text-primary-on-background);
41 }
42
43 @include feature-targeting.targets($feat-structure) {
44 display: inline-flex;
45 align-items: center;
46 vertical-align: middle;
47 }
48
49 > label {
50 @include feature-targeting.targets($feat-structure) {
51 @include rtl.reflexive-property(margin, 0, auto);
52 @include rtl.reflexive-property(padding, variables.$item-spacing, 0);
53
54 order: 0;
55 }
56 }
57 }
58
59 .mdc-form-field--nowrap {
60 > label {
61 @include feature-targeting.targets($feat-structure) {
62 text-overflow: ellipsis;
63 overflow: hidden;
64 white-space: nowrap;
65 }
66 }
67 }
68
69 .mdc-form-field--align-end {
70 > label {
71 @include feature-targeting.targets($feat-structure) {
72 @include rtl.reflexive-property(margin, auto, 0);
73 @include rtl.reflexive-property(padding, 0, variables.$item-spacing);
74
75 order: -1;
76 }
77 }
78 }
79
80 .mdc-form-field--space-between {
81 @include feature-targeting.targets($feat-structure) {
82 justify-content: space-between;
83 }
84
85 > label {
86 @include feature-targeting.targets($feat-structure) {
87 margin: 0;
88
89 @include rtl.rtl {
90 // RTL needed for specificity
91 margin: 0;
92 }
93 }
94 }
95 }
96}