-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
style.scss
452 lines (384 loc) · 9.81 KB
/
style.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
$block-editor-link-control-number-of-actions: 1;
$preview-image-height: 140px;
@keyframes loadingpulse {
0% {
opacity: 1;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.block-editor-link-control {
position: relative;
min-width: $modal-min-width;
.components-popover__content & {
min-width: auto;
width: 90vw;
max-width: $modal-min-width;
}
.show-icon-labels & {
.components-button.has-icon {
// Hide the button icons when labels are set to display...
svg {
display: none;
}
// ... and display labels.
// Uses ::before as ::after is already used for active tab styling.
&::before {
content: attr(aria-label);
}
}
}
}
// Provides positioning context for reset button. Without this then when an
// error notice is displayed the input's reset button is incorrectly positioned.
.block-editor-link-control__search-input-wrapper {
margin-bottom: $grid-unit-10;
position: relative;
}
// Provides positioning context for search actions
.block-editor-link-control__search-input-container {
position: relative;
}
// If the input doesn't have a visible label then
// we need to expand the input itself to occupy
// the full available horizontal space.
.block-editor-link-control__search-input.has-no-label .block-editor-url-input__input {
flex: 1;
}
.block-editor-link-control__field {
margin: $grid-unit-20; // allow margin collapse for vertical spacing.
input[type="text"],
// Specificity overide of URLInput defaults.
&.block-editor-url-input input[type="text"].block-editor-url-input__input {
@include input-control;
display: block;
border: 1px solid $gray-600;
border-radius: $radius-block-ui;
height: $button-size-next-default-40px; // components do not properly support unstable-large yet.
margin: 0;
padding: $grid-unit-10 $grid-unit-20;
position: relative;
width: 100%;
}
}
.block-editor-link-control__search-error {
margin: -$grid-unit-20 * 0.5 $grid-unit-20 $grid-unit-20; // negative margin to bring the error a bit closer to the button
}
.block-editor-link-control__search-actions {
display: flex;
flex-direction: row-reverse; // put "Cancel" on the left but retain DOM order.
justify-content: flex-start;
gap: $grid-unit-10;
padding: $grid-unit-10 $grid-unit-20 $grid-unit-20;
order: 20;
}
.block-editor-link-control__search-results-wrapper {
position: relative;
&::before,
&::after {
content: "";
position: absolute;
left: -1px;
right: $grid-unit-20; // avoid overlaying scrollbars
display: block;
pointer-events: none;
z-index: 100;
}
&::before {
height: $grid-unit-20 * 0.5;
top: 0;
bottom: auto;
}
&::after {
height: $grid-unit-20;
bottom: 0;
top: auto;
}
}
.block-editor-link-control__search-results {
margin-top: -$grid-unit-20;
padding: $grid-unit-10;
max-height: 200px;
overflow-y: auto; // allow results list to scroll
&.is-loading {
opacity: 0.2;
}
}
.block-editor-link-control__search-item {
&.components-button.components-menu-item__button {
height: auto;
text-align: left;
}
.components-menu-item__item {
overflow: hidden;
text-overflow: ellipsis;
// Inline block required to preserve white space
// between `<mark>` elements and text nodes.
display: inline-block;
width: 100%;
mark {
font-weight: 600;
color: inherit;
background-color: transparent;
}
}
.components-menu-item__shortcut {
color: $gray-700;
text-transform: capitalize;
white-space: nowrap; // tags shouldn't go over two lines.
}
&[aria-selected] {
background: $gray-100;
}
&.is-current {
flex-direction: column; // allow for stacking.
background: transparent;
border: 0;
width: 100%;
cursor: default;
padding: $grid-unit-20;
}
.block-editor-link-control__search-item-header {
display: block;
flex-direction: row;
align-items: flex-start;
margin-right: $grid-unit-10;
// Force text to wrap to improve UX when encountering long lines
// of text, particular those with no spaces.
// See: https://github.com/WordPress/gutenberg/issues/33586#issuecomment-888921188
white-space: pre-wrap;
overflow-wrap: break-word;
.block-editor-link-control__search-item-info {
word-break: break-all;
}
}
&.is-preview .block-editor-link-control__search-item-header {
display: flex;
flex: 1; // Fill available space.
}
&.is-error .block-editor-link-control__search-item-header {
align-items: center;
}
.block-editor-link-control__search-item-icon {
position: relative;
margin-right: $grid-unit-10;
max-height: 24px;
flex-shrink: 0;
width: 24px;
display: flex;
justify-content: center;
img {
width: 16px; // favicons often have a source of 32px
}
}
&.is-error .block-editor-link-control__search-item-icon {
top: 0;
width: 32px;
max-height: 32px;
}
.block-editor-link-control__search-item-title {
display: block;
margin-bottom: 0.2em;
font-weight: 500;
position: relative;
mark {
font-weight: 600;
color: inherit;
background-color: transparent;
}
span {
font-weight: normal;
}
svg {
display: none; // specifically requested to be removed visually as well.
}
}
.block-editor-link-control__search-item-description {
padding-top: 12px;
margin: 0;
&.is-placeholder {
margin-top: 12px;
padding-top: 0;
height: 28px;
display: flex;
flex-direction: column;
justify-content: space-around;
&::before,
&::after {
display: block;
content: "";
height: 0.7em;
width: 100%;
background-color: $gray-100;
border-radius: 3px;
}
}
.components-text {
font-size: 0.9em;
}
}
.block-editor-link-control__search-item-image {
display: flex;
width: 100%;
background-color: $gray-100;
justify-content: center;
height: $preview-image-height; // limit height
max-height: $preview-image-height; // limit height
overflow: hidden;
border-radius: 2px;
margin-top: 12px;
&.is-placeholder {
background-color: $gray-100;
border-radius: 3px;
}
img {
display: block; // remove unwanted space below image
max-width: 100%;
height: $preview-image-height; // limit height
max-height: $preview-image-height; // limit height
}
}
}
.block-editor-link-control__search-item-top {
display: flex;
flex-direction: row;
width: 100%; // clip.
}
.block-editor-link-control__search-item-bottom {
transition: opacity 1.5s;
width: 100%;
}
.block-editor-link-control__search-item.is-fetching {
.block-editor-link-control__search-item-description {
&::before,
&::after {
animation: loadingpulse 1s linear infinite;
animation-delay: 0.5s; // avoid animating for fast network responses
}
}
.block-editor-link-control__search-item-image {
animation: loadingpulse 1s linear infinite;
animation-delay: 0.5s; // avoid animating for fast network responses
}
.block-editor-link-control__search-item-icon {
svg,
img {
opacity: 0;
}
&::before {
content: "";
display: block;
background-color: $gray-100;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: 100%;
animation: loadingpulse 1s linear infinite;
animation-delay: 0.5s; // avoid animating for fast network responses
}
}
}
.block-editor-link-control__loading {
margin: $grid-unit-20; // when only loading control is shown it requires it's own spacing.
display: flex;
align-items: center;
.components-spinner {
margin-top: 0;
}
}
// Separate Create button when following other suggestions.
.components-button + .block-editor-link-control__search-create {
overflow: visible;
padding: $grid-unit-15 $grid-unit-20;
// Create fake border. We cannot use border because the button has a border
// radius applied to it
&::before {
content: "";
position: absolute;
top: -#{$block-selected-child-margin * 2};
left: 0;
display: block;
width: 100%;
}
}
.block-editor-link-control__search-create {
align-items: center; // align text with icon.
.block-editor-link-control__search-item-title {
margin-bottom: 0;
}
.block-editor-link-control__search-item-icon {
top: 0; // cancel compensatory spacing added to default suggestions.
}
}
.block-editor-link-control__drawer {
display: flex; // allow for ordering.
order: 30;
flex-direction: column;
flex-basis: 100%; // occupy full width.
}
// Inner div required to avoid padding/margin
// causing janky animation.
.block-editor-link-control__drawer-inner {
display: flex; // allow for ordering.
flex-direction: column;
flex-basis: 100%; // occupy full width.
position: relative;
}
.block-editor-link-control__unlink {
padding-left: $grid-unit-20;
padding-right: $grid-unit-20;
}
.block-editor-link-control__setting {
margin-bottom: $grid-unit-20;
flex: 1;
padding: $grid-unit-10 0 $grid-unit-10 $grid-unit-30;
// Cancel left margin inherited from WP Admin Forms CSS.
input {
margin-left: 0;
}
&.block-editor-link-control__setting:last-child {
margin-bottom: 0;
}
}
.block-editor-link-control__tools {
padding: $grid-unit-10 $grid-unit-10 0 $grid-unit-10;
margin-top: #{$grid-unit-20 * -1};
.components-button.block-editor-link-control__drawer-toggle {
padding-left: 0;
gap: 0;
// Point downwards when open (same as list view expander)
&[aria-expanded="true"] svg {
visibility: visible;
transition: transform 0.1s ease;
transform: rotate(90deg);
@include reduce-motion("transition");
}
// Point rightwards when closed (same as list view expander)
&[aria-expanded="false"] svg {
visibility: visible;
transform: rotate(0deg);
transition: transform 0.1s ease;
@include reduce-motion("transition");
}
}
}
.block-editor-link-control .block-editor-link-control__search-input .components-spinner {
display: block;
&.components-spinner { // Specificity override.
position: absolute;
left: auto;
bottom: auto;
top: calc(50% - #{$spinner-size} / 2);
right: $grid-unit-20;
}
}
.block-editor-link-control__search-item-action {
margin-left: auto; // push to far right hand side
flex-shrink: 0;
}