UNPKG

5.01 kBSCSSView Raw
1@charset "UTF-8";
2// tag mixins
3// --------------------------------------------------
4
5@mixin tag-group-margin($margin) {
6 margin-right: $margin;
7 margin-bottom: $margin;
8}
9
10@mixin tag-size(
11 $height,
12 $lineHeight,
13 $borderWidth,
14 $paddingLr,
15 $fontSize,
16 $iconSize,
17 $minWidth,
18 $spacing
19) {
20 height: $height;
21 padding: 0;
22 line-height: calc(#{$height} - #{$borderWidth} * 2);
23 font-size: 0;
24
25 > .#{$css-prefix}tag-body {
26 font-size: $fontSize;
27 padding: 0 $paddingLr;
28 min-width: $minWidth;
29 }
30
31 &.#{$css-prefix}tag-closable > .#{$css-prefix}tag-body {
32 padding: 0 0 0 $paddingLr;
33 max-width: calc(100% - (#{$spacing} + #{$iconSize} + #{$paddingLr}));
34 }
35 &[dir=rtl].#{$css-prefix}tag-closable > .#{$css-prefix}tag-body {
36 padding: 0 $paddingLr 0 0;
37 }
38
39 &.#{$css-prefix}tag-closable > .#{$css-prefix}tag-close-btn {
40 margin-left: $spacing;
41 padding-right: $paddingLr;
42 .#{$css-prefix}icon {
43 @include icon-size($iconSize);
44 }
45 }
46 &[dir=rtl] > .#{$css-prefix}tag-close-btn {
47 margin-right: $spacing;
48 margin-left: 0;
49 padding-right: 0;
50 padding-left: $paddingLr;
51 }
52}
53
54@mixin tag-statement(
55 $textColor,
56 $borderColor,
57 $bgColor,
58 $textColorHover,
59 $borderColorHover: "",
60 $bgColorHover: "",
61 $tailColor: "",
62 $tailColorHover: "",
63 $tailColorDisabled: "",
64 $textColorDisabled: "",
65 $borderColorDisabled: "",
66 $bgColorDisabled: ""
67) {
68 color: $textColor;
69 border-color: $borderColor;
70 background-color: $bgColor;
71
72 &:not(.disabled):not([disabled]):hover,
73 &:not(.disabled):not([disabled]).hover {
74 color: $textColorHover;
75
76 @if get-compiling-value($borderColorHover) != "" {
77 border-color: $borderColorHover;
78 }
79 @if get-compiling-value($bgColorHover) != "" {
80 background-color: $bgColorHover;
81 }
82
83 @if get-compiling-value($tailColorHover) != "" {
84 > .#{$css-prefix}tag-close-btn {
85 color: $tailColorHover;
86 }
87 }
88 }
89
90 &[disabled],
91 &.disabled {
92 @if get-compiling-value($tailColorDisabled) != "" {
93 > .#{$css-prefix}tag-close-btn {
94 color: $tailColorDisabled;
95 }
96 }
97
98 @if get-compiling-value($textColorDisabled) != "" {
99 color: $textColorDisabled;
100 }
101
102 @if get-compiling-value($borderColorDisabled) != "" {
103 border-color: $borderColorDisabled;
104 }
105
106 @if get-compiling-value($bgColorDisabled) != "" {
107 background-color: $bgColorDisabled;
108 }
109 }
110
111 > .#{$css-prefix}tag-close-btn {
112 @if get-compiling-value($tailColor) != "" {
113 color: $tailColor;
114 }
115 }
116}
117
118@mixin tail-hover-animation() {
119 transform: rotate(90deg);
120 transform-origin: 50% 50%;
121 backface-visibility: hidden;
122}
123
124// for virtual btn
125@mixin tick-bg-size($size) {
126 right: calc(0px - #{$size} / 2);
127 bottom: calc(0px - #{$size} / 2);
128 width: $size;
129 height: $size;
130}
131
132// checkable tag tick
133@mixin checkable-tag-tick-size($tick-bg-size, $tick-size) {
134 &:before {
135 right: calc(0px - #{$tick-bg-size} / 2);
136 bottom: calc(0px - #{$tick-bg-size} / 2);
137 width: $tick-bg-size;
138 height: $tick-bg-size;
139 }
140
141 &:after {
142 font-size: $tick-size;
143 line-height: $tick-size;
144 right: 0;
145 bottom: 0;
146 }
147}
148
149@mixin tag-checked-tick(
150 $tick-icon,
151 $tick-icon-color,
152 $tick-icon-hover-color,
153 $tick-icon-disabled-color,
154 $tick-bg,
155 $tick-bg-hover,
156 $tick-bg-disabled
157) {
158 &:before {
159 position: absolute;
160 content: "";
161 -webkit-font-smoothing: antialiased;
162 background-color: $tick-bg;
163 transform: rotate(45deg);
164 }
165
166 &:after {
167 position: absolute;
168 font-family: $icon-font-family;
169 -webkit-font-smoothing: antialiased;
170 content: $tick-icon;
171 transform: scale(.6);
172 color: $tick-icon-color;
173 }
174
175 &:not(.disabled):not([disabled]):hover,
176 &:not(.disabled):not([disabled]).hover {
177 &:before {
178 background-color: $tick-bg-hover;
179 }
180
181 &:after {
182 color: $tick-icon-hover-color;
183 }
184 }
185
186 &[disabled],
187 &:disabled {
188 &:before {
189 background-color: $tick-bg-disabled;
190 }
191
192 &:after {
193 color: $tick-icon-disabled-color;
194 }
195 }
196}
197
198@mixin placeholder-full {
199 position: absolute;
200 display: block;
201 top: 0;
202 left: 0;
203 right: 0;
204 bottom: 0;
205}
206
207@mixin tag-preset-color($name, $color) {
208 &-#{$name} {
209 background-color: $color;
210 border-color: $color;
211 color: #FFF;
212
213 &-inverse {
214 background-color: rgba(get-compiling-value($color), .25);
215 border-color: $color;
216 color: $color;
217 }
218 }
219}