-
Notifications
You must be signed in to change notification settings - Fork 134
Expand file tree
/
Copy path_legend_item.scss
More file actions
177 lines (149 loc) · 3.88 KB
/
_legend_item.scss
File metadata and controls
177 lines (149 loc) · 3.88 KB
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
@import '../mixins';
$legendItemVerticalPadding: $echLegendRowGap / 2;
$legendItemHeight: #{$euiFontSizeXS * $euiLineHeight};
.echLegendItem {
color: $euiTextColor;
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
align-items: flex-start;
position: relative;
// wrapper is needed to isolate color icon when wrapped or not
.echLegend__colorWrapper > *:first-of-type {
// euiPopover adds a div with height of 19px otherwise
// this prevents color dot from shifting when wrapped
height: $legendItemHeight;
}
&:not([dir='rtl']) > *:not(.background) {
margin-left: $euiSizeXS;
&:last-child:not(.echLegendItem__legendValue) {
margin-right: $euiSizeXS;
}
}
&[dir='rtl'] > *:not(.background) {
margin-right: $euiSizeXS;
&:last-child:not(.echLegendItem__legendValue) {
margin-left: $euiSizeXS;
}
}
&:not(&--hidden) {
.echLegendItem__color--changable {
cursor: pointer;
}
}
&:hover .background {
background-color: $euiColorLightestShade;
}
.background {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
}
&__action {
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
height: $legendItemHeight;
max-width: calc(#{$legendItemHeight} + #{$euiSizeXS * 2});
.euiPopover,
.euiPopover__anchor,
.euiPopover__anchor > *:first-child {
// makes custom buttons in eui popover take full action size
height: 100%;
width: 100%;
display: flex;
}
}
&--actionOnHover {
.echLegendItem__action {
opacity: 0;
// Not using pointer-events: none here because it causes a rendering
// bug in Firefox. See https://github.com/elastic/elastic-charts/pull/2773#discussion_r2792933172
}
&:hover,
&:focus-within {
.echLegendItem__action {
opacity: 1;
pointer-events: auto;
}
}
}
&--isActive {
.echLegendItem__action {
opacity: 1;
pointer-events: auto;
}
}
&__color {
display: flex;
line-height: 1.5;
align-items: center;
}
&__label {
@include euiFontSizeXS;
flex: 1 1 auto;
text-align: left;
vertical-align: baseline;
letter-spacing: unset;
align-items: center;
@include wrapText;
&--singleline {
@include resetWrapText;
@include euiTextTruncate;
// When using middle truncation, JS handles the ellipsis. `clip` will disable euiTextTruncate
&--middle {
text-overflow: clip;
}
}
// div to prevent changing to button
&--multiline:is(div) {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2; // number of lines to show, overridden in element styles
}
// When using middle truncation, JS handles the ellipsis so disable CSS line-clamp truncation
&--multiline--middle:is(div) {
-webkit-line-clamp: none; // Disable CSS truncation, JS handles it
line-break: anywhere; // Allow breaking at any point for accurate text fitting
word-break: break-all; // Fallback for older browsers
}
&--clickable:hover {
cursor: pointer;
text-decoration: underline;
}
}
&__legendValue {
@include euiFontSizeXS;
text-align: right;
flex: 0 0 auto;
margin-left: $euiSizeXS;
font-feature-settings: 'tnum';
letter-spacing: unset;
direction: ltr;
}
&--vertical {
padding-top: $legendItemVerticalPadding / 2;
padding-bottom: $legendItemVerticalPadding / 2;
&:first-of-type {
margin-top: $legendItemVerticalPadding / 2;
}
.background {
margin-top: $legendItemVerticalPadding / 2;
margin-bottom: $legendItemVerticalPadding / 2;
}
}
&--hidden {
color: $euiColorDarkShade;
}
&[dir='rtl'] {
.echLegendItem {
&__label {
text-align: right;
}
}
}
}