@anyblades/blades 2.4.7 → 2.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -28
- package/blades.gemspec +1 -1
- package/css/blades.css +35 -62
- package/css/blades.standalone.core.css +35 -61
- package/css/blades.standalone.css +36 -67
- package/css/blades.standalone.theme.css +1 -5
- package/css/float-label.core.css +12 -12
- package/css/float-label.css +12 -12
- package/css/link-icon.css +6 -6
- package/package.json +1 -1
- package/src/_layout.css +2 -10
- package/src/_utilities.css +3 -4
- package/src/blades.standalone.core.css +2 -0
- package/src/blades.standalone.theme.css +1 -5
- package/src/components/_timeline.css +0 -1
- package/src/content/_code.css +3 -7
- package/src/content/_table.css +4 -7
- package/src/content/_typography.css +3 -10
- package/src/float-label.core.css +12 -12
- package/src/link-icon.css +2 -2
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
/*\3c !--section:code-->```css */
|
|
2
|
+
|
|
1
3
|
/* Follows https://github.com/picocss/pico/blob/main/scss/_index.scss */
|
|
2
4
|
|
|
3
5
|
/* Layout */
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
\3c !--section:docs,columns-->
|
|
7
|
-
|
|
8
|
-
### Auto-columns
|
|
7
|
+
/*\3c !--section:columns-->
|
|
9
8
|
|
|
10
9
|
`.columns` automatically creates columns with at least 30 characters each:
|
|
11
10
|
|
|
@@ -36,10 +35,7 @@ How it works:
|
|
|
36
35
|
break-inside: avoid;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
\3c !--section:docs,jump-->
|
|
41
|
-
|
|
42
|
-
### Jump to top
|
|
38
|
+
/*```\3c !--section:jump-->
|
|
43
39
|
|
|
44
40
|
`data-jump-to="top"` fixes element to the corner and adds extra top padding to make it easy to click:
|
|
45
41
|
```css */
|
|
@@ -51,9 +47,6 @@ How it works:
|
|
|
51
47
|
padding-top: 50vh;
|
|
52
48
|
}
|
|
53
49
|
|
|
54
|
-
/*```
|
|
55
|
-
\3c !--section--> */
|
|
56
|
-
|
|
57
50
|
/*
|
|
58
51
|
\3c !--section:code-->
|
|
59
52
|
```css */
|
|
@@ -199,15 +192,12 @@ Or anything else:
|
|
|
199
192
|
|
|
200
193
|
/* Content */
|
|
201
194
|
|
|
202
|
-
|
|
203
|
-
\3c !--section:docs,h-anchor-->
|
|
204
|
-
|
|
205
|
-
### Heading anchors
|
|
195
|
+
/*\3c !--section:h-anchor-->
|
|
206
196
|
|
|
207
197
|
Links with `href="#..."` inside headings are automatically displayed as anchors:
|
|
208
198
|
|
|
209
199
|
<article>
|
|
210
|
-
<h2 style="margin: 0 0 0 1.5rem">Heading with anchor <a
|
|
200
|
+
<h2 style="margin: 0 0 0 1.5rem">Heading with anchor <a aria-hidden="true" style="visibility: visible">#</a></h2>
|
|
211
201
|
</article>
|
|
212
202
|
|
|
213
203
|
How it works:
|
|
@@ -243,9 +233,7 @@ h1 a[aria-hidden="true"], h2 a[aria-hidden="true"], h3 a[aria-hidden="true"], h4
|
|
|
243
233
|
|
|
244
234
|
**PRO** example of automatic anchors for `11ty`+`markdown-it-anchor`: https://github.com/anyblades/eleventy-blades/blob/main/src/eleventy.config.js
|
|
245
235
|
|
|
246
|
-
\3c !--section:
|
|
247
|
-
|
|
248
|
-
### List markers
|
|
236
|
+
\3c !--section:list-->
|
|
249
237
|
|
|
250
238
|
Customize markers using inline `style="--list-marker:..."` on `<ul>/<ol>` or even individual `<li>`:
|
|
251
239
|
|
|
@@ -340,23 +328,20 @@ ul.unlist > li, ul.unlist-all > li, .unlist-all ul > li, ol.unlist > li, ol.unli
|
|
|
340
328
|
list-style: none;
|
|
341
329
|
}
|
|
342
330
|
|
|
343
|
-
/*```
|
|
344
|
-
\3c !--section--> */
|
|
345
|
-
|
|
346
331
|
/* Extends https://github.com/picocss/pico/blob/main/scss/content/_link.scss
|
|
347
332
|
\3c !--section:code-->
|
|
348
333
|
```css */
|
|
349
334
|
|
|
350
335
|
/* Use inline flex only if link contains an icon */
|
|
351
336
|
|
|
352
|
-
a:
|
|
337
|
+
a:not(.does-not-exist):has(> i) {
|
|
353
338
|
display: inline-flex;
|
|
354
339
|
overflow-y: clip; /* to work in pair with text-underline-offset in Safari */
|
|
355
340
|
gap: 0.375ch; /* =3/8 */
|
|
356
341
|
text-wrap: balance;
|
|
357
342
|
}
|
|
358
343
|
|
|
359
|
-
a > i {
|
|
344
|
+
a:not(.does-not-exist) > i {
|
|
360
345
|
float: left; /* ✅ Chrome ❌ Safari */
|
|
361
346
|
font-style: normal;
|
|
362
347
|
text-underline-offset: -2em; /* ❌ Chrome ✅ Safari - to clip it with overflow-y */
|
|
@@ -364,22 +349,22 @@ a > i {
|
|
|
364
349
|
|
|
365
350
|
/* Favicons */
|
|
366
351
|
|
|
367
|
-
a > i > img {
|
|
352
|
+
a:not(.does-not-exist) > i > img {
|
|
368
353
|
display: inline-block; /* for Tailwind CSS Typography */
|
|
369
354
|
max-width: none; /* to keep ratio safe */
|
|
370
355
|
height: 1.25em;
|
|
371
356
|
margin-block-start: calc(-0.25em / 2);
|
|
372
357
|
}
|
|
373
358
|
|
|
374
|
-
a > i[class^="fa-"],
|
|
375
|
-
a > i[class*=" fa-"] {
|
|
359
|
+
a:not(.does-not-exist) > i[class^="fa-"],
|
|
360
|
+
a:not(.does-not-exist) > i[class*=" fa-"] {
|
|
376
361
|
line-height: inherit;
|
|
377
362
|
--fa-width: auto;
|
|
378
363
|
}
|
|
379
364
|
|
|
380
365
|
/* Font Awesome */
|
|
381
366
|
|
|
382
|
-
a > i.fa-lg {
|
|
367
|
+
a:not(.does-not-exist) > i.fa-lg {
|
|
383
368
|
line-height: normal;
|
|
384
369
|
}
|
|
385
370
|
|
|
@@ -412,10 +397,9 @@ How we made it: https://codepen.io/editor/anydigital/pen/019d2b94-5616-75dc-a23e
|
|
|
412
397
|
|
|
413
398
|
\3c !--section--> */
|
|
414
399
|
|
|
415
|
-
|
|
416
|
-
\3c !--section:docs-->
|
|
400
|
+
/*\3c !--section:docs-->
|
|
417
401
|
|
|
418
|
-
|
|
402
|
+
## Column expanders
|
|
419
403
|
|
|
420
404
|
Place `<hr>` element inside `<th>` column to expand it horizontally:
|
|
421
405
|
|
|
@@ -452,7 +436,7 @@ th hr.x2 {
|
|
|
452
436
|
|
|
453
437
|
/*```
|
|
454
438
|
|
|
455
|
-
|
|
439
|
+
## Borderless table
|
|
456
440
|
|
|
457
441
|
`.borderless` removes all default borders:
|
|
458
442
|
|
|
@@ -465,9 +449,7 @@ th hr.x2 {
|
|
|
465
449
|
{.borderless}
|
|
466
450
|
</article>
|
|
467
451
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
\3c !--section--> */
|
|
452
|
+
\3c !--section-->*/
|
|
471
453
|
|
|
472
454
|
table.borderless th,
|
|
473
455
|
table.borderless td {
|
|
@@ -535,10 +517,7 @@ Living examples: \3c !--A-Z-->
|
|
|
535
517
|
|
|
536
518
|
\3c !--section--> */
|
|
537
519
|
|
|
538
|
-
|
|
539
|
-
\3c !--section:docs-->
|
|
540
|
-
|
|
541
|
-
### Code
|
|
520
|
+
/*\3c !--section:docs-->
|
|
542
521
|
|
|
543
522
|
The `<pre><code>` blocks are Prism-compatible and support captions via `data-caption="..."` attribute:
|
|
544
523
|
|
|
@@ -548,7 +527,8 @@ The `<pre><code>` blocks are Prism-compatible and support captions via `data-cap
|
|
|
548
527
|
├── blades.theme.css # minimal opinionated theme
|
|
549
528
|
└── blades.css # above two together
|
|
550
529
|
```
|
|
551
|
-
|
|
530
|
+
|
|
531
|
+
\3c !--section:code-->
|
|
552
532
|
```css */
|
|
553
533
|
|
|
554
534
|
@media (width < 768px) {
|
|
@@ -568,17 +548,15 @@ code[data-caption]::before {
|
|
|
568
548
|
opacity: 50%;
|
|
569
549
|
}
|
|
570
550
|
|
|
571
|
-
/*```
|
|
572
|
-
\3c !--section--> */
|
|
573
|
-
|
|
574
551
|
/* Forms */
|
|
575
552
|
|
|
576
|
-
/*
|
|
553
|
+
/* Sources moved here from https://github.com/anyblades/float-label-css for easier maintenance
|
|
577
554
|
\3c !--section:docs-->
|
|
578
555
|
|
|
579
556
|
First, we target either:
|
|
580
557
|
1. `<label>` which `:has` inner form inputs (classless approach)
|
|
581
558
|
2. or explicit `.has-float-label` class (explicit approach)
|
|
559
|
+
|
|
582
560
|
```css */
|
|
583
561
|
|
|
584
562
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select),
|
|
@@ -587,10 +565,9 @@ label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"
|
|
|
587
565
|
position: relative;
|
|
588
566
|
}
|
|
589
567
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
```css */
|
|
568
|
+
/*```
|
|
569
|
+
Then, we define the default/fallback state (when the float label should be minimized):
|
|
570
|
+
```css */
|
|
594
571
|
|
|
595
572
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) > span,
|
|
596
573
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) label,
|
|
@@ -603,10 +580,9 @@ label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"
|
|
|
603
580
|
cursor: text;
|
|
604
581
|
}
|
|
605
582
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
```css */
|
|
583
|
+
/*```
|
|
584
|
+
Finally, we detect if placeholder is shown, but not in focus. That means we can safely hide it, and enlarge the float label instead:
|
|
585
|
+
```css */
|
|
610
586
|
|
|
611
587
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) *:placeholder-shown:not(:focus)::-moz-placeholder, .has-float-label *:placeholder-shown:not(:focus)::-moz-placeholder {
|
|
612
588
|
opacity: 0;
|
|
@@ -633,12 +609,13 @@ label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"
|
|
|
633
609
|
opacity: 50%;
|
|
634
610
|
}
|
|
635
611
|
|
|
636
|
-
|
|
637
|
-
|
|
612
|
+
/*```
|
|
613
|
+
|
|
638
614
|
The `:has(*:placeholder-shown:not(:focus))` trick allows this input state information to *propagate* to the parent level. This enables modern CSS to target inner float label (`<span>` or `<label>`) regardless of its position relative to the input field.
|
|
639
615
|
|
|
640
616
|
Historically, this was not possible: the float label had to be placed after the input field to be targeted using the `input:focus + label` selector.
|
|
641
|
-
|
|
617
|
+
|
|
618
|
+
\3c !--section-->*/
|
|
642
619
|
|
|
643
620
|
/* Components */
|
|
644
621
|
|
|
@@ -665,14 +642,11 @@ dl.timeline dd, .has-timeline > dl dd {
|
|
|
665
642
|
border-inline-start: 0.25rem solid gray;
|
|
666
643
|
}
|
|
667
644
|
|
|
668
|
-
/*```*/
|
|
669
|
-
|
|
670
645
|
/* Utilities */
|
|
671
646
|
|
|
672
|
-
|
|
673
|
-
\3c !--section:docs-->
|
|
647
|
+
/*\3c !--section:docs-->
|
|
674
648
|
|
|
675
|
-
|
|
649
|
+
## Auto-dark
|
|
676
650
|
|
|
677
651
|
`.dark-auto` automatically creates a simple dark version of any element:
|
|
678
652
|
|
|
@@ -709,7 +683,7 @@ How it works:
|
|
|
709
683
|
|
|
710
684
|
/*```
|
|
711
685
|
|
|
712
|
-
|
|
686
|
+
## Faded
|
|
713
687
|
|
|
714
688
|
`.faded` reduces the opacity of an element:
|
|
715
689
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
/*\3c !--section:code-->```css */
|
|
2
|
+
|
|
1
3
|
/* Follows https://github.com/picocss/pico/blob/main/scss/_index.scss */
|
|
2
4
|
|
|
3
5
|
/* Layout */
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
\3c !--section:docs,columns-->
|
|
7
|
-
|
|
8
|
-
### Auto-columns
|
|
7
|
+
/*\3c !--section:columns-->
|
|
9
8
|
|
|
10
9
|
`.columns` automatically creates columns with at least 30 characters each:
|
|
11
10
|
|
|
@@ -36,10 +35,7 @@ How it works:
|
|
|
36
35
|
break-inside: avoid;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
\3c !--section:docs,jump-->
|
|
41
|
-
|
|
42
|
-
### Jump to top
|
|
38
|
+
/*```\3c !--section:jump-->
|
|
43
39
|
|
|
44
40
|
`data-jump-to="top"` fixes element to the corner and adds extra top padding to make it easy to click:
|
|
45
41
|
```css */
|
|
@@ -51,9 +47,6 @@ How it works:
|
|
|
51
47
|
padding-top: 50vh;
|
|
52
48
|
}
|
|
53
49
|
|
|
54
|
-
/*```
|
|
55
|
-
\3c !--section--> */
|
|
56
|
-
|
|
57
50
|
/*
|
|
58
51
|
\3c !--section:code-->
|
|
59
52
|
```css */
|
|
@@ -199,15 +192,12 @@ Or anything else:
|
|
|
199
192
|
|
|
200
193
|
/* Content */
|
|
201
194
|
|
|
202
|
-
|
|
203
|
-
\3c !--section:docs,h-anchor-->
|
|
204
|
-
|
|
205
|
-
### Heading anchors
|
|
195
|
+
/*\3c !--section:h-anchor-->
|
|
206
196
|
|
|
207
197
|
Links with `href="#..."` inside headings are automatically displayed as anchors:
|
|
208
198
|
|
|
209
199
|
<article>
|
|
210
|
-
<h2 style="margin: 0 0 0 1.5rem">Heading with anchor <a
|
|
200
|
+
<h2 style="margin: 0 0 0 1.5rem">Heading with anchor <a aria-hidden="true" style="visibility: visible">#</a></h2>
|
|
211
201
|
</article>
|
|
212
202
|
|
|
213
203
|
How it works:
|
|
@@ -243,9 +233,7 @@ h1 a[aria-hidden="true"], h2 a[aria-hidden="true"], h3 a[aria-hidden="true"], h4
|
|
|
243
233
|
|
|
244
234
|
**PRO** example of automatic anchors for `11ty`+`markdown-it-anchor`: https://github.com/anyblades/eleventy-blades/blob/main/src/eleventy.config.js
|
|
245
235
|
|
|
246
|
-
\3c !--section:
|
|
247
|
-
|
|
248
|
-
### List markers
|
|
236
|
+
\3c !--section:list-->
|
|
249
237
|
|
|
250
238
|
Customize markers using inline `style="--list-marker:..."` on `<ul>/<ol>` or even individual `<li>`:
|
|
251
239
|
|
|
@@ -340,23 +328,20 @@ ul.unlist > li, ul.unlist-all > li, .unlist-all ul > li, ol.unlist > li, ol.unli
|
|
|
340
328
|
list-style: none;
|
|
341
329
|
}
|
|
342
330
|
|
|
343
|
-
/*```
|
|
344
|
-
\3c !--section--> */
|
|
345
|
-
|
|
346
331
|
/* Extends https://github.com/picocss/pico/blob/main/scss/content/_link.scss
|
|
347
332
|
\3c !--section:code-->
|
|
348
333
|
```css */
|
|
349
334
|
|
|
350
335
|
/* Use inline flex only if link contains an icon */
|
|
351
336
|
|
|
352
|
-
a:
|
|
337
|
+
a:not(.does-not-exist):has(> i) {
|
|
353
338
|
display: inline-flex;
|
|
354
339
|
overflow-y: clip; /* to work in pair with text-underline-offset in Safari */
|
|
355
340
|
gap: 0.375ch; /* =3/8 */
|
|
356
341
|
text-wrap: balance;
|
|
357
342
|
}
|
|
358
343
|
|
|
359
|
-
a > i {
|
|
344
|
+
a:not(.does-not-exist) > i {
|
|
360
345
|
float: left; /* ✅ Chrome ❌ Safari */
|
|
361
346
|
font-style: normal;
|
|
362
347
|
text-underline-offset: -2em; /* ❌ Chrome ✅ Safari - to clip it with overflow-y */
|
|
@@ -364,22 +349,22 @@ a > i {
|
|
|
364
349
|
|
|
365
350
|
/* Favicons */
|
|
366
351
|
|
|
367
|
-
a > i > img {
|
|
352
|
+
a:not(.does-not-exist) > i > img {
|
|
368
353
|
display: inline-block; /* for Tailwind CSS Typography */
|
|
369
354
|
max-width: none; /* to keep ratio safe */
|
|
370
355
|
height: 1.25em;
|
|
371
356
|
margin-block-start: calc(-0.25em / 2);
|
|
372
357
|
}
|
|
373
358
|
|
|
374
|
-
a > i[class^="fa-"],
|
|
375
|
-
a > i[class*=" fa-"] {
|
|
359
|
+
a:not(.does-not-exist) > i[class^="fa-"],
|
|
360
|
+
a:not(.does-not-exist) > i[class*=" fa-"] {
|
|
376
361
|
line-height: inherit;
|
|
377
362
|
--fa-width: auto;
|
|
378
363
|
}
|
|
379
364
|
|
|
380
365
|
/* Font Awesome */
|
|
381
366
|
|
|
382
|
-
a > i.fa-lg {
|
|
367
|
+
a:not(.does-not-exist) > i.fa-lg {
|
|
383
368
|
line-height: normal;
|
|
384
369
|
}
|
|
385
370
|
|
|
@@ -412,10 +397,9 @@ How we made it: https://codepen.io/editor/anydigital/pen/019d2b94-5616-75dc-a23e
|
|
|
412
397
|
|
|
413
398
|
\3c !--section--> */
|
|
414
399
|
|
|
415
|
-
|
|
416
|
-
\3c !--section:docs-->
|
|
400
|
+
/*\3c !--section:docs-->
|
|
417
401
|
|
|
418
|
-
|
|
402
|
+
## Column expanders
|
|
419
403
|
|
|
420
404
|
Place `<hr>` element inside `<th>` column to expand it horizontally:
|
|
421
405
|
|
|
@@ -452,7 +436,7 @@ th hr.x2 {
|
|
|
452
436
|
|
|
453
437
|
/*```
|
|
454
438
|
|
|
455
|
-
|
|
439
|
+
## Borderless table
|
|
456
440
|
|
|
457
441
|
`.borderless` removes all default borders:
|
|
458
442
|
|
|
@@ -465,9 +449,7 @@ th hr.x2 {
|
|
|
465
449
|
{.borderless}
|
|
466
450
|
</article>
|
|
467
451
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
\3c !--section--> */
|
|
452
|
+
\3c !--section-->*/
|
|
471
453
|
|
|
472
454
|
table.borderless th,
|
|
473
455
|
table.borderless td {
|
|
@@ -535,10 +517,7 @@ Living examples: \3c !--A-Z-->
|
|
|
535
517
|
|
|
536
518
|
\3c !--section--> */
|
|
537
519
|
|
|
538
|
-
|
|
539
|
-
\3c !--section:docs-->
|
|
540
|
-
|
|
541
|
-
### Code
|
|
520
|
+
/*\3c !--section:docs-->
|
|
542
521
|
|
|
543
522
|
The `<pre><code>` blocks are Prism-compatible and support captions via `data-caption="..."` attribute:
|
|
544
523
|
|
|
@@ -548,7 +527,8 @@ The `<pre><code>` blocks are Prism-compatible and support captions via `data-cap
|
|
|
548
527
|
├── blades.theme.css # minimal opinionated theme
|
|
549
528
|
└── blades.css # above two together
|
|
550
529
|
```
|
|
551
|
-
|
|
530
|
+
|
|
531
|
+
\3c !--section:code-->
|
|
552
532
|
```css */
|
|
553
533
|
|
|
554
534
|
@media (width < 768px) {
|
|
@@ -568,17 +548,15 @@ code[data-caption]::before {
|
|
|
568
548
|
opacity: 50%;
|
|
569
549
|
}
|
|
570
550
|
|
|
571
|
-
/*```
|
|
572
|
-
\3c !--section--> */
|
|
573
|
-
|
|
574
551
|
/* Forms */
|
|
575
552
|
|
|
576
|
-
/*
|
|
553
|
+
/* Sources moved here from https://github.com/anyblades/float-label-css for easier maintenance
|
|
577
554
|
\3c !--section:docs-->
|
|
578
555
|
|
|
579
556
|
First, we target either:
|
|
580
557
|
1. `<label>` which `:has` inner form inputs (classless approach)
|
|
581
558
|
2. or explicit `.has-float-label` class (explicit approach)
|
|
559
|
+
|
|
582
560
|
```css */
|
|
583
561
|
|
|
584
562
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select),
|
|
@@ -587,10 +565,9 @@ label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"
|
|
|
587
565
|
position: relative;
|
|
588
566
|
}
|
|
589
567
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
```css */
|
|
568
|
+
/*```
|
|
569
|
+
Then, we define the default/fallback state (when the float label should be minimized):
|
|
570
|
+
```css */
|
|
594
571
|
|
|
595
572
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) > span,
|
|
596
573
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) label,
|
|
@@ -603,10 +580,9 @@ label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"
|
|
|
603
580
|
cursor: text;
|
|
604
581
|
}
|
|
605
582
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
```css */
|
|
583
|
+
/*```
|
|
584
|
+
Finally, we detect if placeholder is shown, but not in focus. That means we can safely hide it, and enlarge the float label instead:
|
|
585
|
+
```css */
|
|
610
586
|
|
|
611
587
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) *:placeholder-shown:not(:focus)::-moz-placeholder, .has-float-label *:placeholder-shown:not(:focus)::-moz-placeholder {
|
|
612
588
|
opacity: 0;
|
|
@@ -633,12 +609,13 @@ label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"
|
|
|
633
609
|
opacity: 50%;
|
|
634
610
|
}
|
|
635
611
|
|
|
636
|
-
|
|
637
|
-
|
|
612
|
+
/*```
|
|
613
|
+
|
|
638
614
|
The `:has(*:placeholder-shown:not(:focus))` trick allows this input state information to *propagate* to the parent level. This enables modern CSS to target inner float label (`<span>` or `<label>`) regardless of its position relative to the input field.
|
|
639
615
|
|
|
640
616
|
Historically, this was not possible: the float label had to be placed after the input field to be targeted using the `input:focus + label` selector.
|
|
641
|
-
|
|
617
|
+
|
|
618
|
+
\3c !--section-->*/
|
|
642
619
|
|
|
643
620
|
/* Components */
|
|
644
621
|
|
|
@@ -665,14 +642,11 @@ dl.timeline dd, .has-timeline > dl dd {
|
|
|
665
642
|
border-inline-start: 0.25rem solid gray;
|
|
666
643
|
}
|
|
667
644
|
|
|
668
|
-
/*```*/
|
|
669
|
-
|
|
670
645
|
/* Utilities */
|
|
671
646
|
|
|
672
|
-
|
|
673
|
-
\3c !--section:docs-->
|
|
647
|
+
/*\3c !--section:docs-->
|
|
674
648
|
|
|
675
|
-
|
|
649
|
+
## Auto-dark
|
|
676
650
|
|
|
677
651
|
`.dark-auto` automatically creates a simple dark version of any element:
|
|
678
652
|
|
|
@@ -709,7 +683,7 @@ How it works:
|
|
|
709
683
|
|
|
710
684
|
/*```
|
|
711
685
|
|
|
712
|
-
|
|
686
|
+
## Faded
|
|
713
687
|
|
|
714
688
|
`.faded` reduces the opacity of an element:
|
|
715
689
|
|
|
@@ -737,9 +711,7 @@ How it works:
|
|
|
737
711
|
filter: invert(1) !important;
|
|
738
712
|
}
|
|
739
713
|
|
|
740
|
-
|
|
741
|
-
\3c !--section:code-->
|
|
742
|
-
```css */
|
|
714
|
+
/*\3c !--section:code-->```css */
|
|
743
715
|
|
|
744
716
|
/* Default/fallback state */
|
|
745
717
|
|
|
@@ -913,6 +885,3 @@ table pre {
|
|
|
913
885
|
.faded a {
|
|
914
886
|
text-decoration-style: dotted;
|
|
915
887
|
}
|
|
916
|
-
|
|
917
|
-
/*```
|
|
918
|
-
\3c !--section--> */
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
\3c !--section:code-->
|
|
3
|
-
```css */
|
|
1
|
+
/*\3c !--section:code-->```css */
|
|
4
2
|
/* Default/fallback state */
|
|
5
3
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) > span,
|
|
6
4
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) label,
|
|
@@ -143,5 +141,3 @@ table pre {
|
|
|
143
141
|
.faded a {
|
|
144
142
|
text-decoration-style: dotted;
|
|
145
143
|
}
|
|
146
|
-
/*```
|
|
147
|
-
\3c !--section--> */
|
package/css/float-label.core.css
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* Sources moved here from https://github.com/anyblades/float-label-css for easier maintenance
|
|
2
2
|
\3c !--section:docs-->
|
|
3
3
|
|
|
4
4
|
First, we target either:
|
|
5
5
|
1. `<label>` which `:has` inner form inputs (classless approach)
|
|
6
6
|
2. or explicit `.has-float-label` class (explicit approach)
|
|
7
|
+
|
|
7
8
|
```css */
|
|
8
9
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select),
|
|
9
10
|
.has-float-label {
|
|
10
11
|
display: block;
|
|
11
12
|
position: relative;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
```css */
|
|
14
|
+
/*```
|
|
15
|
+
Then, we define the default/fallback state (when the float label should be minimized):
|
|
16
|
+
```css */
|
|
17
17
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) > span,
|
|
18
18
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) label,
|
|
19
19
|
.has-float-label > span,
|
|
@@ -24,10 +24,9 @@ label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"
|
|
|
24
24
|
font-size: 75%;
|
|
25
25
|
cursor: text;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
```css */
|
|
27
|
+
/*```
|
|
28
|
+
Finally, we detect if placeholder is shown, but not in focus. That means we can safely hide it, and enlarge the float label instead:
|
|
29
|
+
```css */
|
|
31
30
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) *:placeholder-shown:not(:focus)::-moz-placeholder, .has-float-label *:placeholder-shown:not(:focus)::-moz-placeholder {
|
|
32
31
|
opacity: 0;
|
|
33
32
|
}
|
|
@@ -48,9 +47,10 @@ label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"
|
|
|
48
47
|
font-size: inherit;
|
|
49
48
|
opacity: 50%;
|
|
50
49
|
}
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
/*```
|
|
51
|
+
|
|
53
52
|
The `:has(*:placeholder-shown:not(:focus))` trick allows this input state information to *propagate* to the parent level. This enables modern CSS to target inner float label (`<span>` or `<label>`) regardless of its position relative to the input field.
|
|
54
53
|
|
|
55
54
|
Historically, this was not possible: the float label had to be placed after the input field to be targeted using the `input:focus + label` selector.
|
|
56
|
-
|
|
55
|
+
|
|
56
|
+
\3c !--section-->*/
|
package/css/float-label.css
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/* Float Label CSS v2.0.0-alpha */
|
|
2
|
-
/*
|
|
2
|
+
/* Sources moved here from https://github.com/anyblades/float-label-css for easier maintenance
|
|
3
3
|
\3c !--section:docs-->
|
|
4
4
|
|
|
5
5
|
First, we target either:
|
|
6
6
|
1. `<label>` which `:has` inner form inputs (classless approach)
|
|
7
7
|
2. or explicit `.has-float-label` class (explicit approach)
|
|
8
|
+
|
|
8
9
|
```css */
|
|
9
10
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select),
|
|
10
11
|
.has-float-label {
|
|
11
12
|
display: block;
|
|
12
13
|
position: relative;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```css */
|
|
15
|
+
/*```
|
|
16
|
+
Then, we define the default/fallback state (when the float label should be minimized):
|
|
17
|
+
```css */
|
|
18
18
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) > span,
|
|
19
19
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) label,
|
|
20
20
|
.has-float-label > span,
|
|
@@ -25,10 +25,9 @@ label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"
|
|
|
25
25
|
font-size: 75%;
|
|
26
26
|
cursor: text;
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```css */
|
|
28
|
+
/*```
|
|
29
|
+
Finally, we detect if placeholder is shown, but not in focus. That means we can safely hide it, and enlarge the float label instead:
|
|
30
|
+
```css */
|
|
32
31
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) *:placeholder-shown:not(:focus)::-moz-placeholder, .has-float-label *:placeholder-shown:not(:focus)::-moz-placeholder {
|
|
33
32
|
opacity: 0;
|
|
34
33
|
}
|
|
@@ -49,12 +48,13 @@ label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"
|
|
|
49
48
|
font-size: inherit;
|
|
50
49
|
opacity: 50%;
|
|
51
50
|
}
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
/*```
|
|
52
|
+
|
|
54
53
|
The `:has(*:placeholder-shown:not(:focus))` trick allows this input state information to *propagate* to the parent level. This enables modern CSS to target inner float label (`<span>` or `<label>`) regardless of its position relative to the input field.
|
|
55
54
|
|
|
56
55
|
Historically, this was not possible: the float label had to be placed after the input field to be targeted using the `input:focus + label` selector.
|
|
57
|
-
|
|
56
|
+
|
|
57
|
+
\3c !--section-->*/
|
|
58
58
|
/* Default/fallback state */
|
|
59
59
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) > span,
|
|
60
60
|
label:has(> span):has(input:not([type="checkbox"], [type="radio"], [type="range"]), textarea, select) label,
|