PluginProbe
Code Snippets / 3.10.0-beta.1
Code Snippets v3.10.0-beta.1
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
code-snippets / css / common / _tooltips.scss

_tooltips.scss in Code Snippets 3.10.0-beta.1, at css/common/_tooltips.scss

206 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 $bg-color: hsl(0deg 0% 20% / 90%);
2
3 .tooltip {
4 position: relative;
5 display: inline-block;
6 }
7
8 .tooltip-trigger {
9 display: inline-flex;
10 align-items: center;
11 background: transparent;
12 padding: 0;
13 margin: 0;
14 border: 0;
15 border-radius: 50%;
16 color: inherit;
17 font: inherit;
18
19 &:hover,
20 &:focus {
21 box-shadow: none;
22 }
23
24 &:focus-visible {
25 outline: 2px solid #2271b1;
26 outline-offset: 2px;
27 }
28 }
29
30 .tooltip::before,
31 .tooltip-content {
32 position: absolute;
33 visibility: hidden;
34 opacity: 0;
35 transition: opacity 0.2s ease-in-out,
36 visibility 0.2s ease-in-out,
37 transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
38 transform: translate3d(0, 0, 0);
39 pointer-events: none;
40
41 @media (prefers-reduced-motion: reduce) {
42 transition-duration: 0.01s;
43 }
44 }
45
46 .tooltip::before {
47 z-index: 1001;
48 border: 6px solid transparent;
49 background: transparent;
50 content: "";
51 }
52
53 .tooltip-inline::before {
54 inset-block-start: 4px;
55 }
56
57 .tooltip-content {
58 z-index: 1000;
59 padding: 8px;
60 background-color: $bg-color;
61 color: #fff;
62 border-radius: 6px;
63 position: absolute;
64 font-size: small;
65 font-weight: normal;
66 text-transform: none;
67 min-inline-size: 200px;
68 backdrop-filter: blur(3px);
69
70 .tooltip-block & {
71 margin-inline-start: -80px;
72 }
73
74 .tooltip-inline & {
75 margin-inline-start: 0;
76 margin-block-end: -16px;
77 }
78
79 .tooltip-inline.tooltip-start & {
80 inset-block-start: -50%;
81 }
82 }
83
84 .tooltip-block.tooltip-start {
85 &::before {
86 margin-inline-start: -6px;
87 margin-block-end: -12px;
88 border-block-start-color: $bg-color;
89 }
90
91 &::before, .tooltip-content {
92 inset-block-end: 100%;
93 inset-inline-start: 50%;
94 }
95 }
96
97 .tooltip-block.tooltip-end {
98 &::before {
99 margin-block: -12px 0;
100 border-block-start-color: transparent;
101 border-block-end-color: $bg-color;
102 }
103
104 &::before, .tooltip-content {
105 inset-block: 100% auto;
106 margin-inline-start: 25%;
107 }
108
109 .tooltip-content {
110 inset-inline-end: -70%;
111 }
112 }
113
114 .tooltip-inline.tooltip-start {
115 &::before {
116 inset-block-end: 50%;
117 margin-inline: 0 -12px;
118 margin-block-end: 0;
119 border-block-start-color: transparent;
120 border-inline-start-color: $bg-color;
121 }
122
123 &::before, .tooltip-content {
124 inset-inline: auto 100%;
125 }
126 }
127
128 .tooltip-inline.tooltip-end {
129 &::before {
130 margin-block-end: 0;
131 margin-inline-start: -12px;
132 border-block-start-color: transparent;
133 border-inline-end-color: $bg-color;
134 }
135
136 &::before, .tooltip-content {
137 inset-inline-start: 100%;
138 }
139
140 .tooltip-content {
141 inset-block-start: -50%;
142 }
143 }
144
145 .tooltip:hover,
146 .tooltip:focus,
147 .tooltip:focus-within {
148 &::before, .tooltip-content {
149 visibility: visible;
150 opacity: 1;
151 }
152 }
153
154 .tooltip-block.tooltip-start:hover,
155 .tooltip-block.tooltip-start:focus,
156 .tooltip-block.tooltip-start:focus-within {
157 &::before, .tooltip-content {
158 transform: translateY(-10px);
159 }
160 }
161
162 .tooltip-block.tooltip-end:hover,
163 .tooltip-block.tooltip-end:focus,
164 .tooltip-block.tooltip-end:focus-within {
165 &::before, .tooltip-content {
166 transform: translateY(10px);
167 }
168 }
169
170 .tooltip-inline.tooltip-end:hover,
171 .tooltip-inline.tooltip-end:focus,
172 .tooltip-inline.tooltip-end:focus-within {
173 &::before, .tooltip-content {
174 transform: translateX(calc(10px * var(--cs-direction-multiplier)));
175 }
176 }
177
178 .tooltip-inline.tooltip-start:hover,
179 .tooltip-inline.tooltip-start:focus,
180 .tooltip-inline.tooltip-start:focus-within {
181 &::before, .tooltip-content {
182 transform: translateX(calc(-10px * var(--cs-direction-multiplier)));
183 }
184 }
185
186
187 .help-tooltip {
188 cursor: help !important;
189
190 .tooltip-trigger {
191 cursor: help;
192 }
193
194 .dashicons {
195 color: lightslategrey;
196 }
197
198 &.badge {
199 display: inline-flex;
200
201 .dashicons {
202 color: inherit;
203 }
204 }
205 }
206