UNPKG

3.3 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// Selector '.mdc-*' should only be used in this project.
24// stylelint-disable selector-class-pattern
25
26@use '@material/feature-targeting/feature-targeting';
27@use '@material/rtl/mixins' as rtl-mixins;
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 // stylelint-disable-next-line selector-max-type
50 > label {
51 @include feature-targeting.targets($feat-structure) {
52 @include rtl-mixins.reflexive-property(margin, 0, auto);
53 @include rtl-mixins.reflexive-property(
54 padding,
55 variables.$item-spacing,
56 0
57 );
58
59 order: 0;
60 }
61 }
62 }
63
64 .mdc-form-field--nowrap {
65 > label {
66 @include feature-targeting.targets($feat-structure) {
67 text-overflow: ellipsis;
68 overflow: hidden;
69 white-space: nowrap;
70 }
71 }
72 }
73
74 .mdc-form-field--align-end {
75 // stylelint-disable-next-line selector-max-type
76 > label {
77 @include feature-targeting.targets($feat-structure) {
78 @include rtl-mixins.reflexive-property(margin, auto, 0);
79 @include rtl-mixins.reflexive-property(
80 padding,
81 0,
82 variables.$item-spacing
83 );
84
85 order: -1;
86 }
87 }
88 }
89
90 .mdc-form-field--space-between {
91 @include feature-targeting.targets($feat-structure) {
92 justify-content: space-between;
93 }
94
95 // stylelint-disable-next-line selector-max-type
96 > label {
97 @include feature-targeting.targets($feat-structure) {
98 margin: 0;
99
100 @include rtl-mixins.rtl {
101 // RTL needed for specificity
102 margin: 0;
103 }
104 }
105 }
106 }
107}