-
Notifications
You must be signed in to change notification settings - Fork 42
/
icon.element.scss
217 lines (173 loc) · 4.19 KB
/
icon.element.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
@import './../styles/tokens/generated/index';
@import './../styles/mixins/mixins';
@mixin flipSVGIcon($direction) {
@if $direction == 'horizontal' {
transform: scale(-1) rotateX(180deg);
/* stylelint-disable */
} @else if $direction == 'vertical' {
/* stylelint-enable */
transform: scale(-1) rotateY(180deg);
}
}
:host {
--color: currentColor;
display: inline-block;
@include equilateral(#{$cds-global-space-7});
@include min-equilateral(#{$cds-global-space-7});
margin: 0;
vertical-align: middle;
fill: var(--color);
color: var(--color); // See https://github.com/vmware/clarity/issues/5332
contain: strict;
cursor: inherit;
}
svg {
display: block;
}
// sizing
:host([size*='xs']) {
@include equilateral(#{$cds-global-space-5});
@include min-equilateral(#{$cds-global-space-5});
}
:host([size*='sm']) {
// weirdly, the default... 16px
@include equilateral(#{$cds-global-space-7});
@include min-equilateral(#{$cds-global-space-7});
}
:host([size*='md']) {
// 24px
@include equilateral(#{$cds-global-space-9});
@include min-equilateral(#{$cds-global-space-9});
}
:host([size*='lg']) {
// 36px
@include equilateral(#{$cds-global-space-11});
@include min-equilateral(#{$cds-global-space-11});
}
// note: the selectors for `xl` and `xxl` work as expected due to the order in
// which they are listed here. this is fine and expected for CSS. just know
// that if their order is switched around, they will break.
// likewise if we add an `xxs` it will have to go AFTER `xs`!
:host([size*='xl']) {
// 48px
@include equilateral(#{$cds-global-space-12});
@include min-equilateral(#{$cds-global-space-12});
}
:host([size*='xxl']) {
// 64px
@include equilateral(calc(#{$cds-global-space-13} - #{$cds-global-space-5}));
@include min-equilateral(calc(#{$cds-global-space-13} - #{$cds-global-space-5}));
}
:host([size*='fit']) {
height: auto;
width: auto;
contain: layout;
}
// colors
:host([status='success']) {
--color: #{$cds-alias-status-success};
}
:host([status='danger']) {
--color: #{$cds-alias-status-danger};
}
:host([status='warning']) {
--color: #{$cds-alias-status-warning-dark};
}
:host([status='info']) {
--color: #{$cds-alias-status-info-shade};
}
:host([inverse]) {
--color: #{$cds-global-color-construction-200};
}
// directional
:host([direction='up']) {
transform: rotate(0deg);
}
:host([direction='down']) {
transform: rotate(180deg);
}
:host([direction='right']) {
transform: rotate(90deg);
}
:host([direction='left']) {
transform: rotate(270deg);
}
:host([flip='horizontal']) {
@include flipSVGIcon('horizontal');
}
:host([flip='vertical']) {
@include flipSVGIcon('vertical');
}
.badge,
.alert {
fill: var(--badge-color, #{$cds-alias-status-danger});
}
// variant badge colors
:host([badge='success']) {
--badge-color: #{$cds-alias-status-success};
}
:host([badge='danger']) {
--badge-color: #{$cds-alias-status-danger};
}
:host([badge*='warning']) {
--badge-color: #{$cds-alias-status-warning-dark};
}
:host([badge='inherit']) {
--badge-color: currentColor;
}
:host([badge='info']) {
--badge-color: #{$cds-alias-status-info};
}
// alert colors
:host([badge='inherit-triangle']) {
--badge-color: currentColor;
}
// inverse + variants
:host([badge][inverse]) {
--badge-color: #{$cds-alias-status-danger};
}
// variant badge colors
:host([badge='success'][inverse]) {
--badge-color: #{$cds-alias-status-success};
}
:host([badge*='warning'][inverse]) {
--badge-color: #{$cds-alias-status-warning-dark};
}
:host([badge*='inherit'][inverse]) {
--badge-color: currentColor;
}
:host([badge='info'][inverse]) {
--badge-color: #{$cds-alias-status-info};
}
// unknown icon animation
.cds-internal-dot-1 {
animation: fadeInAndOut 1.8s ease-in 0s infinite;
}
.cds-internal-dot-2 {
animation: fadeInAndOut 1.8s ease-out 0.422s infinite;
}
.cds-internal-dot-3 {
animation: fadeInAndOut 1.8s ease-out 0.675s infinite;
}
@keyframes fadeInAndOut {
0% {
opacity: 0;
}
75% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@media (prefers-reduced-motion) {
.cds-internal-dot-1 {
animation: none;
}
.cds-internal-dot-2 {
animation: none;
}
.cds-internal-dot-3 {
animation: none;
}
}