-
Notifications
You must be signed in to change notification settings - Fork 1
/
_tooltip.scss
145 lines (131 loc) · 2.77 KB
/
_tooltip.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
/* stylelint-disable selector-max-specificity */
@use "../design-tokens/color";
@use "../design-tokens/typography";
@use "../design-tokens/shadow";
$tooltip-arrow-size: 5px;
$tooltip-color: color.$color-grayDarker;
$tooltip-margin: 8px;
@mixin Tooltip__Container {
position: relative;
cursor: pointer;
[role='tooltip'] {
position: absolute;
bottom: 100%;
left: 50%;
margin-bottom: $tooltip-margin;
transform: translate(-50%, 0);
transform-origin: top;
opacity: 0;
transition: all 0.1s ease-in-out 0.1s;
}
&:hover {
[role='tooltip'] {
transform: translate(-50%, -4px);
opacity: 1;
}
}
}
@mixin Tooltip__Container--Down {
[role='tooltip'] {
top: 100%;
bottom: auto;
margin-top: $tooltip-margin + $tooltip-arrow-size;
transform: translate(-50%, -4px);
}
&:hover {
[role='tooltip'] {
transform: translate(-50%, 0);
}
}
}
@mixin Tooltip__Container--Left {
[role='tooltip'] {
top: 50%;
right: 100%;
bottom: auto;
left: auto;
margin-right: $tooltip-margin + $tooltip-arrow-size;
transform: translate(4px, -50%);
}
&:hover {
[role='tooltip'] {
transform: translate(0, -50%);
}
}
}
@mixin Tooltip__Container--Right {
[role='tooltip'] {
top: 50%;
bottom: auto;
left: 100%;
margin-left: $tooltip-margin + $tooltip-arrow-size;
transform: translate(-4px, -50%);
}
&:hover {
[role='tooltip'] {
transform: translate(0, -50%);
}
}
}
@mixin Tooltip {
position: relative;
padding: 8px 12px;
color: color.$color-white;
white-space: nowrap;
text-align: center;
text-indent: 0;
background: $tooltip-color;
border-radius: 4px;
box-shadow: shadow.$shadow-near;
cursor: default;
pointer-events: none;
@include typography.Typography__Caption;
&::after {
position: absolute;
top: 100%;
left: 50%;
width: 0;
height: 0;
margin-left: -$tooltip-arrow-size;
border: solid transparent;
border-color: rgba(0, 0, 0, 0);
border-width: $tooltip-arrow-size;
border-top-color: $tooltip-color;
content: '';
pointer-events: none;
}
}
@mixin Tooltip--Down {
&::after {
top: auto;
bottom: 100%;
border-color: rgba(0, 0, 0, 0);
border-bottom-color: $tooltip-color;
}
}
@mixin Tooltip--Left {
&::after {
top: 50%;
left: 100%;
margin-top: -$tooltip-arrow-size;
margin-left: 0;
border-color: rgba(0, 0, 0, 0);
border-left-color: $tooltip-color;
}
}
@mixin Tooltip--Right {
&::after {
top: 50%;
right: 100%;
left: auto;
margin-top: -$tooltip-arrow-size;
margin-left: 0;
border-color: rgba(0, 0, 0, 0);
border-right-color: $tooltip-color;
}
}
@mixin Tooltip--Large {
width: 260px;
line-height: 1.25;
white-space: normal;
}