UNPKG

4.63 kBSCSSView Raw
1//
2// Copyright IBM Corp. 2016, 2018
3//
4// This source code is licensed under the Apache-2.0 license found in the
5// LICENSE file in the root directory of this source tree.
6//
7
8@import '../../globals/scss/functions';
9@import '../../globals/scss/vars';
10@import '../../globals/scss/helper-mixins';
11@import '../../globals/scss/typography';
12@import '../../globals/scss/vendor/@carbon/elements/scss/import-once/import-once';
13@import 'mixins';
14
15@mixin tags {
16 .#{$prefix}--tag {
17 @include font-family;
18 @include typescale('omega');
19 display: inline-flex;
20 align-items: center;
21 padding: 0 $spacing-xs;
22 height: 1.25rem;
23 margin: $spacing-3xs;
24 border-radius: rem(15px);
25
26 &:not(:first-child) {
27 margin-left: 0;
28 }
29 }
30
31 .#{$prefix}--tag--ibm {
32 @include tag-theme($color__blue-10, $color__blue-60);
33 }
34
35 .#{$prefix}--tag--beta {
36 @include tag-theme($color__gray-1, $color__navy-gray-4);
37 }
38
39 .#{$prefix}--tag--third-party {
40 @include tag-theme($color__teal-10, $color__teal-60);
41 }
42
43 .#{$prefix}--tag--local,
44 .#{$prefix}--tag--dedicated,
45 .#{$prefix}--tag--custom {
46 @include tag-theme($color__purple-10, $color__purple-60);
47 }
48
49 .#{$prefix}--tag--experimental {
50 @include tag-theme($color__orange-10, $color__orange-60);
51 }
52
53 .#{$prefix}--tag--community {
54 @include tag-theme($color__green-10, $color__green-60);
55 }
56
57 .#{$prefix}--tag--private {
58 @include tag-theme($color__yellow-10, $color__yellow-60);
59 }
60
61 // tags used for filtering
62 .#{$prefix}--tag--filter {
63 @include tag-theme($brand-01, white);
64 cursor: pointer;
65 }
66
67 .#{$prefix}--tag--filter > svg {
68 fill: white;
69 width: 0.5rem;
70 height: 0.5rem;
71 margin-left: rem(5px);
72 }
73
74 .#{$prefix}--tag--filter:focus,
75 .#{$prefix}--tag--filter:hover {
76 background-color: $hover-primary;
77 outline: none;
78 }
79
80 // Skeleton state
81 .#{$prefix}--tag.#{$prefix}--skeleton {
82 @include tag-theme($color__gray-1, $color__navy-gray-4);
83 width: rem(60px);
84
85 &:after {
86 @include skeleton;
87 content: '';
88 height: rem(6px);
89 width: 100%;
90 }
91 }
92}
93
94@mixin tags--x {
95 .#{$prefix}--tag {
96 @include type-style('label-01');
97 display: inline-flex;
98 align-items: center;
99 padding: 0 $carbon--spacing-03;
100 height: 1.5rem;
101 margin: $carbon--spacing-02;
102 border-radius: rem(15px);
103
104 &:not(:first-child) {
105 margin-left: 0;
106 }
107
108 &.#{$prefix}--skeleton {
109 @include tag-theme--x($bg-color: $ui-03, $text-color: $text-01);
110 }
111 }
112
113 .#{$prefix}--tag--red {
114 @include tag-theme--x($ibm-color__red-20, $ibm-color__red-70);
115 }
116
117 .#{$prefix}--tag--magenta {
118 @include tag-theme--x($ibm-color__magenta-20, $ibm-color__magenta-70);
119 }
120
121 .#{$prefix}--tag--purple {
122 @include tag-theme--x($ibm-color__purple-20, $ibm-color__purple-70);
123 }
124
125 .#{$prefix}--tag--blue {
126 @include tag-theme--x($ibm-color__blue-20, $ibm-color__blue-70);
127 }
128
129 .#{$prefix}--tag--cyan {
130 @include tag-theme--x($ibm-color__cyan-20, $ibm-color__cyan-70);
131 }
132
133 .#{$prefix}--tag--teal {
134 @include tag-theme--x($ibm-color__teal-20, $ibm-color__teal-70);
135 }
136
137 .#{$prefix}--tag--green {
138 @include tag-theme--x($ibm-color__green-20, $ibm-color__green-70);
139 }
140
141 .#{$prefix}--tag--gray {
142 @include tag-theme--x($ibm-color__gray-20, $ibm-color__gray-100);
143 }
144
145 .#{$prefix}--tag--cool-gray {
146 @include tag-theme--x($ibm-color__cool-gray-20, $ibm-color__cool-gray-100);
147 }
148
149 .#{$prefix}--tag--warm-gray {
150 @include tag-theme--x($ibm-color__warm-gray-20, $ibm-color__warm-gray-100);
151 }
152
153 .#{$prefix}--tag--disabled {
154 @include tag-theme--x($ibm-color__gray-10, $ibm-color__gray-30);
155
156 &:hover {
157 cursor: not-allowed;
158 }
159 }
160
161 // tags used for filtering
162 .#{$prefix}--tag--filter {
163 @include tag-theme--x($interactive-02, $inverse-01);
164 cursor: pointer;
165 padding-right: rem(2px); // Align with hover circle of X button
166 }
167
168 .#{$prefix}--tag--filter > svg {
169 fill: $inverse-01;
170 margin-left: rem(4px);
171 padding: rem(2px);
172 width: rem(20px);
173 height: rem(20px);
174 }
175
176 .#{$prefix}--tag--filter > svg:hover {
177 border-radius: 50%;
178 background-color: $icon-02;
179 }
180
181 .#{$prefix}--tag--filter:focus,
182 .#{$prefix}--tag--filter:hover {
183 outline: none;
184 }
185
186 // Skeleton state
187 .#{$prefix}--tag.#{$prefix}--skeleton {
188 width: rem(60px);
189
190 &:after {
191 @include skeleton;
192 content: '';
193 height: rem(6px);
194 width: 100%;
195 }
196 }
197}
198
199@include exports('tags') {
200 @if feature-flag-enabled('components-x') {
201 @include tags--x;
202 } @else {
203 @include tags;
204 }
205}