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

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