PluginProbe
Code Snippets / 4.0.0-beta.1
Code Snippets v4.0.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 4.0.0-beta.1, at css/common/_tooltips.scss

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