PluginProbe
Code Snippets / 3.10.0
Code Snippets v3.10.0
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 3.0.1 All 64 releases
code-snippets / css / common / _tooltips.scss

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

207 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 $bg-color: rgb(19 18 18 / 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: rgb(19 18 18 / 90%);
61 color: #fff;
62 border-radius: 6px;
63 position: absolute;
64 font-size: 12px;
65 font-weight: normal;
66 text-transform: none;
67 inline-size: max-content;
68 max-inline-size: 200px;
69 backdrop-filter: blur(3px);
70
71 .tooltip-block & {
72 margin-inline-start: -80px;
73 }
74
75 .tooltip-inline & {
76 margin-inline-start: 0;
77 margin-block-end: -16px;
78 }
79
80 .tooltip-inline.tooltip-start & {
81 inset-block-start: -50%;
82 }
83 }
84
85 .tooltip-block.tooltip-start {
86 &::before {
87 margin-inline-start: -6px;
88 margin-block-end: -12px;
89 border-block-start-color: $bg-color;
90 }
91
92 &::before, .tooltip-content {
93 inset-block-end: 100%;
94 inset-inline-start: 50%;
95 }
96 }
97
98 .tooltip-block.tooltip-end {
99 &::before {
100 margin-block: -12px 0;
101 border-block-start-color: transparent;
102 border-block-end-color: $bg-color;
103 }
104
105 &::before, .tooltip-content {
106 inset-block: 100% auto;
107 margin-inline-start: 25%;
108 }
109
110 .tooltip-content {
111 inset-inline-end: -70%;
112 }
113 }
114
115 .tooltip-inline.tooltip-start {
116 &::before {
117 inset-block-end: 50%;
118 margin-inline: 0 -12px;
119 margin-block-end: 0;
120 border-block-start-color: transparent;
121 border-inline-start-color: $bg-color;
122 }
123
124 &::before, .tooltip-content {
125 inset-inline: auto 100%;
126 }
127 }
128
129 .tooltip-inline.tooltip-end {
130 &::before {
131 margin-block-end: 0;
132 margin-inline-start: -12px;
133 border-block-start-color: transparent;
134 border-inline-end-color: $bg-color;
135 }
136
137 &::before, .tooltip-content {
138 inset-inline-start: 100%;
139 }
140
141 .tooltip-content {
142 inset-block-start: -50%;
143 }
144 }
145
146 .tooltip:hover,
147 .tooltip:focus,
148 .tooltip:focus-within {
149 &::before, .tooltip-content {
150 visibility: visible;
151 opacity: 1;
152 }
153 }
154
155 .tooltip-block.tooltip-start:hover,
156 .tooltip-block.tooltip-start:focus,
157 .tooltip-block.tooltip-start:focus-within {
158 &::before, .tooltip-content {
159 transform: translateY(-10px);
160 }
161 }
162
163 .tooltip-block.tooltip-end:hover,
164 .tooltip-block.tooltip-end:focus,
165 .tooltip-block.tooltip-end:focus-within {
166 &::before, .tooltip-content {
167 transform: translateY(10px);
168 }
169 }
170
171 .tooltip-inline.tooltip-end:hover,
172 .tooltip-inline.tooltip-end:focus,
173 .tooltip-inline.tooltip-end:focus-within {
174 &::before, .tooltip-content {
175 transform: translateX(calc(10px * var(--cs-direction-multiplier)));
176 }
177 }
178
179 .tooltip-inline.tooltip-start:hover,
180 .tooltip-inline.tooltip-start:focus,
181 .tooltip-inline.tooltip-start:focus-within {
182 &::before, .tooltip-content {
183 transform: translateX(calc(-10px * var(--cs-direction-multiplier)));
184 }
185 }
186
187
188 .help-tooltip {
189 cursor: help !important;
190
191 .tooltip-trigger {
192 cursor: help;
193 }
194
195 .dashicons {
196 color: lightslategrey;
197 }
198
199 &.badge {
200 display: inline-flex;
201
202 .dashicons {
203 color: inherit;
204 }
205 }
206 }
207